CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TriggerResultsByName.cc
Go to the documentation of this file.
1 
6 
7 namespace edm {
8 
10  : triggerResults_(triggerResults), triggerNames_(triggerNames) {
11  // If either of these is true the object is in an invalid state
12  if (triggerResults_ == nullptr || triggerNames_ == nullptr) {
13  return;
14  }
15 
18  << "TriggerResultsByName::TriggerResultsByName, Trigger names vector and TriggerResults\n"
19  "have different ParameterSetID's. This should be impossible when the object is obtained\n"
20  "from the function named triggerResultsByName in the Event class, which is the way\n"
21  "TriggerResultsByName should always be created. If this is the case, please send\n"
22  "information to reproduce this problem to the edm developers. Otherwise, you are\n"
23  "using this class incorrectly and in a way that is not supported.\n";
24  }
25 
26  if (triggerResults_->size() != triggerNames_->size()) {
28  << "TriggerResultsByName::TriggerResultsByName, Trigger names vector\n"
29  "and TriggerResults have different sizes. This should be impossible,\n"
30  "please send information to reproduce this problem to the edm developers.\n";
31  }
32  }
33 
35  if (triggerResults_ == nullptr || triggerNames_ == nullptr)
36  return false;
37  return true;
38  }
39 
41  if (triggerResults_ == nullptr)
44  }
45 
47  if (triggerResults_ == nullptr)
49  return triggerResults_->wasrun();
50  }
51 
53  if (triggerResults_ == nullptr)
55  return triggerResults_->accept();
56  }
57 
59  if (triggerResults_ == nullptr)
61  return triggerResults_->error();
62  }
63 
65  if (triggerResults_ == nullptr)
67  unsigned i = getAndCheckIndex(pathName);
68  return triggerResults_->at(i);
69  }
70 
71  HLTPathStatus const& TriggerResultsByName::at(unsigned i) const {
72  if (triggerResults_ == nullptr)
74  return triggerResults_->at(i);
75  }
76 
78  if (triggerResults_ == nullptr)
80  unsigned i = getAndCheckIndex(pathName);
81  return triggerResults_->at(i);
82  }
83 
85  if (triggerResults_ == nullptr)
87  return triggerResults_->at(i);
88  }
89 
91  if (triggerResults_ == nullptr)
93  unsigned i = getAndCheckIndex(pathName);
94  return triggerResults_->wasrun(i);
95  }
96 
97  bool TriggerResultsByName::wasrun(unsigned i) const {
98  if (triggerResults_ == nullptr)
100  return triggerResults_->wasrun(i);
101  }
102 
104  if (triggerResults_ == nullptr)
106  unsigned i = getAndCheckIndex(pathName);
107  return triggerResults_->accept(i);
108  }
109 
110  bool TriggerResultsByName::accept(unsigned i) const {
111  if (triggerResults_ == nullptr)
113  return triggerResults_->accept(i);
114  }
115 
117  if (triggerResults_ == nullptr)
119  unsigned i = getAndCheckIndex(pathName);
120  return triggerResults_->error(i);
121  }
122 
123  bool TriggerResultsByName::error(unsigned i) const {
124  if (triggerResults_ == nullptr)
126  return triggerResults_->error(i);
127  }
128 
130  if (triggerResults_ == nullptr)
132  unsigned i = getAndCheckIndex(pathName);
133  return triggerResults_->state(i);
134  }
135 
137  if (triggerResults_ == nullptr)
139  return triggerResults_->state(i);
140  }
141 
143  if (triggerResults_ == nullptr)
145  unsigned i = getAndCheckIndex(pathName);
146  return triggerResults_->index(i);
147  }
148 
149  unsigned TriggerResultsByName::index(unsigned i) const {
150  if (triggerResults_ == nullptr)
152  return triggerResults_->index(i);
153  }
154 
155  std::vector<std::string> const& TriggerResultsByName::triggerNames() const {
156  if (triggerResults_ == nullptr)
158  if (triggerNames_ == nullptr)
160  return triggerNames_->triggerNames();
161  }
162 
164  if (triggerResults_ == nullptr)
166  if (triggerNames_ == nullptr)
168  return triggerNames_->triggerName(i);
169  }
170 
172  if (triggerResults_ == nullptr)
174  if (triggerNames_ == nullptr)
176  return triggerNames_->triggerIndex(pathName);
177  }
178 
180  if (triggerResults_ == nullptr)
182  return triggerResults_->size();
183  }
184 
186  if (triggerNames_ == nullptr)
188  unsigned i = triggerNames_->triggerIndex(pathName);
189  if (i == triggerNames_->size()) {
191  << "TriggerResultsByName::getAndCheckIndex\n"
192  << "Requested trigger name \"" << pathName << "\" does not match any known trigger.\n";
193  }
194  return i;
195  }
196 
199  << "TriggerResultsByName has a null pointer to TriggerResults.\n"
200  << "This probably means TriggerResults was not found in the Event\n"
201  << "because the product was dropped or never created. It could also\n"
202  << "mean it was requested for a process that does not exist or was\n"
203  << "misspelled\n";
204  }
205 
208  << "TriggerResultsByName has a null pointer to TriggerNames.\n"
209  << "This should never happen. It could indicate the ParameterSet\n"
210  << "containing the names is missing from the ParameterSet registry.\n"
211  << "Please report this to the edm developers along with instructions\n"
212  << "to reproduce the problem\n";
213  }
214 } // namespace edm
std::size_t size() const
Definition: TriggerNames.cc:59
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:16
bool accept() const
Has at least one path accepted the event?
HLTPathStatus const & at(std::string const &pathName) const
unsigned int triggerIndex(std::string_view name) const
Definition: TriggerNames.cc:52
unsigned triggerIndex(std::string const &pathName) const
std::string const & triggerName(unsigned i) const
uint16_t size_type
Strings const & triggerNames() const
Definition: TriggerNames.cc:48
ParameterSetID const & parameterSetID() const
Definition: TriggerNames.cc:61
std::vector< std::string > const & triggerNames() const
unsigned index(std::string const &pathName) const
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:50
static std::string const triggerResults("TriggerResults")
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.