1 #ifndef IOMC_RandomEngine_RandomNumberGeneratorService_h
2 #define IOMC_RandomEngine_RandomNumberGeneratorService_h
31 class HepRandomEngine;
39 class LuminosityBlockIndex;
40 class ModuleCallingContext;
41 class ModuleDescription;
61 virtual CLHEP::HepRandomEngine&
getEngine(
StreamID const& streamID)
const override;
77 virtual std::uint32_t
mySeed()
const override;
121 virtual void print(std::ostream& os)
const override;
133 std::shared_ptr<CLHEP::HepRandomEngine>
const&
engine()
const {
return engine_; }
138 std::shared_ptr<CLHEP::HepRandomEngine>
engine_;
170 void snapShot(std::vector<LabelAndEngine>
const& engines, std::vector<RandomEngineState>& cache);
172 std::vector<LabelAndEngine>& engines);
181 void writeStates(std::vector<RandomEngineState>
const&
v,
188 std::vector<RandomEngineState>& cache);
190 std::vector<RandomEngineState>& cache);
192 std::vector<RandomEngineState>& cache,
195 std::vector<RandomEngineState>& cache,
198 void readVector(std::istream& is,
unsigned numItems, std::vector<std::uint32_t>&
v);
201 unsigned int seedOffset,
202 unsigned int eventSeedOffset,
203 std::vector<ModuleIDToEngine>& moduleIDVector);
208 std::uint32_t offset1,
209 std::uint32_t offset2);
std::shared_ptr< CLHEP::HepRandomEngine > engine_
void writeStates(std::vector< RandomEngineState > const &v, std::ofstream &outFile)
void preModuleStreamEndLumi(StreamContext const &sc, ModuleCallingContext const &mcc)
RandomNumberGeneratorService const & operator=(RandomNumberGeneratorService const &)=delete
unsigned int moduleID() const
void readVector(std::istream &is, unsigned numItems, std::vector< std::uint32_t > &v)
static const std::uint32_t maxSeedRanecu
std::shared_ptr< CLHEP::HepRandomEngine > const & engine() const
void postModuleEndJob(ModuleDescription const &description)
void readFromEvent(Event const &event)
std::string const & engineName() const
std::atomic< bool > saveFileNameRecorded_
std::string constructSaveFileName() const
static thread_local std::string moduleLabel_
bool operator<(ModuleIDToEngine const &r) const
VUint32 const & seeds() 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)
std::vector< std::shared_ptr< std::ofstream > > outFiles_
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 preModuleBeginJob(ModuleDescription const &description)
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)
std::string saveFileName_
void postModuleEndStream(StreamContext const &sc, ModuleCallingContext const &mcc)
std::vector< std::vector< ModuleIDToEngine > > streamModuleIDToEngine_
std::vector< unsigned long > const & engineState() 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)
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)
static const std::uint32_t maxSeedTRandom3
virtual void print(std::ostream &os) const override
For debugging.
unsigned int moduleID() const
std::vector< std::vector< LabelAndEngine > > streamEngines_
std::uint32_t eventSeedOffset_
std::vector< std::vector< RandomEngineState > > eventCache_
void readStatesFromFile(std::string const &fileName, std::vector< RandomEngineState > &cache, std::string const &whichStates)
std::string const & label() const
static void fillDescriptions(ConfigurationDescriptions &descriptions)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void readEventStatesFromTextFile(std::string const &fileName, std::vector< RandomEngineState > &cache)
std::vector< std::vector< RandomEngineState > > lumiCache_
void postModuleBeginJob(ModuleDescription const &description)
static const std::vector< std::uint32_t >::size_type maxStates
void preModuleStreamEndRun(StreamContext const &sc, ModuleCallingContext const &mcc)
virtual std::uint32_t mySeed() const override
void preallocate(SystemBounds const &)
std::vector< std::uint32_t > VUint32
LabelAndEngine * labelAndEngine() const
LabelAndEngine(std::string const &theLabel, VUint32 const &theSeeds, std::shared_ptr< CLHEP::HepRandomEngine > const &theEngine)
void preModuleEndJob(ModuleDescription const &description)
void checkEngineType(std::string const &typeFromConfig, std::string const &typeFromEvent, std::string const &engineLabel) const
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &streamID) const override
Use this engine in event methods.
edm::InputTag restoreStateBeginLumiTag_
void postForkReacquireResources(unsigned childIndex, unsigned kMaxChildren)
void postModuleConstruction(ModuleDescription const &description)
LabelAndEngine * labelAndEngine_
void postModuleStreamEndLumi(StreamContext const &sc, ModuleCallingContext const &mcc)
virtual ~RandomNumberGeneratorService()
virtual void postEventRead(Event const &event) override
virtual std::vector< RandomEngineState > const & getLumiCache(LuminosityBlockIndex const &) const override
These two are used by the RandomEngineStateProducer.
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)
void setModuleID(unsigned int v)
VUint32 const & seeds() const
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)
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)
virtual void preBeginLumi(LuminosityBlock const &lumi) override
virtual std::vector< RandomEngineState > const & getEventCache(StreamID const &) const override
void postModuleStreamBeginLumi(StreamContext const &sc, ModuleCallingContext const &mcc)
EventID const & max(EventID const &lh, EventID const &rh)