00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 #include "EnergyCorrections.h"
00060 #include <cmath>
00061
00062 float CorrectMomentumFromRange(float p, bool isdata, Detector::Detector_t det){
00063 static const float c[4]={1.01334,0.05563,-0.05346,0.01205};
00064
00065
00066 if(isdata){
00067
00068
00069 float dcor=1;
00070 if (det==Detector::kNear) dcor=(7.85*2.563)/(7.87*2.54);
00071 else if(det==Detector::kFar) dcor=(7.85*2.558)/(7.87*2.54);
00072
00073 p*=dcor;
00074 }
00075
00076 float pcor=p/(c[0] + c[1]*log(p) + c[2]*pow(log(p), 2) + c[3]*pow(log(p),3));
00077 return pcor;
00078 }
00079
00080 float CorrectSignedMomentumFromCurvature(float p, bool , Detector::Detector_t ){
00081
00082
00083 float pcor=p;
00084 if(pcor!=0) {
00085
00086
00087 float C = (1.01+0.1*fabs(1/p))/(1.01-0.1*(1/p));
00088 pcor*=(1.0/C);
00089 }
00090 return pcor;
00091 }
00092
00093
00094 float CorrectEnergyFromRange(float E, bool isdata, Detector::Detector_t det){
00095 const float m=0.1057;
00096 float p = sqrt(E*E -m*m);
00097 float pcor = CorrectMomentumFromRange(p,isdata,det);
00098 return sqrt(pcor*pcor +m*m);
00099 }
00100
00101
00102 float CorrectShowerEnergyNear(float E, const CandShowerHandle::ShowerType_t& st, int mode, bool ){
00103
00104 float ecor=E;
00105 if(st==CandShowerHandle::kCC){
00106 if(mode==1){
00107
00108 ecor=E/1.18;
00109 }
00110 else if(mode==2){
00111
00112 ecor=((E/1.05)*(1.-0.35*exp(-0.18*E/1.06)));
00113 }
00114 }
00115 else if(st==CandShowerHandle::kWtCC){
00116 if(mode==1){
00117
00118 ecor=((E)*(1.+0.50*exp(-1.00*E)));
00119 }
00120 else if(mode==2){
00121
00122 ecor=E/1.03;
00123 }
00124 }
00125 return ecor;
00126 }
00127
00128 float CorrectShowerEnergyFar(float E, const CandShowerHandle::ShowerType_t& st, int mode, bool isdata){
00129
00130 float ecor=E;
00131 if(st==CandShowerHandle::kCC){
00132 if(isdata) {
00133
00134
00135
00136
00137 const float mip_scale_correction=1.018;
00138 E*=mip_scale_correction;
00139 }
00140
00141 if(mode==1){
00142
00143 ecor=((E)*(1.-0.12*exp(-0.12*E)));
00144 }
00145 else if(mode==2){
00146
00147
00148 ecor=E*(0.99-0.035*E*exp(-0.25*E));
00149 }
00150 }
00151 else if(st==CandShowerHandle::kWtCC){
00152 if(mode==1){
00153
00154 ecor=((E)*(1.+0.18*exp(-0.35*E)));
00155 }
00156 else if(mode==2){
00157
00158 E=ecor;
00159 }
00160 }
00161 return ecor;
00162 }
00163 float CorrectShowerEnergy(float E, const Detector::Detector_t& det,
00164 const CandShowerHandle::ShowerType_t& st,
00165 int mode, bool isdata){
00166 float ecor=E;
00167 if(det==Detector::kNear){
00168 ecor = CorrectShowerEnergyNear(E,st,mode,isdata);
00169 }
00170 else if(det==Detector::kFar){
00171 ecor = CorrectShowerEnergyFar(E,st,mode,isdata);
00172 }
00173
00174 return ecor;
00175
00176 }