CMS 3D CMS Logo

PackedTriggerPrescales.cc
Go to the documentation of this file.
3 #include <cstring>
4 
6  : prescaleValues_(), triggerResults_(edm::RefProd<edm::TriggerResults>(handle).refCore()), triggerNames_(nullptr) {
7  prescaleValues_.resize(handle->size(), 0);
8 }
9 
11  if (unsigned(index) >= triggerResults().size())
12  throw cms::Exception("InvalidReference", "Index out of bounds");
13  return prescaleValues_[index];
14 }
15 
17  if (triggerNames_ == nullptr)
18  throw cms::Exception("LogicError", "getPrescaleForName called without having called setTriggerNames first");
19  if (prefixOnly) {
20  const std::vector<std::string> &names = triggerNames_->triggerNames();
21  size_t siz = name.length() - 1;
22  while (siz > 0 && (name[siz] == '*' || name[siz] == '\0'))
23  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())
38  throw cms::Exception("InvalidReference", "Index out of bounds");
39  prescaleValues_[index] = prescale;
40 }
size
Write out results.
int getPrescaleForName(const std::string &name, bool prefixOnly=false) const
const std::string names[nVars_]
void addPrescaledTrigger(int index, int prescale)
int getPrescaleForIndex(int index) const
static std::string const triggerResults
Definition: EdmProvDump.cc:44
edm::RefProd< Container > RefProd
HLT enums.