Corrected spelling mistake Emperical -> Empirical
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / corrections / Empirical / DrawEmpirical.C
1 void 
2 DrawMG(TObject* o, TLegend* l, TLegend* cent=0)
3 {
4   TMultiGraph* mg = static_cast<TMultiGraph*>(o);
5   TIter next(mg->GetListOfGraphs());
6   TObject* g = 0;
7   Int_t i = 0;
8   while ((g = next())) {
9     g->Draw("p same");
10     TGraph* gg = static_cast<TGraph*>(g);
11     TLegendEntry* e = 0;
12     if (i == 0) {
13       e = l->AddEntry("dummy", mg->GetTitle(), "pl");
14       e->SetMarkerColor(kBlack);
15       e->SetMarkerStyle(gg->GetMarkerStyle());
16       e->SetFillStyle(0);
17     }
18     i++;
19     if (!cent) continue;
20     e = cent->AddEntry("dummy", g->GetTitle(), "f");
21     e->SetMarkerColor(kBlack);
22     e->SetFillStyle(1001);
23     e->SetFillColor(gg->GetMarkerColor());
24   }
25
26 }
27
28 void 
29 DrawEmpirical(const char* corrs="EmpiricalCorrection.root")
30 {
31   TFile* fcorr = TFile::Open(corrs, "READ");
32   if (!fcorr) return;
33
34   TObject* odfmdnom  = fcorr->Get("nominal");
35   TObject* odfmdsat  = fcorr->Get("fmdfmd/satellite");
36   TObject* odfullsat = fcorr->Get("fmdfull/satellite");
37   TObject* ocfmdfmd  = fcorr->Get("fmdfmd/average");
38   TObject* ocfmdfull = fcorr->Get("fmdfull/average");
39   TObject* oraverage = fcorr->Get("ratio");
40
41   Int_t size = 800;
42   TCanvas* c = new TCanvas("c", "c", size / TMath::Sqrt(2), size);
43   c->SetRightMargin(0.02);
44   c->SetTopMargin(0.02);
45   c->Divide(1, 3, 0, 0);
46
47   TVirtualPad* p =  c->cd(1);
48   p->SetRightMargin(0.01);
49   p->SetGridx();
50   TH1* h = new TH1D("h1", "h", 200, -4, 6);
51   h->SetStats(0);
52   h->SetXTitle("#eta");
53   h->SetYTitle("1/N_{ev} dN_{ch}/d#eta");
54   h->SetTitle("");
55   h->SetMinimum(1);
56   h->SetMaximum(2100);
57   h->DrawClone();
58   TLegend* l  = new TLegend(.2,  .05, .45, .25, "dN/d#eta");
59   TLegend* lc = new TLegend(.55, .05, .8,  .25, "Centrality");
60   DrawMG(odfmdnom, l);
61   DrawMG(odfmdsat, l);
62   DrawMG(odfullsat, l, lc);
63   l->SetFillStyle(0);
64   l->SetBorderSize(0);
65   l->Draw();
66   lc->SetFillStyle(0);
67   lc->SetBorderSize(0);
68   lc->Draw();
69
70   p = c->cd(2);
71   p->SetGridx();
72   p->SetRightMargin(0.01);
73   h->SetMinimum(.91);
74   h->SetMaximum(1.21);
75   h->SetYTitle("#LTdN_{ch}/d#eta|_{nominal}/dN_{ch}/d#eta|_{satelitte}#GT");
76   h->DrawClone();
77   // DrawMG(ocfmdfmd);
78   // DrawMG(ocfmdfull);
79   ocfmdfmd->Draw("p same");
80   ocfmdfull->Draw("p same");
81   l = new TLegend(.2, .05, .8, .2);
82   l->SetNColumns(2);
83   l->SetBorderSize(0);
84   l->SetFillStyle(0);
85   l->AddEntry(ocfmdfmd,  "FMD/FMD",  "pl");
86   l->AddEntry(ocfmdfull, "Full/FMD", "pl");
87   l->Draw();
88
89   p = c->cd(3);
90   p->SetGridx();
91   p->SetRightMargin(0.01);
92   h->SetMinimum(-.035);
93   h->SetMaximum(+.065);
94   h->SetYTitle("#frac{#LTFull/FMD#GT}{#LTFMD/FMD#GT}");
95   h->DrawClone();
96   oraverage->Draw("p same");
97   TGraph* g = static_cast<TGraph*>(oraverage);
98   g->SetMarkerStyle(20);
99   g->SetMarkerSize(1.1);
100   // DrawMG(orfmdfmd);
101   // DrawMG(orfmdfull);
102 }
103