#include <DualRand.h>
- Author
Definition at line 50 of file DualRand.h.
CLHEP::DualRand::DualRand |
( |
| ) |
|
Definition at line 77 of file DualRand.cc.
79 numEngines(numberOfEngines++),
80 tausworthe (1234567 + numEngines + 175321),
81 integerCong(69607 * tausworthe + 54329, numEngines)
CLHEP::DualRand::DualRand |
( |
long |
seed | ) |
|
Definition at line 86 of file DualRand.cc.
89 tausworthe ((
unsigned int)
seed + 175321),
90 integerCong(69607 * tausworthe + 54329, 8043)
CLHEP::DualRand::DualRand |
( |
std::istream & |
is | ) |
|
CLHEP::DualRand::DualRand |
( |
int |
rowIndex, |
|
|
int |
colIndex |
|
) |
| |
Definition at line 102 of file DualRand.cc.
105 tausworthe (rowIndex + 1000 * colIndex + 85329),
106 integerCong(69607 * tausworthe + 54329, 1123)
CLHEP::DualRand::~DualRand |
( |
| ) |
|
|
virtual |
std::string CLHEP::DualRand::beginTag |
( |
| ) |
|
|
static |
Definition at line 241 of file DualRand.cc.
242 return "DualRand-begin";
static std::string CLHEP::DualRand::engineName |
( |
| ) |
|
|
inlinestatic |
double CLHEP::DualRand::flat |
( |
| ) |
|
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 113 of file DualRand.cc.
114 unsigned int ic ( integerCong );
115 unsigned int t ( tausworthe );
static double nearlyTwoToMinus_54()
static double twoToMinus_32()
static double twoToMinus_53()
void CLHEP::DualRand::flatArray |
( |
const int |
size, |
|
|
double * |
vect |
|
) |
| |
|
virtual |
std::istream & CLHEP::DualRand::get |
( |
std::istream & |
is | ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 224 of file DualRand.cc.
231 if (strcmp(beginMarker,
"DualRand-begin")) {
232 is.clear(std::ios::badbit | is.rdstate());
233 std::cerr <<
"\nInput mispositioned or"
234 <<
"\nDualRand state description missing or"
235 <<
"\nwrong engine type found." << std::endl;
static const int MarkerLen
virtual std::istream & getState(std::istream &is)
bool CLHEP::DualRand::get |
( |
const std::vector< unsigned long > & |
v | ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 281 of file DualRand.cc.
282 if ((
v[0] & 0xffffffffUL) != engineIDulong<DualRand>()) {
284 "\nDualRand get:state vector has wrong ID word - state unchanged\n";
288 std::cerr <<
"\nDualRand get:state vector has wrong size: "
289 <<
v.size() <<
" - state unchanged\n";
static const unsigned int VECTOR_STATE_SIZE
virtual std::istream & getState(std::istream &is)
std::istream & CLHEP::DualRand::getState |
( |
std::istream & |
is | ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 245 of file DualRand.cc.
247 std::vector<unsigned long>
v;
252 is.clear(std::ios::badbit | is.rdstate());
253 std::cerr <<
"\nDualRand state (vector) description improper."
254 <<
"\ngetState() has failed."
255 <<
"\nInput stream is probably mispositioned now." << std::endl;
272 if (strcmp(endMarker,
"DualRand-end")) {
273 is.clear(std::ios::badbit | is.rdstate());
274 std::cerr <<
"DualRand state description incomplete."
275 <<
"\nInput stream is probably mispositioned now." << std::endl;
static const int MarkerLen
static const unsigned int VECTOR_STATE_SIZE
bool possibleKeywordInput(IS &is, const std::string &key, T &t)
virtual std::istream & getState(std::istream &is)
bool CLHEP::DualRand::getState |
( |
const std::vector< unsigned long > & |
v | ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 295 of file DualRand.cc.
296 std::vector<unsigned long>::const_iterator iv =
v.begin()+1;
297 if (!tausworthe.get(iv))
return false;
298 if (!integerCong.get(iv))
return false;
301 "\nDualRand get:state vector has wrong size: " <<
v.size()
302 <<
"\n Apparently " << iv-
v.begin() <<
" words were consumed\n";
std::string CLHEP::DualRand::name |
( |
| ) |
const |
|
virtual |
CLHEP::DualRand::operator float |
( |
| ) |
|
|
virtual |
CLHEP::DualRand::operator unsigned int |
( |
| ) |
|
|
virtual |
std::ostream & CLHEP::DualRand::put |
( |
std::ostream & |
os | ) |
const |
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 206 of file DualRand.cc.
207 char beginMarker[] =
"DualRand-begin";
208 os << beginMarker <<
"\nUvec\n";
209 std::vector<unsigned long>
v =
put();
210 for (
unsigned int i=0; i<v.size(); ++i) {
std::vector< unsigned long > put() const
std::vector< unsigned long > CLHEP::DualRand::put |
( |
| ) |
const |
|
virtual |
void CLHEP::DualRand::restoreStatus |
( |
const char |
filename[] = "DualRand.conf" | ) |
|
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 150 of file DualRand.cc.
151 std::ifstream inFile(filename, std::ios::in);
153 std::cerr <<
" -- Engine state remains unchanged\n";
157 std::vector<unsigned long>
v;
162 inFile.clear(std::ios::badbit | inFile.rdstate());
163 std::cerr <<
"\nDualRand state (vector) description improper."
164 <<
"\nrestoreStatus has failed."
165 <<
"\nInput stream is probably mispositioned now." << std::endl;
176 tausworthe.get(inFile);
177 integerCong.get(inFile);
static const unsigned int VECTOR_STATE_SIZE
static bool checkFile(std::istream &file, const std::string &filename, const std::string &classname, const std::string &methodname)
static std::string engineName()
bool possibleKeywordInput(IS &is, const std::string &key, T &t)
virtual std::istream & getState(std::istream &is)
void CLHEP::DualRand::saveStatus |
( |
const char |
filename[] = "DualRand.conf" | ) |
const |
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 139 of file DualRand.cc.
140 std::ofstream outFile(filename, std::ios::out);
141 if (!outFile.bad()) {
143 std::vector<unsigned long>
v =
put();
144 for (
unsigned int i=0; i<v.size(); ++i) {
145 outFile << v[i] <<
"\n";
std::vector< unsigned long > put() const
void CLHEP::DualRand::setSeed |
( |
long |
seed, |
|
|
int |
|
|
) |
| |
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 128 of file DualRand.cc.
130 tausworthe = Tausworthe((
unsigned int)
seed + 175321);
131 integerCong = IntegerCong(69607 * tausworthe + 54329, 8043);
void CLHEP::DualRand::setSeeds |
( |
const long * |
seeds, |
|
|
int |
|
|
) |
| |
|
virtual |
void CLHEP::DualRand::showStatus |
( |
| ) |
const |
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 181 of file DualRand.cc.
182 int pr=std::cout.precision(20);
183 std::cout << std::endl;
184 std::cout <<
"-------- DualRand engine status ---------"
186 std::cout <<
"Initial seed = " <<
theSeed << std::endl;
187 std::cout <<
"Tausworthe generator = " << std::endl;
188 tausworthe.put(std::cout);
189 std::cout <<
"\nIntegerCong generator = " << std::endl;
190 integerCong.put(std::cout);
191 std::cout << std::endl <<
"-----------------------------------------"
193 std::cout.precision(pr);
const unsigned int CLHEP::DualRand::VECTOR_STATE_SIZE = 9 |
|
static |
The documentation for this class was generated from the following files:
- source/geant4.10.03.p03/source/externals/clhep/include/CLHEP/Random/DualRand.h
- source/geant4.10.03.p03/source/externals/clhep/src/DualRand.cc