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