src
DataFormats
PatCandidates
src
PackedTriggerPrescales.cc
Go to the documentation of this file.
1
#include "
DataFormats/PatCandidates/interface/PackedTriggerPrescales.h
"
2
#include "
DataFormats/Common/interface/RefProd.h
"
3
#include <cstring>
4
5
pat::PackedTriggerPrescales::PackedTriggerPrescales
(
const
edm::Handle<edm::TriggerResults>
&
handle
)
6
: prescaleValues_(),
triggerResults_
(
edm
::
RefProd
<
edm
::
TriggerResults
>(
handle
).refCore()), triggerNames_(nullptr) {
7
prescaleValues_
.resize(
handle
->size(), 0);
8
}
9
10
int
pat::PackedTriggerPrescales::getPrescaleForIndex
(
int
index
)
const
{
11
if
(
unsigned
(
index
) >=
triggerResults
().
size
())
12
throw
cms::Exception
(
"InvalidReference"
,
"Index out of bounds"
);
13
return
prescaleValues_[
index
];
14
}
15
16
int
pat::PackedTriggerPrescales::getPrescaleForName
(
const
std::string
&
name
,
bool
prefixOnly)
const
{
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
36
void
pat::PackedTriggerPrescales::addPrescaledTrigger
(
int
index
,
int
prescale
) {
37
if
(
unsigned
(
index
) >=
triggerResults
().
size
())
38
throw
cms::Exception
(
"InvalidReference"
,
"Index out of bounds"
);
39
prescaleValues_[
index
] =
prescale
;
40
}
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:443
PackedTriggerPrescales.h
mps_fire.i
i
Definition:
mps_fire.py:428
pat::PackedTriggerPrescales::getPrescaleForName
int getPrescaleForName(const std::string &name, bool prefixOnly=false) const
Definition:
PackedTriggerPrescales.cc:16
Exception
Definition:
hltDiff.cc:245
edm::Handle< edm::TriggerResults >
pat::PackedTriggerPrescales::prescaleValues_
std::vector< int > prescaleValues_
Definition:
PackedTriggerPrescales.h:32
pat::PackedTriggerPrescales::PackedTriggerPrescales
PackedTriggerPrescales()
Definition:
PackedTriggerPrescales.h:12
names
const std::string names[nVars_]
Definition:
PhotonIDValueMapProducer.cc:124
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
dqmiodumpmetadata.n
n
Definition:
dqmiodumpmetadata.py:28
RefProd.h
AlignmentPI::index
index
Definition:
AlignmentPayloadInspectorHelper.h:46
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
prescale
Definition:
PrescaleEventFilter.cc:32
HLTObjectsMonitor_cfi.TriggerResults
TriggerResults
Definition:
HLTObjectsMonitor_cfi.py:9
patZpeak.handle
handle
Definition:
patZpeak.py:25
triggerResults
static std::string const triggerResults
Definition:
EdmProvDump.cc:44
reco::JetExtendedAssociation::RefProd
edm::RefProd< Container > RefProd
Definition:
JetExtendedAssociation.h:33
edm
HLT enums.
Definition:
AlignableModifier.h:19
commonCuts_cff.triggerResults_
triggerResults_
Definition:
commonCuts_cff.py:17
Skims_PA_cff.name
name
Definition:
Skims_PA_cff.py:17
Generated for CMSSW Reference Manual by
1.8.14