Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
FastSimulation
Utilities
src
RandomEngine.cc
Go to the documentation of this file.
1
#include "
FWCore/Utilities/interface/RandomNumberGenerator.h
"
2
#include "
FastSimulation/Utilities/interface/RandomEngine.h
"
3
#include "
IOMC/RandomEngine/src/TRandomAdaptor.h
"
4
5
RandomEngine::RandomEngine
(
edm::RandomNumberGenerator
* rng)
6
:
7
rng_(rng),
8
rootEngine_(0)
9
{
10
// The service engine
11
engine_
= &(rng->
getEngine
());
12
// Get the TRandom3 egine, to benefit from Root functional random generation
13
if
(
engine_
->name() ==
"TRandom3"
)
14
rootEngine_
= ( (
edm::TRandomAdaptor
*)
engine_
)->getRootEngine();
15
// If no root engine, use the CLHEP wrapper.
16
if
( !
rootEngine_
) {
17
flatDistribution_
=
new
CLHEP::RandFlat(*
engine_
);
18
gaussianDistribution_
=
new
CLHEP::RandGaussQ(*
engine_
);
19
poissonDistribution_
=
new
CLHEP::RandPoissonQ(*
engine_
);
20
}
21
}
22
23
RandomEngine::~RandomEngine
()
24
{
25
if
( !
rootEngine_
) {
26
delete
flatDistribution_
;
27
delete
gaussianDistribution_
;
28
delete
poissonDistribution_
;
29
}
30
}
31
32
33
34
RandomEngine::rootEngine_
TRandom3 * rootEngine_
Definition:
RandomEngine.h:60
TRandomAdaptor.h
RandomNumberGenerator.h
RandomEngine::RandomEngine
RandomEngine(edm::RandomNumberGenerator *rng)
Definition:
RandomEngine.cc:5
edm::RandomNumberGenerator
Definition:
RandomNumberGenerator.h:106
RandomEngine::poissonDistribution_
CLHEP::RandPoisson * poissonDistribution_
Definition:
RandomEngine.h:57
RandomEngine.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...
RandomEngine::flatDistribution_
CLHEP::RandFlat * flatDistribution_
Definition:
RandomEngine.h:55
edm::TRandomAdaptor
Definition:
TRandomAdaptor.h:13
RandomEngine::~RandomEngine
~RandomEngine()
Definition:
RandomEngine.cc:23
RandomEngine::engine_
CLHEP::HepRandomEngine * engine_
Definition:
RandomEngine.h:58
RandomEngine::gaussianDistribution_
CLHEP::RandGauss * gaussianDistribution_
Definition:
RandomEngine.h:56
Generated for CMSSW Reference Manual by
1.8.5