FairRoot/PandaRoot
Typedefs | Functions | Variables
evaltrig.C File Reference
#include <algorithm>
#include <map>
#include <utility>
#include <iostream>
#include "TFile.h"
#include "TTree.h"
#include "TString.h"
#include "TCanvas.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TROOT.h"
#include "TEventList.h"
#include "TDirectory.h"
#include "TRegexp.h"
#include "TStyle.h"
#include "TColor.h"
#include "TPaletteAxis.h"
#include "TLegend.h"
#include "TKey.h"
#include "TGraph.h"

Go to the source code of this file.

Typedefs

typedef std::map< double, TH1F * > Hmap
 
typedef std::map< double, TH1F * >
::iterator 
Hmapit
 

Functions

void config_graph (TGraph *g, int m=0, TString name="")
 
void init ()
 
int evaltrig (TString fname="crosstag_histos.root", bool makeplots=0)
 

Variables

const int nlines = 57
 
std::map< int, int > codeidx
 
TGraph geff [100]
 
int cnt [] = {0,0,0,0,0,0,0,0}
 
Hmap sigmap
 
Hmap sigimap
 
Hmap bgmap
 
int modes []
 
double BR []
 
int panel []
 
TString datatype [] = {"D^{0}","D^{*0}","D^{#pm}","D^{*#pm}","D_{s}^{(*)#pm}","c#bar{c}","bayrons/#phi","e/#mu/#gamma"}
 
double range [] = { 2.5, 3.5, 3.0, 3.5, 3.5, 2.0, 2.0, 2.0 }
 
int cols [10] = {1,2,4,6,kOrange+5,9,kGreen+2, kBlue+3,kCyan-2,kMagenta+2}
 

Typedef Documentation

typedef std::map<double, TH1F*> Hmap

Definition at line 26 of file evaltrig.C.

typedef std::map<double, TH1F*>::iterator Hmapit

Definition at line 27 of file evaltrig.C.

Function Documentation

void config_graph ( TGraph *  g,
int  m = 0,
TString  name = "" 
)

Definition at line 73 of file evaltrig.C.

References cols, m, and name.

Referenced by init().

74 {
75  int color=m;
76  if (m<10) color=cols[m];
77  g->SetMarkerStyle(m%15+20);
78  g->SetMarkerColor(1);
79  g->SetMarkerSize(1.2);
80  g->SetLineWidth(2);
81  g->SetLineColor(color);
82  g->SetMarkerColor(color);
83  g->SetName(name);
84 }
__m128 m
Definition: P4_F32vec4.h:28
TFile * g
int cols[10]
Definition: evaltrig.C:69
TString name
int evaltrig ( TString  fname = "crosstag_histos.root",
bool  makeplots = 0 
)

Definition at line 101 of file evaltrig.C.

References bgmap, c1, c2, c3, cnt, codeidx, datatype, f, g, geff, h, i, init(), leg, mode, name, next, nlines, obj, panel, range, sigimap, sigmap, and TString.

102 {
103  init();
104 
105  TFile *f = new TFile(fname,"READ");
106 
107  TKey *key;
108  TIter next(f->GetListOfKeys());
109 
110  TRegexp rsig("hsig[0-9][0-9][0-9]");
111  TRegexp rsigi("hsigi[0-9][0-9][0-9]");
112  TRegexp rbg("hbg[0-9][0-9][0-9]");
113 
114  while ( (key = (TKey*)next()) )
115  {
116  TObject *obj = key->ReadObj();
117  if (!obj->InheritsFrom("TH1F")) continue;
118 
119  TString name = obj->GetName();
120  TH1F* h = (TH1F*) obj;
121 
122  double en = TString(name(name.Length()-3,3)).Atof()/100.;
123 
124  if (name(rsig)!="") sigmap[en] = h;
125  else if (name(rsigi)!="") sigimap[en] = h;
126  else if (name(rbg)!="") bgmap[en] = h;
127  }
128 
129  int Nen = sigmap.size();
130  int i=1;
131 
132  TCanvas *c1 = new TCanvas("c1","histos",10,10,1800,500);
133  c1->Divide(Nen,2);
134 
135  for (Hmapit it=sigmap.begin(); it!=sigmap.end(); ++it)
136  {
137  TH1F *hs = it->second;
138  TH1F *hsi = sigimap[it->first];
139  TH1F *hb = bgmap[it->first];
140 
141  c1->cd(i); hs->Draw(); hsi->Draw("same");
142  c1->cd(i+Nen); hb->Draw();
143  i++;
144 
145  for (int j=1;j<hs->GetNbinsX()+1;++j)
146  {
147  TString modestr = hs->GetXaxis()->GetBinLabel(j);
148  if (modestr=="DPM")
149  {
150  TGraph &g = geff[nlines];
151  g.SetPoint(g.GetN(),it->first, hs->GetBinContent(j));
152  }
153  else
154  {
155  int mode = TString(modestr(1,3)).Atoi();
156  double eff = hs->GetBinContent(j);
157 
158  TGraph &g = geff[codeidx[mode]];
159  g.SetPoint(g.GetN(),it->first, eff);
160  }
161  }
162  }
163 
164  TCanvas *c2=new TCanvas("c2","sig eff",100,30,1600,800);
165  c2->Divide(4,2);
166 
167  TH1F *hdisp = new TH1F("hdisp","Signal Efficiencies",100,2.0,6.0);
168  hdisp->SetMaximum(100.);
169  hdisp->SetStats(0);
170  hdisp->SetXTitle("E_{cm} [GeV]");
171  hdisp->SetYTitle("total effciency [%]");
172  //hdisp->Draw();
173 
174  TLegend *leg[8];
175  for (i=0;i<8;++i)
176  {
177  c2->cd(i+1);
178  gPad->SetTopMargin(0.1);
179  gPad->SetGridx();
180  gPad->SetGridy();
181  hdisp->SetTitle("Signal efficiency: "+datatype[i]+" modes");
182  hdisp->GetXaxis()->SetRangeUser(range[i],6.0);
183  hdisp->DrawCopy();
184  if (i<7)
185  {
186  leg[i]=new TLegend(0.14,0.9-cnt[i]*0.07,0.4,0.9);
187  leg[i]->SetMargin(0.4);
188  }
189  else
190  {
191  leg[i]=new TLegend(0.14,0.12,0.9,0.45);
192  leg[i]->SetNColumns(3);
193  leg[i]->SetMargin(0.5);
194  }
195  }
196 
197  for (i=0;i<nlines;++i)
198  {
199  c2->cd(panel[i]+1);
200  geff[i].Draw("PL same");
201  leg[panel[i]]->AddEntry(geff[i].GetName(),geff[i].GetName(),"EPL");
202  }
203  for (i=0;i<8;++i)
204  {
205  c2->cd(i+1);
206  leg[i]->Draw("same");
207  }
208  c2->Update();
209 
210  TCanvas *c3=new TCanvas("c3","bg eff",150,40,700,500);
211  c3->cd();
212  gPad->SetGridx();
213  gPad->SetGridy();
214  hdisp->SetMaximum(0.5);
215  hdisp->SetMinimum(0.0);
216  hdisp->SetTitle("Background level");
217  hdisp->SetYTitle("acc. background [%]");
218  hdisp->DrawCopy();
219  geff[nlines].Draw("PL same");
220  TLine l;
221  l.SetLineColor(2);l.SetLineStyle(2);l.SetLineWidth(2);
222  l.DrawLine(2,0.1,6,0.1);
223 
224  if (makeplots)
225  {
226  c2->SaveAs("effsig_graphs.gif");
227  c2->SaveAs("effsig_graphs.pdf");
228 
229  c3->SaveAs("effbg_graphs.gif");
230  c3->SaveAs("effbg_graphs.pdf");
231  }
232  return 0;
233 }
double range[]
Definition: evaltrig.C:67
int panel[]
Definition: evaltrig.C:56
Int_t i
Definition: run_full.C:25
TFile * g
TString datatype[]
Definition: evaltrig.C:66
c2
Definition: plot_dirc.C:39
const int nlines
Definition: evaltrig.C:23
Int_t mode
Definition: autocutx.C:47
void init()
Definition: evaltrig.C:88
Hmap bgmap
Definition: evaltrig.C:33
TGraph geff[100]
Definition: evaltrig.C:30
Hmap sigmap
Definition: evaltrig.C:33
TFile * f
Definition: bump_analys.C:12
int cnt[]
Definition: evaltrig.C:31
c1
Definition: plot_dirc.C:35
TString name
c3
Definition: plot_dirc.C:50
std::map< int, int > codeidx
Definition: evaltrig.C:28
Hmap sigimap
Definition: evaltrig.C:33
std::map< double, TH1F * >::iterator Hmapit
Definition: evaltrig.C:27
static int next[96]
Definition: ranlxd.cxx:374
PndAnaPidSelector *& obj
void init ( )

Definition at line 88 of file evaltrig.C.

References cnt, codeidx, config_graph(), geff, i, modes, nlines, and panel.

Referenced by evaltrig().

89 {
90  for (int i=0;i<nlines;++i)
91  {
92  codeidx[modes[i]]=i;
93  config_graph(&geff[i],cnt[panel[i]]++,TString::Format("M%d",modes[i]));
94  }
95 
96  config_graph(&geff[nlines],0,"DPM");
97 }
void config_graph(TGraph *g, int m=0, TString name="")
Definition: evaltrig.C:73
int modes[]
Definition: evaltrig.C:36
int panel[]
Definition: evaltrig.C:56
Int_t i
Definition: run_full.C:25
const int nlines
Definition: evaltrig.C:23
TGraph geff[100]
Definition: evaltrig.C:30
int cnt[]
Definition: evaltrig.C:31
std::map< int, int > codeidx
Definition: evaltrig.C:28

Variable Documentation

Hmap bgmap

Definition at line 33 of file evaltrig.C.

Referenced by evaltrig().

double BR[]
Initial value:
= { 3.9, 13.9, 8.1, 2.0, 3.7,
2.4, 8.6, 5.0, 1.2, 2.3, 1.5, 5.3, 3.1, 0.76, 1.4,
9.4, 6.1, 4.8, 2.1,
2.6, 9.4, 5.5, 1.4, 2.5, 6.4, 4.1, 3.2, 1.4,
5.5, 5.6, 5.4, 5.5,
5.9, 5.9, 1.2, 1.7, 6e-5, 3.5, 1.9, 1.8, 1.7,
63.9, 51.4, 5.0, 3.4, 1.7,
48.9,
100., 100., 100., 100., 100., 100., 100., 100., 100., 100.}

Definition at line 46 of file evaltrig.C.

int cnt[] = {0,0,0,0,0,0,0,0}

Definition at line 31 of file evaltrig.C.

Referenced by evaltrig(), and init().

std::map<int,int> codeidx

Definition at line 28 of file evaltrig.C.

Referenced by evaltrig(), and init().

int cols[10] = {1,2,4,6,kOrange+5,9,kGreen+2, kBlue+3,kCyan-2,kMagenta+2}
TString datatype[] = {"D^{0}","D^{*0}","D^{#pm}","D^{*#pm}","D_{s}^{(*)#pm}","c#bar{c}","bayrons/#phi","e/#mu/#gamma"}

Definition at line 66 of file evaltrig.C.

Referenced by evaltrig().

TGraph geff[100]

Definition at line 30 of file evaltrig.C.

Referenced by evaltrig(), and init().

int modes[]
Initial value:
= { 100, 101, 102, 103, 104,
110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
120, 121, 122, 123,
130, 131, 132, 133, 134, 135, 136, 137, 138,
140, 141, 150, 151,
200, 201, 220, 221, 222, 223, 224, 240, 241,
400, 410, 420, 421, 422,
500,
600, 601, 602, 620, 621, 622, 640, 641, 642, 660}

Definition at line 36 of file evaltrig.C.

Referenced by init().

const int nlines = 57

Definition at line 23 of file evaltrig.C.

Referenced by evaltrig(), and init().

int panel[]
Initial value:
= { 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3, 3, 3,
4, 4, 4, 4,
5, 5, 5, 5, 5, 5, 5, 5, 5,
6, 6, 6, 6, 6,
6,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7}

Definition at line 56 of file evaltrig.C.

Referenced by evaltrig(), and init().

double range[] = { 2.5, 3.5, 3.0, 3.5, 3.5, 2.0, 2.0, 2.0 }

Definition at line 67 of file evaltrig.C.

Referenced by anaclust(), DrawNice2DHisto(), evaltrig(), GaussFitPlot(), LineFitPlot(), and PullFitPlot().

Hmap sigimap

Definition at line 33 of file evaltrig.C.

Referenced by evaltrig().

Hmap sigmap

Definition at line 33 of file evaltrig.C.

Referenced by evaltrig().