]>
Commit | Line | Data |
---|---|---|
2dbde04b | 1 | /** |
2 | * @file DrawNeighbors.C | |
3 | * @author Christian Holm Christensen <cholm@nbi.dk> | |
4 | * @date Thu Nov 17 11:26:12 2011 | |
5 | * | |
6 | * @brief Draw corrlation of neighboring strips | |
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 | |
24 | class TList; | |
25 | #endif | |
56199f2b | 26 | /** |
27 | * Draw the correlation of neighboring strips before/after merging | |
28 | * | |
29 | * @param p List | |
30 | * @param d Detector | |
31 | * @param r Ring | |
32 | * | |
2dbde04b | 33 | * @deprecated Use QATrender instead |
bd6f5206 | 34 | * @ingroup pwglf_forward_scripts_qa |
56199f2b | 35 | */ |
0919aa56 | 36 | void |
37 | DrawRingNeighbors(TList* p, UShort_t d, Char_t r) | |
38 | { | |
39 | if (!p) return; | |
40 | ||
41 | TList* ring = static_cast<TList*>(p->FindObject(Form("FMD%d%c",d,r))); | |
42 | if (!ring) { | |
43 | Error("DrawNeighbors", "List FMD%d%c not found in %s",d,r,p->GetName()); | |
44 | return; | |
45 | } | |
46 | ||
47 | TH2* before = static_cast<TH2D*>(ring->FindObject("neighborsBefore")); | |
48 | if (!before) { | |
49 | Error("DrawRingNeighbors", "Histogram neighborsBefore not found in FMD%d%c", | |
50 | d, r); | |
51 | return; | |
52 | } | |
53 | TH2* after = static_cast<TH2D*>(ring->FindObject("neighborsAfter")); | |
54 | if (!after) { | |
55 | Error("DrawRingNeighbors", "Histogram neighborsAfter not found in FMD%d%c", | |
56 | d, r); | |
57 | return; | |
58 | } | |
59 | gPad->SetLogz(); | |
60 | gPad->SetFillColor(0); | |
b5c9a732 | 61 | TPad* pad = (TPad*)gPad; |
62 | if (d == 3) { | |
63 | pad->SetPad(pad->GetXlowNDC(), pad->GetYlowNDC(), .99, | |
64 | pad->GetYlowNDC()+pad->GetHNDC()); | |
65 | pad->SetRightMargin(0.15); | |
66 | } | |
67 | // gStyle->SetTitleY(gPad->GetBottomMargin()); | |
68 | ||
0919aa56 | 69 | before->SetTitle(Form("FMD%d%c",d,r)); |
70 | before->Draw("colz"); | |
71 | after->Draw("same box"); | |
72 | ||
73 | before->GetXaxis()->SetRangeUser(-.5, 2); | |
74 | before->GetYaxis()->SetRangeUser(-.5, 2); | |
b5c9a732 | 75 | |
76 | TLatex* ltx = new TLatex(gPad->GetLeftMargin()+.01, | |
77 | gPad->GetBottomMargin()+.01, | |
78 | before->GetTitle()); | |
79 | ltx->SetNDC(); | |
80 | ltx->SetTextSize(.07); | |
81 | ltx->Draw(); | |
82 | ||
0919aa56 | 83 | gPad->cd(); |
84 | } | |
85 | ||
56199f2b | 86 | /** |
87 | * Draw the correlation of neighboring strips before/after merging | |
88 | * | |
2dbde04b | 89 | * @param filename Input file name |
90 | * @param folder Input folder name in file | |
56199f2b | 91 | * |
bd6f5206 | 92 | * @ingroup pwglf_forward_scripts_qa |
2dbde04b | 93 | * @deprecated Use QATrender instead |
56199f2b | 94 | */ |
0919aa56 | 95 | void |
d015ecfe | 96 | DrawNeighbors(const char* filename="forward.root", |
97 | const char* folder="ForwardResults") | |
0919aa56 | 98 | { |
99 | gStyle->SetPalette(1); | |
100 | gStyle->SetOptFit(0); | |
101 | gStyle->SetOptStat(0); | |
102 | gStyle->SetTitleW(.4); | |
103 | gStyle->SetTitleH(.1); | |
b5c9a732 | 104 | gStyle->SetTitleX(.1); |
105 | gStyle->SetTitleY(.1); | |
0919aa56 | 106 | gStyle->SetTitleColor(0); |
107 | gStyle->SetTitleStyle(0); | |
108 | gStyle->SetTitleBorderSize(0); | |
b5c9a732 | 109 | gStyle->SetOptTitle(0); |
0919aa56 | 110 | |
111 | TFile* file = TFile::Open(filename, "READ"); | |
112 | if (!file) { | |
113 | Error("DrawNeighbors", "failed to open %s", filename); | |
114 | return; | |
115 | } | |
116 | ||
d015ecfe | 117 | TList* forward = static_cast<TList*>(file->Get(folder)); |
0919aa56 | 118 | if (!forward) { |
d015ecfe | 119 | Error("DrawNeighbors", "List %s not found in %s", folder, filename); |
0919aa56 | 120 | return; |
121 | } | |
122 | ||
123 | TList* sf = static_cast<TList*>(forward->FindObject("fmdSharingFilter")); | |
124 | if (!sf) { | |
125 | Error("DrawNeighbors", "List fmdSharingFilter not found in Forward"); | |
126 | return; | |
127 | } | |
128 | ||
129 | TCanvas* c = new TCanvas("neighbors", "Correlation of Neighbor strips", | |
130 | 900, 700); | |
131 | c->SetFillColor(0); | |
132 | c->SetBorderSize(0); | |
133 | c->Divide(3, 2, 0, 0); | |
134 | ||
135 | c->cd(1); DrawRingNeighbors(sf, 1, 'I'); | |
136 | c->cd(2); DrawRingNeighbors(sf, 2, 'I'); | |
137 | c->cd(5); DrawRingNeighbors(sf, 2, 'O'); | |
138 | c->cd(3); DrawRingNeighbors(sf, 3, 'I'); | |
139 | c->cd(6); DrawRingNeighbors(sf, 3, 'O'); | |
140 | c->cd(4)->SetFillColor(0); | |
141 | c->cd(); | |
d015ecfe | 142 | c->SaveAs("neighbors.png"); |
0919aa56 | 143 | } |
0919aa56 | 144 | |
56199f2b | 145 | // |
146 | // EOF | |
147 | // |