Go to the documentation of this file.00001 #include "RecoEcal/EgammaCoreTools/plugins/EcalClusterEnergyCorrection.h"
00002
00003
00004
00005 float EcalClusterEnergyCorrection::fEta(float energy, float eta, int algorithm) const
00006 {
00007
00008
00009 if ( algorithm != 0 ) return energy;
00010
00011 float ieta = fabs(eta)*(5/0.087);
00012 float p0 = (params_->params())[0];
00013 float p1 = (params_->params())[1];
00014
00015 float correctedEnergy = energy;
00016 if ( ieta < p0 ) correctedEnergy = energy;
00017 else correctedEnergy = energy/(1.0 + p1*(ieta-p0)*(ieta-p0));
00018
00019 return correctedEnergy;
00020 }
00021
00022 float EcalClusterEnergyCorrection::fBrem(float e, float brem, int algorithm) const
00023 {
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 int offset;
00037 if ( algorithm == 0 ) offset = 0;
00038 else if ( algorithm == 1 ) offset = 20;
00039 else {
00040
00041 return e;
00042 }
00043
00044
00045 if ( brem == 0 ) return e;
00046
00047 float bremLowThr = (params_->params())[2 + offset];
00048 float bremHighThr = (params_->params())[3 + offset];
00049 if ( brem < bremLowThr ) brem = bremLowThr;
00050 if ( brem > bremHighThr ) brem = bremHighThr;
00051
00052
00053 float p0 = (params_->params())[4 + offset];
00054 float p1 = (params_->params())[5 + offset];
00055 float p2 = (params_->params())[6 + offset];
00056 float p3 = (params_->params())[7 + offset];
00057 float p4 = (params_->params())[8 + offset];
00058
00059 float threshold = p4;
00060
00061 float y = p0*threshold*threshold + p1*threshold + p2;
00062 float yprime = 2*p0*threshold + p1;
00063 float a = p3;
00064 float b = yprime - 2*a*threshold;
00065 float c = y - a*threshold*threshold - b*threshold;
00066
00067 float fCorr = 1;
00068 if ( brem < threshold )
00069 fCorr = p0*brem*brem + p1*brem + p2;
00070 else
00071 fCorr = a*brem*brem + b*brem + c;
00072
00073
00074 return e/fCorr;
00075 }
00076
00077
00078 float EcalClusterEnergyCorrection::fEtEta(float et, float eta, int algorithm) const
00079 {
00080
00081
00082
00083
00084
00085
00086
00087
00088 float fCorr = 0.;
00089 int offset;
00090 if ( algorithm == 0 ) offset = 0;
00091 else if ( algorithm == 1 ) offset = 20;
00092 else if ( algorithm == 10 ) offset = 28;
00093 else if ( algorithm == 11 ) offset = 39;
00094 else {
00095
00096 return et;
00097 }
00098
00099
00100 if ( algorithm == 0 || algorithm == 10 ) {
00101 float p0 = (params_->params())[ 9 + offset] + (params_->params())[10 + offset]/ (et + (params_->params())[11 + offset]) + (params_->params())[12 + offset]/(et*et);
00102 float p1 = (params_->params())[13 + offset] + (params_->params())[14 + offset]/ (et + (params_->params())[15 + offset]) + (params_->params())[16 + offset]/(et*et);
00103
00104 fCorr = p0 + p1 * atan((params_->params())[17 + offset]*((params_->params())[18 + offset]-fabs(eta))) + (params_->params())[19 + offset] * fabs(eta);
00105
00106 } else if ( algorithm == 1 || algorithm == 11 ) {
00107 float p0 = (params_->params())[ 9 + offset] + (params_->params())[10 + offset]/sqrt(et);
00108 float p1 = (params_->params())[11 + offset] + (params_->params())[12 + offset]/sqrt(et);
00109 float p2 = (params_->params())[13 + offset] + (params_->params())[14 + offset]/sqrt(et);
00110 float p3 = (params_->params())[15 + offset] + (params_->params())[16 + offset]/sqrt(et);
00111
00112 fCorr = p0 + p1*fabs(eta) + p2*eta*eta + p3/fabs(eta);
00113 }
00114
00115
00116 if ( fCorr < 0.5 ) fCorr = 0.5;
00117 if ( fCorr > 1.5 ) fCorr = 1.5;
00118
00119
00120 return et/fCorr;
00121 }
00122
00123
00124 float EcalClusterEnergyCorrection::getValue( const reco::SuperCluster & superCluster, const int mode ) const
00125 {
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136 checkInit();
00137
00138 float eta = fabs(superCluster.eta());
00139 float brem = superCluster.phiWidth()/superCluster.etaWidth();
00140 int algorithm = -1;
00141
00142 if ( mode <= 3 || mode == 10 ) {
00143
00144 algorithm = 0;
00145
00146 float energy = superCluster.rawEnergy();
00147 if ( mode == 10 ) {
00148 algorithm = 10;
00149 energy = superCluster.energy();
00150 }
00151 float correctedEnergy = fEta(energy, eta, algorithm);
00152
00153 if ( mode == 1 ) {
00154 return correctedEnergy - energy;
00155
00156 } else {
00157
00158 correctedEnergy = fBrem(correctedEnergy, brem, algorithm);
00159 if ( mode == 2 ) {
00160 return correctedEnergy - energy;
00161 }
00162
00163 float correctedEt = correctedEnergy/cosh(eta);
00164 correctedEt = fEtEta(correctedEt, eta, algorithm);
00165 correctedEnergy = correctedEt*cosh(eta);
00166 return correctedEnergy - energy;
00167 }
00168 } else if ( mode == 4 || mode == 5 || mode == 11 ) {
00169 algorithm = 1;
00170
00171 float energy = superCluster.rawEnergy() + superCluster.preshowerEnergy();
00172 if ( mode == 11 ) {
00173 algorithm = 11;
00174 energy = superCluster.energy();
00175 }
00176
00177 float correctedEnergy = fBrem(energy, brem, algorithm);
00178 if ( mode == 4 ) {
00179 return correctedEnergy - energy;
00180 }
00181
00182 float correctedEt = correctedEnergy/cosh(eta);
00183 correctedEt = fEtEta(correctedEt, eta, algorithm);
00184 correctedEnergy = correctedEt*cosh(eta);
00185 return correctedEnergy - energy;
00186
00187 } else {
00188
00189
00190 return 0;
00191 }
00192
00193 }
00194
00195
00196 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionFactory.h"
00197 DEFINE_EDM_PLUGIN( EcalClusterFunctionFactory, EcalClusterEnergyCorrection, "EcalClusterEnergyCorrection");