CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 template <typename T1>
30 
31 template <typename T1>
33  const std::vector<edm::Handle<reco::PFClusterCollection>>& clusterHandles) {
34  double etSum = 0.;
35  double candAbsEta = std::abs(cand.eta());
36 
37  float etaStrip = 0;
38  float dRVeto = 0;
39  if (candAbsEta < 1.479) {
40  dRVeto = drVetoBarrel_;
41  etaStrip = etaStripBarrel_;
42  } else {
43  dRVeto = drVetoEndcap_;
44  etaStrip = etaStripEndcap_;
45  }
46 
47  for (unsigned int nHandle = 0; nHandle < clusterHandles.size(); nHandle++) {
48  for (unsigned i = 0; i < clusterHandles[nHandle]->size(); i++) {
49  const reco::PFClusterRef pfclu(clusterHandles[nHandle], i);
50 
51  if (candAbsEta < 1.479) {
52  if (std::abs(pfclu->pt()) < energyBarrel_)
53  continue;
54  } else {
55  if (std::abs(pfclu->energy()) < energyEndcap_)
56  continue;
57  }
58 
59  float dEta = std::abs(cand.eta() - pfclu->eta());
60  if (dEta < etaStrip)
61  continue;
62 
63  float dR2 = deltaR2(cand.eta(), cand.phi(), pfclu->eta(), pfclu->phi());
64  if (dR2 > (drMax_ * drMax_) || dR2 < (dRVeto * dRVeto))
65  continue;
66 
67  if (useEt_)
68  etSum += pfclu->pt();
69  else
70  etSum += pfclu->energy();
71  }
72  }
73 
74  return etSum;
75 }
76 
77 template <typename T1>
79  const std::vector<edm::Handle<reco::PFClusterCollection>>& clusterHandles) {
80  return getSum(*ref, clusterHandles);
81 }
82 
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double getSum(const T1Ref candRef, const std::vector< edm::Handle< reco::PFClusterCollection >> &clusterHandles)
tuple etaStripEndcap
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
HcalPFClusterIsolation(double drMax, double drVetoBarrel, double drVetoEndcap, double etaStripBarrel, double etaStripEndcap, double energyBarrel, double energyEndcap, bool useEt)
tuple etaStripBarrel