51 return double(
fire( mean ));
60 static const double cof[6] = {76.18009172947146,-86.50532032941677,
61 24.01409824083091, -1.231739572450155,
62 0.1208650973866179e-2, -0.5395239384953e-5};
66 tmp -= (x + 0.5) * std::log(tmp);
67 double ser = 1.000000000190015;
69 for ( j = 0; j <= 5; j++ ) {
73 return -tmp + std::log(2.5066282746310005*ser);
82 v1 = 2.0 * eptr->
flat() - 1.0;
83 v2 = 2.0 * eptr->
flat() - 1.0;
87 fac = std::sqrt(-2.0*std::log(r)/r);
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);
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();
148 for(
long* v = vect; v != vect + size; ++v )
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);
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();
207 long* vect,
double m1)
209 for(
long* v = vect; v != vect + size; ++v )
210 *v =
shoot(anEngine,m1);
231 if( xm == -1 )
return 0;
247 sq = std::sqrt(2.0*xm);
249 g1 = xm*alxm -
gammln(xm + 1.0);
257 t = 0.9*(1.0 + y*
y)* std::exp(em*alxm -
gammln(em + 1.0) - g1);
262 if ( static_cast<long>(em) < 0 )
263 em = static_cast<long>(xm) >= 0 ? xm :
getMaxMean();
271 for(
long* v = vect; v != vect + size; ++v )
277 for(
long* v = vect; v != vect + size; ++v )
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";
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);
bool possibleKeywordInput(IS &is, const std::string &key, T &t)
static double getOldMean()
static HepRandomEngine * getTheEngine()
static const double meanMax_st
std::shared_ptr< HepRandomEngine > localEngine
static void shootArray(const int size, long *vect, double m=1.0)
static double normal(HepRandomEngine *eptr)
void fireArray(const int size, long *vect)
static double getMaxMean()
static long shoot(double m=1.0)
static double longs2double(const std::vector< unsigned long > &v)
static void setPStatus(double sq, double alxm, double g1)
static void setOldMean(double val)
HepRandomEngine & engine()
static double * getPStatus()
static CLHEP_THREAD_LOCAL double status_st[3]
static CLHEP_THREAD_LOCAL double oldm_st
std::istream & get(std::istream &is)
static std::vector< unsigned long > dto2longs(double d)
#define CLHEP_THREAD_LOCAL
std::ostream & put(std::ostream &os) const
static const G4double fac
static constexpr double pi