-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMyAnalyzer_bTaggingOptimization_DijetBBTag_2011.cc
More file actions
736 lines (630 loc) · 34.3 KB
/
MyAnalyzer_bTaggingOptimization_DijetBBTag_2011.cc
File metadata and controls
736 lines (630 loc) · 34.3 KB
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
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
// -*- C++ -*-
//
// Package: MyAnalyzer
// Class: MyAnalyzer
//
/**\class MyAnalyzer MyAnalyzer.cc MyAnalysis/MyAnalyzer/src/MyAnalyzer.cc
Description: [one line class summary]
Implementation:
[Notes on implementation]
*/
//
// Original Author: Dinko Ferencek
// Created: Mon Sep 12 15:06:41 CDT 2011
// $Id: MyAnalyzer_bTaggingOptimization_DijetBBTag_2011.cc,v 1.1 2012/02/23 20:38:10 ferencek Exp $
//
//
// system include files
#include <memory>
// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDFilter.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/LuminosityBlock.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "DataFormats/Common/interface/MergeableCounter.h"
// BaseClass
#include "MyAnalysis/MyAnalyzer/interface/BaseClass.h"
// TFileService
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "CommonTools/UtilAlgos/interface/TFileService.h"
// ROOT
#include <TLorentzVector.h>
using namespace std;
//
// class declaration
//
class MyAnalyzer : public BaseClass, public edm::EDFilter {
public:
explicit MyAnalyzer(const edm::ParameterSet&);
~MyAnalyzer();
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
private:
virtual void beginJob() ;
virtual bool filter(edm::Event&, const edm::EventSetup&);
virtual void endJob() ;
virtual bool beginRun(edm::Run&, edm::EventSetup const&);
virtual bool endRun(edm::Run&, edm::EventSetup const&);
virtual bool beginLuminosityBlock(edm::LuminosityBlock&, edm::EventSetup const&);
virtual bool endLuminosityBlock(edm::LuminosityBlock&, edm::EventSetup const&);
// ----------member data ---------------------------
};
//
// constructors and destructor
//
MyAnalyzer::MyAnalyzer(const edm::ParameterSet& iConfig) :
BaseClass(iConfig)
{
//now do whatever initialization is needed
}
MyAnalyzer::~MyAnalyzer()
{
// do anything here that needs to be done at desctruction time
// (e.g. close files, deallocate resources etc.)
}
//
// constants, enums and typedefs
//
//
// static data member definitions
//
//
// member functions
//
// ------------ method called once each job just before starting event loop ------------
void
MyAnalyzer::beginJob()
{
//#####################################################################################
//########################### User's code starts here #################################/
// book your histograms here
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass0to500GeV_eff_denom", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass0to500GeV_eff_num", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass0to500GeV_miseff_denom", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass0to500GeV_miseff_num", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass500to1000GeV_eff_denom", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass500to1000GeV_eff_num", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass500to1000GeV_miseff_denom", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass500to1000GeV_miseff_num", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass1000to1500GeV_eff_denom", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass1000to1500GeV_eff_num", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass1000to1500GeV_miseff_denom", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass1000to1500GeV_miseff_num", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass1500to2000GeV_eff_denom", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass1500to2000GeV_eff_num", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass1500to2000GeV_miseff_denom", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass1500to2000GeV_miseff_num", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass2000to2500GeV_eff_denom", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass2000to2500GeV_eff_num", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass2000to2500GeV_miseff_denom", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass2000to2500GeV_miseff_num", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass2500to3000GeV_eff_denom", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass2500to3000GeV_eff_num", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass2500to3000GeV_miseff_denom", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass2500to3000GeV_miseff_num", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass3000to3500GeV_eff_denom", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass3000to3500GeV_eff_num", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass3000to3500GeV_miseff_denom", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass3000to3500GeV_miseff_num", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass3500to4000GeV_eff_denom", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass3500to4000GeV_eff_num", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass3500to4000GeV_miseff_denom", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass3500to4000GeV_miseff_num", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass4000to1000000GeV_eff_denom", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass4000to1000000GeV_eff_num", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass4000to1000000GeV_miseff_denom", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass4000to1000000GeV_miseff_num", 9, 0.5, 9.5, 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass0to500GeV_eff_denom", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass0to500GeV_eff_num", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass0to500GeV_miseff_denom", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass0to500GeV_miseff_num", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass500to1000GeV_eff_denom", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass500to1000GeV_eff_num", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass500to1000GeV_miseff_denom", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass500to1000GeV_miseff_num", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass1000to1500GeV_eff_denom", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass1000to1500GeV_eff_num", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass1000to1500GeV_miseff_denom", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass1000to1500GeV_miseff_num", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass1500to2000GeV_eff_denom", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass1500to2000GeV_eff_num", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass1500to2000GeV_miseff_denom", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass1500to2000GeV_miseff_num", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass2000to2500GeV_eff_denom", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass2000to2500GeV_eff_num", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass2000to2500GeV_miseff_denom", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass2000to2500GeV_miseff_num", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass2500to3000GeV_eff_denom", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass2500to3000GeV_eff_num", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass2500to3000GeV_miseff_denom", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass2500to3000GeV_miseff_num", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass3000to3500GeV_eff_denom", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass3000to3500GeV_eff_num", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass3000to3500GeV_miseff_denom", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass3000to3500GeV_miseff_num", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass3500to4000GeV_eff_denom", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass3500to4000GeV_eff_num", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass3500to4000GeV_miseff_denom", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass3500to4000GeV_miseff_num", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass4000to1000000GeV_eff_denom", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass4000to1000000GeV_eff_num", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass4000to1000000GeV_miseff_denom", 9, 0.5, 9.5);
CreateUserTH1D("h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass4000to1000000GeV_miseff_num", 9, 0.5, 9.5);
// initialize your variables here
//############################# User's code ends here #################################
//#####################################################################################
}
// ------------ method called when starting to processes a run ------------
bool
MyAnalyzer::beginRun(edm::Run& iRun, const edm::EventSetup& iSetup)
{
return true;
}
// ------------ method called when starting to processes a luminosity block ------------
bool
MyAnalyzer::beginLuminosityBlock(edm::LuminosityBlock&, edm::EventSetup const&)
{
return true;
}
// ------------ method called on each new Event ------------
bool
MyAnalyzer::filter(edm::Event& iEvent, const edm::EventSetup& iSetup)
{
bool ret = false;
// event weight (by default set to 1)
double eventWeight = 1;
//#####################################################################################
//########################### User's code starts here #################################
// int btagger = int(getPreCutValue1("btagger"));
int matchingType = int(getPreCutValue1("matchingType"));
double matchingRadius = getPreCutValue1("matchingRadius");
int doInclusiveTagging = int(getPreCutValue1("doInclusiveTagging"));
// grab necessary objects from the event
edm::Handle<vector<double> > GenParticlePt;
iEvent.getByLabel(edm::InputTag("GenParticles:Pt"), GenParticlePt);
edm::Handle<vector<double> > GenParticleEta;
iEvent.getByLabel(edm::InputTag("GenParticles:Eta"), GenParticleEta);
edm::Handle<vector<double> > GenParticlePhi;
iEvent.getByLabel(edm::InputTag("GenParticles:Phi"), GenParticlePhi);
edm::Handle<vector<double> > GenParticleE;
iEvent.getByLabel(edm::InputTag("GenParticles:Energy"), GenParticleE);
edm::Handle<vector<int> > GenParticlePdgId;
iEvent.getByLabel(edm::InputTag("GenParticles:PdgId"), GenParticlePdgId);
edm::Handle<vector<int> > GenParticleStatus;
iEvent.getByLabel(edm::InputTag("GenParticles:Status"), GenParticleStatus);
edm::Handle<vector<int> > GenParticleMotherIndex;
iEvent.getByLabel(edm::InputTag("GenParticles:MotherIndex"), GenParticleMotherIndex);
edm::Handle<vector<double> > PFJetPt_;
iEvent.getByLabel(edm::InputTag("AK7PFJets:Pt"), PFJetPt_);
edm::Handle<vector<double> > PFJetPtRaw;
iEvent.getByLabel(edm::InputTag("AK7PFJets:PtRaw"), PFJetPtRaw);
edm::Handle<vector<double> > PFJetEta;
iEvent.getByLabel(edm::InputTag("AK7PFJets:Eta"), PFJetEta);
edm::Handle<vector<double> > PFJetPhi;
iEvent.getByLabel(edm::InputTag("AK7PFJets:Phi"), PFJetPhi);
edm::Handle<vector<double> > PFJetE_;
iEvent.getByLabel(edm::InputTag("AK7PFJets:Energy"), PFJetE_);
edm::Handle<vector<double> > PFJetUnc;
iEvent.getByLabel(edm::InputTag("AK7PFJets:JECUnc"), PFJetUnc);
edm::Handle<vector<int> > PFJetPassJetID;
iEvent.getByLabel(edm::InputTag("AK7PFJets:PassTightID"), PFJetPassJetID);
edm::Handle<vector<double> > PFJetSSVHE;
iEvent.getByLabel(edm::InputTag("AK7PFJets:SimpleSecondaryVertexHighEffBTag"), PFJetSSVHE);
edm::Handle<vector<double> > PFJetSSVHP;
iEvent.getByLabel(edm::InputTag("AK7PFJets:SimpleSecondaryVertexHighPurBTag"), PFJetSSVHP);
edm::Handle<vector<double> > PFJetTCHE;
iEvent.getByLabel(edm::InputTag("AK7PFJets:TrackCountingHighEffBTag"), PFJetTCHE);
edm::Handle<vector<double> > PFJetTCHP;
iEvent.getByLabel(edm::InputTag("AK7PFJets:TrackCountingHighPurBTag"), PFJetTCHP);
edm::Handle<vector<int> > PFJetPartonFlavor;
iEvent.getByLabel(edm::InputTag("AK7PFJets:PartonFlavor"), PFJetPartonFlavor);
auto_ptr<std::vector<double> > PFJetPt ( new std::vector<double>() );
auto_ptr<std::vector<double> > PFJetE ( new std::vector<double>() );
for(size_t i=0; i<PFJetPt_->size(); i++)
{
double JES_ScaleFactor = 1.;
if( !iEvent.isRealData() ) JES_ScaleFactor = 1. + getPreCutValue1("JES_Shift")*PFJetUnc->at(i);
PFJetPt->push_back( PFJetPt_->at(i)*JES_ScaleFactor );
PFJetE ->push_back( PFJetE_ ->at(i)*JES_ScaleFactor );
}
// int nBTaggedJets = 0;
int nHeavyFlavorJets = 0;
// int nBTaggedHeavyFlavorJets = 0;
// Set the evaluation of the cuts to false and clear the variable values and filled status
resetCuts();
int nSt3_b = 0, nSt3_b_fromRSG = 0;
for(size_t i=0; i<GenParticlePt->size(); i++)
{
if( abs(GenParticlePdgId->at(i))==5 && GenParticleStatus->at(i)==3 && GenParticleMotherIndex->at(i)>=0 )
{
++nSt3_b;
if( abs(GenParticlePdgId->at(GenParticleMotherIndex->at(i)))==5000039 ) ++nSt3_b_fromRSG;
}
}
fillVariableWithValue( "nSt3_b", nSt3_b );
fillVariableWithValue( "nSt3_b_fromRSG", nSt3_b_fromRSG );
fillVariableWithValue( "nJets", PFJetPt->size() );
if( PFJetPt->size() >= 1 )
{
fillVariableWithValue( "passJetIdJ1", ( PFJetPassJetID->at(0) ? 1 : 0 ) );
fillVariableWithValue( "absEtaJ1", fabs( PFJetEta->at(0) ));
}
if( PFJetPt->size() >= 2 )
{
fillVariableWithValue( "passJetIdJ2", ( PFJetPassJetID->at(1) ? 1 : 0 ) );
fillVariableWithValue( "absEtaJ2", fabs( PFJetEta->at(1) ) );
TLorentzVector v_j1j2, v_j1, v_j2;
v_j1.SetPtEtaPhiE(PFJetPt->at(0),PFJetEta->at(0),PFJetPhi->at(0),PFJetE->at(0));
v_j2.SetPtEtaPhiE(PFJetPt->at(1),PFJetEta->at(1),PFJetPhi->at(1),PFJetE->at(1));
// calculate |DeltaEta(j1,j2)|
fillVariableWithValue( "absDeltaEtaJ1J2", fabs( PFJetEta->at(0) - PFJetEta->at(1) ) );
// calculate M_j1j2
v_j1j2 = v_j1 + v_j2;
fillVariableWithValue( "DijetMass", v_j1j2.M() );
// jet and GenParticle 4-vectors
TLorentzVector v_j, v_gp;
// loop over two leading jets
for(size_t i=0; i<2; ++i)
{
bool isHeavyFlavor = false;
// set jet 4-vector
v_j.SetPtEtaPhiE(PFJetPt->at(i),PFJetEta->at(i),PFJetPhi->at(i),PFJetE->at(i));
if( !iEvent.isRealData() )
{
if( matchingType==0 && abs(PFJetPartonFlavor->at(i))==5 )
{
++nHeavyFlavorJets;
isHeavyFlavor = true;
}
else if( matchingType!=0 )
{
double minDeltaR = 999.;
// loop over GenParticles
for(size_t j=0; j<GenParticlePt->size(); ++j)
{
int pdgID = abs(GenParticlePdgId->at(j));
if( pdgID==511 || pdgID==521 || pdgID==531 || pdgID==541 || pdgID==5122 || pdgID==5132 || pdgID==5232 || pdgID==5332
|| pdgID==411 || pdgID==421 || pdgID==431 || pdgID==4122 || pdgID==4132 || pdgID==4232 || pdgID==4332 )
{
// set GenParticle 4-vector
v_gp.SetPtEtaPhiE(GenParticlePt->at(j),GenParticleEta->at(j),GenParticlePhi->at(j),GenParticleE->at(j));
double deltaR = v_j.DeltaR(v_gp);
if( deltaR < minDeltaR ) minDeltaR = deltaR;
}
}
if( minDeltaR < matchingRadius )
{
++nHeavyFlavorJets;
isHeavyFlavor = true;
}
}
}
// if( (btagger==0 && PFJetTCHE->at(i)>getPreCutValue1("TCHEM_WP")) ||
// (btagger==1 && PFJetSSVHE->at(i)>getPreCutValue1("SSVHEM_WP")) ||
// (btagger==2 && PFJetTCHP->at(i)>getPreCutValue1("TCHPT_WP")) ||
// (btagger==3 && PFJetSSVHP->at(i)>getPreCutValue1("SSVHPT_WP")) )
// {
// ++nBTaggedJets;
// if( isHeavyFlavor ) ++nBTaggedHeavyFlavorJets;
// }
}
}
// Evaluate cuts (but do not apply them)
evaluateCuts();
for (int min=0; min<=4000; min+=500){
int max = min+500;
//int s = 0;
//if(max==4500){max="Inf";s=1;} //max is an int...
if(max==4500){max=1000000;}
std::stringstream junk;
junk << "h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass" << min << "to" << max << "GeV_miseff_num";
string nummiseff = junk.str();
junk.str("");
junk << "h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass" << min << "to" << max << "GeV_eff_num";
string numeff = junk.str();
junk.str("");
junk << "h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass" << min << "to" << max << "GeV_miseff_denom";
string denommiseff = junk.str();
junk.str("");
junk << "h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass" << min << "to" << max << "GeV_eff_denom";
string denomeff = junk.str();
junk.str("");
junk << "h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass" << min << "to" << max << "GeV_miseff_num";
string nummiseff1 = junk.str();
junk.str("");
junk << "h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass" << min << "to" << max << "GeV_eff_num";
string numeff1 = junk.str();
junk.str("");
junk << "h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass" << min << "to" << max << "GeV_miseff_denom";
string denommiseff1 = junk.str();
junk.str("");
junk << "h1_TCHE_TCHP_SSVHE_SSVHP_DijetMass" << min << "to" << max << "GeV_eff_denom";
string denomeff1 = junk.str();
junk.str("");
string titlenum[]={ nummiseff, "", numeff };
string titledenom[]={ denommiseff, "", denomeff };
string titlenum1[]={ nummiseff1, "", numeff1 };
string titledenom1[]={ denommiseff1, "", denomeff1 };
for (int n=0; n<=2; n+=2){
if(passedAllPreviousCuts("DijetMass") && getVariableValue("DijetMass")>min && getVariableValue("DijetMass")<max && ( doInclusiveTagging ? true : nHeavyFlavorJets==n ))
{
for (int j=1; j<=9; j++){
for (int i=1; i<=j; i++){
FillUserTH2D(titledenom[n], j, i);
}
}
// FillUserTH2D("h2_TCHE_TCHP_SSVHE_SSVHP_DijetMass1to1p5TeV_denom", 1, 1); // (Original broad fill left as example to me.)
//FILL COL 1 OF NUM
if( PFJetTCHE->at(0)>getPreCutValue1("TCHEL_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEL_WP") ){
FillUserTH2D(titlenum[n], 1, 1);
}
//FILL COL 2 OF NUM (BOTTOM UP)
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHEL_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEM_WP") ) ||
( PFJetTCHE->at(0)>getPreCutValue1("TCHEM_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEL_WP") ) ){
FillUserTH2D(titlenum[n], 2, 1);
}
if( PFJetTCHE->at(0)>getPreCutValue1("TCHEM_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEM_WP") ){
FillUserTH2D(titlenum[n], 2, 2);
}
//FILL COL 3 OF NUM (BOTTOM UP)
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHEL_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHET_WP") ) ||
( PFJetTCHE->at(0)>getPreCutValue1("TCHET_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEL_WP") ) ){
FillUserTH2D(titlenum[n], 3, 1);
}
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHEM_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHET_WP") ) ||
( PFJetTCHE->at(0)>getPreCutValue1("TCHET_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEM_WP") ) ){
FillUserTH2D(titlenum[n], 3, 2);
}
if( PFJetTCHE->at(0)>getPreCutValue1("TCHET_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHET_WP") ){
FillUserTH2D(titlenum[n], 3, 3);
}
//FILL COL 4 OF NUM (BOTTOM UP)
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHEL_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPL_WP") ) ||
( PFJetTCHP->at(0)>getPreCutValue1("TCHPL_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEL_WP") ) ){
FillUserTH2D(titlenum[n], 4, 1);
}
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHEM_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPL_WP") ) ||
( PFJetTCHP->at(0)>getPreCutValue1("TCHPL_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEM_WP") ) ){
FillUserTH2D(titlenum[n], 4, 2);
}
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHET_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPL_WP") ) ||
( PFJetTCHP->at(0)>getPreCutValue1("TCHPL_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHET_WP") ) ){
FillUserTH2D(titlenum[n], 4, 3);
}
if( PFJetTCHP->at(0)>getPreCutValue1("TCHPL_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPL_WP") ){
FillUserTH2D(titlenum[n], 4, 4);
}
//FILL COL 5 OF NUM (BOTTOM UP)
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHEL_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPM_WP") ) ||
( PFJetTCHP->at(0)>getPreCutValue1("TCHPM_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEL_WP") ) ){
FillUserTH2D(titlenum[n], 5, 1);
}
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHEM_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPM_WP") ) ||
( PFJetTCHP->at(0)>getPreCutValue1("TCHPM_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEM_WP") ) ){
FillUserTH2D(titlenum[n], 5, 2);
}
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHET_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPM_WP") ) ||
( PFJetTCHP->at(0)>getPreCutValue1("TCHPM_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHET_WP") ) ){
FillUserTH2D(titlenum[n], 5, 3);
}
if( ( PFJetTCHP->at(0)>getPreCutValue1("TCHPL_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPM_WP") ) ||
( PFJetTCHP->at(0)>getPreCutValue1("TCHPM_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPL_WP") ) ){
FillUserTH2D(titlenum[n], 5, 4);
}
if( PFJetTCHP->at(0)>getPreCutValue1("TCHPM_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPM_WP") ){
FillUserTH2D(titlenum[n], 5, 5);
}
//FILL COL 6 OF NUM (BOTTOM UP)
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHEL_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPT_WP") ) ||
( PFJetTCHP->at(0)>getPreCutValue1("TCHPT_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEL_WP") ) ){
FillUserTH2D(titlenum[n], 6, 1);
}
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHEM_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPT_WP") ) ||
( PFJetTCHP->at(0)>getPreCutValue1("TCHPT_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEM_WP") ) ){
FillUserTH2D(titlenum[n], 6, 2);
}
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHET_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPT_WP") ) ||
( PFJetTCHP->at(0)>getPreCutValue1("TCHPT_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHET_WP") ) ){
FillUserTH2D(titlenum[n], 6, 3);
}
if( ( PFJetTCHP->at(0)>getPreCutValue1("TCHPL_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPT_WP") ) ||
( PFJetTCHP->at(0)>getPreCutValue1("TCHPT_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPL_WP") ) ){
FillUserTH2D(titlenum[n], 6, 4);
}
if( ( PFJetTCHP->at(0)>getPreCutValue1("TCHPM_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPT_WP") ) ||
( PFJetTCHP->at(0)>getPreCutValue1("TCHPT_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPM_WP") ) ){
FillUserTH2D(titlenum[n], 6, 5);
}
if( PFJetTCHP->at(0)>getPreCutValue1("TCHPT_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPT_WP") ){
FillUserTH2D(titlenum[n], 6, 6);
}
//FILL COL 7 OF NUM (BOTTOM UP)
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHEL_WP") && PFJetSSVHE->at(1)>getPreCutValue1("SSVHEM_WP") ) ||
( PFJetSSVHE->at(0)>getPreCutValue1("SSVHEM_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEL_WP") ) ){
FillUserTH2D(titlenum[n], 7, 1);
}
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHEM_WP") && PFJetSSVHE->at(1)>getPreCutValue1("SSVHEM_WP") ) ||
( PFJetSSVHE->at(0)>getPreCutValue1("SSVHEM_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEM_WP") ) ){
FillUserTH2D(titlenum[n], 7, 2);
}
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHET_WP") && PFJetSSVHE->at(1)>getPreCutValue1("SSVHEM_WP") ) ||
( PFJetSSVHE->at(0)>getPreCutValue1("SSVHEM_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHET_WP") ) ){
FillUserTH2D(titlenum[n], 7, 3);
}
if( ( PFJetTCHP->at(0)>getPreCutValue1("TCHPL_WP") && PFJetSSVHE->at(1)>getPreCutValue1("SSVHEM_WP") ) ||
( PFJetSSVHE->at(0)>getPreCutValue1("SSVHEM_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPL_WP") ) ){
FillUserTH2D(titlenum[n], 7, 4);
}
if( ( PFJetTCHP->at(0)>getPreCutValue1("TCHPM_WP") && PFJetSSVHE->at(1)>getPreCutValue1("SSVHEM_WP") ) ||
( PFJetSSVHE->at(0)>getPreCutValue1("SSVHEM_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPM_WP") ) ){
FillUserTH2D(titlenum[n], 7, 5);
}
if( ( PFJetTCHP->at(0)>getPreCutValue1("TCHPT_WP") && PFJetSSVHE->at(1)>getPreCutValue1("SSVHEM_WP") ) ||
( PFJetSSVHE->at(0)>getPreCutValue1("SSVHEM_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPT_WP") ) ){
FillUserTH2D(titlenum[n], 7, 6);
}
if( PFJetSSVHE->at(0)>getPreCutValue1("SSVHEM_WP") && PFJetSSVHE->at(1)>getPreCutValue1("SSVHEM_WP") ){
FillUserTH2D(titlenum[n], 7, 7);
}
//FILL COL 8 OF NUM (BOTTOM UP)
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHEL_WP") && PFJetSSVHE->at(1)>getPreCutValue1("SSVHET_WP") ) ||
( PFJetSSVHE->at(0)>getPreCutValue1("SSVHET_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEL_WP") ) ){
FillUserTH2D(titlenum[n], 8, 1);
}
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHEM_WP") && PFJetSSVHE->at(1)>getPreCutValue1("SSVHET_WP") ) ||
( PFJetSSVHE->at(0)>getPreCutValue1("SSVHET_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEM_WP") ) ){
FillUserTH2D(titlenum[n], 8, 2);
}
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHET_WP") && PFJetSSVHE->at(1)>getPreCutValue1("SSVHET_WP") ) ||
( PFJetSSVHE->at(0)>getPreCutValue1("SSVHET_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHET_WP") ) ){
FillUserTH2D(titlenum[n], 8, 3);
}
if( ( PFJetTCHP->at(0)>getPreCutValue1("TCHPL_WP") && PFJetSSVHE->at(1)>getPreCutValue1("SSVHET_WP") ) ||
( PFJetSSVHE->at(0)>getPreCutValue1("SSVHET_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPL_WP") ) ){
FillUserTH2D(titlenum[n], 8, 4);
}
if( ( PFJetTCHP->at(0)>getPreCutValue1("TCHPM_WP") && PFJetSSVHE->at(1)>getPreCutValue1("SSVHET_WP") ) ||
( PFJetSSVHE->at(0)>getPreCutValue1("SSVHET_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPM_WP") ) ){
FillUserTH2D(titlenum[n], 8, 5);
}
if( ( PFJetTCHP->at(0)>getPreCutValue1("TCHPT_WP") && PFJetSSVHE->at(1)>getPreCutValue1("SSVHET_WP") ) ||
( PFJetSSVHE->at(0)>getPreCutValue1("SSVHET_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPT_WP") ) ){
FillUserTH2D(titlenum[n], 8, 6);
}
if( ( PFJetSSVHE->at(0)>getPreCutValue1("SSVHEM_WP") && PFJetSSVHE->at(1)>getPreCutValue1("SSVHET_WP") ) ||
( PFJetSSVHE->at(0)>getPreCutValue1("SSVHET_WP") && PFJetSSVHE->at(1)>getPreCutValue1("SSVHEM_WP") ) ){
FillUserTH2D(titlenum[n], 8, 7);
}
if( PFJetSSVHE->at(0)>getPreCutValue1("SSVHET_WP") && PFJetSSVHE->at(1)>getPreCutValue1("SSVHET_WP") ){
FillUserTH2D(titlenum[n], 8, 8);
}
//FILL COL 9 OF NUM (BOTTOM UP)
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHEL_WP") && PFJetSSVHP->at(1)>getPreCutValue1("SSVHPT_WP") ) ||
( PFJetSSVHP->at(0)>getPreCutValue1("SSVHPT_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEL_WP") ) ){
FillUserTH2D(titlenum[n], 9, 1);
}
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHEM_WP") && PFJetSSVHP->at(1)>getPreCutValue1("SSVHPT_WP") ) ||
( PFJetSSVHP->at(0)>getPreCutValue1("SSVHPT_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEM_WP") ) ){
FillUserTH2D(titlenum[n], 9, 2);
}
if( ( PFJetTCHE->at(0)>getPreCutValue1("TCHET_WP") && PFJetSSVHP->at(1)>getPreCutValue1("SSVHPT_WP") ) ||
( PFJetSSVHP->at(0)>getPreCutValue1("SSVHPT_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHET_WP") ) ){
FillUserTH2D(titlenum[n], 9, 3);
}
if( ( PFJetTCHP->at(0)>getPreCutValue1("TCHPL_WP") && PFJetSSVHP->at(1)>getPreCutValue1("SSVHPT_WP") ) ||
( PFJetSSVHP->at(0)>getPreCutValue1("SSVHPT_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPL_WP") ) ){
FillUserTH2D(titlenum[n], 9, 4);
}
if( ( PFJetTCHP->at(0)>getPreCutValue1("TCHPM_WP") && PFJetSSVHP->at(1)>getPreCutValue1("SSVHPT_WP") ) ||
( PFJetSSVHP->at(0)>getPreCutValue1("SSVHPT_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPM_WP") ) ){
FillUserTH2D(titlenum[n], 9, 5);
}
if( ( PFJetTCHP->at(0)>getPreCutValue1("TCHPT_WP") && PFJetSSVHP->at(1)>getPreCutValue1("SSVHPT_WP") ) ||
( PFJetSSVHP->at(0)>getPreCutValue1("SSVHPT_WP") && PFJetTCHP->at(1)>getPreCutValue1("TCHPT_WP") ) ){
FillUserTH2D(titlenum[n], 9, 6);
}
if( ( PFJetSSVHE->at(0)>getPreCutValue1("SSVHEM_WP") && PFJetSSVHP->at(1)>getPreCutValue1("SSVHPT_WP") ) ||
( PFJetSSVHP->at(0)>getPreCutValue1("SSVHPT_WP") && PFJetSSVHE->at(1)>getPreCutValue1("SSVHEM_WP") ) ){
FillUserTH2D(titlenum[n], 9, 7);
}
if( ( PFJetSSVHE->at(0)>getPreCutValue1("SSVHET_WP") && PFJetSSVHP->at(1)>getPreCutValue1("SSVHPT_WP") ) ||
( PFJetSSVHP->at(0)>getPreCutValue1("SSVHPT_WP") && PFJetSSVHE->at(1)>getPreCutValue1("SSVHET_WP") ) ){
FillUserTH2D(titlenum[n], 9, 8);
}
if( PFJetSSVHP->at(0)>getPreCutValue1("SSVHPT_WP") && PFJetSSVHP->at(1)>getPreCutValue1("SSVHPT_WP") ){
FillUserTH2D(titlenum[n], 9, 9);
}
//FILL 1D HISTOGRAMS
for(int m=1; m<=9; m+=1){
FillUserTH1D(titledenom1[n], m);
}
if( (PFJetTCHE->at(0)>getPreCutValue1("TCHEL_WP") || PFJetTCHE->at(1)>getPreCutValue1("TCHEL_WP")) &&
!(PFJetTCHE->at(0)>getPreCutValue1("TCHEL_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEL_WP"))){
FillUserTH1D(titlenum1[n], 1);
}
if( (PFJetTCHE->at(0)>getPreCutValue1("TCHEM_WP") || PFJetTCHE->at(1)>getPreCutValue1("TCHEM_WP")) &&
!(PFJetTCHE->at(0)>getPreCutValue1("TCHEM_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHEM_WP"))){
FillUserTH1D(titlenum1[n], 2);
}
if( (PFJetTCHE->at(0)>getPreCutValue1("TCHET_WP") || PFJetTCHE->at(1)>getPreCutValue1("TCHET_WP")) &&
!(PFJetTCHE->at(0)>getPreCutValue1("TCHET_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHET_WP"))){
FillUserTH1D(titlenum1[n], 3);
}
if( (PFJetTCHE->at(0)>getPreCutValue1("TCHPL_WP") || PFJetTCHE->at(1)>getPreCutValue1("TCHPL_WP")) &&
!(PFJetTCHE->at(0)>getPreCutValue1("TCHPL_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHPL_WP"))){
FillUserTH1D(titlenum1[n], 4);
}
if( (PFJetTCHE->at(0)>getPreCutValue1("TCHPM_WP") || PFJetTCHE->at(1)>getPreCutValue1("TCHPM_WP")) &&
!(PFJetTCHE->at(0)>getPreCutValue1("TCHPM_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHPM_WP"))){
FillUserTH1D(titlenum1[n], 5);
}
if( (PFJetTCHE->at(0)>getPreCutValue1("TCHPT_WP") || PFJetTCHE->at(1)>getPreCutValue1("TCHPT_WP")) &&
!(PFJetTCHE->at(0)>getPreCutValue1("TCHPT_WP") && PFJetTCHE->at(1)>getPreCutValue1("TCHPT_WP"))){
FillUserTH1D(titlenum1[n], 6);
}
if( (PFJetTCHE->at(0)>getPreCutValue1("SSVHEM_WP") || PFJetTCHE->at(1)>getPreCutValue1("SSVHEM_WP")) &&
!(PFJetTCHE->at(0)>getPreCutValue1("SSVHEM_WP") && PFJetTCHE->at(1)>getPreCutValue1("SSVHEM_WP"))){
FillUserTH1D(titlenum1[n], 7);
}
if( (PFJetTCHE->at(0)>getPreCutValue1("SSVHET_WP") || PFJetTCHE->at(1)>getPreCutValue1("SSVHET_WP")) &&
!(PFJetTCHE->at(0)>getPreCutValue1("SSVHET_WP") && PFJetTCHE->at(1)>getPreCutValue1("SSVHET_WP"))){
FillUserTH1D(titlenum1[n], 8);
}
if( (PFJetTCHE->at(0)>getPreCutValue1("SSVHPT_WP") || PFJetTCHE->at(1)>getPreCutValue1("SSVHPT_WP")) &&
!(PFJetTCHE->at(0)>getPreCutValue1("SSVHPT_WP") && PFJetTCHE->at(1)>getPreCutValue1("SSVHPT_WP"))){
FillUserTH1D(titlenum1[n], 9);
}
}
}
}
// select only those events that pass the full selection
if( passedCut("all") ) ret = true;
//############################# User's code ends here #################################
//#####################################################################################
// increment event counters
eventCountBeforeWeight++;
eventCount += eventWeight;
return ret;
}
// ------------ method called when ending the processing of a luminosity block ------------
bool
MyAnalyzer::endLuminosityBlock(edm::LuminosityBlock& iLumi, edm::EventSetup const& iSetup)
{
if ( skimWasMade_ )
{
edm::Handle<edm::MergeableCounter> eventCounter;
if (iLumi.getByLabel(eventCounterInputTag_, eventCounter) && eventCounter.isValid())
{
NEvtTotBeforeWeight_ += (double) eventCounter->value;
}
else
{
edm::LogError("MyAnalyzer::endLuminosityBlock") << "Can't get the product " << eventCounterInputTag_ <<". Please make sure the skimWasMade and eventCounterInputTag parameters were set correctly.";
exit(1);
}
}
return true;
}
// ------------ method called when ending the processing of a run ------------
bool
MyAnalyzer::endRun(edm::Run&, edm::EventSetup const&)
{
return true;
}
// ------------ method called once each job just after ending the event loop ------------
void
MyAnalyzer::endJob()
{
}
// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
void
MyAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
//The following says we do not know what parameters are allowed so do no validation
// Please change this to state exactly what you do use, even if it is no parameters
edm::ParameterSetDescription desc;
desc.setUnknown();
descriptions.addDefault(desc);
}
DEFINE_FWK_MODULE(MyAnalyzer);