CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
triggerExpression::Data Class Reference

#include <TriggerExpressionData.h>

Public Member Functions

bool configurationUpdated () const
 
 Data ()
 
 Data (const edm::ParameterSet &config, edm::ConsumesCollector &&iC)
 
 Data (bool const &usePathStatus, edm::InputTag const &hltResultsTag, edm::InputTag const &l1tResultsTag, bool l1tIgnoreMaskAndPrescale, bool doThrow, edm::ConsumesCollector &&iC)
 
edm::EventNumber_t eventNumber () const
 
bool hasHLT () const
 
bool hasL1T () const
 
bool hltConfigurationUpdated () const
 
const edm::TriggerNameshltMenu () const
 
const edm::TriggerResultshltResults () const
 
bool ignoreL1MaskAndPrescale () const
 
bool l1tConfigurationUpdated () const
 
const L1TUtmTriggerMenul1tMenu () const
 
const std::vector< bool > & l1tResults () const
 
bool passHLT (unsigned int const &index) const
 
bool setEvent (const edm::Event &event, const edm::EventSetup &setup)
 
void setHltResultsTag (edm::InputTag const &tag)
 
void setL1tIgnoreMaskAndPrescale (bool l1tIgnoreMaskAndPrescale)
 
void setL1tResultsTag (edm::InputTag const &tag)
 
void setPathStatusToken (edm::BranchDescription const &branch, edm::ConsumesCollector &&iC)
 
void setThrow (bool doThrow)
 
bool shouldThrow () const
 
int triggerIndex (std::string const &p) const
 
const std::vector< std::string > & triggerNames () const
 
bool usePathStatus () const
 

Public Attributes

edm::EventNumber_t m_eventNumber
 
edm::ParameterSetID m_hltCacheID
 
const edm::TriggerNamesm_hltMenu
 
const edm::TriggerResultsm_hltResults
 
edm::InputTag m_hltResultsTag
 
edm::EDGetTokenT< edm::TriggerResultsm_hltResultsToken
 
bool m_hltUpdated
 
unsigned long long m_l1tCacheID
 
bool m_l1tIgnoreMaskAndPrescale
 
const L1TUtmTriggerMenum_l1tMenu
 
const std::vector< bool > * m_l1tResults
 
edm::InputTag m_l1tResultsTag
 
edm::EDGetTokenT< GlobalAlgBlkBxCollectionm_l1tResultsToken
 
bool m_l1tUpdated
 
edm::ESGetToken< L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd > const m_l1tUtmTriggerMenuToken
 
std::vector< bool > m_pathStatus
 
std::map< std::string, edm::EDGetTokenT< edm::HLTPathStatus > > m_pathStatusTokens
 
bool m_throw
 
std::vector< std::string > m_triggerNames
 
bool m_usePathStatus
 

Detailed Description

Definition at line 23 of file TriggerExpressionData.h.

Constructor & Destructor Documentation

◆ Data() [1/3]

triggerExpression::Data::Data ( )
inline

Definition at line 26 of file TriggerExpressionData.h.

27  : // configuration
28  m_usePathStatus(false),
30  m_hltResultsTag(""),
32  m_l1tResultsTag(""),
36  m_throw(true),
37  // l1 values and status
38  m_l1tResults(nullptr),
39  m_l1tMenu(nullptr),
40  m_l1tCacheID(),
41  m_l1tUpdated(false),
42  // hlt values and status
43  m_pathStatus(),
45  m_hltResults(nullptr),
46  m_hltMenu(nullptr),
47  m_hltCacheID(),
48  m_hltUpdated(false),
49  // event values
50  m_eventNumber() {}
std::vector< std::string > m_triggerNames
edm::ESGetToken< L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd > const m_l1tUtmTriggerMenuToken
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tResultsToken
const edm::TriggerResults * m_hltResults
edm::EDGetTokenT< edm::TriggerResults > m_hltResultsToken
const edm::TriggerNames * m_hltMenu
const L1TUtmTriggerMenu * m_l1tMenu
const std::vector< bool > * m_l1tResults
std::map< std::string, edm::EDGetTokenT< edm::HLTPathStatus > > m_pathStatusTokens
edm::ParameterSetID m_hltCacheID
std::vector< bool > m_pathStatus
edm::EventNumber_t m_eventNumber
unsigned long long m_l1tCacheID

◆ Data() [2/3]

triggerExpression::Data::Data ( const edm::ParameterSet config,
edm::ConsumesCollector &&  iC 
)
inlineexplicit

Definition at line 53 of file TriggerExpressionData.h.

References edm::InputTag::label(), m_hltResultsTag, m_hltResultsToken, m_l1tResultsTag, m_l1tResultsToken, and m_usePathStatus.

54  : // configuration
55  m_usePathStatus(config.getParameter<bool>("usePathStatus")),
57  m_hltResultsTag(config.getParameter<edm::InputTag>("hltResults")),
59  m_l1tResultsTag(config.getParameter<edm::InputTag>("l1tResults")),
62  m_l1tIgnoreMaskAndPrescale(config.getParameter<bool>("l1tIgnoreMaskAndPrescale")),
63  m_throw(config.getParameter<bool>("throw")),
64  // l1 values and status
65  m_l1tResults(nullptr),
66  m_l1tMenu(nullptr),
67  m_l1tCacheID(),
68  m_l1tUpdated(false),
69  // hlt values and status
70  m_pathStatus(),
72  m_hltResults(nullptr),
73  m_hltMenu(nullptr),
74  m_hltCacheID(),
75  m_hltUpdated(false),
76  // event values
77  m_eventNumber() {
78  if (not m_hltResultsTag.label().empty() and not m_usePathStatus)
80  if (not m_l1tResultsTag.label().empty())
82  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< std::string > m_triggerNames
edm::ESGetToken< L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd > const m_l1tUtmTriggerMenuToken
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tResultsToken
Definition: config.py:1
std::string const & label() const
Definition: InputTag.h:36
const edm::TriggerResults * m_hltResults
edm::EDGetTokenT< edm::TriggerResults > m_hltResultsToken
const edm::TriggerNames * m_hltMenu
const L1TUtmTriggerMenu * m_l1tMenu
const std::vector< bool > * m_l1tResults
std::map< std::string, edm::EDGetTokenT< edm::HLTPathStatus > > m_pathStatusTokens
edm::ParameterSetID m_hltCacheID
std::vector< bool > m_pathStatus
edm::EventNumber_t m_eventNumber
unsigned long long m_l1tCacheID

◆ Data() [3/3]

triggerExpression::Data::Data ( bool const &  usePathStatus,
edm::InputTag const &  hltResultsTag,
edm::InputTag const &  l1tResultsTag,
bool  l1tIgnoreMaskAndPrescale,
bool  doThrow,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 85 of file TriggerExpressionData.h.

References edm::InputTag::label(), m_hltResultsTag, m_hltResultsToken, m_l1tResultsTag, m_l1tResultsToken, and m_usePathStatus.

91  : // configuration
94  m_hltResultsTag(hltResultsTag),
96  m_l1tResultsTag(l1tResultsTag),
100  m_throw(doThrow),
101  // l1 values and status
102  m_l1tResults(nullptr),
103  m_l1tMenu(nullptr),
104  m_l1tCacheID(),
105  m_l1tUpdated(false),
106  // hlt values and status
107  m_pathStatus(),
108  m_triggerNames(),
109  m_hltResults(nullptr),
110  m_hltMenu(nullptr),
111  m_hltCacheID(),
112  m_hltUpdated(false),
113  // event values
114  m_eventNumber() {
115  if (not m_hltResultsTag.label().empty() and not m_usePathStatus)
117  if (not m_l1tResultsTag.label().empty())
119  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< std::string > m_triggerNames
edm::ESGetToken< L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd > const m_l1tUtmTriggerMenuToken
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tResultsToken
std::string const & label() const
Definition: InputTag.h:36
const edm::TriggerResults * m_hltResults
edm::EDGetTokenT< edm::TriggerResults > m_hltResultsToken
const edm::TriggerNames * m_hltMenu
const L1TUtmTriggerMenu * m_l1tMenu
const std::vector< bool > * m_l1tResults
std::map< std::string, edm::EDGetTokenT< edm::HLTPathStatus > > m_pathStatusTokens
edm::ParameterSetID m_hltCacheID
std::vector< bool > m_pathStatus
edm::EventNumber_t m_eventNumber
unsigned long long m_l1tCacheID

Member Function Documentation

◆ configurationUpdated()

bool triggerExpression::Data::configurationUpdated ( ) const
inline

Definition at line 159 of file TriggerExpressionData.h.

References m_hltUpdated, m_l1tUpdated, and or.

Referenced by DiJetVarAnalyzer::analyze(), TriggerResultsFilterFromDB::filter(), and TriggerResultsFilter::filter().

159 { return m_hltUpdated or m_l1tUpdated; }
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

◆ eventNumber()

edm::EventNumber_t triggerExpression::Data::eventNumber ( ) const
inline

Definition at line 161 of file TriggerExpressionData.h.

References m_eventNumber.

161 { return m_eventNumber; }
edm::EventNumber_t m_eventNumber

◆ hasHLT()

bool triggerExpression::Data::hasHLT ( ) const
inline

Definition at line 145 of file TriggerExpressionData.h.

References edm::InputTag::label(), and m_hltResultsTag.

Referenced by setEvent().

145 { return not m_hltResultsTag.label().empty(); }
std::string const & label() const
Definition: InputTag.h:36

◆ hasL1T()

bool triggerExpression::Data::hasL1T ( ) const
inline

Definition at line 143 of file TriggerExpressionData.h.

References edm::InputTag::label(), and m_l1tResultsTag.

Referenced by setEvent().

143 { return not m_l1tResultsTag.label().empty(); }
std::string const & label() const
Definition: InputTag.h:36

◆ hltConfigurationUpdated()

bool triggerExpression::Data::hltConfigurationUpdated ( ) const
inline

Definition at line 155 of file TriggerExpressionData.h.

References m_hltUpdated.

◆ hltMenu()

const edm::TriggerNames& triggerExpression::Data::hltMenu ( ) const
inline

Definition at line 149 of file TriggerExpressionData.h.

References m_hltMenu.

149 { return *m_hltMenu; }
const edm::TriggerNames * m_hltMenu

◆ hltResults()

const edm::TriggerResults& triggerExpression::Data::hltResults ( ) const
inline

Definition at line 147 of file TriggerExpressionData.h.

References m_hltResults.

147 { return *m_hltResults; }
const edm::TriggerResults * m_hltResults

◆ ignoreL1MaskAndPrescale()

bool triggerExpression::Data::ignoreL1MaskAndPrescale ( ) const
inline

Definition at line 165 of file TriggerExpressionData.h.

References m_l1tIgnoreMaskAndPrescale.

◆ l1tConfigurationUpdated()

bool triggerExpression::Data::l1tConfigurationUpdated ( ) const
inline

Definition at line 157 of file TriggerExpressionData.h.

References m_l1tUpdated.

◆ l1tMenu()

const L1TUtmTriggerMenu& triggerExpression::Data::l1tMenu ( ) const
inline

Definition at line 153 of file TriggerExpressionData.h.

References m_l1tMenu.

153 { return *m_l1tMenu; }
const L1TUtmTriggerMenu * m_l1tMenu

◆ l1tResults()

const std::vector<bool>& triggerExpression::Data::l1tResults ( ) const
inline

Definition at line 151 of file TriggerExpressionData.h.

References m_l1tResults.

151 { return *m_l1tResults; }
const std::vector< bool > * m_l1tResults

◆ passHLT()

bool triggerExpression::Data::passHLT ( unsigned int const &  index) const
inline

Definition at line 173 of file TriggerExpressionData.h.

References edm::HLTGlobalStatus::accept(), m_hltResults, m_pathStatus, and usePathStatus().

173  {
174  if (usePathStatus())
175  return m_pathStatus[index];
177  }
bool accept() const
Has at least one path accepted the event?
const edm::TriggerResults * m_hltResults
std::vector< bool > m_pathStatus

◆ setEvent()

bool triggerExpression::Data::setEvent ( const edm::Event event,
const edm::EventSetup setup 
)

Definition at line 19 of file TriggerExpressionData.cc.

References edm::get(), patZpeak::handle, hasHLT(), hasL1T(), m_eventNumber, m_hltCacheID, m_hltMenu, m_hltResults, m_hltResultsToken, m_hltUpdated, m_l1tCacheID, m_l1tIgnoreMaskAndPrescale, m_l1tMenu, m_l1tResults, m_l1tResultsToken, m_l1tUpdated, m_l1tUtmTriggerMenuToken, m_pathStatus, m_pathStatusTokens, m_triggerNames, or, AlCaHLTBitMon_ParallelJobs::p, edm::TriggerNames::parameterSetID(), singleTopDQM_cfi::setup, edm::TriggerNames::triggerNames(), triggerNames(), and usePathStatus().

Referenced by DiJetVarAnalyzer::analyze(), FSQDiJetAve::analyze(), TriggerResultsFilterFromDB::filter(), and TriggerResultsFilter::filter().

19  {
20  // cache the event number
21  m_eventNumber = event.id().event();
22 
23  // access L1 objects only if L1 is used
24  if (hasL1T()) {
25  // cache the L1 GT results objects
26  auto const& l1t = edm::get(event, m_l1tResultsToken);
27  if (l1t.size() == 0 or l1t.isEmpty(0)) {
28  m_l1tResults = nullptr;
29  return false;
30  }
32  m_l1tResults = &l1t.at(0, 0).getAlgoDecisionInitial();
33  else
34  m_l1tResults = &l1t.at(0, 0).getAlgoDecisionFinal();
35 
36  // cache the L1 trigger menu
37  unsigned long long l1tCacheID = setup.get<L1TUtmTriggerMenuRcd>().cacheIdentifier();
38  if (m_l1tCacheID == l1tCacheID) {
39  m_l1tUpdated = false;
40  } else {
42  m_l1tCacheID = l1tCacheID;
43  m_l1tUpdated = true;
44  }
45  }
46 
47  // access HLT objects only if HLT is used
48  if (usePathStatus()) {
49  m_pathStatus.clear();
50  std::vector<std::string> triggerNames;
51  m_pathStatus.reserve(m_pathStatusTokens.size());
52  triggerNames.reserve(m_pathStatusTokens.size());
53  for (auto const& p : m_pathStatusTokens) {
54  auto const& handle = event.getHandle(p.second);
55  if (handle.isValid()) {
56  m_pathStatus.push_back(handle->accept());
57  triggerNames.push_back(p.first);
58  } else {
59  edm::LogError("MissingHLTPathStatus")
60  << "invalid handle for requested edm::HLTPathStatus with label \"" << p.first << "\"";
61  }
62  }
65  } else if (hasHLT()) {
66  // cache the HLT TriggerResults
68  if (not m_hltResults)
69  return false;
70 
71  // access the TriggerNames, and check if it has changed
74  m_hltUpdated = false;
75  } else {
77  m_hltUpdated = true;
78  }
79  }
80 
81  return true;
82  }
std::vector< std::string > m_triggerNames
Strings const & triggerNames() const
Definition: TriggerNames.cc:48
edm::ESGetToken< L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd > const m_l1tUtmTriggerMenuToken
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tResultsToken
delete x;
Definition: CaloConfig.h:22
Log< level::Error, false > LogError
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
const edm::TriggerResults * m_hltResults
edm::EDGetTokenT< edm::TriggerResults > m_hltResultsToken
ParameterSetID const & parameterSetID() const
Definition: TriggerNames.cc:61
const edm::TriggerNames * m_hltMenu
const L1TUtmTriggerMenu * m_l1tMenu
const std::vector< bool > * m_l1tResults
const std::vector< std::string > & triggerNames() const
std::map< std::string, edm::EDGetTokenT< edm::HLTPathStatus > > m_pathStatusTokens
edm::ParameterSetID m_hltCacheID
std::vector< bool > m_pathStatus
T const & get(Event const &event, InputTag const &tag) noexcept(false)
Definition: Event.h:676
edm::EventNumber_t m_eventNumber
unsigned long long m_l1tCacheID
Definition: event.py:1

◆ setHltResultsTag()

void triggerExpression::Data::setHltResultsTag ( edm::InputTag const &  tag)
inline

◆ setL1tIgnoreMaskAndPrescale()

void triggerExpression::Data::setL1tIgnoreMaskAndPrescale ( bool  l1tIgnoreMaskAndPrescale)
inline

◆ setL1tResultsTag()

void triggerExpression::Data::setL1tResultsTag ( edm::InputTag const &  tag)
inline

◆ setPathStatusToken()

void triggerExpression::Data::setPathStatusToken ( edm::BranchDescription const &  branch,
edm::ConsumesCollector &&  iC 
)

Definition at line 14 of file TriggerExpressionData.cc.

References MicroEventContent_cff::branch, ProducerED_cfi::InputTag, and m_pathStatusTokens.

Referenced by TriggerResultsFilter::TriggerResultsFilter().

14  {
16  edm::InputTag(branch.moduleLabel(), branch.productInstanceName(), branch.processName()));
17  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::map< std::string, edm::EDGetTokenT< edm::HLTPathStatus > > m_pathStatusTokens

◆ setThrow()

void triggerExpression::Data::setThrow ( bool  doThrow)
inline

Definition at line 137 of file TriggerExpressionData.h.

References m_throw.

137 { m_throw = doThrow; }

◆ shouldThrow()

bool triggerExpression::Data::shouldThrow ( ) const
inline

◆ triggerIndex()

int triggerExpression::Data::triggerIndex ( std::string const &  p) const
inline

Definition at line 179 of file TriggerExpressionData.h.

References spr::find(), m_hltMenu, m_triggerNames, AlCaHLTBitMon_ParallelJobs::p, findQualityFiles::size, edm::TriggerNames::triggerIndex(), and usePathStatus().

179  {
180  if (usePathStatus()) {
181  auto it = std::find(m_triggerNames.begin(), m_triggerNames.end(), p);
182  if (it != m_triggerNames.end())
183  return it - m_triggerNames.begin();
184  } else if (m_hltMenu) {
185  auto index = m_hltMenu->triggerIndex(p);
186  if (index < m_hltMenu->size())
187  return index;
188  }
189  return -1;
190  }
size
Write out results.
std::vector< std::string > m_triggerNames
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
unsigned int triggerIndex(std::string_view name) const
Definition: TriggerNames.cc:52
const edm::TriggerNames * m_hltMenu

◆ triggerNames()

const std::vector<std::string>& triggerExpression::Data::triggerNames ( ) const
inline

Definition at line 167 of file TriggerExpressionData.h.

References m_hltMenu, m_triggerNames, and edm::TriggerNames::triggerNames().

Referenced by setEvent().

167  {
168  if (m_hltMenu)
169  return m_hltMenu->triggerNames();
170  return m_triggerNames;
171  }
std::vector< std::string > m_triggerNames
Strings const & triggerNames() const
Definition: TriggerNames.cc:48
const edm::TriggerNames * m_hltMenu

◆ usePathStatus()

bool triggerExpression::Data::usePathStatus ( ) const
inline

Member Data Documentation

◆ m_eventNumber

edm::EventNumber_t triggerExpression::Data::m_eventNumber

Definition at line 218 of file TriggerExpressionData.h.

Referenced by eventNumber(), and setEvent().

◆ m_hltCacheID

edm::ParameterSetID triggerExpression::Data::m_hltCacheID

Definition at line 214 of file TriggerExpressionData.h.

Referenced by setEvent().

◆ m_hltMenu

const edm::TriggerNames* triggerExpression::Data::m_hltMenu

Definition at line 213 of file TriggerExpressionData.h.

Referenced by hltMenu(), setEvent(), triggerIndex(), and triggerNames().

◆ m_hltResults

const edm::TriggerResults* triggerExpression::Data::m_hltResults

Definition at line 212 of file TriggerExpressionData.h.

Referenced by hltResults(), passHLT(), and setEvent().

◆ m_hltResultsTag

edm::InputTag triggerExpression::Data::m_hltResultsTag

Definition at line 195 of file TriggerExpressionData.h.

Referenced by Data(), hasHLT(), and setHltResultsTag().

◆ m_hltResultsToken

edm::EDGetTokenT<edm::TriggerResults> triggerExpression::Data::m_hltResultsToken

Definition at line 196 of file TriggerExpressionData.h.

Referenced by Data(), and setEvent().

◆ m_hltUpdated

bool triggerExpression::Data::m_hltUpdated

◆ m_l1tCacheID

unsigned long long triggerExpression::Data::m_l1tCacheID

Definition at line 206 of file TriggerExpressionData.h.

Referenced by setEvent().

◆ m_l1tIgnoreMaskAndPrescale

bool triggerExpression::Data::m_l1tIgnoreMaskAndPrescale

◆ m_l1tMenu

const L1TUtmTriggerMenu* triggerExpression::Data::m_l1tMenu

Definition at line 205 of file TriggerExpressionData.h.

Referenced by l1tMenu(), and setEvent().

◆ m_l1tResults

const std::vector<bool>* triggerExpression::Data::m_l1tResults

Definition at line 204 of file TriggerExpressionData.h.

Referenced by l1tResults(), and setEvent().

◆ m_l1tResultsTag

edm::InputTag triggerExpression::Data::m_l1tResultsTag

Definition at line 197 of file TriggerExpressionData.h.

Referenced by Data(), hasL1T(), and setL1tResultsTag().

◆ m_l1tResultsToken

edm::EDGetTokenT<GlobalAlgBlkBxCollection> triggerExpression::Data::m_l1tResultsToken

Definition at line 198 of file TriggerExpressionData.h.

Referenced by Data(), and setEvent().

◆ m_l1tUpdated

bool triggerExpression::Data::m_l1tUpdated

◆ m_l1tUtmTriggerMenuToken

edm::ESGetToken<L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd> const triggerExpression::Data::m_l1tUtmTriggerMenuToken

Definition at line 199 of file TriggerExpressionData.h.

Referenced by setEvent().

◆ m_pathStatus

std::vector<bool> triggerExpression::Data::m_pathStatus

Definition at line 210 of file TriggerExpressionData.h.

Referenced by passHLT(), and setEvent().

◆ m_pathStatusTokens

std::map<std::string, edm::EDGetTokenT<edm::HLTPathStatus> > triggerExpression::Data::m_pathStatusTokens

Definition at line 194 of file TriggerExpressionData.h.

Referenced by setEvent(), and setPathStatusToken().

◆ m_throw

bool triggerExpression::Data::m_throw

Definition at line 201 of file TriggerExpressionData.h.

Referenced by setThrow(), and shouldThrow().

◆ m_triggerNames

std::vector<std::string> triggerExpression::Data::m_triggerNames

Definition at line 211 of file TriggerExpressionData.h.

Referenced by setEvent(), triggerIndex(), and triggerNames().

◆ m_usePathStatus

bool triggerExpression::Data::m_usePathStatus

Definition at line 193 of file TriggerExpressionData.h.

Referenced by Data(), and usePathStatus().