CMS 3D CMS Logo

RandomNumberGeneratorService.h
Go to the documentation of this file.
1 #ifndef IOMC_RandomEngine_RandomNumberGeneratorService_h
2 #define IOMC_RandomEngine_RandomNumberGeneratorService_h
3 
17 
18 #include <atomic>
19 #include <cstdint>
20 #include <fstream>
21 #include <iosfwd>
22 #include <istream>
23 #include <limits>
24 #include <map>
25 #include <memory>
26 #include <string>
27 #include <vector>
28 
29 class RandomEngineState;
30 
31 namespace CLHEP {
32  class HepRandomEngine;
33 }
34 
35 namespace edm {
36  class ActivityRegistry;
38  class ConsumesCollector;
39  class Event;
40  class LuminosityBlock;
41  class LuminosityBlockIndex;
42  class ModuleCallingContext;
43  class ModuleDescription;
44  class ParameterSet;
45  class StreamContext;
46  class StreamID;
47 
48  namespace service {
49 
50  class SystemBounds;
51 
53  public:
56 
59 
62 
64  CLHEP::HepRandomEngine& getEngine(StreamID const& streamID) override;
65 
67  CLHEP::HepRandomEngine& getEngine(LuminosityBlockIndex const& luminosityBlockIndex) override;
68 
69  std::unique_ptr<CLHEP::HepRandomEngine> cloneEngine(LuminosityBlockIndex const&) override;
70 
71  // This returns the seed from the configuration. In the unusual case where an
72  // an engine type takes multiple seeds to initialize a sequence, this function
73  // only returns the first. As a general rule, this function should not be used,
74  // but is available for backward compatibility and debugging. It might be useful
75  // for some types of tests. Using this to seed engines constructed in modules is
76  // not recommended because (unless done very carefully) it will create duplicate
77  // sequences in different threads and/or data races. Also, if engines are created
78  // by modules the replay mechanism will be broken.
79  // Because it is dangerous and could be misused, this function might be deleted
80  // someday if we ever find time to delete all uses of it in CMSSW. There are of
81  // order 10 last time I checked ...
82  std::uint32_t mySeed() const override;
83 
84  static void fillDescriptions(ConfigurationDescriptions& descriptions);
85 
88  void preallocate(SystemBounds const&);
89 
90  void preBeginLumi(LuminosityBlock const& lumi) override;
91  void postEventRead(Event const& event) override;
92  void setLumiCache(LuminosityBlockIndex, std::vector<RandomEngineState> const& iStates) override;
93  void setEventCache(StreamID, std::vector<RandomEngineState> const& iStates) override;
94 
97  void preModuleBeginStream(StreamContext const& sc, ModuleCallingContext const& mcc);
98  void postModuleBeginStream(StreamContext const& sc, ModuleCallingContext const& mcc);
99 
100  void preModuleEndStream(StreamContext const& sc, ModuleCallingContext const& mcc);
101  void postModuleEndStream(StreamContext const& sc, ModuleCallingContext const& mcc);
102 
103  void preModuleStreamBeginRun(StreamContext const& sc, ModuleCallingContext const& mcc);
104  void postModuleStreamBeginRun(StreamContext const& sc, ModuleCallingContext const& mcc);
105 
106  void preModuleStreamEndRun(StreamContext const& sc, ModuleCallingContext const& mcc);
107  void postModuleStreamEndRun(StreamContext const& sc, ModuleCallingContext const& mcc);
108 
109  void preModuleStreamBeginLumi(StreamContext const& sc, ModuleCallingContext const& mcc);
111 
112  void preModuleStreamEndLumi(StreamContext const& sc, ModuleCallingContext const& mcc);
113  void postModuleStreamEndLumi(StreamContext const& sc, ModuleCallingContext const& mcc);
114 
116  std::vector<RandomEngineState> const& getLumiCache(LuminosityBlockIndex const&) const override;
117  std::vector<RandomEngineState> const& getEventCache(StreamID const&) const override;
118 
119  void consumes(ConsumesCollector&& iC) const override;
120 
122  void print(std::ostream& os) const override;
123 
124  private:
125  typedef std::vector<std::uint32_t> VUint32;
126 
128  public:
129  LabelAndEngine(std::string const& theLabel,
130  VUint32 const& theSeeds,
131  std::shared_ptr<CLHEP::HepRandomEngine> const& theEngine)
132  : label_(theLabel), seeds_(theSeeds), engine_(theEngine) {}
133  std::string const& label() const { return label_; }
134  VUint32 const& seeds() const { return seeds_; }
135  std::shared_ptr<CLHEP::HepRandomEngine const> engine() const { return get_underlying_safe(engine_); }
136  std::shared_ptr<CLHEP::HepRandomEngine>& engine() { return get_underlying_safe(engine_); }
137  void setSeed(std::uint32_t v, unsigned int index) { seeds_.at(index) = v; }
138 
139  private:
143  };
144 
145  // This class exists because it is faster to lookup a module using
146  // the moduleID (an integer) than the label (a string). There is a
147  // one to one association between LabelAndEngine objects and ModuleIDToEngine objects.
149  public:
150  ModuleIDToEngine(LabelAndEngine* theLabelAndEngine, unsigned int theModuleID)
151  : engineState_(), labelAndEngine_(theLabelAndEngine), moduleID_(theModuleID) {}
152 
153  std::vector<unsigned long> const& engineState() const { return engineState_; }
156  unsigned int moduleID() const { return moduleID_; }
157  void setEngineState(std::vector<unsigned long> const& v) { engineState_ = v; }
158  // Used to sort so binary lookup can be used on a container of these.
159  bool operator<(ModuleIDToEngine const& r) const { return moduleID() < r.moduleID(); }
160 
161  private:
162  std::vector<unsigned long> engineState_; // Used only for check in stream transitions
164  unsigned int moduleID_;
165  };
166 
167  void preModuleStreamCheck(StreamContext const& sc, ModuleCallingContext const& mcc);
168  void postModuleStreamCheck(StreamContext const& sc, ModuleCallingContext const& mcc);
169 
171  void readFromEvent(Event const& event);
172 
173  void snapShot(std::vector<LabelAndEngine> const& engines, std::vector<RandomEngineState>& cache);
174  void restoreFromCache(std::vector<RandomEngineState> const& cache, std::vector<LabelAndEngine>& engines);
175 
176  void checkEngineType(std::string const& typeFromConfig,
177  std::string const& typeFromEvent,
178  std::string const& engineLabel) const;
179 
181  StreamID const& streamID,
183  void writeStates(std::vector<RandomEngineState> const& v, std::ofstream& outFile);
184  void writeVector(VUint32 const& v, std::ofstream& outFile);
186 
187  void readEventStatesFromTextFile(std::string const& fileName, std::vector<RandomEngineState>& cache);
188  void readLumiStatesFromTextFile(std::string const& fileName, std::vector<RandomEngineState>& cache);
190  std::vector<RandomEngineState>& cache,
191  std::string const& whichStates);
192  bool readEngineState(std::istream& is,
193  std::vector<RandomEngineState>& cache,
194  std::string const& whichStates,
195  bool& saveToCache);
196  void readVector(std::istream& is, unsigned numItems, std::vector<std::uint32_t>& v);
197 
198  void createEnginesInVector(std::vector<LabelAndEngine>& engines,
199  unsigned int seedOffset,
200  unsigned int eventSeedOffset,
201  std::vector<ModuleIDToEngine>& moduleIDVector);
202 
203  void resetEngineSeeds(LabelAndEngine& labelAndEngine,
204  std::string const& engineName,
205  VUint32 const& seeds,
206  std::uint32_t offset1,
207  std::uint32_t offset2);
208 
209  // ---------- member data --------------------------------
210 
211  unsigned int nStreams_;
212 
213  // This exists because we can look things up faster using the moduleID
214  // than using string comparisons with the moduleLabel
215  std::vector<std::vector<ModuleIDToEngine>> streamModuleIDToEngine_; // streamID, sorted by moduleID
216  std::vector<std::vector<ModuleIDToEngine>> lumiModuleIDToEngine_; // luminosityBlockIndex, sortedByModuleID
217 
218  // Holds the engines, plus the seeds and module label also
219  std::vector<std::vector<LabelAndEngine>> streamEngines_; // streamID, sorted by label
220  std::vector<std::vector<LabelAndEngine>> lumiEngines_; // luminosityBlockIndex, sorted by label
221 
222  // These hold the input tags needed to retrieve the states
223  // of the random number engines stored in a previous process.
224  // If the label in the tag is the empty string (the default),
225  // then the service does not try to restore the random numbers.
228 
229  std::vector<std::vector<RandomEngineState>> eventCache_; // streamID, sorted by module label
230  std::vector<std::vector<RandomEngineState>> lumiCache_; // luminosityBlockIndex, sorted by module label
231 
232  // This is used to keep track of the seeds and engine name from
233  // the configuration. The map key is the module label.
234  // The module ID is filled in as modules are constructed.
235  // It is left as max unsigned if the module is never constructed and not in the process
236  class SeedsAndName {
237  public:
238  static constexpr unsigned int kInvalid = std::numeric_limits<unsigned int>::max();
239 
240  SeedsAndName(VUint32 const& theSeeds, std::string const& theEngineName)
241  : seeds_(theSeeds), engineName_(theEngineName), moduleID_(kInvalid) {}
242  VUint32 const& seeds() const { return seeds_; }
243  std::string const& engineName() const { return engineName_; }
244  unsigned int moduleID() const { return moduleID_; }
245  void setModuleID(unsigned int v) { moduleID_ = v; }
246 
247  private:
250  unsigned int moduleID_;
251  };
252  std::map<std::string, SeedsAndName> seedsAndNameMap_;
253 
254  // Keep the name of the file where we want to save the state
255  // of all declared engines at the end of each event. A blank
256  // name means don't bother. Also, keep a record of whether
257  // the save file name has been recorded in the job report.
259  std::atomic<bool> saveFileNameRecorded_;
260  std::vector<edm::propagate_const<std::shared_ptr<std::ofstream>>> outFiles_; // streamID
261 
262  // Keep the name of the file from which we restore the state
263  // of all declared engines at the beginning of a run. A
264  // blank name means there isn't one.
266 
267  // This turns on or off the checks that ensure no random
268  // numbers are generated in a module during stream
269  // beginStream, beginRun, endLuminosityBlock, or endRun.
271 
272  std::uint32_t eventSeedOffset_;
273 
274  bool verbose_;
275 
278  static const std::uint32_t maxSeedRanecu;
279  static const std::uint32_t maxSeedHepJames;
280  static const std::uint32_t maxSeedTRandom3;
281  };
282  } // namespace service
283 } // namespace edm
284 #endif
edm::StreamID
Definition: StreamID.h:30
edm::service::RandomNumberGeneratorService::VUint32
std::vector< std::uint32_t > VUint32
Definition: RandomNumberGeneratorService.h:125
edm::service::RandomNumberGeneratorService::LabelAndEngine::LabelAndEngine
LabelAndEngine(std::string const &theLabel, VUint32 const &theSeeds, std::shared_ptr< CLHEP::HepRandomEngine > const &theEngine)
Definition: RandomNumberGeneratorService.h:129
edm::service::RandomNumberGeneratorService::lumiCache_
std::vector< std::vector< RandomEngineState > > lumiCache_
Definition: RandomNumberGeneratorService.h:230
service
Definition: service.py:1
edm::service::RandomNumberGeneratorService::LabelAndEngine::seeds
VUint32 const & seeds() const
Definition: RandomNumberGeneratorService.h:134
edm::service::RandomNumberGeneratorService::readEventStatesFromTextFile
void readEventStatesFromTextFile(std::string const &fileName, std::vector< RandomEngineState > &cache)
Definition: RandomNumberGeneratorService.cc:903
edm::service::RandomNumberGeneratorService::ModuleIDToEngine::labelAndEngine
LabelAndEngine *& labelAndEngine()
Definition: RandomNumberGeneratorService.h:155
edm::service::RandomNumberGeneratorService::saveStatesToFile
void saveStatesToFile(std::string const &fileName, StreamID const &streamID, LuminosityBlockIndex const &lumiIndex)
Definition: RandomNumberGeneratorService.cc:828
edm::service::RandomNumberGeneratorService::maxStates
static const std::vector< std::uint32_t >::size_type maxStates
Definition: RandomNumberGeneratorService.h:277
edm::service::RandomNumberGeneratorService::streamEngines_
std::vector< std::vector< LabelAndEngine > > streamEngines_
Definition: RandomNumberGeneratorService.h:219
edm::service::RandomNumberGeneratorService::print
void print(std::ostream &os) const override
For debugging.
Definition: RandomNumberGeneratorService.cc:556
edm::service::RandomNumberGeneratorService::eventCache_
std::vector< std::vector< RandomEngineState > > eventCache_
Definition: RandomNumberGeneratorService.h:229
edm::service::RandomNumberGeneratorService::consumes
void consumes(ConsumesCollector &&iC) const override
Definition: RandomNumberGeneratorService.cc:217
ActivityRegistry
edm::service::RandomNumberGeneratorService::fillDescriptions
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: RandomNumberGeneratorService.cc:352
edm::service::RandomNumberGeneratorService::mySeed
std::uint32_t mySeed() const override
Definition: RandomNumberGeneratorService.cc:319
edm::service::RandomNumberGeneratorService::preallocate
void preallocate(SystemBounds const &)
Definition: RandomNumberGeneratorService.cc:393
edm::service::RandomNumberGeneratorService::createEnginesInVector
void createEnginesInVector(std::vector< LabelAndEngine > &engines, unsigned int seedOffset, unsigned int eventSeedOffset, std::vector< ModuleIDToEngine > &moduleIDVector)
Definition: RandomNumberGeneratorService.cc:1078
edm::service::RandomNumberGeneratorService::readEngineState
bool readEngineState(std::istream &is, std::vector< RandomEngineState > &cache, std::string const &whichStates, bool &saveToCache)
Definition: RandomNumberGeneratorService.cc:938
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
SiStripMonitorTrack_RawStandAlone_cff.engineName
engineName
Definition: SiStripMonitorTrack_RawStandAlone_cff.py:33
edm::service::RandomNumberGeneratorService::constructSaveFileName
std::string constructSaveFileName() const
Definition: RandomNumberGeneratorService.cc:896
edm::service::RandomNumberGeneratorService::postModuleStreamEndLumi
void postModuleStreamEndLumi(StreamContext const &sc, ModuleCallingContext const &mcc)
Definition: RandomNumberGeneratorService.cc:542
edm
HLT enums.
Definition: AlignableModifier.h:19
RandomNumberGenerator.h
edm::service::RandomNumberGeneratorService::SeedsAndName::setModuleID
void setModuleID(unsigned int v)
Definition: RandomNumberGeneratorService.h:245
edm::service::RandomNumberGeneratorService::SeedsAndName::seeds_
VUint32 seeds_
Definition: RandomNumberGeneratorService.h:248
edmLumisInFiles.description
description
Definition: edmLumisInFiles.py:11
edm::service::RandomNumberGeneratorService::SeedsAndName::moduleID_
unsigned int moduleID_
Definition: RandomNumberGeneratorService.h:250
edm::service::RandomNumberGeneratorService::eventSeedOffset_
std::uint32_t eventSeedOffset_
Definition: RandomNumberGeneratorService.h:272
edm::service::RandomNumberGeneratorService::ModuleIDToEngine::labelAndEngine
LabelAndEngine const * labelAndEngine() const
Definition: RandomNumberGeneratorService.h:154
edm::service::RandomNumberGeneratorService::getEventCache
std::vector< RandomEngineState > const & getEventCache(StreamID const &) const override
Definition: RandomNumberGeneratorService.cc:552
edm::service::RandomNumberGeneratorService::readStatesFromFile
void readStatesFromFile(std::string const &fileName, std::vector< RandomEngineState > &cache, std::string const &whichStates)
Definition: RandomNumberGeneratorService.cc:915
edm::service::RandomNumberGeneratorService::SeedsAndName
Definition: RandomNumberGeneratorService.h:236
edm::service::RandomNumberGeneratorService::ModuleIDToEngine::labelAndEngine_
edm::propagate_const< LabelAndEngine * > labelAndEngine_
Definition: RandomNumberGeneratorService.h:163
edm::service::RandomNumberGeneratorService::cloneEngine
std::unique_ptr< CLHEP::HepRandomEngine > cloneEngine(LuminosityBlockIndex const &) override
Definition: RandomNumberGeneratorService.cc:290
edm::service::RandomNumberGeneratorService::setEventCache
void setEventCache(StreamID, std::vector< RandomEngineState > const &iStates) override
Definition: RandomNumberGeneratorService.cc:486
edm::get_underlying_safe
constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
Definition: get_underlying_safe.h:41
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
findQualityFiles.v
v
Definition: findQualityFiles.py:179
edm::service::RandomNumberGeneratorService::SeedsAndName::SeedsAndName
SeedsAndName(VUint32 const &theSeeds, std::string const &theEngineName)
Definition: RandomNumberGeneratorService.h:240
edm::service::RandomNumberGeneratorService::checkEngineType
void checkEngineType(std::string const &typeFromConfig, std::string const &typeFromEvent, std::string const &engineLabel) const
Definition: RandomNumberGeneratorService.cc:809
edm::service::RandomNumberGeneratorService::ModuleIDToEngine::setEngineState
void setEngineState(std::vector< unsigned long > const &v)
Definition: RandomNumberGeneratorService.h:157
edm::service::RandomNumberGeneratorService::SeedsAndName::seeds
VUint32 const & seeds() const
Definition: RandomNumberGeneratorService.h:242
edm::service::RandomNumberGeneratorService::SeedsAndName::engineName
std::string const & engineName() const
Definition: RandomNumberGeneratorService.h:243
edm::ModuleDescription
Definition: ModuleDescription.h:21
edm::service::RandomNumberGeneratorService::readLumiStatesFromTextFile
void readLumiStatesFromTextFile(std::string const &fileName, std::vector< RandomEngineState > &cache)
Definition: RandomNumberGeneratorService.cc:909
edm::service::RandomNumberGeneratorService::restoreFromCache
void restoreFromCache(std::vector< RandomEngineState > const &cache, std::vector< LabelAndEngine > &engines)
Definition: RandomNumberGeneratorService.cc:725
edm::RandomNumberGenerator
Definition: RandomNumberGenerator.h:147
RandomEngineState
Definition: RandomEngineState.h:26
edm::service::RandomNumberGeneratorService::LabelAndEngine::engine
std::shared_ptr< CLHEP::HepRandomEngine > & engine()
Definition: RandomNumberGeneratorService.h:136
edm::service::RandomNumberGeneratorService::postEventRead
void postEventRead(Event const &event) override
Definition: RandomNumberGeneratorService.cc:452
edm::propagate_const
Definition: propagate_const.h:32
edm::service::RandomNumberGeneratorService
Definition: RandomNumberGeneratorService.h:52
edm::service::RandomNumberGeneratorService::restoreStateBeginLumiTag_
edm::InputTag restoreStateBeginLumiTag_
Definition: RandomNumberGeneratorService.h:227
edm::service::RandomNumberGeneratorService::writeVector
void writeVector(VUint32 const &v, std::ofstream &outFile)
Definition: RandomNumberGeneratorService.cc:884
edm::service::RandomNumberGeneratorService::LabelAndEngine::engine
std::shared_ptr< CLHEP::HepRandomEngine const > engine() const
Definition: RandomNumberGeneratorService.h:135
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
edm::service::RandomNumberGeneratorService::maxSeeds
static const std::vector< std::uint32_t >::size_type maxSeeds
Definition: RandomNumberGeneratorService.h:276
edm::LuminosityBlockIndex
Definition: LuminosityBlockIndex.h:33
edm::service::RandomNumberGeneratorService::lumiModuleIDToEngine_
std::vector< std::vector< ModuleIDToEngine > > lumiModuleIDToEngine_
Definition: RandomNumberGeneratorService.h:216
edm::StreamContext
Definition: StreamContext.h:31
edm::service::RandomNumberGeneratorService::LabelAndEngine::label
std::string const & label() const
Definition: RandomNumberGeneratorService.h:133
edm::service::RandomNumberGeneratorService::maxSeedHepJames
static const std::uint32_t maxSeedHepJames
Definition: RandomNumberGeneratorService.h:279
edm::service::RandomNumberGeneratorService::preModuleStreamCheck
void preModuleStreamCheck(StreamContext const &sc, ModuleCallingContext const &mcc)
Definition: RandomNumberGeneratorService.cc:621
edm::service::RandomNumberGeneratorService::readVector
void readVector(std::istream &is, unsigned numItems, std::vector< std::uint32_t > &v)
Definition: RandomNumberGeneratorService.cc:1063
edm::service::RandomNumberGeneratorService::postModuleStreamBeginLumi
void postModuleStreamBeginLumi(StreamContext const &sc, ModuleCallingContext const &mcc)
Definition: RandomNumberGeneratorService.cc:532
edm::service::RandomNumberGeneratorService::verbose_
bool verbose_
Definition: RandomNumberGeneratorService.h:274
edm::ActivityRegistry
Definition: ActivityRegistry.h:134
edm::service::RandomNumberGeneratorService::lumiEngines_
std::vector< std::vector< LabelAndEngine > > lumiEngines_
Definition: RandomNumberGeneratorService.h:220
LuminosityBlock
Event
edm::service::RandomNumberGeneratorService::LabelAndEngine
Definition: RandomNumberGeneratorService.h:127
edm::service::RandomNumberGeneratorService::postModuleBeginStream
void postModuleBeginStream(StreamContext const &sc, ModuleCallingContext const &mcc)
Definition: RandomNumberGeneratorService.cc:496
edm::service::RandomNumberGeneratorService::restoreFileName_
std::string restoreFileName_
Definition: RandomNumberGeneratorService.h:265
edm::service::RandomNumberGeneratorService::LabelAndEngine::engine_
edm::propagate_const< std::shared_ptr< CLHEP::HepRandomEngine > > engine_
Definition: RandomNumberGeneratorService.h:142
edm::service::RandomNumberGeneratorService::writeStates
void writeStates(std::vector< RandomEngineState > const &v, std::ofstream &outFile)
Definition: RandomNumberGeneratorService.cc:863
edm::service::RandomNumberGeneratorService::preModuleStreamEndLumi
void preModuleStreamEndLumi(StreamContext const &sc, ModuleCallingContext const &mcc)
Definition: RandomNumberGeneratorService.cc:537
csv2json.lumiIndex
lumiIndex
Definition: csv2json.py:29
utilities.cache
def cache(function)
Definition: utilities.py:3
edm::service::RandomNumberGeneratorService::preBeginLumi
void preBeginLumi(LuminosityBlock const &lumi) override
Definition: RandomNumberGeneratorService.cc:443
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
L1TdeCSCTF_cfi.outFile
outFile
Definition: L1TdeCSCTF_cfi.py:5
CLHEP
Definition: CocoaGlobals.h:27
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::service::RandomNumberGeneratorService::SeedsAndName::engineName_
std::string engineName_
Definition: RandomNumberGeneratorService.h:249
InitialStep_cff.seeds
seeds
Definition: InitialStep_cff.py:231
edm::service::RandomNumberGeneratorService::getEngine
CLHEP::HepRandomEngine & getEngine(StreamID const &streamID) override
Use this engine in event methods.
Definition: RandomNumberGeneratorService.cc:222
edm::service::SystemBounds
Definition: SystemBounds.h:29
edm::service::RandomNumberGeneratorService::saveFileNameRecorded_
std::atomic< bool > saveFileNameRecorded_
Definition: RandomNumberGeneratorService.h:259
edm::ParameterSet
Definition: ParameterSet.h:47
edm::service::RandomNumberGeneratorService::ModuleIDToEngine
Definition: RandomNumberGeneratorService.h:148
ParameterSet
Definition: Functions.h:16
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
edm::service::RandomNumberGeneratorService::seedsAndNameMap_
std::map< std::string, SeedsAndName > seedsAndNameMap_
Definition: RandomNumberGeneratorService.h:252
edm::service::RandomNumberGeneratorService::LabelAndEngine::setSeed
void setSeed(std::uint32_t v, unsigned int index)
Definition: RandomNumberGeneratorService.h:137
edm::service::RandomNumberGeneratorService::SeedsAndName::kInvalid
static constexpr unsigned int kInvalid
Definition: RandomNumberGeneratorService.h:238
edm::service::RandomNumberGeneratorService::LabelAndEngine::seeds_
VUint32 seeds_
Definition: RandomNumberGeneratorService.h:141
edm::service::RandomNumberGeneratorService::ModuleIDToEngine::moduleID_
unsigned int moduleID_
Definition: RandomNumberGeneratorService.h:164
edm::service::RandomNumberGeneratorService::readFromLuminosityBlock
void readFromLuminosityBlock(LuminosityBlock const &lumi)
Definition: RandomNumberGeneratorService.cc:659
edm::service::RandomNumberGeneratorService::maxSeedRanecu
static const std::uint32_t maxSeedRanecu
Definition: RandomNumberGeneratorService.h:278
edm::service::RandomNumberGeneratorService::operator=
RandomNumberGeneratorService const & operator=(RandomNumberGeneratorService const &)=delete
edm::service::RandomNumberGeneratorService::readFromEvent
void readFromEvent(Event const &event)
Definition: RandomNumberGeneratorService.cc:688
edm::service::RandomNumberGeneratorService::ModuleIDToEngine::moduleID
unsigned int moduleID() const
Definition: RandomNumberGeneratorService.h:156
edm::service::RandomNumberGeneratorService::preModuleConstruction
void preModuleConstruction(ModuleDescription const &description)
Definition: RandomNumberGeneratorService.cc:379
InputTag.h
alignCSCRings.r
r
Definition: alignCSCRings.py:93
edm::service::RandomNumberGeneratorService::ModuleIDToEngine::engineState_
std::vector< unsigned long > engineState_
Definition: RandomNumberGeneratorService.h:162
edm::service::RandomNumberGeneratorService::streamModuleIDToEngine_
std::vector< std::vector< ModuleIDToEngine > > streamModuleIDToEngine_
Definition: RandomNumberGeneratorService.h:215
ConfigurationDescriptions
edm::service::RandomNumberGeneratorService::preModuleEndStream
void preModuleEndStream(StreamContext const &sc, ModuleCallingContext const &mcc)
Definition: RandomNumberGeneratorService.cc:500
edm::service::RandomNumberGeneratorService::preModuleStreamBeginLumi
void preModuleStreamBeginLumi(StreamContext const &sc, ModuleCallingContext const &mcc)
Definition: RandomNumberGeneratorService.cc:527
edm::service::RandomNumberGeneratorService::restoreStateTag_
edm::InputTag restoreStateTag_
Definition: RandomNumberGeneratorService.h:226
edm::service::RandomNumberGeneratorService::outFiles_
std::vector< edm::propagate_const< std::shared_ptr< std::ofstream > > > outFiles_
Definition: RandomNumberGeneratorService.h:260
edm::service::RandomNumberGeneratorService::~RandomNumberGeneratorService
~RandomNumberGeneratorService() override
Definition: RandomNumberGeneratorService.cc:215
edm::service::RandomNumberGeneratorService::ModuleIDToEngine::operator<
bool operator<(ModuleIDToEngine const &r) const
Definition: RandomNumberGeneratorService.h:159
edm::service::RandomNumberGeneratorService::postModuleStreamCheck
void postModuleStreamCheck(StreamContext const &sc, ModuleCallingContext const &mcc)
Definition: RandomNumberGeneratorService.cc:635
edm::service::RandomNumberGeneratorService::postModuleStreamEndRun
void postModuleStreamEndRun(StreamContext const &sc, ModuleCallingContext const &mcc)
Definition: RandomNumberGeneratorService.cc:522
edm::service::RandomNumberGeneratorService::saveFileName_
std::string saveFileName_
Definition: RandomNumberGeneratorService.h:258
edm::service::RandomNumberGeneratorService::ModuleIDToEngine::ModuleIDToEngine
ModuleIDToEngine(LabelAndEngine *theLabelAndEngine, unsigned int theModuleID)
Definition: RandomNumberGeneratorService.h:150
edm::service::RandomNumberGeneratorService::SeedsAndName::moduleID
unsigned int moduleID() const
Definition: RandomNumberGeneratorService.h:244
edm::service::RandomNumberGeneratorService::preModuleStreamBeginRun
void preModuleStreamBeginRun(StreamContext const &sc, ModuleCallingContext const &mcc)
Definition: RandomNumberGeneratorService.cc:508
edm::service::RandomNumberGeneratorService::resetEngineSeeds
void resetEngineSeeds(LabelAndEngine &labelAndEngine, std::string const &engineName, VUint32 const &seeds, std::uint32_t offset1, std::uint32_t offset2)
Definition: RandomNumberGeneratorService.cc:1140
edm::service::RandomNumberGeneratorService::ModuleIDToEngine::engineState
std::vector< unsigned long > const & engineState() const
Definition: RandomNumberGeneratorService.h:153
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::service::RandomNumberGeneratorService::LabelAndEngine::label_
std::string label_
Definition: RandomNumberGeneratorService.h:140
edm::service::RandomNumberGeneratorService::maxSeedTRandom3
static const std::uint32_t maxSeedTRandom3
Definition: RandomNumberGeneratorService.h:280
edm::service::RandomNumberGeneratorService::postModuleStreamBeginRun
void postModuleStreamBeginRun(StreamContext const &sc, ModuleCallingContext const &mcc)
Definition: RandomNumberGeneratorService.cc:513
edm::service::RandomNumberGeneratorService::postModuleEndStream
void postModuleEndStream(StreamContext const &sc, ModuleCallingContext const &mcc)
Definition: RandomNumberGeneratorService.cc:504
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
get_underlying_safe.h
SystemBounds
lumi
Definition: LumiSectionData.h:20
edm::service::RandomNumberGeneratorService::preModuleDestruction
void preModuleDestruction(ModuleDescription const &description)
Definition: RandomNumberGeneratorService.cc:386
edm::InputTag
Definition: InputTag.h:15
edm::service::RandomNumberGeneratorService::getLumiCache
std::vector< RandomEngineState > const & getLumiCache(LuminosityBlockIndex const &) const override
These two are used by the RandomEngineStateProducer.
Definition: RandomNumberGeneratorService.cc:547
edm::service::RandomNumberGeneratorService::preModuleBeginStream
void preModuleBeginStream(StreamContext const &sc, ModuleCallingContext const &mcc)
Definition: RandomNumberGeneratorService.cc:492
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
edm::service::RandomNumberGeneratorService::RandomNumberGeneratorService
RandomNumberGeneratorService(ParameterSet const &pset, ActivityRegistry &activityRegistry)
Definition: RandomNumberGeneratorService.cc:61
edm::service::RandomNumberGeneratorService::enableChecking_
bool enableChecking_
Definition: RandomNumberGeneratorService.h:270
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
edm::service::RandomNumberGeneratorService::snapShot
void snapShot(std::vector< LabelAndEngine > const &engines, std::vector< RandomEngineState > &cache)
Definition: RandomNumberGeneratorService.cc:706
edm::service::RandomNumberGeneratorService::preModuleStreamEndRun
void preModuleStreamEndRun(StreamContext const &sc, ModuleCallingContext const &mcc)
Definition: RandomNumberGeneratorService.cc:518
edm::service::RandomNumberGeneratorService::setLumiCache
void setLumiCache(LuminosityBlockIndex, std::vector< RandomEngineState > const &iStates) override
Definition: RandomNumberGeneratorService.cc:480
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29
edm::service::RandomNumberGeneratorService::nStreams_
unsigned int nStreams_
Definition: RandomNumberGeneratorService.h:211