#include <RandPoisson.h>
- Author
Definition at line 42 of file RandPoisson.h.
CLHEP::RandPoisson::RandPoisson |
( |
HepRandomEngine & |
anEngine, |
|
|
double |
a1 = 1.0 |
|
) |
| |
|
inline |
CLHEP::RandPoisson::RandPoisson |
( |
HepRandomEngine * |
anEngine, |
|
|
double |
a1 = 1.0 |
|
) |
| |
|
inline |
CLHEP::RandPoisson::~RandPoisson |
( |
| ) |
|
|
virtual |
static std::string CLHEP::RandPoisson::distributionName |
( |
| ) |
|
|
inlinestatic |
long CLHEP::RandPoisson::fire |
( |
| ) |
|
long CLHEP::RandPoisson::fire |
( |
double |
m | ) |
|
Definition at line 217 of file RandPoisson.cc.
231 if( xm == -1 )
return 0;
241 t *= localEngine->flat();
247 sq = std::sqrt(2.0*xm);
249 g1 = xm*alxm -
gammln(xm + 1.0);
253 y = std::tan(
CLHEP::pi*localEngine->flat());
257 t = 0.9*(1.0 + y*y)* std::exp(em*alxm -
gammln(em + 1.0) - g1);
258 }
while( localEngine->flat() > t );
261 em = xm + std::sqrt(xm) *
normal (localEngine.get());
262 if ( static_cast<long>(em) < 0 )
263 em = static_cast<long>(xm) >= 0 ? xm :
getMaxMean();
265 status[0] = sq; status[1] = alxm; status[2] = g1;
static double normal(HepRandomEngine *eptr)
static double getMaxMean()
static constexpr double pi
void CLHEP::RandPoisson::fireArray |
( |
const int |
size, |
|
|
long * |
vect |
|
) |
| |
Definition at line 269 of file RandPoisson.cc.
271 for(
long* v = vect; v != vect + size; ++v )
void CLHEP::RandPoisson::fireArray |
( |
const int |
size, |
|
|
long * |
vect, |
|
|
double |
m |
|
) |
| |
Definition at line 275 of file RandPoisson.cc.
277 for(
long* v = vect; v != vect + size; ++v )
std::istream & CLHEP::RandPoisson::get |
( |
std::istream & |
is | ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandom.
Reimplemented in CLHEP::RandPoissonQ.
Definition at line 302 of file RandPoisson.cc.
305 if (inName !=
name()) {
306 is.clear(std::ios::badbit | is.rdstate());
307 std::cerr <<
"Mismatch when expecting to read state of a "
308 <<
name() <<
" distribution\n"
309 <<
"Name found was " << inName
310 <<
"\nistream is left in the badbit state\n";
314 std::vector<unsigned long> t(2);
324 is >>
defaultMean >> status[0] >> status[1] >> status[2];
bool possibleKeywordInput(IS &is, const std::string &key, T &t)
static double longs2double(const std::vector< unsigned long > &v)
static double CLHEP::RandPoisson::getMaxMean |
( |
| ) |
|
|
inlinestaticprotected |
static double CLHEP::RandPoisson::getOldMean |
( |
| ) |
|
|
inlinestaticprotected |
static double* CLHEP::RandPoisson::getPStatus |
( |
| ) |
|
|
inlinestaticprotected |
std::string CLHEP::RandPoisson::name |
( |
| ) |
const |
|
virtual |
double CLHEP::RandPoisson::operator() |
( |
| ) |
|
|
virtual |
double CLHEP::RandPoisson::operator() |
( |
double |
m | ) |
|
std::ostream & CLHEP::RandPoisson::put |
( |
std::ostream & |
os | ) |
const |
|
virtual |
Reimplemented from CLHEP::HepRandom.
Reimplemented in CLHEP::RandPoissonQ.
Definition at line 281 of file RandPoisson.cc.
282 int pr=os.precision(20);
283 std::vector<unsigned long> t(2);
284 os <<
" " <<
name() <<
"\n";
285 os <<
"Uvec" <<
"\n";
287 os <<
meanMax <<
" " << t[0] <<
" " << t[1] <<
"\n";
289 os <<
defaultMean <<
" " << t[0] <<
" " << t[1] <<
"\n";
291 os << status[0] <<
" " << t[0] <<
" " << t[1] <<
"\n";
293 os << status[1] <<
" " << t[0] <<
" " << t[1] <<
"\n";
295 os << status[2] <<
" " << t[0] <<
" " << t[1] <<
"\n";
297 os << oldm <<
" " << t[0] <<
" " << t[1] <<
"\n";
static std::vector< unsigned long > dto2longs(double d)
static void CLHEP::RandPoisson::setOldMean |
( |
double |
val | ) |
|
|
inlinestaticprotected |
static void CLHEP::RandPoisson::setPStatus |
( |
double |
sq, |
|
|
double |
alxm, |
|
|
double |
g1 |
|
) |
| |
|
inlinestaticprotected |
Definition at line 110 of file RandPoisson.h.
111 status_st[0] = sq; status_st[1] = alxm; status_st[2] = g1;
long CLHEP::RandPoisson::shoot |
( |
double |
m = 1.0 | ) |
|
|
static |
Definition at line 91 of file RandPoisson.cc.
108 if( xm == -1 )
return 0;
118 t *= anEngine->flat();
124 sq = std::sqrt(2.0*xm);
126 g1 = xm*alxm -
gammln(xm + 1.0);
130 y = std::tan(
CLHEP::pi*anEngine->flat());
134 t = 0.9*(1.0 + y*y)* std::exp(em*alxm -
gammln(em + 1.0) - g1);
135 }
while( anEngine->flat() > t );
138 em = xm + std::sqrt(xm) *
normal (anEngine);
139 if ( static_cast<long>(em) < 0 )
140 em =
static_cast<long>(xm) >= 0 ? xm :
getMaxMean();
static double * getPStatus()
static void setOldMean(double val)
static void setPStatus(double sq, double alxm, double g1)
static HepRandomEngine * getTheEngine()
static double normal(HepRandomEngine *eptr)
static double getMaxMean()
static double getOldMean()
static constexpr double pi
long CLHEP::RandPoisson::shoot |
( |
HepRandomEngine * |
anEngine, |
|
|
double |
m = 1.0 |
|
) |
| |
|
static |
Definition at line 152 of file RandPoisson.cc.
168 if( xm == -1 )
return 0;
178 t *= anEngine->flat();
184 sq = std::sqrt(2.0*xm);
186 g1 = xm*alxm -
gammln(xm + 1.0);
190 y = std::tan(
CLHEP::pi*anEngine->flat());
194 t = 0.9*(1.0 + y*y)* std::exp(em*alxm -
gammln(em + 1.0) - g1);
195 }
while( anEngine->flat() > t );
198 em = xm + std::sqrt(xm) *
normal (anEngine);
199 if ( static_cast<long>(em) < 0 )
200 em =
static_cast<long>(xm) >= 0 ? xm :
getMaxMean();
static double * getPStatus()
static void setOldMean(double val)
static void setPStatus(double sq, double alxm, double g1)
static double normal(HepRandomEngine *eptr)
static double getMaxMean()
static double getOldMean()
static constexpr double pi
void CLHEP::RandPoisson::shootArray |
( |
const int |
size, |
|
|
long * |
vect, |
|
|
double |
m = 1.0 |
|
) |
| |
|
static |
Definition at line 146 of file RandPoisson.cc.
148 for(
long* v = vect; v != vect + size; ++v )
static long shoot(double m=1.0)
void CLHEP::RandPoisson::shootArray |
( |
HepRandomEngine * |
anEngine, |
|
|
const int |
size, |
|
|
long * |
vect, |
|
|
double |
m = 1.0 |
|
) |
| |
|
static |
Definition at line 206 of file RandPoisson.cc.
209 for(
long* v = vect; v != vect + size; ++v )
210 *v =
shoot(anEngine,m1);
static long shoot(double m=1.0)
double CLHEP::RandPoisson::defaultMean |
|
protected |
double CLHEP::RandPoisson::meanMax |
|
protected |
The documentation for this class was generated from the following files: