CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
HLTHighLevel Class Reference

#include <HLTHighLevel.h>

Inheritance diagram for HLTHighLevel:
edm::stream::EDFilter<> edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

bool filter (edm::Event &, const edm::EventSetup &) override
 
 HLTHighLevel (const edm::ParameterSet &)
 
std::vector< std::string > pathsFromSetup (const std::string &key, const edm::Event &, const edm::EventSetup &iSetup) const
 get HLTPaths with key 'key' from EventSetup (AlCaRecoTriggerBitsRcd) More...
 
- 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices 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 init (const edm::TriggerResults &results, const edm::Event &, const edm::EventSetup &iSetup, const edm::TriggerNames &triggerNames)
 initialize the trigger conditions (call this if the trigger paths have changed) More...
 
std::string const & moduleLabel () const
 
std::string const & pathName (const edm::Event &) const
 stolen from HLTFilter More...
 

Private Attributes

edm::ESGetToken< AlCaRecoTriggerBits, AlCaRecoTriggerBitsRcdalcaRecotriggerBitsToken_
 ESGetToken to read AlCaRecoTriggerBits. More...
 
bool andOr_
 false = and-mode (all requested triggers), true = or-mode (at least one) More...
 
const std::string eventSetupPathsKey_
 not empty => use read paths from AlCaRecoTriggerBitsRcd via this key More...
 
std::vector< unsigned int > HLTPathsByIndex_
 list of required HLT triggers by HLT index More...
 
std::vector< std::string > HLTPathsByName_
 list of required HLT triggers by HLT name More...
 
std::vector< std::string > HLTPatterns_
 input patterns that will be expanded into trigger names More...
 
edm::InputTag inputTag_
 HLT TriggerResults EDProduct. More...
 
edm::EDGetTokenT< edm::TriggerResultsinputToken_
 
bool throw_
 throw on any requested trigger being unknown More...
 
edm::ParameterSetID triggerNamesID_
 HLT trigger names. More...
 
std::optional< edm::ESWatcher< AlCaRecoTriggerBitsRcd > > watchAlCaRecoTriggerBitsRcd_
 Watcher to be created and used if 'eventSetupPathsKey_' non empty: More...
 

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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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

See header file for documentation

Author
Martin Grunewald

This class is an HLTFilter (-> EDFilter) implementing filtering on HLT bits

Author
Martin Grunewald

Definition at line 42 of file HLTHighLevel.h.

Constructor & Destructor Documentation

◆ HLTHighLevel()

HLTHighLevel::HLTHighLevel ( const edm::ParameterSet iConfig)
explicit

Definition at line 36 of file HLTHighLevel.cc.

References alcaRecotriggerBitsToken_, eventSetupPathsKey_, Exception, edm::ParameterSet::getParameter(), HLTPatterns_, AlCaHLTBitMon_QueryRunRegistry::string, and watchAlCaRecoTriggerBitsRcd_.

37  : inputTag_(iConfig.getParameter<edm::InputTag>("TriggerResultsTag")),
38  inputToken_(consumes<edm::TriggerResults>(inputTag_)),
40  andOr_(iConfig.getParameter<bool>("andOr")),
41  throw_(iConfig.getParameter<bool>("throw")),
42  eventSetupPathsKey_(iConfig.getParameter<std::string>("eventSetupPathsKey")),
43  HLTPatterns_(iConfig.getParameter<std::vector<std::string> >("HLTPaths")),
46  // names and slot numbers are computed during the event loop,
47  // as they need to access the TriggerNames object via the TriggerResults
48 
49  if (!eventSetupPathsKey_.empty()) {
50  // If paths come from eventsetup, we must watch for IOV changes.
51  if (!HLTPatterns_.empty()) {
52  // We do not want double trigger path setting, so throw!
53  throw cms::Exception("Configuration")
54  << " HLTHighLevel instance: " << iConfig.getParameter<std::string>("@module_label") << "\n configured with "
55  << HLTPatterns_.size() << " HLTPaths and\n"
56  << " eventSetupPathsKey " << eventSetupPathsKey_ << ", choose either of them.";
57  }
58  alcaRecotriggerBitsToken_ = esConsumes<AlCaRecoTriggerBits, AlCaRecoTriggerBitsRcd>();
60  }
61 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bool andOr_
false = and-mode (all requested triggers), true = or-mode (at least one)
Definition: HLTHighLevel.h:69
std::vector< unsigned int > HLTPathsByIndex_
list of required HLT triggers by HLT index
Definition: HLTHighLevel.h:92
edm::ParameterSetID triggerNamesID_
HLT trigger names.
Definition: HLTHighLevel.h:66
std::optional< edm::ESWatcher< AlCaRecoTriggerBitsRcd > > watchAlCaRecoTriggerBitsRcd_
Watcher to be created and used if &#39;eventSetupPathsKey_&#39; non empty:
Definition: HLTHighLevel.h:81
edm::ESGetToken< AlCaRecoTriggerBits, AlCaRecoTriggerBitsRcd > alcaRecotriggerBitsToken_
ESGetToken to read AlCaRecoTriggerBits.
Definition: HLTHighLevel.h:83
edm::EDGetTokenT< edm::TriggerResults > inputToken_
Definition: HLTHighLevel.h:63
const std::string eventSetupPathsKey_
not empty => use read paths from AlCaRecoTriggerBitsRcd via this key
Definition: HLTHighLevel.h:79
bool throw_
throw on any requested trigger being unknown
Definition: HLTHighLevel.h:72
std::vector< std::string > HLTPathsByName_
list of required HLT triggers by HLT name
Definition: HLTHighLevel.h:89
std::vector< std::string > HLTPatterns_
input patterns that will be expanded into trigger names
Definition: HLTHighLevel.h:86
edm::InputTag inputTag_
HLT TriggerResults EDProduct.
Definition: HLTHighLevel.h:62

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 67 of file HLTHighLevel.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, HLTSiStripMonitoring_cff::hltPaths, HLT_2022v15_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

67  {
69  desc.add<edm::InputTag>("TriggerResultsTag", edm::InputTag("TriggerResults", "", "HLT"));
70  std::vector<std::string> hltPaths(0);
71  // # provide list of HLT paths (or patterns) you want
72  desc.add<std::vector<std::string> >("HLTPaths", hltPaths);
73  // # not empty => use read paths from AlCaRecoTriggerBitsRcd via this key
74  desc.add<std::string>("eventSetupPathsKey", "");
75  // # how to deal with multiple triggers: True (OR) accept if ANY is true, False (AND) accept if ALL are true
76  desc.add<bool>("andOr", true);
77  // # throw exception on unknown path names
78  desc.add<bool>("throw", true);
79  descriptions.add("hltHighLevel", desc);
80 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ filter()

bool HLTHighLevel::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::stream::EDFilterBase.

Definition at line 194 of file HLTHighLevel.cc.

References accept(), edm::HLTGlobalStatus::accept(), andOr_, edm::InputTag::encode(), Exception, HLTPathsByIndex_, HLTPathsByName_, mps_fire::i, iEvent, init(), inputTag_, inputToken_, edm::HandleBase::isValid(), LogDebug, LogTrace, moduleLabel(), dqmiodumpmetadata::n, or, pathName(), edm::HLTGlobalStatus::size(), AlCaHLTBitMon_QueryRunRegistry::string, throw_, L1TEGammaOffline_cfi::triggerNames, triggerNamesID_, and watchAlCaRecoTriggerBitsRcd_.

194  {
195  using namespace std;
196  using namespace edm;
197 
198  // get hold of TriggerResults Object
200  iEvent.getByToken(inputToken_, trh);
201  if (trh.isValid()) {
202  LogDebug("HLTHighLevel") << "TriggerResults found, number of HLT paths: " << trh->size();
203  } else {
204  LogError("HLTHighLevel") << "TriggerResults product " << inputTag_.encode()
205  << " not found - returning result=false!";
206  return false;
207  }
208 
209  // init the TriggerNames with the TriggerResults
210  const edm::TriggerNames& triggerNames = iEvent.triggerNames(*trh);
211  bool config_changed = false;
212  if (triggerNamesID_ != triggerNames.parameterSetID()) {
213  triggerNamesID_ = triggerNames.parameterSetID();
214  config_changed = true;
215  }
216 
217  // (re)run the initialization stuff if
218  // - this is the first event
219  // - or the HLT table has changed
220  // - or selected trigger bits come from AlCaRecoTriggerBitsRcd and these changed
221  if (config_changed or (watchAlCaRecoTriggerBitsRcd_ and watchAlCaRecoTriggerBitsRcd_->check(iSetup))) {
222  this->init(*trh, iEvent, iSetup, triggerNames);
223  }
224  unsigned int n = HLTPathsByName_.size();
225  unsigned int nbad = 0;
226  unsigned int fired = 0;
227 
228  // count invalid and fired triggers
229  for (unsigned int i = 0; i < n; i++)
230  if (HLTPathsByIndex_[i] == (unsigned int)-1)
231  ++nbad;
232  else if (trh->accept(HLTPathsByIndex_[i]))
233  ++fired;
234 
235  if ((nbad > 0) and (config_changed or throw_)) {
236  // only generate the error message if it's actually going to be used
237  std::string message;
238 
239  for (unsigned int i = 0; i < n; i++)
240  if (HLTPathsByIndex_[i] == (unsigned int)-1)
241  message += HLTPathsByName_[i] + " ";
242 
243  if (config_changed) {
244  LogTrace("HLTHighLevel") << " HLTHighLevel [instance: " << moduleLabel() << " - path: " << pathName(iEvent)
245  << "] configured with " << nbad << "/" << n << " unknown HLT path names: " << message;
246  }
247 
248  if (throw_) {
249  throw cms::Exception("Configuration")
250  << " HLTHighLevel [instance: " << moduleLabel() << " - path: " << pathName(iEvent) << "] configured with "
251  << nbad << "/" << n << " unknown HLT path names: " << message;
252  }
253  }
254 
255  // Boolean filter result (always at least one trigger)
256  const bool accept((fired > 0) and (andOr_ or (fired == n - nbad)));
257  LogDebug("HLTHighLevel") << "Accept = " << std::boolalpha << accept;
258 
259  return accept;
260 }
bool accept() const
Has at least one path accepted the event?
std::string encode() const
Definition: InputTag.cc:159
void init(const edm::TriggerResults &results, const edm::Event &, const edm::EventSetup &iSetup, const edm::TriggerNames &triggerNames)
initialize the trigger conditions (call this if the trigger paths have changed)
Definition: HLTHighLevel.cc:86
bool andOr_
false = and-mode (all requested triggers), true = or-mode (at least one)
Definition: HLTHighLevel.h:69
Log< level::Error, false > LogError
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
#define LogTrace(id)
std::string const & moduleLabel() const
unsigned int size() const
Get number of paths stored.
int iEvent
Definition: GenABIO.cc:224
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
std::vector< unsigned int > HLTPathsByIndex_
list of required HLT triggers by HLT index
Definition: HLTHighLevel.h:92
edm::ParameterSetID triggerNamesID_
HLT trigger names.
Definition: HLTHighLevel.h:66
std::optional< edm::ESWatcher< AlCaRecoTriggerBitsRcd > > watchAlCaRecoTriggerBitsRcd_
Watcher to be created and used if &#39;eventSetupPathsKey_&#39; non empty:
Definition: HLTHighLevel.h:81
edm::EDGetTokenT< edm::TriggerResults > inputToken_
Definition: HLTHighLevel.h:63
bool isValid() const
Definition: HandleBase.h:70
bool throw_
throw on any requested trigger being unknown
Definition: HLTHighLevel.h:72
HLT enums.
std::vector< std::string > HLTPathsByName_
list of required HLT triggers by HLT name
Definition: HLTHighLevel.h:89
edm::InputTag inputTag_
HLT TriggerResults EDProduct.
Definition: HLTHighLevel.h:62
#define LogDebug(id)
std::string const & pathName(const edm::Event &) const
stolen from HLTFilter

◆ init()

void HLTHighLevel::init ( const edm::TriggerResults results,
const edm::Event event,
const edm::EventSetup iSetup,
const edm::TriggerNames triggerNames 
)
private

initialize the trigger conditions (call this if the trigger paths have changed)

Definition at line 86 of file HLTHighLevel.cc.

References andOr_, edm::InputTag::encode(), eventSetupPathsKey_, Exception, HLTPathsByIndex_, HLTPathsByName_, HLTPatterns_, mps_fire::i, inputTag_, createfilelist::int, edm::is_glob(), LogDebug, LogTrace, match(), oniaPATMuonsWithTrigger_cff::matches, dqmiodumpmetadata::n, pathsFromSetup(), topSingleLeptonDQM_PU_cfi::pattern, edm::regexMatch(), mps_fire::result, throw_, L1TEGammaOffline_cfi::triggerNames, and validateGeometry_cfg::valid.

Referenced by filter().

89  {
90  unsigned int n;
91 
92  // clean up old data
93  HLTPathsByName_.clear();
94  HLTPathsByIndex_.clear();
95 
96  // Overwrite paths from EventSetup via AlCaRecoTriggerBitsRcd if configured:
97  if (!eventSetupPathsKey_.empty()) {
98  HLTPatterns_ = this->pathsFromSetup(eventSetupPathsKey_, event, iSetup);
99  }
100 
101  if (HLTPatterns_.empty()) {
102  // for empty input vector, default to all HLT trigger paths
103  n = result.size();
104  HLTPathsByName_.resize(n);
105  HLTPathsByIndex_.resize(n);
106  for (unsigned int i = 0; i < n; ++i) {
107  HLTPathsByName_[i] = triggerNames.triggerName(i);
108  HLTPathsByIndex_[i] = i;
109  }
110  } else {
111  // otherwise, expand wildcards in trigger names...
112  for (auto const& pattern : HLTPatterns_) {
113  if (edm::is_glob(pattern)) {
114  // found a glob pattern, expand it
115  std::vector<std::vector<std::string>::const_iterator> matches =
116  edm::regexMatch(triggerNames.triggerNames(), pattern);
117  if (matches.empty()) {
118  // pattern does not match any trigger paths
119  if (throw_)
120  throw cms::Exception("Configuration")
121  << "requested pattern \"" << pattern << "\" does not match any HLT paths";
122  else
123  edm::LogInfo("Configuration") << "requested pattern \"" << pattern << "\" does not match any HLT paths";
124  } else {
125  // store the matching patterns
126  for (auto const& match : matches)
127  HLTPathsByName_.push_back(*match);
128  }
129  } else {
130  // found a trigger name, just copy it
131  HLTPathsByName_.push_back(pattern);
132  }
133  }
134  n = HLTPathsByName_.size();
135 
136  // ...and get hold of trigger indices
137  bool valid = false;
138  HLTPathsByIndex_.resize(n);
139  for (unsigned int i = 0; i < HLTPathsByName_.size(); i++) {
140  HLTPathsByIndex_[i] = triggerNames.triggerIndex(HLTPathsByName_[i]);
141  if (HLTPathsByIndex_[i] < result.size()) {
142  valid = true;
143  } else {
144  // trigger path not found
145  HLTPathsByIndex_[i] = (unsigned int)-1;
146  if (throw_)
147  throw cms::Exception("Configuration") << "requested HLT path \"" << HLTPathsByName_[i] << "\" does not exist";
148  else
149  edm::LogInfo("Configuration") << "requested HLT path \"" << HLTPathsByName_[i] << "\" does not exist";
150  }
151  }
152 
153  if (not valid) {
154  // no point in throwing - if requested, it should have already happened
155  edm::LogWarning("Configuration")
156  << "none of the requested paths and pattern match any HLT path - no events will be selected";
157  }
158  }
159 
160  // report on what is finally used
161  LogDebug("HLTHighLevel") << "HLT trigger paths: " + inputTag_.encode() << " - Number of paths: " << n
162  << " - andOr mode: " << andOr_ << " - throw mode: " << throw_;
163 
164  LogTrace("HLTHighLevel") << "The HLT trigger paths (# index name):";
165  for (unsigned int i = 0; i < n; ++i)
166  if (HLTPathsByIndex_[i] == (unsigned int)-1)
167  LogTrace("HLTHighLevel") << " n/a " << HLTPathsByName_[i];
168  else
169  LogTrace("HLTHighLevel") << " " << std::setw(4) << HLTPathsByIndex_[i] << " " << HLTPathsByName_[i];
170 }
std::string encode() const
Definition: InputTag.cc:159
bool is_glob(std::string const &pattern)
Definition: RegexMatch.cc:17
bool andOr_
false = and-mode (all requested triggers), true = or-mode (at least one)
Definition: HLTHighLevel.h:69
#define LogTrace(id)
std::vector< unsigned int > HLTPathsByIndex_
list of required HLT triggers by HLT index
Definition: HLTHighLevel.h:92
std::vector< std::string > pathsFromSetup(const std::string &key, const edm::Event &, const edm::EventSetup &iSetup) const
get HLTPaths with key &#39;key&#39; from EventSetup (AlCaRecoTriggerBitsRcd)
Log< level::Info, false > LogInfo
const std::string eventSetupPathsKey_
not empty => use read paths from AlCaRecoTriggerBitsRcd via this key
Definition: HLTHighLevel.h:79
std::vector< std::vector< std::string >::const_iterator > regexMatch(std::vector< std::string > const &strings, std::regex const &regexp)
Definition: RegexMatch.cc:26
bool throw_
throw on any requested trigger being unknown
Definition: HLTHighLevel.h:72
std::vector< std::string > HLTPathsByName_
list of required HLT triggers by HLT name
Definition: HLTHighLevel.h:89
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
Log< level::Warning, false > LogWarning
std::vector< std::string > HLTPatterns_
input patterns that will be expanded into trigger names
Definition: HLTHighLevel.h:86
edm::InputTag inputTag_
HLT TriggerResults EDProduct.
Definition: HLTHighLevel.h:62
#define LogDebug(id)

◆ moduleLabel()

std::string const & HLTHighLevel::moduleLabel ( ) const
private

Definition at line 266 of file HLTHighLevel.cc.

References edm::stream::EDFilterBase::moduleDescription(), and edm::ModuleDescription::moduleLabel().

Referenced by filter(), and pathsFromSetup().

266 { return moduleDescription().moduleLabel(); }
std::string const & moduleLabel() const
ModuleDescription const & moduleDescription() const
Definition: EDFilterBase.h:61

◆ pathName()

std::string const & HLTHighLevel::pathName ( const edm::Event event) const
private

stolen from HLTFilter

Definition at line 262 of file HLTHighLevel.cc.

Referenced by filter(), and pathsFromSetup().

262  {
263  return event.moduleCallingContext()->placeInPathContext()->pathContext()->pathName();
264 }

◆ pathsFromSetup()

std::vector< std::string > HLTHighLevel::pathsFromSetup ( const std::string &  key,
const edm::Event event,
const edm::EventSetup iSetup 
) const

get HLTPaths with key 'key' from EventSetup (AlCaRecoTriggerBitsRcd)

Definition at line 173 of file HLTHighLevel.cc.

References alcaRecotriggerBitsToken_, Exception, edm::EventSetup::getData(), crabWrapper::key, moduleLabel(), and pathName().

Referenced by init().

175  {
176  // Get map of strings to concatenated list of names of HLT paths from EventSetup:
177  const auto& triggerBits = iSetup.getData(alcaRecotriggerBitsToken_);
178  typedef std::map<std::string, std::string> TriggerMap;
179  const TriggerMap& triggerMap = triggerBits.m_alcarecoToTrig;
180 
181  auto listIter = triggerMap.find(key);
182  if (listIter == triggerMap.end()) {
183  throw cms::Exception("Configuration")
184  << " HLTHighLevel [instance: " << moduleLabel() << " - path: " << pathName(event)
185  << "]: No triggerList with key " << key << " in AlCaRecoTriggerBitsRcd";
186  }
187 
188  // We must avoid a map<string,vector<string> > in DB for performance reason,
189  // so the paths are mapped into one string that we have to decompose:
190  return triggerBits.decompose(listIter->second);
191 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::string const & moduleLabel() const
edm::ESGetToken< AlCaRecoTriggerBits, AlCaRecoTriggerBitsRcd > alcaRecotriggerBitsToken_
ESGetToken to read AlCaRecoTriggerBits.
Definition: HLTHighLevel.h:83
Definition: event.py:1
std::string const & pathName(const edm::Event &) const
stolen from HLTFilter

Member Data Documentation

◆ alcaRecotriggerBitsToken_

edm::ESGetToken<AlCaRecoTriggerBits, AlCaRecoTriggerBitsRcd> HLTHighLevel::alcaRecotriggerBitsToken_
private

ESGetToken to read AlCaRecoTriggerBits.

Definition at line 83 of file HLTHighLevel.h.

Referenced by HLTHighLevel(), and pathsFromSetup().

◆ andOr_

bool HLTHighLevel::andOr_
private

false = and-mode (all requested triggers), true = or-mode (at least one)

Definition at line 69 of file HLTHighLevel.h.

Referenced by filter(), and init().

◆ eventSetupPathsKey_

const std::string HLTHighLevel::eventSetupPathsKey_
private

not empty => use read paths from AlCaRecoTriggerBitsRcd via this key

Definition at line 79 of file HLTHighLevel.h.

Referenced by HLTHighLevel(), and init().

◆ HLTPathsByIndex_

std::vector<unsigned int> HLTHighLevel::HLTPathsByIndex_
private

list of required HLT triggers by HLT index

Definition at line 92 of file HLTHighLevel.h.

Referenced by filter(), and init().

◆ HLTPathsByName_

std::vector<std::string> HLTHighLevel::HLTPathsByName_
private

list of required HLT triggers by HLT name

Definition at line 89 of file HLTHighLevel.h.

Referenced by filter(), and init().

◆ HLTPatterns_

std::vector<std::string> HLTHighLevel::HLTPatterns_
private

input patterns that will be expanded into trigger names

Definition at line 86 of file HLTHighLevel.h.

Referenced by HLTHighLevel(), and init().

◆ inputTag_

edm::InputTag HLTHighLevel::inputTag_
private

HLT TriggerResults EDProduct.

Definition at line 62 of file HLTHighLevel.h.

Referenced by filter(), and init().

◆ inputToken_

edm::EDGetTokenT<edm::TriggerResults> HLTHighLevel::inputToken_
private

Definition at line 63 of file HLTHighLevel.h.

Referenced by filter().

◆ throw_

bool HLTHighLevel::throw_
private

throw on any requested trigger being unknown

Definition at line 72 of file HLTHighLevel.h.

Referenced by filter(), and init().

◆ triggerNamesID_

edm::ParameterSetID HLTHighLevel::triggerNamesID_
private

HLT trigger names.

Definition at line 66 of file HLTHighLevel.h.

Referenced by filter().

◆ watchAlCaRecoTriggerBitsRcd_

std::optional<edm::ESWatcher<AlCaRecoTriggerBitsRcd> > HLTHighLevel::watchAlCaRecoTriggerBitsRcd_
private

Watcher to be created and used if 'eventSetupPathsKey_' non empty:

Definition at line 81 of file HLTHighLevel.h.

Referenced by filter(), and HLTHighLevel().