Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
GeneratorInterface
Core
src
RNDMEngineAccess.cc
Go to the documentation of this file.
1
#include "
FWCore/ServiceRegistry/interface/Service.h
"
2
#include "
FWCore/Utilities/interface/RandomNumberGenerator.h
"
3
#include "
FWCore/Utilities/interface/Exception.h
"
4
5
#include "
GeneratorInterface/Core/interface/RNDMEngineAccess.h
"
6
7
using namespace
gen
;
8
9
CLHEP::HepRandomEngine&
gen::getEngineReference
()
10
{
11
edm::Service<edm::RandomNumberGenerator>
rng;
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
}
edm::Service< edm::RandomNumberGenerator >
RandomNumberGenerator.h
relval_steps.gen
def gen
Definition:
relval_steps.py:246
gen::getEngineReference
CLHEP::HepRandomEngine & getEngineReference()
Definition:
RNDMEngineAccess.cc:9
RNDMEngineAccess.h
edm::Service::isAvailable
bool isAvailable() const
Definition:
Service.h:46
Service.h
edm::RandomNumberGenerator::getEngine
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
Exception.h
edm::hlt::Exception
error
Definition:
HLTenums.h:21
Generated for CMSSW Reference Manual by
1.8.5