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) {
43  drVeto2_ = drVetoBarrel_ * drVetoBarrel_;
44  etaStrip = etaStripBarrel_;
45  } else {
46  drVeto2_ = drVetoEndcap_ * drVetoEndcap_;
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 
HLT_2018_cff.etaStripEndcap
etaStripEndcap
Definition: HLT_2018_cff.py:17512
mps_fire.i
i
Definition: mps_fire.py:355
EcalPFClusterIsolation::computedRVeto
bool computedRVeto(T1Ref candRef, reco::PFClusterRef pfclu)
Definition: EcalPFClusterIsolation.cc:75
edm::PtrVectorItr
Definition: PtrVector.h:51
EcalPFClusterIsolation::getSum
double getSum(T1Ref, edm::Handle< std::vector< reco::PFCluster > >)
Definition: EcalPFClusterIsolation.cc:38
edm::Handle
Definition: AssociativeIterator.h:50
HLT_2018_cff.dEta
dEta
Definition: HLT_2018_cff.py:12289
edm::Ref
Definition: AssociativeIterator.h:58
deltaR.h
HLT_2018_cff.drMax
drMax
Definition: HLT_2018_cff.py:17514
Photon.h
EcalPFClusterIsolation.h
GsfElectron.h
EcalPFClusterIsolation::EcalPFClusterIsolation
EcalPFClusterIsolation(double drMax, double drVetoBarrel, double drVetoEndcap, double etaStripBarrel, double etaStripEndcap, double energyBarrel, double energyEndcap)
Definition: EcalPFClusterIsolation.cc:19
HLT_2018_cff.drVetoBarrel
drVetoBarrel
Definition: HLT_2018_cff.py:17513
HLT_2018_cff.drVetoEndcap
drVetoEndcap
Definition: HLT_2018_cff.py:17517
HLT_2018_cff.energyBarrel
energyBarrel
Definition: HLT_2018_cff.py:17515
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
EcalPFClusterIsolation::~EcalPFClusterIsolation
~EcalPFClusterIsolation()
Definition: EcalPFClusterIsolation.cc:35
HLT_2018_cff.energyEndcap
energyEndcap
Definition: HLT_2018_cff.py:17509
RecoEcalCandidate.h
HLTMuonOfflineAnalyzer_cfi.deltaR2
deltaR2
Definition: HLTMuonOfflineAnalyzer_cfi.py:105
RecoChargedCandidate.h
EcalPFClusterIsolation
Definition: EcalPFClusterIsolation.h:31
HLT_2018_cff.etaStripBarrel
etaStripBarrel
Definition: HLT_2018_cff.py:17508