// -------------------------------------------------------------------- void confgraph(TGraph *g, TString tit, int col=1, int marker=20, double shift=0.) { if (tit!="") g->GetHistogram()->SetTitle(tit); g->GetHistogram()->SetMinimum(0); g->SetLineColor(col); g->SetMarkerColor(col); g->SetMarkerStyle(marker); g->SetMarkerSize(1.5); g->SetLineWidth(2); TF1 *f1 = g->GetFunction("f1"); if (f1) { f1->SetLineColor(col); f1->SetLineStyle(2); } for (int i=0;iGetN();++i) { double x,y; g->GetPoint(i,x,y); g->SetPoint(i,x+shift,y); // cout <GetTitle(); double ymax = TMath::MaxElement(g->GetN(), g->GetY()); double dymax = g->GetErrorY(TMath::LocMax(g->GetN(), g->GetEY())); if (xmin>=xmax) { xmin = TMath::MinElement(g->GetN(), g->GetX()); xmax = TMath::MaxElement(g->GetN(), g->GetX()); } TH1F *h=new TH1F(Form("h%03d",cnt++),tit,g->GetN(),xmin-0.5*(xmax-xmin)/g->GetN(), xmax+0.5*(xmax-xmin)/g->GetN()); h->GetXaxis()->SetLabelSize(0.05); h->GetXaxis()->SetTitleSize(0.05); h->GetYaxis()->SetLabelSize(0.05); h->GetYaxis()->SetTitleSize(0.05); h->GetYaxis()->SetTitleOffset(1.4); if (yymax==0) h->SetMaximum((ymax+dymax)*1.05); else h->SetMaximum(yymax); h->SetMinimum(0); h->SetStats(0); return h; } // -------------------------------------------------------------------- void combinePlotsJ(TString fname="anaJ.root") { gStyle->SetOptStat(0); gStyle->SetOptFit(0); TFile *f=new TFile(fname); TString plotnam[4]={"Jee_A","Jee_B","Jmm_A","Jmm_B"}; TString lab[4] = { "signal efficiency;EMC missing (polar #theta) [%];signal efficiency [%]", "background efficiency;EMC missing (polar #theta) [%];background efficiency [%]", "signal to noise;EMC missing (polar #theta) [%];S/B", "significance;EMC missing (polar #theta) [%];significance [#sigma]"}; TGraphErrors *geffs[4]; TGraphErrors *geffb[4]; TGraphErrors *gston[4]; TGraphErrors *gsign[4]; TCanvas *c1=new TCanvas("c1","c1",10,10,1300,1000); c1->Divide(2,2,0.0001,0.0001); int colors[4] = {kBlue,kCyan-2,2,kRed-7}; TH1F *h[4]={0}; double hmaxy[4] = {14., 3e-4, 2.5, 6.}; int imin = 0, imax=4; for (int i=imin;icd(1); geffs[i]=(TGraphErrors*)f->Get(Form("effs_%s",plotnam[i].Data())); confgraph(geffs[i],"",colors[i],20+(i%2)*3,i); if (h[0]==0) h[0]=createHistoGraph(geffs[i],lab[0], hmaxy[0]); if (i==imin) h[0]->Draw(); geffs[i]->Draw("P same"); c1->cd(2); gPad->SetLogy(); geffb[i]=(TGraphErrors*)f->Get(Form("effb_%s",plotnam[i].Data())); confgraph(geffb[i],"",colors[i],20+(i%2)*3,i); if (h[1]==0) h[1]=createHistoGraph(geffb[i],lab[1], hmaxy[1]); h[1]->SetMinimum(0.5e-8); h[1]->SetMaximum(0.0002); if (i==imin) h[1]->Draw(); geffb[i]->Draw("P same"); c1->cd(3); gston[i]=(TGraphErrors*)f->Get(Form("sn_%s",plotnam[i].Data())); confgraph(gston[i],"",colors[i],20+(i%2)*3,i); if (h[2]==0) h[2]=createHistoGraph(gston[i],lab[2], hmaxy[2]); if (i==imin) h[2]->Draw(); gston[i]->Draw("P same"); c1->cd(4); gsign[i]=(TGraphErrors*)f->Get(Form("sign_%s",plotnam[i].Data())); confgraph(gsign[i],"",colors[i],20+(i%2)*3,i); if (h[3]==0) h[3]=createHistoGraph(gsign[i],lab[3], hmaxy[3]); if (i==imin) h[3]->Draw(); gsign[i]->Draw("P same"); } c1->cd(1); TLegend *leg1=new TLegend(0.16,0.18,0.6,0.38); leg1->AddEntry(geffs[0],"J/#psi(ee) - Setup A","lep"); leg1->AddEntry(geffs[1],"J/#psi(ee) - Setup B","lep"); leg1->AddEntry(geffs[2],"J/#psi(#mu#mu) - Setup A","lep"); leg1->AddEntry(geffs[3],"J/#psi(#mu#mu) - Setup B","lep"); leg1->Draw(); c1->cd(2); TLegend *leg2=new TLegend(0.16,0.48,0.6,0.68); leg2->AddEntry(geffb[0],"J/#psi(ee) - Setup A","lep"); leg2->AddEntry(geffb[1],"J/#psi(ee) - Setup B","lep"); leg2->AddEntry(geffb[2],"J/#psi(#mu#mu) - Setup A","lep"); leg2->AddEntry(geffb[3],"J/#psi(#mu#mu) - Setup B","lep"); leg2->Draw(); c1->cd(3); TLegend *leg3=new TLegend(0.5,0.72,0.94,0.92); leg3->AddEntry(gston[0],"J/#psi(ee) - Setup A","lep"); leg3->AddEntry(gston[1],"J/#psi(ee) - Setup B","lep"); leg3->AddEntry(gston[2],"J/#psi(#mu#mu) - Setup A","lep"); leg3->AddEntry(gston[3],"J/#psi(#mu#mu) - Setup B","lep"); leg3->Draw(); c1->cd(4); TLegend *leg4=new TLegend(0.16,0.18,0.6,0.38); leg4->AddEntry(gsign[0],"J/#psi(ee) - Setup A","lep"); leg4->AddEntry(gsign[1],"J/#psi(ee) - Setup B","lep"); leg4->AddEntry(gsign[2],"J/#psi(#mu#mu) - Setup A","lep"); leg4->AddEntry(gsign[3],"J/#psi(#mu#mu) - Setup B","lep"); leg4->Draw(); c1->SaveAs("fig/comb_J.gif"); }