36 const int RandFlat::MSBBits= 15;
37 const unsigned long RandFlat::MSB= 1ul<<RandFlat::MSBBits;
48 return fire( defaultA, defaultB );
68 double lx,
double dx )
72 for (i=0; i<size; ++i)
73 vect[i] =
shoot(lx,dx);
77 const int size,
double* vect,
78 double lx,
double dx )
82 for (i=0; i<size; ++i)
83 vect[i] =
shoot(anEngine,lx,dx);
90 for (i=0; i<size; ++i)
91 vect[i] =
fire( defaultA, defaultB );
95 double lx,
double dx )
99 for (i=0; i<size; ++i)
100 vect[i] =
fire( lx, dx );
112 outfile <<
"RANDFLAT staticRandomInt: " << staticRandomInt
113 <<
" staticFirstUnusedBit: " << staticFirstUnusedBit <<
"\n";
125 std::ifstream infile ( filename, std::ios::in );
127 char inputword[] =
"NO_KEYWORD ";
131 if (strcmp(inputword,
"RANDFLAT")==0)
break;
132 if (infile.eof())
break;
141 if (strcmp(inputword,
"RANDFLAT")==0) {
146 infile >> staticRandomInt;
150 infile >> staticFirstUnusedBit;
156 int pr=os.precision(20);
157 std::vector<unsigned long> t(2);
158 os <<
" " <<
name() <<
"\n";
159 os <<
"Uvec" <<
"\n";
160 os << randomInt <<
" " << firstUnusedBit <<
"\n";
162 os << defaultWidth <<
" " << t[0] <<
" " << t[1] <<
"\n";
164 os << defaultA <<
" " << t[0] <<
" " << t[1] <<
"\n";
166 os << defaultB <<
" " << t[0] <<
" " << t[1] <<
"\n";
174 if (inName !=
name()) {
175 is.clear(std::ios::badbit | is.rdstate());
176 std::cerr <<
"Mismatch when expecting to read state of a "
177 <<
name() <<
" distribution\n"
178 <<
"Name found was " << inName
179 <<
"\nistream is left in the badbit state\n";
183 std::vector<unsigned long> t(2);
184 is >> randomInt >> firstUnusedBit;
189 is.clear(std::ios::badbit | is.rdstate());
190 std::cerr <<
"\nRandFlat input failed"
191 <<
"\nInput stream is probably mispositioned now." << std::endl;
197 is >> firstUnusedBit;
198 is >> defaultWidth >> defaultA >> defaultB;
204 int prec = os.precision(20);
205 os <<
"RANDFLAT staticRandomInt: " << staticRandomInt
206 <<
" staticFirstUnusedBit: " << staticFirstUnusedBit <<
"\n";
215 is.clear(std::ios::badbit | is.rdstate());
216 std::cerr <<
"Mismatch when expecting to read static state of a "
218 <<
"Name found was " << inName
219 <<
"\nistream is left in the badbit state\n";
226 if (keyword!=
"RANDFLAT") {
227 is.clear(std::ios::badbit | is.rdstate());
228 std::cerr <<
"Mismatch when expecting to read RANDFLAT bit cache info: "
232 is >> c1 >> staticRandomInt >> c2 >> staticFirstUnusedBit;
static c2_factory< G4double > c2
std::ostream & put(std::ostream &os) const
std::vector< ExP01TrackerHit * > a
static std::istream & restoreDistState(std::istream &is)
static HepRandomEngine * getTheEngine()
std::istream & get(std::istream &is)
HepRandomEngine & engine()
static std::string distributionName()
static std::istream & restoreFullState(std::istream &is)
static void restoreEngineStatus(const char filename[]="Config.conf")
static std::ostream & saveDistState(std::ostream &os)
bool possibleKeywordInput(IS &is, const std::string &key, T &t)
virtual void restoreStatus(const char filename[]="Config.conf")=0
static std::ostream & saveFullState(std::ostream &os)
#define CLHEP_THREAD_LOCAL
static std::vector< unsigned long > dto2longs(double d)
void fireArray(const int size, double *vect)
static void shootArray(const int size, double *vect)
virtual void saveStatus(const char filename[]="Config.conf") const =0
static std::ostream & saveFullState(std::ostream &os)
static void saveEngineStatus(const char filename[]="Config.conf")
virtual void flatArray(const int size, double *vect)=0
static std::istream & restoreFullState(std::istream &is)
static double longs2double(const std::vector< unsigned long > &v)