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