RandPoissonQ


Class defining RandPoissonQ, which is derived from RandPoison.
The user interface is identical; but RandPoissonQ is much faster in all cases and a bit less accurate when mu > 100.

Methods to generate Poisson-distributed random deviates.

The method used for mu <= 100 is exact, and 3-7 times faster than that used by RandPoisson.

For mu > 100 then we use a corrected version of a (quick) Gaussian approximation. Naively that would be:

Poisson(mu) ~ floor( mu + .5 + Gaussian(sqrt(mu)) )

but actually, that would give a slightly incorrect sigma and a very different skew than a true Poisson. Instead we return

Poisson(mu) ~ floor( a0*mu + a1*g + a2*g*g ) ) (with g a gaussian normal)

where a0, a1, a2 are chosen to give the exctly correct mean, sigma, and skew for the Poisson distribution.

Author

Mark Fischler

See also

Engines: HepRandomEngine, DRand48Engine , DualRand, HepJamesRandom, Hurd160Engine, Hurd288Engine, MTwistEngine, RandEngine, RanecuEngine, RanluxEngine, Ranlux64Engine, RanshiEngine, TripleRand

Distributions: HepRandom, RandBinomial, RandBit, RandBreitWigner, RandChiSquare, RandExponential, RandFlat, RandGamma, RandGauss, RandGaussQ, RandGaussT, RandGeneral, RandLandau, RandPoisson, RandPoissonT, RandStudentT

Functions: HepStat

Declaration

#include "CLHEP/Random/RandPoissonQ.h"

class RandPoissonQ : public RandPoisson

Public Member Functions

Static Constant
static const HepDouble MAXIMUM_POISSON_DEVIATE
RandPoisson will never return a deviate greater than this value: will be 2.0E9
Constructors
inline RandPoissonQ(HepRandomEngine& anEngine, HepDouble m=1.0)
inline RandPoissonQ( HepRandomEngine* anEngine, HepDouble m=1.0)
These constructors should be used to instantiate a RandPoissonQ distribution object defining a local engine for it.
The static generator will be skipped using the non-static methods defined below.
If the engine is passed by pointer the corresponding engine object will be deleted by the RandPoissonQ destructor.
If the engine is passed by reference the corresponding engine object will not be deleted by the RandPoissonQ destructor.
Destructor
virtual ~RandPoissonQ()
()
HepDouble operator()()
HepDouble operator()(HepDouble m)
Methods using the localEngine to shoot random values, by-passing the static generator.
fire
long fire()
long fire(HepDouble m)
Methods using the localEngine to shoot random values, by-passing the static generator.
fireArray
void fireArray(const HepInt size, long* vect)
void fireArray(const HepInt size, long* vect, HepDouble m)
Methods using the localEngine to shoot random values, by-passing the static generator.
shoot
static long shoot(HepDouble m=1.0)
Static method to shoot random values using the static generator

static long shoot(HepRandomEngine* anEngine, HepDouble m=1.0)
Static methods to shoot random values using a given engine by-passing the static generator.
shootArray
static void shootArray(const HepInt size, long* vect, HepDouble m=1.0)
Static method to shoot random values using the static generator

static void shootArray(HepRandomEngine* anEngine, const HepInt size, long* vect, HepDouble m=1.0)
Static methods to shoot random values using a given engine by-passing the static generator.
tableBoundary
static inline int tableBoundary()

Example

CLHEP/Random/test/testRandDists.cc


19 June 2001
EVC