DataFormats
PatCandidates
src
TriggerObject.cc
Go to the documentation of this file.
1
//
2
//
3
4
#include "
DataFormats/PatCandidates/interface/TriggerObject.h
"
5
6
#include "
FWCore/Utilities/interface/EDMException.h
"
7
8
using namespace
pat
;
9
10
// Constructors and Destructor
11
12
// Default constructor
13
TriggerObject::TriggerObject
() :
reco
::LeafCandidate() {
triggerObjectTypes_
.clear(); }
14
15
// Constructor from trigger::TriggerObject
16
TriggerObject::TriggerObject
(
const
trigger::TriggerObject
& trigObj)
17
:
reco
::LeafCandidate(0, trigObj.particle().
p4
(),
reco
::
Particle
::
Point
(0., 0., 0.), trigObj.
id
()), refToOrig_() {
18
triggerObjectTypes_
.clear();
19
}
20
21
// Constructors from base class object
22
TriggerObject::TriggerObject
(
const
reco::LeafCandidate
& leafCand) :
reco
::LeafCandidate(leafCand), refToOrig_() {
23
triggerObjectTypes_
.clear();
24
}
25
26
// Constructors from base candidate reference (for 'l1extra' particles)
27
TriggerObject::TriggerObject
(
const
reco::CandidateBaseRef
& candRef)
28
:
reco
::LeafCandidate(*candRef), refToOrig_(candRef) {
29
triggerObjectTypes_
.clear();
30
}
31
32
// Constructors from Lorentz-vectors and (optional) PDG ID
33
TriggerObject::TriggerObject
(
const
reco::Particle::LorentzVector
& vec,
int
id
)
34
:
reco
::LeafCandidate(0, vec,
reco
::
Particle
::
Point
(0., 0., 0.),
id
), refToOrig_() {
35
triggerObjectTypes_
.clear();
36
}
37
TriggerObject::TriggerObject
(
const
reco::Particle::PolarLorentzVector
& vec,
int
id
)
38
:
reco
::LeafCandidate(0, vec,
reco
::
Particle
::
Point
(0., 0., 0.),
id
), refToOrig_() {
39
triggerObjectTypes_
.clear();
40
}
41
42
// Methods
43
44
// Get all trigger object type identifiers
45
std::vector<int>
TriggerObject::triggerObjectTypes
()
const
{
46
std::vector<int>
triggerObjectTypes
;
47
for
(
size_t
iTo = 0; iTo <
triggerObjectTypes_
.size(); ++iTo) {
48
triggerObjectTypes
.push_back(
triggerObjectTypes_
.at(iTo));
49
}
50
return
triggerObjectTypes
;
51
}
52
53
// Checks, if a certain label of original collection is assigned
54
bool
TriggerObject::hasCollection
(
const
std::string
&
collName
)
const
{
55
// True, if collection name is simply fine
56
if
(
collName
==
collection_
)
57
return
true
;
58
// Check, if collection name possibly fits in an edm::InputTag approach
59
const
edm::InputTag
collectionTag(
collection_
);
60
const
edm::InputTag
collTag(
collName
);
61
// If evaluated collection tag contains a process name, it must have been found already by identity check
62
if
(collTag.process().empty()) {
63
// Check instance ...
64
if
((collTag.instance().empty() && collectionTag.instance().empty()) ||
65
collTag.instance() == collectionTag.instance()) {
66
// ... and label
67
return
(collTag.label() == collectionTag.label());
68
}
69
}
70
return
false
;
71
}
72
73
// Checks, if a certain trigger object type identifier is assigned
74
bool
TriggerObject::hasTriggerObjectType
(
trigger::TriggerObjectType
triggerObjectType)
const
{
75
for
(
size_t
iF = 0; iF <
triggerObjectTypes_
.size(); ++iF) {
76
if
(triggerObjectType ==
triggerObjectTypes_
.at(iF))
77
return
true
;
78
}
79
return
false
;
80
}
81
82
// Special methods for 'l1extra' particles
83
84
// Getters specific to the 'l1extra' particle types
85
// Exceptions of type 'edm::errors::InvalidReference' are thrown,
86
// if wrong particle type is requested
87
88
// EM
89
const
l1extra::L1EmParticleRef
TriggerObject::origL1EmRef
()
const
{
90
l1extra::L1EmParticleRef
l1Ref;
91
try
{
92
l1Ref =
origObjRef
().
castTo
<
l1extra::L1EmParticleRef
>();
93
}
catch
(
edm::Exception
const
&
X
) {
94
if
(
X
.categoryCode() !=
edm::errors::InvalidReference
)
95
throw
X
;
96
}
97
return
l1Ref;
98
}
99
100
// EtMiss
101
const
l1extra::L1EtMissParticleRef
TriggerObject::origL1EtMissRef
()
const
{
102
l1extra::L1EtMissParticleRef
l1Ref;
103
try
{
104
l1Ref =
origObjRef
().
castTo
<
l1extra::L1EtMissParticleRef
>();
105
}
catch
(
edm::Exception
const
&
X
) {
106
if
(
X
.categoryCode() !=
edm::errors::InvalidReference
)
107
throw
X
;
108
}
109
return
l1Ref;
110
}
111
112
// Jet
113
const
l1extra::L1JetParticleRef
TriggerObject::origL1JetRef
()
const
{
114
l1extra::L1JetParticleRef
l1Ref;
115
try
{
116
l1Ref =
origObjRef
().
castTo
<
l1extra::L1JetParticleRef
>();
117
}
catch
(
edm::Exception
const
&
X
) {
118
if
(
X
.categoryCode() !=
edm::errors::InvalidReference
)
119
throw
X
;
120
}
121
return
l1Ref;
122
}
123
124
// Muon
125
const
l1extra::L1MuonParticleRef
TriggerObject::origL1MuonRef
()
const
{
126
l1extra::L1MuonParticleRef
l1Ref;
127
try
{
128
l1Ref =
origObjRef
().
castTo
<
l1extra::L1MuonParticleRef
>();
129
}
catch
(
edm::Exception
const
&
X
) {
130
if
(
X
.categoryCode() !=
edm::errors::InvalidReference
)
131
throw
X
;
132
}
133
return
l1Ref;
134
}
trigger::TriggerObjectType
TriggerObjectType
Definition:
TriggerTypeDefs.h:23
edm::errors::InvalidReference
Definition:
EDMException.h:39
X
#define X(str)
Definition:
MuonsGrabber.cc:38
trigObjTnPSource_cfi.collName
collName
Definition:
trigObjTnPSource_cfi.py:66
pat::TriggerObject::TriggerObject
TriggerObject()
Constructors and Destructor.
pat::TriggerObject::origObjRef
const reco::CandidateBaseRef & origObjRef() const
Special methods for 'l1extra' particles.
Definition:
TriggerObject.h:120
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:45
reco::Particle::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition:
Particle.h:21
edm::Ref
Definition:
AssociativeIterator.h:58
pat::TriggerObject::hasTriggerObjectType
bool hasTriggerObjectType(trigger::TriggerObjectType triggerObjectType) const
Checks, if a certain trigger object type identifier is assigned.
edm::Exception
Definition:
EDMException.h:77
EDMException.h
pat::TriggerObject::origL1EtMissRef
const l1extra::L1EtMissParticleRef origL1EtMissRef() const
pat::TriggerObject::collection_
std::string collection_
Data Members.
Definition:
TriggerObject.h:48
reco::Particle::PolarLorentzVector
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition:
Particle.h:23
trigger::TriggerObject
Single trigger physics object (e.g., an isolated muon)
Definition:
TriggerObject.h:21
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
Point
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition:
DMRtrends.cc:57
p4
double p4[4]
Definition:
TauolaWrapper.h:92
pat::TriggerObject::triggerObjectTypes
std::vector< int > triggerObjectTypes() const
Get all trigger object type identifiers.
pat
Definition:
HeavyIon.h:7
edm::RefToBase::castTo
REF castTo() const
Definition:
RefToBase.h:257
pat::TriggerObject::triggerObjectTypes_
std::vector< trigger::TriggerObjectType > triggerObjectTypes_
Definition:
TriggerObject.h:52
pat::TriggerFilter::triggerObjectTypes_
std::vector< trigger::TriggerObjectType > triggerObjectTypes_
Definition:
TriggerFilter.h:46
pat::TriggerObject::hasCollection
virtual bool hasCollection(const std::string &collName) const
Checks, if a certain label of original collection is assigned.
triggerObjects_cff.id
id
Definition:
triggerObjects_cff.py:31
Particle
Definition:
Particle.py:1
edm::RefToBase< Candidate >
pat::TriggerObject::origL1EmRef
const l1extra::L1EmParticleRef origL1EmRef() const
reco::LeafCandidate
Definition:
LeafCandidate.h:16
pat::TriggerObject::origL1JetRef
const l1extra::L1JetParticleRef origL1JetRef() const
pat::TriggerObject::origL1MuonRef
const l1extra::L1MuonParticleRef origL1MuonRef() const
edm::InputTag
Definition:
InputTag.h:15
TriggerObject.h
Generated for CMSSW Reference Manual by
1.8.16