CMS 3D CMS Logo

RandomEngineAndDistribution.cc
Go to the documentation of this file.
2 
7 
8 #include "CLHEP/Random/RandomEngine.h"
9 
11  engine_(nullptr) {
13  if ( ! rng.isAvailable() ) {
14  throw cms::Exception("Configuration") <<
15  "RandomNumberGenerator service is not available.\n"
16  "You must add the service in the configuration file\n"
17  "or remove the module that requires it.";
18  }
19  engine_ = &rng->getEngine(streamID);
20 }
21 
23  engine_(nullptr) {
25  if ( ! rng.isAvailable() ) {
26  throw cms::Exception("Configuration") <<
27  "RandomNumberGenerator service is not available.\n"
28  "You must add the service in the configuration file\n"
29  "or remove the module that requires it.";
30  }
31  engine_ = &rng->getEngine(luminosityBlockIndex);
32 }
33 
35 }
#define nullptr
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
RandomEngineAndDistribution(edm::StreamID const &)
bool isAvailable() const
Definition: Service.h:46