]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FORWARD/analysis2/qa/DrawNeighbors.C
Fixed SETUP.C for EventMixing. Library is taken from local directory first.
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / qa / DrawNeighbors.C
CommitLineData
56199f2b 1/**
2 * Draw the correlation of neighboring strips before/after merging
3 *
4 * @param p List
5 * @param d Detector
6 * @param r Ring
7 *
f0ef1e71 8 * @ingroup pwg2_forward_scripts_qa
56199f2b 9 */
0919aa56 10void
11DrawRingNeighbors(TList* p, UShort_t d, Char_t r)
12{
13 if (!p) return;
14
15 TList* ring = static_cast<TList*>(p->FindObject(Form("FMD%d%c",d,r)));
16 if (!ring) {
17 Error("DrawNeighbors", "List FMD%d%c not found in %s",d,r,p->GetName());
18 return;
19 }
20
21 TH2* before = static_cast<TH2D*>(ring->FindObject("neighborsBefore"));
22 if (!before) {
23 Error("DrawRingNeighbors", "Histogram neighborsBefore not found in FMD%d%c",
24 d, r);
25 return;
26 }
27 TH2* after = static_cast<TH2D*>(ring->FindObject("neighborsAfter"));
28 if (!after) {
29 Error("DrawRingNeighbors", "Histogram neighborsAfter not found in FMD%d%c",
30 d, r);
31 return;
32 }
33 gPad->SetLogz();
34 gPad->SetFillColor(0);
b5c9a732 35 TPad* pad = (TPad*)gPad;
36 if (d == 3) {
37 pad->SetPad(pad->GetXlowNDC(), pad->GetYlowNDC(), .99,
38 pad->GetYlowNDC()+pad->GetHNDC());
39 pad->SetRightMargin(0.15);
40 }
41 // gStyle->SetTitleY(gPad->GetBottomMargin());
42
0919aa56 43 before->SetTitle(Form("FMD%d%c",d,r));
44 before->Draw("colz");
45 after->Draw("same box");
46
47 before->GetXaxis()->SetRangeUser(-.5, 2);
48 before->GetYaxis()->SetRangeUser(-.5, 2);
b5c9a732 49
50 TLatex* ltx = new TLatex(gPad->GetLeftMargin()+.01,
51 gPad->GetBottomMargin()+.01,
52 before->GetTitle());
53 ltx->SetNDC();
54 ltx->SetTextSize(.07);
55 ltx->Draw();
56
0919aa56 57 gPad->cd();
58}
59
56199f2b 60/**
61 * Draw the correlation of neighboring strips before/after merging
62 *
63 * @param filename
64 *
f0ef1e71 65 * @ingroup pwg2_forward_scripts_qa
56199f2b 66 */
0919aa56 67void
68DrawNeighbors(const char* filename="forward.root")
69{
70 gStyle->SetPalette(1);
71 gStyle->SetOptFit(0);
72 gStyle->SetOptStat(0);
73 gStyle->SetTitleW(.4);
74 gStyle->SetTitleH(.1);
b5c9a732 75 gStyle->SetTitleX(.1);
76 gStyle->SetTitleY(.1);
0919aa56 77 gStyle->SetTitleColor(0);
78 gStyle->SetTitleStyle(0);
79 gStyle->SetTitleBorderSize(0);
b5c9a732 80 gStyle->SetOptTitle(0);
0919aa56 81
82 TFile* file = TFile::Open(filename, "READ");
83 if (!file) {
84 Error("DrawNeighbors", "failed to open %s", filename);
85 return;
86 }
87
88 TList* forward = static_cast<TList*>(file->Get("Forward"));
89 if (!forward) {
90 Error("DrawNeighbors", "List Forward not found in %s", filename);
91 return;
92 }
93
94 TList* sf = static_cast<TList*>(forward->FindObject("fmdSharingFilter"));
95 if (!sf) {
96 Error("DrawNeighbors", "List fmdSharingFilter not found in Forward");
97 return;
98 }
99
100 TCanvas* c = new TCanvas("neighbors", "Correlation of Neighbor strips",
101 900, 700);
102 c->SetFillColor(0);
103 c->SetBorderSize(0);
104 c->Divide(3, 2, 0, 0);
105
106 c->cd(1); DrawRingNeighbors(sf, 1, 'I');
107 c->cd(2); DrawRingNeighbors(sf, 2, 'I');
108 c->cd(5); DrawRingNeighbors(sf, 2, 'O');
109 c->cd(3); DrawRingNeighbors(sf, 3, 'I');
110 c->cd(6); DrawRingNeighbors(sf, 3, 'O');
111 c->cd(4)->SetFillColor(0);
112 c->cd();
113}
114
115
116
117
56199f2b 118//
119// EOF
120//