test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
HcalRechitIsoCalculator Class Reference

#include <HcalRechitIsoCalculator.h>

Public Member Functions

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. More...
 
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. More...
 
 HcalRechitIsoCalculator (const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::Handle< HBHERecHitCollection > hbhe, const edm::Handle< HFRecHitCollection > hfLabel, const edm::Handle< HORecHitCollection > hoLabel)
 

Private Attributes

const HBHERecHitCollectionfHBHERecHits_
 
const HFRecHitCollectionfHFRecHits_
 
const HORecHitCollectionfHORecHits_
 
const CaloGeometrygeometry_
 

Detailed Description

Definition at line 19 of file HcalRechitIsoCalculator.h.

Constructor & Destructor Documentation

HcalRechitIsoCalculator::HcalRechitIsoCalculator ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const edm::Handle< HBHERecHitCollection hbhe,
const edm::Handle< HFRecHitCollection hfLabel,
const edm::Handle< HORecHitCollection hoLabel 
)

Definition at line 17 of file HcalRechitIsoCalculator.cc.

References edm::EventSetup::get(), edm::ESHandleBase::isValid(), edm::HandleBase::isValid(), edm::Handle< T >::product(), and edm::ESHandle< class >::product().

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 }
bool isValid() const
Definition: HandleBase.h:75
const HBHERecHitCollection * fHBHERecHits_
T const * product() const
Definition: Handle.h:81
const CaloGeometry * geometry_
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
const HORecHitCollection * fHORecHits_
const HFRecHitCollection * fHFRecHits_
bool isValid() const
Definition: ESHandle.h:47

Member Function Documentation

double HcalRechitIsoCalculator::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.

Definition at line 72 of file HcalRechitIsoCalculator.cc.

References CaloRecHit::energy(), eta, PV3DBase< T, PVType, FrameType >::eta(), HBHERecHit::id(), and cmsHarvester::index.

Referenced by photonIsolationHIProducer::produce().

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 }
HcalDetId id() const
get the id
Definition: HBHERecHit.h:23
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.
float energy() const
Definition: CaloRecHit.h:17
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:68
Definition: DetId.h:18
const HBHERecHitCollection * fHBHERecHits_
const CaloGeometry * geometry_
T eta() const
Definition: PV3DBase.h:76
size_type size() const
double HcalRechitIsoCalculator::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.

Definition at line 44 of file HcalRechitIsoCalculator.cc.

References reco::deltaR2(), CaloRecHit::energy(), eta, PV3DBase< T, PVType, FrameType >::eta(), HBHERecHit::id(), and cmsHarvester::index.

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 }
HcalDetId id() const
get the id
Definition: HBHERecHit.h:23
float energy() const
Definition: CaloRecHit.h:17
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:68
Definition: DetId.h:18
const HBHERecHitCollection * fHBHERecHits_
const CaloGeometry * geometry_
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Definition: deltaR.h:36
T eta() const
Definition: PV3DBase.h:76
size_type size() const

Member Data Documentation

const HBHERecHitCollection* HcalRechitIsoCalculator::fHBHERecHits_
private

Definition at line 35 of file HcalRechitIsoCalculator.h.

const HFRecHitCollection* HcalRechitIsoCalculator::fHFRecHits_
private

Definition at line 37 of file HcalRechitIsoCalculator.h.

const HORecHitCollection* HcalRechitIsoCalculator::fHORecHits_
private

Definition at line 36 of file HcalRechitIsoCalculator.h.

const CaloGeometry* HcalRechitIsoCalculator::geometry_
private

Definition at line 38 of file HcalRechitIsoCalculator.h.