Go to the documentation of this file. 1 #include "CLHEP/Random/defs.h"
2 #include "CLHEP/Random/RandGaussZiggurat.h"
3 #include "CLHEP/Units/PhysicalConstants.h"
21 return "RandGaussZiggurat";
26 const double rzm1 = 2147483648.0, rzm2 = 4294967296.;
27 double dn=3.442619855899,tn=dn,vn=9.91256303526217e-3, q;
28 double de=7.697117470131487, te=de, ve=3.949659822581572e-3;
33 kn[0]=(
unsigned long)((dn/q)*rzm1);
40 fn[127]=exp(-.5*dn*dn);
43 dn=sqrt(-2.*log(vn/dn+exp(-.5*dn*dn)));
44 kn[
i+1]=(
unsigned long)((dn/tn)*rzm1);
52 ke[0]=(
unsigned long)((de/q)*rzm2);
62 de=-log(ve/de+exp(-de));
63 ke[
i+1]= (
unsigned long)((de/te)*rzm2);
77 const float r = 3.442620f;
79 unsigned long iz=hz&127;
90 return (hz>0)? r+
x : -r-
x;
98 if((
unsigned long)abs(hz)<
kn[iz])
return (hz*
wn[iz]);
113 vect[
i] =
shoot(mean,stdDev);
120 vect[
i] =
shoot(mean,stdDev);
127 vect[
i] =
shoot(anEngine,mean,stdDev);
134 vect[
i] =
shoot(anEngine,mean,stdDev);
155 vect[
i] =
fire( mean, stdDev );
162 vect[
i] =
fire( mean, stdDev );
167 int pr=os.precision(20);
168 os <<
" " <<
name() <<
"\n";
177 if (inName !=
name()) {
178 is.clear(std::ios::badbit |
is.rdstate());
179 std::cerr <<
"Mismatch when expecting to read state of a "
180 <<
name() <<
" distribution\n"
181 <<
"Name found was " << inName
182 <<
"\nistream is left in the badbit state\n";
static bool ziggurat_init()
std::istream & get(std::istream &is)
HepRandomEngine & engine()
HepRotation and so forth isNear() norm2() rectify() static Rotation row1 row4(To avoid bloat in the code pulled in for programs which don 't use all these features, we split the implementation .cc files. Only isNear() goes into the original Rotation.cc) --------------------------------------- HepAxisAngle and HepEulerAngles classes --------------------------------------- These classes are very useful and simple structures for holding the result of a nice intuituve decomposition of a rotation there is no longer much content in the distinct ZOOM PhysicsVectors library The only content left in the library is the object files representing the various Exception objects When we build the CLHEP classes for the ZOOM we will set up so as to use ZOOM SpaceVector is(but we can disable namespace usage and most of our users do so at this point). What I do is leave Hep3Vector in the global namespace
static float ziggurat_RNOR(HepRandomEngine *anEngine)
std::istream & get(std::istream &is)
user code seldom needs to call this function directly ZMerrno whether or not they are still recorded ZMerrno size() Return the(integer) number of ZMthrow 'n exceptions currently recorded. 5) ZMerrno.clear() Set an internal counter to zero. This counter is available(see next function) to user code to track ZMthrow 'n exceptions that have occurred during any arbitrary time interval. 6) ZMerrno.countSinceCleared() Return the(integer) number of ZMthrow 'n exceptions that have been recorded via ZMerrno.write()
static void shootArray(const int size, float *vect, float mean=0.0, float stdDev=1.0)
virtual double operator()()
static float ziggurat_nfix(long hz, HepRandomEngine *anEngine)
HepRandomEngine & engine()
void fireArray(const int size, float *vect)
std::ostream & put(std::ostream &os) const
static bool ziggurat_is_init
std::ostream & put(std::ostream &os) const
static unsigned long kn[128]
virtual ~RandGaussZiggurat()
shared_ptr< HepRandomEngine > localEngine
static float ziggurat_UNI(HepRandomEngine *anEngine)
static unsigned long ke[256]
any side effects of that construction would occur twice The semantics of throw x
static unsigned long ziggurat_SHR3(HepRandomEngine *anEngine)