CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalClusterEnergyCorrection.cc
Go to the documentation of this file.
2 
3 // Shower leakage corrections developed by Jungzhie et al. using TB data
4 // Developed for EB only!
5 float EcalClusterEnergyCorrection::fEta(float energy, float eta, int algorithm) const
6 {
7 
8  // this correction is setup only for EB
9  if ( algorithm != 0 ) return energy;
10 
11  float ieta = fabs(eta)*(5/0.087);
12  float p0 = (params_->params())[0]; // should be 40.2198
13  float p1 = (params_->params())[1]; // should be -3.03103e-6
14 
15  float correctedEnergy = energy;
16  if ( ieta < p0 ) correctedEnergy = energy;
17  else correctedEnergy = energy/(1.0 + p1*(ieta-p0)*(ieta-p0));
18  //std::cout << "ECEC fEta = " << correctedEnergy << std::endl;
19  return correctedEnergy;
20 }
21 
22 float EcalClusterEnergyCorrection::fBrem(float e, float brem, int algorithm) const
23 {
24  // brem == phiWidth/etaWidth of the SuperCluster
25  // e == energy of the SuperCluster
26  // first parabola (for br > threshold)
27  // p0 + p1*x + p2*x^2
28  // second parabola (for br <= threshold)
29  // ax^2 + bx + c, make y and y' the same in threshold
30  // y = p0 + p1*threshold + p2*threshold^2
31  // yprime = p1 + 2*p2*threshold
32  // a = p3
33  // b = yprime - 2*a*threshold
34  // c = y - a*threshold^2 - b*threshold
35 
36  int offset;
37  if ( algorithm == 0 ) offset = 0;
38  else if ( algorithm == 1 ) offset = 20;
39  else {
40  // not supported, produce no correction
41  return e;
42  }
43 
44  //Make No Corrections if brem is invalid!
45  if ( brem == 0 ) return e;
46 
47  float bremLowThr = (params_->params())[2 + offset];
48  float bremHighThr = (params_->params())[3 + offset];
49  if ( brem < bremLowThr ) brem = bremLowThr;
50  if ( brem > bremHighThr ) brem = bremHighThr;
51 
52  // Parameters provided in cfg file
53  float p0 = (params_->params())[4 + offset];
54  float p1 = (params_->params())[5 + offset];
55  float p2 = (params_->params())[6 + offset];
56  float p3 = (params_->params())[7 + offset];
57  float p4 = (params_->params())[8 + offset];
58  //
59  float threshold = p4;
60 
61  float y = p0*threshold*threshold + p1*threshold + p2;
62  float yprime = 2*p0*threshold + p1;
63  float a = p3;
64  float b = yprime - 2*a*threshold;
65  float c = y - a*threshold*threshold - b*threshold;
66 
67  float fCorr = 1;
68  if ( brem < threshold )
69  fCorr = p0*brem*brem + p1*brem + p2;
70  else
71  fCorr = a*brem*brem + b*brem + c;
72 
73  //std::cout << "ECEC fBrem " << e/fCorr << std::endl;
74  return e/fCorr;
75 }
76 
77 
78 float EcalClusterEnergyCorrection::fEtEta(float et, float eta, int algorithm) const
79 {
80  // et -- Et of the SuperCluster (with respect to (0,0,0))
81  // eta -- eta of the SuperCluster
82 
83  //std::cout << "fEtEta, mode = " << algorithm << std::endl;
84  //std::cout << "ECEC: p0 " << (params_->params())[9] << " " << (params_->params())[10] << " " << (params_->params())[11] << " " << (params_->params())[12] << std::endl;
85  //std::cout << "ECEC: p1 " << (params_->params())[13] << " " << (params_->params())[14] << " " << (params_->params())[15] << " " << (params_->params())[16] << std::endl;
86  //std::cout << "ECEC: fcorr " << (params_->params())[17] << " " << (params_->params())[18] << " " << (params_->params())[19] << std::endl;
87 
88  float fCorr = 0.;
89  int offset;
90  if ( algorithm == 0 ) offset = 0;
91  else if ( algorithm == 1 ) offset = 20;
92  else if ( algorithm == 10 ) offset = 28;
93  else if ( algorithm == 11 ) offset = 39;
94  else {
95  // not supported, produce no correction
96  return et;
97  }
98 
99  // Barrel
100  if ( algorithm == 0 || algorithm == 10 ) {
101  float p0 = (params_->params())[ 9 + offset] + (params_->params())[10 + offset]/ (et + (params_->params())[11 + offset]) + (params_->params())[12 + offset]/(et*et);
102  float p1 = (params_->params())[13 + offset] + (params_->params())[14 + offset]/ (et + (params_->params())[15 + offset]) + (params_->params())[16 + offset]/(et*et);
103 
104  fCorr = p0 + p1 * atan((params_->params())[17 + offset]*((params_->params())[18 + offset]-fabs(eta))) + (params_->params())[19 + offset] * fabs(eta);
105 
106  } else if ( algorithm == 1 || algorithm == 11 ) { // Endcap
107  float p0 = (params_->params())[ 9 + offset] + (params_->params())[10 + offset]/sqrt(et);
108  float p1 = (params_->params())[11 + offset] + (params_->params())[12 + offset]/sqrt(et);
109  float p2 = (params_->params())[13 + offset] + (params_->params())[14 + offset]/sqrt(et);
110  float p3 = (params_->params())[15 + offset] + (params_->params())[16 + offset]/sqrt(et);
111 
112  fCorr = p0 + p1*fabs(eta) + p2*eta*eta + p3/fabs(eta);
113  }
114 
115  // cap the correction at 50%
116  if ( fCorr < 0.5 ) fCorr = 0.5;
117  if ( fCorr > 1.5 ) fCorr = 1.5;
118 
119  //std::cout << "ECEC fEtEta " << et/fCorr << std::endl;
120  return et/fCorr;
121 }
122 
123 
124 float EcalClusterEnergyCorrection::getValue( const reco::SuperCluster & superCluster, const int mode ) const
125 {
126  // mode flags:
127  // hybrid modes: 1 - return f(eta) correction in GeV
128  // 2 - return f(eta) + f(brem) correction
129  // 3 - return f(eta) + f(brem) + f(et, eta) correction
130  // multi5x5: 4 - return f(brem) correction
131  // 5 - return f(brem) + f(et, eta) correction
132 
133  // special cases: mode = 10 -- return f(et, eta) correction with respect to already corrected SC in barrel
134  // mode = 11 -- return f(et, eta) correction with respect to already corrected SC in endcap
135 
136  checkInit();
137 
138  float eta = fabs(superCluster.eta());
139  float brem = superCluster.phiWidth()/superCluster.etaWidth();
140  int algorithm = -1;
141 
142  if ( mode <= 3 || mode == 10 ) {
143  // algorithm: hybrid
144  algorithm = 0;
145 
146  float energy = superCluster.rawEnergy();
147  if ( mode == 10 ) {
148  algorithm = 10;
149  energy = superCluster.energy();
150  }
151  float correctedEnergy = fEta(energy, eta, algorithm);
152 
153  if ( mode == 1 ) {
154  return correctedEnergy - energy;
155 
156  } else {
157  // now apply F(brem)
158  correctedEnergy = fBrem(correctedEnergy, brem, algorithm);
159  if ( mode == 2 ) {
160  return correctedEnergy - energy;
161  }
162 
163  float correctedEt = correctedEnergy/cosh(eta);
164  correctedEt = fEtEta(correctedEt, eta, algorithm);
165  correctedEnergy = correctedEt*cosh(eta);
166  return correctedEnergy - energy;
167  }
168  } else if ( mode == 4 || mode == 5 || mode == 11 ) {
169  algorithm = 1;
170 
171  float energy = superCluster.rawEnergy() + superCluster.preshowerEnergy();
172  if ( mode == 11 ) {
173  algorithm = 11;
174  energy = superCluster.energy();
175  }
176 
177  float correctedEnergy = fBrem(energy, brem, algorithm);
178  if ( mode == 4 ) {
179  return correctedEnergy - energy;
180  }
181 
182  float correctedEt = correctedEnergy/cosh(eta);
183  correctedEt = fEtEta(correctedEt, eta, algorithm);
184  correctedEnergy = correctedEt*cosh(eta);
185  return correctedEnergy - energy;
186 
187  } else {
188 
189  // perform no correction
190  return 0;
191  }
192 
193 }
194 
195 
< trclass="colgroup">< tdclass="colgroup"colspan=5 > Ecal cluster collections</td ></tr >< tr >< td >< ahref="classreco_1_1BasicCluster.html"> reco::BasicCluster</a ></td >< td >< ahref="DataFormats_EgammaReco.html"> reco::BasicClusterCollection</a ></td >< td >< ahref="#"> hybridSuperClusters</a ></td >< tdclass="description"> Basic clusters reconstructed with hybrid algorithm(barrel only)</td >< td >S.Rahatlou</td ></tr >< tr >< td >< a href
float fEtEta(float et, float eta, int algorithm) const
double phiWidth() const
obtain phi and eta width of the Super Cluster
Definition: SuperCluster.h:53
T eta() const
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:160
virtual float getValue(const reco::SuperCluster &, const int mode) const
double etaWidth() const
Definition: SuperCluster.h:54
T sqrt(T t)
Definition: SSEVec.h:46
double p4[4]
Definition: TauolaWrapper.h:92
EcalFunctionParameters & params()
double energy() const
cluster energy
Definition: CaloCluster.h:120
unsigned int offset(bool)
double p2[4]
Definition: TauolaWrapper.h:90
double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
Definition: SuperCluster.h:47
double b
Definition: hdecay.h:120
double p1[4]
Definition: TauolaWrapper.h:89
double a
Definition: hdecay.h:121
float fBrem(float e, float eta, int algorithm) const
float fEta(float e, float eta, int algorithm) const
#define DEFINE_EDM_PLUGIN(factory, type, name)
double preshowerEnergy() const
energy deposited in preshower
Definition: SuperCluster.h:50
const EcalClusterEnergyCorrectionParameters * params_
double p3[4]
Definition: TauolaWrapper.h:91