CMS 3D CMS Logo

PackedTriggerPrescales.cc
Go to the documentation of this file.
3 #include <cstring>
4 
6  prescaleValues_(),
7  triggerResults_(edm::RefProd<edm::TriggerResults>(handle).refCore()),
8  triggerNames_(nullptr)
9 {
10  prescaleValues_.resize(handle->size(),0);
11 }
12 
14  if (unsigned(index) >= triggerResults().size()) throw cms::Exception("InvalidReference", "Index out of bounds");
15  return prescaleValues_[index];
16 }
17 
19  if (triggerNames_ == nullptr) throw cms::Exception("LogicError", "getPrescaleForName called without having called setTriggerNames first");
20  if (prefixOnly) {
21  const std::vector<std::string> &names = triggerNames_->triggerNames();
22  size_t siz = name.length()-1;
23  while (siz > 0 && (name[siz] == '*' || name[siz] == '\0')) siz--;
24  for (unsigned int i = 0, n = names.size(); i < n; ++i) {
25  if (strncmp(name.c_str(), names[i].c_str(), siz) == 0) {
26  return getPrescaleForIndex(i);
27  }
28  }
29  throw cms::Exception("InvalidReference", "Index out of bounds");
30  } else {
31  int index = triggerNames_->triggerIndex(name);
32  return getPrescaleForIndex(index);
33  }
34 }
35 
37  if (unsigned(index) >= triggerResults().size()) throw cms::Exception("InvalidReference", "Index out of bounds");
38  prescaleValues_[index] = prescale;
39 }
40 
size
Write out results.
int getPrescaleForName(const std::string &name, bool prefixOnly=false) const
#define nullptr
Strings const & triggerNames() const
Definition: TriggerNames.cc:20
const std::string names[nVars_]
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:24
void addPrescaledTrigger(int index, int prescale)
unsigned int size() const
Get number of paths stored.
const edm::TriggerResults & triggerResults() const
const edm::TriggerNames * triggerNames_
edm::RefProd< Container > RefProd
HLT enums.
int getPrescaleForIndex(int index) const