CMS 3D CMS Logo

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 16 of file HcalRechitIsoCalculator.cc.

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

20  {
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 }
bool isValid() const
Definition: HandleBase.h:70
const HBHERecHitCollection * fHBHERecHits_
T const * product() const
Definition: Handle.h:69
const CaloGeometry * geometry_
const HORecHitCollection * fHORecHits_
T get() const
Definition: EventSetup.h:73
const HFRecHitCollection * fHFRecHits_
bool isValid() const
Definition: ESHandle.h:44
T const * product() const
Definition: ESHandle.h:86

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 76 of file HcalRechitIsoCalculator.cc.

References HLT_2018_cff::dEta, CaloRecHit::energy(), EgHLTOffHistBins_cfi::et, PVValHelper::eta, PV3DBase< T, PVType, FrameType >::eta(), and HBHERecHit::id().

Referenced by photonIsolationHIProducer::produce().

79  {
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
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.
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
Definition: DetId.h:17
const HBHERecHitCollection * fHBHERecHits_
const CaloGeometry * geometry_
T eta() const
Definition: PV3DBase.h:73
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(), EgHLTOffHistBins_cfi::et, PVValHelper::eta, PV3DBase< T, PVType, FrameType >::eta(), and HBHERecHit::id().

47  {
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 }
constexpr float energy() const
Definition: CaloRecHit.h:29
HcalDetId id() const
get the id
Definition: HBHERecHit.h:39
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
Definition: DetId.h:17
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
const HBHERecHitCollection * fHBHERecHits_
const CaloGeometry * geometry_
T eta() const
Definition: PV3DBase.h:73
size_type size() const

Member Data Documentation

const HBHERecHitCollection* HcalRechitIsoCalculator::fHBHERecHits_
private

Definition at line 39 of file HcalRechitIsoCalculator.h.

const HFRecHitCollection* HcalRechitIsoCalculator::fHFRecHits_
private

Definition at line 41 of file HcalRechitIsoCalculator.h.

const HORecHitCollection* HcalRechitIsoCalculator::fHORecHits_
private

Definition at line 40 of file HcalRechitIsoCalculator.h.

const CaloGeometry* HcalRechitIsoCalculator::geometry_
private

Definition at line 42 of file HcalRechitIsoCalculator.h.