CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RNDMEngineAccess.cc
Go to the documentation of this file.
4 
6 
7 using namespace gen;
8 
9 CLHEP::HepRandomEngine& gen::getEngineReference()
10 {
12  if(!rng.isAvailable()) {
13  throw cms::Exception("Configuration")
14  << "The RandomNumberProducer module requires the RandomNumberGeneratorService\n"
15  "which appears to be absent. Please add that service to your configuration\n"
16  "or remove the modules that require it." << std::endl;
17  }
18 
19 // The Service has already instantiated an engine. Make contact with it.
20  return rng->getEngine();
21 }
CLHEP::HepRandomEngine & getEngineReference()
bool isAvailable() const
Definition: Service.h:46
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...