15#include "CLHEP/Random/defs.h"
16#include "CLHEP/Random/RandGaussQ.h"
17#include "CLHEP/Units/PhysicalConstants.h"
38 double mean,
double stdDev )
40 for(
double* v = vect; v != vect + size; ++v )
41 *v =
shoot(mean,stdDev);
45 const int size,
double* vect,
46 double mean,
double stdDev )
48 for(
double* v = vect; v != vect + size; ++v )
49 *v =
shoot(anEngine,mean,stdDev);
54 for(
double* v = vect; v != vect + size; ++v )
59 double mean,
double stdDev )
61 for(
double* v = vect; v != vect + size; ++v )
62 *v =
fire( mean, stdDev );
76#define Table1size 1000
77#define TableSize (Table0size+Table1size)
79#define Table0step (2.0E-6)
80#define Table1step (5.0E-4)
82#define Table0scale (1.0/Table1step)
85#define Table1offset (Table0size)
89static const float gaussTables [
TableSize] = {
90#include "gaussQTables.cdat"
119 double y0 = gaussTables [index++];
120 double y1 = gaussTables [index];
122 return (
float) (sign * ( y1 * dx + y0 * (1.0-dx) ));
151 for (
int i = 1; i < 50; i++ ) {
152 double vn2 = 1.0/(guess*guess);
153 double s1 = -13*11*9*7*5*3 * vn2*vn2*vn2*vn2*vn2*vn2*vn2;
154 s1 += 11*9*7*5*3 * vn2*vn2*vn2*vn2*vn2*vn2;
155 s1 += -9*7*5*3 * vn2*vn2*vn2*vn2*vn2;
156 s1 += 7*5*3 * vn2*vn2*vn2*vn2;
157 s1 += -5*3 * vn2*vn2*vn2;
158 s1 += 3 * vn2*vn2 - vn2 + 1.0;
159 v = std::sqrt ( 2.0 * std::log ( s1 / (r*guess*std::sqrt(CLHEP::twopi)) ) );
160 if ( std::fabs(v-guess) < eps )
break;
168 long pr=os.precision(20);
169 os <<
" " <<
name() <<
"\n";
178 if (inName !=
name()) {
179 is.clear(std::ios::badbit | is.rdstate());
180 std::cerr <<
"Mismatch when expecting to read state of a "
181 <<
name() <<
" distribution\n"
182 <<
"Name found was " << inName
183 <<
"\nistream is left in the badbit state\n";
std::istream & get(std::istream &is)
static double transformSmall(double r)
std::ostream & put(std::ostream &os) const
static void shootArray(const int size, double *vect, double mean=0.0, double stdDev=1.0)
void fireArray(const int size, double *vect)
HepRandomEngine & engine()
virtual double operator()()
static double transformQuick(double r)
std::istream & get(std::istream &is)
std::ostream & put(std::ostream &os) const
HepRandomEngine & engine()
std::shared_ptr< HepRandomEngine > localEngine