#include <RanluxEngine.h>
- Author
 
Definition at line 45 of file RanluxEngine.h.
 
      
        
          | CLHEP::RanluxEngine::RanluxEngine  | 
          ( | 
          std::istream &  | 
          is | ) | 
           | 
        
      
 
 
      
        
          | CLHEP::RanluxEngine::RanluxEngine  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 76 of file RanluxEngine.cc.
   80    long seedlist[2]={0,0};
 
   83    int numEngines = numberOfEngines++;
 
   84    int cycle = std::abs(
int(numEngines/maxIndex));
 
   85    int curIndex = std::abs(
int(numEngines%maxIndex));
 
   87    long mask = ((cycle & 0x007fffff) << 8);
 
   89    seed = seedlist[0]^
mask;
 
void setSeeds(const long *seeds, int lux=3)
 
void setSeed(long seed, int lux=3)
 
static void getTheTableSeeds(long *seeds, int index)
 
 
 
 
      
        
          | CLHEP::RanluxEngine::RanluxEngine  | 
          ( | 
          long  | 
          seed,  | 
        
        
           | 
           | 
          int  | 
          lux = 3  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 62 of file RanluxEngine.cc.
   65    long seedlist[2]={0,0};
 
void setSeeds(const long *seeds, int lux=3)
 
void setSeed(long seed, int lux=3)
 
static constexpr double lux
 
 
 
 
      
        
          | CLHEP::RanluxEngine::RanluxEngine  | 
          ( | 
          int  | 
          rowIndex,  | 
        
        
           | 
           | 
          int  | 
          colIndex,  | 
        
        
           | 
           | 
          int  | 
          lux  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 98 of file RanluxEngine.cc.
  102    long seedlist[2]={0,0};
 
  105    int cycle = std::abs(
int(rowIndex/maxIndex));
 
  106    int row = std::abs(
int(rowIndex%maxIndex));
 
  107    int col = std::abs(
int(colIndex%2));
 
  108    long mask = (( cycle & 0x000007ff ) << 20 );
 
  110    seed = ( seedlist[col] )^mask;
 
void setSeeds(const long *seeds, int lux=3)
 
void setSeed(long seed, int lux=3)
 
static constexpr double lux
 
static void getTheTableSeeds(long *seeds, int index)
 
 
 
 
  
  
      
        
          | CLHEP::RanluxEngine::~RanluxEngine  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
virtual   | 
  
 
 
  
  
      
        
          | std::string CLHEP::RanluxEngine::beginTag  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
static   | 
  
 
 
  
  
      
        
          | static std::string CLHEP::RanluxEngine::engineName  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inlinestatic   | 
  
 
 
  
  
      
        
          | double CLHEP::RanluxEngine::flat  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
virtual   | 
  
 
Implements CLHEP::HepRandomEngine.
Definition at line 311 of file RanluxEngine.cc.
  317   uni = float_seed_table[j_lag] - float_seed_table[i_lag] - carry;
 
  325   float_seed_table[i_lag] = uni;
 
  328   if(i_lag < 0) i_lag = 23;
 
  329   if(j_lag < 0) j_lag = 23;
 
  343      for( i = 0; i != nskip ; i++){
 
  344          uni = float_seed_table[j_lag] - float_seed_table[i_lag] - carry;
 
  351          float_seed_table[i_lag] = uni;
 
  354          if(i_lag < 0)i_lag = 23;
 
  355          if(j_lag < 0) j_lag = 23;
 
  358   return (
double) next_random;
 
static double mantissa_bit_24()
 
static double mantissa_bit_12()
 
 
 
 
  
  
      
        
          | void CLHEP::RanluxEngine::flatArray  | 
          ( | 
          const int  | 
          size,  | 
         
        
           | 
           | 
          double *  | 
          vect  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
virtual   | 
  
 
Implements CLHEP::HepRandomEngine.
Definition at line 361 of file RanluxEngine.cc.
  368   for (index=0; index<size; ++index) {
 
  369     uni = float_seed_table[j_lag] - float_seed_table[i_lag] - carry;
 
  377     float_seed_table[i_lag] = uni;
 
  380     if(i_lag < 0) i_lag = 23;
 
  381     if(j_lag < 0) j_lag = 23;
 
  388     vect[index] = (double)next_random;
 
  396        for( i = 0; i != nskip ; i++){
 
  397            uni = float_seed_table[j_lag] - float_seed_table[i_lag] - carry;
 
  404            float_seed_table[i_lag] = uni;
 
  407            if(i_lag < 0)i_lag = 23;
 
  408            if(j_lag < 0) j_lag = 23;
 
static double mantissa_bit_24()
 
static double mantissa_bit_12()
 
 
 
 
  
  
      
        
          | std::istream & CLHEP::RanluxEngine::get  | 
          ( | 
          std::istream &  | 
          is | ) | 
           | 
         
       
   | 
  
virtual   | 
  
 
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 448 of file RanluxEngine.cc.
  456   if (strcmp(beginMarker,
"RanluxEngine-begin")) {
 
  457      is.clear(std::ios::badbit | is.rdstate());
 
  458      std::cerr << 
"\nInput stream mispositioned or" 
  459            << 
"\nRanluxEngine state description missing or" 
  460            << 
"\nwrong engine type found." << std::endl;
 
static const int MarkerLen
 
virtual std::istream & getState(std::istream &is)
 
 
 
 
  
  
      
        
          | bool CLHEP::RanluxEngine::get  | 
          ( | 
          const std::vector< unsigned long > &  | 
          v | ) | 
           | 
         
       
   | 
  
virtual   | 
  
 
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 511 of file RanluxEngine.cc.
  512   if ((
v[0] & 0xffffffffUL) != engineIDulong<RanluxEngine>()) {
 
  514         "\nRanluxEngine get:state vector has wrong ID word - state unchanged\n";
 
virtual std::istream & getState(std::istream &is)
 
 
 
 
  
  
      
        
          | int CLHEP::RanluxEngine::getLuxury  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
 
  
  
      
        
          | std::istream & CLHEP::RanluxEngine::getState  | 
          ( | 
          std::istream &  | 
          is | ) | 
           | 
         
       
   | 
  
virtual   | 
  
 
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 470 of file RanluxEngine.cc.
  473     std::vector<unsigned long> 
v;
 
  478         is.clear(std::ios::badbit | is.rdstate());
 
  479         std::cerr << 
"\nRanluxEngine state (vector) description improper." 
  480         << 
"\ngetState() has failed." 
  481            << 
"\nInput stream is probably mispositioned now." << std::endl;
 
  493   for (
int i=0; i<24; ++i) {
 
  494      is >> float_seed_table[i];
 
  496   is >> i_lag; is >>  j_lag;
 
  497   is >> carry; is >> count24;
 
  498   is >> luxury; is >> nskip;
 
  502   if (strcmp(endMarker,
"RanluxEngine-end")) {
 
  503      is.clear(std::ios::badbit | is.rdstate());
 
  504      std::cerr << 
"\nRanluxEngine state description incomplete." 
  505            << 
"\nInput stream is probably mispositioned now." << std::endl;
 
static const int MarkerLen
 
bool possibleKeywordInput(IS &is, const std::string &key, T &t)
 
virtual std::istream & getState(std::istream &is)
 
static const unsigned int VECTOR_STATE_SIZE
 
 
 
 
  
  
      
        
          | bool CLHEP::RanluxEngine::getState  | 
          ( | 
          const std::vector< unsigned long > &  | 
          v | ) | 
           | 
         
       
   | 
  
virtual   | 
  
 
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 520 of file RanluxEngine.cc.
  523         "\nRanluxEngine get:state vector has wrong length - state unchanged\n";
 
  526   for (
int i=0; i<24; ++i) {
 
static double mantissa_bit_24()
 
static const unsigned int VECTOR_STATE_SIZE
 
 
 
 
  
  
      
        
          | std::string CLHEP::RanluxEngine::name  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
virtual   | 
  
 
 
  
  
      
        
          | CLHEP::RanluxEngine::operator unsigned int  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
virtual   | 
  
 
 
  
  
      
        
          | std::ostream & CLHEP::RanluxEngine::put  | 
          ( | 
          std::ostream &  | 
          os | ) | 
           const | 
         
       
   | 
  
virtual   | 
  
 
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 421 of file RanluxEngine.cc.
  423    char beginMarker[] = 
"RanluxEngine-begin";
 
  424   os << beginMarker << 
"\nUvec\n";
 
  425   std::vector<unsigned long> 
v = 
put();
 
  426   for (
unsigned int i=0; i<v.size(); ++i) {
 
std::vector< unsigned long > put() const 
 
 
 
 
  
  
      
        
          | std::vector< unsigned long > CLHEP::RanluxEngine::put  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
virtual   | 
  
 
Reimplemented from CLHEP::HepRandomEngine.
Definition at line 432 of file RanluxEngine.cc.
  433   std::vector<unsigned long> 
v;
 
  434   v.push_back (engineIDulong<RanluxEngine>());
 
  435   for (
int i=0; i<24; ++i) {
 
  439   v.push_back(static_cast<unsigned long>(i_lag));
 
  440   v.push_back(static_cast<unsigned long>(j_lag));
 
  442   v.push_back(static_cast<unsigned long>(count24));
 
  443   v.push_back(static_cast<unsigned long>(luxury));
 
  444   v.push_back(static_cast<unsigned long>(nskip));
 
static double mantissa_bit_24()
 
 
 
 
  
  
      
        
          | void CLHEP::RanluxEngine::restoreStatus  | 
          ( | 
          const char  | 
          filename[] = "Ranlux.conf" | ) | 
           | 
         
       
   | 
  
virtual   | 
  
 
Implements CLHEP::HepRandomEngine.
Definition at line 261 of file RanluxEngine.cc.
  263    std::ifstream inFile( filename, std::ios::in);
 
  265      std::cerr << 
"  -- Engine state remains unchanged\n";
 
  269     std::vector<unsigned long> 
v;
 
  274         inFile.clear(std::ios::badbit | inFile.rdstate());
 
  275         std::cerr << 
"\nRanluxEngine state (vector) description improper." 
  276            << 
"\nrestoreStatus has failed." 
  277            << 
"\nInput stream is probably mispositioned now." << std::endl;
 
  286    if (!inFile.bad() && !inFile.eof()) {
 
  288      for (
int i=0; i<24; ++i)
 
  289        inFile >> float_seed_table[i];
 
  290      inFile >> i_lag; inFile >> j_lag;
 
  291      inFile >> carry; inFile >> count24;
 
  292      inFile >> luxury; inFile >> nskip;
 
static std::string engineName()
 
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)
 
static const unsigned int VECTOR_STATE_SIZE
 
 
 
 
  
  
      
        
          | void CLHEP::RanluxEngine::saveStatus  | 
          ( | 
          const char  | 
          filename[] = "Ranlux.conf" | ) | 
           const | 
         
       
   | 
  
virtual   | 
  
 
Implements CLHEP::HepRandomEngine.
Definition at line 249 of file RanluxEngine.cc.
  251    std::ofstream outFile( filename, std::ios::out ) ;
 
  252   if (!outFile.bad()) {
 
  254     std::vector<unsigned long> 
v = 
put();
 
  255     for (
unsigned int i=0; i<v.size(); ++i) {
 
  256       outFile << v[i] << 
"\n";
 
std::vector< unsigned long > put() const 
 
 
 
 
  
  
      
        
          | void CLHEP::RanluxEngine::setSeed  | 
          ( | 
          long  | 
          seed,  | 
         
        
           | 
           | 
          int  | 
          lux = 3  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
virtual   | 
  
 
Implements CLHEP::HepRandomEngine.
Definition at line 127 of file RanluxEngine.cc.
  135   const int ecuyer_a = 53668;
 
  136   const int ecuyer_b = 40014;
 
  137   const int ecuyer_c = 12211;
 
  138   const int ecuyer_d = 2147483563;
 
  140   const int lux_levels[5] = {0,24,73,199,365};  
 
  142   long int_seed_table[24];
 
  143   long next_seed = 
seed;
 
  151   if( (
lux > 4)||(
lux < 0) ){
 
  155         nskip = lux_levels[3]; 
 
  159      nskip = lux_levels[luxury];
 
  163   for(i = 0;i != 24;i++){
 
  164      k_multiple = next_seed / ecuyer_a;
 
  165      next_seed = ecuyer_b * (next_seed - k_multiple * ecuyer_a) 
 
  166      - k_multiple * ecuyer_c ;
 
  167      if(next_seed < 0)next_seed += ecuyer_d;
 
  168      int_seed_table[i] = next_seed % int_modulus;
 
  171   for(i = 0;i != 24;i++)
 
static double mantissa_bit_24()
 
static constexpr double lux
 
 
 
 
  
  
      
        
          | void CLHEP::RanluxEngine::setSeeds  | 
          ( | 
          const long *  | 
          seeds,  | 
         
        
           | 
           | 
          int  | 
          lux = 3  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
virtual   | 
  
 
Implements CLHEP::HepRandomEngine.
Definition at line 183 of file RanluxEngine.cc.
  185    const int ecuyer_a = 53668;
 
  186    const int ecuyer_b = 40014;
 
  187    const int ecuyer_c = 12211;
 
  188    const int ecuyer_d = 2147483563;
 
  190    const int lux_levels[5] = {0,24,73,199,365};
 
  192    long int_seed_table[24];
 
  193    long k_multiple,next_seed;
 
  210   if( (
lux > 4)||(
lux < 0) ){
 
  214         nskip = lux_levels[3]; 
 
  218      nskip = lux_levels[luxury];
 
  221   for( i = 0;(i != 24)&&(*seedptr != 0);i++){
 
  222       int_seed_table[i] = *seedptr % int_modulus;
 
  227      next_seed = int_seed_table[i-1];
 
  229         k_multiple = next_seed / ecuyer_a;
 
  230         next_seed = ecuyer_b * (next_seed - k_multiple * ecuyer_a) 
 
  231         - k_multiple * ecuyer_c ;
 
  232         if(next_seed < 0)next_seed += ecuyer_d;
 
  233         int_seed_table[i] = next_seed % int_modulus;
 
  237   for(i = 0;i != 24;i++)
 
static double mantissa_bit_24()
 
void setSeed(long seed, int lux=3)
 
static constexpr double lux
 
 
 
 
  
  
      
        
          | void CLHEP::RanluxEngine::showStatus  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
virtual   | 
  
 
Implements CLHEP::HepRandomEngine.
Definition at line 296 of file RanluxEngine.cc.
  298    std::cout << std::endl;
 
  299    std::cout << 
"--------- Ranlux engine status ---------" << std::endl;
 
  300    std::cout << 
" Initial seed = " << 
theSeed << std::endl;
 
  301    std::cout << 
" float_seed_table[] = ";
 
  302    for (
int i=0; i<24; ++i)
 
  303      std::cout << float_seed_table[i] << 
" ";
 
  304    std::cout << std::endl;
 
  305    std::cout << 
" i_lag = " << i_lag << 
", j_lag = " << j_lag << std::endl;
 
  306    std::cout << 
" carry = " << carry << 
", count24 = " << count24 << std::endl;
 
  307    std::cout << 
" luxury = " << luxury << 
" nskip = " << nskip << std::endl;
 
  308    std::cout << 
"----------------------------------------" << std::endl;
 
 
 
 
  
  
      
        
          | const unsigned int CLHEP::RanluxEngine::VECTOR_STATE_SIZE = 31 | 
         
       
   | 
  
static   | 
  
 
 
The documentation for this class was generated from the following files:
- source/geant4.10.03.p02/source/externals/clhep/include/CLHEP/Random/RanluxEngine.h
 
- source/geant4.10.03.p02/source/externals/clhep/src/RanluxEngine.cc