CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFSCEnergyCalibration.cc
Go to the documentation of this file.
3 #include <vector>
4 
5 using namespace std;
6 
8 
9 
10 PFSCEnergyCalibration::PFSCEnergyCalibration(std::vector<double>& barrelCorr,
11  std::vector<double>& endcapCorr):
12  barrelCorr_(barrelCorr),
13  endcapCorr_(endcapCorr)
14 {
15 
16  // intial parameters
17 
18  bool log = false;
19 
20 
21  if(barrelCorr_.size() != 11)
22  edm::LogError("PFSCEnergyCalibration")<<" wrong size input paramter: calibPFSCEle_barrel read = "
23  << barrelCorr_.size() << " expected = 11" << endl;
24 
25 
26  if(endcapCorr_.size() != 9)
27  edm::LogError("PFSCEnergyCalibration")<<" wrong size input parameter: calibPFSCEle_endcap read = "
28  << endcapCorr_.size() << " expected = 8" << endl;
29 
30 
31  if(log)
32  cout << " ****** THE BARREL SC CORRECTIONS ******* " << barrelCorr_.size() << endl;
33  for(unsigned int ip = 0; ip< barrelCorr_.size(); ip++){
34  bb[ip] = barrelCorr_[ip];
35  if(log)
36  cout << " bb[" << ip << "] " << " = " << bb[ip] << endl;
37  }
38 
39  if(log)
40  cout << " ****** THE ENCCAP SC CORRECTIONS ******* " << endcapCorr_.size() << endl;
41  for(unsigned int ip = 0; ip< endcapCorr_.size(); ip++){
42  cc[ip] = endcapCorr_[ip];
43  if(log)
44  cout << " cc[" << ip << "] " << " = " << cc[ip] << endl;
45  }
46 }
48 
49 
51  double fCorr = 0;
52 
53 
54  // 25 November Morning
55 
56 // //p0
57 // double bb0 = 1.03257;
58 // double bb1 = -1.37103e+01;
59 // double bb2 = 3.39716e+02;
60 // double bb3 = 4.86192e-01;
61 
62 // //p1
63 // double bb4 = 1.81653e-03;
64 // double bb5 = 3.64445e-01;
65 // double bb6 = 1.41132;
66 
67 
68 // //p2
69 // double bb7 = 1.02061;
70 // double bb8 = 5.91624e-03;
71 // double bb9 = -5.14434e-05;
72 // double bb10 = 1.42516e-07;
73 
74 
75  double temp_et = et;
76  // Avoid energy correction divergency at low Et.
77  if(temp_et < 2)
78  temp_et = 2;
79 
80 
81  double d0 = 15.0; // sharpness of the curve
82  double d1 = -0.00181;
83  double d2 = 1.081;
84 
85  double p0 = bb[0] + bb[1]/(temp_et + bb[2]) - bb[3]/(temp_et) ;
86  double p1 = bb[4] + bb[5]/(bb[6] + temp_et);
87 
88 
89 
90  // for the momentum the fixed value d2 is prefered to p2
91  double p2 = bb[7] + bb[8]*temp_et + bb[9]*temp_et*temp_et + bb[10]*temp_et*temp_et*temp_et;
92 
93  if(temp_et > 130) {
94  double y = 130;
95  p2 = bb[7] + bb[8]*y + bb[9]*y*y + bb[10]*y*y*y;
96  }
97 
98 
99 
100 
101 
102  fCorr = p0 + p1*atan(d0*(d2 - fabs(eta))) + d1*fabs(eta);
103 
104  return et/fCorr;
105 }
106 
108  double fCorr = 0;
109 
110 
111 // //p0
112 // double c0 = 9.99464e-01;
113 // double c1 = -1.23130e+01;
114 // double c2 = 2.87841;
115 
116 // //p1
117 // double c3 = -1.05697e-04;
118 // double c4 = 1.02819e+01;
119 // double c5 = 3.05904;
120 
121 
122 // //p2
123 // double c6 = 1.35017e-03;
124 // double c7 = -2.21845;
125 // double c8 = 3.42062;
126 
127  double temp_et = et;
128  // Avoid energy correction divergency at low Et.
129  if(temp_et < 2)
130  temp_et = 2;
131 
132  double p0 = cc[0] + cc[1]/(cc[2] + temp_et);
133  double p1 = cc[3] + cc[4]/(cc[5] + temp_et);
134  double p2 = cc[6] + cc[7]/(cc[8] + temp_et);
135 
136 
137  fCorr = p0 + p1*fabs(eta) + p2*eta*eta;
138 
139  return et/fCorr;
140 }
141 
tuple d0
Definition: debug_cff.py:3
std::vector< double > endcapCorr_
tuple d1
Definition: debug_cff.py:7
T eta() const
double SCCorrEtEtaBarrel(double et, double eta)
double p2[4]
Definition: TauolaWrapper.h:90
double SCCorrEtEtaEndcap(double et, double eta)
std::vector< double > barrelCorr_
Log< T >::type log(const T &t)
Definition: Log.h:22
double p1[4]
Definition: TauolaWrapper.h:89
tuple cout
Definition: gather_cfg.py:41