Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

MCNNAnalysis/EnergyCorrections.cxx

Go to the documentation of this file.
00001 
00002 //
00003 // EnergyCorrections.h
00004 //
00005 // Corrections to energy based quantities
00006 //
00007 // Created:  M. Kordosky -- December, 2005
00008 //
00009 // $Author: rhatcher $ 
00010 //
00011 // $Revision: 1.2 $
00012 // 
00013 // $Name:  $
00014 //
00015 // $Id: EnergyCorrections.cxx,v 1.2 2009/05/26 22:04:51 rhatcher Exp $
00016 //
00017 // $Log: EnergyCorrections.cxx,v $
00018 // Revision 1.2  2009/05/26 22:04:51  rhatcher
00019 // Use Detector:: rather than DetectorType:: (synonym) everywhere, so we can
00020 // someday eliminate the deprecated DetectorType::.
00021 //
00022 // Add #include <cmath> in enough places sufficient for resolving random
00023 // use of fabs() when compiled w/ gcc 4.x
00024 //
00025 // Revision 1.1  2009/03/23 09:28:27  rbpatter
00026 // initial import of new singleton MCNN package
00027 //
00028 // Revision 1.4  2006/02/15 15:57:29  kordosky
00029 // add correction from for momentum via curvature as advocated in 1430-v2. Only modifies momenta of positively charged tracks.
00030 //
00031 // Revision 1.3  2006/02/13 00:20:02  kordosky
00032 // correction of +1.8% to FD data shower energy
00033 //
00034 // Revision 1.2  2006/02/12 22:09:58  kordosky
00035 // Update momentum correction to account for new density and thickness measurements.
00036 //
00037 // Revision 1.1  2005/12/16 03:38:51  kordosky
00038 // place implementation in a cxx file
00039 //
00040 // Revision 1.4  2005/12/16 02:52:43  kordosky
00041 // Forgot the include guards.  Thansk Niki.
00042 //
00043 // Revision 1.3  2005/12/15 22:44:31  kordosky
00044 // retweaked A Culling formulae in reaction to his presentation this morning
00045 //
00046 // Revision 1.2  2005/12/15 22:26:19  kordosky
00047 // E=sqrt(p*p+m*m)  != p   (almost negligible)
00048 //
00049 // Revision 1.1  2005/12/15 21:57:09  kordosky
00050 // moved from Mad
00051 //
00052 // Revision 1.2  2005/12/14 20:35:59  kordosky
00053 // Updated energy corrections.
00054 //
00055 // Revision 1.1  2005/12/13 19:41:35  kordosky
00056 // Standalone routines to correct the momentum via range to to groom et al range tables. Also, correct data to 7.755 g/cc which is our current best estimate of the detector density.
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   // correction for difference in data mc steel density
00066   if(isdata){
00067     // inital correction, pre-Oxford 2006
00068     //static const float dcor=7.755/7.87;// data/mc density
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 /* isdata */, Detector::Detector_t /* det */){
00081   // input is the signed momentum (e.g. p/q)
00082   // isdata and det are not used... but maybe in the future
00083   float pcor=p;
00084   if(pcor!=0) {
00085     // correction advertised in 1430-v2, J. Musser
00086     // note: for 1/p < 0   C=1, so correction only matters for mu+
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;// mon mass
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 /* isdata */){
00103 
00104    float ecor=E;
00105    if(st==CandShowerHandle::kCC){
00106       if(mode==1){
00107          // Niki Correction
00108          ecor=E/1.18;
00109       }
00110       else if(mode==2){
00111          // Andy Correction
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          // Niki Correction
00118          ecor=((E)*(1.+0.50*exp(-1.00*E)));
00119       }
00120       else if(mode==2){
00121          // Andy Correction
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        // a correction for the FD MIP scale
00134        // for the beam data, one measured MIP 
00135        // actually corresponds to 1.018 MIPs
00136        // so we must correct shower energy up
00137        const float mip_scale_correction=1.018;
00138        E*=mip_scale_correction;
00139      }
00140 
00141      if(mode==1){
00142        // Niki Correction
00143        ecor=((E)*(1.-0.12*exp(-0.12*E)));
00144      }
00145      else if(mode==2){
00146        // Andy Correction
00147        //        ecor=(E)*(1.-0.2*exp(-0.2*E));
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          // Niki Correction
00154          ecor=((E)*(1.+0.18*exp(-0.35*E)));
00155       }
00156       else if(mode==2){
00157          // Andy Correction
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 }

Generated on Mon Feb 15 11:06:38 2010 for loon by  doxygen 1.3.9.1