]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG0/dNdEta/drawVertexRecEff.C
cassert included
[u/mrichter/AliRoot.git] / PWG0 / dNdEta / drawVertexRecEff.C
1 /* $Id$ */
2
3 // draws the result of AlidNdEtaVertexRecEffSelector
4
5 void drawVertexRecEff()
6 {
7   TFile* fout = TFile::Open("vertexRecEff.root");
8
9   TH1F* dNGen = dynamic_cast<TH1F*> fout->Get("dNGen");
10   TH1F* dNRec = dynamic_cast<TH1F*> fout->Get("dNRec");
11
12   TH1F* vtxGen = dynamic_cast<TH1F*> fout->Get("VtxGen");
13   TH1F* vtxRec = dynamic_cast<TH1F*> fout->Get("VtxRec");
14
15   // calculate ratios
16   TH1F* dNRatiodN = dynamic_cast<TH1F*> (dNRec->Clone("dNRatiodN"));
17   dNRatiodN->SetTitle("Ratio");
18   dNRatiodN->Divide(dNGen);
19
20   //vtxGen->Rebin(4);
21   //vtxRec->Rebin(4);
22
23   // calculate correction ratio number
24   Float_t sumGen = 0;
25   Float_t sumRec = 0;
26   for (Int_t i=1; i<=dNGen->GetNbinsX(); ++i)
27   {
28     sumGen += dNGen->GetBinCenter(i) * dNGen->GetBinContent(i);
29     sumRec += dNRec->GetBinCenter(i) * dNRec->GetBinContent(i);
30   }
31   Float_t ratio = sumRec / dNRec->Integral(1, dNGen->GetNbinsX()) * dNGen->Integral(1, dNGen->GetNbinsX()) / sumGen;
32
33   cout << "Ratio: " << ratio << endl;
34
35   TH1F* dNRatioVtx = dynamic_cast<TH1F*> (vtxRec->Clone("dNRatioVtx"));
36   dNRatioVtx->SetTitle("Ratio");
37   dNRatioVtx->Divide(vtxGen);
38
39   TCanvas* canvas = new TCanvas("dN", "dN", 1000, 1000);
40   canvas->Divide(2, 2);
41
42   canvas->cd(1);
43   dNGen->Draw();
44   dNRec->SetLineColor(kRed);
45   dNRec->Draw("SAME");
46
47   canvas->cd(2);
48   dNRatiodN->Draw();
49
50   canvas->cd(3);
51   vtxGen->Draw();
52   vtxRec->SetLineColor(kRed);
53   vtxRec->Draw("SAME");
54
55   canvas->cd(4);
56   dNRatioVtx->Draw();
57 }