CMS 3D CMS Logo

HFEGammaSLCorrector.cc
Go to the documentation of this file.
1 #include "HFEGammaSLCorrector.h"
2 #include "CLHEP/Vector/LorentzVector.h"
3 
4 namespace hf_egamma {
5 
6  double eSeLCorrected(double es, double el, double pc, double px, double py){
7  double x = log(el/100) ;
8  double y = es / el ;
9  return pc + px*x + py*y ;
10  }
11 
12  double eSeLCorrected(double es, double el, int era){
13  double pc=0.0,px=0.0,py=0.0;
14 
15  switch (era) {
16  case (0): //Data 41
17  pc = -1.02388e-1 ;
18  px = -1.51130e-1 ;
19  py = 9.88514e-1 ;
20  break;
21  case (1): //Fall 10 MC
22  pc = -4.06012e-2 ;
23  px = -1.34769e-1 ;
24  py = 9.90877e-1 ;
25  break;
26  case (2): //Spring 11 MC
27  pc = 5.98732e-3 ;
28  px = -1.74767e-1 ;
29  py = 9.84610e-1 ;
30  break;
31  case (3): //Summer 11 MC
32  pc = -0.036416 ;
33  px = -0.195854 ;
34  py = 0.980633 ;
35  break;
36  case (4): //July 5 Data
37  pc = -0.008077 ;
38  px = -0.216002 ;
39  py = 0.976393 ;
40  break;
41  }
42 
43  //After fitting the 2D histogram, we find a y-intercept b, a slope m,
44  //and a point x0 around which we choose to rotate the data points. We
45  //will map (x,y) --> (x,y') where y' = pc + px*x + py*y, with
46  //pc = sin(atan(m))*x0 - cos(atan(m))*(m*x0+b), px = -sin(atan(m)),
47  //and py = cos(atan(m)). This transformation preserves the x-value of the
48  //data point and takes y' to be the y-value of the original point after it
49  //is rotated through angle atan(m) (to flatten the line of best fit) and
50  //transposed vertically downward by b (to make the line of best fit coincide with the x-axis).
51 
52  return eSeLCorrected(es, el, pc, px, py) ;
53  }
54 }
double eSeLCorrected(double es, double el, double pc, double px, double py)