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 }
RefProd.h
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
patZpeak.handle
handle
Definition: patZpeak.py:23
edm
HLT enums.
Definition: AlignableModifier.h:19
pat::PackedTriggerPrescales::PackedTriggerPrescales
PackedTriggerPrescales()
Definition: PackedTriggerPrescales.h:12
triggerResults
static const std::string triggerResults
Definition: EdmProvDump.cc:45
pat::PackedTriggerPrescales::getPrescaleForName
int getPrescaleForName(const std::string &name, bool prefixOnly=false) const
Definition: PackedTriggerPrescales.cc:16
edm::Handle< edm::TriggerResults >
pat::PackedTriggerPrescales::addPrescaledTrigger
void addPrescaledTrigger(int index, int prescale)
Definition: PackedTriggerPrescales.cc:36
pat::PackedTriggerPrescales::getPrescaleForIndex
int getPrescaleForIndex(int index) const
Definition: PackedTriggerPrescales.cc:10
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
pat::PackedTriggerPrescales::prescaleValues_
std::vector< int > prescaleValues_
Definition: PackedTriggerPrescales.h:32
PackedTriggerPrescales.h
commonCuts_cff.triggerResults_
triggerResults_
Definition: commonCuts_cff.py:17
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
prescale
Definition: PrescaleEventFilter.cc:32
Exception
Definition: hltDiff.cc:245
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
HLTObjectsMonitor_cfi.TriggerResults
TriggerResults
Definition: HLTObjectsMonitor_cfi.py:9
reco::JetExtendedAssociation::RefProd
edm::RefProd< Container > RefProd
Definition: JetExtendedAssociation.h:33
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443