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 virtual CLHEP::HepRandomEngine& getEngine(
StreamID const& streamID)
override;
66 virtual CLHEP::HepRandomEngine& getEngine(
LuminosityBlockIndex const& luminosityBlockIndex)
override;
79 virtual std::uint32_t
mySeed()
const override;
85 void postForkReacquireResources(
unsigned childIndex,
unsigned kMaxChildren);
88 virtual void postEventRead(
Event const&
event)
override;
111 virtual std::vector<RandomEngineState>
const& getLumiCache(
LuminosityBlockIndex const&)
const override;
112 virtual std::vector<RandomEngineState>
const& getEventCache(
StreamID const&)
const override;
117 virtual void print(std::ostream& os)
const override;
126 label_(theLabel), seeds_(theSeeds), engine_(theEngine) { }
128 VUint32
const&
seeds()
const {
return seeds_; }
144 engineState_(), labelAndEngine_(theLabelAndEngine), moduleID_(theModuleID) { }
146 std::vector<unsigned long>
const&
engineState()
const {
return engineState_; }
149 unsigned int moduleID()
const {
return moduleID_; }
166 void readFromEvent(
Event const& event);
168 void snapShot(std::vector<LabelAndEngine>
const& engines, std::vector<RandomEngineState>&
cache);
169 void restoreFromCache(std::vector<RandomEngineState>
const&
cache,
170 std::vector<LabelAndEngine>& engines);
172 void checkEngineType(
std::string const& typeFromConfig,
179 void writeStates(std::vector<RandomEngineState>
const&
v,
186 std::vector<RandomEngineState>&
cache);
188 std::vector<RandomEngineState>&
cache);
190 std::vector<RandomEngineState>&
cache,
192 bool readEngineState(std::istream& is,
193 std::vector<RandomEngineState>&
cache,
196 void readVector(std::istream& is,
unsigned numItems, std::vector<std::uint32_t>&
v);
198 void createEnginesInVector(std::vector<LabelAndEngine>& engines,
199 unsigned int seedOffset,
200 unsigned int eventSeedOffset,
201 std::vector<ModuleIDToEngine>& moduleIDVector);
205 VUint32
const& seeds,
206 std::uint32_t offset1,
207 std::uint32_t offset2);
239 seeds_(theSeeds), engineName_(theEngineName), moduleID_(
std::numeric_limits<unsigned
int>::
max()) { }
240 VUint32
const&
seeds()
const {
return seeds_; }
242 unsigned int moduleID()
const {
return moduleID_; }
257 std::vector<edm::propagate_const<std::shared_ptr<std::ofstream>>>
outFiles_;
unsigned int moduleID() const
static const std::uint32_t maxSeedRanecu
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
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)
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
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)