]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGCF/Correlations/macros/dphicorrelations/correct.C
reverting previous commit, by mistke the patch was committed
[u/mrichter/AliRoot.git] / PWGCF / Correlations / macros / dphicorrelations / correct.C
CommitLineData
3742b71d 1Float_t gpTMin = 0.51;
2Float_t gpTMax = 49.99;
3Int_t gUEHist = 0;
4Bool_t gCache = 0;
5void* gFirst = 0;
6void* gSecond = 0;
7Float_t gForceRange = -1;
8Int_t gEnergy = 900;
9Int_t gRegion = 0;
10const char* gText = "";
11TString Sign[]={"Plus","Minus"};
12enum ECharge_t {
13 kPositive,
14 kNegative,
15 kNCharges
16};
17
18void SetRanges(TAxis* axis)
19{
20 if (strcmp(axis->GetTitle(), "leading p_{T} (GeV/c)") == 0)
21 axis->SetRangeUser(0, (gEnergy == 900) ? 10 : 25);
22
23 if (strcmp(axis->GetTitle(), "multiplicity") == 0)
24 axis->SetRangeUser(0, 10);
25}
26
27void SetRanges(TH1* hist)
28{
29 SetRanges(hist->GetXaxis());
30 SetRanges(hist->GetYaxis());
31 SetRanges(hist->GetZaxis());
32}
33
34void Prepare1DPlot(TH1* hist)
35{
36 if (!hist)
37 return;
38
39 hist->SetLineWidth(2);
40 hist->SetStats(kFALSE);
41
42 hist->GetXaxis()->SetLabelOffset(0.02);
43 hist->GetXaxis()->SetTitleOffset(1.3);
44 hist->GetYaxis()->SetTitleOffset(1.3);
45
46 SetRanges(hist);
47}
48
49TH1* GetSystematicUncertainty(TH1* corr, TH1* trackHist)
50{
51 if (!trackHist)
52 {
53 systError = (TH1*) corr->Clone("systError");
54 systError->Reset();
55 }
56 else // for dphi evaluation
57 systError = new TH1F("systError", "", 100, 0, 50);
58
59 Float_t constantUnc = 0;
60
61 // particle composition
62 constantUnc += 0.8 ** 2;
63
64 // tpc efficiency
65 if (gEnergy == 900 && gpTMin < 1.0)
66 constantUnc += 1.0 ** 2;
67 else if (gEnergy == 900 && gpTMin < 1.5)
68 constantUnc += 0.5 ** 2;
69 if (gEnergy == 7000 && gpTMin < 1.0)
70 constantUnc += 1.0 ** 2;
71 else if (gEnergy == 7000 && gpTMin < 1.5)
72 constantUnc += 0.6 ** 2;
73
74 // track cuts
75 if (gEnergy == 900 && gpTMin < 1.0)
76 constantUnc += 2.5 ** 2;
77 else if (gEnergy == 900 && gpTMin < 1.5)
78 constantUnc += 2.0 ** 2;
79 if (gEnergy == 7000)
80 constantUnc += 3.0 ** 2;
81
82 // difference corrected with pythia and phojet
83 if (gEnergy == 900 && gpTMin < 1.0)
84 constantUnc += 0.6 ** 2;
85 else if (gEnergy == 900 && gpTMin < 1.5)
86 constantUnc += 0.8 ** 2;
87
88 if (gEnergy == 7000 && gpTMin < 1.0)
89 {
90 if (gUEHist == 0)
91 constantUnc += 0.6 ** 2;
92 if (gUEHist == 1)
93 constantUnc += 0.8 ** 2;
94 if (gUEHist == 2)
95 constantUnc += 1.0 ** 2;
96 }
97 else if (gEnergy == 7000 && gpTMin < 1.5)
98 constantUnc += 1.0 ** 2;
99
100 for (Int_t bin=1; bin<=systError->GetNbinsX(); bin++)
101 systError->SetBinContent(bin, constantUnc);
102
103 // mis id bias
104 if (gUEHist == 0 || gUEHist == 2)
105 systError->Fill(0.75, 4.0 ** 2);
106 if (gUEHist == 1)
107 systError->Fill(0.75, 5.0 ** 2);
108
109 if (gEnergy == 900)
110 {
111 if (gpTMin < 1.0)
112 systError->Fill(1.25, 1.0 ** 2);
113 else if (gpTMin < 1.5)
114 systError->Fill(1.25, 2.0 ** 2);
115 }
116
117 // non-closure in MC
118 if (gEnergy == 900)
119 for (Int_t bin=1; bin<=systError->GetNbinsX(); bin++)
120 systError->Fill(systError->GetXaxis()->GetBinCenter(bin), 1.0 ** 2);
121
122 if (gEnergy == 7000)
123 {
124 if (gUEHist == 0 && gUEHist == 1)
125 systError->Fill(0.75, 2.0 ** 2);
126 if (gUEHist == 2)
127 systError->Fill(0.75, 1.2 ** 2);
128 }
129
130 // vertex efficiency
131 systError->Fill(0.75, 1.0 ** 2);
132
133 // strangeness
134 for (Int_t bin=1; bin<=systError->GetNbinsX(); bin++)
135 {
136 if (gEnergy == 900)
137 systError->Fill(systError->GetXaxis()->GetBinCenter(bin), 0.5 ** 2);
138 if (gEnergy == 7000 && systError->GetXaxis()->GetBinCenter(bin) < 1.5)
139 systError->Fill(systError->GetXaxis()->GetBinCenter(bin), 2.0 ** 2);
140 else if (gEnergy == 7000)
141 systError->Fill(systError->GetXaxis()->GetBinCenter(bin), 1.0 ** 2);
142 }
143
144 for (Int_t bin=1; bin<=systError->GetNbinsX(); bin++)
145 systError->SetBinContent(bin, TMath::Sqrt(systError->GetBinContent(bin)));
146
147 if (trackHist)
148 {
149 //new TCanvas; trackHist->Draw();
150 //new TCanvas; systError->DrawCopy("");
151
152 Float_t uncFlat = 0;
153 for (Int_t i=1; i<=trackHist->GetNbinsX(); i++)
154 uncFlat += trackHist->GetBinContent(i) * systError->GetBinContent(systError->FindBin(trackHist->GetBinCenter(i)));
155 if (trackHist->Integral() > 0)
156 uncFlat /= trackHist->Integral();
157
158 systError = (TH1F*) corr->Clone("systError");
159 systError->Reset();
160
161 for (Int_t i=1; i<=systError->GetNbinsX(); i++)
162 systError->SetBinContent(i, uncFlat);
163
164 //new TCanvas; systError->DrawCopy("");
165 }
166
167 systError->SetFillColor(kGray);
168 systError->SetFillStyle(1001);
169 systError->SetMarkerStyle(0);
170 systError->SetLineColor(0);
171
172 return systError;
173}
174
175void DrawRatio(TH1* corr, TH1* mc, const char* name, TH1* syst = 0)
176{
177 mc->SetLineColor(2);
178
179 TCanvas* canvas3 = new TCanvas(name, name, 600, 600);
180 canvas3->Range(0, 0, 1, 1);
181
182 TPad* pad1 = new TPad(Form("%s_1", name), "", 0, 0.5, 0.98, 0.98);
183 pad1->Draw();
184
185 TPad* pad2 = new TPad(Form("%s_2", name), "", 0, 0.02, 0.98, 0.5);
186 pad2->Draw();
187
188 pad1->SetRightMargin(0.01);
189 pad2->SetRightMargin(0.01);
190 pad1->SetTopMargin(0.05);
191 pad1->SetLeftMargin(0.13);
192 pad2->SetLeftMargin(0.13);
193 pad2->SetBottomMargin(0.22);
194
195 // no border between them
196 pad1->SetBottomMargin(0);
197 pad2->SetTopMargin(0);
198
199 pad1->cd();
200 pad1->SetGridx();
201 pad1->SetGridy();
202
203 if (gUEHist != 2)
204 TLegend* legend = new TLegend(0.15, 0.65, 0.55, 0.90);
205 else
206 TLegend* legend = new TLegend(0.55, 0.65, 0.95, 0.90);
207
208 legend->SetFillColor(0);
209 legend->AddEntry(corr, "Corrected");
210 legend->AddEntry(mc, "MC prediction");
211 legend->SetTextSize(0.08);
212
213 Prepare1DPlot(corr);
214
215 TH2F* dummy = new TH2F("dummy", "", 100, corr->GetXaxis()->GetBinLowEdge(1), corr->GetXaxis()->GetBinUpEdge(corr->GetNbinsX()), 1000, 0, TMath::Max(corr->GetMaximum(), mc->GetMaximum()) * 1.1);
216 dummy->SetYTitle(corr->GetYaxis()->GetTitle());
217
218 //dummy = new TH2F("dummy", "", 100, corr->GetXaxis()->GetBinLowEdge(1), corr->GetXaxis()->GetBinUpEdge(corr->GetNbinsX()), 1000, 13.5, 20.5);
219 //dummy->SetYTitle("1/N_{trig} dN/d#Delta#phi");
220
221 dummy->SetStats(kFALSE);
222 dummy->SetXTitle(corr->GetXaxis()->GetTitle());
223 dummy->GetYaxis()->SetTitleOffset(1);
224 Prepare1DPlot(dummy);
225
226 dummy->GetXaxis()->SetLabelSize(0.08);
227 dummy->GetYaxis()->SetLabelSize(0.08);
228 dummy->GetXaxis()->SetTitleSize(0.08);
229 dummy->GetYaxis()->SetTitleSize(0.08);
230 dummy->GetYaxis()->SetTitleOffset(0.8);
231
232 if (gForceRange > 0)
233 dummy->GetYaxis()->SetRangeUser(0, gForceRange);
234
235 dummy->DrawCopy();
236
237 if (0 && gUEHist != 2)
238 {
239 const char* regionStr[] = { "Toward Region", "Away Region", "Transverse Region" };
240 latex = new TLatex(0.65, 0.1, regionStr[gRegion]);
241 latex->SetTextSize(0.075);
242 latex->SetNDC();
243 latex->Draw();
244 }
245
246 if (syst)
247 {
248 systError = (TH1*) syst->Clone("corrSystError");
249 for (Int_t bin=1; bin<=systError->GetNbinsX(); bin++)
250 {
251 systError->SetBinError(bin, corr->GetBinContent(bin) * syst->GetBinContent(bin) / 100);
252 systError->SetBinContent(bin, corr->GetBinContent(bin));
253 }
254
255 systError->Draw("E2 ][ SAME");
256 }
257
258 corr->Draw("SAME");
259 mc->Draw("SAME");
260
261 if (strlen(gText) > 0)
262 {
263 latex = new TLatex(0.2, 0.2, gText);
264 latex->SetNDC();
265 latex->SetTextSize(0.06);
266 latex->Draw();
267 }
268
269 //legend->Draw();
270
271 pad2->cd();
272 //pad2->SetBottomMargin(0.15);
273 //pad2->SetGridx();
274 //pad2->SetGridy();
275
276 TH1* ratio = (TH1*) mc->Clone("ratio");
277 ratio->Divide(corr);
278
279 Float_t minR = TMath::Min(0.91, ratio->GetMinimum() * 0.95);
280 Float_t maxR = TMath::Max(1.09, ratio->GetMaximum() * 1.05);
281
282 minR = 0.8;
283 maxR = 1.2;
284
285 TH1F dummy3("dummy3", ";;Ratio: MC / corr", 100, corr->GetXaxis()->GetBinLowEdge(1), corr->GetXaxis()->GetBinUpEdge(corr->GetNbinsX()));
286 dummy3.SetXTitle(corr->GetXaxis()->GetTitle());
287 Prepare1DPlot(&dummy3);
288 dummy3.SetStats(kFALSE);
289 for (Int_t i=1; i<=100; ++i)
290 dummy3.SetBinContent(i, 1);
291 dummy3.GetYaxis()->SetRangeUser(minR, maxR);
292 dummy3.SetLineWidth(2);
293 dummy3.GetXaxis()->SetLabelSize(0.08);
294 dummy3.GetYaxis()->SetLabelSize(0.08);
295 dummy3.GetXaxis()->SetTitleSize(0.08);
296 dummy3.GetYaxis()->SetTitleSize(0.08);
297 dummy3.GetYaxis()->SetTitleOffset(0.8);
298 dummy3.DrawCopy();
299
300 if (syst)
301 {
302 // for the ratio add in quadrature
303 for (Int_t bin=1; bin<=syst->GetNbinsX(); bin++)
304 {
305 if (corr->GetBinError(bin) > 0)
306 syst->SetBinError(bin, TMath::Sqrt(TMath::Power(syst->GetBinContent(bin) / 100, 2) + TMath::Power(corr->GetBinError(bin) / corr->GetBinContent(bin), 2)));
307 else
308 syst->SetBinError(bin, 0);
309 syst->SetBinContent(bin, 1);
310 }
311
312 syst->Draw("E2 ][ SAME");
313 dummy3.DrawCopy("SAME");
314 }
315
316 ratio->Draw("SAME");
317
318 ratio->Fit("pol0", "N");
319
320 canvas3->Modified();
321 //canvas3->SaveAs(Form("%s.eps", canvas3->GetTitle()));
322}
323
324void loadlibs()
325{
326 gSystem->Load("libANALYSIS");
327 gSystem->Load("libANALYSISalice");
328 gSystem->Load("libCORRFW");
329 gSystem->Load("libPWGTools");
330 gSystem->Load("libPWGCFCorrelationsBase");
331}
332
333const char* lastFileName = 0;
334void* cacheSameEvent = 0;
335void* cacheMixedEvent = 0;
336
337void* GetUEHistogram(const char* fileName, TList** listRef = 0, Bool_t mixed = kFALSE, const char* tag = "")
338{
339 if (!lastFileName || strcmp(lastFileName, fileName) != 0)
340 {
341 lastFileName = fileName;
342 file = TFile::Open(fileName);
343 if (!file)
344 return 0;
345
346 list = (TList*) gFile->Get("PWG4_LeadingTrackUE/histosLeadingTrackUE");
347 if (!list)
348 list = (TList*) gFile->Get(Form("PWG4_PhiCorrelations/histosPhiCorrelations%s", tag));
349 if (!list)
350 list = (TList*) gFile->Get("PWG4_PhiCorrelations/histosPhiCorrelations_Syst");
351
352 if (!list)
353 return 0;
354
355 if (listRef)
356 *listRef = list;
357
358 cacheMixedEvent = list->FindObject("AliUEHistogramsMixed");
359 cacheSameEvent = list->FindObject("AliUEHistogramsSame");
360
361 if (mixed)
362 return cacheMixedEvent;
363
364 if (list->FindObject("AliUEHistograms"))
365 return list->FindObject("AliUEHistograms");
366
367 return cacheSameEvent;
368 }
369 else
370 {
371 Printf("GetUEHistogram --> Using cache for %s", fileName);
372
373 if (mixed)
374 return cacheMixedEvent;
375 else
376 return cacheSameEvent;
377 }
378}
379
380void CompareBias(const char* mcFile = "PWG4_JetTasksOutput.root", Int_t region, Int_t ueHist)
381{
382 loadlibs();
383
384 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(mcFile);
385 SetupRanges(h);
386
387 const char* axis = "z";
388 Float_t ptLeadMin = 0;
389 Float_t ptLeadMax = -1;
390
391 if (ueHist == 2)
392 {
393 ptLeadMin = 0.51 + 0;
394 ptLeadMax = 1.99 + 0;
395 axis = "y";
396 }
397
398 biasFromData = (TH1*) h->GetUEHist(ueHist)->GetBias(AliUEHist::kCFStepBiasStudy, AliUEHist::kCFStepReconstructed, region, axis, ptLeadMin, ptLeadMax)->Clone("biasFromData");
399 biasFromData2 = (TH1*) h->GetUEHist(ueHist)->GetBias(AliUEHist::kCFStepBiasStudy2, AliUEHist::kCFStepReconstructed, region, axis, ptLeadMin, ptLeadMax)->Clone("biasFromData2");
400 //biasFromData = (TH1*) h->GetUEHist(ueHist)->GetBias(AliUEHist::kCFStepReconstructed, AliUEHist::kCFStepRealLeading, region, axis)->Clone("biasFromData");
401 biasFromMC = (TH1*) h->GetUEHist(ueHist)->GetBias(AliUEHist::kCFStepReconstructed, AliUEHist::kCFStepTracked, region, axis, ptLeadMin, ptLeadMax)->Clone("biasFromMC");
402 //biasFromMC = (TH1*) h->GetUEHist(ueHist)->GetBias(AliUEHist::kCFStepReconstructed, AliUEHist::kCFStepRealLeading, region, axis)->Clone("biasFromMC");
403
404/* biasFromData->Draw();
405 biasFromMC->SetLineColor(2);
406 biasFromMC->Draw("SAME");
407 return;*/
408
409 DrawRatio(biasFromData, biasFromMC, "bias: data vs MC");
410 DrawRatio(biasFromData, biasFromData2, "bias: data vs data two step");
411}
412
413void CompareBiasWithData(const char* mcFile = "PWG4_JetTasksOutput.root", const char* dataFile = "esd.root", Int_t region = 2)
414{
415 loadlibs();
416
417 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(mcFile);
418 SetupRanges(h);
419
420 biasFromMC = (TH1*) h->GetNumberDensitypT()->GetBias(AliUEHist::kCFStepReconstructed, AliUEHist::kCFStepTracked, region, "z")->Clone("biasFromMC");
421
422 AliUEHistograms* h2 = (AliUEHistograms*) GetUEHistogram(dataFile);
423 SetupRanges(h2);
424
425 biasFromData = (TH1*) h2->GetNumberDensitypT()->GetBias(AliUEHist::kCFStepBiasStudy, AliUEHist::kCFStepReconstructed, region, "z")->Clone("biasFromData");
426 biasFromData2 = (TH1*) h2->GetNumberDensitypT()->GetBias(AliUEHist::kCFStepBiasStudy2, AliUEHist::kCFStepReconstructed, region, "z")->Clone("biasFromData2");
427
428 DrawRatio(biasFromData, biasFromMC, "bias: data vs MC");
429 DrawRatio(biasFromData, biasFromData2, "bias: data vs data two step");
430}
431
432Int_t count = 0;
433
434void Compare(const char* fileName1, const char* fileName2, Int_t id, Int_t step1, Int_t step2, Int_t region, Float_t ptLeadMin = -1, Float_t ptLeadMax = -1, Int_t centralityBegin = 0, Int_t centralityEnd = -1)
435{
436 loadlibs();
437
438 if (!gCache || !gFirst)
439 {
440 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName1);
441 AliUEHistograms* h2 = (AliUEHistograms*) GetUEHistogram(fileName2);
442 }
443
444 if (gCache)
445 {
446 if (!gFirst)
447 {
448 gFirst = h;
449 gSecond = h2;
450 }
451 else
452 {
453 AliUEHistograms* h = (AliUEHistograms*) gFirst;
454 AliUEHistograms* h2 = (AliUEHistograms*) gSecond;
455 }
456 }
457
458 SetupRanges(h);
459 SetupRanges(h2);
460
461 TH1* hist1 = h->GetUEHist(id)->GetUEHist(step1, region, ptLeadMin, ptLeadMax, centralityBegin, centralityEnd);
462 //TH1* hist1 = h->GetUEHist(id)->GetUEHist(step1, region, ptLeadMin, ptLeadMax);
463 TH1* hist2 = h2->GetUEHist(id)->GetUEHist(step2, region, ptLeadMin, ptLeadMax, centralityBegin, centralityEnd);
464
465 //hist1->Scale(1.0 / hist1->Integral());
466 //hist2->Scale(1.0 / hist2->Integral());
467
468 TH1* trackHist = 0;
469 if (id == 2)
470 {
471 trackHist = h->GetUEHist(id)->GetTrackHist(region)->ShowProjection(2, 0);
472 // only keep bins under consideration
473 for (Int_t bin=1; bin<=trackHist->GetNbinsX(); bin++)
474 if (bin < trackHist->FindBin(ptLeadMin) || bin > trackHist->FindBin(ptLeadMax))
475 trackHist->SetBinContent(bin, 0);
476 }
477
478 // systematic uncertainty
479 TH1* syst = 0; //GetSystematicUncertainty(hist1, trackHist);
480
481 DrawRatio(hist1, hist2, Form("%d_%s_%d_%d_%d_%.2f_%.2f", count++, TString(gSystem->BaseName(fileName1)).Tokenize(".")->First()->GetName(), id, step1, region, ptLeadMin, ptLeadMax), syst);
482}
483
484void CompareEventHist(const char* fileName1, const char* fileName2, Int_t id, Int_t step, Int_t var)
485{
486 loadlibs();
487
488 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName1);
489 SetupRanges(h);
490
491 AliUEHistograms* h2 = (AliUEHistograms*) GetUEHistogram(fileName2);
492 SetupRanges(h2);
493
494 TH1* hist1 = h->GetUEHist(id)->GetEventHist()->ShowProjection(var, step);
495 TH1* hist2 = h2->GetUEHist(id)->GetEventHist()->ShowProjection(var, step);
496
497 DrawRatio(hist1, hist2, "compare");
498}
499
500void CompareEventHist(const char* fileName1, const char* fileName2, Int_t id, Int_t step1, Int_t step2, Int_t var)
501{
502 loadlibs();
503
504 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName1);
505 SetupRanges(h);
506
507 AliUEHistograms* h2 = (AliUEHistograms*) GetUEHistogram(fileName2);
508 SetupRanges(h2);
509
510// h->GetUEHist(id)->GetEventHist()->GetGrid(step1)->GetGrid()->GetAxis(1)->SetRange(1, 5);
511// h2->GetUEHist(id)->GetEventHist()->GetGrid(step2)->GetGrid()->GetAxis(1)->SetRange(1, 5);
512
513 TH1* hist1 = h->GetUEHist(id)->GetEventHist()->ShowProjection(var, step1);
514 TH1* hist2 = h2->GetUEHist(id)->GetEventHist()->ShowProjection(var, step2);
515
516 DrawRatio(hist1, hist2, "compare");
517}
518
519void CompareStep(const char* fileName1, const char* fileName2, Int_t id, Int_t step, Int_t region, Float_t ptLeadMin = -1, Float_t ptLeadMax = -1)
520{
521 // fileName1 is labelled Corrected in the plot
522
523 loadlibs();
524
525 gUEHist = id;
526 gRegion = region;
527 Compare(fileName1, fileName2, id, step, step, region, ptLeadMin, ptLeadMax);
528}
529
530void CompareStep(const char* fileName1, const char* fileName2, Int_t id, Int_t step1, Int_t step2, Int_t region, Float_t ptLeadMin = -1, Float_t ptLeadMax = -1, Int_t centralityBegin = 0, Int_t centralityEnd = -1)
531{
532 // fileName1 is labelled Corrected in the plot
533
534 loadlibs();
535
536 gUEHist = id;
537 gRegion = region;
538 Compare(fileName1, fileName2, id, step1, step2, region, ptLeadMin, ptLeadMax, centralityBegin, centralityEnd);
539}
540
541TH1* DrawStep(const char* fileName, Int_t id, Int_t step, Int_t region, Float_t ptLeadMin = -1, Float_t ptLeadMax = -1, Int_t centralityBegin = 0, Int_t centralityEnd = -1, Int_t twoD = 0, Bool_t mixed = kFALSE)
542{
543 loadlibs();
544
545 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName, 0, mixed);
546 SetupRanges(h);
547
548 new TCanvas;
549 return h->GetUEHist(id)->GetUEHist(step, region, ptLeadMin, ptLeadMax, centralityBegin, centralityEnd, twoD)->DrawCopy();
550}
551
552void DrawProjectionsRidge(const char* fileName, const char* fileNamePbPbMix = 0)
553{
554 if (!fileNamePbPbMix)
555 fileNamePbPbMix = fileName;
556
557 gpTMin = 1.01;
558 gpTMax = 2.99;
559
560 loadlibs();
561
562 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
563 hMixed = (AliUEHistograms*) GetUEHistogram(fileNamePbPbMix, 0, kTRUE);
564
565 SetupRanges(h);
566 SetupRanges(hMixed);
567
568 TH1* hist1 = 0;
569 GetDistAndFlow(h, hMixed, &hist1, 0, 8, 0, 100, 3.01, 3.99, 1, kTRUE, 0, kTRUE);
570
571// ((TH2*) hist1)->Rebin2D(2, 2); hist1->Scale(0.25);
572
573// NormalizeToBinWidth(hist1);
574
575 proj1y = ((TH2*) hist1)->ProjectionY("proj1y", hist1->GetXaxis()->FindBin(-0.5), hist1->GetXaxis()->FindBin(0.5));
576 proj1x = ((TH2*) hist1)->ProjectionX("proj1x", hist1->GetYaxis()->FindBin(-1.79), hist1->GetYaxis()->FindBin(1.79));
577
578 proj1y->Scale(1.0 / (hist1->GetXaxis()->FindBin(0.5) - hist1->GetXaxis()->FindBin(-0.5) + 1));
579 proj1x->Scale(1.0 / (hist1->GetYaxis()->FindBin(1.79) - hist1->GetYaxis()->FindBin(-1.79) + 1));
580
581 proj1y->GetXaxis()->SetTitleOffset(1);
582 proj1x->GetXaxis()->SetTitleOffset(1);
583
584 Float_t zyam = proj1x->GetBinContent(proj1x->GetXaxis()->FindBin(TMath::Pi()/2));
585 proj1x->Add(new TF1("func", "-1", -100, 100), zyam);
586 proj1y->Add(new TF1("func", "-1", -100, 100), zyam);
587
588 new TCanvas("c", "c", 800, 800);
589 gPad->SetLeftMargin(0.15);
590 hist1->SetTitle("");
591 hist1->GetYaxis()->SetRangeUser(-1.79, 1.79);
592 hist1->GetXaxis()->SetTitleOffset(1.5);
593 hist1->GetYaxis()->SetTitleOffset(2);
594 hist1->SetStats(kFALSE);
595 hist1->DrawCopy("SURF1");
596
597// new TCanvas; proj1y->Draw(); new TCanvas; proj1x->Draw(); return;
598
599 TH1* hist2 = 0;
600 GetDistAndFlow(h, hMixed, &hist2, 0, 8, 40, 100, 4.01, 5.99, 1, kTRUE, 0, kTRUE);
601
602// ((TH2*) hist2)->Rebin2D(2, 2); hist2->Scale(0.25);
603// NormalizeToBinWidth(hist2);
604
605 proj2y = ((TH2*) hist2)->ProjectionY("proj2y", hist1->GetXaxis()->FindBin(-0.5), hist1->GetXaxis()->FindBin(0.5));
606 proj2x = ((TH2*) hist2)->ProjectionX("proj2x", hist1->GetYaxis()->FindBin(-1.79), hist1->GetYaxis()->FindBin(1.79));
607
608 proj2y->Scale(1.0 / (hist1->GetXaxis()->FindBin(0.5) - hist1->GetXaxis()->FindBin(-0.5) + 1));
609 proj2x->Scale(1.0 / (hist1->GetYaxis()->FindBin(1.79) - hist1->GetYaxis()->FindBin(-1.79) + 1));
610
611 zyam = proj2x->GetBinContent(proj2x->GetXaxis()->FindBin(TMath::Pi()/2));
612 proj2x->Add(new TF1("func", "-1", -100, 100), zyam);
613 proj2y->Add(new TF1("func", "-1", -100, 100), zyam);
614
615 proj2y->SetLineColor(2); proj2x->SetLineColor(2);
616
617 new TCanvas; proj1y->Draw(); proj2y->Draw("SAME");
618 new TCanvas; proj1x->Draw(); proj2x->Draw("SAME");
619
620 new TCanvas("c2", "c2", 800, 800);
621 gPad->SetLeftMargin(0.15);
622 hist2->SetTitle("");
623 hist2->GetYaxis()->SetRangeUser(-1.79, 1.79);
624 hist2->GetXaxis()->SetTitleOffset(1.5);
625 hist2->GetYaxis()->SetTitleOffset(2);
626 hist2->SetStats(kFALSE);
627 hist2->DrawCopy("SURF1");
628}
629
630void DrawExample(const char* fileName, const char* fileNamePbPbMix = 0)
631{
632 if (!fileNamePbPbMix)
633 fileNamePbPbMix = fileName;
634
635 gpTMin = 1.01;
636 gpTMax = 1.99;
637
638 loadlibs();
639
640 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
641 hMixed = (AliUEHistograms*) GetUEHistogram(fileNamePbPbMix, 0, kTRUE);
642
643 SetupRanges(h);
644 SetupRanges(hMixed);
645
646 TH1* hist1 = 0;
647 GetDistAndFlow(h, hMixed, &hist1, 0, 8, 0, 40, 1.01, 1.99, 1, kTRUE, 0, kTRUE);
648
649 ((TH2*) hist1)->Rebin2D(2, 2);
650 hist1->Scale(0.25);
651
652// NormalizeToBinWidth(hist1);
653
654 new TCanvas("c", "c", 800, 800);
655 gPad->SetLeftMargin(0.15);
656 hist1->SetTitle("");
657 hist1->GetYaxis()->SetRangeUser(-1.79, 1.79);
658 hist1->GetXaxis()->SetTitleOffset(1.5);
659 hist1->GetYaxis()->SetTitleOffset(2);
660 hist1->SetStats(kFALSE);
661 hist1->DrawCopy("SURF1");
662
663 TH1* hist2 = 0;
664 GetDistAndFlow(h, hMixed, &hist2, 0, 8, 40, 100, 1.01, 1.99, 1, kTRUE, 0, kTRUE);
665
666 ((TH2*) hist2)->Rebin2D(2, 2); hist2->Scale(0.25);
667
668// NormalizeToBinWidth(hist1);
669
670 new TCanvas("c2", "c2", 800, 800);
671 gPad->SetLeftMargin(0.15);
672 hist2->SetTitle("");
673 hist2->GetYaxis()->SetRangeUser(-1.79, 1.79);
674 hist2->GetXaxis()->SetTitleOffset(1.5);
675 hist2->GetYaxis()->SetTitleOffset(2);
676 hist2->SetStats(kFALSE);
677 hist2->DrawCopy("SURF1");
678
679
680
681 return;
682
683 hist2 = hist1;
684 /*
685 GetDistAndFlow(h, hMixed, &hist1, 0, 0, 0, 10, 2.01, 3.99, 1, kTRUE, 0, kTRUE);
686
687 ((TH2*) hist1)->Rebin2D(2, 2);
688// NormalizeToBinWidth(hist1);
689
690 new TCanvas("c2", "c2", 800, 800);
691 gPad->SetLeftMargin(0.15);
692 hist1->SetTitle("");
693 hist1->GetYaxis()->SetRangeUser(-1.79, 1.79);
694 hist1->GetXaxis()->SetTitleOffset(1.5);
695 hist1->GetYaxis()->SetTitleOffset(2);
696 hist1->SetStats(kFALSE);
697 hist1->DrawCopy("SURF1");
698
699 hist1->Divide(hist2);
700
701 new TCanvas("c5", "c5", 800, 800);
702 gPad->SetLeftMargin(0.15);
703 hist1->SetTitle("");
704 hist1->GetYaxis()->SetRangeUser(-1.79, 1.79);
705 hist1->GetXaxis()->SetTitleOffset(1.5);
706 hist1->GetYaxis()->SetTitleOffset(2);
707 hist1->SetStats(kFALSE);
708 hist1->DrawCopy("SURF1");
709
710 return;
711
712 GetDistAndFlow(h, hMixed, &hist1, 0, 6, 0, 10, 2.01, 3.99, 1, kTRUE, 0, kTRUE, 6);
713
714 ((TH2*) hist1)->Rebin2D(2, 2);
715// NormalizeToBinWidth(hist1);
716
717 new TCanvas("c3", "c3", 800, 800);
718 gPad->SetLeftMargin(0.15);
719 hist1->SetTitle("");
720 hist1->GetYaxis()->SetRangeUser(-1.79, 1.79);
721 hist1->GetXaxis()->SetTitleOffset(1.5);
722 hist1->GetYaxis()->SetTitleOffset(2);
723 hist1->SetStats(kFALSE);
724 hist1->DrawCopy("SURF1");
725
726// return;
727
728// TH1* hist1 = 0;
729// GetDistAndFlow(h, hMixed, &hist1, 0, 4, 0, 10, 2.01, 3.99, 1, kTRUE, 0, kTRUE, 6);
730//
731// ((TH2*) hist1)->Rebin2D(2, 2);
732// // hist1->Scale(0.25);
733//
734// // NormalizeToBinWidth(hist1);
735//
736// new TCanvas("c1b", "c1b", 800, 800);
737// gPad->SetLeftMargin(0.15);
738// hist1->SetTitle("");
739// hist1->GetYaxis()->SetRangeUser(-1.79, 1.79);
740// hist1->GetXaxis()->SetTitleOffset(1.5);
741// hist1->GetYaxis()->SetTitleOffset(2);
742// hist1->SetStats(kFALSE);
743// hist1->DrawCopy("SURF1");
744// hist2 = hist1;
745
746// return;
747
748// GetDistAndFlow(h, 0, &hist1, 0, 8, 0, 10, 2.01, 3.99, 1, kTRUE, 0, kTRUE);
749//
750// NormalizeToBinWidth(hist1);
751// //
752// for (Int_t i=1; i<=hist1->GetNbinsX(); ++i)
753// {
754// for (Int_t j=1; j<=hist1->GetNbinsY(); ++j)
755// {
756// Float_t factor = 1.0 / (2.0 - TMath::Abs(hist1->GetYaxis()->GetBinCenter(j)));
757// hist1->SetBinContent(i, j, hist1->GetBinContent(i, j) * factor);
758// hist1->SetBinError(i, j, hist1->GetBinError(i, j) * factor);
759// }
760// }
761
762/* new TCanvas("c4", "c4", 800, 800);
763 gPad->SetLeftMargin(0.15);
764 hist1->SetTitle("");
765 hist1->GetYaxis()->SetRangeUser(-1.79, 1.79);
766 hist1->GetXaxis()->SetTitleOffset(1.5);
767 hist1->GetYaxis()->SetTitleOffset(2);
768 hist1->SetStats(kFALSE);
769 hist1->DrawCopy("SURF1"); */
770
771 AliUEHistograms* h2 = (AliUEHistograms*) GetUEHistogram("corrected.root");
772 AliUEHistograms* h2Mixed = (AliUEHistograms*) GetUEHistogram("corrected.root", 0, kTRUE);
773 SetupRanges(h2);
774 SetupRanges(h2Mixed);
775
776 GetDistAndFlow(h2, h2Mixed, &hist1, 0, 8, 0, 10, 2.01, 3.99, 1, kTRUE, 0, kTRUE);
777 ((TH2*) hist1)->Rebin2D(2, 2);
778
779 new TCanvas("c4", "c4", 800, 800);
780 gPad->SetLeftMargin(0.15);
781 hist1->SetTitle("");
782 hist1->GetYaxis()->SetRangeUser(-1.79, 1.79);
783 hist1->GetXaxis()->SetTitleOffset(1.5);
784 hist1->GetYaxis()->SetTitleOffset(2);
785 hist1->SetStats(kFALSE);
786 hist1->DrawCopy("SURF1");
787
788 hist1->Divide(hist2);
789
790 new TCanvas("c5", "c5", 800, 800);
791 gPad->SetLeftMargin(0.15);
792 hist1->SetTitle("");
793 hist1->GetYaxis()->SetRangeUser(-1.79, 1.79);
794 hist1->GetXaxis()->SetTitleOffset(1.5);
795 hist1->GetYaxis()->SetTitleOffset(2);
796 hist1->SetStats(kFALSE);
797 hist1->DrawCopy("SURF1");
798
799// hist1->Divide(histMixed);
800
801// NormalizeToBinWidth(hist1);
802// //
803// for (Int_t i=1; i<=hist1->GetNbinsX(); ++i)
804// {
805// for (Int_t j=1; j<=hist1->GetNbinsY(); ++j)
806// {
807// Float_t factor = 1.0 / (2.0 - TMath::Abs(hist1->GetYaxis()->GetBinCenter(j)));
808// hist1->SetBinContent(i, j, hist1->GetBinContent(i, j) * factor);
809// hist1->SetBinError(i, j
810// }, hist1->GetBinError(i, j) * factor);
811// }
812
813// new TCanvas("c6", "c6", 800, 800);
814// gPad->SetLeftMargin(0.15);
815// hist1->SetTitle("");
816// hist1->GetYaxis()->SetRangeUser(-1.79, 1.79);
817// hist1->GetXaxis()->SetTitleOffset(1.5);
818// hist1->GetYaxis()->SetTitleOffset(2);
819// hist1->SetStats(kFALSE);
820// hist1->DrawCopy("SURF1");
821
822 return;
823
824 GetSumOfRatios(h, hMixed, &hist1, 6, 60, 90, 8.01, 9.99, kTRUE);
825 new TCanvas("c2", "c2", 800, 800);
826 gPad->SetLeftMargin(0.15);
827 hist1->SetTitle("");
828 hist1->GetYaxis()->SetRangeUser(-1.79, 1.79);
829 hist1->GetXaxis()->SetTitleOffset(1.5);
830 hist1->GetYaxis()->SetTitleOffset(2);
831 hist1->SetStats(kFALSE);
832 hist1->Draw("SURF1");
833
834 return;
835
836 latex = new TLatex(0.82, 0.74, "ALICE performance");
837 latex->SetTextSize(0.02);
838 latex->SetTextAlign(22);
839 latex->SetNDC();
840 latex->Draw();
841 latex = new TLatex(0.82, 0.72, "Pb-Pb 2.76 TeV");
842 latex->SetTextSize(0.02);
843 latex->SetTextAlign(22);
844 latex->SetNDC();
845 latex->Draw();
846 latex = new TLatex(0.82, 0.70, "28.09.11");
847 latex->SetTextSize(0.02);
848 latex->SetTextAlign(22);
849 latex->SetNDC();
850 latex->Draw();
851
852 DrawALICELogo(0.75, 0.75, 0.9, 0.9);
853}
854
855void DrawSameMixed(const char* fileName, const char* fileNamePbPbMix = 0, Int_t step = 6)
856{
857 if (!fileNamePbPbMix)
858 fileNamePbPbMix = fileName;
859
860 gpTMin = 1.01;
861 gpTMax = 1.99;
862
863 loadlibs();
864
865 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
866 hMixed = (AliUEHistograms*) GetUEHistogram(fileNamePbPbMix, 0, kTRUE);
867
868 SetupRanges(h);
869 SetupRanges(hMixed);
870
871 TH1* hist1 = 0;
872 GetDistAndFlow(h, 0, &hist1, 0, step, 0, 80, 2.01, 3.99, 1, kTRUE, 0, kTRUE);
873
874// ((TH2*) hist1)->Rebin2D(2, 2);
875// hist1->Scale(0.25);
876
877 NormalizeToBinWidth(hist1);
878
879// for (Int_t i=1; i<=hist1->GetNbinsX(); ++i)
880// {
881// for (Int_t j=1; j<=hist1->GetNbinsY(); ++j)
882// {
883// Float_t factor = 1.0 / (2.0 - TMath::Abs(hist1->GetYaxis()->GetBinCenter(j) / 0.9));
884// hist1->SetBinContent(i, j, hist1->GetBinContent(i, j) * factor);
885// hist1->SetBinError(i, j, hist1->GetBinError(i, j) * factor);
886// }
887// }
888
889 c = new TCanvas("c", "c", 1600, 800);
890 c->Divide(2, 1);
891 c->cd(1);
892 gPad->SetLeftMargin(0.15);
893 hist1->SetTitle("");
894 hist1->GetYaxis()->SetRangeUser(-1.79, 1.79);
895 hist1->GetZaxis()->SetTitleOffset(1.8);
896 hist1->GetXaxis()->SetTitleOffset(1.5);
897 hist1->GetYaxis()->SetTitleOffset(2);
898 hist1->GetZaxis()->SetTitle("same event pairs (a.u.)");
899 hist1->SetStats(kFALSE);
900 hist1->DrawCopy("SURF1");
901
902 DrawALICELogo(kFALSE, 0.2, 0.7, 0.4, 0.9);
903
904 hist2 = hist1;
905
906 GetDistAndFlow(hMixed, 0, &hist1, 0, step, 0, 80, 2.01, 3.99, 1, kTRUE, 0, kTRUE);
907
908// ((TH2*) hist1)->Rebin2D(2, 2);
909 NormalizeToBinWidth(hist1);
910
911// for (Int_t j=1; j<=hist1->GetNbinsY(); ++j)
912// {
913// Float_t factor = 1.0 / (1.0 - TMath::Abs(hist1->GetYaxis()->GetBinCenter(j)) / 6.0);
914// Printf("%d %f", j, factor);
915// for (Int_t i=1; i<=hist1->GetNbinsX(); ++i)
916// {
917// hist1->SetBinContent(i, j, hist1->GetBinContent(i, j) * factor);
918// hist1->SetBinError(i, j, hist1->GetBinError(i, j) * factor);
919// }
920// }
921
922 c->cd(2);
923 gPad->SetLeftMargin(0.15);
924 hist1->SetTitle("");
925 hist1->GetYaxis()->SetRangeUser(-1.79, 1.79);
926 hist1->GetZaxis()->SetTitleOffset(1.8);
927 hist1->GetXaxis()->SetTitleOffset(1.5);
928 hist1->GetYaxis()->SetTitleOffset(2);
929 hist1->GetZaxis()->SetTitle("mixed event pairs (a.u.)");
930 hist1->SetStats(kFALSE);
931 hist1->DrawCopy("SURF1");
932
933 DrawALICELogo(kFALSE, 0.2, 0.7, 0.4, 0.9);
934
935 c->SaveAs(Form("samemixed_%d.eps", step));
936 c->SaveAs(Form("samemixed_%d.png", step));
937
938 new TCanvas("c3", "c3", 800, 800);
939 gPad->SetLeftMargin(0.15);
940 hist2->Divide(hist1);
941 hist2->DrawCopy("SURF1");
942}
943
944void Validation2DAllStepsNew(const char* fileName, Int_t bin = 0)
945{
946 Int_t centralityFrom = 0;
947 Int_t centralityTo = 80;
948
949 gpTMin = 1.01;
950 gpTMax = 1.99;
951
952 Float_t ptTrigBegin = 2.01;
953 Float_t ptTrigEnd = 3.99;
954
955 if (bin == 1)
956 {
957 gpTMin = 0.51;
958 gpTMax = 0.99;
959 ptTrigBegin = 1.01;
960 ptTrigEnd = 1.99;
961 }
962 else if (bin == 2)
963 {
964 gpTMin = 0.51;
965 gpTMax = 0.99;
966 ptTrigBegin = 0.51;
967 ptTrigEnd = 0.99;
968 }
969 else if (bin == 3)
970 {
971/* gpTMin = 0.51;
972 gpTMax = 0.99;
973 ptTrigBegin = 0.51;
974 ptTrigEnd = 0.99;*/
975 centralityFrom = 0;
976 centralityTo = 20;
977 }
978 else if (bin == 4)
979 {
980/* gpTMin = 0.51;
981 gpTMax = 0.99;
982 ptTrigBegin = 0.51;
983 ptTrigEnd = 0.99;*/
984 centralityFrom = 60;
985 centralityTo = 80;
986 }
987 else if (bin == 5)
988 {
989 gpTMin = 0.51;
990 gpTMax = 0.74;
991 ptTrigBegin = 0.51;
992 ptTrigEnd = 0.99;
993 }
994
995 loadlibs();
996
997 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
998 hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE);
999
1000 SetupRanges(h);
1001 SetupRanges(hMixed);
1002
1003 TH1* hist[6];
1004
1005 GetSumOfRatios(h, hMixed, &hist[0], 0, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd);
1006 GetSumOfRatios(h, hMixed, &hist[1], 4, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd);
1007 GetSumOfRatios(h, hMixed, &hist[2], 5, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd);
1008 GetSumOfRatios(h, hMixed, &hist[3], 6, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd);
1009 GetSumOfRatios(h, hMixed, &hist[4], 8, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd);
1010 GetSumOfRatios(h, hMixed, &hist[5], 10, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd);
1011
1012 c = new TCanvas("c", "c", 1600, 1000);
1013 c->Divide(6, 4);
1014
1015 Float_t peakYield1[6];
1016 Float_t baselineValues1[6];
1017
1018 for (Int_t i=0; i<6; i++)
1019 {
1020 if (!hist[i])
1021 continue;
1022
1023 // NOTE fix normalization. these 2d correlations come out of AliUEHist normalized by dphi bin width, but not deta
1024 hist[i]->Scale(1.0 / hist[i]->GetYaxis()->GetBinWidth(1));
1025
1026 ((TH2*) hist[i])->Rebin2D(2, 2); hist[i]->Scale(0.25);
1027 }
1028
1029 for (Int_t i=0; i<6; i++)
1030 {
1031 if (!hist[i])
1032 continue;
1033
1034 c->cd(i+1);
1035 hist[i]->GetYaxis()->SetRangeUser(-1.99, 1.99);
1036 hist[i]->GetXaxis()->SetTitleOffset(1.5);
1037 hist[i]->GetYaxis()->SetTitleOffset(2);
1038 hist[i]->GetZaxis()->SetTitleOffset(1.8);
1039 hist[i]->GetZaxis()->SetTitle("1/N_{trig} dN_{assoc}/d#Delta#etad#Delta#varphi (1/rad.)");
1040 hist[i]->SetStats(kFALSE);
1041 hist[i]->DrawCopy("SURF1");
1042
1043 if (hist[5])
1044 {
1045 c->cd(i+1+6);
1046 TH2* clone = (TH2*) hist[i]->Clone();
1047 clone->Divide(hist[5]);
1048 clone->DrawCopy("COLZ");
1049 gPad->SetRightMargin(0.15);
1050 }
1051
1052 c->cd(i+1+12);
1053 proj1 = ((TH2*) hist[i])->ProjectionX(Form("proj1_%d", i), hist[i]->GetYaxis()->FindBin(-0.99), hist[i]->GetYaxis()->FindBin(0.99));
1054 proj1->DrawCopy();
1055
1056 baselineValues1[i] = proj1->Integral(proj1->FindBin(TMath::Pi()/2 - 0.2), proj1->FindBin(TMath::Pi()/2 + 0.2)) / (proj1->FindBin(TMath::Pi()/2 + 0.2) - proj1->FindBin(TMath::Pi()/2 - 0.2) + 1);
1057 peakYield1[i] = proj1->Integral(proj1->GetXaxis()->FindBin(-1), proj1->GetXaxis()->FindBin(1)) / (proj1->GetXaxis()->FindBin(0.99) - proj1->GetXaxis()->FindBin(-0.99) + 1) - baselineValues1[i];
1058 Printf("%d: %f %f", i, peakYield1[i], baselineValues1[i]);
1059
1060 if (hist[5])
1061 {
1062 proj2 = ((TH2*) hist[5])->ProjectionX(Form("proj2_%d", i), hist[5]->GetYaxis()->FindBin(-0.99), hist[5]->GetYaxis()->FindBin(0.99));
1063 proj2->SetLineColor(2);
1064 proj2->DrawCopy("SAME");
1065
1066 c->cd(i+1+18);
1067 proj1->Divide(proj1, proj2, 1, 1, "B");
1068 proj1->Draw();
1069 }
1070 }
1071
1072 c = new TCanvas("c2", "c2", 1600, 1000);
1073 c->Divide(6, 4);
1074
1075 for (Int_t i=0; i<6; i++)
1076 {
1077 if (!hist[i])
1078 continue;
1079
1080 c->cd(i+1);
1081 hist[i]->GetYaxis()->SetRangeUser(-1.99, 1.99);
1082 hist[i]->GetXaxis()->SetTitleOffset(1.5);
1083 hist[i]->GetYaxis()->SetTitleOffset(2);
1084 hist[i]->GetZaxis()->SetTitleOffset(1.8);
1085 hist[i]->GetZaxis()->SetTitle("1/N_{trig} dN_{assoc}/d#Delta#etad#Delta#varphi (1/rad.)");
1086 hist[i]->SetStats(kFALSE);
1087 hist[i]->DrawCopy("SURF1");
1088
1089 c->cd(i+1+6);
1090 TH2* clone = (TH2*) hist[i]->Clone();
1091 clone->Divide(hist[0]);
1092 clone->DrawCopy("COLZ");
1093 gPad->SetRightMargin(0.15);
1094
1095 c->cd(i+1+12);
1096 proj1 = ((TH2*) hist[i])->ProjectionX(Form("proj3_%d", i), hist[i]->GetYaxis()->FindBin(-0.99), hist[i]->GetYaxis()->FindBin(0.99));
1097 proj1->DrawCopy();
1098
1099 proj2 = ((TH2*) hist[0])->ProjectionX(Form("proj4_%d", i), hist[0]->GetYaxis()->FindBin(-0.99), hist[0]->GetYaxis()->FindBin(0.99));
1100 proj2->SetLineColor(2);
1101 proj2->DrawCopy("SAME");
1102
1103 c->cd(i+1+18);
1104 proj1->Divide(proj1, proj2, 1, 1, "B");
1105 proj1->Draw();
1106 }
1107
1108 c = new TCanvas("c3", "c3", 1600, 1000);
1109 c->Divide(6, 4);
1110
1111 for (Int_t i=3; i<4; i++)
1112 {
1113 if (!hist[i])
1114 continue;
1115
1116 c->cd(i+1);
1117 hist[i]->GetYaxis()->SetRangeUser(-1.99, 1.99);
1118 hist[i]->GetXaxis()->SetTitleOffset(1.5);
1119 hist[i]->GetYaxis()->SetTitleOffset(2);
1120 hist[i]->GetZaxis()->SetTitleOffset(1.8);
1121 hist[i]->GetZaxis()->SetTitle("1/N_{trig} dN_{assoc}/d#Delta#etad#Delta#varphi (1/rad.)");
1122 hist[i]->SetStats(kFALSE);
1123 hist[i]->DrawCopy("SURF1");
1124
1125 c->cd(i+1+6);
1126 TH2* clone = (TH2*) hist[i]->Clone();
1127 clone->Divide(hist[4]);
1128 clone->DrawCopy("COLZ");
1129 gPad->SetRightMargin(0.15);
1130
1131 c->cd(i+1+12);
1132 proj1 = ((TH2*) hist[i])->ProjectionX(Form("proj4_%d", i), hist[i]->GetYaxis()->FindBin(-0.99), hist[i]->GetYaxis()->FindBin(0.99));
1133 proj1->DrawCopy();
1134
1135 proj2 = ((TH2*) hist[4])->ProjectionX(Form("proj5_%d", i), hist[4]->GetYaxis()->FindBin(-0.99), hist[4]->GetYaxis()->FindBin(0.99));
1136 proj2->SetLineColor(2);
1137 proj2->DrawCopy("SAME");
1138
1139 c->cd(i+1+18);
1140 proj1->Divide(proj1, proj2, 1, 1, "B");
1141 proj1->Draw();
1142 }
1143
1144 c = new TCanvas("c4", "c4", 1200, 400);
1145 c->Divide(3, 1);
1146
1147 for (Int_t i=0; i<1; i++)
1148 {
1149 if (!hist[i])
1150 continue;
1151
1152 if (hist[5])
1153 {
1154 c->cd(1);
1155 TH2* clone = (TH2*) hist[i]->Clone();
1156 clone->Divide(hist[5]);
1157 clone->DrawCopy("COLZ");
1158 gPad->SetRightMargin(0.15);
1159 }
1160
1161 c->cd(2);
1162 proj1 = ((TH2*) hist[i])->ProjectionX(Form("proj1_%d", i), hist[i]->GetYaxis()->FindBin(-0.99), hist[i]->GetYaxis()->FindBin(0.99));
1163 proj1->DrawCopy();
1164
1165 baselineValues1[i] = proj1->Integral(proj1->FindBin(TMath::Pi()/2 - 0.2), proj1->FindBin(TMath::Pi()/2 + 0.2)) / (proj1->FindBin(TMath::Pi()/2 + 0.2) - proj1->FindBin(TMath::Pi()/2 - 0.2) + 1);
1166 peakYield1[i] = proj1->Integral(proj1->GetXaxis()->FindBin(-1), proj1->GetXaxis()->FindBin(1)) / (proj1->GetXaxis()->FindBin(0.99) - proj1->GetXaxis()->FindBin(-0.99) + 1) - baselineValues1[i];
1167 Printf("%d: %f %f", i, peakYield1[i], baselineValues1[i]);
1168
1169 if (hist[5])
1170 {
1171 proj2 = ((TH2*) hist[5])->ProjectionX(Form("proj2_%d", i), hist[5]->GetYaxis()->FindBin(-0.99), hist[5]->GetYaxis()->FindBin(0.99));
1172 proj2->SetLineColor(2);
1173 proj2->DrawCopy("SAME");
1174
1175 c->cd(3);
1176 proj1->Divide(proj1, proj2, 1, 1, "B");
1177 proj1->Draw();
1178 }
1179 }
1180
1181 for (Int_t i=0; i<6; i++)
1182 Printf("%d/%d: %f %f", i, 0, peakYield1[i] / peakYield1[0] - 1, baselineValues1[i] / baselineValues1[0] - 1);
1183
1184 if (hist[5])
1185 {
1186 for (Int_t i=0; i<6; i++)
1187 Printf("%d/%d: %f %f", i, 5, peakYield1[i] / peakYield1[5] - 1, baselineValues1[i] / baselineValues1[5] - 1);
1188 }
1189}
1190
1191void Validation2DAllBins(const char* fileName, const char *fileName2)
1192{
1193 /* Int_t is[] = { 0, 1, 2, 3, 4, 5};
1194 Int_t js[] = { 1, 2, 3, 4, 5, 6 };
1195 Int_t n = 5;*/
1196/* Int_t is[] = { 0, 1, 1, 2, 2, 2, 3, 3, 3 };
1197 Int_t js[] = { 1, 1, 2, 1, 2, 3, 1, 2, 3 };*/
1198 Int_t is[] = { 0, 1, 1, 2, 2, 2, 3 };
1199 Int_t js[] = { 1, 1, 2, 1, 2, 3, 3 };
1200 Int_t n = 6;
1201
1202 file1 = TFile::Open(fileName);
1203 TFile* file2 = 0;
1204 if (fileName2)
1205 file2 = TFile::Open(fileName2);
1206
1207 file3 = TFile::Open("non_closure.root", "RECREATE");
1208 file3->Close();
1209
1210 Float_t baselineValues1, baselineValues2, peakYield1, peakYield2;
1211
1212 Int_t padID = 0;
1213 Int_t padN = 4;
1214 for (Int_t centr=0; centr<4; centr++)
1215 {
1216 for (Int_t i=0; i<n; i++)
1217 {
1218 if (padN == 4)
1219 {
1220 c = new TCanvas(Form("c%d", padID), Form("c%d", padID), 1100, 750);
1221 c->Divide(3, 3);
1222 padN = 1;
1223 padID++;
1224 }
1225
1226 TH2* hist1 = (TH2*) file1->Get(Form("dphi_%d_%d_%d", is[i], js[i], centr));
1227 if (!hist1)
1228 continue;
1229 TH2* hist2 = 0;
1230 if (file2)
1231 hist2 = (TH2*) file2->Get(Form("dphi_%d_%d_%d", is[i], js[i], centr));
1232 else
1233 hist2 = (TH2*) file1->Get(Form("dphi_%d_%d_%d", is[i], js[i], centr+4));
1234
1235 // NOTE fix normalization. these 2d correlations come out of AliUEHist normalized by dphi bin width, but not deta
1236 hist1->Scale(1.0 / hist1->GetYaxis()->GetBinWidth(1));
1237 hist2->Scale(1.0 / hist2->GetYaxis()->GetBinWidth(1));
1238
1239 ((TH2*) hist1)->Rebin2D(2, 2); hist1->Scale(0.25);
1240 ((TH2*) hist2)->Rebin2D(2, 2); hist2->Scale(0.25);
1241
1242 const Float_t outerEta = 1.8;
1243 const Float_t exclusion = 0.5;
1244
1245 c->cd(padN);
1246 proj1 = ((TH2*) hist1)->ProjectionX(Form("proj1a_%d_%d", centr, i), hist1->GetYaxis()->FindBin(-outerEta + 0.01), hist1->GetYaxis()->FindBin(-exclusion - 0.01));
1247 proj1b = ((TH2*) hist1)->ProjectionX(Form("proj1b_%d_%d", centr, i), hist1->GetYaxis()->FindBin(exclusion + 0.01), hist1->GetYaxis()->FindBin(outerEta - 0.01));
1248 proj1->Add(proj1b);
1249 copy = proj1->DrawCopy();
1250 copy->GetYaxis()->SetRangeUser(proj1->GetMinimum() * 0.9, proj1->GetMaximum() * 1.2);
1251 proj1c = ((TH2*) hist1)->ProjectionX(Form("proj1c_%d_%d", centr, i), hist1->GetYaxis()->FindBin(-outerEta + 0.01), hist1->GetYaxis()->FindBin(outerEta - 0.01));
1252 proj1c->SetLineColor(2);
1253 proj1c->DrawCopy("SAME");
1254 copy->SetMinimum(TMath::Min(copy->GetMinimum(), proj1c->GetMinimum()));
1255 copy->SetMaximum(1.2 * TMath::Max(copy->GetMaximum(), proj1c->GetMaximum()));
1256
1257 Double_t baselineValues1E, peakYield1E;
1258 baselineValues1 = proj1->IntegralAndError(proj1->FindBin(TMath::Pi()/2 - 0.2), proj1->FindBin(TMath::Pi()/2 + 0.2), baselineValues1E);
1259 baselineValues1 /= (proj1->FindBin(TMath::Pi()/2 + 0.2) - proj1->FindBin(TMath::Pi()/2 - 0.2) + 1);
1260 baselineValues1E /= (proj1->FindBin(TMath::Pi()/2 + 0.2) - proj1->FindBin(TMath::Pi()/2 - 0.2) + 1);
1261 peakYield1 = proj1->IntegralAndError(proj1->GetXaxis()->FindBin(-1), proj1->GetXaxis()->FindBin(1), peakYield1E);
1262 peakYield1 /= (proj1->GetXaxis()->FindBin(0.99) - proj1->GetXaxis()->FindBin(-0.99) + 1);
1263 peakYield1E /= (proj1->GetXaxis()->FindBin(0.99) - proj1->GetXaxis()->FindBin(-0.99) + 1);
1264 peakYield1 -= baselineValues1;
1265 peakYield1E = TMath::Sqrt(peakYield1E * peakYield1E + baselineValues1E * baselineValues1E);
1266
1267 proj2 = ((TH2*) hist2)->ProjectionX(Form("proj2a_%d_%d", centr, i), hist2->GetYaxis()->FindBin(-outerEta + 0.01), hist2->GetYaxis()->FindBin(-exclusion - 0.01));
1268 proj2b = ((TH2*) hist2)->ProjectionX(Form("proj2b_%d_%d", centr, i), hist2->GetYaxis()->FindBin(exclusion + 0.01), hist2->GetYaxis()->FindBin(outerEta - 0.01));
1269 proj2->Add(proj2b);
1270 proj2->SetLineColor(3);
1271 proj2->DrawCopy("SAME");
1272 proj2c = ((TH2*) hist2)->ProjectionX(Form("proj2c_%d_%d", centr, i), hist2->GetYaxis()->FindBin(-outerEta + 0.01), hist2->GetYaxis()->FindBin(outerEta - 0.01));
1273 proj2c->SetLineColor(4);
1274 proj2c->DrawCopy("SAME");
1275
1276 Double_t baselineValues2E, peakYield2E;
1277 baselineValues2 = proj2->IntegralAndError(proj1->FindBin(TMath::Pi()/2 - 0.2), proj2->FindBin(TMath::Pi()/2 + 0.2), baselineValues2E);
1278 baselineValues2 /= (proj2->FindBin(TMath::Pi()/2 + 0.2) - proj2->FindBin(TMath::Pi()/2 - 0.2) + 1);
1279 baselineValues2E /= (proj2->FindBin(TMath::Pi()/2 + 0.2) - proj2->FindBin(TMath::Pi()/2 - 0.2) + 1);
1280 peakYield2 = proj2->IntegralAndError(proj2->GetXaxis()->FindBin(-1), proj2->GetXaxis()->FindBin(1), peakYield2E);
1281 peakYield2 /= (proj2->GetXaxis()->FindBin(0.99) - proj2->GetXaxis()->FindBin(-0.99) + 1);
1282 peakYield2E /= (proj2->GetXaxis()->FindBin(0.99) - proj2->GetXaxis()->FindBin(-0.99) + 1);
1283 peakYield2 -= baselineValues2;
1284 peakYield2E = TMath::Sqrt(peakYield2E * peakYield2E + baselineValues2E * baselineValues2E);
1285
1286 // Printf("%d: %f %f %f %f %.2f%% %.2f%%", i, peakYield1, baselineValues1, peakYield2, baselineValues2, 100.0 * peakYield1 / peakYield2 - 100, 100.0 * baselineValues1 / baselineValues2 - 100);
1287 Printf("%s: %.2f%% +- %.2f%% %.2f%% +- %.2f%%",
1288 hist1->GetTitle(),
1289 100.0 * peakYield1 / peakYield2 - 100,
1290 100.0 * peakYield1 / peakYield2 * TMath::Sqrt(TMath::Power(peakYield1E / peakYield1, 2) + TMath::Power(peakYield2E / peakYield2, 2)),
1291 100.0 * baselineValues1 / baselineValues2 - 100,
1292 100.0 * baselineValues1 / baselineValues2 * TMath::Sqrt(TMath::Power(baselineValues1E / baselineValues1, 2) + TMath::Power(baselineValues2E / baselineValues2, 2))
1293 );
1294
1295 c->cd(padN+3);
1296 proj1->Divide(proj1, proj2, 1, 1, "B");
1297 proj1c->Divide(proj1c, proj2c, 1, 1, "B");
1298 // proj1->Add(proj2, -1);
1299 proj1->Draw();
1300 proj1c->SetLineColor(2);
1301 proj1c->Draw("SAME");
1302
1303 c->cd(padN+6);
1304 hist1->Divide(hist2);
1305 hist1->GetYaxis()->SetRangeUser(-1.79, 1.79);
1306 hist1->Draw("COLZ");
1307
1308 file3 = TFile::Open("non_closure.root", "UPDATE");
1309 proj1->Write(Form("non_closure_%d_%d_%d", is[i], js[i], centr));
1310 proj1c->Write(Form("non_closure_all_%d_%d_%d", is[i], js[i], centr));
1311 hist1->Write(Form("non_closure_2d_%d_%d_%d", is[i], js[i], centr));
1312 file3->Close();
1313
1314 padN++;
1315 }
1316 }
1317}
1318
1319void Validation2DAllSteps(const char* fileName, const char* fileNameCorrected = "corrected.root", Int_t startStep = 8)
1320{
1321 Int_t centralityFrom = 0;
1322 Int_t centralityTo = 80;
1323
1324 gpTMin = 1.01;
1325 gpTMax = 1.99;
1326
1327 Float_t ptTrigBegin = 2.01;
1328 Float_t ptTrigEnd = 2.99;
1329
1330 loadlibs();
1331
1332 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
1333 hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE);
1334
1335 AliUEHistograms* h2 = (AliUEHistograms*) GetUEHistogram(fileNameCorrected);
1336 hMixed2 = (AliUEHistograms*) GetUEHistogram(fileNameCorrected, 0, kTRUE);
1337
1338 SetupRanges(h);
1339 SetupRanges(hMixed);
1340 SetupRanges(h2);
1341 SetupRanges(hMixed2);
1342
1343 TH1* hist[6];
1344 TH1* hist2[6];
1345
1346// GetSumOfRatios(h, hMixed, &hist[0], 0, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd, kTRUE);
1347
1348 GetDistAndFlow(h, hMixed, &hist[0], 0, 0, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd, 1, kTRUE, 0, kTRUE, 0);
1349 GetDistAndFlow(h, hMixed, &hist[1], 0, 4, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd, 1, kTRUE, 0, kTRUE, 6);
1350 GetDistAndFlow(h, hMixed, &hist[2], 0, 5, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd, 1, kTRUE, 0, kTRUE, 6);
1351 GetDistAndFlow(h, hMixed, &hist[3], 0, startStep, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd, 1, kTRUE, 0, kTRUE, startStep);
1352 GetDistAndFlow(h2, hMixed2, &hist2[0], 0, 0, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd, 1, kTRUE, 0, kTRUE, startStep);
1353 GetDistAndFlow(h2, hMixed2, &hist2[1], 0, 4, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd, 1, kTRUE, 0, kTRUE, startStep);
1354 GetDistAndFlow(h2, hMixed2, &hist2[2], 0, 5, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd, 1, kTRUE, 0, kTRUE, startStep);
1355 GetDistAndFlow(h2, hMixed2, &hist2[3], 0, startStep, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd, 1, kTRUE, 0, kTRUE, startStep);
1356
1357 c = new TCanvas("c", "c", 1600, 1000);
1358 c->Divide(4, 5);
1359
1360 Float_t peakYield1[4];
1361 Float_t baselineValues1[4];
1362 Float_t peakYield2[4];
1363 Float_t baselineValues2[4];
1364 for (Int_t i=0; i<4; i++)
1365 {
1366 // NOTE fix normalization. these 2d correlations come out of AliUEHist normalized by dphi bin width, but not deta
1367 hist[i]->Scale(1.0 / hist[i]->GetYaxis()->GetBinWidth(1));
1368 hist2[i]->Scale(1.0 / hist2[i]->GetYaxis()->GetBinWidth(1));
1369
1370 ((TH2*) hist[i])->Rebin2D(2, 2); hist[i]->Scale(0.25);
1371// ((TH2*) hist[i])->Rebin2D(2, 2); hist[i]->Scale(0.25);
1372
1373 c->cd(i+1);
1374 hist[i]->GetYaxis()->SetRangeUser(-1.59, 1.59);
1375 hist[i]->GetXaxis()->SetTitleOffset(1.5);
1376 hist[i]->GetYaxis()->SetTitleOffset(2);
1377 hist[i]->GetZaxis()->SetTitleOffset(1.8);
1378 hist[i]->GetZaxis()->SetTitle("1/N_{trig} dN_{assoc}/d#Delta#etad#Delta#varphi (1/rad.)");
1379 hist[i]->SetStats(kFALSE);
1380 hist[i]->DrawCopy("SURF1");
1381
1382 ((TH2*) hist2[i])->Rebin2D(2, 2); hist2[i]->Scale(0.25);
1383// ((TH2*) hist2[i])->Rebin2D(2, 2); hist2[i]->Scale(0.25);
1384
1385// TF2* func2 = new TF2("func2", "[0]+[1]*exp(-0.5*((x/[2])**2+(y/[3])**2))", -1, 1, -0.99, 0.99);
1386// func2->SetParameters(0, 1, 0.5, 0.5);
1387// hist[i]->Fit(func2, "0R");
1388// hist[i]->Fit(func2, "0R");
1389//
1390// c->cd(i+1+4);
1391// func2->DrawClone("SURF1");
1392//
1393// baselineValues1[i] = func2->GetParameter(0);
1394// func2->SetParameter(0, 0);
1395// peakYield1[i] = func2->Integral(-0.5 * TMath::Pi(), 0.5 * TMath::Pi(), -1.4, 1.4);
1396// Printf("%f %f", peakYield1[i], baselineValues1[i]);
1397
1398 c->cd(i+1+4);
1399 hist2[i]->GetYaxis()->SetRangeUser(-1.59, 1.59);
1400 hist2[i]->GetXaxis()->SetTitleOffset(1.5);
1401 hist2[i]->GetYaxis()->SetTitleOffset(2);
1402 hist2[i]->GetZaxis()->SetTitleOffset(1.8);
1403 hist2[i]->GetZaxis()->SetTitle("1/N_{trig} dN_{assoc}/d#Delta#etad#Delta#varphi (1/rad.)");
1404 hist2[i]->SetStats(kFALSE);
1405 hist2[i]->DrawCopy("SURF1");
1406
1407 c->cd(i+1+12);
1408 proj1 = ((TH2*) hist[i])->ProjectionX(Form("proj1_%d", i), hist[i]->GetYaxis()->FindBin(-0.99), hist[i]->GetYaxis()->FindBin(0.99));
1409 proj1->DrawCopy();
1410
1411 baselineValues1[i] = proj1->GetMinimum();
1412 peakYield1[i] = proj1->Integral(proj1->GetXaxis()->FindBin(-1), proj1->GetXaxis()->FindBin(1)) / (proj1->GetXaxis()->FindBin(0.99) - proj1->GetXaxis()->FindBin(-0.99) + 1) - baselineValues1[i];
1413 Printf("%f %f", peakYield1[i], baselineValues1[i]);
1414
1415 proj2 = ((TH2*) hist2[i])->ProjectionX(Form("proj2_%d", i), hist2[i]->GetYaxis()->FindBin(-0.99), hist2[i]->GetYaxis()->FindBin(0.99));
1416 proj2->SetLineColor(2);
1417 proj2->DrawCopy("SAME");
1418
1419 baselineValues2[i] = proj2->GetMinimum();
1420 peakYield2[i] = proj2->Integral(proj2->GetXaxis()->FindBin(-1), proj2->GetXaxis()->FindBin(1)) / (proj2->GetXaxis()->FindBin(0.99) - proj2->GetXaxis()->FindBin(-0.99) + 1) - baselineValues2[i];
1421 Printf("%f %f", peakYield2[i], baselineValues2[i]);
1422
1423 c->cd(i+1+16);
1424 proj1->Divide(proj2);
1425 proj1->Draw();
1426
1427// func2 = new TF2("func2", "[0]+[1]*exp(-0.5*((x/[2])**2+(y/[3])**2))", -1, 1, -0.99, 0.99);
1428// func2->SetParameters(0, 1, 0.5, 0.5);
1429// hist2[i]->Fit(func2, "0R");
1430// hist2[i]->Fit(func2, "0R");
1431//
1432// c->cd(i+1+12);
1433// func2->DrawClone("SURF1");
1434//
1435// baselineValues2[i] = func2->GetParameter(0);
1436// func2->SetParameter(0, 0);
1437// peakYield2[i] = func2->Integral(-0.5 * TMath::Pi(), 0.5 * TMath::Pi(), -1.4, 1.4);
1438// Printf("%f %f", peakYield2[i], baselineValues2[i]);
1439
1440 c->cd(i+1+8);
1441 TH2* clone = (TH2*) hist[i]->Clone();
1442 clone->Divide(hist2[i]);
1443// clone->Add(hist2[i], -1);
1444 clone->DrawCopy("COLZ");
1445 gPad->SetRightMargin(0.15);
1446
1447/* baselineValues1[i] = clone->Integral(1, clone->GetNbinsX(), clone->GetYaxis()->FindBin(-0.99), clone->GetYaxis()->FindBin(0.99)) / clone->GetNbinsX() / (clone->GetYaxis()->FindBin(0.99) - clone->GetYaxis()->FindBin(-0.99) + 1);
1448 peakYield1[i] = clone->Integral(clone->GetXaxis()->FindBin(-0.5), clone->GetXaxis()->FindBin(0.5), clone->GetYaxis()->FindBin(-0.49), clone->GetYaxis()->FindBin(0.49)) / (clone->GetXaxis()->FindBin(0.5) - clone->GetXaxis()->FindBin(-0.5) + 1) / (clone->GetYaxis()->FindBin(0.49) - clone->GetYaxis()->FindBin(-0.49) + 1);*/
1449
1450// break;
1451 }
1452
1453 for (Int_t i=0; i<4; i++)
1454 {
1455 Printf("%d: %f %f", i, peakYield1[i] / peakYield2[i] - 1, baselineValues1[i] / baselineValues2[i] - 1);
1456// Printf("%d: %f %f", i, peakYield1[i] - 1, baselineValues1[i] - 1);
1457 }
1458}
1459
1460void CorrelatedContaminationEffect(const char* fileName, const char* fileNameCorrected = "corrected.root", Int_t bin = 0, Int_t startStep = 8)
1461{
1462 Int_t centralityFrom = 0;
1463 Int_t centralityTo = 80;
1464
1465 gpTMin = 1.01;
1466 gpTMax = 1.99;
1467
1468 Float_t ptTrigBegin = 2.01;
1469 Float_t ptTrigEnd = 3.99;
1470
1471 if (bin == 1)
1472 {
1473 ptTrigBegin = 1.01;
1474 ptTrigEnd = 1.99;
1475 }
1476 else if (bin == 2)
1477 {
1478 gpTMin = 0.51;
1479 gpTMax = 0.99;
1480 ptTrigBegin = 1.01;
1481 ptTrigEnd = 1.99;
1482 }
1483 else if (bin == 3)
1484 {
1485 ptTrigBegin = 4.01;
1486 ptTrigEnd = 7.99;
1487 }
1488
1489 loadlibs();
1490
1491 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
1492 hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE);
1493
1494 AliUEHistograms* h2 = (AliUEHistograms*) GetUEHistogram(fileNameCorrected);
1495 hMixed2 = (AliUEHistograms*) GetUEHistogram(fileNameCorrected, 0, kTRUE);
1496
1497 SetupRanges(h);
1498 SetupRanges(hMixed);
1499 SetupRanges(h2);
1500 SetupRanges(hMixed2);
1501
1502 TH1* hist[6];
1503
1504 Int_t maxFilled = 5;
1505 GetSumOfRatios(h, hMixed, &hist[0], 0, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd);
1506 GetSumOfRatios(h, hMixed, &hist[1], 4, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd);
1507 GetSumOfRatios(h, hMixed, &hist[2], 5, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd);
1508 GetSumOfRatios(h, hMixed, &hist[3], 6, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd);
1509 GetSumOfRatios(h, hMixed, &hist[4], startStep, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd);
1510// GetSumOfRatios(h2, hMixed2, &hist[5], startStep, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd);
1511
1512// GetDistAndFlow(h, hMixed, &hist[0], 0, 0, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd, 1, kTRUE, 0, kTRUE, 0);
1513// GetDistAndFlow(h, hMixed, &hist[1], 0, 4, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd, 1, kTRUE, 0, kTRUE, 6);
1514// GetDistAndFlow(h, hMixed, &hist[2], 0, 5, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd, 1, kTRUE, 0, kTRUE, 6);
1515// GetDistAndFlow(h, hMixed, &hist[3], 0, 6, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd, 1, kTRUE, 0, kTRUE, 6);
1516// GetDistAndFlow(h, hMixed, &hist[4], 0, startStep, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd, 1, kTRUE, 0, kTRUE, startStep);
1517// GetDistAndFlow(h2, hMixed2, &hist[5], 0, 0, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd, 1, kTRUE, 0, kTRUE, startStep);
1518
1519 c = new TCanvas("c", "c", 1600, 1000);
1520 c->Divide(6, 2);
1521
1522 for (Int_t i=0; i<maxFilled; i++)
1523 {
1524 // NOTE fix normalization. these 2d correlations come out of AliUEHist normalized by dphi bin width, but not deta
1525 hist[i]->Scale(1.0 / hist[i]->GetYaxis()->GetBinWidth(1));
1526
1527 ((TH2*) hist[i])->Rebin2D(2, 2); hist[i]->Scale(0.25);
1528// ((TH2*) hist[i])->Rebin2D(2, 2); hist[i]->Scale(0.25);
1529
1530 c->cd(i+1);
1531 hist[i]->GetYaxis()->SetRangeUser(-1.59, 1.59);
1532 hist[i]->GetXaxis()->SetTitleOffset(1.5);
1533 hist[i]->GetYaxis()->SetTitleOffset(2);
1534 hist[i]->GetZaxis()->SetTitleOffset(1.8);
1535 hist[i]->GetZaxis()->SetTitle("1/N_{trig} dN_{assoc}/d#Delta#etad#Delta#varphi (1/rad.)");
1536 hist[i]->SetStats(kFALSE);
1537 hist[i]->DrawCopy("SURF1");
1538 }
1539
1540 for (Int_t i=1; i<maxFilled; i++)
1541 {
1542 TH2* clone = (TH2*) hist[i]->Clone();
1543 if (i < 4)
1544 clone->Divide(hist[i-1]);
1545 else if (i < 5)
1546 clone->Divide(hist[2]);
1547 else
1548 clone->Divide(hist[0]);
1549
1550 c->cd(6+i);
1551 gPad->SetRightMargin(0.15);
1552 // hist1->SetTitle("");
1553// clone->GetZaxis()->SetRangeUser(0.8, 1.2);
1554 clone->GetZaxis()->SetTitle("1/N_{trig} dN_{assoc}/d#Delta#etad#Delta#varphi (1/rad.)");
1555 clone->SetStats(kFALSE);
1556 clone->DrawCopy("COLZ");
1557 }
1558
1559 Float_t peakYield[6];
1560 Float_t baselineValues[6];
1561 for (Int_t i=0; i<maxFilled; i++)
1562 {
1563 Int_t phi1 = hist[i]->GetXaxis()->FindBin(-1);
1564 Int_t phi2 = hist[i]->GetXaxis()->FindBin(1);
1565 Int_t eta1 = hist[i]->GetYaxis()->FindBin(-1.59);
1566 Int_t eta2 = hist[i]->GetYaxis()->FindBin(1.01);
1567 Int_t eta3 = hist[i]->GetYaxis()->FindBin(1.59);
1568 Float_t baseline = ((TH2*) hist[i])->Integral(phi1, phi2, eta2, eta3, "width") / (phi2 - phi1 + 1) / (eta3 - eta2 + 1);
1569 Float_t peak = ((TH2*) hist[i])->Integral(phi1, phi2, eta1, eta3, "width");
1570 Printf("%f %f", baseline, peak);
1571 peak -= baseline * (eta3 - eta1 + 1) * (phi2 - phi1 + 1);
1572 Printf("%f", peak);
1573 peakYield[i] = peak;
1574 baselineValues[i] = baseline;
1575 }
1576
1577 for (Int_t i=1; i<maxFilled; i++)
1578 {
1579 if (i < 4)
1580 Printf("%d/%d: %f %f", i, i-1, peakYield[i] / peakYield[i-1] - 1, baselineValues[i] / baselineValues[i-1] - 1);
1581 else if (i < 5)
1582 Printf("%d/%d: %f %f", i, 2, peakYield[i] / peakYield[2] - 1, baselineValues[i] / baselineValues[2] - 1);
1583 else
1584 Printf("%d/%d: %f %f", 0, i, peakYield[0] / peakYield[i] - 1, baselineValues[0] / baselineValues[i] - 1);
1585 }
1586
1587 c = new TCanvas("c2", "c2", 1600, 1000);
1588 c->Divide(6, 2);
1589 for (Int_t i=0; i<maxFilled; i++)
1590 {
1591 c->cd(i+1);
1592 hist[i]->DrawCopy("SURF1");
1593
1594 TF2* func2 = new TF2("func2", "[0]+[1]*exp(-0.5*((x/[2])**2+(y/[3])**2))", -0.5 * TMath::Pi(), 0.5 * TMath::Pi(), -1.4, 1.4);
1595 func2->SetParameters(0, 1, 0.5, 0.5);
1596// func2->SetParLimits(1, 0, 10);
1597// func2->SetParLimits(2, sigmaFitLimit, 1);
1598// func2->SetParLimits(3, sigmaFitLimit, 1);
1599 hist[i]->Fit(func2, "0R");
1600
1601 c->cd(i+7);
1602 func2->DrawClone("SURF1");
1603
1604 baselineValues[i] = func2->GetParameter(0);
1605 func2->SetParameter(0, 0);
1606 peakYield[i] = func2->Integral(-0.5 * TMath::Pi(), 0.5 * TMath::Pi(), -1.4, 1.4);
1607 Printf("%f %f", peakYield[i], baselineValues[i]);
1608 }
1609
1610 for (Int_t i=1; i<maxFilled; i++)
1611 {
1612 if (i < 4)
1613 Printf("%d/%d: %f %f", i, i-1, peakYield[i] / peakYield[i-1] - 1, baselineValues[i] / baselineValues[i-1] - 1);
1614 else if (i < 5)
1615 Printf("%d/%d: %f %f", i, 2, peakYield[i] / peakYield[2] - 1, baselineValues[i] / baselineValues[2] - 1);
1616 else
1617 Printf("%d/%d: %f %f", 0, i, peakYield[0] / peakYield[i] - 1, baselineValues[0] / baselineValues[i] - 1);
1618 }
1619
1620 for (Int_t i=1; i<maxFilled; i++)
1621 {
1622 Printf("%d/%d: %f %f", 0, i, peakYield[0] / peakYield[i] - 1, baselineValues[0] / baselineValues[i] - 1);
1623 }
1624}
1625
1626void DrawValidation2D(const char* fileName, const char* fileNameCorrected = "corrected.root", Int_t startStep = 8)
1627{
1628 Int_t centralityTo = 80;
1629
1630 gpTMin = 1.01;
1631 gpTMax = 1.99;
1632
1633 loadlibs();
1634
1635 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
1636 hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE);
1637
1638 SetupRanges(h);
1639 SetupRanges(hMixed);
1640
1641 TH1* hist1 = 0;
1642 GetDistAndFlow(h, hMixed, &hist1, 0, 0, 0, centralityTo, 2.01, 3.99, 1, kTRUE, 0, kTRUE, 0);
1643 // NOTE fix normalization. these 2d correlations come out of AliUEHist normalized by dphi bin width, but not deta
1644 hist1->Scale(1.0 / hist1->GetYaxis()->GetBinWidth(1));
1645
1646// ((TH2*) hist1)->Rebin2D(2, 2); hist1->Scale(0.25);
1647 ((TH2*) hist1)->Rebin2D(2, 2); hist1->Scale(0.25);
1648
1649// NormalizeToBinWidth(hist1);
1650
1651 c = new TCanvas("c", "c", 1000, 1000);
1652 c->Divide(2, 2);
1653
1654 c->cd(1);
1655 gPad->SetLeftMargin(0.15);
1656// hist1->SetTitle("");
1657 hist1->GetYaxis()->SetRangeUser(-1.59, 1.59);
1658 hist1->GetXaxis()->SetTitleOffset(1.5);
1659 hist1->GetYaxis()->SetTitleOffset(2);
1660 hist1->GetZaxis()->SetTitleOffset(1.8);
1661 hist1->GetZaxis()->SetTitle("1/N_{trig} dN_{assoc}/d#Delta#etad#Delta#varphi (1/rad.)");
1662 hist1->SetStats(kFALSE);
1663 hist1->DrawCopy("SURF1");
1664 DrawLatex(0.1, 0.85, 1, "MC", 0.04);
1665// DrawALICELogo(kFALSE, 0.7, 0.7, 0.9, 0.9);
1666
1667 hist2 = hist1;
1668 hist1 = 0;
1669 GetDistAndFlow(h, hMixed, &hist1, 0, startStep, 0, centralityTo, 2.01, 3.99, 1, kTRUE, 0, kTRUE, startStep);
1670 // NOTE fix normalization. these 2d correlations come out of AliUEHist normalized by dphi bin width, but not deta
1671 hist1->Scale(1.0 / hist1->GetYaxis()->GetBinWidth(1));
1672
1673// ((TH2*) hist1)->Rebin2D(2, 2); hist1->Scale(0.25);
1674 ((TH2*) hist1)->Rebin2D(2, 2); hist1->Scale(0.25);
1675// NormalizeToBinWidth(hist1);
1676
1677 c->cd(2);
1678 gPad->SetLeftMargin(0.15);
1679 hist1->SetTitle("");
1680 hist1->GetYaxis()->SetRangeUser(-1.59, 1.59);
1681 hist1->GetXaxis()->SetTitleOffset(1.5);
1682 hist1->GetYaxis()->SetTitleOffset(2);
1683 hist1->GetZaxis()->SetTitleOffset(1.8);
1684 hist1->SetStats(kFALSE);
1685 hist1->GetZaxis()->SetTitle("1/N_{trig} dN_{assoc}/d#Delta#etad#Delta#varphi (1/rad.)");
1686 hist1->DrawCopy("SURF1");
1687 DrawLatex(0.1, 0.85, 1, "Uncorrected", 0.04);
1688// DrawALICELogo(kFALSE, 0.7, 0.7, 0.9, 0.9);
1689
1690 c2 = new TCanvas("c3", "c3", 800, 800);
1691// hist2->Scale(1.09);
1692 hist1->Divide(hist2);
1693// hist1->Add(hist2, -1);
1694 hist1->DrawCopy("SURF1");
1695
1696// return;
1697
1698// AliUEHistograms* h2 = (AliUEHistograms*) GetUEHistogram("LHC11a10a_bis_AOD090_120406_zvtx_rebinned_corrected.root");
1699 AliUEHistograms* h2 = (AliUEHistograms*) GetUEHistogram(fileNameCorrected);
1700 SetupRanges(h2);
1701
1702 GetDistAndFlow(h2, hMixed, &hist1, 0, 0, 0, centralityTo, 2.01, 3.99, 1, kTRUE, 0, kTRUE, startStep);
1703 // NOTE fix normalization. these 2d correlations come out of AliUEHist normalized by dphi bin width, but not deta
1704 hist1->Scale(1.0 / hist1->GetYaxis()->GetBinWidth(1));
1705
1706 ((TH2*) hist1)->Rebin2D(2, 2); hist1->Scale(0.25);
1707// ((TH2*) hist1)->Rebin2D(2, 2); hist1->Scale(0.25);
1708
1709 c->cd(3);
1710 gPad->SetLeftMargin(0.15);
1711 hist1->SetTitle("");
1712 hist1->GetYaxis()->SetRangeUser(-1.59, 1.59);
1713 hist1->GetXaxis()->SetTitleOffset(1.5);
1714 hist1->GetZaxis()->SetTitleOffset(1.8);
1715 hist1->GetZaxis()->SetTitle("1/N_{trig} dN_{assoc}/d#Delta#etad#Delta#varphi (1/rad.)");
1716 hist1->GetYaxis()->SetTitleOffset(2);
1717 hist1->SetStats(kFALSE);
1718 hist1->DrawCopy("SURF1");
1719 DrawLatex(0.1, 0.85, 1, "Corrected", 0.04);
1720// DrawALICELogo(kFALSE, 0.7, 0.7, 0.9, 0.9);
1721
1722 hist1->Divide(hist2);
1723
1724 c->cd(4);
1725 gPad->SetRightMargin(0.15);
1726 hist1->SetTitle("");
1727 hist1->GetYaxis()->SetRangeUser(-1.59, 1.59);
1728 hist1->GetXaxis()->SetTitleOffset(1.2);
1729 hist1->GetYaxis()->SetTitleOffset(1.2);
1730 hist1->GetZaxis()->SetTitle("Ratio: Corrected / MC");
1731 hist1->SetStats(kFALSE);
1732 hist1->GetZaxis()->SetRangeUser(0.99, 1.01);
1733 hist1->DrawCopy("COLZ");
1734
1735// DrawALICELogo(kFALSE, 0.7, 0.7, 0.9, 0.9);
1736
1737 c->SaveAs("validation.eps");
1738 c->SaveAs("validation.gif");
1739}
1740
1741void DrawValidation(const char* fileName1, const char* fileName2)
1742{
1743 gpTMin = 1.01;
1744 gpTMax = 3.99;
1745
1746 CompareStep(fileName1, fileName2, 2, 6, 4, 0, 4.01, 19.99);
1747 CompareStep(fileName1, fileName2, 2, 4, 4, 0, 4.01, 19.99);
1748
1749 CompareStep(fileName1, fileName2, 2, 4, 2, 0, 4.01, 19.99);
1750 CompareStep(fileName1, fileName2, 2, 2, 2, 0, 4.01, 19.99);
1751}
1752
1753void ProfileMultiplicity(const char* fileName = "PWG4_JetTasksOutput.root")
1754{
1755 loadlibs();
1756
1757 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
1758
1759 new TCanvas;
1760 h->GetCorrelationMultiplicity()->Draw("colz");
1761 gPad->SetLogz();
1762
1763 new TCanvas;
1764 h->GetCorrelationMultiplicity()->ProfileX()->DrawCopy()->Fit("pol1", "", "", 1, 10);
1765}
1766
1767void SetupRanges(void* obj)
1768{
1769 if (!obj)
1770 return;
1771 ((AliUEHistograms*) obj)->SetEtaRange(0, 0);
1772// ((AliUEHistograms*) obj)->SetEtaRange(-0.99, 0.99); Printf("WARNING: Setting eta Range!");
1773 ((AliUEHistograms*) obj)->SetPtRange(gpTMin, gpTMax);
1774 ((AliUEHistograms*) obj)->SetCombineMinMax(kTRUE);
1775}
1776
1777void DrawRatios(const char* name, void* correctedVoid, void* comparisonVoid, Int_t compareStep = -1, Int_t compareRegion = 2, Float_t ptLeadMin = -1, Float_t ptLeadMax = -1)
1778{
1779 AliUEHist* corrected = (AliUEHist*) correctedVoid;
1780 AliUEHist* comparison = (AliUEHist*) comparisonVoid;
1781
1782 Int_t beginStep = AliUEHist::kCFStepAll;
1783 Int_t endStep = AliUEHist::kCFStepReconstructed;
1784
1785 if (compareStep != -1)
1786 {
1787 beginStep = compareStep;
1788 endStep = compareStep;
1789 }
1790
1791 Int_t beginRegion = 0;
1792 Int_t endRegion = 2;
1793
1794 if (compareRegion != -1)
1795 {
1796 beginRegion = compareRegion;
1797 endRegion = compareRegion;
1798 }
1799
1800 for (Int_t step=beginStep; step<=endStep; step++)
1801 {
1802 if (compareStep == -1 && (step == AliUEHist::kCFStepAnaTopology || step == AliUEHist::kCFStepTriggered))
1803 continue;
1804
1805 for (Int_t region=beginRegion; region <= endRegion; region++)
1806 {
1807 Printf("%f %f", ptLeadMin, ptLeadMax);
1808 TH1* corrHist = corrected->GetUEHist(step, region, ptLeadMin, ptLeadMax);
1809 TH1* mcHist = comparison->GetUEHist(step, region, ptLeadMin, ptLeadMax);
1810
1811 DrawRatio(corrHist, mcHist, TString(Form("%s: step %d %s %s", name, step, corrected->GetStepTitle(step), corrected->GetRegionTitle(region))));
1812 }
1813 }
1814}
1815
1816void DrawRatios(void* correctedVoid, void* comparisonVoid, Int_t compareStep = -1, Int_t compareRegion = 2, Int_t compareUEHist = 0)
1817{
1818 AliUEHistograms* corrected = (AliUEHistograms*) correctedVoid;
1819 AliUEHistograms* comparison = (AliUEHistograms*) comparisonVoid;
1820
1821 if (1 && compareUEHist == 2)
1822 {
1823 for (Float_t ptMin = 2.01; ptMin < 8; ptMin += 2)
1824 {
1825 ((AliUEHistograms*) corrected)->SetPtRange(ptMin, ptMin + 1.98);
1826 ((AliUEHistograms*) comparison)->SetPtRange(ptMin, ptMin + 1.98);
1827
1828 DrawRatios(TString(Form("Dphi %d pT %f", compareUEHist, ptMin)), corrected->GetUEHist(compareUEHist), comparison->GetUEHist(compareUEHist), compareStep, compareRegion, 8.01, 19.99);
1829 }
1830 return;
1831 }
1832
1833 if (compareUEHist == -1)
1834 {
1835 for (Int_t i=0; i<2; i++)
1836 DrawRatios(TString(Form("UE %d", i)), corrected->GetUEHist(i), comparison->GetUEHist(i), compareStep, compareRegion);
1837 }
1838 else
1839 DrawRatios(TString(Form("UE %d", compareUEHist)), corrected->GetUEHist(compareUEHist), comparison->GetUEHist(compareUEHist), compareStep, compareRegion);
1840}
1841
1842void CompareEventsTracks(void* corrVoid, void* mcVoid, Int_t compareStep, Int_t compareRegion, Int_t compareUEHist = 0)
1843{
1844 AliUEHist* corr = ((AliUEHistograms*) corrVoid)->GetUEHist(compareUEHist);
1845 AliUEHist* mc = ((AliUEHistograms*) mcVoid)->GetUEHist(compareUEHist);
1846
1847 Float_t ptLeadMin = 0;
1848 Float_t ptLeadMax = -1;
1849 Int_t axis = 2;
1850
1851 if (compareUEHist == 2)
1852 {
1853 ptLeadMin = 1.01;
1854 ptLeadMax = 1.49;
1855 axis = 4;
1856 }
1857
1858 TH1* corrHist = corr->GetUEHist(compareStep, compareRegion, ptLeadMin, ptLeadMax);
1859 TH1* mcHist = mc ->GetUEHist(compareStep, compareRegion, ptLeadMin, ptLeadMax);
1860
1861 DrawRatio(corrHist, mcHist, Form("check"));
1862
1863 corr->SetBinLimits(corr->GetTrackHist(compareRegion)->GetGrid(compareStep));
1864 mc->SetBinLimits(corr->GetTrackHist(compareRegion)->GetGrid(compareStep));
1865
1866 corrHist = corr->GetTrackHist(compareRegion)->GetGrid(compareStep)->Project(axis);
1867 mcHist = mc ->GetTrackHist(compareRegion)->GetGrid(compareStep)->Project(axis);
1868 DrawRatio(corrHist, mcHist, Form("check2"));
1869
1870 corrHist = corr->GetEventHist()->GetGrid(compareStep)->Project(0);
1871 mcHist = mc ->GetEventHist()->GetGrid(compareStep)->Project(0);
1872 DrawRatio(corrHist, mcHist, Form("check3"));
1873}
1874
1875void CopyReconstructedData(const char* fileName)
1876{
1877 loadlibs();
1878
1879 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
1880 AliUEHistograms* hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE);
1881
1882 // copy
1883 AliUEHistograms* onlyRec = (AliUEHistograms*) h->Clone();
1884 onlyRec->Reset();
1885 onlyRec->CopyReconstructedData(h);
1886
1887 AliUEHistograms* onlyRecMixed = (AliUEHistograms*) hMixed->Clone();
1888 onlyRecMixed->Reset();
1889 onlyRecMixed->CopyReconstructedData(hMixed);
1890
1891 TString newFileName(fileName);
1892 newFileName.ReplaceAll(".root", "");
1893 newFileName += "_onlyreco.root";
1894
1895 list = new TList;
1896 list->Add(onlyRec);
1897 list->Add(onlyRecMixed);
1898
1899 file3 = TFile::Open(newFileName, "RECREATE");
1900 file3->mkdir("PWG4_PhiCorrelations");
1901 file3->cd("PWG4_PhiCorrelations");
1902 list->Write("histosPhiCorrelations", TObject::kSingleKey);
1903 file3->Close();
1904}
1905
1906void correctMC(const char* fileNameCorrections, const char* fileNameESD = 0, Int_t compareStep = -1, Int_t compareRegion = 2, Int_t compareUEHist = 0)
1907{
1908 // corrects the reconstructed step in fileNameESD with fileNameCorr
1909 // if fileNameESD is 0 data from fileNameCorr is taken
1910 // afterwards the corrected distributions are compared with the MC stored in fileNameESD
1911
1912 loadlibs();
1913
1914 AliUEHistograms* corr = (AliUEHistograms*) GetUEHistogram(fileNameCorrections);
1915 SetupRanges(corr);
1916
1917 corr->ExtendTrackingEfficiency();
1918
1919 AliUEHistograms* testSample = corr;
1920 if (fileNameESD)
1921 testSample = (AliUEHistograms*) GetUEHistogram(fileNameESD);
1922
1923 // copy to esd object
1924 AliUEHistograms* esd = (AliUEHistograms*) corr->Clone();
1925 esd->Reset();
1926 esd->CopyReconstructedData(testSample);
1927
1928 SetupRanges(corr);
1929 SetupRanges(testSample);
1930 SetupRanges(esd);
1931
1932 esd->Correct(corr);
1933
1934 list = new TList;
1935 list->Add(esd);
1936
1937 file3 = TFile::Open("correctedMC.root", "RECREATE");
1938 file3->mkdir("PWG4_PhiCorrelations");
1939 file3->cd("PWG4_PhiCorrelations");
1940 list->Write("histosPhiCorrelations", TObject::kSingleKey);
1941 file3->Close();
1942
1943 if (1)
1944 DrawRatios(esd, testSample, compareStep, compareRegion, compareUEHist);
1945
1946 if (1)
1947 {
1948 esd->SetPtRange(2.01, 3.99);
1949 corrected = esd->GetUEHist(2)->GetUEHist(0, 0, 4.01, 7.99, 0, -1, 1);
1950 testSample->SetPtRange(2.01, 3.99);
1951 mc = testSample->GetUEHist(2)->GetUEHist(0, 0, 4.01, 7.99, 0, -1, 1);
1952 new TCanvas; corrected->DrawCopy("SURF1");
1953 new TCanvas; mc->DrawCopy("SURF1");
1954 new TCanvas; mc->DrawCopy("SURF1")->Divide(corrected);
1955 }
1956
1957 //CompareEventsTracks(esd, testSample, compareStep, compareRegion, compareUEHist);
1958}
1959
1960// function to compare only final step for all regions and distributions
1961
1962void correctData(const char* fileNameCorrections, const char* fileNameESD, const char* contEnhancement = 0, Float_t contEncUpTo = 1.0, Int_t compareStep = 0, Int_t compareRegion = 0, Int_t compareUEHist = 2)
1963{
1964 // corrects fileNameESD with fileNameCorrections and compares the two
1965
1966 loadlibs();
1967
1968 AliUEHistograms* corr = (AliUEHistograms*) GetUEHistogram(fileNameCorrections);
1969
1970 TList* list = 0;
1971 AliUEHistograms* esd = (AliUEHistograms*) GetUEHistogram(fileNameESD, &list);
1972
1973 SetupRanges(corr);
1974 SetupRanges(esd);
1975
1976 Float_t etaRange = 1.2;
1977 Printf(">>>>> Using eta range: |eta| < %f", etaRange);
1978 corr->SetEtaRange(-etaRange+0.01, etaRange-0.01);
1979 corr->ExtendTrackingEfficiency(0);
1980
1981// corr->GetUEHist(2)->GetTrackEfficiency(AliUEHist::kCFStepTracked, AliUEHist::kCFStepTrackedOnlyPrim, 1, -1, 2);
1982// return;
1983
1984 if (contEnhancement)
1985 {
1986 TFile::Open(contEnhancement);
1987 contEncHist = (TH1*) gFile->Get("histo");
1988 contEncHistFullRange = (TH1*) corr->GetUEHist(0)->GetTrackingEfficiency(1)->Clone("contEncHistFullRange");
1989
1990 contEncHistFullRange->Reset();
1991 for (Int_t i=1; i<=contEncHistFullRange->GetNbinsX(); i++)
1992 {
1993 contEncHistFullRange->SetBinContent(i, 1);
1994 if (i <= contEncHist->GetNbinsX() && contEncHist->GetXaxis()->GetBinCenter(i) < contEncUpTo && contEncHist->GetBinContent(i) > 0)
1995 contEncHistFullRange->SetBinContent(i, contEncHist->GetBinContent(i));
1996 }
1997 corr->SetContaminationEnhancement((TH1F*) contEncHistFullRange);
1998 }
1999
2000 esd->Correct(corr);
2001 //esd->GetUEHist(2)->AdditionalDPhiCorrection(0);
2002
2003 file3 = TFile::Open("corrected.root", "RECREATE");
2004 file3->mkdir("PWG4_PhiCorrelations");
2005 file3->cd("PWG4_PhiCorrelations");
2006 list->Write("histosPhiCorrelations", TObject::kSingleKey);
2007 file3->Close();
2008
2009// DrawRatios(esd, corr, compareStep, compareRegion, compareUEHist);
2010}
2011
2012void ITSTPCEfficiency(const char* fileNameData, Int_t id, Int_t itsTPC = 0)
2013{
2014 // its = 0; tpc = 1
2015
2016 // uncertainty from dN/dpT paper
2017 Double_t pTBins[] = {0.0, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 12.0, 14.0, 16.0, 18.0, 20.0, 25.0, 30.0, 35.0, 40.0, 45.0, 50.0, 100.0};
2018 Float_t effITS[] = {0., 0., 0.995, 0.98, 0.986, 0.996, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; // the last three are the same because i don't have entries
2019 Float_t effTPC[] = {0., 0, 1.042, 1.026,1.021, 1.018, 1.015, 1.015, 1.012, 1.012, 1.007, 1.0075,1.006, 1.006, 1.004, 1.004, 1.009 }; // the last bins put as if they were the same
2020
2021 TH1F* effHist = new TH1F("effHist", "effHist", 39, pTBins);
2022 for (Int_t i=0; i<39; i++)
2023 {
2024 Int_t bin = i;
2025 if (i > 16)
2026 bin = 16;
2027 effHist->SetBinContent(i+1, (itsTPC == 0) ? effITS[bin] : effTPC[bin]);
2028 }
2029
2030 new TCanvas; effHist->Draw();
2031
2032 EffectOfModifiedTrackingEfficiency(fileNameData, id, 2, effHist, 1, -1, (itsTPC == 0) ? "ITS" : "TPC");
2033}
2034
2035
2036void EffectOfModifiedTrackingEfficiency(const char* fileNameData, Int_t id, Int_t region, TH1* trackingEff, Int_t axis1, Int_t axis2 = -1, const char* name = "EffectOfModifiedTrackingEfficiency")
2037{
2038 // trackingEff should contain the change in tracking efficiency, i.e. between before and after in the eta-pT plane
2039
2040 loadlibs();
2041
2042 AliUEHistograms* corrected = (AliUEHistograms*) GetUEHistogram(fileNameData);
2043 SetupRanges(corrected);
2044
2045 AliUEHist* ueHist = corrected->GetUEHist(id);
2046
2047 Float_t ptLeadMin = -1;
2048 Float_t ptLeadMax = -1;
2049 if (id == 2)
2050 {
2051 // the uncertainty is flat in delta phi, so use this trick to get directly the uncertainty as function of leading pT
2052 //ptLeadMin = 1.01;
2053 //ptLeadMax = 1.99;
2054 }
2055
2056 // histogram before
2057 TH1* before = ueHist->GetUEHist(AliUEHist::kCFStepAll, region, ptLeadMin, ptLeadMax);
2058
2059 // copy histogram
2060 // the CFStepTriggered step is overwritten here and cannot be used for comparison afterwards anymore
2061 ueHist->CorrectTracks(AliUEHist::kCFStepAll, AliUEHist::kCFStepTriggered, (TH1*) 0, 0, -1);
2062
2063 // reapply tracking efficiency
2064 ueHist->CorrectTracks(AliUEHist::kCFStepTriggered, AliUEHist::kCFStepAll, trackingEff, axis1, axis2);
2065
2066 // histogram after
2067 TH1* after = ueHist->GetUEHist(AliUEHist::kCFStepAll, region, ptLeadMin, ptLeadMax);
2068
2069 DrawRatio(before, after, name);
2070 gPad->GetCanvas()->SaveAs(Form("%s.png", name));
2071}
2072
2073void EffectOfTrackCuts(const char* fileNameData, Int_t id, const char* systFile)
2074{
2075 loadlibs();
2076
2077 AliUEHistograms* corrected = (AliUEHistograms*) GetUEHistogram(fileNameData);
2078 effHist = (TH2D*) corrected->GetUEHist(0)->GetTrackingEfficiency()->Clone("effHist");
2079
2080 file = TFile::Open(systFile);
2081
2082 Int_t maxSyst = 3;
2083 const char* systNames[] = { "NClusTPC", "Chi2TPC", "SigmaDCA" };
2084
2085 for (Int_t i=0; i<maxSyst; i++)
2086 {
2087 for (Int_t j=0; j<2; j++)
2088 {
2089 TString histName;
2090 histName.Form("%s_syst_%s", systNames[i], (j == 0) ? "up" : "down");
2091 systEffect = (TH2*) file->Get(histName);
2092
2093 // rebin
2094 effHist->Reset();
2095 for (Int_t x=1; x <= effHist->GetNbinsX(); x++)
2096 for (Int_t y=1; y <= effHist->GetNbinsY(); y++)
2097 effHist->SetBinContent(x, y, 1);
2098
2099 for (Int_t x=1; x <= systEffect->GetNbinsX(); x++)
2100 for (Int_t y=1; y <= systEffect->GetNbinsY(); y++)
2101 if (systEffect->GetBinContent(x, y) != 0)
2102 effHist->SetBinContent(effHist->GetXaxis()->FindBin(systEffect->GetYaxis()->GetBinCenter(y)), effHist->GetYaxis()->FindBin(systEffect->GetXaxis()->GetBinCenter(x)), systEffect->GetBinContent(x, y));
2103
2104
2105 //new TCanvas; systEffect->Draw("COLZ"); new TCanvas; effHist->Draw("COLZ");
2106
2107 EffectOfModifiedTrackingEfficiency(fileNameData, id, (id == 2) ? 0 : 2, effHist, 0, 1, histName);
2108
2109 //return;
2110 }
2111 }
2112}
2113
2114void ModifyComposition(const char* fileNameData, const char* fileNameCorrections, Int_t id, Bool_t verbose = kFALSE)
2115{
2116 loadlibs();
2117
2118 AliUEHistograms* corrected = (AliUEHistograms*) GetUEHistogram(fileNameData);
2119 SetupRanges(corrected);
2120
2121 AliUEHistograms* corrections = (AliUEHistograms*) GetUEHistogram(fileNameCorrections);
2122 SetupRanges(corrections);
2123
2124 ueHistData = (AliUEHist*) corrected->GetUEHist(id);
2125 ueHistCorrections = (AliUEHist*) corrections->GetUEHist(id);
2126
2127 // copy histogram
2128 // the CFStepTriggered step is overwritten here and cannot be used for comparison afterwards anymore
2129 ueHistData->CorrectTracks(AliUEHist::kCFStepAll, AliUEHist::kCFStepTriggered, (TH1*) 0, 0);
2130
2131 Int_t maxRegion = 3;
2132 Float_t ptLeadMin = -1;
2133 Float_t ptLeadMax = -1;
2134 if (id == 2)
2135 {
2136 maxRegion = 1;
2137 // the uncertainty is flat in delta phi, so use this trick to get directly the uncertainty as function of leading pT
2138 //ptLeadMin = 1.01;
2139 //ptLeadMax = 1.99;
2140 }
2141
2142 // histogram before
2143 TH1* before[3];
2144 for (Int_t region=0; region<maxRegion; region++)
2145 before[region] = ueHistData->GetUEHist(AliUEHist::kCFStepAll, region, ptLeadMin, ptLeadMax);
2146
2147 //defaultEff = ueHistCorrections->GetTrackingEfficiency();
2148 defaultEff = ueHistCorrections->GetTrackingCorrection();
2149 //defaultEffpT = ueHistCorrections->GetTrackingEfficiency(1);
2150 defaultEffpT = ueHistCorrections->GetTrackingCorrection(1);
2151 defaultContainer = ueHistCorrections->GetTrackHistEfficiency();
2152
2153 c = new TCanvas;
2154 defaultEffpT->Draw("");
2155
2156 Float_t largestDeviation[3];
2157 for (Int_t i=0; i<maxRegion; i++)
2158 largestDeviation[i] = 0;
2159
2160 for (Int_t i=0; i<7; i++)
2161 {
2162 // case 0: // default
2163 // case 1: // + 30% kaons
2164 // case 2: // - 30% kaons
2165 // case 3: // + 30% protons
2166 // case 4: // - 30% protons
2167 // case 5: // + 30% others
2168 // case 6: // - 30% others
2169 Int_t correctionIndex = (i+1) / 2 + 1; // bin 1 == protons, bin 2 == kaons, ...
2170 Double_t scaleFactor = (i % 2 == 1) ? 1.3 : 0.7;
2171 if (i == 0)
2172 scaleFactor = 1;
2173
2174 newContainer = (AliCFContainer*) defaultContainer->Clone();
2175
2176 // modify, change all steps
2177 for (Int_t j=0; j<newContainer->GetNStep(); j++)
2178 {
2179 THnSparse* grid = newContainer->GetGrid(j)->GetGrid();
2180
2181 for (Int_t binIdx = 0; binIdx < grid->GetNbins(); binIdx++)
2182 {
2183 Int_t bins[5];
2184 Double_t value = grid->GetBinContent(binIdx, bins);
2185 Double_t error = grid->GetBinError(binIdx);
2186
2187 if (bins[2] != correctionIndex)
2188 continue;
2189
2190 value *= scaleFactor;
2191 error *= scaleFactor;
2192
2193 grid->SetBinContent(bins, value);
2194 grid->SetBinError(bins, error);
2195 }
2196 }
2197
2198 // put in corrections
2199 ueHistCorrections->SetTrackHistEfficiency(newContainer);
2200
2201 // ratio
2202 //modifiedEff = ueHistCorrections->GetTrackingEfficiency();
2203 modifiedEff = ueHistCorrections->GetTrackingCorrection();
2204 modifiedEff->Divide(modifiedEff, defaultEff);
2205 //modifiedEff->Draw("COLZ");
2206
2207 c->cd();
2208 //modifiedEffpT = ueHistCorrections->GetTrackingEfficiency(1);
2209 modifiedEffpT = ueHistCorrections->GetTrackingCorrection(1);
2210 modifiedEffpT->SetLineColor(i+1);
2211 modifiedEffpT->Draw("SAME");
2212
2213 // apply change in tracking efficiency
2214 ueHistData->CorrectTracks(AliUEHist::kCFStepTriggered, AliUEHist::kCFStepAll, modifiedEff, 0, 1);
2215
2216 for (Int_t region=0; region<maxRegion; region++)
2217 {
2218 // histogram after
2219 TH1* after = ueHistData->GetUEHist(AliUEHist::kCFStepAll, region, ptLeadMin, ptLeadMax);
2220
2221 if (verbose)
2222 DrawRatio(before[region], (TH1*) after->Clone(), Form("Region %d Composition %d", region, i));
2223
2224 // ratio is flat, extract deviation
2225 after->Divide(before[region]);
2226 after->Fit("pol0", "0");
2227 Float_t deviation = 100.0 - 100.0 * after->GetFunction("pol0")->GetParameter(0);
2228 Printf("Deviation for region %d case %d is %.2f %%", region, i, deviation);
2229
2230 if (TMath::Abs(deviation) > largestDeviation[region])
2231 largestDeviation[region] = TMath::Abs(deviation);
2232 }
2233 //return;
2234 }
2235
2236 for (Int_t i=0; i<maxRegion; i++)
2237 Printf("Largest deviation in region %d is %f", i, largestDeviation[i]);
2238}
2239
2240void MergeList(const char* prefix = "")
2241{
2242 loadlibs();
2243 gSystem->Load("libPWGflowBase");
2244 gSystem->Load("libPWGflowTasks");
2245
2246 ifstream in;
2247 in.open("list");
2248
2249 TFileMerger m(0);
2250
2251 TString line;
2252 while (in.good())
2253 {
2254 in >> line;
2255
2256 if (line.Length() == 0)
2257 continue;
2258
2259 TString fileName;
2260 fileName.Form("%s%s", prefix, line.Data());
2261// fileName.Form("alien://%s", line.Data());
2262 Printf("%s", fileName.Data());
2263
2264 m.AddFile(fileName);
2265 }
2266
2267 m.SetFastMethod();
2268 m.OutputFile("merged.root");
2269 m.Merge();
2270}
2271
2272void Merge2(const char* file1, const char* file2)
2273{
2274 loadlibs();
2275 TFileMerger m(0);
2276
2277 m.AddFile(file1);
2278 m.AddFile(file2);
2279
2280 m.SetFastMethod();
2281 m.OutputFile("merged.root");
2282 m.Merge();
2283}
2284
2285void Merge3(const char* file1, const char* file2, const char* file3)
2286{
2287 loadlibs();
2288 TFileMerger m(1);
2289
2290 m.AddFile(file1);
2291 m.AddFile(file2);
2292 m.AddFile(file3);
2293
2294 m.SetFastMethod();
2295 m.OutputFile("merged.root");
2296 m.Merge();
2297}
2298
2299void MergeList2(const char* listFile, const char* dir, Bool_t onlyPrintEvents = kFALSE, const char* targetDir = "PWG4_LeadingTrackUE")
2300{
2301 loadlibs();
2302
2303 ifstream in;
2304 in.open(listFile);
2305
2306 AliUEHistograms* final = 0;
2307 TList* finalList = 0;
2308
2309 TString line;
2310 while (in.good())
2311 {
2312 in >> line;
2313
2314 if (line.Length() == 0)
2315 continue;
2316
2317 TString fileName;
2318 fileName.Form("%s/%s/PWG4_JetTasksOutput.root", dir, line.Data());
2319 Printf("%s", fileName.Data());
2320
2321 TList* list = 0;
2322 AliUEHistograms* obj = (AliUEHistograms*) GetUEHistogram(fileName, &list);
2323 if (!obj)
2324 continue;
2325
2326 if (!final)
2327 {
2328 final = (AliUEHistograms*) obj;
2329 //final->GetEventCount()->Draw(); return;
2330 Printf("Events: %d", (Int_t) final->GetEventCount()->ProjectionX()->GetBinContent(4));
2331 finalList = list;
2332 }
2333 else
2334 {
2335 additional = (AliUEHistograms*) obj;
2336 Printf("Events: %d", (Int_t) additional->GetEventCount()->ProjectionX()->GetBinContent(4));
2337
2338 if (!onlyPrintEvents)
2339 {
2340 TList list2;
2341 list2.Add(additional);
2342 final->Merge(&list2);
2343 }
2344 delete additional;
2345 gFile->Close();
2346 }
2347 }
2348
2349 if (onlyPrintEvents)
2350 return;
2351
2352 Printf("Total events (at step 0): %d", (Int_t) final->GetEventCount()->ProjectionX()->GetBinContent(4));
2353
2354 file3 = TFile::Open("merged.root", "RECREATE");
2355 file3->mkdir(targetDir);
2356 file3->cd(targetDir);
2357 finalList->Write(0, TObject::kSingleKey);
2358 file3->Close();
2359}
2360
2361void PlotAll(const char* correctedFile, const char* mcFile)
2362{
2363 gCache = 1;
2364
2365 if (gEnergy == 900)
2366 {
2367 Float_t range[] = { 1.5, 2 };
2368 }
2369 else
2370 {
2371 Float_t range[] = { 3, 10 };
2372 }
2373
2374 for (Int_t id=0; id<3; id++)
2375 {
2376 if (id < 2)
2377 gForceRange = range[id];
2378 else
2379 gForceRange = -1;
2380
2381 if (id < 2)
2382 {
2383 for (Int_t region=0; region<3; region++)
2384 {
2385 CompareStep(correctedFile, mcFile, id, 0, region);
2386 gPad->GetCanvas()->SaveAs(Form("%s_%s_%d_%d.png", TString(correctedFile).Tokenize(".")->First()->GetName(), TString(mcFile).Tokenize(".")->First()->GetName(), id, region));
2387 }
2388 }
2389 else
2390 {
2391 Float_t leadingPtArr[] = { 0.50, 2.0, 4.0, 6.0, 10.0, 20.0, 50.0 };
2392 for (Int_t leadingPtID=0; leadingPtID<6; leadingPtID++)
2393 {
2394 CompareStep(correctedFile, mcFile, id, 0, 0, leadingPtArr[leadingPtID] + 0.01, leadingPtArr[leadingPtID+1] - 0.01);
2395 gPad->GetCanvas()->SaveAs(Form("%s_%s_%d_%.2f_%.2f.png", TString(correctedFile).Tokenize(".")->First()->GetName(), TString(mcFile).Tokenize(".")->First()->GetName(), id, leadingPtArr[leadingPtID], leadingPtArr[leadingPtID+1]));
2396 }
2397 }
2398 }
2399}
2400
2401/*
2402TGraph* GetFlow2040()
2403{
2404 // from first ALICE flow paper (provided by Raimond)
2405 // http://www-library.desy.de/spires/find/hep/www?eprint=arXiv:1011.3914
2406
2407 // centrality 20-30%
2408 Double_t xCumulant4th2030ALICE[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
2409 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000,
2410 5.500000,7.000000,9.000000};
2411 Double_t yCumulant4th2030ALICE[] = {0.000000,0.000000,0.030926,0.041076,0.052063,0.059429,0.070500,0.084461,0.086745,0.099254,
2412 0.109691,0.116398,0.130831,0.141959,0.158932,0.169680,0.171387,0.178858,0.171475,0.140358,
2413 0.000000,0.000000,0.000000};
2414 Double_t xErrCumulant4th2030ALICE[23] = {0.};
2415 Double_t yErrCumulant4th2030ALICE[] = {0.000000,0.000000,0.002857,0.003451,0.003567,0.003859,0.004609,0.004976,0.005412,0.006277,
2416 0.004748,0.005808,0.006896,0.007987,0.008683,0.008080,0.013278,0.018413,0.024873,0.026057,
2417 0.000000,0.000000,0.000000};
2418 Int_t nPointsCumulant4th2030ALICE = sizeof(xCumulant4th2030ALICE)/sizeof(Double_t);
2419 TGraphErrors *Cumulant4th2030ALICE = new TGraphErrors(nPointsCumulant4th2030ALICE,xCumulant4th2030ALICE,yCumulant4th2030ALICE,
2420 xErrCumulant4th2030ALICE,yErrCumulant4th2030ALICE);
2421 Cumulant4th2030ALICE->SetMarkerStyle(kFullSquare);
2422 Cumulant4th2030ALICE->SetMarkerColor(kRed);
2423 Cumulant4th2030ALICE->SetMarkerSize(1.2);
2424 Cumulant4th2030ALICE->SetFillStyle(1001);
2425 Cumulant4th2030ALICE->SetFillColor(kRed-10);
2426
2427 //===================================================================================================================
2428 // centrality 30-40%
2429 Double_t xCumulant4th3040ALICE[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
2430 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000,
2431 5.500000,7.000000,9.000000};
2432 Double_t yCumulant4th3040ALICE[] = {0.000000,0.000000,0.037071,0.048566,0.061083,0.070910,0.078831,0.091396,0.102026,0.109691,
2433 0.124449,0.139819,0.155561,0.165701,0.173678,0.191149,0.202015,0.204540,0.212560,0.195885,
2434 0.000000,0.000000,0.000000};
2435 Double_t xErrCumulant4th3040ALICE[23] = {0.};
2436 Double_t yErrCumulant4th3040ALICE[] = {0.000000,0.000000,0.002992,0.003364,0.003669,0.003931,0.004698,0.005261,0.005446,0.006151,
2437 0.004980,0.005741,0.007198,0.008576,0.010868,0.009926,0.015269,0.020691,0.027601,0.031834,
2438 0.000000,0.000000,0.000000};
2439 Int_t nPointsCumulant4th3040ALICE = sizeof(xCumulant4th3040ALICE)/sizeof(Double_t);
2440 TGraphErrors *Cumulant4th3040ALICE = new TGraphErrors(nPointsCumulant4th3040ALICE,xCumulant4th3040ALICE,yCumulant4th3040ALICE,
2441 xErrCumulant4th3040ALICE,yErrCumulant4th3040ALICE);
2442 Cumulant4th3040ALICE->SetMarkerStyle(kFullTriangleUp);
2443 Cumulant4th3040ALICE->SetMarkerColor(kGreen+2);
2444 Cumulant4th3040ALICE->SetMarkerSize(1.2);
2445 Cumulant4th3040ALICE->SetFillStyle(1001);
2446 Cumulant4th3040ALICE->SetFillColor(kGreen+2);
2447
2448 // build average between the two (for class 20-40%)
2449 Double_t* yAverage = new Double_t[nPointsCumulant4th3040ALICE];
2450 for (Int_t i=0; i<nPointsCumulant4th3040ALICE; i++)
2451 yAverage[i] = (yCumulant4th2030ALICE[i] + yCumulant4th3040ALICE[i]) / 2;
2452
2453 // assume flow constant above highest pT; not neccessarily physically sound ;)
2454 if (1)
2455 {
2456 yAverage[20] = yAverage[19];
2457 xCumulant4th3040ALICE[20] = 100;
2458 nPointsCumulant4th3040ALICE -= 2;
2459 }
2460
2461 TGraph *flow2040 = new TGraph(nPointsCumulant4th3040ALICE,xCumulant4th3040ALICE,yAverage);
2462
2463 if (0)
2464 {
2465 flow2040->Draw("*A");
2466 Cumulant4th2030ALICE->Draw("PSAME");
2467 Cumulant4th3040ALICE->Draw("PSAME");
2468 }
2469
2470 return flow2040;
2471}
2472*/
2473
2474/*
2475TGraph* GetFlow1020()
2476{
2477 // from first ALICE flow paper (provided by Raimond)
2478 // http://www-library.desy.de/spires/find/hep/www?eprint=arXiv:1011.3914
2479
2480 //===================================================================================================================
2481 // centrality 10-20%
2482 Double_t xCumulant4th1020ALICE[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
2483 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000,
2484 5.500000,7.000000,9.000000};
2485 Double_t yCumulant4th1020ALICE[] = {0.000000,0.000000,0.024075,0.031505,0.040413,0.044981,0.055358,0.060563,0.063378,0.070030,
2486 0.082692,0.091611,0.099641,0.107223,0.122376,0.131240,0.137425,0.146050,0.131365,0.124708,
2487 0.000000,0.000000,0.000000};
2488 Double_t xErrCumulant4th1020ALICE[23] = {0.};
2489 Double_t yErrCumulant4th1020ALICE[] = {0.000000,0.000000,0.002413,0.002931,0.003444,0.003950,0.004338,0.004835,0.005059,0.005586,
2490 0.004521,0.005278,0.005999,0.007072,0.008260,0.007279,0.011897,0.017409,0.023995,0.025701,
2491 0.000000,0.000000,0.000000};
2492 Int_t nPointsCumulant4th1020ALICE = sizeof(xCumulant4th1020ALICE)/sizeof(Double_t);
2493
2494 // assume flow constant above highest pT; not neccessarily physically sound ;)
2495 if (1)
2496 {
2497 yCumulant4th1020ALICE[20] = yCumulant4th1020ALICE[19];
2498 xCumulant4th1020ALICE[20] = 100;
2499 nPointsCumulant4th1020ALICE -= 2;
2500 }
2501
2502 TGraphErrors *Cumulant4th1020ALICE = new TGraphErrors(nPointsCumulant4th1020ALICE,xCumulant4th1020ALICE,yCumulant4th1020ALICE,
2503 xErrCumulant4th1020ALICE,yErrCumulant4th1020ALICE);
2504
2505 Cumulant4th1020ALICE->SetMarkerStyle(kFullCircle);
2506 Cumulant4th1020ALICE->SetMarkerColor(kBlue);
2507 Cumulant4th1020ALICE->SetMarkerSize(1.2);
2508 Cumulant4th1020ALICE->SetFillStyle(1001);
2509 Cumulant4th1020ALICE->SetFillColor(kBlue-10);
2510
2511 TGraph *flow1020 = new TGraph(nPointsCumulant4th1020ALICE,xCumulant4th1020ALICE,yCumulant4th1020ALICE);
2512
2513 if (0)
2514 {
2515 flow1020->Draw("*A");
2516 Cumulant4th1020ALICE->Draw("PSAME");
2517 }
2518
2519 return flow1020;
2520}
2521*/
2522
2523/*
2524TGraph* GetFlow05()
2525{
2526 // takes flow measurement from 10-20% and scales by a factor extracted from Fig.3 in the ALICE flow paper
2527 // factor = integrated flow in 0-5% / integrated flow in 10-20%
2528
2529 graph = GetFlow1020();
2530 for (Int_t i=0; i<graph->GetN(); i++)
2531 graph->GetY()[i] *= 0.016 / 0.055;
2532
2533 return graph;
2534}
2535*/
2536TGraphErrors* GetFlow01_Rap02(Int_t n)
2537{
2538 // private communication 19.04.11, Raimond / Ante
2539
2540 if (n == 2)
2541 {
2542 // v2{SP}(pt) for 0-1%, rapidity gap = 0.2:
2543 const Int_t nPointsSP_0001ALICE_v2_etaGap02 = 18;
2544 Double_t xSP_0001ALICE_v2_etaGap02[nPointsSP_0001ALICE_v2_etaGap02] = {0.250000,0.350000,0.450000,0.550000,0.650000,
2545 0.750000,0.850000,0.950000,1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
2546 Double_t ySP_0001ALICE_v2_etaGap02[nPointsSP_0001ALICE_v2_etaGap02] = {0.009235,0.014105,0.017274,0.018245,0.023190,
2547 0.024871,0.028216,0.031506,0.034179,0.035337,0.039836,0.045261,0.043393,0.050693,0.056469,0.055247,0.049718,0.052748};
2548 Double_t xErrSP_0001ALICE_v2_etaGap02[nPointsSP_0001ALICE_v2_etaGap02] = {0.};
2549 Double_t yErrSP_0001ALICE_v2_etaGap02[nPointsSP_0001ALICE_v2_etaGap02] = {0.000515,0.000504,0.000532,0.000585,0.000641,
2550 0.000709,0.000788,0.000876,0.000723,0.000891,0.001098,0.001354,0.001671,0.001485,0.002463,0.004038,0.006441,0.008091};
2551 TGraphErrors *SP_0001ALICE_v2_etaGap02 = new TGraphErrors(nPointsSP_0001ALICE_v2_etaGap02,xSP_0001ALICE_v2_etaGap02,
2552 ySP_0001ALICE_v2_etaGap02,xErrSP_0001ALICE_v2_etaGap02,yErrSP_0001ALICE_v2_etaGap02);
2553 SP_0001ALICE_v2_etaGap02->SetMarkerStyle(kFullCircle);
2554 SP_0001ALICE_v2_etaGap02->SetMarkerColor(kBlue);
2555 SP_0001ALICE_v2_etaGap02->SetFillStyle(1001);
2556 SP_0001ALICE_v2_etaGap02->SetFillColor(kBlue-10);
2557
2558 return SP_0001ALICE_v2_etaGap02;
2559 }
2560
2561 if (n == 3)
2562 {
2563 // v3{SP}(pt) for 0-1%, rapidity gap = 0.2:
2564 const Int_t nPointsSP_0001ALICE_v3_etaGap02 = 18;
2565 Double_t xSP_0001ALICE_v3_etaGap02[nPointsSP_0001ALICE_v3_etaGap02] = {0.250000,0.350000,0.450000,0.550000,0.650000,
2566 0.750000,0.850000,0.950000,1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
2567 Double_t ySP_0001ALICE_v3_etaGap02[nPointsSP_0001ALICE_v3_etaGap02] = {0.005688,0.007222,0.010305,0.013795,0.016077,
2568 0.018693,0.022310,0.026991,0.030162,0.035119,0.043097,0.048201,0.058249,0.063273,0.079233,0.083465,0.087807,0.069577};
2569 Double_t xErrSP_0001ALICE_v3_etaGap02[nPointsSP_0001ALICE_v3_etaGap02] = {0.};
2570 Double_t yErrSP_0001ALICE_v3_etaGap02[nPointsSP_0001ALICE_v3_etaGap02] = {0.000585,0.000582,0.000614,0.000667,0.000734,
2571 0.000811,0.000898,0.000989,0.000817,0.001000,0.001234,0.001517,0.001874,0.001669,0.002765,0.004528,0.007202,0.009066};
2572 TGraphErrors *SP_0001ALICE_v3_etaGap02 = new TGraphErrors(nPointsSP_0001ALICE_v3_etaGap02,xSP_0001ALICE_v3_etaGap02,ySP_0001ALICE_v3_etaGap02,
2573 xErrSP_0001ALICE_v3_etaGap02,yErrSP_0001ALICE_v3_etaGap02);
2574 SP_0001ALICE_v3_etaGap02->SetMarkerStyle(kFullTriangleUp);
2575 SP_0001ALICE_v3_etaGap02->SetMarkerSize(1.4);
2576 SP_0001ALICE_v3_etaGap02->SetMarkerColor(kGreen+2);
2577 SP_0001ALICE_v3_etaGap02->SetFillStyle(1001);
2578 SP_0001ALICE_v3_etaGap02->SetFillColor(kGreen-10);
2579
2580 return SP_0001ALICE_v3_etaGap02;
2581 }
2582
2583 if (n == 4)
2584 {
2585 // v4{SP}(pt) for 0-1%, rapidity gap = 0.2:
2586 const Int_t nPointsSP_0001ALICE_v4_etaGap02 = 18;
2587 Double_t xSP_0001ALICE_v4_etaGap02[nPointsSP_0001ALICE_v4_etaGap02] = {0.250000,0.350000,0.450000,0.550000,0.650000,
2588 0.750000,0.850000,0.950000,1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
2589 Double_t ySP_0001ALICE_v4_etaGap02[nPointsSP_0001ALICE_v4_etaGap02] = {0.001189,0.003540,0.004682,0.004210,0.007032,
2590 0.008627,0.010226,0.013671,0.016214,0.020054,0.023878,0.033939,0.033693,0.040006,0.055612,0.066287,0.074857,0.078751};
2591 Double_t xErrSP_0001ALICE_v4_etaGap02[nPointsSP_0001ALICE_v4_etaGap02] = {0.};
2592 Double_t yErrSP_0001ALICE_v4_etaGap02[nPointsSP_0001ALICE_v4_etaGap02] = {0.001035,0.001017,0.001081,0.001187,0.001299,
2593 0.001432,0.001590,0.001757,0.001443,0.001769,0.002175,0.002674,0.003296,0.002924,0.004844,0.007921,0.012524,0.015771};
2594 TGraphErrors *SP_0001ALICE_v4_etaGap02 = new TGraphErrors(nPointsSP_0001ALICE_v4_etaGap02,xSP_0001ALICE_v4_etaGap02,ySP_0001ALICE_v4_etaGap02,
2595 xErrSP_0001ALICE_v4_etaGap02,yErrSP_0001ALICE_v4_etaGap02);
2596 SP_0001ALICE_v4_etaGap02->SetMarkerStyle(kFullSquare);
2597 SP_0001ALICE_v4_etaGap02->SetMarkerColor(kRed);
2598 SP_0001ALICE_v4_etaGap02->SetFillStyle(1001);
2599 SP_0001ALICE_v4_etaGap02->SetFillColor(kRed-10);
2600
2601 return SP_0001ALICE_v4_etaGap02;
2602 }
2603
2604 return 0;
2605}
2606
2607TGraphErrors* GetFlow01_Rap10(Int_t n)
2608{
2609 if (n == 2)
2610 {
2611 // v2{SP}(pt) for 0-1%, rapidity gap = 1.0:
2612 const Int_t nPointsSP_0001ALICE_v2_etaGap10 = 21;
2613 Double_t xSP_0001ALICE_v2_etaGap10[nPointsSP_0001ALICE_v2_etaGap10] = {0.250000,0.350000,0.450000,0.550000,0.650000,
2614 0.750000,0.850000,0.950000,1.100000,1.300000,1.500000,1.700000,1.900000,2.100000,2.300000,2.500000,2.700000,2.900000,
2615 3.250000,3.750000,4.500000};
2616 Double_t ySP_0001ALICE_v2_etaGap10[nPointsSP_0001ALICE_v2_etaGap10] = {0.009129,0.013461,0.017567,0.018041,0.020384,
2617 0.023780,0.021647,0.029543,0.028912,0.029464,0.037016,0.044131,0.043135,0.047286,0.051983,0.049311,0.050472,0.046569,
2618 0.036905,0.054836,0.030527};
2619 Double_t xErrSP_0001ALICE_v2_etaGap10[nPointsSP_0001ALICE_v2_etaGap10] = {0.};
2620 Double_t yErrSP_0001ALICE_v2_etaGap10[nPointsSP_0001ALICE_v2_etaGap10] = {0.001179,0.001152,0.001219,0.001339,0.001480,
2621 0.001644,0.001831,0.002016,0.001662,0.002033,0.002497,0.003056,0.003777,0.004645,0.005713,0.007069,0.008540,0.010447,
2622 0.009145,0.014749,0.018698};
2623 TGraphErrors *SP_0001ALICE_v2_etaGap10 = new TGraphErrors(nPointsSP_0001ALICE_v2_etaGap10,xSP_0001ALICE_v2_etaGap10,
2624 ySP_0001ALICE_v2_etaGap10,xErrSP_0001ALICE_v2_etaGap10,yErrSP_0001ALICE_v2_etaGap10);
2625 SP_0001ALICE_v2_etaGap10->SetMarkerStyle(kOpenCircle);
2626 SP_0001ALICE_v2_etaGap10->SetMarkerColor(kBlue);
2627 SP_0001ALICE_v2_etaGap10->SetFillStyle(1001);
2628 SP_0001ALICE_v2_etaGap10->SetFillColor(kBlue-10);
2629
2630 return SP_0001ALICE_v2_etaGap10;
2631 }
2632
2633 if (n == 3)
2634 {
2635 // v3{SP}(pt) for 0-1%, rapidity gap = 1.0:
2636 const Int_t nPointsSP_0001ALICE_v3_etaGap10 = 18;
2637 Double_t xSP_0001ALICE_v3_etaGap10[nPointsSP_0001ALICE_v3_etaGap10] = {0.250000,0.350000,0.450000,0.550000,0.650000,
2638 0.750000,0.850000,0.950000,1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
2639 Double_t ySP_0001ALICE_v3_etaGap10[nPointsSP_0001ALICE_v3_etaGap10] = {0.006373,0.008403,0.010848,0.011505,0.016728,
2640 0.018519,0.020163,0.027119,0.029315,0.036832,0.040974,0.043287,0.054395,0.060676,0.081763,0.074333,0.096016,0.074909};
2641 Double_t xErrSP_0001ALICE_v3_etaGap10[nPointsSP_0001ALICE_v3_etaGap10] = {0.};
2642 Double_t yErrSP_0001ALICE_v3_etaGap10[nPointsSP_0001ALICE_v3_etaGap10] = {0.001286,0.001269,0.001346,0.001474,0.001620,
2643 0.001796,0.001991,0.002187,0.001803,0.002203,0.002697,0.003316,0.004078,0.003640,0.006050,0.009873,0.015824,0.020174};
2644 TGraphErrors *SP_0001ALICE_v3_etaGap10 = new TGraphErrors(nPointsSP_0001ALICE_v3_etaGap10,xSP_0001ALICE_v3_etaGap10,ySP_0001ALICE_v3_etaGap10,
2645 xErrSP_0001ALICE_v3_etaGap10,yErrSP_0001ALICE_v3_etaGap10);
2646 SP_0001ALICE_v3_etaGap10->SetMarkerStyle(kOpenTriangleUp);
2647 SP_0001ALICE_v3_etaGap10->SetMarkerSize(1.2);
2648 SP_0001ALICE_v3_etaGap10->SetMarkerColor(kGreen+2);
2649 SP_0001ALICE_v3_etaGap10->SetFillStyle(1001);
2650 SP_0001ALICE_v3_etaGap10->SetFillColor(kGreen-10);
2651
2652 return SP_0001ALICE_v3_etaGap10;
2653 }
2654
2655 if (n == 4)
2656 {
2657 // v4{SP}(pt) for 0-1%, rapidity gap = 1.0:
2658 const Int_t nPointsSP_0001ALICE_v4_etaGap10 = 11;
2659 Double_t xSP_0001ALICE_v4_etaGap10[nPointsSP_0001ALICE_v4_etaGap10] = {0.300000,0.500000,0.700000,0.900000,1.200000,1.600000,2.000000,2.400000,2.800000,3.500000,4.500000};
2660 Double_t ySP_0001ALICE_v4_etaGap10[nPointsSP_0001ALICE_v4_etaGap10] = {-0.000458,0.006444,0.005490,0.010870,0.018866,0.024370,0.029703,0.052505,0.060334,0.048189,0.128184};
2661 Double_t xErrSP_0001ALICE_v4_etaGap10[nPointsSP_0001ALICE_v4_etaGap10] = {0.};
2662 Double_t yErrSP_0001ALICE_v4_etaGap10[nPointsSP_0001ALICE_v4_etaGap10] = {0.001901,0.002012,0.002477,0.003014,0.002852,0.004297,0.006491,0.009846,0.014623,0.017120,0.040568};
2663 TGraphErrors *SP_0001ALICE_v4_etaGap10 = new TGraphErrors(nPointsSP_0001ALICE_v4_etaGap10,xSP_0001ALICE_v4_etaGap10,ySP_0001ALICE_v4_etaGap10,
2664 xErrSP_0001ALICE_v4_etaGap10,yErrSP_0001ALICE_v4_etaGap10);
2665 SP_0001ALICE_v4_etaGap10->SetMarkerStyle(kOpenSquare);
2666 SP_0001ALICE_v4_etaGap10->SetMarkerColor(kRed);
2667 SP_0001ALICE_v4_etaGap10->SetFillStyle(1001);
2668 SP_0001ALICE_v4_etaGap10->SetFillColor(kRed-10);
2669
2670 return SP_0001ALICE_v4_etaGap10;
2671 }
2672
2673 if (n == 5)
2674 {
2675 // v5{SP}(pt) for 0-1%, rapidity gap = 1.0:
2676 const Int_t nPointsSP_0001ALICE_v5_etaGap10 = 11;
2677 Double_t xSP_0001ALICE_v5_etaGap10[nPointsSP_0001ALICE_v5_etaGap10] = {0.300000,0.500000,0.700000,0.900000,1.200000,1.600000,2.000000,2.400000,2.800000,3.500000,4.500000};
2678 Double_t ySP_0001ALICE_v5_etaGap10[nPointsSP_0001ALICE_v5_etaGap10] = {0.007022,0.001344,0.008380,0.004298,-0.001444,0.014114,0.015012,0.041880,0.019820,0.042083,0.015268};
2679 Double_t xErrSP_0001ALICE_v5_etaGap10[nPointsSP_0001ALICE_v5_etaGap10] = {0.};
2680 Double_t yErrSP_0001ALICE_v5_etaGap10[nPointsSP_0001ALICE_v5_etaGap10] = {0.002713,0.003167,0.003741,0.004650,0.004525,0.006578,0.009986,0.015185,0.022535,0.026356,0.064773};
2681 TGraphErrors *SP_0001ALICE_v5_etaGap10 = new TGraphErrors(nPointsSP_0001ALICE_v5_etaGap10,xSP_0001ALICE_v5_etaGap10,ySP_0001ALICE_v5_etaGap10,
2682 xErrSP_0001ALICE_v5_etaGap10,yErrSP_0001ALICE_v5_etaGap10);
2683 return SP_0001ALICE_v5_etaGap10;
2684 }
2685}
2686
2687TGraphErrors* GetFlow02_Rap10(Int_t n)
2688{
2689 // private communication 20.04.11, Ante B. / Raimond
2690
2691 if (n == 2)
2692 {
2693 // v2{SP}(pt) for 00-02%, eta gap = 1.0:
2694 const Int_t nPointsSP_0002_v2_etaGap10 = 15;
2695 Double_t xSP_0002_v2_etaGap10[nPointsSP_0002_v2_etaGap10] = {0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,
2696 0.900000,1.100000,1.350000,1.650000,1.950000,2.250000,2.700000,3.500000,4.500000};
2697 Double_t ySP_0002_v2_etaGap10[nPointsSP_0002_v2_etaGap10] = {0.010171,0.013190,0.017342,0.020629,0.022617,0.026549,
2698 0.027423,0.032261,0.037467,0.041001,0.045763,0.049327,0.049688,0.051480,0.038527};
2699 Double_t xErrSP_0002_v2_etaGap10[nPointsSP_0002_v2_etaGap10] = {0.};
2700 Double_t yErrSP_0002_v2_etaGap10[nPointsSP_0002_v2_etaGap10] = {0.000600,0.000590,0.000625,0.000683,0.000757,0.000839,
2701 0.000692,0.000848,0.000888,0.001209,0.001653,0.002252,0.002465,0.003968,0.009391};
2702 TGraphErrors *SP_0002_v2_etaGap10 = new TGraphErrors(nPointsSP_0002_v2_etaGap10,xSP_0002_v2_etaGap10,ySP_0002_v2_etaGap10,
2703 xErrSP_0002_v2_etaGap10,yErrSP_0002_v2_etaGap10);
2704
2705 return SP_0002_v2_etaGap10;
2706 }
2707
2708 if (n == 3)
2709 {
2710 const Int_t nPointsSP_0002_v3_etaGap10 = 15;
2711 Double_t xSP_0002_v3_etaGap10[nPointsSP_0002_v3_etaGap10] = {0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,
2712 0.900000,1.100000,1.350000,1.650000,1.950000,2.250000,2.700000,3.500000,4.500000};
2713 Double_t ySP_0002_v3_etaGap10[nPointsSP_0002_v3_etaGap10] = {0.006592,0.007286,0.012180,0.012242,0.017416,0.018393,
2714 0.024716,0.030980,0.037703,0.046558,0.051285,0.064613,0.074831,0.077093,0.082442};
2715 Double_t xErrSP_0002_v3_etaGap10[nPointsSP_0002_v3_etaGap10] = {0.};
2716 Double_t yErrSP_0002_v3_etaGap10[nPointsSP_0002_v3_etaGap10] = {0.000682,0.000676,0.000713,0.000782,0.000860,0.000953,
2717 0.000782,0.000957,0.001002,0.001361,0.001862,0.002541,0.002767,0.004466,0.010586};
2718 TGraphErrors *SP_0002_v3_etaGap10 = new TGraphErrors(nPointsSP_0002_v3_etaGap10,xSP_0002_v3_etaGap10,ySP_0002_v3_etaGap10,
2719 xErrSP_0002_v3_etaGap10,yErrSP_0002_v3_etaGap10);
2720
2721 return SP_0002_v3_etaGap10;
2722 }
2723
2724 if (n == 4)
2725 {
2726 const Int_t nPointsSP_0002_v4_etaGap10 = 15;
2727 Double_t xSP_0002_v4_etaGap10[nPointsSP_0002_v4_etaGap10] = {0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,
2728 0.900000,1.100000,1.350000,1.650000,1.950000,2.250000,2.700000,3.500000,4.500000};
2729 Double_t ySP_0002_v4_etaGap10[nPointsSP_0002_v4_etaGap10] = {-0.000533,0.001167,0.002081,0.005218,0.006826,0.008440,
2730 0.013009,0.014812,0.017125,0.030106,0.038279,0.050488,0.067640,0.071637,0.084239};
2731 Double_t xErrSP_0002_v4_etaGap10[nPointsSP_0002_v4_etaGap10] = {0.};
2732 Double_t yErrSP_0002_v4_etaGap10[nPointsSP_0002_v4_etaGap10] = {0.001427,0.001398,0.001482,0.001594,0.001758,0.001945,
2733 0.001593,0.001951,0.002046,0.002787,0.003802,0.005182,0.005663,0.009064,0.021449};
2734 TGraphErrors *SP_0002_v4_etaGap10 = new TGraphErrors(nPointsSP_0002_v4_etaGap10,xSP_0002_v4_etaGap10,ySP_0002_v4_etaGap10,
2735 xErrSP_0002_v4_etaGap10,yErrSP_0002_v4_etaGap10);
2736 return SP_0002_v4_etaGap10;
2737 }
2738
2739 if (n == 5)
2740 {
2741 // v5{SP}(pt) for 00-02%, eta gap = 0.2:
2742 const Int_t nPointsSP_0002_v5_etaGap02 = 13;
2743 Double_t xSP_0002_v5_etaGap02[nPointsSP_0002_v5_etaGap02] = {0.300000,0.500000,0.700000,0.900000,1.100000,1.300000,1.500000,
2744 1.700000,2.000000,2.550000,3.250000,3.950000,4.650000};
2745 Double_t ySP_0002_v5_etaGap02[nPointsSP_0002_v5_etaGap02] = {0.000570,0.002922,0.002151,0.005256,0.006287,0.005849,0.009399,
2746 0.011420,0.012455,0.032134,0.057009,0.020607,0.013551};
2747 Double_t xErrSP_0002_v5_etaGap02[nPointsSP_0002_v5_etaGap02] = {0.};
2748 Double_t yErrSP_0002_v5_etaGap02[nPointsSP_0002_v5_etaGap02] = {0.001074,0.001155,0.001433,0.001725,0.002123,0.002608,0.003196,
2749 0.003930,0.003755,0.004869,0.009719,0.018353,0.031814};
2750 TGraphErrors *SP_0002_v5_etaGap02 = new TGraphErrors(nPointsSP_0002_v5_etaGap02,xSP_0002_v5_etaGap02,ySP_0002_v5_etaGap02,
2751 xErrSP_0002_v5_etaGap02,yErrSP_0002_v5_etaGap02);
2752 return SP_0002_v5_etaGap02;
2753 }
2754}
2755
2756TGraphErrors* GetFlow02(Int_t n)
2757{
2758 // private communication 28.01.11, Ante B. / Raimond
2759
2760 if (n == 2)
2761 {
2762 // v2{2}(pt):
2763 Double_t xCumulant2nd0002ALICE_v2[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
2764 1.050000,1.150000,1.250000,1.350000,1.450000,1.550000,1.650000,1.750000,1.850000,1.950000,
2765 2.250000,2.750000,3.250000,3.750000,4.250000,4.750000,5.500000,6.500000,7.500000,8.500000,
2766 9.500000};
2767 Double_t yCumulant2nd0002ALICE_v2[] = {0.000000,0.000000,0.012173,0.015186,0.018580,0.021114,0.024646,0.027040,0.030269,0.032677,
2768 0.035332,0.037382,0.039228,0.040614,0.042460,0.044658,0.046246,0.050392,0.051436,0.054669,
2769 0.057330,0.063439,0.067425,0.060144,0.071260,0.070206,0.000000,0.000000,0.000000,0.000000,
2770 0.000000};
2771 Double_t xErrCumulant2nd0002ALICE_v2[31] = {0.};
2772 Double_t yErrCumulant2nd0002ALICE_v2[] = {0.000000,0.000000,0.000256,0.000259,0.000271,0.000296,0.000322,0.000357,0.000397,0.000438,
2773 0.000483,0.000529,0.000590,0.000639,0.000713,0.000793,0.000877,0.000976,0.001070,0.001197,
2774 0.000725,0.001265,0.002069,0.003156,0.004605,0.006543,0.000000,0.000000,0.000000,0.000000,
2775 0.000000};
2776 Int_t nPointsCumulant2nd0002ALICE_v2 = sizeof(xCumulant2nd0002ALICE_v2)/sizeof(Double_t);
2777 TGraphErrors *Cumulant2nd0002ALICE_v2 = new TGraphErrors(nPointsCumulant2nd0002ALICE_v2,xCumulant2nd0002ALICE_v2,yCumulant2nd0002ALICE_v2,
2778 xErrCumulant2nd0002ALICE_v2,yErrCumulant2nd0002ALICE_v2);
2779 Cumulant2nd0002ALICE_v2->SetMarkerStyle(kFullCircle);
2780 Cumulant2nd0002ALICE_v2->SetMarkerColor(kBlue);
2781
2782 return Cumulant2nd0002ALICE_v2;
2783 }
2784
2785 if (n == 3)
2786 {
2787 // v3{2}(pt):
2788 Double_t xCumulant2nd0002ALICE_v3[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
2789 1.050000,1.150000,1.250000,1.350000,1.450000,1.550000,1.650000,1.750000,1.850000,1.950000,
2790 2.250000,2.750000,3.250000,3.750000,4.250000,4.750000,5.500000,6.500000,7.500000,8.500000,
2791 9.500000};
2792 Double_t yCumulant2nd0002ALICE_v3[] = {0.000000,0.000000,0.007696,0.008994,0.010544,0.013269,0.016330,0.019234,0.023465,0.026803,
2793 0.029906,0.032211,0.035300,0.038158,0.041861,0.046002,0.049382,0.053574,0.055773,0.059420,
2794 0.069373,0.079922,0.090265,0.103583,0.111358,0.090740,0.000000,0.000000,0.000000,0.000000,
2795 0.000000};
2796 Double_t xErrCumulant2nd0002ALICE_v3[31] = {0.};
2797 Double_t yErrCumulant2nd0002ALICE_v3[] = {0.000000,0.000000,0.000318,0.000317,0.000333,0.000360,0.000392,0.000431,0.000476,0.000523,
2798 0.000575,0.000637,0.000707,0.000785,0.000878,0.000964,0.001064,0.001175,0.001320,0.001459,
2799 0.000889,0.001539,0.002530,0.003826,0.005614,0.007892,0.000000,0.000000,0.000000,0.000000,
2800 0.000000};
2801 Int_t nPointsCumulant2nd0002ALICE_v3 = sizeof(xCumulant2nd0002ALICE_v3)/sizeof(Double_t);
2802 TGraphErrors *Cumulant2nd0002ALICE_v3 = new TGraphErrors(nPointsCumulant2nd0002ALICE_v3,xCumulant2nd0002ALICE_v3,yCumulant2nd0002ALICE_v3,
2803 xErrCumulant2nd0002ALICE_v3,yErrCumulant2nd0002ALICE_v3);
2804 Cumulant2nd0002ALICE_v3->SetMarkerStyle(kFullTriangleUp);
2805 Cumulant2nd0002ALICE_v3->SetMarkerSize(1.2);
2806 Cumulant2nd0002ALICE_v3->SetMarkerColor(kGreen+2);
2807
2808 return Cumulant2nd0002ALICE_v3;
2809 }
2810
2811 if (n == 4)
2812 {
2813 // v4{2}(pt):
2814 Double_t xCumulant2nd0002ALICE_v4[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
2815 1.050000,1.150000,1.250000,1.350000,1.450000,1.550000,1.650000,1.750000,1.850000,1.950000,
2816 2.250000,2.750000,3.250000,3.750000,4.250000,4.750000,5.500000,6.500000,7.500000,8.500000,
2817 9.500000};
2818 Double_t yCumulant2nd0002ALICE_v4[] = {0.000000,0.000000,0.005710,0.006014,0.004483,0.005453,0.007714,0.006837,0.009721,0.011288,
2819 0.012531,0.016461,0.016606,0.018587,0.022722,0.025497,0.025832,0.030994,0.030349,0.034730,
2820 0.045529,0.061153,0.074238,0.079307,0.088885,0.085218,0.000000,0.000000,0.000000,0.000000,
2821 0.000000};
2822 Double_t xErrCumulant2nd0002ALICE_v4[31] = {0.};
2823 Double_t yErrCumulant2nd0002ALICE_v4[] = {0.000000,0.000000,0.000488,0.000493,0.000523,0.000571,0.000609,0.000678,0.000742,0.000805,
2824 0.000903,0.000985,0.001100,0.001219,0.001352,0.001503,0.001682,0.001847,0.002060,0.002303,
2825 0.001400,0.002431,0.003974,0.006040,0.008901,0.012343,0.000000,0.000000,0.000000,0.000000,
2826 0.000000};
2827 Int_t nPointsCumulant2nd0002ALICE_v4 = sizeof(xCumulant2nd0002ALICE_v4)/sizeof(Double_t);
2828 TGraphErrors *Cumulant2nd0002ALICE_v4 = new TGraphErrors(nPointsCumulant2nd0002ALICE_v4,xCumulant2nd0002ALICE_v4,yCumulant2nd0002ALICE_v4,
2829 xErrCumulant2nd0002ALICE_v4,yErrCumulant2nd0002ALICE_v4);
2830 Cumulant2nd0002ALICE_v4->SetMarkerStyle(kFullSquare);
2831 Cumulant2nd0002ALICE_v4->SetMarkerColor(kRed);
2832
2833 return Cumulant2nd0002ALICE_v4;
2834 }
2835
2836 return 0;
2837}
2838
2839/* results up to 5 GeV/c
2840
2841TGraphErrors* GetFlow05(Int_t n)
2842{
2843 // private communication 02.02.11, Ante B. / Raimond
2844
2845 if (n == 2)
2846 {
2847 // v2{2}(pt) for 0-5%:
2848 Double_t xCumulant2nd0005ALICE_v2[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
2849 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
2850 Double_t yCumulant2nd0005ALICE_v2[] = {0.000000,0.000000,0.013891,0.017693,0.021693,0.025323,0.029131,0.032443,0.035781,0.038256,
2851 0.042801,0.047705,0.053229,0.057387,0.062677,0.068815,0.077695,0.082058,0.082511,0.079791};
2852 Double_t xErrCumulant2nd0005ALICE_v2[20] = {0.};
2853 Double_t yErrCumulant2nd0005ALICE_v2[] = {0.000000,0.000000,0.000149,0.000150,0.000160,0.000174,0.000191,0.000211,0.000233,0.000257,
2854 0.000208,0.000254,0.000311,0.000377,0.000464,0.000419,0.000726,0.001180,0.001791,0.002131};
2855 Int_t nPointsCumulant2nd0005ALICE_v2 = sizeof(xCumulant2nd0005ALICE_v2)/sizeof(Double_t);
2856 TGraphErrors *Cumulant2nd0005ALICE_v2 = new TGraphErrors(nPointsCumulant2nd0005ALICE_v2,xCumulant2nd0005ALICE_v2,yCumulant2nd0005ALICE_v2,
2857 xErrCumulant2nd0005ALICE_v2,yErrCumulant2nd0005ALICE_v2);
2858 Cumulant2nd0005ALICE_v2->SetMarkerStyle(kFullCircle);
2859 Cumulant2nd0005ALICE_v2->SetMarkerColor(kBlue);
2860
2861 return Cumulant2nd0005ALICE_v2;
2862 }
2863
2864 if (n == 3)
2865 {
2866 // v3{2}(pt) for 0-5%:
2867 Double_t xCumulant2nd0005ALICE_v3[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
2868 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
2869 Double_t yCumulant2nd0005ALICE_v3[] = {0.000000,0.000000,0.007788,0.009472,0.011596,0.014618,0.017540,0.021020,0.024946,0.028004,
2870 0.032330,0.039491,0.046368,0.053620,0.060662,0.071750,0.086746,0.097857,0.103111,0.104796};
2871 Double_t xErrCumulant2nd0005ALICE_v3[20] = {0.};
2872 Double_t yErrCumulant2nd0005ALICE_v3[] = {0.000000,0.000000,0.000194,0.000192,0.000204,0.000221,0.000241,0.000265,0.000293,0.000323,
2873 0.000266,0.000323,0.000397,0.000486,0.000601,0.000545,0.000947,0.001541,0.002328,0.002777};
2874 Int_t nPointsCumulant2nd0005ALICE_v3 = sizeof(xCumulant2nd0005ALICE_v3)/sizeof(Double_t);
2875 TGraphErrors *Cumulant2nd0005ALICE_v3 = new TGraphErrors(nPointsCumulant2nd0005ALICE_v3,xCumulant2nd0005ALICE_v3,yCumulant2nd0005ALICE_v3,
2876 xErrCumulant2nd0005ALICE_v3,yErrCumulant2nd0005ALICE_v3);
2877 Cumulant2nd0005ALICE_v3->SetMarkerStyle(kFullCircle);
2878 Cumulant2nd0005ALICE_v3->SetMarkerColor(kBlue);
2879
2880 return Cumulant2nd0005ALICE_v3;
2881 }
2882
2883 if (n == 4)
2884 {
2885 // v4{2}(pt) for 0-5%:
2886 Double_t xCumulant2nd0005ALICE_v4[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
2887 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
2888 Double_t yCumulant2nd0005ALICE_v4[] = {0.000000,0.000000,0.006121,0.006137,0.005598,0.005956,0.007262,0.007991,0.009159,0.012062,
2889 0.015085,0.019225,0.024782,0.030092,0.035708,0.046542,0.060077,0.076088,0.082964,0.085405};
2890 Double_t xErrCumulant2nd0005ALICE_v4[20] = {0.};
2891 Double_t yErrCumulant2nd0005ALICE_v4[] = {0.000000,0.000000,0.000275,0.000278,0.000294,0.000319,0.000346,0.000380,0.000419,0.000459,
2892 0.000378,0.000460,0.000570,0.000700,0.000865,0.000789,0.001370,0.002227,0.003370,0.004018};
2893 Int_t nPointsCumulant2nd0005ALICE_v4 = sizeof(xCumulant2nd0005ALICE_v4)/sizeof(Double_t);
2894 TGraphErrors *Cumulant2nd0005ALICE_v4 = new TGraphErrors(nPointsCumulant2nd0005ALICE_v4,xCumulant2nd0005ALICE_v4,yCumulant2nd0005ALICE_v4,
2895 xErrCumulant2nd0005ALICE_v4,yErrCumulant2nd0005ALICE_v4);
2896 Cumulant2nd0005ALICE_v4->SetMarkerStyle(kFullCircle);
2897 Cumulant2nd0005ALICE_v4->SetMarkerColor(kBlue);
2898
2899 return Cumulant2nd0005ALICE_v4;
2900 }
2901
2902 return 0;
2903}
2904
2905TGraphErrors* GetFlow510(Int_t n)
2906{
2907 // private communication 02.02.11, Ante B. / Raimond
2908
2909 if (n == 2)
2910 {
2911 // v2{2}(pt) for 5-10%:
2912 Double_t xCumulant2nd0510ALICE_v2[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
2913 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
2914 Double_t yCumulant2nd0510ALICE_v2[] = {0.000000,0.000000,0.019872,0.026451,0.032901,0.039085,0.044930,0.050200,0.054887,0.060253,
2915 0.066587,0.075080,0.083303,0.090298,0.098782,0.109632,0.124486,0.129621,0.132076,0.120697};
2916 Double_t xErrCumulant2nd0510ALICE_v2[20] = {0.};
2917 Double_t yErrCumulant2nd0510ALICE_v2[] = {0.000000,0.000000,0.000150,0.000152,0.000163,0.000178,0.000196,0.000215,0.000237,0.000261,
2918 0.000213,0.000256,0.000313,0.000381,0.000468,0.000423,0.000727,0.001157,0.001741,0.002064};
2919 Int_t nPointsCumulant2nd0510ALICE_v2 = sizeof(xCumulant2nd0510ALICE_v2)/sizeof(Double_t);
2920 TGraphErrors *Cumulant2nd0510ALICE_v2 = new TGraphErrors(nPointsCumulant2nd0510ALICE_v2,xCumulant2nd0510ALICE_v2,yCumulant2nd0510ALICE_v2,
2921 xErrCumulant2nd0510ALICE_v2,yErrCumulant2nd0510ALICE_v2);
2922 Cumulant2nd0510ALICE_v2->SetMarkerStyle(kOpenCircle);
2923 Cumulant2nd0510ALICE_v2->SetMarkerColor(kBlue);
2924
2925 return Cumulant2nd0510ALICE_v2;
2926 }
2927
2928 if (n == 3)
2929 {
2930 // v3{2}(pt) for 5-10%:
2931 Double_t xCumulant2nd0510ALICE_v3[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
2932 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
2933 Double_t yCumulant2nd0510ALICE_v3[] = {0.000000,0.000000,0.008596,0.010700,0.013820,0.017524,0.021507,0.024316,0.028491,0.032880,
2934 0.038741,0.045830,0.052486,0.059560,0.067990,0.081006,0.097402,0.107050,0.111743,0.116434};
2935 Double_t xErrCumulant2nd0510ALICE_v3[20] = {0.};
2936 Double_t yErrCumulant2nd0510ALICE_v3[] = {0.000000,0.000000,0.000208,0.000207,0.000218,0.000235,0.000258,0.000284,0.000314,0.000347,
2937 0.000285,0.000345,0.000426,0.000521,0.000642,0.000586,0.001008,0.001611,0.002421,0.002853};
2938 Int_t nPointsCumulant2nd0510ALICE_v3 = sizeof(xCumulant2nd0510ALICE_v3)/sizeof(Double_t);
2939 TGraphErrors *Cumulant2nd0510ALICE_v3 = new TGraphErrors(nPointsCumulant2nd0510ALICE_v3,xCumulant2nd0510ALICE_v3,yCumulant2nd0510ALICE_v3,
2940 xErrCumulant2nd0510ALICE_v3,yErrCumulant2nd0510ALICE_v3);
2941 Cumulant2nd0510ALICE_v3->SetMarkerStyle(kOpenCircle);
2942 Cumulant2nd0510ALICE_v3->SetMarkerColor(kBlue);
2943
2944 return Cumulant2nd0510ALICE_v3;
2945 }
2946
2947 if (n == 4)
2948 {
2949 // v4{2}(pt) for 5-10%:
2950 Double_t xCumulant2nd0510ALICE_v4[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
2951 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
2952 Double_t yCumulant2nd0510ALICE_v4[] = {0.000000,0.000000,0.006466,0.006731,0.006344,0.007374,0.008775,0.010324,0.012323,0.014533,
2953 0.017261,0.022507,0.028776,0.035403,0.041936,0.051491,0.070340,0.080081,0.095077,0.088526};
2954 Double_t xErrCumulant2nd0510ALICE_v4[20] = {0.};
2955 Double_t yErrCumulant2nd0510ALICE_v4[] = {0.000000,0.000000,0.000292,0.000295,0.000312,0.000336,0.000366,0.000403,0.000443,0.000485,
2956 0.000399,0.000486,0.000603,0.000738,0.000914,0.000836,0.001443,0.002303,0.003448,0.004078};
2957 Int_t nPointsCumulant2nd0510ALICE_v4 = sizeof(xCumulant2nd0510ALICE_v4)/sizeof(Double_t);
2958 TGraphErrors *Cumulant2nd0510ALICE_v4 = new TGraphErrors(nPointsCumulant2nd0510ALICE_v4,xCumulant2nd0510ALICE_v4,yCumulant2nd0510ALICE_v4,
2959 xErrCumulant2nd0510ALICE_v4,yErrCumulant2nd0510ALICE_v4);
2960 Cumulant2nd0510ALICE_v4->SetMarkerStyle(kOpenCircle);
2961 Cumulant2nd0510ALICE_v4->SetMarkerColor(kBlue);
2962
2963 return Cumulant2nd0510ALICE_v4;
2964 }
2965
2966 return 0;
2967}
2968
2969TGraphErrors* GetFlow1020(Int_t n)
2970{
2971 // private communication 02.02.11, Ante B. / Raimond
2972
2973 if (n == 2)
2974 {
2975 // v2{2}(pt) for 10-20%:
2976 Double_t xCumulant2nd1020ALICE_v2[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
2977 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
2978 Double_t yCumulant2nd1020ALICE_v2[] = {0.000000,0.000000,0.027683,0.037083,0.046511,0.055519,0.063979,0.071626,0.078537,0.085975,
2979 0.095001,0.106979,0.118456,0.129721,0.140641,0.155161,0.173402,0.179870,0.180616,0.168921};
2980 Double_t xErrCumulant2nd1020ALICE_v2[20] = {0.};
2981 Double_t yErrCumulant2nd1020ALICE_v2[] = {0.000000,0.000000,0.000121,0.000124,0.000134,0.000147,0.000163,0.000179,0.000198,0.000217,
2982 0.000177,0.000212,0.000257,0.000311,0.000380,0.000341,0.000569,0.000882,0.001309,0.001537};
2983 Int_t nPointsCumulant2nd1020ALICE_v2 = sizeof(xCumulant2nd1020ALICE_v2)/sizeof(Double_t);
2984 TGraphErrors *Cumulant2nd1020ALICE_v2 = new TGraphErrors(nPointsCumulant2nd1020ALICE_v2,xCumulant2nd1020ALICE_v2,yCumulant2nd1020ALICE_v2,
2985 xErrCumulant2nd1020ALICE_v2,yErrCumulant2nd1020ALICE_v2);
2986 Cumulant2nd1020ALICE_v2->SetMarkerStyle(kFullSquare);
2987 Cumulant2nd1020ALICE_v2->SetMarkerColor(kRed);
2988
2989 return Cumulant2nd1020ALICE_v2;
2990 }
2991
2992 if (n == 3)
2993 {
2994 // v3{2}(pt) for 10-20%:
2995 Double_t xCumulant2nd1020ALICE_v3[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
2996 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
2997 Double_t yCumulant2nd1020ALICE_v3[] = {0.000000,0.000000,0.009830,0.012858,0.016111,0.020120,0.023948,0.028349,0.032741,0.037244,
2998 0.043385,0.051803,0.059374,0.068686,0.076763,0.090151,0.106530,0.117448,0.121383,0.118247};
2999 Double_t xErrCumulant2nd1020ALICE_v3[20] = {0.};
3000 Double_t yErrCumulant2nd1020ALICE_v3[] = {0.000000,0.000000,0.000171,0.000170,0.000180,0.000195,0.000215,0.000236,0.000261,0.000287,
3001 0.000236,0.000288,0.000353,0.000434,0.000536,0.000488,0.000823,0.001277,0.001892,0.002224};
3002 Int_t nPointsCumulant2nd1020ALICE_v3 = sizeof(xCumulant2nd1020ALICE_v3)/sizeof(Double_t);
3003 TGraphErrors *Cumulant2nd1020ALICE_v3 = new TGraphErrors(nPointsCumulant2nd1020ALICE_v3,xCumulant2nd1020ALICE_v3,yCumulant2nd1020ALICE_v3,
3004 xErrCumulant2nd1020ALICE_v3,yErrCumulant2nd1020ALICE_v3);
3005 Cumulant2nd1020ALICE_v3->SetMarkerStyle(kFullSquare);
3006 Cumulant2nd1020ALICE_v3->SetMarkerColor(kRed);
3007
3008 return Cumulant2nd1020ALICE_v3;
3009 }
3010
3011 if (n == 4)
3012 {
3013 // v4{2}(pt) for 10-20%:
3014 Double_t xCumulant2nd1020ALICE_v4[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
3015 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
3016 Double_t yCumulant2nd1020ALICE_v4[] = {0.000000,0.000000,0.007423,0.007647,0.008189,0.008592,0.009489,0.011671,0.013739,0.017199,
3017 0.020084,0.026004,0.031843,0.038388,0.047357,0.057251,0.072433,0.086326,0.094282,0.097432};
3018 Double_t xErrCumulant2nd1020ALICE_v4[20] = {0.};
3019 Double_t yErrCumulant2nd1020ALICE_v4[] = {0.000000,0.000000,0.000243,0.000244,0.000257,0.000279,0.000306,0.000335,0.000368,0.000405,
3020 0.000333,0.000406,0.000502,0.000618,0.000770,0.000701,0.001185,0.001845,0.002730,0.003193};
3021 Int_t nPointsCumulant2nd1020ALICE_v4 = sizeof(xCumulant2nd1020ALICE_v4)/sizeof(Double_t);
3022 TGraphErrors *Cumulant2nd1020ALICE_v4 = new TGraphErrors(nPointsCumulant2nd1020ALICE_v4,xCumulant2nd1020ALICE_v4,yCumulant2nd1020ALICE_v4,
3023 xErrCumulant2nd1020ALICE_v4,yErrCumulant2nd1020ALICE_v4);
3024 Cumulant2nd1020ALICE_v4->SetMarkerStyle(kFullSquare);
3025 Cumulant2nd1020ALICE_v4->SetMarkerColor(kRed);
3026
3027 return Cumulant2nd1020ALICE_v4;
3028 }
3029
3030 return 0;
3031}
3032
3033TGraphErrors* GetFlow2030(Int_t n)
3034{
3035 // private communication 02.02.11, Ante B. / Raimond
3036
3037 if (n == 2)
3038 {
3039 Double_t xCumulant2nd2030ALICE_v2[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
3040 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
3041 Double_t yCumulant2nd2030ALICE_v2[] = {0.000000,0.000000,0.035557,0.048064,0.060768,0.072585,0.083808,0.093772,0.103310,0.112602,
3042 0.124846,0.140603,0.155345,0.169450,0.183077,0.200173,0.219693,0.225741,0.223318,0.207356};
3043 Double_t xErrCumulant2nd2030ALICE_v2[20] = {0.};
3044 Double_t yErrCumulant2nd2030ALICE_v2[] = {0.000000,0.000000,0.000144,0.000147,0.000159,0.000175,0.000194,0.000214,0.000235,0.000259,
3045 0.000211,0.000254,0.000310,0.000377,0.000464,0.000418,0.000677,0.001027,0.001513,0.001761};
3046 Int_t nPointsCumulant2nd2030ALICE_v2 = sizeof(xCumulant2nd2030ALICE_v2)/sizeof(Double_t);
3047 TGraphErrors *Cumulant2nd2030ALICE_v2 = new TGraphErrors(nPointsCumulant2nd2030ALICE_v2,xCumulant2nd2030ALICE_v2,yCumulant2nd2030ALICE_v2,
3048 xErrCumulant2nd2030ALICE_v2,yErrCumulant2nd2030ALICE_v2);
3049 Cumulant2nd2030ALICE_v2->SetMarkerStyle(kOpenSquare);
3050 Cumulant2nd2030ALICE_v2->SetMarkerColor(kRed);
3051
3052 return Cumulant2nd2030ALICE_v2;
3053 }
3054
3055 if (n == 3)
3056 {
3057 // v3{2}(pt) for 20-30%:
3058 Double_t xCumulant2nd2030ALICE_v3[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
3059 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
3060 Double_t yCumulant2nd2030ALICE_v3[] = {0.000000,0.000000,0.011287,0.014937,0.018479,0.022962,0.027854,0.031938,0.037038,0.041443,
3061 0.049872,0.058720,0.068353,0.077692,0.087859,0.099863,0.116141,0.124486,0.124786,0.119520};
3062 Double_t xErrCumulant2nd2030ALICE_v3[20] = {0.};
3063 Double_t yErrCumulant2nd2030ALICE_v3[] = {0.000000,0.000000,0.000215,0.000216,0.000228,0.000248,0.000272,0.000300,0.000332,0.000366,
3064 0.000301,0.000369,0.000456,0.000561,0.000700,0.000636,0.001038,0.001574,0.002307,0.002676};
3065 Int_t nPointsCumulant2nd2030ALICE_v3 = sizeof(xCumulant2nd2030ALICE_v3)/sizeof(Double_t);
3066 TGraphErrors *Cumulant2nd2030ALICE_v3 = new TGraphErrors(nPointsCumulant2nd2030ALICE_v3,xCumulant2nd2030ALICE_v3,yCumulant2nd2030ALICE_v3,
3067 xErrCumulant2nd2030ALICE_v3,yErrCumulant2nd2030ALICE_v3);
3068 Cumulant2nd2030ALICE_v3->SetMarkerStyle(kOpenSquare);
3069 Cumulant2nd2030ALICE_v3->SetMarkerColor(kRed);
3070
3071 return Cumulant2nd2030ALICE_v3;
3072 }
3073
3074 if (n == 4)
3075 {
3076 // v4{2}(pt) for 20-30%:
3077 Double_t xCumulant2nd2030ALICE_v4[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
3078 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
3079 Double_t yCumulant2nd2030ALICE_v4[] = {0.000000,0.000000,0.008435,0.009824,0.009387,0.010408,0.011458,0.013770,0.016335,0.019165,
3080 0.023770,0.030071,0.036231,0.043950,0.051803,0.065222,0.082155,0.091864,0.105061,0.105167};
3081 Double_t xErrCumulant2nd2030ALICE_v4[20] = {0.};
3082 Double_t yErrCumulant2nd2030ALICE_v4[] = {0.000000,0.000000,0.000308,0.000308,0.000328,0.000355,0.000391,0.000430,0.000473,0.000524,
3083 0.000430,0.000524,0.000652,0.000807,0.001006,0.000919,0.001502,0.002277,0.003339,0.003871};
3084 Int_t nPointsCumulant2nd2030ALICE_v4 = sizeof(xCumulant2nd2030ALICE_v4)/sizeof(Double_t);
3085 TGraphErrors *Cumulant2nd2030ALICE_v4 = new TGraphErrors(nPointsCumulant2nd2030ALICE_v4,xCumulant2nd2030ALICE_v4,yCumulant2nd2030ALICE_v4,
3086 xErrCumulant2nd2030ALICE_v4,yErrCumulant2nd2030ALICE_v4);
3087 Cumulant2nd2030ALICE_v4->SetMarkerStyle(kOpenSquare);
3088 Cumulant2nd2030ALICE_v4->SetMarkerColor(kRed);
3089
3090 return Cumulant2nd2030ALICE_v4;
3091 }
3092
3093 return 0;
3094}
3095
3096TGraphErrors* GetFlow3040(Int_t n)
3097{
3098 // private communication 02.02.11, Ante B. / Raimond
3099
3100 if (n == 2)
3101 {
3102 // v2{2}(pt) for 30-40%:
3103 Double_t xCumulant2nd3040ALICE_v2[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
3104 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
3105 Double_t yCumulant2nd3040ALICE_v2[] = {0.000000,0.000000,0.040797,0.055427,0.070543,0.084024,0.096562,0.109411,0.119853,0.130964,
3106 0.145377,0.163806,0.179825,0.196178,0.210377,0.226556,0.245686,0.247898,0.240058,0.225011};
3107 Double_t xErrCumulant2nd3040ALICE_v2[20] = {0.};
3108 Double_t yErrCumulant2nd3040ALICE_v2[] = {0.000000,0.000000,0.000177,0.000182,0.000197,0.000216,0.000239,0.000265,0.000293,0.000325,
3109 0.000266,0.000321,0.000395,0.000486,0.000603,0.000536,0.000840,0.001258,0.001843,0.002118};
3110 Int_t nPointsCumulant2nd3040ALICE_v2 = sizeof(xCumulant2nd3040ALICE_v2)/sizeof(Double_t);
3111 TGraphErrors *Cumulant2nd3040ALICE_v2 = new TGraphErrors(nPointsCumulant2nd3040ALICE_v2,xCumulant2nd3040ALICE_v2,yCumulant2nd3040ALICE_v2,
3112 xErrCumulant2nd3040ALICE_v2,yErrCumulant2nd3040ALICE_v2);
3113 Cumulant2nd3040ALICE_v2->SetMarkerStyle(kFullTriangleUp);
3114 Cumulant2nd3040ALICE_v2->SetMarkerSize(1.2);
3115 Cumulant2nd3040ALICE_v2->SetMarkerColor(kGreen+2);
3116
3117 return Cumulant2nd3040ALICE_v2;
3118 }
3119
3120 if (n == 3)
3121 {
3122 // v3{2}(pt) for 30-40%:
3123 Double_t xCumulant2nd3040ALICE_v3[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
3124 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
3125 Double_t yCumulant2nd3040ALICE_v3[] = {0.000000,0.000000,0.012226,0.016391,0.020792,0.026208,0.030380,0.035710,0.041025,0.047062,
3126 0.053075,0.064201,0.074116,0.085314,0.094391,0.106819,0.124012,0.129388,0.134315,0.132330};
3127 Double_t xErrCumulant2nd3040ALICE_v3[20] = {0.};
3128 Double_t yErrCumulant2nd3040ALICE_v3[] = {0.000000,0.000000,0.000284,0.000286,0.000303,0.000329,0.000364,0.000403,0.000443,0.000492,
3129 0.000408,0.000500,0.000627,0.000778,0.000973,0.000874,0.001375,0.002050,0.002992,0.003438};
3130 Int_t nPointsCumulant2nd3040ALICE_v3 = sizeof(xCumulant2nd3040ALICE_v3)/sizeof(Double_t);
3131 TGraphErrors *Cumulant2nd3040ALICE_v3 = new TGraphErrors(nPointsCumulant2nd3040ALICE_v3,xCumulant2nd3040ALICE_v3,yCumulant2nd3040ALICE_v3,
3132 xErrCumulant2nd3040ALICE_v3,yErrCumulant2nd3040ALICE_v3);
3133 Cumulant2nd3040ALICE_v3->SetMarkerStyle(kFullTriangleUp);
3134 Cumulant2nd3040ALICE_v3->SetMarkerSize(1.2);
3135 Cumulant2nd3040ALICE_v3->SetMarkerColor(kGreen+2);
3136
3137 return Cumulant2nd3040ALICE_v3;
3138 }
3139
3140 if (n == 4)
3141 {
3142 // v4{2}(pt) for 30-40%:
3143 Double_t xCumulant2nd3040ALICE_v4[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
3144 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
3145 Double_t yCumulant2nd3040ALICE_v4[] = {0.000000,0.000000,0.010718,0.011490,0.010994,0.012527,0.013748,0.016425,0.018857,0.021622,
3146 0.026853,0.034636,0.042651,0.049892,0.057795,0.070865,0.088486,0.101656,0.113886,0.118202};
3147 Double_t xErrCumulant2nd3040ALICE_v4[20] = {0.};
3148 Double_t yErrCumulant2nd3040ALICE_v4[] = {0.000000,0.000000,0.000401,0.000406,0.000433,0.000472,0.000521,0.000575,0.000634,0.000704,
3149 0.000580,0.000714,0.000890,0.001114,0.001398,0.001253,0.001974,0.002945,0.004290,0.004909};
3150 Int_t nPointsCumulant2nd3040ALICE_v4 = sizeof(xCumulant2nd3040ALICE_v4)/sizeof(Double_t);
3151 TGraphErrors *Cumulant2nd3040ALICE_v4 = new TGraphErrors(nPointsCumulant2nd3040ALICE_v4,xCumulant2nd3040ALICE_v4,yCumulant2nd3040ALICE_v4,
3152 xErrCumulant2nd3040ALICE_v4,yErrCumulant2nd3040ALICE_v4);
3153 Cumulant2nd3040ALICE_v4->SetMarkerStyle(kFullTriangleUp);
3154 Cumulant2nd3040ALICE_v4->SetMarkerSize(1.2);
3155 Cumulant2nd3040ALICE_v4->SetMarkerColor(kGreen+2);
3156
3157 return Cumulant2nd3040ALICE_v4;
3158 }
3159
3160 return 0;
3161}
3162
3163TGraphErrors* GetFlow4050(Int_t n)
3164{
3165 // private communication 02.02.11, Ante B. / Raimond
3166
3167 if (n == 2)
3168 {
3169 // v2{2}(pt) for 40-50%:
3170 Double_t xCumulant2nd4050ALICE_v2[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
3171 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
3172 Double_t yCumulant2nd4050ALICE_v2[] = {0.000000,0.000000,0.043593,0.059522,0.075558,0.090681,0.104453,0.117913,0.129349,0.141743,
3173 0.157076,0.176121,0.193651,0.208844,0.222402,0.238407,0.252512,0.253592,0.243571,0.233018};
3174 Double_t xErrCumulant2nd4050ALICE_v2[20] = {0.};
3175 Double_t yErrCumulant2nd4050ALICE_v2[] = {0.000000,0.000000,0.000234,0.000241,0.000261,0.000288,0.000322,0.000357,0.000395,0.000438,
3176 0.000362,0.000447,0.000555,0.000685,0.000846,0.000733,0.001121,0.001665,0.002433,0.002768};
3177 Int_t nPointsCumulant2nd4050ALICE_v2 = sizeof(xCumulant2nd4050ALICE_v2)/sizeof(Double_t);
3178 TGraphErrors *Cumulant2nd4050ALICE_v2 = new TGraphErrors(nPointsCumulant2nd4050ALICE_v2,xCumulant2nd4050ALICE_v2,yCumulant2nd4050ALICE_v2,
3179 xErrCumulant2nd4050ALICE_v2,yErrCumulant2nd4050ALICE_v2);
3180 Cumulant2nd4050ALICE_v2->SetMarkerStyle(kOpenTriangleUp);
3181 Cumulant2nd4050ALICE_v2->SetMarkerSize(1.2);
3182 Cumulant2nd4050ALICE_v2->SetMarkerColor(kGreen+2);
3183
3184 return Cumulant2nd4050ALICE_v2;
3185 }
3186
3187 return 0;
3188}
3189*/
3190
3191// results up to high pT
3192
3193TGraphErrors* GetFlow05(Int_t n)
3194{
3195 // private communication 09.03.11, Ante B. / Raimond
3196
3197 if (n == 2)
3198 {
3199 // v2{2}(pt) for 0-5%:
3200 Double_t xCumulant2nd0005ALICE[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
3201 1.050000,1.150000,1.250000,1.350000,1.450000,1.550000,1.650000,1.750000,1.850000,1.950000,
3202 2.100000,2.300000,2.500000,2.700000,2.900000,3.200000,3.600000,4.000000,4.400000,4.800000,
3203 5.500000,6.500000,7.500000,8.500000,9.500000,11.250000,13.750000,16.250000,18.750000,60.000000};
3204 Double_t yCumulant2nd0005ALICE[] = {0.000000,0.000000,0.018169,0.020988,0.024899,0.028309,0.031974,0.035188,0.038218,0.041202,
3205 0.043910,0.046560,0.048183,0.050640,0.052874,0.055334,0.056948,0.059427,0.061540,0.063218,
3206 0.065452,0.069222,0.072578,0.074723,0.077749,0.077178,0.080514,0.075325,0.077692,0.079710,
3207 0.073280,0.063849,0.068274,0.066045,0.071496,0.104352,0.091646,0.050220,0.124185,0.088535};
3208 Double_t xErrCumulant2nd0005ALICE[40] = {0.};
3209 Double_t yErrCumulant2nd0005ALICE[] = {0.000000,0.000000,0.000190,0.000191,0.000199,0.000212,0.000230,0.000248,0.000268,0.000293,
3210 0.000319,0.000346,0.000379,0.000418,0.000459,0.000502,0.000554,0.000614,0.000674,0.000749,
3211 0.000620,0.000769,0.000958,0.001182,0.001446,0.001331,0.001858,0.002552,0.003453,0.004606,
3212 0.004289,0.007006,0.010046,0.013853,0.017709,0.016630,0.025728,0.036763,0.045056,0.029011};
3213 Int_t nPointsCumulant2nd0005ALICE = sizeof(xCumulant2nd0005ALICE)/sizeof(Double_t);
3214 TGraphErrors *Cumulant2nd0005ALICE = new TGraphErrors(nPointsCumulant2nd0005ALICE,xCumulant2nd0005ALICE,yCumulant2nd0005ALICE,
3215 xErrCumulant2nd0005ALICE,yErrCumulant2nd0005ALICE);
3216 Cumulant2nd0005ALICE->SetMarkerStyle(kFullCircle);
3217 Cumulant2nd0005ALICE->SetMarkerColor(kBlue);
3218
3219 return Cumulant2nd0005ALICE;
3220 }
3221
3222 if (n == 3)
3223 {
3224 }
3225
3226 if (n == 4)
3227 {
3228 }
3229
3230 return 0;
3231}
3232
3233TGraphErrors* GetFlow05_Rap10(Int_t n)
3234{
3235 // private communication 17.05.11, Ante B. / should correspond to machcone paper draft
3236
3237 if (n == 2)
3238 {
3239 // v2{SP}(pt) for 00-05%:
3240 const Int_t nPointsSP_0005ALICE_v2_etaGap10 = 17;
3241 Double_t xSP_0005ALICE_v2_etaGap10[nPointsSP_0005ALICE_v2_etaGap10] = {0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.900000,1.100000,
3242 1.300000,1.500000,1.700000,1.900000,2.200000,2.600000,3.000000,3.650000,4.550000};
3243 Double_t ySP_0005ALICE_v2_etaGap10[nPointsSP_0005ALICE_v2_etaGap10] = {0.013672,0.015745,0.019944,0.024169,0.026921,0.030296,0.034916,0.038472,
3244 0.043103,0.046626,0.052386,0.057132,0.060070,0.068419,0.061459,0.056816,0.050311};
3245 Double_t xErrSP_0005ALICE_v2_etaGap10[nPointsSP_0005ALICE_v2_etaGap10] = {0.};
3246 Double_t yErrSP_0005ALICE_v2_etaGap10[nPointsSP_0005ALICE_v2_etaGap10] = {0.000813,0.000804,0.000852,0.000930,0.001029,0.001140,0.000939,0.001155,
3247 0.001410,0.001736,0.002131,0.002620,0.002502,0.003759,0.005615,0.006617,0.014242};
3248 TGraphErrors *GrSP_0005ALICE_v2_etaGap10 = new TGraphErrors(nPointsSP_0005ALICE_v2_etaGap10,xSP_0005ALICE_v2_etaGap10,ySP_0005ALICE_v2_etaGap10,
3249 xErrSP_0005ALICE_v2_etaGap10,yErrSP_0005ALICE_v2_etaGap10);
3250
3251 return GrSP_0005ALICE_v2_etaGap10;
3252 }
3253
3254 if (n == 3)
3255 {
3256 // v3{SP}(pt) for 00-05%:
3257 const Int_t nPointsSP_0005ALICE_v3_etaGap10 = 16;
3258 Double_t xSP_0005ALICE_v3_etaGap10[nPointsSP_0005ALICE_v3_etaGap10] = {0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.900000,1.100000,
3259 1.300000,1.500000,1.700000,1.900000,2.300000,2.900000,3.650000,4.550000};
3260 Double_t ySP_0005ALICE_v3_etaGap10[nPointsSP_0005ALICE_v3_etaGap10] = {0.006303,0.009800,0.011143,0.014246,0.017628,0.019437,0.028412,0.030580,
3261 0.038730,0.045653,0.052469,0.062303,0.071522,0.082223,0.083373,0.076951};
3262 Double_t xErrSP_0005ALICE_v3_etaGap10[nPointsSP_0005ALICE_v3_etaGap10] = {0.};
3263 Double_t yErrSP_0005ALICE_v3_etaGap10[nPointsSP_0005ALICE_v3_etaGap10] = {0.001012,0.000996,0.001062,0.001158,0.001277,0.001415,0.001158,0.001422,
3264 0.001734,0.002124,0.002610,0.003206,0.002724,0.004977,0.008123,0.017180};
3265 TGraphErrors *GrSP_0005ALICE_v3_etaGap10 = new TGraphErrors(nPointsSP_0005ALICE_v3_etaGap10,xSP_0005ALICE_v3_etaGap10,ySP_0005ALICE_v3_etaGap10,
3266 xErrSP_0005ALICE_v3_etaGap10,yErrSP_0005ALICE_v3_etaGap10);
3267
3268
3269 return GrSP_0005ALICE_v3_etaGap10;
3270 }
3271
3272 if (n == 4)
3273 {
3274 // v4{SP}(pt) for 00-05%:
3275 const Int_t nPointsSP_0005ALICE_v4_etaGap10 = 11;
3276 Double_t xSP_0005ALICE_v4_etaGap10[nPointsSP_0005ALICE_v4_etaGap10] = {0.300000,0.500000,0.700000,0.950000,1.250000,1.550000,1.850000,2.300000,2.900000,3.650000,4.550000};
3277 Double_t ySP_0005ALICE_v4_etaGap10[nPointsSP_0005ALICE_v4_etaGap10] = {0.002042,0.002556,0.009693,0.013286,0.016780,0.027865,0.031797,0.051101,0.060164,
3278 0.095985,0.094607};
3279 Double_t xErrSP_0005ALICE_v4_etaGap10[nPointsSP_0005ALICE_v4_etaGap10] = {0.};
3280 Double_t yErrSP_0005ALICE_v4_etaGap10[nPointsSP_0005ALICE_v4_etaGap10] = {0.001460,0.001624,0.001930,0.002021,0.002737,0.003717,0.005042,0.005564,0.010160,
3281 0.016472,0.035083};
3282 TGraphErrors *GrSP_0005ALICE_v4_etaGap10 = new TGraphErrors(nPointsSP_0005ALICE_v4_etaGap10,xSP_0005ALICE_v4_etaGap10,ySP_0005ALICE_v4_etaGap10,
3283 xErrSP_0005ALICE_v4_etaGap10,yErrSP_0005ALICE_v4_etaGap10);
3284
3285 return GrSP_0005ALICE_v4_etaGap10;
3286 }
3287
3288 if (n == 5)
3289 {
3290 // v5{SP}(pt) for 00-05%:
3291 const Int_t nPointsSP_0005ALICE_v5_etaGap10 = 12;
3292 Double_t xSP_0005ALICE_v5_etaGap10[nPointsSP_0005ALICE_v5_etaGap10] = {0.300000,0.500000,0.700000,0.900000,1.100000,1.300000,1.600000,2.000000,2.400000,
3293 2.800000,3.500000,4.500000};
3294 Double_t ySP_0005ALICE_v5_etaGap10[nPointsSP_0005ALICE_v5_etaGap10] = {0.002016,0.003409,0.004029,0.002665,0.002765,0.003042,0.013241,0.015430,0.031845,
3295 0.031373,0.068504,0.017964};
3296 Double_t xErrSP_0005ALICE_v5_etaGap10[nPointsSP_0005ALICE_v5_etaGap10] = {0.};
3297 Double_t yErrSP_0005ALICE_v5_etaGap10[nPointsSP_0005ALICE_v5_etaGap10] = {0.001260,0.001386,0.001696,0.002101,0.002560,0.003119,0.002970,0.004472,0.006802,
3298 0.010073,0.011899,0.027756};
3299 TGraphErrors *GrSP_0005ALICE_v5_etaGap10 = new TGraphErrors(nPointsSP_0005ALICE_v5_etaGap10,xSP_0005ALICE_v5_etaGap10,ySP_0005ALICE_v5_etaGap10,
3300 xErrSP_0005ALICE_v5_etaGap10,yErrSP_0005ALICE_v5_etaGap10);
3301
3302 return GrSP_0005ALICE_v5_etaGap10;
3303 }
3304
3305 return 0;
3306}
3307
3308TGraphErrors* GetFlow510(Int_t n)
3309{
3310 // private communication 09.03.11, Ante B. / Raimond
3311
3312 if (n == 2)
3313 {
3314 // v2{2}(pt) for 5-10%:
3315 Double_t xCumulant2nd0510ALICE[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
3316 1.050000,1.150000,1.250000,1.350000,1.450000,1.550000,1.650000,1.750000,1.850000,1.950000,
3317 2.100000,2.300000,2.500000,2.700000,2.900000,3.200000,3.600000,4.000000,4.400000,4.800000,
3318 5.500000,6.500000,7.500000,8.500000,9.500000,11.250000,13.750000,16.250000,18.750000,60.000000};
3319 Double_t yCumulant2nd0510ALICE[] = {0.000000,0.000000,0.022354,0.028064,0.034341,0.040769,0.046265,0.051160,0.056712,0.061354,
3320 0.066290,0.070340,0.074453,0.078444,0.082367,0.085785,0.088086,0.092676,0.096169,0.100366,
3321 0.104227,0.109710,0.117032,0.121784,0.122227,0.126537,0.127966,0.117790,0.117884,0.111436,
3322 0.104945,0.097640,0.086481,0.091663,0.091404,0.080132,0.015864,0.101500,0.033347,0.205130};
3323 Double_t xErrCumulant2nd0510ALICE[40] = {0.};
3324 Double_t yErrCumulant2nd0510ALICE[] = {0.000000,0.000000,0.000173,0.000176,0.000186,0.000199,0.000219,0.000236,0.000260,0.000283,
3325 0.000312,0.000340,0.000373,0.000410,0.000454,0.000501,0.000552,0.000610,0.000675,0.000753,
3326 0.000620,0.000774,0.000961,0.001183,0.001431,0.001309,0.001814,0.002481,0.003342,0.004379,
3327 0.004122,0.006716,0.009851,0.013626,0.017517,0.015790,0.025680,0.038041,0.054144,0.038987};
3328 Int_t nPointsCumulant2nd0510ALICE = sizeof(xCumulant2nd0510ALICE)/sizeof(Double_t);
3329 TGraphErrors *Cumulant2nd0510ALICE = new TGraphErrors(nPointsCumulant2nd0510ALICE,xCumulant2nd0510ALICE,yCumulant2nd0510ALICE,
3330 xErrCumulant2nd0510ALICE,yErrCumulant2nd0510ALICE);
3331 Cumulant2nd0510ALICE->SetMarkerStyle(kOpenCircle);
3332 Cumulant2nd0510ALICE->SetMarkerColor(kBlue);
3333
3334 return Cumulant2nd0510ALICE;
3335 }
3336
3337 if (n == 3)
3338 {
3339 }
3340
3341 if (n == 4)
3342 {
3343 }
3344
3345 return 0;
3346}
3347
3348TGraphErrors* GetFlow510_Rap10(Int_t n)
3349{
3350 // private communication 18.05.11, Ante B.
3351
3352 if (n == 2)
3353 {
3354 // v2{SP}(pt) for 05-10%, rapidity gap = 1.0:
3355 const Int_t nPointsSP_0510ALICE_v2_etaGap10 = 19;
3356 Double_t xSP_0510ALICE_v2_etaGap10[nPointsSP_0510ALICE_v2_etaGap10] = {0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
33571.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.250000,
33584.750000};
3359 Double_t ySP_0510ALICE_v2_etaGap10[nPointsSP_0510ALICE_v2_etaGap10] = {0.018634,0.025538,0.032157,0.038272,0.044020,0.049252,0.055627,0.059272,
33600.066516,0.073891,0.080945,0.090386,0.094505,0.106393,0.120303,0.122586,0.121731,0.107343,
33610.104059};
3362 Double_t xErrSP_0510ALICE_v2_etaGap10[nPointsSP_0510ALICE_v2_etaGap10] = {0.};
3363 Double_t yErrSP_0510ALICE_v2_etaGap10[nPointsSP_0510ALICE_v2_etaGap10] = {0.000419,0.000411,0.000435,0.000474,0.000523,0.000580,0.000643,0.000712,
33640.000586,0.000717,0.000880,0.001082,0.001333,0.001189,0.001969,0.003199,0.005011,0.007602,
33650.010906};
3366 TGraphErrors *GrSP_0510ALICE_v2_etaGap10 = new TGraphErrors(nPointsSP_0510ALICE_v2_etaGap10,xSP_0510ALICE_v2_etaGap10,
3367 ySP_0510ALICE_v2_etaGap10,xErrSP_0510ALICE_v2_etaGap10,
3368 yErrSP_0510ALICE_v2_etaGap10);
3369
3370 return GrSP_0510ALICE_v2_etaGap10;
3371 }
3372
3373 return 0;
3374}
3375
3376TGraphErrors* GetFlow1020(Int_t n)
3377{
3378 // private communication 09.03.11, Ante B. / Raimond
3379
3380 if (n == 2)
3381 {
3382 // v2{2}(pt) for 10-20%:
3383 Double_t xCumulant2nd1020ALICE[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
3384 1.050000,1.150000,1.250000,1.350000,1.450000,1.550000,1.650000,1.750000,1.850000,1.950000,
3385 2.100000,2.300000,2.500000,2.700000,2.900000,3.200000,3.600000,4.000000,4.400000,4.800000,
3386 5.500000,6.500000,7.500000,8.500000,9.500000,11.250000,13.750000,16.250000,18.750000,60.000000};
3387 Double_t yCumulant2nd1020ALICE[] = {0.000000,0.000000,0.028508,0.037698,0.046914,0.055750,0.063948,0.072298,0.079396,0.086829,
3388 0.093382,0.099676,0.105412,0.110792,0.116715,0.122327,0.127079,0.132302,0.137183,0.142346,
3389 0.149059,0.156729,0.164672,0.171840,0.175346,0.176824,0.178878,0.174979,0.169229,0.153109,
3390 0.139676,0.125686,0.120554,0.096537,0.084736,0.118152,0.116079,0.060032,0.093764,0.206506};
3391 Double_t xErrCumulant2nd1020ALICE[40] = {0.};
3392 Double_t yErrCumulant2nd1020ALICE[] = {0.000000,0.000000,0.000134,0.000136,0.000145,0.000158,0.000173,0.000190,0.000209,0.000229,
3393 0.000252,0.000275,0.000301,0.000331,0.000365,0.000401,0.000442,0.000488,0.000541,0.000599,
3394 0.000496,0.000614,0.000757,0.000915,0.001095,0.000989,0.001360,0.001847,0.002477,0.003234,
3395 0.003012,0.004867,0.007123,0.009774,0.012740,0.011682,0.019629,0.028568,0.039931,0.024776};
3396 Int_t nPointsCumulant2nd1020ALICE = sizeof(xCumulant2nd1020ALICE)/sizeof(Double_t);
3397 TGraphErrors *Cumulant2nd1020ALICE = new TGraphErrors(nPointsCumulant2nd1020ALICE,xCumulant2nd1020ALICE,yCumulant2nd1020ALICE,
3398 xErrCumulant2nd1020ALICE,yErrCumulant2nd1020ALICE);
3399 Cumulant2nd1020ALICE->SetMarkerStyle(kFullSquare);
3400 Cumulant2nd1020ALICE->SetMarkerColor(kRed);
3401
3402 return Cumulant2nd1020ALICE;
3403 }
3404
3405 if (n == 3)
3406 {
3407 }
3408
3409 if (n == 4)
3410 {
3411 }
3412
3413 return 0;
3414}
3415
3416TGraphErrors* GetFlow1020_Rap10(Int_t n)
3417{
3418 // private communication 18.05.11, Ante B.
3419
3420 if (n == 2)
3421 {
3422 // v2{SP}(pt) for 10-20%, rapidity gap = 1.0:
3423 const Int_t nPointsSP_1020ALICE_v2_etaGap10 = 19;
3424 Double_t xSP_1020ALICE_v2_etaGap10[nPointsSP_1020ALICE_v2_etaGap10] = {0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
34251.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.250000,
34264.750000};
3427 Double_t ySP_1020ALICE_v2_etaGap10[nPointsSP_1020ALICE_v2_etaGap10] = {0.026592,0.036955,0.046103,0.055537,0.063461,0.070993,0.078751,0.085723,
34280.094701,0.105631,0.117906,0.128147,0.138505,0.153494,0.166651,0.172691,0.177337,0.155068,
34290.131586};
3430 Double_t xErrSP_1020ALICE_v2_etaGap10[nPointsSP_1020ALICE_v2_etaGap10] = {0.};
3431 Double_t yErrSP_1020ALICE_v2_etaGap10[nPointsSP_1020ALICE_v2_etaGap10] = {0.000302,0.000296,0.000314,0.000342,0.000377,0.000418,0.000465,0.000515,
34320.000423,0.000517,0.000634,0.000779,0.000959,0.000856,0.001406,0.002266,0.003528,0.005281,
34330.007561};
3434 TGraphErrors *GrSP_1020ALICE_v2_etaGap10 = new TGraphErrors(nPointsSP_1020ALICE_v2_etaGap10,xSP_1020ALICE_v2_etaGap10,
3435 ySP_1020ALICE_v2_etaGap10,xErrSP_1020ALICE_v2_etaGap10,
3436 yErrSP_1020ALICE_v2_etaGap10);
3437
3438 return GrSP_1020ALICE_v2_etaGap10;
3439 }
3440
3441 return 0;
3442}
3443
3444TGraphErrors* GetFlow2030(Int_t n)
3445{
3446 // private communication 09.03.11, Ante B. / Raimond
3447
3448 if (n == 2)
3449 {
3450 // v2{2}(pt) for 20-30%:
3451 Double_t xCumulant2nd2030ALICE[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
3452 1.050000,1.150000,1.250000,1.350000,1.450000,1.550000,1.650000,1.750000,1.850000,1.950000,
3453 2.100000,2.300000,2.500000,2.700000,2.900000,3.200000,3.600000,4.000000,4.400000,4.800000,
3454 5.500000,6.500000,7.500000,8.500000,9.500000,11.250000,13.750000,16.250000,18.750000,60.000000};
3455 Double_t yCumulant2nd2030ALICE[] = {0.000000,0.000000,0.035366,0.047465,0.060083,0.072090,0.083418,0.093576,0.103842,0.113110,
3456 0.122193,0.130168,0.138158,0.145627,0.152851,0.159129,0.166073,0.173144,0.178698,0.186188,
3457 0.192045,0.202199,0.210535,0.215004,0.220457,0.223339,0.224050,0.211567,0.203955,0.189716,
3458 0.165994,0.147185,0.131953,0.139331,0.151293,0.127406,0.153764,0.089628,0.161247,0.511418};
3459 Double_t xErrCumulant2nd2030ALICE[40] = {0.};
3460 Double_t yErrCumulant2nd2030ALICE[] = {0.000000,0.000000,0.000155,0.000157,0.000169,0.000184,0.000202,0.000222,0.000244,0.000269,
3461 0.000296,0.000325,0.000357,0.000394,0.000435,0.000481,0.000532,0.000589,0.000655,0.000731,
3462 0.000605,0.000743,0.000904,0.001081,0.001277,0.001145,0.001568,0.002119,0.002806,0.003635,
3463 0.003383,0.005346,0.007935,0.010739,0.014682,0.013434,0.021531,0.032352,0.040396,0.028472};
3464 Int_t nPointsCumulant2nd2030ALICE = sizeof(xCumulant2nd2030ALICE)/sizeof(Double_t);
3465 TGraphErrors *Cumulant2nd2030ALICE = new TGraphErrors(nPointsCumulant2nd2030ALICE,xCumulant2nd2030ALICE,yCumulant2nd2030ALICE,
3466 xErrCumulant2nd2030ALICE,yErrCumulant2nd2030ALICE);
3467 Cumulant2nd2030ALICE->SetMarkerStyle(kOpenSquare);
3468 Cumulant2nd2030ALICE->SetMarkerColor(kRed);
3469
3470 return Cumulant2nd2030ALICE;
3471 }
3472
3473 if (n == 3)
3474 {
3475 }
3476
3477 if (n == 4)
3478 {
3479 }
3480
3481 return 0;
3482}
3483
3484TGraphErrors* GetFlow3040(Int_t n)
3485{
3486 // private communication 09.03.11, Ante B. / Raimond
3487
3488 if (n == 2)
3489 {
3490 // v2{2}(pt) for 30-40%:
3491 Double_t xCumulant2nd3040ALICE[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
3492 1.050000,1.150000,1.250000,1.350000,1.450000,1.550000,1.650000,1.750000,1.850000,1.950000,
3493 2.100000,2.300000,2.500000,2.700000,2.900000,3.200000,3.600000,4.000000,4.400000,4.800000,
3494 5.500000,6.500000,7.500000,8.500000,9.500000,11.250000,13.750000,16.250000,18.750000,60.000000};
3495 Double_t yCumulant2nd3040ALICE[] = {0.000000,0.000000,0.039584,0.054196,0.069291,0.082976,0.095622,0.108940,0.119830,0.131587,
3496 0.141091,0.150899,0.160573,0.168676,0.176301,0.183823,0.191672,0.199506,0.206854,0.212830,
3497 0.219526,0.229376,0.236513,0.240863,0.245961,0.245891,0.242608,0.234302,0.219580,0.212848,
3498 0.194666,0.190184,0.171036,0.159173,0.156932,0.141324,0.132809,0.182683,0.023272,0.032825};
3499 Double_t xErrCumulant2nd3040ALICE[40] = {0.};
3500 Double_t yErrCumulant2nd3040ALICE[] = {0.000000,0.000000,0.000189,0.000192,0.000205,0.000224,0.000247,0.000273,0.000302,0.000334,
3501 0.000369,0.000407,0.000448,0.000496,0.000552,0.000612,0.000682,0.000758,0.000844,0.000941,
3502 0.000774,0.000937,0.001123,0.001329,0.001565,0.001397,0.001911,0.002549,0.003378,0.004306,
3503 0.003987,0.006353,0.009128,0.013032,0.016891,0.015806,0.025150,0.035119,0.044487,0.050083};
3504 Int_t nPointsCumulant2nd3040ALICE = sizeof(xCumulant2nd3040ALICE)/sizeof(Double_t);
3505 TGraphErrors *Cumulant2nd3040ALICE = new TGraphErrors(nPointsCumulant2nd3040ALICE,xCumulant2nd3040ALICE,yCumulant2nd3040ALICE,
3506 xErrCumulant2nd3040ALICE,yErrCumulant2nd3040ALICE);
3507 Cumulant2nd3040ALICE->SetMarkerStyle(kFullTriangleUp);
3508 Cumulant2nd3040ALICE->SetMarkerColor(kGreen+2);
3509
3510 return Cumulant2nd3040ALICE;
3511 }
3512
3513 if (n == 3)
3514 {
3515 }
3516
3517 if (n == 4)
3518 {
3519 }
3520
3521 return 0;
3522}
3523
3524TGraphErrors* GetFlow4050(Int_t n)
3525{
3526 // private communication 09.03.11, Ante B. / Raimond
3527
3528 if (n == 2)
3529 {
3530 // v2{2}(pt) for 40-50%:
3531 Double_t xCumulant2nd4050ALICE[] = {0.050000,0.150000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
3532 1.050000,1.150000,1.250000,1.350000,1.450000,1.550000,1.650000,1.750000,1.850000,1.950000,
3533 2.100000,2.300000,2.500000,2.700000,2.900000,3.200000,3.600000,4.000000,4.400000,4.800000,
3534 5.500000,6.500000,7.500000,8.500000,9.500000,11.250000,13.750000,16.250000,18.750000,60.000000};
3535 Double_t yCumulant2nd4050ALICE[] = {0.000000,0.000000,0.041872,0.058090,0.074444,0.089181,0.103780,0.117279,0.129769,0.142051,
3536 0.153185,0.163147,0.173309,0.181668,0.190998,0.197703,0.205011,0.211063,0.219587,0.223287,
3537 0.231163,0.239606,0.246533,0.251457,0.250034,0.252989,0.240823,0.236489,0.230268,0.204321,
3538 0.213476,0.200247,0.167065,0.190655,0.173573,0.166173,0.153232,0.173112,-0.123540,0.211999};
3539 Double_t xErrCumulant2nd4050ALICE[40] = {0.};
3540 Double_t yErrCumulant2nd4050ALICE[] = {0.000000,0.000000,0.000248,0.000251,0.000270,0.000296,0.000328,0.000363,0.000403,0.000447,
3541 0.000500,0.000556,0.000617,0.000687,0.000770,0.000857,0.000952,0.001057,0.001176,0.001297,
3542 0.001054,0.001265,0.001498,0.001767,0.002076,0.001849,0.002527,0.003358,0.004372,0.005573,
3543 0.005091,0.007981,0.011746,0.015732,0.021883,0.019866,0.032443,0.046521,0.051631,0.083717};
3544 Int_t nPointsCumulant2nd4050ALICE = sizeof(xCumulant2nd4050ALICE)/sizeof(Double_t);
3545 TGraphErrors *Cumulant2nd4050ALICE = new TGraphErrors(nPointsCumulant2nd4050ALICE,xCumulant2nd4050ALICE,yCumulant2nd4050ALICE,
3546 xErrCumulant2nd4050ALICE,yErrCumulant2nd4050ALICE);
3547 Cumulant2nd4050ALICE->SetMarkerStyle(kOpenTriangleUp);
3548 Cumulant2nd4050ALICE->SetMarkerColor(kGreen+2);
3549
3550 return Cumulant2nd4050ALICE;
3551 }
3552
3553 return 0;
3554}
3555
3556TGraphErrors* GetFlow6070_Rap10(Int_t n)
3557{
3558 // private communication 18.05.11, Ante B.
3559
3560 if (n == 2)
3561 {
3562 // v2{SP}(pt) for 60-70%, rapidity gap = 1.0:
3563 const Int_t nPointsSP_6070ALICE_v2_etaGap10 = 9;
3564 Double_t xSP_6070ALICE_v2_etaGap10[nPointsSP_6070ALICE_v2_etaGap10] = {0.300000,0.500000,0.700000,0.900000,1.250000,1.750000,2.500000,3.500000,4.500000};
3565 Double_t ySP_6070ALICE_v2_etaGap10[nPointsSP_6070ALICE_v2_etaGap10] = {0.044958,0.073313,0.105726,0.120423,0.147537,0.186749,0.205423,0.208575,0.185938};
3566 Double_t xErrSP_6070ALICE_v2_etaGap10[nPointsSP_6070ALICE_v2_etaGap10] = {0.};
3567 Double_t yErrSP_6070ALICE_v2_etaGap10[nPointsSP_6070ALICE_v2_etaGap10] = {0.001520,0.001772,0.002245,0.002842,0.002600,0.004443,0.006240,0.014665,0.028810};
3568 TGraphErrors *GrSP_6070ALICE_v2_etaGap10 = new TGraphErrors(nPointsSP_6070ALICE_v2_etaGap10,xSP_6070ALICE_v2_etaGap10,
3569 ySP_6070ALICE_v2_etaGap10,xErrSP_6070ALICE_v2_etaGap10,
3570 yErrSP_6070ALICE_v2_etaGap10);
3571
3572 return GrSP_6070ALICE_v2_etaGap10;
3573 }
3574
3575 return 0;
3576}
3577
3578Float_t CalculateFlow(TH1* ptDist, Float_t ptMin, Float_t ptMax, Int_t n, Int_t centralityBegin, Int_t centralityEnd)
3579{
3580 if (centralityBegin == 0 && centralityEnd == 1)
3581 flow = GetFlow01_Rap10(n);
3582 else if (centralityBegin == 0 && centralityEnd == 2)
3583 flow = GetFlow02_Rap10(n);
3584 else if (centralityBegin == 0 && centralityEnd == 5)
3585 flow = GetFlow05_Rap10(n);
3586 else if (centralityBegin == 5 && centralityEnd == 10)
3587 flow = GetFlow510_Rap10(n);
3588 else if (centralityBegin == 20 && centralityEnd == 30)
3589 flow = GetFlow2030(n);
3590 else if (centralityBegin == 30 && centralityEnd == 40)
3591 flow = GetFlow3040(n);
3592 else if (centralityBegin == 40 && centralityEnd == 50)
3593 flow = GetFlow4050(n);
3594 else if (centralityBegin > 50)
3595 flow = GetFlow6070_Rap10(n);
3596 else if (centralityBegin == 0 && centralityEnd == 20)
3597 {
3598 flow1 = GetFlow05_Rap10(n);
3599 flow2 = GetFlow510_Rap10(n);
3600 flow3 = GetFlow1020_Rap10(n);
3601
3602 flow = (TGraphErrors*) flow2->Clone();
3603
3604 // centrality width * dn/deta from http://arxiv.org/PS_cache/arxiv/pdf/1012/1012.1657v2.pdf
3605 Float_t mult[] = { 5 * 1601, 5 * 1294, 10 * 966 };
3606
3607 for (Int_t i=0; i<flow->GetN(); i++)
3608 {
3609 Float_t x= flow->GetX()[i];
3610
3611// Printf("%f: %f %f %f", x, flow1->Eval(x), flow2->Eval(x), flow3->Eval(x));
3612 flow->GetY()[i] = flow1->Eval(x) * mult[0] + flow2->Eval(x) * mult[1] + flow3->Eval(x) * mult[2];
3613 flow->GetY()[i] /= mult[0] + mult[1] + mult[2];
3614// Printf(" --> %f", flow->GetY()[i]);
3615 }
3616 }
3617 else if (centralityBegin == 20 && centralityEnd == 60)
3618 {
3619 flow = GetFlow2030(n);
3620 flow2 = GetFlow3040(n);
3621 flow3 = GetFlow4050(n);
3622
3623 // centrality width * dn/deta from http://arxiv.org/PS_cache/arxiv/pdf/1012/1012.1657v2.pdf
3624 Float_t mult[] = { 10 * 649, 10 * 426, 10 * (261+149) };
3625
3626 if (flow->GetN() != flow2->GetN() || flow2->GetN() != flow3->GetN())
3627 AliFatal("Incompatible graphs");
3628
3629 for (Int_t i=0; i<flow->GetN(); i++)
3630 {
3631// Printf("%f %f %f", flow->GetY()[i], flow2->GetY()[i], flow3->GetY()[i]);
3632 flow->GetY()[i] = flow->GetY()[i] * mult[0] + flow2->GetY()[i] * mult[1] + flow3->GetY()[i] * mult[2];
3633 flow->GetY()[i] /= mult[0] + mult[1] + mult[2];
3634// Printf(" --> %f", flow->GetY()[i]);
3635 }
3636 }
3637 else
3638 {
3639 Printf("Flow range %d %d not available", centralityBegin, centralityEnd);
3640 AliFatal("");
3641 }
3642
3643 Float_t vn = 0;
3644 Float_t sum = 0;
3645 for (Int_t bin = ptDist->FindBin(ptMin + 0.01); bin <= ptDist->FindBin(ptMax - 0.01); bin++)
3646 {
3647 if (ptDist->GetBinCenter(bin) > flow->GetX()[flow->GetN()-1])
3648 vn += ptDist->GetBinContent(bin) * flow->GetY()[flow->GetN()-1];
3649 else
3650 vn += ptDist->GetBinContent(bin) * flow->Eval(ptDist->GetBinCenter(bin));
3651 sum += ptDist->GetBinContent(bin);
3652 }
3653
3654 if (sum > 0)
3655 vn /= sum;
3656
3657 Printf("v_{%d} = %f for %f < pT < %f", n, vn, ptMin, ptMax);
3658
3659 return vn;
3660}
3661
3662void CalculateFlow(const char* fileName, Int_t centralityBegin, Int_t centralityEnd)
3663{
3664 Float_t ptTrigMin = 2;
3665 Float_t ptTrigMax = 3;
3666
3667 Float_t ptMin = 1;
3668 Float_t ptMax = 2;
3669
3670 loadlibs();
3671
3672 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
3673
3674 cont = h->GetUEHist(2)->GetTrackHist(0);
3675 cont->GetGrid(6)->GetGrid()->GetAxis(3)->SetRangeUser(0.01 + centralityBegin, -0.01 + centralityEnd);
3676 cont->GetGrid(6)->GetGrid()->GetAxis(2)->SetRangeUser(ptTrigMin + 0.01, ptTrigMax - 0.01);
3677
3678 ptDist = cont->ShowProjection(1, 6);
3679 ptDist->Scale(1.0 / ptDist->Integral());
3680
3681 cont = h->GetUEHist(2)->GetEventHist();
3682 cont->GetGrid(6)->GetGrid()->GetAxis(1)->SetRangeUser(0.01 + centralityBegin, -0.01 + centralityEnd);
3683
3684 ptDist2 = cont->ShowProjection(0, 6);
3685 ptDist2->Scale(1.0 / ptDist2->Integral());
3686
3687 TString str;
3688
3689 for (Int_t n=2; n<=4; n++)
3690 {
3691 Float_t v2A = CalculateFlow(ptDist, ptMin, ptMax, n, centralityBegin, centralityEnd);
3692 Float_t v2T = CalculateFlow(ptDist2, ptTrigMin, ptTrigMax, n, centralityBegin, centralityEnd);
3693
3694 str += Form("%f * %f, ", v2A, v2T);
3695 }
3696
3697 ptDist->Draw();
3698 ptDist2->SetLineColor(2);
3699 ptDist2->Draw("SAME");
3700
3701 Printf("%s", str.Data());
3702}
3703
3704// four dimensions for: nearside/awayside/normalization unc, trigger, centrality, case (same, same/mixed, same w/ v2 subtraction, same/mixed w/ v2 subtraction, some more cases...)
3705TGraphErrors***** yields = 0;
3706TString currentYieldFile;
3707
3708void WriteYields()
3709{
3710 TFile::Open("yields.root", "RECREATE");
3711 for (Int_t i=0; i<3; i++)
3712 {
3713 for (Int_t j=0; j<6; j++)
3714 {
3715 for (Int_t k=0; k<4; k++)
3716 {
3717 // CINT limitation here
3718 TGraphErrors** tmp = yields[i][j][k];
3719 for (Int_t l=0; l<31; l++)
3720 {
3721 //Printf("%d %d %d %d", i, j, k, l);
3722 tmp[l]->Write(Form("yield_%d_%d_%d_%d", i, j, k, l));
3723 }
3724 }
3725 }
3726 }
3727 gFile->Close();
3728}
3729
3730void ReadYields(const char* fileName = "yields.root")
3731{
3732 if (currentYieldFile == fileName)
3733 return;
3734
3735 currentYieldFile = fileName;
3736
3737 CreateYieldStructure();
3738 TFile::Open(fileName);
3739 for (Int_t i=0; i<3; i++)
3740 {
3741 for (Int_t j=0; j<6; j++)
3742 {
3743 for (Int_t k=0; k<4; k++)
3744 {
3745 // CINT limitation here
3746 TGraphErrors** tmp = yields[i][j][k];
3747 for (Int_t l=0; l<31; l++)
3748 {
3749 //Printf("%d %d %d %d", i, j, k, l);
3750 tmp[l] = gFile->Get(Form("yield_%d_%d_%d_%d", i, j, k, l));
3751 }
3752 }
3753 }
3754 }
3755}
3756
3757void CreateYieldStructure()
3758{
3759 if (!yields)
3760 {
3761 yields = new TGraphErrors****[3];
3762 for (Int_t i=0; i<3; i++)
3763 {
3764 yields[i] = new TGraphErrors***[6];
3765 for (Int_t j=0; j<6; j++)
3766 {
3767 yields[i][j] = new TGraphErrors**[4];
3768 for (Int_t k=0; k<4; k++)
3769 {
3770 yields[i][j][k] = new TGraphErrors*[31];
3771 // CINT limitation here
3772 TGraphErrors** tmp = yields[i][j][k];
3773 for (Int_t l=0; l<31; l++)
3774 {
3775 //Printf("%d %d %d %d", i, j, k, l);
3776 TGraphErrors* graph = new TGraphErrors;
3777 tmp[l] = graph;
3778 }
3779 }
3780 }
3781 }
3782 }
3783}
3784
3785void GraphShiftX(TGraphErrors* graph, Float_t offset)
3786{
3787 for (Int_t i=0; i<graph->GetN(); i++)
3788 graph->GetX()[i] += offset;
3789}
3790
3791// Float_t kPythiaScalingFactor = 0.935;
3792Float_t kPythiaScalingFactor = 1;
3793
3794void DrawYields(const char* fileName = "yields.root")
3795{
3796 ReadYields(fileName);
3797
3798 c = new TCanvas("c", "c", 1800, 1200);
3799 c->Divide(6, 4);
3800
3801 Int_t markers1[] = { 24, 25, 26, 30 };
3802 Int_t markers2[] = { 20, 21, 22, 29 };
3803 Int_t colors[] = { 1, 2, 3, 4 };
3804 //Int_t caseList[] = { 0, 10+1, 10+1, 8, 10, 11, 12, 13, 1, 9 };
3805 Int_t caseList[] = { 0, 18, 18, 23, 18, 19, 20, 21, 22, 9 };
3806 const char* caseString[] = { "", "baseline sub", "baseline vs v2 sub comp", 0, "baseline sub comp", "Same/Mixed", "Same/Mixed - v2 subtr" };
3807
3808 Bool_t iaa = kTRUE;
3809 if (!iaa)
3810 {
3811 Int_t centralityList[] = { 0, 1, 2, 0, 0, 1 };
3812 Int_t centralityList2[] = { -1, -1, -1, 1, 2, 2 };
3813 Float_t factors[] = { 1, 1, 1, 1, 1, 1 };
3814 const char* centralityString[] = { "0-5%", "20-40%", "60-90%", "0-5% vs 20-40%", "0-5% vs 60-90%", "20-40% vs 60-90%" };
3815 }
3816 else
3817 {
3818 Int_t centralityList[] = { 0, 2, 3, 0, 0, 2 };
3819 Int_t centralityList2[] = { -1, -1, -1, 2, 3, 3 };
3820 //Float_t factors[] = { 1, 1, 1, 1, 1.0/0.9, 1.0/0.9 };
3821 //Float_t factors[] = { 1, 1, 1, 1, 1.0/0.804, 1.0/0.804 };
3822 Float_t factors[] = { 1, 1, 1, 1, 1.0/kPythiaScalingFactor, 1.0/kPythiaScalingFactor };
3823 //Float_t factors[] = { 1, 1, 1, 1, 1.0, 1.0 };
3824 const char* centralityString[] = { "0-5%", "60-90%", "pp", "0-5% vs 60-90%", "0-5% vs pp", "60-90% vs pp" };
3825 }
3826
3827 l = new TLegend(0.5, 0.5, 0.9, 0.9);
3828 l->SetFillColor(0);
3829
3830 Float_t max[] = { 0.4, 2, 2, 2, 2, 10, 10 };
3831 Float_t max2[] = { 5, 2, 2, 2, 2, 2, 2, 2, 2 };
3832
3833 dummy = new TH2F("dummy", ";p_{T,assoc};yield", 100, 0, 20, 20000, 0, 10);
3834 dummy->SetStats(0);
3835
3836 TGraphErrors* prevNear[6];
3837 TGraphErrors* prevAway[6];
3838 for (Int_t caseId=0; caseId<9; caseId++) // case 0->9
3839 {
3840 for (Int_t k=0; k<6; k++) // centrality
3841 {
3842 if (caseId != 3 && caseId < 5)
3843 {
3844 if (caseId < 4)
3845 c->cd(1 + k + caseId*6);
3846 else
3847 c->cd(1 + k + (caseId-1)*6);
3848 currentDummy = dummy->DrawCopy();
3849 currentDummy->GetYaxis()->SetRangeUser(0, max[caseId]);
3850 gPad->SetGridx();
3851 gPad->SetGridy();
3852
3853 latex = new TLatex(0.15, 0.95, Form("%s - %s", caseString[caseId], centralityString[k]));
3854 latex->SetNDC();
3855 latex->SetTextSize(0.05);
3856 latex->Draw();
3857 }
3858 else if (caseId == 3)
3859 c->cd(1 + k + 2*6);
3860 else
3861 c->cd(1 + k + 3*6);
3862
3863 for (Int_t j=0; j<3; j++) // trigger pt
3864 {
3865 if (caseId >= 2 && j != 1)
3866 continue;
3867 Printf("%d %d %d %d", caseId, k, j, caseList[caseId]);
3868
3869 if (k < 3)
3870 {
3871 // CINT limitation here
3872 TGraphErrors** tmp = yields[0][j][centralityList[k]];
3873 nearSide = tmp[caseList[caseId]];
3874 //new TCanvas; nearSide->Draw("AP"); return;
3875
3876 nearSide->SetMarkerStyle(markers1[j]);
3877 nearSide->SetMarkerColor(colors[j]);
3878 nearSide->SetLineColor(colors[j]);
3879
3880 if (caseId == 0 && k == 0)
3881 l->AddEntry(nearSide, Form("trig pt bin %d", j), "P");
3882
3883 TGraphErrors** tmp = yields[1][j][centralityList[k]];
3884 awaySide = tmp[caseList[caseId]];
3885 awaySide->SetMarkerStyle(markers2[j]);
3886 awaySide->SetMarkerColor(colors[j]);
3887 awaySide->SetLineColor(colors[j]);
3888
3889 GraphShiftX(nearSide, -0.1 + j*0.1);
3890 GraphShiftX(awaySide, -0.1 + j*0.1);
3891
3892 if (caseId == 3)
3893 {
3894 nearSide->SetLineColor(caseId - 2);
3895 nearSide->SetMarkerColor(caseId - 2);
3896 awaySide->SetLineColor(caseId - 2);
3897 awaySide->SetMarkerColor(caseId - 2);
3898 }
3899
3900 if (caseId >= 4)
3901 {
3902 nearSide->SetLineColor(caseId - 3);
3903 nearSide->SetMarkerColor(caseId - 3);
3904 awaySide->SetLineColor(caseId - 3);
3905 awaySide->SetMarkerColor(caseId - 3);
3906 }
3907
3908 awaySide->Print();
3909
3910 prevNear[k] = (TGraphErrors*) nearSide->DrawClone("PSAME");
3911 prevAway[k] = (TGraphErrors*) awaySide->DrawClone("PSAME");
3912
3913 if (caseId == 4)
3914 {
3915 Printf("%d", k);
3916 for (Int_t i=0; i<nearSide->GetN(); i++)
3917 {
3918 Printf("%f: %.0f%%", nearSide->GetX()[i], 100.0 * nearSide->GetEY()[i] / nearSide->GetY()[i]);
3919 Printf("%f: %.0f%%", awaySide->GetX()[i], 100.0 * awaySide->GetEY()[i] / awaySide->GetY()[i]);
3920 }
3921 }
3922 }
3923 else
3924 {
3925 // CINT limitation here
3926 tmp = yields[0][j][centralityList[k]]; nearSideCentral = (TGraphErrors*) tmp[caseList[caseId]]->Clone();
3927 tmp = yields[1][j][centralityList[k]]; awaySideCentral = (TGraphErrors*) tmp[caseList[caseId]]->Clone();
3928
3929 tmp = yields[0][j][centralityList2[k]];
3930 nearSidePeripheral = tmp[caseList[caseId]];
3931 if (iaa && caseId == 3 && k >= 4)
3932 nearSidePeripheral = tmp[caseList[caseId-1]];
3933
3934 tmp = yields[1][j][centralityList2[k]];
3935 awaySidePeripheral = tmp[caseList[caseId]];
3936 if (iaa && caseId == 3 && k >= 4)
3937 awaySidePeripheral = tmp[caseList[caseId-1]];
3938
3939// nearSideCentral->Print();
3940// nearSidePeripheral->Print();
3941
3942 if (k == 3)
3943 currentDummy->GetYaxis()->SetTitle("I_{CP}");
3944 else
3945 currentDummy->GetYaxis()->SetTitle("I_{AA}");
3946 currentDummy->GetYaxis()->SetRangeUser(0, max2[caseId]);
3947
3948 for (Int_t i=0; i<nearSideCentral->GetN(); i++)
3949 {
3950 if (i >= nearSidePeripheral->GetN())
3951 {
3952 nearSideCentral->RemovePoint(i);
3953 i--;
3954 continue;
3955 }
3956
3957 //Printf("near %d %f %f", i, nearSideCentral->GetY()[i], nearSidePeripheral->GetY()[i]);
3958 if (nearSidePeripheral->GetY()[i] <= 1e-5 || nearSideCentral->GetY()[i] <= 1e-5)
3959 {
3960 nearSideCentral->RemovePoint(i);
3961 nearSidePeripheral->RemovePoint(i);
3962 i--;
3963 continue;
3964 }
3965
3966 nearSideCentral->GetEY()[i] = TMath::Sqrt(
3967 TMath::Power(nearSideCentral->GetEY()[i] / nearSideCentral->GetY()[i], 2) +
3968 TMath::Power(nearSidePeripheral->GetEY()[i] / nearSidePeripheral->GetY()[i], 2) );
3969
3970 nearSideCentral->GetY()[i] /= nearSidePeripheral->GetY()[i];
3971 nearSideCentral->GetY()[i] *= factors[k];
3972
3973 nearSideCentral->GetEY()[i] *= nearSideCentral->GetY()[i];
3974 }
3975 //Printf("done");
3976
3977 for (Int_t i=0; i<awaySideCentral->GetN(); i++)
3978 {
3979 if (i >= awaySidePeripheral->GetN())
3980 {
3981 awaySideCentral->RemovePoint(i);
3982 i--;
3983 continue;
3984 }
3985
3986 //Printf("away %d", i);
3987 if (awaySidePeripheral->GetY()[i] <= 1e-5 || awaySideCentral->GetY()[i] <= 1e-5)
3988 {
3989 awaySideCentral->RemovePoint(i);
3990 awaySidePeripheral->RemovePoint(i);
3991 i--;
3992 continue;
3993 }
3994
3995 awaySideCentral->GetEY()[i] = TMath::Sqrt(
3996 TMath::Power(awaySideCentral->GetEY()[i] / awaySideCentral->GetY()[i], 2) +
3997 TMath::Power(awaySidePeripheral->GetEY()[i] / awaySidePeripheral->GetY()[i], 2) );
3998
3999 awaySideCentral->GetY()[i] /= awaySidePeripheral->GetY()[i];
4000 awaySideCentral->GetY()[i] *= factors[k];
4001
4002 awaySideCentral->GetEY()[i] *= awaySideCentral->GetY()[i];
4003 }
4004
4005 if (caseId == 3)
4006 {
4007 nearSideCentral = (TGraphErrors*) nearSideCentral->Clone();
4008 nearSideCentral->SetLineColor(1);
4009 nearSideCentral->SetMarkerColor(1);
4010
4011 awaySideCentral = (TGraphErrors*) awaySideCentral->Clone();
4012 awaySideCentral->SetLineColor(1);
4013 awaySideCentral->SetMarkerColor(1);
4014 }
4015
4016 if (caseId >= 4)
4017 {
4018 nearSideCentral = (TGraphErrors*) nearSideCentral->Clone();
4019 nearSideCentral->SetLineColor(caseId - 3);
4020 nearSideCentral->SetMarkerColor(caseId - 3);
4021
4022 awaySideCentral = (TGraphErrors*) awaySideCentral->Clone();
4023 awaySideCentral->SetLineColor(caseId - 3);
4024 awaySideCentral->SetMarkerColor(caseId - 3);
4025 }
4026
4027 //Printf("%d", caseList[caseId]);
4028
4029// nearSideCentral->Print();
4030
4031 nearSideCentral->Draw("PSAME");
4032 awaySideCentral->Draw("PSAME");
4033
4034 if (caseId == 3)
4035 {
4036 for (Int_t i=0; i<nearSideCentral->GetN(); i++)
4037 Printf("Near, bin %d pt = %f, difference %.1f%%", i, nearSideCentral->GetX()[i], 100.0 - 100.0 * nearSideCentral->GetY()[i] / prevNear[k]->Eval(nearSideCentral->GetX()[i]));
4038 for (Int_t i=0; i<awaySideCentral->GetN(); i++)
4039 Printf("Away, bin %d pt = %f, difference %.1f%%", i, awaySideCentral->GetX()[i], 100.0 - 100.0 * awaySideCentral->GetY()[i] / prevAway[k]->Eval(awaySideCentral->GetX()[i]));
4040 }
4041
4042 prevNear[k] = nearSideCentral;
4043 prevAway[k] = awaySideCentral;
4044 }
4045 }
4046 if (caseId == 0 && k == 0)
4047 l->Draw();
4048 }
4049 }
4050
4051 c->SaveAs("yields.png");
4052}
4053
4054void FitGaussians(const char* fileName, Bool_t flat)
4055{
4056 CreateYieldStructure();
4057
4058 aliceFile = TFile::Open(fileName);
4059
4060 Int_t maxLeadingPt = 3;
4061 Int_t maxAssocPt = 3;
4062
4063 TCanvas* canvas = new TCanvas("FitGaussians", "FitGaussians", 1000, 700);
4064 canvas->Divide(maxAssocPt, maxLeadingPt);
4065
4066 for (Int_t i=0; i<maxLeadingPt; i++)
4067 for (Int_t j=0; j<maxAssocPt; j++)
4068 {
4069 TH1* first = 0;
4070 for (Int_t aliceCentrality=0; aliceCentrality<4; aliceCentrality++)
4071 {
4072 Printf("%d %d %d", i, j, aliceCentrality);
4073
4074 canvas->cd(j+1 + (i) * maxAssocPt);
4075 gPad->SetLeftMargin(0.15);
4076 gPad->SetBottomMargin(0.2);
4077 //gPad->SetTopMargin(0.01);
4078 gPad->SetRightMargin(0.01);
4079
4080 hist = (TH1*) aliceFile->Get(Form("dphi_%d_%d_%d%s", i, j, aliceCentrality, (flat) ? "_fit_flat" : ""));
4081 if (!hist)
4082 continue;
4083
4084// hist->Rebin(2);
4085
4086 // two Gauss fits
4087 gausFit = new TF1("gausFit", "[0] + gaus(1) + gaus(4)", -0.5 * TMath::Pi(), 1.5 * TMath::Pi());
4088 gausFit->SetParameters(0, 1, 0, 1, 1, TMath::Pi(), 1);
4089 gausFit->SetParLimits(0, -1, 10000);
4090 gausFit->SetParLimits(1, 0.001, 10000);
4091 gausFit->FixParameter(2, 0);
4092 gausFit->SetParLimits(3, 0.05, 10);
4093 gausFit->SetParLimits(4, 0.001, 10000);
4094 gausFit->FixParameter(5, TMath::Pi());
4095 gausFit->SetParLimits(6, 0.1, 10);
4096
4097 gausFit->SetLineWidth(1);
4098 gausFit->SetLineColor(hist->GetLineColor());
4099
4100 hist->Fit(gausFit, "0RIQ");
4101 gausFit->FixParameter(0, gausFit->GetParameter(0));
4102 hist->Fit(gausFit, "RI", (aliceCentrality == 0) ? "" : "SAME");
4103 //gausFit->DrawCopy("SAME");
4104
4105 // get pT,assoc
4106 TPRegexp reg("(\\d+\\.\\d+) \\< p_\\{T,assoc\\} \\< (\\d+\\.\\d+)");
4107 arr = reg.MatchS(hist->GetTitle(), "", 0, 10);
4108 if (arr->GetEntries() != 3)
4109 continue;
4110
4111 Float_t pt1 = atof(arr->At(1)->GetName());
4112 Float_t pt2 = atof(arr->At(2)->GetName());
4113
4114 FillYield(i, aliceCentrality, (pt1 + pt2) / 2, (pt2 - pt1) / 2, 18, gausFit->GetParameter(3), gausFit->GetParError(3), gausFit->GetParameter(6), gausFit->GetParError(6));
4115
4116 if (!first)
4117 first = hist;
4118 else
4119 first->GetYaxis()->SetRangeUser(TMath::Min(first->GetMinimum(), hist->GetMinimum()), TMath::Max(first->GetMaximum(), hist->GetMaximum()));
4120 }
4121 first->GetYaxis()->SetRangeUser(first->GetMinimum(), 2 * first->GetMaximum());
4122
4123// break;
4124 }
4125
4126
4127 // draw
4128
4129 for (Int_t j=0; j<maxLeadingPt; j++)
4130 {
4131 new TCanvas;
4132
4133 Int_t markers1[] = { 24, 25, 26, 30 };
4134 Int_t markers2[] = { 20, 21, 22, 29 };
4135 Int_t colors[] = { 1, 2, 3, 4 };
4136
4137 dummy = new TH2F("dummy", ";p_{T,assoc};", 100, 0, 10, 1000, 0, 1);
4138 dummy->SetStats(0);
4139 dummy->Draw();
4140
4141 for (Int_t k=0; k<4; k++) // centrality
4142 {
4143 // CINT limitation here
4144 TGraphErrors** tmp = yields[0][j][k];
4145 nearSide = tmp[18];
4146 nearSide->SetMarkerStyle(markers1[k]);
4147 nearSide->SetMarkerColor(colors[k]);
4148 nearSide->SetLineColor(colors[k]);
4149
4150 TGraphErrors** tmp = yields[1][j][k];
4151 awaySide = tmp[18];
4152 awaySide->SetMarkerStyle(markers2[k]);
4153 awaySide->SetMarkerColor(colors[k]);
4154 awaySide->SetLineColor(colors[k]);
4155
4156 nearSide->DrawClone("PSAME");
4157 awaySide->DrawClone("PSAME");
4158 }
4159 }
4160}
4161
4162void TsallisExamples()
4163{
4164 tsallis = new TF1("tsallis", "[0] * (1-[2]*(1-[1])*x*x)**(1/(1-[1]))", -0.5 * TMath::Pi(), 1.5 * TMath::Pi());
4165
4166 Float_t q[] = { 1.0000001, 1.5, 2 };
4167 Float_t beta[] = { 0.1, 1, 10, 100 };
4168
4169 dummy = new TH2F("dummy", "", 100, -0.5 * TMath::Pi(), 1.5 * TMath::Pi(), 100, 0, 1.2);
4170 dummy->SetStats(0);
4171 dummy->Draw();
4172
4173 legend = new TLegend(0.65, 0.5, 1, 1);
4174 legend->SetFillColor(0);
4175
4176 for (Int_t i=0; i<3; i++)
4177 for (Int_t j=0; j<4; j++)
4178 {
4179 tsallis->SetParameters(1, q[i], beta[j]);
4180 tsallis->SetLineColor(i+1);
4181 tsallis->SetLineStyle(j+1);
4182
4183 legend->AddEntry(tsallis->DrawCopy("SAME"), Form("q = %.1f, #beta = %.1f", q[i], beta[j]), "L");
4184 }
4185
4186 legend->Draw();
4187}
4188
4189void DrawTsallisParams()
4190{
4191 ReadYields();
4192
4193 c = new TCanvas("c", "c", 900, 600);
4194 c->Divide(3, 2);
4195
4196 Int_t markers1[] = { 24, 25, 26, 30 };
4197 Int_t markers2[] = { 20, 21, 22, 29 };
4198 Int_t colors[] = { 1, 2, 3, 4 };
4199 Int_t caseList[] = { 12, 13, 8, 6, 8, 9, 10, 11, 1, 7 };
4200 const char* caseString[] = { "q", "beta" };
4201 const char* centralityString[] = { "0-5%", "20-40%", "60-90%", "0-5% vs 20-40%", "0-5% vs 60-90%", "20-40% vs 60-90%" };
4202
4203 l = new TLegend(0.5, 0.5, 0.9, 0.9);
4204 l->SetFillColor(0);
4205
4206 Float_t max[] = { 3, 1000 };
4207 Float_t max2[] = { 5, 2 };
4208
4209 dummy = new TH2F("dummy", ";p_{T,assoc};", 100, 0, 20, 1000, 0, 1000);
4210 dummy->SetStats(0);
4211
4212 for (Int_t caseId=0; caseId<2; caseId++) // case
4213 {
4214 for (Int_t k=0; k<3; k++) // centrality
4215 {
4216 c->cd(1 + k + caseId*3);
4217
4218 currentDummy = dummy->DrawCopy();
4219 currentDummy->GetYaxis()->SetRangeUser(0, max[caseId]);
4220 if (caseId == 1 && k < 3)
4221 gPad->SetLogy();
4222
4223 latex = new TLatex(0.15, 0.95, Form("%s - %s", caseString[caseId], centralityString[k]));
4224 latex->SetNDC();
4225 latex->SetTextSize(0.05);
4226 latex->Draw();
4227
4228 for (Int_t j=0; j<2; j++) // trigger pt
4229 {
4230 if (k < 3)
4231 {
4232 // CINT limitation here
4233 TGraphErrors** tmp = yields[0][j][k];
4234 nearSide = tmp[caseList[caseId]];
4235 nearSide->SetMarkerStyle(markers1[j]);
4236 nearSide->SetMarkerColor(colors[j]);
4237 nearSide->SetLineColor(colors[j]);
4238
4239 if (caseId == 0 && k == 0)
4240 l->AddEntry(nearSide, Form("trig pt bin %d", j), "P");
4241
4242 TGraphErrors** tmp = yields[1][j][k];
4243 awaySide = tmp[caseList[caseId]];
4244 awaySide->SetMarkerStyle(markers2[j]);
4245 awaySide->SetMarkerColor(colors[j]);
4246 awaySide->SetLineColor(colors[j]);
4247
4248 GraphShiftX(nearSide, -0.1 + j*0.1);
4249 GraphShiftX(awaySide, -0.1 + j*0.1);
4250
4251 Printf("%d %d %d", caseId, j, k);
4252 nearSide->Print();
4253 awaySide->Print();
4254
4255 nearSide->DrawClone("PSAME");
4256 awaySide->DrawClone("PSAME");
4257 }
4258 else
4259 {
4260 // CINT limitation here
4261 if (k == 3)
4262 {
4263 tmp = yields[0][j][0]; nearSideCentral = (TGraphErrors*) tmp[caseList[caseId]]->Clone();
4264 tmp = yields[1][j][0]; awaySideCentral = (TGraphErrors*) tmp[caseList[caseId]]->Clone();
4265 tmp = yields[0][j][1]; nearSidePeripheral = tmp[caseList[caseId]];
4266 tmp = yields[1][j][1]; awaySidePeripheral = tmp[caseList[caseId]];
4267 }
4268 else if (k == 4)
4269 {
4270 tmp = yields[0][j][0]; nearSideCentral = (TGraphErrors*) tmp[caseList[caseId]]->Clone();
4271 tmp = yields[1][j][0]; awaySideCentral = (TGraphErrors*) tmp[caseList[caseId]]->Clone();
4272 tmp = yields[0][j][2]; nearSidePeripheral = tmp[caseList[caseId]];
4273 tmp = yields[1][j][2]; awaySidePeripheral = tmp[caseList[caseId]];
4274 }
4275 else if (k == 5)
4276 {
4277 tmp = yields[0][j][1]; nearSideCentral = (TGraphErrors*) tmp[caseList[caseId]]->Clone();
4278 tmp = yields[1][j][1]; awaySideCentral = (TGraphErrors*) tmp[caseList[caseId]]->Clone();
4279 tmp = yields[0][j][2]; nearSidePeripheral = tmp[caseList[caseId]];
4280 tmp = yields[1][j][2]; awaySidePeripheral = tmp[caseList[caseId]];
4281 }
4282
4283 currentDummy->GetYaxis()->SetTitle("I_{CP}");
4284 currentDummy->GetYaxis()->SetRangeUser(0, max2[caseId]);
4285
4286 for (Int_t i=0; i<nearSideCentral->GetN(); i++)
4287 {
4288 //Printf("near %d %f %f", i, nearSideCentral->GetY()[i], nearSidePeripheral->GetY()[i]);
4289 if (nearSidePeripheral->GetY()[i] <= 1e-5 || nearSideCentral->GetY()[i] <= 1e-5)
4290 {
4291 nearSideCentral->RemovePoint(i);
4292 nearSidePeripheral->RemovePoint(i);
4293 i--;
4294 continue;
4295 }
4296
4297 nearSideCentral->GetEY()[i] = TMath::Sqrt(
4298 TMath::Power(nearSideCentral->GetEY()[i] / nearSideCentral->GetY()[i], 2) +
4299 TMath::Power(nearSidePeripheral->GetEY()[i] / nearSidePeripheral->GetY()[i], 2) );
4300
4301 nearSideCentral->GetY()[i] /= nearSidePeripheral->GetY()[i];
4302
4303 nearSideCentral->GetEY()[i] *= nearSideCentral->GetY()[i];
4304 }
4305 //Printf("done");
4306
4307 for (Int_t i=0; i<awaySideCentral->GetN(); i++)
4308 {
4309 //Printf("away %d", i);
4310 if (awaySidePeripheral->GetY()[i] <= 1e-5 || awaySideCentral->GetY()[i] <= 1e-5)
4311 {
4312 awaySideCentral->RemovePoint(i);
4313 awaySidePeripheral->RemovePoint(i);
4314 i--;
4315 continue;
4316 }
4317
4318 awaySideCentral->GetEY()[i] = TMath::Sqrt(
4319 TMath::Power(awaySideCentral->GetEY()[i] / awaySideCentral->GetY()[i], 2) +
4320 TMath::Power(awaySidePeripheral->GetEY()[i] / awaySidePeripheral->GetY()[i], 2) );
4321
4322 awaySideCentral->GetY()[i] /= awaySidePeripheral->GetY()[i];
4323
4324 awaySideCentral->GetEY()[i] *= awaySideCentral->GetY()[i];
4325 }
4326
4327 if (caseId == 3)
4328 {
4329 nearSideCentral = (TGraphErrors*) nearSideCentral->Clone();
4330 nearSideCentral->SetLineColor(1);
4331 nearSideCentral->SetMarkerColor(1);
4332
4333 awaySideCentral = (TGraphErrors*) awaySideCentral->Clone();
4334 awaySideCentral->SetLineColor(1);
4335 awaySideCentral->SetMarkerColor(1);
4336 }
4337
4338 if (caseId >= 4)
4339 {
4340 nearSideCentral = (TGraphErrors*) nearSideCentral->Clone();
4341 nearSideCentral->SetLineColor(caseId - 3);
4342 nearSideCentral->SetMarkerColor(caseId - 3);
4343
4344 awaySideCentral = (TGraphErrors*) awaySideCentral->Clone();
4345 awaySideCentral->SetLineColor(caseId - 3);
4346 awaySideCentral->SetMarkerColor(caseId - 3);
4347 }
4348
4349 //Printf("%d", caseList[caseId]);
4350
4351 nearSideCentral->Draw("PSAME");
4352 awaySideCentral->Draw("PSAME");
4353 }
4354 }
4355 if (caseId == 0 && k == 0)
4356 l->Draw();
4357 }
4358 }
4359
4360 c->SaveAs("tsallisparams.png");
4361}
4362
4363void DrawYieldLHCRHIC_ICP(const char* fileName = "yields.root")
4364{
4365 Int_t caseId = 0;
4366 Int_t caseList[] = { 18 };
4367 Int_t j = 1;
4368
4369 ReadYields(fileName);
4370
4371 c = new TCanvas("lhc_rhic", "lhc_rhic", 800, 600);
4372 gPad->SetGridx();
4373 gPad->SetGridy();
4374
4375 dummy = new TH2F("dummy", ";p_{T,assoc};I_{CP}", 100, 0, 12, 1000, 0, 10);
4376 dummy->SetStats(0);
4377 currentDummy = dummy->DrawCopy();
4378 currentDummy->GetYaxis()->SetRangeUser(0, 2);
4379
4380 TGraphErrors** tmp = yields[0][j][0]; nearSideCentral = (TGraphErrors*) tmp[caseList[caseId]]->Clone();
4381 tmp = yields[1][j][0]; awaySideCentral = (TGraphErrors*) tmp[caseList[caseId]]->Clone();
4382 tmp = yields[0][j][2]; nearSidePeripheral = tmp[caseList[caseId]];
4383 tmp = yields[1][j][2]; awaySidePeripheral = tmp[caseList[caseId]];
4384
4385 for (Int_t i=0; i<nearSideCentral->GetN(); i++)
4386 {
4387 //Printf("near %d %f %f", i, nearSideCentral->GetY()[i], nearSidePeripheral->GetY()[i]);
4388 if (nearSidePeripheral->GetY()[i] <= 1e-5 || nearSideCentral->GetY()[i] <= 1e-5)
4389 {
4390 nearSideCentral->RemovePoint(i);
4391 nearSidePeripheral->RemovePoint(i);
4392 i--;
4393 continue;
4394 }
4395
4396 nearSideCentral->GetEY()[i] = TMath::Sqrt(
4397 TMath::Power(nearSideCentral->GetEY()[i] / nearSideCentral->GetY()[i], 2) +
4398 TMath::Power(nearSidePeripheral->GetEY()[i] / nearSidePeripheral->GetY()[i], 2) );
4399
4400 nearSideCentral->GetY()[i] /= nearSidePeripheral->GetY()[i];
4401
4402 nearSideCentral->GetEY()[i] *= nearSideCentral->GetY()[i];
4403 }
4404 //Printf("done");
4405
4406 for (Int_t i=0; i<awaySideCentral->GetN(); i++)
4407 {
4408 //Printf("away %d", i);
4409 if (awaySidePeripheral->GetY()[i] <= 1e-5 || awaySideCentral->GetY()[i] <= 1e-5)
4410 {
4411 awaySideCentral->RemovePoint(i);
4412 awaySidePeripheral->RemovePoint(i);
4413 i--;
4414 continue;
4415 }
4416
4417 awaySideCentral->GetEY()[i] = TMath::Sqrt(
4418 TMath::Power(awaySideCentral->GetEY()[i] / awaySideCentral->GetY()[i], 2) +
4419 TMath::Power(awaySidePeripheral->GetEY()[i] / awaySidePeripheral->GetY()[i], 2) );
4420
4421 awaySideCentral->GetY()[i] /= awaySidePeripheral->GetY()[i];
4422
4423 awaySideCentral->GetEY()[i] *= awaySideCentral->GetY()[i];
4424 }
4425
4426 nearSideCentral->SetMarkerStyle(21);
4427 nearSideCentral->SetLineColor(1);
4428 nearSideCentral->SetMarkerColor(1);
4429
4430 awaySideCentral->SetMarkerStyle(25);
4431 awaySideCentral->SetLineColor(1);
4432 awaySideCentral->SetMarkerColor(1);
4433
4434 nearSideCentral->Draw("PSAME");
4435 awaySideCentral->Draw("PSAME");
4436
4437 legend = new TLegend(0.4, 0.8, 0.99, 0.99);
4438 legend->SetFillColor(0);
4439 legend->AddEntry(nearSideCentral, "ALICE I_{CP} Near 8-15 GeV 0-5%/60-90%", "P");
4440 legend->AddEntry(awaySideCentral, "ALICE I_{CP} Away 8-15 GeV 0-5%/60-90%", "P");
4441
4442 if (0)
4443 {
4444 nearSideCentral->Fit("pol1", "", "SAME", 4.5, 11.5);
4445 awaySideCentral->Fit("pol1", "", "SAME", 4.5, 11.5);
4446 nearSideCentral->GetFunction("pol1")->SetLineWidth(1);
4447 awaySideCentral->GetFunction("pol1")->SetLineWidth(1);
4448 }
4449
4450 if (0)
4451 {
4452 // RCP, ALICE
4453 dndpt_central = ReadHepdata("raa_dndpt_central.txt", kFALSE, 3);
4454 dndpt_peripheral = ReadHepdata("raa_dndpt_peripheral.txt", kFALSE, 3);
4455
4456 //dndpt_central->Print();
4457 //dndpt_peripheral->Print();
4458
4459 // ratio of Ncoll (from paper)
4460 // TODO there is also an uncertainty on that
4461 Double_t scale = 1690. / 15.7;
4462 Double_t scaleUnc = TMath::Sqrt(TMath::Power(131. / 1690., 2) + TMath::Power(0.7 / 15.7, 2));
4463
4464 for (Int_t i=0; i<dndpt_central->GetN(); i++)
4465 {
4466 dndpt_central->GetEY()[i] = TMath::Sqrt(TMath::Power(dndpt_central->GetEY()[i] / dndpt_central->GetY()[i], 2) +
4467 TMath::Power(dndpt_peripheral->GetEY()[i] / dndpt_peripheral->GetY()[i], 2));
4468 dndpt_central->GetY()[i] /= dndpt_peripheral->GetY()[i] * scale;
4469 dndpt_central->GetEY()[i] *= dndpt_central->GetY()[i];
4470 }
4471
4472 //new TCanvas;
4473 //dndpt_central->Print();
4474 //dndpt_central->Draw("AP");
4475
4476 dndpt_central->Draw("*SAME");
4477
4478 latex = new TLatex(0.34, 0.09, "9% N_{coll} scale uncertainty on R_{CP}");
4479 latex->SetTextSize(0.03);
4480 latex->Draw();
4481
4482 // RAA, ALICE
4483 raa_central = ReadHepdata("raa_alice_central.txt", kFALSE, 3);
4484 raa_central->SetMarkerStyle(20);
4485 //raa_central->Draw("PSAME");
4486
4487 legend->AddEntry(dndpt_central, "ALICE R_{CP} 0-5%/70-80%", "P");
4488 }
4489
4490 if (0)
4491 {
4492 // IAA, RHIC
4493 // calculate ICP from IAA(0-20) / IAA (20-60)
4494 // TODO only using uncertainties from IAA(0-20)
4495 // TODO systematic uncertainty stored in graph with _sys appended
4496 TFile::Open("rhic/pi0h_graphs.root");
4497
4498 for (Int_t i=0; i<3; i+=2)
4499 {
4500 // gIAA_<ptTrigBin>_<centBin>_<angularRegionBin>
4501 central = (TGraphErrors*) gFile->Get(Form("gIAA_3_0_%d", i));
4502 peripheral = (TGraphErrors*) gFile->Get(Form("gIAA_3_1_%d", i));
4503
4504 for (Int_t j=0; j<central->GetN(); j++)
4505 {
4506 central->GetY()[j] /= peripheral->GetY()[j];
4507 central->GetEY()[j] /= peripheral->GetY()[j];
4508 }
4509
4510 central->SetMarkerStyle((i == 0) ? 29 : 30);
4511 central->SetMarkerColor(2);
4512 central->SetLineColor(2);
4513 central->Draw("PSAME");
4514 legend->AddEntry(central, Form("PHENIX I_{CP} %s 9-12 GeV 0-20%/20-60%", (i == 0) ? "Near" : "Away"), "P");
4515 }
4516 }
4517
4518 legend->Draw();
4519
4520 c->SaveAs("icp.png");
4521}
4522
4523TGraphErrors* GetRatio(const char* fileName, Int_t centrality1, Int_t centrality2, Int_t triggerId, Int_t caseId, Int_t side, const char* fileName2 = 0)
4524{
4525 // 0 = near side; 1 = away side
4526
4527 ReadYields(fileName);
4528
4529 TGraphErrors** tmp = yields[side][triggerId][centrality1];
4530 nearSideCentral = (TGraphErrors*) tmp[caseId]->Clone();
4531
4532 if (fileName2)
4533 ReadYields(fileName2);
4534
4535 tmp = yields[side][triggerId][centrality2];
4536 nearSidePeripheral = (TGraphErrors*) tmp[caseId]->Clone();
4537
4538// Printf("%d %d", nearSideCentral->GetN(), nearSidePeripheral->GetN());
4539
4540 for (Int_t i=0; i<nearSideCentral->GetN(); i++)
4541 {
4542 if (nearSidePeripheral->GetY()[i] <= 1e-5 || nearSideCentral->GetY()[i] <= 1e-5)
4543 {
4544 nearSideCentral->RemovePoint(i);
4545 nearSidePeripheral->RemovePoint(i);
4546 i--;
4547 continue;
4548 }
4549
4550 if (nearSideCentral->GetX()[i] != nearSidePeripheral->GetX()[i])
4551 {
4552 Printf("Inconsistent x values %f %f", nearSideCentral->GetX()[i], nearSidePeripheral->GetX()[i]);
4553 AliFatal("");
4554 }
4555
4556// printf("%f %f %f", nearSideCentral->GetX()[i], nearSideCentral->GetY()[i], nearSidePeripheral->GetY()[i]);
4557
4558 nearSideCentral->GetEY()[i] = TMath::Sqrt(
4559 TMath::Power(nearSideCentral->GetEY()[i] / nearSideCentral->GetY()[i], 2) +
4560 TMath::Power(nearSidePeripheral->GetEY()[i] / nearSidePeripheral->GetY()[i], 2) );
4561
4562 nearSideCentral->GetY()[i] /= nearSidePeripheral->GetY()[i];
4563 // scaling for IAA
4564 if (centrality2 == 3)
4565 nearSideCentral->GetY()[i] /= kPythiaScalingFactor;
4566
4567// Printf(" %f", nearSideCentral->GetY()[i]);
4568
4569 nearSideCentral->GetEY()[i] *= nearSideCentral->GetY()[i];
4570 }
4571
4572 //nearSideCentral->GetXaxis()->SetTitle("p_{T, assoc}");
4573 //nearSideCentral->GetYaxis()->SetTitle((centrality2 == 3) ? "I_{AA}" : "I_{CP}");
4574
4575 if (0 && side == 1 && centrality2 == 3)
4576 {
4577 Printf("\n\n\nWARNING !!! Fudging different away side acceptance (only for second file)\n\n\n");
4578 ScaleGraph(nearSideCentral, 1.56);
4579 }
4580
4581 return nearSideCentral;
4582}
4583
4584TGraphErrors* GetIAA(const char* fileName, Int_t centrality, Int_t triggerId, Int_t caseId, Int_t side)
4585{
4586 return GetRatio(fileName, centrality, 3, triggerId, caseId, side);
4587}
4588
4589TGraphErrors* GetICP(const char* fileName, Int_t triggerId, Int_t caseId, Int_t side)
4590{
4591 return GetRatio(fileName, 1, 2, triggerId, caseId, side);
4592}
4593
4594void DrawYieldLHCRHIC_IAA(const char* fileName, Bool_t central, Bool_t rhic)
4595{
4596 Int_t caseId = 0;
4597 Int_t caseList[] = { 18 };
4598 Int_t j = 1;
4599
4600 ReadYields(fileName);
4601
4602 c = new TCanvas("lhc_rhic", "lhc_rhic", 800, 600);
4603 gPad->SetGridx();
4604 gPad->SetGridy();
4605
4606 dummy = new TH2F("dummy", ";p_{T,assoc};I_{AA}", 100, 0, 12, 1000, 0, 10);
4607 dummy->SetStats(0);
4608 currentDummy = dummy->DrawCopy();
4609 currentDummy->GetYaxis()->SetRangeUser(0, 3);
4610
4611 Int_t nominatorBin = 0;
4612 if (!central)
4613 nominatorBin = 2;
4614
4615 nearSideCentral = GetIAA(fileName, nominatorBin, j, caseList[caseId], 0);
4616 awaySideCentral = GetIAA(fileName, nominatorBin, j, caseList[caseId], 1);
4617
4618 nearSideCentral->SetMarkerStyle(21);
4619 nearSideCentral->SetLineColor(1);
4620 nearSideCentral->SetMarkerColor(1);
4621
4622 awaySideCentral->SetMarkerStyle(25);
4623 awaySideCentral->SetLineColor(1);
4624 awaySideCentral->SetMarkerColor(1);
4625
4626 nearSideCentral->Draw("PSAME");
4627 awaySideCentral->Draw("PSAME");
4628
4629 legend = new TLegend(0.4, 0.8, 0.99, 0.99);
4630 legend->SetFillColor(0);
4631 legend->AddEntry(nearSideCentral, Form("ALICE I_{AA} Near 8-15 GeV %s%%/Pythia6", (central) ? "0-5" : "60-90"), "P");
4632 legend->AddEntry(awaySideCentral, Form("ALICE I_{AA} Away 8-15 GeV %s%%/Pythia6", (central) ? "0-5" : "60-90"), "P");
4633
4634 if (rhic)
4635 {
4636 // IAA, RHIC
4637 // systematic uncertainty stored in graph with _sys appended
4638 TFile::Open("rhic/pi0h_graphs.root");
4639
4640 for (Int_t i=0; i<3; i+=2)
4641 {
4642 // gIAA_<ptTrigBin>_<centBin>_<angularRegionBin>
4643 rhic_iaa = (TGraphErrors*) gFile->Get(Form("gIAA_2_%d_%d", (central) ? 0 : 1, i));
4644 rhic_iaa_sys = (TGraphErrors*) gFile->Get(Form("gIAA_2_%d_%d_sys", (central) ? 0 : 1, i));
4645
4646 rhic_iaa->SetMarkerStyle((i == 0) ? 29 : 30);
4647 rhic_iaa->SetMarkerColor(2);
4648 rhic_iaa->SetLineColor(2);
4649 rhic_iaa->Draw("PSAME");
4650 rhic_iaa_sys->SetLineColor(2);
4651 rhic_iaa_sys->SetMarkerColor(2);
4652 rhic_iaa_sys->Draw("PSAME");
4653 legend->AddEntry(rhic_iaa, Form("PHENIX I_{AA} %s 7-9 GeV %s%%/pp", (i == 0) ? "Near" : "Away", (central) ? "0-20" : "20-60"), "P");
4654 }
4655 for (Int_t i=0; i<3; i+=2)
4656 {
4657 // gIAA_<ptTrigBin>_<centBin>_<angularRegionBin>
4658 rhic_iaa = (TGraphErrors*) gFile->Get(Form("gIAA_3_%d_%d", (central) ? 0 : 1, i));
4659 rhic_iaa_sys = (TGraphErrors*) gFile->Get(Form("gIAA_3_%d_%d_sys", (central) ? 0 : 1, i));
4660
4661 rhic_iaa->SetMarkerStyle((i == 0) ? 20 : 24);
4662 rhic_iaa->SetMarkerColor(4);
4663 rhic_iaa->SetLineColor(4);
4664 rhic_iaa->Draw("PSAME");
4665 rhic_iaa_sys->SetLineColor(4);
4666 rhic_iaa_sys->SetMarkerColor(4);
4667 rhic_iaa_sys->Draw("PSAME");
4668 legend->AddEntry(rhic_iaa, Form("PHENIX I_{AA} %s 9-12 GeV %s%%/pp", (i == 0) ? "Near" : "Away", (central) ? "0-20" : "20-60"), "P");
4669 }
4670 }
4671
4672 legend->Draw();
4673
4674 c->SaveAs("iaa.png");
4675}
4676
4677void CompareIAAICP(const char* fileName1, const char* fileName2, Int_t nominatorBin, Int_t denominatorBin, Bool_t skipAway = kFALSE)
4678{
4679 Int_t j = 1;
4680 Int_t caseId = 18;
4681// caseId = 23; Printf("WARNING: Comparing case 23");
4682 //Int_t caseId = 12;
4683
4684 nearSide1 = GetRatio(fileName1, nominatorBin, denominatorBin, j, caseId, 0);
4685 if (!skipAway)
4686 awaySide1 = GetRatio(fileName1, nominatorBin, denominatorBin, j, caseId, 1);
4687 else
4688 awaySide1 = new TGraphErrors;
4689
4690 kPythiaScalingFactor = 1;
4691 nearSide2 = GetRatio(fileName2, nominatorBin, denominatorBin, j, caseId, 0);
4692 if (!skipAway)
4693 awaySide2 = GetRatio(fileName2, nominatorBin, denominatorBin, j, caseId, 1);
4694 else
4695 awaySide2 = new TGraphErrors;
4696
4697// Printf("\n\n\nWARNING !!! Fudging different away side acceptance (only for second file)\n\n\n");
4698// ScaleGraph(awaySide2, 1.56);
4699
4700/* ScaleGraph(nearSide2, 1.33);
4701 ScaleGraph(awaySide2, 1.33);*/
4702
4703 c = new TCanvas;
4704 dummy = new TH2F("dummy", Form(";p_{T,assoc};%s", (denominatorBin == 3) ? "I_{AA}" : "I_{CP}"), 100, 2, 12, 1000, 0, 10);
4705 dummy->SetStats(0);
4706 currentDummy = dummy->DrawCopy();
4707 currentDummy->GetYaxis()->SetRangeUser(0, 2.5);
4708
4709 nearSide1->SetMarkerStyle(21);
4710 nearSide1->SetLineColor(1);
4711 nearSide1->SetMarkerColor(1);
4712
4713 nearSide2->SetMarkerStyle(21);
4714 nearSide2->SetLineColor(2);
4715 nearSide2->SetMarkerColor(2);
4716
4717 awaySide1->SetMarkerStyle(25);
4718 awaySide1->SetLineColor(1);
4719 awaySide1->SetMarkerColor(1);
4720
4721 awaySide2->SetMarkerStyle(25);
4722 awaySide2->SetLineColor(2);
4723 awaySide2->SetMarkerColor(2);
4724
4725 RemovePointsBelowX(nearSide1, 3);
4726 RemovePointsBelowX(nearSide2, 3);
4727 RemovePointsBelowX(awaySide1, 3);
4728 RemovePointsBelowX(awaySide2, 3);
4729
4730 gPad->SetGridx();
4731 gPad->SetGridy();
4732
4733 nearSide1->DrawClone("PSAME");
4734 awaySide1->DrawClone("PSAME");
4735 nearSide2->DrawClone("PSAME");
4736 awaySide2->DrawClone("PSAME");
4737
4738 new TCanvas;
4739 currentDummy = dummy->DrawCopy();
4740 currentDummy->GetYaxis()->SetRangeUser(0.5, 1.5);
4741 gPad->SetGridx();
4742 gPad->SetGridy();
4743
4744 DivideGraphs(nearSide1, nearSide2);
4745 DivideGraphs(awaySide1, awaySide2);
4746
4747 nearSide1->Draw("PSAME");
4748 awaySide1->Draw("PSAME");
4749
4750 nearSide1->Fit("pol0", "", "SAME", 3.01, 9.99);
4751 awaySide1->Fit("pol0", "", "SAME", 3.01, 9.99);
4752}
4753
4754void ScaleGraph(TGraphErrors* graph, Float_t factor)
4755{
4756 for (Int_t i=0; i<graph->GetN(); i++)
4757 {
4758 graph->GetY()[i] *= factor;
4759 graph->GetEY()[i] *= factor;
4760 }
4761}
4762
4763TGraphErrors* DrawBaselines(const char* fileName, Int_t numeratorBin, Int_t denominatorBin, Int_t side, Bool_t verbose = kTRUE)
4764{
4765 Int_t j = 1;
4766
4767 TGraphErrors* first = 0;
4768 TGraphErrors* max = 0;
4769
4770 if (verbose)
4771 {
4772 c = new TCanvas;
4773 dummy = new TH2F("dummy", Form(";p_{T,assoc};%s", (denominatorBin == 3) ? "I_{AA}" : "I_{CP}"), 100, 0, 12, 1000, 0, 10);
4774 dummy->SetStats(0);
4775 currentDummy = dummy->DrawCopy();
4776 currentDummy->GetYaxis()->SetRangeUser(0, 3);
4777
4778 c2 = new TCanvas;
4779 currentDummy = dummy->DrawCopy();
4780 currentDummy->GetYaxis()->SetRangeUser(0, 2);
4781 }
4782
4783// Int_t caseList[] = { 18, 19, 21, 22 };
4784 //Int_t caseList[] = { 23, 24, 26, 27 };
4785 Int_t caseList[] = { 18, 19, 22 };
4786
4787 for (Int_t caseId = 0; caseId < 3; caseId++)
4788 {
4789 graph = GetRatio(fileName, numeratorBin, denominatorBin, j, caseList[caseId], side);
4790
4791 graph->SetLineColor(caseId + 1);
4792 graph->SetMarkerColor(caseId + 1);
4793
4794 RemovePointsBelowX(graph, 3);
4795
4796 if (verbose)
4797 {
4798 c->cd();
4799 graph->DrawClone("*SAME");
4800 }
4801
4802 if (!first)
4803 {
4804 first = graph;
4805 max = (TGraphErrors*) graph->Clone();
4806 for (Int_t i=0; i<max->GetN(); i++)
4807 {
4808 max->GetY()[i] = 0;
4809 max->GetEY()[i] = 0;
4810 }
4811 }
4812 else
4813 {
4814 DivideGraphs(graph, first);
4815
4816 if (verbose)
4817 {
4818 c2->cd();
4819 graph->DrawClone("*SAME");
4820 }
4821
4822 for (Int_t i=0; i<graph->GetN(); i++)
4823 {
4824 if (max->GetY()[i] < TMath::Abs(graph->GetY()[i] - 1))
4825 max->GetY()[i] = TMath::Abs(graph->GetY()[i] - 1);
4826 }
4827 }
4828 }
4829
4830 if (verbose)
4831 {
4832 new TCanvas;
4833 max->Draw("A*");
4834 }
4835
4836 max->GetXaxis()->SetTitle("p_{T, assoc}");
4837 max->GetYaxis()->SetTitle((denominatorBin == 3) ? "Effect on I_{AA}" : "Effect on I_{CP}");
4838 max->GetYaxis()->SetRangeUser(0, 0.4);
4839
4840 return max;
4841}
4842
4843void DrawBaselinesAll(const char* fileName)
4844{
4845 c = new TCanvas("c", "c", 1000, 600);
4846 c->Divide(4, 2);
4847
4848 for (Int_t i=0; i<2; i++)
4849 {
4850 c->cd(1+i*4); DrawBaselines(fileName, 0, 3, i, kFALSE)->Draw("A*"); gPad->SetGridy();
4851 c->cd(2+i*4); DrawBaselines(fileName, 1, 3, i, kFALSE)->Draw("A*"); gPad->SetGridy();
4852 c->cd(3+i*4); DrawBaselines(fileName, 2, 3, i, kFALSE)->Draw("A*"); gPad->SetGridy();
4853 c->cd(4+i*4); DrawBaselines(fileName, 0, 2, i, kFALSE)->Draw("A*"); gPad->SetGridy();
4854 }
4855}
4856
4857TGraphErrors* DrawSystUncIAAPYTHIA(TGraphErrors* graph, Int_t iaa_icp, Int_t awaySide)
4858{
4859 // iaa = 0, icp = 1
4860
4861 Float_t baseline = 1;
4862 if (awaySide == 0)
4863 baseline = 0.07;
4864 else if (awaySide == 1)
4865 baseline = 0.2;
4866
4867 /*
4868 Float_t reference = 0;
4869 if (iaa_icp == 0)
4870 reference = 0.13;
4871 */
4872
4873 Float_t efficiency = 0.08;
4874
4875 Float_t centrality = 1;
4876 if (iaa_icp == 0)
4877 centrality = (awaySide == 0) ? 0.02 : 0.06;
4878 else if (iaa_icp == 1)
4879 centrality = (awaySide == 0) ? 0.04 : 0.08;
4880
4881 Float_t ptResolution = 0;
4882
4883 Float_t total = TMath::Sqrt(baseline * baseline + efficiency * efficiency + centrality * centrality + ptResolution * ptResolution);
4884
4885 Printf("Total syst: %f", total);
4886
4887 systUnc = (TGraphErrors*) graph->Clone();
4888 for (Int_t i=0; i<systUnc->GetN(); i++)
4889 {
4890 systUnc->GetEY()[i] = systUnc->GetY()[i] * total;
4891 systUnc->GetEX()[i] = 0;
4892 }
4893
4894 //systUnc->Print();
4895
4896 systUnc->SetLineColor(kGray + 1);
4897 systUnc->SetLineWidth(6);
4898
4899 systUnc->Draw("PSAME");
4900
4901 return systUnc;
4902}
4903
4904TGraphErrors* DrawSystUncPreliminaries(TGraphErrors* graph, Int_t iaa_icp, Int_t awaySide, Int_t iaa, Bool_t central)
4905{
4906 // iaa = 0, icp = 1
4907
4908 Float_t baseline = 1;
4909 if (awaySide == 0)
4910 baseline = 0.05;
4911 else if (awaySide == 1)
4912 {
4913 if (iaa == 0 && central || iaa == 1)
4914 baseline = 0.2;
4915 else if (iaa == 0 && !central)
4916 baseline = 0.05;
4917 else if (iaa == 2 && central)
4918 baseline = 0.1;
4919 }
4920
4921 /*
4922 Float_t reference = 0;
4923 if (iaa_icp == 0)
4924 reference = 0.13;
4925 */
4926
4927 Float_t efficiency = 0.08;
4928 if (iaa_icp == 1)
4929 efficiency = 0.05;
4930
4931 Float_t centrality = 1;
4932 if (iaa_icp == 0)
4933 centrality = 0.04;
4934 else if (iaa_icp == 1)
4935 centrality = 0.06;
4936
4937 Float_t ptResolution = 0.03;
4938
4939 Float_t integrationWindow = 0;
4940 if (awaySide == 1)
4941 integrationWindow = 0.03;
4942
4943 Float_t total = TMath::Sqrt(baseline * baseline + efficiency * efficiency + centrality * centrality + ptResolution * ptResolution + integrationWindow * integrationWindow);
4944
4945 Printf("Total syst: %f", total);
4946
4947 systUnc = (TGraphErrors*) graph->Clone();
4948 for (Int_t i=0; i<systUnc->GetN(); i++)
4949 {
4950 systUnc->GetEY()[i] = systUnc->GetY()[i] * total;
4951 systUnc->GetEX()[i] = 0;
4952 }
4953
4954 //systUnc->Print();
4955
4956 systUnc->SetLineColor(kGray + 1);
4957 systUnc->SetLineWidth(6);
4958
4959 systUnc->Draw("PSAME");
4960
4961 return systUnc;
4962}
4963
4964TGraphErrors* DrawSystUnc(TGraphErrors* graph, Int_t iaa_icp, Int_t awaySide, Int_t iaa, Bool_t central, Float_t shift = 0.0)
4965{
4966 // iaa_icp: iaa = 0, icp = 1
4967
4968 Float_t baseline = 1;
4969 if (awaySide == 0)
4970 baseline = 0.05;
4971 else if (awaySide == 1)
4972 {
4973 if (iaa == 0 && central || iaa == 1)
4974 baseline = 0.2;
4975 else if (iaa == 0 && !central)
4976 baseline = 0.05;
4977 else if (iaa == 2 && central)
4978 baseline = 0.1;
4979 }
4980
4981 /*
4982 Float_t reference = 0;
4983 if (iaa_icp == 0)
4984 reference = 0.13;
4985 */
4986
4987 Float_t efficiency = 0.04;
4988
4989 Float_t centrality = 1;
4990 if (iaa_icp == 0)
4991 centrality = 0.02;
4992 else if (iaa_icp == 1)
4993 centrality = 0.03;
4994
4995 Float_t ptResolution = 0;
4996
4997 Float_t integrationWindow = 0;
4998 if (awaySide == 1)
4999 integrationWindow = 0.03;
5000
5001 Float_t corrections = 1;
5002 if (iaa_icp == 0)
5003 corrections = 0.02;
5004 else if (iaa_icp == 1)
5005 corrections = 0.01;
5006
5007 Float_t twoTrack = 0.01;
5008
5009 Float_t total = TMath::Sqrt(baseline * baseline + efficiency * efficiency + centrality * centrality + ptResolution * ptResolution + integrationWindow * integrationWindow + corrections * corrections + twoTrack * twoTrack);
5010
5011 Printf("%f %f %f %f %f %f %f --> Total syst: %f", baseline, efficiency, centrality, ptResolution, integrationWindow, corrections, twoTrack, total);
5012
5013 systUnc = (TGraphErrors*) graph->Clone();
5014 for (Int_t i=0; i<systUnc->GetN(); i++)
5015 {
5016 systUnc->GetEY()[i] = systUnc->GetY()[i] * total;
5017 systUnc->GetEX()[i] = 0;
5018 Printf("pt = %.2f y = %.2f +- %.2f (stat.) +- %.2f (syst.)", graph->GetX()[i] - shift, graph->GetY()[i], graph->GetEY()[i], systUnc->GetEY()[i]);
5019 }
5020
5021 //systUnc->Print();
5022
5023 systUnc->SetLineColor(kGray + 1);
5024 systUnc->SetLineWidth(4);
5025
5026 systUnc->Draw("PSAME e2");
5027
5028 return systUnc;
5029}
5030
5031void IAA(const char* fileName, Int_t iaa, const char* fileNameEtaGap = 0)
5032{
5033 // iaa
5034 // 0 = IAA LHC
5035 // 1 = ICP
5036 // 2 = IAA RHIC
5037 // 3 = IAA LHC with theory
5038
5039 Bool_t showTheory = 0;
5040 Bool_t showSTAR = 0;
5041
5042 if (iaa == 3)
5043 {
5044 showTheory = kTRUE;
5045 iaa = 0;
5046 }
5047
5048 if (iaa == 4)
5049 {
5050 showSTAR = kTRUE;
5051 iaa = 0;
5052 }
5053
5054 if (kPythiaScalingFactor != 1)
5055 Printf("Using reference data scaling factor: %f", kPythiaScalingFactor);
5056
5057 style();
5058
5059 Int_t j = 1;
5060 Int_t caseId[] = { 18, 23 };
5061
5062 c = new TCanvas((iaa != 1) ? ((iaa == 0) ? "iaa" : "iaarhic") : "icp", (iaa != 1) ? ((iaa == 0) ? "iaa" : "iaarhic") : "icp", 900, 450);
5063 c->Range(0, 0, 1, 1);
5064
5065 TPad* pad1 = new TPad(Form("%s_2", fileName), "", 0, 0, 0.5, 1);
5066 pad1->Draw();
5067
5068 TPad* pad2 = new TPad(Form("%s_1", fileName), "", 0.5, 0, 1, 1);
5069 pad2->Draw();
5070
5071 pad1->cd();
5072 gPad->SetRightMargin(0);
5073 gPad->SetTopMargin(0.05);
5074 gPad->SetLeftMargin(0.13);
5075 //gPad->SetGridx();
5076// gPad->SetGridy();
5077
5078 pad2->cd();
5079 gPad->SetLeftMargin(0);
5080 gPad->SetTopMargin(0.05);
5081 gPad->SetRightMargin(0.13);
5082 //gPad->SetGridx();
5083// gPad->SetGridy();
5084
5085 pad1->cd();
5086// dummy = new TH2F("dummy", Form(";p_{T,assoc} (GeV/c);%s", (iaa != 1) ? "I_{AA,Pythia}" : "I_{CP}"), 100, 1.5, 10.5, 1000, 0, 2.9);
5087 dummy = new TH2F("dummy", Form(";p_{T,assoc} (GeV/#font[12]{c});%s", (iaa != 1) ? "I_{AA}" : "I_{CP}"), 100, 1.5, 10.5, 1000, 0, 2.4);
5088 dummy->SetStats(0);
5089// dummy->GetYaxis()->SetTitleOffset(1.3);
5090 dummy->GetXaxis()->SetTitleOffset(1.1);
5091 currentDummy = dummy->DrawCopy();
5092
5093 gStyle->SetTextAlign(13);
5094
5095 latex = new TLatex(0.17, 0.90, "Near-side_{ }");
5096 latex->SetTextSize(0.04);
5097 latex->SetNDC();
5098 latex->Draw();
5099
5100// if (iaa != 1)
5101// {
5102// box = new TBox(2, 0.87, 2.5, 1.13);
5103// box->SetFillColor(kGray + 1);
5104// box->SetLineColor(kGray + 1);
5105// box->Draw();
5106//
5107// box2 = new TBox(2, 0.87 * 1.5, 2.5, 1.13 * 1.5);
5108// box2->SetFillColor(kGray + 1);
5109// box2->SetLineColor(kGray + 1);
5110// box2->Draw();
5111// }
5112
5113 pad2->cd();
5114 currentDummy = dummy->DrawCopy();
5115
5116/* if (iaa != 1)
5117 box->Draw();*/
5118
5119 latex = new TLatex(0.05, 0.90, "Away-side");
5120 latex->SetTextSize(0.04);
5121 latex->SetNDC();
5122 latex->Draw();
5123
5124 legend = new TLegend(0.27, (showTheory) ? 0.60 : 0.62, (iaa != 2 && !showSTAR) ? 0.63 : 0.95, 0.77);
5125 legend->SetFillColor(0);
5126 legend->SetBorderSize(0);
5127 legend->SetTextSize((iaa != 2) ? 0.04 : 0.035);
5128
5129 for (Int_t i=0; i<2; i++)
5130 {
5131 nearSideCentral = GetRatio(fileName, (iaa != 2) ? 0 : 1, (iaa != 1) ? 3 : 2, j, caseId[i], 0);
5132 if (iaa == 0)
5133 nearSidePeripheral = GetRatio(fileName, 2, 3, j, caseId[i], 0);
5134 awaySideCentral = GetRatio(fileName, (iaa != 2) ? 0 : 1, (iaa != 1) ? 3 : 2, j, caseId[i], 1);
5135 if (iaa == 0)
5136 awaySidePeripheral = GetRatio(fileName, 2, 3, j, caseId[i], 1);
5137
5138 RemovePointsBelowX(nearSideCentral, 3);
5139 RemovePointsBelowX(awaySideCentral, 3);
5140 RemovePointsAboveX(nearSideCentral, 10);
5141 RemovePointsAboveX(awaySideCentral, 10);
5142
5143 RemoveXErrors(nearSideCentral); RemoveXErrors(awaySideCentral);
5144
5145 if (iaa == 0)
5146 {
5147 RemovePointsBelowX(nearSidePeripheral, 3);
5148 RemovePointsBelowX(awaySidePeripheral, 3);
5149 RemovePointsAboveX(nearSidePeripheral, 10);
5150 RemovePointsAboveX(awaySidePeripheral, 10);
5151 ShiftPoints(nearSidePeripheral, 0.2);
5152 ShiftPoints(awaySidePeripheral, 0.2);
5153 RemoveXErrors(nearSidePeripheral); RemoveXErrors(awaySidePeripheral);
5154 }
5155
5156 nearSideCentral->SetMarkerStyle(21);
5157 nearSideCentral->SetLineColor(1);
5158 nearSideCentral->SetMarkerColor(1);
5159
5160 awaySideCentral->SetMarkerStyle(21);
5161 awaySideCentral->SetLineColor(1);
5162 awaySideCentral->SetMarkerColor(1);
5163
5164 if (showTheory)
5165 {
5166 nearSideCentral->SetLineColor(2);
5167 nearSideCentral->SetMarkerColor(2);
5168 awaySideCentral->SetLineColor(2);
5169 awaySideCentral->SetMarkerColor(2);
5170 }
5171
5172 if (iaa == 0)
5173 {
5174 nearSidePeripheral->SetMarkerStyle(22);
5175 nearSidePeripheral->SetLineColor(2);
5176 nearSidePeripheral->SetMarkerColor(2);
5177
5178 awaySidePeripheral->SetMarkerStyle(22);
5179 awaySidePeripheral->SetLineColor(2);
5180 awaySidePeripheral->SetMarkerColor(2);
5181 }
5182
5183 if (i == 0)
5184 {
5185// TString denominatorStr("Pythia");
5186 TString denominatorStr("pp");
5187 if (iaa == 0)
5188 {
5189 legend->AddEntry(nearSideCentral, Form("%s0-5% / %s", (showSTAR) ? "ALICE Pb-Pb 2.76 TeV " : "", denominatorStr.Data()), "P");
5190 if (!showTheory)
5191 legend->AddEntry(nearSidePeripheral, Form("%s60-90% / %s", (showSTAR) ? "ALICE Pb-Pb 2.76 TeV " : "", denominatorStr.Data()), "P");
5192 }
5193 else if (iaa == 2)
5194 {
5195// legend->AddEntry(nearSideCentral, Form("0-20% / %s", denominatorStr.Data()), "P");
5196 legend->AddEntry(nearSideCentral, Form("ALICE 8 GeV/#font[12]{c} < p_{T,trig} < 15 GeV/#font[12]{c}", denominatorStr.Data()), "P");
5197 }
5198 }
5199
5200
5201 const char* style = "PSAME";
5202 if (i == 1)
5203 style = "LSAMEX";
5204
5205 awaySideCentral->Print();
5206
5207 pad1->cd();
5208 if (i == 0)
5209 DrawSystUnc(nearSideCentral, (iaa == 1), 0, iaa, kTRUE);
5210 nearSideCentral->DrawClone(style);
5211 if (iaa == 0 && !showTheory)
5212 {
5213 if (i == 0)
5214 DrawSystUnc(nearSidePeripheral, (iaa == 1), 0, iaa, kFALSE);
5215 nearSidePeripheral->DrawClone(style);
5216 }
5217
5218 pad2->cd();
5219 if (i == 0)
5220 DrawSystUnc(awaySideCentral, (iaa == 1), 1, iaa, kTRUE);
5221 awaySideCentral->DrawClone(style);
5222 if (iaa == 0 && !showTheory)
5223 {
5224 if (i == 0)
5225 DrawSystUnc(awaySidePeripheral, (iaa == 1), 1, iaa, kFALSE);
5226 awaySidePeripheral->DrawClone(style);
5227 }
5228 }
5229
5230 if (fileNameEtaGap)
5231 {
5232 pad1->cd();
5233
5234 nearSideEtaGapCentral = GetRatio(fileNameEtaGap, (iaa != 2) ? 0 : 1, (iaa != 1) ? 3 : 2, j, caseId[0], 0);
5235 RemovePointsBelowX(nearSideEtaGapCentral, 3);
5236 RemovePointsAboveX(nearSideEtaGapCentral, 10);
5237 RemoveXErrors(nearSideEtaGapCentral);
5238 nearSideEtaGapCentral->SetMarkerStyle(25);
5239 nearSideEtaGapCentral->SetLineColor(1);
5240 nearSideEtaGapCentral->SetMarkerColor(1);
5241 nearSideEtaGapCentral->Draw("PSAME");
5242
5243 if (iaa != 1)
5244 {
5245 nearSideEtaGapPeripheral = GetRatio(fileNameEtaGap, 2, 3, j, caseId[0], 0);
5246 RemovePointsBelowX(nearSideEtaGapPeripheral, 3);
5247 RemovePointsAboveX(nearSideEtaGapPeripheral, 10);
5248 RemoveXErrors(nearSideEtaGapPeripheral);
5249 ShiftPoints(nearSideEtaGapPeripheral, 0.2);
5250 nearSideEtaGapPeripheral->SetMarkerStyle(26);
5251 nearSideEtaGapPeripheral->SetLineColor(2);
5252 nearSideEtaGapPeripheral->SetMarkerColor(2);
5253 nearSideEtaGapPeripheral->Draw("PSAME");
5254 }
5255 }
5256
5257 if (iaa == 2)
5258 {
5259 // IAA, RHIC, PHENIX
5260 // systematic uncertainty stored in graph with _sys appended
5261 TFile::Open("rhic/pi0h_graphs.root");
5262
5263 legend2 = new TLegend(0.5, 0.16, 0.96, 0.27);
5264 legend2->SetFillColor(0);
5265
5266 for (Int_t ptTrigBin=2; ptTrigBin<4; ptTrigBin++)
5267 {
5268 Bool_t central = kTRUE;
5269 for (Int_t i=0; i<3; i+=2)
5270 {
5271 // gIAA_<ptTrigBin>_<centBin>_<angularRegionBin>
5272 rhic_iaa = (TGraphErrors*) gFile->Get(Form("gIAA_%d_%d_%d", ptTrigBin, (central) ? 0 : 1, i));
5273 rhic_iaa_sys = (TGraphErrors*) gFile->Get(Form("gIAA_%d_%d_%d_sys", ptTrigBin, (central) ? 0 : 1, i));
5274
5275 rhic_iaa->SetMarkerStyle((ptTrigBin == 2) ? 20 : 33);
5276 rhic_iaa->SetMarkerColor(2);
5277 rhic_iaa->SetLineColor(2);
5278 rhic_iaa_sys->SetLineColor(2);
5279 rhic_iaa_sys->SetMarkerColor(2);
5280
5281 RemovePointsBelowX(rhic_iaa, 2);
5282 RemovePointsBelowX(rhic_iaa_sys, 2);
5283
5284 Printf("RHIC:");
5285 rhic_iaa->Print();
5286 rhic_iaa_sys->Print();
5287
5288 ShiftPoints(rhic_iaa, -0.05 + 0.05 * (ptTrigBin*2-4));
5289 ShiftPoints(rhic_iaa_sys, -0.05 + 0.05 * (ptTrigBin*2-4));
5290
5291 if (i == 0)
5292 pad1->cd();
5293 else if (i == 2)
5294 pad2->cd();
5295 rhic_iaa->Draw("PSAME");
5296 rhic_iaa_sys->Draw("PSAME");
5297
5298 if (i == 0)
5299 legend->AddEntry(rhic_iaa, Form("PHENIX %s GeV/c < p_{T,trig} < %s GeV/c", (ptTrigBin == 2) ? "7" : "9", (ptTrigBin == 2) ? "9" : "12", (central) ? "0-20" : "20-60"), "P");
5300// legend->AddEntry(rhic_iaa, Form("PHENIX %s GeV/c < p_{T,trig} < %s GeV/c %s%% / pp", (ptTrigBin == 2) ? "7" : "9", (ptTrigBin == 2) ? "9" : "12", (central) ? "0-20" : "20-60"), "P");
5301 }
5302 }
5303
5304// pad1->cd();
5305// legend2->Draw();
5306 }
5307
5308 if (iaa == 0 && showSTAR)
5309 {
5310 for (Int_t i=0; i<2; i++)
5311 {
5312 const char* centralityStr = "05";
5313 if (i == 1)
5314 centralityStr = "4080";
5315
5316 // IAA, RHIC, STAR
5317 // systematic uncertainty stored in graph with _sys appended
5318 nearSide = ReadHepdata(Form("rhic/star_iaa_%s_near.txt", centralityStr));
5319 awaySide = ReadHepdata(Form("rhic/star_iaa_%s_away.txt", centralityStr));
5320
5321 nearSide->SetMarkerStyle(20 + i * 13);
5322 nearSide->SetMarkerColor(4);
5323 nearSide->SetLineColor(4);
5324
5325 awaySide->SetMarkerStyle(20 + i * 13);
5326 awaySide->SetMarkerColor(4);
5327 awaySide->SetLineColor(4);
5328
5329 ShiftPoints(nearSide, -0.1 + 0.2 * i);
5330 ShiftPoints(awaySide, -0.1 + 0.2 * i);
5331
5332 pad1->cd();
5333 nearSide->Draw("PSAME");
5334 pad2->cd();
5335 awaySide->Draw("PSAME");
5336
5337 legend->AddEntry(nearSide, Form("STAR Au-Au 0.2 TeV %s / dAu", (i == 0) ? "0-5%" : "40-80%"), "P");
5338 }
5339 }
5340
5341 // Theory predictions
5342 if (showTheory && iaa == 0)
5343 {
5344 const char* theoryList[] = { "AdS", "ASW", "YaJEM", "YaJEM-D", "XinNian" };
5345 Int_t nTheory = 5;
5346 Int_t markers[] = { 27, 28, 29, 30, 34 };
5347
5348 for (Int_t i=0; i<nTheory; i++)
5349 {
5350 nearSide = ReadHepdata(Form("theory/IAA_near_%s.dat", theoryList[i]));
5351 awaySide = ReadHepdata(Form("theory/IAA_away_%s.dat", theoryList[i]));
5352
5353 nearSide->SetMarkerStyle(markers[i]);
5354 awaySide->SetMarkerStyle(markers[i]);
5355
5356 RemovePointsBelowX(nearSide, 3);
5357 RemovePointsBelowX(awaySide, 3);
5358
5359 Float_t shiftBy = (i % 2 == 0) ? -0.2 : 0.2;
5360 ShiftPoints(nearSide, shiftBy);
5361 ShiftPoints(awaySide, shiftBy);
5362
5363 pad1->cd();
5364 nearSide->Draw("PSAME");
5365
5366 pad2->cd();
5367 awaySide->Draw("PSAME");
5368
5369 if (i == 0)
5370 theoryList[i] = "AdS/CFT";
5371 if (i == 4)
5372 theoryList[i] = "X-N Wang";
5373 legend->AddEntry(nearSide, theoryList[i], "P");
5374 }
5375 }
5376
5377 for (Int_t i=0; i<2; i++)
5378 {
5379 if (i == 0)
5380 pad1->cd();
5381 else
5382 pad2->cd();
5383
5384 Float_t xC = 0.05;
5385 if (i == 0)
5386 xC = 0.17;
5387
5388 if (iaa == 2)
5389 latex = new TLatex(xC, 0.84, "0-20% / pp");
5390 else
5391 latex = new TLatex(0.35+xC, 0.9, "8 GeV/#font[12]{c} < p_{T,trig} < 15 GeV/#font[12]{c}");
5392 latex->SetTextSize(0.04);
5393 latex->SetNDC();
5394 if (i == 0)
5395 latex->Draw();
5396
5397 line = new TLine(1.5, 1, 10.5, 1);
5398 line->SetLineStyle(2);
5399 line->Draw();
5400
5401 if (iaa == 1)
5402 {
5403 latex = new TLatex(xC, 0.84, "0-5% / 60-90%");
5404 latex->SetTextSize(0.04);
5405 latex->SetNDC();
5406 latex->Draw();
5407 }
5408
5409 latex = new TLatex(0.65+xC, 0.90, "ALICE");
5410// latex = new TLatex(0.5+xC, 0.90, "-- work in progress --");
5411 latex->SetTextSize(0.04);
5412 latex->SetNDC();
5413 if (i == 1)
5414 latex->Draw();
5415
5416 latex = new TLatex(0.35+xC, 0.84, "p_{T,assoc} < p_{T,trig}");
5417 latex->SetTextSize(0.04);
5418 latex->SetNDC();
5419 if (i == 0)
5420 latex->Draw();
5421
5422 if (iaa == 1 || iaa == 0)
5423 {
5424 if (iaa == 0 && showSTAR)
5425 latex = new TLatex(0.3+xC, 0.90, "|#eta| < 1.0");
5426 else
5427 latex = new TLatex(xC + 0.65, 0.20, "|#eta| < 1.0");
5428 latex->SetTextSize(0.04);
5429 latex->SetNDC();
5430 if (i == 0)
5431 latex->Draw();
5432 }
5433
5434 if (iaa == 1 || (iaa == 0 && !showSTAR))
5435 {
5436 latex = new TLatex(0.5+xC, 0.72, "Pb-Pb 2.76 TeV");
5437 latex->SetTextSize(0.04);
5438 latex->SetNDC();
5439// latex->Draw();
5440 }
5441
5442 if (iaa == 2)
5443 {
5444 if (i == 0)
5445 latex = new TLatex(0.5, 0.24, "ALICE: Pb-Pb 2.76 TeV |#eta| < 1.0");
5446 else
5447 latex = new TLatex(xC, 0.6, "ALICE: Pb-Pb 2.76 TeV |#eta| < 1.0");
5448 latex->SetTextSize(0.035);
5449 latex->SetNDC();
5450 latex->Draw();
5451
5452 if (i == 0)
5453 latex = new TLatex(0.5, 0.18, "PHENIX: Au-Au 0.2 TeV |#eta| < 0.35");
5454 else
5455 latex = new TLatex(xC, 0.54, "PHENIX: Au-Au 0.2 TeV |#eta| < 0.35");
5456 latex->SetTextSize(0.035);
5457 latex->SetNDC();
5458 latex->Draw();
5459 }
5460
5461 if (showTheory && iaa == 0 && i == 1)
5462 latex = new TLatex(xC, 0.18, "Points: flat pedestal");
5463 else
5464 latex = new TLatex(xC + 0.5 * i, 0.26, "Points: flat pedestal");
5465 latex->SetTextSize(0.04);
5466 latex->SetNDC();
5467 if (i == 0)
5468 latex->Draw();
5469
5470 latex = new TLatex(xC + 0.5 * i, 0.20, "Line: v_{2} subtracted");
5471 latex->SetTextSize(0.04);
5472 latex->SetNDC();
5473 if (i == 0)
5474 latex->Draw();
5475
5476 if (iaa != 1 && i == 1)
5477 {
5478 legendClone = (TLegend*) legend->DrawClone();
5479 if (showTheory && iaa == 0 && i == 0)
5480 legendClone->GetListOfPrimitives()->RemoveLast();
5481// else
5482// legendClone->SetY1(legendClone->GetY1()-0.05);
5483
5484 legend->SetX1(legend->GetX1()-0.12);
5485 legend->SetX2(legend->GetX2()-0.12);
5486 }
5487
5488/* if (i == 0 && iaa != 2)
5489 DrawALICELogo(0.83,0.15,0.98,0.30);
5490 else
5491 DrawALICELogo(0.62 + xC,0.48,0.77 + xC,0.63);*/
5492 }
5493
5494 c->SaveAs(Form("%s.eps", c->GetTitle()));
5495 c->SaveAs(Form("%s.png", c->GetTitle()));
5496}
5497
5498void IAAPaper(const char* fileName, Int_t iaa, const char* fileNameEtaGap = 0)
5499{
5500 // iaa
5501 // 0 = IAA LHC
5502 // 1 = ICP
5503
5504 Bool_t showTheory = 0;
5505 Bool_t showSTAR = 0;
5506
5507 if (iaa == 3)
5508 {
5509 showTheory = kTRUE;
5510 iaa = 0;
5511 }
5512
5513 if (iaa == 4)
5514 {
5515 showSTAR = kTRUE;
5516 iaa = 0;
5517 }
5518
5519 if (kPythiaScalingFactor != 1)
5520 Printf("Using reference data scaling factor: %f", kPythiaScalingFactor);
5521
5522 style();
5523
5524 Int_t j = 1;
5525 Int_t caseId[] = { 18, 23 };
5526
5527 c = new TCanvas((iaa != 1) ? ((iaa == 0) ? "iaa" : "iaarhic") : "icp", (iaa != 1) ? ((iaa == 0) ? "iaa" : "iaarhic") : "icp", 900, 450);
5528 c->Range(0, 0, 1, 1);
5529
5530 TPad* pad1 = new TPad(Form("%s_2", fileName), "", 0, 0, 0.5, 1);
5531 pad1->Draw();
5532
5533 TPad* pad2 = new TPad(Form("%s_1", fileName), "", 0.5, 0, 1, 1);
5534 pad2->Draw();
5535
5536 pad1->cd();
5537 gPad->SetRightMargin(0);
5538 gPad->SetTopMargin(0.05);
5539 gPad->SetLeftMargin(0.13);
5540 //gPad->SetGridx();
5541// gPad->SetGridy();
5542
5543 pad2->cd();
5544 gPad->SetLeftMargin(0);
5545 gPad->SetTopMargin(0.05);
5546 gPad->SetRightMargin(0.13);
5547 //gPad->SetGridx();
5548// gPad->SetGridy();
5549
5550 pad1->cd();
5551// dummy = new TH2F("dummy", Form(";p_{T,assoc} (GeV/c);%s", (iaa != 1) ? "I_{AA,Pythia}" : "I_{CP}"), 100, 1.5, 10.5, 1000, 0, 2.9);
5552 dummy = new TH2F("dummy", Form(";#font[12]{p}_{t,assoc} (GeV/#font[12]{c});%s", (iaa != 1) ? "#font[12]{I}_{AA}" : "#font[12]{I}_{CP} (0-5% / 60-90%)"), 100, 1.5, 10.5, 1000, 0, 2.4);
5553 dummy->SetStats(0);
5554// dummy->GetYaxis()->SetTitleOffset(1.3);
5555 dummy->GetXaxis()->SetTitleOffset(1.1);
5556 currentDummy = dummy->DrawCopy();
5557
5558 gStyle->SetTextAlign(13);
5559
5560 latex = new TLatex(0.17, 0.90, "Near-side_{ }");
5561 latex->SetTextSize(0.04);
5562 latex->SetNDC();
5563 latex->Draw();
5564
5565 latex = new TLatex(0.17, /*(iaa == 1) ? 0.78 :*/ 0.84, "#sqrt{#font[12]{s}_{NN}} = 2.76 TeV");
5566 latex->SetTextSize(0.04);
5567 latex->SetNDC();
5568 latex->Draw();
5569
5570 latex = new TLatex(0.17, 0.2, (iaa == 1) ? "b)" : "a)");
5571 latex->SetTextSize(0.04);
5572 latex->SetNDC();
5573 latex->Draw();
5574
5575// if (iaa != 1)
5576// {
5577// box = new TBox(2, 0.87, 2.5, 1.13);
5578// box->SetFillColor(kGray + 1);
5579// box->SetLineColor(kGray + 1);
5580// box->Draw();
5581//
5582// box2 = new TBox(2, 0.87 * 1.5, 2.5, 1.13 * 1.5);
5583// box2->SetFillColor(kGray + 1);
5584// box2->SetLineColor(kGray + 1);
5585// box2->Draw();
5586// }
5587
5588 pad2->cd();
5589 currentDummy = dummy->DrawCopy();
5590
5591/* if (iaa != 1)
5592 box->Draw();*/
5593
5594 latex = new TLatex(0.05, 0.90, "Away-side");
5595 latex->SetTextSize(0.04);
5596 latex->SetNDC();
5597 latex->Draw();
5598
5599 if (iaa == 1)
5600 legend = new TLegend(0.22, 0.60, 0.67, 0.73);
5601 else
5602 legend = new TLegend(0.12, 0.60, 0.76, 0.79);
5603 legend->SetFillColor(0);
5604 legend->SetBorderSize(0);
5605 legend->SetTextSize((iaa != 2) ? 0.04 : 0.035);
5606
5607 for (Int_t i=0; i<2; i++)
5608 {
5609 nearSideCentral = GetRatio(fileName, (iaa != 2) ? 0 : 1, (iaa != 1) ? 3 : 2, j, caseId[i], 0);
5610 if (iaa == 0)
5611 nearSidePeripheral = GetRatio(fileName, 2, 3, j, caseId[i], 0);
5612 awaySideCentral = GetRatio(fileName, (iaa != 2) ? 0 : 1, (iaa != 1) ? 3 : 2, j, caseId[i], 1);
5613 if (iaa == 0)
5614 awaySidePeripheral = GetRatio(fileName, 2, 3, j, caseId[i], 1);
5615
5616 RemovePointsBelowX(nearSideCentral, 3);
5617 RemovePointsBelowX(awaySideCentral, 3);
5618 RemovePointsAboveX(nearSideCentral, 10);
5619 RemovePointsAboveX(awaySideCentral, 10);
5620
5621 ShiftPoints(nearSideCentral, -0.05);
5622 ShiftPoints(awaySideCentral, -0.05);
5623
5624 if (i == 1)
5625 {
5626 ShiftPoints(nearSideCentral, -0.2);
5627 ShiftPoints(awaySideCentral, -0.2);
5628
5629 if (iaa == 0)
5630 {
5631 ShiftPoints(nearSidePeripheral, 0.2);
5632 ShiftPoints(awaySidePeripheral, 0.2);
5633 }
5634 }
5635
5636 RemoveXErrors(nearSideCentral); RemoveXErrors(awaySideCentral);
5637
5638 if (iaa == 0)
5639 {
5640 RemovePointsBelowX(nearSidePeripheral, 3);
5641 RemovePointsBelowX(awaySidePeripheral, 3);
5642 RemovePointsAboveX(nearSidePeripheral, 10);
5643 RemovePointsAboveX(awaySidePeripheral, 10);
5644 ShiftPoints(nearSidePeripheral, 0.05);
5645 ShiftPoints(awaySidePeripheral, 0.05);
5646 RemoveXErrors(nearSidePeripheral); RemoveXErrors(awaySidePeripheral);
5647 }
5648
5649 nearSideCentral->SetMarkerStyle((i == 0) ? 25 : 27);
5650 nearSideCentral->SetLineColor(1);
5651 nearSideCentral->SetMarkerColor(1);
5652
5653 awaySideCentral->SetMarkerStyle((i == 0) ? 25 : 27);
5654 awaySideCentral->SetLineColor(1);
5655 awaySideCentral->SetMarkerColor(1);
5656
5657 if (showTheory)
5658 {
5659 nearSideCentral->SetLineColor(2);
5660 nearSideCentral->SetMarkerColor(2);
5661 awaySideCentral->SetLineColor(2);
5662 awaySideCentral->SetMarkerColor(2);
5663 }
5664
5665 if (iaa == 0)
5666 {
5667 nearSidePeripheral->SetMarkerStyle((i == 0) ? 21 : 33);
5668 nearSidePeripheral->SetLineColor(2);
5669 nearSidePeripheral->SetMarkerColor(2);
5670
5671 awaySidePeripheral->SetMarkerStyle((i == 0) ? 21 : 33);
5672 awaySidePeripheral->SetLineColor(2);
5673 awaySidePeripheral->SetMarkerColor(2);
5674 }
5675
5676// if (i == 0)
5677 {
5678// TString denominatorStr("Pythia");
5679 TString denominatorStr("pp");
5680 if (iaa == 0)
5681 {
5682 legend->SetHeader("0-5% Pb-Pb/pp 60-90% Pb-Pb/pp");
5683 legend->SetNColumns(2);
5684 }
5685 legend->AddEntry(nearSideCentral, (i == 0) ? "Flat bkg" : "#font[12]{v}_{2} bkg", "P");
5686 if (iaa == 0)
5687 legend->AddEntry(nearSidePeripheral, (i == 0) ? "Flat bkg" : "#font[12]{v}_{2} bkg", "P");
5688
5689// legend->AddEntry(nearSideCentral, Form("%s0-5% / %s", (showSTAR) ? "ALICE Pb-Pb 2.76 TeV " : "", denominatorStr.Data()), "P");
5690// if (!showTheory)
5691// legend->AddEntry(nearSidePeripheral, Form("%s60-90% / %s", (showSTAR) ? "ALICE Pb-Pb 2.76 TeV " : "", denominatorStr.Data()), "P");
5692 if (iaa == 2)
5693 {
5694// legend->AddEntry(nearSideCentral, Form("0-20% / %s", denominatorStr.Data()), "P");
5695 legend->AddEntry(nearSideCentral, Form("ALICE 8 GeV/#font[12]{c} < p_{T,trig} < 15 GeV/#font[12]{c}", denominatorStr.Data()), "P");
5696 }
5697 }
5698
5699
5700 const char* style = "PSAME";
5701// if (i == 1)
5702// style = "LSAMEX";
5703
5704 pad1->cd();
5705// if (i == 0)
5706 DrawSystUnc(nearSideCentral, (iaa == 1), 0, iaa, kTRUE, -0.05 - 0.2 * i);
5707 nearSideCentral->DrawClone(style);
5708 if (iaa == 0 && !showTheory)
5709 {
5710// if (i == 0)
5711 DrawSystUnc(nearSidePeripheral, (iaa == 1), 0, iaa, kFALSE, 0.05 + ((iaa == 0) ? i * 0.2 : 0));
5712 nearSidePeripheral->DrawClone(style);
5713 }
5714
5715 pad2->cd();
5716// if (i == 0)
5717 DrawSystUnc(awaySideCentral, (iaa == 1), 1, iaa, kTRUE, -0.05 - 0.2 * i);
5718 awaySideCentral->DrawClone(style);
5719 if (iaa == 0 && !showTheory)
5720 {
5721// if (i == 0)
5722 DrawSystUnc(awaySidePeripheral, (iaa == 1), 1, iaa, kFALSE, 0.05 + ((iaa == 0) ? i * 0.2 : 0));
5723 awaySidePeripheral->DrawClone(style);
5724 }
5725 }
5726
5727 if (fileNameEtaGap)
5728 {
5729 pad1->cd();
5730
5731 nearSideEtaGapCentral = GetRatio(fileNameEtaGap, (iaa != 2) ? 0 : 1, (iaa != 1) ? 3 : 2, j, caseId[0], 0);
5732 RemovePointsBelowX(nearSideEtaGapCentral, 3);
5733 RemovePointsAboveX(nearSideEtaGapCentral, 10);
5734 RemoveXErrors(nearSideEtaGapCentral);
5735 nearSideEtaGapCentral->SetMarkerStyle(24);
5736 nearSideEtaGapCentral->SetLineColor(1);
5737 nearSideEtaGapCentral->SetMarkerColor(1);
5738 ShiftPoints(nearSideEtaGapCentral, -0.45);
5739 DrawSystUnc(nearSideEtaGapCentral, (iaa == 1), 0, iaa, kTRUE, -0.45);
5740 nearSideEtaGapCentral->Draw("PSAME");
5741
5742 legend->AddEntry(nearSideEtaGapCentral, "#font[12]{#eta}-gap", "P");
5743
5744
5745 if (iaa != 1)
5746 {
5747 nearSideEtaGapPeripheral = GetRatio(fileNameEtaGap, 2, 3, j, caseId[0], 0);
5748 RemovePointsBelowX(nearSideEtaGapPeripheral, 3);
5749 RemovePointsAboveX(nearSideEtaGapPeripheral, 10);
5750 RemoveXErrors(nearSideEtaGapPeripheral);
5751 nearSideEtaGapPeripheral->SetMarkerStyle(20);
5752 nearSideEtaGapPeripheral->SetLineColor(2);
5753 nearSideEtaGapPeripheral->SetMarkerColor(2);
5754 ShiftPoints(nearSideEtaGapPeripheral, 0.45);
5755 DrawSystUnc(nearSideEtaGapPeripheral, (iaa == 1), 0, iaa, kFALSE, 0.45);
5756 nearSideEtaGapPeripheral->Draw("PSAME");
5757
5758 legend->AddEntry(nearSideEtaGapPeripheral, "#font[12]{#eta}-gap", "P");
5759 }
5760 }
5761
5762 if (0 && iaa == 0)
5763 {
5764 // add pythia line showing gluon filtering
5765 // from Jan Rak, by mail, 22.09.11
5766 // pp CF calculated without any adjustment
5767 // AA CF also no adjustment. Particles (h+-) in acceptance are identified with their parent string parton (status 71)
5768 // and the flavor of parent hard outgoing parton (status 23) which is the parent of string parton 71 is checked.
5769 // If it is a gluon the particle is ignored.
5770
5771 Float_t xVal[] = { 3.5, 4.5, 5.5, 7, 9};
5772 Float_t yVal[] = { 0.779418, 0.794234, 0.82759, 0.856457, 0.880526 };
5773 gluonfiltering = new TGraph(5, xVal, yVal);
5774 pad1->cd();
5775 gluonfiltering->Draw("L");
5776
5777 legend3 = new TLegend(0.38, 0.15, 0.58, 0.25);
5778 legend3->SetFillColor(0);
5779 legend3->SetBorderSize(0);
5780 legend3->SetTextSize(0.04);
5781 legend3->AddEntry(gluonfiltering, "PYTHIA quark-only fragmentation", "L");
5782 legend3->Draw();
5783 }
5784
5785 if (iaa == 2)
5786 {
5787 // IAA, RHIC, PHENIX
5788 // systematic uncertainty stored in graph with _sys appended
5789 TFile::Open("rhic/pi0h_graphs.root");
5790
5791 legend2 = new TLegend(0.5, 0.16, 0.96, 0.27);
5792 legend2->SetFillColor(0);
5793
5794 for (Int_t ptTrigBin=2; ptTrigBin<4; ptTrigBin++)
5795 {
5796 Bool_t central = kTRUE;
5797 for (Int_t i=0; i<3; i+=2)
5798 {
5799 // gIAA_<ptTrigBin>_<centBin>_<angularRegionBin>
5800 rhic_iaa = (TGraphErrors*) gFile->Get(Form("gIAA_%d_%d_%d", ptTrigBin, (central) ? 0 : 1, i));
5801 rhic_iaa_sys = (TGraphErrors*) gFile->Get(Form("gIAA_%d_%d_%d_sys", ptTrigBin, (central) ? 0 : 1, i));
5802
5803 rhic_iaa->SetMarkerStyle((ptTrigBin == 2) ? 20 : 33);
5804 rhic_iaa->SetMarkerColor(2);
5805 rhic_iaa->SetLineColor(2);
5806 rhic_iaa_sys->SetLineColor(2);
5807 rhic_iaa_sys->SetMarkerColor(2);
5808
5809 ShiftPoints(rhic_iaa, -0.05 + 0.05 * (ptTrigBin*2-4));
5810 ShiftPoints(rhic_iaa_sys, -0.05 + 0.05 * (ptTrigBin*2-4));
5811
5812 if (i == 0)
5813 pad1->cd();
5814 else if (i == 2)
5815 pad2->cd();
5816 rhic_iaa->Draw("PSAME");
5817 rhic_iaa_sys->Draw("PSAME");
5818
5819 if (i == 0)
5820 legend->AddEntry(rhic_iaa, Form("PHENIX %s GeV/c < p_{T,trig} < %s GeV/c", (ptTrigBin == 2) ? "7" : "9", (ptTrigBin == 2) ? "9" : "12", (central) ? "0-20" : "20-60"), "P");
5821// legend->AddEntry(rhic_iaa, Form("PHENIX %s GeV/c < p_{T,trig} < %s GeV/c %s%% / pp", (ptTrigBin == 2) ? "7" : "9", (ptTrigBin == 2) ? "9" : "12", (central) ? "0-20" : "20-60"), "P");
5822 }
5823 }
5824
5825// pad1->cd();
5826// legend2->Draw();
5827 }
5828
5829 if (iaa == 0 && showSTAR)
5830 {
5831 for (Int_t i=0; i<2; i++)
5832 {
5833 const char* centralityStr = "05";
5834 if (i == 1)
5835 centralityStr = "4080";
5836
5837 // IAA, RHIC, STAR
5838 // systematic uncertainty stored in graph with _sys appended
5839 nearSide = ReadHepdata(Form("rhic/star_iaa_%s_near.txt", centralityStr));
5840 awaySide = ReadHepdata(Form("rhic/star_iaa_%s_away.txt", centralityStr));
5841
5842 nearSide->SetMarkerStyle(20 + i * 13);
5843 nearSide->SetMarkerColor(4);
5844 nearSide->SetLineColor(4);
5845
5846 awaySide->SetMarkerStyle(20 + i * 13);
5847 awaySide->SetMarkerColor(4);
5848 awaySide->SetLineColor(4);
5849
5850 ShiftPoints(nearSide, -0.1 + 0.2 * i);
5851 ShiftPoints(awaySide, -0.1 + 0.2 * i);
5852
5853 pad1->cd();
5854 nearSide->Draw("PSAME");
5855 pad2->cd();
5856 awaySide->Draw("PSAME");
5857
5858 legend->AddEntry(nearSide, Form("STAR Au-Au 0.2 TeV %s / dAu", (i == 0) ? "0-5%" : "40-80%"), "P");
5859 }
5860 }
5861
5862 // Theory predictions
5863 if (showTheory && iaa == 0)
5864 {
5865 const char* theoryList[] = { "AdS", "ASW", "YaJEM", "YaJEM-D", "XinNian" };
5866 Int_t nTheory = 5;
5867 Int_t markers[] = { 27, 28, 29, 30, 34 };
5868
5869 for (Int_t i=0; i<nTheory; i++)
5870 {
5871 nearSide = ReadHepdata(Form("theory/IAA_near_%s.dat", theoryList[i]));
5872 awaySide = ReadHepdata(Form("theory/IAA_away_%s.dat", theoryList[i]));
5873
5874 nearSide->SetMarkerStyle(markers[i]);
5875 awaySide->SetMarkerStyle(markers[i]);
5876
5877 RemovePointsBelowX(nearSide, 3);
5878 RemovePointsBelowX(awaySide, 3);
5879
5880 Float_t shiftBy = (i % 2 == 0) ? -0.2 : 0.2;
5881 ShiftPoints(nearSide, shiftBy);
5882 ShiftPoints(awaySide, shiftBy);
5883
5884 pad1->cd();
5885 nearSide->Draw("PSAME");
5886
5887 pad2->cd();
5888 awaySide->Draw("PSAME");
5889
5890 if (i == 0)
5891 theoryList[i] = "AdS/CFT";
5892 if (i == 4)
5893 theoryList[i] = "X-N Wang";
5894 legend->AddEntry(nearSide, theoryList[i], "P");
5895 }
5896 }
5897
5898 for (Int_t i=0; i<2; i++)
5899 {
5900 if (i == 0)
5901 pad1->cd();
5902 else
5903 pad2->cd();
5904
5905 Float_t xC = 0.05;
5906 if (i == 0)
5907 xC = 0.17;
5908
5909 if (iaa == 2)
5910 latex = new TLatex(xC, 0.84, "0-20% / pp");
5911 else
5912 latex = new TLatex(0.35+xC, 0.9, "8 GeV/#font[12]{c} < #font[12]{p}_{t,trig} < 15 GeV/#font[12]{c}");
5913 latex->SetTextSize(0.04);
5914 latex->SetNDC();
5915 if (i == 0)
5916 latex->Draw();
5917
5918 line = new TLine(1.5, 1, 10.5, 1);
5919 line->SetLineStyle(2);
5920 line->Draw();
5921
5922// if (iaa == 1 && i == 0)
5923// {
5924// latex = new TLatex(xC, 0.84, "0-5% / 60-90%");
5925// latex->SetTextSize(0.04);
5926// latex->SetNDC();
5927// latex->Draw();
5928// }
5929
5930 latex = new TLatex(0.65+xC, 0.90, "ALICE");
5931// latex = new TLatex(0.5+xC, 0.90, "-- work in progress --");
5932 latex->SetTextSize(0.04);
5933 latex->SetNDC();
5934 if (i == 1)
5935 latex->Draw();
5936
5937 latex = new TLatex(0.35+xC, 0.84, "#font[12]{p}_{t,assoc} < #font[12]{p}_{t,trig}");
5938 latex->SetTextSize(0.04);
5939 latex->SetNDC();
5940 if (i == 0)
5941 latex->Draw();
5942
5943 if (iaa == 1 || iaa == 0)
5944 {
5945 if (iaa == 0 && showSTAR)
5946 latex = new TLatex(0.3+xC, 0.90, "|#font[12]{#eta}| < 1.0");
5947 else
5948 latex = new TLatex(0.82, 0.84, "|#font[12]{#eta}| < 1.0");
5949 latex->SetTextSize(0.04);
5950 latex->SetNDC();
5951 if (i == 0)
5952 latex->Draw();
5953 }
5954
5955 if (iaa == 1 || (iaa == 0 && !showSTAR))
5956 {
5957 latex = new TLatex(0.5+xC, 0.72, "Pb-Pb 2.76 TeV");
5958 latex->SetTextSize(0.04);
5959 latex->SetNDC();
5960// latex->Draw();
5961 }
5962
5963 if (iaa == 2)
5964 {
5965 if (i == 0)
5966 latex = new TLatex(0.5, 0.24, "ALICE: Pb-Pb 2.76 TeV |#eta| < 1.0");
5967 else
5968 latex = new TLatex(xC, 0.6, "ALICE: Pb-Pb 2.76 TeV |#eta| < 1.0");
5969 latex->SetTextSize(0.035);
5970 latex->SetNDC();
5971 latex->Draw();
5972
5973 if (i == 0)
5974 latex = new TLatex(0.5, 0.18, "PHENIX: Au-Au 0.2 TeV |#eta| < 0.35");
5975 else
5976 latex = new TLatex(xC, 0.54, "PHENIX: Au-Au 0.2 TeV |#eta| < 0.35");
5977 latex->SetTextSize(0.035);
5978 latex->SetNDC();
5979 latex->Draw();
5980 }
5981
5982 if (i == 1)
5983 {
5984 legendClone = (TLegend*) legend->DrawClone();
5985 if (showTheory && iaa == 0 && i == 0)
5986 legendClone->GetListOfPrimitives()->RemoveLast();
5987// else
5988// legendClone->SetY1(legendClone->GetY1()-0.05);
5989
5990 legend->SetX1(legend->GetX1()-0.12);
5991 legend->SetX2(legend->GetX2()-0.12);
5992 }
5993
5994
5995
5996/* if (i == 0 && iaa != 2)
5997 DrawALICELogo(0.83,0.15,0.98,0.30);
5998 else
5999 DrawALICELogo(0.62 + xC,0.48,0.77 + xC,0.63);*/
6000 }
6001
6002 c->SaveAs(Form("%s.eps", c->GetTitle()));
6003 c->SaveAs(Form("%s.png", c->GetTitle()));
6004}
6005
6006
6007void DrawALICELogo(Float_t x1, Float_t y1, Float_t x2, Float_t y2, Bool_t debug = kFALSE)
6008{
6009 DrawALICELogo(kTRUE, x1, y1, x2, y2, debug);
6010}
6011
6012void DrawALICELogo(Bool_t prel, Float_t x1, Float_t y1, Float_t x2, Float_t y2, Bool_t debug = kFALSE)
6013{
6014 // correct for aspect ratio of figure plus aspect ratio of pad (coordinates are NDC!)
6015// Printf("%d %f %d %f", gPad->GetCanvas()->GetWindowHeight(), gPad->GetHNDC(), gPad->GetCanvas()->GetWindowWidth(), gPad->GetWNDC());
6016 //x2 = x1 + (y2 - y1) * 0.891 * gPad->GetCanvas()->GetWindowHeight() * gPad->GetHNDC() / (gPad->GetWNDC() * gPad->GetCanvas()->GetWindowWidth());
6017 x2 = x1 + (y2 - y1) * (466. / 523) * gPad->GetWh() * gPad->GetHNDC() / (gPad->GetWNDC() * gPad->GetWw());
6018// Printf("%f %f %f %f", x1, x2, y1, y2);
6019
6020 if (!prel)
6021 DrawLatex((x1+x2)/2, y1, 1, "09.05.12", 0.03)->SetTextAlign(23);
6022 TPad *myPadLogo = new TPad("myPadLogo", "Pad for ALICE Logo", x1, y1, x2, y2);
6023 if (debug)
6024 myPadLogo->SetFillColor(2); // color to first figure out where is the pad then comment !
6025 myPadLogo->SetLeftMargin(0);
6026 myPadLogo->SetTopMargin(0);
6027 myPadLogo->SetRightMargin(0);
6028 myPadLogo->SetBottomMargin(0);
6029 myPadLogo->Draw();
6030 myPadLogo->cd();
6031// TASImage *myAliceLogo = new TASImage("~/alice_logo_transparent.png");
6032 TASImage *myAliceLogo = new TASImage((prel) ? "~/alice_logo_preliminary.eps" : "~/alice_logo_performance.eps");
6033 myAliceLogo->Draw();
6034}
6035
6036void RemoveXErrors(TGraphErrors* graph)
6037{
6038 for (Int_t i=0; i<graph->GetN(); i++)
6039 graph->GetEX()[i] = 0;
6040}
6041
6042void RemovePointsBelowX(TGraphErrors* graph, Float_t minX)
6043{
6044 Int_t i=0;
6045 while (i<graph->GetN())
6046 {
6047 if (graph->GetX()[i] < minX)
6048 graph->RemovePoint(i);
6049 else
6050 i++;
6051 }
6052}
6053
6054void RemovePointsAboveX(TGraphErrors* graph, Float_t maxX)
6055{
6056 Int_t i=0;
6057 while (i<graph->GetN())
6058 {
6059 if (graph->GetX()[i] > maxX)
6060 graph->RemovePoint(i);
6061 else
6062 i++;
6063 }
6064}
6065
6066void ShiftPoints(TGraphErrors* graph, Float_t dx)
6067{
6068 Int_t i=0;
6069 while (i<graph->GetN())
6070 {
6071 graph->GetX()[i] += dx;
6072 i++;
6073 }
6074}
6075
6076void DivideGraphs(TGraphErrors* graph1, TGraphErrors* graph2)
6077{
6078 graph1->Print();
6079 graph2->Print();
6080
6081 for (Int_t bin1 = 0; bin1 < graph1->GetN(); bin1++)
6082 {
6083 Float_t x = graph1->GetX()[bin1];
6084
6085 Int_t bin2 = 0;
6086 for (bin2 = 0; bin2<graph2->GetN(); bin2++)
6087 if (graph2->GetX()[bin2] >= x)
6088 break;
6089
6090 if (bin2 == graph2->GetN())
6091 bin2--;
6092
6093 if (bin2 > 0)
6094 if (TMath::Abs(graph2->GetX()[bin2-1] - x) < TMath::Abs(graph2->GetX()[bin2] - x))
6095 bin2--;
6096
6097 if (graph1->GetY()[bin1] == 0 || graph2->GetY()[bin2] == 0 || bin2 == graph2->GetN())
6098 {
6099 Printf("%d %d removed", bin1, bin2);
6100 graph1->RemovePoint(bin1--);
6101 continue;
6102 }
6103
6104 Float_t graph2Extrapolated = graph2->GetY()[bin2];
6105 if (TMath::Abs(x - graph2->GetX()[bin2]) > 0.0001)
6106 {
6107 Printf("%f %f %d %d not found", x, graph2->GetX()[bin2], bin1, bin2);
6108 graph1->RemovePoint(bin1--);
6109 continue;
6110 }
6111
6112 Float_t value = graph1->GetY()[bin1] / graph2Extrapolated;
6113 Float_t error = value * TMath::Sqrt(TMath::Power(graph1->GetEY()[bin1] / graph1->GetY()[bin1], 2) + TMath::Power(graph2->GetEY()[bin2] / graph2->GetY()[bin2], 2));
6114
6115 graph1->GetY()[bin1] = value;
6116 graph1->GetEY()[bin1] = error;
6117
6118 Printf("%d %d %f %f %f %f", bin1, bin2, x, graph2Extrapolated, value, error);
6119 }
6120}
6121
6122Float_t ExtractYields(TH1* hist, Int_t trigId, Int_t centralityId, Float_t ptA, Float_t ptW, Int_t caseId, Double_t normUnc)
6123{
6124 CreateYieldStructure();
6125
6126 Float_t width = 0.69;
6127// Float_t width = 0.5; Printf("WARNING. Using integration width 0.5");
6128// Float_t width = 0.85; Printf("WARNING. Using integration width 0.85");
6129
6130 //new TCanvas; hist->DrawCopy();
6131
6132 Int_t binBegin = hist->FindBin(-width);
6133 Int_t binEnd = hist->FindBin(width);
6134 Double_t nearSideError = 0;
6135 Float_t nearSideYield = hist->IntegralAndError(binBegin, binEnd, nearSideError);
6136 nearSideYield *= hist->GetXaxis()->GetBinWidth(1);
6137 nearSideError *= hist->GetXaxis()->GetBinWidth(1);
6138
6139 Int_t binBegin = hist->FindBin(TMath::Pi() - width);
6140 Int_t binEnd = hist->FindBin(TMath::Pi() + width);
6141 Double_t awaySideError = 0;
6142 Float_t awaySideYield = hist->IntegralAndError(binBegin, binEnd, awaySideError);
6143 awaySideYield *= hist->GetXaxis()->GetBinWidth(1);
6144 awaySideError *= hist->GetXaxis()->GetBinWidth(1);
6145
6146 Printf("%d %d %f %d: %f+-%f %f+-%f (%f)", trigId, centralityId, ptA, caseId, nearSideYield, nearSideError, awaySideYield, awaySideError, normUnc);
6147
6148 FillYield(trigId, centralityId, ptA, ptW, caseId, nearSideYield, TMath::Sqrt(nearSideError * nearSideError + normUnc * normUnc), awaySideYield, TMath::Sqrt(awaySideError * awaySideError + normUnc * normUnc));
6149
6150 // store normUnc for error propagation later
6151 TGraphErrors** tmp = yields[2][trigId][centralityId];
6152 tmp[caseId]->SetPoint(tmp[caseId]->GetN(), ptA, normUnc);
6153
6154 return awaySideYield;
6155}
6156
6157void FillYield(Int_t trigId, Int_t centralityId, Float_t ptA, Float_t ptW, Int_t caseId, Double_t nearSideYield, Double_t nearSideError, Double_t awaySideYield, Double_t awaySideError)
6158{
6159 // CINT limitation here
6160 TGraphErrors** tmp = yields[0][trigId][centralityId];
6161 tmp[caseId]->SetPoint(tmp[caseId]->GetN(), ptA, nearSideYield);
6162 tmp[caseId]->SetPointError(tmp[caseId]->GetN()-1, ptW, nearSideError);
6163 //tmp[caseId]->Print();
6164
6165 tmp = yields[1][trigId][centralityId];
6166 tmp[caseId]->SetPoint(tmp[caseId]->GetN(), ptA, awaySideYield);
6167 tmp[caseId]->SetPointError(tmp[caseId]->GetN()-1, ptW, awaySideError);
6168}
6169
6170Double_t hypgeo(Double_t a, Double_t b, Double_t c, Double_t z)
6171{
6172 // ROOT::Math::hyperg is only defined for |z| < 1
6173 if (z > -1)
6174 return ROOT::Math::hyperg(a, b, c, z);
6175
6176 // for z < -1 we can use an identity from http://en.wikipedia.org/wiki/Hypergeometric_function
6177 return TMath::Power(1-z, -b) * ROOT::Math::hyperg(c-a, b, c, z / (z-1));
6178}
6179
6180Double_t hypgeoder2(Double_t a, Double_t b, Double_t c, Double_t z)
6181{
6182 // derivate of hypgeo with parameter b: d/db hypgeo
6183
6184 static TF1* func = 0;
6185 if (!func)
6186 func = new TF1("hypgeoder2_func", "hypgeo([0], x, [1], [2])");
6187
6188 func->SetParameters(a, c, z);
6189 return func->Derivative(b);
6190}
6191
6192void TsallisYieldUncertainty(Double_t n, Double_t q, Double_t beta, TMatrixDSym covMatrix, Int_t offset, Double_t& yield, Double_t& unc)
6193{
6194 gSystem->Load("libMathMore");
6195
6196 TF1 tsallis("tsallis", "[0] * (1-[2]*(1-[1])*x*x)**(1/(1-[1]))", -0.5 * TMath::Pi(), 1.5 * TMath::Pi());
6197
6198 // Integrate[N (1 - b (1 - q) x^2)^(1/(1 - q)), x] --> N x Hypergeometric2F1[1/2, 1/(-1 + q), 3/2, -b (-1 + q) x^2]
6199 // [0] = n, [1] = q, [2] = beta
6200 TF1 tsallisIntegral("tsallisIntegral", "[0]*x*hypgeo(0.5, 1/([1]-1), 1.5, -[2]*([1]-1)*x*x)");
6201 TF1 tsallisIntegralDerN("tsallisIntegralDerN", "x*hypgeo(0.5, 1/([1]-1), 1.5, -[2]*([1]-1)*x*x)");
6202
6203 TF1 tsallisIntegralDerq("tsallisIntegralDerq", "[0]*x*(((1+[2]*([1]-1)*x*x)**(-1/([1]-1))-hypgeo(0.5, 1/([1]-1), 1.5, -[2]*([1]-1)*x*x))/2/([1]-1) - hypgeoder2(0.5, 1/([1]-1), 1.5, -[2]*([1]-1)*x*x)/([1]-1)**2)");
6204
6205 TF1 tsallisIntegralDerbeta("tsallisIntegralDerbeta", "[0]*x*((1+[2]*([1]-1)*x*x)**(-1/([1]-1))-hypgeo(0.5, 1/([1]-1), 1.5, -[2]*([1]-1)*x*x))/2/[2]");
6206
6207 const Float_t width = 0.7;
6208
6209 TF1* derivates[4];
6210 derivates[0] = new TF1("const", "1");
6211 derivates[1] = &tsallisIntegralDerN;
6212 derivates[2] = &tsallisIntegralDerq;
6213 derivates[3] = &tsallisIntegralDerbeta;
6214
6215 Printf("%f %f %f", n, q, beta);
6216
6217 tsallis.SetParameters(n, q, beta);
6218 tsallisIntegral.SetParameters(n, q, beta);
6219 for (Int_t i=1; i<4; i++)
6220 derivates[i]->SetParameters(n, q, beta);
6221
6222 yield = tsallisIntegral.Eval(width) - tsallisIntegral.Eval(-width);
6223 Double_t yield2 = tsallis.Integral(-width, width);
6224
6225 unc = 0;
6226 for (Int_t i=0; i<4; i++)
6227 for (Int_t j=0; j<4; j++)
6228 {
6229 Int_t covI = i;
6230 Int_t covJ = j;
6231 if (i > 0)
6232 covI += offset;
6233 if (j > 0)
6234 covJ += offset;
6235
6236 Double_t der1 = (derivates[i]->Eval(width) - derivates[i]->Eval(-width));
6237 Double_t der2 = (derivates[j]->Eval(width) - derivates[j]->Eval(-width));
6238
6239 unc += der1 * der2 * covMatrix(covI, covJ);
6240
6241 Printf("%d %d % .3e % .3e % .3e % .3e", i, j, der1, der2, covMatrix(covI, covJ), unc);
6242 }
6243
6244 unc = TMath::Sqrt(unc);
6245
6246 yield /= width * 2;
6247 yield2 /= width * 2;
6248 unc /= width * 2;
6249
6250 Printf("%f (%f) +- %f", yield, yield2, unc);
6251}
6252
6253double NLowestBinAverage(TH1 &h, int N)
6254{
6255 // Returns mean content of N lowest bins in h.
6256
6257 double avg = 0;
6258 int counter = 0;
6259 std::list<double> content;
6260 std::list<double>::iterator i;
6261
6262 for (int jbin=1; jbin<=h.GetNbinsX(); jbin++) {
6263 content.push_back(h.GetBinContent(jbin));
6264 }
6265 content.sort();
6266
6267 for (i = content.begin(); i != content.end(); ++i) {
6268
6269 if (counter == N)
6270 break;
6271
6272 avg += *i/N;
6273 counter++;
6274 }
6275
6276 if (counter < N)
6277 Warning("NLowestBinAverage()",
6278 "Avg. of %d bins requested, %d used", N, counter);
6279
6280 return avg;
6281}
6282
6283void DrawFlow(Float_t v2, TH1* hist, Float_t ptT, Float_t ptA, TH1* histMixed, Int_t trigId, Int_t centralityId, Int_t caseOffset, Float_t ptACenter, Float_t ptAWidth, Bool_t flatBaseLine = kFALSE, Int_t baseLineDetermination = 0, Float_t* vn = 0)
6284{
6285 // caseOffsets
6286 // 0 same with v2 (14 tsallis for baseline [28/29 tsallis params]; 15 yield from tsallis function)
6287 // [disabled] 1 same/mixed with v2 (15 tsallis for baseline)
6288 // 2 same no v2 (16 tsallis for baseline; 17 yield from tsallis function)
6289 // 4 same no v2 (18 flat fit 1)
6290 // 5 same no v2 (19 flat fit 2)
6291 // 6 same no v2 (20 flat avg over 4)
6292 // 7 same no v2 (21 flat avg over 8)
6293 // 8 same no v2 (22 flat avg over 16)
6294 // 9 same with v2 (23 flat fit 1)
6295 // 10 same with v2 (24 flat fit 2)
6296 // 11 same with v2 (25 flat avg over 4)
6297 // 12 same with v2 (26 flat avg over 8)
6298 // 13 same with v2 (27 flat avg over 16)
6299
6300 // 30 gaussian fit width
6301
6302 // same stuff for same/mixed
6303 if (0 && caseOffset == 0 && histMixed)
6304 {
6305 TH1* clone = (TH1*) hist->Clone();
6306 clone->Divide(histMixed);
6307 DrawFlow(v2, clone, ptT, ptA, histMixed, trigId, centralityId, 1, ptACenter, ptAWidth, kFALSE, 0, vn);
6308 }
6309
6310 // same for other baseline subtractions
6311 if (caseOffset == 0)
6312 {
6313 file = TFile::Open("dphi_corr.root", "UPDATE");
6314 hist->Write();
6315 file->Close();
6316
6317 TH1* clone = (TH1*) hist->Clone();
6318 DrawFlow(v2, clone, ptT, ptA, histMixed, trigId, centralityId, 2, ptACenter, ptAWidth, kTRUE, 0, vn);
6319
6320 clone = (TH1*) hist->Clone();
6321 DrawFlow(v2, clone, ptT, ptA, histMixed, trigId, centralityId, 4, ptACenter, ptAWidth, kTRUE, 1, vn);
6322
6323 clone = (TH1*) hist->Clone();
6324 DrawFlow(v2, clone, ptT, ptA, histMixed, trigId, centralityId, 5, ptACenter, ptAWidth, kTRUE, 2, vn);
6325
6326 clone = (TH1*) hist->Clone();
6327 DrawFlow(v2, clone, ptT, ptA, histMixed, trigId, centralityId, 6, ptACenter, ptAWidth, kTRUE, 3, vn);
6328
6329 clone = (TH1*) hist->Clone();
6330 DrawFlow(v2, clone, ptT, ptA, histMixed, trigId, centralityId, 7, ptACenter, ptAWidth, kTRUE, 4, vn);
6331
6332 clone = (TH1*) hist->Clone();
6333 DrawFlow(v2, clone, ptT, ptA, histMixed, trigId, centralityId, 8, ptACenter, ptAWidth, kTRUE, 5, vn);
6334
6335 clone = (TH1*) hist->Clone();
6336 DrawFlow(v2, clone, ptT, ptA, histMixed, trigId, centralityId, 9, ptACenter, ptAWidth, kFALSE, 1, vn);
6337
6338 clone = (TH1*) hist->Clone();
6339 DrawFlow(v2, clone, ptT, ptA, histMixed, trigId, centralityId, 10, ptACenter, ptAWidth, kFALSE, 2, vn);
6340
6341 clone = (TH1*) hist->Clone();
6342 DrawFlow(v2, clone, ptT, ptA, histMixed, trigId, centralityId, 11, ptACenter, ptAWidth, kFALSE, 3, vn);
6343
6344 clone = (TH1*) hist->Clone();
6345 DrawFlow(v2, clone, ptT, ptA, histMixed, trigId, centralityId, 12, ptACenter, ptAWidth, kFALSE, 4, vn);
6346
6347 clone = (TH1*) hist->Clone();
6348 DrawFlow(v2, clone, ptT, ptA, histMixed, trigId, centralityId, 13, ptACenter, ptAWidth, kFALSE, 5, vn);
6349 }
6350
6351 Float_t awaySideYield = ExtractYields(hist, trigId, centralityId, ptACenter, ptAWidth, 0 + caseOffset, 0);
6352
6353 if (flatBaseLine)
6354 {
6355 v2 = 0;
6356 vn = 0;
6357 }
6358
6359/* Float_t v2Trig = flowGraph->Eval(ptT);
6360 Float_t v2Assoc = flowGraph->Eval(ptA);
6361 Float_t v2 = v2Trig * v2Assoc;
6362 Printf("%f %f: %.2f %.2f --> %.4f", ptT, ptA, v2Trig, v2Assoc, v2);*/
6363
6364 TF1* flowFunc = new TF1("flowFunc", "[0] * (1+2*[1]*cos(2*x)+2*[2]*cos(3*x)+2*[3]*cos(4*x)+2*[4]*cos(5*x))", -0.5 * TMath::Pi(), 1.5 * TMath::Pi());
6365
6366 // find minimum
6367 if (0)
6368 {
6369 Float_t minBin = hist->FindBin(0.6);
6370 for (Int_t bin=hist->FindBin(0.6); bin<=hist->FindBin(1.8); bin++)
6371 if (hist->GetBinContent(bin) < hist->GetBinContent(minBin))
6372 minBin = bin;
6373
6374 Float_t norm = hist->GetBinContent(minBin) / (1 + 2 * v2 * cos(2 * hist->GetBinCenter(minBin)));
6375 Double_t normUnc = 0;
6376 }
6377 else
6378 {
6379 if (baseLineDetermination == 0)
6380 {
6381 return;
6382 /*
6383 if (centralityId == 0)
6384 hist->Fit("pol0", "0", "", 0.8., 1.2);
6385 else
6386 hist->Fit("pol0", "0", "", 1.2, 1.6);
6387 */
6388 //tsallis = new TF1("tsallis", "(1-[1]*(1-[0])*x*x)**(1/(1-[0]))", 0, 10)
6389 // (1-b(1-q)x*x)**(1/(1-q))
6390
6391 // combination of two tsallis functions
6392 total = new TF1("total", "[0] + [1] * (1-[3]*(1-[2])*x*x)**(1/(1-[2])) + [4] * (1-[6]*(1-[5])*(x-TMath::Pi())*(x-TMath::Pi()))**(1/(1-[5]))", -0.5 * TMath::Pi(), 1.5 * TMath::Pi());
6393 //total = new TF1("total", "[0] + [1] * (1-[3]*(1-[2])*x*x)**(1/(1-[2])) + [4] * (1-[6]*(1-[5])*(x-TMath::Pi())*(x-TMath::Pi()))**(1/(1-[5])) + [1] * (1-[3]*(1-[2])*(x-TMath::TwoPi())*(x-TMath::TwoPi()))**(1/(1-[2])) + [4] * (1-[6]*(1-[5])*(x+TMath::Pi())*(x+TMath::Pi()))**(1/(1-[5]))", -0.5 * TMath::Pi(), 1.5 * TMath::Pi());
6394 // the latter is the correct function, but a very wide tsallis on the away side can fake a baseline, and then the baseline is significantly off
6395 total->SetParLimits(0, 0, 10000);
6396 total->SetParLimits(1, 0, 10000);
6397 total->SetParLimits(4, 0, 10000);
6398
6399 total->SetParLimits(2, 1.0000001, 5);
6400 total->SetParLimits(5, 1.0000001, 5);
6401
6402 total->SetParLimits(3, 0.1, 1000);
6403 total->SetParLimits(6, 0.1, 1000);
6404
6405 total->SetParameters(1, 1, 1.5, 3, 1, 1.5, 1.1);
6406
6407 // limit q>1
6408 hist->Fit(total, "0RI");
6409 fitResult = hist->Fit(total, "0RSI");
6410
6411 if (0 && fitResult->CovMatrixStatus() > 0)
6412 {
6413 TMatrixDSym cov(fitResult->GetCovarianceMatrix());
6414 cov.Print();
6415
6416 Double_t nearSideYield, nearSideError;
6417 TsallisYieldUncertainty(total->GetParameter(1), total->GetParameter(2), total->GetParameter(3), cov, 0, nearSideYield, nearSideError);
6418
6419 Double_t awaySideYield2, awaySideError;
6420 TsallisYieldUncertainty(total->GetParameter(4), total->GetParameter(5), total->GetParameter(6), cov, 3, awaySideYield2, awaySideError);
6421
6422 FillYield(trigId, centralityId, ptACenter, ptAWidth, 14 + caseOffset + 1, nearSideYield, nearSideError, awaySideYield2, awaySideError);
6423
6424 Printf("Chi2 %f / ndf %d = %f", total->GetChisquare(), total->GetNDF(), (total->GetNDF() > 0) ? total->GetChisquare() / total->GetNDF() : -1);
6425
6426 total->SetLineColor(hist->GetLineColor());
6427 total->SetLineWidth(1);
6428 if (caseOffset == 2)
6429 {
6430 if (0)
6431 total->DrawCopy("SAME");
6432 //total->SetParameter(5, total->GetParameter(5) - TMath::Sqrt(cov[5][5]));
6433 //total->DrawCopy("SAME");
6434 //total->SetParameter(5, total->GetParameter(5) + 2 * TMath::Sqrt(cov[5][5]));
6435 //Printf("%f", total->Integral(-0.7,0.7));
6436 //total->DrawCopy("SAME");
6437 }
6438
6439 if (caseOffset == 0)
6440 {
6441 // store fit parameters
6442
6443 // q
6444 FillYield(trigId, centralityId, ptACenter, ptAWidth, 28, total->GetParameter(2), total->GetParError(2), total->GetParameter(5), total->GetParError(5));
6445 // beta
6446 FillYield(trigId, centralityId, ptACenter, ptAWidth, 29, total->GetParameter(3), total->GetParError(3), total->GetParameter(6), total->GetParError(6));
6447
6448 if (0)
6449 {
6450 // two Gauss fits
6451 gausFit = new TF1("gausFit", "[0] + gaus(1) + gaus(4)", -0.5 * TMath::Pi(), 1.5 * TMath::Pi());
6452 gausFit->SetParameters(1, 1, 0, 1, 1, TMath::Pi(), 0);
6453 gausFit->SetParLimits(0, 0, 10000);
6454 gausFit->SetParLimits(1, 0, 10000);
6455 gausFit->FixParameter(2, 0);
6456 gausFit->SetParLimits(3, 0.01, 10);
6457 gausFit->SetParLimits(4, 0, 10000);
6458 gausFit->FixParameter(5, TMath::Pi());
6459 gausFit->SetParLimits(6, 0.01, 10);
6460
6461 hist->Fit(gausFit, "0RI");
6462 gausFit->SetLineWidth(1);
6463 gausFit->DrawCopy("SAME");
6464
6465 FillYield(trigId, centralityId, ptACenter, ptAWidth, 30, gausFit->GetParameter(3), total->GetParError(3), total->GetParameter(6), total->GetParError(6));
6466 }
6467 }
6468
6469 if (0 && cov[0][0] > 0)
6470 {
6471 for (Int_t i=0; i<cov.GetNcols(); i++)
6472 for (Int_t j=0; j<cov.GetNrows(); j++)
6473 cov[j][i] /= TMath::Sqrt(cov[i][i]) * TMath::Sqrt(cov[j][j]);
6474 cov.Print();
6475 }
6476 }
6477
6478 func = total;
6479 Float_t norm = func->GetParameter(0) / (1 - 2 * v2);
6480 Double_t normUnc = func->GetParError(0) / (1 - 2 * v2);
6481 //return;
6482 }
6483 else if (baseLineDetermination <= 2)
6484 {
6485 Float_t values[3];
6486 Float_t errors[3];
6487
6488 if (baseLineDetermination == 1)
6489 {
6490 Float_t regionBegin[3] = { -TMath::Pi() / 2, TMath::Pi() / 2 - 0.4, 1.5 * TMath::Pi() - 0.4 };
6491 Float_t regionEnd[3] = { -TMath::Pi() / 2 + 0.4, TMath::Pi() / 2 + 0.4, 1.5 * TMath::Pi() };
6492 }
6493 else if (baseLineDetermination == 2)
6494 {
6495 Float_t regionBegin[3] = { -TMath::Pi() / 2, TMath::Pi() / 2 - 0.4 - 0.2, 1.5 * TMath::Pi() - 0.4 - 0.2};
6496 Float_t regionEnd[3] = { -TMath::Pi() / 2 + 0.4 - 0.2, TMath::Pi() / 2 + 0.4 - 0.2, 1.5 * TMath::Pi() };
6497 }
6498
6499 // weighted mean
6500 Float_t sum = 0;
6501 Float_t weight = 0;
6502 for (Int_t i=0; i<3; i++)
6503 {
6504 hist->Fit("pol0", "0Q", "", regionBegin[i], regionEnd[i]);
6505 func = hist->GetFunction("pol0");
6506 if (!func)
6507 continue;
6508 sum += func->GetParameter(0) / func->GetParError(0) / func->GetParError(0);
6509 weight += 1. / func->GetParError(0) / func->GetParError(0);
6510 }
6511
6512 if (weight == 0)
6513 return;
6514
6515 sum /= weight;
6516 weight = TMath::Sqrt(1. / weight);
6517
6518 Float_t norm = sum / (1 - 2 * v2);
6519 Double_t normUnc = weight / (1 - 2 * v2);
6520 }
6521 else
6522 {
6523 Int_t bins = 2;
6524 if (baseLineDetermination == 4)
6525 bins = 4;
6526 if (baseLineDetermination == 5)
6527 bins = 8;
6528 Float_t norm = NLowestBinAverage(*hist, bins);
6529 Double_t normUnc = 0;
6530
6531 Printf("NLowestBinAverage %d --> %f", bins, norm);
6532
6533 norm /= (1 - 2 * v2);
6534 }
6535
6536 Printf("Baseline: %f +- %f", norm, normUnc);
6537 }
6538
6539 if (caseOffset == 0)
6540 {
6541 Float_t awaySideYieldNoBaseline = awaySideYield - norm * (1 - 2 * v2);
6542 Float_t v2YieldNoBaseline = norm * 2 * v2 * (1 + 1.4) / 1.4;
6543 Printf("Relative v2 contribution at centrality = %d, pT,t = %.1f, pT,a = %.1f: %.1f%% (%f %f)", centralityId, ptT, ptA, 100.0 * v2YieldNoBaseline / awaySideYieldNoBaseline, awaySideYieldNoBaseline, v2YieldNoBaseline);
6544 }
6545
6546 //flowFunc->SetParameters(hist->GetBinContent(hist->FindBin(1.4)) / (1.0 - 2.0 * v2), v2);
6547 flowFunc->SetParameters(norm, v2, 0, 0, 0);
6548 if (vn)
6549 flowFunc->SetParameters(norm, vn[1], vn[2], vn[3], vn[4]);
6550 flowFunc->SetLineWidth(2);
6551 if (caseOffset >= 4 && caseOffset <= 9 && caseOffset != 6 && caseOffset != 7)
6552 {
6553 if (caseOffset != 4 && caseOffset != 9)
6554 flowFunc->SetLineStyle(2);
6555 flowFunc->DrawCopy("SAME"); //->SetLineColor(caseOffset - 3);
6556 if (vn)
6557 {
6558 flowFuncTmp = (TF1*) flowFunc->Clone("flowFuncTmp");
6559 for (Int_t i=1; i<=4; i++)
6560 {
6561 flowFuncTmp->SetParameters(flowFuncTmp->GetParameter(0), 0, 0, 0, 0);
6562 flowFuncTmp->SetParameter(i, vn[i]);
6563 flowFuncTmp->SetLineStyle(2);
6564 flowFuncTmp->Print();
6565 flowFuncTmp->DrawCopy("SAME");
6566 }
6567 }
6568 }
6569
6570 hist->Add(flowFunc, -1);
6571 if (caseOffset == 0)
6572 {
6573 file = TFile::Open("dphi_corr.root", "UPDATE");
6574 hist->SetName(TString(hist->GetName()) + "_tsallis_v2");
6575 hist->Write();
6576 file->Close();
6577 // hist->DrawCopy("SAME");
6578 }
6579 if (caseOffset == 2 && flatBaseLine)
6580 {
6581 file = TFile::Open("dphi_corr.root", "UPDATE");
6582 hist->SetName(TString(hist->GetName()) + "_tsallis_flat");
6583 hist->Write();
6584 file->Close();
6585 // hist->DrawCopy("SAME");
6586 }
6587 if (caseOffset == 4 && flatBaseLine)
6588 {
6589 file = TFile::Open("dphi_corr.root", "UPDATE");
6590 hist->SetName(TString(hist->GetName()) + "_fit_flat");
6591 hist->Write();
6592 file->Close();
6593 // hist->DrawCopy("SAME");
6594 }
6595 if (caseOffset == 9)
6596 {
6597 file = TFile::Open("dphi_corr.root", "UPDATE");
6598 hist->SetName(TString(hist->GetName()) + "_fit_v2");
6599 hist->Write();
6600 file->Close();
6601 // hist->DrawCopy("SAME");
6602 }
6603
6604 ExtractYields(hist, trigId, centralityId, ptACenter, ptAWidth, 14 + caseOffset, normUnc);
6605
6606 if (0 && histMixed)
6607 {
6608 Printf("%f", histMixed->Integral() / histMixed->GetNbinsX());
6609 flowFunc->SetParameters(histMixed->Integral() / histMixed->GetNbinsX(), v2);
6610 flowFunc->SetLineColor(2);
6611 //if (caseOffset == 0)
6612 // flowFunc->DrawCopy("SAME");
6613 }
6614}
6615
6616void RemoveBaseLine(TH1* hist)
6617{
6618 if (!hist)
6619 return;
6620
6621 //hist->Rebin(2);
6622 //hist->Scale(0.5);
6623
6624 hist->Fit("pol0", "0", "", 1.07, 2.07);
6625
6626 if (!hist->GetFunction("pol0"))
6627 return;
6628
6629 Float_t zyam = hist->GetFunction("pol0")->GetParameter(0);
6630
6631 if (zyam <= 0)
6632 return;
6633
6634 return;
6635
6636 for (Int_t i=1; i<=hist->GetNbinsX(); i++)
6637 hist->SetBinContent(i, hist->GetBinContent(i) - zyam);
6638}
6639
6640void* cacheIds[10];
6641TH2* cacheMixed[10];
6642
6643Int_t gHistCount = 0;
6644void GetDistAndFlow(void* hVoid, void* hMixedVoid, TH1** hist, Float_t* v2, Int_t step, Int_t centralityBegin, Int_t centralityEnd, Float_t ptBegin, Float_t ptEnd, Int_t twoD = 0, Bool_t equivMixedBin = kFALSE, Float_t* vn = 0, Bool_t scaleToPairs = kTRUE, Int_t stepMixed = -1)
6645{
6646 h = (AliUEHistograms*) hVoid;
6647 hMixed = (AliUEHistograms*) hMixedVoid;
6648
6649 if (stepMixed < 0)
6650 stepMixed = step;
6651
6652 Int_t centralityBeginBin = 0;
6653 Int_t centralityEndBin = -1;
6654
6655 if (centralityEnd >= centralityBegin)
6656 {
6657 centralityBeginBin = h->GetUEHist(2)->GetEventHist()->GetGrid(step)->GetGrid()->GetAxis(1)->FindBin(0.01 + centralityBegin);
6658 centralityEndBin = h->GetUEHist(2)->GetEventHist()->GetGrid(step)->GetGrid()->GetAxis(1)->FindBin(-0.01 + centralityEnd);
6659 }
6660
6661 // 2d same and mixed event
6662 TH2* sameTwoD = h->GetUEHist(2)->GetUEHist(step, 0, ptBegin, ptEnd, centralityBeginBin, centralityEndBin, 1, kFALSE);
6663
6664 if (hMixed)
6665 {
6666 if (!equivMixedBin)
6667 {
6668 // No centrality, nor pT associated dep of the mixed event observed. Use a larger range to get more statistics
6669
6670 Int_t cacheId = -1;
6671
6672 for (Int_t i=0; i<10; i++)
6673 if (cacheIds[i] == hMixed)
6674 {
6675 cacheId = i;
6676 break;
6677 }
6678
6679 // not found
6680 if (cacheId == -1)
6681 for (Int_t i=0; i<10; i++)
6682 if (cacheIds[i] == 0)
6683 {
6684 cacheId = i;
6685 break;
6686 }
6687
6688 if (!cacheIds[cacheId])
6689 {
6690 hMixed->SetPtRange(3.0, 10);
6691 cacheMixed[cacheId] = (TH2*) hMixed->GetUEHist(2)->GetUEHist(stepMixed, 0, 3.0, 10.0, centralityBeginBin, centralityEndBin, 1, kFALSE);
6692 cacheIds[cacheId] = hMixed;
6693 Printf("GetDistAndFlow: Cached for %p on slot %d", hMixed, cacheId);
6694 }
6695
6696 TH2* mixedTwoD = cacheMixed[cacheId];
6697 }
6698 else
6699 {
6700 // use same bin for mixing
6701
6702 TH2* mixedTwoD = (TH2*) hMixed->GetUEHist(2)->GetUEHist(stepMixed, 0, ptBegin, ptEnd, centralityBeginBin, centralityEndBin, 1, kFALSE);
6703 }
6704
6705 if (0)
6706 {
6707 // asssume flat in dphi, gain in statistics
6708 Printf("NOTE: Assuming flat acceptance in phi!");
6709
6710 TH1* histMixedproj = mixedTwoD->ProjectionY();
6711 histMixedproj->Scale(1.0 / mixedTwoD->GetNbinsX());
6712
6713 for (Int_t x=1; x<=mixedTwoD->GetNbinsX(); x++)
6714 for (Int_t y=1; y<=mixedTwoD->GetNbinsY(); y++)
6715 mixedTwoD->SetBinContent(x, y, histMixedproj->GetBinContent(y));
6716 }
6717
6718 // get mixed event normalization by assuming full acceptance at deta of 0 (only works for flat dphi)
6719 if (scaleToPairs)
6720 {
6721 Double_t mixedNorm = mixedTwoD->Integral(1, mixedTwoD->GetNbinsX(), mixedTwoD->GetYaxis()->FindBin(-0.01), mixedTwoD->GetYaxis()->FindBin(0.01));
6722 mixedNorm /= mixedTwoD->GetNbinsX() * (mixedTwoD->GetYaxis()->FindBin(0.01) - mixedTwoD->GetYaxis()->FindBin(-0.01) + 1);
6723 }
6724 else
6725 Double_t mixedNorm = mixedTwoD->Integral() / sameTwoD->Integral();
6726
6727 // divide and scale
6728 sameTwoD->Divide(mixedTwoD);
6729 sameTwoD->Scale(mixedNorm);
6730
6731/* new TCanvas;
6732 sameTwoD->Draw("SURF1");
6733 dfdsafd;*/
6734 }
6735
6736 TString histName;
6737 histName.Form("GetDistAndFlow%d", gHistCount++);
6738
6739 // extract dphi distribution if requested
6740 if (twoD == 1)
6741 {
6742 *hist = sameTwoD;
6743 }
6744
6745 // Float_t etaLimit = 0.8;
6746 Float_t etaLimit = 1.0;
6747
6748 // 20: return corr in |delta eta| < 1 from which 1 < |delta eta| < 2 is subtracted
6749 if (twoD == 0 || twoD == 10 || twoD == 20)
6750 {
6751 Int_t etaBegin = 1;
6752 Int_t etaEnd = sameTwoD->GetNbinsY();
6753
6754 if (twoD == 10 || twoD == 20)
6755 {
6756 etaBegin = sameTwoD->GetYaxis()->FindBin(-etaLimit + 0.01);
6757 etaEnd = sameTwoD->GetYaxis()->FindBin(etaLimit - 0.01);
6758 }
6759
6760 *hist = sameTwoD->ProjectionX(histName, etaBegin, etaEnd);
6761
6762 if (!scaleToPairs)
6763 (*hist)->Scale(1.0 / (etaEnd - etaBegin + 1));
6764 }
6765
6766 if (twoD == 11 || twoD == 20)
6767 {
6768 // errors --> are ok
6769
6770// Float_t outerLimit = 2.0;
6771 Float_t outerLimit = 1.8;
6772 Printf("Phi dist: Using outer limit %.2f", outerLimit);
6773// Float_t outerLimit = etaLimit * 2;
6774
6775 histTmp = sameTwoD->ProjectionX(histName + "1", TMath::Max(1, sameTwoD->GetYaxis()->FindBin(-outerLimit + 0.01)), sameTwoD->GetYaxis()->FindBin(-etaLimit - 0.01));
6776 Int_t etaBins = sameTwoD->GetYaxis()->FindBin(-etaLimit - 0.01) - TMath::Max(1, sameTwoD->GetYaxis()->FindBin(-outerLimit + 0.01)) + 1;
6777
6778 TH1D* tracksTmp = sameTwoD->ProjectionX(histName + "2", sameTwoD->GetYaxis()->FindBin(etaLimit + 0.01), TMath::Min(sameTwoD->GetYaxis()->GetNbins(), sameTwoD->GetYaxis()->FindBin(outerLimit - 0.01)));
6779 etaBins += TMath::Min(sameTwoD->GetYaxis()->GetNbins(), sameTwoD->GetYaxis()->FindBin(outerLimit - 0.01)) - sameTwoD->GetYaxis()->FindBin(etaLimit + 0.01) + 1;
6780
6781// printf("%f +- %f %f +- %f ", (*hist)->GetBinContent(1), (*hist)->GetBinError(1), tracksTmp->GetBinContent(1), tracksTmp->GetBinError(1));
6782 histTmp->Add(tracksTmp);
6783// Printf(" --> %f +- %f", (*hist)->GetBinContent(1), (*hist)->GetBinError(1));
6784
6785 if (!scaleToPairs)
6786 histTmp->Scale(1.0 / etaBins);
6787
6788 if (twoD == 11)
6789 *hist = histTmp;
6790 else if (twoD == 20)
6791 {
6792 // calculate acc with 2 * (deta - 0.5 * deta*deta / 1.6)
6793 if (!hMixedVoid)
6794 histTmp->Scale(0.75 / 0.25);
6795
6796 histTmp->Scale(1.0 / 0.8);
6797
6798 (*hist)->Add(histTmp, -1);
6799 }
6800 }
6801
6802// (*hist)->Rebin(2); (*hist)->Scale(0.5);
6803
6804 //*hist = h->GetUEHist(2)->GetUEHist(step, 0, ptBegin, ptEnd, h->GetUEHist(2)->GetEventHist()->GetGrid(step)->GetGrid()->GetAxis(1)->FindBin(0.01 + centralityBegin), h->GetUEHist(2)->GetEventHist()->GetGrid(step)->GetGrid()->GetAxis(1)->FindBin(-0.01 + centralityEnd), twoD);
6805
6806 TString str;
6807 str.Form("%.1f < p_{T,trig} < %.1f", ptBegin - 0.01, ptEnd + 0.01);
6808
6809 TString str2;
6810 str2.Form("%.2f < p_{T,assoc} < %.2f", gpTMin - 0.01, gpTMax + 0.01);
6811
6812 TString newTitle;
6813 newTitle.Form("%s - %s - %d-%d%%", str.Data(), str2.Data(), centralityBegin, centralityEnd);
6814 (*hist)->SetTitle(newTitle);
6815
6816 if (0 && hMixed)
6817 {
6818 histMixed = hMixed->GetUEHist(2)->GetUEHist(step, 0, ptBegin, ptEnd, hMixed->GetUEHist(2)->GetEventHist()->GetGrid(step)->GetGrid()->GetAxis(1)->FindBin(0.01 + centralityBegin), hMixed->GetUEHist(2)->GetEventHist()->GetGrid(step)->GetGrid()->GetAxis(1)->FindBin(-0.01 + centralityEnd));
6819
6820 //new TCanvas; (*hist)->DrawCopy(); histMixed->DrawCopy("SAME")->SetLineColor(2);
6821
6822 Float_t totalPairs = (*hist)->Integral();
6823
6824 (*hist)->Divide(histMixed);
6825 (*hist)->Scale(totalPairs / (*hist)->Integral());
6826
6827 //(*hist)->DrawCopy("SAME")->SetLineColor(4);
6828 }
6829
6830 if (v2 || vn)
6831 {
6832 // calculate v2trigger
6833 h->GetUEHist(2)->GetEventHist()->GetGrid(step)->GetGrid()->GetAxis(1)->SetRangeUser(0.01 + centralityBegin, -0.01 + centralityEnd);
6834 ptDist = h->GetUEHist(2)->GetEventHist()->Project(step, 0);
6835 Float_t vTrig[5];
6836 for (Int_t i=2; i<=((vn) ? 5 : 2); i++)
6837 vTrig[i-1] = CalculateFlow(ptDist, ptBegin, ptEnd, i, centralityBegin, centralityEnd);
6838 delete ptDist;
6839
6840 // calculate v2 assoc
6841 cont = h->GetUEHist(2)->GetTrackHist(0);
6842 h->GetUEHist(2)->GetTrackHist(0)->GetGrid(step)->GetGrid()->GetAxis(3)->SetRangeUser(0.01 + centralityBegin, -0.01 + centralityEnd);
6843 h->GetUEHist(2)->GetTrackHist(0)->GetGrid(step)->GetGrid()->GetAxis(2)->SetRangeUser(ptBegin, ptEnd);
6844 ptDist = h->GetUEHist(2)->GetTrackHist(0)->Project(step, 1);
6845 Float_t vAssoc[5];
6846 for (Int_t i=2; i<=((vn) ? 5 : 2); i++)
6847 vAssoc[i-1] = CalculateFlow(ptDist, gpTMin, gpTMax, i, centralityBegin, centralityEnd);
6848 delete ptDist;
6849
6850 if (v2)
6851 *v2 = vTrig[2-1] * vAssoc[2-1];
6852 if (vn)
6853 for (Int_t i=2; i<=5; i++)
6854 vn[i-1] = vTrig[i-1] * vAssoc[i-1];
6855 }
6856}
6857
6858void CompareNtrDist(const char* fileName1, const char* fileNameCentrality1)
6859{
6860 loadlibs();
6861 Int_t step = 8;
6862
6863 TCanvas *c1 = new TCanvas("c1", "", 1400, 1100);
6864 TCanvas *c2 = new TCanvas("c2", "", 1400, 1100);
6865
6866 dndpt_central = ReadHepdata("/home/mkofarag/work/Project/2010/raa_dndpt_central.txt", kFALSE, 3);
6867 AliUEHistograms* h1 = (AliUEHistograms*) GetUEHistogram(fileName1);
6868 AliUEHistograms* hc1 = (AliUEHistograms*) GetUEHistogram(fileNameCentrality1);
6869
6870 h1->GetUEHist(2)->GetEventHist()->GetGrid(step)->GetGrid()->GetAxis(1)->SetRangeUser(0.01 + 0, -0.01 + 5);
6871 ptDist1 = h1->GetUEHist(2)->GetEventHist()->Project(step, 0);
6872 ptDist1->Scale(1.0/1.8/TMath::TwoPi()/hc1->GetCentralityDistribution()->Integral(hc1->GetCentralityDistribution()->FindBin(0.01), hc1->GetCentralityDistribution()->FindBin(4.99)));
6873 for (Int_t i=1; i<=ptDist1->GetNbinsX(); i++)
6874 {
6875 ptDist1->SetBinContent(i, ptDist1->GetBinContent(i)/ptDist1->GetBinWidth(i));
6876 }
6877 for (Int_t i=0; i<dndpt_central->GetN();i++)
6878 {
6879 Double_t x = dndpt_central->GetX()[i];
6880 Double_t y = dndpt_central->GetY()[i]*x;
6881 dndpt_central->SetPoint(i,x,y);
6882 }
6883 ptDist2 = (TH1*) ptDist1->Clone("ptDist2");
6884 ptDist2->Reset();
6885 for (Int_t i=0; i<dndpt_central->GetN(); i++)
6886 {
6887 Float_t width = 0;
6888 if (i > 0)
6889 width += (dndpt_central->GetX()[i] - dndpt_central->GetX()[i-1]) / 2;
6890 if (i < dndpt_central->GetN()-1)
6891 width += (dndpt_central->GetX()[i+1] - dndpt_central->GetX()[i]) / 2;
6892 if (i == 0 || i == dndpt_central->GetN() - 1)
6893 width *= 2;
6894 ptDist2->Fill(dndpt_central->GetX()[i],dndpt_central->GetY()[i]*width);
6895 }
6896 for (Int_t i=1; i<=ptDist2->GetNbinsX(); i++)
6897 {
6898 ptDist2->SetBinContent(i, ptDist2->GetBinContent(i)/ptDist2->GetBinWidth(i));
6899 ptDist2->SetBinError(i,0);
6900 }
6901/* for (Int_t i=1; i<=ptDist1->GetNbinsX(); i++)
6902 {
6903 ptDist1->SetBinError(i,0);
6904 }
6905*/
6906 c1->cd();
6907 c1->SetLogy();
6908 ptDist1->SetMarkerStyle(3);
6909 ptDist2->SetMarkerStyle(2);
6910 ptDist1->SetMarkerColor(2);
6911 ptDist2->SetMarkerColor(3);
6912 ptDist1->SetLineColor(2);
6913 ptDist2->SetLineColor(3);
6914 ptDist1->DrawCopy("EP");
6915 ptDist2->Draw("EPSAME");
6916 ptDist1->Divide(ptDist1,ptDist2);
6917 c2->cd();
6918 ptDist1->Draw("EP");
6919
6920}
6921
6922void FitNtrDist(const char* fileName1, const char* fileNameCentrality1)
6923{
6924 loadlibs();
6925 Int_t step = 8;
6926
6927 TCanvas *c1 = new TCanvas("c1", "", 1400, 1100);
6928 TCanvas *c2 = new TCanvas("c2", "", 1400, 1100);
6929 TCanvas *c3 = new TCanvas("c3", "", 1400, 1100);
6930
6931 dndpt_central = ReadHepdata("/home/mkofarag/work/Project/2010/raa_dndpt_central.txt", kFALSE, 3);
6932 TF1* func1 = new TF1("func1", "[0]*x/TMath::Sqrt(0.1396*0.1396+x*x)*TMath::Power(1+x/[1],-1*[2])",0.5,5);
6933 TF1* func2 = new TF1("func2", "[0]*TMath::Power(x,-1*[1])",5,20);
6934
6935 func1->SetParLimits(0, 2000, 5000);
6936 func1->SetParLimits(1, 1, 6);
6937 func1->SetParLimits(2, 7, 20);
6938 dndpt_central->Fit(func1,"RB","",0.5,5);
6939
6940 func2->SetParLimits(0, 0, 1000);
6941 func2->SetParLimits(1, 4, 8);
6942 dndpt_central->Fit(func2,"RB","",5,20);
6943
6944 c1->cd();
6945 c1->SetLogy();
6946 c1->SetLogx();
6947 dndpt_central->Draw("AP");
6948 func1->Draw("SAME");
6949 func2->Draw("SAME");
6950
6951 TF1* func3 = new TF1("func3", "[0]*x*x/TMath::Sqrt(0.1396*0.1396+x*x)*TMath::Power(1+x/[1],-1*[2])",0.5,5);
6952 TF1* func4 = new TF1("func4", "[0]*x*TMath::Power(x,-1*[1])",5,20);
6953
6954 func3->FixParameter(0,func1->GetParameter(0));
6955 func3->FixParameter(1,func1->GetParameter(1));
6956 func3->FixParameter(2,func1->GetParameter(2));
6957 func4->FixParameter(0,func2->GetParameter(0));
6958 func4->FixParameter(1,func2->GetParameter(1));
6959
6960 AliUEHistograms* h1 = (AliUEHistograms*) GetUEHistogram(fileName1);
6961 AliUEHistograms* hc1 = (AliUEHistograms*) GetUEHistogram(fileNameCentrality1);
6962
6963 h1->GetUEHist(2)->GetEventHist()->GetGrid(step)->GetGrid()->GetAxis(1)->SetRangeUser(0.01 + 0, -0.01 + 5);
6964 ptDist1 = h1->GetUEHist(2)->GetEventHist()->Project(step, 0);
6965 ptDist1->Scale(1.0/1.8/TMath::TwoPi()/hc1->GetCentralityDistribution()->Integral(hc1->GetCentralityDistribution()->FindBin(0.01), hc1->GetCentralityDistribution()->FindBin(4.99)));
6966 ptDist2 = (TH1*) ptDist1->Clone("ptDist2");
6967 ptDist2->Reset();
6968 for (Int_t i=1; i<=ptDist1->GetNbinsX(); i++)
6969 {
6970 ptDist1->SetBinContent(i, ptDist1->GetBinContent(i)/ptDist1->GetBinWidth(i));
6971 if (ptDist1->GetBinLowEdge(i)<5) ptDist2->SetBinContent(i, func3->Integral(ptDist1->GetBinLowEdge(i),ptDist1->GetBinLowEdge(i+1)));
6972 else ptDist2->SetBinContent(i, func4->Integral(ptDist1->GetBinLowEdge(i),ptDist1->GetBinLowEdge(i+1)));
6973 }
6974
6975 for (Int_t i=1; i<=ptDist2->GetNbinsX(); i++)
6976 {
6977 ptDist2->SetBinContent(i, ptDist2->GetBinContent(i)/ptDist2->GetBinWidth(i));
6978 }
6979 c2->cd();
6980 c2->SetLogy();
6981 ptDist1->SetMarkerStyle(3);
6982 ptDist2->SetMarkerStyle(2);
6983 ptDist1->SetMarkerColor(2);
6984 ptDist2->SetMarkerColor(3);
6985 ptDist1->SetLineColor(2);
6986 ptDist2->SetLineColor(3);
6987 ptDist1->DrawCopy("EP");
6988 ptDist2->Draw("EPSAME");
6989
6990 ptDist1->Divide(ptDist1,ptDist2);
6991 c3->cd();
6992 ptDist1->Draw("EP");
6993}
6994
6995void DrawNtrDist(const char* fileName1, const char* fileName2, const char* fileNameCentrality1, const char* fileNameCentrality2)
6996{
6997 loadlibs();
6998
6999 Int_t step = 8;
7000
7001 new TCanvas("c", "", 1400, 1100);
7002 AliUEHistograms* h1 = (AliUEHistograms*) GetUEHistogram(fileName1);
7003 AliUEHistograms* h2 = (AliUEHistograms*) GetUEHistogram(fileName2);
7004 AliUEHistograms* hc1 = (AliUEHistograms*) GetUEHistogram(fileNameCentrality1);
7005 AliUEHistograms* hc2 = (AliUEHistograms*) GetUEHistogram(fileNameCentrality2);
7006 h1->GetUEHist(2)->GetEventHist()->GetGrid(step)->GetGrid()->GetAxis(1)->SetRangeUser(0.01 + 0, -0.01 + 10);
7007 h2->GetUEHist(2)->GetEventHist()->GetGrid(step)->GetGrid()->GetAxis(1)->SetRangeUser(0.01 + 0, -0.01 + 10);
7008 ptDist1 = h1->GetUEHist(2)->GetEventHist()->Project(step, 0);
7009 ptDist2 = h2->GetUEHist(2)->GetEventHist()->Project(step, 0);
7010 ptDist1->Scale(1/hc1->GetCentralityDistribution()->Integral(hc1->GetCentralityDistribution()->FindBin(0.01), hc1->GetCentralityDistribution()->FindBin(9.99)));
7011 ptDist2->Scale(1/hc2->GetCentralityDistribution()->Integral(hc2->GetCentralityDistribution()->FindBin(0.01), hc2->GetCentralityDistribution()->FindBin(9.99)));
7012 ptDist1->Divide(ptDist1,ptDist2);
7013 ptDist1->SetMarkerStyle(3);
7014 ptDist1->Draw();
7015}
7016
7017void GetSumOfRatios(void* hVoid, void* hMixedVoid, TH1** hist, Int_t step, Int_t centralityBegin, Int_t centralityEnd, Float_t ptBegin, Float_t ptEnd, Bool_t normalizePerTrigger = kTRUE, Bool_t useCentralityBinsDirectly = kFALSE)
7018{
7019 Printf("GetSumOfRatios | step %d | %d-%d%% | %.1f - %.1f GeV/c | %.1f - %.1f GeV/c", step, centralityBegin, centralityEnd, gpTMin, gpTMax, ptBegin, ptEnd);
7020
7021 h = (AliUEHistograms*) hVoid;
7022 hMixed = (AliUEHistograms*) hMixedVoid;
7023
7024 Int_t centralityBeginBin = 0;
7025 Int_t centralityEndBin = -1;
7026
7027 if (!useCentralityBinsDirectly && centralityEnd >= centralityBegin)
7028 {
7029 centralityBeginBin = h->GetUEHist(2)->GetEventHist()->GetGrid(step)->GetGrid()->GetAxis(1)->FindBin(0.01 + centralityBegin);
7030 centralityEndBin = h->GetUEHist(2)->GetEventHist()->GetGrid(step)->GetGrid()->GetAxis(1)->FindBin(-0.01 + centralityEnd);
7031 }
7032 else if (useCentralityBinsDirectly)
7033 {
7034 centralityBeginBin = centralityBegin;
7035 centralityEndBin = centralityEnd;
7036 }
7037
7038 *hist = h->GetUEHist(2)->GetSumOfRatios2(hMixed->GetUEHist(2), step, 0, ptBegin, ptEnd, centralityBeginBin, centralityEndBin, normalizePerTrigger);
7039
7040 TString str;
7041 str.Form("%.1f < p_{T,trig} < %.1f", ptBegin - 0.01, ptEnd + 0.01);
7042
7043 TString str2;
7044 str2.Form("%.2f < p_{T,assoc} < %.2f", gpTMin - 0.01, gpTMax + 0.01);
7045
7046 TString newTitle;
7047 newTitle.Form("%s - %s - %d-%d", str.Data(), str2.Data(), centralityBegin, centralityEnd);
7048 if (!useCentralityBinsDirectly)
7049 newTitle += "%";
7050 if ((*hist))
7051 (*hist)->SetTitle(newTitle);
7052}
7053
7054void PlotDeltaPhiDistributions(const char* fileName1, const char* fileName2, Float_t yMax = 0.1, Int_t twoD = 0, Int_t centrBegin = 1, Int_t centrEnd = 1)
7055{
7056 loadlibs();
7057
7058 Bool_t veryCentral = 0;
7059 Bool_t flowComparison = 0;
7060 Bool_t rhicOverlay = 0;
7061 Bool_t highStatBinning = 0;
7062
7063 file = TFile::Open("dphi_corr.root", "RECREATE");
7064 file->Close();
7065
7066 Int_t leadingPtOffset = 1;
7067
7068 if (veryCentral || flowComparison)
7069 {
7070 Int_t maxLeadingPt = 2;
7071 Int_t maxAssocPt = 2;
7072 Float_t leadingPtArr[] = { 2.0, 3.0, 4.0, 10.0, 20.0, 40.0 };
7073 //Float_t assocPtArr[] = { 0.15, 0.5, 1.0, 2.0, 4.0, 6.0, 10.0, 20.0, 40.0 };
7074 Float_t assocPtArr[] = { 1.0, 2.0, 3.0, 6.0, 10.0, 20.0, 40.0 };
7075 }
7076 else if (rhicOverlay) // RHIC binning
7077 {
7078 Int_t maxLeadingPt = 4;
7079 Int_t maxAssocPt = 5;
7080 Float_t leadingPtArr[] = { 4.0, 5.0, 7.0, 9.0, 12.0 };
7081 Float_t assocPtArr[] = { 0.5, 1.0, 2.0, 3.0, 5.0, 7.0 };
7082 }
7083 else if (highStatBinning)
7084 {
7085 Int_t maxLeadingPt = 3;
7086 Int_t maxAssocPt = 2;
7087 Float_t leadingPtArr[] = { 4.0, 6.0, 8.0, 15.0 };
7088 Float_t assocPtArr[] = { 1.0, 4.0, 10.0 };
7089 }
7090 else // ALICE binning
7091 {
7092 if (1) // binning from preliminaries
7093 {
7094 Int_t maxLeadingPt = 2;
7095 Int_t maxAssocPt = 7;
7096// Float_t leadingPtArr[] = { 6.0, 8.0, 10.0, 10.0, 15.0 };
7097 Float_t leadingPtArr[] = { 6.0, 8.0, 10.0, 15.0, 15.0 };
7098 Float_t assocPtArr[] = { 0.5, 1.5, 3.0, 4.0, 6.0, 8.0, 10.0, 12.0 };
7099 leadingPtOffset = 2;
7100 }
7101 else if (0)
7102 {
7103 Int_t maxLeadingPt = 1;
7104 Int_t maxAssocPt = 4;
7105 Float_t leadingPtArr[] = { 8.0, 10.0, 15.0, 15.0 };
7106 Float_t assocPtArr[] = { 3.0, 4.0, 6.0, 8.0, 10.0, 12.0 };
7107 leadingPtOffset = 2;
7108 }
7109 else
7110 {
7111 Int_t maxLeadingPt = 3;
7112 Int_t maxAssocPt = 3;
7113 Float_t leadingPtArr[] = { 6.0, 8.0, 10.0, 15.0, 20.0 };
7114 Float_t assocPtArr[] = { 1.0, 2.0, 3.0, 4.0, 6.0, 8.0, 10.0, 12.0 };
7115 leadingPtOffset = 2;
7116 }
7117 }
7118
7119 Int_t nCentralityBins = 5;
7120 Int_t centralityBins[] = { 1, 7, 9, 11, 13, 16 };
7121 //Int_t centralityBins[] = { 1, 3, 5, 7, 9, 13 };
7122
7123 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName1);
7124
7125// h->SetZVtxRange(-0.5, 0.5);
7126// h->SetZVtxRange(1.5, 2.5);
7127
7128 AliUEHistograms* hMixed = 0;
7129 AliUEHistograms* hMixed2 = 0; // GetUEHistogram(fileName2, 0, kTRUE);
7130
7131 if (twoD)
7132 {
7133 hMixed = (AliUEHistograms*) GetUEHistogram(fileName1, 0, kTRUE);
7134 hMixed2 = (AliUEHistograms*) GetUEHistogram(fileName2, 0, kTRUE);
7135 }
7136
7137
7138 if (veryCentral)
7139 {
7140 Printf("WARNING: Reading mixed event from preliminaries/corrected_110317.root");
7141 hMixed = (AliUEHistograms*) GetUEHistogram("preliminaries/corrected_110317.root", 0, kTRUE);
7142 }
7143
7144 AliUEHistograms* h2 = 0;
7145 if (!twoD)
7146 h2 = (AliUEHistograms*) GetUEHistogram(fileName2);
7147
7148
7149 TCanvas* canvas = new TCanvas("DeltaPhi", "DeltaPhi", 1000, 700);
7150 canvas->Divide(maxAssocPt, maxLeadingPt);
7151
7152 TCanvas* canvas2 = new TCanvas("Centrality", "Centrality", 800, 600);
7153 centralityHist = (TH1*) h->GetCentralityDistribution();
7154 NormalizeToBinWidth(centralityHist);
7155 centralityHist->Draw();
7156 gPad->SetLogy();
7157
7158 TLegend* legend = new TLegend(0.2, 0.5, 0.95, 0.90);
7159 TLegend* legend2 = new TLegend(0.5, 0.63, 0.95, 0.90);
7160 legend2->SetFillColor(0);
7161 legend2->SetTextSize(0.04);
7162
7163 for (Int_t i=0; i<maxLeadingPt; i++)
7164 for (Int_t j=0; j<maxAssocPt; j++)
7165 {
7166 TString str;
7167 str.Form("%.1f < p_{T,trig} < %.1f", leadingPtArr[i], leadingPtArr[i+leadingPtOffset]);
7168
7169 if (j == 0)
7170 {
7171 canvas2->cd();
7172 h->GetUEHist(2)->GetEventHist()->GetGrid(6)->SetRangeUser(0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01);
7173 centralityHist = h->GetUEHist(2)->GetEventHist()->ShowProjection(1, 6);
7174 centralityHist->SetLineColor(i+2);
7175 NormalizeToBinWidth(centralityHist);
7176 centralityHist->DrawCopy("SAME");
7177 h->GetUEHist(2)->GetEventHist()->GetGrid(6)->SetRangeUser(0, 0, -1);
7178 legend2->AddEntry(centralityHist, str);
7179 }
7180
7181 canvas->cd(j+1 + i * maxAssocPt);
7182 gPad->SetLeftMargin(0.15);
7183 gPad->SetBottomMargin(0.2);
7184 gPad->SetTopMargin(0.01);
7185 gPad->SetRightMargin(0.01);
7186
7187 if (i == 0 && j == 3)
7188 legend->Draw();
7189
7190 gpTMin = assocPtArr[j] + 0.01;
7191 gpTMax = assocPtArr[j+1] - 0.01;
7192
7193 TString str2;
7194 str2.Form("%.1f < p_{T,assoc} < %.1f", gpTMin - 0.01, gpTMax + 0.01);
7195
7196 SetupRanges(h);
7197
7198 if (h2)
7199 {
7200 SetupRanges(h2); // SetEtaRange(0, 0) does not need to be called for the leading track result
7201 }
7202
7203 if (hMixed)
7204 {
7205 SetupRanges(hMixed);
7206 }
7207
7208 // delta phi
7209 if (!twoD)
7210 {
7211 if (assocPtArr[j] >= leadingPtArr[i+leadingPtOffset])
7212 continue;
7213
7214 // 0-5% --> 1, 5
7215 // 0-10% --> 1, 6
7216 // 0-20% --> 1, 8
7217 // 20-40% --> 9, 10
7218 // 40-80% --> 11, 14
7219 // > 40% --> 11, 16
7220
7221 TString hist1Str, hist2Str, hist2bStr;
7222
7223 Float_t v2[3];
7224 for (Int_t k=0; k<3; k++)
7225 v2[k] = 0;
7226 Float_t vn[3][3];
7227
7228 if (veryCentral)
7229 {
7230 Int_t step = 0;
7231 TH1* hist1 = 0;
7232 TH1* hist2 = 0;
7233 TH1* hist2b = 0;
7234 TH1* hist3 = 0;
7235
7236 GetDistAndFlow(h, hMixed, &hist1, v2, step, 0, 2, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01); hist1Str = "0-2%";
7237// GetDistAndFlow(h, hMixed, &hist2, v2, step, 1, 3, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01); hist2Str = "1-3%";
7238 GetDistAndFlow(h, hMixed, &hist2b, v2+2, step, 30, 40, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01); hist2bStr = "30-40%";
7239
7240 //TH1* hist1 = h->GetUEHist(2)->GetUEHist(step, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 1, 2); hist1Str = "0-2%";
7241 //TH1* hist2 = h->GetUEHist(2)->GetUEHist(step, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 2, 3); hist2Str = "2-3%";
7242 //TH1* hist2b = h->GetUEHist(2)->GetUEHist(step, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 10, 10); hist2bStr = "30-40%";
7243 }
7244 else if (flowComparison)
7245 {
7246 TH1* hist1 = h->GetUEHist(2)->GetUEHist(6, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 1, 5); hist1Str = "0-5%";
7247 TH1* hist2 = h->GetUEHist(2)->GetUEHist(6, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 9, 10); hist2Str = "20-40%";
7248 TH1* hist2b = h->GetUEHist(2)->GetUEHist(6, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 10, 10); hist2bStr = "30-40%";
7249 TH1* hist3 = 0; // h2->GetUEHist(2)->GetUEHist(0, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01);
7250 }
7251 else if (rhicOverlay)
7252 {
7253 TH1* hist1 = h->GetUEHist(2)->GetUEHist(6, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 1, 8); hist1Str = "0-20%";
7254 TH1* hist2 = h->GetUEHist(2)->GetUEHist(6, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 9, 12); hist2Str = "20-60%";
7255 TH1* hist2b = h->GetUEHist(2)->GetUEHist(6, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 13, 15);hist2bStr = "60-90%";
7256 TH1* hist3 = h2->GetUEHist(2)->GetUEHist(0, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01);
7257 }
7258 else
7259 {
7260 Int_t step = 6;
7261 TH1* hist1 = 0;
7262 TH1* hist2 = 0;
7263 TH1* hist2b = 0;
7264
7265 Bool_t equivMixedBin = 1;
7266 Int_t histType = 0;
7267// histType = 20; Printf("WARNING: Using histogram type 20");
7268
7269// GetDistAndFlow(h, hMixed, &hist1, v2, step, 0, 2, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, vn[0]); hist1Str = "0-2%";
7270// GetDistAndFlow(h, hMixed, &hist1, v2, step, 0, 5, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, vn[0]); hist1Str = "0-5%";
7271 GetDistAndFlow(h, hMixed, &hist1, v2, step, 0, 5, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin); hist1Str = "0-5%";
7272
7273 /*
7274 new TCanvas;
7275 hist1->Draw();
7276
7277 TH1* histTmp1 = 0;
7278 GetDistAndFlow(h, hMixed, &histTmp1, v2, step, 0, 5, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 10, equivMixedBin); hist1Str = "0-5%";
7279 histTmp1->SetLineColor(2);
7280 histTmp1->Draw("SAME");
7281 histTmp1->Scale(1 / 0.75);
7282
7283 histTmp1 = 0;
7284 GetDistAndFlow(h, hMixed, &histTmp1, v2, step, 0, 5, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 20, equivMixedBin); hist1Str = "0-5%";
7285 histTmp1->SetLineColor(4);
7286 histTmp1->Draw("SAME");
7287 histTmp1->Scale(1 / 0.75);
7288
7289 histTmp1 = 0;
7290 GetDistAndFlow(h, hMixed, &histTmp1, v2, step, 0, 5, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 11, equivMixedBin); hist1Str = "0-5%";
7291 histTmp1->SetLineColor(3);
7292 histTmp1->Draw("SAME");
7293 histTmp1->Scale(1 / 0.25);
7294
7295 return;
7296 */
7297
7298 GetDistAndFlow(h, hMixed, &hist2, v2+1, step, 0, 20, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin); hist2Str = "0-20%";
7299// GetDistAndFlow(h, hMixed, &hist2b, v2[2], step, 60, 80, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 0, equivMixedBin); hist2bStr = "60-80%";
7300 GetDistAndFlow(h, hMixed, &hist2b, v2+2, step, 60, 90, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin); hist2bStr = "60-90%";
7301
7302 Printf("%f %f %f", v2[0], v2[1], v2[2]);
7303// Printf("%f %f %f", vn[0][1], vn[0][2], vn[0][3]);
7304
7305// TH1* hist1 = h->GetUEHist(2)->GetUEHist(step, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 1, 8); hist1Str = "0-20%";
7306// TH1* hist2 = h->GetUEHist(2)->GetUEHist(step, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 9, 12); hist2Str = "20-60%";
7307// TH1* hist2b = h->GetUEHist(2)->GetUEHist(step, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 13, 15); hist2bStr = "60-90%";
7308
7309 step = 6;
7310// TH1* hist3Old = h2->GetUEHist(2)->GetUEHist(step, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01);
7311 TH1* hist3 = 0;
7312 GetDistAndFlow(h2, hMixed2, &hist3, 0, step, 0, -1, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin);
7313// hist3->Rebin(2); hist3->Scale(0.5);
7314
7315/* new TCanvas;
7316 hist3->Draw();
7317 hist3Old->DrawCopy("SAME")->SetLineColor(2); */
7318 }
7319
7320 /*
7321 RemoveBaseLine(hist1);
7322 RemoveBaseLine(hist2);
7323 RemoveBaseLine(hist2b);
7324 RemoveBaseLine(hist3);
7325 */
7326
7327 TString newTitle;
7328 newTitle.Form("%s - %s", str.Data(), str2.Data());
7329 if (hist1)
7330 {
7331 hist1->SetName(Form("dphi_%d_%d_%d", i, j, 0));
7332 hist1->SetTitle(newTitle + " - " + hist1Str);
7333 }
7334 if (hist2)
7335 {
7336 hist2->SetName(Form("dphi_%d_%d_%d", i, j, 1));
7337 hist2->SetTitle(newTitle + " - " + hist2Str);
7338 }
7339 if (hist2b)
7340 {
7341 hist2b->SetName(Form("dphi_%d_%d_%d", i, j, 2));
7342 hist2b->SetTitle(newTitle + " - " + hist2bStr);
7343 }
7344 if (hist3)
7345 {
7346 hist3->SetName(Form("dphi_%d_%d_%d", i, j, 3));
7347 hist3->SetTitle(newTitle + " - pp");
7348 }
7349
7350 if (0)
7351 {
7352 hist1->Scale(1.0 / hist1->Integral());
7353 hist2->Scale(1.0 / hist2->Integral());
7354 hist3->Scale(1.0 / hist3->Integral());
7355 }
7356
7357 if (i == 0 && j == 0)
7358 {
7359 legend->SetFillColor(0);
7360 legend->AddEntry(hist1, "Pb+Pb 0-5%");
7361 if (hist2)
7362 legend->AddEntry(hist2, "Pb+Pb 20-40%");
7363 if (hist2b)
7364 legend->AddEntry(hist2b, "Pb+Pb 60-90%");
7365 if (hist3)
7366 legend->AddEntry(hist3, "p+p 7 TeV");
7367 legend->SetTextSize(0.08);
7368 }
7369
7370 Prepare1DPlot(hist1);
7371 Prepare1DPlot(hist2);
7372 Prepare1DPlot(hist2b);
7373 Prepare1DPlot(hist3);
7374
7375 Double_t yMin = 0.01;
7376 Double_t yMax2 = yMax;
7377
7378 if (yMax < 0)
7379 {
7380 yMin = -0.01; //TMath::Min(hist1->GetMinimum(), hist2->GetMinimum()) * 0.97;
7381 yMax2 = TMath::Max((hist3) ? hist3->GetMaximum() : 0.0, TMath::Max(hist1->GetMaximum(), (hist2) ? hist2->GetMaximum() : 0.0)) * 1.03;
7382 }
7383
7384 yMax2 *= 1.4;
7385
7386 TH2F* dummy = new TH2F("dummy", "", 100, hist1->GetXaxis()->GetBinLowEdge(1), hist1->GetXaxis()->GetBinUpEdge(hist1->GetNbinsX()), 1000, yMin, yMax2); //TMath::Max(hist1->GetMaximum(), hist2->GetMaximum()) * 1.1);
7387 dummy->SetStats(kFALSE);
7388 dummy->SetXTitle(hist1->GetXaxis()->GetTitle());
7389 dummy->SetYTitle(hist1->GetYaxis()->GetTitle());
7390 dummy->SetYTitle("1/N_{trig} dN/d#Delta#phi");
7391 Prepare1DPlot(dummy);
7392
7393 dummy->GetYaxis()->SetTitleOffset(0.8);
7394
7395 dummy->GetXaxis()->SetLabelSize(0.08);
7396 dummy->GetYaxis()->SetLabelSize(0.08);
7397 dummy->GetXaxis()->SetTitleSize(0.08);
7398 dummy->GetYaxis()->SetTitleSize(0.08);
7399 /*
7400 dummy->GetYaxis()->SetTitleOffset(0.8);
7401 */
7402
7403 dummyTmp = dummy->DrawCopy();
7404
7405 hist1->DrawCopy("SAME");
7406
7407 if (hMixed)
7408 {
7409 SetupRanges(hMixed);
7410 // for HI file do not set range in eta anymore after it was changed to delta eta axis
7411 hMixed->SetEtaRange(0, 0);
7412 }
7413 TH1* hist1Mixed = 0; //hMixed->GetUEHist(2)->GetUEHist(6, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 1, 5);
7414 //DrawFlow(v2[0], hist1, leadingPtArr[i], assocPtArr[j], hist1Mixed, i, 0, 0, (assocPtArr[j] + assocPtArr[j+1]) / 2, (assocPtArr[j+1] - assocPtArr[j]) / 2, kFALSE, 0, vn[0]);
7415 DrawFlow(v2[0], hist1, leadingPtArr[i], assocPtArr[j], hist1Mixed, i, 0, 0, (assocPtArr[j] + assocPtArr[j+1]) / 2, (assocPtArr[j+1] - assocPtArr[j]) / 2, kFALSE, 0);
7416
7417 //hist1Mixed->Draw("SAME");
7418 if (hist2)
7419 {
7420 hist2->SetLineColor(2);
7421 hist2->DrawCopy("SAME");
7422
7423 TH1* hist2Mixed = 0; //hMixed->GetUEHist(2)->GetUEHist(6, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 9, 10);
7424 //hist2Mixed->SetLineColor(2);
7425 //hist2Mixed->Draw("SAME");
7426
7427 DrawFlow(v2[1], hist2, leadingPtArr[i], assocPtArr[j], hist2Mixed, i, 1, 0, (assocPtArr[j] + assocPtArr[j+1]) / 2, (assocPtArr[j+1] - assocPtArr[j]) / 2);
7428 //DrawFlow(GetFlow05(), hist2, leadingPtArr[i], assocPtArr[j], hist2Mixed);
7429 }
7430 if (hist2b)
7431 {
7432 hist2b->SetLineColor(3);
7433 hist2b->DrawCopy("SAME");
7434
7435 TH1* hist2bMixed = 0; //hMixed->GetUEHist(2)->GetUEHist(6, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 13, 15);
7436 DrawFlow(v2[2], hist2b, leadingPtArr[i], assocPtArr[j], hist2bMixed, i, 2, 0, (assocPtArr[j] + assocPtArr[j+1]) / 2, (assocPtArr[j+1] - assocPtArr[j]) / 2);
7437 //DrawFlow(GetFlow05(), hist2b, leadingPtArr[i], assocPtArr[j], hist2bMixed);
7438 }
7439 if (hist3)
7440 {
7441 hist3->SetLineColor(4);
7442 hist3->DrawCopy("SAME");
7443
7444 DrawFlow(0, hist3, leadingPtArr[i], assocPtArr[j], 0, i, 3, 0, (assocPtArr[j] + assocPtArr[j+1]) / 2, (assocPtArr[j+1] - assocPtArr[j]) / 2);
7445 }
7446 //dummyTmp->GetYaxis()->SetRangeUser(0, 1.1 * TMath::Max(TMath::Max(hist1->GetMaximum(), hist2->GetMaximum()), hist2b->GetMaximum()));
7447 }
7448 else // delta eta delta phi
7449 {
7450 if (twoD == 1)
7451 {
7452 if (assocPtArr[j] > leadingPtArr[i])
7453 continue;
7454 }
7455 else
7456 {
7457 Int_t jRef = 1;
7458
7459 if (assocPtArr[jRef] > leadingPtArr[i])
7460 continue;
7461
7462 // fix pt assoc
7463 gpTMin = assocPtArr[jRef] + 0.01;
7464 gpTMax = assocPtArr[jRef+1] - 0.01;
7465
7466 str2.Form("%.1f < p_{T,assoc} < %.1f", gpTMin - 0.01, gpTMax + 0.01);
7467
7468 // use j for centrality
7469 if (j >= nCentralityBins)
7470 continue;
7471
7472 centrBegin = centralityBins[j];
7473 centrEnd = centralityBins[j+1] - 1;
7474 }
7475
7476 SetupRanges(h);
7477 // for HI file do not set range in eta anymore after it was changed to delta eta axis
7478 h->SetEtaRange(0, 0);
7479
7480 SetupRanges(hMixed);
7481 // for HI file do not set range in eta anymore after it was changed to delta eta axis
7482 hMixed->SetEtaRange(0, 0);
7483
7484 TH2* histSame = (TH2*) h->GetUEHist(2)->GetUEHist(6, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, centrBegin, centrEnd, kTRUE);
7485 TH2* histMixed = (TH2*) hMixed->GetUEHist(2)->GetUEHist(6, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, centrBegin, centrEnd, kTRUE);
7486
7487 // rebin
7488 histSame->Rebin2D(2, 2);
7489 histMixed->Rebin2D(2, 2);
7490
7491 if (1)
7492 {
7493 // fit delta eta, assuming no dependence on dphi
7494
7495 //new TCanvas; histMixed->DrawCopy("SURF1");
7496
7497 histMixedproj = histMixed->ProjectionY();
7498 histMixedproj->Scale(1.0 / histMixed->GetNbinsX());
7499
7500 for (Int_t x=1; x<=histMixed->GetNbinsX(); x++)
7501 for (Int_t y=1; y<=histMixed->GetNbinsY(); y++)
7502 histMixed->SetBinContent(x, y, histMixedproj->GetBinContent(y));
7503
7504 //new TCanvas; histMixed->DrawCopy("SURF1");
7505 }
7506
7507 histSame->SetStats(0);
7508 histSame->GetYaxis()->SetRangeUser(-1.5, 1.5);
7509 histSame->SetTitle("");
7510 histSame->Divide(histMixed);
7511 histSame->DrawCopy("SURF1");
7512
7513 TString str3;
7514 str3.Form("%d-%d%%", (Int_t) h->GetCentralityDistribution()->GetXaxis()->GetBinLowEdge(centrBegin), (Int_t) h->GetCentralityDistribution()->GetXaxis()->GetBinUpEdge(centrEnd));
7515 latex = new TLatex(0.15, 0.95, str3);
7516 latex->SetNDC();
7517 latex->SetTextSize(0.08);
7518 latex->Draw();
7519 }
7520
7521 latex = new TLatex(0.55, 0.8, str);
7522 latex->SetNDC();
7523 latex->SetTextSize(0.06);
7524 latex->Draw();
7525
7526 latex = new TLatex(0.55, 0.88, str2);
7527 latex->SetNDC();
7528 latex->SetTextSize(0.06);
7529 latex->Draw();
7530
7531// if (i == 0) return;
7532 }
7533
7534 canvas->SaveAs(Form("DeltaPhi_%.2f.png", yMax));
7535
7536 canvas2->cd();
7537 legend2->Draw();
7538
7539 //TString name;
7540 //name.Form("%s_%.2f_%.2f_%.2f_%.2f.png", TString(gSystem->BaseName(fileName1)).Tokenize(".")->First()->GetName(), leadingPtArr[i], leadingPtArr[i+1], assocPtArr[j], assocPtArr[j+1]);
7541}
7542
7543void ExamplePhiEtaGap(const char* fileNamePbPb, const char* fileNamePbPbMix)
7544{
7545 loadlibs();
7546
7547 if (!fileNamePbPbMix)
7548 fileNamePbPbMix = fileNamePbPb;
7549
7550 Int_t leadingPtOffset = 1;
7551
7552 Int_t maxLeadingPt = 4;
7553 Int_t maxAssocPt = 5;
7554 Float_t leadingPtArr[] = { 2.0, 3.0, 6.0, 6.0, 8.0, 10.0, 15.0, 20.0 };
7555 Float_t assocPtArr[] = { 0.15, 0.5, 1.0, 2.0, 3.0, 4.0, 6.0, 8.0, 10.0, 12.0 };
7556 leadingPtOffset = 1;
7557
7558 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileNamePbPb);
7559 hMixed = (AliUEHistograms*) GetUEHistogram(fileNamePbPbMix, 0, kTRUE);
7560
7561 Int_t i=1;
7562 Int_t j=2;
7563
7564 gpTMin = assocPtArr[j] + 0.01;
7565 gpTMax = assocPtArr[j+1] - 0.01;
7566
7567 SetupRanges(h);
7568 SetupRanges(hMixed);
7569
7570 if (assocPtArr[j] >= leadingPtArr[i+leadingPtOffset])
7571 continue;
7572
7573 TString hist1Str, hist2Str, hist2bStr;
7574
7575 Int_t step = 6;
7576 TH1* hist1 = 0;
7577 TH1* hist2 = 0;
7578 TH1* hist3 = 0;
7579
7580 Float_t v2[3];
7581
7582 Bool_t equivMixedBin = kTRUE;
7583
7584 Int_t centralityBegin = 20;
7585 Int_t centralityEnd = 30;
7586
7587 GetDistAndFlow(h, hMixed, &hist1, 0, step, centralityBegin, centralityEnd, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 20, equivMixedBin);
7588
7589 GetDistAndFlow(h, hMixed, &hist2, 0, step, centralityBegin, centralityEnd, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 10, equivMixedBin);
7590// hist2->Scale(1.0 / 0.8);
7591
7592 GetDistAndFlow(h, hMixed, &hist3, 0, step, centralityBegin, centralityEnd, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 11, equivMixedBin);
7593 hist3->Scale(1.0 / 0.8);
7594
7595 hist1->Draw();
7596 hist2->SetLineColor(2);
7597 hist2->Draw("SAME");
7598 hist3->SetLineColor(4);
7599 hist3->Draw("SAME");
7600}
7601
7602void ExampleDEtaDPhi(const char* fileNamePbPb, const char* fileNamePbPbMix)
7603{
7604 loadlibs();
7605
7606 if (!fileNamePbPbMix)
7607 fileNamePbPbMix = fileNamePbPb;
7608
7609 Int_t leadingPtOffset = 1;
7610
7611 Int_t maxLeadingPt = 4;
7612 Int_t maxAssocPt = 5;
7613 Float_t leadingPtArr[] = { 1.0, 2.0, 3.0, 6.0, 6.0, 8.0, 10.0, 15.0, 20.0 };
7614 Float_t assocPtArr[] = { 0.15, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 8.0, 10.0, 12.0 };
7615 leadingPtOffset = 1;
7616
7617 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileNamePbPb);
7618 hMixed = (AliUEHistograms*) GetUEHistogram(fileNamePbPbMix, 0, kTRUE);
7619
7620 Int_t i=1;
7621 Int_t j=3;
7622
7623 gpTMin = assocPtArr[j] + 0.01;
7624 gpTMax = assocPtArr[j+1] - 0.01;
7625
7626 SetupRanges(h);
7627 SetupRanges(hMixed);
7628
7629 Int_t step = 6;
7630 TH1* hist1 = 0;
7631
7632 GetSumOfRatios(h, hMixed, &hist1, step, 0, 5, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7633
7634 hist1->Draw("SURF1");
7635}
7636
7637Double_t GetEtaCut(TTree* analysisSettings)
7638{
7639 Double_t etaCut = 0;
7640 if (analysisSettings)
7641 {
7642 analysisSettings->GetBranch("fTrackEtaCut")->SetAddress(&etaCut);
7643 analysisSettings->GetEntry(0);
7644 }
7645 return etaCut;
7646}
7647
7648void PlotDeltaPhiEtaGap(const char* fileNamePbPb, const char* fileNamePbPbMix = 0, const char* fileNamepp = 0, const char* fileNamepp2 = 0, const char* outputFile = "dphi_corr.root")
7649{
7650 loadlibs();
7651
7652 if (!fileNamePbPbMix)
7653 fileNamePbPbMix = fileNamePbPb;
7654
7655 file = TFile::Open(outputFile, "RECREATE");
7656 file->Close();
7657
7658 Int_t leadingPtOffset = 1;
7659
7660 Bool_t symmetrizePt = kFALSE;
7661 Int_t maxLeadingPt = 4;
7662 Int_t maxAssocPt = 7;
7663 if (0)
7664 {
7665 //PbPb, NS peak shapes
7666// Float_t leadingPtArr[] = { 2.0, 3.0, 4.0, 6.0, 8.0, 10.0, 15.0, 20.0 };
7667 Float_t leadingPtArr[] = { 2.0, 3.0, 4.0, 8.0, 15.0, 20.0 };
7668 Float_t assocPtArr[] = { 0.15, 0.5, 1.0, 2.0, 3.0, 4.0, 6.0, 8.0, 10.0, 12.0 };
7669 }
7670 else if (1)
7671 {
7672 //Example for the Hadrons_Example wagon
7673 maxLeadingPt = 3;
7674 maxAssocPt = 6;
7675 Float_t leadingPtArr[] = { 3.0, 5.0, 8.0, 16.0 };
7676 Float_t assocPtArr[] = {0.15, 0.3, 50.0, 0.5, 50.0, 1.0, 50.0 };
7677 }
7678 else if (0)
7679 {
7680 //pA, trigger from all pT
7681 maxLeadingPt = 1;
7682 maxAssocPt = 10;
7683 Float_t leadingPtArr[] = { 0.5, 4.0 };
7684 Float_t assocPtArr[] = { 0.15, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 0.5, 4.0 };
7685// symmetrizePt = kTRUE;
7686 }
7687 else if (0)
7688 {
7689 //pA, associated from all pT
7690 maxLeadingPt = 6;
7691 maxAssocPt = 2;
7692 Float_t leadingPtArr[] = { 0.5, 1.0, 2.0, 3.0, 4.0, 0.5, 4.0 };
7693 Float_t assocPtArr[] = { 0.15, 0.5, 4.0 };
7694// symmetrizePt = kTRUE;
7695 }
7696 else if (0)
7697 {
7698 //pA
7699 maxLeadingPt = 5;
7700 maxAssocPt = 6;
7701 Float_t leadingPtArr[] = { 0.5, 1.0, 1.5, 2.0, 2.5, 4.0, 8.0, 15.0, 20.0 };
7702 Float_t assocPtArr[] = { 0.15, 0.5, 1.0, 1.5, 2.0, 2.5, 4.0, 8.0, 10.0, 12.0 };
7703 }
7704 else if (1)
7705 {
7706 //pA, fine
7707 maxLeadingPt = 6;
7708 maxAssocPt = 7;
7709 Float_t leadingPtArr[] = { 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 0.5, 4.0, 20.0 };
7710 Float_t assocPtArr[] = { 0.15, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 0.5, 4.0, 12.0 };
7711 }
7712 else if (0)
7713 {
7714 //pA, v3
7715 maxLeadingPt = 3;
7716 maxAssocPt = 4;
7717 Float_t leadingPtArr[] = { 0.5, 1.5, 2.5, 4.0, 5.0, 8.0, 15.0, 20.0 };
7718 Float_t assocPtArr[] = { 0.15, 0.5, 1.5, 2.5, 4.0, 5.0, 8.0, 10.0, 12.0 };
7719 }
7720 else if (0)
7721 {
7722 //pA 2012; MC validation (also PbPb)
7723 maxLeadingPt = 3;
7724 maxAssocPt = 4;
7725 Float_t leadingPtArr[] = { 0.5, 1.0, 2.0, 4.0, 8.0, 15.0, 20.0 };
7726 Float_t assocPtArr[] = { 0.15, 0.5, 1.0, 2.0, 4.0, 8.0, 10.0, 12.0 };
7727 }
7728 else if (0)
7729 {
7730 // pA, CMS ridge comparison
7731 maxLeadingPt = 4;
7732 maxAssocPt = 5;
7733 Float_t leadingPtArr[] = { 0.5, 1.0, 2.0, 3.0, 4.0, 8.0, 15.0, 20.0 };
7734 Float_t assocPtArr[] = { 0.15, 0.5, 1.0, 2.0, 3.0, 4.0, 6.0, 8.0, 10.0, 12.0 };
7735 }
7736 else if (0)
7737 {
7738 maxLeadingPt = 1;
7739 maxAssocPt = 3;
7740 Float_t leadingPtArr[] = { 2.0, 3.0};
7741 Float_t assocPtArr[] = {0.15, 0.5, 1.0, 2.0};
7742 }
7743 else if (0) //Comparison to STAR (p_T,t)
7744 {
7745 maxLeadingPt = 4;
7746 maxAssocPt = 3;
7747 Float_t leadingPtArr[] = { 2.0, 3.0, 4.0, 5.0, 6.0};
7748 Float_t assocPtArr[] = {0.15, 0.5, 1.5, 6.0};
7749 }
7750 else if (0) //Comparison to STAR (p_T,a)
7751 {
7752 maxLeadingPt = 1;
7753 maxAssocPt = 6;
7754 Float_t leadingPtArr[] = { 3.0, 6.0};
7755 Float_t assocPtArr[] = {0.15, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0};
7756 }
7757 else if (0)
7758 {
7759 maxLeadingPt = 4;
7760 maxAssocPt = 4;
7761 Float_t leadingPtArr[] = { 2.0, 3.0, 4.0, 8.0, 15.0 };
7762 Float_t assocPtArr[] = {0.15, 0.5, 1.0, 1.5, 2.0};
7763 }
7764
7765 TList* list = 0;
7766 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileNamePbPb, &list);
7767 hMixed = (AliUEHistograms*) GetUEHistogram(fileNamePbPbMix, 0, kTRUE);
7768// hMixed3 = (AliUEHistograms*) hMixed->Clone();
7769
7770 if (symmetrizePt)
7771 {
7772 h->GetUEHist(2)->SymmetrizepTBins();
7773 hMixed->GetUEHist(2)->SymmetrizepTBins();
7774 }
7775
7776 TList* list2 = 0;
7777 AliUEHistograms* h2 = 0;
7778 AliUEHistograms* hMixed2 = 0;
7779 if (fileNamepp)
7780 {
7781 h2 = (AliUEHistograms*) GetUEHistogram(fileNamepp, &list2);
7782 hMixed2 = (AliUEHistograms*) GetUEHistogram(fileNamepp, 0, kTRUE);
7783 }
7784
7785 TList* list3 = 0;
7786 AliUEHistograms* h3 = 0;
7787 AliUEHistograms* hMixed3 = 0;
7788 if (fileNamepp2)
7789 {
7790 h3 = (AliUEHistograms*) GetUEHistogram(fileNamepp2, &list3);
7791 hMixed3 = (AliUEHistograms*) GetUEHistogram(fileNamepp2, 0, kTRUE);
7792 }
7793
7794// h->GetUEHist(2)->SetGetMultCache();
7795// hMixed->GetUEHist(2)->SetGetMultCache();
7796
7797 TH2* refMultRaw = (TH2*) list->FindObject("referenceMultiplicity");
7798 if (refMultRaw)
7799 {
7800// new TCanvas; refMultRaw->Draw("COLZ");
7801 Int_t nCentrBins = 4;
7802 Double_t centrBins[] = { 0., 20., 40., 60., 100. };
7803// Double_t centrBins[] = { 0., 3., 10., 50., 100. };
7804 TH1* refMult = new TH1F("refMult", ";centrality;<Nch>", nCentrBins, centrBins);
7805 for (Int_t i=0; i<nCentrBins; i++)
7806 {
7807 TH1* proj = refMultRaw->ProjectionY(Form("proj%d", i), refMultRaw->GetXaxis()->FindBin(centrBins[i] + 0.1), refMultRaw->GetXaxis()->FindBin(centrBins[i+1] - 0.1));
7808// new TCanvas; proj->DrawClone();
7809 refMult->SetBinContent(refMult->GetXaxis()->FindBin(centrBins[i] + 0.1), proj->GetMean());
7810 refMult->SetBinError(refMult->GetXaxis()->FindBin(centrBins[i] + 0.1), proj->GetMeanError());
7811 Printf("Ref multiplicity for centrality %f to %f: %f", centrBins[i], centrBins[i+1], proj->GetMean());
7812 }
7813// new TCanvas; refMult->Draw();
7814 file = TFile::Open(outputFile, "UPDATE");
7815 refMult->Write();
7816 file->Close();
7817// return;
7818 }
7819
7820 tree = (TTree*) list->FindObject("UEAnalysisSettings");
7821 Double_t etaCut = GetEtaCut(tree);
7822 Printf("Setting eta cut to %f", etaCut);
7823 h->SetTrackEtaCut(etaCut);
7824
7825 if (list2)
7826 {
7827 tree = (TTree*) list2->FindObject("UEAnalysisSettings");
7828 if (tree)
7829 {
7830 Double_t etaCut = GetEtaCut(tree);
7831 Printf("Setting eta cut to %f", etaCut);
7832 h2->SetTrackEtaCut(etaCut);
7833 }
7834 else
7835 {
7836 Double_t etaCut = 0.9;
7837 Printf("WARNING: Setting eta cut to %f without checking", etaCut);
7838 h2->SetTrackEtaCut(etaCut);
7839 }
7840 }
7841
7842 if (list3)
7843 {
7844 tree = (TTree*) list3->FindObject("UEAnalysisSettings");
7845 if (tree)
7846 {
7847 Double_t etaCut = GetEtaCut(tree);
7848 Printf("Setting eta cut to %f", etaCut);
7849 h3->SetTrackEtaCut(etaCut);
7850 }
7851 else
7852 {
7853 Double_t etaCut = 0.9;
7854 Printf("WARNING: Setting eta cut to %f without checking", etaCut);
7855 h3->SetTrackEtaCut(etaCut);
7856 }
7857 }
7858
7859 // return;
7860
7861 if (0)
7862 {
7863 h->SetZVtxRange(-0.99, 0.99);
7864 hMixed->SetZVtxRange(-0.99, 0.99);
7865 h2->SetZVtxRange(-0.99, 0.99);
7866 hMixed2->SetZVtxRange(-0.99, 0.99);
7867 }
7868
7869 for (Int_t i=0; i<maxLeadingPt; i++)
7870 for (Int_t j=1; j<maxAssocPt; j++)
7871 {
7872 if(0){
7873 if(j!=(i+1))continue;
7874 Printf("\nOnly symmetric pt bins selected, leading pt: %f - %f associated pt: %f - %f",leadingPtArr[i],leadingPtArr[i+leadingPtOffset],assocPtArr[j],assocPtArr[j+1]);
7875 }
7876
7877 gpTMin = assocPtArr[j] + 0.01;
7878 gpTMax = assocPtArr[j+1] - 0.01;
7879
7880 if(gpTMin >= gpTMax)continue;
7881
7882 SetupRanges(h);
7883 SetupRanges(hMixed);
7884 SetupRanges(h2);
7885 SetupRanges(hMixed2);
7886 SetupRanges(h3);
7887 SetupRanges(hMixed3);
7888// SetupRanges(hMixed3);
7889
7890 if(0)if (assocPtArr[j] >= leadingPtArr[i+leadingPtOffset])
7891 continue;
7892
7893 TH1* hist1 = 0;
7894 TH1* hist2 = 0;
7895 TH1* hist3 = 0;
7896 TH1* hist4 = 0;
7897 TH1* hist5 = 0;
7898 TH1* hist6 = 0;
7899 TH1* hist7 = 0;
7900 TH1* hist8 = 0;
7901
7902 Bool_t equivMixedBin = 1; //kFALSE; // TODO ?
7903 Bool_t scaleToPairs = kTRUE;
7904
7905 Int_t histType = 1;
7906
7907 if (0)
7908 {
7909 // PbPb
7910 Int_t step = 8;
7911
7912 GetSumOfRatios(h, hMixed, &hist1, step, 0, 10, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7913// new TCanvas; hist1->DrawClone("SURF1");
7914// return;
7915
7916/* GetDistAndFlow(h, hMixed, &hist2, 0, step, 0, 10, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
7917 new TCanvas; hist2->DrawClone("SURF1");
7918
7919 hist1->Divide(hist2);
7920 new TCanvas; hist1->DrawClone("SURF1");
7921
7922 return;*/
7923
7924// new TCanvas; hist1->Draw("SURF1"); return;
7925
7926 GetSumOfRatios(h, hMixed, &hist5, step, 10, 20, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7927 GetSumOfRatios(h, hMixed, &hist4, step, 20, 40, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7928 GetSumOfRatios(h, hMixed, &hist6, step, 40, 60, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7929 GetSumOfRatios(h, hMixed, &hist2, step, 60, 70, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7930 step = 8;
7931 if (h2)
7932 GetSumOfRatios(h2, hMixed2, &hist3, step, 0, -1, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7933// new TCanvas; hist3->Draw("SURF1"); return;
7934 }
7935 else if (0)
7936 {
7937 // pA, fine binning
7938 Int_t step = 8;
7939// Int_t step = 0;
7940
7941 GetSumOfRatios(h, hMixed, &hist1, step, 0, 20, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7942 GetSumOfRatios(h, hMixed, &hist2, step, 20, 40, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7943 GetSumOfRatios(h, hMixed, &hist4, step, 40, 60, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7944 GetSumOfRatios(h, hMixed, &hist5, step, 60, 100, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7945// GetSumOfRatios(h, hMixed, &hist7, step, 70, 100, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7946// GetSumOfRatios(h, hMixed, &hist8, step, 80, 100, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7947
7948 if (h2)
7949 GetSumOfRatios(h2, hMixed2, &hist3, step, 0, -1, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7950
7951 if (h3)
7952 GetSumOfRatios(h3, hMixed3, &hist6, step, 0, -1, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7953 }
7954 else if (1)
7955 {
7956 // pp, MB
7957 Int_t step = 8;
7958 GetSumOfRatios(h, hMixed, &hist1, step, 0, 100, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE, kTRUE);
7959 }
7960 else if (0)
7961 {
7962 // pp
7963 Int_t step = 8;
7964
7965 GetSumOfRatios(h, hMixed, &hist1, step, 4, 4, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE, kTRUE);
7966 GetSumOfRatios(h, hMixed, &hist2, step, 3, 3, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE, kTRUE);
7967 GetSumOfRatios(h, hMixed, &hist4, step, 2, 2, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE, kTRUE);
7968 GetSumOfRatios(h, hMixed, &hist5, step, 1, 1, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE, kTRUE);
7969 }
7970 else if (0)
7971 {
7972 // pA, course binning
7973 Int_t step = 8;
7974
7975 GetSumOfRatios(h, hMixed, &hist1, step, 0, 100, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7976 GetSumOfRatios(h, hMixed, &hist2, step, 0, 40, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7977 GetSumOfRatios(h, hMixed, &hist4, step, 40, 100, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7978
7979 GetDistAndFlow(h, hMixed, &hist5, 0, step, 0, 100, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
7980
7981 GetSumOfRatios(h2, hMixed2, &hist3, step, 0, -1, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7982 }
7983 else if (0)
7984 {
7985 // pA, CMS ridge paper comparison
7986 Int_t step = 8;
7987
7988 GetSumOfRatios(h, hMixed, &hist1, step, 0, 3, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7989 GetSumOfRatios(h, hMixed, &hist2, step, 3, 10, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7990 GetSumOfRatios(h, hMixed, &hist4, step, 10, 50, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7991 GetSumOfRatios(h, hMixed, &hist5, step, 50, 100, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7992 GetSumOfRatios(h, hMixed, &hist7, step, 80, 100, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7993 }
7994 else if (0)
7995 {
7996 // pA, MC, validation binning
7997 GetSumOfRatios(h, hMixed, &hist1, 0, 0, 80, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7998 GetSumOfRatios(h, hMixed, &hist5, 10, 0, 80, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
7999 }
8000 else if (0)
8001 {
8002 // pA, MC, validation binning
8003 GetSumOfRatios(h, hMixed, &hist1, 0, 0, 20, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
8004 GetSumOfRatios(h, hMixed, &hist2, 0, 20, 40, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
8005 GetSumOfRatios(h, hMixed, &hist3, 0, 40, 60, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
8006 GetSumOfRatios(h, hMixed, &hist4, 0, 60, 100, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
8007 GetSumOfRatios(h, hMixed, &hist5, 10, 0, 20, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
8008 GetSumOfRatios(h, hMixed, &hist6, 10, 20, 40, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
8009 GetSumOfRatios(h, hMixed, &hist7, 10, 40, 60, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
8010 GetSumOfRatios(h, hMixed, &hist8, 10, 60, 100, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
8011 }
8012 else if (1)
8013 {
8014 // pA, MC, validation binning, without vertex axis
8015 GetDistAndFlow(h, hMixed, &hist1, 0, 0, 0, 20, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8016 GetDistAndFlow(h, hMixed, &hist2, 0, 0, 20, 40, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8017 GetDistAndFlow(h, hMixed, &hist3, 0, 0, 40, 60, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8018 GetDistAndFlow(h, hMixed, &hist4, 0, 0, 60, 100, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8019 GetDistAndFlow(h, hMixed, &hist5, 0, 10, 0, 20, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8020 GetDistAndFlow(h, hMixed, &hist6, 0, 10, 20, 40, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8021 GetDistAndFlow(h, hMixed, &hist7, 0, 10, 40, 60, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8022 GetDistAndFlow(h, hMixed, &hist8, 0, 10, 60, 100, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8023 }
8024 else if (1)
8025 {
8026 Int_t step = 0;
8027
8028 Printf(">>>>>>>> Not using GetSumOfRatios!!!");
8029 GetDistAndFlow(h, hMixed, &hist1, 0, step, 0, 10, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8030// Printf("integral: %f", ((TH2*) hist1)->Integral(1, 36, 5, 36));
8031// return;
8032
8033 GetDistAndFlow(h, hMixed, &hist5, 0, step, 10, 20, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8034 GetDistAndFlow(h, hMixed, &hist4, 0, step, 20, 40, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8035 GetDistAndFlow(h, hMixed, &hist6, 0, step, 40, 60, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8036 GetDistAndFlow(h, hMixed, &hist2, 0, step, 60, 80, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8037// step = 6;
8038 GetDistAndFlow(h2, hMixed2, &hist3, 0, step, 0, -1, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8039// new TCanvas; hist3->DrawClone("SURF1");
8040// GetDistAndFlow(hMixed2, 0, &hist3, 0, step, 0, -1, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8041// new TCanvas; hist3->DrawClone("SURF1");
8042// Printf("integral: %f", ((TH2*) hist3)->Integral(1, 36, 5, 36));
8043// return;
8044
8045 //MC closure test in pA and PbPb with PID
8046 // GetDistAndFlow(h, hMixed, &hist1, 0, step, 0, 20, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8047 // GetDistAndFlow(h, hMixed, &hist2, 0, step, 20, 40, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8048 // GetDistAndFlow(h, hMixed, &hist4, 0, step, 40, 60, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8049 // GetDistAndFlow(h, hMixed, &hist5, 0, step, 60, 100, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8050 // GetDistAndFlow(h, hMixed, &hist7, 0, step, 80, 100, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8051 // GetDistAndFlow(h, hMixed, &hist8, 0, step, 0, 100, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, histType, equivMixedBin, 0, scaleToPairs);
8052 }
8053 else if (0)
8054 {
8055 Int_t step = 8;
8056
8057 GetSumOfRatios(h, hMixed, &hist1, step, 60, 70, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
8058 GetSumOfRatios(h, hMixed, &hist2, step, 70, 80, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
8059 GetSumOfRatios(h, hMixed, &hist3, step, 80, 90, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
8060 }
8061 else if (1)
8062 {
8063 Int_t step = 8;
8064
8065 GetSumOfRatios(h, hMixed, &hist1, step, 0, 1, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
8066 GetSumOfRatios(h, hMixed, &hist2, step, 1, 3, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
8067 GetSumOfRatios(h, hMixed, &hist4, step, 3, 5, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
8068 GetSumOfRatios(h, hMixed, &hist5, step, 5, 10, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
8069 GetSumOfRatios(h, hMixed, &hist6, step, 10, 20, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kTRUE);
8070 }
8071
8072 file = TFile::Open(outputFile, "UPDATE");
8073
8074 if (hist1)
8075 {
8076 hist1->SetName(Form("dphi_%d_%d_%d", i, j, 0));
8077 hist1->Write();
8078 }
8079
8080 if (hist2)
8081 {
8082 hist2->SetName(Form("dphi_%d_%d_%d", i, j, 1));
8083 hist2->Write();
8084 }
8085
8086 if (hist4)
8087 {
8088 hist4->SetName(Form("dphi_%d_%d_%d", i, j, 3));
8089 hist4->Write();
8090 }
8091
8092 if (hist5)
8093 {
8094 hist5->SetName(Form("dphi_%d_%d_%d", i, j, 4));
8095 hist5->Write();
8096 }
8097
8098 if (hist7)
8099 {
8100 hist7->SetName(Form("dphi_%d_%d_%d", i, j, 6));
8101 hist7->Write();
8102 }
8103
8104 if (hist8)
8105 {
8106 hist8->SetName(Form("dphi_%d_%d_%d", i, j, 7));
8107 hist8->Write();
8108 }
8109
8110 if (hist6)
8111 {
8112 hist6->SetName(Form("dphi_%d_%d_%d", i, j, 5));
8113 TString title(hist6->GetTitle());
8114 title.ReplaceAll("0--1%", "pp");
8115 hist6->SetTitle(title);
8116 hist6->Write();
8117 }
8118
8119 if (hist3)
8120 {
8121 hist3->SetName(Form("dphi_%d_%d_%d", i, j, 2));
8122 TString title(hist3->GetTitle());
8123 title.ReplaceAll("0--1%", "pp");
8124 hist3->SetTitle(title);
8125 hist3->Write();
8126 }
8127
8128 file->Close();
8129
8130 delete hist1;
8131 delete hist2;
8132 delete hist3;
8133 delete hist4;
8134 delete hist5;
8135 delete hist6;
8136 delete hist7;
8137 delete hist8;
8138
8139// return;
8140 }
8141
8142 delete h;
8143 delete hMixed;
8144}
8145
8146void ExtractMiniJetHistograms(const char* fileNamePbPb, Bool_t useMixed = kTRUE, const char* outputFile = "dphi_corr.root")
8147{
8148 loadlibs();
8149
8150 file = TFile::Open(outputFile, "RECREATE");
8151 file->Close();
8152
8153 Int_t leadingPtOffset = 1;
8154
8155 if (1)
8156 {
8157 // minijets
8158 Int_t maxLeadingPt = 1;
8159 Int_t maxAssocPt = 1;
8160 Float_t leadingPtArr[] = { 0.7, 5.0 };
8161 Float_t assocPtArr[] = { 0.7, 5.0 };
8162 }
8163
8164 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileNamePbPb);
8165 hMixed = (AliUEHistograms*) GetUEHistogram(fileNamePbPb, 0, kTRUE);
8166
8167 Int_t step = 8;
8168
8169 for (Int_t i=0; i<maxLeadingPt; i++)
8170 {
8171 for (Int_t j=0; j<maxAssocPt; j++)
8172 {
8173// i = 3; j = 6;
8174
8175 gpTMin = assocPtArr[j] + 0.01;
8176 gpTMax = assocPtArr[j+1] - 0.01;
8177
8178 SetupRanges(h);
8179 SetupRanges(hMixed);
8180
8181 if (assocPtArr[j] >= leadingPtArr[i+leadingPtOffset])
8182 continue;
8183
8184 if (1)
8185 {
8186 // pA, minijets, very fine binning
8187
8188 for (Int_t centr=0; centr<20; centr++)
8189 {
8190 TH1* hist1 = 0;
8191 if (useMixed)
8192 GetSumOfRatios(h, hMixed, &hist1, step, 5*centr, 5*centr+5, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, kFALSE);
8193 else
8194 GetDistAndFlow(h, 0, &hist1, 0, step, 5*centr, 5*centr+5, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, 1, 1, 0, kTRUE);
8195
8196 if (!hist1)
8197 continue;
8198
8199 file = TFile::Open(outputFile, "UPDATE");
8200 hist1->SetName(Form("dphi_%d_%d_%d", i, j, centr));
8201 hist1->Write();
8202 file->Close();
8203
8204 delete hist1;
8205 }
8206 }
8207 }
8208
8209 TH1* triggers = h->GetUEHist(2)->GetTriggersAsFunctionOfMultiplicity(step, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01);
8210 triggers->SetName(Form("triggers_%d", i));
8211 TString str;
8212 str.Form("%.1f < p_{T,trig} < %.1f", leadingPtArr[i], leadingPtArr[i+leadingPtOffset]);
8213 triggers->SetTitle(str);
8214
8215 file = TFile::Open(outputFile, "UPDATE");
8216 triggers->Write();
8217 file->Close();
8218 }
8219
8220 TH1* events = h->GetEventCount()->ProjectionY("events", h->GetEventCount()->GetXaxis()->FindBin(step), h->GetEventCount()->GetXaxis()->FindBin(step));
8221 file = TFile::Open(outputFile, "UPDATE");
8222 events->Write("events");
8223 file->Close();
8224}
8225
8226TLatex* DrawLatex(Float_t x, Float_t y, Int_t color, const char* text, Float_t fontSize = 0.06)
8227{
8228 latex = new TLatex(x, y, text);
8229 latex->SetNDC();
8230 latex->SetTextSize(fontSize);
8231 latex->SetTextColor(color);
8232 latex->Draw();
8233 return latex;
8234}
8235
8236void DrawChi2NDF(TF1* func, TH1* hist, Float_t x, Float_t y, Int_t color = 1)
8237{
8238 Float_t chi2 = 0;
8239 Int_t ndf = 0;
8240 for (Int_t i=hist->GetXaxis()->FindBin(-0.8); i<=hist->GetXaxis()->FindBin(0.8); i++)
8241 {
8242 chi2 += TMath::Power((hist->GetBinContent(i) - func->Integral(hist->GetXaxis()->GetBinLowEdge(i), hist->GetXaxis()->GetBinUpEdge(i)) / (hist->GetXaxis()->GetBinUpEdge(i) - hist->GetXaxis()->GetBinLowEdge(i))) / hist->GetBinError(i), 2);
8243 ndf++;
8244 }
8245 ndf -= func->GetNumberFreeParameters();
8246
8247 printf("#chi^{2}/ndf = %.1f/%d = %.1f ", func->GetChisquare(), func->GetNDF(), func->GetChisquare() / func->GetNDF());
8248 Printf("#chi^{2}/ndf = %.1f/%d = %.1f", chi2, ndf, chi2 / ndf);
8249
8250 DrawLatex(x, y, color, Form("#chi^{2}/ndf = %.1f/%d = %.1f", func->GetChisquare(), func->GetNDF(), func->GetChisquare() / func->GetNDF()));
8251 DrawLatex(x, y - 0.05, color, Form("#chi^{2}/ndf = %.1f/%d = %.1f", chi2, ndf, chi2 / ndf));
8252}
8253
8254void FitDeltaPhiEtaGap(TH1* hist, Int_t color, TGraphErrors* graph, Float_t x, Float_t yPosChi2)
8255{
8256 hist->SetLineColor(color);
8257 hist->DrawCopy("SAME");
8258
8259 Bool_t twoGauss = kFALSE;
8260
8261 if (!twoGauss)
8262 func = new TF1("func", "[0]+gaus(1)");
8263 else
8264 {
8265 func = new TF1("func", "[0]+gaus(1)+gaus(4)");
8266 func->FixParameter(5, 0);
8267 func->SetParLimits(3, 0.1, 10);
8268 func->SetParLimits(6, 0.1, 10);
8269 func->SetParLimits(1, 0, 10);
8270 func->SetParLimits(4, 0, 10);
8271 }
8272
8273 func->SetParameters(0, 1, 0, 0.3, 1, 0, 1);
8274 func->FixParameter(2, 0);
8275 func->SetLineColor(color);
8276
8277 hist->Fit(func, "", "SAME");
8278// hist->Fit(func, "IM", "SAME");
8279
8280 if (twoGauss)
8281 {
8282 func2 = new TF1("func2", "[0]+gaus(1)", -1.5, 4.5);
8283 func2->SetParameters(func->GetParameter(0), func->GetParameter(1), func->GetParameter(2), func->GetParameter(3));
8284 func2->SetLineColor(color);
8285 func2->SetLineWidth(1);
8286 func2->SetLineStyle(2);
8287 func2->Draw("SAME");
8288
8289 func2 = new TF1("func2", "[0]+gaus(1)", -1.5, 4.5);
8290 func2->SetParameters(func->GetParameter(0), func->GetParameter(4), func->GetParameter(5), func->GetParameter(6));
8291 func2->SetLineColor(color);
8292 func2->SetLineWidth(1);
8293 func2->SetLineStyle(2);
8294 func2->Draw("SAME");
8295 }
8296
8297 if (twoGauss)
8298 {
8299 Bool_t firstIsMin = func->GetParameter(3) < func->GetParameter(6);
8300
8301 Bool_t onlyOne = kFALSE;
8302 if (func->GetParameter(1) / func->GetParameter(4) < 0.1)
8303 {
8304 firstIsMin = kFALSE;
8305 onlyOne = kTRUE;
8306 }
8307 if (func->GetParameter(1) / func->GetParameter(4) > 10)
8308 {
8309 firstIsMin = kTRUE;
8310 onlyOne = kTRUE;
8311 }
8312
8313 graph->SetPoint(graph->GetN(), x - 0.1, func->GetParameter((firstIsMin) ? 3 : 6));
8314 graph->SetPointError(graph->GetN()-1, 0, func->GetParError((firstIsMin) ? 3 : 6));
8315
8316 if (!onlyOne)
8317 {
8318 graph->SetPoint(graph->GetN(), x + 0.1, TMath::Abs(func->GetParameter((!firstIsMin) ? 3 : 6)));
8319 graph->SetPointError(graph->GetN()-1, 0, func->GetParError((!firstIsMin) ? 3 : 6));
8320 }
8321 }
8322 else
8323 {
8324 graph->SetPoint(graph->GetN(), x, TMath::Abs(func->GetParameter(3)));
8325 graph->SetPointError(graph->GetN()-1, 0, func->GetParError(3));
8326 }
8327
8328 DrawChi2NDF(func, hist, 0.5, yPosChi2, color);
8329}
8330
8331void AnalyzeDeltaPhiEtaGap(const char* fileName)
8332{
8333 TFile::Open(fileName);
8334
8335 Int_t maxLeadingPt = 5;
8336 Int_t maxAssocPt = 6;
8337
8338 TCanvas* canvas = new TCanvas("DeltaPhi", "DeltaPhi", 1000, 700);
8339 canvas->Divide(maxAssocPt, maxLeadingPt);
8340
8341 TGraphErrors* width1 = new TGraphErrors;
8342 TGraphErrors* width2 = new TGraphErrors;
8343 TGraphErrors* width3 = new TGraphErrors;
8344
8345 for (Int_t i=0; i<maxLeadingPt; i++)
8346 for (Int_t j=0; j<maxAssocPt; j++)
8347 {
8348 canvas->cd(j+1 + i * maxAssocPt);
8349 gPad->SetLeftMargin(0.15);
8350 gPad->SetBottomMargin(0.2);
8351 gPad->SetTopMargin(0.01);
8352 gPad->SetRightMargin(0.01);
8353
8354 hist1 = (TH1*) gFile->Get(Form("dphi_%d_%d_%d", i, j, 0));
8355 hist2 = (TH1*) gFile->Get(Form("dphi_%d_%d_%d", i, j, 1));
8356 hist3 = (TH1*) gFile->Get(Form("dphi_%d_%d_%d", i, j, 2));
8357
8358 if (!hist1)
8359 continue;
8360
8361 TString tmpStr(hist1->GetTitle());
8362 tmpStr.ReplaceAll(" - ", "#");
8363 tokens = tmpStr.Tokenize("#");
8364 TString str(tokens->At(0)->GetName());
8365 TString str2(tokens->At(1)->GetName());
8366
8367 Prepare1DPlot(hist1);
8368 Prepare1DPlot(hist2);
8369 Prepare1DPlot(hist3);
8370
8371 // remove baseline
8372 hist1->Fit("pol0", "0", "", 1, 4);
8373 if (!hist1->GetFunction("pol0"))
8374 continue;
8375 hist1->GetFunction("pol0")->SetRange(-10, 10);
8376 hist1->Add(hist1->GetFunction("pol0"), -1);
8377
8378 hist3->Fit("pol0", "0", "", 1, 4);
8379 hist3->GetFunction("pol0")->SetRange(-10, 10);
8380 hist3->Add(hist3->GetFunction("pol0"), -1);
8381
8382 Double_t yMin = 0.01;
8383 Double_t yMax = -1;
8384
8385 if (yMax < 0)
8386 {
8387 yMin = TMath::Min(hist1->GetMinimum(), hist2->GetMinimum()) * 0.97;
8388 yMax = TMath::Max(hist1->GetMaximum(), (hist2) ? hist2->GetMaximum() : 0.0) * 1.1;
8389 }
8390
8391// yMin = hist1->GetMinimum() * 0.9;
8392 yMax *= 1.5;
8393
8394 TH2F* dummy = new TH2F("dummy", "", 100, hist1->GetXaxis()->GetBinLowEdge(1), hist1->GetXaxis()->GetBinUpEdge(hist1->GetNbinsX()), 1000, yMin, yMax);
8395 dummy->SetStats(kFALSE);
8396 dummy->SetXTitle(hist1->GetXaxis()->GetTitle());
8397 dummy->SetYTitle(hist1->GetYaxis()->GetTitle());
8398 dummy->SetYTitle("1/N_{trig} dN/d#Delta#phi");
8399 Prepare1DPlot(dummy);
8400
8401 dummy->GetYaxis()->SetTitleOffset(0.8);
8402
8403 dummy->GetXaxis()->SetLabelSize(0.08);
8404 dummy->GetYaxis()->SetLabelSize(0.08);
8405 dummy->GetXaxis()->SetTitleSize(0.08);
8406 dummy->GetYaxis()->SetTitleSize(0.08);
8407 /*
8408 dummy->GetYaxis()->SetTitleOffset(0.8);
8409 */
8410
8411 dummyTmp = dummy->DrawCopy();
8412
8413 // TODO plot yield? baseline problematic?
8414
8415 Float_t xPos = width1->GetN();
8416 xPos = j*7+i;
8417
8418 FitDeltaPhiEtaGap(hist1, 1, width1, xPos, 0.7);
8419 FitDeltaPhiEtaGap(hist2, 4, width2, xPos, 0.5);
8420 FitDeltaPhiEtaGap(hist3, 2, width3, xPos, 0.6);
8421
8422 latex = new TLatex(0.3, 0.8, str);
8423 latex->SetNDC();
8424 latex->SetTextSize(0.06);
8425 latex->Draw();
8426
8427 latex = new TLatex(0.3, 0.88, str2);
8428 latex->SetNDC();
8429 latex->SetTextSize(0.06);
8430 latex->Draw();
8431
8432 DrawLatex(0.8, 0.9, 1, "0-5%");
8433 DrawLatex(0.8, 0.85, 2, "60-90%");
8434 DrawLatex(0.8, 0.8, 4, "pp");
8435
8436// return;
8437// i = 10; j = 10;
8438 }
8439
8440 new TCanvas;
8441 width1->SetMarkerStyle(20);
8442 width1->Draw("AP");
8443
8444 width2->SetMarkerStyle(24);
8445 width2->SetMarkerColor(4);
8446 width2->Draw("P SAME");
8447
8448 width3->SetMarkerStyle(25);
8449 width3->SetMarkerColor(2);
8450 width3->Draw("P SAME");
8451}
8452
8453void CheckWing(const char* fileName)
8454{
8455 TFile::Open(fileName);
8456
8457 Int_t maxLeadingPt = 4;
8458 Int_t maxAssocPt = 5;
8459
8460 TCanvas* canvas = new TCanvas("DeltaPhi", "DeltaPhi", 1000, 700);
8461 canvas->Divide(maxAssocPt-1, maxLeadingPt);
8462
8463 for (Int_t i=0; i<maxLeadingPt; i++)
8464 for (Int_t j=1; j<maxAssocPt; j++)
8465 {
8466 canvas->cd(j + i * (maxAssocPt - 1));
8467 gPad->SetLeftMargin(0.15);
8468 gPad->SetBottomMargin(0.2);
8469// gPad->SetTopMargin(0.01);
8470 gPad->SetRightMargin(0.01);
8471
8472 hist1 = (TH1*) gFile->Get(Form("dphi_%d_%d_%d", i, j+1, 0));
8473
8474 if (!hist1)
8475 continue;
8476
8477// hist1->Draw("COLZ");
8478
8479 Float_t width = 0.25;
8480
8481 proj = ((TH2*) hist1)->ProjectionY(Form("%s_projx", hist1->GetName()), hist1->GetXaxis()->FindBin(TMath::Pi() - width),hist1->GetXaxis()->FindBin(TMath::Pi() + width));
8482
8483 proj->GetXaxis()->SetRangeUser(-1.79, 1.79);
8484 proj->SetStats(kFALSE);
8485 proj->Draw();
8486
8487 proj2 = ((TH2*) hist1)->ProjectionY(Form("%s_proj2x", hist1->GetName()), hist1->GetXaxis()->FindBin(TMath::Pi() / 2 - width),hist1->GetXaxis()->FindBin(TMath::Pi() / 2 + width));
8488
8489 proj2->GetXaxis()->SetRangeUser(-1.79, 1.79);
8490 proj2->SetLineColor(2);
8491 proj2->Draw("SAME");
8492
8493 proj->SetMinimum(0.999 * proj2->GetMinimum());
8494 }
8495}
8496
8497void CheckWing()
8498{
8499 Int_t maxLeadingPt = 3;
8500 Int_t maxAssocPt = 3;
8501
8502 TCanvas* canvas = new TCanvas("DeltaPhi", "DeltaPhi", 1000, 700);
8503 canvas->Divide(maxAssocPt, maxLeadingPt);
8504
8505// const char* fileNames[] = { "dphi_corr_allpt_zcentral_01.root", "dphi_corr_allpt_01.root" };
8506// const char* fileNames[] = { "dphi_corr_allpt_zcentral.root", "dphi_corr_allpt.root" };
8507// const char* fileNames[] = { "dphi_corr_allpt_zcentral.root", "dphi_corr.root" };
8508// const char* fileNames[] = { "dphi_corr_allpt_01_zcentral.root", "dphi_corr_allpt_01_zsumofratios.root" };
8509// const char* fileNames[] = { "dphi_corr_allpt_cfct_01_zcentral.root", "dphi_corr_allpt_cfct_01_zsumofratios.root" };
8510// const char* fileNames[] = { "dphi_corr_2d.root", "dphi_corr.root" };
8511// const char* fileNames[] = { "dphi_corr_2d_01.root", "dphi_corr.root" };
8512// const char* fileNames[] = { "dphi_corr_2d.root", "dphi_corr_2d_vtxzcentral.root" };
8513// const char* fileNames[] = { "dphi_corr_2d_01.root", , "dphi_corr_2d_01centr_zvtxcentral.root" };
8514// const char* fileNames[] = { "dphi_corr_10k.root", "dphi_corr_50k.root" };
8515// const char* fileNames[] = { "wing1.root", "wing2.root" };
8516 const char* fileNames[] = { "dphi_corr_2d_120112.root", "dphi_corr_2d_p2_111105.root" };
8517
8518 for (Int_t i=0; i<maxLeadingPt; i++)
8519 for (Int_t j=0; j<maxAssocPt; j++)
8520 {
8521 canvas->cd(j+1 + i * maxAssocPt);
8522 gPad->SetLeftMargin(0.15);
8523 gPad->SetBottomMargin(0.2);
8524// gPad->SetTopMargin(0.01);
8525 gPad->SetRightMargin(0.01);
8526
8527 TH1* first = 0;
8528 for (Int_t fileId = 0; fileId < 2; fileId++)
8529 {
8530 TFile::Open(fileNames[fileId]);
8531
8532 hist1 = (TH1*) gFile->Get(Form("dphi_%d_%d_%d", i, j, 3));
8533
8534 if (!hist1)
8535 continue;
8536
8537 // hist1->Draw("COLZ");
8538
8539 Float_t width = 0.5;
8540
8541 for (Int_t areaId = 0; areaId < 3; areaId++)
8542 {
8543 Float_t center = TMath::Pi() / 2 * areaId;
8544 proj = ((TH2*) hist1)->ProjectionY(Form("%s_%d_%d_projx", hist1->GetName(), fileId, areaId), hist1->GetXaxis()->FindBin(center - width), hist1->GetXaxis()->FindBin(center + width));
8545 // proj->Rebin(2); proj->Scale(0.5);
8546
8547 proj->GetXaxis()->SetRangeUser(-1.79, 1.79);
8548 proj->SetStats(kFALSE);
8549 proj->SetLineColor(fileId + 1 + areaId * 2);
8550 proj->Draw((fileId == 0 && areaId == 0) ? "" : "SAME");
8551 if (!first)
8552 first = proj;
8553
8554 proj->Scale(1. / 12);
8555
8556 first->SetMinimum(0.999 * TMath::Min(first->GetMinimum() / 0.999, proj->GetMinimum()));
8557 first->SetMaximum(1.001 * TMath::Max(first->GetMaximum() / 1.001, proj->GetMaximum()));
8558 }
8559 }
8560 }
8561}
8562/*
8563void FitDeltaPhiEtaGap2D(TH2* hist, Bool_t scale, TVirtualPad* pad1, TVirtualPad* pad2, TVirtualPad* pad3, TGraphErrors* width1, TGraphErrors* width2, Float_t x, Float_t yPosChi2)
8564{
8565 Float_t etaLimit = 1.0;
8566 Float_t outerLimit = 1.8;
8567
8568 TString histName(hist->GetName());
8569
8570 TH1D* etaGap = hist->ProjectionX(histName + "_1", TMath::Max(1, hist->GetYaxis()->FindBin(-outerLimit + 0.01)), hist->GetYaxis()->FindBin(-etaLimit - 0.01));
8571 Int_t etaBins = hist->GetYaxis()->FindBin(-etaLimit - 0.01) - TMath::Max(1, hist->GetYaxis()->FindBin(-outerLimit + 0.01)) + 1;
8572
8573 TH1D* tracksTmp = hist->ProjectionX(histName + "_2", hist->GetYaxis()->FindBin(etaLimit + 0.01), TMath::Min(hist->GetYaxis()->GetNbins(), hist->GetYaxis()->FindBin(outerLimit - 0.01)));
8574 etaBins += TMath::Min(hist->GetYaxis()->GetNbins(), hist->GetYaxis()->FindBin(outerLimit - 0.01)) - hist->GetYaxis()->FindBin(etaLimit + 0.01) + 1;
8575
8576 etaGap->Add(tracksTmp);
8577
8578 // get per bin result
8579 etaGap->Scale(1.0 / etaBins);
8580
8581// new TCanvas; etaGap->DrawCopy();
8582
8583 histTmp2D = (TH2*) hist->Clone("histTmp2D");
8584 histTmp2D->Reset();
8585
8586 for (Int_t xbin=1; xbin<=histTmp2D->GetNbinsX(); xbin++)
8587 for (Int_t y=1; y<=histTmp2D->GetNbinsY(); y++)
8588 histTmp2D->SetBinContent(xbin, y, etaGap->GetBinContent(xbin));
8589
8590 if (scale)
8591 {
8592 // mixed event does not reproduce away-side perfectly
8593 // --> extract scaling factor on the away-side from ratios of eta gap and central region
8594 TH1D* centralRegion = hist->ProjectionX(histName + "_3", hist->GetYaxis()->FindBin(-etaLimit + 0.01), hist->GetYaxis()->FindBin(etaLimit - 0.01));
8595 etaBins = hist->GetYaxis()->FindBin(etaLimit - 0.01) - hist->GetYaxis()->FindBin(-etaLimit + 0.01) + 1;
8596 centralRegion->Scale(1.0 / etaBins);
8597
8598// new TCanvas; centralRegion->DrawCopy(); etaGap->SetLineColor(2); etaGap->DrawCopy("SAME");
8599 centralRegion->Divide(etaGap);
8600// new TCanvas; centralRegion->Draw();
8601 centralRegion->Fit("pol0", "0", "", TMath::Pi() - 1, TMath::Pi() + 1);
8602 Float_t scalingFactor = centralRegion->GetFunction("pol0")->GetParameter(0);
8603 Printf(" scalingFactor = %f", scalingFactor);
8604 histTmp2D->Scale(scalingFactor);
8605 }
8606
8607// new TCanvas; hist->DrawCopy("SURF1");
8608
8609 hist->Add(histTmp2D, -1);
8610
8611// new TCanvas; hist->DrawCopy("SURF1");
8612
8613 hist->GetYaxis()->SetRangeUser(-1.59, 1.59);
8614
8615 pad1->cd();
8616 hist->SetStats(0);
8617 hist->DrawCopy("SURF1");
8618
8619 Float_t min = hist->GetMinimum();
8620 Float_t max = hist->GetMaximum();
8621
8622 // ranges are to exclude eta gap region from fit
8623 func = new TF2("func", "[0]+[1]*exp(-0.5*((x/[2])**2+(y/[3])**2))", -5, 5, -1, 1);
8624 func->SetParameters(0, 1, 0.3, 0.3);
8625 func->SetParLimits(1, 0, 10);
8626 func->SetParLimits(2, 0.1, 10);
8627 func->SetParLimits(3, 0.1, 10);
8628
8629 hist->Fit(func, "0R", "");
8630// hist->Fit(func, "IM", "SAME");
8631
8632 pad2->cd();
8633 funcHist = (TH2*) hist->Clone("funcHist");
8634 funcHist->Reset();
8635 funcHist->Add(func);
8636 funcHist->SetMinimum(min);
8637 funcHist->SetMaximum(max);
8638 funcHist->Draw("SURF1");
8639
8640 pad3->cd();
8641 hist->Add(func, -1);
8642 hist->SetMinimum(min);
8643 hist->SetMaximum(max);
8644 hist->DrawCopy("SURF1");
8645
8646 width1->SetPoint(width1->GetN(), x, TMath::Abs(func->GetParameter(2)));
8647 width1->SetPointError(width1->GetN()-1, 0, func->GetParError(2));
8648
8649 width2->SetPoint(width2->GetN(), x, TMath::Abs(func->GetParameter(3)));
8650 width2->SetPointError(width2->GetN()-1, 0, func->GetParError(3));
8651
8652 Float_t chi2 = 0;
8653 Int_t ndf = 0;
8654 for (Int_t i=hist->GetXaxis()->FindBin(-0.8); i<=hist->GetXaxis()->FindBin(0.8); i++)
8655 for (Int_t j=hist->GetYaxis()->FindBin(-0.8); j<=hist->GetYaxis()->FindBin(0.8); j++)
8656 {
8657 if (hist->GetBinError(i, j) > 0)
8658 {
8659 chi2 += TMath::Power(hist->GetBinContent(i, j) / hist->GetBinError(i, j), 2);
8660 ndf++;
8661 }
8662 }
8663 ndf -= func->GetNumberFreeParameters();
8664
8665 printf("#chi^{2}/ndf = %.1f/%d = %.1f ", func->GetChisquare(), func->GetNDF(), func->GetChisquare() / func->GetNDF());
8666 Printf("#chi^{2}/ndf = %.1f/%d = %.1f", chi2, ndf, chi2 / ndf);
8667
8668 DrawLatex(0.5, yPosChi2, 1, Form("#chi^{2}/ndf = %.1f/%d = %.1f", func->GetChisquare(), func->GetNDF(), func->GetChisquare() / func->GetNDF()));
8669 DrawLatex(0.5, yPosChi2 - 0.05, 1, Form("#chi^{2}/ndf = %.1f/%d = %.1f", chi2, ndf, chi2 / ndf));
8670}
8671
8672Double_t DeltaPhiWidth2DFitFunction(Double_t *x, Double_t *par)
8673{
8674 // params: 0: gaussian amplitude, 1: phi width, 2: eta width
8675 // 3..bins+2 constants as fct of eta
8676
8677 Int_t etaBin = (Int_t) ((x[1] + 2.0) / 0.1);
8678
8679 return par[3+etaBin]+par[0]*TMath::Exp(-0.5*((x[0]/par[1])**2+(x[1]/par[2])**2));
8680}
8681
8682void FitDeltaPhi2DOneFunction(TH2* hist, TVirtualPad* pad1, TVirtualPad* pad2, TVirtualPad* pad3, TGraphErrors* width1, TGraphErrors* width2, Float_t x, Float_t yPosChi2)
8683{
8684 Float_t outerLimit = 1.8;
8685
8686 hist->GetYaxis()->SetRangeUser(-1.59, 1.59);
8687
8688 pad1->cd();
8689 hist->SetStats(0);
8690 hist->DrawCopy("SURF1");
8691
8692 Float_t min = hist->GetMinimum();
8693 Float_t max = hist->GetMaximum();
8694
8695 Int_t bins = hist->GetNbinsX();
8696
8697 // ranges are to exclude eta gap region from fit
8698 func = new TF2("func", DeltaPhiWidth2DFitFunction, -5, 5, -outerLimit, outerLimit, bins+3);
8699 func->SetParameters(1, 0.3, 0.3);
8700 for (Int_t i=3; i<bins+3; i++)
8701 func->SetParameter(i, 0);
8702
8703 func->SetParLimits(0, 0, 10);
8704 func->SetParLimits(1, 0.1, 10);
8705 func->SetParLimits(2, 0.1, 10);
8706
8707 hist->Fit(func, "0R", "");
8708// hist->Fit(func, "IM", "SAME");
8709
8710 pad2->cd();
8711 funcHist = (TH2*) hist->Clone("funcHist");
8712 funcHist->Reset();
8713 funcHist->Add(func);
8714 funcHist->SetMinimum(min);
8715 funcHist->SetMaximum(max);
8716 funcHist->Draw("SURF1");
8717
8718 pad3->cd();
8719 hist->Add(func, -1);
8720 hist->SetMinimum(min);
8721 hist->SetMaximum(max);
8722 hist->DrawCopy("SURF1");
8723
8724 width1->SetPoint(width1->GetN(), x, TMath::Abs(func->GetParameter(1)));
8725 width1->SetPointError(width1->GetN()-1, 0, func->GetParError(1));
8726
8727 width2->SetPoint(width2->GetN(), x, TMath::Abs(func->GetParameter(2)));
8728 width2->SetPointError(width2->GetN()-1, 0, func->GetParError(2));
8729
8730 Float_t chi2 = 0;
8731 Int_t ndf = 0;
8732 for (Int_t i=hist->GetXaxis()->FindBin(-0.8); i<=hist->GetXaxis()->FindBin(0.8); i++)
8733 for (Int_t j=hist->GetYaxis()->FindBin(-0.8); j<=hist->GetYaxis()->FindBin(0.8); j++)
8734 {
8735 if (hist->GetBinError(i, j) > 0)
8736 {
8737 chi2 += TMath::Power(hist->GetBinContent(i, j) / hist->GetBinError(i, j), 2);
8738 ndf++;
8739 }
8740 }
8741 ndf -= func->GetNumberFreeParameters();
8742
8743 printf("#chi^{2}/ndf = %.1f/%d = %.1f ", func->GetChisquare(), func->GetNDF(), func->GetChisquare() / func->GetNDF());
8744 Printf("#chi^{2}/ndf = %.1f/%d = %.1f", chi2, ndf, chi2 / ndf);
8745
8746 DrawLatex(0.5, yPosChi2, 1, Form("#chi^{2}/ndf = %.1f/%d = %.1f", func->GetChisquare(), func->GetNDF(), func->GetChisquare() / func->GetNDF()));
8747 DrawLatex(0.5, yPosChi2 - 0.05, 1, Form("#chi^{2}/ndf = %.1f/%d = %.1f", chi2, ndf, chi2 / ndf));
8748}
8749
8750void AnalyzeDeltaPhiEtaGap2D(const char* fileName, Int_t method)
8751{
8752 TFile::Open(fileName);
8753
8754 Int_t maxLeadingPt = 5;
8755 Int_t maxAssocPt = 6;
8756
8757 TGraphErrors* width1[4];
8758 TGraphErrors* width2[4];
8759
8760 Int_t nHists = 4;
8761 for (Int_t histId = 0; histId < nHists; histId++)
8762 {
8763 width1[histId] = new TGraphErrors;
8764 width2[histId] = new TGraphErrors;
8765 for (Int_t i=0; i<maxLeadingPt; i++)
8766 {
8767 TCanvas* canvas = new TCanvas(Form("DeltaPhi_%d_%d", histId, i), Form("DeltaPhi_%d_%d", histId, i), 1000, 1000);
8768 canvas->Divide(3, maxAssocPt);
8769
8770 for (Int_t j=0; j<maxAssocPt; j++)
8771 {
8772 for (Int_t k=1; k<=3; k++)
8773 {
8774 canvas->cd(3 * j + k);
8775 gPad->SetLeftMargin(0.15);
8776 gPad->SetBottomMargin(0.2);
8777 gPad->SetTopMargin(0.01);
8778 gPad->SetRightMargin(0.01);
8779 }
8780
8781// if (i != 1 || j != 2)
8782// continue;
8783
8784 hist1 = (TH1*) gFile->Get(Form("dphi_%d_%d_%d", i, j, histId));
8785 if (!hist1)
8786 continue;
8787
8788 Float_t xPos = j*8+i;
8789
8790 if (method == 0)
8791 FitDeltaPhiEtaGap2D((TH2*) hist1, kFALSE, canvas->cd(3 * j + 1), canvas->cd(3 * j + 2), canvas->cd(3 * j + 3), width1[histId], width2[histId], xPos, 0.9);
8792 else
8793 FitDeltaPhi2DOneFunction((TH2*) hist1, canvas->cd(3 * j + 1), canvas->cd(3 * j + 2), canvas->cd(3 * j + 3), width1[histId], width2[histId], xPos, 0.9);
8794
8795 break;
8796 }
8797
8798 break;
8799 }
8800
8801 break;
8802 }
8803
8804 return;
8805
8806 Int_t marker[] = { 20, 24, 25, 26 };
8807 Int_t colors[] = { 2, 2, 4, 6 };
8808 const char* labels[] = { "0-5%", "60-90%", "pp", "30-40%" };
8809
8810 Bool_t found = kTRUE;
8811 c1 = (TCanvas*) gROOT->GetListOfCanvases()->FindObject("width_phi");
8812 if (!c1)
8813 {
8814 c1 = new TCanvas("width_phi", "width_phi", 800, 600);
8815 colors[0] = 1;
8816 found = kFALSE;
8817 }
8818 c1->cd();
8819
8820 for (Int_t histId = 0; histId < nHists; histId++)
8821 {
8822 width1[histId]->SetMarkerStyle(marker[histId]);
8823 width1[histId]->SetMarkerColor(colors[histId]);
8824 width1[histId]->Draw((histId == 0 && !found) ? "AP" : "PSAME");
8825 DrawLatex(0.7, 0.8 - 0.05 * histId, colors[histId], labels[histId]);
8826 }
8827
8828 found = kTRUE;
8829 c1 = (TCanvas*) gROOT->GetListOfCanvases()->FindObject("width_eta");
8830 if (!c1)
8831 {
8832 c1 = new TCanvas("width_eta", "width_eta", 800, 600);
8833 colors[0] = 1;
8834 found = kFALSE;
8835 }
8836 c1->cd();
8837 for (Int_t histId = 0; histId < nHists; histId++)
8838 {
8839 width2[histId]->SetMarkerStyle(marker[histId]);
8840 width2[histId]->SetMarkerColor(colors[histId]);
8841 width2[histId]->Draw((histId == 0 && !found) ? "AP" : "PSAME");
8842 DrawLatex(0.7, 0.8 - 0.05 * histId, colors[histId], labels[histId]);
8843 }
8844}
8845*/
8846
8847void RemoveWing(const char* fileName, const char* outputFile)
8848{
8849 // remove wing by flattening using the ratio of a flat line to the corr fct at phi = pi/2 +- 0.25 as fct of delta eta
8850
8851 file = TFile::Open(fileName);
8852 file2 = TFile::Open(outputFile, "RECREATE");
8853 file2->Close();
8854
8855 Int_t maxLeadingPt = 10;
8856 Int_t maxAssocPt = 11;
8857
8858 Int_t nHists = 6;
8859 for (Int_t histId = 0; histId < nHists; histId++)
8860 {
8861 for (Int_t i=0; i<maxLeadingPt; i++)
8862 {
8863 for (Int_t j=0; j<maxAssocPt; j++)
8864 {
8865 hist = (TH2*) file->Get(Form("dphi_%d_%d_%d", i, j, histId));
8866 if (!hist)
8867 continue;
8868
8869 Float_t width = 1.5;
8870 TH1* proj = hist->ProjectionY(Form("projx", hist->GetName()), hist->GetXaxis()->FindBin(TMath::Pi() - width), hist->GetXaxis()->FindBin(TMath::Pi()+ width));
8871 proj->Fit("pol0", "0");
8872 //new TCanvas; proj->DrawCopy();
8873 proj->Divide(proj->GetFunction("pol0"));
8874 //new TCanvas; proj->DrawCopy();
8875 //new TCanvas; hist->DrawCopy("SURF1");
8876 for (Int_t x=1; x<=hist->GetNbinsX(); x++)
8877 for (Int_t y=1; y<=hist->GetNbinsY(); y++)
8878 {
8879 if (proj->GetBinContent(y) <= 0)
8880 continue;
8881 hist->SetBinContent(x, y, hist->GetBinContent(x, y) / proj->GetBinContent(y));
8882 hist->SetBinError(x, y, hist->GetBinError(x, y) / proj->GetBinContent(y));
8883 }
8884 //new TCanvas; hist->DrawCopy("SURF1");
8885
8886 file2 = TFile::Open(outputFile, "UPDATE");
8887 hist->Write();
8888 file2->Close();
8889 }
8890 }
8891 }
8892}
8893
8894void RemoveWingAllSpecies()
8895{
8896 const char* suffix[] = { "Hadrons", "Pions", "Kaons", "Protons" };
8897 TString baseName = "dphi_corr_LHC13bc_20130604_";
8898
8899 for (Int_t i=0; i<4; i++)
8900 RemoveWing(baseName + suffix[i] + ".root", baseName + suffix[i] + "_wingremoved.root");
8901}
8902
8903void PlotPtDistributions(const char* fileName1, Int_t centrBegin = 1, Int_t centrEnd = 2)
8904{
8905 loadlibs();
8906
8907 Int_t maxLeadingPt = 3;
8908 Float_t leadingPtArr[] = { 1.0, 10.0, 20.0, 40.0 };
8909
8910 Int_t nCentralityBins = 5;
8911 Int_t centralityBins[] = { 1, 7, 9, 11, 13, 16 };
8912
8913 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName1);
8914
8915 TCanvas* canvas = new TCanvas("Pt", "Pt", 1000, 1000);
8916 canvas->Divide(2, maxLeadingPt+2);
8917
8918 TLegend* legend = new TLegend(0.2, 0.2, 0.95, 0.90);
8919 legend->SetFillColor(0);
8920 legend->SetTextSize(0.08);
8921
8922 TLegend* legendB = new TLegend(0.2, 0.2, 0.95, 0.90);
8923 legendB->SetFillColor(0);
8924 legendB->SetTextSize(0.08);
8925
8926 TLegend* legend2 = new TLegend(0.2, 0.2, 0.95, 0.90);
8927 legend2->SetFillColor(0);
8928 legend2->SetTextSize(0.08);
8929
8930 Int_t colors[] = { 1, 2, 4, 6 };
8931 Int_t markers[] = { 20, 21, 22, 23, 24, 25 };
8932
8933 for (Int_t i=0; i<maxLeadingPt; i++)
8934 {
8935 Double_t ptMin = leadingPtArr[i] + 0.01;
8936 //Double_t ptMax = leadingPtArr[i+1] - 0.01;
8937 Double_t ptMax = 39.99;
8938
8939 TString str;
8940 str.Form("%.1f < p_{T,trig} < %.1f", ptMin - 0.01, ptMax + 0.01);
8941
8942 canvas->cd(2*i+1+2);
8943 gPad->SetLeftMargin(0.15);
8944 gPad->SetBottomMargin(0.2);
8945 gPad->SetTopMargin(0.01);
8946 gPad->SetRightMargin(0.01);
8947 gPad->SetLogy();
8948 gPad->SetLogx();
8949 gPad->SetGridx();
8950 gPad->SetGridy();
8951
8952 TH2F* dummy = new TH2F("dummy", "", 100, 1, 40, 100, 1e-5, 1e3);
8953 dummy->SetStats(kFALSE);
8954 dummy->SetXTitle("p_{T,assoc}");
8955 dummy->SetYTitle("");
8956 dummy->GetYaxis()->SetTitleOffset(1);
8957 Prepare1DPlot(dummy);
8958
8959 dummy->GetXaxis()->SetLabelSize(0.06);
8960 dummy->GetYaxis()->SetLabelSize(0.06);
8961 dummy->GetXaxis()->SetTitleSize(0.06);
8962 dummy->GetYaxis()->SetTitleSize(0.06);
8963 dummy->DrawCopy();
8964
8965 Float_t phiRange[] = { 0, TMath::Pi() / 2, TMath::Pi() };
8966 const char* phiLabels[] = { "Towards", "Transverse", "Away" };
8967
8968 for (Int_t j=0; j<3; j++)
8969 {
8970 TH1* centralEta = 0;
8971 TH1* sideEta1 = 0;
8972
8973 if (j == 0)
8974 {
8975 centralEta = h->GetUEHist(2)->GetPtHist(6, 0, ptMin, ptMax, centrBegin, centrEnd, phiRange[j] - TMath::Pi() / 4, phiRange[j] + TMath::Pi() / 4, -0.69, 0.69);
8976 sideEta1 = h->GetUEHist(2)->GetPtHist(6, 0, ptMin, ptMax, centrBegin, centrEnd, phiRange[j] - TMath::Pi() / 4, phiRange[j] + TMath::Pi() / 4, -1.39, -0.71);
8977 TH1* sideEta2 = h->GetUEHist(2)->GetPtHist(6, 0, ptMin, ptMax, centrBegin, centrEnd, phiRange[j] - TMath::Pi() / 4, phiRange[j] + TMath::Pi() / 4, 0.71, 1.39);
8978 sideEta1->Add(sideEta2); // TODO can be done smarter? what about the errors?
8979
8980 Prepare1DPlot(sideEta1);
8981 Prepare1DPlot(centralEta);
8982
8983 centralEta->SetLineColor(colors[j]);
8984 sideEta1->SetLineColor(colors[j+1]);
8985
8986 if (i == 0)
8987 {
8988 legend->AddEntry(centralEta->Clone(), Form("Jet, %s: |#eta| < 0.7, #phi ~ %.1f", phiLabels[j], phiRange[j]));
8989 legend->AddEntry(sideEta1->Clone(), Form("Ridge, %s: 0.7 < |#eta| < 1.4, #phi ~ %.1f", phiLabels[j], phiRange[j]));
8990 }
8991 }
8992 else
8993 {
8994 centralEta = h->GetUEHist(2)->GetPtHist(6, 0, ptMin, ptMax, centrBegin, centrEnd, phiRange[j] - TMath::Pi() / 4, phiRange[j] + TMath::Pi() / 4, -1.39, 1.39);
8995 centralEta->Scale(0.5);
8996 centralEta->SetLineColor(colors[j+1]);
8997
8998 Prepare1DPlot(centralEta);
8999
9000 if (i == 0)
9001 legend->AddEntry(centralEta->Clone(), Form("%s: |#eta| < 1.4, #phi ~ %.1f", phiLabels[j], phiRange[j]));
9002 }
9003
9004 canvas->cd(2*i+1+2);
9005 centralEta->DrawCopy("SAME");
9006 if (sideEta1)
9007 sideEta1->DrawCopy("SAME");
9008
9009 centralEta->SetLineColor(colors[i]);
9010 centralEta->Scale(100.0 / centralEta->Integral());
9011 if (sideEta1)
9012 {
9013 sideEta1->SetLineColor(colors[i]);
9014 sideEta1->Scale(100.0 / sideEta1->Integral());
9015 }
9016
9017 if (j < 2)
9018 canvas->cd(j*4+4);
9019 else
9020 canvas->cd(j*4+2);
9021 if (i == 0)
9022 {
9023 gPad->SetLeftMargin(0.15);
9024 gPad->SetBottomMargin(0.2);
9025 gPad->SetTopMargin(0.01);
9026 gPad->SetRightMargin(0.01);
9027
9028 dummy->DrawCopy();
9029
9030 gPad->SetLogy();
9031 gPad->SetLogx();
9032 gPad->SetGridx();
9033 gPad->SetGridy();
9034
9035 TString str3;
9036 if (j == 0)
9037 str3.Form("Jet, %s: |#eta| < 0.7, #phi ~ %.1f", phiLabels[j], phiRange[j]);
9038 else
9039 str3.Form("%s: |#eta| < 1.4, #phi ~ %.1f", phiLabels[j], phiRange[j]);
9040 latex = new TLatex(0.2, 0.3, str3);
9041 latex->SetNDC();
9042 latex->SetTextSize(0.08);
9043 latex->Draw();
9044 }
9045
9046 if (j == 0)
9047 legend2->AddEntry(centralEta->Clone(), str);
9048
9049 centralEta->DrawCopy("SAME");
9050
9051 if (sideEta1)
9052 {
9053 canvas->cd(j*4+4+2);
9054 if (i == 0)
9055 {
9056 gPad->SetLeftMargin(0.15);
9057 gPad->SetBottomMargin(0.2);
9058 gPad->SetTopMargin(0.01);
9059 gPad->SetRightMargin(0.01);
9060
9061 dummy->DrawCopy();
9062
9063 gPad->SetLogy();
9064 gPad->SetLogx();
9065 gPad->SetGridx();
9066 gPad->SetGridy();
9067
9068 TString str3;
9069 if (j == 0)
9070 str3.Form("Ridge, %s: 0.7 < |#eta| < 1.4, #phi ~ %.1f", phiLabels[j], phiRange[j]);
9071 else
9072 str3.Form("%s: |#eta| < 1.4, #phi ~ %.1f", phiLabels[j], phiRange[j]);
9073 latex = new TLatex(0.2, 0.3, str3);
9074 latex->SetNDC();
9075 latex->SetTextSize(0.08);
9076 latex->Draw();
9077 }
9078
9079 sideEta1->DrawCopy("SAME");
9080 }
9081 }
9082
9083 TString str3;
9084 str3.Form("%d-%d%%", (Int_t) h->GetCentralityDistribution()->GetXaxis()->GetBinLowEdge(centrBegin), (Int_t) h->GetCentralityDistribution()->GetXaxis()->GetBinUpEdge(centrEnd));
9085 latex = new TLatex(0.2, 0.3, str3);
9086 latex->SetNDC();
9087 latex->SetTextSize(0.08);
9088
9089 latex2 = new TLatex(0.55, 0.8, str);
9090 latex2->SetNDC();
9091 latex2->SetTextSize(0.06);
9092
9093 canvas->cd(2*i+1+2);
9094 latex->Draw();
9095 latex2->Draw();
9096
9097 //break;
9098 }
9099
9100 canvas->cd(1);
9101 legend->Draw();
9102
9103 canvas->cd(2);
9104 legend2->Draw();
9105}
9106
9107TH1* GetNonSubtractedRHICYield(Int_t ptT, Int_t ptA, Int_t centrality)
9108{
9109 rhicFile = TFile::Open("rhic/postcorr_AuAu_iter6_ppg106final.root");
9110
9111 corrFunc = (TH1*) rhicFile->Get(Form("pi0hdphi_%d_%d_%d_2", ptT, ptA, centrality));
9112 //corrFunc->Draw();
9113
9114 // integral
9115 corrFunc->Scale(1.0 / corrFunc->Integral());
9116 // bin width
9117 corrFunc->Scale(TMath::TwoPi() / corrFunc->GetBinWidth(1));
9118
9119 same = (TH1*) rhicFile->Get(Form("pi0hdphi_%d_%d_%d_0", ptT, ptA, centrality));
9120 Float_t nPairs = same->Integral();
9121
9122 triggers = (TH1*) rhicFile->Get(Form("pi0pt_%d_%d", ptT, centrality));
9123 Float_t nTrigs = triggers->Integral();
9124
9125 graph = (TGraph*) rhicFile->Get(Form("gS_%d_%d", ptT, centrality));
9126
9127 Printf("%f %f %f %f", nPairs, nTrigs, nPairs / nTrigs, graph->GetY()[ptA]);
9128
9129 corrFunc->Scale(nPairs / nTrigs);
9130
9131 //corrFunc->Add(new TF1("func", "1", -5, 5), -1. / 3 * (corrFunc->GetBinContent(corrFunc->FindBin(1.5)) + corrFunc->GetBinContent(corrFunc->FindBin(1.2)) + corrFunc->GetBinContent(corrFunc->FindBin(1.0))));
9132
9133 Float_t values[3];
9134 Float_t errors[3];
9135
9136 Float_t regionBegin[3] = { -TMath::Pi() / 2, TMath::Pi() / 2 - 0.4, 1.5 * TMath::Pi() - 0.4 };
9137 Float_t regionEnd[3] = { -TMath::Pi() / 2 + 0.4, TMath::Pi() / 2 + 0.4, 1.5 * TMath::Pi() };
9138
9139 // weighted mean
9140 Float_t sum = 0;
9141 Float_t weight = 0;
9142 for (Int_t i=0; i<3; i++)
9143 {
9144 corrFunc->Fit("pol0", "0Q", "", regionBegin[i], regionEnd[i]);
9145 func = corrFunc->GetFunction("pol0");
9146 if (!func)
9147 continue;
9148 sum += func->GetParameter(0) / func->GetParError(0) / func->GetParError(0);
9149 weight += 1. / func->GetParError(0) / func->GetParError(0);
9150 }
9151
9152 if (weight == 0)
9153 return 0;
9154
9155 sum /= weight;
9156 weight = TMath::Sqrt(1. / weight);
9157
9158 corrFunc->Add(new TF1("func", "1", -5, 5), -sum);
9159
9160 return corrFunc;
9161
9162 new TCanvas;
9163 corrFunc->Draw();
9164 compHist = (TH1*) rhicFile->Get(Form("ptyMSMP_0_%d%d%d", ptT, ptA, centrality));
9165 compHist->DrawCopy("SAME");
9166
9167 //compHist->Add((TF1*) compHist->GetListOfFunctions()->First());
9168 //compHist->DrawCopy("SAME");
9169}
9170
9171void DeltaPhiVsRHIC(Int_t rhicCentrality = 0, Int_t aliceCentrality = 0, Bool_t reduced = kFALSE)
9172{
9173 aliceFile = TFile::Open("alice_dphi_corr_rhicbinning.root");
9174 rhicFile = TFile::Open("rhic/postcorr_AuAu_iter6_ppg106final.root");
9175
9176 Int_t maxLeadingPt = 4;
9177 Int_t maxAssocPt = 5;
9178
9179 if (reduced)
9180 {
9181 Int_t maxSelected = 4;
9182 Int_t selectedLead[] = { 0, 0, 2, 2 };
9183 Int_t selectedAssoc[] = { 1, 2, 3, 4 };
9184
9185 maxLeadingPt = TMath::Sqrt(maxSelected);
9186 maxAssocPt = TMath::Sqrt(maxSelected);
9187 }
9188
9189 TCanvas* canvas = new TCanvas("DeltaPhi", "DeltaPhi", 1000, 700);
9190 canvas->Divide(maxAssocPt, maxLeadingPt);
9191
9192 for (Int_t i=0; i<maxLeadingPt; i++)
9193 for (Int_t j=0; j<maxAssocPt; j++)
9194 {
9195 Printf("%d %d", i, j);
9196
9197 canvas->cd(j+1 + i * maxAssocPt);
9198 gPad->SetLeftMargin(0.15);
9199 gPad->SetBottomMargin(0.2);
9200 //gPad->SetTopMargin(0.01);
9201 gPad->SetRightMargin(0.01);
9202
9203 Int_t iSel = i;
9204 Int_t jSel = j;
9205
9206 if (reduced)
9207 {
9208 iSel = selectedLead[j + i * maxAssocPt];
9209 jSel = selectedAssoc[j + i * maxAssocPt];
9210 }
9211
9212 //rhic = (TH1*) rhicFile->Get(Form("VptyMSMP_0_%d%d%d", iSel, jSel, rhicCentrality));
9213 rhic = GetNonSubtractedRHICYield(iSel, jSel, rhicCentrality);
9214 if (!rhic)
9215 continue;
9216 rhic->SetLineColor(2);
9217 rhic->SetMarkerStyle(1);
9218
9219 alice = (TH1*) aliceFile->Get(Form("dphi_%d_%d_%d_fit_flat", iSel, jSel, aliceCentrality));
9220 if (!alice)
9221 continue;
9222
9223 // match near side yield
9224 if (1)
9225 {
9226 Float_t factor = 0.5 * alice->Integral(alice->FindBin(-0.1), alice->FindBin(0.1)) / rhic->Integral(rhic->FindBin(-0.1), rhic->FindBin(0.1));
9227
9228 Printf("%f", factor);
9229 rhic->Scale(factor);
9230 }
9231
9232 alice->SetLineColor(1);
9233
9234 //alice->Rebin(36); rhic->Rebin(30);
9235
9236 clone = alice->DrawCopy("");
9237 rhic->DrawCopy("SAME");
9238
9239 //Printf("chi2 test: chi2/ndf = %f", alice->Chi2Test(rhic, "WW CHI2/NDF"));
9240 Float_t chi2 = 0;
9241 Float_t n = 0;
9242 for (Int_t k=1; k<=rhic->GetNbinsX(); k++)
9243 {
9244 chi2 += TMath::Power(rhic->GetBinContent(k) - alice->Interpolate(rhic->GetBinCenter(k)), 2) / (TMath::Power(rhic->GetBinError(k), 2) + TMath::Power(alice->GetBinError(alice->FindBin(rhic->GetBinCenter(k))), 2));
9245 n++;
9246 }
9247
9248 chi2 /= n;
9249 Printf("chi2 test: chi2/ndf = %f", chi2);
9250
9251 clone->GetYaxis()->SetRangeUser(TMath::Min(alice->GetMinimum(), rhic->GetMinimum()) * 1.1, TMath::Max(alice->GetMaximum(), rhic->GetMaximum()) * 1.1);
9252
9253 for (Int_t bin=1; bin<=rhic->GetNbinsX(); bin++)
9254 {
9255 Double_t aliceValue = alice->GetBinContent(alice->FindBin(rhic->GetXaxis()->GetBinCenter(bin)));
9256 if (aliceValue == 0)
9257 continue;
9258 rhic->SetBinContent(bin, rhic->GetBinContent(bin) / aliceValue);
9259 rhic->SetBinError(bin, 0);
9260 }
9261
9262 rhic->Rebin(2);
9263 rhic->Scale(0.5);
9264
9265 rhic->SetLineColor(3);
9266 //rhic->DrawCopy("SAME");
9267
9268 //return;
9269 }
9270
9271 canvas->SaveAs("yield_comparison.png");
9272}
9273
9274void DeltaPhi(const char* fileName, const char* fileName2 = 0, Bool_t reduced = kFALSE, Bool_t ppComparison = kFALSE, Int_t mode = 0, const char* dataTag = "", const char* histName = "_fit_flat")
9275{
9276 // DeltaPhi("high_stat_binning_pp7_pt8.root", "high_stat_binning_pp7_pythia_pt8.root", 0, 1, 0, "pp 7 TeV uncorrected")
9277 // DeltaPhi("high_stat_binning_pp900_pt8.root", "high_stat_binning_pp900_pythia_pt8.root", 0, 1, 0, "pp 0.9 TeV uncorrected")
9278
9279 style(2);
9280
9281 aliceFile = TFile::Open(fileName);
9282 if (fileName2)
9283 secondFile = TFile::Open(fileName2);
9284
9285 if (1)
9286 {
9287 Int_t maxLeadingPt = 3;
9288 Int_t maxAssocPt = 3;
9289 }
9290 else
9291 {
9292 Int_t maxLeadingPt = 3;
9293 Int_t maxAssocPt = 7;
9294 }
9295
9296 if (reduced)
9297 {
9298 Int_t maxSelected = 4;
9299 Int_t selectedLead[] = { 1, 1, 1, 1 };
9300 Int_t selectedAssoc[] = { 2, 3, 4, 5 };
9301
9302 maxLeadingPt = TMath::Sqrt(maxSelected);
9303 maxAssocPt = TMath::Sqrt(maxSelected);
9304 }
9305
9306 factorGraph = new TGraphErrors;
9307
9308// TCanvas* canvas = new TCanvas(Form("%s_%s", fileName, fileName2 ? fileName2 : ""), Form("%s_%s", fileName, fileName2 ? fileName2 : ""), 600, 900);
9309 TCanvas* canvas = new TCanvas(Form("%s_%s", fileName, fileName2 ? fileName2 : ""), Form("%s_%s", fileName, fileName2 ? fileName2 : ""), 1000, 1000);
9310 canvas->Divide(maxAssocPt, maxLeadingPt);
9311
9312 for (Int_t i=0; i<maxLeadingPt; i++)
9313 for (Int_t j=0; j<maxAssocPt; j++)
9314 {
9315 TH1* first = 0;
9316 TH1* peripheral = 0;
9317 for (Int_t aliceCentrality=0; aliceCentrality<4; aliceCentrality++)
9318 {
9319 Printf("%d %d %d", i, j, aliceCentrality);
9320
9321 if (aliceCentrality == 1)
9322 continue;
9323
9324 canvas->cd(j+1 + i * maxAssocPt);
9325
9326 Int_t iSel = i;
9327 Int_t jSel = j;
9328 Int_t centralitySel = aliceCentrality;
9329 currentFile = aliceFile;
9330
9331 if (reduced)
9332 {
9333 iSel = selectedLead[j + i * maxAssocPt];
9334 jSel = selectedAssoc[j + i * maxAssocPt];
9335 }
9336
9337 if (fileName2)
9338 {
9339 if (ppComparison)
9340 {
9341 centralitySel = 3;
9342 if (aliceCentrality == 1)
9343 currentFile = secondFile;
9344 else if (aliceCentrality == 2)
9345 break;
9346 }
9347 else
9348 if (aliceCentrality == 3)
9349 currentFile = secondFile;
9350 }
9351
9352 //alice = (TH1*) currentFile->Get(Form("dphi_%d_%d_%d%s", iSel, jSel, centralitySel, (centralitySel < 3) ? "_tsallis_flat" : ((flatOrTsallis) ? "" : "_fit_flat")));
9353 alice = (TH1*) currentFile->Get(Form("dphi_%d_%d_%d%s", iSel, jSel, centralitySel, histName));
9354 if (!alice)
9355 continue;
9356
9357 if (0)
9358 {
9359 Printf("WARNING: Applying some scaling and rebinning! Only for 2.76 data-MC comparison!");
9360 if (aliceCentrality == 0)
9361 {
9362 alice->Rebin(2); alice->Scale(0.5);
9363 alice->Scale(1.0 / 1.6);
9364 }
9365// else
9366// alice->Scale(1.6);
9367 }
9368
9369 alice->Rebin(2); alice->Scale(0.5);
9370// alice->Scale(1.0 / 1.6);
9371
9372 // match near side yield to peripheral
9373 if (1 && centralitySel == 3 && peripheral)
9374 {
9375 if (mode == 0 || mode == 1)
9376 {
9377 Double_t width = 0.5;
9378 Double_t error1, error2;
9379 Double_t integral1 = peripheral->IntegralAndError(peripheral->FindBin(-width), peripheral->FindBin(width), error1);
9380 Double_t integral2 = alice->IntegralAndError(alice->FindBin(-width), alice->FindBin(width), error2);
9381 if (mode == 1)
9382 {
9383 Double_t tmpErr = 0;
9384 integral1 += peripheral->IntegralAndError(peripheral->FindBin(TMath::Pi() - width), peripheral->FindBin(TMath::Pi() + width), tmpErr);
9385 error1 = TMath::Sqrt(error1 * error1 + tmpErr * tmpErr);
9386
9387 integral2 += alice->IntegralAndError(alice->FindBin(TMath::Pi() - width), alice->FindBin(TMath::Pi() + width), tmpErr);
9388 error2 = TMath::Sqrt(error2 * error2 + tmpErr * tmpErr);
9389 }
9390 }
9391 else if (mode == 2)
9392 {
9393 Double_t error1, error2;
9394 Double_t integral1 = peripheral->IntegralAndError(1, peripheral->GetNbinsX(), error1);
9395 Double_t integral2 = alice->IntegralAndError(1, alice->GetNbinsX(), error2);
9396 }
9397 else if (mode == 3)
9398 {
9399 Double_t width = 1.0;
9400 Double_t error1, error2;
9401 Double_t integral1 = peripheral->IntegralAndError(peripheral->FindBin(TMath::Pi() - width), peripheral->FindBin(TMath::Pi() + width), error1);
9402 Double_t integral2 = alice->IntegralAndError(alice->FindBin(TMath::Pi() - width), alice->FindBin(TMath::Pi() + width), error2);
9403 }
9404
9405 Double_t factor = integral1 / integral2;
9406
9407 //factor = 0.804 * 0.9;
9408 Printf("%f", factor);
9409// alice->Scale(factor);
9410 factorGraph->SetPoint(factorGraph->GetN(), factorGraph->GetN(), factor);
9411 factorGraph->SetPointError(factorGraph->GetN() - 1, 0, factor * TMath::Sqrt(TMath::Power(error1 / integral1, 2) + TMath::Power(error2 / integral2, 2)));
9412 }
9413
9414 if (ppComparison && aliceCentrality == 0)
9415 peripheral = alice;
9416 else if (aliceCentrality == 2)
9417 peripheral = alice;
9418
9419// alice->SetYTitle("1/(N_{trig} #Delta#eta) dN_{assoc}/d#Delta#phi (1/rad)");
9420 alice->SetYTitle("1/N_{trig} dN_{assoc}/d#Delta#phi (1/rad)");
9421 alice->SetXTitle("#Delta#phi (rad)");
9422 alice->SetLineColor(aliceCentrality+1);
9423 alice->SetLineWidth(2);
9424 alice->SetMarkerColor(aliceCentrality+1);
9425 alice->GetYaxis()->SetTitleOffset(1.7);
9426 clone = alice->DrawCopy((aliceCentrality > 0) ? "SAME" : "");
9427 clone->SetTitle("");
9428
9429 TString str(alice->GetTitle());
9430 str.ReplaceAll(" - ", "#");
9431 tokens = str.Tokenize("#");
9432
9433 if (aliceCentrality == 0)
9434 {
9435 for (Int_t k=0; k<2; k++)
9436 {
9437 TString str(tokens->At(k)->GetName());
9438 str.ReplaceAll(".0", "");
9439 str.ReplaceAll("< p", "GeV/c < p");
9440 str += " GeV/c";
9441 latex = new TLatex(0.48, 0.92-k*0.06, str);
9442 latex->SetNDC();
9443 latex->SetTextSize(0.04);
9444 latex->Draw();
9445 }
9446
9447 }
9448
9449 if (!first)
9450 first = clone;
9451 else
9452 first->GetYaxis()->SetRangeUser(TMath::Min(first->GetMinimum(), clone->GetMinimum()), TMath::Max(first->GetMaximum(), clone->GetMaximum()));
9453
9454
9455
9456 //return;
9457 }
9458 if (first)
9459 //first->GetYaxis()->SetRangeUser(first->GetMinimum(), first->GetMaximum() * 1.2);
9460 first->GetYaxis()->SetRangeUser(first->GetMinimum(), first->GetMaximum() * 1.5);
9461 }
9462
9463 if (0)
9464 {
9465 for (Int_t i=1; i<=6; i++)
9466 {
9467 canvas->cd(i);
9468
9469 latex = new TLatex(0.58, 0.8, "ALICE preliminary");
9470 latex->SetTextSize(0.04);
9471 latex->SetNDC();
9472 latex->Draw();
9473
9474 latex = new TLatex(0.58, 0.74, Form("%s", dataTag));
9475 latex->SetTextSize(0.04);
9476 latex->SetNDC();
9477 latex->Draw();
9478
9479 latex = new TLatex(0.58, 0.68, "Stat. uncertainties only");
9480 latex->SetTextSize(0.04);
9481 latex->SetNDC();
9482 latex->Draw();
9483
9484 latex = new TLatex(0.58, 0.62, "|#eta| < 0.8");
9485 latex->SetTextSize(0.04);
9486 latex->SetNDC();
9487 latex->Draw();
9488
9489 if (ppComparison)
9490 {
9491 legend = new TLegend(0.3, 0.8, 0.47, 0.95);
9492 legend->SetFillColor(0);
9493 legend->SetTextSize(0.04);
9494 legend->AddEntry(peripheral, "Data");
9495 legend->AddEntry(alice, "Pythia");
9496 legend->Draw();
9497 }
9498
9499 DrawALICELogo(0.75, 0.47, 0.95, 0.6);
9500 }
9501 }
9502
9503 canvas->SaveAs(Form("%s.eps", canvas->GetName()));
9504 canvas->SaveAs(Form("%s.png", canvas->GetName()));
9505
9506 new TCanvas;
9507 peripheral->Divide(alice);
9508 peripheral->DrawCopy();
9509 //alice->DrawCopy("SAME");
9510
9511
9512 graphCanvas = (TCanvas*) gROOT->GetListOfCanvases()->FindObject("graphCanvas");
9513 factorGraph->SetMarkerStyle(20);
9514 if (!graphCanvas)
9515 {
9516 graphCanvas = new TCanvas("graphCanvas", "graphCanvas", 800, 600);
9517 factorGraph->Draw("AP");
9518 }
9519 else
9520 {
9521 graphCanvas->cd();
9522 factorGraph->SetLineColor(2);
9523 factorGraph->SetMarkerColor(2);
9524 factorGraph->Draw("SAMEP");
9525 }
9526 factorGraph->GetYaxis()->SetRangeUser(0.6, 1.4);
9527
9528 factorGraph->Print();
9529}
9530
9531void ComparePPYields(const char* histName = "_fit_flat")
9532{
9533 const char* files[] = { "high_stat_binning_pp900_pt8.root", "high_stat_binning_pp900_pythia_pt8.root", "high_stat_binning_pp276_pythia_pt8.root", "high_stat_binning_pp7_pythia_pt8.root", "high_stat_binning_pp7_pt8.root" };
9534 const char* titles[] = { "0.9 data", "0.9 Pythia", "2.76 Pythia", "7 Pythia", "7 data" };
9535
9536 Int_t colors[] = { 1, 2, 3, 4, 6 };
9537
9538 Int_t maxLeadingPt = 3;
9539 Int_t maxAssocPt = 2;
9540
9541 TCanvas* canvas = new TCanvas("ComparePPYields", "ComparePPYields", 600, 900);
9542 canvas->Divide(maxAssocPt, maxLeadingPt);
9543
9544 legend = new TLegend(0.5, 0.5, 0.8, 0.8);
9545 legend->SetFillColor(0);
9546
9547 TGraphErrors** graphs = new TGraphErrors*[5];
9548 TGraphErrors** graphs2 = new TGraphErrors*[5];
9549
9550 for (Int_t nFiles = 0; nFiles < 5; nFiles++)
9551 {
9552 graphs[nFiles] = new TGraphErrors;
9553 graphs2[nFiles] = new TGraphErrors;
9554 }
9555
9556 for (Int_t i=0; i<maxLeadingPt; i++)
9557 for (Int_t j=0; j<maxAssocPt; j++)
9558 {
9559 canvas->cd(j+1 + i * maxAssocPt);
9560 gPad->SetLeftMargin(0.18);
9561 gPad->SetBottomMargin(0.1);
9562 gPad->SetTopMargin(0.01);
9563 gPad->SetRightMargin(0.01);
9564
9565 TH1* first = 0;
9566
9567 for (Int_t nFiles = 0; nFiles < 5; nFiles++)
9568 {
9569 currentFile = TFile::Open(files[nFiles]);
9570
9571 Int_t aliceCentrality = 3;
9572
9573 Printf("%d %d %d", i, j, nFiles);
9574
9575 alice = (TH1*) currentFile->Get(Form("dphi_%d_%d_%d%s", i, j, aliceCentrality, histName));
9576 if (!alice)
9577 continue;
9578
9579 alice->SetYTitle("1/N_{trig} dN/dp_{T,assoc}");
9580 alice->SetLineColor(colors[nFiles]);
9581 alice->SetMarkerColor(colors[nFiles]);
9582 alice->GetYaxis()->SetTitleOffset(1.7);
9583 clone = alice->DrawCopy((nFiles > 0) ? "SAME" : "");
9584 clone->SetTitle("");
9585
9586 Double_t width = 0.7;
9587 Double_t error, error2;
9588 Double_t integral = alice->IntegralAndError(alice->FindBin(-width), alice->FindBin(width), error);
9589 Double_t integral2 = alice->IntegralAndError(alice->FindBin(TMath::Pi() - width), alice->FindBin(TMath::Pi() + width), error2);
9590
9591 graphs[nFiles]->SetPoint(graphs[nFiles]->GetN(), j + i * maxAssocPt - 0.2, integral);
9592 graphs[nFiles]->SetPointError(graphs[nFiles]->GetN()-1, 0, error);
9593
9594 graphs2[nFiles]->SetPoint(graphs2[nFiles]->GetN(), j + i * maxAssocPt + 0.2, integral2);
9595 graphs2[nFiles]->SetPointError(graphs2[nFiles]->GetN()-1, 0, error2);
9596
9597 if (!first)
9598 first = clone;
9599 else
9600 first->GetYaxis()->SetRangeUser(TMath::Min(first->GetMinimum(), clone->GetMinimum()), TMath::Max(first->GetMaximum(), clone->GetMaximum()));
9601
9602 if (nFiles == 0)
9603 {
9604 TString str(alice->GetTitle());
9605 str.ReplaceAll(" - ", "#");
9606 tokens = str.Tokenize("#");
9607
9608 for (Int_t k=0; k<2; k++)
9609 {
9610 latex = new TLatex(0.6, 0.88-k*0.07, tokens->At(k)->GetName());
9611 latex->SetNDC();
9612 latex->SetTextSize(0.04);
9613 latex->Draw();
9614 }
9615 }
9616
9617 if (i == 0 && j == 0)
9618 legend->AddEntry(clone, titles[nFiles]);
9619 }
9620 if (first)
9621 first->GetYaxis()->SetRangeUser(first->GetMinimum(), first->GetMaximum() * 1.1);
9622 }
9623
9624 canvas->cd(1);
9625
9626 legend->Draw();
9627
9628 new TCanvas;
9629 for (Int_t nFiles = 0; nFiles < 5; nFiles++)
9630 {
9631 graphs[nFiles]->SetMarkerStyle(25);
9632 graphs[nFiles]->SetLineColor(colors[nFiles]);
9633 graphs[nFiles]->SetMarkerColor(colors[nFiles]);
9634 clone2 = (TGraphErrors*) graphs[nFiles]->DrawClone((nFiles == 0) ? "AP" : "PSAME");
9635 clone2->GetYaxis()->SetRangeUser(0, 5);
9636
9637 graphs2[nFiles]->SetMarkerStyle(26);
9638 graphs2[nFiles]->SetLineColor(colors[nFiles]);
9639 graphs2[nFiles]->SetMarkerColor(colors[nFiles]);
9640 graphs2[nFiles]->DrawClone("PSAME");
9641 }
9642
9643 new TCanvas;
9644 for (Int_t nFiles = 0; nFiles < 5; nFiles++)
9645 {
9646 DivideGraphs(graphs[nFiles], graphs[4]);
9647 DivideGraphs(graphs2[nFiles], graphs2[4]);
9648
9649 graphs[nFiles]->SetMarkerStyle(25);
9650 graphs[nFiles]->SetLineColor(colors[nFiles]);
9651 graphs[nFiles]->SetMarkerColor(colors[nFiles]);
9652 clone2 = (TGraphErrors*) graphs[nFiles]->DrawClone((nFiles == 0) ? "AP" : "PSAME");
9653 clone2->GetYaxis()->SetRangeUser(0, 1.5);
9654
9655 graphs2[nFiles]->SetMarkerStyle(26);
9656 graphs2[nFiles]->SetLineColor(colors[nFiles]);
9657 graphs2[nFiles]->SetMarkerColor(colors[nFiles]);
9658 graphs2[nFiles]->DrawClone("PSAME");
9659 }
9660}
9661
9662void DeltaPhiPreliminary(const char* fileName, const char* histName)
9663{
9664 style(2);
9665
9666 currentFile = TFile::Open(fileName);
9667
9668 TCanvas* canvas = new TCanvas(Form("dphi%s", histName), "dphi", 800, 800);
9669 canvas->Divide(2, 2);
9670
9671 TLegend* legend = new TLegend(0.55, 0.47, 0.85, 0.65);
9672 legend->SetFillColor(0);
9673 legend->SetTextSize(0.04);
9674
9675 Int_t colors[] = { 1, 2, 4, 6 };
9676
9677 Int_t pad = 1;
9678 for (Int_t i=1; i<2; i++)
9679 for (Int_t j=2; j<6; j++)
9680 {
9681 canvas->cd(pad++);
9682
9683 for (Int_t aliceCentrality=0; aliceCentrality<3; aliceCentrality+=2)
9684 {
9685 Printf("%d %d %d", i, j, aliceCentrality);
9686
9687 hist = (TH1*) currentFile->Get(Form("dphi_%d_%d_%d%s", i, j, aliceCentrality, histName));
9688 if (!hist)
9689 continue;
9690
9691 if (aliceCentrality == 3)
9692 hist->Scale(kPythiaScalingFactor);
9693
9694 hist->GetYaxis()->SetTitleOffset(1.9);
9695 hist->SetLineColor(colors[aliceCentrality]);
9696 hist->SetMarkerColor(colors[aliceCentrality]);
9697 hist->SetLineWidth(2);
9698 hist->SetYTitle("1/N_{trig} dN_{assoc}/d#Delta#phi");
9699 hist->SetXTitle("#Delta#phi (rad)");
9700
9701 clone = hist->DrawCopy((aliceCentrality > 0) ? "SAME" : "");
9702 clone->SetTitle("");
9703
9704 TString str(hist->GetTitle());
9705 str.ReplaceAll(" - ", "#");
9706 tokens = str.Tokenize("#");
9707 hist->SetTitle("");
9708
9709 if (aliceCentrality == 0)
9710 {
9711 for (Int_t k=0; k<2; k++)
9712 {
9713 TString str(tokens->At(k)->GetName());
9714 str.ReplaceAll(".0", "");
9715 str.ReplaceAll("< p", "GeV/c < p");
9716 str += " GeV/c";
9717
9718 latex = new TLatex(0.5, 0.88-k*0.06, str);
9719 latex->SetNDC();
9720 latex->SetTextSize(0.04);
9721 latex->Draw();
9722 }
9723
9724 latex = new TLatex(0.5, 0.76, "ALICE preliminary");
9725 latex->SetTextSize(0.04);
9726 latex->SetNDC();
9727 latex->Draw();
9728
9729 latex = new TLatex(0.5, 0.70, "Stat. uncertainties only");
9730 latex->SetTextSize(0.04);
9731 latex->SetNDC();
9732 latex->Draw();
9733
9734 clone->GetYaxis()->SetRangeUser(0, clone->GetMaximum() * 1.2);
9735 }
9736
9737 if (pad == 2)
9738 {
9739 if (aliceCentrality == 3)
9740 legend->AddEntry(hist, "Pythia");
9741 else
9742 legend->AddEntry(hist, tokens->At(2)->GetName());
9743 }
9744
9745 legend->Draw();
9746
9747 }
9748 }
9749
9750 canvas->cd(3);
9751
9752 canvas->SaveAs(Form("%s.eps", canvas->GetName()));
9753 canvas->SaveAs(Form("%s.png", canvas->GetName()));
9754}
9755
9756void DeltaPhiBaseLinePreliminary(const char* fileName)
9757{
9758 style(2);
9759
9760 loadlibs();
9761
9762 Float_t leadingPtArr[] = { 6.0, 8.0, 10.0, 15.0, 15.0 };
9763 Float_t assocPtArr[] = { 0.5, 1.5, 3.0, 4.0, 6.0, 8.0, 10.0, 12.0 };
9764 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
9765
9766 Int_t i = 1;
9767 Int_t j = 3;
9768 Int_t step = 0;
9769
9770 gpTMin = assocPtArr[j] + 0.01;
9771 gpTMax = assocPtArr[j+1] - 0.01;
9772 SetupRanges(h);
9773
9774 TString str;
9775 str.Form("%.0f GeV/c < p_{T,trig} < %.0f GeV/c", leadingPtArr[i], leadingPtArr[i+2]);
9776
9777 TString str2;
9778 str2.Form("%.0f GeV/c < p_{T,assoc} < %.0f GeV/c", gpTMin - 0.01, gpTMax + 0.01);
9779
9780 Float_t v2[3];
9781 TH1* hist1 = 0;
9782 TH1* hist2b = 0;
9783
9784 GetDistAndFlow(h, 0, &hist1, v2, step, 0, 5, leadingPtArr[i] + 0.01, leadingPtArr[i+2] - 0.01);
9785 GetDistAndFlow(h, 0, &hist2b, v2+2, step, 60, 90, leadingPtArr[i] + 0.01, leadingPtArr[i+2] - 0.01);
9786
9787 hist1->SetLineWidth(2);
9788 hist2b->SetLineWidth(2);
9789
9790 canvas = new TCanvas("dphi_baseline", "dphi_baseline", 1200, 1200);
9791 canvas->Divide(2, 2);
9792
9793 canvas->cd(1);
9794// gPad->SetLeftMargin(0.20);
9795
9796 hist1->GetYaxis()->SetTitleOffset(1.9);
9797 hist1->SetYTitle("1/N_{trig} dN_{assoc}/d#Delta#phi");
9798 hist1->SetXTitle("#Delta#phi (rad)");
9799 hist1->SetTitle("");
9800 hist1->DrawCopy()->GetYaxis()->SetRangeUser(0, 0.59);
9801
9802 DrawFlow(v2[0], (TH1*) hist1->Clone(), leadingPtArr[i], assocPtArr[j], 0, i, 0, 0, (assocPtArr[j] + assocPtArr[j+1]) / 2, (assocPtArr[j+1] - assocPtArr[j]) / 2);
9803
9804 latex = new TLatex(0.5, 0.78, "0-5%");
9805 latex->SetNDC();
9806 latex->SetTextSize(0.04);
9807 latex->Draw();
9808
9809 if (1)
9810 {
9811 canvas->cd(2);
9812 // gPad->SetLeftMargin(0.20);
9813
9814 hist1->DrawCopy()->GetYaxis()->SetRangeUser(0.18, 0.295);
9815 DrawFlow(v2[0], hist1, leadingPtArr[i], assocPtArr[j], 0, i, 0, 0, (assocPtArr[j] + assocPtArr[j+1]) / 2, (assocPtArr[j+1] - assocPtArr[j]) / 2);
9816
9817 latex->Draw();
9818
9819 canvas->cd(3);
9820 // gPad->SetLeftMargin(0.20);
9821
9822 hist2b->GetYaxis()->SetTitleOffset(1.9);
9823 hist2b->SetYTitle("1/N_{trig} dN_{assoc}/d#Delta#phi");
9824 hist2b->SetXTitle("#Delta#phi (rad)");
9825 hist2b->SetTitle("");
9826 hist2b->DrawCopy();
9827
9828 DrawFlow(v2[2], (TH1*) hist2b->Clone(), leadingPtArr[i], assocPtArr[j], 0, i, 2, 0, (assocPtArr[j] + assocPtArr[j+1]) / 2, (assocPtArr[j+1] - assocPtArr[j]) / 2);
9829
9830 latex = new TLatex(0.5, 0.78, "60-90%");
9831 latex->SetNDC();
9832 latex->SetTextSize(0.04);
9833 latex->Draw();
9834
9835 canvas->cd(4);
9836 // gPad->SetLeftMargin(0.20);
9837
9838 hist2b->DrawCopy()->GetYaxis()->SetRangeUser(0.01, 0.13);
9839 DrawFlow(v2[2], hist2b, leadingPtArr[i], assocPtArr[j], 0, i, 2, 0, (assocPtArr[j] + assocPtArr[j+1]) / 2, (assocPtArr[j+1] - assocPtArr[j]) / 2);
9840
9841 latex->Draw();
9842 }
9843
9844 for (Int_t i=1; i<=4; i++)
9845 {
9846 canvas->cd(i);
9847
9848 latex = new TLatex(0.5, 0.84, str);
9849 latex->SetNDC();
9850 latex->SetTextSize(0.04);
9851 latex->Draw();
9852
9853 latex = new TLatex(0.5, 0.90, str2);
9854 latex->SetNDC();
9855 latex->SetTextSize(0.04);
9856 latex->Draw();
9857
9858 latex = new TLatex(0.5, 0.72, "ALICE preliminary");
9859 latex->SetTextSize(0.04);
9860 latex->SetNDC();
9861 latex->Draw();
9862
9863 latex = new TLatex(0.5, 0.66, "Stat. uncertainties only");
9864 latex->SetTextSize(0.04);
9865 latex->SetNDC();
9866 latex->Draw();
9867 }
9868
9869 canvas->SaveAs(Form("%s.eps", canvas->GetName()));
9870 canvas->SaveAs(Form("%s.png", canvas->GetName()));
9871}
9872
9873/*
9874void DeltaPhiBaseLinePaperPlot(const char* fileName, const char* yieldFile)
9875{
9876 style(2);
9877
9878 Float_t fontSize = 0.08;
9879 Float_t titleOffset = 0.85;
9880
9881 gStyle->SetTextSize(fontSize);
9882 gStyle->SetLabelSize(fontSize, "xy");
9883 gStyle->SetTitleSize(fontSize, "xy");
9884 gStyle->SetTitleOffset(titleOffset, "y");
9885 gStyle->SetHistLineWidth(2);
9886 gROOT->ForceStyle();
9887
9888 loadlibs();
9889
9890 Float_t leadingPtArr[] = { 6.0, 8.0, 10.0, 15.0, 15.0 };
9891 Float_t assocPtArr[] = { 0.5, 1.5, 3.0, 4.0, 6.0, 8.0, 10.0, 12.0 };
9892 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
9893
9894 Int_t i = 1;
9895 Int_t j = 3;
9896 Int_t step = 0;
9897
9898 gpTMin = assocPtArr[j] + 0.01;
9899 gpTMax = assocPtArr[j+1] - 0.01;
9900 SetupRanges(h);
9901
9902 TString str;
9903 str.Form("%.0f GeV/#font[12]{c} < p_{t,trig} < %.0f GeV/#font[12]{c}", leadingPtArr[i], leadingPtArr[i+2]);
9904
9905 TString str2;
9906 str2.Form("%.0f GeV/#font[12]{c} < p_{t,assoc} < %.0f GeV/#font[12]{c}", gpTMin - 0.01, gpTMax + 0.01);
9907
9908 Float_t v2[3];
9909 TH1* hist1 = 0;
9910 TH1* hist2b = 0;
9911
9912 GetDistAndFlow(h, 0, &hist1, v2, step, 0, 5, leadingPtArr[i] + 0.01, leadingPtArr[i+2] - 0.01);
9913
9914 hist1->SetLineWidth(2);
9915
9916 canvas = new TCanvas("dphi_baseline", "dphi_baseline", 600, 840);
9917 canvas->Range(0, 0, 1, 1);
9918
9919 pad1 = new TPad("pad1", "pad1", 0, 0.69, 1, 1);
9920 pad1->Draw();
9921
9922 pad2 = new TPad("pad2", "pad2", 0, 0.38, 1, 0.69);
9923 pad2->Draw();
9924
9925 pad3 = new TPad("pad3", "pad3", 0, 0 , 1, 0.38);
9926 pad3->Draw();
9927
9928 pad1->cd();
9929 gPad->SetMargin(0.15, 0.02, 0, 0.01);
9930
9931// hist1->GetYaxis()->SetTitleOffset(0.85);
9932 hist1->SetYTitle("1/N_{trig} dN_{assoc}/d#Delta#varphi");
9933 hist1->SetXTitle("#Delta#varphi (rad)");
9934 hist1->SetTitle("");
9935
9936 hist1->SetLabelSize(fontSize * 0.38 / 0.31, "xy");
9937 hist1->SetTitleSize(fontSize * 0.38 / 0.31, "xy");
9938 hist1->SetTitleOffset(titleOffset / 0.38 * 0.31, "y");
9939
9940 hist1->DrawCopy(); //->GetYaxis()->SetRangeUser(0, 0.59);
9941
9942 //DrawFlow(v2[0], (TH1*) hist1->Clone(), leadingPtArr[i], assocPtArr[j], 0, i, 0, 0, (assocPtArr[j] + assocPtArr[j+1]) / 2, (assocPtArr[j+1] - assocPtArr[j]) / 2);
9943
9944 pad2->cd();
9945 gPad->SetMargin(0.15, 0.02, 0, 0);
9946
9947 hist1->DrawCopy()->GetYaxis()->SetRangeUser(0.381, 0.457);
9948 DrawFlow(v2[0], hist1, leadingPtArr[i], assocPtArr[j], 0, i, 0, 0, (assocPtArr[j] + assocPtArr[j+1]) / 2, (assocPtArr[j+1] - assocPtArr[j]) / 2);
9949
9950 pad3->cd();
9951 gPad->SetMargin(0.15, 0.02, 0.2, 0);
9952
9953 // get zero subtracted plots
9954 TFile::Open(yieldFile);
9955 hist1sub = (TH1*) gFile->Get(Form("dphi_%d_%d_%d_fit_flat", i, j, 0));
9956 hist1sub->SetYTitle("1/N_{trig} dN_{assoc}/d#Delta#varphi");
9957 hist1sub->SetXTitle("#Delta#varphi (rad)");
9958 hist1sub->SetTitle("");
9959 hist1sub->DrawCopy();
9960
9961 hist2sub = (TH1*) gFile->Get(Form("dphi_%d_%d_%d_fit_flat", i, j, 2));
9962 hist2sub->SetMarkerStyle(24);
9963 hist2sub->SetLineColor(2);
9964 hist2sub->SetMarkerColor(2);
9965// hist2sub->SetMarkerSize(0.8);
9966 hist2sub->DrawCopy("SAMEP E X0");
9967
9968 hist3sub = (TH1*) gFile->Get(Form("dphi_%d_%d_%d_fit_flat", i, j, 3));
9969 hist3sub->SetMarkerStyle(25);
9970 hist3sub->SetLineColor(4);
9971 hist3sub->SetMarkerColor(4);
9972// hist3sub->SetMarkerSize(0.8);
9973 hist3sub->DrawCopy("SAMEP E X0");
9974
9975 legend = new TLegend(0.4, 0.55, 0.9, 0.9);
9976 legend->SetFillColor(0);
9977 legend->SetBorderSize(0);
9978 legend->SetTextSize(0.08);
9979 legend->AddEntry(hist1sub, "Pb-Pb 0-5% centrality", "L");
9980 legend->AddEntry(hist2sub, "Pb-Pb 60-90% centrality", "P");
9981 legend->AddEntry(hist3sub, "pp", "P");
9982 legend->Draw();
9983
9984 pad1->cd();
9985
9986 latex = new TLatex(0.47, 0.85, str);
9987 latex->SetTextSize(fontSize * 0.38 / 0.31);
9988 latex->SetNDC();
9989 latex->Draw();
9990
9991 latex = new TLatex(0.47, 0.73, str2);
9992 latex->SetTextSize(fontSize * 0.38 / 0.31);
9993 latex->SetNDC();
9994 latex->Draw();
9995
9996 latex = new TLatex(0.5, 0.42, "0-5% centrality");
9997 latex->SetNDC();
9998// latex->Draw();
9999
10000 latex = new TLatex(0.45, 0.62, "Stat. uncertainties only");
10001 latex->SetNDC();
10002// latex->Draw();
10003
10004 canvas->SaveAs(Form("%s.eps", canvas->GetName()));
10005 canvas->SaveAs(Form("%s.png", canvas->GetName()));
10006}
10007*/
10008
10009void DeltaPhiBaseLinePaperPlot(const char* fileName, const char* yieldFile)
10010{
10011 style(2);
10012
10013 Float_t fontSize = 0.08;
10014 Float_t titleOffset = 0.85;
10015
10016 gStyle->SetTextSize(fontSize);
10017 gStyle->SetLabelSize(fontSize, "xy");
10018 gStyle->SetTitleSize(fontSize, "xy");
10019 gStyle->SetTitleOffset(titleOffset, "y");
10020 gStyle->SetHistLineWidth(2);
10021 gROOT->ForceStyle();
10022
10023 loadlibs();
10024
10025 Float_t leadingPtArr[] = { 6.0, 8.0, 10.0, 15.0, 15.0 };
10026 Float_t assocPtArr[] = { 0.5, 1.5, 3.0, 4.0, 6.0, 8.0, 10.0, 12.0 };
10027 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
10028
10029 Int_t i = 1;
10030 Int_t j = 3;
10031 Int_t step = 0;
10032
10033 gpTMin = assocPtArr[j] + 0.01;
10034 gpTMax = assocPtArr[j+1] - 0.01;
10035 SetupRanges(h);
10036
10037 TString str;
10038 str.Form("%.0f < #font[12]{p}_{T,trig} < %.0f GeV/#font[12]{c}", leadingPtArr[i], leadingPtArr[i+2]);
10039
10040 TString str2;
10041 str2.Form("%.0f < #font[12]{p}_{T,assoc} < %.0f GeV/#font[12]{c}", gpTMin - 0.01, gpTMax + 0.01);
10042
10043 Float_t v2[3];
10044 TH1* hist1 = 0;
10045 TH1* hist2b = 0;
10046
10047 GetDistAndFlow(h, 0, &hist1, v2, step, 0, 5, leadingPtArr[i] + 0.01, leadingPtArr[i+2] - 0.01);
10048
10049 hist1->SetLineWidth(2);
10050
10051 canvas = new TCanvas("dphi_baseline", "dphi_baseline", 600, 840);
10052 canvas->Range(0, 0, 1, 1);
10053
10054 pad1 = new TPad("pad1", "pad1", 0, 0.69, 1, 1);
10055 pad1->Draw();
10056
10057 pad2 = new TPad("pad2", "pad2", 0, 0.38, 1, 0.69);
10058 pad2->Draw();
10059
10060 pad3 = new TPad("pad3", "pad3", 0, 0 , 1, 0.38);
10061 pad3->Draw();
10062
10063 pad1->cd();
10064 gPad->SetMargin(0.15, 0.02, 0, 0.01);
10065
10066// hist1->GetYaxis()->SetTitleOffset(0.85);
10067 hist1->SetYTitle("");
10068 hist1->SetXTitle("#Delta#font[12]{#varphi} (rad)");
10069 hist1->SetTitle("");
10070
10071 hist1->SetLabelSize(fontSize * 0.38 / 0.31, "xy");
10072 hist1->SetTitleSize(fontSize * 0.38 / 0.31, "xy");
10073 hist1->SetTitleOffset(titleOffset / 0.38 * 0.31, "y");
10074
10075 hist1->DrawCopy("HISTE"); //->GetYaxis()->SetRangeUser(0, 0.59);
10076
10077 //DrawFlow(v2[0], (TH1*) hist1->Clone(), leadingPtArr[i], assocPtArr[j], 0, i, 0, 0, (assocPtArr[j] + assocPtArr[j+1]) / 2, (assocPtArr[j+1] - assocPtArr[j]) / 2);
10078
10079 pad2->cd();
10080 gPad->SetMargin(0.15, 0.02, 0, 0);
10081
10082 hist1->SetYTitle("1/#font[12]{N}_{trig} d#font[12]{N}_{assoc}/d#Delta#font[12]{#varphi} (rad^{-1})");
10083 hist1->DrawCopy("HISTE")->GetYaxis()->SetRangeUser(0.381, 0.457);
10084 DrawFlow(v2[0], hist1, leadingPtArr[i], assocPtArr[j], 0, i, 0, 0, (assocPtArr[j] + assocPtArr[j+1]) / 2, (assocPtArr[j+1] - assocPtArr[j]) / 2);
10085
10086 pad3->cd();
10087 gPad->SetMargin(0.15, 0.02, 0.2, 0);
10088
10089 // get zero subtracted plots
10090 TFile::Open(yieldFile);
10091
10092 hist1sub = (TH1*) gFile->Get(Form("dphi_%d_%d_%d_fit_flat", i, j, 0));
10093 hist1sub->SetYTitle("");
10094 hist1sub->SetXTitle("#Delta#varphi (rad)");
10095 hist1sub->SetTitle("");
10096// hist1sub->SetMarkerStyle(25);
10097// hist1sub->SetLineColor(4);
10098// hist1sub->SetMarkerColor(4);
10099 hist1sub->SetMaximum(0.79);
10100 hist1sub->DrawCopy("HIST E");
10101
10102 hist3sub = (TH1*) gFile->Get(Form("dphi_%d_%d_%d_fit_flat", i, j, 3));
10103// hist3sub->SetFillColor(4);
10104// hist3sub->SetFillStyle(3354);
10105// hist3sub->SetLineWidth(0);
10106// hist3sub->SetLineColor(0);
10107 hist3sub->SetMarkerStyle(25);
10108 hist3sub->SetLineColor(4);
10109 hist3sub->SetMarkerColor(4);
10110 hist3sub->DrawCopy("SAME E X0");
10111
10112 hist1sub->DrawCopy("SAME HIST E");
10113
10114 hist2sub = (TH1*) gFile->Get(Form("dphi_%d_%d_%d_fit_flat", i, j, 2));
10115 hist2sub->SetMarkerStyle(24);
10116 hist2sub->SetLineColor(2);
10117 hist2sub->SetMarkerColor(2);
10118 hist2sub->DrawCopy("SAMEP E X0");
10119
10120 legend = new TLegend(0.4, 0.45, 0.9, 0.8);
10121 legend->SetFillColor(0);
10122 legend->SetBorderSize(0);
10123 legend->SetTextSize(fontSize);
10124 legend->AddEntry(hist1sub, "Pb-Pb 0-5% centrality", "L");
10125 legend->AddEntry(hist2sub, "Pb-Pb 60-90% centrality", "P");
10126 legend->AddEntry(hist3sub, "pp", "P");
10127 legend->Draw();
10128
10129 pad1->cd();
10130
10131 latex = new TLatex(0.59, 0.70, str);
10132 latex->SetTextSize(fontSize * 0.38 / 0.31);
10133 latex->SetNDC();
10134 latex->Draw();
10135
10136 latex = new TLatex(0.59, 0.58, str2);
10137 latex->SetTextSize(fontSize * 0.38 / 0.31);
10138 latex->SetNDC();
10139 latex->Draw();
10140
10141 latex = new TLatex(0.59, 0.46, "#sqrt{#font[12]{s}_{NN}} = 2.76 TeV");
10142 latex->SetTextSize(fontSize * 0.38 / 0.31);
10143 latex->SetNDC();
10144 latex->Draw();
10145
10146 latex = new TLatex(0.43, 0.90, "a) not background subtracted");
10147 latex->SetTextSize(fontSize * 0.38 / 0.31);
10148 latex->SetNDC();
10149 latex->Draw();
10150
10151 latex = new TLatex(0.5, 0.42, "0-5% centrality");
10152 latex->SetNDC();
10153// latex->Draw();
10154
10155 latex = new TLatex(0.45, 0.62, "Stat. uncertainties only");
10156 latex->SetNDC();
10157// latex->Draw();
10158
10159 pad2->cd();
10160
10161 latex = new TLatex(0.43, 0.90, "b) zoomed");
10162 latex->SetTextSize(fontSize * 0.38 / 0.31);
10163 latex->SetNDC();
10164 latex->Draw();
10165
10166 pad3->cd();
10167
10168 latex = new TLatex(0.43, 0.90, "c) background subtracted");
10169 latex->SetNDC();
10170 latex->Draw();
10171
10172
10173 canvas->SaveAs(Form("%s.eps", canvas->GetName()));
10174 canvas->SaveAs(Form("%s.png", canvas->GetName()));
10175}
10176
10177
10178void DeltaPhiRidgePreliminary(const char* fileName)
10179{
10180 style();
10181
10182 loadlibs();
10183
10184 Float_t leadingPtArr[] = { 2.0, 2.0, 3.0, 4.0, 10.0, 20.0, 40.0 };
10185 Float_t assocPtArr[] = { 1.0, 2.0, 3.0, 6.0, 10.0, 20.0, 40.0 };
10186// Float_t leadingPtArr[] = { 6.0, 8.0, 10.0, 15.0, 15.0 };
10187// Float_t assocPtArr[] = { 0.5, 1.5, 3.0, 4.0, 6.0, 8.0, 10.0, 12.0 };
10188 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName, 0, kFALSE);
10189 AliUEHistograms* hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE);
10190
10191// Int_t i = 1;
10192// Int_t j = 3;
10193 Int_t i = 0;
10194 Int_t j = 0;
10195 Int_t step = 6;
10196
10197 gpTMin = assocPtArr[j] + 0.01;
10198 gpTMax = assocPtArr[j+1] - 0.01;
10199 SetupRanges(h);
10200 SetupRanges(hMixed);
10201
10202 TString str;
10203 str.Form("%.1f < p_{T,trig} < %.1f", leadingPtArr[i], leadingPtArr[i+2]);
10204
10205 TString str2;
10206 str2.Form("%.1f < p_{T,assoc} < %.1f", gpTMin - 0.01, gpTMax + 0.01);
10207
10208 Float_t v2[3];
10209 TH1* hist1 = 0;
10210 TH1* hist2b = 0;
10211 TH1* hist1Peak = 0;
10212 TH1* hist2bPeak = 0;
10213 TH1* hist1Ridge = 0;
10214 TH1* hist2bRidge = 0;
10215
10216 TH1* hist2d = 0;
10217 TH1* hist2dMixed = 0;
10218
10219// GetDistAndFlow(h, 0, &hist2d, v2, step, 0, 5, leadingPtArr[i] + 0.01, leadingPtArr[i+2] - 0.01, 1);
10220// GetDistAndFlow(hMixed, 0, &hist2dMixed, v2, step, 0, 5, leadingPtArr[i] + 0.01, leadingPtArr[i+2] - 0.01, 1);
10221// new TCanvas;
10222// //hist2d->Divide(hist2dMixed);
10223// hist2dMixed->Draw("SURF1");
10224
10225 GetDistAndFlow(h, hMixed, &hist1, 0, step, 0, 5, leadingPtArr[i] + 0.01, leadingPtArr[i+2] - 0.01);
10226// GetDistAndFlow(h, 0, &hist2b, v2[2], step, 60, 90, leadingPtArr[i] + 0.01, leadingPtArr[i+2] - 0.01);
10227 GetDistAndFlow(h, hMixed, &hist1Peak, 0, step, 0, 5, leadingPtArr[i] + 0.01, leadingPtArr[i+2] - 0.01, 10);
10228
10229 GetDistAndFlow(h, hMixed, &hist1Ridge, 0, step, 0, 5, leadingPtArr[i] + 0.01, leadingPtArr[i+2] - 0.01, 11);
10230
10231 // TODO normalize
10232
10233 canvas = new TCanvas("dphi_baseline", "dphi_baseline", 800, 800);
10234 canvas->Divide(2, 2);
10235
10236 canvas->cd(1);
10237 gPad->SetLeftMargin(0.20);
10238
10239 hist1->GetYaxis()->SetTitleOffset(1.9);
10240 hist1->SetYTitle("1/N_{trig} dN/dp_{T,assoc}");
10241 hist1->SetTitle("");
10242 hist1->DrawCopy();
10243
10244 hist1Peak->SetLineColor(2);
10245 hist1Peak->DrawCopy("SAME");
10246
10247 hist1Ridge->SetLineColor(4);
10248 hist1Ridge->DrawCopy("SAME");
10249
10250// hist1Peak->Add(hist1Ridge);
10251// hist1Peak->DrawCopy("SAME")->SetLineColor(3);
10252
10253 return;
10254
10255 DrawFlow(v2[0], (TH1*) hist1->Clone(), leadingPtArr[i], assocPtArr[j], 0, i, 0, 0, (assocPtArr[j] + assocPtArr[j+1]) / 2, (assocPtArr[j+1] - assocPtArr[j]) / 2);
10256
10257 latex = new TLatex(0.65, 0.84, str);
10258 latex->SetNDC();
10259 latex->SetTextSize(0.04);
10260 latex->Draw();
10261
10262 latex = new TLatex(0.65, 0.90, str2);
10263 latex->SetNDC();
10264 latex->SetTextSize(0.04);
10265 latex->Draw();
10266
10267 latex = new TLatex(0.84, 0.78, "0-5%");
10268 latex->SetNDC();
10269 latex->SetTextSize(0.04);
10270 latex->Draw();
10271
10272 canvas->cd(2);
10273 gPad->SetLeftMargin(0.20);
10274
10275 hist1->DrawCopy()->GetYaxis()->SetRangeUser(0.18, 0.28);
10276 DrawFlow(v2[0], hist1, leadingPtArr[i], assocPtArr[j], 0, i, 0, 0, (assocPtArr[j] + assocPtArr[j+1]) / 2, (assocPtArr[j+1] - assocPtArr[j]) / 2);
10277
10278 latex->Draw();
10279
10280 latex = new TLatex(0.5, 0.90, "ALICE preliminary");
10281 latex->SetTextSize(0.04);
10282 latex->SetNDC();
10283 latex->Draw();
10284
10285 latex = new TLatex(0.5, 0.84, "Statistical uncertainties only");
10286 latex->SetTextSize(0.04);
10287 latex->SetNDC();
10288 latex->Draw();
10289
10290 canvas->cd(3);
10291 gPad->SetLeftMargin(0.20);
10292
10293 hist2b->GetYaxis()->SetTitleOffset(1.9);
10294 hist2b->SetYTitle("1/N_{trig} dN/dp_{T,assoc}");
10295 hist2b->SetTitle("");
10296 hist2b->DrawCopy();
10297
10298 DrawFlow(v2[2], (TH1*) hist2b->Clone(), leadingPtArr[i], assocPtArr[j], 0, i, 2, 0, (assocPtArr[j] + assocPtArr[j+1]) / 2, (assocPtArr[j+1] - assocPtArr[j]) / 2);
10299
10300 latex = new TLatex(0.84, 0.78, "60-90%");
10301 latex->SetNDC();
10302 latex->SetTextSize(0.04);
10303 latex->Draw();
10304
10305 canvas->cd(4);
10306 gPad->SetLeftMargin(0.20);
10307
10308 hist2b->DrawCopy()->GetYaxis()->SetRangeUser(0.01, 0.1);
10309 DrawFlow(v2[2], hist2b, leadingPtArr[i], assocPtArr[j], 0, i, 2, 0, (assocPtArr[j] + assocPtArr[j+1]) / 2, (assocPtArr[j+1] - assocPtArr[j]) / 2);
10310
10311 latex->Draw();
10312
10313 canvas->SaveAs(Form("%s.eps", canvas->GetName()));
10314 canvas->SaveAs(Form("%s.png", canvas->GetName()));
10315}
10316
10317void MCScalingFactor(Int_t caseId)
10318{
10319 // 900 GeV
10320 // x[5]=5, y[5]=0.813743, ex[5]=0, ey[5]=0.158446
10321 // x[5]=5, y[5]=1.09804, ex[5]=0, ey[5]=0.265434
10322 // 7 TeV
10323 // x[5]=5, y[5]=1.02276, ex[5]=0, ey[5]=0.0199991
10324 // x[5]=5, y[5]=0.870247, ex[5]=0, ey[5]=0.0294444
10325
10326 Float_t factors[] = { 0.814, 1.098, 1.022, 0.870 };
10327 Float_t errors[] = { 0.158, 0.265, 0.020, 0.029 };
10328
10329 Float_t avgs[2];
10330
10331 for (Int_t i=0; i<2; i++)
10332 {
10333 switch (caseId)
10334 {
10335 case 0:
10336 avgs[i] = factors[2*i] / errors[2*i] / errors[2*i] + factors[2*i+1] / errors[2*i+1] / errors[2*i+1];
10337 avgs[i] /= 1. / errors[2*i] / errors[2*i] + 1. / errors[2*i+1] / errors[2*i+1];
10338 break;
10339
10340 case 1:
10341 avgs[i] = factors[2*i];
10342 break;
10343
10344 case 2:
10345 avgs[i] = factors[2*i+1];
10346 break;
10347
10348 case 3:
10349 avgs[0] = factors[0];
10350 avgs[1] = factors[3];
10351 break;
10352
10353 case 4:
10354 avgs[0] = factors[1];
10355 avgs[1] = factors[2];
10356 break;
10357 }
10358 }
10359
10360 Float_t a = avgs[0];
10361 Float_t b = avgs[1];
10362
10363 Printf("%f %f", a, b);
10364
10365 Float_t linEx = a + (b-a)/(7.-0.9) * (2.76-0.9);
10366 Float_t logEx = a + (b-a)/(log(7.)-log(0.9)) * (log(2.76)-log(0.9));
10367
10368 Printf("%f %f", linEx, logEx);
10369}
10370
10371void CompareDeltaPhi(const char* fileName1, const char* fileName2, Int_t centralityID, const char* dist = "_fit_flat", Bool_t reduced = kFALSE)
10372{
10373 firstFile = TFile::Open(fileName1);
10374 secondFile = TFile::Open(fileName2);
10375
10376 Int_t maxLeadingPt = 2;
10377 Int_t maxAssocPt = 7;
10378 Int_t minLeadingPt = 0;
10379 Int_t minAssocPt = 0;
10380
10381 if (reduced)
10382 {
10383 maxLeadingPt = 2;
10384 maxAssocPt = 5;
10385 minLeadingPt = 1;
10386 minAssocPt = 2;
10387 }
10388
10389 TCanvas* canvas = new TCanvas(Form("%s %s", fileName1, fileName2 ? fileName2 : ""), Form("%s %s", fileName1, fileName2 ? fileName2 : ""), 1000, 700);
10390 canvas->Divide(maxAssocPt-minAssocPt, maxLeadingPt-minLeadingPt);
10391
10392 for (Int_t i=minLeadingPt; i<maxLeadingPt; i++)
10393 for (Int_t j=minAssocPt; j<maxAssocPt; j++)
10394 {
10395 Printf("%d %d", i, j);
10396
10397 canvas->cd(j+1-minAssocPt + (i-minLeadingPt) * maxAssocPt);
10398 gPad->SetLeftMargin(0.15);
10399 gPad->SetBottomMargin(0.2);
10400 //gPad->SetTopMargin(0.01);
10401 gPad->SetRightMargin(0.01);
10402
10403 hist1 = (TH1*) firstFile->Get(Form("dphi_%d_%d_%d%s", i, j, centralityID, dist));
10404 hist2 = (TH1*) secondFile->Get(Form("dphi_%d_%d_%d%s", i, j, centralityID, dist));
10405
10406 if (!hist1)
10407 continue;
10408
10409/* hist1->Rebin(2); hist1->Scale(0.5);
10410 hist2->Rebin(2); hist2->Scale(0.5); */
10411// hist1->Scale(1.6);
10412
10413 hist1->SetLineColor(1);
10414 hist2->SetLineColor(2);
10415
10416 hist1->DrawCopy()->GetYaxis()->SetRangeUser(hist1->GetMinimum(), hist1->GetMaximum() * 1.2);
10417 hist2->DrawCopy("SAME");
10418
10419/* if (strlen(dist) == 0)
10420 Printf("chi2 test: %f", hist1->Chi2Test(hist2, "UU NORM CHI2/NDF"));*/
10421
10422 //DrawRatio(hist1, hist2, hist1->GetTitle());
10423
10424 //return;
10425 }
10426}
10427
10428TH1* MACHCone(const char* fileName, Int_t centrality, const char* drawingOption, Bool_t plotContributions, Int_t twoD, TF1** flowFuncP = 0)
10429{
10430 if (0)
10431 {
10432 TFile::Open("machcone_input.root");
10433
10434 switch (centrality)
10435 {
10436 case 0:
10437 hist = (TH1*) gFile->Get("dphi_0_0_0");
10438 break;
10439
10440 case 1:
10441 hist = (TH1*) gFile->Get("dphi_1_1_0");
10442 break;
10443
10444 case 2:
10445 hist = (TH1*) gFile->Get("dphi_0_0_2");
10446 break;
10447
10448 case 3:
10449 hist = (TH1*) gFile->Get("dphi_1_1_2");
10450 break;
10451 }
10452 }
10453 else
10454 {
10455 loadlibs();
10456
10457 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
10458 AliUEHistograms* hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE);
10459
10460 Float_t leadingPtArr[] = { 2.0, 3.0, 4.0, 10.0, 20.0, 40.0 };
10461 Float_t assocPtArr[] = { 1.0, 2.0, 3.0, 6.0, 10.0, 20.0, 40.0 };
10462// Float_t assocPtArr[] = { 2.0, 3.0, 6.0, 10.0, 20.0, 40.0 };
10463
10464 Int_t i = centrality % 2;
10465 Int_t step = 6;
10466
10467 Int_t j = 0;
10468
10469 gpTMin = assocPtArr[i] + 0.01;
10470 gpTMax = assocPtArr[i+1] - 0.01;
10471
10472 Int_t centralityBegin = 0;
10473 Int_t centralityEnd = 1;
10474
10475 if (centrality >= 2)
10476 {
10477 centralityBegin = 30;
10478 centralityEnd = 40;
10479 }
10480
10481 SetupRanges(h);
10482 SetupRanges(hMixed);
10483
10484 TH1* hist = 0;
10485 Float_t vn[5];
10486 vn[0] = 0;
10487 vn[1] = 0;
10488 vn[2] = 0;
10489 vn[3] = 0;
10490 vn[4] = 0;
10491
10492 Bool_t scaleToPairs = 0;
10493
10494 GetDistAndFlow(h, hMixed, &hist, 0, step, centralityBegin, centralityEnd, leadingPtArr[j] + 0.01, leadingPtArr[j+1] - 0.01, twoD, kTRUE, vn, scaleToPairs);
10495 if (scaleToPairs && twoD == 11)
10496 hist->Scale(2);
10497
10498 Printf("%f %f %f", vn[2], vn[3], vn[4]);
10499
10500 // mirror delta phi to improve stats
10501 if (1)
10502 {
10503 for (Int_t bin=1; bin<=hist->GetNbinsX(); bin++)
10504 {
10505 if (hist->GetBinCenter(bin) < 0 || hist->GetBinCenter(bin) > TMath::Pi())
10506 {
10507 if (hist->GetBinCenter(bin) < 0)
10508 Int_t bin2 = hist->FindBin(-1.0 * hist->GetBinCenter(bin));
10509 else
10510 Int_t bin2 = hist->FindBin(TMath::TwoPi() - hist->GetBinCenter(bin));
10511
10512 Float_t combValue = hist->GetBinContent(bin) / hist->GetBinError(bin) / hist->GetBinError(bin) + hist->GetBinContent(bin2) / hist->GetBinError(bin2) / hist->GetBinError(bin2);
10513
10514 Float_t weight = 1. / hist->GetBinError(bin) / hist->GetBinError(bin) + 1. / hist->GetBinError(bin2) / hist->GetBinError(bin2);
10515 combValue /= weight;
10516
10517 Float_t combError = TMath::Sqrt(1.0 / weight);
10518
10519 hist->SetBinContent(bin2, combValue);
10520 hist->SetBinError(bin2, combError);
10521
10522 hist->SetBinContent(bin, combValue);
10523 hist->SetBinError(bin, combError);
10524
10525 Printf("%d %d %f %f", bin, bin2, combValue, combError);
10526 }
10527 }
10528 }
10529 }
10530
10531 TString str(hist->GetTitle());
10532 str.ReplaceAll(" - ", "#");
10533 tokens = str.Tokenize("#");
10534 hist->SetTitle("");
10535
10536 hist->SetLineColor(1);
10537 hist->SetYTitle("1/N_{trig} dN_{assoc}/d#Delta#phi");
10538 hist->SetXTitle("#Delta#phi (rad)");
10539 hist = (TH1*) hist->Clone();
10540 if (!drawingOption)
10541 return hist;
10542
10543 hist = hist->DrawCopy(drawingOption);
10544
10545 for (Int_t i=0; i<tokens->GetEntries()-1; i++)
10546 {
10547 if (centrality == 1)
10548 latex = new TLatex(0.6, 0.9 - i*0.05 - gPad->GetTopMargin(), tokens->At(i)->GetName());
10549 else
10550 latex = new TLatex(0.6, 0.12 - i*0.05, tokens->At(i)->GetName());
10551
10552 latex->SetNDC();
10553 latex->SetTextSize(0.04);
10554 latex->Draw();
10555 }
10556
10557 TF1* flowFunc = new TF1("flowFunc", "[0] * (1+2*[1]*cos(2*x)+2*[2]*cos(3*x)+2*[3]*cos(4*x)+2*[4]*cos(5*x))", -0.5 * TMath::Pi(), 1.5 * TMath::Pi());
10558 //flowFunc->SetLineWidth(1);
10559 flowFunc->SetLineColor(2);
10560 flowFunc->SetLineStyle(2);
10561 for (Int_t i=0; i<4; i++)
10562 flowFunc->FixParameter(i+1, vn[i+1]);
10563 //flowFunc->SetParameter(0, 84.95); flowFunc->DrawClone("SAME");
10564
10565 //flowFunc->SetParameter(0, 85.4); flowFunc->DrawClone("SAME");
10566 //flowFunc->SetParameter(0, 85.6); flowFunc->DrawClone("SAME");
10567
10568// hist->Fit(flowFunc, "", "SAME", 1.8, 4.5);
10569 hist->Fit(flowFunc, "N", "", -0.5 * TMath::Pi(), 1.5 * TMath::Pi());
10570 hist->GetYaxis()->SetRangeUser(hist->GetMinimum() * 0.95, hist->GetMaximum() * 1.05);
10571 flowFunc->SetRange(-0.5 * TMath::Pi(), 1.5 * TMath::Pi());
10572 flowFunc->Draw("SAME");
10573
10574 if (flowFuncP)
10575 *flowFuncP = flowFunc;
10576
10577 //hist->GetYaxis()->SetRangeUser(84, 89);
10578 //flowFunc->SetParameter(4, 1);
10579
10580 Float_t chi2 = 0;
10581 Int_t n=0;
10582 for (Int_t bin=hist->FindBin(1.8); bin<=hist->FindBin(4.5); bin++)
10583 {
10584 chi2 += TMath::Power((hist->GetBinContent(bin) - flowFunc->Eval(hist->GetBinCenter(bin))) / hist->GetBinError(bin), 2);
10585 n++;
10586 //Printf("%f", TMath::Power((hist->GetBinContent(bin) - flowFunc->Eval(hist->GetBinCenter(bin))) / hist->GetBinError(bin), 2));
10587 }
10588
10589 chi2 /= n;
10590
10591 Printf("chi2/ndf = %f", chi2);
10592
10593 if (!plotContributions)
10594 return hist;
10595
10596 for (Int_t n=1; n<=5; n++)
10597 {
10598 flowFuncPart = new TF1("flowFuncPart", "[0] * (1+2*[1]*cos([2]*x))", -0.5 * TMath::Pi(), 1.5 * TMath::Pi());
10599 flowFuncPart->SetParameters(flowFunc->GetParameter(0), vn[n-1], n);
10600 flowFuncPart->SetLineWidth(1);
10601 flowFuncPart->SetLineStyle(n);
10602 flowFuncPart->Draw("SAME");
10603 }
10604
10605 return hist;
10606}
10607
10608void MACHConeAll(const char* fileName)
10609{
10610 loadlibs();
10611
10612 SetFlowStyle();
10613
10614 c = new TCanvas("c", "c", 300, 800);
10615 c->SetTopMargin(0);
10616 c->SetLeftMargin(0);
10617 c->SetRightMargin(0);
10618 c->SetBottomMargin(0);
10619 c->Divide(1, 2, 0, 0);
10620
10621 Float_t rangesMin[] = { 136.1, 17.45, 18, 2.4 };
10622 Float_t rangesMax[] = { 139.4, 18.95, 23.5, 3.6 };
10623
10624 for (Int_t i=0; i<2; i++)
10625 {
10626 c->cd(i+1);
10627
10628 gPad->SetRightMargin(0.05);
10629 gPad->SetLeftMargin(0.20);
10630 gPad->SetTopMargin(0.15);
10631 gPad->SetBottomMargin(0.15);
10632
10633 if (i == 0)
10634 {
10635 gPad->SetBottomMargin(0.01);
10636 }
10637 else if (i == 1)
10638 {
10639 gPad->SetTopMargin(0.01);
10640 gPad->SetBottomMargin(0.7);
10641 }
10642 }
10643
10644 Int_t i = 0;
10645
10646 TF1* flowFunc = 0;
10647
10648 c->cd(i+1);
10649// hist = MACHCone(fileName, i, "", kTRUE, 0, &flowFunc);
10650 hist = (TH1*) MACHCone(fileName, i, 0, kFALSE, 0)->Clone("hist");
10651 hist->GetYaxis()->SetRangeUser(rangesMin[i], rangesMax[i]);
10652 hist->GetYaxis()->SetTitleOffset(1.7);
10653 hist->Draw();
10654// continue;
10655
10656 c->cd(i+1);
10657 //c->cd(i+2);
10658// hist2 = MACHCone(fileName, i, 0, kFALSE, 11);
10659 hist2 = MACHCone(fileName, i, "SAME", kTRUE, 11, &flowFunc);
10660 //hist2->GetYaxis()->SetRangeUser(rangesMin[i], rangesMax[i]);
10661// hist2->Scale(2);
10662 hist2->SetLineColor(4);
10663 //hist2->Draw("SAME");
10664// return;
10665
10666 // sample flowFunc with same binning
10667 flowFuncHist = (TH1*) hist->Clone("flowFuncHist");
10668 flowFuncHist->Reset();
10669
10670 for (Int_t i=1; i<=flowFuncHist->GetNbinsX(); i++)
10671 {
10672 flowFuncHist->SetBinContent(i, flowFunc->Integral(flowFuncHist->GetXaxis()->GetBinLowEdge(i), flowFuncHist->GetXaxis()->GetBinUpEdge(i)));
10673 flowFuncHist->SetBinError(i, 0);
10674 }
10675
10676 i = 0;
10677
10678 flowFuncHist->Scale(1.0 / flowFuncHist->GetBinWidth(1));
10679
10680// new TCanvas;
10681// flowFuncHist->Draw();
10682// flowFunc->Draw("SAME");
10683// return;
10684
10685 // residuals
10686 residuals = (TH1*) hist->Clone("res1");
10687 residuals->SetYTitle("Residuals");
10688 residuals->Divide(flowFuncHist);
10689 c->cd(i+2);
10690 residuals->Draw();
10691 residuals->GetYaxis()->SetNdivisions(505);
10692 residuals->GetYaxis()->SetRangeUser(0.995, 1.005);
10693
10694 residuals = (TH1*) hist2->Clone("res2");
10695 residuals->Divide(flowFuncHist);
10696 c->cd(i+2);
10697 residuals->SetLineColor(4);
10698 residuals->Draw("SAME");
10699
10700 gPad->SetGridy();
10701
10702 if (i == 0)
10703 {
10704 legend = new TLegend(0.43, 0.66, 0.91, 0.82);
10705 legend->SetFillColor(0);
10706 legend->SetTextSize(0.034);
10707 legend->SetTextAlign(22);
10708
10709 legend->SetHeader("Centrality 0-1%");
10710 legend->AddEntry(hist, "|#eta| < 0.8 & All #Delta#eta", "L");
10711 legend->AddEntry(hist2, "|#eta| < 0.8 & |#Delta#eta| > 0.8 (2x)", "L");
10712
10713 c->cd(i+1);
10714 legend->Draw();
10715 }
10716
10717 c->SaveAs(Form("machcone_%d.png", 0));
10718 c->SaveAs(Form("machcone_%d.eps", 0));
10719 c->SaveAs(Form("machcone_%d.C", 0));
10720
10721 return;
10722
10723 c->cd(1);
10724 MACHCone(3, "", kTRUE)->SetTitle("");
10725
10726 c->cd(2);
10727 hist1 = MACHCone(0, "", kFALSE);
10728 hist2 = MACHCone(1, "SAME", kFALSE);
10729 hist3 = MACHCone(2, "SAME", kFALSE);
10730
10731 hist1->SetTitle("");
10732 hist1->GetYaxis()->SetRangeUser(1, 7);
10733}
10734
10735void SetFlowStyle()
10736{
10737 // Set style which will affect all plots.
10738
10739 gStyle->Reset();
10740 // gStyle->SetOptitle(0);
10741 // gStyle->SetOptStat(0);
10742 //gStyle->SetOptDate(1);
10743 // gStyle->SetPalette(8,0); // (1,0)
10744 gStyle->SetPalette(1); // (1,0)
10745 gStyle->SetDrawBorder(0);
10746 // gStyle->SetFillColor(0); // kills palete ???
10747 gStyle->SetCanvasColor(0);
10748 gStyle->SetPadColor(0);
10749 // gStyle->SetFillColor(0); // otherwize it affects Fill colors later
10750 gStyle->SetFrameFillColor(0);
10751 gStyle->SetCanvasBorderMode(0);
10752 gStyle->SetFrameLineWidth(2);
10753 // gStyle->SetFrameFillStyle(4000);
10754 gStyle->SetPadBorderMode(0);
10755 gStyle->SetPadTickX(1);
10756 gStyle->SetPadTickY(1);
10757 gStyle->SetPadBottomMargin(0.15);
10758 gStyle->SetPadLeftMargin(0.15);
10759 gStyle->SetHistLineWidth(2);
10760 gStyle->SetFuncWidth(2);
10761 gStyle->SetLineWidth(2);
10762 gStyle->SetLabelSize(0.05,"xyz");
10763 gStyle->SetLabelOffset(0.01,"y");
10764 gStyle->SetLabelColor(kBlack,"xyz");
10765 gStyle->SetTitleSize(0.06,"xyz");
10766 gStyle->SetTitleOffset(1.3,"y");
10767 gStyle->SetTitleFillColor(0);
10768 gStyle->SetLineWidth(2);
10769 gStyle->SetHistLineColor(1);
10770 gStyle->SetTextColor(1);
10771 gStyle->SetTitleTextColor(1);
10772 TGaxis::SetMaxDigits(4);
10773 gStyle->SetOptStat(0); // removes stat. box from all histos
10774 gROOT->ForceStyle();
10775
10776} // end of void SetFlowStyle()
10777
10778void PlotPtDistributionsSubtracted(const char* fileName1, Int_t centrBegin = 1, Int_t centrEnd = 6, Int_t fit = 0)
10779{
10780 loadlibs();
10781
10782 Int_t nCentralityBins = 5;
10783 Int_t centralityBins[] = { 1, 7, 9, 11, 13, 16 };
10784
10785 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName1);
10786
10787 TCanvas* canvas = new TCanvas("Pt", "Pt", 1000, 1000);
10788 canvas->Divide(2, 2);
10789
10790 TLegend* legend = new TLegend(0.3, 0.8, 0.99, 0.99);
10791 legend->SetFillColor(0);
10792
10793 Int_t colors[] = { 1, 2, 4, 6, 3, 5 };
10794 Int_t markers[] = { 20, 21, 22, 23, 24, 25 };
10795
10796 Double_t ptMin = 10.01;
10797 Double_t ptMax = 39.99;
10798
10799 TString str;
10800 str.Form("%.1f < p_{T,trig} < %.1f", ptMin - 0.01, ptMax + 0.01);
10801
10802 canvas->cd(1);
10803 gPad->SetLeftMargin(0.15);
10804 gPad->SetBottomMargin(0.2);
10805 gPad->SetTopMargin(0.01);
10806 gPad->SetRightMargin(0.01);
10807 gPad->SetLogy();
10808 gPad->SetLogx();
10809 gPad->SetGridx();
10810 gPad->SetGridy();
10811
10812 TH2F* dummy = new TH2F("dummy", "", 100, 1, 40, 100, 1e-5, 1e3);
10813 dummy->SetStats(kFALSE);
10814 dummy->SetXTitle("p_{T,assoc}");
10815 dummy->SetYTitle("1/N_{trig} dN/dp_{T,assoc}");
10816 dummy->GetYaxis()->SetTitleOffset(1);
10817 Prepare1DPlot(dummy);
10818
10819 dummy->GetXaxis()->SetLabelSize(0.05);
10820 dummy->GetYaxis()->SetLabelSize(0.05);
10821 dummy->GetXaxis()->SetTitleSize(0.05);
10822 dummy->GetYaxis()->SetTitleSize(0.05);
10823 dummy->DrawCopy();
10824
10825 canvas->cd(2);
10826 gPad->SetLeftMargin(0.15);
10827 gPad->SetBottomMargin(0.2);
10828 gPad->SetTopMargin(0.01);
10829 gPad->SetRightMargin(0.01);
10830 gPad->SetLogy();
10831 gPad->SetLogx();
10832 gPad->SetGridx();
10833 gPad->SetGridy();
10834 dummy->DrawCopy();
10835
10836 canvas->cd(3);
10837 gPad->SetLeftMargin(0.15);
10838 gPad->SetBottomMargin(0.2);
10839 gPad->SetTopMargin(0.01);
10840 gPad->SetRightMargin(0.01);
10841 gPad->SetLogx();
10842 gPad->SetGridx();
10843 gPad->SetGridy();
10844
10845 dummy = new TH2F("dummy2", "", 100, 1, 40, 100, 0, 100);
10846 dummy->SetStats(kFALSE);
10847 dummy->SetXTitle("p_{T,assoc}");
10848 dummy->SetYTitle("Ratio: Distribution / Inclusive");
10849 dummy->GetYaxis()->SetTitleOffset(1);
10850 Prepare1DPlot(dummy);
10851 dummy->GetXaxis()->SetLabelSize(0.05);
10852 dummy->GetYaxis()->SetLabelSize(0.05);
10853 dummy->GetXaxis()->SetTitleSize(0.05);
10854 dummy->GetYaxis()->SetTitleSize(0.05);
10855 dummy->DrawCopy();
10856
10857 canvas->cd(4);
10858 gPad->SetLeftMargin(0.15);
10859 gPad->SetBottomMargin(0.2);
10860 gPad->SetTopMargin(0.01);
10861 gPad->SetRightMargin(0.01);
10862 gPad->SetLogx();
10863 gPad->SetGridx();
10864 gPad->SetGridy();
10865 dummy->DrawCopy();
10866
10867
10868 // see GetAcceptanceScalingFactor
10869 Float_t scalingFactor = 0.328396; // 0.8
10870 //Float_t scalingFactor = 0.433268; // 0.7
10871 //Float_t scalingFactor = 0.895593; // 0.5 --> 1.6
10872
10873 Float_t phiRange[] = { 0, TMath::Pi() / 2, TMath::Pi() };
10874 const char* phiLabels[] = { "Towards", "Transverse", "Away" };
10875
10876 //Float_t phiSizeTowards = TMath::Pi() / 3;
10877 Float_t phiSizeTowards = 0.75;
10878 //Float_t etaLimit = 0.5;
10879 Float_t etaLimit = 0.8;
10880
10881 towardsCentralEta = h->GetUEHist(2)->GetPtHist(6, 0, ptMin, ptMax, centrBegin, centrEnd, phiRange[0] - phiSizeTowards, phiRange[0] + phiSizeTowards, -etaLimit + 0.01, etaLimit - 0.01);
10882 towardsSideEta1 = h->GetUEHist(2)->GetPtHist(6, 0, ptMin, ptMax, centrBegin, centrEnd, phiRange[0] - phiSizeTowards, phiRange[0] + phiSizeTowards, -1.59, -etaLimit - 0.01);
10883 TH1* towardsSideEta2 = h->GetUEHist(2)->GetPtHist(6, 0, ptMin, ptMax, centrBegin, centrEnd, phiRange[0] - phiSizeTowards, phiRange[0] + phiSizeTowards, etaLimit + 0.01, 1.59);
10884 towardsSideEta1->Add(towardsSideEta2); // TODO can be done smarter? what about the errors?
10885
10886 Prepare1DPlot(towardsSideEta1);
10887 Prepare1DPlot(towardsCentralEta);
10888
10889 towardsCentralEta->SetLineColor(colors[0]);
10890 towardsSideEta1->SetLineColor(colors[3]);
10891 //towardsSideEta1->SetLineStyle(2);
10892
10893 legend->AddEntry(towardsCentralEta->Clone(), Form("Jet, %s: |#Delta#eta| < 0.8, #phi ~ %.1f", phiLabels[0], phiRange[0]));
10894 legend->AddEntry(towardsSideEta1->Clone(), Form("Ridge, %s: 0.8 < |#Delta#eta| < 1.6, #phi ~ %.1f", phiLabels[0], phiRange[0]));
10895
10896 // TODO update when data with new phi binning is available
10897 transverse = h->GetUEHist(2)->GetPtHist(6, 0, ptMin, ptMax, centrBegin, centrEnd, phiRange[1] - TMath::Pi() / 3, phiRange[1] + TMath::Pi() / 3, -1.59, 1.59);
10898 /*
10899 transverse2 = h->GetUEHist(2)->GetPtHist(6, 0, ptMin, ptMax, centrBegin, centrEnd, -0.5 * TMath::Pi(), -TMath::Pi() / 3, -1.59, 1.59, kTRUE);
10900 transverse3 = h->GetUEHist(2)->GetPtHist(6, 0, ptMin, ptMax, centrBegin, centrEnd, TMath::Pi() + TMath::Pi() / 3, 1.5 * TMath::Pi(), -1.59, 1.59, kTRUE);
10901 transverse->Add(transverse2);
10902 transverse->Add(transverse3);
10903 transverse->Scale(1.0 / (2.0 / 3 * TMath::Pi()));
10904 */
10905
10906 //transverseSideEta1 = h->GetUEHist(2)->GetPtHist(6, 0, ptMin, ptMax, centrBegin, centrEnd, phiRange[1] - TMath::Pi() / 4, phiRange[1] + TMath::Pi() / 4, -1.59, -0.81);
10907 //TH1* transverseSideEta2 = h->GetUEHist(2)->GetPtHist(6, 0, ptMin, ptMax, centrBegin, centrEnd, phiRange[1] - TMath::Pi() / 4, phiRange[1] + TMath::Pi() / 4, 0.81, 1.59);
10908 //transverseSideEta1->Add(transverseSideEta2); // TODO can be done smarter? what about the errors?
10909
10910 transverse->SetLineColor(colors[2]);
10911 //transverseSideEta1->SetLineColor(colors[2]);
10912 //transverseSideEta1->SetLineStyle(2);
10913
10914 Prepare1DPlot(transverse);
10915 //Prepare1DPlot(transverseSideEta1);
10916 legend->AddEntry(transverse->Clone(), Form("%s: |#Delta#eta| < 1.6, #phi ~ %.1f", phiLabels[1], phiRange[1]));
10917 //legend->AddEntry(transverseSideEta1->Clone(), Form("%s: 0.8 < |#Delta #eta| < 1.6, #phi ~ %.1f", phiLabels[1], phiRange[1]));
10918
10919 away = h->GetUEHist(2)->GetPtHist(6, 0, ptMin, ptMax, centrBegin, centrEnd, phiRange[2] - TMath::Pi() / 3, phiRange[2] + TMath::Pi() / 3, -1.59, 1.59);
10920
10921 /*
10922 away2 = h->GetUEHist(2)->GetPtHist(6, 0, ptMin, ptMax, centrBegin, centrEnd, phiRange[2] - TMath::Pi() / 4, phiRange[2] + TMath::Pi() / 4, -0.79, 0.79);
10923 away3 = h->GetUEHist(2)->GetPtHist(6, 0, ptMin, ptMax, centrBegin, centrEnd, phiRange[2] - TMath::Pi() / 4, phiRange[2] + TMath::Pi() / 4, -1.59, -0.81);
10924 away4 = h->GetUEHist(2)->GetPtHist(6, 0, ptMin, ptMax, centrBegin, centrEnd, phiRange[2] - TMath::Pi() / 4, phiRange[2] + TMath::Pi() / 4, 0.81, 1.59);
10925 away3->Add(away4);
10926 */
10927
10928 away->SetLineColor(colors[1]);
10929 //away3->SetLineColor(colors[1]);
10930 //away3->SetLineStyle(2);
10931
10932 Prepare1DPlot(away);
10933 legend->AddEntry(away->Clone(), Form("%s: |#Delta#eta| < 1.6, #phi ~ %.1f", phiLabels[2], phiRange[2]));
10934
10935 //inclusive = h->GetUEHist(2)->GetPtHist(6, 0, ptMin, ptMax, centrBegin, centrEnd, -0.5 * TMath::Pi(), 1.5 * TMath::Pi(), -1.59, 1.59);
10936
10937 /*
10938 h->GetUEHist(2)->GetEventHist()->GetGrid(6)->GetGrid()->GetAxis(1)->SetRange(centrBegin, centrEnd);
10939 inclusive = h->GetUEHist(2)->GetEventHist()->ShowProjection(0, 6);
10940 h->GetUEHist(2)->GetEventHist()->GetGrid(6)->GetGrid()->GetAxis(1)->SetRange(0, -1);
10941 */
10942
10943 axis = h->GetUEHist(2)->GetEventHist()->GetGrid(6)->GetGrid()->GetAxis(1);
10944
10945 inclusiveTmp = h->GetCorrelationpT()->ProjectionY("inclusiveTmp", h->GetCorrelationpT()->GetXaxis()->FindBin(axis->GetBinLowEdge(centrBegin) + 0.01), h->GetCorrelationpT()->GetXaxis()->FindBin(axis->GetBinUpEdge(centrEnd) - 0.01));
10946
10947 //rebin to match other histograms
10948 //inclusive2 = inclusive->Rebin(away->GetNbinsX(), "inclusive2", away->GetXaxis()->GetXbins()->GetArray());
10949
10950 // manually, as usual the ROOT function makes a SEGV
10951 inclusive = (TH1*) away->Clone("inclusive");
10952 inclusive->Reset();
10953 inclusive->Sumw2();
10954 for (Int_t bin=1; bin<=inclusiveTmp->GetNbinsX(); bin++)
10955 inclusive->Fill(inclusiveTmp->GetBinCenter(bin), inclusiveTmp->GetBinContent(bin));
10956
10957 for (Int_t bin=1; bin<=inclusive->GetNbinsX(); bin++)
10958 inclusive->SetBinError(bin, TMath::Sqrt(inclusive->GetBinContent(bin)));
10959
10960 // normalization: events, phase space
10961 inclusive->Scale(1.0 / h->GetCentralityDistribution()->Integral(centrBegin, centrEnd));
10962 inclusive->Scale(1.0 / (TMath::TwoPi() * 0.8 * 2));
10963
10964 // bin width
10965 for (Int_t i=1; i<=inclusive->GetNbinsX(); i++)
10966 {
10967 inclusive->SetBinContent(i, inclusive->GetBinContent(i) / inclusive->GetXaxis()->GetBinWidth(i));
10968 inclusive->SetBinError (i, inclusive->GetBinError(i) / inclusive->GetXaxis()->GetBinWidth(i));
10969 }
10970
10971 Prepare1DPlot(inclusive);
10972 inclusive->SetLineColor(colors[4]);
10973 legend->AddEntry(inclusive->Clone(), "Inclusive");
10974
10975 //Prepare1DPlot(away3);
10976 //legend->AddEntry(away3->Clone(), Form("%s: 0.8 < |#Delta #eta| < 1.6, #phi ~ %.1f", phiLabels[2], phiRange[2]));
10977
10978 // scale for acceptance to match acceptance of towardsCentralEta
10979 towardsSideEta1->Scale(1.0 / scalingFactor); // contains only "side-eta"
10980 transverse->Scale(1.0 / (1.0 + scalingFactor)); // full eta
10981 away->Scale(1.0 / (1.0 + scalingFactor)); // full eta
10982 inclusive->Scale(1.0 / (1.0 + scalingFactor)); // full eta (phi scaling implicit)
10983
10984 canvas->cd(1);
10985 towardsCentralEtaClone = towardsCentralEta->DrawCopy("SAME");
10986 towardsSideEta1Clone = towardsSideEta1->DrawCopy("SAME");
10987 transverseClone = transverse->DrawCopy("SAME");
10988 //transverseSideEta1->DrawCopy("SAME");
10989 awayClone = away->DrawCopy("SAME");
10990 inclusiveClone = inclusive->DrawCopy("SAME");
10991 //inclusive2->DrawCopy("SAME");
10992 //away3->DrawCopy("SAME");
10993
10994 canvas->cd(3);
10995
10996 towardsCentralEtaR = (TH1*) towardsCentralEta->Clone("towardsCentralEtaR");
10997 towardsSideEta1R = (TH1*) towardsSideEta1->Clone("towardsSideEta1R");
10998 transverseR = (TH1*) transverse->Clone("transverseR");
10999 awayR = (TH1*) away->Clone("awayR");
11000
11001 towardsCentralEtaR->Divide(inclusive);
11002 towardsSideEta1R->Divide(inclusive);
11003 transverseR->Divide(inclusive);
11004 awayR->Divide(inclusive);
11005
11006 towardsCentralEtaR->DrawCopy("SAME");
11007 towardsSideEta1R->DrawCopy("SAME");
11008 transverseR->DrawCopy("SAME");
11009 awayR->DrawCopy("SAME");
11010
11011 if (fit == 1)
11012 {
11013 canvas->cd(1);
11014
11015 awayClone->Fit("expo", "", "SAME", 1.1, 2.9);
11016 awayClone->GetFunction("expo")->SetRange(1, 10);
11017 gPad->SetLogx(0);
11018 }
11019 else if (fit == 2)
11020 {
11021 canvas->cd(1);
11022
11023 func = new TF1("func", "[0] * x**[1]");
11024 func->SetParameters(1, 1);
11025
11026 Float_t limitLow = 2.1;
11027 Float_t limitHigh = 4.9;
11028
11029 func2 = (TF1*) func->Clone();
11030 towardsCentralEtaClone->Fit(func2, "", "SAME", limitLow, limitHigh);
11031 towardsCentralEtaClone->GetFunction("func")->SetRange(1, 10);
11032 towardsCentralEtaClone->GetFunction("func")->SetLineColor(towardsCentralEtaClone->GetLineColor());
11033
11034 func2 = (TF1*) func->Clone();
11035 towardsSideEta1Clone->Fit(func2, "", "SAME", limitLow, limitHigh);
11036 towardsSideEta1Clone->GetFunction("func")->SetRange(1, 10);
11037 towardsSideEta1Clone->GetFunction("func")->SetLineColor(towardsSideEta1Clone->GetLineColor());
11038
11039 func2 = (TF1*) func->Clone();
11040 transverseClone->Fit(func2, "", "SAME", limitLow, limitHigh);
11041 transverseClone->GetFunction("func")->SetRange(1, 10);
11042 transverseClone->GetFunction("func")->SetLineColor(transverseClone->GetLineColor());
11043
11044 func2 = (TF1*) func->Clone();
11045 awayClone->Fit(func2, "", "SAME", limitLow, limitHigh);
11046 awayClone->GetFunction("func")->SetRange(1, 10);
11047 awayClone->GetFunction("func")->SetLineColor(awayClone->GetLineColor());
11048
11049 func2 = (TF1*) func->Clone();
11050 inclusiveClone->Fit(func2, "", "SAME", limitLow, limitHigh);
11051 inclusiveClone->GetFunction("func")->SetRange(1, 10);
11052 inclusiveClone->GetFunction("func")->SetLineColor(inclusiveClone->GetLineColor());
11053 }
11054
11055 // subtract transverse part
11056 away->Add(transverse, -1);
11057 //away3->Add(transverseSideEta1, -1);
11058 towardsCentralEta->Add(transverse, -1);
11059 towardsSideEta1->Add(transverse, -1);
11060 //inclusive->Add(transverse, -1);
11061
11062 canvas->cd(2);
11063 towardsCentralEta->DrawCopy("SAME");
11064 towardsSideEta1->DrawCopy("SAME");
11065 away->DrawCopy("SAME");
11066 inclusive->DrawCopy("SAME");
11067 //away3->DrawCopy("SAME");
11068
11069 canvas->cd(4);
11070
11071 towardsCentralEtaR = (TH1*) towardsCentralEta->Clone("towardsCentralEtaR2");
11072 towardsSideEta1R = (TH1*) towardsSideEta1->Clone("towardsSideEta1R2");
11073 awayR = (TH1*) away->Clone("awayR2");
11074
11075 towardsCentralEtaR->Divide(inclusive);
11076 towardsSideEta1R->Divide(inclusive);
11077 awayR->Divide(inclusive);
11078
11079 towardsCentralEtaR->DrawCopy("SAME");
11080 towardsSideEta1R->DrawCopy("SAME");
11081 awayR->DrawCopy("SAME");
11082
11083 if (fit == 1)
11084 {
11085 canvas->cd(2);
11086
11087 away->Fit("expo", "", "SAME", 1.1, 2.9);
11088 away->GetFunction("expo")->SetRange(1, 10);
11089 gPad->SetLogx(0);
11090 }
11091 else if (fit == 2)
11092 {
11093 canvas->cd(2);
11094
11095 func = new TF1("func", "[0] * x**[1]");
11096 func->SetParameters(1, 1);
11097
11098 func2 = (TF1*) func->Clone();
11099 towardsCentralEta->Fit(func2, "", "SAME", limitLow, limitHigh);
11100 func2->SetRange(1, 10);
11101
11102 func2 = (TF1*) func->Clone();
11103 towardsSideEta1->Fit(func2, "", "SAME", limitLow, limitHigh);
11104 func2->SetRange(1, 10);
11105
11106 func2 = (TF1*) func->Clone();
11107 away->Fit(func2, "", "SAME", limitLow, limitHigh);
11108 func2->SetRange(1, 10);
11109
11110 func2 = (TF1*) func->Clone();
11111 inclusive->Fit(func2, "", "SAME", limitLow, limitHigh);
11112 func2->SetRange(1, 10);
11113 }
11114
11115 for (Int_t i=1; i<=2; i++)
11116 {
11117 canvas->cd(i);
11118
11119 TString str3;
11120 str3.Form("%d-%d%%", (Int_t) h->GetCentralityDistribution()->GetXaxis()->GetBinLowEdge(centrBegin), (Int_t) h->GetCentralityDistribution()->GetXaxis()->GetBinUpEdge(centrEnd));
11121 latex = new TLatex(0.2, 0.3, str3);
11122 latex->SetNDC();
11123 latex->SetTextSize(0.06);
11124
11125 latex2 = new TLatex(0.55, 0.6, str);
11126 latex2->SetNDC();
11127 latex2->SetTextSize(0.06);
11128
11129 latex->Draw();
11130 latex2->Draw();
11131
11132 legend->Draw();
11133 }
11134}
11135
11136void CombineDeltaPhiWithWeighting()
11137{
11138 // From Hermes:
11139 // For LHC11a2a:
11140 // xsection: 11.879829, ntrials: 8132994.000000
11141 //
11142 // For LHC11a2b:
11143 // xsection: 0.623421, ntrials: 2293420.000000
11144 //
11145 // For LHC11a2c:
11146 // xsection: 0.043815, ntrials: 1314525.375000
11147
11148 // TODO is merging only same event distribution at present
11149
11150 loadlibs();
11151
11152 Int_t nInput = 3;
11153 const char* inputList[] = { "mergejob/LHC11a2a_110124.root", "mergejob/LHC11a2b_110131.root", "mergejob/LHC11a2c_110131.root" };
11154
11155 Float_t xSections[] = { 11.879829 * 1e6 / 8132994, 0.623421 * 1e6 / 2293420, 0.043815 * 1e6 / 1314525 };
11156 xSections[2] /= xSections[0];
11157 xSections[1] /= xSections[0];
11158 xSections[0] /= xSections[0];
11159
11160 AliUEHistograms* files[3];
11161 TList* finalList = 0;
11162 for (Int_t i=0; i<nInput; i++)
11163 {
11164 files[i] = (AliUEHistograms*) GetUEHistogram(inputList[i], (i == 0) ? &finalList : 0);
11165 if (i > 0)
11166 {
11167 files[i]->Scale(xSections[i]);
11168
11169 TList* list2 = new TList;
11170 list2->Add(files[i]);
11171 files[0]->Merge(list2);
11172 }
11173 }
11174
11175 TFile* file3 = TFile::Open("out.root", "RECREATE");
11176 file3->mkdir("PWG4_PhiCorrelations");
11177 file3->cd("PWG4_PhiCorrelations");
11178 finalList->Write(0, TObject::kSingleKey);
11179 file3->Close();
11180}
11181
11182void NormalizeToBinWidth(TH1* hist)
11183{
11184 //
11185 // normalizes a 1-d histogram to its bin width
11186 //
11187
11188 if (hist->GetDimension() == 1)
11189 {
11190 for (Int_t i=1; i<=hist->GetNbinsX(); ++i)
11191 {
11192 hist->SetBinContent(i, hist->GetBinContent(i) / hist->GetBinWidth(i));
11193 hist->SetBinError(i, hist->GetBinError(i) / hist->GetBinWidth(i));
11194 }
11195 }
11196 else if (hist->GetDimension() == 2)
11197 {
11198 for (Int_t i=1; i<=hist->GetNbinsX(); ++i)
11199 {
11200 for (Int_t j=1; j<=hist->GetNbinsY(); ++j)
11201 {
11202 hist->SetBinContent(i, j, hist->GetBinContent(i, j) / hist->GetXaxis()->GetBinWidth(i) / hist->GetYaxis()->GetBinWidth(j));
11203 hist->SetBinError(i, j, hist->GetBinError(i) / hist->GetXaxis()->GetBinWidth(i) / hist->GetYaxis()->GetBinWidth(j));
11204 }
11205 }
11206 }
11207}
11208
11209void GetAcceptanceScalingFactor(const char* fileName1, Float_t eta1 = 0.8, Float_t eta2 = 1.6)
11210{
11211 loadlibs();
11212
11213 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName1, 0, kTRUE);
11214 h->SetPtRange(1.01, 39.99);
11215
11216 new TCanvas;
11217 mixed = ((TH2*)h->GetUEHist(2)->GetUEHist(6, 0, 1.01, 39.99, 0, 16, kTRUE))->ProjectionY();
11218 mixed->DrawCopy();
11219
11220 Float_t left = mixed->Integral(mixed->FindBin(-eta2 + 0.01), mixed->FindBin(-eta1 - 0.01));
11221 Float_t center = mixed->Integral(mixed->FindBin(-eta1 + 0.01), mixed->FindBin(eta1 - 0.01));
11222 Float_t right = mixed->Integral(mixed->FindBin(eta1 + 0.01), mixed->FindBin(eta2 - 0.01));
11223
11224 Printf("%f %f %f", left, center, right);
11225 Printf("%f", (left + right) / center);
11226}
11227
11228void TrackingEfficiencyCentralityDependence(const char* fileName, Int_t step1 = 2, Int_t step2 = 4)
11229{
11230 Int_t nCentralityBins = 3;
11231 Float_t centralityBins[] = { 0, 20, 40, 90 };
11232
11233 Int_t colors[] = { 1, 2, 4, 6 };
11234
11235 loadlibs();
11236
11237 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
11238
11239 new TCanvas;
11240 dummy = new TH2F("dummy", ";p_{T};tracking efficiency", 100, 0, 20, 100, 0.7, 1.3);
11241 dummy->SetStats(0);
11242 dummy->Draw();
11243
11244 legend = new TLegend(0.13, 0.67, 0.31, 0.87);
11245 legend->SetTextSize(0.04);
11246 legend->SetFillColor(0);
11247
11248 for (Int_t i=0; i<nCentralityBins; i++)
11249 {
11250 eventHist = h->GetUEHist(2)->GetEventHist();
11251
11252 eventHist->GetGrid(step1)->SetRangeUser(1, centralityBins[i] + 0.1, centralityBins[i+1] - 0.1);
11253 eventHist->GetGrid(step2)->SetRangeUser(1, centralityBins[i] + 0.1, centralityBins[i+1] - 0.1);
11254
11255 TH1* hist1 = eventHist->ShowProjection(0, step1);
11256 TH1* hist2 = eventHist->ShowProjection(0, step2);
11257
11258 hist2->Divide(hist1);
11259
11260 hist2->SetLineColor(colors[i]);
11261 hist2->GetYaxis()->SetTitle("tracking efficiency");
11262 hist2->Draw("SAME");
11263
11264 legend->AddEntry(hist2, Form("%.0f-%.0f%%", centralityBins[i], centralityBins[i+1]));
11265 }
11266
11267 legend->Draw();
11268}
11269
11270
11271TGraphErrors* ReadHepdata(const char* fileName, Bool_t errorsAreAdded = kFALSE, Int_t skipYErrors = 0, Int_t skipXerrors = 1)
11272{
11273 // expected format: x [x2] y [ye] [ye2] [xe]
11274 //
11275 // skipYErrors: 0 --> ye present
11276 // 1 --> no errors ye
11277 // 2 --> y and ye are lower and upper error, i.e. y' = (y + ye) / 2 and ye = (ye - y) / 2
11278 // 3 --> ye and ye2 are stat and syst error, will be added in quadrature
11279 //
11280 // skipXerrors: 0 --> xe present
11281 // 1 --> no errors xe
11282 // 2 --> x2 present, xe not present and is calculated from x2 - x
11283
11284 ifstream fin(fileName);
11285
11286 graph = new TGraphErrors(0);
11287
11288 Double_t sum = 0;
11289
11290 while (fin.good())
11291 {
11292 char buffer[2000];
11293 if (fin.peek() == '#')
11294 {
11295 fin.getline(buffer, 2000);
11296 continue;
11297 }
11298
11299 Double_t x = -1;
11300 Double_t x2 = -1;
11301 Double_t y = -1;
11302 Double_t ye = 0;
11303 Double_t xe = 0;
11304
11305 fin >> x;
11306
11307 if (skipXerrors == 2)
11308 {
11309 fin >> x2;
11310 xe = (x2 - x + 1) / 2;
11311 x = x + (x2 - x) / 2;
11312 }
11313
11314 fin >> y;
11315
11316 if (y == -1)
11317 continue;
11318
11319 if (skipYErrors == 0)
11320 {
11321 ye = -1;
11322 fin >> ye;
11323 if (ye == -1)
11324 continue;
11325 }
11326 else if (skipYErrors == 2)
11327 {
11328 ye = -1;
11329 fin >> ye;
11330 if (ye == -1)
11331 continue;
11332
11333 Double_t newy = (y + ye) / 2;
11334 ye = (ye - y) / 2;
11335 y = newy;
11336 }
11337 else if (skipYErrors == 3)
11338 {
11339 ye = -1;
11340 fin >> ye;
11341 if (ye == -1)
11342 continue;
11343
11344 Double_t ye2 = -1;
11345 fin >> ye2;
11346 if (ye2 == -1)
11347 continue;
11348
11349 ye = TMath::Sqrt(ye*ye + ye2*ye2);
11350 }
11351
11352 if (skipXerrors == 0)
11353 {
11354 xe = -1;
11355 fin >> xe;
11356 if (xe == -1)
11357 continue;
11358 }
11359
11360 //Printf("%f %f %f %f", x, y, xe, ye);
11361
11362 if (errorsAreAdded)
11363 ye -= y;
11364
11365 graph->SetPoint(graph->GetN(), x, y);
11366 graph->SetPointError(graph->GetN()-1, xe, ye);
11367
11368 sum += y;
11369
11370 // read rest until end of line...
11371 fin.getline(buffer, 2000);
11372 }
11373 fin.close();
11374
11375 Printf("%s: %f", fileName, sum);
11376
11377 return graph;
11378}
11379
11380void EvaluateParticleEfficiency(const char* fileName)
11381{
11382 Int_t centralityBegin = 1;
11383 Int_t centralityEnd = 15;
11384
11385 if (1)
11386 {
11387 Int_t step1 = 4;
11388 Int_t step2 = 5;
11389 }
11390 else
11391 {
11392 Int_t step1 = 2;
11393 Int_t step2 = 4;
11394 }
11395
11396 Float_t ptTriggerBegin = 4.01;
11397 Float_t ptTriggerEnd = 19.99;
11398
11399 Bool_t verbose = 1;
11400
11401 loadlibs();
11402
11403 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
11404 AliUEHist* cont = h->GetUEHist(2);
11405
11406 cont->GetEventHist()->GetGrid(step1)->GetGrid()->GetAxis(1)->SetRange(centralityBegin, centralityEnd);
11407 cont->GetEventHist()->GetGrid(step2)->GetGrid()->GetAxis(1)->SetRange(centralityBegin, centralityEnd);
11408
11409 Int_t stepEff1 = step1 - (Int_t) AliUEHist::kCFStepAnaTopology;
11410 if (stepEff1 == -1)
11411 stepEff1 = 0;
11412 Int_t stepEff2 = step2 - (Int_t) AliUEHist::kCFStepAnaTopology;
11413 if (stepEff2 == -1)
11414 stepEff2 = 0;
11415
11416 cont->GetTrackHistEfficiency()->GetGrid(stepEff1)->GetGrid()->GetAxis(3)->SetRange(centralityBegin, centralityEnd);
11417 cont->GetTrackHistEfficiency()->GetGrid(stepEff2)->GetGrid()->GetAxis(3)->SetRange(centralityBegin, centralityEnd);
11418
11419 TH1* triggerParticle = cont->GetEventHist()->Project(step2, 0);
11420 triggerParticle->Divide(cont->GetEventHist()->Project(step1, 0));
11421
11422 TH1* singleParticle = cont->GetTrackHistEfficiency()->Project(stepEff2, 1);
11423 singleParticle->Divide(cont->GetTrackHistEfficiency()->Project(stepEff1, 1));
11424
11425 //singleParticle = singleParticle->Rebin(triggerParticle->GetNbinsX(), "singleRebin", triggerParticle->GetXaxis()->GetXbins()->GetArray());
11426
11427 TGraphErrors* effectiveEffect = new TGraphErrors;
11428 TGraphErrors* triggerCorrelatedEffect = new TGraphErrors;
11429 TGraphErrors* afterBaseLine = new TGraphErrors;
11430 TGraphErrors* triggerCorrelatedEffect2D = new TGraphErrors;
11431
11432 //TVirtualFitter::SetDefaultFitter("Linear");
11433
11434 for (Int_t bin=3; bin<=triggerParticle->GetNbinsX(); bin++)
11435 {
11436 if (triggerParticle->GetBinCenter(bin) > 10)
11437 continue;
11438
11439 cont->SetPtRange(triggerParticle->GetXaxis()->GetBinLowEdge(bin) + 0.01, triggerParticle->GetXaxis()->GetBinUpEdge(bin) - 0.01);
11440
11441 TH1* hist1 = cont->GetUEHist(step1, 0, ptTriggerBegin, ptTriggerEnd, centralityBegin, centralityEnd);
11442 TH1* hist2 = cont->GetUEHist(step2, 0, ptTriggerBegin, ptTriggerEnd, centralityBegin, centralityEnd);
11443
11444 // TODO the uncertainties on the ratios should be properly calculated! (if that helps ;))
11445 clone = (TH1*) hist2->Clone("clone");
11446 clone->Divide(hist1);
11447
11448 //func = new TF1("func", "[0]", -10, 10);
11449
11450 if ((Int_t) clone->Fit("pol0", "0", "", -10, 10) == 0)
11451 {
11452 func = clone->GetFunction("pol0");
11453 effectiveEffect->SetPoint(effectiveEffect->GetN(), triggerParticle->GetBinCenter(bin) - 0.2, func->GetParameter(0));
11454 effectiveEffect->SetPointError(effectiveEffect->GetN()-1, 0, func->GetParError(0));
11455
11456 if (verbose)
11457 {
11458 new TCanvas;
11459 clone->GetYaxis()->SetRangeUser(0.9, 1.3);
11460 clone->Draw();
11461 func->DrawClone("SAME");
11462 }
11463 }
11464
11465 if ((Int_t) clone->Fit("pol0", "0", "", -0.3, 0.3) == 0)
11466 {
11467 func = clone->GetFunction("pol0");
11468 triggerCorrelatedEffect->SetPoint(triggerCorrelatedEffect->GetN(), triggerParticle->GetBinCenter(bin) - 0.1, func->GetParameter(0));
11469 triggerCorrelatedEffect->SetPointError(triggerCorrelatedEffect->GetN()-1, 0, func->GetParError(0));
11470
11471 if (verbose)
11472 {
11473 func->SetLineColor(2);
11474 func->DrawClone("SAME");
11475 }
11476 }
11477
11478 if ((Int_t) hist2->Fit("pol0", "0", "", 1, 2) == 0)
11479 {
11480 func = hist2->GetFunction("pol0");
11481 func->SetRange(-10, 10);
11482 hist2->Add(func, -1);
11483
11484 if ((Int_t) hist1->Fit("pol0", "0", "", 1, 2) == 0)
11485 {
11486 func = hist1->GetFunction("pol0");
11487 func->SetRange(-10, 10);
11488 hist1->Add(func, -1);
11489
11490 //new TCanvas; hist1->DrawCopy();
11491
11492 hist2->Divide(hist1);
11493
11494 if ((Int_t) hist2->Fit("pol0", "0", "", -0.3, 0.3) == 0)
11495 {
11496 func = hist2->GetFunction("pol0");
11497 afterBaseLine->SetPoint(afterBaseLine->GetN(), triggerParticle->GetBinCenter(bin) + 0.2, func->GetParameter(0));
11498 afterBaseLine->SetPointError(afterBaseLine->GetN()-1, 0, func->GetParError(0));
11499
11500 if (verbose)
11501 {
11502 new TCanvas;
11503 hist2->GetYaxis()->SetRangeUser(0.9, 1.3);
11504 hist2->DrawCopy();
11505 func->SetLineColor(4);
11506 func->DrawClone("SAME");
11507 }
11508 }
11509 }
11510 }
11511
11512 // 2d
11513 TH2* hist1_2D = cont->GetUEHist(step1, 0, ptTriggerBegin, ptTriggerEnd, centralityBegin, centralityEnd, 1);
11514 TH2* hist2_2D = cont->GetUEHist(step2, 0, ptTriggerBegin, ptTriggerEnd, centralityBegin, centralityEnd, 1);
11515
11516 //((TH2*)hist1)->Rebin2D(2, 2); ((TH2*)hist2)->Rebin2D(2, 2);
11517
11518 hist2_2D->Divide(hist1_2D);
11519
11520 if (verbose)
11521 {
11522 new TCanvas;
11523 hist2_2D->Draw("COLZ");
11524 }
11525
11526 //Printf("%d %d %d %d", hist2_2D->GetXaxis()->FindBin(-0.01), hist2_2D->GetXaxis()->FindBin(0.01), hist2_2D->GetYaxis()->FindBin(-0.01), hist2_2D->GetYaxis()->FindBin(0.01));
11527
11528 Double_t error;
11529 Float_t integral = hist2_2D->IntegralAndError(hist2_2D->GetXaxis()->FindBin(-0.01), hist2_2D->GetXaxis()->FindBin(0.01), hist2_2D->GetYaxis()->FindBin(-0.01), hist2_2D->GetYaxis()->FindBin(0.01), error);
11530
11531 integral /= hist2_2D->GetXaxis()->FindBin(0.01) - hist2_2D->GetXaxis()->FindBin(-0.01) + 1;
11532 integral /= hist2_2D->GetYaxis()->FindBin(0.01) - hist2_2D->GetYaxis()->FindBin(-0.01) + 1;
11533
11534 error /= hist2_2D->GetXaxis()->FindBin(0.01) - hist2_2D->GetXaxis()->FindBin(-0.01) + 1;
11535 error /= hist2_2D->GetYaxis()->FindBin(0.01) - hist2_2D->GetYaxis()->FindBin(-0.01) + 1;
11536
11537 triggerCorrelatedEffect2D->SetPoint(triggerCorrelatedEffect2D->GetN(), triggerParticle->GetBinCenter(bin) + 0.1, integral);
11538 triggerCorrelatedEffect2D->SetPointError(triggerCorrelatedEffect2D->GetN()-1, 0, error);
11539
11540 if (verbose)
11541 break;
11542 }
11543
11544 new TCanvas;
11545 triggerParticle->Draw();
11546 triggerParticle->GetXaxis()->SetRangeUser(0, 9.9);
11547
11548 singleParticle->SetLineColor(2);
11549 //singleParticle->Draw("SAME");
11550
11551 effectiveEffect->SetMarkerStyle(24);
11552 effectiveEffect->Draw("PSAME");
11553
11554 triggerCorrelatedEffect->SetMarkerStyle(25);
11555 triggerCorrelatedEffect->SetMarkerColor(2);
11556 triggerCorrelatedEffect->SetLineColor(2);
11557 triggerCorrelatedEffect->Draw("PSAME");
11558
11559 triggerCorrelatedEffect2D->SetMarkerStyle(27);
11560 triggerCorrelatedEffect2D->SetMarkerColor(3);
11561 triggerCorrelatedEffect2D->SetLineColor(3);
11562 triggerCorrelatedEffect2D->Draw("PSAME");
11563
11564 afterBaseLine->SetMarkerStyle(26);
11565 afterBaseLine->SetMarkerColor(4);
11566 afterBaseLine->SetLineColor(4);
11567 afterBaseLine->Draw("PSAME");
11568
11569 legend = new TLegend(0.66, 0.15, 0.88, 0.38);
11570 legend->SetFillColor(0);
11571 legend->SetTextSize(0.04);
11572 legend->AddEntry(triggerParticle, "trigger", "L");
11573 //legend->AddEntry(singleParticle, "single", "L");
11574 legend->AddEntry(effectiveEffect, "effective", "P");
11575 legend->AddEntry(triggerCorrelatedEffect, "at 0", "P");
11576 legend->AddEntry(triggerCorrelatedEffect2D, "at 0 (2d)", "P");
11577 legend->AddEntry(afterBaseLine, "baseline", "P");
11578 legend->Draw();
11579}
11580
11581void EvaluateParticleEfficiency2D(const char* fileName)
11582{
11583 Int_t centralityBegin = 1;
11584 Int_t centralityEnd = 15;
11585
11586 if (1)
11587 {
11588 Int_t step1 = 4;
11589 Int_t step2 = 5;
11590 }
11591 else
11592 {
11593 Int_t step1 = 2;
11594 Int_t step2 = 4;
11595 }
11596
11597 Bool_t verbose = 0;
11598
11599 loadlibs();
11600
11601 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
11602 AliUEHist* cont = h->GetUEHist(2);
11603
11604 cont->GetEventHist()->GetGrid(step1)->GetGrid()->GetAxis(1)->SetRange(centralityBegin, centralityEnd);
11605 cont->GetEventHist()->GetGrid(step2)->GetGrid()->GetAxis(1)->SetRange(centralityBegin, centralityEnd);
11606
11607 Int_t stepEff1 = step1 - (Int_t) AliUEHist::kCFStepAnaTopology;
11608 if (stepEff1 == -1)
11609 stepEff1 = 0;
11610 Int_t stepEff2 = step2 - (Int_t) AliUEHist::kCFStepAnaTopology;
11611 if (stepEff2 == -1)
11612 stepEff2 = 0;
11613
11614 cont->GetTrackHistEfficiency()->GetGrid(stepEff1)->GetGrid()->GetAxis(3)->SetRange(centralityBegin, centralityEnd);
11615 cont->GetTrackHistEfficiency()->GetGrid(stepEff2)->GetGrid()->GetAxis(3)->SetRange(centralityBegin, centralityEnd);
11616
11617 TH1* triggerParticle = cont->GetEventHist()->Project(step2, 0);
11618 triggerParticle->Divide(cont->GetEventHist()->Project(step1, 0));
11619
11620 TH1* singleParticle = cont->GetTrackHistEfficiency()->Project(stepEff2, 1);
11621 singleParticle->Divide(cont->GetTrackHistEfficiency()->Project(stepEff1, 1));
11622
11623 cont->GetTrackHist(0)->GetGrid(step1)->SetRangeUser(0, -0.01, 0.01); // delta eta
11624 cont->GetTrackHist(0)->GetGrid(step1)->SetRangeUser(4, -0.01, 0.01); // delta phi
11625 TH2* tracksStep1 = (TH2*) cont->GetTrackHist(0)->Project(step1, 1, 2);
11626
11627 cont->GetTrackHist(0)->GetGrid(step2)->SetRangeUser(0, -0.01, 0.01); // delta eta
11628 cont->GetTrackHist(0)->GetGrid(step2)->SetRangeUser(4, -0.01, 0.01); // delta phi
11629 TH2* tracksStep2 = (TH2*) cont->GetTrackHist(0)->Project(step2, 1, 2);
11630
11631 tracksStep2->Divide(tracksStep1);
11632
11633 TH1* triggersStep1 = cont->GetEventHist()->Project(step1, 0);
11634 TH1* triggersStep2 = cont->GetEventHist()->Project(step2, 0);
11635
11636 for (Int_t x=1; x<=tracksStep2->GetNbinsX(); x++)
11637 for (Int_t y=1; y<=tracksStep2->GetNbinsY(); y++)
11638 if (singleParticle->GetBinContent(x) > 0)
11639 tracksStep2->SetBinContent(x, y, tracksStep2->GetBinContent(x, y) / triggersStep2->GetBinContent(y) * triggersStep1->GetBinContent(y) / singleParticle->GetBinContent(x));
11640 else
11641 tracksStep2->SetBinContent(x, y, 0);
11642
11643 new TCanvas;
11644 tracksStep2->Draw("COLZ");
11645
11646 TGraphErrors** triggerCorrelatedEffect2D = new TGraphErrors*[triggerParticle->GetNbinsX()+1];
11647 TGraphErrors** triggerCorrelatedEffect2DSub = new TGraphErrors*[triggerParticle->GetNbinsX()+1];
11648
11649 for (Int_t bin1=0; bin1<=triggerParticle->GetNbinsX(); bin1++)
11650 {
11651 triggerCorrelatedEffect2D[bin1] = 0;
11652 triggerCorrelatedEffect2DSub[bin1] = 0;
11653 }
11654
11655 for (Int_t bin1=5; bin1<=triggerParticle->GetNbinsX(); bin1++)
11656 {
11657 if (triggerParticle->GetBinCenter(bin1) > 10)
11658 continue;
11659
11660 Float_t ptTriggerBegin = triggerParticle->GetXaxis()->GetBinLowEdge(bin1) + 0.01;
11661 Float_t ptTriggerEnd = triggerParticle->GetXaxis()->GetBinUpEdge(bin1) - 0.01;
11662
11663 for (Int_t bin2=3; bin2<=triggerParticle->GetNbinsX(); bin2++)
11664 {
11665 if (triggerParticle->GetBinCenter(bin2) > 8)
11666 continue;
11667
11668 if (bin2 > bin1)
11669 continue;
11670
11671 cont->SetPtRange(triggerParticle->GetXaxis()->GetBinLowEdge(bin2) + 0.01, triggerParticle->GetXaxis()->GetBinUpEdge(bin2) - 0.01);
11672
11673 // 2d
11674 TH2* hist1_2D = cont->GetUEHist(step1, 0, ptTriggerBegin, ptTriggerEnd, centralityBegin, centralityEnd, 1);
11675 TH2* hist2_2D = cont->GetUEHist(step2, 0, ptTriggerBegin, ptTriggerEnd, centralityBegin, centralityEnd, 1);
11676
11677 //((TH2*)hist1)->Rebin2D(2, 2); ((TH2*)hist2)->Rebin2D(2, 2);
11678
11679 hist2_2D->Divide(hist1_2D);
11680
11681 if (verbose)
11682 {
11683 new TCanvas;
11684 hist2_2D->Draw("COLZ");
11685 }
11686
11687 //Printf("%d %d %d %d", hist2_2D->GetXaxis()->FindBin(-0.01), hist2_2D->GetXaxis()->FindBin(0.01), hist2_2D->GetYaxis()->FindBin(-0.01), hist2_2D->GetYaxis()->FindBin(0.01));
11688
11689 Double_t error;
11690 Float_t integral = hist2_2D->IntegralAndError(hist2_2D->GetXaxis()->FindBin(-0.01), hist2_2D->GetXaxis()->FindBin(0.01), hist2_2D->GetYaxis()->FindBin(-0.01), hist2_2D->GetYaxis()->FindBin(0.01), error);
11691
11692 integral /= hist2_2D->GetXaxis()->FindBin(0.01) - hist2_2D->GetXaxis()->FindBin(-0.01) + 1;
11693 integral /= hist2_2D->GetYaxis()->FindBin(0.01) - hist2_2D->GetYaxis()->FindBin(-0.01) + 1;
11694
11695 error /= hist2_2D->GetXaxis()->FindBin(0.01) - hist2_2D->GetXaxis()->FindBin(-0.01) + 1;
11696 error /= hist2_2D->GetYaxis()->FindBin(0.01) - hist2_2D->GetYaxis()->FindBin(-0.01) + 1;
11697
11698 if (integral <= 0)
11699 continue;
11700
11701 if (!triggerCorrelatedEffect2D[bin1])
11702 triggerCorrelatedEffect2D[bin1] = new TGraphErrors;
11703
11704 triggerCorrelatedEffect2D[bin1]->SetPoint(triggerCorrelatedEffect2D[bin1]->GetN(), triggerParticle->GetBinCenter(bin2) - 0.5 + 0.1 * bin1, integral);
11705 triggerCorrelatedEffect2D[bin1]->SetPointError(triggerCorrelatedEffect2D[bin1]->GetN()-1, 0, error);
11706
11707 if (!triggerCorrelatedEffect2DSub[bin1])
11708 triggerCorrelatedEffect2DSub[bin1] = new TGraphErrors;
11709
11710 triggerCorrelatedEffect2DSub[bin1]->SetPoint(triggerCorrelatedEffect2DSub[bin1]->GetN(), triggerParticle->GetBinCenter(bin2) - 0.5 + 0.1 * bin1, integral / triggerParticle->GetBinContent(bin2));
11711 triggerCorrelatedEffect2DSub[bin1]->SetPointError(triggerCorrelatedEffect2DSub[bin1]->GetN()-1, 0, error / triggerParticle->GetBinContent(bin2));
11712
11713 if (verbose)
11714 break;
11715 }
11716
11717 if (verbose)
11718 break;
11719 }
11720
11721 new TCanvas;
11722 triggerParticle->Draw();
11723 triggerParticle->GetXaxis()->SetRangeUser(0, 9.9);
11724
11725 legend = new TLegend(0.66, 0.15, 0.88, 0.38);
11726 legend->SetFillColor(0);
11727 legend->SetTextSize(0.04);
11728 legend->AddEntry(triggerParticle, "trigger", "L");
11729
11730 Int_t marker = 20;
11731 Int_t color = 1;
11732
11733 for (Int_t bin1=3; bin1<=triggerParticle->GetNbinsX(); bin1++)
11734 if (triggerCorrelatedEffect2D[bin1])
11735 {
11736 triggerCorrelatedEffect2D[bin1]->SetMarkerStyle(marker++);
11737 triggerCorrelatedEffect2D[bin1]->SetMarkerColor(color);
11738 triggerCorrelatedEffect2D[bin1]->SetLineColor(color++);
11739 triggerCorrelatedEffect2D[bin1]->Draw("PSAME");
11740 legend->AddEntry(triggerCorrelatedEffect2D[bin1], Form("pt %.2f", triggerParticle->GetBinCenter(bin1)), "P");
11741 }
11742
11743 legend->Draw();
11744
11745 new TCanvas;
11746 triggerParticle->Draw();
11747 triggerParticle->GetXaxis()->SetRangeUser(0, 9.9);
11748
11749 marker = 20;
11750 color = 1;
11751
11752 for (Int_t bin1=3; bin1<=triggerParticle->GetNbinsX(); bin1++)
11753 if (triggerCorrelatedEffect2DSub[bin1])
11754 {
11755 triggerCorrelatedEffect2DSub[bin1]->SetMarkerStyle(marker++);
11756 triggerCorrelatedEffect2DSub[bin1]->SetMarkerColor(color);
11757 triggerCorrelatedEffect2DSub[bin1]->SetLineColor(color++);
11758 triggerCorrelatedEffect2DSub[bin1]->Draw("PSAME");
11759 }
11760
11761 legend->Draw();
11762}
11763
11764void DrawEventCount(const char* fileName, Int_t step = 8)
11765{
11766 loadlibs();
11767
11768 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
11769 h->GetEventCount()->Draw("TEXT");
11770
11771 eventCount = h->GetEventCount();
11772 Float_t events = eventCount->Integral(eventCount->GetXaxis()->FindBin(step), eventCount->GetXaxis()->FindBin(step), eventCount->GetYaxis()->FindBin(0.01 + 1), eventCount->GetYaxis()->FindBin(-0.01 + 10));
11773 Printf("Events: %f", events);
11774}
11775
11776void FitDCADistributions(const char* fileName1)
11777{
11778 loadlibs();
11779
11780 TFile::Open(fileName1);
11781 list = (TList*) gFile->Get("histosPhiCorrelationsQA");
11782 prim = (TH2*) list->FindObject("fDCAPrimaries");
11783 sec = (TH2*) list->FindObject("fDCASecondaries");
11784
11785 Float_t zCut = 0.5;
11786
11787 TH2* histList[] = { prim, sec };
11788
11789 TH1* primProj = 0;
11790 TH1* secProj = 0;
11791
11792 for (Int_t i=0; i<2; i++)
11793 {
11794 new TCanvas;
11795 gPad->SetGridx();
11796 gPad->SetGridy();
11797 gPad->SetLogy();
11798
11799// hist = histList[i]->ProjectionX("proj", prim->GetYaxis()->FindBin(-zCut), prim->GetYaxis()->FindBin(zCut))->DrawCopy("");
11800 hist = histList[i]->ProjectionY("proj", prim->GetXaxis()->FindBin(-zCut), prim->GetXaxis()->FindBin(zCut))->DrawCopy("");
11801 hist->SetStats(0);
11802
11803 func = new TF1("func", "gaus(0)+gaus(3)");
11804 func->SetParameters(1e6, 0, 0.02, 1e3, 0, 2);
11805 func->FixParameter(1, 0);
11806 func->FixParameter(4, 0);
11807 func->SetParLimits(2, 0, 0.1);
11808 func->SetParLimits(5, 1, 3);
11809
11810 hist->Fit(func, "", "", -2, 2);
11811
11812 func2 = new TF1("func2", "gaus(0)");
11813 func2->SetParameters(1e3, 0, 2);
11814 func2->FixParameter(1, 0);
11815 func2->SetParLimits(2, 0.5, 5);
11816
11817 hist->Fit(func2, "+", "", -2, -1);
11818 func2->SetRange(-3, 3);
11819 func2->Draw("SAME");
11820
11821// break;
11822 }
11823}
11824
11825void CompareDCADistributions(const char* fileName1, const char* fileName2)
11826{
11827 TFile::Open(fileName1);
11828 list = (TList*) gFile->Get("histosPhiCorrelationsQA");
11829 prim = (TH2*) list->FindObject("fDCAPrimaries");
11830 sec = (TH2*) list->FindObject("fDCASecondaries");
11831
11832 TFile::Open(fileName2);
11833 list = (TList*) gFile->Get("histosPhiCorrelationsQA");
11834 all = (TH2*) list->FindObject("fDCAPrimaries");
11835
11836 Float_t zCut = 3.2;
11837
11838 TH2* histList[] = { prim, sec, all };
11839
11840 Float_t count = 0;
11841
11842 TH1* primProj = 0;
11843 TH1* secProj = 0;
11844
11845 new TCanvas;
11846 gPad->SetGridx();
11847 gPad->SetGridy();
11848
11849 for (Int_t i=0; i<3; i++)
11850 {
11851 hist = histList[i]->ProjectionX("proj", prim->GetYaxis()->FindBin(-zCut), prim->GetYaxis()->FindBin(zCut))->DrawCopy(i>0?"SAME":"");
11852 hist->SetStats(0);
11853 //hist = histList[i]->ProjectionY("proj", prim->GetXaxis()->FindBin(-zCut), prim->GetXaxis()->FindBin(zCut))->DrawCopy(i>0?"SAME":"");
11854 hist->SetLineColor(i+1);
11855 if (i == 0)
11856 primProj = hist;
11857 if (i == 1)
11858 secProj = hist;
11859 if (i == 2)
11860 hist->Scale(1.0 / hist->Integral(hist->GetXaxis()->FindBin(-0.5), hist->GetXaxis()->FindBin(0.5)) * count);
11861 else
11862 count += hist->Integral(hist->GetXaxis()->FindBin(-0.5), hist->GetXaxis()->FindBin(0.5));
11863 }
11864
11865 gPad->SetLogy();
11866
11867 ratio = (TH1*) hist->Clone("ratio");
11868 ratio->Add(primProj, -1);
11869
11870/* for (Int_t i=hist->GetXaxis()->FindBin(-0.1); i<=hist->GetXaxis()->FindBin(0.1); i++)
11871 ratio->SetBinContent(i, 0);*/
11872
11873 for (Int_t i=1; i<=hist->GetNbinsX(); i++)
11874 ratio->SetBinError(i, 0);
11875
11876 ratio->SetLineColor(4);
11877 ratio->DrawCopy("SAME E");
11878
11879 new TCanvas;
11880 gPad->SetGridx();
11881 gPad->SetGridy();
11882
11883 ratio->Rebin(4);
11884 secProj = (TH1*) secProj->Clone();
11885 secProj->Rebin(4);
11886
11887 ratio->Divide(secProj);
11888
11889/* for (Int_t i=1; i<=hist->GetNbinsX(); i++)
11890 ratio->SetBinError(i, 0);*/
11891
11892 ratio->Draw("HIST");
11893 ratio->GetYaxis()->SetRangeUser(0.7, 1.3);
11894
11895 ratio->Fit("pol0", "0+", "", -5, -1);
11896 ratio->Fit("pol0", "0+", "", 1, 5);
11897}
11898
11899void TrackCuts_CompareParameters(const char* fileName1, const char* fileName2, const char* histName, const char* cutFolder = "cuts_quality_only")
11900{
11901 // plotWhich: 0 = only before
11902 // 1 = both
11903 // 2 = only after
11904 //
11905 // mirror: kTRUE --> project negative values on the positive side
11906
11907 Int_t plotWhich = 0;
11908 Bool_t mirror = kFALSE;
11909
11910 TFile* files[2];
11911 files[0] = TFile::Open(fileName1);
11912 files[1] = TFile::Open(fileName2);
11913
11914 Int_t count = 0;
11915 Int_t colors[] = { 1, 2, 3, 4, 5, 6 };
11916
11917 TLegend* legend = new TLegend(0.7, 0.85, 0.93, 0.98);
11918 legend->SetTextSize(0.04);
11919 legend->SetFillColor(0);
11920
11921 TCanvas* c1 = new TCanvas(histName, histName, 1200, 600);
11922 c1->Divide(2, 1);
11923 //TCanvas* c2 = new TCanvas("c2", "c2", 800, 600);
11924 //TCanvas* c3 = new TCanvas("c3", "c3", 800, 600);
11925
11926 const char* folders2[] = { "before_cuts", "after_cuts" };
11927 const char* names[] = { "MC", "Data" };
11928 Bool_t first = kTRUE;
11929 for (Int_t j = ((plotWhich < 2) ? 0 : 1); j < ((plotWhich > 0) ? 2 : 1); j++)
11930 {
11931 TH1* base = 0;
11932 TH1* base2 = 0;
11933 for (Int_t i = 0; i < 2; i++)
11934 {
11935 Printf("%d %d", j, i);
11936 TString folder;
11937 folder.Form("%s/%s/%s", cutFolder, folders2[j], histName);
11938 TH1* hist = (TH1*) files[i]->Get(folder);
11939
11940 if (mirror)
11941 {
11942 for (Int_t bin=1; bin<=hist->GetXaxis()->FindBin(-0.0001); bin++)
11943 {
11944 Int_t newBin = hist->GetXaxis()->FindBin(-hist->GetXaxis()->GetBinCenter(bin));
11945 if (bin != newBin)
11946 {
11947 hist->Fill(-hist->GetXaxis()->GetBinCenter(bin), hist->GetBinContent(bin));
11948 hist->SetBinContent(bin, 0);
11949 }
11950 }
11951 }
11952
11953 legend->AddEntry(hist, Form("%s %s", names[i], (plotWhich == 1) ? folders2[j] : " "));
11954
11955 c1->cd(1);
11956 hist->SetLineColor(colors[count]);
11957 hist->Scale(1.0 / hist->Integral());
11958 hist->SetStats(0);
11959 hist->DrawCopy((count == 0) ? "" : "SAME");
11960
11961 switch (i)
11962 {
11963 case 0: base = hist; break;
11964 case 1: base2 = hist; break;
11965 }
11966
11967 count++;
11968 }
11969
11970 TH1* ratio = base;
11971 ratio->Divide(base2);
11972
11973 ratio->GetYaxis()->SetRangeUser(0, 2);
11974
11975 c1->cd(2);
11976 ratio->DrawCopy((first) ? "" : "SAME");
11977 first = kFALSE;
11978 }
11979
11980 c1->cd(1)->SetLogy();
11981 c1->cd(1)->SetGridx();
11982 c1->cd(1)->SetGridy();
11983 legend->Draw();
11984
11985 c1->cd(2)->SetGridx();
11986 c1->cd(2)->SetGridy();
11987
11988 c1->SaveAs(Form("%s.png", histName));
11989}
11990
11991void PlotQA(const char* fileName, const char* tag = "")
11992{
11993 loadlibs();
11994
11995 if (!gGrid && TString(fileName).BeginsWith("alien://"))
11996 TGrid::Connect("alien://");
11997
11998 TFile::Open(fileName);
11999
12000 // phys sel
12001 Int_t runNumber = 0;
12002 list = (TList*) gFile->Get("PhysSel");
12003 if (list)
12004 {
12005 physSel = (AliPhysicsSelection*) list->FindObject("AliPhysicsSelection");
12006// runNumber = physSel->GetCurrentRun();
12007 }
12008
12009 TString tmp(fileName);
12010 tmp.ReplaceAll("alien:///alice/cern.ch/user/j/jgrosseo/gridjob/dir_", "");
12011 tmp.ReplaceAll(".root", ".png");
12012 tmp.ReplaceAll("/", "-");
12013 TString title;
12014 title.Form("QA_%d_%s", runNumber, tmp.Data());
12015 c = new TCanvas(title, title, 1200, 800);
12016 c->Divide(3, 3);
12017
12018 // QA task
12019 list = (TList*) gFile->Get("histosPhiCorrelationsQA");
12020 if (list)
12021 {
12022 prim = (TH2*) list->FindObject("fDCAPrimaries");
12023 dcaxy = prim->ProjectionX("dcaxy", prim->GetYaxis()->FindBin(-3.2), prim->GetYaxis()->FindBin(3.2));
12024 dcaz = prim->ProjectionY("dcaz", prim->GetXaxis()->FindBin(-2.4), prim->GetXaxis()->FindBin(2.4));
12025 centrCorr = (TH2*) list->FindObject("fCentralityCorrelation");
12026
12027 c->cd(1); dcaxy->Draw(); dcaz->SetLineColor(2); dcaz->Draw("SAME"); gPad->SetLogy();
12028 c->cd(6); centrCorr->Draw("COLZ"); gPad->SetLogz();
12029
12030 cuts = (AliESDtrackCuts*) list->FindObject("cuts_quality_dca");
12031 if (cuts)
12032 {
12033 cluster = cuts->GetNClustersTPC(1);
12034 c->cd(3); cluster->Draw();
12035
12036 ptall = (TH1F*) cuts->GetPtHist(1)->Clone("ptall");
12037 if (ptall->Integral() > 0)
12038 ptall->Scale(1.0 / ptall->Integral());
12039
12040 c->cd(7);
12041 ptall->Draw();
12042
12043 TH1* ptIts = 0;
12044 check_its = (AliESDtrackCuts*) list->FindObject("check_its");
12045 if (check_its)
12046 {
12047 ptIts = (TH1F*) check_its->GetPtHist(1)->Clone("ptIts");
12048 if (ptIts->Integral() > 0)
12049 ptIts->Scale(1.0 / ptIts->Integral());
12050 }
12051
12052 TH1* ptItsAcc = 0;
12053 global_cuts = (AliESDtrackCuts*) list->FindObject("global_cuts");
12054 if (global_cuts)
12055 {
12056 ptItsAcc = (TH1*) global_cuts->GetPtHist(1)->Clone("ptItsAcc");
12057 if (ptItsAcc->Integral() > 0)
12058 ptItsAcc->Scale(1.0 / ptItsAcc->Integral());
12059 }
12060
12061 if (ptIts)
12062 {
12063 ptIts->SetLineColor(2);
12064 ptIts->Draw("SAME");
12065 }
12066
12067 if (ptItsAcc)
12068 {
12069 ptItsAcc->SetLineColor(4);
12070 ptItsAcc->Draw("SAME");
12071 }
12072
12073 gPad->SetLogy();
12074 }
12075 }
12076
12077 // centrality task
12078 list = (TList*) gFile->Get("CentralityStat");
12079 TH1* centrQuality = 0;
12080 if (list)
12081 {
12082 centrQuality = (TH1*) list->FindObject("fHOutQuality");
12083
12084 c->cd(4); if (centrQuality) centrQuality->Draw();
12085 }
12086
12087 // phi corr task
12088 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName, 0, kFALSE, tag);
12089
12090 if (h->GetUEHist(2)->GetTrackHist(0)->GetGrid(6)->GetGrid()->GetNbins() == 0)
12091 {
12092 Printf("We have %d axes", ((AliTHn*) h->GetUEHist(2)->GetTrackHist(0)->GetNVar()));
12093
12094// ((AliTHn*) h->GetUEHist(2)->GetTrackHist(0))->ReduceAxis();
12095 ((AliTHn*) h->GetUEHist(2)->GetTrackHist(0))->FillParent();
12096 ((AliTHn*) h->GetUEHist(2)->GetTrackHist(0))->DeleteContainers();
12097 }
12098 centr = h->GetCentralityDistribution();
12099 NormalizeToBinWidth(centr);
12100 Int_t events = (Int_t) h->GetEventCount()->ProjectionX()->GetBinContent(3);
12101 Int_t mergeCount = h->GetMergeCount();
12102
12103 h->SetPtRange(1.01, 3.99);
12104 dphi_corr = h->GetUEHist(2)->GetUEHist(AliUEHist::kCFStepReconstructed, 0, 1.01, 14.99, 1, 8);
12105 if (dphi_corr->GetEntries() == 0)
12106 dphi_corr = h->GetUEHist(2)->GetUEHist(AliUEHist::kCFStepReconstructed+2, 0, 1.01, 14.99, 1, 8);
12107 if (dphi_corr->GetEntries() == 0)
12108 dphi_corr = h->GetUEHist(2)->GetUEHist(AliUEHist::kCFStepAll, 0, 1.01, 14.99, 1, 8);
12109
12110 AliUEHistograms* hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE, tag);
12111 if (hMixed->GetUEHist(2)->GetTrackHist(0)->GetGrid(6)->GetGrid()->GetNbins() == 0)
12112 {
12113// ((AliTHn*) hMixed->GetUEHist(2)->GetTrackHist(0))->ReduceAxis();
12114 ((AliTHn*) hMixed->GetUEHist(2)->GetTrackHist(0))->FillParent();
12115 }
12116
12117 Float_t ptMin = 0.51;
12118 hMixed->SetPtRange(ptMin, 3.99);
12119 dphi_corr_mixed = hMixed->GetUEHist(2)->GetUEHist(AliUEHist::kCFStepReconstructed, 0, ptMin, 14.99, 1, 8);
12120 if (dphi_corr_mixed->GetEntries() == 0)
12121 dphi_corr_mixed = hMixed->GetUEHist(2)->GetUEHist(AliUEHist::kCFStepReconstructed+2, 0, ptMin, 14.99, 1, 8);
12122 if (dphi_corr_mixed->GetEntries() == 0)
12123 dphi_corr_mixed = hMixed->GetUEHist(2)->GetUEHist(AliUEHist::kCFStepAll, 0, ptMin, 14.99, 1, 8);
12124
12125 if (runNumber != 0 && runNumber != h->GetRunNumber())
12126 AliFatal("Run numbers inconsistent");
12127
12128 Printf("%d", h->GetRunNumber());
12129 if (runNumber == 0)
12130 runNumber = h->GetRunNumber();
12131
12132 c->cd(2); dphi_corr->Draw(); dphi_corr->GetYaxis()->SetRangeUser(dphi_corr->GetMinimum() * 0.9, dphi_corr->GetMaximum() * 1.1); dphi_corr_mixed->SetLineColor(2); dphi_corr_mixed->Draw("SAME");
12133 c->cd(5); centr->Draw("HIST");
12134
12135 c->cd(1);
12136 latex = new TLatex(0.15, 0.8, Form("%d events, %d merged objects", events, mergeCount));
12137 latex->SetTextSize(0.075);
12138 latex->SetNDC();
12139 latex->Draw();
12140
12141 c->cd(8);
12142 h->GetEventCount()->Draw("TEXT");
12143
12144 title.Form("QA_%d_%s", runNumber, tmp.Data());
12145 c->SetTitle(title);
12146
12147 gpTMin = 1.0;
12148 gpTMax = 1.99;
12149 h->SetPtRange(gpTMin, gpTMax);
12150 hMixed->SetPtRange(gpTMin, gpTMax);
12151
12152 TH2* hist1 = 0;
12153
12154 c->cd(3);
12155 GetDistAndFlow(h, 0, &hist1, 0, 6, 0, 20, 1.01, 4.99, 1);
12156 hist1->DrawCopy("SURF1");
12157
12158 c->cd(6);
12159 GetDistAndFlow(hMixed, 0, &hist1, 0, 6, 0, 20, 1.01, 4.99, 1);
12160 hist1->DrawCopy("SURF1");
12161
12162 c->cd(9);
12163 GetSumOfRatios(h, hMixed, &hist1, 6, 0, 20, 1.01, 4.99, kTRUE);
12164 if (hist1)
12165 hist1->DrawCopy("SURF1");
12166
12167 c->SaveAs(Form("qa/%s", c->GetTitle()));
12168}
12169
12170void GetEventNumber(const char* fileName)
12171{
12172 loadlibs();
12173
12174 new TCanvas("c1", "", 800, 600);
12175
12176 Int_t nEvent = 0;
12177
12178 TFile::Open(fileName);
12179 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
12180 centr = h->GetCentralityDistribution();
12181 nEvent = h->GetCentralityDistribution()->Integral(h->GetCentralityDistribution()->FindBin(0.01), h->GetCentralityDistribution()->FindBin(59.99));
12182
12183 cout << "Number of events: " << nEvent << endl;
12184 centr->Draw("HIST");
12185}
12186void CompareStepsOnePlot(const char* fileName, Int_t caseId)
12187{
12188 loadlibs();
12189
12190 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
12191
12192 Int_t stepList[] = { 0, 1, 2, 4, 5, 6 };
12193 Int_t stepListNames[] = { 0, 1, 2, 3, 4, 5 };
12194 Int_t nSteps = 6;
12195 //const char* names[] = { "All", "PhysSel+Vertex", "Reco Primaries", "Reco "
12196// //Int_t stepList[] = { 2, 4, 5, 6 };
12197//
12198//
12199// TH1* hist1 = h->GetUEHist(2)->GetUEHist(0, 0, 6.01, 9.99, 6, 14);
12200// TH1* hist2 = h->GetUEHist(2)->GetUEHist(0, 0, 6.01, 7.99, 6, 14);
12201// TH1* hist3 = h->GetUEHist(2)->GetUEHist(0, 0, 8.01, 9.99, 6, 14);
12202//
12203// hist1->Draw();
12204// hist2->SetLineColor(2);
12205// hist2->Draw("SAME");
12206// hist3->SetLineColor(4);
12207// hist3->Draw("SAME");
12208// return;
12209//
12210
12211 legend = new TLegend(0.65, 0.45, 0.85, 0.85);
12212 legend->SetTextSize(0.04);
12213 legend->SetFillColor(0);
12214
12215 TH1* histList[10];
12216
12217 for (Int_t i=0; i<nSteps; i++)
12218 {
12219 //TH1* hist1 = h->GetUEHist(2)->GetEventHist()->Project(stepList[i], 0);
12220
12221/* h->GetUEHist(2)->GetTrackHist(0)->GetGrid(stepList[i])->GetGrid()->GetAxis(1)->SetRangeUser(1.01, 3.99);
12222 h->GetUEHist(2)->GetTrackHist(0)->GetGrid(stepList[i])->GetGrid()->GetAxis(2)->SetRangeUser(4.01, 19.99);
12223 TH1* hist1 = h->GetUEHist(2)->GetTrackHist(0)->Project(stepList[i], 4);*/
12224
12225 if (caseId == 0)
12226 TH1* hist1 = h->GetUEHist(2)->GetUEHist(stepList[i], 0, 1.01, 19.99);
12227 else if (caseId == 1)
12228 TH1* hist1 = h->GetUEHist(2)->GetEventHist()->Project(stepList[i], 0);
12229
12230 //hist1->Rebin(2);
12231 //hist1->Rebin(4);
12232 hist1->SetMarkerStyle(24+i);
12233 hist1->SetTitle("");
12234 hist1->SetStats(0);
12235 hist1->DrawCopy((i==0)?"":"SAME");
12236 hist1->Fit("pol0", "0");
12237 //hist1->Fit("pol0");
12238 histList[i] = hist1;
12239 legend->AddEntry(hist1, Form("Step %d", stepListNames[i]), "P");
12240 }
12241
12242 legend->Draw();
12243
12244 new TCanvas;
12245 legend = new TLegend(0.65, 0.45, 0.85, 0.85);
12246 legend->SetTextSize(0.04);
12247 legend->SetFillColor(0);
12248
12249 for (Int_t i=1; i<nSteps; i++)
12250 {
12251 histList[i]->DrawCopy((i==1)?"":"SAME")->Divide(histList[i-1]);
12252 legend->AddEntry(histList[i], Form("Step %d/%d", stepListNames[i], stepListNames[i-1]), "P");
12253 }
12254
12255 legend->Draw();
12256
12257 new TCanvas;
12258 for (Int_t i=0; i<nSteps; i++)
12259 {
12260 hist1 = histList[i];
12261 func = new TF1("func", "[0]", -10, 10);
12262 hist1->Fit(func, "0", "", 1, 2);
12263 hist1->Add(func, -1);
12264 hist1->DrawCopy((i==0)?"":"SAME");
12265 }
12266
12267 legend->Draw();
12268
12269 new TCanvas;
12270 for (Int_t i=1; i<nSteps; i++)
12271 {
12272 histList[i]->DrawCopy((i==1)?"":"SAME")->Divide(histList[i-1]);
12273 }
12274
12275 legend->Draw();
12276}
12277
12278void PtShift(const char* fileName)
12279{
12280 loadlibs();
12281
12282 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
12283
12284 new TCanvas;
12285 gPad->SetLogy();
12286
12287 ptHist3 = h->GetCorrelationpT()->ProjectionY();
12288 ptHist3->GetXaxis()->SetRangeUser(0, 20);
12289 //ptHist3->Sumw2();
12290
12291 /*
12292 func = new TF1("func", "[0]+[1]*x**[2]", 4, 20);
12293 func->SetParLimits(2, -10, -1);
12294 func->SetParameters(0, 1, -4);
12295 ptHist3->Fit(func, "", "", 4, 20);
12296
12297 return;
12298 */
12299
12300 ptHist3Shifted = (TH1*) ptHist3->Clone("ptHist3Shifted");
12301 for (Int_t i=1; i<ptHist3Shifted->GetNbinsX(); i++)
12302 //ptHist3Shifted->SetBinContent(i, ptHist3Shifted->GetBinContent(i+3));
12303 ptHist3Shifted->SetBinContent(i, ptHist3Shifted->GetBinContent(1.1*i));
12304
12305 // 10% or 750 MeV
12306
12307 ptHist3Shifted->SetLineColor(2);
12308
12309 ptHist3->Rebin(2);
12310 ptHist3Shifted->Rebin(2);
12311
12312 ptHist3->DrawCopy();
12313 ptHist3Shifted->DrawCopy("SAME");
12314
12315 new TCanvas;
12316 ptHist3->Divide(ptHist3Shifted);
12317 ptHist3->Draw();
12318
12319 //ptHist3->Rebin(2); ptHist3->Scale(1.0 / 2);
12320
12321 gPad->SetGridx();
12322 gPad->SetGridy();
12323}
12324
12325void RAA(const char* fileName, const char* fileName2)
12326{
12327 loadlibs();
12328
12329 TH1* hist[2];
12330
12331 for (Int_t j=0; j<2; j++)
12332 {
12333 if (j == 0)
12334 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
12335 else
12336 {
12337 if (!fileName2)
12338 break;
12339
12340 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName2);
12341 }
12342
12343 ptHist3 = h->GetCorrelationpT()->ProjectionY(Form("proj1_%d", j), 1, 5);
12344 ptHist3->GetXaxis()->SetRangeUser(0, 20);
12345
12346 //h->GetCentralityDistribution()->Draw(); new TCanvas;
12347
12348 Int_t nEvents = h->GetCentralityDistribution()->Integral(h->GetCentralityDistribution()->FindBin(0.01), h->GetCentralityDistribution()->FindBin(4.99));
12349 Printf("%d", nEvents);
12350 ptHist3->Scale(1.0 / 1.6 / TMath::TwoPi() / nEvents / ptHist3->GetBinWidth(1));
12351
12352 hist[j] = ptHist3;
12353 }
12354
12355 new TCanvas;
12356 hist[0]->DrawCopy("");
12357 hist[1]->DrawCopy("SAME")->SetLineColor(2);
12358 gPad->SetLogy();
12359
12360 new TCanvas;
12361 hist[1]->Divide(hist[0]);
12362 hist[1]->DrawCopy();
12363
12364 raa_central = ReadHepdata("raa_alice_central.txt", kFALSE, 3);
12365 raa_central->SetMarkerStyle(20);
12366 raa_central->Draw("PSAME");
12367}
12368
12369void PtComparison(const char* fileName, const char* fileName2 = 0)
12370{
12371 loadlibs();
12372
12373 c = new TCanvas;
12374 c2 = new TCanvas;
12375
12376 for (Int_t j=0; j<2; j++)
12377 {
12378 if (j == 0)
12379 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
12380 else
12381 {
12382 if (!fileName2)
12383 break;
12384
12385 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName2);
12386 }
12387
12388 //new TCanvas; h->GetCorrelationpT()->Draw("COLZ");
12389
12390 ptHist3 = h->GetCorrelationpT()->ProjectionY(Form("proj1_%d", j), 1, 5);
12391 ptHist3->GetXaxis()->SetRangeUser(0, 20);
12392
12393 //h->GetCentralityDistribution()->Draw(); new TCanvas;
12394
12395 Int_t nEvents = h->GetCentralityDistribution()->Integral(h->GetCentralityDistribution()->FindBin(0.01), h->GetCentralityDistribution()->FindBin(4.99));
12396 Printf("%d", nEvents);
12397 ptHist3->Scale(1.0 / 1.6 / TMath::TwoPi() / nEvents / ptHist3->GetBinWidth(1));
12398
12399 //ptHist3->Scale(1690);
12400 //ptHist3->Scale(1.0 / ptHist3->Integral(ptHist3->GetXaxis()->FindBin(1.01), ptHist3->GetNbinsX()) / 3 / 0.6);
12401
12402 for (Int_t i=2; i<ptHist3->GetNbinsX(); i++)
12403 ptHist3->SetBinContent(i, ptHist3->GetBinContent(i) / ptHist3->GetBinCenter(i));
12404 //ptHist3->SetBinContent(i, ptHist3->GetBinContent(i) / ptHist3->GetBinLowEdge(i));
12405
12406 //AliPWG0Helper::NormalizeToBinWidth(ptHist3);
12407
12408 c->cd();
12409 ptHist3->SetLineStyle(j+1);
12410 ptHist3->DrawCopy((j == 0) ? "HIST" : "HISTSAME")->SetLineColor(1);
12411
12412 centralPt = (TH1*) ptHist3->Clone();;
12413
12414 if (1)
12415 {
12416 ptHist3 = h->GetCorrelationpT()->ProjectionY(Form("proj2_%d", j), 71, 80);
12417 ptHist3->GetXaxis()->SetRangeUser(0, 20);
12418
12419 Int_t nEvents = h->GetCentralityDistribution()->Integral(h->GetCentralityDistribution()->FindBin(70.01), h->GetCentralityDistribution()->FindBin(79.99));
12420 ptHist3->Scale(1.0 / 1.6 / TMath::TwoPi() / nEvents / ptHist3->GetBinWidth(1));
12421 //ptHist3->Scale(10.0 / ptHist3->Integral(ptHist3->GetXaxis()->FindBin(1.01), ptHist3->GetNbinsX()) / 3 / 0.6);
12422 Printf("%d", nEvents);
12423
12424 for (Int_t i=2; i<ptHist3->GetNbinsX(); i++)
12425 ptHist3->SetBinContent(i, ptHist3->GetBinContent(i) / ptHist3->GetBinCenter(i));
12426 //ptHist3->SetBinContent(i, ptHist3->GetBinContent(i) / ptHist3->GetBinLowEdge(i));
12427 }
12428
12429 ptHist3->SetLineStyle(j+1);
12430 ptHist3->DrawCopy("HISTSAME")->SetLineColor(2);
12431
12432 dndpt_central = ReadHepdata("raa_dndpt_central.txt", kFALSE, 3);
12433 dndpt_peripheral = ReadHepdata("raa_dndpt_peripheral.txt", kFALSE, 3);
12434
12435// RemovePointsBelowX(dndpt_central, 1);
12436// RemovePointsBelowX(dndpt_peripheral, 1);
12437//
12438// NormalizeTo(dndpt_central, 1);
12439// NormalizeTo(dndpt_peripheral, 10);
12440
12441 dndpt_central->Draw("*SAME");
12442 dndpt_peripheral->SetLineColor(2);
12443 dndpt_peripheral->SetMarkerColor(2);
12444 dndpt_peripheral->Draw("*SAME");
12445
12446 gPad->SetLogy();
12447
12448 c2->cd();
12449
12450 for (Int_t i=1; i<ptHist3->GetNbinsX(); i++)
12451 ptHist3->SetBinContent(i, ptHist3->GetBinContent(i) / dndpt_peripheral->Eval(ptHist3->GetBinCenter(i)));
12452
12453 for (Int_t i=1; i<centralPt->GetNbinsX(); i++)
12454 centralPt->SetBinContent(i, centralPt->GetBinContent(i) / dndpt_central->Eval(centralPt->GetBinCenter(i)));
12455
12456 ptHist3->Rebin(2); ptHist3->Scale(0.5);
12457 centralPt->Rebin(2); centralPt->Scale(0.5);
12458
12459 ptHist3->DrawCopy((j == 0) ? "" : "SAME")->SetLineColor(2);
12460 centralPt->DrawCopy("SAME")->SetLineColor(1);
12461 }
12462
12463 return;
12464
12465 ReadYields("preliminaries/yields_110303.root");
12466
12467 ptHist3->Scale(100);
12468
12469 TGraphErrors** tmp = yields[0][1][0];
12470 nearSide = tmp[18];
12471 nearSide->Draw("* SAME");
12472
12473 TGraphErrors** tmp = yields[1][1][0];
12474 awaySide = tmp[18];
12475 awaySide->SetLineColor(2);
12476 awaySide->SetMarkerColor(2);
12477 awaySide->Draw("* SAME");
12478
12479}
12480
12481void style(Int_t styleId = 1)
12482{
12483 gStyle->SetPalette(1);
12484 gStyle->SetCanvasColor(10);
12485 gStyle->SetHistFillColor(10);
12486 gStyle->SetHistFillStyle(0);
12487 gStyle->SetOptStat(0);
12488 gStyle->SetPadTickX(1);
12489 gStyle->SetPadTickY(1);
12490 gStyle->SetAxisColor(1, "X");
12491 gStyle->SetAxisColor(1, "Y");
12492 gStyle->SetAxisColor(1, "Z");
12493 gStyle->SetLabelColor(1, "X");
12494 gStyle->SetLabelColor(1, "Y");
12495 gStyle->SetLabelColor(1, "Z");
12496 gStyle->SetTickLength(0.03, "X");
12497 gStyle->SetTickLength(0.03, "Y");
12498 gStyle->SetTickLength(0.03, "Z");
12499 gStyle->SetTitleXSize(0.05);
12500 gStyle->SetTitleYSize(0.05);
12501 gStyle->SetNdivisions(506, "X");
12502 gStyle->SetNdivisions(506, "Y");
12503 gStyle->SetNdivisions(506, "Z");
12504
12505 //gStyle->SetPadGridX(1);
12506 //gStyle->SetPadGridY(1);
12507
12508 //gStyle->SetLabelOffset(0.02, "X");
12509 //gStyle->SetLabelOffset(0.02, "Y");
12510 //gStyle->SetLabelOffset(0.02, "Z");
12511 gStyle->SetLabelSize(0.05, "X");
12512 gStyle->SetLabelSize(0.05, "Y");
12513 gStyle->SetLabelSize(0.05, "Z");
12514
12515 gStyle->SetPadLeftMargin(0.12);
12516 gStyle->SetPadRightMargin(0.02);
12517 gStyle->SetPadBottomMargin(0.13);
12518 gStyle->SetPadTopMargin(0.02);
12519
12520 gStyle->SetMarkerSize(1.4); // CKB
12521
12522 const int iFont = 42; // type * 10 + prec 6: helvetica bold 13: times normal 2: times bold
12523
12524/* italic weigth
12525*-* 1 : times-medium-i-normal "Times New Roman" 1 4
12526*-* 2 : times-bold-r-normal "Times New Roman" 0 7
12527*-* 3 : times-bold-i-normal "Times New Roman" 1 7
12528*-* 4 : helvetica-medium-r-normal "Arial" 0 4
12529*-* 5 : helvetica-medium-o-normal "Arial" 1 4
12530*-* 6 : helvetica-bold-r-normal "Arial" 0 7
12531*-* 7 : helvetica-bold-o-normal "Arial" 1 7
12532*-* 8 : courier-medium-r-normal "Courier New" 0 4
12533*-* 9 : courier-medium-o-normal "Courier New" 1 4
12534*-* 10 : courier-bold-r-normal "Courier New" 0 7
12535*-* 11 : courier-bold-o-normal "Courier New" 1 7
12536*-* 12 : symbol-medium-r-normal "Symbol" 0 6
12537*-* 13 : times-medium-r-normal "Times New Roman" 0 4
12538*-* 14 : "Wingdings" 0 4
12539*/
12540
12541 //gStyle->SetTitleXOffset(1); // 1.1
12542 //gStyle->SetTitleYOffset(1); // 1-4
12543
12544 gStyle->SetLabelFont(iFont, "xyz");
12545 gStyle->SetStatFont(iFont);
12546 gStyle->SetTitleFont(iFont, "xyz");
12547 gStyle->SetTextFont(iFont);
12548
12549 if (styleId == 2)
12550 {
12551 gStyle->SetLabelSize(0.07, "X");
12552 gStyle->SetLabelSize(0.07, "Y");
12553 gStyle->SetLabelSize(0.07, "Z");
12554 gStyle->SetTitleXSize(0.07);
12555 gStyle->SetTitleYSize(0.07);
12556
12557 gStyle->SetPadLeftMargin(0.26);
12558 gStyle->SetPadRightMargin(0.01);
12559 gStyle->SetPadBottomMargin(0.15);
12560 gStyle->SetPadTopMargin(0.01);
12561 }
12562
12563 //gStyle->SetEndErrorSize(0.0);
12564
12565 gROOT->ForceStyle();
12566
12567}
12568
12569void NormalizeTo(TGraphErrors* graph, Float_t normalizeTo)
12570{
12571 Float_t sum = 0;
12572 for (Int_t i=0; i<graph->GetN(); i++)
12573 sum += graph->GetY()[i];
12574
12575 if (normalizeTo > 0 && sum > 0)
12576 {
12577 sum /= normalizeTo;
12578 for (Int_t i=0; i<graph->GetN(); i++)
12579 {
12580 graph->SetPoint(i, graph->GetX()[i], graph->GetY()[i] / sum);
12581 graph->SetPointError(i, graph->GetEX()[i], graph->GetEY()[i] / sum);
12582 }
12583 }
12584}
12585
12586void CompareMixedEvent(const char* fileName)
12587{
12588 loadlibs();
12589
12590 Float_t leadingPtArr[] = { 6.0, 8.0, 10.0, 15.0, 15.0 };
12591 Float_t assocPtArr[] = { 0.5, 1.5, 3.0, 4.0, 6.0, 8.0, 10.0, 12.0 };
12592 Int_t leadingPtOffset = 2;
12593 Int_t centralityBins[] = { 0, 0, 1, 6, 9, 16 };
12594
12595 AliUEHistograms* hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE);
12596
12597 Int_t i = 1;
12598 for (Int_t j=2; j<5; j++)
12599 {
12600 gpTMin = assocPtArr[j] + 0.01;
12601 gpTMax = assocPtArr[j+1] - 0.01;
12602
12603 gpTMin = 3.0;
12604 gpTMax = 6.0;
12605
12606 SetupRanges(hMixed);
12607
12608 TH2* mixed = hMixed->GetUEHist(2)->GetUEHist(6, 0, leadingPtArr[i] + 0.01, leadingPtArr[i+leadingPtOffset] - 0.01, centralityBins[j], centralityBins[j+1]-1, 1);
12609
12610 // compare deta
12611
12612 TH1* histMixedproj = mixed->ProjectionY();
12613 histMixedproj->Scale(1.0 / mixed->GetNbinsX());
12614
12615 for (Int_t x=1; x<=mixed->GetNbinsX(); x++)
12616 for (Int_t y=1; y<=mixed->GetNbinsY(); y++)
12617 mixed->SetBinContent(x, y, histMixedproj->GetBinContent(y));
12618
12619 histMixedproj->Scale(1.0 / (0.5 * (histMixedproj->GetBinContent(histMixedproj->GetXaxis()->FindBin(-0.01)) + histMixedproj->GetBinContent(histMixedproj->GetXaxis()->FindBin(0.01)))));
12620
12621 histMixedproj->DrawCopy((j == 2) ? "" : "SAME")->SetLineColor(j-1);
12622 }
12623}
12624
12625void FillParentTHnSparse(const char* fileName, Bool_t reduce = kFALSE, const char* tag = "")
12626{
12627 if (TString(fileName).BeginsWith("alien:"))
12628 TGrid::Connect("alien:");
12629
12630 loadlibs();
12631
12632 TList* list = 0;
12633
12634 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName, &list, kFALSE, tag);
12635 Printf("We have %d axes", ((AliTHn*) h->GetUEHist(2)->GetTrackHist(0)->GetNVar()));
12636
12637 if (reduce)
12638 ((AliTHn*) h->GetUEHist(2)->GetTrackHist(0))->ReduceAxis();
12639 ((AliTHn*) h->GetUEHist(2)->GetTrackHist(0))->FillParent();
12640 ((AliTHn*) h->GetUEHist(2)->GetTrackHist(0))->DeleteContainers();
12641
12642 AliUEHistograms* hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE, tag);
12643 if (reduce)
12644 ((AliTHn*) hMixed->GetUEHist(2)->GetTrackHist(0))->ReduceAxis();
12645 ((AliTHn*) hMixed->GetUEHist(2)->GetTrackHist(0))->FillParent();
12646 ((AliTHn*) hMixed->GetUEHist(2)->GetTrackHist(0))->DeleteContainers();
12647
12648 TString newFileName(fileName);
12649
12650 if (TString(fileName).BeginsWith("alien:"))
12651 newFileName = gSystem->BaseName(newFileName);
12652
12653 newFileName.ReplaceAll(".root", "");
12654 if (reduce)
12655 newFileName += "_.root";
12656 else
12657 newFileName += "_zvtx.root";
12658
12659 file3 = TFile::Open(newFileName, "RECREATE");
12660 file3->mkdir("PWG4_PhiCorrelations");
12661 file3->cd("PWG4_PhiCorrelations");
12662 list->Write("histosPhiCorrelations", TObject::kSingleKey);
12663 file3->Close();
12664}
12665
12666void CompareZVertex(const char* fileName)
12667{
12668 loadlibs();
12669
12670 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
12671 AliUEHistograms* hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE);
12672
12673 axis = h->GetUEHist(2)->GetEventHist()->GetAxis(2, 6);
12674
12675 gpTMin = 2.01;
12676 gpTMax = 7.99;
12677
12678 SetupRanges(h);
12679 SetupRanges(hMixed);
12680
12681 TFile::Open("test.root", "RECREATE");
12682
12683 for (Int_t i=0; i<=axis->GetNbins(); i++)
12684 {
12685 TH1* hist = 0;
12686 if (i > 0)
12687 {
12688 Printf("%d %f %f", i, axis->GetBinLowEdge(i) + 0.01, axis->GetBinUpEdge(i) - 0.01);
12689 h->SetZVtxRange(axis->GetBinLowEdge(i) + 0.01, axis->GetBinUpEdge(i) - 0.01);
12690 hMixed->SetZVtxRange(axis->GetBinLowEdge(i) + 0.01, axis->GetBinUpEdge(i) - 0.01);
12691 }
12692
12693 GetDistAndFlow(h, hMixed, &hist, 0, 6, 0, 10, 2.01, 14.99, 1, kTRUE, 0, kFALSE);
12694
12695 new TCanvas;
12696 hist->DrawCopy("SURF1");
12697
12698 hist->Write(Form("detadphi_%d", i));
12699
12700// if (i == 0) break;
12701
12702 continue;
12703
12704 hist->SetLineColor(i+1);
12705 hist->Scale(1.0 / hist->Integral() / hist->GetBinWidth(1));
12706 hist->Draw((i == 0) ? "" : "SAME");
12707 }
12708
12709 gFile->Close();
12710}
12711
12712void DrawZRanges(Float_t min, Float_t max)
12713{
12714 legend = new TLegend(0.5, 0.5, 0.8, 0.8);
12715
12716 TFile::Open("test.root");
12717
12718 for (Int_t i=0; i<8; i++)
12719 {
12720 if (i == 1 || i == 7)
12721 continue;
12722
12723 hist = (TH2*) gFile->Get(Form("detadphi_%d", i));
12724 hist->Rebin2D(2, 2);
12725 hist->Scale(0.25);
12726
12727 proj = hist->ProjectionY("proj", hist->GetXaxis()->FindBin(min), hist->GetXaxis()->FindBin(max));
12728 proj->Scale(1.0 / (hist->GetXaxis()->FindBin(max) - hist->GetXaxis()->FindBin(min) + 1));
12729
12730 proj->SetLineColor(i+1);
12731 proj->DrawCopy((i == 0) ? "" : "SAME HIST");
12732
12733 legend->AddEntry(proj->Clone(), Form("%d", i));
12734 }
12735
12736 legend->Draw();
12737}
12738
12739void PlotTrackingEfficiency(const char* fileName)
12740{
12741 loadlibs();
12742
12743 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
12744
12745 c = new TCanvas("c", "c", 600, 600);
12746 gPad->SetLeftMargin(0.15);
12747
12748 h->SetEtaRange(-0.89, 0.89);
12749
12750 Float_t centralityBins[] = { 0, 10, 20, 40, 60, 100 };
12751 Int_t nCentralityBins = 5;
12752
12753 legend = new TLegend(0.2, 0.15, 0.46, 0.42);
12754 legend->SetFillColor(0);
12755
12756 Int_t colors[] = { 1, 2, 3, 4, 6 };
12757
12758 for (Int_t i=0; i<nCentralityBins; i++)
12759 {
12760 h->GetUEHist(2)->SetCentralityRange(centralityBins[i] + 0.1, centralityBins[i+1] - 0.1);
12761 proj = h->GetUEHist(2)->GetTrackingEfficiency(1);
12762 proj->GetYaxis()->SetRangeUser(0.7, 0.9);
12763 proj->GetXaxis()->SetRangeUser(0.5, 9.9);
12764 proj->GetYaxis()->SetTitleOffset(1.5);
12765 proj->SetTitle("");
12766 proj->GetYaxis()->SetTitle("Tracking efficiency");
12767 proj->SetMarkerColor(colors[i]);
12768 proj->SetLineColor(colors[i]);
12769 proj->SetStats(0);
12770 projClone = proj->DrawClone((i == 0) ? "" : "SAME");
12771
12772 legend->AddEntry(projClone, Form("%.0f-%.0f%%", centralityBins[i], centralityBins[i+1]));
12773 }
12774
12775 legend->Draw();
12776// DrawLatex(0.58, 0.85, 1, "HIJING Pb-Pb 2.76 TeV", 0.03);
12777// DrawLatex(0.58, 0.81, 1, "|#eta| < 0.9", 0.03);
12778//
12779// DrawALICELogo(kFALSE, 0.7, 0.2, 0.9, 0.4);
12780
12781 c->SaveAs("correction_tracking.eps");
12782
12783 c = new TCanvas("c2", "c2", 600, 600);
12784 gPad->SetLeftMargin(0.15);
12785
12786 proj = (TH1D*) h->GetUEHist(2)->GetTrackEfficiency(AliUEHist::kCFStepTracked, AliUEHist::kCFStepTrackedOnlyPrim, 1);
12787 proj->GetYaxis()->SetRangeUser(0.8, 1.0);
12788 proj->GetXaxis()->SetRangeUser(0.5, 9.9);
12789 proj->GetYaxis()->SetTitleOffset(1.5);
12790 proj->SetTitle("");
12791 proj->GetYaxis()->SetTitle("contamination correction");
12792 proj->SetStats(0);
12793 projClone = proj->DrawClone("");
12794
12795// DrawLatex(0.58, 0.85, 1, "HIJING Pb-Pb 2.76 TeV", 0.03);
12796// DrawLatex(0.58, 0.81, 1, "|#eta| < 0.9", 0.03);
12797// DrawALICELogo(kFALSE, 0.7, 0.2, 0.9, 0.4);
12798
12799 c->SaveAs("correction_contamination.eps");
12800
12801 c = new TCanvas("c3", "c3", 600, 600);
12802 gPad->SetLeftMargin(0.15);
12803
12804 proj = (TH1D*) h->GetUEHist(2)->GetTrackEfficiency(AliUEHist::kCFStepTrackedOnlyPrim, AliUEHist::kCFStepTracked, 1);
12805 proj->GetYaxis()->SetRangeUser(0.95, 1.15);
12806 proj->GetXaxis()->SetRangeUser(0.5, 9.9);
12807 proj->GetYaxis()->SetTitleOffset(1.5);
12808 proj->SetTitle("");
12809 proj->GetYaxis()->SetTitle("contamination");
12810 proj->SetStats(0);
12811 projClone = proj->DrawClone("");
12812
12813// DrawLatex(0.58, 0.85, 1, "HIJING Pb-Pb 2.76 TeV", 0.03);
12814// DrawLatex(0.58, 0.81, 1, "|#eta| < 0.9", 0.03);
12815// DrawALICELogo(kFALSE, 0.7, 0.2, 0.9, 0.4);
12816
12817 c->SaveAs("contamination.eps");
12818}
12819
12820void PlotCorrections(const char* fileName, const char* tag = "")
12821{
12822 loadlibs();
12823
12824 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName, 0, kFALSE, tag);
12825
12826 c = new TCanvas("c", "c", 1200, 800);
12827 c->Divide(3, 3);
12828
12829 c2 = new TCanvas("c2", "c2", 800, 600);
12830 c2->Divide(2, 2);
12831
12832 h->SetEtaRange(-0.89, 0.89);
12833// h->SetEtaRange(-1.19, 1.19);
12834
12835 Float_t centrBins[] = { 0, 20, 40, 60, 100.1 };
12836
12837 for (Int_t i=0; i<4; i++)
12838 {
12839 h->GetUEHist(2)->SetCentralityRange(centrBins[i] + 0.1, centrBins[i+1] - 0.1);
12840 c->cd(i+1);
12841 h->GetUEHist(2)->GetTrackingEfficiency()->DrawClone("COLZ");
12842
12843 c2->cd(1);
12844 proj = h->GetUEHist(2)->GetTrackingEfficiency(1);
12845 proj->SetTitle(""); proj->SetStats(0);
12846 proj->GetYaxis()->SetTitle("tracking efficiency");
12847 proj->SetLineColor(i+1);
12848 proj->DrawClone((i == 0) ? "" : "SAME");
12849
12850 c2->cd(2);
12851 proj = h->GetUEHist(2)->GetTrackingEfficiency(0);
12852 proj->GetYaxis()->SetTitle("tracking efficiency");
12853 proj->SetTitle(""); proj->SetStats(0);
12854 proj->GetXaxis()->SetTitle("#eta");
12855 proj->SetLineColor(i+1);
12856 proj->DrawClone((i == 0) ? "" : "SAME");
12857
12858 c2->cd(3);
12859 proj = h->GetUEHist(2)->GetTrackingContamination(1);
12860 proj->GetYaxis()->SetTitle("contamination correction");
12861 proj->SetTitle(""); proj->SetStats(0);
12862 proj->SetLineColor(i+1);
12863 proj->DrawClone((i == 0) ? "" : "SAME");
12864// return;
12865 }
12866
12867 h->GetUEHist(2)->SetCentralityRange(0, -1);
12868 for (Int_t i=0; i<10; i++)
12869 {
12870 c2->cd(4);
12871 h->SetZVtxRange(-10.0 + 2 * i, -8.0 + 2 * i);
12872 proj = h->GetUEHist(2)->GetTrackingEfficiency(0);
12873 proj->GetYaxis()->SetTitle("tracking efficiency");
12874 proj->SetTitle(""); proj->SetStats(0);
12875 proj->GetXaxis()->SetTitle("#eta");
12876 proj->SetLineColor(i+1);
12877 proj->DrawClone((i == 0) ? "" : "SAME");
12878 }
12879
12880 h->SetZVtxRange(0, -1);
12881
12882/* c->cd(9);
12883 h->GetUEHist(2)->GetTrackingContamination()->Draw("COLZ");*/
12884
12885 proj2 = h->GetUEHist(2)->GetTrackingEfficiency(1);
12886// proj2 = h->GetUEHist(2)->GetTrackEfficiency(AliUEHist::kCFStepAnaTopology, (AliUEHist::CFStep) (AliUEHist::kCFStepTrackedOnlyPrim+2), 1);
12887 new TCanvas;
12888 proj2->Draw();
12889
12890 return;
12891
12892 new TCanvas;
12893 hist = h->GetUEHist(2)->GetCorrelatedContamination();
12894// if (hist->GetEntries() > 0)
12895// hist->Draw("COLZ");
12896}
12897
12898void SaveEfficiencyCorrection(const char* fileName, const char* tag = "", Bool_t condenseCentrality = kTRUE, Bool_t extrapolateHighpT = kFALSE, Int_t partSpecies=-1, Int_t icharge=0, Bool_t ApplyGFCorrection=0, Int_t year=2013)
12899{
12900 // partSpecies= -1 No PID, 0: Pions, 1: Kaons, 2: Hadrons
12901 // icharge is needed because GF correction applies only to negative particles, 0:Positive 1:negative
12902 // ApplyGFCorrection, for Geant3 version >= v1.14 this correction is not needed anymore for antiprotons
12903 // the number of TRD modules installed depends on the year
12904
12905 loadlibs();
12906
12907 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName, 0, kFALSE, tag);
12908
12909 if(partSpecies!=-1){
12910 Double_t epsilon=0.001;
12911 h->GetUEHist(2)->GetTrackHistEfficiency()->GetGrid(0)->GetGrid()->GetAxis(2)->SetRangeUser(partSpecies-epsilon,partSpecies+epsilon);
12912 h->GetUEHist(2)->GetTrackHistEfficiency()->GetGrid(4)->GetGrid()->GetAxis(2)->SetRangeUser(partSpecies-epsilon,partSpecies+epsilon);
12913 }
12914
12915 Int_t dimensions[] = { 0, 1, 3, 4 }; // eta, pT, centrality, vertex
12916 THnBase* generated = h->GetUEHist(2)->GetTrackHistEfficiency()->GetGrid(0)->GetGrid()->ProjectionND(4, dimensions);
12917 THnBase* measured = h->GetUEHist(2)->GetTrackHistEfficiency()->GetGrid((partSpecies==-1)?2:4)->GetGrid()->ProjectionND(4, dimensions); //for ID particle the matched+identified are taken
12918
12919 // new TCanvas; measured->Projection(0, 1, 3)->Draw();
12920
12921 Printf("%f %f", generated->GetEntries(), measured->GetEntries());
12922
12923 Int_t nBins[] = { generated->GetAxis(0)->GetNbins(), generated->GetAxis(1)->GetNbins(), 1, generated->GetAxis(3)->GetNbins() };
12924
12925 if (condenseCentrality)
12926 {
12927 Double_t centrAxis[] = { 0, 101 };
12928 }
12929 else
12930 {
12931 Double_t centrAxis[] = { 0, 10, 20, 40, 60, 101 };
12932 nBins[2] = 5;
12933 }
12934
12935 generated_new = new THnF("generated_new", "", 4, nBins, 0, 0);
12936
12937 generated_new->SetBinEdges(0, generated->GetAxis(0)->GetXbins()->GetArray()); //eta
12938 generated_new->SetBinEdges(1, generated->GetAxis(1)->GetXbins()->GetArray()); //pT
12939 generated_new->SetBinEdges(2, centrAxis); //centrality
12940 generated_new->SetBinEdges(3, generated->GetAxis(3)->GetXbins()->GetArray()); //vertex
12941
12942 for (Int_t i=0; i<4; i++)
12943 generated_new->GetAxis(i)->SetTitle(generated->GetAxis(i)->GetTitle());
12944
12945 measured_new = (THnF*) generated_new->Clone("measured_new");
12946 effCorr = (THnF*) generated_new->Clone("correction");
12947
12948 generated_new->RebinnedAdd(generated);
12949 measured_new->RebinnedAdd(measured);
12950
12951// new TCanvas; measured_new->Projection(0, 1, 3)->Draw();
12952
12953// return;
12954
12955 Printf("%f %f", generated_new->GetEntries(), measured_new->GetEntries());
12956
12957 effCorr->Divide(generated_new, measured_new, 1, 1, "B");
12958// effCorr->Divide(measured_new);
12959
12960 if(ApplyGFCorrection && partSpecies!=-1){//define the functions for the GF correction
12961 TF1 *fGFTracking;
12962 TF1 *fGFMatching;
12963 Int_t ntrd=7;
12964 if(year==2011)ntrd=10;
12965 if(year>=2012)ntrd=13;
12966 Printf("Number of TRD module in %d : %d",year,ntrd);
12967 Printf("Applying GF correction for particle specie %d %s",partSpecies,Sign[icharge].Data());
12968 Int_t partSpeciesAliPID=partSpecies+2; //in AliPID 2: Pions 3:Kaons 4:protons
12969 fGFTracking = TrackingEff_geantflukaCorrection(partSpeciesAliPID,(icharge==0)?kPositive:kNegative);
12970 fGFMatching = TOFmatchMC_geantflukaCorrection(partSpeciesAliPID,(icharge==0)?kPositive:kNegative,ntrd);
12971 TCanvas *cGF=new TCanvas("cGF","cGF");
12972 fGFTracking->SetLineColor(1);
12973 fGFTracking->DrawClone();
12974 fGFMatching->DrawClone("same");
12975 gPad->BuildLegend();
12976 }
12977
12978 Double_t maxEffValue=5;
12979 for (Int_t bin0 = 1; bin0<=effCorr->GetAxis(0)->GetNbins(); bin0++)
12980 for (Int_t bin1 = 1; bin1<=effCorr->GetAxis(1)->GetNbins(); bin1++)
12981 for (Int_t bin2 = 1; bin2<=effCorr->GetAxis(2)->GetNbins(); bin2++)
12982 for (Int_t bin3 = 1; bin3<=effCorr->GetAxis(3)->GetNbins(); bin3++)
12983 {
12984 nBins[0] = bin0;
12985 nBins[1] = bin1;
12986 nBins[2] = bin2;
12987 nBins[3] = bin3;
12988
12989// Printf("%d %d %d %d %.2f %.2f %.2f %.2f is %f", bin0, bin1, bin2, bin3, effCorr->GetAxis(0)->GetBinCenter(bin0), effCorr->GetAxis(1)->GetBinCenter(bin1), effCorr->GetAxis(2)->GetBinCenter(bin2), effCorr->GetAxis(3)->GetBinCenter(bin3), effCorr->GetBinContent(nBins));
12990 if(ApplyGFCorrection && partSpecies!=-1)
12991 {
12992 if(effCorr->GetBinContent(nBins) > 0)
12993 {
12994 Double_t pt=effCorr->GetAxis(1)->GetBinCenter(bin1);
12995 Double_t GFTracking=fGFTracking->Eval(pt);
12996 Double_t GFMatching=fGFMatching->Eval(pt);
12997 //printf("pt: %.3f GFCorrectionTracking: %f GFCorrectionMatching: %f",pt,GFTracking,GFMatching);
12998 //printf(" Eff before: %f",effCorr->GetBinContent(nBins));
12999 effCorr->SetBinContent(nBins,effCorr->GetBinContent(nBins)*GFTracking*GFMatching);
13000 //Printf(" Eff after: %f",effCorr->GetBinContent(nBins));
13001 }
13002 }
13003
13004 if (effCorr->GetBinContent(nBins) > maxEffValue)
13005 {
13006 Printf("Nulling %d %d %d %d %.2f %.2f %.2f %.2f which was %f", bin0, bin1, bin2, bin3, effCorr->GetAxis(0)->GetBinCenter(bin0), effCorr->GetAxis(1)->GetBinCenter(bin1), effCorr->GetAxis(2)->GetBinCenter(bin2), effCorr->GetAxis(3)->GetBinCenter(bin3), effCorr->GetBinContent(nBins));
13007 effCorr->SetBinContent(nBins, 0);
13008 }
13009
13010
13011 }
13012
13013 const Float_t fitRangeBegin = 5.01;
13014 const Float_t fitRangeEnd = 14.99;
13015 const Float_t extendRangeBegin = 8.01;
13016 Bool_t verbose = kTRUE;
13017
13018 if (extrapolateHighpT)
13019 {
13020 Printf("Extrapolating high pT...");
13021
13022 for (Int_t bin0 = 1; bin0<=effCorr->GetAxis(0)->GetNbins(); bin0++)
13023 for (Int_t bin2 = 1; bin2<=effCorr->GetAxis(2)->GetNbins(); bin2++)
13024 for (Int_t bin3 = 1; bin3<=effCorr->GetAxis(3)->GetNbins(); bin3++)
13025 {
13026 effCorr->GetAxis(0)->SetRange(bin0, bin0);
13027 effCorr->GetAxis(2)->SetRange(bin2, bin2);
13028 effCorr->GetAxis(3)->SetRange(bin3, bin3);
13029
13030 if (gRandom->Uniform() < 0.02) verbose = kTRUE;
13031
13032 proj = effCorr->Projection(1);
13033
13034 if (proj->Integral(proj->FindBin(fitRangeBegin), proj->FindBin(fitRangeEnd)) <= 0)
13035 continue;
13036
13037// Printf("%d %d %d %d %f", bin0, bin1, bin2, bin3, proj->Integral(proj->FindBin(fitRangeBegin), proj->FindBin(fitRangeEnd)));
13038
13039 if (verbose)
13040 {
13041 new TCanvas;
13042 proj->Draw();
13043 }
13044
13045 proj->Fit("pol0", (verbose) ? "+" : "Q0+", "SAME", fitRangeBegin, fitRangeEnd);
13046
13047 if (!proj->GetFunction("pol0"))
13048 continue;
13049
13050 Float_t trackingEff = proj->GetFunction("pol0")->GetParameter(0);
13051
13052 for (Int_t bin1 = 1; bin1<=effCorr->GetAxis(1)->GetNbins(); bin1++)
13053 {
13054 if (effCorr->GetAxis(1)->GetBinCenter(bin1) < extendRangeBegin)
13055 continue;
13056
13057 nBins[0] = bin0;
13058 nBins[1] = bin1;
13059 nBins[2] = bin2;
13060 nBins[3] = bin3;
13061
13062// Printf("Setting %d %d %d %d %.2f %.2f %.2f %.2f to %f which was %f", bin0, bin1, bin2, bin3, effCorr->GetAxis(0)->GetBinCenter(bin0), effCorr->GetAxis(1)->GetBinCenter(bin1), effCorr->GetAxis(2)->GetBinCenter(bin2), effCorr->GetAxis(3)->GetBinCenter(bin3), trackingEff, effCorr->GetBinContent(nBins));
13063 effCorr->SetBinContent(nBins, trackingEff);
13064 }
13065
13066 if (verbose)
13067 verbose = kFALSE;
13068 }
13069
13070 effCorr->GetAxis(0)->UnZoom();
13071 effCorr->GetAxis(1)->UnZoom();
13072 effCorr->GetAxis(2)->UnZoom();
13073 effCorr->GetAxis(3)->UnZoom();
13074 }
13075
13076 Printf("%f", effCorr->GetEntries());
13077
13078 TObjString tag2(Form("corrections from file %s", fileName));
13079
13080 file = TFile::Open("correction.root", "RECREATE");
13081 effCorr->Write();
13082 tag2.Write();
13083 file->Close();
13084
13085 new TCanvas;
13086 effCorr->GetAxis(0)->SetRangeUser(-0.49, 0.49);
13087 effCorr->GetAxis(2)->SetRangeUser(65, 65);
13088 effCorr->GetAxis(3)->SetRangeUser(0.01, 0.01);
13089 effCorr->Projection(1)->Draw();
13090}
13091
13092void CompareEfficiencyCorrection(const char* fileName1, const char* fileName2, Int_t axis1, Int_t axis2)
13093{
13094 if (TString(fileName1).BeginsWith("alien") || TString(fileName2).BeginsWith("alien"))
13095 TGrid::Connect("alien:");
13096
13097 file1 = TFile::Open(fileName1);
13098 corr1 = (THnBase*) file1->Get("correction");
13099
13100 file2 = TFile::Open(fileName2);
13101 corr2 = (THnBase*) file2->Get("correction");
13102
13103 corr1->GetAxis(0)->SetRangeUser(-1.19, 1.19);
13104 corr2->GetAxis(0)->SetRangeUser(-1.19, 1.19);
13105 corr1->GetAxis(1)->SetRangeUser(0.51, 3.99);
13106 corr2->GetAxis(1)->SetRangeUser(0.51, 3.99);
13107 corr1->GetAxis(3)->SetRangeUser(0.01, 0.01);
13108 corr2->GetAxis(3)->SetRangeUser(0.01, 0.01);
13109
13110 proj1 = (TH1*) corr1->Projection(axis1, axis2)->Clone("proj1");
13111 new TCanvas; proj1->DrawCopy("COLZ");
13112
13113 proj2 = (TH1*) corr2->Projection(axis1, axis2)->Clone("proj2");
13114 new TCanvas; proj2->DrawCopy("COLZ");
13115
13116 proj1->Divide(proj2);
13117 new TCanvas; proj1->DrawCopy("COLZ");
13118
13119 corr1->GetAxis(0)->SetRangeUser(-0.49, 0.49);
13120 corr2->GetAxis(0)->SetRangeUser(-0.49, 0.49);
13121
13122 proj1 = (TH1*) corr1->Projection(axis2)->Clone("proj3");
13123 new TCanvas; proj1->DrawCopy();
13124
13125 proj2 = (TH1*) corr2->Projection(axis2)->Clone("proj4");
13126 proj2->SetLineColor(2);
13127 proj2->DrawCopy("SAME");
13128
13129 proj1->Divide(proj2);
13130 new TCanvas; proj1->DrawCopy();
13131
13132}
13133
13134
13135void PlotFake(const char* fileName, const char* fileName2 = 0)
13136{
13137 loadlibs();
13138
13139 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
13140 if (fileName2) AliUEHistograms* h2 = (AliUEHistograms*) GetUEHistogram(fileName2);
13141
13142 TLegend* legend = new TLegend(0.7, 0.8, 0.95, 0.95);
13143 legend->SetFillColor(0);
13144 legend->SetTextSize(0.03);
13145 const char* title[] = {"0-20%", "20-40%", "40-60%", "60-80%", "80-100%"};
13146 TLegend* legend2 = new TLegend(0.7, 0.8, 0.95, 0.95);
13147 legend2->SetFillColor(0);
13148 legend2->SetTextSize(0.03);
13149
13150 c1 = new TCanvas("c1", "Ratio of fakes", 1200, 800);
13151 c1->Divide(2, 3);
13152 c2 = new TCanvas("c2", "pTrec vs pT", 1200, 800);
13153 c2->Divide(2, 3);
13154 c3 = new TCanvas("c3", "pTrec pT ratio", 1200, 800);
13155 c3->Divide(2, 3);
13156
13157 h->SetEtaRange(-0.79, 0.79);
13158
13159 for (Int_t i=0; i<5; i++)
13160 {
13161// h->GetUEHist(2)->SetCentralityRange(100.0/5*i + 0.1, 100.0/5*(i+1) - 0.1);
13162 h->GetUEHist(2)->SetCentralityRange(0, 100);
13163 c1->cd(i+1);
13164 h->GetUEHist(2)->GetFakeRate()->DrawClone("COLZ");
13165 c1->cd(6);
13166 proj = h->GetUEHist(2)->GetFakeRate(1);
13167 proj->GetYaxis()->SetRangeUser(0,150);
13168 proj->SetLineColor((i==4) ? 6 : i+1);
13169 proj->DrawClone((i == 0) ? "" : "SAME");
13170 legend->AddEntry(proj, title[i] , "PL");
13171 }
13172
13173 legend->Draw();
13174
13175 c2->cd(1);
13176 h->GetUEHist(2)->GetMCRecoPtCorrelation()->GetXaxis()->SetTitle("p_{T,rec}");
13177 h->GetUEHist(2)->GetMCRecoPtCorrelation()->GetYaxis()->SetTitle("p_{T}");
13178 h->GetUEHist(2)->GetMCRecoPtCorrelation()->GetZaxis()->SetTitle("Centrality");
13179 h->GetUEHist(2)->GetMCRecoPtCorrelation()->DrawCopy();
13180
13181 Float_t difference = 0.05;
13182
13183 for (Int_t i=0; i<5; i++)
13184 {
13185 c2->cd(i+2);
13186 h->GetUEHist(2)->GetMCRecoPtCorrelation()->GetZaxis()->SetRangeUser(100.0/5*i + 0.1,100.0/5*(i+1) - 0.1);
13187 hist = h->GetUEHist(2)->GetMCRecoPtCorrelation()->Project3D("yx");
13188 hist->DrawClone("COLZ");
13189 c2->cd(i+2)->SetLogz();
13190 c3->cd(i+1);
13191 TH1* MisreconstructedPtRate = h->GetUEHist(2)->GetMCRecoPtCorrelation()->ProjectionX("MisreconstructedPtRate");
13192 MisreconstructedPtRate->Reset();
13193 MisreconstructedPtRate->GetYaxis()->SetRangeUser(0,1);
13194
13195 for (Int_t x=0; x<=hist->GetNbinsX(); x++)
13196 {
13197 Float_t ptRec = hist->GetXaxis()->GetBinCenter(x);
13198 Float_t Misreconstructed = 0;
13199 Float_t Reconstructed = 0;
13200 for (Int_t y=0; y<=hist->GetNbinsY(); y++)
13201 {
13202 Float_t pt = hist->GetYaxis()->GetBinCenter(y);
13203 Reconstructed += hist->GetBinContent(x,y);
13204 if (TMath::Abs(ptRec-pt)/pt > difference)
13205 Misreconstructed += hist->GetBinContent(x,y);
13206 }
13207 if (Reconstructed!=0) MisreconstructedPtRate->Fill(ptRec,Misreconstructed/Reconstructed);
13208 }
13209 MisreconstructedPtRate->SetLineColor((i==4) ? 6 : i+1);
13210 MisreconstructedPtRate->DrawClone();
13211 if (i==0) legend2->AddEntry(MisreconstructedPtRate, "2010" , "L");
13212 c3->cd(6);
13213 MisreconstructedPtRate->DrawClone((i == 0) ? "" : "SAME");
13214 if (fileName2)
13215 {
13216 h2->GetUEHist(2)->GetMCRecoPtCorrelation()->GetZaxis()->SetRangeUser(100.0/5*i + 0.1,100.0/5*(i+1) - 0.1);
13217 hist = h2->GetUEHist(2)->GetMCRecoPtCorrelation()->Project3D("yx");
13218 TH1* MisreconstructedPtRate2 = h2->GetUEHist(2)->GetMCRecoPtCorrelation()->ProjectionX("MisreconstructedPtRate2");
13219 MisreconstructedPtRate2->Reset();
13220 MisreconstructedPtRate2->GetYaxis()->SetRangeUser(0,1);
13221 for (Int_t x=0; x<=hist->GetNbinsX(); x++)
13222 {
13223 Float_t ptRec = hist->GetXaxis()->GetBinCenter(x);
13224 Float_t Misreconstructed = 0;
13225 Float_t Reconstructed = 0;
13226 for (Int_t y=0; y<=hist->GetNbinsY(); y++)
13227 {
13228 Float_t pt = hist->GetYaxis()->GetBinCenter(y);
13229 Reconstructed += hist->GetBinContent(x,y);
13230 if (TMath::Abs(ptRec-pt)/pt > difference)
13231 Misreconstructed += hist->GetBinContent(x,y);
13232 }
13233 if (Reconstructed!=0) MisreconstructedPtRate2->Fill(ptRec,Misreconstructed/Reconstructed);
13234 }
13235 c3->cd(i+1);
13236 MisreconstructedPtRate2->SetLineColor((i==2) ? 12 : i+8);
13237 MisreconstructedPtRate2->DrawClone("SAME");
13238 if (i==0) legend2->AddEntry(MisreconstructedPtRate2, "2011" , "L");
13239 legend2->DrawClone();
13240 }
13241 }
13242 c3->cd(6);
13243 legend->Draw();
13244}
13245
13246void CompareCorrections(const char* fileName1, const char* fileName2)
13247{
13248 loadlibs();
13249
13250 AliUEHistograms* h1 = (AliUEHistograms*) GetUEHistogram(fileName1);
13251 AliUEHistograms* h2 = (AliUEHistograms*) GetUEHistogram(fileName2);
13252
13253 c = new TCanvas("c", "c", 1200, 800);
13254
13255 TLegend* legend = new TLegend(0.7, 0.8, 0.95, 0.95);
13256 legend->SetFillColor(0);
13257 legend->SetTextSize(0.03);
13258
13259 h1->SetEtaRange(-0.89, 0.89);
13260 h2->SetEtaRange(-0.89, 0.89);
13261
13262
13263// const char* title1[] = {"2010, 0-10%", "2010, 10-20%", "2010, 20-30%", "2010, 30-40%", "2010, 40-50%"};
13264 const char* title1[] = {"FullTPC, 0-10%", "FullTPC, 10-20%", "FullTPC, 20-30%", "FullTPC, 30-40%", "FullTPC, 40-50%"};
13265 const char* title1[] = {"FullTPC, 0-10%", "FullTPC, 10-20%", "FullTPC, 20-30%", "FullTPC, 30-40%", "FullTPC, 40-50%"};
13266// const char* title2[] = {"2011, 0-10%", "2011, 10-20%", "2011, 20-30%", "2011, 30-40%", "2011, 40-50%"};
13267 const char* title2[] = {"NotFullTPC, 0-10%", "NotFullTPC, 10-20%", "NotFullTPC, 20-30%", "NotFullTPC, 30-40%", "NotFullTPC, 40-50%"};
13268
13269 Int_t colors[16] = { 1, 3, 2, 6, 4, 7, 8, 9, 11, 12, 28, 30, 36, 40, 46 };
13270 Int_t markers[16] = { 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 2, 5};
13271
13272 for (Int_t i=0; i<5; i++)
13273 {
13274 h1->GetUEHist(2)->SetCentralityRange(100.0/10*i + 0.1, 100.0/10*(i+1) - 0.1);
13275 h2->GetUEHist(2)->SetCentralityRange(100.0/10*i + 0.1, 100.0/10*(i+1) - 0.1);
13276
13277 c->cd(1);
13278 proj = h1->GetUEHist(2)->GetTrackingEfficiency(1);
13279 proj->SetLineColor(colors[6]);
13280 proj->SetMarkerColor(colors[6]);
13281 proj->SetMarkerStyle(markers[i]);
13282 proj->DrawClone((i == 0) ? "" : "SAME");
13283 legend->AddEntry(proj, title1[i] , "PL");
13284
13285 proj = h2->GetUEHist(2)->GetTrackingEfficiency(1);
13286 proj->SetLineColor(colors[2]);
13287 proj->SetMarkerColor(colors[2]);
13288 proj->SetMarkerStyle(markers[i+5]);
13289 proj->SetMarkerStyle(markers[i]);
13290 proj->DrawClone("SAME");
13291 legend->AddEntry(proj, title2[i] , "PL");
13292 }
13293
13294 legend->Draw();
13295}
13296
13297void ComparePPHIMixedEvent(const char* ppFile, const char* pbpbFile)
13298{
13299 loadlibs();
13300
13301 AliUEHistograms* hpp = (AliUEHistograms*) GetUEHistogram(ppFile);
13302 AliUEHistograms* hpbpb = (AliUEHistograms*) GetUEHistogram(pbpbFile);
13303
13304 new TCanvas;
13305 hpp->SetPtRange(2, 10);
13306 ppEff = hpp->GetUEHist(2)->GetTrackingEfficiency(0);
13307 ppEff->Draw();
13308
13309 hpbpb->SetPtRange(2, 10);
13310 pbpbEff = hpbpb->GetUEHist(2)->GetTrackingEfficiency(0);
13311 pbpbEff->DrawCopy("SAME")->SetLineColor(2);
13312
13313 new TCanvas;
13314 ppEff2 = hpp->GetUEHist(2)->GetTrackingEfficiency(1);
13315 ppEff2->Draw();
13316
13317 pbpbEff2 = hpbpb->GetUEHist(2)->GetTrackingEfficiency(1);
13318 pbpbEff2->DrawCopy("SAME")->SetLineColor(2);
13319
13320 mixed = ComparePPHIMixedEventGetMixed(ppEff);
13321 mixed2 = ComparePPHIMixedEventGetMixed(pbpbEff);
13322
13323 new TCanvas;
13324 mixed->DrawCopy();
13325 mixed2->DrawCopy("SAME")->SetLineColor(2);
13326
13327 new TCanvas;
13328 mixed->Divide(mixed2);
13329 mixed->Draw();
13330}
13331
13332TH1* ComparePPHIMixedEventGetMixed(TH1* eff)
13333{
13334 eff->Fit("pol0", "0W");
13335 Float_t avgEff = eff->GetFunction("pol0")->GetParameter(0);
13336
13337 eff->Fit("pol0", "0W", "", -0.89, 0.89);
13338 Float_t avgEffCenter = eff->GetFunction("pol0")->GetParameter(0);
13339 Printf("Avg is %f and avg in center is %f", avgEff, avgEffCenter);
13340
13341 TH1* mixed = new TH1F("mixed", "", 100, -2, 2);
13342
13343 Float_t etaLimit = 1.0;
13344
13345 Int_t n = 10000;
13346 Int_t n2 = 100;
13347 for (Int_t i=0; i<n; i++)
13348 {
13349 Float_t etaTrig = gRandom->Uniform(-etaLimit, etaLimit);
13350
13351 for (Int_t j=0; j<n2; j++)
13352 {
13353 Float_t etaAssoc = gRandom->Uniform(-etaLimit, etaLimit);
13354
13355 if (gRandom->Uniform(0, 1) > eff->GetBinContent(eff->FindBin(etaAssoc)))
13356 continue;
13357
13358 mixed->Fill(etaTrig - etaAssoc);
13359 }
13360 }
13361
13362// mixed->Scale(1.0 / avgEffCenter);
13363 mixed->Scale(1.0 / avgEff);
13364
13365 Printf("We have %f pairs and put in %d", mixed->Integral(), n*n2);
13366
13367 return mixed;
13368}
13369
13370void MACHConeEvolution(const char* fileName, const char* fileNameMixed = 0)
13371{
13372 loadlibs();
13373
13374 if (!fileNameMixed)
13375 fileNameMixed = fileName;
13376
13377 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
13378 AliUEHistograms* hMixed = (AliUEHistograms*) GetUEHistogram(fileNameMixed, 0, kTRUE);
13379
13380 Float_t leadingPtArr[] = { 2.0, 3.0, 4.0, 10.0, 20.0, 40.0 };
13381 Float_t assocPtArr[] = { 1.0, 2.0, 3.0, 6.0, 10.0, 20.0, 40.0 };
13382
13383 Int_t i = 1;
13384 Int_t step = 6;
13385 Int_t j = 0;
13386
13387 gpTMin = assocPtArr[i] + 0.01;
13388 gpTMax = assocPtArr[i+1] - 0.01;
13389
13390 for (Int_t centrBin = 0; centrBin < 5; centrBin++)
13391 {
13392 Int_t centralityBegin = centrBin;
13393 Int_t centralityEnd = centrBin+1;
13394
13395 SetupRanges(h);
13396 SetupRanges(hMixed);
13397
13398 TH1* hist = 0;
13399
13400 Bool_t scaleToPairs = 0;
13401
13402 GetDistAndFlow(h, hMixed, &hist, 0, step, centralityBegin, centralityEnd, leadingPtArr[j] + 0.01, leadingPtArr[j+1] - 0.01, 11, kTRUE, 0, scaleToPairs);
13403 hist->Rebin(2); hist->Scale(0.5);
13404
13405 copy = hist->DrawCopy((centrBin == 0) ? "" : "SAME");
13406 copy->SetLineColor(centrBin+1);
13407 }
13408}
13409
13410void PlotTwoTrackEfficiencyControlPlots(const char* fileName)
13411{
13412 loadlibs();
13413 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
13414
13415 Float_t ptRange[] = { 0.0, 1.0, 2.0, 3.0, 4.0, 6.0, 8.0, 10.0 };
13416
13417 graph = new TGraphErrors;
13418
13419 for (Int_t ptID = 0; ptID < 7; ptID++)
13420 {
13421 c = new TCanvas(Form("c%d", ptID), Form("%.0f < pT < %.0f", ptRange[ptID], ptRange[ptID+1]), 800, 400);
13422 c->Divide(2, 1);
13423
13424 for (Int_t i=0; i<2; i++)
13425 {
13426 c->cd(i+1);
13427 h->GetTwoTrackDistance(i)->GetZaxis()->SetRangeUser(ptRange[ptID] + 0.01, ptRange[ptID+1] - 0.01);
13428 p = h->GetTwoTrackDistance(i)->Project3D(Form("yx_%d_%d", i, ptID));
13429// if (ptID == 0)
13430 p->SetStats(0);
13431
13432 pc = (TH2*) p->Clone("pc");
13433 pc->Reset();
13434
13435 p->DrawCopy("COLZ");
13436
13437 continue;
13438
13439 // reduce to one quadrant
13440 for (Int_t x=1; x<=p->GetNbinsX(); x++)
13441 for (Int_t y=1; y<=p->GetNbinsY(); y++)
13442 pc->Fill(TMath::Abs(p->GetXaxis()->GetBinCenter(x)), TMath::Abs(p->GetYaxis()->GetBinCenter(y)), p->GetBinContent(x, y));
13443
13444 c->cd(i+2);
13445 copy = pc->DrawCopy("COLZ");
13446 copy->GetXaxis()->SetRangeUser(0, 10);
13447 copy->GetYaxis()->SetRangeUser(0.00101, 10);
13448
13449 // extract excess
13450 if (1)
13451 {
13452 Float_t center = pc->Integral(pc->GetXaxis()->FindBin(0), pc->GetXaxis()->FindBin(0.009999), 1, pc->GetNbinsY());
13453 Float_t outside = pc->Integral(pc->GetXaxis()->FindBin(0.01001), pc->GetXaxis()->FindBin(0.04999), 1, pc->GetNbinsY());
13454
13455 Float_t excess1 = center - outside / 4;
13456
13457 Float_t center = pc->Integral(pc->GetXaxis()->FindBin(0), pc->GetXaxis()->FindBin(0.001999), 1, pc->GetNbinsY());
13458 Float_t outside = pc->Integral(pc->GetXaxis()->FindBin(0.002001), pc->GetXaxis()->FindBin(0.00999), 1, pc->GetNbinsY());
13459
13460 Float_t excess2 = center - outside / 4;
13461
13462 Printf("%d %f %f", ptID, excess1, excess2);
13463 }
13464
13465 // fit
13466 if (0 && i == 0)
13467 {
13468 p2 = ((TH2*)pc)->ProjectionX("p2", 52, 52+4);
13469// p3 = ((TH2*)p)->ProjectionX("p3", 49-4, 49);
13470 //p2->Add(p3);
13471 //new TCanvas; p2->Draw();
13472 //return;
13473 p2->Fit("pol0", "0");
13474 Float_t avg = p2->GetFunction("pol0")->GetParameter(0);
13475 p2->Fit("pol0", "0", "", -0.002, 0.002);
13476 Float_t min = p2->GetFunction("pol0")->GetParameter(0);
13477 Float_t mine = p2->GetFunction("pol0")->GetParError(0);
13478
13479 if (avg > 0)
13480 {
13481 graph->SetPoint(graph->GetN(), ptRange[ptID], min / avg);
13482 graph->SetPointError(graph->GetN()-1, 0, mine / avg);
13483 }
13484 }
13485
13486 }
13487
13488 c->SaveAs(Form("twotrack_pt_%d_%d.png", (Int_t) ptRange[ptID], (Int_t) ptRange[ptID+1]));
13489 c->SaveAs(Form("twotrack_pt_%d_%d.eps", (Int_t) ptRange[ptID], (Int_t) ptRange[ptID+1]));
13490 }
13491
13492 new TCanvas;
13493 graph->Print();
13494 graph->Draw("A*");
13495}
13496
13497void PlotTwoTrackEfficiencyControlPlots2(const char* fileName)
13498{
13499 loadlibs();
13500 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
13501
13502 Float_t ptRange[] = { 0.0, 1.0, 2.0, 3.0, 4.0, 6.0, 8.0, 10.0 };
13503
13504 graph = new TGraphErrors;
13505
13506 for (Int_t ptID = 0; ptID < 5; ptID++)
13507 {
13508 c = new TCanvas(Form("c%d", ptID), Form("%.0f < pT < %.0f", ptRange[ptID], ptRange[ptID+1]), 1200, 400);
13509 c->Divide(3, 1);
13510
13511 TH2* proj[2];
13512
13513 for (Int_t i=0; i<3; i++)
13514 {
13515 c->cd(i+1);
13516 gPad->SetRightMargin(0.2);
13517
13518 if (i < 2)
13519 {
13520 h->GetTwoTrackDistance(i)->GetZaxis()->SetRangeUser(ptRange[ptID] + 0.01, ptRange[ptID+1] - 0.01);
13521 p = (TH2*) h->GetTwoTrackDistance(i)->Project3D(Form("yx_%d_%d", i, ptID));
13522
13523 if (1)
13524 {
13525 // reduce to one quadrant
13526 pc = (TH2*) p->Clone(Form("%s_pc", p->GetName()));
13527 pc->Reset();
13528 pc->Rebin2D(2, 2);
13529 for (Int_t x=1; x<=p->GetNbinsX(); x++)
13530 for (Int_t y=1; y<=p->GetNbinsY(); y++)
13531 pc->Fill(TMath::Abs(p->GetXaxis()->GetBinCenter(x)), TMath::Abs(p->GetYaxis()->GetBinCenter(y)), p->GetBinContent(x, y));
13532 pc->GetXaxis()->SetRangeUser(0, 100);
13533 pc->GetYaxis()->SetRangeUser(0, 100);
13534 p = pc;
13535 }
13536
13537 if (ptID == 0)
13538 p->SetStats(0);
13539
13540 p->DrawCopy("COLZ");
13541
13542 proj[i] = p;
13543 }
13544 else
13545 {
13546 proj[0]->Divide(proj[1]);
13547 proj[0]->SetStats(0);
13548
13549// Float_t scale = proj[1]->Integral(0, proj[1]->GetNbinsX()+1, 0, proj[1]->GetNbinsY()+1) / proj[0]->Integral(0, proj[1]->GetNbinsX()+1, 0, proj[1]->GetNbinsY()+1);
13550 Float_t scale = proj[0]->Integral(1, proj[1]->GetNbinsX(), 1, proj[1]->GetNbinsY()) / proj[1]->GetNbinsX() / proj[1]->GetNbinsY();
13551 proj[0]->Scale(1./ scale / 4);
13552 proj[0]->DrawCopy("COLZ");
13553 }
13554 }
13555 }
13556}
13557
13558void PlotTwoTrackEfficiencyControlPlots3(const char* fileName, Int_t histID = 0)
13559{
13560 loadlibs();
13561 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
13562 AliUEHistograms* hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE);
13563
13564 Float_t ptRange[] = { 0.0, 1.0, 2.0, 3.0, 4.0, 6.0, 8.0, 10.0 };
13565
13566 graph = new TGraphErrors;
13567
13568 for (Int_t ptID = 0; ptID < 5; ptID++)
13569 {
13570 c = new TCanvas(Form("c%d", ptID), Form("%.0f < pT < %.0f", ptRange[ptID], ptRange[ptID+1]), 1200, 400);
13571 c->Divide(3, 1);
13572
13573 TH2* proj[2];
13574
13575 for (Int_t i=0; i<3; i++)
13576 {
13577 c->cd(i+1);
13578 gPad->SetRightMargin(0.2);
13579
13580 if (i < 2)
13581 {
13582 AliUEHistograms* input = ((i == 0) ? h : hMixed);
13583 input->GetTwoTrackDistance(histID)->GetZaxis()->SetRangeUser(ptRange[ptID] + 0.01, ptRange[ptID+1] - 0.01);
13584 p = (TH2*) input->GetTwoTrackDistance(histID)->Project3D(Form("yx_%d_%d", i, ptID));
13585
13586 if (0)
13587 {
13588 // reduce to one quadrant
13589 pc = (TH2*) p->Clone(Form("%s_pc", p->GetName()));
13590 pc->Reset();
13591// pc->Rebin2D(2, 2);
13592 for (Int_t x=1; x<=p->GetNbinsX(); x++)
13593 for (Int_t y=1; y<=p->GetNbinsY(); y++)
13594 pc->Fill(TMath::Abs(p->GetXaxis()->GetBinCenter(x)), TMath::Abs(p->GetYaxis()->GetBinCenter(y)), p->GetBinContent(x, y));
13595 pc->GetXaxis()->SetRangeUser(0, 100);
13596 pc->GetYaxis()->SetRangeUser(0, 100);
13597 p = pc;
13598 }
13599
13600// if (ptID == 0)
13601 p->SetStats(0);
13602
13603 p->DrawCopy("COLZ");
13604
13605 proj[i] = p;
13606 }
13607 else
13608 {
13609 Float_t scale = proj[0]->Integral() / proj[1]->Integral();
13610 proj[0]->Divide(proj[1]);
13611 proj[0]->SetStats(0);
13612
13613// Float_t scale = proj[1]->Integral(0, proj[1]->GetNbinsX()+1, 0, proj[1]->GetNbinsY()+1) / proj[0]->Integral(0, proj[1]->GetNbinsX()+1, 0, proj[1]->GetNbinsY()+1);
13614// Float_t scale = proj[0]->Integral(1, proj[1]->GetNbinsX(), 1, proj[1]->GetNbinsY()) / proj[1]->GetNbinsX() / proj[1]->GetNbinsY();
13615 proj[0]->Scale(1./ scale);
13616// proj[0]->Scale(1./ scale / 4);
13617 proj[0]->DrawCopy("COLZ");
13618 }
13619 }
13620
13621 break;
13622 }
13623}
13624
13625void SystematicpTResolution(const char* inputYield, Int_t caseId = 18, Int_t triggerId = 1)
13626{
13627 // Study by Jacek comparing TPC only tracks with global tracks for new cuts (crossed rows) (Fwd by Andrew, 07.07.11)
13628 // Resolution from tpc only tracks twice as worse than global tracks
13629 // Parameterization for tpc-only tracks:
13630 // f(pT) = a * pT * sqrt(1+b/(pT^abs(c)))
13631 // a = 0.003; b = 2.08; c = 7.07e-7
13632 Float_t a = 0.003; Float_t b = 2.08; Float_t c = 7.07e-7;
13633 res = new TF1("res", "[0] * x * sqrt(1+[1]/(x**abs([2])))", 0, 15);
13634 res->SetParameters(a, b, c);
13635// res->Draw(); return;
13636
13637 ReadYields(inputYield);
13638
13639 for (Int_t side = 0; side < 2; side++)
13640 {
13641 for (Int_t centrality = 0; centrality < 4; centrality++)
13642 {
13643 TGraphErrors** tmp = yields[side][triggerId][centrality];
13644 graph = tmp[caseId];
13645
13646// graph->DrawClone("A*");
13647
13648 Float_t axisLimits[20];
13649 for (Int_t i=0; i<graph->GetN(); i++)
13650 {
13651 axisLimits[i] = graph->GetX()[i] - graph->GetEX()[i];
13652 axisLimits[i+1] = graph->GetX()[i] + graph->GetEX()[i];
13653 }
13654
13655 hist = new TH1F("hist", "", graph->GetN(), axisLimits);
13656
13657 for (Int_t i=0; i<graph->GetN(); i++)
13658 {
13659 gaus = new TF1("gaus", "gaus(0)", 0, 15);
13660 Float_t sigma = graph->GetX()[i] * res->Eval(graph->GetX()[i]);
13661 Float_t norm = graph->GetY()[i] / TMath::Sqrt(2 * TMath::Pi()) / sigma;
13662 gaus->SetParameters(norm, graph->GetX()[i], sigma);
13663// gaus->Draw("SAME");
13664// Printf("%f %f", graph->GetY()[i], gaus->Integral(0, 20));
13665
13666 // fill histogram
13667 for (Int_t j=1; j<=hist->GetNbinsX(); j++)
13668 hist->SetBinContent(j, hist->GetBinContent(j) + gaus->Integral(hist->GetBinLowEdge(j), hist->GetXaxis()->GetBinUpEdge(j)));
13669 }
13670
13671// hist->Draw("SAME"); return;
13672
13673 for (Int_t i=0; i<graph->GetN(); i++)
13674 graph->GetY()[i] = hist->GetBinContent(i+1);
13675
13676// graph->SetMarkerColor(2); graph->DrawClone("*SAME");
13677 }
13678 }
13679}
13680
13681void DrawProcessIDPlot(const char* fileName)
13682{
13683 if (gFile)
13684 gFile->Close();
13685 TFile::Open(fileName);
13686 list = (TList*) gFile->Get("PWG4_PhiCorrelations/histosPhiCorrelations");
13687 ((TH1*) list->FindObject("processIDs"))->Draw();
13688}
13689
13690void GetExampleDphi(const char* fileName)
13691{
13692 loadlibs();
13693
13694 Int_t leadingPtOffset = 1;
13695
13696 Int_t maxLeadingPt = 5;
13697 Int_t maxAssocPt = 6;
13698 if (1)
13699 {
13700 Float_t leadingPtArr[] = { 2.0, 3.0, 4.0, 6.0, 8.0, 10.0, 15.0, 20.0 };
13701 Float_t assocPtArr[] = { 0.15, 0.5, 1.0, 2.0, 3.0, 4.0, 6.0, 8.0, 10.0, 12.0 };
13702 }
13703 else
13704 {
13705 Float_t leadingPtArr[] = { 0.15, 10.0 };
13706 Float_t assocPtArr[] = { 0.15, 10.0 };
13707 }
13708 leadingPtOffset = 1;
13709
13710// AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
13711 hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE);
13712
13713 if (1)
13714 {
13715// h->SetZVtxRange(-0.99, 0.99);
13716 hMixed->SetZVtxRange(-0.99, 0.99);
13717 }
13718
13719 Int_t i=0;
13720 Int_t j=2;
13721
13722 gpTMin = assocPtArr[j] + 0.01;
13723 gpTMax = assocPtArr[j+1] - 0.01;
13724
13725// SetupRanges(h);
13726 SetupRanges(hMixed);
13727
13728 Int_t bin[6];
13729 bin[0] = hMixed->GetUEHist(2)->GetTrackHist(0)->GetGrid(0)->GetGrid()->GetAxis(0)->FindBin(0.01);
13730 bin[1] = hMixed->GetUEHist(2)->GetTrackHist(0)->GetGrid(0)->GetGrid()->GetAxis(1)->FindBin(1.1);
13731 bin[2] = hMixed->GetUEHist(2)->GetTrackHist(0)->GetGrid(0)->GetGrid()->GetAxis(2)->FindBin(2.1);
13732 bin[3] = hMixed->GetUEHist(2)->GetTrackHist(0)->GetGrid(0)->GetGrid()->GetAxis(3)->FindBin(5.5);
13733 bin[4] = hMixed->GetUEHist(2)->GetTrackHist(0)->GetGrid(0)->GetGrid()->GetAxis(4)->FindBin(0);
13734 if (hMixed->GetUEHist(2)->GetTrackHist(0)->GetGrid(0)->GetGrid()->GetAxis(5))
13735 bin[5] = hMixed->GetUEHist(2)->GetTrackHist(0)->GetGrid(0)->GetGrid()->GetAxis(5)->FindBin(0);
13736 Printf("tracks: %f +- %f", hMixed->GetUEHist(2)->GetTrackHist(0)->GetGrid(6)->GetGrid()->GetBinContent(bin), hMixed->GetUEHist(2)->GetTrackHist(0)->GetGrid(6)->GetGrid()->GetBinError(bin));
13737
13738 bin[0] = hMixed->GetUEHist(2)->GetTrackHist(0)->GetGrid(0)->GetGrid()->GetAxis(2)->FindBin(2.1);
13739 bin[1] = hMixed->GetUEHist(2)->GetTrackHist(0)->GetGrid(0)->GetGrid()->GetAxis(3)->FindBin(5.5);
13740 if (hMixed->GetUEHist(2)->GetTrackHist(0)->GetGrid(0)->GetGrid()->GetAxis(5))
13741 bin[2] = hMixed->GetUEHist(2)->GetTrackHist(0)->GetGrid(0)->GetGrid()->GetAxis(5)->FindBin(0);
13742 Printf("events: %f +- %f", hMixed->GetUEHist(2)->GetEventHist()->GetGrid(6)->GetGrid()->GetBinContent(bin), hMixed->GetUEHist(2)->GetTrackHist(0)->GetGrid(6)->GetGrid()->GetBinError(bin));
13743
13744 return;
13745
13746 Int_t stepMixed = 6;
13747 TH2* mixedTwoD = (TH2*) hMixed->GetUEHist(2)->GetUEHist(stepMixed, 0, leadingPtArr[i+leadingPtOffset], leadingPtArr[i+1+leadingPtOffset], 12, 13, 1, kFALSE);
13748
13749 TH1* proj = mixedTwoD->ProjectionX("px", 11, 30);
13750 proj->Draw();
13751}
13752
13753void GaussToyFit()
13754{
13755 func = new TF1("func", "gaus(0)", -2, 2);
13756 func->SetParameters(1, 0, 0.5);
13757
13758 hist = new TH1F("hist", "", 100, -2, 2);
13759 hist->FillRandom("func", 10000);
13760
13761 func = new TF1("func", "gaus(0)", -2, 2);
13762 func->SetParLimits(2, 0, 10);
13763 func->FixParameter(1, 0);
13764 func->SetParameters(2, 0, 0.1);
13765 hist->Fit(func, "", "", -1, 1);
13766 hist->DrawCopy();
13767
13768 func2 = new TF1("func2", "gaus(0)+[3]", -2, 2);
13769 func2->SetParLimits(2, 0, 10);
13770 func2->FixParameter(1, 0);
13771 func2->SetParameters(2, 0, 0.1, 0);
13772 func2->SetLineColor(2);
13773 hist->Fit(func2, "+", "", -1, 1);
13774
13775 return;
13776
13777 new TCanvas;
13778 constant = new TF1("constant", "1", -2, 2);
13779 hist->Add(constant, -30);
13780 func->SetParameters(2, 0, 0.1);
13781 hist->Fit(func, "", "", -1, 1);
13782}
13783
13784void GaussToyFit2()
13785{
13786 func = new TF2("func", "[0]*exp(-0.5*((x/[1])**2+(y/[2])**2))", -2, 2, -2, 2);
13787 func->SetParameters(1, 0.4, 0.6);
13788
13789 hist = new TH2F("hist", "", 100, -2, 2, 100, -2, 2);
13790 hist->FillRandom("func", 100000);
13791
13792 func = new TF2("func", "[0]*exp(-0.5*((x/[1])**2+(y/[2])**2))", -2, 2, -2, 2);
13793 func->SetParameters(1, 0.2, 0.2);
13794 hist->Fit(func, "", "");
13795 hist->DrawCopy();
13796
13797 new TCanvas;
13798 hist->ProjectionX()->Fit("gaus");
13799
13800 new TCanvas;
13801 hist->ProjectionY()->Fit("gaus");
13802}
13803
13804void AcceptanceToy()
13805{
13806 // study a la Jan Rak presented in Corr PAG on 06.03.12
13807
13808 hist = new TH1F("hist", "", 200, -1.5, 1.5);
13809
13810 Float_t sigma = 0.3;
13811 for (Int_t i=0; i<1000000; i++)
13812 {
13813 // randomize mean
13814 Float_t mean = gRandom->Uniform(-5, 5);
13815
13816 Float_t trig = gRandom->Gaus(mean, sigma);
13817 Float_t assoc = gRandom->Gaus(mean, sigma);
13818
13819// Float_t trig = gRandom->Uniform(-5, 5);
13820// Float_t assoc = gRandom->Uniform(-5, 5);
13821
13822/* if (trig < 0 && assoc < trig)
13823 continue;
13824 if (trig > 0 && assoc > trig)
13825 continue;*/
13826
13827 if (TMath::Abs(trig) < 1 && TMath::Abs(assoc) < 1)
13828// hist->Fill(trig - assoc);
13829 hist->Fill(trig - assoc, 1.0 / (1.0 - TMath::Abs(trig-assoc) / 2));
13830 }
13831
13832 hist->Draw();
13833 hist->Fit("gaus", "", "", -1.5, 1.5);
13834 Printf("%f %f %f", sigma, hist->GetFunction("gaus")->GetParameter(2), hist->GetFunction("gaus")->GetParameter(2) / TMath::Sqrt(2));
13835 hist->GetFunction("gaus")->SetLineColor(2);
13836}
13837
13838void DrawEfficiency(const char* fileName, Int_t step1, Int_t step2)
13839{
13840 gpTMin = 1.01;
13841 gpTMax = 1.99;
13842
13843 loadlibs();
13844
13845 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
13846 hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE);
13847
13848 SetupRanges(h);
13849 SetupRanges(hMixed);
13850
13851 TH1* hist1 = 0;
13852 TH1* hist2 = 0;
13853
13854 GetDistAndFlow(h, hMixed, &hist1, 0, step1, 0, 10, 2.01, 3.99, 1, kTRUE, 0, kTRUE);
13855 GetDistAndFlow(h, hMixed, &hist2, 0, step2, 0, 10, 2.01, 3.99, 1, kTRUE, 0, kTRUE);
13856
13857 ((TH2*)hist1)->Rebin2D(2, 2);
13858 ((TH2*)hist2)->Rebin2D(2, 2);
13859
13860 new TCanvas("c", "c", 800, 800);
13861 gPad->SetLeftMargin(0.15);
13862 hist1->SetTitle("");
13863 hist1->GetYaxis()->SetRangeUser(-1.39, 1.39);
13864 hist1->GetXaxis()->SetTitleOffset(1.5);
13865 hist1->GetYaxis()->SetTitleOffset(2);
13866 hist1->SetStats(kFALSE);
13867 hist1->DrawCopy("SURF1");
13868
13869 new TCanvas("c2", "c2", 800, 800);
13870 gPad->SetLeftMargin(0.15);
13871 hist2->SetTitle("");
13872 hist2->GetYaxis()->SetRangeUser(-1.39, 1.39);
13873 hist2->GetXaxis()->SetTitleOffset(1.5);
13874 hist2->GetYaxis()->SetTitleOffset(2);
13875 hist2->SetStats(kFALSE);
13876 hist2->DrawCopy("SURF1");
13877
13878 hist2->Divide(hist1);
13879
13880 new TCanvas("c3", "c3", 800, 800);
13881 gPad->SetLeftMargin(0.15);
13882 hist2->SetTitle("");
13883 hist2->GetYaxis()->SetRangeUser(-1.39, 1.39);
13884 hist2->GetXaxis()->SetTitleOffset(1.5);
13885 hist2->GetYaxis()->SetTitleOffset(2);
13886 hist2->SetStats(kFALSE);
13887 hist2->Draw("SURF1");
13888}
13889
13890void RewriteObjects(const char* fileName)
13891{
13892 loadlibs();
13893
13894 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
13895 Int_t nAxes = ((AliTHn*) h->GetUEHist(2)->GetTrackHist(0)->GetNVar());
13896 Printf("We have %d axes", nAxes);
13897
13898 TString histId; histId.Form("%dR", nAxes-1);
13899 Printf("%s", histId.Data());
13900
13901 AliUEHistograms* hNew = new AliUEHistograms(h->GetName(), histId);
13902 hNew->DeepCopy(h);
13903 delete h;
13904
13905 AliUEHistograms* hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE);
13906 AliUEHistograms* hMixedNew = new AliUEHistograms(hMixed->GetName(), histId);
13907 hMixedNew->DeepCopy(hMixed);
13908 delete hMixed;
13909
13910 TString newFileName(fileName);
13911 newFileName.ReplaceAll(".root", "");
13912 newFileName += "_rebinned.root";
13913
13914 list = new TList;
13915 list->Add(hNew);
13916 list->Add(hMixedNew);
13917
13918 file3 = TFile::Open(newFileName, "RECREATE");
13919 file3->mkdir("PWG4_PhiCorrelations");
13920 file3->cd("PWG4_PhiCorrelations");
13921 list->Write("histosPhiCorrelations", TObject::kSingleKey);
13922 file3->Close();
13923}
13924
13925void CondenseCentrality(const char* fileName, Float_t targetValue, Int_t step = 0, Float_t from = 0, Float_t to = -1)
13926{
13927 loadlibs();
13928
13929 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
13930 AliUEHistograms* hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE);
13931
13932 h->GetUEHist(2)->CondenseBin(step, 3, 1, targetValue, from, to);
13933 hMixed->GetUEHist(2)->CondenseBin(step, 3, 1, targetValue, from, to);
13934
13935 TString newFileName(fileName);
13936 newFileName.ReplaceAll(".root", "");
13937 newFileName += "_condensed.root";
13938
13939 list = new TList;
13940 list->Add(h);
13941 list->Add(hMixed);
13942
13943 file3 = TFile::Open(newFileName, "RECREATE");
13944 file3->mkdir("PWG4_PhiCorrelations");
13945 file3->cd("PWG4_PhiCorrelations");
13946 list->Write("histosPhiCorrelations", TObject::kSingleKey);
13947 file3->Close();
13948}
13949
13950void SymmetrizepTBins(const char* fileName)
13951{
13952 // copy pt,a < pt,t bins to pt,a > pt,t
13953
13954 loadlibs();
13955
13956 TList* list = 0;
13957 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName, &list);
13958 AliUEHistograms* hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE);
13959
13960 h->GetUEHist(2)->SymmetrizepTBins();
13961 hMixed->GetUEHist(2)->SymmetrizepTBins();
13962
13963 TString newFileName(fileName);
13964 newFileName.ReplaceAll(".root", "");
13965 newFileName += "_symmetrized.root";
13966
13967 file3 = TFile::Open(newFileName, "RECREATE");
13968 file3->mkdir("PWG4_PhiCorrelations");
13969 file3->cd("PWG4_PhiCorrelations");
13970 list->Write("histosPhiCorrelations", TObject::kSingleKey);
13971 file3->Close();
13972}
13973
13974void PtDistributions(Int_t step = 8, Float_t centralityBegin = 1, Float_t centralityEnd = 10)
13975{
13976 loadlibs();
13977
13978// const char* fileNames[] = { "LHC10h_AOD086_120411_zvtx_rebinned_corrected.root", "LHC10h_AOD086_120411_hybrid_zvtx_rebinned_corrected.root", "LHC10h_AOD086_120430_raacuts_zvtx_rebinned_corrected.root" };
13979
13980// const char* fileNames[] = { "LHC10h_AOD086_120411_zvtx_rebinned.root", "LHC10h_AOD086_120411_hybrid_zvtx_rebinned.root", "LHC10h_AOD086_120430_raacuts_zvtx_rebinned.root" };
13981 const char* fileNames[] = { "pt_pos.root", "pt_neg.root" };
13982// const char* fileNames[] = { "LHC11a10a_bis_AOD090_120406_zvtx.root" };
13983
13984// Float_t eventCount[] = { 1098234., 1034306., 1369707. };
13985// Float_t eventCount[] = { 987360.000000, 930278.000000, 1231806.000000 };
13986 Float_t eventCount[] = { 1., 1. };
13987
13988 TH1* pt[3];
13989
13990 new TCanvas;
13991 for (Int_t i=0; i<2; i++)
13992 {
13993/* AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileNames[i]);
13994
13995 h->GetUEHist(2)->GetEventHist()->GetGrid(step)->GetGrid()->GetAxis(1)->SetRangeUser(0.01 + centralityBegin, -0.01 + centralityEnd);
13996 ptDist = h->GetUEHist(2)->GetEventHist()->Project(step, 0);*/
13997
13998/* eventCount = h->GetEventCount();
13999 Float_t events = eventCount->Integral(eventCount->GetXaxis()->FindBin(step), eventCount->GetXaxis()->FindBin(step), eventCount->GetYaxis()->FindBin(0.01 + centralityBegin), eventCount->GetYaxis()->FindBin(-0.01 + centralityEnd));*/
14000 Float_t events = eventCount[i];
14001
14002 TFile::Open(fileNames[i]);
14003 ptDist = (TH2*) gFile->Get("ptDist");
14004
14005 ptDistProj = ptDist->ProjectionX(Form("ptDistProj_%d", i), ptDist->GetYaxis()->FindBin(0.01 + centralityBegin), ptDist->GetYaxis()->FindBin(-0.01 + centralityEnd));
14006
14007// new TCanvas; ptDistProj->Draw(); gPad->SetLogy();
14008
14009
14010 ptDistProj->Scale(1.0 / events);
14011
14012 ptDistProj->SetLineColor(i+1);
14013 ptDistProj->DrawCopy((i == 0) ? "" : "SAME");
14014
14015 pt[i] = (TH1*) ptDistProj->Clone(Form("clone_%d", i));
14016 }
14017 gPad->SetLogy();
14018
14019 new TCanvas;
14020 for (Int_t i=1; i<2; i++)
14021 {
14022 pt[i]->Divide(pt[0]);
14023 pt[i]->DrawCopy((i == 1) ? "" : "SAME");
14024 }
14025}
14026
14027void test(const char* fileNameESD)
14028{
14029 Int_t step = 8;
14030
14031 loadlibs();
14032 AliUEHistograms* esd = (AliUEHistograms*) GetUEHistogram(fileNameESD);
14033
14034 SetupRanges(esd);
14035
14036 ptDist = (TH2*) esd->GetUEHist(2)->GetEventHist()->Project(step, 0, 1);
14037
14038 Printf("%f", ptDist->Integral());
14039}
14040
14041void CorrectPtDistribution(const char* fileNameCorrections, const char* fileNameESD, const char* outputFile)
14042{
14043 Int_t step = 8;
14044
14045 loadlibs();
14046
14047 AliUEHistograms* corr = (AliUEHistograms*) GetUEHistogram(fileNameCorrections);
14048
14049 TList* list = 0;
14050 AliUEHistograms* esd = (AliUEHistograms*) GetUEHistogram(fileNameESD, &list);
14051
14052 SetupRanges(corr);
14053 SetupRanges(esd);
14054
14055 corr->SetEtaRange(-0.89, 0.89);
14056 corr->ExtendTrackingEfficiency(0);
14057
14058 eff = corr->GetUEHist(2)->GetTrackingEfficiencyCorrectionCentrality();
14059 new TCanvas; eff->Draw("COLZ");
14060
14061 cont = corr->GetUEHist(2)->GetTrackingContaminationCentrality();
14062 new TCanvas; cont->Draw("COLZ");
14063
14064 ptDist = (TH2*) esd->GetUEHist(2)->GetEventHist()->Project(step, 0, 1);
14065 ptDist->SetStats(0);
14066 new TCanvas; ptDist->DrawCopy("COLZ");
14067
14068 for (Int_t x=1; x<=ptDist->GetNbinsX(); x++)
14069 for (Int_t y=1; y<=ptDist->GetNbinsY(); y++)
14070 {
14071 Float_t factor = eff->GetBinContent(eff->GetXaxis()->FindBin(ptDist->GetXaxis()->GetBinCenter(x)), eff->GetYaxis()->FindBin(ptDist->GetYaxis()->GetBinCenter(y)));
14072 Float_t contFactor = cont->GetBinContent(cont->GetXaxis()->FindBin(ptDist->GetXaxis()->GetBinCenter(x)), cont->GetYaxis()->FindBin(ptDist->GetYaxis()->GetBinCenter(y)));
14073
14074 printf("%f", contFactor);
14075 if (contFactor > 0)
14076 contFactor = 1.0 + 1.1 * (contFactor - 1.0);
14077 printf(" --> %f\n", contFactor);
14078
14079 factor *= contFactor;
14080
14081 ptDist->SetBinContent(x, y, ptDist->GetBinContent(x, y) * factor);
14082 ptDist->SetBinError(x, y, ptDist->GetBinError(x, y) * factor);
14083 }
14084
14085 new TCanvas; ptDist->DrawCopy("COLZ");
14086
14087 file3 = TFile::Open(outputFile, "RECREATE");
14088 ptDist->Write("ptDist");
14089 file3->Write();
14090 file3->Close();
14091
14092 delete corr;
14093 delete esd;
14094}
14095
14096void CorrectPtDistributionAll()
14097{
14098 CorrectPtDistribution("LHC11a10a_bis_AOD090_120406.root", "LHC10h_AOD086_120411_zvtx_rebinned.root", "ptdist1.root");
14099 CorrectPtDistribution("LHC11a10a_bis_AOD090_120505_zvtx_hybrid.root", "LHC10h_AOD086_120411_hybrid_zvtx_rebinned.root", "ptdist2.root");
14100 CorrectPtDistribution("LHC11a10a_bis_AOD090_120505_zvtx_raa.root", "LHC10h_AOD086_120430_raacuts_zvtx_rebinned.root", "ptdist3.root");
14101}
14102
14103void CreateNormalizationTestObject(Bool_t addRidge = kFALSE)
14104{
14105 loadlibs();
14106 gSystem->Load("libPWGCFCorrelationsDPhi");
14107
14108 AliUEHistograms* hNew = new AliUEHistograms("AliUEHistogramsSame", "5RC");
14109
14110 // fill 1000 particles in one bin
14111 TObjArray* particles = new TObjArray;
14112 particles->Add(new AliDPhiBasicParticle(0, 0, 3.5, 1));
14113 for (Int_t i=0; i<2000; i++)
14114 particles->Add(new AliDPhiBasicParticle(gRandom->Gaus(0, 0.3), gRandom->Gaus(0, 0.3), 1.75, 1));
14115
14116 hNew->FillCorrelations(61, 0, 8, particles);
14117
14118 if (addRidge)
14119 {
14120 for (Int_t i=0; i<10000; i++)
14121 particles->Add(new AliDPhiBasicParticle(gRandom->Uniform(-2, 2), gRandom->Gaus(0, 0.5), 1.75, 1));
14122 }
14123
14124 hNew->FillCorrelations(0.5, 0, 8, particles);
14125
14126 // fill flat mixed event
14127 AliUEHistograms* hMixedNew = new AliUEHistograms("AliUEHistogramsMixed", "5RC");
14128 THnSparse* sparse = hMixedNew->GetUEHist(2)->GetTrackHist(0)->GetGrid(8)->GetGrid();
14129 for (Int_t x=1; x<=sparse->GetAxis(0)->GetNbins(); x++)
14130 for (Int_t y=1; y<=sparse->GetAxis(4)->GetNbins(); y++)
14131 {
14132 Double_t bin[6];
14133 bin[0] = sparse->GetAxis(0)->GetBinCenter(x);
14134 bin[4] = sparse->GetAxis(4)->GetBinCenter(y);
14135 bin[1] = 1.75;
14136 bin[2] = 3.5;
14137 bin[3] = 0.5;
14138 bin[5] = 0;
14139 sparse->Fill(bin);
14140
14141 bin[3] = 61;
14142 sparse->Fill(bin);
14143
14144 bin[3] = 0.5;
14145 bin[2] = 1.75;
14146 sparse->Fill(bin);
14147
14148 bin[3] = 61;
14149 sparse->Fill(bin);
14150 }
14151
14152 Double_t bin[6];
14153 bin[0] = 3.5;
14154 bin[1] = 0.5;
14155 bin[2] = 0;
14156 hMixedNew->GetUEHist(2)->GetEventHist()->GetGrid(8)->GetGrid()->Fill(bin);
14157
14158 bin[1] = 61;
14159 hMixedNew->GetUEHist(2)->GetEventHist()->GetGrid(8)->GetGrid()->Fill(bin);
14160
14161 bin[1] = 0.5;
14162 bin[0] = 1.75;
14163 hMixedNew->GetUEHist(2)->GetEventHist()->GetGrid(8)->GetGrid()->Fill(bin);
14164
14165 bin[1] = 61;
14166 hMixedNew->GetUEHist(2)->GetEventHist()->GetGrid(8)->GetGrid()->Fill(bin);
14167
14168 ((AliTHn*) hNew->GetUEHist(2)->GetTrackHist(0))->FillParent();
14169 ((AliTHn*) hNew->GetUEHist(2)->GetTrackHist(0))->DeleteContainers();
14170
14171 ((AliTHn*) hMixedNew->GetUEHist(2)->GetTrackHist(0))->FillParent();
14172 ((AliTHn*) hMixedNew->GetUEHist(2)->GetTrackHist(0))->DeleteContainers();
14173
14174 list = new TList;
14175 list->Add(hNew);
14176 list->Add(hMixedNew);
14177
14178 file3 = TFile::Open("norm.root", "RECREATE");
14179 file3->mkdir("PWG4_PhiCorrelations");
14180 file3->cd("PWG4_PhiCorrelations");
14181 list->Write("histosPhiCorrelations", TObject::kSingleKey);
14182 file3->Close();
14183}
14184
14185void CompareSumOfRatiosAndDefault(const char* fileName, Int_t bin, Int_t step)
14186{
14187 loadlibs();
14188
14189 Int_t centralityFrom = 0;
14190 Int_t centralityTo = 20;
14191
14192 gpTMin = 1.01;
14193 gpTMax = 1.99;
14194
14195 Float_t ptTrigBegin = 2.01;
14196 Float_t ptTrigEnd = 3.99;
14197
14198 if (bin == 1)
14199 {
14200 ptTrigBegin = 1.01;
14201 ptTrigEnd = 1.99;
14202 }
14203 else if (bin == 2)
14204 {
14205 gpTMin = 0.49;
14206 gpTMax = 0.99;
14207 ptTrigBegin = 0.49;
14208 ptTrigEnd = 0.99;
14209 }
14210
14211 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
14212 hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE);
14213
14214 SetupRanges(h);
14215 SetupRanges(hMixed);
14216
14217 TH2* hist1 = 0;
14218 TH2* hist2 = 0;
14219 GetSumOfRatios(h, hMixed, &hist1, step, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd, kTRUE);
14220 GetDistAndFlow(h, hMixed, &hist2, 0, step, centralityFrom, centralityTo, ptTrigBegin, ptTrigEnd, 1, kTRUE, 0, kTRUE);
14221
14222 hist1->Rebin2D(2, 2); hist1->Scale(0.25);
14223 hist2->Rebin2D(2, 2); hist2->Scale(0.25);
14224
14225 c = new TCanvas("c", "c", 1000, 1000);
14226 c->Divide(2, 3);
14227
14228 c->cd(1);
14229 hist1->DrawCopy("SURF1");
14230
14231 c->cd(2);
14232 hist2->DrawCopy("SURF1");
14233
14234 c->cd(4);
14235 proj1 = ((TH2*) hist1)->ProjectionY("proj1", hist1->GetXaxis()->FindBin(-0.99), hist1->GetXaxis()->FindBin(0.99));
14236 proj1->DrawCopy();
14237 proj2 = ((TH2*) hist2)->ProjectionY("proj2", hist2->GetXaxis()->FindBin(-0.99), hist2->GetXaxis()->FindBin(0.99));
14238 proj2->SetLineColor(2);
14239 proj2->DrawCopy("SAME");
14240
14241 c->cd(5);
14242 proj1->Divide(proj1, proj2, 1, 1, "B");
14243 proj1->DrawCopy();
14244
14245 c->cd(3);
14246 hist1->Divide(hist2);
14247 hist1->DrawCopy("SURF1");
14248}
14249
14250void PtDistribution(const char* fileName, Int_t step, Int_t bin = 0)
14251{
14252 Int_t centralityFrom = 0;
14253 Int_t centralityTo = 80;
14254
14255 Float_t ptTrigBegin = 2.01;
14256 Float_t ptTrigEnd = 3.99;
14257
14258 if (bin == 1)
14259 {
14260 ptTrigBegin = 1.01;
14261 ptTrigEnd = 1.99;
14262 }
14263 else if (bin == 2)
14264 {
14265 ptTrigBegin = 0.51;
14266 ptTrigEnd = 0.99;
14267 }
14268
14269 loadlibs();
14270
14271 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
14272
14273 Int_t centralityBeginBin = 0;
14274 Int_t centralityEndBin = -1;
14275
14276 if (centralityTo >= centralityFrom)
14277 {
14278 centralityBeginBin = h->GetUEHist(2)->GetEventHist()->GetGrid(step)->GetGrid()->GetAxis(1)->FindBin(0.01 + centralityFrom);
14279 centralityEndBin = h->GetUEHist(2)->GetEventHist()->GetGrid(step)->GetGrid()->GetAxis(1)->FindBin(-0.01 + centralityTo);
14280 }
14281
14282 pt1 = h->GetUEHist(2)->GetPtHist(step, 0, ptTrigBegin, ptTrigEnd, centralityBeginBin, centralityEndBin, TMath::Pi()/2 - 0.2, TMath::Pi()/2 + 0.2, -1.99, 1.99);
14283 pt2 = h->GetUEHist(2)->GetPtHist(step, 0, ptTrigBegin, ptTrigEnd, centralityBeginBin, centralityEndBin, -0.5, 0.5, -1.99, 1.99);
14284
14285 new TCanvas;
14286 pt1->DrawCopy();
14287 pt2->SetLineColor(2);
14288 pt2->DrawCopy("SAME");
14289 gPad->SetLogy();
14290
14291 // TODO proper subtraction, to get the pT distribution in the peak
14292}
14293
14294void GetRefMultiplicity(const char* fileNameESD, const char* tag = "")
14295{
14296 Int_t step = 8;
14297
14298 loadlibs();
14299
14300 AliUEHistograms* esd = (AliUEHistograms*) GetUEHistogram(fileNameESD, 0, kFALSE, tag);
14301
14302 Float_t centrBins[] = { 0, 20, 40, 60, 100 };
14303// Float_t centrBins[] = { 0, 100 };
14304
14305 // NOTE Run it on data with limited zvtx range so that there are no empty bins in the corrections!
14306
14307 for (Int_t i=0; i<4; i++)
14308 {
14309 Float_t centrBegin = centrBins[i] + 0.1;
14310 Float_t centrEnd = centrBins[i+1] - 0.1;
14311 esd->GetUEHist(2)->GetEventHist()->GetGrid(step)->GetGrid()->GetAxis(1)->SetRangeUser(centrBegin, centrEnd);
14312
14313 ptDist = (TH2*) esd->GetUEHist(2)->GetEventHist()->Project(step, 0);
14314
14315 centrDist = esd->GetCentralityDistribution();
14316
14317 if (1)
14318 {
14319 // add syst from R_pA
14320 for (Int_t j=1; j<=ptDist->GetNbinsX(); j++)
14321 ptDist->SetBinError(j, TMath::Sqrt(ptDist->GetBinError(j) * ptDist->GetBinError(j) + 0.052 * 0.052 * ptDist->GetBinContent(j) * ptDist->GetBinContent(j)));
14322 }
14323
14324 Float_t events = centrDist->Integral(centrDist->FindBin(centrBegin), centrDist->FindBin(centrEnd));
14325 Double_t error = 0;
14326// Float_t integral = ptDist->IntegralAndError(ptDist->FindBin(0.51), ptDist->FindBin(3.99), error);
14327 Float_t integral = ptDist->IntegralAndError(ptDist->FindBin(0.51), ptDist->FindBin(7.99), error);
14328 Printf("%d: %f +- %f %f --> %f +- %F", i, integral, error, events, integral / events, error / events);
14329
14330 ptDist->Scale(1.0 / events);
14331// ptDist->Scale(1.0 / integral);
14332
14333// ptDist->Rebin(2);
14334
14335 NormalizeToBinWidth(ptDist);
14336 ptDist->SetLineColor(i + 1);
14337 ptDist->DrawCopy((i == 0) ? "" : "SAME");
14338 }
14339 gPad->SetLogy();
14340
14341 TFile::Open("dNdPt_pPb_lab_MinBias_NEW.root");
14342 comparison = (TH1*) gFile->Get("dNdPt_pPb_eta08_stat");
14343 comparison->Scale(1.6); // normalize to my eta range
14344 comparison->SetLineColor(2);
14345 comparison->DrawCopy("SAME");
14346
14347 //rebin
14348 for (Int_t i=1; i<=comparison->GetNbinsX(); i++)
14349 {
14350 // multiply by bin width
14351 comparison->SetBinContent(i, comparison->GetBinContent(i) * comparison->GetBinWidth(i));
14352 comparison->SetBinError(i, comparison->GetBinError(i) * comparison->GetBinWidth(i));
14353 }
14354
14355 Float_t integral = comparison->IntegralAndError(comparison->FindBin(0.51), comparison->FindBin(7.99), error);
14356 Float_t integral2 = comparison->IntegralAndError(comparison->FindBin(0.51), comparison->FindBin(19.99), error);
14357 Printf("%f %f", integral, integral2);
14358
14359 Float_t integral = comparison->IntegralAndError(comparison->FindBin(0.51), comparison->FindBin(7.99), error);
14360 Float_t integral2 = comparison->IntegralAndError(comparison->FindBin(0.61), comparison->FindBin(7.99), error);
14361 Printf("%f %f", integral, integral2);
14362
14363 rebinned = comparison->Rebin(ptDist->GetNbinsX(), "rebinned", ptDist->GetXaxis()->GetXbins()->GetArray());
14364
14365
14366 NormalizeToBinWidth(rebinned);
14367 rebinned->Draw("SAME");
14368
14369 new TCanvas;
14370 ptDist->Divide(rebinned);
14371 ptDist->Draw();
14372
14373 return;
14374
14375 new TCanvas;
14376 syst = (TH1*) gFile->Get("dNdPt_pPb_eta08_syst");
14377 syst->DrawCopy();
14378
14379 new TCanvas;
14380 for (Int_t i=1; i<=syst->GetNbinsX(); i++)
14381 {
14382 if (syst->GetBinContent(i) > 0)
14383 syst->SetBinContent(i, syst->GetBinError(i) / syst->GetBinContent(i));
14384 syst->SetBinError(i, 0);
14385 }
14386 syst->Draw();
14387}
14388
14389void CheckBin(const char* fileName)
14390{
14391 loadlibs();
14392
14393 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
14394 AliUEHistograms* hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE);
14395
14396 sparse = h->GetUEHist(2)->GetTrackHist(0)->GetGrid(8)->GetGrid();
14397 sparse->GetAxis(1)->SetRangeUser(5, 5.1);
14398 sparse->GetAxis(2)->SetRangeUser(7, 7.1);
14399 sparse->GetAxis(3)->SetRangeUser(90, 91);
14400 sparse->GetAxis(4)->SetRangeUser(9, 9.1);
14401
14402 new TCanvas;
14403 sparse->Projection(0, 4)->Draw("colz");
14404
14405 sparse = hMixed->GetUEHist(2)->GetTrackHist(0)->GetGrid(8)->GetGrid();
14406 sparse->GetAxis(1)->SetRangeUser(5, 5.1);
14407 sparse->GetAxis(2)->SetRangeUser(7, 7.1);
14408 sparse->GetAxis(3)->SetRangeUser(90, 91);
14409 sparse->GetAxis(4)->SetRangeUser(9, 9.1);
14410
14411 new TCanvas;
14412 sparse->Projection(0, 4)->Draw("colz");
14413}
14414
14415void GetCorrectedYields(const char* fileName, const char* correctionFile)
14416{
14417 loadlibs();
14418
14419 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
14420
14421 // centrality, pT, eta
14422 yieldsUncorr = h->GetYield();
14423 new TCanvas; yieldsUncorr->DrawCopy();
14424// new TCanvas; yieldsUncorr->ProjectionX("x1")->DrawCopy();
14425
14426 // normalize per event
14427 centrDist = h->GetCentralityCorrelation()->ProjectionX();
14428 new TCanvas; centrDist->Draw();
14429
14430 for (Int_t x=1; x<=yieldsUncorr->GetNbinsX(); x++)
14431 {
14432 Double_t factor = centrDist->GetBinContent(centrDist->FindBin(yieldsUncorr->GetXaxis()->GetBinCenter(x)));
14433// Printf("%d %f %d %f", x, yieldsUncorr->GetXaxis()->GetBinCenter(x), centrDist->FindBin(yieldsUncorr->GetXaxis()->GetBinCenter(x)), factor);
14434 if (factor <= 0)
14435 continue;
14436
14437 for (Int_t y=0; y<=yieldsUncorr->GetNbinsY()+1; y++)
14438 for (Int_t z=0; z<=yieldsUncorr->GetNbinsZ()+1; z++)
14439 {
14440 if (yieldsUncorr->GetBinContent(x, y, z) <= 0)
14441 continue;
14442 yieldsUncorr->SetBinContent(x, y, z, yieldsUncorr->GetBinContent(x, y, z) / factor);
14443 yieldsUncorr->SetBinError(x, y, z, yieldsUncorr->GetBinError(x, y, z) / factor);
14444 }
14445 }
14446
14447// new TCanvas; yieldsUncorr->ProjectionX("x2")->DrawCopy(); return;
14448
14449 AliUEHistograms* hCorr = (AliUEHistograms*) GetUEHistogram(correctionFile);
14450
14451 hCorr->GetUEHist(2)->GetTrackHistEfficiency()->GetGrid(0)->GetGrid()->GetAxis(4)->SetRangeUser(-1.9, 1.9);
14452 hCorr->GetUEHist(2)->GetTrackHistEfficiency()->GetGrid(2)->GetGrid()->GetAxis(4)->SetRangeUser(-1.9, 1.9);
14453
14454 // eta, pT
14455 TH2* generated = hCorr->GetUEHist(2)->GetTrackHistEfficiency()->GetGrid(0)->GetGrid()->Projection(1, 0);
14456 TH2* measured = hCorr->GetUEHist(2)->GetTrackHistEfficiency()->GetGrid(2)->GetGrid()->Projection(1, 0);
14457
14458 Printf("%f %f", generated->GetEntries(), measured->GetEntries());
14459
14460 new TCanvas; generated->Draw("COLZ");
14461 new TCanvas; measured->Draw("COLZ");
14462
14463 effCorr = (TH2*) generated->Clone("correction");
14464 effCorr->Divide(generated, measured, 1, 1, "B");
14465
14466 new TCanvas; effCorr->Draw("COLZ");
14467
14468// return;
14469
14470 yieldsCorr = (TH3F*) yieldsUncorr->Clone("fYieldsCorr");
14471 yieldsCorr->Reset();
14472
14473 for (Int_t x=1; x<=yieldsUncorr->GetNbinsX(); x++)
14474 for (Int_t y=1; y<=yieldsUncorr->GetNbinsY(); y++)
14475 for (Int_t z=1; z<=yieldsUncorr->GetNbinsZ(); z++)
14476 {
14477 Double_t factor = effCorr->GetBinContent(effCorr->GetXaxis()->FindBin(yieldsUncorr->GetZaxis()->GetBinCenter(z)), effCorr->GetYaxis()->FindBin(yieldsUncorr->GetYaxis()->GetBinCenter(y)));
14478 yieldsCorr->SetBinContent(x, y, z, yieldsUncorr->GetBinContent(x, y, z) * factor);
14479 yieldsCorr->SetBinError(x, y, z, yieldsUncorr->GetBinError(x, y, z) * factor);
14480 }
14481
14482 new TCanvas; yieldsCorr->DrawCopy();
14483
14484 TFile::Open("corr_yield.root", "RECREATE");
14485 yieldsCorr->Write();
14486 gFile->Close();
14487
14488 yieldsUncorr->GetXaxis()->SetRangeUser(1, yieldsUncorr->GetNbinsX());
14489
14490 new TCanvas; yieldsUncorr->Project3D("z1")->DrawCopy()->SetLineColor(1); yieldsCorr->Project3D("z2")->DrawCopy("SAME")->SetLineColor(2);
14491
14492 yieldsUncorr->GetXaxis()->SetRangeUser(0.1, 9.9);
14493 yieldsCorr->GetXaxis()->SetRangeUser(0.1, 9.9);
14494 new TCanvas; yieldsUncorr->Project3D("z3")->DrawCopy()->SetLineColor(1); yieldsCorr->Project3D("z4")->DrawCopy("SAME")->SetLineColor(2);
14495 yieldsUncorr->GetXaxis()->SetRangeUser(60.1, 99.9);
14496 yieldsCorr->GetXaxis()->SetRangeUser(60.1, 99.9);
14497 yieldsUncorr->Project3D("z5")->DrawCopy("SAME")->SetLineColor(3); yieldsCorr->Project3D("z6")->DrawCopy("SAME")->SetLineColor(4);
14498}
14499
14500void PlotPtCentrality()
14501{
14502 TFile::Open("corr_yield.root");
14503 yieldsCorr = (TH3F*) gFile->Get("fYieldsCorr");
14504
14505 yieldsCorr->GetZaxis()->SetRangeUser(-0.4999, 0.4999);
14506 yieldsProj = (TH2*) yieldsCorr->Project3D("yx");
14507 Printf("%f", yieldsProj->Integral());
14508
14509 Float_t ptMin[] = { 0.5001, 1.0001, 2.0001 };
14510 Float_t ptMax = 10;
14511
14512 for (Int_t i=0; i<3; i++)
14513 {
14514 profile = yieldsProj->ProjectionX(Form("x%d", i), yieldsProj->GetYaxis()->FindBin(ptMin[i]), yieldsProj->GetYaxis()->FindBin(ptMax));
14515 profile->SetLineColor(i+1);
14516 profile->Draw((i > 0) ? "SAME" : "");
14517 }
14518}
14519
14520void ExtractForAllSpecies()
14521{
14522 TString baseName = "LHC13b2_fix_1_Train";
14523 const char* suffix[] = { "55_Hadrons_symmetrized", "63_Pions", "63_Kaons", "63_Protons" };
14524 TString baseNameOutput = "dphi_corr_mc_130531_allpt_";
14525
14526 for (Int_t i=0; i<4; i++)
14527 PlotDeltaPhiEtaGap(baseName + suffix[i] + ".root", 0, 0, 0, baseNameOutput + suffix[i] + ".root");
14528}
14529
14530void Compare2D(const char* fileName, const char* fileName2)
14531{
14532 Int_t step = 8;
14533
14534 gpTMin = 1.01;
14535 gpTMax = 1.99;
14536
14537 loadlibs();
14538
14539 AliUEHistograms* h = (AliUEHistograms*) GetUEHistogram(fileName);
14540 hMixed = (AliUEHistograms*) GetUEHistogram(fileName, 0, kTRUE);
14541
14542 AliUEHistograms* h2 = (AliUEHistograms*) GetUEHistogram(fileName2);
14543 hMixed2 = (AliUEHistograms*) GetUEHistogram(fileName2, 0, kTRUE);
14544
14545 SetupRanges(h);
14546 SetupRanges(hMixed);
14547 SetupRanges(h2);
14548 SetupRanges(hMixed2);
14549
14550// h->SetZVtxRange(0.1, 0.5);
14551// hMixed->SetZVtxRange(0.1, 0.5);
14552// h2->SetZVtxRange(0.1, 0.5);
14553// hMixed2->SetZVtxRange(0.1, 0.5);
14554
14555 TH1* hist1 = 0;
14556 GetDistAndFlow(h, 0, &hist1, 0, step, 0, 20, 1.01, 1.99, 1, kTRUE, 0, kTRUE);
14557
14558 TH1* hist2 = 0;
14559 GetDistAndFlow(h2, 0, &hist2, 0, step, 0, 20, 1.01, 1.99, 1, kTRUE, 0, kTRUE);
14560
14561 c = new TCanvas("c", "c", 1600, 800);
14562 c->Divide(2, 1);
14563 c->cd(1);
14564 gPad->SetLeftMargin(0.15);
14565
14566 hist1->DrawCopy("SURF1");
14567
14568 c->cd(2);
14569 gPad->SetLeftMargin(0.15);
14570
14571 hist2->DrawCopy("SURF1");
14572
14573 Printf("%f %f", hist1->Integral(), hist2->Integral());
14574
14575 new TCanvas("c3", "c3", 800, 800);
14576 gPad->SetLeftMargin(0.15);
14577 hist2->Divide(hist1);
14578 hist2->DrawCopy("COLZ");
14579}
14580
14581//Geant3/Fluka correction for tracking from the spectra analysis
14582TF1 *
14583TrackingEff_geantflukaCorrection(Int_t ipart, Int_t icharge)
14584{
14585
14586 if (ipart == 3 && icharge == kNegative) {
14587 TF1 *f = new TF1(Form("fGeantFluka_%s_%s", AliPID::ParticleName(ipart), Sign[icharge]), "TrackingPtGeantFlukaCorrectionKaMinus(x);p_{T};GF correction", 0., 5.);
14588 return f;
14589 }
14590 else if (ipart == 4 && icharge == kNegative) {
14591 TF1 *f = new TF1(Form("fGeantFluka_%s_%s", AliPID::ParticleName(ipart), Sign[icharge]), "TrackingPtGeantFlukaCorrectionPrMinus(x);p_{T};GF correction", 0., 5.);
14592 }
14593 else
14594 TF1 *f = new TF1(Form("fGeantFluka_%s_%s", AliPID::ParticleName(ipart), Sign[icharge]), "TrackingPtGeantFlukaCorrectionNull(x);p_{T};GF correction", 0., 5.);
14595
14596 return f;
14597}
14598
14599Double_t
14600TrackingPtGeantFlukaCorrectionNull(Double_t pTmc)
14601{
14602 return 1.;
14603}
14604
14605Double_t
14606TrackingPtGeantFlukaCorrectionPrMinus(Double_t pTmc)
14607{
14608 return (1 - 0.129758 *TMath::Exp(-pTmc*0.679612));
14609}
14610
14611Double_t
14612TrackingPtGeantFlukaCorrectionKaMinus(Double_t pTmc)
14613{
14614 return TMath::Min((0.972865 + 0.0117093*pTmc), 1.);
14615}
14616
14617//Geant3/Fluka correction for matching from the spectra analysis
14618TF1 *
14619TOFmatchMC_geantflukaCorrection(Int_t ipart, Int_t icharge,Int_t ntrd)
14620{
14621 if (ipart == 3 && icharge == kNegative) {
14622 TF1 *f = new TF1(Form("fGeantFluka_%s_%s", AliPID::ParticleName(ipart), Sign[icharge]),Form("MatchingPtGeantFlukaCorrectionKaMinus(x,%d);p_{T};GF correction",ntrd), 0., 5.);
14623 return f;
14624 }
14625 else if (ipart == 4 && icharge == kNegative) {
14626 TF1 *f = new TF1(Form("fGeantFluka_%s_%s", AliPID::ParticleName(ipart), Sign[icharge]),Form("MatchingPtGeantFlukaCorrectionPrMinus(x,%d);p_{T};GF correction",ntrd), 0., 5.);
14627 }
14628 else
14629 TF1 *f = new TF1(Form("fGeantFluka_%s_%s", AliPID::ParticleName(ipart), Sign[icharge]), "MatchingPtGeantFlukaCorrectionNull(x);p_{T};GF correction", 0., 5.);
14630
14631 return f;
14632}
14633
14634
14635Double_t
14636MatchingPtGeantFlukaCorrectionNull(Double_t pTmc)
14637{
14638 return 1.;
14639}
14640Double_t
14641MatchingPtGeantFlukaCorrectionKaMinus(Double_t pTmc, Int_t ntrd = 7)//ntrd is 7 in 2010, 10 in 2011, 13 in 2012+2013
14642{
14643 Float_t ptTPCoutK=pTmc*(1- 3.37297e-03/pTmc/pTmc - 3.26544e-03/pTmc);
14644 Float_t scale = (ntrd * 0.14638485 + (18 - ntrd) * 0.02406) / 18.;
14645 return TMath::Min((TMath::Power(0.972865 + 0.0117093*ptTPCoutK,scale/0.03471)), 1.);
14646}
14647Double_t
14648MatchingPtGeantFlukaCorrectionPrMinus(Double_t pTmc, Int_t ntrd = 7)//ntrd is 7 in 2010, 10 in 2011, 13 in 2012+2013
14649{
14650 Float_t ptTPCoutP =pTmc*(1-6.81059e-01*TMath::Exp(-pTmc*4.20094));
14651 Float_t scale = (ntrd * 0.14638485 + (18 - ntrd) * 0.02406) / 18.;
14652 return (TMath::Power(1 - 0.129758*TMath::Exp(-ptTPCoutP*0.679612),scale/0.03471));
14653}