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::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_
 

Detailed Description

Definition at line 7 of file EcalClusterIsoCalculator.h.

Constructor & Destructor Documentation

◆ EcalClusterIsoCalculator()

EcalClusterIsoCalculator::EcalClusterIsoCalculator ( const edm::Handle< reco::BasicClusterCollection barrel,
const edm::Handle< reco::BasicClusterCollection endcap 
)

Definition at line 17 of file EcalClusterIsoCalculator.cc.

References edm::HandleBase::isValid(), and edm::Handle< T >::product().

18  {
19  if (pEBclusters.isValid())
20  fEBclusters_ = pEBclusters.product();
21  else
22  fEBclusters_ = nullptr;
23 
24  if (pEEclusters.isValid())
25  fEEclusters_ = pEEclusters.product();
26  else
27  fEEclusters_ = nullptr;
28 }
const reco::BasicClusterCollection * fEEclusters_
const reco::BasicClusterCollection * fEBclusters_

Member Function Documentation

◆ getBkgSubEcalClusterIso()

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 81 of file EcalClusterIsoCalculator.cc.

References HLT_2022v12_cff::dEta, reco::CaloCluster::energy(), EgHLTOffHistBins_cfi::et, PVValHelper::eta, remoteMonitoring_LASER_era2018_cfg::threshold, x, reco::CaloCluster::x(), reco::CaloCluster::y(), and reco::CaloCluster::z().

Referenced by photonIsolationHIProducer::produce().

83  {
84  if (!fEBclusters_) {
85  return -100;
86  }
87 
88  if (!fEEclusters_) {
89  return -100;
90  }
91 
92  double SClusterEta = cluster->eta();
93  double TotalEt = 0;
94 
95  TotalEt = -cluster->rawEnergy() / cosh(cluster->eta());
96 
97  for (BasicClusterCollection::const_iterator iclu = fEBclusters_->begin(); iclu != fEBclusters_->end(); ++iclu) {
98  const BasicCluster *clu = &(*iclu);
99  math::XYZVector ClusPoint(clu->x(), clu->y(), clu->z());
100  double eta = ClusPoint.eta();
101 
102  double dEta = fabs(eta - SClusterEta);
103 
104  if (dEta < x * 0.1) {
105  double et = clu->energy() / cosh(eta);
106  if (et < threshold)
107  et = 0;
108  TotalEt += et;
109  }
110  }
111 
112  for (BasicClusterCollection::const_iterator iclu = fEEclusters_->begin(); iclu != fEEclusters_->end(); ++iclu) {
113  const BasicCluster *clu = &(*iclu);
114  math::XYZVector ClusPoint(clu->x(), clu->y(), clu->z());
115  double eta = ClusPoint.eta();
116  double dEta = fabs(eta - SClusterEta);
117 
118  if (dEta < x * 0.1) {
119  double et = clu->energy() / cosh(eta);
120  if (et < threshold)
121  et = 0;
122  TotalEt += et;
123  }
124  }
125 
126  double Cx = getEcalClusterIso(cluster, x, threshold);
127  double CCx = (Cx - TotalEt / 40.0 * x) * (1 / (1 - x / 40.));
128 
129  return CCx;
130 }
const reco::BasicClusterCollection * fEEclusters_
double x() const
x coordinate of cluster centroid
Definition: CaloCluster.h:172
const reco::BasicClusterCollection * fEBclusters_
double z() const
z coordinate of cluster centroid
Definition: CaloCluster.h:178
double y() const
y coordinate of cluster centroid
Definition: CaloCluster.h:175
double energy() const
cluster energy
Definition: CaloCluster.h:149
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

◆ getEcalClusterIso()

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 30 of file EcalClusterIsoCalculator.cc.

References reco::deltaR2(), reco::CaloCluster::energy(), EgHLTOffHistBins_cfi::et, PVValHelper::eta, remoteMonitoring_LASER_era2018_cfg::threshold, x, reco::CaloCluster::x(), reco::CaloCluster::y(), and reco::CaloCluster::z().

32  {
33  if (!fEBclusters_) {
34  return -100;
35  }
36 
37  if (!fEEclusters_) {
38  return -100;
39  }
40 
41  math::XYZVector SClusPoint(cluster->position().x(), cluster->position().y(), cluster->position().z());
42 
43  double TotalEt = 0;
44 
45  TotalEt = -cluster->rawEnergy() / cosh(cluster->eta());
46 
47  // Loop over barrel basic clusters
48  for (BasicClusterCollection::const_iterator iclu = fEBclusters_->begin(); iclu != fEBclusters_->end(); ++iclu) {
49  const BasicCluster *clu = &(*iclu);
50  math::XYZVector ClusPoint(clu->x(), clu->y(), clu->z());
51  double eta = ClusPoint.eta();
52 
53  double dR2 = reco::deltaR2(*clu, *cluster);
54 
55  if (dR2 < (x * x * 0.01)) {
56  double et = clu->energy() / cosh(eta);
57  if (et < threshold)
58  et = 0;
59  TotalEt += et;
60  }
61  }
62 
63  for (BasicClusterCollection::const_iterator iclu = fEEclusters_->begin(); iclu != fEEclusters_->end(); ++iclu) {
64  const BasicCluster *clu = &(*iclu);
65  math::XYZVector ClusPoint(clu->x(), clu->y(), clu->z());
66  double eta = ClusPoint.eta();
67 
68  double dR2 = reco::deltaR2(*clu, *cluster);
69 
70  if (dR2 < (x * x * 0.01)) {
71  double et = clu->energy() / cosh(eta);
72  if (et < threshold)
73  et = 0;
74  TotalEt += et;
75  }
76  }
77 
78  return TotalEt;
79 }
const reco::BasicClusterCollection * fEEclusters_
double x() const
x coordinate of cluster centroid
Definition: CaloCluster.h:172
const reco::BasicClusterCollection * fEBclusters_
double z() const
z coordinate of cluster centroid
Definition: CaloCluster.h:178
double y() const
y coordinate of cluster centroid
Definition: CaloCluster.h:175
double energy() const
cluster energy
Definition: CaloCluster.h:149
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

Member Data Documentation

◆ fEBclusters_

const reco::BasicClusterCollection* EcalClusterIsoCalculator::fEBclusters_
private

Definition at line 18 of file EcalClusterIsoCalculator.h.

◆ fEEclusters_

const reco::BasicClusterCollection* EcalClusterIsoCalculator::fEEclusters_
private

Definition at line 19 of file EcalClusterIsoCalculator.h.