AliPhysics  63e47e1 (63e47e1)
DrawBeforeAfter.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 
37 void
39 {
40  if (!p) return;
41 
42  TList* ring = static_cast<TList*>(p->FindObject(Form("FMD%d%c",d,r)));
43  if (!ring) {
44  Error("DrawBeforeAfter", "List FMD%d%c not found in %s",d,r,p->GetName());
45  return;
46  }
47 
48  TH2* corr = static_cast<TH2D*>(ring->FindObject("beforeAfter"));
49  if (!corr) {
50  Error("DrawRingBeforeAfter", "Histogram esdEloss not found in FMD%d%c",
51  d, r);
52  return;
53  }
54  // gPad->SetLogz();
55  gPad->SetFillColor(0);
56  corr->SetTitle(Form("FMD%d%c",d,r));
57  corr->Draw("colz");
58 
59  corr->GetXaxis()->SetRangeUser(-.5, 4);
60  corr->GetYaxis()->SetRangeUser(-.5, 4);
61  gPad->cd();
62 }
63 
64 
74 void
75 DrawBeforeAfter(const char* filename="forward.root",
76  const char* folder="ForwardResults")
77 {
78  gStyle->SetPalette(1);
79  gStyle->SetOptFit(0);
80  gStyle->SetOptStat(0);
81  gStyle->SetOptTitle(1);
82  gStyle->SetTitleW(.4);
83  gStyle->SetTitleH(.1);
84  gStyle->SetTitleColor(0);
85  gStyle->SetTitleStyle(0);
86  gStyle->SetTitleBorderSize(0);
87  gStyle->SetTitleX(.6);
88 
89  TFile* file = TFile::Open(filename, "READ");
90  if (!file) {
91  Error("DrawBeforeAfter", "failed to open %s", filename);
92  return;
93  }
94 
95  TList* forward = static_cast<TList*>(file->Get(folder));
96  if (!forward) {
97  Error("DrawBeforeAfter", "List %s not found in %s", folder, filename);
98  return;
99  }
100 
101  TList* sf = static_cast<TList*>(forward->FindObject("fmdSharingFilter"));
102  if (!sf) {
103  Error("DrawBeforeAfter", "List fmdSharingFilter not found in Forward");
104  return;
105  }
106 
107  TCanvas* c = new TCanvas("beforeAfter",
108  "Signals before and after merging", 900, 700);
109  c->SetFillColor(0);
110  c->SetBorderSize(0);
111  c->SetLeftMargin(0.15);
112  c->SetRightMargin(0.02);
113  c->SetTopMargin(0.02);
114  c->Divide(3, 2, 0, 0);
115 
116  c->cd(1); DrawRingBeforeAfter(sf, 1, 'I');
117  c->cd(2); DrawRingBeforeAfter(sf, 2, 'I');
118  c->cd(5); DrawRingBeforeAfter(sf, 2, 'O');
119  c->cd(3); DrawRingBeforeAfter(sf, 3, 'I');
120  c->cd(6); DrawRingBeforeAfter(sf, 3, 'O');
121  TVirtualPad* p = c->cd(4);
122  // p->SetTopMargin(0.05);
123  p->SetRightMargin(0.15);
124  p->SetFillColor(0);
125  TH2D* highCuts = static_cast<TH2D*>(sf->FindObject("highCuts"));
126  if (highCuts) highCuts->Draw("colz");
127  c->cd();
128  c->SaveAs("beforeAfter.png");
129 }
130 //
131 // EOF
132 //
const char * filename
Definition: TestFCM.C:1
void DrawBeforeAfter(const char *filename="forward.root", const char *folder="ForwardResults")
char Char_t
Definition: External.C:18
TCanvas * c
Definition: TestFitELoss.C:172
void DrawRingBeforeAfter(TList *p, UShort_t d, Char_t r)
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