CMS 3D CMS Logo

RandomEngine Class Reference

#include <FastSimulation/Utilities/interface/RandomEngine.h>

List of all members.

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_.

00006   : 
00007   rng_(rng),
00008   rootEngine_(0)
00009 {
00010   // The service engine
00011   engine_ = &(rng->getEngine());
00012   // Get the TRandom3 egine, to benefit from Root functional random generation
00013   if ( engine_->name() == "TRandom3" )
00014     rootEngine_ = ( (edm::TRandomAdaptor*) engine_ )->getRootEngine();
00015   // If no root engine, use the CLHEP wrapper.
00016   if ( !rootEngine_ ) { 
00017     flatDistribution_ = new CLHEP::RandFlat(*engine_);
00018     gaussianDistribution_ = new CLHEP::RandGaussQ(*engine_);
00019     poissonDistribution_ = new CLHEP::RandPoissonQ(*engine_);
00020   }
00021 }

RandomEngine::~RandomEngine (  ) 

Definition at line 23 of file RandomEngine.cc.

References flatDistribution_, gaussianDistribution_, poissonDistribution_, and rootEngine_.

00024 {
00025   if ( !rootEngine_ ) { 
00026     delete flatDistribution_;
00027     delete gaussianDistribution_;
00028     delete poissonDistribution_;  
00029   }
00030 }


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::beginJob(), BremsstrahlungSimulator::brem(), NuclearInteractionSimulator::compute(), EMShower::compute(), PairProductionSimulator::compute(), HFShower::compute(), HDShower::compute(), MultipleScatteringSimulator::compute(), HDRShower::computeShower(), CalorimetryManager::EMShowerSimulation(), GammaFunctionGenerator::gammaFrac(), GammaFunctionGenerator::gammaInt(), SiTrackerGaussianSmearingRecHitConverter::gaussianSmearing(), PairProductionSimulator::gbteth(), BremsstrahlungSimulator::gbteth(), FlatPrimaryVertexGenerator::generate(), BaseNumericalRandomGenerator::generate(), BaseNumericalRandomGenerator::generateExp(), BaseNumericalRandomGenerator::generateLin(), HDRShower::getR(), HDShower::HDShower(), HFShower::HFShower(), ParticlePropagator::initProperDecayTime(), HCALResponse::interMU(), FML3EfficiencyHandler::kill(), FMGLfromL3EfficiencyHandler::kill(), FML1EfficiencyHandler::kill(), FMGLfromTKEfficiencyHandler::kill(), FMGLfromL3TKEfficiencyHandler::kill(), HFShower::makeSteps(), HDShower::makeSteps(), HcalRecHitsMaker::noisifySubdet(), EcalPreshowerRecHitsMaker::noisifySubdet(), NuclearInteractionSimulator::NuclearInteractionSimulator(), BremsstrahlungSimulator::poisson(), PileUpProducer::produce(), HDRShower::setHit(), GaussianTail::shoot(), FML1PtSmearer::smear(), SiPixelGaussianSmearingRecHitConverterAlgorithm::smearHit(), HDRShower::thetaFunction(), and TrajectoryManager::TrajectoryManager().

00030                                                                  { 
00031     return rootEngine_ ? 
00032       xmin + (xmax-xmin) * rootEngine_->Rndm()
00033       :
00034       xmin + (xmax-xmin)*flatDistribution_->fire();
00035   }

double RandomEngine::gaussShoot ( double  mean = 0.0,
double  sigma = 1.0 
) const [inline]

Definition at line 37 of file RandomEngine.h.

References gaussianDistribution_, mean(), and rootEngine_.

Referenced by RadialInterval::addInterval(), EMShower::compute(), HFShower::compute(), MultipleScatteringSimulator::compute(), HcalRecHitsMaker::Fill(), EcalPreshowerRecHitsMaker::Fill(), BetaFuncPrimaryVertexGenerator::generate(), GaussianPrimaryVertexGenerator::generate(), CalorimetryManager::HDShowerSimulation(), EcalBarrelRecHitsMaker::loadEcalBarrelRecHits(), EcalEndcapRecHitsMaker::loadEcalEndcapRecHits(), HcalRecHitsMaker::noisifySubdet(), CalorimetryManager::reconstructECAL(), CalorimetryManager::reconstructHCAL(), GaussianTail::shoot(), FML3PtSmearer::smear(), SiStripGaussianSmearingRecHitConverterAlgorithm::smearHit(), and HDRShower::thetaFunction().

00037                                                                     { 
00038     return rootEngine_ ?
00039       rootEngine_->Gaus(mean,sigma)
00040       : 
00041       mean + sigma*gaussianDistribution_->fire();
00042   }

unsigned int RandomEngine::poissonShoot ( double  mean  )  const [inline]

Definition at line 44 of file RandomEngine.h.

References poissonDistribution_, and rootEngine_.

Referenced by EMShower::compute(), HcalRecHitsMaker::noisifySubdet(), EcalPreshowerRecHitsMaker::noisifySubdet(), and PileUpProducer::produce().

00044                                                      { 
00045     return rootEngine_ ? 
00046       rootEngine_->Poisson(mean)
00047       :
00048       poissonDistribution_->fire(mean);
00049   }

CLHEP::HepRandomEngine* RandomEngine::theEngine (  )  const [inline]

Definition at line 24 of file RandomEngine.h.

References engine_.

00024 { return engine_; }

edm::RandomNumberGenerator* RandomEngine::theRandomNumberGenerator (  )  const [inline]

Definition at line 22 of file RandomEngine.h.

References rng_.

00022 {return rng_;}


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().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:30:37 2009 for CMSSW by  doxygen 1.5.4