CMS 3D CMS Logo

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 
11 
13  float intRadiusBarrel,
14  float intRadiusEndcap,
15  float stripBarrel,
16  float stripEndcap,
17  float etLow,
18  float lip,
19  float drb,
21  reco::TrackBase::Point beamPoint,
22  const std::string& dzOptionString)
23  : extRadius2_(extRadius * extRadius),
24  intRadiusBarrel2_(intRadiusBarrel * intRadiusBarrel),
25  intRadiusEndcap2_(intRadiusEndcap * intRadiusEndcap),
26  stripBarrel_(stripBarrel),
27  stripEndcap_(stripEndcap),
28  etLow_(etLow),
29  lip_(lip),
30  drb_(drb),
31  trackCollection_(trackCollection),
32  beamPoint_(beamPoint) {
33  setDzOption(dzOptionString);
34 }
35 
37  if (!s.compare("dz"))
39  else if (!s.compare("vz"))
41  else if (!s.compare("bs"))
43  else if (!s.compare("vtx"))
45  else
47 }
48 
50 
51 // unified acces to isolations
52 std::pair<int, float> PhotonTkIsolation::getIso(const reco::Candidate* photon) const {
53  int counter = 0;
54  float ptSum = 0.;
55 
56  //Take the photon position
57  float photonEta = photon->eta();
58 
59  //loop over tracks
60  for (reco::TrackCollection::const_iterator trItr = trackCollection_->begin(); trItr != trackCollection_->end();
61  ++trItr) {
62  //check z-distance of vertex
63  float dzCut = 0;
64  switch (dzOption_) {
66  dzCut = fabs((*trItr).dz() - photon->vertex().z());
67  break;
69  dzCut = fabs((*trItr).vz() - photon->vertex().z());
70  break;
72  dzCut = fabs((*trItr).dz(beamPoint_) - photon->vertex().z());
73  break;
75  dzCut = fabs((*trItr).dz(photon->vertex()));
76  break;
77  default:
78  dzCut = fabs((*trItr).vz() - photon->vertex().z());
79  break;
80  }
81  if (dzCut > lip_)
82  continue;
83 
84  float this_pt = (*trItr).pt();
85  if (this_pt < etLow_)
86  continue;
87  if (fabs((*trItr).dxy(beamPoint_)) > drb_)
88  continue; // only consider tracks from the main vertex
89  float dr2 = reco::deltaR2(*trItr, *photon);
90  float deta = (*trItr).eta() - photonEta;
91  if (fabs(photonEta) < 1.479) {
92  if (dr2 < extRadius2_ && dr2 >= intRadiusBarrel2_ && fabs(deta) >= stripBarrel_) {
93  ++counter;
94  ptSum += this_pt;
95  }
96  } else {
97  if (dr2 < extRadius2_ && dr2 >= intRadiusEndcap2_ && fabs(deta) >= stripEndcap_) {
98  ++counter;
99  ptSum += this_pt;
100  }
101  }
102 
103  } //end loop over tracks
104 
105  std::pair<int, float> retval;
106  retval.first = counter;
107  retval.second = ptSum;
108  return retval;
109 }
PhotonTkIsolation::setDzOption
void setDzOption(const std::string &s)
Definition: PhotonTkIsolation.cc:36
muons2muons_cfi.photon
photon
Definition: muons2muons_cfi.py:28
counter
Definition: counter.py:1
PhotonTkIsolation::intRadiusBarrel2_
float intRadiusBarrel2_
Definition: PhotonTkIsolation.h:109
PhotonTkIsolation::PhotonTkIsolation
PhotonTkIsolation(float extRadius, float intRadius, float etLow, float lip, float drb, const reco::TrackCollection *trackCollection, reco::TrackBase::Point beamPoint)
Definition: PhotonTkIsolation.h:23
PhotonTkIsolation::etLow_
float etLow_
Definition: PhotonTkIsolation.h:113
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:118
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:114
PhotonTkIsolation::~PhotonTkIsolation
~PhotonTkIsolation()
Definition: PhotonTkIsolation.cc:49
egammaisolation::EgammaTrackSelector::bs
Definition: EgammaTrackSelector.h:20
egammaisolation::EgammaTrackSelector::vz
Definition: EgammaTrackSelector.h:20
HLTObjectMonitor_cfi.photonEta
photonEta
Definition: HLTObjectMonitor_cfi.py:62
PhotonTkIsolation::stripBarrel_
float stripBarrel_
Definition: PhotonTkIsolation.h:111
PhotonTkIsolation::trackCollection_
const reco::TrackCollection * trackCollection_
Definition: PhotonTkIsolation.h:117
qcdUeDQM_cfi.lip
lip
Definition: qcdUeDQM_cfi.py:25
alignCSCRings.s
s
Definition: alignCSCRings.py:92
PhotonTkIsolation::getIso
std::pair< int, float > getIso(const reco::Candidate *) const
Definition: PhotonTkIsolation.cc:52
TrackSplittingMonitor_cfi.dzCut
dzCut
Definition: TrackSplittingMonitor_cfi.py:20
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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:112
egammaisolation::EgammaTrackSelector::vtx
Definition: EgammaTrackSelector.h:20
counter
static std::atomic< unsigned int > counter
Definition: SharedResourceNames.cc:17
EgammaTrackSelector.h
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
PhotonTkIsolation::intRadiusEndcap2_
float intRadiusEndcap2_
Definition: PhotonTkIsolation.h:110
PhotonTkIsolation::dzOption_
int dzOption_
Definition: PhotonTkIsolation.h:120
PhotonTkIsolation::drb_
float drb_
Definition: PhotonTkIsolation.h:115
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14