31 #include "CLHEP/Random/engineIDulong.h"
32 #include "CLHEP/Random/JamesRandom.h"
33 #include "CLHEP/Random/RanecuEngine.h"
49 saveFileName_(pset.getUntrackedParameter<std::
string>(
"saveFileName")),
50 saveFileNameRecorded_(
false),
51 restoreFileName_(pset.getUntrackedParameter<std::
string>(
"restoreFileName")),
52 enableChecking_(pset.getUntrackedParameter<bool>(
"enableChecking")),
55 eventSeedOffset_(pset.getUntrackedParameter<unsigned>(
"eventSeedOffset")),
56 failedToFindStatesInLumi_(
false) {
58 if(pset.
exists(
"restoreStateTag")) {
70 <<
"In the configuration for the RandomNumberGeneratorService both\n"
71 <<
"restoreFileName and restoreStateLabel were set to nonempty values\n"
72 <<
"which is illegal. It is impossible to restore the random engine\n"
73 <<
"states two different ways in the same process.\n";
80 <<
"The saveFileName parameter must be a simple file name with no path\n"
81 <<
"specification. In the configuration, it was given the value \""
90 for(VString::const_iterator it = pSets.begin(), itEnd = pSets.end(); it != itEnd; ++it) {
95 bool initialSeedExists = modulePSet.
exists(
"initialSeed");
96 bool initialSeedSetExists = modulePSet.
exists(
"initialSeedSet");
98 if(initialSeedExists && initialSeedSetExists) {
100 <<
"For the module with the label \"" << *it <<
"\",\n"
101 <<
"both the parameters \"initialSeed\" and \"initialSeedSet\"\n"
102 <<
"have been set in the configuration. You must set one or\n"
103 <<
"the other. It is illegal to set both.\n";
104 }
else if(!initialSeedExists && !initialSeedSetExists) {
106 <<
"For the module with the label \"" << *it <<
"\",\n"
107 <<
"neither the parameter \"initialSeed\" nor \"initialSeedSet\"\n"
108 <<
"has been set in the configuration. You must set one or\n"
110 }
else if(initialSeedExists) {
112 initialSeedSet.clear();
113 initialSeedSet.push_back(initialSeed);
114 }
else if(initialSeedSetExists) {
123 if(initialSeedSet.size() != 2U) {
125 <<
"Random engines of type \"RanecuEngine\" require 2 seeds\n"
126 <<
"be specified with the parameter named \"initialSeedSet\".\n"
127 <<
"Either \"initialSeedSet\" was not in the configuration\n"
128 <<
"or its size was not 2 for the module with label \"" << *it <<
"\".\n" ;
130 boost::shared_ptr<CLHEP::HepRandomEngine> engine(
new CLHEP::RanecuEngine());
136 <<
"The RanecuEngine seeds should be in the range 0 to 2147483647.\n"
137 <<
"The seeds passed to the RandomNumberGenerationService from the\n"
138 "configuration file were " << initialSeedSet[0] <<
" and " << initialSeedSet[1]
139 <<
"\nThis was for the module with label \"" << *it <<
"\".\n";
142 seedL[0] =
static_cast<long int>(initialSeedSet[0]);
143 seedL[1] =
static_cast<long int>(initialSeedSet[1]);
144 engine->setSeeds(seedL, 0);
148 if(initialSeedSet.size() != 1U) {
150 <<
"Random engines of type \"HepJamesRandom\" and \"TRandom3\n"
151 <<
"require exactly 1 seed be specified in the configuration.\n"
152 <<
"There were " << initialSeedSet.size() <<
" seeds set for the\n"
153 <<
"module with label \"" << *it <<
"\".\n" ;
155 long int seedL =
static_cast<long int>(initialSeedSet[0]);
157 if(engineName ==
"HepJamesRandom") {
160 <<
"The CLHEP::HepJamesRandom engine seed should be in the range 0 to 900000000.\n"
161 <<
"The seed passed to the RandomNumberGenerationService from the\n"
162 "configuration file was " << initialSeedSet[0] <<
". This was for \n"
163 <<
"the module with label " << *it <<
".\n";
165 boost::shared_ptr<CLHEP::HepRandomEngine> engine(
new CLHEP::HepJamesRandom(seedL));
167 }
else if(engineName ==
"TRandom3") {
176 uint32_t seedu32 =
static_cast<uint32_t
>(seedL);
177 assert(initialSeedSet[0] == seedu32);
179 boost::shared_ptr<CLHEP::HepRandomEngine> engine(
new TRandomAdaptor(seedL));
183 <<
"The random engine name, \"" << engineName
184 <<
"\", does not correspond to a supported engine.\n"
185 <<
"This engine was configured for the module with label \"" << *it <<
"\"";
229 CLHEP::HepRandomEngine&
235 <<
"The module with label \""
237 <<
"\" requested a random number engine from the \n"
238 "RandomNumberGeneratorService, but that module was not configured\n"
239 "for random numbers. An engine is created only if a seed(s) is provided\n"
240 "in the configuration file. Please add the following PSet to the\n"
241 "configuration file for the RandomNumberGeneratorService:\n\n"
243 " initialSeed = cms.untracked.uint32(your_seed),\n"
244 " engineName = cms.untracked.string('TRandom3')\n"
246 "where you replace \"your_seed\" with a number and add a comma if necessary\n"
247 "The \"engineName\" parameter is optional. If absent the default is \"HepJamesRandom\".\n";
250 <<
"Requested a random number engine from the RandomNumberGeneratorService\n"
251 "when no module was active. This is not supposed to be possible.\n"
252 "Please inform the edm developers about this. It would be helpful to\n"
253 "know the stack. If a source was requesting a random engine this could\n"
254 "happen. Sources are not supposed to be doing that anymore.\n";
263 std::map<std::string, VUint32>::const_iterator iter;
269 <<
"The module with label \""
271 <<
"\" requested a random number seed from the \n"
272 "RandomNumberGeneratorService, but that module was not configured\n"
273 "for random numbers. An engine is created only if a seed(s) is provided\n"
274 "in the configuration file. Please add the following PSet to the\n"
275 "configuration file for the RandomNumberGeneratorService:\n\n"
277 " initialSeed = cms.untracked.uint32(your_seed),\n"
278 " engineName = cms.untracked.string('TRandom3')\n"
280 "where you replace \"your_seed\" with a number and add a comma if necessary\n"
281 "The \"engineName\" parameter is optional. If absent the default is \"HepJamesRandom\".\n";
284 <<
"Requested a random number seed from the RandomNumberGeneratorService\n"
285 "when no module was active. This is not supposed to be possible.\n"
286 "Please inform the edm developers about this. It would be helpful to\n"
287 "know the stack. If a source was requesting a random engine this could\n"
288 "happen. Sources are not supposed to be doing that anymore.\n";
291 return iter->second[0];
311 val.addOptionalUntracked<std::vector<uint32_t> >(
"initialSeedSet");
312 val.addOptionalUntracked<
std::string>(
"engineName");
315 wnode.setComment(
"The name of each ParameterSet will be the associated module label.");
318 descriptions.
add(
"RandomNumberGeneratorService", desc);
326 std::ostringstream
suffix;
327 suffix <<
"_" << childIndex;
404 reportSvc->reportRandomStateFile(fullName);
427 <<
"It is illegal to generate random numbers during module construction because \n"
428 "that makes it very difficult to reproduce the processing of individual\n"
429 "events. Random numbers were generated during module construction for the module with\n"
430 "class name \"" << description.
moduleName() <<
"\"\n"
431 "and module label \"" << description.
moduleLabel() <<
"\"\n";
451 <<
"It is illegal to generate random numbers during beginJob because \n"
452 "that makes it very difficult to reproduce the processing of individual\n"
453 "events. Random numbers were generated during beginJob for the module with\n"
454 "class name \"" << description.
moduleName() <<
"\"\n"
455 "and module label \"" << description.
moduleLabel() <<
"\"\n";
475 <<
"It is illegal to generate random numbers during beginRun because \n"
476 "that makes it very difficult to reproduce the processing of individual\n"
477 "events. Random numbers were generated during beginRun for the module with\n"
478 "class name \"" << description.
moduleName() <<
"\"\n"
479 "and module label \"" << description.
moduleLabel() <<
"\"\n";
519 <<
"It is illegal to generate random numbers during endLumi because \n"
520 "that makes it very difficult to reproduce the processing of individual\n"
521 "events. Random numbers were generated during endLumi for the module with\n"
522 "class name \"" << description.
moduleName() <<
"\"\n"
523 "and module label \"" << description.
moduleLabel() <<
"\"\n";
543 <<
"It is illegal to generate random numbers during endRun because \n"
544 "that makes it very difficult to reproduce the processing of individual\n"
545 "events. Random numbers were generated during endRun for the module with\n"
546 "class name \"" << description.
moduleName() <<
"\"\n"
547 "and module label \"" << description.
moduleLabel() <<
"\"\n";
567 <<
"It is illegal to generate random numbers during endJob because \n"
568 "that makes it very difficult to reproduce the processing of individual\n"
569 "events. Random numbers were generated during endJob for the module with\n"
570 "class name \"" << description.
moduleName() <<
"\"\n"
571 "and module label \"" << description.
moduleLabel() <<
"\"\n";
578 std::vector<RandomEngineState>
const&
583 std::vector<RandomEngineState>
const&
590 std::cout <<
"\n\nRandomNumberGeneratorService dump\n\n";
597 std::vector<uint32_t> seeds = iter->second;
598 for(std::vector<uint32_t>::const_iterator vIter = seeds.begin();
599 vIter != seeds.end();
605 std::cout <<
"\n Contents of engineNameMap\n";
606 for(std::map<std::string, std::string>::const_iterator iter =
engineNameMap_.begin();
609 std::cout <<
" " << iter->first <<
" " << iter->second <<
"\n";
611 std::cout <<
"\n Contents of engineMap\n";
612 for(EngineMap::const_iterator iter =
engineMap_.begin();
616 <<
" " << iter->second->name() <<
" ";
617 if(iter->second->name() ==
std::string(
"HepJamesRandom")) {
620 std::cout <<
"Engine does not know original seed";
628 for(VString::const_iterator iter =
labelStack_.begin();
631 std::cout <<
" " << i <<
" " << *iter <<
"\n";
634 std::cout <<
" currentEngine points to end\n";
643 for(std::vector<EngineMap::const_iterator>::const_iterator iter =
engineStack_.begin();
647 std::cout <<
" " << i <<
" Points to end of engine map\n";
649 std::cout <<
" " << i <<
" " << (*iter)->first
650 <<
" " << (*iter)->second->name() <<
" " << (*iter)->second->getSeed() <<
"\n";
684 <<
"In the configuration for the RandomNumberGeneratorService the\n"
685 <<
"restoreStateTag contains the current process which is illegal.\n"
686 <<
"The process name in the replay process should have been changed\n"
687 <<
"to be different than the original process name and the restoreStateTag\n"
688 <<
"should contain either the original process name or an empty process name.\n";
715 <<
"The RandomNumberGeneratorService is trying to restore\n"
716 <<
"the state of the random engines by reading a product from\n"
718 <<
"fails to find one. The label used in the request for the product\n"
719 <<
"is set in the configuration. It is probably set to the wrong value\n"
720 <<
"in the configuration file. It must match the module label\n"
721 <<
"of the RandomEngineStateProducer that created the product in\n"
722 <<
"a previous process\n";
727 <<
"The RandomNumberGeneratorService is trying to restore\n"
728 <<
"the state of the random engines by reading a product from\n"
729 <<
"the Event and LuminosityBlock with input tag \"" <<
restoreStateTag_ <<
"\".\n"
730 <<
"It found the product in the Event but not the one in the LuminosityBlock.\n"
731 <<
"Either the product in the LuminosityBlock was dropped or\n"
732 <<
"there is a bug somewhere\n";
746 for(std::vector<RandomEngineState>::const_iterator state = states->begin(),
747 iEnd = states->end();
748 state != iEnd; ++state) {
750 std::vector<RandomEngineState>::iterator cachedState =
754 if(cachedState !=
eventCache_.end() && cachedState->getLabel() == state->getLabel()) {
755 if(cachedState->getSeed().size() != state->getSeed().size() ||
756 cachedState->getState().size() != state->getState().size()) {
758 <<
"In function RandomNumberGeneratorService::backwardCompatibilityRead.\n"
759 <<
"When attempting to replay processing with the RandomNumberGeneratorService,\n"
760 <<
"the engine type for each module must be the same in the replay configuration\n"
761 <<
"and the original configuration. If this is not the problem, then the data\n"
762 <<
"is somehow corrupted or there is a bug because the vector in the data containing\n"
763 <<
"the seeds or engine state is the incorrect size for the type of random engine.\n";
765 cachedState->setSeed(state->getSeed());
766 cachedState->setState(state->getState());
775 std::vector<RandomEngineState>::iterator state = cache.begin();
777 for(EngineMap::const_iterator iter =
engineMap_.begin();
781 state->setLabel(iter->first);
782 state->setSeed(
seedMap_[iter->first]);
784 std::vector<unsigned long> stateL = iter->second->put();
785 state->clearStateVector();
786 state->reserveStateVector(stateL.size());
787 for(std::vector<unsigned long>::const_iterator vIter = stateL.begin();
788 vIter != stateL.end();
790 state->push_back_stateVector(static_cast<uint32_t>(*vIter));
797 for(std::vector<RandomEngineState>::const_iterator iter = cache.begin(),
799 iter != iEnd; ++iter) {
803 std::vector<uint32_t>
const& engineState = iter->getState();
804 std::vector<unsigned long> engineStateL;
805 for(std::vector<uint32_t>::const_iterator iVal = engineState.begin(),
806 theEnd = engineState.end();
807 iVal != theEnd; ++iVal) {
808 engineStateL.push_back(static_cast<unsigned long>(*iVal));
811 std::vector<uint32_t>
const& engineSeeds = iter->getSeed();
812 std::vector<long> engineSeedsL;
813 for(std::vector<uint32_t>::const_iterator iVal = engineSeeds.begin(),
814 theEnd = engineSeeds.end();
817 long seedL =
static_cast<long>(*iVal);
818 engineSeedsL.push_back(seedL);
827 uint32_t seedu32 =
static_cast<uint32_t
>(seedL);
828 assert(*iVal == seedu32);
831 EngineMap::iterator engine =
engineMap_.find(engineLabel);
835 seedMap_[engineLabel] = engineSeeds;
839 if(engineStateL[0] == CLHEP::engineIDulong<CLHEP::HepJamesRandom>()) {
844 engine->second->setSeed(engineSeedsL[0], 0);
845 engine->second->get(engineStateL);
846 }
else if(engineStateL[0] == CLHEP::engineIDulong<CLHEP::RanecuEngine>()) {
851 engine->second->get(engineStateL);
852 }
else if(engineStateL[0] == CLHEP::engineIDulong<TRandomAdaptor>()) {
857 engine->second->setSeed(engineSeedsL[0], 0);
858 engine->second->get(engineStateL);
863 <<
"The RandomNumberGeneratorService is trying to restore the state\n"
864 "of the random engines. The state in the event indicates an engine\n"
865 "of an unknown type. This should not be possible unless you are\n"
866 "running with an old code release on a new file that was created\n"
867 "with a newer release which had new engine types added. In this case\n"
868 "the only solution is to use a newer release. In any other case, notify\n"
869 "the EDM developers because this should not be possible\n";
879 if(typeFromConfig != typeFromEvent) {
881 <<
"The RandomNumberGeneratorService is trying to restore\n"
882 <<
"the state of the random engine for the module \""
883 << engineLabel <<
"\". An\n"
884 <<
"error was detected because the type of the engine in the\n"
885 <<
"input file and the configuration file do not match.\n"
886 <<
"In the configuration file the type is \"" << typeFromConfig
887 <<
"\".\nIn the input file the type is \"" << typeFromEvent <<
"\". If\n"
888 <<
"you are not generating any random numbers in this module, then\n"
889 <<
"remove the line in the configuration file that gives it\n"
890 <<
"a seed and the error will go away. Otherwise, you must give\n"
891 <<
"this module the same engine type in the configuration file or\n"
892 <<
"stop trying to restore the random engine state.\n";
903 <<
"Unable to open the file \""
904 << fileName <<
"\" to save the state of the random engines.\n";
906 outFile_.seekp(0, std::ios_base::beg);
907 outFile_ <<
"<RandomEngineStates>\n";
917 outFile_ <<
"</RandomEngineStates>\n" ;
924 for(std::vector<RandomEngineState>::const_iterator iter = v.begin(),
926 iter != iEnd; ++iter) {
928 std::vector<uint32_t>
const& seedVector = iter->getSeed();
931 std::vector<uint32_t>
const& stateVector = iter->getState();
934 outFile <<
"<ModuleLabel>\n" << iter->getLabel() <<
"\n</ModuleLabel>\n";
936 outFile <<
"<SeedLength>\n" << seedVectorLength <<
"\n</SeedLength>\n" ;
937 outFile <<
"<InitialSeeds>\n";
939 outFile <<
"</InitialSeeds>\n";
940 outFile <<
"<FullStateLength>\n" << stateVectorLength <<
"\n</FullStateLength>\n";
941 outFile <<
"<FullState>\n";
943 outFile <<
"</FullState>\n";
950 if(v.empty())
return;
951 size_t numItems = v.size();
952 for(
size_t i = 0;
i < numItems; ++
i) {
953 if(
i != 0 &&
i % 10 == 0) outFile <<
"\n";
954 outFile << std::setw(13) << v[
i];
981 std::vector<RandomEngineState>& cache,
983 std::ifstream inFile;
987 <<
"Unable to open the file \""
988 << fileName <<
"\" to restore the random engine states.\n";
993 if(!inFile.good() || text !=
std::string(
"<RandomEngineStates>")) {
995 <<
"Attempting to read file with random number engine states.\n"
997 <<
"\" is ill-structured or otherwise corrupted.\n"
998 <<
"Cannot read the file header word.\n";
1000 bool saveToCache =
false;
1005 std::vector<RandomEngineState>& cache,
1007 bool& saveToCache) {
1012 std::vector<uint32_t> seedVector;
1014 std::vector<uint32_t> stateVector;
1024 <<
"\" is ill-structured or otherwise corrupted.\n"
1025 <<
"Cannot read next field and did not hit the end yet.\n";
1029 if(leading ==
std::string(
"</RandomEngineStates>"))
return false;
1034 saveToCache =
false;
1041 saveToCache = (leading == whichStates);
1047 is >> moduleLabel >> trailing;
1053 <<
"\" is ill-structured or otherwise corrupted.\n"
1054 <<
"Cannot read a module label when restoring random engine states.\n";
1057 is >> leading >> seedVectorSize >> trailing;
1063 <<
"\" is ill-structured or otherwise corrupted.\n"
1064 <<
"Cannot read seed vector length when restoring random engine states.\n";
1072 <<
"\" is ill-structured or otherwise corrupted.\n"
1073 <<
"Cannot read beginning of InitialSeeds when restoring random engine states.\n";
1079 <<
"\" is ill-structured or otherwise corrupted.\n"
1080 <<
"The number of seeds exceeds 64K.\n";
1090 <<
"\" is ill-structured or otherwise corrupted.\n"
1091 <<
"Cannot read end of InitialSeeds when restoring random engine states.\n";
1094 is >> leading >> stateVectorSize >> trailing;
1100 <<
"\" is ill-structured or otherwise corrupted.\n"
1101 <<
"Cannot read state vector length when restoring random engine states.\n";
1109 <<
"\" is ill-structured or otherwise corrupted.\n"
1110 <<
"Cannot read beginning of FullState when restoring random engine states.\n";
1116 <<
"\" is ill-structured or otherwise corrupted.\n"
1117 <<
"The number of states exceeds 64K.\n";
1120 readVector(is, stateVectorSize, stateVector);
1127 <<
"\" is ill-structured or otherwise corrupted.\n"
1128 <<
"Cannot read end of FullState when restoring random engine states.\n";
1133 randomEngineState.
setLabel(moduleLabel);
1134 std::vector<RandomEngineState>::iterator state =
1135 std::lower_bound(cache.begin(), cache.end(), randomEngineState);
1137 if(state != cache.end() && moduleLabel == state->getLabel()) {
1138 if(seedVector.size() != state->getSeed().size() ||
1139 stateVector.size() != state->getState().size()) {
1142 <<
"\" is ill-structured or otherwise corrupted.\n"
1143 <<
"Vectors containing engine state are the incorrect size for the type of random engine.\n";
1145 state->setSeed(seedVector);
1146 state->setState(stateVector);
1155 v.reserve(numItems);
1157 for(
unsigned i = 0;
i < numItems; ++
i) {
1162 <<
"\" is ill-structured or otherwise corrupted.\n"
1163 <<
"Cannot read vector when restoring random engine states.\n";
1174 for(EngineMap::const_iterator iter =
engineMap_.begin();
1186 assert(seeds.size() == 2U);
1189 offset1 = offset1 %
mod;
1190 offset2 = offset2 %
mod;
1191 seeds[0] = (seeds[0] + offset1) % mod;
1192 seeds[0] = (seeds[0] + offset2) % mod;
1194 seedL[0] =
static_cast<long int>(seeds[0]);
1195 seedL[1] =
static_cast<long int>(seeds[1]);
1196 iter->second->setSeeds(seedL,0);
1198 assert(seeds.size() == 1U);
1200 if(engineName ==
"HepJamesRandom") {
1203 offset1 = offset1 %
mod;
1204 offset2 = offset2 %
mod;
1205 seeds[0] = (seeds[0] + offset1) % mod;
1206 seeds[0] = (seeds[0] + offset2) % mod;
1208 long int seedL =
static_cast<long int>(seeds[0]);
1209 iter->second->setSeed(seedL, 0);
1211 assert(engineName ==
"TRandom3");
1216 if((max32 - seeds[0]) >= offset1) {
1217 seeds[0] = seeds[0] + offset1;
1219 seeds[0] = offset1 - (max32 - seeds[0]) - 1U;
1221 if((max32 - seeds[0]) >= offset2) {
1222 seeds[0] = seeds[0] + offset2;
1224 seeds[0] = offset2 - (max32 - seeds[0]) - 1U;
1226 long seedL =
static_cast<long>(seeds[0]);
1235 uint32_t seedu32 =
static_cast<uint32_t
>(seedL);
1236 assert(seeds[0] == seedu32);
1238 iter->second->setSeed(seedL, 0);
void watchPostModuleConstruction(PostModuleConstruction::slot_type const &iSlot)
void writeStates(std::vector< RandomEngineState > const &v, std::ofstream &outFile)
T getUntrackedParameter(std::string const &, T const &) const
static uint32_t maxSeedHepJames
void restoreFromCache(std::vector< RandomEngineState > const &cache)
void watchPostModuleBeginLumi(PostModuleBeginLumi::slot_type const &iSlot)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::string currentLabel_
void postModuleEndJob(ModuleDescription const &description)
void preModuleEndLumi(ModuleDescription const &description)
bool backwardCompatibilityRead(Event const &event)
void readFromEvent(Event const &event)
void watchPreModuleConstruction(PreModuleConstruction::slot_type const &iSlot)
void watchPostModule(PostModule::slot_type const &iSlot)
virtual void print()
For debugging purposes only.
void setLabel(const std::string &value)
std::vector< std::vector< unsigned long > > engineStateStack_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
static uint32_t maxSeedTRandom3
std::string const & moduleName() const
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
virtual void postEventRead(Event const &event)
void preModuleConstruction(ModuleDescription const &description)
void postModuleEndLumi(ModuleDescription const &description)
void preModule(ModuleDescription const &description)
void postBeginLumi(LuminosityBlock const &lumi, EventSetup const &es)
static size_t const maxStates
void postModule(ModuleDescription const &description)
void watchPreModuleEndLumi(PreModuleEndLumi::slot_type const &iSlot)
void preModuleBeginJob(ModuleDescription const &description)
bool getByLabel(std::string const &label, Handle< PROD > &result) const
void readFromLuminosityBlock(LuminosityBlock const &lumi)
void readLumiStatesFromTextFile(std::string const &fileName)
std::map< std::string, std::string > engineNameMap_
std::string const & moduleLabel() const
void checkEngineType(std::string const &typeFromConfig, std::string const &typeFromEvent, std::string const &engineLabel)
edm::InputTag restoreStateTag_
void watchPreModule(PreModule::slot_type const &iSlot)
void preModuleBeginLumi(ModuleDescription const &description)
std::string saveFileName_
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
void saveStatesToFile(std::string const &fileName)
void postModuleBeginRun(ModuleDescription const &description)
void watchPreModuleEndRun(PreModuleEndRun::slot_type const &iSlot)
virtual CLHEP::HepRandomEngine & getEngine() const
Use this to get the random number engine, this is the only function most users should call...
RandomNumberGeneratorService(ParameterSet const &pset, ActivityRegistry &activityRegistry)
virtual std::vector< RandomEngineState > const & getEventCache() const
void postModuleEndRun(ModuleDescription const &description)
bool readEngineState(std::istream &is, std::vector< RandomEngineState > &cache, std::string const &whichStates, bool &saveToCache)
virtual uint32_t mySeed() const
Exists for backward compatibility.
static size_t const maxSeeds
void watchPostModuleEndRun(PostModuleEndRun::slot_type const &iSlot)
void readEventStatesFromTextFile(std::string const &fileName)
void watchPreModuleEndJob(PreModuleEndJob::slot_type const &iSlot)
virtual void preBeginLumi(LuminosityBlock const &lumi)
bool failedToFindStatesInLumi_
std::vector< RandomEngineState > eventCache_
void readStatesFromFile(std::string const &fileName, std::vector< RandomEngineState > &cache, std::string const &whichStates)
void snapShot(std::vector< RandomEngineState > &cache)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
void watchPostBeginLumi(PostBeginLumi::slot_type const &iSlot)
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 watchPreModuleBeginJob(PreModuleBeginJob::slot_type const &iSlot)
void push(std::string const &iLabel)
void postModuleBeginJob(ModuleDescription const &description)
std::vector< EngineMap::const_iterator > engineStack_
void watchPostModuleBeginRun(PostModuleBeginRun::slot_type const &iSlot)
virtual std::vector< RandomEngineState > const & getLumiCache() const
void preModuleEndRun(ModuleDescription const &description)
void startNewSequencesForEvents()
std::vector< RandomEngineState > lumiCache_
std::map< std::string, VUint32 > seedMap_
ParameterSet const & getParameterSet(std::string const &) const
void postModuleBeginLumi(ModuleDescription const &description)
void preModuleEndJob(ModuleDescription const &description)
std::vector< std::string > VString
edm::InputTag restoreStateBeginLumiTag_
void postForkReacquireResources(unsigned childIndex, unsigned kMaxChildren)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void readVector(std::istream &is, unsigned numItems, std::vector< uint32_t > &v)
void postModuleConstruction(ModuleDescription const &description)
static uint32_t maxSeedRanecu
static std::string const emptyString("")
void watchPostForkReacquireResources(PostForkReacquireResources::slot_type const &iSlot)
virtual ~RandomNumberGeneratorService()
char data[epos_bytes_allocation]
EngineMap::const_iterator currentEngine_
void writeVector(VUint32 const &v, std::ofstream &outFile)
std::string restoreFileName_
void watchPostModuleBeginJob(PostModuleBeginJob::slot_type const &iSlot)
ParameterDescriptionBase * addOptionalUntracked(U const &iLabel, T const &value)
volatile std::atomic< bool > shutdown_flag false
void watchPreModuleBeginLumi(PreModuleBeginLumi::slot_type const &iSlot)
void preModuleBeginRun(ModuleDescription const &description)
T mod(const T &a, const T &b)
void watchPostModuleEndJob(PostModuleEndJob::slot_type const &iSlot)
void watchPreModuleBeginRun(PreModuleBeginRun::slot_type const &iSlot)
std::vector< uint32_t > VUint32
uint32_t eventSeedOffset_
void watchPostModuleEndLumi(PostModuleEndLumi::slot_type const &iSlot)
std::string constructSaveFileName()
bool saveFileNameRecorded_