Go to the documentation of this file.
30 #include "CLHEP/Random/defs.h"
31 #include "CLHEP/Random/RandFlat.h"
32 #include "CLHEP/Random/DoubConv.hh"
37 const int RandFlat::MSBBits= 15;
38 const unsigned long RandFlat::MSB= 1ul<<RandFlat::MSBBits;
39 unsigned long RandFlat::staticRandomInt= 0;
40 unsigned long RandFlat::staticFirstUnusedBit= 0;
49 return fire( defaultA, defaultB );
69 double lx,
double dx )
78 const int size,
double* vect,
79 double lx,
double dx )
84 vect[
i] =
shoot(anEngine,lx,dx);
92 vect[
i] =
fire( defaultA, defaultB );
96 double lx,
double dx )
101 vect[
i] =
fire( lx, dx );
111 std::ofstream outfile ( filename, std::ios::app );
113 outfile <<
"RANDFLAT staticRandomInt: " << staticRandomInt
114 <<
" staticFirstUnusedBit: " << staticFirstUnusedBit <<
"\n";
128 char inputword[] =
"NO_KEYWORD ";
132 if (strcmp(inputword,
"RANDFLAT")==0)
break;
133 if (infile.eof())
break;
142 if (strcmp(inputword,
"RANDFLAT")==0) {
147 infile >> staticRandomInt;
151 infile >> staticFirstUnusedBit;
157 int pr=os.precision(20);
158 std::vector<unsigned long> t(2);
159 os <<
" " <<
name() <<
"\n";
160 os <<
"Uvec" <<
"\n";
161 os << randomInt <<
" " << firstUnusedBit <<
"\n";
163 os << defaultWidth <<
" " << t[0] <<
" " << t[1] <<
"\n";
165 os << defaultA <<
" " << t[0] <<
" " << t[1] <<
"\n";
167 os << defaultB <<
" " << t[0] <<
" " << t[1] <<
"\n";
169 std::cout <<
"RandFlat::put(): randomInt = " << randomInt
170 <<
" firstUnusedBit = " << firstUnusedBit
171 <<
"\ndefaultWidth = " << defaultWidth
172 <<
" defaultA = " << defaultA
173 <<
" defaultB = " << defaultB <<
"\n";
178 int pr=os.precision(20);
179 os <<
" " <<
name() <<
"\n";
180 os << randomInt <<
" " << firstUnusedBit <<
"\n";
181 os << defaultWidth <<
" " << defaultA <<
" " << defaultB <<
"\n";
190 if (inName !=
name()) {
191 is.clear(std::ios::badbit |
is.rdstate());
192 std::cerr <<
"Mismatch when expecting to read state of a "
193 <<
name() <<
" distribution\n"
194 <<
"Name found was " << inName
195 <<
"\nistream is left in the badbit state\n";
199 std::vector<unsigned long> t(2);
200 is >> randomInt >> firstUnusedBit;
205 std::cout <<
"RandFlat::get(): randomInt = " << randomInt
206 <<
" firstUnusedBit = " << firstUnusedBit
207 <<
"\ndefaultWidth = " << defaultWidth
208 <<
" defaultA = " << defaultA
209 <<
" defaultB = " << defaultB <<
"\n";
212 is.clear(std::ios::badbit |
is.rdstate());
213 std::cerr <<
"\nRandFlat input failed"
214 <<
"\nInput stream is probably mispositioned now." << std::endl;
220 is >> firstUnusedBit;
221 is >> defaultWidth >> defaultA >> defaultB;
227 int prec = os.precision(20);
228 os <<
"RANDFLAT staticRandomInt: " << staticRandomInt
229 <<
" staticFirstUnusedBit: " << staticFirstUnusedBit <<
"\n";
238 is.clear(std::ios::badbit |
is.rdstate());
239 std::cerr <<
"Mismatch when expecting to read static state of a "
241 <<
"Name found was " << inName
242 <<
"\nistream is left in the badbit state\n";
250 is.clear(std::ios::badbit |
is.rdstate());
251 std::cerr <<
"Mismatch when expecting to read RANDFLAT bit cache info: "
255 is >> c1 >> staticRandomInt >> c2 >> staticFirstUnusedBit;
static std::ostream & saveFullState(std::ostream &os)
static std::ostream & saveFullState(std::ostream &os)
static std::istream & restoreDistState(std::istream &is)
HepRandomEngine & engine()
std::istream & get(std::istream &is)
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 std::string distributionName()
static std::istream & restoreFullState(std::istream &is)
std::ostream & put(std::ostream &os) const
static double longs2double(const std::vector< unsigned long > &v)
static std::istream & restoreFullState(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()
void fireArray(const int size, double *vect)
Signatures of Hep3Vector::rotate For equivalent ZOOM axis There is no harm in leaving this axis CLHEP has implemented a first forming an identity then rotating that by axis and I leave the CLHEP code alone people are of course free to use the ZOOM originated method with signature which I believe will be faster Return types for rotateZ CLHEP and PhysicsVectors each have these three and they are identical except that the ZOOM version returns a reference to while in CLHEP they return void Having methods that alter an object return a reference to that object is convenient for certain chained and costs nothing I don t wish to potentially break ZOOM user code for no good so I have made these CLHEP method conform to this convention There are a couple of other CLHEP rotate and which use the void return but since these methods or signatures don t appear in the original ZOOM this can t break any so I leave the void return type alone for those After discussion with A P and I have modified the return types of other CLHEP methods which return void and would by the same reasoning be better returning *this These include rotate and boost methods in LorentzVector h HepLorentzVector explicit keyword
static void restoreEngineStatus(const char filename[]="Config.conf")
virtual void saveStatus(const char filename[]="Config.conf") const =0
static void shootArray(const int size, double *vect)
bool possibleKeywordInput(IS &is, const std::string &key, T &t)
static std::ostream & saveDistState(std::ostream &os)
virtual void restoreStatus(const char filename[]="Config.conf")=0
virtual void flatArray(const int size, double *vect)=0
static void saveEngineStatus(const char filename[]="Config.conf")
static std::vector< unsigned long > dto2longs(double d)
it has advantages For I leave the ZMthrows in
static HepRandomEngine * getTheEngine()