reduced number of bins in histgrams (M. Verweij)
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / qa / DrawBeforeAfter.C
CommitLineData
56199f2b 1/**
2 * Draw the before/after merging image for a single ring
3 *
4 * @param p
5 * @param d
6 * @param r
7 *
8 * @ingroup pwg2_forward_analysis_scripts_qa
9 */
b5c9a732 10void
11DrawRingBeforeAfter(TList* p, UShort_t d, Char_t r)
12{
13 if (!p) return;
14
15 TList* ring = static_cast<TList*>(p->FindObject(Form("FMD%d%c",d,r)));
16 if (!ring) {
17 Error("DrawBeforeAfter", "List FMD%d%c not found in %s",d,r,p->GetName());
18 return;
19 }
20
21 TH2* corr = static_cast<TH2D*>(ring->FindObject("beforeAfter"));
22 if (!corr) {
23 Error("DrawRingBeforeAfter", "Histogram esdEloss not found in FMD%d%c",
24 d, r);
25 return;
26 }
27 // gPad->SetLogz();
28 gPad->SetFillColor(0);
29 corr->SetTitle(Form("FMD%d%c",d,r));
30 corr->Draw("colz");
31
32 corr->GetXaxis()->SetRangeUser(-.5, 4);
33 corr->GetYaxis()->SetRangeUser(-.5, 4);
34 gPad->cd();
35}
36
37
56199f2b 38/**
39 * Draw the before/after sharing image for all rings
40 *
41 * @param filename
42 *
43 * @ingroup pwg2_forward_analysis_scripts_qa
44 */
b5c9a732 45void
46DrawBeforeAfter(const char* filename="forward.root")
47{
48 gStyle->SetPalette(1);
49 gStyle->SetOptFit(0);
50 gStyle->SetOptStat(0);
51 gStyle->SetOptTitle(1);
52 gStyle->SetTitleW(.4);
53 gStyle->SetTitleH(.1);
54 gStyle->SetTitleColor(0);
55 gStyle->SetTitleStyle(0);
56 gStyle->SetTitleBorderSize(0);
57 gStyle->SetTitleX(.6);
58
59 TFile* file = TFile::Open(filename, "READ");
60 if (!file) {
61 Error("DrawBeforeAfter", "failed to open %s", filename);
62 return;
63 }
64
65 TList* forward = static_cast<TList*>(file->Get("Forward"));
66 if (!forward) {
67 Error("DrawBeforeAfter", "List Forward not found in %s", filename);
68 return;
69 }
70
71 TList* sf = static_cast<TList*>(forward->FindObject("fmdSharingFilter"));
72 if (!sf) {
73 Error("DrawBeforeAfter", "List fmdSharingFilter not found in Forward");
74 return;
75 }
76
77 TCanvas* c = new TCanvas("beforeAfter",
78 "Signals before and after merging", 900, 700);
79 c->SetFillColor(0);
80 c->SetBorderSize(0);
81 c->SetLeftMargin(0.15);
82 c->SetRightMargin(0.02);
83 c->SetTopMargin(0.02);
84 c->Divide(3, 2, 0, 0);
85
86 c->cd(1); DrawRingBeforeAfter(sf, 1, 'I');
87 c->cd(2); DrawRingBeforeAfter(sf, 2, 'I');
88 c->cd(5); DrawRingBeforeAfter(sf, 2, 'O');
89 c->cd(3); DrawRingBeforeAfter(sf, 3, 'I');
90 c->cd(6); DrawRingBeforeAfter(sf, 3, 'O');
91 TVirtualPad* p = c->cd(4);
92 // p->SetTopMargin(0.05);
93 p->SetRightMargin(0.15);
94 p->SetFillColor(0);
95 TH2D* highCuts = static_cast<TH2D*>(sf->FindObject("highCuts"));
96 if (highCuts) highCuts->Draw("colz");
97 c->cd();
98
99}
100
101
102
103
56199f2b 104//
105// EOF
106//