|
| ExternalLHEProducer (const edm::ParameterSet &iConfig) |
|
| ~ExternalLHEProducer () override |
|
| EDProducer ()=default |
|
SerialTaskQueue * | globalLuminosityBlocksQueue () final |
|
SerialTaskQueue * | globalRunsQueue () final |
|
bool | hasAbilityToProduceInLumis () const final |
|
bool | hasAbilityToProduceInRuns () const final |
|
bool | wantsGlobalLuminosityBlocks () const final |
|
bool | wantsGlobalRuns () const final |
|
| EDProducerBase () |
|
ModuleDescription const & | moduleDescription () const |
|
bool | wantsStreamLuminosityBlocks () const |
|
bool | wantsStreamRuns () const |
|
| ~EDProducerBase () override |
|
void | callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func) |
|
std::vector< edm::ProductResolverIndex > const & | indiciesForPutProducts (BranchType iBranchType) const |
|
| ProducerBase () |
|
std::vector< edm::ProductResolverIndex > const & | putTokenIndexToProductResolverIndex () const |
|
void | registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &) |
|
std::function< void(BranchDescription const &)> | registrationCallback () const |
| used by the fwk to register list of products More...
|
|
void | resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel) |
|
| ~ProducerBase () override |
|
std::vector< ConsumesInfo > | consumesInfo () const |
|
void | convertCurrentProcessAlias (std::string const &processName) |
| Convert "@currentProcess" in InputTag process names to the actual current process name. More...
|
|
| EDConsumerBase () |
|
| EDConsumerBase (EDConsumerBase const &)=delete |
|
| EDConsumerBase (EDConsumerBase &&)=default |
|
ProductResolverIndexAndSkipBit | indexFrom (EDGetToken, BranchType, TypeID const &) const |
|
void | itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const |
|
void | itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const |
|
std::vector< ProductResolverIndexAndSkipBit > const & | itemsToGetFrom (BranchType iType) const |
|
void | labelsForToken (EDGetToken iToken, Labels &oLabels) const |
|
void | modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const |
|
EDConsumerBase const & | operator= (EDConsumerBase const &)=delete |
|
EDConsumerBase & | operator= (EDConsumerBase &&)=default |
|
bool | registeredToConsume (ProductResolverIndex, bool, BranchType) const |
|
bool | registeredToConsumeMany (TypeID const &, BranchType) const |
|
ProductResolverIndexAndSkipBit | uncheckedIndexFrom (EDGetToken) const |
|
void | updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet) |
|
virtual | ~EDConsumerBase () noexcept(false) |
|
|
typedef EDProducerBase | ModuleType |
|
using | ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >> |
|
typedef ProductRegistryHelper::TypeLabelList | TypeLabelList |
|
typedef ProductLabels | Labels |
|
template<typename ProductType , BranchType B = InEvent> |
EDGetTokenT< ProductType > | consumes (edm::InputTag const &tag) |
|
EDGetToken | consumes (const TypeToGet &id, edm::InputTag const &tag) |
|
template<BranchType B> |
EDGetToken | consumes (TypeToGet const &id, edm::InputTag const &tag) |
|
ConsumesCollector | consumesCollector () |
| Use a ConsumesCollector to gather consumes information from helper functions. More...
|
|
template<typename ProductType , BranchType B = InEvent> |
void | consumesMany () |
|
void | consumesMany (const TypeToGet &id) |
|
template<BranchType B> |
void | consumesMany (const TypeToGet &id) |
|
template<typename ProductType , BranchType B = InEvent> |
EDGetTokenT< ProductType > | mayConsume (edm::InputTag const &tag) |
|
EDGetToken | mayConsume (const TypeToGet &id, edm::InputTag const &tag) |
|
template<BranchType B> |
EDGetToken | mayConsume (const TypeToGet &id, edm::InputTag const &tag) |
|
Description: [one line class summary]
Implementation: [Notes on implementation]
Definition at line 69 of file ExternalLHEProducer.cc.
Definition at line 225 of file ExternalLHEProducer.cc.
References LHERunInfoProduct::addComment(), LHERunInfoProduct::addHeader(), args_, Exception, executeScript(), edm::Service< T >::isAvailable(), LogDebug, eostools::move(), edm::RandomNumberGenerator::mySeed(), nEvents_, nextEvent(), nThreads_, outputFile_, AlCaHLTBitMon_ParallelJobs::p, edm::Run::put(), reader_, runInfo, runInfoLast, runInfoProducts, createPayload::skip, and wasMerged.
230 std::ostringstream eventStream;
233 args_.insert(
args_.begin() + 1, eventStream.str());
241 <<
"The ExternalLHEProducer module requires the RandomNumberGeneratorService\n" 242 "which is not present in the configuration file. You must add the service\n" 243 "in the configuration file if you want to run ExternalLHEProducer";
245 std::ostringstream randomStream;
246 randomStream << rng->
mySeed();
248 args_.insert(
args_.begin() + 2, randomStream.str());
253 for (
unsigned int iArg = 0; iArg <
args_.size() ; iArg++ ) {
254 LogDebug(
"LHEInputArgs") <<
"arg [" << iArg <<
"] = " <<
args_[iArg];
265 instream.seekg (0, instream.end);
266 int insize = instream.tellg();
267 instream.seekg (0, instream.beg);
268 p->fillCompressedContent(instream, 0.25*insize);
276 unsigned int skip = 0;
277 reader_ = std::make_unique<lhef::LHEReader>(infiles,
skip);
284 std::for_each(
runInfo->getHeaders().begin(),
288 std::for_each(
runInfo->getComments().begin(),
void addHeader(const Header &header)
std::vector< std::string > args_
boost::shared_ptr< lhef::LHERunInfo > runInfoLast
std::unique_ptr< lhef::LHEReader > reader_
virtual std::uint32_t mySeed() const =0
boost::shared_ptr< lhef::LHERunInfo > runInfo
void addComment(const std::string &line)
void put(std::unique_ptr< PROD > product)
Put a new product.
boost::ptr_deque< LHERunInfoProduct > runInfoProducts
void ExternalLHEProducer::executeScript |
( |
| ) |
|
|
private |
Definition at line 370 of file ExternalLHEProducer.cc.
References edm::TimingServiceBase::addToCPUTime(), dir2webdir::argc, args_, cmsBatch::argv, closeDescriptors(), Exception, mps_fire::i, edm::Service< T >::isAvailable(), NULL, sysUtil::pid, pipe::pipe(), scriptName_, mps_update::status, ntuplemaker::time, and TriggerAnalyzer::write().
Referenced by beginRunProduce().
376 int filedes[2], fd_flags;
382 FileCloseSentry sentry1(filedes[0]), sentry2(filedes[1]);
384 if ((fd_flags = fcntl(filedes[1], F_GETFD,
NULL)) == -1) {
385 throw cms::Exception(
"ExternalLHEProducer") <<
"Failed to get pipe file descriptor flags (errno=" << rc <<
", " << strerror(rc) <<
")";
387 if (fcntl(filedes[1], F_SETFD, fd_flags | FD_CLOEXEC) == -1) {
388 throw cms::Exception(
"ExternalLHEProducer") <<
"Failed to set pipe file descriptor flags (errno=" << rc <<
", " << strerror(rc) <<
")";
391 argc = 1 +
args_.size();
393 char **
argv =
new char *[argc+1];
395 for (
unsigned int i=1;
i<
argc;
i++) {
396 argv[
i] = strdup(
args_[
i-1].c_str());
398 argv[
argc] =
nullptr;
404 execvp(argv[0], argv);
407 while ((
write(filedes[1], &rc,
sizeof(
int)) == -1) && (errno == EINTR)) {}
412 for (
unsigned int i=0;
i<
args_.size()+1;
i++) {
418 throw cms::Exception(
"ForkException") <<
"Unable to fork a child (errno=" << errno <<
", " << strerror(errno) <<
")";
423 while (((rc2 = read(filedes[0], &rc,
sizeof(
int))) == -1) && (errno == EINTR)) { rc2 = 0; }
424 if ((rc2 ==
sizeof(
int)) && rc) {
425 throw cms::Exception(
"ExternalLHEProducer") <<
"Failed to execute script (errno=" << rc <<
", " << strerror(rc) <<
")";
432 if (waitpid(pid, &status, 0) < 0) {
433 if (errno == EINTR) {
436 throw cms::Exception(
"ExternalLHEProducer") <<
"Failed to read child status (errno=" << errno <<
", " << strerror(errno) <<
")";
439 if (WIFSIGNALED(status)) {
440 throw cms::Exception(
"ExternalLHEProducer") <<
"Child exited due to signal " << WTERMSIG(status) <<
".";
442 if (WIFEXITED(status)) {
443 rc = WEXITSTATUS(status);
450 getrusage(RUSAGE_CHILDREN,&ru);
451 double time =
static_cast<double>(ru.ru_stime.tv_sec) + (static_cast<double>(ru.ru_stime.tv_usec) * 1E-6);
455 throw cms::Exception(
"ExternalLHEProducer") <<
"Child failed with exit code " << rc <<
".";
std::vector< std::string > args_
virtual void addToCPUTime(double iTime)=0
int closeDescriptors(int preserve)
def pipe(cmdline, input=None)