#include <RanshiEngine.h>
- Author
Definition at line 52 of file RanshiEngine.h.
◆ anonymous enum
◆ RanshiEngine() [1/4]
CLHEP::RanshiEngine::RanshiEngine |
( |
| ) |
|
Definition at line 63 of file RanshiEngine.cc.
67 int numEngines = numberOfEngines++;
70 buffer[i] = (
unsigned int)((numEngines+19780503
L*(i+1))& 0xffffffff);
76 for( i = 0; i < 10000; ++i)
flat();
unsigned int buffer[numBuff]
◆ RanshiEngine() [2/4]
CLHEP::RanshiEngine::RanshiEngine |
( |
std::istream & |
is | ) |
|
◆ RanshiEngine() [3/4]
CLHEP::RanshiEngine::RanshiEngine |
( |
long |
seed | ) |
|
Definition at line 86 of file RanshiEngine.cc.
90 for (
int i = 0; i <
numBuff; ++i) {
91 buffer[i] = (
unsigned int)seed&0xffffffff;
96 for (j = 0; j < numBuff*20; ++j) {
unsigned int buffer[numBuff]
◆ RanshiEngine() [4/4]
CLHEP::RanshiEngine::RanshiEngine |
( |
int |
rowIndex, |
|
|
int |
colIndex |
|
) |
| |
Definition at line 101 of file RanshiEngine.cc.
107 buffer[i] = (
unsigned int)((rowIndex + (i+1)*(colIndex+8))&0xffffffff);
111 redSpin = colIndex & 0xffffffff;
112 for( i = 0; i < 100; ++i)
flat();
unsigned int buffer[numBuff]
◆ ~RanshiEngine()
CLHEP::RanshiEngine::~RanshiEngine |
( |
| ) |
|
|
virtual |
◆ beginTag()
std::string CLHEP::RanshiEngine::beginTag |
( |
| ) |
|
|
static |
◆ engineName()
static std::string CLHEP::RanshiEngine::engineName |
( |
| ) |
|
|
inlinestatic |
◆ flat()
double CLHEP::RanshiEngine::flat |
( |
| ) |
|
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 117 of file RanshiEngine.cc.
119 unsigned int blkSpin =
buffer[redAngle] & 0xffffffff;
120 unsigned int boostResult = blkSpin ^
redSpin;
122 buffer[redAngle] = ((blkSpin << 17) | (blkSpin >> (32-17))) ^ redSpin;
124 redSpin = (blkSpin +
numFlats++) & 0xffffffff;
static double nearlyTwoToMinus_54()
static double twoToMinus_32()
static double twoToMinus_53()
unsigned int buffer[numBuff]
◆ flatArray()
void CLHEP::RanshiEngine::flatArray |
( |
const int |
size, |
|
|
double * |
vect |
|
) |
| |
|
virtual |
◆ get() [1/2]
std::istream & CLHEP::RanshiEngine::get |
( |
std::istream & |
is | ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 266 of file RanshiEngine.cc.
273 if (strcmp(beginMarker,
"RanshiEngine-begin")) {
274 is.clear(std::ios::badbit | is.rdstate());
275 std::cerr <<
"\nInput mispositioned or" 276 <<
"\nRanshiEngine state description missing or" 277 <<
"\nwrong engine type found." << std::endl;
static const int MarkerLen
virtual std::istream & getState(std::istream &is)
◆ get() [2/2]
bool CLHEP::RanshiEngine::get |
( |
const std::vector< unsigned long > & |
v | ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 325 of file RanshiEngine.cc.
326 if ((
v[0] & 0xffffffffUL) != engineIDulong<RanshiEngine>()) {
328 "\nRanshiEngine get:state vector has wrong ID word - state unchanged\n";
virtual std::istream & getState(std::istream &is)
◆ getState() [1/2]
std::istream & CLHEP::RanshiEngine::getState |
( |
std::istream & |
is | ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 287 of file RanshiEngine.cc.
289 std::vector<unsigned long>
v;
294 is.clear(std::ios::badbit | is.rdstate());
295 std::cerr <<
"\nRanshiEngine state (vector) description improper." 296 <<
"\ngetState() has failed." 297 <<
"\nInput stream is probably mispositioned now." << std::endl;
309 for (
int i = 0; i <
numBuff; ++i) {
316 if (strcmp(endMarker,
"RanshiEngine-end")) {
317 is.clear(std::ios::badbit | is.rdstate());
318 std::cerr <<
"\nRanshiEngine state description incomplete." 319 <<
"\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)
unsigned int buffer[numBuff]
◆ getState() [2/2]
bool CLHEP::RanshiEngine::getState |
( |
const std::vector< unsigned long > & |
v | ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 334 of file RanshiEngine.cc.
337 "\nRanshiEngine get:state vector has wrong length - state unchanged\n";
340 for (
int i = 0; i <
numBuff; ++i) {
static const unsigned int VECTOR_STATE_SIZE
unsigned int buffer[numBuff]
◆ name()
std::string CLHEP::RanshiEngine::name |
( |
| ) |
const |
|
virtual |
◆ operator float()
CLHEP::RanshiEngine::operator float |
( |
| ) |
|
|
virtual |
◆ operator unsigned int()
CLHEP::RanshiEngine::operator unsigned int |
( |
| ) |
|
|
virtual |
◆ put() [1/2]
std::ostream & CLHEP::RanshiEngine::put |
( |
std::ostream & |
os | ) |
const |
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 244 of file RanshiEngine.cc.
245 char beginMarker[] =
"RanshiEngine-begin";
246 os << beginMarker <<
"\nUvec\n";
247 std::vector<unsigned long>
v =
put();
248 for (
unsigned int i=0; i<v.size(); ++i) {
std::vector< unsigned long > put() const
◆ put() [2/2]
std::vector< unsigned long > CLHEP::RanshiEngine::put |
( |
| ) |
const |
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 254 of file RanshiEngine.cc.
255 std::vector<unsigned long>
v;
256 v.push_back (engineIDulong<RanshiEngine>());
257 for (
int i = 0; i <
numBuff; ++i) {
258 v.push_back(static_cast<unsigned long>(
buffer[i]));
260 v.push_back(static_cast<unsigned long>(
redSpin));
261 v.push_back(static_cast<unsigned long>(
numFlats));
262 v.push_back(static_cast<unsigned long>(
halfBuff));
unsigned int buffer[numBuff]
◆ restoreStatus()
void CLHEP::RanshiEngine::restoreStatus |
( |
const char |
filename[] = "RanshiEngine.conf" | ) |
|
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 170 of file RanshiEngine.cc.
173 std::cerr <<
" -- Engine state remains unchanged\n";
177 std::vector<unsigned long>
v;
182 inFile.clear(std::ios::badbit | inFile.rdstate());
183 std::cerr <<
"\nRanshiEngine state (vector) description improper." 184 <<
"\nrestoreStatus has failed." 185 <<
"\nInput stream is probably mispositioned now." << std::endl;
196 for (
int i = 0; i <
numBuff; ++i) {
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)
bool possibleKeywordInput(IS &is, const std::string &key, T &t)
virtual std::istream & getState(std::istream &is)
unsigned int buffer[numBuff]
static std::string engineName()
◆ saveStatus()
void CLHEP::RanshiEngine::saveStatus |
( |
const char |
filename[] = "RanshiEngine.conf" | ) |
const |
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 159 of file RanshiEngine.cc.
160 std::ofstream outFile(filename, std::ios::out);
161 if (!outFile.bad()) {
163 std::vector<unsigned long>
v =
put();
164 for (
unsigned int i=0; i<v.size(); ++i) {
165 outFile << v[i] <<
"\n";
std::vector< unsigned long > put() const
◆ setSeed()
void CLHEP::RanshiEngine::setSeed |
( |
long |
seed, |
|
|
int |
|
|
) |
| |
|
virtual |
◆ setSeeds()
void CLHEP::RanshiEngine::setSeeds |
( |
const long * |
seeds, |
|
|
int |
|
|
) |
| |
|
virtual |
◆ showStatus()
void CLHEP::RanshiEngine::showStatus |
( |
| ) |
const |
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 203 of file RanshiEngine.cc.
204 std::cout << std::setprecision(20) << std::endl;
205 std::cout <<
"----------- Ranshi engine status ----------" << std::endl;
206 std::cout <<
"Initial seed = " <<
theSeed << std::endl;
207 std::cout <<
"Current red spin = " <<
redSpin << std::endl;
208 std::cout <<
"Values produced = " <<
numFlats << std::endl;
209 std::cout <<
"Side of buffer = " << (
halfBuff ?
"upper" :
"lower")
211 std::cout <<
"Current buffer = " << std::endl;
212 for (
int i = 0; i <
numBuff; i+=4) {
214 <<
buffer[i] << std::setw(11) <<
buffer[i+1] << std::setw(11)
215 <<
buffer[i+2] << std::setw(11) <<
buffer[i+3] << std::endl;
217 std::cout <<
"-------------------------------------------" << std::endl;
unsigned int buffer[numBuff]
◆ buffer
unsigned int CLHEP::RanshiEngine::buffer[numBuff] |
|
private |
◆ halfBuff
unsigned int CLHEP::RanshiEngine::halfBuff |
|
private |
◆ numFlats
unsigned int CLHEP::RanshiEngine::numFlats |
|
private |
◆ redSpin
unsigned int CLHEP::RanshiEngine::redSpin |
|
private |
◆ VECTOR_STATE_SIZE
const unsigned int CLHEP::RanshiEngine::VECTOR_STATE_SIZE = numBuff + 4 |
|
staticprivate |
The documentation for this class was generated from the following files: