CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RandomEngine.cc
Go to the documentation of this file.
4 
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 
24 {
25  if ( !rootEngine_ ) {
26  delete flatDistribution_;
27  delete gaussianDistribution_;
28  delete poissonDistribution_;
29  }
30 }
31 
32 
33 
34 
TRandom3 * rootEngine_
Definition: RandomEngine.h:60
RandomEngine(edm::RandomNumberGenerator *rng)
Definition: RandomEngine.cc:5
CLHEP::RandPoisson * poissonDistribution_
Definition: RandomEngine.h:57
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
CLHEP::RandFlat * flatDistribution_
Definition: RandomEngine.h:55
CLHEP::HepRandomEngine * engine_
Definition: RandomEngine.h:58
CLHEP::RandGauss * gaussianDistribution_
Definition: RandomEngine.h:56