CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
 
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 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...
 
const std::string eventSetupPathsLabel_
 
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 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_, eventSetupPathsLabel_, 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  eventSetupPathsLabel_(iConfig.getParameter<std::string>("eventSetupPathsLabel")),
44  HLTPatterns_(iConfig.getParameter<std::vector<std::string> >("HLTPaths")),
47  // names and slot numbers are computed during the event loop,
48  // as they need to access the TriggerNames object via the TriggerResults
49 
50  if (!eventSetupPathsKey_.empty()) {
51  // If paths come from eventsetup, we must watch for IOV changes.
52  if (!HLTPatterns_.empty()) {
53  // We do not want double trigger path setting, so throw!
54  throw cms::Exception("Configuration")
55  << " HLTHighLevel instance: " << iConfig.getParameter<std::string>("@module_label") << "\n configured with "
56  << HLTPatterns_.size() << " HLTPaths and\n"
57  << " eventSetupPathsKey " << eventSetupPathsKey_ << ", choose either of them.";
58  }
60  esConsumes<AlCaRecoTriggerBits, AlCaRecoTriggerBitsRcd>(edm::ESInputTag("", eventSetupPathsLabel_));
62  }
63 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
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:93
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:82
edm::ESGetToken< AlCaRecoTriggerBits, AlCaRecoTriggerBitsRcd > alcaRecotriggerBitsToken_
ESGetToken to read AlCaRecoTriggerBits.
Definition: HLTHighLevel.h:84
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:90
std::vector< std::string > HLTPatterns_
input patterns that will be expanded into trigger names
Definition: HLTHighLevel.h:87
const std::string eventSetupPathsLabel_
Definition: HLTHighLevel.h:80
edm::InputTag inputTag_
HLT TriggerResults EDProduct.
Definition: HLTHighLevel.h:62

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 69 of file HLTHighLevel.cc.

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

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

197  {
198  using namespace std;
199  using namespace edm;
200 
201  // get hold of TriggerResults Object
203  iEvent.getByToken(inputToken_, trh);
204  if (trh.isValid()) {
205  LogDebug("HLTHighLevel") << "TriggerResults found, number of HLT paths: " << trh->size();
206  } else {
207  LogError("HLTHighLevel") << "TriggerResults product " << inputTag_.encode()
208  << " not found - returning result=false!";
209  return false;
210  }
211 
212  // init the TriggerNames with the TriggerResults
213  const edm::TriggerNames& triggerNames = iEvent.triggerNames(*trh);
214  bool config_changed = false;
215  if (triggerNamesID_ != triggerNames.parameterSetID()) {
216  triggerNamesID_ = triggerNames.parameterSetID();
217  config_changed = true;
218  }
219 
220  // (re)run the initialization stuff if
221  // - this is the first event
222  // - or the HLT table has changed
223  // - or selected trigger bits come from AlCaRecoTriggerBitsRcd and these changed
224  if (config_changed or (watchAlCaRecoTriggerBitsRcd_ and watchAlCaRecoTriggerBitsRcd_->check(iSetup))) {
225  this->init(*trh, iEvent, iSetup, triggerNames);
226  }
227  unsigned int n = HLTPathsByName_.size();
228  unsigned int nbad = 0;
229  unsigned int fired = 0;
230 
231  // count invalid and fired triggers
232  for (unsigned int i = 0; i < n; i++)
233  if (HLTPathsByIndex_[i] == (unsigned int)-1)
234  ++nbad;
235  else if (trh->accept(HLTPathsByIndex_[i]))
236  ++fired;
237 
238  if ((nbad > 0) and (config_changed or throw_)) {
239  // only generate the error message if it's actually going to be used
240  std::string message;
241 
242  for (unsigned int i = 0; i < n; i++)
243  if (HLTPathsByIndex_[i] == (unsigned int)-1)
244  message += HLTPathsByName_[i] + " ";
245 
246  if (config_changed) {
247  LogTrace("HLTHighLevel") << " HLTHighLevel [instance: " << moduleLabel() << " - path: " << pathName(iEvent)
248  << "] configured with " << nbad << "/" << n << " unknown HLT path names: " << message;
249  }
250 
251  if (throw_) {
252  throw cms::Exception("Configuration")
253  << " HLTHighLevel [instance: " << moduleLabel() << " - path: " << pathName(iEvent) << "] configured with "
254  << nbad << "/" << n << " unknown HLT path names: " << message;
255  }
256  }
257 
258  // Boolean filter result (always at least one trigger)
259  const bool accept((fired > 0) and (andOr_ or (fired == n - nbad)));
260  LogDebug("HLTHighLevel") << "Accept = " << std::boolalpha << accept;
261 
262  return accept;
263 }
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:89
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:93
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:82
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:90
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 89 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().

92  {
93  unsigned int n;
94 
95  // clean up old data
96  HLTPathsByName_.clear();
97  HLTPathsByIndex_.clear();
98 
99  // Overwrite paths from EventSetup via AlCaRecoTriggerBitsRcd if configured:
100  if (!eventSetupPathsKey_.empty()) {
101  HLTPatterns_ = this->pathsFromSetup(eventSetupPathsKey_, event, iSetup);
102  }
103 
104  if (HLTPatterns_.empty()) {
105  // for empty input vector, default to all HLT trigger paths
106  n = result.size();
107  HLTPathsByName_.resize(n);
108  HLTPathsByIndex_.resize(n);
109  for (unsigned int i = 0; i < n; ++i) {
110  HLTPathsByName_[i] = triggerNames.triggerName(i);
111  HLTPathsByIndex_[i] = i;
112  }
113  } else {
114  // otherwise, expand wildcards in trigger names...
115  for (auto const& pattern : HLTPatterns_) {
116  if (edm::is_glob(pattern)) {
117  // found a glob pattern, expand it
118  std::vector<std::vector<std::string>::const_iterator> matches =
119  edm::regexMatch(triggerNames.triggerNames(), pattern);
120  if (matches.empty()) {
121  // pattern does not match any trigger paths
122  if (throw_)
123  throw cms::Exception("Configuration")
124  << "requested pattern \"" << pattern << "\" does not match any HLT paths";
125  else
126  edm::LogInfo("Configuration") << "requested pattern \"" << pattern << "\" does not match any HLT paths";
127  } else {
128  // store the matching patterns
129  for (auto const& match : matches)
130  HLTPathsByName_.push_back(*match);
131  }
132  } else {
133  // found a trigger name, just copy it
134  HLTPathsByName_.push_back(pattern);
135  }
136  }
137  n = HLTPathsByName_.size();
138 
139  // ...and get hold of trigger indices
140  bool valid = false;
141  HLTPathsByIndex_.resize(n);
142  for (unsigned int i = 0; i < HLTPathsByName_.size(); i++) {
143  HLTPathsByIndex_[i] = triggerNames.triggerIndex(HLTPathsByName_[i]);
144  if (HLTPathsByIndex_[i] < result.size()) {
145  valid = true;
146  } else {
147  // trigger path not found
148  HLTPathsByIndex_[i] = (unsigned int)-1;
149  if (throw_)
150  throw cms::Exception("Configuration") << "requested HLT path \"" << HLTPathsByName_[i] << "\" does not exist";
151  else
152  edm::LogInfo("Configuration") << "requested HLT path \"" << HLTPathsByName_[i] << "\" does not exist";
153  }
154  }
155 
156  if (not valid) {
157  // no point in throwing - if requested, it should have already happened
158  edm::LogWarning("Configuration")
159  << "none of the requested paths and pattern match any HLT path - no events will be selected";
160  }
161  }
162 
163  // report on what is finally used
164  LogDebug("HLTHighLevel") << "HLT trigger paths: " + inputTag_.encode() << " - Number of paths: " << n
165  << " - andOr mode: " << andOr_ << " - throw mode: " << throw_;
166 
167  LogTrace("HLTHighLevel") << "The HLT trigger paths (# index name):";
168  for (unsigned int i = 0; i < n; ++i)
169  if (HLTPathsByIndex_[i] == (unsigned int)-1)
170  LogTrace("HLTHighLevel") << " n/a " << HLTPathsByName_[i];
171  else
172  LogTrace("HLTHighLevel") << " " << std::setw(4) << HLTPathsByIndex_[i] << " " << HLTPathsByName_[i];
173 }
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:93
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:90
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:87
edm::InputTag inputTag_
HLT TriggerResults EDProduct.
Definition: HLTHighLevel.h:62
#define LogDebug(id)

◆ moduleLabel()

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

Definition at line 269 of file HLTHighLevel.cc.

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

Referenced by filter(), and pathsFromSetup().

269 { 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 265 of file HLTHighLevel.cc.

Referenced by filter(), and pathsFromSetup().

265  {
266  return event.moduleCallingContext()->placeInPathContext()->pathContext()->pathName();
267 }

◆ 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 176 of file HLTHighLevel.cc.

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

Referenced by init().

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

◆ eventSetupPathsLabel_

const std::string HLTHighLevel::eventSetupPathsLabel_
private

Definition at line 80 of file HLTHighLevel.h.

Referenced by HLTHighLevel().

◆ HLTPathsByIndex_

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

list of required HLT triggers by HLT index

Definition at line 93 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 90 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 87 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 82 of file HLTHighLevel.h.

Referenced by filter(), and HLTHighLevel().