]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/hfe/AliHFEInclusiveSpectrumQA.cxx
Ignoring coverity to compile
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliHFEInclusiveSpectrumQA.cxx
CommitLineData
959ea9d8 1
2/**************************************************************************
3* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4* *
5* Author: The ALICE Off-line Project. *
6* Contributors are mentioned in the code where appropriate. *
7* *
8* Permission to use, copy, modify and distribute this software and its *
9* documentation strictly for non-commercial purposes is hereby granted *
10* without fee, provided that the above copyright notice appears in all *
11* copies and that both the copyright notice and this permission notice *
12* appear in the supporting documentation. The authors make no claims *
13* about the suitability of this software for any purpose. It is *
14* provided "as is" without express or implied warranty. *
15**************************************************************************/
16//
17// Class for spectrum correction
18// Subtraction of hadronic background, Unfolding of the data and
19// Renormalization done here
20// The following containers have to be set:
21// - Correction framework container for real data
22// - Correction framework container for MC (Efficiency Map)
23// - Correction framework container for background coming from data
24// - Correction framework container for background coming from MC
25//
26// Author:
27// Raphaelle Bailhache <R.Bailhache@gsi.de>
28//
29
30#include <TArrayD.h>
31#include <TH1.h>
32#include <TList.h>
33#include <TObjArray.h>
34#include <TObject.h>
35#include <TROOT.h>
36#include <TCanvas.h>
37#include <TLegend.h>
38#include <TStyle.h>
39#include <TMath.h>
40#include <TAxis.h>
41#include <TGraphErrors.h>
42#include <TFile.h>
43#include <TPad.h>
44#include <TH2D.h>
45#include <TF1.h>
46
47#include "AliPID.h"
48#include "AliCFContainer.h"
49#include "AliCFDataGrid.h"
50#include "AliCFEffGrid.h"
51#include "AliCFGridSparse.h"
52#include "AliCFUnfolding.h"
53#include "AliLog.h"
54
55#include "AliHFEInclusiveSpectrumQA.h"
56#include "AliHFECorrectSpectrumBase.h"
57#include "AliHFEcuts.h"
58#include "AliHFEcontainer.h"
59#include "AliHFEtools.h"
60
61ClassImp(AliHFEInclusiveSpectrumQA)
62
63const Char_t *AliHFEInclusiveSpectrumQA::fgkNameCanvas[AliHFEInclusiveSpectrumQA::kNTypeEfficiency] = {
64 "V0Efficiency",
65 "MCEfficiency",
66 "ParametrizedEfficiency"
67};
68
69//____________________________________________________________
70AliHFEInclusiveSpectrumQA::AliHFEInclusiveSpectrumQA():
71 TNamed(),
72 fPtMax(7.0),
73 fListOfResult(),
74 fWriteToFile(kTRUE)
75{
76 //
77 // Default constructor
78 //
79
80 fListOfResult = new TObjArray(kNResults);
81 fListOfResult->SetName("ListOfResults");
82
83
84}
85//____________________________________________________________
86AliHFEInclusiveSpectrumQA::AliHFEInclusiveSpectrumQA(const char *name):
87 TNamed(name, ""),
88 fPtMax(7.0),
89 fListOfResult(),
90 fWriteToFile(kTRUE)
91{
92 //
93 // Default constructor
94 //
95
96 fListOfResult = new TObjArray(kNResults);
97 fListOfResult->SetName("ListOfResults");
98
99
100}
101
102//____________________________________________________________
103AliHFEInclusiveSpectrumQA::~AliHFEInclusiveSpectrumQA(){
104 //
105 // Destructor
106 //
107 if(fListOfResult) delete fListOfResult;
108
109}
110//____________________________________________________________
111void AliHFEInclusiveSpectrumQA::AddResultAt(TObject *obj,Int_t index)
112{
113 //
114 // Init what we need for the correction:
115 //
116
117 if(fListOfResult) fListOfResult->AddAt(obj,index);
118
119}
120//____________________________________________________________
121TObject *AliHFEInclusiveSpectrumQA::GetResult(Int_t index)
122{
123 //
124 // Get result
125 //
126
127 if(fListOfResult) return fListOfResult->UncheckedAt(index);
128 else return 0x0;
129
130}
131//____________________________________________________________
132void AliHFEInclusiveSpectrumQA::DrawProjections() const
133{
134 //
135 // get spectrum for beauty 2nd method
136 //
137 //
138 AliCFContainer *data = (AliCFContainer *) fListOfResult->UncheckedAt(kDataProjection);
139 THnSparseF *correlation = (THnSparseF *) fListOfResult->UncheckedAt(kCMProjection);
140 if(!data || !correlation) return;
141
142 Int_t ndimcont = data->GetNVar();
143 Int_t ndimcor = correlation->GetNdimensions();
144 Int_t charge = 3;
145 Int_t centrality = 5;
146 Int_t eta = 1;
147
148 TCanvas * canvas = new TCanvas("Projections","Projections",1000,700);
149 Int_t n = 0;
150 if(charge < ndimcont) n++;
151 if(centrality < ndimcont) n++;
152 if(eta < ndimcont) n++;
153 canvas->Divide(2,n);
154 Int_t counter = 1;
155
156 if(charge < ndimcont) {
157
158 canvas->cd(counter);
159 TH1 *checkcharge = (TH1 *) data->Project(data->GetNStep()-1,charge);
160 checkcharge->Draw();
161 counter++;
162 canvas->cd(counter);
163 TH2F* projectioncharge = (TH2F *) correlation->Projection(charge,charge+((Int_t)(ndimcor/2.)));
164 projectioncharge->Draw("colz");
165 counter++;
166
167 }
168
169 if(centrality < ndimcont) {
170 canvas->cd(counter);
171 TH1 *checkcentrality = (TH1 *) data->Project(data->GetNStep()-1,centrality);
172 checkcentrality->Draw();
173 counter++;
174 canvas->cd(counter);
175 TH2F *projectioncentrality = (TH2F *) correlation->Projection(centrality,centrality+((Int_t)(ndimcor/2.)));
176 projectioncentrality->Draw("colz");
177 counter++;
178 }
179
180 if(eta < ndimcont) {
181 canvas->cd(counter);
182 TH1 *checketa = (TH1 *) data->Project(data->GetNStep()-1,eta);
183 checketa->Draw();
184 counter++;
185 canvas->cd(counter);
186 TH2D* projectioneta = (TH2D *) correlation->Projection(eta,eta+((Int_t)(ndimcor/2.)));
187 projectioneta->Draw("colz");
188 }
189
190
191}
192//____________________________________________________________
193void AliHFEInclusiveSpectrumQA::DrawSubtractContamination() const
194{
195 //
196 // get spectrum for beauty 2nd method
197 //
198 //
199 TH1D *measuredTH1Daftersubstraction = (TH1D *) fListOfResult->UncheckedAt(kAfterSC);
200 TH1D *measuredTH1Dbeforesubstraction = (TH1D *) fListOfResult->UncheckedAt(kBeforeSC);
201 if(!measuredTH1Daftersubstraction || !measuredTH1Dbeforesubstraction) return;
202
203 SetStyle();
204
205 TCanvas * cbackgroundsubtraction = new TCanvas("backgroundsubtraction","backgroundsubtraction",1000,700);
206 cbackgroundsubtraction->Divide(2,1);
207 cbackgroundsubtraction->cd(1);
208 gPad->SetLogy();
209 gPad->SetTicks();
210 measuredTH1Daftersubstraction->SetStats(0);
211 measuredTH1Daftersubstraction->SetTitle("");
212 measuredTH1Daftersubstraction->GetYaxis()->SetTitleOffset(1.5);
213 measuredTH1Daftersubstraction->GetYaxis()->SetTitle("dN/dp_{T} [(GeV/c)^{-1}]");
214 measuredTH1Daftersubstraction->GetXaxis()->SetTitle("p^{rec}_{T} [GeV/c]");
215 measuredTH1Daftersubstraction->GetXaxis()->SetRangeUser(0.0,fPtMax);
216 measuredTH1Daftersubstraction->SetMarkerStyle(25);
217 measuredTH1Daftersubstraction->SetMarkerColor(kBlack);
218 measuredTH1Daftersubstraction->SetLineColor(kBlack);
219 measuredTH1Dbeforesubstraction->SetStats(0);
220 measuredTH1Dbeforesubstraction->SetTitle("");
221 measuredTH1Dbeforesubstraction->GetYaxis()->SetTitle("dN/dp_{T} [(GeV/c)^{-1}]");
222 measuredTH1Dbeforesubstraction->GetXaxis()->SetTitle("p^{rec}_{T} [GeV/c]");
223 measuredTH1Dbeforesubstraction->GetXaxis()->SetRangeUser(0.0,fPtMax);
224 measuredTH1Dbeforesubstraction->SetMarkerStyle(24);
225 measuredTH1Dbeforesubstraction->SetMarkerColor(kBlue);
226 measuredTH1Dbeforesubstraction->SetLineColor(kBlue);
227 measuredTH1Daftersubstraction->Draw();
228 measuredTH1Dbeforesubstraction->Draw("same");
229 TLegend *legsubstraction = new TLegend(0.4,0.6,0.89,0.89);
230 legsubstraction->AddEntry(measuredTH1Dbeforesubstraction,"With hadron contamination","p");
231 legsubstraction->AddEntry(measuredTH1Daftersubstraction,"Without hadron contamination ","p");
232 legsubstraction->SetFillStyle(0);
233 legsubstraction->SetLineStyle(0);
234 legsubstraction->SetLineColor(0);
235 legsubstraction->Draw("same");
236 cbackgroundsubtraction->cd(2);
237 gPad->SetLogy();
238 gPad->SetTicks();
239 TH1D* ratiomeasuredcontamination = (TH1D*)measuredTH1Dbeforesubstraction->Clone();
240 ratiomeasuredcontamination->SetName("ratiomeasuredcontamination");
241 ratiomeasuredcontamination->SetTitle("");
242 ratiomeasuredcontamination->GetYaxis()->SetTitleOffset(1.5);
243 ratiomeasuredcontamination->GetYaxis()->SetTitle("(with contamination - without contamination) / with contamination");
244 ratiomeasuredcontamination->GetXaxis()->SetTitle("p^{rec}_{T} [GeV/c]");
245 ratiomeasuredcontamination->GetYaxis()->SetRangeUser(0.8,1.2);
246 ratiomeasuredcontamination->GetXaxis()->SetRangeUser(0.0,fPtMax);
247 ratiomeasuredcontamination->Sumw2();
248 ratiomeasuredcontamination->Add(measuredTH1Daftersubstraction,-1.0);
249 ratiomeasuredcontamination->Divide(measuredTH1Dbeforesubstraction);
250 ratiomeasuredcontamination->SetStats(0);
251 ratiomeasuredcontamination->SetMarkerStyle(26);
252 ratiomeasuredcontamination->SetMarkerColor(kBlack);
253 ratiomeasuredcontamination->SetLineColor(kBlack);
254 for(Int_t k=0; k < ratiomeasuredcontamination->GetNbinsX(); k++){
255 ratiomeasuredcontamination->SetBinError(k+1,0.0);
256 }
257 ratiomeasuredcontamination->Draw("P");
258 if(fWriteToFile) cbackgroundsubtraction->SaveAs("BackgroundSubtracted.png");
259
260}
261
63bdf450 262//____________________________________________________________
263void AliHFEInclusiveSpectrumQA::DrawSubtractPhotonicBackground() const
264{
265 //
266 // get spectrum
267 //
268
269 TH1D *measuredTH1Dafterphotonicsubstraction = (TH1D *) fListOfResult->UncheckedAt(kAfterSPB);
270 TH1D *measuredTH1Dbeforephotonicsubstraction = (TH1D *) fListOfResult->UncheckedAt(kBeforeSPB);
271 if(!measuredTH1Dafterphotonicsubstraction || !measuredTH1Dbeforephotonicsubstraction) return;
272
273 SetStyle();
274
275 TCanvas * cphotonic = new TCanvas("Photonic Subtraction","Photonic Subtraction",1000,700);
276 cphotonic->Divide(2,1);
277 cphotonic->cd(1);
278 gPad->SetLogy();
279 gPad->SetTicks();
280 measuredTH1Dafterphotonicsubstraction->SetStats(0);
281 measuredTH1Dafterphotonicsubstraction->SetTitle("");
282 measuredTH1Dafterphotonicsubstraction->GetYaxis()->SetTitleOffset(1.5);
283 measuredTH1Dafterphotonicsubstraction->GetYaxis()->SetTitle("dN/dp_{T} [(GeV/c)^{-1}]");
284 measuredTH1Dafterphotonicsubstraction->GetXaxis()->SetTitle("p^{rec}_{T} [GeV/c]");
285 measuredTH1Dafterphotonicsubstraction->GetXaxis()->SetRangeUser(0.0,fPtMax);
286 measuredTH1Dafterphotonicsubstraction->SetMarkerStyle(25);
287 measuredTH1Dafterphotonicsubstraction->SetMarkerColor(kBlack);
288 measuredTH1Dafterphotonicsubstraction->SetLineColor(kBlack);
289 measuredTH1Dbeforephotonicsubstraction->SetStats(0);
290 measuredTH1Dbeforephotonicsubstraction->SetTitle("");
291 measuredTH1Dbeforephotonicsubstraction->GetYaxis()->SetTitle("dN/dp_{T} [(GeV/c)^{-1}]");
292 measuredTH1Dbeforephotonicsubstraction->GetXaxis()->SetTitle("p^{rec}_{T} [GeV/c]");
293 measuredTH1Dbeforephotonicsubstraction->GetXaxis()->SetRangeUser(0.0,fPtMax);
294 measuredTH1Dbeforephotonicsubstraction->SetMarkerStyle(24);
295 measuredTH1Dbeforephotonicsubstraction->SetMarkerColor(kBlue);
296 measuredTH1Dbeforephotonicsubstraction->SetLineColor(kBlue);
297 measuredTH1Dafterphotonicsubstraction->Draw();
298 measuredTH1Dbeforephotonicsubstraction->Draw("same");
299 TLegend *legsubstraction = new TLegend(0.4,0.6,0.89,0.89);
300 legsubstraction->AddEntry(measuredTH1Dbeforephotonicsubstraction,"With photonic background","p");
301 legsubstraction->AddEntry(measuredTH1Dafterphotonicsubstraction,"Without photonic background","p");
302 legsubstraction->SetFillStyle(0);
303 legsubstraction->SetLineStyle(0);
304 legsubstraction->SetLineColor(0);
305 legsubstraction->Draw("same");
306 cphotonic->cd(2);
307 gPad->SetLogy();
308 gPad->SetTicks();
309 TH1D* ratiomeasuredphotonic = (TH1D*)measuredTH1Dbeforephotonicsubstraction->Clone();
310 ratiomeasuredphotonic->SetName("ratiomeasuredphotonic");
311 ratiomeasuredphotonic->SetTitle("");
312 ratiomeasuredphotonic->GetYaxis()->SetTitleOffset(1.5);
313 ratiomeasuredphotonic->GetYaxis()->SetTitle("(with photonic background - without photonic background) / with photonic background");
314 ratiomeasuredphotonic->GetXaxis()->SetTitle("p^{rec}_{T} [GeV/c]");
315 ratiomeasuredphotonic->GetYaxis()->SetRangeUser(0.8,1.2);
316 ratiomeasuredphotonic->GetXaxis()->SetRangeUser(0.0,fPtMax);
317 ratiomeasuredphotonic->Sumw2();
318 ratiomeasuredphotonic->Add(measuredTH1Dafterphotonicsubstraction,-1.0);
319 ratiomeasuredphotonic->Divide(measuredTH1Dbeforephotonicsubstraction);
320 ratiomeasuredphotonic->SetStats(0);
321 ratiomeasuredphotonic->SetMarkerStyle(26);
322 ratiomeasuredphotonic->SetMarkerColor(kBlack);
323 ratiomeasuredphotonic->SetLineColor(kBlack);
324 for(Int_t k=0; k < ratiomeasuredphotonic->GetNbinsX(); k++){
325 ratiomeasuredphotonic->SetBinError(k+1,0.0);
326 }
327 ratiomeasuredphotonic->Draw("P");
328 if(fWriteToFile) cphotonic->SaveAs("PhotonicSubtracted.png");
329
330}
959ea9d8 331
332//____________________________________________________________
333void AliHFEInclusiveSpectrumQA::DrawCorrectWithEfficiency(Int_t typeeff) const
334{
335 //
336 // Correct the spectrum for efficiency and unfolding
337 // with both method and compare
338 //
339
340 TH1D *afterE = 0x0;
341 TH1D *beforeE = 0x0;
342 TH1D *efficiencyDproj = 0x0;
343 TF1 *efficiencyparametrized = 0x0;
344
345 if(typeeff== kV0) {
346 afterE = (TH1D *) fListOfResult->UncheckedAt(kAfterV0);
347 beforeE = (TH1D *) fListOfResult->UncheckedAt(kBeforeV0);
348 efficiencyDproj = (TH1D *) fListOfResult->UncheckedAt(kV0Efficiency);
349 }
350 if(typeeff== kMC) {
351 afterE = (TH1D *) fListOfResult->UncheckedAt(kAfterMCE);
352 beforeE = (TH1D *) fListOfResult->UncheckedAt(kBeforeMCE);
353 efficiencyDproj = (TH1D *) fListOfResult->UncheckedAt(kMCEfficiency);
354 }
355 if(typeeff== kParametrized) {
356 afterE = (TH1D *) fListOfResult->UncheckedAt(kAfterPE);
357 beforeE = (TH1D *) fListOfResult->UncheckedAt(kBeforePE);
358 efficiencyparametrized = (TF1 *) fListOfResult->UncheckedAt(kPEfficiency);
359 }
360
63bdf450 361 if((typeeff==kV0 || typeeff==kMC) && (!afterE || !beforeE || !efficiencyDproj)) return;
362 if(typeeff==kParametrized && (!afterE || !beforeE || !efficiencyparametrized)) return;
959ea9d8 363
63bdf450 364 SetStyle();
959ea9d8 365
366 TCanvas * cEfficiency = new TCanvas(AliHFEInclusiveSpectrumQA::fgkNameCanvas[typeeff],AliHFEInclusiveSpectrumQA::fgkNameCanvas[typeeff],1000,700);
367 cEfficiency->Divide(2,1);
368 cEfficiency->cd(1);
369 gPad->SetLogy();
370 gPad->SetTicks();
371 afterE->SetStats(0);
372 afterE->SetTitle("");
373 afterE->GetYaxis()->SetTitleOffset(1.5);
374 afterE->GetYaxis()->SetTitle("dN/dp_{T} [(GeV/c)^{-1}]");
375 afterE->GetXaxis()->SetTitle("p^{rec}_{T} [GeV/c]");
376 afterE->GetXaxis()->SetRangeUser(0.0,fPtMax);
377 afterE->SetMarkerStyle(25);
378 afterE->SetMarkerColor(kBlack);
379 afterE->SetLineColor(kBlack);
380 beforeE->SetStats(0);
381 beforeE->SetTitle("");
382 beforeE->GetYaxis()->SetTitle("dN/dp_{T} [(GeV/c)^{-1}]");
383 beforeE->GetXaxis()->SetTitle("p_{T} [GeV/c]");
384 beforeE->GetXaxis()->SetRangeUser(0.0,fPtMax);
385 beforeE->SetMarkerStyle(24);
386 beforeE->SetMarkerColor(kBlue);
387 beforeE->SetLineColor(kBlue);
388 afterE->Draw();
389 beforeE->Draw("same");
390 TLegend *legefficiency = new TLegend(0.4,0.6,0.89,0.89);
391 legefficiency->AddEntry(beforeE,"Before Efficiency correction","p");
392 legefficiency->AddEntry(afterE,"After Efficiency correction","p");
393 legefficiency->SetFillStyle(0);
394 legefficiency->SetLineStyle(0);
395 legefficiency->SetLineColor(0);
396 legefficiency->Draw("same");
397 cEfficiency->cd(2);
398 gPad->SetTicks();
399 if((typeeff==kV0 || typeeff==kMC)) {
91e50e2b 400 if(efficiencyDproj) {
401 efficiencyDproj->SetTitle("");
402 efficiencyDproj->SetStats(0);
403 efficiencyDproj->GetYaxis()->SetTitleOffset(1.5);
404 efficiencyDproj->GetYaxis()->SetRangeUser(0.0,1.0);
405 efficiencyDproj->GetYaxis()->SetTitle("Efficiency");
406 efficiencyDproj->GetXaxis()->SetTitle("p^{rec}_{T} [GeV/c]");
407 efficiencyDproj->GetXaxis()->SetRangeUser(0.0,fPtMax);
408 efficiencyDproj->SetMarkerStyle(25);
409 efficiencyDproj->Draw();
410 }
959ea9d8 411 }
412 if(typeeff==kParametrized) {
91e50e2b 413 if(efficiencyparametrized) efficiencyparametrized->Draw();
959ea9d8 414 }
415
416 if(fWriteToFile) {
417 if(typeeff==kV0) cEfficiency->SaveAs("EfficiencyV0.png");
418 if(typeeff==kMC) cEfficiency->SaveAs("EfficiencyMC.png");
419 if(typeeff==kParametrized) cEfficiency->SaveAs("EfficiencyParametrized.png");
420 }
421
422}
423
424//____________________________________________________________
425void AliHFEInclusiveSpectrumQA::DrawUnfolding() const
426{
427 //
428 // Draw unfolding
429 //
430 TH1D *measuredspectrumD = (TH1D *) fListOfResult->UncheckedAt(kBeforeU);
431 TH1D *residualspectrumD = (TH1D *) fListOfResult->UncheckedAt(kResidualU);
432 TH1D *efficiencyDproj = (TH1D *) fListOfResult->UncheckedAt(kUEfficiency);
433 THnSparseF *correlation = (THnSparseF *) fListOfResult->UncheckedAt(kCMProjection);
434
435 if(!measuredspectrumD || !residualspectrumD || !efficiencyDproj || !correlation) return;
436
437 Int_t ndimcor = (Int_t) correlation->GetNdimensions()/2.;
438
439 SetStyle();
440
441 TCanvas * cunfolding = new TCanvas("unfolding","unfolding",1000,700);
442 cunfolding->Divide(2,2);
443 cunfolding->cd(1);
444 gPad->SetLogy();
445 gPad->SetTicks();
446 residualspectrumD->GetYaxis()->SetTitle("dN/dp_{T} [(GeV/c)^{-1}]");
447 residualspectrumD->GetXaxis()->SetTitle("p^{rec}_{T} [GeV/c]");
448 residualspectrumD->GetXaxis()->SetRangeUser(0.0,fPtMax);
449 residualspectrumD->SetStats(0);
450 residualspectrumD->SetTitle("");
451 residualspectrumD->GetYaxis()->SetTitleOffset(1.5);
452 residualspectrumD->SetMarkerStyle(26);
453 residualspectrumD->SetMarkerColor(kBlue);
454 residualspectrumD->SetLineColor(kBlue);
455 residualspectrumD->Sumw2();
456 residualspectrumD->Draw("P");
457 measuredspectrumD->SetStats(0);
458 measuredspectrumD->SetTitle("");
459 measuredspectrumD->GetYaxis()->SetTitleOffset(1.5);
460 measuredspectrumD->SetMarkerStyle(25);
461 measuredspectrumD->SetMarkerColor(kBlack);
462 measuredspectrumD->SetLineColor(kBlack);
463 measuredspectrumD->Draw("same");
464 TLegend *legres = new TLegend(0.4,0.6,0.89,0.89);
465 legres->AddEntry(residualspectrumD,"Residual","p");
466 legres->AddEntry(measuredspectrumD,"Measured","p");
467 legres->SetFillStyle(0);
468 legres->SetLineStyle(0);
469 legres->SetLineColor(0);
470 legres->Draw("same");
471 cunfolding->cd(2);
472 gPad->SetTicks();
473 TH1D* ratioresidual = (TH1D*)residualspectrumD->Clone();
474 ratioresidual->SetName("ratioresidual");
475 ratioresidual->SetTitle("");
476 ratioresidual->GetYaxis()->SetRangeUser(0.6,1.4);
477 ratioresidual->GetYaxis()->SetTitle("Folded/Measured");
478 ratioresidual->GetXaxis()->SetTitle("p_{T} [GeV/c]");
479 ratioresidual->Divide(measuredspectrumD);
480 ratioresidual->SetStats(0);
481 ratioresidual->Draw();
482 cunfolding->cd(3);
483 gPad->SetTicks();
484 efficiencyDproj->GetYaxis()->SetTitle("Efficiency");
485 efficiencyDproj->GetXaxis()->SetTitle("p^{MC}_{T} [GeV/c]");
486 efficiencyDproj->GetXaxis()->SetRangeUser(0.0,fPtMax);
487 efficiencyDproj->GetYaxis()->SetRangeUser(0.0,1.0);
488 efficiencyDproj->SetStats(0);
489 efficiencyDproj->SetTitle("");
490 efficiencyDproj->GetYaxis()->SetTitleOffset(1.5);
491 efficiencyDproj->SetMarkerStyle(26);
492 efficiencyDproj->SetMarkerColor(kBlue);
493 efficiencyDproj->SetLineColor(kBlue);
494 efficiencyDproj->Sumw2();
495 efficiencyDproj->Draw("P");
496 cunfolding->cd(4);
497 TH2F *projectioncorr = (TH2F *) correlation->Projection(0,ndimcor);
498 projectioncorr->GetYaxis()->SetTitle("p^{ESD}_{T} [GeV/c]");
499 projectioncorr->GetXaxis()->SetTitle("p^{MC}_{T} [GeV/c]");
500 projectioncorr->GetXaxis()->SetRangeUser(0.0,fPtMax);
501 projectioncorr->GetYaxis()->SetRangeUser(0.0,fPtMax);
502 projectioncorr->SetStats(0);
503 projectioncorr->SetTitle("");
504 projectioncorr->Draw("colz");
505
506 if(fWriteToFile){
507 cunfolding->SaveAs("Unfolding.png");
508 }
509
510}
511//____________________________________________________________
512void AliHFEInclusiveSpectrumQA::DrawResult()
513{
514 //
515 // Draw Results
516 //
517 TGraphErrors* correctedspectrumD = (TGraphErrors *) fListOfResult->UncheckedAt(kFinalResultUnfolded);
518 TGraphErrors* alltogetherspectrumD = (TGraphErrors *) fListOfResult->UncheckedAt( kFinalResultDirectEfficiency);
519 if(!correctedspectrumD || !alltogetherspectrumD) return;
520
521 SetStyle();
522
523 TCanvas * ccorrected = new TCanvas("corrected","corrected",1000,700);
524 ccorrected->Divide(2,1);
525 ccorrected->cd(1);
526 gPad->SetLogy();
527 gPad->SetTicks();
528 correctedspectrumD->SetTitle("");
529 correctedspectrumD->GetYaxis()->SetTitleOffset(1.5);
530 correctedspectrumD->GetYaxis()->SetRangeUser(0.000001,100.0);
531 correctedspectrumD->GetXaxis()->SetRangeUser(0.0,fPtMax);
532 correctedspectrumD->SetMarkerStyle(26);
533 correctedspectrumD->SetMarkerColor(kBlue);
534 correctedspectrumD->SetLineColor(kBlue);
535 correctedspectrumD->Draw("AP");
536 alltogetherspectrumD->SetTitle("");
537 alltogetherspectrumD->GetYaxis()->SetTitleOffset(1.5);
538 alltogetherspectrumD->GetYaxis()->SetRangeUser(0.000000001,1.0);
539 alltogetherspectrumD->SetMarkerStyle(25);
540 alltogetherspectrumD->SetMarkerColor(kBlack);
541 alltogetherspectrumD->SetLineColor(kBlack);
542 alltogetherspectrumD->Draw("P");
543 TLegend *legcorrected = new TLegend(0.4,0.6,0.89,0.89);
544 legcorrected->AddEntry(correctedspectrumD,"Unfolded","p");
545 legcorrected->AddEntry(alltogetherspectrumD,"Direct corrected","p");
546 legcorrected->SetFillStyle(0);
547 legcorrected->SetLineStyle(0);
548 legcorrected->SetLineColor(0);
549 legcorrected->Draw("same");
550 ccorrected->cd(2);
551 gPad->SetTicks();
552 TH1D* ratiocorrected = DivideSpectra(correctedspectrumD,alltogetherspectrumD);
553 ratiocorrected->SetName("ratiocorrected");
554 ratiocorrected->SetTitle("");
555 ratiocorrected->GetYaxis()->SetTitleOffset(1.5);
556 ratiocorrected->GetYaxis()->SetTitle("Unfolded/DirectCorrected");
557 ratiocorrected->GetXaxis()->SetTitle("p_{T} [GeV/c]");
558 ratiocorrected->GetXaxis()->SetRangeUser(0.0,fPtMax);
559 ratiocorrected->GetYaxis()->SetRangeUser(0.4,1.4);
560 ratiocorrected->SetStats(0);
561 ratiocorrected->Draw();
562 if(fWriteToFile)ccorrected->SaveAs("CorrectedResults.png");
563
564}
565//____________________________________________________________
566TH1D *AliHFEInclusiveSpectrumQA::DivideSpectra(TGraphErrors *ga, TGraphErrors *gb)
567{
568 //
569 // Divide Spectra
570 //
571
572 TH1D *afterE = (TH1D *) fListOfResult->UncheckedAt(kAfterMCE);
573 if(!afterE) return 0x0;
574
575 TH1D *histoB = (TH1D*) afterE->Clone();
576 histoB->Sumw2();
577 histoB->SetName("ratio");
578 TH1D *histoa = (TH1D*) afterE->Clone();
579 histoa->Sumw2();
580 histoa->SetName("a");
581 TH1D *histob = (TH1D*) afterE->Clone();
582 histob->Sumw2();
583 histob->SetName("b");
584
585 double xa,ya,xb,yb,eya,eyb;
586 Int_t npointsa = ga->GetN();
587 Int_t npointsb = gb->GetN();
588 if(npointsa != npointsb) {
589 printf("Problem the two spectra have not the same number of points\n");
590 return 0x0;
591 }
592 for(Int_t k = 0; k < npointsa; k++){
593 ga->GetPoint(k,xa,ya);
594 gb->GetPoint(k,xb,yb);
595 //
596 Double_t centerhisto = histoa->GetBinCenter(k+1);
597 //
598 if((TMath::Abs(xa-xb) > 0.0001) || (TMath::Abs(xa-centerhisto) > 0.0001)) {
599 printf("Problem not the same x axis\n");
600 return 0x0;
601 }
602 histoa->SetBinContent(k+1,ya);
603 histob->SetBinContent(k+1,yb);
604 //
605 eya = ga->GetErrorY(k);
606 eyb = gb->GetErrorY(k);
607 //
608 histoa->SetBinError(k+1,eya);
609 histob->SetBinError(k+1,eyb);
610
611 }
612
613 histoB->Sumw2();
614 histoB->Divide(histoa,histob,1.0,1.0,"B");
615
616 return histoB;
617
618}
619//__________________________________________
620void AliHFEInclusiveSpectrumQA::SetStyle() const
621{
622 //
623 // Set style
624 //
625
626 gStyle->SetPalette(1);
627 gStyle->SetOptStat(1111);
628 gStyle->SetPadBorderMode(0);
629 gStyle->SetCanvasColor(10);
630 gStyle->SetPadLeftMargin(0.13);
631 gStyle->SetPadRightMargin(0.13);
632
633}