test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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_(0)
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_ == 0) 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 
int i
Definition: DBlmapReader.cc:9
int getPrescaleForName(const std::string &name, bool prefixOnly=false) const
static const HistoName names[]
void addPrescaledTrigger(int index, int prescale)
tuple handle
Definition: patZpeak.py:22
static std::string const triggerResults
Definition: EdmProvDump.cc:41
edm::RefProd< Container > RefProd
int getPrescaleForIndex(int index) const
tuple size
Write out results.