]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/qa/DrawBeforeAfter.C
Fixes for pA indenfication of events
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / qa / DrawBeforeAfter.C
CommitLineData
2dbde04b 1/**
2 * @file DrawBeforeAfter.C
3 * @author Christian Holm Christensen <cholm@nbi.dk>
4 * @date Thu Nov 17 11:18:18 2011
5 *
6 * @brief Script to draw the before/after merging energy loss spectra
7 *
8 * @deprecated Use QATrender instead
bd6f5206 9 * @ingroup pwglf_forward_scripts_qa
2dbde04b 10 */
d015ecfe 11#ifndef __CINT__
12# include <TH1.h>
13# include <TH2.h>
14# include <TList.h>
15# include <TFile.h>
16# include <TString.h>
17# include <TError.h>
18# include <TPad.h>
19# include <TCanvas.h>
20# include <TLine.h>
21# include <TLatex.h>
22# include <TStyle.h>
23#else
24class TList;
25#endif
26
56199f2b 27/**
28 * Draw the before/after merging image for a single ring
29 *
2dbde04b 30 * @param p Parent list
31 * @param d Detector
32 * @param r Ring
56199f2b 33 *
2dbde04b 34 * @deprecated Use QATrender instead
bd6f5206 35 * @ingroup pwglf_forward_scripts_qa
56199f2b 36 */
b5c9a732 37void
38DrawRingBeforeAfter(TList* p, UShort_t d, Char_t r)
39{
40 if (!p) return;
41
42 TList* ring = static_cast<TList*>(p->FindObject(Form("FMD%d%c",d,r)));
43 if (!ring) {
44 Error("DrawBeforeAfter", "List FMD%d%c not found in %s",d,r,p->GetName());
45 return;
46 }
47
48 TH2* corr = static_cast<TH2D*>(ring->FindObject("beforeAfter"));
49 if (!corr) {
50 Error("DrawRingBeforeAfter", "Histogram esdEloss not found in FMD%d%c",
51 d, r);
52 return;
53 }
54 // gPad->SetLogz();
55 gPad->SetFillColor(0);
56 corr->SetTitle(Form("FMD%d%c",d,r));
57 corr->Draw("colz");
58
59 corr->GetXaxis()->SetRangeUser(-.5, 4);
60 corr->GetYaxis()->SetRangeUser(-.5, 4);
61 gPad->cd();
62}
63
64
56199f2b 65/**
66 * Draw the before/after sharing image for all rings
67 *
2dbde04b 68 * @param filename Input file name
69 * @param folder Input folder in file
56199f2b 70 *
2dbde04b 71 * @deprecated Use QATrender instead
bd6f5206 72 * @ingroup pwglf_forward_scripts_qa
56199f2b 73 */
b5c9a732 74void
d015ecfe 75DrawBeforeAfter(const char* filename="forward.root",
76 const char* folder="ForwardResults")
b5c9a732 77{
78 gStyle->SetPalette(1);
79 gStyle->SetOptFit(0);
80 gStyle->SetOptStat(0);
81 gStyle->SetOptTitle(1);
82 gStyle->SetTitleW(.4);
83 gStyle->SetTitleH(.1);
84 gStyle->SetTitleColor(0);
85 gStyle->SetTitleStyle(0);
86 gStyle->SetTitleBorderSize(0);
87 gStyle->SetTitleX(.6);
88
89 TFile* file = TFile::Open(filename, "READ");
90 if (!file) {
91 Error("DrawBeforeAfter", "failed to open %s", filename);
92 return;
93 }
94
d015ecfe 95 TList* forward = static_cast<TList*>(file->Get(folder));
b5c9a732 96 if (!forward) {
d015ecfe 97 Error("DrawBeforeAfter", "List %s not found in %s", folder, filename);
b5c9a732 98 return;
99 }
100
101 TList* sf = static_cast<TList*>(forward->FindObject("fmdSharingFilter"));
102 if (!sf) {
103 Error("DrawBeforeAfter", "List fmdSharingFilter not found in Forward");
104 return;
105 }
106
107 TCanvas* c = new TCanvas("beforeAfter",
108 "Signals before and after merging", 900, 700);
109 c->SetFillColor(0);
110 c->SetBorderSize(0);
111 c->SetLeftMargin(0.15);
112 c->SetRightMargin(0.02);
113 c->SetTopMargin(0.02);
114 c->Divide(3, 2, 0, 0);
115
116 c->cd(1); DrawRingBeforeAfter(sf, 1, 'I');
117 c->cd(2); DrawRingBeforeAfter(sf, 2, 'I');
118 c->cd(5); DrawRingBeforeAfter(sf, 2, 'O');
119 c->cd(3); DrawRingBeforeAfter(sf, 3, 'I');
120 c->cd(6); DrawRingBeforeAfter(sf, 3, 'O');
121 TVirtualPad* p = c->cd(4);
122 // p->SetTopMargin(0.05);
123 p->SetRightMargin(0.15);
124 p->SetFillColor(0);
125 TH2D* highCuts = static_cast<TH2D*>(sf->FindObject("highCuts"));
126 if (highCuts) highCuts->Draw("colz");
127 c->cd();
d015ecfe 128 c->SaveAs("beforeAfter.png");
b5c9a732 129}
56199f2b 130//
131// EOF
132//