]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FLOW/AliFlowCommon/AliFlowAnalysisWithCumulants.cxx
fix ownerschip of TLists
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowCommon / AliFlowAnalysisWithCumulants.cxx
1 /*************************************************************************
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
3 *                                                                        *
4 * Author: The ALICE Off-line Project.                                    *
5 * Contributors are mentioned in the code where appropriate.              *
6 *                                                                        *
7 * Permission to use, copy, modify and distribute this software and its   *
8 * documentation strictly for non-commercial purposes is hereby granted   *
9 * without fee, provided that the above copyright notice appears in all   *
10 * copies and that both the copyright notice and this permission notice   *
11 * appear in the supporting documentation. The authors make no claims     *
12 * about the suitability of this software for any purpose. It is          *
13 * provided "as is" without express or implied warranty.                  * 
14 **************************************************************************/
15
16 /******************************** 
17  * flow analysis with cumulants * 
18  *                              *
19  * author: Ante Bilandzic       * 
20  *          (anteb@nikhef.nl)   *
21  *******************************/ 
22
23 #define AliFlowAnalysisWithCumulants_cxx
24
25 #include "Riostream.h"
26 #include "AliFlowCommonConstants.h"
27 #include "AliFlowCommonHist.h"
28 #include "AliFlowCommonHistResults.h"
29 #include "TChain.h"
30 #include "TFile.h"
31 #include "TList.h" //NEW
32 #include "TParticle.h"
33 #include "TRandom3.h"
34 #include "TProfile.h"
35 #include "TProfile2D.h" 
36 #include "TProfile3D.h"
37 #include "AliFlowEventSimple.h"
38 #include "AliFlowTrackSimple.h"
39 #include "AliFlowAnalysisWithCumulants.h"
40 #include "AliFlowCumuConstants.h"
41 #include "AliCumulantsFunctions.h"
42
43 class TH1;
44 class TGraph;
45 class TPave;
46 class TLatex;
47 class TMarker;
48 class TRandom3;
49 class TObjArray;
50 class TList;
51 class TCanvas;
52 class TSystem;
53 class TROOT;
54 class AliFlowVector;
55 class TVector;
56
57 //================================================================================================================
58
59 ClassImp(AliFlowAnalysisWithCumulants)
60
61 AliFlowAnalysisWithCumulants::AliFlowAnalysisWithCumulants():  
62  fTrack(NULL),
63  fHistList(NULL),
64  fWeightsList(NULL),
65  fR0(0),
66  fPtMax(0),
67  fPtMin(0),
68  fBinWidthPt(0),
69  fgknBinsPt(0),
70  fEtaMax(0),
71  fEtaMin(0),
72  fBinWidthEta(0),
73  fgknBinsEta(0),
74  fAvQx(0),
75  fAvQy(0),
76  fAvQ2x(0),
77  fAvQ2y(0),
78  fAvMultIntFlowGFC(NULL),
79  fQVectorComponentsGFC(NULL),
80  fIntFlowResultsGFC(NULL),
81  fDiffFlowResults2ndOrderGFC(NULL),
82  fDiffFlowResults4thOrderGFC(NULL),
83  fDiffFlowResults6thOrderGFC(NULL),
84  fDiffFlowResults8thOrderGFC(NULL),
85  fCommonHistsResults2nd(NULL),
86  fCommonHistsResults4th(NULL),
87  fCommonHistsResults6th(NULL),
88  fCommonHistsResults8th(NULL),
89  fIntFlowGenFun(NULL),
90  fIntFlowGenFun4(NULL),//(only for other system of Eq.)
91  fIntFlowGenFun6(NULL),//(only for other system of Eq.)
92  fIntFlowGenFun8(NULL),//(only for other system of Eq.)
93  fIntFlowGenFun16(NULL),//(only for other system of Eq.)
94  fAvMultIntFlow4GFC(NULL),//(only for other system of Eq.)
95  fAvMultIntFlow6GFC(NULL),//(only for other system of Eq.)
96  fAvMultIntFlow8GFC(NULL),//(only for other system of Eq.)
97  fAvMultIntFlow16GFC(NULL),//(only for other system of Eq.)
98  fDiffFlowPtRPGenFunRe(NULL),
99  fDiffFlowPtRPGenFunIm(NULL),
100  fPtBinRPNoOfParticles(NULL),
101  fDiffFlowEtaRPGenFunRe(NULL),
102  fDiffFlowEtaRPGenFunIm(NULL),
103  fEtaBinRPNoOfParticles(NULL),
104  fDiffFlowPtPOIGenFunRe(NULL),
105  fDiffFlowPtPOIGenFunIm(NULL),
106  fPtBinPOINoOfParticles(NULL),
107  fDiffFlowEtaPOIGenFunRe(NULL),
108  fDiffFlowEtaPOIGenFunIm(NULL),
109  fEtaBinPOINoOfParticles(NULL),
110  /*
111  fDiffFlowGenFunRe0(NULL),
112  fDiffFlowGenFunRe1(NULL),
113  fDiffFlowGenFunRe2(NULL),
114  fDiffFlowGenFunRe3(NULL),
115  fDiffFlowGenFunRe4(NULL),
116  fDiffFlowGenFunRe5(NULL),
117  fDiffFlowGenFunRe6(NULL),
118  fDiffFlowGenFunRe7(NULL),
119  fDiffFlowGenFunIm0(NULL),
120  fDiffFlowGenFunIm1(NULL),
121  fDiffFlowGenFunIm2(NULL),
122  fDiffFlowGenFunIm3(NULL),
123  fDiffFlowGenFunIm4(NULL),
124  fDiffFlowGenFunIm5(NULL),
125  fDiffFlowGenFunIm6(NULL),
126  fDiffFlowGenFunIm7(NULL),
127  */
128  fCommonHists(NULL),
129  fOtherEquations(kFALSE),
130  fUsePhiWeights(kFALSE),
131  fUsePtWeights(kFALSE),
132  fUseEtaWeights(kFALSE),
133  fAverageOfSquaredWeight(NULL)
134 {
135  //constructor 
136  fHistList = new TList();
137  fWeightsList = new TList();
138  fWeightsList->SetName("Weights");
139  fWeightsList->SetOwner(kTRUE);
140  fR0=AliFlowCumuConstants::fgR0;
141  //Pt:
142  fPtMax=AliFlowCommonConstants::GetPtMax(); 
143  fPtMin=AliFlowCommonConstants::GetPtMin();
144  fgknBinsPt=AliFlowCommonConstants::GetNbinsPt();
145  if(fgknBinsPt)
146  {
147   fBinWidthPt=(fPtMax-fPtMin)/fgknBinsPt;  
148  } 
149  //Eta: 
150  fEtaMax=AliFlowCommonConstants::GetEtaMax(); 
151  fEtaMin=AliFlowCommonConstants::GetEtaMin();
152  fgknBinsEta=AliFlowCommonConstants::GetNbinsEta();
153  if(fgknBinsEta)
154  {
155   fBinWidthEta=(fEtaMax-fEtaMin)/fgknBinsEta;  
156  } 
157  
158  fOtherEquations=AliFlowCumuConstants::fgOtherEquations;
159 }
160
161 AliFlowAnalysisWithCumulants::~AliFlowAnalysisWithCumulants()
162 {
163  //desctructor
164  delete fHistList; 
165  delete fWeightsList;
166 }
167
168 //================================================================================================================
169
170 void AliFlowAnalysisWithCumulants::Init()
171 {
172  //various output histograms
173  
174  //average multiplicity 
175  fAvMultIntFlowGFC = new TProfile("fAvMultIntFlowGFC","Average Weighted Multiplicity",1,0,1,"s");
176  fAvMultIntFlowGFC->SetXTitle("");
177  fAvMultIntFlowGFC->SetYTitle("");
178  fAvMultIntFlowGFC->SetLabelSize(0.06);
179  fAvMultIntFlowGFC->SetMarkerStyle(25);
180  fAvMultIntFlowGFC->SetLabelOffset(0.01);
181  (fAvMultIntFlowGFC->GetXaxis())->SetBinLabel(1,"Average Weighted Multiplicity");
182  fHistList->Add(fAvMultIntFlowGFC);
183  
184  //averages of Q-vector components (1st bin: <Q_x>, 2nd bin: <Q_y>, 3rd bin: <(Q_x)^2>, 4th bin: <(Q_y)^2>)
185  fQVectorComponentsGFC = new TProfile("fQVectorComponentsGFC","Average of Q-vector components",4,0.,4.);
186  fQVectorComponentsGFC->SetXTitle("");
187  fQVectorComponentsGFC->SetYTitle("");
188  fQVectorComponentsGFC->SetLabelSize(0.06);
189  fQVectorComponentsGFC->SetMarkerStyle(25);
190  (fQVectorComponentsGFC->GetXaxis())->SetBinLabel(1,"<Q_{x}>");
191  (fQVectorComponentsGFC->GetXaxis())->SetBinLabel(2,"<Q_{y}>");
192  (fQVectorComponentsGFC->GetXaxis())->SetBinLabel(3,"<Q_{x}^{2}>");
193  (fQVectorComponentsGFC->GetXaxis())->SetBinLabel(4,"<Q_{y}^{2}>");
194  fHistList->Add(fQVectorComponentsGFC);
195  
196  //final results for integrated flow (v_n{2}, v_n{4},..., v_n{16}) from cumulants (by default n=2) 
197  fIntFlowResultsGFC = new TH1D("fIntFlowResultsGFC","Integrated Flow From Cumulants (Generating Function)",4,0,4);
198  fIntFlowResultsGFC->SetXTitle("");
199  fIntFlowResultsGFC->SetYTitle("");
200  fIntFlowResultsGFC->SetLabelSize(0.06);
201  //fIntFlowResultsGFC->SetTickLength(1);
202  fIntFlowResultsGFC->SetMarkerStyle(25);
203  (fIntFlowResultsGFC->GetXaxis())->SetBinLabel(1,"v_{n}{2}");
204  (fIntFlowResultsGFC->GetXaxis())->SetBinLabel(2,"v_{n}{4}");
205  (fIntFlowResultsGFC->GetXaxis())->SetBinLabel(3,"v_{n}{6}");
206  (fIntFlowResultsGFC->GetXaxis())->SetBinLabel(4,"v_{n}{8}");
207  fHistList->Add(fIntFlowResultsGFC);
208   
209  //final results for differential flow v_p/n{2} (by default p=n=2)
210  fDiffFlowResults2ndOrderGFC = new TH1D("fDiffFlowResults2ndOrderGFC","v'_2/2{2}",fgknBinsPt,fPtMin,fPtMax);
211  fDiffFlowResults2ndOrderGFC->SetXTitle("pt [GeV]");
212  fDiffFlowResults2ndOrderGFC->SetYTitle("");
213  fHistList->Add(fDiffFlowResults2ndOrderGFC);
214
215  //final results for differential flow v_p/n{4} (by default p=n=2) 
216  fDiffFlowResults4thOrderGFC = new TH1D("fDiffFlowResults4thOrderGFC","v'_2/2{4}",fgknBinsPt,fPtMin,fPtMax);
217  fDiffFlowResults4thOrderGFC->SetXTitle("pt [GeV]");
218  fDiffFlowResults4thOrderGFC->SetYTitle("");
219  fHistList->Add(fDiffFlowResults4thOrderGFC);
220  
221  //final results for differential flow v_p/n{6} (by default p=n=2)  
222  fDiffFlowResults6thOrderGFC = new TH1D("fDiffFlowResults6thOrderGFC","v'_2/2{6}",fgknBinsPt,fPtMin,fPtMax);
223  fDiffFlowResults6thOrderGFC->SetXTitle("pt [GeV]");
224  fDiffFlowResults6thOrderGFC->SetYTitle("");
225  fHistList->Add(fDiffFlowResults6thOrderGFC);
226  
227  //final results for differential flow v_p/n{8} (by default p=n=2)
228  fDiffFlowResults8thOrderGFC = new TH1D("fDiffFlowResults8thOrderGFC","v'_2/2{8}",fgknBinsPt,fPtMin,fPtMax);
229  fDiffFlowResults8thOrderGFC->SetXTitle("pt [GeV]");
230  fDiffFlowResults8thOrderGFC->SetYTitle("");
231  fHistList->Add(fDiffFlowResults8thOrderGFC);
232   
233  //avarage of the generating function for integrated flow <G[p][q]>
234  fIntFlowGenFun = new TProfile2D("fIntFlowGenFun","<G[p][q]>",fgkPmax,0.,(Double_t)fgkPmax,fgkQmax,0.,(Double_t)fgkQmax);
235  fIntFlowGenFun->SetXTitle("p");
236  fIntFlowGenFun->SetYTitle("q");
237  fHistList->Add(fIntFlowGenFun);
238
239  if(fOtherEquations)
240  {
241   //avarage of the generating function for integrated flow <G[p][q]> (only for other system of Eq. - up to 4th order)
242   fIntFlowGenFun4 = new TProfile2D("fIntFlowGenFun4","<G4[p4][q4]>",fgkPmax4,0.,(Double_t)fgkPmax4,fgkQmax4,0.,(Double_t)fgkQmax4);
243   fIntFlowGenFun4->SetXTitle("p4");
244   fIntFlowGenFun4->SetYTitle("q4");
245   fHistList->Add(fIntFlowGenFun4);
246
247   //avarage of the generating function for integrated flow <G[p][q]> (only for other system of Eq. - up to 6th order) 
248   fIntFlowGenFun6 = new TProfile2D("fIntFlowGenFun6","<G6[p6][q6]>",fgkPmax6,0.,(Double_t)fgkPmax6,fgkQmax6,0.,(Double_t)fgkQmax6);
249   fIntFlowGenFun6->SetXTitle("p6");
250   fIntFlowGenFun6->SetYTitle("q6");
251   fHistList->Add(fIntFlowGenFun6);
252
253   //avarage of the generating function for integrated flow <G[p][q]> (only for other system of Eq. - up to 8th order)
254   fIntFlowGenFun8 = new TProfile2D("fIntFlowGenFun8","<G8[p8][q8]>",fgkPmax8,0.,(Double_t)fgkPmax8,fgkQmax8,0.,(Double_t)fgkQmax8);
255   fIntFlowGenFun8->SetXTitle("p8");
256   fIntFlowGenFun8->SetYTitle("q8");
257   fHistList->Add(fIntFlowGenFun8);
258
259   //avarage of the generating function for integrated flow <G[p][q]> (only for other system of Eq. - up to 16th order)
260   fIntFlowGenFun16 = new TProfile2D("fIntFlowGenFun16","<G16[p16][q16]>",fgkPmax16,0.,(Double_t)fgkPmax16,fgkQmax16,0.,(Double_t)fgkQmax16);
261   fIntFlowGenFun16->SetXTitle("p16");
262   fIntFlowGenFun16->SetYTitle("q16");
263   fHistList->Add(fIntFlowGenFun16);
264  
265   //average multiplicity (only for other system of Eq. - up to 4th order)
266   fAvMultIntFlow4GFC = new TProfile("fAvMultIntFlow4GFC","Average Multiplicity",1,0,1,"s");
267   fAvMultIntFlow4GFC->SetXTitle("");
268   fAvMultIntFlow4GFC->SetYTitle("");
269   fAvMultIntFlow4GFC->SetLabelSize(0.06);
270   fAvMultIntFlow4GFC->SetMarkerStyle(25);
271   fAvMultIntFlow4GFC->SetLabelOffset(0.01);
272   (fAvMultIntFlow4GFC->GetXaxis())->SetBinLabel(1,"Average Multiplicity");
273   fHistList->Add(fAvMultIntFlow4GFC);
274  
275   //average multiplicity (only for other system of Eq. - up to 6th order)
276   fAvMultIntFlow6GFC = new TProfile("fAvMultIntFlow6GFC","Average Multiplicity",1,0,1,"s");
277   fAvMultIntFlow6GFC->SetXTitle("");
278   fAvMultIntFlow6GFC->SetYTitle("");
279   fAvMultIntFlow6GFC->SetLabelSize(0.06);
280   fAvMultIntFlow6GFC->SetMarkerStyle(25);
281   fAvMultIntFlow6GFC->SetLabelOffset(0.01);
282   (fAvMultIntFlow6GFC->GetXaxis())->SetBinLabel(1,"Average Multiplicity");
283   fHistList->Add(fAvMultIntFlow6GFC);
284  
285   //average multiplicity (only for other system of Eq. - up to 8th order)
286   fAvMultIntFlow8GFC = new TProfile("fAvMultIntFlow8GFC","Average Multiplicity",1,0,1,"s");
287   fAvMultIntFlow8GFC->SetXTitle("");
288   fAvMultIntFlow8GFC->SetYTitle("");
289   fAvMultIntFlow8GFC->SetLabelSize(0.06);
290   fAvMultIntFlow8GFC->SetMarkerStyle(25);
291   fAvMultIntFlow8GFC->SetLabelOffset(0.01);
292   (fAvMultIntFlow8GFC->GetXaxis())->SetBinLabel(1,"Average Multiplicity");
293   fHistList->Add(fAvMultIntFlow8GFC);
294  
295   //average multiplicity (only for other system of Eq. - up to 16th order)
296   fAvMultIntFlow16GFC = new TProfile("fAvMultIntFlow16GFC","Average Multiplicity",1,0,1,"s");
297   fAvMultIntFlow16GFC->SetXTitle("");
298   fAvMultIntFlow16GFC->SetYTitle("");
299   fAvMultIntFlow16GFC->SetLabelSize(0.06);
300   fAvMultIntFlow16GFC->SetMarkerStyle(25);
301   fAvMultIntFlow16GFC->SetLabelOffset(0.01);
302   (fAvMultIntFlow16GFC->GetXaxis())->SetBinLabel(1,"Average Multiplicity");
303   fHistList->Add(fAvMultIntFlow16GFC);
304  }
305  
306  //avarage of the real part of generating function for differential flow in Pt <Re(D[b][p][q])>
307  fDiffFlowPtRPGenFunRe = new TProfile3D("fDiffFlowPtRPGenFunRe","<Re(D[b][p][q])>",fgknBinsPt,(Double_t)(fPtMin/fBinWidthPt),(Double_t)(fPtMax/fBinWidthPt),fgkPmax,0.,(Double_t)fgkPmax,fgkQmax,0.,(Double_t)fgkQmax);
308  fDiffFlowPtRPGenFunRe->SetXTitle("b");
309  fDiffFlowPtRPGenFunRe->SetYTitle("p");
310  fDiffFlowPtRPGenFunRe->SetZTitle("q");
311  fDiffFlowPtRPGenFunRe->SetTitleOffset(1.44,"X");
312  fDiffFlowPtRPGenFunRe->SetTitleOffset(1.44,"Y");
313  fHistList->Add(fDiffFlowPtRPGenFunRe);
314  
315  //avarage of the imaginary part of generating function for differential flow in Pt <Im(D[b][p][q])>
316  fDiffFlowPtRPGenFunIm = new TProfile3D("fDiffFlowPtRPGenFunIm","<Im(D[b][p][q])>",fgknBinsPt,(Double_t)(fPtMin/fBinWidthPt),(Double_t)(fPtMax/fBinWidthPt),fgkPmax,0.,(Double_t)fgkPmax,fgkQmax,0.,(Double_t)fgkQmax);
317  fDiffFlowPtRPGenFunIm->SetXTitle("b");
318  fDiffFlowPtRPGenFunIm->SetYTitle("p");
319  fDiffFlowPtRPGenFunIm->SetZTitle("q");
320  fDiffFlowPtRPGenFunIm->SetTitleOffset(1.44,"X");
321  fDiffFlowPtRPGenFunIm->SetTitleOffset(1.44,"Y");
322  fHistList->Add(fDiffFlowPtRPGenFunIm);
323  
324  //number of particles per pt bin
325  fPtBinRPNoOfParticles = new TProfile("fPtBinRPNoOfParticles","Number of particles per #p_{t} bin",fgknBinsPt,fPtMin,fPtMax);
326  fPtBinRPNoOfParticles->SetXTitle("pt [GeV]");
327  fPtBinRPNoOfParticles->SetYTitle("");
328  fHistList->Add(fPtBinRPNoOfParticles);
329  
330  //avarage of the real part of generating function for differential flow in Eta <Re(D[b][p][q])>
331  fDiffFlowEtaRPGenFunRe = new TProfile3D("fDiffFlowEtaRPGenFunRe","<Re(D[b][p][q])>",fgknBinsEta,(Double_t)(fEtaMin/fBinWidthEta),(Double_t)(fEtaMax/fBinWidthEta),fgkPmax,0.,(Double_t)fgkPmax,fgkQmax,0.,(Double_t)fgkQmax);
332  fDiffFlowEtaRPGenFunRe->SetXTitle("b");
333  fDiffFlowEtaRPGenFunRe->SetYTitle("p");
334  fDiffFlowEtaRPGenFunRe->SetZTitle("q");
335  fDiffFlowEtaRPGenFunRe->SetTitleOffset(1.44,"X");
336  fDiffFlowEtaRPGenFunRe->SetTitleOffset(1.44,"Y");
337  fHistList->Add(fDiffFlowEtaRPGenFunRe);
338  
339  //avarage of the imaginary part of generating function for differential flow in Eta <Im(D[b][p][q])>
340  fDiffFlowEtaRPGenFunIm = new TProfile3D("fDiffFlowEtaRPGenFunIm","<Im(D[b][p][q])>",fgknBinsEta,(Double_t)(fEtaMin/fBinWidthEta),(Double_t)(fEtaMax/fBinWidthEta),fgkPmax,0.,(Double_t)fgkPmax,fgkQmax,0.,(Double_t)fgkQmax);
341  fDiffFlowEtaRPGenFunIm->SetXTitle("b");
342  fDiffFlowEtaRPGenFunIm->SetYTitle("p");
343  fDiffFlowEtaRPGenFunIm->SetZTitle("q");
344  fDiffFlowEtaRPGenFunIm->SetTitleOffset(1.44,"X");
345  fDiffFlowEtaRPGenFunIm->SetTitleOffset(1.44,"Y");
346  fHistList->Add(fDiffFlowEtaRPGenFunIm);
347  
348  //number of particles per eta bin
349  fEtaBinRPNoOfParticles = new TProfile("fEtaBinRPNoOfParticles","Number of particles per #eta bin",fgknBinsEta,fEtaMin,fEtaMax);
350  fEtaBinRPNoOfParticles->SetXTitle("#eta");
351  fEtaBinRPNoOfParticles->SetYTitle("");
352  fHistList->Add(fEtaBinRPNoOfParticles);
353  
354  //avarage of the real part of generating function for differential flow in Pt <Re(D[b][p][q])>
355  fDiffFlowPtPOIGenFunRe = new TProfile3D("fDiffFlowPtPOIGenFunRe","<Re(D[b][p][q])>",fgknBinsPt,(Double_t)(fPtMin/fBinWidthPt),(Double_t)(fPtMax/fBinWidthPt),fgkPmax,0.,(Double_t)fgkPmax,fgkQmax,0.,(Double_t)fgkQmax);
356  fDiffFlowPtPOIGenFunRe->SetXTitle("b");
357  fDiffFlowPtPOIGenFunRe->SetYTitle("p");
358  fDiffFlowPtPOIGenFunRe->SetZTitle("q");
359  fDiffFlowPtPOIGenFunRe->SetTitleOffset(1.44,"X");
360  fDiffFlowPtPOIGenFunRe->SetTitleOffset(1.44,"Y");
361  fHistList->Add(fDiffFlowPtPOIGenFunRe);
362  
363  //avarage of the imaginary part of generating function for differential flow in Pt <Im(D[b][p][q])>
364  fDiffFlowPtPOIGenFunIm = new TProfile3D("fDiffFlowPtPOIGenFunIm","<Im(D[b][p][q])>",fgknBinsPt,(Double_t)(fPtMin/fBinWidthPt),(Double_t)(fPtMax/fBinWidthPt),fgkPmax,0.,(Double_t)fgkPmax,fgkQmax,0.,(Double_t)fgkQmax);
365  fDiffFlowPtPOIGenFunIm->SetXTitle("b");
366  fDiffFlowPtPOIGenFunIm->SetYTitle("p");
367  fDiffFlowPtPOIGenFunIm->SetZTitle("q");
368  fDiffFlowPtPOIGenFunIm->SetTitleOffset(1.44,"X");
369  fDiffFlowPtPOIGenFunIm->SetTitleOffset(1.44,"Y");
370  fHistList->Add(fDiffFlowPtPOIGenFunIm);
371  
372  //number of particles per pt bin
373  fPtBinPOINoOfParticles = new TProfile("fPtBinPOINoOfParticles","Number of particles per #p_{t} bin",fgknBinsPt,fPtMin,fPtMax);
374  fPtBinPOINoOfParticles->SetXTitle("pt [GeV]");
375  fPtBinPOINoOfParticles->SetYTitle("");
376  fHistList->Add(fPtBinPOINoOfParticles);
377  
378  //avarage of the real part of generating function for differential flow in Eta <Re(D[b][p][q])>
379  fDiffFlowEtaPOIGenFunRe = new TProfile3D("fDiffFlowEtaPOIGenFunRe","<Re(D[b][p][q])>",fgknBinsEta,(Double_t)(fEtaMin/fBinWidthEta),(Double_t)(fEtaMax/fBinWidthEta),fgkPmax,0.,(Double_t)fgkPmax,fgkQmax,0.,(Double_t)fgkQmax);
380  fDiffFlowEtaPOIGenFunRe->SetXTitle("b");
381  fDiffFlowEtaPOIGenFunRe->SetYTitle("p");
382  fDiffFlowEtaPOIGenFunRe->SetZTitle("q");
383  fDiffFlowEtaPOIGenFunRe->SetTitleOffset(1.44,"X");
384  fDiffFlowEtaPOIGenFunRe->SetTitleOffset(1.44,"Y");
385  fHistList->Add(fDiffFlowEtaPOIGenFunRe);
386  
387  //avarage of the imaginary part of generating function for differential flow in Eta <Im(D[b][p][q])>
388  fDiffFlowEtaPOIGenFunIm = new TProfile3D("fDiffFlowEtaPOIGenFunIm","<Im(D[b][p][q])>",fgknBinsEta,(Double_t)(fEtaMin/fBinWidthEta),(Double_t)(fEtaMax/fBinWidthEta),fgkPmax,0.,(Double_t)fgkPmax,fgkQmax,0.,(Double_t)fgkQmax);
389  fDiffFlowEtaPOIGenFunIm->SetXTitle("b");
390  fDiffFlowEtaPOIGenFunIm->SetYTitle("p");
391  fDiffFlowEtaPOIGenFunIm->SetZTitle("q");
392  fDiffFlowEtaPOIGenFunIm->SetTitleOffset(1.44,"X");
393  fDiffFlowEtaPOIGenFunIm->SetTitleOffset(1.44,"Y");
394  fHistList->Add(fDiffFlowEtaPOIGenFunIm);
395  
396  //number of particles per eta bin
397  fEtaBinPOINoOfParticles = new TProfile("fEtaBinPOINoOfParticles","Number of particles per #eta bin",fgknBinsEta,fEtaMin,fEtaMax);
398  fEtaBinPOINoOfParticles->SetXTitle("#eta");
399  fEtaBinPOINoOfParticles->SetYTitle("");
400  fHistList->Add(fEtaBinPOINoOfParticles);
401  
402  /*
403  fDiffFlowGenFunRe0 = new TProfile2D("fDiffFlowGenFunRe0","Re(<D[b][0][q]>)",fgknBins,(Double_t)(fPtMin/fBinWidth),(Double_t)(fPtMax/fBinWidth),fgkQmax,0.,(Double_t)fgkQmax);
404  fDiffFlowGenFunRe0->SetXTitle("b");
405  fDiffFlowGenFunRe0->SetYTitle("q");
406  fHistList->Add(fDiffFlowGenFunRe0);
407
408  fDiffFlowGenFunIm0 = new TProfile2D("fDiffFlowGcout<<"HEY M1"<<endl;enFunIm0","Im(<D[b][0][q]>)",fgknBins,(Double_t)(fPtMin/fBinWidth),(Double_t)(fPtMax/fBinWidth),fgkQmax,0.,(Double_t)fgkQmax);
409  fDiffFlowGenFunIm0->SetXTitle("b");
410  fDiffFlowGenFunIm0->SetYTitle("q");
411  fHistList->Add(fDiffFlowGenFunIm0);
412  
413  fDiffFlowGenFunRe1 = new TProfile2D("fDiffFlowGenFunRe1","Re(<D[b][1][q]>)",fgknBins,(Double_t)(fPtMin/fBinWidth),(Double_t)(fPtMax/fBinWidth),fgkQmax,0.,(Double_t)fgkQmax);
414  fDiffFlowGenFunRe1->SetXTitle("b");
415  fDiffFlowGenFunRe1->SetYTitle("q");
416  fHistList->Add(fDiffFlowGenFunRe1);
417  
418  fDiffFlowGenFunIm1 = new TProfile2D("fDiffFlowGenFunIm1","Im(<D[b][1][q]>)",fgknBins,(Double_t)(fPtMin/fBinWidth),(Double_t)(fPtMax/fBinWidth),fgkQmax,0.,(Double_t)fgkQmax);
419  fDiffFlowGenFunIm1->SetXTitle("b");
420  fDiffFlowGenFunIm1->SetYTitle("q");
421  fHistList->Add(fDiffFlowGenFunIm1);
422  
423  fDiffFlowGenFunRe2 = new TProfile2D("fDiffFlowGenFunRe2","Re(<D[b][2][q]>)",fgknBins,(Double_t)(fPtMin/fBinWidth),(Double_t)(fPtMax/fBinWidth),fgkQmax,0.,(Double_t)fgkQmax);
424  fDiffFlowGenFunRe2->SetXTitle("b");
425  fDiffFlowGenFunRe2->SetYTitle("q");
426  fHistList->Add(fDiffFlowGenFunRe2);
427  
428  fDiffFlowGenFunIm2 = new TProfile2D("fDiffFlowGenFunIm2","Im(<D[b][2][q]>)",fgknBins,(Double_t)(fPtMin/fBinWidth),(Double_t)(fPtMax/fBinWidth),fgkQmax,0.,(Double_t)fgkQmax);
429  fDiffFlowGenFunIm2->SetXTitle("b");
430  fDiffFlowGenFunIm2->SetYTitle("q");
431  fHistList->Add(fDiffFlowGenFunIm2);
432  
433  fDiffFlowGenFunRe3 = new TProfile2D("fDiffFlowGenFunRe3","Re(<D[b][3][q]>)",fgknBins,(Double_t)(fPtMin/fBinWidth),(Double_t)(fPtMax/fBinWidth),fgkQmax,0.,(Double_t)fgkQmax);
434  fDiffFlowGenFunRe3->SetXTitle("b");
435  fDiffFlowGenFunRe3->SetYTitle("q");
436  fHistList->Add(fDiffFlowGenFunRe3);
437  
438  fDiffFlowGenFunIm3 = new TProfile2D("fDiffFlowGenFunIm3","Im(<D[b][3][q]>)",fgknBins,(Double_t)(fPtMin/fBinWidth),(Double_t)(fPtMax/fBinWidth),fgkQmax,0.,(Double_t)fgkQmax);
439  fDiffFlowGenFunIm3->SetXTitle("b");
440  fDiffFlowGenFunIm3->SetYTitle("q");
441  fHistList->Add(fDiffFlowGenFunIm3);
442  
443  fDiffFlowGenFunRe4 = new TProfile2D("fDiffFlowGenFunRe4","Re(<D[b][4][q]>)",fgknBins,(Double_t)(fPtMin/fBinWidth),(Double_t)(fPtMax/fBinWidth),fgkQmax,0.,(Double_t)fgkQmax);
444  fDiffFlowGenFunRe4->SetXTitle("b");
445  fDiffFlowGenFunRe4->SetYTitle("q");
446  fHistList->Add(fDiffFlowGenFunRe4);
447  
448  fDiffFlowGenFunIm4 = new TProfile2D("fDiffFlowGenFunIm4","Im(<D[b][4][q]>)",fgknBins,(Double_t)(fPtMin/fBinWidth),(Double_t)(fPtMax/fBinWidth),fgkQmax,0.,(Double_t)fgkQmax);
449  fDiffFlowGenFunIm4->SetXTitle("b");
450  fDiffFlowGenFunIm4->SetYTitle("q");
451  fHistList->Add(fDiffFlowGenFunIm4);
452  
453  fDiffFlowGenFunRe5 = new TProfile2D("fDiffFlowGenFunRe5","Re(<D[b][5][q]>)",fgkQmax,0.,(Double_t)fgkQmax,fgknBins,(Double_t)(fPtMin/fBinWidth),(Double_t)(fPtMax/fBinWidth));
454  fDiffFlowGenFunRe5->SetXTitle("b");
455  fDiffFlowGenFunRe5->SetYTitle("q");
456  fHistList->Add(fDiffFlowGenFunRe5);
457  
458  fDiffFlowGenFunIm5 = new TProfile2D("fDiffFlowGenFunIm5","Im(<D[b][5][q]>)",fgknBins,(Double_t)(fPtMin/fBinWidth),(Double_t)(fPtMax/fBinWidth),fgkQmax,0.,(Double_t)fgkQmax);
459  fDiffFlowGenFunIm5->SetXTitle("b");
460  fDiffFlowGenFunIm5->SetYTitle("q");
461  fHistList->Add(fDiffFlowGenFunIm5);
462  
463  fDiffFlowGenFunRe6 = new TProfile2D("fDiffFlowGenFunRe6","Re(<D[b][6][q]>)",fgknBins,(Double_t)(fPtMin/fBinWidth),(Double_t)(fPtMax/fBinWidth),fgkQmax,0.,(Double_t)fgkQmax);
464  fDiffFlowGenFunRe6->SetXTitle("b");
465  fDiffFlowGenFunRe6->SetYTitle("q");
466  fHistList->Add(fDiffFlowGenFunRe6);
467  
468  fDiffFlowGenFunIm6 = new TProfile2D("fDiffFlowGenFunIm6","Im(<D[b][6][q]>)",fgknBins,(Double_t)(fPtMin/fBinWidth),(Double_t)(fPtMax/fBinWidth),fgkQmax,0.,(Double_t)fgkQmax);
469  fDiffFlowGenFunIm6->SetXTitle("b");
470  fDiffFlowGenFunIm6->SetYTitle("q");
471  fHistList->Add(fDiffFlowGenFunIm6);
472  
473  fDiffFlowGenFunRe7 = new TProfile2D("fDiffFlowGenFunRe7","Re(<D[b][7][q]>)",fgknBins,(Double_t)(fPtMin/fBinWidth),(Double_t)(fPtMax/fBinWidth),fgkQmax,0.,(Double_t)fgkQmax);
474  fDiffFlowGenFunRe7->SetXTitle("b");
475  fDiffFlowGenFunRe7->SetYTitle("q");
476  fHistList->Add(fDiffFlowGenFunRe7);
477  
478  fDiffFlowGenFunIm7 = new TProfile2D("fDiffFlowGenFunIm7","Im(<D[b][7][q]>)",fgknBins,(Double_t)(fPtMin/fBinWidth),(Double_t)(fPtMax/fBinWidth),fgkQmax,0.,(Double_t)fgkQmax);
479  fDiffFlowGenFunIm7->SetXTitle("b");
480  fDiffFlowGenFunIm7->SetYTitle("q");
481  fHistList->Add(fDiffFlowGenFunIm7);
482  */
483  
484  //common control histograms
485  fCommonHists = new AliFlowCommonHist("AliFlowCommonHistGFC");
486  fHistList->Add(fCommonHists);  
487  
488  //common histograms for final results (2nd order)
489  fCommonHistsResults2nd = new AliFlowCommonHistResults("AliFlowCommonHistResults2ndOrderGFC");
490  fHistList->Add(fCommonHistsResults2nd); 
491  
492  //common histograms for final results (4th order)
493  fCommonHistsResults4th = new AliFlowCommonHistResults("AliFlowCommonHistResults4thOrderGFC");
494  fHistList->Add(fCommonHistsResults4th);
495  
496  //common histograms for final results (6th order)
497  fCommonHistsResults6th = new AliFlowCommonHistResults("AliFlowCommonHistResults6thOrderGFC");
498  fHistList->Add(fCommonHistsResults6th); 
499  
500  //common histograms for final results (8th order)
501  fCommonHistsResults8th = new AliFlowCommonHistResults("AliFlowCommonHistResults8thOrderGFC");
502  fHistList->Add(fCommonHistsResults8th);
503  
504  //<w^2>
505  fAverageOfSquaredWeight = new TProfile("fAverageOfSquaredWeight","<w^{2}>",1,0,1);
506  fAverageOfSquaredWeight->SetLabelSize(0.06);
507  fAverageOfSquaredWeight->SetMarkerStyle(25);
508  fAverageOfSquaredWeight->SetLabelOffset(0.01);
509  (fAverageOfSquaredWeight->GetXaxis())->SetBinLabel(1,"<w^{2}>");
510  fHistList->Add(fAverageOfSquaredWeight);
511  
512  // add list fWeightsList with weights to the main list
513  fHistList->Add(fWeightsList); 
514 }//end of Init()
515
516 //================================================================================================================
517
518 void AliFlowAnalysisWithCumulants::Make(AliFlowEventSimple* anEvent)
519 {
520  //running over data:
521  Int_t nPrim = anEvent->NumberOfTracks(); //total multiplicity
522  
523  Int_t nEventNSelTracksRP = anEvent->GetEventNSelTracksRP(); //selected multiplicity (particles used for int. flow)
524  
525  Int_t n = 2; // int flow harmonic (to be improved)
526  
527  //---------------------------------------------------------------------------------------------------------
528  // weights:
529  Bool_t useWeights = fUsePhiWeights||fUsePtWeights||fUseEtaWeights;
530  
531  TH1F *phiWeights = NULL; // histogram with phi weights
532  TH1D *ptWeights  = NULL; // histogram with pt weights
533  TH1D *etaWeights = NULL; // histogram with eta weights
534
535  Double_t wPhi = 1.; // phi weight
536  Double_t wPt  = 1.; // pt weight
537  Double_t wEta = 1.; // eta weight
538    
539  if(useWeights)
540  {
541   if(!fWeightsList)
542   {
543    cout<<" WARNING: fWeightsList is NULL pointer in GFC::Make() !!!!"<<endl;
544    exit(0);
545   }
546   if(fUsePhiWeights) 
547   {
548    phiWeights = dynamic_cast<TH1F *>(fWeightsList->FindObject("phi_weights"));
549    if(!phiWeights)
550    {
551     cout<<" WARNING: couldn't access the histogram with phi weights in GFC::Make() !!!!"<<endl;
552     exit(0);
553    } 
554   } 
555   if(fUsePtWeights) 
556   { 
557    ptWeights = dynamic_cast<TH1D *>(fWeightsList->FindObject("pt_weights"));
558    if(!ptWeights) 
559    {
560     cout<<" WARNING: couldn't access the histogram with pt weights in GFC::Make() !!!!"<<endl;
561     exit(0);
562    } 
563   } 
564   if(fUseEtaWeights) 
565   {
566    etaWeights = dynamic_cast<TH1D *>(fWeightsList->FindObject("eta_weights"));
567    if(!etaWeights) 
568    {
569     cout<<" WARNING: couldn't access the histogram with eta weights in GFC::Make() !!!!"<<endl;
570     exit(0);
571    }
572   } 
573  } 
574  //---------------------------------------------------------------------------------------------------------
575   
576  if(nEventNSelTracksRP>9) //generating function formalism applied here make sense only for selected multiplicity >= 10 
577  { 
578  //fill the common control histograms
579  fCommonHists->FillControlHistograms(anEvent);   
580   
581  //initializing the generating function G[p][q] for integrated flow 
582  Double_t genfunG[fgkPmax][fgkQmax];
583  
584  for(Int_t p=0;p<fgkPmax;p++)
585  {
586   for(Int_t q=0;q<fgkQmax;q++)
587   {
588    genfunG[p][q]=1.;
589   }   
590  }
591
592  Int_t nSelTracksRP = 0; //cross-checking the selected multiplicity
593   
594  Double_t dPhi = 0.;
595  Double_t dPt  = 0.;
596  Double_t dEta = 0.;
597  Int_t nBinsPhi = 0;
598  
599  for(Int_t i=0;i<nPrim;i++)
600  {
601   fTrack=anEvent->GetTrack(i);
602   if(fTrack && fTrack->InRPSelection())
603   {
604    nSelTracksRP++;
605    // get azimuthal angle, momentum and pseudorapidity of a particle:
606    dPhi = fTrack->Phi();
607    dPt  = fTrack->Pt();
608    dEta = fTrack->Eta();
609    // phi weights:
610    if(fUsePhiWeights) 
611    {
612     nBinsPhi = phiWeights->GetNbinsX();
613     if(nBinsPhi) 
614     {
615      wPhi = phiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*nBinsPhi/TMath::TwoPi())));
616     }
617    } 
618    // pt weights:
619    if(fUsePtWeights)
620    {          
621     if(fBinWidthPt) 
622     {
623      wPt = ptWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-fPtMin)/fBinWidthPt)));
624     }
625    }             
626    // eta weights:
627    if(fUseEtaWeights)
628    {    
629     if(fBinWidthEta)
630     {
631      wEta=etaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-fEtaMin)/fBinWidthEta))); 
632     }
633    }
634    // evaluate the generating function:
635    for(Int_t p=0;p<fgkPmax;p++)
636    {
637     for(Int_t q=0;q<fgkQmax;q++)
638     {
639      genfunG[p][q]*=(1.+wPhi*wPt*wEta*(2.*fR0*sqrt(p+1.)/nEventNSelTracksRP)*cos(fgkFlow*dPhi-2.*q*TMath::Pi()/fgkQmax));
640     }
641    }
642    // calculate <w^2> 
643    fAverageOfSquaredWeight->Fill(0.,pow(wPhi*wPt*wEta,2.),1); 
644   } // end of if(fTrack && fTrack->InRPSelection())
645  } // end of for(Int_t i=0;i<nPrim;i++) 
646  
647  //storing the value of G[p][q] in 2D profile in order to get automatically the avarage <G[p][q]>
648  for(Int_t p=0;p<fgkPmax;p++)
649  {
650   for(Int_t q=0;q<fgkQmax;q++)
651   {
652    fIntFlowGenFun->Fill((Double_t)p,(Double_t)q,genfunG[p][q],1);
653   }
654  } 
655  
656  //storing the selected multiplicity (if fAvMultIntFlow is not filled here then you had wrongly selected the particles used for integrated flow)
657  if(nSelTracksRP==nEventNSelTracksRP)
658  {
659   fAvMultIntFlowGFC->Fill(0.,nSelTracksRP,1);
660  } else 
661    {
662     cout<<"WARNING: nSelTracksRP != nEventNSelTracksRP in GFC::Make(). Something is wrong with RP flagging !!!!"<<endl;
663    }
664  
665  // calculating Q-vector of event (needed for errors)
666  AliFlowVector fQVector;
667  fQVector.Set(0.,0.);
668  fQVector.SetMult(0);
669  fQVector=anEvent->GetQ(1*n,fWeightsList,fUsePhiWeights,fUsePtWeights,fUseEtaWeights); // get the Q vector for this event
670  fQVectorComponentsGFC->Fill(0.,fQVector.X(),1);         // in the 1st bin fill Q_x
671  fQVectorComponentsGFC->Fill(1.,fQVector.Y(),1);         // in the 2nd bin fill Q_y
672  fQVectorComponentsGFC->Fill(2.,pow(fQVector.X(),2.),1); // in the 3rd bin fill (Q_x)^2
673  fQVectorComponentsGFC->Fill(3.,pow(fQVector.Y(),2.),1); // in the 4th bin fill (Q_y)^2
674  
675  //3D profiles for differential flow in pt and eta
676  //second loop over data: evaluating the generating function D[b][p][q] for differential flow 
677  //remark 0: D[b][p][q] is a complex number => real and imaginary part are calculated separately
678  //remark 1: note that bellow G[p][q] is needed, the value of generating function for integrated flow for the CURRENT event
679  //remark 2: results are stored in 3D profiles in order to automatically get <Re(D[b][p][q])> and <Im(D[b][p][q])>
680  for(Int_t i=0;i<nPrim;i++)
681  {
682   fTrack=anEvent->GetTrack(i);
683   if(fTrack)
684   {
685    if(fTrack->InRPSelection() && fTrack->InPOISelection())
686    {
687     // get azimuthal angle, momentum and pseudorapidity of a particle:
688     dPhi = fTrack->Phi();
689     dPt  = fTrack->Pt();
690     dEta = fTrack->Eta();
691     
692     fPtBinPOINoOfParticles->Fill(dPt,dPt,1.);
693     fEtaBinPOINoOfParticles->Fill(dEta,dEta,1.);
694     
695     // phi weights:
696     if(fUsePhiWeights) 
697     {
698      nBinsPhi = phiWeights->GetNbinsX();
699      if(nBinsPhi) 
700      {
701       wPhi = phiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*nBinsPhi/TMath::TwoPi())));
702      }
703     } 
704     // pt weights:
705     if(fUsePtWeights)
706     {          
707      if(fBinWidthPt) 
708      {
709       wPt = ptWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-fPtMin)/fBinWidthPt)));
710      }
711     }             
712     // eta weights:
713     if(fUseEtaWeights)
714     {    
715      if(fBinWidthEta)
716      {
717       wEta=etaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-fEtaMin)/fBinWidthEta))); 
718      }
719     }
720    
721     for(Int_t p=0;p<fgkPmax;p++)
722     {
723      for(Int_t q=0;q<fgkQmax;q++)
724      {
725       //real part (Pt)
726       fDiffFlowPtPOIGenFunRe->Fill(dPt/fBinWidthPt,(Double_t)p,(Double_t)q,genfunG[p][q]*cos(fgkMltpl*fgkFlow*dPhi)/(1.+wPhi*wPt*wEta*(2.*fR0*sqrt(p+1.)/nSelTracksRP)*cos(fgkFlow*dPhi-2.*q*TMath::Pi()/fgkQmax)),1.);
727       //imaginary part (Pt)
728       fDiffFlowPtPOIGenFunIm->Fill(dPt/fBinWidthPt,(Double_t)p,(Double_t)q,genfunG[p][q]*sin(fgkMltpl*fgkFlow*dPhi)/(1.+wPhi*wPt*wEta*(2.*fR0*sqrt(p+1.)/nSelTracksRP)*cos(fgkFlow*dPhi-2.*q*TMath::Pi()/fgkQmax)),1.); 
729       //real part (Eta)
730       fDiffFlowEtaPOIGenFunRe->Fill(dEta/fBinWidthEta,(Double_t)p,(Double_t)q,genfunG[p][q]*cos(fgkMltpl*fgkFlow*dPhi)/(1.+wPhi*wPt*wEta*(2.*fR0*sqrt(p+1.)/nSelTracksRP)*cos(fgkFlow*dPhi-2.*q*TMath::Pi()/fgkQmax)),1.);
731       //imaginary part (Eta)
732       fDiffFlowEtaPOIGenFunIm->Fill(dEta/fBinWidthEta,(Double_t)p,(Double_t)q,genfunG[p][q]*sin(fgkMltpl*fgkFlow*dPhi)/(1.+wPhi*wPt*wEta*(2.*fR0*sqrt(p+1.)/nSelTracksRP)*cos(fgkFlow*dPhi-2.*q*TMath::Pi()/fgkQmax)),1.); 
733      }
734     }
735    } 
736    else if(fTrack->InPOISelection() && !(fTrack->InRPSelection()))
737    {
738     // get azimuthal angle, momentum and pseudorapidity of a particle:
739     dPhi = fTrack->Phi();
740     dPt  = fTrack->Pt();
741     dEta = fTrack->Eta();
742    
743     fPtBinPOINoOfParticles->Fill(dPt,dPt,1.);
744     fEtaBinPOINoOfParticles->Fill(dEta,dEta,1.);
745     for(Int_t p=0;p<fgkPmax;p++)
746     {
747      for(Int_t q=0;q<fgkQmax;q++)
748      {
749       //real part (Pt)
750       fDiffFlowPtPOIGenFunRe->Fill(dPt/fBinWidthPt,(Double_t)p,(Double_t)q,genfunG[p][q]*cos(fgkMltpl*fgkFlow*dPhi),1.);
751       //imaginary part (Pt)
752       fDiffFlowPtPOIGenFunIm->Fill(dPt/fBinWidthPt,(Double_t)p,(Double_t)q,genfunG[p][q]*sin(fgkMltpl*fgkFlow*dPhi),1.); 
753       //real part (Eta)
754       fDiffFlowEtaPOIGenFunRe->Fill(dEta/fBinWidthEta,(Double_t)p,(Double_t)q,genfunG[p][q]*cos(fgkMltpl*fgkFlow*dPhi),1.);
755       //imaginary part (Eta)
756       fDiffFlowEtaPOIGenFunIm->Fill(dEta/fBinWidthEta,(Double_t)p,(Double_t)q,genfunG[p][q]*sin(fgkMltpl*fgkFlow*dPhi),1.);                     
757      } 
758     }
759    }
760    //RP:
761    if(fTrack->InRPSelection())       
762    {
763     // get azimuthal angle, momentum and pseudorapidity of a particle:
764     dPhi = fTrack->Phi();
765     dPt  = fTrack->Pt();
766     dEta = fTrack->Eta();
767    
768     fPtBinRPNoOfParticles->Fill(dPt,dPt,1.);
769     fEtaBinRPNoOfParticles->Fill(dEta,dEta,1.);
770     
771     // phi weights:
772     if(fUsePhiWeights) 
773     {
774      nBinsPhi = phiWeights->GetNbinsX();
775      if(nBinsPhi) 
776      {
777       wPhi = phiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*nBinsPhi/TMath::TwoPi())));
778      }
779     } 
780     // pt weights:
781     if(fUsePtWeights)
782     {          
783      if(fBinWidthPt) 
784      {
785       wPt = ptWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-fPtMin)/fBinWidthPt)));
786      }
787     }             
788     // eta weights:
789     if(fUseEtaWeights)
790     {    
791      if(fBinWidthEta)
792      {
793       wEta=etaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-fEtaMin)/fBinWidthEta))); 
794      }
795     }
796     
797     for(Int_t p=0;p<fgkPmax;p++)
798     {
799      for(Int_t q=0;q<fgkQmax;q++)
800      {
801       //real part (Pt)
802       fDiffFlowPtRPGenFunRe->Fill(dPt/fBinWidthPt,(Double_t)p,(Double_t)q,genfunG[p][q]*cos(fgkMltpl*fgkFlow*dPhi)/(1.+wPhi*wPt*wEta*(2.*fR0*sqrt(p+1.)/nSelTracksRP)*cos(fgkFlow*dPhi-2.*q*TMath::Pi()/fgkQmax)),1.);
803       //imaginary part (Pt)
804       fDiffFlowPtRPGenFunIm->Fill(dPt/fBinWidthPt,(Double_t)p,(Double_t)q,genfunG[p][q]*sin(fgkMltpl*fgkFlow*dPhi)/(1.+wPhi*wPt*wEta*(2.*fR0*sqrt(p+1.)/nSelTracksRP)*cos(fgkFlow*dPhi-2.*q*TMath::Pi()/fgkQmax)),1.); 
805       //real part (Eta)
806       fDiffFlowEtaRPGenFunRe->Fill(dEta/fBinWidthEta,(Double_t)p,(Double_t)q,genfunG[p][q]*cos(fgkMltpl*fgkFlow*dPhi)/(1.+wPhi*wPt*wEta*(2.*fR0*sqrt(p+1.)/nSelTracksRP)*cos(fgkFlow*dPhi-2.*q*TMath::Pi()/fgkQmax)),1.);
807       //imaginary part (Eta)
808       fDiffFlowEtaRPGenFunIm->Fill(dEta/fBinWidthEta,(Double_t)p,(Double_t)q,genfunG[p][q]*sin(fgkMltpl*fgkFlow*dPhi)/(1.+wPhi*wPt*wEta*(2.*fR0*sqrt(p+1.)/nSelTracksRP)*cos(fgkFlow*dPhi-2.*q*TMath::Pi()/fgkQmax)),1.); 
809      }
810     }
811    }//end of if(fTrack->InRPSelection())                   
812   }//end of if(fTrack)  
813  }//ending the second loop over data    
814  
815  
816  
817  /*
818  //sixteen 2D profiles for differential flow          
819  for(Int_t i=0;i<nPrim;i++){
820   fTrack=anEvent->GetTrack(i);
821   if (fTrack && fTrack->InPOISelection()){
822    //for(Int_t p=0;p<fgkPmax;p++){
823     for(Int_t q=0;q<fgkQmax;q++){
824      //real part
825      fDiffFlowGenFunRe0->Fill(fTrack->Pt()/fBinWidth,(Double_t)q,genfunG[0][q]*cos(fgkMltpl*fgkFlow*fTrack->Phi())/(1.+(2.*fR0*sqrt(0.+1.)/nSelTracksRP)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax)),1.);
826      //imaginary part
827      fDiffFlowGenFunIm0->Fill(fTrack->Pt()/fBinWidth,(Double_t)q,genfunG[0][q]*sin(fgkMltpl*fgkFlow*fTrack->Phi())/(1.+(2.*fR0*sqrt(0.+1.)/nSelTracksRP)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax)),1.); 
828      //-----------------------------------------------------------------------
829      //real part
830      fDiffFlowGenFunRe1->Fill(fTrack->Pt()/fBinWidth,(Double_t)q,genfunG[1][q]*cos(fgkMltpl*fgkFlow*fTrack->Phi())/(1.+(2.*fR0*sqrt(1.+1.)/nSelTracksRP)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax)),1.);
831      //imaginary part
832      fDiffFlowGenFunIm1->Fill(fTrack->Pt()/fBinWidth,(Double_t)q,genfunG[1][q]*sin(fgkMltpl*fgkFlow*fTrack->Phi())/(1.+(2.*fR0*sqrt(1.+1.)/nSelTracksRP)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax)),1.);             
833     //-----------------------------------------------------------------------
834      //real part
835      fDiffFlowGenFunRe2->Fill(fTrack->Pt()/fBinWidth,(Double_t)q,genfunG[2][q]*cos(fgkMltpl*fgkFlow*fTrack->Phi())/(1.+(2.*fR0*sqrt(2.+1.)/nSelTracksRP)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax)),1.);
836      //imaginary part
837      fDiffFlowGenFunIm2->Fill(fTrack->Pt()/fBinWidth,(Double_t)q,genfunG[2][q]*sin(fgkMltpl*fgkFlow*fTrack->Phi())/(1.+(2.*fR0*sqrt(2.+1.)/nSelTracksRP)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax)),1.);  
838      //-----------------------------------------------------------------------
839      //real part
840      fDiffFlowGenFunRe3->Fill(fTrack->Pt()/fBinWidth,(Double_t)q,genfunG[3][q]*cos(fgkMltpl*fgkFlow*fTrack->Phi())/(1.+(2.*fR0*sqrt(3.+1.)/nSelTracksRP)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax)),1.);
841      //imaginary part
842      fDiffFlowGenFunIm3->Fill(fTrack->Pt()/fBinWidth,(Double_t)q,genfunG[3][q]*sin(fgkMltpl*fgkFlow*fTrack->Phi())/(1.+(2.*fR0*sqrt(3.+1.)/nSelTracksRP)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax)),1.);  
843      //-----------------------------------------------------------------------
844      //real part
845      fDiffFlowGenFunRe4->Fill(fTrack->Pt()/fBinWidth,(Double_t)q,genfunG[4][q]*cos(fgkMltpl*fgkFlow*fTrack->Phi())/(1.+(2.*fR0*sqrt(4.+1.)/nSelTracksRP)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax)),1.);
846      //imaginary part
847      fDiffFlowGenFunIm4->Fill(fTrack->Pt()/fBinWidth,(Double_t)q,genfunG[4][q]*sin(fgkMltpl*fgkFlow*fTrack->Phi())/(1.+(2.*fR0*sqrt(4.+1.)/nSelTracksRP)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax)),1.);  
848      //-----------------------------------------------------------------------
849      //real part
850      fDiffFlowGenFunRe5->Fill(fTrack->Pt()/fBinWidth,(Double_t)q,genfunG[5][q]*cos(fgkMltpl*fgkFlow*fTrack->Phi())/(1.+(2.*fR0*sqrt(5.+1.)/nSelTracksRP)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax)),1.);
851      //imaginary part
852      fDiffFlowGenFunIm5->Fill(fTrack->Pt()/fBinWidth,(Double_t)q,genfunG[5][q]*sin(fgkMltpl*fgkFlow*fTrack->Phi())/(1.+(2.*fR0*sqrt(5.+1.)/nSelTracksRP)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax)),1.);  
853      //-----------------------------------------------------------------------
854      //real part
855      fDiffFlowGenFunRe6->Fill(fTrack->Pt()/fBinWidth,(Double_t)q,genfunG[6][q]*cos(fgkMltpl*fgkFlow*fTrack->Phi())/(1.+(2.*fR0*sqrt(6.+1.)/nSelTracksRP)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax)),1.);
856      //imaginary part
857      fDiffFlowGenFunIm6->Fill(fTrack->Pt()/fBinWidth,(Double_t)q,genfunG[6][q]*sin(fgkMltpl*fgkFlow*fTrack->Phi())/(1.+(2.*fR0*sqrt(6.+1.)/nSelTracksRP)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax)),1.);
858      //-----------------------------------------------------------------------
859      //real part
860      fDiffFlowGenFunRe7->Fill(fTrack->Pt()/fBinWidth,(Double_t)q,genfunG[7][q]*cos(fgkMltpl*fgkFlow*fTrack->Phi())/(1.+(2.*fR0*sqrt(7.+1.)/nSelTracksRP)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax)),1.);
861      //imaginary part
862      fDiffFlowGenFunIm7->Fill(fTrack->Pt()/fBinWidth,(Double_t)q,genfunG[7][q]*sin(fgkMltpl*fgkFlow*fTrack->Phi())/(1.+(2.*fR0*sqrt(7.+1.)/nSelTracksRP)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax)),1.);    
863    }
864    //}
865   }  
866  }//ending the second loop over data            
867  */
868       
869  }//end of if(nEventNSelTracksRP>9)                   
870  
871
872  
873   
874    
875     
876      
877       
878        
879         
880          
881           
882            
883  //off the record: numerical equations for cumulants solved up to different highest order  
884  if(fOtherEquations)
885  {
886   //running over data
887   Int_t nPrimOE = anEvent->NumberOfTracks();//total multiplicity 
888   
889   Int_t nEventNSelTracksRPOE = anEvent->GetEventNSelTracksRP();
890   
891   Double_t genfunG4[fgkPmax4][fgkQmax4];
892   Double_t genfunG6[fgkPmax6][fgkQmax6];
893   Double_t genfunG8[fgkPmax8][fgkQmax8];
894   Double_t genfunG16[fgkPmax16][fgkQmax16];
895   for(Int_t p=0;p<fgkPmax16;p++)
896   {
897    for(Int_t q=0;q<fgkQmax16;q++)
898    {
899     genfunG16[p][q]=1.;
900     if(p<fgkPmax8 && q<fgkQmax8)
901     {
902      genfunG8[p][q]=1.;
903      if(p<fgkPmax6 && q<fgkQmax6)
904      {
905       genfunG6[p][q]=1.;
906       if(p<fgkPmax4 && q<fgkQmax4)
907       {
908        genfunG4[p][q]=1.;
909       }
910      }
911     } 
912    }
913   } 
914    
915   //multiplicities: 
916   if(nEventNSelTracksRPOE>15) fAvMultIntFlow16GFC->Fill(0.,nEventNSelTracksRPOE,1);
917   if(nEventNSelTracksRPOE>7) fAvMultIntFlow8GFC->Fill(0.,nEventNSelTracksRPOE,1);
918   if(nEventNSelTracksRPOE>5) fAvMultIntFlow6GFC->Fill(0.,nEventNSelTracksRPOE,1);
919   if(nEventNSelTracksRPOE>3) fAvMultIntFlow4GFC->Fill(0.,nEventNSelTracksRPOE,1);  
920   
921   //first loop over data: evaluating the generating function G[p][q] for integrated flow 
922   for(Int_t i=0;i<nPrimOE;i++)
923   {
924    fTrack=anEvent->GetTrack(i);
925    if(fTrack && fTrack->InRPSelection())
926    {
927     for(Int_t p=0;p<fgkPmax16;p++)
928     {
929      for(Int_t q=0;q<fgkQmax16;q++)
930      {
931       if(nEventNSelTracksRPOE>15)
932       {
933        genfunG16[p][q]*=(1.+(2.*fR0*sqrt(p+1.)/nEventNSelTracksRPOE)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax16));
934       }       
935       if(p<fgkPmax8 && q<fgkQmax8)
936       {
937        if(nEventNSelTracksRPOE>7)
938        { 
939         genfunG8[p][q]*=(1.+(2.*fR0*sqrt(p+1.)/nEventNSelTracksRPOE)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax8));
940        }
941        if(p<fgkPmax6 && q<fgkQmax6)
942        {
943         if(nEventNSelTracksRPOE>5) 
944         {
945          genfunG6[p][q]*=(1.+(2.*fR0*sqrt(p+1.)/nEventNSelTracksRPOE)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax6));
946         }
947         if(p<fgkPmax4 && q<fgkQmax4)
948         {
949          if(nEventNSelTracksRPOE>3)
950          {
951           genfunG4[p][q]*=(1.+(2.*fR0*sqrt(p+1.)/nEventNSelTracksRPOE)*cos(fgkFlow*fTrack->Phi()-2.*q*TMath::Pi()/fgkQmax4));
952          } 
953         }
954        }
955       }
956      } 
957     }  
958    }//end of if(fTrack && fTrack->InRPSelection())
959   }//ending the loop over data
960  
961  //storing the value of G[p][q] in 2D profile in order to get automatically the avarage <G[p][q]>
962  for(Int_t p=0;p<fgkPmax16;p++)
963  {
964   for(Int_t q=0;q<fgkQmax16;q++)
965   {
966    if(nEventNSelTracksRPOE>15) fIntFlowGenFun16->Fill((Double_t)p,(Double_t)q,genfunG16[p][q],1);
967    if(p<fgkPmax8 && q<fgkQmax8)
968    {
969     if(nEventNSelTracksRPOE>7) fIntFlowGenFun8->Fill((Double_t)p,(Double_t)q,genfunG8[p][q],1);
970     if(p<fgkPmax6 && q<fgkQmax6)
971     {
972      if(nEventNSelTracksRPOE>5) fIntFlowGenFun6->Fill((Double_t)p,(Double_t)q,genfunG6[p][q],1);
973      if(p<fgkPmax4 && q<fgkQmax4)
974      {
975       if(nEventNSelTracksRPOE>3) fIntFlowGenFun4->Fill((Double_t)p,(Double_t)q,genfunG4[p][q],1);
976      }
977     }
978    } 
979   }
980  }
981 }//end of if(fOtherEquations)                  
982                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
983 }//end of Make()
984
985 //================================================================================================================
986
987 void AliFlowAnalysisWithCumulants::GetOutputHistograms(TList *outputListHistos) 
988 {
989  // get the pointers to all output histograms before calling Finish()
990  if (outputListHistos) 
991  {
992   //Get the common histograms from the output list
993   //histograms to store the final results
994   TH1D *intFlowResults   = dynamic_cast<TH1D*>(outputListHistos->FindObject("fIntFlowResultsGFC"));
995   TH1D *diffFlowResults2 = dynamic_cast<TH1D*>(outputListHistos->FindObject("fDiffFlowResults2ndOrderGFC"));
996   TH1D *diffFlowResults4 = dynamic_cast<TH1D*>(outputListHistos->FindObject("fDiffFlowResults4thOrderGFC"));
997   TH1D *diffFlowResults6 = dynamic_cast<TH1D*>(outputListHistos->FindObject("fDiffFlowResults6thOrderGFC"));
998   TH1D *diffFlowResults8 = dynamic_cast<TH1D*>(outputListHistos->FindObject("fDiffFlowResults8thOrderGFC"));
999                     
1000   //common histograms to store the final results  the integrated and differential flow
1001   AliFlowCommonHistResults *commonHistRes2nd = dynamic_cast<AliFlowCommonHistResults*>(outputListHistos->FindObject("AliFlowCommonHistResults2ndOrderGFC"));
1002   AliFlowCommonHistResults *commonHistRes4th = dynamic_cast<AliFlowCommonHistResults*>(outputListHistos->FindObject("AliFlowCommonHistResults4thOrderGFC"));
1003   AliFlowCommonHistResults *commonHistRes6th = dynamic_cast<AliFlowCommonHistResults*>(outputListHistos->FindObject("AliFlowCommonHistResults6thOrderGFC"));
1004   AliFlowCommonHistResults *commonHistRes8th = dynamic_cast<AliFlowCommonHistResults*>(outputListHistos->FindObject("AliFlowCommonHistResults8thOrderGFC"));
1005   
1006   //common control histogram
1007   AliFlowCommonHist *commonHists = dynamic_cast<AliFlowCommonHist*>(outputListHistos->FindObject("AliFlowCommonHistGFC"));
1008   
1009   //profiles with average values of generating functions for int. and diff. flow
1010   TProfile2D *intFlowGenFun    = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fIntFlowGenFun")); 
1011   
1012   TProfile2D *intFlowGenFun4   = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fIntFlowGenFun4"));  //only for other system of Eq.
1013   TProfile2D *intFlowGenFun6   = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fIntFlowGenFun6"));  //only for other system of Eq. 
1014   TProfile2D *intFlowGenFun8   = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fIntFlowGenFun8"));  //only for other system of Eq.
1015   TProfile2D *intFlowGenFun16  = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fIntFlowGenFun16")); //only for other system of Eq.  
1016   
1017   //RP, Pt:
1018   TProfile3D *diffFlowPtRPGenFunRe = dynamic_cast<TProfile3D*>(outputListHistos->FindObject("fDiffFlowPtRPGenFunRe"));
1019   TProfile3D *diffFlowPtRPGenFunIm = dynamic_cast<TProfile3D*>(outputListHistos->FindObject("fDiffFlowPtRPGenFunIm"));
1020   TProfile *ptBinRPNoOfParticles = dynamic_cast<TProfile*>(outputListHistos->FindObject("fPtBinRPNoOfParticles"));
1021   
1022   //RP, Eta:
1023   TProfile3D *diffFlowEtaRPGenFunRe = dynamic_cast<TProfile3D*>(outputListHistos->FindObject("fDiffFlowEtaRPGenFunRe"));
1024   TProfile3D *diffFlowEtaRPGenFunIm = dynamic_cast<TProfile3D*>(outputListHistos->FindObject("fDiffFlowEtaRPGenFunIm"));
1025   TProfile *etaBinRPNoOfParticles = dynamic_cast<TProfile*>(outputListHistos->FindObject("fEtaBinRPNoOfParticles"));
1026   
1027   //POI, Pt:
1028   TProfile3D *diffFlowPtPOIGenFunRe = dynamic_cast<TProfile3D*>(outputListHistos->FindObject("fDiffFlowPtPOIGenFunRe"));
1029   TProfile3D *diffFlowPtPOIGenFunIm = dynamic_cast<TProfile3D*>(outputListHistos->FindObject("fDiffFlowPtPOIGenFunIm"));
1030   TProfile *ptBinPOINoOfParticles = dynamic_cast<TProfile*>(outputListHistos->FindObject("fPtBinPOINoOfParticles"));
1031   
1032   //POI, Eta:
1033   TProfile3D *diffFlowEtaPOIGenFunRe = dynamic_cast<TProfile3D*>(outputListHistos->FindObject("fDiffFlowEtaPOIGenFunRe"));
1034   TProfile3D *diffFlowEtaPOIGenFunIm = dynamic_cast<TProfile3D*>(outputListHistos->FindObject("fDiffFlowEtaPOIGenFunIm"));
1035   TProfile *etaBinPOINoOfParticles = dynamic_cast<TProfile*>(outputListHistos->FindObject("fEtaBinPOINoOfParticles"));
1036   
1037   //average selected multiplicity (for int. flow) 
1038   TProfile *avMult = dynamic_cast<TProfile*>(outputListHistos->FindObject("fAvMultIntFlowGFC"));
1039   
1040   TProfile *avMult4  = dynamic_cast<TProfile*>(outputListHistos->FindObject("fAvMultIntFlow4GFCA"));  //only for other system of Eq.
1041   TProfile *avMult6  = dynamic_cast<TProfile*>(outputListHistos->FindObject("fAvMultIntFlow6GFCA"));  //only for other system of Eq.
1042   TProfile *avMult8  = dynamic_cast<TProfile*>(outputListHistos->FindObject("fAvMultIntFlow8GFCA"));  //only for other system of Eq.
1043   TProfile *avMult16 = dynamic_cast<TProfile*>(outputListHistos->FindObject("fAvMultIntFlow16GFCA")); //only for other system of Eq.
1044   
1045   //average values of Q-vector components (1st bin: <Q_x>, 2nd bin: <Q_y>, 3rd bin: <(Q_x)^2>, 4th bin: <(Q_y)^2>) 
1046   TProfile *qVectorComponents = dynamic_cast<TProfile*>(outputListHistos->FindObject("fQVectorComponentsGFC"));
1047   
1048   //<w^2> 
1049   TProfile *averageOfSquaredWeight = dynamic_cast<TProfile*>(outputListHistos->FindObject("fAverageOfSquaredWeight"));
1050       
1051   /*
1052   TProfile2D *diffFlowPtGenFunRe0 = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fdiffFlowPtGenFunRe0"));
1053   TProfile2D *diffFlowPtGenFunRe1 = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fdiffFlowPtGenFunRe1")); 
1054   TProfile2D *diffFlowPtGenFunRe2 = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fdiffFlowPtGenFunRe2")); 
1055   TProfile2D *diffFlowPtGenFunRe3 = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fdiffFlowPtGenFunRe3")); 
1056   TProfile2D *diffFlowPtGenFunRe4 = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fdiffFlowPtGenFunRe4")); 
1057   TProfile2D *diffFlowPtGenFunRe5 = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fdiffFlowPtGenFunRe5")); 
1058   TProfile2D *diffFlowPtGenFunRe6 = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fdiffFlowPtGenFunRe6")); 
1059   TProfile2D *diffFlowPtGenFunRe7 = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fdiffFlowPtGenFunRe7")); 
1060   TProfile2D *diffFlowPtGenFunIm0 = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fdiffFlowPtGenFunIm0")); 
1061   TProfile2D *diffFlowPtGenFunIm1 = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fdiffFlowPtGenFunIm1")); 
1062   TProfile2D *diffFlowPtGenFunIm2 = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fdiffFlowPtGenFunIm2")); 
1063   TProfile2D *diffFlowPtGenFunIm3 = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fdiffFlowPtGenFunIm3")); 
1064   TProfile2D *diffFlowPtGenFunIm4 = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fdiffFlowPtGenFunIm4")); 
1065   TProfile2D *diffFlowPtGenFunIm5 = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fdiffFlowPtGenFunIm5")); 
1066   TProfile2D *diffFlowPtGenFunIm6 = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fdiffFlowPtGenFunIm6")); 
1067   TProfile2D *diffFlowPtGenFunIm7 = dynamic_cast<TProfile2D*>(outputListHistos->FindObject("fdiffFlowPtGenFunIm7")); 
1068   */
1069
1070   //profile with avarage selected multiplicity for int. flow 
1071   //TProfile *avMult = dynamic_cast<TProfile*>(outputListHistos->FindObject("fAvMultIntFlow"));
1072   
1073   //profile with avarage values of Q-vector components (1st bin: <Q_x>, 2nd bin: <Q_y>, 3rd bin: <(Q_x)^2>, 4th bin: <(Q_y)^2>) 
1074   //TProfile *QVectorComponents = dynamic_cast<TProfile*>(outputListHistos->FindObject("fQVectorComponents"));
1075   
1076   //q-distribution
1077   //TH1D *qDist = dynamic_cast<TH1D*>(outputListHistos->FindObject("fQDist"));
1078   
1079   //AliCumulantsFunctions finalResults(intFlowGenFun,NULL,NULL, intFlowResults,diffFlowResults2,diffFlowResults4,diffFlowResults6,diffFlowResults8,avMult,QVectorComponents,qDist,diffFlowPtGenFunRe0,diffFlowPtGenFunRe1,diffFlowPtGenFunRe2, diffFlowPtGenFunRe3,diffFlowPtGenFunRe4,diffFlowPtGenFunRe5,diffFlowPtGenFunRe6,diffFlowPtGenFunRe7,diffFlowPtGenFunIm0,diffFlowPtGenFunIm1, diffFlowPtGenFunIm2,diffFlowPtGenFunIm3,diffFlowPtGenFunIm4,diffFlowPtGenFunIm5,diffFlowPtGenFunIm6,diffFlowPtGenFunIm7);
1080   
1081   //AliCumulantsFunctions finalResults(intFlowGenFun,diffFlowPtGenFunRe,diffFlowPtGenFunIm, intFlowResults,diffFlowResults2,diffFlowResults4,diffFlowResults6,diffFlowResults8,avMult,QVectorComponents,qDist);
1082          
1083   //finalResults.Calculate();  
1084   
1085   //---------------------------------------------------
1086   
1087   this->SetIntFlowResults(intFlowResults); 
1088   this->SetDiffFlowResults2nd(diffFlowResults2);
1089   this->SetDiffFlowResults4th(diffFlowResults4);
1090   this->SetDiffFlowResults6th(diffFlowResults6);
1091   this->SetDiffFlowResults8th(diffFlowResults8); 
1092   
1093   this->SetCommonHistsResults2nd(commonHistRes2nd); 
1094   this->SetCommonHistsResults4th(commonHistRes4th);
1095   this->SetCommonHistsResults6th(commonHistRes6th);
1096   this->SetCommonHistsResults8th(commonHistRes8th);
1097   
1098   this->SetCommonHists(commonHists);
1099   
1100   this->SetIntFlowGenFun(intFlowGenFun);
1101   
1102   this->SetIntFlowGenFun4(intFlowGenFun4);   //only for other system of Eq.
1103   this->SetIntFlowGenFun6(intFlowGenFun6);   //only for other system of Eq.
1104   this->SetIntFlowGenFun8(intFlowGenFun8);   //only for other system of Eq.
1105   this->SetIntFlowGenFun16(intFlowGenFun16); //only for other system of Eq. 
1106   
1107   this->SetDiffFlowPtRPGenFunRe(diffFlowPtRPGenFunRe);
1108   this->SetDiffFlowPtRPGenFunIm(diffFlowPtRPGenFunIm);
1109   this->SetNumberOfParticlesPerPtBinRP(ptBinRPNoOfParticles);
1110   
1111   this->SetDiffFlowEtaRPGenFunRe(diffFlowEtaRPGenFunRe);
1112   this->SetDiffFlowEtaRPGenFunIm(diffFlowEtaRPGenFunIm);
1113   this->SetNumberOfParticlesPerEtaBinRP(etaBinRPNoOfParticles);     
1114   
1115   this->SetDiffFlowPtPOIGenFunRe(diffFlowPtPOIGenFunRe);
1116   this->SetDiffFlowPtPOIGenFunIm(diffFlowPtPOIGenFunIm);
1117   this->SetNumberOfParticlesPerPtBinPOI(ptBinPOINoOfParticles);
1118   
1119   this->SetDiffFlowEtaPOIGenFunRe(diffFlowEtaPOIGenFunRe);
1120   this->SetDiffFlowEtaPOIGenFunIm(diffFlowEtaPOIGenFunIm);
1121   this->SetNumberOfParticlesPerEtaBinPOI(etaBinPOINoOfParticles);
1122   
1123   this->SetAverageMultiplicity(avMult);
1124   
1125   this->SetAverageMultiplicity4(avMult4);   //only for other system of Eq.
1126   this->SetAverageMultiplicity6(avMult6);   //only for other system of Eq.
1127   this->SetAverageMultiplicity8(avMult8);   //only for other system of Eq.
1128   this->SetAverageMultiplicity16(avMult16); //only for other system of Eq.
1129   
1130   this->SetQVectorComponents(qVectorComponents);
1131   
1132   this->SetAverageOfSquaredWeight(averageOfSquaredWeight);
1133  } 
1134 }
1135
1136 //================================================================================================================
1137
1138 void AliFlowAnalysisWithCumulants::Finish()
1139 {
1140  //calculate the final results
1141  //AliCumulantsFunctions finalResults(fIntFlowGenFun,NULL,NULL, fIntFlowResults,fDiffFlowResults2,fDiffFlowResults4,fDiffFlowResults6,fDiffFlowResults8,fAvMultIntFlow,fQVectorComponents,  fQDist,fDiffFlowGenFunRe0,fDiffFlowGenFunRe1,fDiffFlowGenFunRe2, fDiffFlowGenFunRe3,fDiffFlowGenFunRe4,fDiffFlowGenFunRe5,fDiffFlowGenFunRe6,fDiffFlowGenFunRe7,fDiffFlowGenFunIm0,fDiffFlowGenFunIm1, fDiffFlowGenFunIm2,fDiffFlowGenFunIm3,fDiffFlowGenFunIm4,fDiffFlowGenFunIm5,fDiffFlowGenFunIm6,fDiffFlowGenFunIm7);
1142
1143  AliCumulantsFunctions finalResults(fIntFlowGenFun,fIntFlowGenFun4,fIntFlowGenFun6,fIntFlowGenFun8,fIntFlowGenFun16,fAvMultIntFlow4GFC, fAvMultIntFlow6GFC,fAvMultIntFlow8GFC,fAvMultIntFlow16GFC,fDiffFlowPtRPGenFunRe,fDiffFlowPtRPGenFunIm,fPtBinRPNoOfParticles, fDiffFlowEtaRPGenFunRe,fDiffFlowEtaRPGenFunIm,fEtaBinRPNoOfParticles,fDiffFlowPtPOIGenFunRe,fDiffFlowPtPOIGenFunIm,fPtBinPOINoOfParticles, fDiffFlowEtaPOIGenFunRe,fDiffFlowEtaPOIGenFunIm,fEtaBinPOINoOfParticles,fIntFlowResultsGFC,fDiffFlowResults2ndOrderGFC,fDiffFlowResults4thOrderGFC,fDiffFlowResults6thOrderGFC,fDiffFlowResults8thOrderGFC, fAvMultIntFlowGFC,fQVectorComponentsGFC,fAverageOfSquaredWeight,fCommonHistsResults2nd, fCommonHistsResults4th,fCommonHistsResults6th,fCommonHistsResults8th,fCommonHists);
1144                            
1145  finalResults.Calculate();     
1146 }
1147
1148 //================================================================================================================
1149
1150 void AliFlowAnalysisWithCumulants::WriteHistograms(TString* outputFileName)
1151 {
1152  //store the final results in output .root file
1153  TFile *output = new TFile(outputFileName->Data(),"RECREATE");
1154  //output->WriteObject(fHistList, "cobjGFC","SingleKey");
1155  fHistList->SetName("cobjGFC");
1156  fHistList->SetOwner(kTRUE);
1157  fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
1158  delete output;
1159 }
1160
1161 //================================================================================================================
1162
1163 //================================================================================================================
1164
1165 void AliFlowAnalysisWithCumulants::WriteHistograms(TString outputFileName)
1166 {
1167  //store the final results in output .root file
1168  TFile *output = new TFile(outputFileName.Data(),"RECREATE");
1169  //output->WriteObject(fHistList, "cobjGFC","SingleKey");
1170  fHistList->SetName("cobjGFC");
1171  fHistList->SetOwner(kTRUE);
1172  fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
1173  delete output;
1174 }
1175
1176 //================================================================================================================
1177
1178
1179
1180