thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
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
17namespace ThePEG {
18
27
28public:
29
35 StandardRandom() : u() { if ( theSeed != 0 ) setSeed(theSeed); }
37
38public:
39
44 virtual void setSeed(long seed);
45
46protected:
47
51 virtual void fill();
52
53public:
54
55
63
69 void persistentInput(PersistentIStream & is, int version);
71
75 static void Init();
76
77protected:
78
85 virtual IBPtr clone() const;
86
91 virtual IBPtr fullclone() const;
93
94private:
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
126private:
127
132
137
138};
139
144template <>
147 typedef RandomGenerator NthBase;
148};
149
152template <>
153struct ClassTraits<StandardRandom>: public ClassTraitsBase<StandardRandom> {
155 static string className() { return "ThePEG::StandardRandom"; }
156};
157
160}
161
162#endif /* ThePEG_StandardRandom_H */
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data.
PersistentIStream is used to read persistent objects from a stream where they were previously written...
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
RandomGenerator is an interface to the CLHEP::RandomEngine classes.
long theSeed
The seed to initialize the random generator with.
StandardRandom inherits from the RandomGenerator class and is an interface to the CLHEP::JamesRandom ...
int j97
Index for the internal state.
virtual void fill()
Fill the cache with random numbers.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
virtual IBPtr clone() const
Make a simple clone of this object.
static ClassDescription< StandardRandom > initStandardRandom
Describe a concrete class with persistent data.
array< double, 97 > u
The internal state vector.
virtual void setSeed(long seed)
Reset the underlying random algorithm with the given seed.
double cd
Parameter for the internal state.
int i97
Index for the internal state.
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
double cm
Parameter for the internal state.
double c
Parameter for the internal state.
StandardRandom & operator=(const StandardRandom &)=delete
Private and non-existent assignment operator.
StandardRandom()
Default constructor.
static void Init()
Standard Init function used to initialize the interface.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
BaseClassTraits describes the base classes of the templated class.
Definition: ClassTraits.h:156
int NthBase
The type of the BaseN'th base class (int means there are no further base classes).
Definition: ClassTraits.h:161
static string className()
Return the name of class T.
Definition: ClassTraits.h:66
ClassTraitsType is an empty, non-polymorphic, base class.
Definition: ClassTraits.h:30