CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EcalClusterIsoCalculator Class Reference

#include <EcalClusterIsoCalculator.h>

Public Member Functions

 EcalClusterIsoCalculator (const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::Handle< reco::BasicClusterCollection > barrel, const edm::Handle< reco::BasicClusterCollection > endcap)
 
double getBkgSubEcalClusterIso (const reco::SuperClusterRef clus, const double radius, const double threshold)
 Return the background-subtracted ecal cluster energy in a cone around the SC. More...
 
double getEcalClusterIso (const reco::SuperClusterRef clus, const double radius, const double threshold)
 Return the ecal cluster energy in a cone around the SC. More...
 

Private Attributes

const reco::BasicClusterCollectionfEBclusters_
 
const reco::BasicClusterCollectionfEEclusters_
 
const CaloGeometrygeometry_
 

Detailed Description

Definition at line 17 of file EcalClusterIsoCalculator.h.

Constructor & Destructor Documentation

EcalClusterIsoCalculator::EcalClusterIsoCalculator ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const edm::Handle< reco::BasicClusterCollection barrel,
const edm::Handle< reco::BasicClusterCollection endcap 
)

Definition at line 19 of file EcalClusterIsoCalculator.cc.

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

22  {
23  if (pEBclusters.isValid())
24  fEBclusters_ = pEBclusters.product();
25  else
26  fEBclusters_ = nullptr;
27 
28  if (pEEclusters.isValid())
29  fEEclusters_ = pEEclusters.product();
30  else
31  fEEclusters_ = nullptr;
32 
33  ESHandle<CaloGeometry> geometryHandle;
34  iSetup.get<CaloGeometryRecord>().get(geometryHandle);
35  if (geometryHandle.isValid())
36  geometry_ = geometryHandle.product();
37  else
38  geometry_ = nullptr;
39 }
const reco::BasicClusterCollection * fEEclusters_
const reco::BasicClusterCollection * fEBclusters_
T get() const
Definition: EventSetup.h:73
bool isValid() const
Definition: ESHandle.h:44
T const * product() const
Definition: ESHandle.h:86

Member Function Documentation

double EcalClusterIsoCalculator::getBkgSubEcalClusterIso ( const reco::SuperClusterRef  clus,
const double  radius,
const double  threshold 
)

Return the background-subtracted ecal cluster energy in a cone around the SC.

Definition at line 93 of file EcalClusterIsoCalculator.cc.

References HLT_2018_cff::dEta, EgHLTOffHistBins_cfi::et, and PVValHelper::eta.

Referenced by photonIsolationHIProducer::produce().

95  {
96  if (!fEBclusters_) {
97  return -100;
98  }
99 
100  if (!fEEclusters_) {
101  return -100;
102  }
103 
104  double SClusterEta = cluster->eta();
105  double TotalEt = 0;
106 
107  TotalEt = -cluster->rawEnergy() / cosh(cluster->eta());
108 
109  for (BasicClusterCollection::const_iterator iclu = fEBclusters_->begin(); iclu != fEBclusters_->end(); ++iclu) {
110  const BasicCluster *clu = &(*iclu);
111  math::XYZVector ClusPoint(clu->x(), clu->y(), clu->z());
112  double eta = ClusPoint.eta();
113 
114  double dEta = fabs(eta - SClusterEta);
115 
116  if (dEta < x * 0.1) {
117  double et = clu->energy() / cosh(eta);
118  if (et < threshold)
119  et = 0;
120  TotalEt += et;
121  }
122  }
123 
124  for (BasicClusterCollection::const_iterator iclu = fEEclusters_->begin(); iclu != fEEclusters_->end(); ++iclu) {
125  const BasicCluster *clu = &(*iclu);
126  math::XYZVector ClusPoint(clu->x(), clu->y(), clu->z());
127  double eta = ClusPoint.eta();
128  double dEta = fabs(eta - SClusterEta);
129 
130  if (dEta < x * 0.1) {
131  double et = clu->energy() / cosh(eta);
132  if (et < threshold)
133  et = 0;
134  TotalEt += et;
135  }
136  }
137 
138  double Cx = getEcalClusterIso(cluster, x, threshold);
139  double CCx = (Cx - TotalEt / 40.0 * x) * (1 / (1 - x / 40.));
140 
141  return CCx;
142 }
const reco::BasicClusterCollection * fEEclusters_
const reco::BasicClusterCollection * fEBclusters_
double getEcalClusterIso(const reco::SuperClusterRef clus, const double radius, const double threshold)
Return the ecal cluster energy in a cone around the SC.
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
double EcalClusterIsoCalculator::getEcalClusterIso ( const reco::SuperClusterRef  clus,
const double  radius,
const double  threshold 
)

Return the ecal cluster energy in a cone around the SC.

Definition at line 41 of file EcalClusterIsoCalculator.cc.

References reco::deltaR2(), EgHLTOffHistBins_cfi::et, and PVValHelper::eta.

43  {
44  if (!fEBclusters_) {
45  return -100;
46  }
47 
48  if (!fEEclusters_) {
49  return -100;
50  }
51 
52  math::XYZVector SClusPoint(cluster->position().x(), cluster->position().y(), cluster->position().z());
53 
54  double TotalEt = 0;
55 
56  TotalEt = -cluster->rawEnergy() / cosh(cluster->eta());
57 
58  // Loop over barrel basic clusters
59  for (BasicClusterCollection::const_iterator iclu = fEBclusters_->begin(); iclu != fEBclusters_->end(); ++iclu) {
60  const BasicCluster *clu = &(*iclu);
61  math::XYZVector ClusPoint(clu->x(), clu->y(), clu->z());
62  double eta = ClusPoint.eta();
63 
64  double dR2 = reco::deltaR2(*clu, *cluster);
65 
66  if (dR2 < (x * x * 0.01)) {
67  double et = clu->energy() / cosh(eta);
68  if (et < threshold)
69  et = 0;
70  TotalEt += et;
71  }
72  }
73 
74  for (BasicClusterCollection::const_iterator iclu = fEEclusters_->begin(); iclu != fEEclusters_->end(); ++iclu) {
75  const BasicCluster *clu = &(*iclu);
76  const GlobalPoint clusPoint(clu->x(), clu->y(), clu->z());
77  math::XYZVector ClusPoint(clu->x(), clu->y(), clu->z());
78  double eta = ClusPoint.eta();
79 
80  double dR2 = reco::deltaR2(*clu, *cluster);
81 
82  if (dR2 < (x * x * 0.01)) {
83  double et = clu->energy() / cosh(eta);
84  if (et < threshold)
85  et = 0;
86  TotalEt += et;
87  }
88  }
89 
90  return TotalEt;
91 }
const reco::BasicClusterCollection * fEEclusters_
const reco::BasicClusterCollection * fEBclusters_
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
T eta() const
Definition: PV3DBase.h:73

Member Data Documentation

const reco::BasicClusterCollection* EcalClusterIsoCalculator::fEBclusters_
private

Definition at line 30 of file EcalClusterIsoCalculator.h.

const reco::BasicClusterCollection* EcalClusterIsoCalculator::fEEclusters_
private

Definition at line 31 of file EcalClusterIsoCalculator.h.

const CaloGeometry* EcalClusterIsoCalculator::geometry_
private

Definition at line 32 of file EcalClusterIsoCalculator.h.