AliPhysics  41af4b0 (41af4b0)
Draw123.C
Go to the documentation of this file.
1 
12 #ifndef __CINT__
13 # include <TH1.h>
14 # include <TH2.h>
15 # include <TList.h>
16 # include <TFile.h>
17 # include <TString.h>
18 # include <TError.h>
19 # include <TPad.h>
20 # include <TCanvas.h>
21 # include <TLine.h>
22 # include <TLatex.h>
23 # include <TStyle.h>
24 # include <TLegend.h>
25 #else
26 class TList;
27 #endif
28 
40 void
42 {
43  if (!p) return;
44 
45  TList* ring = static_cast<TList*>(p->FindObject(Form("FMD%d%c",d,r)));
46  if (!ring) {
47  Error("Draw123", "List FMD%d%c not found in %s",d,r,p->GetName());
48  return;
49  }
50 
51  TH1* one = static_cast<TH1*>(ring->FindObject("singleEloss"));
52  TH1* two = static_cast<TH1*>(ring->FindObject("doubleEloss"));
53  TH1* three = static_cast<TH1*>(ring->FindObject("tripleEloss"));
54  if (!one || !two || !three) {
55  Error("DrawRing123", "Histograms of Eloss not found in FMD%d%c", d, r);
56  return;
57  }
58  one->SetStats(0);
59  one->SetTitle(Form("FMD%d%c", d, r));
60  one->GetXaxis()->SetRangeUser(0, 8);
61 
62  gPad->SetLogy();
63  gPad->SetFillColor(0);
64 
65  one->Draw();
66  if (two) two->Draw("same");
67  if (three) three->Draw("same");
68 
69  TLegend* l = new TLegend(.6, .6, .95, 1);
70  l->SetFillColor(0);
71  l->SetBorderSize(0);
72  l->AddEntry(one);
73  if (two) l->AddEntry(two);
74  if (three) l->AddEntry(three);
75  l->Draw();
76 
77  gPad->cd();
78 }
79 
80 
91 void
92 Draw123(const char* filename="forward.root",
93  const char* folder="ForwardResults")
94 {
95  gStyle->SetPalette(1);
96  gStyle->SetOptFit(0);
97  gStyle->SetOptStat(0);
98  gStyle->SetOptTitle(1);
99  gStyle->SetTitleW(.4);
100  gStyle->SetTitleH(.1);
101  gStyle->SetTitleColor(0);
102  gStyle->SetTitleStyle(0);
103  gStyle->SetTitleBorderSize(0);
104  gStyle->SetTitleX(.6);
105 
106  TFile* file = TFile::Open(filename, "READ");
107  if (!file) {
108  Error("Draw123", "failed to open %s", filename);
109  return;
110  }
111 
112  TList* forward = static_cast<TList*>(file->Get(folder));
113  if (!forward) {
114  Error("Draw123", "List %s not found in %s", folder, filename);
115  return;
116  }
117 
118  TList* sf = static_cast<TList*>(forward->FindObject("fmdSharingFilter"));
119  if (!sf) {
120  Error("Draw123", "List fmdSharingFilter not found in Forward");
121  return;
122  }
123 
124  TCanvas* c = new TCanvas("123",
125  "singles, doubles, and tripples", 900, 700);
126  c->SetFillColor(0);
127  c->SetBorderSize(0);
128  c->SetLeftMargin(0.15);
129  c->SetRightMargin(0.02);
130  c->SetTopMargin(0.02);
131  c->Divide(3, 2, 0, 0);
132 
133  c->cd(1); DrawRing123(sf, 1, 'I');
134  c->cd(2); DrawRing123(sf, 2, 'I');
135  c->cd(5); DrawRing123(sf, 2, 'O');
136  c->cd(3); DrawRing123(sf, 3, 'I');
137  c->cd(6); DrawRing123(sf, 3, 'O');
138  TVirtualPad* p = c->cd(4);
139  // p->SetTopMargin(0.05);
140  p->SetRightMargin(0.15);
141  p->SetFillColor(0);
142  TH2D* highCuts = static_cast<TH2D*>(sf->FindObject("highCuts"));
143  if (highCuts) highCuts->Draw("colz");
144  c->cd();
145  c->SaveAs("123.png");
146 }
147 
148 //
149 // EOF
150 //
const char * filename
Definition: TestFCM.C:1
void DrawRing123(TList *p, UShort_t d, Char_t r)
Definition: Draw123.C:41
char Char_t
Definition: External.C:18
TCanvas * c
Definition: TestFitELoss.C:172
Definition: External.C:228
TFile * file
TList with histograms for a given trigger.
unsigned short UShort_t
Definition: External.C:28
Definition: External.C:196
void Draw123(const char *filename="forward.root", const char *folder="ForwardResults")
Definition: Draw123.C:92