]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FORWARD/analysis2/scripts/DrawNeighbors.C
cbabee5e55a9c3e1da66bd2a7cbb74b60558327b
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / scripts / DrawNeighbors.C
1 void
2 DrawRingNeighbors(TList* p, UShort_t d, Char_t r)
3 {
4   if (!p) return;
5
6   TList* ring = static_cast<TList*>(p->FindObject(Form("FMD%d%c",d,r)));
7   if (!ring) { 
8     Error("DrawNeighbors", "List FMD%d%c not found in %s",d,r,p->GetName());
9     return;
10   }
11   
12   TH2* before = static_cast<TH2D*>(ring->FindObject("neighborsBefore"));
13   if (!before) { 
14     Error("DrawRingNeighbors", "Histogram neighborsBefore not found in FMD%d%c",
15           d, r);
16     return;
17   }
18   TH2* after = static_cast<TH2D*>(ring->FindObject("neighborsAfter"));
19   if (!after) { 
20     Error("DrawRingNeighbors", "Histogram neighborsAfter not found in FMD%d%c",
21           d, r);
22     return;
23   }
24   gPad->SetLogz();
25   gPad->SetFillColor(0);
26   before->SetTitle(Form("FMD%d%c",d,r));
27   before->Draw("colz");
28   after->Draw("same box");
29
30   before->GetXaxis()->SetRangeUser(-.5, 2);
31   before->GetYaxis()->SetRangeUser(-.5, 2);
32   gPad->cd();
33 }
34
35
36 void
37 DrawNeighbors(const char* filename="forward.root")
38 {
39   gStyle->SetPalette(1);
40   gStyle->SetOptFit(0);
41   gStyle->SetOptStat(0);
42   gStyle->SetTitleW(.4);
43   gStyle->SetTitleH(.1);
44   gStyle->SetTitleColor(0);
45   gStyle->SetTitleStyle(0);
46   gStyle->SetTitleBorderSize(0);
47   gStyle->SetTitleX(.6);
48
49   TFile* file = TFile::Open(filename, "READ");
50   if (!file) { 
51     Error("DrawNeighbors", "failed to open %s", filename);
52     return;
53   }
54
55   TList* forward = static_cast<TList*>(file->Get("Forward"));
56   if (!forward) { 
57     Error("DrawNeighbors", "List Forward not found in %s", filename);
58     return;
59   }
60
61   TList* sf = static_cast<TList*>(forward->FindObject("fmdSharingFilter"));
62   if (!sf) { 
63     Error("DrawNeighbors", "List fmdSharingFilter not found in Forward");
64     return;
65   }
66   
67   TCanvas* c = new TCanvas("neighbors", "Correlation of Neighbor strips", 
68                            900, 700);
69   c->SetFillColor(0);
70   c->SetBorderSize(0);
71   c->Divide(3, 2, 0, 0);
72   
73   c->cd(1); DrawRingNeighbors(sf, 1, 'I');
74   c->cd(2); DrawRingNeighbors(sf, 2, 'I');
75   c->cd(5); DrawRingNeighbors(sf, 2, 'O');
76   c->cd(3); DrawRingNeighbors(sf, 3, 'I');
77   c->cd(6); DrawRingNeighbors(sf, 3, 'O');
78   c->cd(4)->SetFillColor(0);
79   c->cd();
80 }
81
82   
83   
84