]>
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 | #else | |
14 | class TList; | |
15 | #endif | |
16 | ||
56199f2b | 17 | /** |
18 | * Draw the before/after merging image for a single ring | |
19 | * | |
20 | * @param p | |
21 | * @param d | |
22 | * @param r | |
23 | * | |
f0ef1e71 | 24 | * @ingroup pwg2_forward_scripts_qa |
56199f2b | 25 | */ |
b5c9a732 | 26 | void |
27 | DrawRingBeforeAfter(TList* p, UShort_t d, Char_t r) | |
28 | { | |
29 | if (!p) return; | |
30 | ||
31 | TList* ring = static_cast<TList*>(p->FindObject(Form("FMD%d%c",d,r))); | |
32 | if (!ring) { | |
33 | Error("DrawBeforeAfter", "List FMD%d%c not found in %s",d,r,p->GetName()); | |
34 | return; | |
35 | } | |
36 | ||
37 | TH2* corr = static_cast<TH2D*>(ring->FindObject("beforeAfter")); | |
38 | if (!corr) { | |
39 | Error("DrawRingBeforeAfter", "Histogram esdEloss not found in FMD%d%c", | |
40 | d, r); | |
41 | return; | |
42 | } | |
43 | // gPad->SetLogz(); | |
44 | gPad->SetFillColor(0); | |
45 | corr->SetTitle(Form("FMD%d%c",d,r)); | |
46 | corr->Draw("colz"); | |
47 | ||
48 | corr->GetXaxis()->SetRangeUser(-.5, 4); | |
49 | corr->GetYaxis()->SetRangeUser(-.5, 4); | |
50 | gPad->cd(); | |
51 | } | |
52 | ||
53 | ||
56199f2b | 54 | /** |
55 | * Draw the before/after sharing image for all rings | |
56 | * | |
57 | * @param filename | |
58 | * | |
f0ef1e71 | 59 | * @ingroup pwg2_forward_scripts_qa |
56199f2b | 60 | */ |
b5c9a732 | 61 | void |
d015ecfe | 62 | DrawBeforeAfter(const char* filename="forward.root", |
63 | const char* folder="ForwardResults") | |
b5c9a732 | 64 | { |
65 | gStyle->SetPalette(1); | |
66 | gStyle->SetOptFit(0); | |
67 | gStyle->SetOptStat(0); | |
68 | gStyle->SetOptTitle(1); | |
69 | gStyle->SetTitleW(.4); | |
70 | gStyle->SetTitleH(.1); | |
71 | gStyle->SetTitleColor(0); | |
72 | gStyle->SetTitleStyle(0); | |
73 | gStyle->SetTitleBorderSize(0); | |
74 | gStyle->SetTitleX(.6); | |
75 | ||
76 | TFile* file = TFile::Open(filename, "READ"); | |
77 | if (!file) { | |
78 | Error("DrawBeforeAfter", "failed to open %s", filename); | |
79 | return; | |
80 | } | |
81 | ||
d015ecfe | 82 | TList* forward = static_cast<TList*>(file->Get(folder)); |
b5c9a732 | 83 | if (!forward) { |
d015ecfe | 84 | Error("DrawBeforeAfter", "List %s not found in %s", folder, filename); |
b5c9a732 | 85 | return; |
86 | } | |
87 | ||
88 | TList* sf = static_cast<TList*>(forward->FindObject("fmdSharingFilter")); | |
89 | if (!sf) { | |
90 | Error("DrawBeforeAfter", "List fmdSharingFilter not found in Forward"); | |
91 | return; | |
92 | } | |
93 | ||
94 | TCanvas* c = new TCanvas("beforeAfter", | |
95 | "Signals before and after merging", 900, 700); | |
96 | c->SetFillColor(0); | |
97 | c->SetBorderSize(0); | |
98 | c->SetLeftMargin(0.15); | |
99 | c->SetRightMargin(0.02); | |
100 | c->SetTopMargin(0.02); | |
101 | c->Divide(3, 2, 0, 0); | |
102 | ||
103 | c->cd(1); DrawRingBeforeAfter(sf, 1, 'I'); | |
104 | c->cd(2); DrawRingBeforeAfter(sf, 2, 'I'); | |
105 | c->cd(5); DrawRingBeforeAfter(sf, 2, 'O'); | |
106 | c->cd(3); DrawRingBeforeAfter(sf, 3, 'I'); | |
107 | c->cd(6); DrawRingBeforeAfter(sf, 3, 'O'); | |
108 | TVirtualPad* p = c->cd(4); | |
109 | // p->SetTopMargin(0.05); | |
110 | p->SetRightMargin(0.15); | |
111 | p->SetFillColor(0); | |
112 | TH2D* highCuts = static_cast<TH2D*>(sf->FindObject("highCuts")); | |
113 | if (highCuts) highCuts->Draw("colz"); | |
114 | c->cd(); | |
d015ecfe | 115 | c->SaveAs("beforeAfter.png"); |
b5c9a732 | 116 | } |
117 | ||
118 | ||
119 | ||
120 | ||
56199f2b | 121 | // |
122 | // EOF | |
123 | // |