CMS 3D CMS Logo

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 ()
 
CLHEP::HepRandomEngine * getRandomEngine () const
 
 RandomEngineGlue ()
 
void setRandomEngine (CLHEP::HepRandomEngine *v)
 
 ~RandomEngineGlue () override
 

Static Public Member Functions

static void Init ()
 

Protected Member Functions

IBPtr clone () const override
 
void doinit () noexcept(false) override
 
void fill () override
 
IBPtr fullclone () const override
 
void setSeed (long seed) override
 

Private Attributes

Proxy::ProxyID proxyID
 
CLHEP::HepRandomEngine * randomEngine
 

Static Private Attributes

static ClassDescription< RandomEngineGlueinitRandomEngineGlue
 

Detailed Description

Definition at line 24 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 ( )
override

Definition at line 23 of file RandomEngineGlue.cc.

24 {
25 }

Member Function Documentation

IBPtr ThePEG::RandomEngineGlue::clone ( void  ) const
inlineoverrideprotected

Definition at line 65 of file RandomEngineGlue.h.

65 { return new_ptr(*this); }
void RandomEngineGlue::doinit ( )
overrideprotectednoexcept

Definition at line 52 of file RandomEngineGlue.cc.

References ThePEG::Proxy< Proxy >::find(), flush(), initRandomEngineGlue, 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  )
overrideprotected

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().

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

Definition at line 66 of file RandomEngineGlue.h.

References noexcept.

66 { return new_ptr(*this); }
CLHEP::HepRandomEngine* ThePEG::RandomEngineGlue::getRandomEngine ( ) const
inline

Definition at line 30 of file RandomEngineGlue.h.

References randomEngine.

30 { return randomEngine; }
CLHEP::HepRandomEngine * randomEngine
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 29 of file RandomEngineGlue.h.

References randomEngine, and findQualityFiles::v.

Referenced by Herwig7Interface::setPEGRandomEngine().

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

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 74 of file RandomEngineGlue.h.

Referenced by doinit().

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

Definition at line 71 of file RandomEngineGlue.h.

Referenced by doinit(), and Init().

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

Definition at line 72 of file RandomEngineGlue.h.

Referenced by doinit(), and fill().