CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
HLTPathSelector Class Reference
Inheritance diagram for HLTPathSelector:
edm::stream::EDFilter<> edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HLTPathSelector (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::EDFilter<>
 EDFilter ()=default
 
 EDFilter (const EDFilter &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDFilteroperator= (const EDFilter &)=delete
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
 EDFilterBase (const EDFilterBase &)=delete
 
ModuleDescription const & moduleDescription () const
 
const EDFilterBaseoperator= (const EDFilterBase &)=delete
 
 ~EDFilterBase () override
 
- Public Member Functions inherited from edm::ProducerBase
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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) 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 (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginRun (edm::Run const &, edm::EventSetup const &) override
 
void endJob ()
 
bool filter (edm::Event &, edm::EventSetup const &) override
 

Private Attributes

HLTConfigProvider hltConfig_
 
std::map< std::string, unsigned int > hltPathsMap_
 
const std::vector< std::string > hltPathsOfInterest_
 
const std::string processName_
 
std::map< std::string, int > tmap_
 
const edm::InputTag triggerEventTag_
 
const edm::EDGetTokenT< trigger::TriggerEventtriggerEventToken_
 
const edm::InputTag triggerResultsTag_
 
const edm::EDGetTokenT< edm::TriggerResultstriggerResultsToken_
 
const bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDFilter<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- 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 23 of file HLTPathSelector.cc.

Constructor & Destructor Documentation

◆ HLTPathSelector()

HLTPathSelector::HLTPathSelector ( const edm::ParameterSet ps)
explicit

Definition at line 62 of file HLTPathSelector.cc.

63  : verbose_(ps.getUntrackedParameter<bool>("verbose", false)),
64  processName_(ps.getParameter<std::string>("processName")),
65  hltPathsOfInterest_(ps.getParameter<std::vector<std::string> >("hltPathsOfInterest")),
67  ps.getUntrackedParameter<edm::InputTag>("triggerResults", edm::InputTag("TriggerResults", "", "HLT"))),
69  ps.getUntrackedParameter<edm::InputTag>("triggerEvent", edm::InputTag("hltTriggerSummaryAOD", "", "HLT"))),
70  triggerResultsToken_(consumes<edm::TriggerResults>(triggerResultsTag_)),
71  triggerEventToken_(consumes<trigger::TriggerEvent>(triggerEventTag_)) {}
const edm::InputTag triggerEventTag_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
const edm::InputTag triggerResultsTag_
T getUntrackedParameter(std::string const &, T const &) const
const std::vector< std::string > hltPathsOfInterest_
const std::string processName_
const edm::EDGetTokenT< trigger::TriggerEvent > triggerEventToken_
const bool verbose_

Member Function Documentation

◆ beginRun()

void HLTPathSelector::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 73 of file HLTPathSelector.cc.

References HLTConfigProvider::dump(), hltConfig_, hltPathsMap_, hltPathsOfInterest_, HLTConfigProvider::init(), dqmiodumpmetadata::n, castor_dqm_sourceclient_file_cfg::path, processName_, HLTConfigProvider::size(), HLTConfigProvider::triggerIndex(), and HLTConfigProvider::triggerNames().

73  {
74  bool changed(true);
75  if (hltConfig_.init(iRun, iSetup, processName_, changed)) {
76  if (changed) {
77  edm::LogInfo("HLTPathSelector") << "HLT initialised";
78  hltConfig_.dump("PrescaleTable");
79  }
80  hltPathsMap_.clear();
81  const unsigned int n(hltConfig_.size());
82  const std::vector<std::string>& pathList = hltConfig_.triggerNames();
83  for (const auto& path : pathList) {
84  if (!hltPathsOfInterest_.empty()) {
85  int nmatch = 0;
86  for (const auto& kt : hltPathsOfInterest_)
87  nmatch += TPRegexp(kt).Match(path);
88  if (!nmatch)
89  continue;
90  }
91  const unsigned int triggerIndex(hltConfig_.triggerIndex(path));
92  // abort on invalid trigger name
93  if (triggerIndex >= n) {
94  edm::LogError("HLTPathSelector") << "path: " << path << " - not found!";
95  continue;
96  }
97  hltPathsMap_[path] = triggerIndex;
98  }
99  } else
100  edm::LogError("HLTPathSelector") << " config extraction failure with process name " << processName_;
101 }
HLTConfigProvider hltConfig_
std::map< std::string, unsigned int > hltPathsMap_
Log< level::Error, false > LogError
const std::vector< std::string > hltPathsOfInterest_
void dump(const std::string &what) const
Dumping config info to cout.
const std::string processName_
unsigned int size() const
number of trigger paths in trigger table
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
Log< level::Info, false > LogInfo
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
const std::vector< std::string > & triggerNames() const
names of trigger paths

◆ endJob()

void HLTPathSelector::endJob ( void  )
private

Definition at line 147 of file HLTPathSelector.cc.

References tmap_.

147  {
148  edm::LogInfo("HLTPathSelector") << setw(32) << "HLT Path" << setw(9) << "ACCEPT";
149  for (auto const& jt : tmap_)
150  edm::LogInfo("HLTPathSelector") << setw(9) << jt.second;
151 }
Log< level::Info, false > LogInfo
std::map< std::string, int > tmap_

◆ fillDescriptions()

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

Definition at line 52 of file HLTPathSelector.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

52  {
54  desc.addUntracked<bool>("verbose", false);
55  desc.add<std::string>("processName", std::string(""));
56  desc.add<std::vector<std::string> >("hltPathsOfInterest", {});
57  desc.addUntracked<edm::InputTag>("triggerResults", edm::InputTag("TriggerResults", "", "HLT"));
58  desc.addUntracked<edm::InputTag>("triggerEvent", edm::InputTag("hltTriggerSummaryAOD", "", "HLT"));
59  descriptions.addWithDefaultLabel(desc);
60 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ filter()

bool HLTPathSelector::filter ( edm::Event iEvent,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

Implements edm::stream::EDFilterBase.

Definition at line 103 of file HLTPathSelector.cc.

References edm::HLTGlobalStatus::accept(), cms::cuda::assert(), edm::HLTGlobalStatus::error(), RemoveAddSevLevel::flag, hltConfig_, hltPathsMap_, iEvent, edm::HandleBase::isValid(), castor_dqm_sourceclient_file_cfg::path, edm::HLTGlobalStatus::size(), HLTConfigProvider::size(), AlCaHLTBitMon_QueryRunRegistry::string, tmap_, triggerEventToken_, triggerResultsToken_, verbose_, and edm::HLTGlobalStatus::wasrun().

103  {
104  // get event products
105  edm::Handle<edm::TriggerResults> triggerResultsHandle_;
106  iEvent.getByToken(triggerResultsToken_, triggerResultsHandle_);
107  if (!triggerResultsHandle_.isValid()) {
108  edm::LogError("HLTPathSelector") << "Error in getting TriggerResults product from Event!";
109  return false;
110  }
111 
112  edm::Handle<trigger::TriggerEvent> triggerEventHandle_;
113  iEvent.getByToken(triggerEventToken_, triggerEventHandle_);
114  if (!triggerEventHandle_.isValid()) {
115  edm::LogError("HLTPathSelector") << "Error in getting TriggerEvent product from Event!";
116  return false;
117  }
118  // sanity check
119  assert(triggerResultsHandle_->size() == hltConfig_.size());
120 
121  int flag = 0;
122  for (auto const& it : hltPathsMap_) {
123  const std::string path(it.first);
124  const unsigned int triggerIndex(it.second);
125  assert(triggerIndex == iEvent.triggerNames(*triggerResultsHandle_).triggerIndex(path));
126 
127  // Results from TriggerResults product
128  if (verbose_)
129  edm::LogInfo("HLTPathSelector") << " Trigger path <" << path << "> status:"
130  << " WasRun=" << triggerResultsHandle_->wasrun(triggerIndex)
131  << " Accept=" << triggerResultsHandle_->accept(triggerIndex)
132  << " Error=" << triggerResultsHandle_->error(triggerIndex);
133 
134  if (triggerResultsHandle_->wasrun(triggerIndex) && triggerResultsHandle_->accept(triggerIndex)) {
135  ++flag;
136  if (tmap_.find(path) == tmap_.end())
137  tmap_[path] = 1;
138  else
139  tmap_[path]++;
140  }
141  }
142  if (flag > 0)
143  return true;
144  return false;
145 }
bool accept() const
Has at least one path accepted the event?
HLTConfigProvider hltConfig_
bool error() const
Has any path encountered an error (exception)
std::map< std::string, unsigned int > hltPathsMap_
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
Log< level::Error, false > LogError
assert(be >=bs)
bool wasrun() const
Was at least one path run?
unsigned int size() const
Get number of paths stored.
int iEvent
Definition: GenABIO.cc:224
unsigned int size() const
number of trigger paths in trigger table
Log< level::Info, false > LogInfo
std::map< std::string, int > tmap_
const edm::EDGetTokenT< trigger::TriggerEvent > triggerEventToken_
const bool verbose_
bool isValid() const
Definition: HandleBase.h:70

Member Data Documentation

◆ hltConfig_

HLTConfigProvider HLTPathSelector::hltConfig_
private

Definition at line 43 of file HLTPathSelector.cc.

Referenced by beginRun(), and filter().

◆ hltPathsMap_

std::map<std::string, unsigned int> HLTPathSelector::hltPathsMap_
private

Definition at line 45 of file HLTPathSelector.cc.

Referenced by beginRun(), and filter().

◆ hltPathsOfInterest_

const std::vector<std::string> HLTPathSelector::hltPathsOfInterest_
private

Definition at line 37 of file HLTPathSelector.cc.

Referenced by beginRun().

◆ processName_

const std::string HLTPathSelector::processName_
private

Definition at line 36 of file HLTPathSelector.cc.

Referenced by beginRun().

◆ tmap_

std::map<std::string, int> HLTPathSelector::tmap_
private

Definition at line 46 of file HLTPathSelector.cc.

Referenced by endJob(), and filter().

◆ triggerEventTag_

const edm::InputTag HLTPathSelector::triggerEventTag_
private

Definition at line 39 of file HLTPathSelector.cc.

◆ triggerEventToken_

const edm::EDGetTokenT<trigger::TriggerEvent> HLTPathSelector::triggerEventToken_
private

Definition at line 41 of file HLTPathSelector.cc.

Referenced by filter().

◆ triggerResultsTag_

const edm::InputTag HLTPathSelector::triggerResultsTag_
private

Definition at line 38 of file HLTPathSelector.cc.

◆ triggerResultsToken_

const edm::EDGetTokenT<edm::TriggerResults> HLTPathSelector::triggerResultsToken_
private

Definition at line 40 of file HLTPathSelector.cc.

Referenced by filter().

◆ verbose_

const bool HLTPathSelector::verbose_
private

Definition at line 35 of file HLTPathSelector.cc.

Referenced by filter().