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")) {
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");
105 const char *outfilename =
"cmsgrid_final.lhe";
109 std::array<std::string,5> argStrs;
112 argStrs[2]=nevStream.str();
113 argStrs[3]=randomStream.str();
114 argStrs[4]=std::to_string(ncpu);
115 std::array<char*,6>
args{ { &argStrs[0][0], &argStrs[1][0],&argStrs[2][0],&argStrs[3][0], &argStrs[4][0],
nullptr } };
121 throw cms::Exception(
"BaseHadronizer::generateLHE") <<
"Unable to fork a child";
131 waitpid(pid, &status, 0);
133 throw cms::Exception(
"BaseHadronizer::generateLHE") <<
"Failed to execute script";
136 FILE*
lhef = std::fopen(outfilename,
"r");
138 throw cms::Exception(
"BaseHadronizer::generateLHE") <<
"Output file " << outfilename <<
" not found.";
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 generateLHE(edm::LuminosityBlock const &lumi, CLHEP::HepRandomEngine *rengine, unsigned int ncpu)
void setFilterEfficiency(double effic)
BaseHadronizer(edm::ParameterSet const &ps)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
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
def remove(d, key, TELL=False)
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