forked from zixu/boostedWWAnalysis
-
Notifications
You must be signed in to change notification settings - Fork 3
/
sampleWrapperClass.py
3537 lines (2826 loc) · 244 KB
/
sampleWrapperClass.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
# A class which takes histograms and plots them in a versatile way
# inputs are file names which can b "data" or "MC"
import ROOT
import os
import sys
import math
from array import array
from optparse import OptionParser
from ROOT import RooTrace
from ROOT import TTree
from ROOT import gROOT
from bsmReweighter import *
import sys
from DataFormats.FWLite import Events, Handle
ROOT.gStyle.SetPalette(1)
ROOT.gStyle.SetOptFit(0)
ROOT.TH1.SetDefaultSumw2()
ROOT.TH2.SetDefaultSumw2()
ROOT.gStyle.SetPadTopMargin(0.09);
ROOT.gStyle.SetPadLeftMargin(0.16);
# FWLITE stuff
ROOT.gSystem.Load('libCondFormatsJetMETObjects')
ROOT.gSystem.Load('libFWCoreFWLite');
ROOT.gSystem.Load('libFWCoreUtilities');
### ------------ h e l p e r s --------------------
def deltaphi(phi1,phi2):
if math.fabs(phi1-phi2) > ROOT.TMath.Pi() :
return (2*ROOT.TMath.Pi()-math.fabs(phi1-phi2));
else:
return math.fabs(phi1-phi2);
def getListRMS(list):
mean = sum(list)/float(len(list));
return math.sqrt(sum((n-mean)*(n-mean) for n in list)/len(list));
def getListMean(list):
return sum(list)/float(len(list));
### ----------- class implementation -----------
class sampleWrapperClass:
### ------------------------------------------------
def __init__(self, label, file, channel, sampleEffLumi, lumi, treename, isData,outputfiledirectory):
self.IsData_ = isData; ### flag when running on data
self.FileName_ = file; ### input file name
self.File_ = ROOT.TFile(file); ## get the root file
self.InputTree_ = self.File_.Get(treename); ## get the input tree
self.SampleWeight_ = lumi/sampleEffLumi; ## take the lumi re-weight factor
self.JetPrefix_ = "GroomedJet_CA8";
self.Label_ = label;
self.Channel_ = channel
self.OFileName_ = outputfiledirectory+"trainingtrees_"+channel+"/ofile_"+label+".root";
# initialization for doing BSM reweighting --> set Higgs properties when running on higgs samples
self.SignalMass_ = -1;
if TString(self.FileName_).Contains("HWW") and TString(self.FileName_).Contains("600") : self.SignalMass_ = 600;
if TString(self.FileName_).Contains("HWW") and TString(self.FileName_).Contains("700") : self.SignalMass_ = 700;
if TString(self.FileName_).Contains("HWW") and TString(self.FileName_).Contains("800") : self.SignalMass_ = 800;
if TString(self.FileName_).Contains("HWW") and TString(self.FileName_).Contains("900") : self.SignalMass_ = 900;
if TString(self.FileName_).Contains("HWW") and TString(self.FileName_).Contains("1000") : self.SignalMass_ = 1000;
self.FitSMSignal = False;
self.FitSMSignal_mean = -1;
self.FitSMSignal_gamma = -1;
self.isVBF_ = False;
if TString(self.FileName_).Contains("VBFHWW") : self.isVBF_ = True;
###### reweight file --> open the root file for cps re-weighting at posteriori and prepare the information for VBF interference reweight
if self.SignalMass_ > 0:
self.rwName = "H_CPSrw_%03d"%(self.SignalMass_);
self.rwF = ROOT.TFile("CPSrw/"+self.rwName+".root");
self.h_rwCPS = self.rwF.Get(self.rwName);
self.x_rwCPS = self.h_rwCPS.GetXaxis();
############ ---------- Set up jet corrections on the fly of R >= 0.7 jets
fDir = "JECs/"
jecUncStr = ROOT.std.string(fDir + "GR_R_53_V10_Uncertainty_AK7PFchs.txt");
self.jecUnc_ = ROOT.JetCorrectionUncertainty(jecUncStr);
jecUncStrAK5 = ROOT.std.string(fDir + "GR_R_53_V10_Uncertainty_AK5PFchs.txt");
self.jecUncAK5_ = ROOT.JetCorrectionUncertainty(jecUncStrAK5);
self.jerUncStr_ = ROOT.std.string(fDir + "pfJetResolutionMCtoDataCorrLUT.root");
self.jerHistName_ = ROOT.std.string("pfJetResolutionMCtoDataCorrLUT");
self.inputJERCFile_ = ROOT.TFile(ROOT.TString(self.jerUncStr_).Data());
self.histoJERC_ = self.inputJERCFile_.Get(ROOT.TString(self.jerHistName_).Data());
self.jetResolutionMC_CA8_ = [0.051,0.051,0.061,0.062,0.072,0.1]
self.jetResolutionMC_AK5_ = [0.053,0.054,0.067,0.072,0.082,0.1]
self.Random_ = ROOT.TRandom3();
self.Random_.SetSeed();
if self.Channel_ == "mu":
self.LeptonScaleUnc_ = 0.002 ;
self.LeptonScaleUncHighPT_ = math.sqrt(0.002**2 + 0.05**2) ;
self.LeptonResolutionUnc_ = 0.006 ;
else:
self.LeptonScaleUnc_ = 0.006 ;
self.LeptonScaleUncHighPT_ = 0.006 ;
self.LeptonResolutionUnc_ = 0.014 ;
def getLabel(self):
return self.Label_
def getTrainingTreeName(self):
return self.OFileName_
def getSampleLabel(self):
return self.Label_
def crystalBallLowHigh( self, x, par):
xx = x[0];
mean = par[1];
sigma = par[2];
alpha = par[3];
n = par[4];
alpha2 = par[5];
n2 = par[6];
if (xx-mean)/sigma > math.fabs(alpha) :
A = ROOT.TMath.Power(n/math.fabs(alpha), n) * ROOT.TMath.Exp(-0.5 * alpha*alpha)
B = n/math.fabs(alpha) - math.fabs(alpha);
return par[0] * A * math.pow(B + (xx-mean)/sigma, -1.*n);
elif (xx-mean)/sigma < -1.*math.fabs(alpha2):
A = ROOT.TMath.Power(n2/math.fabs(alpha2), n2) * ROOT.TMath.Exp(-0.5 * alpha2*alpha2);
B = n2/math.fabs(alpha2) - math.fabs(alpha2);
return par[0] * A * ROOT.TMath.Power(B - (xx-mean)/sigma, -1.*n2);
else:
return par[0] * ROOT.TMath.Exp(-1. * (xx-mean)*(xx-mean) / (2*sigma*sigma) );
### main function used to create the final otree
def createTrainingTree(self):
print self.FileName_
self.NTree_ = self.InputTree_.GetEntries();
print "Turning off branches...", self.FileName_
self.InputTree_.SetBranchStatus("vbf*Charged*",0);
self.InputTree_.SetBranchStatus("vbf*Neutral*",0);
self.InputTree_.SetBranchStatus("vbf*Neutral*",0);
self.InputTree_.SetBranchStatus("vbf*Photon*",0);
self.InputTree_.SetBranchStatus("vbf*Electron*",0);
self.InputTree_.SetBranchStatus("vbf*HF*",0);
self.InputTree_.SetBranchStatus("JetPFCor*Charged*",0);
self.InputTree_.SetBranchStatus("JetPFCor*Neutral*",0);
self.InputTree_.SetBranchStatus("JetPFCor*Neutral*",0);
self.InputTree_.SetBranchStatus("JetPFCor*Electron*",0);
self.InputTree_.SetBranchStatus("JetPFCor*HF*",0);
self.InputTree_.SetBranchStatus("Hadronic*",0);
self.InputTree_.SetBranchStatus("boosted*ang*",0);
self.InputTree_.SetBranchStatus("fit_*",0);
self.InputTree_.SetBranchStatus("W_tb*",0);
self.InputTree_.SetBranchStatus("W_Parton*",0);
self.InputTree_.SetBranchStatus("JetGen*",0);
print "Initializing sample: ", self.FileName_
print "Nentries = ", self.NTree_
# fill histograms
self.createBRDTree();
self.File_.Close();
### produce weights for alternative models --> input are the generator mass value for a given event, c' and BRnew
def GetInteferenceWeights(self, mass, Cprime, BRnew=0, rwCPS=1):
massin = self.SignalMass_;
if massin < 0: return;
## define the fit range min and max as a function of the higgs mass
massmin = {600:200,700:200,800:400,900:400,1000:400};
massmax = {600:1200,700:1200,800:1500,900:1600,1000:1800};
#### read in original file and get lineshape from fit --> just for the first event, the file is read again and the lineshape is fitted just one time, taking
#### the generated value, max and min range --> mean and gamma for BWRunning fit is returned from the function
if not self.FitSMSignal:
fitSM = FitMassPoint(self.FileName_, massin, massmin[massin], massmax[massin],rwCPS);
self.FitSMSignal_mean = fitSM[0];
self.FitSMSignal_gamma = fitSM[1];
self.FitSMSignal = True;
#### create a weight for the given event after switch is turned --> taking the fitted mean, Gamma and the factor realted to c' and BRnew
weight_width = lineshapeWidthReweight(mass, self.FitSMSignal_mean, self.FitSMSignal_gamma, Cprime/(1.-BRnew), massmin[massin], massmax[massin]); ## new gamma
weight_xs = Cprime*(1-BRnew); ## new xs
return (weight_width*weight_xs); ## the weight is the product of the two
### ------------------------------------------------
def createBRDTree(self):
#### Output file --> create
fname = self.OFileName_;
self.OFile_ = ROOT.TFile(fname,"RECREATE");
self.otree = ROOT.TTree("otree","otree");
########## Initialize Variables
self.InitializeVariables();
########## Create Output branches
self.createBranches();
###### loop preparation
prefix = self.JetPrefix_;
NLoop = min(self.NTree_,10e9);
NLoopWeight = self.NTree_/NLoop;
wSampleWeight = NLoopWeight*self.SampleWeight_;
RooTrace.active(ROOT.kTRUE);
RooTrace.mark();
################################################
########## Start Loop On the Evvents ###########
################################################
for iEvent in range(NLoop) :
if iEvent %10000 == 0: print "iEvent = ", iEvent
self.InputTree_.GetEntry(iEvent);
if self.Channel_ == 'mu': lepLabel = "muon";
if self.Channel_ == 'el': lepLabel = "electron";
###############################################
########## Fill TTbar Control Region Info ####
###############################################
ttbarlike = 0;
index_ca8_in_oppoHemi = [];
for iJet in range(6): ### loop on ca8 jet over pt > 200, take dR(jet,lep) > Pi/2 --> opposite hemisphere
if getattr( self.InputTree_, "GroomedJet_CA8_pt" )[iJet] > 200 and math.fabs(getattr( self.InputTree_, "GroomedJet_CA8_eta" )[iJet])<2.4:
j_ca8_eta = getattr( self.InputTree_, "GroomedJet_CA8_eta" )[iJet];
j_ca8_phi = getattr( self.InputTree_, "GroomedJet_CA8_phi" )[iJet];
l_eta = getattr( self.InputTree_, "W_"+lepLabel+"_eta" );
l_phi = getattr( self.InputTree_, "W_"+lepLabel+"_phi" );
l_charge = getattr( self.InputTree_, "W_"+lepLabel+"_charge" );
dR_lj = math.sqrt( (l_eta - j_ca8_eta)**2 + deltaphi(l_phi,j_ca8_phi)**2 ); ## delta R between lepton and hadronic W candidate over 200 GeV
if dR_lj > ROOT.TMath.Pi()/2.: index_ca8_in_oppoHemi.append(iJet); ## opposite hemishpere
minMass = -1;
theca8Index = -1;
## loop on the vector of opposite hemisphere and take the jet with the mass closer to the nominal W mass
for iJet in range(len(index_ca8_in_oppoHemi)):
curmass = getattr( self.InputTree_, "GroomedJet_CA8_mass_pr" )[index_ca8_in_oppoHemi[iJet]]; ## search for the jet with mass closer to the W
if math.fabs(curmass-80.385) < math.fabs(minMass-80.385):
minMass = curmass;
theca8Index = index_ca8_in_oppoHemi[iJet];
### count ak5 jets
index_ak5_in_sameHemi = [];
index_ak5_in_oppoHemi = [];
index_ak5_in_sameHemi_vetoca8 = [];
index_ak5_in_oppoHemi_vetoca8 = [];
index_ak5_in_sameHemi_csvl = [];
index_ak5_in_oppoHemi_csvl = [];
index_ak5_in_sameHemi_vetoca8_csvl = [];
index_ak5_in_oppoHemi_vetoca8_csvl = [];
index_ak5_in_sameHemi_csvm = [];
index_ak5_in_oppoHemi_csvm = [];
index_ak5_in_sameHemi_vetoca8_csvm = [];
index_ak5_in_oppoHemi_vetoca8_csvm = [];
index_ak5_in_sameHemi_csvt = [];
index_ak5_in_oppoHemi_csvt = [];
index_ak5_in_sameHemi_vetoca8_csvt = [];
index_ak5_in_oppoHemi_vetoca8_csvt = [];
## HT of the event --> pt scalar sum
ttb_ht = getattr( self.InputTree_, "W_"+lepLabel+"_pt" );
ttb_ht += getattr( self.InputTree_, "event_met_pfmet" );
dR_ca8_bjet = -999 ;
dR_ca8_jet = -999 ;
if theca8Index >= 0: ## if a W candidate is found --> loop on ak5 jet in the JetPFCor collection -> central jets
for iJet in range(6):
if getattr( self.InputTree_, "JetPFCor_Pt" )[iJet] < 0 : break ;
if getattr( self.InputTree_, "JetPFCor_Pt" )[iJet] > 30: ## loop on the ak5 with pt > 30 only central jets
ttb_ht += getattr( self.InputTree_, "JetPFCor_Pt" )[iJet];
j_ca8_eta = getattr( self.InputTree_, "GroomedJet_CA8_eta" )[theca8Index];
j_ca8_phi = getattr( self.InputTree_, "GroomedJet_CA8_phi" )[theca8Index];
j_ak5_eta = getattr( self.InputTree_, "JetPFCor_Eta" )[iJet];
j_ak5_phi = getattr( self.InputTree_, "JetPFCor_Phi" )[iJet];
l_eta = getattr( self.InputTree_, "W_"+lepLabel+"_eta" );
l_phi = getattr( self.InputTree_, "W_"+lepLabel+"_phi" );
dR_jj = math.sqrt( (j_ak5_eta - j_ca8_eta)**2 + deltaphi(j_ak5_phi,j_ca8_phi)**2 ); ## delta R W-jet jet
dR_lj = math.sqrt( (l_eta - j_ak5_eta)**2 + deltaphi(l_phi,j_ak5_phi)**2 ); ## delta R jet lep
if dR_lj < ROOT.TMath.Pi()/2. : ## same hemisphere wrt to the lepton, no cleaning with W-jet --> same hemisphere -> btag counting
index_ak5_in_sameHemi.append( iJet );
if getattr( self.InputTree_, "JetPFCor_bDiscriminatorCSV" )[iJet] > 0.244: index_ak5_in_sameHemi_csvl.append(iJet);
if getattr( self.InputTree_, "JetPFCor_bDiscriminatorCSV" )[iJet] > 0.679: index_ak5_in_sameHemi_csvm.append(iJet);
if getattr( self.InputTree_, "JetPFCor_bDiscriminatorCSV" )[iJet] > 0.898: index_ak5_in_sameHemi_csvt.append(iJet);
elif dR_lj > ROOT.TMath.Pi()/2. : ## opposite hemisphere wrt to the lepton, no cleaning with W-jet --> opposite hemisphere -> btag counting
index_ak5_in_oppoHemi.append( iJet );
if getattr( self.InputTree_, "JetPFCor_bDiscriminatorCSV" )[iJet] > 0.244: index_ak5_in_oppoHemi_csvl.append(iJet);
if getattr( self.InputTree_, "JetPFCor_bDiscriminatorCSV" )[iJet] > 0.679: index_ak5_in_oppoHemi_csvm.append(iJet);
if getattr( self.InputTree_, "JetPFCor_bDiscriminatorCSV" )[iJet] > 0.898: index_ak5_in_oppoHemi_csvt.append(iJet);
if dR_lj > ROOT.TMath.Pi()/2. and dR_jj > 0.8: ### veto ca8 counter --> cleaning inside W-jet -> a W never go to b, but some btag fake rate is possible
index_ak5_in_oppoHemi_vetoca8.append( iJet );
if getattr( self.InputTree_, "JetPFCor_bDiscriminatorCSV" )[iJet] > 0.244: index_ak5_in_oppoHemi_vetoca8_csvl.append(iJet);
if getattr( self.InputTree_, "JetPFCor_bDiscriminatorCSV" )[iJet] > 0.679: index_ak5_in_oppoHemi_vetoca8_csvm.append(iJet);
if getattr( self.InputTree_, "JetPFCor_bDiscriminatorCSV" )[iJet] > 0.898: index_ak5_in_oppoHemi_vetoca8_csvt.append(iJet);
elif dR_lj < ROOT.TMath.Pi()/2. and dR_jj > 0.8:
index_ak5_in_sameHemi_vetoca8.append( iJet );
if getattr( self.InputTree_, "JetPFCor_bDiscriminatorCSV" )[iJet] > 0.244: index_ak5_in_sameHemi_vetoca8_csvl.append(iJet);
if getattr( self.InputTree_, "JetPFCor_bDiscriminatorCSV" )[iJet] > 0.679: index_ak5_in_sameHemi_vetoca8_csvm.append(iJet);
if getattr( self.InputTree_, "JetPFCor_bDiscriminatorCSV" )[iJet] > 0.898: index_ak5_in_sameHemi_vetoca8_csvt.append(iJet);
### other topological info dR between W-jet and closer jet or bjet outside its cone
if dR_jj > 0.8 :
if getattr( self.InputTree_, "JetPFCor_bDiscriminatorCSV" )[iJet] > 0.679 and dR_jj < math.fabs(dR_ca8_bjet) :
dR_ca8_bjet = dR_jj ;
dR_ca8_jet = dR_jj ;
elif getattr( self.InputTree_, "JetPFCor_bDiscriminatorCSV" )[iJet] <= 0.679 and dR_jj < math.fabs(dR_ca8_jet) :
dR_ca8_jet = dR_jj ;
for iJet in range(6): ## same loop on forward jets
if getattr( self.InputTree_, "JetPFCorVBFTag_Pt" )[iJet] < 0 : break ;
if getattr( self.InputTree_, "JetPFCorVBFTag_Pt" )[iJet] > 30: ## loop on the ak5 with pt > 30 only central jets
ttb_ht += getattr( self.InputTree_, "JetPFCorVBFTag_Pt" )[iJet];
j_ca8_eta = getattr( self.InputTree_, "GroomedJet_CA8_eta" )[theca8Index];
j_ca8_phi = getattr( self.InputTree_, "GroomedJet_CA8_phi" )[theca8Index];
j_ak5_eta = getattr( self.InputTree_, "JetPFCorVBFTag_Eta" )[iJet];
j_ak5_phi = getattr( self.InputTree_, "JetPFCorVBFTag_Phi" )[iJet];
l_eta = getattr( self.InputTree_, "W_"+lepLabel+"_eta" );
l_phi = getattr( self.InputTree_, "W_"+lepLabel+"_phi" );
dR_jj = math.sqrt( (j_ak5_eta - j_ca8_eta)**2 + deltaphi(j_ak5_phi,j_ca8_phi)**2 ); ## delta R W-jet jet
dR_lj = math.sqrt( (l_eta - j_ak5_eta)**2 + deltaphi(l_phi,j_ak5_phi)**2 ); ## delta R jet lep
if dR_lj < ROOT.TMath.Pi()/2. : ## same hemisphere wrt to lepton --> no cleaning with ak5 inside W-jet cone
index_ak5_in_sameHemi.append( iJet );
if getattr( self.InputTree_, "JetPFCorVBFTag_bDiscriminatorCSV" )[iJet] > 0.244: index_ak5_in_sameHemi_csvl.append(iJet);
if getattr( self.InputTree_, "JetPFCorVBFTag_bDiscriminatorCSV" )[iJet] > 0.679: index_ak5_in_sameHemi_csvm.append(iJet);
if getattr( self.InputTree_, "JetPFCorVBFTag_bDiscriminatorCSV" )[iJet] > 0.898: index_ak5_in_sameHemi_csvt.append(iJet);
elif dR_lj > ROOT.TMath.Pi()/2. : ## opposite hemisphere wrt to lepton --> no cleaning with ak5 inside W-jet cone
index_ak5_in_oppoHemi.append( iJet );
if getattr( self.InputTree_, "JetPFCorVBFTag_bDiscriminatorCSV" )[iJet] > 0.244: index_ak5_in_oppoHemi_csvl.append(iJet);
if getattr( self.InputTree_, "JetPFCorVBFTag_bDiscriminatorCSV" )[iJet] > 0.679: index_ak5_in_oppoHemi_csvm.append(iJet);
if getattr( self.InputTree_, "JetPFCorVBFTag_bDiscriminatorCSV" )[iJet] > 0.898: index_ak5_in_oppoHemi_csvt.append(iJet);
if dR_lj > ROOT.TMath.Pi()/2. and dR_jj > 0.8: ## same hemisphere wrt to lepton --> cleaning with ak5 inside W-jet cone
index_ak5_in_oppoHemi_vetoca8.append( iJet );
if getattr( self.InputTree_, "JetPFCorVBFTag_bDiscriminatorCSV" )[iJet] > 0.244: index_ak5_in_oppoHemi_vetoca8_csvl.append(iJet);
if getattr( self.InputTree_, "JetPFCorVBFTag_bDiscriminatorCSV" )[iJet] > 0.679: index_ak5_in_oppoHemi_vetoca8_csvm.append(iJet);
if getattr( self.InputTree_, "JetPFCorVBFTag_bDiscriminatorCSV" )[iJet] > 0.898: index_ak5_in_oppoHemi_vetoca8_csvt.append(iJet);
elif dR_lj < ROOT.TMath.Pi()/2. and dR_jj > 0.8:
index_ak5_in_sameHemi_vetoca8.append( iJet );
if getattr( self.InputTree_, "JetPFCorVBFTag_bDiscriminatorCSV" )[iJet] > 0.244: index_ak5_in_sameHemi_vetoca8_csvl.append(iJet);
if getattr( self.InputTree_, "JetPFCorVBFTag_bDiscriminatorCSV" )[iJet] > 0.679: index_ak5_in_sameHemi_vetoca8_csvm.append(iJet);
if getattr( self.InputTree_, "JetPFCorVBFTag_bDiscriminatorCSV" )[iJet] > 0.898: index_ak5_in_sameHemi_vetoca8_csvt.append(iJet);
### other topological info dR between W-jet and closer jet or bjet outside its cone
if dR_jj > 0.8:
if getattr( self.InputTree_, "JetPFCorVBFTag_bDiscriminatorCSV" )[iJet] > 0.679 and dR_jj < math.fabs(dR_ca8_bjet) :
dR_ca8_bjet = dR_jj ;
dR_ca8_jet = dR_jj ;
elif getattr( self.InputTree_, "JetPFCorVBFTag_bDiscriminatorCSV" )[iJet] <= 0.679 and dR_jj < math.fabs(dR_ca8_jet) :
dR_ca8_jet = dR_jj ;
### number of jets in the same emisphere of the lepton
self.ttb_nak5_same_[0] = int(len(index_ak5_in_sameHemi));
### number of jets in the same emisphere of the lepton passing csvl
self.ttb_nak5_same_csvl_[0] = int(len(index_ak5_in_sameHemi_csvl));
### number of jets in the same emisphere of the lepton passing csvm
self.ttb_nak5_same_csvm_[0] = int(len(index_ak5_in_sameHemi_csvm));
### number of jets in the same emisphere of the lepton passing csvt
self.ttb_nak5_same_csvt_[0] = int(len(index_ak5_in_sameHemi_csvt));
### number of jets in the opposite emisphere of the lepton
self.ttb_nak5_oppo_[0] = int(len(index_ak5_in_oppoHemi));
### number of jets in the opposite emisphere of the lepton passing csvl
self.ttb_nak5_oppo_csvl_[0] = int(len(index_ak5_in_oppoHemi_csvl));
### number of jets in the opposite emisphere of the lepton passing csvm
self.ttb_nak5_oppo_csvm_[0] = int(len(index_ak5_in_oppoHemi_csvm));
### number of jets in the opposite emisphere of the lepton passing csvt
self.ttb_nak5_oppo_csvt_[0] = int(len(index_ak5_in_oppoHemi_csvt));
### number of jets in the opposite emisphere of the lepton cleaned wrt to the hadronic candidate
self.ttb_nak5_oppoveto_[0] = int(len(index_ak5_in_oppoHemi_vetoca8));
self.ttb_nak5_oppoveto_csvl_[0] = int(len(index_ak5_in_oppoHemi_vetoca8_csvl));
self.ttb_nak5_oppoveto_csvm_[0] = int(len(index_ak5_in_oppoHemi_vetoca8_csvm));
self.ttb_nak5_oppoveto_csvt_[0] = int(len(index_ak5_in_oppoHemi_vetoca8_csvt));
### number of jets in the same emisphere of the lepton cleaned wrt to the hadronic candidate
self.ttb_nak5_sameveto_[0] = int(len(index_ak5_in_sameHemi_vetoca8));
self.ttb_nak5_sameveto_csvl_[0] = int(len(index_ak5_in_sameHemi_vetoca8_csvl));
self.ttb_nak5_sameveto_csvm_[0] = int(len(index_ak5_in_sameHemi_vetoca8_csvm));
self.ttb_nak5_sameveto_csvt_[0] = int(len(index_ak5_in_sameHemi_vetoca8_csvt));
### jet quantities
self.ttb_ht_[0] = ttb_ht;
self.ttb_ca8_mass_pr_[0] = getattr( self.InputTree_, "GroomedJet_CA8_mass_pr" )[theca8Index];
self.ttb_ca8_ungroomed_pt_[0] = getattr( self.InputTree_, "GroomedJet_CA8_pt" )[theca8Index];
self.ttb_ca8_ungroomed_eta_[0] = getattr( self.InputTree_, "GroomedJet_CA8_eta" )[theca8Index];
self.ttb_ca8_ungroomed_phi_[0] = getattr( self.InputTree_, "GroomedJet_CA8_phi" )[theca8Index];
self.ttb_ca8_ungroomed_e_[0] = getattr( self.InputTree_, "GroomedJet_CA8_e" )[theca8Index];
### dR between W-jet and closer jet or bjet outside its cone
self.ttb_dR_ca8_bjet_closer_[0] = dR_ca8_bjet ;
self.ttb_dR_ca8_jet_closer_[0] = dR_ca8_jet ;
### some generator info
if not self.IsData_ :
self.ttb_ca8_ungroomed_gen_pt_[0] = getattr( self.InputTree_, "GenGroomedJet_CA8_pt" )[theca8Index];
self.ttb_ca8_ungroomed_gen_eta_[0] = getattr( self.InputTree_, "GenGroomedJet_CA8_eta" )[theca8Index];
self.ttb_ca8_ungroomed_gen_phi_[0] = getattr( self.InputTree_, "GenGroomedJet_CA8_phi" )[theca8Index];
self.ttb_ca8_ungroomed_gen_e_[0] = getattr( self.InputTree_, "GenGroomedJet_CA8_e" )[theca8Index];
self.ttb_ca8_charge_[0] = getattr( self.InputTree_, "GroomedJet_CA8_jetcharge" )[theca8Index];
self.ttb_ca8_charge_k05_[0] = getattr( self.InputTree_, "GroomedJet_CA8_jetcharge_k05" )[theca8Index];
self.ttb_ca8_charge_k07_[0] = getattr( self.InputTree_, "GroomedJet_CA8_jetcharge_k07" )[theca8Index];
self.ttb_ca8_charge_k10_[0] = getattr( self.InputTree_, "GroomedJet_CA8_jetcharge_k10" )[theca8Index];
self.ttb_ca8_tau2tau1_[0] = getattr( self.InputTree_, "GroomedJet_CA8_tau2tau1" )[theca8Index];
self.ttb_ca8_tau2tau1_exkT_[0] = getattr( self.InputTree_, "GroomedJet_CA8_tau2tau1_exkT" )[theca8Index];
self.ttb_ca8_tau2tau1_pr_[0] = getattr( self.InputTree_, "GroomedJet_CA8_tau2tau1_pr" )[theca8Index];
self.ttb_ca8_GeneralizedECF_[0] = getattr( self.InputTree_, "GroomedJet_CA8_jetGeneralizedECF" )[theca8Index];
self.ttb_ca8_mu_[0] = getattr( self.InputTree_, "GroomedJet_CA8_massdrop_pr" )[theca8Index];
### invariant mass of the full system
ttb_ca8J_p4 = ROOT.TLorentzVector();
ttb_ca8J_pt = getattr( self.InputTree_, "GroomedJet_CA8_pt" )[theca8Index];
ttb_ca8J_eta = getattr( self.InputTree_, "GroomedJet_CA8_eta" )[theca8Index];
ttb_ca8J_phi = getattr( self.InputTree_, "GroomedJet_CA8_phi" )[theca8Index];
ttb_ca8J_e = getattr( self.InputTree_, "GroomedJet_CA8_e" )[theca8Index];
ttb_ca8J_p4.SetPtEtaPhiE(ttb_ca8J_pt, ttb_ca8J_eta, ttb_ca8J_phi, ttb_ca8J_e)
ttb_V_p4 = ROOT.TLorentzVector(getattr(self.InputTree_,"W_px"),getattr(self.InputTree_,"W_py"),getattr(self.InputTree_,"W_pz_type0"),getattr(self.InputTree_,"W_e"));
self.ttb_ca8_mlvj_type0_[0] = (ttb_V_p4+ttb_ca8J_p4).M();
ttb_V_p4.SetPxPyPzE(getattr(self.InputTree_,"W_px"),getattr(self.InputTree_,"W_py"),getattr(self.InputTree_,"W_pz_type2"),getattr(self.InputTree_,"W_e"));
self.ttb_ca8_mlvj_type2_[0] = (ttb_V_p4+ttb_ca8J_p4).M();
ttb_V_p4.SetPxPyPzE(getattr(self.InputTree_,"W_px"),getattr(self.InputTree_,"W_py"),getattr(self.InputTree_,"W_pz_type0_met"),getattr(self.InputTree_,"W_e"));
self.ttb_ca8_mlvj_type0_met_[0] = (ttb_V_p4+ttb_ca8J_p4).M();
ttb_V_p4.SetPxPyPzE(getattr(self.InputTree_,"W_px"),getattr(self.InputTree_,"W_py"),getattr(self.InputTree_,"W_pz_type2_met"),getattr(self.InputTree_,"W_e"));
self.ttb_ca8_mlvj_type2_met_[0] = (ttb_V_p4+ttb_ca8J_p4).M();
self.ttb_ca8_px_[0] = ttb_ca8J_p4.Px();
self.ttb_ca8_py_[0] = ttb_ca8J_p4.Py();
self.ttb_ca8_pz_[0] = ttb_ca8J_p4.Pz();
self.ttb_ca8_e_[0] = ttb_ca8J_p4.E();
## preselection for the ttbar control region selection: at least one btag loose same or opposite hemisphere wrt to the lepton
oppo1same1 = (self.ttb_nak5_same_csvl_[0] > 0 or self.ttb_nak5_oppo_csvl_[0] > 0) or (self.ttb_nak5_sameveto_csvl_[0]>0 or self.ttb_nak5_oppoveto_csvl_[0]>0);
oppo2same0 = (self.ttb_nak5_same_csvl_[0] == 0 and self.ttb_nak5_oppo_csvl_[0] > 1) or (self.ttb_nak5_sameveto_csvl_[0]==0 or self.ttb_nak5_oppoveto_csvl_[0] > 1);
if oppo1same1 or oppo2same0:
self.isttbar_[0] = 1 ;
else: ## default value for non ttbar events
self.ttb_nak5_same_[0] = -1;
self.ttb_nak5_same_csvl_[0] = -1;
self.ttb_nak5_same_csvm_[0] = -1;
self.ttb_nak5_same_csvt_[0] = -1;
self.ttb_nak5_oppo_[0] = -1;
self.ttb_nak5_oppo_csvl_[0] = -1;
self.ttb_nak5_oppo_csvm_[0] = -1;
self.ttb_nak5_oppo_csvt_[0] = -1;
self.ttb_nak5_oppoveto_[0] = -1;
self.ttb_dR_ca8_bjet_closer_[0] = -999 ;
self.ttb_dR_ca8_jet_closer_[0] = -999 ;
self.ttb_nak5_oppoveto_csvl_[0] = -1;
self.ttb_nak5_oppoveto_csvm_[0] = -1;
self.ttb_nak5_oppoveto_csvt_[0] = -1;
self.ttb_nak5_sameveto_csvl_[0] = -1;
self.ttb_nak5_sameveto_csvm_[0] = -1;
self.ttb_nak5_sameveto_csvt_[0] = -1;
self.ttb_ca8_mass_pr_[0] = -1;
self.ttb_ca8_ungroomed_pt_[0] = -1;
self.ttb_ca8_ungroomed_eta_[0] = -999;
self.ttb_ca8_ungroomed_phi_[0] = -999;
self.ttb_ca8_ungroomed_e_[0] = -1;
self.ttb_ca8_ungroomed_gen_pt_[0] = -1;
self.ttb_ca8_ungroomed_gen_eta_[0] = -999;
self.ttb_ca8_ungroomed_gen_phi_[0] = -999;
self.ttb_ca8_ungroomed_gen_e_[0] = -1;
self.ttb_ca8_charge_[0] = -999;
self.ttb_ca8_charge_k05_[0] = -999;
self.ttb_ca8_charge_k07_[0] = -999;
self.ttb_ca8_charge_k10_[0] = -999;
self.ttb_ca8_tau2tau1_[0] = -999;
self.ttb_ca8_tau2tau1_exkT_[0] = -999;
self.ttb_ca8_tau2tau1_pr_[0] = -999;
self.ttb_ca8_GeneralizedECF_[0] = -999;
self.ttb_ca8_mu_[0] = -999;
self.ttb_ca8_mlvj_type0_[0] = -999;
self.ttb_ca8_mlvj_type2_[0] = -999;
self.ttb_ca8_mlvj_type0_met_[0] = -999;
self.ttb_ca8_mlvj_type2_met_[0] = -999;
self.ttb_ca8_px_[0] = -999;
self.ttb_ca8_py_[0] = -999;
self.ttb_ca8_pz_[0] = -999;
self.ttb_ca8_e_[0] = -999;
#########################################################################################################################
##################### Cuts used to define flag for final signal region and ttbar control region definition ##############
#########################################################################################################################
leptonCut = 30 ;
leptonCutString = "W_muon_pt";
metCut = 40;
if self.Channel_ == "el":
leptonCut = 35;
leptonCutString = "W_electron_pt";
metCut = 40;
signallike = 0;
if ( getattr( self.InputTree_, "W_pt" ) > 200 and
getattr( self.InputTree_, "GroomedJet_CA8_pt" )[0] > 200 and
math.fabs(getattr( self.InputTree_, "GroomedJet_CA8_eta" )[0]) < 2.4 and
getattr( self.InputTree_, "event_met_pfmet" ) > metCut and
getattr( self.InputTree_, leptonCutString ) > leptonCut and
getattr( self.InputTree_, "GroomedJet_CA8_deltaR_lca8jet") > 1.57) :
if ( self.Channel_ == "mu" and
math.fabs(getattr( self.InputTree_, "W_muon_dz000")) < 0.02 and
math.fabs(getattr( self.InputTree_, "W_muon_dzPV")) < 0.5 and
math.fabs( getattr( self.InputTree_, "W_muon_eta" )) < 2.1 ) :
signallike = 1 ;
elif self.Channel_ == "el" : signallike = 1 ;
ttbarlike = 0;
if self.isttbar_[0] == 1 and getattr( self.InputTree_, "event_met_pfmet" ) > metCut and getattr( self.InputTree_, leptonCutString ) > leptonCut:
ttbarlike = 1;
##################### store the info just for ttbar like or signal like events
if ttbarlike == 1 or signallike == 1 :
#####################################################################
############### Fill Event property only for interesting events #####
#####################################################################
self.event_[0] = getattr( self.InputTree_, "event_evtNo");
self.event_runNo_[0] = getattr( self.InputTree_, "event_runNo" );
self.event_lumi_[0] = getattr( self.InputTree_, "event_lumi" );
effwt = getattr( self.InputTree_, "effwt" );
puwt = getattr( self.InputTree_, "puwt" );
totSampleWeight = 1.;
if self.IsData_: totSampleWeight = wSampleWeight;
else: totSampleWeight = wSampleWeight*effwt*puwt; ## total weight takes into account also pileUp and efficiency (not the btag)
self.totalEventWeight_[0] = totSampleWeight;
self.eff_and_pu_Weight_[0] = effwt*puwt;
self.wSampleWeight_[0] = wSampleWeight;
self.btag_weight_[0] = getattr( self.InputTree_, "eff_btag" );
self.btag_weight_up_[0] = getattr( self.InputTree_, "eff_btag_up" );
self.btag_weight_dn_[0] = getattr( self.InputTree_, "eff_btag_dw" );
self.btag_weight_up_dn_[0] = getattr( self.InputTree_, "eff_btag_up_dw" );
self.btag_weight_dn_up_[0] = getattr( self.InputTree_, "eff_btag_dw_up" );
self.nPV_[0] = getattr( self.InputTree_, "event_nPV" );
self.issignal_[0] = signallike;
self.isttbar_[0] = ttbarlike;
self.numberJetBin_[0] = getattr(self.InputTree_, "numberJetBin")[0];
self.numberJetBin2_[0] = getattr(self.InputTree_, "numberJetBin")[1];
self.numberJetBin3_[0] = getattr(self.InputTree_, "numberJetBin")[2];
self.numberJetBin4_[0] = getattr(self.InputTree_, "numberJetBin")[3];
if not self.IsData_:
self.numberJetBinGen_[0] = getattr(self.InputTree_, "numberJetBinGen")[0];
self.numberJetBinGen2_[0] = getattr(self.InputTree_, "numberJetBinGen")[1];
self.numberJetBinGen3_[0] = getattr(self.InputTree_, "numberJetBinGen")[2];
self.numberJetBinGen4_[0] = getattr(self.InputTree_, "numberJetBinGen")[3];
if self.Label_ == "TTbar_mcatnlo" :
self.event_weight_[0] = getattr( self.InputTree_, "event_weight" )/math.fabs(getattr( self.InputTree_, "event_weight" )) ;
else: self.event_weight_[0] = 1.;
#### CPS part -> take value from histos external file
rwCPS = 1;
if self.SignalMass_ > 0:
binVal = self.x_rwCPS.FindBin(getattr(self.InputTree_,"W_H_mass_gen"));
if binVal > self.h_rwCPS.GetNbinsX(): binVal = self.h_rwCPS.GetNbinsX();
if binVal < 1: binVal = 1;
rwCPS = self.h_rwCPS.GetBinContent( binVal );
############## interference weight and cps weight
self.complexpolewtggH600 = getattr(self.InputTree_,"complexpolewtggH600")*rwCPS;
self.interferencewtggH600 = getattr(self.InputTree_,"interferencewtggH600");
self.avecomplexpolewtggH600 = getattr(self.InputTree_,"avecomplexpolewtggH600");
self.interference_Weight_H600_[0] = self.complexpolewtggH600*self.interferencewtggH600/self.avecomplexpolewtggH600; ## complete weight for standard higgs
self.interference_Weight_H600_up_[0] = self.complexpolewtggH600*getattr(self.InputTree_,"interferencewt_upggH600")/self.avecomplexpolewtggH600;
self.interference_Weight_H600_dn_[0] = self.complexpolewtggH600*getattr(self.InputTree_,"interferencewt_downggH600")/self.avecomplexpolewtggH600;
self.complexpolewtggH700 = getattr(self.InputTree_,"complexpolewtggH700")*rwCPS;
self.interferencewtggH700 = getattr(self.InputTree_,"interferencewtggH700");
self.avecomplexpolewtggH700 = getattr(self.InputTree_,"avecomplexpolewtggH700");
self.interference_Weight_H700_[0] = self.complexpolewtggH700*self.interferencewtggH700/self.avecomplexpolewtggH700; ## complete weight for standard higgs
self.interference_Weight_H700_up_[0] = self.complexpolewtggH700*getattr(self.InputTree_,"interferencewt_upggH700")/self.avecomplexpolewtggH700;
self.interference_Weight_H700_dn_[0] = self.complexpolewtggH700*getattr(self.InputTree_,"interferencewt_downggH700")/self.avecomplexpolewtggH700;
self.complexpolewtggH800 = getattr(self.InputTree_,"complexpolewtggH800")*rwCPS;
self.interferencewtggH800 = getattr(self.InputTree_,"interferencewtggH800");
self.avecomplexpolewtggH800 = getattr(self.InputTree_,"avecomplexpolewtggH800");
self.interference_Weight_H800_[0] = self.complexpolewtggH800*self.interferencewtggH800/self.avecomplexpolewtggH800; ## complete weight for standard higgs
self.interference_Weight_H800_up_[0] = self.complexpolewtggH800*getattr(self.InputTree_,"interferencewt_upggH800")/self.avecomplexpolewtggH800;
self.interference_Weight_H800_dn_[0] = self.complexpolewtggH800*getattr(self.InputTree_,"interferencewt_downggH800")/self.avecomplexpolewtggH800;
self.complexpolewtggH900 = getattr(self.InputTree_,"complexpolewtggH900")*rwCPS;
self.interferencewtggH900 = getattr(self.InputTree_,"interferencewtggH900");
self.avecomplexpolewtggH900 = getattr(self.InputTree_,"avecomplexpolewtggH900");
self.interference_Weight_H900_[0] = self.complexpolewtggH900*self.interferencewtggH900/self.avecomplexpolewtggH900; ## complete weight for standard higgs
self.interference_Weight_H900_up_[0] = self.complexpolewtggH900*getattr(self.InputTree_,"interferencewt_upggH900")/self.avecomplexpolewtggH900;
self.interference_Weight_H900_dn_[0] = self.complexpolewtggH900*getattr(self.InputTree_,"interferencewt_downggH900")/self.avecomplexpolewtggH900;
self.complexpolewtggH1000 = getattr(self.InputTree_,"complexpolewtggH1000")*rwCPS;
self.interferencewtggH1000 = getattr(self.InputTree_,"interferencewtggH1000");
self.avecomplexpolewtggH1000 = getattr(self.InputTree_,"avecomplexpolewtggH1000");
self.interference_Weight_H1000_[0] = self.complexpolewtggH1000*self.interferencewtggH1000/self.avecomplexpolewtggH1000; ## complete weight for standard higgs
self.interference_Weight_H1000_up_[0] = self.complexpolewtggH1000*getattr(self.InputTree_,"interferencewt_upggH1000")/self.avecomplexpolewtggH1000;
self.interference_Weight_H1000_dn_[0] = self.complexpolewtggH1000*getattr(self.InputTree_,"interferencewt_downggH1000")/self.avecomplexpolewtggH1000;
self.cps_Weight_H600_[0] = self.complexpolewtggH600/self.avecomplexpolewtggH600;
self.cps_Weight_H700_[0] = self.complexpolewtggH700/self.avecomplexpolewtggH700;
self.cps_Weight_H800_[0] = self.complexpolewtggH800/self.avecomplexpolewtggH800;
self.cps_Weight_H900_[0] = self.complexpolewtggH900/self.avecomplexpolewtggH900;
self.cps_Weight_H1000_[0] = self.complexpolewtggH1000/self.avecomplexpolewtggH1000;
#### produce weights for alternative models
if self.SignalMass_ > 0:
curIntfRw = getattr(self.InputTree_,"interferencewtggH%03d"%(self.SignalMass_)); ## take the interference value filled in the tree for the right mass
curIntfRw_up = getattr(self.InputTree_,"interferencewt_upggH%03d"%(self.SignalMass_)); ## take the interference value filled in the tree for the right mass
curIntfRw_dn = getattr(self.InputTree_,"interferencewt_downggH%03d"%(self.SignalMass_)); ## take the interference value filled in the tree for the right mass
self.genHMass_[0] = getattr(self.InputTree_,"W_H_mass_gen");
self.genHphi_[0] = getattr(self.InputTree_,"W_H_phi_gen");
self.genHeta_[0] = getattr(self.InputTree_,"W_H_eta_gen");
self.genHpt_[0] = getattr(self.InputTree_,"W_H_pt_gen"); ## generator level higgs properties will be stored in the otree
if self.isVBF_: ## if is vbf signal, also tag jet quark info stored
self.genTagQuark1E_[0] = getattr(self.InputTree_,"W_TagQuark_E")[0];
self.genTagQuark1eta_[0] = getattr(self.InputTree_,"W_TagQuark_eta")[0];
self.genTagQuark1phi_[0] = getattr(self.InputTree_,"W_TagQuark_phi")[0];
self.genTagQuark1pt_[0] = getattr(self.InputTree_,"W_TagQuark_pt")[0];
self.genTagQuark2E_[0] = getattr(self.InputTree_,"W_TagQuark_E")[1];
self.genTagQuark2eta_[0] = getattr(self.InputTree_,"W_TagQuark_eta")[1];
self.genTagQuark2phi_[0] = getattr(self.InputTree_,"W_TagQuark_phi")[1];
self.genTagQuark2pt_[0] = getattr(self.InputTree_,"W_TagQuark_pt")[1];
for iPar in range(len(self.cprimeVals)): ## run over the possible value of the new couplig constant and BR
for jPar in range(len(self.brnewVals)):
curCprime = float(self.cprimeVals[iPar])/10.; ## take the c' value
curBRnew = float(self.brnewVals[jPar])/10.; ## take the BRnew value
if self.isVBF_:
### for VBF signal the bsmReweights is given just by the value returned by GetInteferenceWeights
self.bsmReweights[iPar][jPar][0] = self.GetInteferenceWeights( getattr(self.InputTree_,"W_H_mass_gen"), curCprime, curBRnew, rwCPS);
self.bsmReweights_up[iPar][jPar][0] = self.GetInteferenceWeights( getattr(self.InputTree_,"W_H_mass_gen"), curCprime, curBRnew, rwCPS);
self.bsmReweights_dn[iPar][jPar][0] = self.GetInteferenceWeights( getattr(self.InputTree_,"W_H_mass_gen"), curCprime, curBRnew, rwCPS);
else:
### for ggH signal the bsmReweights is given by the value returned by GetInteferenceWeights * IntfRescale
self.bsmReweights[iPar][jPar][0] = self.GetInteferenceWeights(getattr(self.InputTree_,"W_H_mass_gen"),curCprime,curBRnew,rwCPS)*IntfRescale(curIntfRw,curCprime,curBRnew);
self.bsmReweights_up[iPar][jPar][0] = self.GetInteferenceWeights(getattr(self.InputTree_,"W_H_mass_gen"),curCprime,curBRnew,rwCPS)*IntfRescale(curIntfRw_up,curCprime,curBRnew);
self.bsmReweights_dn[iPar][jPar][0] = self.GetInteferenceWeights(getattr(self.InputTree_,"W_H_mass_gen"),curCprime,curBRnew,rwCPS)*IntfRescale(curIntfRw_dn,curCprime,curBRnew);
else:
### default values for generator info
self.genHMass_[0] = -1;
self.genHphi_[0] = -999;
self.genHeta_[0] = -999;
self.genHpt_[0] = -1;
self.genTagQuark1E_ = -1;
self.genTagQuark1eta_ = -999.;
self.genTagQuark1phi_ = -999.;
self.genTagQuark1pt_ = -1.;
self.genTagQuark2E_ = -1;
self.genTagQuark2eta_ = -999.;
self.genTagQuark2phi_ = -999.;
self.genTagQuark2pt_ = -1.;
for iPar in range(len(self.cprimeVals)): ## set to -1
for jPar in range(len(self.brnewVals)):
self.bsmReweights[iPar][jPar][0] = -1;
self.bsmReweights_up[iPar][jPar][0] = -1;
self.bsmReweights_dn[iPar][jPar][0] = -1;
################ lepton and met side
if self.Channel_ == "mu" :
self.l_pt_[0] = getattr( self.InputTree_, "W_muon_pt" );
self.l_eta_[0] = getattr( self.InputTree_, "W_muon_eta" );
self.l_phi_[0] = getattr( self.InputTree_, "W_muon_phi" );
self.l_charge_[0] = getattr( self.InputTree_, "W_muon_charge" );
elif self.Channel_ == "el":
self.l_pt_[0] = getattr( self.InputTree_, "W_electron_pt" );
self.l_eta_[0] = getattr( self.InputTree_, "W_electron_eta" );
self.l_phi_[0] = getattr( self.InputTree_, "W_electron_phi" );
self.l_charge_[0] = getattr( self.InputTree_, "W_electron_charge" );
self.pfMET_[0] = getattr( self.InputTree_, "event_met_pfmet" );
self.pfMET_Phi_[0] = getattr( self.InputTree_, "event_met_pfmetPhi" );
################# Other basic Observables
self.mass_lvj_type0_[0] = getattr( self.InputTree_, "boostedW_lvj_m_type0" );
self.mass_lvj_type2_[0] = getattr( self.InputTree_, "boostedW_lvj_m_type2" );
self.mass_lvj_type0_met_[0] = getattr( self.InputTree_, "boostedW_lvj_m_type0_met" );
self.mass_lvj_type2_met_[0] = getattr( self.InputTree_, "boostedW_lvj_m_type2_met" );
self.mass_lv_subj_type0_[0] = getattr( self.InputTree_, "boosted_lvj_m_type0" );
self.mass_lv_subj_type2_[0] = getattr( self.InputTree_, "boosted_lvj_m_type2" );
self.mass_lv_subj_type0_met_[0] = getattr( self.InputTree_, "boosted_lvj_m_type0_met" );
self.mass_lv_subj_type2_met_[0] = getattr( self.InputTree_, "boosted_lvj_m_type2_met" );
self.v_pt_[0] = getattr( self.InputTree_, "W_pt" );
self.v_mt_[0] = getattr( self.InputTree_, "W_mt" );
self.v_eta_[0] = getattr( self.InputTree_, "W_eta" );
self.v_phi_[0] = getattr( self.InputTree_, "W_phi" );
self.nu_pz_type0_[0] = getattr( self.InputTree_, "W_nu1_pz_type0" );
self.nu_pz_type2_[0] = getattr( self.InputTree_, "W_nu1_pz_type2" );
self.nu_pz_type0_met_[0] = getattr( self.InputTree_, "W_nu1_pz_type0_met" );
self.nu_pz_type2_met_[0] = getattr( self.InputTree_, "W_nu1_pz_type2_met" );
self.W_pz_type0_[0] = getattr( self.InputTree_, "W_pz_type0" );
self.W_pz_type2_[0] = getattr( self.InputTree_, "W_pz_type2" );
self.W_pz_type0_met_[0] = getattr( self.InputTree_, "W_pz_type0_met" );
self.W_pz_type2_met_[0] = getattr( self.InputTree_, "W_pz_type2_met" );
W_Lepton_gen = ROOT.TLorentzVector() ;
if self.IsData_ == False :
self.nu_pz_gen_[0] = getattr( self.InputTree_, "W_neutrino_pz_gen" );
if self.Channel_ == "mu" :
W_Lepton_gen.SetPxPyPzE(getattr(self.InputTree_, "W_muon_px_gen" )+getattr(self.InputTree_, "W_neutrino_px_gen"),
getattr(self.InputTree_, "W_muon_py_gen" )+getattr(self.InputTree_, "W_neutrino_py_gen" ),
getattr(self.InputTree_, "W_muon_pz_gen" )+getattr(self.InputTree_, "W_neutrino_pz_gen" ),
getattr(self.InputTree_, "W_muon_e_gen" )+getattr(self.InputTree_, "W_neutrino_e_gen" ));
self.W_pz_gen_[0] = getattr( self.InputTree_, "W_neutrino_pz_gen" ) + getattr( self.InputTree_, "W_muon_pz_gen" );
self.W_pt_gen_[0] = W_Lepton_gen.Pt();
elif self.Channel_ == "el" :
W_Lepton_gen.SetPxPyPzE(getattr(self.InputTree_, "W_electron_px_gen" )+getattr(self.InputTree_, "W_neutrino_px_gen"),
getattr(self.InputTree_, "W_electron_py_gen" )+getattr(self.InputTree_, "W_neutrino_py_gen" ),
getattr(self.InputTree_, "W_electron_pz_gen" )+getattr(self.InputTree_, "W_neutrino_pz_gen" ),
getattr(self.InputTree_, "W_electron_e_gen" )+getattr(self.InputTree_, "W_neutrino_e_gen" ));
self.W_pz_gen_[0] = getattr( self.InputTree_, "W_neutrino_pz_gen" ) + getattr( self.InputTree_, "W_electron_pz_gen" );
self.W_pt_gen_[0] = W_Lepton_gen.Pt();
######## W-Jet stuff
self.ungroomed_jet_pt_[0] = getattr( self.InputTree_, prefix+"_pt" )[0];
self.ungroomed_jet_eta_[0] = getattr( self.InputTree_, prefix+"_eta" )[0];
self.ungroomed_jet_phi_[0] = getattr( self.InputTree_, prefix+"_phi" )[0];
self.ungroomed_jet_e_[0] = getattr( self.InputTree_, prefix+"_e" )[0];
self.jet_mass_pr_[0] = getattr( self.InputTree_, prefix + "_mass_pr" )[0];
self.jet_pt_pr_[0] = getattr( self.InputTree_, prefix + "_pt_pr" )[0];
self.jet_charge_[0] = getattr( self.InputTree_, prefix + "_jetcharge" )[0];
self.jet_charge_k05_[0] = getattr( self.InputTree_, prefix + "_jetcharge_k05" )[0];
self.jet_charge_k07_[0] = getattr( self.InputTree_, prefix + "_jetcharge_k07" )[0];
self.jet_charge_k10_[0] = getattr( self.InputTree_, prefix + "_jetcharge_k10" )[0];
self.jet_grsens_ft_[0] = getattr( self.InputTree_, prefix + "_mass_ft" )[0] / getattr( self.InputTree_, prefix + "_mass" )[0];
self.jet_grsens_tr_[0] = getattr( self.InputTree_, prefix + "_mass_tr" )[0] / getattr( self.InputTree_, prefix + "_mass" )[0];
self.jet_massdrop_pr_[0] = getattr( self.InputTree_, prefix + "_massdrop_pr" )[0];
qjetmassdistribution = getattr( self.InputTree_, prefix+"_qjetmass" );
qjetvol = getListRMS(qjetmassdistribution)/getListMean(qjetmassdistribution);
self.jet_qjetvol_[0] = qjetvol;
self.jet_tau2tau1_[0] = getattr( self.InputTree_, prefix + "_tau2tau1" )[0];
self.jet_tau2tau1_exkT_[0] = getattr( self.InputTree_, prefix + "_tau2tau1_exkT" )[0];
self.jet_tau2tau1_pr_[0] = getattr( self.InputTree_, prefix + "_tau2tau1_pr" )[0];
self.jet_GeneralizedECF_[0] = getattr( self.InputTree_, prefix + "_jetGeneralizedECF" )[0];
self.jet_jetconstituents_[0] = getattr( self.InputTree_, prefix + "_jetconstituents" )[0];
self.jet_rcore4_[0] = getattr( self.InputTree_, prefix + "_rcores")[3*6 + 0];
self.jet_rcore5_[0] = getattr( self.InputTree_, prefix + "_rcores")[4*6 + 0];
self.jet_rcore6_[0] = getattr( self.InputTree_, prefix + "_rcores")[5*6 + 0];
self.jet_rcore7_[0] = getattr( self.InputTree_, prefix + "_rcores")[6*6 + 0];
self.jet_planarlow04_[0] = getattr( self.InputTree_, prefix + "_planarflow04");
self.jet_planarlow05_[0] = getattr( self.InputTree_, prefix + "_planarflow05");
self.jet_planarlow06_[0] = getattr( self.InputTree_, prefix + "_planarflow06");
self.jet_planarlow07_[0] = getattr( self.InputTree_, prefix + "_planarflow07");
self.pt1FracVal = max( getattr( self.InputTree_, prefix + "_prsubjet1ptoverjetpt" ), getattr( self.InputTree_, prefix + "_prsubjet2ptoverjetpt" ) );
self.pt2FracVal = min( getattr( self.InputTree_, prefix + "_prsubjet1ptoverjetpt" ), getattr( self.InputTree_, prefix + "_prsubjet2ptoverjetpt" ) );
self.jet_pt1frac_[0] = self.pt1FracVal;
self.jet_pt2frac_[0] = self.pt2FracVal;
self.jet_sjdr_[0] = getattr( self.InputTree_, prefix + "_prsubjet1subjet2_deltaR" );
self.deltaR_lca8jet_[0] = getattr( self.InputTree_, prefix + "_deltaR_lca8jet" );
self.deltaphi_METca8jet_[0] = getattr( self.InputTree_, prefix + "_deltaphi_METca8jet_type2" );
self.deltaphi_Vca8jet_[0] = getattr( self.InputTree_, prefix + "_deltaphi_Vca8jet_type2" );
self.deltaphi_METca8jet_met_[0] = getattr( self.InputTree_, prefix + "_deltaphi_METca8jet_type2_met" );
self.deltaphi_Vca8jet_met_[0] = getattr( self.InputTree_, prefix + "_deltaphi_Vca8jet_type2_met" );
#### some generator information
if not self.IsData_ :
self.ungroomed_gen_jet_pt_[0] = getattr( self.InputTree_, "Gen"+prefix+"_pt" )[0];
self.ungroomed_gen_jet_eta_[0] = getattr( self.InputTree_, "Gen"+prefix+"_eta" )[0];
self.ungroomed_gen_jet_phi_[0] = getattr( self.InputTree_, "Gen"+prefix+"_phi" )[0];
self.ungroomed_gen_jet_e_[0] = getattr( self.InputTree_, "Gen"+prefix+"_e" )[0];
self.gen_jet_mass_pr_ = getattr( self.InputTree_, "Gen"+prefix + "_mass_pr" )[0];
self.gen_jet_pt_pr_ = getattr( self.InputTree_, "Gen"+prefix + "_pt_pr" )[0];
# self.gen_jet_grsens_ft_[0] = getattr( self.InputTree_, "Gen"+prefix + "_mass_ft" )[0] / getattr( self.InputTree_, "Gen"+prefix + "_mass" )[0];
# self.gen_jet_grsens_tr_[0] = getattr( self.InputTree_, "Gen"+prefix + "_mass_tr" )[0] / getattr( self.InputTree_, "Gen"+prefix + "_mass" )[0];
# self.gen_jet_massdrop_pr_[0] = getattr( self.InputTree_, "Gen"+prefix + "_massdrop_pr" )[0];
# qjetmassdistribution = getattr( self.InputTree_, "Gen"+prefix+"_qjetmass" );
# if qjetmassdistribution != 0 :
# qjetvol = getListRMS(qjetmassdistribution)/getListMean(qjetmassdistribution);
# self.gen_jet_qjetvol_[0] = qjetvol;
self.gen_jet_tau2tau1_[0] = getattr( self.InputTree_, "Gen"+prefix + "_tau2tau1" )[0];
self.gen_jet_tau2tau1_exkT_[0] = getattr( self.InputTree_, "Gen"+prefix + "_tau2tau1_exkT" )[0];
self.gen_jet_tau2tau1_pr_[0] = getattr( self.InputTree_, "Gen"+prefix + "_tau2tau1_pr" )[0];
self.gen_jet_jetconstituents_[0] = getattr( self.InputTree_, "Gen"+prefix + "_jetconstituents" )[0];
# self.gen_jet_rcore4_[0] = getattr( self.InputTree_, "Gen"+prefix + "_rcores")[3*6 + 0];
# self.gen_jet_rcore5_[0] = getattr( self.InputTree_, "Gen"+prefix + "_rcores")[4*6 + 0];
# self.gen_jet_rcore6_[0] = getattr( self.InputTree_, "Gen"+prefix + "_rcores")[5*6 + 0];
# self.gen_jet_rcore7_[0] = getattr( self.InputTree_, "Gen"+prefix + "_rcores")[6*6 + 0];
######################################################################################
### CA8 jet collection -> scale up and down for the jet energy scale uncertainty ####
######################################################################################
self.jecUnc_.setJetEta( getattr( self.InputTree_, prefix+"_eta" )[0]);
self.jecUnc_.setJetPt( getattr( self.InputTree_, prefix+"_pt" )[0]);
self.j_jecfactor_up_[0] = self.jecUnc_.getUncertainty( True );
self.jecUnc_.setJetEta( getattr( self.InputTree_, prefix+"_eta" )[0]);
self.jecUnc_.setJetPt( getattr( self.InputTree_, prefix+"_pt" )[0]);
self.j_jecfactor_dn_[0] = self.jecUnc_.getUncertainty( False ) ;
self.j_jecfactor_up_[0] = math.sqrt( self.j_jecfactor_up_[0]**2 + 0.02**2 ); ## inflate the uncertainty for the difference between ca8 and ak7
self.j_jecfactor_dn_[0] = math.sqrt( self.j_jecfactor_dn_[0]**2 + 0.02**2 );
self.curjes_up = 1 + self.j_jecfactor_up_[0];
self.curjes_dn = 1 - self.j_jecfactor_dn_[0];
jorig_pt = getattr( self.InputTree_, prefix + "_pt_pr" )[0];
jorig_eta = getattr( self.InputTree_, prefix + "_eta_pr" )[0];
jorig_phi = getattr( self.InputTree_, prefix + "_phi_pr" )[0];
jorig_e = getattr( self.InputTree_, prefix + "_e_pr" )[0];
jdef_ptetaphie = ROOT.TLorentzVector();
jdef_ptetaphie.SetPtEtaPhiE(jorig_pt, jorig_eta, jorig_phi, jorig_e); ## original jet 4V after pruning
jdef_up = ROOT.TLorentzVector(jdef_ptetaphie.Px() * self.curjes_up, jdef_ptetaphie.Py() * self.curjes_up,
jdef_ptetaphie.Pz() * self.curjes_up, jdef_ptetaphie.E() * self.curjes_up); ## scaled up jet
jdef_dn = ROOT.TLorentzVector(jdef_ptetaphie.Px() * self.curjes_dn, jdef_ptetaphie.Py() * self.curjes_dn,
jdef_ptetaphie.Pz() * self.curjes_dn, jdef_ptetaphie.E() * self.curjes_dn); ## scaled down jet
self.jet_mass_pr_jes_up_[0] = jdef_up.M(); ## mass pruned up
self.jet_mass_pr_jes_dn_[0] = jdef_dn.M(); ## mass pruned dwon
jorig_pt = getattr( self.InputTree_, prefix + "_pt" )[0];
jorig_eta = getattr( self.InputTree_, prefix + "_eta" )[0];
jorig_phi = getattr( self.InputTree_, prefix + "_phi" )[0];
jorig_e = getattr( self.InputTree_, prefix + "_e" )[0];
jdef_ptetaphie.SetPtEtaPhiE(jorig_pt, jorig_eta, jorig_phi, jorig_e); ## original jet 4V after pruning
jdef_up.SetPxPyPzE(jdef_ptetaphie.Px() * self.curjes_up, jdef_ptetaphie.Py() * self.curjes_up,
jdef_ptetaphie.Pz() * self.curjes_up, jdef_ptetaphie.E() * self.curjes_up); ## scaled up jet
jdef_dn.SetPxPyPzE(jdef_ptetaphie.Px() * self.curjes_dn, jdef_ptetaphie.Py() * self.curjes_dn,
jdef_ptetaphie.Pz() * self.curjes_dn, jdef_ptetaphie.E() * self.curjes_dn); ## scaled down jet
self.ungroomed_jet_pt_jes_up_[0] = jdef_up.Pt(); ## ungroomed pt up
self.ungroomed_jet_pt_jes_dn_[0] = jdef_dn.Pt(); ## ungroomed pt down
############################################################################
### CA8 jet collection -> smear for the jet energy resolution uncertainty #
############################################################################
## Match the reco selected W candidate with the gen ones:
smearFactor = 1.;
smearError = 0.;
smearFactor_up = 1.;
smearFactor_dn = 1.;
x = math.fabs(jdef_ptetaphie.Eta());
y = jdef_ptetaphie.Pt();
if( x > self.histoJERC_.GetXaxis().GetXmin() and x < self.histoJERC_.GetXaxis().GetXmax() and
y > self.histoJERC_.GetYaxis().GetXmin() and y < self.histoJERC_.GetYaxis().GetXmax()):
bin = self.histoJERC_.FindBin(x,y);
smearFactor += self.histoJERC_.GetBinContent(bin)-1.;
smearError = self.histoJERC_.GetBinError(bin);
smearFactor_up = smearFactor+smearFactor*smearError ;
smearFactor_dn = smearFactor-smearFactor*smearError ;
smearedEnergy = jdef_ptetaphie.E();
smearedEnergy_up = jdef_ptetaphie.E();
smearedEnergy_dn = jdef_ptetaphie.E();
if(math.fabs(jdef_ptetaphie.Eta())<0.5):
if(smearFactor > 1 ):
smearedEnergy = jdef_ptetaphie.E()*(1+self.Random_.Gaus(0.,self.jetResolutionMC_CA8_[0]*math.sqrt(smearFactor*smearFactor-1)));
else :
smearedEnergy = jdef_ptetaphie.E()*(1+self.Random_.Gaus(0.,self.jetResolutionMC_CA8_[0]*math.sqrt(1-smearFactor*smearFactor)));
if(smearFactor_up > 1 ):
smearedEnergy_up = jdef_ptetaphie.E()*(1+self.Random_.Gaus(0.,self.jetResolutionMC_CA8_[0]*math.sqrt(smearFactor_up*smearFactor_up-1)));
else :
smearedEnergy_up = jdef_ptetaphie.E()*(1+self.Random_.Gaus(0.,self.jetResolutionMC_CA8_[0]*math.sqrt(1-smearFactor_up*smearFactor_up)));
if(smearFactor_dn > 1 ):
smearedEnergy_dn = jdef_ptetaphie.E()*(1+self.Random_.Gaus(0.,self.jetResolutionMC_CA8_[0]*math.sqrt(smearFactor_dn*smearFactor_dn-1)));
else :
smearedEnergy_dn = jdef_ptetaphie.E()*(1+self.Random_.Gaus(0.,self.jetResolutionMC_CA8_[0]*math.sqrt(1-smearFactor_dn*smearFactor_dn)));
elif(math.fabs(jdef_ptetaphie.Eta())>= 0.5 and math.fabs(jdef_ptetaphie.Eta())<1.0):
if(smearFactor > 1 ):
smearedEnergy = jdef_ptetaphie.E()*(1+self.Random_.Gaus(0.,self.jetResolutionMC_CA8_[1]*math.sqrt(smearFactor*smearFactor-1)));
else :
smearedEnergy = jdef_ptetaphie.E()*(1+self.Random_.Gaus(0.,self.jetResolutionMC_CA8_[1]*math.sqrt(1-smearFactor*smearFactor)));
if(smearFactor_up > 1 ):
smearedEnergy_up = jdef_ptetaphie.E()*(1+self.Random_.Gaus(0.,self.jetResolutionMC_CA8_[1]*math.sqrt(smearFactor_up*smearFactor_up-1)));
else :
smearedEnergy_up = jdef_ptetaphie.E()*(1+self.Random_.Gaus(0.,self.jetResolutionMC_CA8_[1]*math.sqrt(1-smearFactor_up*smearFactor_up)));
if(smearFactor_dn > 1 ):
smearedEnergy_dn = jdef_ptetaphie.E()*(1+self.Random_.Gaus(0.,self.jetResolutionMC_CA8_[1]*math.sqrt(smearFactor_dn*smearFactor_dn-1)));
else :
smearedEnergy_dn = jdef_ptetaphie.E()*(1+self.Random_.Gaus(0.,self.jetResolutionMC_CA8_[1]*math.sqrt(1-smearFactor_dn*smearFactor_dn)));
elif(math.fabs(jdef_ptetaphie.Eta())>= 1.0 and math.fabs(jdef_ptetaphie.Eta())<1.5):
if(smearFactor > 1 ):
smearedEnergy = jdef_ptetaphie.E()*(1+self.Random_.Gaus(0.,self.jetResolutionMC_CA8_[2]*math.sqrt(smearFactor*smearFactor-1)));
else :
smearedEnergy = jdef_ptetaphie.E()*(1+self.Random_.Gaus(0.,self.jetResolutionMC_CA8_[2]*math.sqrt(1-smearFactor*smearFactor)));
if(smearFactor_up > 1 ):
smearedEnergy_up = jdef_ptetaphie.E()*(1+self.Random_.Gaus(0.,self.jetResolutionMC_CA8_[2]*math.sqrt(smearFactor_up*smearFactor_up-1)));
else :
smearedEnergy_up = jdef_ptetaphie.E()*(1+self.Random_.Gaus(0.,self.jetResolutionMC_CA8_[2]*math.sqrt(1-smearFactor_up*smearFactor_up)));
if(smearFactor_dn > 1 ):
smearedEnergy_dn = jdef_ptetaphie.E()*(1+self.Random_.Gaus(0.,self.jetResolutionMC_CA8_[2]*math.sqrt(smearFactor_dn*smearFactor_dn-1)));
else :
smearedEnergy_dn = jdef_ptetaphie.E()*(1+self.Random_.Gaus(0.,self.jetResolutionMC_CA8_[2]*math.sqrt(1-smearFactor_dn*smearFactor_dn)));