CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
HLTPathSelector Class Reference

#include <HLTPathSelector.h>

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
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilterBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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_
 
std::string processName_
 
std::map< std::string, int > tmap_
 
edm::InputTag triggerEventTag_
 
const edm::EDGetTokenT
< trigger::TriggerEvent
triggerEventToken_
 
edm::InputTag triggerResultsTag_
 
const edm::EDGetTokenT
< edm::TriggerResults
triggerResultsToken_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDFilter<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
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)
 

Detailed Description

Definition at line 16 of file HLTPathSelector.h.

Constructor & Destructor Documentation

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

Definition at line 11 of file HLTPathSelector.cc.

11  :
12  verbose_(ps.getUntrackedParameter<bool>("verbose", false)),
13  processName_(ps.getParameter<std::string>("processName")),
14  hltPathsOfInterest_(ps.getParameter<std::vector<std::string> >("hltPathsOfInterest")),
15  triggerResultsTag_(ps.getUntrackedParameter<edm::InputTag>("triggerResults", edm::InputTag("TriggerResults","","HLT"))),
16  triggerEventTag_(ps.getUntrackedParameter<edm::InputTag>("triggerEvent", edm::InputTag("hltTriggerSummaryAOD","","HLT"))),
17  triggerResultsToken_(consumes<edm::TriggerResults>(triggerResultsTag_)),
18  triggerEventToken_(consumes<trigger::TriggerEvent>(triggerEventTag_))
19 {
20 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
const std::vector< std::string > hltPathsOfInterest_
edm::InputTag triggerResultsTag_
const edm::EDGetTokenT< trigger::TriggerEvent > triggerEventToken_
std::string processName_
edm::InputTag triggerEventTag_

Member Function Documentation

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 21 of file HLTPathSelector.cc.

References HLTConfigProvider::dump(), hltConfig_, hltPathsMap_, hltPathsOfInterest_, HLTConfigProvider::init(), gen::n, fed_dqm_sourceclient-live_cfg::path, processName_, HLTConfigProvider::size(), HLTConfigProvider::triggerIndex(), and HLTConfigProvider::triggerNames().

21  {
22  bool changed(true);
23  if (hltConfig_.init(iRun, iSetup, processName_, changed)) {
24  if (changed) {
25  edm::LogInfo("HLTPathSelector") << "HLT initialised";
26  hltConfig_.dump("PrescaleTable");
27  }
28  hltPathsMap_.clear();
29  const unsigned int n(hltConfig_.size());
30  const std::vector<std::string>& pathList = hltConfig_.triggerNames();
31  for (auto path: pathList) {
32  if (hltPathsOfInterest_.size()) {
33  int nmatch = 0;
34  for (auto kt: hltPathsOfInterest_)
35  nmatch += TPRegexp(kt).Match(path);
36  if (!nmatch) continue;
37  }
38  const unsigned int triggerIndex(hltConfig_.triggerIndex(path));
39  // abort on invalid trigger name
40  if (triggerIndex >= n) {
41  edm::LogError("HLTPathSelector") << "path: " << path << " - not found!";
42  continue;
43  }
44  hltPathsMap_[path] = triggerIndex;
45  }
46  }
47  else
48  edm::LogError("HLTPathSelector")
49  << " config extraction failure with process name "
50  << processName_;
51 }
unsigned int size() const
number of trigger paths in trigger table
void dump(const std::string &what) const
Dumping config info to cout.
HLTConfigProvider hltConfig_
std::map< std::string, unsigned int > hltPathsMap_
const std::vector< std::string > & triggerNames() const
names of trigger paths
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
const std::vector< std::string > hltPathsOfInterest_
std::string processName_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
void HLTPathSelector::endJob ( void  )
private

Definition at line 95 of file HLTPathSelector.cc.

References tmap_.

95  {
96 
97  edm::LogInfo("HLTPathSelector")
98  << setw(32) << "HLT Path"
99  << setw(9) << "ACCEPT";
100  for (auto const& jt: tmap_)
101  edm::LogInfo("HLTPathSelector")
102  << setw(9) << jt.second;
103 }
std::map< std::string, int > tmap_
bool HLTPathSelector::filter ( edm::Event iEvent,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

Implements edm::stream::EDFilterBase.

Definition at line 52 of file HLTPathSelector.cc.

References assert(), edm::Event::getByToken(), hltConfig_, hltPathsMap_, edm::HandleBase::isValid(), fed_dqm_sourceclient-live_cfg::path, HLTConfigProvider::size(), AlCaHLTBitMon_QueryRunRegistry::string, tmap_, triggerEventToken_, edm::TriggerNames::triggerIndex(), edm::Event::triggerNames(), triggerResultsToken_, and verbose_.

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

52  {
53  // get event products
54  edm::Handle<edm::TriggerResults> triggerResultsHandle_;
55  iEvent.getByToken(triggerResultsToken_, triggerResultsHandle_);
56  if (!triggerResultsHandle_.isValid()) {
57  edm::LogError("HLTPathSelector") << "Error in getting TriggerResults product from Event!";
58  return false;
59  }
60 
61  edm::Handle<trigger::TriggerEvent> triggerEventHandle_;
62  iEvent.getByToken(triggerEventToken_, triggerEventHandle_);
63  if (!triggerEventHandle_.isValid()) {
64  edm::LogError("HLTPathSelector") << "Error in getting TriggerEvent product from Event!";
65  return false;
66  }
67  // sanity check
68  assert(triggerResultsHandle_->size() == hltConfig_.size());
69 
70  int flag = 0;
71  for (auto const& it: hltPathsMap_) {
72  const std::string path(it.first);
73  const unsigned int triggerIndex(it.second);
74  assert(triggerIndex == iEvent.triggerNames(*triggerResultsHandle_).triggerIndex(path));
75 
76  // Results from TriggerResults product
77  if (verbose_)
78  edm::LogInfo("HLTPathSelector")
79  << " Trigger path <" << path << "> status:"
80  << " WasRun=" << triggerResultsHandle_->wasrun(triggerIndex)
81  << " Accept=" << triggerResultsHandle_->accept(triggerIndex)
82  << " Error=" << triggerResultsHandle_->error(triggerIndex);
83 
84  if (triggerResultsHandle_->wasrun(triggerIndex) && triggerResultsHandle_->accept(triggerIndex)) {
85  ++flag;
86  if (tmap_.find(path) == tmap_.end())
87  tmap_[path] = 1;
88  else
89  tmap_[path]++;
90  }
91  }
92  if (flag > 0) return true;
93  return false;
94 }
unsigned int size() const
number of trigger paths in trigger table
HLTConfigProvider hltConfig_
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:220
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
std::map< std::string, unsigned int > hltPathsMap_
assert(m_qm.get())
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
bool isValid() const
Definition: HandleBase.h:75
std::map< std::string, int > tmap_
const edm::EDGetTokenT< trigger::TriggerEvent > triggerEventToken_

Member Data Documentation

HLTConfigProvider HLTPathSelector::hltConfig_
private

Definition at line 36 of file HLTPathSelector.h.

Referenced by beginRun(), and filter().

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

Definition at line 38 of file HLTPathSelector.h.

Referenced by beginRun(), and filter().

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

Definition at line 30 of file HLTPathSelector.h.

Referenced by beginRun().

std::string HLTPathSelector::processName_
private

Definition at line 29 of file HLTPathSelector.h.

Referenced by beginRun().

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

Definition at line 39 of file HLTPathSelector.h.

Referenced by endJob(), and filter().

edm::InputTag HLTPathSelector::triggerEventTag_
private

Definition at line 32 of file HLTPathSelector.h.

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

Definition at line 34 of file HLTPathSelector.h.

Referenced by filter().

edm::InputTag HLTPathSelector::triggerResultsTag_
private

Definition at line 31 of file HLTPathSelector.h.

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

Definition at line 33 of file HLTPathSelector.h.

Referenced by filter().

bool HLTPathSelector::verbose_
private

Definition at line 28 of file HLTPathSelector.h.

Referenced by filter().