]>
Commit | Line | Data |
---|---|---|
b5c9a732 | 1 | void |
2 | CompELossFits(const char* fname1, const char* fname2) | |
3 | { | |
4 | ||
5 | TFile* file1 = TFile::Open(fname1, "READ"); | |
6 | if (!file1) { | |
7 | Error("CompELossFits", "Couldn't open %s", fname1); | |
8 | return; | |
9 | } | |
10 | ||
11 | TFile* file2 = TFile::Open(fname2, "READ"); | |
12 | if (!file2) { | |
13 | Error("CompELossFits", "Couldn't open %s", fname2); | |
14 | return; | |
15 | } | |
16 | ||
17 | AliFMDCorrELossFit* fit1 = | |
18 | static_cast<AliFMDCorrELossFit*>(file1->Get("elossfits")); | |
19 | if (!fit1) { | |
20 | Error("CompELossFits", "Couldn't get elossfits from %s", fname1); | |
21 | return; | |
22 | } | |
23 | ||
24 | AliFMDCorrELossFit* fit2 = | |
25 | static_cast<AliFMDCorrELossFit*>(file2->Get("elossfits")); | |
26 | if (!fit2) { | |
27 | Error("CompELossFits", "Couldn't get elossfits from %s", fname2); | |
28 | return; | |
29 | } | |
30 | ||
31 | ||
32 | TList* stacks1 = fit1->GetStacks(true, false, 4); | |
33 | TList* stacks2 = fit2->GetStacks(true, false, 4); | |
34 | ||
35 | Int_t nStacks = stacks1->GetEntries(); | |
36 | ||
37 | TCanvas* c = new TCanvas("c", "c", 900, 1200); | |
38 | c->SetRightMargin(0.02); | |
39 | c->SetTopMargin(0.02); | |
40 | c->SetFillColor(0); | |
41 | c->SetBorderSize(0); | |
42 | c->SetBorderMode(0); | |
43 | ||
44 | c->cd(); | |
45 | TPad* top = new TPad("top", "Top", 0, .95, 1, 1, 0, 0, 0); | |
46 | top->Draw(); | |
47 | top->cd(); | |
48 | TLatex* l = new TLatex(.5,.5, Form("%s / %s", fname1, fname2)); | |
49 | l->SetTextSize(0.3); | |
50 | l->SetNDC(); | |
51 | l->SetTextAlign(22); | |
52 | l->Draw(); | |
53 | ||
54 | c->cd(); | |
55 | TPad* body = new TPad("body", "body", 0, 0, 1, .95, 0, 0, 0); | |
56 | body->Draw(); | |
57 | body->cd(); | |
58 | body->Divide(2, (nStacks+1)/2, 0, 0); | |
59 | ||
60 | Int_t nPad2 = nStacks; | |
61 | for (Int_t i = 0; i < nStacks; i++) { | |
62 | Int_t iPad = 1 + i/nPad2 + 2 * (i % nPad2); | |
63 | TVirtualPad* p = body->cd(i+1); | |
64 | p->SetLeftMargin(0.15); | |
65 | p->SetRightMargin(0.01); | |
66 | THStack* stack1 = static_cast<THStack*>(stacks1->At(i)); | |
67 | THStack* stack2 = static_cast<THStack*>(stacks2->At(i)); | |
68 | ||
69 | THStack* ratio = static_cast<THStack*>(stack1->Clone()); | |
70 | Int_t nHists = stack1->GetHists()->GetEntries(); | |
71 | for (Int_t j = 0; j < nHists; j++) { | |
72 | TH1* h1 = static_cast<TH1*>(stack1->GetHists()->At(j)); | |
73 | TH1* h2 = static_cast<TH1*>(stack2->GetHists()->At(j)); | |
74 | TH1* hr = static_cast<TH1*>(ratio->GetHists()->At(j)); | |
75 | hr->Divide(h1, h2); | |
76 | } | |
77 | ratio->Draw("nostack"); | |
78 | } | |
79 | } | |
80 | ||
81 | ||
82 | ||
83 | ||
84 | ||
85 | ||
86 |