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 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/clhep/include/CLHEP/Random/RanshiEngine.h (Version 11.3.0) and /externals/clhep/include/CLHEP/Random/RanshiEngine.h (Version 7.1.p1)


  1 // -*- C++ -*-                                      1 
  2 //                                                
  3 // -------------------------------------------    
  4 //                           HEP Random           
  5 //                      --- RanshiEngine ---      
  6 //                       class header file        
  7 // -------------------------------------------    
  8 //                                                
  9 //                                                
 10 // The algorithm for this random engine was ta    
 11 // Phys. Comm. 87 (1995) 291-306".                
 12 //                                                
 13 // The algorithm can be imagined as a physical    
 14 // 512 "black balls" each with their own uniqu    
 15 // acterized by disrete angles, where the spin    
 16 // A "red ball" collides based upon the angle     
 17 // of its spin, and the spin of the colliding     
 18 // random number. The spin of the colliding ba    
 19 // left circular shift of the black ball's spi    
 20 // spin. The black ball's old spin becomes the    
 21 //                                                
 22 // To avoid the traps presented, two measures     
 23 // ball will oscillate between hitting the low    
 24 // turn and the upper half on another; second,    
 25 // incremented by a counter of the number of r    
 26 //                                                
 27 // The result is scaled to a double precision     
 28 // is added another random double further scal    
 29 // right in order to ensure that the remaining    
 30 // left empty due to the mere 32 bits represen    
 31                                                   
 32 // ===========================================    
 33 // Ken Smith      - Created: 9th June 1998        
 34 //                - Removed pow() from flat me    
 35 //                - Added conversion operators    
 36 // Mark Fischler    Methods put, get for insta    
 37 // Mark Fischler    methods for anonymous save    
 38 // ===========================================    
 39                                                   
 40 #ifndef HepRanshiEngine_h                         
 41 #define HepRanshiEngine_h                         
 42                                                   
 43 #include "CLHEP/Random/RandomEngine.h"            
 44                                                   
 45 namespace CLHEP {                                 
 46                                                   
 47 /**                                               
 48  * @author                                        
 49  * @ingroup random                                
 50  */                                               
 51 class RanshiEngine: public HepRandomEngine {      
 52                                                   
 53 public:                                           
 54                                                   
 55     RanshiEngine();                               
 56     RanshiEngine(std::istream &is);               
 57     RanshiEngine(long seed);                      
 58     RanshiEngine(int rowIndex, int colIndex);     
 59     virtual ~RanshiEngine();                      
 60     // Constructors and destructor                
 61                                                   
 62     double flat();                                
 63     // Returns a pseudo random number between     
 64                                                   
 65     void flatArray(const int size, double* vec    
 66     // Fills the array "vect" of specified siz    
 67                                                   
 68     void setSeed(long seed, int);                 
 69     // Sets the state of the algorithm accordi    
 70                                                   
 71     void setSeeds(const long* seeds, int);        
 72     // Sets the state of the algorithm accordi    
 73     // array of seeds.                            
 74                                                   
 75     void saveStatus(const char filename[] = "R    
 76     // Saves on named file the current engine     
 77                                                   
 78     void restoreStatus(const char filename[] =    
 79     // Reads from named file the last saved en    
 80     // and restores it.                           
 81                                                   
 82     void showStatus() const;                      
 83     // Dumps the engine status on the screen      
 84                                                   
 85     operator double();       // Returns same a    
 86     operator float();        // flat value, wi    
 87     operator unsigned int(); // 32-bit flat va    
 88                                                   
 89     virtual std::ostream & put (std::ostream &    
 90     virtual std::istream & get (std::istream &    
 91     static  std::string beginTag ( );             
 92     virtual std::istream & getState ( std::ist    
 93                                                   
 94     std::string name() const;                     
 95     static std::string engineName() {return "R    
 96                                                   
 97     std::vector<unsigned long> put () const;      
 98     bool get (const std::vector<unsigned long>    
 99     bool getState (const std::vector<unsigned     
100                                                   
101 private:                                          
102     enum {numBuff = 512};                         
103                                                   
104     unsigned int halfBuff, numFlats;              
105     unsigned int buffer[numBuff];                 
106     unsigned int redSpin;                         
107                                                   
108     static const unsigned int VECTOR_STATE_SIZ    
109                                                   
110 }; // RanshiEngine                                
111                                                   
112 }  // namespace CLHEP                             
113                                                   
114 #endif // HepRanshiEngine_h                       
115