23 |
|
void todo() { |
24 |
|
dout << "My to do list: " << endl; |
25 |
|
dout << " - ExperimentalModule::Poisson_ratio_plot : Get the second part to work!" << endl; |
26 |
+ |
dout << " - compare_onpeak_offpeak_signal_distributions: Implement this function ... " << endl; |
27 |
|
dout << "Info : The trigger requirement is currently set to " << (const char*) passtrig << endl; |
28 |
+ |
dout << "Info : The pt requirement is currently set to " << (const char*) passtrig << endl; |
29 |
+ |
dout << "Info : The mll requirement is currently set to " << (const char*) cutmass << endl; |
30 |
+ |
dout << "Info : The lepton requirement is currently set to " << (const char*) leptoncut << endl; |
31 |
|
} |
32 |
|
|
33 |
|
void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, float &MCSigma, float &DataSigma, stringstream &result, bool doPUreweighting = true ) |
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); |
280 |
|
draw_separation_lines=true; |
281 |
|
} |
282 |
|
if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1"; |
283 |
< |
if(filename=="mll_aboveJZB100") cut=cutOSSF&&cutnJets&&ibasiccut; |
283 |
> |
if(Contains(filename,"mll_aboveJZB100")) cut=cutOSSF&&cutnJets&&ibasiccut; |
284 |
> |
if(Contains(filename,"mll_osof_aboveJZB")) cut=cutOSOF&&cutnJets&&ibasiccut; |
285 |
|
if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutOSSF; |
286 |
|
if(filename=="mll_inclusive_osof") cut=cutOSOF; |
287 |
|
if(filename=="mll_inclusive_ee") cut=cutOSSF&&"id1==0"; |
379 |
|
delete ckin; |
380 |
|
} |
381 |
|
|
294 |
– |
|
382 |
|
void make_JES_plot() { |
383 |
|
|
384 |
|
int nbins=10; |
433 |
|
float mll_low=40; |
434 |
|
float mll_hi=160; |
435 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
436 |
< |
mll_low=30; |
437 |
< |
mll_hi=180; |
436 |
> |
mll_low=10; |
437 |
> |
mll_hi=210; |
438 |
|
} |
439 |
+ |
/* |
440 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true); |
441 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true); |
442 |
|
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_ee",doPF,true); |
446 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true); |
447 |
|
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)((350-mll_low)),mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF); |
448 |
> |
make_kin_plot("mll","",(int)((350-mll_low)),mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF);/* |
449 |
> |
make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",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); |
452 |
|
make_kin_plot("pt","",50,0,400,dolog,"Z p_{T} [GeV]","Zpt",doPF); |
455 |
|
make_kin_plot("eta1","",40,-5,5,nolog,"#eta_{l}","eta",doPF); |
456 |
|
make_kin_plot("jzb[1]","",100,-150,150,dolog,"JZB [GeV]","jzb_ossf",doPF); |
457 |
|
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets",doPF); |
458 |
< |
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF); |
458 |
> |
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF);*//* |
459 |
|
if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]"); |
460 |
|
stringstream jzbcut; |
461 |
|
jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))"; |
462 |
|
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
463 |
+ |
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); |
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 |
+ |
stringstream jzbcut2; |
467 |
+ |
jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))"; |
468 |
+ |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true); |
469 |
+ |
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); |
470 |
+ |
stringstream jzbcut3; |
471 |
+ |
jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))"; |
472 |
+ |
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); |
473 |
+ |
*/ |
474 |
+ |
make_special_obs_pred_mll_plot(mcjzb,50); |
475 |
+ |
make_special_obs_pred_mll_plot(mcjzb,100); |
476 |
+ |
make_special_obs_pred_mll_plot(mcjzb,150); |
477 |
+ |
make_special_obs_pred_mll_plot(mcjzb,200); |
478 |
+ |
make_special_obs_pred_mll_plot(mcjzb,250); |
479 |
|
} |
480 |
|
|
481 |
|
void make_comp_plot( string var, string xlabel, string filename, float jzbcut, string mcjzb, string datajzb, |
584 |
|
|
585 |
|
float simulatedlumi=luminosity;//in pb please - adjust to your likings |
586 |
|
|
587 |
< |
TH1F *JZBplotZJETs = allsamples.Draw("JZBplotZJETs",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
588 |
< |
TH1F *JZBplotLM4 = allsamples.Draw("JZBplotLM4",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("LM4")); |
587 |
> |
TH1F *JZBplotZJETs = allsamples.Draw("JZBplotZJETs",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/DY")); |
588 |
> |
TH1F *JZBplotLM4; |
589 |
> |
if(PlottingSetup::RestrictToMassPeak) JZBplotLM4 = allsamples.Draw("JZBplotLM4",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("LM4")); |
590 |
> |
else JZBplotLM4 = allsamples.Draw("JZBplotLM4",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("LM3")); |
591 |
|
TH1F *JZBplotTtbar = allsamples.Draw("JZBplotTtbar",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("TTJets")); |
592 |
|
|
593 |
|
JZBplotTtbar->SetLineColor(allsamples.GetColor("TTJet")); |
611 |
|
TLegend *signal_bg_comparison_leg2 = make_legend("",0.55,0.75,false); |
612 |
|
signal_bg_comparison_leg2->AddEntry(JZBplotZJETs,"Z+Jets","f"); |
613 |
|
signal_bg_comparison_leg2->AddEntry(JZBplotTtbar,"t#bar{t}","f"); |
614 |
< |
signal_bg_comparison_leg2->AddEntry(JZBplotLM4,"LM4","f"); |
614 |
> |
if(PlottingSetup::RestrictToMassPeak) signal_bg_comparison_leg2->AddEntry(JZBplotLM4,"LM4","f"); |
615 |
> |
else signal_bg_comparison_leg2->AddEntry(JZBplotLM4,"LM3","f"); |
616 |
|
signal_bg_comparison_leg2->Draw(); |
617 |
|
DrawMCPrelim(simulatedlumi); |
618 |
|
CompleteSave(can,"jzb_bg_vs_signal_distribution"); |
856 |
|
|
857 |
|
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float sigma, float high, int use_data, bool overlay_signal = false ) |
858 |
|
{ |
859 |
+ |
switch_overunderflow(true); |
860 |
|
bool is_data=false; |
861 |
|
bool use_signal=false; |
862 |
|
if(use_data==1) is_data=true; |
865 |
|
if(is_data) nbins=50; |
866 |
|
float low=0; |
867 |
|
float hi=500; |
868 |
+ |
|
869 |
+ |
stringstream largerzeroS; |
870 |
+ |
largerzeroS << "("<<jzb<<">0)"; |
871 |
+ |
TCut largerzero(largerzeroS.str().c_str()); |
872 |
+ |
stringstream smallerzeroS; |
873 |
+ |
smallerzeroS << "("<<jzb<<"<0)"; |
874 |
+ |
TCut smallerzero(smallerzeroS.str().c_str()); |
875 |
+ |
|
876 |
|
TH1F *blankback = new TH1F("blankback","blankback",int(high/10),0,high); |
877 |
< |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
878 |
< |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
879 |
< |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
880 |
< |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
877 |
> |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
878 |
> |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
879 |
> |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
880 |
> |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
881 |
> |
|
882 |
|
blankback->GetXaxis()->SetTitle(RcorrJZBeemm->GetXaxis()->GetTitle()); |
883 |
|
blankback->GetYaxis()->SetTitle(RcorrJZBeemm->GetYaxis()->GetTitle()); |
884 |
|
blankback->GetXaxis()->CenterTitle(); |
893 |
|
TH1F *RcorrJZBeemmNoS; |
894 |
|
|
895 |
|
//these are for the ratio |
896 |
< |
TH1F *JRcorrJZBeemm = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
897 |
< |
TH1F *JLcorrJZBeemm = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
898 |
< |
TH1F *JRcorrJZBem = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
899 |
< |
TH1F *JLcorrJZBem = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
896 |
> |
|
897 |
> |
TH1F *JRcorrJZBeemm = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
898 |
> |
TH1F *JLcorrJZBeemm = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
899 |
> |
TH1F *JRcorrJZBem = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
900 |
> |
TH1F *JLcorrJZBem = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
901 |
|
|
902 |
|
TH1F *JRcorrJZBSBem; |
903 |
|
TH1F *JLcorrJZBSBem; |
904 |
|
TH1F *JRcorrJZBSBeemm; |
905 |
|
TH1F *JLcorrJZBSBeemm; |
906 |
|
|
907 |
< |
if(use_data==2 || overlay_signal) RcorrJZBeemmNoS = allsamples.Draw("RcorrJZBeemmNoS",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,false); |
907 |
> |
if(use_data==2 || overlay_signal) RcorrJZBeemmNoS = allsamples.Draw("RcorrJZBeemmNoS",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,false); |
908 |
|
|
909 |
|
|
910 |
|
if(PlottingSetup::RestrictToMassPeak) { |
911 |
< |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
912 |
< |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
913 |
< |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
914 |
< |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
915 |
< |
|
911 |
> |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
912 |
> |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
913 |
> |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
914 |
> |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
915 |
> |
|
916 |
|
//these are for the ratio |
917 |
< |
JRcorrJZBSBem = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
918 |
< |
JLcorrJZBSBem = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
919 |
< |
JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
920 |
< |
JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
802 |
< |
|
917 |
> |
JRcorrJZBSBem = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
918 |
> |
JLcorrJZBSBem = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
919 |
> |
JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
920 |
> |
JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
921 |
|
} |
922 |
|
|
923 |
|
TH1F *lm4RcorrJZBeemm; |
924 |
< |
if(overlay_signal || use_data == 2 ) lm4RcorrJZBeemm = allsamples.Draw("lm4RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,allsamples.FindSample("LM4")); |
924 |
> |
if(overlay_signal || use_data == 2 || use_data == 1) lm4RcorrJZBeemm = allsamples.Draw("lm4RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,allsamples.FindSample("LM")); |
925 |
|
|
926 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed. |
927 |
|
|
1015 |
|
Bpred->Draw("hist,same"); |
1016 |
|
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1017 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1018 |
+ |
lm4RcorrJZBeemm->Draw("hist,same"); |
1019 |
|
legBpred->AddEntry(RcorrJZBeemm,"observed","p"); |
1020 |
|
legBpred->AddEntry(Bpred,"predicted","l"); |
1021 |
|
legBpred->AddEntry(analytical_function[1],"predicted fit","l"); |
1025 |
|
DrawPrelim(); |
1026 |
|
|
1027 |
|
//this plot shows what the prediction is composed of |
1028 |
< |
TCanvas *specialcanv = new TCanvas("specialcanv","specialcanv"); |
1029 |
< |
specialcanv->SetLogy(1); |
1030 |
< |
Zjetspred->SetFillColor(kYellow); |
1031 |
< |
Zjetspred->SetLineColor(kYellow); |
1032 |
< |
TTbarpred->SetFillColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0])); |
1033 |
< |
TTbarpred->SetLineColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0])); |
1028 |
> |
TPad *predcomppad = new TPad("predcomppad","predcomppad",0,0,1,1); |
1029 |
> |
float CurrentBpredLineWidth=Bpred->GetLineWidth(); |
1030 |
> |
Bpred->SetLineWidth(2); |
1031 |
> |
predcomppad->cd(); |
1032 |
> |
predcomppad->SetLogy(1); |
1033 |
> |
|
1034 |
> |
TH1F *jzbnegative = (TH1F*)LcorrJZBeemm->Clone("jzbnegative"); |
1035 |
> |
TH1F *sidebandsemu = (TH1F*)Bpred->Clone("sidebandsemu"); |
1036 |
> |
sidebandsemu->Add(jzbnegative,-1); |
1037 |
> |
|
1038 |
> |
jzbnegative->SetFillColor(allsamples.GetColor((allsamples.FindSample("DY"))[0])); |
1039 |
> |
jzbnegative->SetLineColor(allsamples.GetColor((allsamples.FindSample("DY"))[0])); |
1040 |
> |
sidebandsemu->SetLineColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0])); |
1041 |
> |
sidebandsemu->SetFillColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0])); |
1042 |
> |
|
1043 |
|
THStack predcomposition("predcomposition","prediction composition"); |
1044 |
< |
predcomposition.Add(TTbarpred); |
1045 |
< |
predcomposition.Add(Zjetspred); |
1044 |
> |
predcomposition.Add(sidebandsemu); |
1045 |
> |
predcomposition.Add(jzbnegative); |
1046 |
|
blankback->Draw(); |
1047 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1048 |
|
predcomposition.Draw("histo,same");// |
1049 |
|
Bpred->Draw("hist,same"); |
1050 |
< |
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1050 |
> |
// analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1051 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1052 |
< |
legBpred->Draw(); |
1052 |
> |
// TH1F *lm4RcorrJZBeemmC = (TH1F*)lm4RcorrJZBeemm->Clone("lm4RcorrJZBeemmC"); |
1053 |
> |
// lm4RcorrJZBeemmC->SetLineColor(kOrange+1); |
1054 |
> |
lm4RcorrJZBeemm->SetLineColor(kOrange+1); |
1055 |
> |
// lm4RcorrJZBeemmC->Draw("histo,same"); |
1056 |
> |
lm4RcorrJZBeemm->SetLineWidth(2); |
1057 |
> |
lm4RcorrJZBeemm->Draw("histo,same"); |
1058 |
|
DrawPrelim(); |
1059 |
< |
TLegend *specialleg = new TLegend(0.6,0.4,0.89,0.55); |
1060 |
< |
specialleg->SetFillColor(kWhite);specialleg->SetLineColor(kWhite); |
1061 |
< |
specialleg->AddEntry(Zjetspred,"Z+Jets prediction","f"); |
1062 |
< |
specialleg->AddEntry(TTbarpred,"t#bar{t} prediction","f"); |
1063 |
< |
specialleg->Draw("same"); |
1064 |
< |
CompleteSave(specialcanv,"Bpred_Data_____PredictionComposition"); |
1065 |
< |
|
1059 |
> |
TLegend *speciallegBpred = make_legend("",0.45,0.55); |
1060 |
> |
speciallegBpred->AddEntry(RcorrJZBeemm,"Data","pl"); |
1061 |
> |
speciallegBpred->AddEntry(Bpred,"Total background","l"); |
1062 |
> |
speciallegBpred->AddEntry(jzbnegative,"JZB<0 (data)","f"); |
1063 |
> |
speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f"); |
1064 |
> |
// speciallegBpred->AddEntry(lm4RcorrJZBeemmC,"LM4","l"); |
1065 |
> |
speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1066 |
> |
speciallegBpred->Draw(); |
1067 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,predcomppad,"Bpred_Data_____PredictionComposition",true,use_data!=1,"data/pred"); |
1068 |
> |
|
1069 |
> |
TCanvas *specialcanv = new TCanvas("specialcanv","specialcanv"); |
1070 |
|
THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal); |
1071 |
|
blankback->Draw(); |
1072 |
|
kostack.Draw("same"); |
1076 |
|
legBpred->Draw(); |
1077 |
|
DrawPrelim(); |
1078 |
|
CompleteSave(specialcanv,"Bpred_Data_____PredictionCompositioninMC"); |
1079 |
+ |
Bpred->SetLineWidth((int)CurrentBpredLineWidth); |
1080 |
|
|
1081 |
< |
delete specialcanv; |
944 |
< |
delete specialleg; |
1081 |
> |
delete speciallegBpred; |
1082 |
|
delete Zjetspred; |
1083 |
|
delete TTbarpred; |
1084 |
|
|
1088 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1089 |
|
Bpred->Draw("hist,same"); |
1090 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1091 |
< |
legBpred->AddEntry(RcorrJZBeemm,"MC observed","p"); |
1091 |
> |
legBpred->AddEntry(RcorrJZBeemm,"MC true","p"); |
1092 |
|
legBpred->AddEntry(Bpred,"MC predicted","l"); |
1093 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18 |
1094 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // causes seg fault on root v5.18 |
1102 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1103 |
|
Bpred->Draw("hist,same"); |
1104 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1105 |
< |
legBpred->AddEntry(RcorrJZBeemm,"MC observed","p"); |
1105 |
> |
legBpred->AddEntry(RcorrJZBeemm,"MC true","p"); |
1106 |
|
legBpred->AddEntry(Bpred,"MC predicted","l"); |
1107 |
< |
legBpred2->AddEntry(RcorrJZBeemm,"MC observed","p"); |
1107 |
> |
legBpred2->AddEntry(RcorrJZBeemm,"MC true","p"); |
1108 |
|
legBpred2->AddEntry(Bpred,"MC predicted","l"); |
1109 |
|
{ |
1110 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18 --> now only allowed for root >=v5.30 |
1133 |
|
//3rd last argument: do special bpred ratio, 2nd last argument: extended range!, last: y-axis title |
1134 |
|
string ytitle("ratio"); |
1135 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
1136 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,use_data!=1,ytitle); |
1136 |
> |
//save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,use_data!=1,ytitle); |
1137 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,false,ytitle);//not extending the y range anymore up to 4 |
1138 |
|
|
1139 |
|
|
1140 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1141 |
|
/// The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!) |
1142 |
< |
if(!PlottingSetup::RestrictToMassPeak) return; |
1143 |
< |
TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem"); |
1144 |
< |
Bpredem->Add(RcorrJZBem); |
1145 |
< |
Bpredem->Add(LcorrJZBem,-1); |
1146 |
< |
TH1F *BpredSBem = (TH1F*)LcorrJZBeemm->Clone("BpredSBem"); |
1147 |
< |
BpredSBem->Add(RcorrJZBSBem); |
1148 |
< |
Bpred->Add(LcorrJZBSBem,-1); |
1149 |
< |
TH1F *BpredSBeemm = (TH1F*)LcorrJZBeemm->Clone("BpredSBeemm"); |
1150 |
< |
BpredSBeemm->Add(RcorrJZBSBeemm); |
1151 |
< |
BpredSBeemm->Add(LcorrJZBSBeemm,-1.0); |
1152 |
< |
globalcanvas->cd(); |
1153 |
< |
globalcanvas->SetLogy(1); |
1154 |
< |
|
1155 |
< |
RcorrJZBeemm->SetMarkerStyle(20); |
1156 |
< |
RcorrJZBeemm->GetXaxis()->SetRangeUser(0,high); |
1157 |
< |
blankback->Draw(); |
1158 |
< |
RcorrJZBeemm->Draw("e1x0,same"); |
1159 |
< |
RcorrJZBeemm->SetMarkerSize(DataMarkerSize); |
1160 |
< |
|
1161 |
< |
Bpredem->SetLineColor(kRed+1); |
1162 |
< |
Bpredem->SetStats(0); |
1163 |
< |
Bpredem->Draw("hist,same"); |
1164 |
< |
|
1165 |
< |
BpredSBem->SetLineColor(kGreen+2);//TColor::GetColor("#0B6138")); |
1166 |
< |
BpredSBem->SetLineStyle(2); |
1167 |
< |
BpredSBem->Draw("hist,same"); |
1168 |
< |
|
1169 |
< |
BpredSBeemm->SetLineColor(kBlue+1); |
1170 |
< |
BpredSBeemm->SetLineStyle(3); |
1171 |
< |
BpredSBeemm->Draw("hist,same"); |
1172 |
< |
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1173 |
< |
|
1174 |
< |
TLegend *legBpredc = make_legend("",0.6,0.55); |
1175 |
< |
if(use_data==1) |
1176 |
< |
{ |
1177 |
< |
legBpredc->AddEntry(RcorrJZBeemm,"observed","p"); |
1178 |
< |
legBpredc->AddEntry(Bpredem,"OFZP","l"); |
1179 |
< |
legBpredc->AddEntry(BpredSBem,"OFSB","l"); |
1180 |
< |
legBpredc->AddEntry(BpredSBeemm,"SFSB","l"); |
1181 |
< |
legBpredc->Draw(); |
1182 |
< |
CompleteSave(globalcanvas,"Bpred_Data_comparison"); |
1183 |
< |
} |
1184 |
< |
if(use_data==0) { |
1185 |
< |
legBpredc->AddEntry(RcorrJZBeemm,"MC observed","p"); |
1186 |
< |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1187 |
< |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1188 |
< |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1189 |
< |
legBpredc->Draw(); |
1190 |
< |
CompleteSave(globalcanvas,"Bpred_MC_comparison"); |
1191 |
< |
} |
1192 |
< |
if(use_data==2) { |
1193 |
< |
legBpredc->AddEntry(RcorrJZBeemm,"MC observed","p"); |
1194 |
< |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1195 |
< |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1196 |
< |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1197 |
< |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1198 |
< |
legBpredc->Draw(); |
1199 |
< |
CompleteSave(globalcanvas,"Bpred_MCwithS_comparison"); |
1142 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
1143 |
> |
TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem"); |
1144 |
> |
Bpredem->Add(RcorrJZBem); |
1145 |
> |
Bpredem->Add(LcorrJZBem,-1); |
1146 |
> |
TH1F *BpredSBem = (TH1F*)LcorrJZBeemm->Clone("BpredSBem"); |
1147 |
> |
BpredSBem->Add(RcorrJZBSBem); |
1148 |
> |
Bpred->Add(LcorrJZBSBem,-1); |
1149 |
> |
TH1F *BpredSBeemm = (TH1F*)LcorrJZBeemm->Clone("BpredSBeemm"); |
1150 |
> |
BpredSBeemm->Add(RcorrJZBSBeemm); |
1151 |
> |
BpredSBeemm->Add(LcorrJZBSBeemm,-1.0); |
1152 |
> |
globalcanvas->cd(); |
1153 |
> |
globalcanvas->SetLogy(1); |
1154 |
> |
|
1155 |
> |
RcorrJZBeemm->SetMarkerStyle(20); |
1156 |
> |
RcorrJZBeemm->GetXaxis()->SetRangeUser(0,high); |
1157 |
> |
blankback->Draw(); |
1158 |
> |
RcorrJZBeemm->Draw("e1x0,same"); |
1159 |
> |
RcorrJZBeemm->SetMarkerSize(DataMarkerSize); |
1160 |
> |
|
1161 |
> |
Bpredem->SetLineColor(kRed+1); |
1162 |
> |
Bpredem->SetStats(0); |
1163 |
> |
Bpredem->Draw("hist,same"); |
1164 |
> |
|
1165 |
> |
BpredSBem->SetLineColor(kGreen+2);//TColor::GetColor("#0B6138")); |
1166 |
> |
BpredSBem->SetLineStyle(2); |
1167 |
> |
BpredSBem->Draw("hist,same"); |
1168 |
> |
|
1169 |
> |
BpredSBeemm->SetLineColor(kBlue+1); |
1170 |
> |
BpredSBeemm->SetLineStyle(3); |
1171 |
> |
BpredSBeemm->Draw("hist,same"); |
1172 |
> |
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1173 |
> |
|
1174 |
> |
TLegend *legBpredc = make_legend("",0.6,0.55); |
1175 |
> |
if(use_data==1) |
1176 |
> |
{ |
1177 |
> |
legBpredc->AddEntry(RcorrJZBeemm,"observed","p"); |
1178 |
> |
legBpredc->AddEntry(Bpredem,"OFZP","l"); |
1179 |
> |
legBpredc->AddEntry(BpredSBem,"OFSB","l"); |
1180 |
> |
legBpredc->AddEntry(BpredSBeemm,"SFSB","l"); |
1181 |
> |
legBpredc->Draw(); |
1182 |
> |
CompleteSave(globalcanvas,"Bpred_Data_comparison"); |
1183 |
> |
} |
1184 |
> |
if(use_data==0) { |
1185 |
> |
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
1186 |
> |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1187 |
> |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1188 |
> |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1189 |
> |
legBpredc->Draw(); |
1190 |
> |
CompleteSave(globalcanvas,"Bpred_MC_comparison"); |
1191 |
> |
} |
1192 |
> |
if(use_data==2) { |
1193 |
> |
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
1194 |
> |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1195 |
> |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1196 |
> |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1197 |
> |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1198 |
> |
legBpredc->Draw(); |
1199 |
> |
CompleteSave(globalcanvas,"Bpred_MCwithS_comparison"); |
1200 |
> |
} |
1201 |
|
} |
1202 |
+ |
|
1203 |
|
delete RcorrJZBeemm; |
1204 |
|
delete LcorrJZBeemm; |
1205 |
|
delete RcorrJZBem; |
1224 |
|
delete JLcorrJZBSBeemm; |
1225 |
|
} |
1226 |
|
if(overlay_signal || use_data==2) delete lm4RcorrJZBeemm; |
1227 |
+ |
switch_overunderflow(false); |
1228 |
|
} |
1229 |
|
|
1230 |
|
void do_prediction_plots(string mcjzb, string datajzb, float DataSigma, float MCSigma, bool overlay_signal ) { |
1399 |
|
Float_t ymin = 1.e-5, ymax = 0.25; |
1400 |
|
TCanvas *can = new TCanvas("can","Lepton Comparison Canvas"); |
1401 |
|
can->SetLogy(1); |
1402 |
< |
TH1F *eemc = allsamples.Draw("eemc","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==0)",mc, luminosity,allsamples.FindSample("DYJetsToLL")); |
1403 |
< |
TH1F *mmmc = allsamples.Draw("mmmc","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==1)",mc, luminosity,allsamples.FindSample("DYJetsToLL")); |
1402 |
> |
TH1F *eemc = allsamples.Draw("eemc","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==0)",mc, luminosity,allsamples.FindSample("/DY")); |
1403 |
> |
TH1F *mmmc = allsamples.Draw("mmmc","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==1)",mc, luminosity,allsamples.FindSample("/DY")); |
1404 |
|
eemc->SetLineColor(kBlue); |
1405 |
|
mmmc->SetLineColor(kRed); |
1406 |
|
eemc->SetMinimum(0.1); |
1465 |
|
DrawPrelim(); |
1466 |
|
save_with_ratio(jeed,jmmd,eemmpad->cd(),"lepton_comparison/jzb_Comparing_ee_mm_data"); |
1467 |
|
|
1468 |
< |
TH1F *zjeed = allsamples.Draw("zjeed",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==0)",mc, luminosity,allsamples.FindSample("DYJets")); |
1469 |
< |
TH1F *zjmmd = allsamples.Draw("zjmmd",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==1)",mc, luminosity,allsamples.FindSample("DYJets")); |
1470 |
< |
TH1F *zjeemmd = allsamples.Draw("zjeemmd",jzbvariablemc,int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets, mc, luminosity,allsamples.FindSample("DYJets")); |
1468 |
> |
TH1F *zjeed = allsamples.Draw("zjeed",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==0)",mc, luminosity,allsamples.FindSample("/DY")); |
1469 |
> |
TH1F *zjmmd = allsamples.Draw("zjmmd",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==1)",mc, luminosity,allsamples.FindSample("/DY")); |
1470 |
> |
TH1F *zjeemmd = allsamples.Draw("zjeemmd",jzbvariablemc,int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets, mc, luminosity,allsamples.FindSample("/DY")); |
1471 |
|
dout << "Z+Jets ee : " << zjeed->GetMean() << "+/-" << zjeed->GetMeanError() << endl; |
1472 |
|
dout << "Z+Jets ee : " << zjmmd->GetMean() << "+/-" << zjmmd->GetMeanError() << endl; |
1473 |
|
dout << "Z+Jets eemd : " << zjeemmd->GetMean() << "+/-" << zjeemmd->GetMeanError() << endl; |
1979 |
|
TCanvas *cancorr = new TCanvas("cancorr","Canvas for Response Correction"); |
1980 |
|
cancorr->SetLogz(); |
1981 |
|
cancorr->SetRightMargin(0.13); |
1982 |
< |
flag_this_change(__FUNCTION__,__LINE__,false);//PlottingSetup::RestrictToMassPeak |
1982 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1983 |
|
TCut zptforresponsepresentation("pt<600"&&cutmass&&cutOSSF&&"((sumJetPt[1]/pt)<5.0)"); |
1984 |
|
TH2F *niceresponseplotd = new TH2F("niceresponseplotd","",100,0,600,100,0,5); |
1985 |
|
(allsamples.collection)[allsamples.FindSample("Data")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotd",zptforresponsepresentation); |
2053 |
|
allsamples.PickUpEvents(cut); |
2054 |
|
} |
2055 |
|
|
2056 |
< |
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError) { |
2056 |
> |
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError,float DataPeakError) { |
2057 |
|
dout << "Saving configuration template!" << endl; |
2058 |
|
ofstream configfile; |
2059 |
|
configfile.open("../DistributedModelCalculations/last_configuration.C"); |
2074 |
|
configfile<<"string mcjzb=\"mcjzb_ERROR\";\n"; |
2075 |
|
configfile<<"vector<float>jzb_cuts;\n"; |
2076 |
|
configfile<<"float MCPeakError=-999;\n"; |
2077 |
+ |
configfile<<"float DataPeakError=-999;\n"; |
2078 |
|
configfile<<"}\n\n"; |
2079 |
|
|
2080 |
|
configfile<<"void read_config() {\n"; |
2081 |
|
configfile<<"datajzb=\""<<datajzb<<"\";\n"; |
2082 |
|
configfile<<"mcjzb=\""<<mcjzb<<"\";\n\n"; |
2083 |
< |
configfile<<"\n\nMCPeakError="<<MCPeakError<<";\n\n"; |
2083 |
> |
configfile<<"\n\nMCPeakError="<<MCPeakError<<";\n"; |
2084 |
> |
configfile<<"DataPeakError="<<DataPeakError<<";\n\n"; |
2085 |
|
for(int i=0;i<jzb_cuts.size();i++) configfile<<"jzb_cuts.push_back("<<jzb_cuts[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2086 |
|
configfile<<"\n\n"; |
2087 |
|
for(int i=0;i<Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2093 |
|
for(int i=0;i<flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2094 |
|
configfile<<"\n\n"; |
2095 |
|
configfile<<"luminosity="<<luminosity<<";\n"; |
2096 |
+ |
configfile<<"RestrictToMassPeak="<<RestrictToMassPeak<<";//defines the type of analysis we're running\n"; |
2097 |
|
|
2098 |
|
configfile<<"\n\ncout << \"Configuration successfully loaded!\" << endl; \n \n } \n \n"; |
2099 |
|
|
2194 |
|
leg->Draw("same"); |
2195 |
|
DrawMCPrelim(simulatedlumi); |
2196 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison"); |
2197 |
< |
|
2197 |
> |
cout << __LINE__ << endl; |
2198 |
|
TH1F *TZemcopy = (TH1F*)TZem->Clone("TZemcopy"); |
2199 |
+ |
cout << __LINE__ << endl; |
2200 |
|
TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy"); |
2201 |
< |
TH1F *TSeemmcopy = (TH1F*)TSeemm->Clone("TSeemmcopy"); |
2202 |
< |
TH1F *TSemcopy = (TH1F*)TSem->Clone("TSemcopy"); |
2201 |
> |
cout << __LINE__ << endl; |
2202 |
> |
TH1F *TSeemmcopy; |
2203 |
> |
TH1F *TSemcopy; |
2204 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
2205 |
> |
TSeemmcopy = (TH1F*)TSeemm->Clone("TSeemmcopy"); |
2206 |
> |
TSemcopy = (TH1F*)TSem->Clone("TSemcopy"); |
2207 |
> |
} |
2208 |
|
|
2209 |
|
TZem->Divide(TZeemm); |
2210 |
|
TZem->SetMarkerStyle(21); |
2226 |
|
|
2227 |
|
float linepos=0.25; |
2228 |
|
if(PlottingSetup::RestrictToMassPeak) linepos=0.25; |
2229 |
+ |
if(!PlottingSetup::RestrictToMassPeak) linepos=0.1; //sys uncertainty for iJZB |
2230 |
|
TLine *top = new TLine(binning[0],1.0+linepos,binning[binning.size()-1],1.0+linepos); |
2231 |
|
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
2232 |
|
TLine *bottom = new TLine(binning[0],1.0-linepos,binning[binning.size()-1],1.0-linepos); |
2233 |
|
|
2234 |
+ |
/*write_warning(__FUNCTION__,"These two lines are to be removed!"); |
2235 |
+ |
TLine *topalt = new TLine(binning[0],1.0+0.1,binning[binning.size()-1],1.0+0.1); |
2236 |
+ |
TLine *bottomalt = new TLine(binning[0],1.0-0.1,binning[binning.size()-1],1.0-0.1); |
2237 |
+ |
topalt->SetLineColor(kRed);topalt->SetLineStyle(3); |
2238 |
+ |
bottomalt->SetLineColor(kRed);bottomalt->SetLineStyle(3); |
2239 |
+ |
topalt->Draw("same");bottomalt->Draw("same");*/ |
2240 |
+ |
|
2241 |
+ |
|
2242 |
|
top->SetLineColor(kBlue);top->SetLineStyle(2); |
2243 |
|
bottom->SetLineColor(kBlue);bottom->SetLineStyle(2); |
2244 |
|
center->SetLineColor(kBlue); |
2263 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison_ratio"); |
2264 |
|
|
2265 |
|
|
2107 |
– |
|
2266 |
|
///-------------- second part: only look at the quantity we actually care about! |
2267 |
|
TH1F *leftsfzp = (TH1F*)nTZeemm->Clone("leftsfzp"); |
2268 |
|
TH1F *rightsfzp = (TH1F*)TZeemmcopy->Clone("rightsfzp"); |
2415 |
|
|
2416 |
|
TCut kcut(cutmass&&cutOSSF&&"pfJetGoodNum>2"); |
2417 |
|
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events", |
2418 |
< |
kcut&&kPos,mc,simulatedlumi,systsamples.FindSample("DYJets")); |
2418 |
> |
kcut&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2419 |
|
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events", |
2420 |
< |
kcut&&kNeg,mc,simulatedlumi,systsamples.FindSample("DYJets")); |
2420 |
> |
kcut&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2421 |
|
hJZBpos->SetLineColor(kBlack); |
2422 |
|
hJZBneg->SetLineColor(kRed); |
2423 |
|
|
2683 |
|
JZBSelEff(mcjzb,(signalsamples.collection)[isignal].events,(signalsamples.collection)[isignal].samplename,bins); // Only for some selected samples |
2684 |
|
} |
2685 |
|
} |
2686 |
+ |
|
2687 |
+ |
void qcd_plots(string datajzb, string mcjzb, vector<float> bins) { |
2688 |
+ |
// What this function aims to do: |
2689 |
+ |
// Illustrate cut flow for QCD (requiring only one lepton, requiring etc.) |
2690 |
+ |
// Illustrate how little QCD is left over! i.e. make some pointless JZB plot with only QCD to visualize the fact that there's not much really. |
2691 |
+ |
TCanvas *can = new TCanvas("can","can"); |
2692 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
2693 |
+ |
kinpad->cd(); |
2694 |
+ |
|
2695 |
+ |
string jzb=mcjzb; |
2696 |
+ |
|
2697 |
+ |
float hi=400; |
2698 |
+ |
bool use_signal=false; |
2699 |
+ |
bool use_data=false; |
2700 |
|
|
2701 |
+ |
bool is_data=false; |
2702 |
+ |
int nbins=50;//100; |
2703 |
+ |
float low=0; |
2704 |
+ |
float high=500; |
2705 |
+ |
int versok=false; |
2706 |
+ |
if(gROOT->GetVersionInt()>=53000) versok=true; |
2707 |
+ |
|
2708 |
+ |
TH1F *blankback = new TH1F("blankback","blankback",int(high/10),0,high); |
2709 |
+ |
TH1F *RcorrJZBeemm = qcdsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2710 |
+ |
TH1F *LcorrJZBeemm = qcdsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2711 |
+ |
TH1F *RcorrJZBem = qcdsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2712 |
+ |
TH1F *LcorrJZBem = qcdsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2713 |
+ |
blankback->GetXaxis()->SetTitle(RcorrJZBeemm->GetXaxis()->GetTitle()); |
2714 |
+ |
blankback->GetYaxis()->SetTitle(RcorrJZBeemm->GetYaxis()->GetTitle()); |
2715 |
+ |
blankback->GetXaxis()->CenterTitle(); |
2716 |
+ |
blankback->GetYaxis()->CenterTitle(); |
2717 |
+ |
|
2718 |
+ |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed. |
2719 |
+ |
TH1F *RcorrJZBSBem; |
2720 |
+ |
TH1F *LcorrJZBSBem; |
2721 |
+ |
TH1F *RcorrJZBSBeemm; |
2722 |
+ |
TH1F *LcorrJZBSBeemm; |
2723 |
+ |
|
2724 |
+ |
TH1F *RcorrJZBeemmNoS; |
2725 |
+ |
|
2726 |
+ |
//these are for the ratio |
2727 |
+ |
TH1F *JRcorrJZBeemm = qcdsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2728 |
+ |
TH1F *JLcorrJZBeemm = qcdsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2729 |
+ |
TH1F *JRcorrJZBem = qcdsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2730 |
+ |
TH1F *JLcorrJZBem = qcdsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2731 |
+ |
|
2732 |
+ |
TH1F *JRcorrJZBSBem; |
2733 |
+ |
TH1F *JLcorrJZBSBem; |
2734 |
+ |
TH1F *JRcorrJZBSBeemm; |
2735 |
+ |
TH1F *JLcorrJZBSBeemm; |
2736 |
+ |
|
2737 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
2738 |
+ |
RcorrJZBSBem = qcdsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2739 |
+ |
LcorrJZBSBem = qcdsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2740 |
+ |
RcorrJZBSBeemm = qcdsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2741 |
+ |
LcorrJZBSBeemm = qcdsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2742 |
+ |
|
2743 |
+ |
//these are for the ratio |
2744 |
+ |
JRcorrJZBSBem = qcdsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2745 |
+ |
JLcorrJZBSBem = qcdsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2746 |
+ |
JRcorrJZBSBeemm = qcdsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2747 |
+ |
JLcorrJZBSBeemm = qcdsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2748 |
+ |
|
2749 |
+ |
} |
2750 |
+ |
|
2751 |
+ |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed. |
2752 |
+ |
|
2753 |
+ |
TH1F *Zjetspred = (TH1F*)LcorrJZBeemm->Clone("Zjetspred"); |
2754 |
+ |
TH1F *TTbarpred = (TH1F*)RcorrJZBem->Clone("TTbarpred"); |
2755 |
+ |
|
2756 |
+ |
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
2757 |
+ |
TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred"); |
2758 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
2759 |
+ |
Bpred->Add(RcorrJZBem,1.0/3.); |
2760 |
+ |
Bpred->Add(LcorrJZBem,-1.0/3.); |
2761 |
+ |
Bpred->Add(RcorrJZBSBem,1.0/3.); |
2762 |
+ |
Bpred->Add(LcorrJZBSBem,-1.0/3.); |
2763 |
+ |
Bpred->Add(RcorrJZBSBeemm,1.0/3.); |
2764 |
+ |
Bpred->Add(LcorrJZBSBeemm,-1.0/3.); |
2765 |
+ |
|
2766 |
+ |
TTbarpred->Scale(1.0/3); |
2767 |
+ |
Zjetspred->Add(LcorrJZBem,-1.0/3.); |
2768 |
+ |
Zjetspred->Add(LcorrJZBSBem,-1.0/3.); |
2769 |
+ |
TTbarpred->Add(RcorrJZBSBem,1.0/3.); |
2770 |
+ |
Zjetspred->Add(LcorrJZBSBeemm,-1.0/3.); |
2771 |
+ |
TTbarpred->Add(RcorrJZBSBeemm,1.0/3.); |
2772 |
+ |
|
2773 |
+ |
//these are for the ratio |
2774 |
+ |
JBpred->Add(JRcorrJZBem,1.0/3.); |
2775 |
+ |
JBpred->Add(JLcorrJZBem,-1.0/3.); |
2776 |
+ |
JBpred->Add(JRcorrJZBSBem,1.0/3.); |
2777 |
+ |
JBpred->Add(JLcorrJZBSBem,-1.0/3.); |
2778 |
+ |
JBpred->Add(JRcorrJZBSBeemm,1.0/3.); |
2779 |
+ |
JBpred->Add(JLcorrJZBSBeemm,-1.0/3.); |
2780 |
+ |
} else { |
2781 |
+ |
Bpred->Add(RcorrJZBem,1.0); |
2782 |
+ |
Bpred->Add(LcorrJZBem,-1.0); |
2783 |
+ |
|
2784 |
+ |
Zjetspred->Add(LcorrJZBem,-1.0); |
2785 |
+ |
|
2786 |
+ |
//these are for the ratio |
2787 |
+ |
JBpred->Add(JRcorrJZBem,1.0); |
2788 |
+ |
JBpred->Add(JLcorrJZBem,-1.0); |
2789 |
+ |
} |
2790 |
+ |
|
2791 |
+ |
|
2792 |
+ |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed |
2793 |
+ |
|
2794 |
+ |
TLegend *legBpred = make_legend("",0.6,0.55,false); |
2795 |
+ |
RcorrJZBeemm->Draw("e1x0,same"); |
2796 |
+ |
Bpred->Draw("hist,same"); |
2797 |
+ |
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
2798 |
+ |
legBpred->AddEntry(RcorrJZBeemm,"MC observed","p"); |
2799 |
+ |
legBpred->AddEntry(Bpred,"MC predicted","l"); |
2800 |
+ |
if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18 |
2801 |
+ |
if(versok) legBpred->AddEntry((TObject*)0,"",""); // causes seg fault on root v5.18 |
2802 |
+ |
legBpred->Draw(); |
2803 |
+ |
DrawMCPrelim(); |
2804 |
+ |
|
2805 |
+ |
//3rd last argument: do special bpred ratio, 2nd last argument: extended range!, last: y-axis title |
2806 |
+ |
string ytitle("ratio"); |
2807 |
+ |
if ( use_data==1 ) ytitle = "data/pred"; |
2808 |
+ |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,"QCD/Bpred",true,use_data!=1,ytitle); |
2809 |
+ |
|
2810 |
+ |
TH1F *allevents = qcdsamples.Draw("allevents","pfJetGoodNum",1,0,100, "internal code", "events", "" ,mc, luminosity); |
2811 |
+ |
TH1F *ossf = qcdsamples.Draw("ossf","pfJetGoodNum",1,0,100, "internal code", "events", cutOSSF ,mc, luminosity); |
2812 |
+ |
TH1F *osof = qcdsamples.Draw("osof","pfJetGoodNum",1,0,100, "internal code", "events", cutOSOF ,mc, luminosity); |
2813 |
+ |
TH1F *njossf = qcdsamples.Draw("njossf","pfJetGoodNum",1,0,100, "internal code", "events", cutnJets&&cutOSSF ,mc, luminosity); |
2814 |
+ |
TH1F *njosof = qcdsamples.Draw("njosof","pfJetGoodNum",1,0,100, "internal code", "events", cutnJets&&cutOSOF ,mc, luminosity); |
2815 |
+ |
|
2816 |
+ |
dout << "______________________________________________" << endl; |
2817 |
+ |
dout << "QCD contribution: " << endl; |
2818 |
+ |
dout << "Total number of events: " << allevents->Integral() << endl; |
2819 |
+ |
dout << "OSSF events: " << ossf->Integral() << endl; |
2820 |
+ |
dout << "OSOF events: " << osof->Integral() << endl; |
2821 |
+ |
dout << "OSSF events with >=3 jets:" << njossf->Integral() << endl; |
2822 |
+ |
dout << "OSOF events with >=3 jets:" << njosof->Integral() << endl; |
2823 |
+ |
dout << "(note that no mass requirement has been imposed)" << endl; |
2824 |
+ |
|
2825 |
+ |
dout << "______________________________________________" << endl; |
2826 |
+ |
dout << "How QCD shows up in the different regions: " << endl; |
2827 |
+ |
dout << "OSSF: " << endl; |
2828 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
2829 |
+ |
dout << " Z window: \t" << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl; |
2830 |
+ |
dout << " sideband: \t" << RcorrJZBSBeemm->Integral() << " (JZB>0) , " << LcorrJZBSBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBSBeemm->Integral() + LcorrJZBSBeemm->Integral() << endl; |
2831 |
+ |
} else { |
2832 |
+ |
dout << " " << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl; |
2833 |
+ |
} |
2834 |
+ |
dout << "OSOF: " << endl; |
2835 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
2836 |
+ |
dout << " Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl; |
2837 |
+ |
dout << " sideband: \t" << RcorrJZBSBem->Integral() << " (JZB>0) , " << LcorrJZBSBem->Integral() << " (JZB<0) --> total: " << RcorrJZBSBem->Integral() + LcorrJZBSBem->Integral() << endl; |
2838 |
+ |
} else { |
2839 |
+ |
dout << " Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl; |
2840 |
+ |
} |
2841 |
+ |
dout << "Therefore: " << endl; |
2842 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
2843 |
+ |
dout << " Prediction increases by : " << LcorrJZBeemm->Integral() << " + (1.0/3)*(" << RcorrJZBSBeemm->Integral() <<"-"<< LcorrJZBSBeemm->Integral() << ") (SFSB) "; |
2844 |
+ |
dout << " + (1.0/3)*(" << RcorrJZBem->Integral() <<"-"<< LcorrJZBem->Integral() << ") (OFZP) "; |
2845 |
+ |
dout << " + (1.0/3)*(" << RcorrJZBSBem->Integral() <<"-"<< LcorrJZBSBem->Integral() << ") (OFSB) "; |
2846 |
+ |
dout << " = " << LcorrJZBeemm->Integral() + (1.0/3)*(RcorrJZBSBeemm->Integral() - LcorrJZBSBeemm->Integral() + RcorrJZBem->Integral() - LcorrJZBem->Integral() + RcorrJZBSBem->Integral() - LcorrJZBSBem->Integral()) << endl; |
2847 |
+ |
} else { |
2848 |
+ |
dout << " Prediction increases by : " << LcorrJZBeemm->Integral(); |
2849 |
+ |
dout << " + (" << RcorrJZBem->Integral() <<"-"<< LcorrJZBem->Integral() << ") (OFZP) "; |
2850 |
+ |
dout << " = " << LcorrJZBeemm->Integral() + RcorrJZBem->Integral() - LcorrJZBem->Integral() << endl; |
2851 |
+ |
} |
2852 |
+ |
dout << " Observation increases by : " << RcorrJZBeemm->Integral() << endl; |
2853 |
+ |
|
2854 |
+ |
dout << endl; |
2855 |
+ |
for(int i=0;i<bins.size();i++) { |
2856 |
+ |
dout << " JZB > " << bins[i] << " : " << endl; |
2857 |
+ |
dout << " Observation increases by : " << RcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl; |
2858 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
2859 |
+ |
dout << " Prediction increases by : " << LcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + (1.0/3)*(RcorrJZBSBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBSBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + RcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + RcorrJZBSBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBSBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX())) << endl; |
2860 |
+ |
} else { |
2861 |
+ |
dout << " Prediction increases by : " << LcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + RcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl; |
2862 |
+ |
} |
2863 |
+ |
} |
2864 |
+ |
|
2865 |
+ |
delete can; |
2866 |
+ |
delete allevents; |
2867 |
+ |
if(ossf) delete ossf; |
2868 |
+ |
if(RcorrJZBem) delete RcorrJZBem; |
2869 |
+ |
if(LcorrJZBem) delete LcorrJZBem; |
2870 |
+ |
if(RcorrJZBeemm) delete RcorrJZBeemm; |
2871 |
+ |
if(LcorrJZBeemm) delete LcorrJZBeemm; |
2872 |
+ |
if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBem) delete RcorrJZBSBem; |
2873 |
+ |
if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBem) delete LcorrJZBSBem; |
2874 |
+ |
if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBeemm) delete RcorrJZBSBeemm; |
2875 |
+ |
if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBeemm) delete LcorrJZBSBeemm; |
2876 |
+ |
} |
2877 |
+ |
|
2878 |
+ |
void check_ptsanity() { |
2879 |
+ |
TCanvas *ptsancan = new TCanvas("ptsancan","ptsancan",600,1800); |
2880 |
+ |
TH1F *individualpt1histos[allsamples.collection.size()]; |
2881 |
+ |
TH1F *individualpt2histos[allsamples.collection.size()]; |
2882 |
+ |
TH1F *fpt1 = new TH1F("fpt1","fpt1",50,0,50); |
2883 |
+ |
fpt1->GetYaxis()->SetRangeUser(0,1); |
2884 |
+ |
fpt1->GetXaxis()->SetTitle("p_{T,1}"); |
2885 |
+ |
fpt1->GetXaxis()->CenterTitle(); |
2886 |
+ |
|
2887 |
+ |
TH1F *fpt2 = new TH1F("fpt2","fpt2",50,0,50); |
2888 |
+ |
fpt2->GetXaxis()->SetTitle("p_{T,2}"); |
2889 |
+ |
fpt2->GetXaxis()->CenterTitle(); |
2890 |
+ |
|
2891 |
+ |
ptsancan->Divide(1,3); |
2892 |
+ |
ptsancan->cd(1); |
2893 |
+ |
float maxpt1entry=0; |
2894 |
+ |
float maxpt2entry=0; |
2895 |
+ |
|
2896 |
+ |
TLegend *leg = make_legend(); |
2897 |
+ |
leg->SetX1(0.0); |
2898 |
+ |
leg->SetY1(0.0); |
2899 |
+ |
leg->SetX2(1.0); |
2900 |
+ |
leg->SetY2(1.0); |
2901 |
+ |
|
2902 |
+ |
|
2903 |
+ |
for(int isample=0;isample<allsamples.collection.size();isample++) { |
2904 |
+ |
string nowname=(allsamples.collection)[isample].filename; |
2905 |
+ |
cout << "Drawing: " << nowname << " (sample " << isample+1 << " / " << allsamples.collection.size() << ")" << endl; |
2906 |
+ |
individualpt1histos[isample] = allsamples.Draw(GetNumericHistoName(),"pt1",50,0,50, "p_{T,1}", "events",cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample(nowname)); |
2907 |
+ |
individualpt2histos[isample] = allsamples.Draw(GetNumericHistoName(),"pt2",50,0,50, "p_{T,2}", "events",cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample(nowname)); |
2908 |
+ |
individualpt1histos[isample]->SetLineColor(isample+1); |
2909 |
+ |
individualpt2histos[isample]->SetLineColor(isample+1); |
2910 |
+ |
float currmaxpt1entry=individualpt1histos[isample]->GetMaximum()/individualpt1histos[isample]->Integral(); |
2911 |
+ |
float currmaxpt2entry=individualpt2histos[isample]->GetMaximum()/individualpt2histos[isample]->Integral(); |
2912 |
+ |
cout << " pt 1 histo contains; " << individualpt1histos[isample]->Integral() << endl; |
2913 |
+ |
cout << " pt 2 histo contains; " << individualpt2histos[isample]->Integral() << endl; |
2914 |
+ |
if(currmaxpt1entry>maxpt1entry)maxpt1entry=currmaxpt1entry; |
2915 |
+ |
if(currmaxpt2entry>maxpt2entry)maxpt2entry=currmaxpt2entry; |
2916 |
+ |
leg->AddEntry(individualpt2histos[isample],((allsamples.collection)[isample].filename).c_str(),"f"); |
2917 |
+ |
} |
2918 |
+ |
|
2919 |
+ |
fpt1->GetYaxis()->SetRangeUser(0,maxpt1entry); |
2920 |
+ |
fpt2->GetYaxis()->SetRangeUser(0,maxpt2entry); |
2921 |
+ |
|
2922 |
+ |
ptsancan->cd(1); |
2923 |
+ |
fpt1->Draw(); |
2924 |
+ |
ptsancan->cd(2); |
2925 |
+ |
fpt2->Draw(); |
2926 |
+ |
|
2927 |
+ |
for(int isample=0;isample<allsamples.collection.size();isample++) { |
2928 |
+ |
ptsancan->cd(1); |
2929 |
+ |
individualpt1histos[isample]->DrawNormalized("same,histo"); |
2930 |
+ |
ptsancan->cd(2); |
2931 |
+ |
individualpt2histos[isample]->DrawNormalized("same,histo"); |
2932 |
+ |
} |
2933 |
+ |
ptsancan->cd(3); |
2934 |
+ |
leg->Draw(); |
2935 |
+ |
CompleteSave(ptsancan,"PtSanityCheck"); |
2936 |
+ |
|
2937 |
+ |
delete ptsancan; |
2938 |
+ |
} |
2939 |
+ |
|
2940 |
+ |
void do_mlls_plot(string mcjzb) { |
2941 |
+ |
cout << "At this point we'd plot the mll distribution" << endl; |
2942 |
+ |
TCanvas *sigcan = new TCanvas("sigcan","sigcan"); |
2943 |
+ |
for(int isig=0;isig<(signalsamples.collection).size();isig++) { |
2944 |
+ |
if(!(signalsamples.collection)[isig].events) continue; |
2945 |
+ |
string nowname=(signalsamples.collection)[isig].filename; |
2946 |
+ |
TH1F *mll = signalsamples.Draw("mllhisto","mll",150,0,150, "m_{ll}", "events",cutOSSF&&cutnJets,mc,luminosity,signalsamples.FindSample(nowname)); |
2947 |
+ |
// TH1F *mll = signalsamples.Draw("mllhisto","mll",150,0,150, "m_{ll}", "events","",mc,luminosity,signalsamples.FindSample(nowname)); |
2948 |
+ |
mll->SetLineColor(TColor::GetColor("#04B404")); |
2949 |
+ |
stringstream poscutS; |
2950 |
+ |
poscutS << "((" << mcjzb <<")>50)"; |
2951 |
+ |
TCut poscut(poscutS.str().c_str()); |
2952 |
+ |
TH1F *mllP = signalsamples.Draw("mllhistoP","mll",150,0,150, "m_{ll}", "events",cutOSSF&&cutnJets&&poscut,mc,luminosity,signalsamples.FindSample(nowname)); |
2953 |
+ |
mllP->SetLineColor(TColor::GetColor("#0040FF")); |
2954 |
+ |
mll->Draw("histo"); |
2955 |
+ |
mllP->Draw("histo,same"); |
2956 |
+ |
TLegend *leg = make_legend(); |
2957 |
+ |
leg->SetY1(0.8); |
2958 |
+ |
leg->AddEntry(mll,(signalsamples.collection)[isig].samplename.c_str(),"L"); |
2959 |
+ |
leg->AddEntry(mllP,((signalsamples.collection)[isig].samplename+", JZB>50").c_str(),"L"); |
2960 |
+ |
leg->Draw(); |
2961 |
+ |
TLine *lin = new TLine(71.2,0,71.2,mll->GetMaximum()); |
2962 |
+ |
TLine *lin2 = new TLine(111.2,0,111.2,mll->GetMaximum()); |
2963 |
+ |
lin->Draw("same"); |
2964 |
+ |
lin2->Draw("same"); |
2965 |
+ |
|
2966 |
+ |
CompleteSave(sigcan,"MllShape/"+(signalsamples.collection)[isig].samplename); |
2967 |
+ |
delete mll; |
2968 |
+ |
delete mllP; |
2969 |
+ |
} |
2970 |
+ |
} |
2971 |
+ |
|
2972 |
+ |
void met_vs_jzb_plots() { |
2973 |
+ |
|
2974 |
+ |
TCanvas *canmetjzb = new TCanvas("canmet","MET vs JZB canvas"); |
2975 |
+ |
canmetjzb->SetRightMargin(0.16); |
2976 |
+ |
|
2977 |
+ |
vector<string> findme; |
2978 |
+ |
findme.push_back("DY"); |
2979 |
+ |
findme.push_back("TTJets"); |
2980 |
+ |
findme.push_back("LM"); |
2981 |
+ |
|
2982 |
+ |
for(int ifind=0;ifind<findme.size();ifind++) { |
2983 |
+ |
vector<int> selsamples = allsamples.FindSample(findme[ifind]); |
2984 |
+ |
TH2F *metvsjzb = new TH2F("metvsjzb","metvsjzb",200,0,100,400,-100,100); |
2985 |
+ |
for(int isel=0;isel<selsamples.size();isel++) { |
2986 |
+ |
cout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl; |
2987 |
+ |
allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF); |
2988 |
+ |
} |
2989 |
+ |
metvsjzb->Scale(allsamples.collection[selsamples[0]].weight); |
2990 |
+ |
metvsjzb->SetStats(0); |
2991 |
+ |
metvsjzb->GetXaxis()->SetTitle("MET (GeV)"); |
2992 |
+ |
metvsjzb->GetYaxis()->SetTitle("JZB (GeV)"); |
2993 |
+ |
metvsjzb->GetXaxis()->CenterTitle(); |
2994 |
+ |
metvsjzb->GetYaxis()->CenterTitle(); |
2995 |
+ |
metvsjzb->Draw("COLZ"); |
2996 |
+ |
TText* title = write_text(0.5,0.95,allsamples.collection[selsamples[0]].samplename); |
2997 |
+ |
title->SetTextAlign(12); |
2998 |
+ |
title->Draw(); |
2999 |
+ |
CompleteSave(canmetjzb,(string)"METvsJZBplots/"+findme[ifind]); |
3000 |
+ |
} |
3001 |
+ |
} |
3002 |
+ |
|
3003 |
|
|
3004 |
|
void test() { |
3005 |
|
|