g4tools  5.4.0
randd
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
2 // See the file tools.license for terms.
3 
4 #ifndef tools_randd
5 #define tools_randd
6 
7 #include "randT"
8 #include "rtausmed"
9 
10 #include "S_STRING"
11 #include "scast"
12 
13 namespace tools {
14 
15 class irandd {
16 public:
17  virtual ~irandd() {}
18 public:
19  virtual void* cast(const std::string&) const = 0;
20 public:
21  virtual double shootd() const = 0;
22 };
23 
24 class rbinomiald : public virtual irandd, public rbinomial<rtausmed,double,unsigned int> {
26 public:
28 public:
29  virtual void* cast(const std::string& a_class) const {
30  if(void* p = cmp_cast<rbinomiald>(this,a_class)) return p;
31  return 0;
32  }
33  virtual double shootd() const {return shoot();}
34 public:
35  rbinomiald(unsigned int a_n = 1,double a_p = 0.5):parent(m_flat,a_n,a_p),m_flat(){}
36  virtual ~rbinomiald(){}
37 public:
38  rbinomiald(const rbinomiald& a_from):irandd(a_from),parent(m_flat),m_flat(a_from.m_flat){}
39  rbinomiald& operator=(const rbinomiald& a_from) {
40  parent::operator=(a_from);
41  m_flat = a_from.m_flat;
42  return *this;
43  }
44 protected:
46 };
47 
48 class rgaussd : public virtual irandd, public rgauss<rtausmed,double> {
50 public:
52 public:
53  virtual void* cast(const std::string& a_class) const {
54  if(void* p = cmp_cast<rgaussd>(this,a_class)) return p;
55  return 0;
56  }
57  virtual double shootd() const {return shoot();}
58 public:
59  rgaussd(double a_mean = 0,double a_std_dev = 1):parent(m_flat,a_mean,a_std_dev),m_flat(){}
60  virtual ~rgaussd(){}
61 public:
62  rgaussd(const rgaussd& a_from):irandd(a_from),parent(m_flat),m_flat(a_from.m_flat){}
63  rgaussd& operator=(const rgaussd& a_from) {
64  parent::operator=(a_from);
65  m_flat = a_from.m_flat;
66  return *this;
67  }
68 public:
69  double shoot() const {return parent::shoot(::sqrt,::log);}
70 protected:
72 };
73 
74 class rexpd : public virtual irandd, public rexp<rtausmed,double> {
76 public:
78 public:
79  virtual void* cast(const std::string& a_class) const {
80  if(void* p = cmp_cast<rexpd>(this,a_class)) return p;
81  return 0;
82  }
83  virtual double shootd() const {return shoot();}
84 public:
85  rexpd(double a_rate = 1):parent(m_flat,a_rate),m_flat(){}
86  virtual ~rexpd(){}
87 public:
88  rexpd(const rexpd& a_from):irandd(a_from),parent(m_flat),m_flat(a_from.m_flat){}
89  rexpd& operator=(const rexpd& a_from) {
90  parent::operator=(a_from);
91  m_flat = a_from.m_flat;
92  return *this;
93  }
94 public:
95  double shoot() const {return parent::shoot(::log);}
96 protected:
98 };
99 
100 class rdir2d : public rdir2<rtausmed,double> {
102 public:
104 public:
106  virtual ~rdir2d(){}
107 public:
108  rdir2d(const rdir2d& a_from):parent(m_flat),m_flat(a_from.m_flat){}
109  rdir2d& operator=(const rdir2d& a_from) {
110  parent::operator=(a_from);
111  m_flat = a_from.m_flat;
112  return *this;
113  }
114 protected:
116 };
117 
118 class rdir3d : public rdir3<rtausmed,double> {
120 public:
122 public:
124  virtual ~rdir3d(){}
125 public:
126  rdir3d(const rdir3d& a_from):parent(m_flat),m_flat(a_from.m_flat){}
127  rdir3d& operator=(const rdir3d& a_from) {
128  parent::operator=(a_from);
129  m_flat = a_from.m_flat;
130  return *this;
131  }
132 public:
133  void shoot(double& a_x,double& a_y,double& a_z) const {
134  parent::shoot(a_x,a_y,a_z,::sqrt);
135  }
136 protected:
138 };
139 
140 }
141 
142 #include "mathd"
143 
144 namespace tools {
145 
146 class rbwd : public virtual irandd, public rbw<rtausmed,double> {
148 public:
150 public:
151  virtual void* cast(const std::string& a_class) const {
152  if(void* p = cmp_cast<rbwd>(this,a_class)) return p;
153  return 0;
154  }
155  virtual double shootd() const {return shoot();}
156 public:
157  rbwd(double a_mean = 0,double a_gamma = 1):parent(m_flat,a_mean,a_gamma),m_flat(){}
158  virtual ~rbwd(){}
159 public:
160  rbwd(const rbwd& a_from):irandd(a_from),parent(m_flat),m_flat(a_from.m_flat){}
161  rbwd& operator=(const rbwd& a_from) {
162  parent::operator=(a_from);
163  m_flat = a_from.m_flat;
164  return *this;
165  }
166 public:
167  double shoot() const {return parent::shoot(half_pi(),::tan);}
168 protected:
170 };
171 
172 }
173 
174 #include "typedefs"
175 
176 namespace tools {
177 
178 class rpoissd : public virtual irandd, public rpoiss<rtausmed,double,uint64> {
180 public:
182 public:
183  virtual void* cast(const std::string& a_class) const {
184  if(void* p = cmp_cast<rpoissd>(this,a_class)) return p;
185  return 0;
186  }
187  virtual double shootd() const {return double(shoot());}
188 public:
189  rpoissd(double a_mean = 1):parent(m_flat,a_mean),m_flat(){}
190  virtual ~rpoissd(){}
191 public:
192  rpoissd(const rpoissd& a_from):irandd(a_from),parent(m_flat),m_flat(a_from.m_flat){}
193  rpoissd& operator=(const rpoissd& a_from) {
194  parent::operator=(a_from);
195  m_flat = a_from.m_flat;
196  return *this;
197  }
198 public:
199  uint64 shoot() const {return parent::shoot(two_pi(),::sqrt,::log,::exp,::cos);}
200 protected:
202 };
203 
204 }
205 
206 #endif
tools::rexpd::rexpd
rexpd(const rexpd &a_from)
Definition: randd:88
tools::rpoissd::operator=
rpoissd & operator=(const rpoissd &a_from)
Definition: randd:193
tools::rbw< rtausmed, double >::operator=
rbw & operator=(const rbw &a_from)
Definition: randT:52
tools::rpoissd::shoot
uint64 shoot() const
Definition: randd:199
tools::rbwd
Definition: randd:146
tools::rexpd::operator=
rexpd & operator=(const rexpd &a_from)
Definition: randd:89
tools::uint64
unsigned long long uint64
Definition: typedefs:72
tools::rpoissd::shootd
virtual double shootd() const
Definition: randd:187
tools::rdir3< rtausmed, double >::shoot
void shoot(double &a_x, double &a_y, double &a_z, double(*a_sqrt)(double)) const
Definition: randT:131
typedefs
tools::rexpd::rexpd
rexpd(double a_rate=1)
Definition: randd:85
tools::rgaussd::rgaussd
rgaussd(double a_mean=0, double a_std_dev=1)
Definition: randd:59
tools::rgaussd::operator=
rgaussd & operator=(const rgaussd &a_from)
Definition: randd:63
tools::irandd
Definition: randd:15
tools::rdir2d::rdir2d
rdir2d(const rdir2d &a_from)
Definition: randd:108
tools::half_pi
double half_pi()
Definition: mathd:19
tools::rpoiss
Definition: randT:154
tools::rbwd::cast
virtual void * cast(const std::string &a_class) const
Definition: randd:151
tools::rpoissd::cast
virtual void * cast(const std::string &a_class) const
Definition: randd:183
tools::rbinomial< rtausmed, double, unsigned int >::operator=
rbinomial & operator=(const rbinomial &a_from)
Definition: randT:202
tools::rexp< rtausmed, double >::shoot
double shoot(math_func a_log) const
Definition: randT:81
tools::rdir2d::rdir2d
rdir2d()
Definition: randd:105
tools::rtausmed
Definition: rtausmed:18
tools::rexp< rtausmed, double >::operator=
rexp & operator=(const rexp &a_from)
Definition: randT:79
tools::rbinomial< rtausmed, double, unsigned int >::shoot
unsigned int shoot() const
Definition: randT:208
tools::rbinomiald::shootd
virtual double shootd() const
Definition: randd:33
tools::rpoissd
Definition: randd:178
tools::rdir2d::operator=
rdir2d & operator=(const rdir2d &a_from)
Definition: randd:109
tools::rbwd::shootd
virtual double shootd() const
Definition: randd:155
tools::rexpd::m_flat
rtausmed m_flat
Definition: randd:97
tools::rdir2< rtausmed, double >::operator=
rdir2 & operator=(const rdir2 &)
Definition: randT:102
tools::rbwd::m_flat
rtausmed m_flat
Definition: randd:169
tools::rpoissd::rpoissd
rpoissd(const rpoissd &a_from)
Definition: randd:192
tools::rexp
Definition: randT:72
tools::rdir3d
Definition: randd:118
mathd
tools::rbinomiald::m_flat
rtausmed m_flat
Definition: randd:45
tools::rbwd::operator=
rbwd & operator=(const rbwd &a_from)
Definition: randd:161
tools::two_pi
double two_pi()
Definition: mathd:18
tools::irandd::~irandd
virtual ~irandd()
Definition: randd:17
tools::rgaussd::cast
virtual void * cast(const std::string &a_class) const
Definition: randd:53
TOOLS_SCLASS
#define TOOLS_SCLASS(a_name)
Definition: S_STRING:41
tools::rgaussd::m_flat
rtausmed m_flat
Definition: randd:71
tools::rbinomiald::cast
virtual void * cast(const std::string &a_class) const
Definition: randd:29
rtausmed
tools::rgauss
Definition: randT:10
tools::rdir3d::shoot
void shoot(double &a_x, double &a_y, double &a_z) const
Definition: randd:133
tools::rdir2d::~rdir2d
virtual ~rdir2d()
Definition: randd:106
tools::rdir3
Definition: randT:123
tools::rbinomiald::rbinomiald
rbinomiald(unsigned int a_n=1, double a_p=0.5)
Definition: randd:35
tools::rexpd::~rexpd
virtual ~rexpd()
Definition: randd:86
tools::rexpd::cast
virtual void * cast(const std::string &a_class) const
Definition: randd:79
tools::rdir2
Definition: randT:96
tools::rgaussd
Definition: randd:48
tools::irandd::cast
virtual void * cast(const std::string &) const =0
tools::rbwd::~rbwd
virtual ~rbwd()
Definition: randd:158
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::rgaussd::rgaussd
rgaussd(const rgaussd &a_from)
Definition: randd:62
tools::rbw
Definition: randT:46
tools::rpoiss< rtausmed, double, uint64 >::operator=
rpoiss & operator=(const rpoiss &a_from)
Definition: randT:160
tools::rgaussd::shoot
double shoot() const
Definition: randd:69
tools::rbwd::shoot
double shoot() const
Definition: randd:167
S_STRING
tools::rbinomiald::rbinomiald
rbinomiald(const rbinomiald &a_from)
Definition: randd:38
tools::rbinomiald
Definition: randd:24
scast
tools::rbinomiald::~rbinomiald
virtual ~rbinomiald()
Definition: randd:36
tools::rdir3d::operator=
rdir3d & operator=(const rdir3d &a_from)
Definition: randd:127
tools::rpoissd::m_flat
rtausmed m_flat
Definition: randd:201
tools::rbwd::rbwd
rbwd(double a_mean=0, double a_gamma=1)
Definition: randd:157
tools::rdir3d::rdir3d
rdir3d(const rdir3d &a_from)
Definition: randd:126
tools::rpoissd::~rpoissd
virtual ~rpoissd()
Definition: randd:190
tools::rdir3d::rdir3d
rdir3d()
Definition: randd:123
tools::rexpd::shoot
double shoot() const
Definition: randd:95
tools::rgauss< rtausmed, double >::shoot
double shoot(math_func a_sqrt, math_func a_log) const
Definition: randT:26
tools::rexpd
Definition: randd:74
tools::rdir2d
Definition: randd:100
tools::rgaussd::shootd
virtual double shootd() const
Definition: randd:57
tools::rpoissd::rpoissd
rpoissd(double a_mean=1)
Definition: randd:189
tools::rgaussd::~rgaussd
virtual ~rgaussd()
Definition: randd:60
tools::rgauss< rtausmed, double >::operator=
rgauss & operator=(const rgauss &a_from)
Definition: randT:20
tools::rbinomiald::operator=
rbinomiald & operator=(const rbinomiald &a_from)
Definition: randd:39
tools::rbw< rtausmed, double >::shoot
double shoot(const double &a_half_pi, double(*a_tan)(double)) const
Definition: randT:58
tools::rdir3< rtausmed, double >::operator=
rdir3 & operator=(const rdir3 &)
Definition: randT:129
tools::rbinomial
Definition: randT:196
tools::rbwd::rbwd
rbwd(const rbwd &a_from)
Definition: randd:160
tools::rexpd::shootd
virtual double shootd() const
Definition: randd:83
tools::rdir3d::m_flat
rtausmed m_flat
Definition: randd:137
tools::rdir2d::m_flat
rtausmed m_flat
Definition: randd:115
tools::rdir3d::~rdir3d
virtual ~rdir3d()
Definition: randd:124
tools::irandd::shootd
virtual double shootd() const =0
tools::rpoiss< rtausmed, double, uint64 >::shoot
uint64 shoot(const double &a_two_pi, double(*a_sqrt)(double), double(*a_log)(double), double(*a_exp)(double), double(*a_cos)(double)) const
Definition: randT:165
randT