CMS 3D CMS Logo

Public Member Functions | Private Attributes

RandomEngine Class Reference

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

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

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_, rootEngine_, SiStripMonitorClusterAlca_cfi::xmax, and SiStripMonitorClusterAlca_cfi::xmin.

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(), 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]
unsigned int RandomEngine::poissonShoot ( double  mean) const [inline]
CLHEP::HepRandomEngine* RandomEngine::theEngine ( ) const [inline]

Definition at line 24 of file RandomEngine.h.

References engine_.

{ return engine_; }
edm::RandomNumberGenerator* RandomEngine::theRandomNumberGenerator ( ) const [inline]

Definition at line 22 of file RandomEngine.h.

References rng_.

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

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