Main Page
Namespaces
Classes
Package Documentation
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_(),
7
triggerResults_(
edm
::
RefProd
<
edm
::TriggerResults>(handle).refCore()),
8
triggerNames_(
nullptr
)
9
{
10
prescaleValues_
.resize(handle->
size
(),0);
11
}
12
13
int
pat::PackedTriggerPrescales::getPrescaleForIndex
(
int
index
)
const
{
14
if
(
unsigned
(index) >=
triggerResults
().
size
())
throw
cms::Exception
(
"InvalidReference"
,
"Index out of bounds"
);
15
return
prescaleValues_
[
index
];
16
}
17
18
int
pat::PackedTriggerPrescales::getPrescaleForName
(
const
std::string
&
name
,
bool
prefixOnly)
const
{
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
36
void
pat::PackedTriggerPrescales::addPrescaledTrigger
(
int
index
,
int
prescale
) {
37
if
(
unsigned
(index) >=
triggerResults
().
size
())
throw
cms::Exception
(
"InvalidReference"
,
"Index out of bounds"
);
38
prescaleValues_
[
index
] = prescale;
39
}
40
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:443
PackedTriggerPrescales.h
mps_fire.i
i
Definition:
mps_fire.py:330
pat::PackedTriggerPrescales::getPrescaleForName
int getPrescaleForName(const std::string &name, bool prefixOnly=false) const
Definition:
PackedTriggerPrescales.cc:18
Exception
Definition:
hltDiff.cc:292
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::Handle< edm::TriggerResults >
nullptr
#define nullptr
Definition:
GCC11Compatibility.h:37
pat::PackedTriggerPrescales::prescaleValues_
std::vector< int > prescaleValues_
Definition:
PackedTriggerPrescales.h:34
pat::PackedTriggerPrescales::PackedTriggerPrescales
PackedTriggerPrescales()
Definition:
PackedTriggerPrescales.h:12
edm::TriggerNames::triggerNames
Strings const & triggerNames() const
Definition:
TriggerNames.cc:20
names
const std::string names[nVars_]
Definition:
PhotonIDValueMapProducer.cc:121
RefProd.h
AlignmentPI::index
index
Definition:
AlignmentPayloadInspectorHelper.h:36
edm::TriggerNames::triggerIndex
unsigned int triggerIndex(std::string const &name) const
Definition:
TriggerNames.cc:24
pat::PackedTriggerPrescales::addPrescaledTrigger
void addPrescaledTrigger(int index, int prescale)
Definition:
PackedTriggerPrescales.cc:36
edm::HLTGlobalStatus::size
unsigned int size() const
Get number of paths stored.
Definition:
HLTGlobalStatus.h:39
pat::PackedTriggerPrescales::triggerResults
const edm::TriggerResults & triggerResults() const
Definition:
PackedTriggerPrescales.h:22
prescale
Definition:
PrescaleEventFilter.cc:33
pat::PackedTriggerPrescales::triggerNames_
const edm::TriggerNames * triggerNames_
Definition:
PackedTriggerPrescales.h:36
reco::JetExtendedAssociation::RefProd
edm::RefProd< Container > RefProd
Definition:
JetExtendedAssociation.h:33
cmsBatch.handle
handle
Definition:
cmsBatch.py:286
gen::n
int n
Definition:
Cascade2Hadronizer.cc:79
edm
HLT enums.
Definition:
AlignableModifier.h:17
pat::PackedTriggerPrescales::getPrescaleForIndex
int getPrescaleForIndex(int index) const
Definition:
PackedTriggerPrescales.cc:13
dataset.name
name
Definition:
dataset.py:45
Generated for CMSSW Reference Manual by
1.8.11