CMS 3D CMS Logo

HcalRechitIsoCalculator.cc
Go to the documentation of this file.
2 
4 
8 
12 
13 using namespace edm;
14 using namespace reco;
15 
17  const edm::EventSetup &iSetup,
21  if (hf.isValid())
22  fHFRecHits_ = hf.product();
23  else
24  fHFRecHits_ = nullptr;
25 
26  if (ho.isValid())
27  fHORecHits_ = ho.product();
28  else
29  fHORecHits_ = nullptr;
30 
31  if (hbhe.isValid())
32  fHBHERecHits_ = hbhe.product();
33  else
34  fHBHERecHits_ = nullptr;
35 
36  ESHandle<CaloGeometry> geometryHandle;
37  iSetup.get<CaloGeometryRecord>().get(geometryHandle);
38  if (geometryHandle.isValid())
39  geometry_ = geometryHandle.product();
40  else
41  geometry_ = nullptr;
42 }
43 
45  const double x,
46  const double threshold,
47  const double innerR) {
48  if (!fHBHERecHits_) {
49  return -100;
50  }
51 
52  double TotalEt = 0;
53 
54  for (size_t index = 0; index < fHBHERecHits_->size(); index++) {
55  const HBHERecHit &rechit = (*fHBHERecHits_)[index];
56  const DetId &detid = rechit.id();
57  const GlobalPoint &hitpoint = geometry_->getPosition(detid);
58  double eta = hitpoint.eta();
59 
60  double dR2 = reco::deltaR2(*cluster, hitpoint);
61  // veto inner cone///////////////
62  if (dR2 < innerR * innerR)
63  continue;
65  if (dR2 < (x * x * 0.01)) {
66  double et = rechit.energy() / cosh(eta);
67  if (et < threshold)
68  et = 0;
69  TotalEt += et;
70  }
71  }
72 
73  return TotalEt;
74 }
75 
77  const double x,
78  const double threshold,
79  const double innerR) {
80  if (!fHBHERecHits_) {
81  return -100;
82  }
83 
84  double SClusterEta = cluster->eta();
85  double TotalEt = 0;
86 
87  for (size_t index = 0; index < fHBHERecHits_->size(); index++) {
88  const HBHERecHit &rechit = (*fHBHERecHits_)[index];
89  const DetId &detid = rechit.id();
90  const GlobalPoint &hitpoint = geometry_->getPosition(detid);
91  double eta = hitpoint.eta();
92  double dEta = fabs(eta - SClusterEta);
93 
94  if (dEta < x * 0.1) {
95  double et = rechit.energy() / cosh(eta);
96  if (et < threshold)
97  et = 0;
98  TotalEt += et;
99  }
100  }
101 
102  double Rx = getHcalRechitIso(cluster, x, threshold, innerR);
103  double CRx = (Rx - TotalEt * (0.01 * x * x - innerR * innerR) / (2 * 2 * 0.1 * x)) * (1 / (1 - x / 40.));
104 
105  return CRx;
106 }
constexpr float energy() const
Definition: CaloRecHit.h:29
HcalRechitIsoCalculator(const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::Handle< HBHERecHitCollection > hbhe, const edm::Handle< HFRecHitCollection > hfLabel, const edm::Handle< HORecHitCollection > hoLabel)
HcalDetId id() const
get the id
Definition: HBHERecHit.h:39
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.
int iEvent
Definition: GenABIO.cc:224
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:69
T eta() const
Definition: PV3DBase.h:73
fixed size matrix
HLT enums.
T get() const
Definition: EventSetup.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.
bool isValid() const
Definition: ESHandle.h:44
T const * product() const
Definition: ESHandle.h:86