// ----------------------------------------------------------------------------- // ----- pl_over_MCCounter.C ----- // ----- ----- // ----- created by C. Simon on 2018-10-10 ----- // ----- ----- // ----------------------------------------------------------------------------- void pl_over_MCCounter(Int_t iModuleType, Int_t iModuleIndex, Int_t iCounterIndex) { gStyle->SetPalette(1); gStyle->SetOptStat(kTRUE); gStyle->SetOptFit(kTRUE); gStyle->SetPaintTextFormat(".2f"); gROOT->cd(); gROOT->SetDirLevel(1); TH1* h1(NULL); TH2* h2(NULL); TEfficiency* heff(NULL); TH1* hpass(NULL); TH1* htotal(NULL); TF1* f1(NULL); TProfile* pf(NULL); TH1* pj(NULL); TString hname; TCanvas* can = new TCanvas("can", Form("MC counter %d-%d-%d reconstruction overview", iModuleType, iModuleIndex, iCounterIndex), 0, 0, 1500, 1066); can->Divide(6, 4); can->cd(1); hname = Form("hCounterAccTrackMul_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex); h1 = dynamic_cast(gROOT->FindObjectAny(hname)); if(h1) { gPad->SetLogy(); h1->Draw(); } else { cout << hname << " not found" << endl; } can->cd(2); hname = Form("hCounterAccRefTrackMul_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex); h1 = dynamic_cast(gROOT->FindObjectAny(hname)); if(h1) { gPad->SetLogy(); h1->Draw(); } else { cout << hname << " not found" << endl; } can->cd(3); hname = Form("hCounterAccRndmTrackMul_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex); h1 = dynamic_cast(gROOT->FindObjectAny(hname)); if(h1) { gPad->SetLogy(); h1->Draw(); } else { cout << hname << " not found" << endl; } can->cd(4); hname = Form("hCounterAccDomTrackMul_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex); h1 = dynamic_cast(gROOT->FindObjectAny(hname)); if(h1) { gPad->SetLogy(); h1->Draw(); } else { cout << hname << " not found" << endl; } can->cd(7); hname = Form("hRndmTracksProcSpec_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex); h2 = dynamic_cast(gROOT->FindObjectAny(hname)); if(h2) { h2->GetXaxis()->SetLabelSize(0.08); h2->GetYaxis()->SetLabelSize(0.09); h2->SetMarkerSize(2); h2->Draw("col text"); } else { cout << hname << " not found" << endl; } can->cd(8); hname = Form("hRndmTracksProcMat_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex); h2 = dynamic_cast(gROOT->FindObjectAny(hname)); if(h2) { h2->GetXaxis()->SetLabelSize(0.08); h2->GetYaxis()->SetLabelSize(0.09); h2->SetMarkerSize(2); h2->Draw("col text"); } else { cout << hname << " not found" << endl; } can->cd(9); hname = Form("hDomTracksProcSpec_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex); h2 = dynamic_cast(gROOT->FindObjectAny(hname)); if(h2) { h2->GetXaxis()->SetLabelSize(0.08); h2->GetYaxis()->SetLabelSize(0.09); h2->SetMarkerSize(2); h2->Draw("col text"); } else { cout << hname << " not found" << endl; } can->cd(10); hname = Form("hDomTracksProcMat_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex); h2 = dynamic_cast(gROOT->FindObjectAny(hname)); if(h2) { h2->GetXaxis()->SetLabelSize(0.08); h2->GetYaxis()->SetLabelSize(0.09); h2->SetMarkerSize(2); h2->Draw("col text"); } else { cout << hname << " not found" << endl; } can->cd(13); hname = Form("hCounterRecRefTrackEfficiencyPassed_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex); hpass = dynamic_cast(gROOT->FindObjectAny(hname)); if(hpass) { hname = Form("hCounterRecRefTrackEfficiencyTotal_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex); htotal = dynamic_cast(gROOT->FindObjectAny(hname)); if(htotal) { if(TEfficiency::CheckConsistency(*hpass, *htotal)) { heff = new TEfficiency(*hpass, *htotal); heff->Draw("AP"); gPad->Update(); heff->GetPaintedGraph()->GetXaxis()->SetLimits(heff->GetTotalHistogram()->GetXaxis()->GetXmin(), heff->GetTotalHistogram()->GetXaxis()->GetXmax()); heff->GetPaintedGraph()->GetYaxis()->SetRangeUser(0., 1.1); gPad->Modified(); } } else { cout << hname << " not found" << endl; } } else { cout << hname << " not found" << endl; } can->cd(14); hname = Form("hCounterRecRefTrackPurityPassed_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex); hpass = dynamic_cast(gROOT->FindObjectAny(hname)); if(hpass) { hname = Form("hCounterRecRefTrackEfficiencyPassed_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex); htotal = dynamic_cast(gROOT->FindObjectAny(hname)); if(htotal) { if(TEfficiency::CheckConsistency(*hpass, *htotal)) { heff = new TEfficiency(*hpass, *htotal); heff->Draw("AP"); gPad->Update(); heff->GetPaintedGraph()->GetXaxis()->SetLimits(heff->GetTotalHistogram()->GetXaxis()->GetXmin(), heff->GetTotalHistogram()->GetXaxis()->GetXmax()); heff->GetPaintedGraph()->GetYaxis()->SetRangeUser(0., 1.1); heff->GetPaintedGraph()->GetYaxis()->SetTitle("reco purity []"); gPad->Modified(); } } else { cout << hname << " not found" << endl; } } else { cout << hname << " not found" << endl; } can->cd(23); hname = Form("hCounterRefTrackLocalXY_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex); h2 = dynamic_cast(gROOT->FindObjectAny(hname)); if(h2) { gPad->SetLogz(); h2->Draw("colz"); } else { cout << hname << " not found" << endl; } can->cd(16); hname = Form("hCounterRefTrackMulHitMul_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex); h2 = dynamic_cast(gROOT->FindObjectAny(hname)); if(h2) { gPad->SetLogz(); h2->Draw("colz"); h2->ProfileX()->Draw("same"); } else { cout << hname << " not found" << endl; } can->cd(5); hname = Form("hCounterRefTrackMulCell_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex); h2 = dynamic_cast(gROOT->FindObjectAny(hname)); if(h2) { gPad->SetLogz(); h2->Draw("colz"); h2->ProfileX()->Draw("same"); TH1* hocc = new TH1F(Form("hCounterRefTrackOccCell_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex), Form("%d-%d-%d ref track cell occ; %s; occupancy [%%]", iModuleType, iModuleIndex, iCounterIndex, h2->GetXaxis()->GetTitle()), h2->GetNbinsX(), h2->GetXaxis()->GetXmin(), h2->GetXaxis()->GetXmax()); TH1* hmtp = new TH1F(Form("hCounterRefTrackMTPCell_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex), Form("%d-%d-%d ref track cell mtp; %s; multi-track prob. [%%]", iModuleType, iModuleIndex, iCounterIndex, h2->GetXaxis()->GetTitle()), h2->GetNbinsX(), h2->GetXaxis()->GetXmin(), h2->GetXaxis()->GetXmax()); for(Int_t iCell = 0; iCell < h2->GetNbinsX(); iCell++) { pj = h2->ProjectionY("_py", iCell + 1, iCell + 1); Double_t dNTotalEvents = pj->GetEntries(); Double_t dNFullEvents = pj->Integral(2, pj->GetNbinsX()); Double_t dNMultiEvents = pj->Integral(3, pj->GetNbinsX()); if(dNTotalEvents) { hocc->SetBinContent(iCell + 1, 100.*dNFullEvents/dNTotalEvents); } if(dNFullEvents) { hmtp->SetBinContent(iCell + 1, 100.*dNMultiEvents/dNFullEvents); } if(iCell + 1 == h2->GetNbinsX()/2) { pj->SetName(Form("%s_%d", pj->GetName(), h2->GetNbinsX()/2)); can->cd(6); gPad->SetLogy(); pj->Draw(); } else { delete pj; } } can->cd(19); hocc->GetYaxis()->SetRangeUser(0., 20.); hocc->Draw(); can->cd(20); hmtp->GetYaxis()->SetRangeUser(0., 30.); hmtp->Draw(); } else { cout << hname << " not found" << endl; } can->cd(11); hname = Form("hCounterHitMulCell_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex); h2 = dynamic_cast(gROOT->FindObjectAny(hname)); if(h2) { gPad->SetLogz(); h2->Draw("colz"); h2->ProfileX()->Draw("same"); TH1* hocc = new TH1F(Form("hCounterHitOccCell_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex), Form("%d-%d-%d hit cell occ; %s; occupancy [%%]", iModuleType, iModuleIndex, iCounterIndex, h2->GetXaxis()->GetTitle()), h2->GetNbinsX(), h2->GetXaxis()->GetXmin(), h2->GetXaxis()->GetXmax()); TH1* hmtp = new TH1F(Form("hCounterHitMTPCell_%d_%d_%d", iModuleType, iModuleIndex, iCounterIndex), Form("%d-%d-%d hit cell mtp; %s; multi-hit prob. [%%]", iModuleType, iModuleIndex, iCounterIndex, h2->GetXaxis()->GetTitle()), h2->GetNbinsX(), h2->GetXaxis()->GetXmin(), h2->GetXaxis()->GetXmax()); for(Int_t iCell = 0; iCell < h2->GetNbinsX(); iCell++) { pj = h2->ProjectionY("_py", iCell + 1, iCell + 1); Double_t dNTotalEvents = pj->GetEntries(); Double_t dNFullEvents = pj->Integral(2, pj->GetNbinsX()); Double_t dNMultiEvents = pj->Integral(3, pj->GetNbinsX()); if(dNTotalEvents) { hocc->SetBinContent(iCell + 1, 100.*dNFullEvents/dNTotalEvents); } if(dNFullEvents) { hmtp->SetBinContent(iCell + 1, 100.*dNMultiEvents/dNFullEvents); } if(iCell + 1 == h2->GetNbinsX()/2) { pj->SetName(Form("%s_%d", pj->GetName(), h2->GetNbinsX()/2)); can->cd(12); gPad->SetLogy(); pj->Draw(); } else { delete pj; } } can->cd(21); hocc->GetYaxis()->SetRangeUser(0., 25.); hocc->Draw(); can->cd(22); hmtp->GetYaxis()->SetRangeUser(0., 5.); hmtp->Draw(); } else { cout << hname << " not found" << endl; } can->cd(17); hname = Form("hCounterHitMulCell_%d_%d_%d_pfx", iModuleType, iModuleIndex, iCounterIndex); pf = dynamic_cast(gROOT->FindObjectAny(hname)); if(pf) { pf->SetTitle(Form("%d-%d-%d #color[602]{hit}/#color[2]{ref track} MUL/cell", iModuleType, iModuleIndex, iCounterIndex)); pf->GetYaxis()->SetRangeUser(0., 0.5); pf->Draw(); hname = Form("hCounterRefTrackMulCell_%d_%d_%d_pfx", iModuleType, iModuleIndex, iCounterIndex); pf = dynamic_cast(gROOT->FindObjectAny(hname)); if(pf) { pf->SetLineColor(kRed); pf->Draw("same"); } else { cout << hname << " not found" << endl; } } else { cout << hname << " not found" << endl; } can->SaveAs(Form("pl_over_MCCounter_%d%d%d.pdf", iModuleType, iModuleIndex, iCounterIndex)); }