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

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

21 {
22  if(pEBclusters.isValid())
23  fEBclusters_ = pEBclusters.product();
24  else
25  fEBclusters_ = nullptr;
26 
27  if(pEEclusters.isValid())
28  fEEclusters_ = pEEclusters.product();
29  else
30  fEEclusters_ = nullptr;
31 
32  ESHandle<CaloGeometry> geometryHandle;
33  iSetup.get<CaloGeometryRecord>().get(geometryHandle);
34  if(geometryHandle.isValid())
35  geometry_ = geometryHandle.product();
36  else
37  geometry_ = nullptr;
38 }
const reco::BasicClusterCollection * fEEclusters_
const reco::BasicClusterCollection * fEBclusters_
const T & get() const
Definition: EventSetup.h:56
bool isValid() const
Definition: ESHandle.h:47
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 stringResolutionProvider_cfi::et, and stringResolutionProvider_cfi::eta.

Referenced by photonIsolationHIProducer::produce().

94 {
95  if(!fEBclusters_) {
96  return -100;
97  }
98 
99  if(!fEEclusters_) {
100  return -100;
101  }
102 
103  double SClusterEta = cluster->eta();
104  double TotalEt = 0;
105 
106  TotalEt = - cluster->rawEnergy()/cosh(cluster->eta());
107 
108  for(BasicClusterCollection::const_iterator iclu = fEBclusters_->begin();
109  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) et=0;
119  TotalEt += et;
120  }
121  }
122 
123  for(BasicClusterCollection::const_iterator iclu = fEEclusters_->begin();
124  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) et=0;
133  TotalEt += et;
134  }
135  }
136 
137  double Cx = getEcalClusterIso(cluster,x,threshold);
138  double CCx = (Cx - TotalEt / 40.0 * x) * (1/(1-x/40.));
139 
140  return CCx;
141 }
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:30
et
define resolution functions of each parameter
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 40 of file EcalClusterIsoCalculator.cc.

References reco::deltaR2(), stringResolutionProvider_cfi::et, and stringResolutionProvider_cfi::eta.

41 {
42  if(!fEBclusters_) {
43  return -100;
44  }
45 
46  if(!fEEclusters_) {
47  return -100;
48  }
49 
50  math::XYZVector SClusPoint(cluster->position().x(),
51  cluster->position().y(),
52  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();
60  iclu != fEBclusters_->end(); ++iclu) {
61  const BasicCluster *clu = &(*iclu);
62  math::XYZVector ClusPoint(clu->x(),clu->y(),clu->z());
63  double eta = ClusPoint.eta();
64 
65  double dR2 = reco::deltaR2(*clu, *cluster);
66 
67  if (dR2 < (x*x*0.01)) {
68  double et = clu->energy()/cosh(eta);
69  if (et<threshold) et=0;
70  TotalEt += et;
71  }
72  }
73 
74  for(BasicClusterCollection::const_iterator iclu = fEEclusters_->begin();
75  iclu != fEEclusters_->end(); ++iclu) {
76  const BasicCluster *clu = &(*iclu);
77  const GlobalPoint clusPoint(clu->x(),clu->y(),clu->z());
78  math::XYZVector ClusPoint(clu->x(),clu->y(),clu->z());
79  double eta = ClusPoint.eta();
80 
81  double dR2 = reco::deltaR2(*clu, *cluster);
82 
83  if (dR2 < (x*x*0.01)) {
84  double et = clu->energy()/cosh(eta);
85  if (et<threshold) et=0;
86  TotalEt += et;
87  }
88  }
89 
90  return TotalEt;
91 }
const reco::BasicClusterCollection * fEEclusters_
const reco::BasicClusterCollection * fEBclusters_
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
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

Member Data Documentation

const reco::BasicClusterCollection* EcalClusterIsoCalculator::fEBclusters_
private

Definition at line 31 of file EcalClusterIsoCalculator.h.

const reco::BasicClusterCollection* EcalClusterIsoCalculator::fEEclusters_
private

Definition at line 32 of file EcalClusterIsoCalculator.h.

const CaloGeometry* EcalClusterIsoCalculator::geometry_
private

Definition at line 33 of file EcalClusterIsoCalculator.h.