CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
gen::P8RndmEngine Class Reference

#include <P8RndmEngine.h>

Inheritance diagram for gen::P8RndmEngine:

Public Member Functions

virtual double flat () override
 
 P8RndmEngine ()
 
void setRandomEngine (CLHEP::HepRandomEngine *v)
 

Private Member Functions

void throwNullPtr () const
 

Private Attributes

CLHEP::HepRandomEngine * randomEngine_
 

Detailed Description

Description: Used to set an external random number engine in Pythia 8. Pythia 8 recognizes a class that has Pythia8::RndmEngine as a base class and a virtual flat method. If you pass a pointer to an object of this class to Pythia 8 it will use it to generate random numbers.

Independent of Pythia 8, one can set the CLHEP engine that this class uses in its flat method.

Author
W. David Dagenhart, created 26 November 2013

Definition at line 27 of file P8RndmEngine.h.

Constructor & Destructor Documentation

gen::P8RndmEngine::P8RndmEngine ( )
inline

Definition at line 30 of file P8RndmEngine.h.

30 : randomEngine_(nullptr) { }
CLHEP::HepRandomEngine * randomEngine_
Definition: P8RndmEngine.h:41

Member Function Documentation

double gen::P8RndmEngine::flat ( void  )
overridevirtual

Definition at line 7 of file P8RndmEngine.cc.

References randomEngine_, and throwNullPtr().

Referenced by gen::Py8PtGun::generatePartonsAndHadronize(), gen::Py8JetGun::generatePartonsAndHadronize(), and gen::Py8EGun::generatePartonsAndHadronize().

7  {
8  if(randomEngine_ == nullptr) {
9  throwNullPtr();
10  }
11  return randomEngine_->flat();
12  }
void throwNullPtr() const
Definition: P8RndmEngine.cc:14
CLHEP::HepRandomEngine * randomEngine_
Definition: P8RndmEngine.h:41
void gen::P8RndmEngine::setRandomEngine ( CLHEP::HepRandomEngine *  v)
inline

Definition at line 35 of file P8RndmEngine.h.

References findQualityFiles::v.

35 { randomEngine_ = v; }
double v[5][pyjets_maxn]
CLHEP::HepRandomEngine * randomEngine_
Definition: P8RndmEngine.h:41
void gen::P8RndmEngine::throwNullPtr ( ) const
private

Definition at line 14 of file P8RndmEngine.cc.

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

Referenced by flat().

14  {
16  << "The Pythia 8 code attempted to a generate random number while\n"
17  << "the engine pointer was null. This might mean that the code\n"
18  << "was modified to generate a random number outside the event and\n"
19  << "beginLuminosityBlock methods, which is not allowed.\n";
20  }

Member Data Documentation

CLHEP::HepRandomEngine* gen::P8RndmEngine::randomEngine_
private

Definition at line 41 of file P8RndmEngine.h.

Referenced by flat().