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;
63 CLHEP::HepRandomEngine& getEngine(
StreamID const& streamID)
override;
81 std::uint32_t
mySeed()
const override;
89 void postEventRead(
Event const&
event)
override;
91 void setEventCache(
StreamID, std::vector<RandomEngineState>
const& iStates)
override;
115 std::vector<RandomEngineState>
const& getEventCache(
StreamID const&)
const override;
120 void print(std::ostream& os)
const override;
129 label_(theLabel), seeds_(theSeeds), engine_(theEngine) { }
131 VUint32
const&
seeds()
const {
return seeds_; }
147 engineState_(), labelAndEngine_(theLabelAndEngine), moduleID_(theModuleID) { }
149 std::vector<unsigned long>
const&
engineState()
const {
return engineState_; }
152 unsigned int moduleID()
const {
return moduleID_; }
169 void readFromEvent(
Event const& event);
171 void snapShot(std::vector<LabelAndEngine>
const& engines, std::vector<RandomEngineState>&
cache);
172 void restoreFromCache(std::vector<RandomEngineState>
const&
cache,
173 std::vector<LabelAndEngine>& engines);
175 void checkEngineType(
std::string const& typeFromConfig,
182 void writeStates(std::vector<RandomEngineState>
const&
v,
189 std::vector<RandomEngineState>&
cache);
191 std::vector<RandomEngineState>&
cache);
193 std::vector<RandomEngineState>&
cache,
195 bool readEngineState(std::istream& is,
196 std::vector<RandomEngineState>&
cache,
199 void readVector(std::istream& is,
unsigned numItems, std::vector<std::uint32_t>&
v);
201 void createEnginesInVector(std::vector<LabelAndEngine>& engines,
202 unsigned int seedOffset,
203 unsigned int eventSeedOffset,
204 std::vector<ModuleIDToEngine>& moduleIDVector);
208 VUint32
const& seeds,
209 std::uint32_t offset1,
210 std::uint32_t offset2);
242 seeds_(theSeeds), engineName_(theEngineName), moduleID_(
std::numeric_limits<unsigned
int>::
max()) { }
243 VUint32
const&
seeds()
const {
return seeds_; }
245 unsigned int moduleID()
const {
return moduleID_; }
260 std::vector<edm::propagate_const<std::shared_ptr<std::ofstream>>>
outFiles_;
unsigned int moduleID() const
static const std::uint32_t maxSeedRanecu
std::string const & engineName() const
std::atomic< bool > saveFileNameRecorded_
bool operator<(ModuleIDToEngine const &r) const
VUint32 const & seeds() const
std::shared_ptr< CLHEP::HepRandomEngine const > engine() const
std::vector< unsigned long > engineState_
ModuleIDToEngine(LabelAndEngine *theLabelAndEngine, unsigned int theModuleID)
S & print(S &os, JobReport::InputFile const &f)
void setEngineState(std::vector< unsigned long > const &v)
edm::InputTag restoreStateTag_
void writeVector(std::ostream &os, int indentation, std::vector< T > const &value_, ValueFormat format)
void setSeed(std::uint32_t v, unsigned int index)
std::string saveFileName_
std::vector< std::vector< ModuleIDToEngine > > streamModuleIDToEngine_
std::vector< unsigned long > const & engineState() const
std::vector< edm::propagate_const< std::shared_ptr< std::ofstream > > > outFiles_
edm::propagate_const< std::shared_ptr< CLHEP::HepRandomEngine > > engine_
LabelAndEngine const * labelAndEngine() const
edm::propagate_const< LabelAndEngine * > labelAndEngine_
static const std::uint32_t maxSeedTRandom3
unsigned int moduleID() const
std::vector< std::vector< LabelAndEngine > > streamEngines_
std::uint32_t eventSeedOffset_
std::vector< std::vector< RandomEngineState > > eventCache_
std::string const & label() const
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
std::vector< std::vector< RandomEngineState > > lumiCache_
std::shared_ptr< CLHEP::HepRandomEngine > & engine()
static const std::vector< std::uint32_t >::size_type maxStates
std::vector< std::uint32_t > VUint32
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
LabelAndEngine(std::string const &theLabel, VUint32 const &theSeeds, std::shared_ptr< CLHEP::HepRandomEngine > const &theEngine)
edm::InputTag restoreStateBeginLumiTag_
LabelAndEngine *& labelAndEngine()
std::string restoreFileName_
static const std::vector< std::uint32_t >::size_type maxSeeds
void setModuleID(unsigned int v)
VUint32 const & seeds() const
RandomNumberGeneratorService
Modules for shifting and smearing 4-vectors' energies of Objects.
std::vector< std::vector< LabelAndEngine > > lumiEngines_
std::map< std::string, SeedsAndName > seedsAndNameMap_
std::vector< std::vector< ModuleIDToEngine > > lumiModuleIDToEngine_
static const std::uint32_t maxSeedHepJames
SeedsAndName(VUint32 const &theSeeds, std::string const &theEngineName)