30 #include "CLHEP/Random/engineIDulong.h"
31 #include "CLHEP/Random/JamesRandom.h"
32 #include "CLHEP/Random/RanecuEngine.h"
48 saveFileName_(pset.getUntrackedParameter<std::
string>(
"saveFileName")),
49 saveFileNameRecorded_(
false),
50 restoreFileName_(pset.getUntrackedParameter<std::
string>(
"restoreFileName")),
51 enableChecking_(pset.getUntrackedParameter<bool>(
"enableChecking")),
54 eventSeedOffset_(pset.getUntrackedParameter<unsigned>(
"eventSeedOffset")),
55 failedToFindStatesInLumi_(
false) {
57 if(pset.
exists(
"restoreStateTag")) {
66 <<
"In the configuration for the RandomNumberGeneratorService both\n"
67 <<
"restoreFileName and restoreStateLabel were set to nonempty values\n"
68 <<
"which is illegal. It is impossible to restore the random engine\n"
69 <<
"states two different ways in the same process.\n";
76 <<
"The saveFileName parameter must be a simple file name with no path\n"
77 <<
"specification. In the configuration, it was given the value \""
86 for(VString::const_iterator it = pSets.begin(), itEnd = pSets.end(); it != itEnd; ++it) {
91 bool initialSeedExists = modulePSet.
exists(
"initialSeed");
92 bool initialSeedSetExists = modulePSet.
exists(
"initialSeedSet");
94 if(initialSeedExists && initialSeedSetExists) {
96 <<
"For the module with the label \"" << *it <<
"\",\n"
97 <<
"both the parameters \"initialSeed\" and \"initialSeedSet\"\n"
98 <<
"have been set in the configuration. You must set one or\n"
99 <<
"the other. It is illegal to set both.\n";
100 }
else if(!initialSeedExists && !initialSeedSetExists) {
102 <<
"For the module with the label \"" << *it <<
"\",\n"
103 <<
"neither the parameter \"initialSeed\" nor \"initialSeedSet\"\n"
104 <<
"has been set in the configuration. You must set one or\n"
106 }
else if(initialSeedExists) {
108 initialSeedSet.clear();
109 initialSeedSet.push_back(initialSeed);
110 }
else if(initialSeedSetExists) {
119 if(initialSeedSet.size() != 2U) {
121 <<
"Random engines of type \"RanecuEngine\" require 2 seeds\n"
122 <<
"be specified with the parameter named \"initialSeedSet\".\n"
123 <<
"Either \"initialSeedSet\" was not in the configuration\n"
124 <<
"or its size was not 2 for the module with label \"" << *it <<
"\".\n" ;
126 boost::shared_ptr<CLHEP::HepRandomEngine> engine(
new CLHEP::RanecuEngine());
132 <<
"The RanecuEngine seeds should be in the range 0 to 2147483647.\n"
133 <<
"The seeds passed to the RandomNumberGenerationService from the\n"
134 "configuration file were " << initialSeedSet[0] <<
" and " << initialSeedSet[1]
135 <<
"\nThis was for the module with label \"" << *it <<
"\".\n";
138 seedL[0] =
static_cast<long int>(initialSeedSet[0]);
139 seedL[1] =
static_cast<long int>(initialSeedSet[1]);
140 engine->setSeeds(seedL, 0);
144 if(initialSeedSet.size() != 1U) {
146 <<
"Random engines of type \"HepJamesRandom\" and \"TRandom3\n"
147 <<
"require exactly 1 seed be specified in the configuration.\n"
148 <<
"There were " << initialSeedSet.size() <<
" seeds set for the\n"
149 <<
"module with label \"" << *it <<
"\".\n" ;
151 long int seedL =
static_cast<long int>(initialSeedSet[0]);
153 if(engineName ==
"HepJamesRandom") {
156 <<
"The CLHEP::HepJamesRandom engine seed should be in the range 0 to 900000000.\n"
157 <<
"The seed passed to the RandomNumberGenerationService from the\n"
158 "configuration file was " << initialSeedSet[0] <<
". This was for \n"
159 <<
"the module with label " << *it <<
".\n";
161 boost::shared_ptr<CLHEP::HepRandomEngine> engine(
new CLHEP::HepJamesRandom(seedL));
163 }
else if(engineName ==
"TRandom3") {
172 uint32_t seedu32 =
static_cast<uint32_t
>(seedL);
173 assert(initialSeedSet[0] == seedu32);
175 boost::shared_ptr<CLHEP::HepRandomEngine> engine(
new TRandomAdaptor(seedL));
179 <<
"The random engine name, \"" << engineName
180 <<
"\", does not correspond to a supported engine.\n"
181 <<
"This engine was configured for the module with label \"" << *it <<
"\"";
225 CLHEP::HepRandomEngine&
231 <<
"The module with label \""
233 <<
"\" requested a random number engine from the \n"
234 "RandomNumberGeneratorService, but that module was not configured\n"
235 "for random numbers. An engine is created only if a seed(s) is provided\n"
236 "in the configuration file. Please add the following PSet to the\n"
237 "configuration file for the RandomNumberGeneratorService:\n\n"
239 " initialSeed = cms.untracked.uint32(your_seed),\n"
240 " engineName = cms.untracked.string('TRandom3')\n"
242 "where you replace \"your_seed\" with a number and add a comma if necessary\n"
243 "The \"engineName\" parameter is optional. If absent the default is \"HepJamesRandom\".\n";
246 <<
"Requested a random number engine from the RandomNumberGeneratorService\n"
247 "when no module was active. This is not supposed to be possible.\n"
248 "Please inform the edm developers about this. It would be helpful to\n"
249 "know the stack. If a source was requesting a random engine this could\n"
250 "happen. Sources are not supposed to be doing that anymore.\n";
259 std::map<std::string, VUint32>::const_iterator iter;
265 <<
"The module with label \""
267 <<
"\" requested a random number seed from the \n"
268 "RandomNumberGeneratorService, but that module was not configured\n"
269 "for random numbers. An engine is created only if a seed(s) is provided\n"
270 "in the configuration file. Please add the following PSet to the\n"
271 "configuration file for the RandomNumberGeneratorService:\n\n"
273 " initialSeed = cms.untracked.uint32(your_seed),\n"
274 " engineName = cms.untracked.string('TRandom3')\n"
276 "where you replace \"your_seed\" with a number and add a comma if necessary\n"
277 "The \"engineName\" parameter is optional. If absent the default is \"HepJamesRandom\".\n";
280 <<
"Requested a random number seed from the RandomNumberGeneratorService\n"
281 "when no module was active. This is not supposed to be possible.\n"
282 "Please inform the edm developers about this. It would be helpful to\n"
283 "know the stack. If a source was requesting a random engine this could\n"
284 "happen. Sources are not supposed to be doing that anymore.\n";
287 return iter->second[0];
307 val.addOptionalUntracked<std::vector<uint32_t> >(
"initialSeedSet");
308 val.addOptionalUntracked<
std::string>(
"engineName");
311 wnode.setComment(
"The name of each ParameterSet will be the associated module label.");
314 descriptions.
add(
"RandomNumberGeneratorService", desc);
322 std::ostringstream
suffix;
323 suffix <<
"_" << childIndex;
400 reportSvc->reportRandomStateFile(fullName);
423 <<
"It is illegal to generate random numbers during module construction because \n"
424 "that makes it very difficult to reproduce the processing of individual\n"
425 "events. Random numbers were generated during module construction for the module with\n"
426 "class name \"" << description.
moduleName() <<
"\"\n"
427 "and module label \"" << description.
moduleLabel() <<
"\"\n";
447 <<
"It is illegal to generate random numbers during beginJob because \n"
448 "that makes it very difficult to reproduce the processing of individual\n"
449 "events. Random numbers were generated during beginJob for the module with\n"
450 "class name \"" << description.
moduleName() <<
"\"\n"
451 "and module label \"" << description.
moduleLabel() <<
"\"\n";
471 <<
"It is illegal to generate random numbers during beginRun because \n"
472 "that makes it very difficult to reproduce the processing of individual\n"
473 "events. Random numbers were generated during beginRun for the module with\n"
474 "class name \"" << description.
moduleName() <<
"\"\n"
475 "and module label \"" << description.
moduleLabel() <<
"\"\n";
515 <<
"It is illegal to generate random numbers during endLumi because \n"
516 "that makes it very difficult to reproduce the processing of individual\n"
517 "events. Random numbers were generated during endLumi for the module with\n"
518 "class name \"" << description.
moduleName() <<
"\"\n"
519 "and module label \"" << description.
moduleLabel() <<
"\"\n";
539 <<
"It is illegal to generate random numbers during endRun because \n"
540 "that makes it very difficult to reproduce the processing of individual\n"
541 "events. Random numbers were generated during endRun for the module with\n"
542 "class name \"" << description.
moduleName() <<
"\"\n"
543 "and module label \"" << description.
moduleLabel() <<
"\"\n";
563 <<
"It is illegal to generate random numbers during endJob because \n"
564 "that makes it very difficult to reproduce the processing of individual\n"
565 "events. Random numbers were generated during endJob for the module with\n"
566 "class name \"" << description.
moduleName() <<
"\"\n"
567 "and module label \"" << description.
moduleLabel() <<
"\"\n";
574 std::vector<RandomEngineState>
const&
579 std::vector<RandomEngineState>
const&
586 std::cout <<
"\n\nRandomNumberGeneratorService dump\n\n";
593 std::vector<uint32_t> seeds = iter->second;
594 for(std::vector<uint32_t>::const_iterator vIter = seeds.begin();
595 vIter != seeds.end();
601 std::cout <<
"\n Contents of engineNameMap\n";
602 for(std::map<std::string, std::string>::const_iterator iter =
engineNameMap_.begin();
605 std::cout <<
" " << iter->first <<
" " << iter->second <<
"\n";
607 std::cout <<
"\n Contents of engineMap\n";
608 for(EngineMap::const_iterator iter =
engineMap_.begin();
612 <<
" " << iter->second->name() <<
" ";
613 if(iter->second->name() ==
std::string(
"HepJamesRandom")) {
616 std::cout <<
"Engine does not know original seed";
624 for(VString::const_iterator iter =
labelStack_.begin();
627 std::cout <<
" " << i <<
" " << *iter <<
"\n";
630 std::cout <<
" currentEngine points to end\n";
639 for(std::vector<EngineMap::const_iterator>::const_iterator iter =
engineStack_.begin();
643 std::cout <<
" " << i <<
" Points to end of engine map\n";
645 std::cout <<
" " << i <<
" " << (*iter)->first
646 <<
" " << (*iter)->second->name() <<
" " << (*iter)->second->getSeed() <<
"\n";
699 <<
"The RandomNumberGeneratorService is trying to restore\n"
700 <<
"the state of the random engines by reading a product from\n"
702 <<
"fails to find one. The label used in the request for the product\n"
703 <<
"is set in the configuration. It is probably set to the wrong value\n"
704 <<
"in the configuration file. It must match the module label\n"
705 <<
"of the RandomEngineStateProducer that created the product in\n"
706 <<
"a previous process\n";
711 <<
"The RandomNumberGeneratorService is trying to restore\n"
712 <<
"the state of the random engines by reading a product from\n"
713 <<
"the Event and LuminosityBlock with input tag \"" <<
restoreStateTag_ <<
"\".\n"
714 <<
"It found the product in the Event but not the one in the LuminosityBlock.\n"
715 <<
"Either the product in the LuminosityBlock was dropped or\n"
716 <<
"there is a bug somewhere\n";
730 for(std::vector<RandomEngineState>::const_iterator
state = states->begin(),
731 iEnd = states->end();
734 std::vector<RandomEngineState>::iterator cachedState =
738 if(cachedState !=
eventCache_.end() && cachedState->getLabel() ==
state->getLabel()) {
739 if(cachedState->getSeed().size() !=
state->getSeed().size() ||
740 cachedState->getState().size() !=
state->getState().size()) {
742 <<
"In function RandomNumberGeneratorService::backwardCompatibilityRead.\n"
743 <<
"When attempting to replay processing with the RandomNumberGeneratorService,\n"
744 <<
"the engine type for each module must be the same in the replay configuration\n"
745 <<
"and the original configuration. If this is not the problem, then the data\n"
746 <<
"is somehow corrupted or there is a bug because the vector in the data containing\n"
747 <<
"the seeds or engine state is the incorrect size for the type of random engine.\n";
749 cachedState->setSeed(
state->getSeed());
750 cachedState->setState(
state->getState());
759 std::vector<RandomEngineState>::iterator
state = cache.begin();
761 for(EngineMap::const_iterator iter =
engineMap_.begin();
765 state->setLabel(iter->first);
766 state->setSeed(
seedMap_[iter->first]);
768 std::vector<unsigned long> stateL = iter->second->put();
769 state->clearStateVector();
770 state->reserveStateVector(stateL.size());
771 for(std::vector<unsigned long>::const_iterator vIter = stateL.begin();
772 vIter != stateL.end();
774 state->push_back_stateVector(static_cast<uint32_t>(*vIter));
781 for(std::vector<RandomEngineState>::const_iterator iter = cache.begin(),
783 iter != iEnd; ++iter) {
787 std::vector<uint32_t>
const& engineState = iter->getState();
788 std::vector<unsigned long> engineStateL;
789 for(std::vector<uint32_t>::const_iterator iVal = engineState.begin(),
790 theEnd = engineState.end();
791 iVal != theEnd; ++iVal) {
792 engineStateL.push_back(static_cast<unsigned long>(*iVal));
795 std::vector<uint32_t>
const& engineSeeds = iter->getSeed();
796 std::vector<long> engineSeedsL;
797 for(std::vector<uint32_t>::const_iterator iVal = engineSeeds.begin(),
798 theEnd = engineSeeds.end();
801 long seedL =
static_cast<long>(*iVal);
802 engineSeedsL.push_back(seedL);
811 uint32_t seedu32 =
static_cast<uint32_t
>(seedL);
812 assert(*iVal == seedu32);
815 EngineMap::iterator engine =
engineMap_.find(engineLabel);
819 seedMap_[engineLabel] = engineSeeds;
823 if(engineStateL[0] == CLHEP::engineIDulong<CLHEP::HepJamesRandom>()) {
828 engine->second->setSeed(engineSeedsL[0], 0);
829 engine->second->get(engineStateL);
830 }
else if(engineStateL[0] == CLHEP::engineIDulong<CLHEP::RanecuEngine>()) {
835 engine->second->get(engineStateL);
836 }
else if(engineStateL[0] == CLHEP::engineIDulong<TRandomAdaptor>()) {
841 engine->second->setSeed(engineSeedsL[0], 0);
842 engine->second->get(engineStateL);
847 <<
"The RandomNumberGeneratorService is trying to restore the state\n"
848 "of the random engines. The state in the event indicates an engine\n"
849 "of an unknown type. This should not be possible unless you are\n"
850 "running with an old code release on a new file that was created\n"
851 "with a newer release which had new engine types added. In this case\n"
852 "the only solution is to use a newer release. In any other case, notify\n"
853 "the EDM developers because this should not be possible\n";
863 if(typeFromConfig != typeFromEvent) {
865 <<
"The RandomNumberGeneratorService is trying to restore\n"
866 <<
"the state of the random engine for the module \""
867 << engineLabel <<
"\". An\n"
868 <<
"error was detected because the type of the engine in the\n"
869 <<
"input file and the configuration file do not match.\n"
870 <<
"In the configuration file the type is \"" << typeFromConfig
871 <<
"\".\nIn the input file the type is \"" << typeFromEvent <<
"\". If\n"
872 <<
"you are not generating any random numbers in this module, then\n"
873 <<
"remove the line in the configuration file that gives it\n"
874 <<
"a seed and the error will go away. Otherwise, you must give\n"
875 <<
"this module the same engine type in the configuration file or\n"
876 <<
"stop trying to restore the random engine state.\n";
887 <<
"Unable to open the file \""
888 << fileName <<
"\" to save the state of the random engines.\n";
890 outFile_.seekp(0, std::ios_base::beg);
891 outFile_ <<
"<RandomEngineStates>\n";
901 outFile_ <<
"</RandomEngineStates>\n" ;
907 std::ofstream& outFile) {
908 for(std::vector<RandomEngineState>::const_iterator iter = v.begin(),
910 iter != iEnd; ++iter) {
912 std::vector<uint32_t>
const& seedVector = iter->getSeed();
915 std::vector<uint32_t>
const& stateVector = iter->getState();
918 outFile <<
"<ModuleLabel>\n" << iter->getLabel() <<
"\n</ModuleLabel>\n";
920 outFile <<
"<SeedLength>\n" << seedVectorLength <<
"\n</SeedLength>\n" ;
921 outFile <<
"<InitialSeeds>\n";
923 outFile <<
"</InitialSeeds>\n";
924 outFile <<
"<FullStateLength>\n" << stateVectorLength <<
"\n</FullStateLength>\n";
925 outFile <<
"<FullState>\n";
927 outFile <<
"</FullState>\n";
933 std::ofstream& outFile) {
934 if(v.empty())
return;
935 size_t numItems = v.size();
936 for(
size_t i = 0;
i < numItems; ++
i) {
937 if(
i != 0 &&
i % 10 == 0) outFile <<
"\n";
938 outFile << std::setw(13) << v[
i];
965 std::vector<RandomEngineState>& cache,
967 std::ifstream inFile;
971 <<
"Unable to open the file \""
972 << fileName <<
"\" to restore the random engine states.\n";
977 if(!inFile.good() || text !=
std::string(
"<RandomEngineStates>")) {
979 <<
"Attempting to read file with random number engine states.\n"
981 <<
"\" is ill-structured or otherwise corrupted.\n"
982 <<
"Cannot read the file header word.\n";
984 bool saveToCache =
false;
989 std::vector<RandomEngineState>& cache,
996 std::vector<uint32_t> seedVector;
998 std::vector<uint32_t> stateVector;
1008 <<
"\" is ill-structured or otherwise corrupted.\n"
1009 <<
"Cannot read next field and did not hit the end yet.\n";
1013 if(leading ==
std::string(
"</RandomEngineStates>"))
return false;
1018 saveToCache =
false;
1025 saveToCache = (leading == whichStates);
1031 is >> moduleLabel >> trailing;
1037 <<
"\" is ill-structured or otherwise corrupted.\n"
1038 <<
"Cannot read a module label when restoring random engine states.\n";
1041 is >> leading >> seedVectorSize >> trailing;
1047 <<
"\" is ill-structured or otherwise corrupted.\n"
1048 <<
"Cannot read seed vector length when restoring random engine states.\n";
1056 <<
"\" is ill-structured or otherwise corrupted.\n"
1057 <<
"Cannot read beginning of InitialSeeds when restoring random engine states.\n";
1063 <<
"\" is ill-structured or otherwise corrupted.\n"
1064 <<
"The number of seeds exceeds 64K.\n";
1074 <<
"\" is ill-structured or otherwise corrupted.\n"
1075 <<
"Cannot read end of InitialSeeds when restoring random engine states.\n";
1078 is >> leading >> stateVectorSize >> trailing;
1084 <<
"\" is ill-structured or otherwise corrupted.\n"
1085 <<
"Cannot read state vector length when restoring random engine states.\n";
1093 <<
"\" is ill-structured or otherwise corrupted.\n"
1094 <<
"Cannot read beginning of FullState when restoring random engine states.\n";
1100 <<
"\" is ill-structured or otherwise corrupted.\n"
1101 <<
"The number of states exceeds 64K.\n";
1104 readVector(is, stateVectorSize, stateVector);
1111 <<
"\" is ill-structured or otherwise corrupted.\n"
1112 <<
"Cannot read end of FullState when restoring random engine states.\n";
1117 randomEngineState.
setLabel(moduleLabel);
1118 std::vector<RandomEngineState>::iterator
state =
1119 std::lower_bound(cache.begin(), cache.end(), randomEngineState);
1121 if(state != cache.end() && moduleLabel == state->getLabel()) {
1122 if(seedVector.size() != state->getSeed().size() ||
1123 stateVector.size() != state->getState().size()) {
1126 <<
"\" is ill-structured or otherwise corrupted.\n"
1127 <<
"Vectors containing engine state are the incorrect size for the type of random engine.\n";
1129 state->setSeed(seedVector);
1130 state->setState(stateVector);
1139 v.reserve(numItems);
1141 for(
unsigned i = 0;
i < numItems; ++
i) {
1146 <<
"\" is ill-structured or otherwise corrupted.\n"
1147 <<
"Cannot read vector when restoring random engine states.\n";
1158 for(EngineMap::const_iterator iter =
engineMap_.begin();
1170 assert(seeds.size() == 2U);
1173 offset1 = offset1 %
mod;
1174 offset2 = offset2 %
mod;
1175 seeds[0] = (seeds[0] + offset1) % mod;
1176 seeds[0] = (seeds[0] + offset2) % mod;
1178 seedL[0] =
static_cast<long int>(seeds[0]);
1179 seedL[1] =
static_cast<long int>(seeds[1]);
1180 iter->second->setSeeds(seedL,0);
1182 assert(seeds.size() == 1U);
1184 if(engineName ==
"HepJamesRandom") {
1187 offset1 = offset1 %
mod;
1188 offset2 = offset2 %
mod;
1189 seeds[0] = (seeds[0] + offset1) % mod;
1190 seeds[0] = (seeds[0] + offset2) % mod;
1192 long int seedL =
static_cast<long int>(seeds[0]);
1193 iter->second->setSeed(seedL, 0);
1195 assert(engineName ==
"TRandom3");
1200 if((max32 - seeds[0]) >= offset1) {
1201 seeds[0] = seeds[0] + offset1;
1203 seeds[0] = offset1 - (max32 - seeds[0]) - 1U;
1205 if((max32 - seeds[0]) >= offset2) {
1206 seeds[0] = seeds[0] + offset2;
1208 seeds[0] = offset2 - (max32 - seeds[0]) - 1U;
1210 long seedL =
static_cast<long>(seeds[0]);
1219 uint32_t seedu32 =
static_cast<uint32_t
>(seedL);
1220 assert(seeds[0] == seedu32);
1222 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)
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_