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;
79 std::uint32_t
mySeed()
const override;
87 void postEventRead(
Event const&
event)
override;
111 std::vector<RandomEngineState>
const& getEventCache(
StreamID const&)
const override;
116 void print(std::ostream& os)
const override;
125 label_(theLabel), seeds_(theSeeds), engine_(theEngine) { }
127 VUint32
const&
seeds()
const {
return seeds_; }
143 engineState_(), labelAndEngine_(theLabelAndEngine), moduleID_(theModuleID) { }
145 std::vector<unsigned long>
const&
engineState()
const {
return engineState_; }
148 unsigned int moduleID()
const {
return moduleID_; }
165 void readFromEvent(
Event const& event);
167 void snapShot(std::vector<LabelAndEngine>
const& engines, std::vector<RandomEngineState>&
cache);
168 void restoreFromCache(std::vector<RandomEngineState>
const&
cache,
169 std::vector<LabelAndEngine>& engines);
171 void checkEngineType(
std::string const& typeFromConfig,
178 void writeStates(std::vector<RandomEngineState>
const&
v,
185 std::vector<RandomEngineState>&
cache);
187 std::vector<RandomEngineState>&
cache);
189 std::vector<RandomEngineState>&
cache,
191 bool readEngineState(std::istream& is,
192 std::vector<RandomEngineState>&
cache,
195 void readVector(std::istream& is,
unsigned numItems, std::vector<std::uint32_t>&
v);
197 void createEnginesInVector(std::vector<LabelAndEngine>& engines,
198 unsigned int seedOffset,
199 unsigned int eventSeedOffset,
200 std::vector<ModuleIDToEngine>& moduleIDVector);
204 VUint32
const& seeds,
205 std::uint32_t offset1,
206 std::uint32_t offset2);
238 seeds_(theSeeds), engineName_(theEngineName), moduleID_(
std::numeric_limits<unsigned
int>::
max()) { }
239 VUint32
const&
seeds()
const {
return seeds_; }
241 unsigned int moduleID()
const {
return moduleID_; }
256 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)