CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TriggerResultsByName.cc
Go to the documentation of this file.
1 
6 
7 namespace edm {
8 
10  TriggerResultsByName(TriggerResults const* triggerResults,
11  TriggerNames const* triggerNames) :
12  triggerResults_(triggerResults),
13  triggerNames_(triggerNames) {
14 
15  // If either of these is true the object is in an invalid state
16  if (triggerResults_ == 0 || triggerNames_ == 0) {
17  return;
18  }
19 
22  << "TriggerResultsByName::TriggerResultsByName, Trigger names vector and TriggerResults\n"
23  "have different ParameterSetID's. This should be impossible when the object is obtained\n"
24  "from the function named triggerResultsByName in the Event class, which is the way\n"
25  "TriggerResultsByName should always be created. If this is the case, please send\n"
26  "information to reproduce this problem to the edm developers. Otherwise, you are\n"
27  "using this class incorrectly and in a way that is not supported.\n";
28  }
29 
30  if (triggerResults_->size() != triggerNames_->size()) {
32  << "TriggerResultsByName::TriggerResultsByName, Trigger names vector\n"
33  "and TriggerResults have different sizes. This should be impossible,\n"
34  "please send information to reproduce this problem to the edm developers.\n";
35  }
36  }
37 
38  bool
40  isValid() const {
41  if (triggerResults_ == 0 || triggerNames_ == 0) return false;
42  return true;
43  }
44 
45  ParameterSetID const&
47  parameterSetID() const {
50  }
51 
52  bool
54  wasrun() const {
56  return triggerResults_->wasrun();
57  }
58 
59  bool
61  accept() const {
63  return triggerResults_->accept();
64  }
65 
66  bool
68  error() const {
70  return triggerResults_->error();
71  }
72 
73  HLTPathStatus const&
75  at(std::string const& pathName) const {
77  unsigned i = getAndCheckIndex(pathName);
78  return triggerResults_->at(i);
79  }
80 
81  HLTPathStatus const&
83  at(unsigned i) const {
85  return triggerResults_->at(i);
86  }
87 
88  HLTPathStatus const&
90  operator[](std::string const& pathName) const {
92  unsigned i = getAndCheckIndex(pathName);
93  return triggerResults_->at(i);
94  }
95 
96  HLTPathStatus const&
98  operator[](unsigned i) const {
100  return triggerResults_->at(i);
101  }
102 
103  bool
105  wasrun(std::string const& pathName) const {
107  unsigned i = getAndCheckIndex(pathName);
108  return triggerResults_->wasrun(i);
109  }
110 
111  bool
113  wasrun(unsigned i) const {
115  return triggerResults_->wasrun(i);
116  }
117 
118  bool
120  accept(std::string const& pathName) const {
122  unsigned i = getAndCheckIndex(pathName);
123  return triggerResults_->accept(i);
124  }
125 
126  bool
128  accept(unsigned i) const {
130  return triggerResults_->accept(i);
131  }
132 
133  bool
135  error(std::string const& pathName) const {
137  unsigned i = getAndCheckIndex(pathName);
138  return triggerResults_->error(i);
139  }
140 
141  bool
143  error(unsigned i) const {
145  return triggerResults_->error(i);
146  }
147 
150  state(std::string const& pathName) const {
152  unsigned i = getAndCheckIndex(pathName);
153  return triggerResults_->state(i);
154  }
155 
158  state(unsigned i) const {
160  return triggerResults_->state(i);
161  }
162 
163  unsigned
165  index(std::string const& pathName) const {
167  unsigned i = getAndCheckIndex(pathName);
168  return triggerResults_->index(i);
169  }
170 
171  unsigned
173  index(unsigned i) const {
175  return triggerResults_->index(i);
176  }
177 
178  std::vector<std::string> const&
180  triggerNames() const {
183  return triggerNames_->triggerNames();
184  }
185 
186  std::string const&
188  triggerName(unsigned i) const {
191  return triggerNames_->triggerName(i);
192  }
193 
194  unsigned
196  triggerIndex(std::string const& pathName) const {
199  return triggerNames_->triggerIndex(pathName);
200  }
201 
204  size() const {
206  return triggerResults_->size();
207  }
208 
209  unsigned
211  getAndCheckIndex(std::string const& pathName) const {
213  unsigned i = triggerNames_->triggerIndex(pathName);
214  if (i == triggerNames_->size()) {
216  << "TriggerResultsByName::getAndCheckIndex\n"
217  << "Requested trigger name \""
218  << pathName << "\" does not match any known trigger.\n";
219  }
220  return i;
221  }
222 
223  void
227  << "TriggerResultsByName has a null pointer to TriggerResults.\n"
228  << "This probably means TriggerResults was not found in the Event\n"
229  << "because the product was dropped or never created. It could also\n"
230  << "mean it was requested for a process that does not exist or was\n"
231  << "misspelled\n";
232  }
233 
234  void
238  << "TriggerResultsByName has a null pointer to TriggerNames.\n"
239  << "This should never happen. It could indicate the ParameterSet\n"
240  << "containing the names is missing from the ParameterSet registry.\n"
241  << "Please report this to the edm developers along with instructions\n"
242  << "to reproduce the problem\n";
243  }
244 }
int i
Definition: DBlmapReader.cc:9
bool wasrun() const
Was at least one path run?
ParameterSetID const & parameterSetID() const
TriggerNames const * triggerNames_
std::vector< std::string >::size_type size() const
unsigned getAndCheckIndex(std::string const &pathName) const
HLTState
status of a trigger path
Definition: HLTenums.h:21
bool accept() const
Has at least one path accepted the event?
HLTPathStatus const & at(std::string const &pathName) const
unsigned triggerIndex(std::string const &pathName) const
std::string const & triggerName(unsigned i) const
Strings::size_type size() const
Definition: TriggerNames.cc:39
uint16_t size_type
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
ParameterSetID const & parameterSetID() const
Definition: TriggerNames.cc:42
const std::string * pathName() const
Definition: HLTadd.h:31
std::vector< std::string > const & triggerNames() const
unsigned index(std::string const &pathName) const
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
unsigned int size() const
Get number of paths stored.
unsigned int index(const unsigned int i) const
Get index (slot position) of module giving the decision of the ith path.
bool error() const
Has any path encountered an error (exception)
const HLTPathStatus & at(const unsigned int i) const
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
hlt::HLTState state(std::string const &pathName) const
TriggerResultsByName(TriggerResults const *triggerResults, TriggerNames const *triggerNames)
HLTPathStatus const & operator[](std::string const &pathName) const
TriggerResults const * triggerResults_
const ParameterSetID & parameterSetID() const
Get stored parameter set id.
hlt::HLTState state(const unsigned int i) const
Get status of ith path.