Go to the documentation of this file.00001 #include "RecoParticleFlow/PFClusterTools/interface/PFSCEnergyCalibration.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 #include <vector>
00004
00005 using namespace std;
00006
00007 PFSCEnergyCalibration::PFSCEnergyCalibration() {}
00008
00009
00010 PFSCEnergyCalibration::PFSCEnergyCalibration(std::vector<double>& barrelFbremCorr,
00011 std::vector<double>& endcapFbremCorr,
00012 std::vector<double>& barrelCorr,
00013 std::vector<double>& endcapCorr):
00014 barrelFbremCorr_(barrelFbremCorr),
00015 endcapFbremCorr_(endcapFbremCorr),
00016 barrelCorr_(barrelCorr),
00017 endcapCorr_(endcapCorr)
00018 {
00019
00020
00021
00022 bool log = false;
00023
00024 if(barrelFbremCorr_.size() != 13)
00025 edm::LogError("PFSCEnergyCalibration")<<" wrong size input paramter: calibPFSCEle_Fbrem_barrel read = "
00026 << barrelCorr_.size() << " expected = 13" << endl;
00027
00028
00029 if(endcapFbremCorr_.size() != 13)
00030 edm::LogError("PFSCEnergyCalibration")<<" wrong size input parameter: calibPFSCEle_Fbrem_endcap read = "
00031 << endcapCorr_.size() << " expected = 13" << endl;
00032
00033
00034
00035 if(barrelCorr_.size() != 17)
00036 edm::LogError("PFSCEnergyCalibration")<<" wrong size input paramter: calibPFSCEle_barrel read = "
00037 << barrelCorr_.size() << " expected = 17" << endl;
00038
00039
00040 if(endcapCorr_.size() != 9)
00041 edm::LogError("PFSCEnergyCalibration")<<" wrong size input parameter: calibPFSCEle_endcap read = "
00042 << endcapCorr_.size() << " expected = 9" << endl;
00043
00044
00045 if(log)
00046 cout << " ****** THE BARREL SC FBREM CORRECTIONS ******* " << barrelFbremCorr_.size() << endl;
00047 for(unsigned int ip = 0; ip< barrelFbremCorr_.size(); ip++){
00048 pbb[ip] = barrelFbremCorr_[ip];
00049 if(log)
00050 cout << " pbb[" << ip << "] " << " = " << pbb[ip] << endl;
00051 }
00052
00053 if(log)
00054 cout << " ****** THE ENCCAP SC FBREM CORRECTIONS ******* " << endcapFbremCorr_.size() << endl;
00055 for(unsigned int ip = 0; ip< endcapFbremCorr_.size(); ip++){
00056 pbe[ip] = endcapFbremCorr_[ip];
00057 if(log)
00058 cout << " pbe[" << ip << "] " << " = " << pbe[ip] << endl;
00059 }
00060
00061 if(log)
00062 cout << " ****** THE BARREL SC CORRECTIONS ******* " << barrelCorr_.size() << endl;
00063 for(unsigned int ip = 0; ip< barrelCorr_.size(); ip++){
00064 bb[ip] = barrelCorr_[ip];
00065 if(log)
00066 cout << " bb[" << ip << "] " << " = " << bb[ip] << endl;
00067 }
00068
00069 if(log)
00070 cout << " ****** THE ENCCAP SC CORRECTIONS ******* " << endcapCorr_.size() << endl;
00071 for(unsigned int ip = 0; ip< endcapCorr_.size(); ip++){
00072 cc[ip] = endcapCorr_[ip];
00073 if(log)
00074 cout << " cc[" << ip << "] " << " = " << cc[ip] << endl;
00075 }
00076 }
00077 PFSCEnergyCalibration::~PFSCEnergyCalibration() {}
00078
00079
00080 double PFSCEnergyCalibration::SCCorrFBremBarrel(double e, double et, double brLinear) {
00081 double fCorr = 1;
00082
00083
00084 if ( brLinear == 0 ) return e;
00085
00086
00087 if ( brLinear < pbb[0] ) brLinear = pbb[0];
00088 if ( brLinear > pbb[1] ) brLinear = pbb[1];
00089
00090
00091 double p0 = pbb[2];
00092 double p1 = pbb[3];
00093 double p2 = pbb[4];
00094 double p3 = pbb[5];
00095 double p4 = pbb[6];
00096
00097
00098
00099 if( et < pbb[7] ) {
00100 p0 = pbb[8];
00101 p1 = pbb[9];
00102 p2 = pbb[10];
00103 p3 = pbb[11];
00104 p4 = pbb[12];
00105 }
00106
00107 double threshold = p4;
00108
00109 double y = p0*threshold*threshold + p1*threshold + p2;
00110 double yprime = 2*p0*threshold + p1;
00111 double a = p3;
00112 double b = yprime - 2*a*threshold;
00113 double c = y - a*threshold*threshold - b*threshold;
00114
00115 if ( brLinear < threshold )
00116 fCorr = p0*brLinear*brLinear + p1*brLinear + p2;
00117 else
00118 fCorr = a*brLinear*brLinear + b*brLinear + c;
00119
00120 return e/fCorr;
00121
00122 }
00123
00124
00125 double PFSCEnergyCalibration::SCCorrFBremEndcap(double e, double eta, double brLinear) {
00126 double fCorr = 1;
00127
00128
00129
00130 if ( brLinear == 0 ) return e;
00131
00132 if ( brLinear < pbe[0] ) brLinear = pbe[0];
00133 if ( brLinear > pbe[1] ) brLinear = pbe[1];
00134
00135
00136 double p0 = pbe[2];
00137 double p1 = pbe[3];
00138 double p2 = pbe[4];
00139 double p3 = pbe[5];
00140 double p4 = pbe[6];
00141
00142
00143
00144 if(fabs(eta) > pbe[7] ) {
00145 p0 = pbe[8];
00146 p1 = pbe[9];
00147 p2 = pbe[10];
00148 p3 = pbe[11];
00149 p4 = pbe[12];
00150 }
00151
00152 double threshold = p4;
00153
00154 double y = p0*threshold*threshold + p1*threshold + p2;
00155 double yprime = 2*p0*threshold + p1;
00156 double a = p3;
00157 double b = yprime - 2*a*threshold;
00158 double c = y - a*threshold*threshold - b*threshold;
00159
00160 if ( brLinear < threshold )
00161 fCorr = p0*brLinear*brLinear + p1*brLinear + p2;
00162 else
00163 fCorr = a*brLinear*brLinear + b*brLinear + c;
00164
00165 return e/fCorr;
00166
00167
00168 }
00169
00170
00171 double PFSCEnergyCalibration::SCCorrEtEtaBarrel(double et, double eta) {
00172 double fCorr = 0;
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222 double temp_et = et;
00223
00224 if(temp_et < 3)
00225 temp_et = 3;
00226
00227 double c0 = bb[0];
00228 double c1 = bb[1];
00229 double c2 = bb[2];
00230 double c3 = bb[3];
00231
00232 double d0 = bb[4];
00233 double d1 = bb[5];
00234 double d2 = bb[6];
00235 double d3 = bb[7];
00236
00237 double e0 = 1.081;
00238 double e1 = 7.6;
00239 double e2 = -0.00181;
00240
00241
00242 if(temp_et < bb[8] ) {
00243
00244 c0 = bb[9];
00245 c1 = bb[10];
00246 c2 = bb[11];
00247 c3 = bb[12];
00248
00249 d0 = bb[13];
00250 d1 = bb[14];
00251 d2 = bb[15];
00252 d3 = bb[16];
00253
00254 }
00255
00256 double p0 = c0 + c1/(temp_et + c2) + c3/(temp_et*temp_et);
00257 double p1 = d0/(temp_et + d1) + d2/(temp_et*temp_et + d3);
00258
00259
00260 fCorr = p0 + p1*atan(e1*(e0 - fabs(eta))) + e2*fabs(eta);
00261
00262 return et/fCorr;
00263
00264 }
00265
00266 double PFSCEnergyCalibration::SCCorrEtEtaEndcap(double et, double eta) {
00267 double fCorr = 0;
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286 double temp_et = et;
00287
00288 if(temp_et < 3)
00289 temp_et = 3;
00290
00291 double p0 = cc[0] + cc[1]/(cc[2] + temp_et);
00292 double p1 = cc[3] + cc[4]/(cc[5] + temp_et);
00293 double p2 = cc[6] + cc[7]/(cc[8] + temp_et);
00294
00295
00296 fCorr = p0 + p1*fabs(eta) + p2*eta*eta;
00297
00298 return et/fCorr;
00299 }
00300