CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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::TriggerResults
m_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
< GlobalAlgBlkBxCollection
m_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

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
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
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
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::map< std::string, edm::EDGetTokenT< edm::HLTPathStatus > > m_pathStatusTokens
std::string const & label() const
Definition: InputTag.h:36
edm::ParameterSetID m_hltCacheID
std::vector< bool > m_pathStatus
edm::EventNumber_t m_eventNumber
unsigned long long m_l1tCacheID
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),
99  m_l1tIgnoreMaskAndPrescale(l1tIgnoreMaskAndPrescale),
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
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
std::string const & label() const
Definition: InputTag.h:36
edm::ParameterSetID m_hltCacheID
std::vector< bool > m_pathStatus
edm::EventNumber_t m_eventNumber
unsigned long long m_l1tCacheID

Member Function Documentation

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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::EventNumber_t triggerExpression::Data::eventNumber ( ) const
inline

Definition at line 161 of file TriggerExpressionData.h.

References m_eventNumber.

Referenced by triggerExpression::Prescaler::init().

161 { return m_eventNumber; }
edm::EventNumber_t m_eventNumber
bool triggerExpression::Data::hasHLT ( ) const
inline

Definition at line 145 of file TriggerExpressionData.h.

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

Referenced by triggerExpression::PathReader::operator()(), and setEvent().

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

Definition at line 143 of file TriggerExpressionData.h.

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

Referenced by triggerExpression::L1uGTReader::init(), triggerExpression::L1uGTReader::operator()(), and setEvent().

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

Definition at line 155 of file TriggerExpressionData.h.

References m_hltUpdated.

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
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
bool triggerExpression::Data::ignoreL1MaskAndPrescale ( ) const
inline

Definition at line 165 of file TriggerExpressionData.h.

References m_l1tIgnoreMaskAndPrescale.

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

Definition at line 157 of file TriggerExpressionData.h.

References m_l1tUpdated.

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

Definition at line 153 of file TriggerExpressionData.h.

References m_l1tMenu.

Referenced by triggerExpression::L1uGTReader::init().

153 { return *m_l1tMenu; }
const L1TUtmTriggerMenu * m_l1tMenu
const std::vector<bool>& triggerExpression::Data::l1tResults ( ) const
inline

Definition at line 151 of file TriggerExpressionData.h.

References m_l1tResults.

Referenced by triggerExpression::L1uGTReader::operator()().

151 { return *m_l1tResults; }
const std::vector< bool > * m_l1tResults
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().

Referenced by triggerExpression::PathReader::operator()().

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
bool triggerExpression::Data::setEvent ( const edm::Event event,
const edm::EventSetup setup 
)

Definition at line 19 of file TriggerExpressionData.cc.

References edm::EventSetup::get(), edm::get(), edm::EventSetup::getData(), 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(), 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  for (auto const& p : m_pathStatusTokens) {
52  auto const& handle = event.getHandle(p.second);
53  if (handle.isValid()) {
54  m_pathStatus.push_back(handle->accept());
55  triggerNames.push_back(p.first);
56  }
57  }
60  } else if (hasHLT()) {
61  // cache the HLT TriggerResults
63  if (not m_hltResults)
64  return false;
65 
66  // access the TriggerNames, and check if it has changed
67  m_hltMenu = &event.triggerNames(*m_hltResults);
69  m_hltUpdated = false;
70  } else {
72  m_hltUpdated = true;
73  }
74  }
75 
76  return true;
77  }
std::vector< std::string > m_triggerNames
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
const std::vector< std::string > & triggerNames() const
edm::ESGetToken< L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd > const m_l1tUtmTriggerMenuToken
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tResultsToken
Strings const & triggerNames() const
Definition: TriggerNames.cc:48
ParameterSetID const & parameterSetID() const
Definition: TriggerNames.cc:61
bool getData(T &iHolder) const
Definition: EventSetup.h:128
const edm::TriggerResults * m_hltResults
edm::EDGetTokenT< edm::TriggerResults > m_hltResultsToken
tuple handle
Definition: patZpeak.py:23
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
T get() const
Definition: EventSetup.h:88
std::vector< bool > m_pathStatus
T const & get(Event const &event, InputTag const &tag) noexcept(false)
Definition: Event.h:679
edm::EventNumber_t m_eventNumber
unsigned long long m_l1tCacheID
void triggerExpression::Data::setHltResultsTag ( edm::InputTag const &  tag)
inline
void triggerExpression::Data::setL1tIgnoreMaskAndPrescale ( bool  l1tIgnoreMaskAndPrescale)
inline

Definition at line 133 of file TriggerExpressionData.h.

References m_l1tIgnoreMaskAndPrescale.

133  {
134  m_l1tIgnoreMaskAndPrescale = l1tIgnoreMaskAndPrescale;
135  }
void triggerExpression::Data::setL1tResultsTag ( edm::InputTag const &  tag)
inline
void triggerExpression::Data::setPathStatusToken ( edm::BranchDescription const &  branch,
edm::ConsumesCollector &&  iC 
)

Definition at line 14 of file TriggerExpressionData.cc.

References HLT_FULL_cff::InputTag, m_pathStatusTokens, edm::BranchDescription::moduleLabel(), edm::BranchDescription::processName(), and edm::BranchDescription::productInstanceName().

Referenced by TriggerResultsFilter::TriggerResultsFilter().

14  {
15  m_pathStatusTokens[branch.moduleLabel()] = iC.consumes<edm::HLTPathStatus>(
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
void triggerExpression::Data::setThrow ( bool  doThrow)
inline

Definition at line 137 of file TriggerExpressionData.h.

References m_throw.

137 { m_throw = doThrow; }
bool triggerExpression::Data::shouldThrow ( ) const
inline
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().

Referenced by triggerExpression::PathReader::init().

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  }
std::vector< std::string > m_triggerNames
unsigned int triggerIndex(std::string_view name) const
Definition: TriggerNames.cc:52
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const edm::TriggerNames * m_hltMenu
tuple size
Write out results.
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 triggerExpression::PathReader::init(), and 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
bool triggerExpression::Data::usePathStatus ( ) const
inline

Member Data Documentation

edm::EventNumber_t triggerExpression::Data::m_eventNumber

Definition at line 218 of file TriggerExpressionData.h.

Referenced by eventNumber(), and setEvent().

edm::ParameterSetID triggerExpression::Data::m_hltCacheID

Definition at line 214 of file TriggerExpressionData.h.

Referenced by setEvent().

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

Definition at line 213 of file TriggerExpressionData.h.

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

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

Definition at line 212 of file TriggerExpressionData.h.

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

edm::InputTag triggerExpression::Data::m_hltResultsTag

Definition at line 195 of file TriggerExpressionData.h.

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

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

Definition at line 196 of file TriggerExpressionData.h.

Referenced by Data(), and setEvent().

bool triggerExpression::Data::m_hltUpdated
unsigned long long triggerExpression::Data::m_l1tCacheID

Definition at line 206 of file TriggerExpressionData.h.

Referenced by setEvent().

bool triggerExpression::Data::m_l1tIgnoreMaskAndPrescale
const L1TUtmTriggerMenu* triggerExpression::Data::m_l1tMenu

Definition at line 205 of file TriggerExpressionData.h.

Referenced by l1tMenu(), and setEvent().

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

Definition at line 204 of file TriggerExpressionData.h.

Referenced by l1tResults(), and setEvent().

edm::InputTag triggerExpression::Data::m_l1tResultsTag

Definition at line 197 of file TriggerExpressionData.h.

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

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

Definition at line 198 of file TriggerExpressionData.h.

Referenced by Data(), and setEvent().

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

Definition at line 199 of file TriggerExpressionData.h.

Referenced by setEvent().

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

Definition at line 210 of file TriggerExpressionData.h.

Referenced by passHLT(), and setEvent().

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().

bool triggerExpression::Data::m_throw

Definition at line 201 of file TriggerExpressionData.h.

Referenced by setThrow(), and shouldThrow().

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

Definition at line 211 of file TriggerExpressionData.h.

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

bool triggerExpression::Data::m_usePathStatus

Definition at line 193 of file TriggerExpressionData.h.

Referenced by Data(), and usePathStatus().