00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef RandPoisson_h
00033 #define RandPoisson_h 1
00034
00035 #include "Random.h"
00036
00037 class RandPoisson : public HepRandom {
00038
00039 public:
00040
00041 inline RandPoisson ( HepRandomEngine& anEngine );
00042 inline RandPoisson ( HepRandomEngine* anEngine );
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 virtual ~RandPoisson();
00053
00054
00055
00056
00057 static long shoot( HepDouble m=1.0 );
00058
00059 static void shootArray ( const HepInt size, long* vect, HepDouble m=1.0 );
00060 #ifndef ST_NO_TEMPLATE_DEF_ARGS
00061 static void shootArray ( vector<long>&, HepDouble m=1.0 );
00062 #else
00063 static void shootArray ( vector<long, allocator<long> >&, HepDouble m=1.0 );
00064 #endif
00065
00066
00067
00068 static long shoot( HepRandomEngine* anEngine, HepDouble m=1.0 );
00069
00070 static void shootArray ( HepRandomEngine* anEngine,
00071 const HepInt size, long* vect, HepDouble m=1.0 );
00072 #ifndef ST_NO_TEMPLATE_DEF_ARGS
00073 static void shootArray ( HepRandomEngine*,
00074 vector<long>&, HepDouble m=1.0 );
00075 #else
00076 static void shootArray ( HepRandomEngine*,
00077 vector<long, allocator<long> >&, HepDouble m=1.0 );
00078 #endif
00079
00080
00081
00082 long fire( HepDouble m=1.0 );
00083
00084 void fireArray ( const HepInt size, long* vect, HepDouble m=1.0 );
00085 #ifndef ST_NO_TEMPLATE_DEF_ARGS
00086 void fireArray ( vector<long>&, HepDouble m=1.0 );
00087 #else
00088 void fireArray ( vector<long,allocator<long> >&, HepDouble m=1.0 );
00089 #endif
00090 HepDouble operator()();
00091
00092
00093 protected:
00094
00095 static HepDouble getOldMean() {return HepRandom::getTheGenerator()->getOldMean();}
00096
00097 static HepDouble getMaxMean() {return HepRandom::getTheGenerator()->getMaxMean();}
00098
00099 static void setOldMean( HepDouble val ){HepRandom::getTheGenerator()->setOldMean(val);}
00100
00101 static HepDouble* getPStatus() {return HepRandom::getTheGenerator()->getPStatus();}
00102
00103 static void setPStatus(HepDouble sq, HepDouble alxm, HepDouble g) {
00104 HepRandom::getTheGenerator()->setPStatus(sq, alxm, g);
00105 }
00106
00107 private:
00108
00109 HepRandomEngine* localEngine;
00110 HepBoolean deleteEngine;
00111 HepDouble status[3], oldm;
00112 const HepDouble meanMax;
00113 };
00114
00115
00116
00117
00118
00119 inline RandPoisson::RandPoisson(HepRandomEngine & anEngine)
00120 : localEngine(&anEngine), deleteEngine(false),
00121 oldm(-1.0), meanMax(2.0E9) {
00122 status[0] = status[1] = status[2] = 0.;
00123 }
00124
00125 inline RandPoisson::RandPoisson(HepRandomEngine * anEngine)
00126 : localEngine(anEngine), deleteEngine(true),
00127 oldm(-1.0), meanMax(2.0E9) {
00128 status[0] = status[1] = status[2] = 0.;
00129 }
00130
00131 #endif