13 if (ps.
exists(
"RandomizedParameters")) {
14 std::vector<edm::ParameterSet> randomizedParameters =
15 ps.
getParameter<std::vector<edm::ParameterSet> >(
"RandomizedParameters");
19 for (
unsigned int irand = 0; irand < randomizedParameters.size(); ++irand) {
20 randomInitWeights_[irand] = randomizedParameters[irand].getParameter<
double>(
"ConfigWeight");
21 if (randomizedParameters[irand].exists(
"ConfigDescription")) {
23 randomizedParameters[irand].getParameter<
std::string>(
"ConfigDescription");
25 if (randomizedParameters[irand].exists(
"GridpackPath")) {
30 if (ps.
exists(
"GridpackPath")) {
58 std::vector<long unsigned int>
seeds = rengine->put();
60 seeds.push_back(
lumi.id().luminosityBlock());
61 std::seed_seq seedseq(
seeds.begin(),
seeds.end());
62 std::mt19937 randgen(seedseq);
70 CLHEP::HepRandomEngine* rengine,
78 std::vector<long unsigned int>
seeds = rengine->put();
80 seeds.push_back(
lumi.id().luminosityBlock());
81 std::seed_seq seedseq(
seeds.begin(),
seeds.end());
82 std::array<unsigned int, 1> lheseed;
83 seedseq.generate(lheseed.begin(), lheseed.end());
85 constexpr
unsigned int maxseed = 30081 * 30081;
86 unsigned int seedval = lheseed[0] % (maxseed + 1);
90 ->getParameter<edm::ParameterSet>(
"@main_input")
91 .getUntrackedParameter<
unsigned int>(
"numberEventsInLuminosityBlock");
93 std::ostringstream nevStream;
96 std::ostringstream randomStream;
97 randomStream << seedval;
99 edm::FileInPath script(
"GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh");
102 std::array<std::string, 5> argStrs;
105 argStrs[2] = nevStream.str();
106 argStrs[3] = randomStream.str();
107 argStrs[4] = std::to_string(ncpu);
108 std::array<char*, 6>
args{
109 {&argStrs[0][0], &argStrs[1][0], &argStrs[2][0], &argStrs[3][0], &argStrs[4][0],
nullptr}};
115 throw cms::Exception(
"BaseHadronizer::generateLHE") <<
"Unable to fork a child";
116 }
else if (pid == 0) {
125 throw cms::Exception(
"BaseHadronizer::generateLHE") <<
"Failed to execute script";