AliPhysics  608b256 (608b256)
DrawNeighbors.C
Go to the documentation of this file.
1 
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
26 
36 void
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);
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 
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);
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 
83  gPad->cd();
84 }
85 
95 void
96 DrawNeighbors(const char* filename="forward.root",
97  const char* folder="ForwardResults")
98 {
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);
110 
111  TFile* file = TFile::Open(filename, "READ");
112  if (!file) {
113  Error("DrawNeighbors", "failed to open %s", filename);
114  return;
115  }
116 
117  TList* forward = static_cast<TList*>(file->Get(folder));
118  if (!forward) {
119  Error("DrawNeighbors", "List %s not found in %s", folder, filename);
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();
142  c->SaveAs("neighbors.png");
143 }
144 
145 //
146 // EOF
147 //
const char * filename
Definition: TestFCM.C:1
char Char_t
Definition: External.C:18
TCanvas * c
Definition: TestFitELoss.C:172
void DrawRingNeighbors(TList *p, UShort_t d, Char_t r)
Definition: DrawNeighbors.C:37
void DrawNeighbors(const char *filename="forward.root", const char *folder="ForwardResults")
Definition: DrawNeighbors.C:96
Definition: External.C:228
Definition: External.C:220
TFile * file
TList with histograms for a given trigger.
unsigned short UShort_t
Definition: External.C:28