#include <RanecuEngine.h>
◆ RanecuEngine() [1/3]
CLHEP::RanecuEngine::RanecuEngine |
( |
std::istream & |
is | ) |
|
◆ RanecuEngine() [2/3]
CLHEP::RanecuEngine::RanecuEngine |
( |
| ) |
|
Definition at line 68 of file RanecuEngine.cc.
71 int numEngines = numberOfEngines++;
72 int cycle = std::abs(
int(numEngines/
maxSeq));
76 long mask = ((cycle & 0x007fffff) << 8);
77 for (
int i=0; i<2; ++i) {
78 for (
int j=0; j<
maxSeq; ++j) {
static void getTheTableSeeds(long *seeds, int index)
◆ RanecuEngine() [3/3]
CLHEP::RanecuEngine::RanecuEngine |
( |
int |
index | ) |
|
Definition at line 86 of file RanecuEngine.cc.
92 long mask = ((cycle & 0x000007ff) << 20);
93 for (
int j=0; j<
maxSeq; ++j) {
void further_randomize(int seq, int col, int index, int modulus)
static void getTheTableSeeds(long *seeds, int index)
◆ ~RanecuEngine()
CLHEP::RanecuEngine::~RanecuEngine |
( |
| ) |
|
|
virtual |
◆ beginTag()
std::string CLHEP::RanecuEngine::beginTag |
( |
| ) |
|
|
static |
◆ engineName()
static std::string CLHEP::RanecuEngine::engineName |
( |
| ) |
|
|
inlinestatic |
◆ flat()
double CLHEP::RanecuEngine::flat |
( |
| ) |
|
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 196 of file RanecuEngine.cc.
206 if (seed1 < 0) seed1 +=
shift1;
208 if (seed2 < 0) seed2 +=
shift2;
213 long diff = seed1-seed2;
215 if (diff <= 0) diff += (
shift1-1);
216 return (
double)(diff*
prec);
static const int ecuyer_b
static const int ecuyer_f
static const int ecuyer_a
static const int ecuyer_e
static const int ecuyer_d
static const int ecuyer_c
◆ flatArray()
void CLHEP::RanecuEngine::flatArray |
( |
const int |
size, |
|
|
double * |
vect |
|
) |
| |
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 219 of file RanecuEngine.cc.
227 for (i=0; i<size; ++i)
233 if (seed1 < 0) seed1 +=
shift1;
235 if (seed2 < 0) seed2 +=
shift2;
237 long diff = seed1-seed2;
238 if (diff <= 0) diff += (
shift1-1);
240 vect[i] = (double)(diff*
prec);
static const int ecuyer_b
static const int ecuyer_f
static const int ecuyer_a
static const int ecuyer_e
static const int ecuyer_d
static const int ecuyer_c
◆ further_randomize()
void CLHEP::RanecuEngine::further_randomize |
( |
int |
seq, |
|
|
int |
col, |
|
|
int |
index, |
|
|
int |
modulus |
|
) |
| |
|
private |
◆ get() [1/2]
std::istream & CLHEP::RanecuEngine::get |
( |
std::istream & |
is | ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 287 of file RanecuEngine.cc.
296 if (strcmp(beginMarker,
"RanecuEngine-begin")) {
297 is.clear(std::ios::badbit | is.rdstate());
298 std::cerr <<
"\nInput stream mispositioned or" 299 <<
"\nRanecuEngine state description missing or" 300 <<
"\nwrong engine type found." << std::endl;
static const int MarkerLen
virtual std::istream & getState(std::istream &is)
◆ get() [2/2]
bool CLHEP::RanecuEngine::get |
( |
const std::vector< unsigned long > & |
v | ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 349 of file RanecuEngine.cc.
350 if ((
v[0] & 0xffffffffUL) != engineIDulong<RanecuEngine>()) {
352 "\nRanecuEngine get:state vector has wrong ID word - state unchanged\n";
virtual std::istream & getState(std::istream &is)
◆ getState() [1/2]
std::istream & CLHEP::RanecuEngine::getState |
( |
std::istream & |
is | ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 310 of file RanecuEngine.cc.
313 std::vector<unsigned long>
v;
318 is.clear(std::ios::badbit | is.rdstate());
319 std::cerr <<
"\nRanecuEngine state (vector) description improper." 320 <<
"\ngetState() has failed." 321 <<
"\nInput stream is probably mispositioned now." << std::endl;
332 for (
int i=0; i<2; ++i) {
338 if (strcmp(endMarker,
"RanecuEngine-end")) {
339 is.clear(std::ios::badbit | is.rdstate());
340 std::cerr <<
"\nRanecuEngine state description incomplete." 341 <<
"\nInput stream is probably mispositioned now." << std::endl;
static const int MarkerLen
static const unsigned int VECTOR_STATE_SIZE
virtual std::istream & getState(std::istream &is)
bool possibleKeywordInput(IS &is, const std::string &key, T &t)
◆ getState() [2/2]
bool CLHEP::RanecuEngine::getState |
( |
const std::vector< unsigned long > & |
v | ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 358 of file RanecuEngine.cc.
361 "\nRanecuEngine get:state vector has wrong length - state unchanged\n";
static const unsigned int VECTOR_STATE_SIZE
◆ name()
std::string CLHEP::RanecuEngine::name |
( |
| ) |
const |
|
virtual |
◆ operator unsigned int()
CLHEP::RanecuEngine::operator unsigned int |
( |
| ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 246 of file RanecuEngine.cc.
255 if (seed1 < 0) seed1 +=
shift1;
257 if (seed2 < 0) seed2 +=
shift2;
261 long diff = seed1-seed2;
262 if( diff <= 0 ) diff += (
shift1-1);
264 return ((diff << 1) | (seed1&1))& 0xffffffff;
static const int ecuyer_b
static const int ecuyer_f
static const int ecuyer_a
static const int ecuyer_e
static const int ecuyer_d
static const int ecuyer_c
◆ put() [1/2]
std::ostream & CLHEP::RanecuEngine::put |
( |
std::ostream & |
os | ) |
const |
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 267 of file RanecuEngine.cc.
269 char beginMarker[] =
"RanecuEngine-begin";
270 os << beginMarker <<
"\nUvec\n";
271 std::vector<unsigned long>
v =
put();
272 for (
unsigned int i=0; i<v.size(); ++i) {
std::vector< unsigned long > put() const
◆ put() [2/2]
std::vector< unsigned long > CLHEP::RanecuEngine::put |
( |
| ) |
const |
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 278 of file RanecuEngine.cc.
279 std::vector<unsigned long>
v;
280 v.push_back (engineIDulong<RanecuEngine>());
281 v.push_back(static_cast<unsigned long>(
theSeed));
282 v.push_back(static_cast<unsigned long>(
table[
theSeed][0]));
283 v.push_back(static_cast<unsigned long>(
table[theSeed][1]));
◆ restoreStatus()
void CLHEP::RanecuEngine::restoreStatus |
( |
const char |
filename[] = "Ranecu.conf" | ) |
|
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 152 of file RanecuEngine.cc.
156 std::cerr <<
" -- Engine state remains unchanged\n";
160 std::vector<unsigned long>
v;
165 inFile.clear(std::ios::badbit | inFile.rdstate());
166 std::cerr <<
"\nJamesRandom state (vector) description improper." 167 <<
"\nrestoreStatus has failed." 168 <<
"\nInput stream is probably mispositioned now." << std::endl;
177 if (!inFile.bad() && !inFile.eof()) {
179 for (
int i=0; i<2; ++i)
static std::string engineName()
static const unsigned int VECTOR_STATE_SIZE
virtual std::istream & getState(std::istream &is)
static bool checkFile(std::istream &file, const std::string &filename, const std::string &classname, const std::string &methodname)
bool possibleKeywordInput(IS &is, const std::string &key, T &t)
◆ saveStatus()
void CLHEP::RanecuEngine::saveStatus |
( |
const char |
filename[] = "Ranecu.conf" | ) |
const |
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 139 of file RanecuEngine.cc.
141 std::ofstream outFile( filename, std::ios::out ) ;
143 if (!outFile.bad()) {
145 std::vector<unsigned long>
v =
put();
146 for (
unsigned int i=0; i<v.size(); ++i) {
147 outFile << v[i] <<
"\n";
std::vector< unsigned long > put() const
◆ setIndex()
void CLHEP::RanecuEngine::setIndex |
( |
long |
index | ) |
|
◆ setSeed()
void CLHEP::RanecuEngine::setSeed |
( |
long |
index, |
|
|
int |
dum = 0 |
|
) |
| |
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 110 of file RanecuEngine.cc.
void further_randomize(int seq, int col, int index, int modulus)
static void getTheTableSeeds(long *seeds, int index)
◆ setSeeds()
void CLHEP::RanecuEngine::setSeeds |
( |
const long * |
seeds, |
|
|
int |
index = -1 |
|
) |
| |
|
virtual |
◆ showStatus()
void CLHEP::RanecuEngine::showStatus |
( |
| ) |
const |
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 185 of file RanecuEngine.cc.
187 std::cout << std::endl;
188 std::cout <<
"--------- Ranecu engine status ---------" << std::endl;
189 std::cout <<
" Initial seed (index) = " <<
theSeed << std::endl;
190 std::cout <<
" Current couple of seeds = " 193 std::cout <<
"----------------------------------------" << std::endl;
◆ ecuyer_a
const int CLHEP::RanecuEngine::ecuyer_a = 40014 |
|
staticprotected |
◆ ecuyer_b
const int CLHEP::RanecuEngine::ecuyer_b = 53668 |
|
staticprotected |
◆ ecuyer_c
const int CLHEP::RanecuEngine::ecuyer_c = 12211 |
|
staticprotected |
◆ ecuyer_d
const int CLHEP::RanecuEngine::ecuyer_d = 40692 |
|
staticprotected |
◆ ecuyer_e
const int CLHEP::RanecuEngine::ecuyer_e = 52774 |
|
staticprotected |
◆ ecuyer_f
const int CLHEP::RanecuEngine::ecuyer_f = 3791 |
|
staticprotected |
◆ maxSeq
const int CLHEP::RanecuEngine::maxSeq = 215 |
|
staticprivate |
◆ seq
int CLHEP::RanecuEngine::seq |
|
private |
◆ shift1
const int CLHEP::RanecuEngine::shift1 = 2147483563 |
|
staticprotected |
◆ shift2
const int CLHEP::RanecuEngine::shift2 = 2147483399 |
|
staticprotected |
◆ table
long CLHEP::RanecuEngine::table[215][2] |
|
private |
◆ VECTOR_STATE_SIZE
const unsigned int CLHEP::RanecuEngine::VECTOR_STATE_SIZE = 4 |
|
staticprotected |
The documentation for this class was generated from the following files: