486218874b3afa00722978fb4f014d390addbbce
[u/mrichter/AliRoot.git] / PWGCF / Correlations / macros / dphicorrelations / correct.C
1 Float_t gpTMin = 0.51;
2 Float_t gpTMax = 49.99;
3 Int_t gUEHist = 0;
4 Bool_t gCache = 0;
5 void* gFirst = 0;
6 void* gSecond = 0;
7 Float_t gForceRange = -1;
8 Int_t gEnergy = 900;
9 Int_t gRegion = 0;
10 const char* gText = "";
11 TString Sign[]={"Plus","Minus"};
12 enum ECharge_t {
13   kPositive,
14   kNegative,
15   kNCharges
16 };
17
18 void 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
27 void SetRanges(TH1* hist)
28 {
29   SetRanges(hist->GetXaxis());
30   SetRanges(hist->GetYaxis());
31   SetRanges(hist->GetZaxis());
32 }
33
34 void 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
49 TH1* 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
175 void 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
324 void loadlibs()
325 {
326   gSystem->Load("libANALYSIS");
327   gSystem->Load("libANALYSISalice");
328   gSystem->Load("libCORRFW");
329   gSystem->Load("libPWGTools");
330   gSystem->Load("libPWGCFCorrelationsBase");
331 }
332
333 const char* lastFileName = 0;
334 void* cacheSameEvent = 0;
335 void* cacheMixedEvent = 0;
336
337 void* 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
380 void 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   
413 void 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
432 Int_t count = 0;
433
434 void 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
484 void 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
500 void 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
519 void 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
530 void 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
541 TH1* 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
552 void 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
630 void 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
855 void 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
944 void 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
1191 void 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
1319 void 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
1460 void 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
1626 void 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
1741 void 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
1753 void 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
1767 void 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
1777 void 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
1816 void 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
1842 void 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
1875 void 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
1906 void 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
1962 void 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
2012 void 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
2036 void 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
2073 void 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
2114 void 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
2240 void 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
2272 void 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
2285 void 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
2299 void 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
2361 void 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 /*
2402 TGraph* 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 /*
2475 TGraph* 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 /*
2524 TGraph* 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 */
2536 TGraphErrors* 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
2607 TGraphErrors* 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
2687 TGraphErrors* 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
2756 TGraphErrors* 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
2841 TGraphErrors* 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
2905 TGraphErrors* 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
2969 TGraphErrors* 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
3033 TGraphErrors* 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
3096 TGraphErrors* 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
3163 TGraphErrors* 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
3193 TGraphErrors* 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
3233 TGraphErrors* 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
3308 TGraphErrors* 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
3348 TGraphErrors* 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,
3357 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.250000,
3358 4.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,
3360 0.066516,0.073891,0.080945,0.090386,0.094505,0.106393,0.120303,0.122586,0.121731,0.107343,
3361 0.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,
3364 0.000586,0.000717,0.000880,0.001082,0.001333,0.001189,0.001969,0.003199,0.005011,0.007602,
3365 0.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
3376 TGraphErrors* 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
3416 TGraphErrors* 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,
3425 1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.250000,
3426 4.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,
3428 0.094701,0.105631,0.117906,0.128147,0.138505,0.153494,0.166651,0.172691,0.177337,0.155068,
3429 0.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,
3432 0.000423,0.000517,0.000634,0.000779,0.000959,0.000856,0.001406,0.002266,0.003528,0.005281,
3433 0.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     
3444 TGraphErrors* 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
3484 TGraphErrors* 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
3524 TGraphErrors* 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
3556 TGraphErrors* 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
3578 Float_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
3662 void 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   {