#include <RanecuEngine.h>
CLHEP::RanecuEngine::RanecuEngine |
( |
std::istream & |
is | ) |
|
CLHEP::RanecuEngine::RanecuEngine |
( |
| ) |
|
Definition at line 68 of file RanecuEngine.cc.
71 int numEngines = numberOfEngines++;
72 int cycle = std::abs(
int(numEngines/maxSeq));
73 seq = 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)
CLHEP::RanecuEngine::RanecuEngine |
( |
int |
index | ) |
|
Definition at line 86 of file RanecuEngine.cc.
89 int cycle = std::abs(
int(index/maxSeq));
90 seq = std::abs(
int(index%maxSeq));
92 long mask = ((cycle & 0x000007ff) << 20);
93 for (
int j=0; j<maxSeq; ++j) {
99 further_randomize (seq, 0, index,
shift1);
static void getTheTableSeeds(long *seeds, int index)
CLHEP::RanecuEngine::~RanecuEngine |
( |
| ) |
|
|
virtual |
std::string CLHEP::RanecuEngine::beginTag |
( |
| ) |
|
|
static |
static std::string CLHEP::RanecuEngine::engineName |
( |
| ) |
|
|
inlinestatic |
double CLHEP::RanecuEngine::flat |
( |
| ) |
|
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 196 of file RanecuEngine.cc.
198 const int index = seq;
199 long seed1 = table[index][0];
200 long seed2 = table[index][1];
206 if (seed1 < 0) seed1 +=
shift1;
208 if (seed2 < 0) seed2 +=
shift2;
210 table[index][0] = seed1;
211 table[index][1] = seed2;
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
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
static const int ecuyer_e
static const int ecuyer_d
static const int ecuyer_c
void CLHEP::RanecuEngine::flatArray |
( |
const int |
size, |
|
|
double * |
vect |
|
) |
| |
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 219 of file RanecuEngine.cc.
221 const int index = seq;
222 long seed1 = table[index][0];
223 long seed2 = table[index][1];
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);
242 table[index][0] = seed1;
243 table[index][1] = seed2;
static const int ecuyer_b
static const int ecuyer_f
static const int ecuyer_a
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
static const int ecuyer_e
static const int ecuyer_d
static const int ecuyer_c
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)
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)
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)
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
bool possibleKeywordInput(IS &is, const std::string &key, T &t)
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
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
std::string CLHEP::RanecuEngine::name |
( |
| ) |
const |
|
virtual |
CLHEP::RanecuEngine::operator unsigned int |
( |
| ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 246 of file RanecuEngine.cc.
247 const int index = seq;
248 long seed1 = table[index][0];
249 long seed2 = table[index][1];
255 if (seed1 < 0) seed1 +=
shift1;
257 if (seed2 < 0) seed2 +=
shift2;
259 table[index][0] = seed1;
260 table[index][1] = seed2;
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
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
static const int ecuyer_e
static const int ecuyer_d
static const int ecuyer_c
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
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]));
void CLHEP::RanecuEngine::restoreStatus |
( |
const char |
filename[] = "Ranecu.conf" | ) |
|
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 152 of file RanecuEngine.cc.
154 std::ifstream inFile( filename, std::ios::in);
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)
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
bool possibleKeywordInput(IS &is, const std::string &key, T &t)
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
void CLHEP::RanecuEngine::setIndex |
( |
long |
index | ) |
|
void CLHEP::RanecuEngine::setSeed |
( |
long |
index, |
|
|
int |
dum = 0 |
|
) |
| |
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 110 of file RanecuEngine.cc.
112 seq = std::abs(
int(index%maxSeq));
116 further_randomize (seq, 0, index,
shift1);
117 further_randomize (seq, 1, dum,
shift2);
static void getTheTableSeeds(long *seeds, int index)
void CLHEP::RanecuEngine::setSeeds |
( |
const long * |
seeds, |
|
|
int |
index = -1 |
|
) |
| |
|
virtual |
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 = "
192 << table[
theSeed][1] << std::endl;
193 std::cout <<
"----------------------------------------" << std::endl;
const int CLHEP::RanecuEngine::ecuyer_a = 40014 |
|
staticprotected |
const int CLHEP::RanecuEngine::ecuyer_b = 53668 |
|
staticprotected |
const int CLHEP::RanecuEngine::ecuyer_c = 12211 |
|
staticprotected |
const int CLHEP::RanecuEngine::ecuyer_d = 40692 |
|
staticprotected |
const int CLHEP::RanecuEngine::ecuyer_e = 52774 |
|
staticprotected |
const int CLHEP::RanecuEngine::ecuyer_f = 3791 |
|
staticprotected |
const int CLHEP::RanecuEngine::shift1 = 2147483563 |
|
staticprotected |
const int CLHEP::RanecuEngine::shift2 = 2147483399 |
|
staticprotected |
const unsigned int CLHEP::RanecuEngine::VECTOR_STATE_SIZE = 4 |
|
staticprotected |
The documentation for this class was generated from the following files: