CMS 3D CMS Logo

TriggerExpressionData.h
Go to the documentation of this file.
1 #ifndef HLTrigger_HLTfilters_TriggerExpressionData_h
2 #define HLTrigger_HLTfilters_TriggerExpressionData_h
3 
14 
15 namespace edm {
16  class Event;
17  class EventSetup;
18  class TriggerNames;
19 } // namespace edm
20 
21 namespace triggerExpression {
22 
23  class Data {
24  public:
25  // default c'tor
26  Data()
27  : // configuration
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(),
42  // hlt values and status
43  m_pathStatus(),
45  m_hltResults(nullptr),
46  m_hltMenu(nullptr),
47  m_hltCacheID(),
49  // event values
50  m_eventNumber() {}
51 
52  // explicit c'tor from a ParameterSet
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(),
69  // hlt values and status
70  m_pathStatus(),
72  m_hltResults(nullptr),
73  m_hltMenu(nullptr),
74  m_hltCacheID(),
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  }
83 
84  // explicit c'tor from single arguments
85  Data(bool const& usePathStatus,
86  edm::InputTag const& hltResultsTag,
87  edm::InputTag const& l1tResultsTag,
89  bool doThrow,
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(),
106  // hlt values and status
107  m_pathStatus(),
108  m_triggerNames(),
109  m_hltResults(nullptr),
110  m_hltMenu(nullptr),
111  m_hltCacheID(),
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  }
120 
121  // set path status token
123 
124  // set the new event
125  bool setEvent(const edm::Event& event, const edm::EventSetup& setup);
126 
127  // re-configuration accessors
128 
130 
132 
135  }
136 
137  void setThrow(bool doThrow) { m_throw = doThrow; }
138 
139  // read-only accessors
140 
141  bool usePathStatus() const { return m_usePathStatus; }
142 
143  bool hasL1T() const { return not m_l1tResultsTag.label().empty(); }
144 
145  bool hasHLT() const { return not m_hltResultsTag.label().empty(); }
146 
147  const edm::TriggerResults& hltResults() const { return *m_hltResults; }
148 
149  const edm::TriggerNames& hltMenu() const { return *m_hltMenu; }
150 
151  const std::vector<bool>& l1tResults() const { return *m_l1tResults; }
152 
153  const L1TUtmTriggerMenu& l1tMenu() const { return *m_l1tMenu; }
154 
155  bool hltConfigurationUpdated() const { return m_hltUpdated; }
156 
157  bool l1tConfigurationUpdated() const { return m_l1tUpdated; }
158 
160 
162 
163  bool shouldThrow() const { return m_throw; }
164 
166 
167  const std::vector<std::string>& triggerNames() const {
168  if (m_hltMenu)
169  return m_hltMenu->triggerNames();
170  return m_triggerNames;
171  }
172 
173  bool passHLT(unsigned int const& index) const {
174  if (usePathStatus())
175  return m_pathStatus[index];
177  }
178 
179  int triggerIndex(std::string const& p) const {
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  }
191 
192  // configuration
194  std::map<std::string, edm::EDGetTokenT<edm::HLTPathStatus> > m_pathStatusTokens;
201  bool m_throw;
202 
203  // l1 values and status
204  const std::vector<bool>* m_l1tResults;
206  unsigned long long m_l1tCacheID;
208 
209  // hlt values and status
210  std::vector<bool> m_pathStatus;
211  std::vector<std::string> m_triggerNames;
216 
217  // event values
219  };
220 
221 } // namespace triggerExpression
222 
223 #endif // HLTrigger_HLTfilters_TriggerExpressionData_h
size
Write out results.
bool accept() const
Has at least one path accepted the event?
const edm::TriggerResults & hltResults() const
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
std::vector< std::string > m_triggerNames
Strings const & triggerNames() const
Definition: TriggerNames.cc:48
void setL1tResultsTag(edm::InputTag const &tag)
Data(const edm::ParameterSet &config, edm::ConsumesCollector &&iC)
edm::ESGetToken< L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd > const m_l1tUtmTriggerMenuToken
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tResultsToken
const L1TUtmTriggerMenu & l1tMenu() const
unsigned long long EventNumber_t
const edm::TriggerNames & hltMenu() const
Definition: config.py:1
std::string const & label() const
Definition: InputTag.h:36
void setL1tIgnoreMaskAndPrescale(bool l1tIgnoreMaskAndPrescale)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const std::vector< bool > & l1tResults() const
void setPathStatusToken(edm::BranchDescription const &branch, edm::ConsumesCollector &&iC)
unsigned int triggerIndex(std::string_view name) const
Definition: TriggerNames.cc:52
int triggerIndex(std::string const &p) const
Data(bool const &usePathStatus, edm::InputTag const &hltResultsTag, edm::InputTag const &l1tResultsTag, bool l1tIgnoreMaskAndPrescale, bool doThrow, edm::ConsumesCollector &&iC)
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
void setHltResultsTag(edm::InputTag const &tag)
edm::EDGetTokenT< edm::TriggerResults > m_hltResultsToken
edm::EventNumber_t eventNumber() const
bool passHLT(unsigned int const &index) const
const edm::TriggerNames * m_hltMenu
bool setEvent(const edm::Event &event, const edm::EventSetup &setup)
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
HLT enums.
std::vector< bool > m_pathStatus
edm::EventNumber_t m_eventNumber
unsigned long long m_l1tCacheID
Definition: event.py:1