CMS 3D CMS Logo

EcalPFClusterIsolation.cc
Go to the documentation of this file.
1 //*****************************************************************************
2 // File: EgammaRecHitIsolation.cc
3 // ----------------------------------------------------------------------------
4 // OrigAuth: Matthias Mozer, hacked by Sam Harper (ie the ugly stuff is mine)
5 // Institute: IIHE-VUB, RAL
6 //=============================================================================
7 //*****************************************************************************
8 
10 
15 
17 
18 template <typename T1>
20  double drVetoBarrel,
21  double drVetoEndcap,
22  double etaStripBarrel,
23  double etaStripEndcap,
24  double energyBarrel,
25  double energyEndcap)
26  : drMax_(drMax),
27  drVetoBarrel_(drVetoBarrel),
28  drVetoEndcap_(drVetoEndcap),
29  etaStripBarrel_(etaStripBarrel),
30  etaStripEndcap_(etaStripEndcap),
31  energyBarrel_(energyBarrel),
32  energyEndcap_(energyEndcap) {}
33 
34 template <typename T1>
36 
37 template <typename T1>
39  drVeto2_ = -1.;
40  float etaStrip = -1;
41 
42  if (fabs(candRef->eta()) < 1.479) {
44  etaStrip = etaStripBarrel_;
45  } else {
47  etaStrip = etaStripEndcap_;
48  }
49 
50  float etSum = 0;
51  for (size_t i = 0; i < clusterHandle->size(); i++) {
52  reco::PFClusterRef pfclu(clusterHandle, i);
53 
54  if (fabs(candRef->eta()) < 1.479) {
55  if (fabs(pfclu->pt()) < energyBarrel_)
56  continue;
57  } else {
58  if (fabs(pfclu->energy()) < energyEndcap_)
59  continue;
60  }
61 
62  float dEta = fabs(candRef->eta() - pfclu->eta());
63  if (dEta < etaStrip)
64  continue;
65  if (not computedRVeto(candRef, pfclu))
66  continue;
67 
68  etSum += pfclu->pt();
69  }
70 
71  return etSum;
72 }
73 
74 template <typename T1>
76  float dR2 = deltaR2(candRef->eta(), candRef->phi(), pfclu->eta(), pfclu->phi());
77  if (dR2 > (drMax_ * drMax_))
78  return false;
79 
80  if (candRef->superCluster().isNonnull()) {
81  // Exclude clusters that are part of the candidate
82  for (reco::CaloCluster_iterator it = candRef->superCluster()->clustersBegin();
83  it != candRef->superCluster()->clustersEnd();
84  ++it) {
85  if ((*it)->seed() == pfclu->seed()) {
86  return false;
87  }
88  }
89  }
90 
91  return true;
92 }
93 
94 template <>
96  float dR2 = deltaR2(candRef->eta(), candRef->phi(), pfclu->eta(), pfclu->phi());
97  if (dR2 > (drMax_ * drMax_) || dR2 < drVeto2_)
98  return false;
99  else
100  return true;
101 }
102 
EcalPFClusterIsolation(double drMax, double drVetoBarrel, double drVetoEndcap, double etaStripBarrel, double etaStripEndcap, double energyBarrel, double energyEndcap)
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
bool computedRVeto(T1Ref candRef, reco::PFClusterRef pfclu)
double getSum(T1Ref, edm::Handle< std::vector< reco::PFCluster > >)