CMS 3D CMS Logo

EcalClusterIsoCalculator.cc
Go to the documentation of this file.
1 // ROOT includes
2 #include <Math/VectorUtil.h>
3 
6 
12 
13 using namespace edm;
14 using namespace reco;
15 using namespace std;
16 
18  const edm::Handle<BasicClusterCollection> pEEclusters) {
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 }
29 
31  const double x,
32  const double threshold) {
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 }
80 
82  const double x,
83  double const threshold) {
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 }
EcalClusterIsoCalculator(const edm::Handle< reco::BasicClusterCollection > barrel, const edm::Handle< reco::BasicClusterCollection > endcap)
T const * product() const
Definition: Handle.h:70
double x() const
x coordinate of cluster centroid
Definition: CaloCluster.h:171
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.
double z() const
z coordinate of cluster centroid
Definition: CaloCluster.h:177
double y() const
y coordinate of cluster centroid
Definition: CaloCluster.h:174
double energy() const
cluster energy
Definition: CaloCluster.h:148
double getEcalClusterIso(const reco::SuperClusterRef clus, const double radius, const double threshold)
Return the ecal cluster energy in a cone around the SC.
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
bool isValid() const
Definition: HandleBase.h:70
fixed size matrix
HLT enums.
float x