#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::RandomNumberGenerator * | theRandomNumberGenerator () const |
~RandomEngine () | |
Private Attributes | |
CLHEP::HepRandomEngine * | engine_ |
CLHEP::RandFlat * | flatDistribution_ |
CLHEP::RandGauss * | gaussianDistribution_ |
CLHEP::RandPoisson * | poissonDistribution_ |
edm::RandomNumberGenerator * | rng_ |
TRandom3 * | rootEngine_ |
Definition at line 18 of file RandomEngine.h.
RandomEngine::RandomEngine | ( | edm::RandomNumberGenerator * | rng | ) |
Definition at line 5 of file RandomEngine.cc.
References engine_, flatDistribution_, gaussianDistribution_, edm::RandomNumberGenerator::getEngine(), poissonDistribution_, and rootEngine_.
: rng_(rng), rootEngine_(0) { // The service engine engine_ = &(rng->getEngine()); // Get the TRandom3 egine, to benefit from Root functional random generation if ( engine_->name() == "TRandom3" ) rootEngine_ = ( (edm::TRandomAdaptor*) engine_ )->getRootEngine(); // If no root engine, use the CLHEP wrapper. if ( !rootEngine_ ) { flatDistribution_ = new CLHEP::RandFlat(*engine_); gaussianDistribution_ = new CLHEP::RandGaussQ(*engine_); poissonDistribution_ = new CLHEP::RandPoissonQ(*engine_); } }
RandomEngine::~RandomEngine | ( | ) |
Definition at line 23 of file RandomEngine.cc.
References flatDistribution_, gaussianDistribution_, poissonDistribution_, and rootEngine_.
{ if ( !rootEngine_ ) { delete flatDistribution_; delete gaussianDistribution_; delete poissonDistribution_; } }
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(), MuonBremsstrahlungSimulator::brem(), 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(), MuonBremsstrahlungSimulator::gbteth(), BremsstrahlungSimulator::gbteth(), SimpleHistogramGenerator::generate(), FlatPrimaryVertexGenerator::generate(), BaseNumericalRandomGenerator::generate(), BaseNumericalRandomGenerator::generateExp(), BaseNumericalRandomGenerator::generateLin(), HDRShower::getR(), HDShower::HDShower(), HFShower::HFShower(), ParticlePropagator::initProperDecayTime(), HCALResponse::interMU(), HFShower::makeSteps(), HDShower::makeSteps(), HcalRecHitsMaker::noisifySubdet(), EcalPreshowerRecHitsMaker::noisifySubdet(), NuclearInteractionSimulator::NuclearInteractionSimulator(), MuonBremsstrahlungSimulator::poisson(), BremsstrahlungSimulator::poisson(), PileUpProducer::produce(), MuonSimHitProducer::produce(), EcalEndcapRecHitsMaker::randomNoisifier(), EcalBarrelRecHitsMaker::randomNoisifier(), HDRShower::setHit(), GaussianTail::shoot(), SiPixelGaussianSmearingRecHitConverterAlgorithm::smearHit(), and HDRShower::thetaFunction().
{ return rootEngine_ ? xmin + (xmax-xmin) * rootEngine_->Rndm() : xmin + (xmax-xmin)*flatDistribution_->fire(); }
double RandomEngine::gaussShoot | ( | double | mean = 0.0 , |
double | sigma = 1.0 |
||
) | const [inline] |
Definition at line 37 of file RandomEngine.h.
References gaussianDistribution_, timingPdfMaker::mean, and rootEngine_.
Referenced by RadialInterval::addInterval(), EMShower::compute(), MultipleScatteringSimulator::compute(), EMShower::EMShower(), HcalRecHitsMaker::Fill(), EcalPreshowerRecHitsMaker::Fill(), BetaFuncPrimaryVertexGenerator::generate(), GaussianPrimaryVertexGenerator::generate(), CalorimetryManager::HDShowerSimulation(), EcalEndcapRecHitsMaker::loadPCaloHits(), EcalBarrelRecHitsMaker::loadPCaloHits(), HcalRecHitsMaker::noisifySubdet(), EcalEndcapRecHitsMaker::noisifySuperCrystals(), EcalBarrelRecHitsMaker::noisifyTriggerTower(), EcalEndcapRecHitsMaker::randomNoisifier(), EcalBarrelRecHitsMaker::randomNoisifier(), CalorimetryManager::reconstructECAL(), CalorimetryManager::reconstructHCAL(), GaussianTail::shoot(), SiStripGaussianSmearingRecHitConverterAlgorithm::smearHit(), and HDRShower::thetaFunction().
{ return rootEngine_ ? rootEngine_->Gaus(mean,sigma) : mean + sigma*gaussianDistribution_->fire(); }
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(), PileUpProducer::produce(), EcalEndcapRecHitsMaker::randomNoisifier(), and EcalBarrelRecHitsMaker::randomNoisifier().
{ return rootEngine_ ? rootEngine_->Poisson(mean) : poissonDistribution_->fire(mean); }
CLHEP::HepRandomEngine* RandomEngine::theEngine | ( | ) | const [inline] |
edm::RandomNumberGenerator* RandomEngine::theRandomNumberGenerator | ( | ) | const [inline] |
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().