|
|
Go to the documentation of this file. 1 #ifndef IOMC_RandomEngine_RandomNumberGeneratorService_h
2 #define IOMC_RandomEngine_RandomNumberGeneratorService_h
32 class HepRandomEngine;
38 class ConsumesCollector;
41 class LuminosityBlockIndex;
42 class ModuleCallingContext;
43 class ModuleDescription;
82 std::uint32_t
mySeed()
const override;
122 void print(std::ostream& os)
const override;
131 std::shared_ptr<CLHEP::HepRandomEngine>
const& theEngine)
173 void snapShot(std::vector<LabelAndEngine>
const& engines, std::vector<RandomEngineState>&
cache);
174 void restoreFromCache(std::vector<RandomEngineState>
const&
cache, std::vector<LabelAndEngine>& engines);
190 std::vector<RandomEngineState>&
cache,
193 std::vector<RandomEngineState>&
cache,
196 void readVector(std::istream& is,
unsigned numItems, std::vector<std::uint32_t>&
v);
199 unsigned int seedOffset,
200 unsigned int eventSeedOffset,
201 std::vector<ModuleIDToEngine>& moduleIDVector);
206 std::uint32_t offset1,
207 std::uint32_t offset2);
260 std::vector<edm::propagate_const<std::shared_ptr<std::ofstream>>>
outFiles_;
std::vector< std::uint32_t > VUint32
LabelAndEngine(std::string const &theLabel, VUint32 const &theSeeds, std::shared_ptr< CLHEP::HepRandomEngine > const &theEngine)
std::vector< std::vector< RandomEngineState > > lumiCache_
VUint32 const & seeds() const
void readEventStatesFromTextFile(std::string const &fileName, std::vector< RandomEngineState > &cache)
LabelAndEngine *& labelAndEngine()
void saveStatesToFile(std::string const &fileName, StreamID const &streamID, LuminosityBlockIndex const &lumiIndex)
static const std::vector< std::uint32_t >::size_type maxStates
std::vector< std::vector< LabelAndEngine > > streamEngines_
void print(std::ostream &os) const override
For debugging.
std::vector< std::vector< RandomEngineState > > eventCache_
void consumes(ConsumesCollector &&iC) const override
static void fillDescriptions(ConfigurationDescriptions &descriptions)
std::uint32_t mySeed() const override
void preallocate(SystemBounds const &)
void createEnginesInVector(std::vector< LabelAndEngine > &engines, unsigned int seedOffset, unsigned int eventSeedOffset, std::vector< ModuleIDToEngine > &moduleIDVector)
bool readEngineState(std::istream &is, std::vector< RandomEngineState > &cache, std::string const &whichStates, bool &saveToCache)
std::string constructSaveFileName() const
void postModuleStreamEndLumi(StreamContext const &sc, ModuleCallingContext const &mcc)
void setModuleID(unsigned int v)
std::uint32_t eventSeedOffset_
LabelAndEngine const * labelAndEngine() const
std::vector< RandomEngineState > const & getEventCache(StreamID const &) const override
void readStatesFromFile(std::string const &fileName, std::vector< RandomEngineState > &cache, std::string const &whichStates)
edm::propagate_const< LabelAndEngine * > labelAndEngine_
std::unique_ptr< CLHEP::HepRandomEngine > cloneEngine(LuminosityBlockIndex const &) override
void setEventCache(StreamID, std::vector< RandomEngineState > const &iStates) override
constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
SeedsAndName(VUint32 const &theSeeds, std::string const &theEngineName)
void checkEngineType(std::string const &typeFromConfig, std::string const &typeFromEvent, std::string const &engineLabel) const
void setEngineState(std::vector< unsigned long > const &v)
VUint32 const & seeds() const
std::string const & engineName() const
void readLumiStatesFromTextFile(std::string const &fileName, std::vector< RandomEngineState > &cache)
void restoreFromCache(std::vector< RandomEngineState > const &cache, std::vector< LabelAndEngine > &engines)
std::shared_ptr< CLHEP::HepRandomEngine > & engine()
void postEventRead(Event const &event) override
edm::InputTag restoreStateBeginLumiTag_
void writeVector(VUint32 const &v, std::ofstream &outFile)
std::shared_ptr< CLHEP::HepRandomEngine const > engine() const
static const std::vector< std::uint32_t >::size_type maxSeeds
std::vector< std::vector< ModuleIDToEngine > > lumiModuleIDToEngine_
std::string const & label() const
static const std::uint32_t maxSeedHepJames
void preModuleStreamCheck(StreamContext const &sc, ModuleCallingContext const &mcc)
void readVector(std::istream &is, unsigned numItems, std::vector< std::uint32_t > &v)
void postModuleStreamBeginLumi(StreamContext const &sc, ModuleCallingContext const &mcc)
std::vector< std::vector< LabelAndEngine > > lumiEngines_
void postModuleBeginStream(StreamContext const &sc, ModuleCallingContext const &mcc)
std::string restoreFileName_
edm::propagate_const< std::shared_ptr< CLHEP::HepRandomEngine > > engine_
void writeStates(std::vector< RandomEngineState > const &v, std::ofstream &outFile)
void preModuleStreamEndLumi(StreamContext const &sc, ModuleCallingContext const &mcc)
void preBeginLumi(LuminosityBlock const &lumi) override
CLHEP::HepRandomEngine & getEngine(StreamID const &streamID) override
Use this engine in event methods.
std::atomic< bool > saveFileNameRecorded_
std::map< std::string, SeedsAndName > seedsAndNameMap_
void setSeed(std::uint32_t v, unsigned int index)
static constexpr unsigned int kInvalid
void readFromLuminosityBlock(LuminosityBlock const &lumi)
static const std::uint32_t maxSeedRanecu
RandomNumberGeneratorService const & operator=(RandomNumberGeneratorService const &)=delete
void readFromEvent(Event const &event)
unsigned int moduleID() const
void preModuleConstruction(ModuleDescription const &description)
std::vector< unsigned long > engineState_
std::vector< std::vector< ModuleIDToEngine > > streamModuleIDToEngine_
void preModuleEndStream(StreamContext const &sc, ModuleCallingContext const &mcc)
void preModuleStreamBeginLumi(StreamContext const &sc, ModuleCallingContext const &mcc)
edm::InputTag restoreStateTag_
std::vector< edm::propagate_const< std::shared_ptr< std::ofstream > > > outFiles_
~RandomNumberGeneratorService() override
bool operator<(ModuleIDToEngine const &r) const
void postModuleStreamCheck(StreamContext const &sc, ModuleCallingContext const &mcc)
void postModuleStreamEndRun(StreamContext const &sc, ModuleCallingContext const &mcc)
std::string saveFileName_
ModuleIDToEngine(LabelAndEngine *theLabelAndEngine, unsigned int theModuleID)
unsigned int moduleID() const
void preModuleStreamBeginRun(StreamContext const &sc, ModuleCallingContext const &mcc)
void resetEngineSeeds(LabelAndEngine &labelAndEngine, std::string const &engineName, VUint32 const &seeds, std::uint32_t offset1, std::uint32_t offset2)
std::vector< unsigned long > const & engineState() const
static const std::uint32_t maxSeedTRandom3
void postModuleStreamBeginRun(StreamContext const &sc, ModuleCallingContext const &mcc)
void postModuleEndStream(StreamContext const &sc, ModuleCallingContext const &mcc)
void preModuleDestruction(ModuleDescription const &description)
std::vector< RandomEngineState > const & getLumiCache(LuminosityBlockIndex const &) const override
These two are used by the RandomEngineStateProducer.
void preModuleBeginStream(StreamContext const &sc, ModuleCallingContext const &mcc)
RandomNumberGeneratorService(ParameterSet const &pset, ActivityRegistry &activityRegistry)
void snapShot(std::vector< LabelAndEngine > const &engines, std::vector< RandomEngineState > &cache)
void preModuleStreamEndRun(StreamContext const &sc, ModuleCallingContext const &mcc)
void setLumiCache(LuminosityBlockIndex, std::vector< RandomEngineState > const &iStates) override