ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
Athena_test::normal_distribution< T > Class Template Reference

#include <random.h>

Collaboration diagram for Athena_test::normal_distribution< T >:

Public Member Functions

 normal_distribution (T mu, T s)
 
operator() (URNG &rng) const
 

Private Attributes

m_mu
 
m_s
 

Detailed Description

template<class T>
class Athena_test::normal_distribution< T >

Definition at line 101 of file random.h.

Constructor & Destructor Documentation

◆ normal_distribution()

template<class T >
Athena_test::normal_distribution< T >::normal_distribution ( mu,
s 
)
inline

Definition at line 104 of file random.h.

104 : m_mu(mu), m_s(s) {}

Member Function Documentation

◆ operator()()

template<class T >
T Athena_test::normal_distribution< T >::operator() ( URNG rng) const

Definition at line 114 of file random.h.

115 {
116  // Stamdard Box-Muller transform a la Numerical Recipes, except that for simplicity
117  // i don't try to remember the second generated number between calls. I don't
118  // really care about performance here.
119  T v1, v2, r2;
120  do {
121  v1 = 2*(static_cast<T>(rng()) / URNG::max())-1;
122  v2 = 2*(static_cast<T>(rng()) / URNG::max())-1;
123  r2 = v1*v1 + v2*v2;
124  } while (r2 >= 1);
125 
126  T fac = sqrt(-2*log(r2) / r2);
127  return v1*fac*m_s + m_mu;
128 }

Member Data Documentation

◆ m_mu

template<class T >
T Athena_test::normal_distribution< T >::m_mu
private

Definition at line 108 of file random.h.

◆ m_s

template<class T >
T Athena_test::normal_distribution< T >::m_s
private

Definition at line 109 of file random.h.


The documentation for this class was generated from the following file:
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
MCP::ScaleSmearParam::r2
@ r2
D3PDTest::rng
uint32_t rng()
Definition: FillerAlg.cxx:40
Athena_test::URNG::max
static constexpr result_type max()
Definition: random.h:82
Athena_test::normal_distribution::m_mu
T m_mu
Definition: random.h:108
ReadCellNoiseFromCoolCompare.v2
v2
Definition: ReadCellNoiseFromCoolCompare.py:364
Athena_test::normal_distribution::m_s
T m_s
Definition: random.h:109
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35