CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
edm::EventContentAnalyzer Class Reference
Inheritance diagram for edm::EventContentAnalyzer:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (Event const &, EventSetup const &) override
 
void endJob () override
 
 EventContentAnalyzer (ParameterSet const &)
 
 ~EventContentAnalyzer () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

std::map< std::string, int > cumulates_
 
int evno_
 
bool getData_
 
std::vector< std::string > getModuleLabels_
 
std::string indentation_
 
bool listContent_
 
bool listPathStatus_
 
bool listProvenance_
 
std::vector< std::string > moduleLabels_
 
bool verbose_
 
std::string verboseIndentation_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 259 of file EventContentAnalyzer.cc.

Constructor & Destructor Documentation

◆ EventContentAnalyzer()

edm::EventContentAnalyzer::EventContentAnalyzer ( ParameterSet const &  iConfig)
explicit

Definition at line 287 of file EventContentAnalyzer.cc.

References edm::one::EDAnalyzerBase::callWhenNewProductsRegistered(), edm::BranchDescription::className(), edm::EDConsumerBase::consumes(), getData_, getModuleLabels_, mod(), edm::BranchDescription::moduleLabel(), moduleLabels_, edm::BranchDescription::processName(), edm::PRODUCT_TYPE, edm::BranchDescription::productInstanceName(), edm::sort_all(), AlCaHLTBitMon_QueryRunRegistry::string, and edm::BranchDescription::unwrappedTypeID().

288  : indentation_(iConfig.getUntrackedParameter<std::string>("indentation")),
289  verboseIndentation_(iConfig.getUntrackedParameter<std::string>("verboseIndentation")),
290  moduleLabels_(iConfig.getUntrackedParameter<std::vector<std::string>>("verboseForModuleLabels")),
291  verbose_(iConfig.getUntrackedParameter<bool>("verbose") || !moduleLabels_.empty()),
292  getModuleLabels_(iConfig.getUntrackedParameter<std::vector<std::string>>("getDataForModuleLabels")),
293  getData_(iConfig.getUntrackedParameter<bool>("getData") || !getModuleLabels_.empty()),
294  evno_(1),
295  listContent_(iConfig.getUntrackedParameter<bool>("listContent")),
296  listProvenance_(iConfig.getUntrackedParameter<bool>("listProvenance")),
297  listPathStatus_(iConfig.getUntrackedParameter<bool>("listPathStatus")) {
298  //now do what ever initialization is needed
301  if (getData_) {
303  if (getModuleLabels_.empty()) {
304  const std::string kPathStatus("edm::PathStatus");
305  const std::string kEndPathStatus("edm::EndPathStatus");
306  if (iBranch.className() != kPathStatus && iBranch.className() != kEndPathStatus) {
308  edm::InputTag{iBranch.moduleLabel(), iBranch.productInstanceName(), iBranch.processName()});
309  }
310  } else {
311  for (auto const& mod : this->getModuleLabels_) {
312  if (iBranch.moduleLabel() == mod) {
314  edm::InputTag{mod, iBranch.productInstanceName(), iBranch.processName()});
315  break;
316  }
317  }
318  }
319  });
320  }
321  }
std::vector< std::string > getModuleLabels_
TypeID unwrappedTypeID() const
std::string const & processName() const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::string const & className() const
std::string const & productInstanceName() const
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:92
std::vector< std::string > moduleLabels_
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::string const & moduleLabel() const

◆ ~EventContentAnalyzer()

edm::EventContentAnalyzer::~EventContentAnalyzer ( )
override

Definition at line 323 of file EventContentAnalyzer.cc.

323  {
324  // do anything here that needs to be done at destruction time
325  // (e.g. close files, deallocate resources etc.)
326  }

Member Function Documentation

◆ analyze()

void edm::EventContentAnalyzer::analyze ( Event const &  iEvent,
EventSetup const &   
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 333 of file EventContentAnalyzer.cc.

References edm::binary_search_all(), className(), cumulates_, evno_, edm::ParameterSet::existsAs(), edm::friendlyname::friendlyName(), getData_, edm::pset::Registry::getMapped(), getModuleLabels_, edm::ParameterSet::getParameterSet(), patZpeak::handle, iEvent, indentation_, ProducerED_cfi::InputTag, edm::pset::Registry::instance(), submitPVResolutionJobs::key, listContent_, listPathStatus_, listProvenance_, HerwigMaxPtPartonFilter_cfi::moduleLabel, moduleLabels_, SimL1EmulatorRepack_CalouGT_cff::processName, crab_script::provenance, AlCaHLTBitMon_QueryRunRegistry::string, verbose_, and verboseIndentation_.

333  {
334  typedef std::vector<StableProvenance const*> Provenances;
335  Provenances provenances;
336 
337  iEvent.getAllStableProvenance(provenances);
338 
339  if (listContent_) {
340  LogAbsolute("EventContent") << "\n"
341  << indentation_ << "Event " << std::setw(5) << evno_ << " contains "
342  << provenances.size() << " product" << (provenances.size() == 1 ? "" : "s")
343  << " with friendlyClassName, moduleLabel, productInstanceName and processName:"
344  << std::endl;
345  }
346 
348  for (auto const& provenance : provenances) {
349  std::string const& className = provenance->className();
350  const std::string kPathStatus("edm::PathStatus");
351  const std::string kEndPathStatus("edm::EndPathStatus");
352  if (not listPathStatus_ and (className == kPathStatus || className == kEndPathStatus)) {
353  continue;
354  }
355  std::string const& friendlyName = provenance->friendlyClassName();
356  //if(friendlyName.empty()) friendlyName = std::string("||");
357 
358  std::string const& modLabel = provenance->moduleLabel();
359  //if(modLabel.empty()) modLabel = std::string("||");
360 
361  std::string const& instanceName = provenance->productInstanceName();
362  //if(instanceName.empty()) instanceName = std::string("||");
363 
364  std::string const& processName = provenance->processName();
365 
366  bool doVerbose = verbose_ && (moduleLabels_.empty() || binary_search_all(moduleLabels_, modLabel));
367 
368  if (listContent_ || doVerbose) {
369  LogAbsolute("EventContent") << indentation_ << friendlyName << " \"" << modLabel << "\" \"" << instanceName
370  << "\" \"" << processName << "\""
371  << " (productId = " << provenance->productID() << ")" << std::endl;
372 
373  if (listProvenance_) {
374  const bool isAlias = provenance->branchDescription().isAlias();
375  std::string aliasForModLabel;
376  LogAbsolute("EventContent") << *provenance;
377  if (isAlias) {
378  aliasForModLabel = iEvent.getStableProvenance(provenance->originalBranchID()).moduleLabel();
379  LogAbsolute("EventContent") << "Is an alias for " << aliasForModLabel;
380  }
381  ProcessHistory const& processHistory = iEvent.processHistory();
382  for (ProcessConfiguration const& pc : processHistory) {
383  if (pc.processName() == provenance->processName()) {
384  ParameterSetID const& psetID = pc.parameterSetID();
385  pset::Registry const* psetRegistry = pset::Registry::instance();
386  ParameterSet const* processPset = psetRegistry->getMapped(psetID);
387  if (processPset) {
388  if (processPset->existsAs<ParameterSet>(modLabel)) {
389  if (isAlias) {
390  LogAbsolute("EventContent") << "Alias PSet";
391  }
392  LogAbsolute("EventContent") << processPset->getParameterSet(modLabel);
393  }
394  if (isAlias and processPset->existsAs<ParameterSet>(aliasForModLabel)) {
395  LogAbsolute("EventContent") << processPset->getParameterSet(aliasForModLabel);
396  }
397  }
398  }
399  }
400  }
401  }
402  std::string key = friendlyName + std::string(" + \"") + modLabel + std::string("\" + \"") + instanceName +
403  "\" \"" + processName + "\"";
404  ++cumulates_[key];
405 
406  if (doVerbose) {
407  //indent one level before starting to print
408  printObject(iEvent, className, modLabel, instanceName, processName, startIndent, verboseIndentation_);
409  continue;
410  }
411  if (getData_) {
412  std::string class_and_label = friendlyName + "_" + modLabel;
413  if (getModuleLabels_.empty() || binary_search_all(getModuleLabels_, modLabel) ||
414  binary_search_all(getModuleLabels_, class_and_label)) {
415  try {
417  } catch (edm::Exception const&) {
418  LogAbsolute("EventContent") << startIndent << " \"" << className << "\""
419  << " is an unknown type" << std::endl;
420  return;
421  }
423  iEvent.getByLabel(InputTag(modLabel, instanceName, processName), handle);
424  }
425  }
426  }
427  //std::cout << "Mine" << std::endl;
428  ++evno_;
429  }
std::vector< std::string > getModuleLabels_
std::map< std::string, int > cumulates_
int iEvent
Definition: GenABIO.cc:224
std::string friendlyName(std::string const &iFullName)
key
prepare the HTCondor submission files and eventually submit them
Hash< ParameterSetType > ParameterSetID
std::vector< std::string > moduleLabels_
bool binary_search_all(ForwardSequence const &s, Datum const &d)
wrappers for std::binary_search
Definition: Algorithms.h:58
Log< level::System, true > LogAbsolute
static Registry * instance()
Definition: Registry.cc:12
std::string className(const T &t)
Definition: ClassName.h:31

◆ endJob()

void edm::EventContentAnalyzer::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 432 of file EventContentAnalyzer.cc.

References cumulates_, and ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it.

432  {
433  typedef std::map<std::string, int> nameMap;
434 
435  LogAbsolute("EventContent") << "\nSummary for key being the concatenation of friendlyClassName, moduleLabel, "
436  "productInstanceName and processName"
437  << std::endl;
438  for (nameMap::const_iterator it = cumulates_.begin(), itEnd = cumulates_.end(); it != itEnd; ++it) {
439  LogAbsolute("EventContent") << std::setw(6) << it->second << " occurrences of key " << it->first << std::endl;
440  }
441  }
std::map< std::string, int > cumulates_
Log< level::System, true > LogAbsolute

◆ fillDescriptions()

void edm::EventContentAnalyzer::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 443 of file EventContentAnalyzer.cc.

References edm::ConfigurationDescriptions::add(), edm::ConfigurationDescriptions::addDefault(), submitPVResolutionJobs::desc, np, edm::ConfigurationDescriptions::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

443  {
444  descriptions.setComment(
445  "This plugin will print a list of all products in the event "
446  "provenance. It also has options to print and/or get each product.");
447 
449 
450  ParameterDescriptionNode* np;
451 
452  std::string defaultString("++");
453  np = desc.addUntracked<std::string>("indentation", defaultString);
454  np->setComment("This string is printed at the beginning of every line printed during event processing.");
455 
456  np = desc.addUntracked<bool>("verbose", false);
457  np->setComment("If true, the contents of products are printed.");
458 
459  defaultString = " ";
460  np = desc.addUntracked<std::string>("verboseIndentation", defaultString);
461  np->setComment(
462  "This string is used to further indent lines when printing the contents of products in verbose mode.");
463 
464  std::vector<std::string> defaultVString;
465 
466  np = desc.addUntracked<std::vector<std::string>>("verboseForModuleLabels", defaultVString);
467  np->setComment("If this vector is not empty, then only products with module labels on this list are printed.");
468 
469  np = desc.addUntracked<bool>("getData", false);
470  np->setComment("If true the products will be retrieved using getByLabel.");
471 
472  np = desc.addUntracked<std::vector<std::string>>("getDataForModuleLabels", defaultVString);
473  np->setComment(
474  "If this vector is not empty, then only products with module labels on this list are retrieved by getByLabel.");
475 
476  np = desc.addUntracked<bool>("listContent", true);
477  np->setComment("If true then print a list of all the event content.");
478 
479  np = desc.addUntracked<bool>("listProvenance", false);
480  np->setComment("If true, and if listContent or verbose is true, print provenance information for each product");
481 
482  desc.addUntracked<bool>("listPathStatus", false)
483  ->setComment("If true, also show PathStatus/EndPathStatus data products.");
484  descriptions.add("printContent", desc);
485  descriptions.addDefault(desc);
486  }
int np
Definition: AMPTWrapper.h:43

Member Data Documentation

◆ cumulates_

std::map<std::string, int> edm::EventContentAnalyzer::cumulates_
private

Definition at line 278 of file EventContentAnalyzer.cc.

Referenced by analyze(), and endJob().

◆ evno_

int edm::EventContentAnalyzer::evno_
private

Definition at line 277 of file EventContentAnalyzer.cc.

Referenced by analyze().

◆ getData_

bool edm::EventContentAnalyzer::getData_
private

Definition at line 276 of file EventContentAnalyzer.cc.

Referenced by analyze(), and EventContentAnalyzer().

◆ getModuleLabels_

std::vector<std::string> edm::EventContentAnalyzer::getModuleLabels_
private

Definition at line 275 of file EventContentAnalyzer.cc.

Referenced by analyze(), and EventContentAnalyzer().

◆ indentation_

std::string edm::EventContentAnalyzer::indentation_
private

Definition at line 271 of file EventContentAnalyzer.cc.

Referenced by analyze().

◆ listContent_

bool edm::EventContentAnalyzer::listContent_
private

Definition at line 279 of file EventContentAnalyzer.cc.

Referenced by analyze().

◆ listPathStatus_

bool edm::EventContentAnalyzer::listPathStatus_
private

Definition at line 281 of file EventContentAnalyzer.cc.

Referenced by analyze().

◆ listProvenance_

bool edm::EventContentAnalyzer::listProvenance_
private

Definition at line 280 of file EventContentAnalyzer.cc.

Referenced by analyze().

◆ moduleLabels_

std::vector<std::string> edm::EventContentAnalyzer::moduleLabels_
private

Definition at line 273 of file EventContentAnalyzer.cc.

Referenced by analyze(), and EventContentAnalyzer().

◆ verbose_

bool edm::EventContentAnalyzer::verbose_
private

Definition at line 274 of file EventContentAnalyzer.cc.

Referenced by analyze().

◆ verboseIndentation_

std::string edm::EventContentAnalyzer::verboseIndentation_
private

Definition at line 272 of file EventContentAnalyzer.cc.

Referenced by analyze().