thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.2.1
StandardRandom.h
1 // -*- C++ -*-
2 //
3 // StandardRandom.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2019 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef ThePEG_StandardRandom_H
10 #define ThePEG_StandardRandom_H
11 // This is the declaration of the StandardRandom class.
12 
13 #include "RandomGenerator.h"
14 #include "ThePEG/Persistency/PersistentOStream.h"
15 #include "ThePEG/Persistency/PersistentIStream.h"
16 
17 namespace ThePEG {
18 
27 
28 public:
29 
35  StandardRandom() : u() { if ( theSeed != 0 ) setSeed(theSeed); }
37 
38 public:
39 
44  virtual void setSeed(long seed);
45 
46 protected:
47 
51  virtual void fill();
52 
53 public:
54 
55 
62  void persistentOutput(PersistentOStream & os) const;
63 
69  void persistentInput(PersistentIStream & is, int version);
71 
75  static void Init();
76 
77 protected:
78 
85  virtual IBPtr clone() const;
86 
91  virtual IBPtr fullclone() const;
93 
94 private:
95 
99  array<double,97> u;
100 
104  double c;
105 
109  double cd;
110 
114  double cm;
115 
119  int i97;
120 
124  int j97;
125 
126 private:
127 
132 
136  StandardRandom & operator=(const StandardRandom &) = delete;
137 
138 };
139 
144 template <>
147  typedef RandomGenerator NthBase;
148 };
149 
152 template <>
153 struct ClassTraits<StandardRandom>: public ClassTraitsBase<StandardRandom> {
155  static string className() { return "ThePEG::StandardRandom"; }
156 };
157 
160 }
161 
162 #endif /* ThePEG_StandardRandom_H */
virtual void setSeed(long seed)
Reset the underlying random algorithm with the given seed.
PersistentIStream is used to read persistent objects from a stream where they were previously written...
ClassTraitsType is an empty, non-polymorphic, base class.
Definition: ClassTraits.h:30
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data...
static ClassDescription< StandardRandom > initStandardRandom
Describe a concrete class with persistent data.
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
virtual void fill()
Fill the cache with random numbers.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
RandomGenerator is an interface to the CLHEP::RandomEngine classes.
static void Init()
Standard Init function used to initialize the interface.
int j97
Index for the internal state.
double c
Parameter for the internal state.
int i97
Index for the internal state.
StandardRandom & operator=(const StandardRandom &)=delete
Private and non-existent assignment operator.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
StandardRandom inherits from the RandomGenerator class and is an interface to the CLHEP::JamesRandom ...
double cd
Parameter for the internal state.
StandardRandom()
Default constructor.
virtual IBPtr clone() const
Make a simple clone of this object.
The default concrete implementation of ClassTraitsBase.
Definition: ClassTraits.h:134
double cm
Parameter for the internal state.
long theSeed
The seed to initialize the random generator with.
array< double, 97 > u
The internal state vector.
BaseClassTraits describes the base classes of the templated class.
Definition: ClassTraits.h:156
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
The templated ClassTraitsBase class defines a set of default information about classes used by ThePEG...
Definition: ClassTraits.h:52