]>
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 | ||
dd367a14 | 23 | void loadlibs() |
24 | { | |
69b09e3b | 25 | gSystem->Load("libVMC"); |
26 | gSystem->Load("libTree"); | |
27 | gSystem->Load("libSTEERBase"); | |
28 | gSystem->Load("libESD"); | |
29 | gSystem->Load("libAOD"); | |
dd367a14 | 30 | gSystem->Load("libANALYSIS"); |
69b09e3b | 31 | gSystem->Load("libANALYSISalice"); |
dd367a14 | 32 | gSystem->Load("libPWG0base"); |
33 | } | |
34 | ||
0ab29cfa | 35 | void SetRanges(TAxis* axis) |
92d2d8ad | 36 | { |
0ab29cfa | 37 | if (strcmp(axis->GetTitle(), "#eta") == 0) |
69b09e3b | 38 | axis->SetRangeUser(-1.4999, 1.4999); |
39 | if (strcmp(axis->GetTitle(), "p_{T} [GeV/c]") == 0 || strcmp(axis->GetTitle(), "p_{T} (GeV/c)") == 0) | |
40 | { | |
c17301f3 | 41 | axis->SetRangeUser(0, 4.9999); |
69b09e3b | 42 | axis->SetTitle("p_{T} (GeV/c)"); |
43 | } | |
70fdd197 | 44 | if (strcmp(axis->GetTitle(), "vtx z [cm]") == 0 || strcmp(axis->GetTitle(), "vtx z (cm)") == 0 || strcmp(axis->GetTitle(), "vtx-z [cm]") == 0 || strcmp(axis->GetTitle(), "vtx-z (cm)") == 0) |
69b09e3b | 45 | { |
0ab29cfa | 46 | axis->SetRangeUser(-15, 14.9999); |
69b09e3b | 47 | axis->SetTitle("vtx-z (cm)"); |
48 | } | |
0ab29cfa | 49 | if (strcmp(axis->GetTitle(), "Ntracks") == 0) |
50 | axis->SetRangeUser(0, 99.9999); | |
25db2d85 | 51 | } |
52 | ||
0ab29cfa | 53 | void SetRanges(TH1* hist) |
25db2d85 | 54 | { |
0ab29cfa | 55 | SetRanges(hist->GetXaxis()); |
56 | SetRanges(hist->GetYaxis()); | |
57 | SetRanges(hist->GetZaxis()); | |
58 | } | |
25db2d85 | 59 | |
0ab29cfa | 60 | |
61 | void Prepare3DPlot(TH3* hist) | |
62 | { | |
63 | hist->GetXaxis()->SetTitleOffset(1.5); | |
64 | hist->GetYaxis()->SetTitleOffset(1.5); | |
65 | hist->GetZaxis()->SetTitleOffset(1.5); | |
66 | ||
67 | hist->SetStats(kFALSE); | |
68 | } | |
69 | ||
70 | void Prepare2DPlot(TH2* hist) | |
71 | { | |
72 | hist->SetStats(kFALSE); | |
73 | hist->GetYaxis()->SetTitleOffset(1.4); | |
74 | ||
75 | hist->SetMinimum(0); | |
76 | hist->SetMaximum(gMax); | |
77 | ||
78 | SetRanges(hist); | |
79 | } | |
80 | ||
81 | void Prepare1DPlot(TH1* hist) | |
82 | { | |
83 | hist->SetLineWidth(2); | |
84 | hist->SetStats(kFALSE); | |
85 | ||
72e597d7 | 86 | hist->GetXaxis()->SetLabelOffset(0.02); |
87 | hist->GetXaxis()->SetTitleOffset(1.3); | |
88 | hist->GetYaxis()->SetTitleOffset(1.3); | |
89 | ||
0ab29cfa | 90 | SetRanges(hist); |
91 | } | |
92 | ||
93 | void InitPad() | |
94 | { | |
95 | gPad->Range(0, 0, 1, 1); | |
96 | gPad->SetLeftMargin(0.15); | |
97 | //gPad->SetRightMargin(0.05); | |
98 | //gPad->SetTopMargin(0.13); | |
72e597d7 | 99 | gPad->SetBottomMargin(0.12); |
0ab29cfa | 100 | |
72e597d7 | 101 | gPad->SetGridx(); |
102 | gPad->SetGridy(); | |
0ab29cfa | 103 | } |
104 | ||
105 | void InitPadCOLZ() | |
106 | { | |
107 | gPad->Range(0, 0, 1, 1); | |
108 | gPad->SetRightMargin(0.15); | |
109 | gPad->SetLeftMargin(0.12); | |
c17301f3 | 110 | gPad->SetTopMargin(0.05); |
0ab29cfa | 111 | |
112 | gPad->SetGridx(); | |
113 | gPad->SetGridy(); | |
d09fb536 | 114 | } |
115 | ||
dd367a14 | 116 | // --- end of helpers --- begin functions --- |
117 | ||
3dfa46a4 | 118 | void DrawOverview(const char* fileName = "correction_map.root", const char* dirName = "dndeta_correction") |
dd367a14 | 119 | { |
120 | loadlibs(); | |
121 | if (!TFile::Open(fileName)) | |
122 | return; | |
123 | ||
124 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(dirName, dirName); | |
125 | if (!dNdEtaCorrection->LoadHistograms()) | |
126 | return; | |
127 | ||
128 | dNdEtaCorrection->Finish(); | |
129 | ||
130 | dNdEtaCorrection->DrawOverview(); | |
131 | } | |
132 | ||
51f6de65 | 133 | void PrintInfo(const char* fileName = "correction_map.root", const char* dirName = "dndeta_correction") |
134 | { | |
135 | loadlibs(); | |
136 | if (!TFile::Open(fileName)) | |
137 | return; | |
138 | ||
139 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(dirName, dirName); | |
140 | if (!dNdEtaCorrection->LoadHistograms()) | |
141 | return; | |
142 | ||
143 | dNdEtaCorrection->Finish(); | |
144 | ||
145 | for (Int_t i=AlidNdEtaCorrection::kTrack2Particle; i<=AlidNdEtaCorrection::kND; i++) | |
146 | { | |
147 | Printf("Correction %d", i); | |
70fdd197 | 148 | dNdEtaCorrection->GetCorrection(i)->PrintInfo(0.2); |
51f6de65 | 149 | } |
150 | } | |
151 | ||
152 | void PrintAllInfos() | |
153 | { | |
154 | PrintInfo(); | |
155 | ||
156 | Printf("RAW ESD"); | |
157 | TFile::Open("analysis_esd_raw.root"); | |
158 | dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta"); | |
159 | fdNdEtaAnalysis->LoadHistograms("fdNdEtaAnalysisESD"); | |
160 | fdNdEtaAnalysis->GetData()->PrintInfo(0.3); | |
161 | ||
162 | const Int_t num = 3; | |
163 | const char* results[] = { "dndeta", "dndetaTr", "dndetaTrVtx" }; | |
164 | ||
165 | TFile::Open("analysis_esd.root"); | |
166 | for (Int_t i=0; i<num; i++) | |
167 | { | |
168 | Printf("CORRECTED %s", results[i]); | |
169 | dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta"); | |
170 | fdNdEtaAnalysis->LoadHistograms(results[i]); | |
171 | fdNdEtaAnalysis->GetData()->PrintInfo(0.3); | |
172 | } | |
173 | } | |
174 | ||
8ca1a6d9 | 175 | void ComparedNdEta(const char* ESDfolder = "dndeta", const char* MCfolder = "dndeta", const char* esdFile = "analysis_esd.root", const char* mcFile = "analysis_mc.root") |
176 | { | |
177 | gSystem->Load("libPWG0base"); | |
178 | ||
179 | TFile::Open(esdFile); | |
180 | dNdEtaAnalysis* fdNdEtaAnalysisESD = new dNdEtaAnalysis(ESDfolder, ESDfolder); | |
181 | fdNdEtaAnalysisESD->LoadHistograms(); | |
182 | ||
183 | TFile::Open(mcFile); | |
184 | dNdEtaAnalysis* fdNdEtaAnalysisMC = new dNdEtaAnalysis(MCfolder, MCfolder); | |
185 | fdNdEtaAnalysisMC->LoadHistograms(); | |
0448e811 | 186 | //fdNdEtaAnalysisMC->Finish(0, 0.3, AlidNdEtaCorrection::kNone); |
8ca1a6d9 | 187 | |
188 | for (Int_t i=0; i<dNdEtaAnalysis::kVertexBinning; ++i) | |
0448e811 | 189 | fdNdEtaAnalysisESD->GetdNdEtaPtCutOffCorrectedHistogram(i)->Divide(fdNdEtaAnalysisMC->GetdNdEtaPtCutOffCorrectedHistogram(i)); |
8ca1a6d9 | 190 | |
191 | fdNdEtaAnalysisESD->DrawHistograms(); | |
192 | } | |
193 | ||
194 | void CompareVertexDist(Int_t plot = 0, const char* correctionMapFile = "correction_map.root", const char* correctionMapFolder = "dndeta_correction") | |
195 | { | |
196 | gSystem->Load("libPWG0base"); | |
197 | ||
198 | const char* ESDfolder = 0; | |
199 | ||
200 | if (plot == 0) // all | |
201 | ESDfolder = "dndeta"; | |
202 | else if (plot == 1) // mb | |
203 | ESDfolder = "dndeta_mb"; | |
204 | else if (plot == 2) // mb vtx | |
205 | ESDfolder = "dndeta_mbvtx"; | |
206 | ||
207 | TFile::Open("analysis_esd.root"); | |
208 | dNdEtaAnalysis* fdNdEtaAnalysisESD = new dNdEtaAnalysis(ESDfolder, ESDfolder); | |
209 | fdNdEtaAnalysisESD->LoadHistograms(); | |
210 | ||
211 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(correctionMapFolder, correctionMapFolder); | |
212 | dNdEtaCorrection->LoadHistograms(correctionMapFile, correctionMapFolder); | |
213 | ||
214 | TH2F* hist = 0; | |
215 | ||
216 | if (plot == 0) // all | |
217 | hist = dNdEtaCorrection->GetTriggerBiasCorrection()->GetGeneratedHistogram(); | |
218 | else if (plot == 1) // mb | |
219 | hist = dNdEtaCorrection->GetTriggerBiasCorrection()->GetMeasuredHistogram(); | |
220 | else if (plot == 2) // mb vtx | |
221 | hist = dNdEtaCorrection->GetVertexRecoCorrection()->GetMeasuredHistogram(); | |
222 | ||
223 | TH1* proj = hist->ProjectionX(); | |
224 | ||
225 | TH1* vertex = fdNdEtaAnalysisESD->GetVtxHistogram(); | |
226 | for (Int_t i=1; i<=vertex->GetNbinsX(); ++i) | |
227 | { | |
228 | Float_t value = proj->GetBinContent(proj->FindBin(vertex->GetBinCenter(i))); | |
229 | if (value != 0) | |
230 | { | |
231 | printf("vtx = %f, esd = %f, corr = %f, ratio = %f\n", vertex->GetBinCenter(i), vertex->GetBinContent(i), value, vertex->GetBinContent(i) / value); | |
232 | vertex->SetBinContent(i, vertex->GetBinContent(i) / value); | |
233 | } | |
234 | } | |
235 | ||
236 | new TCanvas; | |
237 | vertex->DrawCopy(); | |
238 | } | |
239 | ||
240 | void CompareTrack2ParticleWithAnalysisData(const char* correctionMapFile = "correction_map.root", const char* correctionMapFolder = "dndeta_correction") | |
241 | { | |
a7f69e56 | 242 | loadlibs(); |
8ca1a6d9 | 243 | |
244 | TFile::Open("analysis_esd.root"); | |
245 | dNdEtaAnalysis* fdNdEtaAnalysisESD = new dNdEtaAnalysis("dndeta_mbvtx", "dndeta_mbvtx"); | |
246 | fdNdEtaAnalysisESD->LoadHistograms(); | |
247 | ||
248 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(correctionMapFolder, correctionMapFolder); | |
249 | dNdEtaCorrection->LoadHistograms(correctionMapFile, correctionMapFolder); | |
250 | ||
251 | //TH1* histESD = fdNdEtaAnalysisESD->GetUncorrectedHistogram(); | |
252 | //TH1* histCorr = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetMeasuredHistogram(); | |
253 | ||
254 | TH1* histESD = fdNdEtaAnalysisESD->GetHistogram(); | |
255 | TH1* histCorr = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetGeneratedHistogram(); | |
256 | ||
257 | TH1F* diff = new TH1F("diff", "diff", 100, 0.98, 1.02); | |
258 | ||
259 | new TCanvas; | |
260 | histESD->Draw(); | |
261 | ||
262 | new TCanvas; | |
263 | histCorr->Draw(); | |
264 | ||
265 | for (Int_t x=1; x<=histESD->GetNbinsX(); ++x) | |
266 | for (Int_t y=1; y<=histESD->GetNbinsY(); ++y) | |
267 | for (Int_t z=1; z<=histESD->GetNbinsZ(); ++z) | |
268 | { | |
269 | Float_t value1 = histESD->GetBinContent(x, y, z); | |
270 | Float_t value2 = histCorr->GetBinContent(histCorr->FindBin(histESD->GetXaxis()->GetBinCenter(x), histESD->GetYaxis()->GetBinCenter(y), histESD->GetZaxis()->GetBinCenter(z))); | |
271 | ||
272 | if (value2 > 0 && value1 > 0) | |
273 | { | |
274 | printf("%f %f %f\n", value1, value2, value1 / value2); | |
275 | diff->Fill(value1 / value2); | |
276 | } | |
277 | } | |
278 | ||
279 | new TCanvas; | |
280 | diff->Draw(); | |
281 | } | |
282 | ||
dd367a14 | 283 | Double_t PrintIntegratedDeviation(TH1* histMC, TH1* histESD, const char* desc = "") |
284 | { | |
285 | Double_t avgMC = 0; | |
286 | Double_t avgESD = 0; | |
287 | for (Int_t bin = histMC->FindBin(-0.7999); bin <= histMC->FindBin(0.7999); bin++) | |
288 | { | |
289 | avgMC += histMC->GetBinContent(bin); | |
290 | avgESD += histESD->GetBinContent(bin); | |
291 | } | |
292 | Int_t nBins = histMC->FindBin(0.7999) - histMC->FindBin(-0.7999) + 1; | |
293 | ||
294 | avgMC /= nBins; | |
295 | avgESD /= nBins; | |
296 | ||
297 | // deviation when integrate in |eta| < 0.8 between mc and esd | |
298 | Double_t diffFullRange = (avgMC - avgESD) / avgMC; | |
299 | ||
300 | Printf("%s: Integrated deviation in |eta| < 0.8 is %.2f %%", desc, diffFullRange * 100); | |
301 | ||
302 | return diffFullRange; | |
303 | } | |
304 | ||
1cbdb1a6 | 305 | void dNdEtaNoResolution() |
306 | { | |
307 | loadlibs(); | |
308 | ||
309 | TFile::Open("correction_map.root"); | |
310 | ||
311 | const char* correctionMapFolder = "dndeta_correction"; | |
312 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(correctionMapFolder, correctionMapFolder); | |
313 | dNdEtaCorrection->LoadHistograms(); | |
314 | dNdEtaCorrection->GetTrack2ParticleCorrection()->PrintInfo(0.3); | |
315 | ||
316 | TFile::Open("analysis_mc.root"); | |
317 | fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaTracks", "dndetaTracks"); | |
318 | fdNdEtaAnalysis->LoadHistograms(); | |
319 | fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0.3, AlidNdEtaCorrection::kTrack2Particle, "ESD (no resolution effect) -> MB with vertex"); | |
320 | fdNdEtaAnalysis->GetdNdEtaPtCutOffCorrectedHistogram(0)->SetMarkerStyle(21); | |
321 | ||
322 | TFile::Open("analysis_mc.root"); | |
323 | dNdEtaAnalysis* fdNdEtaAnalysisMC = new dNdEtaAnalysis("dndetaTrVtx", "dndetaTrVtx"); | |
324 | fdNdEtaAnalysisMC->LoadHistograms(); | |
325 | fdNdEtaAnalysisMC->Finish(0, 0, AlidNdEtaCorrection::kNone, "MC: MB with vertex"); | |
326 | ||
327 | DrawdNdEtaRatio(fdNdEtaAnalysis->GetdNdEtaPtCutOffCorrectedHistogram(0), fdNdEtaAnalysisMC->GetdNdEtaPtCutOffCorrectedHistogram(0), "MB with vertex (no resolution effect)", 3); | |
328 | } | |
329 | ||
330 | TH1* GetMCHist(const char* folder, Float_t ptCut, const char* tag) | |
331 | { | |
69b09e3b | 332 | loadlibs(); |
333 | ||
1cbdb1a6 | 334 | dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis(folder, folder); |
335 | fdNdEtaAnalysis->LoadHistograms(); | |
336 | fdNdEtaAnalysis->Finish(0, ptCut, AlidNdEtaCorrection::kNone, tag); | |
337 | return fdNdEtaAnalysis->GetdNdEtaHistogram(0); | |
338 | } | |
339 | ||
69b09e3b | 340 | void dNdEtaFinal(Bool_t spd = kTRUE) |
341 | { | |
342 | TFile* file = TFile::Open("analysis_esd.root"); | |
343 | TH1* histESD = (TH1*) file->Get("dndeta/dNdEta_corrected"); | |
344 | TH1* histESDnsd = (TH1*) file->Get("dndetaNSD/dNdEta_corrected"); | |
345 | Prepare1DPlot(histESD); | |
346 | Prepare1DPlot(histESDnsd); | |
347 | ||
348 | TCanvas* canvas = new TCanvas("dNdEtaFinal", "dNdEtaFinal", 600, 600); | |
349 | gPad->SetTopMargin(0.05); | |
350 | gPad->SetRightMargin(0.05); | |
351 | gPad->SetLeftMargin(0.12); | |
352 | gPad->SetBottomMargin(0.12); | |
353 | gPad->SetGridx(); | |
354 | gPad->SetGridy(); | |
355 | ||
356 | Float_t etaMax = 1.9; | |
357 | Float_t histMax = 1.39; | |
358 | Float_t systErrorValue = 0.023; | |
359 | Float_t systErrorNSDValue = 0.081; | |
360 | if (!spd) | |
361 | { | |
362 | //etaMax = 1.5; | |
363 | histMax = 0.99; | |
364 | systErrorValue = 0.043; | |
365 | systErrorNSDValue = 0.088; | |
366 | } | |
367 | ||
368 | dummy = new TH2F("dummy", ";#eta;dN_{ch}/d#eta", 100, -etaMax, etaMax, 100, 3, 8); | |
369 | dummy->SetStats(0); | |
370 | dummy->GetYaxis()->SetTitleOffset(1.3); | |
371 | ||
372 | histESD->SetMarkerStyle(20); | |
373 | histESDnsd->SetMarkerStyle(21); | |
374 | histESDnsd->SetMarkerColor(4); | |
375 | histESDnsd->SetLineColor(4); | |
376 | histESD->SetMarkerSize(1.5); | |
377 | histESDnsd->SetMarkerSize(1.5); | |
378 | ||
379 | histESD->GetXaxis()->SetRangeUser(-histMax, histMax); | |
380 | histESDnsd->GetXaxis()->SetRangeUser(-histMax, histMax); | |
381 | ||
382 | legend = new TLegend(0.3, 0.2, 0.78, 0.4); | |
383 | legend->SetFillColor(0); | |
384 | legend->SetTextSize(0.04); | |
385 | legend->AddEntry(histESD, "Inelastic events", "P"); | |
386 | legend->AddEntry(histESDnsd, "NSD events", "P"); | |
387 | ||
388 | dummy->Draw(); | |
389 | ||
390 | // syst errors. | |
391 | TH1* systError = (TH1*) histESD->Clone("systError"); | |
392 | for (Int_t i=1; i<=systError->GetNbinsX(); ++i) | |
393 | systError->SetBinError(i, systError->GetBinContent(i) * systErrorValue); | |
394 | // change error drawing style | |
395 | systError->SetFillColor(15); | |
396 | systError->DrawCopy("SAME E2 ]["); | |
397 | ||
398 | // syst error NSD | |
399 | for (Int_t i=1; i<=systError->GetNbinsX(); ++i) | |
400 | { | |
401 | systError->SetBinContent(i, histESDnsd->GetBinContent(i)); | |
402 | systError->SetBinError(i, systError->GetBinContent(i) * systErrorNSDValue); | |
403 | } | |
404 | systError->DrawCopy("SAME E2 ]["); | |
405 | ||
406 | histESD->Draw("SAME"); | |
407 | histESDnsd->Draw("SAME"); | |
408 | legend->Draw(); | |
409 | ||
410 | canvas->SaveAs(Form("%s_dndeta_final.eps", (spd) ? "spd" : "tpc")); | |
411 | } | |
412 | ||
413 | void dNdEtaPythiaPhojet() | |
414 | { | |
415 | // evtl. deactivate acceptance maps in dNdEtaAnalysis.cxx | |
416 | ||
417 | loadlibs(); | |
418 | ||
419 | TH1* hist[4]; | |
420 | ||
421 | TFile::Open("LHC08c11_10TeV_0.5T/mb1/spd/analysis_mc.root"); | |
422 | hist[0] = (TH1*) GetMCHist("dndeta", -1, "MC: full inelastic")->Clone("histMC"); | |
423 | hist[1] = (TH1*) GetMCHist("dndetaNSD", -1, "MC: NSD")->Clone("histMCnsd"); | |
424 | ||
425 | TFile::Open("LHC08c15_10TeV_0.5T_Phojet/mb1/spd/analysis_mc.root"); | |
426 | hist[2] = (TH1*) GetMCHist("dndeta", -1, "MC: full inelastic")->Clone("histMCPhojet"); | |
427 | hist[3] = (TH1*) GetMCHist("dndetaNSD", -1, "MC: NSD")->Clone("histMCnsdPhojet"); | |
428 | ||
429 | file = TFile::Open("pythia_phojet_dndeta.root", "RECREATE"); | |
430 | for (Int_t i=0; i<4; i++) | |
431 | hist[i]->Write(); | |
432 | file->Close(); | |
433 | } | |
434 | ||
3dfa46a4 | 435 | void dNdEta(Bool_t onlyESD = kFALSE, Bool_t save = kTRUE) |
d09fb536 | 436 | { |
69b09e3b | 437 | loadlibs(); |
438 | ||
d09fb536 | 439 | TFile* file = TFile::Open("analysis_esd.root"); |
69b09e3b | 440 | |
441 | dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta"); | |
442 | fdNdEtaAnalysis->LoadHistograms("dndeta"); | |
443 | ||
74fd10b3 | 444 | TH1* histESD = (TH1*) file->Get("dndeta/dNdEta_corrected"); |
0fc41645 | 445 | TH1* histESDnsd = (TH1*) file->Get("dndetaNSD/dNdEta_corrected"); |
69b09e3b | 446 | TH1* histESDnsdNoPt = (TH1*) file->Get("dndetaNSD/dNdEta"); |
74fd10b3 | 447 | TH1* histESDNoPt = (TH1*) file->Get("dndeta/dNdEta"); |
448 | TH1* histESDMB = (TH1*) file->Get("dndetaTr/dNdEta_corrected"); | |
449 | TH1* histESDMBNoPt = (TH1*) file->Get("dndetaTr/dNdEta"); | |
450 | TH1* histESDMBVtx = (TH1*) file->Get("dndetaTrVtx/dNdEta_corrected"); | |
451 | TH1* histESDMBVtxNoPt = (TH1*) file->Get("dndetaTrVtx/dNdEta"); | |
9e952c39 | 452 | TH1* histESDMBTracksNoPt = (TH1*) file->Get("dndetaTracks/dNdEta"); |
d09fb536 | 453 | |
454 | Prepare1DPlot(histESD); | |
0fc41645 | 455 | Prepare1DPlot(histESDnsd); |
d09fb536 | 456 | Prepare1DPlot(histESDMB); |
457 | Prepare1DPlot(histESDMBVtx); | |
458 | ||
74fd10b3 | 459 | Prepare1DPlot(histESDNoPt); |
460 | Prepare1DPlot(histESDMBNoPt); | |
461 | Prepare1DPlot(histESDMBVtxNoPt); | |
9e952c39 | 462 | Prepare1DPlot(histESDMBTracksNoPt); |
74fd10b3 | 463 | |
464 | histESD->SetLineWidth(0); | |
0fc41645 | 465 | histESDnsd->SetLineWidth(0); |
74fd10b3 | 466 | histESDMB->SetLineWidth(0); |
467 | histESDMBVtx->SetLineWidth(0); | |
468 | ||
469 | histESDNoPt->SetLineWidth(0); | |
470 | histESDMBNoPt->SetLineWidth(0); | |
471 | histESDMBVtxNoPt->SetLineWidth(0); | |
72e597d7 | 472 | |
9e952c39 | 473 | histESD->SetMarkerColor(1); |
0fc41645 | 474 | histESDnsd->SetMarkerColor(6); |
9e952c39 | 475 | histESDMB->SetMarkerColor(2); |
69b09e3b | 476 | histESDMBVtx->SetMarkerColor(4); |
72e597d7 | 477 | |
3dfa46a4 | 478 | histESD->SetLineColor(1); |
0fc41645 | 479 | histESDnsd->SetLineColor(6); |
3dfa46a4 | 480 | histESDMB->SetLineColor(2); |
69b09e3b | 481 | histESDMBVtx->SetLineColor(4); |
3dfa46a4 | 482 | |
9e952c39 | 483 | histESDNoPt->SetMarkerColor(1); |
484 | histESDMBNoPt->SetMarkerColor(2); | |
69b09e3b | 485 | histESDMBVtxNoPt->SetMarkerColor(4); |
486 | histESDMBTracksNoPt->SetMarkerColor(3); | |
74fd10b3 | 487 | |
72e597d7 | 488 | histESD->SetMarkerStyle(20); |
0fc41645 | 489 | histESDnsd->SetMarkerStyle(29); |
72e597d7 | 490 | histESDMB->SetMarkerStyle(21); |
491 | histESDMBVtx->SetMarkerStyle(22); | |
d09fb536 | 492 | |
74fd10b3 | 493 | histESDNoPt->SetMarkerStyle(20); |
494 | histESDMBNoPt->SetMarkerStyle(21); | |
495 | histESDMBVtxNoPt->SetMarkerStyle(22); | |
9e952c39 | 496 | histESDMBTracksNoPt->SetMarkerStyle(23); |
3dfa46a4 | 497 | |
a7f69e56 | 498 | Float_t etaLimit = (fdNdEtaAnalysis->GetAnalysisMode() & AliPWG0Helper::kTPC) ? 0.89 : 1.79; |
499 | Float_t etaPlotLimit = (fdNdEtaAnalysis->GetAnalysisMode() & AliPWG0Helper::kTPC) ? 1.2 : 2.3; | |
69b09e3b | 500 | //Float_t etaLimit = (fdNdEtaAnalysis->GetAnalysisMode() == AliPWG0Helper::kTPC) ? 0.89 : 1.39; |
501 | //Float_t etaPlotLimit = (fdNdEtaAnalysis->GetAnalysisMode() == AliPWG0Helper::kTPC) ? 1.2 : 1.9; | |
4c351225 | 502 | |
503 | histESDMBVtx->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
504 | histESDMB->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
505 | histESD->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
0fc41645 | 506 | histESDnsd->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); |
74fd10b3 | 507 | |
4c351225 | 508 | histESDNoPt->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); |
74fd10b3 | 509 | histESDMBNoPt->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); |
510 | histESDMBVtxNoPt->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
9e952c39 | 511 | histESDMBTracksNoPt->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); |
512 | ||
0fc41645 | 513 | Float_t max = TMath::Max(histESDMBVtx->GetMaximum(), histESDMB->GetMaximum()); |
514 | max = TMath::Max(max, histESD->GetMaximum()); | |
a7f69e56 | 515 | max = TMath::Max(max, histESDMBTracksNoPt->GetMaximum()); |
0fc41645 | 516 | |
69b09e3b | 517 | TLegend* legend = new TLegend(0.35, 0.05, 0.75, 0.4); |
518 | legend->SetFillColor(0); | |
519 | legend->AddEntry(histESDMBVtx, "Triggered, vertex"); | |
520 | legend->AddEntry(histESDMB, "Triggered"); | |
1d107532 | 521 | legend->AddEntry(histESD, "All INEL events"); |
522 | legend->AddEntry(histESDnsd, "All NSD events"); | |
69b09e3b | 523 | |
70fdd197 | 524 | TH2F* dummy = new TH2F("dummy", "", 100, -etaPlotLimit, etaPlotLimit, 1000, 0, max * 1.1); |
525 | dummy->GetYaxis()->SetRangeUser(2.1, max * 1.1); | |
0fc41645 | 526 | Prepare1DPlot(dummy); |
527 | dummy->SetStats(kFALSE); | |
528 | dummy->SetXTitle("#eta"); | |
529 | dummy->SetYTitle("dN_{ch}/d#eta"); | |
530 | dummy->GetYaxis()->SetTitleOffset(1); | |
531 | ||
0f67a57c | 532 | TCanvas* canvas = new TCanvas("dNdEta1", "dNdEta1", 500, 500); |
d09fb536 | 533 | |
0ab29cfa | 534 | dummy->DrawCopy(); |
d09fb536 | 535 | histESDMBVtx->Draw("SAME"); |
536 | histESDMB->Draw("SAME"); | |
537 | histESD->Draw("SAME"); | |
1d107532 | 538 | histESDnsd->Draw("SAME"); |
69b09e3b | 539 | legend->Draw(); |
d09fb536 | 540 | |
3dfa46a4 | 541 | if (save) |
542 | { | |
543 | canvas->SaveAs("dNdEta1.gif"); | |
544 | canvas->SaveAs("dNdEta1.eps"); | |
545 | } | |
1d107532 | 546 | |
547 | histESD->Fit("pol0", "0", "", -0.45, 0.45); | |
548 | histESDnsd->Fit("pol0", "0", "", -0.45, 0.45); | |
0ab29cfa | 549 | |
550 | if (onlyESD) | |
551 | return; | |
d09fb536 | 552 | |
dd367a14 | 553 | loadlibs(); |
74fd10b3 | 554 | |
d09fb536 | 555 | TFile* file2 = TFile::Open("analysis_mc.root"); |
745d6088 | 556 | |
69b09e3b | 557 | TH1* histMCTrVtx = (TH1*) GetMCHist("dndetaTrVtx", -1, "MC: MB with trigger")->Clone("histMCTrVtx"); |
558 | TH1* ratioTrVtx = (TH1*) DrawdNdEtaRatio(histESDMBVtx, histMCTrVtx, "triggered_vertex", etaPlotLimit)->Clone(); | |
559 | ||
1cbdb1a6 | 560 | TH1* histMC = (TH1*) GetMCHist("dndeta", -1, "MC: full inelastic")->Clone("histMC"); |
561 | TH1* histMCTr = (TH1*) GetMCHist("dndetaTr", -1, "MC: minimum bias")->Clone("histMCTr"); | |
1cbdb1a6 | 562 | TH1* histMCnsd = (TH1*) GetMCHist("dndetaNSD", -1, "MC: NSD")->Clone("histMCnsd"); |
d09fb536 | 563 | |
69b09e3b | 564 | TH1* histMCPtCut = (TH1*) GetMCHist("dndeta", 0.21, "MC: full inelastic, pt cut")->Clone("histMCPtCut"); |
565 | TH1* histMCTrPtCut = (TH1*) GetMCHist("dndetaTr", 0.21, "MC: minimum bias, pt cut")->Clone("histMCTrPtCut"); | |
566 | TH1* histMCTrVtxPtCut = (TH1*) GetMCHist("dndetaTrVtx", 0.21, "MC: MB with trigger, pt cut")->Clone("histMCTrVtxPtCut"); | |
567 | TH1* histMCnsdNoPt = (TH1*) GetMCHist("dndetaNSD", 0.21, "MC: NSD, put cut")->Clone("histMCnsdNoPt"); | |
568 | TH1* histMCTracksPtCut = (TH1*) GetMCHist("dndetaTracks", 0.21, "MC: Tracks w/o resolution effect, pt cut")->Clone("histMCTracksPtCut"); | |
9e952c39 | 569 | |
d09fb536 | 570 | Prepare1DPlot(histMC); |
0fc41645 | 571 | Prepare1DPlot(histMCnsd); |
74fd10b3 | 572 | Prepare1DPlot(histMCTr); |
573 | Prepare1DPlot(histMCTrVtx); | |
574 | ||
d09fb536 | 575 | Prepare1DPlot(histMCPtCut); |
74fd10b3 | 576 | Prepare1DPlot(histMCTrPtCut); |
577 | Prepare1DPlot(histMCTrVtxPtCut); | |
745d6088 | 578 | Prepare1DPlot(histMCTracksPtCut); |
579 | ||
580 | histMC->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
581 | histMCnsd->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
582 | histMCTr->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
583 | histMCTrVtx->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
584 | ||
585 | histMCPtCut->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
586 | histMCTrPtCut->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
587 | histMCTrVtxPtCut->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
588 | histMCTracksPtCut->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
d09fb536 | 589 | |
9e952c39 | 590 | histMC->SetLineColor(1); |
0fc41645 | 591 | histMCnsd->SetLineColor(6); |
9e952c39 | 592 | histMCTr->SetLineColor(2); |
69b09e3b | 593 | histMCTrVtx->SetLineColor(4); |
74fd10b3 | 594 | |
9e952c39 | 595 | histMCPtCut->SetLineColor(1); |
596 | histMCTrPtCut->SetLineColor(2); | |
69b09e3b | 597 | histMCTrVtxPtCut->SetLineColor(4); |
9e952c39 | 598 | if (histMCTracksPtCut) |
69b09e3b | 599 | histMCTracksPtCut->SetLineColor(3); |
d09fb536 | 600 | |
745d6088 | 601 | TCanvas* canvas2 = new TCanvas("dNdEta2", "dNdEta2", 500, 500); |
602 | ||
0ab29cfa | 603 | TH2* dummy2 = (TH2F*) dummy->Clone("dummy2"); |
0fc41645 | 604 | dummy2->GetYaxis()->SetRangeUser(0, max * 1.1); |
d09fb536 | 605 | |
0ab29cfa | 606 | dummy2->DrawCopy(); |
d09fb536 | 607 | histMC->Draw("SAME"); |
0fc41645 | 608 | histMCnsd->Draw("SAME"); |
74fd10b3 | 609 | histMCTr->Draw("SAME"); |
610 | histMCTrVtx->Draw("SAME"); | |
d09fb536 | 611 | histESD->Draw("SAME"); |
0fc41645 | 612 | histESDnsd->Draw("SAME"); |
74fd10b3 | 613 | histESDMB->Draw("SAME"); |
614 | histESDMBVtx->Draw("SAME"); | |
d09fb536 | 615 | histESDNoPt->Draw("SAME"); |
74fd10b3 | 616 | histESDMBNoPt->Draw("SAME"); |
617 | histESDMBVtxNoPt->Draw("SAME"); | |
9e952c39 | 618 | histESDMBTracksNoPt->Draw("SAME"); |
d09fb536 | 619 | histMCPtCut->Draw("SAME"); |
74fd10b3 | 620 | histMCTrPtCut->Draw("SAME"); |
621 | histMCTrVtxPtCut->Draw("SAME"); | |
9e952c39 | 622 | if (histMCTracksPtCut) |
623 | histMCTracksPtCut->Draw("SAME"); | |
d09fb536 | 624 | |
3dfa46a4 | 625 | if (save) |
626 | { | |
627 | canvas2->SaveAs("dNdEta2.gif"); | |
628 | canvas2->SaveAs("dNdEta2.eps"); | |
629 | } | |
0ab29cfa | 630 | |
69b09e3b | 631 | TH1* ratio = (TH1*) DrawdNdEtaRatio(histESD, histMC, "full_inelastic", etaPlotLimit)->Clone(); |
632 | TH1* ratioTr = (TH1*) DrawdNdEtaRatio(histESDMB, histMCTr, "triggered", etaPlotLimit)->Clone(); | |
633 | TH1* ratioTrVtx = (TH1*) DrawdNdEtaRatio(histESDMBVtx, histMCTrVtx, "triggered_vertex", etaPlotLimit)->Clone(); | |
634 | TH1* ratioTrVtxNoPt = (TH1*) DrawdNdEtaRatio(histESDMBVtxNoPt, histMCTrVtxPtCut, "triggered_vertex_nopt", etaPlotLimit)->Clone(); | |
635 | TH1* ratioNSD = (TH1*) DrawdNdEtaRatio(histESDnsd, histMCnsd, "NSD", etaPlotLimit)->Clone(); | |
636 | ||
637 | // draw ratios of single steps | |
638 | c7 = new TCanvas("all_ratios", "all_ratios", 600, 600); | |
639 | c7->SetRightMargin(0.05); | |
640 | c7->SetTopMargin(0.05); | |
641 | c7->SetGridx(); | |
642 | c7->SetGridy(); | |
643 | ||
644 | ratioTrVtxNoPt->SetMarkerStyle(20); | |
645 | ratioTrVtx->SetMarkerStyle(21); | |
646 | ratioTr->SetMarkerStyle(23); | |
647 | ratio->SetMarkerStyle(22); | |
648 | ratioNSD->SetMarkerStyle(26); | |
649 | ||
650 | ratioTrVtxNoPt->SetMarkerSize(2); | |
651 | ratioTrVtx->SetMarkerSize(2); | |
652 | ratioTr->SetMarkerSize(2); | |
653 | ratio->SetMarkerSize(2); | |
654 | ratioNSD->SetMarkerSize(2); | |
655 | ||
656 | ratioTrVtxNoPt->SetMarkerColor(1); | |
657 | ratioTrVtx->SetMarkerColor(2); | |
658 | ratioTr->SetMarkerColor(4); | |
659 | ratio->SetMarkerColor(2); | |
660 | ratioNSD->SetMarkerColor(1); | |
661 | ||
662 | ratioTrVtxNoPt->SetLineColor(1); | |
663 | ratioTrVtx->SetLineColor(2); | |
664 | ratioTr->SetLineColor(4); | |
665 | ratio->SetLineColor(2); | |
666 | ratioNSD->SetLineColor(1); | |
667 | ||
668 | legend7 = new TLegend(0.13, 0.7, 0.94, 0.9); | |
669 | legend7->SetFillColor(0); | |
670 | legend7->SetTextSize(0.035); | |
671 | legend7->SetNColumns(2); | |
672 | ||
673 | flat = new TF1("flat", "-1", -5, 5); | |
674 | ratioTrVtxNoPt->Add(flat); | |
675 | ratioTrVtx->Add(flat); | |
676 | ratioTr->Add(flat); | |
677 | ratio->Add(flat); | |
678 | ratioNSD->Add(flat); | |
679 | ||
680 | ratioTrVtxNoPt->Scale(100); | |
681 | ratioTrVtx->Scale(100); | |
682 | ratioTr->Scale(100); | |
683 | ratio->Scale(100); | |
684 | ratioNSD->Scale(100); | |
685 | ||
686 | ratio->Add(ratioTr, -1); | |
687 | ratioNSD->Add(ratioTr, -1); | |
688 | ratioTr->Add(ratioTrVtx, -1); | |
689 | ratioTrVtx->Add(ratioTrVtxNoPt, -1); | |
690 | ||
691 | legend7->AddEntry(ratioTrVtxNoPt, "Track-to-particle", "P"); | |
692 | legend7->AddEntry(ratio, "Trigger-bias INEL", "P"); | |
693 | legend7->AddEntry(ratioTr, "Vertex-reconstruction", "P"); | |
694 | legend7->AddEntry(ratioNSD, "Trigger-bias NSD", "P"); | |
a7f69e56 | 695 | if ((fdNdEtaAnalysis->GetAnalysisMode() & AliPWG0Helper::kFieldOn) && (fdNdEtaAnalysis->GetAnalysisMode() & AliPWG0Helper::kTPC || fdNdEtaAnalysis->GetAnalysisMode() & AliPWG0Helper::kTPCITS)) |
69b09e3b | 696 | legend7->AddEntry(ratioTrVtx, "p_{T} cut-off", "P"); |
697 | ||
698 | TH1* dummy7 = new TH2F("dummy7", ";#eta;Deviation in %", 100, -etaPlotLimit, etaPlotLimit, 100, -5, 7); | |
699 | dummy7->SetStats(0); | |
700 | dummy7->Draw(); | |
701 | ||
702 | ratio->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
703 | ratioTr->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
704 | ratioTrVtx->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
705 | ratioTrVtxNoPt->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
706 | ratioNSD->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); | |
707 | ||
708 | ratio->Draw("HIST EP SAME"); | |
709 | ratioTr->Draw("HIST EP SAME"); | |
a7f69e56 | 710 | if ((fdNdEtaAnalysis->GetAnalysisMode() & AliPWG0Helper::kFieldOn) && (fdNdEtaAnalysis->GetAnalysisMode() & AliPWG0Helper::kTPC || fdNdEtaAnalysis->GetAnalysisMode() & AliPWG0Helper::kTPCITS)) |
69b09e3b | 711 | ratioTrVtx->Draw("HIST EP SAME"); |
712 | ratioTrVtxNoPt->Draw("HIST EP SAME"); | |
713 | ratioNSD->Draw("HIST EP SAME"); | |
714 | legend7->Draw(); | |
715 | ||
716 | c7->SaveAs("ratios.eps"); | |
745d6088 | 717 | |
0fc41645 | 718 | new TCanvas; |
719 | dummy2->DrawCopy(); | |
720 | histMCnsd->Draw("SAME"); | |
721 | histESDnsd->Draw("SAME"); | |
722 | ||
69b09e3b | 723 | ratio = (TH1*) histMC->Clone("ratio"); |
8ca1a6d9 | 724 | TH1* ratioNoPt = (TH1*) histMCPtCut->Clone("ratioNoPt"); |
725 | ||
726 | ratio->Divide(histESD); | |
727 | ratioNoPt->Divide(histESDNoPt); | |
728 | ||
3dfa46a4 | 729 | ratio->GetXaxis()->SetRangeUser(-etaLimit, etaLimit); |
8ca1a6d9 | 730 | |
731 | ratio->SetLineColor(1); | |
732 | ratioNoPt->SetLineColor(2); | |
733 | ||
dd367a14 | 734 | Double_t average = 0; // average deviation from 1 in ratio (depends on the number of bins if statistical) |
735 | for (Int_t bin = ratio->FindBin(-0.7999); bin <= ratio->FindBin(0.7999); bin++) | |
736 | average += TMath::Abs(ratio->GetBinContent(bin) - 1); | |
737 | Int_t nBins = ratio->FindBin(0.7999) - ratio->FindBin(-0.7999) + 1; | |
738 | average /= nBins; | |
739 | Printf("Average deviation in |eta| < 0.8 is %.2f %%", average * 100); | |
740 | ||
741 | PrintIntegratedDeviation(histMC, histESD, "all events"); | |
51f6de65 | 742 | PrintIntegratedDeviation(histMCnsd, histESDnsd, "all events (NSD)"); |
dd367a14 | 743 | PrintIntegratedDeviation(histMCTr, histESDMB, "triggered"); |
744 | PrintIntegratedDeviation(histMCTrVtx, histESDMBVtx, "trigger, vertex"); | |
745 | PrintIntegratedDeviation(histMCPtCut, histESDNoPt, "all events (no pt corr)"); | |
69b09e3b | 746 | PrintIntegratedDeviation(histMCnsdNoPt, histESDnsdNoPt, "all events (NSD) (no pt corr)"); |
dd367a14 | 747 | PrintIntegratedDeviation(histMCTrPtCut, histESDMBNoPt, "triggered (no pt corr)"); |
748 | PrintIntegratedDeviation(histMCTrVtxPtCut, histESDMBVtxNoPt, "trigger, vertex (no pt corr)"); | |
a7f69e56 | 749 | PrintIntegratedDeviation(histESD, histESDNoPt, "pt cut off correction"); |
dd367a14 | 750 | |
69b09e3b | 751 | TCanvas* canvas3 = new TCanvas("dNdEta", "dNdEta", 600, 600); |
8ca1a6d9 | 752 | canvas3->Range(0, 0, 1, 1); |
753 | //canvas3->Divide(1, 2, 0, 0); | |
754 | ||
755 | //canvas3->cd(1); | |
9e952c39 | 756 | TPad* pad1 = new TPad("dNdEta_1", "", 0, 0.5, 0.98, 0.98); |
69b09e3b | 757 | pad1->SetTopMargin(0.05); |
758 | pad1->SetLeftMargin(0.13); | |
8ca1a6d9 | 759 | pad1->Draw(); |
760 | ||
9e952c39 | 761 | TPad* pad2 = new TPad("dNdEta_2", "", 0, 0.02, 0.98, 0.5); |
69b09e3b | 762 | pad2->SetLeftMargin(0.13); |
8ca1a6d9 | 763 | pad2->Draw(); |
764 | ||
69b09e3b | 765 | pad1->SetRightMargin(0.01); |
766 | pad2->SetRightMargin(0.01); | |
0ab29cfa | 767 | |
8ca1a6d9 | 768 | // no border between them |
769 | pad1->SetBottomMargin(0); | |
770 | pad2->SetTopMargin(0); | |
771 | ||
772 | pad1->cd(); | |
69b09e3b | 773 | pad1->SetGridx(); |
774 | pad1->SetGridy(); | |
8ca1a6d9 | 775 | |
72e597d7 | 776 | legend->AddEntry(histMC, "MC prediction"); |
0ab29cfa | 777 | |
69b09e3b | 778 | dummy->GetXaxis()->SetLabelSize(0.08); |
779 | dummy->GetYaxis()->SetLabelSize(0.08); | |
780 | dummy->GetXaxis()->SetTitleSize(0.08); | |
781 | dummy->GetYaxis()->SetTitleSize(0.08); | |
782 | dummy->GetYaxis()->SetTitleOffset(0.8); | |
72e597d7 | 783 | dummy->DrawCopy(); |
0ab29cfa | 784 | histESDMBVtx->Draw("SAME"); |
785 | histESDMB->Draw("SAME"); | |
786 | histESD->Draw("SAME"); | |
0ab29cfa | 787 | histMC->Draw("SAME"); |
72e597d7 | 788 | |
69b09e3b | 789 | legend->SetTextSize(0.08); |
72e597d7 | 790 | legend->Draw(); |
0ab29cfa | 791 | |
8ca1a6d9 | 792 | pad2->cd(); |
793 | pad2->SetBottomMargin(0.15); | |
69b09e3b | 794 | //pad2->SetGridx(); |
795 | //pad2->SetGridy(); | |
72e597d7 | 796 | |
69b09e3b | 797 | Float_t minR = 0.91; //TMath::Min(0.961, ratio->GetMinimum() * 0.95); |
798 | Float_t maxR = 1.09; //TMath::Max(1.049, ratio->GetMaximum() * 1.05); | |
9e952c39 | 799 | |
69b09e3b | 800 | TH1F dummy3("dummy3", ";#eta;Ratio: MC / corr", 100, -etaPlotLimit, etaPlotLimit); |
8ca1a6d9 | 801 | dummy3.SetStats(kFALSE); |
745d6088 | 802 | for (Int_t i=1; i<=100; ++i) |
803 | dummy3.SetBinContent(i, 1); | |
0fc41645 | 804 | dummy3.GetYaxis()->SetRangeUser(minR, maxR); |
8ca1a6d9 | 805 | dummy3.SetLineWidth(2); |
69b09e3b | 806 | dummy3.GetXaxis()->SetLabelSize(0.08); |
807 | dummy3.GetYaxis()->SetLabelSize(0.08); | |
808 | dummy3.GetXaxis()->SetTitleSize(0.08); | |
809 | dummy3.GetYaxis()->SetTitleSize(0.08); | |
810 | dummy3.GetYaxis()->SetTitleOffset(0.8); | |
8ca1a6d9 | 811 | dummy3.DrawCopy(); |
72e597d7 | 812 | |
8ca1a6d9 | 813 | ratio->Draw("SAME"); |
72e597d7 | 814 | |
8ca1a6d9 | 815 | //pad2->Draw(); |
72e597d7 | 816 | |
8ca1a6d9 | 817 | canvas3->Modified(); |
72e597d7 | 818 | |
3dfa46a4 | 819 | if (save) |
820 | { | |
821 | canvas3->SaveAs("dNdEta.gif"); | |
822 | canvas3->SaveAs("dNdEta.eps"); | |
823 | } | |
8ca1a6d9 | 824 | |
825 | TCanvas* canvas4 = new TCanvas("ratio", "ratio", 700, 500); | |
72e597d7 | 826 | |
827 | ratio->Draw(); | |
828 | ratioNoPt->Draw("SAME"); | |
829 | ||
4c351225 | 830 | TLegend* legend = new TLegend(0.6, 0.7, 0.95, 0.9); |
831 | legend->SetFillColor(0); | |
832 | legend->AddEntry(ratio, "mc/esd"); | |
833 | legend->AddEntry(ratioNoPt, "mc/esd, not pt cut off corrected"); | |
834 | legend->Draw(); | |
d09fb536 | 835 | } |
836 | ||
69b09e3b | 837 | TH1* DrawdNdEtaRatio(TH1* corr, TH1* mc, const char* name, Float_t etaPlotLimit) |
745d6088 | 838 | { |
69b09e3b | 839 | TCanvas* canvas3 = new TCanvas(name, name, 600, 600); |
745d6088 | 840 | canvas3->Range(0, 0, 1, 1); |
841 | ||
842 | TPad* pad1 = new TPad(Form("%s_1", name), "", 0, 0.5, 0.98, 0.98); | |
843 | pad1->Draw(); | |
844 | ||
845 | TPad* pad2 = new TPad(Form("%s_2", name), "", 0, 0.02, 0.98, 0.5); | |
846 | pad2->Draw(); | |
847 | ||
69b09e3b | 848 | pad1->SetRightMargin(0.01); |
849 | pad2->SetRightMargin(0.01); | |
850 | pad1->SetTopMargin(0.05); | |
851 | pad1->SetLeftMargin(0.13); | |
852 | pad2->SetLeftMargin(0.13); | |
853 | pad2->SetBottomMargin(0.15); | |
854 | ||
745d6088 | 855 | // no border between them |
856 | pad1->SetBottomMargin(0); | |
857 | pad2->SetTopMargin(0); | |
858 | ||
859 | pad1->cd(); | |
69b09e3b | 860 | pad1->SetGridx(); |
861 | pad1->SetGridy(); | |
745d6088 | 862 | |
69b09e3b | 863 | TLegend* legend = new TLegend(0.35, 0.05, 0.75, 0.3); |
745d6088 | 864 | legend->SetFillColor(0); |
69b09e3b | 865 | legend->AddEntry(corr, "Corrected"); |
745d6088 | 866 | legend->AddEntry(mc, "MC prediction"); |
69b09e3b | 867 | legend->SetTextSize(0.08); |
745d6088 | 868 | |
a7f69e56 | 869 | TH2F* dummy = new TH2F("dummy", "", 100, -etaPlotLimit, etaPlotLimit, 1000, 2.7, corr->GetMaximum() * 1.1); |
745d6088 | 870 | Prepare1DPlot(dummy); |
871 | dummy->SetStats(kFALSE); | |
872 | dummy->SetXTitle("#eta"); | |
873 | dummy->SetYTitle("dN_{ch}/d#eta"); | |
874 | dummy->GetYaxis()->SetTitleOffset(1); | |
875 | ||
69b09e3b | 876 | dummy->GetXaxis()->SetLabelSize(0.08); |
877 | dummy->GetYaxis()->SetLabelSize(0.08); | |
878 | dummy->GetXaxis()->SetTitleSize(0.08); | |
879 | dummy->GetYaxis()->SetTitleSize(0.08); | |
880 | dummy->GetYaxis()->SetTitleOffset(0.8); | |
745d6088 | 881 | dummy->DrawCopy(); |
882 | ||
883 | corr->Draw("SAME"); | |
884 | mc->Draw("SAME"); | |
885 | ||
886 | legend->Draw(); | |
887 | ||
888 | pad2->cd(); | |
889 | pad2->SetBottomMargin(0.15); | |
69b09e3b | 890 | //pad2->SetGridx(); |
891 | //pad2->SetGridy(); | |
745d6088 | 892 | |
893 | TH1* ratio = (TH1*) mc->Clone("ratio"); | |
894 | ratio->Divide(corr); | |
895 | ||
69b09e3b | 896 | Float_t minR = TMath::Min(0.91, ratio->GetMinimum() * 0.95); |
897 | Float_t maxR = TMath::Max(1.09, ratio->GetMaximum() * 1.05); | |
745d6088 | 898 | |
899 | TH1F dummy3("dummy3", ";#eta;Ratio: MC / corr", 100, -etaPlotLimit, etaPlotLimit); | |
900 | dummy3.SetStats(kFALSE); | |
901 | for (Int_t i=1; i<=100; ++i) | |
902 | dummy3.SetBinContent(i, 1); | |
903 | dummy3.GetYaxis()->SetRangeUser(minR, maxR); | |
904 | dummy3.SetLineWidth(2); | |
69b09e3b | 905 | dummy3.GetXaxis()->SetLabelSize(0.08); |
906 | dummy3.GetYaxis()->SetLabelSize(0.08); | |
907 | dummy3.GetXaxis()->SetTitleSize(0.08); | |
908 | dummy3.GetYaxis()->SetTitleSize(0.08); | |
909 | dummy3.GetYaxis()->SetTitleOffset(0.8); | |
745d6088 | 910 | dummy3.DrawCopy(); |
911 | ||
912 | ratio->Draw("SAME"); | |
913 | ||
914 | canvas3->Modified(); | |
69b09e3b | 915 | |
916 | return ratio; | |
745d6088 | 917 | } |
918 | ||
d09fb536 | 919 | void ptSpectrum() |
920 | { | |
921 | TFile* file = TFile::Open("analysis_esd.root"); | |
0ab29cfa | 922 | TH1* histESD = (TH1*) file->Get("dndeta/dndeta_pt"); |
d09fb536 | 923 | |
924 | TFile* file2 = TFile::Open("analysis_mc.root"); | |
0ab29cfa | 925 | TH1* histMC = (TH1*) file2->Get("dndeta/dndeta_pt"); |
d09fb536 | 926 | |
927 | TCanvas* canvas = new TCanvas("ptSpectrum", "ptSpectrum", 500, 500); | |
928 | InitPad(); | |
929 | gPad->SetLogy(); | |
930 | ||
931 | Prepare1DPlot(histMC); | |
932 | Prepare1DPlot(histESD); | |
933 | ||
934 | histESD->SetTitle(""); | |
25db2d85 | 935 | histESD->GetXaxis()->SetTitle("p_{T} [GeV/c]"); |
936 | histESD->GetYaxis()->SetTitle("#frac{dN}{d#eta dp_{T}} [c/GeV]"); | |
d09fb536 | 937 | |
938 | histMC->SetLineColor(kBlue); | |
939 | histESD->SetLineColor(kRed); | |
940 | ||
941 | histESD->GetYaxis()->SetTitleOffset(1.5); | |
942 | histESD->GetXaxis()->SetRangeUser(0, 4.9999); | |
943 | ||
944 | histESD->SetMaximum(TMath::Max(histESD->GetMaximum(), histMC->GetMaximum()) * 2); | |
945 | ||
946 | histESD->Draw(); | |
947 | histMC->Draw("SAME"); | |
948 | ||
949 | canvas->SaveAs("ptSpectrum.gif"); | |
0ab29cfa | 950 | canvas->SaveAs("ptSpectrum.eps"); |
92d2d8ad | 951 | } |
952 | ||
0bd1f8a0 | 953 | void TriggerBiasVtxRecon(const char* fileName = "correction_map.root", const char* folder = "dndeta_correction") |
92d2d8ad | 954 | { |
0448e811 | 955 | gSystem->Load("libPWG0base"); |
956 | ||
957 | TFile::Open(fileName); | |
958 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction"); | |
959 | dNdEtaCorrection->LoadHistograms(); | |
0ab29cfa | 960 | |
0448e811 | 961 | TH2* corrTrigger = dNdEtaCorrection->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetCorrectionHistogram(); |
962 | TH2* corrVtx = dNdEtaCorrection->GetVertexRecoCorrection()->GetEventCorrection()->GetCorrectionHistogram(); | |
0ab29cfa | 963 | |
964 | Prepare2DPlot(corrTrigger); | |
0448e811 | 965 | corrTrigger->SetTitle("b) Trigger bias correction"); |
0ab29cfa | 966 | |
967 | Prepare2DPlot(corrVtx); | |
0448e811 | 968 | corrVtx->SetTitle("a) Vertex reconstruction correction"); |
0ab29cfa | 969 | |
5c495d37 | 970 | corrTrigger->GetYaxis()->SetTitle("Multiplicity"); |
971 | corrVtx->GetYaxis()->SetTitle("Multiplicity"); | |
972 | ||
0ab29cfa | 973 | TCanvas* canvas = new TCanvas("TriggerBiasVtxRecon", "TriggerBiasVtxRecon", 1000, 500); |
974 | canvas->Divide(2, 1); | |
975 | ||
976 | canvas->cd(1); | |
977 | InitPadCOLZ(); | |
0448e811 | 978 | corrVtx->DrawCopy("COLZ"); |
0ab29cfa | 979 | |
980 | canvas->cd(2); | |
981 | InitPadCOLZ(); | |
0448e811 | 982 | corrTrigger->DrawCopy("COLZ"); |
0ab29cfa | 983 | |
984 | canvas->SaveAs(Form("TriggerBiasVtxRecon_%d.gif", gMax)); | |
985 | canvas->SaveAs(Form("TriggerBiasVtxRecon_%d.eps", gMax)); | |
986 | ||
987 | canvas = new TCanvas("TriggerBiasVtxReconZoom", "TriggerBiasVtxReconZoom", 1000, 500); | |
988 | canvas->Divide(2, 1); | |
989 | ||
990 | corrTrigger->GetYaxis()->SetRangeUser(0, 5); | |
991 | corrVtx->GetYaxis()->SetRangeUser(0, 5); | |
992 | ||
993 | canvas->cd(1); | |
994 | InitPadCOLZ(); | |
0448e811 | 995 | corrVtx->DrawCopy("COLZ"); |
0ab29cfa | 996 | |
997 | canvas->cd(2); | |
998 | InitPadCOLZ(); | |
0448e811 | 999 | corrTrigger->DrawCopy("COLZ"); |
0ab29cfa | 1000 | |
1001 | canvas->SaveAs(Form("TriggerBiasVtxReconZoom_%d.gif", gMax)); | |
1002 | canvas->SaveAs(Form("TriggerBiasVtxReconZoom_%d.eps", gMax)); | |
1003 | } | |
1004 | ||
1005 | void TriggerBias(const char* fileName = "correction_map.root") | |
1006 | { | |
1007 | TFile* file = TFile::Open(fileName); | |
92d2d8ad | 1008 | |
5c495d37 | 1009 | TH2* corr = dynamic_cast<TH2*> (file->Get("dndeta_correction/corr_dndeta_correction_trigger")); |
92d2d8ad | 1010 | |
1011 | Prepare2DPlot(corr); | |
1012 | corr->SetTitle("Trigger bias correction"); | |
1013 | ||
1014 | TCanvas* canvas = new TCanvas("TriggerBias", "TriggerBias", 500, 500); | |
1015 | InitPadCOLZ(); | |
1016 | corr->DrawCopy("COLZ"); | |
1017 | ||
25db2d85 | 1018 | canvas->SaveAs(Form("TriggerBias_%d.gif", gMax)); |
0ab29cfa | 1019 | canvas->SaveAs(Form("TriggerBias_%d.eps", gMax)); |
92d2d8ad | 1020 | |
1021 | corr->GetYaxis()->SetRangeUser(0, 5); | |
1022 | ||
1023 | canvas = new TCanvas("TriggerBiasZoom", "TriggerBiasZoom", 500, 500); | |
1024 | InitPadCOLZ(); | |
1025 | corr->DrawCopy("COLZ"); | |
1026 | ||
25db2d85 | 1027 | canvas->SaveAs(Form("TriggerBiasZoom_%d.gif", gMax)); |
0ab29cfa | 1028 | canvas->SaveAs(Form("TriggerBiasZoom_%d.eps", gMax)); |
92d2d8ad | 1029 | } |
1030 | ||
72e597d7 | 1031 | void TriggerBias1D(const char* fileName = "correction_map.root", const char* folderName = "dndeta_correction") |
1032 | { | |
1033 | gSystem->Load("libPWG0base"); | |
1034 | ||
1035 | TFile* file = TFile::Open(fileName); | |
1036 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(folderName, folderName); | |
0448e811 | 1037 | dNdEtaCorrection->LoadHistograms(); |
72e597d7 | 1038 | |
0448e811 | 1039 | TH1* hist = dNdEtaCorrection->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->Get1DCorrection("x"); |
1040 | TH1* hist2 = dNdEtaCorrection->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->Get1DCorrection("y", -10, 10); | |
72e597d7 | 1041 | |
0448e811 | 1042 | TCanvas* canvas = new TCanvas("TriggerBias1D", "TriggerBias1D", 1000, 500); |
8ca1a6d9 | 1043 | canvas->Divide(2, 1); |
1044 | ||
1045 | canvas->cd(1); | |
72e597d7 | 1046 | InitPad(); |
1047 | ||
1048 | Prepare1DPlot(hist); | |
1049 | hist->SetTitle(""); | |
1050 | hist->GetYaxis()->SetTitle("correction factor"); | |
1051 | hist->GetYaxis()->SetRangeUser(1, 1.5); | |
1052 | hist->GetYaxis()->SetTitleOffset(1.6); | |
1053 | hist->Draw(); | |
1054 | ||
8ca1a6d9 | 1055 | canvas->cd(2); |
1056 | InitPad(); | |
1057 | ||
1058 | Prepare1DPlot(hist2); | |
1059 | hist2->SetTitle(""); | |
1060 | hist2->GetYaxis()->SetTitle("correction factor"); | |
1061 | hist2->GetXaxis()->SetRangeUser(0, 5); | |
1062 | hist2->GetYaxis()->SetTitleOffset(1.6); | |
1063 | hist2->GetXaxis()->SetTitle("multiplicity"); | |
1064 | hist2->Draw(); | |
1065 | ||
1066 | TPaveText* pave = new TPaveText(0.6, 0.8, 0.8, 0.85, "NDC"); | |
1067 | pave->SetFillColor(0); | |
1068 | pave->AddText("|z| < 10 cm"); | |
1069 | pave->Draw(); | |
1070 | ||
72e597d7 | 1071 | canvas->SaveAs("TriggerBias1D.eps"); |
1072 | } | |
1073 | ||
92d2d8ad | 1074 | void VtxRecon() |
1075 | { | |
1076 | TFile* file = TFile::Open("correction_map.root"); | |
1077 | ||
72e597d7 | 1078 | TH2* corr = dynamic_cast<TH2*> (file->Get("dndeta_correction/corr_dndeta_correction_vtxReco")); |
92d2d8ad | 1079 | |
1080 | Prepare2DPlot(corr); | |
1081 | corr->SetTitle("Vertex reconstruction correction"); | |
1082 | ||
1083 | TCanvas* canvas = new TCanvas("VtxRecon", "VtxRecon", 500, 500); | |
1084 | InitPadCOLZ(); | |
25db2d85 | 1085 | corr->DrawCopy("COLZ"); |
1086 | ||
0ab29cfa | 1087 | canvas->SaveAs(Form("VtxRecon_%d.eps", gMax)); |
1088 | canvas->SaveAs(Form("VtxRecon_%d.eps", gMax)); | |
25db2d85 | 1089 | |
1090 | corr->GetYaxis()->SetRangeUser(0, 5); | |
1091 | ||
0ab29cfa | 1092 | canvas = new TCanvas("VtxReconZoom", "VtxReconZoom", 500, 500); |
25db2d85 | 1093 | InitPadCOLZ(); |
1094 | corr->DrawCopy("COLZ"); | |
92d2d8ad | 1095 | |
25db2d85 | 1096 | canvas->SaveAs(Form("VtxReconZoom_%d.gif", gMax)); |
0ab29cfa | 1097 | canvas->SaveAs(Form("VtxReconZoom_%d.eps", gMax)); |
92d2d8ad | 1098 | } |
1099 | ||
72e597d7 | 1100 | void VtxRecon1D(const char* fileName = "correction_map.root", const char* folderName = "dndeta_correction") |
1101 | { | |
1102 | gSystem->Load("libPWG0base"); | |
1103 | ||
1104 | TFile* file = TFile::Open(fileName); | |
1105 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(folderName, folderName); | |
0448e811 | 1106 | dNdEtaCorrection->LoadHistograms(); |
72e597d7 | 1107 | |
0448e811 | 1108 | TH1* hist = dNdEtaCorrection->GetVertexRecoCorrection()->GetEventCorrection()->Get1DCorrection("x"); |
1109 | TH1* hist2 = dNdEtaCorrection->GetVertexRecoCorrection()->GetEventCorrection()->Get1DCorrection("y", -10, 10); | |
8ca1a6d9 | 1110 | |
1111 | TCanvas* canvas = new TCanvas("VtxRecon1D", "VtxRecon1D", 1000, 500); | |
1112 | canvas->Divide(2, 1); | |
72e597d7 | 1113 | |
8ca1a6d9 | 1114 | canvas->cd(1); |
72e597d7 | 1115 | InitPad(); |
1116 | ||
1117 | Prepare1DPlot(hist); | |
1118 | hist->SetTitle(""); | |
1119 | hist->GetYaxis()->SetTitle("correction factor"); | |
1120 | hist->GetYaxis()->SetRangeUser(1, 1.8); | |
1121 | hist->GetYaxis()->SetTitleOffset(1.6); | |
8ca1a6d9 | 1122 | hist->DrawCopy(); |
1123 | ||
1124 | canvas->cd(2); | |
1125 | InitPad(); | |
1126 | ||
1127 | Prepare1DPlot(hist2); | |
1128 | hist2->SetTitle(""); | |
1129 | hist2->GetYaxis()->SetTitle("correction factor"); | |
1130 | hist2->GetXaxis()->SetRangeUser(0, 20); | |
1131 | hist2->GetYaxis()->SetTitleOffset(1.6); | |
1132 | hist2->GetXaxis()->SetTitle("multiplicity"); | |
1133 | hist2->Draw(); | |
1134 | ||
1135 | TPaveText* pave = new TPaveText(0.6, 0.8, 0.8, 0.85, "NDC"); | |
1136 | pave->SetFillColor(0); | |
1137 | pave->AddText("|z| < 10 cm"); | |
1138 | pave->Draw(); | |
72e597d7 | 1139 | |
1140 | canvas->SaveAs("VtxRecon1D.eps"); | |
8ca1a6d9 | 1141 | |
0448e811 | 1142 | Correction1DCreatePlots(fileName, folderName, 9.9, 2); |
8ca1a6d9 | 1143 | |
0448e811 | 1144 | TH1* corrX = dynamic_cast<TH1*> (gROOT->FindObject("generated_x_div_measured_x")); |
1145 | TH1* corrZ = dynamic_cast<TH1*> (gROOT->FindObject("generated_z_div_measured_z")); | |
1146 | ||
1147 | Prepare1DPlot(corrX); | |
1148 | Prepare1DPlot(corrZ); | |
1149 | ||
1150 | corrX->GetYaxis()->SetTitleOffset(1.5); | |
1151 | corrZ->GetYaxis()->SetTitleOffset(1.5); | |
1152 | ||
1153 | corrX->SetTitle("a) z projection"); | |
1154 | corrZ->SetTitle("b) p_{T} projection"); | |
1155 | ||
69b09e3b | 1156 | corrX->GetYaxis()->SetTitle("Correction factor"); |
1157 | corrZ->GetYaxis()->SetTitle("Correction factor"); | |
0448e811 | 1158 | |
1159 | corrZ->GetXaxis()->SetRangeUser(0.11, 9.9); | |
1160 | ||
1161 | TString canvasName; | |
1162 | canvasName.Form("VtxRecon1D_Track"); | |
1163 | TCanvas* canvas = new TCanvas(canvasName, canvasName, 800, 400); | |
1164 | canvas->Divide(2, 1); | |
1165 | ||
1166 | canvas->cd(1); | |
1167 | InitPad(); | |
1168 | corrX->DrawCopy(); | |
1169 | ||
1170 | canvas->cd(2); | |
1171 | InitPad(); | |
1172 | gPad->SetLogx(); | |
1173 | corrZ->Draw(); | |
1174 | ||
1175 | canvas->SaveAs("VtxRecon1D_Track.eps"); | |
1176 | canvas->SaveAs("VtxRecon1D_Track.gif"); | |
72e597d7 | 1177 | } |
1178 | ||
0ab29cfa | 1179 | void Track2ParticleAsNumber(const char* fileName = "correction_map.root") |
1afae8ff | 1180 | { |
25db2d85 | 1181 | gSystem->Load("libPWG0base"); |
1182 | ||
0ab29cfa | 1183 | TFile::Open(fileName); |
8b3563f4 | 1184 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction"); |
0ab29cfa | 1185 | dNdEtaCorrection->LoadHistograms(fileName, "dndeta_correction"); |
1186 | ||
1187 | TH3F* gene = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetGeneratedHistogram(); | |
1188 | TH3F* meas = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetMeasuredHistogram(); | |
1189 | ||
1190 | TH3F* gene = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetGeneratedHistogram(); | |
1191 | TH3F* meas = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetMeasuredHistogram(); | |
1192 | ||
1193 | gene->GetYaxis()->SetRangeUser(-0.8, 0.8); | |
1194 | meas->GetYaxis()->SetRangeUser(-0.8, 0.8); | |
1195 | gene->GetXaxis()->SetRangeUser(-10, 10); | |
1196 | meas->GetXaxis()->SetRangeUser(-10, 10); | |
1197 | ||
1198 | Float_t eff1 = gene->Integral() / meas->Integral(); | |
1199 | Float_t error1 = TMath::Sqrt(gene->Integral()) / meas->Integral(); | |
1200 | ||
1201 | printf("Correction without pT cut: %f +- %f\n", eff1, error1); | |
1202 | ||
1203 | gene->GetZaxis()->SetRangeUser(0.3, 10); | |
1204 | meas->GetZaxis()->SetRangeUser(0.3, 10); | |
1205 | ||
1206 | Float_t eff2 = gene->Integral() / meas->Integral(); | |
1207 | Float_t error2 = TMath::Sqrt(gene->Integral()) / meas->Integral(); | |
1208 | ||
1209 | printf("Correction with pT cut: %f +- %f\n", eff2, error2); | |
1210 | ||
1211 | gene->GetZaxis()->SetRangeUser(0.3, 1); | |
1212 | meas->GetZaxis()->SetRangeUser(0.3, 1); | |
1213 | ||
1214 | Float_t eff3 = gene->Integral() / meas->Integral(); | |
1215 | Float_t error3 = TMath::Sqrt(gene->Integral()) / meas->Integral(); | |
1216 | ||
1217 | printf("Correction with 0.3 < pT < 0.5: %f +- %f\n", eff3, error3); | |
1218 | } | |
1219 | ||
69b09e3b | 1220 | void Correction1DCreatePlots(const char* fileName = "correction_map.root", const char* folderName = "dndeta_correction", Float_t upperPtLimit = 9.9, Int_t correctionType = 0, Int_t correctionType2 = -1) |
0ab29cfa | 1221 | { |
69b09e3b | 1222 | if (correctionType2 == -1) |
1223 | correctionType2 = correctionType; | |
1224 | ||
0ab29cfa | 1225 | TFile::Open(fileName); |
bdfe2916 | 1226 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(folderName, folderName); |
0448e811 | 1227 | dNdEtaCorrection->LoadHistograms(); |
0ab29cfa | 1228 | |
0448e811 | 1229 | TH3F* gene = dNdEtaCorrection->GetCorrection(correctionType)->GetTrackCorrection()->GetGeneratedHistogram(); |
69b09e3b | 1230 | TH3F* meas = dNdEtaCorrection->GetCorrection(correctionType2)->GetTrackCorrection()->GetMeasuredHistogram(); |
0ab29cfa | 1231 | |
1232 | gene->GetZaxis()->SetRangeUser(0.3, upperPtLimit); | |
1233 | meas->GetZaxis()->SetRangeUser(0.3, upperPtLimit); | |
1234 | gene->GetYaxis()->SetRangeUser(-0.8, 0.8); | |
1235 | meas->GetYaxis()->SetRangeUser(-0.8, 0.8); | |
5a6310fe | 1236 | AliPWG0Helper::CreateDividedProjections(gene, meas, "x", kFALSE); |
0ab29cfa | 1237 | gene->GetYaxis()->SetRange(0, 0); |
1238 | meas->GetYaxis()->SetRange(0, 0); | |
1239 | ||
5a6310fe | 1240 | gene->GetXaxis()->SetRangeUser(-9.9, 9.9); |
1241 | meas->GetXaxis()->SetRangeUser(-9.9, 9.9); | |
1242 | AliPWG0Helper::CreateDividedProjections(gene, meas, "y", kFALSE); | |
0ab29cfa | 1243 | gene->GetZaxis()->SetRange(0, 0); |
1244 | meas->GetZaxis()->SetRange(0, 0); | |
1245 | ||
1246 | gene->GetYaxis()->SetRangeUser(-0.8, 0.8); | |
1247 | meas->GetYaxis()->SetRangeUser(-0.8, 0.8); | |
5a6310fe | 1248 | AliPWG0Helper::CreateDividedProjections(gene, meas, "z", kFALSE); |
0ab29cfa | 1249 | } |
25db2d85 | 1250 | |
69b09e3b | 1251 | TCanvas* Correction1D(Int_t correctionType = 0, const char* fileName = "correction_map.root", const char* folder = "dndeta_correction", Float_t upperPtLimit = 9.9, Int_t correctionType2 = -1) |
0448e811 | 1252 | { |
1253 | gSystem->Load("libPWG0base"); | |
1254 | ||
69b09e3b | 1255 | Correction1DCreatePlots(fileName, folder, upperPtLimit, correctionType, correctionType2); |
0448e811 | 1256 | |
1257 | TH1* corrX = dynamic_cast<TH1*> (gROOT->FindObject(Form("generated_x_div_measured_x", folder, folder))); | |
1258 | TH1* corrY = dynamic_cast<TH1*> (gROOT->FindObject(Form("generated_y_div_measured_y", folder, folder))); | |
1259 | TH1* corrZ = dynamic_cast<TH1*> (gROOT->FindObject(Form("generated_z_div_measured_z", folder, folder))); | |
1260 | ||
1261 | Prepare1DPlot(corrX); | |
1262 | Prepare1DPlot(corrY); | |
1263 | Prepare1DPlot(corrZ); | |
1264 | ||
69b09e3b | 1265 | /* |
0448e811 | 1266 | corrX->SetTitle("a) z projection"); |
1267 | corrY->SetTitle("b) #eta projection"); | |
1268 | corrZ->SetTitle("c) p_{T} projection"); | |
69b09e3b | 1269 | */ |
1270 | ||
1271 | corrX->SetTitle(""); | |
1272 | corrY->SetTitle(""); | |
1273 | corrZ->SetTitle(""); | |
1274 | ||
1275 | corrX->SetTitleSize(0.06, "xyz"); | |
1276 | corrX->SetLabelSize(0.06, "xyz"); | |
1277 | corrY->SetTitleSize(0.06, "xyz"); | |
1278 | corrY->SetLabelSize(0.06, "xyz"); | |
1279 | corrZ->SetTitleSize(0.06, "xyz"); | |
1280 | corrZ->SetLabelSize(0.06, "xyz"); | |
1281 | ||
1282 | corrX->GetYaxis()->SetTitle("Correction factor"); | |
1283 | corrY->GetYaxis()->SetTitle("Correction factor"); | |
1284 | corrZ->GetYaxis()->SetTitle("Correction factor"); | |
1285 | //corrX->GetYaxis()->SetTitleOffset(1.7); | |
1286 | //corrY->GetYaxis()->SetTitleOffset(1.7); | |
1287 | //corrZ->GetYaxis()->SetTitleOffset(1.7); | |
5a6310fe | 1288 | corrX->GetYaxis()->SetRangeUser(0.8, 1.5); |
1289 | corrY->GetYaxis()->SetRangeUser(0.8, 1.5); | |
1290 | corrZ->GetYaxis()->SetRangeUser(0.8, 1.5); | |
0448e811 | 1291 | |
5a6310fe | 1292 | corrZ->GetXaxis()->SetRangeUser(0.11, upperPtLimit); |
0448e811 | 1293 | |
1294 | TString canvasName; | |
5a6310fe | 1295 | canvasName.Form(Form("Correction1D_%d_%s_%f", correctionType, fileName, upperPtLimit)); |
0448e811 | 1296 | TCanvas* canvas = new TCanvas(canvasName, canvasName, 1200, 400); |
1297 | canvas->Divide(3, 1); | |
1298 | ||
5a6310fe | 1299 | TLatex* Tl = new TLatex; |
69b09e3b | 1300 | Tl->SetTextSize(0.06); |
5a6310fe | 1301 | Tl->SetBit(TLatex::kTextNDC); |
1302 | ||
0448e811 | 1303 | canvas->cd(1); |
1304 | InitPad(); | |
69b09e3b | 1305 | gPad->SetTopMargin(0.05); |
1306 | gPad->SetBottomMargin(0.15); | |
0448e811 | 1307 | corrX->DrawCopy(); |
69b09e3b | 1308 | Tl->DrawLatex(0.5, 0.88, "0.3 < p_{T} < 10"); |
1309 | Tl->DrawLatex(0.5, 0.8, "|#eta| < 0.8"); | |
0448e811 | 1310 | |
1311 | canvas->cd(2); | |
1312 | InitPad(); | |
69b09e3b | 1313 | gPad->SetTopMargin(0.05); |
1314 | gPad->SetBottomMargin(0.15); | |
0448e811 | 1315 | corrY->Draw(); |
69b09e3b | 1316 | Tl->DrawLatex(0.5, 0.88, "0.3 < p_{T} < 10"); |
1317 | Tl->DrawLatex(0.5, 0.8, "|vtx-z| < 10 cm"); | |
0448e811 | 1318 | |
1319 | canvas->cd(3); | |
1320 | InitPad(); | |
69b09e3b | 1321 | gPad->SetTopMargin(0.05); |
1322 | gPad->SetBottomMargin(0.15); | |
5a6310fe | 1323 | gPad->SetLogx(); |
0448e811 | 1324 | corrZ->Draw(); |
69b09e3b | 1325 | corrZ->GetXaxis()->SetLabelOffset(0.005); |
1326 | corrZ->GetXaxis()->SetTitleOffset(1.2); | |
1327 | Tl->DrawLatex(0.5, 0.88, "|vtx-z| < 10 cm"); | |
1328 | Tl->DrawLatex(0.5, 0.8, "|#eta| < 0.8"); | |
0448e811 | 1329 | |
5a6310fe | 1330 | return canvas; |
0448e811 | 1331 | } |
1332 | ||
72e597d7 | 1333 | void Track2Particle1D(const char* fileName = "correction_map.root", const char* folder = "dndeta_correction", Float_t upperPtLimit = 9.9) |
0ab29cfa | 1334 | { |
1335 | gSystem->Load("libPWG0base"); | |
1336 | ||
0448e811 | 1337 | Correction1DCreatePlots(fileName, folder, upperPtLimit, AlidNdEtaCorrection::kTrack2Particle); |
0ab29cfa | 1338 | |
0448e811 | 1339 | TH1* corrX = dynamic_cast<TH1*> (gROOT->FindObject(Form("generated_x_div_measured_x", folder, folder))); |
1340 | TH1* corrY = dynamic_cast<TH1*> (gROOT->FindObject(Form("generated_y_div_measured_y", folder, folder))); | |
1341 | TH1* corrZ = dynamic_cast<TH1*> (gROOT->FindObject(Form("generated_z_div_measured_z", folder, folder))); | |
0ab29cfa | 1342 | |
1343 | Prepare1DPlot(corrX); | |
1344 | Prepare1DPlot(corrY); | |
1345 | Prepare1DPlot(corrZ); | |
1346 | ||
0448e811 | 1347 | corrX->SetTitle("a) z projection"); |
72e597d7 | 1348 | corrY->SetTitle("a) #eta projection"); |
1349 | corrZ->SetTitle("b) p_{T} projection"); | |
1350 | ||
1351 | corrY->GetYaxis()->SetTitle("correction factor"); | |
1352 | corrZ->GetYaxis()->SetTitle("correction factor"); | |
0ab29cfa | 1353 | |
1354 | corrZ->GetXaxis()->SetRangeUser(0, upperPtLimit); | |
1355 | ||
bdfe2916 | 1356 | TString canvasName; |
72e597d7 | 1357 | canvasName.Form("Track2Particle1D_%s", folder); |
bdfe2916 | 1358 | TCanvas* canvas = new TCanvas(canvasName, canvasName, 1200, 400); |
0ab29cfa | 1359 | canvas->Divide(3, 1); |
1360 | ||
1361 | canvas->cd(1); | |
1362 | InitPad(); | |
bdfe2916 | 1363 | corrX->DrawCopy(); |
0ab29cfa | 1364 | |
1365 | canvas->cd(2); | |
1366 | InitPad(); | |
0448e811 | 1367 | corrY->Draw(); |
0ab29cfa | 1368 | |
1369 | canvas->cd(3); | |
1370 | InitPad(); | |
0448e811 | 1371 | corrZ->Draw(); |
0ab29cfa | 1372 | |
72e597d7 | 1373 | canvas->SaveAs(Form("Track2Particle1D_%s_%f.gif", fileName, upperPtLimit)); |
1374 | canvas->SaveAs(Form("Track2Particle1D_%s_%f.eps", fileName, upperPtLimit)); | |
1375 | ||
5c495d37 | 1376 | //TPaveText* pave = new TPaveText(-0.4, 1.35, 0.4, 1.45); |
1377 | ||
72e597d7 | 1378 | canvasName.Form("Track2Particle1D_%s_etapt", folder); |
1379 | TCanvas* canvas = new TCanvas(canvasName, canvasName, 1000, 500); | |
1380 | canvas->Divide(2, 1); | |
1381 | ||
1382 | canvas->cd(1); | |
1383 | InitPad(); | |
1384 | corrY->GetXaxis()->SetRangeUser(-0.99, 0.99); | |
1385 | corrY->GetYaxis()->SetRangeUser(1, 1.5); | |
1386 | corrY->GetYaxis()->SetTitleOffset(1.5); | |
1387 | corrY->DrawCopy(); | |
5c495d37 | 1388 | TPaveText* pave = new TPaveText(0.3, 0.7, 0.7, 0.8, "NDC"); |
1389 | pave->AddText("|z| < 10 cm"); | |
1390 | pave->AddText("0.3 GeV/c < p_{T} < 10 GeV/c"); | |
1391 | pave->Draw(); | |
72e597d7 | 1392 | |
1393 | canvas->cd(2); | |
1394 | InitPad(); | |
5c495d37 | 1395 | gPad->SetLogx(); |
1396 | corrZ->GetYaxis()->SetRangeUser(1, 2.5); | |
1397 | corrZ->GetXaxis()->SetRangeUser(0.101, upperPtLimit); | |
72e597d7 | 1398 | corrZ->GetYaxis()->SetTitleOffset(1.5); |
1399 | corrZ->DrawCopy(); | |
5c495d37 | 1400 | pave = new TPaveText(0.5, 0.7, 0.8, 0.8, "NDC"); |
1401 | pave->AddText("|z| < 10 cm"); | |
1402 | pave->AddText("|#eta| < 0.8"); | |
1403 | pave->Draw(); | |
72e597d7 | 1404 | |
1405 | canvas->SaveAs(Form("Track2Particle1D_etapt_%s_%f.eps", fileName, upperPtLimit)); | |
4c351225 | 1406 | canvas->SaveAs(Form("Track2Particle1D_etapt_%s_%f.gif", fileName, upperPtLimit)); |
0ab29cfa | 1407 | } |
1408 | ||
69b09e3b | 1409 | /* |
0ab29cfa | 1410 | void CompareTrack2Particle1D(Float_t upperPtLimit = 9.9) |
1411 | { | |
1412 | gSystem->Load("libPWG0base"); | |
1413 | ||
8ca1a6d9 | 1414 | // particle type |
1415 | for (Int_t particle=0; particle<4; ++particle) | |
1416 | { | |
1417 | TString dirName; | |
1418 | dirName.Form("correction_%d", particle); | |
1419 | Track2Particle1DCreatePlots("systematics-detail-only-positive.root", dirName, upperPtLimit); | |
0ab29cfa | 1420 | |
8ca1a6d9 | 1421 | TString tmpx, tmpy, tmpz; |
1422 | tmpx.Form("gene_%s_nTrackToNPart_x_div_meas_%s_nTrackToNPart_x", dirName.Data(), dirName.Data()); | |
1423 | tmpy.Form("gene_%s_nTrackToNPart_y_div_meas_%s_nTrackToNPart_y", dirName.Data(), dirName.Data()); | |
1424 | tmpz.Form("gene_%s_nTrackToNPart_z_div_meas_%s_nTrackToNPart_z", dirName.Data(), dirName.Data()); | |
0ab29cfa | 1425 | |
8ca1a6d9 | 1426 | TH1* posX = dynamic_cast<TH1*> (gROOT->FindObject(tmpx)->Clone("pos_x")); |
1427 | TH1* posY = dynamic_cast<TH1*> (gROOT->FindObject(tmpy)->Clone("pos_y")); | |
1428 | TH1* posZ = dynamic_cast<TH1*> (gROOT->FindObject(tmpz)->Clone("pos_z")); | |
0ab29cfa | 1429 | |
8ca1a6d9 | 1430 | Track2Particle1DCreatePlots("systematics-detail-only-negative.root", dirName, upperPtLimit); |
0ab29cfa | 1431 | |
8ca1a6d9 | 1432 | TH1* negX = dynamic_cast<TH1*> (gROOT->FindObject(tmpx)->Clone("neg_x")); |
1433 | TH1* negY = dynamic_cast<TH1*> (gROOT->FindObject(tmpy)->Clone("neg_y")); | |
1434 | TH1* negZ = dynamic_cast<TH1*> (gROOT->FindObject(tmpz)->Clone("neg_z")); | |
0ab29cfa | 1435 | |
8ca1a6d9 | 1436 | posX->Divide(negX); |
1437 | posY->Divide(negY); | |
1438 | posZ->Divide(negZ); | |
0ab29cfa | 1439 | |
8ca1a6d9 | 1440 | Prepare1DPlot(posX); |
1441 | Prepare1DPlot(posY); | |
1442 | Prepare1DPlot(posZ); | |
0ab29cfa | 1443 | |
8ca1a6d9 | 1444 | Float_t min = 0.8; |
1445 | Float_t max = 1.2; | |
0ab29cfa | 1446 | |
8ca1a6d9 | 1447 | posX->SetMinimum(min); |
1448 | posX->SetMaximum(max); | |
1449 | posY->SetMinimum(min); | |
1450 | posY->SetMaximum(max); | |
1451 | posZ->SetMinimum(min); | |
1452 | posZ->SetMaximum(max); | |
0ab29cfa | 1453 | |
8ca1a6d9 | 1454 | posZ->GetXaxis()->SetRangeUser(0, upperPtLimit); |
0ab29cfa | 1455 | |
8ca1a6d9 | 1456 | posX->GetYaxis()->SetTitleOffset(1.7); |
1457 | posX->GetYaxis()->SetTitle("C_{+} / C_{-}"); | |
1458 | posY->GetYaxis()->SetTitleOffset(1.7); | |
1459 | posY->GetYaxis()->SetTitle("C_{+} / C_{-}"); | |
1460 | posZ->GetYaxis()->SetTitleOffset(1.7); | |
1461 | posZ->GetYaxis()->SetTitle("C_{+} / C_{-}"); | |
0ab29cfa | 1462 | |
8ca1a6d9 | 1463 | posZ->GetXaxis()->SetRangeUser(0, 1); |
0ab29cfa | 1464 | |
8ca1a6d9 | 1465 | TString canvasName; |
1466 | canvasName.Form("PosNegRatios_%s_%f", ((particle == 0) ? "Pi" : ((particle == 1) ? "K" : ((particle == 2) ? "p" : "other"))), upperPtLimit); | |
0ab29cfa | 1467 | |
8ca1a6d9 | 1468 | TCanvas* canvas = new TCanvas(canvasName, canvasName, 1200, 400); |
1469 | canvas->Divide(3, 1); | |
0ab29cfa | 1470 | |
8ca1a6d9 | 1471 | canvas->cd(1); |
1472 | InitPad(); | |
1473 | posX->DrawCopy(); | |
0ab29cfa | 1474 | |
8ca1a6d9 | 1475 | canvas->cd(2); |
1476 | InitPad(); | |
1477 | posY->DrawCopy(); | |
1478 | ||
1479 | canvas->cd(3); | |
1480 | InitPad(); | |
1481 | posZ->DrawCopy(); | |
0ab29cfa | 1482 | |
8ca1a6d9 | 1483 | canvas->SaveAs(Form("%s.gif", canvas->GetName())); |
1484 | canvas->SaveAs(Form("%s.eps", canvas->GetName())); | |
1485 | } | |
0ab29cfa | 1486 | } |
69b09e3b | 1487 | */ |
0ab29cfa | 1488 | |
51f6de65 | 1489 | void CompareTrack2Particle1D(const char* file1, const char* file2, Float_t upperPtLimit = 9.9) |
1490 | { | |
1491 | loadlibs(); | |
1492 | ||
1493 | const char* folderName = "dndeta_correction"; | |
1494 | ||
1495 | c = new TCanvas("CompareTrack2Particle1D", "CompareTrack2Particle1D", 1200, 400); | |
1496 | c->Divide(3, 1); | |
1497 | ||
1498 | for (Int_t fileId = 0; fileId < 2; fileId++) | |
1499 | { | |
1500 | const char* file = ((fileId == 0) ? file1 : file2); | |
1501 | Correction1DCreatePlots(file, folderName, upperPtLimit, 1); | |
1502 | ||
1503 | TH1* corr[3]; | |
1504 | corr[0] = dynamic_cast<TH1*> (gROOT->FindObject("generated_x_div_measured_x")); | |
1505 | corr[1] = dynamic_cast<TH1*> (gROOT->FindObject("generated_y_div_measured_y")); | |
1506 | corr[2] = dynamic_cast<TH1*> (gROOT->FindObject("generated_z_div_measured_z")); | |
1507 | /*corr[0] = dynamic_cast<TH1*> (gROOT->FindObject("generated_x"))->Clone(Form("hist_x_%d", fileId)); | |
1508 | corr[1] = dynamic_cast<TH1*> (gROOT->FindObject("generated_y"))->Clone(Form("hist_y_%d", fileId)); | |
1509 | corr[2] = dynamic_cast<TH1*> (gROOT->FindObject("generated_z"))->Clone(Form("hist_z_%d", fileId));*/ | |
1510 | ||
1511 | for (Int_t i=0; i<3; i++) | |
1512 | { | |
1513 | c->cd(i+1); | |
1514 | InitPad(); | |
1515 | corr[i]->GetYaxis()->SetRangeUser(0.8, 2); | |
1516 | corr[i]->SetLineColor(fileId+1); | |
1517 | corr[i]->DrawCopy((fileId == 0) ? "" : "SAME"); | |
1518 | } | |
1519 | } | |
1520 | ||
1521 | return; | |
1522 | ||
1523 | c->SaveAs(Form("%s.gif", canvas->GetName())); | |
1524 | c->SaveAs(Form("%s.eps", canvas->GetName())); | |
1525 | } | |
1526 | ||
0ab29cfa | 1527 | void Track2Particle2DCreatePlots(const char* fileName = "correction_map.root") |
1528 | { | |
1529 | TFile::Open(fileName); | |
1530 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction"); | |
0448e811 | 1531 | dNdEtaCorrection->LoadHistograms(); |
0ab29cfa | 1532 | |
0448e811 | 1533 | TH3F* gene = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetGeneratedHistogram(); |
1534 | TH3F* meas = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetMeasuredHistogram(); | |
1afae8ff | 1535 | |
69b09e3b | 1536 | gene->GetZaxis()->SetRangeUser(0.2, 10); |
1537 | meas->GetZaxis()->SetRangeUser(0.2, 10); | |
25db2d85 | 1538 | AliPWG0Helper::CreateDividedProjections(gene, meas, "yx"); |
0ab29cfa | 1539 | gene->GetZaxis()->SetRange(0, 0); |
1540 | meas->GetZaxis()->SetRange(0, 0); | |
25db2d85 | 1541 | |
1542 | gene->GetYaxis()->SetRangeUser(-0.8, 0.8); | |
1543 | meas->GetYaxis()->SetRangeUser(-0.8, 0.8); | |
1544 | AliPWG0Helper::CreateDividedProjections(gene, meas, "zx"); | |
0ab29cfa | 1545 | gene->GetYaxis()->SetRange(0, 0); |
1546 | meas->GetYaxis()->SetRange(0, 0); | |
25db2d85 | 1547 | |
1548 | gene->GetXaxis()->SetRangeUser(-10, 10); | |
1549 | meas->GetXaxis()->SetRangeUser(-10, 10); | |
1550 | AliPWG0Helper::CreateDividedProjections(gene, meas, "zy"); | |
0ab29cfa | 1551 | gene->GetXaxis()->SetRange(0, 0); |
1552 | meas->GetXaxis()->SetRange(0, 0); | |
1553 | } | |
1554 | ||
c17301f3 | 1555 | TCanvas* Track2Particle2D(const char* fileName = "correction_map.root", const char* folder = "dndeta_correction") |
0ab29cfa | 1556 | { |
1557 | gSystem->Load("libPWG0base"); | |
1558 | ||
1559 | Track2Particle2DCreatePlots(fileName); | |
25db2d85 | 1560 | |
0448e811 | 1561 | TH2* corrYX = dynamic_cast<TH2*> (gROOT->FindObject("generated_yx_div_measured_yx")); |
1562 | TH2* corrZX = dynamic_cast<TH2*> (gROOT->FindObject("generated_zx_div_measured_zx")); | |
1563 | TH2* corrZY = dynamic_cast<TH2*> (gROOT->FindObject("generated_zy_div_measured_zy")); | |
25db2d85 | 1564 | |
1afae8ff | 1565 | Prepare2DPlot(corrYX); |
1566 | Prepare2DPlot(corrZX); | |
1567 | Prepare2DPlot(corrZY); | |
1568 | ||
0ab29cfa | 1569 | const char* title = ""; |
92d2d8ad | 1570 | corrYX->SetTitle(title); |
1571 | corrZX->SetTitle(title); | |
1572 | corrZY->SetTitle(title); | |
1afae8ff | 1573 | |
d09fb536 | 1574 | TCanvas* canvas = new TCanvas("Track2Particle2D", "Track2Particle2D", 1200, 400); |
1afae8ff | 1575 | canvas->Divide(3, 1); |
1576 | ||
1577 | canvas->cd(1); | |
1578 | InitPadCOLZ(); | |
1579 | corrYX->Draw("COLZ"); | |
1580 | ||
1581 | canvas->cd(2); | |
1582 | InitPadCOLZ(); | |
1583 | corrZX->Draw("COLZ"); | |
1584 | ||
1585 | canvas->cd(3); | |
1586 | InitPadCOLZ(); | |
1587 | corrZY->Draw("COLZ"); | |
92d2d8ad | 1588 | |
51f6de65 | 1589 | canvas->SaveAs(Form("corr_track2particle_%d.gif", gMax)); |
1590 | canvas->SaveAs(Form("corr_track2particle_%d.eps", gMax)); | |
c17301f3 | 1591 | |
1592 | return canvas; | |
0ab29cfa | 1593 | } |
1594 | ||
1595 | void CompareTrack2Particle2D() | |
1596 | { | |
1597 | gSystem->Load("libPWG0base"); | |
1598 | ||
1599 | Track2Particle2DCreatePlots("correction_maponly-positive.root"); | |
1600 | ||
1c15d51a | 1601 | TH2* posYX = dynamic_cast<TH2*> (gROOT->FindObject("generated_yx_div_measured_yx")->Clone("pos_yx")); |
1602 | TH2* posZX = dynamic_cast<TH2*> (gROOT->FindObject("generated_zx_div_measured_zx")->Clone("pos_zx")); | |
1603 | TH2* posZY = dynamic_cast<TH2*> (gROOT->FindObject("generated_zy_div_measured_zy")->Clone("pos_zy")); | |
0ab29cfa | 1604 | |
1605 | Track2Particle2DCreatePlots("correction_maponly-negative.root"); | |
1606 | ||
1c15d51a | 1607 | TH2* negYX = dynamic_cast<TH2*> (gROOT->FindObject("generated_yx_div_measured_yx")->Clone("neg_yx")); |
1608 | TH2* negZX = dynamic_cast<TH2*> (gROOT->FindObject("generated_zx_div_measured_zx")->Clone("neg_zx")); | |
1609 | TH2* negZY = dynamic_cast<TH2*> (gROOT->FindObject("generated_zy_div_measured_zy")->Clone("neg_zy")); | |
0ab29cfa | 1610 | |
1611 | posYX->Divide(negYX); | |
1612 | posZX->Divide(negZX); | |
1613 | posZY->Divide(negZY); | |
1614 | ||
1615 | Prepare2DPlot(posYX); | |
1616 | Prepare2DPlot(posZX); | |
1617 | Prepare2DPlot(posZY); | |
1618 | ||
1619 | Float_t min = 0.8; | |
1620 | Float_t max = 1.2; | |
1621 | ||
1622 | posYX->SetMinimum(min); | |
1623 | posYX->SetMaximum(max); | |
1624 | posZX->SetMinimum(min); | |
1625 | posZX->SetMaximum(max); | |
1626 | posZY->SetMinimum(min); | |
1627 | posZY->SetMaximum(max); | |
1628 | ||
1629 | TCanvas* canvas = new TCanvas("CompareTrack2Particle2D", "CompareTrack2Particle2D", 1200, 400); | |
1630 | canvas->Divide(3, 1); | |
1631 | ||
1632 | canvas->cd(1); | |
1633 | InitPadCOLZ(); | |
1634 | posYX->Draw("COLZ"); | |
1635 | ||
1636 | canvas->cd(2); | |
1637 | InitPadCOLZ(); | |
1638 | posZX->Draw("COLZ"); | |
1639 | ||
1640 | canvas->cd(3); | |
1641 | InitPadCOLZ(); | |
1642 | posZY->Draw("COLZ"); | |
1643 | ||
1644 | canvas->SaveAs("CompareTrack2Particle2D.gif"); | |
1645 | canvas->SaveAs("CompareTrack2Particle2D.eps"); | |
1afae8ff | 1646 | } |
1647 | ||
1648 | void Track2Particle3D() | |
1649 | { | |
1650 | // get left margin proper | |
1651 | ||
1652 | TFile* file = TFile::Open("correction_map.root"); | |
1653 | ||
d09fb536 | 1654 | TH3* corr = dynamic_cast<TH3*> (file->Get("dndeta_correction/corr_nTrackToNPart")); |
1655 | ||
1656 | corr->SetTitle("Correction Factor"); | |
1657 | SetRanges(corr->GetZaxis()); | |
1658 | ||
1659 | Prepare3DPlot(corr); | |
1660 | ||
1661 | TCanvas* canvas = new TCanvas("Track2Particle3D", "Track2Particle3D", 500, 500); | |
1662 | canvas->SetTheta(29.428); | |
1663 | canvas->SetPhi(16.5726); | |
1664 | ||
1665 | corr->Draw(); | |
1666 | ||
1667 | canvas->SaveAs("Track2Particle3D.gif"); | |
0ab29cfa | 1668 | canvas->SaveAs("Track2Particle3D.eps"); |
d09fb536 | 1669 | } |
1670 | ||
1671 | void Track2Particle3DAll() | |
1672 | { | |
d09fb536 | 1673 | TFile* file = TFile::Open("correction_map.root"); |
1674 | ||
1afae8ff | 1675 | TH3* gene = dynamic_cast<TH3*> (file->Get("dndeta_correction/gene_nTrackToNPart")); |
1676 | TH3* meas = dynamic_cast<TH3*> (file->Get("dndeta_correction/meas_nTrackToNPart")); | |
1677 | TH3* corr = dynamic_cast<TH3*> (file->Get("dndeta_correction/corr_nTrackToNPart")); | |
1678 | ||
1679 | gene->SetTitle("Generated Particles"); | |
1680 | meas->SetTitle("Measured Tracks"); | |
1681 | corr->SetTitle("Correction Factor"); | |
1682 | ||
1683 | Prepare3DPlot(gene); | |
1684 | Prepare3DPlot(meas); | |
1685 | Prepare3DPlot(corr); | |
1686 | ||
d09fb536 | 1687 | TCanvas* canvas = new TCanvas("Track2Particle3DAll", "Track2Particle3DAll", 1200, 400); |
1afae8ff | 1688 | canvas->Divide(3, 1); |
1689 | ||
1690 | canvas->cd(1); | |
1691 | InitPad(); | |
1692 | gene->Draw(); | |
1693 | ||
1694 | canvas->cd(2); | |
1695 | meas->Draw(); | |
1696 | ||
1697 | canvas->cd(3); | |
1698 | corr->Draw(); | |
d09fb536 | 1699 | |
1700 | canvas->SaveAs("Track2Particle3DAll.gif"); | |
0ab29cfa | 1701 | canvas->SaveAs("Track2Particle3DAll.eps"); |
1afae8ff | 1702 | } |
1703 | ||
6b7fa615 | 1704 | void MultiplicityMC(Int_t xRangeMax = 50) |
4c6b34a8 | 1705 | { |
1706 | TFile* file = TFile::Open("multiplicityMC.root"); | |
1707 | ||
1708 | if (!file) | |
1709 | { | |
1710 | printf("multiplicityMC.root could not be opened.\n"); | |
1711 | return; | |
1712 | } | |
1713 | ||
1714 | TH1F* fMultiplicityESD = dynamic_cast<TH1F*> (file->Get("fMultiplicityESD")); | |
1715 | TH1F* fMultiplicityMC = dynamic_cast<TH1F*> (file->Get("fMultiplicityMC")); | |
1716 | TH2F* fCorrelation = dynamic_cast<TH2F*> (file->Get("fCorrelation")); | |
1717 | ||
1718 | TH1F* correction = new TH1F("MultiplicityMC_correction", "MultiplicityMC_correction;Ntracks;Npart", 76, -0.5, 75.5); | |
1719 | TH1F* correctionWidth = new TH1F("MultiplicityMC_correctionwidth", "MultiplicityMC_correctionwidth;Ntracks;Npart", 76, -0.5, 75.5); | |
1720 | //fMultiplicityMC->GetNbinsX(), fMultiplicityMC->GetXaxis()->GetXmin(), fMultiplicityMC->GetXaxis()->GetXmax()); | |
1721 | for (Int_t i=1; i<=correction->GetNbinsX(); ++i) | |
1722 | { | |
1723 | TH1D* proj = fCorrelation->ProjectionX("_px", i, i+1); | |
1724 | proj->Fit("gaus", "0"); | |
1725 | correction->SetBinContent(i, proj->GetFunction("gaus")->GetParameter(1)); | |
1726 | correctionWidth->SetBinContent(i, proj->GetFunction("gaus")->GetParameter(2)); | |
1727 | ||
1728 | continue; | |
1729 | ||
1730 | // draw for debugging | |
1731 | new TCanvas; | |
1732 | proj->DrawCopy(); | |
1733 | proj->GetFunction("gaus")->DrawCopy("SAME"); | |
1734 | } | |
1735 | ||
1736 | TH1F* fMultiplicityESDCorrected = new TH1F("fMultiplicityESDCorrected", "fMultiplicityESDCorrected", 2010, -0.5, 200.5); | |
1737 | ||
1738 | for (Int_t i=1; i<=correction->GetNbinsX(); ++i) | |
1739 | { | |
1740 | Float_t mean = correction->GetBinContent(i); | |
1741 | Float_t width = correctionWidth->GetBinContent(i); | |
1742 | ||
1743 | Int_t fillBegin = fMultiplicityESDCorrected->FindBin(mean - width * 3); | |
1744 | Int_t fillEnd = fMultiplicityESDCorrected->FindBin(mean + width * 3); | |
1745 | printf("bin %d mean %f width %f, filling from %d to %d\n", i, mean, width, fillBegin, fillEnd); | |
1746 | ||
1747 | for (Int_t j=fillBegin; j <= fillEnd; ++j) | |
1748 | { | |
1749 | fMultiplicityESDCorrected->AddBinContent(j, TMath::Gaus(fMultiplicityESDCorrected->GetXaxis()->GetBinCenter(j), mean, width, kTRUE) * fMultiplicityESD->GetBinContent(i)); | |
1750 | } | |
1751 | } | |
1752 | ||
1753 | TH1F* fMultiplicityESDCorrectedRebinned = dynamic_cast<TH1F*> (fMultiplicityESDCorrected->Clone("fMultiplicityESDCorrectedRebinned")); | |
1754 | fMultiplicityESDCorrectedRebinned->Rebin(10); | |
1755 | fMultiplicityESDCorrectedRebinned->Scale(0.1); | |
1756 | ||
6b7fa615 | 1757 | TH1F* ratio = dynamic_cast<TH1F*> (fMultiplicityESD->Clone("multiplicity_ratio")); |
1758 | ratio->SetTitle("ratio;Ntracks;Nreco/Ngene"); | |
1759 | ratio->Divide(fMultiplicityMC); | |
1760 | ||
4c6b34a8 | 1761 | TH1F* ratio2 = dynamic_cast<TH1F*> (fMultiplicityESDCorrectedRebinned->Clone("multiplicity_ratio_corrected")); |
1762 | ratio2->Divide(fMultiplicityMC); | |
1763 | ||
1764 | TCanvas* canvas = new TCanvas("MultiplicityMC", "MultiplicityMC", 1500, 1000); | |
1765 | canvas->Divide(3, 2); | |
1766 | ||
6b7fa615 | 1767 | fMultiplicityESD->GetXaxis()->SetRangeUser(0, xRangeMax); |
1768 | ratio->GetXaxis()->SetRangeUser(0, xRangeMax); | |
1769 | fCorrelation->GetXaxis()->SetRangeUser(0, xRangeMax); | |
1770 | fCorrelation->GetYaxis()->SetRangeUser(0, xRangeMax); | |
1771 | correction->GetXaxis()->SetRangeUser(0, xRangeMax); | |
1772 | fMultiplicityESDCorrected->GetXaxis()->SetRangeUser(0, xRangeMax); | |
1773 | fMultiplicityESDCorrectedRebinned->GetXaxis()->SetRangeUser(0, xRangeMax); | |
1774 | ||
1775 | canvas->cd(1); //InitPad(); | |
4c6b34a8 | 1776 | fMultiplicityESD->Draw(); |
1777 | fMultiplicityMC->SetLineColor(2); | |
1778 | fMultiplicityMC->Draw("SAME"); | |
1779 | ||
6b7fa615 | 1780 | TLegend* legend = new TLegend(0.6, 0.7, 0.85, 0.85); |
1781 | legend->AddEntry(fMultiplicityESD, "ESD"); | |
1782 | legend->AddEntry(fMultiplicityMC, "MC"); | |
1783 | legend->Draw(); | |
4c6b34a8 | 1784 | |
6b7fa615 | 1785 | canvas->cd(2); |
4c6b34a8 | 1786 | fCorrelation->Draw("COLZ"); |
1787 | ||
6b7fa615 | 1788 | canvas->cd(3); |
4c6b34a8 | 1789 | correction->Draw(); |
1790 | //correction->Fit("pol1"); | |
1791 | correctionWidth->SetLineColor(2); | |
1792 | correctionWidth->Draw("SAME"); | |
1793 | ||
6b7fa615 | 1794 | legend = new TLegend(0.2, 0.7, 0.45, 0.85); |
1795 | legend->AddEntry(correction, "#bar{x}"); | |
1796 | legend->AddEntry(correctionWidth, "#sigma"); | |
1797 | legend->Draw(); | |
1798 | ||
1799 | canvas->cd(4); | |
1800 | ratio->Draw(); | |
1801 | ||
1802 | ratio2->SetLineColor(2); | |
1803 | ratio2->Draw("SAME"); | |
1804 | ||
1805 | legend = new TLegend(0.6, 0.7, 0.85, 0.85); | |
1806 | legend->AddEntry(ratio, "uncorrected"); | |
1807 | legend->AddEntry(ratio2, "corrected"); | |
1808 | legend->Draw(); | |
1809 | ||
4c6b34a8 | 1810 | canvas->cd(5); |
6b7fa615 | 1811 | fMultiplicityESDCorrected->SetLineColor(kBlue); |
4c6b34a8 | 1812 | fMultiplicityESDCorrected->Draw(); |
1813 | fMultiplicityMC->Draw("SAME"); | |
1814 | fMultiplicityESD->Draw("SAME"); | |
1815 | ||
6b7fa615 | 1816 | legend = new TLegend(0.6, 0.7, 0.85, 0.85); |
1817 | legend->AddEntry(fMultiplicityESDCorrected, "ESD corrected"); | |
1818 | legend->AddEntry(fMultiplicityMC, "MC"); | |
1819 | legend->AddEntry(fMultiplicityESD, "ESD"); | |
1820 | legend->Draw(); | |
1821 | ||
4c6b34a8 | 1822 | canvas->cd(6); |
6b7fa615 | 1823 | fMultiplicityESDCorrectedRebinned->SetLineColor(kBlue); |
4c6b34a8 | 1824 | fMultiplicityESDCorrectedRebinned->Draw(); |
1825 | fMultiplicityMC->Draw("SAME"); | |
6b7fa615 | 1826 | |
1827 | legend = new TLegend(0.6, 0.7, 0.85, 0.85); | |
1828 | legend->AddEntry(fMultiplicityESDCorrectedRebinned, "ESD corrected"); | |
1829 | legend->AddEntry(fMultiplicityMC, "MC"); | |
1830 | legend->Draw(); | |
1831 | ||
1832 | canvas->SaveAs("MultiplicityMC.gif"); | |
4c6b34a8 | 1833 | } |
1834 | ||
1835 | void MultiplicityESD() | |
1836 | { | |
1837 | TFile* file = TFile::Open("multiplicityESD.root"); | |
1838 | ||
1839 | if (!file) | |
1840 | { | |
1841 | printf("multiplicityESD.root could not be opened.\n"); | |
1842 | return; | |
1843 | } | |
1844 | ||
1845 | TH1F* fMultiplicityESD = dynamic_cast<TH1F*> (file->Get("fMultiplicity")); | |
1846 | ||
1847 | TCanvas* canvas = new TCanvas("MultiplicityESD", "MultiplicityESD", 500, 500); | |
1848 | ||
1849 | fMultiplicityESD->Draw(); | |
1850 | } | |
1851 | ||
69b09e3b | 1852 | void CompareCorrection2Measured(Float_t ptMin = 0.301, const char* dataInput = "analysis_esd_raw.root", const char* correctionMapFile = "correction_map.root", const char* correctionMapFolder = "dndeta_correction") |
770a1f1d | 1853 | { |
1854 | loadlibs(); | |
1855 | ||
1856 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(correctionMapFolder, correctionMapFolder); | |
1857 | TFile::Open(correctionMapFile); | |
1858 | dNdEtaCorrection->LoadHistograms(); | |
1859 | ||
1860 | TFile* file = TFile::Open(dataInput); | |
1861 | ||
1862 | if (!file) | |
1863 | { | |
1864 | cout << "Error. File not found" << endl; | |
1865 | return; | |
1866 | } | |
1867 | ||
1868 | dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta"); | |
1869 | fdNdEtaAnalysis->LoadHistograms("fdNdEtaAnalysisESD"); | |
1870 | ||
1871 | gROOT->cd(); | |
1872 | ||
1873 | TH3* hist1 = (TH3*) dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetMeasuredHistogram()->Clone("mc"); | |
1874 | hist1->SetTitle("mc"); | |
3dfa46a4 | 1875 | Printf("mc contains %f entries", hist1->Integral()); |
69b09e3b | 1876 | Printf("mc contains %f entries in |vtx-z| < 10, pt > 0.3", hist1->Integral(hist1->GetXaxis()->FindBin(-9.9), hist1->GetXaxis()->FindBin(9.9), hist1->GetYaxis()->FindBin(-0.99), hist1->GetYaxis()->FindBin(0.99), hist1->GetZaxis()->FindBin(ptMin), hist1->GetNbinsZ())); |
770a1f1d | 1877 | |
1878 | TH3* hist2 = (TH3*) fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetMeasuredHistogram()->Clone("esd"); | |
1879 | hist2->SetTitle("esd"); | |
3dfa46a4 | 1880 | Printf("esd contains %f entries", hist2->Integral()); |
69b09e3b | 1881 | Printf("esd contains %f entries in |vtx-z| < 10, pt > 0.3", hist2->Integral(hist2->GetXaxis()->FindBin(-9.9), hist2->GetXaxis()->FindBin(9.9), hist2->GetYaxis()->FindBin(-0.99), hist2->GetYaxis()->FindBin(0.99), hist2->GetZaxis()->FindBin(ptMin), hist2->GetNbinsZ())); |
1882 | ||
1883 | AliPWG0Helper::CreateDividedProjections(hist1, hist2); | |
1884 | AliPWG0Helper::CreateDividedProjections(hist1, hist2, "x"); | |
1885 | ||
1886 | hist1->GetXaxis()->SetRange(hist1->GetXaxis()->FindBin(-10), hist2->GetXaxis()->FindBin(10)); | |
1887 | hist2->GetXaxis()->SetRange(hist1->GetXaxis()->FindBin(-10), hist2->GetXaxis()->FindBin(10)); | |
1888 | AliPWG0Helper::CreateDividedProjections(hist1, hist2, "y"); | |
1889 | ||
1890 | new TCanvas; gROOT->FindObject("mc_yx_div_esd_yx")->Draw("COLZ"); | |
1891 | new TCanvas; gROOT->FindObject("mc_zx_div_esd_zx")->Draw("COLZ"); | |
1892 | new TCanvas; gROOT->FindObject("mc_zy_div_esd_zy")->Draw("COLZ"); | |
1893 | new TCanvas; gROOT->FindObject("mc_x_div_esd_x")->Draw("COLZ"); | |
1894 | new TCanvas; gROOT->FindObject("mc_y_div_esd_y")->Draw("COLZ"); | |
a7f69e56 | 1895 | |
1896 | TH2* hist3 = (TH2*) dNdEtaCorrection->GetVertexRecoCorrection()->GetEventCorrection()->GetMeasuredHistogram()->Clone("mc2"); | |
1897 | hist3->SetTitle("mc2"); | |
1898 | Printf("mc event contains %f entries", hist3->Integral()); | |
1899 | Printf("mc event contains %f entries in |vtx-z| < 10", hist3->Integral(hist3->GetXaxis()->FindBin(-9.9), hist3->GetXaxis()->FindBin(9.9), 1, hist3->GetNbinsY())); | |
1900 | ||
1901 | TH2* hist4 = (TH2*) fdNdEtaAnalysis->GetData()->GetEventCorrection()->GetMeasuredHistogram()->Clone("esd2"); | |
1902 | hist4->SetTitle("esd2"); | |
1903 | Printf("esd event contains %f entries", hist4->Integral()); | |
1904 | Printf("esd event contains %f entries in |vtx-z| < 10", hist4->Integral(hist4->GetXaxis()->FindBin(-9.9), hist4->GetXaxis()->FindBin(9.9), 1, hist4->GetNbinsY())); | |
1905 | ||
1906 | ratio = (TH2*) hist3->Clone("ratio"); | |
1907 | ratio->Divide(hist4); | |
1908 | ||
1909 | new TCanvas; ratio->Draw("COLZ"); | |
69b09e3b | 1910 | } |
1911 | ||
1912 | void CompareCorrection2Generated(Float_t ptMin = 0.301, const char* dataInput = "analysis_mc.root", const char* correctionMapFile = "correction_map.root", const char* correctionMapFolder = "dndeta_correction") | |
1913 | { | |
1914 | loadlibs(); | |
1915 | ||
1916 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(correctionMapFolder, correctionMapFolder); | |
1917 | TFile::Open(correctionMapFile); | |
1918 | dNdEtaCorrection->LoadHistograms(); | |
1919 | ||
1920 | TFile* file = TFile::Open(dataInput); | |
1921 | ||
1922 | if (!file) | |
1923 | { | |
1924 | cout << "Error. File not found" << endl; | |
1925 | return; | |
1926 | } | |
1927 | ||
1928 | dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaTrVtx", "dndetaTrVtx"); | |
1929 | fdNdEtaAnalysis->LoadHistograms("dndetaTrVtx"); | |
1930 | ||
1931 | gROOT->cd(); | |
1932 | ||
1933 | TH3* hist1 = (TH3*) dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetGeneratedHistogram()->Clone("mc"); | |
1934 | hist1->SetTitle("mc"); | |
1935 | Printf("mc contains %f entries", hist1->Integral()); | |
1936 | Printf("mc contains %f entries in |vtx-z| < 10, pt > 0.3", hist1->Integral(hist1->GetXaxis()->FindBin(-9.9), hist1->GetXaxis()->FindBin(9.9), hist1->GetYaxis()->FindBin(-0.99), hist1->GetYaxis()->FindBin(0.99), hist1->GetZaxis()->FindBin(ptMin), hist1->GetNbinsZ())); | |
1937 | ||
1938 | TH3* hist2 = (TH3*) fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetGeneratedHistogram()->Clone("esd"); | |
1939 | hist2->SetTitle("esd"); | |
1940 | Printf("esd contains %f entries", hist2->Integral()); | |
1941 | Printf("esd contains %f entries in |vtx-z| < 10, pt > 0.3", hist2->Integral(hist2->GetXaxis()->FindBin(-9.9), hist2->GetXaxis()->FindBin(9.9), hist2->GetYaxis()->FindBin(-0.99), hist2->GetYaxis()->FindBin(0.99), hist2->GetZaxis()->FindBin(ptMin), hist2->GetNbinsZ())); | |
770a1f1d | 1942 | |
1943 | AliPWG0Helper::CreateDividedProjections(hist1, hist2); | |
0fc41645 | 1944 | AliPWG0Helper::CreateDividedProjections(hist1, hist2, "x"); |
1945 | ||
1946 | hist1->GetXaxis()->SetRange(hist1->GetXaxis()->FindBin(-10), hist2->GetXaxis()->FindBin(10)); | |
1947 | hist2->GetXaxis()->SetRange(hist1->GetXaxis()->FindBin(-10), hist2->GetXaxis()->FindBin(10)); | |
1948 | AliPWG0Helper::CreateDividedProjections(hist1, hist2, "y"); | |
770a1f1d | 1949 | |
1950 | new TCanvas; gROOT->FindObject("mc_yx_div_esd_yx")->Draw("COLZ"); | |
1951 | new TCanvas; gROOT->FindObject("mc_zx_div_esd_zx")->Draw("COLZ"); | |
1952 | new TCanvas; gROOT->FindObject("mc_zy_div_esd_zy")->Draw("COLZ"); | |
0fc41645 | 1953 | new TCanvas; gROOT->FindObject("mc_x_div_esd_x")->Draw("COLZ"); |
1954 | new TCanvas; gROOT->FindObject("mc_y_div_esd_y")->Draw("COLZ"); | |
3dfa46a4 | 1955 | } |
1956 | ||
1957 | void CompareMeasured2Measured(const char* dataInput = "analysis_esd_raw.root", const char* dataInput2 = "analysis_esd_raw.root") | |
1958 | { | |
1959 | loadlibs(); | |
1960 | ||
1961 | TFile* file = TFile::Open(dataInput); | |
1962 | ||
1963 | if (!file) | |
1964 | { | |
1965 | cout << "Error. File not found" << endl; | |
1966 | return; | |
1967 | } | |
1968 | ||
1969 | dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta"); | |
1970 | fdNdEtaAnalysis->LoadHistograms("fdNdEtaAnalysisESD"); | |
1971 | ||
1972 | TFile* file = TFile::Open(dataInput2); | |
1973 | ||
1974 | if (!file) | |
1975 | { | |
1976 | cout << "Error. File not found" << endl; | |
1977 | return; | |
1978 | } | |
1979 | ||
1980 | dNdEtaAnalysis* fdNdEtaAnalysis2 = new dNdEtaAnalysis("dndeta2", "dndeta2"); | |
1981 | fdNdEtaAnalysis2->LoadHistograms("fdNdEtaAnalysisESD"); | |
1982 | ||
1983 | gROOT->cd(); | |
1984 | ||
1985 | TH3* hist1 = (TH3*) fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetMeasuredHistogram()->Clone("esd1"); | |
1986 | hist1->SetTitle("esd1"); | |
1987 | Printf("esd1 contains %f entries", hist1->GetEntries()); | |
1988 | Printf("esd1 contains %f entries in |vtx-z| < 10, pt > 0.3", hist1->Integral(hist1->GetXaxis()->FindBin(-9.9), hist1->GetXaxis()->FindBin(9.9), 1, hist1->GetNbinsY(), hist1->GetZaxis()->FindBin(0.301), hist1->GetNbinsZ())); | |
1989 | ||
1990 | TH3* hist2 = (TH3*) fdNdEtaAnalysis2->GetData()->GetTrackCorrection()->GetMeasuredHistogram()->Clone("esd2"); | |
1991 | hist2->SetTitle("esd2"); | |
1992 | Printf("esd2 contains %f entries", hist2->GetEntries()); | |
1993 | Printf("esd2 contains %f entries in |vtx-z| < 10, pt > 0.3", hist2->Integral(hist2->GetXaxis()->FindBin(-9.9), hist2->GetXaxis()->FindBin(9.9), 1, hist2->GetNbinsY(), hist2->GetZaxis()->FindBin(0.301), hist2->GetNbinsZ())); | |
1994 | ||
1995 | AliPWG0Helper::CreateDividedProjections(hist1, hist2); | |
1996 | ||
1997 | new TCanvas; gROOT->FindObject("esd1_yx_div_esd2_yx")->Draw("COLZ"); | |
1998 | new TCanvas; gROOT->FindObject("esd1_zx_div_esd2_zx")->Draw("COLZ"); | |
1999 | new TCanvas; gROOT->FindObject("esd1_zy_div_esd2_zy")->Draw("COLZ"); | |
2000 | ||
2001 | TH2* event1 = (TH2*) fdNdEtaAnalysis->GetData()->GetEventCorrection()->GetMeasuredHistogram()->Clone("event1"); | |
2002 | TH2* event2 = (TH2*) fdNdEtaAnalysis2->GetData()->GetEventCorrection()->GetMeasuredHistogram()->Clone("event2"); | |
2003 | ||
2004 | Printf("event1 contains %f entries", event1->GetEntries()); | |
2005 | Printf("event2 contains %f entries", event2->GetEntries()); | |
2006 | Printf("event1 integral is %f", event1->Integral()); | |
2007 | Printf("event2 integral is %f", event2->Integral()); | |
2008 | Printf("event1 contains %f entries in |vtx-z| < 10", event1->Integral(event1->GetXaxis()->FindBin(-9.9), event1->GetXaxis()->FindBin(9.9), 1, event1->GetNbinsY())); | |
2009 | Printf("event2 contains %f entries in |vtx-z| < 10", event2->Integral(event2->GetXaxis()->FindBin(-9.9), event2->GetXaxis()->FindBin(9.9), 1, event2->GetNbinsY())); | |
2010 | ||
2011 | projx1 = event1->ProjectionX(); | |
2012 | projx2 = event2->ProjectionX(); | |
2013 | ||
2014 | new TCanvas; projx1->DrawCopy(); projx2->SetLineColor(2); projx2->DrawCopy("SAME"); | |
2015 | ||
2016 | projx1->Divide(projx2); | |
2017 | new TCanvas; projx1->Draw(); | |
2018 | ||
2019 | event1->Divide(event2); | |
2020 | new TCanvas; event1->Draw("COLZ"); | |
770a1f1d | 2021 | |
2022 | } | |
3dfa46a4 | 2023 | |
69b09e3b | 2024 | void DrawTrackletOrigin(const char* fileName = "correction_map.root", Bool_t myFile = kTRUE) |
0fc41645 | 2025 | { |
69b09e3b | 2026 | TFile::Open(fileName); |
0fc41645 | 2027 | |
2028 | Int_t maxHists = 8; | |
2029 | TH1* hist[8]; | |
69b09e3b | 2030 | |
2031 | const Int_t kRebin = 8; | |
0fc41645 | 2032 | |
69b09e3b | 2033 | const char* titles[] = { "PP", "SS", "PP'", "PS'", "PS", "SP'", "SS'", "" }; |
0fc41645 | 2034 | |
69b09e3b | 2035 | if (myFile) |
2036 | { | |
2037 | for (Int_t i=0; i<maxHists; i++) | |
2038 | { | |
2039 | hist[i] = (TH1*) gFile->Get(Form("fDeltaPhi_%d", i)); | |
2040 | if (hist[i]->GetDimension() == 2) | |
2041 | hist[i] = ((TH2*) hist[i])->ProjectionX(Form("fDeltaPhi_clone_%d", i)); | |
2042 | } | |
2043 | } | |
2044 | else | |
2045 | { | |
2046 | maxHists = 6; | |
2047 | const char* names[] = { "DePhiPPTracklets", "DePhiSecTracklets", "DePhiPpTracklets", "DePhiPSTracklets", "DePhiPSdaugTracklets", "DePhiSPTracklets" }; | |
2048 | for (Int_t i=0; i<maxHists; i++) | |
2049 | hist[i] = (TH1*) gFile->Get(names[i]); | |
2050 | } | |
2051 | ||
2052 | // clone before rebinning | |
2053 | good = (TH1*) hist[0]->Clone("good"); | |
2054 | good->Add(hist[4]); | |
2055 | ||
2056 | bad = (TH1*) hist[1]->Clone("bad"); | |
2057 | bad->Add(hist[2]); | |
2058 | bad->Add(hist[3]); | |
2059 | bad->Add(hist[5]); | |
2060 | if (myFile) | |
2061 | bad->Add(hist[6]); | |
2062 | ||
2063 | c = (TCanvas*) gROOT->GetListOfCanvases()->FindObject("c"); | |
2064 | TH1* ref = 0; | |
2065 | Bool_t nw = kFALSE; | |
2066 | if (!c) | |
2067 | { | |
2068 | c = new TCanvas("c", "c", 600, 600); | |
2069 | nw = kTRUE; | |
2070 | ref = (TH1*) c->GetListOfPrimitives()->At(1); | |
2071 | } | |
2072 | c->cd(); | |
2073 | c->SetRightMargin(0.05); | |
2074 | c->SetTopMargin(0.05); | |
2075 | c->SetLogy(); | |
2076 | c->SetGridx(); | |
2077 | c->SetGridy(); | |
2078 | ||
2079 | Int_t order[] = { 0, 4, 1, 2, 3, 5, 6, 7 }; | |
2080 | //Int_t colors[] = {1,2,4,1,2,4,1,2,4}; | |
2081 | Int_t colors[] = {1,2,3,4,6,7,8,102}; | |
2082 | Int_t markers[] = {20, 21, 22, 23, 24, 25, 26, 27, 28}; | |
2083 | ||
2084 | TLegend* legend = new TLegend(0.75, 0.6, 0.93, 0.93); | |
2085 | legend->SetFillColor(0); | |
2086 | legend->SetTextSize(0.04); | |
0fc41645 | 2087 | |
2088 | Int_t total = 0; | |
69b09e3b | 2089 | for (Int_t ii=0; ii<maxHists; ii++) |
0fc41645 | 2090 | { |
69b09e3b | 2091 | i = order[ii]; |
2092 | ||
2093 | hist[i]->Rebin(kRebin); | |
0fc41645 | 2094 | hist[i]->SetStats(kFALSE); |
2095 | hist[i]->SetLineColor(colors[i]); | |
69b09e3b | 2096 | hist[i]->SetLineWidth(2); |
2097 | //hist[i]->SetMarkerStyle(markers[i]); | |
2098 | //hist[i]->SetMarkerColor(colors[i]); | |
2099 | //hist[i]->SetLineStyle(ii+1); | |
2100 | hist[i]->GetXaxis()->SetRangeUser(-0.09, 0.09); | |
2101 | hist[i]->GetYaxis()->SetRangeUser(5, hist[i]->GetMaximum() * 2); | |
2102 | hist[i]->GetYaxis()->SetTitleOffset(1.3); | |
2103 | hist[i]->GetXaxis()->SetTitle("#Delta#varphi (rad.)"); | |
2104 | ||
2105 | if (i == 0 && ref) | |
2106 | hist[i]->Scale(1.0 / hist[i]->GetMaximum() * ref->GetMaximum()); | |
2107 | ||
2108 | hist[i]->DrawCopy(((i == 0 && nw) ? "" : "SAME")); | |
0fc41645 | 2109 | |
2110 | total += hist[i]->GetEntries(); | |
2111 | ||
2112 | if (i != 7) | |
69b09e3b | 2113 | legend->AddEntry(hist[i], titles[i], "L"); |
0fc41645 | 2114 | } |
2115 | ||
2116 | legend->Draw(); | |
69b09e3b | 2117 | c->SaveAs("spd_tracklets_deltaphi_detailed.eps"); |
0fc41645 | 2118 | |
2119 | Printf("Total: %d", total); | |
2120 | for (Int_t i=0; i<maxHists; i++) | |
69b09e3b | 2121 | Printf("Histogram %d (%s) contains %.2f %% of the entries", i, titles[i], 100.0 * hist[i]->GetEntries() / total); |
0fc41645 | 2122 | |
2123 | printf("| Delta phi | Acc. %% | "); | |
2124 | for (Int_t i=0; i<maxHists; i++) | |
2125 | printf("%3s %% | ", titles[i]); | |
2126 | Printf(""); | |
2127 | ||
2128 | for (Float_t f = 0.01; f < 0.09; f += 0.01) | |
2129 | { | |
2130 | Int_t integralBegin = hist[0]->GetXaxis()->FindBin(-f); | |
2131 | Int_t integralEnd = hist[0]->GetXaxis()->FindBin(f); | |
2132 | ||
2133 | Int_t total2 = 0; | |
2134 | for (Int_t i=0; i<maxHists; i++) | |
2135 | total2 += (Int_t) hist[i]->Integral(integralBegin, integralEnd); | |
2136 | ||
2137 | printf("| %.2f | %6.2f | ", f, 100.0 * total2 / total); | |
2138 | ||
2139 | for (Int_t i=0; i<maxHists; i++) | |
2140 | printf("%6.2f | ", (hist[i]->GetEntries() > 0) ? (100.0 * hist[i]->Integral(integralBegin, integralEnd) / hist[i]->GetEntries()) : -1.0); | |
2141 | Printf(""); | |
2142 | } | |
69b09e3b | 2143 | |
2144 | eff = new TH1F("eff", ";#Delta#varphi cut (rad.)", 101,-0.0005, 0.1005); | |
2145 | cont = new TH1F("cont", "cont", 101,-0.0005, 0.1005); | |
2146 | signalOverBg = new TH1F("signalOverBg", "signalOverBg", 101,-0.0005, 0.1005); | |
2147 | for (Float_t cut=0.000; cut<0.10; cut += 0.001) | |
2148 | { | |
2149 | Float_t accGood = good->Integral(good->GetXaxis()->FindBin(-cut), good->GetXaxis()->FindBin(cut)); | |
2150 | Float_t accBad = bad->Integral(bad->GetXaxis()->FindBin(-cut), bad->GetXaxis()->FindBin(cut)); | |
2151 | Float_t sB = accGood / accBad; | |
2152 | eff->Fill(cut, 100.0 * accGood / good->Integral()); | |
2153 | cont->Fill(cut, 100.0 * accBad / (accGood + accBad)); | |
2154 | signalOverBg->Fill(cut, sB); | |
2155 | } | |
2156 | ||
2157 | //new TCanvas; signalOverBg->Draw(); | |
2158 | ||
2159 | c = (TCanvas*) gROOT->GetListOfCanvases()->FindObject("c2"); | |
2160 | Bool_t nw = kFALSE; | |
2161 | if (!c) | |
2162 | { | |
2163 | c = new TCanvas("c2", "c2", 600, 600); | |
2164 | nw = kTRUE; | |
2165 | } | |
2166 | c->cd(); | |
2167 | c->SetRightMargin(0.05); | |
2168 | c->SetTopMargin(0.05); | |
2169 | c->SetGridx(); | |
2170 | c->SetGridy(); | |
2171 | gPad->SetLogy(); | |
2172 | good->Rebin(kRebin); | |
2173 | bad->Rebin(kRebin); | |
2174 | good->GetXaxis()->SetRangeUser(-0.09, 0.09); | |
2175 | good->GetYaxis()->SetTitleOffset(1.3); | |
2176 | good->SetStats(0); | |
2177 | good->GetXaxis()->SetTitle("#Delta#varphi (rad.)"); | |
2178 | good->DrawCopy((nw) ? "" : "SAME"); | |
2179 | ||
2180 | bad->SetLineColor(2); | |
2181 | bad->SetLineStyle(2); | |
2182 | bad->SetLineWidth(2); | |
2183 | //bad->SetMarkerColor(2); | |
2184 | //bad->SetMarkerStyle(7); | |
2185 | bad->DrawCopy("SAME"); | |
2186 | ||
2187 | TLegend* legend = new TLegend(0.2, 0.13, 0.85, 0.25); | |
2188 | legend->SetFillColor(0); | |
2189 | legend->SetTextSize(0.04); | |
2190 | legend->AddEntry(good, "Primaries", "L"); | |
2191 | legend->AddEntry(bad, "Secondaries + Background", "L"); | |
2192 | legend->Draw(); | |
2193 | ||
2194 | c->SaveAs("spd_tracklets_deltaphi.eps"); | |
2195 | ||
2196 | c = (TCanvas*) gROOT->GetListOfCanvases()->FindObject("c3"); | |
2197 | Bool_t nw = kFALSE; | |
2198 | if (!c) | |
2199 | { | |
2200 | c = new TCanvas("c3", "c3", 600, 600); | |
2201 | nw = kTRUE; | |
2202 | } | |
2203 | c->cd(); | |
2204 | c->SetRightMargin(0.05); | |
2205 | c->SetTopMargin(0.05); | |
2206 | c->SetGridx(); | |
2207 | c->SetGridy(); | |
2208 | ||
2209 | TLegend* legend = new TLegend(0.5, 0.6, 0.93, 0.75); | |
2210 | legend->SetFillColor(0); | |
2211 | legend->SetTextSize(0.04); | |
2212 | legend->AddEntry(eff, "Efficiency (%)", "L"); | |
2213 | legend->AddEntry(cont, "Contamination (%)", "L"); | |
2214 | ||
2215 | eff->SetStats(0); | |
2216 | eff->GetXaxis()->SetRangeUser(0, 0.08); | |
2217 | eff->GetYaxis()->SetRangeUser(1e-3, 105); | |
2218 | eff->SetLineWidth(2); | |
2219 | eff->DrawCopy((nw) ? "" : "SAME"); | |
2220 | cont->SetLineStyle(2); | |
2221 | cont->SetLineWidth(2); | |
2222 | cont->SetLineColor(2); | |
2223 | cont->DrawCopy("SAME"); | |
2224 | legend->Draw(); | |
2225 | ||
2226 | c->SaveAs("spd_tracklets_efficiency.eps"); | |
a7f69e56 | 2227 | } |
2228 | ||
2229 | void DrawTrackletOrigin_Compare(const char* file1, const char* file2) | |
2230 | { | |
2231 | DrawTrackletOrigin(file1); | |
2232 | good1 = (TH1*) gROOT->FindObject("good")->Clone("good1"); | |
2233 | bad1 = (TH1*) gROOT->FindObject("bad")->Clone("bad1"); | |
2234 | ||
2235 | DrawTrackletOrigin(file2); | |
2236 | good2 = (TH1*) gROOT->FindObject("good")->Clone("good2"); | |
2237 | bad2 = (TH1*) gROOT->FindObject("bad")->Clone("bad2"); | |
2238 | ||
2239 | c = new TCanvas("c4", "c4", 600, 600); | |
2240 | c->SetRightMargin(0.05); | |
2241 | c->SetTopMargin(0.05); | |
2242 | c->SetGridx(); | |
2243 | c->SetGridy(); | |
2244 | gPad->SetLogy(); | |
2245 | ||
2246 | good1->Draw(); | |
2247 | bad1->SetLineColor(1); | |
2248 | bad1->SetMarkerColor(1); | |
2249 | bad1->Draw("SAME"); | |
69b09e3b | 2250 | |
a7f69e56 | 2251 | Float_t factor = (good1->Integral() + bad1->Integral()) / (good2->Integral() + bad2->Integral()); |
69b09e3b | 2252 | |
a7f69e56 | 2253 | good2->Scale(factor); |
2254 | bad2->Scale(factor); | |
2255 | ||
2256 | good2->SetLineColor(2); | |
2257 | bad2->SetMarkerColor(2); | |
2258 | ||
2259 | good2->Draw("SAME"); | |
2260 | bad2->Draw("SAME"); | |
2261 | ||
2262 | good1->GetYaxis()->SetRangeUser(1, TMath::Max(good1->GetMaximum(), good2->GetMaximum()) * 1.1); | |
69b09e3b | 2263 | } |
a7f69e56 | 2264 | |
69b09e3b | 2265 | void Tracklets_Asymmetry() |
2266 | { | |
2267 | TFile::Open("correction_map.root"); | |
2268 | ||
2269 | Int_t maxHists = 7; | |
2270 | TH1* hist[8]; | |
2271 | ||
2272 | Int_t colors[] = {1,2,3,4,6,7,8,102}; | |
2273 | const char* titles[] = { "PP", "SS", "PP'", "PS'", "PS", "SP'", "SS'", "" }; | |
2274 | ||
2275 | TLegend* legend = new TLegend(0.75, 0.6, 0.93, 0.93); | |
2276 | ||
2277 | for (Int_t i=0; i<maxHists; i++) | |
2278 | { | |
2279 | hist[i] = (TH1*) gFile->Get(Form("fDeltaPhi_%d", i)); | |
2280 | hist[i]->Rebin(10); | |
2281 | ||
2282 | for (Int_t j=hist[i]->GetNbinsX()/2; j<=hist[i]->GetNbinsX(); j++) | |
2283 | if (hist[i]->GetBinContent(j) > 0) | |
2284 | hist[i]->SetBinContent(j, (hist[i]->GetBinContent(j) - hist[i]->GetBinContent(hist[i]->GetXaxis()->FindBin(-hist[i]->GetXaxis()->GetBinCenter(j)))) / hist[i]->GetBinContent(j)); | |
2285 | ||
2286 | hist[i]->SetStats(kFALSE); | |
2287 | hist[i]->SetLineColor(colors[i]); | |
2288 | hist[i]->GetXaxis()->SetRangeUser(0.001, 0.09); | |
2289 | //hist[i]->GetYaxis()->SetRangeUser(5, hist[i]->GetMaximum() * 2); | |
2290 | hist[i]->GetYaxis()->SetTitleOffset(1.3); | |
2291 | hist[i]->GetXaxis()->SetTitle("#Delta#varphi (rad.)"); | |
2292 | hist[i]->Draw(((i == 0) ? "" : "SAME")); | |
2293 | ||
2294 | legend->AddEntry(hist[i], titles[i], "L"); | |
2295 | } | |
2296 | ||
2297 | legend->Draw(); | |
0fc41645 | 2298 | } |
567160d6 | 2299 | |
1c15d51a | 2300 | TH2* GetCorrection(const char* fileName = "correction_map.root", const char* dirName = "dndeta_correction", Double_t ptmin=0.2) |
567160d6 | 2301 | { |
1c15d51a | 2302 | // returns the correction factor with pt integrated out |
2303 | ||
567160d6 | 2304 | loadlibs(); |
2305 | ||
2306 | TFile::Open(fileName); | |
2307 | ||
2308 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(dirName, dirName); | |
2309 | if (!dNdEtaCorrection->LoadHistograms()) | |
2310 | return; | |
2311 | ||
ea441adf | 2312 | // hist = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetCorrectionHistogram(); |
567160d6 | 2313 | |
ea441adf | 2314 | gener = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetGeneratedHistogram(); |
2315 | measu = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetMeasuredHistogram(); | |
2316 | ||
2317 | gener->GetZaxis()->SetRange(gener->GetZaxis()->FindBin(ptmin), gener->GetNbinsZ()+1); | |
2318 | TH2D *gener_xy = gener->Project3D("yx"); | |
2319 | ||
2320 | measu->GetZaxis()->SetRange(measu->GetZaxis()->FindBin(ptmin), measu->GetNbinsZ()+1); | |
2321 | TH2D *measu_xy = measu->Project3D("yx"); | |
2322 | ||
2323 | cout << measu->GetZaxis()->FindBin(ptmin) << " " << measu->GetNbinsZ()+1 << endl; | |
2324 | ||
2325 | TCanvas *canp = new TCanvas("canp","canp",600,1000); | |
2326 | canp->Divide(1,2,0.0001,0.0001); | |
2327 | canp->cd(1); | |
2328 | gener_xy->Draw("COLZ"); | |
2329 | canp->cd(2); | |
2330 | measu_xy->Draw("COLZ"); | |
2331 | ||
2332 | ||
2333 | TCanvas *canpr = new TCanvas("canpr","canpr",700,500); | |
2334 | canpr->cd(); | |
2335 | TH2D *proj = new TH2D(*gener_xy); | |
2336 | proj->Divide(measu_xy); | |
2337 | ||
2338 | // proj = hist->Project3D("yx"); | |
1cbdb1a6 | 2339 | proj->Draw("COLZ"); |
2340 | ||
1c15d51a | 2341 | return proj; |
2342 | } | |
2343 | ||
2344 | void DetermineAcceptance(const char* fileName = "correction_map.root", const char* dirName = "dndeta_correction", Double_t ptmin=0.2) | |
2345 | { | |
2346 | TH2* proj = GetCorrection(fileName, dirName, ptmin); | |
2347 | ||
ea441adf | 2348 | const Float_t limit = 5; |
1cbdb1a6 | 2349 | |
2350 | TString array = "{"; | |
2351 | TString arrayEnd = "}"; | |
2352 | ||
2353 | for (Int_t y=1; y<=proj->GetNbinsY(); ++y) | |
2354 | { | |
2355 | Int_t begin = -1; | |
2356 | Int_t end = -1; | |
2357 | for (Int_t x=1; x<=proj->GetNbinsX(); ++x) | |
2358 | { | |
2359 | if (begin == -1 && proj->GetBinContent(x, y) > 0 && proj->GetBinContent(x, y) < limit) | |
2360 | begin = x; | |
2361 | if (begin != -1 && proj->GetBinContent(x, y) > 0 && proj->GetBinContent(x, y) < limit) | |
2362 | end = x; | |
2363 | } | |
2364 | Printf("Limits for y = %d are %d to %d", y, begin, end); | |
2365 | ||
2366 | if (y > 1) | |
2367 | array += ", "; | |
2368 | array += Form("%d", begin); | |
2369 | ||
2370 | if (y > 1) | |
2371 | arrayEnd.Prepend(", "); | |
2372 | arrayEnd.Prepend(Form("%d", (end == -1) ? -1 : proj->GetNbinsX() + 1 - end)); | |
2373 | } | |
2374 | array += "}"; | |
2375 | arrayEnd.Prepend("{"); | |
2376 | ||
2377 | Printf("Begin array:"); | |
2378 | Printf("%s", array.Data()); | |
567160d6 | 2379 | |
1cbdb1a6 | 2380 | Printf("End array (mirrored) (should be the same):"); |
2381 | Printf("%s", arrayEnd.Data()); | |
567160d6 | 2382 | } |
eaa3702a | 2383 | |
2384 | void AverageMultiplicity(const char* fileName = "correction_map.root", const char* correctionMapFolder = "dndeta_correction") | |
2385 | { | |
2386 | loadlibs(); | |
2387 | ||
2388 | TFile::Open(fileName); | |
2389 | ||
2390 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(correctionMapFolder, correctionMapFolder); | |
2391 | dNdEtaCorrection->LoadHistograms(); | |
2392 | TH2* events = dNdEtaCorrection->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetGeneratedHistogram(); | |
2393 | TH3* tracks = dNdEtaCorrection->GetTriggerBiasCorrectionINEL()->GetTrackCorrection()->GetGeneratedHistogram(); | |
2394 | ||
2395 | Float_t nEvents = events->Integral(events->GetXaxis()->FindBin(-1), events->GetXaxis()->FindBin(1), 0, events->GetNbinsY()+1); | |
2396 | Float_t nTracks = tracks->Integral(tracks->GetXaxis()->FindBin(-1), tracks->GetXaxis()->FindBin(1), tracks->GetYaxis()->FindBin(-0.39), tracks->GetYaxis()->FindBin(0.59), 0, tracks->GetNbinsZ()+1); | |
2397 | ||
2398 | Printf("%f %f --> %f", nEvents, nTracks, nTracks / nEvents); | |
2399 | } | |
2400 | ||
1c15d51a | 2401 | void GetAverageCorrectionFactor(Float_t etaRange = 1.5, Float_t vertexRange = 9.9, const char* rawFile = "analysis_esd_raw.root", const char* mcFile = "analysis_mc.root") |
2402 | { | |
2403 | loadlibs(); | |
2404 | ||
2405 | TFile::Open(rawFile); | |
2406 | dNdEtaAnalysis* raw = new dNdEtaAnalysis("dndeta", "dndeta"); | |
2407 | raw->LoadHistograms("fdNdEtaAnalysisESD"); | |
2408 | raw->GetData()->GetTrackCorrection()->GetMeasuredHistogram()->GetXaxis()->SetRangeUser(-vertexRange, vertexRange); | |
2409 | tracks = raw->GetData()->GetTrackCorrection()->GetMeasuredHistogram()->Project3D("y"); | |
2410 | events = raw->GetData()->GetEventCorrection()->GetMeasuredHistogram()->ProjectionX("events", 0, raw->GetData()->GetEventCorrection()->GetMeasuredHistogram()->GetNbinsY() + 1); | |
2411 | Float_t nEvents = events->Integral(events->FindBin(-vertexRange), events->FindBin(vertexRange)); | |
2412 | tracks->Scale(1.0 / nEvents / tracks->GetBinWidth(1)); | |
2413 | ||
2414 | TFile::Open(mcFile); | |
2415 | dNdEtaAnalysis* mc = new dNdEtaAnalysis("dndeta", "dndeta"); | |
2416 | mc->LoadHistograms("dndetaTrVtx"); | |
2417 | mcH = mc->GetdNdEtaPtCutOffCorrectedHistogram(0); | |
2418 | ||
2419 | new TCanvas; | |
2420 | mcH->SetLineColor(2); | |
2421 | mcH->DrawCopy(); | |
2422 | tracks->DrawCopy("SAME"); | |
2423 | ||
2424 | new TCanvas; | |
2425 | mcH->GetYaxis()->SetRangeUser(0, 5); | |
2426 | mcH->Divide(tracks); | |
2427 | mcH->DrawCopy(); | |
2428 | mcH->Fit("pol0", "", "", -etaRange, etaRange); | |
2429 | } | |
2430 | ||
a7f69e56 | 2431 | void TrackCuts_Comparison_MC(char* histName, Int_t plotWhich = 0, const char* fileName = "correction_map.root", Bool_t mirror = kFALSE) |
1c15d51a | 2432 | { |
2433 | // for the nsigmaplot it is needed to run with all cuts except the nsigmatovertex | |
2434 | // --> manually disable it in the run.C | |
5a6310fe | 2435 | // |
2436 | // plotWhich: 0 = only before | |
2437 | // 1 = both | |
2438 | // 2 = only after | |
69b09e3b | 2439 | // |
2440 | // mirror: kTRUE --> project negative values on the positive side | |
2441 | ||
1c15d51a | 2442 | |
2443 | file = TFile::Open(fileName); | |
2444 | ||
2445 | Int_t count = 0; | |
2446 | Int_t colors[] = { 1, 2, 3, 4, 5, 6 }; | |
2447 | ||
5a6310fe | 2448 | TLegend* legend = new TLegend(0.5, 0.7, 1, 1); |
1c15d51a | 2449 | TLegend* legend2 = new TLegend(0.4, 0.6, 1, 1); |
5a6310fe | 2450 | TLegend* legend3 = new TLegend(0.6, 0.5, 1, 0.7); |
1c15d51a | 2451 | |
69b09e3b | 2452 | TCanvas* c1 = new TCanvas(histName, histName, 800, 1200); |
5a6310fe | 2453 | c1->Divide(1, 2); |
1c15d51a | 2454 | //TCanvas* c2 = new TCanvas("c2", "c2", 800, 600); |
5a6310fe | 2455 | //TCanvas* c3 = new TCanvas("c3", "c3", 800, 600); |
1c15d51a | 2456 | |
2457 | const char* folders2[] = { "before_cuts", "after_cuts" }; | |
5a6310fe | 2458 | Bool_t first = kTRUE; |
2459 | for (Int_t j = ((plotWhich < 2) ? 0 : 1); j < ((plotWhich > 0) ? 2 : 1); j++) | |
1c15d51a | 2460 | { |
2461 | const char* folders1[] = { "esd_track_cuts", "esd_track_cuts_primaries", "esd_track_cuts_secondaries" }; | |
5a6310fe | 2462 | const char* names[] = { "all", "primaries", "secondaries" }; |
1c15d51a | 2463 | TH1* base = 0; |
2464 | TH1* prim = 0; | |
2465 | TH1* sec = 0; | |
2466 | for (Int_t i = 0; i < 3; i++) | |
2467 | { | |
2468 | TString folder; | |
2469 | folder.Form("%s/%s/%s", folders1[i], folders2[j], histName); | |
2470 | TH1* hist = (TH1*) file->Get(folder); | |
69b09e3b | 2471 | |
2472 | if (mirror) | |
2473 | { | |
2474 | for (Int_t bin=1; bin<=hist->GetXaxis()->FindBin(-0.0001); bin++) | |
2475 | { | |
2476 | Int_t newBin = hist->GetXaxis()->FindBin(-hist->GetXaxis()->GetBinCenter(bin)); | |
2477 | if (bin != newBin) | |
2478 | { | |
2479 | hist->Fill(-hist->GetXaxis()->GetBinCenter(bin), hist->GetBinContent(bin)); | |
2480 | hist->SetBinContent(bin, 0); | |
2481 | } | |
2482 | } | |
2483 | } | |
2484 | ||
5a6310fe | 2485 | legend->AddEntry(hist, Form("%s %s", names[i], folders2[j])); |
1c15d51a | 2486 | |
5a6310fe | 2487 | c1->cd(1); |
1c15d51a | 2488 | hist->SetLineColor(colors[count]); |
2489 | hist->DrawCopy((count == 0) ? "" : "SAME"); | |
2490 | ||
2491 | switch (i) | |
2492 | { | |
2493 | case 0: base = hist; break; | |
2494 | case 1: prim = hist; break; | |
2495 | case 2: sec = hist; break; | |
2496 | } | |
2497 | ||
2498 | count++; | |
2499 | } | |
2500 | ||
2501 | TH1* eff = (TH1*) prim->Clone("eff"); eff->Reset(); | |
2502 | TH1* purity = (TH1*) prim->Clone("purity"); purity->Reset(); | |
2503 | ||
2504 | for (Int_t bin = 1; bin <= prim->GetNbinsX(); bin++) | |
2505 | { | |
2506 | eff->SetBinContent(bin, prim->Integral(1, bin) / prim->Integral(1, prim->GetNbinsX() + 1)); | |
5a6310fe | 2507 | if (prim->Integral(1, bin) + sec->Integral(1, bin) > 0) |
2508 | purity->SetBinContent(bin, sec->Integral(1, bin) / (prim->Integral(1, bin) + sec->Integral(1, bin))); | |
1c15d51a | 2509 | } |
2510 | ||
2511 | eff->GetYaxis()->SetRangeUser(0, 1); | |
2512 | eff->SetLineColor(colors[0+j*2]); | |
2513 | eff->SetStats(kFALSE); | |
2514 | purity->SetLineColor(colors[1+j*2]); | |
2515 | ||
2516 | legend3->AddEntry(eff, Form("%s: efficiency", folders2[j])); | |
2517 | legend3->AddEntry(purity, Form("%s: contamination", folders2[j])); | |
2518 | ||
5a6310fe | 2519 | c1->cd(2); |
2520 | eff->DrawCopy((first) ? "" : "SAME"); | |
2521 | first = kFALSE; | |
1c15d51a | 2522 | purity->DrawCopy("SAME"); |
2523 | } | |
2524 | ||
5a6310fe | 2525 | c1->cd(1)->SetLogy(); |
2526 | c1->cd(1)->SetGridx(); | |
2527 | c1->cd(1)->SetGridy(); | |
1c15d51a | 2528 | legend->Draw(); |
2529 | ||
2530 | //c2->cd(); | |
2531 | // c2->SetGridx(); | |
2532 | // c2->SetGridy(); | |
2533 | //legend2->Draw(); | |
2534 | ||
5a6310fe | 2535 | c1->cd(2)->SetGridx(); |
2536 | c1->cd(2)->SetGridy(); | |
1c15d51a | 2537 | legend3->Draw(); |
5a6310fe | 2538 | |
69b09e3b | 2539 | //c1->SaveAs(Form("%s.png", histName)); |
1c15d51a | 2540 | } |
2541 | ||
a7f69e56 | 2542 | void TrackCuts_Comparison_Data(char* histName, Int_t plotWhich, const char* fileName1, const char* fileName2, Bool_t mirror = kFALSE, const char* label1 = "file1", const char* label2 = "file2") |
2543 | { | |
2544 | // for the nsigmaplot it is needed to run with all cuts except the nsigmatovertex | |
2545 | // --> manually disable it in the run.C | |
2546 | // | |
2547 | // plotWhich: 0 = only before | |
2548 | // 1 = both | |
2549 | // 2 = only after | |
2550 | // | |
2551 | // mirror: kTRUE --> project negative values on the positive side | |
2552 | ||
2553 | ||
2554 | Int_t count = 0; | |
2555 | Int_t colors[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; | |
2556 | ||
2557 | TLegend* legend = new TLegend(0.5, 0.7, 1, 1); | |
2558 | legend->SetFillColor(0); | |
2559 | TLegend* legend2 = new TLegend(0.4, 0.6, 1, 1); | |
2560 | TLegend* legend3 = new TLegend(0.6, 0.5, 1, 0.7); | |
2561 | ||
2562 | TCanvas* c1 = new TCanvas(histName, histName, 600, 600); | |
2563 | //TCanvas* c2 = new TCanvas("c2", "c2", 800, 600); | |
2564 | //TCanvas* c3 = new TCanvas("c3", "c3", 800, 600); | |
2565 | ||
2566 | const char* folders2[] = { "before_cuts", "after_cuts" }; | |
2567 | Bool_t first = kTRUE; | |
2568 | for (Int_t j = ((plotWhich < 2) ? 0 : 1); j < ((plotWhich > 0) ? 2 : 1); j++) | |
2569 | { | |
2570 | const char* folders1[] = { "esd_track_cuts", "esd_track_cuts_primaries", "esd_track_cuts_secondaries" }; | |
2571 | const char* names[] = { "all", "primaries", "secondaries" }; | |
2572 | ||
2573 | Float_t normalize[3]; | |
2574 | ||
2575 | for (Int_t i = 0; i < 2; i++) | |
2576 | { | |
2577 | file = TFile::Open((i == 0) ? fileName1 : fileName2); | |
2578 | ||
2579 | for (Int_t k = 1; k < 3; k++) | |
2580 | { | |
2581 | TString folder; | |
2582 | folder.Form("%s/%s/%s", folders1[k], folders2[j], histName); | |
2583 | Printf("%s", folder.Data()); | |
2584 | TH1* hist = (TH1*) file->Get(folder); | |
2585 | ||
2586 | if (mirror) | |
2587 | { | |
2588 | for (Int_t bin=1; bin<=hist->GetXaxis()->FindBin(-0.0001); bin++) | |
2589 | { | |
2590 | Int_t newBin = hist->GetXaxis()->FindBin(-hist->GetXaxis()->GetBinCenter(bin)); | |
2591 | if (bin != newBin) | |
2592 | { | |
2593 | hist->Fill(-hist->GetXaxis()->GetBinCenter(bin), hist->GetBinContent(bin)); | |
2594 | hist->SetBinContent(bin, 0); | |
2595 | } | |
2596 | } | |
2597 | } | |
2598 | ||
2599 | if (i == 0) | |
2600 | { | |
2601 | normalize[k] = hist->Integral(); | |
2602 | } | |
2603 | else | |
2604 | hist->Scale(normalize[k] / hist->Integral()); | |
2605 | ||
2606 | legend->AddEntry(hist, Form("%s %s %s", (i == 0) ? label1 : label2, (k == 1) ? "primaries" : "secondaries", folders2[j])); | |
2607 | ||
2608 | c1->cd(); | |
2609 | hist->SetStats(0); | |
2610 | hist->SetLineColor(colors[count]); | |
2611 | hist->DrawCopy((count == 0) ? "" : "SAME"); | |
2612 | ||
2613 | count++; | |
2614 | } | |
2615 | } | |
2616 | ||
2617 | } | |
2618 | ||
2619 | //c1->SetLogy(); | |
2620 | c1->SetGridx(); | |
2621 | c1->SetGridy(); | |
2622 | legend->Draw(); | |
2623 | } | |
2624 | ||
1c15d51a | 2625 | void TrackCuts_DCA() |
2626 | { | |
2627 | file = TFile::Open("correction_map.root"); | |
2628 | hist = (TH2*) file->Get("esd_track_cuts/before_cuts/dXYvsDZ"); | |
2629 | ||
2630 | TCanvas* c1 = new TCanvas("c1", "c1", 600, 600); | |
2631 | c1->SetLogz(); | |
2632 | c1->SetRightMargin(0.12); | |
2633 | c1->SetBottomMargin(0.12); | |
2634 | ||
2635 | hist->SetStats(kFALSE); | |
2636 | hist->Draw("COLZ"); | |
2637 | ||
2638 | ellipse = new TEllipse(0, 0, 4); | |
2639 | ellipse->SetLineWidth(2); | |
2640 | ellipse->SetLineStyle(2); | |
2641 | ellipse->SetFillStyle(0); | |
2642 | ellipse->Draw(); | |
2643 | ||
2644 | c1->SaveAs("trackcuts_dca_2d.eps"); | |
2645 | } | |
2646 | ||
2647 | void FindNSigma(TH2* hist, Int_t nSigma = 1) | |
2648 | { | |
2649 | TH1* proj = hist->ProjectionY(); | |
2650 | proj->Reset(); | |
2651 | ||
2652 | for (Int_t bin=1; bin<=proj->GetNbinsX(); bin++) | |
2653 | { | |
2654 | if (hist->Integral(1, hist->GetNbinsX(), bin, bin) == 0) | |
2655 | continue; | |
2656 | ||
2657 | Int_t limit = -1; | |
2658 | for (limit = 1; limit<=hist->GetNbinsX(); limit++) | |
2659 | } | |
2660 | } | |
2661 | ||
2662 | void ShowOnlyAccepted(TH2* input, const char* fileName = "correction_map.root", const char* dirName = "dndeta_correction", Double_t ptmin=0.2) | |
2663 | { | |
2664 | TH2* proj = GetCorrection(fileName, dirName, ptmin); | |
2665 | ||
2666 | for (Int_t y=1; y<=proj->GetNbinsY(); ++y) | |
2667 | for (Int_t x=1; x<=proj->GetNbinsX(); ++x) | |
2668 | if (proj->GetBinContent(x, y) > 5 || proj->GetBinContent(x, y) == 0) | |
2669 | { | |
2670 | proj->SetBinContent(x, y, 0); | |
2671 | } | |
2672 | else | |
2673 | proj->SetBinContent(x, y, 1); | |
2674 | ||
2675 | ||
2676 | input->Multiply(proj); | |
2677 | } | |
51f6de65 | 2678 | |
2679 | void MakeGaussianProfile(const char* histName = "fVertexCorrelation", Bool_t subtractMean = kFALSE) | |
2680 | { | |
2681 | TFile::Open("correction_map.root"); | |
2682 | ||
2683 | TH2* hist2d = (TH2*) gFile->Get(histName); | |
2684 | hist2d->Sumw2(); | |
2685 | ||
2686 | TH1* result = hist2d->ProjectionX("result"); | |
2687 | result->GetYaxis()->SetTitle(hist2d->GetYaxis()->GetTitle()); | |
2688 | result->Reset(); | |
2689 | ||
2690 | for (Int_t x=1; x<hist2d->GetNbinsX(); ++x) | |
2691 | { | |
2692 | hist = hist2d->ProjectionY(Form("temp_%d", x), x, x); | |
2693 | if (hist->GetEntries() == 0) | |
2694 | continue; | |
2695 | if (hist->Fit("gaus") == 0) | |
2696 | { | |
2697 | func = hist->GetFunction("gaus"); | |
2698 | mean = func->GetParameter(1); | |
2699 | error = func->GetParError(1); | |
2700 | ||
2701 | if (subtractMean) | |
2702 | mean = hist2d->GetXaxis()->GetBinCenter(x) - mean; | |
2703 | ||
2704 | result->SetBinContent(x, mean); | |
2705 | result->SetBinError(x, error); | |
2706 | ||
2707 | if (x % 10 == 0) | |
2708 | { | |
2709 | new TCanvas; | |
2710 | ((TH1*) hist->Clone())->DrawCopy(); | |
2711 | } | |
2712 | } | |
2713 | //break; | |
2714 | } | |
2715 | ||
2716 | new TCanvas; | |
2717 | result->GetYaxis()->SetRangeUser(-0.2, 0.2); | |
2718 | result->Draw(); | |
2719 | } | |
69b09e3b | 2720 | |
2721 | TH2* GetAcceptance(void* corr2d_void) | |
2722 | { | |
2723 | corr2d = (AliCorrectionMatrix2D*) corr2d_void; | |
2724 | corr_xy = (TH2*) corr2d->GetCorrectionHistogram()->Clone("acceptance"); | |
2725 | ||
2726 | // fold in acceptance | |
2727 | for (Int_t x=1; x<=corr_xy->GetNbinsX(); ++x) | |
2728 | for (Int_t y=1; y<=corr_xy->GetNbinsY(); ++y) | |
2729 | { | |
2730 | if (corr_xy->GetBinContent(x, y) > 1.5) | |
2731 | corr_xy->SetBinContent(x, y, 0); | |
2732 | ||
2733 | if (corr_xy->GetBinContent(x, y) > 0) | |
2734 | corr_xy->SetBinContent(x, y, 1); | |
2735 | ||
2736 | corr_xy->SetBinError(x, y, 0); | |
2737 | } | |
2738 | ||
2739 | return corr_xy; | |
2740 | } | |
2741 | ||
2742 | void ZeroOutsideAcceptance(TH2* acc, TH3* hist) | |
2743 | { | |
2744 | for (Int_t x=0; x<=acc->GetNbinsX()+1; ++x) | |
2745 | for (Int_t y=0; y<=acc->GetNbinsY()+1; ++y) | |
2746 | { | |
1d107532 | 2747 | if (acc->GetBinContent(x, y) > 2 || acc->GetBinContent(x, y) == 0) |
69b09e3b | 2748 | { |
2749 | for (Int_t z=0; z<=hist->GetNbinsZ()+1; ++z) | |
2750 | { | |
2751 | hist->SetBinContent(x, y, z, 0); | |
2752 | hist->SetBinError(x, y, z, 0); | |
2753 | } | |
2754 | } | |
2755 | } | |
2756 | } | |
2757 | ||
2758 | void DrawPhi() | |
2759 | { | |
2760 | loadlibs(); | |
2761 | ||
2762 | TFile::Open("correction_map.root"); | |
2763 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction"); | |
2764 | if (!dNdEtaCorrection->LoadHistograms()) | |
2765 | return 0; | |
2766 | ||
2767 | TFile::Open("analysis_esd.root"); | |
2768 | dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaTrVtx", "dndetaTrVtx"); | |
2769 | fdNdEtaAnalysis->LoadHistograms(); | |
2770 | ||
2771 | // acc. map! | |
2772 | //acc = GetAcceptance(dNdEtaCorrection->GetCorrection(1)->GetTrackCorrection()->Get2DCorrection("yx", 0, 1000)); | |
2773 | acc = dNdEtaCorrection->GetCorrection(1)->GetTrackCorrection()->Get2DCorrection("yx", 0, 1000)->GetCorrectionHistogram(); | |
2774 | //new TCanvas; acc->Draw("COLZ"); | |
2775 | ||
2776 | histG = fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetGeneratedHistogram(); | |
2777 | ZeroOutsideAcceptance(acc, histG); | |
2778 | //new TCanvas; histG->Project3D("yx")->Draw("COLZ"); | |
2779 | //histG->GetYaxis()->SetRangeUser(-0.9, 0.9); | |
2780 | ||
2781 | histM = fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetMeasuredHistogram(); | |
2782 | ZeroOutsideAcceptance(acc, histM); | |
2783 | //histM->GetYaxis()->SetRangeUser(-0.9, 0.9); | |
2784 | ||
2785 | TFile::Open("analysis_mc.root"); | |
2786 | dNdEtaAnalysis* fdNdEtaAnalysis2 = new dNdEtaAnalysis("dndetaTrVtxMC", "dndetaTrVtxMC"); | |
2787 | fdNdEtaAnalysis2->LoadHistograms("dndetaTrVtx"); | |
2788 | ||
2789 | histMC = fdNdEtaAnalysis2->GetData()->GetTrackCorrection()->GetMeasuredHistogram(); | |
2790 | ZeroOutsideAcceptance(acc, histMC); | |
2791 | //new TCanvas; histMC->Project3D("yx2")->Draw("COLZ"); | |
2792 | ||
2793 | //histG->GetZaxis()->SetRangeUser(1,2); histMC->GetZaxis()->SetRangeUser(1,2); | |
2794 | new TCanvas; a = histG->Project3D("yx3"); a->Add(histMC->Project3D("yx4"), -1); a->Draw("COLZ"); | |
2795 | ||
2796 | //histMC->GetYaxis()->SetRangeUser(-0.9, 0.9); | |
2797 | ||
2798 | c = new TCanvas; | |
2799 | ||
2800 | histG->GetXaxis()->SetRangeUser(-9.9, 9.9); | |
1d107532 | 2801 | histG->Project3D("z")->DrawCopy(); |
69b09e3b | 2802 | |
2803 | histM->GetXaxis()->SetRangeUser(-9.9, 9.9); | |
2804 | proj = histM->Project3D("z2"); | |
2805 | proj->SetLineColor(2); | |
1d107532 | 2806 | proj->DrawCopy("SAME"); |
69b09e3b | 2807 | |
2808 | histMC->GetXaxis()->SetRangeUser(-9.9, 9.9); | |
2809 | projMC = histMC->Project3D("z3"); | |
1d107532 | 2810 | projMC->SetLineColor(4); |
2811 | projMC->DrawCopy("SAME"); | |
69b09e3b | 2812 | } |
2813 | ||
1d107532 | 2814 | void PrintEventStats(Int_t corrID = 3, const char* fileName = "correction_map.root", const char* dir = "dndeta_correction") |
69b09e3b | 2815 | { |
2816 | loadlibs(); | |
2817 | ||
2818 | /* | |
2819 | TFile::Open("analysis_mc.root"); | |
2820 | fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaNSD", "dndetaNSD"); | |
2821 | fdNdEtaAnalysis->LoadHistograms(); | |
2822 | trackHist = fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetGeneratedHistogram(); | |
2823 | eventHist = fdNdEtaAnalysis->GetData()->GetEventCorrection()->GetGeneratedHistogram(); | |
2824 | */ | |
2825 | ||
1d107532 | 2826 | TFile::Open(fileName); |
2827 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(dir, dir); | |
69b09e3b | 2828 | if (!dNdEtaCorrection->LoadHistograms()) |
2829 | return; | |
2830 | trackHist = dNdEtaCorrection->GetCorrection(corrID)->GetTrackCorrection()->GetGeneratedHistogram(); | |
2831 | eventHist = dNdEtaCorrection->GetCorrection(corrID)->GetEventCorrection()->GetGeneratedHistogram(); | |
2832 | ||
2833 | trackHist->GetXaxis()->SetRange(0, trackHist->GetNbinsX()+1); | |
2834 | trackHist->GetZaxis()->SetRange(0, trackHist->GetNbinsZ()+1); | |
2835 | eta = trackHist->Project3D("y"); | |
2836 | ||
2837 | events = eventHist->Integral(0, eventHist->GetNbinsX()+1, 0, eventHist->GetNbinsY()+1); | |
2838 | ||
2839 | eta->Scale(1.0 / events); | |
2840 | ||
2841 | Float_t avgN = eta->Integral(0, eta->GetNbinsX()+1); | |
2842 | Printf("<N> = %f", avgN); | |
2843 | ||
2844 | eta->Scale(1.0 / eta->GetXaxis()->GetBinWidth(1)); | |
2845 | ||
2846 | Printf("dndeta | eta = 0 is %f", (eta->GetBinContent(eta->FindBin(0.01)) + eta->GetBinContent(eta->FindBin(-0.01))) / 2); | |
a7f69e56 | 2847 | Printf("dndeta in |eta| < 0.5 is %f", eta->Integral(eta->FindBin(-0.49), eta->FindBin(0.49)) / (eta->FindBin(0.49) - eta->FindBin(-0.49) + 1)); |
69b09e3b | 2848 | Printf("dndeta in |eta| < 1 is %f", eta->Integral(eta->FindBin(-0.99), eta->FindBin(0.99)) / (eta->FindBin(0.99) - eta->FindBin(-0.99) + 1)); |
2849 | Printf("dndeta in |eta| < 1.5 is %f", eta->Integral(eta->FindBin(-1.49), eta->FindBin(1.49)) / (eta->FindBin(1.49) - eta->FindBin(-1.49) + 1)); | |
2850 | ||
2851 | stats = (TH2*) gFile->Get("fEventStats"); | |
2852 | proj = stats->ProjectionX(); | |
2853 | gROOT->ProcessLine(".L PrintHist.C"); | |
2854 | PrintHist2D(stats); | |
2855 | PrintHist(proj); | |
2856 | ||
2857 | Printf("+++ TRIGGER EFFICIENCIES +++"); | |
2858 | ||
a7f69e56 | 2859 | Printf("INEL = %.1f", 100. * (proj->GetBinContent(1) - stats->GetBinContent(1, 1) - stats->GetBinContent(1, 3)) / proj->GetBinContent(1)); |
2860 | Printf("NSD = %.1f", 100. * (proj->GetBinContent(2) - stats->GetBinContent(2, 1) - stats->GetBinContent(2, 3)) / proj->GetBinContent(2)); | |
2861 | Printf("ND = %.1f", 100. * (proj->GetBinContent(3) - stats->GetBinContent(3, 1) - stats->GetBinContent(3, 3)) / proj->GetBinContent(3)); | |
2862 | Printf("SD = %.1f", 100. * (proj->GetBinContent(4) - stats->GetBinContent(4, 1) - stats->GetBinContent(4, 3)) / proj->GetBinContent(4)); | |
2863 | Printf("DD = %.1f", 100. * (proj->GetBinContent(5) - stats->GetBinContent(5, 1) - stats->GetBinContent(5, 3)) / proj->GetBinContent(5)); | |
2864 | ||
1d107532 | 2865 | Printf("+++ VERTEX EFFICIENCIES +++"); |
2866 | ||
2867 | Printf("INEL = %.1f", 100. * (stats->GetBinContent(1, 3) + stats->GetBinContent(1, 4)) / proj->GetBinContent(1)); | |
2868 | Printf("NSD = %.1f", 100. * (stats->GetBinContent(2, 3) + stats->GetBinContent(2, 4)) / proj->GetBinContent(2)); | |
2869 | ||
2870 | Float_t vtxND = 100. * (stats->GetBinContent(3, 3) + stats->GetBinContent(3, 4)) / proj->GetBinContent(3); | |
2871 | Float_t vtxSD = 100. * (stats->GetBinContent(4, 3) + stats->GetBinContent(4, 4)) / proj->GetBinContent(4); | |
2872 | Float_t vtxDD = 100. * (stats->GetBinContent(5, 3) + stats->GetBinContent(5, 4)) / proj->GetBinContent(5); | |
2873 | Printf("ND = %.1f", vtxND); | |
2874 | Printf("SD = %.1f", vtxSD); | |
2875 | Printf("DD = %.1f", vtxDD); | |
2876 | ||
2877 | Float_t ua5_SD = 0.153; | |
2878 | Float_t ua5_DD = 0.080; | |
2879 | Float_t ua5_ND = 0.767; | |
2880 | ||
2881 | Float_t vtxINELUA5 = ua5_SD * vtxSD + ua5_DD * vtxDD + ua5_ND * vtxND; | |
2882 | Float_t vtxNSDUA5 = (ua5_DD * vtxDD + ua5_ND * vtxND) / (ua5_DD + ua5_ND); | |
2883 | Printf("INEL (UA5) = %.1f", vtxINELUA5); | |
2884 | Printf("NSD (UA5) = %.1f", vtxNSDUA5); | |
2885 | ||
a7f69e56 | 2886 | Printf("+++ TRIGGER + VERTEX EFFICIENCIES +++"); |
2887 | ||
2888 | Printf("INEL = %.1f", 100. * stats->GetBinContent(1, 4) / proj->GetBinContent(1)); | |
2889 | Printf("NSD = %.1f", 100. * stats->GetBinContent(2, 4) / proj->GetBinContent(2)); | |
2890 | Printf("ND = %.1f", 100. * stats->GetBinContent(3, 4) / proj->GetBinContent(3)); | |
2891 | Printf("SD = %.1f", 100. * stats->GetBinContent(4, 4) / proj->GetBinContent(4)); | |
2892 | Printf("DD = %.1f", 100. * stats->GetBinContent(5, 4) / proj->GetBinContent(5)); | |
69b09e3b | 2893 | |
1d107532 | 2894 | |
2895 | ||
69b09e3b | 2896 | for (Int_t i=7; i<=proj->GetNbinsX(); i++) |
2897 | if (proj->GetBinContent(i) > 0) | |
2898 | Printf("bin %d (process type %d) = %.2f", i, (Int_t) proj->GetXaxis()->GetBinCenter(i), 100.0 * (proj->GetBinContent(i) - stats->GetBinContent(i, 1)) / proj->GetBinContent(i)); | |
2899 | ||
2900 | //eta->Draw(); | |
2901 | } | |
2902 | ||
2903 | void TestAsymmetry() | |
2904 | { | |
2905 | loadlibs(); | |
2906 | ||
2907 | TFile* file2 = TFile::Open("analysis_mc.root"); | |
2908 | ||
2909 | dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta"); | |
2910 | fdNdEtaAnalysis->LoadHistograms(); | |
2911 | fdNdEtaAnalysis->Finish(0, 0, AlidNdEtaCorrection::kNone, "..."); | |
2912 | ||
2913 | fdNdEtaAnalysis->GetdNdEtaHistogram(0)->DrawCopy(); | |
2914 | ||
2915 | hist = (TH1*) fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetMeasuredHistogram(); | |
2916 | hist2 = (TH1*) hist->Clone("hist2"); | |
2917 | for (Int_t x=1; x<=hist->GetNbinsX(); x++) | |
2918 | for (Int_t y=1; y<=hist->GetNbinsY(); y++) | |
2919 | for (Int_t z=1; z<=hist->GetNbinsZ(); z++) | |
2920 | { | |
2921 | Printf("%d %d %d %d", x, y, z, hist->GetNbinsY() + 1 - y); | |
2922 | hist->SetBinContent(x, y, z, hist2->GetBinContent(hist->GetNbinsX() / 2, TMath::Min(y, hist->GetNbinsY() + 1 - y), z)); | |
2923 | } | |
2924 | ||
2925 | hist = fdNdEtaAnalysis->GetData()->GetEventCorrection()->GetMeasuredHistogram(); | |
2926 | for (Int_t x=1; x<=hist->GetNbinsX(); x++) | |
2927 | for (Int_t y=1; y<=hist->GetNbinsY(); y++) | |
2928 | { | |
2929 | //Printf("%d %d %d %d", x, y, z, hist->GetNbinsY() + 1 - y); | |
2930 | hist->SetBinContent(x, y, hist->GetBinContent(hist->GetNbinsX() / 2, y)); | |
2931 | } | |
2932 | ||
2933 | fdNdEtaAnalysis->Finish(0, 0, AlidNdEtaCorrection::kNone, "..."); | |
2934 | fdNdEtaAnalysis->GetdNdEtaHistogram(0)->SetMarkerColor(2); | |
2935 | fdNdEtaAnalysis->GetdNdEtaHistogram(0)->SetLineColor(2); | |
2936 | fdNdEtaAnalysis->GetdNdEtaHistogram(0)->SetMarkerStyle(5); | |
2937 | fdNdEtaAnalysis->GetdNdEtaHistogram(0)->DrawCopy("SAMEP"); | |
2938 | } | |
2939 | ||
2940 | void DeltaPhiFromPt(Float_t smearing = 0.005) | |
2941 | { | |
2942 | loadlibs(); | |
2943 | ||
2944 | TFile::Open("analysis_mc.root"); | |
2945 | hist = (TH1*) gFile->Get("dndeta_check_pt"); | |
2946 | ||
2947 | dPhiHist = new TH1F("dPhiHist", ";#Delta phi", 400, -0.1, 0.1); | |
2948 | dPhiHist2 = new TH1F("dPhiHist2", ";#Delta phi", 400, -0.1, 0.1); | |
2949 | ||
2950 | for (Int_t i=1; i<=hist->GetNbinsX(); i++) | |
2951 | { | |
2952 | Float_t pt = hist->GetBinCenter(i); | |
2953 | Float_t deltaPhi = (0.076 - 0.039) / 2 / (pt / 0.15); | |
2954 | ||
2955 | if (smearing > 0) | |
2956 | { | |
2957 | gaus = new TF1("mygaus", "gaus(0)", -0.1, 0.1); | |
2958 | gaus->SetParameters(1, -deltaPhi, smearing); | |
2959 | ||
2960 | dPhiHist->FillRandom("mygaus", hist->GetBinContent(i) / 2 * 1000); | |
2961 | ||
2962 | dPhiHist2->FillRandom("mygaus", hist->GetBinContent(i) / 2 * 1000); | |
2963 | gaus->SetParameters(1, deltaPhi, smearing); | |
2964 | dPhiHist2->FillRandom("mygaus", hist->GetBinContent(i) / 2 * 1000); | |
2965 | } | |
2966 | else | |
2967 | { | |
2968 | dPhiHist->Fill(deltaPhi, hist->GetBinContent(i) / 2); | |
2969 | dPhiHist2->Fill(deltaPhi, hist->GetBinContent(i) / 2); | |
2970 | dPhiHist2->Fill(-deltaPhi, hist->GetBinContent(i) / 2); | |
2971 | } | |
2972 | } | |
2973 | ||
2974 | new TCanvas; | |
2975 | dPhiHist->Draw(); | |
2976 | dPhiHist2->SetLineColor(2); | |
2977 | dPhiHist2->Draw("SAME"); | |
2978 | gPad->SetLogy(); | |
2979 | ||
2980 | TFile::Open("trackletsDePhi.root"); | |
2981 | //TFile::Open("tmp/correction_maponly-positive.root"); | |
2982 | //TFile::Open("tmp/correction_map.root"); | |
2983 | //tracklets = (TH1*) gFile->Get(Form("fDeltaPhi_%d", 0)); | |
2984 | tracklets = (TH1*) gFile->Get("DePhiPPTracklets"); | |
2985 | tracklets->Scale(1.0 / tracklets->GetMaximum() * dPhiHist->GetMaximum()); | |
2986 | tracklets->SetLineColor(4); | |
2987 | tracklets->Draw("SAME"); | |
2988 | } | |
a7f69e56 | 2989 | |
2990 | void VertexDistributions() | |
2991 | { | |
2992 | loadlibs(); | |
2993 | ||
2994 | TFile::Open("correction_map.root"); | |
2995 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction"); | |
2996 | if (!dNdEtaCorrection->LoadHistograms()) | |
2997 | return; | |
2998 | ||
2999 | all = dNdEtaCorrection->GetCorrection(AlidNdEtaCorrection::kINEL)->GetEventCorrection()->GetGeneratedHistogram()->ProjectionX("all"); | |
3000 | trigger = dNdEtaCorrection->GetCorrection(AlidNdEtaCorrection::kINEL)->GetEventCorrection()->GetMeasuredHistogram()->ProjectionX("trigger"); | |
3001 | vtx = dNdEtaCorrection->GetCorrection(AlidNdEtaCorrection::kVertexReco)->GetEventCorrection()->GetMeasuredHistogram()->ProjectionX("vtx"); | |
3002 | ||
3003 | nottriggered = (TH1*) all->Clone("nottriggered"); | |
3004 | nottriggered->Add(trigger, -1); | |
3005 | ||
3006 | novertex = (TH1*) trigger->Clone("novertex"); | |
3007 | novertex->Add(vtx, -1); | |
3008 | ||
3009 | temphist = dNdEtaCorrection->GetCorrection(AlidNdEtaCorrection::kVertexReco)->GetEventCorrection()->GetMeasuredHistogram(); | |
3010 | highmult = temphist->ProjectionX("highmult", temphist->GetYaxis()->FindBin(10), temphist->GetNbinsY()); | |
3011 | //all = dNdEtaCorrection->GetCorrection(AlidNdEtaCorrection::kINEL)->GetEventCorrection()->GetGeneratedHistogram()->ProjectionX("all", temphist->GetYaxis()->FindBin(10), temphist->GetNbinsY()); | |
3012 | ||
3013 | for (Int_t i=1; i<=trigger->GetNbinsX(); i++) | |
3014 | { | |
3015 | all->SetBinContent(i, all->GetBinContent(i) / all->GetBinWidth(i)); | |
3016 | trigger->SetBinContent(i, trigger->GetBinContent(i) / trigger->GetBinWidth(i)); | |
3017 | vtx->SetBinContent(i, vtx->GetBinContent(i) / vtx->GetBinWidth(i)); | |
3018 | nottriggered->SetBinContent(i, nottriggered->GetBinContent(i) / nottriggered->GetBinWidth(i)); | |
3019 | novertex->SetBinContent(i, novertex->GetBinContent(i) / novertex->GetBinWidth(i)); | |
3020 | highmult->SetBinContent(i, highmult->GetBinContent(i) / highmult->GetBinWidth(i)); | |
3021 | } | |
3022 | ||
3023 | new TCanvas; | |
3024 | vtx->SetTitle(""); | |
3025 | vtx->SetStats(0); | |
3026 | vtx->DrawCopy("HIST"); | |
3027 | ||
3028 | all->Scale(1.0 / all->Integral()); | |
3029 | nottriggered->Scale(1.0 / nottriggered->Integral()); | |
3030 | novertex->Scale(1.0 / novertex->Integral()); | |
3031 | highmult->Scale(1.0 / highmult->Integral()); | |
3032 | ||
3033 | new TCanvas; | |
3034 | all->Draw("HIST"); | |
3035 | novertex->SetLineColor(2); | |
3036 | novertex->Draw("HISTSAME"); | |
3037 | highmult->SetLineColor(3); | |
3038 | highmult->Draw("HISTSAME"); | |
3039 | ||
3040 | legend = new TLegend(0.5, 0.5, 0.8, 0.8); | |
3041 | legend->SetFillColor(0); | |
3042 | legend->AddEntry(all, "all"); | |
3043 | legend->AddEntry(novertex, "no vertex"); | |
3044 | legend->AddEntry(highmult, "mult > 10"); | |
3045 | legend->Draw(); | |
3046 | ||
3047 | new TCanvas; | |
3048 | trigger->Scale(1.0 / trigger->Integral()); | |
3049 | vtx->Scale(1.0 / vtx->Integral()); | |
3050 | ||
3051 | trigger->Divide(vtx); | |
3052 | ||
3053 | trigger->Draw(); | |
3054 | //vtx->SetLineColor(2); | |
3055 | //vtx->Draw("SAME"); | |
3056 | ||
3057 | //temphist = dNdEtaCorrection->GetCorrection(AlidNdEtaCorrection::kVertexReco)->GetEventCorrection()->GetMeasuredHistogram(); | |
3058 | temphist = dNdEtaCorrection->GetCorrection(AlidNdEtaCorrection::kINEL)->GetEventCorrection()->GetGeneratedHistogram(); | |
3059 | //temphist = dNdEtaCorrection->GetCorrection(AlidNdEtaCorrection::kINEL)->GetEventCorrection()->GetMeasuredHistogram(); | |
3060 | ||
70fdd197 | 3061 | temphist = (TH2*) gFile->Get("fTemp1"); |
3062 | ||
a7f69e56 | 3063 | new TCanvas; |
3064 | legend = new TLegend(0.7, 0.7, 0.99, 0.99); | |
3065 | legend->SetFillColor(0); | |
3066 | ||
3067 | Bool_t first = kTRUE; | |
3068 | for (Int_t i=0; i<20; i+=5) | |
3069 | { | |
3070 | highmult = temphist->ProjectionX("highmult", i+1, i+1+4); | |
70fdd197 | 3071 | highmult->Rebin(10); |
a7f69e56 | 3072 | Printf("%f", highmult->Integral()); |
3073 | if (highmult->Integral() <= 0) | |
3074 | continue; | |
3075 | ||
3076 | for (Int_t j=1; j<=trigger->GetNbinsX(); j++) | |
3077 | highmult->SetBinContent(j, highmult->GetBinContent(j) / highmult->GetBinWidth(j)); | |
3078 | ||
3079 | highmult->Scale(1.0 / highmult->Integral()); | |
3080 | highmult->SetLineColor((i/5)+1); | |
3081 | highmult->GetYaxis()->SetRangeUser(0, 0.15); | |
3082 | if (first) | |
3083 | { | |
3084 | highmult->DrawCopy(); | |
3085 | first = kFALSE; | |
3086 | } | |
3087 | else | |
3088 | highmult->DrawCopy("SAME"); | |
3089 | legend->AddEntry(highmult->Clone(), Form("%d <= N <= %d", i, i+4)); | |
3090 | } | |
3091 | legend->Draw(); | |
3092 | ||
3093 | } | |
3094 | ||
3095 | void PlotPt1DCorrection() | |
3096 | { | |
3097 | const char* files[] = { "field.root", "field_onlyprim.root", "nofield.root", "nofield_onlyprim.root" }; | |
3098 | const char* names[] = { "B: all", "B: primaries", "No B: all", "No B: primaries" }; | |
3099 | Int_t colors[] = { 1, 2, 3, 4 }; | |
3100 | ||
3101 | loadlibs(); | |
3102 | ||
3103 | dummy = new TH2F("dummy", ";p_{T};correction", 100, 0, 1.4, 100, 0.5, 3); | |
3104 | dummy->SetStats(0); | |
3105 | //dummy->GetYaxis()->SetTitleOffset(1.3); | |
3106 | dummy->Draw(); | |
3107 | ||
3108 | legend = new TLegend(0.48, 0.57, 0.88, 0.88); | |
3109 | legend->SetFillColor(0); | |
3110 | ||
3111 | for (Int_t i=0; i<4; i++) | |
3112 | { | |
3113 | TFile::Open(files[i]); | |
3114 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction"); | |
3115 | if (!dNdEtaCorrection->LoadHistograms()) | |
3116 | return; | |
3117 | ||
3118 | hist = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->Get1DCorrectionHistogram("z", -9.9, 9.9, -0.79, 0.79); | |
3119 | hist->SetLineColor(colors[i]); | |
3120 | hist->SetLineWidth(2); | |
3121 | hist->SetMarkerColor(colors[i]); | |
3122 | hist->Draw("SAME"); | |
3123 | ||
3124 | legend->AddEntry(hist, names[i], "L"); | |
3125 | } | |
3126 | ||
3127 | legend->Draw(); | |
3128 | } | |
1d107532 | 3129 | |
3130 | void FitDiamond() | |
3131 | { | |
3132 | TFile::Open("analysis_esd_raw.root"); | |
3133 | ||
3134 | hist = (TH3*) gFile->Get("vertex_check"); | |
3135 | ||
3136 | gStyle->SetOptFit(1); | |
3137 | ||
3138 | TH1* proj[3]; | |
3139 | proj[0] = hist->ProjectionX(); | |
3140 | proj[1] = hist->ProjectionY(); | |
3141 | proj[2] = hist->ProjectionZ(); | |
3142 | ||
3143 | for (Int_t i=0; i<3; i++) | |
3144 | { | |
3145 | c = new TCanvas; | |
3146 | proj[i]->Draw(); | |
3147 | proj[i]->Fit("gaus"); | |
3148 | ||
3149 | c->SaveAs(Form("FitDiamond_%d.png", i)); | |
3150 | } | |
3151 | } | |
3152 | ||
3153 | void FitDiamondVsMult() | |
3154 | { | |
3155 | TFile::Open("analysis_esd_raw.root"); | |
3156 | ||
3157 | fVertexVsMult = (TH3*) gFile->Get("fVertexVsMult"); | |
3158 | fVertexVsMult->GetZaxis()->SetTitle("multiplicity"); | |
3159 | ||
3160 | TH2* proj[2]; | |
3161 | proj[0] = (TH2*) fVertexVsMult->Project3D("xz"); | |
3162 | proj[1] = (TH2*) fVertexVsMult->Project3D("yz"); | |
3163 | ||
3164 | gStyle->SetPadGridX(kTRUE); | |
3165 | gStyle->SetPadGridY(kTRUE); | |
3166 | ||
12bb57f1 | 3167 | Int_t max = 40; |
1d107532 | 3168 | |
3169 | for (Int_t i=0; i<2; i++) | |
3170 | { | |
3171 | proj[i]->Rebin2D(4, 1); | |
3172 | proj[i]->FitSlicesY(); | |
3173 | ||
3174 | c = new TCanvas(Form("c_%d", i), Form("c_%d", i), 800, 400); | |
3175 | c->Divide(2, 1); | |
3176 | ||
3177 | c->cd(1); | |
3178 | hist = (TH1*) gROOT->FindObject(Form("fVertexVsMult_%sz_1", (i == 0) ? "x" : "y")); | |
3179 | hist->GetXaxis()->SetRangeUser(0, max); | |
3180 | hist->GetYaxis()->SetRangeUser(-0.4, 0.4); | |
3181 | hist->Draw(); | |
3182 | ||
3183 | c->cd(2); | |
3184 | hist = (TH1*) gROOT->FindObject(Form("fVertexVsMult_%sz_2", (i == 0) ? "x" : "y")); | |
3185 | hist->GetXaxis()->SetRangeUser(0, max); | |
3186 | hist->GetYaxis()->SetRangeUser(0, 0.2); | |
3187 | hist->Draw(); | |
3188 | ||
3189 | c->SaveAs(Form("FitDiamondVsMult_%d.png", i)); | |
3190 | } | |
3191 | } | |
3192 | ||
12bb57f1 | 3193 | void CompareQualityHists(const char* fileName1, const char* fileName2, const char* plotName, Int_t rebin1 = 1, Int_t rebin2 = 1, const char* exec = 0) |
1d107532 | 3194 | { |
3195 | file1 = TFile::Open(fileName1); | |
3196 | hist1 = (TH1*) file1->Get(plotName); | |
3197 | ||
3198 | file2 = TFile::Open(fileName2); | |
3199 | hist2 = (TH1*) file2->Get(plotName); | |
3200 | ||
12bb57f1 | 3201 | if (exec) |
3202 | { | |
3203 | hist1 = (TH1*) gROOT->ProcessLine(Form(exec, hist1, "hist1a")); | |
3204 | hist2 = (TH1*) gROOT->ProcessLine(Form(exec, hist2, "hist2a")); | |
3205 | } | |
3206 | ||
3207 | CompareQualityHists(hist1, hist2, rebin1, rebin2); | |
3208 | } | |
3209 | ||
3210 | void CompareQualityHists(TH1* hist1, TH1* hist2, Int_t rebin1 = 1, Int_t rebin2 = 1) | |
3211 | { | |
1d107532 | 3212 | hist1->SetLineColor(1); |
3213 | hist2->SetLineColor(2); | |
3214 | ||
3215 | if (rebin1 != 0 && rebin2 != 0) | |
3216 | { | |
3217 | hist1->Rebin(TMath::Abs(rebin1)); | |
3218 | hist2->Rebin(TMath::Abs(rebin2)); | |
3219 | } | |
3220 | ||
3221 | if (rebin1 > 0 && rebin2 > 0) | |
3222 | { | |
3223 | hist1->Scale(hist2->Integral() / hist1->Integral() / rebin1 * rebin2); | |
3224 | ||
3225 | //hist1->Scale(0.5); | |
3226 | //hist2->Scale(0.5); | |
3227 | } | |
3228 | ||
3229 | c = new TCanvas; | |
12bb57f1 | 3230 | hist1->GetYaxis()->SetRangeUser(0, hist1->GetMaximum() * 1.3); |
1d107532 | 3231 | hist1->DrawCopy(); |
3232 | hist2->DrawCopy("SAME"); | |
12bb57f1 | 3233 | c->SaveAs(Form("%s_1.png", hist1->GetName())); |
1d107532 | 3234 | |
12bb57f1 | 3235 | for (Int_t i=1; i<=hist1->GetNbinsX(); i++) |
3236 | if (hist1->GetBinContent(i) == 0 && hist2->GetBinContent(i) > 0 || hist1->GetBinContent(i) > 0 && hist2->GetBinContent(i) == 0) | |
3237 | Printf("Inconsistent bin %d: %f %f", i, hist1->GetBinContent(i), hist2->GetBinContent(i)); | |
3238 | ||
3239 | if (rebin1 == rebin2) | |
3240 | { | |
3241 | c2 = new TCanvas; | |
3242 | hist1->Divide(hist2); | |
3243 | hist1->DrawCopy(); | |
3244 | c2->SaveAs(Form("%s_2.png", hist1->GetName())); | |
3245 | ||
3246 | for (Int_t i=1; i<=hist1->GetNbinsX(); i++) | |
3247 | if (hist1->GetBinContent(i) > 0.9 && hist1->GetBinContent(i) < 1.1) | |
3248 | hist1->SetBinContent(i, 0); | |
3249 | ||
3250 | new TCanvas; | |
3251 | hist1->SetMarkerStyle(20); | |
3252 | hist1->DrawCopy("P"); | |
3253 | } | |
1d107532 | 3254 | } |
3255 | ||
3256 | void DrawClustersVsTracklets() | |
3257 | { | |
3258 | TFile::Open("analysis_esd_raw.root"); | |
3259 | ||
3260 | hist = (TH2*) gFile->Get("fTrackletsVsClusters"); | |
3261 | ||
3262 | c = new TCanvas("c", "c", 600, 600); | |
3263 | c->SetRightMargin(0.05); | |
3264 | c->SetTopMargin(0.05); | |
3265 | ||
3266 | hist->SetStats(0); | |
3267 | hist->GetYaxis()->SetRangeUser(0, 400); | |
3268 | hist->GetYaxis()->SetTitleOffset(1.3); | |
3269 | hist->GetXaxis()->SetRangeUser(0, 30); | |
3270 | hist->Draw("BOX"); | |
3271 | ||
3272 | func = new TF1("func", "80 + x * 11", 0, 30); | |
3273 | func->Draw("SAME"); | |
3274 | ||
3275 | c->SaveAs("clusters_vs_tracklets.eps"); | |
3276 | } | |
3277 | ||
3278 | void VertexPlotBackgroundNote() | |
3279 | { | |
3280 | TFile::Open("all.root"); | |
3281 | ||
3282 | hist = (TH3*) gFile->Get("vertex_check"); | |
3283 | proj = (TH1*) hist->ProjectionZ()->Clone("all"); | |
3284 | proj->Rebin(2); | |
3285 | ||
3286 | proj->Draw(); | |
3287 | ||
3288 | TFile::Open("analysis_esd_raw.root"); | |
3289 | hist = (TH3*) gFile->Get("vertex_check"); | |
3290 | proj = (TH1*) hist->ProjectionZ()->Clone("afterbg"); | |
3291 | proj->Rebin(2); | |
3292 | ||
3293 | proj->SetLineColor(2); | |
3294 | proj->Draw("SAME"); | |
3295 | ||
3296 | ||
12bb57f1 | 3297 | } |
3298 | ||
3299 | void BackgroundAnalysis(const char* signal, const char* background) | |
3300 | { | |
3301 | TFile::Open(signal); | |
3302 | signalHist = (TH2*) gFile->Get("fTrackletsVsClusters"); | |
3303 | ||
3304 | TFile::Open(background); | |
3305 | backgroundHist = (TH2*) gFile->Get("fTrackletsVsClusters"); | |
3306 | ||
3307 | Printf("For events with >= 1 tracklet:"); | |
3308 | ||
3309 | func = new TF1("func", "[0] + x * 11", 0, 30); | |
3310 | for (Int_t a = 50; a <= 100; a += 10) | |
3311 | { | |
3312 | func->SetParameter(0, a); | |
3313 | ||
3314 | Float_t signalCount = 0; | |
3315 | Float_t backgroundCount = 0; | |
3316 | for (Int_t x = 2; x <= signalHist->GetNbinsX(); x++) | |
3317 | { | |
3318 | signalCount += signalHist->Integral(x, x, signalHist->GetYaxis()->FindBin(func->Eval(signalHist->GetXaxis()->GetBinCenter(x))), signalHist->GetNbinsY()); | |
3319 | backgroundCount += backgroundHist->Integral(x, x, signalHist->GetYaxis()->FindBin(func->Eval(signalHist->GetXaxis()->GetBinCenter(x))), signalHist->GetNbinsY()); | |
3320 | } | |
3321 | ||
3322 | Float_t signalFraction = 100.0 * signalCount / signalHist->Integral(2, signalHist->GetNbinsX(), 1, signalHist->GetNbinsY()); | |
3323 | Float_t backgroundFraction = 100.0 * backgroundCount / backgroundHist->Integral(2, signalHist->GetNbinsX(), 1, signalHist->GetNbinsY()); | |
3324 | ||
3325 | Printf("Cut at a = %d; Removed %.2f %% of the background (%.0f events); Removed %.2f %% of the signal", a, backgroundFraction, backgroundCount, signalFraction); | |
3326 | } | |
3327 | } | |
3328 | ||
3329 | void ZPhiPlots() | |
3330 | { | |
3331 | TFile::Open("analysis_esd_raw.root"); | |
3332 | ||
3333 | for (Int_t i=0; i<2; i++) | |
3334 | { | |
3335 | hist = (TH2*) gFile->Get(Form("fZPhi_%d", i)); | |
3336 | ||
3337 | c = new TCanvas; | |
3338 | hist->SetStats(0); | |
3339 | hist->Draw("COLZ"); | |
3340 | c->SaveAs(Form("ZPhi_%d.png", i)); | |
3341 | } | |
3342 | } | |
3343 | ||
3344 | void DrawStats(Bool_t all = kFALSE) | |
3345 | { | |
3346 | if (all) | |
3347 | { | |
3348 | Int_t count = 4; | |
3349 | const char* list[] = { "CINT1B-ABCE-NOPF-ALL/spd", "CINT1A-ABCE-NOPF-ALL/spd", "CINT1C-ABCE-NOPF-ALL/spd", "CINT1-E-NOPF-ALL/spd" }; | |
3350 | } | |
3351 | else | |
3352 | { | |
3353 | Int_t count = 1; | |
3354 | const char* list[] = { "." }; | |
3355 | } | |
3356 | ||
3357 | for (Int_t i=0; i<count; i++) | |
3358 | { | |
3359 | TFile::Open(Form("%s/analysis_esd_raw.root", list[i])); | |
3360 | ||
3361 | hist = (TH2*) gFile->Get("fStats2"); | |
3362 | ||
3363 | c = new TCanvas(list[i], list[i], 800, 600); | |
3364 | gPad->SetBottomMargin(0.2); | |
3365 | gPad->SetLeftMargin(0.2); | |
3366 | gPad->SetRightMargin(0.2); | |
3367 | hist->Draw("TEXT"); | |
3368 | hist->SetMarkerSize(2); | |
3369 | //hist->GetYaxis()->SetRangeUser(0, 0); | |
3370 | ||
3371 | gROOT->Macro("increaseFonts.C"); | |
3372 | ||
3373 | c->SaveAs(Form("%s/stats.png", list[i])); | |
3374 | } | |
3375 | } |