CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

CLHEP/RandomObjects/RandomVector.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // -----------------------------------------------------------------------
4 // HEP Random
5 // --- HepRandomVector ---
6 // class header file
7 // -----------------------------------------------------------------------
8 // This file is part of CLHEP, extended to match the distributions in RPP.
9 //
10 // It's exactly analogous to HepRandom except that the return types for
11 // the fire() and related methods are std::vector<double> instead of
12 // double.
13 //
14 // Distribution classes returning HepVectors of results inherit from
15 // HepRandomVector instead of HepRandom.
16 //
17 // HepVector is used instead of the more modern looking
18 // std::vector<double> because the motivating sub-class
19 // RandMultiGauss uses HepMatrix to supply the correlation
20 // matrix S anyway. Given that, we might as well stick to
21 // HepVector when a vector of numbers is needed, as well.
22 //
23 // =======================================================================
24 // Mark Fischler - Created: 19 Oct, 1998
25 // 10/20/98 - Removed all shoot-related material
26 // =======================================================================
27 
28 #ifndef HepRandomVector_h
29 #define HepRandomVector_h 1
30 
32 #include "CLHEP/Random/RandomEngine.h"
33 #include "CLHEP/Matrix/Vector.h"
34 
35 namespace CLHEP {
36 
42 
43 public:
44 
46  HepRandomVector(long seed);
47  // Contructors with and without a seed using a default engine
48  // (JamesRandom) which is instantiated for use of this distribution
49  // instance. If the seed is omitted, multiple instantiations will
50  // each get unique seeds.
51 
54  // Constructor taking an alternative engine as argument. If a pointer is
55  // given the corresponding object will be deleted by the HepRandom
56  // destructor.
57 
58  virtual ~HepRandomVector();
59  // Destructor
60 
61  inline HepVector flat();
62  // Returns vector of flat values ( interval ]0.1[ ).
63 
64  inline HepVector flat (HepRandomEngine* theNewEngine);
65  // Returns a vector of flat values, given a defined Random Engine.
66 
67  inline void flatArray(const int size, HepVector* vect);
68  // Fills "vect" array of flat random values, given the size.
69  // Included for consistency with the HepRandom class.
70 
71  inline void flatArray(HepRandomEngine* theNewEngine,
72  const int size, HepVector* vect);
73  // Fills "vect" array of flat random values, given the size
74  // and a defined Random Engine.
75 
76 
77  virtual HepVector operator()();
78  // To get a flat random number using the operator ().
79 
80 
81 private: // -------- Private methods ---------
82 
83  inline void setSeed(long seed, int lux);
84  // (Re)Initializes the generator with a seed.
85 
86  inline long getSeed() const;
87  // Gets the current seed of the current generator.
88 
89  inline void setSeeds(const long* seeds, int aux);
90  // (Re)Initializes the generator with a zero terminated list of seeds.
91 
92  inline const long* getSeeds () const;
93  // Gets the current array of seeds of the current generator.
94 
95  void setEngine (HepRandomEngine* engine) { theEngine = engine; }
96  // To set the underlying algorithm object
97 
98  HepRandomEngine * getEngine() const { return theEngine; }
99  // Returns a pointer to the underlying algorithm object.
100 
101  void saveStatus( const char filename[] = "Config.conf" ) const;
102  // Saves to file the current status of the current engine.
103 
104  void restoreStatus( const char filename[] = "Config.conf" );
105  // Restores a saved status (if any) for the current engine.
106 
107  void showStatus() const;
108  // Dumps the current engine status on screen.
109 
110 protected: // -------- Data members ---------
111 
113  // The corresponding algorithm.
114 
115 private: // -------- Data members ---------
116 
117  bool deleteEngine;
118  // True if the engine should be deleted on destruction.
119 
120 };
121 
122 } // namespace CLHEP
123 
124 #include "CLHEP/RandomObjects/RandomVector.icc"
125 
126 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
127 // backwards compatibility will be enabled ONLY in CLHEP 1.9
128 using namespace CLHEP;
129 #endif
130 
131 #endif
CLHEP::HepRandomVector::flat
HepVector flat()
CLHEP::HepRandomEngine
Definition: Matrix/CLHEP/Random/RandomEngine.h:55
CLHEP::HepRandomVector
Definition: CLHEP/RandomObjects/RandomVector.h:41
CLHEP::HepRandomVector::HepRandomVector
HepRandomVector()
Definition: RandomVector.cc:21
size
user code seldom needs to call this function directly ZMerrno whether or not they are still recorded ZMerrno size() Return the(integer) number of ZMthrow 'n exceptions currently recorded. 5) ZMerrno.clear() Set an internal counter to zero. This counter is available(see next function) to user code to track ZMthrow 'n exceptions that have occurred during any arbitrary time interval. 6) ZMerrno.countSinceCleared() Return the(integer) number of ZMthrow 'n exceptions that have been recorded via ZMerrno.write()
CLHEP
Definition: ClhepVersion.h:13
CLHEP::HepRandomVector::flatArray
void flatArray(const int size, HepVector *vect)
CLHEP::HepRandomVector::~HepRandomVector
virtual ~HepRandomVector()
Definition: RandomVector.cc:38
CLHEP::HepRandomVector::theEngine
HepRandomEngine * theEngine
Definition: CLHEP/RandomObjects/RandomVector.h:112
CLHEP::HepRandomVector::operator()
virtual HepVector operator()()
Definition: RandomVector.cc:42
seeds
Technical Maintenance Note for CLHEP Random Consequences of seeding JamesRandom with positive seed values greater than In the source code JamesRandom The usual way of seeding a generator is via the default which makes use of the table of seeds(with some trickery to ensure that the values won 't repeat after the table rows are exhausted). The trickery preserves the fact that sees are never negative(because the table values are never negative
CLHEP::HepVector
Definition: Matrix/CLHEP/Matrix/Vector.h:39
defs.h