FairRoot/PandaRoot
Functions
combinePlotsJ_slc.C File Reference

Go to the source code of this file.

Functions

void confgraph (TGraph *g, TString tit, int col=1, int marker=20, double shift=0.)
 
TH1F * createHistoGraph (TGraph *g, TString tit="", double yymax=0, double xmin=0, double xmax=0)
 
void combinePlotsJ_slc (TString fname="anaJ_slc.root")
 

Function Documentation

void combinePlotsJ_slc ( TString  fname = "anaJ_slc.root")

Definition at line 67 of file combinePlotsJ_slc.C.

References c1, confgraph(), createHistoGraph(), f, h, i, and TString.

68 {
69  gStyle->SetOptStat(0);
70  gStyle->SetOptFit(0);
71 
72  TFile *f=new TFile(fname);
73 
74  TString plotnam[4]={"Jee_A","Jee_B","Jmm_A","Jmm_B"};
75  TString lab[4] = { "signal efficiency;EMC missing (#phi) [%];signal efficiency [%]", "background efficiency;EMC missing (#phi) [%];background efficiency [%]", "signal to noise;EMC missing (#phi) [%];S/B", "significance;EMC missing (#phi) [%];significance [#sigma]"};
76 
77  TGraphErrors *geffs[4];
78  TGraphErrors *geffb[4];
79  TGraphErrors *gston[4];
80  TGraphErrors *gsign[4];
81 
82  TCanvas *c1=new TCanvas("c1","c1",10,10,1300,1000);
83  c1->Divide(2,2,0.0001,0.0001);
84 
85  int colors[4] = {kBlue,kCyan-2,2,kRed-7};
86 
87  TH1F *h[4]={0};
88  double hmaxy[4] = {14., 3e-4, 2.5, 6.};
89 
90  int imin = 0, imax=4;
91  for (int i=imin;i<imax;++i)
92  {
93  c1->cd(1);
94  geffs[i]=(TGraphErrors*)f->Get(Form("effs_%s",plotnam[i].Data()));
95  confgraph(geffs[i],"",colors[i],20+(i%2)*3,i);
96  if (h[0]==0) h[0]=createHistoGraph(geffs[i],lab[0], hmaxy[0]);
97  if (i==imin) h[0]->Draw();
98  geffs[i]->Draw("P same");
99 
100  c1->cd(2); gPad->SetLogy();
101  geffb[i]=(TGraphErrors*)f->Get(Form("effb_%s",plotnam[i].Data()));
102  confgraph(geffb[i],"",colors[i],20+(i%2)*3,i);
103  if (h[1]==0) h[1]=createHistoGraph(geffb[i],lab[1], hmaxy[1]);
104  h[1]->SetMinimum(0.5e-8);
105  h[1]->SetMaximum(0.0002);
106  if (i==imin) h[1]->Draw();
107  geffb[i]->Draw("P same");
108 
109  c1->cd(3);
110  gston[i]=(TGraphErrors*)f->Get(Form("sn_%s",plotnam[i].Data()));
111  confgraph(gston[i],"",colors[i],20+(i%2)*3,i);
112  if (h[2]==0) h[2]=createHistoGraph(gston[i],lab[2], hmaxy[2]);
113  if (i==imin) h[2]->Draw();
114  gston[i]->Draw("P same");
115 
116  c1->cd(4);
117  gsign[i]=(TGraphErrors*)f->Get(Form("sign_%s",plotnam[i].Data()));
118  confgraph(gsign[i],"",colors[i],20+(i%2)*3,i);
119  if (h[3]==0) h[3]=createHistoGraph(gsign[i],lab[3], hmaxy[3]);
120  if (i==imin) h[3]->Draw();
121  gsign[i]->Draw("P same");
122  }
123 
124  c1->cd(1);
125  TLegend *leg1=new TLegend(0.16,0.18,0.6,0.38);
126  leg1->AddEntry(geffs[0],"J/#psi(ee) - Setup A","lep");
127  leg1->AddEntry(geffs[1],"J/#psi(ee) - Setup B","lep");
128  leg1->AddEntry(geffs[2],"J/#psi(#mu#mu) - Setup A","lep");
129  leg1->AddEntry(geffs[3],"J/#psi(#mu#mu) - Setup B","lep");
130  leg1->Draw();
131 
132  c1->cd(2);
133  TLegend *leg2=new TLegend(0.16,0.48,0.6,0.68);
134  leg2->AddEntry(geffb[0],"J/#psi(ee) - Setup A","lep");
135  leg2->AddEntry(geffb[1],"J/#psi(ee) - Setup B","lep");
136  leg2->AddEntry(geffb[2],"J/#psi(#mu#mu) - Setup A","lep");
137  leg2->AddEntry(geffb[3],"J/#psi(#mu#mu) - Setup B","lep");
138  leg2->Draw();
139 
140  c1->cd(3);
141  TLegend *leg3=new TLegend(0.5,0.72,0.94,0.92);
142  leg3->AddEntry(gston[0],"J/#psi(ee) - Setup A","lep");
143  leg3->AddEntry(gston[1],"J/#psi(ee) - Setup B","lep");
144  leg3->AddEntry(gston[2],"J/#psi(#mu#mu) - Setup A","lep");
145  leg3->AddEntry(gston[3],"J/#psi(#mu#mu) - Setup B","lep");
146  leg3->Draw();
147 
148  c1->cd(4);
149  TLegend *leg4=new TLegend(0.16,0.18,0.6,0.38);
150  leg4->AddEntry(gsign[0],"J/#psi(ee) - Setup A","lep");
151  leg4->AddEntry(gsign[1],"J/#psi(ee) - Setup B","lep");
152  leg4->AddEntry(gsign[2],"J/#psi(#mu#mu) - Setup A","lep");
153  leg4->AddEntry(gsign[3],"J/#psi(#mu#mu) - Setup B","lep");
154  leg4->Draw();
155 
156 
157  c1->SaveAs("fig/comb_J_slc.gif");
158 }
Int_t i
Definition: run_full.C:25
TH1F * createHistoGraph(TGraph *g, TString tit="", double xmin=0, double xmax=0)
Definition: analyse_etac1.C:60
void confgraph(TGraph *g, TString tit, int col=1, int marker=20)
Definition: analyse_etac1.C:47
TFile * f
Definition: bump_analys.C:12
c1
Definition: plot_dirc.C:35
void confgraph ( TGraph *  g,
TString  tit,
int  col = 1,
int  marker = 20,
double  shift = 0. 
)

Definition at line 4 of file combinePlotsJ_slc.C.

References col, f1, i, x, and y.

5 {
6  if (tit!="") g->GetHistogram()->SetTitle(tit);
7  g->GetHistogram()->SetMinimum(0);
8  g->SetLineColor(col);
9  g->SetMarkerColor(col);
10  g->SetMarkerStyle(marker);
11  g->SetMarkerSize(1.5);
12  g->SetLineWidth(2);
13 
14  TF1 *f1 = (TF1*)g->GetListOfFunctions()->At(0);//("f1");
15 
16  if (f1)
17  {
18  f1->SetLineColor(col);
19  f1->SetLineStyle(2);
20  }
21 
22  for (int i=0;i<g->GetN();++i)
23  {
24  double x,y;
25  g->GetPoint(i,x,y);
26  g->SetPoint(i,x+shift,y);
27 
28  // cout <<x<<" "<<y<<endl;
29  }
30 }
Int_t i
Definition: run_full.C:25
TF1 * f1
Definition: reco_analys2.C:50
int col
Definition: anaLmdDigi.C:67
TFile * g
Double_t x
Double_t y
TH1F* createHistoGraph ( TGraph *  g,
TString  tit = "",
double  yymax = 0,
double  xmin = 0,
double  xmax = 0 
)

Definition at line 35 of file combinePlotsJ_slc.C.

References cnt, h, xmax, and xmin.

36 {
37  static int cnt=0;
38  if (tit=="") tit=g->GetTitle();
39 
40  double ymax = TMath::MaxElement(g->GetN(), g->GetY());
41  double dymax = g->GetErrorY(TMath::LocMax(g->GetN(), g->GetEY()));
42 
43  if (xmin>=xmax)
44  {
45  xmin = TMath::MinElement(g->GetN(), g->GetX());
46  xmax = TMath::MaxElement(g->GetN(), g->GetX());
47  }
48  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());
49 
50  h->GetXaxis()->SetLabelSize(0.05);
51  h->GetXaxis()->SetTitleSize(0.05);
52  h->GetYaxis()->SetLabelSize(0.05);
53  h->GetYaxis()->SetTitleSize(0.05);
54  h->GetYaxis()->SetTitleOffset(1.4);
55 
56  if (yymax==0) h->SetMaximum((ymax+dymax)*1.05);
57  else h->SetMaximum(yymax);
58  h->SetMinimum(0);
59 
60  h->SetStats(0);
61 
62  return h;
63 }
Double_t xmax
TFile * g
Int_t cnt
Definition: hist-t7.C:106
Double_t xmin