forked from rgerosa/boostedWWAnalysis
-
Notifications
You must be signed in to change notification settings - Fork 5
/
doFit_class_run2exo.py
executable file
·3605 lines (2802 loc) · 315 KB
/
doFit_class_run2exo.py
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
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#! /Usr/bin/env python
import os
import glob
import math
import array
import ROOT
import ntpath
import sys
import subprocess
from subprocess import Popen
from optparse import OptionParser
from ROOT import gROOT, TPaveLabel, gStyle, gSystem, TGaxis, TStyle, TLatex, TString, TF1,TFile,TLine, TLegend, TH1D,TH2D,THStack,TChain, TCanvas, TMatrixDSym, TMath, TText, TPad, RooFit, RooArgSet, RooArgList, RooArgSet, RooAbsData, RooAbsPdf, RooAddPdf, RooWorkspace, RooExtendPdf,RooCBShape, RooLandau, RooFFTConvPdf, RooGaussian, RooBifurGauss, RooArgusBG,RooDataSet,RooExponential,RooBreitWigner, RooVoigtian, RooNovosibirsk, RooRealVar,RooFormulaVar, RooDataHist, RooHistPdf,RooCategory, RooChebychev, RooSimultaneous, RooGenericPdf,RooConstVar, RooKeysPdf, RooHistPdf, RooEffProd, RooProdPdf, RooChi2Var, TIter, kTRUE, kFALSE, kGray, kRed, kDashed, kGreen,kAzure, kOrange, kBlack,kBlue,kYellow,kCyan, kMagenta, kWhite, TGraph, RooMCStudy
############################################
# Job steering #
############################################
parser = OptionParser()
##### basic options ###########
parser.add_option('-b', '--noPlots',action='store_true', dest='noX', default=False, help='no X11 windows')
parser.add_option('--check', action='store_true', dest='check', default=False, help='check the workspace for limit setting')
parser.add_option('-s', '--simple', action='store_true', dest='simple', default=False, help='pre-limit in simple mode')
parser.add_option('-m', '--multi', action='store_true', dest='multi', default=True, help='pre-limit in multi mode')
#### additional information: channel. jet bin, signal properties
parser.add_option('-p', '--psmodel', action="store", type="string", dest="psmodel", default="pythia")
parser.add_option('-a', '--additioninformation', action="store", type="string", dest="additioninformation", default="HIGGS")
parser.add_option('-c', '--channel', action="store", type="string", dest="channel", default="mu")
parser.add_option('-i', '--inPath', action="store", type="string", dest="inPath", default="./")
parser.add_option('-f', '--treeFolder', action="store", type="string", dest="treeFolder", default="./")
parser.add_option('--cprime', action="store", type="int", dest="cprime", default=10)
parser.add_option('--BRnew', action="store", type="int", dest="BRnew", default=0)
parser.add_option('--closuretest', action='store', type="int", dest='closuretest', default=0, help='closure test; 0: no test; 1: A1->A2; 2: A->B')
parser.add_option('--pseudodata', action='store', type="int", dest='pseudodata', default=1, help='pseudodata 0 -> use real data, else use stack of MC backgrounds')
parser.add_option('--fitSignal', action='store', type="int", dest='fitsignal', default=0, help='fit only signal lineshape with a chosen model')
parser.add_option('--category', action="store", type="string", dest="category", default="HP")
parser.add_option('--jetBin', action="store", type="string", dest="jetBin", default="")
parser.add_option('--skipJetSystematics', action="store", type="int", dest="skipJetSystematics", default=0)
parser.add_option('--interferenceModel', action="store", type="string", dest="interferenceModel", default="3")
(options, args) = parser.parse_args()
ROOT.gSystem.Load(options.inPath+"/PlotStyle/Util_cxx.so")
ROOT.gSystem.Load(options.inPath+"/PlotStyle/PlotUtils_cxx.so")
ROOT.gSystem.Load(options.inPath+"/PDFs/PdfDiagonalizer_cc.so")
ROOT.gSystem.Load(options.inPath+"/PDFs/HWWLVJRooPdfs_cxx.so")
ROOT.gSystem.Load(options.inPath+"/PDFs/MakePdf_cxx.so")
ROOT.gSystem.Load(options.inPath+"/BiasStudy/BiasUtils_cxx.so")
ROOT.gSystem.Load(options.inPath+"/FitUtils/FitUtils_cxx.so")
from ROOT import draw_error_band, draw_error_band_extendPdf, draw_error_band_Decor, draw_error_band_shape_Decor, Calc_error_extendPdf, Calc_error, RooErfExpPdf, RooAlpha, RooAlpha4ErfPowPdf, RooAlpha4ErfPow2Pdf, RooAlpha4ErfPowExpPdf, PdfDiagonalizer, RooPowPdf, RooPow2Pdf, RooErfPowExpPdf, RooErfPowPdf, RooErfPow2Pdf, RooQCDPdf, RooUser1Pdf, RooBWRunPdf, RooAnaExpNPdf,RooExpNPdf, RooAlpha4ExpNPdf, RooExpTailPdf, RooAlpha4ExpTailPdf, Roo2ExpPdf, RooAlpha42ExpPdf
from ROOT import MakeGeneralPdf, MakeExtendedModel, get_TTbar_mj_Model, get_STop_mj_Model, get_VV_mj_Model, get_WW_EWK_mj_Model, get_WJets_mj_Model, get_ggH_mj_Model, get_vbfH_mj_Model, get_TTbar_mlvj_Model, get_STop_mlvj_Model, get_VV_mlvj_Model, get_WW_EWK_mlvj_Model, get_WJets_mlvj_Model, get_ggH_mlvj_Model, get_vbfH_mlvj_Model, fix_Model, clone_Model
from ROOT import setTDRStyle, get_pull, draw_canvas, draw_canvas_with_pull, legend4Plot, GetDataPoissonInterval, GetLumi, draw_error_band_ws
from ROOT import fit_mj_single_MC, fit_mlvj_model_single_MC, fit_WJetsNormalization_in_Mj_signal_region, fit_mlvj_in_Mj_sideband, get_WJets_mlvj_correction_sb_lo_to_signal_region, get_mlvj_normalization_insignalregion, fit_genHMass, SystematicUncertaintyHiggs_2jetBin, SystematicUncertaintyHiggs_01jetBin
from ROOT import *
gInterpreter.GenerateDictionary("std::map<std::string,std::string>", "map;string;string")
###############################
## doFit Class Implemetation ##
###############################
class doFit_wj_and_wlvj:
def __init__(self, in_channel,in_higgs_sample, in_mlvj_signal_region_min=500, in_mlvj_signal_region_max=700, in_mj_min=30, in_mj_max=140, in_mlvj_min=400., in_mlvj_max=1400., fit_model="ErfExp_v1", fit_model_alter="ErfPow_v1", input_workspace=None):
RooAbsPdf.defaultIntegratorConfig().setEpsRel(1e-9) ;
RooAbsPdf.defaultIntegratorConfig().setEpsAbs(1e-9) ;
### shapes to be used in mj
self.mj_shape = ROOT.std.map(ROOT.std.string,ROOT.std.string) () ;
self.mj_shape["TTbar"] = "2Gaus_ErfExp";
self.mj_shape["VV"] = "2_2Gaus";
self.mj_shape["WW_EWK"] = "2_2Gaus";
if options.jetBin == "_2jet": self.mj_shape["STop"] = "ErfExp";
else: self.mj_shape["STop"] = "ErfExpGaus_sp";
if options.jetBin == "_2jet":
self.mj_shape["WJets0"] = "ErfExp";
self.mj_shape["WJets1"] = "ErfExp";
self.mj_shape["WJets01"] = "User1";
else:
self.mj_shape["WJets0"] = "ErfExp";
self.mj_shape["WJets1"] = "ErfExp";
self.mj_shape["WJets01"] = "User1";
# self.mj_shape["WJets0"] = "User1";
# self.mj_shape["WJets1"] = "User1";
# self.mj_shape["WJets01"] = "ErfExp";
self.mlvj_shape = ROOT.std.map(ROOT.std.string,ROOT.std.string) () ;
self.mlvj_shape["TTbar"] = "Exp" #fit_model;
self.mlvj_shape["VV"] = "ExpN";
# self.mlvj_shape["VV"] = fit_model;
self.mlvj_shape["WW_EWK"] = fit_model;
self.mlvj_shape["STop"] = "Exp" #fit_model;
self.mlvj_shape["WJets0"] = fit_model;
self.mlvj_shape["WJets1"] = fit_model;
self.mlvj_shape["WJets01"] = fit_model_alter;
self.mlvj_shape["BulkGraviton"] = "CB_v1";
self.mlvj_shape["vbfH"] = "SCB_Exp_v1";
self.tmpFile = TFile("tmp2.root","RECREATE");
self.tmpFile.cd();
### set the channel type --> electron or muon
self.channel = in_channel;
self.higgs_sample = in_higgs_sample;
if in_higgs_sample == "BulkGraviton600": self.vbfhiggs_sample = "vbfH600";
if in_higgs_sample == "BulkGraviton700": self.vbfhiggs_sample = "vbfH700";
if in_higgs_sample == "BulkGraviton800": self.vbfhiggs_sample = "vbfH800";
if in_higgs_sample == "BulkGraviton900": self.vbfhiggs_sample = "vbfH900";
if in_higgs_sample == "BulkGraviton1000": self.vbfhiggs_sample = "vbfH1000";
if in_higgs_sample == "BulkGraviton1500": self.vbfhiggs_sample = "vbfH1500";
if in_higgs_sample == "BulkGraviton2000": self.vbfhiggs_sample = "vbfH2000";
print "########################################################################################"
print "######## define class: binning, variables, cuts, files and nuissance parameters ########"
print "########################################################################################"
### Set the mj binning for plots
self.BinWidth_mj = 5.;
## set the model used for the background parametrization
self.MODEL_4_mlvj = fit_model;
self.MODEL_4_mlvj_alter = fit_model_alter;
### Set the binning for mlvj plots as a function of the model
if not options.fitsignal:
if self.MODEL_4_mlvj == "ErfPowExp_v1" or self.MODEL_4_mlvj == "ErfPow2_v1" or self.MODEL_4_mlvj == "ErfExp_v1":
self.BinWidth_mlvj = 35.;
else:
self.BinWidth_mlvj = 50.;
else:
if self.MODEL_4_mlvj == "ErfPowExp_v1" or self.MODEL_4_mlvj == "ErfPow2_v1" or self.MODEL_4_mlvj == "ErfExp_v1":
self.BinWidth_mlvj = 10.;
else:
self.BinWidth_mlvj = 10.;
#narrow the BinWidth_mj and BinWidth_mlvj by a factor of 5. Because Higgs-Combination-Tools will generate a binned sample, so need the bin width narrow. So, as a easy solution, we will increase the bin-width by a factor of 5 when ploting m_j m_WW
self.leg = TLegend();
self.narrow_factor = 10;
## correct the binning of mj
self.BinWidth_mj = self.BinWidth_mj;
self.nbins_mj = int((in_mj_max-in_mj_min)/self.BinWidth_mj);
in_mj_max = in_mj_min+self.nbins_mj*self.BinWidth_mj;
## correct the binning of mlvj
self.BinWidth_mlvj = self.BinWidth_mlvj;
self.nbins_mlvj = int((in_mlvj_max-in_mlvj_min)/self.BinWidth_mlvj);
in_mlvj_max = in_mlvj_min+self.nbins_mlvj*self.BinWidth_mlvj;
## define jet mass variable
rrv_mass_j = RooRealVar("rrv_mass_j","pruned m_{J}",(in_mj_min+in_mj_max)/2.,in_mj_min,in_mj_max,"GeV");
rrv_mass_j.setBins(self.nbins_mj);
## define invariant mass WW variable
rrv_mass_lvj = RooRealVar("rrv_mass_lvj","m_{WW}",(in_mlvj_min+in_mlvj_max)/2.,in_mlvj_min,in_mlvj_max,"GeV");
rrv_mass_lvj.setBins(self.nbins_mlvj);
## generator higgs mass
rrv_mass_gen_WW = RooRealVar("rrv_mass_gen_WW","gen_m_{WW}",(in_mlvj_min+in_mlvj_max)/2.,in_mlvj_min,in_mlvj_max,"GeV");
rrv_mass_gen_WW.setBins(self.nbins_mlvj);
## create the workspace and import them
if input_workspace is None:
self.workspace4fit_ = RooWorkspace("workspace4fit_","workspace4fit_");
else:
self.workspace4fit_ = input_workspace;
getattr(self.workspace4fit_,"import")(rrv_mass_j);
getattr(self.workspace4fit_,"import")(rrv_mass_lvj);
getattr(self.workspace4fit_,"import")(rrv_mass_gen_WW);
#prepare workspace for unbin-Limit -> just fo the stuff on which running the limit
self.workspace4limit_ = RooWorkspace("workspace4limit_","workspace4limit_");
## different code operation mode -> just normal analysis
if options.closuretest == 0:
self.mj_sideband_lo_min = in_mj_min;
self.mj_sideband_lo_max = 65;
self.mj_signal_min = 65;
self.mj_signal_max = 105;
self.mj_sideband_hi_min = 135;
self.mj_sideband_hi_max = in_mj_max;
if options.closuretest == 1: ##closure test A1->A2
self.mj_sideband_lo_min = in_mj_min;
self.mj_sideband_lo_max = 55;
self.mj_signal_min = 55;
self.mj_signal_max = 65;
self.mj_sideband_hi_min = 135;
self.mj_sideband_hi_max = in_mj_max;
if options.closuretest == 2: #closure test A->B
self.mj_sideband_lo_min = in_mj_min;
self.mj_sideband_lo_max = 65;
self.mj_signal_min = 135;
self.mj_signal_max = 145;
self.mj_sideband_hi_min = 145;
self.mj_sideband_hi_max = in_mj_max;
## zone definition in the jet mass
rrv_mass_j.setRange("sb_lo",self.mj_sideband_lo_min,self.mj_sideband_lo_max);
rrv_mass_j.setRange("signal_region",self.mj_signal_min,self.mj_signal_max);
rrv_mass_j.setRange("sb_hi",self.mj_sideband_hi_min,self.mj_sideband_hi_max);
rrv_mass_j.setRange("sblo_to_sbhi",self.mj_sideband_lo_min,self.mj_sideband_hi_max);
## signal region definition in the mlvj variable in case of counting limit
self.mlvj_signal_min = in_mlvj_signal_region_min
self.mlvj_signal_max = in_mlvj_signal_region_max
rrv_mass_lvj.setRange("signal_region",self.mlvj_signal_min,self.mlvj_signal_max);
#prepare the data and mc files --> set the working directory and the files name
self.file_Directory = options.treeFolder+"WWTree_%s/"%(self.channel);
self.PS_model = options.psmodel;
if options.pseudodata == 1:
self.file_data = ("WWTree_pseudodata.root");
else:
self.file_data = ("WWTree_data_golden_2p1.root");
self.file_ggH = ("WWTree_%s.root"%(self.higgs_sample));
# self.file_vbfH = ("WWTree_%s.root"%(self.vbfhiggs_sample));
#WJets0 is the default PS model, WJets1 is the alternative PS model
'''
if self.PS_model == "pythia":
if options.jetBin == "_2jet" :
self.file_WJets0_mc = ("WWTree_WJets_exclusive_Pythia.root");
self.file_WJets1_mc = ("WWTree_WJets_Herwig.root");
else:
self.file_WJets1_mc = ("WWTree_WJets_Pythia100.root");
self.file_WJets0_mc = ("WWTree_WJets_Herwig.root");
else:
if options.jetBin == "_2jet" :
self.file_WJets0_mc = ("WWTree_WJets_Herwig.root");
self.file_WJets1_mc = ("WWTree_WJets_exclusive_Pythia.root");
else:
self.file_WJets0_mc = ("WWTree_WJets_Herwig.root");
self.file_WJets1_mc = ("WWTree_WJets_Pythia100.root");
'''
self.file_WJets0_mc = ("WWTree_WJets.root");
self.file_VV_mc = ("WWTree_VV.root");# WW+WZ
# self.file_WW_EWK_mc = ("WWTree_WW2jet_phantom.root");# WW_EWK
self.file_STop_mc = ("WWTree_STop.root");#STop
self.file_TTbar_mc = ("WWTree_TTbar.root");
# self.file_TTbar_matchDn_mc = ("WWTree_TTbar_matchDn.root");
# self.file_TTbar_matchUp_mc = ("WWTree_TTbar_matchUp.root");
# self.file_TTbar_scaleDn_mc = ("WWTree_TTbar_scaleDn.root");
# self.file_TTbar_scaleUp_mc = ("WWTree_TTbar_scaleUp.root");
# self.file_TTbar_mcanlo_mc = ("WWTree_TTbar_mcanlo.root");
self.PS_model= options.psmodel
## event categorization as a function of the purity and the applied selection
self.category = options.category;
self.wtagger_label = options.category;
if self.wtagger_label=="HP" :
if self.channel=="el":
self.wtagger_cut=0.45 ; self.wtagger_cut_min=0. ;
if self.channel=="mu":
self.wtagger_cut=0.45 ; self.wtagger_cut_min=0. ;
if self.channel=="em":
self.wtagger_cut=0.45 ; self.wtagger_cut_min=0. ;
if self.wtagger_label=="LP":
self.wtagger_cut=0.75 ;
self.wtagger_cut_min=0.5 ;
if self.wtagger_label=="nocut":
self.wtagger_cut=10000;
#medium wtagger_eff reweight between data and mc #Wtagger_forV SF have be add to ntuple weight;
if self.channel=="mu" and self.wtagger_label=="HP":
if options.pseudodata == 1:
self.rrv_wtagger_eff_reweight_forT = RooRealVar("rrv_wtagger_eff_reweight_forT","rrv_wtagger_eff_reweight_forT",1.);
self.rrv_wtagger_eff_reweight_forT.setError(0.042);
self.rrv_wtagger_eff_reweight_forV = RooRealVar("rrv_wtagger_eff_reweight_forV","rrv_wtagger_eff_reweight_forV",1.);
self.rrv_wtagger_eff_reweight_forV.setError(0.144*self.rrv_wtagger_eff_reweight_forV.getVal());
elif options.pseudodata == 0 and options.jetBin == "_2jet":
self.rrv_wtagger_eff_reweight_forT = RooRealVar("rrv_wtagger_eff_reweight_forT","rrv_wtagger_eff_reweight_forT",0.850);
self.rrv_wtagger_eff_reweight_forT.setError(0.042);
self.rrv_wtagger_eff_reweight_forV = RooRealVar("rrv_wtagger_eff_reweight_forV","rrv_wtagger_eff_reweight_forV",0.692);
self.rrv_wtagger_eff_reweight_forV.setError(0.144*self.rrv_wtagger_eff_reweight_forV.getVal());
elif options.pseudodata == 0 and not options.jetBin == "_2jet":
self.rrv_wtagger_eff_reweight_forT = RooRealVar("rrv_wtagger_eff_reweight_forT","rrv_wtagger_eff_reweight_forT",0.850);
self.rrv_wtagger_eff_reweight_forT.setError(0.042*self.rrv_wtagger_eff_reweight_forT.getVal());
self.rrv_wtagger_eff_reweight_forV = RooRealVar("rrv_wtagger_eff_reweight_forV","rrv_wtagger_eff_reweight_forV",0.692);
self.rrv_wtagger_eff_reweight_forV.setError(0.144*self.rrv_wtagger_eff_reweight_forV.getVal());
if self.channel=="el" and self.wtagger_label=="HP":
if options.pseudodata == 1:
self.rrv_wtagger_eff_reweight_forT = RooRealVar("rrv_wtagger_eff_reweight_forT","rrv_wtagger_eff_reweight_forT",1.);
self.rrv_wtagger_eff_reweight_forT.setError(0.042);
self.rrv_wtagger_eff_reweight_forV = RooRealVar("rrv_wtagger_eff_reweight_forV","rrv_wtagger_eff_reweight_forV",1.);
self.rrv_wtagger_eff_reweight_forV.setError(0.144*self.rrv_wtagger_eff_reweight_forV.getVal());
elif options.pseudodata == 0 and options.jetBin == "_2jet":
self.rrv_wtagger_eff_reweight_forT = RooRealVar("rrv_wtagger_eff_reweight_forT","rrv_wtagger_eff_reweight_forT",0.850);
self.rrv_wtagger_eff_reweight_forT.setError(0.042);
self.rrv_wtagger_eff_reweight_forV = RooRealVar("rrv_wtagger_eff_reweight_forV","rrv_wtagger_eff_reweight_forV",0.692);
self.rrv_wtagger_eff_reweight_forV.setError(0.144*self.rrv_wtagger_eff_reweight_forV.getVal());
elif options.pseudodata == 0 and not options.jetBin == "_2jet":
self.rrv_wtagger_eff_reweight_forT = RooRealVar("rrv_wtagger_eff_reweight_forT","rrv_wtagger_eff_reweight_forT",0.850);
self.rrv_wtagger_eff_reweight_forT.setError(0.042*self.rrv_wtagger_eff_reweight_forT.getVal());
self.rrv_wtagger_eff_reweight_forV = RooRealVar("rrv_wtagger_eff_reweight_forV","rrv_wtagger_eff_reweight_forV",0.692);
self.rrv_wtagger_eff_reweight_forV.setError(0.144*self.rrv_wtagger_eff_reweight_forV.getVal());
if self.channel=="em" and self.wtagger_label=="HP":
if options.pseudodata == 1:
self.rrv_wtagger_eff_reweight_forT=RooRealVar("rrv_wtagger_eff_reweight_forT","rrv_wtagger_eff_reweight_forT", 1.0);
self.rrv_wtagger_eff_reweight_forT.setError(0.265);
self.rrv_wtagger_eff_reweight_forV=RooRealVar("rrv_wtagger_eff_reweight_forV","rrv_wtagger_eff_reweight_forV",1.0);
self.rrv_wtagger_eff_reweight_forV.setError(0.097*self.rrv_wtagger_eff_reweight_forV.getVal());
elif options.pseudodata ==0 and options.jetBin == "_2jet":
self.rrv_wtagger_eff_reweight_forT = RooRealVar("rrv_wtagger_eff_reweight_forT","rrv_wtagger_eff_reweight_forT", 1.);
self.rrv_wtagger_eff_reweight_forT.setError(0.265);
self.rrv_wtagger_eff_reweight_forV = RooRealVar("rrv_wtagger_eff_reweight_forV","rrv_wtagger_eff_reweight_forV",0.93);
self.rrv_wtagger_eff_reweight_forV.setError(0.097*self.rrv_wtagger_eff_reweight_forV.getVal());
#medium wtagger_eff reweight between data and mc #Wtagger_forV SF have be add to ntuple weight;
if self.channel=="mu" and self.wtagger_label=="LP":
if options.pseudodata == 1:
self.rrv_wtagger_eff_reweight_forT = RooRealVar("rrv_wtagger_eff_reweight_forT","rrv_wtagger_eff_reweight_forT",1.);
self.rrv_wtagger_eff_reweight_forT.setError(0.06);
self.rrv_wtagger_eff_reweight_forV = RooRealVar("rrv_wtagger_eff_reweight_forV","rrv_wtagger_eff_reweight_forV",1.);
self.rrv_wtagger_eff_reweight_forV.setError(0.097*self.rrv_wtagger_eff_reweight_forV.getVal());
elif options.pseudodata == 0 and options.jetBin == "_2jet":
self.rrv_wtagger_eff_reweight_forT = RooRealVar("rrv_wtagger_eff_reweight_forT","rrv_wtagger_eff_reweight_forT",1.128);
self.rrv_wtagger_eff_reweight_forT.setError(0.338);
self.rrv_wtagger_eff_reweight_forV = RooRealVar("rrv_wtagger_eff_reweight_forV","rrv_wtagger_eff_reweight_forV",0.93);
self.rrv_wtagger_eff_reweight_forV.setError(0.097*self.rrv_wtagger_eff_reweight_forV.getVal());
elif options.pseudodata == 0 and not options.jetBin == "_2jet":
self.rrv_wtagger_eff_reweight_forT = RooRealVar("rrv_wtagger_eff_reweight_forT","rrv_wtagger_eff_reweight_forT",0.767);
self.rrv_wtagger_eff_reweight_forT.setError(0.128*self.rrv_wtagger_eff_reweight_forT.getVal());
self.rrv_wtagger_eff_reweight_forV = RooRealVar("rrv_wtagger_eff_reweight_forV","rrv_wtagger_eff_reweight_forV",0.879);
self.rrv_wtagger_eff_reweight_forV.setError(0.130*self.rrv_wtagger_eff_reweight_forV.getVal());
if self.channel=="el" and self.wtagger_label=="LP":
if options.pseudodata == 1:
self.rrv_wtagger_eff_reweight_forT = RooRealVar("rrv_wtagger_eff_reweight_forT","rrv_wtagger_eff_reweight_forT",1.);
self.rrv_wtagger_eff_reweight_forT.setError(0.08);
self.rrv_wtagger_eff_reweight_forV = RooRealVar("rrv_wtagger_eff_reweight_forV","rrv_wtagger_eff_reweight_forV",1.);
self.rrv_wtagger_eff_reweight_forV.setError(0.097*self.rrv_wtagger_eff_reweight_forV.getVal());
elif options.pseudodata == 0 and options.jetBin == "_2jet":
self.rrv_wtagger_eff_reweight_forT = RooRealVar("rrv_wtagger_eff_reweight_forT","rrv_wtagger_eff_reweight_forT",0.96);
self.rrv_wtagger_eff_reweight_forT.setError(0.369);
self.rrv_wtagger_eff_reweight_forV = RooRealVar("rrv_wtagger_eff_reweight_forV","rrv_wtagger_eff_reweight_forV",0.93);
self.rrv_wtagger_eff_reweight_forV.setError(0.097*self.rrv_wtagger_eff_reweight_forV.getVal());
elif options.pseudodata == 0 and not options.jetBin == "_2jet":
self.rrv_wtagger_eff_reweight_forT = RooRealVar("rrv_wtagger_eff_reweight_forT","rrv_wtagger_eff_reweight_forT",0.603);
self.rrv_wtagger_eff_reweight_forT.setError(0.248*self.rrv_wtagger_eff_reweight_forT.getVal());
self.rrv_wtagger_eff_reweight_forV = RooRealVar("rrv_wtagger_eff_reweight_forV","rrv_wtagger_eff_reweight_forV",0.751);
self.rrv_wtagger_eff_reweight_forV.setError(0.219*self.rrv_wtagger_eff_reweight_forV.getVal());
if self.channel=="em" and self.wtagger_label=="LP":
if options.pseudodata == 1:
self.rrv_wtagger_eff_reweight_forT=RooRealVar("rrv_wtagger_eff_reweight_forT","rrv_wtagger_eff_reweight_forT", 1.0);
self.rrv_wtagger_eff_reweight_forT.setError(0.265);
self.rrv_wtagger_eff_reweight_forV=RooRealVar("rrv_wtagger_eff_reweight_forV","rrv_wtagger_eff_reweight_forV",1.0);
self.rrv_wtagger_eff_reweight_forV.setError(0.097*self.rrv_wtagger_eff_reweight_forV.getVal());
elif options.pseudodata ==0 and options.jetBin == "_2jet":
self.rrv_wtagger_eff_reweight_forT = RooRealVar("rrv_wtagger_eff_reweight_forT","rrv_wtagger_eff_reweight_forT", 1.);
self.rrv_wtagger_eff_reweight_forT.setError(0.265);
self.rrv_wtagger_eff_reweight_forV = RooRealVar("rrv_wtagger_eff_reweight_forV","rrv_wtagger_eff_reweight_forV",0.93);
self.rrv_wtagger_eff_reweight_forV.setError(0.097*self.rrv_wtagger_eff_reweight_forV.getVal());
print "wtagger efficiency correction for Top sample: %s +/- %s"%(self.rrv_wtagger_eff_reweight_forT.getVal(), self.rrv_wtagger_eff_reweight_forT.getError());
print "wtagger efficiency correction for V sample: %s +/- %s"%(self.rrv_wtagger_eff_reweight_forV.getVal(), self.rrv_wtagger_eff_reweight_forV.getError());
#result files: The event number, parameters and error write into a txt file. The dataset and pdfs write into a root file
if not os.path.isdir("cards_%s_%s_%s"%(self.channel,self.mlvj_shape["WJets0"],self.category)): os.system("mkdir cards_%s_%s_%s"%(self.channel,self.mlvj_shape["WJets0"],self.category));
self.rlt_DIR = "cards_%s_%s_%s/"%(self.channel,self.mlvj_shape["WJets0"],self.category);
if options.jetBin == "_2jet" :
self.file_rlt_txt = self.rlt_DIR+"other_hwwlvj_%s_%s%s_%02d_%02d.txt"%(self.higgs_sample,self.channel,options.jetBin,options.cprime,options.BRnew)
self.file_rlt_root = self.rlt_DIR+"hwwlvj_%s_%s%s_%02d_%02d_workspace.root"%(self.higgs_sample,self.channel,options.jetBin,options.cprime,options.BRnew)
self.file_datacard_unbin_BulkGravitonvbfH = self.rlt_DIR+"hwwlvj_%s_%s%s_%02d_%02d_unbin.txt"%(self.higgs_sample,self.channel,options.jetBin,options.cprime,options.BRnew)
self.file_datacard_unbin_BulkGraviton = self.rlt_DIR+"hwwlvj_%s_%s%s_%02d_%02d_unbin.txt"%(self.higgs_sample,self.channel,options.jetBin,options.cprime,options.BRnew)
self.file_datacard_unbin_vbfH = self.rlt_DIR+"hwwlvj_%s_%s%s_vbfH_%02d_%02d_unbin.txt"%(self.higgs_sample,self.channel,options.jetBin,options.cprime,options.BRnew)
self.file_datacard_counting_BulkGravitonvbfH = self.rlt_DIR+"hwwlvj_%s_%s%s_%02d_%02d_counting.txt"%(self.higgs_sample,self.channel,options.jetBin,options.cprime,options.BRnew)
self.file_datacard_counting_BulkGraviton = self.rlt_DIR+"hwwlvj_%s_%s%s_%02d_%02d_counting.txt"%(self.higgs_sample,self.channel,options.jetBin,options.cprime,options.BRnew)
self.file_datacard_counting_vbfH = self.rlt_DIR+"hwwlvj_%s_%s%s_vbfH_%02d_%02d_counting.txt"%(self.higgs_sample,self.channel,options.jetBin,options.cprime,options.BRnew)
else:
self.file_rlt_txt = self.rlt_DIR+"other_hwwlvj_%s_%s_%02d_%02d.txt"%(self.higgs_sample,self.channel,options.cprime,options.BRnew)
self.file_rlt_root = self.rlt_DIR+"hwwlvj_%s_%s_%02d_%02d_workspace.root"%(self.higgs_sample,self.channel,options.cprime,options.BRnew)
self.file_datacard_unbin_BulkGravitonvbfH = self.rlt_DIR+"hwwlvj_%s_%s_%02d_%02d_unbin.txt"%(self.higgs_sample,self.channel,options.cprime,options.BRnew)
self.file_datacard_unbin_BulkGraviton = self.rlt_DIR+"hwwlvj_%s_%s_%02d_%02d_unbin.txt"%(self.higgs_sample,self.channel,options.cprime,options.BRnew)
self.file_datacard_unbin_vbfH = self.rlt_DIR+"hwwlvj_%s_%s_vbfH_%02d_%02d_unbin.txt"%(self.higgs_sample,self.channel,options.cprime,options.BRnew)
self.file_datacard_counting_BulkGravitonvbfH = self.rlt_DIR+"hwwlvj_%s_%s_%02d_%02d_counting.txt"%(self.higgs_sample,self.channel,options.cprime,options.BRnew)
self.file_datacard_counting_BulkGraviton = self.rlt_DIR+"hwwlvj_%s_%s_%02d_%02d_counting.txt"%(self.higgs_sample,self.channel,options.cprime,options.BRnew)
self.file_datacard_counting_vbfH = self.rlt_DIR+"hwwlvj_%s_%s_vbfH_%02d_%02d_counting.txt"%(self.higgs_sample,self.channel,options.cprime,options.BRnew)
self.file_out = open(self.file_rlt_txt,"w");
self.file_out.write("Welcome:\n");
self.file_out.close()
self.file_out = open(self.file_rlt_txt,"a+");
self.higgs_xs_scale=1.0; #higgs XS scale
## color palette
self.color_palet = ROOT.std.map(ROOT.std.string, int) () ;
self.color_palet["data"] = 1;
self.color_palet["WJets"] = 2;
self.color_palet["VV"] = 4;
self.color_palet["WW_EWK"] = 6;
self.color_palet["STop"] = 7;
self.color_palet["TTbar"] = 210;
self.color_palet["BulkGraviton"] = 1;
self.color_palet["vbfH"] = 12;
self.color_palet["Signal"] = 1;
self.color_palet["Uncertainty"] = 1;
self.color_palet["Other_Backgrounds"] = 1;
# self.Lumi = 1550;
self.Lumi = 2198;
# self.Lumi = 1263;
# if self.channel=="el":
# self.Lumi = 19166;
#met cut:el 70; mu: 50
self.pfMET_cut = 40;
self.lpt_cut = 40;
self.vpt_cut = 200;
# self.pfMET_cut = 40;
# self.lpt_cut = 53;
self.bcut = 0.890;
if self.channel=="el":
# self.pfMET_cut = 80;
# self.lpt_cut = 120;
self.pfMET_cut = 80;
self.lpt_cut = 45;
#deltaPhi_METj cut
self.deltaPhi_METj_cut = 2.0;
self.top_veto_had = 200 ;
self.top_veto_lep = 200 ;
self.top_veto_had_min = 0 ;
self.top_veto_lep_min = 0 ;
# self.dEta_cut = 3.0 ;
# self.Mjj_cut = 250 ;
self.dEta_cut = 2.0 ;
self.Mjj_cut = 200 ;
# parameters of data-driven method to get the WJets background event number.
self.number_WJets_insideband = -1;
self.datadriven_alpha_WJets_unbin = -1;
self.datadriven_alpha_WJets_counting = -1;
#uncertainty for datacard
self.lumi_uncertainty = 0.046;
self.XS_STop_uncertainty = 0.05 ;
self.XS_VV_uncertainty = 0.03 ;
self.XS_WW_EWK_uncertainty = 0.20 ;
self.XS_TTbar_uncertainty = 0.084 ;
self.XS_TTbar_NLO_uncertainty = 0.063 ;# from AN-12-368 table8
self.XS_STop_NLO_uncertainty = 0.05 ; # from AN-12-368 table8
self.XS_VV_NLO_uncertainty = 0.10 ; # from AN-12-368 table8
### jet binning uncertainty
if options.jetBin == "_2jet":
self.QCDscale_ggH0in = 0.000;
self.QCDscale_ggH2in = 0.190;
else:
self.QCDscale_ggH0in = 0.260;
self.QCDscale_ggH2in = -0.060;
self.QCDscale_qqH = 0.0;
self.pdf_gg = 0.0;
self.pdf_qqbar = 0.0;
self.QCDscale_ggH_ACCEPT = 0.0;
self.QCDscale_qqH_ACCEPT = 0.0;
# from twiki https:#twiki.cern.ch/twiki/bin/view/LHCPhysics/CERNYellowReportPageAt8TeV,
if self.higgs_sample == "BulkGraviton600":
self.QCDscale_qqH = 0.007 ;
self.pdf_gg = 0.091 ;
self.pdf_qqbar = 0.050 ;
self.QCDscale_ggH_ACCEPT = 0.036 ;
self.QCDscale_qqH_ACCEPT = 0.007 ;
self.XS_BulkG_uncertainty = 0.090 ;
elif self.higgs_sample == "BulkGraviton700":
self.QCDscale_qqH = 0.008;
self.pdf_gg = 0.101;
self.pdf_qqbar = 0.042
self.QCDscale_ggH_ACCEPT = 0.038;
self.QCDscale_qqH_ACCEPT = 0.008
self.XS_BulkG_uncertainty = 0.100 ;
elif self.higgs_sample == "BulkGraviton750":
self.QCDscale_qqH = 0.008;
self.pdf_gg = 0.101;
self.pdf_qqbar = 0.042
self.QCDscale_ggH_ACCEPT = 0.038;
self.QCDscale_qqH_ACCEPT = 0.008
self.XS_BulkG_uncertainty = 0.105 ;
elif self.higgs_sample == "BulkGraviton800":
self.QCDscale_qqH = 0.010;
self.pdf_gg = 0.106;
self.pdf_qqbar = 0.047;
self.QCDscale_ggH_ACCEPT = 0.040;
self.QCDscale_qqH_ACCEPT = 0.009
self.XS_BulkG_uncertainty = 0.110 ;
elif self.higgs_sample == "BulkGraviton900":
self.QCDscale_qqH = 0.012
self.pdf_gg = 0.111;
self.pdf_qqbar = 0.053
self.QCDscale_ggH_ACCEPT = 0.042;
self.QCDscale_qqH_ACCEPT = 0.010
self.XS_BulkG_uncertainty = 0.120 ;
elif self.higgs_sample == "BulkGraviton1000":
self.QCDscale_qqH = 0.013;
self.pdf_gg = 0.121;
self.pdf_qqbar = 0.059;
self.QCDscale_ggH_ACCEPT = 0.046;
self.QCDscale_qqH_ACCEPT = 0.011
self.XS_BulkG_uncertainty = 0.130 ;
### interference effect
self.interference_ggH_uncertainty = 0.10;
self.interference_vbfH_uncertainty = 0.25;
#normalization uncertainty from jet scale
self.WJets_normalization_uncertainty_from_jet_scale = 0.;
self.VV_normalization_uncertainty_from_jet_scale = 0.;
self.WW_EWK_normalization_uncertainty_from_jet_scale = 0.;
self.STop_normalization_uncertainty_from_jet_scale = 0.;
self.TTbar_normalization_uncertainty_from_jet_scale = 0.;
self.ggH_normalization_uncertainty_from_jet_scale = 0.;
self.vbf_normalization_uncertainty_from_jet_scale = 0.;
#normalization uncertainty from jet_res
self.WJets_normalization_uncertainty_from_jet_res = 0.;
self.VV_normalization_uncertainty_from_jet_res = 0.;
self.WW_EWK_normalization_uncertainty_from_jet_res = 0.;
self.STop_normalization_uncertainty_from_jet_res = 0.;
self.TTbar_normalization_uncertainty_from_jet_res = 0.;
self.ggH_normalization_uncertainty_from_jet_res = 0.;
self.vbf_normalization_uncertainty_from_jet_res = 0.;
#normalization uncertainty from lep scale
if self.channel == "mu":
self.WJets_normalization_uncertainty_from_lep_scale = 1.000;
self.VV_normalization_uncertainty_from_lep_scale = 1.007;
self.WW_EWK_normalization_uncertainty_from_lep_scale = 1.007;
self.STop_normalization_uncertainty_from_lep_scale = 1.007;
self.TTbar_normalization_uncertainty_from_lep_scale = 1.007;
self.ggH_normalization_uncertainty_from_lep_scale = 1.007;
self.vbf_normalization_uncertainty_from_lep_scale = 1.007;
elif self.channel == "el":
self.WJets_normalization_uncertainty_from_lep_scale = 1.000;
self.VV_normalization_uncertainty_from_lep_scale = 1.002;
self.WW_EWK_normalization_uncertainty_from_lep_scale = 1.002;
self.STop_normalization_uncertainty_from_lep_scale = 1.002;
self.TTbar_normalization_uncertainty_from_lep_scale = 1.002;
self.ggH_normalization_uncertainty_from_lep_scale = 1.002;
self.vbf_normalization_uncertainty_from_lep_scale = 1.002;
elif self.channel == "em":
self.WJets_normalization_uncertainty_from_lep_scale = 1.000;
self.VV_normalization_uncertainty_from_lep_scale = 1.075;
self.WW_EWK_normalization_uncertainty_from_lep_scale = 1.007;
self.STop_normalization_uncertainty_from_lep_scale = 1.000;
self.TTbar_normalization_uncertainty_from_lep_scale = 1.004;
self.ggH_normalization_uncertainty_from_lep_scale = 1.021;
self.vbf_normalization_uncertainty_from_lep_scale = 1.010;
#normalization uncertainty from lep_res
if self.channel == "mu":
self.WJets_normalization_uncertainty_from_lep_res = 1.000;
self.VV_normalization_uncertainty_from_lep_res = 1.001;
self.WW_EWK_normalization_uncertainty_from_lep_res = 1.001;
self.STop_normalization_uncertainty_from_lep_res = 1.001;
self.TTbar_normalization_uncertainty_from_lep_res = 1.001;
self.ggH_normalization_uncertainty_from_lep_res = 1.001;
self.vbf_normalization_uncertainty_from_lep_res = 1.001;
elif self.channel == "el":
self.WJets_normalization_uncertainty_from_lep_res = 1.000;
self.VV_normalization_uncertainty_from_lep_res = 1.001;
self.WW_EWK_normalization_uncertainty_from_lep_res = 1.001;
self.STop_normalization_uncertainty_from_lep_res = 1.001;
self.TTbar_normalization_uncertainty_from_lep_res = 1.001;
self.ggH_normalization_uncertainty_from_lep_res = 1.001;
self.vbf_normalization_uncertainty_from_lep_res = 1.001;
elif self.channel == "em":
self.WJets_normalization_uncertainty_from_lep_res = 1.000;
self.VV_normalization_uncertainty_from_lep_res = 1.008;
self.WW_EWK_normalization_uncertainty_from_lep_res = 1.000;
self.STop_normalization_uncertainty_from_lep_res = 1.000;
self.TTbar_normalization_uncertainty_from_lep_res = 1.000;
self.ggH_normalization_uncertainty_from_lep_res = 1.008;
self.vbf_normalization_uncertainty_from_lep_res = 1.001;
#normalization uncertainty from btag
self.WJets_normalization_uncertainty_from_btag = 1.000;
self.VV_normalization_uncertainty_from_btag = 1.000;
self.WW_EWK_normalization_uncertainty_from_btag = 1.000;
self.STop_normalization_uncertainty_from_btag = 1.000;
self.TTbar_normalization_uncertainty_from_btag = 1.000;
self.ggH_normalization_uncertainty_from_btag = 1.002;
self.vbf_normalization_uncertainty_from_btag = 1.000;
#el and mu trigger and eff uncertainty, AN2012_368_v5 12.3
self.lep_trigger_uncertainty = 0.01;
self.lep_eff_uncertainty = 0.02;
#### increase shape uncertainty
self.shape_para_error_WJets0 = 1.4;
self.shape_para_error_TTbar = 2.0;
if self.higgs_sample == "BulkGraviton600" or self.higgs_sample == "BulkGraviton700":
self.shape_para_error_alpha = 1.4;
else:
self.shape_para_error_alpha = 1.4;
# shape parameter uncertainty
self.FloatingParams = RooArgList("floatpara_list");
self.FloatingParams_wjet = RooArgList("floatpara_list_wjet");
### set the TDR Style
setTDRStyle();
#### method to fit the WJets normalization inside the mj signal region -> and write the jets mass sys if available
def fit_WJetsNorm(self, scaleJetMass = 0.): # to get the normalization of WJets in signal_region
print "############### Fit mj Normalization ##################"
## fit the two version of pdf for Wjets shape if available
fit_WJetsNormalization_in_Mj_signal_region(self.workspace4fit_,self.color_palet,self.mj_shape,"_WJets0","",self.mj_shape["WJets0"],self.channel,self.wtagger_label,0,options.pseudodata,self.mj_signal_min,self.mj_signal_max,options.jetBin); ## fit jet mass distribution
self.workspace4fit_.writeToFile(self.tmpFile.GetName());
# fit_WJetsNormalization_in_Mj_signal_region(self.workspace4fit_,self.color_palet,self.mj_shape,"_WJets01","",self.mj_shape["WJets01"],self.channel,self.wtagger_label,0,options.pseudodata,self.mj_signal_min,self.mj_signal_max,options.jetBin); ## fit jet mass distribution
# self.workspace4fit_.writeToFile(self.tmpFile.GetName());
# if not options.jetBin == "_2jet":
# fit_WJetsNormalization_in_Mj_signal_region(self.workspace4fit_,self.color_palet,self.mj_shape,"_WJets1","",self.mj_shape["WJets1"],self.channel,self.wtagger_label,0,options.pseudodata,self.mj_signal_min,self.mj_signal_max,options.jetBin); ## fit jet mass distribution
# self.workspace4fit_.writeToFile(self.tmpFile.GetName());
rrv_WJets0 = self.workspace4fit_.var("rrv_number_WJets0_in_mj_signal_region_from_fitting_%s"%(self.channel)); ## nominal parametrization for Wjets
# rrv_WJets01 = self.workspace4fit_.var("rrv_number_WJets01_in_mj_signal_region_from_fitting_%s"%(self.channel)); ## alternate descrption
# if not options.jetBin == "_2jet": rrv_WJets1 = self.workspace4fit_.var("rrv_number_WJets1_in_mj_signal_region_from_fitting_%s"%(self.channel));
rrv_WJets0.Print();
# rrv_WJets01.Print();
# if not options.jetBin == "_2jet": rrv_WJets1.Print();
# if options.jetBin == "_2jet":
# total_uncertainty = TMath.Sqrt(TMath.Power(rrv_WJets0.getError(),2)+TMath.Power(rrv_WJets01.getVal()-rrv_WJets0.getVal(),2)); ## add in quadrature the difference
# else:
# total_uncertainty = TMath.Sqrt(TMath.Power(rrv_WJets0.getError(),2)+TMath.Power(rrv_WJets01.getVal()-rrv_WJets0.getVal(),2)+TMath.Power(rrv_WJets1.getVal()-rrv_WJets0.getVal(),2)); ## add in quadrature the difference
# rrv_WJets0.setError(total_uncertainty);
rrv_WJets0.Print();
# print "Total Uncertainty in WJtes0 due to fit and shape: uncertainty ",total_uncertainty/rrv_WJets0.getVal();
'''
#uncertainty due to the VBF interference
rrv_vbf = self.workspace4fit_.var("rrv_number_dataset_signal_region_%s_%s_mj"%(self.vbfhiggs_sample,self.channel))
rrv_vbfmassvbf_int_up = self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_int_up_%s_mj"%(self.vbfhiggs_sample,self.channel))
rrv_vbfmassvbf_int_dn = self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_int_dn_%s_mj"%(self.vbfhiggs_sample,self.channel))
rrv_vbf.Print();
rrv_vbfmassvbf_int_up.Print();
rrv_vbfmassvbf_int_dn.Print();
self.interference_vbfH_uncertainty = ((TMath.Abs(rrv_vbfmassvbf_int_up.getVal()-rrv_vbf.getVal())+TMath.Abs(rrv_vbfmassvbf_int_dn.getVal()-rrv_vbf.getVal() ) )/2.)/rrv_vbf.getVal();
print "Total Uncertainty on vbfH due to interference: uncertainty ",self.interference_vbfH_uncertainty;
'''
if scaleJetMass :
fit_WJetsNormalization_in_Mj_signal_region(self.workspace4fit_,self.color_palet,self.mj_shape,"_WJets0massvbf_jes_up","massvbf_jes_up",self.mj_shape["WJets0"],self.channel,self.wtagger_label,0,options.pseudodata,self.mj_signal_min,self.mj_signal_max,options.jetBin); ## fit jet mass distribution
self.workspace4fit_.writeToFile(self.tmpFile.GetName());
fit_WJetsNormalization_in_Mj_signal_region(self.workspace4fit_,self.color_palet,self.mj_shape,"_WJets0massvbf_jes_dn","massvbf_jes_dn",self.mj_shape["WJets0"],self.channel,self.wtagger_label,0,options.pseudodata,self.mj_signal_min,self.mj_signal_max,options.jetBin); ## fit jet mass distribution
self.workspace4fit_.writeToFile(self.tmpFile.GetName());
fit_WJetsNormalization_in_Mj_signal_region(self.workspace4fit_,self.color_palet,self.mj_shape,"_WJets0massvbf_jer","massvbf_jer",self.mj_shape["WJets0"],self.channel,self.wtagger_label,0,options.pseudodata,self.mj_signal_min,self.mj_signal_max,options.jetBin); ## fit jet mass distribution
self.workspace4fit_.writeToFile(self.tmpFile.GetName());
fit_WJetsNormalization_in_Mj_signal_region(self.workspace4fit_,self.color_palet,self.mj_shape,"_WJets0massvbf_jer_up","massvbf_jer_up",self.mj_shape["WJets0"],self.channel,self.wtagger_label,0,options.pseudodata,self.mj_signal_min,self.mj_signal_max,options.jetBin); ## fit jet mass distribution
self.workspace4fit_.writeToFile(self.tmpFile.GetName());
fit_WJetsNormalization_in_Mj_signal_region(self.workspace4fit_,self.color_palet,self.mj_shape,"_WJets0massvbf_jer_dn","massvbf_jer_dn",self.mj_shape["WJets0"],self.channel,self.wtagger_label,0,options.pseudodata,self.mj_signal_min,self.mj_signal_max,options.jetBin); ## fit jet mass distribution
self.workspace4fit_.writeToFile(self.tmpFile.GetName());
rrv_WJetsmassvbf_jes_up = self.workspace4fit_.var("rrv_number_WJets0massvbf_jes_up_in_mj_signal_region_from_fitting_%s"%(self.channel));
rrv_WJetsmassvbf_jes_dn = self.workspace4fit_.var("rrv_number_WJets0massvbf_jes_dn_in_mj_signal_region_from_fitting_%s"%(self.channel));
rrv_WJetsmassvbf_jer = self.workspace4fit_.var("rrv_number_WJets0massvbf_jer_in_mj_signal_region_from_fitting_%s"%(self.channel));
rrv_WJetsmassvbf_jer_up = self.workspace4fit_.var("rrv_number_WJets0massvbf_jer_up_in_mj_signal_region_from_fitting_%s"%(self.channel));
rrv_WJetsmassvbf_jer_dn = self.workspace4fit_.var("rrv_number_WJets0massvbf_jer_dn_in_mj_signal_region_from_fitting_%s"%(self.channel));
print "######################### wjets scale and resolution effect " ;
rrv_WJetsmassvbf_jes_up.Print();
rrv_WJetsmassvbf_jes_dn.Print();
rrv_WJetsmassvbf_jer.Print();
rrv_WJetsmassvbf_jer_up.Print();
rrv_WJetsmassvbf_jer_dn.Print();
#jet mass uncertainty on WJets normalization
if(self.workspace4fit_.var("rrv_number_WJets0massvbf_jes_up_in_mj_signal_region_from_fitting_%s"%(self.channel)) and self.workspace4fit_.var("rrv_number_WJets0massvbf_jes_dn_in_mj_signal_region_from_fitting_%s"%(self.channel)) and self.workspace4fit_.var("rrv_number_WJets0massvbf_jer_in_mj_signal_region_from_fitting_%s"%(self.channel)) and self.workspace4fit_.var("rrv_number_WJets0massvbf_jer_up_in_mj_signal_region_from_fitting_%s"%(self.channel)) and self.workspace4fit_.var("rrv_number_WJets0massvbf_jer_dn_in_mj_signal_region_from_fitting_%s"%(self.channel))):
self.WJets_normalization_uncertainty_from_jet_scale = ((TMath.Abs(rrv_WJetsmassvbf_jes_up.getVal()-rrv_WJets0.getVal())+TMath.Abs(rrv_WJetsmassvbf_jes_dn.getVal()-rrv_WJets0.getVal() ) )/2.)/rrv_WJets0.getVal();
print "Total Uncertainty on WJtes0 due to jes: relaxed uncertainty ",self.WJets_normalization_uncertainty_from_jet_scale;
self.WJets_normalization_uncertainty_from_jet_res = ((TMath.Abs(rrv_WJetsmassvbf_jer.getVal()-rrv_WJets0.getVal())+TMath.Abs(rrv_WJetsmassvbf_jer_up.getVal()-rrv_WJets0.getVal() )+TMath.Abs(rrv_WJetsmassvbf_jer_dn.getVal()-rrv_WJets0.getVal() ) )/3.)/rrv_WJets0.getVal();
print "Total Uncertainty on WJtes0 due to jes: relaxed uncertainty ",self.WJets_normalization_uncertainty_from_jet_res;
#jet mass uncertainty on sTop normalization
rrv_STop = self.workspace4fit_.var("rrv_number_dataset_signal_region_STop_%s_mj"%(self.channel))
rrv_STopmassvbf_jes_up = self.workspace4fit_.var("rrv_number_dataset_signal_region_STopmassvbf_jes_up_%s_mj"%(self.channel))
rrv_STopmassvbf_jes_dn = self.workspace4fit_.var("rrv_number_dataset_signal_region_STopmassvbf_jes_dn_%s_mj"%(self.channel))
rrv_STopmassvbf_jer = self.workspace4fit_.var("rrv_number_dataset_signal_region_STopmassvbf_jer_%s_mj"%(self.channel))
rrv_STopmassvbf_jer_up = self.workspace4fit_.var("rrv_number_dataset_signal_region_STopmassvbf_jer_up_%s_mj"%(self.channel))
rrv_STopmassvbf_jer_dn = self.workspace4fit_.var("rrv_number_dataset_signal_region_STopmassvbf_jer_dn_%s_mj"%(self.channel))
rrv_STop.Print();
rrv_STopmassvbf_jes_up.Print();
rrv_STopmassvbf_jes_dn.Print();
rrv_STopmassvbf_jer.Print();
rrv_STopmassvbf_jer_up.Print();
rrv_STopmassvbf_jer_dn.Print();
#jet mass uncertainty on STop normalization
if(self.workspace4fit_.var("rrv_number_dataset_signal_region_STopmassvbf_jes_up_%s_mj"%(self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_STopmassvbf_jes_dn_%s_mj"%(self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_STopmassvbf_jer_up_%s_mj"%(self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_STopmassvbf_jer_dn_%s_mj"%(self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_STopmassvbf_jer_%s_mj"%(self.channel))):
self.STop_normalization_uncertainty_from_jet_scale = ((TMath.Abs(rrv_STopmassvbf_jes_up.getVal()-rrv_STop.getVal())+TMath.Abs(rrv_STopmassvbf_jes_dn.getVal()-rrv_STop.getVal() ) )/2.)/rrv_STop.getVal();
print "Total Uncertainty on STop due to jes: uncertainty ",self.STop_normalization_uncertainty_from_jet_scale;
self.STop_normalization_uncertainty_from_jet_res = ((TMath.Abs(rrv_STopmassvbf_jer.getVal()-rrv_STop.getVal())+TMath.Abs(rrv_STopmassvbf_jer_up.getVal()-rrv_STop.getVal() )+TMath.Abs(rrv_STopmassvbf_jer_dn.getVal()-rrv_STop.getVal() ) )/3.)/rrv_STop.getVal();
print "Total Uncertainty on STop due to jer: uncertainty ",self.STop_normalization_uncertainty_from_jet_res;
#jet mass uncertainty on TTbar normalization
rrv_TTbar = self.workspace4fit_.var("rrv_number_dataset_signal_region_TTbar_%s_mj"%(self.channel))
rrv_TTbarmassvbf_jes_up = self.workspace4fit_.var("rrv_number_dataset_signal_region_TTbarmassvbf_jes_up_%s_mj"%(self.channel))
rrv_TTbarmassvbf_jes_dn = self.workspace4fit_.var("rrv_number_dataset_signal_region_TTbarmassvbf_jes_dn_%s_mj"%(self.channel))
rrv_TTbarmassvbf_jer = self.workspace4fit_.var("rrv_number_dataset_signal_region_TTbarmassvbf_jer_%s_mj"%(self.channel))
rrv_TTbarmassvbf_jer_dn = self.workspace4fit_.var("rrv_number_dataset_signal_region_TTbarmassvbf_jer_up_%s_mj"%(self.channel))
rrv_TTbarmassvbf_jer_up = self.workspace4fit_.var("rrv_number_dataset_signal_region_TTbarmassvbf_jer_dn_%s_mj"%(self.channel))
rrv_TTbar.Print();
rrv_TTbarmassvbf_jes_up.Print();
rrv_TTbarmassvbf_jes_dn.Print();
rrv_TTbarmassvbf_jer.Print();
rrv_TTbarmassvbf_jer_up.Print();
rrv_TTbarmassvbf_jer_dn.Print();
#jet mass uncertainty on TTbar normalization
if(self.workspace4fit_.var("rrv_number_dataset_signal_region_TTbarmassvbf_jes_up_%s_mj"%(self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_TTbarmassvbf_jes_dn_%s_mj"%(self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_TTbarmassvbf_jer_up_%s_mj"%(self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_TTbarmassvbf_jer_dn_%s_mj"%(self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_TTbarmassvbf_jer_%s_mj"%(self.channel))):
self.TTbar_normalization_uncertainty_from_jet_scale = ((TMath.Abs(rrv_TTbarmassvbf_jes_up.getVal()-rrv_TTbar.getVal())+TMath.Abs(rrv_TTbarmassvbf_jes_dn.getVal()-rrv_TTbar.getVal() ) )/2.)/rrv_TTbar.getVal();
print "Total Uncertainty on TTbar due to jes: uncertainty ",self.TTbar_normalization_uncertainty_from_jet_scale;
self.TTbar_normalization_uncertainty_from_jet_res = ((TMath.Abs(rrv_TTbarmassvbf_jer.getVal()-rrv_TTbar.getVal())+TMath.Abs(rrv_TTbarmassvbf_jer_up.getVal()-rrv_TTbar.getVal() )+TMath.Abs(rrv_TTbarmassvbf_jer_dn.getVal()-rrv_TTbar.getVal() ) )/3.)/rrv_TTbar.getVal();
print "Total Uncertainty on TTbar due to jer: uncertainty ",self.TTbar_normalization_uncertainty_from_jet_res;
#jet mass uncertainty on VV normalization
rrv_VV = self.workspace4fit_.var("rrv_number_dataset_signal_region_VV_%s_mj"%(self.channel))
rrv_VVmassvbf_jes_up = self.workspace4fit_.var("rrv_number_dataset_signal_region_VVmassvbf_jes_up_%s_mj"%(self.channel))
rrv_VVmassvbf_jes_dn = self.workspace4fit_.var("rrv_number_dataset_signal_region_VVmassvbf_jes_dn_%s_mj"%(self.channel))
rrv_VVmassvbf_jer = self.workspace4fit_.var("rrv_number_dataset_signal_region_VVmassvbf_jer_%s_mj"%(self.channel))
rrv_VVmassvbf_jer_up = self.workspace4fit_.var("rrv_number_dataset_signal_region_VVmassvbf_jer_up_%s_mj"%(self.channel))
rrv_VVmassvbf_jer_dn = self.workspace4fit_.var("rrv_number_dataset_signal_region_VVmassvbf_jer_dn_%s_mj"%(self.channel))
rrv_VV.Print();
rrv_VVmassvbf_jes_up.Print();
rrv_VVmassvbf_jes_dn.Print();
rrv_VVmassvbf_jer_up.Print();
rrv_VVmassvbf_jer_dn.Print();
rrv_VVmassvbf_jer.Print();
#jet mass uncertainty on VV normalization
if(self.workspace4fit_.var("rrv_number_dataset_signal_region_VVmassvbf_jes_up_%s_mj"%(self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_VVmassvbf_jes_dn_%s_mj"%(self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_VVmassvbf_jer_up_%s_mj"%(self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_VVmassvbf_jer_dn_%s_mj"%(self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_VVmassvbf_jer_%s_mj"%(self.channel))):
self.VV_normalization_uncertainty_from_jet_scale = ((TMath.Abs(rrv_VVmassvbf_jes_up.getVal()-rrv_VV.getVal())+TMath.Abs(rrv_VVmassvbf_jes_dn.getVal()-rrv_VV.getVal() ) )/2.)/rrv_VV.getVal();
print "Total Uncertainty on VV due to jes: uncertainty ",self.VV_normalization_uncertainty_from_jet_scale;
self.VV_normalization_uncertainty_from_jet_res = ((TMath.Abs(rrv_VVmassvbf_jer_up.getVal()-rrv_VV.getVal())+TMath.Abs(rrv_VVmassvbf_jer_dn.getVal()-rrv_VV.getVal() )+TMath.Abs(rrv_VVmassvbf_jer.getVal()-rrv_VV.getVal() ) )/3.)/rrv_VV.getVal();
print "Total Uncertainty on VV due to jer: uncertainty ",self.VV_normalization_uncertainty_from_jet_res;
#jet mass uncertainty on WW_EWK normalization
if options.jetBin == "_2jet" :
rrv_WW_EWK = self.workspace4fit_.var("rrv_number_dataset_signal_region_WW_EWK_%s_mj"%(self.channel))
rrv_WW_EWKmassvbf_jes_up = self.workspace4fit_.var("rrv_number_dataset_signal_region_WW_EWKmassvbf_jes_up_%s_mj"%(self.channel))
rrv_WW_EWKmassvbf_jes_dn = self.workspace4fit_.var("rrv_number_dataset_signal_region_WW_EWKmassvbf_jes_dn_%s_mj"%(self.channel))
rrv_WW_EWKmassvbf_jer = self.workspace4fit_.var("rrv_number_dataset_signal_region_WW_EWKmassvbf_jer_%s_mj"%(self.channel))
rrv_WW_EWKmassvbf_jer_up = self.workspace4fit_.var("rrv_number_dataset_signal_region_WW_EWKmassvbf_jer_up_%s_mj"%(self.channel))
rrv_WW_EWKmassvbf_jer_dn = self.workspace4fit_.var("rrv_number_dataset_signal_region_WW_EWKmassvbf_jer_dn_%s_mj"%(self.channel))
rrv_WW_EWK.Print();
rrv_WW_EWKmassvbf_jes_up.Print();
rrv_WW_EWKmassvbf_jes_dn.Print();
rrv_WW_EWKmassvbf_jer_up.Print();
rrv_WW_EWKmassvbf_jer_dn.Print();
rrv_WW_EWKmassvbf_jer.Print();
#jet mass uncertainty on WW_EWK normalization
if(self.workspace4fit_.var("rrv_number_dataset_signal_region_WW_EWKmassvbf_jes_up_%s_mj"%(self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_WW_EWKmassvbf_jes_dn_%s_mj"%(self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_WW_EWKmassvbf_jer_up_%s_mj"%(self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_WW_EWKmassvbf_jer_dn_%s_mj"%(self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_WW_EWKmassvbf_jer_%s_mj"%(self.channel))):
self.WW_EWK_normalization_uncertainty_from_jet_scale = ((TMath.Abs(rrv_WW_EWKmassvbf_jes_up.getVal()-rrv_WW_EWK.getVal())+TMath.Abs(rrv_WW_EWKmassvbf_jes_dn.getVal()-rrv_WW_EWK.getVal() ) )/2.)/rrv_WW_EWK.getVal();
print "Total Uncertainty on WW_EWK due to jes: uncertainty ",self.WW_EWK_normalization_uncertainty_from_jet_scale;
self.WW_EWK_normalization_uncertainty_from_jet_res = ((TMath.Abs(rrv_WW_EWKmassvbf_jer_up.getVal()-rrv_WW_EWK.getVal())+TMath.Abs(rrv_WW_EWKmassvbf_jer_dn.getVal()-rrv_WW_EWK.getVal() )+TMath.Abs(rrv_WW_EWKmassvbf_jer.getVal()-rrv_WW_EWK.getVal() ) )/3.)/rrv_WW_EWK.getVal();
print "Total Uncertainty on WW_EWK due to jer: uncertainty ",self.WW_EWK_normalization_uncertainty_from_jet_res;
#jet mass uncertainty on ggH normalization
rrv_ggH = self.workspace4fit_.var("rrv_number_dataset_signal_region_%s_%s_mj"%(self.higgs_sample,self.channel))
rrv_ggHmassvbf_jes_up = self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jes_up_%s_mj"%(self.higgs_sample,self.channel))
rrv_ggHmassvbf_jes_dn = self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jes_dn_%s_mj"%(self.higgs_sample,self.channel))
rrv_ggHmassvbf_jer = self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jer_%s_mj"%(self.higgs_sample,self.channel))
rrv_ggHmassvbf_jer_up = self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jer_up_%s_mj"%(self.higgs_sample,self.channel))
rrv_ggHmassvbf_jer_dn = self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jer_dn_%s_mj"%(self.higgs_sample,self.channel))
rrv_ggH.Print();
rrv_ggHmassvbf_jes_up.Print();
rrv_ggHmassvbf_jes_dn.Print();
rrv_ggHmassvbf_jer.Print();
rrv_ggHmassvbf_jer_up.Print();
rrv_ggHmassvbf_jer_dn.Print();
#jet mass uncertainty on ggH normalization
if(self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jes_up_%s_mj"%(self.higgs_sample,self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jes_up_%s_mj"%(self.higgs_sample,self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jer_up_%s_mj"%(self.higgs_sample,self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jes_dn_%s_mj"%(self.higgs_sample,self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jer_%s_mj"%(self.higgs_sample,self.channel))):
self.ggH_normalization_uncertainty_from_jet_scale = ((TMath.Abs(rrv_ggHmassvbf_jes_up.getVal()-rrv_ggH.getVal())+TMath.Abs(rrv_ggHmassvbf_jes_dn.getVal()-rrv_ggH.getVal() ) )/2.)/rrv_ggH.getVal();
print "Total Uncertainty on BulkGraviton due to jes: uncertainty ",self.ggH_normalization_uncertainty_from_jet_scale;
self.ggH_normalization_uncertainty_from_jet_res = ((TMath.Abs(rrv_ggHmassvbf_jer_up.getVal()-rrv_ggH.getVal())+TMath.Abs(rrv_ggHmassvbf_jer_dn.getVal()-rrv_ggH.getVal() )+TMath.Abs(rrv_ggHmassvbf_jer.getVal()-rrv_ggH.getVal() ) )/3.)/rrv_ggH.getVal();
print "Total Uncertainty on BulkGraviton due to jer: uncertainty ",self.ggH_normalization_uncertainty_from_jet_res;
#jet mass uncertainty on vbf normalizatio
rrv_vbfmassvbf_jes_up = self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jes_up_%s_mj"%(self.vbfhiggs_sample,self.channel))
rrv_vbfmassvbf_jes_dn = self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jes_dn_%s_mj"%(self.vbfhiggs_sample,self.channel))
rrv_vbfmassvbf_jer_up = self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jer_up_%s_mj"%(self.vbfhiggs_sample,self.channel))
rrv_vbfmassvbf_jer_dn = self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jer_dn_%s_mj"%(self.vbfhiggs_sample,self.channel))
rrv_vbfmassvbf_jer = self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jer_%s_mj"%(self.vbfhiggs_sample,self.channel))
rrv_vbfmassvbf_jes_up.Print();
rrv_vbfmassvbf_jes_dn.Print();
rrv_vbfmassvbf_jer_up.Print();
rrv_vbfmassvbf_jer_dn.Print();
rrv_vbfmassvbf_jer.Print();
#jet mass uncertainty on vbf normalization
if(self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jes_up_%s_mj"%(self.vbfhiggs_sample,self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jes_dn_%s_mj"%(self.vbfhiggs_sample,self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jer_up_%s_mj"%(self.vbfhiggs_sample,self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jer_dn_%s_mj"%(self.vbfhiggs_sample,self.channel)) and self.workspace4fit_.var("rrv_number_dataset_signal_region_%smassvbf_jer_%s_mj"%(self.vbfhiggs_sample,self.channel))):
self.vbf_normalization_uncertainty_from_jet_scale = ((TMath.Abs(rrv_vbfmassvbf_jes_up.getVal()-rrv_vbf.getVal())+TMath.Abs(rrv_vbfmassvbf_jes_dn.getVal()-rrv_vbf.getVal() ) )/2.)/rrv_vbf.getVal();
print "Total Uncertainty on vbfH due to jes: uncertainty ",self.vbf_normalization_uncertainty_from_jet_scale;
self.vbf_normalization_uncertainty_from_jet_res = ((TMath.Abs(rrv_vbfmassvbf_jer_up.getVal()-rrv_vbf.getVal())+TMath.Abs(rrv_vbfmassvbf_jer_dn.getVal()-rrv_vbf.getVal() )+TMath.Abs(rrv_vbfmassvbf_jer.getVal()-rrv_vbf.getVal() ) )/3.)/rrv_vbf.getVal();
print "Total Uncertainty on vbfH due to jer: uncertainty ",self.vbf_normalization_uncertainty_from_jet_res;
##### Method used to cycle on the events and for the dataset to be fitted
def get_mj_and_mlvj_dataset(self,in_file_name, label, jet_mass="jet_mass_pr"):# to get the shape of m_lvj
# read in tree
fileIn_name = TString(self.file_Directory+in_file_name);
fileIn = TFile(fileIn_name.Data());
treeIn = fileIn.Get("otree");
rrv_mass_j = self.workspace4fit_.var("rrv_mass_j")
rrv_mass_lvj = self.workspace4fit_.var("rrv_mass_lvj")
rrv_mass_gen_WW = self.workspace4fit_.var("rrv_mass_gen_WW")
rrv_weight = RooRealVar("rrv_weight","rrv_weight",0. ,10000000.)
# dataset of m_j -> before and after vbf cuts -> central object value
rdataset_mj = RooDataSet("rdataset"+label+"_"+self.channel+"_mj","rdataset"+label+"_"+self.channel+"_mj",RooArgSet(rrv_mass_j,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_mj = RooDataSet("rdataset4fit"+label+"_"+self.channel+"_mj","rdataset4fit"+label+"_"+self.channel+"_mj",RooArgSet(rrv_mass_j,rrv_weight),RooFit.WeightVar(rrv_weight) );
if TString(label).Contains("BulkGraviton") or TString(label).Contains("vbfH"):
rdataset4fit_m_WW_gen = RooDataSet("rdataset4fit"+label+"_genHMass_"+self.channel,"rdataset4fit"+label+"_genHMass_"+self.channel,RooArgSet(rrv_mass_gen_WW,rrv_weight),RooFit.WeightVar(rrv_weight));
if TString(label).Contains("vbfH") or TString(label).Contains("BulkGraviton"):
rdataset_signal_region_mlvj_int_up = RooDataSet("rdataset"+label+"massvbf_int_up"+"_signal_region"+"_"+self.channel+"_mlvj","rdataset"+label+"massvbf_int_up"+"_signal_region"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_signal_region_mlvj_int_dn = RooDataSet("rdataset"+label+"massvbf_int_dn"+"_signal_region"+"_"+self.channel+"_mlvj","rdataset"+label+"massvbf_int_dn"+"_signal_region"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_signal_region_mlvj_int_up = RooDataSet("rdataset4fit"+label+"massvbf_int_up"+"_signal_region"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"massvbf_int_up"+"_signal_region"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_signal_region_mlvj_int_dn = RooDataSet("rdataset4fit"+label+"massvbf_int_dn"+"_signal_region"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"massvbf_int_dn"+"_signal_region"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_mj_int_up = RooDataSet("rdataset"+label+"massvbf_int_up"+"_"+self.channel+"_mj","rdataset"+label+"massvbf_int_up"+"_"+self.channel+"_mj",RooArgSet(rrv_mass_j,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_mj_int_up = RooDataSet("rdataset4fit"+label+"massvbf_int_up"+"_"+self.channel+"_mj","rdataset4fit"+label+"massvbf_int_up"+"_"+self.channel+"_mj",RooArgSet(rrv_mass_j,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_mj_int_dn = RooDataSet("rdataset"+label+"massvbf_int_dn"+"_"+self.channel+"_mj","rdataset"+label+"massvbf_int_dn"+"_"+self.channel+"_mj",RooArgSet(rrv_mass_j,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_mj_int_dn = RooDataSet("rdataset4fit"+label+"massvbf_int_dn"+"_"+self.channel+"_mj","rdataset4fit"+label+"massvbf_int_dn"+"_"+self.channel+"_mj",RooArgSet(rrv_mass_j,rrv_weight),RooFit.WeightVar(rrv_weight) );
#dataset of m_lvj -> before and after vbf cuts -> central object value
rdataset_sb_lo_mlvj = RooDataSet("rdataset"+label+"_sb_lo"+"_"+self.channel+"_mlvj","rdataset"+label+"_sb_lo"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_signal_region_mlvj = RooDataSet("rdataset"+label+"_signal_region"+"_"+self.channel+"_mlvj","rdataset"+label+"_signal_region"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_sb_hi_mlvj = RooDataSet("rdataset"+label+"_sb_hi"+"_"+self.channel+"_mlvj","rdataset"+label+"_sb_hi"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_sb_lo_mlvj = RooDataSet("rdataset4fit"+label+"_sb_lo"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"_sb_lo"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_signal_region_mlvj = RooDataSet("rdataset4fit"+label+"_signal_region"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"_signal_region"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_sb_hi_mlvj = RooDataSet("rdataset4fit"+label+"_sb_hi"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"_sb_hi"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
if label != "_WJets01" and label != "_WJets1" and label !="_data" and not options.skipJetSystematics:
#dataset of jes_up
rdataset_mj_jes_up = RooDataSet("rdataset"+label+"massvbf_jes_up"+"_"+self.channel+"_mj","rdataset"+label+"massvbf_jes_up"+"_"+self.channel+"_mj",RooArgSet(rrv_mass_j,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_mj_jes_up = RooDataSet("rdataset4fit"+label+"massvbf_jes_up"+"_"+self.channel+"_mj","rdataset4fit"+label+"massvbf_jes_up"+"_"+self.channel+"_mj",RooArgSet(rrv_mass_j,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_sb_lo_mlvj_jes_up = RooDataSet("rdataset"+label+"massvbf_jes_up"+"_sb_lo"+"_"+self.channel+"_mlvj","rdataset"+label+"massvbf_jes_up"+"_sb_lo"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_signal_region_mlvj_jes_up = RooDataSet("rdataset"+label+"massvbf_jes_up"+"_signal_region"+"_"+self.channel+"_mlvj","rdataset"+label+"massvbf_jes_up"+"_signal_region"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_sb_hi_mlvj_jes_up = RooDataSet("rdataset"+label+"massvbf_jes_up"+"_sb_hi"+"_"+self.channel+"_mlvj","rdataset"+label+"massvbf_jes_up"+"_sb_hi"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_sb_lo_mlvj_jes_up = RooDataSet("rdataset4fit"+label+"massvbf_jes_up"+"_sb_lo"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"massvbf_jes_up"+"_sb_lo"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_signal_region_mlvj_jes_up = RooDataSet("rdataset4fit"+label+"massvbf_jes_up"+"_signal_region"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"massvbf_jes_up"+"_signal_region"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_sb_hi_mlvj_jes_up = RooDataSet("rdataset4fit"+label+"massvbf_jes_up"+"_sb_hi"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"massvbf_jes_up"+"_sb_hi"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
#dataset of applying jes dn
rdataset_mj_jes_dn = RooDataSet("rdataset"+label+"massvbf_jes_dn"+"_"+self.channel+"_mj","rdataset"+label+"massvbf_jes_dn"+"_"+self.channel+"_mj",RooArgSet(rrv_mass_j,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_mj_jes_dn = RooDataSet("rdataset4fit"+label+"massvbf_jes_dn"+"_"+self.channel+"_mj","rdataset4fit"+label+"massvbf_jes_dn"+"_"+self.channel+"_mj",RooArgSet(rrv_mass_j,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_sb_lo_mlvj_jes_dn = RooDataSet("rdataset"+label+"massvbf_jes_dn"+"_sb_lo"+"_"+self.channel+"_mlvj","rdataset"+label+"massvbf_jes_dn"+"_sb_lo"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_signal_region_mlvj_jes_dn = RooDataSet("rdataset"+label+"massvbf_jes_dn"+"_signal_region"+"_"+self.channel+"_mlvj","rdataset"+label+"massvbf_jes_dn"+"_signal_region"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_sb_hi_mlvj_jes_dn = RooDataSet("rdataset"+label+"massvbf_jes_dn"+"_sb_hi"+"_"+self.channel+"_mlvj","rdataset"+label+"massvbf_jes_dn"+"_sb_hi"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_sb_lo_mlvj_jes_dn = RooDataSet("rdataset4fit"+label+"massvbf_jes_dn"+"_sb_lo"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"massvbf_jes_dn"+"_sb_lo"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_signal_region_mlvj_jes_dn = RooDataSet("rdataset4fit"+label+"massvbf_jes_dn"+"_signal_region"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"massvbf_jes_dn"+"_signal_region"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_sb_hi_mlvj_jes_dn = RooDataSet("rdataset4fit"+label+"massvbf_jes_dn"+"_sb_hi"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"massvbf_jes_dn"+"_sb_hi"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
#dataset of applying jer up
rdataset_mj_jer_up = RooDataSet("rdataset"+label+"massvbf_jer_up"+"_"+self.channel+"_mj","rdataset"+label+"massvbf_jer_up"+"_"+self.channel+"_mj",RooArgSet(rrv_mass_j,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_mj_jer_up = RooDataSet("rdataset4fit"+label+"massvbf_jer_up"+"_"+self.channel+"_mj","rdataset4fit"+label+"massvbf_jer_up"+"_"+self.channel+"_mj",RooArgSet(rrv_mass_j,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_sb_lo_mlvj_jer_up = RooDataSet("rdataset"+label+"massvbf_jer_up"+"_sb_lo"+"_"+self.channel+"_mlvj","rdataset"+label+"massvbf_jer_up"+"_sb_lo"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_signal_region_mlvj_jer_up = RooDataSet("rdataset"+label+"massvbf_jer_up"+"_signal_region"+"_"+self.channel+"_mlvj","rdataset"+label+"massvbf_jer_up"+"_signal_region"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_sb_hi_mlvj_jer_up = RooDataSet("rdataset"+label+"massvbf_jer_up"+"_sb_hi"+"_"+self.channel+"_mlvj","rdataset"+label+"massvbf_jer_up"+"_sb_hi"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_sb_lo_mlvj_jer_up = RooDataSet("rdataset4fit"+label+"massvbf_jer_up"+"_sb_lo"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"massvbf_jer_up"+"_sb_lo"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_signal_region_mlvj_jer_up = RooDataSet("rdataset4fit"+label+"massvbf_jer_up"+"_signal_region"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"massvbf_jer_up"+"_signal_region"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_sb_hi_mlvj_jer_up = RooDataSet("rdataset4fit"+label+"massvbf_jer_up"+"_sb_hi"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"massvbf_jer_up"+"_sb_hi"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
#dataset of applying jer dn
rdataset_mj_jer_dn = RooDataSet("rdataset"+label+"massvbf_jer_dn"+"_"+self.channel+"_mj","rdataset"+label+"massvbf_jer_dn"+"_"+self.channel+"_mj",RooArgSet(rrv_mass_j,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_mj_jer_dn = RooDataSet("rdataset4fit"+label+"massvbf_jer_dn"+"_"+self.channel+"_mj","rdataset4fit"+label+"massvbf_jer_dn"+"_"+self.channel+"_mj",RooArgSet(rrv_mass_j,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_sb_lo_mlvj_jer_dn = RooDataSet("rdataset"+label+"massvbf_jer_dn"+"_sb_lo"+"_"+self.channel+"_mlvj","rdataset"+label+"massvbf_jer_dn"+"_sb_lo"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_signal_region_mlvj_jer_dn = RooDataSet("rdataset"+label+"massvbf_jer_dn"+"_signal_region"+"_"+self.channel+"_mlvj","rdataset"+label+"massvbf_jer_dn"+"_signal_region"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_sb_hi_mlvj_jer_dn = RooDataSet("rdataset"+label+"massvbf_jer_dn"+"_sb_hi"+"_"+self.channel+"_mlvj","rdataset"+label+"massvbf_jer_dn"+"_sb_hi"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_sb_lo_mlvj_jer_dn = RooDataSet("rdataset4fit"+label+"massvbf_jer_dn"+"_sb_lo"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"massvbf_jer_dn"+"_sb_lo"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_signal_region_mlvj_jer_dn = RooDataSet("rdataset4fit"+label+"massvbf_jer_dn"+"_signal_region"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"massvbf_jer_dn"+"_signal_region"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_sb_hi_mlvj_jer_dn = RooDataSet("rdataset4fit"+label+"massvbf_jer_dn"+"_sb_hi"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"massvbf_jer_dn"+"_sb_hi"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
#dataset of applying jer
rdataset_mj_jer = RooDataSet("rdataset"+label+"massvbf_jer"+"_"+self.channel+"_mj","rdataset"+label+"massvbf_jer"+"_"+self.channel+"_mj",RooArgSet(rrv_mass_j,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_mj_jer = RooDataSet("rdataset4fit"+label+"massvbf_jer"+"_"+self.channel+"_mj","rdataset4fit"+label+"massvbf_jer"+"_"+self.channel+"_mj",RooArgSet(rrv_mass_j,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_sb_lo_mlvj_jer = RooDataSet("rdataset"+label+"massvbf_jer"+"_sb_lo"+"_"+self.channel+"_mlvj","rdataset"+label+"massvbf_jer"+"_sb_lo"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_signal_region_mlvj_jer = RooDataSet("rdataset"+label+"massvbf_jer"+"_signal_region"+"_"+self.channel+"_mlvj","rdataset"+label+"massvbf_jer"+"_signal_region"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset_sb_hi_mlvj_jer = RooDataSet("rdataset"+label+"massvbf_jer"+"_sb_hi"+"_"+self.channel+"_mlvj","rdataset"+label+"massvbf_jer"+"_sb_hi"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_sb_lo_mlvj_jer = RooDataSet("rdataset4fit"+label+"massvbf_jer"+"_sb_lo"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"massvbf_jer"+"_sb_lo"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_signal_region_mlvj_jer = RooDataSet("rdataset4fit"+label+"massvbf_jer"+"_signal_region"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"massvbf_jer"+"_signal_region"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
rdataset4fit_sb_hi_mlvj_jer = RooDataSet("rdataset4fit"+label+"massvbf_jer"+"_sb_hi"+"_"+self.channel+"_mlvj","rdataset4fit"+label+"massvbf_jer"+"_sb_hi"+"_"+self.channel+"_mlvj",RooArgSet(rrv_mass_lvj,rrv_weight),RooFit.WeightVar(rrv_weight) );
###### Define the event categorization
data_category = RooCategory("data_category","data_category");
data_category.defineType("sideband");
data_category.defineType("signal_region");
combData = RooDataSet("combData"+label+"_"+self.channel,"combData"+label+"_"+self.channel,RooArgSet(rrv_mass_lvj, data_category, rrv_weight),RooFit.WeightVar(rrv_weight) );
combData4fit = RooDataSet("combData4fit"+label+"_"+self.channel,"combData4fit"+label+"_"+self.channel,RooArgSet(rrv_mass_lvj, data_category, rrv_weight),RooFit.WeightVar(rrv_weight) );
if label != "_WJets01" and label != "_WJets1" and label !="_data" and not options.skipJetSystematics:
## jes_up
combData_jes_up = RooDataSet("combData"+label+"massvbf_jes_up"+"_"+self.channel,"combData"+label+"massvbf_jes_up"+"_"+self.channel,RooArgSet(rrv_mass_lvj, data_category, rrv_weight),RooFit.WeightVar(rrv_weight) );
combData4fit_jes_up = RooDataSet("combData4fit"+label+"massvbf_jes_up"+"_"+self.channel,"combData4fit"+label+"massvbf_jes_up"+"_"+self.channel,RooArgSet(rrv_mass_lvj, data_category, rrv_weight),RooFit.WeightVar(rrv_weight) );
## jes_dn
combData_jes_dn = RooDataSet("combData"+label+"massvbf_jes_dn"+"_"+self.channel,"combData"+label+"massvbf_jes_dn"+"_"+self.channel,RooArgSet(rrv_mass_lvj, data_category, rrv_weight),RooFit.WeightVar(rrv_weight) );
combData4fit_jes_dn = RooDataSet("combData4fit"+label+"massvbf_jes_dn"+"_"+self.channel,"combData4fit"+label+"massvbf_jes_dn"+"_"+self.channel,RooArgSet(rrv_mass_lvj, data_category, rrv_weight),RooFit.WeightVar(rrv_weight) );
## jer_up
combData_jer_up = RooDataSet("combData"+label+"massvbf_jer_up"+"_"+self.channel,"combData"+label+"massvbf_jer_up"+"_"+self.channel,RooArgSet(rrv_mass_lvj, data_category, rrv_weight),RooFit.WeightVar(rrv_weight) );
combData4fit_jer_up = RooDataSet("combData4fit"+label+"massvbf_jer_up"+"_"+self.channel,"combData4fit"+label+"massvbf_jer_up"+"_"+self.channel,RooArgSet(rrv_mass_lvj, data_category, rrv_weight),RooFit.WeightVar(rrv_weight) );
## jer_dn