-
Notifications
You must be signed in to change notification settings - Fork 0
/
JetMETObjects.patch
556 lines (556 loc) · 18.9 KB
/
JetMETObjects.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
Index: Makefile
===================================================================
RCS file: /local/reps/CMSSW/CMSSW/CondFormats/JetMETObjects/Makefile,v
retrieving revision 1.6
diff -r1.6 Makefile
47a48,51
> $(TMPDIR)/JetCorrectionUncertainty.o \
> $(TMPDIR)/SimpleJetCorrectionUncertainty.o \
> $(TMPDIR)/JetResolution.o \
> $(TMPDIR)/Utilities.o \
87a92,109
> $(TMPDIR)/JetCorrectionUncertainty.o: interface/JetCorrectionUncertainty.h \
> src/JetCorrectionUncertainty.cc
> $(CXX) $(CXXFLAGS) -c src/JetCorrectionUncertainty.cc \
> -o $(TMPDIR)/JetCorrectionUncertainty.o
>
> $(TMPDIR)/SimpleJetCorrectionUncertainty.o: interface/SimpleJetCorrectionUncertainty.h \
> src/SimpleJetCorrectionUncertainty.cc
> $(CXX) $(CXXFLAGS) -c src/SimpleJetCorrectionUncertainty.cc \
> -o $(TMPDIR)/SimpleJetCorrectionUncertainty.o
>
> $(TMPDIR)/JetResolution.o: interface/JetResolution.h \
> src/JetResolution.cc
> $(CXX) $(CXXFLAGS) -c src/JetResolution.cc \
> -o $(TMPDIR)/JetResolution.o
>
> $(TMPDIR)/Utilities.o: src/Utilities.cc
> $(CXX) $(CXXFLAGS) -c src/Utilities.cc \
> -o $(TMPDIR)/Utilities.o
95a118,120
> interface/JetCorrectionUncertainty.h \
> interface/SimpleJetCorrectionUncertainty.h \
> interface/JetResolution.h \
100c125
< -c -I$(TMPDIR) \
---
> -c -DSTANDALONE -I$(TMPDIR) \
103a129,131
> interface/JetCorrectionUncertainty.h \
> interface/SimpleJetCorrectionUncertainty.h \
> interface/JetResolution.h \
Index: interface/FactorizedJetCorrector.h
===================================================================
RCS file: /local/reps/CMSSW/CMSSW/CondFormats/JetMETObjects/interface/FactorizedJetCorrector.h,v
retrieving revision 1.11
diff -r1.11 FactorizedJetCorrector.h
19c19
< enum VarTypes {kJetPt,kJetEta,kJetPhi,kJetE,kJetEMF,kRelLepPt,kPtRel,kNPV,kJetA,kRho,kJPTrawE,kJPTrawEt,kJPTrawPt,kJPTrawEta,kJPTrawOff};
---
> enum VarTypes {kJetPt,kJetEta,kJetPhi,kJetE,kJetEMF,kRelLepPt,kPtRel,kNPV,kJetA,kRho,kJPTrawE,kJPTrawEt,kJPTrawPt,kJPTrawEta,kJPTrawOff,kJW};
20a21
>
30c31,33
< void setJetEMF (float fEMF);
---
> void setJetEMF (float fEMF);
> void setJetEtaEtaMoment (float fEtaEta);
> void setJetPhiPhiMoment (float fPhiPhi);
63c66,68
< float mJetEMF;
---
> float mJetEMF;
> float mJetEtaEta;
> float mJetPhiPhi;
80c85,87
< bool mIsJetEMFset;
---
> bool mIsJetEMFset;
> bool mIsJetEtaEtaset;
> bool mIsJetPhiPhiset;
Index: interface/JetCorrectorParameters.h
===================================================================
RCS file: /local/reps/CMSSW/CMSSW/CondFormats/JetMETObjects/interface/JetCorrectorParameters.h,v
retrieving revision 1.17
diff -r1.17 JetCorrectorParameters.h
14c14
< #include "FWCore/Utilities/interface/Exception.h"
---
>
Index: src/FactorizedJetCorrector.cc
===================================================================
RCS file: /local/reps/CMSSW/CMSSW/CondFormats/JetMETObjects/src/FactorizedJetCorrector.cc,v
retrieving revision 1.19
diff -r1.19 FactorizedJetCorrector.cc
9c9,10
< #include "CondFormats/JetMETObjects/src/Utilities.cc"
---
>
>
16a18,20
>
> void handleError(const std::string& fClass, const std::string& fMessage);
>
22,32c26,38
< mJetEta = -9999;
< mJetPt = -9999;
< mJetPhi = -9999;
< mJetE = -9999;
< mJetEMF = -9999;
< mJetA = -9999;
< mRho = -9999;
< mLepPx = -9999;
< mLepPy = -9999;
< mLepPz = -9999;
< mNPV = -9999;
---
> mJetEta = -9999;
> mJetPt = -9999;
> mJetPhi = -9999;
> mJetE = -9999;
> mJetEMF = -9999;
> mJetA = -9999;
> mRho = -9999;
> mJetEtaEta = -9999;
> mJetPhiPhi = -9999;
> mLepPx = -9999;
> mLepPy = -9999;
> mLepPz = -9999;
> mNPV = -9999;
37a44
>
40a48,49
> mIsJetEtaEtaset = false;
> mIsJetPhiPhiset = false;
46a56,57
> mIsJetEtaEtaset = false;
> mIsJetPhiPhiset = false;
65a77,78
> mJetEtaEta = -9999;
> mJetPhiPhi = -9999;
81c94,96
< mIsJetEMFset = false;
---
> mIsJetEMFset = false;
> mIsJetEtaEtaset = false;
> mIsJetPhiPhiset = false;
83a99,100
> mIsJetEtaEtaset = false;
> mIsJetPhiPhiset = false;
103c120,122
< mRho = -9999;
---
> mRho = -9999;
> mJetEtaEta = -9999;
> mJetPhiPhi = -9999;
119c138,140
< mIsJetEMFset = false;
---
> mIsJetEMFset = false;
> mIsJetEtaEtaset = false;
> mIsJetPhiPhiset = false;
121a143,144
> mIsJetEtaEtaset = false;
> mIsJetPhiPhiset = false;
127a151
>
138a163,164
> mLevels.push_back(kL4);
> else if (ss == "L4JW")
168a195
>
179c206,208
< mLevels.push_back(kL4);
---
> mLevels.push_back(kL4);
> else if (tmp[i] == "L4JW")
> mLevels.push_back(kL4);
227a257
>
241c271,273
< result.push_back(kRelLepPt);
---
> result.push_back(kRelLepPt);
> else if (ss=="JetWidth")
> result.push_back(kJW);
417a450
>
448a482,487
> else if (fVarTypes[i] == kJW)
> {
> if (!mIsJetEtaEtaset || !mIsJetPhiPhiset)
> handleError("FactorizedJetCorrector","jet phiphi- or etaetamoments are not set");
> result.push_back(0.5*(mJetEtaEta+mJetPhiPhi));
> }
559a599,611
> //------------------------------------------------------------------------
> void FactorizedJetCorrector::setJetEtaEtaMoment(float fEtaEta)
> {
> mJetEtaEta = fEtaEta;
> mIsJetEtaEtaset = true;
> }
> //------------------------------------------------------------------------
> void FactorizedJetCorrector::setJetPhiPhiMoment(float fPhiPhi)
> {
> mJetPhiPhi = fPhiPhi;
> mIsJetPhiPhiset = true;
> }
> //------------------------------------------------------------------------
Index: src/JetCorrectionUncertainty.cc
===================================================================
RCS file: /local/reps/CMSSW/CMSSW/CondFormats/JetMETObjects/src/JetCorrectionUncertainty.cc,v
retrieving revision 1.4
diff -r1.4 JetCorrectionUncertainty.cc
4d3
< #include "FWCore/Utilities/interface/Exception.h"
10a10
> void handleError(const std::string& fClass, const std::string& fMessage);
118c118
< throw cms::Exception("JetCorrectionUncertainty::")<<" jet eta is not set";
---
> handleError("JetCorrectionUncertainty"," jet eta is not set");
124c124
< throw cms::Exception("JetCorrectionUncertainty::")<<" jet pt is not set";
---
> handleError("JetCorrectionUncertainty"," jet pt is not set");
130c130
< throw cms::Exception("JetCorrectionUncertainty::")<<" jet phi is not set";
---
> handleError("JetCorrectionUncertainty"," jet phi is not set");
136c136
< throw cms::Exception("JetCorrectionUncertainty::")<<" jet energy is not set";
---
> handleError("JetCorrectionUncertainty"," jet energy is not set");
142c142
< throw cms::Exception("JetCorrectionUncertainty::")<<" jet emf is not set";
---
> handleError("JetCorrectionUncertainty::"," jet emf is not set");
148c148
< throw cms::Exception("JetCorrectionUncertainty::")<<" lepton px is not set";
---
> handleError("JetCorrectionUncertainty"," lepton px is not set");
154c154
< throw cms::Exception("JetCorrectionUncertainty::")<<" lepton py is not set";
---
> handleError("JetCorrectionUncertainty"," lepton py is not set");
160c160
< throw cms::Exception("JetCorrectionUncertainty::")<<" lepton pz is not set";
---
> handleError("JetCorrectionUncertainty"," lepton pz is not set");
164c164
< throw cms::Exception("JetCorrectionUncertainty::")<<" unknown parameter "<<fNames[i];
---
> handleError("JetCorrectionUncertainty"," unknown parameter ");
188c188
< throw cms::Exception("JetCorrectionUncertainty")<<" not positive lepton-jet momentum: "<<lj2;
---
> handleError("JetCorrectionUncertainty"," not positive lepton-jet momentum");
Index: src/JetCorrectorParameters.cc
===================================================================
RCS file: /local/reps/CMSSW/CMSSW/CondFormats/JetMETObjects/src/JetCorrectorParameters.cc,v
retrieving revision 1.22
diff -r1.22 JetCorrectorParameters.cc
8d7
< #include "CondFormats/JetMETObjects/src/Utilities.cc"
17a17,23
> void handleError(const std::string& fClass, const std::string& fMessage);
> float getFloat(const std::string& token);
> unsigned getUnsigned(const std::string& token);
> std::string getSection(const std::string& token);
> std::vector<std::string> getTokens(const std::string& fLine);
> std::string getDefinitions(const std::string& token);
> float quadraticInterpolation(float fZ, const float fX[3], const float fY[3]);
464a471
> #ifndef STANDALONE
466a474,477
> #else
> std::cerr << " cannot find key " << static_cast<int>(k) << std::endl;
> throw "InvalidInput";
> #endif
531d541
<
546a557
> #ifndef STANDALONE
547a559,562
> #else
> std::cerr << " Cannot find label " << label << std::endl;
> throw "InvalidInput";
> #endif
555,558c570,575
< #include "FWCore/Utilities/interface/typelookup.h"
<
< TYPELOOKUP_DATA_REG(JetCorrectorParameters);
< TYPELOOKUP_DATA_REG(JetCorrectorParametersCollection);
---
> #ifndef STANDALONE
> #include "FWCore/Utilities/interface/typelookup.h"
> TYPELOOKUP_DATA_REG(JetCorrectorParameters);
> TYPELOOKUP_DATA_REG(JetCorrectorParametersCollection);
> #endif
>
Index: src/SimpleJetCorrectionUncertainty.cc
===================================================================
RCS file: /local/reps/CMSSW/CMSSW/CondFormats/JetMETObjects/src/SimpleJetCorrectionUncertainty.cc,v
retrieving revision 1.2
diff -r1.2 SimpleJetCorrectionUncertainty.cc
3d2
< #include "FWCore/Utilities/interface/Exception.h"
6a6
> void handleError(const std::string& fClass, const std::string& fMessage);
33c33
< throw cms::Exception("SimpleJetCorrectionUncertainty")<<" bin variables out of range";
---
> handleError("SimpleJetCorrectionUncertainty"," bin variables out of range");
41c41
< throw cms::Exception("SimpleJetCorrectionUncertainty")<<" wrong bin: "<<fBin<<": only "<<mParameters->size()<<" are available";
---
> handleError("SimpleJetCorrectionUncertainty"," wrong bin, only are available");
44c44
< throw cms::Exception ("SimpleJetCorrectionUncertainty")<<"wrong # of parameters: multiple of 3 expected, "<<p.size()<< " got";
---
> handleError("SimpleJetCorrectionUncertainty","wrong # of parameters: multiple of 3 expected");
85c85
< throw cms::Exception("SimpleJetCorrectionUncertainty")<<" interpolation error";
---
> handleError("SimpleJetCorrectionUncertainty"," interpolation error");
Index: src/SimpleJetCorrector.cc
===================================================================
RCS file: /local/reps/CMSSW/CMSSW/CondFormats/JetMETObjects/src/SimpleJetCorrector.cc,v
retrieving revision 1.8
diff -r1.8 SimpleJetCorrector.cc
3d2
< #include "CondFormats/JetMETObjects/src/Utilities.cc"
7a7,14
> void handleError(const std::string& fClass, const std::string& fMessage);
> float getFloat(const std::string& token);
> unsigned getUnsigned(const std::string& token);
> std::string getSection(const std::string& token);
> std::vector<std::string> getTokens(const std::string& fLine);
> std::string getDefinitions(const std::string& token);
> float quadraticInterpolation(float fZ, const float fX[3], const float fY[3]);
>
Index: src/Utilities.cc
===================================================================
RCS file: /local/reps/CMSSW/CMSSW/CondFormats/JetMETObjects/src/Utilities.cc,v
retrieving revision 1.3
diff -r1.3 Utilities.cc
1,3d0
< #ifndef UTIL_H
< #define UTIL_H
<
10d6
<
17c13,84
< namespace
---
> void handleError(const std::string& fClass, const std::string& fMessage);
>
>
> //----------------------------------------------------------------------
> float getFloat(const std::string& token)
> {
> char* endptr;
> float result = strtod (token.c_str(), &endptr);
> if (endptr == token.c_str())
> {
> std::stringstream sserr;
> sserr<<"can't convert token "<<token<<" to float value";
> handleError("getFloat",sserr.str());
> }
> return result;
> }
> //----------------------------------------------------------------------
> unsigned getUnsigned(const std::string& token)
> {
> char* endptr;
> unsigned result = strtoul (token.c_str(), &endptr, 0);
> if (endptr == token.c_str())
> {
> std::stringstream sserr;
> sserr<<"can't convert token "<<token<<" to unsigned value";
> handleError("getUnsigned",sserr.str());
> }
> return result;
> }
> //----------------------------------------------------------------------
> std::string getSection(const std::string& token)
> {
> size_t iFirst = token.find ('[');
> size_t iLast = token.find (']');
> if (iFirst != std::string::npos && iLast != std::string::npos && iFirst < iLast)
> return std::string (token, iFirst+1, iLast-iFirst-1);
> return "";
> }
> //----------------------------------------------------------------------
> std::vector<std::string> getTokens(const std::string& fLine)
> {
> std::vector<std::string> tokens;
> std::string currentToken;
> for (unsigned ipos = 0; ipos < fLine.length (); ++ipos)
> {
> char c = fLine[ipos];
> if (c == '#') break; // ignore comments
> else if (c == ' ')
> { // flush current token if any
> if (!currentToken.empty())
> {
> tokens.push_back(currentToken);
> currentToken.clear();
> }
> }
> else
> currentToken += c;
> }
> if (!currentToken.empty()) tokens.push_back(currentToken); // flush end
> return tokens;
> }
> //----------------------------------------------------------------------
> std::string getDefinitions(const std::string& token)
> {
> size_t iFirst = token.find ('{');
> size_t iLast = token.find ('}');
> if (iFirst != std::string::npos && iLast != std::string::npos && iFirst < iLast)
> return std::string (token, iFirst+1, iLast-iFirst-1);
> return "";
> }
> //------------------------------------------------------------------------
> void handleError(const std::string& fClass, const std::string& fMessage)
19,89d85
< void handleError(const std::string& fClass, const std::string& fMessage);
< //----------------------------------------------------------------------
< float getFloat(const std::string& token)
< {
< char* endptr;
< float result = strtod (token.c_str(), &endptr);
< if (endptr == token.c_str())
< {
< std::stringstream sserr;
< sserr<<"can't convert token "<<token<<" to float value";
< handleError("getFloat",sserr.str());
< }
< return result;
< }
< //----------------------------------------------------------------------
< unsigned getUnsigned(const std::string& token)
< {
< char* endptr;
< unsigned result = strtoul (token.c_str(), &endptr, 0);
< if (endptr == token.c_str())
< {
< std::stringstream sserr;
< sserr<<"can't convert token "<<token<<" to unsigned value";
< handleError("getUnsigned",sserr.str());
< }
< return result;
< }
< //----------------------------------------------------------------------
< std::string getSection(const std::string& token)
< {
< size_t iFirst = token.find ('[');
< size_t iLast = token.find (']');
< if (iFirst != std::string::npos && iLast != std::string::npos && iFirst < iLast)
< return std::string (token, iFirst+1, iLast-iFirst-1);
< return "";
< }
< //----------------------------------------------------------------------
< std::vector<std::string> getTokens(const std::string& fLine)
< {
< std::vector<std::string> tokens;
< std::string currentToken;
< for (unsigned ipos = 0; ipos < fLine.length (); ++ipos)
< {
< char c = fLine[ipos];
< if (c == '#') break; // ignore comments
< else if (c == ' ')
< { // flush current token if any
< if (!currentToken.empty())
< {
< tokens.push_back(currentToken);
< currentToken.clear();
< }
< }
< else
< currentToken += c;
< }
< if (!currentToken.empty()) tokens.push_back(currentToken); // flush end
< return tokens;
< }
< //----------------------------------------------------------------------
< std::string getDefinitions(const std::string& token)
< {
< size_t iFirst = token.find ('{');
< size_t iLast = token.find ('}');
< if (iFirst != std::string::npos && iLast != std::string::npos && iFirst < iLast)
< return std::string (token, iFirst+1, iLast-iFirst-1);
< return "";
< }
< //------------------------------------------------------------------------
< void handleError(const std::string& fClass, const std::string& fMessage)
< {
91,93c87,89
< std::stringstream sserr;
< sserr<<fClass<<" ERROR: "<<fMessage;
< throw std::runtime_error(sserr.str());
---
> std::stringstream sserr;
> sserr<<fClass<<" ERROR: "<<fMessage;
> throw std::runtime_error(sserr.str());
95c91
< throw cms::Exception(fClass)<<fMessage;
---
> throw cms::Exception(fClass)<<fMessage;
97,122d92
< }
< //------------------------------------------------------------------------
< float quadraticInterpolation(float fZ, const float fX[3], const float fY[3])
< {
< // Quadratic interpolation through the points (x[i],y[i]). First find the parabola that
< // is defined by the points and then calculate the y(z).
< float D[4],a[3];
< D[0] = fX[0]*fX[1]*(fX[0]-fX[1])+fX[1]*fX[2]*(fX[1]-fX[2])+fX[2]*fX[0]*(fX[2]-fX[0]);
< D[3] = fY[0]*(fX[1]-fX[2])+fY[1]*(fX[2]-fX[0])+fY[2]*(fX[0]-fX[1]);
< D[2] = fY[0]*(pow(fX[2],2)-pow(fX[1],2))+fY[1]*(pow(fX[0],2)-pow(fX[2],2))+fY[2]*(pow(fX[1],2)-pow(fX[0],2));
< D[1] = fY[0]*fX[1]*fX[2]*(fX[1]-fX[2])+fY[1]*fX[0]*fX[2]*(fX[2]-fX[0])+fY[2]*fX[0]*fX[1]*(fX[0]-fX[1]);
< if (D[0] != 0)
< {
< a[0] = D[1]/D[0];
< a[1] = D[2]/D[0];
< a[2] = D[3]/D[0];
< }
< else
< {
< a[0] = 0.0;
< a[1] = 0.0;
< a[2] = 0.0;
< }
< float r = a[0]+fZ*(a[1]+fZ*a[2]);
< return r;
< }
124c94,118
< #endif
---
> //------------------------------------------------------------------------
> float quadraticInterpolation(float fZ, const float fX[3], const float fY[3])
> {
> // Quadratic interpolation through the points (x[i],y[i]). First find the parabola that
> // is defined by the points and then calculate the y(z).
> float D[4],a[3];
> D[0] = fX[0]*fX[1]*(fX[0]-fX[1])+fX[1]*fX[2]*(fX[1]-fX[2])+fX[2]*fX[0]*(fX[2]-fX[0]);
> D[3] = fY[0]*(fX[1]-fX[2])+fY[1]*(fX[2]-fX[0])+fY[2]*(fX[0]-fX[1]);
> D[2] = fY[0]*(pow(fX[2],2)-pow(fX[1],2))+fY[1]*(pow(fX[0],2)-pow(fX[2],2))+fY[2]*(pow(fX[1],2)-pow(fX[0],2));
> D[1] = fY[0]*fX[1]*fX[2]*(fX[1]-fX[2])+fY[1]*fX[0]*fX[2]*(fX[2]-fX[0])+fY[2]*fX[0]*fX[1]*(fX[0]-fX[1]);
> if (D[0] != 0)
> {
> a[0] = D[1]/D[0];
> a[1] = D[2]/D[0];
> a[2] = D[3]/D[0];
> }
> else
> {
> a[0] = 0.0;
> a[1] = 0.0;
> a[2] = 0.0;
> }
> float r = a[0]+fZ*(a[1]+fZ*a[2]);
> return r;
> }