CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HcalRechitIsoCalculator.cc
Go to the documentation of this file.
2 
4 
6 
10 
11 using namespace edm;
12 using namespace reco;
13 
18  if (hf.isValid())
19  fHFRecHits_ = hf.product();
20  else
21  fHFRecHits_ = nullptr;
22 
23  if (ho.isValid())
24  fHORecHits_ = ho.product();
25  else
26  fHORecHits_ = nullptr;
27 
28  if (hbhe.isValid())
29  fHBHERecHits_ = hbhe.product();
30  else
31  fHBHERecHits_ = nullptr;
32 
33  geometry_ = geometry;
34 }
35 
37  const double x,
38  const double threshold,
39  const double innerR) {
40  if (!fHBHERecHits_) {
41  return -100;
42  }
43 
44  double TotalEt = 0;
45 
46  for (size_t index = 0; index < fHBHERecHits_->size(); index++) {
47  const HBHERecHit &rechit = (*fHBHERecHits_)[index];
48  const DetId &detid = rechit.id();
49  const GlobalPoint &hitpoint = geometry_->getPosition(detid);
50  double eta = hitpoint.eta();
51 
52  double dR2 = reco::deltaR2(*cluster, hitpoint);
53  // veto inner cone///////////////
54  if (dR2 < innerR * innerR)
55  continue;
57  if (dR2 < (x * x * 0.01)) {
58  double et = rechit.energy() / cosh(eta);
59  if (et < threshold)
60  et = 0;
61  TotalEt += et;
62  }
63  }
64 
65  return TotalEt;
66 }
67 
69  const double x,
70  const double threshold,
71  const double innerR) {
72  if (!fHBHERecHits_) {
73  return -100;
74  }
75 
76  double SClusterEta = cluster->eta();
77  double TotalEt = 0;
78 
79  for (size_t index = 0; index < fHBHERecHits_->size(); index++) {
80  const HBHERecHit &rechit = (*fHBHERecHits_)[index];
81  const DetId &detid = rechit.id();
82  const GlobalPoint &hitpoint = geometry_->getPosition(detid);
83  double eta = hitpoint.eta();
84  double dEta = fabs(eta - SClusterEta);
85 
86  if (dEta < x * 0.1) {
87  double et = rechit.energy() / cosh(eta);
88  if (et < threshold)
89  et = 0;
90  TotalEt += et;
91  }
92  }
93 
94  double Rx = getHcalRechitIso(cluster, x, threshold, innerR);
95  double CRx = (Rx - TotalEt * (0.01 * x * x - innerR * innerR) / (2 * 2 * 0.1 * x)) * (1 / (1 - x / 40.));
96 
97  return CRx;
98 }
constexpr float energy() const
Definition: CaloRecHit.h:29
HcalRechitIsoCalculator(const CaloGeometry *geometry, const edm::Handle< HBHERecHitCollection > hbhe, const edm::Handle< HFRecHitCollection > hfLabel, const edm::Handle< HORecHitCollection > hoLabel)
double getHcalRechitIso(const reco::SuperClusterRef clus, const double i, const double threshold, const double innerR=0.0)
Return the hcal rechit energy in a cone around the SC.
constexpr HcalDetId id() const
get the id
Definition: HBHERecHit.h:41
bool isValid() const
Definition: HandleBase.h:70
Definition: DetId.h:17
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
T const * product() const
Definition: Handle.h:70
T eta() const
Definition: PV3DBase.h:73
double getBkgSubHcalRechitIso(const reco::SuperClusterRef clus, const double i, const double threshold, const double innerR=0.0)
Return the background-subtracted hcal rechit energy in a cone around the SC.