RecoEgamma
EgammaIsolationAlgos
src
PhotonTkIsolation.cc
Go to the documentation of this file.
1
//*****************************************************************************
2
// File: PhotonTkIsolation.cc
3
// ----------------------------------------------------------------------------
4
// OrigAuth: Matthias Mozer
5
// Institute: IIHE-VUB
6
//=============================================================================
7
//*****************************************************************************
8
//C++ includes
9
#include <vector>
10
#include <functional>
11
12
//ROOT includes
13
#include <Math/VectorUtil.h>
14
15
//CMSSW includes
16
#include "
RecoEgamma/EgammaIsolationAlgos/interface/PhotonTkIsolation.h
"
17
#include "
DataFormats/TrackReco/interface/TrackFwd.h
"
18
#include "
TrackingTools/PatternTools/interface/Trajectory.h
"
19
#include "
TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h
"
20
#include "
DataFormats/GeometryVector/interface/GlobalPoint.h
"
21
#include "
DataFormats/GeometryVector/interface/GlobalVector.h
"
22
#include "
DataFormats/RecoCandidate/interface/RecoCandidate.h
"
23
#include "
DataFormats/EgammaReco/interface/SuperCluster.h
"
24
#include "
DataFormats/EgammaReco/interface/SuperClusterFwd.h
"
25
#include "
DataFormats/GsfTrackReco/interface/GsfTrack.h
"
26
#include "
DataFormats/VertexReco/interface/Vertex.h
"
27
#include "
DataFormats/Candidate/interface/Particle.h
"
28
29
PhotonTkIsolation::PhotonTkIsolation
(
float
extRadius
,
30
float
intRadiusBarrel
,
31
float
intRadiusEndcap
,
32
float
stripBarrel
,
33
float
stripEndcap
,
34
float
etLow,
35
float
lip
,
36
float
drb,
37
const
reco::TrackCollection
*
trackCollection
,
38
reco::TrackBase::Point
beamPoint,
39
const
std::string
& dzOptionString)
40
: extRadius2_(
extRadius
*
extRadius
),
41
intRadiusBarrel2_(
intRadiusBarrel
*
intRadiusBarrel
),
42
intRadiusEndcap2_(
intRadiusEndcap
*
intRadiusEndcap
),
43
stripBarrel_(
stripBarrel
),
44
stripEndcap_(
stripEndcap
),
45
etLow_(etLow),
46
lip_(
lip
),
47
drb_(drb),
48
trackCollection_(
trackCollection
),
49
beamPoint_(beamPoint) {
50
setDzOption
(dzOptionString);
51
}
52
53
void
PhotonTkIsolation::setDzOption
(
const
std::string
&
s
) {
54
if
(!
s
.compare(
"dz"
))
55
dzOption_
=
egammaisolation::EgammaTrackSelector::dz
;
56
else
if
(!
s
.compare(
"vz"
))
57
dzOption_
=
egammaisolation::EgammaTrackSelector::vz
;
58
else
if
(!
s
.compare(
"bs"
))
59
dzOption_
=
egammaisolation::EgammaTrackSelector::bs
;
60
else
if
(!
s
.compare(
"vtx"
))
61
dzOption_
=
egammaisolation::EgammaTrackSelector::vtx
;
62
else
63
dzOption_
=
egammaisolation::EgammaTrackSelector::dz
;
64
}
65
66
PhotonTkIsolation::~PhotonTkIsolation
() {}
67
68
// unified acces to isolations
69
std::pair<int, float>
PhotonTkIsolation::getIso
(
const
reco::Candidate
*
photon
)
const
{
70
int
counter
= 0;
71
float
ptSum = 0.;
72
73
//Take the photon position
74
float
photonEta
=
photon
->eta();
75
76
//loop over tracks
77
for
(reco::TrackCollection::const_iterator trItr =
trackCollection_
->begin(); trItr !=
trackCollection_
->end();
78
++trItr) {
79
//check z-distance of vertex
80
float
dzCut
= 0;
81
switch
(
dzOption_
) {
82
case
egammaisolation::EgammaTrackSelector::dz
:
83
dzCut
= fabs((*trItr).dz() -
photon
->vertex().z());
84
break
;
85
case
egammaisolation::EgammaTrackSelector::vz
:
86
dzCut
= fabs((*trItr).vz() -
photon
->vertex().z());
87
break
;
88
case
egammaisolation::EgammaTrackSelector::bs
:
89
dzCut
= fabs((*trItr).dz(
beamPoint_
) -
photon
->vertex().z());
90
break
;
91
case
egammaisolation::EgammaTrackSelector::vtx
:
92
dzCut
= fabs((*trItr).dz(
photon
->vertex()));
93
break
;
94
default
:
95
dzCut
= fabs((*trItr).vz() -
photon
->vertex().z());
96
break
;
97
}
98
if
(
dzCut
>
lip_
)
99
continue
;
100
101
float
this_pt = (*trItr).pt();
102
if
(this_pt <
etLow_
)
103
continue
;
104
if
(fabs((*trItr).dxy(
beamPoint_
)) >
drb_
)
105
continue
;
// only consider tracks from the main vertex
106
float
dr2 =
reco::deltaR2
(*trItr, *
photon
);
107
float
deta = (*trItr).eta() -
photonEta
;
108
if
(fabs(
photonEta
) < 1.479) {
109
if
(dr2 < extRadius2_ && dr2 >=
intRadiusBarrel2_
&& fabs(deta) >=
stripBarrel_
) {
110
++
counter
;
111
ptSum += this_pt;
112
}
113
}
else
{
114
if
(dr2 < extRadius2_ && dr2 >=
intRadiusEndcap2_
&& fabs(deta) >=
stripEndcap_
) {
115
++
counter
;
116
ptSum += this_pt;
117
}
118
}
119
120
}
//end loop over tracks
121
122
std::pair<int, float> retval;
123
retval.first =
counter
;
124
retval.second = ptSum;
125
return
retval;
126
}
PhotonTkIsolation::setDzOption
void setDzOption(const std::string &s)
Definition:
PhotonTkIsolation.cc:53
muons2muons_cfi.photon
photon
Definition:
muons2muons_cfi.py:28
counter
Definition:
counter.py:1
PhotonTkIsolation::intRadiusBarrel2_
float intRadiusBarrel2_
Definition:
PhotonTkIsolation.h:111
PhotonTkIsolation::PhotonTkIsolation
PhotonTkIsolation(float extRadius, float intRadius, float etLow, float lip, float drb, const reco::TrackCollection *trackCollection, reco::TrackBase::Point beamPoint)
Definition:
PhotonTkIsolation.h:25
PhotonTkIsolation::etLow_
float etLow_
Definition:
PhotonTkIsolation.h:115
electronTrackIsolationLcone_cfi.stripEndcap
stripEndcap
Definition:
electronTrackIsolationLcone_cfi.py:9
egammaisolation::EgammaTrackSelector::dz
Definition:
EgammaTrackSelector.h:20
PhotonTkIsolation::beamPoint_
reco::TrackBase::Point beamPoint_
Definition:
PhotonTkIsolation.h:120
electronEcalRecHitIsolationLcone_cfi.extRadius
extRadius
Definition:
electronEcalRecHitIsolationLcone_cfi.py:18
electronEcalRecHitIsolationLcone_cfi.intRadiusBarrel
intRadiusBarrel
Definition:
electronEcalRecHitIsolationLcone_cfi.py:15
PhotonTkIsolation::lip_
float lip_
Definition:
PhotonTkIsolation.h:116
PhotonTkIsolation::~PhotonTkIsolation
~PhotonTkIsolation()
Definition:
PhotonTkIsolation.cc:66
egammaisolation::EgammaTrackSelector::bs
Definition:
EgammaTrackSelector.h:20
egammaisolation::EgammaTrackSelector::vz
Definition:
EgammaTrackSelector.h:20
HLTObjectMonitor_cfi.photonEta
photonEta
Definition:
HLTObjectMonitor_cfi.py:62
RecoCandidate.h
PhotonTkIsolation::stripBarrel_
float stripBarrel_
Definition:
PhotonTkIsolation.h:113
PhotonTkIsolation::trackCollection_
const reco::TrackCollection * trackCollection_
Definition:
PhotonTkIsolation.h:119
qcdUeDQM_cfi.lip
lip
Definition:
qcdUeDQM_cfi.py:25
alignCSCRings.s
s
Definition:
alignCSCRings.py:92
TrackFwd.h
PhotonTkIsolation::getIso
std::pair< int, float > getIso(const reco::Candidate *) const
Definition:
PhotonTkIsolation.cc:69
TrackSplittingMonitor_cfi.dzCut
dzCut
Definition:
TrackSplittingMonitor_cfi.py:20
Particle.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
Vertex.h
electronTrackIsolationLcone_cfi.stripBarrel
stripBarrel
Definition:
electronTrackIsolationLcone_cfi.py:8
duplicaterechits_cfi.trackCollection
trackCollection
Definition:
duplicaterechits_cfi.py:4
reco::deltaR2
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition:
deltaR.h:16
PhotonTkIsolation::stripEndcap_
float stripEndcap_
Definition:
PhotonTkIsolation.h:114
egammaisolation::EgammaTrackSelector::vtx
Definition:
EgammaTrackSelector.h:20
GsfTrack.h
counter
static std::atomic< unsigned int > counter
Definition:
SharedResourceNames.cc:15
electronEcalRecHitIsolationLcone_cfi.intRadiusEndcap
intRadiusEndcap
Definition:
electronEcalRecHitIsolationLcone_cfi.py:16
reco::Candidate
Definition:
Candidate.h:27
reco::TrackBase::Point
math::XYZPoint Point
point in the space
Definition:
TrackBase.h:80
PhotonTkIsolation.h
Trajectory.h
PhotonTkIsolation::intRadiusEndcap2_
float intRadiusEndcap2_
Definition:
PhotonTkIsolation.h:112
SuperClusterFwd.h
SuperCluster.h
PhotonTkIsolation::dzOption_
int dzOption_
Definition:
PhotonTkIsolation.h:122
GlobalVector.h
TrajectoryStateTransform.h
PhotonTkIsolation::drb_
float drb_
Definition:
PhotonTkIsolation.h:117
GlobalPoint.h
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition:
TrackFwd.h:14
Generated for CMSSW Reference Manual by
1.8.16