854 |
|
return return_functions; |
855 |
|
} |
856 |
|
|
857 |
< |
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float sigma, float high, int use_data, bool overlay_signal = false ) |
857 |
> |
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float sigma, float high, int use_data, bool overlay_signal = false,string subdir="" ) |
858 |
|
{ |
859 |
+ |
// note: sigma is not used ATM |
860 |
|
switch_overunderflow(true); |
861 |
|
bool is_data=false; |
862 |
|
bool use_signal=false; |
1065 |
|
// speciallegBpred->AddEntry(lm4RcorrJZBeemmC,"LM4","l"); |
1066 |
|
speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1067 |
|
speciallegBpred->Draw(); |
1068 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,predcomppad,"Bpred_Data_____PredictionComposition",true,use_data!=1,"data/pred"); |
1068 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition",true,use_data!=1,"data/pred"); |
1069 |
|
|
1070 |
|
TCanvas *specialcanv = new TCanvas("specialcanv","specialcanv"); |
1071 |
|
THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal); |
1076 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1077 |
|
legBpred->Draw(); |
1078 |
|
DrawPrelim(); |
1079 |
< |
CompleteSave(specialcanv,"Bpred_Data_____PredictionCompositioninMC"); |
1079 |
> |
CompleteSave(specialcanv,subdir+"Bpred_Data_____PredictionCompositioninMC"); |
1080 |
|
Bpred->SetLineWidth((int)CurrentBpredLineWidth); |
1081 |
|
|
1082 |
|
delete speciallegBpred; |
1135 |
|
string ytitle("ratio"); |
1136 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
1137 |
|
//save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,use_data!=1,ytitle); |
1138 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,false,ytitle);//not extending the y range anymore up to 4 |
1138 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,false,ytitle);//not extending the y range anymore up to 4 |
1139 |
|
|
1140 |
|
|
1141 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1180 |
|
legBpredc->AddEntry(BpredSBem,"OFSB","l"); |
1181 |
|
legBpredc->AddEntry(BpredSBeemm,"SFSB","l"); |
1182 |
|
legBpredc->Draw(); |
1183 |
< |
CompleteSave(globalcanvas,"Bpred_Data_comparison"); |
1183 |
> |
CompleteSave(globalcanvas,subdir+"Bpred_Data_comparison"); |
1184 |
|
} |
1185 |
|
if(use_data==0) { |
1186 |
|
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
1188 |
|
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1189 |
|
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1190 |
|
legBpredc->Draw(); |
1191 |
< |
CompleteSave(globalcanvas,"Bpred_MC_comparison"); |
1191 |
> |
CompleteSave(globalcanvas,subdir+"Bpred_MC_comparison"); |
1192 |
|
} |
1193 |
|
if(use_data==2) { |
1194 |
|
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
1197 |
|
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1198 |
|
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1199 |
|
legBpredc->Draw(); |
1200 |
< |
CompleteSave(globalcanvas,"Bpred_MCwithS_comparison"); |
1200 |
> |
CompleteSave(globalcanvas,subdir+"Bpred_MCwithS_comparison"); |
1201 |
|
} |
1202 |
|
} |
1203 |
|
|
1582 |
|
TText *writeline1 = write_cut_on_canvas(write_cut.c_str()); |
1583 |
|
writeline1->SetTextSize(0.035); |
1584 |
|
writeline1->Draw(); |
1585 |
< |
save_with_ratio(datahisto,mcstack,jzbpad->cd(),("jzb/"+savename)); |
1585 |
> |
if(!Contains(savename,"Dibosons")) save_with_ratio(datahisto,mcstack,jzbpad->cd(),("jzb/"+savename)); |
1586 |
> |
else save_with_ratio(datahisto,mcstack,jzbpad->cd(),savename); |
1587 |
|
TPad *jzbpad2 = new TPad("jzbpad2","jzbpad2",0,0,1,1); |
1588 |
|
jzbpad2->cd(); |
1589 |
|
jzbpad2->SetLogy(1); |
1598 |
|
writeline1->SetTextSize(0.035); |
1599 |
|
writeline1->Draw(); |
1600 |
|
DrawPrelim(); |
1601 |
< |
save_with_ratio(datahisto,mcstack,jzbpad2->cd(),("jzb/PositiveSideOnly/"+savename+"")); |
1601 |
> |
if(!Contains(savename,"Dibosons")) save_with_ratio(datahisto,mcstack,jzbpad2->cd(),("jzb/PositiveSideOnly/"+savename+"")); |
1602 |
> |
else save_with_ratio(datahisto,mcstack,jzbpad2->cd(),(savename+"__PosOnly")); |
1603 |
|
datahisto->Delete(); |
1604 |
|
mcstack.Delete(); |
1605 |
|
} |
1607 |
|
Double_t GausR(Double_t *x, Double_t *par) { |
1608 |
|
return gRandom->Gaus(x[0],par[0]); |
1609 |
|
} |
1610 |
+ |
|
1611 |
+ |
void produce_stretched_jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
1612 |
+ |
TCanvas *dican = new TCanvas("dican","JZB Plots Canvas"); |
1613 |
+ |
float max=jzbHigh ; |
1614 |
+ |
float min=-120; |
1615 |
+ |
int nbins=(int)((max-min)/5.0); // we want 5 GeV/bin |
1616 |
+ |
int coarserbins=int(nbins/2.0); |
1617 |
+ |
int rebinnedbins=int(nbins/4.0); |
1618 |
+ |
|
1619 |
+ |
vector<float>binning;vector<float>coarse_binning;vector<float>coarsest_binning; |
1620 |
+ |
for(int i=0;i<=nbins;i++)binning.push_back(min+i*(max-min)/((float)nbins)); |
1621 |
+ |
for(int i=0;i<=coarserbins;i++)coarse_binning.push_back(min+i*(max-min)/((float)coarserbins)); |
1622 |
+ |
for(int i=0;i<=rebinnedbins;i++)coarsest_binning.push_back(min+i*(max-min)/((float)rebinnedbins)); |
1623 |
+ |
|
1624 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_SFZP",dican,binning); |
1625 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_OFZP",dican,binning); |
1626 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"Dibosons/ee/jzb_OS_SFZP",dican,binning); |
1627 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_SFZP",dican,binning); |
1628 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"Dibosons/ee/jzb_OS_OFZP",dican,binning); |
1629 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_OFZP",dican,binning); |
1630 |
+ |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning); |
1631 |
+ |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning); |
1632 |
+ |
|
1633 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_SFZP_coarse",dican,coarse_binning); |
1634 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_OFZP_coarse",dican,coarse_binning); |
1635 |
+ |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning); |
1636 |
+ |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning); |
1637 |
+ |
|
1638 |
+ |
delete dican; |
1639 |
+ |
} |
1640 |
|
|
1641 |
+ |
|
1642 |
+ |
void diboson_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
1643 |
+ |
vector<int> SamplesToBeModified = allsamples.FindSampleBySampleName("WW/WZ/ZZ"); |
1644 |
+ |
|
1645 |
+ |
if(SamplesToBeModified.size()==0 || SamplesToBeModified[0]==-1) { |
1646 |
+ |
write_error(__FUNCTION__,"Could not find any diboson samples - aborting diboson plots"); |
1647 |
+ |
return; |
1648 |
+ |
} |
1649 |
+ |
|
1650 |
+ |
float stretchfactor = 100.0; |
1651 |
+ |
vector<string> labels; |
1652 |
+ |
|
1653 |
+ |
|
1654 |
+ |
dout << "Going to increase the cross section for diboson samples ... " << endl; |
1655 |
+ |
for(int i=0;i<SamplesToBeModified.size();i++) { |
1656 |
+ |
float origxs=(allsamples.collection)[SamplesToBeModified[i]].xs; |
1657 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].xs=origxs*stretchfactor; |
1658 |
+ |
dout << " Increased xs for sample " << (allsamples.collection)[SamplesToBeModified[i]].filename << " from " << origxs << " to " << (allsamples.collection)[SamplesToBeModified[i]].xs << " (by a factor of " << stretchfactor << ")" << endl; |
1659 |
+ |
labels.push_back((allsamples.collection)[SamplesToBeModified[i]].samplename); |
1660 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].samplename=any2string(int(stretchfactor))+" x "+(allsamples.collection)[SamplesToBeModified[i]].samplename; |
1661 |
+ |
dout << " (also renamed it to " << (allsamples.collection)[SamplesToBeModified[i]].samplename << " )" << endl; |
1662 |
+ |
} |
1663 |
+ |
|
1664 |
+ |
dout << "Going to produce JZB plots" << endl; |
1665 |
+ |
// produce_stretched_jzb_plots(mcjzb,datajzb,ratio_binning); |
1666 |
+ |
TCanvas *gloca = new TCanvas("gloca","gloca"); |
1667 |
+ |
float sigma=123456; |
1668 |
+ |
|
1669 |
+ |
dout << "Going to produce prediction plots" << endl; |
1670 |
+ |
do_prediction_plot(mcjzb, gloca, sigma, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do only MC plots, no signal |
1671 |
+ |
do_prediction_plot(mcjzb, gloca, sigma, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do MC plots with signal |
1672 |
+ |
delete gloca; |
1673 |
+ |
|
1674 |
+ |
dout << "Going to reset the cross section for diboson samples ... " << endl; |
1675 |
+ |
for(int i=0;i<SamplesToBeModified.size();i++) { |
1676 |
+ |
float Upxs=(allsamples.collection)[SamplesToBeModified[i]].xs; |
1677 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].xs=(allsamples.collection)[SamplesToBeModified[i]].xs*(1.0/stretchfactor); |
1678 |
+ |
string Upname=(allsamples.collection)[SamplesToBeModified[i]].samplename; |
1679 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].samplename=labels[i]; |
1680 |
+ |
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; |
1681 |
+ |
|
1682 |
+ |
} |
1683 |
+ |
|
1684 |
+ |
} |
1685 |
|
void jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
1686 |
|
TCanvas *can = new TCanvas("can","JZB Plots Canvas"); |
1687 |
|
float max=jzbHigh ; |
1716 |
|
// flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1717 |
|
// if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarsest",can,coarsest_binning); |
1718 |
|
// if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarsest",can,coarsest_binning); |
1719 |
+ |
delete can; |
1720 |
|
} |
1721 |
|
|
1722 |
|
|