CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RandomEngineAndDistribution.cc
Go to the documentation of this file.
2 
6 
7 #include "CLHEP/Random/RandomEngine.h"
8 
11  if (!rng.isAvailable()) {
12  throw cms::Exception("Configuration") << "RandomNumberGenerator service is not available.\n"
13  "You must add the service in the configuration file\n"
14  "or remove the module that requires it.";
15  }
16  engine_ = &rng->getEngine(streamID);
17 }
18 
20  : engine_(nullptr) {
22  if (!rng.isAvailable()) {
23  throw cms::Exception("Configuration") << "RandomNumberGenerator service is not available.\n"
24  "You must add the service in the configuration file\n"
25  "or remove the module that requires it.";
26  }
27  engine_ = &rng->getEngine(luminosityBlockIndex);
28 }
29 
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
RandomEngineAndDistribution(edm::StreamID const &)
bool isAvailable() const
Definition: Service.h:40