StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RanecuEngine.h
1 /***************************************************************************
2  *
3  * $Id: RanecuEngine.h,v 1.2 1999/12/07 23:43:04 ullrich Exp $
4  *
5  * Author: Gabriele Cosmo - Created: 2nd February 1996
6  * modified for SCL bl
7  ***************************************************************************
8  *
9  * Description:
10  * RanecuEngine.h,v 1.5 1997/10/16 20:40:27
11  * -----------------------------------------------------------------------
12  * HEP Random
13  * --- RanecuEngine ---
14  * class header file
15  * -----------------------------------------------------------------------
16  * This file is part of Geant4 (simulation toolkit for HEP).
17  *
18  * RANECU Random Engine - algorithm originally written in FORTRAN77
19  * as part of the MATHLIB HEP library.
20  * Seeds are taken from SeedTable given an index, the getSeed() method
21  * returns the current index of SeedTable, while the getSeeds() method
22  * returns a pointer to the local table of seeds at the current index.
23  *
24  ***************************************************************************
25  *
26  * $Log: RanecuEngine.h,v $
27  * Revision 1.2 1999/12/07 23:43:04 ullrich
28  * Modified to get rid of warnings on Linux.
29  *
30  * Revision 1.1 1999/01/30 03:59:01 fisyak
31  * Root Version of StarClassLibrary
32  *
33  * Revision 1.1 1999/01/23 00:27:43 ullrich
34  * Initial Revision
35  *
36  **************************************************************************/
37 
38 #ifndef RanecuEngine_h
39 #define RanecuEngine_h 1
40 
41 #include "RandomEngine.h"
42 
43 class RanecuEngine : public HepRandomEngine {
44 
45 public:
46 
47  RanecuEngine(HepInt index=0);
48  ~RanecuEngine();
49  // Constructor and destructor.
50 
51  RanecuEngine(const RanecuEngine &p);
52  // Copy constructor
53 
54  RanecuEngine & operator = (const RanecuEngine &p);
55  // Overloaded assignment operator, to retrieve the engine status.
56 
57  HepDouble flat();
58  // Returns a pseudo random number between 0 and 1
59  // (excluding the end points)
60 
61  void flatArray (const HepInt size, HepDouble* vect);
62 #ifndef ST_NO_TEMPLATE_DEF_ARGS
63  void flatArray (vector<HepDouble>&);
64 #else
65  void flatArray (vector<HepDouble, allocator<HepDouble> >&);
66 #endif
67  // Fills an array "vect" of specified size with flat random values.
68 
69  void setSeed (long index, HepInt dum=0);
70  // Sets the state of the algorithm according to "index", the position
71  // in the table of seeds.
72 
73  void setSeeds (const long* seeds, HepInt index=-1);
74  // Sets the state of the algorithm according to the array of seeds
75  // "seeds" containing two seed values to be stored in the table at
76  // "index" position.
77 
78  void saveStatus() const;
79  // Saves on file Ranecu.conf the current engine status.
80 
81  void restoreStatus();
82  // Reads from file Ranecu.conf the last saved engine status
83  // and restores it.
84 
85  void showStatus() const;
86  // Dumps the engine status on the screen.
87 
88 private:
89 
90  // Members defining the current state of the generator.
91 
92  long table[215][2];
93  HepInt seq;
94  const HepInt ecuyer_a, ecuyer_b, ecuyer_c, ecuyer_d, ecuyer_e, ecuyer_f;
95  const HepInt shift1, shift2;
96  const HepInt maxSeq;
97  const HepDouble prec;
98 
99 };
100 
101 #endif