CMS 3D CMS Logo

myEvtRandomEngine.cc
Go to the documentation of this file.
1 //--------------------------------------------------------------------------
2 //
3 // Module: myEvtRandomEngine.cpp
4 //
5 // Description:
6 // this is an EvtRandomEngine
7 // It is used as an interface of the random number engine provided
8 // by the CMSSW Random Number Generator Service and EvtGen
9 // Its "random()" method uses the "Flat()" method of the CLHEP::HepRandomEngine
10 // provided by the Random Number Generator Service
11 //
12 // Modification history:
13 //
14 // Nello Nappi May 9, 2007 Module created
15 //
16 //------------------------------------------------------------------------
17 //
19 #include "CLHEP/Random/RandomEngine.h"
21 
22 myEvtRandomEngine::myEvtRandomEngine(CLHEP::HepRandomEngine *xx) { the_engine = xx; }
23 
25 
27  if (the_engine == nullptr) {
28  throwNullPtr();
29  }
30  return the_engine->flat();
31 }
32 
34  throw edm::Exception(edm::errors::LogicError) << "The EvtGen code attempted to a generate random number while\n"
35  << "the engine pointer was null. This might mean that the code\n"
36  << "was modified to generate a random number outside the event and\n"
37  << "beginLuminosityBlock methods, which is not allowed.\n";
38 }
myEvtRandomEngine::the_engine
CLHEP::HepRandomEngine * the_engine
Definition: myEvtRandomEngine.h:42
edm::errors::LogicError
Definition: EDMException.h:37
EDMException.h
myEvtRandomEngine.h
myEvtRandomEngine::random
double random() override
Definition: myEvtRandomEngine.cc:26
myEvtRandomEngine::myEvtRandomEngine
myEvtRandomEngine(CLHEP::HepRandomEngine *xx)
Definition: myEvtRandomEngine.cc:22
myEvtRandomEngine::throwNullPtr
void throwNullPtr() const
Definition: myEvtRandomEngine.cc:33
myEvtRandomEngine::~myEvtRandomEngine
~myEvtRandomEngine() override
Definition: myEvtRandomEngine.cc:24
Exception
Definition: hltDiff.cc:246
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19