]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FORWARD/analysis2/qa/DrawNeighbors.C
Documentation fixes
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / qa / DrawNeighbors.C
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  *
8  * @ingroup pwg2_forward_scripts_qa
9  */
10 void
11 DrawRingNeighbors(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);
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
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);
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
57   gPad->cd();
58 }
59
60 /** 
61  * Draw the correlation of neighboring strips before/after merging 
62  * 
63  * @param filename 
64  *
65  * @ingroup pwg2_forward_scripts_qa
66  */
67 void
68 DrawNeighbors(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);
75   gStyle->SetTitleX(.1);
76   gStyle->SetTitleY(.1);
77   gStyle->SetTitleColor(0);
78   gStyle->SetTitleStyle(0);
79   gStyle->SetTitleBorderSize(0);
80   gStyle->SetOptTitle(0);
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  
118 //
119 // EOF
120 //