17 if (ps.
exists(
"RandomizedParameters")) {
18 std::vector<edm::ParameterSet> randomizedParameters = ps.
getParameter<std::vector<edm::ParameterSet> >(
"RandomizedParameters");
22 for (
unsigned int irand = 0; irand<randomizedParameters.size(); ++irand) {
23 randomInitWeights_[irand] = randomizedParameters[irand].getParameter<
double>(
"ConfigWeight");
24 if (randomizedParameters[irand].exists(
"ConfigDescription")) {
27 if (randomizedParameters[irand].exists(
"GridpackPath")) {
33 if (ps.
exists(
"GridpackPath")) {
57 return genLumiInfoHeader;
67 std::vector<long unsigned int> seeds = rengine->put();
68 seeds.push_back(lumi.
id().
run());
70 std::seed_seq seedseq(seeds.begin(),seeds.end());
71 std::mt19937 randgen(seedseq);
86 std::vector<long unsigned int> seeds = rengine->put();
87 seeds.push_back(lumi.
id().
run());
89 std::seed_seq seedseq(seeds.begin(),seeds.end());
90 std::array<unsigned int,1> lheseed;
91 seedseq.generate(lheseed.begin(),lheseed.end());
93 constexpr unsigned int maxseed = 30081*30081;
94 unsigned int seedval = lheseed[0]%(maxseed+1);
98 std::ostringstream nevStream;
101 std::ostringstream randomStream;
102 randomStream << seedval;
104 edm::FileInPath script(
"GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh");
108 args[0] = strdup(script.
fullPath().c_str());
110 args[2] = strdup(nevStream.str().c_str());
111 args[3] = strdup(randomStream.str().c_str());
118 throw cms::Exception(
"BaseHadronizer::generateLHE") <<
"Unable to fork a child";
122 execvp(args[0],args);
128 waitpid(pid, &status, 0);
130 throw cms::Exception(
"BaseHadronizer::generateLHE") <<
"Failed to execute script";
133 FILE* lhef = std::fopen(outfilename,
"r");
135 throw cms::Exception(
"BaseHadronizer::generateLHE") <<
"Output file " << outfilename <<
" not found.";
141 for (
int iarg=0; iarg<4; ++iarg) {
const_reverse_iterator rbegin() const
LuminosityBlockID id() const
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< double > randomInitWeights_
void setFilterEfficiency(double effic)
BaseHadronizer(edm::ParameterSet const &ps)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
void generateLHE(edm::LuminosityBlock const &lumi, CLHEP::HepRandomEngine *rengine)
void randomizeIndex(edm::LuminosityBlock const &lumi, CLHEP::HepRandomEngine *rengine)
GenRunInfoProduct & runInfo()
ProcessHistory const & processHistory() const
const std::string & randomInitConfigDescription() const
bool getMapped(key_type const &k, value_type &result) const
std::vector< std::string > gridpackPaths_
std::vector< std::string > randomInitConfigDescriptions_
LuminosityBlockNumber_t luminosityBlock() const
const std::string & gridpackPath() const
std::string fullPath() const
void setExternalXSecNLO(const XSec &xsec)
void setExternalXSecLO(const XSec &xsec)
static const std::vector< std::string > theSharedResources
static Registry * instance()
virtual GenLumiInfoHeader * getGenLumiInfoHeader() const