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 unweighting 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  product->setEvtNum(partonLevel_->evtnum());
207  if (nPartonMapping_.empty()) {
208  product->setNpLO(partonLevel_->npLO());
209  product->setNpNLO(partonLevel_->npNLO());
210  }
211  else {
212  // overwrite npLO and npNLO values by user-specified mapping
213  unsigned processId(partonLevel_->getHEPEUP()->IDPRUP);
214  unsigned order(0);
215  unsigned np(0);
216  try {
217  auto procDef(nPartonMapping_.at(processId));
218  order = procDef.first;
219  np = procDef.second;
220  }
221  catch (std::out_of_range&) {
222  throw cms::Exception("ExternalLHEProducer") << "Unexpected IDPRUP encountered: " << partonLevel_->getHEPEUP()->IDPRUP;
223  }
224 
225  switch (order) {
226  case 0:
227  product->setNpLO(np);
228  product->setNpNLO(-1);
229  break;
230  case 1:
231  product->setNpLO(-1);
232  product->setNpNLO(np);
233  break;
234  default:
235  break;
236  }
237  }
238 
239  std::for_each(partonLevel_->getComments().begin(),
240  partonLevel_->getComments().end(),
241  boost::bind(&LHEEventProduct::addComment,
242  product.get(), _1));
243 
244  iEvent.put(std::move(product));
245 
246  if (runInfo_) {
247  std::unique_ptr<LHERunInfoProduct> product(new LHERunInfoProduct(*runInfo_->getHEPRUP()));
248  std::for_each(runInfo_->getHeaders().begin(),
249  runInfo_->getHeaders().end(),
250  boost::bind(&LHERunInfoProduct::addHeader,
251  product.get(), _1));
252  std::for_each(runInfo_->getComments().begin(),
253  runInfo_->getComments().end(),
254  boost::bind(&LHERunInfoProduct::addComment,
255  product.get(), _1));
256 
257  if (!runInfoProducts_.empty()) {
258  runInfoProducts_.front().mergeProduct(*product);
259  if (!wasMerged) {
260  runInfoProducts_.pop_front();
261  runInfoProducts_.push_front(product.release());
262  wasMerged = true;
263  }
264  }
265 
266  runInfo_.reset();
267  }
268 
269  partonLevel_.reset();
270  return;
271 }
272 
273 // ------------ method called when starting to processes a run ------------
274 void
276 {
277 
278  // pass the number of events as previous to last argument
279 
280  // pass the random number generator seed as last argument
281 
283 
284  if ( ! rng.isAvailable()) {
285  throw cms::Exception("Configuration")
286  << "The ExternalLHEProducer module requires the RandomNumberGeneratorService\n"
287  "which is not present in the configuration file. You must add the service\n"
288  "in the configuration file if you want to run ExternalLHEProducer";
289  }
290 
291  std::vector<std::string> infiles;
292  auto const seed = rng->mySeed();
293  if (generateConcurrently_) {
294  infiles.resize(nThreads_);
295  auto const nEventsAve = nEvents_ / nThreads_;
296  unsigned int const overflow = nThreads_ - (nEvents_ % nThreads_);
297  std::exception_ptr except;
298  std::atomic<char> exceptSet{0};
299 
300  tbb::this_task_arena::isolate([this, &except, &infiles, &exceptSet, nEventsAve, overflow, seed]() {
301  tbb::empty_task* waitTask = new (tbb::task::allocate_root()) tbb::empty_task;
302  waitTask->set_ref_count(1 + nThreads_);
303 
304  for (unsigned int t = 0; t < nThreads_; ++t) {
305  uint32_t nEvents = nEventsAve;
306  if (nEvents_ % nThreads_ != 0 and t >= overflow) {
307  nEvents += 1;
308  }
309  auto task = edm::make_functor_task(tbb::task::allocate_root(),
310  [t, this, &infiles, seed, nEvents, &except, &exceptSet, waitTask]() {
311  try {
312  using namespace boost::filesystem;
313  using namespace std::string_literals;
314  auto out = path("thread"s + std::to_string(t)) / path(outputFile_);
315  infiles[t] = out.native();
316  executeScript(makeArgs(nEvents, 1, seed + t), t, false);
317  } catch (...) {
318  char expected = 0;
319  if (exceptSet.compare_exchange_strong(expected, 1)) {
320  except = std::current_exception();
321  exceptSet.store(2);
322  }
323  }
324  waitTask->decrement_ref_count();
325  });
326  tbb::task::spawn(*task);
327  }
328  waitTask->wait_for_all();
329  tbb::task::destroy(*waitTask);
330  });
331  if (exceptSet != 0) {
332  std::rethrow_exception(except);
333  }
334  } else {
335  infiles = std::vector<std::string>(1, outputFile_);
337  }
338 
339  //run post-generation command if specified
340  if (!postGenerationCommand_.empty()) {
341  std::vector<std::string> postcmd = postGenerationCommand_;
342  try {
343  postcmd[0] = edm::FileInPath(postcmd[0]).fullPath();
344  } catch (const edm::Exception& e) {
345  edm::LogWarning("ExternalLHEProducer") << postcmd[0] << " is not a relative path. Run it as a shell command.";
346  }
347  executeScript(postcmd, 0, true);
348  }
349 
350  //fill LHEXMLProduct (streaming read directly into compressed buffer to save memory)
351  std::unique_ptr<LHEXMLStringProduct> p(new LHEXMLStringProduct);
352 
353  //store the XML file only if explictly requested
354  if (storeXML_) {
356  if (generateConcurrently_) {
357  using namespace boost::filesystem;
358  file = (path("thread0") / path(outputFile_)).native();
359  } else {
360  file = outputFile_;
361  }
362  std::ifstream instream(file);
363  if (!instream) {
364  throw cms::Exception("OutputOpenError") << "Unable to open script output file " << outputFile_ << ".";
365  }
366  instream.seekg (0, instream.end);
367  int insize = instream.tellg();
368  instream.seekg (0, instream.beg);
369  p->fillCompressedContent(instream, 0.25*insize);
370  instream.close();
371  }
372  run.put(std::move(p), "LHEScriptOutput");
373 
374  // LHE C++ classes translation
375  // (read back uncompressed file from disk in streaming mode again to save memory)
376 
377  unsigned int skip = 0;
378  reader_ = std::make_unique<lhef::LHEReader>(infiles, skip);
379 
380  nextEvent();
381  if (runInfoLast_) {
383 
384  std::unique_ptr<LHERunInfoProduct> product(new LHERunInfoProduct(*runInfo_->getHEPRUP()));
385  std::for_each(runInfo_->getHeaders().begin(),
386  runInfo_->getHeaders().end(),
387  boost::bind(&LHERunInfoProduct::addHeader,
388  product.get(), _1));
389  std::for_each(runInfo_->getComments().begin(),
390  runInfo_->getComments().end(),
391  boost::bind(&LHERunInfoProduct::addComment,
392  product.get(), _1));
393 
394  // keep a copy around in case of merging
395  runInfoProducts_.push_back(new LHERunInfoProduct(*product));
396  wasMerged = false;
397 
398  run.put(std::move(product));
399 
400  runInfo_.reset();
401  }
402 
403 }
404 
405 // ------------ method called when ending the processing of a run ------------
406 void
408 {
409 
410  if (!runInfoProducts_.empty()) {
411  std::unique_ptr<LHERunInfoProduct> product(runInfoProducts_.pop_front().release());
412  run.put(std::move(product));
413  }
414 
415  nextEvent();
416  if (partonLevel_) {
417  // VALIDATION_RUN env variable allows to finish event processing early without errors by sending SIGINT
418  if (std::getenv("VALIDATION_RUN") != nullptr) {
419  edm::LogWarning("ExternalLHEProducer")
420  << "Event loop is over, but there are still lhe events to process, ignoring...";
421  } else {
423  << "Error in ExternalLHEProducer::endRunProduce(). "
424  << "Event loop is over, but there are still lhe events to process."
425  << "This could happen if lhe file contains more events than requested. This is never expected to happen.";
426  }
427  }
428 
429  reader_.reset();
430  if (generateConcurrently_) {
431  for (unsigned int t = 0; t < nThreads_; ++t) {
432  using namespace boost::filesystem;
433  using namespace std::string_literals;
434  auto out = path("thread"s + std::to_string(t)) / path(outputFile_);
435  if (unlink(out.c_str())) {
436  throw cms::Exception("OutputDeleteError") << "Unable to delete original script output file " << out
437  << " (errno=" << errno << ", " << strerror(errno) << ").";
438  }
439  }
440  } else {
441  if (unlink(outputFile_.c_str())) {
442  throw cms::Exception("OutputDeleteError") << "Unable to delete original script output file " << outputFile_
443  << " (errno=" << errno << ", " << strerror(errno) << ").";
444  }
445  }
446 }
447 
448 std::vector<std::string> ExternalLHEProducer::makeArgs(uint32_t nEvents,
449  unsigned int nThreads,
450  std::uint32_t seed) const {
451  std::vector<std::string> args;
452  args.reserve(3 + args_.size());
453 
454  args.push_back(args_.front());
455  args.push_back(std::to_string(nEvents));
456 
457  args.push_back(std::to_string(seed));
458 
459  args.push_back(std::to_string(nThreads));
460  std::copy(args_.begin() + 1, args_.end(), std::back_inserter(args));
461 
462  for (unsigned int iArg = 0; iArg < args.size(); iArg++) {
463  LogDebug("LHEInputArgs") << "arg [" << iArg << "] = " << args[iArg];
464  }
465 
466  return args;
467 }
468 
469 // ------------ Close all the open file descriptors ------------
470 int
472 {
473  int maxfd = 1024;
474  int fd;
475 #ifdef __linux__
476  DIR * dir;
477  struct dirent *dp;
478  maxfd = preserve;
479  if ((dir = opendir("/proc/self/fd"))) {
480  errno = 0;
481  while ((dp = readdir (dir)) != nullptr) {
482  if ((strcmp(dp->d_name, ".") == 0) || (strcmp(dp->d_name, "..") == 0)) {
483  continue;
484  }
485  if (sscanf(dp->d_name, "%d", &fd) != 1) {
486  //throw cms::Exception("closeDescriptors") << "Found unexpected filename in /proc/self/fd: " << dp->d_name;
487  return -1;
488  }
489  if (fd > maxfd) {
490  maxfd = fd;
491  }
492  }
493  if (errno) {
494  //throw cms::Exception("closeDescriptors") << "Unable to determine the number of fd (errno=" << errno << ", " << strerror(errno) << ").";
495  return errno;
496  }
497  closedir(dir);
498  }
499 #endif
500  // TODO: assert for an unreasonable number of fds?
501  for (fd=3; fd<maxfd+1; fd++) {
502  if (fd != preserve)
503  close(fd);
504  }
505  return 0;
506 }
507 
508 // ------------ Execute the script associated with this producer ------------
509 void
510 ExternalLHEProducer::executeScript(std::vector<std::string> const& args, int id, bool isPost) const
511 {
512 
513  // Fork a script, wait until it finishes.
514 
515  int rc = 0, rc2 = 0;
516  int filedes[2], fd_flags;
517 
518  if (pipe(filedes)) {
519  throw cms::Exception("Unable to create a new pipe");
520  }
521  FileCloseSentry sentry1(filedes[0]), sentry2(filedes[1]);
522 
523  if ((fd_flags = fcntl(filedes[1], F_GETFD, NULL)) == -1) {
524  throw cms::Exception("ExternalLHEProducer") << "Failed to get pipe file descriptor flags (errno=" << rc << ", " << strerror(rc) << ")";
525  }
526  if (fcntl(filedes[1], F_SETFD, fd_flags | FD_CLOEXEC) == -1) {
527  throw cms::Exception("ExternalLHEProducer") << "Failed to set pipe file descriptor flags (errno=" << rc << ", " << strerror(rc) << ")";
528  }
529 
530  unsigned int argc_pre = 0;
531  // For generation command the first argument gives to the scriptName
532  if (!isPost) {
533  argc_pre = 1;
534  }
535  unsigned int argc = argc_pre + args.size();
536  // TODO: assert that we have a reasonable number of arguments
537  char **argv = new char *[argc+1];
538  if (!isPost) {
539  argv[0] = strdup(scriptName_.c_str());
540  }
541  for (unsigned int i = 0; i < args.size(); i++) {
542  argv[argc_pre + i] = strdup(args[i].c_str());
543  }
544  argv[argc] = nullptr;
545 
546  pid_t pid = fork();
547  if (pid == 0) {
548  // The child process
549  if (!(rc = closeDescriptors(filedes[1]))) {
550  if (!isPost && generateConcurrently_) {
551  using namespace boost::filesystem;
552  using namespace std::string_literals;
553  boost::system::error_code ec;
554  auto newDir = path("thread"s + std::to_string(id));
555  create_directory(newDir, ec);
556  current_path(newDir, ec);
557  }
558  execvp(argv[0], argv); // If execv returns, we have an error.
559  rc = errno;
560  }
561  while ((write(filedes[1], &rc, sizeof(int)) == -1) && (errno == EINTR)) {}
562  _exit(1);
563  }
564 
565  // Free the arg vector ASAP
566  for (unsigned int i=0; i<args.size()+1; i++) {
567  free(argv[i]);
568  }
569  delete [] argv;
570 
571  if (pid == -1) {
572  throw cms::Exception("ForkException") << "Unable to fork a child (errno=" << errno << ", " << strerror(errno) << ")";
573  }
574 
575  close(filedes[1]);
576  // If the exec succeeds, the read will fail.
577  while (((rc2 = read(filedes[0], &rc, sizeof(int))) == -1) && (errno == EINTR)) { rc2 = 0; }
578  if ((rc2 == sizeof(int)) && rc) {
579  throw cms::Exception("ExternalLHEProducer") << "Failed to execute script (errno=" << rc << ", " << strerror(rc) << ")";
580  }
581  close(filedes[0]);
582 
583  int status = 0;
584  errno = 0;
585  do {
586  if (waitpid(pid, &status, 0) < 0) {
587  if (errno == EINTR) {
588  continue;
589  } else {
590  throw cms::Exception("ExternalLHEProducer") << "Failed to read child status (errno=" << errno << ", " << strerror(errno) << ")";
591  }
592  }
593  if (WIFSIGNALED(status)) {
594  throw cms::Exception("ExternalLHEProducer") << "Child exited due to signal " << WTERMSIG(status) << ".";
595  }
596  if (WIFEXITED(status)) {
597  rc = WEXITSTATUS(status);
598  break;
599  }
600  } while (true);
601  if (rc) {
602  throw cms::Exception("ExternalLHEProducer") << "Child failed with exit code " << rc << ".";
603  }
604 
605 }
606 
607 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
608 void
610  //The following says we do not know what parameters are allowed so do no validation
611  // Please change this to state exactly what you do use, even if it is no parameters
613  desc.setComment("Executes an external script and places its output file into an EDM collection");
614 
615  edm::FileInPath thePath;
616  desc.add<edm::FileInPath>("scriptName", thePath);
617  desc.add<std::string>("outputFile", "myoutput");
618  desc.add<std::vector<std::string> >("args");
619  desc.add<uint32_t>("numberOfParameters");
620  desc.addUntracked<uint32_t>("nEvents");
621  desc.addUntracked<bool>("storeXML", false);
622  desc.addUntracked<bool>("generateConcurrently", false)
623  ->setComment("If true, run the script concurrently in separate processes.");
624  desc.addUntracked<std::vector<std::string>>("postGenerationCommand", std::vector<std::string>())
625  ->setComment(
626  "Command to run after the generation script has completed. The first argument can be a relative path.");
627 
628  edm::ParameterSetDescription nPartonMappingDesc;
629  nPartonMappingDesc.add<unsigned>("idprup");
630  nPartonMappingDesc.add<std::string>("order");
631  nPartonMappingDesc.add<unsigned>("np");
632  desc.addVPSetOptional("nPartonMapping", nPartonMappingDesc);
633 
634  descriptions.addDefault(desc);
635 }
636 
638 {
639 
640  if (partonLevel_)
641  return;
642 
643  if(not reader_) { return;}
644 
645  partonLevel_ = reader_->next();
646  if (!partonLevel_) {
647  //see if we have another file to read;
648  bool newFileOpened;
649  do {
650  newFileOpened = false;
651  partonLevel_ = reader_->next(&newFileOpened);
652  } while (newFileOpened && !partonLevel_);
653  }
654  if (!partonLevel_)
655  return;
656 
657  std::shared_ptr<lhef::LHERunInfo> runInfoThis = partonLevel_->getRunInfo();
658  if (runInfoThis != runInfoLast_) {
659  runInfo_ = runInfoThis;
660  runInfoLast_ = runInfoThis;
661  }
662 }
663 
664 //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_