]>
Commit | Line | Data |
---|---|---|
d015ecfe | 1 | #ifndef __CINT__ |
2 | # include <TH1.h> | |
3 | # include <TH2.h> | |
4 | # include <TList.h> | |
5 | # include <TFile.h> | |
6 | # include <TString.h> | |
7 | # include <TError.h> | |
8 | # include <TPad.h> | |
9 | # include <TCanvas.h> | |
10 | # include <TLine.h> | |
11 | # include <TLatex.h> | |
12 | # include <TStyle.h> | |
13 | # include <TLegend.h> | |
14 | #else | |
15 | class TList; | |
16 | #endif | |
17 | ||
18 | /** | |
19 | * Draw the before/after merging image for a single ring | |
20 | * | |
21 | * @param p | |
22 | * @param d | |
23 | * @param r | |
24 | * | |
25 | * @ingroup pwg2_forward_scripts_qa | |
26 | */ | |
27 | void | |
28 | DrawRing123(TList* p, UShort_t d, Char_t r) | |
29 | { | |
30 | if (!p) return; | |
31 | ||
32 | TList* ring = static_cast<TList*>(p->FindObject(Form("FMD%d%c",d,r))); | |
33 | if (!ring) { | |
34 | Error("Draw123", "List FMD%d%c not found in %s",d,r,p->GetName()); | |
35 | return; | |
36 | } | |
37 | ||
38 | TH1* one = static_cast<TH1*>(ring->FindObject("singleEloss")); | |
39 | TH1* two = static_cast<TH1*>(ring->FindObject("doubleEloss")); | |
40 | TH1* three = static_cast<TH1*>(ring->FindObject("tripleEloss")); | |
41 | if (!one || !two || !three) { | |
42 | Error("DrawRing123", "Histograms of Eloss not found in FMD%d%c", d, r); | |
43 | return; | |
44 | } | |
45 | one->SetStats(0); | |
46 | one->SetTitle(Form("FMD%d%c", d, r)); | |
47 | one->GetXaxis()->SetRangeUser(0, 8); | |
48 | ||
49 | gPad->SetLogy(); | |
50 | gPad->SetFillColor(0); | |
51 | ||
52 | one->Draw(); | |
53 | if (two) two->Draw("same"); | |
54 | if (three) three->Draw("same"); | |
55 | ||
56 | TLegend* l = new TLegend(.6, .6, .95, 1); | |
57 | l->SetFillColor(0); | |
58 | l->SetBorderSize(0); | |
59 | l->AddEntry(one); | |
60 | if (two) l->AddEntry(two); | |
61 | if (three) l->AddEntry(three); | |
62 | l->Draw(); | |
63 | ||
64 | gPad->cd(); | |
65 | } | |
66 | ||
67 | ||
68 | /** | |
69 | * Draw the before/after sharing image for all rings | |
70 | * | |
71 | * @param filename | |
72 | * | |
73 | * @ingroup pwg2_forward_scripts_qa | |
74 | */ | |
75 | void | |
76 | Draw123(const char* filename="forward.root", | |
77 | const char* folder="ForwardResults") | |
78 | { | |
79 | gStyle->SetPalette(1); | |
80 | gStyle->SetOptFit(0); | |
81 | gStyle->SetOptStat(0); | |
82 | gStyle->SetOptTitle(1); | |
83 | gStyle->SetTitleW(.4); | |
84 | gStyle->SetTitleH(.1); | |
85 | gStyle->SetTitleColor(0); | |
86 | gStyle->SetTitleStyle(0); | |
87 | gStyle->SetTitleBorderSize(0); | |
88 | gStyle->SetTitleX(.6); | |
89 | ||
90 | TFile* file = TFile::Open(filename, "READ"); | |
91 | if (!file) { | |
92 | Error("Draw123", "failed to open %s", filename); | |
93 | return; | |
94 | } | |
95 | ||
96 | TList* forward = static_cast<TList*>(file->Get(folder)); | |
97 | if (!forward) { | |
98 | Error("Draw123", "List %s not found in %s", folder, filename); | |
99 | return; | |
100 | } | |
101 | ||
102 | TList* sf = static_cast<TList*>(forward->FindObject("fmdSharingFilter")); | |
103 | if (!sf) { | |
104 | Error("Draw123", "List fmdSharingFilter not found in Forward"); | |
105 | return; | |
106 | } | |
107 | ||
108 | TCanvas* c = new TCanvas("123", | |
109 | "singles, doubles, and tripples", 900, 700); | |
110 | c->SetFillColor(0); | |
111 | c->SetBorderSize(0); | |
112 | c->SetLeftMargin(0.15); | |
113 | c->SetRightMargin(0.02); | |
114 | c->SetTopMargin(0.02); | |
115 | c->Divide(3, 2, 0, 0); | |
116 | ||
117 | c->cd(1); DrawRing123(sf, 1, 'I'); | |
118 | c->cd(2); DrawRing123(sf, 2, 'I'); | |
119 | c->cd(5); DrawRing123(sf, 2, 'O'); | |
120 | c->cd(3); DrawRing123(sf, 3, 'I'); | |
121 | c->cd(6); DrawRing123(sf, 3, 'O'); | |
122 | TVirtualPad* p = c->cd(4); | |
123 | // p->SetTopMargin(0.05); | |
124 | p->SetRightMargin(0.15); | |
125 | p->SetFillColor(0); | |
126 | TH2D* highCuts = static_cast<TH2D*>(sf->FindObject("highCuts")); | |
127 | if (highCuts) highCuts->Draw("colz"); | |
128 | c->cd(); | |
129 | c->SaveAs("123.png"); | |
130 | } | |
131 | ||
132 | ||
133 | ||
134 | ||
135 | // | |
136 | // EOF | |
137 | // |