CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
RandPoissonT.h
Go to the documentation of this file.
1// $Id: RandPoissonT.h,v 1.5 2010/06/16 17:24:53 garren Exp $
2// -*- C++ -*-
3//
4// -----------------------------------------------------------------------
5// HEP Random
6// --- RandPoissonT ---
7// class header file
8// -----------------------------------------------------------------------
9
10// Class defining methods for shooting numbers according to the Poisson
11// distribution, given a mean. RandPoissonT is derived from RandPoisson
12// and shares the identical user interface. RandPoissonT is always
13// perfectly accurate for any value of mu.
14
15// For mu > 100 the algorithm used is taken from the base class RandPoisson
16// (Algorithm from "W.H.Press et al., Numerical Recipes in C, Second Edition".)
17//
18// For mu < 100, algorithm used is a table lookup based on [mu/K] for some
19// smallish K, followed by an explicit series-drived poisson for the small
20// remaining part of mu. This method is exact, and is substantially faster
21// than the method used by the base class. The implementation of this method
22// is in the RandPoissonQ class.
23
24// =======================================================================
25// M. Fischler - Created 26 Jan 2000
26// M. Fischler - put and get to/from streams 12/10/04
27// =======================================================================
28
29#ifndef RandPoissonT_h
30#define RandPoissonT_h 1
31
32#include "CLHEP/Random/defs.h"
33#include "CLHEP/Random/RandPoisson.h"
34
35namespace CLHEP {
36
37/**
38 * @author
39 * @ingroup random
40 */
41class RandPoissonT : public RandPoisson {
42
43public:
44
45 RandPoissonT ( HepRandomEngine& anEngine, double mean=1.0 );
46 RandPoissonT ( HepRandomEngine* anEngine, double mean=1.0 );
47 // These constructors should be used to instantiate a RandPoissonT
48 // distribution object defining a local engine for it.
49 // The static generator will be skipped using the non-static methods
50 // defined below.
51 // If the engine is passed by pointer the corresponding engine object
52 // will be deleted by the RandPoissonT destructor.
53 // If the engine is passed by reference the corresponding engine object
54 // will not be deleted by the RandPoissonT destructor.
55
56 virtual ~RandPoissonT();
57 // Destructor
58
59 // Save and restore to/from streams
60
61 std::ostream & put ( std::ostream & os ) const;
62 std::istream & get ( std::istream & is );
63
64 // Static methods to shoot random values using the static generator
65
66 static long shoot( double mean=1.0 );
67
68 static void shootArray ( const int size, long* vect, double mean=1.0 );
69
70 // Static methods to shoot random values using a given engine
71 // by-passing the static generator.
72
73 static long shoot( HepRandomEngine* anEngine, double mean=1.0 );
74
75 static void shootArray ( HepRandomEngine* anEngine,
76 const int size, long* vect, double mean=1.0 );
77
78 // Methods using the localEngine to shoot random values, by-passing
79 // the static generator.
80
81 long fire();
82 long fire( double m );
83
84 void fireArray ( const int size, long* vect );
85 void fireArray ( const int size, long* vect, double mean);
86
87 double operator()();
88 double operator()( double mean );
89
90 std::string name() const;
92
93 static std::string distributionName() {return "RandPoissonT";}
94 // Provides the name of this distribution class
95
96
97private:
98
99};
100
101} // namespace CLHEP
102
103#ifdef ENABLE_BACKWARDS_COMPATIBILITY
104// backwards compatibility will be enabled ONLY in CLHEP 1.9
105using namespace CLHEP;
106#endif
107
108#include "CLHEP/Random/RandPoissonT.icc"
109
110#endif
virtual ~RandPoissonT()
Definition: RandPoissonT.cc:53
std::istream & get(std::istream &is)
void fireArray(const int size, long *vect)
std::ostream & put(std::ostream &os) const
std::string name() const
Definition: RandPoissonT.cc:42
static std::string distributionName()
Definition: RandPoissonT.h:93
static long shoot(double mean=1.0)
Definition: RandPoissonT.cc:60
static void shootArray(HepRandomEngine *anEngine, const int size, long *vect, double mean=1.0)
HepRandomEngine & engine()
Definition: RandPoissonT.cc:43
static void shootArray(const int size, long *vect, double mean=1.0)
Definition: RandPoissonT.cc:97