CMS 3D CMS Logo

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