CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
35 template<typename T1>
37 {}
38 
39 template<typename T1>
41 
42  drVeto2_ = -1.;
43  float etaStrip = -1;
44 
45  if (fabs(candRef->eta()) < 1.479) {
46  drVeto2_ = drVetoBarrel_*drVetoBarrel_;
47  etaStrip = etaStripBarrel_;
48  } else {
49  drVeto2_ = drVetoEndcap_*drVetoEndcap_;
50  etaStrip = etaStripEndcap_;
51  }
52 
53  float etSum = 0;
54  for (size_t i=0; i<clusterHandle->size(); i++) {
55  reco::PFClusterRef pfclu(clusterHandle, i);
56 
57  if (fabs(candRef->eta()) < 1.479) {
58  if (fabs(pfclu->pt()) < energyBarrel_)
59  continue;
60  } else {
61  if (fabs(pfclu->energy()) < energyEndcap_)
62  continue;
63  }
64 
65  float dEta = fabs(candRef->eta() - pfclu->eta());
66  if(dEta < etaStrip) continue;
67  if (not computedRVeto(candRef, pfclu)) continue;
68 
69  etSum += pfclu->pt();
70  }
71 
72  return etSum;
73 }
74 
75 template<typename T1>
77 
78  float dR2 = deltaR2(candRef->eta(), candRef->phi(), pfclu->eta(), pfclu->phi());
79  if(dR2 > (drMax_*drMax_))
80  return false;
81 
82  if (candRef->superCluster().isNonnull()) {
83  // Exclude clusters that are part of the candidate
84  for (reco::CaloCluster_iterator it = candRef->superCluster()->clustersBegin(); it != candRef->superCluster()->clustersEnd(); ++it) {
85  if ((*it)->seed() == pfclu->seed()) {
86  return false;
87  }
88  }
89  }
90 
91  return true;
92 }
93 
94 template<>
96 
97  float dR2 = deltaR2(candRef->eta(), candRef->phi(), pfclu->eta(), pfclu->phi());
98  if(dR2 > (drMax_*drMax_) || dR2 < drVeto2_)
99  return false;
100  else
101  return true;
102 }
103 
EcalPFClusterIsolation(double drMax, double drVetoBarrel, double drVetoEndcap, double etaStripBarrel, double etaStripEndcap, double energyBarrel, double energyEndcap)
int i
Definition: DBlmapReader.cc:9
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
bool computedRVeto(T1Ref candRef, reco::PFClusterRef pfclu)
double getSum(T1Ref, edm::Handle< std::vector< reco::PFCluster > >)
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Definition: deltaR.h:36