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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/JamesRandom.h (Version 11.3.0) and /externals/clhep/include/CLHEP/Random/JamesRandom.h (Version 11.0.p1)


  1 // -*- C++ -*-                                      1 // -*- C++ -*-
  2 //                                                  2 //
  3 // -------------------------------------------      3 // -----------------------------------------------------------------------
  4 //                             HEP Random           4 //                             HEP Random
  5 //                        --- HepJamesRandom -      5 //                        --- HepJamesRandom ---
  6 //                          class header file       6 //                          class header file
  7 // -------------------------------------------      7 // -----------------------------------------------------------------------
  8 // This file is part of Geant4 (simulation too      8 // This file is part of Geant4 (simulation toolkit for HEP).
  9 //                                                  9 //
 10 // HepJamesRandom implements the algorithm by      10 // HepJamesRandom implements the algorithm by Marsaglia-Zaman RANMAR
 11 // described in "F.James, Comp. Phys. Comm. 60     11 // described in "F.James, Comp. Phys. Comm. 60 (1990) 329" and implemented
 12 // in FORTRAN77 as part of the MATHLIB HEP lib     12 // in FORTRAN77 as part of the MATHLIB HEP library for pseudo-random
 13 // numbers generation.                             13 // numbers generation.
 14 // This is the default random engine invoked b     14 // This is the default random engine invoked by each distribution unless
 15 // the user sets a different one.                  15 // the user sets a different one.
 16                                                    16 
 17 // ===========================================     17 // =======================================================================
 18 // Gabriele Cosmo - Created: 5th September 199     18 // Gabriele Cosmo - Created: 5th September 1995
 19 //                - Minor corrections: 31st Oc     19 //                - Minor corrections: 31st October 1996
 20 //                - Added methods for engine s     20 //                - Added methods for engine status: 19th November 1996
 21 //                - setSeed(), setSeeds() now      21 //                - setSeed(), setSeeds() now have default dummy argument
 22 //                  set to zero: 11th July 199     22 //                  set to zero: 11th July 1997
 23 // J.Marraffino   - Added stream operators and     23 // J.Marraffino   - Added stream operators and related constructor.
 24 //                  Added automatic seed selec     24 //                  Added automatic seed selection from seed table and
 25 //                  engine counter: 16th Feb 1     25 //                  engine counter: 16th Feb 1998
 26 // Ken Smith      - Added conversion operators     26 // Ken Smith      - Added conversion operators:  6th Aug 1998
 27 // V. Innocente   - changed pointers to indice     27 // V. Innocente   - changed pointers to indices     3 may 2000
 28 // Mark Fischler  - Methods for distrib. insta     28 // Mark Fischler  - Methods for distrib. instance save/restore 12/8/04    
 29 //  Mark Fischler    methods for anonymous sav     29 //  Mark Fischler    methods for anonymous save/restore 12/27/04    
 30 // ===========================================     30 // =======================================================================
 31                                                    31 
 32 #ifndef HepJamesRandom_h                           32 #ifndef HepJamesRandom_h
 33 #define HepJamesRandom_h 1                         33 #define HepJamesRandom_h 1
 34                                                    34 
 35 #include "CLHEP/Random/RandomEngine.h"             35 #include "CLHEP/Random/RandomEngine.h"
 36                                                    36 
 37 namespace CLHEP {                                  37 namespace CLHEP {
 38                                                    38 
 39 /**                                                39 /**
 40  * @author                                         40  * @author
 41  * @ingroup random                                 41  * @ingroup random
 42  */                                                42  */
 43 class HepJamesRandom: public HepRandomEngine {     43 class HepJamesRandom: public HepRandomEngine {
 44                                                    44 
 45 public:                                            45 public:
 46                                                    46 
 47   HepJamesRandom(std::istream& is);                47   HepJamesRandom(std::istream& is);
 48   HepJamesRandom();                                48   HepJamesRandom();
 49   HepJamesRandom(long seed);                       49   HepJamesRandom(long seed);
 50   HepJamesRandom(int rowIndex, int colIndex);      50   HepJamesRandom(int rowIndex, int colIndex);
 51   virtual ~HepJamesRandom();                       51   virtual ~HepJamesRandom();
 52   // Constructor and destructor.                   52   // Constructor and destructor.
 53                                                    53 
 54   double flat();                                   54   double flat();
 55   // Returns a pseudo random number between 0      55   // Returns a pseudo random number between 0 and 1 
 56   // (excluding the end points)                    56   // (excluding the end points)
 57                                                    57 
 58   void flatArray (const int size, double* vect     58   void flatArray (const int size, double* vect);
 59   // Fills the array "vect" of specified size      59   // Fills the array "vect" of specified size with flat random values.
 60                                                    60 
 61   void setSeed(long seed, int dum=0);              61   void setSeed(long seed, int dum=0);
 62   // Sets the state of the algorithm according     62   // Sets the state of the algorithm according to seed.
 63                                                    63 
 64   void setSeeds(const long * seeds, int dum=0)     64   void setSeeds(const long * seeds, int dum=0);
 65   // Sets the state of the algorithm according     65   // Sets the state of the algorithm according to the zero terminated
 66   // array of seeds. Only the first seed is us     66   // array of seeds. Only the first seed is used.
 67                                                    67 
 68   void saveStatus( const char filename[] = "Ja     68   void saveStatus( const char filename[] = "JamesRand.conf" ) const;
 69   // Saves on file JamesRand.conf the current      69   // Saves on file JamesRand.conf the current engine status.
 70                                                    70 
 71   void restoreStatus( const char filename[] =      71   void restoreStatus( const char filename[] = "JamesRand.conf" );
 72   // Reads from file JamesRand.conf the last s     72   // Reads from file JamesRand.conf the last saved engine status
 73   // and restores it.                              73   // and restores it.
 74                                                    74 
 75   void showStatus() const;                         75   void showStatus() const;
 76   // Dumps the engine status on the screen.        76   // Dumps the engine status on the screen.
 77                                                    77 
 78   operator double();                               78   operator double();
 79   // Returns same as flat()                        79   // Returns same as flat()
 80   operator float();                                80   operator float();
 81   // less precise flat, faster if possible         81   // less precise flat, faster if possible
 82   operator unsigned int();                         82   operator unsigned int();
 83   // 32-bit flat, but slower than double or fl     83   // 32-bit flat, but slower than double or float.
 84                                                    84 
 85   virtual std::ostream & put (std::ostream & o     85   virtual std::ostream & put (std::ostream & os) const;
 86   virtual std::istream & get (std::istream & i     86   virtual std::istream & get (std::istream & is);
 87   static  std::string beginTag ( );                87   static  std::string beginTag ( );
 88   virtual std::istream & getState ( std::istre     88   virtual std::istream & getState ( std::istream & is );
 89                                                    89 
 90   std::string name() const;                        90   std::string name() const;
 91   static std::string engineName() {return "Hep     91   static std::string engineName() {return "HepJamesRandom";}
 92                                                    92 
 93   std::vector<unsigned long> put () const;         93   std::vector<unsigned long> put () const;
 94   bool get (const std::vector<unsigned long> &     94   bool get (const std::vector<unsigned long> & v);
 95   bool getState (const std::vector<unsigned lo     95   bool getState (const std::vector<unsigned long> & v);
 96                                                    96   
 97   static const unsigned int VECTOR_STATE_SIZE      97   static const unsigned int VECTOR_STATE_SIZE = 202;
 98                                                    98   
 99 private:                                           99 private:
100                                                   100 
101   // Members defining the current status of th    101   // Members defining the current status of the generator.
102   double u[97];                                   102   double u[97];
103   double c, cd, cm;                               103   double c, cd, cm;
104   int i97, j97;                                   104   int i97, j97;
105 };                                                105 };
106                                                   106 
107 }  // namespace CLHEP                             107 }  // namespace CLHEP
108                                                   108 
109 #endif                                            109 #endif
110                                                   110