diff --git a/IOMC/RandomEngine/python/IOMC_cff.py b/IOMC/RandomEngine/python/IOMC_cff.py index 7aec5233dd36c..e07c2077f9dc3 100644 --- a/IOMC/RandomEngine/python/IOMC_cff.py +++ b/IOMC/RandomEngine/python/IOMC_cff.py @@ -1,5 +1,8 @@ import FWCore.ParameterSet.Config as cms +FullSimEngine = cms.untracked.string('HepJamesRandom') +#FullSimEngine = cms.untracked.string('MixMaxRng') +FastSimEngine = cms.untracked.string('TRandom3') RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService", # # seed for a source no longer needed - replaces by "generator" @@ -10,11 +13,11 @@ # ), externalLHEProducer = cms.PSet( initialSeed = cms.untracked.uint32(234567), - engineName = cms.untracked.string('HepJamesRandom') + engineName = FullSimEngine ), generator = cms.PSet( initialSeed = cms.untracked.uint32(123456789), - engineName = cms.untracked.string('HepJamesRandom') + engineName = FullSimEngine ), # # EvtGenProducer discontinued, replaced by funtionalities in ExternalDecays, @@ -26,43 +29,43 @@ # ), VtxSmeared = cms.PSet( initialSeed = cms.untracked.uint32(98765432), - engineName = cms.untracked.string('HepJamesRandom') + engineName = FullSimEngine ), LHCTransport = cms.PSet( initialSeed = cms.untracked.uint32(87654321), - engineName = cms.untracked.string('TRandom3') + engineName = FastSimEngine ), hiSignalLHCTransport = cms.PSet( initialSeed = cms.untracked.uint32(88776655), - engineName = cms.untracked.string('TRandom3') + engineName = FastSimEngine ), g4SimHits = cms.PSet( initialSeed = cms.untracked.uint32(11), - engineName = cms.untracked.string('HepJamesRandom') + engineName = FullSimEngine ), mix = cms.PSet( initialSeed = cms.untracked.uint32(12345), - engineName = cms.untracked.string('HepJamesRandom') + engineName = FullSimEngine ), mixData = cms.PSet( initialSeed = cms.untracked.uint32(12345), - engineName = cms.untracked.string('HepJamesRandom') + engineName = FullSimEngine ), simSiStripDigiSimLink = cms.PSet( initialSeed = cms.untracked.uint32(1234567), - engineName = cms.untracked.string('HepJamesRandom') + engineName = FullSimEngine ), simMuonDTDigis = cms.PSet( initialSeed = cms.untracked.uint32(1234567), - engineName = cms.untracked.string('HepJamesRandom') + engineName = FullSimEngine ), simMuonCSCDigis = cms.PSet( initialSeed = cms.untracked.uint32(11223344), - engineName = cms.untracked.string('HepJamesRandom') + engineName = FullSimEngine ), simMuonRPCDigis = cms.PSet( initialSeed = cms.untracked.uint32(1234567), - engineName = cms.untracked.string('HepJamesRandom') + engineName = FullSimEngine ), # # HI generation & simulation is a special processing/chain, @@ -70,11 +73,11 @@ # hiSignal = cms.PSet( initialSeed = cms.untracked.uint32(123456789), - engineName = cms.untracked.string('HepJamesRandom') + engineName = FullSimEngine ), hiSignalG4SimHits = cms.PSet( initialSeed = cms.untracked.uint32(11), - engineName = cms.untracked.string('HepJamesRandom') + engineName = FullSimEngine ), # @@ -83,82 +86,82 @@ # famosPileUp = cms.PSet( initialSeed = cms.untracked.uint32(918273), - engineName = cms.untracked.string('TRandom3') + engineName = FastSimEngine ), mixGenPU = cms.PSet( initialSeed = cms.untracked.uint32(918273), # intentionally the same as famosPileUp - engineName = cms.untracked.string('TRandom3') + engineName = FastSimEngine ), mixSimCaloHits = cms.PSet( initialSeed = cms.untracked.uint32(918273), - engineName = cms.untracked.string('TRandom3') + engineName = FastSimEngine ), mixRecoTracks = cms.PSet( initialSeed = cms.untracked.uint32(918273), - engineName = cms.untracked.string('TRandom3') + engineName = FastSimEngine ), famosSimHits = cms.PSet( initialSeed = cms.untracked.uint32(13579), - engineName = cms.untracked.string('TRandom3') + engineName = FastSimEngine ), fastTrackerRecHits = cms.PSet( initialSeed = cms.untracked.uint32(24680), - engineName = cms.untracked.string('TRandom3') + engineName = FastSimEngine ), ecalRecHit = cms.PSet( initialSeed = cms.untracked.uint32(654321), - engineName = cms.untracked.string('TRandom3') + engineName = FastSimEngine ), ecalPreshowerRecHit = cms.PSet( initialSeed = cms.untracked.uint32(6541321), - engineName = cms.untracked.string('TRandom3') + engineName = FastSimEngine ), hbhereco = cms.PSet( initialSeed = cms.untracked.uint32(541321), - engineName = cms.untracked.string('TRandom3') + engineName = FastSimEngine ), horeco = cms.PSet( initialSeed = cms.untracked.uint32(541321), - engineName = cms.untracked.string('TRandom3') + engineName = FastSimEngine ), hfreco = cms.PSet( initialSeed = cms.untracked.uint32(541321), - engineName = cms.untracked.string('TRandom3') + engineName = FastSimEngine ), paramMuons = cms.PSet( initialSeed = cms.untracked.uint32(54525), - engineName = cms.untracked.string('TRandom3') + engineName = FastSimEngine ), l1ParamMuons = cms.PSet( initialSeed = cms.untracked.uint32(6453209), - engineName = cms.untracked.string('TRandom3') + engineName = FastSimEngine ), MuonSimHits = cms.PSet( initialSeed = cms.untracked.uint32(987346), - engineName = cms.untracked.string('TRandom3') + engineName = FastSimEngine ), #CTPPS FastSim CTPPSFastRecHits = cms.PSet( initialSeed = cms.untracked.uint32(1357987), - engineName = cms.untracked.string('TRandom3') + engineName = FastSimEngine ), # filter for simulated beam spot simBeamSpotFilter = cms.PSet( initialSeed = cms.untracked.uint32(87654321), - engineName = cms.untracked.string('HepJamesRandom') + engineName = FullSimEngine ) # to save the status of the last event (useful for crashes) ,saveFileName = cms.untracked.string('') @@ -175,14 +178,14 @@ from Configuration.Eras.Modifier_run2_GEM_2017_cff import run2_GEM_2017 run2_GEM_2017.toModify(RandomNumberGeneratorService, simMuonGEMDigis = cms.PSet( initialSeed = cms.untracked.uint32(1234567), - engineName = cms.untracked.string('HepJamesRandom')) ) + engineName = FullSimEngine) ) from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM run3_GEM.toModify( RandomNumberGeneratorService, simMuonGEMDigis = cms.PSet( initialSeed = cms.untracked.uint32(1234567), - engineName = cms.untracked.string('HepJamesRandom')) + engineName = FullSimEngine) ) from Configuration.Eras.Modifier_phase2_muon_cff import phase2_muon @@ -190,16 +193,16 @@ RandomNumberGeneratorService, simMuonME0Digis = cms.PSet( initialSeed = cms.untracked.uint32(1234567), - engineName = cms.untracked.string('HepJamesRandom')), + engineName = FullSimEngine), simMuonME0PseudoDigis = cms.PSet( initialSeed = cms.untracked.uint32(1234567), - engineName = cms.untracked.string('HepJamesRandom')), + engineName = FullSimEngine), simMuonME0PseudoReDigis = cms.PSet( initialSeed = cms.untracked.uint32(7654321), - engineName = cms.untracked.string('HepJamesRandom')), + engineName = FullSimEngine), simMuonME0PseudoReDigisCoarse = cms.PSet( initialSeed = cms.untracked.uint32(2234567), - engineName = cms.untracked.string('HepJamesRandom')), + engineName = FullSimEngine), ) from Configuration.Eras.Modifier_phase2_timing_cff import phase2_timing @@ -207,14 +210,14 @@ RandomNumberGeneratorService, trackTimeValueMapProducer = cms.PSet( initialSeed = cms.untracked.uint32(1234567), - engineName = cms.untracked.string('HepJamesRandom') + engineName = FullSimEngine ), gsfTrackTimeValueMapProducer = cms.PSet( initialSeed = cms.untracked.uint32(1234567), - engineName = cms.untracked.string('HepJamesRandom') + engineName = FullSimEngine ), ecalBarrelClusterFastTimer = cms.PSet( initialSeed = cms.untracked.uint32(1234567), - engineName = cms.untracked.string('HepJamesRandom') + engineName = FullSimEngine ) ) diff --git a/IOMC/RandomEngine/src/RandomNumberGeneratorService.cc b/IOMC/RandomEngine/src/RandomNumberGeneratorService.cc index 75813d8465360..001641da36f4f 100644 --- a/IOMC/RandomEngine/src/RandomNumberGeneratorService.cc +++ b/IOMC/RandomEngine/src/RandomNumberGeneratorService.cc @@ -41,6 +41,7 @@ #include "CLHEP/Random/engineIDulong.h" #include "CLHEP/Random/JamesRandom.h" #include "CLHEP/Random/RanecuEngine.h" +#include "CLHEP/Random/MixMaxRng.h" #include #include @@ -140,7 +141,7 @@ namespace edm { if(initialSeedSet[0] > maxSeedRanecu || initialSeedSet[1] > maxSeedRanecu) { // They need to fit in a 31 bit integer throw Exception(errors::Configuration) - << "The RanecuEngine seeds should be in the range 0 to 2147483647.\n" + << "The RanecuEngine seeds should be in the range 0 to " << maxSeedRanecu << ".\n" << "The seeds passed to the RandomNumberGenerationService from the\n" "configuration file were " << initialSeedSet[0] << " and " << initialSeedSet[1] << "\nThis was for the module with label \"" << label << "\".\n"; @@ -150,7 +151,7 @@ namespace edm { else { if(initialSeedSet.size() != 1U) { throw Exception(errors::Configuration) - << "Random engines of type \"HepJamesRandom\" and \"TRandom3\n" + << "Random engines of type \"HepJamesRandom\", \"TRandom3\" and \"MixMaxRng\" \n" << "require exactly 1 seed be specified in the configuration.\n" << "There were " << initialSeedSet.size() << " seeds set for the\n" << "module with label \"" << label << "\".\n" ; @@ -158,12 +159,28 @@ namespace edm { if(engineName == "HepJamesRandom") { if(initialSeedSet[0] > maxSeedHepJames) { throw Exception(errors::Configuration) - << "The CLHEP::HepJamesRandom engine seed should be in the range 0 to 900000000.\n" + << "The CLHEP::HepJamesRandom engine seed should be in the range 0 to " << maxSeedHepJames <<".\n" << "The seed passed to the RandomNumberGenerationService from the\n" "configuration file was " << initialSeedSet[0] << ". This was for \n" << "the module with label " << label << ".\n"; } - } else if(engineName != "TRandom3") { + } else if(engineName == "MixMaxRng") { + if(initialSeedSet[0] > maxSeedTRandom3) { + throw Exception(errors::Configuration) + << "The CLHEP::MixMaxRng engine seed should be in the range 0 to " << maxSeedTRandom3 << ".\n" + << "The seed passed to the RandomNumberGenerationService from the\n" + "configuration file was " << initialSeedSet[0] << ". This was for \n" + << "the module with label " << label << ".\n"; + } + } else if(engineName == "TRandom3") { + if(initialSeedSet[0] > maxSeedTRandom3) { + throw Exception(errors::Configuration) + << "The CLHEP::MixMaxRng engine seed should be in the range 0 to " << maxSeedTRandom3 << ".\n" + << "The seed passed to the RandomNumberGenerationService from the\n" + "configuration file was " << initialSeedSet[0] << ". This was for \n" + << "the module with label " << label << ".\n"; + } + } else { throw Exception(errors::Configuration) << "The random engine name, \"" << engineName << "\", does not correspond to a supported engine.\n" @@ -557,6 +574,8 @@ namespace edm { os << " " << i.engine()->name(); if(i.engine()->name() == std::string("HepJamesRandom")) { os << " " << i.engine()->getSeed(); + } else if(i.engine()->name() == std::string("MixMaxRng")) { + os << " " << i.engine()->getSeed(); } else { os << " engine does not know seeds"; } @@ -576,6 +595,8 @@ namespace edm { os << " " << i.engine()->name(); if(i.engine()->name() == std::string("HepJamesRandom")) { os << " " << i.engine()->getSeed(); + } else if(i.engine()->name() == std::string("MixMaxRng")) { + os << " " << i.engine()->getSeed(); } else { os << " engine does not know seeds"; } @@ -754,6 +775,15 @@ namespace edm { labelAndEngine->setSeed(engineSeeds[0], 0); labelAndEngine->setSeed(engineSeeds[1], 1); + } else if(engineStateL[0] == CLHEP::engineIDulong()) { + + checkEngineType(engine->name(), std::string("MixMaxRng"), engineLabel); + + // This line actually restores the engine state. + engine->setSeed(engineSeedsL[0], 0); + engine->get(engineStateL); + + labelAndEngine->setSeed(engineSeeds[0], 0); } else if(engineStateL[0] == CLHEP::engineIDulong()) { checkEngineType(engine->name(), std::string("TRandom3"), engineLabel); @@ -841,17 +871,14 @@ namespace edm { void RandomNumberGeneratorService::writeStates(std::vector const& v, std::ofstream& outFile) { - for(std::vector::const_iterator iter = v.begin(), - iEnd = v.end(); - iter != iEnd; ++iter) { - - std::vector const& seedVector = iter->getSeed(); + for(auto & state : v) { + std::vector const& seedVector = state.getSeed(); std::vector::size_type seedVectorLength = seedVector.size(); - std::vector const& stateVector = iter->getState(); + std::vector const& stateVector = state.getState(); std::vector::size_type stateVectorLength = stateVector.size(); - outFile << "\n" << iter->getLabel() << "\n\n"; + outFile << "\n" << state.getLabel() << "\n\n"; outFile << "\n" << seedVectorLength << "\n\n" ; outFile << "\n"; @@ -1120,6 +1147,12 @@ namespace edm { if(seedOffset != 0 || eventSeedOffset != 0) { resetEngineSeeds(engines.back(), name, seeds, seedOffset, eventSeedOffset); } + } else if(name == "MixMaxRng") { + std::shared_ptr engine = std::make_shared(seedL); + engines.emplace_back(label, seeds, engine); + if(seedOffset != 0 || eventSeedOffset != 0) { + resetEngineSeeds(engines.back(), name, seeds, seedOffset, eventSeedOffset); + } } else { // TRandom3, currently the only other possibility // There is a dangerous conversion from std::uint32_t to long @@ -1169,7 +1202,7 @@ namespace edm { } else { assert(seeds.size() == 1U); - if(engineName == "HepJamesRandom") { + if(engineName == "HepJamesRandom" || engineName == "MixMaxRng") { // Wrap around if the offsets push the seed over the maximum allowed value std::uint32_t mod = maxSeedHepJames + 1U; offset1 %= mod; diff --git a/IOMC/RandomEngine/test/TestRandomNumberServiceGlobal.cc b/IOMC/RandomEngine/test/TestRandomNumberServiceGlobal.cc index 97e344a9ad10b..b1428c63d5f00 100644 --- a/IOMC/RandomEngine/test/TestRandomNumberServiceGlobal.cc +++ b/IOMC/RandomEngine/test/TestRandomNumberServiceGlobal.cc @@ -72,6 +72,7 @@ the text file containing the states. #include "CLHEP/Random/engineIDulong.h" #include "CLHEP/Random/JamesRandom.h" #include "CLHEP/Random/RanecuEngine.h" +#include "CLHEP/Random/MixMaxRng.h" #include #include @@ -133,7 +134,6 @@ class TestRandomNumberServiceGlobal : public edm::global::EDAnalyzer seeds_; unsigned int offset_; @@ -193,8 +193,9 @@ TestRandomNumberServiceGlobal::analyze(edm::StreamID streamID, edm::Event const& if(dump_) { edm::Service rng; - std::cout << "*** TestRandomNumberServiceGlobal analyze " << rng->mySeed() << "\n"; - std::cout << rng->getEngine(streamID).name() << "\n"; + std::cout << "*** TestRandomNumberServiceGlobal analyze " << rng->mySeed() << " " + << rng->getEngine(streamID).name() << " streamID= " << streamID + << " multiStreamReplay: " << multiStreamReplay_ << "\n"; } TestRandomNumberServiceStreamCache* cache = streamCache(streamID); @@ -219,6 +220,11 @@ TestRandomNumberServiceGlobal::analyze(edm::StreamID streamID, edm::Event const& double mean = 10.0; // Mean of the exponential double randomNumberEvent3_ = expDist.fire(mean); + if(dump_) { + std::cout << " " << engine.name() << " " << randomNumberEvent0_<< " " << randomNumberEvent1_<< " " + << randomNumberEvent2_<< " " << randomNumberEvent3_ << std::endl; + } + // Write them to a text file cache->outFile_ << rng->mySeed() << "\n"; cache->outFile_ << randomNumberEvent0_ << "\n"; @@ -330,8 +336,8 @@ TestRandomNumberServiceGlobal::globalBeginLuminosityBlock(edm::LuminosityBlock c if(dump_) { edm::Service rng; - std::cout << "*** TestRandomNumberServiceGlobal beginLuminosityBlock " << rng->mySeed() << "\n"; - std::cout << rng->getEngine(lumi.index()).name() << "\n"; + std::cout << "*** TestRandomNumberServiceGlobal beginLuminosityBlock " << rng->mySeed() << " " + << rng->getEngine(lumi.index()).name() << "\n"; } auto lumiCache = std::make_shared(); @@ -352,22 +358,27 @@ TestRandomNumberServiceGlobal::globalBeginLuminosityBlock(edm::LuminosityBlock c long int seedL = static_cast(seed0); if(engineName_ == "HepJamesRandom") { lumiCache->referenceEngine_ = std::shared_ptr(new CLHEP::HepJamesRandom(seedL)); // propagate_const has no reset() function + } else if(engineName_ == "MixMaxRng") { + lumiCache->referenceEngine_ = std::shared_ptr(new CLHEP::MixMaxRng(seedL)); // propagate_const has no reset() function } else { lumiCache->referenceEngine_ = std::shared_ptr(new edm::TRandomAdaptor(seedL)); // propagate_const has no reset() function } } - lumiCache->referenceRandomNumbers_.clear(); - lumiCache->referenceRandomNumbers_.push_back(lumiCache->referenceEngine_->flat()); - lumiCache->referenceRandomNumbers_.push_back(lumiCache->referenceEngine_->flat()); + double y1 = lumiCache->referenceEngine_->flat(); + double y2 = lumiCache->referenceEngine_->flat(); edm::Service rng; CLHEP::HepRandomEngine& engine = rng->getEngine(lumi.index()); + double x1 = engine.flat(); + double x2 = engine.flat(); - if(engine.flat() != lumiCache->referenceRandomNumbers_.at(0) || - engine.flat() != lumiCache->referenceRandomNumbers_.at(1)) { + if(x1 != y1 || x2 != y2) { throw cms::Exception("TestRandomNumberService") - << "TestRandomNumberServiceGlobal::globalBeginLuminosityBlock: Random sequence does not match expected sequence"; + << "TestRandomNumberServiceGlobal::globalBeginLuminosityBlock: " + << " x1= " << x1 << " y1= " << y1 << " x2= " << x2 << " y2= " << y2 << " " + << engine.name() << " " << lumiCache->referenceEngine_->name() + << " seed0= " << seed0 << " nStream= " << nStreams_; } return lumiCache; @@ -404,6 +415,8 @@ TestRandomNumberServiceGlobal::beginStream(edm::StreamID streamID) const { long int seedL = static_cast(seeds_.at(0) + streamID.value() + offset_); if(engineName_ == "HepJamesRandom") { streamCache->referenceEngine_ = std::shared_ptr(new CLHEP::HepJamesRandom(seedL)); // propagate_const has no reset() function + } else if(engineName_ == "MixMaxRng") { + streamCache->referenceEngine_ = std::shared_ptr(new CLHEP::MixMaxRng(seedL)); // propagate_const has no reset() function } else { streamCache->referenceEngine_ = std::shared_ptr(new edm::TRandomAdaptor(seedL)); // propagate_const has no reset() function } diff --git a/IOMC/RandomEngine/test/testMultiStreamReplay1_cfg.py b/IOMC/RandomEngine/test/testMultiStreamReplay1_cfg.py index 4c310771bae46..2c0d3d91da5cc 100644 --- a/IOMC/RandomEngine/test/testMultiStreamReplay1_cfg.py +++ b/IOMC/RandomEngine/test/testMultiStreamReplay1_cfg.py @@ -36,6 +36,10 @@ initialSeed = cms.untracked.uint32(7), engineName = cms.untracked.string('TRandom3') ), + t6 = cms.PSet( + initialSeed = cms.untracked.uint32(7), + engineName = cms.untracked.string('MixMaxRng') + ), enableChecking = cms.untracked.bool(True), verbose = cms.untracked.bool(False), restoreStateTag = cms.untracked.InputTag('randomEngineStateProducer') @@ -73,6 +77,14 @@ nStreams = cms.untracked.uint32(3), multiStreamReplay = cms.untracked.bool(True) ) +process.t6 = cms.EDAnalyzer("TestRandomNumberServiceGlobal", + engineName = cms.untracked.string('MixMaxRng'), + seeds = cms.untracked.vuint32(85), + offset = cms.untracked.uint32(0), + maxEvents = cms.untracked.uint32(5), + nStreams = cms.untracked.uint32(3), + multiStreamReplay = cms.untracked.bool(True) +) process.randomEngineStateProducer2 = cms.EDProducer("RandomEngineStateProducer") @@ -80,5 +92,5 @@ fileName = cms.untracked.string('testMultiStreamReplay1.root') ) -process.p = cms.Path(process.t1+process.t2+process.t3+process.t4+process.randomEngineStateProducer2) +process.p = cms.Path(process.t1+process.t2+process.t3+process.t4+process.t6+process.randomEngineStateProducer2) process.o = cms.EndPath(process.out) diff --git a/IOMC/RandomEngine/test/testMultiStreamReplay2_cfg.py b/IOMC/RandomEngine/test/testMultiStreamReplay2_cfg.py index 09e30fe7274cf..6cadafd1a6a78 100644 --- a/IOMC/RandomEngine/test/testMultiStreamReplay2_cfg.py +++ b/IOMC/RandomEngine/test/testMultiStreamReplay2_cfg.py @@ -24,9 +24,9 @@ engineName = cms.untracked.string('HepJamesRandom'), initialSeed = cms.untracked.uint32(7) ), - t5 = cms.PSet( + t6 = cms.PSet( initialSeed = cms.untracked.uint32(7), - engineName = cms.untracked.string('TRandom3') + engineName = cms.untracked.string('MixMaxRng') ), restoreFileName = cms.untracked.string('StashStateStream.data_2'), enableChecking = cms.untracked.bool(True) @@ -80,6 +80,15 @@ seedByLumi = cms.untracked.vuint32(0, 87, 87, 207, 207), multiStreamReplay = cms.untracked.bool(True) ) +process.t6 = cms.EDAnalyzer("TestRandomNumberServiceGlobal", + engineName = cms.untracked.string('MixMaxRng'), + seeds = cms.untracked.vuint32(85), + offset = cms.untracked.uint32(0), + maxEvents = cms.untracked.uint32(5), + nStreams = cms.untracked.uint32(1), + seedByLumi = cms.untracked.vuint32(0, 88, 88, 208, 208), + multiStreamReplay = cms.untracked.bool(True) +) process.randomEngineStateProducer = cms.EDProducer("RandomEngineStateProducer") @@ -87,5 +96,5 @@ fileName = cms.untracked.string('testMultiStreamReplay2.root') ) -process.p = cms.Path(process.t1+process.t2+process.t3+process.t4+process.randomEngineStateProducer) +process.p = cms.Path(process.t1+process.t2+process.t3+process.t4+process.t6+process.randomEngineStateProducer) process.o = cms.EndPath(process.out) diff --git a/IOMC/RandomEngine/test/testMultiStream_cfg.py b/IOMC/RandomEngine/test/testMultiStream_cfg.py index c4908b9c87b6e..583d46a2ae2c6 100644 --- a/IOMC/RandomEngine/test/testMultiStream_cfg.py +++ b/IOMC/RandomEngine/test/testMultiStream_cfg.py @@ -26,9 +26,9 @@ engineName = cms.untracked.string('HepJamesRandom'), initialSeed = cms.untracked.uint32(84) ), - t5 = cms.PSet( - initialSeed = cms.untracked.uint32(191), - engineName = cms.untracked.string('TRandom3') + t6 = cms.PSet( + initialSeed = cms.untracked.uint32(85), + engineName = cms.untracked.string('MixMaxRng') ), enableChecking = cms.untracked.bool(True), verbose = cms.untracked.bool(True) @@ -74,6 +74,13 @@ maxEvents = cms.untracked.uint32(5), nStreams = cms.untracked.uint32(3) ) +process.t6 = cms.EDAnalyzer("TestRandomNumberServiceGlobal", + engineName = cms.untracked.string('MixMaxRng'), + seeds = cms.untracked.vuint32(85), + offset = cms.untracked.uint32(0), + maxEvents = cms.untracked.uint32(5), + nStreams = cms.untracked.uint32(3) +) process.randomEngineStateProducer = cms.EDProducer("RandomEngineStateProducer") @@ -81,5 +88,5 @@ fileName = cms.untracked.string('testMultiStream.root') ) -process.p = cms.Path(process.t1+process.t2+process.t3+process.t4+process.randomEngineStateProducer) +process.p = cms.Path(process.t1+process.t2+process.t3+process.t4+process.t6+process.randomEngineStateProducer) process.o = cms.EndPath(process.out) diff --git a/IOMC/RandomEngine/test/testRandomService.sh b/IOMC/RandomEngine/test/testRandomService.sh index 31c9678c521b7..0282ffb898a0b 100755 --- a/IOMC/RandomEngine/test/testRandomService.sh +++ b/IOMC/RandomEngine/test/testRandomService.sh @@ -16,11 +16,13 @@ pushd ${LOCAL_TMP_DIR} mv testRandomService_0_t2.txt testRandomService1_0_t2.txt mv testRandomService_0_t3.txt testRandomService1_0_t3.txt mv testRandomService_0_t4.txt testRandomService1_0_t4.txt + mv testRandomService_0_t6.txt testRandomService1_0_t6.txt diff ${LOCAL_TEST_DIR}/unit_test_outputs/testRandomService1_0_t1.txt testRandomService1_0_t1.txt || die "comparing testRandomService1_0_t1.txt" $? diff ${LOCAL_TEST_DIR}/unit_test_outputs/testRandomService1_0_t2.txt testRandomService1_0_t2.txt || die "comparing testRandomService1_0_t2.txt" $? diff ${LOCAL_TEST_DIR}/unit_test_outputs/testRandomService1_0_t3.txt testRandomService1_0_t3.txt || die "comparing testRandomService1_0_t3.txt" $? diff ${LOCAL_TEST_DIR}/unit_test_outputs/testRandomService1_0_t4.txt testRandomService1_0_t4.txt || die "comparing testRandomService1_0_t4.txt" $? + diff ${LOCAL_TEST_DIR}/unit_test_outputs/testRandomService1_0_t6.txt testRandomService1_0_t6.txt || die "comparing testRandomService1_0_t6.txt" $? echo " " echo "RandomNumberGeneratorService 2" diff --git a/IOMC/RandomEngine/test/testRandomService1_cfg.py b/IOMC/RandomEngine/test/testRandomService1_cfg.py index e4083feab8fb5..f2545a6768731 100644 --- a/IOMC/RandomEngine/test/testRandomService1_cfg.py +++ b/IOMC/RandomEngine/test/testRandomService1_cfg.py @@ -57,9 +57,9 @@ engineName = cms.untracked.string('HepJamesRandom'), initialSeed = cms.untracked.uint32(84) ), - t5 = cms.PSet( - initialSeed = cms.untracked.uint32(191), - engineName = cms.untracked.string('TRandom3') + t6 = cms.PSet( + initialSeed = cms.untracked.uint32(85), + engineName = cms.untracked.string('MixMaxRng') ), enableChecking = cms.untracked.bool(True), verbose = cms.untracked.bool(True) @@ -86,6 +86,7 @@ seeds = cms.untracked.vuint32(81), offset = cms.untracked.uint32(0), maxEvents = cms.untracked.uint32(5), + dump = cms.untracked.bool(True), nStreams = cms.untracked.uint32(1) ) process.t2 = cms.EDAnalyzer("TestRandomNumberServiceGlobal", @@ -93,6 +94,7 @@ seeds = cms.untracked.vuint32(1, 2), offset = cms.untracked.uint32(0), maxEvents = cms.untracked.uint32(5), + dump = cms.untracked.bool(True), nStreams = cms.untracked.uint32(1) ) process.t3 = cms.EDAnalyzer("TestRandomNumberServiceGlobal", @@ -111,6 +113,16 @@ seeds = cms.untracked.vuint32(84), offset = cms.untracked.uint32(0), maxEvents = cms.untracked.uint32(5), + dump = cms.untracked.bool(True), + nStreams = cms.untracked.uint32(1) +) + +process.t6 = cms.EDAnalyzer("TestRandomNumberServiceGlobal", + engineName = cms.untracked.string('MixMaxRng'), + seeds = cms.untracked.vuint32(85), + offset = cms.untracked.uint32(0), + maxEvents = cms.untracked.uint32(5), + dump = cms.untracked.bool(True), nStreams = cms.untracked.uint32(1) ) @@ -126,5 +138,5 @@ fileName = cms.untracked.string('testRandomService1.root') ) -process.p = cms.Path(process.t1+process.t2+process.t3+process.t4+process.randomEngineStateProducer) +process.p = cms.Path(process.t1+process.t2+process.t3+process.t4+process.t6+process.randomEngineStateProducer) process.o = cms.EndPath(process.out) diff --git a/IOMC/RandomEngine/test/testRandomService2_cfg.py b/IOMC/RandomEngine/test/testRandomService2_cfg.py index 2d97948807a52..2a2cefae7d14e 100644 --- a/IOMC/RandomEngine/test/testRandomService2_cfg.py +++ b/IOMC/RandomEngine/test/testRandomService2_cfg.py @@ -25,9 +25,9 @@ engineName = cms.untracked.string('HepJamesRandom'), initialSeed = cms.untracked.uint32(204) ), - t5 = cms.PSet( + t6 = cms.PSet( initialSeed = cms.untracked.uint32(205), - engineName = cms.untracked.string('TRandom3') + engineName = cms.untracked.string('MixMaxRng') ), enableChecking = cms.untracked.bool(True), verbose = cms.untracked.bool(False) @@ -73,6 +73,13 @@ maxEvents = cms.untracked.uint32(5), nStreams = cms.untracked.uint32(1) ) +process.t6 = cms.EDAnalyzer("TestRandomNumberServiceGlobal", + engineName = cms.untracked.string('MixMaxRng'), + seeds = cms.untracked.vuint32(205), + offset = cms.untracked.uint32(0), + maxEvents = cms.untracked.uint32(5), + nStreams = cms.untracked.uint32(1) +) process.randomEngineStateProducer = cms.EDProducer("RandomEngineStateProducer") @@ -80,5 +87,5 @@ fileName = cms.untracked.string('testRandomService2.root') ) -process.p = cms.Path(process.t1+process.t2+process.t3+process.t4+process.randomEngineStateProducer) +process.p = cms.Path(process.t1+process.t2+process.t3+process.t4+process.t6+process.randomEngineStateProducer) process.o = cms.EndPath(process.out) diff --git a/IOMC/RandomEngine/test/testRandomService3_cfg.py b/IOMC/RandomEngine/test/testRandomService3_cfg.py index 88d7e2335d8c6..59c95895c39f7 100644 --- a/IOMC/RandomEngine/test/testRandomService3_cfg.py +++ b/IOMC/RandomEngine/test/testRandomService3_cfg.py @@ -23,9 +23,9 @@ engineName = cms.untracked.string('HepJamesRandom'), initialSeed = cms.untracked.uint32(84) ), - t5 = cms.PSet( - initialSeed = cms.untracked.uint32(191), - engineName = cms.untracked.string('TRandom3') + t6 = cms.PSet( + initialSeed = cms.untracked.uint32(85), + engineName = cms.untracked.string('MixMaxRng') ), saveFileName = cms.untracked.string('StashState3.data'), enableChecking = cms.untracked.bool(True), @@ -72,6 +72,13 @@ maxEvents = cms.untracked.uint32(5), nStreams = cms.untracked.uint32(1) ) +process.t6 = cms.EDAnalyzer("TestRandomNumberServiceGlobal", + engineName = cms.untracked.string('MixMaxRng'), + seeds = cms.untracked.vuint32(85), + offset = cms.untracked.uint32(2), + maxEvents = cms.untracked.uint32(5), + nStreams = cms.untracked.uint32(1) +) process.randomEngineStateProducer = cms.EDProducer("RandomEngineStateProducer") @@ -79,5 +86,5 @@ fileName = cms.untracked.string('testRandomService3.root') ) -process.p = cms.Path(process.t1+process.t2+process.t3+process.t4+process.randomEngineStateProducer) +process.p = cms.Path(process.t1+process.t2+process.t3+process.t4+process.t6+process.randomEngineStateProducer) process.o = cms.EndPath(process.out) diff --git a/IOMC/RandomEngine/test/testRandomServiceTest1_cfg.py b/IOMC/RandomEngine/test/testRandomServiceTest1_cfg.py index 15df242c829c6..44d8de5da1a16 100644 --- a/IOMC/RandomEngine/test/testRandomServiceTest1_cfg.py +++ b/IOMC/RandomEngine/test/testRandomServiceTest1_cfg.py @@ -34,9 +34,9 @@ engineName = cms.untracked.string('HepJamesRandom'), initialSeed = cms.untracked.uint32(7) ), - t5 = cms.PSet( + t6 = cms.PSet( initialSeed = cms.untracked.uint32(7), - engineName = cms.untracked.string('TRandom3') + engineName = cms.untracked.string('MixMaxRng') ), enableChecking = cms.untracked.bool(True), restoreStateLabel = cms.untracked.string('randomEngineStateProducer') @@ -78,6 +78,15 @@ skippedEvents = cms.untracked.vuint32(2), seedByLumi = cms.untracked.vuint32(0, 85, 85, 205, 205) ) +process.t6 = cms.EDAnalyzer("TestRandomNumberServiceGlobal", + engineName = cms.untracked.string('MixMaxRng'), + seeds = cms.untracked.vuint32(85), + offset = cms.untracked.uint32(0), + maxEvents = cms.untracked.uint32(15), + nStreams = cms.untracked.uint32(1), + skippedEvents = cms.untracked.vuint32(2), + seedByLumi = cms.untracked.vuint32(0, 86, 86, 206, 206) +) process.p = cms.Path(process.t1+process.t2+process.t3+process.t4) process.o = cms.EndPath(process.out) diff --git a/IOMC/RandomEngine/test/unit_test_outputs/child0FirstEvent.txt b/IOMC/RandomEngine/test/unit_test_outputs/child0FirstEvent.txt index f07eb61599126..9b0124c0250df 100644 --- a/IOMC/RandomEngine/test/unit_test_outputs/child0FirstEvent.txt +++ b/IOMC/RandomEngine/test/unit_test_outputs/child0FirstEvent.txt @@ -2,3 +2,4 @@ t1 Event random numbers 0.422889 0.0392907 0.291227 1.61244 Lumi random numbers t2 Event random numbers 0.999981 0.203459 0.668007 7.73632 Lumi random numbers 3.66345e-05 0.440199 0.548889 t3 Event random numbers 0.257042 0.565658 0.683788 1.8103 Lumi random numbers 0.202607 0.993071 0.207093 t4 Event random numbers 0.133504 0.85941 0.256103 11.7224 Lumi random numbers 0.00202554 0.718933 0.136718 +t6 Event random numbers 0.0298122 0.993504 0.26053 4.79664 Lumi random numbers 0.473693 0.743566 0.931702 diff --git a/IOMC/RandomEngine/test/unit_test_outputs/child1FirstEvent.txt b/IOMC/RandomEngine/test/unit_test_outputs/child1FirstEvent.txt index f63ba874eeeb8..1efb3d0973aef 100644 --- a/IOMC/RandomEngine/test/unit_test_outputs/child1FirstEvent.txt +++ b/IOMC/RandomEngine/test/unit_test_outputs/child1FirstEvent.txt @@ -2,3 +2,4 @@ t1 Event random numbers 0.616179 0.838397 0.174838 12.6847 Lumi random numbers 0 t2 Event random numbers 0.999999 0.949039 0.294968 4.06209 Lumi random numbers 3.66345e-05 0.440199 0.548889 t3 Event random numbers 0.046041 0.56008 0.370242 7.37113 Lumi random numbers 0.202607 0.993071 0.207093 t4 Event random numbers 0.425331 0.542731 0.653642 8.09904 Lumi random numbers 0.00202554 0.718933 0.136718 +t6 Event random numbers 0.187911 0.0321131 0.896756 3.93939 Lumi random numbers 0.473693 0.743566 0.931702 diff --git a/IOMC/RandomEngine/test/unit_test_outputs/testMultiStreamDump.txt b/IOMC/RandomEngine/test/unit_test_outputs/testMultiStreamDump.txt index 325b28ead0077..af396cbdeab39 100644 --- a/IOMC/RandomEngine/test/unit_test_outputs/testMultiStreamDump.txt +++ b/IOMC/RandomEngine/test/unit_test_outputs/testMultiStreamDump.txt @@ -7,7 +7,7 @@ RandomNumberGeneratorService dump t2 5 RanecuEngine 1 2 t3 6 TRandom3 83 t4 7 HepJamesRandom 84 - t5 4294967295 TRandom3 191 + t6 8 MixMaxRng 85 nStreams_ = 3 saveFileName_ = StashStateStream.data saveFileNameRecorded_ = 0 @@ -24,16 +24,19 @@ RandomNumberGeneratorService dump t2 1 2 RanecuEngine engine does not know seeds t3 83 TRandom3 engine does not know seeds t4 84 HepJamesRandom 84 + t6 85 MixMaxRng 85 Stream 1 t1 82 HepJamesRandom 82 t2 2 2 RanecuEngine engine does not know seeds t3 84 TRandom3 engine does not know seeds t4 85 HepJamesRandom 85 + t6 86 MixMaxRng 86 Stream 2 t1 83 HepJamesRandom 83 t2 3 2 RanecuEngine engine does not know seeds t3 85 TRandom3 engine does not know seeds t4 86 HepJamesRandom 86 + t6 87 MixMaxRng 87 lumiEngines_ lumiIndex 0 @@ -41,3 +44,4 @@ RandomNumberGeneratorService dump t2 4 2 RanecuEngine engine does not know seeds t3 86 TRandom3 engine does not know seeds t4 87 HepJamesRandom 87 + t6 88 MixMaxRng 88 diff --git a/IOMC/RandomEngine/test/unit_test_outputs/testRandomService1Dump.txt b/IOMC/RandomEngine/test/unit_test_outputs/testRandomService1Dump.txt index 13becb18ce11d..5637951fbf9e6 100644 --- a/IOMC/RandomEngine/test/unit_test_outputs/testRandomService1Dump.txt +++ b/IOMC/RandomEngine/test/unit_test_outputs/testRandomService1Dump.txt @@ -7,7 +7,7 @@ RandomNumberGeneratorService dump t2 5 RanecuEngine 1 2 t3 6 TRandom3 83 t4 7 HepJamesRandom 84 - t5 4294967295 TRandom3 191 + t6 8 MixMaxRng 85 nStreams_ = 1 saveFileName_ = StashState1.data saveFileNameRecorded_ = 0 @@ -24,6 +24,7 @@ RandomNumberGeneratorService dump t2 1 2 RanecuEngine engine does not know seeds t3 83 TRandom3 engine does not know seeds t4 84 HepJamesRandom 84 + t6 85 MixMaxRng 85 lumiEngines_ lumiIndex 0 @@ -31,17 +32,64 @@ RandomNumberGeneratorService dump t2 2 2 RanecuEngine engine does not know seeds t3 84 TRandom3 engine does not know seeds t4 85 HepJamesRandom 85 -*** TestRandomNumberServiceGlobal beginLuminosityBlock 83 -TRandom3 -*** TestRandomNumberServiceGlobal analyze 83 -TRandom3 -*** TestRandomNumberServiceGlobal analyze 83 -TRandom3 -*** TestRandomNumberServiceGlobal analyze 83 -TRandom3 -*** TestRandomNumberServiceGlobal beginLuminosityBlock 83 -TRandom3 -*** TestRandomNumberServiceGlobal analyze 83 -TRandom3 -*** TestRandomNumberServiceGlobal analyze 83 -TRandom3 + t6 86 MixMaxRng 86 +*** TestRandomNumberServiceGlobal beginLuminosityBlock 81 HepJamesRandom +*** TestRandomNumberServiceGlobal beginLuminosityBlock 1 RanecuEngine +*** TestRandomNumberServiceGlobal beginLuminosityBlock 83 TRandom3 +*** TestRandomNumberServiceGlobal beginLuminosityBlock 84 HepJamesRandom +*** TestRandomNumberServiceGlobal beginLuminosityBlock 85 MixMaxRng +*** TestRandomNumberServiceGlobal analyze 81 HepJamesRandom streamID= 0 multiStreamReplay: 0 + HepJamesRandom 0.422889 0.0392907 0.291227 1.61244 +*** TestRandomNumberServiceGlobal analyze 1 RanecuEngine streamID= 0 multiStreamReplay: 0 + RanecuEngine 0.999981 0.203459 0.668007 7.73632 +*** TestRandomNumberServiceGlobal analyze 83 TRandom3 streamID= 0 multiStreamReplay: 0 + TRandom3 0.257042 0.565658 0.683788 1.8103 +*** TestRandomNumberServiceGlobal analyze 84 HepJamesRandom streamID= 0 multiStreamReplay: 0 + HepJamesRandom 0.133504 0.85941 0.256103 11.7224 +*** TestRandomNumberServiceGlobal analyze 85 MixMaxRng streamID= 0 multiStreamReplay: 0 + MixMaxRng 0.0298122 0.993504 0.26053 4.79664 +*** TestRandomNumberServiceGlobal analyze 81 HepJamesRandom streamID= 0 multiStreamReplay: 0 + HepJamesRandom 0.0841909 0.01745 0.285556 0.631759 +*** TestRandomNumberServiceGlobal analyze 1 RanecuEngine streamID= 0 multiStreamReplay: 0 + RanecuEngine 0.732909 0.332698 0.415352 1.74366 +*** TestRandomNumberServiceGlobal analyze 83 TRandom3 streamID= 0 multiStreamReplay: 0 + TRandom3 0.663642 0.906853 0.77713 12.956 +*** TestRandomNumberServiceGlobal analyze 84 HepJamesRandom streamID= 0 multiStreamReplay: 0 + HepJamesRandom 0.0839297 0.889512 0.0493518 2.83357 +*** TestRandomNumberServiceGlobal analyze 85 MixMaxRng streamID= 0 multiStreamReplay: 0 + MixMaxRng 0.317751 0.300103 0.873082 0.816035 +*** TestRandomNumberServiceGlobal analyze 81 HepJamesRandom streamID= 0 multiStreamReplay: 0 + HepJamesRandom 0.225607 0.569195 0.116241 13.8232 +*** TestRandomNumberServiceGlobal analyze 1 RanecuEngine streamID= 0 multiStreamReplay: 0 + RanecuEngine 0.541681 0.544943 0.4229 14.5781 +*** TestRandomNumberServiceGlobal analyze 83 TRandom3 streamID= 0 multiStreamReplay: 0 + TRandom3 0.827367 0.0782056 0.356684 9.52653 +*** TestRandomNumberServiceGlobal analyze 84 HepJamesRandom streamID= 0 multiStreamReplay: 0 + HepJamesRandom 0.68063 0.298945 0.848839 19.9464 +*** TestRandomNumberServiceGlobal analyze 85 MixMaxRng streamID= 0 multiStreamReplay: 0 + MixMaxRng 0.192687 0.539452 0.751037 7.65776 +*** TestRandomNumberServiceGlobal beginLuminosityBlock 81 HepJamesRandom +*** TestRandomNumberServiceGlobal beginLuminosityBlock 1 RanecuEngine +*** TestRandomNumberServiceGlobal beginLuminosityBlock 83 TRandom3 +*** TestRandomNumberServiceGlobal beginLuminosityBlock 84 HepJamesRandom +*** TestRandomNumberServiceGlobal beginLuminosityBlock 85 MixMaxRng +*** TestRandomNumberServiceGlobal analyze 81 HepJamesRandom streamID= 0 multiStreamReplay: 0 + HepJamesRandom 0.609341 0.532968 0.251729 45.3539 +*** TestRandomNumberServiceGlobal analyze 1 RanecuEngine streamID= 0 multiStreamReplay: 0 + RanecuEngine 0.975133 0.170844 0.312642 6.13623 +*** TestRandomNumberServiceGlobal analyze 83 TRandom3 streamID= 0 multiStreamReplay: 0 + TRandom3 0.386736 0.214575 0.743409 5.0411 +*** TestRandomNumberServiceGlobal analyze 84 HepJamesRandom streamID= 0 multiStreamReplay: 0 + HepJamesRandom 0.0809463 0.147144 0.346757 18.3554 +*** TestRandomNumberServiceGlobal analyze 85 MixMaxRng streamID= 0 multiStreamReplay: 0 + MixMaxRng 0.749048 0.0460058 0.216306 7.5557 +*** TestRandomNumberServiceGlobal analyze 81 HepJamesRandom streamID= 0 multiStreamReplay: 0 + HepJamesRandom 0.444845 0.317331 0.0381796 14.6314 +*** TestRandomNumberServiceGlobal analyze 1 RanecuEngine streamID= 0 multiStreamReplay: 0 + RanecuEngine 0.176497 0.710599 0.884126 2.34164 +*** TestRandomNumberServiceGlobal analyze 83 TRandom3 streamID= 0 multiStreamReplay: 0 + TRandom3 0.282541 0.00410514 0.294077 38.9648 +*** TestRandomNumberServiceGlobal analyze 84 HepJamesRandom streamID= 0 multiStreamReplay: 0 + HepJamesRandom 0.793322 0.157134 0.376794 5.68684 +*** TestRandomNumberServiceGlobal analyze 85 MixMaxRng streamID= 0 multiStreamReplay: 0 + MixMaxRng 0.780203 0.707089 0.09847 5.5464 diff --git a/IOMC/RandomEngine/test/unit_test_outputs/testRandomService1_0_t6.txt b/IOMC/RandomEngine/test/unit_test_outputs/testRandomService1_0_t6.txt new file mode 100644 index 0000000000000..3cffd48528d91 --- /dev/null +++ b/IOMC/RandomEngine/test/unit_test_outputs/testRandomService1_0_t6.txt @@ -0,0 +1,25 @@ +85 +0.0298122 +0.993504 +0.26053 +4.79664 +85 +0.317751 +0.300103 +0.873082 +0.816035 +85 +0.192687 +0.539452 +0.751037 +7.65776 +85 +0.749048 +0.0460058 +0.216306 +7.5557 +85 +0.780203 +0.707089 +0.09847 +5.5464