#include <ExternalRandomNumberGeneratorService.h>
Public Member Functions | |
std::unique_ptr< CLHEP::HepRandomEngine > | cloneEngine (LuminosityBlockIndex const &) final |
void | consumes (ConsumesCollector &&iC) const final |
ExternalRandomNumberGeneratorService () | |
CLHEP::HepRandomEngine & | getEngine (LuminosityBlockIndex const &) final |
Use this engine in the global begin luminosity block method. More... | |
CLHEP::HepRandomEngine & | getEngine (StreamID const &) final |
Use this engine in event methods. More... | |
std::vector< RandomEngineState > const & | getEventCache (StreamID const &) const final |
std::vector< RandomEngineState > const & | getLumiCache (LuminosityBlockIndex const &) const final |
std::vector< unsigned long > | getState () const |
std::uint32_t | mySeed () const final |
void | postEventRead (Event const &event) final |
void | preBeginLumi (LuminosityBlock const &lumi) final |
void | print (std::ostream &os) const final |
For debugging purposes only. More... | |
void | setEventCache (StreamID, std::vector< RandomEngineState > const &iStates) final |
void | setLumiCache (LuminosityBlockIndex, std::vector< RandomEngineState > const &iStates) final |
void | setState (std::vector< unsigned long > const &, long seed) |
Public Member Functions inherited from edm::RandomNumberGenerator | |
RandomNumberGenerator const & | operator= (RandomNumberGenerator const &)=delete |
RandomNumberGenerator () | |
RandomNumberGenerator (RandomNumberGenerator const &)=delete | |
virtual | ~RandomNumberGenerator () |
Private Member Functions | |
std::unique_ptr< CLHEP::HepRandomEngine > | createFromState (std::vector< unsigned long > const &, long seed) const |
ExternalRandomNumberGeneratorService (ExternalRandomNumberGeneratorService const &)=delete | |
ExternalRandomNumberGeneratorService const & | operator= (ExternalRandomNumberGeneratorService const &)=delete |
Private Attributes | |
std::unique_ptr< CLHEP::HepRandomEngine > | engine_ |
Definition at line 20 of file ExternalRandomNumberGeneratorService.h.
ExternalRandomNumberGeneratorService::ExternalRandomNumberGeneratorService | ( | ) |
Definition at line 22 of file ExternalRandomNumberGeneratorService.cc.
|
privatedelete |
|
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 39 of file ExternalRandomNumberGeneratorService.cc.
References createFromState(), and engine_.
|
finalvirtual |
Implements edm::RandomNumberGenerator.
Definition at line 88 of file ExternalRandomNumberGeneratorService.cc.
|
private |
Definition at line 46 of file ExternalRandomNumberGeneratorService.cc.
References Exception, and edm::errors::Unknown.
Referenced by cloneEngine(), and setState().
|
finalvirtual |
Use this engine in the global begin luminosity block method.
Implements edm::RandomNumberGenerator.
Definition at line 35 of file ExternalRandomNumberGeneratorService.cc.
References engine_.
|
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 34 of file ExternalRandomNumberGeneratorService.cc.
References engine_.
|
finalvirtual |
Implements edm::RandomNumberGenerator.
Definition at line 79 of file ExternalRandomNumberGeneratorService.cc.
|
finalvirtual |
Implements edm::RandomNumberGenerator.
Definition at line 83 of file ExternalRandomNumberGeneratorService.cc.
std::vector< unsigned long > ExternalRandomNumberGeneratorService::getState | ( | ) | const |
Definition at line 32 of file ExternalRandomNumberGeneratorService.cc.
References engine_.
Referenced by main().
|
finalvirtual |
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 69 of file ExternalRandomNumberGeneratorService.cc.
Referenced by main().
|
privatedelete |
|
finalvirtual |
Implements edm::RandomNumberGenerator.
Definition at line 73 of file ExternalRandomNumberGeneratorService.cc.
|
finalvirtual |
Implements edm::RandomNumberGenerator.
Definition at line 71 of file ExternalRandomNumberGeneratorService.cc.
|
finalvirtual |
For debugging purposes only.
Implements edm::RandomNumberGenerator.
Definition at line 91 of file ExternalRandomNumberGeneratorService.cc.
|
finalvirtual |
Implements edm::RandomNumberGenerator.
Definition at line 77 of file ExternalRandomNumberGeneratorService.cc.
|
finalvirtual |
Implements edm::RandomNumberGenerator.
Definition at line 75 of file ExternalRandomNumberGeneratorService.cc.
void ExternalRandomNumberGeneratorService::setState | ( | std::vector< unsigned long > const & | iState, |
long | seed | ||
) |
Definition at line 24 of file ExternalRandomNumberGeneratorService.cc.
References createFromState(), and engine_.
Referenced by main().
|
private |
Definition at line 58 of file ExternalRandomNumberGeneratorService.h.
Referenced by cloneEngine(), getEngine(), getState(), and setState().