]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FORWARD/analysis2/scripts/DrawBeforeAfter.C
New scripts, and script updates
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / scripts / DrawBeforeAfter.C
1 void
2 DrawRingBeforeAfter(TList* p, UShort_t d, Char_t r)
3 {
4   if (!p) return;
5
6   TList* ring = static_cast<TList*>(p->FindObject(Form("FMD%d%c",d,r)));
7   if (!ring) { 
8     Error("DrawBeforeAfter", "List FMD%d%c not found in %s",d,r,p->GetName());
9     return;
10   }
11   
12   TH2* corr = static_cast<TH2D*>(ring->FindObject("beforeAfter"));
13   if (!corr) { 
14     Error("DrawRingBeforeAfter", "Histogram esdEloss not found in FMD%d%c",
15           d, r);
16     return;
17   }
18   // gPad->SetLogz();
19   gPad->SetFillColor(0);
20   corr->SetTitle(Form("FMD%d%c",d,r));
21   corr->Draw("colz");
22
23   corr->GetXaxis()->SetRangeUser(-.5, 4);
24   corr->GetYaxis()->SetRangeUser(-.5, 4);
25   gPad->cd();
26 }
27
28
29 void
30 DrawBeforeAfter(const char* filename="forward.root")
31 {
32   gStyle->SetPalette(1);
33   gStyle->SetOptFit(0);
34   gStyle->SetOptStat(0);
35   gStyle->SetOptTitle(1);
36   gStyle->SetTitleW(.4);
37   gStyle->SetTitleH(.1);
38   gStyle->SetTitleColor(0);
39   gStyle->SetTitleStyle(0);
40   gStyle->SetTitleBorderSize(0);
41   gStyle->SetTitleX(.6);
42   
43   TFile* file = TFile::Open(filename, "READ");
44   if (!file) { 
45     Error("DrawBeforeAfter", "failed to open %s", filename);
46     return;
47   }
48
49   TList* forward = static_cast<TList*>(file->Get("Forward"));
50   if (!forward) { 
51     Error("DrawBeforeAfter", "List Forward not found in %s", filename);
52     return;
53   }
54
55   TList* sf = static_cast<TList*>(forward->FindObject("fmdSharingFilter"));
56   if (!sf) { 
57     Error("DrawBeforeAfter", "List fmdSharingFilter not found in Forward");
58     return;
59   }
60   
61   TCanvas* c = new TCanvas("beforeAfter", 
62                            "Signals before and after merging", 900, 700);
63   c->SetFillColor(0);
64   c->SetBorderSize(0);
65   c->SetLeftMargin(0.15);
66   c->SetRightMargin(0.02);
67   c->SetTopMargin(0.02);
68   c->Divide(3, 2, 0, 0);
69   
70   c->cd(1); DrawRingBeforeAfter(sf, 1, 'I');
71   c->cd(2); DrawRingBeforeAfter(sf, 2, 'I');
72   c->cd(5); DrawRingBeforeAfter(sf, 2, 'O');
73   c->cd(3); DrawRingBeforeAfter(sf, 3, 'I');
74   c->cd(6); DrawRingBeforeAfter(sf, 3, 'O');
75   TVirtualPad* p = c->cd(4);
76   // p->SetTopMargin(0.05);
77   p->SetRightMargin(0.15);
78   p->SetFillColor(0);
79   TH2D* highCuts = static_cast<TH2D*>(sf->FindObject("highCuts"));
80   if (highCuts) highCuts->Draw("colz");
81   c->cd();
82   
83 }
84
85   
86   
87