]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/qa/DrawBeforeAfter.C
Fixes for pA indenfication of events
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / qa / DrawBeforeAfter.C
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 
9  * @ingroup pwglf_forward_scripts_qa
10  */
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
24 class TList;
25 #endif
26
27 /** 
28  * Draw the before/after merging image for a single ring
29  * 
30  * @param p  Parent list
31  * @param d  Detector 
32  * @param r  Ring 
33  *
34  * @deprecated Use QATrender instead 
35  * @ingroup pwglf_forward_scripts_qa
36  */
37 void
38 DrawRingBeforeAfter(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
65 /** 
66  * Draw the before/after sharing image for all rings 
67  * 
68  * @param filename Input file name  
69  * @param folder   Input folder in file 
70  *
71  * @deprecated Use QATrender instead 
72  * @ingroup pwglf_forward_scripts_qa
73  */
74 void
75 DrawBeforeAfter(const char* filename="forward.root", 
76                 const char* folder="ForwardResults")
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
95   TList* forward = static_cast<TList*>(file->Get(folder));
96   if (!forward) { 
97     Error("DrawBeforeAfter", "List %s not found in %s", folder, filename);
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();
128   c->SaveAs("beforeAfter.png");
129 }
130 //
131 // EOF
132 //