CMS 3D CMS Logo

ExternalLHEProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: ExternalLHEProducer
4 // Class: ExternalLHEProducer
5 //
13 //
14 // Original Author: Brian Paul Bockelman,8 R-018,+41227670861,
15 // Created: Fri Oct 21 11:37:26 CEST 2011
16 //
17 //
18 
19 
20 // system include files
21 #include <cstdio>
22 #include <cstdlib>
23 #include <memory>
24 #include <vector>
25 #include <string>
26 #include <fstream>
27 #include "boost/filesystem.hpp"
28 #include <unistd.h>
29 #include <dirent.h>
30 #include <fcntl.h>
31 #include <sys/wait.h>
32 #include <sys/time.h>
33 #include <sys/resource.h>
34 #include "tbb/task_arena.h"
35 
36 
37 #include "boost/bind.hpp"
38 #include "boost/shared_ptr.hpp"
39 #include "boost/ptr_container/ptr_deque.hpp"
40 
41 // user include files
45 
49 
51 
54 
59 
63 
66 
68 
69 //
70 // class declaration
71 //
72 
73 class ExternalLHEProducer : public edm::one::EDProducer<edm::BeginRunProducer,
74  edm::EndRunProducer> {
75 public:
76  explicit ExternalLHEProducer(const edm::ParameterSet& iConfig);
77 
78  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
79 
80 private:
81 
82  void produce(edm::Event&, const edm::EventSetup&) override;
83  void beginRunProduce(edm::Run& run, edm::EventSetup const& es) override;
84  void endRunProduce(edm::Run&, edm::EventSetup const&) override;
85  void preallocThreads(unsigned int) override;
86 
87  std::vector<std::string> makeArgs(uint32_t nEvents, unsigned int nThreads, std::uint32_t seed) const;
88  int closeDescriptors(int preserve) const;
89  void executeScript(std::vector<std::string> const& args, int id, bool isPost) const;
90 
91  void nextEvent();
92 
93  // ----------member data ---------------------------
96  const std::vector<std::string> args_;
97  uint32_t npars_;
98  uint32_t nEvents_;
99  bool storeXML_;
100  unsigned int nThreads_{1};
103  const std::vector<std::string> postGenerationCommand_;
104 
105  // Used only if nPartonMapping is in the configuration
106  std::map<unsigned, std::pair<unsigned, unsigned>> nPartonMapping_{};
107 
108  std::unique_ptr<lhef::LHEReader> reader_;
109  std::shared_ptr<lhef::LHERunInfo> runInfoLast_;
110  std::shared_ptr<lhef::LHERunInfo> runInfo_;
111  std::shared_ptr<lhef::LHEEvent> partonLevel_;
112  boost::ptr_deque<LHERunInfoProduct> runInfoProducts_;
113  bool wasMerged;
114 
115  class FileCloseSentry : private boost::noncopyable {
116  public:
117  explicit FileCloseSentry(int fd) : fd_(fd) {};
118 
120  close(fd_);
121  }
122  private:
123  int fd_;
124  };
125 
126 };
127 
128 //
129 // constructors and destructor
130 //
132  scriptName_((iConfig.getParameter<edm::FileInPath>("scriptName")).fullPath()),
133  outputFile_(iConfig.getParameter<std::string>("outputFile")),
134  args_(iConfig.getParameter<std::vector<std::string> >("args")),
135  npars_(iConfig.getParameter<uint32_t>("numberOfParameters")),
136  nEvents_(iConfig.getUntrackedParameter<uint32_t>("nEvents")),
137  storeXML_(iConfig.getUntrackedParameter<bool>("storeXML")),
138  generateConcurrently_(iConfig.getUntrackedParameter<bool>("generateConcurrently")),
139  postGenerationCommand_(iConfig.getUntrackedParameter<std::vector<std::string>>("postGenerationCommand"))
140 {
141  if (npars_ != args_.size())
142  throw cms::Exception("ExternalLHEProducer") << "Problem with configuration: " << args_.size() << " script arguments given, expected " << npars_;
143 
144  if (iConfig.exists("nPartonMapping")) {
145  auto& processMap(iConfig.getParameterSetVector("nPartonMapping"));
146  for (auto& cfg : processMap) {
147  unsigned processId(cfg.getParameter<unsigned>("idprup"));
148 
149  auto orderStr(cfg.getParameter<std::string>("order"));
150  unsigned order(0);
151  if (orderStr == "LO")
152  order = 0;
153  else if (orderStr == "NLO")
154  order = 1;
155  else
156  throw cms::Exception("ExternalLHEProducer") << "Invalid order specification for process " << processId << ": " << orderStr;
157 
158  unsigned np(cfg.getParameter<unsigned>("np"));
159 
160  nPartonMapping_.emplace(processId, std::make_pair(order, np));
161  }
162  }
163 
164  produces<LHEXMLStringProduct, edm::Transition::BeginRun>("LHEScriptOutput");
165 
166  produces<LHEEventProduct>();
167  produces<LHERunInfoProduct, edm::Transition::BeginRun>();
168  produces<LHERunInfoProduct, edm::Transition::EndRun>();
169 }
170 
171 
172 //
173 // member functions
174 //
175 
176 // ------------ method called with number of threads in job --
177 void
179 {
180  nThreads_ = iThreads;
181 }
182 
183 // ------------ method called to produce the data ------------
184 void
186 {
187  nextEvent();
188  if (!partonLevel_) {
189  throw edm::Exception(edm::errors::EventGenerationFailure) << "No lhe event found in ExternalLHEProducer::produce(). "
190  << "The likely cause is that the lhe file contains fewer events than were requested, which is possible "
191  << "in case of phase space integration or uneweighting efficiency problems.";
192  }
193 
194  std::unique_ptr<LHEEventProduct> product(
195  new LHEEventProduct(*partonLevel_->getHEPEUP(),
196  partonLevel_->originalXWGTUP())
197  );
198  if (partonLevel_->getPDF()) {
199  product->setPDF(*partonLevel_->getPDF());
200  }
201  std::for_each(partonLevel_->weights().begin(),
202  partonLevel_->weights().end(),
203  boost::bind(&LHEEventProduct::addWeight,
204  product.get(), _1));
205  product->setScales(partonLevel_->scales());
206  if (nPartonMapping_.empty()) {
207  product->setNpLO(partonLevel_->npLO());
208  product->setNpNLO(partonLevel_->npNLO());
209  }
210  else {
211  // overwrite npLO and npNLO values by user-specified mapping
212  unsigned processId(partonLevel_->getHEPEUP()->IDPRUP);
213  unsigned order(0);
214  unsigned np(0);
215  try {
216  auto procDef(nPartonMapping_.at(processId));
217  order = procDef.first;
218  np = procDef.second;
219  }
220  catch (std::out_of_range&) {
221  throw cms::Exception("ExternalLHEProducer") << "Unexpected IDPRUP encountered: " << partonLevel_->getHEPEUP()->IDPRUP;
222  }
223 
224  switch (order) {
225  case 0:
226  product->setNpLO(np);
227  product->setNpNLO(-1);
228  break;
229  case 1:
230  product->setNpLO(-1);
231  product->setNpNLO(np);
232  break;
233  default:
234  break;
235  }
236  }
237 
238  std::for_each(partonLevel_->getComments().begin(),
239  partonLevel_->getComments().end(),
240  boost::bind(&LHEEventProduct::addComment,
241  product.get(), _1));
242 
243  iEvent.put(std::move(product));
244 
245  if (runInfo_) {
246  std::unique_ptr<LHERunInfoProduct> product(new LHERunInfoProduct(*runInfo_->getHEPRUP()));
247  std::for_each(runInfo_->getHeaders().begin(),
248  runInfo_->getHeaders().end(),
249  boost::bind(&LHERunInfoProduct::addHeader,
250  product.get(), _1));
251  std::for_each(runInfo_->getComments().begin(),
252  runInfo_->getComments().end(),
253  boost::bind(&LHERunInfoProduct::addComment,
254  product.get(), _1));
255 
256  if (!runInfoProducts_.empty()) {
257  runInfoProducts_.front().mergeProduct(*product);
258  if (!wasMerged) {
259  runInfoProducts_.pop_front();
260  runInfoProducts_.push_front(product.release());
261  wasMerged = true;
262  }
263  }
264 
265  runInfo_.reset();
266  }
267 
268  partonLevel_.reset();
269  return;
270 }
271 
272 // ------------ method called when starting to processes a run ------------
273 void
275 {
276 
277  // pass the number of events as previous to last argument
278 
279  // pass the random number generator seed as last argument
280 
282 
283  if ( ! rng.isAvailable()) {
284  throw cms::Exception("Configuration")
285  << "The ExternalLHEProducer module requires the RandomNumberGeneratorService\n"
286  "which is not present in the configuration file. You must add the service\n"
287  "in the configuration file if you want to run ExternalLHEProducer";
288  }
289 
290  std::vector<std::string> infiles;
291  auto const seed = rng->mySeed();
292  if (generateConcurrently_) {
293  infiles.resize(nThreads_);
294  auto const nEventsAve = nEvents_ / nThreads_;
295  unsigned int const overflow = nThreads_ - (nEvents_ % nThreads_);
296  std::exception_ptr except;
297  std::atomic<char> exceptSet{0};
298 
299  tbb::this_task_arena::isolate([this, &except, &infiles, &exceptSet, nEventsAve, overflow, seed]() {
300  tbb::empty_task* waitTask = new (tbb::task::allocate_root()) tbb::empty_task;
301  waitTask->set_ref_count(1 + nThreads_);
302 
303  for (unsigned int t = 0; t < nThreads_; ++t) {
304  uint32_t nEvents = nEventsAve;
305  if (nEvents_ % nThreads_ != 0 and t >= overflow) {
306  nEvents += 1;
307  }
308  auto task = edm::make_functor_task(tbb::task::allocate_root(),
309  [t, this, &infiles, seed, nEvents, &except, &exceptSet, waitTask]() {
310  try {
311  using namespace boost::filesystem;
312  using namespace std::string_literals;
313  auto out = path("thread"s + std::to_string(t)) / path(outputFile_);
314  infiles[t] = out.native();
315  executeScript(makeArgs(nEvents, 1, seed + t), t, false);
316  } catch (...) {
317  char expected = 0;
318  if (exceptSet.compare_exchange_strong(expected, 1)) {
319  except = std::current_exception();
320  exceptSet.store(2);
321  }
322  }
323  waitTask->decrement_ref_count();
324  });
325  tbb::task::spawn(*task);
326  }
327  waitTask->wait_for_all();
328  tbb::task::destroy(*waitTask);
329  });
330  if (exceptSet != 0) {
331  std::rethrow_exception(except);
332  }
333  } else {
334  infiles = std::vector<std::string>(1, outputFile_);
336  }
337 
338  //run post-generation command if specified
339  if (!postGenerationCommand_.empty()) {
340  std::vector<std::string> postcmd = postGenerationCommand_;
341  try {
342  postcmd[0] = edm::FileInPath(postcmd[0]).fullPath();
343  } catch (const edm::Exception& e) {
344  edm::LogWarning("ExternalLHEProducer") << postcmd[0] << " is not a relative path. Run it as a shell command.";
345  }
346  executeScript(postcmd, 0, true);
347  }
348 
349  //fill LHEXMLProduct (streaming read directly into compressed buffer to save memory)
350  std::unique_ptr<LHEXMLStringProduct> p(new LHEXMLStringProduct);
351 
352  //store the XML file only if explictly requested
353  if (storeXML_) {
355  if (generateConcurrently_) {
356  using namespace boost::filesystem;
357  file = (path("thread0") / path(outputFile_)).native();
358  } else {
359  file = outputFile_;
360  }
361  std::ifstream instream(file);
362  if (!instream) {
363  throw cms::Exception("OutputOpenError") << "Unable to open script output file " << outputFile_ << ".";
364  }
365  instream.seekg (0, instream.end);
366  int insize = instream.tellg();
367  instream.seekg (0, instream.beg);
368  p->fillCompressedContent(instream, 0.25*insize);
369  instream.close();
370  }
371  run.put(std::move(p), "LHEScriptOutput");
372 
373  // LHE C++ classes translation
374  // (read back uncompressed file from disk in streaming mode again to save memory)
375 
376  unsigned int skip = 0;
377  reader_ = std::make_unique<lhef::LHEReader>(infiles, skip);
378 
379  nextEvent();
380  if (runInfoLast_) {
382 
383  std::unique_ptr<LHERunInfoProduct> product(new LHERunInfoProduct(*runInfo_->getHEPRUP()));
384  std::for_each(runInfo_->getHeaders().begin(),
385  runInfo_->getHeaders().end(),
386  boost::bind(&LHERunInfoProduct::addHeader,
387  product.get(), _1));
388  std::for_each(runInfo_->getComments().begin(),
389  runInfo_->getComments().end(),
390  boost::bind(&LHERunInfoProduct::addComment,
391  product.get(), _1));
392 
393  // keep a copy around in case of merging
394  runInfoProducts_.push_back(new LHERunInfoProduct(*product));
395  wasMerged = false;
396 
397  run.put(std::move(product));
398 
399  runInfo_.reset();
400  }
401 
402 }
403 
404 // ------------ method called when ending the processing of a run ------------
405 void
407 {
408 
409  if (!runInfoProducts_.empty()) {
410  std::unique_ptr<LHERunInfoProduct> product(runInfoProducts_.pop_front().release());
411  run.put(std::move(product));
412  }
413 
414  nextEvent();
415  if (partonLevel_) {
416  // VALIDATION_RUN env variable allows to finish event processing early without errors by sending SIGINT
417  if (std::getenv("VALIDATION_RUN") != nullptr) {
418  edm::LogWarning("ExternalLHEProducer")
419  << "Event loop is over, but there are still lhe events to process, ignoring...";
420  } else {
422  << "Error in ExternalLHEProducer::endRunProduce(). "
423  << "Event loop is over, but there are still lhe events to process."
424  << "This could happen if lhe file contains more events than requested. This is never expected to happen.";
425  }
426  }
427 
428  reader_.reset();
429  if (generateConcurrently_) {
430  for (unsigned int t = 0; t < nThreads_; ++t) {
431  using namespace boost::filesystem;
432  using namespace std::string_literals;
433  auto out = path("thread"s + std::to_string(t)) / path(outputFile_);
434  if (unlink(out.c_str())) {
435  throw cms::Exception("OutputDeleteError") << "Unable to delete original script output file " << out
436  << " (errno=" << errno << ", " << strerror(errno) << ").";
437  }
438  }
439  } else {
440  if (unlink(outputFile_.c_str())) {
441  throw cms::Exception("OutputDeleteError") << "Unable to delete original script output file " << outputFile_
442  << " (errno=" << errno << ", " << strerror(errno) << ").";
443  }
444  }
445 }
446 
447 std::vector<std::string> ExternalLHEProducer::makeArgs(uint32_t nEvents,
448  unsigned int nThreads,
449  std::uint32_t seed) const {
450  std::vector<std::string> args;
451  args.reserve(3 + args_.size());
452 
453  args.push_back(args_.front());
454  args.push_back(std::to_string(nEvents));
455 
456  args.push_back(std::to_string(seed));
457 
458  args.push_back(std::to_string(nThreads));
459  std::copy(args_.begin() + 1, args_.end(), std::back_inserter(args));
460 
461  for (unsigned int iArg = 0; iArg < args.size(); iArg++) {
462  LogDebug("LHEInputArgs") << "arg [" << iArg << "] = " << args[iArg];
463  }
464 
465  return args;
466 }
467 
468 // ------------ Close all the open file descriptors ------------
469 int
471 {
472  int maxfd = 1024;
473  int fd;
474 #ifdef __linux__
475  DIR * dir;
476  struct dirent *dp;
477  maxfd = preserve;
478  if ((dir = opendir("/proc/self/fd"))) {
479  errno = 0;
480  while ((dp = readdir (dir)) != nullptr) {
481  if ((strcmp(dp->d_name, ".") == 0) || (strcmp(dp->d_name, "..") == 0)) {
482  continue;
483  }
484  if (sscanf(dp->d_name, "%d", &fd) != 1) {
485  //throw cms::Exception("closeDescriptors") << "Found unexpected filename in /proc/self/fd: " << dp->d_name;
486  return -1;
487  }
488  if (fd > maxfd) {
489  maxfd = fd;
490  }
491  }
492  if (errno) {
493  //throw cms::Exception("closeDescriptors") << "Unable to determine the number of fd (errno=" << errno << ", " << strerror(errno) << ").";
494  return errno;
495  }
496  closedir(dir);
497  }
498 #endif
499  // TODO: assert for an unreasonable number of fds?
500  for (fd=3; fd<maxfd+1; fd++) {
501  if (fd != preserve)
502  close(fd);
503  }
504  return 0;
505 }
506 
507 // ------------ Execute the script associated with this producer ------------
508 void
509 ExternalLHEProducer::executeScript(std::vector<std::string> const& args, int id, bool isPost) const
510 {
511 
512  // Fork a script, wait until it finishes.
513 
514  int rc = 0, rc2 = 0;
515  int filedes[2], fd_flags;
516 
517  if (pipe(filedes)) {
518  throw cms::Exception("Unable to create a new pipe");
519  }
520  FileCloseSentry sentry1(filedes[0]), sentry2(filedes[1]);
521 
522  if ((fd_flags = fcntl(filedes[1], F_GETFD, NULL)) == -1) {
523  throw cms::Exception("ExternalLHEProducer") << "Failed to get pipe file descriptor flags (errno=" << rc << ", " << strerror(rc) << ")";
524  }
525  if (fcntl(filedes[1], F_SETFD, fd_flags | FD_CLOEXEC) == -1) {
526  throw cms::Exception("ExternalLHEProducer") << "Failed to set pipe file descriptor flags (errno=" << rc << ", " << strerror(rc) << ")";
527  }
528 
529  unsigned int argc_pre = 0;
530  // For generation command the first argument gives to the scriptName
531  if (!isPost) {
532  argc_pre = 1;
533  }
534  unsigned int argc = argc_pre + args.size();
535  // TODO: assert that we have a reasonable number of arguments
536  char **argv = new char *[argc+1];
537  if (!isPost) {
538  argv[0] = strdup(scriptName_.c_str());
539  }
540  for (unsigned int i = 0; i < args.size(); i++) {
541  argv[argc_pre + i] = strdup(args[i].c_str());
542  }
543  argv[argc] = nullptr;
544 
545  pid_t pid = fork();
546  if (pid == 0) {
547  // The child process
548  if (!(rc = closeDescriptors(filedes[1]))) {
549  if (!isPost && generateConcurrently_) {
550  using namespace boost::filesystem;
551  using namespace std::string_literals;
552  boost::system::error_code ec;
553  auto newDir = path("thread"s + std::to_string(id));
554  create_directory(newDir, ec);
555  current_path(newDir, ec);
556  }
557  execvp(argv[0], argv); // If execv returns, we have an error.
558  rc = errno;
559  }
560  while ((write(filedes[1], &rc, sizeof(int)) == -1) && (errno == EINTR)) {}
561  _exit(1);
562  }
563 
564  // Free the arg vector ASAP
565  for (unsigned int i=0; i<args.size()+1; i++) {
566  free(argv[i]);
567  }
568  delete [] argv;
569 
570  if (pid == -1) {
571  throw cms::Exception("ForkException") << "Unable to fork a child (errno=" << errno << ", " << strerror(errno) << ")";
572  }
573 
574  close(filedes[1]);
575  // If the exec succeeds, the read will fail.
576  while (((rc2 = read(filedes[0], &rc, sizeof(int))) == -1) && (errno == EINTR)) { rc2 = 0; }
577  if ((rc2 == sizeof(int)) && rc) {
578  throw cms::Exception("ExternalLHEProducer") << "Failed to execute script (errno=" << rc << ", " << strerror(rc) << ")";
579  }
580  close(filedes[0]);
581 
582  int status = 0;
583  errno = 0;
584  do {
585  if (waitpid(pid, &status, 0) < 0) {
586  if (errno == EINTR) {
587  continue;
588  } else {
589  throw cms::Exception("ExternalLHEProducer") << "Failed to read child status (errno=" << errno << ", " << strerror(errno) << ")";
590  }
591  }
592  if (WIFSIGNALED(status)) {
593  throw cms::Exception("ExternalLHEProducer") << "Child exited due to signal " << WTERMSIG(status) << ".";
594  }
595  if (WIFEXITED(status)) {
596  rc = WEXITSTATUS(status);
597  break;
598  }
599  } while (true);
600  if (rc) {
601  throw cms::Exception("ExternalLHEProducer") << "Child failed with exit code " << rc << ".";
602  }
603 
604 }
605 
606 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
607 void
609  //The following says we do not know what parameters are allowed so do no validation
610  // Please change this to state exactly what you do use, even if it is no parameters
612  desc.setComment("Executes an external script and places its output file into an EDM collection");
613 
614  edm::FileInPath thePath;
615  desc.add<edm::FileInPath>("scriptName", thePath);
616  desc.add<std::string>("outputFile", "myoutput");
617  desc.add<std::vector<std::string> >("args");
618  desc.add<uint32_t>("numberOfParameters");
619  desc.addUntracked<uint32_t>("nEvents");
620  desc.addUntracked<bool>("storeXML", false);
621  desc.addUntracked<bool>("generateConcurrently", false)
622  ->setComment("If true, run the script concurrently in separate processes.");
623  desc.addUntracked<std::vector<std::string>>("postGenerationCommand", std::vector<std::string>())
624  ->setComment(
625  "Command to run after the generation script has completed. The first argument can be a relative path.");
626 
627  edm::ParameterSetDescription nPartonMappingDesc;
628  nPartonMappingDesc.add<unsigned>("idprup");
629  nPartonMappingDesc.add<std::string>("order");
630  nPartonMappingDesc.add<unsigned>("np");
631  desc.addVPSetOptional("nPartonMapping", nPartonMappingDesc);
632 
633  descriptions.addDefault(desc);
634 }
635 
637 {
638 
639  if (partonLevel_)
640  return;
641 
642  if(not reader_) { return;}
643 
644  partonLevel_ = reader_->next();
645  if (!partonLevel_) {
646  //see if we have another file to read;
647  bool newFileOpened;
648  do {
649  newFileOpened = false;
650  partonLevel_ = reader_->next(&newFileOpened);
651  } while (newFileOpened && !partonLevel_);
652  }
653  if (!partonLevel_)
654  return;
655 
656  std::shared_ptr<lhef::LHERunInfo> runInfoThis = partonLevel_->getRunInfo();
657  if (runInfoThis != runInfoLast_) {
658  runInfo_ = runInfoThis;
659  runInfoLast_ = runInfoThis;
660  }
661 }
662 
663 //define this as a plug-in
#define LogDebug(id)
void beginRunProduce(edm::Run &run, edm::EventSetup const &es) override
void setComment(std::string const &value)
VParameterSet const & getParameterSetVector(std::string const &name) const
void endRunProduce(edm::Run &, edm::EventSetup const &) override
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void addHeader(const Header &header)
def copy(args, dbName)
void addComment(const std::string &line)
def destroy(e)
Definition: pyrootRender.py:15
FunctorTask< F > * make_functor_task(ALLOC &&iAlloc, F f)
Definition: FunctorTask.h:47
ParameterDescriptionBase * addVPSetOptional(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
void produce(edm::Event &, const edm::EventSetup &) override
void executeScript(std::vector< std::string > const &args, int id, bool isPost) const
void addWeight(const WGT &wgt)
bool exists(std::string const &parameterName) const
checks if a parameter exists
#define NULL
Definition: scimark2.h:8
boost::ptr_deque< LHERunInfoProduct > runInfoProducts_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void setComment(std::string const &value)
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void addDefault(ParameterSetDescription const &psetDescription)
int np
Definition: AMPTWrapper.h:33
std::shared_ptr< lhef::LHERunInfo > runInfoLast_
std::shared_ptr< lhef::LHERunInfo > runInfo_
int closeDescriptors(int preserve) const
std::unique_ptr< lhef::LHEReader > reader_
bool isAvailable() const
Definition: Service.h:40
std::map< unsigned, std::pair< unsigned, unsigned > > nPartonMapping_
def pipe(cmdline, input=None)
Definition: pipe.py:5
std::vector< std::string > makeArgs(uint32_t nEvents, unsigned int nThreads, std::uint32_t seed) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
virtual std::uint32_t mySeed() const =0
const std::vector< std::string > args_
const std::vector< std::string > postGenerationCommand_
void addComment(const std::string &line)
void preallocThreads(unsigned int) override
void put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Run.h:108
HLT enums.
std::string fullPath() const
Definition: FileInPath.cc:163
dbl *** dir
Definition: mlp_gen.cc:35
def write(self, setup)
UInt_t nEvents
Definition: hcalCalib.cc:41
ExternalLHEProducer(const edm::ParameterSet &iConfig)
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45
std::shared_ptr< lhef::LHEEvent > partonLevel_