#include <MTwistEngine.h>
- Author
Definition at line 34 of file MTwistEngine.h.
◆ anonymous enum
◆ MTwistEngine() [1/4]
CLHEP::MTwistEngine::MTwistEngine |
( |
| ) |
|
◆ MTwistEngine() [2/4]
CLHEP::MTwistEngine::MTwistEngine |
( |
long |
seed | ) |
|
◆ MTwistEngine() [3/4]
CLHEP::MTwistEngine::MTwistEngine |
( |
int |
rowIndex, |
|
|
int |
colIndex |
|
) |
| |
◆ MTwistEngine() [4/4]
CLHEP::MTwistEngine::MTwistEngine |
( |
std::istream & |
is | ) |
|
◆ ~MTwistEngine()
CLHEP::MTwistEngine::~MTwistEngine |
( |
| ) |
|
|
virtual |
◆ beginTag()
std::string CLHEP::MTwistEngine::beginTag |
( |
| ) |
|
|
static |
Definition at line 346 of file MTwistEngine.cc.
346 {
347 return "MTwistEngine-begin";
348}
◆ checkFile()
bool CLHEP::HepRandomEngine::checkFile |
( |
std::istream & |
file, |
|
|
const std::string & |
filename, |
|
|
const std::string & |
classname, |
|
|
const std::string & |
methodname |
|
) |
| |
|
staticprotectedinherited |
◆ engineName()
static std::string CLHEP::MTwistEngine::engineName |
( |
| ) |
|
|
inlinestatic |
◆ exponent_bit_32()
static double CLHEP::HepRandomEngine::exponent_bit_32 |
( |
| ) |
|
|
inlinestaticprotectedinherited |
◆ flat()
double CLHEP::MTwistEngine::flat |
( |
| ) |
|
|
virtual |
◆ flatArray()
void CLHEP::MTwistEngine::flatArray |
( |
const int |
size, |
|
|
double * |
vect |
|
) |
| |
|
virtual |
◆ get() [1/2]
bool CLHEP::MTwistEngine::get |
( |
const std::vector< unsigned long > & |
v | ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 368 of file MTwistEngine.cc.
368 {
369 if ((v[0] & 0xffffffffUL) != engineIDulong<MTwistEngine>()) {
370 std::cerr <<
371 "\nMTwistEngine get:state vector has wrong ID word - state unchanged\n";
372 return false;
373 }
375}
virtual std::istream & getState(std::istream &is)
References getState().
◆ get() [2/2]
std::istream & CLHEP::MTwistEngine::get |
( |
std::istream & |
is | ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 328 of file MTwistEngine.cc.
329{
331 is >> std::ws;
333
334
335 is >> beginMarker;
336 if (strcmp(beginMarker,"MTwistEngine-begin")) {
337 is.clear(std::ios::badbit | is.rdstate());
338 std::cerr << "\nInput stream mispositioned or"
339 << "\nMTwistEngine state description missing or"
340 << "\nwrong engine type found." << std::endl;
341 return is;
342 }
344}
static const int MarkerLen
References getState(), and CLHEP::MarkerLen.
◆ getSeed()
long CLHEP::HepRandomEngine::getSeed |
( |
| ) |
const |
|
inlineinherited |
◆ getSeeds()
const long * CLHEP::HepRandomEngine::getSeeds |
( |
| ) |
const |
|
inlineinherited |
◆ getState() [1/2]
bool CLHEP::MTwistEngine::getState |
( |
const std::vector< unsigned long > & |
v | ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 377 of file MTwistEngine.cc.
377 {
379 std::cerr <<
380 "\nMTwistEngine get:state vector has wrong length - state unchanged\n";
381 return false;
382 }
383 for (int i=0; i<624; ++i) {
385 }
387 return true;
388}
static const unsigned int VECTOR_STATE_SIZE
References count624, mt, and VECTOR_STATE_SIZE.
◆ getState() [2/2]
std::istream & CLHEP::MTwistEngine::getState |
( |
std::istream & |
is | ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 350 of file MTwistEngine.cc.
351{
354 for (
int i=0; i<624; ++i) is >>
mt[i];
356 is >> std::ws;
358 is >> endMarker;
359 if (strcmp(endMarker,"MTwistEngine-end")) {
360 is.clear(std::ios::badbit | is.rdstate());
361 std::cerr << "\nMTwistEngine state description incomplete."
362 << "\nInput stream is probably mispositioned now." << std::endl;
363 return is;
364 }
365 return is;
366}
References count624, CLHEP::MarkerLen, mt, and CLHEP::HepRandomEngine::theSeed.
Referenced by get().
◆ mantissa_bit_12()
static double CLHEP::HepRandomEngine::mantissa_bit_12 |
( |
| ) |
|
|
inlinestaticprotectedinherited |
◆ mantissa_bit_24()
static double CLHEP::HepRandomEngine::mantissa_bit_24 |
( |
| ) |
|
|
inlinestaticprotectedinherited |
◆ mantissa_bit_32()
static double CLHEP::HepRandomEngine::mantissa_bit_32 |
( |
| ) |
|
|
inlinestaticprotectedinherited |
◆ name()
std::string CLHEP::MTwistEngine::name |
( |
| ) |
const |
|
virtual |
◆ nearlyTwoToMinus_54()
static double CLHEP::HepRandomEngine::nearlyTwoToMinus_54 |
( |
| ) |
|
|
inlinestaticprotectedinherited |
◆ newEngine() [1/2]
HepRandomEngine * CLHEP::HepRandomEngine::newEngine |
( |
const std::vector< unsigned long > & |
v | ) |
|
|
staticinherited |
◆ newEngine() [2/2]
◆ operator double()
CLHEP::MTwistEngine::operator double |
( |
| ) |
|
|
virtual |
◆ operator float()
CLHEP::MTwistEngine::operator float |
( |
| ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 239 of file MTwistEngine.cc.
239 {
240 unsigned int y;
241
243 int i;
244
246 y = (
mt[i] & 0x80000000) | (
mt[i+1] & 0x7fffffff);
247 mt[i] =
mt[i+
M] ^ (y >> 1) ^ ((y & 0x1) ? 0x9908b0df : 0x0 );
248 }
249
250 for( ; i <
N-1 ; ++i ) {
251 y = (
mt[i] & 0x80000000) | (
mt[i+1] & 0x7fffffff);
252 mt[i] =
mt[i-
NminusM] ^ (y >> 1) ^ ((y & 0x1) ? 0x9908b0df : 0x0 );
253 }
254
255 y = (
mt[i] & 0x80000000) | (
mt[0] & 0x7fffffff);
256 mt[i] =
mt[
M-1] ^ (y >> 1) ^ ((y & 0x1) ? 0x9908b0df : 0x0 );
257
259 }
260
262 y ^= ( y >> 11);
263 y ^= ((y << 7 ) & 0x9d2c5680);
264 y ^= ((y << 15) & 0xefc60000);
265 y ^= ( y >> 18);
266
268}
References M.
◆ operator unsigned int()
CLHEP::MTwistEngine::operator unsigned int |
( |
| ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 270 of file MTwistEngine.cc.
270 {
271 unsigned int y;
272
274 int i;
275
277 y = (
mt[i] & 0x80000000) | (
mt[i+1] & 0x7fffffff);
278 mt[i] =
mt[i+
M] ^ (y >> 1) ^ ((y & 0x1) ? 0x9908b0df : 0x0 );
279 }
280
281 for( ; i <
N-1 ; ++i ) {
282 y = (
mt[i] & 0x80000000) | (
mt[i+1] & 0x7fffffff);
283 mt[i] =
mt[i-
NminusM] ^ (y >> 1) ^ ((y & 0x1) ? 0x9908b0df : 0x0 );
284 }
285
286 y = (
mt[i] & 0x80000000) | (
mt[0] & 0x7fffffff);
287 mt[i] =
mt[
M-1] ^ (y >> 1) ^ ((y & 0x1) ? 0x9908b0df : 0x0 );
288
290 }
291
293 y ^= ( y >> 11);
294 y ^= ((y << 7 ) & 0x9d2c5680);
295 y ^= ((y << 15) & 0xefc60000);
296 y ^= ( y >> 18);
297
298 return y;
299}
References M.
◆ operator!=()
◆ operator==()
◆ put() [1/2]
std::vector< unsigned long > CLHEP::MTwistEngine::put |
( |
| ) |
const |
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 318 of file MTwistEngine.cc.
318 {
319 std::vector<unsigned long> v;
320 v.push_back (engineIDulong<MTwistEngine>());
321 for (int i=0; i<624; ++i) {
322 v.push_back(
static_cast<unsigned long>(
mt[i]));
323 }
325 return v;
326}
References count624, and mt.
◆ put() [2/2]
std::ostream & CLHEP::MTwistEngine::put |
( |
std::ostream & |
os | ) |
const |
|
virtual |
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 301 of file MTwistEngine.cc.
302{
303 char beginMarker[] = "MTwistEngine-begin";
304 char endMarker[] = "MTwistEngine-end";
305
306 int pr = os.precision(20);
307 os << " " << beginMarker << " ";
309 for (int i=0; i<624; ++i) {
311 }
313 os << endMarker << "\n";
314 os.precision(pr);
315 return os;
316}
References count624, mt, and CLHEP::HepRandomEngine::theSeed.
◆ restoreStatus()
void CLHEP::MTwistEngine::restoreStatus |
( |
const char |
filename[] = "MTwist.conf" | ) |
|
|
virtual |
◆ saveStatus()
void CLHEP::MTwistEngine::saveStatus |
( |
const char |
filename[] = "MTwist.conf" | ) |
const |
|
virtual |
◆ setSeed()
void CLHEP::MTwistEngine::setSeed |
( |
long |
seed, |
|
|
int |
k |
|
) |
| |
|
virtual |
◆ setSeeds()
void CLHEP::MTwistEngine::setSeeds |
( |
const long * |
seeds, |
|
|
int |
k |
|
) |
| |
|
virtual |
◆ showStatus()
void CLHEP::MTwistEngine::showStatus |
( |
| ) |
const |
|
virtual |
Implements CLHEP::HepRandomEngine.
Definition at line 216 of file MTwistEngine.cc.
217{
218 std::cout << std::endl;
219 std::cout << "--------- MTwist engine status ---------" << std::endl;
220 std::cout << std::setprecision(20);
221 std::cout <<
" Initial seed = " <<
theSeed << std::endl;
222 std::cout <<
" Current index = " <<
count624 << std::endl;
223 std::cout << " Array status mt[] = " << std::endl;
224
225
226 for (int i=0; i<620; i+=5) {
227 std::cout <<
mt[i] <<
" " <<
mt[i+1] <<
" " <<
mt[i+2] <<
" "
228 <<
mt[i+3] <<
" " <<
mt[i+4] <<
"\n";
229 }
230 std::cout <<
mt[620] <<
" " <<
mt[621] <<
" " <<
mt[622] <<
" "
231 <<
mt[623] << std::endl;
232 std::cout << "----------------------------------------" << std::endl;
233}
References count624, mt, and CLHEP::HepRandomEngine::theSeed.
◆ twoToMinus_32()
static double CLHEP::HepRandomEngine::twoToMinus_32 |
( |
| ) |
|
|
inlinestaticprotectedinherited |
◆ twoToMinus_48()
static double CLHEP::HepRandomEngine::twoToMinus_48 |
( |
| ) |
|
|
inlinestaticprotectedinherited |
◆ twoToMinus_49()
static double CLHEP::HepRandomEngine::twoToMinus_49 |
( |
| ) |
|
|
inlinestaticprotectedinherited |
◆ twoToMinus_53()
static double CLHEP::HepRandomEngine::twoToMinus_53 |
( |
| ) |
|
|
inlinestaticprotectedinherited |
◆ count624
int CLHEP::MTwistEngine::count624 |
|
private |
◆ mt
unsigned int CLHEP::MTwistEngine::mt[624] |
|
private |
◆ theSeed
long CLHEP::HepRandomEngine::theSeed |
|
protectedinherited |
Definition at line 142 of file RandomEngine.h.
Referenced by CLHEP::DualRand::DualRand(), CLHEP::HepRandomEngine::getSeed(), CLHEP::DualRand::getState(), CLHEP::HepJamesRandom::getState(), CLHEP::MixMaxRng::getState(), getState(), CLHEP::RanecuEngine::getState(), CLHEP::Ranlux64Engine::getState(), CLHEP::RanluxEngine::getState(), CLHEP::RanshiEngine::getState(), CLHEP::HepJamesRandom::HepJamesRandom(), CLHEP::MixMaxRng::MixMaxRng(), CLHEP::RanecuEngine::put(), CLHEP::MixMaxRng::put(), put(), CLHEP::RanecuEngine::RanecuEngine(), CLHEP::RanluxEngine::RanluxEngine(), CLHEP::RanluxppEngine::RanluxppEngine(), CLHEP::RanshiEngine::RanshiEngine(), CLHEP::DualRand::restoreStatus(), CLHEP::HepJamesRandom::restoreStatus(), restoreStatus(), CLHEP::RanecuEngine::restoreStatus(), CLHEP::RanluxEngine::restoreStatus(), CLHEP::Ranlux64Engine::restoreStatus(), CLHEP::RanshiEngine::restoreStatus(), saveStatus(), CLHEP::RanecuEngine::setIndex(), CLHEP::RanecuEngine::setSeed(), CLHEP::HepJamesRandom::setSeed(), CLHEP::MixMaxRng::setSeed(), CLHEP::RanluxppEngine::setSeed(), CLHEP::Ranlux64Engine::setSeed(), CLHEP::RanluxEngine::setSeed(), CLHEP::DualRand::setSeed(), setSeed(), CLHEP::RanecuEngine::setSeeds(), CLHEP::Ranlux64Engine::setSeeds(), CLHEP::RanluxEngine::setSeeds(), CLHEP::MixMaxRng::setSeeds(), CLHEP::RanshiEngine::setSeeds(), CLHEP::DualRand::showStatus(), CLHEP::HepJamesRandom::showStatus(), showStatus(), CLHEP::RanecuEngine::showStatus(), CLHEP::Ranlux64Engine::showStatus(), CLHEP::RanluxEngine::showStatus(), and CLHEP::RanshiEngine::showStatus().
◆ theSeeds
const long* CLHEP::HepRandomEngine::theSeeds |
|
protectedinherited |
Definition at line 143 of file RandomEngine.h.
Referenced by CLHEP::HepRandomEngine::getSeeds(), CLHEP::RanecuEngine::RanecuEngine(), CLHEP::RanecuEngine::setIndex(), CLHEP::RanecuEngine::setSeed(), CLHEP::HepJamesRandom::setSeeds(), CLHEP::RanluxppEngine::setSeeds(), CLHEP::RanecuEngine::setSeeds(), CLHEP::Ranlux64Engine::setSeeds(), CLHEP::RanluxEngine::setSeeds(), CLHEP::MixMaxRng::setSeeds(), CLHEP::DualRand::setSeeds(), setSeeds(), and CLHEP::RanshiEngine::setSeeds().
◆ VECTOR_STATE_SIZE
const unsigned int CLHEP::MTwistEngine::VECTOR_STATE_SIZE = 626 |
|
static |
The documentation for this class was generated from the following files: