#include "PileupRandomNumberGenerator.h"
Public Member Functions | |
std::unique_ptr< CLHEP::HepRandomEngine > | cloneEngine (edm::LuminosityBlockIndex const &) final |
CLHEP::HepRandomEngine & | getEngine (edm::StreamID const &) final |
Use this engine in event methods. More... | |
CLHEP::HepRandomEngine & | getEngine (edm::LuminosityBlockIndex const &) final |
Use this engine in the global begin luminosity block method. More... | |
std::uint32_t | mySeed () const final |
PileupRandomNumberGenerator (std::vector< std::string > const &iModuleLabels) | |
void | setEngine (CLHEP::HepRandomEngine const &) |
void | setSeed (uint32_t iSeed) |
Public Member Functions inherited from edm::RandomNumberGenerator | |
RandomNumberGenerator const & | operator= (RandomNumberGenerator const &)=delete |
RandomNumberGenerator () | |
RandomNumberGenerator (RandomNumberGenerator const &)=delete | |
virtual | ~RandomNumberGenerator () |
Private Member Functions | |
void | consumes (edm::ConsumesCollector &&iC) const final |
const std::string & | findPresentModule () const |
std::vector< RandomEngineState > const & | getEventCache (edm::StreamID const &) const final |
std::vector< RandomEngineState > const & | getLumiCache (edm::LuminosityBlockIndex const &) const final |
void | postEventRead (edm::Event const &event) final |
void | preBeginLumi (edm::LuminosityBlock const &lumi) final |
void | print (std::ostream &os) const final |
For debugging purposes only. More... | |
void | setEventCache (edm::StreamID, std::vector< RandomEngineState > const &iStates) final |
void | setLumiCache (edm::LuminosityBlockIndex, std::vector< RandomEngineState > const &iStates) final |
Static Private Member Functions | |
static std::unique_ptr< CLHEP::HepRandomEngine > | cloneEngine (CLHEP::HepRandomEngine const &existingEngine) |
Private Attributes | |
std::unordered_map< std::string, std::unique_ptr< CLHEP::HepRandomEngine > > | m_modulesToEngines |
uint32_t | m_seed |
Description: Handle forwarding random numbers to modules within a mixing module
Usage: Internal
Definition at line 32 of file PileupRandomNumberGenerator.h.
PileupRandomNumberGenerator::PileupRandomNumberGenerator | ( | std::vector< std::string > const & | iModuleLabels | ) |
Definition at line 27 of file PileupRandomNumberGenerator.cc.
References m_modulesToEngines, and Skims_PA_cff::name.
|
finalvirtual |
This function is not intended for general use. It is intended for the special case where multiple instances of Pythia 8 will be run concurrently and we want them to be initialized exactly the same. In this special case, the luminosity block engine(s) owned by the service should not be used to generate random numbers in between calls to cloneEngine, because the clone will be in the state that existed at the moment of cloning. Before initializing Pythia, this function should be used to clone the engine owned by the service and the cloned random engine should be used to generate numbers for initialization so that all initializations in the process get identical sequences of random numbers.
Implements edm::RandomNumberGenerator.
Definition at line 41 of file PileupRandomNumberGenerator.cc.
References edm::cloneEngine(), findPresentModule(), and m_modulesToEngines.
|
staticprivate |
|
finalprivatevirtual |
Implements edm::RandomNumberGenerator.
Definition at line 70 of file PileupRandomNumberGenerator.cc.
|
private |
Definition at line 74 of file PileupRandomNumberGenerator.cc.
References Exception, edm::CurrentModuleOnThread::getCurrentModuleOnThread(), edm::errors::LogicError, edm::ModuleCallingContext::moduleDescription(), and edm::ModuleDescription::moduleLabel().
Referenced by cloneEngine(), and getEngine().
|
finalvirtual |
Use this engine in event methods.
Use the next 2 functions to get the random number engine. These are the only functions most modules should call.
Implements edm::RandomNumberGenerator.
Definition at line 33 of file PileupRandomNumberGenerator.cc.
References findPresentModule(), and m_modulesToEngines.
|
finalvirtual |
Use this engine in the global begin luminosity block method.
Implements edm::RandomNumberGenerator.
Definition at line 37 of file PileupRandomNumberGenerator.cc.
References findPresentModule(), and m_modulesToEngines.
|
finalprivatevirtual |
Implements edm::RandomNumberGenerator.
Definition at line 61 of file PileupRandomNumberGenerator.cc.
|
finalprivatevirtual |
Implements edm::RandomNumberGenerator.
Definition at line 65 of file PileupRandomNumberGenerator.cc.
|
inlinefinalvirtual |
This returns the seed from the configuration. In the unusual case where an an engine type takes multiple seeds to initialize a sequence, this function only returns the first. As a general rule, this function should not be used, but is available for backward compatibility and debugging. It might be useful for some types of tests. Using this to seed engines constructed in modules is not recommended because (unless done very carefully) it will create duplicate sequences in different threads and/or data races. Also, if engines are created by modules the replay mechanism will be broken. Because it is dangerous and could be misused, this function might be deleted someday if we ever find time to delete all uses of it in CMSSW. There are of order 10 last time I checked ...
Implements edm::RandomNumberGenerator.
Definition at line 45 of file PileupRandomNumberGenerator.h.
References m_seed.
|
finalprivatevirtual |
Implements edm::RandomNumberGenerator.
Definition at line 55 of file PileupRandomNumberGenerator.cc.
|
finalprivatevirtual |
Implements edm::RandomNumberGenerator.
Definition at line 54 of file PileupRandomNumberGenerator.cc.
|
finalprivatevirtual |
For debugging purposes only.
Implements edm::RandomNumberGenerator.
Definition at line 72 of file PileupRandomNumberGenerator.cc.
void PileupRandomNumberGenerator::setEngine | ( | CLHEP::HepRandomEngine const & | iEngine | ) |
Definition at line 48 of file PileupRandomNumberGenerator.cc.
References edm::cloneEngine(), m_modulesToEngines, and findQualityFiles::v.
Referenced by edm::PileUp::setRandomEngine().
|
finalprivatevirtual |
Implements edm::RandomNumberGenerator.
Definition at line 59 of file PileupRandomNumberGenerator.cc.
|
finalprivatevirtual |
Implements edm::RandomNumberGenerator.
Definition at line 57 of file PileupRandomNumberGenerator.cc.
void PileupRandomNumberGenerator::setSeed | ( | uint32_t | iSeed | ) |
Definition at line 46 of file PileupRandomNumberGenerator.cc.
References m_seed.
Referenced by edm::PileUp::setRandomEngine().
|
private |
Definition at line 66 of file PileupRandomNumberGenerator.h.
Referenced by cloneEngine(), getEngine(), PileupRandomNumberGenerator(), and setEngine().
|
private |
Definition at line 67 of file PileupRandomNumberGenerator.h.