CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalPFClusterIsolation.cc
Go to the documentation of this file.
2 
7 
9 
10 template<typename T1>
12  double drVetoBarrel,
13  double drVetoEndcap,
14  double etaStripBarrel,
15  double etaStripEndcap,
16  double energyBarrel,
17  double energyEndcap,
18  bool useEt):
19  drMax_(drMax),
20  drVetoBarrel_(drVetoBarrel),
21  drVetoEndcap_(drVetoEndcap),
22  etaStripBarrel_(etaStripBarrel),
23  etaStripEndcap_(etaStripEndcap),
24  energyBarrel_(energyBarrel),
25  energyEndcap_(energyEndcap),
26  useEt_(useEt)
27 {}
28 
29 template<typename T1>
31 {}
32 
33 template<typename T1>
34 double HcalPFClusterIsolation<T1>::getSum(const T1Ref candRef, const std::vector<edm::Handle<reco::PFClusterCollection>>& clusterHandles) {
35 
36  double etSum = 0.;
37 
38  float etaStrip = 0;
39  float dRVeto = 0;
40  if (fabs(candRef->eta()) < 1.479) {
41  dRVeto = drVetoBarrel_;
42  etaStrip = etaStripBarrel_;
43  } else {
44  dRVeto = drVetoEndcap_;
45  etaStrip = etaStripEndcap_;
46  }
47 
48 
49  for (unsigned int nHandle=0; nHandle<clusterHandles.size(); nHandle++) {
50  for(unsigned i=0; i<clusterHandles[nHandle]->size(); i++) {
51  const reco::PFClusterRef pfclu(clusterHandles[nHandle], i);
52 
53  if (fabs(candRef->eta()) < 1.479) {
54  if (fabs(pfclu->pt()) < energyBarrel_)
55  continue;
56  } else {
57  if (fabs(pfclu->energy()) < energyEndcap_)
58  continue;
59  }
60 
61  float dEta = fabs(candRef->eta() - pfclu->eta());
62  if(dEta < etaStrip)
63  continue;
64 
65  float dR = deltaR(candRef->eta(), candRef->phi(), pfclu->eta(), pfclu->phi());
66  if(dR > drMax_ || dR < dRVeto)
67  continue;
68 
69  if (useEt_)
70  etSum += pfclu->pt();
71  else
72  etSum += pfclu->energy();
73  }
74  }
75 
76  return etSum;
77 }
78 
int i
Definition: DBlmapReader.cc:9
double getSum(const T1Ref candRef, const std::vector< edm::Handle< reco::PFClusterCollection >> &clusterHandles)
tuple etaStripEndcap
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
HcalPFClusterIsolation(double drMax, double drVetoBarrel, double drVetoEndcap, double etaStripBarrel, double etaStripEndcap, double energyBarrel, double energyEndcap, bool useEt)
tuple etaStripBarrel