Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:34:06

0001 #include "HFEGammaSLCorrector.h"
0002 
0003 #include <cmath>
0004 
0005 namespace hf_egamma {
0006 
0007   double eSeLCorrected(double es, double el, double pc, double px, double py) {
0008     double x = std::log(el / 100);
0009     double y = es / el;
0010     return pc + px * x + py * y;
0011   }
0012 
0013   double eSeLCorrected(double es, double el, int era) {
0014     double pc = 0.0, px = 0.0, py = 0.0;
0015 
0016     switch (era) {
0017       case (0):  //Data 41
0018         pc = -1.02388e-1;
0019         px = -1.51130e-1;
0020         py = 9.88514e-1;
0021         break;
0022       case (1):  //Fall 10 MC
0023         pc = -4.06012e-2;
0024         px = -1.34769e-1;
0025         py = 9.90877e-1;
0026         break;
0027       case (2):  //Spring 11 MC
0028         pc = 5.98732e-3;
0029         px = -1.74767e-1;
0030         py = 9.84610e-1;
0031         break;
0032       case (3):  //Summer 11 MC
0033         pc = -0.036416;
0034         px = -0.195854;
0035         py = 0.980633;
0036         break;
0037       case (4):  //July 5 Data
0038         pc = -0.008077;
0039         px = -0.216002;
0040         py = 0.976393;
0041         break;
0042     }
0043 
0044     //After fitting the 2D histogram, we find a y-intercept b, a slope m,
0045     //and a point x0 around which we choose to rotate the data points. We
0046     //will map (x,y) --> (x,y') where y' = pc + px*x + py*y, with
0047     //pc = sin(atan(m))*x0 - cos(atan(m))*(m*x0+b), px = -sin(atan(m)),
0048     //and py = cos(atan(m)). This transformation preserves the x-value of the
0049     //data point and takes y' to be the y-value of the original point after it
0050     //is rotated through angle atan(m) (to flatten the line of best fit) and
0051     //transposed vertically downward by b (to make the line of best fit coincide with the x-axis).
0052 
0053     return eSeLCorrected(es, el, pc, px, py);
0054   }
0055 }  // namespace hf_egamma