CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
RandomEngine Class Reference

#include <RandomEngine.h>

Public Member Functions

double flatShoot (double xmin=0.0, double xmax=1.0) const
 
double gaussShoot (double mean=0.0, double sigma=1.0) const
 
unsigned int poissonShoot (double mean) const
 
 RandomEngine (edm::RandomNumberGenerator *rng)
 
CLHEP::HepRandomEngine * theEngine () const
 
edm::RandomNumberGeneratortheRandomNumberGenerator () const
 
 ~RandomEngine ()
 

Private Attributes

CLHEP::HepRandomEngine * engine_
 
CLHEP::RandFlat * flatDistribution_
 
CLHEP::RandGauss * gaussianDistribution_
 
CLHEP::RandPoisson * poissonDistribution_
 
edm::RandomNumberGeneratorrng_
 
TRandom3 * rootEngine_
 

Detailed Description

Definition at line 18 of file RandomEngine.h.

Constructor & Destructor Documentation

RandomEngine::RandomEngine ( edm::RandomNumberGenerator rng)

Definition at line 5 of file RandomEngine.cc.

References engine_, flatDistribution_, gaussianDistribution_, edm::RandomNumberGenerator::getEngine(), poissonDistribution_, and rootEngine_.

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 }
TRandom3 * rootEngine_
Definition: RandomEngine.h:60
edm::RandomNumberGenerator * rng_
Definition: RandomEngine.h:53
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
RandomEngine::~RandomEngine ( )

Definition at line 23 of file RandomEngine.cc.

References flatDistribution_, gaussianDistribution_, poissonDistribution_, and rootEngine_.

24 {
25  if ( !rootEngine_ ) {
26  delete flatDistribution_;
27  delete gaussianDistribution_;
28  delete poissonDistribution_;
29  }
30 }
TRandom3 * rootEngine_
Definition: RandomEngine.h:60
CLHEP::RandPoisson * poissonDistribution_
Definition: RandomEngine.h:57
CLHEP::RandFlat * flatDistribution_
Definition: RandomEngine.h:55
CLHEP::RandGauss * gaussianDistribution_
Definition: RandomEngine.h:56

Member Function Documentation

double RandomEngine::flatShoot ( double  xmin = 0.0,
double  xmax = 1.0 
) const
inline

Definition at line 30 of file RandomEngine.h.

References flatDistribution_, and rootEngine_.

Referenced by EcalHitMaker::addHit(), PileUpProducer::beginRun(), BremsstrahlungSimulator::brem(), MultipleScatteringSimulator::compute(), PairProductionSimulator::compute(), HFShower::compute(), HDShower::compute(), EMShower::compute(), NuclearInteractionSimulator::compute(), HDRShower::computeShower(), CalorimetryManager::EMShowerSimulation(), GammaFunctionGenerator::gammaFrac(), GammaFunctionGenerator::gammaInt(), SiTrackerGaussianSmearingRecHitConverter::gaussianSmearing(), PairProductionSimulator::gbteth(), BremsstrahlungSimulator::gbteth(), FlatPrimaryVertexGenerator::generate(), SimpleHistogramGenerator::generate(), BaseNumericalRandomGenerator::generate(), BaseNumericalRandomGenerator::generateExp(), BaseNumericalRandomGenerator::generateLin(), HDRShower::getR(), HDShower::HDShower(), HFShower::HFShower(), ParticlePropagator::initProperDecayTime(), HCALResponse::interMU(), FML3EfficiencyHandler::kill(), FMGLfromL3TKEfficiencyHandler::kill(), FMGLfromL3EfficiencyHandler::kill(), FMGLfromTKEfficiencyHandler::kill(), FML1EfficiencyHandler::kill(), HFShower::makeSteps(), HDShower::makeSteps(), HcalRecHitsMaker::noisifySubdet(), EcalPreshowerRecHitsMaker::noisifySubdet(), NuclearInteractionSimulator::NuclearInteractionSimulator(), BremsstrahlungSimulator::poisson(), PileUpProducer::produce(), MuonSimHitProducer::produce(), EcalBarrelRecHitsMaker::randomNoisifier(), EcalEndcapRecHitsMaker::randomNoisifier(), HDRShower::setHit(), GaussianTail::shoot(), FML1PtSmearer::smear(), SiPixelGaussianSmearingRecHitConverterAlgorithm::smearHit(), and HDRShower::thetaFunction().

30  {
31  return rootEngine_ ?
32  xmin + (xmax-xmin) * rootEngine_->Rndm()
33  :
34  xmin + (xmax-xmin)*flatDistribution_->fire();
35  }
TRandom3 * rootEngine_
Definition: RandomEngine.h:60
CLHEP::RandFlat * flatDistribution_
Definition: RandomEngine.h:55
double RandomEngine::gaussShoot ( double  mean = 0.0,
double  sigma = 1.0 
) const
inline
unsigned int RandomEngine::poissonShoot ( double  mean) const
inline
CLHEP::HepRandomEngine* RandomEngine::theEngine ( ) const
inline

Definition at line 24 of file RandomEngine.h.

References engine_.

24 { return engine_; }
CLHEP::HepRandomEngine * engine_
Definition: RandomEngine.h:58
edm::RandomNumberGenerator* RandomEngine::theRandomNumberGenerator ( ) const
inline

Definition at line 22 of file RandomEngine.h.

References rng_.

22 {return rng_;}
edm::RandomNumberGenerator * rng_
Definition: RandomEngine.h:53

Member Data Documentation

CLHEP::HepRandomEngine* RandomEngine::engine_
private

Definition at line 58 of file RandomEngine.h.

Referenced by RandomEngine(), and theEngine().

CLHEP::RandFlat* RandomEngine::flatDistribution_
private

Definition at line 55 of file RandomEngine.h.

Referenced by flatShoot(), RandomEngine(), and ~RandomEngine().

CLHEP::RandGauss* RandomEngine::gaussianDistribution_
private

Definition at line 56 of file RandomEngine.h.

Referenced by gaussShoot(), RandomEngine(), and ~RandomEngine().

CLHEP::RandPoisson* RandomEngine::poissonDistribution_
private

Definition at line 57 of file RandomEngine.h.

Referenced by poissonShoot(), RandomEngine(), and ~RandomEngine().

edm::RandomNumberGenerator* RandomEngine::rng_
private

Definition at line 53 of file RandomEngine.h.

Referenced by theRandomNumberGenerator().

TRandom3* RandomEngine::rootEngine_
private

Definition at line 60 of file RandomEngine.h.

Referenced by flatShoot(), gaussShoot(), poissonShoot(), RandomEngine(), and ~RandomEngine().