#include #include #include #include "TCanvas.h" #include "TH1F.h" #include "AtlasUtils.h" #include "AtlasStyle.C" #include "AtlasLabels.C" #define nrT 100 void readUnfoldingBreakdown(std::string hname, bool saving=false) { if (hname=="XXX"){ std::cout<<"No histogram selected - possible choices are: \n"; std::cout<<"\"j_bjet_Pt_binned\""<LoadMacro("AtlasUtils.C"); SetAtlasStyle(); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); std::string filen="../data/UnfoldingBreakdownNumbers.txt"; Double_t MR[nrT], NR[nrT], MmatchR[nrT], NmatchR[nrT], Mfake[nrT], Nfake[nrT], MT[nrT], NT[nrT], MmatchT[nrT], NmatchT[nrT], Meff[nrT], Neff[nrT]; int m_debug; //Int_t nr = 0; if (m_debug>1) std::cout<<" file to be read = <"<"<SetBinContent(j, MR [index]); h_Data0NR ->SetBinContent(j, NR [index]); h_Data0MmatchR->SetBinContent(j, MmatchR [index]); h_Data0NmatchR->SetBinContent(j, NmatchR [index]); h_Data0Mfake ->SetBinContent(j, Mfake [index]); h_Data0Nfake ->SetBinContent(j, Nfake [index]); h_Data0MT ->SetBinContent(j, MT [index]); h_Data0NT ->SetBinContent(j, NT [index]); h_Data0MmatchT->SetBinContent(j, MmatchT [index]); h_Data0NmatchT->SetBinContent(j, NmatchT [index]); h_Data0Meff ->SetBinContent(j, Meff [index]); h_Data0Neff ->SetBinContent(j, Neff [index]); // std::cout<<"at index "<GetYaxis()->SetRangeUser(0.5,1.5); h_Data0NR->GetXaxis()->SetTitle(hname.c_str()); h_Data0NR->Draw("EP"); h_Data0MR->Draw("SAME"); h_Data0MmatchR->SetLineColor(2); h_Data0MmatchR->SetLineStyle(2); h_Data0NmatchR->SetMarkerColor(2); h_Data0NmatchR->SetMarkerStyle(24); h_Data0NmatchR->SetMarkerSize(2.); h_Data0MmatchR->Draw("SAME"); h_Data0NmatchR->Draw("SAMEP"); TLegend* myLegend7 = new TLegend(0.7,0.7,0.95,0.95); myLegend7->AddEntry(h_Data0NR, "Reco N","P"); myLegend7->AddEntry(h_Data0MR, "Reco M","L"); myLegend7->AddEntry(h_Data0NmatchR, "matched-Reco N","P"); myLegend7->AddEntry(h_Data0MmatchR, "matched-Reco M","L"); myLegend7->SetShadowColor(1); myLegend7->SetBorderSize(0); myLegend7->SetFillStyle(0); myLegend7->Draw(); TCanvas* c1 = new TCanvas("Fakes","fakes"); h_Data0Nfake->GetXaxis()->SetTitle(hname.c_str()); h_Data0Mfake->Draw(); h_Data0Nfake->Draw("SAMEP"); TLegend* myLegend8 = new TLegend(0.7,0.7,0.95,0.95); myLegend8->AddEntry(h_Data0Nfake, "Fakes N","P"); myLegend8->AddEntry(h_Data0Mfake, "Fakes M","L"); myLegend8->SetShadowColor(1); myLegend8->SetBorderSize(0); myLegend8->SetFillStyle(0); myLegend8->Draw(); TCanvas* c2 = new TCanvas("Truth","truth"); //h_Data0MR->GetYaxis()->SetRangeUser(0.5,1.5); h_Data0NT->GetXaxis()->SetTitle(hname.c_str()); h_Data0NT->Draw("EP"); h_Data0MT->Draw("SAME"); h_Data0MmatchT->SetLineColor(2); h_Data0MmatchT->SetLineStyle(2); h_Data0NmatchT->SetMarkerStyle(24); h_Data0NmatchT->SetMarkerSize(2.); h_Data0NmatchT->SetMarkerColor(2); h_Data0MmatchT->Draw("SAME"); h_Data0NmatchT->Draw("SAMEP"); TLegend* myLegend6 = new TLegend(0.7,0.7,0.95,0.95); myLegend6->AddEntry(h_Data0NT, "Truth N","P"); myLegend6->AddEntry(h_Data0MT, "Truth M","L"); myLegend6->AddEntry(h_Data0NmatchT, "matched-Truth N","P"); myLegend6->AddEntry(h_Data0MmatchT, "matched-Truth M","L"); myLegend6->SetShadowColor(1); myLegend6->SetBorderSize(0); myLegend6->SetFillStyle(0); myLegend6->Draw(); TCanvas* c3 = new TCanvas("Efficiency","eff"); h_Data0Neff->GetXaxis()->SetTitle(hname.c_str()); h_Data0Neff->Draw(); h_Data0Meff->Draw("SAMEP"); TLegend* myLegend5 = new TLegend(0.7,0.7,0.95,0.95); myLegend5->AddEntry(h_Data0Neff, "Efficiency N","P"); myLegend5->AddEntry(h_Data0Meff, "Efficiency M","L"); myLegend5->SetShadowColor(1); myLegend5->SetBorderSize(0); myLegend5->SetFillStyle(0); myLegend5->Draw(); TH1F *Rratio = h_Data0NR->Clone(("hratioR_"+hname).c_str()); Rratio->Divide(h_Data0MR); TH1F *RMratio = h_Data0NmatchR->Clone(("hratioRmatch_"+hname).c_str()); RMratio->Divide(h_Data0MmatchR); TH1F *Tratio = h_Data0NT->Clone(("hratioT_"+hname).c_str()); Tratio->Divide(h_Data0MT); TH1F *TMratio = h_Data0NmatchT->Clone(("hratioTmatch_"+hname).c_str()); TMratio->Divide(h_Data0MmatchT); TH1F *Effratio = h_Data0Neff->Clone(("hratioRff_"+hname).c_str()); Effratio->Divide(h_Data0Meff); TH1F *Fakesratio = h_Data0Nfake->Clone(("hratioFakes_"+hname).c_str()); Fakesratio->Divide(h_Data0Mfake); TCanvas* cr0 = new TCanvas("RatioReco","RatioReco"); Rratio->GetXaxis()->SetTitle(hname.c_str()); Rratio->SetMinimum(0.7); Rratio->SetMaximum(1.3); Rratio->Draw("P"); RMratio->SetMarkerStyle(23); RMratio->Draw("PSAME"); TLegend* myLegend4 = new TLegend(0.7,0.7,0.95,0.95); myLegend4->AddEntry(Rratio, "Reco N/M","PL"); myLegend4->AddEntry(RMratio,"matched-Reco N/M","PL"); myLegend4->SetShadowColor(1); myLegend4->SetBorderSize(0); myLegend4->SetFillStyle(0); myLegend4->Draw(); TCanvas* cr1 = new TCanvas("RatioTruth","RatioTruth"); Tratio->GetXaxis()->SetTitle(hname.c_str()); Tratio->SetMinimum(0.7); Tratio->SetMaximum(1.3); Tratio->Draw("P"); TMratio->SetMarkerStyle(23); TMratio->Draw("PSAME"); TLegend* myLegend3 = new TLegend(0.7,0.7,0.95,0.95); myLegend3->AddEntry(Tratio, "Truth N/M","PL"); myLegend3->AddEntry(TMratio,"matched-Truth N/M","PL"); myLegend3->SetShadowColor(1); myLegend3->SetBorderSize(0); myLegend3->SetFillStyle(0); myLegend3->Draw(); TCanvas* cr2 = new TCanvas("RatioEff","RatioEff"); Effratio->GetXaxis()->SetTitle(hname.c_str()); Effratio->SetMinimum(0.7); Effratio->SetMaximum(1.3); Effratio->Draw("P"); TLegend* myLegend2 = new TLegend(0.7,0.7,0.95,0.95); myLegend2->AddEntry(Effratio,"Efficiency N/M","P"); myLegend2->SetShadowColor(1); myLegend2->SetBorderSize(0); myLegend2->SetFillStyle(0); myLegend2->Draw(); TCanvas* cr3 = new TCanvas("RatioFakes","RatioFakes"); Fakesratio->GetXaxis()->SetTitle(hname.c_str()); Fakesratio->SetMinimum(0.7); Fakesratio->SetMaximum(1.3); Fakesratio->Draw("P"); TLegend* myLegend1 = new TLegend(0.7,0.7,0.95,0.95); myLegend1->AddEntry(Fakesratio,"Fake rate N/M","P"); myLegend1->SetShadowColor(1); myLegend1->SetBorderSize(0); myLegend1->SetFillStyle(0); myLegend1->Draw(); TCanvas* cr4 = new TCanvas("Ratios","Ratios"); Fakesratio->SetMinimum(0.7); Fakesratio->SetMaximum(1.3); Effratio->SetMarkerColor(2); Rratio->SetMarkerColor(4); Tratio->SetMarkerColor(3); Fakesratio->Draw("CP"); Effratio ->Draw("CPSAME"); Rratio ->Draw("CPSAME"); Tratio ->Draw("CPSAME"); TLegend* myLegend = new TLegend(0.7,0.7,0.95,0.95); myLegend->AddEntry(Fakesratio,"Fake rate","P"); myLegend->AddEntry(Effratio, "Efficiency","P"); myLegend->AddEntry(Rratio, "Reco yield","P"); myLegend->AddEntry(Tratio, "Truth yield","P"); myLegend->SetShadowColor(1); myLegend->SetBorderSize(0); myLegend->SetFillStyle(0); myLegend->Draw(); if (saving){ newFile->Write(); newFile->Close(); } c0->SaveAs(("temporary/"+std::string(c0->GetName())+hname+".eps").c_str()); c1->SaveAs(("temporary/"+std::string(c1->GetName())+hname+".eps").c_str()); c2->SaveAs(("temporary/"+std::string(c2->GetName())+hname+".eps").c_str()); c3->SaveAs(("temporary/"+std::string(c3->GetName())+hname+".eps").c_str()); cr0->SaveAs(("temporary/"+std::string(cr0->GetName())+hname+".eps").c_str()); cr1->SaveAs(("temporary/"+std::string(cr1->GetName())+hname+".eps").c_str()); cr2->SaveAs(("temporary/"+std::string(cr2->GetName())+hname+".eps").c_str()); cr3->SaveAs(("temporary/"+std::string(cr3->GetName())+hname+".eps").c_str()); cr4->SaveAs(("temporary/"+std::string(cr4->GetName())+hname+".eps").c_str()); return; }