StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RandEngine.h
1 /***************************************************************************
2  *
3  * $Id: RandEngine.h,v 1.1 1999/01/30 03:58:59 fisyak Exp $
4  *
5  * Author: Gabriele Cosmo - Created: 5th September 1995
6  * modified for SCL bl
7  ***************************************************************************
8  *
9  * Description:
10  * RandEngine.h,v 1.3 1997/07/12 21:05:57
11  *
12  * -----------------------------------------------------------------------
13  * HEP Random
14  * --- RandEngine ---
15  * class header file
16  * -----------------------------------------------------------------------
17  * This file is part of Geant4 (simulation toolkit for HEP).
18  *
19  * Random engine using rand() and srand() functions from C standard
20  * library to implement the flat() basic distribution and for setting
21  * seeds.
22  *
23  ***************************************************************************
24  *
25  * $Log: RandEngine.h,v $
26  * Revision 1.1 1999/01/30 03:58:59 fisyak
27  * Root Version of StarClassLibrary
28  *
29  * Revision 1.1 1999/01/23 00:27:36 ullrich
30  * Initial Revision
31  *
32  **************************************************************************/
33 #ifndef RandEngine_h
34 #define RandEngine_h 1
35 
36 #include "RandomEngine.h"
37 
38 class RandEngine : public HepRandomEngine {
39 
40 public:
41 
42  RandEngine(long seed = 19780503);
43  ~RandEngine();
44  // Constructor and destructor
45 
46  RandEngine(const RandEngine &p);
47  // Copy constructor
48 
49  RandEngine & operator = (const RandEngine &p);
50  // Overloaded assignment operator, to retrieve the engine status.
51 
52  HepDouble flat();
53  // It returns a pseudo random number between 0 and 1,
54  // according to the standard stdlib random function rand()
55  // but excluding the end points.
56 
57  void flatArray (const HepInt size, HepDouble* vect);
58 #ifndef ST_NO_TEMPLATE_DEF_ARGS
59  void flatArray (vector<HepDouble>&);
60 #else
61  void flatArray (vector<HepDouble, allocator<HepDouble> >&);
62 #endif
63  // Fills the array "vect" of specified size with flat random values.
64 
65  void setSeed(long seed, HepInt dum=0);
66  // Sets the state of the algorithm according to seed.
67 
68  void setSeeds(const long * seeds, HepInt dum=0);
69  // Sets the state of the algorithm according to the zero terminated
70  // array of seeds. Only the first seed is used.
71 
72  void saveStatus() const;
73  // Saves on file Rand.conf the current engine status.
74 
75  void restoreStatus();
76  // Reads from file Rand.conf the last saved engine status
77  // and restores it.
78 
79  void showStatus() const;
80  // Dumps the engine status on the screen.
81 
82 private:
83 
84  const HepDouble mx;
85  long seq;
86 
87 };
88 
89 #endif