AliPhysics  b76e98e (b76e98e)
DrawCorrAcc2.C
Go to the documentation of this file.
1 
15 void
16 ClearCanvas(TCanvas* c)
17 {
18  c->SetLeftMargin(.1);
19  c->SetRightMargin(.05);
20  c->SetBottomMargin(.1);
21  c->SetTopMargin(.05);
22  c->Clear();
23 }
24 
42 void
43 DrawCorrAcc2(const char* fname, const char* option="colz")
44 {
45  //__________________________________________________________________
46  // Load libraries and object
47  gROOT->Macro("$ALICE_PHYSICS/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C");
48 
49  TFile* file = TFile::Open(fname, "READ");
50  if (!file) {
51  Error("DrawCorrAcc", "Failed to open %s", fname);
52  return;
53  }
54  TString pname(fname);
55  pname.ReplaceAll(".root", ".pdf");
56 
57  const char* objName =
60  AliFMDCorrAcceptance* corr =
61  static_cast<AliFMDCorrAcceptance*>(file->Get(objName));
62  if (!corr) {
63  Error("DrawCorrAcc", "Object '%s' not found in %s", objName, fname);
64  return;
65  }
66 
67  //__________________________________________________________________
68  // Create a canvas
69  // TCanvas* c = new TCanvas("c", "c", 800 / TMath::Sqrt(2), 800);
70  TCanvas* c = new TCanvas("c", "c", 800, 800 / TMath::Sqrt(2));
71  c->SetFillColor(0);
72  c->SetBorderSize(0);
73  c->SetBorderMode(0);
74 
75  gStyle->SetOptStat(0);
76  gStyle->SetTitleColor(0);
77  gStyle->SetTitleStyle(0);
78  gStyle->SetTitleBorderSize(0);
79  gStyle->SetTitleX(.5);
80  gStyle->SetTitleY(1);
81  gStyle->SetTitleW(.8);
82  gStyle->SetTitleH(.09);
83  gStyle->SetFrameFillColor(kWhite);
84  gStyle->SetFrameBorderSize(1);
85  gStyle->SetFrameBorderMode(1);
86  gStyle->SetPalette(1);
87 
88  ClearCanvas(c);
89  const TAxis& vtxAxis = corr->GetVertexAxis();
90  Int_t nVtx = vtxAxis.GetNbins();
91  c->Divide((nVtx+2)/3, 3, 0, 0);
92  Int_t ipad = 0;
93 
94  //__________________________________________________________________
95  // Draw all corrections
96  for (UShort_t v = 1; v <= nVtx; v++) {
97  ipad++;
98  if (ipad == 1 || ipad == 12) ipad++;
99 
100  TVirtualPad* p = c->cd(ipad);
101  p->SetFillColor(kWhite);
102 
103  THStack* stack = new THStack(Form("vtx%02d", v),
104  Form("%+5.1f<v_{z}<%+5.1f",
105  vtxAxis.GetBinLowEdge(v),
106  vtxAxis.GetBinUpEdge(v)));
107  for (UShort_t d = 1; d <= 3; d++) {
108  UShort_t nQ = (d == 1 ? 1 : 2);
109  for (UShort_t q = 0; q < nQ; q++) {
110  Char_t r = (q == 0 ? 'I' : 'O');
111 
112  TH2* h1 = corr->GetCorrection(d, r, v);
113  if (!h1) {
114  Warning("DrawCorrAcc", "No correction for r=%c, v=%d", r, v);
115  continue;
116  }
117  Int_t nY = h1->GetNbinsY();
118  TH1* hh = h1->ProjectionX(Form("FMD%d%c", d, r), 1, nY);
119  hh->Scale(1. / nY);
120  hh->SetDirectory(0);
121  hh->SetMarkerColor(AliForwardUtil::RingColor(d, r));
122  hh->SetLineColor(AliForwardUtil::RingColor(d, r));
123  hh->SetFillColor(AliForwardUtil::RingColor(d, r));
124  hh->SetFillStyle(3004);
125 
126  stack->Add(hh);
127  }
128  }
129  stack->SetMaximum(1.2);
130  stack->Draw("nostack");
131  }
132  //__________________________________________________________________
133  // Close output file
134  c->SaveAs("acceptance.png");
135 }
136 //
137 // EOF
138 //
TH2D * GetCorrection(UShort_t d, Char_t r, Double_t v) const
char Char_t
Definition: External.C:18
TCanvas * c
Definition: TestFitELoss.C:172
AliStack * stack
int Int_t
Definition: External.C:63
static Color_t RingColor(UShort_t d, Char_t r)
void DrawCorrAcc2(const char *fname, const char *option="colz")
Definition: DrawCorrAcc2.C:43
const char * GetObjectName(Int_t what) const
const TAxis & GetVertexAxis() const
void ClearCanvas(TCanvas *c)
Definition: DrawCorrAcc2.C:16
Definition: External.C:220
TFile * file
TList with histograms for a given trigger.
unsigned short UShort_t
Definition: External.C:28
Definition: External.C:196
static AliForwardCorrectionManager & Instance()