2 * @file DrawNeighbors.C
3 * @author Christian Holm Christensen <cholm@nbi.dk>
4 * @date Thu Nov 17 11:26:12 2011
6 * @brief Draw corrlation of neighboring strips
8 * @deprecated Use QATrender instead
9 * @ingroup pwg2_forward_scripts_qa
27 * Draw the correlation of neighboring strips before/after merging
33 * @deprecated Use QATrender instead
34 * @ingroup pwg2_forward_scripts_qa
37 DrawRingNeighbors(TList* p, UShort_t d, Char_t r)
41 TList* ring = static_cast<TList*>(p->FindObject(Form("FMD%d%c",d,r)));
43 Error("DrawNeighbors", "List FMD%d%c not found in %s",d,r,p->GetName());
47 TH2* before = static_cast<TH2D*>(ring->FindObject("neighborsBefore"));
49 Error("DrawRingNeighbors", "Histogram neighborsBefore not found in FMD%d%c",
53 TH2* after = static_cast<TH2D*>(ring->FindObject("neighborsAfter"));
55 Error("DrawRingNeighbors", "Histogram neighborsAfter not found in FMD%d%c",
60 gPad->SetFillColor(0);
61 TPad* pad = (TPad*)gPad;
63 pad->SetPad(pad->GetXlowNDC(), pad->GetYlowNDC(), .99,
64 pad->GetYlowNDC()+pad->GetHNDC());
65 pad->SetRightMargin(0.15);
67 // gStyle->SetTitleY(gPad->GetBottomMargin());
69 before->SetTitle(Form("FMD%d%c",d,r));
71 after->Draw("same box");
73 before->GetXaxis()->SetRangeUser(-.5, 2);
74 before->GetYaxis()->SetRangeUser(-.5, 2);
76 TLatex* ltx = new TLatex(gPad->GetLeftMargin()+.01,
77 gPad->GetBottomMargin()+.01,
80 ltx->SetTextSize(.07);
87 * Draw the correlation of neighboring strips before/after merging
89 * @param filename Input file name
90 * @param folder Input folder name in file
92 * @ingroup pwg2_forward_scripts_qa
93 * @deprecated Use QATrender instead
96 DrawNeighbors(const char* filename="forward.root",
97 const char* folder="ForwardResults")
99 gStyle->SetPalette(1);
100 gStyle->SetOptFit(0);
101 gStyle->SetOptStat(0);
102 gStyle->SetTitleW(.4);
103 gStyle->SetTitleH(.1);
104 gStyle->SetTitleX(.1);
105 gStyle->SetTitleY(.1);
106 gStyle->SetTitleColor(0);
107 gStyle->SetTitleStyle(0);
108 gStyle->SetTitleBorderSize(0);
109 gStyle->SetOptTitle(0);
111 TFile* file = TFile::Open(filename, "READ");
113 Error("DrawNeighbors", "failed to open %s", filename);
117 TList* forward = static_cast<TList*>(file->Get(folder));
119 Error("DrawNeighbors", "List %s not found in %s", folder, filename);
123 TList* sf = static_cast<TList*>(forward->FindObject("fmdSharingFilter"));
125 Error("DrawNeighbors", "List fmdSharingFilter not found in Forward");
129 TCanvas* c = new TCanvas("neighbors", "Correlation of Neighbor strips",
133 c->Divide(3, 2, 0, 0);
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);
142 c->SaveAs("neighbors.png");