CMS 3D CMS Logo

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