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