1 #ifndef IOMC_RandomEngine_RandomNumberGeneratorService_h
2 #define IOMC_RandomEngine_RandomNumberGeneratorService_h
32 class HepRandomEngine;
40 class LuminosityBlockIndex;
41 class ModuleCallingContext;
42 class ModuleDescription;
78 virtual std::uint32_t
mySeed()
const override;
114 virtual void print(std::ostream& os)
const override;
165 void snapShot(std::vector<LabelAndEngine>
const& engines, std::vector<RandomEngineState>& cache);
167 std::vector<LabelAndEngine>& engines);
176 void writeStates(std::vector<RandomEngineState>
const&
v,
183 std::vector<RandomEngineState>& cache);
185 std::vector<RandomEngineState>& cache);
187 std::vector<RandomEngineState>& cache,
190 std::vector<RandomEngineState>& cache,
193 void readVector(std::istream& is,
unsigned numItems, std::vector<std::uint32_t>&
v);
196 unsigned int seedOffset,
197 unsigned int eventSeedOffset,
198 std::vector<ModuleIDToEngine>& moduleIDVector);
203 std::uint32_t offset1,
204 std::uint32_t offset2);
254 std::vector<edm::propagate_const<std::shared_ptr<std::ofstream>>>
outFiles_;
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)
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &streamID) override
Use this engine in event methods.
static const std::uint32_t maxSeedRanecu
void readFromEvent(Event const &event)
std::string const & engineName() const
std::atomic< bool > saveFileNameRecorded_
std::string constructSaveFileName() const
bool operator<(ModuleIDToEngine const &r) const
VUint32 const & seeds() const
std::shared_ptr< CLHEP::HepRandomEngine const > engine() 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)
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)
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)
std::vector< edm::propagate_const< std::shared_ptr< std::ofstream > > > outFiles_
edm::propagate_const< std::shared_ptr< CLHEP::HepRandomEngine > > engine_
LabelAndEngine const * labelAndEngine() 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)
void preModuleStreamBeginRun(StreamContext const &sc, ModuleCallingContext const &mcc)
edm::propagate_const< LabelAndEngine * > labelAndEngine_
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)
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
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_
std::shared_ptr< CLHEP::HepRandomEngine > & engine()
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(std::string const &theLabel, VUint32 const &theSeeds, std::shared_ptr< CLHEP::HepRandomEngine > const &theEngine)
void checkEngineType(std::string const &typeFromConfig, std::string const &typeFromEvent, std::string const &engineLabel) const
edm::InputTag restoreStateBeginLumiTag_
void postForkReacquireResources(unsigned childIndex, unsigned kMaxChildren)
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)