AliPhysics  9c66e61 (9c66e61)
DrawCorrSecMap2.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 DrawCorrSecMap2(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("DrawCorrSecMap", "Failed to open %s", fname);
52  return;
53  }
54  TString pname(fname);
55  pname.ReplaceAll(".root", ".png");
56  pname = gSystem->BaseName(pname);
57 
58  const char* objName = "AliFMDCorrSecondaryMap";
59  // AliForwardCorrectionManager::Instance()
60  // .GetObjectName(AliForwardCorrectionManager::kSecondaryMap);
61  AliFMDCorrSecondaryMap* corr =
62  static_cast<AliFMDCorrSecondaryMap*>(file->Get(objName));
63  if (!corr) {
64  TList* l = static_cast<TList*>(file->Get("ForwardCorrResults"));
65  if (l)
66  corr = static_cast<AliFMDCorrSecondaryMap*>(l->FindObject(objName));
67  }
68  if (!corr) {
69  Error("DrawCorrSecMap", "Object '%s' not found in %s", objName, fname);
70  return;
71  }
72 
73  //__________________________________________________________________
74  // Create a canvas
75  TCanvas* c = new TCanvas("c", "c", 800, 800 / TMath::Sqrt(2));
76  c->SetFillColor(0);
77  c->SetBorderSize(0);
78  c->SetBorderMode(0);
79  // c->Print(Form("%s[", pname.Data()));
80 
81  gStyle->SetOptStat(0);
82  gStyle->SetTitleColor(0);
83  gStyle->SetTitleStyle(0);
84  gStyle->SetTitleBorderSize(0);
85  gStyle->SetTitleX(.1);
86  gStyle->SetTitleY(1);
87  gStyle->SetTitleW(.8);
88  gStyle->SetTitleH(.09);
89  gStyle->SetFrameFillColor(kWhite);
90  gStyle->SetFrameBorderSize(1);
91  gStyle->SetFrameBorderMode(1);
92  gStyle->SetPalette(1);
93 
94  ClearCanvas(c);
95  //__________________________________________________________________
96  // Draw all corrections
97  const TAxis& vtxAxis = corr->GetVertexAxis();
98  Int_t nVtx = vtxAxis.GetNbins();
99  c->Divide((nVtx+2)/3, 3, 0, 0);
100  Int_t ipad = 0;
101  for (UShort_t v=1; v <= nVtx; v++) {
102  ipad++;
103  if (nVtx == 10 && (ipad == 1 || ipad == 12)) ipad++;
104 
105  TVirtualPad* p = c->cd(ipad);
106  p->SetFillColor(kWhite);
107  THStack* stack = new THStack(Form("vtxBin%02d", v),
108  Form("%-4.1f<v_{z}<%4.1f",
109  vtxAxis.GetBinLowEdge(v),
110  vtxAxis.GetBinUpEdge(v)));
111 
112  for (UShort_t d = 1; d <= 3; d++) {
113  UShort_t nQ = (d == 1 ? 1 : 2);
114  for (UShort_t q = 0; q < nQ; q++) {
115  Char_t r = (q == 0 ? 'I' : 'O');
116 
117  TH2* h1 = corr->GetCorrection(d, r, v);
118  if (!h1) {
119  Warning("DrawCorrSecMap", "No correction for r=%c, v=%d", r, v);
120  continue;
121  }
122 
123  // Info("DrawCorrSecMap2", "Getting FMD%d%c vtxbin %d", d, r, v);
124  TH1D* pr = h1->ProjectionX(Form("FMD%d%c", d, r), -1, -1, "e");
125  pr->SetDirectory(0);
126  pr->SetTitle(Form("FMD%d%c", d, r));
127  pr->Scale(1. / (q == 0 ? 20 : 40));
128  pr->SetMarkerColor(AliForwardUtil::RingColor(d, r));
129 
130  stack->Add(pr);
131  }
132  }
133  stack->SetMaximum(3.2);
134  stack->Draw("nostack");
135  }
136 
137  //__________________________________________________________________
138  // Close output file
139  c->SaveAs(pname.Data());
140 
141 }
142 //
143 // EOF
144 //
TSystem * gSystem
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
const TAxis & GetVertexAxis() const
AliStack * stack
void DrawCorrSecMap2(const char *fname, const char *option="colz")
int Int_t
Definition: External.C:63
static Color_t RingColor(UShort_t d, Char_t r)
Definition: External.C:212
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