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>& barrelFbremCorr,
11  std::vector<double>& endcapFbremCorr,
12  std::vector<double>& barrelCorr,
13  std::vector<double>& endcapCorr):
14  barrelFbremCorr_(barrelFbremCorr),
15  endcapFbremCorr_(endcapFbremCorr),
16  barrelCorr_(barrelCorr),
17  endcapCorr_(endcapCorr)
18 {
19 
20  // intial parameters
21 
22  bool log = false;
23 
24  if(barrelFbremCorr_.size() != 13)
25  edm::LogError("PFSCEnergyCalibration")<<" wrong size input paramter: calibPFSCEle_Fbrem_barrel read = "
26  << barrelCorr_.size() << " expected = 13" << endl;
27 
28 
29  if(endcapFbremCorr_.size() != 13)
30  edm::LogError("PFSCEnergyCalibration")<<" wrong size input parameter: calibPFSCEle_Fbrem_endcap read = "
31  << endcapCorr_.size() << " expected = 13" << endl;
32 
33 
34 
35  if(barrelCorr_.size() != 17)
36  edm::LogError("PFSCEnergyCalibration")<<" wrong size input paramter: calibPFSCEle_barrel read = "
37  << barrelCorr_.size() << " expected = 17" << endl;
38 
39 
40  if(endcapCorr_.size() != 9)
41  edm::LogError("PFSCEnergyCalibration")<<" wrong size input parameter: calibPFSCEle_endcap read = "
42  << endcapCorr_.size() << " expected = 9" << endl;
43 
44 
45  if(log)
46  cout << " ****** THE BARREL SC FBREM CORRECTIONS ******* " << barrelFbremCorr_.size() << endl;
47  for(unsigned int ip = 0; ip< barrelFbremCorr_.size(); ip++){
48  pbb[ip] = barrelFbremCorr_[ip];
49  if(log)
50  cout << " pbb[" << ip << "] " << " = " << pbb[ip] << endl;
51  }
52 
53  if(log)
54  cout << " ****** THE ENCCAP SC FBREM CORRECTIONS ******* " << endcapFbremCorr_.size() << endl;
55  for(unsigned int ip = 0; ip< endcapFbremCorr_.size(); ip++){
56  pbe[ip] = endcapFbremCorr_[ip];
57  if(log)
58  cout << " pbe[" << ip << "] " << " = " << pbe[ip] << endl;
59  }
60 
61  if(log)
62  cout << " ****** THE BARREL SC CORRECTIONS ******* " << barrelCorr_.size() << endl;
63  for(unsigned int ip = 0; ip< barrelCorr_.size(); ip++){
64  bb[ip] = barrelCorr_[ip];
65  if(log)
66  cout << " bb[" << ip << "] " << " = " << bb[ip] << endl;
67  }
68 
69  if(log)
70  cout << " ****** THE ENCCAP SC CORRECTIONS ******* " << endcapCorr_.size() << endl;
71  for(unsigned int ip = 0; ip< endcapCorr_.size(); ip++){
72  cc[ip] = endcapCorr_[ip];
73  if(log)
74  cout << " cc[" << ip << "] " << " = " << cc[ip] << endl;
75  }
76 }
78 
79 
80 double PFSCEnergyCalibration::SCCorrFBremBarrel(double e, double et, double brLinear) { //MM
81  double fCorr = 1;
82 
83  // make NO correction if brLinear is invalid!
84  if ( brLinear == 0 ) return e;
85  //
86 
87  if ( brLinear < pbb[0] ) brLinear = pbb[0];
88  if ( brLinear > pbb[1] ) brLinear = pbb[1];
89 
90 
91  double p0 = pbb[2];
92  double p1 = pbb[3];
93  double p2 = pbb[4];
94  double p3 = pbb[5];
95  double p4 = pbb[6];
96 
97 
98  //Low pt ( < 25 GeV) dedicated corrections
99  if( et < pbb[7] ) {
100  p0 = pbb[8];
101  p1 = pbb[9];
102  p2 = pbb[10];
103  p3 = pbb[11];
104  p4 = pbb[12];
105  }
106 
107  double threshold = p4;
108 
109  double y = p0*threshold*threshold + p1*threshold + p2;
110  double yprime = 2*p0*threshold + p1;
111  double a = p3;
112  double b = yprime - 2*a*threshold;
113  double c = y - a*threshold*threshold - b*threshold;
114 
115  if ( brLinear < threshold )
116  fCorr = p0*brLinear*brLinear + p1*brLinear + p2;
117  else
118  fCorr = a*brLinear*brLinear + b*brLinear + c;
119 
120  return e/fCorr;
121 
122 }
123 
124 
125 double PFSCEnergyCalibration::SCCorrFBremEndcap(double e, double eta, double brLinear) {//MM
126  double fCorr = 1;
127 
128  //Energy must contain associated preshower energy
129 
130  if ( brLinear == 0 ) return e;
131 
132  if ( brLinear < pbe[0] ) brLinear = pbe[0];
133  if ( brLinear > pbe[1] ) brLinear = pbe[1];
134 
135 
136  double p0 = pbe[2];
137  double p1 = pbe[3];
138  double p2 = pbe[4];
139  double p3 = pbe[5];
140  double p4 = pbe[6];
141 
142  //Change of set of corrections to take
143  //into account the active preshower region
144  if(fabs(eta) > pbe[7] ) {
145  p0 = pbe[8];
146  p1 = pbe[9];
147  p2 = pbe[10];
148  p3 = pbe[11];
149  p4 = pbe[12];
150  }
151 
152  double threshold = p4;
153 
154  double y = p0*threshold*threshold + p1*threshold + p2;
155  double yprime = 2*p0*threshold + p1;
156  double a = p3;
157  double b = yprime - 2*a*threshold;
158  double c = y - a*threshold*threshold - b*threshold;
159 
160  if ( brLinear < threshold )
161  fCorr = p0*brLinear*brLinear + p1*brLinear + p2;
162  else
163  fCorr = a*brLinear*brLinear + b*brLinear + c;
164 
165  return e/fCorr;
166 
167 
168 }
169 
170 
172  double fCorr = 0;
173 
174 
175  // 25 November Morning
176 
177 // //p0
178 // double bb0 = 1.03257;
179 // double bb1 = -1.37103e+01;
180 // double bb2 = 3.39716e+02;
181 // double bb3 = 4.86192e-01;
182 
183 // //p1
184 // double bb4 = 1.81653e-03;
185 // double bb5 = 3.64445e-01;
186 // double bb6 = 1.41132;
187 
188 
189 // //p2
190 // double bb7 = 1.02061;
191 // double bb8 = 5.91624e-03;
192 // double bb9 = -5.14434e-05;
193 // double bb10 = 1.42516e-07;
194 
195  //2010 corrections
196 // double temp_et = et;
197 // // Avoid energy correction divergency at low Et.
198 // if(temp_et < 2)
199 // temp_et = 2;
200 
201 // double d0 = 15.0; // sharpness of the curve
202 // double d1 = -0.00181;
203 // double d2 = 1.081;
204 
205 // double p0 = bb[0] + bb[1]/(temp_et + bb[2]) - bb[3]/(temp_et) ;
206 // double p1 = bb[4] + bb[5]/(bb[6] + temp_et);
207 
208 
209 
210 // // for the momentum the fixed value d2 is prefered to p2
211 // double p2 = bb[7] + bb[8]*temp_et + bb[9]*temp_et*temp_et + bb[10]*temp_et*temp_et*temp_et;
212 
213 // if(temp_et > 130) {
214 // double y = 130;
215 // p2 = bb[7] + bb[8]*y + bb[9]*y*y + bb[10]*y*y*y;
216 // }
217 
218 // fCorr = p0 + p1*atan(d0*(d2 - fabs(eta))) + d1*fabs(eta);
219 
220 
221  //February 2011 corrections
222  double temp_et = et;
223  // Avoid energy correction divergency at low Et.
224  if(temp_et < 3)
225  temp_et = 3;
226 
227  double c0 = bb[0];
228  double c1 = bb[1];
229  double c2 = bb[2];
230  double c3 = bb[3];
231 
232  double d0 = bb[4];
233  double d1 = bb[5];
234  double d2 = bb[6];
235  double d3 = bb[7];
236 
237  double e0 = 1.081; // curve point in eta distribution
238  double e1 = 7.6; // sharpness of the curve
239  double e2 = -0.00181;
240 
241  //Low pt ( < 25 GeV) dedidacted corrections
242  if(temp_et < bb[8] ) {
243 
244  c0 = bb[9];
245  c1 = bb[10];
246  c2 = bb[11];
247  c3 = bb[12];
248 
249  d0 = bb[13];
250  d1 = bb[14];
251  d2 = bb[15];
252  d3 = bb[16];
253 
254  }
255 
256  double p0 = c0 + c1/(temp_et + c2) + c3/(temp_et*temp_et);
257  double p1 = d0/(temp_et + d1) + d2/(temp_et*temp_et + d3);
258 
259 
260  fCorr = p0 + p1*atan(e1*(e0 - fabs(eta))) + e2*fabs(eta);
261 
262  return et/fCorr;
263 
264 }
265 
267  double fCorr = 0;
268 
269 
270 // //p0
271 // double c0 = 9.99464e-01;
272 // double c1 = -1.23130e+01;
273 // double c2 = 2.87841;
274 
275 // //p1
276 // double c3 = -1.05697e-04;
277 // double c4 = 1.02819e+01;
278 // double c5 = 3.05904;
279 
280 
281 // //p2
282 // double c6 = 1.35017e-03;
283 // double c7 = -2.21845;
284 // double c8 = 3.42062;
285 
286  double temp_et = et;
287  // Avoid energy correction divergency at low Et.
288  if(temp_et < 3)
289  temp_et = 3;
290 
291  double p0 = cc[0] + cc[1]/(cc[2] + temp_et);
292  double p1 = cc[3] + cc[4]/(cc[5] + temp_et);
293  double p2 = cc[6] + cc[7]/(cc[8] + temp_et);
294 
295 
296  fCorr = p0 + p1*fabs(eta) + p2*eta*eta;
297 
298  return et/fCorr;
299 }
300 
std::vector< double > endcapCorr_
double SCCorrFBremBarrel(double e, double et, double brLinear)
double p4[4]
Definition: TauolaWrapper.h:92
double SCCorrEtEtaBarrel(double et, double eta)
double p2[4]
Definition: TauolaWrapper.h:90
double SCCorrEtEtaEndcap(double et, double eta)
std::vector< double > barrelCorr_
double b
Definition: hdecay.h:120
std::vector< double > endcapFbremCorr_
double p1[4]
Definition: TauolaWrapper.h:89
double a
Definition: hdecay.h:121
tuple cout
Definition: gather_cfg.py:121
std::vector< double > barrelFbremCorr_
double SCCorrFBremEndcap(double e, double eta, double brLinear)
double p3[4]
Definition: TauolaWrapper.h:91
tuple log
Definition: cmsBatch.py:341