Implement weigths for Q cumulants in local run
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowAnalysisWithQCumulants.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 Q-cumulants * 
18  *                                * 
19  * author:  Ante Bilandzic        * 
20  *           (anteb@nikhef.nl)    *
21  *********************************/ 
22
23 #define AliFlowAnalysisWithQCumulants_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"
32 #include "TGraph.h"
33 #include "TParticle.h"
34 #include "TRandom3.h"
35 #include "TStyle.h"
36 #include "TProfile.h"
37 #include "TProfile2D.h" 
38 #include "TProfile3D.h"
39 #include "TMath.h"
40 #include "TArrow.h"
41 #include "TPaveLabel.h"
42 #include "TCanvas.h"
43 #include "AliFlowEventSimple.h"
44 #include "AliFlowTrackSimple.h"
45 #include "AliFlowAnalysisWithQCumulants.h"
46 #include "AliQCumulantsFunctions.h"
47
48 #include "TRandom.h"
49
50 class TH1;
51 class TGraph;
52 class TPave;
53 class TLatex;
54 class TMarker;
55 class TRandom3;
56 class TObjArray;
57 class TList;
58 class TCanvas;
59 class TSystem;
60 class TROOT;
61 class AliFlowVector;
62 class TVector;
63
64 //================================================================================================================
65
66 ClassImp(AliFlowAnalysisWithQCumulants)
67
68 AliFlowAnalysisWithQCumulants::AliFlowAnalysisWithQCumulants():  
69  fTrack(NULL),
70  fHistList(NULL),
71  fWeightsList(NULL),
72  fAvMultIntFlowQC(NULL),
73  fQvectorComponents(NULL),
74  fIntFlowResultsQC(NULL),
75  fDiffFlowResults2ndOrderQC(NULL),
76  fDiffFlowResults4thOrderQC(NULL),
77  fCovariances(NULL),
78  fQvectorForEachEventX(NULL),//to be removed
79  fQvectorForEachEventY(NULL),//to be removed
80  fQCorrelations(NULL),
81  fQProduct(NULL),
82  fDirectCorrelations(NULL),
83  fPtReq1nRP(NULL),
84  fPtImq1nRP(NULL),
85  fPtReq2nRP(NULL),
86  fPtImq2nRP(NULL),
87  f2PerPtBin1n1nRP(NULL),
88  f2PerPtBin2n2nRP(NULL),
89  f3PerPtBin2n1n1nRP(NULL),
90  f3PerPtBin1n1n2nRP(NULL),
91  f4PerPtBin1n1n1n1nRP(NULL),
92  fEtaReq1nRP(NULL),
93  fEtaImq1nRP(NULL),
94  fEtaReq2nRP(NULL),
95  fEtaImq2nRP(NULL),
96  f2PerEtaBin1n1nRP(NULL),
97  f2PerEtaBin2n2nRP(NULL),
98  f3PerEtaBin2n1n1nRP(NULL),
99  f3PerEtaBin1n1n2nRP(NULL),
100  f4PerEtaBin1n1n1n1nRP(NULL),
101  fPtReq1nPrimePOI(NULL),
102  fPtImq1nPrimePOI(NULL),
103  fPtReq2nPrimePOI(NULL),
104  fPtImq2nPrimePOI(NULL),
105  fmPrimePerPtBin(NULL),
106  fPtReq1nPrimePrimePOI(NULL),
107  fPtImq1nPrimePrimePOI(NULL),
108  fPtReq2nPrimePrimePOI(NULL),
109  fPtImq2nPrimePrimePOI(NULL),
110  fmPrimePrimePerPtBin(NULL),
111  fEtaReq1nPrimePOI(NULL),
112  fEtaImq1nPrimePOI(NULL),
113  fEtaReq2nPrimePOI(NULL),
114  fEtaImq2nPrimePOI(NULL),
115  fmPrimePerEtaBin(NULL),
116  fEtaReq1nPrimePrimePOI(NULL),
117  fEtaImq1nPrimePrimePOI(NULL),
118  fEtaReq2nPrimePrimePOI(NULL),
119  fEtaImq2nPrimePrimePOI(NULL),
120  fmPrimePrimePerEtaBin(NULL),
121  f2PerPtBin1n1nPOI(NULL),
122  f2PerPtBin2n2nPOI(NULL),
123  f3PerPtBin2n1n1nPOI(NULL),
124  f3PerPtBin1n1n2nPOI(NULL),
125  f4PerPtBin1n1n1n1nPOI(NULL),
126  f2PerEtaBin1n1nPOI(NULL),
127  f2PerEtaBin2n2nPOI(NULL),
128  f3PerEtaBin2n1n1nPOI(NULL),
129  f3PerEtaBin1n1n2nPOI(NULL),
130  f4PerEtaBin1n1n1n1nPOI(NULL), 
131  fCommonHists2nd(NULL),
132  fCommonHists4th(NULL),
133  fCommonHists6th(NULL),
134  fCommonHists8th(NULL),
135  fCommonHistsResults2nd(NULL),
136  fCommonHistsResults4th(NULL),
137  fCommonHistsResults6th(NULL),
138  fCommonHistsResults8th(NULL),
139  f2pDistribution(NULL),
140  f4pDistribution(NULL),
141  f6pDistribution(NULL),
142  f8pDistribution(NULL),
143  fnBinsPt(0),
144  fPtMin(0),
145  fPtMax(0),
146  fnBinsEta(0),
147  fEtaMin(0),
148  fEtaMax(0),
149  fEventCounter(0),
150  fUsePhiWeights(kFALSE),
151  fUsePtWeights(kFALSE),
152  fUseEtaWeights(kFALSE)
153 {
154  //constructor 
155  fHistList = new TList(); 
156  fWeightsList = new TList();
157   
158  fnBinsPt = AliFlowCommonConstants::GetNbinsPt();
159  fPtMin   = AliFlowCommonConstants::GetPtMin();      
160  fPtMax   = AliFlowCommonConstants::GetPtMax();
161  
162  fnBinsEta = AliFlowCommonConstants::GetNbinsEta();
163  fEtaMin   = AliFlowCommonConstants::GetEtaMin();            
164  fEtaMax   = AliFlowCommonConstants::GetEtaMax();
165 }
166
167 AliFlowAnalysisWithQCumulants::~AliFlowAnalysisWithQCumulants()
168 {
169  //destructor
170  delete fHistList; 
171  delete fWeightsList;
172 }
173
174 //================================================================================================================
175
176 void AliFlowAnalysisWithQCumulants::Init()
177 {
178  //various output histograms
179  //avarage multiplicity 
180  fAvMultIntFlowQC = new TProfile("fAvMultIntFlowQC","Average Multiplicity",1,0,1,"s");
181  fAvMultIntFlowQC->SetXTitle("");
182  fAvMultIntFlowQC->SetYTitle("");
183  fAvMultIntFlowQC->SetLabelSize(0.06);
184  fAvMultIntFlowQC->SetMarkerStyle(25);
185  fAvMultIntFlowQC->SetLabelOffset(0.01);
186  (fAvMultIntFlowQC->GetXaxis())->SetBinLabel(1,"Average Multiplicity");
187  fHistList->Add(fAvMultIntFlowQC);
188  
189  //Q-vector stuff
190  fQvectorComponents = new TProfile("fQvectorComponents","Avarage of Q-vector components",44,0.,44.,"s");
191  fQvectorComponents->SetXTitle("");
192  fQvectorComponents->SetYTitle("");
193  //fHistList->Add(fQvectorComponents);
194  
195  //final results for integrated flow from Q-cumulants
196  fIntFlowResultsQC = new TH1D("fIntFlowResultsQC","Integrated Flow from Q-cumulants",4,0,4);
197  //fIntFlowResults->SetXTitle("");
198  //fIntFlowResultsQC->SetYTitle("Integrated Flow");
199  fIntFlowResultsQC->SetLabelSize(0.06);
200  //fIntFlowResultsQC->SetTickLength(1);
201  fIntFlowResultsQC->SetMarkerStyle(25);
202  (fIntFlowResultsQC->GetXaxis())->SetBinLabel(1,"v_{n}{2}");
203  (fIntFlowResultsQC->GetXaxis())->SetBinLabel(2,"v_{n}{4}");
204  (fIntFlowResultsQC->GetXaxis())->SetBinLabel(3,"v_{n}{6}");
205  (fIntFlowResultsQC->GetXaxis())->SetBinLabel(4,"v_{n}{8}");
206  fHistList->Add(fIntFlowResultsQC);
207
208  //final results for differential flow from 2nd order Q-cumulant
209  fDiffFlowResults2ndOrderQC = new TH1D("fDiffFlowResults2ndOrderQC","Differential Flow from 2nd Order Q-cumulant",fnBinsPt,fPtMin,fPtMax);
210  fDiffFlowResults2ndOrderQC->SetXTitle("p_{t} [GeV]");
211  //fDiffFlowResults2ndOrderQC->SetYTitle("Differential Flow");
212  fHistList->Add(fDiffFlowResults2ndOrderQC);
213  
214  //final results for differential flow from 4th order Q-cumulant
215  fDiffFlowResults4thOrderQC = new TH1D("fDiffFlowResults4thOrderQC","Differential Flow from 4th Order Q-cumulant",fnBinsPt,fPtMin,fPtMax);
216  fDiffFlowResults4thOrderQC->SetXTitle("p_{t} [GeV]");
217  //fDiffFlowResults4thOrderQC->SetYTitle("Differential Flow");
218  fHistList->Add(fDiffFlowResults4thOrderQC);
219  
220  //final results for covariances (1st bin: <2*4>-<2>*<4>, 2nd bin: <2*6>-<2>*<6>, ...)
221  fCovariances = new TH1D("fCovariances","Covariances",6,0,6);
222  //fCovariances->SetXTitle("");
223  //fCovariances->SetYTitle("<covariance>");
224  fCovariances->SetLabelSize(0.04);
225  fCovariances->SetTickLength(1);
226  fCovariances->SetMarkerStyle(25);
227  (fCovariances->GetXaxis())->SetBinLabel(1,"Cov(2,4)");
228  (fCovariances->GetXaxis())->SetBinLabel(2,"Cov(2,6)");
229  (fCovariances->GetXaxis())->SetBinLabel(3,"Cov(2,8)");
230  (fCovariances->GetXaxis())->SetBinLabel(4,"Cov(4,6)");
231  (fCovariances->GetXaxis())->SetBinLabel(5,"Cov(4,8)");
232  (fCovariances->GetXaxis())->SetBinLabel(6,"Cov(6,8)");
233  fHistList->Add(fCovariances);
234   
235  //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
236  //                   !!!! to be removed !!!! 
237  //profile containing the x-components of Q-vectors from all events 
238  fQvectorForEachEventX = new TProfile("fQvectorForEachEventX","x-components of Q-vectors",44000,1,44000,"s");
239  fHistList->Add(fQvectorForEachEventX);
240  
241  //profile containing the y-components of Q-vectors from all events 
242  fQvectorForEachEventY = new TProfile("fQvectorForEachEventY","y-components of Q-vectors",44000,1,44000,"s");
243  fHistList->Add(fQvectorForEachEventY);
244  //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
245     
246  //multi-particle correlations calculated from Q-vectors
247  fQCorrelations = new TProfile("fQCorrelations","multi-particle correlations from Q-vectors",32,0,32,"s");
248  //fQCorrelations->SetXTitle("correlations");
249  //fQCorrelations->SetYTitle("");
250  fQCorrelations->SetTickLength(-0.01,"Y");
251  fQCorrelations->SetMarkerStyle(25);
252  fQCorrelations->SetLabelSize(0.03);
253  fQCorrelations->SetLabelOffset(0.01,"Y");
254  
255  (fQCorrelations->GetXaxis())->SetBinLabel(1,"<<2>>_{n|n}");
256  (fQCorrelations->GetXaxis())->SetBinLabel(2,"<<2>>_{2n|2n}");
257  (fQCorrelations->GetXaxis())->SetBinLabel(3,"<<2>>_{3n|3n}");
258  (fQCorrelations->GetXaxis())->SetBinLabel(4,"<<2>>_{4n|4n}");
259  
260  (fQCorrelations->GetXaxis())->SetBinLabel(6,"<<3>>_{2n|n,n}");
261  (fQCorrelations->GetXaxis())->SetBinLabel(7,"<<3>>_{3n|2n,n}");
262  (fQCorrelations->GetXaxis())->SetBinLabel(8,"<<3>>_{4n|2n,2n}");
263  (fQCorrelations->GetXaxis())->SetBinLabel(9,"<<3>>_{4n|3n,n}");
264  
265  (fQCorrelations->GetXaxis())->SetBinLabel(11,"<<4>>_{n,n|n,n}"); 
266  (fQCorrelations->GetXaxis())->SetBinLabel(12,"<<4>>_{2n,n|2n,n}");
267  (fQCorrelations->GetXaxis())->SetBinLabel(13,"<<4>>_{2n,2n|2n,2n}");
268  (fQCorrelations->GetXaxis())->SetBinLabel(14,"<<4>>_{3n|n,n,n}");
269  (fQCorrelations->GetXaxis())->SetBinLabel(15,"<<4>>_{3n,n|3n,n}");
270  (fQCorrelations->GetXaxis())->SetBinLabel(16,"<<4>>_{3n,n|2n,2n}"); 
271  (fQCorrelations->GetXaxis())->SetBinLabel(17,"<<4>>_{4n|2n,n,n}");
272  
273  (fQCorrelations->GetXaxis())->SetBinLabel(19,"<<5>>_{2n|n,n,n,n}"); 
274  (fQCorrelations->GetXaxis())->SetBinLabel(20,"<<5>>_{2n,2n|2n,n,n}");
275  (fQCorrelations->GetXaxis())->SetBinLabel(21,"<<5>>_{3n,n|2n,n,n}");
276  (fQCorrelations->GetXaxis())->SetBinLabel(22,"<<5>>_{4n|n,n,n,n}");
277  
278  (fQCorrelations->GetXaxis())->SetBinLabel(24,"<<6>>_{n,n,n|n,n,n}");
279  (fQCorrelations->GetXaxis())->SetBinLabel(25,"<<6>>_{2n,n,n|2n,n,n}");
280  (fQCorrelations->GetXaxis())->SetBinLabel(26,"<<6>>_{2n,2n|n,n,n,n}");
281  (fQCorrelations->GetXaxis())->SetBinLabel(27,"<<6>>_{3n,n|n,n,n,n}");
282  
283  (fQCorrelations->GetXaxis())->SetBinLabel(29,"<<7>>_{2n,n,n|n,n,n,n}");
284
285  (fQCorrelations->GetXaxis())->SetBinLabel(31,"<<8>>_{n,n,n,n|n,n,n,n}");
286  
287  fHistList->Add(fQCorrelations);
288  
289  //average products
290  fQProduct = new TProfile("fQProduct","average of products",6,0,6,"s");
291  fQProduct->SetTickLength(-0.01,"Y");
292  fQProduct->SetMarkerStyle(25);
293  fQProduct->SetLabelSize(0.03);
294  fQProduct->SetLabelOffset(0.01,"Y");
295  (fQProduct->GetXaxis())->SetBinLabel(1,"<<2*4>>");
296  (fQProduct->GetXaxis())->SetBinLabel(2,"<<2*6>>");
297  (fQProduct->GetXaxis())->SetBinLabel(3,"<<2*8>>");
298  (fQProduct->GetXaxis())->SetBinLabel(4,"<<4*6>>");
299  (fQProduct->GetXaxis())->SetBinLabel(5,"<<4*8>>");
300  (fQProduct->GetXaxis())->SetBinLabel(6,"<<6*8>>");
301  fQProduct->SetXTitle("");
302  fQProduct->SetYTitle("");
303  fHistList->Add(fQProduct);
304  
305  //multi-particle correlations calculated with nested loops (0..40 integrated flow; 40..80 differential flow)
306  fDirectCorrelations = new TProfile("fDirectCorrelations","multi-particle correlations with nested loops",80,0,80,"s");
307  fDirectCorrelations->SetXTitle("");
308  fDirectCorrelations->SetYTitle("correlations");
309  fHistList->Add(fDirectCorrelations);
310  
311  //fPtReq1nRP
312  fPtReq1nRP = new TProfile("fPtReq1nRP","Re[q_n]",fnBinsPt,fPtMin,fPtMax,"s");
313  fPtReq1nRP->SetXTitle("p_{t} [GeV]");
314  fPtReq1nRP->SetYTitle("Re[q_n]");
315  //fHistList->Add(fPtReq1nRP);
316  
317  //fPtImq1nRP
318  fPtImq1nRP = new TProfile("fPtImq1nRP","Im[q_n]",fnBinsPt,fPtMin,fPtMax,"s");
319  fPtImq1nRP->SetXTitle("p_{t} [GeV]");
320  fPtImq1nRP->SetYTitle("Im[q_n]");
321  //fHistList->Add(fPtImq1nRP);
322  
323  //fPtReq2nRP
324  fPtReq2nRP = new TProfile("fPtReq2nRP","Re[q_2n]",fnBinsPt,fPtMin,fPtMax,"s");
325  fPtReq2nRP->SetXTitle("p_{t} [GeV]");
326  fPtReq2nRP->SetYTitle("Im[D]");
327  //fHistList->Add(fPtReq2nRP);
328
329  //fPtImq2nRP
330  fPtImq2nRP = new TProfile("fPtImq2nRP","Im[q_2n]",fnBinsPt,fPtMin,fPtMax,"s");
331  fPtImq2nRP->SetXTitle("p_{t} [GeV]");
332  fPtImq2nRP->SetYTitle("Im[q_2n]");
333  //fHistList->Add(fPtImq2nRP);
334  
335  //f2PerPtBin1n1nRP
336  f2PerPtBin1n1nRP = new TProfile("f2PerPtBin1n1nRP","<2'>_{n|n}",fnBinsPt,fPtMin,fPtMax,"s");
337  f2PerPtBin1n1nRP->SetXTitle("p_{t} [GeV]");
338  //f2PerPtBin1n1n->SetYTitle("<2'>_{n|n}");
339  fHistList->Add(f2PerPtBin1n1nRP);
340  
341  //f2PerPtBin2n2nRP
342  f2PerPtBin2n2nRP = new TProfile("f2PerPtBin2n2nRP","<2'>_{2n|2n}",fnBinsPt,fPtMin,fPtMax,"s");
343  f2PerPtBin2n2nRP->SetXTitle("p_{t} [GeV]");
344  //f2PerPtBin2n2nRP->SetYTitle("<2'>_{2n|2n}");}//line needed only for nested loops - end of if(nPrim>8&&nPrim<12) 
345  fHistList->Add(f2PerPtBin2n2nRP);
346  
347  //f3PerPtBin2n1n1nRP
348  f3PerPtBin2n1n1nRP = new TProfile("f3PerPtBin2n1n1nRP","<3'>_{2n|n,n}",fnBinsPt,fPtMin,fPtMax,"s");
349  f3PerPtBin2n1n1nRP->SetXTitle("p_{t} [GeV]");
350  //f3PerPtBin2n1n1nRP->SetYTitle("<3'>_{2n|n,n}");
351  fHistList->Add(f3PerPtBin2n1n1nRP);
352  
353  //f3PerPtBin1n1n2nRP
354  f3PerPtBin1n1n2nRP = new TProfile("f3PerPtBin1n1n2nRP","<3'>_{n,n|2n}",fnBinsPt,fPtMin,fPtMax,"s");
355  f3PerPtBin1n1n2nRP->SetXTitle("p_{t} [GeV]");
356  //f3PerPtBin1n1n2nRP->SetYTitle("<3'>_{n,n|2n}");
357  fHistList->Add(f3PerPtBin1n1n2nRP);
358  
359  //f4PerPtBin1n1n1n1nRP
360  f4PerPtBin1n1n1n1nRP = new TProfile("f4PerPtBin1n1n1n1nRP","<4'>_{n,n|n,n}",fnBinsPt,fPtMin,fPtMax,"s");
361  f4PerPtBin1n1n1n1nRP->SetXTitle("p_{t} [GeV]");
362  //f4PerPtBin1n1n1n1nRP->SetYTitle("<4'>_{n,n|n,n}");
363  fHistList->Add(f4PerPtBin1n1n1n1nRP);
364  
365  //fEtaReq1nRP
366  fEtaReq1nRP = new TProfile("fEtaReq1nRP","Re[q_n]",fnBinsEta,fEtaMin,fEtaMax,"s");
367  fEtaReq1nRP->SetXTitle("#eta");
368  fEtaReq1nRP->SetYTitle("Re[q_n]");
369  fHistList->Add(fEtaReq1nRP);
370  
371  //fEtaImq1nRP
372  fEtaImq1nRP = new TProfile("fEtaImq1nRP","Im[q_n]",fnBinsEta,fEtaMin,fEtaMax,"s");
373  fEtaImq1nRP->SetXTitle("#eta");
374  fEtaImq1nRP->SetYTitle("Im[q_n]");
375  //fHistList->Add(fEtaImq1nRP);
376  
377  //fEtaReq2nRP
378  fEtaReq2nRP = new TProfile("fEtaReq2nRP","Re[q_2n]",fnBinsEta,fEtaMin,fEtaMax,"s");
379  fEtaReq2nRP->SetXTitle("#eta");
380  fEtaReq2nRP->SetYTitle("Im[D]");
381  //fHistList->Add(fEtaReq2nRP);
382  
383  //fEtaImq2nRP
384  fEtaImq2nRP = new TProfile("fEtaImq2nRP","Im[q_2n]",fnBinsEta,fEtaMin,fEtaMax,"s");
385  fEtaImq2nRP->SetXTitle("#eta");
386  fEtaImq2nRP->SetYTitle("Im[q_2n]");
387  //fHistList->Add(fEtaImq2nRP);
388  
389  //f2PerEtaBin1n1nRP
390  f2PerEtaBin1n1nRP = new TProfile("f2PerEtaBin1n1nRP","<2'>_{n|n}",fnBinsEta,fEtaMin,fEtaMax,"s");
391  f2PerEtaBin1n1nRP->SetXTitle("#eta");
392
393  //f2PerEtaBin1n1nRP->SetYTitle("<2'>_{n|n}");
394  fHistList->Add(f2PerEtaBin1n1nRP);
395  
396  //f2PerEtaBin2n2nRP
397  f2PerEtaBin2n2nRP = new TProfile("f2PerEtaBin2n2nRP","<2'>_{2n|2n}",fnBinsEta,fEtaMin,fEtaMax,"s");
398  f2PerEtaBin2n2nRP->SetXTitle("#eta");
399  //f2PerEtaBin2n2nRP->SetYTitle("<2'>_{2n|2n}");
400  fHistList->Add(f2PerEtaBin2n2nRP);
401  
402  //f3PerEtaBin2n1n1nRP
403  f3PerEtaBin2n1n1nRP = new TProfile("f3PerEtaBin2n1n1nRP","<3'>_{2n|n,n}",fnBinsEta,fEtaMin,fEtaMax,"s");
404  f3PerEtaBin2n1n1nRP->SetXTitle("#eta");
405  //f3PerEtaBin2n1n1nRP->SetYTitle("<3'>_{2n|n,n}");
406  fHistList->Add(f3PerEtaBin2n1n1nRP);
407  
408  //f3PerEtaBin1n1n2nRP
409  f3PerEtaBin1n1n2nRP = new TProfile("f3PerEtaBin1n1n2RP","<3'>_{n,n|2n}",fnBinsEta,fEtaMin,fEtaMax,"s");
410  f3PerEtaBin1n1n2nRP->SetXTitle("#eta");
411  //f3PerEtaBin1n1n2n->SetYTitle("<3'>_{n,n|2n}");
412  fHistList->Add(f3PerEtaBin1n1n2nRP);
413  
414  //f4PerEtaBin1n1n1n1nRP
415  f4PerEtaBin1n1n1n1nRP = new TProfile("f4PerEtaBin1n1n1n1nRP","<4'>_{n,n|n,n}",fnBinsEta,fEtaMin,fEtaMax,"s");
416  f4PerEtaBin1n1n1n1nRP->SetXTitle("#eta");
417  //f4PerEtaBin1n1n1n1nRP->SetYTitle("<4'>_{n,n|n,n}");
418  fHistList->Add(f4PerEtaBin1n1n1n1nRP);
419  
420  //fPtReq1nPrimePOI
421  fPtReq1nPrimePOI = new TProfile("fPtReq1nPrimePOI","Re[q_{n}^{'}]",fnBinsPt,fPtMin,fPtMax,"s");
422  fPtReq1nPrimePOI->SetXTitle("p_{t} [GeV]");
423  fPtReq1nPrimePOI->SetYTitle("Re[q_{n}^{'}]");
424  //fHistList->Add(fPtReq1nPrimePOI);
425  
426  //fPtImq1nPrimePOI
427  fPtImq1nPrimePOI = new TProfile("fPtImq1nPrimePOI","Im[q_{n}^{'}]",fnBinsPt,fPtMin,fPtMax,"s");
428  fPtImq1nPrimePOI->SetXTitle("p_{t} [GeV]");
429  fPtImq1nPrimePOI->SetYTitle("Im[q_{n}^{'}]");
430  //fHistList->Add(fPtImq1nPrimePOI);
431  
432  //fPtReq2nPrimePOI
433  fPtReq2nPrimePOI = new TProfile("fPtReq2nPrimePOI","Re[q_{2n}^{'}]",fnBinsPt,fPtMin,fPtMax,"s");
434  fPtReq2nPrimePOI->SetXTitle("p_{t} [GeV]");
435  fPtReq2nPrimePOI->SetYTitle("Re[q_{2n}^{'}]");
436  //fHistList->Add(fPtReq2nPrimePOI);
437  
438  //fPtImq2nPrimePOI
439  fPtImq2nPrimePOI = new TProfile("fPtImq2nPrimePOI","Im[q_{2n}^{'}]",fnBinsPt,fPtMin,fPtMax,"s");
440  fPtImq2nPrimePOI->SetXTitle("p_{t} [GeV]");
441  fPtImq2nPrimePOI->SetYTitle("Im[q_{2n}^{'}]");
442  //fHistList->Add(fPtImq2nPrimePOI);
443  
444  //fmPrimePerPtBin
445  fmPrimePerPtBin = new TProfile("fmPrimePerPtBin","# of particles selected both as RP and POI per #p_{t} bin",fnBinsPt,fPtMin,fPtMax,"s");
446  fmPrimePerPtBin->SetXTitle("p_{t} [GeV]");
447  fmPrimePerPtBin->SetYTitle("Counts");
448  //fHistList->Add(fOverlapPerPtBin);
449  
450  //fPtReq1nPrimePrimePOI
451  fPtReq1nPrimePrimePOI = new TProfile("fPtReq1nPrimePrimePOI","Re[q_{n}^{''}]",fnBinsPt,fPtMin,fPtMax,"s");
452  fPtReq1nPrimePrimePOI->SetXTitle("p_{t} [GeV]");
453  fPtReq1nPrimePrimePOI->SetYTitle("Re[q_{n}^{''}]");
454  //fHistList->Add(fPtReq1nPrimePrimePOI);
455  
456  //fPtImq1nPrimePrimePOI
457  fPtImq1nPrimePrimePOI = new TProfile("fPtImq1nPrimePrimePOI","Im[q_{n}^{''}]",fnBinsPt,fPtMin,fPtMax,"s");
458  fPtImq1nPrimePrimePOI->SetXTitle("p_{t} [GeV]");
459  fPtImq1nPrimePrimePOI->SetYTitle("Im[q_{n}^{''}]");
460  //fHistList->Add(fPtImq1nPrimePrimePOI);
461  
462  //fPtReq2nPrimePrimePOI
463  fPtReq2nPrimePrimePOI = new TProfile("fPtReq2nPrimePrimePOI","Re[q_{2n}^{''}]",fnBinsPt,fPtMin,fPtMax,"s");
464  fPtReq2nPrimePrimePOI->SetXTitle("p_{t} [GeV]");
465  fPtReq2nPrimePrimePOI->SetYTitle("Re[q_{2n}^{''}]");
466  //fHistList->Add(fPtReq2nPrimePrimePOI);
467  
468  //fPtImq2nPrimePrimePOI
469  fPtImq2nPrimePrimePOI = new TProfile("fPtImq2nPrimePrimePOI","Im[q_{2n}^{''}]",fnBinsPt,fPtMin,fPtMax,"s");
470  fPtImq2nPrimePrimePOI->SetXTitle("p_{t} [GeV]");
471  fPtImq2nPrimePrimePOI->SetYTitle("Im[q_{2n}^{''}]");
472  //fHistList->Add(fPtImq2nPrimePrimePOI);
473  
474  //fmPrimePrimePerPtBin
475  fmPrimePrimePerPtBin = new TProfile("fmPrimePrimePerPtBin","# of particles selected as POI and NOT as RP per #p_{t} bin",fnBinsPt,fPtMin,fPtMax,"s");
476  fmPrimePrimePerPtBin->SetXTitle("p_{t} [GeV]");
477  fmPrimePrimePerPtBin->SetYTitle("Counts");
478  //fHistList->Add(fmPrimePrimePerPtBin);
479  
480  //fEtaReq1nPrimePOI
481  fEtaReq1nPrimePOI = new TProfile("fEtaReq1nPrimePOI","Re[q_{n}^{'}]",fnBinsEta,fEtaMin,fEtaMax,"s");
482  fEtaReq1nPrimePOI->SetXTitle("#eta");
483  fEtaReq1nPrimePOI->SetYTitle("Re[q_{n}^{'}]");
484  //fHistList->Add(fEtaReq1nPrimePOI);
485  
486  //fEtaImq1nPrimePOI
487  fEtaImq1nPrimePOI = new TProfile("fEtaImq1nPrimePOI","Im[q_{n}^{'}]",fnBinsEta,fEtaMin,fEtaMax,"s");
488  fEtaImq1nPrimePOI->SetXTitle("#eta");
489  fEtaImq1nPrimePOI->SetYTitle("Im[q_{n}^{'}]");
490  //fHistList->Add(fEtaImq1nPrimePOI);
491  
492  //fEtaReq2nPrimePOI
493  fEtaReq2nPrimePOI = new TProfile("fEtaReq2nPrimePOI","Re[q_{2n}^{'}]",fnBinsEta,fEtaMin,fEtaMax,"s");
494  fEtaReq2nPrimePOI->SetXTitle("#eta");
495  fEtaReq2nPrimePOI->SetYTitle("Re[q_{2n}^{'}]");
496  //fHistList->Add(fEtaReq2nPrimePOI);
497  
498  //fEtaImq2nPrimePOI
499  fEtaImq2nPrimePOI = new TProfile("fEtaImq2nPrimePOI","Im[q_{2n}^{'}]",fnBinsEta,fEtaMin,fEtaMax,"s");
500  fEtaImq2nPrimePOI->SetXTitle("#eta");
501  fEtaImq2nPrimePOI->SetYTitle("Im[q_{2n}^{'}]");
502  //fHistList->Add(fEtaImq2nPrimePOI);
503  
504  //fmPrimePerEtaBin
505  fmPrimePerEtaBin = new TProfile("fmPrimePerEtaBin","# of particles selected both as RP and POI per #p_{t} bin",fnBinsEta,fEtaMin,fEtaMax,"s");
506  fmPrimePerEtaBin->SetXTitle("#eta");
507  fmPrimePerEtaBin->SetYTitle("Counts");
508  //fHistList->Add(fOverlapPerEtaBin);
509  
510  //fEtaReq1nPrimePrimePOIafvQvector1n=anEvent->GetQ(1*n
511  fEtaReq1nPrimePrimePOI = new TProfile("fEtaReq1nPrimePrimePOI","Re[q_{n}^{''}]",fnBinsEta,fEtaMin,fEtaMax,"s");
512  fEtaReq1nPrimePrimePOI->SetXTitle("#eta");
513  fEtaReq1nPrimePrimePOI->SetYTitle("Re[q_{n}^{''}]");
514  //fHistList->Add(fEtaReq1nPrimePrimePOI);
515  
516  //fEtaImq1nPrimePrimePOI
517  fEtaImq1nPrimePrimePOI = new TProfile("fEtaImq1nPrimePrimePOI","Im[q_{n}^{''}]",fnBinsEta,fEtaMin,fEtaMax,"s");
518  fEtaImq1nPrimePrimePOI->SetXTitle("#eta");
519  fEtaImq1nPrimePrimePOI->SetYTitle("Im[q_{n}^{''}]");
520  //fHistList->Add(fEtaImq1nPrimePrimePOI);
521  
522  //fEtaReq2nPrimePrimePOI
523  fEtaReq2nPrimePrimePOI = new TProfile("fEtaReq2nPrimePrimePOI","Re[q_{2n}^{''}]",fnBinsEta,fEtaMin,fEtaMax,"s");
524  fEtaReq2nPrimePrimePOI->SetXTitle("#eta");
525  fEtaReq2nPrimePrimePOI->SetYTitle("Re[q_{2n}^{''}]");
526  //fHistList->Add(fEtaReq2nPrimePrimePOI);
527  
528  //fEtaImq2nPrimePrimePOI
529  fEtaImq2nPrimePrimePOI = new TProfile("fEtaImq2nPrimePrimePOI","Im[q_{2n}^{''}]",fnBinsEta,fEtaMin,fEtaMax,"s");
530  fEtaImq2nPrimePrimePOI->SetXTitle("#eta");
531  fEtaImq2nPrimePrimePOI->SetYTitle("Im[q_{2n}^{''}]");
532  //fHistList->Add(fEtaImq2nPrimePrimePOI);
533  
534  //fmPrimePrimePerEtaBin
535  fmPrimePrimePerEtaBin = new TProfile("fmPrimePrimePerEtaBin","# of particles selected as POI and NOT as RP per #p_{t} bin",fnBinsEta,fEtaMin,fEtaMax,"s");
536  fmPrimePrimePerEtaBin->SetXTitle("#eta");
537  fmPrimePrimePerEtaBin->SetYTitle("Counts");
538  //fHistList->Add(fmPrimePrimePerEtaBin);
539
540  //f2PerPtBin1n1nPOI
541  f2PerPtBin1n1nPOI = new TProfile("f2PerPtBin1n1nPOI","<2'>_{n|n}",fnBinsPt,fPtMin,fPtMax,"s");
542  f2PerPtBin1n1nPOI->SetXTitle("#eta");
543  //f2PerPtBin1n1n->SetYTitle("<2'>_{n|n}");
544  fHistList->Add(f2PerPtBin1n1nPOI);
545  
546  //f2PerPtBin2n2nPOI
547  f2PerPtBin2n2nPOI = new TProfile("f2PerPtBin2n2nPOI","<2'>_{2n|2n}",fnBinsPt,fPtMin,fPtMax,"s");
548  f2PerPtBin2n2nPOI->SetXTitle("p_{t} [GeV]");
549  //f2PerPtBin2n2nPOI->SetYTitle("<2'>_{2n|2n}");
550  fHistList->Add(f2PerPtBin2n2nPOI);
551  
552  //f3PerPtBin2n1n1nPOI
553  f3PerPtBin2n1n1nPOI = new TProfile("f3PerPtBin2n1n1nPOI","<3'>_{2n|n,n}",fnBinsPt,fPtMin,fPtMax,"s");
554  f3PerPtBin2n1n1nPOI->SetXTitle("p_{t} [GeV]");
555  //f3PerPtBin2n1n1nPOI->SetYTitle("<3'>_{2n|n,n}");
556  fHistList->Add(f3PerPtBin2n1n1nPOI);
557  
558  //f3PerPtBin1n1n2nPOI
559  f3PerPtBin1n1n2nPOI = new TProfile("f3PerPtBin1n1n2nPOI","<3'>_{n,n|2n}",fnBinsPt,fPtMin,fPtMax,"s");
560  f3PerPtBin1n1n2nPOI->SetXTitle("p_{t} [GeV]");
561  //f3PerPtBin1n1n2nPOI->SetYTitle("<3'>_{n,n|2n}");
562  fHistList->Add(f3PerPtBin1n1n2nPOI);
563  
564  //f4PerPtBin1n1n1n1nPOI
565  f4PerPtBin1n1n1n1nPOI = new TProfile("f4PerPtBin1n1n1n1nPOI","<4'>_{n,n|n,n}",fnBinsPt,fPtMin,fPtMax,"s");
566  f4PerPtBin1n1n1n1nPOI->SetXTitle("p_{t} [GeV]");
567  //f4PerPtBin1n1n1n1nPOI->SetYTitle("<4'>_{n,n|n,n}");
568  fHistList->Add(f4PerPtBin1n1n1n1nPOI);
569  
570  //f2PerEtaBin1n1nPOI
571  f2PerEtaBin1n1nPOI = new TProfile("f2PerEtaBin1n1nPOI","<2'>_{n|n}",fnBinsEta,fEtaMin,fEtaMax,"s");
572  f2PerEtaBin1n1nPOI->SetXTitle("#eta");
573  //f2PerEtaBin1n1nPOI->SetYTitle("<2'>_{n|n}");
574  fHistList->Add(f2PerEtaBin1n1nPOI);
575  
576  //f2PerEtaBin2n2nPOI
577  f2PerEtaBin2n2nPOI = new TProfile("f2PerEtaBin2n2nPOI","<2'>_{2n|2n}",fnBinsEta,fEtaMin,fEtaMax,"s");
578  f2PerEtaBin2n2nPOI->SetXTitle("#eta");
579  //f2PerEtaBin2n2nPOI->SetYTitle("<2'>_{2n|2n}");
580  fHistList->Add(f2PerEtaBin2n2nPOI);
581  
582  //f3PerEtaBin2n1n1nPOI
583  f3PerEtaBin2n1n1nPOI = new TProfile("f3PerEtaBin2n1n1nPOI","<3'>_{2n|n,n}",fnBinsEta,fEtaMin,fEtaMax,"s");
584  f3PerEtaBin2n1n1nPOI->SetXTitle("#eta");
585  //f3PerEtaBin2n1n1nPOI->SetYTitle("<3'>_{2n|n,n}");
586  fHistList->Add(f3PerEtaBin2n1n1nPOI);
587  
588  //f3PerEtaBin1n1n2nPOI
589  f3PerEtaBin1n1n2nPOI = new TProfile("f3PerEtaBin1n1n2POI","<3'>_{n,n|2n}",fnBinsEta,fEtaMin,fEtaMax,"s");
590  f3PerEtaBin1n1n2nPOI->SetXTitle("#eta");
591  //f3PerEtaBin1n1n2n->SetYTitle("<3'>_{n,n|2n}");
592  fHistList->Add(f3PerEtaBin1n1n2nPOI);
593  
594  //f4PerEtaBin1n1n1n1nPOI
595  f4PerEtaBin1n1n1n1nPOI = new TProfile("f4PerEtaBin1n1n1n1nPOI","<4'>_{n,n|n,n}",fnBinsEta,fEtaMin,fEtaMax,"s");
596  f4PerEtaBin1n1n1n1nPOI->SetXTitle("#eta");
597  //f4PerEtaBin1n1n1n1nPOI->SetYTitle("<4'>_{n,n|n,n}");
598  fHistList->Add(f4PerEtaBin1n1n1n1nPOI);
599  
600  //common control histogram (2nd order)
601  fCommonHists2nd = new AliFlowCommonHist("AliFlowCommonHist2ndOrderQC");
602  fHistList->Add(fCommonHists2nd);  
603  
604  //common control histogram (4th order)
605  fCommonHists4th = new AliFlowCommonHist("AliFlowCommonHist4thOrderQC");
606  fHistList->Add(fCommonHists4th);  
607  
608  //common control histogram (6th order)
609  fCommonHists6th = new AliFlowCommonHist("AliFlowCommonHist6thOrderQC");
610  fHistList->Add(fCommonHists6th);  
611  
612  //common control histogram (8th order)
613  fCommonHists8th = new AliFlowCommonHist("AliFlowCommonHist8thOrderQC");
614  fHistList->Add(fCommonHists8th);  
615   
616  //common histograms for final results (2nd order)
617  fCommonHistsResults2nd = new AliFlowCommonHistResults("AliFlowCommonHistResults2ndOrderQC");
618  fHistList->Add(fCommonHistsResults2nd); 
619  
620  //common histograms for final results (4th order)
621  fCommonHistsResults4th = new AliFlowCommonHistResults("AliFlowCommonHistResults4thOrderQC");
622  fHistList->Add(fCommonHistsResults4th);
623  
624  //common histograms for final results (6th order)
625  fCommonHistsResults6th = new AliFlowCommonHistResults("AliFlowCommonHistResults6thOrderQC");
626  fHistList->Add(fCommonHistsResults6th); 
627  
628  //common histograms for final results (8th order)
629  fCommonHistsResults8th = new AliFlowCommonHistResults("AliFlowCommonHistResults8thOrderQC");
630  fHistList->Add(fCommonHistsResults8th); 
631  
632  //weighted <2>_{n|n} distribution
633  f2pDistribution = new TH1D("f2pDistribution","<2>_{n|n} distribution",100000,-0.02,0.1);
634  f2pDistribution->SetXTitle("<2>_{n|n}");
635  f2pDistribution->SetYTitle("Counts");
636  fHistList->Add(f2pDistribution);
637
638  //weighted <4>_{n,n|n,n} distribution
639  f4pDistribution = new TH1D("f4pDistribution","<4>_{n,n|n,n} distribution",100000,-0.00025,0.002);
640  f4pDistribution->SetXTitle("<4>_{n,n|n,n}");
641  f4pDistribution->SetYTitle("Counts");
642  fHistList->Add(f4pDistribution); 
643  
644  //weighted <6>_{n,n,n|n,n,n} distribution
645  f6pDistribution = new TH1D("f6pDistribution","<6>_{n,n,n|n,n,n} distribution",100000,-0.000005,0.000025);
646  f6pDistribution->SetXTitle("<6>_{n,n,n|n,n,n}");
647  f6pDistribution->SetYTitle("Counts");
648  fHistList->Add(f6pDistribution);
649  
650  //weighted <8>_{n,n,n,n|n,n,n,n} distribution
651  f8pDistribution = new TH1D("f8pDistribution","<8>_{n,n,n,n|n,n,n,n} distribution",100000,-0.000000001,0.00000001);
652  f8pDistribution->SetXTitle("<8>_{n,n,n,n|n,n,n,n}");
653  f8pDistribution->SetYTitle("Counts");
654  fHistList->Add(f8pDistribution);
655 }//end of Init()
656
657 //================================================================================================================
658
659 void AliFlowAnalysisWithQCumulants::Make(AliFlowEventSimple* anEvent)
660 {
661  //running over data 
662  
663  //get the total multiplicity nPrim of event:
664  Int_t nPrim = anEvent->NumberOfTracks();//nPrim = RPs + POIs + rest  
665
666  //needed for debugging: (to be improved - add explanation here) 
667  //Bool_t bNestedLoops=kTRUE;
668  //if(!(bNestedLoops)||(nPrim>0&&nPrim<12))
669  //{
670  //if(nPrim>0&&nPrim<12)
671  //{
672  Int_t n=2;//int flow harmonic (to be improved)
673  
674  //---------------------------------------------------------------------------------------------------------
675  //Q-vectors of an event evaluated in harmonics n, 2n, 3n and 4n from RP particles:
676  AliFlowVector afvQvector1n, afvQvector2n, afvQvector3n, afvQvector4n;
677  
678  afvQvector1n.Set(0.,0.);
679  afvQvector1n.SetMult(0);
680  afvQvector1n=anEvent->GetQ(1*n,fWeightsList,fUsePhiWeights,fUsePtWeights,fUseEtaWeights);
681  
682  afvQvector2n.Set(0.,0.);
683  afvQvector2n.SetMult(0);
684  afvQvector2n=anEvent->GetQ(2*n,fWeightsList,fUsePhiWeights,fUsePtWeights,fUseEtaWeights);
685                                             
686  afvQvector3n.Set(0.,0.);
687  afvQvector3n.SetMult(0);
688  afvQvector3n=anEvent->GetQ(3*n,fWeightsList,fUsePhiWeights,fUsePtWeights,fUseEtaWeights); 
689  
690  afvQvector4n.Set(0.,0.);
691  afvQvector4n.SetMult(0);
692  afvQvector4n=anEvent->GetQ(4*n,fWeightsList,fUsePhiWeights,fUsePtWeights,fUseEtaWeights);
693
694             
695             
696  //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
697  //                        !!!! to be removed !!!!
698  fQvectorForEachEventX->Fill(1.*(++fEventCounter),afvQvector1n.X());
699  fQvectorForEachEventY->Fill(1.*(fEventCounter),afvQvector1n.Y()); 
700  //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
701                        
702                                   
703                                                         
704  //---------------------------------------------------------------------------------------------------------
705  
706  //multiplicity of RP particles:
707  Double_t dMult = afvQvector1n.GetMult();
708  
709  fAvMultIntFlowQC->Fill(0.,dMult,1.);//to be removed (this info is also stored in one of control histograms)
710  
711  //---------------------------------------------------------------------------------------------------------
712  //
713  //                                          *******************
714  //                                          **** Q-vectors ****
715  //                                          *******************
716  //
717  Double_t reQ2nQ1nstarQ1nstar = pow(afvQvector1n.X(),2.)*afvQvector2n.X()+2.*afvQvector1n.X()*afvQvector1n.Y()*afvQvector2n.Y()-pow(afvQvector1n.Y(),2.)*afvQvector2n.X();//Re[Q_{2n} Q_{n}^* Q_{n}^*]
718  //Double_t imQ2nQ1nstarQ1nstar = pow(Qvector1n.X(),2.)*Qvector2n.Y()-2.*Qvector1n.X()*Qvector1n.Y()*Qvector2n.X()-pow(Qvector1n.Y(),2.)*Qvector2n.Y();//Im[Q_{2n} Q_{n}^* Q_{n}^*]
719  Double_t reQ1nQ1nQ2nstar = reQ2nQ1nstarQ1nstar;//Re[Q_{n} Q_{n} Q_{2n}^*] = Re[Q_{2n} Q_{n}^* Q_{n}^*]
720  Double_t reQ3nQ1nQ2nstarQ2nstar = (pow(afvQvector2n.X(),2.)-pow(afvQvector2n.Y(),2.))*(afvQvector3n.X()*afvQvector1n.X()-afvQvector3n.Y()*afvQvector1n.Y())+2.*afvQvector2n.X()*afvQvector2n.Y()*(afvQvector3n.X()*afvQvector1n.Y()+afvQvector3n.Y()*afvQvector1n.X());
721  //Double_t imQ3nQ1nQ2nstarQ2nstar = calculate and implement this (deleteMe) 
722  Double_t reQ2nQ2nQ3nstarQ1nstar = reQ3nQ1nQ2nstarQ2nstar;
723  Double_t reQ4nQ2nstarQ2nstar = pow(afvQvector2n.X(),2.)*afvQvector4n.X()+2.*afvQvector2n.X()*afvQvector2n.Y()*afvQvector4n.Y()-pow(afvQvector2n.Y(),2.)*afvQvector4n.X();//Re[Q_{4n} Q_{2n}^* Q_{2n}^*]
724  //Double_t imQ4nQ2nstarQ2nstar = calculate and implement this (deleteMe)
725  Double_t reQ2nQ2nQ4nstar = reQ4nQ2nstarQ2nstar;
726  Double_t reQ4nQ3nstarQ1nstar = afvQvector4n.X()*(afvQvector3n.X()*afvQvector1n.X()-afvQvector3n.Y()*afvQvector1n.Y())+afvQvector4n.Y()*(afvQvector3n.X()*afvQvector1n.Y()+afvQvector3n.Y()*afvQvector1n.X());//Re[Q_{4n} Q_{3n}^* Q_{n}^*]
727  Double_t reQ3nQ1nQ4nstar = reQ4nQ3nstarQ1nstar;//Re[Q_{3n} Q_{n} Q_{4n}^*] = Re[Q_{4n} Q_{3n}^* Q_{n}^*]
728  //Double_t imQ4nQ3nstarQ1nstar = calculate and implement this (deleteMe)
729  Double_t reQ3nQ2nstarQ1nstar = afvQvector3n.X()*afvQvector2n.X()*afvQvector1n.X()-afvQvector3n.X()*afvQvector2n.Y()*afvQvector1n.Y()+afvQvector3n.Y()*afvQvector2n.X()*afvQvector1n.Y()+afvQvector3n.Y()*afvQvector2n.Y()*afvQvector1n.X();//Re[Q_{3n} Q_{2n}^* Q_{n}^*]
730  Double_t reQ2nQ1nQ3nstar = reQ3nQ2nstarQ1nstar;//Re[Q_{2n} Q_{n} Q_{3n}^*] = Re[Q_{3n} Q_{2n}^* Q_{n}^*]
731  //Double_t imQ3nQ2nstarQ1nstar; //calculate and implement this (deleteMe)
732  Double_t reQ3nQ1nstarQ1nstarQ1nstar = afvQvector3n.X()*pow(afvQvector1n.X(),3)-3.*afvQvector1n.X()*afvQvector3n.X()*pow(afvQvector1n.Y(),2)+3.*afvQvector1n.Y()*afvQvector3n.Y()*pow(afvQvector1n.X(),2)-afvQvector3n.Y()*pow(afvQvector1n.Y(),3);//Re[Q_{3n} Q_{n}^* Q_{n}^* Q_{n}^*]
733  //Double_t imQ3nQ1nstarQ1nstarQ1nstar; //calculate and implement this (deleteMe)
734  Double_t xQ2nQ1nQ2nstarQ1nstar = pow(afvQvector2n.Mod()*afvQvector1n.Mod(),2);//|Q_{2n}|^2 |Q_{n}|^2
735  Double_t reQ4nQ2nstarQ1nstarQ1nstar = (afvQvector4n.X()*afvQvector2n.X()+afvQvector4n.Y()*afvQvector2n.Y())*(pow(afvQvector1n.X(),2)-pow(afvQvector1n.Y(),2))+2.*afvQvector1n.X()*afvQvector1n.Y()*(afvQvector4n.Y()*afvQvector2n.X()-afvQvector4n.X()*afvQvector2n.Y());//Re[Q_{4n} Q_{2n}^* Q_{n}^* Q_{n}^*] 
736  //Double_t imQ4nQ2nstarQ1nstarQ1nstar; //calculate and implement this (deleteMe)
737  Double_t reQ2nQ1nQ1nstarQ1nstarQ1nstar = (afvQvector2n.X()*afvQvector1n.X()-afvQvector2n.Y()*afvQvector1n.Y())*(pow(afvQvector1n.X(),3)-3.*afvQvector1n.X()*pow(afvQvector1n.Y(),2))+(afvQvector2n.X()*afvQvector1n.Y()+afvQvector1n.X()*afvQvector2n.Y())*(3.*afvQvector1n.Y()*pow(afvQvector1n.X(),2)-pow(afvQvector1n.Y(),3));//Re[Q_{2n} Q_{n} Q_{n}^* Q_{n}^* Q_{n}^*]
738  //Double_t imQ2nQ1nQ1nstarQ1nstarQ1nstar; //calculate and implement this (deleteMe)
739  Double_t reQ2nQ2nQ2nstarQ1nstarQ1nstar = pow(afvQvector2n.Mod(),2.)*(afvQvector2n.X()*(pow(afvQvector1n.X(),2.)-pow(afvQvector1n.Y(),2.))+2.*afvQvector2n.Y()*afvQvector1n.X()*afvQvector1n.Y());//Re[Q_{2n} Q_{2n} Q_{2n}^* Q_{n}^* Q_{n}^*]
740  //Double_t imQ2nQ2nQ2nstarQ1nstarQ1nstar = pow(Qvector2n.Mod(),2.)*(Qvector2n.Y()*(pow(Qvector1n.X(),2.)-pow(Qvector1n.Y(),2.))-2.*Qvector2n.X()*Qvector1n.X()*Qvector1n.Y());//Im[Q_{2n} Q_{2n} Q_{2n}^* Q_{n}^* Q_{n}^*]
741  Double_t reQ4nQ1nstarQ1nstarQ1nstarQ1nstar = pow(afvQvector1n.X(),4.)*afvQvector4n.X()-6.*pow(afvQvector1n.X(),2.)*afvQvector4n.X()*pow(afvQvector1n.Y(),2.)+pow(afvQvector1n.Y(),4.)*afvQvector4n.X()+4.*pow(afvQvector1n.X(),3.)*afvQvector1n.Y()*afvQvector4n.Y()-4.*pow(afvQvector1n.Y(),3.)*afvQvector1n.X()*afvQvector4n.Y();//Re[Q_{4n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]
742  //Double_t imQ4nQ1nstarQ1nstarQ1nstarQ1nstar = pow(Qvector1n.X(),4.)*Qvector4n.Y()-6.*pow(Qvector1n.X(),2.)*Qvector4n.Y()*pow(Qvector1n.Y(),2.)+pow(Qvector1n.Y(),4.)*Qvector4n.Y()+4.*pow(Qvector1n.Y(),3.)*Qvector1n.X()*Qvector4n.X()-4.*pow(Qvector1n.X(),3.)*Qvector1n.Y()*Qvector4n.X();//Im[Q_{4n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]
743  Double_t reQ3nQ1nQ2nstarQ1nstarQ1nstar = pow(afvQvector1n.Mod(),2.)*(afvQvector1n.X()*afvQvector2n.X()*afvQvector3n.X()-afvQvector3n.X()*afvQvector1n.Y()*afvQvector2n.Y()+afvQvector2n.X()*afvQvector1n.Y()*afvQvector3n.Y()+afvQvector1n.X()*afvQvector2n.Y()*afvQvector3n.Y());//Re[Q_{3n} Q_{n} Q_{2n}^* Q_{n}^* Q_{n}^*]
744  //Double_t imQ3nQ1nQ2nstarQ1nstarQ1nstar = pow(afvQvector1n.Mod(),2.)*(-afvQvector2n.X()*afvQvector3n.X()*afvQvector1n.Y()-afvQvector1n.X()*afvQvector3n.X()*afvQvector2n.Y()+afvQvector1n.X()*afvQvector2n.X()*afvQvector3n.Y()-afvQvector1n.Y()*afvQvector2n.Y()*afvQvector3n.Y());//Im[Q_{3n} Q_{n} Q_{2n}^* Q_{n}^* Q_{n}^*]
745  Double_t reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(afvQvector1n.X(),2.)*afvQvector2n.X()-2.*afvQvector1n.X()*afvQvector2n.X()*afvQvector1n.Y()-afvQvector2n.X()*pow(afvQvector1n.Y(),2.)+afvQvector2n.Y()*pow(afvQvector1n.X(),2.)+2.*afvQvector1n.X()*afvQvector1n.Y()*afvQvector2n.Y()-pow(afvQvector1n.Y(),2.)*afvQvector2n.Y())*(pow(afvQvector1n.X(),2.)*afvQvector2n.X()+2.*afvQvector1n.X()*afvQvector2n.X()*afvQvector1n.Y()-afvQvector2n.X()*pow(afvQvector1n.Y(),2.)-afvQvector2n.Y()*pow(afvQvector1n.X(),2.)+2.*afvQvector1n.X()*afvQvector1n.Y()*afvQvector2n.Y()+pow(afvQvector1n.Y(),2.)*afvQvector2n.Y());//Re[Q_{2n} Q_{2n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]
746  //Double_t imQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar = 2.*(pow(afvQvector1n.X(),2.)*afvQvector2n.X()-afvQvector2n.X()*pow(afvQvector1n.Y(),2.)+2.*afvQvector1n.X()*afvQvector1n.Y()*afvQvector2n.Y())*(pow(afvQvector1n.X(),2.)*afvQvector2n.Y()-2.*afvQvector1n.X()*afvQvector1n.Y()*afvQvector2n.X()-pow(afvQvector1n.Y(),2.)*afvQvector2n.Y());//Im[Q_{2n} Q_{2n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]
747  Double_t reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = pow(afvQvector1n.Mod(),2.)*(pow(afvQvector1n.X(),3.)*afvQvector3n.X()-3.*afvQvector1n.X()*afvQvector3n.X()*pow(afvQvector1n.Y(),2.)+3.*pow(afvQvector1n.X(),2.)*afvQvector1n.Y()*afvQvector3n.Y()-pow(afvQvector1n.Y(),3.)*afvQvector3n.Y());//Re[Q_{3n} Q_{n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]
748  //Double_t imQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = pow(afvQvector1n.Mod(),2.)*(pow(afvQvector1n.Y(),3.)*afvQvector3n.X()-3.*afvQvector1n.Y()*afvQvector3n.X()*pow(afvQvector1n.X(),2.)-3.*pow(afvQvector1n.Y(),2.)*afvQvector1n.X()*afvQvector3n.Y()+pow(afvQvector1n.X(),3.)*afvQvector3n.Y());//Im[Q_{3n} Q_{n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]
749  Double_t xQ2nQ1nQ1nQ2nstarQ1nstarQ1nstar = pow(afvQvector2n.Mod(),2.)*pow(afvQvector1n.Mod(),4.);//|Q_{2n}|^2 |Q_{n}|^4
750  Double_t reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = pow(afvQvector1n.Mod(),4.)*(pow(afvQvector1n.X(),2.)*afvQvector2n.X()-afvQvector2n.X()*pow(afvQvector1n.Y(),2.)+2.*afvQvector1n.X()*afvQvector1n.Y()*afvQvector2n.Y());//Re[Q_{2n} Q_{n} Q_{n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]
751  //Double_t imQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = pow(afvQvector1n.Mod(),4.)*(pow(afvQvector1n.X(),2.)*afvQvector2n.Y()-afvQvector2n.Y()*pow(afvQvector1n.Y(),2.)-2.*afvQvector1n.X()*afvQvector2n.X()*afvQvector1n.Y());//Re[Q_{2n} Q_{n} Q_{n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]
752  //---------------------------------------------------------------------------------------------------------
753  
754  //---------------------------------------------------------------------------------------------------------
755  //
756  //                                        **************************************
757  //                                        **** multi-particle correlations: ****
758  //                                        **************************************
759  //
760  // Remark 1: multi-particle correlations calculated with Q-vectors are stored in fQCorrelations.
761  // Remark 2: binning of fQCorrelations is organized as follows: 
762  //
763  // 1st bin: <2>_{n|n} = two1n1n
764  // 2nd bin: <2>_{2n|2n} = two2n2n
765  // 3rd bin: <2>_{3n|3n} = two3n3n
766  // 4th bin: <2>_{4n|4n} = two4n4n
767  // 5th bin: --  EMPTY --
768  // 6th bin: <3>_{2n|n,n} = three2n1n1n
769  // 7th bin: <3>_{3n|2n,n} = three3n2n1n
770  // 8th bin: <3>_{4n|2n,2n} = three4n2n2n
771  // 9th bin: <3>_{4n|3n,n} = three4n3n1n
772  //10th bin: --  EMPTY --
773  //11th bin: <4>_{n,n|n,n} = four1n1n1n1n
774  //12th bin: <4>_{2n,n|2n,n} = four2n1n2n1n
775  //13th bin: <4>_{2n,2n|2n,2n} = four2n2n2n2n
776  //14th bin: <4>_{3n|n,n,n} = four3n1n1n1n
777  //15th bin: <4>_{3n,n|3n,n} = four3n1n3n1n 
778  //16th bin: <4>_{3n,n|2n,2n} = four3n1n2n2n
779  //17th bin: <4>_{4n|2n,n,n} = four4n2n1n1n
780  //18th bin: --  EMPTY --
781  //19th bin: <5>_{2n|n,n,n,n} = five2n1n1n1n1n
782  //20th bin: <5>_{2n,2n|2n,n,n} = five2n2n2n1n1n
783  //21st bin: <5>_{3n,n|2n,n,n} = five3n1n2n1n1n
784  //22nd bin: <5>_{4n|n,n,n,n} = five4n1n1n1n1n  
785  //23rd bin: --  EMPTY --
786  //24th bin: <6>_{n,n,n|n,n,n} = six1n1n1n1n1n1n
787  //25th bin: <6>_{2n,n,n|2n,n,n} = six2n1n1n2n1n1n
788  //26th bin: <6>_{2n,2n|n,n,n,n} = six2n2n1n1n1n1n
789  //27th bin: <6>_{3n,n|n,n,n,n} = six3n1n1n1n1n1n
790  //28th bin: --  EMPTY --
791  //29th bin: <7>_{2n,n,n|n,n,n,n} = seven2n1n1n1n1n1n1n
792  //30th bin: --  EMPTY --
793  //31st bin: <8>_{n,n,n,n|n,n,n,n} = eight1n1n1n1n1n1n1n1n
794
795  
796  // binning of fQProduct (all correlations are evaluated in harmonic n): 
797  // 1st bin: <2>*<4>
798  // 2nd bin: <2>*<6>
799  // 3rd bin: <2>*<8> 
800  // 4th bin: <4>*<6>
801  // 5th bin: <4>*<8>
802  // 6th bin: <6>*<8>
803          
804  //2-particle
805  Double_t two1n1n=0., two2n2n=0., two3n3n=0., two4n4n=0.; 
806  if(dMult>1)
807  {
808   //fill the common control histogram (2nd order):
809   
810   fCommonHists2nd->FillControlHistograms(anEvent); 
811  
812   two1n1n = (pow(afvQvector1n.Mod(),2.)-dMult)/(dMult*(dMult-1.)); //<2>_{n|n}   = <cos(n*(phi1-phi2))>
813   two2n2n = (pow(afvQvector2n.Mod(),2.)-dMult)/(dMult*(dMult-1.)); //<2>_{2n|2n} = <cos(2n*(phi1-phi2))>
814   two3n3n = (pow(afvQvector3n.Mod(),2.)-dMult)/(dMult*(dMult-1.)); //<2>_{3n|3n} = <cos(3n*(phi1-phi2))>
815   two4n4n = (pow(afvQvector4n.Mod(),2.)-dMult)/(dMult*(dMult-1.)); //<2>_{4n|4n} = <cos(4n*(phi1-phi2))>
816     
817   fQCorrelations->Fill(0.,two1n1n,dMult*(dMult-1.)); 
818   fQCorrelations->Fill(1.,two2n2n,dMult*(dMult-1.)); 
819   fQCorrelations->Fill(2.,two3n3n,dMult*(dMult-1.)); 
820   fQCorrelations->Fill(3.,two4n4n,dMult*(dMult-1.)); 
821   
822   f2pDistribution->Fill(two1n1n,dMult*(dMult-1.)); 
823  }
824  
825  //3-particle
826  Double_t three2n1n1n=0., three3n2n1n=0., three4n2n2n=0., three4n3n1n=0.;
827  if(dMult>2)
828  {
829   three2n1n1n = (reQ2nQ1nstarQ1nstar-2.*pow(afvQvector1n.Mod(),2.)-pow(afvQvector2n.Mod(),2.)+2.*dMult)/(dMult*(dMult-1.)*(dMult-2.)); //Re[<3>_{2n|n,n}] = Re[<3>_{n,n|2n}] = <cos(n*(2.*phi1-phi2-phi3))>
830   three3n2n1n = (reQ3nQ2nstarQ1nstar-pow(afvQvector3n.Mod(),2.)-pow(afvQvector2n.Mod(),2.)-pow(afvQvector1n.Mod(),2.)+2.*dMult)/(dMult*(dMult-1.)*(dMult-2.)); //Re[<3>_{3n|2n,n}] = Re[<3>_{2n,n|3n}] = <cos(n*(3.*phi1-2.*phi2-phi3))>
831   three4n2n2n = (reQ4nQ2nstarQ2nstar-2.*pow(afvQvector2n.Mod(),2.)-pow(afvQvector4n.Mod(),2.)+2.*dMult)/(dMult*(dMult-1.)*(dMult-2.)); //Re[<3>_{4n|2n,2n}] = Re[<3>_{2n,2n|4n}] = <cos(n*(4.*phi1-2.*phi2-2.*phi3))>
832   three4n3n1n = (reQ4nQ3nstarQ1nstar-pow(afvQvector4n.Mod(),2.)-pow(afvQvector3n.Mod(),2.)-pow(afvQvector1n.Mod(),2.)+2.*dMult)/(dMult*(dMult-1.)*(dMult-2.)); //Re[<3>_{4n|3n,n}] = Re[<3>_{3n,n|4n}] = <cos(n*(4.*phi1-3.*phi2-phi3))>
833  
834   fQCorrelations->Fill(5.,three2n1n1n,dMult*(dMult-1.)*(dMult-2.)); 
835   fQCorrelations->Fill(6.,three3n2n1n,dMult*(dMult-1.)*(dMult-2.));
836   fQCorrelations->Fill(7.,three4n2n2n,dMult*(dMult-1.)*(dMult-2.)); 
837   fQCorrelations->Fill(8.,three4n3n1n,dMult*(dMult-1.)*(dMult-2.));    
838  }
839  
840  //4-particle
841  Double_t four1n1n1n1n=0., four2n2n2n2n=0., four2n1n2n1n=0., four3n1n1n1n=0., four4n2n1n1n=0., four3n1n2n2n=0., four3n1n3n1n=0.;  
842  if(dMult>3)
843  {
844   //fill the common control histogram (4th order):
845   fCommonHists4th->FillControlHistograms(anEvent); 
846
847   four1n1n1n1n = (2.*dMult*(dMult-3.)+pow(afvQvector1n.Mod(),4.)-4.*(dMult-2.)*pow(afvQvector1n.Mod(),2.)-2.*reQ2nQ1nstarQ1nstar+pow(afvQvector2n.Mod(),2.))/(dMult*(dMult-1)*(dMult-2.)*(dMult-3.));//<4>_{n,n|n,n}
848   four2n2n2n2n = (2.*dMult*(dMult-3.)+pow(afvQvector2n.Mod(),4.)-4.*(dMult-2.)*pow(afvQvector2n.Mod(),2.)-2.*reQ4nQ2nstarQ2nstar+pow(afvQvector4n.Mod(),2.))/(dMult*(dMult-1)*(dMult-2.)*(dMult-3.));//<4>_{2n,2n|2n,2n}
849   four2n1n2n1n = (xQ2nQ1nQ2nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar-2.*reQ2nQ1nstarQ1nstar)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))-((dMult-5.)*pow(afvQvector1n.Mod(),2.)+(dMult-4.)*pow(afvQvector2n.Mod(),2.)-pow(afvQvector3n.Mod(),2.))/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))+(dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));//Re[<4>_{2n,n|2n,n}]
850   four3n1n1n1n = (reQ3nQ1nstarQ1nstarQ1nstar-3.*reQ3nQ2nstarQ1nstar-3.*reQ2nQ1nstarQ1nstar)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))+(2.*pow(afvQvector3n.Mod(),2.)+3.*pow(afvQvector2n.Mod(),2.)+6.*pow(afvQvector1n.Mod(),2.)-6.*dMult)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));//Re[<4>_{3n|n,n,n}]
851   four4n2n1n1n = (reQ4nQ2nstarQ1nstarQ1nstar-2.*reQ4nQ3nstarQ1nstar-reQ4nQ2nstarQ2nstar-2.*reQ3nQ2nstarQ1nstar)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))-(reQ2nQ1nstarQ1nstar-2.*pow(afvQvector4n.Mod(),2.)-2.*pow(afvQvector3n.Mod(),2.)-3.*pow(afvQvector2n.Mod(),2.)-4.*pow(afvQvector1n.Mod(),2.))/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))-(6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));//Re[<4>_{4n|2n,n,n}]
852   four3n1n2n2n = (reQ3nQ1nQ2nstarQ2nstar-reQ4nQ2nstarQ2nstar-reQ3nQ1nQ4nstar-2.*reQ3nQ2nstarQ1nstar)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))-(2.*reQ1nQ1nQ2nstar-pow(afvQvector4n.Mod(),2.)-2.*pow(afvQvector3n.Mod(),2.)-4.*pow(afvQvector2n.Mod(),2.)-4.*pow(afvQvector1n.Mod(),2.))/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))-(6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));//Re[<4>_{3n,n|2n,2n}] 
853   four3n1n3n1n = (pow(afvQvector3n.Mod(),2.)*pow(afvQvector1n.Mod(),2.)-2.*reQ4nQ3nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))+(pow(afvQvector4n.Mod(),2.)-(dMult-4.)*pow(afvQvector3n.Mod(),2.)+pow(afvQvector2n.Mod(),2.)-(dMult-4.)*pow(afvQvector1n.Mod(),2.))/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))+(dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));//<4>_{3n,n|3n,n}
854   //four_3n1n3n1n = Q3nQ1nQ3nstarQ1nstar/(M*(M-1.)*(M-2.)*(M-3.))-(2.*three_3n2n1n+2.*three_4n3n1n)/(M-3.)-(two_4n4n+M*two_3n3n+two_2n2n+M*two_1n1n)/((M-2.)*(M-3.))-M/((M-1.)*(M-2.)*(M-3.));//<4>_{3n,n|3n,n}
855   
856   fQCorrelations->Fill(10.,four1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
857   fQCorrelations->Fill(11.,four2n1n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
858   fQCorrelations->Fill(12.,four2n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
859   fQCorrelations->Fill(13.,four3n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
860   fQCorrelations->Fill(14.,four3n1n3n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
861   fQCorrelations->Fill(15.,four3n1n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
862   fQCorrelations->Fill(16.,four4n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
863   
864   f4pDistribution->Fill(four1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
865   
866   fQProduct->Fill(0.,two1n1n*four1n1n1n1n,dMult*(dMult-1.)*dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
867  }
868
869  //5-particle
870  Double_t five2n1n1n1n1n=0., five2n2n2n1n1n=0., five3n1n2n1n1n=0., five4n1n1n1n1n=0.;
871  if(dMult>4)
872  {
873   five2n1n1n1n1n = (reQ2nQ1nQ1nstarQ1nstarQ1nstar-reQ3nQ1nstarQ1nstarQ1nstar+6.*reQ3nQ2nstarQ1nstar)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))-(reQ2nQ1nQ3nstar+3.*(dMult-6.)*reQ2nQ1nstarQ1nstar+3.*reQ1nQ1nQ2nstar)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))-(2.*pow(afvQvector3n.Mod(),2.)+3.*pow(afvQvector2n.Mod()*afvQvector1n.Mod(),2.)-3.*(dMult-4.)*pow(afvQvector2n.Mod(),2.))/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))-3.*(pow(afvQvector1n.Mod(),4.)-2.*(2*dMult-5.)*pow(afvQvector1n.Mod(),2.)+2.*dMult*(dMult-4.))/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));//Re[<5>_{2n,n|n,n,n}]
874   
875   five2n2n2n1n1n = (reQ2nQ2nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-2.*reQ2nQ2nQ3nstarQ1nstar)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))+2.*(reQ4nQ2nstarQ2nstar+4.*reQ3nQ2nstarQ1nstar+reQ3nQ1nQ4nstar)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))+(reQ2nQ2nQ4nstar-2.*(dMult-5.)*reQ2nQ1nstarQ1nstar+2.*reQ1nQ1nQ2nstar)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))-(2.*pow(afvQvector4n.Mod(),2.)+4.*pow(afvQvector3n.Mod(),2.)+1.*pow(afvQvector2n.Mod(),4.)-2.*(3.*dMult-10.)*pow(afvQvector2n.Mod(),2.))/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))-(4.*pow(afvQvector1n.Mod(),2.)*pow(afvQvector2n.Mod(),2.)-4.*(dMult-5.)*pow(afvQvector1n.Mod(),2.)+4.*dMult*(dMult-6.))/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));//Re[<5>_{2n,2n|2n,n,n}]  
876
877   //five_2n2n2n1n1n = reQ2nQ2nQ2nstarQ1nstarQ1nstar/(M*(M-1.)*(M-2.)*(M-3.)*(M-4.))-(4.*four_2n1n2n1n+2.*four_3n1n2n2n+1.*four_2n2n2n2n+four_4n2n1n1n)/(M-4.)-(2.*three_4n3n1n+three_4n2n2n+three_4n2n2n+2.*three_3n2n1n)/((M-3.)*(M-4.))-(4.*three_3n2n1n+(2.*M-1.)*three_2n1n1n+2.*three_2n1n1n)/((M-3.)*(M-4.))-(two_4n4n+2.*two_3n3n+4.*(M-1.)*two_2n2n+2.*(2.*M-1.)*two_1n1n)/((M-2.)*(M-3.)*(M-4.))-(2.*M-1.)/((M-1.)*(M-2.)*(M-3.)*(M-4.)); //OK! 
878    
879   five4n1n1n1n1n = (reQ4nQ1nstarQ1nstarQ1nstarQ1nstar-6.*reQ4nQ2nstarQ1nstarQ1nstar-4.*reQ3nQ1nstarQ1nstarQ1nstar)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))+(8.*reQ4nQ3nstarQ1nstar+3.*reQ4nQ2nstarQ2nstar+12.*reQ3nQ2nstarQ1nstar+12.*reQ2nQ1nstarQ1nstar)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))-(6.*pow(afvQvector4n.Mod(),2.)+8.*pow(afvQvector3n.Mod(),2.)+12.*pow(afvQvector2n.Mod(),2.)+24.*pow(afvQvector1n.Mod(),2.)-24.*dMult)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));//Re[<5>_{4n|n,n,n,n}] 
880   
881   //five_4n1n1n1n1n = reQ4nQ1nstarQ1nstarQ1nstarQ1nstar/(M*(M-1.)*(M-2.)*(M-3.)*(M-4.)) -  (4.*four_3n1n1n1n+6.*four_4n2n1n1n)/(M-4.)  -  (6.*three_2n1n1n  + 12.*three_3n2n1n + 4.*three_4n3n1n + 3.*three_4n2n2n)/((M-3.)*(M-4.))  -  (4.*two_1n1n + 6.*two_2n2n + 4.*two_3n3n + 1.*two_4n4n)/((M-2.)*(M-3.)*(M-4.)) - 1./((M-1.)*(M-2.)*(M-3.)*(M-4.)); //OK!
882   
883   five3n1n2n1n1n = (reQ3nQ1nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ3nQ1nstarQ1nstarQ1nstar)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))-(reQ3nQ1nQ2nstarQ2nstar-3.*reQ4nQ3nstarQ1nstar-reQ4nQ2nstarQ2nstar)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))-((2.*dMult-13.)*reQ3nQ2nstarQ1nstar-reQ3nQ1nQ4nstar-9.*reQ2nQ1nstarQ1nstar)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))-(2.*reQ1nQ1nQ2nstar+2.*pow(afvQvector4n.Mod(),2.)-2.*(dMult-5.)*pow(afvQvector3n.Mod(),2.)+2.*pow(afvQvector3n.Mod(),2.)*pow(afvQvector1n.Mod(),2.))/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))+(2.*(dMult-6.)*pow(afvQvector2n.Mod(),2.)-2.*pow(afvQvector2n.Mod(),2.)*pow(afvQvector1n.Mod(),2.)-pow(afvQvector1n.Mod(),4.)+2.*(3.*dMult-11.)*pow(afvQvector1n.Mod(),2.))/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))-4.*(dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));//Re[<5>_{3n,n|2n,n,n}] 
884   
885   //five3n1n2n1n1n = reQ3nQ1nQ2nstarQ1nstarQ1nstar/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)) -  (four4n2n1n1n+four1n1n1n1n+four3n1n1n1n+2.*four2n1n2n1n+2.*three3n2n1n+2.*four3n1n3n1n+four3n1n2n2n)/(dMult-4.)  -   (2.*three4n3n1n+three4n2n2n+6.*three3n2n1n+three4n3n1n+2.*three3n2n1n+3.*three2n1n1n+2.*three2n1n1n+4.*two1n1n+2.*two2n2n+2.*two3n3n)/((dMult-3.)*(dMult-4.))  -  (5.*two1n1n + 4.*two2n2n + 3.*two3n3n + 1.*two4n4n + 2.)/((dMult-2.)*(dMult-3.)*(dMult-4.))  - 1./((dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)) ;//Re[<5>_{3n,n|2n,n,n}] //OK!
886   
887   //five3n1n2n1n1n = reQ3nQ1nQ2nstarQ1nstarQ1nstar/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)) -  (four4n2n1n1n+four1n1n1n1n+four3n1n1n1n+2.*four2n1n2n1n+2.*four3n1n3n1n+four3n1n2n2n)/(dMult-4.)  -      (2.*three4n3n1n+three4n2n2n+2.*dMult*three3n2n1n+three4n3n1n+2.*three3n2n1n+3.*three2n1n1n+2.*three2n1n1n)/((dMult-3.)*(dMult-4.))  -  ((4.*dMult-3.)*two1n1n + 2.*dMult*two2n2n + (2.*dMult-1.)*two3n3n + two4n4n)/((dMult-2.)*(dMult-3.)*(dMult-4.))  - (2.*dMult-1.)/((dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)) ;//Re[<5>_{3n,n|2n,n,n}] //OK!
888    
889   fQCorrelations->Fill(18.,five2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
890   fQCorrelations->Fill(19.,five2n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
891   fQCorrelations->Fill(20.,five3n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
892   fQCorrelations->Fill(21.,five4n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
893  }
894
895  //6-particle
896  Double_t six1n1n1n1n1n1n=0., six2n2n1n1n1n1n=0., six3n1n1n1n1n1n=0., six2n1n1n2n1n1n=0.;
897  if(dMult>5)
898  {
899   //fill the common control histogram (6th order):
900   fCommonHists6th->FillControlHistograms(anEvent); 
901  
902   six1n1n1n1n1n1n = (pow(afvQvector1n.Mod(),6.)+9.*xQ2nQ1nQ2nstarQ1nstar-6.*reQ2nQ1nQ1nstarQ1nstarQ1nstar)/(dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-4)*(dMult-5))+4.*(reQ3nQ1nstarQ1nstarQ1nstar-3.*reQ3nQ2nstarQ1nstar)/(dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-4)*(dMult-5))+2.*(9.*(dMult-4.)*reQ2nQ1nstarQ1nstar+2.*pow(afvQvector3n.Mod(),2.))/(dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-4)*(dMult-5))-9.*(pow(afvQvector1n.Mod(),4.)+pow(afvQvector2n.Mod(),2.))/(dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-5))+(18.*pow(afvQvector1n.Mod(),2.))/(dMult*(dMult-1)*(dMult-3)*(dMult-4))-(6.)/((dMult-1)*(dMult-2)*(dMult-3));//<6>_{n,n,n|n,n,n}
903   
904   six2n1n1n2n1n1n = (xQ2nQ1nQ1nQ2nstarQ1nstarQ1nstar-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(2.*five2n2n2n1n1n+4.*five2n1n1n1n1n+4.*five3n1n2n1n1n+4.*four2n1n2n1n+1.*four1n1n1n1n)-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(4.*four1n1n1n1n+4.*two1n1n+2.*three2n1n1n+2.*three2n1n1n+4.*four3n1n1n1n+8.*three2n1n1n+2.*four4n2n1n1n+4.*four2n1n2n1n+2.*two2n2n+8.*four2n1n2n1n+4.*four3n1n3n1n+8.*three3n2n1n+4.*four3n1n2n2n+4.*four1n1n1n1n+4.*four2n1n2n1n+1.*four2n2n2n2n)-dMult*(dMult-1.)*(dMult-2.)*(2.*three2n1n1n+8.*two1n1n+4.*two1n1n+2.+4.*two1n1n+4.*three2n1n1n+2.*two2n2n+4.*three2n1n1n+8.*three3n2n1n+8.*two2n2n+4.*three4n3n1n+4.*two3n3n+4.*three3n2n1n+4.*two1n1n+8.*three2n1n1n+4.*two1n1n+4.*three3n2n1n+4.*three2n1n1n+2.*two2n2n+4.*three3n2n1n+2.*three4n2n2n)-dMult*(dMult-1.)*(4.*two1n1n+4.+4.*two1n1n+2.*two2n2n+1.+4.*two1n1n+4.*two2n2n+4.*two3n3n+   1.+2.*two2n2n+1.*two4n4n)-dMult)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));//<6>_{2n,n,n|2n,n,n}
905  
906   six2n2n1n1n1n1n = (reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(five4n1n1n1n1n+8.*five2n1n1n1n1n+6.*five2n2n2n1n1n)-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(4.*four3n1n1n1n+6.*four4n2n1n1n+12.*three2n1n1n+12.*four1n1n1n1n+24.*four2n1n2n1n+4.*four3n1n2n2n+3.*four2n2n2n2n)-dMult*(dMult-1.)*(dMult-2.)*(6.*three2n1n1n+12.*three3n2n1n+4.*three4n3n1n+3.*three4n2n2n+8.*three2n1n1n+24.*two1n1n+12.*two2n2n+12.*three2n1n1n+8.*three3n2n1n+1.*three4n2n2n)-dMult*(dMult-1.)*(4.*two1n1n+6.*two2n2n+4.*two3n3n+1.*two4n4n+2.*two2n2n+8.*two1n1n+6.)-dMult)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));//<6>_{2n,2n,n|n,n,n}
907    
908   six3n1n1n1n1n1n = (reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(five4n1n1n1n1n+4.*five2n1n1n1n1n+6.*five3n1n2n1n1n+4.*four3n1n1n1n)-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(4.*four3n1n1n1n+6.*four4n2n1n1n+6.*four1n1n1n1n+12.*three2n1n1n+12.*four2n1n2n1n+6.*four3n1n1n1n+12.*three3n2n1n+4.*four3n1n3n1n+3.*four3n1n2n2n)-dMult*(dMult-1.)*(dMult-2.)*(6.*three2n1n1n+12.*three3n2n1n+4.*three4n3n1n+3.*three4n2n2n+4.*two1n1n+12.*two1n1n+6.*three2n1n1n+12.*three2n1n1n+4.*three3n2n1n+12.*two2n2n+4.*three3n2n1n+4.*two3n3n+1.*three4n3n1n+6.*three3n2n1n)-dMult*(dMult-1.)*(4.*two1n1n+6.*two2n2n+4.*two3n3n+1.*two4n4n+1.*two1n1n+4.+6.*two1n1n+4.*two2n2n+1.*two3n3n)-dMult)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));//<6>_{3n,n|n,n,n,n}
909    
910   fQCorrelations->Fill(23.,six1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
911   fQCorrelations->Fill(24.,six2n1n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
912   fQCorrelations->Fill(25.,six2n2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
913   fQCorrelations->Fill(26.,six3n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
914
915   f6pDistribution->Fill(six1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
916   
917   fQProduct->Fill(1.,two1n1n*six1n1n1n1n1n1n,dMult*(dMult-1.)*dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
918   fQProduct->Fill(3.,four1n1n1n1n*six1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
919  }
920  
921  //7-particle
922  Double_t seven2n1n1n1n1n1n1n=0.;
923  if(dMult>6)
924  {
925   seven2n1n1n1n1n1n1n = (reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(2.*six3n1n1n1n1n1n+4.*six1n1n1n1n1n1n+1.*six2n2n1n1n1n1n+6.*six2n1n1n2n1n1n+8.*five2n1n1n1n1n)-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(1.*five4n1n1n1n1n +8.*five2n1n1n1n1n+8.*four3n1n1n1n+12.*five3n1n2n1n1n+4.*five2n1n1n1n1n+3.*five2n2n2n1n1n+6.*five2n2n2n1n1n+6.*four1n1n1n1n+24.*four1n1n1n1n+12.*five2n1n1n1n1n+12.*five2n1n1n1n1n+12.*three2n1n1n+24.*four2n1n2n1n+4.*five3n1n2n1n1n+4.*five2n1n1n1n1n)-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(4.*four3n1n1n1n+6.*four4n2n1n1n+12.*four1n1n1n1n+24.*three2n1n1n+24.*four2n1n2n1n+12.*four3n1n1n1n+24.*three3n2n1n+8.*four3n1n3n1n+6.*four3n1n2n2n+6.*three2n1n1n+12.*four1n1n1n1n+12.*four2n1n2n1n+6.*three2n1n1n+12.*four2n1n2n1n+4.*four3n1n2n2n+3.*four2n2n2n2n+4.*four1n1n1n1n+6.*three2n1n1n+24.*two1n1n+24.*four1n1n1n1n+4.*four3n1n1n1n+24.*two1n1n+24.*three2n1n1n+12.*two2n2n+24.*three2n1n1n+12.*four2n1n2n1n+8.*three3n2n1n+8.*four2n1n2n1n+1.*four4n2n1n1n)-dMult*(dMult-1.)*(dMult-2.)*(6.*three2n1n1n+1.*three2n1n1n+8.*two1n1n+12.*three3n2n1n+24.*two1n1n+12.*three2n1n1n+4.*three2n1n1n+8.*two1n1n+4.*three4n3n1n+24.*three2n1n1n+8.*three3n2n1n+12.*two1n1n+12.*two1n1n+3.*three4n2n2n+24.*two2n2n+6.*two2n2n+12.+12.*three3n2n1n+8.*two3n3n+12.*three2n1n1n+24.*two1n1n+4.*three3n2n1n+8.*three3n2n1n+2.*three4n3n1n+12.*two1n1n+8.*three2n1n1n+4.*three2n1n1n+2.*three3n2n1n+6.*two2n2n+8.*two2n2n+1.*three4n2n2n+4.*three3n2n1n+6.*three2n1n1n)-dMult*(dMult-1.)*(4.*two1n1n+2.*two1n1n+6.*two2n2n+8.+1.*two2n2n+4.*two3n3n+12.*two1n1n+4.*two1n1n+1.*two4n4n+8.*two2n2n+6.+2.*two3n3n+4.*two1n1n+1.*two2n2n)-dMult)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.));
926         
927   fQCorrelations->Fill(28.,seven2n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.));
928  }
929  
930  //8-particle
931  Double_t eight1n1n1n1n1n1n1n1n=0.;
932  if(dMult>7)
933  {
934   //fill the common control histogram (8th order):
935   fCommonHists8th->FillControlHistograms(anEvent); 
936   
937   eight1n1n1n1n1n1n1n1n = (pow(afvQvector1n.Mod(),8)-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(12.*seven2n1n1n1n1n1n1n+16.*six1n1n1n1n1n1n)-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(8.*six3n1n1n1n1n1n+48.*six1n1n1n1n1n1n+6.*six2n2n1n1n1n1n+96.*five2n1n1n1n1n+72.*four1n1n1n1n+36.*six2n1n1n2n1n1n)-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(2.*five4n1n1n1n1n+32.*five2n1n1n1n1n+36.*four1n1n1n1n+32.*four3n1n1n1n+48.*five2n1n1n1n1n+48.*five3n1n2n1n1n+144.*five2n1n1n1n1n+288.*four1n1n1n1n+36.*five2n2n2n1n1n+144.*three2n1n1n+96.*two1n1n+144.*four2n1n2n1n)-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(8.*four3n1n1n1n+48.*four1n1n1n1n+12.*four4n2n1n1n+96.*four2n1n2n1n+96.*three2n1n1n+72.*three2n1n1n+144.*two1n1n+16.*four3n1n3n1n+48.*four3n1n1n1n+144.*four1n1n1n1n+72.*four1n1n1n1n+96.*three3n2n1n+24.*four3n1n2n2n+144.*four2n1n2n1n+288.*two1n1n+288.*three2n1n1n+9.*four2n2n2n2n+72.*two2n2n+24.)-dMult*(dMult-1.)*(dMult-2.)*(12.*three2n1n1n+16.*two1n1n+24.*three3n2n1n+48.*three2n1n1n+96.*two1n1n+8.*three4n3n1n+32.*three3n2n1n+96.*three2n1n1n+144.*two1n1n+6.*three4n2n2n+96.*two2n2n+36.*two2n2n+72.+48.*three3n2n1n+16.*two3n3n+72.*three2n1n1n+144.*two1n1n)-dMult*(dMult-1.)*(8.*two1n1n+12.*two2n2n+16.+8.*two3n3n+48.*two1n1n+1.*two4n4n+16.*two2n2n+18.)-dMult)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));
938   
939   fQCorrelations->Fill(30.,eight1n1n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));
940  
941   f8pDistribution->Fill(eight1n1n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));
942  } 
943  //---------------------------------------------------------------------------------------------------------
944  
945  
946  
947  
948  //--------------------------------------------------------------------------------------------------------- 
949  // DIFFERENTIAL FLOW
950  
951  Double_t dQ1nx = afvQvector1n.X();
952  Double_t dQ1ny = afvQvector1n.Y();
953  Double_t dQ2nx = afvQvector2n.X();
954  Double_t dQ2ny = afvQvector2n.Y();
955  
956  Double_t dBinWidthPt=0.,dBinWidthEta=0.;
957  if(fnBinsPt)
958  { 
959   dBinWidthPt=1.*(fPtMax-fPtMin)/fnBinsPt;
960  } 
961  if(fnBinsEta)
962  {
963   dBinWidthEta=1.*(fEtaMax-fEtaMin)/fnBinsEta;
964  }
965  
966  //RP:
967  Double_t qxPtRP=0.,qyPtRP=0.,q2xPtRP=0.,q2yPtRP=0.,mPtRP=0.;//add comments for these variables (deleteMe)
968  Double_t qxEtaRP=0.,qyEtaRP=0.,q2xEtaRP=0.,q2yEtaRP=0.,mEtaRP=0.;//add comments for these variables (deleteMe)
969   
970  for(Int_t i=0;i<nPrim;i++)//loop over all particles
971  { 
972   fTrack=anEvent->GetTrack(i);
973   if(fTrack && fTrack->UseForIntegratedFlow())//checking RP condition 
974   {
975    //Pt:
976    fPtReq1nRP->Fill(fTrack->Pt(),cos(n*(fTrack->Phi())),1.);
977    fPtImq1nRP->Fill(fTrack->Pt(),sin(n*(fTrack->Phi())),1.);
978    fPtReq2nRP->Fill(fTrack->Pt(),cos(2.*n*(fTrack->Phi())),1.);
979    fPtImq2nRP->Fill(fTrack->Pt(),sin(2.*n*(fTrack->Phi())),1.);
980    //Eta:
981    fEtaReq1nRP->Fill(fTrack->Eta(),cos(n*(fTrack->Phi())),1.);
982    fEtaImq1nRP->Fill(fTrack->Eta(),sin(n*(fTrack->Phi())),1.);
983    fEtaReq2nRP->Fill(fTrack->Eta(),cos(2.*n*(fTrack->Phi())),1.);
984    fEtaImq2nRP->Fill(fTrack->Eta(),sin(2.*n*(fTrack->Phi())),1.);
985   }
986  } 
987   
988  //Pt:
989  Double_t twoDiffPt1n1nRP=0.,twoDiffPt2n2nRP=0.,threeDiffPt2n1n1nRP=0.,threeDiffPt1n1n2nRP=0.,fourDiffPt1n1n1n1nRP=0.;
990  
991  for(Int_t bin=1;bin<(fnBinsPt+1);bin++)//loop over pt-bins 
992  { 
993   qxPtRP = (fPtReq1nRP->GetBinContent(bin))*(fPtReq1nRP->GetBinEntries(bin));
994   qyPtRP = (fPtImq1nRP->GetBinContent(bin))*(fPtImq1nRP->GetBinEntries(bin)); 
995   q2xPtRP = (fPtReq2nRP->GetBinContent(bin))*(fPtReq2nRP->GetBinEntries(bin));  
996   q2yPtRP = (fPtImq2nRP->GetBinContent(bin))*(fPtImq2nRP->GetBinEntries(bin)); 
997   mPtRP = fPtReq1nRP->GetBinEntries(bin);          
998  
999   if(mPtRP>0&&dMult>1)
1000   {
1001    twoDiffPt1n1nRP = (qxPtRP*dQ1nx+qyPtRP*dQ1ny-mPtRP)/(mPtRP*(dMult-1.));
1002    f2PerPtBin1n1nRP->Fill(fPtMin+(bin-1)*dBinWidthPt,twoDiffPt1n1nRP,mPtRP*(dMult-1.));//<2'>_{n|n}
1003    
1004    twoDiffPt2n2nRP = (q2xPtRP*dQ2nx+q2yPtRP*dQ2ny-mPtRP)/(mPtRP*(dMult-1.));
1005    f2PerPtBin2n2nRP->Fill(fPtMin+(bin-1)*dBinWidthPt,twoDiffPt2n2nRP,mPtRP*(dMult-1.));//<2'>_{2n|2n} 
1006   }
1007   
1008   if(mPtRP>0&&dMult>2)
1009   {
1010    threeDiffPt2n1n1nRP = (q2xPtRP*(dQ1nx*dQ1nx-dQ1ny*dQ1ny)+2.*q2yPtRP*dQ1nx*dQ1ny-2.*(qxPtRP*dQ1nx+qyPtRP*dQ1ny)-(q2xPtRP*dQ2nx+q2yPtRP*dQ2ny)+2.*mPtRP)/(mPtRP*(dMult-1.)*(dMult-2.));
1011    f3PerPtBin2n1n1nRP->Fill(fPtMin+(bin-1)*dBinWidthPt,threeDiffPt2n1n1nRP,mPtRP*(dMult-1.)*(dMult-2.));//Re[<3'>_{2n|n,n}]
1012    
1013    threeDiffPt1n1n2nRP = (dQ2nx*(qxPtRP*dQ1nx-qyPtRP*dQ1ny)+dQ2ny*(qxPtRP*dQ1ny+qyPtRP*dQ1nx)-2.*(qxPtRP*dQ1nx+qyPtRP*dQ1ny)-(q2xPtRP*dQ2nx+q2yPtRP*dQ2ny)+2.*mPtRP)/(mPtRP*(dMult-1.)*(dMult-2.));
1014    f3PerPtBin1n1n2nRP->Fill(fPtMin+(bin-1)*dBinWidthPt,threeDiffPt1n1n2nRP,mPtRP*(dMult-1.)*(dMult-2.));//Re[<3'>_{n,n|2n}]
1015   }
1016   
1017   if(mPtRP>0&&dMult>3)
1018   {
1019    fourDiffPt1n1n1n1nRP = ((dQ1nx*dQ1nx+dQ1ny*dQ1ny)*(qxPtRP*dQ1nx+qyPtRP*dQ1ny)-(q2xPtRP*(dQ1nx*dQ1nx-dQ1ny*dQ1ny)+2.*q2yPtRP*dQ1nx*dQ1ny)-(dQ2nx*(qxPtRP*dQ1nx-qyPtRP*dQ1ny)+dQ2ny*(qxPtRP*dQ1ny+qyPtRP*dQ1nx))+(q2xPtRP*dQ2nx+q2yPtRP*dQ2ny)-2.*(dMult-3.)*(qxPtRP*dQ1nx+qyPtRP*dQ1ny)-2.*mPtRP*(dQ1nx*dQ1nx+dQ1ny*dQ1ny)+2.*(dQ1nx*qxPtRP+dQ1ny*qyPtRP)+2.*mPtRP*(dMult-3.))/(mPtRP*(dMult-1.)*(dMult-2.)*(dMult-3.));
1020    f4PerPtBin1n1n1n1nRP->Fill(fPtMin+(bin-1)*dBinWidthPt,fourDiffPt1n1n1n1nRP,mPtRP*(dMult-1.)*(dMult-2.)*(dMult-3.));//Re[<4'>_{n,n|n,n}]
1021   } 
1022  }//end of for(Int_t bin=1;bin<(fnBinsPt+1);bin++)//loop over pt-bins  
1023   
1024  fPtReq1nRP->Reset();
1025  fPtImq1nRP->Reset();
1026  fPtReq2nRP->Reset();
1027  fPtImq2nRP->Reset();
1028  
1029  //Eta:
1030  Double_t twoDiffEta1n1nRP=0.,twoDiffEta2n2nRP=0.,threeDiffEta2n1n1nRP=0.,threeDiffEta1n1n2nRP=0.,fourDiffEta1n1n1n1nRP=0.;
1031  
1032  for(Int_t bin=1;bin<(fnBinsEta+1);bin++)//loop over eta-bins 
1033  { 
1034   qxEtaRP = (fEtaReq1nRP->GetBinContent(bin))*(fEtaReq1nRP->GetBinEntries(bin));
1035   qyEtaRP = (fEtaImq1nRP->GetBinContent(bin))*(fEtaImq1nRP->GetBinEntries(bin)); 
1036   q2xEtaRP = (fEtaReq2nRP->GetBinContent(bin))*(fEtaReq2nRP->GetBinEntries(bin));  
1037   q2yEtaRP = (fEtaImq2nRP->GetBinContent(bin))*(fEtaImq2nRP->GetBinEntries(bin)); 
1038   mEtaRP = fEtaReq1nRP->GetBinEntries(bin); 
1039   
1040   if(mEtaRP>0&&dMult>1)
1041   {
1042    twoDiffEta1n1nRP = (qxEtaRP*dQ1nx+qyEtaRP*dQ1ny-mEtaRP)/(mEtaRP*(dMult-1.));
1043    f2PerEtaBin1n1nRP->Fill(fEtaMin+(bin-1)*dBinWidthEta,twoDiffEta1n1nRP,mEtaRP*(dMult-1.));//<2'>_{n|n}
1044    
1045    twoDiffEta2n2nRP = (q2xEtaRP*dQ2nx+q2yEtaRP*dQ2ny-mEtaRP)/(mEtaRP*(dMult-1.));
1046    f2PerEtaBin2n2nRP->Fill(fEtaMin+(bin-1)*dBinWidthEta,twoDiffEta2n2nRP,mEtaRP*(dMult-1.));//<2'>_{2n|2n} 
1047   }
1048   
1049   if(mEtaRP>0&&dMult>2)
1050   {
1051    threeDiffEta2n1n1nRP = (q2xEtaRP*(dQ1nx*dQ1nx-dQ1ny*dQ1ny)+2.*q2yEtaRP*dQ1nx*dQ1ny-2.*(qxEtaRP*dQ1nx+qyEtaRP*dQ1ny)-(q2xEtaRP*dQ2nx+q2yEtaRP*dQ2ny)+2.*mEtaRP)/(mEtaRP*(dMult-1.)*(dMult-2.));
1052    f3PerEtaBin2n1n1nRP->Fill(fEtaMin+(bin-1)*dBinWidthEta,threeDiffEta2n1n1nRP,mEtaRP*(dMult-1.)*(dMult-2.));//Re[<3'>_{2n|n,n}]
1053    
1054    threeDiffEta1n1n2nRP = (dQ2nx*(qxEtaRP*dQ1nx-qyEtaRP*dQ1ny)+dQ2ny*(qxEtaRP*dQ1ny+qyEtaRP*dQ1nx)-2.*(qxEtaRP*dQ1nx+qyEtaRP*dQ1ny)-(q2xEtaRP*dQ2nx+q2yEtaRP*dQ2ny)+2.*mEtaRP)/(mEtaRP*(dMult-1.)*(dMult-2.));
1055    f3PerEtaBin1n1n2nRP->Fill(fEtaMin+(bin-1)*dBinWidthEta,threeDiffEta1n1n2nRP,mEtaRP*(dMult-1.)*(dMult-2.));//Re[<3'>_{n,n|2n}]
1056   }
1057   
1058   if(mEtaRP>0&&dMult>3)
1059   {
1060    fourDiffEta1n1n1n1nRP = ((dQ1nx*dQ1nx+dQ1ny*dQ1ny)*(qxEtaRP*dQ1nx+qyEtaRP*dQ1ny)-(q2xEtaRP*(dQ1nx*dQ1nx-dQ1ny*dQ1ny)+2.*q2yEtaRP*dQ1nx*dQ1ny)-(dQ2nx*(qxEtaRP*dQ1nx-qyEtaRP*dQ1ny)+dQ2ny*(qxEtaRP*dQ1ny+qyEtaRP*dQ1nx))+(q2xEtaRP*dQ2nx+q2yEtaRP*dQ2ny)-2.*(dMult-3.)*(qxEtaRP*dQ1nx+qyEtaRP*dQ1ny)-2.*mEtaRP*(dQ1nx*dQ1nx+dQ1ny*dQ1ny)+2.*(dQ1nx*qxEtaRP+dQ1ny*qyEtaRP)+2.*mEtaRP*(dMult-3.))/(mEtaRP*(dMult-1.)*(dMult-2.)*(dMult-3.));
1061    f4PerEtaBin1n1n1n1nRP->Fill(fEtaMin+(bin-1)*dBinWidthEta,fourDiffEta1n1n1n1nRP,mEtaRP*(dMult-1.)*(dMult-2.)*(dMult-3.));//Re[<4'>_{n,n|n,n}]
1062   }  
1063  }//end of for(Int_t bin=1;bin<(fnBinsEta+1);bin++)//loop over eta-bins 
1064   
1065  fEtaReq1nRP->Reset();
1066  fEtaImq1nRP->Reset();
1067  fEtaReq2nRP->Reset();
1068  fEtaImq2nRP->Reset();
1069  
1070  //POI:
1071  Double_t qxPrimePtPOI=0.,qyPrimePtPOI=0.,q2xPrimePtPOI=0.,q2yPrimePtPOI=0.,mPrimePtPOI=0.;//add comments for these variables (deleteMe)
1072  Double_t qxPrimePrimePtPOI=0.,qyPrimePrimePtPOI=0.,q2xPrimePrimePtPOI=0.,q2yPrimePrimePtPOI=0.,mPrimePrimePtPOI=0.;//add comments for these variables (deleteMe)
1073  Double_t qxPrimeEtaPOI=0.,qyPrimeEtaPOI=0.,q2xPrimeEtaPOI=0.,q2yPrimeEtaPOI=0.,mPrimeEtaPOI=0.;//add comments for these variables (deleteMe)
1074  Double_t qxPrimePrimeEtaPOI=0.,qyPrimePrimeEtaPOI=0.,q2xPrimePrimeEtaPOI=0.,q2yPrimePrimeEtaPOI=0.,mPrimePrimeEtaPOI=0.;//add comments for the
1075
1076  for(Int_t i=0;i<nPrim;i++)//loop over all particles (to be improved: do the calculations for RPs and POIs in the same loop) 
1077  { 
1078   fTrack=anEvent->GetTrack(i);
1079   if(fTrack)
1080   {
1081    if(fTrack->UseForDifferentialFlow())//checking if particle is POI 
1082    {
1083     if(fTrack->UseForIntegratedFlow())//checking if particle is both POI and RP 
1084     {
1085      //Pt:
1086      fPtReq1nPrimePrimePOI->Fill(fTrack->Pt(),cos(n*(fTrack->Phi())),1.); 
1087      fPtImq1nPrimePrimePOI->Fill(fTrack->Pt(),sin(n*(fTrack->Phi())),1.);
1088      fPtReq2nPrimePrimePOI->Fill(fTrack->Pt(),cos(2.*n*(fTrack->Phi())),1.);
1089      fPtImq2nPrimePrimePOI->Fill(fTrack->Pt(),sin(2.*n*(fTrack->Phi())),1.);
1090      //Eta:
1091      fEtaReq1nPrimePrimePOI->Fill(fTrack->Eta(),cos(n*(fTrack->Phi())),1.); 
1092      fEtaImq1nPrimePrimePOI->Fill(fTrack->Eta(),sin(n*(fTrack->Phi())),1.);
1093      fEtaReq2nPrimePrimePOI->Fill(fTrack->Eta(),cos(2.*n*(fTrack->Phi())),1.);
1094      fEtaImq2nPrimePrimePOI->Fill(fTrack->Eta(),sin(2.*n*(fTrack->Phi())),1.);
1095     }else if(!(fTrack->UseForIntegratedFlow()))//checking if particles is POI and not RP  
1096      {
1097       //Pt:
1098       fPtReq1nPrimePOI->Fill(fTrack->Pt(),cos(n*(fTrack->Phi())),1.); 
1099       fPtImq1nPrimePOI->Fill(fTrack->Pt(),sin(n*(fTrack->Phi())),1.);
1100       fPtReq2nPrimePOI->Fill(fTrack->Pt(),cos(2.*n*(fTrack->Phi())),1.);
1101       fPtImq2nPrimePOI->Fill(fTrack->Pt(),sin(2.*n*(fTrack->Phi())),1.);
1102       //Eta:
1103       fEtaReq1nPrimePOI->Fill(fTrack->Eta(),cos(n*(fTrack->Phi())),1.); 
1104       fEtaImq1nPrimePOI->Fill(fTrack->Eta(),sin(n*(fTrack->Phi())),1.);
1105       fEtaReq2nPrimePOI->Fill(fTrack->Eta(),cos(2.*n*(fTrack->Phi())),1.);
1106       fEtaImq2nPrimePOI->Fill(fTrack->Eta(),sin(2.*n*(fTrack->Phi())),1.);
1107      }//end of else if(!(fTrack->UseForIntegratedFlow()))//checking if particles is POI and not RP 
1108    }//end of if(fTrack->UseForDifferentialFlow())//checking if particle is POI
1109   }//end of if(fTrack}      
1110  }//end of for(Int_t i=0;i<nPrim;i++)        
1111          
1112  //Pt:
1113  //Double_t twoDiffPt1n1nPOI=0.,twoDiffPt2n2nPOI=0.,threeDiffPt2n1n1nPOI=0.,threeDiffPt1n1n2nPOI=0.,fourDiffPt1n1n1n1nPOI=0.;
1114  Double_t twoDiffPt1n1nPOI=0.,twoDiffPt2n2nPOI=0.,fourDiffPt1n1n1n1nPOI=0.;
1115  
1116  for(Int_t bin=1;bin<(fnBinsPt+1);bin++)//loop over pt-bins 
1117  { 
1118   //q'      
1119   qxPrimePtPOI = (fPtReq1nPrimePOI->GetBinContent(bin))*(fPtReq1nPrimePOI->GetBinEntries(bin));
1120   qyPrimePtPOI = (fPtImq1nPrimePOI->GetBinContent(bin))*(fPtImq1nPrimePOI->GetBinEntries(bin)); 
1121   q2xPrimePtPOI = (fPtReq2nPrimePOI->GetBinContent(bin))*(fPtReq2nPrimePOI->GetBinEntries(bin));  
1122   q2yPrimePtPOI = (fPtImq2nPrimePOI->GetBinContent(bin))*(fPtImq2nPrimePOI->GetBinEntries(bin)); 
1123   mPrimePtPOI = fPtReq1nPrimePOI->GetBinEntries(bin);      
1124   //q''                    
1125   qxPrimePrimePtPOI = (fPtReq1nPrimePrimePOI->GetBinContent(bin))*(fPtReq1nPrimePrimePOI->GetBinEntries(bin));
1126   qyPrimePrimePtPOI = (fPtImq1nPrimePrimePOI->GetBinContent(bin))*(fPtImq1nPrimePrimePOI->GetBinEntries(bin)); 
1127   q2xPrimePrimePtPOI = (fPtReq2nPrimePrimePOI->GetBinContent(bin))*(fPtReq2nPrimePrimePOI->GetBinEntries(bin));  
1128   q2yPrimePrimePtPOI = (fPtImq2nPrimePrimePOI->GetBinContent(bin))*(fPtImq2nPrimePrimePOI->GetBinEntries(bin)); 
1129   mPrimePrimePtPOI = fPtReq1nPrimePrimePOI->GetBinEntries(bin);         
1130                    
1131   if((mPrimePtPOI+mPrimePrimePtPOI>0)&&dMult>0&&!(mPrimePrimePtPOI==1&&mPrimePtPOI==0&&dMult==1))//to be improved 
1132   {   
1133    twoDiffPt1n1nPOI = (qxPrimePrimePtPOI*dQ1nx+qyPrimePrimePtPOI*dQ1ny-mPrimePrimePtPOI+qxPrimePtPOI*dQ1nx+qyPrimePtPOI*dQ1ny)/(mPrimePrimePtPOI*(dMult-1)+mPrimePtPOI*dMult);   
1134    f2PerPtBin1n1nPOI->Fill(fPtMin+(bin-1)*dBinWidthPt,twoDiffPt1n1nPOI,mPrimePrimePtPOI*(dMult-1)+mPrimePtPOI*dMult);//<2'>_{n|n}
1135   
1136    twoDiffPt2n2nPOI = (q2xPrimePrimePtPOI*dQ2nx+q2yPrimePrimePtPOI*dQ2ny-mPrimePrimePtPOI+q2xPrimePtPOI*dQ2nx+q2yPrimePtPOI*dQ2ny)/(mPrimePrimePtPOI*(dMult-1)+mPrimePtPOI*dMult);   
1137    f2PerPtBin2n2nPOI->Fill(fPtMin+(bin-1)*dBinWidthPt,twoDiffPt2n2nPOI,mPrimePrimePtPOI*(dMult-1)+mPrimePtPOI*dMult);//<2'>_{2n|2n} 
1138   }//end of if((mPrimePtPOI+mPrimePrimePtPOI>0)&&dMult>0)
1139   
1140   /*
1141   to be improved: correct Eqs. needed here)
1142   if(mPtPOI>0&&dMult>3)
1143   {
1144    threeDiffPt2n1n1nPOI = (q2xPtPOI*(dQ1nx*dQ1nx-dQ1ny*dQ1ny)+2.*q2yPtPOI*dQ1nx*dQ1ny-2.*(qxPtPOI*dQ1nx+qyPtPOI*dQ1ny)-(q2xPtPOI*dQ2nx+q2yPtPOI*dQ2ny)+2.*mPtPOI)/(mPtPOI*(dMult-1.)*(dMult-2.));//to be improved (correct formula needed)
1145    //f3PePOItBin2n1n1nPOI->Fill(fPtMin+(bin-1)*dBinWidthPt,threeDiffPt2n1n1nPOI,mPtPOI*(dMult-1.)*(dMult-2.));//Re[<3'>_{2n|n,n}]
1146    
1147    threeDiffPt1n1n2nPOI = (dQ2nx*(qxPtPOI*dQ1nx-qyPtPOI*dQ1ny)+dQ2ny*(qxPtPOI*dQ1ny+qyPtPOI*dQ1nx)-2.*(qxPtPOI*dQ1nx+qyPtPOI*dQ1ny)-(q2xPtPOI*dQ2nx+q2yPtPOI*dQ2ny)+2.*mPtPOI)/(mPtPOI*(dMult-1.)*(dMult-2.));//to be improved (correct formula needed)
1148    //f3PePOItBin1n1n2nPOI->Fill(fPtMin+(bin-1)*dBinWidthPt,threeDiffPt1n1n2nPOI,mPtPOI*(dMult-1.)*(dMult-2.));//Re[<3'>_{n,n|2n}]
1149   }
1150   */
1151   
1152   //if((mPrimePtPOI+mPrimePrimePtPOI>0)&&dMult>2)//to be improved (dMult>2 or dMult>3)
1153   if(!(mPrimePtPOI==0&&mPrimePrimePtPOI==0)&&!(mPrimePtPOI==0&&(dMult==1||dMult==2||dMult==3))&&!(mPrimePrimePtPOI==0&&(dMult==0||dMult==1||dMult==2)))//to be improved 
1154   {  
1155    fourDiffPt1n1n1n1nPOI=((dQ1nx*dQ1nx+dQ1ny*dQ1ny)*(qxPrimePtPOI*dQ1nx+qyPrimePtPOI*dQ1ny)-2.*(dMult-1)*(qxPrimePtPOI*dQ1nx+qyPrimePtPOI*dQ1ny)-(dQ2nx*(qxPrimePtPOI*dQ1nx-qyPrimePtPOI*dQ1ny)+dQ2ny*(qxPrimePtPOI*dQ1ny+qyPrimePtPOI*dQ1nx))+(dQ1nx*dQ1nx+dQ1ny*dQ1ny)*(qxPrimePrimePtPOI*dQ1nx+qyPrimePrimePtPOI*dQ1ny)-(q2xPrimePrimePtPOI*(dQ1nx*dQ1nx-dQ1ny*dQ1ny)+2.*q2yPrimePrimePtPOI*dQ1nx*dQ1ny)-(dQ2nx*(qxPrimePrimePtPOI*dQ1nx-qyPrimePrimePtPOI*dQ1ny)+dQ2ny*(qxPrimePrimePtPOI*dQ1ny+qyPrimePrimePtPOI*dQ1nx))+(q2xPrimePrimePtPOI*dQ2nx+q2yPrimePrimePtPOI*dQ2ny)-2.*(dMult-3.)*(qxPrimePrimePtPOI*dQ1nx+qyPrimePrimePtPOI*dQ1ny)-2.*mPrimePrimePtPOI*(dQ1nx*dQ1nx+dQ1ny*dQ1ny)+2.*(dQ1nx*qxPrimePrimePtPOI+dQ1ny*qyPrimePrimePtPOI)+2.*mPrimePrimePtPOI*(dMult-3.))/(mPrimePtPOI*dMult*(dMult-1)*(dMult-2)+mPrimePrimePtPOI*(dMult-1)*(dMult-2)*(dMult-3));
1156            
1157    f4PerPtBin1n1n1n1nPOI->Fill(fPtMin+(bin-1)*dBinWidthPt,fourDiffPt1n1n1n1nPOI,mPrimePtPOI*dMult*(dMult-1)*(dMult-2)+mPrimePrimePtPOI*(dMult-1)*(dMult-2)*(dMult-3));//Re[<4'>_{n,n|n,n}]
1158   }//end of if((mPrimePtPOI+mPrimePrimePtPOI>0)&&dMult>2)   
1159  }//end of for(Int_t bin=1;bin<(fnBinsPt+1);bin++)//loop over pt-bins  
1160    
1161  fPtReq1nPrimePOI->Reset();
1162  fPtImq1nPrimePOI->Reset();
1163  fPtReq2nPrimePOI->Reset();
1164  fPtImq2nPrimePOI->Reset();
1165  
1166  fPtReq1nPrimePrimePOI->Reset();
1167  fPtImq1nPrimePrimePOI->Reset();
1168  fPtReq2nPrimePrimePOI->Reset();
1169  fPtImq2nPrimePrimePOI->Reset();
1170
1171  //Eta:
1172  //Double_t twoDiffEta1n1nPOI=0.,twoDiffEta2n2nPOI=0.,threeDiffEta2n1n1nPOI=0.,threeDiffEta1n1n2nPOI=0.,fourDiffEta1n1n1n1nPOI=0.;
1173  Double_t twoDiffEta1n1nPOI=0.,twoDiffEta2n2nPOI=0.,fourDiffEta1n1n1n1nPOI=0.;
1174  
1175  for(Int_t bin=1;bin<(fnBinsEta+1);bin++)//loop over eta-bins 
1176  { 
1177   //q'      
1178   qxPrimeEtaPOI = (fEtaReq1nPrimePOI->GetBinContent(bin))*(fEtaReq1nPrimePOI->GetBinEntries(bin));
1179   qyPrimeEtaPOI = (fEtaImq1nPrimePOI->GetBinContent(bin))*(fEtaImq1nPrimePOI->GetBinEntries(bin)); 
1180   q2xPrimeEtaPOI = (fEtaReq2nPrimePOI->GetBinContent(bin))*(fEtaReq2nPrimePOI->GetBinEntries(bin));  
1181   q2yPrimeEtaPOI = (fEtaImq2nPrimePOI->GetBinContent(bin))*(fEtaImq2nPrimePOI->GetBinEntries(bin)); 
1182   mPrimeEtaPOI = fEtaReq1nPrimePOI->GetBinEntries(bin);      
1183   //q''                    
1184   qxPrimePrimeEtaPOI = (fEtaReq1nPrimePrimePOI->GetBinContent(bin))*(fEtaReq1nPrimePrimePOI->GetBinEntries(bin));
1185   qyPrimePrimeEtaPOI = (fEtaImq1nPrimePrimePOI->GetBinContent(bin))*(fEtaImq1nPrimePrimePOI->GetBinEntries(bin)); 
1186   q2xPrimePrimeEtaPOI = (fEtaReq2nPrimePrimePOI->GetBinContent(bin))*(fEtaReq2nPrimePrimePOI->GetBinEntries(bin));  
1187   q2yPrimePrimeEtaPOI = (fEtaImq2nPrimePrimePOI->GetBinContent(bin))*(fEtaImq2nPrimePrimePOI->GetBinEntries(bin)); 
1188   mPrimePrimeEtaPOI = fEtaReq1nPrimePrimePOI->GetBinEntries(bin);         
1189                    
1190   if((mPrimeEtaPOI+mPrimePrimeEtaPOI>0)&&dMult>0&&!(mPrimePrimeEtaPOI==1&&mPrimeEtaPOI==0&&dMult==1))//to be improved (dMult>1 or dMult>0)
1191   {   
1192    twoDiffEta1n1nPOI = (qxPrimePrimeEtaPOI*dQ1nx+qyPrimePrimeEtaPOI*dQ1ny-mPrimePrimeEtaPOI+qxPrimeEtaPOI*dQ1nx+qyPrimeEtaPOI*dQ1ny)/(mPrimePrimeEtaPOI*(dMult-1)+mPrimeEtaPOI*dMult);   
1193    f2PerEtaBin1n1nPOI->Fill(fEtaMin+(bin-1)*dBinWidthEta,twoDiffEta1n1nPOI,mPrimePrimeEtaPOI*(dMult-1)+mPrimeEtaPOI*dMult);//<2'>_{n|n}
1194   
1195    twoDiffEta2n2nPOI = (q2xPrimePrimeEtaPOI*dQ2nx+q2yPrimePrimeEtaPOI*dQ2ny-mPrimePrimeEtaPOI+q2xPrimeEtaPOI*dQ2nx+q2yPrimeEtaPOI*dQ2ny)/(mPrimePrimeEtaPOI*(dMult-1)+mPrimeEtaPOI*dMult);   
1196    f2PerEtaBin2n2nPOI->Fill(fEtaMin+(bin-1)*dBinWidthEta,twoDiffEta2n2nPOI,mPrimePrimeEtaPOI*(dMult-1)+mPrimeEtaPOI*dMult);//<2'>_{2n|2n} 
1197   }//end of if((mPrimeEtaPOI+mPrimePrimeEtaPOI>0)&&dMult>0)
1198   
1199   /*
1200   to be improved: correct Eqs. needed here)
1201   if(mEtaPOI>0&&dMult>3)
1202   {
1203    threeDiffEta2n1n1nPOI = (q2xEtaPOI*(dQ1nx*dQ1nx-dQ1ny*dQ1ny)+2.*q2yEtaPOI*dQ1nx*dQ1ny-2.*(qxEtaPOI*dQ1nx+qyEtaPOI*dQ1ny)-(q2xEtaPOI*dQ2nx+q2yEtaPOI*dQ2ny)+2.*mEtaPOI)/(mEtaPOI*(dMult-1.)*(dMult-2.));//to be improved (correct formula)
1204    //f3PePOItBin2n1n1nPOI->Fill(fEtaMin+(bin-1)*dBinWidthEta,threeDiffEta2n1n1nPOI,mEtaPOI*(dMult-1.)*(dMult-2.));//Re[<3'>_{2n|n,n}]
1205    
1206    threeDiffEta1n1n2nPOI = (dQ2nx*(qxEtaPOI*dQ1nx-qyEtaPOI*dQ1ny)+dQ2ny*(qxEtaPOI*dQ1ny+qyEtaPOI*dQ1nx)-2.*(qxEtaPOI*dQ1nx+qyEtaPOI*dQ1ny)-(q2xEtaPOI*dQ2nx+q2yEtaPOI*dQ2ny)+2.*mEtaPOI)/(mEtaPOI*(dMult-1.)*(dMult-2.));//to be improved (correct formula)
1207    //f3PePOItBin1n1n2nPOI->Fill(fEtaMin+(bin-1)*dBinWidthEta,threeDiffEta1n1n2nPOI,mEtaPOI*(dMult-1.)*(dMult-2.));//Re[<3'>_{n,n|2n}]
1208   }
1209   */
1210   
1211   //if((mPrimeEtaPOI+mPrimePrimeEtaPOI>0)&&dMult>2)//to be improved (dMult>2 or dMult>3)
1212   if(!(mPrimeEtaPOI==0&&mPrimePrimeEtaPOI==0)&&!(mPrimeEtaPOI==0&&(dMult==1||dMult==2||dMult==3))&&!(mPrimePrimeEtaPOI==0&&(dMult==0||dMult==1||dMult==2)))
1213   {  
1214    fourDiffEta1n1n1n1nPOI=((dQ1nx*dQ1nx+dQ1ny*dQ1ny)*(qxPrimeEtaPOI*dQ1nx+qyPrimeEtaPOI*dQ1ny)-2.*(dMult-1)*(qxPrimeEtaPOI*dQ1nx+qyPrimeEtaPOI*dQ1ny)-(dQ2nx*(qxPrimeEtaPOI*dQ1nx-qyPrimeEtaPOI*dQ1ny)+dQ2ny*(qxPrimeEtaPOI*dQ1ny+qyPrimeEtaPOI*dQ1nx))+(dQ1nx*dQ1nx+dQ1ny*dQ1ny)*(qxPrimePrimeEtaPOI*dQ1nx+qyPrimePrimeEtaPOI*dQ1ny)-(q2xPrimePrimeEtaPOI*(dQ1nx*dQ1nx-dQ1ny*dQ1ny)+2.*q2yPrimePrimeEtaPOI*dQ1nx*dQ1ny)-(dQ2nx*(qxPrimePrimeEtaPOI*dQ1nx-qyPrimePrimeEtaPOI*dQ1ny)+dQ2ny*(qxPrimePrimeEtaPOI*dQ1ny+qyPrimePrimeEtaPOI*dQ1nx))+(q2xPrimePrimeEtaPOI*dQ2nx+q2yPrimePrimeEtaPOI*dQ2ny)-2.*(dMult-3.)*(qxPrimePrimeEtaPOI*dQ1nx+qyPrimePrimeEtaPOI*dQ1ny)-2.*mPrimePrimeEtaPOI*(dQ1nx*dQ1nx+dQ1ny*dQ1ny)+2.*(dQ1nx*qxPrimePrimeEtaPOI+dQ1ny*qyPrimePrimeEtaPOI)+2.*mPrimePrimeEtaPOI*(dMult-3.))/(mPrimeEtaPOI*dMult*(dMult-1)*(dMult-2)+mPrimePrimeEtaPOI*(dMult-1)*(dMult-2)*(dMult-3));
1215            
1216    f4PerEtaBin1n1n1n1nPOI->Fill(fEtaMin+(bin-1)*dBinWidthEta,fourDiffEta1n1n1n1nPOI,mPrimeEtaPOI*dMult*(dMult-1)*(dMult-2)+mPrimePrimeEtaPOI*(dMult-1)*(dMult-2)*(dMult-3));//Re[<4'>_{n,n|n,n}]
1217   }//end of if((mPrimeEtaPOI+mPrimePrimeEtaPOI>0)&&dMult>2)   
1218  }//end of for(Int_t bin=1;bin<(fnBinsEta+1);bin++)//loop over eta-bins  
1219    
1220  fEtaReq1nPrimePOI->Reset();
1221  fEtaImq1nPrimePOI->Reset();
1222  fEtaReq2nPrimePOI->Reset();
1223  fEtaImq2nPrimePOI->Reset();
1224  
1225  fEtaReq1nPrimePrimePOI->Reset();
1226  fEtaImq1nPrimePrimePOI->Reset();
1227  fEtaReq2nPrimePrimePOI->Reset();
1228  fEtaImq2nPrimePrimePOI->Reset();
1229
1230 //---------------------------------------------------------------------------------------------------------
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242 /*
1243  //Eta:
1244  Double_t twoDiffEta1n1nPOI=0.,twoDiffEta2n2nPOI=0.,threeDiffEta2n1n1nPOI=0.,threeDiffEta1n1n2nPOI=0.,fourDiffEta1n1n1n1nPOI=0.;
1245  
1246  for(Int_t bin=1;bin<(fnBinsEta+1);bin++)//loop over eta-bins 
1247  { 
1248   qxEtaPOI = (fEtaReq1nPOI->GetBinContent(bin))*(fEtaReq1nPOI->GetBinEntries(bin));
1249   qyEtaPOI = (fEtaImq1nPOI->GetBinContent(bin))*(fEtaImq1nPOI->GetBinEntries(bin)); 
1250   q2xEtaPOI = (fEtaReq2nPOI->GetBinContent(bin))*(fEtaReq2nPOI->GetBinEntries(bin));  
1251   q2yEtaPOI = (fEtaImq2nPOI->GetBinContent(bin))*(fEtaImq2nPOI->GetBinEntries(bin)); 
1252   mEtaPOI = fEtaReq1nPOI->GetBinEntries(bin); 
1253   
1254   if(mEtaPOI>0&&dMult>1)
1255   {
1256    twoDiffEta1n1nPOI = (qxEtaPOI*dQ1nx+qyEtaPOI*dQ1ny-dOverlapEta)/((mEtaPOI-dOverlapEta)*dMult+dOverlapEta*(dMult-1.));
1257    f2PerEtaBin1n1nPOI->Fill(fEtaMin+(bin-1)*dBinWidthEta,twoDiffEta1n1nPOI,(mEtaPOI-dOverlapEta)*dMult+dOverlapEta*(dMult-1.));//<2'>_{n|n}
1258    
1259    twoDiffEta2n2nPOI = (q2xEtaPOI*dQ2nx+q2yEtaPOI*dQ2ny-dOverlapEta)/((mEtaPOI-dOverlapEta)*dMult+dOverlapEta*(dMult-1.));
1260    f2PerEtaBin2n2nPOI->Fill(fEtaMin+(bin-1)*dBinWidthEta,twoDiffEta2n2nPOI,(mEtaPOI-dOverlapEta)*dMult+dOverlapEta*(dMult-1.));//<2'>_{2n|2n} 
1261   }
1262   
1263   if(mEtaPOI>0&&dMult>2)
1264   {
1265    threeDiffEta2n1n1nPOI = (q2xEtaPOI*(dQ1nx*dQ1nx-dQ1ny*dQ1ny)+2.*q2yEtaPOI*dQ1nx*dQ1ny-2.*(qxEtaPOI*dQ1nx+qyEtaPOI*dQ1ny)-(q2xEtaPOI*dQ2nx+q2yEtaPOI*dQ2ny)+2.*mEtaPOI)/(mEtaPOI*(dMult-1.)*(dMult-2.));//to be improved (correct formula)
1266    //f3PerEtaBin2n1n1nPOI->Fill(fEtaMin+(bin-1)*dBinWidthEta,threeDiffEta2n1n1nPOI,mEtaPOI*(dMult-1.)*(dMult-2.));//Re[<3'>_{2n|n,n}]
1267    
1268    threeDiffEta1n1n2nPOI = (dQ2nx*(qxEtaPOI*dQ1nx-qyEtaPOI*dQ1ny)+dQ2ny*(qxEtaPOI*dQ1ny+qyEtaPOI*dQ1nx)-2.*(qxEtaPOI*dQ1nx+qyEtaPOI*dQ1ny)-(q2xEtaPOI*dQ2nx+q2yEtaPOI*dQ2ny)+2.*mEtaPOI)/(mEtaPOI*(dMult-1.)*(dMult-2.));//to be improved (correct formula)
1269    //f3PerEtaBin1n1n2nPOI->Fill(fEtaMin+(bin-1)*dBinWidthEta,threeDiffEta1n1n2nPOI,mEtaPOI*(dMult-1.)*(dMult-2.));//Re[<3'>_{n,n|2n}]
1270   }
1271   
1272   if(mEtaPOI>0&&dMult>3)
1273   {
1274    fourDiffEta1n1n1n1nPOI = ((dQ1nx*dQ1nx+dQ1ny*dQ1ny)*(qxEtaPOI*dQ1nx+qyEtaPOI*dQ1ny)-(q2xEtaPOI*(dQ1nx*dQ1nx-dQ1ny*dQ1ny)+2.*q2yEtaPOI*dQ1nx*dQ1ny)-(dQ2nx*(qxEtaPOI*dQ1nx-qyEtaPOI*dQ1ny)+dQ2ny*(qxEtaPOI*dQ1ny+qyEtaPOI*dQ1nx))+(q2xEtaPOI*dQ2nx+q2yEtaPOI*dQ2ny)-2.*(dMult-3.)*(qxEtaPOI*dQ1nx+qyEtaPOI*dQ1ny)-2.*mEtaPOI*(dQ1nx*dQ1nx+dQ1ny*dQ1ny)+2.*(dQ1nx*qxEtaPOI+dQ1ny*qyEtaPOI)+2.*mEtaPOI*(dMult-3.))/(mEtaPOI*(dMult-1.)*(dMult-2.)*(dMult-3.));//to be improved (correct formula)
1275    //f4PerEtaBin1n1n1n1nPOI->Fill(fEtaMin+(bin-1)*dBinWidthEta,fourDiffEta1n1n1n1nPOI,mEtaPOI*(dMult-1.)*(dMult-2.)*(dMult-3.));//Re[<4'>_{n,n|n,n}]
1276   }
1277    
1278  } 
1279   
1280  fEtaReq1nPOI->Reset();
1281  fEtaImq1nPOI->Reset();
1282  fEtaReq2nPOI->Reset();
1283  fEtaImq2nPOI->Reset();
1284 */
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310  /*
1311
1312
1313
1314
1315  //if(bNestedLoops)to be improved
1316  //{ to be improved               
1317  //-------------------------------------------------------------------------------------------------------------------------------- 
1318  //
1319  //                                          **********************
1320  //                                          **** NESTED LOOPS ****
1321  //                                          ********************** 
1322  //
1323  // Remark 1: multi-particle correlations calculated with nested loops are stored in fDirectCorrelations.
1324  // Remark 2: binning of fDirectCorrelations: bins 0..40 - correlations needed for integrated flow; bins 40..80 - correlations needed for differential flow (taking as an example bin 0.5 < pt < 0.6)
1325  //
1326  // binning details of fDirectCorrelations (integrated flow):
1327  //
1328  // 1st bin: <2>_{n|n} = two1n1n
1329  // 2nd bin: <2>_{2n|2n} = two2n2n
1330  // 3rd bin: <2>_{3n|3n} = two3n3n
1331  // 4th bin: <2>_{4n|4n} = two4n4n
1332  // 5th bin: --  EMPTY --
1333  // 6th bin: <3>_{2n|n,n} = three2n1n1n
1334  // 7th bin: <3>_{3n|2n,n} = three3n2n1n
1335  // 8th bin: <3>_{4n|2n,2n} = three4n2n2n
1336  // 9th bin: <3>_{4n|3n,n} = three4n3n1n
1337  //10th bin: --  EMPTY --
1338  //11th bin: <4>_{n,n|n,n} = four1n1n1n1n
1339  //12th bin: <4>_{2n,n|2n,n} = four2n1n2n1n
1340  //13th bin: <4>_{2n,2n|2n,2n} = four2n2n2n2n
1341  //14th bin: <4>_{3n|n,n,n} = four3n1n1n1n
1342  //15th bin: <4>_{3n,n|3n,n} = four3n1n3n1n 
1343  //16th bin: <4>_{3n,n|2n,2n} = four3n1n2n2n
1344  //17th bin: <4>_{4n|2n,n,n} = four4n2n1n1n
1345  //18th bin: --  EMPTY --
1346  //19th bin: <5>_{2n|n,n,n,n} = five2n1n1n1n1n
1347  //20th bin: <5>_{2n,2n|2n,n,n} = five2n2n2n1n1n
1348  //21st bin: <5>_{3n,n|2n,n,n} = five3n1n2n1n1n
1349  //22nd bin: <5>_{4n|n,n,n,n} = five4n1n1n1n1n  
1350  //23rd bin: --  EMPTY --
1351  //24th bin: <6>_{n,n,n|n,n,n} = six1n1n1n1n1n1n
1352  //25th bin: <6>_{2n,n,n|2n,n,n} = six2n1n1n2n1n1n
1353  //26th bin: <6>_{2n,2n|n,n,n,n} = six2n2n1n1n1n1n
1354  //27th bin: <6>_{3n,n|n,n,n,n} = six3n1n1n1n1n1n
1355  //28th bin: --  EMPTY --
1356  //29th bin: <7>_{2n,n,n|n,n,n,n} = seven2n1n1n1n1n1n1n
1357  //30th bin: --  EMPTY --
1358  //31st bin: <8>_{n,n,n,n|n,n,n,n} = eight1n1n1n1n1n1n1n1n
1359  
1360  Double_t phi1=0., phi2=0., phi3=0., phi4=0., phi5=0., phi6=0., phi7=0., phi8=0.;
1361
1362  //<2>_{k*n|k*n} (k=1,2,3 and 4)
1363  for(Int_t i1=0;i1<dMult;i1++)
1364  {
1365   fTrack=anEvent->GetTrack(i1);
1366   phi1=fTrack->Phi();
1367   for(Int_t i2=0;i2<dMult;i2++)
1368   {
1369    if(i2==i1)continue;
1370    fTrack=anEvent->GetTrack(i2);
1371    phi2=fTrack->Phi();
1372    fDirectCorrelations->Fill(0.,cos(n*(phi1-phi2)),1);    //<2>_{n|n}
1373    fDirectCorrelations->Fill(1.,cos(2.*n*(phi1-phi2)),1); //<2>_{2n|2n}
1374    fDirectCorrelations->Fill(2.,cos(3.*n*(phi1-phi2)),1); //<2>_{3n|3n}
1375    fDirectCorrelations->Fill(3.,cos(4.*n*(phi1-phi2)),1); //<2>_{4n|4n} 
1376   }
1377  }  
1378      
1379  //<3>_{2n|n,n}, <3>_{3n|2n,n}, <3>_{4n|2n,2n} and <3>_{4n|3n,n}
1380  for(Int_t i1=0;i1<dMult;i1++)
1381  {
1382   fTrack=anEvent->GetTrack(i1);
1383   phi1=fTrack->Phi();
1384   for(Int_t i2=0;i2<dMult;i2++)
1385   {
1386    if(i2==i1)continue;
1387    fTrack=anEvent->GetTrack(i2);
1388    phi2=fTrack->Phi();
1389    for(Int_t i3=0;i3<dMult;i3++)
1390    {
1391     if(i3==i1||i3==i2)continue;
1392     fTrack=anEvent->GetTrack(i3);
1393     phi3=fTrack->Phi();
1394     fDirectCorrelations->Fill(5.,cos(2*n*phi1-n*(phi2+phi3)),1);        //<3>_{2n|n,n}
1395     fDirectCorrelations->Fill(6.,cos(3.*n*phi1-2.*n*phi2-n*phi3),1);    //<3>_{3n|2n,n}
1396     fDirectCorrelations->Fill(7.,cos(4.*n*phi1-2.*n*phi2-2.*n*phi3),1); //<3>_{4n|2n,2n}
1397     fDirectCorrelations->Fill(8.,cos(4.*n*phi1-3.*n*phi2-n*phi3),1);    //<3>_{4n|3n,n}
1398    }
1399   }
1400  }
1401   
1402  //<4>_{n,n|n,n}, <4>_{2n,n|2n,n}, <4>_{2n,2n|2n,2n}, <4>_{3n|n,n,n}, <4>_{3n,n|3n,n}, <4>_{3n,n|2n,2n} and <4>_{4n|2n,n,n} 
1403  for(Int_t i1=0;i1<dMult;i1++)
1404  {
1405   fTrack=anEvent->GetTrack(i1);
1406   phi1=fTrack->Phi();
1407   for(Int_t i2=0;i2<dMult;i2++)
1408   {
1409    if(i2==i1)continue;
1410    fTrack=anEvent->GetTrack(i2);
1411    phi2=fTrack->Phi();
1412    for(Int_t i3=0;i3<dMult;i3++)
1413    {
1414     if(i3==i1||i3==i2)continue;
1415     fTrack=anEvent->GetTrack(i3);
1416     phi3=fTrack->Phi();
1417     for(Int_t i4=0;i4<dMult;i4++)
1418     {
1419      if(i4==i1||i4==i2||i4==i3)continue;
1420      fTrack=anEvent->GetTrack(i4);
1421      phi4=fTrack->Phi();
1422      fDirectCorrelations->Fill(10.,cos(n*phi1+n*phi2-n*phi3-n*phi4),1);            //<4>_{n,n|n,n}
1423      fDirectCorrelations->Fill(11.,cos(2.*n*phi1+n*phi2-2.*n*phi3-n*phi4),1);      //<4>_{2n,n|2n,n}
1424      fDirectCorrelations->Fill(12.,cos(2.*n*phi1+2*n*phi2-2.*n*phi3-2.*n*phi4),1); //<4>_{2n,2n|2n,2n}
1425      fDirectCorrelations->Fill(13.,cos(3.*n*phi1-n*phi2-n*phi3-n*phi4),1);         //<4>_{3n|n,n,n}
1426      fDirectCorrelations->Fill(14.,cos(3.*n*phi1+n*phi2-3.*n*phi3-n*phi4),1);      //<4>_{3n,n|3n,n}   
1427      fDirectCorrelations->Fill(15.,cos(3.*n*phi1+n*phi2-2.*n*phi3-2.*n*phi4),1);   //<4>_{3n,n|2n,2n}
1428      fDirectCorrelations->Fill(16.,cos(4.*n*phi1-2.*n*phi2-n*phi3-n*phi4),1);      //<4>_{4n|2n,n,n}
1429     }  
1430    }
1431   }
1432  }
1433  
1434  //<5>_{2n,n,n,n,n}, //<5>_{2n,2n|2n,n,n}, <5>_{3n,n|2n,n,n} and <5>_{4n|n,n,n,n}
1435  for(Int_t i1=0;i1<dMult;i1++)
1436  {
1437   //cout<<"i1 = "<<i1<<endl;
1438   fTrack=anEvent->GetTrack(i1);
1439   phi1=fTrack->Phi();
1440   for(Int_t i2=0;i2<dMult;i2++)
1441   {
1442    if(i2==i1)continue;
1443    fTrack=anEvent->GetTrack(i2);
1444    phi2=fTrack->Phi();
1445    for(Int_t i3=0;i3<dMult;i3++)
1446    {
1447     if(i3==i1||i3==i2)continue;
1448     fTrack=anEvent->GetTrack(i3);
1449     phi3=fTrack->Phi();
1450     for(Int_t i4=0;i4<dMult;i4++)
1451     {
1452      if(i4==i1||i4==i2||i4==i3)continue;
1453      fTrack=anEvent->GetTrack(i4);
1454      phi4=fTrack->Phi();
1455      for(Int_t i5=0;i5<dMult;i5++)
1456      {
1457       if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
1458       fTrack=anEvent->GetTrack(i5);
1459       phi5=fTrack->Phi();
1460       fDirectCorrelations->Fill(18.,cos(2.*n*phi1+n*phi2-n*phi3-n*phi4-n*phi5),1);       //<5>_{2n,n|n,n,n}
1461       fDirectCorrelations->Fill(19.,cos(2.*n*phi1+2.*n*phi2-2.*n*phi3-n*phi4-n*phi5),1); //<5>_{2n,2n|2n,n,n}
1462       fDirectCorrelations->Fill(20.,cos(3.*n*phi1+n*phi2-2.*n*phi3-n*phi4-n*phi5),1);    //<5>_{3n,n|2n,n,n}
1463       fDirectCorrelations->Fill(21.,cos(4.*n*phi1-n*phi2-n*phi3-n*phi4-n*phi5),1);       //<5>_{4n|n,n,n,n}
1464      }
1465     }  
1466    }
1467   }
1468  }
1469  
1470  //<6>_{n,n,n,n,n,n}, <6>_{2n,n,n|2n,n,n}, <6>_{2n,2n|n,n,n,n} and <6>_{3n,n|n,n,n,n}
1471  for(Int_t i1=0;i1<dMult;i1++)
1472  {
1473   //cout<<"i1 = "<<i1<<endl;
1474   fTrack=anEvent->GetTrack(i1);
1475   phi1=fTrack->Phi();
1476   for(Int_t i2=0;i2<dMult;i2++)
1477   {
1478    if(i2==i1)continue;
1479    fTrack=anEvent->GetTrack(i2);
1480    phi2=fTrack->Phi();
1481    for(Int_t i3=0;i3<dMult;i3++)
1482    {
1483     if(i3==i1||i3==i2)continue;
1484     fTrack=anEvent->GetTrack(i3);
1485     phi3=fTrack->Phi();
1486     for(Int_t i4=0;i4<dMult;i4++)
1487     {
1488      if(i4==i1||i4==i2||i4==i3)continue;
1489      fTrack=anEvent->GetTrack(i4);
1490      phi4=fTrack->Phi();
1491      for(Int_t i5=0;i5<dMult;i5++)
1492      {
1493       if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
1494       fTrack=anEvent->GetTrack(i5);
1495       phi5=fTrack->Phi();
1496       for(Int_t i6=0;i6<dMult;i6++)
1497       {
1498        if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5)continue;
1499        fTrack=anEvent->GetTrack(i6);
1500        phi6=fTrack->Phi(); 
1501        fDirectCorrelations->Fill(23.,cos(n*phi1+n*phi2+n*phi3-n*phi4-n*phi5-n*phi6),1);       //<6>_{n,n,n|n,n,n}
1502        fDirectCorrelations->Fill(24.,cos(2.*n*phi1+n*phi2+n*phi3-2.*n*phi4-n*phi5-n*phi6),1); //<6>_{2n,n,n|2n,n,n}
1503        fDirectCorrelations->Fill(25.,cos(2.*n*phi1+2.*n*phi2-n*phi3-n*phi4-n*phi5-n*phi6),1); //<6>_{2n,2n|n,n,n,n}
1504        fDirectCorrelations->Fill(26.,cos(3.*n*phi1+n*phi2-n*phi3-n*phi4-n*phi5-n*phi6),1);    //<6>_{3n,n|n,n,n,n}     
1505       } 
1506      }
1507     }  
1508    }
1509   }
1510  }
1511
1512  //<7>_{2n,n,n|n,n,n,n}
1513  for(Int_t i1=0;i1<dMult;i1++)
1514  {
1515   //cout<<"i1 = "<<i1<<endl;
1516   fTrack=anEvent->GetTrack(i1);
1517   phi1=fTrack->Phi();
1518   for(Int_t i2=0;i2<dMult;i2++)
1519   {
1520    if(i2==i1)continue;
1521    fTrack=anEvent->GetTrack(i2);
1522    phi2=fTrack->Phi();
1523    for(Int_t i3=0;i3<dMult;i3++)
1524    {
1525     if(i3==i1||i3==i2)continue;
1526     fTrack=anEvent->GetTrack(i3);
1527     phi3=fTrack->Phi();
1528     for(Int_t i4=0;i4<dMult;i4++)
1529     {
1530      if(i4==i1||i4==i2||i4==i3)continue;
1531      fTrack=anEvent->GetTrack(i4);
1532      phi4=fTrack->Phi();
1533      for(Int_t i5=0;i5<dMult;i5++)
1534      {
1535       if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
1536       fTrack=anEvent->GetTrack(i5);
1537       phi5=fTrack->Phi();
1538       for(Int_t i6=0;i6<dMult;i6++)
1539       {
1540        if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5)continue;
1541        fTrack=anEvent->GetTrack(i6);
1542        phi6=fTrack->Phi(); 
1543        for(Int_t i7=0;i7<dMult;i7++)
1544        {
1545         if(i7==i1||i7==i2||i7==i3||i7==i4||i7==i5||i7==i6)continue;
1546         fTrack=anEvent->GetTrack(i7);
1547         phi7=fTrack->Phi(); 
1548         fDirectCorrelations->Fill(28.,cos(2.*n*phi1+n*phi2+n*phi3-n*phi4-n*phi5-n*phi6-n*phi7),1);//<7>_{2n,n,n|n,n,n,n}
1549        } 
1550       } 
1551      }
1552     }  
1553    }
1554   }
1555  }
1556  
1557  //<8>_{n,n,n,n|n,n,n,n}
1558  for(Int_t i1=0;i1<dMult;i1++)
1559  {
1560   cout<<"i1 = "<<i1<<endl;
1561   fTrack=anEvent->GetTrack(i1);
1562   phi1=fTrack->Phi();
1563   for(Int_t i2=0;i2<dMult;i2++)
1564   {
1565    if(i2==i1)continue;
1566    fTrack=anEvent->GetTrack(i2);
1567    phi2=fTrack->Phi();
1568    for(Int_t i3=0;i3<dMult;i3++)
1569    {
1570     if(i3==i1||i3==i2)continue;
1571     fTrack=anEvent->GetTrack(i3);
1572     phi3=fTrack->Phi();
1573     for(Int_t i4=0;i4<dMult;i4++)
1574     {
1575      if(i4==i1||i4==i2||i4==i3)continue;
1576      fTrack=anEvent->GetTrack(i4);
1577      phi4=fTrack->Phi();
1578      for(Int_t i5=0;i5<dMult;i5++)
1579      {
1580       if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
1581       fTrack=anEvent->GetTrack(i5);
1582       phi5=fTrack->Phi();
1583       for(Int_t i6=0;i6<dMult;i6++)
1584       {
1585        if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5)continue;
1586        fTrack=anEvent->GetTrack(i6);
1587        phi6=fTrack->Phi(); 
1588        for(Int_t i7=0;i7<dMult;i7++)
1589        {
1590         if(i7==i1||i7==i2||i7==i3||i7==i4||i7==i5||i7==i6)continue;
1591         fTrack=anEvent->GetTrack(i7);
1592         phi7=fTrack->Phi(); 
1593         for(Int_t i8=0;i8<dMult;i8++)
1594         {
1595          if(i8==i1||i8==i2||i8==i3||i8==i4||i8==i5||i8==i6||i8==i7)continue;
1596          fTrack=anEvent->GetTrack(i8);
1597          phi8=fTrack->Phi();  
1598          fDirectCorrelations->Fill(30.,cos(n*phi1+n*phi2+n*phi3+n*phi4-n*phi5-n*phi6-n*phi7-n*phi8),1);//<8>_{n,n,n,n|n,n,n,n}
1599         } 
1600        } 
1601       } 
1602      }
1603     }  
1604    }
1605   }
1606  }
1607  
1608  // binning details of fDirectCorrelations (differential flow):
1609  //
1610  //41st bin: <2'>_{n|n}
1611  //42nd bin: <2'>_{2n|2n}
1612  //43rd bin: <2'>_{3n|3n}
1613  //44th bin: <2'>_{4n|4n}
1614  //46th bin: <3'>_{2n|n,n}
1615  //47th bin: <3'>_{n,n|2n}
1616  //51st bin: <4'>_{n,n|n,n}
1617  //56th bin: <5'>_{2n,n|n,n,n}
1618  //61st bin: <6'>_{n,n,n|n,n,n}
1619  //66th bin: <7'>_{2n,n,n|n,n,n,n}
1620  //71st bin: <8'>_{n,n,n,n|n,n,n,n}
1621  
1622  
1623  //<2'>_{n|n}
1624  for(Int_t i1=0;i1<nPrim;i1++)
1625  {
1626   fTrack=anEvent->GetTrack(i1);
1627   if(!((fTrack->Pt()>=0.5&&fTrack->Pt()<0.6)&&(fTrack->UseForDifferentialFlow())))continue;//POI condition
1628   phi1=fTrack->Phi();
1629   for(Int_t i2=0;i2<nPrim;i2++)
1630   {
1631    if(i2==i1)continue;
1632    fTrack=anEvent->GetTrack(i2);
1633    if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition
1634    phi2=fTrack->Phi();
1635     //cout<<"1st = "<<i1<<"     "<< (anEvent->GetTrack(i1))->Eta() << " " << (anEvent->GetTrack(i1))->Pt()<<endl;
1636     //cout<<"2nd = "<<i2<<"     "<< (anEvent->GetTrack(i2))->Eta() << " " << (anEvent->GetTrack(i2))->Pt()<<endl; 
1637    //fill the fDirectCorrelations:    
1638    fDirectCorrelations->Fill(40.,cos(1.*n*(phi1-phi2)),1);//<2'>_{n,n}
1639    fDirectCorrelations->Fill(41.,cos(2.*n*(phi1-phi2)),1);//<2'>_{2n,2n}
1640    fDirectCorrelations->Fill(42.,cos(3.*n*(phi1-phi2)),1);//<2'>_{3n,3n}
1641    fDirectCorrelations->Fill(43.,cos(4.*n*(phi1-phi2)),1);//<2'>_{4n,4n}     
1642   }//end of for(Int_t i2=0;i2<nPrim;i2++)
1643  }//end of for(Int_t i1=0;i1<nPrim;i1++)
1644  
1645  //<3'>_{2n|n,n}
1646  for(Int_t i1=0;i1<nPrim;i1++)
1647  {
1648   fTrack=anEvent->GetTrack(i1);
1649   if(!((fTrack->Pt()>=0.5&&fTrack->Pt()<0.6)&&(fTrack->UseForDifferentialFlow())))continue;//POI condition
1650   phi1=fTrack->Phi();
1651   for(Int_t i2=0;i2<nPrim;i2++)
1652   {
1653    if(i2==i1)continue;
1654    fTrack=anEvent->GetTrack(i2);
1655    if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition
1656    phi2=fTrack->Phi();
1657    for(Int_t i3=0;i3<nPrim;i3++)
1658    {
1659     if(i3==i1||i3==i2)continue;
1660     fTrack=anEvent->GetTrack(i3);
1661     if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition
1662     phi3=fTrack->Phi();
1663     //fill the fDirectCorrelations:           
1664     fDirectCorrelations->Fill(45.,cos(n*(2.*phi1-phi2-phi3)),1);//<3'>_{2n|n,n}
1665     fDirectCorrelations->Fill(46.,cos(n*(phi1+phi2-2.*phi3)),1);//<3'>_{n,n|2n}    
1666    }//end of for(Int_t i3=0;i3<nPrim;i3++)  
1667   }//end of for(Int_t i2=0;i2<nPrim;i2++)  
1668  }//end of for(Int_t i1=0;i1<nPrim;i1++) 
1669   
1670  //<4'>_{n,n|n,n}
1671  for(Int_t i1=0;i1<nPrim;i1++)
1672  {
1673   fTrack=anEvent->GetTrack(i1);
1674   if(!((fTrack->Pt()>=0.5&&fTrack->Pt()<0.6)&&(fTrack->UseForDifferentialFlow())))continue;//POI condition
1675   phi1=fTrack->Phi();
1676   for(Int_t i2=0;i2<nPrim;i2++)
1677   {
1678    if(i2==i1)continue;
1679    fTrack=anEvent->GetTrack(i2);
1680    if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition   
1681    phi2=fTrack->Phi();
1682    for(Int_t i3=0;i3<nPrim;i3++)
1683    { 
1684     if(i3==i1||i3==i2)continue;
1685     fTrack=anEvent->GetTrack(i3);
1686     if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition   
1687     phi3=fTrack->Phi();
1688     for(Int_t i4=0;i4<nPrim;i4++)
1689     {
1690      if(i4==i1||i4==i2||i4==i3)continue;
1691      fTrack=anEvent->GetTrack(i4);
1692      if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition  
1693      phi4=fTrack->Phi();
1694      //fill the fDirectCorrelations:
1695      fDirectCorrelations->Fill(50.,cos(n*(phi1+phi2-phi3-phi4)),1);//<4'>_{n,n|n,n} 
1696     }//end of for(Int_t i4=0;i4<nPrim;i4++)
1697    }//end of for(Int_t i3=0;i3<nPrim;i3++)
1698   }//end of for(Int_t i2=0;i2<nPrim;i2++) 
1699  }//end of for(Int_t i1=0;i1<nPrim;i1++)
1700  
1701  //<5'>_{2n,n|n,n,n}
1702  for(Int_t i1=0;i1<nPrim;i1++)
1703  {
1704   fTrack=anEvent->GetTrack(i1);
1705   if(!((fTrack->Pt()>=0.5&&fTrack->Pt()<0.6)&&(fTrack->UseForDifferentialFlow())))continue;//POI condition
1706   phi1=fTrack->Phi();
1707   for(Int_t i2=0;i2<nPrim;i2++)
1708   {
1709    if(i2==i1)continue;
1710    fTrack=anEvent->GetTrack(i2);
1711    if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition   
1712    phi2=fTrack->Phi();
1713    for(Int_t i3=0;i3<nPrim;i3++)
1714    { 
1715     if(i3==i1||i3==i2)continue;
1716     fTrack=anEvent->GetTrack(i3);
1717     if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition   
1718     phi3=fTrack->Phi();
1719     for(Int_t i4=0;i4<nPrim;i4++)
1720     {
1721      if(i4==i1||i4==i2||i4==i3)continue;
1722      fTrack=anEvent->GetTrack(i4);
1723      if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition  
1724      phi4=fTrack->Phi();
1725      for(Int_t i5=0;i5<nPrim;i5++)
1726      {
1727       if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
1728       fTrack=anEvent->GetTrack(i5);
1729       if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition  
1730       phi5=fTrack->Phi();    
1731       //fill the fDirectCorrelations:if(bNestedLoops)
1732       fDirectCorrelations->Fill(55.,cos(2.*n*phi1+n*phi2-n*phi3-n*phi4-n*phi5),1);//<5'>_{2n,n|n,n,n}
1733      }//end of for(Int_t i5=0;i5<nPrim;i5++)  
1734     }//end of for(Int_t i4=0;i4<nPrim;i4++)
1735    }//end of for(Int_t i3=0;i3<nPrim;i3++)
1736   }//end of for(Int_t i2=0;i2<nPrim;i2++) 
1737  }//end of for(Int_t i1=0;i1<nPrim;i1++)
1738  
1739  //<6'>_{n,n,n|n,n,n}
1740  for(Int_t i1=0;i1<nPrim;i1++)
1741  {
1742   fTrack=anEvent->GetTrack(i1);
1743   if(!((fTrack->Pt()>=0.5&&fTrack->Pt()<0.6)&&(fTrack->UseForDifferentialFlow())))continue;//POI condition
1744   phi1=fTrack->Phi();
1745   for(Int_t i2=0;i2<nPrim;i2++)
1746   {
1747    if(i2==i1)continue;
1748    fTrack=anEvent->GetTrack(i2);
1749    if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition   
1750    phi2=fTrack->Phi();
1751    for(Int_t i3=0;i3<nPrim;i3++)
1752    { 
1753     if(i3==i1||i3==i2)continue;
1754     fTrack=anEvent->GetTrack(i3);
1755     if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition   
1756     phi3=fTrack->Phi();
1757     for(Int_t i4=0;i4<nPrim;i4++)
1758     {
1759      if(i4==i1||i4==i2||i4==i3)continue;
1760      fTrack=anEvent->GetTrack(i4);
1761      if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition  
1762      phi4=fTrack->Phi();
1763      for(Int_t i5=0;i5<nPrim;i5++)
1764      {
1765       if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
1766       fTrack=anEvent->GetTrack(i5);
1767       if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition  
1768       phi5=fTrack->Phi();    
1769       for(Int_t i6=0;i6<nPrim;i6++)
1770       {
1771        if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5)continue;
1772        fTrack=anEvent->GetTrack(i6);
1773        if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition  
1774        phi6=fTrack->Phi();  
1775        //fill the fDirectCorrelations:
1776        fDirectCorrelations->Fill(60.,cos(n*(phi1+phi2+phi3-phi4-phi5-phi6)),1);//<6'>_{n,n,n|n,n,n}
1777       }//end of for(Int_t i6=0;i6<nPrim;i6++)   
1778      }//end of for(Int_t i5=0;i5<nPrim;i5++)  
1779     }//end of for(Int_t i4=0;i4<nPrim;i4++)
1780    }//end of for(Int_t i3=0;i3<nPrim;i3++)
1781   }//end of for(Int_t i2=0;i2<nPrim;i2++) 
1782  }//end of for(Int_t i1=0;i1<nPrim;i1++)
1783  
1784  //<7'>_{2n,n,n|n,n,n,n}
1785  for(Int_t i1=0;i1<nPrim;i1++)
1786  {
1787   fTrack=anEvent->GetTrack(i1);
1788   if(!((fTrack->Pt()>=0.5&&fTrack->Pt()<0.6)&&(fTrack->UseForDifferentialFlow())))continue;//POI condition
1789   phi1=fTrack->Phi();
1790   for(Int_t i2=0;i2<nPrim;i2++)
1791   {
1792    if(i2==i1)continue;
1793    fTrack=anEvent->GetTrack(i2);
1794    if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition   
1795    phi2=fTrack->Phi();
1796    for(Int_t i3=0;i3<nPrim;i3++)
1797    { 
1798     if(i3==i1||i3==i2)continue;
1799     fTrack=anEvent->GetTrack(i3);
1800     if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition   
1801     phi3=fTrack->Phi();
1802     for(Int_t i4=0;i4<nPrim;i4++)
1803     {
1804      if(i4==i1||i4==i2||i4==i3)continue;
1805      fTrack=anEvent->GetTrack(i4);
1806      if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition  
1807      phi4=fTrack->Phi();
1808      for(Int_t i5=0;i5<nPrim;i5++)
1809      {
1810       if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
1811       fTrack=anEvent->GetTrack(i5);
1812       if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition  
1813       phi5=fTrack->Phi();    
1814       for(Int_t i6=0;i6<nPrim;i6++)
1815       {
1816        if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5)continue;
1817        fTrack=anEvent->GetTrack(i6);
1818        if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition  
1819        phi6=fTrack->Phi();
1820        for(Int_t i7=0;i7<nPrim;i7++)
1821        {
1822         if(i7==i1||i7==i2||i7==i3||i7==i4||i7==i5||i7==i6)continue;
1823         fTrack=anEvent->GetTrack(i7);
1824         if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition  
1825         phi7=fTrack->Phi();   
1826         //fill the fDirectCorrelations:
1827         fDirectCorrelations->Fill(65.,cos(2.*n*phi1+n*phi2+n*phi3-n*phi4-n*phi5-n*phi6-n*phi7),1);//<7'>_{2n,n,n|n,n,n,n}
1828        }//end of for(Int_t i7=0;i7<nPrim;i7++)  
1829       }//end of for(Int_t i6=0;i6<nPrim;i6++)   
1830      }//end of for(Int_t i5=0;i5<nPrim;i5++)  
1831     }//end of for(Int_t i4=0;i4<nPrim;i4++)
1832    }//end of for(Int_t i3=0;i3<nPrim;i3++)
1833   }//end of for(Int_t i2=0;i2<nPrim;i2++) 
1834  }//end of for(Int_t i1=0;i1<nPrim;i1++)
1835  
1836  //<8'>_{n,n,n,n|n,n,n,n}
1837  for(Int_t i1=0;i1<nPrim;i1++)
1838  {
1839   fTrack=anEvent->GetTrack(i1);
1840   if(!((fTrack->Pt()>=0.5&&fTrack->Pt()<0.6)&&(fTrack->UseForDifferentialFlow())))continue;//POI condition
1841   phi1=fTrack->Phi();
1842   for(Int_t i2=0;i2<nPrim;i2++)
1843   {
1844    if(i2==i1)continue;
1845    fTrack=anEvent->GetTrack(i2);
1846    if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition   
1847    phi2=fTrack->Phi();
1848    for(Int_t i3=0;i3<nPrim;i3++)
1849    { 
1850     if(i3==i1||i3==i2)continue;
1851     fTrack=anEvent->GetTrack(i3);
1852     if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition   
1853     phi3=fTrack->Phi();
1854     for(Int_t i4=0;i4<nPrim;i4++)
1855     {
1856      if(i4==i1||i4==i2||i4==i3)continue;
1857      fTrack=anEvent->GetTrack(i4);
1858      if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition  
1859      phi4=fTrack->Phi();
1860      for(Int_t i5=0;i5<nPrim;i5++)
1861      {
1862       if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
1863       fTrack=anEvent->GetTrack(i5);
1864       if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition  
1865       phi5=fTrack->Phi();    
1866       for(Int_t i6=0;i6<nPrim;i6++)
1867       {
1868        if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5)continue;
1869        fTrack=anEvent->GetTrack(i6);
1870        if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition  
1871        phi6=fTrack->Phi();
1872        for(Int_t i7=0;i7<nPrim;i7++)
1873        {
1874         if(i7==i1||i7==i2||i7==i3||i7==i4||i7==i5||i7==i6)continue;
1875         fTrack=anEvent->GetTrack(i7);
1876         if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition  
1877         phi7=fTrack->Phi();
1878         for(Int_t i8=0;i8<nPrim;i8++)
1879         {
1880          if(i8==i1||i8==i2||i8==i3||i8==i4||i8==i5||i8==i6||i8==i7)continue;
1881          fTrack=anEvent->GetTrack(i8);
1882          if(!(fTrack->UseForIntegratedFlow()))continue;//RP condition  
1883          phi8=fTrack->Phi();           
1884          //fill the fDirectCorrelations:
1885          fDirectCorrelations->Fill(70.,cos(n*(phi1+phi2+phi3+phi4-phi5-phi6-phi7-phi8)),1);//<8'>_{n,n,n,n|n,n,n,n}
1886         }//end of for(Int_t i8=0;i8<nPrim;i8++) 
1887        }//end of for(Int_t i7=0;i7<nPrim;i7++)  
1888       }//end of for(Int_t i6=0;i6<nPrim;i6++)   
1889      }//end of for(Int_t i5=0;i5<nPrim;i5++)  
1890     }//end of for(Int_t i4=0;i4<nPrim;i4++)
1891    }//end of for(Int_t i3=0;i3<nPrim;i3++)
1892   }//end of for(Int_t i2=0;i2<nPrim;i2++) 
1893  }//end of for(Int_t i1=0;i1<nPrim;i1++)
1894  
1895  
1896  
1897  */
1898  
1899  
1900 //--------------------------------------------------------------------------------------------------------------------------------  
1901
1902  //}//end of if(nPrim>0&&nPrim<12)
1903 }//end of Make()
1904
1905 //================================================================================================================
1906
1907 void AliFlowAnalysisWithQCumulants::Finish()
1908 {
1909  //calculate the final results
1910  AliQCumulantsFunctions finalResults(fIntFlowResultsQC,fDiffFlowResults2ndOrderQC,fDiffFlowResults4thOrderQC,fCovariances,fAvMultIntFlowQC,fQvectorComponents,fQCorrelations, fQProduct,fDirectCorrelations,f2PerPtBin1n1nRP,f2PerPtBin2n2nRP,f3PerPtBin2n1n1nRP,f3PerPtBin1n1n2nRP,f4PerPtBin1n1n1n1nRP, f2PerEtaBin1n1nRP,f2PerEtaBin2n2nRP,f3PerEtaBin2n1n1nRP,f3PerEtaBin1n1n2nRP,f4PerEtaBin1n1n1n1nRP,f2PerPtBin1n1nPOI,f2PerPtBin2n2nPOI,f3PerPtBin2n1n1nPOI,f3PerPtBin1n1n2nPOI,f4PerPtBin1n1n1n1nPOI, f2PerEtaBin1n1nPOI,f2PerEtaBin2n2nPOI,f3PerEtaBin2n1n1nPOI,f3PerEtaBin1n1n2nPOI,f4PerEtaBin1n1n1n1nPOI,fCommonHists2nd,fCommonHists4th, fCommonHists6th, fCommonHists8th,fCommonHistsResults2nd, fCommonHistsResults4th,fCommonHistsResults6th,fCommonHistsResults8th);
1911
1912  finalResults.Calculate(); 
1913  
1914  
1915  /*
1916    
1917     
1918  //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1919  //                   !!!! to be removed !!!!  
1920  
1921  TCanvas* qvectorPlot = new TCanvas("qvectorPlot","Q-vector Plot",1000,1000);
1922  
1923  qvectorPlot->cd(1);
1924  
1925  TH1D* style = new TH1D("style","Q-vectors",100,-244,244); 
1926  (style->GetYaxis())->SetRangeUser(-244,244);
1927  
1928  style->Draw();
1929   
1930  Int_t nBins=fQvectorForEachEventX->GetNbinsX();
1931  Double_t qxxx=0.,qyyy=0.;
1932  //cout<<"nBins = "<<nBins<<endl;   
1933  //cout<<fQvectorForEachEventX->GetBinEntries(4)<<endl;    
1934  //cout<<fQvectorForEachEventY->GetBinEntries(4)<<endl;     
1935  
1936  for(Int_t b=1;b<nBins+1;b++)
1937  {
1938   if(fQvectorForEachEventX->GetBinEntries(b)==1 && fQvectorForEachEventY->GetBinEntries(b)==1)
1939   {
1940    qxxx=fQvectorForEachEventX->GetBinContent(b);
1941    qyyy=fQvectorForEachEventY->GetBinContent(b);
1942    //cout<<qxxx<<" "<<qyyy<<endl;
1943    TArrow *qvector = new TArrow(0.0,0.0,qxxx,qyyy,0.0144,"|>");
1944    qvector->SetAngle(40);
1945    qvector->SetLineWidth(2);
1946    qvector->Draw("");
1947   }
1948  }  
1949  
1950  //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx       
1951
1952  */        
1953                            
1954 }
1955
1956 //================================================================================================================
1957
1958 void AliFlowAnalysisWithQCumulants::WriteHistograms(TString outputFileName)
1959 {
1960  //store the final results in output .root file
1961  TFile *output = new TFile(outputFileName.Data(),"RECREATE");
1962  output->WriteObject(fHistList, "cobjQC","SingleKey");
1963  delete output;
1964 }
1965
1966 //================================================================================================================
1967
1968
1969