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