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

Constructor & Destructor Documentation

◆ RandomEngineGlue()

RandomEngineGlue::RandomEngineGlue ( )

Definition at line 18 of file RandomEngineGlue.cc.

18 : randomEngine(nullptr) {}
CLHEP::HepRandomEngine * randomEngine

◆ ~RandomEngineGlue()

RandomEngineGlue::~RandomEngineGlue ( )
override

Definition at line 20 of file RandomEngineGlue.cc.

20 {}

Member Function Documentation

◆ clone()

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

Definition at line 63 of file RandomEngineGlue.h.

63 { return new_ptr(*this); }

◆ doinit()

void RandomEngineGlue::doinit ( )
overrideprotectednoexcept

Definition at line 43 of file RandomEngineGlue.cc.

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

43  {
44  RandomGenerator::doinit();
45 
46  std::shared_ptr<Proxy> proxy = Proxy::find(proxyID);
47  if (!proxy)
48  throw InitException();
49 
50  proxy->instance = this;
51  randomEngine = proxy->getRandomEngine();
52  flush();
53 }
static std::shared_ptr< Proxy > find(ProxyID id)
Definition: Proxy.h:46
CLHEP::HepRandomEngine * randomEngine

◆ fill()

void RandomEngineGlue::fill ( void  )
overrideprotected

Definition at line 27 of file RandomEngineGlue.cc.

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

27  {
28  if (randomEngine == nullptr) {
29  throw edm::Exception(edm::errors::LogicError) << "The PEG code attempted to a generate random number while\n"
30  << "the engine pointer was null. This might mean that the code\n"
31  << "was tried to generate a random number outside the event and\n"
32  << "beginLuminosityBlock methods, which is not allowed.\n";
33  }
34  nextNumber = theNumbers.begin();
35  for (RndVector::iterator it = nextNumber; it != theNumbers.end(); ++it)
36  *it = randomEngine->flat();
37 }
CLHEP::HepRandomEngine * randomEngine

◆ flush()

void RandomEngineGlue::flush ( )

Definition at line 22 of file RandomEngineGlue.cc.

Referenced by doinit().

22  {
23  RandomGenerator::flush();
24  gaussSaved = false;
25 }

◆ fullclone()

IBPtr ThePEG::RandomEngineGlue::fullclone ( ) const
inlineoverrideprotected

Definition at line 64 of file RandomEngineGlue.h.

64 { return new_ptr(*this); }

◆ getRandomEngine()

CLHEP::HepRandomEngine* ThePEG::RandomEngineGlue::getRandomEngine ( ) const
inline

Definition at line 28 of file RandomEngineGlue.h.

References randomEngine.

28 { return randomEngine; }
CLHEP::HepRandomEngine * randomEngine

◆ Init()

void RandomEngineGlue::Init ( void  )
static

Definition at line 57 of file RandomEngineGlue.cc.

References proxyID.

57  {
58  typedef Proxy::ProxyID ProxyID;
59 
60  static ClassDocumentation<RandomEngineGlue> documentation("Interface to the CMSSW RandomNumberEngine.");
61  static Parameter<RandomEngineGlue, ProxyID> interfaceProxyID(
62  "ProxyID", "The ProxyID.", &RandomEngineGlue::proxyID, ProxyID(), ProxyID(), ProxyID(), false, false, false);
63 
64  interfaceProxyID.rank(11);
65 }
unsigned long ProxyID
Definition: Proxy.h:16

◆ setRandomEngine()

void ThePEG::RandomEngineGlue::setRandomEngine ( CLHEP::HepRandomEngine *  v)
inline

Definition at line 27 of file RandomEngineGlue.h.

References randomEngine, and findQualityFiles::v.

Referenced by Herwig7Interface::setPEGRandomEngine().

27 { randomEngine = v; }
CLHEP::HepRandomEngine * randomEngine

◆ setSeed()

void RandomEngineGlue::setSeed ( long  seed)
overrideprotected

Definition at line 39 of file RandomEngineGlue.cc.

39  {
40  // we ignore this, CMSSW overrides the seed from ThePEG
41 }

Member Data Documentation

◆ initRandomEngineGlue

ClassDescription< RandomEngineGlue > RandomEngineGlue::initRandomEngineGlue
staticprivate

Definition at line 72 of file RandomEngineGlue.h.

◆ proxyID

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

Definition at line 69 of file RandomEngineGlue.h.

Referenced by doinit(), and Init().

◆ randomEngine

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

Definition at line 70 of file RandomEngineGlue.h.

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