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

Public Member Functions

 rdir2 (FLAT &a_flat)
 
virtual ~rdir2 ()
 
 rdir2 (const rdir2 &a_from)
 
rdir2operator= (const rdir2 &)
 
void shoot (REAL &a_x, REAL &a_y) const
 
FLAT & flat ()
 
void set_seed (unsigned int a_seed)
 

Protected Attributes

FLAT & m_flat
 

Detailed Description

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

Definition at line 96 of file randT.

Constructor & Destructor Documentation

◆ rdir2() [1/2]

template<class FLAT , class REAL >
tools::rdir2< FLAT, REAL >::rdir2 ( FLAT &  a_flat)
inline

Definition at line 98 of file randT.

98 :m_flat(a_flat){}

◆ ~rdir2()

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

Definition at line 99 of file randT.

99 {}

◆ rdir2() [2/2]

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

Definition at line 101 of file randT.

101 :m_flat(a_from.m_flat){}

Member Function Documentation

◆ flat()

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

Definition at line 116 of file randT.

116 {return m_flat;}

◆ operator=()

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

Definition at line 102 of file randT.

102 {return *this;}

◆ set_seed()

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

Definition at line 117 of file randT.

117 {m_flat.set_seed(a_seed);}

◆ shoot()

template<class FLAT , class REAL >
void tools::rdir2< FLAT, REAL >::shoot ( REAL &  a_x,
REAL &  a_y 
) const
inline

Definition at line 104 of file randT.

104  {
105  // from gsl_ran_dir_2d.
106  REAL u,v,s;
107  do {
108  u = REAL(2) * m_flat.shoot()-REAL(1);
109  v = REAL(2) * m_flat.shoot()-REAL(1);
110  s = u * u + v * v;
111  }
112  while ( (s > REAL(1)) || (s==REAL(0)) );
113  a_x = (u * u - v * v) / s;
114  a_y = REAL(2) * u * v / s;
115  }

Member Data Documentation

◆ m_flat

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

Definition at line 119 of file randT.


The documentation for this class was generated from the following file:
tools::rdir2::m_flat
FLAT & m_flat
Definition: randT:119