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;
102 std::array<std::string, 5> argStrs;
103 argStrs[0] =
script.fullPath();
105 argStrs[2] = nevStream.str();
106 argStrs[3] = randomStream.str();
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";
T getParameter(std::string const &) const
std::vector< double > randomInitWeights_
void generateLHE(edm::LuminosityBlock const &lumi, CLHEP::HepRandomEngine *rengine, unsigned int ncpu)
bool getMapped(key_type const &k, value_type &result) const
const std::string & randomInitConfigDescription() const
virtual std::unique_ptr< GenLumiInfoHeader > getGenLumiInfoHeader() const
void setFilterEfficiency(double effic)
BaseHadronizer(edm::ParameterSet const &ps)
const std::string & gridpackPath() const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::string to_string(const V &value)
T getUntrackedParameter(std::string const &, T const &) const
void randomizeIndex(edm::LuminosityBlock const &lumi, CLHEP::HepRandomEngine *rengine)
GenRunInfoProduct & runInfo()
std::vector< std::string > gridpackPaths_
std::vector< std::string > randomInitConfigDescriptions_
def remove(d, key, TELL=False)
void setExternalXSecNLO(const XSec &xsec)
void setExternalXSecLO(const XSec &xsec)
static const std::vector< std::string > theSharedResources
static Registry * instance()