/afs/hep.man.ac.uk/u/markowen/ATLAS/SFrameProof/2011EPS/topUtils/src/electron_SF_R16.h

00001 #ifndef electron_SF_R16_h
00002 #define electron_SF_R16_h
00003 
00004 // copied from trunk 13-2-2011
00005 // added missing #include <cmath>
00006 
00007 /****************************************************************************
00008  * electron_SF_R16.h                                                        *
00009  *                                                                          *
00010  * Simple functions which return data/MC scale factors                      *
00011  * given a electron's eta                                                                                                       *
00012  * Also functions for corresponding uncertainties.                          *
00013  *                                                                          *
00014  * double ele_ID_SF(double et, double ET)                                   *
00015  * double ele_ID_SF_err(double eta, double ET)                                  *
00016  * double ele_reco_SF();                                                    *
00017  * double ele_reco_SF_err();                                                    *
00018  * double ele_recoID_SF(double eta, double ET);                             *
00019  * double ele_recoID_SF_err(double eta, double ET);                             *
00020  * double ele_trigger_SF();                                                 *
00021  * double ele_trigger_SF_err();                                                 *
00022  *                                                                          *
00023  * History                                                                  *
00024  *         26 Jan 2011 -- created by S. Caughron                            *   
00025  ***************************************************************************/
00026 
00027 #include <iostream>
00028 #include <cmath>
00029 
00030 // forward declaration of functions
00031 double ele_ID_SF(double eta, double ET);
00032 double ele_ID_SF_err(double eta, double ET);
00033 double ele_reco_SF();
00034 double ele_reco_SF_err();
00035 double ele_recoID_SF(double eta, double ET);
00036 double ele_recoID_SF_err(double eta, double ET);
00037 double ele_trigger_SF();
00038 double ele_trigger_SF_err();
00039 
00040 
00041 // For ID+iso scale factors
00042 double ele_ID_SF(double eta, double ET)
00043 {
00044 
00045     double ele_eta = eta;
00046     double ele_ET = ET;
00047     int etaI=-1; int ET_I=-1;   
00048 
00049     const double etabins[8] = {-2.47,-2.01,-1.37,-0.8,  // lower edges of eta bins
00050                                                            0.0,0.8,1.52,2.01};   
00051     const double ETbins[6] = {20.,25.,30.,35.,40.,45.}; // lower edges of eta bins
00052 
00053         const double SFmatrix[6][8] = {{0.917,0.946,0.968,0.907,0.912,0.970,0.961,0.953},   //rows are ET
00054                                                                    {0.960,0.990,1.013,0.949,0.955,1.016,1.006,0.998},     //columns are eta
00055                                                                    {0.998,1.029,1.053,0.987,0.993,1.056,1.046,1.037},
00056                                                                    {0.996,1.027,1.051,0.985,0.991,1.054,1.044,1.035},
00057                                                                    {0.998,1.029,1.053,0.987,0.993,1.056,1.046,1.037},
00058                                                                    {1.007,1.038,1.062,0.995,1.002,1.065,1.055,1.046}};
00059 
00060 
00061         const double etamax = 2.47;
00062         const double etacrack[2] = {1.37,1.52};
00063 
00064     if ( fabs(ele_eta) > etamax || (fabs(ele_eta) > etacrack[0] && fabs(ele_eta) < etacrack[1]) )  // check forward, crack regions
00065 
00066         return 1.0;       
00067 
00068     else {           
00069         
00070         for (int i=7; i>=0; i--){    // find eta index
00071             if ( ele_eta > etabins[i] ) {
00072                 etaI = i;
00073                 break;
00074             }
00075         }
00076         for (int i=5; i>=0; i--){    // find eta index
00077             if ( ele_ET > ETbins[i] ) {
00078                 ET_I = i;
00079                 break;
00080             }
00081         }
00082 
00083         return SFmatrix[ET_I][etaI];
00084 
00085     } //else
00086 
00087     return 0;
00088 }
00089 
00090 // For ID+iso scale factor uncertainties (symmetric)
00091 double ele_ID_SF_err(double eta, double ET)
00092 {
00093 
00094     double ele_eta = eta;
00095     double ele_ET = ET;
00096     int etaI=-1; int ET_I=-1;   
00097 
00098     const double etabins[8] = {-2.47,-2.01,-1.37,-0.8,  // lower edges of eta bins
00099                                                            0.0,0.8,1.52,2.01};   
00100     const double ETbins[6] = {20.,25.,30.,35.,40.,45.}; // lower edges of eta bins
00101 
00102         const double errmatrix[6][8] = {{ 0.082,  0.083,  0.082,  0.081,  0.081,  0.082,  0.086,  0.085 },     //rows are ET
00103                                                                         { 0.028,  0.032,  0.030,  0.027,  0.027,  0.029,  0.038,  0.037  },    //columns are eta
00104                                                                         { 0.027,  0.032,  0.029,  0.026,  0.026,  0.028,  0.038,  0.036  },
00105                                                                         { 0.025,  0.030,  0.027,  0.023,  0.023,  0.025,  0.036,  0.034  },
00106                                                                         { 0.025,  0.030,  0.028,  0.024,  0.024,  0.026,  0.037,  0.035  },
00107                                                                         { 0.034,  0.038,  0.035,  0.033,  0.033,  0.034,  0.043,  0.041  }};
00108 
00109         const double etamax = 2.47;
00110         const double etacrack[2] = {1.37,1.52};
00111 
00112     if ( fabs(ele_eta) > etamax || (fabs(ele_eta) > etacrack[0] && fabs(ele_eta) < etacrack[1]) )  // check forward, crack regions
00113 
00114         return 1.0;       
00115 
00116     else {           
00117         
00118         for (int i=7; i>=0; i--){    // find eta index
00119             if ( ele_eta > etabins[i] ) {
00120                 etaI = i;
00121                 break;
00122             }
00123         }
00124         for (int i=5; i>=0; i--){    // find ET index
00125             if ( ele_ET > ETbins[i] ) {
00126                 ET_I = i;
00127                 break;
00128             }
00129         }
00130                 
00131         return errmatrix[ET_I][etaI];
00132 
00133     } //else
00134 
00135     return 0;
00136 }
00137 
00138 double ele_reco_SF()
00139 {
00140 
00141         const double SF = 1.0;  //for rel15 (and rel16), just a number
00142     return SF;
00143 
00144 }
00145 
00146 // For reco SF uncertainties (symmetric)
00147 double ele_reco_SF_err()
00148 {
00149 
00150         const double SFerr = 0.015;  //for rel15, just a number
00151     return SFerr;
00152 
00153 }
00154 
00155 //returns cumulative reco+ID SF
00156 double ele_recoID_SF(double eta, double ET)
00157 {
00158 
00159         double ele_eta = eta;
00160         double ele_ET = ET;
00161         double total_SF = ele_ID_SF(ele_eta, ele_ET) * ele_reco_SF();
00162 
00163         return total_SF;
00164 
00165 }
00166 
00167 //returns cumulative reco+ID SF uncertainty
00168 double ele_recoID_SF_err(double eta, double ET)
00169 {
00170 
00171         double ele_eta = eta;
00172         double ele_ET = ET;
00173         double ID_err = ele_ID_SF_err(ele_eta, ele_ET) / ele_ID_SF(ele_eta, ele_ET);  //need relative errors
00174         double reco_err = ele_reco_SF_err() / ele_reco_SF();
00175 
00176         double tot_rel_err = sqrt( pow(ID_err,2) + pow(reco_err,2) );
00177         double tot_abs_err = tot_rel_err * ele_recoID_SF(ele_eta, ele_ET);
00178 
00179         return tot_abs_err;
00180 
00181 }
00182 
00183 // For trigger SFs
00184 double ele_trigger_SF()
00185 {
00186 
00187         const double SF = 0.995;  //for rel15 (and rel16), just a number
00188     return SF;
00189 
00190 }
00191 
00192 // For trigger SF uncertainties (symmetric)
00193 double ele_trigger_SF_err()
00194 {
00195 
00196         const double SFerr = 0.005;  //for rel15 (and rel16) , just a number
00197     return SFerr;
00198 
00199 }
00200 
00201 #endif

Generated on Thu Jun 30 11:40:04 2011 for manTreeSFrame by  doxygen 1.4.7