35 |
|
// Temporarily switch off PU reweighting, if asked |
36 |
|
TCut weightbackup=cutWeight; |
37 |
|
if ( !doPUreweighting ) cutWeight="1.0"; |
38 |
< |
|
38 |
> |
|
39 |
|
TCanvas *tempcan = new TCanvas("tempcan","Temporary canvas for peak finding preparations"); |
40 |
|
TH1F *rawJZBeemmMC = allsamples.Draw("rawJZBeemmMC",jzbvariablemc,100,-50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,mc, luminosity); |
41 |
|
TH1F *rawJZBeemmData = allsamples.Draw("rawJZBeemmData",jzbvariabledata,100, -50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data, luminosity); |
72 |
|
delete tempcan; |
73 |
|
} |
74 |
|
|
75 |
+ |
void make_special_obs_pred_mll_plot(string mcjzb, float jzbthreshold) { |
76 |
+ |
float min=70.0; |
77 |
+ |
float max=115.0; |
78 |
+ |
if(!PlottingSetup::RestrictToMassPeak) { |
79 |
+ |
min=10; |
80 |
+ |
max=150; |
81 |
+ |
} |
82 |
+ |
int nbins=int((max-min)/5); |
83 |
+ |
|
84 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
85 |
+ |
|
86 |
+ |
stringstream largerzeroS; |
87 |
+ |
largerzeroS << "(" << mcjzb << ">" << jzbthreshold << ")"; |
88 |
+ |
TCut largerzero(largerzeroS.str().c_str()); |
89 |
+ |
|
90 |
+ |
stringstream smallerzeroS; |
91 |
+ |
smallerzeroS << "(" << mcjzb << "<-" << jzbthreshold << ")"; |
92 |
+ |
TCut smallerzero(smallerzeroS.str().c_str()); |
93 |
+ |
|
94 |
+ |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,data,luminosity); |
95 |
+ |
THStack mcRcorrJZBeemm = allsamples.DrawStack("mcRcorrJZBeemm","mll",nbins,min,max, "m_{ll} [GeV}", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,mc,luminosity); |
96 |
+ |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzero,data,luminosity); |
97 |
+ |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzero,data,luminosity); |
98 |
+ |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzero,data,luminosity); |
99 |
+ |
|
100 |
+ |
TH1F *RcorrJZBSBem; |
101 |
+ |
TH1F *LcorrJZBSBem; |
102 |
+ |
TH1F *RcorrJZBSBeemm; |
103 |
+ |
TH1F *LcorrJZBSBeemm; |
104 |
+ |
|
105 |
+ |
// TH1F *RcorrJZBeemmNoS; |
106 |
+ |
|
107 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
108 |
+ |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzero,data, luminosity); |
109 |
+ |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzero,data, luminosity); |
110 |
+ |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzero,data, luminosity); |
111 |
+ |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzero,data, luminosity); |
112 |
+ |
} |
113 |
+ |
|
114 |
+ |
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
115 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
116 |
+ |
Bpred->Add(RcorrJZBem,1.0/3.); |
117 |
+ |
Bpred->Add(LcorrJZBem,-1.0/3.); |
118 |
+ |
Bpred->Add(RcorrJZBSBem,1.0/3.); |
119 |
+ |
Bpred->Add(LcorrJZBSBem,-1.0/3.); |
120 |
+ |
Bpred->Add(RcorrJZBSBeemm,1.0/3.); |
121 |
+ |
Bpred->Add(LcorrJZBSBeemm,-1.0/3.); |
122 |
+ |
} else { |
123 |
+ |
Bpred->Add(RcorrJZBem,1.0); |
124 |
+ |
Bpred->Add(LcorrJZBem,-1.0); |
125 |
+ |
} |
126 |
+ |
|
127 |
+ |
Bpred->SetLineColor(kRed); |
128 |
+ |
|
129 |
+ |
RcorrJZBeemm->Draw(); |
130 |
+ |
mcRcorrJZBeemm.Draw("same"); |
131 |
+ |
Bpred->Draw("histo,same"); |
132 |
+ |
RcorrJZBeemm->Draw("same"); |
133 |
+ |
|
134 |
+ |
TLegend *leg = allsamples.allbglegend(); |
135 |
+ |
leg->SetX1(0.58); |
136 |
+ |
leg->AddEntry(RcorrJZBeemm,"observed (data)","l"); |
137 |
+ |
leg->AddEntry(Bpred,"predicted (data)","l"); |
138 |
+ |
leg->Draw("same"); |
139 |
+ |
|
140 |
+ |
stringstream saveas; |
141 |
+ |
saveas << "kin/Mll_After_Cut/Cut_At" << jzbthreshold; |
142 |
+ |
CompleteSave(ckin,saveas.str()); |
143 |
+ |
|
144 |
+ |
delete RcorrJZBeemm; |
145 |
+ |
delete LcorrJZBeemm; |
146 |
+ |
delete RcorrJZBem; |
147 |
+ |
delete LcorrJZBem; |
148 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
149 |
+ |
delete RcorrJZBSBeemm; |
150 |
+ |
delete LcorrJZBSBeemm; |
151 |
+ |
delete RcorrJZBSBem; |
152 |
+ |
delete LcorrJZBSBem; |
153 |
+ |
} |
154 |
+ |
delete Bpred; |
155 |
+ |
delete ckin; |
156 |
+ |
} |
157 |
+ |
|
158 |
|
void make_special_mll_plot(int nbins, float min, float max, bool logscale,string xlabel) { |
159 |
|
|
160 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
189 |
|
TIter next(bgleg->GetListOfPrimitives()); |
190 |
|
TObject* obj; |
191 |
|
// Copy the nice bkgd legend skipping the "data" |
192 |
< |
while ( obj = next() ) |
192 |
> |
while ( (obj = next()) ) |
193 |
|
if ( strcmp(((TLegendEntry*)obj)->GetObject()->GetName(),"datahistoOSSF") ) |
194 |
|
kinleg->GetListOfPrimitives()->Add(obj); |
195 |
|
|
208 |
|
TIter next(hmc.GetHists()); |
209 |
|
TObject* obj; |
210 |
|
TH1* hratio = NULL; |
211 |
< |
while ( obj = next() ) { |
211 |
> |
while ( (obj = next()) ) { |
212 |
|
if ( !hratio ) { |
213 |
|
hratio = (TH1*)obj->Clone(); |
214 |
|
hratio->SetName("hratio"); |
269 |
|
TCut cut; |
270 |
|
cut=cutmass&&cutOSSF&&cutnJets&&ibasiccut; |
271 |
|
if(filename=="nJets") cut=cutmass&&cutOSSF&&ibasiccut; |
272 |
+ |
if(filename=="nJets_osof") cut=cutmass&&cutOSOF&&ibasiccut; |
273 |
|
if(filename=="nJets_nocuts_except_mll_ossf") cut=cutmass&&cutOSSF; |
274 |
|
if(filename=="mll") { |
275 |
|
cut=cutOSSF&&cutnJets&&ibasiccut; |
281 |
|
draw_separation_lines=true; |
282 |
|
} |
283 |
|
if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1"; |
284 |
< |
if(filename=="mll_aboveJZB100") cut=cutOSSF&&cutnJets&&ibasiccut; |
284 |
> |
if(Contains(filename,"mll_aboveJZB100")) cut=cutOSSF&&cutnJets&&ibasiccut; |
285 |
> |
if(Contains(filename,"mll_osof_aboveJZB")) cut=cutOSOF&&cutnJets&&ibasiccut; |
286 |
|
if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutOSSF; |
287 |
|
if(filename=="mll_inclusive_osof") cut=cutOSOF; |
288 |
|
if(filename=="mll_inclusive_ee") cut=cutOSSF&&"id1==0"; |
297 |
|
THStack mcstack = allsamples.DrawStack("mcstack",variable,nbins,min,max, xlabel, "events",cut,mc,luminosity); |
298 |
|
if(variable=="pfJetGoodPt[0]") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
299 |
|
if(variable=="pt") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
300 |
< |
if(filename=="mll_inclusive") datahisto->SetMinimum(1); |
300 |
> |
if(filename=="mll_inclusive"||filename=="mll_inclusive_mm"||filename=="mll_inclusive_ee") datahisto->SetMinimum(1); |
301 |
|
if(filename=="mll_osof") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
302 |
|
if(filename=="mll_osof") datahisto->SetMinimum(9); |
218 |
– |
|
303 |
|
datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
304 |
|
datahisto->Draw("e1"); |
305 |
|
ckin->Update(); |
379 |
|
delete ckin; |
380 |
|
} |
381 |
|
|
298 |
– |
|
382 |
|
void make_JES_plot() { |
383 |
|
|
384 |
|
int nbins=10; |
430 |
|
bool dolog=true; |
431 |
|
bool nolog=false; |
432 |
|
if(doPF) write_warning(__FUNCTION__,"Please use caution when trying to produce PF plots; not all versions of the JZB trees have these variables!"); |
433 |
< |
float mll_low=40; |
433 |
> |
float mll_low=50; |
434 |
|
float mll_hi=160; |
435 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
436 |
< |
mll_low=30; |
437 |
< |
mll_hi=180; |
436 |
> |
mll_low=20; |
437 |
> |
mll_hi=210; |
438 |
|
} |
439 |
+ |
|
440 |
+ |
make_kin_plot("met[4]","",40,0,200,dolog,"MET [GeV]","met",doPF,true); |
441 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true); |
442 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true); |
443 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true); |
445 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true); |
446 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true); |
447 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true); |
448 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
448 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/2,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
449 |
|
make_kin_plot("mll","",(int)((350-mll_low)),mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF); |
450 |
< |
make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
451 |
< |
make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
450 |
> |
make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF); |
451 |
> |
// make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
452 |
> |
// make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
453 |
|
make_kin_plot("pt","",50,0,400,dolog,"Z p_{T} [GeV]","Zpt",doPF); |
454 |
|
make_kin_plot("pt1","",50,0,100,nolog,"p_{T} [GeV]","pt1",doPF); |
455 |
|
make_kin_plot("pt2","",50,0,100,nolog,"p_{T} [GeV]","pt2",doPF); |
456 |
|
make_kin_plot("eta1","",40,-5,5,nolog,"#eta_{l}","eta",doPF); |
457 |
|
make_kin_plot("jzb[1]","",100,-150,150,dolog,"JZB [GeV]","jzb_ossf",doPF); |
458 |
< |
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets",doPF); |
459 |
< |
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF); |
458 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets",doPF); |
459 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF); |
460 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF); |
461 |
|
if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]"); |
462 |
|
stringstream jzbcut; |
463 |
|
jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))"; |
464 |
|
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
465 |
+ |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_aboveJZB100",doPF,true); |
466 |
+ |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
467 |
+ |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_aboveJZB100",doPF,true); |
468 |
+ |
stringstream jzbcut2; |
469 |
+ |
jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))"; |
470 |
+ |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true); |
471 |
+ |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_aboveJZB150",doPF,true); |
472 |
+ |
stringstream jzbcut3; |
473 |
+ |
jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))"; |
474 |
+ |
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true); make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_aboveJZB50",doPF,true,true); |
475 |
+ |
|
476 |
+ |
make_special_obs_pred_mll_plot(mcjzb,0); |
477 |
+ |
make_special_obs_pred_mll_plot(mcjzb,50); |
478 |
+ |
make_special_obs_pred_mll_plot(mcjzb,100); |
479 |
+ |
make_special_obs_pred_mll_plot(mcjzb,150); |
480 |
+ |
make_special_obs_pred_mll_plot(mcjzb,200); |
481 |
+ |
make_special_obs_pred_mll_plot(mcjzb,250); |
482 |
|
} |
483 |
|
|
484 |
|
void make_comp_plot( string var, string xlabel, string filename, float jzbcut, string mcjzb, string datajzb, |
550 |
|
|
551 |
|
|
552 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- the arguments changed |
553 |
< |
for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) { |
553 |
> |
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
554 |
|
float jzbcut=jzb_cuts[ijzb]; // Comparison plots are done for this JZB cut |
555 |
|
float mll_low=50;float mll_high=170; |
556 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
857 |
|
return return_functions; |
858 |
|
} |
859 |
|
|
860 |
< |
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float sigma, float high, int use_data, bool overlay_signal = false ) |
860 |
> |
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float sigma, float high, int use_data, bool overlay_signal = false,string subdir="" ) |
861 |
|
{ |
862 |
+ |
// note: sigma is not used ATM |
863 |
|
switch_overunderflow(true); |
864 |
|
bool is_data=false; |
865 |
|
bool use_signal=false; |
934 |
|
|
935 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
936 |
|
TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred"); |
937 |
+ |
|
938 |
+ |
TH1F *BpredSys = (TH1F*)LcorrJZBeemm->Clone("Bpredsys"); |
939 |
+ |
ClearHisto(BpredSys); |
940 |
+ |
write_error(__FUNCTION__,"Implemented systematic error but NOT drawing it yet. Need to still implement drawing, particularly in ratio."); |
941 |
+ |
|
942 |
|
if(PlottingSetup::RestrictToMassPeak) { |
943 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
944 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
961 |
|
JBpred->Add(JLcorrJZBSBem,-1.0/3.); |
962 |
|
JBpred->Add(JRcorrJZBSBeemm,1.0/3.); |
963 |
|
JBpred->Add(JLcorrJZBSBeemm,-1.0/3.); |
964 |
+ |
|
965 |
+ |
//Systematics: |
966 |
+ |
AddSquared(BpredSys,LcorrJZBeemm,zjetsestimateuncertONPEAK*zjetsestimateuncertONPEAK); |
967 |
+ |
AddSquared(BpredSys,RcorrJZBem,emuncertONPEAK*emuncertONPEAK*(1.0/9)); |
968 |
+ |
AddSquared(BpredSys,LcorrJZBem,emuncertONPEAK*emuncertONPEAK*(1.0/9)); |
969 |
+ |
AddSquared(BpredSys,RcorrJZBSBem,emsidebanduncertONPEAK*emsidebanduncertONPEAK*(1.0/9)); |
970 |
+ |
AddSquared(BpredSys,LcorrJZBSBem,emsidebanduncertONPEAK*emsidebanduncertONPEAK*(1.0/9)); |
971 |
+ |
AddSquared(BpredSys,RcorrJZBSBeemm,eemmsidebanduncertONPEAK*eemmsidebanduncertONPEAK*(1.0/9)); |
972 |
+ |
AddSquared(BpredSys,LcorrJZBSBeemm,eemmsidebanduncertONPEAK*eemmsidebanduncertONPEAK*(1.0/9)); |
973 |
|
} else { |
974 |
|
Bpred->Add(RcorrJZBem,1.0); |
975 |
|
Bpred->Add(LcorrJZBem,-1.0); |
979 |
|
//these are for the ratio |
980 |
|
JBpred->Add(JRcorrJZBem,1.0); |
981 |
|
JBpred->Add(JLcorrJZBem,-1.0); |
982 |
+ |
|
983 |
+ |
//Systematics |
984 |
+ |
AddSquared(BpredSys,LcorrJZBeemm,zjetsestimateuncertOFFPEAK*zjetsestimateuncertOFFPEAK); |
985 |
+ |
AddSquared(BpredSys,RcorrJZBem,emuncertOFFPEAK*emuncertOFFPEAK); |
986 |
+ |
AddSquared(BpredSys,LcorrJZBem,emuncertOFFPEAK*emuncertOFFPEAK); |
987 |
+ |
|
988 |
|
} |
989 |
|
|
990 |
< |
|
990 |
> |
SQRT(BpredSys); |
991 |
> |
|
992 |
|
|
993 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed |
994 |
|
TH1F *Tpred = (TH1F*)RcorrJZBem->Clone("Bpred"); |
1033 |
|
blankback->Draw(); |
1034 |
|
if(use_data==1) |
1035 |
|
{ |
1036 |
+ |
//Bpred->SetLineWidth(3); //paper style.overruled. |
1037 |
+ |
//lm4RcorrJZBeemm->SetLineWidth(3); //paper style.overruled. |
1038 |
|
analytical_function = do_extended_fit_to_plot(Bpred,Tpred,LcorrJZBeemm,LcorrJZBem,is_data); |
1039 |
|
kinpad->cd();//necessary because the extended fit function creates its own canvas |
1040 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1041 |
|
|
1042 |
|
Bpred->Draw("hist,same"); |
1043 |
< |
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1043 |
> |
//analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1044 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1045 |
|
lm4RcorrJZBeemm->Draw("hist,same"); |
1046 |
|
legBpred->AddEntry(RcorrJZBeemm,"observed","p"); |
1076 |
|
Bpred->Draw("hist,same"); |
1077 |
|
// analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1078 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1079 |
< |
// TH1F *lm4RcorrJZBeemmC = (TH1F*)lm4RcorrJZBeemm->Clone("lm4RcorrJZBeemmC"); |
952 |
< |
// lm4RcorrJZBeemmC->SetLineColor(kOrange+1); |
953 |
< |
lm4RcorrJZBeemm->SetLineColor(kOrange+1); |
954 |
< |
// lm4RcorrJZBeemmC->Draw("histo,same"); |
1079 |
> |
// lm4RcorrJZBeemm->SetLineColor(kOrange+1); |
1080 |
|
lm4RcorrJZBeemm->SetLineWidth(2); |
1081 |
+ |
//lm4RcorrJZBeemm->SetLineWidth(2); // paper style. overruled. |
1082 |
|
lm4RcorrJZBeemm->Draw("histo,same"); |
1083 |
|
DrawPrelim(); |
1084 |
|
TLegend *speciallegBpred = make_legend("",0.45,0.55); |
1085 |
+ |
//TLegend *speciallegBpred = make_legend("",0.35,0.55); // paper style. overruled. |
1086 |
|
speciallegBpred->AddEntry(RcorrJZBeemm,"Data","pl"); |
1087 |
|
speciallegBpred->AddEntry(Bpred,"Total background","l"); |
1088 |
|
speciallegBpred->AddEntry(jzbnegative,"JZB<0 (data)","f"); |
1090 |
|
// speciallegBpred->AddEntry(lm4RcorrJZBeemmC,"LM4","l"); |
1091 |
|
speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1092 |
|
speciallegBpred->Draw(); |
1093 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,predcomppad,"Bpred_Data_____PredictionComposition",true,use_data!=1,"data/pred"); |
1093 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition",true,use_data!=1,"data/pred"); |
1094 |
|
|
1095 |
|
TCanvas *specialcanv = new TCanvas("specialcanv","specialcanv"); |
1096 |
|
THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal); |
1101 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1102 |
|
legBpred->Draw(); |
1103 |
|
DrawPrelim(); |
1104 |
< |
CompleteSave(specialcanv,"Bpred_Data_____PredictionCompositioninMC"); |
1104 |
> |
CompleteSave(specialcanv,subdir+"Bpred_Data_____PredictionCompositioninMC"); |
1105 |
|
Bpred->SetLineWidth((int)CurrentBpredLineWidth); |
1106 |
|
|
1107 |
|
delete speciallegBpred; |
1112 |
|
} |
1113 |
|
if(use_data==0) { |
1114 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1115 |
+ |
//Bpred->SetLineWidth(3); // paper style. overruled. |
1116 |
|
Bpred->Draw("hist,same"); |
1117 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1118 |
|
legBpred->AddEntry(RcorrJZBeemm,"MC true","p"); |
1119 |
< |
legBpred->AddEntry(Bpred,"MC predicted","l"); |
1119 |
> |
legBpred->AddEntry(Bpred,"MC predicted","l"); |
1120 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18 |
1121 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // causes seg fault on root v5.18 |
1122 |
|
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1127 |
|
} |
1128 |
|
if(use_data==2) { |
1129 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1130 |
+ |
//Bpred->SetLineWidth(3); // paper style. overruled. |
1131 |
|
Bpred->Draw("hist,same"); |
1132 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1133 |
|
legBpred->AddEntry(RcorrJZBeemm,"MC true","p"); |
1143 |
|
// CompleteSave(globalcanvas,"Bpred_MCwithS"); // done below in save_with_ratio |
1144 |
|
} |
1145 |
|
{ |
1146 |
+ |
//lm4RcorrJZBeemm->SetLineWidth(3); //paper style. overruled. |
1147 |
+ |
//RcorrJZBeemmNoS->SetLineWidth(3); //paper style. overruled. |
1148 |
+ |
//lm4RcorrJZBeemm->SetLineStyle(2); //paper style. overruled. |
1149 |
+ |
//RcorrJZBeemmNoS->SetLineStyle(3); //paper style. overruled. |
1150 |
+ |
//lm4RcorrJZBeemm->SetLineColor(kOrange+1); //paper style. overruled. |
1151 |
+ |
|
1152 |
|
RcorrJZBeemmNoS->SetLineStyle(2); |
1153 |
|
legBpred2->AddEntry(RcorrJZBeemmNoS,"MC B","l"); |
1154 |
|
legBpred2->AddEntry(lm4RcorrJZBeemm,"MC S","l"); |
1168 |
|
string ytitle("ratio"); |
1169 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
1170 |
|
//save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,use_data!=1,ytitle); |
1171 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,false,ytitle);//not extending the y range anymore up to 4 |
1171 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,false,ytitle);//not extending the y range anymore up to 4 |
1172 |
|
|
1173 |
|
|
1174 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1175 |
|
/// The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!) |
1176 |
< |
if(!PlottingSetup::RestrictToMassPeak) return; |
1177 |
< |
TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem"); |
1178 |
< |
Bpredem->Add(RcorrJZBem); |
1179 |
< |
Bpredem->Add(LcorrJZBem,-1); |
1180 |
< |
TH1F *BpredSBem = (TH1F*)LcorrJZBeemm->Clone("BpredSBem"); |
1181 |
< |
BpredSBem->Add(RcorrJZBSBem); |
1182 |
< |
Bpred->Add(LcorrJZBSBem,-1); |
1183 |
< |
TH1F *BpredSBeemm = (TH1F*)LcorrJZBeemm->Clone("BpredSBeemm"); |
1184 |
< |
BpredSBeemm->Add(RcorrJZBSBeemm); |
1185 |
< |
BpredSBeemm->Add(LcorrJZBSBeemm,-1.0); |
1186 |
< |
globalcanvas->cd(); |
1187 |
< |
globalcanvas->SetLogy(1); |
1188 |
< |
|
1189 |
< |
RcorrJZBeemm->SetMarkerStyle(20); |
1190 |
< |
RcorrJZBeemm->GetXaxis()->SetRangeUser(0,high); |
1191 |
< |
blankback->Draw(); |
1192 |
< |
RcorrJZBeemm->Draw("e1x0,same"); |
1193 |
< |
RcorrJZBeemm->SetMarkerSize(DataMarkerSize); |
1194 |
< |
|
1195 |
< |
Bpredem->SetLineColor(kRed+1); |
1196 |
< |
Bpredem->SetStats(0); |
1197 |
< |
Bpredem->Draw("hist,same"); |
1198 |
< |
|
1199 |
< |
BpredSBem->SetLineColor(kGreen+2);//TColor::GetColor("#0B6138")); |
1200 |
< |
BpredSBem->SetLineStyle(2); |
1201 |
< |
BpredSBem->Draw("hist,same"); |
1202 |
< |
|
1203 |
< |
BpredSBeemm->SetLineColor(kBlue+1); |
1204 |
< |
BpredSBeemm->SetLineStyle(3); |
1205 |
< |
BpredSBeemm->Draw("hist,same"); |
1206 |
< |
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1207 |
< |
|
1208 |
< |
TLegend *legBpredc = make_legend("",0.6,0.55); |
1209 |
< |
if(use_data==1) |
1210 |
< |
{ |
1211 |
< |
legBpredc->AddEntry(RcorrJZBeemm,"observed","p"); |
1212 |
< |
legBpredc->AddEntry(Bpredem,"OFZP","l"); |
1213 |
< |
legBpredc->AddEntry(BpredSBem,"OFSB","l"); |
1214 |
< |
legBpredc->AddEntry(BpredSBeemm,"SFSB","l"); |
1215 |
< |
legBpredc->Draw(); |
1216 |
< |
CompleteSave(globalcanvas,"Bpred_Data_comparison"); |
1217 |
< |
} |
1218 |
< |
if(use_data==0) { |
1219 |
< |
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
1220 |
< |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1221 |
< |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1222 |
< |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1223 |
< |
legBpredc->Draw(); |
1224 |
< |
CompleteSave(globalcanvas,"Bpred_MC_comparison"); |
1225 |
< |
} |
1226 |
< |
if(use_data==2) { |
1227 |
< |
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
1228 |
< |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1229 |
< |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1230 |
< |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1231 |
< |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1232 |
< |
legBpredc->Draw(); |
1233 |
< |
CompleteSave(globalcanvas,"Bpred_MCwithS_comparison"); |
1176 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
1177 |
> |
TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem"); |
1178 |
> |
Bpredem->Add(RcorrJZBem); |
1179 |
> |
Bpredem->Add(LcorrJZBem,-1); |
1180 |
> |
TH1F *BpredSBem = (TH1F*)LcorrJZBeemm->Clone("BpredSBem"); |
1181 |
> |
BpredSBem->Add(RcorrJZBSBem); |
1182 |
> |
Bpred->Add(LcorrJZBSBem,-1); |
1183 |
> |
TH1F *BpredSBeemm = (TH1F*)LcorrJZBeemm->Clone("BpredSBeemm"); |
1184 |
> |
BpredSBeemm->Add(RcorrJZBSBeemm); |
1185 |
> |
BpredSBeemm->Add(LcorrJZBSBeemm,-1.0); |
1186 |
> |
globalcanvas->cd(); |
1187 |
> |
globalcanvas->SetLogy(1); |
1188 |
> |
|
1189 |
> |
RcorrJZBeemm->SetMarkerStyle(20); |
1190 |
> |
RcorrJZBeemm->GetXaxis()->SetRangeUser(0,high); |
1191 |
> |
blankback->Draw(); |
1192 |
> |
RcorrJZBeemm->Draw("e1x0,same"); |
1193 |
> |
RcorrJZBeemm->SetMarkerSize(DataMarkerSize); |
1194 |
> |
|
1195 |
> |
Bpredem->SetLineColor(kRed+1); |
1196 |
> |
Bpredem->SetStats(0); |
1197 |
> |
Bpredem->Draw("hist,same"); |
1198 |
> |
|
1199 |
> |
BpredSBem->SetLineColor(kGreen+2);//TColor::GetColor("#0B6138")); |
1200 |
> |
BpredSBem->SetLineStyle(2); |
1201 |
> |
BpredSBem->Draw("hist,same"); |
1202 |
> |
|
1203 |
> |
BpredSBeemm->SetLineColor(kBlue+1); |
1204 |
> |
BpredSBeemm->SetLineStyle(3); |
1205 |
> |
BpredSBeemm->Draw("hist,same"); |
1206 |
> |
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1207 |
> |
|
1208 |
> |
TLegend *legBpredc = make_legend("",0.6,0.55); |
1209 |
> |
if(use_data==1) |
1210 |
> |
{ |
1211 |
> |
legBpredc->AddEntry(RcorrJZBeemm,"observed","p"); |
1212 |
> |
legBpredc->AddEntry(Bpredem,"OFZP","l"); |
1213 |
> |
legBpredc->AddEntry(BpredSBem,"OFSB","l"); |
1214 |
> |
legBpredc->AddEntry(BpredSBeemm,"SFSB","l"); |
1215 |
> |
legBpredc->Draw(); |
1216 |
> |
CompleteSave(globalcanvas,subdir+"Bpred_Data_comparison"); |
1217 |
> |
} |
1218 |
> |
if(use_data==0) { |
1219 |
> |
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
1220 |
> |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1221 |
> |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1222 |
> |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1223 |
> |
legBpredc->Draw(); |
1224 |
> |
CompleteSave(globalcanvas,subdir+"Bpred_MC_comparison"); |
1225 |
> |
} |
1226 |
> |
if(use_data==2) { |
1227 |
> |
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
1228 |
> |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1229 |
> |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1230 |
> |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1231 |
> |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1232 |
> |
legBpredc->Draw(); |
1233 |
> |
CompleteSave(globalcanvas,subdir+"Bpred_MCwithS_comparison"); |
1234 |
> |
} |
1235 |
|
} |
1236 |
+ |
|
1237 |
|
delete RcorrJZBeemm; |
1238 |
|
delete LcorrJZBeemm; |
1239 |
|
delete RcorrJZBem; |
1264 |
|
void do_prediction_plots(string mcjzb, string datajzb, float DataSigma, float MCSigma, bool overlay_signal ) { |
1265 |
|
TCanvas *globalcanvas = new TCanvas("globalcanvas","Prediction Canvas"); |
1266 |
|
do_prediction_plot(datajzb,globalcanvas,DataSigma,jzbHigh ,data,overlay_signal); |
1267 |
< |
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mc,overlay_signal); |
1268 |
< |
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mcwithsignal,overlay_signal); |
1267 |
> |
if ( !PlottingSetup::Approved ) { |
1268 |
> |
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mc,overlay_signal); |
1269 |
> |
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mcwithsignal,overlay_signal); |
1270 |
> |
} else { |
1271 |
> |
write_info(__FUNCTION__,"You set approved to true, therefore not producing prediction/observation plots for MC with and without signal."); |
1272 |
> |
} |
1273 |
|
} |
1274 |
|
|
1275 |
|
void do_ratio_plot(int is_data,vector<float> binning, string jzb, TCanvas *can, float high=-9999) { |
1619 |
|
TText *writeline1 = write_cut_on_canvas(write_cut.c_str()); |
1620 |
|
writeline1->SetTextSize(0.035); |
1621 |
|
writeline1->Draw(); |
1622 |
< |
save_with_ratio(datahisto,mcstack,jzbpad->cd(),("jzb/"+savename)); |
1622 |
> |
if(!Contains(savename,"Dibosons")) save_with_ratio(datahisto,mcstack,jzbpad->cd(),("jzb/"+savename)); |
1623 |
> |
else save_with_ratio(datahisto,mcstack,jzbpad->cd(),savename); |
1624 |
|
TPad *jzbpad2 = new TPad("jzbpad2","jzbpad2",0,0,1,1); |
1625 |
|
jzbpad2->cd(); |
1626 |
|
jzbpad2->SetLogy(1); |
1635 |
|
writeline1->SetTextSize(0.035); |
1636 |
|
writeline1->Draw(); |
1637 |
|
DrawPrelim(); |
1638 |
< |
save_with_ratio(datahisto,mcstack,jzbpad2->cd(),("jzb/PositiveSideOnly/"+savename+"")); |
1638 |
> |
if(!Contains(savename,"Dibosons")) save_with_ratio(datahisto,mcstack,jzbpad2->cd(),("jzb/PositiveSideOnly/"+savename+"")); |
1639 |
> |
else save_with_ratio(datahisto,mcstack,jzbpad2->cd(),(savename+"__PosOnly")); |
1640 |
|
datahisto->Delete(); |
1641 |
|
mcstack.Delete(); |
1642 |
|
} |
1644 |
|
Double_t GausR(Double_t *x, Double_t *par) { |
1645 |
|
return gRandom->Gaus(x[0],par[0]); |
1646 |
|
} |
1647 |
+ |
|
1648 |
+ |
void produce_stretched_jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
1649 |
+ |
TCanvas *dican = new TCanvas("dican","JZB Plots Canvas"); |
1650 |
+ |
float max=jzbHigh ; |
1651 |
+ |
float min=-120; |
1652 |
+ |
int nbins=(int)((max-min)/5.0); // we want 5 GeV/bin |
1653 |
+ |
int coarserbins=int(nbins/2.0); |
1654 |
+ |
int rebinnedbins=int(nbins/4.0); |
1655 |
|
|
1656 |
+ |
vector<float>binning;vector<float>coarse_binning;vector<float>coarsest_binning; |
1657 |
+ |
for(int i=0;i<=nbins;i++)binning.push_back(min+i*(max-min)/((float)nbins)); |
1658 |
+ |
for(int i=0;i<=coarserbins;i++)coarse_binning.push_back(min+i*(max-min)/((float)coarserbins)); |
1659 |
+ |
for(int i=0;i<=rebinnedbins;i++)coarsest_binning.push_back(min+i*(max-min)/((float)rebinnedbins)); |
1660 |
+ |
|
1661 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_SFZP",dican,binning); |
1662 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_OFZP",dican,binning); |
1663 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"Dibosons/ee/jzb_OS_SFZP",dican,binning); |
1664 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_SFZP",dican,binning); |
1665 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"Dibosons/ee/jzb_OS_OFZP",dican,binning); |
1666 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_OFZP",dican,binning); |
1667 |
+ |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning); |
1668 |
+ |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning); |
1669 |
+ |
|
1670 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_SFZP_coarse",dican,coarse_binning); |
1671 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_OFZP_coarse",dican,coarse_binning); |
1672 |
+ |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning); |
1673 |
+ |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning); |
1674 |
+ |
|
1675 |
+ |
delete dican; |
1676 |
+ |
} |
1677 |
+ |
|
1678 |
+ |
|
1679 |
+ |
void diboson_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
1680 |
+ |
vector<int> SamplesToBeModified = allsamples.FindSampleBySampleName("WW/WZ/ZZ"); |
1681 |
+ |
|
1682 |
+ |
if(SamplesToBeModified.size()==0 || SamplesToBeModified[0]==-1) { |
1683 |
+ |
write_error(__FUNCTION__,"Could not find any diboson samples - aborting diboson plots"); |
1684 |
+ |
return; |
1685 |
+ |
} |
1686 |
+ |
|
1687 |
+ |
float stretchfactor = 100.0; |
1688 |
+ |
vector<string> labels; |
1689 |
+ |
|
1690 |
+ |
|
1691 |
+ |
dout << "Going to increase the cross section for diboson samples ... " << endl; |
1692 |
+ |
for(int i=0;i<(int)SamplesToBeModified.size();i++) { |
1693 |
+ |
float origxs=(allsamples.collection)[SamplesToBeModified[i]].xs; |
1694 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].xs=origxs*stretchfactor; |
1695 |
+ |
dout << " Increased xs for sample " << (allsamples.collection)[SamplesToBeModified[i]].filename << " from " << origxs << " to " << (allsamples.collection)[SamplesToBeModified[i]].xs << " (by a factor of " << stretchfactor << ")" << endl; |
1696 |
+ |
labels.push_back((allsamples.collection)[SamplesToBeModified[i]].samplename); |
1697 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].samplename=any2string(int(stretchfactor))+" x "+(allsamples.collection)[SamplesToBeModified[i]].samplename; |
1698 |
+ |
dout << " (also renamed it to " << (allsamples.collection)[SamplesToBeModified[i]].samplename << " )" << endl; |
1699 |
+ |
} |
1700 |
+ |
|
1701 |
+ |
dout << "Going to produce JZB plots" << endl; |
1702 |
+ |
produce_stretched_jzb_plots(mcjzb,datajzb,ratio_binning); |
1703 |
+ |
TCanvas *gloca = new TCanvas("gloca","gloca"); |
1704 |
+ |
float sigma=123456; |
1705 |
+ |
|
1706 |
+ |
dout << "Going to produce prediction plots" << endl; |
1707 |
+ |
do_prediction_plot(mcjzb, gloca, sigma, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do only MC plots, no signal |
1708 |
+ |
do_prediction_plot(mcjzb, gloca, sigma, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do MC plots with signal |
1709 |
+ |
delete gloca; |
1710 |
+ |
|
1711 |
+ |
dout << "Going to reset the cross section for diboson samples ... " << endl; |
1712 |
+ |
for(int i=0;i<(int)SamplesToBeModified.size();i++) { |
1713 |
+ |
float Upxs=(allsamples.collection)[SamplesToBeModified[i]].xs; |
1714 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].xs=(allsamples.collection)[SamplesToBeModified[i]].xs*(1.0/stretchfactor); |
1715 |
+ |
string Upname=(allsamples.collection)[SamplesToBeModified[i]].samplename; |
1716 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].samplename=labels[i]; |
1717 |
+ |
dout << " Reset xs for sample " << (allsamples.collection)[SamplesToBeModified[i]].samplename << " from " << Upxs << " to " << (allsamples.collection)[SamplesToBeModified[i]].xs << " (by a factor of " << stretchfactor << ") and reset the correct name (from " << Upname << ")" << endl; |
1718 |
+ |
|
1719 |
+ |
} |
1720 |
+ |
|
1721 |
+ |
} |
1722 |
|
void jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
1723 |
|
TCanvas *can = new TCanvas("can","JZB Plots Canvas"); |
1724 |
|
float max=jzbHigh ; |
1732 |
|
for(int i=0;i<=coarserbins;i++)coarse_binning.push_back(min+i*(max-min)/((float)coarserbins)); |
1733 |
|
for(int i=0;i<=rebinnedbins;i++)coarsest_binning.push_back(min+i*(max-min)/((float)rebinnedbins)); |
1734 |
|
|
1735 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP",can,binning); |
1736 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP",can,binning); |
1737 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_SFZP",can,binning); |
1738 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_SFZP",can,binning); |
1739 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning); |
1740 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning); |
1741 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1742 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
1743 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
1735 |
> |
if ( !PlottingSetup::Approved ) { |
1736 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP",can,binning); |
1737 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP",can,binning); |
1738 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_SFZP",can,binning); |
1739 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_SFZP",can,binning); |
1740 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning); |
1741 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning); |
1742 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1743 |
> |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
1744 |
> |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
1745 |
> |
} |
1746 |
|
|
1747 |
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP_coarse",can,coarse_binning); |
1748 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning); |
1749 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1750 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
1751 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
1752 |
< |
|
1753 |
< |
// draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP_coarsest",can,coarsest_binning); |
1754 |
< |
// draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarsest",can,coarsest_binning); |
1536 |
< |
// flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1537 |
< |
// if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarsest",can,coarsest_binning); |
1538 |
< |
// if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarsest",can,coarsest_binning); |
1748 |
> |
if ( !PlottingSetup::Approved ) { |
1749 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning); |
1750 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1751 |
> |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
1752 |
> |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
1753 |
> |
} |
1754 |
> |
delete can; |
1755 |
|
} |
1756 |
|
|
1757 |
|
|
1806 |
|
string posneg[] = {"pos","neg"}; |
1807 |
|
TCut tkRegions[] = {cutOSSF&&cutnJets&&cutmass,cutOSOF&&cutnJets&&cutmass,cutOSSF&&cutnJets&&sidebandcut,cutOSOF&&cutnJets&&sidebandcut}; |
1808 |
|
|
1809 |
< |
for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) { |
1809 |
> |
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
1810 |
|
TCut jzbMC[] = { give_jzb_expression(mcjzb,jzb_cuts[ijzb],"pos"), give_jzb_expression(mcjzb,jzb_cuts[ijzb],"neg") }; |
1811 |
|
dout << "_________________________________________________________" << endl; |
1812 |
|
dout << "Table for JZB> " << jzb_cuts[ijzb] << endl; |
1813 |
< |
for(int isample=0;isample<(allsamples.collection).size();isample++) { |
1813 |
> |
for(int isample=0;isample<(int)(allsamples.collection).size();isample++) { |
1814 |
|
if(!(allsamples.collection)[isample].is_data) dout << (allsamples.collection)[isample].samplename << " & "; |
1815 |
|
else dout << "Sample & "; |
1816 |
|
for(int iregion=0;iregion<nRegions;iregion++) { |
2069 |
|
|
2070 |
|
void draw_ttbar_and_zjets_shape(string mcjzb, string datajzb) { |
2071 |
|
int all_leptons=-1; |
1856 |
– |
int electrons_only=0; |
1857 |
– |
int mu_only=1; |
1858 |
– |
int twojetswith50gev=1; |
2072 |
|
int threejetswith30gev=0; |
2073 |
|
/* |
2074 |
+ |
int twojetswith50gev=1; |
2075 |
+ |
int electrons_only=0; |
2076 |
+ |
int mu_only=1; |
2077 |
+ |
|
2078 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,twojetswith50gev); |
2079 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev); |
2080 |
|
|
2093 |
|
TCanvas *cancorr = new TCanvas("cancorr","Canvas for Response Correction"); |
2094 |
|
cancorr->SetLogz(); |
2095 |
|
cancorr->SetRightMargin(0.13); |
2096 |
< |
flag_this_change(__FUNCTION__,__LINE__,false);//PlottingSetup::RestrictToMassPeak |
2096 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
2097 |
|
TCut zptforresponsepresentation("pt<600"&&cutmass&&cutOSSF&&"((sumJetPt[1]/pt)<5.0)"); |
2098 |
+ |
if(PlottingSetup::DoBTag) zptforresponsepresentation=zptforresponsepresentation&&PlottingSetup::bTagRequirement; |
2099 |
|
TH2F *niceresponseplotd = new TH2F("niceresponseplotd","",100,0,600,100,0,5); |
2100 |
|
(allsamples.collection)[allsamples.FindSample("Data")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotd",zptforresponsepresentation); |
2101 |
|
niceresponseplotd->SetStats(0); |
2106 |
|
niceresponseplotd->Draw("COLZ"); |
2107 |
|
TProfile * profd = (TProfile*)niceresponseplotd->ProfileX(); |
2108 |
|
profd->SetMarkerSize(DataMarkerSize); |
2109 |
< |
profd->Fit("pol0","","same,e1",30,400); |
2109 |
> |
profd->Fit("pol0","","same,e1",100,400); |
2110 |
|
DrawPrelim(); |
2111 |
|
TText* title = write_text(0.5,0.7,"Data"); |
2112 |
|
title->SetTextAlign(12); |
2122 |
|
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_Data"); |
2123 |
|
|
2124 |
|
TH2F *niceresponseplotm = new TH2F("niceresponseplotm","",100,0,600,100,0,5); |
2125 |
< |
(allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotm",zptforresponsepresentation); |
2125 |
> |
(allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotm",zptforresponsepresentation*cutWeight); |
2126 |
|
niceresponseplotm->SetStats(0); |
2127 |
|
niceresponseplotm->GetXaxis()->SetTitle("Z p_{T} [GeV]"); |
2128 |
|
niceresponseplotm->GetYaxis()->SetTitle("Response"); |
2132 |
|
(allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt",zptforresponsepresentation,"PROF,same"); |
2133 |
|
TProfile * profm = (TProfile*)niceresponseplotm->ProfileX(); |
2134 |
|
profm->SetMarkerSize(DataMarkerSize); |
2135 |
< |
profm->Fit("pol0","","same,e1",30,400); |
2135 |
> |
profm->Fit("pol0","","same,e1",100,400); |
2136 |
|
DrawMCPrelim(); |
2137 |
|
title = write_text(0.5,0.7,"MC simulation"); |
2138 |
|
title->SetTextAlign(12); |
2168 |
|
allsamples.PickUpEvents(cut); |
2169 |
|
} |
2170 |
|
|
2171 |
< |
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError) { |
2171 |
> |
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError,float DataPeakError, vector<float> jzb_shape_limit_bins) { |
2172 |
|
dout << "Saving configuration template!" << endl; |
2173 |
|
ofstream configfile; |
2174 |
|
configfile.open("../DistributedModelCalculations/last_configuration.C"); |
2188 |
|
configfile<<"string datajzb=\"datajzb_ERROR\";\n"; |
2189 |
|
configfile<<"string mcjzb=\"mcjzb_ERROR\";\n"; |
2190 |
|
configfile<<"vector<float>jzb_cuts;\n"; |
2191 |
+ |
configfile<<"vector<float>jzb_shape_limit_bins;\n"; |
2192 |
|
configfile<<"float MCPeakError=-999;\n"; |
2193 |
+ |
configfile<<"float DataPeakError=-999;\n"; |
2194 |
|
configfile<<"}\n\n"; |
2195 |
|
|
2196 |
|
configfile<<"void read_config() {\n"; |
2197 |
|
configfile<<"datajzb=\""<<datajzb<<"\";\n"; |
2198 |
|
configfile<<"mcjzb=\""<<mcjzb<<"\";\n\n"; |
2199 |
< |
configfile<<"\n\nMCPeakError="<<MCPeakError<<";\n\n"; |
2200 |
< |
for(int i=0;i<jzb_cuts.size();i++) configfile<<"jzb_cuts.push_back("<<jzb_cuts[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2199 |
> |
configfile<<"\n\nMCPeakError="<<MCPeakError<<";\n"; |
2200 |
> |
configfile<<"DataPeakError="<<DataPeakError<<";\n\n"; |
2201 |
> |
for(int i=0;i<(int)jzb_cuts.size();i++) configfile<<"jzb_cuts.push_back("<<jzb_cuts[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2202 |
|
configfile<<"\n\n"; |
2203 |
< |
for(int i=0;i<Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2204 |
< |
for(int i=0;i<Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2205 |
< |
for(int i=0;i<Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2203 |
> |
for(int i=0;i<(int)Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2204 |
> |
for(int i=0;i<(int)Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2205 |
> |
for(int i=0;i<(int)Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2206 |
> |
configfile<<"\n\n"; |
2207 |
> |
for(int i=0;i<(int)flippedNobs.size();i++) configfile<<"flippedNobs.push_back("<<flippedNobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2208 |
> |
for(int i=0;i<(int)flippedNpred.size();i++) configfile<<"flippedNpred.push_back("<<flippedNpred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2209 |
> |
for(int i=0;i<(int)flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2210 |
> |
for(int i=0;i<(int)jzb_shape_limit_bins.size();i++) configfile<<"jzb_shape_limit_bins.push_back("<<jzb_shape_limit_bins[i]<<"); // JZB shape bin boundary at " << jzb_shape_limit_bins[i] << "\n"; |
2211 |
|
configfile<<"\n\n"; |
1986 |
– |
for(int i=0;i<flippedNobs.size();i++) configfile<<"flippedNobs.push_back("<<flippedNobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
1987 |
– |
for(int i=0;i<flippedNpred.size();i++) configfile<<"flippedNpred.push_back("<<flippedNpred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
1988 |
– |
for(int i=0;i<flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2212 |
|
configfile<<"\n\n"; |
2213 |
|
configfile<<"luminosity="<<luminosity<<";\n"; |
2214 |
|
configfile<<"RestrictToMassPeak="<<RestrictToMassPeak<<";//defines the type of analysis we're running\n"; |
2234 |
|
float max=histos[0]->GetMaximum(); |
2235 |
|
if(manualmin>=0) min=manualmin; |
2236 |
|
else { |
2237 |
< |
for(int i=1;i<histos.size();i++) { |
2237 |
> |
for(int i=1;i<(int)histos.size();i++) { |
2238 |
|
float curmin=get_nonzero_minimum(histos[i]); |
2239 |
|
float curmax=histos[i]->GetMaximum(); |
2240 |
|
if(curmin<min) min=curmin; |
2245 |
|
histos[0]->Draw(drawoption.c_str()); |
2246 |
|
stringstream drawopt; |
2247 |
|
drawopt << drawoption << ",same"; |
2248 |
< |
for(int i=1;i<histos.size();i++) { |
2248 |
> |
for(int i=1;i<(int)histos.size();i++) { |
2249 |
|
histos[i]->Draw(drawopt.str().c_str()); |
2250 |
|
} |
2251 |
|
} |
2254 |
|
//in the case of the on peak analysis, we compare the 3 control regions to the real value |
2255 |
|
//in the case of the OFF peak analysis, we compare our control region to the real value |
2256 |
|
TCut weightbackup=cutWeight; |
2257 |
< |
cutWeight="1.0"; |
2257 |
> |
// cutWeight="1.0"; |
2258 |
|
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
2259 |
|
|
2260 |
|
|
2312 |
|
leg->Draw("same"); |
2313 |
|
DrawMCPrelim(simulatedlumi); |
2314 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison"); |
2092 |
– |
|
2315 |
|
TH1F *TZemcopy = (TH1F*)TZem->Clone("TZemcopy"); |
2316 |
|
TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy"); |
2317 |
< |
TH1F *TSeemmcopy = (TH1F*)TSeemm->Clone("TSeemmcopy"); |
2318 |
< |
TH1F *TSemcopy = (TH1F*)TSem->Clone("TSemcopy"); |
2317 |
> |
TH1F *TSeemmcopy; |
2318 |
> |
TH1F *TSemcopy; |
2319 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
2320 |
> |
TSeemmcopy = (TH1F*)TSeemm->Clone("TSeemmcopy"); |
2321 |
> |
TSemcopy = (TH1F*)TSem->Clone("TSemcopy"); |
2322 |
> |
} |
2323 |
|
|
2324 |
|
TZem->Divide(TZeemm); |
2325 |
|
TZem->SetMarkerStyle(21); |
2341 |
|
|
2342 |
|
float linepos=0.25; |
2343 |
|
if(PlottingSetup::RestrictToMassPeak) linepos=0.25; |
2344 |
+ |
if(!PlottingSetup::RestrictToMassPeak) linepos=0.1; //sys uncertainty for iJZB |
2345 |
|
TLine *top = new TLine(binning[0],1.0+linepos,binning[binning.size()-1],1.0+linepos); |
2346 |
|
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
2347 |
|
TLine *bottom = new TLine(binning[0],1.0-linepos,binning[binning.size()-1],1.0-linepos); |
2348 |
|
|
2349 |
+ |
/*write_warning(__FUNCTION__,"These two lines are to be removed!"); |
2350 |
+ |
TLine *topalt = new TLine(binning[0],1.0+0.1,binning[binning.size()-1],1.0+0.1); |
2351 |
+ |
TLine *bottomalt = new TLine(binning[0],1.0-0.1,binning[binning.size()-1],1.0-0.1); |
2352 |
+ |
topalt->SetLineColor(kRed);topalt->SetLineStyle(3); |
2353 |
+ |
bottomalt->SetLineColor(kRed);bottomalt->SetLineStyle(3); |
2354 |
+ |
topalt->Draw("same");bottomalt->Draw("same");*/ |
2355 |
+ |
|
2356 |
+ |
|
2357 |
|
top->SetLineColor(kBlue);top->SetLineStyle(2); |
2358 |
|
bottom->SetLineColor(kBlue);bottom->SetLineStyle(2); |
2359 |
|
center->SetLineColor(kBlue); |
2378 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison_ratio"); |
2379 |
|
|
2380 |
|
|
2146 |
– |
|
2381 |
|
///-------------- second part: only look at the quantity we actually care about! |
2382 |
|
TH1F *leftsfzp = (TH1F*)nTZeemm->Clone("leftsfzp"); |
2383 |
|
TH1F *rightsfzp = (TH1F*)TZeemmcopy->Clone("rightsfzp"); |
2504 |
|
} |
2505 |
|
|
2506 |
|
|
2507 |
< |
void zjets_prediction_comparison() { |
2507 |
> |
void zjets_prediction_comparison(string mcjzbWithPU) { |
2508 |
> |
TCanvas *zcan = new TCanvas("zcan","zcan"); |
2509 |
> |
zcan->SetLogy(1); |
2510 |
> |
TCut weightbackup=cutWeight; |
2511 |
> |
|
2512 |
> |
/* |
2513 |
|
// Do it without PU re-weighting |
2514 |
|
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
2515 |
|
stringstream resultsNoPU; |
2516 |
|
|
2517 |
|
stringstream mcjzbnoPU; |
2518 |
< |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,MCSigma,DataSigma,resultsNoPU,false); |
2518 |
> |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,MCSigma,DataSigma,resultsNoPU,true); |
2519 |
|
if(MCPeakNoPU>0) mcjzbnoPU<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeakNoPU)<<")"; |
2520 |
|
else mcjzbnoPU<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeakNoPU)<<")"; |
2521 |
|
|
2522 |
|
string mcjzb = mcjzbnoPU.str(); |
2523 |
|
dout << "The peak corrected JZB expression for MC without pileup is : " << mcjzb << endl; |
2524 |
|
|
2286 |
– |
TCut weightbackup=cutWeight; |
2525 |
|
cutWeight="1.0"; |
2526 |
+ |
*/ |
2527 |
+ |
string mcjzb = mcjzbWithPU; // this is with PURW, if you want without it you have to uncomment the part above (and comment out this line) |
2528 |
|
float sbg_min=0.; |
2529 |
|
float sbg_max=100.; |
2530 |
|
int sbg_nbins=5; |
2534 |
|
TCut kNeg((mcjzb+"<0").c_str()); |
2535 |
|
string var( "abs("+mcjzb+")" ); |
2536 |
|
|
2537 |
< |
TCut kcut(cutmass&&cutOSSF&&"pfJetGoodNum>2"); |
2538 |
< |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events", |
2539 |
< |
kcut&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2300 |
< |
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events", |
2301 |
< |
kcut&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2537 |
> |
TCut kcut(cutmass&&cutOSSF&&cutnJets); |
2538 |
> |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",kcut&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2539 |
> |
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",kcut&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2540 |
|
hJZBpos->SetLineColor(kBlack); |
2541 |
|
hJZBneg->SetLineColor(kRed); |
2542 |
|
|
2305 |
– |
Int_t nbins = 5; |
2306 |
– |
Float_t xmax = 100.; |
2307 |
– |
|
2308 |
– |
|
2309 |
– |
TCanvas *zcan = new TCanvas("zcan","zcan"); |
2310 |
– |
zcan->SetLogy(1); |
2543 |
|
|
2544 |
|
hJZBpos->Draw("e1"); |
2545 |
|
hJZBneg->Draw("same,hist"); |
2622 |
|
|
2623 |
|
TCanvas *cannie = new TCanvas("cannie","cannie"); |
2624 |
|
|
2625 |
< |
for(int icut=0;icut<jzb_cuts.size();icut++) { |
2625 |
> |
for(int icut=0;icut<(int)jzb_cuts.size();icut++) { |
2626 |
|
float currcut=jzb_cuts[icut]; |
2627 |
|
int nbins=1;float low=currcut; |
2628 |
|
vector<int> mysample; |
2681 |
|
//prediction part |
2682 |
|
if(is_data) cout << "Data prediction & "; |
2683 |
|
if(subselection!="none") cout << subselection << " prediction &"; |
2684 |
< |
for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & "; |
2684 |
> |
for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & "; |
2685 |
|
|
2686 |
|
cout << endl; |
2687 |
|
//observation part |
2688 |
|
if(is_data) cout << "Data observation & "; |
2689 |
|
if(subselection!="none") cout << subselection << " observation &"; |
2690 |
< |
for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & "; |
2690 |
> |
for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & "; |
2691 |
|
cout << endl; |
2692 |
|
cout << "_________________________________________________________________" << endl; |
2693 |
|
delete cannie; |
2722 |
|
int nbins = sizeof(xbins)/sizeof(float)-1; |
2723 |
|
int markers[] = { 20, 26, 21, 24, 22, 25, 28 }; |
2724 |
|
|
2725 |
< |
TH1F* heff = new TH1F("heff", "JZB eff ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
2726 |
< |
TH1F* hgen = new TH1F("hgen", "JZB gen ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
2727 |
< |
TH1F* hreco = new TH1F("hreco","JZB reco ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
2725 |
> |
|
2726 |
> |
TH1F* heff = new TH1F("heff", "JZB eff ; generator JZB [GeV]; efficiency",nbins,xbins); |
2727 |
> |
TH1F* hgen = new TH1F("hgen", "JZB gen ; generator JZB [GeV]; efficiency",nbins,xbins); |
2728 |
> |
TH1F* hreco = new TH1F("hreco","JZB reco ; generator JZB [GeV]; efficiency",nbins,xbins); |
2729 |
|
|
2730 |
|
TCut kgen(genMassCut&&"genZPt>0&&genNjets>2&&abs(genMID)==23"&&cutOSSF); |
2731 |
|
TCut kreco(cutmass); |
2741 |
|
TCanvas *can = new TCanvas("can","Canvas for JZB Efficiency",600,600); |
2742 |
|
can->SetGridx(1); |
2743 |
|
can->SetGridy(1); |
2744 |
+ |
can->SetLeftMargin(0.16); |
2745 |
+ |
can->SetRightMargin(0.05); |
2746 |
|
TLegend *leg = make_legend("",0.6,0.2,false,0.89,0.5); |
2747 |
+ |
leg->SetBorderSize(1); |
2748 |
+ |
leg->SetLineColor(kBlack); |
2749 |
+ |
leg->SetTextFont(62); |
2750 |
|
|
2751 |
< |
|
2514 |
< |
|
2515 |
< |
for ( int icut=0; icut<jzb_bins.size(); ++icut ) { |
2751 |
> |
for ( int icut=0; icut<(int)jzb_bins.size(); ++icut ) { |
2752 |
|
|
2753 |
|
ostringstream selection; |
2754 |
|
selection << mcjzb << ">" << jzb_bins[icut]; |
2764 |
|
} |
2765 |
|
|
2766 |
|
heff->GetXaxis()->SetRangeUser(min, max); |
2767 |
+ |
// heff->GetXaxis()->SetLabelSize(0.05); // paper style. overruled. |
2768 |
+ |
// heff->GetYaxis()->SetLabelSize(0.05); // paper style. overruled. |
2769 |
+ |
// heff->GetXaxis()->SetTitleSize(0.06); // paper style. overruled. |
2770 |
+ |
// heff->GetYaxis()->SetTitleSize(0.06); // paper style. overruled. |
2771 |
|
heff->SetMarkerStyle(markers[icut]); |
2772 |
|
heff->Fit("func","Q+","same"); |
2773 |
|
|
2779 |
|
|
2780 |
|
// Store plot |
2781 |
|
TH1F* h = (TH1F*)heff->Clone(hname); |
2782 |
+ |
h->SetNdivisions(505,"X"); |
2783 |
|
if ( icut) h->Draw("same"); |
2784 |
|
else h->Draw(); |
2785 |
|
char htitle[256]; sprintf(htitle,"JZB > %3.0f GeV", jzb_bins[icut]); |
2800 |
|
// Calls the above function for each signal sample |
2801 |
|
void plot_jzb_sel_eff(string mcjzb, samplecollection &signalsamples, vector<float> bins ) |
2802 |
|
{ |
2803 |
< |
for (int isignal=0; isignal<signalsamples.collection.size();isignal++) { |
2803 |
> |
for (int isignal=0; isignal<(int)signalsamples.collection.size();isignal++) { |
2804 |
|
dout << "JZB selection efficiency curve: " << std::endl; |
2805 |
|
JZBSelEff(mcjzb,(signalsamples.collection)[isignal].events,(signalsamples.collection)[isignal].samplename,bins); // Only for some selected samples |
2806 |
|
} |
2843 |
|
TH1F *RcorrJZBSBeemm; |
2844 |
|
TH1F *LcorrJZBSBeemm; |
2845 |
|
|
2846 |
< |
TH1F *RcorrJZBeemmNoS; |
2846 |
> |
// TH1F *RcorrJZBeemmNoS; |
2847 |
|
|
2848 |
|
//these are for the ratio |
2849 |
|
TH1F *JRcorrJZBeemm = qcdsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2974 |
|
dout << " Observation increases by : " << RcorrJZBeemm->Integral() << endl; |
2975 |
|
|
2976 |
|
dout << endl; |
2977 |
< |
for(int i=0;i<bins.size();i++) { |
2977 |
> |
for(int i=0;i<(int)bins.size();i++) { |
2978 |
|
dout << " JZB > " << bins[i] << " : " << endl; |
2979 |
|
dout << " Observation increases by : " << RcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl; |
2980 |
|
if(PlottingSetup::RestrictToMassPeak) { |
3022 |
|
leg->SetY2(1.0); |
3023 |
|
|
3024 |
|
|
3025 |
< |
for(int isample=0;isample<allsamples.collection.size();isample++) { |
3025 |
> |
for(int isample=0;isample<(int)allsamples.collection.size();isample++) { |
3026 |
|
string nowname=(allsamples.collection)[isample].filename; |
3027 |
|
cout << "Drawing: " << nowname << " (sample " << isample+1 << " / " << allsamples.collection.size() << ")" << endl; |
3028 |
|
individualpt1histos[isample] = allsamples.Draw(GetNumericHistoName(),"pt1",50,0,50, "p_{T,1}", "events",cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample(nowname)); |
3046 |
|
ptsancan->cd(2); |
3047 |
|
fpt2->Draw(); |
3048 |
|
|
3049 |
< |
for(int isample=0;isample<allsamples.collection.size();isample++) { |
3049 |
> |
for(int isample=0;isample<(int)allsamples.collection.size();isample++) { |
3050 |
|
ptsancan->cd(1); |
3051 |
|
individualpt1histos[isample]->DrawNormalized("same,histo"); |
3052 |
|
ptsancan->cd(2); |
3062 |
|
void do_mlls_plot(string mcjzb) { |
3063 |
|
cout << "At this point we'd plot the mll distribution" << endl; |
3064 |
|
TCanvas *sigcan = new TCanvas("sigcan","sigcan"); |
3065 |
< |
for(int isig=0;isig<(signalsamples.collection).size();isig++) { |
3065 |
> |
for(int isig=0;isig<(int)(signalsamples.collection).size();isig++) { |
3066 |
|
if(!(signalsamples.collection)[isig].events) continue; |
3067 |
|
string nowname=(signalsamples.collection)[isig].filename; |
3068 |
|
TH1F *mll = signalsamples.Draw("mllhisto","mll",150,0,150, "m_{ll}", "events",cutOSSF&&cutnJets,mc,luminosity,signalsamples.FindSample(nowname)); |
3101 |
|
findme.push_back("TTJets"); |
3102 |
|
findme.push_back("LM"); |
3103 |
|
|
3104 |
< |
for(int ifind=0;ifind<findme.size();ifind++) { |
3104 |
> |
for(int ifind=0;ifind<(int)findme.size();ifind++) { |
3105 |
|
vector<int> selsamples = allsamples.FindSample(findme[ifind]); |
3106 |
|
TH2F *metvsjzb = new TH2F("metvsjzb","metvsjzb",200,0,100,400,-100,100); |
3107 |
< |
for(int isel=0;isel<selsamples.size();isel++) { |
3107 |
> |
for(int isel=0;isel<(int)selsamples.size();isel++) { |
3108 |
|
cout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl; |
3109 |
|
allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF); |
3110 |
|
} |