4 * Scripts to draw energy loss fits from correction object file
6 * @ingroup pwg2_forward_analysis_scripts
11 * @param c Canvas to clear
13 * @ingroup pwg2_forward_analysis_scripts
16 ClearCanvas(TCanvas* c)
19 c->SetRightMargin(.05);
20 c->SetBottomMargin(.1);
26 * Draw energy loss fits to a multi-page PDF.
29 * The input file is expected to contain a AliFMDCorrELossFit object
30 * named @i elossfits in the top level directory.
33 * A multi-page PDF. Note, that the PDF generated by ROOT in this way
34 * is broken (cannot be read by Acrobat Reader on Windows and MacOSX)
35 * and one should pass it through a filter to correct these problems.
37 * @param fname File name
38 * @param option Drawing options
40 * @ingroup pwg2_forward_analysis_scripts
43 DrawCorrELoss(const char* fname, const char* option="summary error")
45 //__________________________________________________________________
46 // Load libraries and object
47 gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C");
49 TFile* file = TFile::Open(fname, "READ");
51 Error("DrawCorrELoss", "Failed to open %s", fname);
54 TString pname(gSystem->BaseName(fname));
55 pname.ReplaceAll(".root", ".pdf");
57 AliFMDCorrELossFit* fits =
58 static_cast<AliFMDCorrELossFit*>(file->Get("elossfits"));
60 Error("DrawCorrELoss", "Object 'elossfits' not found in %s", fname);
64 //__________________________________________________________________
67 Bool_t summary = opts.Contains("summary");
68 if (summary) opts.ReplaceAll("summary", "");
70 //__________________________________________________________________
73 Int_t w = h / TMath::Sqrt(2);
75 TCanvas* c = new TCanvas("c", "c", w, h);
79 c->Print(Form("%s[", pname.Data()));
81 gStyle->SetOptStat(0);
82 gStyle->SetTitleFillColor(0);
83 gStyle->SetTitleStyle(0);
84 gStyle->SetTitleBorderSize(0);
85 gStyle->SetTitleX(.7);
87 gStyle->SetTitleW(.3);
88 gStyle->SetTitleH(.1);
89 gStyle->SetFrameFillColor(kWhite);
90 gStyle->SetFrameBorderSize(1);
91 gStyle->SetFrameBorderMode(1);
94 //__________________________________________________________________
96 // Create a title page
97 TLatex* ll = new TLatex(.5,.8, fname);
99 ll->SetTextSize(0.05);
103 TLatex* l = new TLatex(.5,.8, fname);
105 l->SetTextSize(0.03);
108 l->DrawLatex(0.2, 0.70, "1^{st} page is a summary of fit parameters");
109 l->DrawLatex(0.2, 0.67, "2^{nd} page is a summary of relative errors");
110 l->DrawLatex(0.2, 0.64, "Subsequent pages shows the fitted functions");
111 l->DrawLatex(0.3, 0.60, "Black line is the full fitted function");
112 l->DrawLatex(0.3, 0.57, "Coloured lines are the individual N-mip comp.");
113 l->DrawLatex(0.3, 0.54, "Full drawn lines correspond to used components");
114 l->DrawLatex(0.3, 0.51, "Dashed lines correspond to ignored components");
115 l->DrawLatex(0.2, 0.47, "Each component has the form");
116 l->DrawLatex(0.3, 0.42, "f_{n}(x; #Delta, #xi, #sigma') = "
117 "#int_{-#infty}^{+#infty}d#Delta' "
118 "landau(x; #Delta, #xi)gaus(x; #Delta', #sigma')");
119 l->DrawLatex(0.2, 0.37, "The full function is given by");
120 l->DrawLatex(0.3, 0.32, "f_{N}(x; #Delta, #xi, #sigma', #bf{a}) = "
121 "#sum_{i=1}^{N} a_{i} "
122 "f_{i}(x; #Delta_{i}, #xi_{i}, #sigma_{i}')");
123 l->DrawLatex(0.3, 0.26, "#Delta_{i} = i (#Delta_{1} + #xi_{1} log(i))");
124 l->DrawLatex(0.3, 0.23, "#xi_{i} = i #xi_{1}");
125 l->DrawLatex(0.3, 0.20, "#sigma_{i} = #sqrt{i} #sigma_{1}");
126 l->DrawLatex(0.3, 0.17, "#sigma_{n} #dot{=} 0");
127 l->DrawLatex(0.3, 0.14, "#sigma'^{2} = #sigma^{2}_{n} + #sigma^{2}");
128 l->DrawLatex(0.3, 0.11, "a_{1} = 1");
129 c->Print(pname.Data(), "Title:Title page");
134 //__________________________________________________________________
135 // Draw overview page
136 fits->Draw(opts.Data());
137 c->Print(pname.Data(), "Title:Fit overview");
140 c->Print(Form("%s]", pname.Data()));
141 TString pngName(pname.Data());
142 pngName.ReplaceAll(".pdf", ".png");
143 c->Print(pngName.Data());
148 //__________________________________________________________________
149 // Draw relative parameter errors
150 fits->Draw("relative");
151 c->Print(pname.Data(), "Title:Relative parameter errors");
153 //__________________________________________________________________
154 // Draw all fits individually
156 for (UShort_t d=1; d<=3; d++) {
157 UShort_t nQ = (d == 1 ? 1 : 2);
158 for (UShort_t q = 0; q < nQ; q++) {
159 Char_t r = (q == 0 ? 'I' : 'O');
161 TObjArray* ra = fits->GetRingArray(d, r);
164 AliFMDCorrELossFit::ELossFit* fit = 0;
167 while ((fit = static_cast<AliFMDCorrELossFit::ELossFit*>(next()))) {
168 if ((i % nPad) == 0) {
170 c->Divide(2,nPad/2,0,0);
172 TVirtualPad* p = c->cd((i % nPad) + 1);
176 p->SetFillColor(kWhite);
179 if ((i % nPad) == (nPad-1))
180 c->Print(pname.Data(),
181 Form("Title:FMD%d%c page %d", d, r, (i/nPad)+1));
185 c->Print(pname.Data(),
186 Form("Title:FMD%d%c page %d", d, r, (i/nPad)+1));
190 //__________________________________________________________________
192 c->Print(Form("%s]", pname.Data()));