CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes
ThePEG::RandomEngineGlue Class Reference

#include <RandomEngineGlue.h>

Inheritance diagram for ThePEG::RandomEngineGlue:

Classes

class  Proxy
 

Public Member Functions

void flush ()
 
 RandomEngineGlue ()
 
void setRandomEngine (CLHEP::HepRandomEngine *v)
 
virtual ~RandomEngineGlue ()
 

Static Public Member Functions

static void Init ()
 

Protected Member Functions

virtual IBPtr clone () const
 
virtual void doinit () throw (InitException)
 
virtual void fill ()
 
virtual IBPtr fullclone () const
 
virtual void setSeed (long seed)
 

Private Attributes

Proxy::ProxyID proxyID
 
CLHEP::HepRandomEngine * randomEngine
 

Static Private Attributes

static ClassDescription
< RandomEngineGlue
initRandomEngineGlue
 

Detailed Description

Definition at line 23 of file RandomEngineGlue.h.

Constructor & Destructor Documentation

RandomEngineGlue::RandomEngineGlue ( )

Definition at line 18 of file RandomEngineGlue.cc.

18  :
19  randomEngine(nullptr)
20 {
21 }
CLHEP::HepRandomEngine * randomEngine
RandomEngineGlue::~RandomEngineGlue ( )
virtual

Definition at line 23 of file RandomEngineGlue.cc.

24 {
25 }

Member Function Documentation

virtual IBPtr ThePEG::RandomEngineGlue::clone ( void  ) const
inlineprotectedvirtual

Definition at line 64 of file RandomEngineGlue.h.

64 { return new_ptr(*this); }
void RandomEngineGlue::doinit ( )
throw (InitException
)
protectedvirtual

Definition at line 52 of file RandomEngineGlue.cc.

References ThePEG::Proxy< Proxy >::find(), flush(), proxyID, and randomEngine.

53 {
54  RandomGenerator::doinit();
55 
56  boost::shared_ptr<Proxy> proxy = Proxy::find(proxyID);
57  if (!proxy)
58  throw InitException();
59 
60  proxy->instance = this;
61  randomEngine = proxy->getRandomEngine();
62  flush();
63 }
static boost::shared_ptr< Proxy > find(ProxyID id)
Definition: Proxy.h:46
CLHEP::HepRandomEngine * randomEngine
void RandomEngineGlue::fill ( void  )
protectedvirtual

Definition at line 33 of file RandomEngineGlue.cc.

References Exception, edm::errors::LogicError, and randomEngine.

34 {
35  if(randomEngine == nullptr) {
37  << "The PEG code attempted to a generate random number while\n"
38  << "the engine pointer was null. This might mean that the code\n"
39  << "was tried to generate a random number outside the event and\n"
40  << "beginLuminosityBlock methods, which is not allowed.\n";
41  }
42  nextNumber = theNumbers.begin();
43  for(RndVector::iterator it = nextNumber; it != theNumbers.end(); ++it)
44  *it = randomEngine->flat();
45 }
CLHEP::HepRandomEngine * randomEngine
void RandomEngineGlue::flush ( )

Definition at line 27 of file RandomEngineGlue.cc.

Referenced by doinit(), and ThePEGInterface::flushRandomNumberGenerator().

28 {
29  RandomGenerator::flush();
30  gaussSaved = false;
31 }
virtual IBPtr ThePEG::RandomEngineGlue::fullclone ( ) const
inlineprotectedvirtual

Definition at line 65 of file RandomEngineGlue.h.

65 { return new_ptr(*this); }
void RandomEngineGlue::Init ( void  )
static

Definition at line 67 of file RandomEngineGlue.cc.

References proxyID.

67  {
68  typedef Proxy::ProxyID ProxyID;
69 
70  static ClassDocumentation<RandomEngineGlue> documentation
71  ("Interface to the CMSSW RandomNumberEngine.");
72  static Parameter<RandomEngineGlue, ProxyID> interfaceProxyID
73  ("ProxyID", "The ProxyID.",
74  &RandomEngineGlue::proxyID, ProxyID(),
75  ProxyID(), ProxyID(), false, false, false);
76 
77  interfaceProxyID.rank(11);
78 }
unsigned long ProxyID
Definition: Proxy.h:16
void ThePEG::RandomEngineGlue::setRandomEngine ( CLHEP::HepRandomEngine *  v)
inline

Definition at line 28 of file RandomEngineGlue.h.

References randomEngine, and findQualityFiles::v.

Referenced by ThePEGInterface::setPEGRandomEngine().

28 { randomEngine = v; }
CLHEP::HepRandomEngine * randomEngine
void RandomEngineGlue::setSeed ( long  seed)
protectedvirtual

Definition at line 47 of file RandomEngineGlue.cc.

48 {
49  // we ignore this, CMSSW overrides the seed from ThePEG
50 }

Member Data Documentation

ClassDescription< RandomEngineGlue > RandomEngineGlue::initRandomEngineGlue
staticprivate

Definition at line 73 of file RandomEngineGlue.h.

Proxy::ProxyID ThePEG::RandomEngineGlue::proxyID
private

Definition at line 70 of file RandomEngineGlue.h.

Referenced by doinit(), and Init().

CLHEP::HepRandomEngine* ThePEG::RandomEngineGlue::randomEngine
private

Definition at line 71 of file RandomEngineGlue.h.

Referenced by doinit(), fill(), and setRandomEngine().