]>
Commit | Line | Data |
---|---|---|
1afae8ff | 1 | /* $Id$ */ |
2 | ||
0ab29cfa | 3 | #if !defined(__CINT__) || defined(__MAKECINT__) |
4 | ||
5 | #include "AliPWG0Helper.h" | |
6 | #include "dNdEtaAnalysis.h" | |
7 | #include "AlidNdEtaCorrection.h" | |
8 | ||
9 | #include <TCanvas.h> | |
10 | #include <TFile.h> | |
11 | #include <TH1.h> | |
12 | #include <TH2F.h> | |
13 | #include <TH3F.h> | |
14 | #include <TLine.h> | |
15 | #include <TSystem.h> | |
16 | ||
17 | #endif | |
18 | ||
25db2d85 | 19 | Int_t gMax = 5; |
20 | ||
0ab29cfa | 21 | extern TSystem* gSystem; |
22 | ||
23 | void SetRanges(TAxis* axis) | |
92d2d8ad | 24 | { |
0ab29cfa | 25 | if (strcmp(axis->GetTitle(), "#eta") == 0) |
26 | axis->SetRangeUser(-1.7999, 1.7999); | |
27 | if (strcmp(axis->GetTitle(), "p_{T} [GeV/c]") == 0) | |
28 | axis->SetRangeUser(0, 9.9999); | |
29 | if (strcmp(axis->GetTitle(), "vtx z [cm]") == 0) | |
30 | axis->SetRangeUser(-15, 14.9999); | |
31 | if (strcmp(axis->GetTitle(), "Ntracks") == 0) | |
32 | axis->SetRangeUser(0, 99.9999); | |
25db2d85 | 33 | } |
34 | ||
0ab29cfa | 35 | void SetRanges(TH1* hist) |
25db2d85 | 36 | { |
0ab29cfa | 37 | SetRanges(hist->GetXaxis()); |
38 | SetRanges(hist->GetYaxis()); | |
39 | SetRanges(hist->GetZaxis()); | |
40 | } | |
25db2d85 | 41 | |
0ab29cfa | 42 | |
43 | void Prepare3DPlot(TH3* hist) | |
44 | { | |
45 | hist->GetXaxis()->SetTitleOffset(1.5); | |
46 | hist->GetYaxis()->SetTitleOffset(1.5); | |
47 | hist->GetZaxis()->SetTitleOffset(1.5); | |
48 | ||
49 | hist->SetStats(kFALSE); | |
50 | } | |
51 | ||
52 | void Prepare2DPlot(TH2* hist) | |
53 | { | |
54 | hist->SetStats(kFALSE); | |
55 | hist->GetYaxis()->SetTitleOffset(1.4); | |
56 | ||
57 | hist->SetMinimum(0); | |
58 | hist->SetMaximum(gMax); | |
59 | ||
60 | SetRanges(hist); | |
61 | } | |
62 | ||
63 | void Prepare1DPlot(TH1* hist) | |
64 | { | |
65 | hist->SetLineWidth(2); | |
66 | hist->SetStats(kFALSE); | |
67 | ||
72e597d7 | 68 | hist->GetXaxis()->SetLabelOffset(0.02); |
69 | hist->GetXaxis()->SetTitleOffset(1.3); | |
70 | hist->GetYaxis()->SetTitleOffset(1.3); | |
71 | ||
0ab29cfa | 72 | SetRanges(hist); |
73 | } | |
74 | ||
75 | void InitPad() | |
76 | { | |
77 | gPad->Range(0, 0, 1, 1); | |
78 | gPad->SetLeftMargin(0.15); | |
79 | //gPad->SetRightMargin(0.05); | |
80 | //gPad->SetTopMargin(0.13); | |
72e597d7 | 81 | gPad->SetBottomMargin(0.12); |
0ab29cfa | 82 | |
72e597d7 | 83 | gPad->SetGridx(); |
84 | gPad->SetGridy(); | |
0ab29cfa | 85 | } |
86 | ||
87 | void InitPadCOLZ() | |
88 | { | |
89 | gPad->Range(0, 0, 1, 1); | |
90 | gPad->SetRightMargin(0.15); | |
91 | gPad->SetLeftMargin(0.12); | |
92 | ||
93 | gPad->SetGridx(); | |
94 | gPad->SetGridy(); | |
d09fb536 | 95 | } |
96 | ||
8ca1a6d9 | 97 | void ComparedNdEta(const char* ESDfolder = "dndeta", const char* MCfolder = "dndeta", const char* esdFile = "analysis_esd.root", const char* mcFile = "analysis_mc.root") |
98 | { | |
99 | gSystem->Load("libPWG0base"); | |
100 | ||
101 | TFile::Open(esdFile); | |
102 | dNdEtaAnalysis* fdNdEtaAnalysisESD = new dNdEtaAnalysis(ESDfolder, ESDfolder); | |
103 | fdNdEtaAnalysisESD->LoadHistograms(); | |
104 | ||
105 | TFile::Open(mcFile); | |
106 | dNdEtaAnalysis* fdNdEtaAnalysisMC = new dNdEtaAnalysis(MCfolder, MCfolder); | |
107 | fdNdEtaAnalysisMC->LoadHistograms(); | |
108 | fdNdEtaAnalysisMC->Finish(0, 0.3); | |
109 | ||
110 | for (Int_t i=0; i<dNdEtaAnalysis::kVertexBinning; ++i) | |
111 | fdNdEtaAnalysisESD->GetdNdEtaHistogram(i)->Divide(fdNdEtaAnalysisMC->GetdNdEtaHistogram(i)); | |
112 | ||
113 | fdNdEtaAnalysisESD->DrawHistograms(); | |
114 | } | |
115 | ||
116 | void CompareVertexDist(Int_t plot = 0, const char* correctionMapFile = "correction_map.root", const char* correctionMapFolder = "dndeta_correction") | |
117 | { | |
118 | gSystem->Load("libPWG0base"); | |
119 | ||
120 | const char* ESDfolder = 0; | |
121 | ||
122 | if (plot == 0) // all | |
123 | ESDfolder = "dndeta"; | |
124 | else if (plot == 1) // mb | |
125 | ESDfolder = "dndeta_mb"; | |
126 | else if (plot == 2) // mb vtx | |
127 | ESDfolder = "dndeta_mbvtx"; | |
128 | ||
129 | TFile::Open("analysis_esd.root"); | |
130 | dNdEtaAnalysis* fdNdEtaAnalysisESD = new dNdEtaAnalysis(ESDfolder, ESDfolder); | |
131 | fdNdEtaAnalysisESD->LoadHistograms(); | |
132 | ||
133 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(correctionMapFolder, correctionMapFolder); | |
134 | dNdEtaCorrection->LoadHistograms(correctionMapFile, correctionMapFolder); | |
135 | ||
136 | TH2F* hist = 0; | |
137 | ||
138 | if (plot == 0) // all | |
139 | hist = dNdEtaCorrection->GetTriggerBiasCorrection()->GetGeneratedHistogram(); | |
140 | else if (plot == 1) // mb | |
141 | hist = dNdEtaCorrection->GetTriggerBiasCorrection()->GetMeasuredHistogram(); | |
142 | else if (plot == 2) // mb vtx | |
143 | hist = dNdEtaCorrection->GetVertexRecoCorrection()->GetMeasuredHistogram(); | |
144 | ||
145 | TH1* proj = hist->ProjectionX(); | |
146 | ||
147 | TH1* vertex = fdNdEtaAnalysisESD->GetVtxHistogram(); | |
148 | for (Int_t i=1; i<=vertex->GetNbinsX(); ++i) | |
149 | { | |
150 | Float_t value = proj->GetBinContent(proj->FindBin(vertex->GetBinCenter(i))); | |
151 | if (value != 0) | |
152 | { | |
153 | printf("vtx = %f, esd = %f, corr = %f, ratio = %f\n", vertex->GetBinCenter(i), vertex->GetBinContent(i), value, vertex->GetBinContent(i) / value); | |
154 | vertex->SetBinContent(i, vertex->GetBinContent(i) / value); | |
155 | } | |
156 | } | |
157 | ||
158 | new TCanvas; | |
159 | vertex->DrawCopy(); | |
160 | } | |
161 | ||
162 | void CompareTrack2ParticleWithAnalysisData(const char* correctionMapFile = "correction_map.root", const char* correctionMapFolder = "dndeta_correction") | |
163 | { | |
164 | gSystem->Load("libPWG0base"); | |
165 | ||
166 | TFile::Open("analysis_esd.root"); | |
167 | dNdEtaAnalysis* fdNdEtaAnalysisESD = new dNdEtaAnalysis("dndeta_mbvtx", "dndeta_mbvtx"); | |
168 | fdNdEtaAnalysisESD->LoadHistograms(); | |
169 | ||
170 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(correctionMapFolder, correctionMapFolder); | |
171 | dNdEtaCorrection->LoadHistograms(correctionMapFile, correctionMapFolder); | |
172 | ||
173 | //TH1* histESD = fdNdEtaAnalysisESD->GetUncorrectedHistogram(); | |
174 | //TH1* histCorr = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetMeasuredHistogram(); | |
175 | ||
176 | TH1* histESD = fdNdEtaAnalysisESD->GetHistogram(); | |
177 | TH1* histCorr = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetGeneratedHistogram(); | |
178 | ||
179 | TH1F* diff = new TH1F("diff", "diff", 100, 0.98, 1.02); | |
180 | ||
181 | new TCanvas; | |
182 | histESD->Draw(); | |
183 | ||
184 | new TCanvas; | |
185 | histCorr->Draw(); | |
186 | ||
187 | for (Int_t x=1; x<=histESD->GetNbinsX(); ++x) | |
188 | for (Int_t y=1; y<=histESD->GetNbinsY(); ++y) | |
189 | for (Int_t z=1; z<=histESD->GetNbinsZ(); ++z) | |
190 | { | |
191 | Float_t value1 = histESD->GetBinContent(x, y, z); | |
192 | Float_t value2 = histCorr->GetBinContent(histCorr->FindBin(histESD->GetXaxis()->GetBinCenter(x), histESD->GetYaxis()->GetBinCenter(y), histESD->GetZaxis()->GetBinCenter(z))); | |
193 | ||
194 | if (value2 > 0 && value1 > 0) | |
195 | { | |
196 | printf("%f %f %f\n", value1, value2, value1 / value2); | |
197 | diff->Fill(value1 / value2); | |
198 | } | |
199 | } | |
200 | ||
201 | new TCanvas; | |
202 | diff->Draw(); | |
203 | } | |
204 | ||
0ab29cfa | 205 | void dNdEta(Bool_t onlyESD = kFALSE) |
d09fb536 | 206 | { |
207 | TFile* file = TFile::Open("analysis_esd.root"); | |
0ab29cfa | 208 | TH1* histESD = (TH1*) file->Get("dndeta/dndeta_dNdEta_corrected_2"); |
209 | TH1* histESDNoPt = (TH1*) file->Get("dndeta/dndeta_dNdEta_2"); | |
210 | TH1* histESDMB = (TH1*) file->Get("dndeta_mb/dndeta_mb_dNdEta_corrected_2"); | |
211 | TH1* histESDMBVtx = (TH1*) file->Get("dndeta_mbvtx/dndeta_mbvtx_dNdEta_corrected_2"); | |
d09fb536 | 212 | |
213 | TCanvas* canvas = new TCanvas("dNdEta1", "dNdEta1", 500, 500); | |
214 | ||
215 | Prepare1DPlot(histESD); | |
216 | Prepare1DPlot(histESDNoPt); | |
217 | Prepare1DPlot(histESDMB); | |
218 | Prepare1DPlot(histESDMBVtx); | |
219 | ||
72e597d7 | 220 | histESD->SetLineColor(0); |
221 | histESDMB->SetLineColor(0); | |
222 | histESDMBVtx->SetLineColor(0); | |
223 | ||
224 | histESD->SetMarkerColor(kRed); | |
225 | histESDMB->SetMarkerColor(kBlue); | |
226 | histESDMBVtx->SetMarkerColor(103); | |
227 | ||
228 | histESD->SetMarkerStyle(20); | |
229 | histESDMB->SetMarkerStyle(21); | |
230 | histESDMBVtx->SetMarkerStyle(22); | |
d09fb536 | 231 | |
8ca1a6d9 | 232 | TH2F* dummy = new TH2F("dummy", "", 100, -1.5, 1.5, 1000, 0.1, histESDMBVtx->GetMaximum() * 1.1); |
72e597d7 | 233 | Prepare1DPlot(dummy); |
d09fb536 | 234 | dummy->SetStats(kFALSE); |
235 | dummy->SetXTitle("#eta"); | |
72e597d7 | 236 | dummy->SetYTitle("dN_{ch}/d#eta"); |
237 | dummy->GetYaxis()->SetTitleOffset(1); | |
d09fb536 | 238 | |
8ca1a6d9 | 239 | Float_t etaLimit = 0.7999; |
4c351225 | 240 | |
241 | histESDMBVtx->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
242 | histESDMB->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
243 | histESD->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
244 | histESDNoPt->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
d09fb536 | 245 | |
0ab29cfa | 246 | dummy->DrawCopy(); |
d09fb536 | 247 | histESDMBVtx->Draw("SAME"); |
248 | histESDMB->Draw("SAME"); | |
249 | histESD->Draw("SAME"); | |
250 | ||
251 | canvas->SaveAs("dNdEta1.gif"); | |
0ab29cfa | 252 | canvas->SaveAs("dNdEta1.eps"); |
253 | ||
254 | if (onlyESD) | |
255 | return; | |
d09fb536 | 256 | |
257 | TFile* file2 = TFile::Open("analysis_mc.root"); | |
0ab29cfa | 258 | TH1* histMC = (TH1*) file2->Get("dndeta/dndeta_dNdEta_corrected_2")->Clone("cloned"); |
d09fb536 | 259 | |
260 | gSystem->Load("libPWG0base"); | |
0ab29cfa | 261 | dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta"); |
d09fb536 | 262 | fdNdEtaAnalysis->LoadHistograms(); |
263 | fdNdEtaAnalysis->Finish(0, 0.3); | |
264 | TH1* histMCPtCut = fdNdEtaAnalysis->GetdNdEtaHistogram(2); | |
265 | ||
266 | TCanvas* canvas2 = new TCanvas("dNdEta2", "dNdEta2", 500, 500); | |
267 | ||
268 | Prepare1DPlot(histMC); | |
269 | Prepare1DPlot(histMCPtCut); | |
270 | ||
271 | histMC->SetLineColor(kBlue); | |
272 | histMCPtCut->SetLineColor(104); | |
273 | histESDNoPt->SetLineColor(102); | |
274 | ||
0ab29cfa | 275 | TH2* dummy2 = (TH2F*) dummy->Clone("dummy2"); |
72e597d7 | 276 | Prepare1DPlot(dummy2); |
d09fb536 | 277 | dummy2->GetYaxis()->SetRangeUser(0, histESD->GetMaximum() * 1.1); |
278 | ||
0ab29cfa | 279 | dummy2->DrawCopy(); |
d09fb536 | 280 | histMC->Draw("SAME"); |
281 | // histMC->Draw(); | |
282 | histESD->Draw("SAME"); | |
283 | histESDNoPt->Draw("SAME"); | |
284 | histMCPtCut->Draw("SAME"); | |
285 | ||
286 | canvas2->SaveAs("dNdEta2.gif"); | |
0ab29cfa | 287 | canvas2->SaveAs("dNdEta2.eps"); |
288 | ||
8ca1a6d9 | 289 | TH1* ratio = (TH1*) histMC->Clone("ratio"); |
290 | TH1* ratioNoPt = (TH1*) histMCPtCut->Clone("ratioNoPt"); | |
291 | ||
292 | ratio->Divide(histESD); | |
293 | ratioNoPt->Divide(histESDNoPt); | |
294 | ||
295 | ratio->GetXaxis()->SetRangeUser(-0.7999, 0.7999); | |
296 | ||
297 | ratio->SetLineColor(1); | |
298 | ratioNoPt->SetLineColor(2); | |
299 | ||
300 | TCanvas* canvas3 = new TCanvas("dNdEta", "dNdEta", 700, 700); | |
301 | canvas3->Range(0, 0, 1, 1); | |
302 | //canvas3->Divide(1, 2, 0, 0); | |
303 | ||
304 | //canvas3->cd(1); | |
305 | TPad* pad1 = new TPad("dNdEta_1", "", 0, 0.4, 0.98, 0.98); | |
306 | pad1->Draw(); | |
307 | ||
308 | TPad* pad2 = new TPad("dNdEta_2", "", 0, 0.02, 0.98, 0.4); | |
309 | pad2->Draw(); | |
310 | ||
311 | pad1->SetRightMargin(0.05); | |
312 | pad2->SetRightMargin(0.05); | |
0ab29cfa | 313 | |
8ca1a6d9 | 314 | // no border between them |
315 | pad1->SetBottomMargin(0); | |
316 | pad2->SetTopMargin(0); | |
317 | ||
318 | pad1->cd(); | |
319 | ||
320 | TLegend* legend = new TLegend(0.4, 0.2, 0.65, 0.4); | |
72e597d7 | 321 | legend->SetFillColor(0); |
322 | legend->AddEntry(histESDMBVtx, "triggered, vertex"); | |
323 | legend->AddEntry(histESDMB, "triggered"); | |
324 | legend->AddEntry(histESD, "all events"); | |
325 | legend->AddEntry(histMC, "MC prediction"); | |
0ab29cfa | 326 | |
72e597d7 | 327 | dummy->DrawCopy(); |
0ab29cfa | 328 | histESDMBVtx->Draw("SAME"); |
329 | histESDMB->Draw("SAME"); | |
330 | histESD->Draw("SAME"); | |
0ab29cfa | 331 | histMC->Draw("SAME"); |
72e597d7 | 332 | |
333 | legend->Draw(); | |
0ab29cfa | 334 | |
8ca1a6d9 | 335 | pad2->cd(); |
336 | pad2->SetBottomMargin(0.15); | |
72e597d7 | 337 | |
8ca1a6d9 | 338 | TH1F dummy3("dummy3", ";#eta;Ratio: MC / ESD", 1, -1.5, 1.5); |
339 | dummy3.SetStats(kFALSE); | |
340 | dummy3.SetBinContent(1, 1); | |
341 | dummy3.GetYaxis()->SetRangeUser(0.961, 1.049); | |
342 | dummy3.SetLineWidth(2); | |
343 | dummy3.GetXaxis()->SetLabelSize(0.06); | |
344 | dummy3.GetYaxis()->SetLabelSize(0.06); | |
345 | dummy3.GetXaxis()->SetTitleSize(0.06); | |
346 | dummy3.GetYaxis()->SetTitleSize(0.06); | |
347 | dummy3.GetYaxis()->SetTitleOffset(0.7); | |
348 | dummy3.DrawCopy(); | |
72e597d7 | 349 | |
8ca1a6d9 | 350 | ratio->Draw("SAME"); |
72e597d7 | 351 | |
8ca1a6d9 | 352 | //pad2->Draw(); |
72e597d7 | 353 | |
8ca1a6d9 | 354 | canvas3->Modified(); |
72e597d7 | 355 | |
8ca1a6d9 | 356 | canvas3->SaveAs("dNdEta.gif"); |
357 | canvas3->SaveAs("dNdEta.eps"); | |
358 | ||
359 | TCanvas* canvas4 = new TCanvas("ratio", "ratio", 700, 500); | |
72e597d7 | 360 | |
361 | ratio->Draw(); | |
362 | ratioNoPt->Draw("SAME"); | |
363 | ||
4c351225 | 364 | TLegend* legend = new TLegend(0.6, 0.7, 0.95, 0.9); |
365 | legend->SetFillColor(0); | |
366 | legend->AddEntry(ratio, "mc/esd"); | |
367 | legend->AddEntry(ratioNoPt, "mc/esd, not pt cut off corrected"); | |
368 | legend->Draw(); | |
d09fb536 | 369 | } |
370 | ||
371 | void ptSpectrum() | |
372 | { | |
373 | TFile* file = TFile::Open("analysis_esd.root"); | |
0ab29cfa | 374 | TH1* histESD = (TH1*) file->Get("dndeta/dndeta_pt"); |
d09fb536 | 375 | |
376 | TFile* file2 = TFile::Open("analysis_mc.root"); | |
0ab29cfa | 377 | TH1* histMC = (TH1*) file2->Get("dndeta/dndeta_pt"); |
d09fb536 | 378 | |
379 | TCanvas* canvas = new TCanvas("ptSpectrum", "ptSpectrum", 500, 500); | |
380 | InitPad(); | |
381 | gPad->SetLogy(); | |
382 | ||
383 | Prepare1DPlot(histMC); | |
384 | Prepare1DPlot(histESD); | |
385 | ||
386 | histESD->SetTitle(""); | |
25db2d85 | 387 | histESD->GetXaxis()->SetTitle("p_{T} [GeV/c]"); |
388 | histESD->GetYaxis()->SetTitle("#frac{dN}{d#eta dp_{T}} [c/GeV]"); | |
d09fb536 | 389 | |
390 | histMC->SetLineColor(kBlue); | |
391 | histESD->SetLineColor(kRed); | |
392 | ||
393 | histESD->GetYaxis()->SetTitleOffset(1.5); | |
394 | histESD->GetXaxis()->SetRangeUser(0, 4.9999); | |
395 | ||
396 | histESD->SetMaximum(TMath::Max(histESD->GetMaximum(), histMC->GetMaximum()) * 2); | |
397 | ||
398 | histESD->Draw(); | |
399 | histMC->Draw("SAME"); | |
400 | ||
401 | canvas->SaveAs("ptSpectrum.gif"); | |
0ab29cfa | 402 | canvas->SaveAs("ptSpectrum.eps"); |
92d2d8ad | 403 | } |
404 | ||
405 | void ptCutoff() | |
406 | { | |
407 | gSystem->Load("libPWG0base"); | |
408 | ||
8b3563f4 | 409 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction"); |
92d2d8ad | 410 | dNdEtaCorrection->LoadHistograms("correction_map.root","dndeta_correction"); |
411 | ||
72e597d7 | 412 | dNdEtaCorrection->GetMeasuredFraction(0.3, -100, kTRUE); |
92d2d8ad | 413 | |
72e597d7 | 414 | TH1* hist = dynamic_cast<TH1*> (gROOT->FindObject("gene_dndeta_correction_nTrackToNPart_pt")->Clone("ptcutoff")); |
92d2d8ad | 415 | |
416 | hist->GetXaxis()->SetRangeUser(0, 0.9999); | |
417 | hist->SetMinimum(0); | |
92d2d8ad | 418 | |
419 | hist->SetTitle("Generated Particles"); | |
d09fb536 | 420 | Prepare1DPlot(hist); |
92d2d8ad | 421 | |
72e597d7 | 422 | TCanvas* canvas = new TCanvas("ptCutoff", "ptCutoff", 700, 500); |
423 | hist->DrawCopy(); | |
92d2d8ad | 424 | |
d09fb536 | 425 | TLine* line = new TLine(0.3, 0 - hist->GetMaximum() * 0, 0.3, hist->GetMaximum() * 1.1); |
92d2d8ad | 426 | line->SetLineWidth(3); |
d09fb536 | 427 | line->SetLineColor(kRed); |
92d2d8ad | 428 | line->Draw(); |
429 | ||
430 | canvas->SaveAs("ptCutoff.gif"); | |
0ab29cfa | 431 | canvas->SaveAs("ptCutoff.eps"); |
72e597d7 | 432 | |
433 | TH1F* factor = new TH1F("factor", ";#eta;correction factor", 10, -1, 1.000001); | |
434 | for (Float_t eta = -0.9; eta<1; eta += 0.2) | |
435 | factor->Fill(eta, 1.0 / dNdEtaCorrection->GetMeasuredFraction(0.3, eta, kFALSE)); | |
436 | ||
437 | TCanvas* canvas = new TCanvas("ptCutoff_factor", "ptCutoff_factor", 700, 500); | |
438 | InitPad(); | |
439 | ||
440 | Prepare1DPlot(factor); | |
441 | factor->GetYaxis()->SetRangeUser(1, 2); | |
442 | factor->GetYaxis()->SetTitleOffset(1); | |
443 | factor->Draw(); | |
444 | ||
445 | canvas->SaveAs("ptCutoff_factor.eps"); | |
92d2d8ad | 446 | } |
447 | ||
0bd1f8a0 | 448 | void TriggerBiasVtxRecon(const char* fileName = "correction_map.root", const char* folder = "dndeta_correction") |
92d2d8ad | 449 | { |
0ab29cfa | 450 | TFile* file = TFile::Open(fileName); |
451 | ||
0bd1f8a0 | 452 | TH2* corrTrigger = dynamic_cast<TH2*> (file->Get(Form("%s/corr_%s_trigger", folder, folder))); |
453 | TH2* corrVtx = dynamic_cast<TH2*> (file->Get(Form("%s/corr_%s_vtxReco", folder, folder))); | |
0ab29cfa | 454 | |
455 | Prepare2DPlot(corrTrigger); | |
456 | corrTrigger->SetTitle("a) Trigger bias correction"); | |
457 | ||
458 | Prepare2DPlot(corrVtx); | |
459 | corrVtx->SetTitle("b) Vertex reconstruction correction"); | |
460 | ||
5c495d37 | 461 | corrTrigger->GetYaxis()->SetTitle("Multiplicity"); |
462 | corrVtx->GetYaxis()->SetTitle("Multiplicity"); | |
463 | ||
0ab29cfa | 464 | TCanvas* canvas = new TCanvas("TriggerBiasVtxRecon", "TriggerBiasVtxRecon", 1000, 500); |
465 | canvas->Divide(2, 1); | |
466 | ||
467 | canvas->cd(1); | |
468 | InitPadCOLZ(); | |
469 | corrTrigger->DrawCopy("COLZ"); | |
470 | ||
471 | canvas->cd(2); | |
472 | InitPadCOLZ(); | |
473 | corrVtx->DrawCopy("COLZ"); | |
474 | ||
475 | canvas->SaveAs(Form("TriggerBiasVtxRecon_%d.gif", gMax)); | |
476 | canvas->SaveAs(Form("TriggerBiasVtxRecon_%d.eps", gMax)); | |
477 | ||
478 | canvas = new TCanvas("TriggerBiasVtxReconZoom", "TriggerBiasVtxReconZoom", 1000, 500); | |
479 | canvas->Divide(2, 1); | |
480 | ||
481 | corrTrigger->GetYaxis()->SetRangeUser(0, 5); | |
482 | corrVtx->GetYaxis()->SetRangeUser(0, 5); | |
483 | ||
484 | canvas->cd(1); | |
485 | InitPadCOLZ(); | |
486 | corrTrigger->DrawCopy("COLZ"); | |
487 | ||
488 | canvas->cd(2); | |
489 | InitPadCOLZ(); | |
490 | corrVtx->DrawCopy("COLZ"); | |
491 | ||
492 | canvas->SaveAs(Form("TriggerBiasVtxReconZoom_%d.gif", gMax)); | |
493 | canvas->SaveAs(Form("TriggerBiasVtxReconZoom_%d.eps", gMax)); | |
494 | } | |
495 | ||
496 | void TriggerBias(const char* fileName = "correction_map.root") | |
497 | { | |
498 | TFile* file = TFile::Open(fileName); | |
92d2d8ad | 499 | |
5c495d37 | 500 | TH2* corr = dynamic_cast<TH2*> (file->Get("dndeta_correction/corr_dndeta_correction_trigger")); |
92d2d8ad | 501 | |
502 | Prepare2DPlot(corr); | |
503 | corr->SetTitle("Trigger bias correction"); | |
504 | ||
505 | TCanvas* canvas = new TCanvas("TriggerBias", "TriggerBias", 500, 500); | |
506 | InitPadCOLZ(); | |
507 | corr->DrawCopy("COLZ"); | |
508 | ||
25db2d85 | 509 | canvas->SaveAs(Form("TriggerBias_%d.gif", gMax)); |
0ab29cfa | 510 | canvas->SaveAs(Form("TriggerBias_%d.eps", gMax)); |
92d2d8ad | 511 | |
512 | corr->GetYaxis()->SetRangeUser(0, 5); | |
513 | ||
514 | canvas = new TCanvas("TriggerBiasZoom", "TriggerBiasZoom", 500, 500); | |
515 | InitPadCOLZ(); | |
516 | corr->DrawCopy("COLZ"); | |
517 | ||
25db2d85 | 518 | canvas->SaveAs(Form("TriggerBiasZoom_%d.gif", gMax)); |
0ab29cfa | 519 | canvas->SaveAs(Form("TriggerBiasZoom_%d.eps", gMax)); |
92d2d8ad | 520 | } |
521 | ||
72e597d7 | 522 | void TriggerBias1D(const char* fileName = "correction_map.root", const char* folderName = "dndeta_correction") |
523 | { | |
524 | gSystem->Load("libPWG0base"); | |
525 | ||
526 | TFile* file = TFile::Open(fileName); | |
527 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(folderName, folderName); | |
528 | dNdEtaCorrection->LoadHistograms(fileName, folderName); | |
529 | ||
8ca1a6d9 | 530 | TH1* hist = dNdEtaCorrection->GetTriggerBiasCorrection()->Get1DCorrection("x"); |
531 | TH1* hist2 = dNdEtaCorrection->GetTriggerBiasCorrection()->Get1DCorrection("y", -10, 10); | |
72e597d7 | 532 | |
8ca1a6d9 | 533 | TCanvas* canvas = new TCanvas("VtxRecon1D", "VtxRecon1D", 1000, 500); |
534 | canvas->Divide(2, 1); | |
535 | ||
536 | canvas->cd(1); | |
72e597d7 | 537 | InitPad(); |
538 | ||
539 | Prepare1DPlot(hist); | |
540 | hist->SetTitle(""); | |
541 | hist->GetYaxis()->SetTitle("correction factor"); | |
542 | hist->GetYaxis()->SetRangeUser(1, 1.5); | |
543 | hist->GetYaxis()->SetTitleOffset(1.6); | |
544 | hist->Draw(); | |
545 | ||
8ca1a6d9 | 546 | canvas->cd(2); |
547 | InitPad(); | |
548 | ||
549 | Prepare1DPlot(hist2); | |
550 | hist2->SetTitle(""); | |
551 | hist2->GetYaxis()->SetTitle("correction factor"); | |
552 | hist2->GetXaxis()->SetRangeUser(0, 5); | |
553 | hist2->GetYaxis()->SetTitleOffset(1.6); | |
554 | hist2->GetXaxis()->SetTitle("multiplicity"); | |
555 | hist2->Draw(); | |
556 | ||
557 | TPaveText* pave = new TPaveText(0.6, 0.8, 0.8, 0.85, "NDC"); | |
558 | pave->SetFillColor(0); | |
559 | pave->AddText("|z| < 10 cm"); | |
560 | pave->Draw(); | |
561 | ||
72e597d7 | 562 | canvas->SaveAs("TriggerBias1D.eps"); |
563 | } | |
564 | ||
92d2d8ad | 565 | void VtxRecon() |
566 | { | |
567 | TFile* file = TFile::Open("correction_map.root"); | |
568 | ||
72e597d7 | 569 | TH2* corr = dynamic_cast<TH2*> (file->Get("dndeta_correction/corr_dndeta_correction_vtxReco")); |
92d2d8ad | 570 | |
571 | Prepare2DPlot(corr); | |
572 | corr->SetTitle("Vertex reconstruction correction"); | |
573 | ||
574 | TCanvas* canvas = new TCanvas("VtxRecon", "VtxRecon", 500, 500); | |
575 | InitPadCOLZ(); | |
25db2d85 | 576 | corr->DrawCopy("COLZ"); |
577 | ||
0ab29cfa | 578 | canvas->SaveAs(Form("VtxRecon_%d.eps", gMax)); |
579 | canvas->SaveAs(Form("VtxRecon_%d.eps", gMax)); | |
25db2d85 | 580 | |
581 | corr->GetYaxis()->SetRangeUser(0, 5); | |
582 | ||
0ab29cfa | 583 | canvas = new TCanvas("VtxReconZoom", "VtxReconZoom", 500, 500); |
25db2d85 | 584 | InitPadCOLZ(); |
585 | corr->DrawCopy("COLZ"); | |
92d2d8ad | 586 | |
25db2d85 | 587 | canvas->SaveAs(Form("VtxReconZoom_%d.gif", gMax)); |
0ab29cfa | 588 | canvas->SaveAs(Form("VtxReconZoom_%d.eps", gMax)); |
92d2d8ad | 589 | } |
590 | ||
72e597d7 | 591 | void VtxRecon1D(const char* fileName = "correction_map.root", const char* folderName = "dndeta_correction") |
592 | { | |
593 | gSystem->Load("libPWG0base"); | |
594 | ||
595 | TFile* file = TFile::Open(fileName); | |
596 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(folderName, folderName); | |
597 | dNdEtaCorrection->LoadHistograms(fileName, folderName); | |
598 | ||
599 | TH1* hist = dNdEtaCorrection->GetVertexRecoCorrection()->Get1DCorrection("x"); | |
8ca1a6d9 | 600 | TH1* hist2 = dNdEtaCorrection->GetVertexRecoCorrection()->Get1DCorrection("y", -10, 10); |
601 | ||
602 | TCanvas* canvas = new TCanvas("VtxRecon1D", "VtxRecon1D", 1000, 500); | |
603 | canvas->Divide(2, 1); | |
72e597d7 | 604 | |
8ca1a6d9 | 605 | canvas->cd(1); |
72e597d7 | 606 | InitPad(); |
607 | ||
608 | Prepare1DPlot(hist); | |
609 | hist->SetTitle(""); | |
610 | hist->GetYaxis()->SetTitle("correction factor"); | |
611 | hist->GetYaxis()->SetRangeUser(1, 1.8); | |
612 | hist->GetYaxis()->SetTitleOffset(1.6); | |
8ca1a6d9 | 613 | hist->DrawCopy(); |
614 | ||
615 | canvas->cd(2); | |
616 | InitPad(); | |
617 | ||
618 | Prepare1DPlot(hist2); | |
619 | hist2->SetTitle(""); | |
620 | hist2->GetYaxis()->SetTitle("correction factor"); | |
621 | hist2->GetXaxis()->SetRangeUser(0, 20); | |
622 | hist2->GetYaxis()->SetTitleOffset(1.6); | |
623 | hist2->GetXaxis()->SetTitle("multiplicity"); | |
624 | hist2->Draw(); | |
625 | ||
626 | TPaveText* pave = new TPaveText(0.6, 0.8, 0.8, 0.85, "NDC"); | |
627 | pave->SetFillColor(0); | |
628 | pave->AddText("|z| < 10 cm"); | |
629 | pave->Draw(); | |
72e597d7 | 630 | |
631 | canvas->SaveAs("VtxRecon1D.eps"); | |
8ca1a6d9 | 632 | |
633 | for (Int_t i=1; i<=hist->GetNbinsX() / 2; ++i) | |
634 | if (hist->GetBinContent(hist->GetNbinsX() + 1 - i) != 0) | |
635 | hist->SetBinContent(i, hist->GetBinContent(i) / hist->GetBinContent(hist->GetNbinsX() + 1 - i)); | |
636 | ||
637 | new TCanvas; | |
638 | hist->GetXaxis()->SetRange(1, hist->GetNbinsX() / 2); | |
639 | hist->GetYaxis()->SetRangeUser(0.8, 1.2); | |
640 | hist->DrawCopy(); | |
72e597d7 | 641 | } |
642 | ||
0ab29cfa | 643 | void Track2ParticleAsNumber(const char* fileName = "correction_map.root") |
1afae8ff | 644 | { |
25db2d85 | 645 | gSystem->Load("libPWG0base"); |
646 | ||
0ab29cfa | 647 | TFile::Open(fileName); |
8b3563f4 | 648 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction"); |
0ab29cfa | 649 | dNdEtaCorrection->LoadHistograms(fileName, "dndeta_correction"); |
650 | ||
651 | TH3F* gene = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetGeneratedHistogram(); | |
652 | TH3F* meas = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetMeasuredHistogram(); | |
653 | ||
654 | TH3F* gene = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetGeneratedHistogram(); | |
655 | TH3F* meas = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetMeasuredHistogram(); | |
656 | ||
657 | gene->GetYaxis()->SetRangeUser(-0.8, 0.8); | |
658 | meas->GetYaxis()->SetRangeUser(-0.8, 0.8); | |
659 | gene->GetXaxis()->SetRangeUser(-10, 10); | |
660 | meas->GetXaxis()->SetRangeUser(-10, 10); | |
661 | ||
662 | Float_t eff1 = gene->Integral() / meas->Integral(); | |
663 | Float_t error1 = TMath::Sqrt(gene->Integral()) / meas->Integral(); | |
664 | ||
665 | printf("Correction without pT cut: %f +- %f\n", eff1, error1); | |
666 | ||
667 | gene->GetZaxis()->SetRangeUser(0.3, 10); | |
668 | meas->GetZaxis()->SetRangeUser(0.3, 10); | |
669 | ||
670 | Float_t eff2 = gene->Integral() / meas->Integral(); | |
671 | Float_t error2 = TMath::Sqrt(gene->Integral()) / meas->Integral(); | |
672 | ||
673 | printf("Correction with pT cut: %f +- %f\n", eff2, error2); | |
674 | ||
675 | gene->GetZaxis()->SetRangeUser(0.3, 1); | |
676 | meas->GetZaxis()->SetRangeUser(0.3, 1); | |
677 | ||
678 | Float_t eff3 = gene->Integral() / meas->Integral(); | |
679 | Float_t error3 = TMath::Sqrt(gene->Integral()) / meas->Integral(); | |
680 | ||
681 | printf("Correction with 0.3 < pT < 0.5: %f +- %f\n", eff3, error3); | |
682 | } | |
683 | ||
bdfe2916 | 684 | void Track2Particle1DCreatePlots(const char* fileName = "correction_map.root", const char* folderName = "dndeta_correction", Float_t upperPtLimit = 10) |
0ab29cfa | 685 | { |
686 | TFile::Open(fileName); | |
bdfe2916 | 687 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(folderName, folderName); |
688 | dNdEtaCorrection->LoadHistograms(fileName, folderName); | |
0ab29cfa | 689 | |
690 | TH3F* gene = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetGeneratedHistogram(); | |
691 | TH3F* meas = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetMeasuredHistogram(); | |
692 | ||
693 | gene->GetZaxis()->SetRangeUser(0.3, upperPtLimit); | |
694 | meas->GetZaxis()->SetRangeUser(0.3, upperPtLimit); | |
695 | gene->GetYaxis()->SetRangeUser(-0.8, 0.8); | |
696 | meas->GetYaxis()->SetRangeUser(-0.8, 0.8); | |
697 | AliPWG0Helper::CreateDividedProjections(gene, meas, "x", kTRUE); | |
698 | gene->GetYaxis()->SetRange(0, 0); | |
699 | meas->GetYaxis()->SetRange(0, 0); | |
700 | ||
701 | gene->GetXaxis()->SetRangeUser(-10, 10); | |
702 | meas->GetXaxis()->SetRangeUser(-10, 10); | |
703 | AliPWG0Helper::CreateDividedProjections(gene, meas, "y", kTRUE); | |
704 | gene->GetZaxis()->SetRange(0, 0); | |
705 | meas->GetZaxis()->SetRange(0, 0); | |
706 | ||
707 | gene->GetYaxis()->SetRangeUser(-0.8, 0.8); | |
708 | meas->GetYaxis()->SetRangeUser(-0.8, 0.8); | |
709 | AliPWG0Helper::CreateDividedProjections(gene, meas, "z", kTRUE); | |
710 | } | |
25db2d85 | 711 | |
72e597d7 | 712 | void Track2Particle1D(const char* fileName = "correction_map.root", const char* folder = "dndeta_correction", Float_t upperPtLimit = 9.9) |
0ab29cfa | 713 | { |
714 | gSystem->Load("libPWG0base"); | |
715 | ||
72e597d7 | 716 | Track2Particle1DCreatePlots(fileName, folder, upperPtLimit); |
0ab29cfa | 717 | |
72e597d7 | 718 | TH1* corrX = dynamic_cast<TH1*> (gROOT->FindObject(Form("gene_%s_nTrackToNPart_x_div_meas_%s_nTrackToNPart_x", folder, folder))); |
719 | TH1* corrY = dynamic_cast<TH1*> (gROOT->FindObject(Form("gene_%s_nTrackToNPart_y_div_meas_%s_nTrackToNPart_y", folder, folder))); | |
720 | TH1* corrZ = dynamic_cast<TH1*> (gROOT->FindObject(Form("gene_%s_nTrackToNPart_z_div_meas_%s_nTrackToNPart_z", folder, folder))); | |
0ab29cfa | 721 | |
722 | Prepare1DPlot(corrX); | |
723 | Prepare1DPlot(corrY); | |
724 | Prepare1DPlot(corrZ); | |
725 | ||
72e597d7 | 726 | //corrX->SetTitle("a) z projection"); |
727 | corrY->SetTitle("a) #eta projection"); | |
728 | corrZ->SetTitle("b) p_{T} projection"); | |
729 | ||
730 | corrY->GetYaxis()->SetTitle("correction factor"); | |
731 | corrZ->GetYaxis()->SetTitle("correction factor"); | |
0ab29cfa | 732 | |
733 | corrZ->GetXaxis()->SetRangeUser(0, upperPtLimit); | |
734 | ||
bdfe2916 | 735 | TString canvasName; |
72e597d7 | 736 | canvasName.Form("Track2Particle1D_%s", folder); |
bdfe2916 | 737 | TCanvas* canvas = new TCanvas(canvasName, canvasName, 1200, 400); |
0ab29cfa | 738 | canvas->Divide(3, 1); |
739 | ||
740 | canvas->cd(1); | |
741 | InitPad(); | |
bdfe2916 | 742 | corrX->DrawCopy(); |
0ab29cfa | 743 | |
744 | canvas->cd(2); | |
745 | InitPad(); | |
bdfe2916 | 746 | corrY->DrawCopy(); |
0ab29cfa | 747 | |
748 | canvas->cd(3); | |
749 | InitPad(); | |
bdfe2916 | 750 | corrZ->DrawCopy(); |
0ab29cfa | 751 | |
72e597d7 | 752 | canvas->SaveAs(Form("Track2Particle1D_%s_%f.gif", fileName, upperPtLimit)); |
753 | canvas->SaveAs(Form("Track2Particle1D_%s_%f.eps", fileName, upperPtLimit)); | |
754 | ||
5c495d37 | 755 | //TPaveText* pave = new TPaveText(-0.4, 1.35, 0.4, 1.45); |
756 | ||
72e597d7 | 757 | canvasName.Form("Track2Particle1D_%s_etapt", folder); |
758 | TCanvas* canvas = new TCanvas(canvasName, canvasName, 1000, 500); | |
759 | canvas->Divide(2, 1); | |
760 | ||
761 | canvas->cd(1); | |
762 | InitPad(); | |
763 | corrY->GetXaxis()->SetRangeUser(-0.99, 0.99); | |
764 | corrY->GetYaxis()->SetRangeUser(1, 1.5); | |
765 | corrY->GetYaxis()->SetTitleOffset(1.5); | |
766 | corrY->DrawCopy(); | |
5c495d37 | 767 | TPaveText* pave = new TPaveText(0.3, 0.7, 0.7, 0.8, "NDC"); |
768 | pave->AddText("|z| < 10 cm"); | |
769 | pave->AddText("0.3 GeV/c < p_{T} < 10 GeV/c"); | |
770 | pave->Draw(); | |
72e597d7 | 771 | |
772 | canvas->cd(2); | |
773 | InitPad(); | |
5c495d37 | 774 | gPad->SetLogx(); |
775 | corrZ->GetYaxis()->SetRangeUser(1, 2.5); | |
776 | corrZ->GetXaxis()->SetRangeUser(0.101, upperPtLimit); | |
72e597d7 | 777 | corrZ->GetYaxis()->SetTitleOffset(1.5); |
778 | corrZ->DrawCopy(); | |
5c495d37 | 779 | pave = new TPaveText(0.5, 0.7, 0.8, 0.8, "NDC"); |
780 | pave->AddText("|z| < 10 cm"); | |
781 | pave->AddText("|#eta| < 0.8"); | |
782 | pave->Draw(); | |
72e597d7 | 783 | |
784 | canvas->SaveAs(Form("Track2Particle1D_etapt_%s_%f.eps", fileName, upperPtLimit)); | |
4c351225 | 785 | canvas->SaveAs(Form("Track2Particle1D_etapt_%s_%f.gif", fileName, upperPtLimit)); |
0ab29cfa | 786 | } |
787 | ||
788 | void CompareTrack2Particle1D(Float_t upperPtLimit = 9.9) | |
789 | { | |
790 | gSystem->Load("libPWG0base"); | |
791 | ||
8ca1a6d9 | 792 | // particle type |
793 | for (Int_t particle=0; particle<4; ++particle) | |
794 | { | |
795 | TString dirName; | |
796 | dirName.Form("correction_%d", particle); | |
797 | Track2Particle1DCreatePlots("systematics-detail-only-positive.root", dirName, upperPtLimit); | |
0ab29cfa | 798 | |
8ca1a6d9 | 799 | TString tmpx, tmpy, tmpz; |
800 | tmpx.Form("gene_%s_nTrackToNPart_x_div_meas_%s_nTrackToNPart_x", dirName.Data(), dirName.Data()); | |
801 | tmpy.Form("gene_%s_nTrackToNPart_y_div_meas_%s_nTrackToNPart_y", dirName.Data(), dirName.Data()); | |
802 | tmpz.Form("gene_%s_nTrackToNPart_z_div_meas_%s_nTrackToNPart_z", dirName.Data(), dirName.Data()); | |
0ab29cfa | 803 | |
8ca1a6d9 | 804 | TH1* posX = dynamic_cast<TH1*> (gROOT->FindObject(tmpx)->Clone("pos_x")); |
805 | TH1* posY = dynamic_cast<TH1*> (gROOT->FindObject(tmpy)->Clone("pos_y")); | |
806 | TH1* posZ = dynamic_cast<TH1*> (gROOT->FindObject(tmpz)->Clone("pos_z")); | |
0ab29cfa | 807 | |
8ca1a6d9 | 808 | Track2Particle1DCreatePlots("systematics-detail-only-negative.root", dirName, upperPtLimit); |
0ab29cfa | 809 | |
8ca1a6d9 | 810 | TH1* negX = dynamic_cast<TH1*> (gROOT->FindObject(tmpx)->Clone("neg_x")); |
811 | TH1* negY = dynamic_cast<TH1*> (gROOT->FindObject(tmpy)->Clone("neg_y")); | |
812 | TH1* negZ = dynamic_cast<TH1*> (gROOT->FindObject(tmpz)->Clone("neg_z")); | |
0ab29cfa | 813 | |
8ca1a6d9 | 814 | posX->Divide(negX); |
815 | posY->Divide(negY); | |
816 | posZ->Divide(negZ); | |
0ab29cfa | 817 | |
8ca1a6d9 | 818 | Prepare1DPlot(posX); |
819 | Prepare1DPlot(posY); | |
820 | Prepare1DPlot(posZ); | |
0ab29cfa | 821 | |
8ca1a6d9 | 822 | Float_t min = 0.8; |
823 | Float_t max = 1.2; | |
0ab29cfa | 824 | |
8ca1a6d9 | 825 | posX->SetMinimum(min); |
826 | posX->SetMaximum(max); | |
827 | posY->SetMinimum(min); | |
828 | posY->SetMaximum(max); | |
829 | posZ->SetMinimum(min); | |
830 | posZ->SetMaximum(max); | |
0ab29cfa | 831 | |
8ca1a6d9 | 832 | posZ->GetXaxis()->SetRangeUser(0, upperPtLimit); |
0ab29cfa | 833 | |
8ca1a6d9 | 834 | posX->GetYaxis()->SetTitleOffset(1.7); |
835 | posX->GetYaxis()->SetTitle("C_{+} / C_{-}"); | |
836 | posY->GetYaxis()->SetTitleOffset(1.7); | |
837 | posY->GetYaxis()->SetTitle("C_{+} / C_{-}"); | |
838 | posZ->GetYaxis()->SetTitleOffset(1.7); | |
839 | posZ->GetYaxis()->SetTitle("C_{+} / C_{-}"); | |
0ab29cfa | 840 | |
8ca1a6d9 | 841 | posZ->GetXaxis()->SetRangeUser(0, 1); |
0ab29cfa | 842 | |
8ca1a6d9 | 843 | TString canvasName; |
844 | canvasName.Form("PosNegRatios_%s_%f", ((particle == 0) ? "Pi" : ((particle == 1) ? "K" : ((particle == 2) ? "p" : "other"))), upperPtLimit); | |
0ab29cfa | 845 | |
8ca1a6d9 | 846 | TCanvas* canvas = new TCanvas(canvasName, canvasName, 1200, 400); |
847 | canvas->Divide(3, 1); | |
0ab29cfa | 848 | |
8ca1a6d9 | 849 | canvas->cd(1); |
850 | InitPad(); | |
851 | posX->DrawCopy(); | |
0ab29cfa | 852 | |
8ca1a6d9 | 853 | canvas->cd(2); |
854 | InitPad(); | |
855 | posY->DrawCopy(); | |
856 | ||
857 | canvas->cd(3); | |
858 | InitPad(); | |
859 | posZ->DrawCopy(); | |
0ab29cfa | 860 | |
8ca1a6d9 | 861 | canvas->SaveAs(Form("%s.gif", canvas->GetName())); |
862 | canvas->SaveAs(Form("%s.eps", canvas->GetName())); | |
863 | } | |
0ab29cfa | 864 | } |
865 | ||
866 | void Track2Particle2DCreatePlots(const char* fileName = "correction_map.root") | |
867 | { | |
868 | TFile::Open(fileName); | |
869 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction"); | |
870 | dNdEtaCorrection->LoadHistograms(fileName, "dndeta_correction"); | |
871 | ||
872 | TH3F* gene = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetGeneratedHistogram(); | |
873 | TH3F* meas = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetMeasuredHistogram(); | |
1afae8ff | 874 | |
25db2d85 | 875 | gene->GetZaxis()->SetRangeUser(0.3, 10); |
876 | meas->GetZaxis()->SetRangeUser(0.3, 10); | |
877 | AliPWG0Helper::CreateDividedProjections(gene, meas, "yx"); | |
0ab29cfa | 878 | gene->GetZaxis()->SetRange(0, 0); |
879 | meas->GetZaxis()->SetRange(0, 0); | |
25db2d85 | 880 | |
881 | gene->GetYaxis()->SetRangeUser(-0.8, 0.8); | |
882 | meas->GetYaxis()->SetRangeUser(-0.8, 0.8); | |
883 | AliPWG0Helper::CreateDividedProjections(gene, meas, "zx"); | |
0ab29cfa | 884 | gene->GetYaxis()->SetRange(0, 0); |
885 | meas->GetYaxis()->SetRange(0, 0); | |
25db2d85 | 886 | |
887 | gene->GetXaxis()->SetRangeUser(-10, 10); | |
888 | meas->GetXaxis()->SetRangeUser(-10, 10); | |
889 | AliPWG0Helper::CreateDividedProjections(gene, meas, "zy"); | |
0ab29cfa | 890 | gene->GetXaxis()->SetRange(0, 0); |
891 | meas->GetXaxis()->SetRange(0, 0); | |
892 | } | |
893 | ||
0bd1f8a0 | 894 | void Track2Particle2D(const char* fileName = "correction_map.root", const char* folder = "dndeta_correction") |
0ab29cfa | 895 | { |
896 | gSystem->Load("libPWG0base"); | |
897 | ||
898 | Track2Particle2DCreatePlots(fileName); | |
25db2d85 | 899 | |
0bd1f8a0 | 900 | TH2* corrYX = dynamic_cast<TH2*> (gROOT->FindObject(Form("gene_%s_nTrackToNPart_yx_div_meas_%s_nTrackToNPart_yx", folder, folder))); |
901 | TH2* corrZX = dynamic_cast<TH2*> (gROOT->FindObject(Form("gene_%s_nTrackToNPart_zx_div_meas_%s_nTrackToNPart_zx", folder, folder))); | |
902 | TH2* corrZY = dynamic_cast<TH2*> (gROOT->FindObject(Form("gene_%s_nTrackToNPart_zy_div_meas_%s_nTrackToNPart_zy", folder, folder))); | |
25db2d85 | 903 | |
904 | /* this reads them from the file | |
d09fb536 | 905 | TH2* corrYX = dynamic_cast<TH2*> (file->Get("dndeta_correction/gene_nTrackToNPart_yx_div_meas_nTrackToNPart_yx")); |
906 | TH2* corrZX = dynamic_cast<TH2*> (file->Get("dndeta_correction/gene_nTrackToNPart_zx_div_meas_nTrackToNPart_zx")); | |
25db2d85 | 907 | TH2* corrZY = dynamic_cast<TH2*> (file->Get("dndeta_correction/gene_nTrackToNPart_zy_div_meas_nTrackToNPart_zy"));*/ |
1afae8ff | 908 | |
909 | Prepare2DPlot(corrYX); | |
910 | Prepare2DPlot(corrZX); | |
911 | Prepare2DPlot(corrZY); | |
912 | ||
0ab29cfa | 913 | const char* title = ""; |
92d2d8ad | 914 | corrYX->SetTitle(title); |
915 | corrZX->SetTitle(title); | |
916 | corrZY->SetTitle(title); | |
1afae8ff | 917 | |
d09fb536 | 918 | TCanvas* canvas = new TCanvas("Track2Particle2D", "Track2Particle2D", 1200, 400); |
1afae8ff | 919 | canvas->Divide(3, 1); |
920 | ||
921 | canvas->cd(1); | |
922 | InitPadCOLZ(); | |
923 | corrYX->Draw("COLZ"); | |
924 | ||
925 | canvas->cd(2); | |
926 | InitPadCOLZ(); | |
927 | corrZX->Draw("COLZ"); | |
928 | ||
929 | canvas->cd(3); | |
930 | InitPadCOLZ(); | |
931 | corrZY->Draw("COLZ"); | |
92d2d8ad | 932 | |
25db2d85 | 933 | canvas->SaveAs(Form("Track2Particle2D_%d.gif", gMax)); |
0ab29cfa | 934 | canvas->SaveAs(Form("Track2Particle2D_%d.eps", gMax)); |
935 | } | |
936 | ||
937 | void CompareTrack2Particle2D() | |
938 | { | |
939 | gSystem->Load("libPWG0base"); | |
940 | ||
941 | Track2Particle2DCreatePlots("correction_maponly-positive.root"); | |
942 | ||
943 | TH2* posYX = dynamic_cast<TH2*> (gROOT->FindObject("gene_nTrackToNPart_yx_div_meas_nTrackToNPart_yx")->Clone("pos_yx")); | |
944 | TH2* posZX = dynamic_cast<TH2*> (gROOT->FindObject("gene_nTrackToNPart_zx_div_meas_nTrackToNPart_zx")->Clone("pos_zx")); | |
945 | TH2* posZY = dynamic_cast<TH2*> (gROOT->FindObject("gene_nTrackToNPart_zy_div_meas_nTrackToNPart_zy")->Clone("pos_zy")); | |
946 | ||
947 | Track2Particle2DCreatePlots("correction_maponly-negative.root"); | |
948 | ||
949 | TH2* negYX = dynamic_cast<TH2*> (gROOT->FindObject("gene_nTrackToNPart_yx_div_meas_nTrackToNPart_yx")->Clone("neg_yx")); | |
950 | TH2* negZX = dynamic_cast<TH2*> (gROOT->FindObject("gene_nTrackToNPart_zx_div_meas_nTrackToNPart_zx")->Clone("neg_zx")); | |
951 | TH2* negZY = dynamic_cast<TH2*> (gROOT->FindObject("gene_nTrackToNPart_zy_div_meas_nTrackToNPart_zy")->Clone("neg_zy")); | |
952 | ||
953 | posYX->Divide(negYX); | |
954 | posZX->Divide(negZX); | |
955 | posZY->Divide(negZY); | |
956 | ||
957 | Prepare2DPlot(posYX); | |
958 | Prepare2DPlot(posZX); | |
959 | Prepare2DPlot(posZY); | |
960 | ||
961 | Float_t min = 0.8; | |
962 | Float_t max = 1.2; | |
963 | ||
964 | posYX->SetMinimum(min); | |
965 | posYX->SetMaximum(max); | |
966 | posZX->SetMinimum(min); | |
967 | posZX->SetMaximum(max); | |
968 | posZY->SetMinimum(min); | |
969 | posZY->SetMaximum(max); | |
970 | ||
971 | TCanvas* canvas = new TCanvas("CompareTrack2Particle2D", "CompareTrack2Particle2D", 1200, 400); | |
972 | canvas->Divide(3, 1); | |
973 | ||
974 | canvas->cd(1); | |
975 | InitPadCOLZ(); | |
976 | posYX->Draw("COLZ"); | |
977 | ||
978 | canvas->cd(2); | |
979 | InitPadCOLZ(); | |
980 | posZX->Draw("COLZ"); | |
981 | ||
982 | canvas->cd(3); | |
983 | InitPadCOLZ(); | |
984 | posZY->Draw("COLZ"); | |
985 | ||
986 | canvas->SaveAs("CompareTrack2Particle2D.gif"); | |
987 | canvas->SaveAs("CompareTrack2Particle2D.eps"); | |
1afae8ff | 988 | } |
989 | ||
990 | void Track2Particle3D() | |
991 | { | |
992 | // get left margin proper | |
993 | ||
994 | TFile* file = TFile::Open("correction_map.root"); | |
995 | ||
d09fb536 | 996 | TH3* corr = dynamic_cast<TH3*> (file->Get("dndeta_correction/corr_nTrackToNPart")); |
997 | ||
998 | corr->SetTitle("Correction Factor"); | |
999 | SetRanges(corr->GetZaxis()); | |
1000 | ||
1001 | Prepare3DPlot(corr); | |
1002 | ||
1003 | TCanvas* canvas = new TCanvas("Track2Particle3D", "Track2Particle3D", 500, 500); | |
1004 | canvas->SetTheta(29.428); | |
1005 | canvas->SetPhi(16.5726); | |
1006 | ||
1007 | corr->Draw(); | |
1008 | ||
1009 | canvas->SaveAs("Track2Particle3D.gif"); | |
0ab29cfa | 1010 | canvas->SaveAs("Track2Particle3D.eps"); |
d09fb536 | 1011 | } |
1012 | ||
1013 | void Track2Particle3DAll() | |
1014 | { | |
d09fb536 | 1015 | TFile* file = TFile::Open("correction_map.root"); |
1016 | ||
1afae8ff | 1017 | TH3* gene = dynamic_cast<TH3*> (file->Get("dndeta_correction/gene_nTrackToNPart")); |
1018 | TH3* meas = dynamic_cast<TH3*> (file->Get("dndeta_correction/meas_nTrackToNPart")); | |
1019 | TH3* corr = dynamic_cast<TH3*> (file->Get("dndeta_correction/corr_nTrackToNPart")); | |
1020 | ||
1021 | gene->SetTitle("Generated Particles"); | |
1022 | meas->SetTitle("Measured Tracks"); | |
1023 | corr->SetTitle("Correction Factor"); | |
1024 | ||
1025 | Prepare3DPlot(gene); | |
1026 | Prepare3DPlot(meas); | |
1027 | Prepare3DPlot(corr); | |
1028 | ||
d09fb536 | 1029 | TCanvas* canvas = new TCanvas("Track2Particle3DAll", "Track2Particle3DAll", 1200, 400); |
1afae8ff | 1030 | canvas->Divide(3, 1); |
1031 | ||
1032 | canvas->cd(1); | |
1033 | InitPad(); | |
1034 | gene->Draw(); | |
1035 | ||
1036 | canvas->cd(2); | |
1037 | meas->Draw(); | |
1038 | ||
1039 | canvas->cd(3); | |
1040 | corr->Draw(); | |
d09fb536 | 1041 | |
1042 | canvas->SaveAs("Track2Particle3DAll.gif"); | |
0ab29cfa | 1043 | canvas->SaveAs("Track2Particle3DAll.eps"); |
1afae8ff | 1044 | } |
1045 | ||
6b7fa615 | 1046 | void MultiplicityMC(Int_t xRangeMax = 50) |
4c6b34a8 | 1047 | { |
1048 | TFile* file = TFile::Open("multiplicityMC.root"); | |
1049 | ||
1050 | if (!file) | |
1051 | { | |
1052 | printf("multiplicityMC.root could not be opened.\n"); | |
1053 | return; | |
1054 | } | |
1055 | ||
1056 | TH1F* fMultiplicityESD = dynamic_cast<TH1F*> (file->Get("fMultiplicityESD")); | |
1057 | TH1F* fMultiplicityMC = dynamic_cast<TH1F*> (file->Get("fMultiplicityMC")); | |
1058 | TH2F* fCorrelation = dynamic_cast<TH2F*> (file->Get("fCorrelation")); | |
1059 | ||
1060 | TH1F* correction = new TH1F("MultiplicityMC_correction", "MultiplicityMC_correction;Ntracks;Npart", 76, -0.5, 75.5); | |
1061 | TH1F* correctionWidth = new TH1F("MultiplicityMC_correctionwidth", "MultiplicityMC_correctionwidth;Ntracks;Npart", 76, -0.5, 75.5); | |
1062 | //fMultiplicityMC->GetNbinsX(), fMultiplicityMC->GetXaxis()->GetXmin(), fMultiplicityMC->GetXaxis()->GetXmax()); | |
1063 | for (Int_t i=1; i<=correction->GetNbinsX(); ++i) | |
1064 | { | |
1065 | TH1D* proj = fCorrelation->ProjectionX("_px", i, i+1); | |
1066 | proj->Fit("gaus", "0"); | |
1067 | correction->SetBinContent(i, proj->GetFunction("gaus")->GetParameter(1)); | |
1068 | correctionWidth->SetBinContent(i, proj->GetFunction("gaus")->GetParameter(2)); | |
1069 | ||
1070 | continue; | |
1071 | ||
1072 | // draw for debugging | |
1073 | new TCanvas; | |
1074 | proj->DrawCopy(); | |
1075 | proj->GetFunction("gaus")->DrawCopy("SAME"); | |
1076 | } | |
1077 | ||
1078 | TH1F* fMultiplicityESDCorrected = new TH1F("fMultiplicityESDCorrected", "fMultiplicityESDCorrected", 2010, -0.5, 200.5); | |
1079 | ||
1080 | for (Int_t i=1; i<=correction->GetNbinsX(); ++i) | |
1081 | { | |
1082 | Float_t mean = correction->GetBinContent(i); | |
1083 | Float_t width = correctionWidth->GetBinContent(i); | |
1084 | ||
1085 | Int_t fillBegin = fMultiplicityESDCorrected->FindBin(mean - width * 3); | |
1086 | Int_t fillEnd = fMultiplicityESDCorrected->FindBin(mean + width * 3); | |
1087 | printf("bin %d mean %f width %f, filling from %d to %d\n", i, mean, width, fillBegin, fillEnd); | |
1088 | ||
1089 | for (Int_t j=fillBegin; j <= fillEnd; ++j) | |
1090 | { | |
1091 | fMultiplicityESDCorrected->AddBinContent(j, TMath::Gaus(fMultiplicityESDCorrected->GetXaxis()->GetBinCenter(j), mean, width, kTRUE) * fMultiplicityESD->GetBinContent(i)); | |
1092 | } | |
1093 | } | |
1094 | ||
1095 | TH1F* fMultiplicityESDCorrectedRebinned = dynamic_cast<TH1F*> (fMultiplicityESDCorrected->Clone("fMultiplicityESDCorrectedRebinned")); | |
1096 | fMultiplicityESDCorrectedRebinned->Rebin(10); | |
1097 | fMultiplicityESDCorrectedRebinned->Scale(0.1); | |
1098 | ||
6b7fa615 | 1099 | TH1F* ratio = dynamic_cast<TH1F*> (fMultiplicityESD->Clone("multiplicity_ratio")); |
1100 | ratio->SetTitle("ratio;Ntracks;Nreco/Ngene"); | |
1101 | ratio->Divide(fMultiplicityMC); | |
1102 | ||
4c6b34a8 | 1103 | TH1F* ratio2 = dynamic_cast<TH1F*> (fMultiplicityESDCorrectedRebinned->Clone("multiplicity_ratio_corrected")); |
1104 | ratio2->Divide(fMultiplicityMC); | |
1105 | ||
1106 | TCanvas* canvas = new TCanvas("MultiplicityMC", "MultiplicityMC", 1500, 1000); | |
1107 | canvas->Divide(3, 2); | |
1108 | ||
6b7fa615 | 1109 | fMultiplicityESD->GetXaxis()->SetRangeUser(0, xRangeMax); |
1110 | ratio->GetXaxis()->SetRangeUser(0, xRangeMax); | |
1111 | fCorrelation->GetXaxis()->SetRangeUser(0, xRangeMax); | |
1112 | fCorrelation->GetYaxis()->SetRangeUser(0, xRangeMax); | |
1113 | correction->GetXaxis()->SetRangeUser(0, xRangeMax); | |
1114 | fMultiplicityESDCorrected->GetXaxis()->SetRangeUser(0, xRangeMax); | |
1115 | fMultiplicityESDCorrectedRebinned->GetXaxis()->SetRangeUser(0, xRangeMax); | |
1116 | ||
1117 | canvas->cd(1); //InitPad(); | |
4c6b34a8 | 1118 | fMultiplicityESD->Draw(); |
1119 | fMultiplicityMC->SetLineColor(2); | |
1120 | fMultiplicityMC->Draw("SAME"); | |
1121 | ||
6b7fa615 | 1122 | TLegend* legend = new TLegend(0.6, 0.7, 0.85, 0.85); |
1123 | legend->AddEntry(fMultiplicityESD, "ESD"); | |
1124 | legend->AddEntry(fMultiplicityMC, "MC"); | |
1125 | legend->Draw(); | |
4c6b34a8 | 1126 | |
6b7fa615 | 1127 | canvas->cd(2); |
4c6b34a8 | 1128 | fCorrelation->Draw("COLZ"); |
1129 | ||
6b7fa615 | 1130 | canvas->cd(3); |
4c6b34a8 | 1131 | correction->Draw(); |
1132 | //correction->Fit("pol1"); | |
1133 | correctionWidth->SetLineColor(2); | |
1134 | correctionWidth->Draw("SAME"); | |
1135 | ||
6b7fa615 | 1136 | legend = new TLegend(0.2, 0.7, 0.45, 0.85); |
1137 | legend->AddEntry(correction, "#bar{x}"); | |
1138 | legend->AddEntry(correctionWidth, "#sigma"); | |
1139 | legend->Draw(); | |
1140 | ||
1141 | canvas->cd(4); | |
1142 | ratio->Draw(); | |
1143 | ||
1144 | ratio2->SetLineColor(2); | |
1145 | ratio2->Draw("SAME"); | |
1146 | ||
1147 | legend = new TLegend(0.6, 0.7, 0.85, 0.85); | |
1148 | legend->AddEntry(ratio, "uncorrected"); | |
1149 | legend->AddEntry(ratio2, "corrected"); | |
1150 | legend->Draw(); | |
1151 | ||
4c6b34a8 | 1152 | canvas->cd(5); |
6b7fa615 | 1153 | fMultiplicityESDCorrected->SetLineColor(kBlue); |
4c6b34a8 | 1154 | fMultiplicityESDCorrected->Draw(); |
1155 | fMultiplicityMC->Draw("SAME"); | |
1156 | fMultiplicityESD->Draw("SAME"); | |
1157 | ||
6b7fa615 | 1158 | legend = new TLegend(0.6, 0.7, 0.85, 0.85); |
1159 | legend->AddEntry(fMultiplicityESDCorrected, "ESD corrected"); | |
1160 | legend->AddEntry(fMultiplicityMC, "MC"); | |
1161 | legend->AddEntry(fMultiplicityESD, "ESD"); | |
1162 | legend->Draw(); | |
1163 | ||
4c6b34a8 | 1164 | canvas->cd(6); |
6b7fa615 | 1165 | fMultiplicityESDCorrectedRebinned->SetLineColor(kBlue); |
4c6b34a8 | 1166 | fMultiplicityESDCorrectedRebinned->Draw(); |
1167 | fMultiplicityMC->Draw("SAME"); | |
6b7fa615 | 1168 | |
1169 | legend = new TLegend(0.6, 0.7, 0.85, 0.85); | |
1170 | legend->AddEntry(fMultiplicityESDCorrectedRebinned, "ESD corrected"); | |
1171 | legend->AddEntry(fMultiplicityMC, "MC"); | |
1172 | legend->Draw(); | |
1173 | ||
1174 | canvas->SaveAs("MultiplicityMC.gif"); | |
4c6b34a8 | 1175 | } |
1176 | ||
1177 | void MultiplicityESD() | |
1178 | { | |
1179 | TFile* file = TFile::Open("multiplicityESD.root"); | |
1180 | ||
1181 | if (!file) | |
1182 | { | |
1183 | printf("multiplicityESD.root could not be opened.\n"); | |
1184 | return; | |
1185 | } | |
1186 | ||
1187 | TH1F* fMultiplicityESD = dynamic_cast<TH1F*> (file->Get("fMultiplicity")); | |
1188 | ||
1189 | TCanvas* canvas = new TCanvas("MultiplicityESD", "MultiplicityESD", 500, 500); | |
1190 | ||
1191 | fMultiplicityESD->Draw(); | |
1192 | } | |
1193 | ||
0ab29cfa | 1194 | void drawPlots(Int_t max) |
1afae8ff | 1195 | { |
0ab29cfa | 1196 | gMax = max; |
1afae8ff | 1197 | |
0ab29cfa | 1198 | ptCutoff(); |
1199 | TriggerBias(); | |
1200 | VtxRecon(); | |
1201 | Track2Particle2D(); | |
1202 | Track2Particle3D(); | |
1203 | ptSpectrum(); | |
1204 | dNdEta(); | |
1afae8ff | 1205 | } |
1206 | ||
0ab29cfa | 1207 | void drawPlots() |
d09fb536 | 1208 | { |
0ab29cfa | 1209 | drawPlots(5); |
1210 | drawPlots(2); | |
1afae8ff | 1211 | } |