g4tools  5.4.0
Public Member Functions | Protected Attributes | List of all members
tools::rgauss< FLAT, REAL > Class Template Reference

Public Member Functions

 rgauss (FLAT &a_flat, REAL a_mean=0, REAL a_std_dev=1)
 
virtual ~rgauss ()
 
 rgauss (const rgauss &a_from)
 
rgaussoperator= (const rgauss &a_from)
 
REAL shoot (math_func a_sqrt, math_func a_log) const
 
FLAT & flat ()
 
void set_seed (unsigned int a_seed)
 
void set (REAL a_mean=0, REAL a_std_dev=1)
 

Protected Attributes

FLAT & m_flat
 
REAL m_mean
 
REAL m_std_dev
 

Detailed Description

template<class FLAT, class REAL>
class tools::rgauss< FLAT, REAL >

Definition at line 10 of file randT.

Constructor & Destructor Documentation

◆ rgauss() [1/2]

template<class FLAT , class REAL >
tools::rgauss< FLAT, REAL >::rgauss ( FLAT &  a_flat,
REAL  a_mean = 0,
REAL  a_std_dev = 1 
)
inline

Definition at line 15 of file randT.

16  :m_flat(a_flat),m_mean(a_mean),m_std_dev(a_std_dev){}

◆ ~rgauss()

template<class FLAT , class REAL >
virtual tools::rgauss< FLAT, REAL >::~rgauss ( )
inlinevirtual

Definition at line 17 of file randT.

17 {}

◆ rgauss() [2/2]

template<class FLAT , class REAL >
tools::rgauss< FLAT, REAL >::rgauss ( const rgauss< FLAT, REAL > &  a_from)
inline

Definition at line 19 of file randT.

19 :m_flat(a_from.m_flat),m_mean(a_from.m_mean),m_std_dev(a_from.m_std_dev){}

Member Function Documentation

◆ flat()

template<class FLAT , class REAL >
FLAT& tools::rgauss< FLAT, REAL >::flat ( )
inline

Definition at line 36 of file randT.

36 {return m_flat;}

◆ operator=()

template<class FLAT , class REAL >
rgauss& tools::rgauss< FLAT, REAL >::operator= ( const rgauss< FLAT, REAL > &  a_from)
inline

Definition at line 20 of file randT.

20  {
21  m_mean = a_from.m_mean;
22  m_std_dev = a_from.m_std_dev;
23  return *this;
24  }

◆ set()

template<class FLAT , class REAL >
void tools::rgauss< FLAT, REAL >::set ( REAL  a_mean = 0,
REAL  a_std_dev = 1 
)
inline

Definition at line 38 of file randT.

38 {m_mean = a_mean;m_std_dev = a_std_dev;}

◆ set_seed()

template<class FLAT , class REAL >
void tools::rgauss< FLAT, REAL >::set_seed ( unsigned int  a_seed)
inline

Definition at line 37 of file randT.

37 {m_flat.set_seed(a_seed);}

◆ shoot()

template<class FLAT , class REAL >
REAL tools::rgauss< FLAT, REAL >::shoot ( math_func  a_sqrt,
math_func  a_log 
) const
inline

Definition at line 26 of file randT.

26  {
27  REAL v1,v2,r,fac;
28  do {
29  v1 = REAL(2) * m_flat.shoot() - REAL(1);
30  v2 = REAL(2) * m_flat.shoot() - REAL(1);
31  r = v1*v1 + v2*v2;
32  } while (r>REAL(1));
33  fac = a_sqrt(-REAL(2)*a_log(r)/r);
34  return (v2 * fac) * m_std_dev + m_mean;
35  }

Member Data Documentation

◆ m_flat

template<class FLAT , class REAL >
FLAT& tools::rgauss< FLAT, REAL >::m_flat
protected

Definition at line 40 of file randT.

◆ m_mean

template<class FLAT , class REAL >
REAL tools::rgauss< FLAT, REAL >::m_mean
protected

Definition at line 41 of file randT.

◆ m_std_dev

template<class FLAT , class REAL >
REAL tools::rgauss< FLAT, REAL >::m_std_dev
protected

Definition at line 42 of file randT.


The documentation for this class was generated from the following file:
tools::rgauss::m_flat
FLAT & m_flat
Definition: randT:40
tools::rgauss::m_mean
REAL m_mean
Definition: randT:41
tools::rgauss::m_std_dev
REAL m_std_dev
Definition: randT:42