// -------------------------------------------------------------------- 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 combinePlotsEtac(TString fname="ana_etac.root") { gStyle->SetOptStat(0); gStyle->SetOptFit(0); TFile *f=new TFile(fname); TString plotnam[2]={"etac1_A","etac1_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[2]; TGraphErrors *geffb[2]; TGraphErrors *gston[2]; TGraphErrors *gsign[2]; TCanvas *c1=new TCanvas("c1","c1",10,10,1300,1000); c1->Divide(2,2,0.0001,0.0001); int colors[2] = {kBlue,kCyan-2}; //int colors[2] = {2,kRed-7}; TH1F *h[4]={0}; double hmaxy[4] = {20., 1e-5, 0.25, 7.}; for (int i=0;i<2;++i) { c1->cd(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==0) 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(1e-8); if (i==0) 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==0) 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==0) h[3]->Draw(); gsign[i]->Draw("P same"); } c1->cd(1); TLegend *leg1=new TLegend(0.6,0.8,0.94,0.92); leg1->AddEntry(geffs[0],"#eta_{c1}#eta - Setup A","lep"); leg1->AddEntry(geffs[1],"#eta_{c1}#eta - Setup B","lep"); leg1->Draw(); c1->cd(2); TLegend *leg2=new TLegend(0.6,0.8,0.94,0.92); leg2->AddEntry(geffb[0],"#eta_{c1}#eta - Setup A","lep"); leg2->AddEntry(geffb[1],"#eta_{c1}#eta - Setup B","lep"); leg2->Draw(); c1->cd(3); TLegend *leg3=new TLegend(0.6,0.8,0.94,0.92); leg3->AddEntry(gston[0],"#eta_{c1}#eta - Setup A","lep"); leg3->AddEntry(gston[1],"#eta_{c1}#eta - Setup B","lep"); leg3->Draw(); c1->cd(4); TLegend *leg4=new TLegend(0.6,0.8,0.94,0.92); leg4->AddEntry(gsign[0],"#eta_{c1}#eta - Setup A","lep"); leg4->AddEntry(gsign[1],"#eta_{c1}#eta - Setup B","lep"); leg4->Draw(); c1->SaveAs("fig/comb_etac.gif"); }