]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/FLOW/Base/AliFlowAnalysisWithQCumulants.cxx
Ante Bilandzic: add POI as reference multiplicity estimator
[u/mrichter/AliRoot.git] / PWG / FLOW / Base / 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  *        (abilandzic@gmail.com)  *
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
31 #include "TFile.h"
32 #include "TList.h"
33 #include "TGraph.h"
34 #include "TParticle.h"
35 #include "TRandom3.h"
36 #include "TStyle.h"
37 #include "TProfile.h"
38 #include "TProfile2D.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 "TArrayD.h"
47 #include "TRandom.h"
48 #include "TF1.h"
49
50 class TH1;
51 class TH2;
52 class TGraph;
53 class TPave;
54 class TLatex;
55 class TMarker;
56 class TRandom3;
57 class TObjArray;
58 class TList;
59 class TCanvas;
60 class TSystem;
61 class TROOT;
62 class AliFlowVector;
63 class TVector;
64
65 //================================================================================================================
66
67 using std::endl;
68 using std::cout;
69 using std::flush;
70 ClassImp(AliFlowAnalysisWithQCumulants)
71
72 AliFlowAnalysisWithQCumulants::AliFlowAnalysisWithQCumulants(): 
73  // 0.) base:
74  fHistList(NULL),
75  // 1.) common:
76  fBookOnlyBasicCCH(kTRUE),
77  fCommonHists(NULL),
78  fCommonHists2nd(NULL), 
79  fCommonHists4th(NULL),
80  fCommonHists6th(NULL),
81  fCommonHists8th(NULL),
82  fCommonHistsResults2nd(NULL),
83  fCommonHistsResults4th(NULL),
84  fCommonHistsResults6th(NULL),
85  fCommonHistsResults8th(NULL),
86  fnBinsPhi(0),
87  fPhiMin(0),
88  fPhiMax(0),
89  fPhiBinWidth(0),
90  fnBinsPt(0),
91  fPtMin(0),
92  fPtMax(0),
93  fPtBinWidth(0),
94  fnBinsEta(0),
95  fEtaMin(0),
96  fEtaMax(0),
97  fEtaBinWidth(0),
98  fCommonConstants(NULL),
99  fFillMultipleControlHistograms(kFALSE),
100  fHarmonic(2),
101  fAnalysisLabel(NULL),
102  // 2a.) particle weights:
103  fWeightsList(NULL),
104  fUsePhiWeights(kFALSE),
105  fUsePtWeights(kFALSE),
106  fUseEtaWeights(kFALSE),
107  fUseTrackWeights(kFALSE),
108  fUseParticleWeights(NULL),
109  fPhiWeights(NULL),
110  fPtWeights(NULL),
111  fEtaWeights(NULL),
112  // 2b.) event weights:
113  fMultiplicityWeight(NULL),
114  fMultiplicityIs(AliFlowCommonConstants::kRP),
115  // 3.) integrated flow:
116  fIntFlowList(NULL), 
117  fIntFlowProfiles(NULL),
118  fIntFlowResults(NULL),
119  fIntFlowAllCorrelationsVsM(NULL),
120  fIntFlowFlags(NULL),
121  fApplyCorrectionForNUA(kFALSE),  
122  fApplyCorrectionForNUAVsM(kFALSE),
123  fnBinsMult(10000),
124  fMinMult(0.),  
125  fMaxMult(10000.), 
126  fPropagateErrorAlsoFromNIT(kFALSE), 
127  fCalculateCumulantsVsM(kFALSE),
128  fCalculateAllCorrelationsVsM(kFALSE), 
129  fMinimumBiasReferenceFlow(kTRUE), 
130  fForgetAboutCovariances(kFALSE), 
131  fStorePhiDistributionForOneEvent(kFALSE),
132  fReQ(NULL),
133  fImQ(NULL),
134  fSpk(NULL),
135  fIntFlowCorrelationsEBE(NULL),
136  fIntFlowEventWeightsForCorrelationsEBE(NULL),
137  fIntFlowCorrelationsAllEBE(NULL),
138  fNumberOfRPsEBE(0.),
139  fNumberOfPOIsEBE(0.),
140  fReferenceMultiplicityEBE(0.),  
141  fAvMultiplicity(NULL),
142  fIntFlowCorrelationsPro(NULL),
143  fIntFlowSquaredCorrelationsPro(NULL),
144  fIntFlowCorrelationsAllPro(NULL),
145  fIntFlowExtraCorrelationsPro(NULL),
146  fIntFlowProductOfCorrelationsPro(NULL),
147  fIntFlowProductOfCorrectionTermsForNUAPro(NULL),
148  fIntFlowCorrelationsHist(NULL),
149  fIntFlowCorrelationsAllHist(NULL),
150  fIntFlowCovariances(NULL),
151  fIntFlowSumOfProductOfEventWeights(NULL),
152  fIntFlowCovariancesNUA(NULL),
153  fIntFlowSumOfProductOfEventWeightsNUA(NULL),
154  fIntFlowQcumulants(NULL),
155  fIntFlowQcumulantsRebinnedInM(NULL), 
156  fIntFlowQcumulantsErrorSquaredRatio(NULL), 
157  fIntFlow(NULL),
158  fIntFlowRebinnedInM(NULL),
159  fIntFlowDetectorBias(NULL),
160  // 4.) differential flow:
161  fDiffFlowList(NULL),
162  fDiffFlowProfiles(NULL),
163  fDiffFlowResults(NULL),
164  fDiffFlow2D(NULL),
165  fDiffFlowFlags(NULL),
166  fCalculateDiffFlow(kTRUE),
167  fCalculate2DDiffFlow(kFALSE),
168  fCalculateDiffFlowVsEta(kTRUE),
169  // 5.) other differential correlators:
170  fOtherDiffCorrelatorsList(NULL),
171  // 6.) distributions:
172  fDistributionsList(NULL),
173  fDistributionsFlags(NULL),
174  fStoreDistributions(kFALSE),
175  // 7.) various:
176  fVariousList(NULL),
177  fPhiDistributionForOneEvent(NULL),
178  // 8.) debugging and cross-checking:
179  fNestedLoopsList(NULL),
180  fEvaluateIntFlowNestedLoops(kFALSE),
181  fEvaluateDiffFlowNestedLoops(kFALSE),
182  fMaxAllowedMultiplicity(10),
183  fEvaluateNestedLoops(NULL),
184  fIntFlowDirectCorrelations(NULL),
185  fIntFlowExtraDirectCorrelations(NULL),
186  fCrossCheckInPtBinNo(10),
187  fCrossCheckInEtaBinNo(20),
188  fNoOfParticlesInBin(NULL),
189  fMixedHarmonicsNestedLoops(NULL),
190  // 9.) mixed harmonics: 
191  fMixedHarmonicsList(NULL),
192  fMixedHarmonicsProfiles(NULL),
193  fMixedHarmonicsResults(NULL),
194  fMixedHarmonicsErrorPropagation(NULL),
195  fMixedHarmonicsFlags(NULL),
196  fCalculateMixedHarmonics(kFALSE),
197  fCalculateMixedHarmonicsVsM(kFALSE),
198  f2pCorrelations(NULL),
199  f3pCorrelations(NULL),
200  f4pCorrelations(NULL),
201  f5pCorrelations(NULL),
202  f6pCorrelations(NULL),
203  f7pCorrelations(NULL),
204  f8pCorrelations(NULL),
205  f2pCumulants(NULL),
206  f3pCumulants(NULL),
207  f4pCumulants(NULL),
208  f5pCumulants(NULL),
209  f6pCumulants(NULL),
210  f7pCumulants(NULL),
211  f8pCumulants(NULL),
212  fMixedHarmonicProductOfEventWeights(NULL),
213  fMixedHarmonicProductOfCorrelations(NULL),
214  // 10.) Control histograms:
215  fControlHistogramsList(NULL), 
216  fControlHistogramsFlags(NULL),
217  fStoreControlHistograms(kFALSE),
218  fCorrelationNoRPsVsRefMult(NULL), 
219  fCorrelationNoPOIsVsRefMult(NULL),
220  fCorrelationNoRPsVsNoPOIs(NULL)
221  {
222   // constructor  
223   
224   // base list to hold all output objects:
225   fHistList = new TList();
226   fHistList->SetName("cobjQC");
227   fHistList->SetOwner(kTRUE);
228   
229   // list to hold histograms with phi, pt and eta weights:      
230   fWeightsList = new TList();
231   
232   // multiplicity weight:
233   fMultiplicityWeight = new TString("combinations");
234
235   // analysis label;
236   fAnalysisLabel = new TString();
237       
238   // initialize all arrays:  
239   this->InitializeArraysForIntFlow();
240   this->InitializeArraysForDiffFlow();
241   this->InitializeArraysForDistributions();
242   this->InitializeArraysForVarious();
243   this->InitializeArraysForNestedLoops();
244   this->InitializeArraysForMixedHarmonics();
245   
246  } // end of constructor
247  
248 //================================================================================================================  
249
250 AliFlowAnalysisWithQCumulants::~AliFlowAnalysisWithQCumulants()
251 {
252  // destructor
253  
254  delete fHistList;
255
256 } // end of AliFlowAnalysisWithQCumulants::~AliFlowAnalysisWithQCumulants()
257
258 //================================================================================================================
259
260 void AliFlowAnalysisWithQCumulants::Init()
261 {
262  // a) Cross check if the settings make sense before starting the QC adventure;
263  // b) Access all common constants;
264  // c) Book all objects;
265  // d) Store flags for integrated and differential flow;
266  // e) Store flags for distributions of corelations;
267  // f) Store harmonic which will be estimated;
268  // g) Store flags for mixed harmonics.
269   
270  //save old value and prevent histograms from being added to directory
271  //to avoid name clashes in case multiple analaysis objects are used
272  //in an analysis
273  Bool_t oldHistAddStatus = TH1::AddDirectoryStatus();
274  TH1::AddDirectory(kFALSE);
275  
276  // a) Cross check if the settings make sense before starting the QC adventure; 
277  this->CrossCheckSettings();
278  // b) Access all common constants and book a profile to hold them:
279  this->CommonConstants("Init");
280  // c) Book all objects:
281  this->BookAndFillWeightsHistograms(); 
282  this->BookAndNestAllLists();
283  this->BookCommonHistograms();
284  this->BookEverythingForIntegratedFlow(); 
285  this->BookEverythingForDifferentialFlow(); 
286  this->BookEverythingFor2DDifferentialFlow(); 
287  this->BookEverythingForDistributions();
288  this->BookEverythingForVarious();
289  this->BookEverythingForNestedLoops();
290  this->BookEverythingForMixedHarmonics();
291  this->BookEverythingForControlHistograms();
292
293  // d) Store flags for integrated and differential flow:
294  this->StoreIntFlowFlags();
295  this->StoreDiffFlowFlags();
296  // e) Store flags for distributions of corelations:
297  this->StoreFlagsForDistributions();
298  // f) Store harmonic which will be estimated:
299  this->StoreHarmonic();
300  // g) Store flags for mixed harmonics:
301  this->StoreMixedHarmonicsFlags();
302  
303  TH1::AddDirectory(oldHistAddStatus);
304 } // end of void AliFlowAnalysisWithQCumulants::Init()
305
306 //================================================================================================================
307
308 void AliFlowAnalysisWithQCumulants::Make(AliFlowEventSimple* anEvent)
309 {
310  // Running over data only in this method.
311  
312  // a) Check all pointers used in this method;
313  // b) Define local variables;
314  // c) Fill the common control histograms and call the method to fill fAvMultiplicity;
315  // d) Loop over data and calculate e-b-e quantities Q_{n,k}, S_{p,k} and s_{p,k};
316  // e) Calculate the final expressions for S_{p,k} and s_{p,k} (important !!!!); 
317  // f) Call the methods which calculate correlations for reference flow;
318  // g) Call the methods which calculate correlations for differential flow;
319  // h) Call the methods which calculate correlations for 2D differential flow;
320  // i) Call the methods which calculate other differential correlators;
321  // j) Distributions of correlations;
322  // k) Store phi distribution for one event to illustrate flow;
323  // l) Cross-check with nested loops correlators for reference flow;
324  // m) Cross-check with nested loops correlators for differential flow;
325  // n) Reset all event-by-event quantities (very important !!!!). 
326  
327  // a) Check all pointers used in this method:
328  this->CheckPointersUsedInMake();
329  
330  // b) Define local variables:
331  Double_t dPhi = 0.; // azimuthal angle in the laboratory frame
332  Double_t dPt  = 0.; // transverse momentum
333  Double_t dEta = 0.; // pseudorapidity
334  Double_t wPhi = 1.; // phi weight
335  Double_t wPt  = 1.; // pt weight
336  Double_t wEta = 1.; // eta weight
337  Double_t wTrack = 1.; // track weight
338  fNumberOfRPsEBE = anEvent->GetNumberOfRPs(); // number of RPs (i.e. number of reference particles)
339  fNumberOfPOIsEBE = anEvent->GetNumberOfPOIs(); // number of POIs (i.e. number of particles of interest)
340  fReferenceMultiplicityEBE = anEvent->GetReferenceMultiplicity(); // reference multiplicity for current event
341  Double_t ptEta[2] = {0.,0.}; // 0 = dPt, 1 = dEta
342   
343  // c) Fill the common control histograms and call the method to fill fAvMultiplicity:
344  this->FillCommonControlHistograms(anEvent);                                                               
345  this->FillAverageMultiplicities(fNumberOfRPsEBE); 
346  if(fStoreControlHistograms){this->FillControlHistograms(anEvent);}                                                              
347                                                                                                                                                                                                                                                                                         
348  // d) Loop over data and calculate e-b-e quantities Q_{n,k}, S_{p,k} and s_{p,k}:
349  Int_t nPrim = anEvent->NumberOfTracks();  // nPrim = total number of primary tracks
350
351  AliFlowTrackSimple *aftsTrack = NULL;
352  Int_t n = fHarmonic; // shortcut for the harmonic 
353  for(Int_t i=0;i<nPrim;i++) 
354  { 
355   aftsTrack=anEvent->GetTrack(i);
356   if(aftsTrack)
357   {
358    if(!(aftsTrack->InRPSelection() || aftsTrack->InPOISelection())){continue;} // safety measure: consider only tracks which are RPs or POIs
359    if(aftsTrack->InRPSelection()) // RP condition:
360    {    
361     dPhi = aftsTrack->Phi();
362     dPt  = aftsTrack->Pt();
363     dEta = aftsTrack->Eta();
364     if(fUsePhiWeights && fPhiWeights && fnBinsPhi) // determine phi weight for this particle:
365     {
366      wPhi = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*fnBinsPhi/TMath::TwoPi())));
367     }
368     if(fUsePtWeights && fPtWeights && fnBinsPt) // determine pt weight for this particle:
369     {
370      wPt = fPtWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-fPtMin)/fPtBinWidth))); 
371     }              
372     if(fUseEtaWeights && fEtaWeights && fEtaBinWidth) // determine eta weight for this particle: 
373     {
374      wEta = fEtaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-fEtaMin)/fEtaBinWidth))); 
375     }      
376     // Access track weight:
377     if(fUseTrackWeights)
378     {
379      wTrack = aftsTrack->Weight(); 
380     }
381     // Calculate Re[Q_{m*n,k}] and Im[Q_{m*n,k}] for this event (m = 1,2,...,12, k = 0,1,...,8):
382     for(Int_t m=0;m<12;m++) // to be improved - hardwired 6 
383     {
384      for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
385      {
386       (*fReQ)(m,k)+=pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1)*n*dPhi); 
387       (*fImQ)(m,k)+=pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1)*n*dPhi); 
388      } 
389     }
390     // Calculate S_{p,k} for this event (Remark: final calculation of S_{p,k} follows after the loop over data bellow):
391     for(Int_t p=0;p<8;p++)
392     {
393      for(Int_t k=0;k<9;k++)
394      {     
395       (*fSpk)(p,k)+=pow(wPhi*wPt*wEta*wTrack,k);
396      }
397     } 
398     // Differential flow:
399     if(fCalculateDiffFlow || fCalculate2DDiffFlow)
400     {
401      ptEta[0] = dPt; 
402      ptEta[1] = dEta; 
403      // Calculate r_{m*n,k} and s_{p,k} (r_{m,k} is 'p-vector' for RPs): 
404      for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
405      {
406       for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
407       {
408        if(fCalculateDiffFlow)
409        {
410         for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
411         {
412          fReRPQ1dEBE[0][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
413          fImRPQ1dEBE[0][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);          
414          if(m==0) // s_{p,k} does not depend on index m
415          {
416           fs1dEBE[0][pe][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k),1.);
417          } // end of if(m==0) // s_{p,k} does not depend on index m
418         } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
419        } // end of if(fCalculateDiffFlow) 
420        if(fCalculate2DDiffFlow)
421        {
422         fReRPQ2dEBE[0][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
423         fImRPQ2dEBE[0][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);      
424         if(m==0) // s_{p,k} does not depend on index m
425         {
426          fs2dEBE[0][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k),1.);
427         } // end of if(m==0) // s_{p,k} does not depend on index m
428        } // end of if(fCalculate2DDiffFlow)
429       } // end of for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
430      } // end of for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
431      // Checking if RP particle is also POI particle:      
432      if(aftsTrack->InPOISelection())
433      {
434       // Calculate q_{m*n,k} and s_{p,k} ('q-vector' and 's' for RPs && POIs): 
435       for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
436       {
437        for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
438        {
439         if(fCalculateDiffFlow)
440         {
441          for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
442          {
443           fReRPQ1dEBE[2][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
444           fImRPQ1dEBE[2][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);          
445           if(m==0) // s_{p,k} does not depend on index m
446           {
447            fs1dEBE[2][pe][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k),1.);
448           } // end of if(m==0) // s_{p,k} does not depend on index m
449          } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
450         } // end of if(fCalculateDiffFlow) 
451         if(fCalculate2DDiffFlow)
452         {
453          fReRPQ2dEBE[2][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
454          fImRPQ2dEBE[2][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);      
455          if(m==0) // s_{p,k} does not depend on index m
456          {
457           fs2dEBE[2][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k),1.);
458          } // end of if(m==0) // s_{p,k} does not depend on index m
459         } // end of if(fCalculate2DDiffFlow)
460        } // end of for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
461       } // end of for(Int_t k=0;k<9;k++) // to be improved - hardwired 9    
462      } // end of if(aftsTrack->InPOISelection())  
463     } // end of if(fCalculateDiffFlow || fCalculate2DDiffFlow)         
464    } // end of if(pTrack->InRPSelection())
465    if(aftsTrack->InPOISelection())
466    {
467     dPhi = aftsTrack->Phi();
468     dPt  = aftsTrack->Pt();
469     dEta = aftsTrack->Eta();
470     wPhi = 1.;
471     wPt  = 1.;
472     wEta = 1.;
473     wTrack = 1.;
474     if(fUsePhiWeights && fPhiWeights && fnBinsPhi && aftsTrack->InRPSelection()) // determine phi weight for POI && RP particle:
475     {
476      wPhi = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*fnBinsPhi/TMath::TwoPi())));
477     }
478     if(fUsePtWeights && fPtWeights && fnBinsPt && aftsTrack->InRPSelection()) // determine pt weight for POI && RP particle:
479     {
480      wPt = fPtWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-fPtMin)/fPtBinWidth))); 
481     }              
482     if(fUseEtaWeights && fEtaWeights && fEtaBinWidth && aftsTrack->InRPSelection()) // determine eta weight for POI && RP particle: 
483     {
484      wEta = fEtaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-fEtaMin)/fEtaBinWidth))); 
485     }      
486     // Access track weight for POI && RP particle:
487     if(aftsTrack->InRPSelection() && fUseTrackWeights)
488     {
489      wTrack = aftsTrack->Weight(); 
490     }
491     ptEta[0] = dPt;
492     ptEta[1] = dEta;
493     // Calculate p_{m*n,k} ('p-vector' for POIs): 
494     for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
495     {
496      for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
497      {
498       if(fCalculateDiffFlow)
499       {
500        for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
501        {
502         fReRPQ1dEBE[1][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
503         fImRPQ1dEBE[1][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);          
504        } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
505       } // end of if(fCalculateDiffFlow) 
506       if(fCalculate2DDiffFlow)
507       {
508        fReRPQ2dEBE[1][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
509        fImRPQ2dEBE[1][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);      
510       } // end of if(fCalculate2DDiffFlow)
511      } // end of for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
512     } // end of for(Int_t k=0;k<9;k++) // to be improved - hardwired 9    
513    } // end of if(pTrack->InPOISelection())    
514   } else // to if(aftsTrack)
515     {
516      printf("\n WARNING (QC): No particle (i.e. aftsTrack is a NULL pointer in AFAWQC::Make())!!!!\n\n");
517     }
518  } // end of for(Int_t i=0;i<nPrim;i++) 
519
520  // e) Calculate the final expressions for S_{p,k} and s_{p,k} (important !!!!):
521  for(Int_t p=0;p<8;p++)
522  {
523   for(Int_t k=0;k<9;k++)
524   {
525    (*fSpk)(p,k)=pow((*fSpk)(p,k),p+1);
526    // ... for the time being s_{p,k} dosn't need higher powers, so no need to finalize it here ...
527   } // end of for(Int_t k=0;k<9;k++)  
528  } // end of for(Int_t p=0;p<8;p++)
529  
530  // f) Call the methods which calculate correlations for reference flow:
531  if(!fEvaluateIntFlowNestedLoops)
532  {
533   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
534   {
535    if(fNumberOfRPsEBE>1){this->CalculateIntFlowCorrelations();} // without using particle weights
536   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
537     {
538      if(fNumberOfRPsEBE>1){this->CalculateIntFlowCorrelationsUsingParticleWeights();} // with using particle weights   
539     }        
540   // Whether or not using particle weights the following is calculated in the same way:  
541   if(fNumberOfRPsEBE>3){this->CalculateIntFlowProductOfCorrelations();}
542   if(fNumberOfRPsEBE>1){this->CalculateIntFlowSumOfEventWeights();}
543   if(fNumberOfRPsEBE>1){this->CalculateIntFlowSumOfProductOfEventWeights();}  
544   // Non-isotropic terms:
545   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
546   {
547    if(fNumberOfRPsEBE>0){this->CalculateIntFlowCorrectionsForNUASinTerms();}
548    if(fNumberOfRPsEBE>0){this->CalculateIntFlowCorrectionsForNUACosTerms();}
549   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
550     {
551      if(fNumberOfRPsEBE>0){this->CalculateIntFlowCorrectionsForNUASinTermsUsingParticleWeights();}
552      if(fNumberOfRPsEBE>0){this->CalculateIntFlowCorrectionsForNUACosTermsUsingParticleWeights();}     
553     }      
554   // Whether or not using particle weights the following is calculated in the same way:  
555   if(fNumberOfRPsEBE>0){this->CalculateIntFlowProductOfCorrectionTermsForNUA();}     
556   if(fNumberOfRPsEBE>0){this->CalculateIntFlowSumOfEventWeightsNUA();}     
557   if(fNumberOfRPsEBE>0){this->CalculateIntFlowSumOfProductOfEventWeightsNUA();}     
558   // Mixed harmonics:
559   if(fCalculateMixedHarmonics){this->CalculateMixedHarmonics();}
560  } // end of if(!fEvaluateIntFlowNestedLoops)
561
562  // g) Call the methods which calculate correlations for differential flow:
563  if(!fEvaluateDiffFlowNestedLoops && fCalculateDiffFlow)
564  {
565   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
566   {
567    // Without using particle weights:
568    this->CalculateDiffFlowCorrelations("RP","Pt"); 
569    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrelations("RP","Eta");}
570    this->CalculateDiffFlowCorrelations("POI","Pt");
571    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrelations("POI","Eta");}
572    // Non-isotropic terms:
573    this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Pt");
574    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Eta");}
575    this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Pt");
576    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Eta");}
577    this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Pt");
578    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Eta");}
579    this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Pt");
580    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Eta");}   
581   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
582     {
583      // With using particle weights:   
584      this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Pt"); 
585      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Eta");} 
586      this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Pt"); 
587      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Eta");} 
588      // Non-isotropic terms:
589      this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("RP","Pt");
590      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("RP","Eta");}
591      this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("POI","Pt");
592      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("POI","Eta");}
593      this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("RP","Pt");
594      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("RP","Eta");}
595      this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("POI","Pt");
596      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("POI","Eta");}   
597     }     
598   // Whether or not using particle weights the following is calculated in the same way:  
599   this->CalculateDiffFlowProductOfCorrelations("RP","Pt");
600   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowProductOfCorrelations("RP","Eta");}
601   this->CalculateDiffFlowProductOfCorrelations("POI","Pt");
602   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowProductOfCorrelations("POI","Eta");}
603   this->CalculateDiffFlowSumOfEventWeights("RP","Pt");
604   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowSumOfEventWeights("RP","Eta");}
605   this->CalculateDiffFlowSumOfEventWeights("POI","Pt");
606   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowSumOfEventWeights("POI","Eta");}
607   this->CalculateDiffFlowSumOfProductOfEventWeights("RP","Pt");
608   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowSumOfProductOfEventWeights("RP","Eta");}
609   this->CalculateDiffFlowSumOfProductOfEventWeights("POI","Pt");
610   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowSumOfProductOfEventWeights("POI","Eta");}   
611  } // end of if(!fEvaluateDiffFlowNestedLoops && fCalculateDiffFlow)
612
613  // h) Call the methods which calculate correlations for 2D differential flow:
614  if(!fEvaluateDiffFlowNestedLoops && fCalculate2DDiffFlow)
615  {
616   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
617   {
618    // Without using particle weights:
619    this->Calculate2DDiffFlowCorrelations("RP"); 
620    this->Calculate2DDiffFlowCorrelations("POI");
621    // Non-isotropic terms:
622    // ... to be ctd ...
623   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
624     {
625      // With using particle weights:   
626      // ... to be ctd ...  
627      // Non-isotropic terms:
628      // ... to be ctd ...
629     }     
630   // Whether or not using particle weights the following is calculated in the same way:  
631   // ... to be ctd ...   
632  } // end of if(!fEvaluateDiffFlowNestedLoops && fCalculate2DDiffFlow)
633  
634  // i) Call the methods which calculate other differential correlators:
635  if(!fEvaluateDiffFlowNestedLoops && fCalculateDiffFlow)
636  {
637   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
638   {
639    // Without using particle weights:
640    this->CalculateOtherDiffCorrelators("RP","Pt"); 
641    if(fCalculateDiffFlowVsEta){this->CalculateOtherDiffCorrelators("RP","Eta");}
642    this->CalculateOtherDiffCorrelators("POI","Pt"); 
643    if(fCalculateDiffFlowVsEta){this->CalculateOtherDiffCorrelators("POI","Eta");}     
644   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
645     {
646      // With using particle weights:   
647      // ... to be ctd ...  
648     }     
649   // Whether or not using particle weights the following is calculated in the same way:  
650   // ... to be ctd ...   
651  } // end of if(!fEvaluateDiffFlowNestedLoops)
652  
653  // j) Distributions of correlations:
654  if(fStoreDistributions){this->StoreDistributionsOfCorrelations();}
655  
656  // k) Store phi distribution for one event to illustrate flow: 
657  if(fStorePhiDistributionForOneEvent){this->StorePhiDistributionForOneEvent(anEvent);}
658    
659  // l) Cross-check with nested loops correlators for reference flow:
660  if(fEvaluateIntFlowNestedLoops){this->EvaluateIntFlowNestedLoops(anEvent);} 
661
662  // m) Cross-check with nested loops correlators for differential flow:
663  if(fEvaluateDiffFlowNestedLoops){this->EvaluateDiffFlowNestedLoops(anEvent);} 
664  
665  // n) Reset all event-by-event quantities (very important !!!!):
666  this->ResetEventByEventQuantities();
667  
668 } // end of AliFlowAnalysisWithQCumulants::Make(AliFlowEventSimple* anEvent)
669
670 //=======================================================================================================================
671
672 void AliFlowAnalysisWithQCumulants::Finish()
673 {
674  // Calculate the final results.
675  
676  // a) Check all pointers used in this method;
677  // b) Access the constants;
678  // c) Access the flags;
679  // d) Calculate reference cumulants (not corrected for detector effects);
680  // e) Correct reference cumulants for detector effects;
681  // f) Calculate reference flow;
682  // g) Store results for reference flow in AliFlowCommonHistResults and print them on the screen;
683  // h) Calculate the final results for differential flow (without/with weights);
684  // i) Correct the results for differential flow (without/with weights) for effects of non-uniform acceptance (NUA);
685  // j) Calculate the final results for integrated flow (RP/POI) and store in AliFlowCommonHistResults;
686  // k) Store results for differential flow in AliFlowCommonHistResults;
687  // l) Print the final results for integrated flow (RP/POI) on the screen; 
688  // m) Cross-checking: Results from Q-vectors vs results from nested loops;
689  // i) Calculate cumulants for mixed harmonics.
690
691  // a) Check all pointers used in this method:
692  this->CheckPointersUsedInFinish();
693   
694  // b) Access the constants:
695  this->CommonConstants("Finish");          
696  
697  if(fCommonHists && fCommonHists->GetHarmonic()) // to be improved (moved somewhere else)
698  {
699   fHarmonic = (Int_t)(fCommonHists->GetHarmonic())->GetBinContent(1);
700  } 
701  
702  // c) Access the flags: // to be improved (implement a method for this? should I store again the flags because they can get modified with redoFinish?)
703  fUsePhiWeights = (Bool_t)fUseParticleWeights->GetBinContent(1); 
704  fUsePtWeights = (Bool_t)fUseParticleWeights->GetBinContent(2); 
705  fUseEtaWeights = (Bool_t)fUseParticleWeights->GetBinContent(3);  
706  fUseTrackWeights = (Bool_t)fUseParticleWeights->GetBinContent(4);  
707  fApplyCorrectionForNUA = (Bool_t)fIntFlowFlags->GetBinContent(3); 
708  fPrintFinalResults[0] = (Bool_t)fIntFlowFlags->GetBinContent(4);
709  fPrintFinalResults[1] = (Bool_t)fIntFlowFlags->GetBinContent(5);
710  fPrintFinalResults[2] = (Bool_t)fIntFlowFlags->GetBinContent(6);
711  fPrintFinalResults[3] = (Bool_t)fIntFlowFlags->GetBinContent(7);
712  fApplyCorrectionForNUAVsM = (Bool_t)fIntFlowFlags->GetBinContent(8);  
713  fPropagateErrorAlsoFromNIT = (Bool_t)fIntFlowFlags->GetBinContent(9);  
714  fCalculateCumulantsVsM = (Bool_t)fIntFlowFlags->GetBinContent(10); 
715  fMinimumBiasReferenceFlow = (Bool_t)fIntFlowFlags->GetBinContent(11); 
716  fForgetAboutCovariances = (Bool_t)fIntFlowFlags->GetBinContent(12);
717  fStorePhiDistributionForOneEvent = (Bool_t)fIntFlowFlags->GetBinContent(13);
718  fFillMultipleControlHistograms = (Bool_t)fIntFlowFlags->GetBinContent(14); 
719  fCalculateAllCorrelationsVsM = (Bool_t)fIntFlowFlags->GetBinContent(15);
720  fEvaluateIntFlowNestedLoops = (Bool_t)fEvaluateNestedLoops->GetBinContent(1);
721  fEvaluateDiffFlowNestedLoops = (Bool_t)fEvaluateNestedLoops->GetBinContent(2); 
722  fCrossCheckInPtBinNo = (Int_t)fEvaluateNestedLoops->GetBinContent(3);
723  fCrossCheckInEtaBinNo = (Int_t)fEvaluateNestedLoops->GetBinContent(4); 
724  fCalculateMixedHarmonics = (Bool_t)fMixedHarmonicsFlags->GetBinContent(1);
725  //fHarmonic = (Int_t)fMixedHarmonicsFlags->GetBinContent(2); // TBI should I add inpdependent generic harmonic here?
726  fCalculateMixedHarmonicsVsM = (Bool_t)fMixedHarmonicsFlags->GetBinContent(3);
727
728  // d) Calculate reference cumulants (not corrected for detector effects):
729  this->FinalizeCorrelationsIntFlow();
730  this->CalculateCovariancesIntFlow();
731  this->CalculateCumulantsIntFlow();
732
733  // e) Correct reference cumulants for detector effects:
734  this->FinalizeCorrectionTermsForNUAIntFlow();
735  this->CalculateCovariancesNUAIntFlow(); 
736  this->CalculateQcumulantsCorrectedForNUAIntFlow();  
737
738  // f) Calculate reference flow:
739  this->CalculateReferenceFlow(); 
740   
741  // g) Store results for reference flow in AliFlowCommonHistResults and print them on the screen:
742  this->FillCommonHistResultsIntFlow();  
743  if(fPrintFinalResults[0]){this->PrintFinalResultsForIntegratedFlow("RF");}
744  if(fPrintFinalResults[3] && fCalculateCumulantsVsM){this->PrintFinalResultsForIntegratedFlow("RF, rebinned in M");}
745  
746  // h) Calculate the final results for differential flow (without/with weights):
747  if(fCalculateDiffFlow)
748  {
749   this->FinalizeReducedCorrelations("RP","Pt"); 
750   if(fCalculateDiffFlowVsEta){this->FinalizeReducedCorrelations("RP","Eta");} 
751   this->FinalizeReducedCorrelations("POI","Pt"); 
752   if(fCalculateDiffFlowVsEta){this->FinalizeReducedCorrelations("POI","Eta");}
753   this->CalculateDiffFlowCovariances("RP","Pt");
754   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCovariances("RP","Eta");}
755   this->CalculateDiffFlowCovariances("POI","Pt");
756   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCovariances("POI","Eta");}
757   this->CalculateDiffFlowCumulants("RP","Pt");
758   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCumulants("RP","Eta");}
759   this->CalculateDiffFlowCumulants("POI","Pt");
760   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCumulants("POI","Eta");}
761   this->CalculateDiffFlow("RP","Pt");
762   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlow("RP","Eta");}
763   this->CalculateDiffFlow("POI","Pt");
764   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlow("POI","Eta");}
765  } // if(fCalculateDiffFlow)
766  
767  // i) Correct the results for differential flow (without/with weights) for effects of non-uniform acceptance (NUA):
768  if(fCalculateDiffFlow)
769  {
770   this->FinalizeCorrectionTermsForNUADiffFlow("RP","Pt");
771   if(fCalculateDiffFlowVsEta){this->FinalizeCorrectionTermsForNUADiffFlow("RP","Eta");}
772   this->FinalizeCorrectionTermsForNUADiffFlow("POI","Pt");
773   if(fCalculateDiffFlowVsEta){this->FinalizeCorrectionTermsForNUADiffFlow("POI","Eta");}      
774   this->CalculateDiffFlowCumulantsCorrectedForNUA("RP","Pt");   
775   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCumulantsCorrectedForNUA("RP","Eta");}   
776   this->CalculateDiffFlowCumulantsCorrectedForNUA("POI","Pt");   
777   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCumulantsCorrectedForNUA("POI","Eta");}  
778   if(fApplyCorrectionForNUA)
779   {
780    this->CalculateDiffFlowCorrectedForNUA("RP","Pt"); 
781    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectedForNUA("RP","Eta");} 
782    this->CalculateDiffFlowCorrectedForNUA("POI","Pt"); 
783    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectedForNUA("POI","Eta");} 
784   }
785  } // end of if(fCalculateDiffFlow && fApplyCorrectionForNUA)
786  
787  // i) Calcualate final results for 2D differential flow: 
788  if(fCalculate2DDiffFlow)
789  {
790   this->Calculate2DDiffFlowCumulants("RP");
791   this->Calculate2DDiffFlowCumulants("POI");
792   this->Calculate2DDiffFlow("RP");  
793   this->Calculate2DDiffFlow("POI");  
794  } // end of if(fCalculate2DDiffFlow)
795     
796  // j) Calculate the final results for integrated flow (RP/POI) and store in AliFlowCommonHistResults:
797  if(fCalculateDiffFlow)
798  {
799   this->CalculateFinalResultsForRPandPOIIntegratedFlow("RP");
800   this->CalculateFinalResultsForRPandPOIIntegratedFlow("POI");
801  }
802  
803  // k) Store results for differential flow in AliFlowCommonHistResults:
804  if(fCalculateDiffFlow)
805  {
806   this->FillCommonHistResultsDiffFlow("RP");
807   this->FillCommonHistResultsDiffFlow("POI");
808  }
809  
810  // l) Print the final results for integrated flow (RP/POI) on the screen:
811  if(fPrintFinalResults[1] && fCalculateDiffFlow){this->PrintFinalResultsForIntegratedFlow("RP");} 
812  if(fPrintFinalResults[2] && fCalculateDiffFlow){this->PrintFinalResultsForIntegratedFlow("POI");}
813     
814  // m) Cross-checking: Results from Q-vectors vs results from nested loops:
815  //  m1) Reference flow:
816  if(fEvaluateIntFlowNestedLoops)
817  {
818   this->CrossCheckIntFlowCorrelations();
819   this->CrossCheckIntFlowCorrectionTermsForNUA(); 
820   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights){this->CrossCheckIntFlowExtraCorrelations();}
821   if(fCalculateMixedHarmonics){this->CrossCheckIntFlowCorrelations();}     
822  } // end of if(fEvaluateIntFlowNestedLoops)  
823  //  m2) Differential flow: 
824  if(fEvaluateDiffFlowNestedLoops && fCalculateDiffFlow) 
825  {
826   // Correlations:
827   this->PrintNumberOfParticlesInSelectedBin();
828   this->CrossCheckDiffFlowCorrelations("RP","Pt");  
829   if(fCalculateDiffFlowVsEta){this->CrossCheckDiffFlowCorrelations("RP","Eta");} 
830   this->CrossCheckDiffFlowCorrelations("POI","Pt");  
831   if(fCalculateDiffFlowVsEta){this->CrossCheckDiffFlowCorrelations("POI","Eta");}
832   // Correction terms for non-uniform acceptance:
833   this->CrossCheckDiffFlowCorrectionTermsForNUA("RP","Pt");      
834   if(fCalculateDiffFlowVsEta){this->CrossCheckDiffFlowCorrectionTermsForNUA("RP","Eta");}       
835   this->CrossCheckDiffFlowCorrectionTermsForNUA("POI","Pt");      
836   if(fCalculateDiffFlowVsEta){this->CrossCheckDiffFlowCorrectionTermsForNUA("POI","Eta");}
837   // Other differential correlators:       
838   this->CrossCheckOtherDiffCorrelators("RP","Pt");  
839   if(fCalculateDiffFlowVsEta){this->CrossCheckOtherDiffCorrelators("RP","Eta");} 
840   this->CrossCheckOtherDiffCorrelators("POI","Pt");  
841   if(fCalculateDiffFlowVsEta){this->CrossCheckOtherDiffCorrelators("POI","Eta");}
842  } // end of if(fEvaluateDiffFlowNestedLoops)
843                                                                                 
844  // i) Calculate cumulants for mixed harmonics: 
845  if(fCalculateMixedHarmonics){this->CalculateCumulantsMixedHarmonics();} 
846
847 } // end of AliFlowAnalysisWithQCumulants::Finish()
848
849 //=======================================================================================================================
850
851 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowNestedLoops(AliFlowEventSimple* anEvent)
852 {
853  // Evaluate all correlators for reference flow with nested loops.
854  
855  Int_t nPrim = anEvent->NumberOfTracks(); // number of primaries
856  if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity) // by default fMaxAllowedMultiplicity = 10 
857  {
858   // Without using particle weights:
859   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
860   {
861    // Correlations:
862    this->CalculateIntFlowCorrelations(); // from Q-vectors
863    this->EvaluateIntFlowCorrelationsWithNestedLoops(anEvent); // from nested loops (TBI: do I have to pass here anEvent or not?)
864    // Correction for non-uniform acceptance:
865    this->CalculateIntFlowCorrectionsForNUASinTerms(); // from Q-vectors (sin terms)
866    this->CalculateIntFlowCorrectionsForNUACosTerms(); // from Q-vectors (cos terms)
867    this->EvaluateIntFlowCorrectionsForNUAWithNestedLoops(anEvent); // from nested loops (both sin and cos terms)
868    // Mixed harmonics:
869    if(fCalculateMixedHarmonics)
870    {
871     this->CalculateMixedHarmonics(); // from Q-vectors  
872     this->EvaluateMixedHarmonicsWithNestedLoops(anEvent); // from nested loops (TBI: do I have to pass here anEvent or not?)
873    } // end of if(fCalculateMixedHarmonics)
874   }
875   // Using particle weights:
876   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
877   {
878    // Correlations
879    this->CalculateIntFlowCorrelationsUsingParticleWeights(); // from Q-vectors
880    this->EvaluateIntFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent); // from nested loops (to be improved: do I have to pass here anEvent or not?)
881    // Correction for non-uniform acceptance:
882    this->CalculateIntFlowCorrectionsForNUASinTermsUsingParticleWeights(); // from Q-vectors (sin terms)
883    this->CalculateIntFlowCorrectionsForNUACosTermsUsingParticleWeights(); // from Q-vectors (cos terms)
884    this->EvaluateIntFlowCorrectionsForNUAWithNestedLoopsUsingParticleWeights(anEvent); // from nested loops (both sin and cos terms)   
885   }
886  } else if(nPrim>fMaxAllowedMultiplicity) // to if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity)
887    {
888     cout<<endl;
889     cout<<"Skipping the event because multiplicity is "<<nPrim<<". Too high to evaluate nested loops!"<<endl;
890    } else
891      {
892       cout<<endl;
893       cout<<"Skipping the event because multiplicity is "<<nPrim<<"."<<endl;      
894      } 
895
896 } // end of void AliFlowAnalysisWithQCumulants::EvaluateIntFlowNestedLoops(AliFlowEventSimple* anEvent)
897
898 //=======================================================================================================================
899
900 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowNestedLoops(AliFlowEventSimple* anEvent)
901 {
902  // Evalauted all correlators for differential flow with nested loops.
903
904  if(!fCalculateDiffFlow){return;}
905
906  Int_t nPrim = anEvent->NumberOfTracks(); // number of primaries
907  if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity) // by default fMaxAllowedMultiplicity = 10
908  {
909   // Without using particle weights:
910   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
911   {
912    // 1.) Reduced correlations:
913    //  Q-vectors:
914    this->CalculateDiffFlowCorrelations("RP","Pt");
915    this->CalculateDiffFlowCorrelations("RP","Eta");
916    this->CalculateDiffFlowCorrelations("POI","Pt");
917    this->CalculateDiffFlowCorrelations("POI","Eta");
918    //  Nested loops:
919    this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"RP","Pt"); 
920    this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"RP","Eta"); 
921    this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"POI","Pt"); 
922    this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"POI","Eta"); 
923    // 2.) Reduced corrections for non-uniform acceptance:
924    //  Q-vectors:
925    this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Pt");
926    this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Eta");
927    this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Pt");
928    this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Eta");
929    this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Pt");
930    this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Eta");
931    this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Pt");
932    this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Eta");
933    //  Nested loops:
934    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"RP","Pt");
935    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"RP","Eta");
936    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"POI","Pt"); 
937    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"POI","Eta"); 
938    // 3.) Other differential correlators:
939    //  Q-vectors:
940    this->CalculateOtherDiffCorrelators("RP","Pt");
941    this->CalculateOtherDiffCorrelators("RP","Eta");
942    this->CalculateOtherDiffCorrelators("POI","Pt");
943    this->CalculateOtherDiffCorrelators("POI","Eta");   
944    //  Nested loops:
945    this->EvaluateOtherDiffCorrelatorsWithNestedLoops(anEvent,"RP","Pt");
946    this->EvaluateOtherDiffCorrelatorsWithNestedLoops(anEvent,"RP","Eta");
947    this->EvaluateOtherDiffCorrelatorsWithNestedLoops(anEvent,"POI","Pt");
948    this->EvaluateOtherDiffCorrelatorsWithNestedLoops(anEvent,"POI","Eta");   
949   } // end of if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
950   // Using particle weights:
951   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
952   {
953    this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Pt"); 
954    this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Eta"); 
955    this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Pt"); 
956    this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Eta"); 
957    this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("RP","Pt");
958    this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("RP","Eta");
959    this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("POI","Pt");
960    this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("POI","Eta");
961    this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("RP","Pt");
962    this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("RP","Eta");
963    this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("POI","Pt");
964    this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("POI","Eta");
965    this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"RP","Pt"); 
966    this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"RP","Eta");
967    this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"POI","Pt"); 
968    this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"POI","Eta");   
969    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(anEvent,"RP","Pt"); 
970    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(anEvent,"RP","Eta"); 
971    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(anEvent,"POI","Pt"); 
972    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(anEvent,"POI","Eta"); 
973   } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
974  } // end of if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity) // by default fMaxAllowedMultiplicity = 10
975
976 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowNestedLoops(AliFlowEventSimple* anEvent)
977
978 //=======================================================================================================================
979
980 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTerms()
981 {
982  // Calculate correction terms for non-uniform acceptance of the detector for reference flow (cos terms).
983  
984  // multiplicity:
985  Double_t dMult = (*fSpk)(0,0);
986  
987  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
988  Double_t dReQ1n = (*fReQ)(0,0);
989  Double_t dReQ2n = (*fReQ)(1,0);
990  //Double_t dReQ3n = (*fReQ)(2,0);
991  //Double_t dReQ4n = (*fReQ)(3,0);
992  Double_t dImQ1n = (*fImQ)(0,0);
993  Double_t dImQ2n = (*fImQ)(1,0);
994  //Double_t dImQ3n = (*fImQ)(2,0);
995  //Double_t dImQ4n = (*fImQ)(3,0);
996
997  // Multiplicity bin of an event (relevant for all histos vs M): 
998  Double_t dMultiplicityBin = 0.;
999  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
1000  {
1001   dMultiplicityBin = fNumberOfRPsEBE+0.5;
1002  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
1003    {
1004     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
1005    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
1006      {
1007       dMultiplicityBin = fNumberOfPOIsEBE+0.5;
1008      } 
1009
1010  //                                  *************************************************************
1011  //                                  **** corrections for non-uniform acceptance (cos terms): ****
1012  //                                  *************************************************************
1013  //
1014  // Remark 1: corrections for non-uniform acceptance (cos terms) calculated with non-weighted Q-vectors 
1015  //           are stored in 1D profile fQCorrectionsCos.
1016  // Remark 2: binning of fIntFlowCorrectionTermsForNUAPro[1] is organized as follows:
1017  // --------------------------------------------------------------------------------------------------------------------
1018  // 1st bin: <<cos(n*(phi1))>> = cosP1n
1019  // 2nd bin: <<cos(n*(phi1+phi2))>> = cosP1nP1n
1020  // 3rd bin: <<cos(n*(phi1-phi2-phi3))>> = cosP1nM1nM1n
1021  // 4th bin: <<cos(n*(2phi1-phi2))>> = cosP2nM1n
1022  // --------------------------------------------------------------------------------------------------------------------
1023   
1024  // 1-particle:
1025  Double_t cosP1n = 0.; // <<cos(n*(phi1))>>
1026    
1027  if(dMult>0)
1028  {
1029   cosP1n = dReQ1n/dMult; 
1030   
1031   // average non-weighted 1-particle correction (cos terms) for non-uniform acceptance for single event:
1032   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(1,cosP1n);
1033   // event weights for NUA terms:
1034   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->SetBinContent(1,dMult);
1035   
1036   // final average non-weighted 1-particle correction (cos terms) for non-uniform acceptance for all events:
1037   fIntFlowCorrectionTermsForNUAPro[1]->Fill(0.5,cosP1n,dMult);  
1038   if(fCalculateCumulantsVsM){fIntFlowCorrectionTermsForNUAVsMPro[1][0]->Fill(dMultiplicityBin,cosP1n,dMult);}    
1039  } 
1040  
1041  // 2-particle:
1042  Double_t cosP1nP1n = 0.; // <<cos(n*(phi1+phi2))>>
1043  Double_t cosP2nM1n = 0.; // <<cos(n*(2phi1-phi2))>>
1044  
1045  if(dMult>1)
1046  {
1047   cosP1nP1n = (pow(dReQ1n,2)-pow(dImQ1n,2)-dReQ2n)/(dMult*(dMult-1)); 
1048   cosP2nM1n = (dReQ2n*dReQ1n+dImQ2n*dImQ1n-dReQ1n)/(dMult*(dMult-1)); 
1049   
1050   // average non-weighted 2-particle correction (cos terms) for non-uniform acceptance for single event:
1051   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(2,cosP1nP1n);
1052   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(4,cosP2nM1n);
1053   // event weights for NUA terms:
1054   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->SetBinContent(2,dMult*(dMult-1));
1055   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->SetBinContent(4,dMult*(dMult-1));
1056       
1057   // final average non-weighted 2-particle correction (cos terms) for non-uniform acceptance for all events:
1058   fIntFlowCorrectionTermsForNUAPro[1]->Fill(1.5,cosP1nP1n,dMult*(dMult-1));  
1059   fIntFlowCorrectionTermsForNUAPro[1]->Fill(3.5,cosP2nM1n,dMult*(dMult-1));
1060   if(fCalculateCumulantsVsM)
1061   {
1062    fIntFlowCorrectionTermsForNUAVsMPro[1][1]->Fill(dMultiplicityBin,cosP1nP1n,dMult*(dMult-1));  
1063    fIntFlowCorrectionTermsForNUAVsMPro[1][3]->Fill(dMultiplicityBin,cosP2nM1n,dMult*(dMult-1));
1064   }
1065  } 
1066  
1067  // 3-particle:
1068  Double_t cosP1nM1nM1n = 0.; // <<cos(n*(phi1-phi2-phi3))>>
1069  
1070  if(dMult>2)
1071  {
1072   cosP1nM1nM1n = (dReQ1n*(pow(dReQ1n,2)+pow(dImQ1n,2))-dReQ1n*dReQ2n-dImQ1n*dImQ2n-2.*(dMult-1)*dReQ1n)
1073                / (dMult*(dMult-1)*(dMult-2)); 
1074   
1075   // average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for single event:
1076   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(3,cosP1nM1nM1n);
1077   // event weights for NUA terms:
1078   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->SetBinContent(3,dMult*(dMult-1)*(dMult-2));
1079   
1080   // final average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for all events:
1081   fIntFlowCorrectionTermsForNUAPro[1]->Fill(2.5,cosP1nM1nM1n,dMult*(dMult-1)*(dMult-2));
1082   if(fCalculateCumulantsVsM){fIntFlowCorrectionTermsForNUAVsMPro[1][2]->Fill(dMultiplicityBin,cosP1nM1nM1n,dMult*(dMult-1)*(dMult-2));}  
1083  } 
1084  
1085 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTerms()
1086
1087 //=======================================================================================================================
1088
1089 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTerms()
1090 {
1091  // calculate corrections for non-uniform acceptance of the detector for no-name integrated flow (sin terms)
1092  
1093  // multiplicity:
1094  Double_t dMult = (*fSpk)(0,0);
1095  
1096  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
1097  Double_t dReQ1n = (*fReQ)(0,0);
1098  Double_t dReQ2n = (*fReQ)(1,0);
1099  //Double_t dReQ3n = (*fReQ)(2,0);
1100  //Double_t dReQ4n = (*fReQ)(3,0);
1101  Double_t dImQ1n = (*fImQ)(0,0);
1102  Double_t dImQ2n = (*fImQ)(1,0);
1103  //Double_t dImQ3n = (*fImQ)(2,0);
1104  //Double_t dImQ4n = (*fImQ)(3,0);
1105         
1106  // Multiplicity bin of an event (relevant for all histos vs M): 
1107  Double_t dMultiplicityBin = 0.;
1108  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
1109  {
1110   dMultiplicityBin = fNumberOfRPsEBE+0.5;
1111  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
1112    {
1113     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
1114    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
1115      {
1116       dMultiplicityBin = fNumberOfPOIsEBE+0.5;
1117      } 
1118
1119  //                                  *************************************************************
1120  //                                  **** corrections for non-uniform acceptance (sin terms): ****
1121  //                                  *************************************************************
1122  //
1123  // Remark 1: corrections for non-uniform acceptance (sin terms) calculated with non-weighted Q-vectors 
1124  //           are stored in 1D profile fQCorrectionsSin.
1125  // Remark 2: binning of fIntFlowCorrectionTermsForNUAPro[0] is organized as follows:
1126  // --------------------------------------------------------------------------------------------------------------------
1127  // 1st bin: <<sin(n*(phi1))>> = sinP1n
1128  // 2nd bin: <<sin(n*(phi1+phi2))>> = sinP1nP1n
1129  // 3rd bin: <<sin(n*(phi1-phi2-phi3))>> = sinP1nM1nM1n
1130  // 4th bin: <<sin(n*(2phi1-phi2))>> = sinP2nM1n
1131  // --------------------------------------------------------------------------------------------------------------------
1132  
1133  // 1-particle:
1134  Double_t sinP1n = 0.; // <sin(n*(phi1))>
1135  
1136  if(dMult>0)
1137  {
1138   sinP1n = dImQ1n/dMult; 
1139      
1140   // average non-weighted 1-particle correction (sin terms) for non-uniform acceptance for single event:
1141   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(1,sinP1n);  
1142   // event weights for NUA terms:
1143   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->SetBinContent(1,dMult);
1144   
1145   // final average non-weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:   
1146   fIntFlowCorrectionTermsForNUAPro[0]->Fill(0.5,sinP1n,dMult);  
1147   if(fCalculateCumulantsVsM){fIntFlowCorrectionTermsForNUAVsMPro[0][0]->Fill(dMultiplicityBin,sinP1n,dMult);} 
1148  } 
1149  
1150  // 2-particle:
1151  Double_t sinP1nP1n = 0.; // <<sin(n*(phi1+phi2))>>
1152  Double_t sinP2nM1n = 0.; // <<sin(n*(2phi1-phi2))>>
1153  if(dMult>1)
1154  {
1155   sinP1nP1n = (2.*dReQ1n*dImQ1n-dImQ2n)/(dMult*(dMult-1)); 
1156   sinP2nM1n = (dImQ2n*dReQ1n-dReQ2n*dImQ1n-dImQ1n)/(dMult*(dMult-1)); 
1157      
1158   // average non-weighted 2-particle correction (sin terms) for non-uniform acceptance for single event:
1159   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(2,sinP1nP1n);
1160   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(4,sinP2nM1n);
1161   // event weights for NUA terms:
1162   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->SetBinContent(2,dMult*(dMult-1));
1163   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->SetBinContent(4,dMult*(dMult-1));
1164   
1165   // final average non-weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:      
1166   fIntFlowCorrectionTermsForNUAPro[0]->Fill(1.5,sinP1nP1n,dMult*(dMult-1));  
1167   fIntFlowCorrectionTermsForNUAPro[0]->Fill(3.5,sinP2nM1n,dMult*(dMult-1));  
1168   if(fCalculateCumulantsVsM)
1169   {
1170    fIntFlowCorrectionTermsForNUAVsMPro[0][1]->Fill(dMultiplicityBin,sinP1nP1n,dMult*(dMult-1));  
1171    fIntFlowCorrectionTermsForNUAVsMPro[0][3]->Fill(dMultiplicityBin,sinP2nM1n,dMult*(dMult-1));    
1172   }
1173  } 
1174  
1175  // 3-particle:
1176  Double_t sinP1nM1nM1n = 0.; // <<sin(n*(phi1-phi2-phi3))>>
1177  
1178  if(dMult>2)
1179  {
1180   sinP1nM1nM1n = (-dImQ1n*(pow(dReQ1n,2)+pow(dImQ1n,2))+dReQ1n*dImQ2n-dImQ1n*dReQ2n+2.*(dMult-1)*dImQ1n)
1181                / (dMult*(dMult-1)*(dMult-2)); 
1182   
1183   // average non-weighted 3-particle correction (sin terms) for non-uniform acceptance for single event:
1184   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(3,sinP1nM1nM1n);
1185   // event weights for NUA terms:
1186   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->SetBinContent(3,dMult*(dMult-1)*(dMult-2));
1187   
1188   // final average non-weighted 3-particle correction (sin terms) for non-uniform acceptance for all events:  
1189   fIntFlowCorrectionTermsForNUAPro[0]->Fill(2.5,sinP1nM1nM1n,dMult*(dMult-1)*(dMult-2));
1190   if(fCalculateCumulantsVsM){fIntFlowCorrectionTermsForNUAVsMPro[0][2]->Fill(dMultiplicityBin,sinP1nM1nM1n,dMult*(dMult-1)*(dMult-2));}  
1191  } 
1192  
1193 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTerms()
1194
1195 //=======================================================================================================================
1196
1197 void AliFlowAnalysisWithQCumulants::GetOutputHistograms(TList *outputListHistos)
1198 {
1199  // a) Get pointers for common control and common result histograms;
1200  // b) Get pointers for histograms holding particle weights;
1201  // c) Get pointers for reference flow histograms;
1202  // d) Get pointers for differential flow histograms;
1203  // e) Get pointers for 2D differential flow histograms;
1204  // f) Get pointers for other differential correlators;
1205  // g) Get pointers for nested loops' histograms;
1206  // h) Get pointers for mixed harmonics histograms.
1207  
1208  if(outputListHistos)
1209  {      
1210   this->SetHistList(outputListHistos);
1211   if(!fHistList)
1212   {
1213    printf("\n WARNING (QC): fHistList is NULL in AFAWQC::GOH() !!!!\n\n");
1214    exit(0);
1215   }
1216   this->GetPointersForCommonHistograms(); 
1217   this->GetPointersForParticleWeightsHistograms(); 
1218   this->GetPointersForIntFlowHistograms();
1219   this->GetPointersForDiffFlowHistograms(); 
1220   this->GetPointersFor2DDiffFlowHistograms(); 
1221   this->GetPointersForOtherDiffCorrelators();  
1222   this->GetPointersForMixedHarmonicsHistograms(); 
1223   this->GetPointersForNestedLoopsHistograms(); 
1224  } else 
1225    {
1226     printf("\n WARNING (QC): outputListHistos is NULL in AFAWQC::GOH() !!!!\n\n");
1227     exit(0);
1228    }
1229    
1230 } // end of void AliFlowAnalysisWithQCumulants::GetOutputHistograms(TList *outputListHistos)
1231
1232 //=======================================================================================================================
1233
1234 TProfile* AliFlowAnalysisWithQCumulants::MakePtProjection(TProfile2D *profilePtEta) const
1235 {
1236  // project 2D profile onto pt axis to get 1D profile
1237  
1238  Int_t nBinsPt   = profilePtEta->GetNbinsX();
1239  Double_t dPtMin = (profilePtEta->GetXaxis())->GetXmin();
1240  Double_t dPtMax = (profilePtEta->GetXaxis())->GetXmax();
1241  
1242  Int_t nBinsEta   = profilePtEta->GetNbinsY();
1243  
1244  TProfile *profilePt = new TProfile("","",nBinsPt,dPtMin,dPtMax); 
1245  
1246  for(Int_t p=1;p<=nBinsPt;p++)
1247  {
1248   Double_t contentPt = 0.;
1249   Double_t entryPt = 0.;
1250   Double_t spreadPt = 0.;
1251   Double_t sum1 = 0.;
1252   Double_t sum2 = 0.;
1253   Double_t sum3 = 0.;
1254   for(Int_t e=1;e<=nBinsEta;e++)
1255   {
1256    contentPt += (profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)))
1257               * (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1258    entryPt   += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1259    
1260    sum1 += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)))
1261          * (pow(profilePtEta->GetBinError(profilePtEta->GetBin(p,e)),2.)
1262             + pow(profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)),2.)); 
1263    sum2 += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1264    sum3 += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)))
1265          * (profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)));            
1266   }
1267   if(sum2>0. && sum1/sum2-pow(sum3/sum2,2.) > 0.)
1268   {
1269    spreadPt = pow(sum1/sum2-pow(sum3/sum2,2.),0.5);
1270   }
1271   profilePt->SetBinContent(p,contentPt);
1272   profilePt->SetBinEntries(p,entryPt);
1273   {
1274    profilePt->SetBinError(p,spreadPt);
1275   }
1276   
1277  }
1278  
1279  return profilePt;
1280  
1281 } // end of TProfile* AliFlowAnalysisWithQCumulants::MakePtProjection(TProfile2D *profilePtEta)
1282
1283
1284 //=======================================================================================================================
1285
1286
1287 TProfile* AliFlowAnalysisWithQCumulants::MakeEtaProjection(TProfile2D *profilePtEta) const
1288 {
1289  // project 2D profile onto eta axis to get 1D profile
1290  
1291  Int_t nBinsEta   = profilePtEta->GetNbinsY();
1292  Double_t dEtaMin = (profilePtEta->GetYaxis())->GetXmin();
1293  Double_t dEtaMax = (profilePtEta->GetYaxis())->GetXmax();
1294  
1295  Int_t nBinsPt = profilePtEta->GetNbinsX();
1296  
1297  TProfile *profileEta = new TProfile("","",nBinsEta,dEtaMin,dEtaMax); 
1298  
1299  for(Int_t e=1;e<=nBinsEta;e++)
1300  {
1301   Double_t contentEta = 0.;
1302   Double_t entryEta = 0.;
1303   for(Int_t p=1;p<=nBinsPt;p++)
1304   {
1305    contentEta += (profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)))
1306               * (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1307    entryEta   += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1308   }
1309   profileEta->SetBinContent(e,contentEta);
1310   profileEta->SetBinEntries(e,entryEta);
1311  }
1312  
1313  return profileEta;
1314  
1315 } // end of TProfile* AliFlowAnalysisWithQCumulants::MakeEtaProjection(TProfile2D *profilePtEta)
1316
1317 //=======================================================================================================================
1318
1319 void AliFlowAnalysisWithQCumulants::PrintFinalResultsForIntegratedFlow(TString type)
1320 {
1321  // Printing on the screen the final results for integrated flow (RF, POI and RP). 
1322  
1323  Int_t n = fHarmonic; 
1324  
1325  Double_t dVn[4] = {0.}; // array to hold Vn{2}, Vn{4}, Vn{6} and Vn{8}   
1326  Double_t dVnErr[4] = {0.}; // array to hold errors of Vn{2}, Vn{4}, Vn{6} and Vn{8}   
1327  
1328  if(type == "RF")
1329  {
1330   for(Int_t b=0;b<4;b++)
1331   {
1332    dVn[0] = (fCommonHistsResults2nd->GetHistIntFlow())->GetBinContent(1); 
1333    dVnErr[0] = (fCommonHistsResults2nd->GetHistIntFlow())->GetBinError(1); 
1334    dVn[1] = (fCommonHistsResults4th->GetHistIntFlow())->GetBinContent(1); 
1335    dVnErr[1] = (fCommonHistsResults4th->GetHistIntFlow())->GetBinError(1); 
1336    dVn[2] = (fCommonHistsResults6th->GetHistIntFlow())->GetBinContent(1); 
1337    dVnErr[2] = (fCommonHistsResults6th->GetHistIntFlow())->GetBinError(1); 
1338    dVn[3] = (fCommonHistsResults8th->GetHistIntFlow())->GetBinContent(1); 
1339    dVnErr[3] = (fCommonHistsResults8th->GetHistIntFlow())->GetBinError(1);    
1340   }  
1341  } else if(type == "RP")
1342    {
1343     dVn[0] = (fCommonHistsResults2nd->GetHistIntFlowRP())->GetBinContent(1); 
1344     dVnErr[0] = (fCommonHistsResults2nd->GetHistIntFlowRP())->GetBinError(1); 
1345     dVn[1] = (fCommonHistsResults4th->GetHistIntFlowRP())->GetBinContent(1); 
1346     dVnErr[1] = (fCommonHistsResults4th->GetHistIntFlowRP())->GetBinError(1); 
1347     dVn[2] = (fCommonHistsResults6th->GetHistIntFlowRP())->GetBinContent(1); 
1348     dVnErr[2] = (fCommonHistsResults6th->GetHistIntFlowRP())->GetBinError(1); 
1349     dVn[3] = (fCommonHistsResults8th->GetHistIntFlowRP())->GetBinContent(1); 
1350     dVnErr[3] = (fCommonHistsResults8th->GetHistIntFlowRP())->GetBinError(1); 
1351    } else if(type == "POI")
1352      {
1353       dVn[0] = (fCommonHistsResults2nd->GetHistIntFlowPOI())->GetBinContent(1); 
1354       dVnErr[0] = (fCommonHistsResults2nd->GetHistIntFlowPOI())->GetBinError(1); 
1355       dVn[1] = (fCommonHistsResults4th->GetHistIntFlowPOI())->GetBinContent(1); 
1356       dVnErr[1] = (fCommonHistsResults4th->GetHistIntFlowPOI())->GetBinError(1); 
1357       dVn[2] = (fCommonHistsResults6th->GetHistIntFlowPOI())->GetBinContent(1); 
1358       dVnErr[2] = (fCommonHistsResults6th->GetHistIntFlowPOI())->GetBinError(1); 
1359       dVn[3] = (fCommonHistsResults8th->GetHistIntFlowPOI())->GetBinContent(1); 
1360       dVnErr[3] = (fCommonHistsResults8th->GetHistIntFlowPOI())->GetBinError(1); 
1361      } else if(type == "RF, rebinned in M" && fCalculateCumulantsVsM)
1362        {
1363         for(Int_t b=0;b<4;b++)
1364         {
1365          dVn[b] = fIntFlowRebinnedInM->GetBinContent(b+1); 
1366          dVnErr[b] = fIntFlowRebinnedInM->GetBinError(b+1);
1367         }  
1368        }
1369  
1370  TString title = " flow estimates from Q-cumulants"; 
1371  TString subtitle = "    ("; 
1372  TString subtitle2 = "       (rebinned in M)"; 
1373  
1374  if(type != "RF, rebinned in M")
1375  {
1376   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
1377   {
1378    subtitle.Append(type);
1379    subtitle.Append(", without weights)");
1380   } else  
1381     {
1382      subtitle.Append(type);
1383      subtitle.Append(", with weights)");
1384     }
1385  } else
1386    {
1387     if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
1388     {
1389      subtitle.Append("RF");
1390      subtitle.Append(", without weights)");
1391     } else  
1392       {
1393        subtitle.Append("RF");
1394        subtitle.Append(", with weights)");      
1395       }
1396    } 
1397    
1398  cout<<endl;
1399  cout<<"*************************************"<<endl;
1400  cout<<"*************************************"<<endl;
1401  cout<<title.Data()<<endl; 
1402  cout<<subtitle.Data()<<endl; 
1403  if(type == "RF, rebinned in M"){cout<<subtitle2.Data()<<endl;}
1404  cout<<endl;
1405   
1406  for(Int_t i=0;i<4;i++)
1407  {
1408   cout<<"  v_"<<n<<"{"<<2*(i+1)<<"} = "<<dVn[i]<<" +/- "<<dVnErr[i]<<endl;
1409  }
1410  
1411  cout<<endl;
1412  if(type == "RF")
1413  {
1414   if(fApplyCorrectionForNUA)
1415   {
1416    cout<<" detector bias (corrected for): "<<endl;
1417   } else
1418     {
1419      cout<<" detector bias (not corrected for):"<<endl;  
1420     }
1421   cout<<"  to QC{2}: "<<fIntFlowDetectorBias->GetBinContent(1)<<" +/- "<<fIntFlowDetectorBias->GetBinError(1)<<endl;
1422   cout<<"  to QC{4}: "<<fIntFlowDetectorBias->GetBinContent(2)<<" +/- "<<fIntFlowDetectorBias->GetBinError(2)<<endl;
1423   cout<<endl;
1424  }
1425  if(type == "RF" || type == "RF, rebinned in M")
1426  {
1427   cout<<"     nEvts = "<<(Int_t)fCommonHists->GetHistMultRP()->GetEntries()<<", <M> = "<<(Double_t)fCommonHists->GetHistMultRP()->GetMean()<<endl; 
1428  }
1429  else if (type == "RP")
1430  {
1431   cout<<"     nEvts = "<<(Int_t)fCommonHists->GetHistMultRP()->GetEntries()<<", <M> = "<<(Double_t)fCommonHists->GetHistMultRP()->GetMean()<<endl;  
1432  } 
1433  else if (type == "POI")
1434  {
1435   cout<<"     nEvts = "<<(Int_t)fCommonHists->GetHistMultPOI()->GetEntries()<<", <M> = "<<(Double_t)fCommonHists->GetHistMultPOI()->GetMean()<<endl;
1436  }  
1437  
1438  cout<<"*************************************"<<endl;
1439  cout<<"*************************************"<<endl;
1440  cout<<endl; 
1441   
1442 }// end of AliFlowAnalysisWithQCumulants::PrintFinalResultsForIntegratedFlow(TString type="RF");
1443
1444 //=======================================================================================================================
1445
1446 void AliFlowAnalysisWithQCumulants::WriteHistograms(TString outputFileName)
1447 {
1448  //store the final results in output .root file
1449  TFile *output = new TFile(outputFileName.Data(),"RECREATE");
1450  //output->WriteObject(fHistList, "cobjQC","SingleKey");
1451  fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
1452  delete output;
1453 }
1454
1455
1456 //=======================================================================================================================
1457
1458
1459 void AliFlowAnalysisWithQCumulants::WriteHistograms(TDirectoryFile *outputFileName)
1460 {
1461  //store the final results in output .root file
1462  fHistList->SetName("cobjQC");
1463  fHistList->SetOwner(kTRUE);
1464  outputFileName->Add(fHistList);
1465  outputFileName->Write(outputFileName->GetName(), TObject::kSingleKey);
1466 }
1467
1468 //=======================================================================================================================
1469
1470 void AliFlowAnalysisWithQCumulants::BookCommonHistograms()
1471 {
1472  // Book common control histograms and common histograms for final results.
1473  //  a) Book common control histograms;
1474  //  b) Book common result histograms.
1475  
1476  // a) Book common control histograms: 
1477  //  Common control histograms (all events):
1478  TString commonHistsName = "AliFlowCommonHistQC";
1479  commonHistsName += fAnalysisLabel->Data();
1480  fCommonHists = new AliFlowCommonHist(commonHistsName.Data(),commonHistsName.Data(),fBookOnlyBasicCCH);
1481  fHistList->Add(fCommonHists);  
1482  //  Common control histograms (selected events):
1483  if(fFillMultipleControlHistograms)
1484  {
1485   // Common control histogram filled for events with 2 and more reference particles:
1486   TString commonHists2ndOrderName = "AliFlowCommonHist2ndOrderQC";
1487   commonHists2ndOrderName += fAnalysisLabel->Data();
1488   fCommonHists2nd = new AliFlowCommonHist(commonHists2ndOrderName.Data(),commonHists2ndOrderName.Data(),fBookOnlyBasicCCH);
1489   fHistList->Add(fCommonHists2nd);  
1490   // Common control histogram filled for events with 2 and more reference particles:
1491   TString commonHists4thOrderName = "AliFlowCommonHist4thOrderQC";
1492   commonHists4thOrderName += fAnalysisLabel->Data();
1493   fCommonHists4th = new AliFlowCommonHist(commonHists4thOrderName.Data(),commonHists4thOrderName.Data(),fBookOnlyBasicCCH);
1494   fHistList->Add(fCommonHists4th);  
1495   // Common control histogram filled for events with 6 and more reference particles:
1496   TString commonHists6thOrderName = "AliFlowCommonHist6thOrderQC";
1497   commonHists6thOrderName += fAnalysisLabel->Data();
1498   fCommonHists6th = new AliFlowCommonHist(commonHists6thOrderName.Data(),commonHists6thOrderName.Data(),fBookOnlyBasicCCH);
1499   fHistList->Add(fCommonHists6th);  
1500   // Common control histogram filled for events with 8 and more reference particles:
1501   TString commonHists8thOrderName = "AliFlowCommonHist8thOrderQC";
1502   commonHists8thOrderName += fAnalysisLabel->Data();
1503   fCommonHists8th = new AliFlowCommonHist(commonHists8thOrderName.Data(),commonHists8thOrderName.Data(),fBookOnlyBasicCCH);
1504   fHistList->Add(fCommonHists8th);    
1505  } // end of if(fFillMultipleControlHistograms)
1506  
1507  // b) Book common result histograms: 
1508  //  Common result histograms for QC{2}:
1509  TString commonHistResults2ndOrderName = "AliFlowCommonHistResults2ndOrderQC";
1510  commonHistResults2ndOrderName += fAnalysisLabel->Data();
1511  fCommonHistsResults2nd = new AliFlowCommonHistResults(commonHistResults2ndOrderName.Data(),"",fHarmonic);
1512  fHistList->Add(fCommonHistsResults2nd);  
1513  //  Common result histograms for QC{4}:
1514  TString commonHistResults4thOrderName = "AliFlowCommonHistResults4thOrderQC";
1515  commonHistResults4thOrderName += fAnalysisLabel->Data();
1516  fCommonHistsResults4th = new AliFlowCommonHistResults(commonHistResults4thOrderName.Data(),"",fHarmonic);
1517  fHistList->Add(fCommonHistsResults4th); 
1518  //  Common result histograms for QC{6}:
1519  TString commonHistResults6thOrderName = "AliFlowCommonHistResults6thOrderQC";
1520  commonHistResults6thOrderName += fAnalysisLabel->Data();
1521  fCommonHistsResults6th = new AliFlowCommonHistResults(commonHistResults6thOrderName.Data(),"",fHarmonic);
1522  fHistList->Add(fCommonHistsResults6th);  
1523  //  Common result histograms for QC{8}:
1524  TString commonHistResults8thOrderName = "AliFlowCommonHistResults8thOrderQC";
1525  commonHistResults8thOrderName += fAnalysisLabel->Data();
1526  fCommonHistsResults8th = new AliFlowCommonHistResults(commonHistResults8thOrderName.Data(),"",fHarmonic);
1527  fHistList->Add(fCommonHistsResults8th); 
1528  
1529 } // end of void AliFlowAnalysisWithQCumulants::BookCommonHistograms()
1530
1531 //=======================================================================================================================
1532
1533 void AliFlowAnalysisWithQCumulants::BookAndFillWeightsHistograms()
1534 {
1535  // Book and fill histograms which hold phi, pt and eta weights.
1536
1537  if(!fWeightsList)
1538  {
1539   printf("\n WARNING (QC): fWeightsList is NULL in AFAWQC::BAFWH() !!!! \n\n");
1540   exit(0);  
1541  }
1542     
1543  TString fUseParticleWeightsName = "fUseParticleWeightsQC";
1544  fUseParticleWeightsName += fAnalysisLabel->Data();
1545  fUseParticleWeights = new TProfile(fUseParticleWeightsName.Data(),"0 = particle weight not used, 1 = particle weight used ",4,0,4);
1546  fUseParticleWeights->SetLabelSize(0.06);
1547  fUseParticleWeights->SetStats(kFALSE);
1548  (fUseParticleWeights->GetXaxis())->SetBinLabel(1,"w_{#phi}");
1549  (fUseParticleWeights->GetXaxis())->SetBinLabel(2,"w_{p_{T}}");
1550  (fUseParticleWeights->GetXaxis())->SetBinLabel(3,"w_{#eta}");
1551  (fUseParticleWeights->GetXaxis())->SetBinLabel(4,"w_{track}");
1552  fUseParticleWeights->Fill(0.5,(Int_t)fUsePhiWeights);
1553  fUseParticleWeights->Fill(1.5,(Int_t)fUsePtWeights);
1554  fUseParticleWeights->Fill(2.5,(Int_t)fUseEtaWeights);
1555  fUseParticleWeights->Fill(3.5,(Int_t)fUseTrackWeights);
1556  fWeightsList->Add(fUseParticleWeights); 
1557   
1558  if(fUsePhiWeights)
1559  {
1560   if(fWeightsList->FindObject("phi_weights"))
1561   {
1562    fPhiWeights = dynamic_cast<TH1F*>(fWeightsList->FindObject("phi_weights"));
1563    if(!fPhiWeights)
1564    {
1565     printf("\n WARNING (QC): fPhiWeights is NULL in AFAWQC::BAFWH() !!!!\n\n");
1566     exit(0);
1567    }
1568    if(TMath::Abs(fPhiWeights->GetBinWidth(1)-fPhiBinWidth)>pow(10.,-6.))
1569    {
1570     cout<<endl;
1571     cout<<"WARNING (QC): Inconsistent binning in histograms for phi-weights throughout the code."<<endl;
1572     cout<<endl;
1573     //exit(0);
1574    }
1575   } else 
1576     {
1577      cout<<"WARNING: fWeightsList->FindObject(\"phi_weights\") is NULL in AFAWQC::BAFWH() !!!!"<<endl;
1578      exit(0);
1579     }
1580  } // end of if(fUsePhiWeights)
1581  
1582  if(fUsePtWeights) 
1583  {
1584   if(fWeightsList->FindObject("pt_weights"))
1585   {
1586    fPtWeights = dynamic_cast<TH1D*>(fWeightsList->FindObject("pt_weights"));
1587    if(!fPtWeights)
1588    {
1589     printf("\n WARNING (QC): fPtWeights is NULL in AFAWQC::BAFWH() !!!!\n\n");
1590     exit(0);
1591    }
1592    if(TMath::Abs(fPtWeights->GetBinWidth(1)-fPtBinWidth)>pow(10.,-6.))
1593    {
1594     cout<<endl;
1595     cout<<"WARNING (QC): Inconsistent binning in histograms for pt-weights throughout the code."<<endl;
1596     cout<<endl;
1597     //exit(0);
1598    }
1599   } else 
1600     {
1601      cout<<"WARNING: fWeightsList->FindObject(\"pt_weights\") is NULL in AFAWQC::BAFWH() !!!!"<<endl;
1602      exit(0);
1603     }
1604  } // end of if(fUsePtWeights)    
1605
1606  if(fUseEtaWeights) 
1607  {
1608   if(fWeightsList->FindObject("eta_weights"))
1609   {
1610    fEtaWeights = dynamic_cast<TH1D*>(fWeightsList->FindObject("eta_weights"));
1611    if(!fEtaWeights)
1612    {
1613     printf("\n WARNING (QC): fEtaWeights is NULL in AFAWQC::BAFWH() !!!!\n\n");
1614     exit(0);
1615    }
1616    if(TMath::Abs(fEtaWeights->GetBinWidth(1)-fEtaBinWidth)>pow(10.,-6.))
1617    {
1618     cout<<endl;
1619     cout<<"WARNING (QC): Inconsistent binning in histograms for eta-weights throughout the code."<<endl;
1620     cout<<endl;
1621     //exit(0);
1622    }
1623   } else 
1624     {
1625      cout<<"WARNING: fUseEtaWeights && fWeightsList->FindObject(\"eta_weights\") is NULL in AFAWQC::BAFWH() !!!!"<<endl;
1626      exit(0);
1627     }
1628  } // end of if(fUseEtaWeights)
1629  
1630 } // end of AliFlowAnalysisWithQCumulants::BookAndFillWeightsHistograms()
1631
1632 //=======================================================================================================================
1633
1634 void AliFlowAnalysisWithQCumulants::BookEverythingForIntegratedFlow()
1635 {
1636  // Book all objects for integrated flow:
1637  //  a) Book profile to hold all flags for integrated flow;
1638  //  b) Book event-by-event quantities;
1639  //  c) Book profiles; // to be improved (comment)
1640  //  d) Book histograms holding the final results.
1641  
1642  TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data members?)
1643  TString powerFlag[2] = {"linear","quadratic"}; // to be improved (should I promote this to data members?)
1644  
1645  // a) Book profile to hold all flags for integrated flow:
1646  TString intFlowFlagsName = "fIntFlowFlags";
1647  intFlowFlagsName += fAnalysisLabel->Data();
1648  fIntFlowFlags = new TProfile(intFlowFlagsName.Data(),"Flags for Integrated Flow",16,0.,16.);
1649  fIntFlowFlags->SetTickLength(-0.01,"Y");
1650  fIntFlowFlags->SetMarkerStyle(25);
1651  fIntFlowFlags->SetLabelSize(0.04);
1652  fIntFlowFlags->SetLabelOffset(0.02,"Y");
1653  fIntFlowFlags->SetStats(kFALSE);
1654  fIntFlowFlags->GetXaxis()->SetBinLabel(1,"Particle Weights");
1655  fIntFlowFlags->GetXaxis()->SetBinLabel(2,"Event Weights");
1656  fIntFlowFlags->GetXaxis()->SetBinLabel(3,"Corrected for NUA?");
1657  fIntFlowFlags->GetXaxis()->SetBinLabel(4,"Print RF results");
1658  fIntFlowFlags->GetXaxis()->SetBinLabel(5,"Print RP results");
1659  fIntFlowFlags->GetXaxis()->SetBinLabel(6,"Print POI results");
1660  fIntFlowFlags->GetXaxis()->SetBinLabel(7,"Print RF (rebinned in M) results");
1661  fIntFlowFlags->GetXaxis()->SetBinLabel(8,"Corrected for NUA vs M?");
1662  fIntFlowFlags->GetXaxis()->SetBinLabel(9,"Propagate errors to v_{n} from correlations?");
1663  fIntFlowFlags->GetXaxis()->SetBinLabel(10,"Calculate cumulants vs M");
1664  fIntFlowFlags->GetXaxis()->SetBinLabel(11,"fMinimumBiasReferenceFlow");
1665  fIntFlowFlags->GetXaxis()->SetBinLabel(12,"fForgetAboutCovariances");
1666  fIntFlowFlags->GetXaxis()->SetBinLabel(13,"fStorePhiDistributionForOneEvent");
1667  fIntFlowFlags->GetXaxis()->SetBinLabel(14,"fFillMultipleControlHistograms");
1668  fIntFlowFlags->GetXaxis()->SetBinLabel(15,"Calculate all correlations vs M");
1669  fIntFlowFlags->GetXaxis()->SetBinLabel(16,"fMultiplicityIs");
1670  fIntFlowList->Add(fIntFlowFlags);
1671
1672  // b) Book event-by-event quantities:
1673  // Re[Q_{m*n,k}], Im[Q_{m*n,k}] and S_{p,k}^M: 
1674  fReQ = new TMatrixD(12,9);
1675  fImQ = new TMatrixD(12,9);
1676  fSpk = new TMatrixD(8,9);
1677  // average correlations <2>, <4>, <6> and <8> for single event (bining is the same as in fIntFlowCorrelationsPro and fIntFlowCorrelationsHist):
1678  TString intFlowCorrelationsEBEName = "fIntFlowCorrelationsEBE";
1679  intFlowCorrelationsEBEName += fAnalysisLabel->Data();
1680  fIntFlowCorrelationsEBE = new TH1D(intFlowCorrelationsEBEName.Data(),intFlowCorrelationsEBEName.Data(),4,0,4);
1681  // weights for average correlations <2>, <4>, <6> and <8> for single event:
1682  TString intFlowEventWeightsForCorrelationsEBEName = "fIntFlowEventWeightsForCorrelationsEBE";
1683  intFlowEventWeightsForCorrelationsEBEName += fAnalysisLabel->Data();
1684  fIntFlowEventWeightsForCorrelationsEBE = new TH1D(intFlowEventWeightsForCorrelationsEBEName.Data(),intFlowEventWeightsForCorrelationsEBEName.Data(),4,0,4);
1685  // average all correlations for single event (bining is the same as in fIntFlowCorrelationsAllPro and fIntFlowCorrelationsAllHist):
1686  TString intFlowCorrelationsAllEBEName = "fIntFlowCorrelationsAllEBE";
1687  intFlowCorrelationsAllEBEName += fAnalysisLabel->Data();
1688  fIntFlowCorrelationsAllEBE = new TH1D(intFlowCorrelationsAllEBEName.Data(),intFlowCorrelationsAllEBEName.Data(),64,0,64);
1689  // average correction terms for non-uniform acceptance for single event 
1690  // (binning is the same as in fIntFlowCorrectionTermsForNUAPro[2] and fIntFlowCorrectionTermsForNUAHist[2]):
1691  TString fIntFlowCorrectionTermsForNUAEBEName = "fIntFlowCorrectionTermsForNUAEBE";
1692  fIntFlowCorrectionTermsForNUAEBEName += fAnalysisLabel->Data();
1693  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
1694  {
1695   fIntFlowCorrectionTermsForNUAEBE[sc] = new TH1D(Form("%s: %s terms",fIntFlowCorrectionTermsForNUAEBEName.Data(),sinCosFlag[sc].Data()),Form("Correction terms for non-uniform acceptance (%s terms)",sinCosFlag[sc].Data()),4,0,4);  
1696  }
1697  // event weights for terms for non-uniform acceptance: 
1698  TString fIntFlowEventWeightForCorrectionTermsForNUAEBEName = "fIntFlowEventWeightForCorrectionTermsForNUAEBE";
1699  fIntFlowEventWeightForCorrectionTermsForNUAEBEName += fAnalysisLabel->Data();
1700  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
1701  {
1702   fIntFlowEventWeightForCorrectionTermsForNUAEBE[sc] = new TH1D(Form("%s: %s terms",fIntFlowEventWeightForCorrectionTermsForNUAEBEName.Data(),sinCosFlag[sc].Data()),Form("Event weights for terms for non-uniform acceptance (%s terms)",sinCosFlag[sc].Data()),4,0,4); // to be improved - 4  
1703  }
1704  // c) Book profiles: // to be improved (comment)
1705  // profile to hold average multiplicities and number of events for events with nRP>=0, nRP>=1, ... , and nRP>=8:
1706  TString avMultiplicityName = "fAvMultiplicity";
1707  avMultiplicityName += fAnalysisLabel->Data();
1708  fAvMultiplicity = new TProfile(avMultiplicityName.Data(),"Average multiplicities of reference particles (RPs)",9,0,9);
1709  fAvMultiplicity->SetTickLength(-0.01,"Y");
1710  fAvMultiplicity->SetMarkerStyle(25);
1711  fAvMultiplicity->SetLabelSize(0.05);
1712  fAvMultiplicity->SetLabelOffset(0.02,"Y");
1713  fAvMultiplicity->SetYTitle("Average multiplicity");
1714  (fAvMultiplicity->GetXaxis())->SetBinLabel(1,"all evts");
1715  (fAvMultiplicity->GetXaxis())->SetBinLabel(2,"n_{RP} #geq 1");
1716  (fAvMultiplicity->GetXaxis())->SetBinLabel(3,"n_{RP} #geq 2");
1717  (fAvMultiplicity->GetXaxis())->SetBinLabel(4,"n_{RP} #geq 3");
1718  (fAvMultiplicity->GetXaxis())->SetBinLabel(5,"n_{RP} #geq 4");
1719  (fAvMultiplicity->GetXaxis())->SetBinLabel(6,"n_{RP} #geq 5");
1720  (fAvMultiplicity->GetXaxis())->SetBinLabel(7,"n_{RP} #geq 6");
1721  (fAvMultiplicity->GetXaxis())->SetBinLabel(8,"n_{RP} #geq 7");
1722  (fAvMultiplicity->GetXaxis())->SetBinLabel(9,"n_{RP} #geq 8");
1723  fIntFlowProfiles->Add(fAvMultiplicity);
1724  // Average correlations <<2>>, <<4>>, <<6>> and <<8>> for all events (with wrong errors!):
1725  TString correlationFlag[4] = {"#LT#LT2#GT#GT","#LT#LT4#GT#GT","#LT#LT6#GT#GT","#LT#LT8#GT#GT"};
1726  TString intFlowCorrelationsProName = "fIntFlowCorrelationsPro";
1727  intFlowCorrelationsProName += fAnalysisLabel->Data();
1728  fIntFlowCorrelationsPro = new TProfile(intFlowCorrelationsProName.Data(),"Average correlations for all events",4,0,4,"s");
1729  fIntFlowCorrelationsPro->Sumw2();
1730  fIntFlowCorrelationsPro->SetTickLength(-0.01,"Y");
1731  fIntFlowCorrelationsPro->SetMarkerStyle(25);
1732  fIntFlowCorrelationsPro->SetLabelSize(0.06);
1733  fIntFlowCorrelationsPro->SetLabelOffset(0.01,"Y");
1734  for(Int_t b=0;b<4;b++)
1735  {
1736   (fIntFlowCorrelationsPro->GetXaxis())->SetBinLabel(b+1,correlationFlag[b].Data());
1737  }
1738  fIntFlowProfiles->Add(fIntFlowCorrelationsPro);
1739  // Average correlations squared <<2>^2>, <<4>^2>, <<6>^2> and <<8>^2> for all events:
1740  TString squaredCorrelationFlag[4] = {"#LT#LT2#GT^{2}#GT","#LT#LT4#GT^{2}#GT","#LT#LT6#GT^{2}#GT","#LT#LT8#GT^{2}#GT"};
1741  TString intFlowSquaredCorrelationsProName = "fIntFlowSquaredCorrelationsPro";
1742  intFlowSquaredCorrelationsProName += fAnalysisLabel->Data();
1743  fIntFlowSquaredCorrelationsPro = new TProfile(intFlowSquaredCorrelationsProName.Data(),"Average squared correlations for all events",4,0,4,"s");
1744  fIntFlowSquaredCorrelationsPro->Sumw2();
1745  fIntFlowSquaredCorrelationsPro->SetTickLength(-0.01,"Y");
1746  fIntFlowSquaredCorrelationsPro->SetMarkerStyle(25);
1747  fIntFlowSquaredCorrelationsPro->SetLabelSize(0.06);
1748  fIntFlowSquaredCorrelationsPro->SetLabelOffset(0.01,"Y");
1749  for(Int_t b=0;b<4;b++)
1750  {
1751   (fIntFlowSquaredCorrelationsPro->GetXaxis())->SetBinLabel(b+1,squaredCorrelationFlag[b].Data());
1752  }
1753  fIntFlowProfiles->Add(fIntFlowSquaredCorrelationsPro);
1754  if(fCalculateCumulantsVsM)
1755  {
1756   for(Int_t ci=0;ci<4;ci++) // correlation index
1757   {
1758    // average correlations <<2>>, <<4>>, <<6>> and <<8>> versus multiplicity for all events (with wrong errors):
1759    TString intFlowCorrelationsVsMProName = "fIntFlowCorrelationsVsMPro";
1760    intFlowCorrelationsVsMProName += fAnalysisLabel->Data();
1761    fIntFlowCorrelationsVsMPro[ci] = new TProfile(Form("%s, %s",intFlowCorrelationsVsMProName.Data(),correlationFlag[ci].Data()),
1762                                                  Form("%s vs multiplicity",correlationFlag[ci].Data()),
1763                                                  fnBinsMult,fMinMult,fMaxMult,"s");   
1764    fIntFlowCorrelationsVsMPro[ci]->Sumw2();                                                                                       
1765    fIntFlowCorrelationsVsMPro[ci]->GetYaxis()->SetTitle(correlationFlag[ci].Data());
1766    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
1767    {
1768     fIntFlowCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("# RPs"); 
1769    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
1770      {
1771       fIntFlowCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
1772      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
1773        {
1774         fIntFlowCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("# POIs"); 
1775        } 
1776    fIntFlowProfiles->Add(fIntFlowCorrelationsVsMPro[ci]);
1777    // average squared correlations <<2>^2>, <<4>^2>, <<6>^2> and <<8>^2> versus multiplicity for all events:  
1778    TString intFlowSquaredCorrelationsVsMProName = "fIntFlowSquaredCorrelationsVsMPro";
1779    intFlowSquaredCorrelationsVsMProName += fAnalysisLabel->Data();
1780    fIntFlowSquaredCorrelationsVsMPro[ci] = new TProfile(Form("%s, %s",intFlowSquaredCorrelationsVsMProName.Data(),squaredCorrelationFlag[ci].Data()),
1781                                                         Form("%s vs multiplicity",squaredCorrelationFlag[ci].Data()),
1782                                                         fnBinsMult,fMinMult,fMaxMult,"s");   
1783    fIntFlowSquaredCorrelationsVsMPro[ci]->Sumw2();                                                                                              
1784    fIntFlowSquaredCorrelationsVsMPro[ci]->GetYaxis()->SetTitle(squaredCorrelationFlag[ci].Data());
1785    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
1786    {
1787     fIntFlowSquaredCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("# RPs");
1788    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
1789      {
1790       fIntFlowSquaredCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
1791      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
1792        {
1793         fIntFlowSquaredCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("# POIs");
1794        }
1795    fIntFlowProfiles->Add(fIntFlowSquaredCorrelationsVsMPro[ci]);
1796   } // end of for(Int_t ci=0;ci<4;ci++) // correlation index  
1797  } // end of if(fCalculateCumulantsVsM)
1798  // averaged all correlations for all events (with wrong errors!):
1799  TString intFlowCorrelationsAllProName = "fIntFlowCorrelationsAllPro";
1800  intFlowCorrelationsAllProName += fAnalysisLabel->Data();
1801  fIntFlowCorrelationsAllPro = new TProfile(intFlowCorrelationsAllProName.Data(),"Average all correlations for all events",64,0,64);
1802  fIntFlowCorrelationsAllPro->Sumw2();
1803  fIntFlowCorrelationsAllPro->SetTickLength(-0.01,"Y");
1804  fIntFlowCorrelationsAllPro->SetMarkerStyle(25);
1805  fIntFlowCorrelationsAllPro->SetLabelSize(0.03);
1806  fIntFlowCorrelationsAllPro->SetLabelOffset(0.01,"Y");
1807  // 2-p correlations:
1808  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(1,"#LT#LT2#GT#GT_{n|n}");
1809  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(2,"#LT#LT2#GT#GT_{2n|2n}");
1810  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(3,"#LT#LT2#GT#GT_{3n|3n}");
1811  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(4,"#LT#LT2#GT#GT_{4n|4n}");
1812  // 3-p correlations:
1813  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(6,"#LT#LT3#GT#GT_{2n|n,n}");
1814  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(7,"#LT#LT3#GT#GT_{3n|2n,n}");
1815  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(8,"#LT#LT3#GT#GT_{4n|2n,2n}");
1816  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(9,"#LT#LT3#GT#GT_{4n|3n,n}");
1817  // 4-p correlations:
1818  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(11,"#LT#LT4#GT#GT_{n,n|n,n}"); 
1819  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(12,"#LT#LT4#GT#GT_{2n,n|2n,n}");
1820  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(13,"#LT#LT4#GT#GT_{2n,2n|2n,2n}");
1821  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(14,"#LT#LT4#GT#GT_{3n|n,n,n}");
1822  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(15,"#LT#LT4#GT#GT_{3n,n|3n,n}");
1823  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(16,"#LT#LT4#GT#GT_{3n,n|2n,2n}"); 
1824  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(17,"#LT#LT4#GT#GT_{4n|2n,n,n}");
1825  // 5-p correlations:
1826  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(19,"#LT#LT5#GT#GT_{2n,n|n,n,n}"); 
1827  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(20,"#LT#LT5#GT#GT_{2n,2n|2n,n,n}");
1828  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(21,"#LT#LT5#GT#GT_{3n,n|2n,n,n}");
1829  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(22,"#LT#LT5#GT#GT_{4n|n,n,n,n}");
1830  // 6-p correlations:
1831  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(24,"#LT#LT6#GT#GT_{n,n,n|n,n,n}");
1832  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(25,"#LT#LT6#GT#GT_{2n,n,n|2n,n,n}");
1833  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(26,"#LT#LT6#GT#GT_{2n,2n|n,n,n,n}");
1834  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(27,"#LT#LT6#GT#GT_{3n,n|n,n,n,n}");
1835  // 7-p correlations:  
1836  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(29,"#LT#LT7#GT#GT_{2n,n,n|n,n,n,n}");
1837  // 8-p correlations:
1838  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(31,"#LT#LT8#GT#GT_{n,n,n,n|n,n,n,n}");
1839  //  EXTRA correlations for v3{5} study:
1840  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(33,"#LT#LT4#GT#GT_{4n,2n|3n,3n}");
1841  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(34,"#LT#LT5#GT#GT_{3n,3n|2n,2n,2n}");
1842  //  EXTRA correlations for Teaney-Yan study:
1843  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(35,"#LT#LT2#GT#GT_{5n|5n}");
1844  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(36,"#LT#LT2#GT#GT_{6n|6n}");
1845  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(37,"#LT#LT3#GT#GT_{5n|3n,2n}");
1846  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(38,"#LT#LT3#GT#GT_{5n|4n,1n}");
1847  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(39,"#LT#LT3#GT#GT_{6n|3n,3n}");
1848  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(40,"#LT#LT3#GT#GT_{6n|4n,2n}");
1849  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(41,"#LT#LT3#GT#GT_{6n|5n,1n}");
1850  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(42,"#LT#LT4#GT#GT_{6n|3n,2n,1n}");
1851  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(43,"#LT#LT4#GT#GT_{3n,2n|3n,2n}");
1852  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(44,"#LT#LT4#GT#GT_{4n,1n|3n,2n}");
1853  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(45,"#LT#LT4#GT#GT_{3n,3n|3n,3n}");
1854  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(46,"#LT#LT4#GT#GT_{4n,2n|3n,3n}");
1855  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(47,"#LT#LT4#GT#GT_{5n,1n|3n,3n}");
1856  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(48,"#LT#LT4#GT#GT_{4n,2n|4n,2n}");
1857  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(49,"#LT#LT4#GT#GT_{5n,1n|4n,2n}");
1858  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(50,"#LT#LT4#GT#GT_{5n|3n,1n,1n}");
1859  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(51,"#LT#LT4#GT#GT_{5n|2n,2n,1n}");
1860  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(52,"#LT#LT4#GT#GT_{5n,1n|5n,1n}");
1861  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(53,"#LT#LT5#GT#GT_{3n,3n|3n,2n,1n}");
1862  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(54,"#LT#LT5#GT#GT_{4n,2n|3n,2n,1n}");
1863  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(55,"#LT#LT5#GT#GT_{3n,2n|3n,1n,1n}");
1864  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(56,"#LT#LT5#GT#GT_{3n,2n|2n,2n,1n}");
1865  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(57,"#LT#LT5#GT#GT_{5n,1n|3n,2n,1n}");
1866  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(58,"#LT#LT6#GT#GT_{3n,2n,1n|3n,2n,1n}");
1867  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(59,"#LT#LT4#GT#GT_{6n|4n,1n,1n}");
1868  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(60,"#LT#LT4#GT#GT_{6n|2n,2n,2n}");
1869  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(61,"#LT#LT5#GT#GT_{6n|2n,2n,1n,1n}");
1870  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(62,"#LT#LT5#GT#GT_{4n,1n,1n|3n,3n}");
1871  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(63,"#LT#LT6#GT#GT_{3n,3n|2n,2n,1n,1n}");
1872  fIntFlowProfiles->Add(fIntFlowCorrelationsAllPro);
1873  // average all correlations versus multiplicity (errors via Sumw2 - to be improved):
1874  if(fCalculateAllCorrelationsVsM)
1875  {
1876   // 2-p correlations vs M:  
1877   fIntFlowCorrelationsAllVsMPro[0] = new TProfile("two1n1n","#LT#LT2#GT#GT_{n|n}",fnBinsMult,fMinMult,fMaxMult);
1878   fIntFlowCorrelationsAllVsMPro[1] = new TProfile("two2n2n","#LT#LT2#GT#GT_{2n|2n}",fnBinsMult,fMinMult,fMaxMult);
1879   fIntFlowCorrelationsAllVsMPro[2] = new TProfile("two3n3n","#LT#LT2#GT#GT_{3n|3n}",fnBinsMult,fMinMult,fMaxMult);
1880   fIntFlowCorrelationsAllVsMPro[3] = new TProfile("two4n4n","#LT#LT2#GT#GT_{4n|4n}",fnBinsMult,fMinMult,fMaxMult);
1881   // 3-p correlations vs M:
1882   fIntFlowCorrelationsAllVsMPro[5] = new TProfile("three2n1n1n","#LT#LT3#GT#GT_{2n|n,n}",fnBinsMult,fMinMult,fMaxMult);
1883   fIntFlowCorrelationsAllVsMPro[6] = new TProfile("three3n2n1n","#LT#LT3#GT#GT_{3n|2n,n}",fnBinsMult,fMinMult,fMaxMult);
1884   fIntFlowCorrelationsAllVsMPro[7] = new TProfile("three4n2n2n","#LT#LT3#GT#GT_{4n|2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1885   fIntFlowCorrelationsAllVsMPro[8] = new TProfile("three4n3n1n","#LT#LT3#GT#GT_{4n|3n,n}",fnBinsMult,fMinMult,fMaxMult);
1886   // 4-p correlations vs M:
1887   fIntFlowCorrelationsAllVsMPro[10] = new TProfile("four1n1n1n1n","#LT#LT4#GT#GT_{n,n|n,n}",fnBinsMult,fMinMult,fMaxMult);
1888   fIntFlowCorrelationsAllVsMPro[11] = new TProfile("four2n1n2n1n","#LT#LT4#GT#GT_{2n,n|2n,n}",fnBinsMult,fMinMult,fMaxMult);
1889   fIntFlowCorrelationsAllVsMPro[12] = new TProfile("four2n2n2n2n","#LT#LT4#GT#GT_{2n,2n|2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1890   fIntFlowCorrelationsAllVsMPro[13] = new TProfile("four3n1n1n1n","#LT#LT4#GT#GT_{3n|n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1891   fIntFlowCorrelationsAllVsMPro[14] = new TProfile("four3n1n3n1n","#LT#LT4#GT#GT_{3n,n|3n,n}",fnBinsMult,fMinMult,fMaxMult);
1892   fIntFlowCorrelationsAllVsMPro[15] = new TProfile("four3n1n2n2n","#LT#LT4#GT#GT_{3n,n|2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1893   fIntFlowCorrelationsAllVsMPro[16] = new TProfile("four4n2n1n1n","#LT#LT4#GT#GT_{4n|2n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1894   // 5-p correlations vs M:
1895   fIntFlowCorrelationsAllVsMPro[18] = new TProfile("five2n1n1n1n1n","#LT#LT5#GT#GT_{2n,n|n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1896   fIntFlowCorrelationsAllVsMPro[19] = new TProfile("five2n2n2n1n1n","#LT#LT5#GT#GT_{2n,2n|2n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1897   fIntFlowCorrelationsAllVsMPro[20] = new TProfile("five3n1n2n1n1n","#LT#LT5#GT#GT_{3n,n|2n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1898   fIntFlowCorrelationsAllVsMPro[21] = new TProfile("five4n1n1n1n1n","#LT#LT5#GT#GT_{4n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1899   // 6-p correlations vs M:
1900   fIntFlowCorrelationsAllVsMPro[23] = new TProfile("six1n1n1n1n1n1n","#LT#LT6#GT#GT_{n,n,n|n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1901   fIntFlowCorrelationsAllVsMPro[24] = new TProfile("six2n1n1n2n1n1n","#LT#LT6#GT#GT_{2n,n,n|2n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1902   fIntFlowCorrelationsAllVsMPro[25] = new TProfile("six2n2n1n1n1n1n","#LT#LT6#GT#GT_{2n,2n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1903   fIntFlowCorrelationsAllVsMPro[26] = new TProfile("six3n1n1n1n1n1n","#LT#LT6#GT#GT_{3n,n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1904   // 7-p correlations vs M:
1905   fIntFlowCorrelationsAllVsMPro[28] = new TProfile("seven2n1n1n1n1n1n1n","#LT#LT7#GT#GT_{2n,n,n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1906   // 8-p correlations vs M:
1907   fIntFlowCorrelationsAllVsMPro[30] = new TProfile("eight1n1n1n1n1n1n1n1n","#LT#LT8#GT#GT_{n,n,n,n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1908   // EXTRA correlations vs M for v3{5} study (to be improved - put them in a right order somewhere):
1909   fIntFlowCorrelationsAllVsMPro[32] = new TProfile("four4n2n3n3n","#LT#LT4#GT#GT_{4n,2n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1910   fIntFlowCorrelationsAllVsMPro[33] = new TProfile("five3n3n2n2n2n","#LT#LT5#GT#GT_{3n,3n|2n,2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1911   // EXTRA correlations vs M for Teaney-Yan study (to be improved - put them in a right order somewhere):
1912   fIntFlowCorrelationsAllVsMPro[34] = new TProfile("two5n5n","#LT#LT2#GT#GT_{5n|5n}",fnBinsMult,fMinMult,fMaxMult);
1913   fIntFlowCorrelationsAllVsMPro[35] = new TProfile("two6n6n","#LT#LT2#GT#GT_{6n|6n}",fnBinsMult,fMinMult,fMaxMult);
1914   fIntFlowCorrelationsAllVsMPro[36] = new TProfile("three5n3n2n","#LT#LT3#GT#GT_{5n|3n,2n}",fnBinsMult,fMinMult,fMaxMult);
1915   fIntFlowCorrelationsAllVsMPro[37] = new TProfile("three5n4n1n","#LT#LT3#GT#GT_{5n|4n,1n}",fnBinsMult,fMinMult,fMaxMult);
1916   fIntFlowCorrelationsAllVsMPro[38] = new TProfile("three6n3n3n","#LT#LT3#GT#GT_{6n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1917   fIntFlowCorrelationsAllVsMPro[39] = new TProfile("three6n4n2n","#LT#LT3#GT#GT_{6n|4n,2n}",fnBinsMult,fMinMult,fMaxMult);
1918   fIntFlowCorrelationsAllVsMPro[40] = new TProfile("three6n5n1n","#LT#LT3#GT#GT_{6n|5n,1n}",fnBinsMult,fMinMult,fMaxMult);
1919   fIntFlowCorrelationsAllVsMPro[41] = new TProfile("four6n3n2n1n","#LT#LT4#GT#GT_{6n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1920   fIntFlowCorrelationsAllVsMPro[42] = new TProfile("four3n2n3n2n","#LT#LT4#GT#GT_{3n,2n|3n,2n}",fnBinsMult,fMinMult,fMaxMult);
1921   fIntFlowCorrelationsAllVsMPro[43] = new TProfile("four4n1n3n2n","#LT#LT4#GT#GT_{4n,1n|3n,2n}",fnBinsMult,fMinMult,fMaxMult);
1922   fIntFlowCorrelationsAllVsMPro[44] = new TProfile("four3n3n3n3n","#LT#LT4#GT#GT_{3n,3n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1923   fIntFlowCorrelationsAllVsMPro[45] = new TProfile("four4n2n3n3n","#LT#LT4#GT#GT_{4n,2n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1924   fIntFlowCorrelationsAllVsMPro[46] = new TProfile("four5n1n3n3n","#LT#LT4#GT#GT_{5n,1n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1925   fIntFlowCorrelationsAllVsMPro[47] = new TProfile("four4n2n4n2n","#LT#LT4#GT#GT_{4n,2n|4n,2n}",fnBinsMult,fMinMult,fMaxMult);
1926   fIntFlowCorrelationsAllVsMPro[48] = new TProfile("four5n1n4n2n","#LT#LT4#GT#GT_{5n,1n|4n,2n}",fnBinsMult,fMinMult,fMaxMult);
1927   fIntFlowCorrelationsAllVsMPro[49] = new TProfile("four5n3n1n1n","#LT#LT4#GT#GT_{5n|3n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1928   fIntFlowCorrelationsAllVsMPro[50] = new TProfile("four5n2n2n1n","#LT#LT4#GT#GT_{5n|2n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1929   fIntFlowCorrelationsAllVsMPro[51] = new TProfile("four5n1n5n1n","#LT#LT4#GT#GT_{5n,1n|5n,1n}",fnBinsMult,fMinMult,fMaxMult);
1930   fIntFlowCorrelationsAllVsMPro[52] = new TProfile("five3n3n3n2n1n","#LT#LT5#GT#GT_{3n,3n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1931   fIntFlowCorrelationsAllVsMPro[53] = new TProfile("five4n2n3n2n1n","#LT#LT5#GT#GT_{4n,2n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1932   fIntFlowCorrelationsAllVsMPro[54] = new TProfile("five3n2n3n1n1n","#LT#LT5#GT#GT_{3n,2n|3n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1933   fIntFlowCorrelationsAllVsMPro[55] = new TProfile("five3n2n2n2n1n","#LT#LT5#GT#GT_{3n,2n|2n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1934   fIntFlowCorrelationsAllVsMPro[56] = new TProfile("five5n1n3n2n1n","#LT#LT5#GT#GT_{5n,1n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1935   fIntFlowCorrelationsAllVsMPro[57] = new TProfile("six3n2n1n3n2n1n","#LT#LT6#GT#GT_{3n,2n,1n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1936   fIntFlowCorrelationsAllVsMPro[58] = new TProfile("four6n4n1n1n","#LT#LT4#GT#GT_{6n|4n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1937   fIntFlowCorrelationsAllVsMPro[59] = new TProfile("four6n2n2n2n","#LT#LT4#GT#GT_{6n|2n,2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1938   fIntFlowCorrelationsAllVsMPro[60] = new TProfile("five6n2n2n1n1n","#LT#LT5#GT#GT_{6n|2n,2n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1939   fIntFlowCorrelationsAllVsMPro[61] = new TProfile("five4n1n1n3n3n","#LT#LT5#GT#GT_{4n,1n,1n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1940   fIntFlowCorrelationsAllVsMPro[62] = new TProfile("six3n3n2n2n1n1n","#LT#LT6#GT#GT_{3n,3n|2n,2n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1941   for(Int_t n=0;n<63;n++)
1942   {
1943    if(fIntFlowCorrelationsAllVsMPro[n])
1944    {
1945     fIntFlowCorrelationsAllVsMPro[n]->Sumw2();
1946     if(fMultiplicityIs==AliFlowCommonConstants::kRP)
1947     {
1948      fIntFlowCorrelationsAllVsMPro[n]->GetXaxis()->SetTitle("# RPs"); 
1949     } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
1950       {
1951        fIntFlowCorrelationsAllVsMPro[n]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
1952       } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
1953         {
1954          fIntFlowCorrelationsAllVsMPro[n]->GetXaxis()->SetTitle("# POIs");
1955         }
1956     fIntFlowAllCorrelationsVsM->Add(fIntFlowCorrelationsAllVsMPro[n]);
1957    } // end of if(fIntFlowCorrelationsAllVsMPro[n])
1958   } // end of for(Int_t n=0;n<63;n++)
1959  } // end of if(fCalculateAllCorrelationsVsM)
1960  // when particle weights are used some extra correlations appear:
1961  if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights) 
1962  {
1963   TString intFlowExtraCorrelationsProName = "fIntFlowExtraCorrelationsPro";
1964   intFlowExtraCorrelationsProName += fAnalysisLabel->Data();
1965   fIntFlowExtraCorrelationsPro = new TProfile(intFlowExtraCorrelationsProName.Data(),"Average extra correlations for all events",100,0,100,"s");
1966   fIntFlowExtraCorrelationsPro->SetTickLength(-0.01,"Y");
1967   fIntFlowExtraCorrelationsPro->SetMarkerStyle(25);
1968   fIntFlowExtraCorrelationsPro->SetLabelSize(0.03);
1969   fIntFlowExtraCorrelationsPro->SetLabelOffset(0.01,"Y");
1970   // extra 2-p correlations:
1971   (fIntFlowExtraCorrelationsPro->GetXaxis())->SetBinLabel(1,"<<w1^3 w2 cos(n*(phi1-phi2))>>");
1972   (fIntFlowExtraCorrelationsPro->GetXaxis())->SetBinLabel(2,"<<w1 w2 w3^2 cos(n*(phi1-phi2))>>");
1973   fIntFlowProfiles->Add(fIntFlowExtraCorrelationsPro);
1974  } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
1975  // average product of correlations <2>, <4>, <6> and <8>:  
1976  TString productFlag[6] = {"#LT#LT2#GT#LT4#GT#GT","#LT#LT2#GT#LT6#GT#GT","#LT#LT2#GT#LT8#GT#GT",
1977                            "#LT#LT4#GT#LT6#GT#GT","#LT#LT4#GT#LT8#GT#GT","#LT#LT6#GT#LT8#GT#GT"};
1978  TString intFlowProductOfCorrelationsProName = "fIntFlowProductOfCorrelationsPro";
1979  intFlowProductOfCorrelationsProName += fAnalysisLabel->Data();
1980  fIntFlowProductOfCorrelationsPro = new TProfile(intFlowProductOfCorrelationsProName.Data(),"Average products of correlations",6,0,6);
1981  fIntFlowProductOfCorrelationsPro->SetTickLength(-0.01,"Y");
1982  fIntFlowProductOfCorrelationsPro->SetMarkerStyle(25); 
1983  fIntFlowProductOfCorrelationsPro->SetLabelSize(0.05);
1984  fIntFlowProductOfCorrelationsPro->SetLabelOffset(0.01,"Y");
1985  for(Int_t b=0;b<6;b++)
1986  {
1987   (fIntFlowProductOfCorrelationsPro->GetXaxis())->SetBinLabel(b+1,productFlag[b].Data());
1988  }
1989  fIntFlowProfiles->Add(fIntFlowProductOfCorrelationsPro); 
1990  // average product of correlations <2>, <4>, <6> and <8> versus multiplicity
1991  // [0=<<2><4>>,1=<<2><6>>,2=<<2><8>>,3=<<4><6>>,4=<<4><8>>,5=<<6><8>>]  
1992  if(fCalculateCumulantsVsM)
1993  {
1994   TString intFlowProductOfCorrelationsVsMProName = "fIntFlowProductOfCorrelationsVsMPro";
1995   intFlowProductOfCorrelationsVsMProName += fAnalysisLabel->Data();
1996   for(Int_t pi=0;pi<6;pi++)
1997   { 
1998    fIntFlowProductOfCorrelationsVsMPro[pi] = new TProfile(Form("%s, %s",intFlowProductOfCorrelationsVsMProName.Data(),productFlag[pi].Data()),
1999                                                           Form("%s versus multiplicity",productFlag[pi].Data()),
2000                                                           fnBinsMult,fMinMult,fMaxMult);             
2001    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2002    {
2003     fIntFlowProductOfCorrelationsVsMPro[pi]->GetXaxis()->SetTitle("# RPs");
2004    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2005      {
2006       fIntFlowProductOfCorrelationsVsMPro[pi]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2007      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2008        {
2009         fIntFlowProductOfCorrelationsVsMPro[pi]->GetXaxis()->SetTitle("# POIs");
2010        }
2011    fIntFlowProfiles->Add(fIntFlowProductOfCorrelationsVsMPro[pi]);
2012   } // end of for(Int_t pi=0;pi<6;pi++)
2013  } // end of if(fCalculateCumulantsVsM) 
2014  // average product of correction terms for NUA:  
2015  TString intFlowProductOfCorrectionTermsForNUAProName = "fIntFlowProductOfCorrectionTermsForNUAPro";
2016  intFlowProductOfCorrectionTermsForNUAProName += fAnalysisLabel->Data();
2017  fIntFlowProductOfCorrectionTermsForNUAPro = new TProfile(intFlowProductOfCorrectionTermsForNUAProName.Data(),"Average products of correction terms for NUA",27,0,27);
2018  fIntFlowProductOfCorrectionTermsForNUAPro->SetTickLength(-0.01,"Y");
2019  fIntFlowProductOfCorrectionTermsForNUAPro->SetMarkerStyle(25); 
2020  fIntFlowProductOfCorrectionTermsForNUAPro->SetLabelSize(0.03);
2021  fIntFlowProductOfCorrectionTermsForNUAPro->SetLabelOffset(0.01,"Y");
2022  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(1,"<<2><cos(#phi)>>");
2023  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(2,"<<2><sin(#phi)>>");
2024  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(3,"<<cos(#phi)><sin(#phi)>>");
2025  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(4,"Cov(<2>,<cos(#phi_{1}+#phi_{2})>)");
2026  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(5,"Cov(<2>,<sin(#phi_{1}+#phi_{2})>)");
2027  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(6,"Cov(<2>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2028  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(7,"Cov(<2>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2029  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(8,"Cov(<4>,<cos(#phi)>)");
2030  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(9,"Cov(<4>,<sin(#phi)>)");
2031  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(10,"Cov(<4>,<cos(#phi_{1}+#phi_{2})>)");
2032  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(11,"Cov(<4>,<sin(#phi_{1}+#phi_{2})>)");
2033  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(12,"Cov(<4>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>>)");
2034  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(13,"Cov(<4>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>>)");
2035  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(14,"Cov(<cos(#phi)>,<cos(#phi_{1}+#phi_{2})>)"); 
2036  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(15,"Cov(<cos(#phi)>,<sin(#phi_{1}+#phi_{2})>)");
2037  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(16,"Cov(<cos(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2038  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(17,"Cov(<cos(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2039  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(18,"Cov(<sin(#phi)>,<cos(#phi_{1}+#phi_{2})>)");
2040  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(19,"Cov(<sin(#phi)>,<sin(#phi_{1}+#phi_{2})>)");
2041  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(20,"Cov(<sin(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2042  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(21,"Cov(<sin(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2043  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(22,"Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}+#phi_{2})>)");
2044  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(23,"Cov(<cos(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2045  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(24,"Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2046  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(25,"Cov(<sin(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2047  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(26,"Cov(<sin(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2048  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(27,"Cov(<cos(#phi_{1}-#phi_{2}-#phi_{3}>,<sin(#phi_{1}-#phi_{2}-#phi_{3}>)");
2049  fIntFlowProfiles->Add(fIntFlowProductOfCorrectionTermsForNUAPro);
2050  // average correction terms for non-uniform acceptance (with wrong errors!):
2051  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
2052  {
2053   TString intFlowCorrectionTermsForNUAProName = "fIntFlowCorrectionTermsForNUAPro";
2054   intFlowCorrectionTermsForNUAProName += fAnalysisLabel->Data();
2055   fIntFlowCorrectionTermsForNUAPro[sc] = new TProfile(Form("%s: %s terms",intFlowCorrectionTermsForNUAProName.Data(),sinCosFlag[sc].Data()),Form("Correction terms for non-uniform acceptance (%s terms)",sinCosFlag[sc].Data()),4,0,4,"s");
2056   fIntFlowCorrectionTermsForNUAPro[sc]->SetTickLength(-0.01,"Y");
2057   fIntFlowCorrectionTermsForNUAPro[sc]->SetMarkerStyle(25);
2058   fIntFlowCorrectionTermsForNUAPro[sc]->SetLabelSize(0.05);
2059   fIntFlowCorrectionTermsForNUAPro[sc]->SetLabelOffset(0.01,"Y");
2060   (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(1,Form("#LT#LT%s(n(#phi_{1}))#GT#GT",sinCosFlag[sc].Data()));
2061   (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(2,Form("#LT#LT%s(n(#phi_{1}+#phi_{2}))#GT#GT",sinCosFlag[sc].Data()));  
2062   (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(3,Form("#LT#LT%s(n(#phi_{1}-#phi_{2}-#phi_{3}))#GT#GT",sinCosFlag[sc].Data()));  
2063   (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(4,Form("#LT#LT%s(n(2#phi_{1}-#phi_{2}))#GT#GT",sinCosFlag[sc].Data()));  
2064   fIntFlowProfiles->Add(fIntFlowCorrectionTermsForNUAPro[sc]);
2065   // versus multiplicity:
2066   if(fCalculateCumulantsVsM)
2067   {
2068    TString correctionTermFlag[4] = {"(n(phi1))","(n(phi1+phi2))","(n(phi1-phi2-phi3))","(n(2phi1-phi2))"}; // to be improved - hardwired 4
2069    for(Int_t ci=0;ci<4;ci++) // correction term index (to be improved - hardwired 4)
2070    {
2071     TString intFlowCorrectionTermsForNUAVsMProName = "fIntFlowCorrectionTermsForNUAVsMPro";
2072     intFlowCorrectionTermsForNUAVsMProName += fAnalysisLabel->Data();
2073     fIntFlowCorrectionTermsForNUAVsMPro[sc][ci] = new TProfile(Form("%s: #LT#LT%s%s#GT#GT",intFlowCorrectionTermsForNUAVsMProName.Data(),sinCosFlag[sc].Data(),correctionTermFlag[ci].Data()),Form("#LT#LT%s%s#GT#GT vs M",sinCosFlag[sc].Data(),correctionTermFlag[ci].Data()),fnBinsMult,fMinMult,fMaxMult,"s");
2074     fIntFlowProfiles->Add(fIntFlowCorrectionTermsForNUAVsMPro[sc][ci]);
2075    }
2076   } // end of if(fCalculateCumulantsVsM)
2077  } // end of for(Int_t sc=0;sc<2;sc++) 
2078  
2079  // d) Book histograms holding the final results:
2080  // average correlations <<2>>, <<4>>, <<6>> and <<8>> for all events (with correct errors!):
2081  TString intFlowCorrelationsHistName = "fIntFlowCorrelationsHist";
2082  intFlowCorrelationsHistName += fAnalysisLabel->Data();
2083  fIntFlowCorrelationsHist = new TH1D(intFlowCorrelationsHistName.Data(),"Average correlations for all events",4,0,4);
2084  fIntFlowCorrelationsHist->SetTickLength(-0.01,"Y");
2085  fIntFlowCorrelationsHist->SetMarkerStyle(25);
2086  fIntFlowCorrelationsHist->SetLabelSize(0.06);
2087  fIntFlowCorrelationsHist->SetLabelOffset(0.01,"Y");
2088  (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(1,"#LT#LT2#GT#GT");
2089  (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(2,"#LT#LT4#GT#GT");
2090  (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(3,"#LT#LT6#GT#GT");
2091  (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(4,"#LT#LT8#GT#GT");
2092  fIntFlowResults->Add(fIntFlowCorrelationsHist);
2093  // average correlations <<2>>, <<4>>, <<6>> and <<8>> for all events (with correct errors!) vs M:
2094  if(fCalculateCumulantsVsM)
2095  {
2096   for(Int_t ci=0;ci<4;ci++) // correlation index
2097   {
2098    TString intFlowCorrelationsVsMHistName = "fIntFlowCorrelationsVsMHist";
2099    intFlowCorrelationsVsMHistName += fAnalysisLabel->Data();
2100    fIntFlowCorrelationsVsMHist[ci] = new TH1D(Form("%s, %s",intFlowCorrelationsVsMHistName.Data(),correlationFlag[ci].Data()),
2101                                               Form("%s vs multiplicity",correlationFlag[ci].Data()),
2102                                               fnBinsMult,fMinMult,fMaxMult);                                            
2103    fIntFlowCorrelationsVsMHist[ci]->GetYaxis()->SetTitle(correlationFlag[ci].Data());
2104    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2105    {
2106     fIntFlowCorrelationsVsMHist[ci]->GetXaxis()->SetTitle("# RPs");
2107    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2108      {
2109       fIntFlowCorrelationsVsMHist[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2110      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2111        {
2112         fIntFlowCorrelationsVsMHist[ci]->GetXaxis()->SetTitle("# POIs");
2113        }
2114    fIntFlowResults->Add(fIntFlowCorrelationsVsMHist[ci]);
2115   } // end of for(Int_t ci=0;ci<4;ci++) // correlation index   
2116  } // end of if(fCalculateCumulantsVsM) 
2117  // average all correlations for all events (with correct errors!):
2118  TString intFlowCorrelationsAllHistName = "fIntFlowCorrelationsAllHist";
2119  intFlowCorrelationsAllHistName += fAnalysisLabel->Data();
2120  fIntFlowCorrelationsAllHist = new TH1D(intFlowCorrelationsAllHistName.Data(),"Average correlations for all events",34,0,34);
2121  fIntFlowCorrelationsAllHist->SetTickLength(-0.01,"Y");
2122  fIntFlowCorrelationsAllHist->SetMarkerStyle(25);
2123  fIntFlowCorrelationsAllHist->SetLabelSize(0.03);
2124  fIntFlowCorrelationsAllHist->SetLabelOffset(0.01,"Y");
2125  // 2-p correlations:
2126  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(1,"<<2>>_{n|n}");
2127  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(2,"<<2>>_{2n|2n}");
2128  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(3,"<<2>>_{3n|3n}");
2129  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(4,"<<2>>_{4n|4n}");
2130  // 3-p correlations:
2131  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(6,"<<3>>_{2n|n,n}");
2132  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(7,"<<3>>_{3n|2n,n}");
2133  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(8,"<<3>>_{4n|2n,2n}");
2134  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(9,"<<3>>_{4n|3n,n}");
2135  // 4-p correlations:
2136  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(11,"<<4>>_{n,n|n,n}"); 
2137  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(12,"<<4>>_{2n,n|2n,n}");
2138  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(13,"<<4>>_{2n,2n|2n,2n}");
2139  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(14,"<<4>>_{3n|n,n,n}");
2140  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(15,"<<4>>_{3n,n|3n,n}");
2141  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(16,"<<4>>_{3n,n|2n,2n}"); 
2142  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(17,"<<4>>_{4n|2n,n,n}");
2143  // 5-p correlations:
2144  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(19,"<<5>>_{2n|n,n,n,n}"); 
2145  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(20,"<<5>>_{2n,2n|2n,n,n}");
2146  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(21,"<<5>>_{3n,n|2n,n,n}");
2147  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(22,"<<5>>_{4n|n,n,n,n}");
2148  // 6-p correlations:
2149  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(24,"<<6>>_{n,n,n|n,n,n}");
2150  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(25,"<<6>>_{2n,n,n|2n,n,n}");
2151  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(26,"<<6>>_{2n,2n|n,n,n,n}");
2152  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(27,"<<6>>_{3n,n|n,n,n,n}");
2153  // 7-p correlations:  
2154  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(29,"<<7>>_{2n,n,n|n,n,n,n}");
2155  // 8-p correlations:
2156  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(31,"<<8>>_{n,n,n,n|n,n,n,n}");
2157  fIntFlowResults->Add(fIntFlowCorrelationsAllHist);
2158  // average correction terms for non-uniform acceptance (with correct errors!):
2159  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
2160  {
2161   TString intFlowCorrectionTermsForNUAHistName = "fIntFlowCorrectionTermsForNUAHist";
2162   intFlowCorrectionTermsForNUAHistName += fAnalysisLabel->Data();
2163   fIntFlowCorrectionTermsForNUAHist[sc] = new TH1D(Form("%s: %s terms",intFlowCorrectionTermsForNUAHistName.Data(),sinCosFlag[sc].Data()),Form("Correction terms for non-uniform acceptance (%s terms)",sinCosFlag[sc].Data()),4,0,4);
2164   fIntFlowCorrectionTermsForNUAHist[sc]->SetTickLength(-0.01,"Y");
2165   fIntFlowCorrectionTermsForNUAHist[sc]->SetMarkerStyle(25);
2166   fIntFlowCorrectionTermsForNUAHist[sc]->SetLabelSize(0.05);
2167   fIntFlowCorrectionTermsForNUAHist[sc]->SetLabelOffset(0.01,"Y");
2168   (fIntFlowCorrectionTermsForNUAHist[sc]->GetXaxis())->SetBinLabel(1,Form("#LT#LT%s(n(#phi_{1}))#GT#GT",sinCosFlag[sc].Data()));
2169   (fIntFlowCorrectionTermsForNUAHist[sc]->GetXaxis())->SetBinLabel(2,Form("#LT#LT%s(n(#phi_{1}+#phi_{2}))#GT#GT",sinCosFlag[sc].Data()));  
2170   (fIntFlowCorrectionTermsForNUAHist[sc]->GetXaxis())->SetBinLabel(3,Form("#LT#LT%s(n(#phi_{1}-#phi_{2}-#phi_{3}))#GT#GT",sinCosFlag[sc].Data()));  
2171   (fIntFlowCorrectionTermsForNUAHist[sc]->GetXaxis())->SetBinLabel(4,Form("#LT#LT%s(n(2#phi_{1}-#phi_{2}))#GT#GT",sinCosFlag[sc].Data()));   
2172   fIntFlowResults->Add(fIntFlowCorrectionTermsForNUAHist[sc]);
2173  } // end of for(Int_t sc=0;sc<2;sc++) 
2174  // covariances (multiplied with weight dependent prefactor):
2175  TString intFlowCovariancesName = "fIntFlowCovariances";
2176  intFlowCovariancesName += fAnalysisLabel->Data();
2177  fIntFlowCovariances = new TH1D(intFlowCovariancesName.Data(),"Covariances (multiplied with weight dependent prefactor)",6,0,6);
2178  fIntFlowCovariances->SetLabelSize(0.04);
2179  fIntFlowCovariances->SetMarkerStyle(25);
2180  (fIntFlowCovariances->GetXaxis())->SetBinLabel(1,"Cov(#LT2#GT,#LT4#GT)");
2181  (fIntFlowCovariances->GetXaxis())->SetBinLabel(2,"Cov(#LT2#GT,#LT6#GT)");
2182  (fIntFlowCovariances->GetXaxis())->SetBinLabel(3,"Cov(#LT2#GT,#LT8#GT)");
2183  (fIntFlowCovariances->GetXaxis())->SetBinLabel(4,"Cov(#LT4#GT,#LT6#GT)");
2184  (fIntFlowCovariances->GetXaxis())->SetBinLabel(5,"Cov(#LT4#GT,#LT8#GT)");
2185  (fIntFlowCovariances->GetXaxis())->SetBinLabel(6,"Cov(#LT6#GT,#LT8#GT)");  
2186  fIntFlowResults->Add(fIntFlowCovariances);
2187  // sum of linear and quadratic event weights for <2>, <4>, <6> and <8>:
2188  TString intFlowSumOfEventWeightsName = "fIntFlowSumOfEventWeights";
2189  intFlowSumOfEventWeightsName += fAnalysisLabel->Data();
2190  for(Int_t power=0;power<2;power++)
2191  {
2192   fIntFlowSumOfEventWeights[power] = new TH1D(Form("%s: %s",intFlowSumOfEventWeightsName.Data(),powerFlag[power].Data()),Form("Sum of %s event weights for correlations",powerFlag[power].Data()),4,0,4);
2193   fIntFlowSumOfEventWeights[power]->SetLabelSize(0.04);
2194   fIntFlowSumOfEventWeights[power]->SetMarkerStyle(25);
2195   if(power == 0)
2196   {
2197    (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{#LT2#GT}");
2198    (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{#LT4#GT}");
2199    (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{#LT6#GT}");
2200    (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{#LT8#GT}");
2201   } else if (power == 1) 
2202     {
2203      (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{#LT2#GT}^{2}");
2204      (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{#LT4#GT}^{2}");
2205      (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{#LT6#GT}^{2}");
2206      (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{#LT8#GT}^{2}");
2207     }
2208   fIntFlowResults->Add(fIntFlowSumOfEventWeights[power]);
2209  } 
2210  // sum of products of event weights for correlations <2>, <4>, <6> and <8>:  
2211  TString intFlowSumOfProductOfEventWeightsName = "fIntFlowSumOfProductOfEventWeights";
2212  intFlowSumOfProductOfEventWeightsName += fAnalysisLabel->Data();
2213  fIntFlowSumOfProductOfEventWeights = new TH1D(intFlowSumOfProductOfEventWeightsName.Data(),"Sum of product of event weights for correlations",6,0,6);
2214  fIntFlowSumOfProductOfEventWeights->SetLabelSize(0.04);
2215  fIntFlowSumOfProductOfEventWeights->SetMarkerStyle(25);
2216  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LT4#GT}");
2217  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LT6#GT}");
2218  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LT8#GT}");
2219  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LT6#GT}");
2220  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(5,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LT8#GT}");
2221  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(6,"#sum_{i=1}^{N} w_{#LT6#GT} w_{#LT8#GT}");
2222  fIntFlowResults->Add(fIntFlowSumOfProductOfEventWeights);
2223  // final result for covariances of correlations (multiplied with weight dependent prefactor) versus M
2224  // [0=Cov(2,4),1=Cov(2,6),2=Cov(2,8),3=Cov(4,6),4=Cov(4,8),5=Cov(6,8)]:
2225  if(fCalculateCumulantsVsM)
2226  {
2227   TString intFlowCovariancesVsMName = "fIntFlowCovariancesVsM";
2228   intFlowCovariancesVsMName += fAnalysisLabel->Data();
2229   TString covarianceFlag[6] = {"Cov(<2>,<4>)","Cov(<2>,<6>)","Cov(<2>,<8>)","Cov(<4>,<6>)","Cov(<4>,<8>)","Cov(<6>,<8>)"};
2230   for(Int_t ci=0;ci<6;ci++)
2231   {
2232    fIntFlowCovariancesVsM[ci] = new TH1D(Form("%s, %s",intFlowCovariancesVsMName.Data(),covarianceFlag[ci].Data()),
2233                                          Form("%s vs multiplicity",covarianceFlag[ci].Data()),
2234                                          fnBinsMult,fMinMult,fMaxMult);
2235    fIntFlowCovariancesVsM[ci]->GetYaxis()->SetTitle(covarianceFlag[ci].Data());
2236    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2237    {
2238     fIntFlowCovariancesVsM[ci]->GetXaxis()->SetTitle("# RPs");
2239    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2240      {
2241       fIntFlowCovariancesVsM[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2242      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2243        {
2244         fIntFlowCovariancesVsM[ci]->GetXaxis()->SetTitle("# POIs");
2245        }
2246    fIntFlowResults->Add(fIntFlowCovariancesVsM[ci]);
2247   }
2248  } // end of if(fCalculateCumulantsVsM) 
2249  // sum of linear and quadratic event weights for <2>, <4>, <6> and <8> versus multiplicity
2250  // [0=sum{w_{<2>}},1=sum{w_{<4>}},2=sum{w_{<6>}},3=sum{w_{<8>}}][0=linear 1,1=quadratic]:
2251  if(fCalculateCumulantsVsM)
2252  {
2253   TString intFlowSumOfEventWeightsVsMName = "fIntFlowSumOfEventWeightsVsM";
2254   intFlowSumOfEventWeightsVsMName += fAnalysisLabel->Data();
2255   TString sumFlag[2][4] = {{"#sum_{i=1}^{N} w_{<2>}","#sum_{i=1}^{N} w_{<4>}","#sum_{i=1}^{N} w_{<6>}","#sum_{i=1}^{N} w_{<8>}"},
2256                            {"#sum_{i=1}^{N} w_{<2>}^{2}","#sum_{i=1}^{N} w_{<4>}^{2}","#sum_{i=1}^{N} w_{<6>}^{2}","#sum_{i=1}^{N} w_{<8>}^{2}"}};
2257   for(Int_t si=0;si<4;si++)
2258   {
2259    for(Int_t power=0;power<2;power++)
2260    {
2261     fIntFlowSumOfEventWeightsVsM[si][power] = new TH1D(Form("%s, %s",intFlowSumOfEventWeightsVsMName.Data(),sumFlag[power][si].Data()),
2262                                                        Form("%s vs multiplicity",sumFlag[power][si].Data()),
2263                                                        fnBinsMult,fMinMult,fMaxMult);    
2264     fIntFlowSumOfEventWeightsVsM[si][power]->GetYaxis()->SetTitle(sumFlag[power][si].Data());  
2265     if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2266     {
2267      fIntFlowSumOfEventWeightsVsM[si][power]->GetXaxis()->SetTitle("# RPs");
2268     } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2269       {
2270        fIntFlowSumOfEventWeightsVsM[si][power]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2271       } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2272         {
2273          fIntFlowSumOfEventWeightsVsM[si][power]->GetXaxis()->SetTitle("# POIs");
2274         }
2275     fIntFlowResults->Add(fIntFlowSumOfEventWeightsVsM[si][power]);
2276    } // end of for(Int_t power=0;power<2;power++)
2277   } // end of for(Int_t si=0;si<4;si++)   
2278  } // end of if(fCalculateCumulantsVsM)
2279  // sum of products of event weights for correlations <2>, <4>, <6> and <8> vs M
2280  // [0=sum{w_{<2>}w_{<4>}},1=sum{w_{<2>}w_{<6>}},2=sum{w_{<2>}w_{<8>}},
2281  //  3=sum{w_{<4>}w_{<6>}},4=sum{w_{<4>}w_{<8>}},5=sum{w_{<6>}w_{<8>}}]:  
2282  if(fCalculateCumulantsVsM)
2283  {
2284   TString intFlowSumOfProductOfEventWeightsVsMName = "fIntFlowSumOfProductOfEventWeightsVsM";
2285   intFlowSumOfProductOfEventWeightsVsMName += fAnalysisLabel->Data();
2286   TString sopowFlag[6] = {"#sum_{i=1}^{N} w_{<2>} w_{<4>}","#sum_{i=1}^{N} w_{<2>} w_{<6>}","#sum_{i=1}^{N} w_{<2>} w_{<8>}",
2287                           "#sum_{i=1}^{N} w_{<4>} w_{<6>}","#sum_{i=1}^{N} w_{<4>} w_{<8>}","#sum_{i=1}^{N} w_{<6>} w_{<8>}"}; 
2288   for(Int_t pi=0;pi<6;pi++)
2289   {
2290    fIntFlowSumOfProductOfEventWeightsVsM[pi] = new TH1D(Form("%s, %s",intFlowSumOfProductOfEventWeightsVsMName.Data(),sopowFlag[pi].Data()),
2291                                                         Form("%s versus multiplicity",sopowFlag[pi].Data()),
2292                                                         fnBinsMult,fMinMult,fMaxMult); 
2293    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2294    {
2295     fIntFlowSumOfProductOfEventWeightsVsM[pi]->GetXaxis()->SetTitle("# RPs"); 
2296    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2297      {
2298       fIntFlowSumOfProductOfEventWeightsVsM[pi]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2299      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2300        {
2301         fIntFlowSumOfProductOfEventWeightsVsM[pi]->GetXaxis()->SetTitle("# POIs");
2302        }
2303    fIntFlowSumOfProductOfEventWeightsVsM[pi]->GetYaxis()->SetTitle(sopowFlag[pi].Data()); 
2304    fIntFlowResults->Add(fIntFlowSumOfProductOfEventWeightsVsM[pi]);
2305   } // end of for(Int_t pi=0;pi<6;pi++) 
2306  } // end of if(fCalculateCumulantsVsM)
2307  // covariances of NUA terms (multiplied with weight dependent prefactor):
2308  TString intFlowCovariancesNUAName = "fIntFlowCovariancesNUA";
2309  intFlowCovariancesNUAName += fAnalysisLabel->Data();
2310  fIntFlowCovariancesNUA = new TH1D(intFlowCovariancesNUAName.Data(),"Covariances for NUA (multiplied with weight dependent prefactor)",27,0,27);
2311  fIntFlowCovariancesNUA->SetLabelSize(0.04);
2312  fIntFlowCovariancesNUA->SetMarkerStyle(25);
2313  fIntFlowCovariancesNUA->GetXaxis()->SetLabelSize(0.02);
2314  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(1,"Cov(<2>,<cos(#phi)>");
2315  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(2,"Cov(<2>,<sin(#phi)>)");
2316  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(3,"Cov(<cos(#phi)>,<sin(#phi)>)");
2317  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(4,"Cov(<2>,<cos(#phi_{1}+#phi_{2})>)");
2318  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(5,"Cov(<2>,<sin(#phi_{1}+#phi_{2})>)");
2319  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(6,"Cov(<2>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2320  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(7,"Cov(<2>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2321  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(8,"Cov(<4>,<cos(#phi)>)");
2322  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(9,"Cov(<4>,<sin(#phi)>)");
2323  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(10,"Cov(<4>,<cos(#phi_{1}+#phi_{2})>)");
2324  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(11,"Cov(<4>,<sin(#phi_{1}+#phi_{2})>)");
2325  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(12,"Cov(<4>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>>)");
2326  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(13,"Cov(<4>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>>)");
2327  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(14,"Cov(<cos(#phi)>,<cos(#phi_{1}+#phi_{2})>)"); 
2328  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(15,"Cov(<cos(#phi)>,<sin(#phi_{1}+#phi_{2})>)");
2329  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(16,"Cov(<cos(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2330  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(17,"Cov(<cos(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2331  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(18,"Cov(<sin(#phi)>,<cos(#phi_{1}+#phi_{2})>)");
2332  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(19,"Cov(<sin(#phi)>,<sin(#phi_{1}+#phi_{2})>)");
2333  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(20,"Cov(<sin(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2334  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(21,"Cov(<sin(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2335  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(22,"Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}+#phi_{2})>)");
2336  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(23,"Cov(<cos(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2337  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(24,"Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2338  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(25,"Cov(<sin(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2339  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(26,"Cov(<sin(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2340  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(27,"Cov(<cos(#phi_{1}-#phi_{2}-#phi_{3}>,<sin(#phi_{1}-#phi_{2}-#phi_{3}>)");
2341  fIntFlowResults->Add(fIntFlowCovariancesNUA);
2342  // sum of linear and quadratic event weights for NUA terms:
2343  TString intFlowSumOfEventWeightsNUAName = "fIntFlowSumOfEventWeightsNUA";
2344  intFlowSumOfEventWeightsNUAName += fAnalysisLabel->Data();
2345  for(Int_t sc=0;sc<2;sc++)
2346  {
2347   for(Int_t power=0;power<2;power++)
2348   {
2349    fIntFlowSumOfEventWeightsNUA[sc][power] = new TH1D(Form("%s: %s, %s",intFlowSumOfEventWeightsNUAName.Data(),powerFlag[power].Data(),sinCosFlag[sc].Data()),Form("Sum of %s event weights for NUA %s terms",powerFlag[power].Data(),sinCosFlag[sc].Data()),4,0,4); // to be improved - 4
2350    fIntFlowSumOfEventWeightsNUA[sc][power]->SetLabelSize(0.05);
2351    fIntFlowSumOfEventWeightsNUA[sc][power]->SetMarkerStyle(25);
2352    if(power == 0)
2353    {
2354     (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(1,Form("#sum_{i=1}^{N} w_{<%s(#phi)>}",sinCosFlag[sc].Data()));
2355     (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(2,Form("#sum_{i=1}^{N} w_{<%s(#phi_{1}+#phi_{2})>}",sinCosFlag[sc].Data()));
2356     (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(3,Form("#sum_{i=1}^{N} w_{<%s(#phi_{1}-#phi_{2}-#phi_{3})>}",sinCosFlag[sc].Data()));   
2357     (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(4,Form("#sum_{i=1}^{N} w_{<%s(2#phi_{1}-#phi_{2})>}",sinCosFlag[sc].Data()));
2358    } else if(power == 1) 
2359      {
2360       (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(1,Form("#sum_{i=1}^{N} w_{<%s(#phi)>}^{2}",sinCosFlag[sc].Data()));
2361       (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(2,Form("#sum_{i=1}^{N} w_{<%s(#phi_{1}+#phi_{2})>}^{2}",sinCosFlag[sc].Data()));
2362       (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(3,Form("#sum_{i=1}^{N} w_{<%s(#phi_{1}-#phi_{2}-#phi_{3})>}^{2}",sinCosFlag[sc].Data()));
2363       (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(4,Form("#sum_{i=1}^{N} w_{<%s(2#phi_{1}-#phi_{2})>}^{2}",sinCosFlag[sc].Data()));
2364      }
2365    fIntFlowResults->Add(fIntFlowSumOfEventWeightsNUA[sc][power]);
2366   }
2367  }  
2368  // sum of products of event weights for NUA terms:  
2369  TString intFlowSumOfProductOfEventWeightsNUAName = "fIntFlowSumOfProductOfEventWeightsNUA";
2370  intFlowSumOfProductOfEventWeightsNUAName += fAnalysisLabel->Data();
2371  fIntFlowSumOfProductOfEventWeightsNUA = new TH1D(intFlowSumOfProductOfEventWeightsNUAName.Data(),"Sum of product of event weights for NUA terms",27,0,27);
2372  fIntFlowSumOfProductOfEventWeightsNUA->SetLabelSize(0.02);
2373  fIntFlowSumOfProductOfEventWeightsNUA->SetMarkerStyle(25);
2374  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTcos(#phi)#GT}");
2375  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTsin(#phi)#GT}");
2376  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTsin(#phi)#GT}");
2377  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTcos(#phi_{1}+#phi_{2})#GT}");
2378  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(5,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2379  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(6,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2380  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(7,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2381  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(8,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTcos(#phi)#GT}");
2382  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(9,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTsin(#phi)#GT}");
2383  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(10,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTcos(#phi_{1}+#phi_{2})#GT}");
2384  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(11,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2385  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(12,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2386  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(13,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2387  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(14,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTcos(#phi_{1}+#phi_{2})#GT}");
2388  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(15,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2389  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(16,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2390  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(17,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2391  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(18,"#sum_{i=1}^{N} w_{#LTsin(#phi)#GT} w_{#LTcos(#phi_{1}+#phi_{2})#GT}");
2392  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(19,"#sum_{i=1}^{N} w_{#LTsin(#phi)#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2393  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(20,"#sum_{i=1}^{N} w_{#LTsin(#phi)#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2394  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(21,"#sum_{i=1}^{N} w_{#LTsin(#phi)#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2395  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(22,"#sum_{i=1}^{N} w_{#LTcos(#phi_{1}+#phi_{2})#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2396  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(23,"#sum_{i=1}^{N} w_{#LTcos(#phi_{1}+#phi_{2})#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2397  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(24,"#sum_{i=1}^{N} w_{#LTcos(#phi_{1}+#phi_{2})#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2398  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(25,"#sum_{i=1}^{N} w_{#LTsin(#phi_{1}+#phi_{2})#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2399  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(26,"#sum_{i=1}^{N} w_{#LTsin(#phi_{1}+#phi_{2})#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2400  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(27,"#sum_{i=1}^{N} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2401  fIntFlowResults->Add(fIntFlowSumOfProductOfEventWeightsNUA);
2402  // Final results for reference Q-cumulants:
2403  TString cumulantFlag[4] = {"QC{2}","QC{4}","QC{6}","QC{8}"};
2404  TString intFlowQcumulantsName = "fIntFlowQcumulants";
2405  intFlowQcumulantsName += fAnalysisLabel->Data();
2406  fIntFlowQcumulants = new TH1D(intFlowQcumulantsName.Data(),"Reference Q-cumulants",4,0,4);
2407  if(fPropagateErrorAlsoFromNIT)
2408  {
2409   fIntFlowQcumulants->SetTitle("Reference Q-cumulants (error from non-isotropic terms also propagated)");
2410  }
2411  fIntFlowQcumulants->SetLabelSize(0.05);
2412  fIntFlowQcumulants->SetMarkerStyle(25);
2413  for(Int_t b=0;b<4;b++)
2414  {
2415   (fIntFlowQcumulants->GetXaxis())->SetBinLabel(b+1,cumulantFlag[b].Data());
2416  } 
2417  fIntFlowResults->Add(fIntFlowQcumulants);
2418  // Final results for reference Q-cumulants rebinned in M: 
2419  if(fCalculateCumulantsVsM)
2420  {
2421   TString intFlowQcumulantsRebinnedInMName = "fIntFlowQcumulantsRebinnedInM";
2422   intFlowQcumulantsRebinnedInMName += fAnalysisLabel->Data();
2423   fIntFlowQcumulantsRebinnedInM = new TH1D(intFlowQcumulantsRebinnedInMName.Data(),"Reference Q-cumulants rebinned in M",4,0,4);
2424   fIntFlowQcumulantsRebinnedInM->SetLabelSize(0.05);
2425   fIntFlowQcumulantsRebinnedInM->SetMarkerStyle(25);
2426   for(Int_t b=0;b<4;b++)
2427   {
2428    (fIntFlowQcumulantsRebinnedInM->GetXaxis())->SetBinLabel(b+1,cumulantFlag[b].Data());
2429   } 
2430   fIntFlowResults->Add(fIntFlowQcumulantsRebinnedInM);
2431  } // end of if(fCalculateCumulantsVsM) 
2432  // Ratio between error squared: with/without non-isotropic terms:
2433  TString intFlowQcumulantsErrorSquaredRatioName = "fIntFlowQcumulantsErrorSquaredRatio";
2434  intFlowQcumulantsErrorSquaredRatioName += fAnalysisLabel->Data();
2435  fIntFlowQcumulantsErrorSquaredRatio = new TH1D(intFlowQcumulantsErrorSquaredRatioName.Data(),"Error squared of reference Q-cumulants: #frac{with NUA terms}{without NUA terms}",4,0,4);
2436  fIntFlowQcumulantsErrorSquaredRatio->SetLabelSize(0.05);
2437  fIntFlowQcumulantsErrorSquaredRatio->SetMarkerStyle(25);
2438  for(Int_t b=0;b<4;b++)
2439  {
2440   (fIntFlowQcumulantsErrorSquaredRatio->GetXaxis())->SetBinLabel(b+1,cumulantFlag[b].Data());
2441  } 
2442  fIntFlowResults->Add(fIntFlowQcumulantsErrorSquaredRatio);
2443  // final results for integrated Q-cumulants versus multiplicity:
2444  if(fCalculateCumulantsVsM)
2445  {
2446   TString intFlowQcumulantsVsMName = "fIntFlowQcumulantsVsM";
2447   intFlowQcumulantsVsMName += fAnalysisLabel->Data();
2448   for(Int_t co=0;co<4;co++) // cumulant order
2449   {
2450    fIntFlowQcumulantsVsM[co] = new TH1D(Form("%s, %s",intFlowQcumulantsVsMName.Data(),cumulantFlag[co].Data()),
2451                                         Form("%s vs multiplicity",cumulantFlag[co].Data()),
2452                                         fnBinsMult,fMinMult,fMaxMult);
2453    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2454    {
2455     fIntFlowQcumulantsVsM[co]->GetXaxis()->SetTitle("# RPs");
2456    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2457      {
2458       fIntFlowQcumulantsVsM[co]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2459      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2460        {
2461         fIntFlowQcumulantsVsM[co]->GetXaxis()->SetTitle("# POIs");
2462        }
2463    fIntFlowQcumulantsVsM[co]->GetYaxis()->SetTitle(cumulantFlag[co].Data());  
2464    fIntFlowResults->Add(fIntFlowQcumulantsVsM[co]);                                    
2465   } // end of for(Int_t co=0;co<4;co++) // cumulant order
2466  } // end of if(fCalculateCumulantsVsM)
2467  // final integrated flow estimates from Q-cumulants:
2468  TString flowFlag[4] = {Form("v_{%d}{2,QC}",fHarmonic),Form("v_{%d}{4,QC}",fHarmonic),Form("v_{%d}{6,QC}",fHarmonic),Form("v_{%d}{8,QC}",fHarmonic)};
2469  TString intFlowName = "fIntFlow";
2470  intFlowName += fAnalysisLabel->Data();  
2471  // integrated flow from Q-cumulants:
2472  fIntFlow = new TH1D(intFlowName.Data(),"Reference flow estimates from Q-cumulants",4,0,4);
2473  fIntFlow->SetLabelSize(0.05);
2474  fIntFlow->SetMarkerStyle(25);
2475  for(Int_t b=0;b<4;b++)
2476  {
2477   (fIntFlow->GetXaxis())->SetBinLabel(b+1,flowFlag[b].Data()); 
2478  }
2479  fIntFlowResults->Add(fIntFlow); 
2480  // Reference flow vs M rebinned in one huge bin:
2481  if(fCalculateCumulantsVsM)
2482  { 
2483   TString intFlowRebinnedInMName = "fIntFlowRebinnedInM";
2484   intFlowRebinnedInMName += fAnalysisLabel->Data();  
2485   fIntFlowRebinnedInM = new TH1D(intFlowRebinnedInMName.Data(),"Reference flow estimates from Q-cumulants (rebinned in M)",4,0,4);
2486   fIntFlowRebinnedInM->SetLabelSize(0.05);
2487   fIntFlowRebinnedInM->SetMarkerStyle(25);
2488   for(Int_t b=0;b<4;b++)
2489   {
2490    (fIntFlowRebinnedInM->GetXaxis())->SetBinLabel(b+1,flowFlag[b].Data()); 
2491   }
2492   fIntFlowResults->Add(fIntFlowRebinnedInM); 
2493  } 
2494  // integrated flow from Q-cumulants: versus multiplicity:
2495  if(fCalculateCumulantsVsM)
2496  {
2497   TString intFlowVsMName = "fIntFlowVsM";
2498   intFlowVsMName += fAnalysisLabel->Data();
2499   for(Int_t co=0;co<4;co++) // cumulant order
2500   {
2501    fIntFlowVsM[co] = new TH1D(Form("%s, %s",intFlowVsMName.Data(),flowFlag[co].Data()),
2502                               Form("%s vs multiplicity",flowFlag[co].Data()),
2503                               fnBinsMult,fMinMult,fMaxMult);
2504    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2505    {
2506     fIntFlowVsM[co]->GetXaxis()->SetTitle("# RPs");
2507    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2508      {
2509       fIntFlowVsM[co]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2510      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2511        {
2512         fIntFlowVsM[co]->GetXaxis()->SetTitle("# POIs"); 
2513        }
2514    fIntFlowVsM[co]->GetYaxis()->SetTitle(flowFlag[co].Data());  
2515    fIntFlowResults->Add(fIntFlowVsM[co]);                                    
2516   } // end of for(Int_t co=0;co<4;co++) // cumulant order
2517  } // end of if(fCalculateCumulantsVsM)
2518  // quantifying detector effects effects to correlations:
2519  TString intFlowDetectorBiasName = "fIntFlowDetectorBias";
2520  intFlowDetectorBiasName += fAnalysisLabel->Data();  
2521  fIntFlowDetectorBias = new TH1D(intFlowDetectorBiasName.Data(),"Quantifying detector bias",4,0,4);
2522  fIntFlowDetectorBias->SetLabelSize(0.05);
2523  fIntFlowDetectorBias->SetMarkerStyle(25);
2524  for(Int_t ci=0;ci<4;ci++)
2525  {  
2526   (fIntFlowDetectorBias->GetXaxis())->SetBinLabel(ci+1,Form("#frac{corrected}{measured} %s",cumulantFlag[ci].Data()));
2527  }
2528  fIntFlowResults->Add(fIntFlowDetectorBias); 
2529  // quantifying detector effects to correlations versus multiplicity:
2530  if(fCalculateCumulantsVsM)
2531  {
2532   TString intFlowDetectorBiasVsMName = "fIntFlowDetectorBiasVsM";
2533   intFlowDetectorBiasVsMName += fAnalysisLabel->Data();
2534   for(Int_t ci=0;ci<4;ci++) // correlation index
2535   {
2536    fIntFlowDetectorBiasVsM[ci] = new TH1D(Form("%s for %s",intFlowDetectorBiasVsMName.Data(),cumulantFlag[ci].Data()),
2537                                           Form("Quantifying detector bias for %s vs multiplicity",cumulantFlag[ci].Data()),
2538                                           fnBinsMult,fMinMult,fMaxMult);
2539    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2540    {
2541     fIntFlowDetectorBiasVsM[ci]->GetXaxis()->SetTitle("# RPs"); 
2542    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2543      {
2544       fIntFlowDetectorBiasVsM[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2545      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2546        {
2547         fIntFlowDetectorBiasVsM[ci]->GetXaxis()->SetTitle("# POIs");
2548        }
2549    fIntFlowDetectorBiasVsM[ci]->GetYaxis()->SetTitle("#frac{corrected}{measured}");  
2550    fIntFlowResults->Add(fIntFlowDetectorBiasVsM[ci]);                                    
2551   } // end of for(Int_t co=0;co<4;co++) // cumulant order
2552  } // end of if(fCalculateCumulantsVsM)
2553    
2554 } // end of AliFlowAnalysisWithQCumulants::BookEverythingForIntegratedFlow()
2555
2556 //=======================================================================================================================
2557
2558 void AliFlowAnalysisWithQCumulants::BookEverythingForControlHistograms()
2559 {
2560  // Book all objects for control histograms.
2561
2562  // a) Book profile to hold all flags for control histograms;
2563  // b) Book all control histograms.
2564
2565  // a) Book profile to hold all flags for control histograms:
2566  TString controlHistogramsFlagsName = "fControlHistogramsFlags";
2567  controlHistogramsFlagsName += fAnalysisLabel->Data();
2568  fControlHistogramsFlags = new TProfile(controlHistogramsFlagsName.Data(),"Flags for Control Histograms",3,0,3);
2569  fControlHistogramsFlags->SetTickLength(-0.01,"Y");
2570  fControlHistogramsFlags->SetMarkerStyle(25);
2571  fControlHistogramsFlags->SetLabelSize(0.04);
2572  fControlHistogramsFlags->SetLabelOffset(0.02,"Y");
2573  fControlHistogramsFlags->SetStats(kFALSE);
2574  fControlHistogramsFlags->GetXaxis()->SetBinLabel(1,"fCorrelationNoRPsVsRefMult");
2575  fControlHistogramsFlags->GetXaxis()->SetBinLabel(2,"fCorrelationNoPOIsVsRefMult");
2576  fControlHistogramsFlags->GetXaxis()->SetBinLabel(3,"fCorrelationNoRPsVsNoPOIs");
2577  fControlHistogramsList->Add(fControlHistogramsFlags);
2578
2579  if(!fStoreControlHistograms){return;}
2580
2581  // b) Book all control histograms:
2582  //  b1) Correlation between # RPs and ref. mult. determined centrally:
2583  TString sCorrelationNoRPsVsRefMultName = "fCorrelationNoRPsVsRefMult";
2584  sCorrelationNoRPsVsRefMultName += fAnalysisLabel->Data();
2585  fCorrelationNoRPsVsRefMult = new TH2D(sCorrelationNoRPsVsRefMultName.Data(),"# RPs vs. Reference Multiplicity",fnBinsMult,fMinMult,fMaxMult,fnBinsMult,fMinMult,fMaxMult);
2586  fCorrelationNoRPsVsRefMult->SetTickLength(-0.01,"Y");
2587  fCorrelationNoRPsVsRefMult->SetLabelSize(0.04);
2588  fCorrelationNoRPsVsRefMult->SetLabelOffset(0.02,"Y");
2589  fCorrelationNoRPsVsRefMult->SetStats(kTRUE);
2590  fCorrelationNoRPsVsRefMult->GetXaxis()->SetTitle("# RPs");
2591  fCorrelationNoRPsVsRefMult->GetYaxis()->SetTitle("Reference Multiplicity");
2592  fControlHistogramsList->Add(fCorrelationNoRPsVsRefMult);
2593  //  b2) Correlation between # POIs and ref. mult. determined centrally:
2594  TString sCorrelationNoPOIsVsRefMultName = "fCorrelationNoPOIsVsRefMult";
2595  sCorrelationNoPOIsVsRefMultName += fAnalysisLabel->Data();
2596  fCorrelationNoPOIsVsRefMult = new TH2D(sCorrelationNoPOIsVsRefMultName.Data(),"# POIs vs. Reference Multiplicity",fnBinsMult,fMinMult,fMaxMult,fnBinsMult,fMinMult,fMaxMult);
2597  fCorrelationNoPOIsVsRefMult->SetTickLength(-0.01,"Y");
2598  fCorrelationNoPOIsVsRefMult->SetLabelSize(0.04);
2599  fCorrelationNoPOIsVsRefMult->SetLabelOffset(0.02,"Y");
2600  fCorrelationNoPOIsVsRefMult->SetStats(kTRUE);
2601  fCorrelationNoPOIsVsRefMult->GetXaxis()->SetTitle("# POIs");
2602  fCorrelationNoPOIsVsRefMult->GetYaxis()->SetTitle("Reference Multiplicity");
2603  fControlHistogramsList->Add(fCorrelationNoPOIsVsRefMult);
2604  //  b3) Correlation between # RPs and # POIs:
2605  TString sCorrelationNoRPsVsNoPOIsName = "fCorrelationNoRPsVsNoPOIs";
2606  sCorrelationNoRPsVsNoPOIsName += fAnalysisLabel->Data();
2607  fCorrelationNoRPsVsNoPOIs = new TH2D(sCorrelationNoRPsVsNoPOIsName.Data(),"# RPs vs. # POIs",fnBinsMult,fMinMult,fMaxMult,fnBinsMult,fMinMult,fMaxMult);
2608  fCorrelationNoRPsVsNoPOIs->SetTickLength(-0.01,"Y");
2609  fCorrelationNoRPsVsNoPOIs->SetLabelSize(0.04);
2610  fCorrelationNoRPsVsNoPOIs->SetLabelOffset(0.02,"Y");
2611  fCorrelationNoRPsVsNoPOIs->SetStats(kTRUE);
2612  fCorrelationNoRPsVsNoPOIs->GetXaxis()->SetTitle("# RPs");
2613  fCorrelationNoRPsVsNoPOIs->GetYaxis()->SetTitle("# POIs");
2614  fControlHistogramsList->Add(fCorrelationNoRPsVsNoPOIs);
2615
2616 } // end of void AliFlowAnalysisWithQCumulants::BookEverythingForControlHistograms()
2617
2618 //=======================================================================================================================
2619
2620 void AliFlowAnalysisWithQCumulants::BookEverythingForMixedHarmonics()
2621 {
2622  // Book all objects for mixed harmonics.
2623
2624  // a) Book profile to hold all flags for mixed harmonics;
2625  // b) Book all objects in TList fMixedHarmonicsProfiles;
2626  // c) Book all objects in TList fMixedHarmonicsResults;
2627  // d) Book all objects in TList fMixedHarmonicsErrorPropagation.
2628
2629  // a) Book profile to hold all flags for mixed harmonics:
2630  TString mixedHarmonicsFlagsName = "fMixedHarmonicsFlags";
2631  mixedHarmonicsFlagsName += fAnalysisLabel->Data();
2632  fMixedHarmonicsFlags = new TProfile(mixedHarmonicsFlagsName.Data(),"Flags for Mixed Harmonics",4,0,4);
2633  fMixedHarmonicsFlags->SetTickLength(-0.01,"Y");
2634  fMixedHarmonicsFlags->SetMarkerStyle(25);
2635  fMixedHarmonicsFlags->SetLabelSize(0.04);
2636  fMixedHarmonicsFlags->SetLabelOffset(0.02,"Y");
2637  fMixedHarmonicsFlags->SetStats(kFALSE);
2638  fMixedHarmonicsFlags->GetXaxis()->SetBinLabel(1,"Calculate Mixed Harmonics");
2639  fMixedHarmonicsFlags->GetXaxis()->SetBinLabel(2,"Generic Harmonic");
2640  fMixedHarmonicsFlags->GetXaxis()->SetBinLabel(3,"Calculate vs Multiplicity");
2641  fMixedHarmonicsFlags->GetXaxis()->SetBinLabel(4,"Multiplicity Weight");
2642  fMixedHarmonicsList->Add(fMixedHarmonicsFlags);
2643
2644  if(!fCalculateMixedHarmonics){return;}
2645
2646  // b) Book all objects in TList fMixedHarmonicsProfiles:
2647  //  b1) 2-p correlations:
2648  TString s2pCorrelationsName = "f2pCorrelations";
2649  s2pCorrelationsName += fAnalysisLabel->Data();
2650  f2pCorrelations = new TProfile(s2pCorrelationsName.Data(),Form("2-particle correlations (n = %d)",fHarmonic),6,0,6,"s");
2651  f2pCorrelations->SetTickLength(-0.01,"Y");
2652  f2pCorrelations->SetMarkerStyle(25);
2653  f2pCorrelations->SetLabelSize(0.04);
2654  f2pCorrelations->SetLabelOffset(0.02,"Y");
2655  f2pCorrelations->SetStats(kFALSE);
2656  f2pCorrelations->Sumw2();
2657  f2pCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT2#GT#GT_{%dn|%dn}",1*fHarmonic,1*fHarmonic));
2658  f2pCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT2#GT#GT_{%dn|%dn}",2*fHarmonic,2*fHarmonic));
2659  f2pCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT2#GT#GT_{%dn|%dn}",3*fHarmonic,3*fHarmonic));
2660  f2pCorrelations->GetXaxis()->SetBinLabel(4,Form("#LT#LT2#GT#GT_{%dn|%dn}",4*fHarmonic,4*fHarmonic));
2661  f2pCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT2#GT#GT_{%dn|%dn}",5*fHarmonic,5*fHarmonic));
2662  f2pCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT2#GT#GT_{%dn|%dn}",6*fHarmonic,6*fHarmonic));
2663  fMixedHarmonicsProfiles->Add(f2pCorrelations);
2664  //  b2) 3-p correlations (3+6):
2665  TString s3pCorrelationsName = "f3pCorrelations";
2666  s3pCorrelationsName += fAnalysisLabel->Data();
2667  f3pCorrelations = new TProfile(s3pCorrelationsName.Data(),Form("3-particle correlations (n = %d)",fHarmonic),10,0,10,"s"); 
2668  f3pCorrelations->SetTickLength(-0.01,"Y");
2669  f3pCorrelations->SetMarkerStyle(25);
2670  f3pCorrelations->SetLabelSize(0.04);
2671  f3pCorrelations->SetLabelOffset(0.02,"Y");
2672  f3pCorrelations->SetStats(kFALSE);
2673  f3pCorrelations->Sumw2();
2674  // 3-p correlations sensitive to two distinct harmonics (3):
2675  f3pCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic));
2676  f3pCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic));
2677  f3pCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic));
2678  f3pCorrelations->GetXaxis()->SetBinLabel(4,""); // empty
2679  // 3-p correlations sensitive to three distinct harmonics (6):
2680  f3pCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,1*fHarmonic));
2681  f3pCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,1*fHarmonic));
2682  f3pCorrelations->GetXaxis()->SetBinLabel(7,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,2*fHarmonic));
2683  f3pCorrelations->GetXaxis()->SetBinLabel(8,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,1*fHarmonic));
2684  f3pCorrelations->GetXaxis()->SetBinLabel(9,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,2*fHarmonic));
2685  f3pCorrelations->GetXaxis()->SetBinLabel(10,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,1*fHarmonic));
2686  fMixedHarmonicsProfiles->Add(f3pCorrelations);
2687  //  b3) 4-p correlations (6+15+2+10+8):
2688  TString s4pCorrelationsName = "f4pCorrelations";
2689  s4pCorrelationsName += fAnalysisLabel->Data();
2690  f4pCorrelations = new TProfile(s4pCorrelationsName.Data(),Form("4-particle correlations (n = %d)",fHarmonic),45,0,45,"s");
2691  f4pCorrelations->SetTickLength(-0.01,"Y");
2692  f4pCorrelations->SetMarkerStyle(25);
2693  f4pCorrelations->SetLabelSize(0.03);
2694  f4pCorrelations->SetLabelOffset(0.02,"Y");
2695  f4pCorrelations->SetStats(kFALSE);
2696  f4pCorrelations->Sumw2();
2697  // "same harmonic" (6):
2698  f4pCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2699  f4pCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2700  f4pCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
2701  f4pCorrelations->GetXaxis()->SetBinLabel(4,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
2702  f4pCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic));
2703  f4pCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,6*fHarmonic));
2704  f4pCorrelations->GetXaxis()->SetBinLabel(7,""); // empty
2705  // "standard candles" (15):
2706  f4pCorrelations->GetXaxis()->SetBinLabel(8,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic));
2707  f4pCorrelations->GetXaxis()->SetBinLabel(9,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic));
2708  f4pCorrelations->GetXaxis()->SetBinLabel(10,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic));
2709  f4pCorrelations->GetXaxis()->SetBinLabel(11,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic));
2710  f4pCorrelations->GetXaxis()->SetBinLabel(12,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic));
2711  f4pCorrelations->GetXaxis()->SetBinLabel(13,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic));
2712  f4pCorrelations->GetXaxis()->SetBinLabel(14,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic));
2713  f4pCorrelations->GetXaxis()->SetBinLabel(15,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic));
2714  f4pCorrelations->GetXaxis()->SetBinLabel(16,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic));
2715  f4pCorrelations->GetXaxis()->SetBinLabel(17,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic));
2716  f4pCorrelations->GetXaxis()->SetBinLabel(18,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,6*fHarmonic,1*fHarmonic));
2717  f4pCorrelations->GetXaxis()->SetBinLabel(19,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,2*fHarmonic));
2718  f4pCorrelations->GetXaxis()->SetBinLabel(20,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,3*fHarmonic));
2719  f4pCorrelations->GetXaxis()->SetBinLabel(21,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,4*fHarmonic));
2720  f4pCorrelations->GetXaxis()->SetBinLabel(22,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,5*fHarmonic));
2721  f4pCorrelations->GetXaxis()->SetBinLabel(23,""); // empty
2722  // 4-p correlations sensitive to two distinct harmonics (2):
2723  f4pCorrelations->GetXaxis()->SetBinLabel(24,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2724  f4pCorrelations->GetXaxis()->SetBinLabel(25,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2725  f4pCorrelations->GetXaxis()->SetBinLabel(26,""); // empty
2726  // 4-p correlations sensitive to three distinct harmonics (10):
2727  f4pCorrelations->GetXaxis()->SetBinLabel(27,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic));
2728  f4pCorrelations->GetXaxis()->SetBinLabel(28,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
2729  f4pCorrelations->GetXaxis()->SetBinLabel(29,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic));
2730  f4pCorrelations->GetXaxis()->SetBinLabel(30,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
2731  f4pCorrelations->GetXaxis()->SetBinLabel(31,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
2732  f4pCorrelations->GetXaxis()->SetBinLabel(32,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
2733  f4pCorrelations->GetXaxis()->SetBinLabel(33,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic));
2734  f4pCorrelations->GetXaxis()->SetBinLabel(34,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
2735  f4pCorrelations->GetXaxis()->SetBinLabel(35,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,4*fHarmonic));
2736  f4pCorrelations->GetXaxis()->SetBinLabel(36,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,5*fHarmonic));
2737  f4pCorrelations->GetXaxis()->SetBinLabel(37,""); // empty
2738  // 4-p correlations sensitive to four distinct harmonics (8):
2739  f4pCorrelations->GetXaxis()->SetBinLabel(38,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic));
2740  f4pCorrelations->GetXaxis()->SetBinLabel(39,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic));
2741  f4pCorrelations->GetXaxis()->SetBinLabel(40,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic));
2742  f4pCorrelations->GetXaxis()->SetBinLabel(41,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
2743  f4pCorrelations->GetXaxis()->SetBinLabel(42,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,2*fHarmonic));
2744  f4pCorrelations->GetXaxis()->SetBinLabel(43,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
2745  f4pCorrelations->GetXaxis()->SetBinLabel(44,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,3*fHarmonic));
2746  f4pCorrelations->GetXaxis()->SetBinLabel(45,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,4*fHarmonic));
2747  fMixedHarmonicsProfiles->Add(f4pCorrelations);
2748  //  b3) 5-p correlations (30+9+30+11+3):
2749  TString s5pCorrelationsName = "f5pCorrelations";
2750  s5pCorrelationsName += fAnalysisLabel->Data();
2751  f5pCorrelations = new TProfile(s5pCorrelationsName.Data(),Form("5-particle correlations (n = %d)",fHarmonic),87,0,87,"s");
2752  f5pCorrelations->SetTickLength(-0.01,"Y");
2753  f5pCorrelations->SetMarkerStyle(25);
2754  f5pCorrelations->SetLabelSize(0.02);
2755  f5pCorrelations->SetLabelOffset(0.02,"Y");
2756  f5pCorrelations->SetStats(kFALSE);
2757  f5pCorrelations->Sumw2();
2758  // "standard candles" (30):
2759  f5pCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
2760  f5pCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
2761  f5pCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
2762  f5pCorrelations->GetXaxis()->SetBinLabel(4,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
2763  f5pCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
2764  f5pCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
2765  f5pCorrelations->GetXaxis()->SetBinLabel(7,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
2766  f5pCorrelations->GetXaxis()->SetBinLabel(8,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
2767  f5pCorrelations->GetXaxis()->SetBinLabel(9,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
2768  f5pCorrelations->GetXaxis()->SetBinLabel(10,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
2769  f5pCorrelations->GetXaxis()->SetBinLabel(11,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
2770  f5pCorrelations->GetXaxis()->SetBinLabel(12,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
2771  f5pCorrelations->GetXaxis()->SetBinLabel(13,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
2772  f5pCorrelations->GetXaxis()->SetBinLabel(14,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
2773  f5pCorrelations->GetXaxis()->SetBinLabel(15,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
2774  f5pCorrelations->GetXaxis()->SetBinLabel(16,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
2775  f5pCorrelations->GetXaxis()->SetBinLabel(17,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
2776  f5pCorrelations->GetXaxis()->SetBinLabel(18,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
2777  f5pCorrelations->GetXaxis()->SetBinLabel(19,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
2778  f5pCorrelations->GetXaxis()->SetBinLabel(20,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
2779  f5pCorrelations->GetXaxis()->SetBinLabel(21,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
2780  f5pCorrelations->GetXaxis()->SetBinLabel(22,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
2781  f5pCorrelations->GetXaxis()->SetBinLabel(23,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,3*fHarmonic));
2782  f5pCorrelations->GetXaxis()->SetBinLabel(24,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,1*fHarmonic,1*fHarmonic));
2783  f5pCorrelations->GetXaxis()->SetBinLabel(25,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,2*fHarmonic,1*fHarmonic));
2784  f5pCorrelations->GetXaxis()->SetBinLabel(26,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,2*fHarmonic,2*fHarmonic));
2785  f5pCorrelations->GetXaxis()->SetBinLabel(27,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,3*fHarmonic,1*fHarmonic));
2786  f5pCorrelations->GetXaxis()->SetBinLabel(28,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,2*fHarmonic));
2787  f5pCorrelations->GetXaxis()->SetBinLabel(29,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,3*fHarmonic,2*fHarmonic));
2788  f5pCorrelations->GetXaxis()->SetBinLabel(30,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,4*fHarmonic,1*fHarmonic));
2789  f5pCorrelations->GetXaxis()->SetBinLabel(31,""); // empty
2790  // 5-p correlations sensitive to two distinct harmonics (9):
2791  f5pCorrelations->GetXaxis()->SetBinLabel(32,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2792  f5pCorrelations->GetXaxis()->SetBinLabel(33,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
2793  f5pCorrelations->GetXaxis()->SetBinLabel(34,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2794  f5pCorrelations->GetXaxis()->SetBinLabel(35,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2795  f5pCorrelations->GetXaxis()->SetBinLabel(36,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2796  f5pCorrelations->GetXaxis()->SetBinLabel(37,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
2797  f5pCorrelations->GetXaxis()->SetBinLabel(38,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
2798  f5pCorrelations->GetXaxis()->SetBinLabel(39,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
2799  f5pCorrelations->GetXaxis()->SetBinLabel(40,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,3*fHarmonic,3*fHarmonic));
2800  f5pCorrelations->GetXaxis()->SetBinLabel(41,""); // empty
2801  // 5-p correlations sensitive to three distinct harmonics (30):
2802  f5pCorrelations->GetXaxis()->SetBinLabel(42,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
2803  f5pCorrelations->GetXaxis()->SetBinLabel(43,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
2804  f5pCorrelations->GetXaxis()->SetBinLabel(44,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
2805  f5pCorrelations->GetXaxis()->SetBinLabel(45,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
2806  f5pCorrelations->GetXaxis()->SetBinLabel(46,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
2807  f5pCorrelations->GetXaxis()->SetBinLabel(47,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
2808  f5pCorrelations->GetXaxis()->SetBinLabel(48,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
2809  f5pCorrelations->GetXaxis()->SetBinLabel(49,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
2810  f5pCorrelations->GetXaxis()->SetBinLabel(50,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2811  f5pCorrelations->GetXaxis()->SetBinLabel(51,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2812  f5pCorrelations->GetXaxis()->SetBinLabel(52,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
2813  f5pCorrelations->GetXaxis()->SetBinLabel(53,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
2814  f5pCorrelations->GetXaxis()->SetBinLabel(54,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
2815  f5pCorrelations->GetXaxis()->SetBinLabel(55,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
2816  f5pCorrelations->GetXaxis()->SetBinLabel(56,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
2817  f5pCorrelations->GetXaxis()->SetBinLabel(57,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
2818  f5pCorrelations->GetXaxis()->SetBinLabel(58,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
2819  f5pCorrelations->GetXaxis()->SetBinLabel(59,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
2820  f5pCorrelations->GetXaxis()->SetBinLabel(60,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
2821  f5pCorrelations->GetXaxis()->SetBinLabel(61,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
2822  f5pCorrelations->GetXaxis()->SetBinLabel(62,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2823  f5pCorrelations->GetXaxis()->SetBinLabel(63,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
2824  f5pCorrelations->GetXaxis()->SetBinLabel(64,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
2825  f5pCorrelations->GetXaxis()->SetBinLabel(65,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
2826  f5pCorrelations->GetXaxis()->SetBinLabel(66,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
2827  f5pCorrelations->GetXaxis()->SetBinLabel(67,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,5*fHarmonic,5*fHarmonic));
2828  f5pCorrelations->GetXaxis()->SetBinLabel(68,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic,1*fHarmonic));
2829  f5pCorrelations->GetXaxis()->SetBinLabel(69,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,5*fHarmonic,2*fHarmonic));
2830  f5pCorrelations->GetXaxis()->SetBinLabel(70,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,4*fHarmonic,2*fHarmonic));
2831  f5pCorrelations->GetXaxis()->SetBinLabel(71,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,5*fHarmonic,1*fHarmonic));
2832  f5pCorrelations->GetXaxis()->SetBinLabel(72,""); // empty
2833  // 5-p correlations sensitive to four distinct harmonics (11):
2834  f5pCorrelations->GetXaxis()->SetBinLabel(73,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
2835  f5pCorrelations->GetXaxis()->SetBinLabel(74,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
2836  f5pCorrelations->GetXaxis()->SetBinLabel(75,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
2837  f5pCorrelations->GetXaxis()->SetBinLabel(76,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
2838  f5pCorrelations->GetXaxis()->SetBinLabel(77,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
2839  f5pCorrelations->GetXaxis()->SetBinLabel(78,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
2840  f5pCorrelations->GetXaxis()->SetBinLabel(79,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,5*fHarmonic,3*fHarmonic));
2841  f5pCorrelations->GetXaxis()->SetBinLabel(80,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
2842  f5pCorrelations->GetXaxis()->SetBinLabel(81,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic));
2843  f5pCorrelations->GetXaxis()->SetBinLabel(82,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,5*fHarmonic,5*fHarmonic));
2844  f5pCorrelations->GetXaxis()->SetBinLabel(83,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic));
2845  f5pCorrelations->GetXaxis()->SetBinLabel(84,""); // empty
2846  // 5-p correlations sensitive to five distinct harmonics (3):
2847  f5pCorrelations->GetXaxis()->SetBinLabel(85,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
2848  f5pCorrelations->GetXaxis()->SetBinLabel(86,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,1*fHarmonic,5*fHarmonic,4*fHarmonic));
2849  f5pCorrelations->GetXaxis()->SetBinLabel(87,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
2850  fMixedHarmonicsProfiles->Add(f5pCorrelations);
2851  //  b4) 6-p correlations (??+??+??+??+??):
2852  TString s6pCorrelationsName = "f6pCorrelations";
2853  s6pCorrelationsName += fAnalysisLabel->Data();
2854  f6pCorrelations = new TProfile(s6pCorrelationsName.Data(),Form("6-particle correlations (n = %d)",fHarmonic),1,0.,1.);
2855  f6pCorrelations->SetTickLength(-0.01,"Y");
2856  f6pCorrelations->SetMarkerStyle(25);
2857  f6pCorrelations->SetLabelSize(0.02);
2858  f6pCorrelations->SetLabelOffset(0.02,"Y");
2859  f6pCorrelations->SetStats(kFALSE);
2860  f6pCorrelations->Sumw2(); 
2861  //fMixedHarmonicsProfiles->Add(f6pCorrelations); // TBI
2862  //  b5) 7-p correlations (??+??+??+??+??):
2863  TString s7pCorrelationsName = "f7pCorrelations";
2864  s7pCorrelationsName += fAnalysisLabel->Data();
2865  f7pCorrelations = new TProfile(s7pCorrelationsName.Data(),Form("7-particle correlations (n = %d)",fHarmonic),1,0.,1.);
2866  f7pCorrelations->SetTickLength(-0.01,"Y");
2867  f7pCorrelations->SetMarkerStyle(25);
2868  f7pCorrelations->SetLabelSize(0.02);
2869  f7pCorrelations->SetLabelOffset(0.02,"Y");
2870  f7pCorrelations->SetStats(kFALSE);
2871  f7pCorrelations->Sumw2(); 
2872  //fMixedHarmonicsProfiles->Add(f7pCorrelations); // TBI
2873  //  b6) 8-p correlations (??+??+??+??+??):
2874  TString s8pCorrelationsName = "f8pCorrelations";
2875  s8pCorrelationsName += fAnalysisLabel->Data();
2876  f8pCorrelations = new TProfile(s8pCorrelationsName.Data(),Form("8-particle correlations (n = %d)",fHarmonic),1,0.,1.);
2877  f8pCorrelations->SetTickLength(-0.01,"Y");
2878  f8pCorrelations->SetMarkerStyle(25);
2879  f8pCorrelations->SetLabelSize(0.02);
2880  f8pCorrelations->SetLabelOffset(0.02,"Y");
2881  f8pCorrelations->SetStats(kFALSE);
2882  f8pCorrelations->Sumw2(); 
2883  //fMixedHarmonicsProfiles->Add(f8pCorrelations); // TBI
2884
2885  // c) Book all objects in TList fMixedHarmonicsResults:
2886  // QC{2}:
2887  f2pCumulants = f2pCorrelations->ProjectionX("f2pCumulants");
2888  f2pCumulants->SetTitle(Form("2-particle cumulants (n = %d)",fHarmonic));
2889  f2pCumulants->SetStats(kFALSE);
2890  f2pCumulants->SetMarkerStyle(kFullSquare);
2891  f2pCumulants->SetMarkerColor(kBlack);
2892  f2pCumulants->SetLineColor(kBlack);
2893  fMixedHarmonicsResults->Add(f2pCumulants);
2894  // QC{3}:
2895  f3pCumulants = f3pCorrelations->ProjectionX("f3pCumulants");
2896  f3pCumulants->SetTitle(Form("3-particle cumulants (n = %d)",fHarmonic));
2897  f3pCumulants->SetStats(kFALSE);
2898  f3pCumulants->SetMarkerStyle(kFullSquare);
2899  f3pCumulants->SetMarkerColor(kGreen+2);
2900  f3pCumulants->SetLineColor(kGreen+2);
2901  fMixedHarmonicsResults->Add(f3pCumulants);
2902  // QC{4}:
2903  f4pCumulants = f4pCorrelations->ProjectionX("f4pCumulants");
2904  f4pCumulants->SetTitle(Form("4-particle cumulants (n = %d)",fHarmonic));
2905  f4pCumulants->SetStats(kFALSE);
2906  f4pCumulants->SetMarkerStyle(kFullSquare);
2907  f4pCumulants->SetMarkerColor(kRed);
2908  f4pCumulants->SetLineColor(kRed);
2909  fMixedHarmonicsResults->Add(f4pCumulants);
2910  // QC{5}:
2911  f5pCumulants = f5pCorrelations->ProjectionX("f5pCumulants");
2912  f5pCumulants->SetTitle(Form("5-particle cumulants (n = %d)",fHarmonic));
2913  f5pCumulants->SetStats(kFALSE);
2914  f5pCumulants->SetMarkerStyle(kFullSquare);
2915  f5pCumulants->SetMarkerColor(kBlue);
2916  f5pCumulants->SetLineColor(kBlue);
2917  fMixedHarmonicsResults->Add(f5pCumulants);
2918
2919  // d) Book all objects in TList fMixedHarmonicsErrorPropagation: 
2920  // Sum of linear and quadratic event weights for mixed harmonics => [0=linear 1,1=quadratic]: 
2921  TString mixedHarmonicEventWeightsName = "fMixedHarmonicEventWeights";
2922  mixedHarmonicEventWeightsName += fAnalysisLabel->Data();
2923  TString powerFlag[2] = {"linear","quadratic"}; 
2924  for(Int_t power=0;power<2;power++)
2925  {
2926   fMixedHarmonicEventWeights[power] = new TH1D(Form("%s: %s",mixedHarmonicEventWeightsName.Data(),powerFlag[power].Data()),Form("Sum of %s event weights for correlations",powerFlag[power].Data()),8,0.,8.);
2927   fMixedHarmonicEventWeights[power]->SetLabelSize(0.04);
2928   fMixedHarmonicEventWeights[power]->SetMarkerStyle(25);
2929   fMixedHarmonicEventWeights[power]->SetStats(kFALSE);
2930   if(power == 0)
2931   {
2932    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum w_{#LT1#GT}");
2933    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum w_{#LT2#GT}");
2934    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum w_{#LT3#GT}");
2935    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum w_{#LT4#GT}");
2936    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(5,"#sum w_{#LT5#GT}");
2937    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(6,"#sum w_{#LT6#GT}");
2938    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(7,"#sum w_{#LT7#GT}");
2939    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(8,"#sum w_{#LT8#GT}");
2940   } else if (power == 1) 
2941     {
2942      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum w_{#LT1#GT}^{2}");
2943      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum w_{#LT2#GT}^{2}");
2944      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum w_{#LT3#GT}^{2}");
2945      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum w_{#LT4#GT}^{2}");
2946      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(5,"#sum w_{#LT5#GT}^{2}");
2947      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(6,"#sum w_{#LT6#GT}^{2}");
2948      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(7,"#sum w_{#LT7#GT}^{2}");
2949      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(8,"#sum w_{#LT8#GT}^{2}");
2950     }
2951   fMixedHarmonicsErrorPropagation->Add(fMixedHarmonicEventWeights[power]);
2952  } // end of for(Int_t power=0;power<2;power++)
2953  
2954  // Sums of products of event weights for mixed harmonics:
2955  TString mixedHarmonicProductOfEventWeightsName = "fMixedHarmonicProductOfEventWeights";
2956  mixedHarmonicProductOfEventWeightsName += fAnalysisLabel->Data();
2957  fMixedHarmonicProductOfEventWeights = new TH2D(mixedHarmonicProductOfEventWeightsName.Data(),"Sums of products of event weights",8,0.,8.,8,0.,8.);
2958  fMixedHarmonicProductOfEventWeights->SetStats(kFALSE);
2959  fMixedHarmonicProductOfEventWeights->GetXaxis()->SetLabelSize(0.05);
2960  fMixedHarmonicProductOfEventWeights->GetYaxis()->SetLabelSize(0.05);
2961  for(Int_t b=1;b<=8;b++)
2962  {
2963   fMixedHarmonicProductOfEventWeights->GetXaxis()->SetBinLabel(b,Form("w_{#LT%i#GT}",b)); 
2964   fMixedHarmonicProductOfEventWeights->GetYaxis()->SetBinLabel(b,Form("w_{#LT%i#GT}",b)); 
2965  } 
2966  fMixedHarmonicsErrorPropagation->Add(fMixedHarmonicProductOfEventWeights);
2967
2968  // Averages of products of mixed harmonics correlations:
2969  TString mixedHarmonicProductOfCorrelationsName = "fMixedHarmonicProductOfCorrelations";
2970  mixedHarmonicProductOfCorrelationsName += fAnalysisLabel->Data();
2971  fMixedHarmonicProductOfCorrelations = new TProfile2D(mixedHarmonicProductOfCorrelationsName.Data(),"Averages of products of mixed correlators",139,0.,139.,139,0.,139.);
2972  fMixedHarmonicProductOfCorrelations->Sumw2();
2973  fMixedHarmonicProductOfCorrelations->SetStats(kFALSE);
2974  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetLabelSize(0.015);
2975  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetLabelSize(0.015);
2976  // x-axis:
2977  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT2#GT#GT_{%dn|%dn}",1*fHarmonic,1*fHarmonic));
2978  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT2#GT#GT_{%dn|%dn}",2*fHarmonic,2*fHarmonic));
2979  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT2#GT#GT_{%dn|%dn}",3*fHarmonic,3*fHarmonic));
2980  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(4,Form("#LT#LT2#GT#GT_{%dn|%dn}",4*fHarmonic,4*fHarmonic));
2981  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT2#GT#GT_{%dn|%dn}",5*fHarmonic,5*fHarmonic));
2982  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT2#GT#GT_{%dn|%dn}",6*fHarmonic,6*fHarmonic));
2983  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(7,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic));
2984  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(8,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic));
2985  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(9,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic));
2986  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(10,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,1*fHarmonic));
2987  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(11,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,1*fHarmonic));
2988  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(12,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,2*fHarmonic));
2989  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(13,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,1*fHarmonic));
2990  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(14,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,2*fHarmonic));
2991  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(15,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,1*fHarmonic));
2992  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(16,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2993  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(17,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2994  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(18,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
2995  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(19,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
2996  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(20,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic));
2997  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(21,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,6*fHarmonic));
2998  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(22,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic));
2999  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(23,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic));
3000  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(24,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic));
3001  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(25,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic));
3002  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(26,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic));
3003  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(27,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic));
3004  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(28,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic));
3005  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(29,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic));
3006  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(30,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic));
3007  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(31,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic));
3008  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(32,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,6*fHarmonic,1*fHarmonic));
3009  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(33,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,2*fHarmonic));
3010  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(34,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,3*fHarmonic));
3011  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(35,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,4*fHarmonic));
3012  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(36,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,5*fHarmonic));
3013  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(37,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3014  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(38,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3015  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(39,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic));
3016  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(40,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3017  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(41,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic));
3018  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(42,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3019  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(43,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3020  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(44,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
3021  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(45,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic));
3022  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(46,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3023  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(47,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,4*fHarmonic));
3024  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(48,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,5*fHarmonic));
3025  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(49,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic));
3026  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(50,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic));
3027  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(51,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic));
3028  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(52,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
3029  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(53,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,2*fHarmonic));
3030  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(54,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3031  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(55,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,3*fHarmonic));
3032  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(56,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,4*fHarmonic));
3033  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(57,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3034  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(58,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3035  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(59,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3036  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(60,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3037  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(61,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3038  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(62,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3039  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(63,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3040  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(64,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
3041  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(65,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3042  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(66,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3043  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(67,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
3044  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(68,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
3045  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(69,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
3046  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(70,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
3047  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(71,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3048  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(72,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3049  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(73,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3050  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(74,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
3051  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(75,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
3052  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(76,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
3053  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(77,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
3054  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(78,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
3055  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(79,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,3*fHarmonic));
3056  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(80,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,1*fHarmonic,1*fHarmonic));
3057  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(81,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,2*fHarmonic,1*fHarmonic));
3058  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(82,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,2*fHarmonic,2*fHarmonic));
3059  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(83,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,3*fHarmonic,1*fHarmonic));
3060  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(84,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,2*fHarmonic));
3061  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(85,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,3*fHarmonic,2*fHarmonic));
3062  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(86,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,4*fHarmonic,1*fHarmonic));
3063  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(87,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3064  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(88,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3065  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(89,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3066  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(90,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3067  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(91,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3068  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(92,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3069  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(93,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3070  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(94,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
3071  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(95,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,3*fHarmonic,3*fHarmonic));
3072  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(96,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3073  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(97,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3074  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(98,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3075  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(99,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3076  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(100,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
3077  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(101,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3078  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(102,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3079  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(103,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3080  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(104,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3081  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(105,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3082  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(106,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3083  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(107,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3084  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(108,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3085  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(109,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3086  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(110,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
3087  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(111,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
3088  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(112,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
3089  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(113,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
3090  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(114,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
3091  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(115,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3092  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(116,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3093  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(117,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
3094  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(118,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
3095  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(119,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3096  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(120,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
3097  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(121,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,5*fHarmonic,5*fHarmonic));
3098  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(122,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic,1*fHarmonic));
3099  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(123,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,5*fHarmonic,2*fHarmonic));
3100  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(124,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,4*fHarmonic,2*fHarmonic));
3101  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(125,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,5*fHarmonic,1*fHarmonic));
3102  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(126,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3103  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(127,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
3104  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(128,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3105  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(129,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
3106  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(130,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3107  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(131,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
3108  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(132,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,5*fHarmonic,3*fHarmonic));
3109  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(133,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
3110  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(134,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic));
3111  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(135,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,5*fHarmonic,5*fHarmonic));
3112  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(136,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic));
3113  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(137,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3114  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(138,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,1*fHarmonic,5*fHarmonic,4*fHarmonic));
3115  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(139,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
3116  // y-axis:
3117  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(1,Form("#LT#LT2#GT#GT_{%dn|%dn}",1*fHarmonic,1*fHarmonic));
3118  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(2,Form("#LT#LT2#GT#GT_{%dn|%dn}",2*fHarmonic,2*fHarmonic));
3119  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(3,Form("#LT#LT2#GT#GT_{%dn|%dn}",3*fHarmonic,3*fHarmonic));
3120  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(4,Form("#LT#LT2#GT#GT_{%dn|%dn}",4*fHarmonic,4*fHarmonic));
3121  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(5,Form("#LT#LT2#GT#GT_{%dn|%dn}",5*fHarmonic,5*fHarmonic));
3122  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(6,Form("#LT#LT2#GT#GT_{%dn|%dn}",6*fHarmonic,6*fHarmonic));
3123  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(7,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic));
3124  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(8,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic));
3125  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(9,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic));
3126  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(10,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,1*fHarmonic));
3127  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(11,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,1*fHarmonic));
3128  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(12,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,2*fHarmonic));
3129  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(13,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,1*fHarmonic));
3130  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(14,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,2*fHarmonic));
3131  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(15,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,1*fHarmonic));
3132  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(16,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3133  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(17,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3134  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(18,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3135  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(19,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
3136  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(20,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic));
3137  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(21,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,6*fHarmonic));
3138  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(22,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic));
3139  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(23,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic));
3140  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(24,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic));
3141  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(25,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic));
3142  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(26,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic));
3143  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(27,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic));
3144  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(28,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic));
3145  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(29,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic));
3146  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(30,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic));
3147  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(31,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic));
3148  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(32,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,6*fHarmonic,1*fHarmonic));
3149  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(33,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,2*fHarmonic));
3150  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(34,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,3*fHarmonic));
3151  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(35,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,4*fHarmonic));
3152  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(36,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,5*fHarmonic));
3153  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(37,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3154  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(38,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3155  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(39,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic));
3156  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(40,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3157  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(41,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic));
3158  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(42,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3159  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(43,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3160  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(44,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
3161  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(45,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic));
3162  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(46,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3163  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(47,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,4*fHarmonic));
3164  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(48,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,5*fHarmonic));
3165  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(49,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic));
3166  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(50,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic));
3167  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(51,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic));
3168  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(52,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
3169  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(53,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,2*fHarmonic));
3170  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(54,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3171  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(55,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,3*fHarmonic));
3172  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(56,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,4*fHarmonic));
3173  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(57,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3174  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(58,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3175  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(59,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3176  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(60,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3177  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(61,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3178  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(62,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3179  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(63,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3180  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(64,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
3181  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(65,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3182  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(66,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3183  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(67,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
3184  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(68,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
3185  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(69,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
3186  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(70,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
3187  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(71,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3188  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(72,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3189  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(73,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3190  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(74,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
3191  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(75,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
3192  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(76,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
3193  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(77,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
3194  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(78,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
3195  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(79,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,3*fHarmonic));
3196  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(80,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,1*fHarmonic,1*fHarmonic));
3197  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(81,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,2*fHarmonic,1*fHarmonic));
3198  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(82,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,2*fHarmonic,2*fHarmonic));
3199  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(83,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,3*fHarmonic,1*fHarmonic));
3200  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(84,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,2*fHarmonic));
3201  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(85,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,3*fHarmonic,2*fHarmonic));
3202  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(86,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,4*fHarmonic,1*fHarmonic));
3203  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(87,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3204  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(88,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3205  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(89,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3206  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(90,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3207  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(91,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3208  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(92,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3209  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(93,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3210  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(94,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
3211  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(95,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,3*fHarmonic,3*fHarmonic));
3212  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(96,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3213  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(97,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3214  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(98,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3215  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(99,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3216  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(100,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
3217  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(101,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3218  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(102,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3219  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(103,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3220  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(104,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3221  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(105,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3222  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(106,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3223  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(107,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3224  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(108,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3225  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(109,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3226  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(110,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
3227  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(111,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
3228  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(112,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
3229  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(113,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
3230  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(114,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
3231  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(115,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3232  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(116,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3233  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(117,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
3234  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(118,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
3235  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(119,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3236  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(120,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
3237  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(121,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,5*fHarmonic,5*fHarmonic));
3238  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(122,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic,1*fHarmonic));
3239  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(123,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,5*fHarmonic,2*fHarmonic));
3240  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(124,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,4*fHarmonic,2*fHarmonic));
3241  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(125,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,5*fHarmonic,1*fHarmonic));
3242  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(126,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3243  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(127,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
3244  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(128,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3245  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(129,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
3246  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(130,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3247  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(131,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
3248  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(132,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,5*fHarmonic,3*fHarmonic));
3249  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(133,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
3250  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(134,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic));
3251  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(135,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,5*fHarmonic,5*fHarmonic));
3252  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(136,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic));
3253  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(137,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3254  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(138,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,1*fHarmonic,5*fHarmonic,4*fHarmonic));
3255  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(139,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
3256  fMixedHarmonicsErrorPropagation->Add(fMixedHarmonicProductOfCorrelations);
3257
3258 } // end of void AliFlowAnalysisWithQCumulants::BookEverythingForMixedHarmonics()
3259
3260 //=======================================================================================================================
3261
3262 void AliFlowAnalysisWithQCumulants::InitializeArraysForNestedLoops()
3263 {
3264  // Initialize arrays of all objects relevant for calculations with nested loops.
3265  
3266  // integrated flow:
3267  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
3268  {
3269   fIntFlowDirectCorrectionTermsForNUA[sc] = NULL;
3270  } 
3271
3272  // differential flow:  
3273  // correlations:
3274  for(Int_t t=0;t<2;t++) // type: RP or POI
3275  { 
3276   for(Int_t pe=0;pe<2;pe++) // pt or eta
3277   {
3278    for(Int_t ci=0;ci<4;ci++) // correlation index
3279    {
3280     fDiffFlowDirectCorrelations[t][pe][ci] = NULL;
3281    } // end of for(Int_t ci=0;ci<4;ci++) // correlation index  
3282   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
3283  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
3284  // correction terms for non-uniform acceptance:
3285  for(Int_t t=0;t<2;t++) // type: RP or POI
3286  { 
3287   for(Int_t pe=0;pe<2;pe++) // pt or eta
3288   {
3289    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
3290    {
3291     for(Int_t cti=0;cti<9;cti++) // correction term index
3292     {
3293      fDiffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti] = NULL;
3294     }   
3295    }
3296   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
3297  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
3298
3299  // other differential correlators: 
3300  for(Int_t t=0;t<2;t++) // type: RP or POI
3301  { 
3302   for(Int_t pe=0;pe<2;pe++) // pt or eta
3303   {
3304    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
3305    {
3306     for(Int_t ci=0;ci<1;ci++) // correlator index
3307     {
3308      fOtherDirectDiffCorrelators[t][pe][sc][ci] = NULL;
3309     }   
3310    }
3311   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
3312  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
3313
3314 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForNestedLoops()
3315
3316 //=======================================================================================================================
3317
3318 void AliFlowAnalysisWithQCumulants::InitializeArraysForMixedHarmonics()
3319 {
3320  // Initialize arrays of all objects relevant for mixed harmonics.
3321
3322  for(Int_t power=0;power<2;power++) // linear or quadratic 
3323  {
3324   fMixedHarmonicEventWeights[power] = NULL;    
3325  }
3326
3327 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForMixedHarmonics()
3328
3329 //=======================================================================================================================
3330
3331 void AliFlowAnalysisWithQCumulants::BookEverythingForNestedLoops()
3332 {
3333  // Book all objects relevant for calculations with nested loops.
3334  
3335  TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data members?)
3336  TString typeFlag[2] = {"RP","POI"}; // to be improved (should I promote this to data members?)
3337  TString ptEtaFlag[2] = {"p_{T}","#eta"}; // to be improved (should I promote this to data members?)
3338  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"}; // to be improved (should I promote this to data members?)
3339  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
3340  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
3341
3342  TString evaluateNestedLoopsName = "fEvaluateNestedLoops";
3343  evaluateNestedLoopsName += fAnalysisLabel->Data();
3344  fEvaluateNestedLoops = new TProfile(evaluateNestedLoopsName.Data(),"Flags for nested loops",4,0,4);
3345  fEvaluateNestedLoops->SetLabelSize(0.03);
3346  fEvaluateNestedLoops->SetStats(kFALSE);
3347  (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(1,"fEvaluateIntFlowNestedLoops");
3348  (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(2,"fEvaluateDiffFlowNestedLoops");
3349  (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(3,"fCrossCheckInPtBinNo");
3350  (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(4,"fCrossCheckInEtaBinNo");
3351  fEvaluateNestedLoops->Fill(0.5,(Int_t)fEvaluateIntFlowNestedLoops);
3352  fEvaluateNestedLoops->Fill(1.5,(Int_t)fEvaluateDiffFlowNestedLoops);
3353  fEvaluateNestedLoops->Fill(2.5,fCrossCheckInPtBinNo);
3354  fEvaluateNestedLoops->Fill(3.5,fCrossCheckInEtaBinNo);
3355  fNestedLoopsList->Add(fEvaluateNestedLoops);
3356  // nested loops for integrated flow:
3357  if(fEvaluateIntFlowNestedLoops)
3358  {
3359   // correlations:
3360   TString intFlowDirectCorrelationsName = "fIntFlowDirectCorrelations";
3361   intFlowDirectCorrelationsName += fAnalysisLabel->Data();
3362   fIntFlowDirectCorrelations = new TProfile(intFlowDirectCorrelationsName.Data(),"Multiparticle correlations calculated with nested loops (for int. flow)",64,0,64,"s");
3363   fNestedLoopsList->Add(fIntFlowDirectCorrelations);
3364   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
3365   {
3366    TString intFlowExtraDirectCorrelationsName = "fIntFlowExtraDirectCorrelations";
3367    intFlowExtraDirectCorrelationsName += fAnalysisLabel->Data();
3368    fIntFlowExtraDirectCorrelations = new TProfile(intFlowExtraDirectCorrelationsName.Data(),"Extra multiparticle correlations calculated with nested loops (for int. flow)",100,0,100,"s");
3369    fNestedLoopsList->Add(fIntFlowExtraDirectCorrelations);  
3370   } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
3371   // correction terms for non-uniform acceptance:
3372   for(Int_t sc=0;sc<2;sc++) // sin or cos terms
3373   {
3374    TString intFlowDirectCorrectionTermsForNUAName = "fIntFlowDirectCorrectionTermsForNUA";
3375    intFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();
3376    fIntFlowDirectCorrectionTermsForNUA[sc] = new TProfile(Form("%s: %s terms",intFlowDirectCorrectionTermsForNUAName.Data(),sinCosFlag[sc].Data()),Form("Correction terms for non-uniform acceptance (%s terms)",sinCosFlag[sc].Data()),10,0,10,"s");
3377    fNestedLoopsList->Add(fIntFlowDirectCorrectionTermsForNUA[sc]);
3378   } // end of for(Int_t sc=0;sc<2;sc++) 
3379   // Mixed harmonics:
3380   if(fCalculateMixedHarmonics)
3381   {
3382    TString mixedHarmonicsNestedLoopsName = "fMixedHarmonicsNestedLoops";
3383    mixedHarmonicsNestedLoopsName += fAnalysisLabel->Data();
3384    fMixedHarmonicsNestedLoops = new TProfile(mixedHarmonicsNestedLoopsName.Data(),"Mixed harmonics calculated with nested loops",200,0,200); // TBI hardwired 200
3385    fNestedLoopsList->Add(fMixedHarmonicsNestedLoops);
3386   } // end of if(fCalculateMixedHarmonics)
3387  } // end of if(fEvaluateIntFlowNestedLoops)
3388  
3389  // nested loops for differential flow: 
3390  if(fEvaluateDiffFlowNestedLoops)
3391  {
3392   // reduced correlations:
3393   TString diffFlowDirectCorrelationsName = "fDiffFlowDirectCorrelations";
3394   diffFlowDirectCorrelationsName += fAnalysisLabel->Data();
3395   for(Int_t t=0;t<2;t++) // type: RP or POI
3396   { 
3397    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
3398    {
3399     for(Int_t rci=0;rci<4;rci++) // reduced correlation index
3400     {
3401      // reduced correlations:
3402      fDiffFlowDirectCorrelations[t][pe][rci] = new TProfile(Form("%s, %s, %s, %s",diffFlowDirectCorrelationsName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),reducedCorrelationIndex[rci].Data()),Form("%s, %s, %s, %s",diffFlowDirectCorrelationsName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),reducedCorrelationIndex[rci].Data()),1,lowerPtEtaEdge[pe],upperPtEtaEdge[pe],"s");
3403      fDiffFlowDirectCorrelations[t][pe][rci]->SetXTitle(ptEtaFlag[pe].Data());
3404      fNestedLoopsList->Add(fDiffFlowDirectCorrelations[t][pe][rci]); // to be improved (add dedicated list to hold reduced correlations)
3405     } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
3406    } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
3407   } // end of for(Int_t t=0;t<2;t++) // type: RP or POI 
3408   
3409   // correction terms for non-uniform acceptance:
3410   TString diffFlowDirectCorrectionTermsForNUAName = "fDiffFlowDirectCorrectionTermsForNUA";
3411   diffFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();
3412   for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
3413   { 
3414    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
3415    {
3416     for(Int_t sc=0;sc<2;sc++) // sin or cos
3417     {
3418      for(Int_t cti=0;cti<9;cti++) // correction term index
3419      {
3420       fDiffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti] = new TProfile(Form("%s, %s, %s, %s, cti = %d",diffFlowDirectCorrectionTermsForNUAName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),sinCosFlag[sc].Data(),cti+1),Form("%s, %s, %s, %s, cti = %d",diffFlowDirectCorrectionTermsForNUAName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),sinCosFlag[sc].Data(),cti+1),1,lowerPtEtaEdge[pe],upperPtEtaEdge[pe],"s"); 
3421       fNestedLoopsList->Add(fDiffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti]);
3422      }
3423     }
3424    }
3425   }
3426   // other differential correlators: 
3427   TString otherDirectDiffCorrelatorsName = "fOtherDirectDiffCorrelators";
3428   otherDirectDiffCorrelatorsName += fAnalysisLabel->Data();
3429   for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
3430   { 
3431    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
3432    {
3433     for(Int_t sc=0;sc<2;sc++) // sin or cos
3434     {
3435      for(Int_t ci=0;ci<1;ci++) // correlator index
3436      {
3437       fOtherDirectDiffCorrelators[t][pe][sc][ci] = new TProfile(Form("%s, %s, %s, %s, ci = %d",otherDirectDiffCorrelatorsName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),sinCosFlag[sc].Data(),ci+1),Form("%s, %s, %s, %s, ci = %d",otherDirectDiffCorrelatorsName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),sinCosFlag[sc].Data(),ci+1),1,lowerPtEtaEdge[pe],upperPtEtaEdge[pe]); 
3438       fNestedLoopsList->Add(fOtherDirectDiffCorrelators[t][pe][sc][ci]);
3439      }
3440     }
3441    }
3442   }
3443   // number of RPs and POIs in selected pt and eta bins for cross-checkings:
3444   TString noOfParticlesInBinName = "fNoOfParticlesInBin";
3445   fNoOfParticlesInBin = new TH1D(noOfParticlesInBinName.Data(),"Number of RPs and POIs in selected p_{T} and #eta bin",4,0,4);
3446   fNoOfParticlesInBin->GetXaxis()->SetBinLabel(1,"# of RPs in p_{T} bin");
3447   fNoOfParticlesInBin->GetXaxis()->SetBinLabel(2,"# of RPs in #eta bin");
3448   fNoOfParticlesInBin->GetXaxis()->SetBinLabel(3,"# of POIs in p_{T} bin");
3449   fNoOfParticlesInBin->GetXaxis()->SetBinLabel(4,"# of POIs in #eta bin");
3450   fNestedLoopsList->Add(fNoOfParticlesInBin);
3451  } // end of if(fEvaluateDiffFlowNestedLoops)
3452
3453 } // end of AliFlowAnalysisWithQCumulants::BookEverythingForNestedLoops()
3454
3455 //=========================================================================================================
3456
3457 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelations()
3458 {
3459  // Calculate in this method all multiparticle azimuthal correlations.
3460  //
3461  // Remark 1: All multiparticle correlations are stored in TProfile fIntFlowCorrelationsAllPro;
3462  // Remark 2: There is a special TProfile fIntFlowCorrelationsPro holding results 
3463  //           only for same harmonic's correlations <<2>>, <<4>>, <<6>> and <<8>>;  
3464  // Remark 3: Binning of fIntFlowCorrelationsAllPro is organized as follows:
3465  // --------------------------------------------------------------------------------------------------------------------
3466  //  1st bin: <2>_{1n|1n} = two1n1n = cos(1n(phi1-phi2))>
3467  //  2nd bin: <2>_{2n|2n} = two2n2n = cos(2n(phi1-phi2))>
3468  //  3rd bin: <2>_{3n|3n} = two3n3n = cos(3n(phi1-phi2))> 
3469  //  4th bin: <2>_{4n|4n} = two4n4n = cos(4n(phi1-phi2))>
3470  //  5th bin:           ----  EMPTY ----
3471  //  6th bin: <3>_{2n|1n,1n} = three2n1n1n = <cos(n(2*phi1-phi2-phi3))>
3472  //  7th bin: <3>_{3n|2n,1n} = three3n2n1n = <cos(n(3*phi1-2*phi2-phi3))>
3473  //  8th bin: <3>_{4n|2n,2n} = three4n2n2n = <cos(n(4*phi1-2*phi2-2*phi3))>
3474  //  9th bin: <3>_{4n|3n,1n} = three4n3n1n = <cos(n(4*phi1-3*phi2-phi3))>
3475  // 10th bin:           ----  EMPTY ----
3476  // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1n = <cos(n(phi1+phi2-phi3-phi4))>
3477  // 12th bin: <4>_{2n,1n|2n,1n} = four2n1n2n1n = <cos(n(2*phi1+phi2-2*phi3-phi4))>
3478  // 13th bin: <4>_{2n,2n|2n,2n} = four2n2n2n2n = <cos(2n(phi1+phi2-phi3-phi4))>
3479  // 14th bin: <4>_{3n|1n,1n,1n} = four3n1n1n1n = <cos(n(3*phi1-phi2-phi3-phi4))> 
3480  // 15th bin: <4>_{3n,1n|3n,1n} = four3n1n3n1n = <cos(n(3*phi1+phi2-3*phi3-phi4))>
3481  // 16th bin: <4>_{3n,1n|2n,2n} = four3n1n2n2n = <cos(n(3*phi1+phi2-2*phi3-2*phi4))>
3482  // 17th bin: <4>_{4n|2n,1n,1n} = four4n2n1n1n = <cos(n(4*phi1-2*phi2-phi3-phi4))>
3483  // 18th bin:           ----  EMPTY ----
3484  // 19th bin: <5>_{2n,1n|1n,1n,1n} = five2n1n1n1n1n = <cos(n(2*phi1+phi2-phi3-phi4-phi5))>
3485  // 20th bin: <5>_{2n,2n|2n,1n,1n} = five2n2n2n1n1n = <cos(n(2*phi1+2*phi2-2*phi3-phi4-phi5))>
3486  // 21st bin: <5>_{3n,1n|2n,1n,1n} = five3n1n2n1n1n = <cos(n(3*phi1+phi2-2*phi3-phi4-phi5))>
3487  // 22nd bin: <5>_{4n|1n,1n,1n,1n} = five4n1n1n1n1n = <cos(n(4*phi1-phi2-phi3-phi4-phi5))>
3488  // 23rd bin:           ----  EMPTY ----
3489  // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = six1n1n1n1n1n1n = <cos(n(phi1+phi2+phi3-phi4-phi5-phi6))>
3490  // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = six2n1n1n2n1n1n = <cos(n(2*phi1+phi2+phi3-2*phi4-phi5-phi6))>
3491  // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = six2n2n1n1n1n1n = <cos(n(2*phi1+2*phi2-phi3-phi4-phi5-phi6))>
3492  // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = six3n1n1n1n1n1n = <cos(n(3*phi1+phi2-phi3-phi4-phi5-phi6))> 
3493  // 28th bin:           ----  EMPTY ----
3494  // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = seven2n1n1n1n1n1n1n =  <cos(n(2*phi1+phi2+phi3-phi4-phi5-phi6-phi7))>
3495  // 30th bin:           ----  EMPTY ----
3496  // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = eight1n1n1n1n1n1n1n1n = <cos(n(phi1+phi2+phi3+phi4-phi5-phi6-phi7-phi8))>
3497  // 32nd bin:           ----  EMPTY ----
3498  //  Extra correlations for v3{5} study: 
3499  // 33rd bin: <4>_{4n,2n|3n,3n} = four4n2n3n3n = <cos(n(4*phi1+2*phi2-3*phi3-3*phi4))>
3500  // 34th bin: <5>_{3n,3n|2n,2n,2n} = five3n3n2n2n2n = <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-2*phi5))> 
3501  //  Extra correlations for Teaney-Yan study: 
3502  // 35th bin: <2>_{5n|5n} = two5n5n = <cos(5n(phi1-phi2)> 
3503  // 36th bin: <2>_{6n|6n} = two6n6n = <cos(6n(phi1-phi2)> 
3504  // 37th bin: <3>_{5n|3n,2n} = three5n3n2n = <cos(n(5*phi1-3*phi2-2*phi3)> 
3505  // 38th bin: <3>_{5n|4n,1n} = three5n4n1n = <cos(n(5*phi1-4*phi2-1*phi3)> 
3506  // 39th bin: <3>_{6n|3n,3n} = three6n3n3n = <cos(n(6*phi1-3*phi2-3*phi3)> 
3507  // 40th bin: <3>_{6n|4n,2n} = three6n4n2n = <cos(n(6*phi1-4*phi2-2*phi3)> 
3508  // 41st bin: <3>_{6n|5n,1n} = three6n5n1n = <cos(n(6*phi1-5*phi2-1*phi3)>
3509  // 42nd bin: <4>_{6n|3n,2n,1n} = four6n3n2n1n = <cos(n(6*phi1-3*phi2-2*phi3-1*phi4)>
3510  // 43rd bin: <4>_{3n,2n|3n,2n} = four3n2n3n2n = <cos(n(3*phi1+2*phi2-3*phi3-2*phi4)>
3511  // 44th bin: <4>_{4n,1n|3n,2n} = four4n1n3n2n = <cos(n(4*phi1+1*phi2-3*phi3-2*phi4)>
3512  // 45th bin: <4>_{3n,3n|3n,3n} = four3n3n3n3n = <cos(3n*(phi1+phi2-phi3-phi4))> 
3513  // 46th bin: <4>_{4n,2n|3n,3n} = four4n2n3n3n = <cos(n(4*phi1+2*phi2-3*phi3-3*phi4)>
3514  // 47th bin: <4>_{5n,1n|3n,3n} = four5n1n3n3n = <cos(n(5*phi1+1*phi2-3*phi3-3*phi4)>
3515  // 48th bin: <4>_{4n,2n|4n,2n} = four4n2n4n2n = <cos(n(4*phi1+2*phi2-4*phi3-2*phi4)> 
3516  // 49th bin: <4>_{5n,1n|4n,2n} = four5n1n4n2n = <cos(n(5*phi1+1*phi2-4*phi3-2*phi4)>
3517  // 50th bin: <4>_{5n|3n,1n,1n} = four5n3n1n1n = <cos(n(5*phi1-3*phi2-1*phi3-1*phi4)>
3518  // 51st bin: <4>_{5n|2n,2n,1n} = four5n2n2n1n = <cos(n(5*phi1-2*phi2-2*phi3-1*phi4)>
3519  // 52nd bin: <4>_{5n,1n|5n,1n} = four5n1n5n1n = <cos(n(5*phi1+1*phi2-5*phi3-1*phi4)>
3520  // 53rd bin: <5>_{3n,3n|3n,2n,1n} = five3n3n3n2n1n = <cos(n(3*phi1+3*phi2-3*phi3-2*phi4-1*phi5)>
3521  // 54th bin: <5>_{4n,2n|3n,2n,1n} = five4n2n3n2n1n = <cos(n(4*phi1+2*phi2-3*phi3-2*phi4-1*phi5)>
3522  // 55th bin: <5>_{3n,2n|3n,1n,1n} = five3n2n3n1n1n = <cos(n(3*phi1+2*phi2-3*phi3-1*phi4-1*phi5)>
3523  // 56th bin: <5>_{3n,2n|2n,2n,1n} = five3n2n2n2n1n = <cos(n(3*phi1+2*phi2-2*phi3-2*phi4-1*phi5)>
3524  // 57th bin: <5>_{5n,1n|3n,2n,1n} = five5n1n3n2n1n = <cos(n(5*phi1+1*phi2-3*phi3-2*phi4-1*phi5)>
3525  // 58th bin: <6>_{3n,2n,1n|3n,2n,1n} = six3n2n1n3n2n1n = <cos(n(3*phi1+2*phi2+1*phi3-3*phi4-2*phi5-1*phi6)>
3526  //  Extra correlations for Teaney-Yan study (B): 
3527  // 59th bin: <4>_{6n|4n,1n,1n} = four6n4n1n1n = <cos(n(6*phi1-4*phi2-1*phi3-1*phi4)>
3528  // 60th bin: <4>_{6n|2n,2n,2n} = four6n2n2n2n = <cos(n(6*phi1-2*phi2-2*phi3-2*phi4)>
3529  // 61st bin: <5>_{6n|2n,2n,1n,1n} = five6n2n2n1n1n = <cos(n(6*phi1-2*phi2-2*phi3-1*phi4-1*phi5)>
3530  // 62nd bin: <5>_{4n,1n,1n|3n,3n} = five4n1n1n3n3n = <cos(n(4*phi1+1*phi2+1*phi3-3*phi4-3*phi5)>
3531  // 63rd bin: <6>_{3n,3n|2n,2n,1n,1n} = six3n3n2n2n1n1n = <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-1*phi5-1*phi6)>
3532  // --------------------------------------------------------------------------------------------------------------------
3533
3534  // Multiplicity of an event: 
3535  Double_t dMult = (*fSpk)(0,0);
3536  // Real parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n, 4n, 5n and 6n: 
3537  Double_t dReQ1n = (*fReQ)(0,0);
3538  Double_t dReQ2n = (*fReQ)(1,0);
3539  Double_t dReQ3n = (*fReQ)(2,0);
3540  Double_t dReQ4n = (*fReQ)(3,0);
3541  Double_t dReQ5n = (*fReQ)(4,0); 
3542  Double_t dReQ6n = (*fReQ)(5,0);
3543  // Imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n, 4n, 5n and 6n:
3544  Double_t dImQ1n = (*fImQ)(0,0);
3545  Double_t dImQ2n = (*fImQ)(1,0);
3546  Double_t dImQ3n = (*fImQ)(2,0);
3547  Double_t dImQ4n = (*fImQ)(3,0);
3548  Double_t dImQ5n = (*fImQ)(4,0); 
3549  Double_t dImQ6n = (*fImQ)(5,0);
3550
3551  // Multiplicity bin of an event (relevant for all histos vs M): 
3552  Double_t dMultiplicityBin = 0.;
3553  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
3554  {
3555   dMultiplicityBin = fNumberOfRPsEBE+0.5;
3556  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
3557    {
3558     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
3559    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
3560      {
3561       dMultiplicityBin = fNumberOfPOIsEBE+0.5;
3562      }
3563   
3564  // Real parts of expressions involving various combinations of Q-vectors which appears
3565  // simultaneously in several equations for multiparticle correlations bellow: 
3566  // Re[Q_{2n}Q_{n}^*Q_{n}^*]
3567  Double_t reQ2nQ1nstarQ1nstar = pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n; 
3568  // Re[Q_{6n}Q_{3n}^*Q_{3n}^*]
3569  Double_t reQ6nQ3nstarQ3nstar = pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n;  
3570  // Re[Q_{4n}Q_{2n}^*Q_{2n}^*]
3571  Double_t reQ4nQ2nstarQ2nstar = pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n;
3572  // Re[Q_{4n}Q_{3n}^*Q_{n}^*]
3573  Double_t reQ4nQ3nstarQ1nstar = dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);
3574  // Re[Q_{3n}Q_{2n}^*Q_{n}^*]
3575  Double_t reQ3nQ2nstarQ1nstar = dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
3576                               + dImQ3n*dImQ2n*dReQ1n; 
3577  // Re[Q_{5n}Q_{3n}^*Q_{2n}^*]
3578  Double_t reQ5nQ3nstarQ2nstar = dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n
3579                               + dImQ5n*dImQ2n*dReQ3n;                             
3580  // Re[Q_{5n}Q_{4n}^*Q_{1n}^*]
3581  Double_t reQ5nQ4nstarQ1nstar = dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n
3582                               + dImQ5n*dImQ4n*dReQ1n;                              
3583  // Re[Q_{6n}Q_{5n}^*Q_{1n}^*]                              
3584  Double_t reQ6nQ5nstarQ1nstar = dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n
3585                               + dImQ6n*dImQ5n*dReQ1n;
3586  // Re[Q_{6n}Q_{4n}^*Q_{2n}^*]                              
3587  Double_t reQ6nQ4nstarQ2nstar = dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
3588                               + dImQ6n*dImQ4n*dReQ2n;
3589  // Re[Q_{3n}Q_{n}Q_{2n}^*Q_{2n}^*]
3590  Double_t reQ3nQ1nQ2nstarQ2nstar = (pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
3591                                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);                                
3592  // Re[Q_{3n}Q_{n}^*Q_{n}^*Q_{n}^*]
3593  Double_t reQ3nQ1nstarQ1nstarQ1nstar = dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
3594                                      + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3);
3595  // Re[Q_{6n}Q_{2n}^*Q_{2n}^*Q_{2n}^*]
3596  Double_t reQ6nQ2nstarQ2nstarQ2nstar = dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
3597                                      + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3);
3598  // Re[Q_{4n}Q_{2n}^*Q_{n}^*Q_{n}^*]
3599  Double_t reQ4nQ2nstarQ1nstarQ1nstar = (dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
3600                                      + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n);  
3601  // Re[Q_{4n}Q_{2n}^*Q_{3n}^*Q_{3n}^*]
3602  Double_t reQ4nQ2nQ3nstarQ3nstar = (dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
3603                                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n;                    
3604  // Re[Q_{4n}Q_{n}Q_{3n}^*Q_{2n}^*]
3605  Double_t reQ4nQ1nQ3nstarQ2nstar = dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
3606                                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
3607                                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
3608                                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n;
3609  // Re[Q_{5n}Q_{n}Q_{4n}^*Q_{2n}^*]
3610  Double_t reQ5nQ1nQ4nstarQ2nstar = dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
3611                                  + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
3612                                  - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n 
3613                                  + dImQ1n*dImQ2n*dReQ4n*dReQ5n+dReQ1n*dReQ2n*dReQ4n*dReQ5n;                                  
3614  // Re[Q_{5n}Q_{n}Q_{3n}^*Q_{3n}^*]                                  
3615  Double_t reQ5nQ1nQ3nstarQ3nstar = dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
3616                                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
3617                                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n;
3618  // Re[Q_{5n}Q_{3n}^*Q_{n}^*Q_{n}^*]                                  
3619  Double_t reQ5nQ3nstarQ1nstarQ1nstar = -pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
3620                                      + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
3621                                      - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n;                     
3622  // Re[Q_{5n}Q_{2n}^*Q_{2n}^*Q_{n}^*]                                  
3623  Double_t reQ5nQ2nstarQ2nstarQ1nstar = -pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
3624                                      + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
3625                                      - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n;                                     
3626  // Re[Q_{6n}Q_{4n}^*Q_{n}^*Q_{n}^*]                                  
3627  Double_t reQ6nQ4nstarQ1nstarQ1nstar = -pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
3628                                      +  2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
3629                                      -  pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n;
3630  // |Q_{2n}|^2 |Q_{n}|^2
3631  Double_t dQ2nQ1nQ2nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
3632  // |Q_{4n}|^2 |Q_{2n}|^2
3633  Double_t dQ4nQ2nQ4nstarQ2nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.));
3634  // |Q_{3n}|^2 |Q_{2n}|^2
3635  Double_t dQ3nQ2nQ3nstarQ2nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.));
3636  // |Q_{5n}|^2 |Q_{n}|^2
3637  Double_t dQ5nQ1nQ5nstarQ1nstar = (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
3638  // |Q_{3n}|^2 |Q_{n}|^2
3639  Double_t dQ3nQ1nQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
3640  // Re[Q_{2n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*]
3641  Double_t reQ2nQ1nQ1nstarQ1nstarQ1nstar = (dReQ2n*dReQ1n-dImQ2n*dImQ1n)*(pow(dReQ1n,3)-3.*dReQ1n*pow(dImQ1n,2))
3642                                         + (dReQ2n*dImQ1n+dReQ1n*dImQ2n)*(3.*dImQ1n*pow(dReQ1n,2)-pow(dImQ1n,3)); 
3643  // Re[Q_{2n}Q_{2n}Q_{2n}^*Q_{n}^*Q_{n}^*]
3644  Double_t reQ2nQ2nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
3645                                         * (dReQ2n*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) + 2.*dImQ2n*dReQ1n*dImQ1n);
3646  // Re[Q_{4n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
3647  Double_t reQ4nQ1nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,4.)*dReQ4n-6.*pow(dReQ1n,2.)*dReQ4n*pow(dImQ1n,2.)
3648                                             + pow(dImQ1n,4.)*dReQ4n+4.*pow(dReQ1n,3.)*dImQ1n*dImQ4n
3649                                             - 4.*pow(dImQ1n,3.)*dReQ1n*dImQ4n;
3650  // Re[Q_{3n}Q_{n}Q_{2n}^*Q_{n}^*Q_{n}^*]
3651  Double_t reQ3nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
3652                                         * (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n
3653                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n);
3654  // Re[Q_{6n}Q_{n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
3655  Double_t reQ6nQ3nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
3656                                      - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
3657                                      + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
3658                                      + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n;
3659  // Re[Q_{3n}Q_{3n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
3660  Double_t reQ3nQ3nQ3nstarQ2nstarQ1nstar = (pow(dImQ3n,2.)+pow(dReQ3n,2.))
3661                                         * (dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n
3662                                         - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n);   
3663  // Re[Q_{3n}Q_{3n}Q_{2n}^*Q_{2n}^*Q_{2n}^*]
3664  Double_t reQ3nQ3nQ2nstarQ2nstarQ2nstar = pow(dReQ2n,3.)*pow(dReQ3n,2.) 
3665                                         - 3.*dReQ2n*pow(dReQ3n,2.)*pow(dImQ2n,2.)
3666                                         + 6.*pow(dReQ2n,2.)*dReQ3n*dImQ2n*dImQ3n 
3667                                         - 2.*dReQ3n*pow(dImQ2n,3.)*dImQ3n-pow(dReQ2n,3.)*pow(dImQ3n,2.) 
3668                                         + 3.*dReQ2n*pow(dImQ2n,2.)*pow(dImQ3n,2.);
3669  // Re[Q_{4n}Q_{2n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
3670  Double_t reQ4nQ2nQ3nstarQ2nstarQ1nstar = (pow(dImQ2n,2.)+pow(dReQ2n,2.))
3671                                         * (dImQ3n*dImQ4n*dReQ1n+dImQ1n*dImQ4n*dReQ3n 
3672                                         - dImQ1n*dImQ3n*dReQ4n+dReQ1n*dReQ3n*dReQ4n);
3673  // Re[Q_{3n}Q_{2n}Q_{3n}^*Q_{n}^*Q_{n}^*]
3674  Double_t reQ3nQ2nQ3nstarQ1nstarQ1nstar = -(pow(dImQ3n,2.)+pow(dReQ3n,2.))
3675                                         * (-2.*dImQ1n*dImQ2n*dReQ1n+pow(dImQ1n,2.)*dReQ2n-pow(dReQ1n,2.)*dReQ2n);                              
3676  // Re[Q_{3n}Q_{2n}Q_{2n}^*Q_{2n}^*Q_{n}^*]
3677  Double_t reQ3nQ2nQ2nstarQ2nstarQ1nstar = (pow(dImQ2n,2.)+pow(dReQ2n,2.))
3678                                         * (dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n 
3679                                         - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n);
3680  // Re[Q_{5n}Q_{n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
3681  Double_t reQ5nQ1nQ3nstarQ2nstarQ1nstar = (pow(dImQ1n,2.)+pow(dReQ1n,2.))
3682                                         * (dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n 
3683                                         - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n);   
3684  // Re[Q_{2n}Q_{2n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
3685  Double_t reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)*dReQ2n-2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)
3686                                                + dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dImQ2n)
3687                                                * (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)
3688                                                - dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n+pow(dImQ1n,2.)*dImQ2n); 
3689  // Re[Q_{3n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
3690  Double_t reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
3691                                                * (pow(dReQ1n,3.)*dReQ3n-3.*dReQ1n*dReQ3n*pow(dImQ1n,2.)
3692                                                + 3.*pow(dReQ1n,2.)*dImQ1n*dImQ3n-pow(dImQ1n,3.)*dImQ3n);
3693  // |Q_{2n}|^2 |Q_{n}|^4
3694  Double_t dQ2nQ1nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.); 
3695  // |Q_{3n}|^2 |Q_{2n}|^2 |Q_{n}|^2
3696  Double_t dQ3nQ2nQ1nQ3nstarQ2nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3697                                           * (pow(dReQ1n,2.)+pow(dImQ1n,2.));
3698  // Re[Q_{2n}Q_{n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
3699  Double_t reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
3700                                                   * (pow(dReQ1n,2.)*dReQ2n-dReQ2n*pow(dImQ1n,2.)
3701                                                   + 2.*dReQ1n*dImQ1n*dImQ2n);                                                  
3702  // Re[Q_{6n}Q_{2n}^*Q_{2n}^*Q_{n}^*Q_{n}^*]
3703  Double_t reQ6nQ2nstarQ2nstarQ1nstarQ1nstar = pow(dReQ1n*dReQ2n,2.)*dReQ6n-pow(dReQ2n*dImQ1n,2.)*dReQ6n
3704                                             - 4.*dReQ1n*dReQ2n*dReQ6n*dImQ1n*dImQ2n 
3705                                             - pow(dReQ1n*dImQ2n,2.)*dReQ6n+pow(dImQ1n*dImQ2n,2.)*dReQ6n
3706                                             + 2.*dReQ1n*pow(dReQ2n,2.)*dImQ1n*dImQ6n
3707                                             + 2.*pow(dReQ1n,2.)*dReQ2n*dImQ2n*dImQ6n 
3708                                             - 2.*dReQ2n*pow(dImQ1n,2.)*dImQ2n*dImQ6n 
3709                                             - 2.*dReQ1n*dImQ1n*pow(dImQ2n,2.)*dImQ6n;       
3710  // Re[Q_{4n}Q_{1n}Q_{1n}Q_{3n}^*Q_{3n}^*]
3711  Double_t reQ4nQ1nQ1nQ3nstarQ3nstar = pow(dReQ1n*dReQ3n,2.)*dReQ4n-pow(dReQ3n*dImQ1n,2.)*dReQ4n  
3712                                     + 4.*dReQ1n*dReQ3n*dReQ4n*dImQ1n*dImQ3n 
3713                                     - pow(dReQ1n*dImQ3n,2.)*dReQ4n+pow(dImQ1n*dImQ3n,2.)*dReQ4n  
3714                                     - 2.*dReQ1n*pow(dReQ3n,2.)*dImQ1n*dImQ4n 
3715                                     + 2.*pow(dReQ1n,2.)*dReQ3n*dImQ3n*dImQ4n 
3716                                     - 2.*dReQ3n*pow(dImQ1n,2.)*dImQ3n*dImQ4n 
3717                                     + 2.*dReQ1n*dImQ1n*pow(dImQ3n,2.)*dImQ4n;
3718  // Re[Q_{3n}Q_{3n}Q_{2n}^*Q_{2n}^*Q_{1n}^*Q_{1n}^*]
3719  Double_t reQ3nQ3nQ2nstarQ2nstarQ1nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ2n*dReQ3n*dImQ1n-dReQ1n*dReQ3n*dImQ2n 
3720                                                - dReQ3n*dImQ1n*dImQ2n+dReQ1n*dReQ2n*dImQ3n+dReQ2n*dImQ1n*dImQ3n 
3721                                                + dReQ1n*dImQ2n*dImQ3n-dImQ1n*dImQ2n*dImQ3n)*(dReQ1n*dReQ2n*dReQ3n 
3722                                                + dReQ2n*dReQ3n*dImQ1n+dReQ1n*dReQ3n*dImQ2n-dReQ3n*dImQ1n*dImQ2n 
3723                                                - dReQ1n*dReQ2n*dImQ3n+dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n 
3724                                                + dImQ1n*dImQ2n*dImQ3n);
3725     
3726  // Results for multiparticle azimuthal correlations:
3727  // 2-particle:
3728  Double_t two1n1n = 0.; // <cos(n(phi1-phi2))>
3729  Double_t two2n2n = 0.; // <cos(2n(phi1-phi2))>
3730  Double_t two3n3n = 0.; // <cos(3n(phi1-phi2))>
3731  Double_t two4n4n = 0.; // <cos(4n(phi1-phi2))>
3732  if(dMult>1)
3733  {
3734   two1n1n = (pow(dReQ1n,2.)+pow(dImQ1n,2.)-dMult)/(dMult*(dMult-1.)); 
3735   two2n2n = (pow(dReQ2n,2.)+pow(dImQ2n,2.)-dMult)/(dMult*(dMult-1.)); 
3736   two3n3n = (pow(dReQ3n,2.)+pow(dImQ3n,2.)-dMult)/(dMult*(dMult-1.)); 
3737   two4n4n = (pow(dReQ4n,2.)+pow(dImQ4n,2.)-dMult)/(dMult*(dMult-1.)); 
3738   // Average 2-particle correlations for single event: 
3739   fIntFlowCorrelationsAllEBE->SetBinContent(1,two1n1n);
3740   fIntFlowCorrelationsAllEBE->SetBinContent(2,two2n2n);
3741   fIntFlowCorrelationsAllEBE->SetBinContent(3,two3n3n);
3742   fIntFlowCorrelationsAllEBE->SetBinContent(4,two4n4n);         
3743   // Average 2-particle correlations for all events:      
3744   fIntFlowCorrelationsAllPro->Fill(0.5,two1n1n,dMult*(dMult-1.));
3745   fIntFlowCorrelationsAllPro->Fill(1.5,two2n2n,dMult*(dMult-1.)); 
3746   fIntFlowCorrelationsAllPro->Fill(2.5,two3n3n,dMult*(dMult-1.)); 
3747   fIntFlowCorrelationsAllPro->Fill(3.5,two4n4n,dMult*(dMult-1.)); 
3748   // Store separetately <2>:
3749   fIntFlowCorrelationsEBE->SetBinContent(1,two1n1n); // <2>  
3750   // Testing other multiplicity weights:
3751   Double_t mWeight2p = 0.;
3752   if(fMultiplicityWeight->Contains("combinations"))
3753   {
3754    mWeight2p = dMult*(dMult-1.);
3755   } else if(fMultiplicityWeight->Contains("unit"))
3756     {
3757      mWeight2p = 1.;    
3758     } else if(fMultiplicityWeight->Contains("multiplicity"))
3759       {
3760        mWeight2p = dMult;           
3761       }          
3762   fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(1,mWeight2p); // eW_<2>
3763   fIntFlowCorrelationsPro->Fill(0.5,two1n1n,mWeight2p);
3764   fIntFlowSquaredCorrelationsPro->Fill(0.5,two1n1n*two1n1n,mWeight2p);
3765   if(fCalculateCumulantsVsM)
3766   {
3767    fIntFlowCorrelationsVsMPro[0]->Fill(dMultiplicityBin,two1n1n,mWeight2p);
3768    fIntFlowSquaredCorrelationsVsMPro[0]->Fill(dMultiplicityBin,two1n1n*two1n1n,mWeight2p);
3769   } 
3770   if(fCalculateAllCorrelationsVsM)
3771   {
3772    fIntFlowCorrelationsAllVsMPro[0]->Fill(dMultiplicityBin,two1n1n,mWeight2p);
3773    fIntFlowCorrelationsAllVsMPro[1]->Fill(dMultiplicityBin,two2n2n,mWeight2p);
3774    fIntFlowCorrelationsAllVsMPro[2]->Fill(dMultiplicityBin,two3n3n,mWeight2p);
3775    fIntFlowCorrelationsAllVsMPro[3]->Fill(dMultiplicityBin,two4n4n,mWeight2p);
3776   }  
3777  } // end of if(dMult>1)
3778  
3779  // 3-particle:
3780  Double_t three2n1n1n = 0.; // <cos(n(2*phi1-phi2-phi3))>
3781  Double_t three3n2n1n = 0.; // <cos(n(3*phi1-2*phi2-phi3))>
3782  Double_t three4n2n2n = 0.; // <cos(n(4*phi1-2*phi2-2*phi3))>
3783  Double_t three4n3n1n = 0.; // <cos(n(4*phi1-3*phi2-phi3))> 
3784  if(dMult>2)
3785  {
3786   three2n1n1n = (reQ2nQ1nstarQ1nstar-2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3787               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
3788               / (dMult*(dMult-1.)*(dMult-2.));                     
3789   three3n2n1n = (reQ3nQ2nstarQ1nstar-(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3790               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))
3791               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
3792               / (dMult*(dMult-1.)*(dMult-2.));
3793   three4n2n2n = (reQ4nQ2nstarQ2nstar-2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3794               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*dMult)
3795               / (dMult*(dMult-1.)*(dMult-2.)); 
3796   three4n3n1n = (reQ4nQ3nstarQ1nstar-(pow(dReQ4n,2.)+pow(dImQ4n,2.))
3797               - (pow(dReQ3n,2.)+pow(dImQ3n,2.))
3798               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
3799               / (dMult*(dMult-1.)*(dMult-2.));              
3800   // Average 3-particle correlations for single event: 
3801   fIntFlowCorrelationsAllEBE->SetBinContent(6,three2n1n1n);
3802   fIntFlowCorrelationsAllEBE->SetBinContent(7,three3n2n1n);
3803   fIntFlowCorrelationsAllEBE->SetBinContent(8,three4n2n2n);
3804   fIntFlowCorrelationsAllEBE->SetBinContent(9,three4n3n1n);
3805   // Average 3-particle correlations for all events:                
3806   fIntFlowCorrelationsAllPro->Fill(5.5,three2n1n1n,dMult*(dMult-1.)*(dMult-2.)); 
3807   fIntFlowCorrelationsAllPro->Fill(6.5,three3n2n1n,dMult*(dMult-1.)*(dMult-2.));
3808   fIntFlowCorrelationsAllPro->Fill(7.5,three4n2n2n,dMult*(dMult-1.)*(dMult-2.)); 
3809   fIntFlowCorrelationsAllPro->Fill(8.5,three4n3n1n,dMult*(dMult-1.)*(dMult-2.));  
3810   // Average 3-particle correlations vs M for all events:                
3811   if(fCalculateAllCorrelationsVsM)
3812   {
3813    fIntFlowCorrelationsAllVsMPro[5]->Fill(dMultiplicityBin,three2n1n1n,dMult*(dMult-1.)*(dMult-2.));
3814    fIntFlowCorrelationsAllVsMPro[6]->Fill(dMultiplicityBin,three3n2n1n,dMult*(dMult-1.)*(dMult-2.));
3815    fIntFlowCorrelationsAllVsMPro[7]->Fill(dMultiplicityBin,three4n2n2n,dMult*(dMult-1.)*(dMult-2.));
3816    fIntFlowCorrelationsAllVsMPro[8]->Fill(dMultiplicityBin,three4n3n1n,dMult*(dMult-1.)*(dMult-2.));
3817   }    
3818  } // end of if(dMult>2)
3819  
3820  // 4-particle:
3821  Double_t four1n1n1n1n = 0.; // <cos(n(phi1+phi2-phi3-phi4))>
3822  Double_t four2n2n2n2n = 0.; // <cos(2n(phi1+phi2-phi3-phi4))>
3823  Double_t four2n1n2n1n = 0.; // <cos(n(2*phi1+phi2-2*phi3-phi4))> 
3824  Double_t four3n1n1n1n = 0.; // <cos(n(3*phi1-phi2-phi3-phi4))> 
3825  Double_t four4n2n1n1n = 0.; // <cos(n(4*phi1-2*phi2-phi3-phi4))> 
3826  Double_t four3n1n2n2n = 0.; // <cos(n(3*phi1+phi2-2*phi3-2*phi4))> 
3827  Double_t four3n1n3n1n = 0.; // <cos(n(3*phi1+phi2-3*phi3-phi4))>    
3828  if(dMult>3)
3829  {
3830   four1n1n1n1n = (2.*dMult*(dMult-3.)+pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ1n,2.)
3831                + pow(dImQ1n,2.))-2.*reQ2nQ1nstarQ1nstar+(pow(dReQ2n,2.)+pow(dImQ2n,2.)))
3832                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));     
3833   four2n2n2n2n = (2.*dMult*(dMult-3.)+pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ2n,2.)
3834                + pow(dImQ2n,2.))-2.*reQ4nQ2nstarQ2nstar+(pow(dReQ4n,2.)+pow(dImQ4n,2.)))
3835                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));
3836   four2n1n2n1n = (dQ2nQ1nQ2nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar-2.*reQ2nQ1nstarQ1nstar)
3837                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
3838                - ((dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3839                + (dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-(pow(dReQ3n,2.)+pow(dImQ3n,2.)))
3840                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
3841                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));
3842   four3n1n1n1n = (reQ3nQ1nstarQ1nstarQ1nstar-3.*reQ3nQ2nstarQ1nstar-3.*reQ2nQ1nstarQ1nstar
3843                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3844                + 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
3845                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3846   four4n2n1n1n = (reQ4nQ2nstarQ1nstarQ1nstar-2.*reQ4nQ3nstarQ1nstar-reQ4nQ2nstarQ2nstar-2.*reQ3nQ2nstarQ1nstar)
3847                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
3848                - (reQ2nQ1nstarQ1nstar-2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3849                - 3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
3850                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
3851                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));
3852   four3n1n2n2n = (reQ3nQ1nQ2nstarQ2nstar-reQ4nQ2nstarQ2nstar-reQ4nQ3nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar)
3853                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
3854                - (2.*reQ2nQ1nstarQ1nstar-(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3855                - 4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
3856                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
3857                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.)); 
3858   four3n1n3n1n = ((pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3859                - 2.*reQ4nQ3nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar
3860                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3861                + pow(dReQ2n,2.)+pow(dImQ2n,2.)-(dMult-4.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3862                + dMult*(dMult-6.))
3863                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));           
3864   // Average 4-particle correlations for single event: 
3865   fIntFlowCorrelationsAllEBE->SetBinContent(11,four1n1n1n1n);
3866   fIntFlowCorrelationsAllEBE->SetBinContent(12,four2n1n2n1n);
3867   fIntFlowCorrelationsAllEBE->SetBinContent(13,four2n2n2n2n);
3868   fIntFlowCorrelationsAllEBE->SetBinContent(14,four3n1n1n1n);
3869   fIntFlowCorrelationsAllEBE->SetBinContent(15,four3n1n3n1n);
3870   fIntFlowCorrelationsAllEBE->SetBinContent(16,four3n1n2n2n);
3871   fIntFlowCorrelationsAllEBE->SetBinContent(17,four4n2n1n1n);       
3872   // Average 4-particle correlations for all events:                
3873   fIntFlowCorrelationsAllPro->Fill(10.5,four1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3874   fIntFlowCorrelationsAllPro->Fill(11.5,four2n1n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3875   fIntFlowCorrelationsAllPro->Fill(12.5,four2n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3876   fIntFlowCorrelationsAllPro->Fill(13.5,four3n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3877   fIntFlowCorrelationsAllPro->Fill(14.5,four3n1n3n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3878   fIntFlowCorrelationsAllPro->Fill(15.5,four3n1n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
3879   fIntFlowCorrelationsAllPro->Fill(16.5,four4n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
3880   // Average 4-particle correlations vs M for all events:                
3881   if(fCalculateAllCorrelationsVsM)
3882   {
3883    fIntFlowCorrelationsAllVsMPro[10]->Fill(dMultiplicityBin,four1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3884    fIntFlowCorrelationsAllVsMPro[11]->Fill(dMultiplicityBin,four2n1n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3885    fIntFlowCorrelationsAllVsMPro[12]->Fill(dMultiplicityBin,four2n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3886    fIntFlowCorrelationsAllVsMPro[13]->Fill(dMultiplicityBin,four3n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3887    fIntFlowCorrelationsAllVsMPro[14]->Fill(dMultiplicityBin,four3n1n3n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3888    fIntFlowCorrelationsAllVsMPro[15]->Fill(dMultiplicityBin,four3n1n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3889    fIntFlowCorrelationsAllVsMPro[16]->Fill(dMultiplicityBin,four4n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3890   }       
3891   // Store separetately <4>:
3892   fIntFlowCorrelationsEBE->SetBinContent(2,four1n1n1n1n); // <4>
3893   // Testing other multiplicity weights:
3894   Double_t mWeight4p = 0.;
3895   if(fMultiplicityWeight->Contains("combinations"))
3896   {
3897    mWeight4p = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.);
3898   } else if(fMultiplicityWeight->Contains("unit"))
3899     {
3900      mWeight4p = 1.;    
3901     } else if(fMultiplicityWeight->Contains("multiplicity"))
3902       {
3903        mWeight4p = dMult;           
3904       }      
3905   fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(2,mWeight4p); // eW_<4>
3906   fIntFlowCorrelationsPro->Fill(1.5,four1n1n1n1n,mWeight4p);
3907   fIntFlowSquaredCorrelationsPro->Fill(1.5,four1n1n1n1n*four1n1n1n1n,mWeight4p);
3908   if(fCalculateCumulantsVsM)
3909   {
3910    fIntFlowCorrelationsVsMPro[1]->Fill(dMultiplicityBin,four1n1n1n1n,mWeight4p);
3911    fIntFlowSquaredCorrelationsVsMPro[1]->Fill(dMultiplicityBin,four1n1n1n1n*four1n1n1n1n,mWeight4p);
3912   }   
3913  } // end of if(dMult>3)
3914
3915  // 5-particle:
3916  Double_t five2n1n1n1n1n = 0.; // <cos(n(2*phi1+phi2-phi3-phi4-phi5))>
3917  Double_t five2n2n2n1n1n = 0.; // <cos(n(2*phi1+2*phi2-2*phi3-phi4-phi5))>
3918  Double_t five3n1n2n1n1n = 0.; // <cos(n(3*phi1+phi2-2*phi3-phi4-phi5))>
3919  Double_t five4n1n1n1n1n = 0.; // <cos(n(4*phi1-phi2-phi3-phi4-phi5))>
3920  if(dMult>4)
3921  {            
3922   five2n1n1n1n1n = (reQ2nQ1nQ1nstarQ1nstarQ1nstar-reQ3nQ1nstarQ1nstarQ1nstar+5.*reQ3nQ2nstarQ1nstar
3923                  - 3.*(dMult-5.)*reQ2nQ1nstarQ1nstar-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3924                  - 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))     
3925                  + 3.*(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3926                  - 3.*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
3927                  + 6.*(2.*dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult*(dMult-4.))
3928                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
3929   five2n2n2n1n1n = (reQ2nQ2nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-2.*reQ3nQ1nQ2nstarQ2nstar
3930                  + 3.*reQ4nQ2nstarQ2nstar+8.*reQ3nQ2nstarQ1nstar+2.*reQ4nQ3nstarQ1nstar
3931                  - 2.*(dMult-6.)*reQ2nQ1nstarQ1nstar
3932                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3933                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)
3934                  + 2.*(3.*dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3935                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3936                  + 4.*(dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
3937                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
3938   five4n1n1n1n1n = (reQ4nQ1nstarQ1nstarQ1nstarQ1nstar-6.*reQ4nQ2nstarQ1nstarQ1nstar-4.*reQ3nQ1nstarQ1nstarQ1nstar
3939                  + 8.*reQ4nQ3nstarQ1nstar+3.*reQ4nQ2nstarQ2nstar+12.*reQ3nQ2nstarQ1nstar+12.*reQ2nQ1nstarQ1nstar
3940                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-8.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3941                  - 12.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-24.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+24.*dMult)
3942                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
3943   five3n1n2n1n1n = (reQ3nQ1nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ3nQ1nstarQ1nstarQ1nstar
3944                  - reQ3nQ1nQ2nstarQ2nstar+4.*reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar
3945                  - (2.*dMult-13.)*reQ3nQ2nstarQ1nstar+7.*reQ2nQ1nstarQ1nstar
3946                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
3947                  + 2.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3948                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3949                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3950                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3951                  - pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
3952                  + 2.*(3.*dMult-11.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
3953                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));                 
3954   // Average 5-particle correlations for single event: 
3955   fIntFlowCorrelationsAllEBE->SetBinContent(19,five2n1n1n1n1n);
3956   fIntFlowCorrelationsAllEBE->SetBinContent(20,five2n2n2n1n1n);
3957   fIntFlowCorrelationsAllEBE->SetBinContent(21,five3n1n2n1n1n);
3958   fIntFlowCorrelationsAllEBE->SetBinContent(22,five4n1n1n1n1n);        
3959   // Average 5-particle correlations for all events:                         
3960   fIntFlowCorrelationsAllPro->Fill(18.5,five2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
3961   fIntFlowCorrelationsAllPro->Fill(19.5,five2n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
3962   fIntFlowCorrelationsAllPro->Fill(20.5,five3n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
3963   fIntFlowCorrelationsAllPro->Fill(21.5,five4n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
3964   // Average 5-particle correlations vs M for all events:                
3965   if(fCalculateAllCorrelationsVsM)
3966   {
3967    fIntFlowCorrelationsAllVsMPro[18]->Fill(dMultiplicityBin,five2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
3968    fIntFlowCorrelationsAllVsMPro[19]->Fill(dMultiplicityBin,five2n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
3969    fIntFlowCorrelationsAllVsMPro[20]->Fill(dMultiplicityBin,five3n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
3970    fIntFlowCorrelationsAllVsMPro[21]->Fill(dMultiplicityBin,five4n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
3971   }    
3972  } // end of if(dMult>4)
3973     
3974  // 6-particle:
3975  Double_t six1n1n1n1n1n1n = 0.; // <cos(n(phi1+phi2+phi3-phi4-phi5-phi6))>
3976  Double_t six2n2n1n1n1n1n = 0.; // <cos(n(2*phi1+2*phi2-phi3-phi4-phi5-phi6))>
3977  Double_t six3n1n1n1n1n1n = 0.; // <cos(n(3*phi1+phi2-phi3-phi4-phi5-phi6))>
3978  Double_t six2n1n1n2n1n1n = 0.; // <cos(n(2*phi1+phi2+phi3-2*phi4-phi5-phi6))>
3979  if(dMult>5)
3980  {
3981   six1n1n1n1n1n1n = (pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),3.)-6.*reQ2nQ1nQ1nstarQ1nstarQ1nstar
3982                   + 4.*reQ3nQ1nstarQ1nstarQ1nstar-12.*reQ3nQ2nstarQ1nstar+18.*(dMult-4.)*reQ2nQ1nstarQ1nstar
3983                   + 9.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3984                   + 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-9.*(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3985                   - 9.*(dMult-4.)*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.) 
3986                   + 18.*(dMult*dMult-7.*dMult+10.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3987                   - 6.*dMult*(dMult*dMult-9.*dMult+20.))
3988                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
3989   six2n1n1n2n1n1n = (dQ2nQ1nQ1nQ2nstarQ1nstarQ1nstar-4.*reQ3nQ1nQ2nstarQ1nstarQ1nstar
3990                   - 4.*reQ2nQ1nQ1nstarQ1nstarQ1nstar-2.*reQ2nQ2nQ2nstarQ1nstarQ1nstar
3991                   + 4.*reQ4nQ2nstarQ1nstarQ1nstar+4.*reQ3nQ1nQ2nstarQ2nstar+4.*reQ3nQ1nstarQ1nstarQ1nstar
3992                   - 8.*reQ4nQ3nstarQ1nstar-4.*reQ4nQ2nstarQ2nstar+4.*(2.*dMult-13.)*reQ3nQ2nstarQ1nstar
3993                   + 2.*(7.*dMult-34.)*reQ2nQ1nstarQ1nstar+4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3994                   - 4.*(dMult-7.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3995                   + 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3996                   + pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)+(2.*dMult*dMult-27.*dMult+76.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3997                   - (dMult-12.)*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
3998                   + 4.*(dMult*dMult-15.*dMult+34.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3999                   - 2.*dMult*(dMult*dMult-17.*dMult+60.))
4000                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4001   six2n2n1n1n1n1n = (reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar-6.*reQ2nQ2nQ2nstarQ1nstarQ1nstar-reQ4nQ1nstarQ1nstarQ1nstarQ1nstar
4002                   - 8.*reQ2nQ1nQ1nstarQ1nstarQ1nstar+8.*reQ3nQ1nstarQ1nstarQ1nstar+6.*reQ4nQ2nstarQ1nstarQ1nstar
4003                   + 8.*reQ3nQ1nQ2nstarQ2nstar-40.*reQ3nQ2nstarQ1nstar-8.*reQ4nQ3nstarQ1nstar-9.*reQ4nQ2nstarQ2nstar
4004                   + 24.*(dMult-4.)*reQ2nQ1nstarQ1nstar+24.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4005                   + 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+16.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4006                   + 3.*pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)-12.*(2.*dMult-7.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4007                   + 12.*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)-48.*(dMult-3.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4008                   + 24.*dMult*(dMult-5.))
4009                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
4010   six3n1n1n1n1n1n = (reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar-6.*reQ3nQ1nQ2nstarQ1nstarQ1nstar+6.*reQ4nQ2nstarQ1nstarQ1nstar
4011                   - reQ4nQ1nstarQ1nstarQ1nstarQ1nstar-4.*reQ2nQ1nQ1nstarQ1nstarQ1nstar+3.*reQ3nQ1nQ2nstarQ2nstar
4012                   - 4.*(dMult-5.)*reQ3nQ1nstarQ1nstarQ1nstar-14.*reQ4nQ3nstarQ1nstar
4013                   - 3.*reQ4nQ2nstarQ2nstar+4.*(3.*dMult-17.)*reQ3nQ2nstarQ1nstar+12.*(dMult-6.)*reQ2nQ1nstarQ1nstar
4014                   + 12.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))  
4015                   + 8.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))  
4016                   + 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-8.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
4017                   - 12.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-48.*(dMult-3.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4018                   + 12.*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)+24.*dMult*(dMult-5.))
4019                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4020   // Average 6-particle correlations for single event: 
4021   fIntFlowCorrelationsAllEBE->SetBinContent(24,six1n1n1n1n1n1n);
4022   fIntFlowCorrelationsAllEBE->SetBinContent(25,six2n1n1n2n1n1n);
4023   fIntFlowCorrelationsAllEBE->SetBinContent(26,six2n2n1n1n1n1n);
4024   fIntFlowCorrelationsAllEBE->SetBinContent(27,six3n1n1n1n1n1n);
4025   // Average 6-particle correlations for all events:         
4026   fIntFlowCorrelationsAllPro->Fill(23.5,six1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
4027   fIntFlowCorrelationsAllPro->Fill(24.5,six2n1n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
4028   fIntFlowCorrelationsAllPro->Fill(25.5,six2n2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4029   fIntFlowCorrelationsAllPro->Fill(26.5,six3n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
4030   // Average 6-particle correlations vs M for all events:                
4031   if(fCalculateAllCorrelationsVsM)
4032   {
4033    fIntFlowCorrelationsAllVsMPro[23]->Fill(dMultiplicityBin,six1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4034    fIntFlowCorrelationsAllVsMPro[24]->Fill(dMultiplicityBin,six2n1n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4035    fIntFlowCorrelationsAllVsMPro[25]->Fill(dMultiplicityBin,six2n2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4036    fIntFlowCorrelationsAllVsMPro[26]->Fill(dMultiplicityBin,six3n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4037   }    
4038   // Store separetately <6>:
4039   fIntFlowCorrelationsEBE->SetBinContent(3,six1n1n1n1n1n1n); // <6>
4040   // Testing other multiplicity weights:
4041   Double_t mWeight6p = 0.;
4042   if(fMultiplicityWeight->Contains("combinations"))
4043   {
4044    mWeight6p = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.);
4045   } else if(fMultiplicityWeight->Contains("unit"))
4046     {
4047      mWeight6p = 1.;    
4048     } else if(fMultiplicityWeight->Contains("multiplicity"))
4049       {
4050        mWeight6p = dMult;           
4051       }
4052   fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(3,mWeight6p); // eW_<6>
4053   fIntFlowCorrelationsPro->Fill(2.5,six1n1n1n1n1n1n,mWeight6p);
4054   fIntFlowSquaredCorrelationsPro->Fill(2.5,six1n1n1n1n1n1n*six1n1n1n1n1n1n,mWeight6p);
4055   if(fCalculateCumulantsVsM)
4056   {
4057    fIntFlowCorrelationsVsMPro[2]->Fill(dMultiplicityBin,six1n1n1n1n1n1n,mWeight6p);
4058    fIntFlowSquaredCorrelationsVsMPro[2]->Fill(dMultiplicityBin,six1n1n1n1n1n1n*six1n1n1n1n1n1n,mWeight6p);
4059   }    
4060  } // end of if(dMult>5)
4061  
4062  // 7-particle:
4063  Double_t seven2n1n1n1n1n1n1n = 0.; // <cos(n(2*phi1+phi2+phi3-phi4-phi5-phi6-phi7))>
4064  if(dMult>6)
4065  {
4066   seven2n1n1n1n1n1n1n = (reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar-4.*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),3.)
4067                       - reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar-2.*reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar
4068                       + 9.*reQ2nQ2nQ2nstarQ1nstarQ1nstar+20.*reQ3nQ1nQ2nstarQ1nstarQ1nstar 
4069                       + 2.*reQ4nQ1nstarQ1nstarQ1nstarQ1nstar-8.*(dMult-8.)*reQ2nQ1nQ1nstarQ1nstarQ1nstar
4070                       - 18.*reQ4nQ2nstarQ1nstarQ1nstar-14.*reQ3nQ1nQ2nstarQ2nstar
4071                       + 8.*(dMult-7.)*reQ3nQ1nstarQ1nstarQ1nstar+28.*reQ4nQ3nstarQ1nstar
4072                       + 12.*reQ4nQ2nstarQ2nstar-8.*(5.*dMult-31.)*reQ3nQ2nstarQ1nstar      
4073                       + 12.*(dMult*dMult-15.*dMult+46.)*reQ2nQ1nstarQ1nstar
4074                       - 16.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4075                       - 6.*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4076                       - 3.*pow(pow(dReQ2n,2.)+pow(dImQ2n,2.),2.)
4077                       + 12.*(2.*dMult-13.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4078                       - 12.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+16.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4079                       - 12.*(dMult-8.)*(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4080                       + 12.*(3.*dMult-14.)*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.)
4081                       - 24.*(3.*dMult-7.)*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4082                       + 24.*dMult*(dMult-5.)*(dMult-6.))
4083                       / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.));   
4084   // Average 7-particle correlations for single event: 
4085   fIntFlowCorrelationsAllEBE->SetBinContent(29,seven2n1n1n1n1n1n1n);       
4086   // Average 7-particle correlations for all events:                      
4087   fIntFlowCorrelationsAllPro->Fill(28.5,seven2n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
4088                                                                  *(dMult-4.)*(dMult-5.)*(dMult-6.));
4089   // Average 7-particle correlations vs M for all events:                
4090   if(fCalculateAllCorrelationsVsM)
4091   {
4092    fIntFlowCorrelationsAllVsMPro[28]->Fill(dMultiplicityBin,seven2n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
4093                                                                               *(dMult-4.)*(dMult-5.)*(dMult-6.));
4094   }    
4095  } // end of if(dMult>6)
4096  
4097  // 8-particle:
4098  Double_t eight1n1n1n1n1n1n1n1n = 0.; // <cos(n(phi1+phi2+phi3+phi4-phi5-phi6-phi7-phi8))>
4099  if(dMult>7)
4100  {  
4101   eight1n1n1n1n1n1n1n1n = (pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),4.)-12.*reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar
4102                         + 16.*reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar+6.*reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar
4103                         - 12.*reQ4nQ1nstarQ1nstarQ1nstarQ1nstar-36.*reQ2nQ2nQ2nstarQ1nstarQ1nstar
4104                         - 96.*reQ3nQ1nQ2nstarQ1nstarQ1nstar
4105                         + 72.*reQ4nQ2nstarQ1nstarQ1nstar+48.*reQ3nQ1nQ2nstarQ2nstar
4106                         - 64.*(dMult-6.)*reQ3nQ1nstarQ1nstarQ1nstar
4107                         + 96.*(dMult-6.)*reQ2nQ1nQ1nstarQ1nstarQ1nstar
4108                         - 96.*reQ4nQ3nstarQ1nstar-36.*reQ4nQ2nstarQ2nstar
4109                         + 192.*(dMult-6.)*reQ3nQ2nstarQ1nstar
4110                         - 144.*(dMult-7.)*(dMult-4.)*reQ2nQ1nstarQ1nstar
4111                         + 64.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4112                         - 144.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4113                         + 72.*(dMult-7.)*(dMult-4.)*(pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
4114                         - 96.*(dMult-7.)*(dMult-6.)*(dMult-2.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4115                         + 36.*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4116                         + 9.*pow(pow(dReQ2n,2.)+pow(dImQ2n,2.),2.)
4117                         - 64.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4118                         + 36.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4119                         - 16.*(dMult-6.)*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),3.)
4120                         + 24.*dMult*(dMult-7.)*(dMult-6.)*(dMult-5.))
4121                         / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));   
4122   // Average 8-particle correlations for single event: 
4123   fIntFlowCorrelationsAllEBE->SetBinContent(31,eight1n1n1n1n1n1n1n1n);      
4124   // Average 8-particle correlations for all events:                       
4125   fIntFlowCorrelationsAllPro->Fill(30.5,eight1n1n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
4126                                                                    *(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));
4127   // Average 8-particle correlations vs M for all events:                
4128   if(fCalculateAllCorrelationsVsM)
4129   {
4130    fIntFlowCorrelationsAllVsMPro[30]->Fill(dMultiplicityBin,eight1n1n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
4131                                                                                 *(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));
4132   }     
4133   // Store separetately <8>:
4134   fIntFlowCorrelationsEBE->SetBinContent(4,eight1n1n1n1n1n1n1n1n); // <8>
4135   // Testing other multiplicity weights:
4136   Double_t mWeight8p = 0.;
4137   if(fMultiplicityWeight->Contains("combinations"))
4138   {
4139    mWeight8p = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.);
4140   } else if(fMultiplicityWeight->Contains("unit"))
4141     {
4142      mWeight8p = 1.;    
4143     } else if(fMultiplicityWeight->Contains("multiplicity"))
4144       {
4145        mWeight8p = dMult;           
4146       }        
4147   fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(4,mWeight8p); // eW_<8>
4148   fIntFlowCorrelationsPro->Fill(3.5,eight1n1n1n1n1n1n1n1n,mWeight8p);
4149   fIntFlowSquaredCorrelationsPro->Fill(3.5,eight1n1n1n1n1n1n1n1n*eight1n1n1n1n1n1n1n1n,mWeight8p);  
4150   if(fCalculateCumulantsVsM)
4151   {
4152    fIntFlowCorrelationsVsMPro[3]->Fill(dMultiplicityBin,eight1n1n1n1n1n1n1n1n,mWeight8p);
4153    fIntFlowSquaredCorrelationsVsMPro[3]->Fill(dMultiplicityBin,eight1n1n1n1n1n1n1n1n*eight1n1n1n1n1n1n1n1n,mWeight8p);
4154   }    
4155  } // end of if(dMult>7) 
4156  
4157  // EXTRA correlations for v3{5} study:
4158  // 4-particle:
4159  Double_t four4n2n3n3n = 0.; // <cos(n(4*phi1+2*phi2-3*phi3-3*phi4))>
4160  if(dMult>3.)
4161  {
4162   four4n2n3n3n = (reQ4nQ2nQ3nstarQ3nstar-reQ6nQ4nstarQ2nstar-reQ6nQ3nstarQ3nstar
4163                - 2.*reQ4nQ3nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar
4164                + (pow(dReQ6n,2.)+pow(dImQ6n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4165                + 2.*(2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4166                + (pow(dReQ1n,2.)+pow(dImQ1n,2.))-3.*dMult))
4167                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));               
4168   fIntFlowCorrelationsAllPro->Fill(32.5,four4n2n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4169   // Average 4-particle correlations vs M for all events:                
4170   if(fCalculateAllCorrelationsVsM)
4171   {
4172    fIntFlowCorrelationsAllVsMPro[32]->Fill(dMultiplicityBin,four4n2n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4173   }    
4174  } // end of if(dMult>3.)
4175  
4176  // 5-particle:
4177  Double_t five3n3n2n2n2n = 0.; // <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-2*phi5))>                                    
4178  if(dMult>4.)
4179  {
4180   five3n3n2n2n2n = (reQ3nQ3nQ2nstarQ2nstarQ2nstar-reQ6nQ2nstarQ2nstarQ2nstar-3.*reQ4nQ2nQ3nstarQ3nstar 
4181                  - 6.*reQ3nQ1nQ2nstarQ2nstar+2.*reQ6nQ3nstarQ3nstar+3.*reQ6nQ4nstarQ2nstar
4182                  + 6.*reQ4nQ3nstarQ1nstar+6.*reQ4nQ2nstarQ2nstar
4183                  + 12.*reQ3nQ2nstarQ1nstar+6.*reQ2nQ1nstarQ1nstar
4184                  - 2.*((pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
4185                  + 3.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4186                  + 6.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
4187                  + 9.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4188                  + 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-12.*dMult))
4189                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4190   fIntFlowCorrelationsAllPro->Fill(33.5,five3n3n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4191   if(fCalculateAllCorrelationsVsM)
4192   {
4193    fIntFlowCorrelationsAllVsMPro[33]->Fill(dMultiplicityBin,five3n3n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4194   }     
4195  } // end of if(dMult>4.)
4196  
4197  // EXTRA correlations for Teaney-Yan study: 
4198  // 2-particle:
4199  Double_t two5n5n = 0.; // <cos(5n(phi1-phi2))>
4200  Double_t two6n6n = 0.; // <cos(6n(phi1-phi2))> 
4201  if(dMult>1)
4202  {
4203   two5n5n = (pow(dReQ5n,2.)+pow(dImQ5n,2.)-dMult)/(dMult*(dMult-1.)); 
4204   two6n6n = (pow(dReQ6n,2.)+pow(dImQ6n,2.)-dMult)/(dMult*(dMult-1.));        
4205   // Average 2-particle correlations for all events:      
4206   fIntFlowCorrelationsAllPro->Fill(34.5,two5n5n,dMult*(dMult-1.));
4207   fIntFlowCorrelationsAllPro->Fill(35.5,two6n6n,dMult*(dMult-1.)); 
4208   if(fCalculateAllCorrelationsVsM)
4209   {
4210    fIntFlowCorrelationsAllVsMPro[34]->Fill(dMultiplicityBin,two5n5n,dMult*(dMult-1.));
4211    fIntFlowCorrelationsAllVsMPro[35]->Fill(dMultiplicityBin,two6n6n,dMult*(dMult-1.));
4212   }       
4213  } // end of if(dMult>1)
4214  
4215  // 3-particle:
4216  Double_t three5n3n2n = 0.; // <cos(n(5*phi1-3*phi2-2*phi3)> 
4217  Double_t three5n4n1n = 0.; // <cos(n(5*phi1-4*phi2-1*phi3)> 
4218  Double_t three6n3n3n = 0.; // <cos(n(6*phi1-3*phi2-3*phi3)> 
4219  Double_t three6n4n2n = 0.; // <cos(n(6*phi1-4*phi2-2*phi3)> 
4220  Double_t three6n5n1n = 0.; // <cos(n(6*phi1-5*phi2-1*phi3)> 
4221  if(dMult>2)
4222  {
4223   three5n3n2n = (reQ5nQ3nstarQ2nstar-(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4224               - (pow(dReQ3n,2.)+pow(dImQ3n,2.))
4225               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
4226               / (dMult*(dMult-1.)*(dMult-2.));           
4227   three5n4n1n = (reQ5nQ4nstarQ1nstar-(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4228               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))
4229               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4230               / (dMult*(dMult-1.)*(dMult-2.));                          
4231   three6n3n3n = (reQ6nQ3nstarQ3nstar-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4232               - (pow(dReQ6n,2.)+pow(dImQ6n,2.))+2.*dMult)
4233               / (dMult*(dMult-1.)*(dMult-2.)); 
4234   three6n4n2n = (reQ6nQ4nstarQ2nstar-(pow(dReQ6n,2.)+pow(dImQ6n,2.))
4235               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))
4236               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
4237               / (dMult*(dMult-1.)*(dMult-2.));
4238   three6n5n1n = (reQ6nQ5nstarQ1nstar-(pow(dReQ6n,2.)+pow(dImQ6n,2.))
4239               - (pow(dReQ5n,2.)+pow(dImQ5n,2.))
4240               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4241               / (dMult*(dMult-1.)*(dMult-2.));            
4242   // Average 3-particle correlations for all events:      
4243   fIntFlowCorrelationsAllPro->Fill(36.5,three5n3n2n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(5*phi1-3*phi2-2*phi3)>> 
4244   fIntFlowCorrelationsAllPro->Fill(37.5,three5n4n1n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(5*phi1-4*phi2-1*phi3)>> 
4245   fIntFlowCorrelationsAllPro->Fill(38.5,three6n3n3n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(6*phi1-3*phi2-3*phi3)>> 
4246   fIntFlowCorrelationsAllPro->Fill(39.5,three6n4n2n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(6*phi1-4*phi2-2*phi3)>>
4247   fIntFlowCorrelationsAllPro->Fill(40.5,three6n5n1n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(6*phi1-5*phi2-1*phi3)>>
4248   if(fCalculateAllCorrelationsVsM)
4249   {
4250    fIntFlowCorrelationsAllVsMPro[36]->Fill(dMultiplicityBin,three5n3n2n,dMult*(dMult-1.)*(dMult-2.));
4251    fIntFlowCorrelationsAllVsMPro[37]->Fill(dMultiplicityBin,three5n4n1n,dMult*(dMult-1.)*(dMult-2.));
4252    fIntFlowCorrelationsAllVsMPro[38]->Fill(dMultiplicityBin,three6n3n3n,dMult*(dMult-1.)*(dMult-2.));
4253    fIntFlowCorrelationsAllVsMPro[39]->Fill(dMultiplicityBin,three6n4n2n,dMult*(dMult-1.)*(dMult-2.));
4254    fIntFlowCorrelationsAllVsMPro[40]->Fill(dMultiplicityBin,three6n5n1n,dMult*(dMult-1.)*(dMult-2.));
4255   }       
4256  } // end of if(dMult>2)
4257  
4258  // 4-particle:
4259  Double_t four6n3n2n1n = 0.; // <cos(n(6*phi1-3*phi2-2*phi3-1*phi4)>
4260  Double_t four3n2n3n2n = 0.; // <cos(n(3*phi1+2*phi2-3*phi3-2*phi4)>
4261  Double_t four4n1n3n2n = 0.; // <cos(n(4*phi1+1*phi2-3*phi3-2*phi4)> 
4262  Double_t four3n3n3n3n = 0.; // <cos(3n(phi1+phi2-phi3-phi4))> 
4263  //Double_t four4n2n3n3n = 0.; // <cos(n(4*phi1+2*phi2-3*phi3-3*phi4)> // I already have this one above
4264  Double_t four5n1n3n3n = 0.; // <cos(n(5*phi1+1*phi2-3*phi3-3*phi4)>
4265  Double_t four4n2n4n2n = 0.; // <cos(n(4*phi1+2*phi2-4*phi3-2*phi4)> 
4266  Double_t four5n1n4n2n = 0.; // <cos(n(5*phi1+1*phi2-4*phi3-2*phi4)> 
4267  Double_t four5n3n1n1n = 0.; // <cos(n(5*phi1-3*phi2-1*phi3-1*phi4)> 
4268  Double_t four5n2n2n1n = 0.; // <cos(n(5*phi1-2*phi2-2*phi3-1*phi4)>
4269  Double_t four5n1n5n1n = 0.; // <cos(n(5*phi1+1*phi2-5*phi3-1*phi4)>
4270  Double_t four6n4n1n1n = 0.; // <cos(n(6*phi1-4*phi2-1*phi3-1*phi4)>
4271  Double_t four6n2n2n2n = 0.; // <cos(n(6*phi1-2*phi2-2*phi3-2*phi4)>
4272  if(dMult>3)
4273  {
4274   four6n3n2n1n = (reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ4nstarQ2nstar-reQ6nQ3nstarQ3nstar-reQ6nQ5nstarQ1nstar
4275                - reQ5nQ3nstarQ2nstar-reQ4nQ3nstarQ1nstar-reQ3nQ2nstarQ1nstar
4276                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+pow(dReQ5n,2.)+pow(dImQ5n,2.)
4277                + pow(dReQ4n,2.)+pow(dImQ4n,2.)+3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4278                + 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
4279                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4280   four3n2n3n2n = (dQ3nQ2nQ3nstarQ2nstar-2.*reQ5nQ3nstarQ2nstar-2.*reQ3nQ2nstarQ1nstar
4281                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)               
4282                -(dMult-4.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
4283                + dMult*(dMult-6.))
4284                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));     
4285   four4n1n3n2n = (reQ4nQ1nQ3nstarQ2nstar-reQ5nQ3nstarQ2nstar-reQ5nQ4nstarQ1nstar-reQ4nQ3nstarQ1nstar
4286                - reQ4nQ2nstarQ2nstar-reQ3nQ2nstarQ1nstar-reQ2nQ1nstarQ1nstar
4287                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4288                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4289                + 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
4290                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));                             
4291   four3n3n3n3n = (2.*dMult*(dMult-3.)+pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ3n,2.)
4292                + pow(dImQ3n,2.))-2.*reQ6nQ3nstarQ3nstar+(pow(dReQ6n,2.)+pow(dImQ6n,2.)))
4293                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));   
4294   //four4n2n3n3n = ; // I already have this one above
4295   four5n1n3n3n = (reQ5nQ1nQ3nstarQ3nstar-reQ6nQ5nstarQ1nstar-reQ6nQ3nstarQ3nstar-2.*reQ5nQ3nstarQ2nstar
4296                - 2.*reQ3nQ2nstarQ1nstar+pow(dReQ6n,2.)+pow(dImQ6n,2.)+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4297                + 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4298                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)                                  
4299                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));   
4300   four4n2n4n2n = (dQ4nQ2nQ4nstarQ2nstar-2.*reQ6nQ4nstarQ2nstar-2.*reQ4nQ2nstarQ2nstar)
4301                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4302                - ((dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4303                + (dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-(pow(dReQ6n,2.)+pow(dImQ6n,2.)))
4304                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4305                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.)); 
4306   four5n1n4n2n = (reQ5nQ1nQ4nstarQ2nstar-reQ6nQ5nstarQ1nstar-reQ6nQ4nstarQ2nstar-reQ5nQ4nstarQ1nstar
4307                - reQ5nQ3nstarQ2nstar-reQ4nQ3nstarQ1nstar-reQ2nQ1nstarQ1nstar+pow(dReQ6n,2.)+pow(dImQ6n,2.)
4308                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4309                + pow(dReQ3n,2.)+pow(dImQ3n,2.)+2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4310                + 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
4311                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));     
4312   four5n3n1n1n = (reQ5nQ3nstarQ1nstarQ1nstar-2.*reQ5nQ4nstarQ1nstar-reQ5nQ3nstarQ2nstar-2.*reQ4nQ3nstarQ1nstar
4313                - reQ2nQ1nstarQ1nstar+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4314                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+pow(dReQ2n,2.)+pow(dImQ2n,2.)
4315                + 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
4316                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));                    
4317   four5n2n2n1n = (reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ4nstarQ1nstar-2.*reQ5nQ3nstarQ2nstar-reQ4nQ2nstarQ2nstar
4318                - 2.*reQ3nQ2nstarQ1nstar+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+pow(dReQ4n,2.)+pow(dImQ4n,2.)
4319                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4320                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
4321                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));   
4322   four5n1n5n1n = (dQ5nQ1nQ5nstarQ1nstar-2.*reQ6nQ5nstarQ1nstar-2.*reQ5nQ4nstarQ1nstar
4323                + pow(dReQ6n,2.)+pow(dImQ6n,2.)-(dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4324                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+dMult*(dMult-6.))  
4325                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));    
4326                               
4327   // TBI: Recursive formula needed:
4328   four6n4n1n1n = (reQ6nQ4nstarQ1nstarQ1nstar
4329                - dMult*(dMult-1.)*(dMult-2.)*(three2n1n1n+2.*three5n4n1n+2.*three6n5n1n+three6n4n2n)
4330                - dMult*(dMult-1.)*(2.*two1n1n+1.*two4n4n+1.*two6n6n+1.*two2n2n+2.*two5n5n)
4331                - 1.*dMult)
4332                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4333   
4334   four6n2n2n2n = (reQ6nQ2nstarQ2nstarQ2nstar-3.*reQ6nQ4nstarQ2nstar-3.*reQ4nQ2nstarQ2nstar
4335                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+3.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4336                + 6.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-6.*dMult)
4337                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4338   // Average 4-particle correlations for all events:      
4339   fIntFlowCorrelationsAllPro->Fill(41.5,four6n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4340   fIntFlowCorrelationsAllPro->Fill(42.5,four3n2n3n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4341   fIntFlowCorrelationsAllPro->Fill(43.5,four4n1n3n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4342   fIntFlowCorrelationsAllPro->Fill(44.5,four3n3n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4343   //fIntFlowCorrelationsAllPro->Fill(45.5,four4n2n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); // I already have this one above
4344   fIntFlowCorrelationsAllPro->Fill(46.5,four5n1n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4345   fIntFlowCorrelationsAllPro->Fill(47.5,four4n2n4n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4346   fIntFlowCorrelationsAllPro->Fill(48.5,four5n1n4n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4347   fIntFlowCorrelationsAllPro->Fill(49.5,four5n3n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4348   fIntFlowCorrelationsAllPro->Fill(50.5,four5n2n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4349   fIntFlowCorrelationsAllPro->Fill(51.5,four5n1n5n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4350   fIntFlowCorrelationsAllPro->Fill(58.5,four6n4n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4351   fIntFlowCorrelationsAllPro->Fill(59.5,four6n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4352   if(fCalculateAllCorrelationsVsM)
4353   {
4354    fIntFlowCorrelationsAllVsMPro[41]->Fill(dMultiplicityBin,four6n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4355    fIntFlowCorrelationsAllVsMPro[42]->Fill(dMultiplicityBin,four3n2n3n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4356    fIntFlowCorrelationsAllVsMPro[43]->Fill(dMultiplicityBin,four4n1n3n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4357    fIntFlowCorrelationsAllVsMPro[44]->Fill(dMultiplicityBin,four3n3n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4358    //fIntFlowCorrelationsAllVsMPro[45]->Fill(dMultiplicityBin,four4n2n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4359    fIntFlowCorrelationsAllVsMPro[46]->Fill(dMultiplicityBin,four5n1n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4360    fIntFlowCorrelationsAllVsMPro[47]->Fill(dMultiplicityBin,four4n2n4n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4361    fIntFlowCorrelationsAllVsMPro[48]->Fill(dMultiplicityBin,four5n1n4n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4362    fIntFlowCorrelationsAllVsMPro[49]->Fill(dMultiplicityBin,four5n3n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4363    fIntFlowCorrelationsAllVsMPro[50]->Fill(dMultiplicityBin,four5n2n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4364    fIntFlowCorrelationsAllVsMPro[51]->Fill(dMultiplicityBin,four5n1n5n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4365    fIntFlowCorrelationsAllVsMPro[58]->Fill(dMultiplicityBin,four6n4n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4366    fIntFlowCorrelationsAllVsMPro[59]->Fill(dMultiplicityBin,four6n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4367   }       
4368  } // end of if(dMult>3)
4369
4370  // 5-particle:
4371  Double_t five3n3n3n2n1n = 0.; // <cos(n(3*phi1+3*phi2-3*phi3-2*phi4-1*phi5)>
4372  Double_t five4n2n3n2n1n = 0.; // <cos(n(4*phi1+2*phi2-3*phi3-2*phi4-1*phi5)>
4373  Double_t five3n2n3n1n1n = 0.; // <cos(n(3*phi1+2*phi2-3*phi3-1*phi4-1*phi5)>
4374  Double_t five3n2n2n2n1n = 0.; // <cos(n(3*phi1+2*phi2-2*phi3-2*phi4-1*phi5)>
4375  Double_t five5n1n3n2n1n = 0.; // <cos(n(5*phi1+1*phi2-3*phi3-2*phi4-1*phi5)>
4376  Double_t five6n2n2n1n1n = 0.; // <cos(n(6*phi1-2*phi2-2*phi3-1*phi4-1*phi5)>
4377  Double_t five4n1n1n3n3n = 0.; // <cos(n(4*phi1+1*phi2+1*phi3-3*phi4-3*phi5)>
4378  if(dMult>4)
4379  { 
4380   five3n3n3n2n1n = (reQ3nQ3nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ5nQ1nQ3nstarQ3nstar-reQ4nQ2nQ3nstarQ3nstar
4381                  + reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+3.*reQ6nQ3nstarQ3nstar+4.*reQ5nQ3nstarQ2nstar+4.*reQ4nQ3nstarQ1nstar
4382                  - 2.*(dMult-6.)*reQ3nQ2nstarQ1nstar-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
4383                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4384                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4385                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(3.*dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4386                  - pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)+2.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4387                  + 2.*(dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
4388                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));                                  
4389   five4n2n3n2n1n = (reQ4nQ2nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar
4390                  - reQ4nQ2nQ3nstarQ3nstar-reQ4nQ1nQ3nstarQ2nstar-reQ4nQ2nstarQ1nstarQ1nstar
4391                  - reQ3nQ1nQ2nstarQ2nstar-(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4392                  + 3.*reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ6nQ3nstarQ3nstar+reQ5nQ4nstarQ1nstar
4393                  + 3.*reQ5nQ3nstarQ2nstar-(dMult-7.)*reQ4nQ3nstarQ1nstar+3.*reQ4nQ2nstarQ2nstar+7.*reQ3nQ2nstarQ1nstar
4394                  + 4.*reQ2nQ1nstarQ1nstar-(pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4395                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4396                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4397                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4398                  + 2.*(dMult-7.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+(dMult-12.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4399                  - 2.*dMult*(dMult-12.))
4400                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));   
4401   five3n2n3n1n1n = (reQ3nQ2nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-2.*reQ4nQ1nQ3nstarQ2nstar-reQ3nQ1nstarQ1nstarQ1nstar
4402                  - 2.*reQ3nQ1nQ2nstarQ2nstar+2.*reQ5nQ4nstarQ1nstar+3.*reQ5nQ3nstarQ2nstar+6.*reQ4nQ3nstarQ1nstar
4403                  + 2.*reQ4nQ2nstarQ2nstar+9.*reQ3nQ2nstarQ1nstar-(dMult-8.)*reQ2nQ1nstarQ1nstar
4404                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
4405                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
4406                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4407                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(dMult-12.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4408                  + 2.*(dMult-9.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.))
4409                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4410   five3n2n2n2n1n = (reQ3nQ2nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ4nQ1nQ3nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar
4411                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+reQ5nQ4nstarQ1nstar
4412                  + 4.*reQ5nQ3nstarQ2nstar+reQ4nQ3nstarQ1nstar+3.*reQ4nQ2nstarQ2nstar-2.*(dMult-6.)*reQ3nQ2nstarQ1nstar
4413                  + 4.*reQ2nQ1nstarQ1nstar-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4414                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4415                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4416                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)+2.*(3.*dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4417                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
4418                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
4419   five5n1n3n2n1n = (reQ5nQ1nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ3nstarQ3nstar
4420                  - reQ4nQ1nQ3nstarQ2nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar 
4421                  + 3.*reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ3nstarQ3nstar+4.*reQ5nQ4nstarQ1nstar
4422                  - (dMult-7.)*reQ5nQ3nstarQ2nstar+4.*reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar+6.*reQ3nQ2nstarQ1nstar
4423                  + 3.*reQ2nQ1nstarQ1nstar-(pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4424                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4425                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4426                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+(dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))  
4427                  - 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4428                  + (dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*(dMult-7.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4429                  - 2.*dMult*(dMult-12.))
4430                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));       
4431   // Peter Jochumzsen:
4432   five6n2n2n1n1n = (reQ6nQ2nstarQ2nstarQ1nstarQ1nstar
4433                  - 12.*pow(dReQ1n,2.)-12.*pow(dImQ1n,2.)
4434                  - 14.*pow(dReQ2n,2.)-14.*pow(dImQ2n,2.)
4435                  - 8.*pow(dReQ3n,2.)-8.*pow(dImQ3n,2.)
4436                  - 6.*pow(dReQ4n,2.)-6.*pow(dImQ4n,2.)
4437                  - 4.*pow(dReQ5n,2.)-4.*pow(dImQ5n,2.)
4438                  - 6.*pow(dReQ6n,2.)-6.*pow(dImQ6n,2.)
4439                  + 2.*reQ2nQ1nstarQ1nstar + 8.*reQ3nQ2nstarQ1nstar
4440                  + 5.*reQ6nQ4nstarQ2nstar - reQ6nQ4nstarQ1nstarQ1nstar
4441                  + 2.*reQ6nQ3nstarQ3nstar - reQ6nQ2nstarQ2nstarQ2nstar 
4442                  + 4.*reQ4nQ2nstarQ2nstar - 2.*reQ4nQ2nstarQ1nstarQ1nstar 
4443                  + 2.*reQ5nQ4nstarQ1nstar - 2.*reQ5nQ2nstarQ2nstarQ1nstar 
4444                  + 4.*reQ4nQ3nstarQ1nstar + 4.*reQ5nQ3nstarQ2nstar
4445                  + 4.*reQ6nQ5nstarQ1nstar - 4.*reQ6nQ3nstarQ2nstarQ1nstar + 24.*dMult)
4446                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));  
4447   // Peter Jochumzsen:
4448   five4n1n1n3n3n = (reQ4nQ1nQ1nQ3nstarQ3nstar-16.*pow(dReQ1n,2.)-16.*pow(dImQ1n,2.)
4449                  - 10.*pow(dReQ2n,2.)-10.*pow(dImQ2n,2.)-12.*pow(dReQ3n,2.)-12.*pow(dImQ3n,2.)
4450                  - 6.*pow(dReQ4n,2.)-6.*pow(dImQ4n,2.)-4.*pow(dReQ5n,2.)-4.*pow(dImQ5n,2.)
4451                  - 2.*pow(dReQ6n,2.)-2.*pow(dImQ6n,2.)+6.*reQ2nQ1nstarQ1nstar 
4452                  - 1.*reQ6nQ4nstarQ1nstarQ1nstar-1.*reQ4nQ2nQ3nstarQ3nstar 
4453                  + 1.*reQ6nQ4nstarQ2nstar-2.*reQ5nQ1nQ3nstarQ3nstar 
4454                  + 2.*reQ4nQ2nstarQ2nstar+4.*reQ4nQ3nstarQ1nstar 
4455                  - 2.*reQ3nQ1nstarQ1nstarQ1nstar+10.*reQ3nQ2nstarQ1nstar 
4456                  + 2.*reQ6nQ5nstarQ1nstar+2.*reQ6nQ3nstarQ3nstar 
4457                  - 4.*reQ4nQ1nQ3nstarQ2nstar+4.*reQ5nQ4nstarQ1nstar
4458                  + 4.*reQ5nQ3nstarQ2nstar + 24.*dMult)
4459                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4460   // Average 5-particle correlations for all events:      
4461   fIntFlowCorrelationsAllPro->Fill(52.5,five3n3n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4462   fIntFlowCorrelationsAllPro->Fill(53.5,five4n2n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4463   fIntFlowCorrelationsAllPro->Fill(54.5,five3n2n3n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4464   fIntFlowCorrelationsAllPro->Fill(55.5,five3n2n2n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4465   fIntFlowCorrelationsAllPro->Fill(56.5,five5n1n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4466   fIntFlowCorrelationsAllPro->Fill(60.5,five6n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4467   fIntFlowCorrelationsAllPro->Fill(61.5,five4n1n1n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4468   if(fCalculateAllCorrelationsVsM)
4469   {
4470    fIntFlowCorrelationsAllVsMPro[52]->Fill(dMultiplicityBin,five3n3n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4471    fIntFlowCorrelationsAllVsMPro[53]->Fill(dMultiplicityBin,five4n2n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4472    fIntFlowCorrelationsAllVsMPro[54]->Fill(dMultiplicityBin,five3n2n3n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4473    fIntFlowCorrelationsAllVsMPro[55]->Fill(dMultiplicityBin,five3n2n2n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4474    fIntFlowCorrelationsAllVsMPro[56]->Fill(dMultiplicityBin,five5n1n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4475    fIntFlowCorrelationsAllVsMPro[60]->Fill(dMultiplicityBin,five6n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4476    fIntFlowCorrelationsAllVsMPro[61]->Fill(dMultiplicityBin,five4n1n1n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4477   }         
4478  } // end of if(dMult>4)
4479
4480  // 6-particle:
4481  Double_t six3n2n1n3n2n1n = 0.; // <cos(n(3*phi1+2*phi2+1*phi3-3*phi4-2*phi5-1*phi6)>
4482  Double_t six3n3n2n2n1n1n = 0.; // <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-1*phi5-1*phi6)>   
4483  if(dMult>5.)
4484  { 
4485   six3n2n1n3n2n1n = (dQ3nQ2nQ1nQ3nstarQ2nstarQ1nstar-2.*reQ3nQ3nQ3nstarQ2nstarQ1nstar
4486                   - 2.*reQ3nQ2nQ2nstarQ2nstarQ1nstar-2.*reQ3nQ1nQ2nstarQ1nstarQ1nstar
4487                   - 2.*reQ3nQ2nQ3nstarQ1nstarQ1nstar-2.*reQ4nQ2nQ3nstarQ2nstarQ1nstar
4488                   - 2.*reQ5nQ1nQ3nstarQ2nstarQ1nstar+4.*reQ6nQ3nstarQ2nstarQ1nstar
4489                   + 2.*reQ5nQ1nQ4nstarQ2nstar+2.*reQ5nQ1nQ3nstarQ3nstar
4490                   + 2.*reQ4nQ2nQ3nstarQ3nstar+6.*reQ4nQ1nQ3nstarQ2nstar
4491                   + 2.*reQ5nQ3nstarQ1nstarQ1nstar+2.*reQ5nQ2nstarQ2nstarQ1nstar
4492                   + 6.*reQ3nQ1nQ2nstarQ2nstar+2.*reQ4nQ2nstarQ1nstarQ1nstar
4493                   - 4.*reQ6nQ5nstarQ1nstar-4.*reQ6nQ4nstarQ2nstar-6.*reQ5nQ4nstarQ1nstar
4494                   - 4.*reQ6nQ3nstarQ3nstar+2.*(dMult-11.)*reQ5nQ3nstarQ2nstar
4495                   + 2.*(dMult-13.)*reQ4nQ3nstarQ1nstar-8.*reQ4nQ2nstarQ2nstar
4496                   + 2.*(5.*dMult-32.)*reQ3nQ2nstarQ1nstar+2.*reQ3nQ1nstarQ1nstarQ1nstar
4497                   + 2.*(dMult-13.)*reQ2nQ1nstarQ1nstar
4498                   - (dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4499                   + (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4500                   + (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4501                   - (dMult-11.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4502                   - (dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4503                   + 4.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-(dMult-12.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4504                   - (dMult-16.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)
4505                   + (dMult*dMult-19.*dMult+68.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4506                   + (dMult*dMult-19.*dMult+72.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4507                   + pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)+pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
4508                   + (dMult*dMult-20.*dMult+80.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4509                   - dMult*(dMult-12.)*(dMult-10.))
4510                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));   
4511   
4512   // Peter Jochumzsen:
4513   six3n3n2n2n1n1n = (reQ3nQ3nQ2nstarQ2nstarQ1nstarQ1nstar
4514                   + (80.-16.*dMult)*pow(dReQ1n,2.)+(80.-16.*dMult)*pow(dImQ1n,2.)
4515                   + (78.-16.*dMult)*pow(dReQ2n,2.)+(78.-16.*dMult)*pow(dImQ2n,2.)
4516                   + (72.-16.*dMult)*pow(dReQ3n,2.)+(72.-16.*dMult)*pow(dImQ3n,2.)
4517                   + 14.*pow(dReQ4n,2.)+14.*pow(dImQ4n,2.)
4518                   + 8.*pow(dReQ5n,2.)+8.*pow(dImQ5n,2.)
4519                   + 6.*pow(dReQ6n,2.)+6.*pow(dImQ6n,2.)
4520                   + 1.*reQ6nQ2nstarQ2nstarQ2nstar - 1.*reQ6nQ2nstarQ2nstarQ1nstarQ1nstar
4521                   - 76.*reQ3nQ2nstarQ1nstar + 4.*reQ3nQ1nstarQ1nstarQ1nstar
4522                   - 8.*reQ3nQ2nstarQ1nstar + 8.*dQ2nQ1nQ2nstarQ1nstar
4523                   + 4.*reQ5nQ2nstarQ2nstarQ1nstar - 2.*reQ6nQ3nstarQ3nstar
4524                   + 4.*reQ6nQ3nstarQ2nstarQ1nstar - 4.*reQ5nQ4nstarQ1nstar
4525                   + 16.*dMult*reQ3nQ2nstarQ1nstar - 2.*reQ4nQ2nstarQ2nstar
4526                   - 4.*reQ3nQ3nQ3nstarQ2nstarQ1nstar -8.*reQ4nQ3nstarQ1nstar
4527                   - 10.*reQ4nQ2nstarQ2nstar + 4.*reQ4nQ2nstarQ1nstarQ1nstar
4528                   - 12.*reQ4nQ3nstarQ1nstar + 8.*dQ3nQ1nQ3nstarQ1nstar
4529                   + 8.*reQ3nQ1nQ2nstarQ2nstar - 4.*reQ3nQ1nQ2nstarQ1nstarQ1nstar
4530                   + 5.*reQ4nQ2nQ3nstarQ3nstar+2.*pow(pow(dReQ2n,2.)+pow(dImQ2n,2.),2.)
4531                   + 4.*reQ5nQ1nQ3nstarQ3nstar+2.*pow(pow(dReQ3n,2.)+pow(dImQ3n,2.),2.)
4532                   - 6.*reQ6nQ3nstarQ3nstar - 14.*reQ2nQ1nstarQ1nstar
4533                   - 1.*reQ3nQ3nQ2nstarQ2nstarQ2nstar-4.*reQ3nQ2nQ2nstarQ2nstarQ1nstar
4534                   - 1.*reQ4nQ1nQ1nQ3nstarQ3nstar-8.*reQ5nQ3nstarQ2nstar
4535                   + 2.*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.) - 10.*reQ2nQ1nstarQ1nstar
4536                   - 4.*reQ6nQ5nstarQ1nstar-5.*reQ6nQ4nstarQ2nstar
4537                   + 1.*reQ6nQ4nstarQ1nstarQ1nstar-8.*reQ5nQ3nstarQ2nstar
4538                   + 4.*reQ4nQ1nQ3nstarQ2nstar+8.*dQ3nQ2nQ3nstarQ2nstar
4539                   - 120.*dMult + 16.*dMult*dMult)
4540                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4541
4542   // Average 6-particle correlations for all events:      
4543   fIntFlowCorrelationsAllPro->Fill(57.5,six3n2n1n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4544   fIntFlowCorrelationsAllPro->Fill(62.5,six3n3n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4545   if(fCalculateAllCorrelationsVsM)
4546   {
4547    fIntFlowCorrelationsAllVsMPro[57]->Fill(dMultiplicityBin,six3n2n1n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4548    fIntFlowCorrelationsAllVsMPro[62]->Fill(dMultiplicityBin,six3n3n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4549   }          
4550  } // end of if(dMult>5.)
4551  
4552 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelations()
4553
4554 //=====================================================================================================
4555
4556 void AliFlowAnalysisWithQCumulants::CalculateMixedHarmonics()
4557 {
4558  // Calculate in this method all multi-particle azimuthal correlations in mixed harmonics.
4559  // (Remark: For completeness sake, we also calculate here again correlations in the same harmonic.) 
4560
4561  // a) Access Q-vectors and multiplicity of current event; 
4562  // b) Determine multiplicity weights and fill some histos;
4563  // c) Calculate 2-p correlations; 
4564  // d) Calculate 3-p correlations; 
4565  // e) Calculate 4-p correlations; 
4566  // f) Calculate 5-p correlations; 
4567  // g) Calculate 6-p correlations; 
4568  // h) Calculate 7-p correlations; 
4569  // i) Calculate 8-p correlations.
4570
4571  // a) Access Q-vectors and multiplicity of current event:
4572  // Multiplicity of an event: 
4573  Double_t dMult = (*fSpk)(0,0);
4574  // Real parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n, 4n, 5n and 6n: 
4575  Double_t dReQ1n = (*fReQ)(0,0);
4576  Double_t dReQ2n = (*fReQ)(1,0);
4577  Double_t dReQ3n = (*fReQ)(2,0);
4578  Double_t dReQ4n = (*fReQ)(3,0);
4579  Double_t dReQ5n = (*fReQ)(4,0); 
4580  Double_t dReQ6n = (*fReQ)(5,0);
4581  Double_t dReQ7n = (*fReQ)(6,0);
4582  Double_t dReQ8n = (*fReQ)(7,0);
4583  Double_t dReQ9n = (*fReQ)(8,0);
4584  Double_t dReQ10n = (*fReQ)(9,0);
4585  Double_t dReQ11n = (*fReQ)(10,0);
4586  Double_t dReQ12n = (*fReQ)(11,0);
4587  // Imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n, 4n, 5n and 6n:
4588  Double_t dImQ1n = (*fImQ)(0,0);
4589  Double_t dImQ2n = (*fImQ)(1,0);
4590  Double_t dImQ3n = (*fImQ)(2,0);
4591  Double_t dImQ4n = (*fImQ)(3,0);
4592  Double_t dImQ5n = (*fImQ)(4,0); 
4593  Double_t dImQ6n = (*fImQ)(5,0);
4594  Double_t dImQ7n = (*fImQ)(6,0);
4595  Double_t dImQ8n = (*fImQ)(7,0);
4596  Double_t dImQ9n = (*fImQ)(8,0);
4597  Double_t dImQ10n = (*fImQ)(9,0);
4598  Double_t dImQ11n = (*fImQ)(10,0);
4599  Double_t dImQ12n = (*fImQ)(11,0);
4600  // All mixed correlators:
4601  Double_t allMixedCorrelators[139] = {0.};
4602
4603  // Real parts of expressions involving various combinations of Q-vectors which appears
4604  // simultaneously in several equations for multiparticle correlations bellow: 
4605  // Re[Q_{2n}Q_{n}^*Q_{n}^*]
4606  Double_t reQ2nQ1nstarQ1nstar = pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n; 
4607  // Re[Q_{6n}Q_{3n}^*Q_{3n}^*]
4608  Double_t reQ6nQ3nstarQ3nstar = pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n;  
4609  // Re[Q_{4n}Q_{2n}^*Q_{2n}^*]
4610  Double_t reQ4nQ2nstarQ2nstar = pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n;
4611  // Re[Q_{4n}Q_{3n}^*Q_{n}^*]
4612  Double_t reQ4nQ3nstarQ1nstar = dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);
4613  // Re[Q_{3n}Q_{2n}^*Q_{n}^*]
4614  Double_t reQ3nQ2nstarQ1nstar = dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
4615                               + dImQ3n*dImQ2n*dReQ1n; 
4616  // Re[Q_{5n}Q_{3n}^*Q_{2n}^*]
4617  Double_t reQ5nQ3nstarQ2nstar = dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n
4618                               + dImQ5n*dImQ2n*dReQ3n;                             
4619  // Re[Q_{5n}Q_{4n}^*Q_{1n}^*]
4620  Double_t reQ5nQ4nstarQ1nstar = dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n
4621                               + dImQ5n*dImQ4n*dReQ1n;                              
4622  // Re[Q_{6n}Q_{5n}^*Q_{1n}^*]                              
4623  Double_t reQ6nQ5nstarQ1nstar = dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n
4624                               + dImQ6n*dImQ5n*dReQ1n;
4625  // Re[Q_{6n}Q_{4n}^*Q_{2n}^*]                       
4626  Double_t reQ6nQ4nstarQ2nstar = dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
4627                               + dImQ6n*dImQ4n*dReQ2n;
4628  // Re[Q_{3n}Q_{n}Q_{2n}^*Q_{2n}^*]
4629  Double_t reQ3nQ1nQ2nstarQ2nstar = (pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
4630                                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);                                
4631  // Re[Q_{3n}Q_{n}^*Q_{n}^*Q_{n}^*]
4632  Double_t reQ3nQ1nstarQ1nstarQ1nstar = dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
4633                                      + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3);
4634  // Re[Q_{6n}Q_{2n}^*Q_{2n}^*Q_{2n}^*]
4635  Double_t reQ6nQ2nstarQ2nstarQ2nstar = dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
4636                                      + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3);
4637  // Re[Q_{4n}Q_{2n}^*Q_{n}^*Q_{n}^*]
4638  Double_t reQ4nQ2nstarQ1nstarQ1nstar = (dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
4639                                      + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n);  
4640  // Re[Q_{4n}Q_{2n}^*Q_{3n}^*Q_{3n}^*]
4641  Double_t reQ4nQ2nQ3nstarQ3nstar = (dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
4642                                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n;                    
4643  // Re[Q_{4n}Q_{n}Q_{3n}^*Q_{2n}^*]
4644  Double_t reQ4nQ1nQ3nstarQ2nstar = dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
4645                                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
4646                                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
4647                                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n;
4648
4649  // Re[Q_{5n}Q_{n}Q_{4n}^*Q_{2n}^*]
4650  Double_t reQ5nQ1nQ4nstarQ2nstar = dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
4651                                  + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
4652                                  - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n 
4653                                  + dImQ1n*dImQ2n*dReQ4n*dReQ5n+dReQ1n*dReQ2n*dReQ4n*dReQ5n;                                  
4654  // Re[Q_{5n}Q_{n}Q_{3n}^*Q_{3n}^*]                                  
4655  Double_t reQ5nQ1nQ3nstarQ3nstar = dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
4656                                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
4657                                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n;
4658  // Re[Q_{5n}Q_{3n}^*Q_{n}^*Q_{n}^*]                                  
4659  Double_t reQ5nQ3nstarQ1nstarQ1nstar = -pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
4660                                      + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
4661                                      - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n;                     
4662  // Re[Q_{5n}Q_{2n}^*Q_{2n}^*Q_{n}^*]                                  
4663  Double_t reQ5nQ2nstarQ2nstarQ1nstar = -pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
4664                                      + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
4665                                      - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n;                                     
4666  // Re[Q_{6n}Q_{4n}^*Q_{n}^*Q_{n}^*]                                  
4667  Double_t reQ6nQ4nstarQ1nstarQ1nstar = -pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
4668                                      +  2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
4669                                      -  pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n;
4670  /*// |Q_{2n}|^2 |Q_{n}|^2
4671  Double_t dQ2nQ1nQ2nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
4672  // |Q_{4n}|^2 |Q_{2n}|^2
4673  Double_t dQ4nQ2nQ4nstarQ2nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.));
4674  // |Q_{3n}|^2 |Q_{2n}|^2
4675  Double_t dQ3nQ2nQ3nstarQ2nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.));
4676  // |Q_{5n}|^2 |Q_{n}|^2
4677  Double_t dQ5nQ1nQ5nstarQ1nstar = (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
4678  // |Q_{3n}|^2 |Q_{n}|^2
4679  Double_t dQ3nQ1nQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));*/
4680  // Re[Q_{2n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*]
4681  /*Double_t reQ2nQ1nQ1nstarQ1nstarQ1nstar = (dReQ2n*dReQ1n-dImQ2n*dImQ1n)*(pow(dReQ1n,3)-3.*dReQ1n*pow(dImQ1n,2))
4682                                         + (dReQ2n*dImQ1n+dReQ1n*dImQ2n)*(3.*dImQ1n*pow(dReQ1n,2)-pow(dImQ1n,3));*/ 
4683  // Re[Q_{2n}Q_{2n}Q_{2n}^*Q_{n}^*Q_{n}^*]
4684  /*Double_t reQ2nQ2nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
4685                                         * (dReQ2n*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) + 2.*dImQ2n*dReQ1n*dImQ1n);*/
4686  /*// Re[Q_{4n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
4687  Double_t reQ4nQ1nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,4.)*dReQ4n-6.*pow(dReQ1n,2.)*dReQ4n*pow(dImQ1n,2.)
4688                                             + pow(dImQ1n,4.)*dReQ4n+4.*pow(dReQ1n,3.)*dImQ1n*dImQ4n
4689                                             - 4.*pow(dImQ1n,3.)*dReQ1n*dImQ4n;*/
4690  // Re[Q_{3n}Q_{n}Q_{2n}^*Q_{n}^*Q_{n}^*]
4691  /*Double_t reQ3nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
4692                                         * (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n
4693                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n);*/
4694  // Re[Q_{6n}Q_{n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
4695  Double_t reQ6nQ3nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
4696                                      - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
4697                                      + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
4698                                      + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n;
4699  // Re[Q_{3n}Q_{3n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
4700  /*Double_t reQ3nQ3nQ3nstarQ2nstarQ1nstar = (pow(dImQ3n,2.)+pow(dReQ3n,2.))
4701                                         * (dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n
4702                                         - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n);*/   
4703  /*// Re[Q_{3n}Q_{3n}Q_{2n}^*Q_{2n}^*Q_{2n}^*]
4704  Double_t reQ3nQ3nQ2nstarQ2nstarQ2nstar = pow(dReQ2n,3.)*pow(dReQ3n,2.) 
4705                                         - 3.*dReQ2n*pow(dReQ3n,2.)*pow(dImQ2n,2.)
4706                                         + 6.*pow(dReQ2n,2.)*dReQ3n*dImQ2n*dImQ3n 
4707                                         - 2.*dReQ3n*pow(dImQ2n,3.)*dImQ3n-pow(dReQ2n,3.)*pow(dImQ3n,2.) 
4708                                         + 3.*dReQ2n*pow(dImQ2n,2.)*pow(dImQ3n,2.);*/
4709  // Re[Q_{4n}Q_{2n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
4710  /*Double_t reQ4nQ2nQ3nstarQ2nstarQ1nstar = (pow(dImQ2n,2.)+pow(dReQ2n,2.))
4711                                         * (dImQ3n*dImQ4n*dReQ1n+dImQ1n*dImQ4n*dReQ3n 
4712                                         - dImQ1n*dImQ3n*dReQ4n+dReQ1n*dReQ3n*dReQ4n);*/
4713  // Re[Q_{3n}Q_{2n}Q_{3n}^*Q_{n}^*Q_{n}^*]
4714  /*Double_t reQ3nQ2nQ3nstarQ1nstarQ1nstar = -(pow(dImQ3n,2.)+pow(dReQ3n,2.))
4715                                         * (-2.*dImQ1n*dImQ2n*dReQ1n+pow(dImQ1n,2.)*dReQ2n-pow(dReQ1n,2.)*dReQ2n);*/                              
4716  // Re[Q_{3n}Q_{2n}Q_{2n}^*Q_{2n}^*Q_{n}^*]
4717  /*Double_t reQ3nQ2nQ2nstarQ2nstarQ1nstar = (pow(dImQ2n,2.)+pow(dReQ2n,2.))
4718                                         * (dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n 
4719                                         - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n);*/
4720 /* // Re[Q_{5n}Q_{n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
4721  Double_t reQ5nQ1nQ3nstarQ2nstarQ1nstar = (pow(dImQ1n,2.)+pow(dReQ1n,2.))
4722                                         * (dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n 
4723                                         - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n);   
4724  */
4725  /*
4726  // Re[Q_{2n}Q_{2n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
4727  Double_t reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)*dReQ2n-2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)
4728                                                + dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dImQ2n)
4729                                                * (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)
4730                                                - dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n+pow(dImQ1n,2.)*dImQ2n); 
4731  // Re[Q_{3n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
4732  Double_t reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
4733                                                * (pow(dReQ1n,3.)*dReQ3n-3.*dReQ1n*dReQ3n*pow(dImQ1n,2.)
4734                                                + 3.*pow(dReQ1n,2.)*dImQ1n*dImQ3n-pow(dImQ1n,3.)*dImQ3n);
4735  */
4736  // |Q_{2n}|^2 |Q_{n}|^4
4737  //Double_t dQ2nQ1nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.); 
4738  /*
4739  // |Q_{3n}|^2 |Q_{2n}|^2 |Q_{n}|^2
4740  Double_t dQ3nQ2nQ1nQ3nstarQ2nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4741                                           * (pow(dReQ1n,2.)+pow(dImQ1n,2.));
4742  // Re[Q_{2n}Q_{n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
4743  Double_t reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
4744                                                   * (pow(dReQ1n,2.)*dReQ2n-dReQ2n*pow(dImQ1n,2.)
4745                                                   + 2.*dReQ1n*dImQ1n*dImQ2n);                                                  
4746  */
4747  // Re[Q_{6n}Q_{2n}^*Q_{2n}^*Q_{n}^*Q_{n}^*]
4748  /*Double_t reQ6nQ2nstarQ2nstarQ1nstarQ1nstar = pow(dReQ1n*dReQ2n,2.)*dReQ6n-pow(dReQ2n*dImQ1n,2.)*dReQ6n
4749                                             - 4.*dReQ1n*dReQ2n*dReQ6n*dImQ1n*dImQ2n 
4750                                             - pow(dReQ1n*dImQ2n,2.)*dReQ6n+pow(dImQ1n*dImQ2n,2.)*dReQ6n
4751                                             + 2.*dReQ1n*pow(dReQ2n,2.)*dImQ1n*dImQ6n
4752                                             + 2.*pow(dReQ1n,2.)*dReQ2n*dImQ2n*dImQ6n 
4753                                             - 2.*dReQ2n*pow(dImQ1n,2.)*dImQ2n*dImQ6n 
4754                                             - 2.*dReQ1n*dImQ1n*pow(dImQ2n,2.)*dImQ6n;
4755  */                                                                                      
4756  // Re[Q_{4n}Q_{1n}Q_{1n}Q_{3n}^*Q_{3n}^*]
4757  /*
4758  Double_t reQ4nQ1nQ1nQ3nstarQ3nstar = pow(dReQ1n*dReQ3n,2.)*dReQ4n-pow(dReQ3n*dImQ1n,2.)*dReQ4n  
4759                                     + 4.*dReQ1n*dReQ3n*dReQ4n*dImQ1n*dImQ3n 
4760                                     - pow(dReQ1n*dImQ3n,2.)*dReQ4n+pow(dImQ1n*dImQ3n,2.)*dReQ4n  
4761                                     - 2.*dReQ1n*pow(dReQ3n,2.)*dImQ1n*dImQ4n 
4762                                     + 2.*pow(dReQ1n,2.)*dReQ3n*dImQ3n*dImQ4n 
4763                                     - 2.*dReQ3n*pow(dImQ1n,2.)*dImQ3n*dImQ4n 
4764                                     + 2.*dReQ1n*dImQ1n*pow(dImQ3n,2.)*dImQ4n;*/
4765  /* 
4766  // Re[Q_{3n}Q_{3n}Q_{2n}^*Q_{2n}^*Q_{1n}^*Q_{1n}^*]
4767  Double_t reQ3nQ3nQ2nstarQ2nstarQ1nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ2n*dReQ3n*dImQ1n-dReQ1n*dReQ3n*dImQ2n 
4768                                                - dReQ3n*dImQ1n*dImQ2n+dReQ1n*dReQ2n*dImQ3n+dReQ2n*dImQ1n*dImQ3n 
4769                                                + dReQ1n*dImQ2n*dImQ3n-dImQ1n*dImQ2n*dImQ3n)*(dReQ1n*dReQ2n*dReQ3n 
4770                                                + dReQ2n*dReQ3n*dImQ1n+dReQ1n*dReQ3n*dImQ2n-dReQ3n*dImQ1n*dImQ2n 
4771                                                - dReQ1n*dReQ2n*dImQ3n+dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n 
4772                                                + dImQ1n*dImQ2n*dImQ3n);
4773  */
4774
4775  // b) Determine multiplicity weights and fill some histos:
4776  Double_t d2pMultiplicityWeight = 0.; // weight for <2>_{...} to get <<2>>_{...}
4777  Double_t d3pMultiplicityWeight = 0.; // weight for <3>_{...} to get <<3>>_{...}
4778  Double_t d4pMultiplicityWeight = 0.; // weight for <4>_{...} to get <<4>>_{...}
4779  Double_t d5pMultiplicityWeight = 0.; // weight for <5>_{...} to get <<5>>_{...}
4780  Double_t d6pMultiplicityWeight = 0.; // weight for <6>_{...} to get <<6>>_{...}
4781  Double_t d7pMultiplicityWeight = 0.; // weight for <7>_{...} to get <<7>>_{...}
4782  Double_t d8pMultiplicityWeight = 0.; // weight for <8>_{...} to get <<8>>_{...}
4783  if(fMultiplicityWeight->Contains("combinations")) // default multiplicity weight
4784  {
4785   d2pMultiplicityWeight = dMult*(dMult-1.);
4786   d3pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.);
4787   d4pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.);
4788   d5pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.);
4789   d6pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.);
4790   d7pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.);
4791   d8pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.);
4792  } else if(fMultiplicityWeight->Contains("unit"))
4793    {
4794     d2pMultiplicityWeight = 1.;
4795     d3pMultiplicityWeight = 1.;
4796     d4pMultiplicityWeight = 1.;
4797     d5pMultiplicityWeight = 1.;
4798     d6pMultiplicityWeight = 1.;
4799     d7pMultiplicityWeight = 1.;
4800     d8pMultiplicityWeight = 1.;
4801    } else if(fMultiplicityWeight->Contains("multiplicity"))
4802      {
4803       d2pMultiplicityWeight = dMult;
4804       d3pMultiplicityWeight = dMult;
4805       d4pMultiplicityWeight = dMult;
4806       d5pMultiplicityWeight = dMult;
4807       d6pMultiplicityWeight = dMult;
4808       d7pMultiplicityWeight = dMult;
4809       d8pMultiplicityWeight = dMult; 
4810      }       
4811  for(Int_t p=0;p<=1;p++) // power (0=linear,1=quadratic)
4812  {
4813   fMixedHarmonicEventWeights[p]->Fill(0.5,pow(dMult,p+1));
4814   fMixedHarmonicEventWeights[p]->Fill(1.5,pow(d2pMultiplicityWeight,p+1));
4815   fMixedHarmonicEventWeights[p]->Fill(2.5,pow(d3pMultiplicityWeight,p+1));
4816   fMixedHarmonicEventWeights[p]->Fill(3.5,pow(d4pMultiplicityWeight,p+1));
4817   fMixedHarmonicEventWeights[p]->Fill(4.5,pow(d5pMultiplicityWeight,p+1));
4818   fMixedHarmonicEventWeights[p]->Fill(5.5,pow(d6pMultiplicityWeight,p+1));
4819   fMixedHarmonicEventWeights[p]->Fill(6.5,pow(d7pMultiplicityWeight,p+1));
4820   fMixedHarmonicEventWeights[p]->Fill(7.5,pow(d8pMultiplicityWeight,p+1));
4821  } // end of for(Int_t p=0;p<=1;p++) // power (0=linear,1=quadratic)   
4822  fMixedHarmonicProductOfEventWeights->Fill(0.5,0.5,dMult*dMult);
4823  fMixedHarmonicProductOfEventWeights->Fill(0.5,1.5,dMult*d2pMultiplicityWeight);
4824  fMixedHarmonicProductOfEventWeights->Fill(0.5,2.5,dMult*d3pMultiplicityWeight);
4825  fMixedHarmonicProductOfEventWeights->Fill(0.5,3.5,dMult*d4pMultiplicityWeight);
4826  fMixedHarmonicProductOfEventWeights->Fill(0.5,4.5,dMult*d5pMultiplicityWeight);
4827  fMixedHarmonicProductOfEventWeights->Fill(0.5,5.5,dMult*d6pMultiplicityWeight);
4828  fMixedHarmonicProductOfEventWeights->Fill(0.5,6.5,dMult*d7pMultiplicityWeight);
4829  fMixedHarmonicProductOfEventWeights->Fill(0.5,7.5,dMult*d8pMultiplicityWeight);
4830  fMixedHarmonicProductOfEventWeights->Fill(1.5,1.5,d2pMultiplicityWeight*d2pMultiplicityWeight);
4831  fMixedHarmonicProductOfEventWeights->Fill(1.5,2.5,d2pMultiplicityWeight*d3pMultiplicityWeight);
4832  fMixedHarmonicProductOfEventWeights->Fill(1.5,3.5,d2pMultiplicityWeight*d4pMultiplicityWeight);
4833  fMixedHarmonicProductOfEventWeights->Fill(1.5,4.5,d2pMultiplicityWeight*d5pMultiplicityWeight);
4834  fMixedHarmonicProductOfEventWeights->Fill(1.5,5.5,d2pMultiplicityWeight*d6pMultiplicityWeight);
4835  fMixedHarmonicProductOfEventWeights->Fill(1.5,6.5,d2pMultiplicityWeight*d7pMultiplicityWeight);
4836  fMixedHarmonicProductOfEventWeights->Fill(1.5,7.5,d2pMultiplicityWeight*d8pMultiplicityWeight);
4837  fMixedHarmonicProductOfEventWeights->Fill(2.5,2.5,d3pMultiplicityWeight*d3pMultiplicityWeight);
4838  fMixedHarmonicProductOfEventWeights->Fill(2.5,3.5,d3pMultiplicityWeight*d4pMultiplicityWeight);
4839  fMixedHarmonicProductOfEventWeights->Fill(2.5,4.5,d3pMultiplicityWeight*d5pMultiplicityWeight);
4840  fMixedHarmonicProductOfEventWeights->Fill(2.5,5.5,d3pMultiplicityWeight*d6pMultiplicityWeight);
4841  fMixedHarmonicProductOfEventWeights->Fill(2.5,6.5,d3pMultiplicityWeight*d7pMultiplicityWeight);
4842  fMixedHarmonicProductOfEventWeights->Fill(2.5,7.5,d3pMultiplicityWeight*d8pMultiplicityWeight);
4843  fMixedHarmonicProductOfEventWeights->Fill(3.5,3.5,d4pMultiplicityWeight*d4pMultiplicityWeight);
4844  fMixedHarmonicProductOfEventWeights->Fill(3.5,4.5,d4pMultiplicityWeight*d5pMultiplicityWeight);
4845  fMixedHarmonicProductOfEventWeights->Fill(3.5,5.5,d4pMultiplicityWeight*d6pMultiplicityWeight);
4846  fMixedHarmonicProductOfEventWeights->Fill(3.5,6.5,d4pMultiplicityWeight*d7pMultiplicityWeight);
4847  fMixedHarmonicProductOfEventWeights->Fill(3.5,7.5,d4pMultiplicityWeight*d8pMultiplicityWeight);
4848  fMixedHarmonicProductOfEventWeights->Fill(4.5,4.5,d5pMultiplicityWeight*d5pMultiplicityWeight);
4849  fMixedHarmonicProductOfEventWeights->Fill(4.5,5.5,d5pMultiplicityWeight*d6pMultiplicityWeight);
4850  fMixedHarmonicProductOfEventWeights->Fill(4.5,6.5,d5pMultiplicityWeight*d7pMultiplicityWeight);
4851  fMixedHarmonicProductOfEventWeights->Fill(4.5,7.5,d5pMultiplicityWeight*d8pMultiplicityWeight);
4852  fMixedHarmonicProductOfEventWeights->Fill(5.5,5.5,d6pMultiplicityWeight*d6pMultiplicityWeight);
4853  fMixedHarmonicProductOfEventWeights->Fill(5.5,6.5,d6pMultiplicityWeight*d7pMultiplicityWeight);
4854  fMixedHarmonicProductOfEventWeights->Fill(5.5,7.5,d6pMultiplicityWeight*d8pMultiplicityWeight);
4855  fMixedHarmonicProductOfEventWeights->Fill(6.5,6.5,d7pMultiplicityWeight*d7pMultiplicityWeight); 
4856  fMixedHarmonicProductOfEventWeights->Fill(6.5,7.5,d7pMultiplicityWeight*d8pMultiplicityWeight); 
4857  fMixedHarmonicProductOfEventWeights->Fill(7.5,7.5,d8pMultiplicityWeight*d8pMultiplicityWeight); 
4858  
4859  // c) Calculate 2-p correlations:
4860  Double_t two1n1n = 0.; // <2>_{1n|1n} = <cos(1n(phi1-phi2))>
4861  Double_t two2n2n = 0.; // <2>_{2n|2n} = <cos(2n(phi1-phi2))>
4862  Double_t two3n3n = 0.; // <2>_{3n|3n} = <cos(3n(phi1-phi2))>
4863  Double_t two4n4n = 0.; // <2>_{4n|4n} = <cos(4n(phi1-phi2))>
4864  Double_t two5n5n = 0.; // <2>_{5n|5n} = <cos(5n(phi1-phi2))>
4865  Double_t two6n6n = 0.; // <2>_{6n|6n} = <cos(6n(phi1-phi2))>
4866  if(dMult>1.)
4867  {
4868   two1n1n = (pow(dReQ1n,2.)+pow(dImQ1n,2.)-dMult)/(dMult*(dMult-1.)); 
4869   two2n2n = (pow(dReQ2n,2.)+pow(dImQ2n,2.)-dMult)/(dMult*(dMult-1.)); 
4870   two3n3n = (pow(dReQ3n,2.)+pow(dImQ3n,2.)-dMult)/(dMult*(dMult-1.)); 
4871   two4n4n = (pow(dReQ4n,2.)+pow(dImQ4n,2.)-dMult)/(dMult*(dMult-1.)); 
4872   two5n5n = (pow(dReQ5n,2.)+pow(dImQ5n,2.)-dMult)/(dMult*(dMult-1.)); 
4873   two6n6n = (pow(dReQ6n,2.)+pow(dImQ6n,2.)-dMult)/(dMult*(dMult-1.));   
4874   f2pCorrelations->Fill(0.5,two1n1n,d2pMultiplicityWeight);
4875   f2pCorrelations->Fill(1.5,two2n2n,d2pMultiplicityWeight);
4876   f2pCorrelations->Fill(2.5,two3n3n,d2pMultiplicityWeight);
4877   f2pCorrelations->Fill(3.5,two4n4n,d2pMultiplicityWeight);
4878   f2pCorrelations->Fill(4.5,two5n5n,d2pMultiplicityWeight);
4879   f2pCorrelations->Fill(5.5,two6n6n,d2pMultiplicityWeight);
4880   allMixedCorrelators[0]=two1n1n;
4881   allMixedCorrelators[1]=two2n2n;
4882   allMixedCorrelators[2]=two3n3n;
4883   allMixedCorrelators[3]=two4n4n;
4884   allMixedCorrelators[4]=two5n5n;
4885   allMixedCorrelators[5]=two6n6n;
4886  } // end of if(dMult>1.)
4887
4888  // d) Calculate 3-p correlations:
4889  //  d1) Two distinct harmonics (3): 
4890  Double_t three2n1n1n = 0.; // <3>_{2n|1n,1n} = <cos(n(2*phi1-1*phi2-1*phi3))>
4891  Double_t three4n2n2n = 0.; // <3>_{4n|2n,2n} = <cos(n(4*phi1-2*phi2-2*phi3))>
4892  Double_t three6n3n3n = 0.; // <3>_{6n|3n,3n} = <cos(n(6*phi1-3*phi2-3*phi3))> 
4893  //  d2) Three distinct harmonics (6): 
4894  Double_t three3n2n1n = 0.; // <3>_{3n|2n,1n} = <cos(n(3*phi1-2*phi2-1*phi3))>
4895  Double_t three4n3n1n = 0.; // <3>_{4n|3n,1n} = <cos(n(4*phi1-3*phi2-1*phi3))> 
4896  Double_t three5n3n2n = 0.; // <3>_{5n|3n,2n} = <cos(n(5*phi1-3*phi2-2*phi3))>
4897  Double_t three5n4n1n = 0.; // <3>_{5n|4n,1n} = <cos(n(5*phi1-4*phi2-1*phi3))> 
4898  Double_t three6n4n2n = 0.; // <3>_{6n|4n,2n} = <cos(n(6*phi1-4*phi2-2*phi3))> 
4899  Double_t three6n5n1n = 0.; // <3>_{6n|5n,1n} = <cos(n(6*phi1-5*phi2-1*phi3))>
4900  if(dMult>2.)
4901  {
4902   three2n1n1n = (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n
4903               - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
4904               / (dMult*(dMult-1.)*(dMult-2.)); 
4905   three4n2n2n = (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n
4906               - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*dMult)
4907               / (dMult*(dMult-1.)*(dMult-2.)); 
4908   three6n3n3n = (reQ6nQ3nstarQ3nstar
4909               - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4910               - (pow(dReQ6n,2.)+pow(dImQ6n,2.))+2.*dMult)
4911               / (dMult*(dMult-1.)*(dMult-2.));  
4912   three3n2n1n = (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
4913               + dImQ3n*dImQ2n*dReQ1n-(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4914               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))-(pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4915               / (dMult*(dMult-1.)*(dMult-2.));
4916   three4n3n1n = (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)
4917               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))-(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4918               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4919               / (dMult*(dMult-1.)*(dMult-2.));  
4920   three5n3n2n = (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n
4921               + dImQ5n*dImQ2n*dReQ3n-(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4922               - (pow(dReQ3n,2.)+pow(dImQ3n,2.))
4923               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
4924               / (dMult*(dMult-1.)*(dMult-2.)); 
4925   three5n4n1n = (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n
4926               + dImQ5n*dImQ4n*dReQ1n-(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4927               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))
4928               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4929               / (dMult*(dMult-1.)*(dMult-2.));
4930   three6n4n2n = (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
4931               + dImQ6n*dImQ4n*dReQ2n-(pow(dReQ6n,2.)+pow(dImQ6n,2.))
4932               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))-(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
4933               / (dMult*(dMult-1.)*(dMult-2.));
4934   three6n5n1n = (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n
4935               + dImQ6n*dImQ5n*dReQ1n-(pow(dReQ6n,2.)+pow(dImQ6n,2.))
4936               - (pow(dReQ5n,2.)+pow(dImQ5n,2.))
4937               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4938               / (dMult*(dMult-1.)*(dMult-2.)); 
4939   f3pCorrelations->Fill(0.5,three2n1n1n,d3pMultiplicityWeight);
4940   f3pCorrelations->Fill(1.5,three4n2n2n,d3pMultiplicityWeight);
4941   f3pCorrelations->Fill(2.5,three6n3n3n,d3pMultiplicityWeight);
4942   //f3pCorrelations->Fill(3.5,0.,d3pMultiplicityWeight); // empty TBI
4943   f3pCorrelations->Fill(4.5,three3n2n1n,d3pMultiplicityWeight);
4944   f3pCorrelations->Fill(5.5,three4n3n1n,d3pMultiplicityWeight);
4945   f3pCorrelations->Fill(6.5,three5n3n2n,d3pMultiplicityWeight);
4946   f3pCorrelations->Fill(7.5,three5n4n1n,d3pMultiplicityWeight);
4947   f3pCorrelations->Fill(8.5,three6n4n2n,d3pMultiplicityWeight);
4948   f3pCorrelations->Fill(9.5,three6n5n1n,d3pMultiplicityWeight);
4949   allMixedCorrelators[6]=three2n1n1n;
4950   allMixedCorrelators[7]=three4n2n2n;
4951   allMixedCorrelators[8]=three6n3n3n;
4952   allMixedCorrelators[9]=three3n2n1n;
4953   allMixedCorrelators[10]=three4n3n1n;
4954   allMixedCorrelators[11]=three5n3n2n;
4955   allMixedCorrelators[12]=three5n4n1n;
4956   allMixedCorrelators[13]=three6n4n2n;
4957   allMixedCorrelators[14]=three6n5n1n;
4958  } // end of if(dMult>2.)
4959
4960  // e) Calculate 4-p correlations:
4961  //  e1) Single harmonic (6): 
4962  Double_t four1n1n1n1n = 0.; // <4>_{1n,1n|1n,1n} = <cos(1*n(phi1+phi2-phi3-phi4))>
4963  Double_t four2n2n2n2n = 0.; // <4>_{2n,2n|2n,2n} = <cos(2*n(phi1+phi2-phi3-phi4))>
4964  Double_t four3n3n3n3n = 0.; // <4>_{3n,3n|3n,3n} = <cos(3*n(phi1+phi2-phi3-phi4))>
4965  Double_t four4n4n4n4n = 0.; // <4>_{4n,4n|4n,4n} = <cos(4*n(phi1+phi2-phi3-phi4))>
4966  Double_t four5n5n5n5n = 0.; // <4>_{5n,5n|5n,5n} = <cos(5*n(phi1+phi2-phi3-phi4))>
4967  Double_t four6n6n6n6n = 0.; // <4>_{6n,6n|6n,6n} = <cos(6*n(phi1+phi2-phi3-phi4))>
4968  //  e2) "Standard candles" (15):
4969  Double_t four2n1n2n1n = 0.; // <4>_{2n,1n|2n,1n} = <cos(n(2*phi1+1*phi2-2*phi3-1*phi4))>
4970  Double_t four3n1n3n1n = 0.; // <4>_{3n,1n|3n,1n} = <cos(n(3*phi1+1*phi2-3*phi3-1*phi4))>
4971  Double_t four3n2n3n2n = 0.; // <4>_{3n,2n|3n,2n} = <cos(n(3*phi1+2*phi2-3*phi3-2*phi4))>
4972  Double_t four4n1n4n1n = 0.; // <4>_{4n,1n|4n,1n} = <cos(n(4*phi1+1*phi2-4*phi3-1*phi4))>
4973  Double_t four4n2n4n2n = 0.; // <4>_{4n,2n|4n,2n} = <cos(n(4*phi1+2*phi2-4*phi3-2*phi4))>
4974  Double_t four4n3n4n3n = 0.; // <4>_{4n,3n|4n,3n} = <cos(n(4*phi1+3*phi2-4*phi3-3*phi4))>
4975  Double_t four5n1n5n1n = 0.; // <4>_{5n,1n|5n,1n} = <cos(n(5*phi1+1*phi2-5*phi3-1*phi4))>
4976  Double_t four5n2n5n2n = 0.; // <4>_{5n,2n|5n,2n} = <cos(n(5*phi1+2*phi2-5*phi3-2*phi4))>
4977  Double_t four5n3n5n3n = 0.; // <4>_{5n,3n|5n,3n} = <cos(n(5*phi1+3*phi2-5*phi3-3*phi4))>
4978  Double_t four5n4n5n4n = 0.; // <4>_{5n,4n|5n,4n} = <cos(n(5*phi1+4*phi2-5*phi3-4*phi4))>
4979  Double_t four6n1n6n1n = 0.; // <4>_{6n,1n|6n,1n} = <cos(n(6*phi1+1*phi2-6*phi3-1*phi4))>
4980  Double_t four6n2n6n2n = 0.; // <4>_{6n,2n|6n,2n} = <cos(n(6*phi1+2*phi2-6*phi3-2*phi4))>
4981  Double_t four6n3n6n3n = 0.; // <4>_{6n,3n|6n,3n} = <cos(n(6*phi1+3*phi2-6*phi3-3*phi4))>
4982  Double_t four6n4n6n4n = 0.; // <4>_{6n,4n|6n,4n} = <cos(n(6*phi1+4*phi2-6*phi3-4*phi4))>
4983  Double_t four6n5n6n5n = 0.; // <4>_{6n,5n|6n,5n} = <cos(n(6*phi1+5*phi2-6*phi3-5*phi4))>
4984  //  e3) Two distinct harmonics (2): 
4985  Double_t four3n1n1n1n = 0.; // <4>_{3n|1n,1n,1n} = <cos(n(3*phi1-1*phi2-1*phi3-1*phi4))>
4986  Double_t four6n2n2n2n = 0.; // <4>_{6n|2n,2n,2n} = <cos(n(6*phi1-2*phi2-2*phi3-2*phi4))>
4987  //  e4) Three distinct harmonics (10): 
4988  Double_t four3n1n2n2n = 0.; // <4>_{3n,1n|2n,2n} = <cos(n(3*phi1+1*phi2-2*phi3-2*phi4))>
4989  Double_t four4n2n1n1n = 0.; // <4>_{4n|2n,1n,1n} = <cos(n(4*phi1-2*phi2-1*phi3-1*phi4))>
4990  Double_t four4n2n3n3n = 0.; // <4>_{4n,2n|3n,3n} = <cos(n(4*phi1+2*phi2-3*phi3-3*phi4))>
4991  Double_t four5n2n2n1n = 0.; // <4>_{5n|2n,2n,1n} = <cos(n(5*phi1-2*phi2-2*phi3-1*phi4))>
4992  Double_t four5n3n1n1n = 0.; // <4>_{5n|3n,1n,1n} = <cos(n(5*phi1-3*phi2-1*phi3-1*phi4))>
4993  Double_t four5n1n3n3n = 0.; // <4>_{5n,1n|3n,3n} = <cos(n(5*phi1+1*phi2-3*phi3-3*phi4))>
4994  Double_t four5n3n4n4n = 0.; // <4>_{5n,3n|4n,4n} = <cos(n(5*phi1+3*phi2-4*phi3-4*phi4))>
4995  Double_t four6n4n1n1n = 0.; // <4>_{6n|4n,1n,1n} = <cos(n(6*phi1-4*phi2-1*phi3-1*phi4))>
4996  Double_t four6n2n4n4n = 0.; // <4>_{6n,2n|4n,4n} = <cos(n(6*phi1+2*phi2-4*phi3-4*phi4))>
4997  Double_t four6n4n5n5n = 0.; // <4>_{6n,4n|5n,5n} = <cos(n(6*phi1+4*phi2-5*phi3-5*phi4))>
4998  //  e5) Four distinct harmonics (8): 
4999  Double_t four4n1n3n2n = 0.; // <4>_{4n,1n|3n,2n} = <cos(n(4*phi1+1*phi2-3*phi3-2*phi4))>
5000  Double_t four5n1n4n2n = 0.; // <4>_{5n,1n|4n,2n} = <cos(n(5*phi1+1*phi2-4*phi3-2*phi4))>
5001  Double_t four5n2n4n3n = 0.; // <4>_{5n,2n|4n,3n} = <cos(n(5*phi1+2*phi2-4*phi3-3*phi4))>
5002  Double_t four6n1n4n3n = 0.; // <4>_{6n,1n|4n,3n} = <cos(n(6*phi1+1*phi2-4*phi3-3*phi4))>
5003  Double_t four6n1n5n2n = 0.; // <4>_{6n,1n|5n,2n} = <cos(n(6*phi1+1*phi2-5*phi3-2*phi4))>
5004  Double_t four6n3n2n1n = 0.; // <4>_{6n|3n,2n,1n} = <cos(n(6*phi1-3*phi2-2*phi3-1*phi4))>
5005  Double_t four6n2n5n3n = 0.; // <4>_{6n,2n|5n,3n} = <cos(n(6*phi1+2*phi2-5*phi3-3*phi4))>
5006  Double_t four6n3n5n4n = 0.; // <4>_{6n,3n|5n,4n} = <cos(n(6*phi1+3*phi2-5*phi3-4*phi4))>
5007  if(dMult>3.)
5008  {
5009   // Single harmonic (6): 
5010   four1n1n1n1n = (2.*dMult*(dMult-3.)+pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ1n,2.)
5011                + pow(dImQ1n,2.))-2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5012                + (pow(dReQ2n,2.)+pow(dImQ2n,2.)))
5013                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));     
5014   four2n2n2n2n = (2.*dMult*(dMult-3.)+pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ2n,2.)
5015                + pow(dImQ2n,2.))-2.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5016                + (pow(dReQ4n,2.)+pow(dImQ4n,2.)))
5017                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.)); 
5018   four3n3n3n3n = (2.*dMult*(dMult-3.)+pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ3n,2.)
5019                + pow(dImQ3n,2.))-2.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5020                + (pow(dReQ6n,2.)+pow(dImQ6n,2.)))
5021                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));     
5022   four4n4n4n4n = (2.*dMult*(dMult-3.)+pow((pow(dReQ4n,2.)+pow(dImQ4n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ4n,2.)
5023                + pow(dImQ4n,2.))-2.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
5024                + (pow(dReQ8n,2.)+pow(dImQ8n,2.)))
5025                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));     
5026   four5n5n5n5n = (2.*dMult*(dMult-3.)+pow((pow(dReQ5n,2.)+pow(dImQ5n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ5n,2.)
5027                + pow(dImQ5n,2.))-2.*(pow(dReQ5n,2.)*dReQ10n+2.*dReQ5n*dImQ5n*dImQ10n-pow(dImQ5n,2.)*dReQ10n)
5028                + (pow(dReQ10n,2.)+pow(dImQ10n,2.)))
5029                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));    
5030   four6n6n6n6n = (2.*dMult*(dMult-3.)+pow((pow(dReQ6n,2.)+pow(dImQ6n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ6n,2.)
5031                + pow(dImQ6n,2.))-2.*(pow(dReQ6n,2.)*dReQ12n+2.*dReQ6n*dImQ6n*dImQ12n-pow(dImQ6n,2.)*dReQ12n)
5032                + (pow(dReQ12n,2.)+pow(dImQ12n,2.)))
5033                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));  
5034   // "Standard candles" (15):
5035   four2n1n2n1n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5036                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
5037                + dImQ3n*dImQ2n*dReQ1n)-2.*(pow(dReQ1n,2.)*dReQ2n
5038                + 2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n))
5039                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5040                - ((dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5041                + (dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-(pow(dReQ3n,2.)+pow(dImQ3n,2.)))
5042                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5043                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));
5044   four3n1n3n1n = ((pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5045                - 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5046                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5047                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5048                + pow(dReQ2n,2.)+pow(dImQ2n,2.)-(dMult-4.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5049                + dMult*(dMult-6.))
5050                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5051   four3n2n3n2n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5052                - 2.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5053                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5054                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)               
5055                - (dMult-4.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
5056                + dMult*(dMult-6.))
5057                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
5058   four4n1n4n1n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
5059                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ1n*dImQ4n+dImQ5n*dImQ1n*dReQ4n)
5060                - 2.*(dReQ3n*dReQ4n*dReQ1n+dImQ3n*dImQ4n*dReQ1n+dReQ3n*dImQ4n*dImQ1n-dImQ3n*dImQ1n*dReQ4n)
5061                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)
5062                - (dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
5063                + dMult*(dMult-6.))
5064                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5065   four4n2n4n2n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5066                - 2.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
5067                + dImQ6n*dImQ4n*dReQ2n)-2.*(pow(dReQ2n,2.)*dReQ4n
5068                + 2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n))
5069                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5070                - ((dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5071                + (dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-(pow(dReQ6n,2.)+pow(dImQ6n,2.)))
5072                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5073                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));
5074   four4n3n4n3n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
5075                - 2.*(dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ3n*dImQ4n+dImQ7n*dImQ3n*dReQ4n)
5076                - 2.*(dReQ1n*dReQ4n*dReQ3n+dImQ1n*dImQ4n*dReQ3n+dReQ1n*dImQ4n*dImQ3n-dImQ1n*dImQ3n*dReQ4n)
5077                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)
5078                - (dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
5079                + dMult*(dMult-6.))
5080                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5081   four5n1n5n1n = (((pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
5082                - 2.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5083                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5084                + pow(dReQ6n,2.)+pow(dImQ6n,2.)-(dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5085                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+dMult*(dMult-6.))  
5086                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5087   four5n2n5n2n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
5088                - 2.*(dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ2n*dImQ5n+dImQ7n*dImQ2n*dReQ5n)
5089                - 2.*(dReQ3n*dReQ5n*dReQ2n+dImQ3n*dImQ5n*dReQ2n+dReQ3n*dImQ5n*dImQ2n-dImQ3n*dImQ2n*dReQ5n)
5090                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)
5091                - (dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
5092                + dMult*(dMult-6.))
5093                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5094   four5n3n5n3n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
5095                - 2.*(dReQ8n*dReQ5n*dReQ3n-dReQ8n*dImQ5n*dImQ3n+dImQ8n*dReQ3n*dImQ5n+dImQ8n*dImQ3n*dReQ5n)
5096                - 2.*(dReQ2n*dReQ5n*dReQ3n+dImQ2n*dImQ5n*dReQ3n+dReQ2n*dImQ5n*dImQ3n-dImQ2n*dImQ3n*dReQ5n)
5097                + pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)
5098                - (dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
5099                + dMult*(dMult-6.))
5100                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5101   four5n4n5n4n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
5102                - 2.*(dReQ9n*dReQ5n*dReQ4n-dReQ9n*dImQ5n*dImQ4n+dImQ9n*dReQ4n*dImQ5n+dImQ9n*dImQ4n*dReQ5n)
5103                - 2.*(dReQ1n*dReQ5n*dReQ4n+dImQ1n*dImQ5n*dReQ4n+dReQ1n*dImQ5n*dImQ4n-dImQ1n*dImQ4n*dReQ5n)
5104                + pow(dReQ9n,2.)+pow(dImQ9n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)
5105                - (dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.))
5106                + dMult*(dMult-6.))
5107                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5108   four6n1n6n1n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
5109                - 2.*(dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ1n*dImQ6n+dImQ7n*dImQ1n*dReQ6n)
5110                - 2.*(dReQ5n*dReQ6n*dReQ1n+dImQ5n*dImQ6n*dReQ1n+dReQ5n*dImQ6n*dImQ1n-dImQ5n*dImQ1n*dReQ6n)
5111                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)
5112                - (dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
5113                + dMult*(dMult-6.))
5114                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5115   four6n2n6n2n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5116                - 2.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
5117                - 2.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5118                + pow(dReQ8n,2.)+pow(dImQ8n,2.)-(dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5119                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5120                + dMult*(dMult-6.))
5121                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5122   four6n3n6n3n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5123                - 2.*(dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n
5124                + dImQ9n*dImQ6n*dReQ3n)-2.*(pow(dReQ3n,2.)*dReQ6n
5125                + 2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n))
5126                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5127                - ((dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5128                + (dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-(pow(dReQ9n,2.)+pow(dImQ9n,2.)))
5129                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5130                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));
5131   four6n4n6n4n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5132                - 2.*(dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
5133                - 2.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5134                + pow(dReQ10n,2.)+pow(dImQ10n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)               
5135                - (dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.))
5136                + dMult*(dMult-6.))
5137                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
5138   four6n5n6n5n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
5139                - 2.*(dReQ11n*dReQ6n*dReQ5n-dReQ11n*dImQ6n*dImQ5n+dImQ11n*dReQ5n*dImQ6n+dImQ11n*dImQ5n*dReQ6n)
5140                - 2.*(dReQ1n*dReQ6n*dReQ5n+dImQ1n*dImQ6n*dReQ5n+dReQ1n*dImQ6n*dImQ5n-dImQ1n*dImQ5n*dReQ6n)
5141                + pow(dReQ11n,2.)+pow(dImQ11n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)
5142                - (dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.))
5143                + dMult*(dMult-6.))
5144                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5145   // Two distinct harmonics (2):
5146   four3n1n1n1n = (dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
5147                + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3)               
5148                - 3.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5149                - 3.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5150                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5151                + 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5152                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5153   four6n2n2n2n = (dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
5154                + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3)               
5155                - 3.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5156                - 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5157                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+3.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5158                + 6.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-6.*dMult)
5159                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5160   // Three distinct harmonics (10): 
5161   four3n1n2n2n = ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
5162                + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)
5163                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5164                - (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5165                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n))
5166                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5167                - (2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5168                - (pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5169                - 4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
5170                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5171                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));
5172   four4n2n1n1n = ((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
5173                + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n)
5174                - 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5175                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5176                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n))
5177                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5178                - ((pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5179                - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5180                - 3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
5181                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5182                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));
5183   four4n2n3n3n = ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
5184                + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n
5185                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5186                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5187                - 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5188                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5189                + (pow(dReQ6n,2.)+pow(dImQ6n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5190                + 2.*(2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5191                + (pow(dReQ1n,2.)+pow(dImQ1n,2.))-3.*dMult))
5192                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
5193   four5n2n2n1n = (-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
5194                + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
5195                - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n
5196                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5197                - 2.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5198                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5199                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5200                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+pow(dReQ4n,2.)+pow(dImQ4n,2.)
5201                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5202                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5203                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5204   four5n3n1n1n = (-pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
5205                + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
5206                - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n
5207                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5208                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5209                - 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5210                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5211                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5212                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+pow(dReQ2n,2.)+pow(dImQ2n,2.)
5213                + 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
5214                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
5215   four5n1n3n3n = (dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
5216                - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
5217                + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n
5218                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5219                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5220                - 2.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5221                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5222                + pow(dReQ6n,2.)+pow(dImQ6n,2.)+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5223                + 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5224                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)                                  
5225                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5226   four5n3n4n4n = ((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ5n*dReQ3n-dImQ5n*dImQ3n) 
5227                + 2.*dReQ4n*dImQ4n*(dReQ5n*dImQ3n+dImQ5n*dReQ3n)
5228                - (dReQ8n*dReQ3n*dReQ5n-dReQ8n*dImQ3n*dImQ5n+dImQ8n*dReQ3n*dImQ5n+dImQ8n*dImQ3n*dReQ5n)
5229                - (pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
5230                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5231                - 2.*(dReQ4n*dReQ3n*dReQ1n-dReQ4n*dImQ3n*dImQ1n+dImQ4n*dReQ3n*dImQ1n+dImQ4n*dImQ3n*dReQ1n)
5232                + pow(dReQ8n,2.)+pow(dImQ8n,2.)+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
5233                + 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
5234                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
5235                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5236   four6n4n1n1n = (-pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
5237                + 2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
5238                - pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n
5239                - 2.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5240                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n) 
5241                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n) 
5242                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n) 
5243                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)
5244                + pow(dReQ4n,2.)+pow(dImQ4n,2.))+pow(dReQ2n,2.)+pow(dImQ2n,2.)
5245                + 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5246                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5247   four6n2n4n4n = ((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
5248                + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n)
5249                - (pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
5250                - (dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
5251                - 2.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n))
5252                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5253                - (2.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5254                - (pow(dReQ8n,2.)+pow(dImQ8n,2.))-2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5255                - 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)))
5256                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5257                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));
5258   four6n4n5n5n = ((pow(dReQ5n,2.)-pow(dImQ5n,2.))*(dReQ6n*dReQ4n-dImQ6n*dImQ4n) 
5259                + 2.*dReQ5n*dImQ5n*(dReQ6n*dImQ4n+dImQ6n*dReQ4n)
5260                - (dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
5261                - (pow(dReQ5n,2.)*dReQ10n+2.*dReQ5n*dImQ5n*dImQ10n-pow(dImQ5n,2.)*dReQ10n)
5262                - 2.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5263                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5264                + pow(dReQ10n,2.)+pow(dImQ10n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5265                + 4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))              
5266                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5267                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5268   // Four distinct harmonics (8): 
5269   four4n1n3n2n = (dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
5270                + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
5271                - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
5272                + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n 
5273                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5274                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5275                - (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5276                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5277                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5278                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5279                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5280                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5281                + 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
5282                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5283   four5n1n4n2n = (dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
5284                + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
5285                - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n+dImQ1n*dImQ2n*dReQ4n*dReQ5n
5286                + dReQ1n*dReQ2n*dReQ4n*dReQ5n
5287                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5288                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5289                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5290                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5291                - (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5292                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5293                + pow(dReQ6n,2.)+pow(dImQ6n,2.)
5294                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5295                + pow(dReQ3n,2.)+pow(dImQ3n,2.)+2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5296                + 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5297                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5298   four5n2n4n3n = (dImQ2n*dImQ3n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ2n*dReQ3n 
5299                + dImQ3n*dImQ5n*dReQ2n*dReQ4n-dImQ2n*dImQ5n*dReQ3n*dReQ4n
5300                - dImQ3n*dImQ4n*dReQ2n*dReQ5n+dImQ2n*dImQ4n*dReQ3n*dReQ5n 
5301                + dImQ2n*dImQ3n*dReQ4n*dReQ5n+dReQ2n*dReQ3n*dReQ4n*dReQ5n
5302                - (dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ5n*dImQ2n+dImQ7n*dImQ5n*dReQ2n)
5303                - (dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
5304                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5305                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5306                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5307                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5308                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5309                + 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5310                + 3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+pow(dReQ1n,2.)+pow(dImQ1n,2.)-6.*dMult)
5311                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5312   four6n1n4n3n = (dImQ1n*dImQ3n*dImQ4n*dImQ6n+dImQ4n*dImQ6n*dReQ1n*dReQ3n 
5313                + dImQ3n*dImQ6n*dReQ1n*dReQ4n-dImQ1n*dImQ6n*dReQ3n*dReQ4n
5314                - dImQ3n*dImQ4n*dReQ1n*dReQ6n+dImQ1n*dImQ4n*dReQ3n*dReQ6n+dImQ1n*dImQ3n*dReQ4n*dReQ6n
5315                + dReQ1n*dReQ3n*dReQ4n*dReQ6n
5316                - (dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
5317                - (dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
5318                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5319                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5320                - (dReQ4n*dReQ1n*dReQ3n-dReQ4n*dImQ1n*dImQ3n+dImQ4n*dReQ1n*dImQ3n+dImQ4n*dImQ1n*dReQ3n)
5321                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5322                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5323                + 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5324                + pow(dReQ2n,2.)+pow(dImQ2n,2.)+2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5325                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5326   four6n1n5n2n = (dImQ1n*dImQ2n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ1n*dReQ2n 
5327                + dImQ2n*dImQ6n*dReQ1n*dReQ5n-dImQ1n*dImQ6n*dReQ2n*dReQ5n
5328                - dImQ2n*dImQ5n*dReQ1n*dReQ6n+dImQ1n*dImQ5n*dReQ2n*dReQ6n+dImQ1n*dImQ2n*dReQ5n*dReQ6n
5329                + dReQ1n*dReQ2n*dReQ5n*dReQ6n
5330                - (dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
5331                - (dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ5n*dImQ2n+dImQ7n*dImQ5n*dReQ2n)
5332                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5333                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5334                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5335                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n) 
5336                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5337                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+pow(dReQ4n,2.)+pow(dImQ4n,2.)
5338                + 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5339                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5340   four6n3n2n1n = (dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
5341                - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
5342                + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
5343                + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n
5344                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5345                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5346                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5347                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5348                - (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5349                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5350                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+pow(dReQ5n,2.)+pow(dImQ5n,2.)
5351                + pow(dReQ4n,2.)+pow(dImQ4n,2.)+3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5352                + 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5353                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5354   four6n2n5n3n = (dImQ2n*dImQ3n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ2n*dReQ3n 
5355                + dImQ3n*dImQ6n*dReQ2n*dReQ5n-dImQ2n*dImQ6n*dReQ3n*dReQ5n
5356                - dImQ3n*dImQ5n*dReQ2n*dReQ6n+dImQ2n*dImQ5n*dReQ3n*dReQ6n+dImQ2n*dImQ3n*dReQ5n*dReQ6n
5357                + dReQ2n*dReQ3n*dReQ5n*dReQ6n
5358                - (dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n+dImQ8n*dImQ6n*dReQ2n)
5359                - (dReQ8n*dReQ5n*dReQ3n-dReQ8n*dImQ5n*dImQ3n+dImQ8n*dReQ5n*dImQ3n+dImQ8n*dImQ5n*dReQ3n)
5360                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5361                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5362                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5363                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5364                + pow(dReQ8n,2.)+pow(dImQ8n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5365                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5366                + 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+pow(dReQ1n,2.)+pow(dImQ1n,2.)-6.*dMult)
5367                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5368   four6n3n5n4n = (dImQ3n*dImQ4n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ3n*dReQ4n 
5369                + dImQ4n*dImQ6n*dReQ3n*dReQ5n-dImQ3n*dImQ6n*dReQ4n*dReQ5n
5370                - dImQ4n*dImQ5n*dReQ3n*dReQ6n+dImQ3n*dImQ5n*dReQ4n*dReQ6n+dImQ3n*dImQ4n*dReQ5n*dReQ6n
5371                + dReQ3n*dReQ4n*dReQ5n*dReQ6n
5372                - (dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n+dImQ9n*dImQ6n*dReQ3n)
5373                - (dReQ9n*dReQ5n*dReQ4n-dReQ9n*dImQ5n*dImQ4n+dImQ9n*dReQ5n*dImQ4n+dImQ9n*dImQ5n*dReQ4n)
5374                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5375                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5376                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5377                - (dReQ4n*dReQ3n*dReQ1n-dReQ4n*dImQ3n*dImQ1n+dImQ4n*dReQ3n*dImQ1n+dImQ4n*dImQ3n*dReQ1n)
5378                + pow(dReQ9n,2.)+pow(dImQ9n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5379                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5380                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+pow(dReQ2n,2.)+pow(dImQ2n,2.)
5381                + pow(dReQ1n,2.)+pow(dImQ1n,2.)-6.*dMult)
5382                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5383   f4pCorrelations->Fill(0.5,four1n1n1n1n,d4pMultiplicityWeight);
5384   f4pCorrelations->Fill(1.5,four2n2n2n2n,d4pMultiplicityWeight);
5385   f4pCorrelations->Fill(2.5,four3n3n3n3n,d4pMultiplicityWeight);
5386   f4pCorrelations->Fill(3.5,four4n4n4n4n,d4pMultiplicityWeight);
5387   f4pCorrelations->Fill(4.5,four5n5n5n5n,d4pMultiplicityWeight);
5388   f4pCorrelations->Fill(5.5,four6n6n6n6n,d4pMultiplicityWeight);
5389   //f4pCorrelations->Fill(6.5,0.,d4pMultiplicityWeight); // empty
5390   f4pCorrelations->Fill(7.5,four2n1n2n1n,d4pMultiplicityWeight);
5391   f4pCorrelations->Fill(8.5,four3n1n3n1n,d4pMultiplicityWeight);
5392   f4pCorrelations->Fill(9.5,four3n2n3n2n,d4pMultiplicityWeight);
5393   f4pCorrelations->Fill(10.5,four4n1n4n1n,d4pMultiplicityWeight);
5394   f4pCorrelations->Fill(11.5,four4n2n4n2n,d4pMultiplicityWeight);
5395   f4pCorrelations->Fill(12.5,four4n3n4n3n,d4pMultiplicityWeight);
5396   f4pCorrelations->Fill(13.5,four5n1n5n1n,d4pMultiplicityWeight);
5397   f4pCorrelations->Fill(14.5,four5n2n5n2n,d4pMultiplicityWeight);
5398   f4pCorrelations->Fill(15.5,four5n3n5n3n,d4pMultiplicityWeight);
5399   f4pCorrelations->Fill(16.5,four5n4n5n4n,d4pMultiplicityWeight);
5400   f4pCorrelations->Fill(17.5,four6n1n6n1n,d4pMultiplicityWeight);
5401   f4pCorrelations->Fill(18.5,four6n2n6n2n,d4pMultiplicityWeight);
5402   f4pCorrelations->Fill(19.5,four6n3n6n3n,d4pMultiplicityWeight);
5403   f4pCorrelations->Fill(20.5,four6n4n6n4n,d4pMultiplicityWeight);
5404   f4pCorrelations->Fill(21.5,four6n5n6n5n,d4pMultiplicityWeight);
5405   //f4pCorrelations->Fill(22.5,0.,d4pMultiplicityWeight); // empty
5406   f4pCorrelations->Fill(23.5,four3n1n1n1n,d4pMultiplicityWeight);
5407   f4pCorrelations->Fill(24.5,four6n2n2n2n,d4pMultiplicityWeight);
5408   //f4pCorrelations->Fill(25.5,0.,d4pMultiplicityWeight); // empty
5409   f4pCorrelations->Fill(26.5,four3n1n2n2n,d4pMultiplicityWeight);
5410   f4pCorrelations->Fill(27.5,four4n2n1n1n,d4pMultiplicityWeight);
5411   f4pCorrelations->Fill(28.5,four4n2n3n3n,d4pMultiplicityWeight);
5412   f4pCorrelations->Fill(29.5,four5n2n2n1n,d4pMultiplicityWeight);
5413   f4pCorrelations->Fill(30.5,four5n3n1n1n,d4pMultiplicityWeight);
5414   f4pCorrelations->Fill(31.5,four5n1n3n3n,d4pMultiplicityWeight);
5415   f4pCorrelations->Fill(32.5,four5n3n4n4n,d4pMultiplicityWeight);
5416   f4pCorrelations->Fill(33.5,four6n4n1n1n,d4pMultiplicityWeight);
5417   f4pCorrelations->Fill(34.5,four6n2n4n4n,d4pMultiplicityWeight);
5418   f4pCorrelations->Fill(35.5,four6n4n5n5n,d4pMultiplicityWeight);
5419   //f4pCorrelations->Fill(36.5,0.,d4pMultiplicityWeight); // empty
5420   f4pCorrelations->Fill(37.5,four4n1n3n2n,d4pMultiplicityWeight); 
5421   f4pCorrelations->Fill(38.5,four5n1n4n2n,d4pMultiplicityWeight); 
5422   f4pCorrelations->Fill(39.5,four5n2n4n3n,d4pMultiplicityWeight); 
5423   f4pCorrelations->Fill(40.5,four6n1n4n3n,d4pMultiplicityWeight); 
5424   f4pCorrelations->Fill(41.5,four6n1n5n2n,d4pMultiplicityWeight); 
5425   f4pCorrelations->Fill(42.5,four6n3n2n1n,d4pMultiplicityWeight); 
5426   f4pCorrelations->Fill(43.5,four6n2n5n3n,d4pMultiplicityWeight); 
5427   f4pCorrelations->Fill(44.5,four6n3n5n4n,d4pMultiplicityWeight); 
5428   allMixedCorrelators[15]=four1n1n1n1n;
5429   allMixedCorrelators[16]=four2n2n2n2n;
5430   allMixedCorrelators[17]=four3n3n3n3n;
5431   allMixedCorrelators[18]=four4n4n4n4n;
5432   allMixedCorrelators[19]=four5n5n5n5n;
5433   allMixedCorrelators[20]=four6n6n6n6n;
5434   allMixedCorrelators[21]=four2n1n2n1n;
5435   allMixedCorrelators[22]=four3n1n3n1n;
5436   allMixedCorrelators[23]=four3n2n3n2n;
5437   allMixedCorrelators[24]=four4n1n4n1n;
5438   allMixedCorrelators[25]=four4n2n4n2n;
5439   allMixedCorrelators[26]=four4n3n4n3n;
5440   allMixedCorrelators[27]=four5n1n5n1n;
5441   allMixedCorrelators[28]=four5n2n5n2n;
5442   allMixedCorrelators[29]=four5n3n5n3n;
5443   allMixedCorrelators[30]=four5n4n5n4n;
5444   allMixedCorrelators[31]=four6n1n6n1n;
5445   allMixedCorrelators[32]=four6n2n6n2n;
5446   allMixedCorrelators[33]=four6n3n6n3n;
5447   allMixedCorrelators[34]=four6n4n6n4n;
5448   allMixedCorrelators[35]=four6n5n6n5n;
5449   allMixedCorrelators[36]=four3n1n1n1n;
5450   allMixedCorrelators[37]=four6n2n2n2n;
5451   allMixedCorrelators[38]=four3n1n2n2n;
5452   allMixedCorrelators[39]=four4n2n1n1n;
5453   allMixedCorrelators[40]=four4n2n3n3n;
5454   allMixedCorrelators[41]=four5n2n2n1n;
5455   allMixedCorrelators[42]=four5n3n1n1n;
5456   allMixedCorrelators[43]=four5n1n3n3n;
5457   allMixedCorrelators[44]=four5n3n4n4n;
5458   allMixedCorrelators[45]=four6n4n1n1n;
5459   allMixedCorrelators[46]=four6n2n4n4n;
5460   allMixedCorrelators[47]=four6n4n5n5n;
5461   allMixedCorrelators[48]=four4n1n3n2n;
5462   allMixedCorrelators[49]=four5n1n4n2n;
5463   allMixedCorrelators[50]=four5n2n4n3n;
5464   allMixedCorrelators[51]=four6n1n4n3n;
5465   allMixedCorrelators[52]=four6n1n5n2n;
5466   allMixedCorrelators[53]=four6n3n2n1n;
5467   allMixedCorrelators[54]=four6n2n5n3n;
5468   allMixedCorrelators[55]=four6n3n5n4n;
5469  } // end of if(dMult>3.)
5470
5471  // f) Calculate 5-p correlations:
5472  //  f1) "Standard candles" (30):
5473  Double_t five3n2n3n1n1n = 0.; // <5>_{3n,2n|3n,1n,1n} = <cos(n(3*phi1+2*phi2-3*phi3-1*phi4-1*phi5))>
5474  Double_t five4n1n2n2n1n = 0.; // <5>_{4n,1n|2n,2n,1n} = <cos(n(4*phi1+1*phi2-2*phi3-2*phi4-1*phi5))>
5475  Double_t five4n2n3n2n1n = 0.; // <5>_{4n,2n|3n,2n,1n} = <cos(n(4*phi1+2*phi2-3*phi3-2*phi4-1*phi5))>
5476  Double_t five4n3n3n2n2n = 0.; // <5>_{4n,3n|3n,2n,2n} = <cos(n(4*phi1+3*phi2-3*phi3-2*phi4-2*phi5))>
5477  Double_t five4n2n4n1n1n = 0.; // <5>_{4n,2n|4n,1n,1n} = <cos(n(4*phi1+2*phi2-4*phi3-1*phi4-1*phi5))>
5478  Double_t five4n3n4n2n1n = 0.; // <5>_{4n,3n|4n,2n,1n} = <cos(n(4*phi1+3*phi2-4*phi3-2*phi4-1*phi5))>
5479  Double_t five5n1n3n2n1n = 0.; // <5>_{5n,1n|3n,2n,1n} = <cos(n(5*phi1+1*phi2-3*phi3-2*phi4-1*phi5))>
5480  Double_t five5n2n5n1n1n = 0.; // <5>_{5n,2n|5n,1n,1n} = <cos(n(5*phi1+2*phi2-5*phi3-1*phi4-1*phi5))>
5481  Double_t five5n2n4n2n1n = 0.; // <5>_{5n,2n|4n,2n,1n} = <cos(n(5*phi1+2*phi2-4*phi3-2*phi4-1*phi5))>
5482  Double_t five5n3n4n3n1n = 0.; // <5>_{5n,3n|4n,3n,1n} = <cos(n(5*phi1+3*phi2-4*phi3-3*phi4-1*phi5))>
5483  Double_t five5n4n4n3n2n = 0.; // <5>_{5n,4n|4n,3n,2n} = <cos(n(5*phi1+4*phi2-4*phi3-3*phi4-2*phi5))>
5484  Double_t five5n3n5n2n1n = 0.; // <5>_{5n,3n|5n,2n,1n} = <cos(n(5*phi1+3*phi2-5*phi3-2*phi4-1*phi5))>
5485  Double_t five5n4n5n2n2n = 0.; // <5>_{5n,4n|5n,2n,2n} = <cos(n(5*phi1+4*phi2-5*phi3-2*phi4-2*phi5))>
5486  Double_t five5n4n5n3n1n = 0.; // <5>_{5n,4n|5n,3n,1n} = <cos(n(5*phi1+4*phi2-5*phi3-3*phi4-1*phi5))>
5487  Double_t five6n1n3n3n1n = 0.; // <5>_{6n,1n|3n,3n,1n} = <cos(n(6*phi1+1*phi2-3*phi3-3*phi4-1*phi5))>
5488  Double_t five6n2n3n3n2n = 0.; // <5>_{6n,2n|3n,3n,2n} = <cos(n(6*phi1+2*phi2-3*phi3-3*phi4-2*phi5))>
5489  Double_t five6n1n4n2n1n = 0.; // <5>_{6n,1n|4n,2n,1n} = <cos(n(6*phi1+1*phi2-4*phi3-2*phi4-1*phi5))>
5490  Double_t five6n3n4n3n2n = 0.; // <5>_{6n,3n|4n,3n,2n} = <cos(n(6*phi1+3*phi2-4*phi3-3*phi4-2*phi5))>
5491  Double_t five6n4n4n3n3n = 0.; // <5>_{6n,4n|4n,3n,3n} = <cos(n(6*phi1+4*phi2-4*phi3-3*phi4-3*phi5))>
5492  Double_t five6n2n5n2n1n = 0.; // <5>_{6n,2n|5n,2n,1n} = <cos(n(6*phi1+2*phi2-5*phi3-2*phi4-1*phi5))>
5493  Double_t five6n3n5n3n1n = 0.; // <5>_{6n,3n|5n,3n,1n} = <cos(n(6*phi1+3*phi2-5*phi3-3*phi4-1*phi5))>
5494  Double_t five6n4n5n4n1n = 0.; // <5>_{6n,4n|5n,4n,1n} = <cos(n(6*phi1+4*phi2-5*phi3-4*phi4-1*phi5))>
5495  Double_t five6n5n5n3n3n = 0.; // <5>_{6n,5n|5n,3n,3n} = <cos(n(6*phi1+5*phi2-5*phi3-3*phi4-3*phi5))>
5496  Double_t five6n2n6n1n1n = 0.; // <5>_{6n,2n|6n,1n,1n} = <cos(n(6*phi1+2*phi2-6*phi3-1*phi4-1*phi5))>
5497  Double_t five6n3n6n2n1n = 0.; // <5>_{6n,3n|6n,2n,1n} = <cos(n(6*phi1+3*phi2-6*phi3-2*phi4-1*phi5))>
5498  Double_t five6n4n6n2n2n = 0.; // <5>_{6n,4n|6n,2n,2n} = <cos(n(6*phi1+4*phi2-6*phi3-2*phi4-2*phi5))>
5499  Double_t five6n4n6n3n1n = 0.; // <5>_{6n,4n|6n,3n,1n} = <cos(n(6*phi1+4*phi2-6*phi3-3*phi4-1*phi5))>
5500  Double_t five6n5n5n4n2n = 0.; // <5>_{6n,5n|5n,4n,2n} = <cos(n(6*phi1+5*phi2-5*phi3-4*phi4-2*phi5))>
5501  Double_t five6n5n6n3n2n = 0.; // <5>_{6n,5n|6n,3n,2n} = <cos(n(6*phi1+5*phi2-6*phi3-3*phi4-2*phi5))> // TBI swap with previous
5502  Double_t five6n5n6n4n1n = 0.; // <5>_{6n,5n|6n,4n,1n} = <cos(n(6*phi1+5*phi2-6*phi3-4*phi4-1*phi5))>
5503  //  f2) Two distinct harmonics (9):
5504  Double_t five2n1n1n1n1n = 0.; // <5>_{2n,1n|1n,1n,1n} = <cos(n(2*phi1+1*phi2-1*phi3-1*phi4-1*phi5))>
5505  Double_t five2n2n2n1n1n = 0.; // <5>_{2n,2n|2n,1n,1n} = <cos(n(2*phi1+2*phi2-2*phi3-1*phi4-1*phi5))>
5506  Double_t five3n3n2n2n2n = 0.; // <5>_{3n,3n|2n,2n,2n} = <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-2*phi5))>
5507  Double_t five4n1n1n1n1n = 0.; // <5>_{4n|1n,1n,1n,1n} = <cos(n(4*phi1-1*phi2-1*phi3-1*phi4-1*phi5))>
5508  Double_t five4n2n2n2n2n = 0.; // <5>_{4n,2n|2n,2n,2n} = <cos(n(4*phi1+2*phi2-2*phi3-2*phi4-2*phi5))>
5509  Double_t five4n4n4n2n2n = 0.; // <5>_{4n,4n|4n,2n,2n} = <cos(n(4*phi1+4*phi2-4*phi3-2*phi4-2*phi5))>
5510  Double_t five6n3n3n3n3n = 0.; // <5>_{6n,3n|3n,3n,3n} = <cos(n(6*phi1+3*phi2-3*phi3-3*phi4-3*phi5))>
5511  Double_t five6n6n4n4n4n = 0.; // <5>_{6n,6n|4n,4n,4n} = <cos(n(6*phi1+6*phi2-4*phi3-4*phi4-4*phi5))>
5512  Double_t five6n6n6n3n3n = 0.; // <5>_{6n,6n|6n,3n,3n} = <cos(n(6*phi1+6*phi2-6*phi3-3*phi4-3*phi5))>
5513  //  f3) Three distinct harmonics (30):
5514  Double_t five3n1n2n1n1n = 0.; // <5>_{3n,1n|2n,1n,1n} = <cos(n(3*phi1+1*phi2-2*phi3-1*phi4-1*phi5))>
5515  Double_t five3n2n2n2n1n = 0.; // <5>_{3n,2n|2n,2n,1n} = <cos(n(3*phi1+2*phi2-2*phi3-2*phi4-1*phi5))>
5516  Double_t five3n3n3n2n1n = 0.; // <5>_{3n,3n|3n,2n,1n} = <cos(n(3*phi1+3*phi2-3*phi3-2*phi4-1*phi5))>
5517  Double_t five4n1n3n1n1n = 0.; // <5>_{4n,1n|3n,1n,1n} = <cos(n(4*phi1+1*phi2-3*phi3-1*phi4-1*phi5))>
5518  Double_t five4n1n1n3n3n = 0.; // <5>_{4n,1n,1n|3n,3n} = <cos(n(4*phi1+1*phi2+1*phi3-3*phi4-3*phi5))>
5519  Double_t five4n3n3n3n1n = 0.; // <5>_{4n,3n|3n,3n,1n} = <cos(n(4*phi1+3*phi2-3*phi3-3*phi4-1*phi5))>
5520  Double_t five4n4n3n3n2n = 0.; // <5>_{4n,4n|3n,3n,2n} = <cos(n(4*phi1+4*phi2-3*phi3-3*phi4-2*phi5))>
5521  Double_t five4n4n4n3n1n = 0.; // <5>_{4n,4n|4n,3n,1n} = <cos(n(4*phi1+4*phi2-4*phi3-3*phi4-1*phi5))>
5522  Double_t five5n2n1n1n1n = 0.; // <5>_{5n|2n,1n,1n,1n} = <cos(n(5*phi1-2*phi2-1*phi3-1*phi4-1*phi5))>
5523  Double_t five5n1n2n2n2n = 0.; // <5>_{5n,1n|2n,2n,2n} = <cos(n(5*phi1+1*phi2-2*phi3-2*phi4-2*phi5))>
5524  Double_t five5n2n3n2n2n = 0.; // <5>_{5n,2n|3n,2n,2n} = <cos(n(5*phi1+2*phi2-3*phi3-2*phi4-2*phi5))>
5525  Double_t five5n3n3n3n2n = 0.; // <5>_{5n,3n|3n,3n,2n} = <cos(n(5*phi1+3*phi2-3*phi3-3*phi4-2*phi5))>
5526  Double_t five5n1n4n1n1n = 0.; // <5>_{5n,1n|4n,1n,1n} = <cos(n(5*phi1+1*phi2-4*phi3-1*phi4-1*phi5))>
5527  Double_t five5n4n3n3n3n = 0.; // <5>_{5n,4n|3n,3n,3n} = <cos(n(5*phi1+4*phi2-3*phi3-3*phi4-3*phi5))>
5528  Double_t five5n4n4n4n1n = 0.; // <5>_{5n,4n|4n,4n,1n} = <cos(n(5*phi1+4*phi2-4*phi3-4*phi4-1*phi5))>
5529  Double_t five5n5n4n3n3n = 0.; // <5>_{5n,5n|4n,3n,3n} = <cos(n(5*phi1+5*phi2-4*phi3-3*phi4-3*phi5))>
5530  Double_t five5n5n4n4n2n = 0.; // <5>_{5n,5n|4n,4n,2n} = <cos(n(5*phi1+5*phi2-4*phi3-4*phi4-2*phi5))>
5531  Double_t five5n5n5n3n2n = 0.; // <5>_{5n,5n|5n,3n,2n} = <cos(n(5*phi1+5*phi2-5*phi3-3*phi4-2*phi5))>
5532  Double_t five5n5n5n4n1n = 0.; // <5>_{5n,5n|5n,4n,1n} = <cos(n(5*phi1+5*phi2-5*phi3-4*phi4-1*phi5))>
5533  Double_t five6n2n2n1n1n = 0.; // <5>_{6n|2n,2n,1n,1n} = <cos(n(6*phi1-2*phi2-2*phi3-1*phi4-1*phi5))>
5534  Double_t five6n3n1n1n1n = 0.; // <5>_{6n|3n,1n,1n,1n} = <cos(n(6*phi1-3*phi2-1*phi3-1*phi4-1*phi5))>
5535  Double_t five6n1n1n4n4n = 0.; // <5>_{6n,1n,1n|4n,4n} = <cos(n(6*phi1+1*phi2+1*phi3-4*phi4-4*phi5))>
5536  Double_t five6n1n5n1n1n = 0.; // <5>_{6n,1n|5n,1n,1n} = <cos(n(6*phi1+1*phi2-5*phi3-1*phi4-1*phi5))>
5537  Double_t five6n2n4n2n2n = 0.; // <5>_{6n,2n|4n,2n,2n} = <cos(n(6*phi1+2*phi2-4*phi3-2*phi4-2*phi5))>
5538  Double_t five6n4n4n4n2n = 0.; // <5>_{6n,4n|4n,4n,2n} = <cos(n(6*phi1+4*phi2-4*phi3-4*phi4-2*phi5))>
5539  Double_t five6n2n2n5n5n = 0.; // <5>_{6n,2n,2n|5n,5n} = <cos(n(6*phi1+2*phi2+2*phi3-5*phi4-5*phi5))>
5540  Double_t five6n5n5n5n1n = 0.; // <5>_{6n,5n|5n,5n,1n} = <cos(n(6*phi1+5*phi2-5*phi3-5*phi4-1*phi5))>
5541  Double_t five6n6n5n5n2n = 0.; // <5>_{6n,6n|5n,5n,2n} = <cos(n(6*phi1+6*phi2-5*phi3-5*phi4-2*phi5))>
5542  Double_t five6n6n6n4n2n = 0.; // <5>_{6n,6n|6n,4n,2n} = <cos(n(6*phi1+6*phi2-6*phi3-4*phi4-2*phi5))>
5543  Double_t five6n6n6n5n1n = 0.; // <5>_{6n,6n|6n,5n,1n} = <cos(n(6*phi1+6*phi2-6*phi3-5*phi4-1*phi5))> // TBI swap with the one above
5544  // Four distinct harmonics (11):
5545  Double_t five5n2n3n3n1n = 0.; // <5>_{5n,2n|3n,3n,1n} = <cos(n(5*phi1+2*phi2-3*phi3-3*phi4-1*phi5))>
5546  Double_t five5n1n1n4n3n = 0.; // <5>_{5n,1n,1n|4n,3n} = <cos(n(5*phi1+1*phi2+1*phi3-4*phi4-3*phi5))>
5547  Double_t five5n3n4n2n2n = 0.; // <5>_{5n,3n|4n,2n,2n} = <cos(n(5*phi1+3*phi2-4*phi3-2*phi4-2*phi5))>
5548  Double_t five5n2n1n4n4n = 0.; // <5>_{5n,2n,1n|4n,4n} = <cos(n(5*phi1+2*phi2+1*phi3-4*phi4-4*phi5))>
5549  Double_t five6n1n3n2n2n = 0.; // <5>_{6n,1n|3n,2n,2n} = <cos(n(6*phi1+1*phi2-3*phi3-2*phi4-2*phi5))>
5550  Double_t five6n3n4n4n1n = 0.; // <5>_{6n,3n|4n,4n,1n} = <cos(n(6*phi1+3*phi2-4*phi3-4*phi4-1*phi5))>
5551  Double_t five6n1n1n5n3n = 0.; // <5>_{6n,1n,1n|5n,3n} = <cos(n(6*phi1+1*phi2+1*phi3-5*phi4-3*phi5))>
5552  Double_t five6n3n5n2n2n = 0.; // <5>_{6n,3n|5n,2n,2n} = <cos(n(6*phi1+3*phi2-5*phi3-2*phi4-2*phi5))>
5553  Double_t five6n5n4n4n3n = 0.; // <5>_{6n,5n|4n,4n,3n} = <cos(n(6*phi1+5*phi2-4*phi3-4*phi4-3*phi5))>
5554  Double_t five6n3n1n5n5n = 0.; // <5>_{6n,3n,1n|5n,5n} = <cos(n(6*phi1+3*phi2+1*phi3-5*phi4-5*phi5))>
5555  Double_t five6n6n5n4n3n = 0.; // <5>_{6n,6n|5n,4n,3n} = <cos(n(6*phi1+6*phi2-5*phi3-4*phi4-3*phi5))>
5556  // Five distinct harmonics (3):
5557  Double_t five6n2n4n3n1n = 0.; // <5>_{6n,2n|4n,3n,1n} = <cos(n(6*phi1+2*phi2-4*phi3-3*phi4-1*phi5))>
5558  Double_t five6n2n1n5n4n = 0.; // <5>_{6n,2n,1n|5n,4n} = <cos(n(6*phi1+2*phi2+1*phi3-5*phi4-4*phi5))>
5559  Double_t five6n4n5n3n2n = 0.; // <5>_{6n,4n|5n,3n,2n} = <cos(n(6*phi1+4*phi2-5*phi3-3*phi4-2*phi5))>
5560  if(dMult>4.)
5561  {
5562   five3n2n3n1n1n = (-(pow(dImQ3n,2.)+pow(dReQ3n,2.))
5563                  * (-2.*dImQ1n*dImQ2n*dReQ1n+pow(dImQ1n,2.)*dReQ2n-pow(dReQ1n,2.)*dReQ2n)
5564                  - (-pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
5565                  + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
5566                  - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n)
5567                  - 2.*(dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
5568                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
5569                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
5570                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
5571                  - (dReQ3n*pow(dReQ1n,3.)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2.)
5572                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2.)-dImQ3n*pow(dImQ1n,3.))
5573                  - 2.*((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
5574                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5575                  + 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5576                  + 3.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5577                  + 6.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5578                  + 2.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5579                  + 9.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5580                  - (dMult-8.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5581                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
5582                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
5583                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5584                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(dMult-12.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5585                  + 2.*(dMult-9.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.))
5586                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
5587   five4n1n2n2n1n = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))
5588                  * (pow(dReQ2n,2.)*dReQ4n-pow(dImQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n)
5589                  - 2.*(dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
5590                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
5591                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
5592                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)    
5593                  - 2.*((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) 
5594                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
5595                  - (-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
5596                  + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
5597                  - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n)
5598                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
5599                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5600                  + (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5601                  + 2.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5602                  + 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5603                  + 2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5604                  + 3.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5605                  + 4.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5606                  + 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5607                  + 6.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5608                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5609                  - (dMult-6.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5610                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5611                  - 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5612                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5613                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5614                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5615                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5616                  + 2.*(dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.))
5617                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
5618   five4n2n3n2n1n = ((pow(dImQ2n,2.)+pow(dReQ2n,2.))*(dImQ3n*dImQ4n*dReQ1n+dImQ1n*dImQ4n*dReQ3n 
5619                  - dImQ1n*dImQ3n*dReQ4n+dReQ1n*dReQ3n*dReQ4n)
5620                  - (dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
5621                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
5622                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
5623                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
5624                  - (dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
5625                  + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
5626                  - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n 
5627                  + dImQ1n*dImQ2n*dReQ4n*dReQ5n+dReQ1n*dReQ2n*dReQ4n*dReQ5n)
5628                  - ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
5629                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n)
5630                  - (dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
5631                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
5632                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
5633                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
5634                  - ((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) 
5635                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
5636                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
5637                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5638                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5639                  + 3.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5640                  + (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5641                  + pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n
5642                  + dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n
5643                  + 3.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5644                  - (dMult-7.)*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5645                  + 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5646                  + 7.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5647                  + 4.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5648                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5649                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5650                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5651                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5652                  + 2.*(dMult-7.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+(dMult-12.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5653                  - 2.*dMult*(dMult-12.))
5654                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
5655
5656   // *********************************************************************
5657   Double_t reQ7nQ3nstarQ2nstarQ2nstar = (dReQ7n*dReQ3n+dImQ7n*dImQ3n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
5658                                       + 2.*dReQ2n*dImQ2n*(dImQ7n*dReQ3n-dReQ7n*dImQ3n); 
5659   Double_t reQ5nQ2nQ4nstarQ3nstar = dImQ2n*dImQ3n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ2n*dReQ3n 
5660                                   + dImQ3n*dImQ5n*dReQ2n*dReQ4n-dImQ2n*dImQ5n*dReQ3n*dReQ4n
5661                                   - dImQ3n*dImQ4n*dReQ2n*dReQ5n+dImQ2n*dImQ4n*dReQ3n*dReQ5n 
5662                                   + dImQ2n*dImQ3n*dReQ4n*dReQ5n+dReQ2n*dReQ3n*dReQ4n*dReQ5n;
5663   Double_t reQ7nQ4nstarQ3nstar = dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n
5664                                + dImQ7n*dImQ4n*dReQ3n; 
5665
5666
5667   Double_t reQ7nQ5nstarQ2nstar = dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ5n*dImQ2n
5668                                + dImQ7n*dImQ5n*dReQ2n;
5669
5670   // <5>_{6n,4n|4n,3n,3n}:
5671   Double_t reQ10nQ4nstarQ3nstarQ3nstar = (dReQ10n*dReQ4n+dImQ10n*dImQ4n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
5672                                       + 2.*dReQ3n*dImQ3n*(dImQ10n*dReQ4n-dReQ10n*dImQ4n); 
5673   Double_t reQ7nQ3nQ6nstarQ4nstar = dImQ3n*dImQ4n*dImQ6n*dImQ7n+dImQ6n*dImQ7n*dReQ3n*dReQ4n 
5674                                   + dImQ4n*dImQ7n*dReQ3n*dReQ6n-dImQ3n*dImQ7n*dReQ4n*dReQ6n
5675                                   - dImQ4n*dImQ6n*dReQ3n*dReQ7n+dImQ3n*dImQ6n*dReQ4n*dReQ7n 
5676                                   + dImQ3n*dImQ4n*dReQ6n*dReQ7n+dReQ3n*dReQ4n*dReQ6n*dReQ7n;
5677   Double_t reQ10nQ7nstarQ3nstar = dReQ10n*dReQ7n*dReQ3n-dReQ10n*dImQ7n*dImQ3n+dImQ10n*dReQ7n*dImQ3n
5678                                 + dImQ10n*dImQ7n*dReQ3n; 
5679   Double_t reQ10nQ6nstarQ4nstar = dReQ10n*dReQ6n*dReQ4n-dReQ10n*dImQ6n*dImQ4n+dImQ10n*dReQ6n*dImQ4n
5680                                 + dImQ10n*dImQ6n*dReQ4n; 
5681   Double_t reQ6nQ1nQ4nstarQ3nstar = dImQ1n*dImQ3n*dImQ4n*dImQ6n+dImQ4n*dImQ6n*dReQ1n*dReQ3n 
5682                                   + dImQ3n*dImQ6n*dReQ1n*dReQ4n-dImQ1n*dImQ6n*dReQ3n*dReQ4n
5683                                   - dImQ3n*dImQ4n*dReQ1n*dReQ6n+dImQ1n*dImQ4n*dReQ3n*dReQ6n 
5684                                   + dImQ1n*dImQ3n*dReQ4n*dReQ6n+dReQ1n*dReQ3n*dReQ4n*dReQ6n;
5685   Double_t reQ7nQ6nstarQ1nstar = dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n
5686                                + dImQ7n*dImQ6n*dReQ1n;
5687  // <5>_{6n,5n|5n,3n,3n}:
5688  /*Double_t reQ11nQ5nstarQ3nstarQ3nstar = (dReQ11n*dReQ5n+dImQ11n*dImQ5n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
5689                                       + 2.*dReQ3n*dImQ3n*(dImQ11n*dReQ5n-dReQ11n*dImQ5n); */
5690  Double_t reQ6nQ2nQ5nstarQ3nstar = dImQ2n*dImQ3n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ2n*dReQ3n 
5691                                  + dImQ3n*dImQ6n*dReQ2n*dReQ5n-dImQ2n*dImQ6n*dReQ3n*dReQ5n
5692                                  - dImQ3n*dImQ5n*dReQ2n*dReQ6n+dImQ2n*dImQ5n*dReQ3n*dReQ6n 
5693                                  + dImQ2n*dImQ3n*dReQ5n*dReQ6n+dReQ2n*dReQ3n*dReQ5n*dReQ6n;
5694  Double_t reQ8nQ3nQ6nstarQ5nstar = dImQ3n*dImQ5n*dImQ6n*dImQ8n+dImQ6n*dImQ8n*dReQ3n*dReQ5n 
5695                                  + dImQ5n*dImQ8n*dReQ3n*dReQ6n-dImQ3n*dImQ8n*dReQ5n*dReQ6n
5696                                  - dImQ5n*dImQ6n*dReQ3n*dReQ8n+dImQ3n*dImQ6n*dReQ5n*dReQ8n 
5697                                  + dImQ3n*dImQ5n*dReQ6n*dReQ8n+dReQ3n*dReQ5n*dReQ6n*dReQ8n;
5698  Double_t reQ11nQ6nstarQ5nstar = dReQ11n*dReQ6n*dReQ5n-dReQ11n*dImQ6n*dImQ5n+dImQ11n*dReQ6n*dImQ5n
5699                                + dImQ11n*dImQ6n*dReQ5n;
5700  Double_t reQ8nQ6nstarQ2nstar = dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n
5701                               + dImQ8n*dImQ6n*dReQ2n; 
5702  Double_t reQ11nQ8nstarQ3nstar = dReQ11n*dReQ8n*dReQ3n-dReQ11n*dImQ8n*dImQ3n+dImQ11n*dReQ8n*dImQ3n
5703                                + dImQ11n*dImQ8n*dReQ3n;
5704  Double_t reQ8nQ5nstarQ3nstar = dReQ8n*dReQ5n*dReQ3n-dReQ8n*dImQ5n*dImQ3n+dImQ8n*dReQ5n*dImQ3n
5705                               + dImQ8n*dImQ5n*dReQ3n; 
5706  // <5>_{5n,2n|5n,1n,1n}
5707  Double_t reQ7nQ5nstarQ1nstarQ1nstar = (dReQ7n*dReQ5n+dImQ7n*dImQ5n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
5708                                       + 2.*dReQ1n*dImQ1n*(dImQ7n*dReQ5n-dReQ7n*dImQ5n); 
5709  Double_t reQ6nQ1nQ5nstarQ2nstar = dImQ1n*dImQ2n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ1n*dReQ2n 
5710                                  + dImQ2n*dImQ6n*dReQ1n*dReQ5n-dImQ1n*dImQ6n*dReQ2n*dReQ5n
5711                                  - dImQ2n*dImQ5n*dReQ1n*dReQ6n+dImQ1n*dImQ5n*dReQ2n*dReQ6n 
5712                                  + dImQ1n*dImQ2n*dReQ5n*dReQ6n+dReQ1n*dReQ2n*dReQ5n*dReQ6n;
5713  // <5>_{5n,4n|5n,2n,2n}
5714  Double_t reQ9nQ5nstarQ2nstarQ2nstar = (dReQ9n*dReQ5n+dImQ9n*dImQ5n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
5715                                      + 2.*dReQ2n*dImQ2n*(dImQ9n*dReQ5n-dReQ9n*dImQ5n);
5716  Double_t reQ7nQ2nQ5nstarQ4nstar = dImQ2n*dImQ4n*dImQ5n*dImQ7n+dImQ5n*dImQ7n*dReQ2n*dReQ4n 
5717                                  + dImQ4n*dImQ7n*dReQ2n*dReQ5n-dImQ2n*dImQ7n*dReQ4n*dReQ5n
5718                                  - dImQ4n*dImQ5n*dReQ2n*dReQ7n+dImQ2n*dImQ5n*dReQ4n*dReQ7n 
5719                                  + dImQ2n*dImQ4n*dReQ5n*dReQ7n+dReQ2n*dReQ4n*dReQ5n*dReQ7n;
5720  Double_t reQ9nQ5nstarQ4nstar = dReQ9n*dReQ5n*dReQ4n-dReQ9n*dImQ5n*dImQ4n+dImQ9n*dReQ5n*dImQ4n
5721                               + dImQ9n*dImQ5n*dReQ4n; 
5722  Double_t reQ9nQ7nstarQ2nstar = dReQ9n*dReQ7n*dReQ2n-dReQ9n*dImQ7n*dImQ2n+dImQ9n*dReQ7n*dImQ2n
5723                               + dImQ9n*dImQ7n*dReQ2n; 
5724  // <5>_{6n,2n|6n,1n,1n}
5725  Double_t reQ8nQ6nstarQ1nstarQ1nstar = (dReQ8n*dReQ6n+dImQ8n*dImQ6n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
5726                                      + 2.*dReQ1n*dImQ1n*(dImQ8n*dReQ6n-dReQ8n*dImQ6n);
5727  Double_t reQ7nQ1nQ6nstarQ2nstar = dImQ1n*dImQ2n*dImQ6n*dImQ7n+dImQ6n*dImQ7n*dReQ1n*dReQ2n 
5728                                  + dImQ2n*dImQ7n*dReQ1n*dReQ6n-dImQ1n*dImQ7n*dReQ2n*dReQ6n
5729                                  - dImQ2n*dImQ6n*dReQ1n*dReQ7n+dImQ1n*dImQ6n*dReQ2n*dReQ7n 
5730                                  + dImQ1n*dImQ2n*dReQ6n*dReQ7n+dReQ1n*dReQ2n*dReQ6n*dReQ7n;
5731  Double_t reQ8nQ7nstarQ1nstar = dReQ8n*dReQ7n*dReQ1n-dReQ8n*dImQ7n*dImQ1n+dImQ8n*dReQ7n*dImQ1n
5732                               + dImQ8n*dImQ7n*dReQ1n;
5733  // <5>_{5n,2n|4n,2n,1n}
5734  Double_t reQ5nQ2nQ4nstarQ2nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
5735                                         * (dReQ1n*dReQ4n*dReQ5n-dReQ5n*dImQ1n*dImQ4n 
5736                                         + dReQ4n*dImQ1n*dImQ5n+dReQ1n*dImQ4n*dImQ5n);
5737  Double_t reQ7nQ4nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ4n*dReQ7n-dReQ4n*dReQ7n*dImQ1n*dImQ2n 
5738                                      - dReQ2n*dReQ7n*dImQ1n*dImQ4n-dReQ1n*dReQ7n*dImQ2n*dImQ4n 
5739                                      + dReQ2n*dReQ4n*dImQ1n*dImQ7n+dReQ1n*dReQ4n*dImQ2n*dImQ7n 
5740                                      + dReQ1n*dReQ2n*dImQ4n*dImQ7n-dImQ1n*dImQ2n*dImQ4n*dImQ7n;
5741  // <5>_{4n,3n|4n,2n,1n}:
5742  Double_t reQ4nQ3nQ4nstarQ2nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n 
5743                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n) 
5744                                         * (pow(dReQ4n,2.)+pow(dImQ4n,2.));        
5745  /*
5746  Double_t reQ4nQ1nQ3nstarQ2nstar = dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
5747                                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
5748                                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
5749                                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n;
5750  */
5751  // <5>_{5n,3n|4n,3n,1n}:
5752  Double_t reQ5nQ3nQ4nstarQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))
5753                                         * (dReQ1n*dReQ4n*dReQ5n-dReQ5n*dImQ1n*dImQ4n 
5754                                         + dReQ4n*dImQ1n*dImQ5n+dReQ1n*dImQ4n*dImQ5n);
5755  Double_t reQ5nQ3nQ4nstarQ4nstar = dReQ3n*pow(dReQ4n,2.)*dReQ5n+2.*dReQ4n*dReQ5n*dImQ3n*dImQ4n 
5756                                  - dReQ3n*dReQ5n*pow(dImQ4n,2.)-pow(dReQ4n,2.)*dImQ3n*dImQ5n
5757                                  + 2.*dReQ3n*dReQ4n*dImQ4n*dImQ5n+dImQ3n*pow(dImQ4n,2.)*dImQ5n;
5758  Double_t reQ7nQ1nQ5nstarQ3nstar = dImQ1n*dImQ3n*dImQ5n*dImQ7n+dImQ5n*dImQ7n*dReQ1n*dReQ3n 
5759                                  + dImQ3n*dImQ7n*dReQ1n*dReQ5n-dImQ1n*dImQ7n*dReQ3n*dReQ5n
5760                                  - dImQ3n*dImQ5n*dReQ1n*dReQ7n+dImQ1n*dImQ5n*dReQ3n*dReQ7n 
5761                                  + dImQ1n*dImQ3n*dReQ5n*dReQ7n+dReQ1n*dReQ3n*dReQ5n*dReQ7n;             
5762  Double_t reQ8nQ4nstarQ3nstarQ1nstar = dReQ1n*dReQ3n*dReQ4n*dReQ8n-dReQ4n*dReQ8n*dImQ1n*dImQ3n 
5763                                      - dReQ3n*dReQ8n*dImQ1n*dImQ4n-dReQ1n*dReQ8n*dImQ3n*dImQ4n 
5764                                      + dReQ3n*dReQ4n*dImQ1n*dImQ8n+dReQ1n*dReQ4n*dImQ3n*dImQ8n 
5765                                      + dReQ1n*dReQ3n*dImQ4n*dImQ8n-dImQ1n*dImQ3n*dImQ4n*dImQ8n;
5766  Double_t reQ8nQ4nstarQ4nstar = pow(dReQ4n,2.)*dReQ8n-dReQ8n*pow(dImQ4n,2.)+2.*dReQ4n*dImQ4n*dImQ8n;
5767  // <5>_{5n,4n|4n,3n,2n}:
5768  Double_t reQ5nQ4nQ4nstarQ3nstarQ2nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))
5769                                         * (dReQ2n*dReQ3n*dReQ5n-dReQ5n*dImQ2n*dImQ3n 
5770                                         + dReQ3n*dImQ2n*dImQ5n+dReQ2n*dImQ3n*dImQ5n);
5771  Double_t reQ6nQ3nQ5nstarQ4nstar = dImQ4n*dImQ3n*dImQ6n*dImQ5n+dImQ6n*dImQ5n*dReQ4n*dReQ3n 
5772                                  + dImQ3n*dImQ5n*dReQ4n*dReQ6n-dImQ4n*dImQ5n*dReQ3n*dReQ6n
5773                                  - dImQ3n*dImQ6n*dReQ4n*dReQ5n+dImQ4n*dImQ6n*dReQ3n*dReQ5n 
5774                                  + dImQ4n*dImQ3n*dReQ6n*dReQ5n+dReQ4n*dReQ3n*dReQ6n*dReQ5n;
5775  Double_t reQ9nQ4nstarQ3nstarQ2nstar = dReQ2n*dReQ3n*dReQ4n*dReQ9n-dReQ4n*dReQ9n*dImQ2n*dImQ3n 
5776                                      - dReQ3n*dReQ9n*dImQ2n*dImQ4n-dReQ2n*dReQ9n*dImQ3n*dImQ4n 
5777                                      + dReQ3n*dReQ4n*dImQ2n*dImQ9n+dReQ2n*dReQ4n*dImQ3n*dImQ9n 
5778                                      + dReQ2n*dReQ3n*dImQ4n*dImQ9n-dImQ2n*dImQ3n*dImQ4n*dImQ9n;   
5779  Double_t reQ9nQ6nstarQ3nstar = dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n
5780                               + dImQ9n*dImQ6n*dReQ3n; 
5781  // <5>_{5n,3n|5n,2n,1n}:
5782  Double_t reQ5nQ3nQ5nstarQ2nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n 
5783                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n) 
5784                                         * (pow(dReQ5n,2.)+pow(dImQ5n,2.));
5785  Double_t reQ8nQ5nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ5n*dReQ8n-dReQ5n*dReQ8n*dImQ1n*dImQ2n 
5786                                      - dReQ2n*dReQ8n*dImQ1n*dImQ5n-dReQ1n*dReQ8n*dImQ2n*dImQ5n 
5787                                      + dReQ2n*dReQ5n*dImQ1n*dImQ8n+dReQ1n*dReQ5n*dImQ2n*dImQ8n 
5788                                      + dReQ1n*dReQ2n*dImQ5n*dImQ8n-dImQ1n*dImQ2n*dImQ5n*dImQ8n;
5789  // <5>_{5n,4n|5n,3n,1n}:
5790  Double_t reQ5nQ4nQ5nstarQ3nstarQ1nstar = (dReQ1n*dReQ3n*dReQ4n-dReQ4n*dImQ1n*dImQ3n 
5791                                         + dReQ3n*dImQ1n*dImQ4n+dReQ1n*dImQ3n*dImQ4n) 
5792                                         * (pow(dReQ5n,2.)+pow(dImQ5n,2.));
5793  Double_t reQ8nQ1nQ5nstarQ4nstar = dImQ4n*dImQ1n*dImQ8n*dImQ5n+dImQ8n*dImQ5n*dReQ4n*dReQ1n 
5794                                  + dImQ1n*dImQ5n*dReQ4n*dReQ8n-dImQ4n*dImQ5n*dReQ1n*dReQ8n
5795                                  - dImQ1n*dImQ8n*dReQ4n*dReQ5n+dImQ4n*dImQ8n*dReQ1n*dReQ5n 
5796                                  + dImQ4n*dImQ1n*dReQ8n*dReQ5n+dReQ4n*dReQ1n*dReQ8n*dReQ5n;                      
5797  Double_t reQ9nQ5nstarQ3nstarQ1nstar = dReQ1n*dReQ3n*dReQ5n*dReQ9n-dReQ5n*dReQ9n*dImQ1n*dImQ3n 
5798                                      - dReQ3n*dReQ9n*dImQ1n*dImQ5n-dReQ1n*dReQ9n*dImQ3n*dImQ5n 
5799                                      + dReQ3n*dReQ5n*dImQ1n*dImQ9n+dReQ1n*dReQ5n*dImQ3n*dImQ9n 
5800                                      + dReQ1n*dReQ3n*dImQ5n*dImQ9n-dImQ1n*dImQ3n*dImQ5n*dImQ9n;
5801  Double_t reQ9nQ8nstarQ1nstar = dReQ9n*dReQ8n*dReQ1n-dReQ9n*dImQ8n*dImQ1n+dImQ9n*dReQ8n*dImQ1n
5802                               + dImQ9n*dImQ8n*dReQ1n; 
5803  // <5>_{6n,1n|4n,2n,1n}:
5804  Double_t reQ6nQ1nQ4nstarQ2nstarQ1nstar = (dReQ2n*dReQ4n*dReQ6n-dReQ6n*dImQ2n*dImQ4n 
5805                                         + dReQ4n*dImQ2n*dImQ6n+dReQ2n*dImQ4n*dImQ6n) 
5806                                         * (pow(dReQ1n,2.)+pow(dImQ1n,2.));
5807  // <5>_{6n,3n|4n,3n,2n}:
5808  Double_t reQ6nQ3nQ4nstarQ3nstarQ2nstar = (dReQ2n*dReQ4n*dReQ6n-dReQ6n*dImQ2n*dImQ4n 
5809                                         + dReQ4n*dImQ2n*dImQ6n+dReQ2n*dImQ4n*dImQ6n) 
5810                                         * (pow(dReQ3n,2.)+pow(dImQ3n,2.));
5811  Double_t reQ7nQ2nQ6nstarQ3nstar = dImQ3n*dImQ2n*dImQ7n*dImQ6n+dImQ7n*dImQ6n*dReQ3n*dReQ2n 
5812                                  + dImQ2n*dImQ6n*dReQ3n*dReQ7n-dImQ3n*dImQ6n*dReQ2n*dReQ7n
5813                                  - dImQ2n*dImQ7n*dReQ3n*dReQ6n+dImQ3n*dImQ7n*dReQ2n*dReQ6n 
5814                                  + dImQ3n*dImQ2n*dReQ7n*dReQ6n+dReQ3n*dReQ2n*dReQ7n*dReQ6n;                      
5815  // <5>_{6n,2n|5n,2n,1n}:
5816  Double_t reQ6nQ2nQ5nstarQ2nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
5817                                         * (dReQ1n*dReQ5n*dReQ6n-dReQ6n*dImQ1n*dImQ5n 
5818                                         + dReQ5n*dImQ1n*dImQ6n+dReQ1n*dImQ5n*dImQ6n);
5819  // <5>_{6n,3n|5n,3n,1n}:
5820  Double_t reQ6nQ3nQ5nstarQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))
5821                                         * (dReQ1n*dReQ5n*dReQ6n-dReQ6n*dImQ1n*dImQ5n 
5822                                         + dReQ5n*dImQ1n*dImQ6n+dReQ1n*dImQ5n*dImQ6n);
5823  Double_t reQ8nQ1nQ6nstarQ3nstar = dImQ3n*dImQ1n*dImQ8n*dImQ6n+dImQ8n*dImQ6n*dReQ3n*dReQ1n 
5824                                  + dImQ1n*dImQ6n*dReQ3n*dReQ8n-dImQ3n*dImQ6n*dReQ1n*dReQ8n
5825                                  - dImQ1n*dImQ8n*dReQ3n*dReQ6n+dImQ3n*dImQ8n*dReQ1n*dReQ6n 
5826                                  + dImQ3n*dImQ1n*dReQ8n*dReQ6n+dReQ3n*dReQ1n*dReQ8n*dReQ6n;                      
5827  // <5>_{6n,4n|5n,4n,1n}:
5828  Double_t reQ6nQ4nQ5nstarQ4nstarQ1nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))
5829                                         * (dReQ1n*dReQ5n*dReQ6n-dReQ6n*dImQ1n*dImQ5n 
5830                                         + dReQ5n*dImQ1n*dImQ6n+dReQ1n*dImQ5n*dImQ6n);
5831  Double_t reQ6nQ4nQ5nstarQ5nstar = dReQ4n*pow(dReQ5n,2.)*dReQ6n+2.*dReQ5n*dReQ6n*dImQ4n*dImQ5n 
5832                                  - dReQ4n*dReQ6n*pow(dImQ5n,2.)-pow(dReQ5n,2.)*dImQ4n*dImQ6n
5833                                  + 2.*dReQ4n*dReQ5n*dImQ5n*dImQ6n+dImQ4n*pow(dImQ5n,2.)*dImQ6n;
5834  Double_t reQ9nQ1nQ6nstarQ4nstar = dImQ4n*dImQ1n*dImQ9n*dImQ6n+dImQ9n*dImQ6n*dReQ4n*dReQ1n 
5835                                  + dImQ1n*dImQ6n*dReQ4n*dReQ9n-dImQ4n*dImQ6n*dReQ1n*dReQ9n
5836                                  - dImQ1n*dImQ9n*dReQ4n*dReQ6n+dImQ4n*dImQ9n*dReQ1n*dReQ6n 
5837                                  + dImQ4n*dImQ1n*dReQ9n*dReQ6n+dReQ4n*dReQ1n*dReQ9n*dReQ6n;
5838  Double_t reQ10nQ5nstarQ4nstarQ1nstar = dReQ1n*dReQ4n*dReQ5n*dReQ10n-dReQ5n*dReQ10n*dImQ1n*dImQ4n 
5839                                       - dReQ4n*dReQ10n*dImQ1n*dImQ5n-dReQ1n*dReQ10n*dImQ4n*dImQ5n 
5840                                       + dReQ4n*dReQ5n*dImQ1n*dImQ10n+dReQ1n*dReQ5n*dImQ4n*dImQ10n 
5841                                       + dReQ1n*dReQ4n*dImQ5n*dImQ10n-dImQ1n*dImQ4n*dImQ5n*dImQ10n;
5842  Double_t reQ10nQ9nstarQ1nstar = dReQ10n*dReQ9n*dReQ1n-dReQ10n*dImQ9n*dImQ1n+dImQ10n*dReQ9n*dImQ1n
5843                                + dImQ10n*dImQ9n*dReQ1n;
5844  Double_t reQ10nQ5nstarQ5nstar = pow(dReQ5n,2.)*dReQ10n-dReQ10n*pow(dImQ5n,2.)+2.*dReQ5n*dImQ5n*dImQ10n;
5845  // <5>_{6n,3n|6n,2n,1n}:
5846  Double_t reQ6nQ3nQ6nstarQ2nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n 
5847                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n) 
5848                                         * (pow(dReQ6n,2.)+pow(dImQ6n,2.));
5849  Double_t reQ9nQ6nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ6n*dReQ9n-dReQ6n*dReQ9n*dImQ1n*dImQ2n 
5850                                      - dReQ2n*dReQ9n*dImQ1n*dImQ6n-dReQ1n*dReQ9n*dImQ2n*dImQ6n 
5851                                      + dReQ2n*dReQ6n*dImQ1n*dImQ9n+dReQ1n*dReQ6n*dImQ2n*dImQ9n 
5852                                      + dReQ1n*dReQ2n*dImQ6n*dImQ9n-dImQ1n*dImQ2n*dImQ6n*dImQ9n;
5853  // <5>_{6n,4n|6n,3n,1n}:
5854  Double_t reQ6nQ4nQ6nstarQ3nstarQ1nstar = (dReQ1n*dReQ3n*dReQ4n-dReQ4n*dImQ1n*dImQ3n 
5855                                         + dReQ3n*dImQ1n*dImQ4n+dReQ1n*dImQ3n*dImQ4n) 
5856                                         * (pow(dReQ6n,2.)+pow(dImQ6n,2.));
5857  Double_t reQ10nQ6nstarQ3nstarQ1nstar = dReQ1n*dReQ3n*dReQ6n*dReQ10n-dReQ6n*dReQ10n*dImQ1n*dImQ3n 
5858                                       - dReQ3n*dReQ10n*dImQ1n*dImQ6n-dReQ1n*dReQ10n*dImQ3n*dImQ6n 
5859                                       + dReQ3n*dReQ6n*dImQ1n*dImQ10n+dReQ1n*dReQ6n*dImQ3n*dImQ10n 
5860                                       + dReQ1n*dReQ3n*dImQ6n*dImQ10n-dImQ1n*dImQ3n*dImQ6n*dImQ10n;
5861  // <5>_{6n,5n|5n,4n,2n}:
5862  Double_t reQ6nQ5nQ5nstarQ4nstarQ2nstar = (dReQ2n*dReQ4n*dReQ6n-dReQ6n*dImQ2n*dImQ4n 
5863                                         + dReQ4n*dImQ2n*dImQ6n+dReQ2n*dImQ4n*dImQ6n) 
5864                                         * (pow(dReQ5n,2.)+pow(dImQ5n,2.));
5865  Double_t reQ7nQ4nQ6nstarQ5nstar = dImQ5n*dImQ4n*dImQ7n*dImQ6n+dImQ7n*dImQ6n*dReQ5n*dReQ4n 
5866                                  + dImQ4n*dImQ6n*dReQ5n*dReQ7n-dImQ5n*dImQ6n*dReQ4n*dReQ7n
5867                                  - dImQ4n*dImQ7n*dReQ5n*dReQ6n+dImQ5n*dImQ7n*dReQ4n*dReQ6n 
5868                                  + dImQ5n*dImQ4n*dReQ7n*dReQ6n+dReQ5n*dReQ4n*dReQ7n*dReQ6n;
5869  Double_t reQ9nQ2nQ6nstarQ5nstar = dImQ5n*dImQ2n*dImQ9n*dImQ6n+dImQ9n*dImQ6n*dReQ5n*dReQ2n 
5870                                  + dImQ2n*dImQ6n*dReQ5n*dReQ9n-dImQ5n*dImQ6n*dReQ2n*dReQ9n
5871                                  - dImQ2n*dImQ9n*dReQ5n*dReQ6n+dImQ5n*dImQ9n*dReQ2n*dReQ6n 
5872                                  + dImQ5n*dImQ2n*dReQ9n*dReQ6n+dReQ5n*dReQ2n*dReQ9n*dReQ6n;
5873  Double_t reQ11nQ5nstarQ4nstarQ2nstar = dReQ2n*dReQ4n*dReQ5n*dReQ11n-dReQ5n*dReQ11n*dImQ2n*dImQ4n 
5874                                       - dReQ4n*dReQ11n*dImQ2n*dImQ5n-dReQ2n*dReQ11n*dImQ4n*dImQ5n 
5875                                       + dReQ4n*dReQ5n*dImQ2n*dImQ11n+dReQ2n*dReQ5n*dImQ4n*dImQ11n 
5876                                       + dReQ2n*dReQ4n*dImQ5n*dImQ11n-dImQ2n*dImQ4n*dImQ5n*dImQ11n;
5877  Double_t reQ11nQ9nstarQ2nstar = dReQ11n*dReQ9n*dReQ2n-dReQ11n*dImQ9n*dImQ2n+dImQ11n*dReQ9n*dImQ2n
5878                                + dImQ11n*dImQ9n*dReQ2n;
5879  Double_t reQ11nQ7nstarQ4nstar = dReQ11n*dReQ7n*dReQ4n-dReQ11n*dImQ7n*dImQ4n+dImQ11n*dReQ7n*dImQ4n
5880                                + dImQ11n*dImQ7n*dReQ4n;
5881  // <5>_{6n,5n|6n,3n,2n}:
5882  Double_t reQ6nQ5nQ6nstarQ3nstarQ2nstar = (dReQ2n*dReQ3n*dReQ5n-dReQ5n*dImQ2n*dImQ3n 
5883                                         + dReQ3n*dImQ2n*dImQ5n+dReQ2n*dImQ3n*dImQ5n) 
5884                                         * (pow(dReQ6n,2.)+pow(dImQ6n,2.));
5885  Double_t reQ11nQ6nstarQ3nstarQ2nstar = dReQ2n*dReQ3n*dReQ6n*dReQ11n-dReQ6n*dReQ11n*dImQ2n*dImQ3n 
5886                                       - dReQ3n*dReQ11n*dImQ2n*dImQ6n-dReQ2n*dReQ11n*dImQ3n*dImQ6n 
5887                                       + dReQ3n*dReQ6n*dImQ2n*dImQ11n+dReQ2n*dReQ6n*dImQ3n*dImQ11n 
5888                                       + dReQ2n*dReQ3n*dImQ6n*dImQ11n-dImQ2n*dImQ3n*dImQ6n*dImQ11n;
5889  // <5>_{6n,5n|6n,4n,1n}:
5890  Double_t reQ6nQ5nQ6nstarQ4nstarQ1nstar = (dReQ1n*dReQ4n*dReQ5n-dReQ5n*dImQ1n*dImQ4n 
5891                                         + dReQ4n*dImQ1n*dImQ5n+dReQ1n*dImQ4n*dImQ5n) 
5892                                         * (pow(dReQ6n,2.)+pow(dImQ6n,2.));
5893  Double_t reQ10nQ1nQ6nstarQ5nstar = dImQ5n*dImQ1n*dImQ10n*dImQ6n+dImQ10n*dImQ6n*dReQ5n*dReQ1n 
5894                                   + dImQ1n*dImQ6n*dReQ5n*dReQ10n-dImQ5n*dImQ6n*dReQ1n*dReQ10n
5895                                   - dImQ1n*dImQ10n*dReQ5n*dReQ6n+dImQ5n*dImQ10n*dReQ1n*dReQ6n 
5896                                   + dImQ5n*dImQ1n*dReQ10n*dReQ6n+dReQ5n*dReQ1n*dReQ10n*dReQ6n;
5897  Double_t reQ11nQ10nstarQ1nstar = dReQ11n*dReQ10n*dReQ1n-dReQ11n*dImQ10n*dImQ1n+dImQ11n*dReQ10n*dImQ1n
5898                                 + dImQ11n*dImQ10n*dReQ1n;
5899  Double_t reQ11nQ6nstarQ4nstarQ1nstar = dReQ1n*dReQ4n*dReQ6n*dReQ11n-dReQ6n*dReQ11n*dImQ1n*dImQ4n 
5900                                       - dReQ4n*dReQ11n*dImQ1n*dImQ6n-dReQ1n*dReQ11n*dImQ4n*dImQ6n 
5901                                       + dReQ4n*dReQ6n*dImQ1n*dImQ11n+dReQ1n*dReQ6n*dImQ4n*dImQ11n 
5902                                       + dReQ1n*dReQ4n*dImQ6n*dImQ11n-dImQ1n*dImQ4n*dImQ6n*dImQ11n;
5903  // <5>_{4n,1n|3n,1n,1n}:
5904  Double_t reQ4nQ1nQ3nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
5905                                         * (dReQ1n*dReQ3n*dReQ4n-dReQ4n*dImQ1n*dImQ3n
5906                                         + dReQ3n*dImQ1n*dImQ4n+dReQ1n*dImQ3n*dImQ4n);
5907  Double_t reQ4nQ1nQ4nstarQ1nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
5908  Double_t reQ3nQ1nQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
5909  // <5>_{4n,3n|3n,3n,1n}:
5910  Double_t reQ4nQ3nQ3nstarQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))
5911                                         * (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)); 
5912  Double_t reQ7nQ3nstarQ3nstarQ1nstar = (dReQ7n*dReQ1n+dImQ7n*dImQ1n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
5913                                      + 2.*dReQ3n*dImQ3n*(dImQ7n*dReQ1n-dReQ7n*dImQ1n); 
5914  // <5>_{4n,4n|4n,3n,1n}:
5915  Double_t reQ4nQ4nQ4nstarQ3nstarQ1nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))
5916                                         * reQ4nQ3nstarQ1nstar;
5917  Double_t reQ7nQ1nQ4nstarQ4nstar = dReQ1n*pow(dReQ4n,2.)*dReQ7n+2.*dReQ4n*dReQ7n*dImQ1n*dImQ4n 
5918                                  - dReQ1n*dReQ7n*pow(dImQ4n,2.)-pow(dReQ4n,2.)*dImQ1n*dImQ7n
5919                                  + 2.*dReQ1n*dReQ4n*dImQ4n*dImQ7n+dImQ1n*pow(dImQ4n,2.)*dImQ7n;
5920  // <5>_{5n,2n|3n,2n,2n}:
5921  Double_t reQ5nQ2nQ3nstarQ2nstarQ2nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
5922                                         * reQ5nQ3nstarQ2nstar;
5923  // <5>_{5n,3n|3n,3n,2n}:
5924  Double_t reQ5nQ3nQ3nstarQ3nstarQ2nstar = (pow(dImQ3n,2.)+pow(dReQ3n,2.))
5925                                         * (dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n 
5926                                         - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n);
5927  Double_t reQ8nQ3nstarQ3nstarQ2nstar = (dReQ8n*dReQ2n+dImQ8n*dImQ2n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
5928                                      + 2.*dReQ3n*dImQ3n*(dImQ8n*dReQ2n-dReQ8n*dImQ2n);
5929  /*
5930  Double_t reQ5nQ1nQ3nstarQ2nstar = dImQ2n*dImQ1n*dImQ5n*dImQ3n+dImQ5n*dImQ3n*dReQ2n*dReQ1n 
5931                                  + dImQ1n*dImQ3n*dReQ2n*dReQ5n-dImQ2n*dImQ3n*dReQ1n*dReQ5n
5932                                  - dImQ1n*dImQ5n*dReQ2n*dReQ3n+dImQ2n*dImQ5n*dReQ1n*dReQ3n 
5933                                  + dImQ2n*dImQ1n*dReQ5n*dReQ3n+dReQ2n*dReQ1n*dReQ5n*dReQ3n;
5934  */
5935  // <5>_{5n,1n|4n,1n,1n}:
5936  Double_t reQ5nQ1nQ4nstarQ1nstarQ1nstar = (pow(dImQ1n,2.)+pow(dReQ1n,2.))
5937                                         * (dImQ1n*dImQ5n*dReQ4n+dImQ4n*dImQ5n*dReQ1n 
5938                                         - dImQ4n*dImQ1n*dReQ5n+dReQ4n*dReQ1n*dReQ5n);
5939  // <5>_{5n,4n|4n,4n,1n}:
5940  Double_t reQ5nQ4nQ4nstarQ4nstarQ1nstar = (pow(dImQ4n,2.)+pow(dReQ4n,2.))
5941                                         * (dImQ4n*dImQ5n*dReQ1n+dImQ1n*dImQ5n*dReQ4n 
5942                                         - dImQ1n*dImQ4n*dReQ5n+dReQ1n*dReQ4n*dReQ5n);
5943  Double_t reQ9nQ4nstarQ4nstarQ1nstar = (dReQ9n*dReQ1n+dImQ9n*dImQ1n)*(pow(dReQ4n,2)-pow(dImQ4n,2)) 
5944                                      + 2.*dReQ4n*dImQ4n*(dImQ9n*dReQ1n-dReQ9n*dImQ1n);
5945  // <5>_{5n,5n|5n,3n,2n}:
5946  Double_t reQ5nQ5nQ5nstarQ3nstarQ2nstar = (pow(dImQ5n,2.)+pow(dReQ5n,2.))
5947                                         * (dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n
5948                                         - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n);
5949  Double_t reQ7nQ3nQ5nstarQ5nstar = dReQ3n*pow(dReQ5n,2.)*dReQ7n+2.*dReQ5n*dReQ7n*dImQ3n*dImQ5n 
5950                                  - dReQ3n*dReQ7n*pow(dImQ5n,2.)-pow(dReQ5n,2.)*dImQ3n*dImQ7n
5951                                  + 2.*dReQ3n*dReQ5n*dImQ5n*dImQ7n+dImQ3n*pow(dImQ5n,2.)*dImQ7n;
5952  Double_t reQ8nQ2nQ5nstarQ5nstar = dReQ2n*pow(dReQ5n,2.)*dReQ8n+2.*dReQ5n*dReQ8n*dImQ2n*dImQ5n 
5953                                  - dReQ2n*dReQ8n*pow(dImQ5n,2.)-pow(dReQ5n,2.)*dImQ2n*dImQ8n
5954                                  + 2.*dReQ2n*dReQ5n*dImQ5n*dImQ8n+dImQ2n*pow(dImQ5n,2.)*dImQ8n;
5955  Double_t reQ10nQ5nstarQ3nstarQ2nstar = dReQ2n*dReQ3n*dReQ5n*dReQ10n-dReQ5n*dReQ10n*dImQ2n*dImQ3n 
5956                                       - dReQ3n*dReQ10n*dImQ2n*dImQ5n-dReQ2n*dReQ10n*dImQ3n*dImQ5n 
5957                                       + dReQ3n*dReQ5n*dImQ2n*dImQ10n+dReQ2n*dReQ5n*dImQ3n*dImQ10n 
5958                                       + dReQ2n*dReQ3n*dImQ5n*dImQ10n-dImQ2n*dImQ3n*dImQ5n*dImQ10n;
5959  Double_t reQ10nQ8nstarQ2nstar = dReQ10n*dReQ8n*dReQ2n-dReQ10n*dImQ8n*dImQ2n+dImQ10n*dReQ8n*dImQ2n
5960                                + dImQ10n*dImQ8n*dReQ2n;
5961  // <5>_{5n,5n|5n,4n,1n}:
5962  Double_t reQ5nQ5nQ5nstarQ4nstarQ1nstar = (pow(dImQ5n,2.)+pow(dReQ5n,2.))
5963                                         * (dImQ4n*dImQ5n*dReQ1n+dImQ1n*dImQ5n*dReQ4n
5964                                         - dImQ1n*dImQ4n*dReQ5n+dReQ1n*dReQ4n*dReQ5n);
5965  Double_t reQ9nQ1nQ5nstarQ5nstar = dReQ1n*pow(dReQ5n,2.)*dReQ9n+2.*dReQ5n*dReQ9n*dImQ1n*dImQ5n 
5966                                  - dReQ1n*dReQ9n*pow(dImQ5n,2.)-pow(dReQ5n,2.)*dImQ1n*dImQ9n
5967                                  + 2.*dReQ1n*dReQ5n*dImQ5n*dImQ9n+dImQ1n*pow(dImQ5n,2.)*dImQ9n;
5968  // <5>_{6n,1n|5n,1n,1n}:
5969  Double_t reQ6nQ1nQ5nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
5970                                         * (dReQ1n*dReQ5n*dReQ6n-dReQ6n*dImQ1n*dImQ5n
5971                                         + dReQ5n*dImQ1n*dImQ6n+dReQ1n*dImQ5n*dImQ6n);
5972  // <5>_{6n,5n|5n,5n,1n}:
5973  Double_t reQ6nQ5nQ5nstarQ5nstarQ1nstar = (pow(dImQ5n,2.)+pow(dReQ5n,2.))
5974                                         * (dImQ5n*dImQ6n*dReQ1n+dImQ1n*dImQ6n*dReQ5n 
5975                                         - dImQ1n*dImQ5n*dReQ6n+dReQ1n*dReQ5n*dReQ6n);
5976  Double_t reQ11nQ5nstarQ5nstarQ1nstar = (dReQ11n*dReQ1n+dImQ11n*dImQ1n)*(pow(dReQ5n,2)-pow(dImQ5n,2)) 
5977                                       + 2.*dReQ5n*dImQ5n*(dImQ11n*dReQ1n-dReQ11n*dImQ1n);
5978  // <5>_{6n,6n|6n,5n,1n}:
5979  Double_t reQ6nQ6nQ6nstarQ5nstarQ1nstar = (pow(dReQ6n,2.)+pow(dImQ6n,2.))
5980                                         * reQ6nQ5nstarQ1nstar;
5981  Double_t reQ7nQ5nQ6nstarQ6nstar = dReQ5n*pow(dReQ6n,2.)*dReQ7n+2.*dReQ6n*dReQ7n*dImQ5n*dImQ6n 
5982                                  - dReQ5n*dReQ7n*pow(dImQ6n,2.)-pow(dReQ6n,2.)*dImQ5n*dImQ7n
5983                                  + 2.*dReQ5n*dReQ6n*dImQ6n*dImQ7n+dImQ5n*pow(dImQ6n,2.)*dImQ7n;
5984  Double_t reQ11nQ1nQ6nstarQ6nstar = dReQ1n*pow(dReQ6n,2.)*dReQ11n+2.*dReQ6n*dReQ11n*dImQ1n*dImQ6n 
5985                                   - dReQ1n*dReQ11n*pow(dImQ6n,2.)-pow(dReQ6n,2.)*dImQ1n*dImQ11n
5986                                   + 2.*dReQ1n*dReQ6n*dImQ6n*dImQ11n+dImQ1n*pow(dImQ6n,2.)*dImQ11n;
5987  Double_t reQ12nQ6nstarQ6nstar = pow(dReQ6n,2.)*dReQ12n-dReQ12n*pow(dImQ6n,2.)+2.*dReQ6n*dImQ6n*dImQ12n;
5988  Double_t reQ12nQ11nstarQ1nstar = dReQ12n*dReQ11n*dReQ1n-dReQ12n*dImQ11n*dImQ1n+dImQ12n*dReQ11n*dImQ1n
5989                                 + dImQ12n*dImQ11n*dReQ1n;
5990  Double_t reQ12nQ6nstarQ5nstarQ1nstar = dReQ1n*dReQ5n*dReQ6n*dReQ12n-dReQ6n*dReQ12n*dImQ1n*dImQ5n 
5991                                       - dReQ5n*dReQ12n*dImQ1n*dImQ6n-dReQ1n*dReQ12n*dImQ5n*dImQ6n 
5992                                       + dReQ5n*dReQ6n*dImQ1n*dImQ12n+dReQ1n*dReQ6n*dImQ5n*dImQ12n 
5993                                       + dReQ1n*dReQ5n*dImQ6n*dImQ12n-dImQ1n*dImQ5n*dImQ6n*dImQ12n;
5994  Double_t reQ12nQ7nstarQ5nstar = dReQ12n*dReQ7n*dReQ5n-dReQ12n*dImQ7n*dImQ5n+dImQ12n*dReQ7n*dImQ5n
5995                                + dImQ12n*dImQ7n*dReQ5n;
5996  // <5>_{6n,2n|4n,3n,1n}:
5997  Double_t reQ6nQ2nQ4nstarQ3nstarQ1nstar = dReQ1n*dReQ2n*dReQ3n*dReQ4n*dReQ6n+dReQ3n*dReQ4n*dReQ6n*dImQ1n*dImQ2n 
5998                                         - dReQ2n*dReQ4n*dReQ6n*dImQ1n*dImQ3n+dReQ1n*dReQ4n*dReQ6n*dImQ2n*dImQ3n 
5999                                         - dReQ2n*dReQ3n*dReQ6n*dImQ1n*dImQ4n+dReQ1n*dReQ3n*dReQ6n*dImQ2n*dImQ4n
6000                                         - dReQ1n*dReQ2n*dReQ6n*dImQ3n*dImQ4n-dReQ6n*dImQ1n*dImQ2n*dImQ3n*dImQ4n 
6001                                         + dReQ2n*dReQ3n*dReQ4n*dImQ1n*dImQ6n-dReQ1n*dReQ3n*dReQ4n*dImQ2n*dImQ6n 
6002                                         + dReQ1n*dReQ2n*dReQ4n*dImQ3n*dImQ6n+dReQ4n*dImQ1n*dImQ2n*dImQ3n*dImQ6n 
6003                                         + dReQ1n*dReQ2n*dReQ3n*dImQ4n*dImQ6n+dReQ3n*dImQ1n*dImQ2n*dImQ4n*dImQ6n 
6004                                         - dReQ2n*dImQ1n*dImQ3n*dImQ4n*dImQ6n+dReQ1n*dImQ2n*dImQ3n*dImQ4n*dImQ6n;
6005  Double_t reQ6nQ2nQ4nstarQ4nstar = dReQ2n*pow(dReQ4n,2.)*dReQ6n+2.*dReQ4n*dReQ6n*dImQ2n*dImQ4n 
6006                                  - dReQ2n*dReQ6n*pow(dImQ4n,2.)-pow(dReQ4n,2.)*dImQ2n*dImQ6n
6007                                  + 2.*dReQ2n*dReQ4n*dImQ4n*dImQ6n+dImQ2n*pow(dImQ4n,2.)*dImQ6n;
6008  // <5>_{6n,2n,1n|5n,4n}:
6009  Double_t reQ6nQ2nQ1nQ5nstarQ4nstar = dReQ1n*dReQ2n*dReQ4n*dReQ6n*dReQ5n - dReQ4n*dReQ6n*dReQ5n*dImQ1n*dImQ2n 
6010                                     + dReQ2n*dReQ6n*dReQ5n*dImQ1n*dImQ4n + dReQ1n*dReQ6n*dReQ5n*dImQ2n*dImQ4n
6011                                     - dReQ2n*dReQ4n*dReQ5n*dImQ1n*dImQ6n - dReQ1n*dReQ4n*dReQ5n*dImQ2n*dImQ6n 
6012                                     + dReQ1n*dReQ2n*dReQ5n*dImQ4n*dImQ6n - dReQ5n*dImQ1n*dImQ2n*dImQ4n*dImQ6n 
6013                                     + dReQ2n*dReQ4n*dReQ6n*dImQ1n*dImQ5n + dReQ1n*dReQ4n*dReQ6n*dImQ2n*dImQ5n 
6014                                     - dReQ1n*dReQ2n*dReQ6n*dImQ4n*dImQ5n + dReQ6n*dImQ1n*dImQ2n*dImQ4n*dImQ5n 
6015                                     + dReQ1n*dReQ2n*dReQ4n*dImQ6n*dImQ5n - dReQ4n*dImQ1n*dImQ2n*dImQ6n*dImQ5n 
6016                                     + dReQ2n*dImQ1n*dImQ4n*dImQ6n*dImQ5n + dReQ1n*dImQ2n*dImQ4n*dImQ6n*dImQ5n;
6017
6018  // <5>_{6n,4n|5n,3n,2n}:
6019  Double_t reQ6nQ4nQ5nstarQ3nstarQ2nstar = dReQ2n*dReQ3n*dReQ4n*dReQ5n*dReQ6n - dReQ4n*dReQ5n*dReQ6n*dImQ2n*dImQ3n 
6020                                         + dReQ3n*dReQ5n*dReQ6n*dImQ2n*dImQ4n + dReQ2n*dReQ5n*dReQ6n*dImQ3n*dImQ4n
6021                                         - dReQ3n*dReQ4n*dReQ6n*dImQ2n*dImQ5n - dReQ2n*dReQ4n*dReQ6n*dImQ3n*dImQ5n 
6022                                         + dReQ2n*dReQ3n*dReQ6n*dImQ4n*dImQ5n - dReQ6n*dImQ2n*dImQ3n*dImQ4n*dImQ5n 
6023                                         + dReQ3n*dReQ4n*dReQ5n*dImQ2n*dImQ6n + dReQ2n*dReQ4n*dReQ5n*dImQ3n*dImQ6n 
6024                                         - dReQ2n*dReQ3n*dReQ5n*dImQ4n*dImQ6n + dReQ5n*dImQ2n*dImQ3n*dImQ4n*dImQ6n 
6025                                         + dReQ2n*dReQ3n*dReQ4n*dImQ5n*dImQ6n - dReQ4n*dImQ2n*dImQ3n*dImQ5n*dImQ6n 
6026                                         + dReQ3n*dImQ2n*dImQ4n*dImQ5n*dImQ6n + dReQ2n*dImQ3n*dImQ4n*dImQ5n*dImQ6n;
6027  Double_t reQ8nQ2nQ6nstarQ4nstar = dImQ4n*dImQ2n*dImQ8n*dImQ6n+dImQ8n*dImQ6n*dReQ4n*dReQ2n 
6028                                  + dImQ2n*dImQ6n*dReQ4n*dReQ8n-dImQ4n*dImQ6n*dReQ2n*dReQ8n
6029                                  - dImQ2n*dImQ8n*dReQ4n*dReQ6n+dImQ4n*dImQ8n*dReQ2n*dReQ6n 
6030                                  + dImQ4n*dImQ2n*dReQ8n*dReQ6n+dReQ4n*dReQ2n*dReQ8n*dReQ6n;
6031
6032  // <5>_{4n,4n|3n,3n,2n}:
6033  Double_t reQ4nQ4nQ3nstarQ3nstarQ2nstar = dReQ2n*pow(dReQ3n,2.)*pow(dReQ4n,2.)-2.*dReQ3n*pow(dReQ4n,2.)*dImQ2n*dImQ3n 
6034                                         - dReQ2n*pow(dReQ4n,2.)*pow(dImQ3n,2.)+2.*pow(dReQ3n,2.)*dReQ4n*dImQ2n*dImQ4n 
6035                                         + 4.*dReQ2n*dReQ3n*dReQ4n*dImQ3n*dImQ4n - 2.*dReQ4n*dImQ2n*pow(dImQ3n,2.)*dImQ4n
6036                                         - dReQ2n*pow(dReQ3n,2.)*pow(dImQ4n,2.) + 2.*dReQ3n*dImQ2n*dImQ3n*pow(dImQ4n,2.) 
6037                                         + dReQ2n*pow(dImQ3n,2.)*pow(dImQ4n,2.);
6038
6039  // <5>_{5n|2n,1n,1n,1n}:
6040  Double_t reQ5nQ2nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,3.)*dReQ2n*dReQ5n-3.*dReQ1n*dReQ2n*dReQ5n*pow(dImQ1n,2.) 
6041                                             - 3.*pow(dReQ1n,2.)*dReQ5n*dImQ1n*dImQ2n+dReQ5n*pow(dImQ1n,3.)*dImQ2n 
6042                                             + 3.*pow(dReQ1n,2.)*dReQ2n*dImQ1n*dImQ5n-dReQ2n*pow(dImQ1n,3.)*dImQ5n
6043                                             + pow(dReQ1n,3.)*dImQ2n*dImQ5n-3.*dReQ1n*pow(dImQ1n,2.)*dImQ2n*dImQ5n;
6044
6045  // <5>_{5n,1n|2n,2n,2n}:
6046  Double_t reQ5nQ1nQ2nstarQ2nstarQ2nstar = dReQ1n*pow(dReQ2n,3.)*dReQ5n+3.*pow(dReQ2n,2.)*dReQ5n*dImQ1n*dImQ2n
6047                                         - 3.*dReQ1n*dReQ2n*dReQ5n*pow(dImQ2n,2.)-dReQ5n*dImQ1n*pow(dImQ2n,3.) 
6048                                         - pow(dReQ2n,3.)*dImQ1n*dImQ5n+3.*dReQ1n*pow(dReQ2n,2.)*dImQ2n*dImQ5n 
6049                                         + 3.*dReQ2n*dImQ1n*pow(dImQ2n,2.)*dImQ5n-dReQ1n*pow(dImQ2n,3.)*dImQ5n;
6050
6051
6052  // <5>_{5n,4n|3n,3n,3n}:
6053  Double_t reQ5nQ4nQ3nstarQ3nstarQ3nstar = dReQ4n*pow(dReQ3n,3.)*dReQ5n+3.*pow(dReQ3n,2.)*dReQ5n*dImQ4n*dImQ3n
6054                                         - 3.*dReQ4n*dReQ3n*dReQ5n*pow(dImQ3n,2.)-dReQ5n*dImQ4n*pow(dImQ3n,3.) 
6055                                         - pow(dReQ3n,3.)*dImQ4n*dImQ5n+3.*dReQ4n*pow(dReQ3n,2.)*dImQ3n*dImQ5n 
6056                                         + 3.*dReQ3n*dImQ4n*pow(dImQ3n,2.)*dImQ5n-dReQ4n*pow(dImQ3n,3.)*dImQ5n;
6057
6058  Double_t reQ9nQ3nstarQ3nstarQ3nstar = dReQ9n*pow(dReQ3n,3)-3.*dReQ3n*dReQ9n*pow(dImQ3n,2)
6059                                      + 3.*dImQ3n*dImQ9n*pow(dReQ3n,2)-dImQ9n*pow(dImQ3n,3); 
6060  // <5>_{5n,5n|4n,3n,3n}:
6061  Double_t reQ5nQ5nQ4nstarQ3nstarQ3nstar = dReQ4n*pow(dReQ3n,2.)*pow(dReQ5n,2.) - 2.*dReQ3n*pow(dReQ5n,2.)*dImQ4n*dImQ3n
6062                                         - dReQ4n*pow(dReQ5n,2.)*pow(dImQ3n,2.) + 2.*pow(dReQ3n,2.)*dReQ5n*dImQ4n*dImQ5n 
6063                                         + 4.*dReQ4n*dReQ3n*dReQ5n*dImQ3n*dImQ5n - 2.*dReQ5n*dImQ4n*pow(dImQ3n,2.)*dImQ5n
6064                                         - dReQ4n*pow(dReQ3n,2.)*pow(dImQ5n,2.) + 2.*dReQ3n*dImQ4n*dImQ3n*pow(dImQ5n,2.) 
6065                                         + dReQ4n*pow(dImQ3n,2.)*pow(dImQ5n,2.);
6066
6067  // <5>_{5n,5n|4n,4n,2n}:   
6068  Double_t reQ5nQ5nQ4nstarQ4nstarQ2nstar = dReQ2n*pow(dReQ4n,2.)*pow(dReQ5n,2.) - 2.*dReQ4n*pow(dReQ5n,2.)*dImQ2n*dImQ4n
6069                                         - dReQ2n*pow(dReQ5n,2.)*pow(dImQ4n,2.) + 2.*pow(dReQ4n,2.)*dReQ5n*dImQ2n*dImQ5n 
6070                                         + 4.*dReQ2n*dReQ4n*dReQ5n*dImQ4n*dImQ5n - 2.*dReQ5n*dImQ2n*pow(dImQ4n,2.)*dImQ5n
6071                                         - dReQ2n*pow(dReQ4n,2.)*pow(dImQ5n,2.) + 2.*dReQ4n*dImQ2n*dImQ4n*pow(dImQ5n,2.) 
6072                                         + dReQ2n*pow(dImQ4n,2.)*pow(dImQ5n,2.);
6073  Double_t reQ10nQ4nstarQ4nstarQ2nstar = (dReQ10n*dReQ2n+dImQ10n*dImQ2n)*(pow(dReQ4n,2)-pow(dImQ4n,2)) 
6074                                       + 2.*dReQ4n*dImQ4n*(dImQ10n*dReQ2n-dReQ10n*dImQ2n);
6075  // <5>_{6n|3n,1n,1n,1n}:
6076  Double_t reQ6nQ3nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,3.)*dReQ3n*dReQ6n-3.*dReQ1n*dReQ3n*dReQ6n*pow(dImQ1n,2.) 
6077                                             - 3.*pow(dReQ1n,2.)*dReQ6n*dImQ1n*dImQ3n+dReQ6n*pow(dImQ1n,3.)*dImQ3n 
6078                                             + 3.*pow(dReQ1n,2.)*dReQ3n*dImQ1n*dImQ6n-dReQ3n*pow(dImQ1n,3.)*dImQ6n
6079                                             + pow(dReQ1n,3.)*dImQ3n*dImQ6n-3.*dReQ1n*pow(dImQ1n,2.)*dImQ3n*dImQ6n;
6080  // <5>_{6n,1n,1n|4n,4n}:
6081  Double_t reQ6nQ1nQ1nQ4nstarQ4nstar = pow(dReQ1n,2.)*pow(dReQ4n,2.)*dReQ6n - pow(dReQ4n,2.)*dReQ6n*pow(dImQ1n,2.)
6082                                     + 4.*dReQ1n*dReQ4n*dReQ6n*dImQ1n*dImQ4n - pow(dReQ1n,2.)*dReQ6n*pow(dImQ4n,2.)
6083                                     + dReQ6n*pow(dImQ1n,2.)*pow(dImQ4n,2.) - 2.*dReQ1n*pow(dReQ4n,2.)*dImQ1n*dImQ6n 
6084                                     + 2.*pow(dReQ1n,2.)*dReQ4n*dImQ4n*dImQ6n - 2.*dReQ4n*pow(dImQ1n,2.)*dImQ4n*dImQ6n
6085                                     + 2.*dReQ1n*dImQ1n*pow(dImQ4n,2.)*dImQ6n;
6086
6087
6088  // <5>_{6n,2n,2n|5n,5n}:
6089  Double_t reQ6nQ2nQ2nQ5nstarQ5nstar = pow(dReQ2n,2.)*pow(dReQ5n,2.)*dReQ6n - pow(dReQ5n,2.)*dReQ6n*pow(dImQ2n,2.)
6090                                     + 4.*dReQ2n*dReQ5n*dReQ6n*dImQ2n*dImQ5n - pow(dReQ2n,2.)*dReQ6n*pow(dImQ5n,2.)
6091                                     + dReQ6n*pow(dImQ2n,2.)*pow(dImQ5n,2.) - 2.*dReQ2n*pow(dReQ5n,2.)*dImQ2n*dImQ6n 
6092                                     + 2.*pow(dReQ2n,2.)*dReQ5n*dImQ5n*dImQ6n - 2.*dReQ5n*pow(dImQ2n,2.)*dImQ5n*dImQ6n
6093                                     + 2.*dReQ2n*dImQ2n*pow(dImQ5n,2.)*dImQ6n;
6094  Double_t reQ10nQ6nstarQ2nstarQ2nstar = (dReQ10n*dReQ6n+dImQ10n*dImQ6n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
6095                                       + 2.*dReQ2n*dImQ2n*(dImQ10n*dReQ6n-dReQ10n*dImQ6n);
6096  // <5>_{6n,6n|5n,5n,2n}:
6097  Double_t reQ6nQ6nQ5nstarQ5nstarQ2nstar = dReQ2n*pow(dReQ5n,2.)*pow(dReQ6n,2.) - 2.*dReQ5n*pow(dReQ6n,2.)*dImQ2n*dImQ5n
6098                                         - dReQ2n*pow(dReQ6n,2.)*pow(dImQ5n,2.) + 2.*pow(dReQ5n,2.)*dReQ6n*dImQ2n*dImQ6n 
6099                                         + 4.*dReQ2n*dReQ5n*dReQ6n*dImQ5n*dImQ6n - 2.*dReQ6n*dImQ2n*pow(dImQ5n,2.)*dImQ6n
6100                                         - dReQ2n*pow(dReQ5n,2.)*pow(dImQ6n,2.) + 2.*dReQ5n*dImQ2n*dImQ5n*pow(dImQ6n,2.) 
6101                                         + dReQ2n*pow(dImQ5n,2.)*pow(dImQ6n,2.);
6102  Double_t reQ10nQ2nQ6nstarQ6nstar = dImQ2n*pow(dImQ6n,2.)*dImQ10n+2.*dImQ6n*dImQ10n*dReQ2n*dReQ6n
6103                                   - dImQ2n*dImQ10n*pow(dReQ6n,2.)-pow(dImQ6n,2.)*dReQ2n*dReQ10n 
6104                                   + 2.*dImQ2n*dImQ6n*dReQ6n*dReQ10n+dReQ2n*pow(dReQ6n,2.)*dReQ10n;
6105  Double_t reQ12nQ5nstarQ5nstarQ2nstar = (dReQ12n*dReQ2n+dImQ12n*dImQ2n)*(pow(dReQ5n,2)-pow(dImQ5n,2)) 
6106                                       + 2.*dReQ5n*dImQ5n*(dImQ12n*dReQ2n-dReQ12n*dImQ2n);
6107  Double_t reQ12nQ10nstarQ2nstar = dReQ12n*dReQ10n*dReQ2n-dReQ12n*dImQ10n*dImQ2n+dImQ12n*dReQ10n*dImQ2n
6108                                 + dImQ12n*dImQ10n*dReQ2n;
6109  // <5>_{5n,2n|3n,3n,1n}: 
6110  Double_t reQ5nQ2nQ3nstarQ3nstarQ1nstar = dReQ1n*dReQ2n*pow(dReQ3n,2.)*dReQ5n + pow(dReQ3n,2.)*dReQ5n*dImQ1n*dImQ2n 
6111                                         - 2.*dReQ2n*dReQ3n*dReQ5n*dImQ1n*dImQ3n + 2.*dReQ1n*dReQ3n*dReQ5n*dImQ2n*dImQ3n 
6112                                         - dReQ1n*dReQ2n*dReQ5n*pow(dImQ3n,2.) - dReQ5n*dImQ1n*dImQ2n*pow(dImQ3n,2.) 
6113                                         + dReQ2n*pow(dReQ3n,2.)*dImQ1n*dImQ5n - dReQ1n*pow(dReQ3n,2.)*dImQ2n*dImQ5n
6114                                         + 2.*dReQ1n*dReQ2n*dReQ3n*dImQ3n*dImQ5n + 2.*dReQ3n*dImQ1n*dImQ2n*dImQ3n*dImQ5n
6115                                         - dReQ2n*dImQ1n*pow(dImQ3n,2.)*dImQ5n + dReQ1n*dImQ2n*pow(dImQ3n,2.)*dImQ5n;
6116  // <5>_{5n,1n,1n|4n,3n}:
6117  Double_t reQ5nQ1nQ1nQ4nstarQ3nstar = pow(dReQ1n,2.)*dReQ3n*dReQ4n*dReQ5n - dReQ3n*dReQ4n*dReQ5n*pow(dImQ1n,2.)
6118                                     + 2.*dReQ1n*dReQ4n*dReQ5n*dImQ1n*dImQ3n + 2.*dReQ1n*dReQ3n*dReQ5n*dImQ1n*dImQ4n
6119                                     - pow(dReQ1n,2.)*dReQ5n*dImQ3n*dImQ4n + dReQ5n*pow(dImQ1n,2.)*dImQ3n*dImQ4n
6120                                     - 2.*dReQ1n*dReQ3n*dReQ4n*dImQ1n*dImQ5n + pow(dReQ1n,2.)*dReQ4n*dImQ3n*dImQ5n
6121                                     - dReQ4n*pow(dImQ1n,2.)*dImQ3n*dImQ5n + pow(dReQ1n,2.)*dReQ3n*dImQ4n*dImQ5n
6122                                     - dReQ3n*pow(dImQ1n,2.)*dImQ4n*dImQ5n + 2.*dReQ1n*dImQ1n*dImQ3n*dImQ4n*dImQ5n;
6123  // <5>_{5n,3n|4n,2n,2n}:
6124  Double_t reQ5nQ3nQ4nstarQ2nstarQ2nstar = dReQ4n*dReQ3n*pow(dReQ2n,2.)*dReQ5n + pow(dReQ2n,2.)*dReQ5n*dImQ4n*dImQ3n 
6125                                         - 2.*dReQ3n*dReQ2n*dReQ5n*dImQ4n*dImQ2n + 2.*dReQ4n*dReQ2n*dReQ5n*dImQ3n*dImQ2n 
6126                                         - dReQ4n*dReQ3n*dReQ5n*pow(dImQ2n,2.) - dReQ5n*dImQ4n*dImQ3n*pow(dImQ2n,2.) 
6127                                         + dReQ3n*pow(dReQ2n,2.)*dImQ4n*dImQ5n - dReQ4n*pow(dReQ2n,2.)*dImQ3n*dImQ5n
6128                                         + 2.*dReQ4n*dReQ3n*dReQ2n*dImQ2n*dImQ5n + 2.*dReQ2n*dImQ4n*dImQ3n*dImQ2n*dImQ5n
6129                                         - dReQ3n*dImQ4n*pow(dImQ2n,2.)*dImQ5n + dReQ4n*dImQ3n*pow(dImQ2n,2.)*dImQ5n;
6130  Double_t reQ8nQ4nstarQ2nstarQ2nstar = (dReQ8n*dReQ4n+dImQ8n*dImQ4n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
6131                                      + 2.*dReQ2n*dImQ2n*(dImQ8n*dReQ4n-dReQ8n*dImQ4n);
6132  // <5>_{5n,2n,1n|4n,4n}:
6133  Double_t reQ5nQ2nQ1nQ4nstarQ4nstar = dReQ1n*dReQ2n*pow(dReQ4n,2.)*dReQ5n - pow(dReQ4n,2.)*dReQ5n*dImQ1n*dImQ2n
6134                                     + 2.*dReQ2n*dReQ4n*dReQ5n*dImQ1n*dImQ4n + 2.*dReQ1n*dReQ4n*dReQ5n*dImQ2n*dImQ4n
6135                                     - dReQ1n*dReQ2n*dReQ5n*pow(dImQ4n,2.) + dReQ5n*dImQ1n*dImQ2n*pow(dImQ4n,2.)
6136                                     - dReQ2n*pow(dReQ4n,2.)*dImQ1n*dImQ5n - dReQ1n*pow(dReQ4n,2.)*dImQ2n*dImQ5n
6137                                     + 2.*dReQ1n*dReQ2n*dReQ4n*dImQ4n*dImQ5n - 2.*dReQ4n*dImQ1n*dImQ2n*dImQ4n*dImQ5n
6138                                     + dReQ2n*dImQ1n*pow(dImQ4n,2.)*dImQ5n + dReQ1n*dImQ2n*pow(dImQ4n,2.)*dImQ5n;
6139  // <5>_{6n,1n|3n,2n,2n}:
6140  Double_t reQ6nQ1nQ3nstarQ2nstarQ2nstar = dReQ3n*dReQ1n*pow(dReQ2n,2.)*dReQ6n + pow(dReQ2n,2.)*dReQ6n*dImQ3n*dImQ1n 
6141                                         - 2.*dReQ1n*dReQ2n*dReQ6n*dImQ3n*dImQ2n + 2.*dReQ3n*dReQ2n*dReQ6n*dImQ1n*dImQ2n 
6142                                         - dReQ3n*dReQ1n*dReQ6n*pow(dImQ2n,2.) - dReQ6n*dImQ3n*dImQ1n*pow(dImQ2n,2.) 
6143                                         + dReQ1n*pow(dReQ2n,2.)*dImQ3n*dImQ6n - dReQ3n*pow(dReQ2n,2.)*dImQ1n*dImQ6n
6144                                         + 2.*dReQ3n*dReQ1n*dReQ2n*dImQ2n*dImQ6n + 2.*dReQ2n*dImQ3n*dImQ1n*dImQ2n*dImQ6n
6145                                         - dReQ1n*dImQ3n*pow(dImQ2n,2.)*dImQ6n + dReQ3n*dImQ1n*pow(dImQ2n,2.)*dImQ6n;
6146
6147  // <5>_{6n,3n|4n,4n,1n}:
6148  Double_t reQ6nQ3nQ4nstarQ4nstarQ1nstar = dReQ1n*dReQ3n*pow(dReQ4n,2.)*dReQ6n + pow(dReQ4n,2.)*dReQ6n*dImQ1n*dImQ3n 
6149                                         - 2.*dReQ3n*dReQ4n*dReQ6n*dImQ1n*dImQ4n + 2.*dReQ1n*dReQ4n*dReQ6n*dImQ3n*dImQ4n 
6150                                         - dReQ1n*dReQ3n*dReQ6n*pow(dImQ4n,2.) - dReQ6n*dImQ1n*dImQ3n*pow(dImQ4n,2.) 
6151                                         + dReQ3n*pow(dReQ4n,2.)*dImQ1n*dImQ6n - dReQ1n*pow(dReQ4n,2.)*dImQ3n*dImQ6n
6152                                         + 2.*dReQ1n*dReQ3n*dReQ4n*dImQ4n*dImQ6n + 2.*dReQ4n*dImQ1n*dImQ3n*dImQ4n*dImQ6n
6153                                         - dReQ3n*dImQ1n*pow(dImQ4n,2.)*dImQ6n + dReQ1n*dImQ3n*pow(dImQ4n,2.)*dImQ6n;
6154
6155  // five6n1n1n5n3n = 0.; // <5>_{6n,1n,1n|5n,3n} = <cos(n(6*phi1+1*phi2+1*phi3-5*phi4-3*phi5))>
6156  Double_t reQ6nQ1nQ1nQ5nstarQ3nstar = pow(dReQ1n,2.)*dReQ3n*dReQ5n*dReQ6n - dReQ3n*dReQ5n*dReQ6n*pow(dImQ1n,2.)
6157                                     + 2.*dReQ1n*dReQ5n*dReQ6n*dImQ1n*dImQ3n + 2.*dReQ1n*dReQ3n*dReQ6n*dImQ1n*dImQ5n
6158                                     - pow(dReQ1n,2.)*dReQ6n*dImQ3n*dImQ5n + dReQ6n*pow(dImQ1n,2.)*dImQ3n*dImQ5n
6159                                     - 2.*dReQ1n*dReQ3n*dReQ5n*dImQ1n*dImQ6n + pow(dReQ1n,2.)*dReQ5n*dImQ3n*dImQ6n
6160                                     - dReQ5n*pow(dImQ1n,2.)*dImQ3n*dImQ6n + pow(dReQ1n,2.)*dReQ3n*dImQ5n*dImQ6n
6161                                     - dReQ3n*pow(dImQ1n,2.)*dImQ5n*dImQ6n + 2.*dReQ1n*dImQ1n*dImQ3n*dImQ5n*dImQ6n;
6162
6163  // <5>_{6n,3n|5n,2n,2n}:
6164  Double_t reQ6nQ3nQ5nstarQ2nstarQ2nstar = dReQ5n*dReQ3n*pow(dReQ2n,2.)*dReQ6n + pow(dReQ2n,2.)*dReQ6n*dImQ5n*dImQ3n 
6165                                         - 2.*dReQ3n*dReQ2n*dReQ6n*dImQ5n*dImQ2n + 2.*dReQ5n*dReQ2n*dReQ6n*dImQ3n*dImQ2n 
6166                                         - dReQ5n*dReQ3n*dReQ6n*pow(dImQ2n,2.) - dReQ6n*dImQ5n*dImQ3n*pow(dImQ2n,2.) 
6167                                         + dReQ3n*pow(dReQ2n,2.)*dImQ5n*dImQ6n - dReQ5n*pow(dReQ2n,2.)*dImQ3n*dImQ6n
6168                                         + 2.*dReQ5n*dReQ3n*dReQ2n*dImQ2n*dImQ6n + 2.*dReQ2n*dImQ5n*dImQ3n*dImQ2n*dImQ6n
6169                                         - dReQ3n*dImQ5n*pow(dImQ2n,2.)*dImQ6n + dReQ5n*dImQ3n*pow(dImQ2n,2.)*dImQ6n;
6170
6171  // <5>_{6n,5n|4n,4n,3n}:
6172  Double_t reQ6nQ5nQ4nstarQ4nstarQ3nstar = dReQ3n*dReQ5n*pow(dReQ4n,2.)*dReQ6n + pow(dReQ4n,2.)*dReQ6n*dImQ3n*dImQ5n 
6173                                         - 2.*dReQ5n*dReQ4n*dReQ6n*dImQ3n*dImQ4n + 2.*dReQ3n*dReQ4n*dReQ6n*dImQ5n*dImQ4n 
6174                                         - dReQ3n*dReQ5n*dReQ6n*pow(dImQ4n,2.) - dReQ6n*dImQ3n*dImQ5n*pow(dImQ4n,2.) 
6175                                         + dReQ5n*pow(dReQ4n,2.)*dImQ3n*dImQ6n - dReQ3n*pow(dReQ4n,2.)*dImQ5n*dImQ6n
6176                                         + 2.*dReQ3n*dReQ5n*dReQ4n*dImQ4n*dImQ6n + 2.*dReQ4n*dImQ3n*dImQ5n*dImQ4n*dImQ6n
6177                                         - dReQ5n*dImQ3n*pow(dImQ4n,2.)*dImQ6n + dReQ3n*dImQ5n*pow(dImQ4n,2.)*dImQ6n;
6178  Double_t reQ11nQ4nstarQ4nstarQ3nstar = (dReQ11n*dReQ3n+dImQ11n*dImQ3n)*(pow(dReQ4n,2)-pow(dImQ4n,2)) 
6179                                       + 2.*dReQ4n*dImQ4n*(dImQ11n*dReQ3n-dReQ11n*dImQ3n);
6180
6181  // <5>_{6n,3n,1n|5n,5n}:
6182  Double_t reQ6nQ3nQ1nQ5nstarQ5nstar = dReQ1n*dReQ3n*pow(dReQ5n,2.)*dReQ6n - pow(dReQ5n,2.)*dReQ6n*dImQ1n*dImQ3n
6183                                     + 2.*dReQ3n*dReQ5n*dReQ6n*dImQ1n*dImQ5n + 2.*dReQ1n*dReQ5n*dReQ6n*dImQ3n*dImQ5n
6184                                     - dReQ1n*dReQ3n*dReQ6n*pow(dImQ5n,2.) + dReQ6n*dImQ1n*dImQ3n*pow(dImQ5n,2.)
6185                                     - dReQ3n*pow(dReQ5n,2.)*dImQ1n*dImQ6n - dReQ1n*pow(dReQ5n,2.)*dImQ3n*dImQ6n
6186                                     + 2.*dReQ1n*dReQ3n*dReQ5n*dImQ5n*dImQ6n - 2.*dReQ5n*dImQ1n*dImQ3n*dImQ5n*dImQ6n
6187                                     + dReQ3n*dImQ1n*pow(dImQ5n,2.)*dImQ6n + dReQ1n*dImQ3n*pow(dImQ5n,2.)*dImQ6n;
6188
6189  // <5>_{6n,6n|5n,4n,3n}:
6190  Double_t reQ6nQ6nQ5nstarQ4nstarQ3nstar = dReQ3n*dReQ4n*dReQ5n*pow(dReQ6n,2.) - dReQ5n*pow(dReQ6n,2.)*dImQ3n*dImQ4n
6191                                         - dReQ4n*pow(dReQ6n,2.)*dImQ3n*dImQ5n - dReQ3n*pow(dReQ6n,2.)*dImQ4n*dImQ5n
6192                                         + 2.*dReQ4n*dReQ5n*dReQ6n*dImQ3n*dImQ6n + 2.*dReQ3n*dReQ5n*dReQ6n*dImQ4n*dImQ6n
6193                                         + 2.*dReQ3n*dReQ4n*dReQ6n*dImQ5n*dImQ6n - 2.*dReQ6n*dImQ3n*dImQ4n*dImQ5n*dImQ6n
6194                                         - dReQ3n*dReQ4n*dReQ5n*pow(dImQ6n,2.) + dReQ5n*dImQ3n*dImQ4n*pow(dImQ6n,2.)
6195                                         + dReQ4n*dImQ3n*dImQ5n*pow(dImQ6n,2.) + dReQ3n*dImQ4n*dImQ5n*pow(dImQ6n,2.);
6196
6197
6198  Double_t reQ8nQ4nQ6nstarQ6nstar = dImQ4n*pow(dImQ6n,2.)*dImQ8n+2.*dImQ6n*dImQ8n*dReQ4n*dReQ6n
6199                                  - dImQ4n*dImQ8n*pow(dReQ6n,2.)-pow(dImQ6n,2.)*dReQ4n*dReQ8n 
6200                                  + 2.*dImQ4n*dImQ6n*dReQ6n*dReQ8n+dReQ4n*pow(dReQ6n,2.)*dReQ8n;
6201
6202
6203  Double_t reQ9nQ3nQ6nstarQ6nstar = dImQ3n*pow(dImQ6n,2.)*dImQ9n+2.*dImQ6n*dImQ9n*dReQ3n*dReQ6n
6204                                  - dImQ3n*dImQ9n*pow(dReQ6n,2.)-pow(dImQ6n,2.)*dReQ3n*dReQ9n 
6205                                  + 2.*dImQ3n*dImQ6n*dReQ6n*dReQ9n+dReQ3n*pow(dReQ6n,2.)*dReQ9n;
6206
6207
6208  Double_t reQ12nQ5nstarQ4nstarQ3nstar = dReQ3n*dReQ5n*dReQ4n*dReQ12n-dReQ4n*dReQ12n*dImQ3n*dImQ5n 
6209                                       - dReQ5n*dReQ12n*dImQ3n*dImQ4n-dReQ3n*dReQ12n*dImQ5n*dImQ4n 
6210                                       + dReQ5n*dReQ4n*dImQ3n*dImQ12n+dReQ3n*dReQ4n*dImQ5n*dImQ12n 
6211                                       + dReQ3n*dReQ5n*dImQ4n*dImQ12n-dImQ3n*dImQ5n*dImQ4n*dImQ12n;
6212  Double_t reQ12nQ9nstarQ3nstar = dReQ12n*dReQ9n*dReQ3n-dReQ12n*dImQ9n*dImQ3n+dImQ12n*dReQ9n*dImQ3n
6213                                + dImQ12n*dImQ9n*dReQ3n;
6214  Double_t reQ12nQ8nstarQ4nstar = dReQ12n*dReQ8n*dReQ4n-dReQ12n*dImQ8n*dImQ4n+dImQ12n*dReQ8n*dImQ4n
6215                                + dImQ12n*dImQ8n*dReQ4n;
6216
6217    
6218   five4n3n3n2n2n = ((pow(dReQ3n,2.)+pow(dImQ3n,2.))
6219                  * (pow(dReQ2n,2.)*dReQ4n-pow(dImQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n)
6220                  - ((dReQ7n*dReQ3n+dImQ7n*dImQ3n)*(pow(dReQ2n,2.)-pow(dImQ2n,2.)) 
6221                  + 2.*dReQ2n*dImQ2n*(dImQ7n*dReQ3n-dReQ7n*dImQ3n))
6222                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
6223                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
6224                  - 2.*(dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
6225                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
6226                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
6227                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
6228                  - 2.*(dImQ2n*dImQ3n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ2n*dReQ3n 
6229                  + dImQ3n*dImQ5n*dReQ2n*dReQ4n-dImQ2n*dImQ5n*dReQ3n*dReQ4n
6230                  - dImQ3n*dImQ4n*dReQ2n*dReQ5n+dImQ2n*dImQ4n*dReQ3n*dReQ5n 
6231                  + dImQ2n*dImQ3n*dReQ4n*dReQ5n+dReQ2n*dReQ3n*dReQ4n*dReQ5n)
6232                  + 2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
6233                  + 1.*(dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
6234                  + 3.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
6235                  + 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
6236                  + 2.*(dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ5n*dImQ2n+dImQ7n*dImQ5n*dReQ2n)
6237                  + 2.*(dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
6238                  + 6.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6239                  + 6.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
6240                  - (dMult-6.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
6241                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6242                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6243                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6244                  - 4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6245                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6246                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6247                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6248                  + 2.*(dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6249                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6250                  - 2.*dMult*(dMult-12.)) 
6251                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6252   five4n2n4n1n1n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))
6253                  * (pow(dReQ1n,2.)*dReQ2n-pow(dImQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n)
6254                  - reQ6nQ4nstarQ1nstarQ1nstar
6255                  - reQ4nQ2nstarQ1nstarQ1nstar
6256                  - 2.*reQ4nQ1nQ3nstarQ2nstar
6257                  - 2.*reQ5nQ1nQ4nstarQ2nstar
6258                  + 2.*reQ3nQ2nstarQ1nstar
6259                  + reQ6nQ4nstarQ2nstar
6260                  + 3.*reQ4nQ2nstarQ2nstar
6261                  + 2.*reQ5nQ3nstarQ2nstar
6262                  + 2.*reQ6nQ5nstarQ1nstar
6263                  + 2.*reQ6nQ4nstarQ2nstar
6264                  + 6.*reQ4nQ3nstarQ1nstar
6265                  + 6.*reQ5nQ4nstarQ1nstar
6266                  - (dMult-6.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
6267                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6268                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6269                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6270                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6271                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6272                  + 2.*(dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6273                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
6274                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6275   // to be polished:
6276   five4n3n4n2n1n = (reQ4nQ3nQ4nstarQ2nstarQ1nstar
6277                  - reQ5nQ2nQ4nstarQ3nstar
6278                  - reQ6nQ1nQ4nstarQ3nstar
6279                  - reQ4nQ1nQ3nstarQ2nstar
6280                  - reQ7nQ4nstarQ2nstarQ1nstar
6281                  - reQ4nQ2nstarQ1nstarQ1nstar
6282                  - reQ4nQ2nQ3nstarQ3nstar
6283                  + reQ4nQ3nstarQ1nstar
6284                  + reQ7nQ4nstarQ3nstar
6285                  + 3.*reQ4nQ3nstarQ1nstar
6286                  + 2.*reQ7nQ4nstarQ3nstar
6287                  + reQ5nQ3nstarQ2nstar
6288                  + reQ7nQ5nstarQ2nstar
6289                  + reQ6nQ3nstarQ3nstar
6290                  + reQ4nQ3nstarQ1nstar
6291                  + reQ7nQ6nstarQ1nstar
6292                  + reQ2nQ1nstarQ1nstar
6293                  - (dMult-6.)*reQ3nQ2nstarQ1nstar
6294                  + 3.*reQ5nQ4nstarQ1nstar
6295                  + reQ4nQ3nstarQ1nstar
6296                  + 2.*reQ4nQ2nstarQ2nstar
6297                  + 3.*reQ6nQ4nstarQ2nstar
6298                  + reQ3nQ2nstarQ1nstar
6299                  + reQ4nQ2nstarQ2nstar
6300                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6301                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6302                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6303                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6304                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6305                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
6306                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6307                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6308                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6309                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6310                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6311                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6312                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
6313                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6314   five5n1n3n2n1n = ((pow(dImQ1n,2.)+pow(dReQ1n,2.))*(dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n 
6315                  - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n)
6316                  - (dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
6317                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
6318                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
6319                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
6320                  - (dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
6321                  + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
6322                  - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n 
6323                  + dImQ1n*dImQ2n*dReQ4n*dReQ5n+dReQ1n*dReQ2n*dReQ4n*dReQ5n)
6324                  - (dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
6325                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
6326                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n)
6327                  - (dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
6328                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
6329                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
6330                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
6331                  - (-pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
6332                  + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
6333                  - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n)
6334                  - (-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
6335                  + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
6336                  - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n)
6337                  + 3.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
6338                  + dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n
6339                  + pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n
6340                  + 4.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
6341                  - (dMult-7.)*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
6342                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
6343                  + pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n
6344                  + 6.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6345                  + 3.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
6346                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6347                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6348                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6349                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+(dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))  
6350                  - 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6351                  + (dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*(dMult-7.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6352                  - 2.*dMult*(dMult-12.))
6353                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
6354   // to be polished:
6355   five5n2n5n1n1n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))
6356                  * (pow(dReQ1n,2.)*dReQ2n-pow(dImQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n)
6357                  - reQ7nQ5nstarQ1nstarQ1nstar
6358                  - reQ5nQ3nstarQ1nstarQ1nstar
6359                  - 2.*reQ5nQ1nQ4nstarQ2nstar
6360                  - 2.*reQ6nQ1nQ5nstarQ2nstar
6361                  + 2.*reQ4nQ3nstarQ1nstar
6362                  + reQ7nQ5nstarQ2nstar
6363                  + 3.*reQ5nQ3nstarQ2nstar
6364                  + 2.*reQ6nQ4nstarQ2nstar
6365                  + 2.*reQ7nQ6nstarQ1nstar
6366                  + 2.*reQ7nQ5nstarQ2nstar
6367                  + 6.*reQ5nQ4nstarQ1nstar
6368                  + 6.*reQ6nQ5nstarQ1nstar
6369                  - (dMult-6.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
6370                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6371                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6372                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))-4.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6373                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6374                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6375                  + 2.*(dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6376                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
6377                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6378   // to be polished:
6379   five5n2n4n2n1n = (reQ5nQ2nQ4nstarQ2nstarQ1nstar
6380                  - reQ5nQ2nQ4nstarQ3nstar
6381                  - reQ6nQ1nQ5nstarQ2nstar
6382                  - reQ5nQ2nstarQ2nstarQ1nstar
6383                  - reQ7nQ4nstarQ2nstarQ1nstar
6384                  - reQ4nQ1nQ3nstarQ2nstar
6385                  - reQ5nQ1nQ4nstarQ2nstar
6386                  + reQ2nQ1nstarQ1nstar
6387                  + reQ7nQ5nstarQ2nstar
6388                  + 3.*reQ5nQ3nstarQ2nstar
6389                  + 2.*reQ7nQ5nstarQ2nstar
6390                  + reQ5nQ3nstarQ2nstar
6391                  + reQ7nQ4nstarQ3nstar
6392                  + reQ6nQ5nstarQ1nstar
6393                  + reQ2nQ1nstarQ1nstar
6394                  + reQ7nQ6nstarQ1nstar
6395                  + reQ3nQ2nstarQ1nstar
6396                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
6397                  + 3.*reQ3nQ2nstarQ1nstar
6398                  + reQ2nQ1nstarQ1nstar
6399                  + 2.*reQ4nQ2nstarQ2nstar
6400                  + 3.*reQ6nQ4nstarQ2nstar
6401                  + reQ4nQ3nstarQ1nstar
6402                  + reQ4nQ2nstarQ2nstar
6403                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6404                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6405                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6406                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6407                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6408                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6409                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6410                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6411                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6412                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6413                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6414                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6415                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.)) 
6416                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6417   // to be polished: 
6418   five5n3n4n3n1n = (reQ5nQ3nQ4nstarQ3nstarQ1nstar
6419                  - reQ5nQ3nQ4nstarQ4nstar
6420                  - reQ7nQ1nQ5nstarQ3nstar
6421                  - reQ5nQ3nstarQ1nstarQ1nstar
6422                  - reQ8nQ4nstarQ3nstarQ1nstar
6423                  - reQ4nQ1nQ3nstarQ2nstar
6424                  - reQ5nQ2nQ4nstarQ3nstar
6425                  + reQ3nQ2nstarQ1nstar
6426                  + reQ8nQ5nstarQ3nstar
6427                  + 3.*reQ5nQ3nstarQ2nstar
6428                  + 2.*reQ8nQ5nstarQ3nstar
6429                  + reQ5nQ4nstarQ1nstar
6430                  + reQ8nQ4nstarQ4nstar
6431                  + reQ7nQ5nstarQ2nstar
6432                  + reQ3nQ2nstarQ1nstar
6433                  + reQ8nQ7nstarQ1nstar
6434                  + reQ2nQ1nstarQ1nstar
6435                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
6436                  + 3.*reQ4nQ3nstarQ1nstar
6437                  + reQ3nQ2nstarQ1nstar
6438                  + 2.*reQ4nQ3nstarQ1nstar
6439                  + 3.*reQ7nQ4nstarQ3nstar
6440                  + reQ4nQ2nstarQ2nstar
6441                  + reQ4nQ3nstarQ1nstar
6442                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6443                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6444                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6445                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
6446                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6447                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6448                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6449                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6450                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6451                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6452                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6453                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6454                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
6455                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6456   // to be polished: 
6457   five5n4n4n3n2n = (reQ5nQ4nQ4nstarQ3nstarQ2nstar
6458                  - reQ6nQ3nQ5nstarQ4nstar
6459                  - reQ7nQ2nQ5nstarQ4nstar
6460                  - reQ5nQ1nQ4nstarQ2nstar
6461                  - reQ9nQ4nstarQ3nstarQ2nstar
6462                  - reQ4nQ1nQ3nstarQ2nstar
6463                  - reQ5nQ2nQ4nstarQ3nstar
6464                  + reQ4nQ2nstarQ2nstar
6465                  + reQ9nQ5nstarQ4nstar
6466                  + 3.*reQ5nQ4nstarQ1nstar
6467                  + 2.*reQ9nQ5nstarQ4nstar
6468                  + reQ6nQ5nstarQ1nstar
6469                  + reQ9nQ6nstarQ3nstar
6470                  + reQ7nQ5nstarQ2nstar
6471                  + reQ4nQ2nstarQ2nstar
6472                  + reQ9nQ7nstarQ2nstar
6473                  + reQ2nQ1nstarQ1nstar
6474                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
6475                  + 3.*reQ6nQ4nstarQ2nstar
6476                  + reQ4nQ2nstarQ2nstar
6477                  + 2.*reQ4nQ3nstarQ1nstar
6478                  + 3.*reQ7nQ4nstarQ3nstar
6479                  + reQ3nQ2nstarQ1nstar
6480                  + reQ4nQ3nstarQ1nstar
6481                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6482                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6483                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6484                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
6485                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6486                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6487                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6488                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6489                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6490                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6491                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6492                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6493                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
6494                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6495   // to be polished: 
6496   five5n3n5n2n1n = (reQ5nQ3nQ5nstarQ2nstarQ1nstar
6497                  - reQ6nQ2nQ5nstarQ3nstar
6498                  - reQ7nQ1nQ5nstarQ3nstar
6499                  - reQ5nQ1nQ3nstarQ3nstar
6500                  - reQ8nQ5nstarQ2nstarQ1nstar
6501                  - reQ5nQ2nstarQ2nstarQ1nstar
6502                  - reQ5nQ2nQ4nstarQ3nstar
6503                  + reQ5nQ4nstarQ1nstar
6504                  + reQ8nQ5nstarQ3nstar
6505                  + 3.*reQ5nQ3nstarQ2nstar
6506                  + 2.*reQ8nQ5nstarQ3nstar
6507                  + reQ6nQ3nstarQ3nstar
6508                  + reQ8nQ6nstarQ2nstar
6509                  + reQ7nQ4nstarQ3nstar
6510                  + reQ5nQ4nstarQ1nstar
6511                  + reQ8nQ7nstarQ1nstar
6512                  + reQ3nQ2nstarQ1nstar
6513                  - (dMult-6.)*reQ3nQ2nstarQ1nstar
6514                  + 3.*reQ6nQ5nstarQ1nstar
6515                  + reQ5nQ4nstarQ1nstar
6516                  + 2.*reQ5nQ3nstarQ2nstar
6517                  + 3.*reQ7nQ5nstarQ2nstar
6518                  + reQ4nQ2nstarQ2nstar
6519                  + reQ5nQ3nstarQ2nstar
6520                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6521                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6522                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6523                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
6524                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6525                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6526                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6527                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6528                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6529                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6530                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6531                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6532                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
6533                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6534   // to be polished:
6535   five5n4n5n2n2n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))
6536                  * (pow(dReQ2n,2.)*dReQ4n-pow(dImQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n)
6537                  - reQ9nQ5nstarQ2nstarQ2nstar
6538                  - reQ5nQ2nstarQ2nstarQ1nstar
6539                  - 2.*reQ5nQ2nQ4nstarQ3nstar
6540                  - 2.*reQ7nQ2nQ5nstarQ4nstar
6541                  + 2.*reQ3nQ2nstarQ1nstar
6542                  + reQ9nQ5nstarQ4nstar
6543                  + 3.*reQ5nQ4nstarQ1nstar
6544                  + 2.*reQ7nQ4nstarQ3nstar
6545                  + 2.*reQ9nQ7nstarQ2nstar
6546                  + 2.*reQ9nQ5nstarQ4nstar
6547                  + 6.*reQ5nQ3nstarQ2nstar
6548                  + 6.*reQ7nQ5nstarQ2nstar
6549                  - (dMult-6.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
6550                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6551                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6552                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))-4.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6553                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6554                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6555                  + 2.*(dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6556                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
6557                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6558   // to be polished:
6559   five5n4n5n3n1n = (reQ5nQ4nQ5nstarQ3nstarQ1nstar
6560                  - reQ6nQ3nQ5nstarQ4nstar
6561                  - reQ8nQ1nQ5nstarQ4nstar
6562                  - reQ5nQ1nQ4nstarQ2nstar
6563                  - reQ9nQ5nstarQ3nstarQ1nstar
6564                  - reQ5nQ3nstarQ1nstarQ1nstar
6565                  - reQ5nQ3nQ4nstarQ4nstar
6566                  + reQ5nQ4nstarQ1nstar
6567                  + reQ9nQ5nstarQ4nstar
6568                  + 3.*reQ5nQ4nstarQ1nstar
6569                  + 2.*reQ9nQ5nstarQ4nstar
6570                  + reQ6nQ4nstarQ2nstar
6571                  + reQ9nQ6nstarQ3nstar
6572                  + reQ8nQ4nstarQ4nstar
6573                  + reQ5nQ4nstarQ1nstar
6574                  + reQ9nQ8nstarQ1nstar
6575                  + reQ2nQ1nstarQ1nstar
6576                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
6577                  + 3.*reQ6nQ5nstarQ1nstar
6578                  + reQ5nQ4nstarQ1nstar
6579                  + 2.*reQ5nQ3nstarQ2nstar
6580                  + 3.*reQ8nQ5nstarQ3nstar
6581                  + reQ4nQ3nstarQ1nstar
6582                  + reQ5nQ3nstarQ2nstar
6583                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6584                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6585                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6586                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
6587                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6588                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6589                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6590                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
6591                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6592                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6593                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6594                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6595                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
6596                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
6597   five6n1n3n3n1n = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))
6598                  * (pow(dReQ3n,2.)*dReQ6n-pow(dImQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n)
6599                  - 2.*(dImQ1n*dImQ3n*dImQ4n*dImQ6n+dImQ4n*dImQ6n*dReQ1n*dReQ3n 
6600                  + dImQ3n*dImQ6n*dReQ1n*dReQ4n-dImQ1n*dImQ6n*dReQ3n*dReQ4n
6601                  - dImQ3n*dImQ4n*dReQ1n*dReQ6n+dImQ1n*dImQ4n*dReQ3n*dReQ6n 
6602                  + dImQ1n*dImQ3n*dReQ4n*dReQ6n+dReQ1n*dReQ3n*dReQ4n*dReQ6n)   
6603                  - 2.*(dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
6604                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
6605                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
6606                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
6607                  - (-pow(dImQ3n,2.)*dImQ1n*dImQ7n+dImQ1n*dImQ7n*pow(dReQ3n,2.)
6608                  + 2.*dImQ3n*dImQ7n*dReQ3n*dReQ1n-2.*dImQ3n*dImQ1n*dReQ3n*dReQ7n 
6609                  - pow(dImQ3n,2.)*dReQ1n*dReQ7n+pow(dReQ3n,2.)*dReQ1n*dReQ7n)
6610                  - ((pow(dReQ3n,2.)-pow(dImQ3n,2.))*(dReQ5n*dReQ1n-dImQ5n*dImQ1n) 
6611                  + 2.*dReQ3n*dImQ3n*(dReQ5n*dImQ1n+dImQ5n*dReQ1n))
6612                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6613                  + (dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
6614                  + 2.*(dReQ7n*dReQ3n*dReQ4n-dReQ7n*dImQ3n*dImQ4n+dImQ7n*dReQ3n*dImQ4n+dImQ7n*dImQ3n*dReQ4n)
6615                  + 2.*(dReQ6n*(dReQ4n*dReQ2n-dImQ4n*dImQ2n)+dImQ6n*(dReQ4n*dImQ2n+dImQ4n*dReQ2n))
6616                  + 3.*(dReQ6n*(dReQ5n*dReQ1n-dImQ5n*dImQ1n)+dImQ6n*(dReQ5n*dImQ1n+dImQ5n*dReQ1n))
6617                  + 4.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6618                  + 2.*(dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
6619                  + 6.*(dReQ4n*dReQ3n*dReQ1n-dReQ4n*dImQ3n*dImQ1n+dImQ4n*dReQ3n*dImQ1n+dImQ4n*dImQ3n*dReQ1n)
6620                  + 2.*(dReQ5n*dReQ3n*dReQ2n-dReQ5n*dImQ3n*dImQ2n+dImQ5n*dReQ3n*dImQ2n+dImQ5n*dImQ3n*dReQ2n)
6621                  - (dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
6622                  - 4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6623                  - 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6624                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6625                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6626                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6627                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+(dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6628                  + 2.*(dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.))
6629                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6630   five6n2n3n3n2n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))
6631                  * (pow(dReQ3n,2.)*dReQ6n-pow(dImQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n)
6632                  - 2.*(dImQ2n*dImQ3n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ2n*dReQ3n 
6633                  + dImQ3n*dImQ6n*dReQ2n*dReQ5n-dImQ2n*dImQ6n*dReQ3n*dReQ5n
6634                  - dImQ3n*dImQ5n*dReQ2n*dReQ6n+dImQ2n*dImQ5n*dReQ3n*dReQ6n 
6635                  + dImQ2n*dImQ3n*dReQ5n*dReQ6n+dReQ2n*dReQ3n*dReQ5n*dReQ6n) 
6636                  - 2.*(dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
6637                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
6638                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
6639                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
6640                  - (-pow(dImQ3n,2.)*dImQ2n*dImQ8n+dImQ2n*dImQ8n*pow(dReQ3n,2.)
6641                  + 2.*dImQ3n*dImQ8n*dReQ3n*dReQ2n-2.*dImQ3n*dImQ2n*dReQ3n*dReQ8n 
6642                  - pow(dImQ3n,2.)*dReQ2n*dReQ8n+pow(dReQ3n,2.)*dReQ2n*dReQ8n)
6643                  - ((pow(dReQ3n,2.)-pow(dImQ3n,2.))*(dReQ4n*dReQ2n-dImQ4n*dImQ2n) 
6644                  + 2.*dReQ3n*dImQ3n*(dReQ4n*dImQ2n+dImQ4n*dReQ2n))
6645                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6646                  + (dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n+dImQ8n*dImQ6n*dReQ2n)
6647                  + 2.*(dReQ8n*dReQ3n*dReQ5n-dReQ8n*dImQ3n*dImQ5n+dImQ8n*dReQ3n*dImQ5n+dImQ8n*dImQ3n*dReQ5n)
6648                  + 2.*(dReQ6n*(dReQ5n*dReQ1n-dImQ5n*dImQ1n)+dImQ6n*(dReQ5n*dImQ1n+dImQ5n*dReQ1n))
6649                  + 3.*(dReQ6n*(dReQ4n*dReQ2n-dImQ4n*dImQ2n)+dImQ6n*(dReQ4n*dImQ2n+dImQ4n*dReQ2n))
6650                  + 4.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6651                  + 2.*(dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n+dImQ8n*dImQ6n*dReQ2n)
6652                  + 6.*(dReQ5n*dReQ3n*dReQ2n-dReQ5n*dImQ3n*dImQ2n+dImQ5n*dReQ3n*dImQ2n+dImQ5n*dImQ3n*dReQ2n)
6653                  + 2.*(dReQ4n*dReQ3n*dReQ1n-dReQ4n*dImQ3n*dImQ1n+dImQ4n*dReQ3n*dImQ1n+dImQ4n*dImQ3n*dReQ1n)
6654                  - (dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
6655                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
6656                  - 4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6657                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6658                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6659                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6660                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6661                  + 2.*(dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.))
6662                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6663   // to be polished:
6664   five6n1n4n2n1n = (reQ6nQ1nQ4nstarQ2nstarQ1nstar
6665                  - reQ6nQ1nQ4nstarQ3nstar
6666                  - reQ6nQ1nQ5nstarQ2nstar
6667                  - reQ6nQ3nstarQ2nstarQ1nstar
6668                  - reQ7nQ4nstarQ2nstarQ1nstar
6669                  - reQ5nQ1nQ4nstarQ2nstar
6670                  - reQ6nQ4nstarQ1nstarQ1nstar
6671                  + reQ2nQ1nstarQ1nstar
6672                  + reQ7nQ6nstarQ1nstar
6673                  + 3.*reQ6nQ5nstarQ1nstar
6674                  + 2.*reQ7nQ6nstarQ1nstar
6675                  + reQ6nQ3nstarQ3nstar
6676                  + reQ7nQ4nstarQ3nstar
6677                  + reQ6nQ5nstarQ1nstar
6678                  + reQ2nQ1nstarQ1nstar
6679                  + reQ7nQ5nstarQ2nstar
6680                  + reQ5nQ3nstarQ2nstar
6681                  - (dMult-6.)*reQ6nQ4nstarQ2nstar
6682                  + 3.*reQ3nQ2nstarQ1nstar
6683                  + reQ2nQ1nstarQ1nstar
6684                  + 2.*reQ4nQ3nstarQ1nstar
6685                  + 3.*reQ5nQ4nstarQ1nstar
6686                  + reQ5nQ4nstarQ1nstar
6687                  + reQ4nQ3nstarQ1nstar
6688                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6689                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6690                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6691                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6692                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6693                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6694                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6695                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
6696                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6697                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6698                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6699                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6700                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.)) 
6701                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
6702   // to be polished: 
6703   five6n3n4n3n2n = (reQ6nQ3nQ4nstarQ3nstarQ2nstar
6704                  - reQ6nQ3nQ5nstarQ4nstar
6705                  - reQ7nQ2nQ6nstarQ3nstar
6706                  - reQ6nQ3nstarQ2nstarQ1nstar
6707                  - reQ9nQ4nstarQ3nstarQ2nstar
6708                  - reQ4nQ2nQ3nstarQ3nstar
6709                  - reQ6nQ1nQ4nstarQ3nstar
6710                  + reQ3nQ2nstarQ1nstar
6711                  + reQ9nQ6nstarQ3nstar
6712                  + 3.*reQ6nQ3nstarQ3nstar
6713                  + 2.*reQ9nQ6nstarQ3nstar
6714                  + reQ6nQ5nstarQ1nstar
6715                  + reQ9nQ5nstarQ4nstar
6716                  + reQ7nQ6nstarQ1nstar
6717                  + reQ3nQ2nstarQ1nstar
6718                  + reQ9nQ7nstarQ2nstar
6719                  + reQ3nQ2nstarQ1nstar
6720                  - (dMult-6.)*reQ6nQ4nstarQ2nstar
6721                  + 3.*reQ5nQ3nstarQ2nstar
6722                  + reQ3nQ2nstarQ1nstar
6723                  + 2.*reQ4nQ3nstarQ1nstar
6724                  + 3.*reQ7nQ4nstarQ3nstar
6725                  + reQ4nQ3nstarQ1nstar
6726                  + reQ4nQ3nstarQ1nstar
6727                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6728                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6729                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6730                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
6731                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6732                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
6733                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6734                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6735                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6736                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6737                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6738                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6739                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
6740                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6741   five6n4n4n3n3n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))
6742                  * (pow(dReQ3n,2.)*dReQ6n-pow(dImQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n)
6743                  - ((dReQ10n*dReQ4n+dImQ10n*dImQ4n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
6744                  + 2.*dReQ3n*dImQ3n*(dImQ10n*dReQ4n-dReQ10n*dImQ4n))
6745                  - ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
6746                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n)
6747                  - 2.*(dImQ1n*dImQ3n*dImQ4n*dImQ6n+dImQ4n*dImQ6n*dReQ1n*dReQ3n 
6748                  + dImQ3n*dImQ6n*dReQ1n*dReQ4n-dImQ1n*dImQ6n*dReQ3n*dReQ4n
6749                  - dImQ3n*dImQ4n*dReQ1n*dReQ6n+dImQ1n*dImQ4n*dReQ3n*dReQ6n 
6750                  + dImQ1n*dImQ3n*dReQ4n*dReQ6n+dReQ1n*dReQ3n*dReQ4n*dReQ6n)
6751                  - 2.*(dImQ3n*dImQ4n*dImQ6n*dImQ7n+dImQ6n*dImQ7n*dReQ3n*dReQ4n 
6752                  + dImQ4n*dImQ7n*dReQ3n*dReQ6n-dImQ3n*dImQ7n*dReQ4n*dReQ6n
6753                  - dImQ4n*dImQ6n*dReQ3n*dReQ7n+dImQ3n*dImQ6n*dReQ4n*dReQ7n 
6754                  + dImQ3n*dImQ4n*dReQ6n*dReQ7n+dReQ3n*dReQ4n*dReQ6n*dReQ7n)
6755                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6756                  + 1.*(dReQ10n*dReQ6n*dReQ4n-dReQ10n*dImQ6n*dImQ4n+dImQ10n*dReQ6n*dImQ4n+dImQ10n*dImQ6n*dReQ4n)
6757                  + 3.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
6758                  + 2.*(dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
6759                  + 2.*(dReQ10n*dReQ7n*dReQ3n-dReQ10n*dImQ7n*dImQ3n+dImQ10n*dReQ7n*dImQ3n+dImQ10n*dImQ7n*dReQ3n)
6760                  + 2.*(dReQ10n*dReQ6n*dReQ4n-dReQ10n*dImQ6n*dImQ4n+dImQ10n*dReQ6n*dImQ4n+dImQ10n*dImQ6n*dReQ4n)
6761                  + 6.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
6762                  + 6.*(dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
6763                  - (dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
6764                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6765                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6766                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))-4.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6767                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6768                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6769                  + 2.*(dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6770                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
6771                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6772   // to be polished:
6773   five6n2n5n2n1n = (reQ6nQ2nQ5nstarQ2nstarQ1nstar
6774                  - reQ6nQ2nQ5nstarQ3nstar
6775                  - reQ7nQ1nQ6nstarQ2nstar
6776                  - reQ6nQ3nstarQ2nstarQ1nstar
6777                  - reQ8nQ5nstarQ2nstarQ1nstar
6778                  - reQ5nQ1nQ4nstarQ2nstar
6779                  - reQ6nQ1nQ5nstarQ2nstar
6780                  + reQ2nQ1nstarQ1nstar
6781                  + reQ8nQ6nstarQ2nstar
6782                  + 3.*reQ6nQ4nstarQ2nstar
6783                  + 2.*reQ8nQ6nstarQ2nstar
6784                  + reQ6nQ3nstarQ3nstar
6785                  + reQ8nQ5nstarQ3nstar
6786                  + reQ7nQ6nstarQ1nstar
6787                  + reQ2nQ1nstarQ1nstar
6788                  + reQ8nQ7nstarQ1nstar
6789                  + reQ4nQ3nstarQ1nstar
6790                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
6791                  + 3.*reQ3nQ2nstarQ1nstar
6792                  + reQ2nQ1nstarQ1nstar
6793                  + 2.*reQ5nQ3nstarQ2nstar
6794                  + 3.*reQ7nQ5nstarQ2nstar
6795                  + reQ5nQ4nstarQ1nstar
6796                  + reQ5nQ3nstarQ2nstar
6797                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6798                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6799                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6800                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
6801                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6802                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6803                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6804                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6805                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6806                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6807                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6808                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6809                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.)) 
6810                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6811   // to be polished:
6812   five6n3n5n3n1n = (reQ6nQ3nQ5nstarQ3nstarQ1nstar
6813                  - reQ6nQ3nQ5nstarQ4nstar
6814                  - reQ8nQ1nQ6nstarQ3nstar
6815                  - reQ6nQ3nstarQ2nstarQ1nstar
6816                  - reQ9nQ5nstarQ3nstarQ1nstar
6817                  - reQ5nQ1nQ3nstarQ3nstar
6818                  - reQ6nQ2nQ5nstarQ3nstar
6819                  + reQ3nQ2nstarQ1nstar
6820                  + reQ9nQ6nstarQ3nstar
6821                  + 3.*reQ6nQ3nstarQ3nstar
6822                  + 2.*reQ9nQ6nstarQ3nstar
6823                  + reQ6nQ4nstarQ2nstar
6824                  + reQ9nQ5nstarQ4nstar
6825                  + reQ8nQ6nstarQ2nstar
6826                  + reQ3nQ2nstarQ1nstar
6827                  + reQ9nQ8nstarQ1nstar
6828                  + reQ3nQ2nstarQ1nstar
6829                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
6830                  + 3.*reQ4nQ3nstarQ1nstar
6831                  + reQ3nQ2nstarQ1nstar
6832                  + 2.*reQ5nQ3nstarQ2nstar
6833                  + 3.*reQ8nQ5nstarQ3nstar
6834                  + reQ5nQ3nstarQ2nstar
6835                  + reQ5nQ3nstarQ2nstar
6836                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6837                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6838                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6839                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
6840                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6841                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6842                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6843                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
6844                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6845                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6846                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6847                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6848                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
6849                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6850   // to be polished:
6851   five6n4n5n4n1n = (reQ6nQ4nQ5nstarQ4nstarQ1nstar
6852                  - reQ6nQ4nQ5nstarQ5nstar
6853                  - reQ9nQ1nQ6nstarQ4nstar
6854                  - reQ6nQ4nstarQ1nstarQ1nstar
6855                  - reQ10nQ5nstarQ4nstarQ1nstar
6856                  - reQ5nQ1nQ4nstarQ2nstar
6857                  - reQ6nQ3nQ5nstarQ4nstar
6858                  + reQ4nQ3nstarQ1nstar
6859                  + reQ10nQ6nstarQ4nstar
6860                  + 3.*reQ6nQ4nstarQ2nstar
6861                  + 2.*reQ10nQ6nstarQ4nstar
6862                  + reQ6nQ5nstarQ1nstar
6863                  + reQ10nQ5nstarQ5nstar
6864                  + reQ9nQ6nstarQ3nstar
6865                  + reQ4nQ3nstarQ1nstar
6866                  + reQ10nQ9nstarQ1nstar
6867                  + reQ2nQ1nstarQ1nstar
6868                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
6869                  + 3.*reQ5nQ4nstarQ1nstar
6870                  + reQ4nQ3nstarQ1nstar
6871                  + 2.*reQ5nQ4nstarQ1nstar
6872                  + 3.*reQ9nQ5nstarQ4nstar
6873                  + reQ5nQ3nstarQ2nstar
6874                  + reQ5nQ4nstarQ1nstar
6875                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6876                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6877                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6878                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
6879                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6880                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
6881                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6882                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
6883                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6884                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6885                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6886                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6887                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
6888                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6889   five6n5n5n3n3n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))
6890                  * (pow(dReQ3n,2.)*dReQ6n-pow(dImQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n)
6891                  - ((dReQ11n*dReQ5n+dImQ11n*dImQ5n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
6892                  + 2.*dReQ3n*dImQ3n*(dImQ11n*dReQ5n-dReQ11n*dImQ5n))
6893                  - (dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
6894                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
6895                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n)
6896                  - 2.*(dImQ2n*dImQ3n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ2n*dReQ3n 
6897                  + dImQ3n*dImQ6n*dReQ2n*dReQ5n-dImQ2n*dImQ6n*dReQ3n*dReQ5n
6898                  - dImQ3n*dImQ5n*dReQ2n*dReQ6n+dImQ2n*dImQ5n*dReQ3n*dReQ6n 
6899                  + dImQ2n*dImQ3n*dReQ5n*dReQ6n+dReQ2n*dReQ3n*dReQ5n*dReQ6n)
6900                  - 2.*(dImQ3n*dImQ5n*dImQ6n*dImQ8n+dImQ6n*dImQ8n*dReQ3n*dReQ5n 
6901                  + dImQ5n*dImQ8n*dReQ3n*dReQ6n-dImQ3n*dImQ8n*dReQ5n*dReQ6n
6902                  - dImQ5n*dImQ6n*dReQ3n*dReQ8n+dImQ3n*dImQ6n*dReQ5n*dReQ8n 
6903                  + dImQ3n*dImQ5n*dReQ6n*dReQ8n+dReQ3n*dReQ5n*dReQ6n*dReQ8n)
6904                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6905                  + 1.*(dReQ11n*dReQ6n*dReQ5n-dReQ11n*dImQ6n*dImQ5n+dImQ11n*dReQ6n*dImQ5n+dImQ11n*dImQ6n*dReQ5n)
6906                  + 3.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
6907                  + 2.*(dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n+dImQ8n*dImQ6n*dReQ2n)
6908                  + 2.*(dReQ11n*dReQ8n*dReQ3n-dReQ11n*dImQ8n*dImQ3n+dImQ11n*dReQ8n*dImQ3n+dImQ11n*dImQ8n*dReQ3n)
6909                  + 2.*(dReQ11n*dReQ6n*dReQ5n-dReQ11n*dImQ6n*dImQ5n+dImQ11n*dReQ6n*dImQ5n+dImQ11n*dImQ6n*dReQ5n)
6910                  + 6.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
6911                  + 6.*(dReQ8n*dReQ5n*dReQ3n-dReQ8n*dImQ5n*dImQ3n+dImQ8n*dReQ5n*dImQ3n+dImQ8n*dImQ5n*dReQ3n)
6912                  - (dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
6913                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6914                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6915                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))-4.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
6916                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6917                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6918                  + 2.*(dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6919                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
6920                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6921   // to be polished:
6922   five6n2n6n1n1n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))
6923                  * (pow(dReQ1n,2.)*dReQ2n-pow(dImQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n)
6924                  - reQ8nQ6nstarQ1nstarQ1nstar
6925                  - reQ6nQ4nstarQ1nstarQ1nstar
6926                  - 2.*reQ6nQ1nQ5nstarQ2nstar
6927                  - 2.*reQ7nQ1nQ6nstarQ2nstar
6928                  + 2.*reQ5nQ4nstarQ1nstar
6929                  + reQ8nQ6nstarQ2nstar
6930                  + 3.*reQ6nQ4nstarQ2nstar
6931                  + 2.*reQ7nQ5nstarQ2nstar
6932                  + 2.*reQ8nQ7nstarQ1nstar
6933                  + 2.*reQ8nQ6nstarQ2nstar
6934                  + 6.*reQ6nQ5nstarQ1nstar
6935                  + 6.*reQ7nQ6nstarQ1nstar
6936                  - (dMult-6.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
6937                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6938                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6939                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))-4.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6940                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
6941                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6942                  + 2.*(dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6943                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
6944                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6945   five6n3n6n2n1n = (reQ6nQ3nQ6nstarQ2nstarQ1nstar
6946                  - reQ7nQ2nQ6nstarQ3nstar
6947                  - reQ8nQ1nQ6nstarQ3nstar
6948                  - reQ6nQ1nQ4nstarQ3nstar
6949                  - reQ9nQ6nstarQ2nstarQ1nstar
6950                  - reQ6nQ3nstarQ2nstarQ1nstar
6951                  - reQ6nQ2nQ5nstarQ3nstar
6952                  + reQ6nQ5nstarQ1nstar
6953                  + reQ9nQ6nstarQ3nstar
6954                  + 3.*reQ6nQ3nstarQ3nstar
6955                  + 2.*reQ9nQ6nstarQ3nstar
6956                  + reQ7nQ4nstarQ3nstar
6957                  + reQ9nQ7nstarQ2nstar
6958                  + reQ8nQ5nstarQ3nstar
6959                  + reQ6nQ5nstarQ1nstar
6960                  + reQ9nQ8nstarQ1nstar
6961                  + reQ4nQ3nstarQ1nstar
6962                  - (dMult-6.)*reQ3nQ2nstarQ1nstar
6963                  + 3.*reQ7nQ6nstarQ1nstar
6964                  + reQ6nQ5nstarQ1nstar
6965                  + 2.*reQ6nQ4nstarQ2nstar
6966                  + 3.*reQ8nQ6nstarQ2nstar
6967                  + reQ5nQ3nstarQ2nstar
6968                  + reQ6nQ4nstarQ2nstar
6969                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6970                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6971                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6972                                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
6973                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6974                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6975                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
6976                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
6977                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6978                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6979                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6980                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6981                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
6982                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6983   five6n4n6n2n2n = (-(pow(dImQ6n,2.)+pow(dReQ6n,2.))
6984                  * (-2.*dImQ2n*dImQ4n*dReQ2n+pow(dImQ2n,2.)*dReQ4n-pow(dReQ2n,2.)*dReQ4n)
6985                  - (-pow(dImQ2n,2.)*dImQ6n*dImQ10n+dImQ6n*dImQ10n*pow(dReQ2n,2.)
6986                  + 2.*dImQ2n*dImQ10n*dReQ2n*dReQ6n-2.*dImQ2n*dImQ6n*dReQ2n*dReQ10n 
6987                  - pow(dImQ2n,2.)*dReQ6n*dReQ10n+pow(dReQ2n,2.)*dReQ6n*dReQ10n)
6988                  - 2.*(dImQ2n*dImQ4n*dImQ6n*dImQ8n+dImQ6n*dImQ8n*dReQ2n*dReQ4n 
6989                  + dImQ4n*dImQ8n*dReQ2n*dReQ6n-dImQ2n*dImQ8n*dReQ4n*dReQ6n
6990                  - dImQ4n*dImQ6n*dReQ2n*dReQ8n+dImQ2n*dImQ6n*dReQ4n*dReQ8n 
6991                  + dImQ2n*dImQ4n*dReQ6n*dReQ8n+dReQ2n*dReQ4n*dReQ6n*dReQ8n)
6992                  - (dReQ6n*pow(dReQ2n,3.)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2.)
6993                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2.)-dImQ6n*pow(dImQ2n,3.))
6994                  - 2.*((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
6995                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
6996                  + 2.*(dReQ10n*dReQ8n*dReQ2n-dReQ10n*dImQ8n*dImQ2n+dImQ10n*dReQ8n*dImQ2n+dImQ10n*dImQ8n*dReQ2n)
6997                  + 3.*(dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
6998                  + 6.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
6999                  + 2.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
7000                  + 9.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7001                  - (dMult-8.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7002                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7003                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7004                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))-4.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7005                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+(dMult-12.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7006                  + 2.*(dMult-9.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.))
7007                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7008   // to be polished:
7009   five6n4n6n3n1n = (reQ6nQ4nQ6nstarQ3nstarQ1nstar
7010                  - reQ7nQ3nQ6nstarQ4nstar
7011                  - reQ9nQ1nQ6nstarQ4nstar
7012                  - reQ6nQ1nQ4nstarQ3nstar
7013                  - reQ10nQ6nstarQ3nstarQ1nstar
7014                  - reQ6nQ3nstarQ2nstarQ1nstar
7015                  - reQ6nQ3nQ5nstarQ4nstar
7016                  + reQ6nQ5nstarQ1nstar
7017                  + reQ10nQ6nstarQ4nstar
7018                  + 3.*reQ6nQ4nstarQ2nstar
7019                  + 2.*reQ10nQ6nstarQ4nstar
7020                  + reQ7nQ4nstarQ3nstar
7021                  + reQ10nQ7nstarQ3nstar
7022                  + reQ9nQ5nstarQ4nstar
7023                  + reQ6nQ5nstarQ1nstar
7024                  + reQ10nQ9nstarQ1nstar
7025                  + reQ3nQ2nstarQ1nstar
7026                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
7027                  + 3.*reQ7nQ6nstarQ1nstar
7028                  + reQ6nQ5nstarQ1nstar
7029                  + 2.*reQ6nQ3nstarQ3nstar
7030                  + 3.*reQ9nQ6nstarQ3nstar
7031                  + reQ5nQ3nstarQ2nstar
7032                  + reQ6nQ3nstarQ3nstar
7033                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7034                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7035                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7036                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
7037                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7038                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7039                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7040                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
7041                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7042                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7043                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7044                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7045                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
7046                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7047   // to be polished:
7048   five6n5n5n4n2n = (reQ6nQ5nQ5nstarQ4nstarQ2nstar
7049                  - reQ7nQ4nQ6nstarQ5nstar
7050                  - reQ9nQ2nQ6nstarQ5nstar
7051                  - reQ6nQ1nQ5nstarQ2nstar
7052                  - reQ11nQ5nstarQ4nstarQ2nstar
7053                  - reQ5nQ1nQ4nstarQ2nstar
7054                  - reQ6nQ3nQ5nstarQ4nstar
7055                  + reQ5nQ3nstarQ2nstar
7056                  + reQ11nQ6nstarQ5nstar
7057                  + 3.*reQ6nQ5nstarQ1nstar
7058                  + 2.*reQ11nQ6nstarQ5nstar
7059                  + reQ7nQ6nstarQ1nstar
7060                  + reQ11nQ7nstarQ4nstar
7061                  + reQ9nQ6nstarQ3nstar
7062                  + reQ5nQ3nstarQ2nstar
7063                  + reQ11nQ9nstarQ2nstar
7064                  + reQ2nQ1nstarQ1nstar
7065                  - (dMult-6.)*reQ6nQ4nstarQ2nstar
7066                  + 3.*reQ7nQ5nstarQ2nstar
7067                  + reQ5nQ3nstarQ2nstar
7068                  + 2.*reQ5nQ4nstarQ1nstar
7069                  + 3.*reQ9nQ5nstarQ4nstar
7070                  + reQ4nQ3nstarQ1nstar
7071                  + reQ5nQ4nstarQ1nstar
7072                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7073                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7074                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7075                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))
7076                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7077                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7078                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7079                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
7080                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7081                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7082                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7083                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7084                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
7085                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7086   // to be polished:
7087   five6n5n6n3n2n = (reQ6nQ5nQ6nstarQ3nstarQ2nstar
7088                  - reQ8nQ3nQ6nstarQ5nstar
7089                  - reQ9nQ2nQ6nstarQ5nstar
7090                  - reQ6nQ2nQ5nstarQ3nstar
7091                  - reQ11nQ6nstarQ3nstarQ2nstar
7092                  - reQ6nQ3nstarQ2nstarQ1nstar
7093                  - reQ6nQ3nQ5nstarQ4nstar
7094                  + reQ6nQ4nstarQ2nstar
7095                  + reQ11nQ6nstarQ5nstar
7096                  + 3.*reQ6nQ5nstarQ1nstar
7097                  + 2.*reQ11nQ6nstarQ5nstar
7098                  + reQ8nQ5nstarQ3nstar
7099                  + reQ11nQ8nstarQ3nstar
7100                  + reQ9nQ5nstarQ4nstar
7101                  + reQ6nQ4nstarQ2nstar
7102                  + reQ11nQ9nstarQ2nstar
7103                  + reQ3nQ2nstarQ1nstar
7104                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
7105                  + 3.*reQ8nQ6nstarQ2nstar
7106                  + reQ6nQ4nstarQ2nstar
7107                  + 2.*reQ6nQ3nstarQ3nstar
7108                  + 3.*reQ9nQ6nstarQ3nstar
7109                  + reQ4nQ3nstarQ1nstar
7110                  + reQ6nQ3nstarQ3nstar
7111                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7112                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7113                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7114                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))
7115                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7116                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
7117                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7118                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
7119                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7120                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7121                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7122                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7123                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
7124                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7125   // to be polished:
7126   five6n5n6n4n1n = (reQ6nQ5nQ6nstarQ4nstarQ1nstar
7127                  - reQ7nQ4nQ6nstarQ5nstar
7128                  - reQ10nQ1nQ6nstarQ5nstar
7129                  - reQ6nQ1nQ5nstarQ2nstar
7130                  - reQ11nQ6nstarQ4nstarQ1nstar
7131                  - reQ6nQ4nstarQ1nstarQ1nstar
7132                  - reQ6nQ4nQ5nstarQ5nstar
7133                  + reQ6nQ5nstarQ1nstar
7134                  + reQ11nQ6nstarQ5nstar
7135                  + 3.*reQ6nQ5nstarQ1nstar
7136                  + 2.*reQ11nQ6nstarQ5nstar
7137                  + reQ7nQ5nstarQ2nstar
7138                  + reQ11nQ7nstarQ4nstar
7139                  + reQ10nQ5nstarQ5nstar
7140                  + reQ6nQ5nstarQ1nstar
7141                  + reQ11nQ10nstarQ1nstar
7142                  + reQ2nQ1nstarQ1nstar
7143                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
7144                  + 3.*reQ7nQ6nstarQ1nstar
7145                  + reQ6nQ5nstarQ1nstar
7146                  + 2.*reQ6nQ4nstarQ2nstar
7147                  + 3.*reQ10nQ6nstarQ4nstar
7148                  + reQ5nQ4nstarQ1nstar
7149                  + reQ6nQ4nstarQ2nstar
7150                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7151                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7152                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7153                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))
7154                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7155                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7156                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7157                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.)) 
7158                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7159                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7160                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7161                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7162                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
7163                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7164   //  f2) Two distinct harmonics (9):
7165   five2n1n1n1n1n = ((dReQ2n*dReQ1n-dImQ2n*dImQ1n)*(pow(dReQ1n,3)-3.*dReQ1n*pow(dImQ1n,2))
7166                  + (dReQ2n*dImQ1n+dReQ1n*dImQ2n)*(3.*dImQ1n*pow(dReQ1n,2)-pow(dImQ1n,3))
7167                  - (dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
7168                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3))
7169                  + 5.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7170                  - 3.*(dMult-5.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7171                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7172                  - 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))     
7173                  + 3.*(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7174                  - 3.*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
7175                  + 6.*(2.*dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult*(dMult-4.))
7176                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7177   five2n2n2n1n1n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))*(dReQ2n*(pow(dReQ1n,2.)-pow(dImQ1n,2.))+2.*dImQ2n*dReQ1n*dImQ1n)
7178                  - ((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
7179                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
7180                  - 2.*((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
7181                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7182                  + 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7183                  + 8.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7184                  + 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7185                  - 2.*(dMult-6.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7186                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7187                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)
7188                  + 2.*(3.*dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7189                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7190                  + 4.*(dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
7191                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7192   five3n3n2n2n2n = (pow(dReQ2n,3.)*pow(dReQ3n,2.)-3.*dReQ2n*pow(dReQ3n,2.)*pow(dImQ2n,2.)
7193                  + 6.*pow(dReQ2n,2.)*dReQ3n*dImQ2n*dImQ3n-2.*dReQ3n*pow(dImQ2n,3.)*dImQ3n
7194                  - pow(dReQ2n,3.)*pow(dImQ3n,2.)+3.*dReQ2n*pow(dImQ2n,2.)*pow(dImQ3n,2.)
7195                  - (dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
7196                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3))
7197                  - 3.*((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
7198                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n)
7199                  - 6.*((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
7200                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7201                  + 2.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7202                  + 3.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7203                  + 6.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7204                  + 6.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7205                  + 12.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7206                  + 6.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7207                  - 2.*((pow(dReQ6n,2.)+pow(dImQ6n,2.))+3.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7208                  + 6.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+9.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7209                  + 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-12.*dMult))
7210                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7211   five4n1n1n1n1n = (pow(dReQ1n,4.)*dReQ4n-6.*pow(dReQ1n,2.)*dReQ4n*pow(dImQ1n,2.)
7212                  + pow(dImQ1n,4.)*dReQ4n+4.*pow(dReQ1n,3.)*dImQ1n*dImQ4n-4.*pow(dImQ1n,3.)*dReQ1n*dImQ4n
7213                  - 6.*((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
7214                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
7215                  - 4.*(dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
7216                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3))
7217                  + 8.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7218                  + 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7219                  + 12.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n) 
7220                  + 12.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7221                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-8.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7222                  - 12.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-24.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+24.*dMult)
7223                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7224   five4n2n2n2n2n = ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(pow(dReQ2n,3)-3.*dReQ2n*pow(dImQ2n,2))
7225                  + (dReQ4n*dImQ2n+dReQ2n*dImQ4n)*(3.*dImQ2n*pow(dReQ2n,2)-pow(dImQ2n,3))
7226                  - (dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
7227                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3))
7228                  + 5.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7229                  - 3.*(dMult-5.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7230                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7231                  - 3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))     
7232                  + 3.*(dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7233                  - 3.*pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)
7234                  + 6.*(2.*dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-6.*dMult*(dMult-4.))
7235                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7236   five4n4n4n2n2n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(dReQ4n*(pow(dReQ2n,2.)-pow(dImQ2n,2.))+2.*dImQ4n*dReQ2n*dImQ2n)
7237                  - ((dReQ8n*dReQ4n+dImQ8n*dImQ4n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
7238                  + 2.*dReQ2n*dImQ2n*(dImQ8n*dReQ4n-dReQ8n*dImQ4n))
7239                  - 2.*((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
7240                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7241                  + 3.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
7242                  + 8.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7243                  + 2.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7244                  - 2.*(dMult-6.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7245                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))-4.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7246                  - pow((pow(dReQ4n,2.)+pow(dImQ4n,2.)),2.)
7247                  + 2.*(3.*dMult-10.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7248                  - 4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7249                  + 4.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*dMult*(dMult-6.))
7250                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7251   five6n3n3n3n3n = ((dReQ6n*dReQ3n-dImQ6n*dImQ3n)*(pow(dReQ3n,3)-3.*dReQ3n*pow(dImQ3n,2))
7252                  + (dReQ6n*dImQ3n+dReQ3n*dImQ6n)*(3.*dImQ3n*pow(dReQ3n,2)-pow(dImQ3n,3))
7253                  - (dReQ9n*pow(dReQ3n,3)-3.*dReQ3n*dReQ9n*pow(dImQ3n,2)
7254                  + 3.*dImQ3n*dImQ9n*pow(dReQ3n,2)-dImQ9n*pow(dImQ3n,3))
7255                  + 5.*(dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n+dImQ9n*dImQ6n*dReQ3n)
7256                  - 3.*(dMult-5.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7257                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
7258                  - 3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))     
7259                  + 3.*(dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7260                  - 3.*pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)
7261                  + 6.*(2.*dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-6.*dMult*(dMult-4.))
7262                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7263   five6n6n4n4n4n = (pow(dReQ4n,3.)*pow(dReQ6n,2.)-3.*dReQ4n*pow(dReQ6n,2.)*pow(dImQ4n,2.)
7264                  + 6.*pow(dReQ4n,2.)*dReQ6n*dImQ4n*dImQ6n-2.*dReQ6n*pow(dImQ4n,3.)*dImQ6n
7265                  - pow(dReQ4n,3.)*pow(dImQ6n,2.)+3.*dReQ4n*pow(dImQ4n,2.)*pow(dImQ6n,2.)
7266                  - (dReQ12n*pow(dReQ4n,3)-3.*dReQ4n*dReQ12n*pow(dImQ4n,2)
7267                  + 3.*dImQ4n*dImQ12n*pow(dReQ4n,2)-dImQ12n*pow(dImQ4n,3))
7268                  - 3.*((dReQ8n*dReQ4n-dImQ8n*dImQ4n)*(dReQ6n*dReQ6n-dImQ6n*dImQ6n)
7269                  + 2.*(dReQ8n*dImQ4n+dImQ8n*dReQ4n)*dReQ6n*dImQ6n)
7270                  - 6.*((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
7271                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7272                  + 2.*(pow(dReQ6n,2.)*dReQ12n+2.*dReQ6n*dImQ6n*dImQ12n-pow(dImQ6n,2.)*dReQ12n)
7273                  + 3.*(dReQ12n*dReQ8n*dReQ4n-dReQ12n*dImQ8n*dImQ4n+dImQ12n*dReQ8n*dImQ4n+dImQ12n*dImQ8n*dReQ4n)
7274                  + 6.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7275                  + 6.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
7276                  + 12.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7277                  + 6.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7278                  - 2.*((pow(dReQ12n,2.)+pow(dImQ12n,2.))+3.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7279                  + 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+9.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7280                  + 6.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-12.*dMult))
7281                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7282   five6n6n6n3n3n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(dReQ6n*(pow(dReQ3n,2.)-pow(dImQ3n,2.))+2.*dImQ6n*dReQ3n*dImQ3n)
7283                  - ((dReQ12n*dReQ6n+dImQ12n*dImQ6n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
7284                  + 2.*dReQ3n*dImQ3n*(dImQ12n*dReQ6n-dReQ12n*dImQ6n))
7285                  - 2.*((pow(dReQ6n,2.)-pow(dImQ6n,2.))*(dReQ9n*dReQ3n-dImQ9n*dImQ3n) 
7286                  + 2.*dReQ6n*dImQ6n*(dReQ9n*dImQ3n+dImQ9n*dReQ3n))
7287                  + 3.*(pow(dReQ6n,2.)*dReQ12n+2.*dReQ6n*dImQ6n*dImQ12n-pow(dImQ6n,2.)*dReQ12n)
7288                  + 8.*(dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n+dImQ9n*dImQ6n*dReQ3n)
7289                  + 2.*(dReQ12n*(dReQ9n*dReQ3n-dImQ9n*dImQ3n)+dImQ12n*(dReQ9n*dImQ3n+dImQ9n*dReQ3n))
7290                  - 2.*(dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7291                  - 2.*(pow(dReQ12n,2.)+pow(dImQ12n,2.))-4.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
7292                  - pow((pow(dReQ6n,2.)+pow(dImQ6n,2.)),2.)
7293                  + 2.*(3.*dMult-10.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7294                  - 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7295                  + 4.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-4.*dMult*(dMult-6.))
7296                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7297   //  f3) Three distinct harmonics (30):
7298   five3n1n2n1n1n = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))*(dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n
7299                  + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n)
7300                  - ((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
7301                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n)) 
7302                  - (dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
7303                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3))
7304                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
7305                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7306                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7307                  + pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n
7308                  - (2.*dMult-13.)*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
7309                  + dImQ3n*dImQ2n*dReQ1n)
7310                  + 7.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7311                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7312                  + 2.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7313                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7314                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7315                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7316                  - pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
7317                  + 2.*(3.*dMult-11.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
7318                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7319   five3n2n2n2n1n = ((pow(dImQ2n,2.)+pow(dReQ2n,2.))*(dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n 
7320                  - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n)
7321                  - (-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
7322                  + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
7323                  - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n)
7324                  - (dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
7325                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
7326                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
7327                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
7328                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
7329                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7330                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7331                  + (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
7332                  + 4.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
7333                  + dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)
7334                  + 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7335                  - 2.*(dMult-6.)*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7336                  + 4.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7337                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7338                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7339                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7340                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)+2.*(3.*dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7341                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
7342                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
7343   five3n3n3n2n1n = ((pow(dImQ3n,2.)+pow(dReQ3n,2.))*(dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n
7344                  - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n)
7345                  - (dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
7346                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
7347                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
7348                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
7349                  - (dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
7350                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
7351                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n)
7352                  - ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
7353                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n)
7354                  + dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n
7355                  + dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n
7356                  + 3.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7357                  + 4.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
7358                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7359                  - 2.*(dMult-6.)*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7360                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7361                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7362                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7363                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(3.*dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7364                  - pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)+2.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7365                  + 2.*(dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
7366                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7367   five4n1n3n1n1n = (reQ4nQ1nQ3nstarQ1nstarQ1nstar
7368                  - reQ4nQ1nQ3nstarQ2nstar
7369                  - reQ4nQ1nQ4nstarQ1nstar
7370                  - reQ4nQ2nstarQ1nstarQ1nstar
7371                  - reQ5nQ3nstarQ1nstarQ1nstar
7372                  - reQ3nQ1nQ3nstarQ1nstar
7373                  - dMult*reQ4nQ3nstarQ1nstar
7374                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7375                  + reQ5nQ4nstarQ1nstar
7376                  + 3.*reQ4nQ3nstarQ1nstar
7377                  + 2.*reQ5nQ4nstarQ1nstar
7378                  + reQ4nQ2nstarQ2nstar
7379                  + reQ5nQ3nstarQ2nstar
7380                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7381                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7382                  + reQ5nQ4nstarQ1nstar
7383                  + reQ3nQ2nstarQ1nstar
7384                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
7385                  + 3.*reQ2nQ1nstarQ1nstar
7386                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7387                  + 2.*reQ3nQ2nstarQ1nstar
7388                  + 3.*reQ4nQ3nstarQ1nstar
7389                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7390                  + reQ3nQ2nstarQ1nstar
7391                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7392                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7393                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7394                                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7395                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7396                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7397                  - 2.*dMult*dMult 
7398                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7399                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7400                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7401                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7402                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7403                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.)) 
7404                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7405   five4n1n1n3n3n = // calculated by Peter Jochumzsen
7406                  (pow(dReQ1n*dReQ3n,2.)*dReQ4n-pow(dReQ3n*dImQ1n,2.)*dReQ4n  
7407                  + 4.*dReQ1n*dReQ3n*dReQ4n*dImQ1n*dImQ3n 
7408                  - pow(dReQ1n*dImQ3n,2.)*dReQ4n+pow(dImQ1n*dImQ3n,2.)*dReQ4n  
7409                  - 2.*dReQ1n*pow(dReQ3n,2.)*dImQ1n*dImQ4n+2.*pow(dReQ1n,2.)*dReQ3n*dImQ3n*dImQ4n 
7410                  - 2.*dReQ3n*pow(dImQ1n,2.)*dImQ3n*dImQ4n+2.*dReQ1n*dImQ1n*pow(dImQ3n,2.)*dImQ4n
7411                  + 6.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7412                  - 1.*(-pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
7413                  + 2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
7414                  - pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n) 
7415                  - 1.*((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
7416                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n) 
7417                  + 1.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7418                  - 2.*(dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
7419                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
7420                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n) 
7421                  + 2.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7422                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)) 
7423                  - 2.*(dReQ3n*pow(dReQ1n,3.)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2.)
7424                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2.)-dImQ3n*pow(dImQ1n,3.))
7425                  + 10.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n) 
7426                  + 2.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
7427                  + 2.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n) 
7428                  - 4.*(dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
7429                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
7430                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
7431                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
7432                  + 4.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
7433                  + 4.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
7434                  - 16.*pow(dReQ1n,2.)-16.*pow(dImQ1n,2.)
7435                  - 10.*pow(dReQ2n,2.)-10.*pow(dImQ2n,2.)-12.*pow(dReQ3n,2.)-12.*pow(dImQ3n,2.)
7436                  - 6.*pow(dReQ4n,2.)-6.*pow(dImQ4n,2.)-4.*pow(dReQ5n,2.)-4.*pow(dImQ5n,2.)
7437                  - 2.*pow(dReQ6n,2.)-2.*pow(dImQ6n,2.)+24.*dMult)
7438                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7439   // to be polished:
7440   five4n3n3n3n1n = (reQ4nQ3nQ3nstarQ3nstarQ1nstar
7441                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7442                  - reQ6nQ1nQ4nstarQ3nstar
7443                  - dMult*reQ4nQ3nstarQ1nstar
7444                  - reQ7nQ3nstarQ3nstarQ1nstar
7445                  - reQ3nQ1nQ3nstarQ1nstar
7446                  - reQ4nQ2nQ3nstarQ3nstar
7447                  + reQ3nQ2nstarQ1nstar
7448                  + reQ7nQ4nstarQ3nstar
7449                  + 3.*reQ4nQ3nstarQ1nstar
7450                  + 2.*reQ7nQ4nstarQ3nstar
7451                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7452                  + reQ7nQ4nstarQ3nstar
7453                  + reQ6nQ4nstarQ2nstar
7454                  + reQ3nQ2nstarQ1nstar
7455                  + reQ7nQ6nstarQ1nstar
7456                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7457                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
7458                  + 3.*reQ4nQ3nstarQ1nstar
7459                  + reQ3nQ2nstarQ1nstar
7460                  + 2.*dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7461                  + 3.*reQ6nQ3nstarQ3nstar
7462                  + reQ3nQ2nstarQ1nstar
7463                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7464                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7465                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7466                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7467                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
7468                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7469                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7470                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7471                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
7472                  - 2.*dMult*dMult 
7473                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7474                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7475                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7476                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
7477                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7478
7479   // to be polished:
7480   five4n4n3n3n2n = (reQ4nQ4nQ3nstarQ3nstarQ2nstar
7481                  - reQ5nQ3nQ4nstarQ4nstar-reQ5nQ3nQ4nstarQ4nstar-reQ6nQ2nQ4nstarQ4nstar
7482                  - reQ4nQ1nQ3nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar-reQ4nQ2nQ3nstarQ3nstar                  
7483                                  - reQ8nQ3nstarQ3nstarQ2nstar-reQ4nQ2nQ3nstarQ3nstar-reQ4nQ1nQ3nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar
7484                  + 2.*(reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ8nQ4nstarQ4nstar)
7485                                  + reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ6nQ4nstarQ2nstar
7486                  + reQ8nQ6nstarQ2nstar+reQ8nQ5nstarQ3nstar+reQ8nQ5nstarQ3nstar
7487                                  + reQ5nQ4nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar                                                           
7488                                  + reQ5nQ4nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar                                                           
7489                                  + reQ6nQ4nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7490                  + 2.*(reQ6nQ3nstarQ3nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar)
7491                  + 2.*(reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar)
7492                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7493                                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
7494                                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
7495                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))                                
7496                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
7497                                  + 24.*dMult) 
7498                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7499
7500   /*
7501   // correct recursive formula, not needed for the time being.
7502   five4n4n3n3n2n = (reQ4nQ4nQ3nstarQ3nstarQ2nstar
7503                  - dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
7504                  * (2.*four4n2n3n3n+4.*four4n1n3n2n+1.*four8n3n3n2n+1.*four6n2n4n4n+2.*four5n3n4n4n)
7505                  - dMult*(dMult-1.)*(dMult-2.)
7506                  * (4.*three4n3n1n+2.*three4n2n2n+2.*three5n3n2n+1.*three6n3n3n+1.*three8n4n4n
7507                                  + 4.*three3n2n1n+2.*three2n1n1n+1.*three8n6n2n+2.*three8n5n3n+2.*three6n4n2n+4.*three5n4n1n)
7508                  - dMult*(dMult-1.)
7509                                  * (1.*two2n2n+2.*two3n3n+2.*two4n4n+2.*two5n5n+1.*two6n6n+4.*two1n1n+2.*two2n2n+1.*two8n8n)
7510                                  - dMult)
7511                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
7512   */
7513
7514   // to be polished:
7515   five4n4n4n3n1n = (reQ4nQ4nQ4nstarQ3nstarQ1nstar
7516                  - reQ5nQ3nQ4nstarQ4nstar
7517                  - reQ7nQ1nQ4nstarQ4nstar
7518                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7519                  - reQ8nQ4nstarQ3nstarQ1nstar
7520                  - dMult*reQ4nQ3nstarQ1nstar
7521                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7522                  + reQ4nQ3nstarQ1nstar
7523                  + reQ8nQ4nstarQ4nstar
7524                  + 3.*dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7525                  + 2.*reQ8nQ4nstarQ4nstar
7526                  + reQ5nQ4nstarQ1nstar
7527                  + reQ8nQ5nstarQ3nstar
7528                  + reQ7nQ4nstarQ3nstar
7529                  + reQ4nQ3nstarQ1nstar
7530                  + reQ8nQ7nstarQ1nstar
7531                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7532                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
7533                  + 3.*reQ5nQ4nstarQ1nstar
7534                  + reQ4nQ3nstarQ1nstar
7535                  + 2.*reQ4nQ3nstarQ1nstar
7536                  + 3.*reQ7nQ4nstarQ3nstar
7537                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7538                  + reQ4nQ3nstarQ1nstar
7539                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7540                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7541                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7542                                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7543                  - 2.*dMult*dMult 
7544                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7545                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7546                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7547                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7548                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7549                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7550                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7551                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
7552                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7553   // to be polished:
7554   five5n2n1n1n1n = (reQ5nQ2nstarQ1nstarQ1nstarQ1nstar
7555                      - reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar
7556                                  - reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar
7557                                  - reQ3nQ1nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar
7558                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar)
7559                                  + reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar
7560                                  + reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7561                                  + reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
7562                                  + reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
7563                                  + reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
7564                  + 2.*(reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar)
7565                  + 2.*(reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
7566                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7567                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.))
7568                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
7569                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
7570                                  - 6.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
7571                                  + 24.*dMult) 
7572                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7573   // to be polished:
7574   five5n1n2n2n2n = (reQ5nQ1nQ2nstarQ2nstarQ2nstar
7575                  - reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ4nstarQ2nstar
7576                                  - reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar
7577                                  - reQ6nQ2nstarQ2nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar
7578                                  + 2.*(reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ6nQ5nstarQ1nstar)
7579                                  + reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar
7580                                  + reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar
7581                                  + reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7582                                  + reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7583                                  + reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7584                  + 2.*(reQ4nQ2nstarQ2nstar+reQ4nQ2nstarQ2nstar+reQ4nQ2nstarQ2nstar)
7585                  + 2.*(reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar)
7586                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7587                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
7588                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.))
7589                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
7590                                  - 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
7591                                  + 24.*dMult) 
7592                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7593   // to be polished:
7594   five5n2n3n2n2n = (reQ5nQ2nQ3nstarQ2nstarQ2nstar
7595                  - reQ5nQ2nQ4nstarQ3nstar
7596                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7597                  - reQ5nQ2nstarQ2nstarQ1nstar
7598                  - reQ7nQ3nstarQ2nstarQ2nstar
7599                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7600                  - dMult*reQ5nQ3nstarQ2nstar
7601                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7602                  + reQ7nQ5nstarQ2nstar
7603                  + 3.*reQ5nQ3nstarQ2nstar
7604                  + 2.*reQ7nQ5nstarQ2nstar
7605                  + reQ5nQ4nstarQ1nstar
7606                  + reQ7nQ4nstarQ3nstar
7607                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7608                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7609                  + reQ7nQ5nstarQ2nstar
7610                  + reQ3nQ2nstarQ1nstar
7611                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
7612                  + 3.*reQ4nQ2nstarQ2nstar
7613                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7614                  + 2.*reQ3nQ2nstarQ1nstar
7615                  + 3.*reQ5nQ3nstarQ2nstar
7616                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7617                  + reQ3nQ2nstarQ1nstar
7618                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7619                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7620                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7621                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
7622                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7623                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7624                  - 2.*dMult*dMult
7625                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7626                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7627                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7628                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7629                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7630                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.)) 
7631                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7632   // to be polished:
7633   five5n3n3n3n2n = (reQ5nQ3nQ3nstarQ3nstarQ2nstar
7634                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7635                  - reQ6nQ2nQ5nstarQ3nstar
7636                  - dMult*reQ5nQ3nstarQ2nstar
7637                  - reQ8nQ3nstarQ3nstarQ2nstar 
7638                                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7639                  - reQ5nQ1nQ3nstarQ3nstar
7640                  + reQ3nQ2nstarQ1nstar
7641                  + reQ8nQ5nstarQ3nstar
7642                  + 3.*reQ5nQ3nstarQ2nstar
7643                  + 2.*reQ8nQ5nstarQ3nstar
7644                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7645                  + reQ8nQ5nstarQ3nstar
7646                  + reQ6nQ5nstarQ1nstar
7647                  + reQ3nQ2nstarQ1nstar
7648                  + reQ8nQ6nstarQ2nstar
7649                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7650                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
7651                  + 3.*reQ5nQ3nstarQ2nstar
7652                  + reQ3nQ2nstarQ1nstar
7653                  + 2.*dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7654                  + 3.*reQ6nQ3nstarQ3nstar
7655                  + reQ3nQ2nstarQ1nstar
7656                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7657                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7658                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7659                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7660                                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7661                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7662                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7663                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7664                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
7665                  - 2.*dMult*dMult 
7666                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7667                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7668                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7669                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
7670                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7671   // to be polished:
7672   five5n1n4n1n1n = (reQ5nQ1nQ4nstarQ1nstarQ1nstar
7673                  - reQ5nQ1nQ4nstarQ2nstar
7674                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7675                  - reQ5nQ3nstarQ1nstarQ1nstar
7676                  - reQ6nQ4nstarQ1nstarQ1nstar 
7677                                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7678                  - dMult*reQ5nQ4nstarQ1nstar
7679                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7680                  + reQ6nQ5nstarQ1nstar
7681                  + 3.*reQ5nQ4nstarQ1nstar
7682                  + 2.*reQ6nQ5nstarQ1nstar
7683                  + reQ5nQ3nstarQ2nstar
7684                  + reQ6nQ4nstarQ2nstar
7685                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7686                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7687                  + reQ6nQ5nstarQ1nstar
7688                  + reQ4nQ3nstarQ1nstar
7689                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
7690                  + 3.*reQ2nQ1nstarQ1nstar
7691                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7692                  + 2.*reQ4nQ3nstarQ1nstar
7693                  + 3.*reQ5nQ4nstarQ1nstar
7694                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7695                  + reQ4nQ3nstarQ1nstar
7696                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7697                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7698                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7699                                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7700                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7701                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7702                  - 2.*dMult*dMult
7703                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7704                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7705                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7706                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7707                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7708                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.)) 
7709                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7710   // to be polished:
7711   five5n4n3n3n3n = (reQ5nQ4nQ3nstarQ3nstarQ3nstar
7712                  - reQ6nQ3nQ5nstarQ4nstar-reQ6nQ3nQ5nstarQ4nstar-reQ6nQ3nQ5nstarQ4nstar
7713                                  - reQ5nQ1nQ3nstarQ3nstar-reQ5nQ1nQ3nstarQ3nstar-reQ5nQ1nQ3nstarQ3nstar
7714                          - reQ9nQ3nstarQ3nstarQ3nstar-reQ4nQ2nQ3nstarQ3nstar-reQ4nQ2nQ3nstarQ3nstar-reQ4nQ2nQ3nstarQ3nstar
7715                                  + 2.*(reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ9nQ5nstarQ4nstar)
7716                                  + reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar
7717                                  + reQ9nQ6nstarQ3nstar+reQ9nQ6nstarQ3nstar+reQ9nQ6nstarQ3nstar
7718                                  + reQ6nQ4nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7719                                  + reQ6nQ4nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7720                                  + reQ6nQ4nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7721                  + 2.*(reQ6nQ3nstarQ3nstar+reQ6nQ3nstarQ3nstar+reQ6nQ3nstarQ3nstar)
7722                  + 2.*(reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
7723                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7724                                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
7725                                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
7726                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
7727                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
7728                                  + 24.*dMult) 
7729                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7730   // to be polished:
7731   five5n4n4n4n1n = (reQ5nQ4nQ4nstarQ4nstarQ1nstar
7732                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7733                  - reQ8nQ1nQ5nstarQ4nstar
7734                  - dMult*reQ5nQ4nstarQ1nstar
7735                  - reQ9nQ4nstarQ4nstarQ1nstar 
7736                                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7737                  - reQ5nQ3nQ4nstarQ4nstar
7738                  + reQ4nQ3nstarQ1nstar
7739                  + reQ9nQ5nstarQ4nstar
7740                  + 3.*reQ5nQ4nstarQ1nstar
7741                  + 2.*reQ9nQ5nstarQ4nstar
7742                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7743                  + reQ9nQ5nstarQ4nstar
7744                  + reQ8nQ5nstarQ3nstar
7745                  + reQ4nQ3nstarQ1nstar
7746                  + reQ9nQ8nstarQ1nstar
7747                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7748                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
7749                  + 3.*reQ5nQ4nstarQ1nstar
7750                  + reQ4nQ3nstarQ1nstar
7751                  + 2.*dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7752                  + 3.*reQ8nQ4nstarQ4nstar
7753                  + reQ4nQ3nstarQ1nstar
7754                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7755                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7756                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7757                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7758                                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
7759                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7760                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7761                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7762                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
7763                  - 2.*dMult*dMult 
7764                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7765                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7766                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7767                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
7768                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7769   // to be polished:
7770   five5n5n4n3n3n = (reQ5nQ5nQ4nstarQ3nstarQ3nstar
7771                  - reQ6nQ4nQ5nstarQ5nstar-reQ7nQ3nQ5nstarQ5nstar-reQ7nQ3nQ5nstarQ5nstar
7772                                  - reQ5nQ2nQ4nstarQ3nstar-reQ5nQ1nQ3nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar                  
7773                                  - reQ10nQ4nstarQ3nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar-reQ5nQ1nQ3nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar
7774                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ10nQ5nstarQ5nstar)
7775                                  + reQ6nQ5nstarQ1nstar+reQ7nQ5nstarQ2nstar+reQ7nQ5nstarQ2nstar
7776                                  + reQ10nQ7nstarQ3nstar+reQ10nQ6nstarQ4nstar+reQ10nQ7nstarQ3nstar
7777                                  + reQ6nQ5nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7778                                  + reQ7nQ5nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ2nstarQ2nstar
7779                                  + reQ7nQ5nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ2nstarQ2nstar
7780                                  + 2.*(reQ7nQ4nstarQ3nstar+reQ7nQ4nstarQ3nstar+reQ6nQ3nstarQ3nstar)
7781                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar)
7782                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7783                                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
7784                                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
7785                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
7786                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
7787                                  + 24.*dMult) 
7788                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7789   // to be polished:
7790   five5n5n4n4n2n = (reQ5nQ5nQ4nstarQ4nstarQ2nstar
7791                  - reQ6nQ4nQ5nstarQ5nstar-reQ6nQ4nQ5nstarQ5nstar-reQ8nQ2nQ5nstarQ5nstar
7792                                  - reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ4nstarQ2nstar-reQ5nQ3nQ4nstarQ4nstar                  
7793                                  - reQ10nQ4nstarQ4nstarQ2nstar-reQ5nQ3nQ4nstarQ4nstar-reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ4nstarQ2nstar
7794                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ10nQ5nstarQ5nstar)
7795                                  + reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ8nQ5nstarQ3nstar
7796                                  + reQ10nQ8nstarQ2nstar+reQ10nQ6nstarQ4nstar+reQ10nQ6nstarQ4nstar
7797                                  + reQ6nQ5nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ4nQ3nstarQ1nstar
7798                                  + reQ6nQ5nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ4nQ3nstarQ1nstar
7799                                  + reQ8nQ5nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
7800                                  + 2.*(reQ8nQ4nstarQ4nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar)
7801                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar)
7802                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7803                                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
7804                                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.))
7805                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
7806                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
7807                                  + 24.*dMult) 
7808                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7809   // to be polished:
7810   five5n5n5n3n2n = (reQ5nQ5nQ5nstarQ3nstarQ2nstar
7811                  - reQ7nQ3nQ5nstarQ5nstar
7812                  - reQ8nQ2nQ5nstarQ5nstar
7813                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7814                  - reQ10nQ5nstarQ3nstarQ2nstar 
7815                                  - dMult*reQ5nQ3nstarQ2nstar
7816                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7817                  + reQ5nQ3nstarQ2nstar
7818                  + reQ10nQ5nstarQ5nstar
7819                  + 3.*dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7820                  + 2.*reQ10nQ5nstarQ5nstar
7821                  + reQ7nQ5nstarQ2nstar
7822                  + reQ10nQ7nstarQ3nstar
7823                  + reQ8nQ5nstarQ3nstar
7824                  + reQ5nQ3nstarQ2nstar
7825                  + reQ10nQ8nstarQ2nstar
7826                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7827                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
7828                  + 3.*reQ7nQ5nstarQ2nstar
7829                  + reQ5nQ3nstarQ2nstar
7830                  + 2.*reQ5nQ3nstarQ2nstar
7831                  + 3.*reQ8nQ5nstarQ3nstar
7832                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7833                  + reQ5nQ3nstarQ2nstar
7834                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7835                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7836                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7837                                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
7838                  - 2.*dMult*dMult 
7839                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7840                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7841                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
7842                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7843                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7844                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7845                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7846                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
7847                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7848   // to be polished:
7849   five5n5n5n4n1n = (reQ5nQ5nQ5nstarQ4nstarQ1nstar
7850                  - reQ6nQ4nQ5nstarQ5nstar
7851                  - reQ9nQ1nQ5nstarQ5nstar
7852                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7853                  - reQ10nQ5nstarQ4nstarQ1nstar 
7854                                  - dMult*reQ5nQ4nstarQ1nstar
7855                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7856                  + reQ5nQ4nstarQ1nstar
7857                  + reQ10nQ5nstarQ5nstar
7858                  + 3.*dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7859                  + 2.*reQ10nQ5nstarQ5nstar
7860                  + reQ6nQ5nstarQ1nstar
7861                  + reQ10nQ6nstarQ4nstar
7862                  + reQ9nQ5nstarQ4nstar
7863                  + reQ5nQ4nstarQ1nstar
7864                  + reQ10nQ9nstarQ1nstar
7865                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7866                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
7867                  + 3.*reQ6nQ5nstarQ1nstar
7868                  + reQ5nQ4nstarQ1nstar
7869                  + 2.*reQ5nQ4nstarQ1nstar
7870                  + 3.*reQ9nQ5nstarQ4nstar
7871                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7872                  + reQ5nQ4nstarQ1nstar
7873                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7874                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7875                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7876                                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
7877                  - 2.*dMult*dMult 
7878                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
7879                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7880                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
7881                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7882                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7883                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7884                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7885                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
7886                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7887   five6n2n2n1n1n = // calculated by Peter Jochumzsen 
7888                  (pow(dReQ1n*dReQ2n,2.)*dReQ6n-pow(dReQ2n*dImQ1n,2.)*dReQ6n
7889                  - 4.*dReQ1n*dReQ2n*dReQ6n*dImQ1n*dImQ2n 
7890                  - pow(dReQ1n*dImQ2n,2.)*dReQ6n+pow(dImQ1n*dImQ2n,2.)*dReQ6n
7891                  + 2.*dReQ1n*pow(dReQ2n,2.)*dImQ1n*dImQ6n+2.*pow(dReQ1n,2.)*dReQ2n*dImQ2n*dImQ6n 
7892                  - 2.*dReQ2n*pow(dImQ1n,2.)*dImQ2n*dImQ6n-2.*dReQ1n*dImQ1n*pow(dImQ2n,2.)*dImQ6n
7893                  + 2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n) 
7894                  + 8.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7895                  + 5.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7896                  - (-pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
7897                  + 2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
7898                  - pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n)
7899                  + 2.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n) 
7900                  - (dReQ6n*pow(dReQ2n,3.)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2.)
7901                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2.)-dImQ6n*pow(dImQ2n,3.))
7902                  + 4.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n) 
7903                  - 2.*((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) 
7904                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
7905                  + 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
7906                  - 2.*(-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
7907                  + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
7908                  - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n) 
7909                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)) 
7910                  + 4.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
7911                  + 4.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
7912                  - 4.*(dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
7913                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
7914                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
7915                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
7916                  - 12.*pow(dReQ1n,2.)-12.*pow(dImQ1n,2.)-14.*pow(dReQ2n,2.)-14.*pow(dImQ2n,2.)
7917                  - 8.*pow(dReQ3n,2.)-8.*pow(dImQ3n,2.)-6.*pow(dReQ4n,2.)-6.*pow(dImQ4n,2.)
7918                  - 4.*pow(dReQ5n,2.)-4.*pow(dImQ5n,2.)-6.*pow(dReQ6n,2.)-6.*pow(dImQ6n,2.)+24.*dMult)
7919                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7920   // to be polished:
7921   five6n3n1n1n1n = (reQ6nQ3nstarQ1nstarQ1nstarQ1nstar
7922                  - reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar
7923                                  - reQ6nQ4nstarQ1nstarQ1nstar-reQ6nQ4nstarQ1nstarQ1nstar-reQ6nQ4nstarQ1nstarQ1nstar
7924                                  - reQ3nQ1nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar
7925                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ3nstarQ3nstar)
7926                                  + reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar
7927                                  + reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7928                                  + reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar
7929                                  + reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar
7930                                  + reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar
7931                  + 2.*(reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar)
7932                  + 2.*(reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
7933                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7934                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.))
7935                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
7936                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.))
7937                                  - 6.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
7938                                  + 24.*dMult) 
7939                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7940
7941
7942   // to be polished:
7943   five6n1n1n4n4n = (reQ6nQ1nQ1nQ4nstarQ4nstar
7944                      - reQ6nQ2nQ4nstarQ4nstar-reQ7nQ1nQ4nstarQ4nstar-reQ7nQ1nQ4nstarQ4nstar
7945                                  - reQ6nQ1nQ4nstarQ3nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
7946                  - reQ8nQ6nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
7947                                  + 2.*(reQ6nQ4nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ8nQ4nstarQ4nstar)
7948                                  + reQ4nQ2nstarQ2nstar+reQ7nQ4nstarQ3nstar+reQ7nQ4nstarQ3nstar // ?? 1st term
7949                  + reQ8nQ7nstarQ1nstar+reQ8nQ6nstarQ2nstar+reQ8nQ7nstarQ1nstar
7950                                  + reQ4nQ2nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7951                                  + reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                                                           
7952                  + reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                           
7953                  + 2.*(reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ2nQ1nstarQ1nstar)
7954                  + 2.*(reQ6nQ4nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
7955                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7956                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
7957                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
7958                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
7959                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
7960                                  + 24.*dMult) 
7961                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7962   
7963   // to be polished:
7964   five6n1n5n1n1n = (reQ6nQ1nQ5nstarQ1nstarQ1nstar
7965                  - reQ6nQ1nQ5nstarQ2nstar
7966                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7967                  - reQ6nQ4nstarQ1nstarQ1nstar
7968                  - reQ7nQ5nstarQ1nstarQ1nstar 
7969                              - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7970                  - dMult*reQ6nQ5nstarQ1nstar
7971                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7972                  + reQ7nQ6nstarQ1nstar
7973                  + 3.*reQ6nQ5nstarQ1nstar
7974                  + 2.*reQ7nQ6nstarQ1nstar
7975                  + reQ6nQ4nstarQ2nstar
7976                  + reQ7nQ5nstarQ2nstar
7977                  + dMult*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7978                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7979                  + reQ7nQ6nstarQ1nstar
7980                  + reQ5nQ4nstarQ1nstar
7981                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
7982                  + 3.*reQ2nQ1nstarQ1nstar
7983                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7984                  + 2.*reQ5nQ4nstarQ1nstar
7985                  + 3.*reQ6nQ5nstarQ1nstar
7986                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7987                  + reQ5nQ4nstarQ1nstar
7988                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7989                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7990                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7991                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
7992                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7993                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7994                  - 2.*dMult*dMult
7995                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
7996                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7997                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7998                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7999                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8000                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.)) 
8001                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8002   five6n2n4n2n2n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))*(dReQ2n*dReQ4n*dReQ6n-dReQ6n*dImQ2n*dImQ4n
8003                  + dReQ4n*dImQ2n*dImQ6n+dReQ2n*dImQ4n*dImQ6n)
8004                  - ((dReQ8n*dReQ4n+dImQ8n*dImQ4n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
8005                  + 2.*dReQ2n*dImQ2n*(dImQ8n*dReQ4n-dReQ8n*dImQ4n)) 
8006                  - (dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
8007                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3))
8008                  - ((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
8009                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
8010                  + 4.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
8011                  + pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n
8012                  - (2.*dMult-13.)*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
8013                  + dImQ6n*dImQ4n*dReQ2n)
8014                  + 7.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
8015                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
8016                  + 2.*(dMult-5.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8017                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8018                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8019                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8020                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)
8021                  + 2.*(3.*dMult-11.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*dMult*(dMult-6.))
8022                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8023   five6n4n4n4n2n = ((pow(dImQ4n,2.)+pow(dReQ4n,2.))*(dImQ4n*dImQ6n*dReQ2n+dImQ2n*dImQ6n*dReQ4n 
8024                  - dImQ2n*dImQ4n*dReQ6n+dReQ2n*dReQ4n*dReQ6n)
8025                  - (-pow(dImQ4n,2.)*dImQ2n*dImQ10n+dImQ2n*dImQ10n*pow(dReQ4n,2.)
8026                  + 2.*dImQ4n*dImQ10n*dReQ4n*dReQ2n-2.*dImQ4n*dImQ2n*dReQ4n*dReQ10n 
8027                  - pow(dImQ4n,2.)*dReQ2n*dReQ10n+pow(dReQ4n,2.)*dReQ2n*dReQ10n)
8028                  - (dImQ2n*dImQ4n*dImQ6n*dImQ8n+dImQ6n*dImQ8n*dReQ2n*dReQ4n 
8029                  + dImQ4n*dImQ8n*dReQ2n*dReQ6n-dImQ2n*dImQ8n*dReQ4n*dReQ6n
8030                  - dImQ4n*dImQ6n*dReQ2n*dReQ8n+dImQ2n*dImQ6n*dReQ4n*dReQ8n 
8031                  + dImQ2n*dImQ4n*dReQ6n*dReQ8n+dReQ2n*dReQ4n*dReQ6n*dReQ8n)
8032                  - ((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
8033                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
8034                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8035                  + (dReQ10n*dReQ8n*dReQ2n-dReQ10n*dImQ8n*dImQ2n+dImQ10n*dReQ8n*dImQ2n+dImQ10n*dImQ8n*dReQ2n)
8036                  + 4.*(dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
8037                  + dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n)
8038                  + 3.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
8039                  - 2.*(dMult-6.)*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
8040                  + 4.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
8041                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
8042                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))+2.*(dMult-5.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8043                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8044                  - pow((pow(dReQ4n,2.)+pow(dImQ4n,2.)),2.)+2.*(3.*dMult-10.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8045                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*dMult*(dMult-6.))
8046                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8047   // to be polished:
8048   five6n2n2n5n5n = (reQ6nQ2nQ2nQ5nstarQ5nstar
8049                  - reQ6nQ4nQ5nstarQ5nstar-reQ8nQ2nQ5nstarQ5nstar-reQ8nQ2nQ5nstarQ5nstar
8050                                  - reQ6nQ2nQ5nstarQ3nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ6nQ2nQ5nstarQ3nstar
8051                                  - reQ10nQ6nstarQ2nstarQ2nstar-reQ6nQ2nQ5nstarQ3nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ6nQ2nQ5nstarQ3nstar
8052                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ10nQ5nstarQ5nstar)
8053                                  + reQ5nQ4nstarQ1nstar+reQ8nQ5nstarQ3nstar+reQ8nQ5nstarQ3nstar
8054                  + reQ10nQ8nstarQ2nstar+reQ10nQ6nstarQ4nstar+reQ10nQ8nstarQ2nstar
8055                                  + reQ5nQ4nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
8056                                  + reQ8nQ5nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                                                           
8057                                  + reQ8nQ5nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                           
8058                  + 2.*(reQ8nQ6nstarQ2nstar+reQ8nQ6nstarQ2nstar+reQ4nQ2nstarQ2nstar)
8059                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar)
8060                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8061                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8062                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.))
8063                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8064                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
8065                                  + 24.*dMult) 
8066                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8067   // to be polished:
8068   five6n5n5n5n1n = (reQ6nQ5nQ5nstarQ5nstarQ1nstar
8069                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8070                  - reQ10nQ1nQ6nstarQ5nstar
8071                  - dMult*reQ6nQ5nstarQ1nstar
8072                  - reQ11nQ5nstarQ5nstarQ1nstar 
8073                              - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8074                  - reQ6nQ4nQ5nstarQ5nstar
8075                  + reQ5nQ4nstarQ1nstar
8076                  + reQ11nQ6nstarQ5nstar
8077                  + 3.*reQ6nQ5nstarQ1nstar
8078                  + 2.*reQ11nQ6nstarQ5nstar
8079                  + dMult*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8080                  + reQ11nQ6nstarQ5nstar
8081                  + reQ10nQ6nstarQ4nstar
8082                  + reQ5nQ4nstarQ1nstar
8083                  + reQ11nQ10nstarQ1nstar
8084                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8085                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
8086                  + 3.*reQ6nQ5nstarQ1nstar
8087                  + reQ5nQ4nstarQ1nstar
8088                  + 2.*dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8089                  + 3.*reQ10nQ5nstarQ5nstar
8090                  + reQ5nQ4nstarQ1nstar
8091                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8092                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8093                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8094                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8095                                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))
8096                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8097                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
8098                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8099                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.)) 
8100                  - 2.*dMult*dMult
8101                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8102                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8103                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8104                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
8105                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8106   // to be polished:
8107   five6n6n5n5n2n = (reQ6nQ6nQ5nstarQ5nstarQ2nstar
8108                  - reQ7nQ5nQ6nstarQ6nstar-reQ7nQ5nQ6nstarQ6nstar-reQ10nQ2nQ6nstarQ6nstar
8109                  - reQ6nQ1nQ5nstarQ2nstar-reQ6nQ1nQ5nstarQ2nstar-reQ6nQ4nQ5nstarQ5nstar
8110                                  - reQ12nQ5nstarQ5nstarQ2nstar-reQ6nQ4nQ5nstarQ5nstar-reQ6nQ1nQ5nstarQ2nstar-reQ6nQ1nQ5nstarQ2nstar
8111                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ12nQ6nstarQ6nstar)
8112                                  + reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ10nQ6nstarQ4nstar
8113                  + reQ12nQ10nstarQ2nstar+reQ12nQ7nstarQ5nstar+reQ12nQ7nstarQ5nstar
8114                                  + reQ7nQ6nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ5nQ4nstarQ1nstar                           
8115                                  + reQ7nQ6nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ5nQ4nstarQ1nstar
8116                                  + reQ10nQ6nstarQ4nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar                          
8117                  + 2.*(reQ10nQ5nstarQ5nstar+reQ7nQ5nstarQ2nstar+reQ7nQ5nstarQ2nstar)
8118                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar)
8119                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8120                  - 2.*(pow(dReQ12n,2.)+pow(dImQ12n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8121                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ10n,2.)+pow(dImQ10n,2.))
8122                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8123                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
8124                                  + 24.*dMult) 
8125                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8126   five6n6n6n4n2n = ((pow(dImQ6n,2.)+pow(dReQ6n,2.))*(dImQ4n*dImQ6n*dReQ2n+dImQ2n*dImQ6n*dReQ4n
8127                  - dImQ2n*dImQ4n*dReQ6n+dReQ2n*dReQ4n*dReQ6n)
8128                  - (dReQ2n*dReQ4n*dReQ6n*dReQ12n-dReQ6n*dReQ12n*dImQ2n*dImQ4n
8129                  - dReQ4n*dReQ12n*dImQ2n*dImQ6n-dReQ2n*dReQ12n*dImQ4n*dImQ6n
8130                  + dReQ4n*dReQ6n*dImQ2n*dImQ12n+dReQ2n*dReQ6n*dImQ4n*dImQ12n 
8131                  + dReQ2n*dReQ4n*dImQ6n*dImQ12n-dImQ2n*dImQ4n*dImQ6n*dImQ12n)
8132                  - (dImQ2n*pow(dImQ6n,2.)*dImQ10n+2.*dImQ6n*dImQ10n*dReQ2n*dReQ6n
8133                  - dImQ2n*dImQ10n*pow(dReQ6n,2.)-pow(dImQ6n,2.)*dReQ2n*dReQ10n 
8134                  + 2.*dImQ2n*dImQ6n*dReQ6n*dReQ10n+dReQ2n*pow(dReQ6n,2.)*dReQ10n)
8135                  - ((dReQ8n*dReQ4n-dImQ8n*dImQ4n)*(dReQ6n*dReQ6n-dImQ6n*dImQ6n)
8136                  + 2.*(dReQ8n*dImQ4n+dImQ8n*dReQ4n)*dReQ6n*dImQ6n)
8137                  + dReQ12n*dReQ10n*dReQ2n-dReQ12n*dImQ10n*dImQ2n+dImQ12n*dReQ10n*dImQ2n+dImQ12n*dImQ10n*dReQ2n
8138                  + dReQ12n*dReQ8n*dReQ4n-dReQ12n*dImQ8n*dImQ4n+dImQ12n*dReQ8n*dImQ4n+dImQ12n*dImQ8n*dReQ4n
8139                  + 3.*(pow(dReQ6n,2.)*dReQ12n+2.*dReQ6n*dImQ6n*dImQ12n-pow(dImQ6n,2.)*dReQ12n)
8140                  + 4.*(dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
8141                  + 4.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
8142                  - 2.*(dMult-6.)*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
8143                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
8144                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8145                  - 2.*(pow(dReQ12n,2.)+pow(dImQ12n,2.))-2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
8146                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))+2.*(3.*dMult-10.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8147                  - pow((pow(dReQ6n,2.)+pow(dImQ6n,2.)),2.)+2.*(dMult-5.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8148                  + 2.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*dMult*(dMult-6.))
8149                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8150   // to be polished (and  TBI swap with the one above):
8151   five6n6n6n5n1n = (reQ6nQ6nQ6nstarQ5nstarQ1nstar
8152                  - reQ7nQ5nQ6nstarQ6nstar
8153                  - reQ11nQ1nQ6nstarQ6nstar
8154                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8155                  - reQ12nQ6nstarQ5nstarQ1nstar 
8156                              - dMult*reQ6nQ5nstarQ1nstar
8157                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8158                  + reQ6nQ5nstarQ1nstar
8159                  + reQ12nQ6nstarQ6nstar
8160                  + 3.*dMult*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8161                  + 2.*reQ12nQ6nstarQ6nstar
8162                  + reQ7nQ6nstarQ1nstar
8163                  + reQ12nQ7nstarQ5nstar
8164                  + reQ11nQ6nstarQ5nstar
8165                  + reQ6nQ5nstarQ1nstar
8166                  + reQ12nQ11nstarQ1nstar
8167                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8168                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
8169                  + 3.*reQ7nQ6nstarQ1nstar
8170                  + reQ6nQ5nstarQ1nstar
8171                  + 2.*reQ6nQ5nstarQ1nstar
8172                  + 3.*reQ11nQ6nstarQ5nstar
8173                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8174                  + reQ6nQ5nstarQ1nstar
8175                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8176                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8177                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8178                                  - 2.*(pow(dReQ12n,2.)+pow(dImQ12n,2.))
8179                  - 2.*dMult*dMult
8180                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
8181                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8182                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.)) 
8183                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8184                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8185                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8186                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8187                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
8188                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8189   // Four distinct harmonics (11):
8190   // to be polished:
8191   five5n2n3n3n1n = (reQ5nQ2nQ3nstarQ3nstarQ1nstar
8192                  - reQ5nQ2nQ4nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar-reQ6nQ1nQ5nstarQ2nstar
8193                                  - reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ1nQ3nstarQ3nstar                  
8194                                  - reQ7nQ3nstarQ3nstarQ1nstar-reQ4nQ2nQ3nstarQ3nstar-reQ3nQ1nQ2nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar
8195                                  + 2.*(reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ7nQ5nstarQ2nstar)
8196                                  + reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ6nQ5nstarQ1nstar
8197                                  + reQ7nQ6nstarQ1nstar+reQ7nQ4nstarQ3nstar+reQ7nQ4nstarQ3nstar
8198                                  + reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar
8199                                  + reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar
8200                                  + reQ6nQ4nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
8201                                  + 2.*(reQ6nQ3nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8202                                  + 2.*(reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8203                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8204                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
8205                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
8206                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8207                                  - 6.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8208                                  + 24.*dMult) 
8209                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8210   // to be polished:
8211   five5n1n1n4n3n = (reQ5nQ1nQ1nQ4nstarQ3nstar
8212                  - reQ5nQ2nQ4nstarQ3nstar-reQ6nQ1nQ4nstarQ3nstar-reQ6nQ1nQ4nstarQ3nstar
8213                                  - reQ5nQ1nQ4nstarQ2nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar
8214                                  - reQ7nQ5nstarQ1nstarQ1nstar-reQ5nQ1nQ3nstarQ3nstar-reQ3nQ1nstarQ1nstarQ1nstar-reQ5nQ1nQ3nstarQ3nstar
8215                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ7nQ4nstarQ3nstar)
8216                                  + reQ4nQ2nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar
8217                  + reQ7nQ6nstarQ1nstar+reQ7nQ5nstarQ2nstar+reQ7nQ6nstarQ1nstar
8218                                  + reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar
8219                                  + reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar                                                                                           
8220                                  + reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar                                                           
8221                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8222                  + 2.*(reQ5nQ3nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8223                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8224                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8225                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
8226                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
8227                                  - 6.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8228                                  + 24.*dMult) 
8229                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8230   // to be polished:
8231   five5n3n4n2n2n = (reQ5nQ3nQ4nstarQ2nstarQ2nstar
8232                  - reQ5nQ3nQ4nstarQ4nstar-reQ6nQ2nQ5nstarQ3nstar-reQ6nQ2nQ5nstarQ3nstar
8233                                  - reQ5nQ1nQ4nstarQ2nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar                      
8234                                  - reQ8nQ4nstarQ2nstarQ2nstar-reQ4nQ2nQ3nstarQ3nstar-reQ3nQ1nQ2nstarQ2nstar-reQ4nQ2nQ3nstarQ3nstar
8235                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ8nQ5nstarQ3nstar)
8236                                  + reQ5nQ4nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar
8237                  + reQ8nQ6nstarQ2nstar+reQ8nQ4nstarQ4nstar+reQ8nQ6nstarQ2nstar
8238                                  + reQ4nQ3nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar
8239                                  + reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar
8240                                  + reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar
8241                                  + 2.*(reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ4nQ2nstarQ2nstar)
8242                                  + 2.*(reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8243                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8244                                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8245                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
8246                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8247                                  - 6.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
8248                                  + 24.*dMult) 
8249                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8250
8251   // to be polished!!!:
8252   five5n2n1n4n4n = (reQ5nQ2nQ1nQ4nstarQ4nstar
8253                  - reQ5nQ3nQ4nstarQ4nstar-reQ6nQ2nQ4nstarQ4nstar-reQ7nQ1nQ4nstarQ4nstar
8254                                  - reQ5nQ1nQ4nstarQ2nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ5nQ2nQ4nstarQ3nstar
8255                                  - reQ8nQ5nstarQ2nstarQ1nstar-reQ5nQ2nQ4nstarQ3nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar
8256                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ8nQ4nstarQ4nstar)
8257                                  + reQ4nQ3nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ7nQ4nstarQ3nstar
8258                  + reQ8nQ7nstarQ1nstar+reQ8nQ5nstarQ3nstar+reQ8nQ6nstarQ2nstar
8259                                  + reQ4nQ3nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar
8260                                  + reQ6nQ4nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ5nQ3nstarQ2nstar                                                                                           
8261                                  + reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar                                                           
8262                  + 2.*(reQ7nQ5nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8263                  + 2.*(reQ5nQ4nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar)
8264                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8265                                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8266                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
8267                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8268                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8269                                  + 24.*dMult) 
8270                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8271
8272
8273   // to be polished:
8274   five6n1n3n2n2n = (reQ6nQ1nQ3nstarQ2nstarQ2nstar
8275                  - reQ6nQ1nQ4nstarQ3nstar-reQ6nQ1nQ5nstarQ2nstar-reQ6nQ1nQ5nstarQ2nstar
8276                  - reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ2nstarQ2nstarQ2nstar-reQ6nQ3nstarQ2nstarQ1nstar                      
8277                                  - reQ7nQ3nstarQ2nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar
8278                                  + 2.*(reQ6nQ3nstarQ3nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ7nQ6nstarQ1nstar)
8279                                  + reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar
8280                  + reQ7nQ5nstarQ2nstar+reQ7nQ4nstarQ3nstar+reQ7nQ5nstarQ2nstar
8281                                  + reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
8282                                  + reQ5nQ4nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar
8283                                  + reQ5nQ4nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar
8284                                  + 2.*(reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ4nQ2nstarQ2nstar)
8285                                  + 2.*(reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8286                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8287                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
8288                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.))
8289                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
8290                                  - 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
8291                                  + 24.*dMult) 
8292                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8293
8294
8295   // to be polished:
8296   five6n3n4n4n1n = (reQ6nQ3nQ4nstarQ4nstarQ1nstar
8297                  - reQ8nQ1nQ6nstarQ3nstar-reQ6nQ3nQ5nstarQ4nstar-reQ6nQ3nQ5nstarQ4nstar
8298                                  - reQ6nQ4nstarQ1nstarQ1nstar-reQ6nQ2nQ4nstarQ4nstar-reQ6nQ4nstarQ1nstarQ1nstar                  
8299                                  - reQ9nQ4nstarQ4nstarQ1nstar-reQ4nQ1nQ3nstarQ2nstar-reQ5nQ3nQ4nstarQ4nstar-reQ4nQ1nQ3nstarQ2nstar
8300                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ9nQ6nstarQ3nstar)
8301                                  + reQ8nQ6nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar
8302                  + reQ9nQ5nstarQ4nstar+reQ9nQ8nstarQ1nstar+reQ9nQ5nstarQ4nstar
8303                                  + reQ8nQ5nstarQ3nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar                           
8304                                  + reQ5nQ3nstarQ2nstar+reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar                           
8305                                  + reQ5nQ3nstarQ2nstar+reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar
8306                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ8nQ4nstarQ4nstar)
8307                  + 2.*(reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8308                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8309                                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.))
8310                                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.))
8311                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
8312                                  - 6.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.))
8313                  + 24.*dMult) 
8314                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8315
8316   // to be polished:
8317   five6n1n1n5n3n = (reQ6nQ1nQ1nQ5nstarQ3nstar
8318                  - reQ6nQ2nQ5nstarQ3nstar-reQ7nQ1nQ5nstarQ3nstar-reQ7nQ1nQ5nstarQ3nstar
8319                  - reQ6nQ1nQ5nstarQ2nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ6nQ1nQ5nstarQ2nstar
8320                                  - reQ8nQ6nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar-reQ3nQ1nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
8321                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ8nQ5nstarQ3nstar)
8322                                  + reQ5nQ3nstarQ2nstar+reQ7nQ5nstarQ2nstar+reQ7nQ5nstarQ2nstar
8323                  + reQ8nQ7nstarQ1nstar+reQ8nQ6nstarQ2nstar+reQ8nQ7nstarQ1nstar
8324                                  + reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar
8325                                  + reQ7nQ4nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ6nQ4nstarQ2nstar                                                                                           
8326                                  + reQ7nQ4nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ6nQ4nstarQ2nstar                                                                                           
8327                  + 2.*(reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8328                  + 2.*(reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8329                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8330                                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8331                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
8332                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
8333                  - 6.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8334                  + 24.*dMult) 
8335                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8336   // to be polished:
8337   five6n3n5n2n2n = (reQ6nQ3nQ5nstarQ2nstarQ2nstar
8338                  - reQ6nQ3nQ5nstarQ4nstar-reQ7nQ2nQ6nstarQ3nstar-reQ7nQ2nQ6nstarQ3nstar
8339                  - reQ6nQ1nQ5nstarQ2nstar-reQ6nQ2nstarQ2nstarQ2nstar-reQ6nQ1nQ5nstarQ2nstar                      
8340                                  - reQ9nQ5nstarQ2nstarQ2nstar-reQ5nQ2nQ4nstarQ3nstar-reQ3nQ1nQ2nstarQ2nstar-reQ5nQ2nQ4nstarQ3nstar
8341                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ9nQ6nstarQ3nstar)
8342                                  + reQ6nQ4nstarQ2nstar+reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar
8343                  + reQ9nQ7nstarQ2nstar+reQ9nQ5nstarQ4nstar+reQ9nQ7nstarQ2nstar
8344                                  + reQ4nQ3nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar                           
8345                                  + reQ7nQ4nstarQ3nstar+reQ4nQ2nstarQ2nstar+reQ5nQ4nstarQ1nstar                           
8346                                  + reQ7nQ4nstarQ3nstar+reQ4nQ2nstarQ2nstar+reQ5nQ4nstarQ1nstar
8347                  + 2.*(reQ7nQ5nstarQ2nstar+reQ7nQ5nstarQ2nstar+reQ4nQ2nstarQ2nstar)
8348                  + 2.*(reQ5nQ3nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8349                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8350                                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8351                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
8352                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
8353                                  - 6.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
8354                  + 24.*dMult) 
8355                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8356
8357   // to be polished 
8358   five6n5n4n4n3n = (reQ6nQ5nQ4nstarQ4nstarQ3nstar
8359                  - reQ7nQ4nQ6nstarQ5nstar-reQ7nQ4nQ6nstarQ5nstar-reQ8nQ3nQ6nstarQ5nstar
8360                  - reQ6nQ1nQ4nstarQ3nstar-reQ6nQ1nQ4nstarQ3nstar-reQ6nQ2nQ4nstarQ4nstar                  
8361                                  - reQ11nQ4nstarQ4nstarQ3nstar-reQ5nQ3nQ4nstarQ4nstar-reQ5nQ2nQ4nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar
8362                                  + 2.*(reQ6nQ4nstarQ2nstar+reQ6nQ3nstarQ3nstar+reQ6nQ4nstarQ2nstar+reQ11nQ6nstarQ5nstar)
8363                                  + reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ8nQ6nstarQ2nstar
8364                  + reQ11nQ8nstarQ3nstar+reQ11nQ7nstarQ4nstar+reQ11nQ7nstarQ4nstar
8365                                  + reQ7nQ5nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ2nstarQ2nstar                                                           
8366                                  + reQ7nQ5nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ2nstarQ2nstar                           
8367                                  + reQ8nQ5nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
8368                  + 2.*(reQ8nQ4nstarQ4nstar+reQ7nQ4nstarQ3nstar+reQ7nQ4nstarQ3nstar)
8369                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar)
8370                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8371                                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
8372                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.))
8373                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))                                
8374                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
8375                                  + 24.*dMult) 
8376                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8377   // to be polished:
8378   five6n3n1n5n5n = (reQ6nQ3nQ1nQ5nstarQ5nstar
8379                  - reQ6nQ4nQ5nstarQ5nstar-reQ7nQ3nQ5nstarQ5nstar-reQ9nQ1nQ5nstarQ5nstar      
8380                                  - reQ6nQ1nQ5nstarQ2nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ6nQ3nQ5nstarQ4nstar
8381                                  - reQ10nQ6nstarQ3nstarQ1nstar-reQ6nQ3nQ5nstarQ4nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ6nQ1nQ5nstarQ2nstar
8382                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ10nQ5nstarQ5nstar)
8383                                  + reQ5nQ4nstarQ1nstar+reQ7nQ5nstarQ2nstar+reQ9nQ5nstarQ4nstar
8384                  + reQ10nQ9nstarQ1nstar+reQ10nQ6nstarQ4nstar+reQ10nQ7nstarQ3nstar
8385                                  + reQ5nQ4nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ4nQ3nstarQ1nstar
8386                                  + reQ7nQ5nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ6nQ4nstarQ2nstar                                                                                           
8387                                  + reQ9nQ5nstarQ4nstar+reQ4nQ3nstarQ1nstar+reQ6nQ4nstarQ2nstar                                                                                           
8388                  + 2.*(reQ9nQ6nstarQ3nstar+reQ7nQ6nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8389                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar)
8390                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8391                                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8392                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ9n,2.)+pow(dImQ9n,2.))
8393                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8394                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8395                  + 24.*dMult) 
8396                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8397   // to be polished:
8398   five6n6n5n4n3n = (reQ6nQ6nQ5nstarQ4nstarQ3nstar
8399                  - reQ7nQ5nQ6nstarQ6nstar-reQ8nQ4nQ6nstarQ6nstar-reQ9nQ3nQ6nstarQ6nstar
8400                                  - reQ6nQ2nQ5nstarQ3nstar-reQ6nQ1nQ4nstarQ3nstar-reQ6nQ3nQ5nstarQ4nstar                  
8401                                  - reQ12nQ5nstarQ4nstarQ3nstar-reQ6nQ3nQ5nstarQ4nstar-reQ6nQ1nQ4nstarQ3nstar-reQ6nQ2nQ5nstarQ3nstar
8402                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ3nstarQ3nstar+reQ6nQ4nstarQ2nstar+reQ12nQ6nstarQ6nstar)
8403                                  + reQ7nQ6nstarQ1nstar+reQ8nQ6nstarQ2nstar+reQ9nQ6nstarQ3nstar
8404                  + reQ12nQ9nstarQ3nstar+reQ12nQ7nstarQ5nstar+reQ12nQ8nstarQ4nstar
8405                                  + reQ7nQ6nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar                                                           
8406                                  + reQ8nQ6nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar                           
8407                                  + reQ9nQ6nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ5nQ3nstarQ2nstar
8408                  + 2.*(reQ9nQ5nstarQ4nstar+reQ8nQ5nstarQ3nstar+reQ7nQ4nstarQ3nstar)
8409                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ3nstarQ3nstar)
8410                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8411                                  - 2.*(pow(dReQ12n,2.)+pow(dImQ12n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8412                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ9n,2.)+pow(dImQ9n,2.))
8413                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))                                
8414                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
8415                                  + 24.*dMult) 
8416                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8417   // Five distinct harmonics (3):
8418
8419   // to be polished:
8420   five6n2n4n3n1n = (reQ6nQ2nQ4nstarQ3nstarQ1nstar
8421                      - reQ6nQ2nQ4nstarQ4nstar-reQ6nQ2nQ5nstarQ3nstar-reQ7nQ1nQ6nstarQ2nstar
8422                      - reQ6nQ4nstarQ1nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
8423                      - reQ8nQ4nstarQ3nstarQ1nstar-reQ5nQ2nQ4nstarQ3nstar-reQ3nQ1nQ2nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar
8424                                  + 2.*(reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ6nQ3nstarQ3nstar+reQ8nQ6nstarQ2nstar)
8425                                  + 1.*(reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ7nQ6nstarQ1nstar)
8426                                  + 1.*(reQ8nQ7nstarQ1nstar+reQ8nQ4nstarQ4nstar+reQ8nQ5nstarQ3nstar)
8427                                  + 1.*(reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8428                                  + 1.*(reQ5nQ3nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8429                                  + 1.*(reQ7nQ5nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar)
8430                                  + 2.*(reQ7nQ4nstarQ3nstar+reQ5nQ4nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8431                                  + 2.*(reQ4nQ2nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar) // 3 - 1
8432                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8433                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
8434                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
8435                          - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
8436                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
8437                  + 24.*dMult) 
8438                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8439
8440
8441   // to be polished:
8442   five6n2n1n5n4n = (reQ6nQ2nQ1nQ5nstarQ4nstar
8443                  - reQ6nQ3nQ5nstarQ4nstar-reQ7nQ2nQ5nstarQ4nstar-reQ8nQ1nQ5nstarQ4nstar
8444                                  - reQ6nQ1nQ5nstarQ2nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ6nQ2nQ5nstarQ3nstar                      
8445                                  - reQ9nQ6nstarQ2nstarQ1nstar-reQ6nQ2nQ4nstarQ4nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
8446                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ9nQ5nstarQ4nstar)
8447                                  + reQ5nQ3nstarQ2nstar+reQ7nQ5nstarQ2nstar+reQ8nQ5nstarQ3nstar
8448                  + reQ9nQ8nstarQ1nstar+reQ9nQ6nstarQ3nstar+reQ9nQ7nstarQ2nstar
8449                                  + reQ4nQ3nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar                           
8450                                  + reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                           
8451                                  + reQ8nQ4nstarQ4nstar+reQ4nQ2nstarQ2nstar+reQ6nQ4nstarQ2nstar
8452                  + 2.*(reQ8nQ6nstarQ2nstar+reQ7nQ6nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8453                  + 2.*(reQ6nQ4nstarQ2nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar)
8454                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8455                                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8456                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.))
8457                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
8458                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8459                  + 24.*dMult) 
8460                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8461
8462
8463
8464   // to be polished:
8465   five6n4n5n3n2n = (reQ6nQ4nQ5nstarQ3nstarQ2nstar
8466                      - reQ6nQ4nQ5nstarQ5nstar-reQ7nQ3nQ6nstarQ4nstar-reQ8nQ2nQ6nstarQ4nstar
8467                      - reQ6nQ1nQ5nstarQ2nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ2nQ5nstarQ3nstar
8468                      - reQ10nQ5nstarQ3nstarQ2nstar-reQ5nQ3nQ4nstarQ4nstar-reQ4nQ1nQ3nstarQ2nstar-reQ5nQ2nQ4nstarQ3nstar
8469                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ3nstarQ3nstar+reQ10nQ6nstarQ4nstar)
8470                                  + 1.*(reQ6nQ5nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ8nQ6nstarQ2nstar)
8471                                  + 1.*(reQ10nQ8nstarQ2nstar+reQ10nQ5nstarQ5nstar+reQ10nQ7nstarQ3nstar)
8472                                  + 1.*(reQ5nQ4nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8473                                  + 1.*(reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar)
8474                                  + 1.*(reQ8nQ4nstarQ4nstar+reQ4nQ3nstarQ1nstar+reQ5nQ4nstarQ1nstar)
8475                                  + 2.*(reQ8nQ5nstarQ3nstar+reQ7nQ5nstarQ2nstar+reQ5nQ3nstarQ2nstar)
8476                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar) // 3 - 1
8477                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8478                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
8479                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
8480                          - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
8481                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
8482                  + 24.*dMult) 
8483                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8484
8485
8486
8487   f5pCorrelations->Fill(0.5,five3n2n3n1n1n,d5pMultiplicityWeight);
8488   f5pCorrelations->Fill(1.5,five4n1n2n2n1n,d5pMultiplicityWeight); 
8489   f5pCorrelations->Fill(2.5,five4n2n3n2n1n,d5pMultiplicityWeight);
8490   f5pCorrelations->Fill(3.5,five4n3n3n2n2n,d5pMultiplicityWeight);
8491   f5pCorrelations->Fill(4.5,five4n2n4n1n1n,d5pMultiplicityWeight);
8492   f5pCorrelations->Fill(5.5,five4n3n4n2n1n,d5pMultiplicityWeight);
8493   f5pCorrelations->Fill(6.5,five5n1n3n2n1n,d5pMultiplicityWeight);
8494   f5pCorrelations->Fill(7.5,five5n2n5n1n1n,d5pMultiplicityWeight);
8495   f5pCorrelations->Fill(8.5,five5n2n4n2n1n,d5pMultiplicityWeight);
8496   f5pCorrelations->Fill(9.5,five5n3n4n3n1n,d5pMultiplicityWeight);
8497   f5pCorrelations->Fill(10.5,five5n4n4n3n2n,d5pMultiplicityWeight);
8498   f5pCorrelations->Fill(11.5,five5n3n5n2n1n,d5pMultiplicityWeight);
8499   f5pCorrelations->Fill(12.5,five5n4n5n2n2n,d5pMultiplicityWeight);
8500   f5pCorrelations->Fill(13.5,five5n4n5n3n1n,d5pMultiplicityWeight);
8501   f5pCorrelations->Fill(14.5,five6n1n3n3n1n,d5pMultiplicityWeight);
8502   f5pCorrelations->Fill(15.5,five6n2n3n3n2n,d5pMultiplicityWeight); 
8503   f5pCorrelations->Fill(16.5,five6n1n4n2n1n,d5pMultiplicityWeight); 
8504   f5pCorrelations->Fill(17.5,five6n3n4n3n2n,d5pMultiplicityWeight); 
8505   f5pCorrelations->Fill(18.5,five6n4n4n3n3n,d5pMultiplicityWeight); 
8506   f5pCorrelations->Fill(19.5,five6n2n5n2n1n,d5pMultiplicityWeight); 
8507   f5pCorrelations->Fill(20.5,five6n3n5n3n1n,d5pMultiplicityWeight); 
8508   f5pCorrelations->Fill(21.5,five6n4n5n4n1n,d5pMultiplicityWeight); 
8509   f5pCorrelations->Fill(22.5,five6n5n5n3n3n,d5pMultiplicityWeight); 
8510   f5pCorrelations->Fill(23.5,five6n2n6n1n1n,d5pMultiplicityWeight); 
8511   f5pCorrelations->Fill(24.5,five6n3n6n2n1n,d5pMultiplicityWeight); 
8512   f5pCorrelations->Fill(25.5,five6n4n6n2n2n,d5pMultiplicityWeight); 
8513   f5pCorrelations->Fill(26.5,five6n4n6n3n1n,d5pMultiplicityWeight); 
8514   f5pCorrelations->Fill(27.5,five6n5n5n4n2n,d5pMultiplicityWeight); 
8515   f5pCorrelations->Fill(28.5,five6n5n6n3n2n,d5pMultiplicityWeight); 
8516   f5pCorrelations->Fill(29.5,five6n5n6n4n1n,d5pMultiplicityWeight);
8517   //f5pCorrelations->Fill(30.5,-44.,d5pMultiplicityWeight);
8518   f5pCorrelations->Fill(31.5,five2n1n1n1n1n,d5pMultiplicityWeight);
8519   f5pCorrelations->Fill(32.5,five2n2n2n1n1n,d5pMultiplicityWeight); 
8520   f5pCorrelations->Fill(33.5,five3n3n2n2n2n,d5pMultiplicityWeight);
8521   f5pCorrelations->Fill(34.5,five4n1n1n1n1n,d5pMultiplicityWeight);
8522   f5pCorrelations->Fill(35.5,five4n2n2n2n2n,d5pMultiplicityWeight); 
8523   f5pCorrelations->Fill(36.5,five4n4n4n2n2n,d5pMultiplicityWeight); 
8524   f5pCorrelations->Fill(37.5,five6n3n3n3n3n,d5pMultiplicityWeight); 
8525   f5pCorrelations->Fill(38.5,five6n6n4n4n4n,d5pMultiplicityWeight); 
8526   f5pCorrelations->Fill(39.5,five6n6n6n3n3n,d5pMultiplicityWeight);
8527   //f5pCorrelations->Fill(40.5,-44.,d5pMultiplicityWeight);
8528   f5pCorrelations->Fill(41.5,five3n1n2n1n1n,d5pMultiplicityWeight);
8529   f5pCorrelations->Fill(42.5,five3n2n2n2n1n,d5pMultiplicityWeight);
8530   f5pCorrelations->Fill(43.5,five3n3n3n2n1n,d5pMultiplicityWeight);
8531   f5pCorrelations->Fill(44.5,five4n1n3n1n1n,d5pMultiplicityWeight);
8532   f5pCorrelations->Fill(45.5,five4n1n1n3n3n,d5pMultiplicityWeight);
8533   f5pCorrelations->Fill(46.5,five4n3n3n3n1n,d5pMultiplicityWeight);
8534   f5pCorrelations->Fill(47.5,five4n4n3n3n2n,d5pMultiplicityWeight);
8535   f5pCorrelations->Fill(48.5,five4n4n4n3n1n,d5pMultiplicityWeight);
8536   f5pCorrelations->Fill(49.5,five5n2n1n1n1n,d5pMultiplicityWeight);
8537   f5pCorrelations->Fill(50.5,five5n1n2n2n2n,d5pMultiplicityWeight);
8538   f5pCorrelations->Fill(51.5,five5n2n3n2n2n,d5pMultiplicityWeight);
8539   f5pCorrelations->Fill(52.5,five5n3n3n3n2n,d5pMultiplicityWeight);
8540   f5pCorrelations->Fill(53.5,five5n1n4n1n1n,d5pMultiplicityWeight);
8541   f5pCorrelations->Fill(54.5,five5n4n3n3n3n,d5pMultiplicityWeight);
8542   f5pCorrelations->Fill(55.5,five5n4n4n4n1n,d5pMultiplicityWeight);
8543   f5pCorrelations->Fill(56.5,five5n5n4n3n3n,d5pMultiplicityWeight);
8544   f5pCorrelations->Fill(57.5,five5n5n4n4n2n,d5pMultiplicityWeight);
8545   f5pCorrelations->Fill(58.5,five5n5n5n3n2n,d5pMultiplicityWeight);
8546   f5pCorrelations->Fill(59.5,five5n5n5n4n1n,d5pMultiplicityWeight);
8547   f5pCorrelations->Fill(60.5,five6n2n2n1n1n,d5pMultiplicityWeight);
8548   f5pCorrelations->Fill(61.5,five6n3n1n1n1n,d5pMultiplicityWeight);
8549   f5pCorrelations->Fill(62.5,five6n1n1n4n4n,d5pMultiplicityWeight);
8550   f5pCorrelations->Fill(63.5,five6n1n5n1n1n,d5pMultiplicityWeight);
8551   f5pCorrelations->Fill(64.5,five6n2n4n2n2n,d5pMultiplicityWeight);
8552   f5pCorrelations->Fill(65.5,five6n4n4n4n2n,d5pMultiplicityWeight);
8553   f5pCorrelations->Fill(66.5,five6n2n2n5n5n,d5pMultiplicityWeight);
8554   f5pCorrelations->Fill(67.5,five6n5n5n5n1n,d5pMultiplicityWeight);
8555   f5pCorrelations->Fill(68.5,five6n6n5n5n2n,d5pMultiplicityWeight);
8556   f5pCorrelations->Fill(69.5,five6n6n6n4n2n,d5pMultiplicityWeight);
8557   f5pCorrelations->Fill(70.5,five6n6n6n5n1n,d5pMultiplicityWeight);
8558   //f5pCorrelations->Fill(71.5,-44.,d5pMultiplicityWeight);
8559   f5pCorrelations->Fill(72.5,five5n2n3n3n1n,d5pMultiplicityWeight);
8560   f5pCorrelations->Fill(73.5,five5n1n1n4n3n,d5pMultiplicityWeight);
8561   f5pCorrelations->Fill(74.5,five5n3n4n2n2n,d5pMultiplicityWeight);
8562   f5pCorrelations->Fill(75.5,five5n2n1n4n4n,d5pMultiplicityWeight);
8563   f5pCorrelations->Fill(76.5,five6n1n3n2n2n,d5pMultiplicityWeight);
8564   f5pCorrelations->Fill(77.5,five6n3n4n4n1n,d5pMultiplicityWeight);
8565   f5pCorrelations->Fill(78.5,five6n1n1n5n3n,d5pMultiplicityWeight);
8566   f5pCorrelations->Fill(79.5,five6n3n5n2n2n,d5pMultiplicityWeight);
8567   f5pCorrelations->Fill(80.5,five6n5n4n4n3n,d5pMultiplicityWeight);
8568   f5pCorrelations->Fill(81.5,five6n3n1n5n5n,d5pMultiplicityWeight);
8569   f5pCorrelations->Fill(82.5,five6n6n5n4n3n,d5pMultiplicityWeight);
8570   //f5pCorrelations->Fill(83.5,-44.,d5pMultiplicityWeight);
8571   f5pCorrelations->Fill(84.5,five6n2n4n3n1n,d5pMultiplicityWeight);
8572   f5pCorrelations->Fill(85.5,five6n2n1n5n4n,d5pMultiplicityWeight);
8573   f5pCorrelations->Fill(86.5,five6n4n5n3n2n,d5pMultiplicityWeight);
8574   allMixedCorrelators[56]=five3n2n3n1n1n;
8575   allMixedCorrelators[57]=five4n1n2n2n1n;
8576   allMixedCorrelators[58]=five4n2n3n2n1n;
8577   allMixedCorrelators[59]=five4n3n3n2n2n;
8578   allMixedCorrelators[60]=five4n2n4n1n1n;
8579   allMixedCorrelators[61]=five4n3n4n2n1n;
8580   allMixedCorrelators[62]=five5n1n3n2n1n;
8581   allMixedCorrelators[63]=five5n2n5n1n1n;
8582   allMixedCorrelators[64]=five5n2n4n2n1n;
8583   allMixedCorrelators[65]=five5n3n4n3n1n;
8584   allMixedCorrelators[66]=five5n4n4n3n2n;
8585   allMixedCorrelators[67]=five5n3n5n2n1n;
8586   allMixedCorrelators[68]=five5n4n5n2n2n;
8587   allMixedCorrelators[69]=five5n4n5n3n1n;
8588   allMixedCorrelators[70]=five6n1n3n3n1n;
8589   allMixedCorrelators[71]=five6n2n3n3n2n;
8590   allMixedCorrelators[72]=five6n1n4n2n1n;
8591   allMixedCorrelators[73]=five6n3n4n3n2n;
8592   allMixedCorrelators[74]=five6n4n4n3n3n;
8593   allMixedCorrelators[75]=five6n2n5n2n1n;
8594   allMixedCorrelators[76]=five6n3n5n3n1n;
8595   allMixedCorrelators[77]=five6n4n5n4n1n;
8596   allMixedCorrelators[78]=five6n5n5n3n3n;
8597   allMixedCorrelators[79]=five6n2n6n1n1n;
8598   allMixedCorrelators[80]=five6n3n6n2n1n;
8599   allMixedCorrelators[81]=five6n4n6n2n2n;
8600   allMixedCorrelators[82]=five6n4n6n3n1n;
8601   allMixedCorrelators[83]=five6n5n5n4n2n;
8602   allMixedCorrelators[84]=five6n5n6n3n2n;
8603   allMixedCorrelators[85]=five6n5n6n4n1n;
8604   allMixedCorrelators[86]=five2n1n1n1n1n;
8605   allMixedCorrelators[87]=five2n2n2n1n1n;
8606   allMixedCorrelators[88]=five3n3n2n2n2n;
8607   allMixedCorrelators[89]=five4n1n1n1n1n;
8608   allMixedCorrelators[90]=five4n2n2n2n2n;
8609   allMixedCorrelators[91]=five4n4n4n2n2n;
8610   allMixedCorrelators[92]=five6n3n3n3n3n;
8611   allMixedCorrelators[93]=five6n6n4n4n4n;
8612   allMixedCorrelators[94]=five6n6n6n3n3n;
8613   allMixedCorrelators[95]=five3n1n2n1n1n;
8614   allMixedCorrelators[96]=five3n2n2n2n1n;
8615   allMixedCorrelators[97]=five3n3n3n2n1n;
8616   allMixedCorrelators[98]=five4n1n3n1n1n;
8617   allMixedCorrelators[99]=five4n1n1n3n3n;
8618   allMixedCorrelators[100]=five4n3n3n3n1n;
8619   allMixedCorrelators[101]=five4n4n3n3n2n;
8620   allMixedCorrelators[102]=five4n4n4n3n1n;
8621   allMixedCorrelators[103]=five5n2n1n1n1n;
8622   allMixedCorrelators[104]=five5n1n2n2n2n;
8623   allMixedCorrelators[105]=five5n2n3n2n2n;
8624   allMixedCorrelators[106]=five5n3n3n3n2n;
8625   allMixedCorrelators[107]=five5n1n4n1n1n;
8626   allMixedCorrelators[108]=five5n4n3n3n3n;
8627   allMixedCorrelators[109]=five5n4n4n4n1n;
8628   allMixedCorrelators[110]=five5n5n4n3n3n;
8629   allMixedCorrelators[111]=five5n5n4n4n2n;
8630   allMixedCorrelators[112]=five5n5n5n3n2n;
8631   allMixedCorrelators[113]=five5n5n5n4n1n;
8632   allMixedCorrelators[114]=five6n2n2n1n1n;
8633   allMixedCorrelators[115]=five6n3n1n1n1n;
8634   allMixedCorrelators[116]=five6n1n1n4n4n;
8635   allMixedCorrelators[117]=five6n1n5n1n1n;
8636   allMixedCorrelators[118]=five6n2n4n2n2n;
8637   allMixedCorrelators[119]=five6n4n4n4n2n;
8638   allMixedCorrelators[120]=five6n2n2n5n5n;
8639   allMixedCorrelators[121]=five6n5n5n5n1n;
8640   allMixedCorrelators[122]=five6n6n5n5n2n;
8641   allMixedCorrelators[123]=five6n6n6n4n2n;
8642   allMixedCorrelators[124]=five6n6n6n5n1n;
8643   allMixedCorrelators[125]=five5n2n3n3n1n;
8644   allMixedCorrelators[126]=five5n1n1n4n3n;
8645   allMixedCorrelators[127]=five5n3n4n2n2n;
8646   allMixedCorrelators[128]=five5n2n1n4n4n;
8647   allMixedCorrelators[129]=five6n1n3n2n2n;
8648   allMixedCorrelators[130]=five6n3n4n4n1n;
8649   allMixedCorrelators[131]=five6n1n1n5n3n;
8650   allMixedCorrelators[132]=five6n3n5n2n2n;
8651   allMixedCorrelators[133]=five6n5n4n4n3n;
8652   allMixedCorrelators[134]=five6n3n1n5n5n;
8653   allMixedCorrelators[135]=five6n6n5n4n3n;
8654   allMixedCorrelators[136]=five6n2n4n3n1n;
8655   allMixedCorrelators[137]=five6n2n1n5n4n;
8656   allMixedCorrelators[138]=five6n4n5n3n2n;
8657  } // end of if(dMult>4.)
8658  
8659  // Products of mixed harmonics:
8660  Double_t dwx=0.;
8661  Double_t dwy=0.;
8662  for(Int_t x=1;x<=139;x++)
8663  {  
8664   if(x>=1 && x<7)
8665   {
8666    dwx=d2pMultiplicityWeight;
8667   } else if(x>=7 && x<16)
8668     {
8669      dwx=d3pMultiplicityWeight;
8670     } else if(x>=16 && x<57)
8671       {
8672        dwx=d4pMultiplicityWeight;
8673       } else if(x>=57 && x<140)
8674         {
8675          dwx=d5pMultiplicityWeight;
8676         }
8677   for(Int_t y=x+1;y<=139;y++)
8678   {
8679    if(y>=1 && y<7)
8680    {
8681     dwy=d2pMultiplicityWeight;
8682    } else if(y>=7 && y<16)
8683      {
8684       dwy=d3pMultiplicityWeight;
8685      } else if(y>=16 && y<57)
8686        {
8687         dwy=d4pMultiplicityWeight;
8688        } else if(y>=57 && y<140)
8689          {
8690           dwy=d5pMultiplicityWeight;
8691          }
8692    fMixedHarmonicProductOfCorrelations->Fill(x-0.5,y-0.5,allMixedCorrelators[x-1]*allMixedCorrelators[y-1],dwx*dwy);
8693   } // end of for(Int_t y=x+1;y<=139;y++)
8694  } // end of for(Int_t x=1;x<=139;x++)
8695
8696 } // end of void AliFlowAnalysisWithQCumulants::CalculateMixedHarmonics()
8697
8698 //===================================================================================================================
8699
8700 void AliFlowAnalysisWithQCumulants::CalculateCumulantsMixedHarmonics()
8701 {
8702  // Calculate in this method all multi-particle cumulants for azimuthal correlations in mixed harmonics.
8703  // (Remark: For completeness sake, we also calculate here again cumulants in the same harmonic.) 
8704
8705  // a) Calculate 2-p cumulants; 
8706  // b) Calculate 3-p cumulants; 
8707  // c) Calculate 4-p cumulants; 
8708  // d) Calculate 5-p cumulants. 
8709
8710  // a) Calculate 2-p cumulants: 
8711  for(Int_t b=1;b<=6;b++)
8712  {
8713   f2pCumulants->SetBinContent(b,f2pCorrelations->GetBinContent(b)); 
8714   Double_t dSumWLinear = 0.; // sum of linear event weights
8715   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
8716   Double_t dSpread = 0.; // weighted and biased estimator for sigma
8717   Double_t dError = 0.; // weighted and unbiased estimator for error
8718   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8719   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8720   dSpread = f2pCorrelations->GetBinError(b);
8721   if(pow(dSumWLinear,2.)>dSumWQuadratic)
8722   {
8723    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
8724    f2pCumulants->SetBinError(b,dError); 
8725   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
8726  } // end of for(Int_t b=1;b<=6;b++)
8727
8728  // b) Calculate 3-p cumulants: 
8729  for(Int_t b=1;b<=10;b++)
8730  {
8731   f3pCumulants->SetBinContent(b,f3pCorrelations->GetBinContent(b)); 
8732   Double_t dSumWLinear = 0.; // sum of linear event weights
8733   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
8734   Double_t dSpread = 0.; // weighted and biased estimator for sigma
8735   Double_t dError = 0.; // weighted and unbiased estimator for sigma
8736   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(3);
8737   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(3);
8738   dSpread = f3pCorrelations->GetBinError(b);
8739   if(pow(dSumWLinear,2.)>dSumWQuadratic)
8740   {
8741    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
8742    f3pCumulants->SetBinError(b,dError); 
8743   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
8744  } // end of for(Int_t b=1;b<=10;b++)
8745
8746  // c) Calculate 4-p cumulants: 
8747  // c1) "Single harmonic":
8748  for(Int_t b=1;b<=6;b++)
8749  {
8750   f4pCumulants->SetBinContent(b,f4pCorrelations->GetBinContent(b)-2.*pow(f2pCorrelations->GetBinContent(b),2.));
8751   Double_t dSumWLinearTwo = 0.; // sum of linear event weights for <2>
8752   Double_t dSumWQuadraticTwo = 0.; // sum of quadratic event weights <2>
8753   Double_t dSpreadTwo = 0.; // weighted and biased estimator for sigma of <2>
8754   Double_t dSumWLinearFour = 0.; // sum of linear event weights for <4>
8755   Double_t dSumWQuadraticFour = 0.; // sum of quadratic event weights <4>
8756   Double_t dSpreadFour = 0.; // weighted and biased estimator for sigma of <4>
8757   dSumWLinearTwo = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8758   dSumWQuadraticTwo = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8759   dSpreadTwo = f2pCorrelations->GetBinError(b);
8760   dSumWLinearFour = fMixedHarmonicEventWeights[0]->GetBinContent(4);
8761   dSumWQuadraticFour = fMixedHarmonicEventWeights[1]->GetBinContent(4);
8762   dSpreadFour = f4pCorrelations->GetBinError(b);
8763   if(pow(dSumWLinearTwo,2.)>dSumWQuadraticTwo && pow(dSumWLinearFour,2.)>dSumWQuadraticFour) 
8764   {
8765    Double_t dError = 16.*pow(f2pCorrelations->GetBinContent(b),2.)
8766                    * pow((pow(dSumWQuadraticTwo,0.5)/dSumWLinearTwo)*dSpreadTwo*pow(pow(dSumWLinearTwo,2.)/(pow(dSumWLinearTwo,2.)-dSumWQuadraticTwo),0.5),2.)
8767                    + pow((pow(dSumWQuadraticFour,0.5)/dSumWLinearFour)*dSpreadFour*pow(pow(dSumWLinearFour,2.)/(pow(dSumWLinearFour,2.)-dSumWQuadraticFour),0.5),2.)
8768                    - 8.*f2pCorrelations->GetBinContent(b)
8769                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8770                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(b,b+15))
8771                    - f2pCorrelations->GetBinContent(b)*f4pCorrelations->GetBinContent(b))
8772                    / (dSumWLinearTwo*dSumWLinearFour-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
8773    if(dError>0.)
8774    {
8775     f4pCumulants->SetBinError(b,pow(dError,0.5)); 
8776    }
8777   } // end of if(pow(dSumWLinearTwo,2.)>dSumWQuadraticTwo && pow(dSumWLinearFour,2.)>dSumWQuadraticFour) 
8778  } // end of for(Int_t b=1;b<=6;b++)     
8779  // c2) "Standard candles":
8780  // <4>_{2n,1n|2n,1n}:
8781  f4pCumulants->SetBinContent(8,f4pCorrelations->GetBinContent(8)-f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(1));
8782  {
8783   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
8784   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
8785   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
8786   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
8787   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
8788   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
8789   Double_t dSumWLinearFour2n1n2n1n = 0.; // sum of linear event weights for <4>
8790   Double_t dSumWQuadraticFour2n1n2n1n = 0.; // sum of quadratic event weights <4>
8791   Double_t dSpreadFour2n1n2n1n = 0.; // weighted and biased estimator for sigma of <4>
8792   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8793   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8794   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
8795   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8796   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8797   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
8798   dSumWLinearFour2n1n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
8799   dSumWQuadraticFour2n1n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
8800   dSpreadFour2n1n2n1n = f4pCorrelations->GetBinError(8);
8801   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
8802      pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
8803      pow(dSumWLinearFour2n1n2n1n,2.)>dSumWQuadraticFour2n1n2n1n)
8804   {
8805    Double_t dError = pow(f2pCorrelations->GetBinContent(2),2.)
8806                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
8807                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
8808                    + pow(f2pCorrelations->GetBinContent(1),2.)
8809                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
8810                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
8811                    + pow((pow(dSumWQuadraticFour2n1n2n1n,0.5)/dSumWLinearFour2n1n2n1n)
8812                    * dSpreadFour2n1n2n1n*pow(pow(dSumWLinearFour2n1n2n1n,2.)/(pow(dSumWLinearFour2n1n2n1n,2.)-dSumWQuadraticFour2n1n2n1n),0.5),2.)
8813                    + 2.*f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(1)
8814                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
8815                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,2))
8816                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(2))
8817                    / (dSumWLinearTwo1n1n*dSumWLinearTwo2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
8818                    - 2.*f2pCorrelations->GetBinContent(2)
8819                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8820                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,22))
8821                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(8))
8822                    / (dSumWLinearTwo1n1n*dSumWLinearFour2n1n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
8823                    - 2.*f2pCorrelations->GetBinContent(1)
8824                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8825                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,22))
8826                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(8))
8827                    / (dSumWLinearTwo2n2n*dSumWLinearFour2n1n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
8828    if(dError>0.)
8829    {
8830     f4pCumulants->SetBinError(8,pow(dError,0.5)); 
8831    }
8832   } // end of if(...)
8833  } // end of {
8834  // <4>_{3n,1n|3n,1n}:
8835  f4pCumulants->SetBinContent(9,f4pCorrelations->GetBinContent(9)-f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(1));
8836  {
8837   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
8838   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
8839   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
8840   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
8841   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
8842   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
8843   Double_t dSumWLinearFour3n1n3n1n = 0.; // sum of linear event weights for <4>
8844   Double_t dSumWQuadraticFour3n1n3n1n = 0.; // sum of quadratic event weights <4>
8845   Double_t dSpreadFour3n1n3n1n = 0.; // weighted and biased estimator for sigma of <4>
8846   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8847   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8848   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
8849   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8850   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8851   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
8852   dSumWLinearFour3n1n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
8853   dSumWQuadraticFour3n1n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
8854   dSpreadFour3n1n3n1n = f4pCorrelations->GetBinError(9);
8855   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
8856      pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
8857      pow(dSumWLinearFour3n1n3n1n,2.)>dSumWQuadraticFour3n1n3n1n)
8858   {
8859    Double_t dError = pow(f2pCorrelations->GetBinContent(3),2.)
8860                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
8861                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
8862                    + pow(f2pCorrelations->GetBinContent(1),2.)
8863                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
8864                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
8865                    + pow((pow(dSumWQuadraticFour3n1n3n1n,0.5)/dSumWLinearFour3n1n3n1n)
8866                    * dSpreadFour3n1n3n1n*pow(pow(dSumWLinearFour3n1n3n1n,2.)/(pow(dSumWLinearFour3n1n3n1n,2.)-dSumWQuadraticFour3n1n3n1n),0.5),2.)
8867                    + 2.*f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(1)
8868                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
8869                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,3))
8870                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(3))
8871                    / (dSumWLinearTwo1n1n*dSumWLinearTwo3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
8872                    - 2.*f2pCorrelations->GetBinContent(3)
8873                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8874                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,23))
8875                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(9))
8876                    / (dSumWLinearTwo1n1n*dSumWLinearFour3n1n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
8877                    - 2.*f2pCorrelations->GetBinContent(1)
8878                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8879                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,23))
8880                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(9))
8881                    / (dSumWLinearTwo3n3n*dSumWLinearFour3n1n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
8882    if(dError>0.)
8883    {
8884     f4pCumulants->SetBinError(9,pow(dError,0.5)); 
8885    }
8886   } // end of if(...)
8887  } // end of {
8888  // <4>_{3n,2n|3n,2n}:
8889  f4pCumulants->SetBinContent(10,f4pCorrelations->GetBinContent(10)-f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(2));
8890  {
8891   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
8892   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
8893   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
8894   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
8895   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
8896   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
8897   Double_t dSumWLinearFour3n2n3n2n = 0.; // sum of linear event weights for <4>
8898   Double_t dSumWQuadraticFour3n2n3n2n = 0.; // sum of quadratic event weights <4>
8899   Double_t dSpreadFour3n2n3n2n = 0.; // weighted and biased estimator for sigma of <4>
8900   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8901   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8902   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
8903   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8904   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8905   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
8906   dSumWLinearFour3n2n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
8907   dSumWQuadraticFour3n2n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
8908   dSpreadFour3n2n3n2n = f4pCorrelations->GetBinError(10);
8909   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
8910      pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
8911      pow(dSumWLinearFour3n2n3n2n,2.)>dSumWQuadraticFour3n2n3n2n)
8912   {
8913    Double_t dError = pow(f2pCorrelations->GetBinContent(3),2.)
8914                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
8915                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
8916                    + pow(f2pCorrelations->GetBinContent(2),2.)
8917                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
8918                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
8919                    + pow((pow(dSumWQuadraticFour3n2n3n2n,0.5)/dSumWLinearFour3n2n3n2n)
8920                    * dSpreadFour3n2n3n2n*pow(pow(dSumWLinearFour3n2n3n2n,2.)/(pow(dSumWLinearFour3n2n3n2n,2.)-dSumWQuadraticFour3n2n3n2n),0.5),2.)
8921                    + 2.*f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(2)
8922                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
8923                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,3))
8924                    - f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(3))
8925                    / (dSumWLinearTwo2n2n*dSumWLinearTwo3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
8926                    - 2.*f2pCorrelations->GetBinContent(3)
8927                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8928                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,24))
8929                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(10))
8930                    / (dSumWLinearTwo2n2n*dSumWLinearFour3n2n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
8931                    - 2.*f2pCorrelations->GetBinContent(2)
8932                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8933                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,24))
8934                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(10))
8935                    / (dSumWLinearTwo3n3n*dSumWLinearFour3n2n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
8936    if(dError>0.)
8937    {
8938     f4pCumulants->SetBinError(10,pow(dError,0.5)); 
8939    }
8940   } // end of if(...)
8941  } // end of {
8942  // <4>_{4n,1n|4n,1n}
8943  f4pCumulants->SetBinContent(11,f4pCorrelations->GetBinContent(11)-f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(1));
8944  {
8945   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
8946   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
8947   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
8948   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
8949   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
8950   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
8951   Double_t dSumWLinearFour4n1n4n1n = 0.; // sum of linear event weights for <4>
8952   Double_t dSumWQuadraticFour4n1n4n1n = 0.; // sum of quadratic event weights <4>
8953   Double_t dSpreadFour4n1n4n1n = 0.; // weighted and biased estimator for sigma of <4>
8954   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8955   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8956   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
8957   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8958   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8959   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
8960   dSumWLinearFour4n1n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
8961   dSumWQuadraticFour4n1n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
8962   dSpreadFour4n1n4n1n = f4pCorrelations->GetBinError(11);
8963   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
8964      pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
8965      pow(dSumWLinearFour4n1n4n1n,2.)>dSumWQuadraticFour4n1n4n1n)
8966   {
8967    Double_t dError = pow(f2pCorrelations->GetBinContent(4),2.)
8968                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
8969                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
8970                    + pow(f2pCorrelations->GetBinContent(1),2.)
8971                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
8972                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
8973                    + pow((pow(dSumWQuadraticFour4n1n4n1n,0.5)/dSumWLinearFour4n1n4n1n)
8974                    * dSpreadFour4n1n4n1n*pow(pow(dSumWLinearFour4n1n4n1n,2.)/(pow(dSumWLinearFour4n1n4n1n,2.)-dSumWQuadraticFour4n1n4n1n),0.5),2.)
8975                    + 2.*f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(1)
8976                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
8977                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,4))
8978                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(4))
8979                    / (dSumWLinearTwo1n1n*dSumWLinearTwo4n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
8980                    - 2.*f2pCorrelations->GetBinContent(4)
8981                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8982                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,25))
8983                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(11))
8984                    / (dSumWLinearTwo1n1n*dSumWLinearFour4n1n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
8985                    - 2.*f2pCorrelations->GetBinContent(1)
8986                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8987                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,25))
8988                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(11))
8989                    / (dSumWLinearTwo4n4n*dSumWLinearFour4n1n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
8990    if(dError>0.)
8991    {
8992     f4pCumulants->SetBinError(11,pow(dError,0.5)); 
8993    }
8994   } // end of if(...)
8995  } // end of {
8996  // <4>_{4n,2n|4n,2n}
8997  f4pCumulants->SetBinContent(12,f4pCorrelations->GetBinContent(12)-f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(2));
8998  {
8999   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
9000   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
9001   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
9002   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9003   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9004   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9005   Double_t dSumWLinearFour4n2n4n2n = 0.; // sum of linear event weights for <4>
9006   Double_t dSumWQuadraticFour4n2n4n2n = 0.; // sum of quadratic event weights <4>
9007   Double_t dSpreadFour4n2n4n2n = 0.; // weighted and biased estimator for sigma of <4>
9008   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9009   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9010   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
9011   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9012   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9013   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9014   dSumWLinearFour4n2n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9015   dSumWQuadraticFour4n2n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9016   dSpreadFour4n2n4n2n = f4pCorrelations->GetBinError(12);
9017   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
9018      pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9019      pow(dSumWLinearFour4n2n4n2n,2.)>dSumWQuadraticFour4n2n4n2n)
9020   {
9021    Double_t dError = pow(f2pCorrelations->GetBinContent(4),2.)
9022                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
9023                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
9024                    + pow(f2pCorrelations->GetBinContent(2),2.)
9025                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9026                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9027                    + pow((pow(dSumWQuadraticFour4n2n4n2n,0.5)/dSumWLinearFour4n2n4n2n)
9028                    * dSpreadFour4n2n4n2n*pow(pow(dSumWLinearFour4n2n4n2n,2.)/(pow(dSumWLinearFour4n2n4n2n,2.)-dSumWQuadraticFour4n2n4n2n),0.5),2.)
9029                    + 2.*f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(2)
9030                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9031                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,4))
9032                    - f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(4))
9033                    / (dSumWLinearTwo2n2n*dSumWLinearTwo4n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9034                    - 2.*f2pCorrelations->GetBinContent(4)
9035                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9036                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,25))
9037                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(12))
9038                    / (dSumWLinearTwo2n2n*dSumWLinearFour4n2n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9039                    - 2.*f2pCorrelations->GetBinContent(2)
9040                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9041                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,25))
9042                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(12))
9043                    / (dSumWLinearTwo4n4n*dSumWLinearFour4n2n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9044    if(dError>0.)
9045    {
9046     f4pCumulants->SetBinError(12,pow(dError,0.5)); 
9047    }
9048   } // end of if(...)
9049  } // end of {
9050  // <4>_{4n,3n|4n,3n}
9051  f4pCumulants->SetBinContent(13,f4pCorrelations->GetBinContent(13)-f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(3));
9052  {
9053   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9054   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9055   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9056   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9057   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9058   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9059   Double_t dSumWLinearFour4n3n4n3n = 0.; // sum of linear event weights for <4>
9060   Double_t dSumWQuadraticFour4n3n4n3n = 0.; // sum of quadratic event weights <4>
9061   Double_t dSpreadFour4n3n4n3n = 0.; // weighted and biased estimator for sigma of <4>
9062   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9063   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9064   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9065   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9066   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9067   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9068   dSumWLinearFour4n3n4n3n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9069   dSumWQuadraticFour4n3n4n3n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9070   dSpreadFour4n3n4n3n = f4pCorrelations->GetBinError(13);
9071   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9072      pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9073      pow(dSumWLinearFour4n3n4n3n,2.)>dSumWQuadraticFour4n3n4n3n)
9074   {
9075    Double_t dError = pow(f2pCorrelations->GetBinContent(4),2.)
9076                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9077                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9078                    + pow(f2pCorrelations->GetBinContent(3),2.)
9079                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9080                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9081                    + pow((pow(dSumWQuadraticFour4n3n4n3n,0.5)/dSumWLinearFour4n3n4n3n)
9082                    * dSpreadFour4n3n4n3n*pow(pow(dSumWLinearFour4n3n4n3n,2.)/(pow(dSumWLinearFour4n3n4n3n,2.)-dSumWQuadraticFour4n3n4n3n),0.5),2.)
9083                    + 2.*f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(3)
9084                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9085                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,4))
9086                    - f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(4))
9087                    / (dSumWLinearTwo3n3n*dSumWLinearTwo4n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9088                    - 2.*f2pCorrelations->GetBinContent(4)
9089                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9090                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,26))
9091                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(13))
9092                    / (dSumWLinearTwo3n3n*dSumWLinearFour4n3n4n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9093                    - 2.*f2pCorrelations->GetBinContent(3)
9094                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9095                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,26))
9096                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(13))
9097                    / (dSumWLinearTwo4n4n*dSumWLinearFour4n3n4n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9098    if(dError>0.)
9099    {
9100     f4pCumulants->SetBinError(13,pow(dError,0.5)); 
9101    }
9102   } // end of if(...)
9103  } // end of {
9104  // <4>_{5n,1n|5n,1n}
9105  f4pCumulants->SetBinContent(14,f4pCorrelations->GetBinContent(14)-f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(1));
9106  {
9107   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
9108   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
9109   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
9110   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
9111   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
9112   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
9113   Double_t dSumWLinearFour5n1n5n1n = 0.; // sum of linear event weights for <4>
9114   Double_t dSumWQuadraticFour5n1n5n1n = 0.; // sum of quadratic event weights <4>
9115   Double_t dSpreadFour5n1n5n1n = 0.; // weighted and biased estimator for sigma of <4>
9116   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9117   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9118   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
9119   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9120   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9121   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9122   dSumWLinearFour5n1n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9123   dSumWQuadraticFour5n1n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9124   dSpreadFour5n1n5n1n = f4pCorrelations->GetBinError(14);
9125   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
9126      pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9127      pow(dSumWLinearFour5n1n5n1n,2.)>dSumWQuadraticFour5n1n5n1n)
9128   {
9129    Double_t dError = pow(f2pCorrelations->GetBinContent(5),2.)
9130                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
9131                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
9132                    + pow(f2pCorrelations->GetBinContent(1),2.)
9133                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9134                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9135                    + pow((pow(dSumWQuadraticFour5n1n5n1n,0.5)/dSumWLinearFour5n1n5n1n)
9136                    * dSpreadFour5n1n5n1n*pow(pow(dSumWLinearFour5n1n5n1n,2.)/(pow(dSumWLinearFour5n1n5n1n,2.)-dSumWQuadraticFour5n1n5n1n),0.5),2.)
9137                    + 2.*f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(1)
9138                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9139                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,5))
9140                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(5))
9141                    / (dSumWLinearTwo1n1n*dSumWLinearTwo5n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9142                    - 2.*f2pCorrelations->GetBinContent(5)
9143                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9144                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,28))
9145                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(14))
9146                    / (dSumWLinearTwo1n1n*dSumWLinearFour5n1n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9147                    - 2.*f2pCorrelations->GetBinContent(1)
9148                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9149                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,28))
9150                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(14))
9151                    / (dSumWLinearTwo5n5n*dSumWLinearFour5n1n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9152    if(dError>0.)
9153    {
9154     f4pCumulants->SetBinError(14,pow(dError,0.5)); 
9155    }
9156   } // end of if(...)
9157  } // end of {
9158  // <4>_{5n,2n|5n,2n}
9159  f4pCumulants->SetBinContent(15,f4pCorrelations->GetBinContent(15)-f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(2));
9160  {
9161   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
9162   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
9163   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
9164   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
9165   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
9166   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
9167   Double_t dSumWLinearFour5n2n5n2n = 0.; // sum of linear event weights for <4>
9168   Double_t dSumWQuadraticFour5n2n5n2n = 0.; // sum of quadratic event weights <4>
9169   Double_t dSpreadFour5n2n5n2n = 0.; // weighted and biased estimator for sigma of <4>
9170   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9171   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9172   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
9173   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9174   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9175   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9176   dSumWLinearFour5n2n5n2n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9177   dSumWQuadraticFour5n2n5n2n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9178   dSpreadFour5n2n5n2n = f4pCorrelations->GetBinError(15);
9179   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
9180      pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9181      pow(dSumWLinearFour5n2n5n2n,2.)>dSumWQuadraticFour5n2n5n2n)
9182   {
9183    Double_t dError = pow(f2pCorrelations->GetBinContent(5),2.)
9184                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
9185                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
9186                    + pow(f2pCorrelations->GetBinContent(2),2.)
9187                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9188                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9189                    + pow((pow(dSumWQuadraticFour5n2n5n2n,0.5)/dSumWLinearFour5n2n5n2n)
9190                    * dSpreadFour5n2n5n2n*pow(pow(dSumWLinearFour5n2n5n2n,2.)/(pow(dSumWLinearFour5n2n5n2n,2.)-dSumWQuadraticFour5n2n5n2n),0.5),2.)
9191                    + 2.*f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(2)
9192                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9193                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,5))
9194                    - f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(5))
9195                    / (dSumWLinearTwo2n2n*dSumWLinearTwo5n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9196                    - 2.*f2pCorrelations->GetBinContent(5)
9197                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9198                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,29))
9199                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(15))
9200                    / (dSumWLinearTwo2n2n*dSumWLinearFour5n2n5n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9201                    - 2.*f2pCorrelations->GetBinContent(2)
9202                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9203                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,29))
9204                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(15))
9205                    / (dSumWLinearTwo5n5n*dSumWLinearFour5n2n5n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9206    if(dError>0.)
9207    {
9208     f4pCumulants->SetBinError(15,pow(dError,0.5)); 
9209    }
9210   } // end of if(...)
9211  } // end of {
9212  // <4>_{5n,3n|5n,3n}
9213  f4pCumulants->SetBinContent(16,f4pCorrelations->GetBinContent(16)-f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(3));
9214  {
9215   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9216   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9217   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9218   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
9219   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
9220   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
9221   Double_t dSumWLinearFour5n3n5n3n = 0.; // sum of linear event weights for <4>
9222   Double_t dSumWQuadraticFour5n3n5n3n = 0.; // sum of quadratic event weights <4>
9223   Double_t dSpreadFour5n3n5n3n = 0.; // weighted and biased estimator for sigma of <4>
9224   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9225   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9226   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9227   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9228   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9229   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9230   dSumWLinearFour5n3n5n3n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9231   dSumWQuadraticFour5n3n5n3n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9232   dSpreadFour5n3n5n3n = f4pCorrelations->GetBinError(16);
9233   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9234      pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9235      pow(dSumWLinearFour5n3n5n3n,2.)>dSumWQuadraticFour5n3n5n3n)
9236   {
9237    Double_t dError = pow(f2pCorrelations->GetBinContent(5),2.)
9238                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9239                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9240                    + pow(f2pCorrelations->GetBinContent(3),2.)
9241                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9242                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9243                    + pow((pow(dSumWQuadraticFour5n3n5n3n,0.5)/dSumWLinearFour5n3n5n3n)
9244                    * dSpreadFour5n3n5n3n*pow(pow(dSumWLinearFour5n3n5n3n,2.)/(pow(dSumWLinearFour5n3n5n3n,2.)-dSumWQuadraticFour5n3n5n3n),0.5),2.)
9245                    + 2.*f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(3)
9246                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9247                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,5))
9248                    - f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(5))
9249                    / (dSumWLinearTwo3n3n*dSumWLinearTwo5n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9250                    - 2.*f2pCorrelations->GetBinContent(5)
9251                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9252                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,30))
9253                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(16))
9254                    / (dSumWLinearTwo3n3n*dSumWLinearFour5n3n5n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9255                    - 2.*f2pCorrelations->GetBinContent(3)
9256                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9257                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,30))
9258                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(16))
9259                    / (dSumWLinearTwo5n5n*dSumWLinearFour5n3n5n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9260    if(dError>0.)
9261    {
9262     f4pCumulants->SetBinError(16,pow(dError,0.5)); 
9263    }
9264   } // end of if(...)
9265  } // end of {
9266  // <4>_{5n,4n|5n,4n}
9267  f4pCumulants->SetBinContent(17,f4pCorrelations->GetBinContent(17)-f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(4));
9268  {
9269   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9270   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9271   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9272   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
9273   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
9274   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
9275   Double_t dSumWLinearFour5n4n5n4n = 0.; // sum of linear event weights for <4>
9276   Double_t dSumWQuadraticFour5n4n5n4n = 0.; // sum of quadratic event weights <4>
9277   Double_t dSpreadFour5n4n5n4n = 0.; // weighted and biased estimator for sigma of <4>
9278   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9279   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9280   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9281   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9282   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9283   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9284   dSumWLinearFour5n4n5n4n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9285   dSumWQuadraticFour5n4n5n4n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9286   dSpreadFour5n4n5n4n = f4pCorrelations->GetBinError(17);
9287   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9288      pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9289      pow(dSumWLinearFour5n4n5n4n,2.)>dSumWQuadraticFour5n4n5n4n)
9290   {
9291    Double_t dError = pow(f2pCorrelations->GetBinContent(5),2.)
9292                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9293                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9294                    + pow(f2pCorrelations->GetBinContent(4),2.)
9295                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9296                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9297                    + pow((pow(dSumWQuadraticFour5n4n5n4n,0.5)/dSumWLinearFour5n4n5n4n)
9298                    * dSpreadFour5n4n5n4n*pow(pow(dSumWLinearFour5n4n5n4n,2.)/(pow(dSumWLinearFour5n4n5n4n,2.)-dSumWQuadraticFour5n4n5n4n),0.5),2.)
9299                    + 2.*f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(4)
9300                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9301                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,5))
9302                    - f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(5))
9303                    / (dSumWLinearTwo4n4n*dSumWLinearTwo5n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9304                    - 2.*f2pCorrelations->GetBinContent(5)
9305                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9306                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,31))
9307                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(17))
9308                    / (dSumWLinearTwo4n4n*dSumWLinearFour5n4n5n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9309                    - 2.*f2pCorrelations->GetBinContent(4)
9310                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9311                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,31))
9312                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(17))
9313                    / (dSumWLinearTwo5n5n*dSumWLinearFour5n4n5n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9314    if(dError>0.)
9315    {
9316     f4pCumulants->SetBinError(17,pow(dError,0.5)); 
9317    }
9318   } // end of if(...)
9319  } // end of {
9320  // <4>_{6n,1n|6n,1n}
9321  f4pCumulants->SetBinContent(18,f4pCorrelations->GetBinContent(18)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(1));
9322  {
9323   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
9324   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
9325   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
9326   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9327   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9328   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9329   Double_t dSumWLinearFour6n1n6n1n = 0.; // sum of linear event weights for <4>
9330   Double_t dSumWQuadraticFour6n1n6n1n = 0.; // sum of quadratic event weights <4>
9331   Double_t dSpreadFour6n1n6n1n = 0.; // weighted and biased estimator for sigma of <4>
9332   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9333   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9334   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
9335   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9336   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9337   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9338   dSumWLinearFour6n1n6n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9339   dSumWQuadraticFour6n1n6n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9340   dSpreadFour6n1n6n1n = f4pCorrelations->GetBinError(18);
9341   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
9342      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9343      pow(dSumWLinearFour6n1n6n1n,2.)>dSumWQuadraticFour6n1n6n1n)
9344   {
9345    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9346                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
9347                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
9348                    + pow(f2pCorrelations->GetBinContent(1),2.)
9349                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9350                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9351                    + pow((pow(dSumWQuadraticFour6n1n6n1n,0.5)/dSumWLinearFour6n1n6n1n)
9352                    * dSpreadFour6n1n6n1n*pow(pow(dSumWLinearFour6n1n6n1n,2.)/(pow(dSumWLinearFour6n1n6n1n,2.)-dSumWQuadraticFour6n1n6n1n),0.5),2.)
9353                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(1)
9354                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9355                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,6))
9356                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(6))
9357                    / (dSumWLinearTwo1n1n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9358                    - 2.*f2pCorrelations->GetBinContent(6)
9359                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9360                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,32))
9361                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(18))
9362                    / (dSumWLinearTwo1n1n*dSumWLinearFour6n1n6n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9363                    - 2.*f2pCorrelations->GetBinContent(1)
9364                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9365                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,32))
9366                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(18))
9367                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n1n6n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9368    if(dError>0.)
9369    {
9370     f4pCumulants->SetBinError(18,pow(dError,0.5)); 
9371    }
9372   } // end of if(...)
9373  } // end of {
9374  // <4>_{6n,2n|6n,2n}
9375  f4pCumulants->SetBinContent(19,f4pCorrelations->GetBinContent(19)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(2));
9376  {
9377   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
9378   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
9379   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
9380   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9381   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9382   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9383   Double_t dSumWLinearFour6n2n6n2n = 0.; // sum of linear event weights for <4>
9384   Double_t dSumWQuadraticFour6n2n6n2n = 0.; // sum of quadratic event weights <4>
9385   Double_t dSpreadFour6n2n6n2n = 0.; // weighted and biased estimator for sigma of <4>
9386   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9387   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9388   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
9389   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9390   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9391   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9392   dSumWLinearFour6n2n6n2n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9393   dSumWQuadraticFour6n2n6n2n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9394   dSpreadFour6n2n6n2n = f4pCorrelations->GetBinError(19);
9395   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
9396      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9397      pow(dSumWLinearFour6n2n6n2n,2.)>dSumWQuadraticFour6n2n6n2n)
9398   {
9399    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9400                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
9401                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
9402                    + pow(f2pCorrelations->GetBinContent(2),2.)
9403                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9404                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9405                    + pow((pow(dSumWQuadraticFour6n2n6n2n,0.5)/dSumWLinearFour6n2n6n2n)
9406                    * dSpreadFour6n2n6n2n*pow(pow(dSumWLinearFour6n2n6n2n,2.)/(pow(dSumWLinearFour6n2n6n2n,2.)-dSumWQuadraticFour6n2n6n2n),0.5),2.)
9407                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(2)
9408                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9409                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,6))
9410                    - f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(6))
9411                    / (dSumWLinearTwo2n2n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9412                    - 2.*f2pCorrelations->GetBinContent(6)
9413                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9414                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,33))
9415                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(19))
9416                    / (dSumWLinearTwo2n2n*dSumWLinearFour6n2n6n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9417                    - 2.*f2pCorrelations->GetBinContent(2)
9418                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9419                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,33))
9420                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(19))
9421                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n2n6n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9422    if(dError>0.)
9423    {
9424     f4pCumulants->SetBinError(19,pow(dError,0.5)); 
9425    }
9426   } // end of if(...)
9427  } // end of {
9428  // <4>_{6n,3n|6n,3n}
9429  f4pCumulants->SetBinContent(20,f4pCorrelations->GetBinContent(20)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(3));
9430  {
9431   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9432   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9433   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9434   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9435   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9436   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9437   Double_t dSumWLinearFour6n3n6n3n = 0.; // sum of linear event weights for <4>
9438   Double_t dSumWQuadraticFour6n3n6n3n = 0.; // sum of quadratic event weights <4>
9439   Double_t dSpreadFour6n3n6n3n = 0.; // weighted and biased estimator for sigma of <4>
9440   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9441   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9442   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9443   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9444   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9445   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9446   dSumWLinearFour6n3n6n3n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9447   dSumWQuadraticFour6n3n6n3n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9448   dSpreadFour6n3n6n3n = f4pCorrelations->GetBinError(20);
9449   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9450      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9451      pow(dSumWLinearFour6n3n6n3n,2.)>dSumWQuadraticFour6n3n6n3n)
9452   {
9453    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9454                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9455                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9456                    + pow(f2pCorrelations->GetBinContent(3),2.)
9457                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9458                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9459                    + pow((pow(dSumWQuadraticFour6n3n6n3n,0.5)/dSumWLinearFour6n3n6n3n)
9460                    * dSpreadFour6n3n6n3n*pow(pow(dSumWLinearFour6n3n6n3n,2.)/(pow(dSumWLinearFour6n3n6n3n,2.)-dSumWQuadraticFour6n3n6n3n),0.5),2.)
9461                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(3)
9462                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9463                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,6))
9464                    - f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(6))
9465                    / (dSumWLinearTwo3n3n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9466                    - 2.*f2pCorrelations->GetBinContent(6)
9467                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9468                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,34))
9469                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(20))
9470                    / (dSumWLinearTwo3n3n*dSumWLinearFour6n3n6n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9471                    - 2.*f2pCorrelations->GetBinContent(3)
9472                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9473                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,34))
9474                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(20))
9475                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n3n6n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9476    if(dError>0.)
9477    {
9478     f4pCumulants->SetBinError(20,pow(dError,0.5)); 
9479    }
9480   } // end of if(...)
9481  } // end of {
9482  // <4>_{6n,4n|6n,4n}
9483  f4pCumulants->SetBinContent(21,f4pCorrelations->GetBinContent(21)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(4));
9484  {
9485   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9486   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9487   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9488   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9489   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9490   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9491   Double_t dSumWLinearFour6n4n6n4n = 0.; // sum of linear event weights for <4>
9492   Double_t dSumWQuadraticFour6n4n6n4n = 0.; // sum of quadratic event weights <4>
9493   Double_t dSpreadFour6n4n6n4n = 0.; // weighted and biased estimator for sigma of <4>
9494   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9495   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9496   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9497   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9498   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9499   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9500   dSumWLinearFour6n4n6n4n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9501   dSumWQuadraticFour6n4n6n4n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9502   dSpreadFour6n4n6n4n = f4pCorrelations->GetBinError(21);
9503   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9504      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9505      pow(dSumWLinearFour6n4n6n4n,2.)>dSumWQuadraticFour6n4n6n4n)
9506   {
9507    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9508                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9509                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9510                    + pow(f2pCorrelations->GetBinContent(4),2.)
9511                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9512                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9513                    + pow((pow(dSumWQuadraticFour6n4n6n4n,0.5)/dSumWLinearFour6n4n6n4n)
9514                    * dSpreadFour6n4n6n4n*pow(pow(dSumWLinearFour6n4n6n4n,2.)/(pow(dSumWLinearFour6n4n6n4n,2.)-dSumWQuadraticFour6n4n6n4n),0.5),2.)
9515                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(4)
9516                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9517                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,6))
9518                    - f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(6))
9519                    / (dSumWLinearTwo4n4n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9520                    - 2.*f2pCorrelations->GetBinContent(6)
9521                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9522                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,35))
9523                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(21))
9524                    / (dSumWLinearTwo4n4n*dSumWLinearFour6n4n6n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9525                    - 2.*f2pCorrelations->GetBinContent(4)
9526                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9527                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,35))
9528                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(21))
9529                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n4n6n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9530    if(dError>0.)
9531    {
9532     f4pCumulants->SetBinError(21,pow(dError,0.5)); 
9533    }
9534   } // end of if(...)
9535  } // end of {
9536  // <4>_{6n,5n|6n,5n}
9537  f4pCumulants->SetBinContent(22,f4pCorrelations->GetBinContent(22)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(5));
9538  {
9539   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
9540   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
9541   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
9542   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9543   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9544   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9545   Double_t dSumWLinearFour6n5n6n5n = 0.; // sum of linear event weights for <4>
9546   Double_t dSumWQuadraticFour6n5n6n5n = 0.; // sum of quadratic event weights <4>
9547   Double_t dSpreadFour6n5n6n5n = 0.; // weighted and biased estimator for sigma of <4>
9548   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9549   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9550   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9551   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9552   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9553   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9554   dSumWLinearFour6n5n6n5n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9555   dSumWQuadraticFour6n5n6n5n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9556   dSpreadFour6n5n6n5n = f4pCorrelations->GetBinError(22);
9557   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9558      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9559      pow(dSumWLinearFour6n5n6n5n,2.)>dSumWQuadraticFour6n5n6n5n)
9560   {
9561    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9562                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9563                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9564                    + pow(f2pCorrelations->GetBinContent(5),2.)
9565                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9566                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9567                    + pow((pow(dSumWQuadraticFour6n5n6n5n,0.5)/dSumWLinearFour6n5n6n5n)
9568                    * dSpreadFour6n5n6n5n*pow(pow(dSumWLinearFour6n5n6n5n,2.)/(pow(dSumWLinearFour6n5n6n5n,2.)-dSumWQuadraticFour6n5n6n5n),0.5),2.)
9569                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(5)
9570                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9571                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,6))
9572                    - f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(6))
9573                    / (dSumWLinearTwo5n5n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9574                    - 2.*f2pCorrelations->GetBinContent(6)
9575                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9576                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,36))
9577                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(22))
9578                    / (dSumWLinearTwo5n5n*dSumWLinearFour6n5n6n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9579                    - 2.*f2pCorrelations->GetBinContent(5)
9580                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9581                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,36))
9582                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(22))
9583                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n5n6n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9584    if(dError>0.)
9585    {
9586     f4pCumulants->SetBinError(22,pow(dError,0.5)); 
9587    }
9588   } // end of if(...)
9589  } // end of {
9590
9591  // c3) "Two distinct harmonics":
9592  for(Int_t b=24;b<=25;b++)
9593  {
9594   f4pCumulants->SetBinContent(b,f4pCorrelations->GetBinContent(b));
9595   Double_t dSumWLinear = 0.; // sum of linear event weights
9596   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
9597   Double_t dSpread = 0.; // weighted and biased estimator for sigma
9598   Double_t dError = 0.; // weighted and unbiased estimator for sigma
9599   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9600   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9601   dSpread = f4pCorrelations->GetBinError(b);
9602   if(pow(dSumWLinear,2.)>dSumWQuadratic)
9603   {
9604    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
9605    f4pCumulants->SetBinError(b,dError); 
9606   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
9607  } // end of for(Int_t b=24;b<=25;b++)
9608  // c4) "Three distinct harmonics":
9609  for(Int_t b=27;b<=36;b++)
9610  {
9611   f4pCumulants->SetBinContent(b,f4pCorrelations->GetBinContent(b));
9612   Double_t dSumWLinear = 0.; // sum of linear event weights
9613   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
9614   Double_t dSpread = 0.; // weighted and biased estimator for sigma
9615   Double_t dError = 0.; // weighted and unbiased estimator for sigma
9616   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9617   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9618   dSpread = f4pCorrelations->GetBinError(b);
9619   if(pow(dSumWLinear,2.)>dSumWQuadratic)
9620   {
9621    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
9622    f4pCumulants->SetBinError(b,dError); 
9623   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
9624  } // end of for(Int_t b=27;b<=36;b++)
9625  // c5) "Four distinct harmonics":
9626  for(Int_t b=38;b<=45;b++)
9627  {
9628   f4pCumulants->SetBinContent(b,f4pCorrelations->GetBinContent(b));
9629   Double_t dSumWLinear = 0.; // sum of linear event weights
9630   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
9631   Double_t dSpread = 0.; // weighted and biased estimator for sigma
9632   Double_t dError = 0.; // weighted and unbiased estimator for sigma
9633   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9634   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9635   dSpread = f4pCorrelations->GetBinError(b);
9636   if(pow(dSumWLinear,2.)>dSumWQuadratic)
9637   {
9638    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
9639    f4pCumulants->SetBinError(b,dError); 
9640   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
9641  } // end of for(Int_t b=38;b<=45;b++)
9642
9643  // d) Calculate 5-p cumulants: 
9644  // d1) "Standard candles":
9645  f5pCumulants->SetBinContent(1,f5pCorrelations->GetBinContent(1)-f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(3));
9646  {
9647   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9648   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9649   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9650   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
9651   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
9652   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
9653   Double_t dSumWLinearFive3n2n3n1n1n = 0.; // sum of linear event weights for <4>
9654   Double_t dSumWQuadraticFive3n2n3n1n1n = 0.; // sum of quadratic event weights <4>
9655   Double_t dSpreadFive3n2n3n1n1n = 0.; // weighted and biased estimator for sigma of <4>
9656   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9657   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9658   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9659   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9660   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9661   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
9662   dSumWLinearFive3n2n3n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
9663   dSumWQuadraticFive3n2n3n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
9664   dSpreadFive3n2n3n1n1n = f5pCorrelations->GetBinError(1);
9665   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9666      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
9667      pow(dSumWLinearFive3n2n3n1n1n,2.)>dSumWQuadraticFive3n2n3n1n1n)
9668   {
9669    Double_t dError = pow(f3pCorrelations->GetBinContent(1),2.)
9670                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9671                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9672                    + pow(f2pCorrelations->GetBinContent(3),2.)
9673                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
9674                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
9675                    + pow((pow(dSumWQuadraticFive3n2n3n1n1n,0.5)/dSumWLinearFive3n2n3n1n1n)
9676                    * dSpreadFive3n2n3n1n1n*pow(pow(dSumWLinearFive3n2n3n1n1n,2.)/(pow(dSumWLinearFive3n2n3n1n1n,2.)-dSumWQuadraticFive3n2n3n1n1n),0.5),2.)
9677                    + 2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(3)
9678                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3))
9679                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,7))
9680                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(1))
9681                    / (dSumWLinearTwo3n3n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
9682                    - 2.*f3pCorrelations->GetBinContent(1)
9683                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5))
9684                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,57))
9685                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(1))
9686                    / (dSumWLinearTwo3n3n*dSumWLinearFive3n2n3n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
9687                    - 2.*f2pCorrelations->GetBinContent(3)
9688                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5))
9689                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,57))
9690                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(1))
9691                    / (dSumWLinearThree2n1n1n*dSumWLinearFive3n2n3n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
9692    if(dError>0.)
9693    {
9694     f5pCumulants->SetBinError(1,pow(dError,0.5)); 
9695    }
9696   } // end of if(...)
9697  } // end of {
9698
9699  f5pCumulants->SetBinContent(2,f5pCorrelations->GetBinContent(2)-f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(1));
9700  {
9701   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
9702   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
9703   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
9704   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
9705   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
9706   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
9707   Double_t dSumWLinearFive4n1n2n2n1n = 0.; // sum of linear event weights for <4>
9708   Double_t dSumWQuadraticFive4n1n2n2n1n = 0.; // sum of quadratic event weights <4>
9709   Double_t dSpreadFive4n1n2n2n1n = 0.; // weighted and biased estimator for sigma of <4>
9710   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9711   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9712   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
9713   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9714   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9715   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
9716   dSumWLinearFive4n1n2n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
9717   dSumWQuadraticFive4n1n2n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
9718   dSpreadFive4n1n2n2n1n = f5pCorrelations->GetBinError(2);
9719   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
9720      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
9721      pow(dSumWLinearFive4n1n2n2n1n,2.)>dSumWQuadraticFive4n1n2n2n1n)
9722   {
9723    Double_t dError = pow(f3pCorrelations->GetBinContent(2),2.)
9724                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
9725                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
9726                    + pow(f2pCorrelations->GetBinContent(1),2.)
9727                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
9728                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
9729                    + pow((pow(dSumWQuadraticFive4n1n2n2n1n,0.5)/dSumWLinearFive4n1n2n2n1n)
9730                    * dSpreadFive4n1n2n2n1n*pow(pow(dSumWLinearFive4n1n2n2n1n,2.)/(pow(dSumWLinearFive4n1n2n2n1n,2.)-dSumWQuadraticFive4n1n2n2n1n),0.5),2.)
9731                    + 2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(1)
9732                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3))
9733                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,8))
9734                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(2))
9735                    / (dSumWLinearTwo1n1n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
9736                    - 2.*f3pCorrelations->GetBinContent(2)
9737                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5))
9738                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,58))
9739                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(2))
9740                    / (dSumWLinearTwo1n1n*dSumWLinearFive4n1n2n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
9741                    - 2.*f2pCorrelations->GetBinContent(1)
9742                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5))
9743                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,58))
9744                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(2))
9745                    / (dSumWLinearThree4n2n2n*dSumWLinearFive4n1n2n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
9746    if(dError>0.)
9747    {
9748     f5pCumulants->SetBinError(2,pow(dError,0.5)); 
9749    }
9750   } // end of if(...)
9751  } // end of {
9752  f5pCumulants->SetBinContent(3,f5pCorrelations->GetBinContent(3)-f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(2));
9753  {
9754   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
9755   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
9756   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
9757   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
9758   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
9759   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
9760   Double_t dSumWLinearFive4n2n3n2n1n = 0.; // sum of linear event weights for <4>
9761   Double_t dSumWQuadraticFive4n2n3n2n1n = 0.; // sum of quadratic event weights <4>
9762   Double_t dSpreadFive4n2n3n2n1n = 0.; // weighted and biased estimator for sigma of <4>
9763   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9764   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9765   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
9766   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9767   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9768   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
9769   dSumWLinearFive4n2n3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
9770   dSumWQuadraticFive4n2n3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
9771   dSpreadFive4n2n3n2n1n = f5pCorrelations->GetBinError(3);
9772   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
9773      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
9774      pow(dSumWLinearFive4n2n3n2n1n,2.)>dSumWQuadraticFive4n2n3n2n1n)
9775   {
9776    Double_t dError = pow(f3pCorrelations->GetBinContent(6),2.)
9777                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
9778                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
9779                    + pow(f2pCorrelations->GetBinContent(2),2.)
9780                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
9781                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
9782                    + pow((pow(dSumWQuadraticFive4n2n3n2n1n,0.5)/dSumWLinearFive4n2n3n2n1n)
9783                    * dSpreadFive4n2n3n2n1n*pow(pow(dSumWLinearFive4n2n3n2n1n,2.)/(pow(dSumWLinearFive4n2n3n2n1n,2.)-dSumWQuadraticFive4n2n3n2n1n),0.5),2.)
9784                    + 2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(2)
9785                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3))
9786                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,11))
9787                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(6))
9788                    / (dSumWLinearTwo2n2n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
9789                    - 2.*f3pCorrelations->GetBinContent(6)
9790                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5))
9791                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,59))
9792                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(3))
9793                    / (dSumWLinearTwo2n2n*dSumWLinearFive4n2n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
9794                    - 2.*f2pCorrelations->GetBinContent(2)
9795                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5))
9796                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,59))
9797                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(3))
9798                    / (dSumWLinearThree4n3n1n*dSumWLinearFive4n2n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
9799    if(dError>0.)
9800    {
9801     f5pCumulants->SetBinError(3,pow(dError,0.5)); 
9802    }
9803   } // end of if(...)
9804  } // end of {
9805  f5pCumulants->SetBinContent(4,f5pCorrelations->GetBinContent(4)-f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(3));
9806  {
9807   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9808   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9809   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9810   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
9811   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
9812   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
9813   Double_t dSumWLinearFive4n3n3n2n2n = 0.; // sum of linear event weights for <4>
9814   Double_t dSumWQuadraticFive4n3n3n2n2n = 0.; // sum of quadratic event weights <4>
9815   Double_t dSpreadFive4n3n3n2n2n = 0.; // weighted and biased estimator for sigma of <4>
9816   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9817   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9818   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9819   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9820   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9821   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
9822   dSumWLinearFive4n3n3n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
9823   dSumWQuadraticFive4n3n3n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
9824   dSpreadFive4n3n3n2n2n = f5pCorrelations->GetBinError(4);
9825   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9826      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
9827      pow(dSumWLinearFive4n3n3n2n2n,2.)>dSumWQuadraticFive4n3n3n2n2n)
9828   {
9829    Double_t dError = pow(f3pCorrelations->GetBinContent(2),2.)
9830                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9831                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9832                    + pow(f2pCorrelations->GetBinContent(3),2.)
9833                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
9834                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
9835                    + pow((pow(dSumWQuadraticFive4n3n3n2n2n,0.5)/dSumWLinearFive4n3n3n2n2n)
9836                    * dSpreadFive4n3n3n2n2n*pow(pow(dSumWLinearFive4n3n3n2n2n,2.)/(pow(dSumWLinearFive4n3n3n2n2n,2.)-dSumWQuadraticFive4n3n3n2n2n),0.5),2.)
9837                    + 2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(3)
9838                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3))
9839                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,8))
9840                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(2))
9841                    / (dSumWLinearTwo3n3n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
9842                    - 2.*f3pCorrelations->GetBinContent(2)
9843                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5))
9844                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,60))
9845                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(4))
9846                    / (dSumWLinearTwo3n3n*dSumWLinearFive4n3n3n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
9847                    - 2.*f2pCorrelations->GetBinContent(3)
9848                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5))
9849                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,60))
9850                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(4))
9851                    / (dSumWLinearThree4n2n2n*dSumWLinearFive4n3n3n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
9852    if(dError>0.)
9853    {
9854     f5pCumulants->SetBinError(4,pow(dError,0.5)); 
9855    }
9856   } // end of if(...)
9857  } // end of {
9858  f5pCumulants->SetBinContent(5,f5pCorrelations->GetBinContent(5)-f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(4));
9859  {
9860   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9861   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9862   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9863   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
9864   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
9865   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
9866   Double_t dSumWLinearFive4n2n4n1n1n = 0.; // sum of linear event weights for <4>
9867   Double_t dSumWQuadraticFive4n2n4n1n1n = 0.; // sum of quadratic event weights <4>
9868   Double_t dSpreadFive4n2n4n1n1n = 0.; // weighted and biased estimator for sigma of <4>
9869   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9870   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9871   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9872   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9873   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9874   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
9875   dSumWLinearFive4n2n4n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
9876   dSumWQuadraticFive4n2n4n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
9877   dSpreadFive4n2n4n1n1n = f5pCorrelations->GetBinError(5);
9878   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9879      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
9880      pow(dSumWLinearFive4n2n4n1n1n,2.)>dSumWQuadraticFive4n2n4n1n1n)
9881   {
9882    Double_t dError = pow(f3pCorrelations->GetBinContent(1),2.)
9883                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9884                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9885                    + pow(f2pCorrelations->GetBinContent(4),2.)
9886                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
9887                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
9888                    + pow((pow(dSumWQuadraticFive4n2n4n1n1n,0.5)/dSumWLinearFive4n2n4n1n1n)
9889                    * dSpreadFive4n2n4n1n1n*pow(pow(dSumWLinearFive4n2n4n1n1n,2.)/(pow(dSumWLinearFive4n2n4n1n1n,2.)-dSumWQuadraticFive4n2n4n1n1n),0.5),2.)
9890                    + 2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(4)
9891                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
9892                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,7)) 
9893                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(1))
9894                    / (dSumWLinearTwo4n4n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
9895                    - 2.*f3pCorrelations->GetBinContent(1)
9896                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
9897                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,61))
9898                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(5))
9899                    / (dSumWLinearTwo4n4n*dSumWLinearFive4n2n4n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
9900                    - 2.*f2pCorrelations->GetBinContent(4)
9901                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
9902                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,61))
9903                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(5))
9904                    / (dSumWLinearThree2n1n1n*dSumWLinearFive4n2n4n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
9905    if(dError>0.)
9906    {
9907     f5pCumulants->SetBinError(5,pow(dError,0.5)); 
9908    }
9909   } // end of if(...)
9910  } // end of {
9911  f5pCumulants->SetBinContent(6,f5pCorrelations->GetBinContent(6)-f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(4));
9912  {
9913   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9914   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9915   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9916   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
9917   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
9918   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
9919   Double_t dSumWLinearFive4n3n4n2n1n = 0.; // sum of linear event weights for <4>
9920   Double_t dSumWQuadraticFive4n3n4n2n1n = 0.; // sum of quadratic event weights <4>
9921   Double_t dSpreadFive4n3n4n2n1n = 0.; // weighted and biased estimator for sigma of <4>
9922   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9923   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9924   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9925   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9926   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9927   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
9928   dSumWLinearFive4n3n4n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
9929   dSumWQuadraticFive4n3n4n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
9930   dSpreadFive4n3n4n2n1n = f5pCorrelations->GetBinError(6);
9931   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9932      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
9933      pow(dSumWLinearFive4n3n4n2n1n,2.)>dSumWQuadraticFive4n3n4n2n1n)
9934   {
9935    Double_t dError = pow(f3pCorrelations->GetBinContent(5),2.)
9936                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9937                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9938                    + pow(f2pCorrelations->GetBinContent(4),2.)
9939                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
9940                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
9941                    + pow((pow(dSumWQuadraticFive4n3n4n2n1n,0.5)/dSumWLinearFive4n3n4n2n1n)
9942                    * dSpreadFive4n3n4n2n1n*pow(pow(dSumWLinearFive4n3n4n2n1n,2.)/(pow(dSumWLinearFive4n3n4n2n1n,2.)-dSumWQuadraticFive4n3n4n2n1n),0.5),2.)
9943                    + 2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(4)
9944                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
9945                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,10)) 
9946                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(5))
9947                    / (dSumWLinearTwo4n4n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
9948                    - 2.*f3pCorrelations->GetBinContent(5)
9949                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
9950                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,62))
9951                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(6))
9952                    / (dSumWLinearTwo4n4n*dSumWLinearFive4n3n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
9953                    - 2.*f2pCorrelations->GetBinContent(4)
9954                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
9955                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,62))
9956                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(6))
9957                    / (dSumWLinearThree3n2n1n*dSumWLinearFive4n3n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
9958    if(dError>0.)
9959    {
9960     f5pCumulants->SetBinError(6,pow(dError,0.5)); 
9961    }
9962   } // end of if(...)
9963  } // end of {
9964  f5pCumulants->SetBinContent(7,f5pCorrelations->GetBinContent(7)-f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(1));
9965  {
9966   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
9967   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
9968   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
9969   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
9970   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
9971   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
9972   Double_t dSumWLinearFive5n1n3n2n1n = 0.; // sum of linear event weights for <4>
9973   Double_t dSumWQuadraticFive5n1n3n2n1n = 0.; // sum of quadratic event weights <4>
9974   Double_t dSpreadFive5n1n3n2n1n = 0.; // weighted and biased estimator for sigma of <4>
9975   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9976   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9977   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
9978   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9979   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9980   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
9981   dSumWLinearFive5n1n3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
9982   dSumWQuadraticFive5n1n3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
9983   dSpreadFive5n1n3n2n1n = f5pCorrelations->GetBinError(7);
9984   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
9985      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
9986      pow(dSumWLinearFive5n1n3n2n1n,2.)>dSumWQuadraticFive5n1n3n2n1n)
9987   {
9988    Double_t dError = pow(f3pCorrelations->GetBinContent(7),2.)
9989                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
9990                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
9991                    + pow(f2pCorrelations->GetBinContent(1),2.)
9992                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
9993                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
9994                    + pow((pow(dSumWQuadraticFive5n1n3n2n1n,0.5)/dSumWLinearFive5n1n3n2n1n)
9995                    * dSpreadFive5n1n3n2n1n*pow(pow(dSumWLinearFive5n1n3n2n1n,2.)/(pow(dSumWLinearFive5n1n3n2n1n,2.)-dSumWQuadraticFive5n1n3n2n1n),0.5),2.)
9996                    + 2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(1)
9997                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
9998                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,12)) 
9999                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(7))
10000                    / (dSumWLinearTwo1n1n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10001                    - 2.*f3pCorrelations->GetBinContent(7)
10002                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10003                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,63))
10004                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(7))
10005                    / (dSumWLinearTwo1n1n*dSumWLinearFive5n1n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10006                    - 2.*f2pCorrelations->GetBinContent(1)
10007                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10008                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,63))
10009                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(7))
10010                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n1n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10011    if(dError>0.)
10012    {
10013     f5pCumulants->SetBinError(7,pow(dError,0.5)); 
10014    }
10015   } // end of if(...)
10016  } // end of {
10017  f5pCumulants->SetBinContent(8,f5pCorrelations->GetBinContent(8)-f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(5));
10018  {
10019   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
10020   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
10021   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
10022   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
10023   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
10024   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
10025   Double_t dSumWLinearFive5n2n5n1n1n = 0.; // sum of linear event weights for <4>
10026   Double_t dSumWQuadraticFive5n2n5n1n1n = 0.; // sum of quadratic event weights <4>
10027   Double_t dSpreadFive5n2n5n1n1n = 0.; // weighted and biased estimator for sigma of <4>
10028   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10029   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10030   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
10031   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10032   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10033   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
10034   dSumWLinearFive5n2n5n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10035   dSumWQuadraticFive5n2n5n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10036   dSpreadFive5n2n5n1n1n = f5pCorrelations->GetBinError(8);
10037   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
10038      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
10039      pow(dSumWLinearFive5n2n5n1n1n,2.)>dSumWQuadraticFive5n2n5n1n1n)
10040   {
10041    Double_t dError = pow(f3pCorrelations->GetBinContent(1),2.)
10042                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
10043                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
10044                    + pow(f2pCorrelations->GetBinContent(5),2.)
10045                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
10046                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
10047                    + pow((pow(dSumWQuadraticFive5n2n5n1n1n,0.5)/dSumWLinearFive5n2n5n1n1n)
10048                    * dSpreadFive5n2n5n1n1n*pow(pow(dSumWLinearFive5n2n5n1n1n,2.)/(pow(dSumWLinearFive5n2n5n1n1n,2.)-dSumWQuadraticFive5n2n5n1n1n),0.5),2.)
10049                    + 2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(5)
10050                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10051                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,7)) 
10052                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(1))
10053                    / (dSumWLinearTwo5n5n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10054                    - 2.*f3pCorrelations->GetBinContent(1)
10055                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10056                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,64))
10057                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(8))
10058                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n2n5n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10059                    - 2.*f2pCorrelations->GetBinContent(5)
10060                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10061                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,64))
10062                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(8))
10063                    / (dSumWLinearThree2n1n1n*dSumWLinearFive5n2n5n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10064    if(dError>0.)
10065    {
10066     f5pCumulants->SetBinError(8,pow(dError,0.5)); 
10067    }
10068   } // end of if(...)
10069  } // end of {
10070  f5pCumulants->SetBinContent(9,f5pCorrelations->GetBinContent(9)-f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(2));
10071  {
10072   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
10073   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
10074   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
10075   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
10076   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
10077   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
10078   Double_t dSumWLinearFive5n2n4n2n1n = 0.; // sum of linear event weights for <4>
10079   Double_t dSumWQuadraticFive5n2n4n2n1n = 0.; // sum of quadratic event weights <4>
10080   Double_t dSpreadFive5n2n4n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10081   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10082   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10083   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
10084   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10085   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10086   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
10087   dSumWLinearFive5n2n4n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10088   dSumWQuadraticFive5n2n4n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10089   dSpreadFive5n2n4n2n1n = f5pCorrelations->GetBinError(9);
10090   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
10091      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
10092      pow(dSumWLinearFive5n2n4n2n1n,2.)>dSumWQuadraticFive5n2n4n2n1n)
10093   {
10094    Double_t dError = pow(f3pCorrelations->GetBinContent(8),2.)
10095                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
10096                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
10097                    + pow(f2pCorrelations->GetBinContent(2),2.)
10098                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
10099                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
10100                    + pow((pow(dSumWQuadraticFive5n2n4n2n1n,0.5)/dSumWLinearFive5n2n4n2n1n)
10101                    * dSpreadFive5n2n4n2n1n*pow(pow(dSumWLinearFive5n2n4n2n1n,2.)/(pow(dSumWLinearFive5n2n4n2n1n,2.)-dSumWQuadraticFive5n2n4n2n1n),0.5),2.)
10102                    + 2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(2)
10103                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10104                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,13)) 
10105                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(8))
10106                    / (dSumWLinearTwo2n2n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10107                    - 2.*f3pCorrelations->GetBinContent(8)
10108                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10109                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,65))
10110                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(9))
10111                    / (dSumWLinearTwo2n2n*dSumWLinearFive5n2n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10112                    - 2.*f2pCorrelations->GetBinContent(2)
10113                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10114                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,65))
10115                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(9))
10116                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n2n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10117    if(dError>0.)
10118    {
10119     f5pCumulants->SetBinError(9,pow(dError,0.5)); 
10120    }
10121   } // end of if(...)
10122  } // end of {
10123  f5pCumulants->SetBinContent(10,f5pCorrelations->GetBinContent(10)-f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(3));
10124  {
10125   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
10126   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
10127   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
10128   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
10129   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
10130   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
10131   Double_t dSumWLinearFive5n3n4n3n1n = 0.; // sum of linear event weights for <4>
10132   Double_t dSumWQuadraticFive5n3n4n3n1n = 0.; // sum of quadratic event weights <4>
10133   Double_t dSpreadFive5n3n4n3n1n = 0.; // weighted and biased estimator for sigma of <4>
10134   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10135   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10136   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
10137   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10138   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10139   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
10140   dSumWLinearFive5n3n4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10141   dSumWQuadraticFive5n3n4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10142   dSpreadFive5n3n4n3n1n = f5pCorrelations->GetBinError(10);
10143   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
10144      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
10145      pow(dSumWLinearFive5n3n4n3n1n,2.)>dSumWQuadraticFive5n3n4n3n1n)
10146   {
10147    Double_t dError = pow(f3pCorrelations->GetBinContent(8),2.)
10148                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
10149                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
10150                    + pow(f2pCorrelations->GetBinContent(3),2.)
10151                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
10152                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
10153                    + pow((pow(dSumWQuadraticFive5n3n4n3n1n,0.5)/dSumWLinearFive5n3n4n3n1n)
10154                    * dSpreadFive5n3n4n3n1n*pow(pow(dSumWLinearFive5n3n4n3n1n,2.)/(pow(dSumWLinearFive5n3n4n3n1n,2.)-dSumWQuadraticFive5n3n4n3n1n),0.5),2.)
10155                    + 2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(3)
10156                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10157                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,13)) 
10158                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(8))
10159                    / (dSumWLinearTwo3n3n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10160                    - 2.*f3pCorrelations->GetBinContent(8)
10161                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10162                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,66))
10163                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(10))
10164                    / (dSumWLinearTwo3n3n*dSumWLinearFive5n3n4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10165                    - 2.*f2pCorrelations->GetBinContent(3)
10166                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10167                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,66))
10168                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(10))
10169                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n3n4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10170    if(dError>0.)
10171    {
10172     f5pCumulants->SetBinError(10,pow(dError,0.5)); 
10173    }
10174   } // end of if(...)
10175  } // end of {
10176  f5pCumulants->SetBinContent(11,f5pCorrelations->GetBinContent(11)-f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(4));
10177  {
10178   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
10179   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
10180   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
10181   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
10182   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
10183   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
10184   Double_t dSumWLinearFive5n4n4n3n2n = 0.; // sum of linear event weights for <4>
10185   Double_t dSumWQuadraticFive5n4n4n3n2n = 0.; // sum of quadratic event weights <4>
10186   Double_t dSpreadFive5n4n4n3n2n = 0.; // weighted and biased estimator for sigma of <4>
10187   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10188   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10189   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
10190   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10191   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10192   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
10193   dSumWLinearFive5n4n4n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10194   dSumWQuadraticFive5n4n4n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10195   dSpreadFive5n4n4n3n2n = f5pCorrelations->GetBinError(11);
10196   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
10197      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
10198      pow(dSumWLinearFive5n4n4n3n2n,2.)>dSumWQuadraticFive5n4n4n3n2n)
10199   {
10200    Double_t dError = pow(f3pCorrelations->GetBinContent(7),2.)
10201                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
10202                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
10203                    + pow(f2pCorrelations->GetBinContent(4),2.)
10204                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
10205                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
10206                    + pow((pow(dSumWQuadraticFive5n4n4n3n2n,0.5)/dSumWLinearFive5n4n4n3n2n)
10207                    * dSpreadFive5n4n4n3n2n*pow(pow(dSumWLinearFive5n4n4n3n2n,2.)/(pow(dSumWLinearFive5n4n4n3n2n,2.)-dSumWQuadraticFive5n4n4n3n2n),0.5),2.)
10208                    + 2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(4)
10209                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10210                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,12)) 
10211                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(7))
10212                    / (dSumWLinearTwo4n4n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10213                    - 2.*f3pCorrelations->GetBinContent(7)
10214                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10215                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,67))
10216                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(11))
10217                    / (dSumWLinearTwo4n4n*dSumWLinearFive5n4n4n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10218                    - 2.*f2pCorrelations->GetBinContent(4)
10219                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10220                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,67))
10221                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(11))
10222                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n4n4n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10223    if(dError>0.)
10224    {
10225     f5pCumulants->SetBinError(11,pow(dError,0.5)); 
10226    }
10227   } // end of if(...)
10228  } // end of {
10229  f5pCumulants->SetBinContent(12,f5pCorrelations->GetBinContent(12)-f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(5));
10230  {
10231   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
10232   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
10233   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
10234   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
10235   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
10236   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
10237   Double_t dSumWLinearFive5n3n5n2n1n = 0.; // sum of linear event weights for <4>
10238   Double_t dSumWQuadraticFive5n3n5n2n1n = 0.; // sum of quadratic event weights <4>
10239   Double_t dSpreadFive5n3n5n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10240   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10241   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10242   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
10243   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10244   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10245   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
10246   dSumWLinearFive5n3n5n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10247   dSumWQuadraticFive5n3n5n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10248   dSpreadFive5n3n5n2n1n = f5pCorrelations->GetBinError(12);
10249   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
10250      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
10251      pow(dSumWLinearFive5n3n5n2n1n,2.)>dSumWQuadraticFive5n3n5n2n1n)
10252   {
10253    Double_t dError = pow(f3pCorrelations->GetBinContent(5),2.)
10254                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
10255                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
10256                    + pow(f2pCorrelations->GetBinContent(5),2.)
10257                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
10258                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
10259                    + pow((pow(dSumWQuadraticFive5n3n5n2n1n,0.5)/dSumWLinearFive5n3n5n2n1n)
10260                    * dSpreadFive5n3n5n2n1n*pow(pow(dSumWLinearFive5n3n5n2n1n,2.)/(pow(dSumWLinearFive5n3n5n2n1n,2.)-dSumWQuadraticFive5n3n5n2n1n),0.5),2.)
10261                    + 2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(5)
10262                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10263                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,10)) 
10264                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(5))
10265                    / (dSumWLinearTwo5n5n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10266                    - 2.*f3pCorrelations->GetBinContent(5)
10267                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10268                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,68))
10269                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(12))
10270                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n3n5n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10271                    - 2.*f2pCorrelations->GetBinContent(5)
10272                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10273                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,68))
10274                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(12))
10275                    / (dSumWLinearThree3n2n1n*dSumWLinearFive5n3n5n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10276    if(dError>0.)
10277    {
10278     f5pCumulants->SetBinError(12,pow(dError,0.5)); 
10279    }
10280   } // end of if(...)
10281  } // end of {
10282  f5pCumulants->SetBinContent(13,f5pCorrelations->GetBinContent(13)-f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(5));
10283  {
10284   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
10285   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
10286   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
10287   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
10288   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
10289   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
10290   Double_t dSumWLinearFive5n4n5n2n2n = 0.; // sum of linear event weights for <4>
10291   Double_t dSumWQuadraticFive5n4n5n2n2n = 0.; // sum of quadratic event weights <4>
10292   Double_t dSpreadFive5n4n5n2n2n = 0.; // weighted and biased estimator for sigma of <4>
10293   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10294   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10295   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
10296   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10297   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10298   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
10299   dSumWLinearFive5n4n5n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10300   dSumWQuadraticFive5n4n5n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10301   dSpreadFive5n4n5n2n2n = f5pCorrelations->GetBinError(13);
10302   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
10303      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
10304      pow(dSumWLinearFive5n4n5n2n2n,2.)>dSumWQuadraticFive5n4n5n2n2n)
10305   {
10306    Double_t dError = pow(f3pCorrelations->GetBinContent(2),2.)
10307                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
10308                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
10309                    + pow(f2pCorrelations->GetBinContent(5),2.)
10310                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
10311                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
10312                    + pow((pow(dSumWQuadraticFive5n4n5n2n2n,0.5)/dSumWLinearFive5n4n5n2n2n)
10313                    * dSpreadFive5n4n5n2n2n*pow(pow(dSumWLinearFive5n4n5n2n2n,2.)/(pow(dSumWLinearFive5n4n5n2n2n,2.)-dSumWQuadraticFive5n4n5n2n2n),0.5),2.)
10314                    + 2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(5)
10315                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10316                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,8)) 
10317                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(2))
10318                    / (dSumWLinearTwo5n5n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10319                    - 2.*f3pCorrelations->GetBinContent(2)
10320                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10321                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,69))
10322                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(13))
10323                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n4n5n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10324                    - 2.*f2pCorrelations->GetBinContent(5)
10325                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10326                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,69))
10327                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(13))
10328                    / (dSumWLinearThree4n2n2n*dSumWLinearFive5n4n5n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10329    if(dError>0.)
10330    {
10331     f5pCumulants->SetBinError(13,pow(dError,0.5)); 
10332    }
10333   } // end of if(...)
10334  } // end of {
10335  f5pCumulants->SetBinContent(14,f5pCorrelations->GetBinContent(14)-f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(5));
10336  {
10337   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
10338   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
10339   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
10340   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
10341   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
10342   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
10343   Double_t dSumWLinearFive5n4n5n3n1n = 0.; // sum of linear event weights for <4>
10344   Double_t dSumWQuadraticFive5n4n5n3n1n = 0.; // sum of quadratic event weights <4>
10345   Double_t dSpreadFive5n4n5n3n1n = 0.; // weighted and biased estimator for sigma of <4>
10346   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10347   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10348   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
10349   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10350   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10351   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
10352   dSumWLinearFive5n4n5n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10353   dSumWQuadraticFive5n4n5n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10354   dSpreadFive5n4n5n3n1n = f5pCorrelations->GetBinError(14);
10355   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
10356      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
10357      pow(dSumWLinearFive5n4n5n3n1n,2.)>dSumWQuadraticFive5n4n5n3n1n)
10358   {
10359    Double_t dError = pow(f3pCorrelations->GetBinContent(6),2.)
10360                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
10361                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
10362                    + pow(f2pCorrelations->GetBinContent(5),2.)
10363                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
10364                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
10365                    + pow((pow(dSumWQuadraticFive5n4n5n3n1n,0.5)/dSumWLinearFive5n4n5n3n1n)
10366                    * dSpreadFive5n4n5n3n1n*pow(pow(dSumWLinearFive5n4n5n3n1n,2.)/(pow(dSumWLinearFive5n4n5n3n1n,2.)-dSumWQuadraticFive5n4n5n3n1n),0.5),2.)
10367                    + 2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(5)
10368                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10369                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,11)) 
10370                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(6))
10371                    / (dSumWLinearTwo5n5n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10372                    - 2.*f3pCorrelations->GetBinContent(6)
10373                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10374                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,70))
10375                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(14))
10376                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n4n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10377                    - 2.*f2pCorrelations->GetBinContent(5)
10378                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10379                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,70))
10380                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(14))
10381                    / (dSumWLinearThree4n3n1n*dSumWLinearFive5n4n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10382    if(dError>0.)
10383    {
10384     f5pCumulants->SetBinError(14,pow(dError,0.5)); 
10385    }
10386   } // end of if(...)
10387  } // end of {
10388  f5pCumulants->SetBinContent(15,f5pCorrelations->GetBinContent(15)-f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(1));
10389  {
10390   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
10391   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
10392   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
10393   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
10394   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
10395   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
10396   Double_t dSumWLinearFive6n1n3n3n1n = 0.; // sum of linear event weights for <4>
10397   Double_t dSumWQuadraticFive6n1n3n3n1n = 0.; // sum of quadratic event weights <4>
10398   Double_t dSpreadFive6n1n3n3n1n = 0.; // weighted and biased estimator for sigma of <4>
10399   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10400   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10401   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
10402   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10403   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10404   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
10405   dSumWLinearFive6n1n3n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10406   dSumWQuadraticFive6n1n3n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10407   dSpreadFive6n1n3n3n1n = f5pCorrelations->GetBinError(15);
10408   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
10409      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
10410      pow(dSumWLinearFive6n1n3n3n1n,2.)>dSumWQuadraticFive6n1n3n3n1n)
10411   {
10412    Double_t dError = pow(f3pCorrelations->GetBinContent(3),2.)
10413                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
10414                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
10415                    + pow(f2pCorrelations->GetBinContent(1),2.)
10416                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
10417                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
10418                    + pow((pow(dSumWQuadraticFive6n1n3n3n1n,0.5)/dSumWLinearFive6n1n3n3n1n)
10419                    * dSpreadFive6n1n3n3n1n*pow(pow(dSumWLinearFive6n1n3n3n1n,2.)/(pow(dSumWLinearFive6n1n3n3n1n,2.)-dSumWQuadraticFive6n1n3n3n1n),0.5),2.)
10420                    + 2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(1)
10421                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10422                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,9)) 
10423                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(3))
10424                    / (dSumWLinearTwo1n1n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10425                    - 2.*f3pCorrelations->GetBinContent(3)
10426                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10427                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,71))
10428                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(15))
10429                    / (dSumWLinearTwo1n1n*dSumWLinearFive6n1n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10430                    - 2.*f2pCorrelations->GetBinContent(1)
10431                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10432                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,71))
10433                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(15))
10434                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n1n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10435    if(dError>0.)
10436    {
10437     f5pCumulants->SetBinError(15,pow(dError,0.5)); 
10438    }
10439   } // end of if(...)
10440  } // end of {
10441  f5pCumulants->SetBinContent(16,f5pCorrelations->GetBinContent(16)-f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(2));
10442  {
10443   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
10444   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
10445   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
10446   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
10447   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
10448   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
10449   Double_t dSumWLinearFive6n2n3n3n2n = 0.; // sum of linear event weights for <4>
10450   Double_t dSumWQuadraticFive6n2n3n3n2n = 0.; // sum of quadratic event weights <4>
10451   Double_t dSpreadFive6n2n3n3n2n = 0.; // weighted and biased estimator for sigma of <4>
10452   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10453   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10454   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
10455   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10456   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10457   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
10458   dSumWLinearFive6n2n3n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10459   dSumWQuadraticFive6n2n3n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10460   dSpreadFive6n2n3n3n2n = f5pCorrelations->GetBinError(16);
10461   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
10462      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
10463      pow(dSumWLinearFive6n2n3n3n2n,2.)>dSumWQuadraticFive6n2n3n3n2n)
10464   {
10465    Double_t dError = pow(f3pCorrelations->GetBinContent(3),2.)
10466                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
10467                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
10468                    + pow(f2pCorrelations->GetBinContent(2),2.)
10469                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
10470                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
10471                    + pow((pow(dSumWQuadraticFive6n2n3n3n2n,0.5)/dSumWLinearFive6n2n3n3n2n)
10472                    * dSpreadFive6n2n3n3n2n*pow(pow(dSumWLinearFive6n2n3n3n2n,2.)/(pow(dSumWLinearFive6n2n3n3n2n,2.)-dSumWQuadraticFive6n2n3n3n2n),0.5),2.)
10473                    + 2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(2)
10474                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10475                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,9)) 
10476                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(3))
10477                    / (dSumWLinearTwo2n2n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10478                    - 2.*f3pCorrelations->GetBinContent(3)
10479                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10480                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,72))
10481                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(16))
10482                    / (dSumWLinearTwo2n2n*dSumWLinearFive6n2n3n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10483                    - 2.*f2pCorrelations->GetBinContent(2)
10484                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10485                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,72))
10486                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(16))
10487                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n2n3n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10488    if(dError>0.)
10489    {
10490     f5pCumulants->SetBinError(16,pow(dError,0.5)); 
10491    }
10492   } // end of if(...)
10493  } // end of {
10494  f5pCumulants->SetBinContent(17,f5pCorrelations->GetBinContent(17)-f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(1));
10495  {
10496   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
10497   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
10498   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
10499   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
10500   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
10501   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
10502   Double_t dSumWLinearFive6n1n4n2n1n = 0.; // sum of linear event weights for <4>
10503   Double_t dSumWQuadraticFive6n1n4n2n1n = 0.; // sum of quadratic event weights <4>
10504   Double_t dSpreadFive6n1n4n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10505   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10506   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10507   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
10508   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10509   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10510   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
10511   dSumWLinearFive6n1n4n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10512   dSumWQuadraticFive6n1n4n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10513   dSpreadFive6n1n4n2n1n = f5pCorrelations->GetBinError(17);
10514   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
10515      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
10516      pow(dSumWLinearFive6n1n4n2n1n,2.)>dSumWQuadraticFive6n1n4n2n1n)
10517   {
10518    Double_t dError = pow(f3pCorrelations->GetBinContent(9),2.)
10519                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
10520                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
10521                    + pow(f2pCorrelations->GetBinContent(1),2.)
10522                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
10523                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
10524                    + pow((pow(dSumWQuadraticFive6n1n4n2n1n,0.5)/dSumWLinearFive6n1n4n2n1n)
10525                    * dSpreadFive6n1n4n2n1n*pow(pow(dSumWLinearFive6n1n4n2n1n,2.)/(pow(dSumWLinearFive6n1n4n2n1n,2.)-dSumWQuadraticFive6n1n4n2n1n),0.5),2.)
10526                    + 2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(1)
10527                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10528                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,14)) 
10529                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(9))
10530                    / (dSumWLinearTwo1n1n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10531                    - 2.*f3pCorrelations->GetBinContent(9)
10532                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10533                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,73))
10534                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(17))
10535                    / (dSumWLinearTwo1n1n*dSumWLinearFive6n1n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10536                    - 2.*f2pCorrelations->GetBinContent(1)
10537                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10538                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,73))
10539                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(17))
10540                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n1n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10541    if(dError>0.)
10542    {
10543     f5pCumulants->SetBinError(17,pow(dError,0.5)); 
10544    }
10545   } // end of if(...)
10546  } // end of {
10547  f5pCumulants->SetBinContent(18,f5pCorrelations->GetBinContent(18)-f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(3));
10548  {
10549   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
10550   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
10551   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
10552   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
10553   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
10554   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
10555   Double_t dSumWLinearFive6n3n4n3n2n = 0.; // sum of linear event weights for <4>
10556   Double_t dSumWQuadraticFive6n3n4n3n2n = 0.; // sum of quadratic event weights <4>
10557   Double_t dSpreadFive6n3n4n3n2n = 0.; // weighted and biased estimator for sigma of <4>
10558   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10559   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10560   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
10561   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10562   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10563   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
10564   dSumWLinearFive6n3n4n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10565   dSumWQuadraticFive6n3n4n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10566   dSpreadFive6n3n4n3n2n = f5pCorrelations->GetBinError(18);
10567   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
10568      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
10569      pow(dSumWLinearFive6n3n4n3n2n,2.)>dSumWQuadraticFive6n3n4n3n2n)
10570   {
10571    Double_t dError = pow(f3pCorrelations->GetBinContent(9),2.)
10572                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
10573                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
10574                    + pow(f2pCorrelations->GetBinContent(3),2.)
10575                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
10576                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
10577                    + pow((pow(dSumWQuadraticFive6n3n4n3n2n,0.5)/dSumWLinearFive6n3n4n3n2n)
10578                    * dSpreadFive6n3n4n3n2n*pow(pow(dSumWLinearFive6n3n4n3n2n,2.)/(pow(dSumWLinearFive6n3n4n3n2n,2.)-dSumWQuadraticFive6n3n4n3n2n),0.5),2.)
10579                    + 2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(3)
10580                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10581                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,14)) 
10582                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(9))
10583                    / (dSumWLinearTwo3n3n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10584                    - 2.*f3pCorrelations->GetBinContent(9)
10585                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10586                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,74))
10587                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(18))
10588                    / (dSumWLinearTwo3n3n*dSumWLinearFive6n3n4n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10589                    - 2.*f2pCorrelations->GetBinContent(3)
10590                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10591                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,74))
10592                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(18))
10593                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n3n4n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10594    if(dError>0.)
10595    {
10596     f5pCumulants->SetBinError(18,pow(dError,0.5)); 
10597    }
10598   } // end of if(...)
10599  } // end of {
10600  f5pCumulants->SetBinContent(19,f5pCorrelations->GetBinContent(19)-f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(4));
10601  {
10602   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
10603   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
10604   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
10605   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
10606   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
10607   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
10608   Double_t dSumWLinearFive6n4n4n3n3n = 0.; // sum of linear event weights for <4>
10609   Double_t dSumWQuadraticFive6n4n4n3n3n = 0.; // sum of quadratic event weights <4>
10610   Double_t dSpreadFive6n4n4n3n3n = 0.; // weighted and biased estimator for sigma of <4>
10611   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10612   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10613   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
10614   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10615   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10616   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
10617   dSumWLinearFive6n4n4n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10618   dSumWQuadraticFive6n4n4n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10619   dSpreadFive6n4n4n3n3n = f5pCorrelations->GetBinError(19);
10620   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
10621      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
10622      pow(dSumWLinearFive6n4n4n3n3n,2.)>dSumWQuadraticFive6n4n4n3n3n)
10623   {
10624    Double_t dError = pow(f3pCorrelations->GetBinContent(3),2.)
10625                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
10626                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
10627                    + pow(f2pCorrelations->GetBinContent(4),2.)
10628                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
10629                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
10630                    + pow((pow(dSumWQuadraticFive6n4n4n3n3n,0.5)/dSumWLinearFive6n4n4n3n3n)
10631                    * dSpreadFive6n4n4n3n3n*pow(pow(dSumWLinearFive6n4n4n3n3n,2.)/(pow(dSumWLinearFive6n4n4n3n3n,2.)-dSumWQuadraticFive6n4n4n3n3n),0.5),2.)
10632                    + 2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(4)
10633                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10634                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,9)) 
10635                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(3))
10636                    / (dSumWLinearTwo4n4n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10637                    - 2.*f3pCorrelations->GetBinContent(3)
10638                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10639                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,75))
10640                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(19))
10641                    / (dSumWLinearTwo4n4n*dSumWLinearFive6n4n4n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10642                    - 2.*f2pCorrelations->GetBinContent(4)
10643                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10644                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,75))
10645                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(19))
10646                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n4n4n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10647    if(dError>0.)
10648    {
10649     f5pCumulants->SetBinError(19,pow(dError,0.5)); 
10650    }
10651   } // end of if(...)
10652  } // end of {
10653  f5pCumulants->SetBinContent(20,f5pCorrelations->GetBinContent(20)-f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(2));
10654  {
10655   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
10656   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
10657   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
10658   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
10659   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
10660   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
10661   Double_t dSumWLinearFive6n2n5n2n1n = 0.; // sum of linear event weights for <4>
10662   Double_t dSumWQuadraticFive6n2n5n2n1n = 0.; // sum of quadratic event weights <4>
10663   Double_t dSpreadFive6n2n5n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10664   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10665   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10666   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
10667   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10668   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10669   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
10670   dSumWLinearFive6n2n5n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10671   dSumWQuadraticFive6n2n5n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10672   dSpreadFive6n2n5n2n1n = f5pCorrelations->GetBinError(20);
10673   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
10674      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
10675      pow(dSumWLinearFive6n2n5n2n1n,2.)>dSumWQuadraticFive6n2n5n2n1n)
10676   {
10677    Double_t dError = pow(f3pCorrelations->GetBinContent(10),2.)
10678                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
10679                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
10680                    + pow(f2pCorrelations->GetBinContent(2),2.)
10681                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
10682                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
10683                    + pow((pow(dSumWQuadraticFive6n2n5n2n1n,0.5)/dSumWLinearFive6n2n5n2n1n)
10684                    * dSpreadFive6n2n5n2n1n*pow(pow(dSumWLinearFive6n2n5n2n1n,2.)/(pow(dSumWLinearFive6n2n5n2n1n,2.)-dSumWQuadraticFive6n2n5n2n1n),0.5),2.)
10685                    + 2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(2)
10686                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10687                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,15)) 
10688                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(10))
10689                    / (dSumWLinearTwo2n2n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10690                    - 2.*f3pCorrelations->GetBinContent(10)
10691                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10692                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,76))
10693                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(20))
10694                    / (dSumWLinearTwo2n2n*dSumWLinearFive6n2n5n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10695                    - 2.*f2pCorrelations->GetBinContent(2)
10696                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10697                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,76))
10698                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(20))
10699                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n2n5n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10700    if(dError>0.)
10701    {
10702     f5pCumulants->SetBinError(20,pow(dError,0.5)); 
10703    }
10704   } // end of if(...)
10705  } // end of {
10706  f5pCumulants->SetBinContent(21,f5pCorrelations->GetBinContent(21)-f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(3));
10707  {
10708   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
10709   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
10710   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
10711   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
10712   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
10713   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
10714   Double_t dSumWLinearFive6n3n5n3n1n = 0.; // sum of linear event weights for <4>
10715   Double_t dSumWQuadraticFive6n3n5n3n1n = 0.; // sum of quadratic event weights <4>
10716   Double_t dSpreadFive6n3n5n3n1n = 0.; // weighted and biased estimator for sigma of <4>
10717   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10718   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10719   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
10720   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10721   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10722   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
10723   dSumWLinearFive6n3n5n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10724   dSumWQuadraticFive6n3n5n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10725   dSpreadFive6n3n5n3n1n = f5pCorrelations->GetBinError(21);
10726   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
10727      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
10728      pow(dSumWLinearFive6n3n5n3n1n,2.)>dSumWQuadraticFive6n3n5n3n1n)
10729   {
10730    Double_t dError = pow(f3pCorrelations->GetBinContent(10),2.)
10731                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
10732                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
10733                    + pow(f2pCorrelations->GetBinContent(3),2.)
10734                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
10735                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
10736                    + pow((pow(dSumWQuadraticFive6n3n5n3n1n,0.5)/dSumWLinearFive6n3n5n3n1n)
10737                    * dSpreadFive6n3n5n3n1n*pow(pow(dSumWLinearFive6n3n5n3n1n,2.)/(pow(dSumWLinearFive6n3n5n3n1n,2.)-dSumWQuadraticFive6n3n5n3n1n),0.5),2.)
10738                    + 2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(3)
10739                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10740                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,15)) 
10741                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(10))
10742                    / (dSumWLinearTwo3n3n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10743                    - 2.*f3pCorrelations->GetBinContent(10)
10744                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10745                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,77))
10746                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(21))
10747                    / (dSumWLinearTwo3n3n*dSumWLinearFive6n3n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10748                    - 2.*f2pCorrelations->GetBinContent(3)
10749                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10750                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,77))
10751                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(21))
10752                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n3n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10753    if(dError>0.)
10754    {
10755     f5pCumulants->SetBinError(21,pow(dError,0.5)); 
10756    }
10757   } // end of if(...)
10758  } // end of {
10759  f5pCumulants->SetBinContent(22,f5pCorrelations->GetBinContent(22)-f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(4));
10760  {
10761   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
10762   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
10763   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
10764   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
10765   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
10766   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
10767   Double_t dSumWLinearFive6n3n5n3n1n = 0.; // sum of linear event weights for <4>
10768   Double_t dSumWQuadraticFive6n3n5n3n1n = 0.; // sum of quadratic event weights <4>
10769   Double_t dSpreadFive6n3n5n3n1n = 0.; // weighted and biased estimator for sigma of <4>
10770   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10771   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10772   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
10773   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10774   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10775   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
10776   dSumWLinearFive6n3n5n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10777   dSumWQuadraticFive6n3n5n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10778   dSpreadFive6n3n5n3n1n = f5pCorrelations->GetBinError(22);
10779   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
10780      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
10781      pow(dSumWLinearFive6n3n5n3n1n,2.)>dSumWQuadraticFive6n3n5n3n1n)
10782   {
10783    Double_t dError = pow(f3pCorrelations->GetBinContent(10),2.)
10784                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
10785                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
10786                    + pow(f2pCorrelations->GetBinContent(4),2.)
10787                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
10788                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
10789                    + pow((pow(dSumWQuadraticFive6n3n5n3n1n,0.5)/dSumWLinearFive6n3n5n3n1n)
10790                    * dSpreadFive6n3n5n3n1n*pow(pow(dSumWLinearFive6n3n5n3n1n,2.)/(pow(dSumWLinearFive6n3n5n3n1n,2.)-dSumWQuadraticFive6n3n5n3n1n),0.5),2.)
10791                    + 2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(4)
10792                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10793                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,15)) 
10794                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(10))
10795                    / (dSumWLinearTwo4n4n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10796                    - 2.*f3pCorrelations->GetBinContent(10)
10797                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10798                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,78))
10799                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(22))
10800                    / (dSumWLinearTwo4n4n*dSumWLinearFive6n3n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10801                    - 2.*f2pCorrelations->GetBinContent(4)
10802                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10803                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,78))
10804                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(22))
10805                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n3n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10806    if(dError>0.)
10807    {
10808     f5pCumulants->SetBinError(22,pow(dError,0.5)); 
10809    }
10810   } // end of if(...)
10811  } // end of {
10812  f5pCumulants->SetBinContent(23,f5pCorrelations->GetBinContent(23)-f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(5));
10813  {
10814   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
10815   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
10816   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
10817   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
10818   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
10819   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
10820   Double_t dSumWLinearFive6n5n5n3n3n = 0.; // sum of linear event weights for <4>
10821   Double_t dSumWQuadraticFive6n5n5n3n3n = 0.; // sum of quadratic event weights <4>
10822   Double_t dSpreadFive6n5n5n3n3n = 0.; // weighted and biased estimator for sigma of <4>
10823   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10824   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10825   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
10826   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10827   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10828   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
10829   dSumWLinearFive6n5n5n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10830   dSumWQuadraticFive6n5n5n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10831   dSpreadFive6n5n5n3n3n = f5pCorrelations->GetBinError(23);
10832   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
10833      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
10834      pow(dSumWLinearFive6n5n5n3n3n,2.)>dSumWQuadraticFive6n5n5n3n3n)
10835   {
10836    Double_t dError = pow(f3pCorrelations->GetBinContent(3),2.)
10837                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
10838                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
10839                    + pow(f2pCorrelations->GetBinContent(5),2.)
10840                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
10841                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
10842                    + pow((pow(dSumWQuadraticFive6n5n5n3n3n,0.5)/dSumWLinearFive6n5n5n3n3n)
10843                    * dSpreadFive6n5n5n3n3n*pow(pow(dSumWLinearFive6n5n5n3n3n,2.)/(pow(dSumWLinearFive6n5n5n3n3n,2.)-dSumWQuadraticFive6n5n5n3n3n),0.5),2.)
10844                    + 2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(5)
10845                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10846                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,9)) 
10847                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(3))
10848                    / (dSumWLinearTwo5n5n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10849                    - 2.*f3pCorrelations->GetBinContent(3)
10850                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10851                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,79))
10852                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(23))
10853                    / (dSumWLinearTwo5n5n*dSumWLinearFive6n5n5n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10854                    - 2.*f2pCorrelations->GetBinContent(5)
10855                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10856                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,79))
10857                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(23))
10858                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n5n5n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10859    if(dError>0.)
10860    {
10861     f5pCumulants->SetBinError(23,pow(dError,0.5)); 
10862    }
10863   } // end of if(...)
10864  } // end of {
10865  f5pCumulants->SetBinContent(24,f5pCorrelations->GetBinContent(24)-f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(6));
10866  {
10867   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
10868   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
10869   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
10870   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
10871   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
10872   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
10873   Double_t dSumWLinearFive6n2n6n1n1n = 0.; // sum of linear event weights for <4>
10874   Double_t dSumWQuadraticFive6n2n6n1n1n = 0.; // sum of quadratic event weights <4>
10875   Double_t dSpreadFive6n2n6n1n1n = 0.; // weighted and biased estimator for sigma of <4>
10876   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10877   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10878   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
10879   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10880   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10881   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
10882   dSumWLinearFive6n2n6n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10883   dSumWQuadraticFive6n2n6n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10884   dSpreadFive6n2n6n1n1n = f5pCorrelations->GetBinError(24);
10885   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
10886      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
10887      pow(dSumWLinearFive6n2n6n1n1n,2.)>dSumWQuadraticFive6n2n6n1n1n)
10888   {
10889    Double_t dError = pow(f3pCorrelations->GetBinContent(1),2.)
10890                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
10891                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
10892                    + pow(f2pCorrelations->GetBinContent(6),2.)
10893                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
10894                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
10895                    + pow((pow(dSumWQuadraticFive6n2n6n1n1n,0.5)/dSumWLinearFive6n2n6n1n1n)
10896                    * dSpreadFive6n2n6n1n1n*pow(pow(dSumWLinearFive6n2n6n1n1n,2.)/(pow(dSumWLinearFive6n2n6n1n1n,2.)-dSumWQuadraticFive6n2n6n1n1n),0.5),2.)
10897                    + 2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(6)
10898                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10899                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,7)) 
10900                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(1))
10901                    / (dSumWLinearTwo6n6n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10902                    - 2.*f3pCorrelations->GetBinContent(1)
10903                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10904                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,80))
10905                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(24))
10906                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n2n6n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10907                    - 2.*f2pCorrelations->GetBinContent(6)
10908                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10909                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,80))
10910                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(24))
10911                    / (dSumWLinearThree2n1n1n*dSumWLinearFive6n2n6n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10912    if(dError>0.)
10913    {
10914     f5pCumulants->SetBinError(24,pow(dError,0.5)); 
10915    }
10916   } // end of if(...)
10917  } // end of {
10918  f5pCumulants->SetBinContent(25,f5pCorrelations->GetBinContent(25)-f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(6));
10919  {
10920   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
10921   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
10922   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
10923   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
10924   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
10925   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
10926   Double_t dSumWLinearFive6n3n6n2n1n = 0.; // sum of linear event weights for <4>
10927   Double_t dSumWQuadraticFive6n3n6n2n1n = 0.; // sum of quadratic event weights <4>
10928   Double_t dSpreadFive6n3n6n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10929   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10930   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10931   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
10932   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10933   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10934   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
10935   dSumWLinearFive6n3n6n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10936   dSumWQuadraticFive6n3n6n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10937   dSpreadFive6n3n6n2n1n = f5pCorrelations->GetBinError(25);
10938   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
10939      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
10940      pow(dSumWLinearFive6n3n6n2n1n,2.)>dSumWQuadraticFive6n3n6n2n1n)
10941   {
10942    Double_t dError = pow(f3pCorrelations->GetBinContent(5),2.)
10943                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
10944                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
10945                    + pow(f2pCorrelations->GetBinContent(6),2.)
10946                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
10947                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
10948                    + pow((pow(dSumWQuadraticFive6n3n6n2n1n,0.5)/dSumWLinearFive6n3n6n2n1n)
10949                    * dSpreadFive6n3n6n2n1n*pow(pow(dSumWLinearFive6n3n6n2n1n,2.)/(pow(dSumWLinearFive6n3n6n2n1n,2.)-dSumWQuadraticFive6n3n6n2n1n),0.5),2.)
10950                    + 2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(6)
10951                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10952                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,10)) 
10953                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(5))
10954                    / (dSumWLinearTwo6n6n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10955                    - 2.*f3pCorrelations->GetBinContent(5)
10956                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10957                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,81))
10958                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(25))
10959                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n3n6n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10960                    - 2.*f2pCorrelations->GetBinContent(6)
10961                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10962                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,81))
10963                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(25))
10964                    / (dSumWLinearThree3n2n1n*dSumWLinearFive6n3n6n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10965    if(dError>0.)
10966    {
10967     f5pCumulants->SetBinError(25,pow(dError,0.5)); 
10968    }
10969   } // end of if(...)
10970  } // end of {
10971  f5pCumulants->SetBinContent(26,f5pCorrelations->GetBinContent(26)-f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(6));
10972  {
10973   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
10974   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
10975   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
10976   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
10977   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
10978   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
10979   Double_t dSumWLinearFive6n4n6n2n2n = 0.; // sum of linear event weights for <4>
10980   Double_t dSumWQuadraticFive6n4n6n2n2n = 0.; // sum of quadratic event weights <4>
10981   Double_t dSpreadFive6n4n6n2n2n = 0.; // weighted and biased estimator for sigma of <4>
10982   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10983   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10984   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
10985   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10986   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10987   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
10988   dSumWLinearFive6n4n6n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10989   dSumWQuadraticFive6n4n6n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10990   dSpreadFive6n4n6n2n2n = f5pCorrelations->GetBinError(26);
10991   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
10992      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
10993      pow(dSumWLinearFive6n4n6n2n2n,2.)>dSumWQuadraticFive6n4n6n2n2n)
10994   {
10995    Double_t dError = pow(f3pCorrelations->GetBinContent(2),2.)
10996                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
10997                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
10998                    + pow(f2pCorrelations->GetBinContent(6),2.)
10999                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
11000                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
11001                    + pow((pow(dSumWQuadraticFive6n4n6n2n2n,0.5)/dSumWLinearFive6n4n6n2n2n)
11002                    * dSpreadFive6n4n6n2n2n*pow(pow(dSumWLinearFive6n4n6n2n2n,2.)/(pow(dSumWLinearFive6n4n6n2n2n,2.)-dSumWQuadraticFive6n4n6n2n2n),0.5),2.)
11003                    + 2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(6)
11004                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11005                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,8)) 
11006                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(2))
11007                    / (dSumWLinearTwo6n6n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11008                    - 2.*f3pCorrelations->GetBinContent(2)
11009                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11010                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,82))
11011                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(26))
11012                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n4n6n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11013                    - 2.*f2pCorrelations->GetBinContent(6)
11014                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11015                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,82))
11016                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(26))
11017                    / (dSumWLinearThree4n2n2n*dSumWLinearFive6n4n6n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11018    if(dError>0.)
11019    {
11020     f5pCumulants->SetBinError(26,pow(dError,0.5)); 
11021    }
11022   } // end of if(...)
11023  } // end of {
11024  f5pCumulants->SetBinContent(27,f5pCorrelations->GetBinContent(27)-f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(6));
11025  {
11026   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11027   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11028   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11029   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
11030   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
11031   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
11032   Double_t dSumWLinearFive6n4n6n3n1n = 0.; // sum of linear event weights for <4>
11033   Double_t dSumWQuadraticFive6n4n6n3n1n = 0.; // sum of quadratic event weights <4>
11034   Double_t dSpreadFive6n4n6n3n1n = 0.; // weighted and biased estimator for sigma of <4>
11035   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11036   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11037   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11038   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11039   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11040   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
11041   dSumWLinearFive6n4n6n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11042   dSumWQuadraticFive6n4n6n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11043   dSpreadFive6n4n6n3n1n = f5pCorrelations->GetBinError(27);
11044   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11045      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
11046      pow(dSumWLinearFive6n4n6n3n1n,2.)>dSumWQuadraticFive6n4n6n3n1n)
11047   {
11048    Double_t dError = pow(f3pCorrelations->GetBinContent(6),2.)
11049                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11050                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11051                    + pow(f2pCorrelations->GetBinContent(6),2.)
11052                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
11053                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
11054                    + pow((pow(dSumWQuadraticFive6n4n6n3n1n,0.5)/dSumWLinearFive6n4n6n3n1n)
11055                    * dSpreadFive6n4n6n3n1n*pow(pow(dSumWLinearFive6n4n6n3n1n,2.)/(pow(dSumWLinearFive6n4n6n3n1n,2.)-dSumWQuadraticFive6n4n6n3n1n),0.5),2.)
11056                    + 2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(6)
11057                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11058                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,11)) 
11059                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(6))
11060                    / (dSumWLinearTwo6n6n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11061                    - 2.*f3pCorrelations->GetBinContent(6)
11062                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11063                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,83))
11064                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(27))
11065                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n4n6n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11066                    - 2.*f2pCorrelations->GetBinContent(6)
11067                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11068                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,83))
11069                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(27))
11070                    / (dSumWLinearThree4n3n1n*dSumWLinearFive6n4n6n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11071    if(dError>0.)
11072    {
11073     f5pCumulants->SetBinError(27,pow(dError,0.5)); 
11074    }
11075   } // end of if(...)
11076  } // end of {
11077  f5pCumulants->SetBinContent(28,f5pCorrelations->GetBinContent(28)-f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(5));
11078  {
11079   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
11080   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
11081   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
11082   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
11083   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
11084   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
11085   Double_t dSumWLinearFive6n4n6n3n1n = 0.; // sum of linear event weights for <4>
11086   Double_t dSumWQuadraticFive6n4n6n3n1n = 0.; // sum of quadratic event weights <4>
11087   Double_t dSpreadFive6n4n6n3n1n = 0.; // weighted and biased estimator for sigma of <4>
11088   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11089   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11090   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
11091   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11092   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11093   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
11094   dSumWLinearFive6n4n6n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11095   dSumWQuadraticFive6n4n6n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11096   dSpreadFive6n4n6n3n1n = f5pCorrelations->GetBinError(28);
11097   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
11098      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
11099      pow(dSumWLinearFive6n4n6n3n1n,2.)>dSumWQuadraticFive6n4n6n3n1n)
11100   {
11101    Double_t dError = pow(f3pCorrelations->GetBinContent(9),2.)
11102                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
11103                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
11104                    + pow(f2pCorrelations->GetBinContent(5),2.)
11105                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
11106                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
11107                    + pow((pow(dSumWQuadraticFive6n4n6n3n1n,0.5)/dSumWLinearFive6n4n6n3n1n)
11108                    * dSpreadFive6n4n6n3n1n*pow(pow(dSumWLinearFive6n4n6n3n1n,2.)/(pow(dSumWLinearFive6n4n6n3n1n,2.)-dSumWQuadraticFive6n4n6n3n1n),0.5),2.)
11109                    + 2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(5)
11110                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11111                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,14)) 
11112                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(9))
11113                    / (dSumWLinearTwo5n5n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11114                    - 2.*f3pCorrelations->GetBinContent(9)
11115                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11116                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,84))
11117                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(28))
11118                    / (dSumWLinearTwo5n5n*dSumWLinearFive6n4n6n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11119                    - 2.*f2pCorrelations->GetBinContent(5)
11120                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11121                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,84))
11122                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(28))
11123                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n4n6n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11124    if(dError>0.)
11125    {
11126     f5pCumulants->SetBinError(28,pow(dError,0.5)); 
11127    }
11128   } // end of if(...)
11129  } // end of {
11130  f5pCumulants->SetBinContent(29,f5pCorrelations->GetBinContent(29)-f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(6));
11131  { 
11132   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11133   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11134   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11135   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
11136   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
11137   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
11138   Double_t dSumWLinearFive6n5n6n3n2n = 0.; // sum of linear event weights for <4>
11139   Double_t dSumWQuadraticFive6n5n6n3n2n = 0.; // sum of quadratic event weights <4>
11140   Double_t dSpreadFive6n5n6n3n2n = 0.; // weighted and biased estimator for sigma of <4>
11141   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11142   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11143   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11144   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11145   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11146   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
11147   dSumWLinearFive6n5n6n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11148   dSumWQuadraticFive6n5n6n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11149   dSpreadFive6n5n6n3n2n = f5pCorrelations->GetBinError(29);
11150   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11151      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
11152      pow(dSumWLinearFive6n5n6n3n2n,2.)>dSumWQuadraticFive6n5n6n3n2n)
11153   {
11154    Double_t dError = pow(f3pCorrelations->GetBinContent(7),2.)
11155                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11156                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11157                    + pow(f2pCorrelations->GetBinContent(6),2.)
11158                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
11159                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
11160                    + pow((pow(dSumWQuadraticFive6n5n6n3n2n,0.5)/dSumWLinearFive6n5n6n3n2n)
11161                    * dSpreadFive6n5n6n3n2n*pow(pow(dSumWLinearFive6n5n6n3n2n,2.)/(pow(dSumWLinearFive6n5n6n3n2n,2.)-dSumWQuadraticFive6n5n6n3n2n),0.5),2.)
11162                    + 2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(6)
11163                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11164                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,12)) 
11165                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(7))
11166                    / (dSumWLinearTwo6n6n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11167                    - 2.*f3pCorrelations->GetBinContent(7)
11168                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11169                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,85))
11170                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(29))
11171                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n5n6n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11172                    - 2.*f2pCorrelations->GetBinContent(6)
11173                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11174                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,85))
11175                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(29))
11176                    / (dSumWLinearThree5n3n2n*dSumWLinearFive6n5n6n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11177    if(dError>0.)
11178    {
11179     f5pCumulants->SetBinError(29,pow(dError,0.5)); 
11180    }
11181   } // end of if(...)
11182  } // end of {
11183  f5pCumulants->SetBinContent(30,f5pCorrelations->GetBinContent(30)-f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(6));
11184  { 
11185   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11186   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11187   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11188   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
11189   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
11190   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
11191   Double_t dSumWLinearFive6n5n6n4n1n = 0.; // sum of linear event weights for <4>
11192   Double_t dSumWQuadraticFive6n5n6n4n1n = 0.; // sum of quadratic event weights <4>
11193   Double_t dSpreadFive6n5n6n4n1n = 0.; // weighted and biased estimator for sigma of <4>
11194   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11195   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11196   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11197   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11198   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11199   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
11200   dSumWLinearFive6n5n6n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11201   dSumWQuadraticFive6n5n6n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11202   dSpreadFive6n5n6n4n1n = f5pCorrelations->GetBinError(30);
11203   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11204      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
11205      pow(dSumWLinearFive6n5n6n4n1n,2.)>dSumWQuadraticFive6n5n6n4n1n)
11206   {
11207    Double_t dError = pow(f3pCorrelations->GetBinContent(8),2.)
11208                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11209                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11210                    + pow(f2pCorrelations->GetBinContent(6),2.)
11211                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
11212                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
11213                    + pow((pow(dSumWQuadraticFive6n5n6n4n1n,0.5)/dSumWLinearFive6n5n6n4n1n)
11214                    * dSpreadFive6n5n6n4n1n*pow(pow(dSumWLinearFive6n5n6n4n1n,2.)/(pow(dSumWLinearFive6n5n6n4n1n,2.)-dSumWQuadraticFive6n5n6n4n1n),0.5),2.)
11215                    + 2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(6)
11216                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11217                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,13)) 
11218                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(8))
11219                    / (dSumWLinearTwo6n6n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11220                    - 2.*f3pCorrelations->GetBinContent(8)
11221                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11222                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,86))
11223                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(30))
11224                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n5n6n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11225                    - 2.*f2pCorrelations->GetBinContent(6)
11226                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11227                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,86))
11228                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(30))
11229                    / (dSumWLinearThree5n4n1n*dSumWLinearFive6n5n6n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11230    if(dError>0.)
11231    {
11232     f5pCumulants->SetBinError(30,pow(dError,0.5)); 
11233    }
11234   } // end of if(...)
11235  } // end of {
11236  // d2) "Two distinct harmonics":
11237  f5pCumulants->SetBinContent(32,f5pCorrelations->GetBinContent(32)-3.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(1));
11238  { 
11239   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
11240   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
11241   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
11242   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
11243   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
11244   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
11245   Double_t dSumWLinearFive2n1n1n1n1n = 0.; // sum of linear event weights for <4>
11246   Double_t dSumWQuadraticFive2n1n1n1n1n = 0.; // sum of quadratic event weights <4>
11247   Double_t dSpreadFive2n1n1n1n1n = 0.; // weighted and biased estimator for sigma of <4>
11248   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11249   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11250   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
11251   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11252   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11253   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
11254   dSumWLinearFive2n1n1n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11255   dSumWQuadraticFive2n1n1n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11256   dSpreadFive2n1n1n1n1n = f5pCorrelations->GetBinError(32);
11257   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
11258      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
11259      pow(dSumWLinearFive2n1n1n1n1n,2.)>dSumWQuadraticFive2n1n1n1n1n)
11260   {
11261    Double_t dError = 9.*pow(f3pCorrelations->GetBinContent(1),2.)
11262                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
11263                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
11264                    + 9.*pow(f2pCorrelations->GetBinContent(1),2.)
11265                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
11266                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
11267                    + pow((pow(dSumWQuadraticFive2n1n1n1n1n,0.5)/dSumWLinearFive2n1n1n1n1n)
11268                    * dSpreadFive2n1n1n1n1n*pow(pow(dSumWLinearFive2n1n1n1n1n,2.)/(pow(dSumWLinearFive2n1n1n1n1n,2.)-dSumWQuadraticFive2n1n1n1n1n),0.5),2.)
11269                    + 9.*2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(1)
11270                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11271                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,7)) 
11272                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(1))
11273                    / (dSumWLinearTwo1n1n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11274                    - 3.*2.*f3pCorrelations->GetBinContent(1)
11275                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11276                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,87))
11277                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(32))
11278                    / (dSumWLinearTwo1n1n*dSumWLinearFive2n1n1n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11279                    - 3.*2.*f2pCorrelations->GetBinContent(1)
11280                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11281                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,87))
11282                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(32))
11283                    / (dSumWLinearThree2n1n1n*dSumWLinearFive2n1n1n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11284    if(dError>0.)
11285    {
11286     f5pCumulants->SetBinError(32,pow(dError,0.5)); 
11287    }
11288   } // end of if(...)
11289  } // end of {
11290  f5pCumulants->SetBinContent(33,f5pCorrelations->GetBinContent(33)-2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(2));
11291  { 
11292   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
11293   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
11294   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
11295   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
11296   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
11297   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
11298   Double_t dSumWLinearFive2n2n2n1n1n = 0.; // sum of linear event weights for <4>
11299   Double_t dSumWQuadraticFive2n2n2n1n1n = 0.; // sum of quadratic event weights <4>
11300   Double_t dSpreadFive2n2n2n1n1n = 0.; // weighted and biased estimator for sigma of <4>
11301   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11302   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11303   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
11304   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11305   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11306   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
11307   dSumWLinearFive2n2n2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11308   dSumWQuadraticFive2n2n2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11309   dSpreadFive2n2n2n1n1n = f5pCorrelations->GetBinError(33);
11310   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
11311      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
11312      pow(dSumWLinearFive2n2n2n1n1n,2.)>dSumWQuadraticFive2n2n2n1n1n)
11313   {
11314    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(1),2.)
11315                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
11316                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
11317                    + 4.*pow(f2pCorrelations->GetBinContent(2),2.)
11318                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
11319                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
11320                    + pow((pow(dSumWQuadraticFive2n2n2n1n1n,0.5)/dSumWLinearFive2n2n2n1n1n)
11321                    * dSpreadFive2n2n2n1n1n*pow(pow(dSumWLinearFive2n2n2n1n1n,2.)/(pow(dSumWLinearFive2n2n2n1n1n,2.)-dSumWQuadraticFive2n2n2n1n1n),0.5),2.)
11322                    + 4.*2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(2)
11323                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11324                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,7)) 
11325                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(1))
11326                    / (dSumWLinearTwo2n2n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11327                    - 2.*2.*f3pCorrelations->GetBinContent(1)
11328                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11329                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,88))
11330                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(33))
11331                    / (dSumWLinearTwo2n2n*dSumWLinearFive2n2n2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11332                    - 2.*2.*f2pCorrelations->GetBinContent(2)
11333                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11334                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,88))
11335                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(33))
11336                    / (dSumWLinearThree2n1n1n*dSumWLinearFive2n2n2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11337    if(dError>0.)
11338    {
11339     f5pCumulants->SetBinError(33,pow(dError,0.5)); 
11340    }
11341   } // end of if(...)
11342  } // end of {
11343  f5pCumulants->SetBinContent(34,f5pCorrelations->GetBinContent(34));
11344  {
11345   Double_t dSumWLinear = 0.; // sum of linear event weights
11346   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11347   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11348   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11349   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11350   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11351   dSpread = f5pCorrelations->GetBinError(34);
11352   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11353   {
11354    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11355    f5pCumulants->SetBinError(34,dError); 
11356   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11357  } 
11358  f5pCumulants->SetBinContent(35,f5pCorrelations->GetBinContent(35));
11359  {
11360   Double_t dSumWLinear = 0.; // sum of linear event weights
11361   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11362   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11363   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11364   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11365   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11366   dSpread = f5pCorrelations->GetBinError(35);
11367   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11368   {
11369    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11370    f5pCumulants->SetBinError(35,dError); 
11371   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11372  } 
11373  f5pCumulants->SetBinContent(36,f5pCorrelations->GetBinContent(36)-3.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(2));
11374  { 
11375   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
11376   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
11377   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
11378   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
11379   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
11380   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
11381   Double_t dSumWLinearFive4n2n2n2n2n = 0.; // sum of linear event weights for <4>
11382   Double_t dSumWQuadraticFive4n2n2n2n2n = 0.; // sum of quadratic event weights <4>
11383   Double_t dSpreadFive4n2n2n2n2n = 0.; // weighted and biased estimator for sigma of <4>
11384   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11385   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11386   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
11387   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11388   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11389   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
11390   dSumWLinearFive4n2n2n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11391   dSumWQuadraticFive4n2n2n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11392   dSpreadFive4n2n2n2n2n = f5pCorrelations->GetBinError(36);
11393   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
11394      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
11395      pow(dSumWLinearFive4n2n2n2n2n,2.)>dSumWQuadraticFive4n2n2n2n2n)
11396   {
11397    Double_t dError = 9.*pow(f3pCorrelations->GetBinContent(2),2.)
11398                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
11399                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
11400                    + 9.*pow(f2pCorrelations->GetBinContent(2),2.)
11401                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
11402                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
11403                    + pow((pow(dSumWQuadraticFive4n2n2n2n2n,0.5)/dSumWLinearFive4n2n2n2n2n)
11404                    * dSpreadFive4n2n2n2n2n*pow(pow(dSumWLinearFive4n2n2n2n2n,2.)/(pow(dSumWLinearFive4n2n2n2n2n,2.)-dSumWQuadraticFive4n2n2n2n2n),0.5),2.)
11405                    + 9.*2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(2)
11406                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11407                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,8)) 
11408                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(2))
11409                    / (dSumWLinearTwo2n2n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11410                    - 3.*2.*f3pCorrelations->GetBinContent(2)
11411                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11412                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,91))
11413                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(36))
11414                    / (dSumWLinearTwo2n2n*dSumWLinearFive4n2n2n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11415                    - 3.*2.*f2pCorrelations->GetBinContent(2)
11416                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11417                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,91))
11418                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(36))
11419                    / (dSumWLinearThree4n2n2n*dSumWLinearFive4n2n2n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11420    if(dError>0.)
11421    {
11422     f5pCumulants->SetBinError(36,pow(dError,0.5)); 
11423    }
11424   } // end of if(...)
11425  } // end of {
11426  f5pCumulants->SetBinContent(37,f5pCorrelations->GetBinContent(37)-2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(4)); 
11427  { 
11428   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
11429   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
11430   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
11431   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
11432   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
11433   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
11434   Double_t dSumWLinearFive4n4n4n2n2n = 0.; // sum of linear event weights for <4>
11435   Double_t dSumWQuadraticFive4n4n4n2n2n = 0.; // sum of quadratic event weights <4>
11436   Double_t dSpreadFive4n4n4n2n2n = 0.; // weighted and biased estimator for sigma of <4>
11437   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11438   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11439   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
11440   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11441   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11442   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
11443   dSumWLinearFive4n4n4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11444   dSumWQuadraticFive4n4n4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11445   dSpreadFive4n4n4n2n2n = f5pCorrelations->GetBinError(37);
11446   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
11447      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
11448      pow(dSumWLinearFive4n4n4n2n2n,2.)>dSumWQuadraticFive4n4n4n2n2n)
11449   {
11450    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(2),2.)
11451                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
11452                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
11453                    + 4.*pow(f2pCorrelations->GetBinContent(4),2.)
11454                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
11455                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
11456                    + pow((pow(dSumWQuadraticFive4n4n4n2n2n,0.5)/dSumWLinearFive4n4n4n2n2n)
11457                    * dSpreadFive4n4n4n2n2n*pow(pow(dSumWLinearFive4n4n4n2n2n,2.)/(pow(dSumWLinearFive4n4n4n2n2n,2.)-dSumWQuadraticFive4n4n4n2n2n),0.5),2.)
11458                    + 4.*2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(4)
11459                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11460                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,8)) 
11461                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(2))
11462                    / (dSumWLinearTwo4n4n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11463                    - 2.*2.*f3pCorrelations->GetBinContent(2)
11464                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11465                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,92))
11466                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(37))
11467                    / (dSumWLinearTwo4n4n*dSumWLinearFive4n4n4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11468                    - 2.*2.*f2pCorrelations->GetBinContent(4)
11469                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11470                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,92))
11471                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(37))
11472                    / (dSumWLinearThree4n2n2n*dSumWLinearFive4n4n4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11473    if(dError>0.)
11474    {
11475     f5pCumulants->SetBinError(37,pow(dError,0.5)); 
11476    }
11477   } // end of if(...)
11478  } // end of {
11479  f5pCumulants->SetBinContent(38,f5pCorrelations->GetBinContent(38)-3.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(3)); 
11480  { 
11481   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
11482   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
11483   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
11484   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
11485   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
11486   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
11487   Double_t dSumWLinearFive6n3n3n3n3n = 0.; // sum of linear event weights for <4>
11488   Double_t dSumWQuadraticFive6n3n3n3n3n = 0.; // sum of quadratic event weights <4>
11489   Double_t dSpreadFive6n3n3n3n3n = 0.; // weighted and biased estimator for sigma of <4>
11490   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11491   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11492   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
11493   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11494   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11495   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
11496   dSumWLinearFive6n3n3n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11497   dSumWQuadraticFive6n3n3n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11498   dSpreadFive6n3n3n3n3n = f5pCorrelations->GetBinError(38);
11499   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
11500      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
11501      pow(dSumWLinearFive6n3n3n3n3n,2.)>dSumWQuadraticFive6n3n3n3n3n)
11502   {
11503    Double_t dError = 9.*pow(f3pCorrelations->GetBinContent(3),2.)
11504                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
11505                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
11506                    + 9.*pow(f2pCorrelations->GetBinContent(3),2.)
11507                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
11508                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
11509                    + pow((pow(dSumWQuadraticFive6n3n3n3n3n,0.5)/dSumWLinearFive6n3n3n3n3n)
11510                    * dSpreadFive6n3n3n3n3n*pow(pow(dSumWLinearFive6n3n3n3n3n,2.)/(pow(dSumWLinearFive6n3n3n3n3n,2.)-dSumWQuadraticFive6n3n3n3n3n),0.5),2.)
11511                    + 9.*2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(3)
11512                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11513                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,9)) 
11514                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(3))
11515                    / (dSumWLinearTwo3n3n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11516                    - 3.*2.*f3pCorrelations->GetBinContent(3)
11517                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11518                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,93))
11519                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(38))
11520                    / (dSumWLinearTwo3n3n*dSumWLinearFive6n3n3n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11521                    - 3.*2.*f2pCorrelations->GetBinContent(3)
11522                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11523                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,93))
11524                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(38))
11525                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n3n3n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11526    if(dError>0.)
11527    {
11528     f5pCumulants->SetBinError(38,pow(dError,0.5)); 
11529    }
11530   } // end of if(...)
11531  } // end of {
11532  f5pCumulants->SetBinContent(39,f5pCorrelations->GetBinContent(39));
11533  {
11534   Double_t dSumWLinear = 0.; // sum of linear event weights
11535   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11536   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11537   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11538   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11539   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11540   dSpread = f5pCorrelations->GetBinError(39);
11541   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11542   {
11543    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11544    f5pCumulants->SetBinError(39,dError); 
11545   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11546  } 
11547  f5pCumulants->SetBinContent(40,f5pCorrelations->GetBinContent(40)-2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(6)); 
11548  { 
11549   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11550   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11551   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11552   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
11553   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
11554   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
11555   Double_t dSumWLinearFive6n6n6n3n3n = 0.; // sum of linear event weights for <4>
11556   Double_t dSumWQuadraticFive6n6n6n3n3n = 0.; // sum of quadratic event weights <4>
11557   Double_t dSpreadFive6n6n6n3n3n = 0.; // weighted and biased estimator for sigma of <4>
11558   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11559   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11560   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11561   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11562   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11563   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
11564   dSumWLinearFive6n6n6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11565   dSumWQuadraticFive6n6n6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11566   dSpreadFive6n6n6n3n3n = f5pCorrelations->GetBinError(40);
11567   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11568      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
11569      pow(dSumWLinearFive6n6n6n3n3n,2.)>dSumWQuadraticFive6n6n6n3n3n)
11570   {
11571    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(3),2.)
11572                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11573                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11574                    + 4.*pow(f2pCorrelations->GetBinContent(6),2.)
11575                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
11576                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
11577                    + pow((pow(dSumWQuadraticFive6n6n6n3n3n,0.5)/dSumWLinearFive6n6n6n3n3n)
11578                    * dSpreadFive6n6n6n3n3n*pow(pow(dSumWLinearFive6n6n6n3n3n,2.)/(pow(dSumWLinearFive6n6n6n3n3n,2.)-dSumWQuadraticFive6n6n6n3n3n),0.5),2.)
11579                    + 4.*2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(6)
11580                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11581                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,9)) 
11582                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(3))
11583                    / (dSumWLinearTwo6n6n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11584                    - 2.*2.*f3pCorrelations->GetBinContent(3)
11585                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11586                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,95))
11587                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(40))
11588                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n6n6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11589                    - 2.*2.*f2pCorrelations->GetBinContent(6)
11590                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11591                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,95))
11592                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(40))
11593                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n6n6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11594    if(dError>0.)
11595    {
11596     f5pCumulants->SetBinError(40,pow(dError,0.5)); 
11597    }
11598   } // end of if(...)
11599  } // end of {
11600
11601  // d2) "Three distinct harmonics":
11602  f5pCumulants->SetBinContent(42,f5pCorrelations->GetBinContent(42)-2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(1)); 
11603  { 
11604   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
11605   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
11606   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
11607   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
11608   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
11609   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
11610   Double_t dSumWLinearFive3n1n2n1n1n = 0.; // sum of linear event weights for <4>
11611   Double_t dSumWQuadraticFive3n1n2n1n1n = 0.; // sum of quadratic event weights <4>
11612   Double_t dSpreadFive3n1n2n1n1n = 0.; // weighted and biased estimator for sigma of <4>
11613   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11614   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11615   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
11616   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11617   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11618   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
11619   dSumWLinearFive3n1n2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11620   dSumWQuadraticFive3n1n2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11621   dSpreadFive3n1n2n1n1n = f5pCorrelations->GetBinError(42);
11622   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
11623      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
11624      pow(dSumWLinearFive3n1n2n1n1n,2.)>dSumWQuadraticFive3n1n2n1n1n)
11625   {
11626    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(5),2.)
11627                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
11628                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
11629                    + 4.*pow(f2pCorrelations->GetBinContent(1),2.)
11630                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
11631                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
11632                    + pow((pow(dSumWQuadraticFive3n1n2n1n1n,0.5)/dSumWLinearFive3n1n2n1n1n)
11633                    * dSpreadFive3n1n2n1n1n*pow(pow(dSumWLinearFive3n1n2n1n1n,2.)/(pow(dSumWLinearFive3n1n2n1n1n,2.)-dSumWQuadraticFive3n1n2n1n1n),0.5),2.)
11634                    + 4.*2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(1)
11635                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11636                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,10)) 
11637                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(5))
11638                    / (dSumWLinearTwo1n1n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11639                    - 2.*2.*f3pCorrelations->GetBinContent(5)
11640                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11641                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,96))
11642                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(42))
11643                    / (dSumWLinearTwo1n1n*dSumWLinearFive3n1n2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11644                    - 2.*2.*f2pCorrelations->GetBinContent(1)
11645                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11646                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,96))
11647                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(42))
11648                    / (dSumWLinearThree3n2n1n*dSumWLinearFive3n1n2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11649    if(dError>0.)
11650    {
11651     f5pCumulants->SetBinError(42,pow(dError,0.5)); 
11652    }
11653   } // end of if(...)
11654  } // end of {
11655  f5pCumulants->SetBinContent(43,f5pCorrelations->GetBinContent(43)-2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(2)); 
11656  { 
11657   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
11658   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
11659   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
11660   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
11661   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
11662   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
11663   Double_t dSumWLinearFive3n2n2n2n1n = 0.; // sum of linear event weights for <4>
11664   Double_t dSumWQuadraticFive3n2n2n2n1n = 0.; // sum of quadratic event weights <4>
11665   Double_t dSpreadFive3n2n2n2n1n = 0.; // weighted and biased estimator for sigma of <4>
11666   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11667   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11668   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
11669   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11670   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11671   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
11672   dSumWLinearFive3n2n2n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11673   dSumWQuadraticFive3n2n2n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11674   dSpreadFive3n2n2n2n1n = f5pCorrelations->GetBinError(43);
11675   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
11676      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
11677      pow(dSumWLinearFive3n2n2n2n1n,2.)>dSumWQuadraticFive3n2n2n2n1n)
11678   {
11679    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(5),2.)
11680                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
11681                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
11682                    + 4.*pow(f2pCorrelations->GetBinContent(2),2.)
11683                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
11684                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
11685                    + pow((pow(dSumWQuadraticFive3n2n2n2n1n,0.5)/dSumWLinearFive3n2n2n2n1n)
11686                    * dSpreadFive3n2n2n2n1n*pow(pow(dSumWLinearFive3n2n2n2n1n,2.)/(pow(dSumWLinearFive3n2n2n2n1n,2.)-dSumWQuadraticFive3n2n2n2n1n),0.5),2.)
11687                    + 4.*2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(2)
11688                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11689                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,10)) 
11690                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(5))
11691                    / (dSumWLinearTwo2n2n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11692                    - 2.*2.*f3pCorrelations->GetBinContent(5)
11693                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11694                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,97))
11695                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(43))
11696                    / (dSumWLinearTwo2n2n*dSumWLinearFive3n2n2n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11697                    - 2.*2.*f2pCorrelations->GetBinContent(2)
11698                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11699                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,97))
11700                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(43))
11701                    / (dSumWLinearThree3n2n1n*dSumWLinearFive3n2n2n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11702    if(dError>0.)
11703    {
11704     f5pCumulants->SetBinError(43,pow(dError,0.5)); 
11705    }
11706   } // end of if(...)
11707  } // end of {
11708  f5pCumulants->SetBinContent(44,f5pCorrelations->GetBinContent(44)-2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(3)); 
11709  { 
11710   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
11711   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
11712   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
11713   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
11714   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
11715   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
11716   Double_t dSumWLinearFive3n3n3n2n1n = 0.; // sum of linear event weights for <4>
11717   Double_t dSumWQuadraticFive3n3n3n2n1n = 0.; // sum of quadratic event weights <4>
11718   Double_t dSpreadFive3n3n3n2n1n = 0.; // weighted and biased estimator for sigma of <4>
11719   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11720   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11721   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
11722   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11723   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11724   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
11725   dSumWLinearFive3n3n3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11726   dSumWQuadraticFive3n3n3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11727   dSpreadFive3n3n3n2n1n = f5pCorrelations->GetBinError(44);
11728   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
11729      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
11730      pow(dSumWLinearFive3n3n3n2n1n,2.)>dSumWQuadraticFive3n3n3n2n1n)
11731   {
11732    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(5),2.)
11733                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
11734                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
11735                    + 4.*pow(f2pCorrelations->GetBinContent(3),2.)
11736                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
11737                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
11738                    + pow((pow(dSumWQuadraticFive3n3n3n2n1n,0.5)/dSumWLinearFive3n3n3n2n1n)
11739                    * dSpreadFive3n3n3n2n1n*pow(pow(dSumWLinearFive3n3n3n2n1n,2.)/(pow(dSumWLinearFive3n3n3n2n1n,2.)-dSumWQuadraticFive3n3n3n2n1n),0.5),2.)
11740                    + 4.*2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(3)
11741                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11742                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,10)) 
11743                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(5))
11744                    / (dSumWLinearTwo3n3n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11745                    - 2.*2.*f3pCorrelations->GetBinContent(5)
11746                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11747                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,98))
11748                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(44))
11749                    / (dSumWLinearTwo3n3n*dSumWLinearFive3n3n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11750                    - 2.*2.*f2pCorrelations->GetBinContent(3)
11751                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11752                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,98))
11753                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(44))
11754                    / (dSumWLinearThree3n2n1n*dSumWLinearFive3n3n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11755    if(dError>0.)
11756    {
11757     f5pCumulants->SetBinError(44,pow(dError,0.5)); 
11758    }
11759   } // end of if(...)
11760  } // end of {
11761  f5pCumulants->SetBinContent(45,f5pCorrelations->GetBinContent(45)-2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(1)); 
11762  { 
11763   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
11764   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
11765   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
11766   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
11767   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
11768   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
11769   Double_t dSumWLinearFive4n1n3n1n1n = 0.; // sum of linear event weights for <4>
11770   Double_t dSumWQuadraticFive4n1n3n1n1n = 0.; // sum of quadratic event weights <4>
11771   Double_t dSpreadFive4n1n3n1n1n = 0.; // weighted and biased estimator for sigma of <4>
11772   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11773   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11774   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
11775   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11776   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11777   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
11778   dSumWLinearFive4n1n3n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11779   dSumWQuadraticFive4n1n3n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11780   dSpreadFive4n1n3n1n1n = f5pCorrelations->GetBinError(45);
11781   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
11782      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
11783      pow(dSumWLinearFive4n1n3n1n1n,2.)>dSumWQuadraticFive4n1n3n1n1n)
11784   {
11785    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(6),2.)
11786                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
11787                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
11788                    + 4.*pow(f2pCorrelations->GetBinContent(1),2.)
11789                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
11790                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
11791                    + pow((pow(dSumWQuadraticFive4n1n3n1n1n,0.5)/dSumWLinearFive4n1n3n1n1n)
11792                    * dSpreadFive4n1n3n1n1n*pow(pow(dSumWLinearFive4n1n3n1n1n,2.)/(pow(dSumWLinearFive4n1n3n1n1n,2.)-dSumWQuadraticFive4n1n3n1n1n),0.5),2.)
11793                    + 4.*2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(1)
11794                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11795                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,11)) 
11796                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(6))
11797                    / (dSumWLinearTwo1n1n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11798                    - 2.*2.*f3pCorrelations->GetBinContent(6)
11799                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11800                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,99))
11801                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(45))
11802                    / (dSumWLinearTwo1n1n*dSumWLinearFive4n1n3n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11803                    - 2.*2.*f2pCorrelations->GetBinContent(1)
11804                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11805                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,99))
11806                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(45))
11807                    / (dSumWLinearThree4n3n1n*dSumWLinearFive4n1n3n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11808    if(dError>0.)
11809    {
11810     f5pCumulants->SetBinError(45,pow(dError,0.5)); 
11811    }
11812   } // end of if(...)
11813  } // end of {
11814  f5pCumulants->SetBinContent(46,f5pCorrelations->GetBinContent(46));
11815  {
11816   Double_t dSumWLinear = 0.; // sum of linear event weights
11817   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11818   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11819   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11820   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11821   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11822   dSpread = f5pCorrelations->GetBinError(46);
11823   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11824   {
11825    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11826    f5pCumulants->SetBinError(46,dError); 
11827   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11828  } 
11829  f5pCumulants->SetBinContent(47,f5pCorrelations->GetBinContent(47)-2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(3)); 
11830  { 
11831   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
11832   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
11833   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
11834   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
11835   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
11836   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
11837   Double_t dSumWLinearFive4n3n3n3n1n = 0.; // sum of linear event weights for <4>
11838   Double_t dSumWQuadraticFive4n3n3n3n1n = 0.; // sum of quadratic event weights <4>
11839   Double_t dSpreadFive4n3n3n3n1n = 0.; // weighted and biased estimator for sigma of <4>
11840   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11841   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11842   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
11843   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11844   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11845   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
11846   dSumWLinearFive4n3n3n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11847   dSumWQuadraticFive4n3n3n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11848   dSpreadFive4n3n3n3n1n = f5pCorrelations->GetBinError(47);
11849   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
11850      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
11851      pow(dSumWLinearFive4n3n3n3n1n,2.)>dSumWQuadraticFive4n3n3n3n1n)
11852   {
11853    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(6),2.)
11854                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
11855                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
11856                    + 4.*pow(f2pCorrelations->GetBinContent(3),2.)
11857                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
11858                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
11859                    + pow((pow(dSumWQuadraticFive4n3n3n3n1n,0.5)/dSumWLinearFive4n3n3n3n1n)
11860                    * dSpreadFive4n3n3n3n1n*pow(pow(dSumWLinearFive4n3n3n3n1n,2.)/(pow(dSumWLinearFive4n3n3n3n1n,2.)-dSumWQuadraticFive4n3n3n3n1n),0.5),2.)
11861                    + 4.*2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(3)
11862                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11863                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,11)) 
11864                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(6))
11865                    / (dSumWLinearTwo3n3n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11866                    - 2.*2.*f3pCorrelations->GetBinContent(6)
11867                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11868                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,101))
11869                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(47))
11870                    / (dSumWLinearTwo3n3n*dSumWLinearFive4n3n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11871                    - 2.*2.*f2pCorrelations->GetBinContent(3)
11872                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11873                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,101))
11874                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(47))
11875                    / (dSumWLinearThree4n3n1n*dSumWLinearFive4n3n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11876    if(dError>0.)
11877    {
11878     f5pCumulants->SetBinError(47,pow(dError,0.5)); 
11879    }
11880   } // end of if(...)
11881  } // end of {
11882  f5pCumulants->SetBinContent(48,f5pCorrelations->GetBinContent(48));
11883  {
11884   Double_t dSumWLinear = 0.; // sum of linear event weights
11885   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11886   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11887   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11888   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11889   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11890   dSpread = f5pCorrelations->GetBinError(48);
11891   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11892   {
11893    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11894    f5pCumulants->SetBinError(48,dError); 
11895   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11896  } 
11897  f5pCumulants->SetBinContent(49,f5pCorrelations->GetBinContent(49)-2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(4));  
11898  { 
11899   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
11900   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
11901   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
11902   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
11903   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
11904   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
11905   Double_t dSumWLinearFive4n3n3n3n1n = 0.; // sum of linear event weights for <4>
11906   Double_t dSumWQuadraticFive4n3n3n3n1n = 0.; // sum of quadratic event weights <4>
11907   Double_t dSpreadFive4n3n3n3n1n = 0.; // weighted and biased estimator for sigma of <4>
11908   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11909   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11910   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
11911   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11912   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11913   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
11914   dSumWLinearFive4n3n3n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11915   dSumWQuadraticFive4n3n3n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11916   dSpreadFive4n3n3n3n1n = f5pCorrelations->GetBinError(49);
11917   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
11918      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
11919      pow(dSumWLinearFive4n3n3n3n1n,2.)>dSumWQuadraticFive4n3n3n3n1n)
11920   {
11921    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(6),2.)
11922                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
11923                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
11924                    + 4.*pow(f2pCorrelations->GetBinContent(4),2.)
11925                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
11926                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
11927                    + pow((pow(dSumWQuadraticFive4n3n3n3n1n,0.5)/dSumWLinearFive4n3n3n3n1n)
11928                    * dSpreadFive4n3n3n3n1n*pow(pow(dSumWLinearFive4n3n3n3n1n,2.)/(pow(dSumWLinearFive4n3n3n3n1n,2.)-dSumWQuadraticFive4n3n3n3n1n),0.5),2.)
11929                    + 4.*2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(4)
11930                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11931                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,11)) 
11932                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(6))
11933                    / (dSumWLinearTwo4n4n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11934                    - 2.*2.*f3pCorrelations->GetBinContent(6)
11935                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11936                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,103))
11937                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(49))
11938                    / (dSumWLinearTwo4n4n*dSumWLinearFive4n3n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11939                    - 2.*2.*f2pCorrelations->GetBinContent(4)
11940                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11941                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,103))
11942                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(49))
11943                    / (dSumWLinearThree4n3n1n*dSumWLinearFive4n3n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11944    if(dError>0.)
11945    {
11946     f5pCumulants->SetBinError(49,pow(dError,0.5)); 
11947    }
11948   } // end of if(...)
11949  } // end of {
11950  f5pCumulants->SetBinContent(50,f5pCorrelations->GetBinContent(50));
11951  {
11952   Double_t dSumWLinear = 0.; // sum of linear event weights
11953   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11954   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11955   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11956   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11957   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11958   dSpread = f5pCorrelations->GetBinError(50);
11959   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11960   {
11961    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11962    f5pCumulants->SetBinError(50,dError); 
11963   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11964  } 
11965  f5pCumulants->SetBinContent(51,f5pCorrelations->GetBinContent(51));
11966  {
11967   Double_t dSumWLinear = 0.; // sum of linear event weights
11968   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11969   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11970   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11971   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11972   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11973   dSpread = f5pCorrelations->GetBinError(51);
11974   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11975   {
11976    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11977    f5pCumulants->SetBinError(51,dError); 
11978   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11979  } 
11980  f5pCumulants->SetBinContent(52,f5pCorrelations->GetBinContent(52)-2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(2));  
11981  { 
11982   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
11983   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
11984   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
11985   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
11986   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
11987   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
11988   Double_t dSumWLinearFive5n2n3n2n2n = 0.; // sum of linear event weights for <4>
11989   Double_t dSumWQuadraticFive5n2n3n2n2n = 0.; // sum of quadratic event weights <4>
11990   Double_t dSpreadFive5n2n3n2n2n = 0.; // weighted and biased estimator for sigma of <4>
11991   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11992   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11993   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
11994   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11995   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11996   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
11997   dSumWLinearFive5n2n3n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11998   dSumWQuadraticFive5n2n3n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11999   dSpreadFive5n2n3n2n2n = f5pCorrelations->GetBinError(52);
12000   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
12001      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
12002      pow(dSumWLinearFive5n2n3n2n2n,2.)>dSumWQuadraticFive5n2n3n2n2n)
12003   {
12004    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(7),2.)
12005                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
12006                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
12007                    + 4.*pow(f2pCorrelations->GetBinContent(2),2.)
12008                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
12009                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
12010                    + pow((pow(dSumWQuadraticFive5n2n3n2n2n,0.5)/dSumWLinearFive5n2n3n2n2n)
12011                    * dSpreadFive5n2n3n2n2n*pow(pow(dSumWLinearFive5n2n3n2n2n,2.)/(pow(dSumWLinearFive5n2n3n2n2n,2.)-dSumWQuadraticFive5n2n3n2n2n),0.5),2.)
12012                    + 4.*2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(2)
12013                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12014                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,12)) 
12015                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(7))
12016                    / (dSumWLinearTwo2n2n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12017                    - 2.*2.*f3pCorrelations->GetBinContent(7)
12018                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12019                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,106))
12020                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(52))
12021                    / (dSumWLinearTwo2n2n*dSumWLinearFive5n2n3n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12022                    - 2.*2.*f2pCorrelations->GetBinContent(2)
12023                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12024                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,106))
12025                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(52))
12026                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n2n3n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12027    if(dError>0.)
12028    {
12029     f5pCumulants->SetBinError(52,pow(dError,0.5)); 
12030    }
12031   } // end of if(...)
12032  } // end of {
12033  f5pCumulants->SetBinContent(53,f5pCorrelations->GetBinContent(53)-2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(3));  
12034  { 
12035   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
12036   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
12037   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
12038   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
12039   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
12040   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
12041   Double_t dSumWLinearFive5n3n3n3n2n = 0.; // sum of linear event weights for <4>
12042   Double_t dSumWQuadraticFive5n3n3n3n2n = 0.; // sum of quadratic event weights <4>
12043   Double_t dSpreadFive5n3n3n3n2n = 0.; // weighted and biased estimator for sigma of <4>
12044   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12045   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12046   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
12047   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12048   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12049   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
12050   dSumWLinearFive5n3n3n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12051   dSumWQuadraticFive5n3n3n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12052   dSpreadFive5n3n3n3n2n = f5pCorrelations->GetBinError(53);
12053   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
12054      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
12055      pow(dSumWLinearFive5n3n3n3n2n,2.)>dSumWQuadraticFive5n3n3n3n2n)
12056   {
12057    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(7),2.)
12058                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
12059                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
12060                    + 4.*pow(f2pCorrelations->GetBinContent(3),2.)
12061                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
12062                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
12063                    + pow((pow(dSumWQuadraticFive5n3n3n3n2n,0.5)/dSumWLinearFive5n3n3n3n2n)
12064                    * dSpreadFive5n3n3n3n2n*pow(pow(dSumWLinearFive5n3n3n3n2n,2.)/(pow(dSumWLinearFive5n3n3n3n2n,2.)-dSumWQuadraticFive5n3n3n3n2n),0.5),2.)
12065                    + 4.*2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(3)
12066                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12067                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,12)) 
12068                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(7))
12069                    / (dSumWLinearTwo3n3n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12070                    - 2.*2.*f3pCorrelations->GetBinContent(7)
12071                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12072                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,107))
12073                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(53))
12074                    / (dSumWLinearTwo3n3n*dSumWLinearFive5n3n3n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12075                    - 2.*2.*f2pCorrelations->GetBinContent(3)
12076                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12077                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,107))
12078                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(53))
12079                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n3n3n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12080    if(dError>0.)
12081    {
12082     f5pCumulants->SetBinError(53,pow(dError,0.5)); 
12083    }
12084   } // end of if(...)
12085  } // end of {
12086  f5pCumulants->SetBinContent(54,f5pCorrelations->GetBinContent(54)-2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(1)); 
12087  { 
12088   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
12089   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
12090   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
12091   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
12092   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
12093   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
12094   Double_t dSumWLinearFive5n1n4n1n1n = 0.; // sum of linear event weights for <4>
12095   Double_t dSumWQuadraticFive5n1n4n1n1n = 0.; // sum of quadratic event weights <4>
12096   Double_t dSpreadFive5n1n4n1n1n = 0.; // weighted and biased estimator for sigma of <4>
12097   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12098   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12099   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
12100   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12101   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12102   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
12103   dSumWLinearFive5n1n4n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12104   dSumWQuadraticFive5n1n4n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12105   dSpreadFive5n1n4n1n1n = f5pCorrelations->GetBinError(54);
12106   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
12107      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
12108      pow(dSumWLinearFive5n1n4n1n1n,2.)>dSumWQuadraticFive5n1n4n1n1n)
12109   {
12110    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(8),2.)
12111                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
12112                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
12113                    + 4.*pow(f2pCorrelations->GetBinContent(1),2.)
12114                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
12115                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
12116                    + pow((pow(dSumWQuadraticFive5n1n4n1n1n,0.5)/dSumWLinearFive5n1n4n1n1n)
12117                    * dSpreadFive5n1n4n1n1n*pow(pow(dSumWLinearFive5n1n4n1n1n,2.)/(pow(dSumWLinearFive5n1n4n1n1n,2.)-dSumWQuadraticFive5n1n4n1n1n),0.5),2.)
12118                    + 4.*2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(1)
12119                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12120                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,13)) 
12121                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(8))
12122                    / (dSumWLinearTwo1n1n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12123                    - 2.*2.*f3pCorrelations->GetBinContent(8)
12124                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12125                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,108))
12126                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(54))
12127                    / (dSumWLinearTwo1n1n*dSumWLinearFive5n1n4n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12128                    - 2.*2.*f2pCorrelations->GetBinContent(1)
12129                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12130                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,108))
12131                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(54))
12132                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n1n4n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12133    if(dError>0.)
12134    {
12135     f5pCumulants->SetBinError(54,pow(dError,0.5)); 
12136    }
12137   } // end of if(...)
12138  } // end of {
12139
12140  f5pCumulants->SetBinContent(55,f5pCorrelations->GetBinContent(55));
12141  {
12142   Double_t dSumWLinear = 0.; // sum of linear event weights
12143   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12144   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12145   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12146   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12147   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12148   dSpread = f5pCorrelations->GetBinError(55);
12149   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12150   {
12151    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12152    f5pCumulants->SetBinError(55,dError); 
12153   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12154  } 
12155  f5pCumulants->SetBinContent(56,f5pCorrelations->GetBinContent(56)-2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(4));
12156  { 
12157   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
12158   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
12159   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
12160   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
12161   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
12162   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
12163   Double_t dSumWLinearFive5n4n4n4n1n = 0.; // sum of linear event weights for <4>
12164   Double_t dSumWQuadraticFive5n4n4n4n1n = 0.; // sum of quadratic event weights <4>
12165   Double_t dSpreadFive5n4n4n4n1n = 0.; // weighted and biased estimator for sigma of <4>
12166   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12167   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12168   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
12169   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12170   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12171   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
12172   dSumWLinearFive5n4n4n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12173   dSumWQuadraticFive5n4n4n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12174   dSpreadFive5n4n4n4n1n = f5pCorrelations->GetBinError(56);
12175   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
12176      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
12177      pow(dSumWLinearFive5n4n4n4n1n,2.)>dSumWQuadraticFive5n4n4n4n1n)
12178   {
12179    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(8),2.)
12180                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
12181                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
12182                    + 4.*pow(f2pCorrelations->GetBinContent(4),2.)
12183                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
12184                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
12185                    + pow((pow(dSumWQuadraticFive5n4n4n4n1n,0.5)/dSumWLinearFive5n4n4n4n1n)
12186                    * dSpreadFive5n4n4n4n1n*pow(pow(dSumWLinearFive5n4n4n4n1n,2.)/(pow(dSumWLinearFive5n4n4n4n1n,2.)-dSumWQuadraticFive5n4n4n4n1n),0.5),2.)
12187                    + 4.*2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(4)
12188                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12189                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,13)) 
12190                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(8))
12191                    / (dSumWLinearTwo4n4n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12192                    - 2.*2.*f3pCorrelations->GetBinContent(8)
12193                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12194                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,110))
12195                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(56))
12196                    / (dSumWLinearTwo4n4n*dSumWLinearFive5n4n4n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12197                    - 2.*2.*f2pCorrelations->GetBinContent(4)
12198                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12199                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,110))
12200                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(56))
12201                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n4n4n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12202    if(dError>0.)
12203    {
12204     f5pCumulants->SetBinError(56,pow(dError,0.5)); 
12205    }
12206   } // end of if(...)
12207  } // end of {
12208  f5pCumulants->SetBinContent(57,f5pCorrelations->GetBinContent(57));
12209  {
12210   Double_t dSumWLinear = 0.; // sum of linear event weights
12211   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12212   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12213   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12214   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12215   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12216   dSpread = f5pCorrelations->GetBinError(57);
12217   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12218   {
12219    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12220    f5pCumulants->SetBinError(57,dError); 
12221   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12222  } 
12223  f5pCumulants->SetBinContent(58,f5pCorrelations->GetBinContent(58));
12224  {
12225   Double_t dSumWLinear = 0.; // sum of linear event weights
12226   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12227   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12228   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12229   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12230   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12231   dSpread = f5pCorrelations->GetBinError(58);
12232   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12233   {
12234    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12235    f5pCumulants->SetBinError(58,dError); 
12236   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12237  } 
12238  f5pCumulants->SetBinContent(59,f5pCorrelations->GetBinContent(59)-2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(5));  
12239  { 
12240   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
12241   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
12242   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
12243   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
12244   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
12245   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
12246   Double_t dSumWLinearFive5n5n5n3n2n = 0.; // sum of linear event weights for <4>
12247   Double_t dSumWQuadraticFive5n5n5n3n2n = 0.; // sum of quadratic event weights <4>
12248   Double_t dSpreadFive5n5n5n3n2n = 0.; // weighted and biased estimator for sigma of <4>
12249   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12250   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12251   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
12252   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12253   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12254   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
12255   dSumWLinearFive5n5n5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12256   dSumWQuadraticFive5n5n5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12257   dSpreadFive5n5n5n3n2n = f5pCorrelations->GetBinError(59);
12258   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
12259      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
12260      pow(dSumWLinearFive5n5n5n3n2n,2.)>dSumWQuadraticFive5n5n5n3n2n)
12261   {
12262    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(7),2.)
12263                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
12264                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
12265                    + 4.*pow(f2pCorrelations->GetBinContent(5),2.)
12266                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
12267                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
12268                    + pow((pow(dSumWQuadraticFive5n5n5n3n2n,0.5)/dSumWLinearFive5n5n5n3n2n)
12269                    * dSpreadFive5n5n5n3n2n*pow(pow(dSumWLinearFive5n5n5n3n2n,2.)/(pow(dSumWLinearFive5n5n5n3n2n,2.)-dSumWQuadraticFive5n5n5n3n2n),0.5),2.)
12270                    + 4.*2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(5)
12271                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12272                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,12)) 
12273                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(7))
12274                    / (dSumWLinearTwo5n5n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12275                    - 2.*2.*f3pCorrelations->GetBinContent(7)
12276                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12277                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,113))
12278                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(59))
12279                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n5n5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12280                    - 2.*2.*f2pCorrelations->GetBinContent(5)
12281                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12282                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,113))
12283                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(59))
12284                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n5n5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12285    if(dError>0.)
12286    {
12287     f5pCumulants->SetBinError(59,pow(dError,0.5)); 
12288    }
12289   } // end of if(...)
12290  } // end of {
12291  f5pCumulants->SetBinContent(60,f5pCorrelations->GetBinContent(60)-2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(5));  
12292  { 
12293   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
12294   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
12295   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
12296   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
12297   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
12298   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
12299   Double_t dSumWLinearFive5n5n5n4n1n = 0.; // sum of linear event weights for <4>
12300   Double_t dSumWQuadraticFive5n5n5n4n1n = 0.; // sum of quadratic event weights <4>
12301   Double_t dSpreadFive5n5n5n4n1n = 0.; // weighted and biased estimator for sigma of <4>
12302   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12303   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12304   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
12305   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12306   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12307   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
12308   dSumWLinearFive5n5n5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12309   dSumWQuadraticFive5n5n5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12310   dSpreadFive5n5n5n4n1n = f5pCorrelations->GetBinError(60);
12311   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
12312      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
12313      pow(dSumWLinearFive5n5n5n4n1n,2.)>dSumWQuadraticFive5n5n5n4n1n)
12314   {
12315    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(8),2.)
12316                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
12317                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
12318                    + 4.*pow(f2pCorrelations->GetBinContent(5),2.)
12319                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
12320                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
12321                    + pow((pow(dSumWQuadraticFive5n5n5n4n1n,0.5)/dSumWLinearFive5n5n5n4n1n)
12322                    * dSpreadFive5n5n5n4n1n*pow(pow(dSumWLinearFive5n5n5n4n1n,2.)/(pow(dSumWLinearFive5n5n5n4n1n,2.)-dSumWQuadraticFive5n5n5n4n1n),0.5),2.)
12323                    + 4.*2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(5)
12324                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12325                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,13)) 
12326                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(8))
12327                    / (dSumWLinearTwo5n5n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12328                    - 2.*2.*f3pCorrelations->GetBinContent(8)
12329                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12330                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,114))
12331                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(60))
12332                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n5n5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12333                    - 2.*2.*f2pCorrelations->GetBinContent(5)
12334                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12335                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,114))
12336                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(60))
12337                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n5n5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12338    if(dError>0.)
12339    {
12340     f5pCumulants->SetBinError(60,pow(dError,0.5)); 
12341    }
12342   } // end of if(...)
12343  } // end of {
12344  f5pCumulants->SetBinContent(61,f5pCorrelations->GetBinContent(61));
12345  {
12346   Double_t dSumWLinear = 0.; // sum of linear event weights
12347   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12348   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12349   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12350   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12351   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12352   dSpread = f5pCorrelations->GetBinError(61);
12353   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12354   {
12355    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12356    f5pCumulants->SetBinError(61,dError); 
12357   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12358  } 
12359  f5pCumulants->SetBinContent(62,f5pCorrelations->GetBinContent(62));
12360  {
12361   Double_t dSumWLinear = 0.; // sum of linear event weights
12362   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12363   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12364   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12365   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12366   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12367   dSpread = f5pCorrelations->GetBinError(62);
12368   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12369   {
12370    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12371    f5pCumulants->SetBinError(62,dError); 
12372   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12373  } 
12374  f5pCumulants->SetBinContent(63,f5pCorrelations->GetBinContent(63));
12375  {
12376   Double_t dSumWLinear = 0.; // sum of linear event weights
12377   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12378   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12379   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12380   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12381   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12382   dSpread = f5pCorrelations->GetBinError(63);
12383   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12384   {
12385    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12386    f5pCumulants->SetBinError(63,dError); 
12387   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12388  } 
12389  f5pCumulants->SetBinContent(64,f5pCorrelations->GetBinContent(64)-2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(1));  
12390  { 
12391   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
12392   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
12393   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
12394   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
12395   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
12396   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
12397   Double_t dSumWLinearFive6n1n5n1n1n = 0.; // sum of linear event weights for <4>
12398   Double_t dSumWQuadraticFive6n1n5n1n1n = 0.; // sum of quadratic event weights <4>
12399   Double_t dSpreadFive6n1n5n1n1n = 0.; // weighted and biased estimator for sigma of <4>
12400   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12401   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12402   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
12403   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12404   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12405   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
12406   dSumWLinearFive6n1n5n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12407   dSumWQuadraticFive6n1n5n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12408   dSpreadFive6n1n5n1n1n = f5pCorrelations->GetBinError(64);
12409   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
12410      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
12411      pow(dSumWLinearFive6n1n5n1n1n,2.)>dSumWQuadraticFive6n1n5n1n1n)
12412   {
12413    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(10),2.)
12414                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
12415                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
12416                    + 4.*pow(f2pCorrelations->GetBinContent(1),2.)
12417                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
12418                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
12419                    + pow((pow(dSumWQuadraticFive6n1n5n1n1n,0.5)/dSumWLinearFive6n1n5n1n1n)
12420                    * dSpreadFive6n1n5n1n1n*pow(pow(dSumWLinearFive6n1n5n1n1n,2.)/(pow(dSumWLinearFive6n1n5n1n1n,2.)-dSumWQuadraticFive6n1n5n1n1n),0.5),2.)
12421                    + 4.*2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(1)
12422                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12423                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,15)) 
12424                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(10))
12425                    / (dSumWLinearTwo1n1n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12426                    - 2.*2.*f3pCorrelations->GetBinContent(10)
12427                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12428                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,118))
12429                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(64))
12430                    / (dSumWLinearTwo1n1n*dSumWLinearFive6n1n5n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12431                    - 2.*2.*f2pCorrelations->GetBinContent(1)
12432                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12433                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,118))
12434                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(64))
12435                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n1n5n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12436    if(dError>0.)
12437    {
12438     f5pCumulants->SetBinError(64,pow(dError,0.5)); 
12439    }
12440   } // end of if(...)
12441  } // end of {
12442  f5pCumulants->SetBinContent(65,f5pCorrelations->GetBinContent(65)-2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(2));  
12443  { 
12444   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
12445   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
12446   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
12447   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
12448   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
12449   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
12450   Double_t dSumWLinearFive6n2n4n2n2n = 0.; // sum of linear event weights for <4>
12451   Double_t dSumWQuadraticFive6n2n4n2n2n = 0.; // sum of quadratic event weights <4>
12452   Double_t dSpreadFive6n2n4n2n2n = 0.; // weighted and biased estimator for sigma of <4>
12453   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12454   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12455   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
12456   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12457   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12458   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
12459   dSumWLinearFive6n2n4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12460   dSumWQuadraticFive6n2n4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12461   dSpreadFive6n2n4n2n2n = f5pCorrelations->GetBinError(65);
12462   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
12463      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
12464      pow(dSumWLinearFive6n2n4n2n2n,2.)>dSumWQuadraticFive6n2n4n2n2n)
12465   {
12466    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(9),2.)
12467                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
12468                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
12469                    + 4.*pow(f2pCorrelations->GetBinContent(2),2.)
12470                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
12471                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
12472                    + pow((pow(dSumWQuadraticFive6n2n4n2n2n,0.5)/dSumWLinearFive6n2n4n2n2n)
12473                    * dSpreadFive6n2n4n2n2n*pow(pow(dSumWLinearFive6n2n4n2n2n,2.)/(pow(dSumWLinearFive6n2n4n2n2n,2.)-dSumWQuadraticFive6n2n4n2n2n),0.5),2.)
12474                    + 4.*2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(2)
12475                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12476                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,14)) 
12477                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(9))
12478                    / (dSumWLinearTwo2n2n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12479                    - 2.*2.*f3pCorrelations->GetBinContent(9)
12480                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12481                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,119))
12482                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(65))
12483                    / (dSumWLinearTwo2n2n*dSumWLinearFive6n2n4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12484                    - 2.*2.*f2pCorrelations->GetBinContent(2)
12485                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12486                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,119))
12487                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(65))
12488                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n2n4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12489    if(dError>0.)
12490    {
12491     f5pCumulants->SetBinError(65,pow(dError,0.5)); 
12492    }
12493   } // end of if(...)
12494  } // end of {
12495  f5pCumulants->SetBinContent(66,f5pCorrelations->GetBinContent(66)-2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(4));
12496  { 
12497   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
12498   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
12499   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
12500   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
12501   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
12502   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
12503   Double_t dSumWLinearFive6n4n4n4n2n = 0.; // sum of linear event weights for <4>
12504   Double_t dSumWQuadraticFive6n4n4n4n2n = 0.; // sum of quadratic event weights <4>
12505   Double_t dSpreadFive6n4n4n4n2n = 0.; // weighted and biased estimator for sigma of <4>
12506   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12507   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12508   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
12509   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12510   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12511   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
12512   dSumWLinearFive6n4n4n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12513   dSumWQuadraticFive6n4n4n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12514   dSpreadFive6n4n4n4n2n = f5pCorrelations->GetBinError(66);
12515   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
12516      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
12517      pow(dSumWLinearFive6n4n4n4n2n,2.)>dSumWQuadraticFive6n4n4n4n2n)
12518   {
12519    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(9),2.)
12520                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
12521                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
12522                    + 4.*pow(f2pCorrelations->GetBinContent(4),2.)
12523                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
12524                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
12525                    + pow((pow(dSumWQuadraticFive6n4n4n4n2n,0.5)/dSumWLinearFive6n4n4n4n2n)
12526                    * dSpreadFive6n4n4n4n2n*pow(pow(dSumWLinearFive6n4n4n4n2n,2.)/(pow(dSumWLinearFive6n4n4n4n2n,2.)-dSumWQuadraticFive6n4n4n4n2n),0.5),2.)
12527                    + 4.*2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(4)
12528                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12529                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,14)) 
12530                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(9))
12531                    / (dSumWLinearTwo4n4n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12532                    - 2.*2.*f3pCorrelations->GetBinContent(9)
12533                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12534                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,120))
12535                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(66))
12536                    / (dSumWLinearTwo4n4n*dSumWLinearFive6n4n4n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12537                    - 2.*2.*f2pCorrelations->GetBinContent(4)
12538                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12539                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,120))
12540                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(66))
12541                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n4n4n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12542    if(dError>0.)
12543    {
12544     f5pCumulants->SetBinError(66,pow(dError,0.5)); 
12545    }
12546   } // end of if(...)
12547  } // end of {  
12548  f5pCumulants->SetBinContent(67,f5pCorrelations->GetBinContent(67));
12549  {
12550   Double_t dSumWLinear = 0.; // sum of linear event weights
12551   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12552   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12553   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12554   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12555   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12556   dSpread = f5pCorrelations->GetBinError(67);
12557   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12558   {
12559    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12560    f5pCumulants->SetBinError(67,dError); 
12561   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12562  }  
12563  f5pCumulants->SetBinContent(68,f5pCorrelations->GetBinContent(68)-2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(5));  
12564  { 
12565   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
12566   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
12567   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
12568   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
12569   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
12570   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
12571   Double_t dSumWLinearFive6n5n5n5n1n = 0.; // sum of linear event weights for <4>
12572   Double_t dSumWQuadraticFive6n5n5n5n1n = 0.; // sum of quadratic event weights <4>
12573   Double_t dSpreadFive6n5n5n5n1n = 0.; // weighted and biased estimator for sigma of <4>
12574   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12575   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12576   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
12577   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12578   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12579   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
12580   dSumWLinearFive6n5n5n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12581   dSumWQuadraticFive6n5n5n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12582   dSpreadFive6n5n5n5n1n = f5pCorrelations->GetBinError(68);
12583   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
12584      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
12585      pow(dSumWLinearFive6n5n5n5n1n,2.)>dSumWQuadraticFive6n5n5n5n1n)
12586   {
12587    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(10),2.)
12588                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
12589                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
12590                    + 4.*pow(f2pCorrelations->GetBinContent(5),2.)
12591                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
12592                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
12593                    + pow((pow(dSumWQuadraticFive6n5n5n5n1n,0.5)/dSumWLinearFive6n5n5n5n1n)
12594                    * dSpreadFive6n5n5n5n1n*pow(pow(dSumWLinearFive6n5n5n5n1n,2.)/(pow(dSumWLinearFive6n5n5n5n1n,2.)-dSumWQuadraticFive6n5n5n5n1n),0.5),2.)
12595                    + 4.*2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(5)
12596                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12597                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,15)) 
12598                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(10))
12599                    / (dSumWLinearTwo5n5n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12600                    - 2.*2.*f3pCorrelations->GetBinContent(10)
12601                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12602                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,122))
12603                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(68))
12604                    / (dSumWLinearTwo5n5n*dSumWLinearFive6n5n5n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12605                    - 2.*2.*f2pCorrelations->GetBinContent(5)
12606                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12607                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,122))
12608                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(68))
12609                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n5n5n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12610    if(dError>0.)
12611    {
12612     f5pCumulants->SetBinError(68,pow(dError,0.5)); 
12613    }
12614   } // end of if(...)
12615  } // end of {
12616  f5pCumulants->SetBinContent(69,f5pCorrelations->GetBinContent(69));
12617  {
12618   Double_t dSumWLinear = 0.; // sum of linear event weights
12619   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12620   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12621   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12622   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12623   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12624   dSpread = f5pCorrelations->GetBinError(69);
12625   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12626   {
12627    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12628    f5pCumulants->SetBinError(69,dError); 
12629   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12630  } 
12631  f5pCumulants->SetBinContent(70,f5pCorrelations->GetBinContent(70)-2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(6));  
12632  { 
12633   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
12634   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
12635   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
12636   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
12637   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
12638   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
12639   Double_t dSumWLinearFive6n6n6n4n2n = 0.; // sum of linear event weights for <4>
12640   Double_t dSumWQuadraticFive6n6n6n4n2n = 0.; // sum of quadratic event weights <4>
12641   Double_t dSpreadFive6n6n6n4n2n = 0.; // weighted and biased estimator for sigma of <4>
12642   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12643   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12644   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
12645   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12646   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12647   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
12648   dSumWLinearFive6n6n6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12649   dSumWQuadraticFive6n6n6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12650   dSpreadFive6n6n6n4n2n = f5pCorrelations->GetBinError(70);
12651   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
12652      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
12653      pow(dSumWLinearFive6n6n6n4n2n,2.)>dSumWQuadraticFive6n6n6n4n2n)
12654   {
12655    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(9),2.)
12656                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
12657                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
12658                    + 4.*pow(f2pCorrelations->GetBinContent(6),2.)
12659                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
12660                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
12661                    + pow((pow(dSumWQuadraticFive6n6n6n4n2n,0.5)/dSumWLinearFive6n6n6n4n2n)
12662                    * dSpreadFive6n6n6n4n2n*pow(pow(dSumWLinearFive6n6n6n4n2n,2.)/(pow(dSumWLinearFive6n6n6n4n2n,2.)-dSumWQuadraticFive6n6n6n4n2n),0.5),2.)
12663                    + 4.*2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(6)
12664                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12665                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,14)) 
12666                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(9))
12667                    / (dSumWLinearTwo6n6n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12668                    - 2.*2.*f3pCorrelations->GetBinContent(9)
12669                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12670                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,124))
12671                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(70))
12672                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n6n6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12673                    - 2.*2.*f2pCorrelations->GetBinContent(6)
12674                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12675                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,124))
12676                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(70))
12677                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n6n6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12678    if(dError>0.)
12679    {
12680     f5pCumulants->SetBinError(70,pow(dError,0.5)); 
12681    }
12682   } // end of if(...)
12683  } // end of {
12684
12685
12686
12687
12688
12689  f5pCumulants->SetBinContent(71,f5pCorrelations->GetBinContent(71)-2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(6));  
12690  { 
12691   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
12692   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
12693   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
12694   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
12695   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
12696   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
12697   Double_t dSumWLinearFive6n6n6n5n1n = 0.; // sum of linear event weights for <4>
12698   Double_t dSumWQuadraticFive6n6n6n5n1n = 0.; // sum of quadratic event weights <4>
12699   Double_t dSpreadFive6n6n6n5n1n = 0.; // weighted and biased estimator for sigma of <4>
12700   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12701   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12702   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
12703   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12704   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12705   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
12706   dSumWLinearFive6n6n6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12707   dSumWQuadraticFive6n6n6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12708   dSpreadFive6n6n6n5n1n = f5pCorrelations->GetBinError(71);
12709   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
12710      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
12711      pow(dSumWLinearFive6n6n6n5n1n,2.)>dSumWQuadraticFive6n6n6n5n1n)
12712   {
12713    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(10),2.)
12714                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
12715                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
12716                    + 4.*pow(f2pCorrelations->GetBinContent(6),2.)
12717                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
12718                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
12719                    + pow((pow(dSumWQuadraticFive6n6n6n5n1n,0.5)/dSumWLinearFive6n6n6n5n1n)
12720                    * dSpreadFive6n6n6n5n1n*pow(pow(dSumWLinearFive6n6n6n5n1n,2.)/(pow(dSumWLinearFive6n6n6n5n1n,2.)-dSumWQuadraticFive6n6n6n5n1n),0.5),2.)
12721                    + 4.*2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(6)
12722                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12723                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,15)) 
12724                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(10))
12725                    / (dSumWLinearTwo6n6n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12726                    - 2.*2.*f3pCorrelations->GetBinContent(10)
12727                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12728                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,125))
12729                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(71))
12730                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n6n6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12731                    - 2.*2.*f2pCorrelations->GetBinContent(6)
12732                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12733                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,125))
12734                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(71))
12735                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n6n6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12736    if(dError>0.)
12737    {
12738     f5pCumulants->SetBinError(71,pow(dError,0.5)); 
12739    }
12740   } // end of if(...)
12741  } // end of {
12742  // d3) "Four distinct harmonics":
12743  for(Int_t b=73;b<=83;b++)
12744  {
12745   f5pCumulants->SetBinContent(b,f5pCorrelations->GetBinContent(b));
12746   Double_t dSumWLinear = 0.; // sum of linear event weights
12747   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12748   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12749   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12750   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12751   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12752   dSpread = f5pCorrelations->GetBinError(b);
12753   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12754   {
12755    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12756    f5pCumulants->SetBinError(b,dError); 
12757   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12758  } // end of for(Int_t b=73;b<=83;b++)
12759  // d4) "Five distinct harmonics":
12760  for(Int_t b=85;b<=87;b++)
12761  {
12762   f5pCumulants->SetBinContent(b,f5pCorrelations->GetBinContent(b));
12763   Double_t dSumWLinear = 0.; // sum of linear event weights
12764   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12765   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12766   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12767   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12768   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12769   dSpread = f5pCorrelations->GetBinError(b);
12770   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12771   {
12772    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12773    f5pCumulants->SetBinError(b,dError); 
12774   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12775  } // end of for(Int_t b=85;b<=87;b++)
12776
12777 } // end of void AliFlowAnalysisWithQCumulants::CalculateCumulantsMixedHarmonics()
12778
12779 //===================================================================================================================
12780
12781 void AliFlowAnalysisWithQCumulants::StorePhiDistributionForOneEvent(AliFlowEventSimple *anEvent)
12782 {
12783  // Store phi distribution for one event to illustrate flow.
12784  
12785  if(fPhiDistributionForOneEvent->GetEntries()>0){return;} // store only phi distribution for one event
12786  
12787  Double_t vMin = fPhiDistributionForOneEventSettings[0]; 
12788  Double_t vMax = fPhiDistributionForOneEventSettings[1]; 
12789  Double_t refMultMin = fPhiDistributionForOneEventSettings[2]; 
12790  Double_t refMultMax = fPhiDistributionForOneEventSettings[3]; 
12791  
12792  Double_t vEBE = 0.;
12793  Double_t cumulant4thEBE = fIntFlowCorrelationsEBE->GetBinContent(2)-2.*pow(fIntFlowCorrelationsEBE->GetBinContent(1),2.);
12794  if(cumulant4thEBE<0.)
12795  {
12796   vEBE = pow(-1.*cumulant4thEBE,0.25);
12797   if((vEBE>vMin && vEBE<vMax) && (fReferenceMultiplicityEBE>refMultMin && fReferenceMultiplicityEBE<refMultMax))
12798   {
12799    fPhiDistributionForOneEvent->SetTitle(Form("v_{%i} = %f",fHarmonic,vEBE));
12800    for(Int_t p=0;p<anEvent->NumberOfTracks();p++)
12801    {
12802     if(anEvent->GetTrack(p)->InRPSelection())
12803     {
12804      fPhiDistributionForOneEvent->Fill(anEvent->GetTrack(p)->Phi());
12805     }
12806    } // end of for(Int_t p=0;p<anEvent->NumberOfTracks();p++)
12807   } else
12808     {
12809      fPhiDistributionForOneEvent->SetTitle(Form("v_{%i} = %f, out of specified boundaries",fHarmonic,vEBE));  
12810     } 
12811    
12812  } // end of if(cumulant4thEBE<0.)
12813  
12814 } // end of void AliFlowAnalysisWithQCumulants::StorePhiDistributionForOneEvent(AliFlowEventSimple *anEvent)
12815
12816 //===================================================================================================================
12817
12818 void AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrelations()
12819 {
12820  // Calculate averages of products of correlations for integrated flow.
12821
12822  // Multiplicity bin of an event (relevant for all histos vs M): 
12823  Double_t dMultiplicityBin = 0.;
12824  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
12825  {
12826   dMultiplicityBin = fNumberOfRPsEBE+0.5;
12827  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
12828    {
12829     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
12830    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
12831      {
12832       dMultiplicityBin = fNumberOfPOIsEBE+0.5;
12833      }
12834
12835  Int_t counter = 0;
12836  
12837  for(Int_t ci1=1;ci1<4;ci1++)
12838  {
12839   for(Int_t ci2=ci1+1;ci2<=4;ci2++)
12840   {
12841    fIntFlowProductOfCorrelationsPro->Fill(0.5+counter,
12842                                           fIntFlowCorrelationsEBE->GetBinContent(ci1)*
12843                                           fIntFlowCorrelationsEBE->GetBinContent(ci2),
12844                                           fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci1)*
12845                                           fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci2));
12846    // products versus multiplicity:  // [0=<<2><4>>,1=<<2><6>>,2=<<2><8>>,3=<<4><6>>,4=<<4><8>>,5=<<6><8>>]
12847    if(fCalculateCumulantsVsM)
12848    {
12849     fIntFlowProductOfCorrelationsVsMPro[counter]->Fill(dMultiplicityBin, // to be improved: dMult => sum of weights ?
12850                                                        fIntFlowCorrelationsEBE->GetBinContent(ci1)*
12851                                                        fIntFlowCorrelationsEBE->GetBinContent(ci2),
12852                                                        fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci1)*
12853                                                        fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci2));
12854    } // end of if(fCalculateCumulantsVsM)
12855    counter++;                                                                                                                        
12856   }
12857  }
12858  
12859 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrelations()
12860
12861
12862 //=======================================================================================================================
12863
12864
12865 void AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrectionTermsForNUA()
12866 {
12867  // Calculate averages of products of correction terms for NUA.
12868  
12869  // a) Binning of fIntFlowProductOfCorrectionTermsForNUAPro is organized as follows:
12870  //     1st bin: <<2><cos(phi)>> 
12871  //     2nd bin: <<2><sin(phi)>>
12872  //     3rd bin: <<cos(phi)><sin(phi)>>
12873  //     4th bin: <<2><cos(phi1+phi2)>> 
12874  //     5th bin: <<2><sin(phi1+phi2)>>
12875  //     6th bin: <<2><cos(phi1-phi2-phi3)>> 
12876  //     7th bin: <<2><sin(phi1-phi2-phi3)>>
12877  //     8th bin: <<4><cos(phi1)>>
12878  //     9th bin: <<4><sin(phi1)>>
12879  //    10th bin: <<4><cos(phi1+phi2)>>
12880  //    11th bin: <<4><sin(phi1+phi2)>>
12881  //    12th bin: <<4><cos(phi1-phi2-phi3)>>
12882  //    13th bin: <<4><sin(phi1-phi2-phi3)>>
12883  //    14th bin: <<cos(phi1)><cos(phi1+phi2)>>
12884  //    15th bin: <<cos(phi1)><sin(phi1+phi2)>> 
12885  //    16th bin: <<cos(phi1)><cos(phi1-phi2-phi3)>>
12886  //    17th bin: <<cos(phi1)><sin(phi1-phi2-phi3)>> 
12887  //    18th bin: <<sin(phi1)><cos(phi1+phi2)>>
12888  //    19th bin: <<sin(phi1)><sin(phi1+phi2)>> 
12889  //    20th bin: <<sin(phi1)><cos(phi1-phi2-phi3)>>
12890  //    21st bin: <<sin(phi1)><sin(phi1-phi2-phi3)>>
12891  //    22nd bin: <<cos(phi1+phi2)><sin(phi1+phi2)>>
12892  //    23rd bin: <<cos(phi1+phi2)><cos(phi1-phi2-phi3)>>
12893  //    24th bin: <<cos(phi1+phi2)><sin(phi1-phi2-phi3)>>
12894  //    25th bin: <<sin(phi1+phi2)><cos(phi1-phi2-phi3)>>
12895  //    26th bin: <<sin(phi1+phi2)><sin(phi1-phi2-phi3)>>
12896  //    27th bin: <<cos(phi1-phi2-phi3)><sin(phi1-phi2-phi3)>>
12897  
12898  // <<2><cos(phi)>>:
12899  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(0.5,
12900                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1),
12901                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
12902                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1));
12903  // <<2><sin(phi)>>:
12904  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(1.5,
12905                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1),
12906                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
12907                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
12908  // <<cos(phi)><sin(phi)>>:
12909  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(2.5,
12910                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1),
12911                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
12912                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
12913  // <<2><cos(phi1+phi2)>>:
12914  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(3.5,
12915                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2),
12916                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
12917                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
12918  // <<2><sin(phi1+phi2)>>:
12919  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(4.5,
12920                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
12921                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
12922                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
12923  // <<2><cos(phi1-phi2-phi3)>>:
12924  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(5.5,
12925                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
12926                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
12927                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
12928  // <<2><sin(phi1-phi2-phi3)>>:
12929  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(6.5,
12930                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
12931                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
12932                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
12933  // <<4><cos(phi1)>>:
12934  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(7.5,
12935                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1),
12936                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
12937                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1));
12938  // <<4><sin(phi1)>>:
12939  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(8.5,
12940                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1),
12941                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
12942                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
12943  // <<4><cos(phi1+phi2)>>:
12944  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(9.5,
12945                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2),
12946                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
12947                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
12948  // <<4><sin(phi1+phi2)>>:
12949  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(10.5,
12950                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
12951                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
12952                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));
12953  // <<4><cos(phi1-phi2-phi3)>>:
12954  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(11.5,
12955                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
12956                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
12957                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
12958  // <<4><sin(phi1-phi2-phi3)>>:
12959  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(12.5,
12960                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
12961                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
12962                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));   
12963  // <<cos(phi1)><cos(phi1+phi2)>>:
12964  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(13.5,
12965                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2),
12966                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
12967                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
12968  // <<cos(phi1)><sin(phi1+phi2)>>: 
12969  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(14.5,
12970                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
12971                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
12972                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
12973  // <<cos(phi1)><cos(phi1-phi2-phi3)>>:
12974  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(15.5,
12975                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
12976                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
12977                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
12978  // <<cos(phi1)><sin(phi1-phi2-phi3)>>: 
12979  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(16.5,
12980                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
12981                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
12982                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));  
12983  // <<sin(phi1)><cos(phi1+phi2)>>:
12984  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(17.5,
12985                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2),
12986                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)
12987                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2));  
12988  // <<sin(phi1)><sin(phi1+phi2)>>: 
12989  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(18.5,
12990                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
12991                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)
12992                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));  
12993  // <<sin(phi1)><cos(phi1-phi2-phi3)>>:
12994  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(19.5,
12995                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
12996                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)
12997                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
12998  // <<sin(phi1)><sin(phi1-phi2-phi3)>>:
12999  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(20.5,
13000                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
13001                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)
13002                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
13003  // <<cos(phi1+phi2)><sin(phi1+phi2)>>:
13004  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(21.5,
13005                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
13006                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)
13007                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
13008  // <<cos(phi1+phi2)><cos(phi1-phi2-phi3)>>:
13009  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(22.5,
13010                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
13011                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)
13012                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));   
13013  // <<cos(phi1+phi2)><sin(phi1-phi2-phi3)>>:
13014  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(23.5,
13015                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
13016                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)
13017                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));    
13018  // <<sin(phi1+phi2)><cos(phi1-phi2-phi3)>>:
13019  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(24.5,
13020                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
13021                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)
13022                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));    
13023  // <<sin(phi1+phi2)><sin(phi1-phi2-phi3)>>:
13024  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(25.5,
13025                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
13026                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)
13027                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));    
13028  // <<cos(phi1-phi2-phi3)><sin(phi1-phi2-phi3)>>:
13029  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(26.5,
13030                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
13031                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)
13032                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));    
13033
13034 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrectionTermsForNUA()
13035
13036 //=======================================================================================================================
13037
13038 void AliFlowAnalysisWithQCumulants::CalculateCovariancesIntFlow()
13039 {
13040  // a) Calculate unbiased estimators Cov(<2>,<4>), Cov(<2>,<6>), Cov(<2>,<8>), Cov(<4>,<6>), Cov(<4>,<8>) and Cov(<6>,<8>)
13041  //    for covariances V_(<2>,<4>), V_(<2>,<6>), V_(<2>,<8>), V_(<4>,<6>), V_(<4>,<8>) and V_(<6>,<8>).
13042  // b) Store in histogram fIntFlowCovariances for instance the following: 
13043  //
13044  //             Cov(<2>,<4>) * (sum_{i=1}^{N} w_{<2>}_i w_{<4>}_i )/[(sum_{i=1}^{N} w_{<2>}_i) * (sum_{j=1}^{N} w_{<4>}_j)]
13045  // 
13046  //    where N is the number of events, w_{<2>} is event weight for <2> and w_{<4>} is event weight for <4>.
13047  // c) Binning of fIntFlowCovariances is organized as follows:
13048  // 
13049  //     1st bin: Cov(<2>,<4>) * (sum_{i=1}^{N} w_{<2>}_i w_{<4>}_i )/[(sum_{i=1}^{N} w_{<2>}_i) * (sum_{j=1}^{N} w_{<4>}_j)] 
13050  //     2nd bin: Cov(<2>,<6>) * (sum_{i=1}^{N} w_{<2>}_i w_{<6>}_i )/[(sum_{i=1}^{N} w_{<2>}_i) * (sum_{j=1}^{N} w_{<6>}_j)]
13051  //     3rd bin: Cov(<2>,<8>) * (sum_{i=1}^{N} w_{<2>}_i w_{<8>}_i )/[(sum_{i=1}^{N} w_{<2>}_i) * (sum_{j=1}^{N} w_{<8>}_j)]
13052  //     4th bin: Cov(<4>,<6>) * (sum_{i=1}^{N} w_{<4>}_i w_{<6>}_i )/[(sum_{i=1}^{N} w_{<4>}_i) * (sum_{j=1}^{N} w_{<6>}_j)]
13053  //     5th bin: Cov(<4>,<8>) * (sum_{i=1}^{N} w_{<4>}_i w_{<8>}_i )/[(sum_{i=1}^{N} w_{<4>}_i) * (sum_{j=1}^{N} w_{<8>}_j)]
13054  //     6th bin: Cov(<6>,<8>) * (sum_{i=1}^{N} w_{<6>}_i w_{<8>}_i )/[(sum_{i=1}^{N} w_{<6>}_i) * (sum_{j=1}^{N} w_{<8>}_j)]
13055  //
13056     
13057  // Average 2-, 4-, 6- and 8-particle correlations for all events:
13058  Double_t correlation[4] = {0.};
13059  for(Int_t ci=0;ci<4;ci++)
13060  {
13061   correlation[ci] = fIntFlowCorrelationsPro->GetBinContent(ci+1);
13062  } 
13063  // Average products of 2-, 4-, 6- and 8-particle correlations: 
13064  Double_t productOfCorrelations[4][4] = {{0.}};
13065  Int_t productOfCorrelationsLabel = 1;
13066  // Denominators in the expressions for the unbiased estimator for covariance:
13067  Double_t denominator[4][4] = {{0.}};
13068  Int_t sumOfProductOfEventWeightsLabel1 = 1;
13069  // Weight dependent prefactor which multiply unbiased estimators for covariances:
13070  Double_t wPrefactor[4][4] = {{0.}}; 
13071  Int_t sumOfProductOfEventWeightsLabel2 = 1;
13072  for(Int_t c1=0;c1<4;c1++)
13073  {
13074   for(Int_t c2=c1+1;c2<4;c2++)
13075   {
13076    productOfCorrelations[c1][c2] = fIntFlowProductOfCorrelationsPro->GetBinContent(productOfCorrelationsLabel);
13077    if(TMath::Abs(fIntFlowSumOfEventWeights[0]->GetBinContent(c1+1)) > 1.e-44 && TMath::Abs(fIntFlowSumOfEventWeights[0]->GetBinContent(c2+1)) > 1.e-44)
13078    {
13079     denominator[c1][c2] = 1.-(fIntFlowSumOfProductOfEventWeights->GetBinContent(sumOfProductOfEventWeightsLabel1))
13080                         / (fIntFlowSumOfEventWeights[0]->GetBinContent(c1+1) 
13081                         * fIntFlowSumOfEventWeights[0]->GetBinContent(c2+1));                              
13082     wPrefactor[c1][c2] = fIntFlowSumOfProductOfEventWeights->GetBinContent(sumOfProductOfEventWeightsLabel2)
13083                        / (fIntFlowSumOfEventWeights[0]->GetBinContent(c1+1)
13084                        * fIntFlowSumOfEventWeights[0]->GetBinContent(c2+1));                                                       
13085    }
13086    productOfCorrelationsLabel++; // to be improved - do I need here all 3 counters?
13087    sumOfProductOfEventWeightsLabel1++;
13088    sumOfProductOfEventWeightsLabel2++;  
13089   } // end of for(Int_t c2=c1+1;c2<4;c2++)
13090  } // end of for(Int_t c1=0;c1<4;c1++)
13091  
13092  Int_t covarianceLabel = 1;
13093  for(Int_t c1=0;c1<4;c1++)
13094  {
13095   for(Int_t c2=c1+1;c2<4;c2++)
13096   {
13097    if(TMath::Abs(denominator[c1][c2]) > 1.e-44)
13098    {
13099     // Covariances:
13100     Double_t cov = (productOfCorrelations[c1][c2]-correlation[c1]*correlation[c2])/denominator[c1][c2]; 
13101     // Covariances multiplied with weight dependent prefactor:
13102     Double_t wCov = cov * wPrefactor[c1][c2];
13103     fIntFlowCovariances->SetBinContent(covarianceLabel,wCov);
13104    }
13105    covarianceLabel++;
13106   } // end of for(Int_t c2=c1+1;c2<4;c2++) 
13107  } // end of for(Int_t c1=0;c1<4;c1++)
13108  
13109  // Versus multiplicity: 
13110  if(!fCalculateCumulantsVsM){return;}
13111  Int_t nBins = fIntFlowCorrelationsVsMPro[0]->GetNbinsX(); // to be improved (hardwired 0) 
13112  for(Int_t b=1;b<=nBins;b++)
13113  {
13114   // Average 2-, 4-, 6- and 8-particle correlations for all events:
13115   Double_t correlationVsM[4] = {0.};
13116   for(Int_t ci=0;ci<4;ci++)
13117   {
13118    correlationVsM[ci] = fIntFlowCorrelationsVsMPro[ci]->GetBinContent(b);
13119   } // end of for(Int_t ci=0;ci<4;ci++)
13120   // Average products of 2-, 4-, 6- and 8-particle correlations: 
13121   Double_t productOfCorrelationsVsM[4][4] = {{0.}};
13122   Int_t productOfCorrelationsLabelVsM = 1;
13123   // Denominators in the expressions for the unbiased estimator for covariance:
13124   Double_t denominatorVsM[4][4] = {{0.}};
13125   Int_t sumOfProductOfEventWeightsLabel1VsM = 1;
13126   // Weight dependent prefactor which multiply unbiased estimators for covariances:
13127   Double_t wPrefactorVsM[4][4] = {{0.}}; 
13128   Int_t sumOfProductOfEventWeightsLabel2VsM = 1;
13129   for(Int_t c1=0;c1<4;c1++)
13130   {
13131    for(Int_t c2=c1+1;c2<4;c2++)
13132    {
13133     productOfCorrelationsVsM[c1][c2] = fIntFlowProductOfCorrelationsVsMPro[productOfCorrelationsLabelVsM-1]->GetBinContent(b);
13134     if(TMath::Abs(fIntFlowSumOfEventWeightsVsM[c1][0]->GetBinContent(b)) > 1.e-44 && TMath::Abs(fIntFlowSumOfEventWeightsVsM[c2][0]->GetBinContent(b)) > 1.e-44)
13135     {
13136      denominatorVsM[c1][c2] = 1.-(fIntFlowSumOfProductOfEventWeightsVsM[sumOfProductOfEventWeightsLabel1VsM-1]->GetBinContent(b))
13137                             / (fIntFlowSumOfEventWeightsVsM[c1][0]->GetBinContent(b) 
13138                             * fIntFlowSumOfEventWeightsVsM[c2][0]->GetBinContent(b));                              
13139      wPrefactorVsM[c1][c2] = fIntFlowSumOfProductOfEventWeightsVsM[sumOfProductOfEventWeightsLabel2VsM-1]->GetBinContent(b)
13140                            / (fIntFlowSumOfEventWeightsVsM[c1][0]->GetBinContent(b)
13141                            * fIntFlowSumOfEventWeightsVsM[c2][0]->GetBinContent(b));                                                       
13142     }
13143     productOfCorrelationsLabelVsM++;
13144     sumOfProductOfEventWeightsLabel1VsM++;
13145     sumOfProductOfEventWeightsLabel2VsM++;  
13146    } // end of for(Int_t c1=0;c1<4;c1++) 
13147   } // end of for(Int_t c2=c1+1;c2<4;c2++)
13148  
13149   Int_t covarianceLabelVsM = 1;
13150   for(Int_t c1=0;c1<4;c1++)
13151   {
13152    for(Int_t c2=c1+1;c2<4;c2++)
13153    {
13154     if(TMath::Abs(denominatorVsM[c1][c2]) > 1.e-44)
13155     {
13156      // Covariances:
13157      Double_t covVsM = (productOfCorrelationsVsM[c1][c2]-correlationVsM[c1]*correlationVsM[c2])/denominatorVsM[c1][c2]; 
13158      // Covariances multiplied with weight dependent prefactor:
13159      Double_t wCovVsM = covVsM * wPrefactorVsM[c1][c2];
13160      fIntFlowCovariancesVsM[covarianceLabelVsM-1]->SetBinContent(b,wCovVsM);
13161     }
13162     covarianceLabelVsM++;
13163    } // end of for(Int_t c2=c1+1;c2<4;c2++)
13164   } // end of for(Int_t c1=0;c1<4;c1++)
13165  } // end of for(Int_t b=1;b<=nBins;b++)
13166   
13167 } // end of AliFlowAnalysisWithQCumulants::CalculateCovariancesIntFlow()
13168
13169 //=======================================================================================================================
13170
13171 void AliFlowAnalysisWithQCumulants::CalculateCovariancesNUAIntFlow()
13172 {
13173  // a) Calculate unbiased estimators Cov(*,*) for true covariances V_(*,*) for NUA terms.
13174  // b) Store in histogram fIntFlowCovariancesNUA for instance the following: 
13175  //
13176  //             Cov(<2>,<cos(phi)>) * (sum_{i=1}^{N} w_{<2>}_i w_{<cos(phi)>}_i )/[(sum_{i=1}^{N} w_{<2>}_i) * (sum_{j=1}^{N} w_{<cos(phi)>}_j)]
13177  // 
13178  //    where N is the number of events, w_{<2>} is event weight for <2> and w_{<cos(phi)>} is event weight for <cos(phi)>.
13179  // c) Binning of fIntFlowCovariancesNUA is organized as follows:
13180  // 
13181  //     1st bin: Cov(<2>,<cos(phi)>) * (sum_{i=1}^{N} w_{<2>}_i w_{<cos(phi)>}_i )/[(sum_{i=1}^{N} w_{<2>}_i) * (sum_{j=1}^{N} w_{<cos(phi)>}_j)] 
13182  //     2nd bin: Cov(<2>,<sin(phi)>) * (sum_{i=1}^{N} w_{<2>}_i w_{<sin(phi)>}_i )/[(sum_{i=1}^{N} w_{<2>}_i) * (sum_{j=1}^{N} w_{<sin(phi)>}_j)]
13183  //     3rd bin: Cov(<cos(phi)>,<sin(phi)>) * (sum_{i=1}^{N} w_{<cos(phi)>}_i w_{<sin(phi)>}_i )/[(sum_{i=1}^{N} w_{<cos(phi)>}_i) * (sum_{j=1}^{N} w_{<sin(phi)>}_j)]
13184  // ...
13185       
13186  // Cov(<2>,<cos(phi)>):
13187  Double_t product1 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(1); // <<2><cos(phi)>> 
13188  Double_t term1st1 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13189  Double_t term2nd1 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi)>>
13190  Double_t sumOfW1st1 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13191  Double_t sumOfW2nd1 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi)>}
13192  Double_t sumOfWW1 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(1); // W_{<2>} * W_{<cos(phi)>}
13193  // numerator in the expression for the the unbiased estimator for covariance:
13194  Double_t numerator1 = product1 - term1st1*term2nd1; 
13195  // denominator in the expression for the the unbiased estimator for covariance:
13196  Double_t denominator1 = 0.;
13197  if(TMath::Abs(sumOfW1st1*sumOfW2nd1)>0.)
13198  {
13199   denominator1 = 1.-sumOfWW1/(sumOfW1st1*sumOfW2nd1);
13200   if(TMath::Abs(denominator1)>0.)
13201   {
13202    // covariance:
13203    Double_t covariance1 = numerator1/denominator1;
13204    // weight dependent prefactor for covariance:
13205    Double_t wPrefactor1 = sumOfWW1/(sumOfW1st1*sumOfW2nd1);
13206    // finally, store "weighted" covariance:
13207    fIntFlowCovariancesNUA->SetBinContent(1,wPrefactor1*covariance1);
13208   } // end of if(TMath::Abs(denominator)>0.)
13209  } // end of if(TMath::Abs(sumOfW1st1*sumOfW2nd1)>0.)
13210  
13211  // Cov(<2>,<sin(phi)>):
13212  Double_t product2 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(2); // <<2><sin(phi)>> 
13213  Double_t term1st2 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13214  Double_t term2nd2 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi)>>
13215  Double_t sumOfW1st2 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13216  Double_t sumOfW2nd2 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi)>}
13217  Double_t sumOfWW2 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(2); // W_{<2>} * W_{<sin(phi)>}
13218  // numerator in the expression for the the unbiased estimator for covariance:
13219  Double_t numerator2 = product2 - term1st2*term2nd2;
13220  // denominator in the expression for the the unbiased estimator for covariance:
13221  Double_t denominator2 = 0.;
13222  if(TMath::Abs(sumOfW1st2*sumOfW2nd2)>0.)
13223  {  
13224   denominator2 = 1.-sumOfWW2/(sumOfW1st2*sumOfW2nd2);
13225   if(TMath::Abs(denominator2)>0.)
13226   {
13227    // covariance:
13228    Double_t covariance2 = numerator2/denominator2;
13229    // weight dependent prefactor for covariance:
13230    Double_t wPrefactor2 = sumOfWW2/(sumOfW1st2*sumOfW2nd2);
13231    // finally, store "weighted" covariance:
13232    fIntFlowCovariancesNUA->SetBinContent(2,wPrefactor2*covariance2);
13233   } // end of if(TMath::Abs(denominator2)>0.)
13234  } // end of if(TMath::Abs(sumOfW1st2*sumOfW2nd2)>0.)
13235  
13236  // Cov(<cos(phi)>,<sin(phi)>):
13237  Double_t product3 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(3); // <<cos(phi)><sin(phi)>> 
13238  Double_t term1st3 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi)>>
13239  Double_t term2nd3 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi)>>
13240  Double_t sumOfW1st3 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi)>}
13241  Double_t sumOfW2nd3 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi)>}
13242  Double_t sumOfWW3 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(3); // W_{<cos(phi)>} * W_{<sin(phi)>}
13243  // numerator in the expression for the the unbiased estimator for covariance:
13244  Double_t numerator3 = product3 - term1st3*term2nd3; 
13245  // denominator in the expression for the the unbiased estimator for covariance:
13246  Double_t denominator3 = 0;
13247  if(TMath::Abs(sumOfW1st3*sumOfW2nd3)>0.)
13248  { 
13249   denominator3 = 1.-sumOfWW3/(sumOfW1st3*sumOfW2nd3);
13250   if(TMath::Abs(denominator3)>0.)
13251   {
13252    // covariance:
13253    Double_t covariance3 = numerator3/denominator3;
13254    // weight dependent prefactor for covariance:
13255    Double_t wPrefactor3 = sumOfWW3/(sumOfW1st3*sumOfW2nd3);
13256    // finally, store "weighted" covariance:
13257    fIntFlowCovariancesNUA->SetBinContent(3,wPrefactor3*covariance3);
13258   } // end of if(TMath::Abs(denominator3)>0.)
13259  } // end of if(TMath::Abs(sumOfW1st3*sumOfW2nd3)>0.)
13260  
13261  // Cov(<2>,<cos(phi1+phi2)>):
13262  Double_t product4 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(4); // <<2><cos(phi1+phi2)>> 
13263  Double_t term1st4 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13264  Double_t term2nd4 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13265  Double_t sumOfW1st4 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13266  Double_t sumOfW2nd4 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13267  Double_t sumOfWW4 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(4); // W_{<2>} * W_{<cos(phi1+phi2)>}
13268  // numerator in the expression for the the unbiased estimator for covariance:
13269  Double_t numerator4 = product4 - term1st4*term2nd4; 
13270  // denominator in the expression for the the unbiased estimator for covariance:
13271  Double_t denominator4 = 0.;
13272  if(TMath::Abs(sumOfW1st4*sumOfW2nd4)>0.)
13273  { 
13274   denominator4 = 1.-sumOfWW4/(sumOfW1st4*sumOfW2nd4);
13275   if(TMath::Abs(denominator4)>0.)
13276   {  
13277    // covariance:
13278    Double_t covariance4 = numerator4/denominator4;
13279    // weight dependent prefactor for covariance:
13280    Double_t wPrefactor4 = sumOfWW4/(sumOfW1st4*sumOfW2nd4);
13281    // finally, store "weighted" covariance:
13282    fIntFlowCovariancesNUA->SetBinContent(4,wPrefactor4*covariance4);
13283   } // end of if(TMath::Abs(denominator4)>0.)
13284  } // end of if(TMath::Abs(sumOfW1st4*sumOfW2nd4)>0.)
13285  
13286  // Cov(<2>,<sin(phi1+phi2)>):
13287  Double_t product5 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(5); // <<2><sin(phi1+phi2)>> 
13288  Double_t term1st5 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13289  Double_t term2nd5 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13290  Double_t sumOfW1st5 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13291  Double_t sumOfW2nd5 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13292  Double_t sumOfWW5 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(5); // W_{<2>} * W_{<sin(phi1+phi2)>}
13293  // numerator in the expression for the the unbiased estimator for covariance:
13294  Double_t numerator5 = product5 - term1st5*term2nd5; 
13295  // denominator in the expression for the the unbiased estimator for covariance:
13296  Double_t denominator5 = 0.;
13297  if(TMath::Abs(sumOfW1st5*sumOfW2nd5)>0.)
13298  {  
13299   denominator5 = 1.-sumOfWW5/(sumOfW1st5*sumOfW2nd5);
13300   if(TMath::Abs(denominator5)>0.)
13301   {  
13302    // covariance:
13303    Double_t covariance5 = numerator5/denominator5;
13304    // weight dependent prefactor for covariance:
13305    Double_t wPrefactor5 = sumOfWW5/(sumOfW1st5*sumOfW2nd5);
13306    // finally, store "weighted" covariance:
13307    fIntFlowCovariancesNUA->SetBinContent(5,wPrefactor5*covariance5);
13308   } // end of if(TMath::Abs(denominator5)>0.)
13309  } // end of if(TMath::Abs(sumOfW1st5*sumOfW2nd5)>0.)
13310  
13311  // Cov(<2>,<cos(phi1-phi2-phi3)>):
13312  Double_t product6 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(6); // <<2><cos(phi1-phi2-phi3)>> 
13313  Double_t term1st6 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13314  Double_t term2nd6 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13315  Double_t sumOfW1st6 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13316  Double_t sumOfW2nd6 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13317  Double_t sumOfWW6 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(6); // W_{<2>} * W_{<cos(phi1-phi2-phi3)>}
13318  // numerator in the expression for the the unbiased estimator for covariance:
13319  Double_t numerator6 = product6 - term1st6*term2nd6; 
13320  // denominator in the expression for the the unbiased estimator for covariance:
13321  Double_t denominator6 = 0.;
13322  if(TMath::Abs(sumOfW1st6*sumOfW2nd6)>0.)
13323  {  
13324   denominator6 = 1.-sumOfWW6/(sumOfW1st6*sumOfW2nd6);
13325   if(TMath::Abs(denominator6)>0.)
13326   {  
13327    // covariance:
13328    Double_t covariance6 = numerator6/denominator6;
13329    // weight dependent prefactor for covariance:
13330    Double_t wPrefactor6 = sumOfWW6/(sumOfW1st6*sumOfW2nd6);
13331    // finally, store "weighted" covariance:
13332    fIntFlowCovariancesNUA->SetBinContent(6,wPrefactor6*covariance6);
13333   } // end of if(TMath::Abs(denominator6)>0.)
13334  } // end of if(TMath::Abs(sumOfW1st6*sumOfW2nd6)>0.)
13335  
13336  // Cov(<2>,<sin(phi1-phi2-phi3)>):
13337  Double_t product7 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(7); // <<2><sin(phi1-phi2-phi3)>> 
13338  Double_t term1st7 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13339  Double_t term2nd7 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13340  Double_t sumOfW1st7 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13341  Double_t sumOfW2nd7 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13342  Double_t sumOfWW7 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(7); // W_{<2>} * W_{<sin(phi1-phi2-phi3)>}
13343  // numerator in the expression for the the unbiased estimator for covariance:
13344  Double_t numerator7 = product7 - term1st7*term2nd7; 
13345  // denominator in the expression for the the unbiased estimator for covariance:
13346  Double_t denominator7 = 0.;
13347  if(TMath::Abs(sumOfW1st7*sumOfW2nd7)>0.)
13348  {  
13349   denominator7 = 1.-sumOfWW7/(sumOfW1st7*sumOfW2nd7);
13350   if(TMath::Abs(denominator7)>0.)
13351   {   
13352    // covariance:
13353    Double_t covariance7 = numerator7/denominator7;
13354    // weight dependent prefactor for covariance:
13355    Double_t wPrefactor7 = sumOfWW7/(sumOfW1st7*sumOfW2nd7);
13356    // finally, store "weighted" covariance:
13357    fIntFlowCovariancesNUA->SetBinContent(7,wPrefactor7*covariance7);
13358   } // end of if(TMath::Abs(denominator7)>0.)
13359  } // end of if(TMath::Abs(sumOfW1st7*sumOfW2nd7)>0.)
13360  
13361  // Cov(<4>,<cos(phi1>):
13362  Double_t product8 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(8); // <<4><cos(phi1)>> 
13363  Double_t term1st8 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13364  Double_t term2nd8 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13365  Double_t sumOfW1st8 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13366  Double_t sumOfW2nd8 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13367  Double_t sumOfWW8 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(8); // W_{<4>} * W_{<cos(phi1)>}
13368  // numerator in the expression for the the unbiased estimator for covariance:
13369  Double_t numerator8 = product8 - term1st8*term2nd8; 
13370  // denominator in the expression for the the unbiased estimator for covariance:
13371  Double_t denominator8 = 0.;
13372  if(TMath::Abs(sumOfW1st8*sumOfW2nd8)>0.)
13373  { 
13374   denominator8 = 1.-sumOfWW8/(sumOfW1st8*sumOfW2nd8);
13375   if(TMath::Abs(denominator8)>0.)
13376   {     
13377    // covariance:
13378    Double_t covariance8 = numerator8/denominator8;
13379    // weight dependent prefactor for covariance:
13380    Double_t wPrefactor8 = sumOfWW8/(sumOfW1st8*sumOfW2nd8);
13381    // finally, store "weighted" covariance:
13382    fIntFlowCovariancesNUA->SetBinContent(8,wPrefactor8*covariance8);
13383   } // end of if(TMath::Abs(denominator8)>0.)
13384  } // end of if(TMath::Abs(sumOfW1st8*sumOfW2nd8)>0.)
13385  
13386  // Cov(<4>,<sin(phi1)>):
13387  Double_t product9 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(9); // <<4><sin(phi1)>> 
13388  Double_t term1st9 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13389  Double_t term2nd9 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
13390  Double_t sumOfW1st9 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13391  Double_t sumOfW2nd9 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
13392  Double_t sumOfWW9 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(9); // W_{<4>} * W_{<sin(phi1)>}
13393  // numerator in the expression for the the unbiased estimator for covariance:
13394  Double_t numerator9 = product9 - term1st9*term2nd9; 
13395  // denominator in the expression for the the unbiased estimator for covariance:
13396  Double_t denominator9 = 0.;
13397  if(TMath::Abs(sumOfW1st9*sumOfW2nd9)>0.) 
13398  {
13399   denominator9 = 1.-sumOfWW9/(sumOfW1st9*sumOfW2nd9);
13400   if(TMath::Abs(denominator9)>0.)
13401   {     
13402    // covariance:
13403    Double_t covariance9 = numerator9/denominator9;
13404    // weight dependent prefactor for covariance:
13405    Double_t wPrefactor9 = sumOfWW9/(sumOfW1st9*sumOfW2nd9);
13406    // finally, store "weighted" covariance:
13407    fIntFlowCovariancesNUA->SetBinContent(9,wPrefactor9*covariance9); 
13408   }
13409  } // end of if(TMath::Abs(sumOfW1st9*sumOfW2nd9)>0.) 
13410  
13411  // Cov(<4>,<cos(phi1+phi2)>):
13412  Double_t product10 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(10); // <<4><cos(phi1+phi2)>> 
13413  Double_t term1st10 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13414  Double_t term2nd10 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13415  Double_t sumOfW1st10 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13416  Double_t sumOfW2nd10 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13417  Double_t sumOfWW10 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(10); // W_{<4>} * W_{<cos(phi1+phi2)>}
13418  // numerator in the expression for the the unbiased estimator for covariance:
13419  Double_t numerator10 = product10 - term1st10*term2nd10; 
13420  // denominator in the expression for the the unbiased estimator for covariance:
13421  Double_t denominator10 = 0.;
13422  if(TMath::Abs(sumOfW1st10*sumOfW2nd10)>0.) 
13423  { 
13424   denominator10 = 1.-sumOfWW10/(sumOfW1st10*sumOfW2nd10);
13425   if(TMath::Abs(denominator10)>0.) 
13426   { 
13427    // covariance:
13428    Double_t covariance10 = numerator10/denominator10;
13429    // weight dependent prefactor for covariance:
13430    Double_t wPrefactor10 = sumOfWW10/(sumOfW1st10*sumOfW2nd10);
13431    // finally, store "weighted" covariance:
13432    fIntFlowCovariancesNUA->SetBinContent(10,wPrefactor10*covariance10);
13433   } // end of if(TMath::Abs(denominator10)>0.) 
13434  } // end of if(TMath::Abs(sumOfW1st10*sumOfW2nd10)>0.) 
13435  
13436  // Cov(<4>,<sin(phi1+phi2)>):
13437  Double_t product11 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(11); // <<4><sin(phi1+phi2)>> 
13438  Double_t term1st11 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13439  Double_t term2nd11 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13440  Double_t sumOfW1st11 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13441  Double_t sumOfW2nd11 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13442  Double_t sumOfWW11 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(11); // W_{<4>} * W_{<sin(phi1+phi2)>}
13443  // numerator in the expression for the the unbiased estimator for covariance:
13444  Double_t numerator11 = product11 - term1st11*term2nd11; 
13445  // denominator in the expression for the the unbiased estimator for covariance:
13446  Double_t denominator11 = 0.;
13447  if(TMath::Abs(sumOfW1st11*sumOfW2nd11)>0.) 
13448  {  
13449   denominator11 = 1.-sumOfWW11/(sumOfW1st11*sumOfW2nd11);
13450   if(TMath::Abs(denominator11)>0.) 
13451   { 
13452    // covariance:
13453    Double_t covariance11 = numerator11/denominator11;
13454    // weight dependent prefactor for covariance:
13455    Double_t wPrefactor11 = sumOfWW11/(sumOfW1st11*sumOfW2nd11);
13456    // finally, store "weighted" covariance:
13457    fIntFlowCovariancesNUA->SetBinContent(11,wPrefactor11*covariance11);
13458   } // end of if(TMath::Abs(denominator11)>0.) 
13459  } // end of if(TMath::Abs(sumOfW1st11*sumOfW2nd11)>0.) 
13460
13461  // Cov(<4>,<cos(phi1-phi2-phi3)>):
13462  Double_t product12 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(12); // <<4><cos(phi1-phi2-phi3)>> 
13463  Double_t term1st12 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13464  Double_t term2nd12 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13465  Double_t sumOfW1st12 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13466  Double_t sumOfW2nd12 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13467  Double_t sumOfWW12 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(12); // W_{<4>} * W_{<cos(phi1-phi2-phi3)>}
13468  // numerator in the expression for the the unbiased estimator for covariance:
13469  Double_t numerator12 = product12 - term1st12*term2nd12; 
13470  // denominator in the expression for the the unbiased estimator for covariance:
13471  Double_t denominator12 = 0.;
13472  if(TMath::Abs(sumOfW1st12*sumOfW2nd12)>0.) 
13473  {   
13474   denominator12 = 1.-sumOfWW12/(sumOfW1st12*sumOfW2nd12);
13475   if(TMath::Abs(denominator12)>0.) 
13476   { 
13477    // covariance:
13478    Double_t covariance12 = numerator12/denominator12;
13479    // weight dependent prefactor for covariance:
13480    Double_t wPrefactor12 = sumOfWW12/(sumOfW1st12*sumOfW2nd12);
13481    // finally, store "weighted" covariance:
13482    fIntFlowCovariancesNUA->SetBinContent(12,wPrefactor12*covariance12);
13483   } // end of if(TMath::Abs(denominator12)>0.)
13484  } // end of if(TMath::Abs(sumOfW1st12*sumOfW2nd12)>0.)  
13485
13486  // Cov(<4>,<sin(phi1-phi2-phi3)>):
13487  Double_t product13 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(13); // <<4><sin(phi1-phi2-phi3)>> 
13488  Double_t term1st13 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13489  Double_t term2nd13 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13490  Double_t sumOfW1st13 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13491  Double_t sumOfW2nd13 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13492  Double_t sumOfWW13 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(13); // W_{<4>} * W_{<sin(phi1-phi2-phi3)>}
13493  // numerator in the expression for the the unbiased estimator for covariance:
13494  Double_t numerator13 = product13 - term1st13*term2nd13; 
13495  // denominator in the expression for the the unbiased estimator for covariance:
13496  Double_t denominator13 = 0.;
13497  if(TMath::Abs(sumOfW1st13*sumOfW2nd13)>0.) 
13498  {   
13499   denominator13 = 1.-sumOfWW13/(sumOfW1st13*sumOfW2nd13);
13500   if(TMath::Abs(denominator13)>0.) 
13501   { 
13502    // covariance:
13503    Double_t covariance13 = numerator13/denominator13;
13504    // weight dependent prefactor for covariance:
13505    Double_t wPrefactor13 = sumOfWW13/(sumOfW1st13*sumOfW2nd13);
13506    // finally, store "weighted" covariance:
13507    fIntFlowCovariancesNUA->SetBinContent(13,wPrefactor13*covariance13);
13508   } // end of if(TMath::Abs(denominator13)>0.) 
13509  } // end of if(TMath::Abs(sumOfW1st13*sumOfW2nd13)>0.) 
13510
13511  // Cov(<cos(phi1)>,<cos(phi1+phi2)>):
13512  Double_t product14 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(14); // <<cos(phi1)><cos(phi1+phi2)>> 
13513  Double_t term1st14 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13514  Double_t term2nd14 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13515  Double_t sumOfW1st14 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13516  Double_t sumOfW2nd14 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13517  Double_t sumOfWW14 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(14); // W_{<cos(phi1)>} * W_{<cos(phi1+phi2)>}
13518  // numerator in the expression for the the unbiased estimator for covariance:
13519  Double_t numerator14 = product14 - term1st14*term2nd14; 
13520  // denominator in the expression for the the unbiased estimator for covariance:
13521  Double_t denominator14 = 0.;
13522  if(TMath::Abs(sumOfW1st14*sumOfW2nd14)>0.) 
13523  {  
13524   denominator14 = 1.-sumOfWW14/(sumOfW1st14*sumOfW2nd14);
13525   if(TMath::Abs(denominator14)>0.) 
13526   { 
13527    // covariance:
13528    Double_t covariance14 = numerator14/denominator14;
13529    // weight dependent prefactor for covariance:
13530    Double_t wPrefactor14 = sumOfWW14/(sumOfW1st14*sumOfW2nd14);
13531    // finally, store "weighted" covariance:
13532    fIntFlowCovariancesNUA->SetBinContent(14,wPrefactor14*covariance14);
13533   } // end of if(TMath::Abs(denominator14)>0.) 
13534  } // end of if(TMath::Abs(sumOfW1st14*sumOfW2nd14)>0.) 
13535
13536  // Cov(<cos(phi1)>,<sin(phi1+phi2)>):
13537  Double_t product15 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(15); // <<cos(phi1)><sin(phi1+phi2)>> 
13538  Double_t term1st15 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13539  Double_t term2nd15 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13540  Double_t sumOfW1st15 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13541  Double_t sumOfW2nd15 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13542  Double_t sumOfWW15 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(15); // W_{<cos(phi1)>} * W_{<sin(phi1+phi2)>}
13543  // numerator in the expression for the the unbiased estimator for covariance:
13544  Double_t numerator15 = product15 - term1st15*term2nd15; 
13545  // denominator in the expression for the the unbiased estimator for covariance:
13546  Double_t denominator15 = 0.;
13547  if(TMath::Abs(sumOfW1st15*sumOfW2nd15)>0.) 
13548  {  
13549   denominator15 = 1.-sumOfWW15/(sumOfW1st15*sumOfW2nd15);
13550   if(TMath::Abs(denominator15)>0.) 
13551   { 
13552    // covariance:
13553    Double_t covariance15 = numerator15/denominator15;
13554    // weight dependent prefactor for covariance:
13555    Double_t wPrefactor15 = sumOfWW15/(sumOfW1st15*sumOfW2nd15);
13556    // finally, store "weighted" covariance:
13557    fIntFlowCovariancesNUA->SetBinContent(15,wPrefactor15*covariance15);
13558   } // end of if(TMath::Abs(denominator15)>0.)  
13559  } // end of if(TMath::Abs(sumOfW1st15*sumOfW2nd15)>0.)  
13560  
13561  // Cov(<cos(phi1)>,<cos(phi1-phi2-phi3)>):
13562  Double_t product16 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(16); // <<cos(phi1)><cos(phi1-phi2-phi3)>> 
13563  Double_t term1st16 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13564  Double_t term2nd16 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13565  Double_t sumOfW1st16 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13566  Double_t sumOfW2nd16 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13567  Double_t sumOfWW16 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(16); // W_{<cos(phi1)>} * W_{<cos(phi1-phi2-phi3)>}
13568  // numerator in the expression for the the unbiased estimator for covariance:
13569  Double_t numerator16 = product16 - term1st16*term2nd16; 
13570  // denominator in the expression for the the unbiased estimator for covariance:
13571  Double_t denominator16 = 0.;
13572  if(TMath::Abs(sumOfW1st16*sumOfW2nd16)>0.) 
13573  {   
13574   denominator16 = 1.-sumOfWW16/(sumOfW1st16*sumOfW2nd16);
13575   if(TMath::Abs(denominator16)>0.) 
13576   {   
13577    // covariance:
13578    Double_t covariance16 = numerator16/denominator16;
13579    // weight dependent prefactor for covariance:
13580    Double_t wPrefactor16 = sumOfWW16/(sumOfW1st16*sumOfW2nd16);
13581    // finally, store "weighted" covariance:
13582    fIntFlowCovariancesNUA->SetBinContent(16,wPrefactor16*covariance16);
13583   } // end of if(TMath::Abs(denominator16)>0.)
13584  } // end ofif(TMath::Abs(sumOfW1st16*sumOfW2nd16)>0.)  
13585  
13586  // Cov(<cos(phi1)>,<sin(phi1-phi2-phi3)>):
13587  Double_t product17 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(17); // <<cos(phi1)><sin(phi1-phi2-phi3)>> 
13588  Double_t term1st17 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13589  Double_t term2nd17 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13590  Double_t sumOfW1st17 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13591  Double_t sumOfW2nd17 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13592  Double_t sumOfWW17 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(17); // W_{<cos(phi1)>} * W_{<sin(phi1-phi2-phi3)>}
13593  // numerator in the expression for the the unbiased estimator for covariance:
13594  Double_t numerator17 = product17 - term1st17*term2nd17; 
13595  // denominator in the expression for the the unbiased estimator for covariance:
13596  Double_t denominator17 = 0.;
13597  if(TMath::Abs(sumOfW1st17*sumOfW2nd17)>0.) 
13598  {
13599   denominator17 = 1.-sumOfWW17/(sumOfW1st17*sumOfW2nd17);
13600   if(TMath::Abs(denominator17)>0.) 
13601   {   
13602    // covariance:
13603    Double_t covariance17 = numerator17/denominator17;
13604    // weight dependent prefactor for covariance:
13605    Double_t wPrefactor17 = sumOfWW17/(sumOfW1st17*sumOfW2nd17);
13606     // finally, store "weighted" covariance:
13607    fIntFlowCovariancesNUA->SetBinContent(17,wPrefactor17*covariance17);
13608   } // end of if(TMath::Abs(denominator17)>0.) 
13609  } // end of if(TMath::Abs(sumOfW1st17*sumOfW2nd17)>0.) 
13610
13611  // Cov(<sin(phi1)>,<cos(phi1+phi2)>):
13612  Double_t product18 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(18); // <<sin(phi1)><cos(phi1+phi2)>> 
13613  Double_t term1st18 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
13614  Double_t term2nd18 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13615  Double_t sumOfW1st18 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
13616  Double_t sumOfW2nd18 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13617  Double_t sumOfWW18 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(18); // W_{<sin(phi1)>} * W_{<cos(phi1+phi2)>}
13618  // numerator in the expression for the the unbiased estimator for covariance:
13619  Double_t numerator18 = product18 - term1st18*term2nd18; 
13620  // denominator in the expression for the the unbiased estimator for covariance:
13621  Double_t denominator18 = 0.;
13622  if(TMath::Abs(sumOfW1st18*sumOfW2nd18)>0.) 
13623  { 
13624   denominator18 = 1.-sumOfWW18/(sumOfW1st18*sumOfW2nd18);
13625   if(TMath::Abs(denominator18)>0.) 
13626   {   
13627    // covariance:
13628    Double_t covariance18 = numerator18/denominator18;
13629    // weight dependent prefactor for covariance:
13630    Double_t wPrefactor18 = sumOfWW18/(sumOfW1st18*sumOfW2nd18);
13631    // finally, store "weighted" covariance:
13632    fIntFlowCovariancesNUA->SetBinContent(18,wPrefactor18*covariance18); 
13633   } // end of if(TMath::Abs(denominator18)>0.) 
13634  } // end of if(TMath::Abs(sumOfW1st18*sumOfW2nd18)>0.) 
13635
13636  // Cov(<sin(phi1)>,<sin(phi1+phi2)>):
13637  Double_t product19 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(19); // <<sin(phi1)><sin(phi1+phi2)>> 
13638  Double_t term1st19 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
13639  Double_t term2nd19 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13640  Double_t sumOfW1st19 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
13641  Double_t sumOfW2nd19 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13642  Double_t sumOfWW19 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(19); // W_{<sin(phi1)>} * W_{<sin(phi1+phi2)>}
13643  // numerator in the expression for the the unbiased estimator for covariance:
13644  Double_t numerator19 = product19 - term1st19*term2nd19; 
13645  // denominator in the expression for the the unbiased estimator for covariance:
13646  Double_t denominator19 = 0.;
13647  if(TMath::Abs(sumOfW1st19*sumOfW2nd19)>0.) 
13648  { 
13649   denominator19 = 1.-sumOfWW19/(sumOfW1st19*sumOfW2nd19);
13650   if(TMath::Abs(denominator19)>0.) 
13651   {   
13652    // covariance:
13653    Double_t covariance19 = numerator19/denominator19;
13654    // weight dependent prefactor for covariance:
13655    Double_t wPrefactor19 = sumOfWW19/(sumOfW1st19*sumOfW2nd19);
13656    // finally, store "weighted" covariance:
13657    fIntFlowCovariancesNUA->SetBinContent(19,wPrefactor19*covariance19);
13658   } // end of if(TMath::Abs(denominator19)>0.)
13659  } // end of if(TMath::Abs(sumOfW1st19*sumOfW2nd19)>0.)
13660  
13661  // Cov(<sin(phi1)>,<cos(phi1-phi2-phi3)>):
13662  Double_t product20 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(20); // <<sin(phi1)><cos(phi1-phi2-phi3)>> 
13663  Double_t term1st20 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
13664  Double_t term2nd20 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13665  Double_t sumOfW1st20 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
13666  Double_t sumOfW2nd20 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13667  Double_t sumOfWW20 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(20); // W_{<sin(phi1)>} * W_{<cos(phi1-phi2-phi3)>}
13668  // numerator in the expression for the the unbiased estimator for covariance:
13669  Double_t numerator20 = product20 - term1st20*term2nd20; 
13670  // denominator in the expression for the the unbiased estimator for covariance:
13671  Double_t denominator20 = 0.;
13672  if(TMath::Abs(sumOfW1st20*sumOfW2nd20)>0.)
13673  { 
13674   denominator20 = 1.-sumOfWW20/(sumOfW1st20*sumOfW2nd20);
13675   if(TMath::Abs(denominator20)>0.) 
13676   { 
13677    // covariance:
13678    Double_t covariance20 = numerator20/denominator20;
13679    // weight dependent prefactor for covariance:
13680    Double_t wPrefactor20 = sumOfWW20/(sumOfW1st20*sumOfW2nd20);
13681    // finally, store "weighted" covariance:
13682    fIntFlowCovariancesNUA->SetBinContent(20,wPrefactor20*covariance20);
13683   } // end of if(TMath::Abs(denominator20)>0.) 
13684  } // end of if(TMath::Abs(sumOfW1st20*sumOfW2nd20)>0.)
13685
13686  // Cov(<sin(phi1)>,<sin(phi1-phi2-phi3)>):
13687  Double_t product21 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(21); // <<sin(phi1)><sin(phi1-phi2-phi3)>> 
13688  Double_t term1st21 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
13689  Double_t term2nd21 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13690  Double_t sumOfW1st21 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
13691  Double_t sumOfW2nd21 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13692  Double_t sumOfWW21 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(21); // W_{<sin(phi1)>} * W_{<sin(phi1-phi2-phi3)>}
13693  // numerator in the expression for the the unbiased estimator for covariance:
13694  Double_t numerator21 = product21 - term1st21*term2nd21; 
13695  // denominator in the expression for the the unbiased estimator for covariance:
13696  Double_t denominator21 = 0.;
13697  if(TMath::Abs(sumOfW1st21*sumOfW2nd21)>0.)
13698  { 
13699   denominator21 = 1.-sumOfWW21/(sumOfW1st21*sumOfW2nd21);
13700   if(TMath::Abs(denominator21)>0.) 
13701   {   
13702    // covariance:
13703    Double_t covariance21 = numerator21/denominator21;
13704    // weight dependent prefactor for covariance:
13705    Double_t wPrefactor21 = sumOfWW21/(sumOfW1st21*sumOfW2nd21);
13706    // finally, store "weighted" covariance:
13707    fIntFlowCovariancesNUA->SetBinContent(21,wPrefactor21*covariance21);
13708   } // end of if(TMath::Abs(denominator21)>0.)
13709  } // end of if(TMath::Abs(sumOfW1st21*sumOfW2nd21)>0.)
13710
13711  // Cov(<cos(phi1+phi2)>,<sin(phi1+phi2)>):
13712  Double_t product22 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(22); // <<cos(phi1+phi2)><sin(phi1+phi2)>> 
13713  Double_t term1st22 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13714  Double_t term2nd22 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13715  Double_t sumOfW1st22 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13716  Double_t sumOfW2nd22 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13717  Double_t sumOfWW22 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(22); // W_{<cos(phi1+phi2)>} * W_{<sin(phi1+phi2)>}
13718  // numerator in the expression for the the unbiased estimator for covariance:
13719  Double_t numerator22 = product22 - term1st22*term2nd22; 
13720  // denominator in the expression for the the unbiased estimator for covariance:
13721  Double_t denominator22 = 0.;
13722  if(TMath::Abs(sumOfW1st22*sumOfW2nd22)>0.)
13723  { 
13724   denominator22 = 1.-sumOfWW22/(sumOfW1st22*sumOfW2nd22);
13725   if(TMath::Abs(denominator22)>0.) 
13726   {   
13727    // covariance:
13728    Double_t covariance22 = numerator22/denominator22;
13729    // weight dependent prefactor for covariance:
13730    Double_t wPrefactor22 = sumOfWW22/(sumOfW1st22*sumOfW2nd22);
13731    // finally, store "weighted" covariance:
13732    fIntFlowCovariancesNUA->SetBinContent(22,wPrefactor22*covariance22);
13733   } // end of if(TMath::Abs(denominator22)>0.) 
13734  } // end of if(TMath::Abs(sumOfW1st22*sumOfW2nd22)>0.) 
13735
13736  // Cov(<cos(phi1+phi2)>,<cos(phi1-phi2-phi3)>):
13737  Double_t product23 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(23); // <<cos(phi1+phi2)><cos(phi1-phi2-phi3)>> 
13738  Double_t term1st23 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13739  Double_t term2nd23 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13740  Double_t sumOfW1st23 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13741  Double_t sumOfW2nd23 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13742  Double_t sumOfWW23 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(23); // W_{<cos(phi1+phi2)>} * W_{<cos(phi1-phi2-phi3)>}
13743  // numerator in the expression for the the unbiased estimator for covariance:
13744  Double_t numerator23 = product23 - term1st23*term2nd23; 
13745  // denominator in the expression for the the unbiased estimator for covariance:
13746  Double_t denominator23 = 0.;
13747  if(TMath::Abs(sumOfW1st23*sumOfW2nd23)>0.)
13748  {  
13749   denominator23 = 1.-sumOfWW23/(sumOfW1st23*sumOfW2nd23);
13750   if(TMath::Abs(denominator23)>0.) 
13751   {   
13752    // covariance:
13753    Double_t covariance23 = numerator23/denominator23;
13754    // weight dependent prefactor for covariance:
13755    Double_t wPrefactor23 = sumOfWW23/(sumOfW1st23*sumOfW2nd23);
13756    // finally, store "weighted" covariance:
13757    fIntFlowCovariancesNUA->SetBinContent(23,wPrefactor23*covariance23);
13758   } // end of if(TMath::Abs(denominator23)>0.) 
13759  } // end of if(TMath::Abs(sumOfW1st23*sumOfW2nd23)>0.)
13760  
13761  // Cov(<cos(phi1+phi2)>,<sin(phi1-phi2-phi3)>):
13762  Double_t product24 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(24); // <<cos(phi1+phi2)><sin(phi1-phi2-phi3)>> 
13763  Double_t term1st24 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13764  Double_t term2nd24 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13765  Double_t sumOfW1st24 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13766  Double_t sumOfW2nd24 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13767  Double_t sumOfWW24 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(24); // W_{<cos(phi1+phi2)>} * W_{<sin(phi1-phi2-phi3)>}
13768  // numerator in the expression for the the unbiased estimator for covariance:
13769  Double_t numerator24 = product24 - term1st24*term2nd24; 
13770  // denominator in the expression for the the unbiased estimator for covariance:
13771  Double_t denominator24 = 0.;
13772  if(TMath::Abs(sumOfW1st24*sumOfW2nd24)>0.)
13773  {   
13774   denominator24 = 1.-sumOfWW24/(sumOfW1st24*sumOfW2nd24);
13775   if(TMath::Abs(denominator24)>0.) 
13776   {   
13777    // covariance:
13778    Double_t covariance24 = numerator24/denominator24;
13779    // weight dependent prefactor for covariance:
13780    Double_t wPrefactor24 = sumOfWW24/(sumOfW1st24*sumOfW2nd24);
13781    // finally, store "weighted" covariance:
13782    fIntFlowCovariancesNUA->SetBinContent(24,wPrefactor24*covariance24);
13783   } // end of if(TMath::Abs(denominator24)>0.)  
13784  } // end of if(TMath::Abs(sumOfW1st24*sumOfW2nd24)>0.)
13785
13786  // Cov(<sin(phi1+phi2)>,<cos(phi1-phi2-phi3)>):
13787  Double_t product25 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(25); // <<sin(phi1+phi2)><cos(phi1-phi2-phi3)>> 
13788  Double_t term1st25 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13789  Double_t term2nd25 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13790  Double_t sumOfW1st25 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13791  Double_t sumOfW2nd25 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13792  Double_t sumOfWW25 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(25); // W_{<sin(phi1+phi2)>} * W_{<cos(phi1-phi2-phi3)>}
13793  // numerator in the expression for the the unbiased estimator for covariance:
13794  Double_t numerator25 = product25 - term1st25*term2nd25; 
13795  // denominator in the expression for the the unbiased estimator for covariance:
13796  Double_t denominator25 = 0.;
13797  if(TMath::Abs(sumOfW1st25*sumOfW2nd25)>0.)
13798  { 
13799   denominator25 = 1.-sumOfWW25/(sumOfW1st25*sumOfW2nd25);
13800   if(TMath::Abs(denominator25)>0.) 
13801   { 
13802    // covariance:
13803    Double_t covariance25 = numerator25/denominator25;
13804    // weight dependent prefactor for covariance:
13805    Double_t wPrefactor25 = sumOfWW25/(sumOfW1st25*sumOfW2nd25);
13806    // finally, store "weighted" covariance:
13807    fIntFlowCovariancesNUA->SetBinContent(25,wPrefactor25*covariance25);
13808   } // end of if(TMath::Abs(denominator25)>0.)
13809  } // end of if(TMath::Abs(sumOfW1st25*sumOfW2nd25)>0.)
13810  
13811  // Cov(<sin(phi1+phi2)>,<sin(phi1-phi2-phi3)>):
13812  Double_t product26 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(26); // <<sin(phi1+phi2)><sin(phi1-phi2-phi3)>> 
13813  Double_t term1st26 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13814  Double_t term2nd26 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13815  Double_t sumOfW1st26 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13816  Double_t sumOfW2nd26 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13817  Double_t sumOfWW26 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(26); // W_{<sin(phi1+phi2)>} * W_{<sin(phi1-phi2-phi3)>}
13818  // numerator in the expression for the the unbiased estimator for covariance:
13819  Double_t numerator26 = product26 - term1st26*term2nd26; 
13820  // denominator in the expression for the the unbiased estimator for covariance:
13821  Double_t denominator26 = 0.;
13822  if(TMath::Abs(sumOfW1st26*sumOfW2nd26)>0.)
13823  { 
13824   denominator26 = 1.-sumOfWW26/(sumOfW1st26*sumOfW2nd26);
13825   if(TMath::Abs(denominator26)>0.) 
13826   { 
13827    // covariance:
13828    Double_t covariance26 = numerator26/denominator26;
13829    // weight dependent prefactor for covariance:
13830    Double_t wPrefactor26 = sumOfWW26/(sumOfW1st26*sumOfW2nd26);
13831    // finally, store "weighted" covariance:
13832    fIntFlowCovariancesNUA->SetBinContent(26,wPrefactor26*covariance26);
13833   } // end of if(TMath::Abs(denominator26)>0.) 
13834  } // end of if(TMath::Abs(sumOfW1st26*sumOfW2nd26)>0.)
13835  
13836  // Cov(<cos(phi1-phi2-phi3)>,<sin(phi1-phi2-phi3)>):
13837  Double_t product27 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(27); // <<cos(phi1-phi2-phi3)><sin(phi1-phi2-phi3)>> 
13838  Double_t term1st27 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13839  Double_t term2nd27 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13840  Double_t sumOfW1st27 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13841  Double_t sumOfW2nd27 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13842  Double_t sumOfWW27 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(27); // W_{<cos(phi1-phi2-phi3)>} * W_{<sin(phi1-phi2-phi3)>}
13843  // numerator in the expression for the the unbiased estimator for covariance:
13844  Double_t numerator27 = product27 - term1st27*term2nd27; 
13845  // denominator in the expression for the the unbiased estimator for covariance:
13846  Double_t denominator27 = 0.;
13847  if(TMath::Abs(sumOfW1st27*sumOfW2nd27)>0.)
13848  { 
13849   denominator27 = 1.-sumOfWW27/(sumOfW1st27*sumOfW2nd27);
13850   if(TMath::Abs(denominator27)>0.) 
13851   { 
13852    // covariance:
13853    Double_t covariance27 = numerator27/denominator27;
13854    // weight dependent prefactor for covariance:
13855    Double_t wPrefactor27 = sumOfWW27/(sumOfW1st27*sumOfW2nd27);
13856    // finally, store "weighted" covariance:
13857    fIntFlowCovariancesNUA->SetBinContent(27,wPrefactor27*covariance27);
13858   } // end of if(TMath::Abs(denominator27)>0.) 
13859  } // end of if(TMath::Abs(sumOfW1st27*sumOfW2nd27)>0.)
13860  
13861 } // end of AliFlowAnalysisWithQCumulants::CalculateCovariancesNUAIntFlow()
13862
13863 //=======================================================================================================================
13864
13865 void AliFlowAnalysisWithQCumulants::FinalizeCorrelationsIntFlow() 
13866 {
13867  // From profile fIntFlowCorrelationsPro access measured correlations and spread, 
13868  // correctly calculate the statistical errors and store the final results and 
13869  // statistical errors for correlations in histogram fIntFlowCorrelationsHist.
13870  //
13871  // Remark: Statistical error of correlation is calculated as:
13872  //
13873  //          statistical error = termA * spread * termB:
13874  //          termA = sqrt{sum_{i=1}^{N} w^2}/(sum_{i=1}^{N} w)
13875  //          termB = 1/sqrt(1-termA^2)   
13876  //
13877    
13878  for(Int_t ci=1;ci<=4;ci++) // correlation index
13879  {
13880   if(fIntFlowCorrelationsPro->GetBinEffectiveEntries(ci) < 2 || fIntFlowSquaredCorrelationsPro->GetBinEffectiveEntries(ci) < 2)
13881   {
13882    fIntFlowCorrelationsPro->SetBinError(ci,0.);
13883    fIntFlowSquaredCorrelationsPro->SetBinError(ci,0.);
13884    continue;
13885   } 
13886   Double_t correlation = fIntFlowCorrelationsPro->GetBinContent(ci);
13887   Double_t squaredCorrelation = fIntFlowSquaredCorrelationsPro->GetBinContent(ci);
13888   Double_t spread = 0.;
13889   if(squaredCorrelation-correlation*correlation >= 0.)
13890   {
13891    spread = pow(squaredCorrelation-correlation*correlation,0.5);
13892   } else
13893     {
13894      cout<<endl;
13895      cout<<Form(" WARNING: Imaginary 'spread' for %d-particle correlation!!!! ",2*ci)<<endl;
13896      cout<<endl;
13897     }
13898   Double_t sumOfLinearEventWeights = fIntFlowSumOfEventWeights[0]->GetBinContent(ci);
13899   Double_t sumOfQuadraticEventWeights = fIntFlowSumOfEventWeights[1]->GetBinContent(ci);
13900   Double_t termA = 0.;
13901   Double_t termB = 0.;
13902   if(TMath::Abs(sumOfLinearEventWeights) > 0.) // to be improved - shall I omitt here Abs() ?
13903   {
13904    termA = pow(sumOfQuadraticEventWeights,0.5)/sumOfLinearEventWeights;
13905   } else
13906     {
13907      cout<<endl;
13908      cout<<" WARNING (QC): sumOfLinearEventWeights == 0 in method FinalizeCorrelationsIntFlow() !!!!"<<endl;
13909      cout<<"               (for "<<2*ci<<"-particle correlation)"<<endl;
13910      cout<<endl;
13911     }
13912   if(1.-pow(termA,2.) > 0.)
13913   {
13914    termB = 1./pow(1-pow(termA,2.),0.5);
13915   } else
13916     {
13917      cout<<endl;
13918      cout<<" WARNING (QC): 1.-pow(termA,2.) <= 0 in method FinalizeCorrelationsIntFlow() !!!!"<<endl;   
13919      cout<<"               (for "<<2*ci<<"-particle correlation)"<<endl;
13920      cout<<endl;
13921     }     
13922   Double_t statisticalError = termA * spread * termB;
13923   fIntFlowCorrelationsHist->SetBinContent(ci,correlation);
13924   fIntFlowCorrelationsHist->SetBinError(ci,statisticalError);
13925  } // end of for(Int_t ci=1;ci<=4;ci++) // correlation index     
13926  
13927  // Versus multiplicity: 
13928  if(!fCalculateCumulantsVsM){return;}
13929  for(Int_t ci=0;ci<=3;ci++) // correlation index
13930  {
13931   Int_t nBins = fIntFlowCorrelationsVsMPro[ci]->GetNbinsX(); 
13932   for(Int_t b=1;b<=nBins;b++) // looping over multiplicity bins
13933   {
13934    if(fIntFlowCorrelationsVsMPro[ci]->GetBinEffectiveEntries(b) < 2 || fIntFlowSquaredCorrelationsVsMPro[ci]->GetBinEffectiveEntries(b) < 2)
13935    {
13936     fIntFlowCorrelationsVsMPro[ci]->SetBinError(b,0.);
13937     fIntFlowSquaredCorrelationsVsMPro[ci]->SetBinError(b,0.);
13938     continue;
13939    } 
13940    Double_t correlationVsM = fIntFlowCorrelationsVsMPro[ci]->GetBinContent(b);
13941    Double_t squaredCorrelationVsM = fIntFlowSquaredCorrelationsVsMPro[ci]->GetBinContent(b);
13942    Double_t spreadVsM = 0.;
13943    if(squaredCorrelationVsM-correlationVsM*correlationVsM >= 0.)
13944    {
13945     spreadVsM = pow(squaredCorrelationVsM-correlationVsM*correlationVsM,0.5);
13946    } else
13947      {
13948       cout<<endl;
13949       cout<<Form(" WARNING (QC): Imaginary 'spreadVsM' for ci = %d, bin = %d, entries = %f !!!!",
13950                  ci,b,fIntFlowCorrelationsVsMPro[ci]->GetBinEffectiveEntries(b))<<endl; 
13951       cout<<endl;
13952      }     
13953    Double_t sumOfLinearEventWeightsVsM = fIntFlowSumOfEventWeightsVsM[ci][0]->GetBinContent(b);
13954    Double_t sumOfQuadraticEventWeightsVsM = fIntFlowSumOfEventWeightsVsM[ci][1]->GetBinContent(b);
13955    Double_t termAVsM = 0.;
13956    Double_t termBVsM = 0.;
13957    if(sumOfLinearEventWeightsVsM > 0.) 
13958    {
13959     termAVsM = pow(sumOfQuadraticEventWeightsVsM,0.5)/sumOfLinearEventWeightsVsM;
13960    }
13961    if(1.-pow(termAVsM,2.) > 0.)
13962    {
13963     termBVsM = 1./pow(1-pow(termAVsM,2.),0.5);
13964    }     
13965    Double_t statisticalErrorVsM = termAVsM * spreadVsM * termBVsM;
13966    fIntFlowCorrelationsVsMHist[ci]->SetBinContent(b,correlationVsM);
13967    fIntFlowCorrelationsVsMHist[ci]->SetBinError(b,statisticalErrorVsM);  
13968   } // end of for(Int_t b=1;b<=nBins;b++)
13969  } // end of for(Int_t ci=1;ci<=4;ci++) // correlation index                                                        
13970                                                                                                                            
13971 } // end of AliFlowAnalysisWithQCumulants::FinalizeCorrelationsIntFlow()
13972
13973 //=======================================================================================================================
13974
13975 void AliFlowAnalysisWithQCumulants::FillAverageMultiplicities(Int_t nRP)
13976 {
13977  // Fill profile fAverageMultiplicity to hold average multiplicities and 
13978  // number of events for events with nRP>=0, nRP>=1, ... , and nRP>=8
13979  
13980  // Binning of fAverageMultiplicity is organized as follows:
13981  //  1st bin: all events (including the empty ones)
13982  //  2nd bin: event with # of RPs greater or equal to 1
13983  //  3rd bin: event with # of RPs greater or equal to 2
13984  //  4th bin: event with # of RPs greater or equal to 3
13985  //  5th bin: event with # of RPs greater or equal to 4
13986  //  6th bin: event with # of RPs greater or equal to 5
13987  //  7th bin: event with # of RPs greater or equal to 6
13988  //  8th bin: event with # of RPs greater or equal to 7
13989  //  9th bin: event with # of RPs greater or equal to 8
13990  
13991  if(nRP<0)
13992  {
13993   cout<<endl;
13994   cout<<" WARNING (QC): nRP<0 in in AFAWQC::FAM() !!!!"<<endl;
13995   cout<<endl;
13996   exit(0);
13997  }
13998  
13999  for(Int_t i=0;i<9;i++)
14000  {
14001   if(nRP>=i){fAvMultiplicity->Fill(i+0.5,nRP,1);}
14002  }
14003  
14004 } // end of AliFlowAnalysisWithQCumulants::FillAverageMultiplicities(nRP)
14005
14006 //=======================================================================================================================
14007
14008 void AliFlowAnalysisWithQCumulants::CalculateCumulantsIntFlow()
14009
14010  // a) Calculate Q-cumulants from the measured multiparticle correlations;
14011  // b) Propagate the statistical errors from measured multiparticle correlations to statistical errors of Q-cumulants;  
14012  // c) Remark: Q-cumulants calculated in this method are biased by non-uniform acceptance of detector !!!! 
14013  //            Method CalculateQcumulantsCorrectedForNUAIntFlow() is called afterwards to correct for this bias;
14014  // d) Store the results and statistical error of Q-cumulants in histogram fIntFlowQcumulants.
14015  //    Binning of fIntFlowQcumulants is organized as follows:
14016  //
14017  //            1st bin: QC{2}
14018  //            2nd bin: QC{4}
14019  //            3rd bin: QC{6}
14020  //            4th bin: QC{8}
14021  //
14022  
14023  // Correlations:
14024  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>> 
14025  Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>>  
14026  Double_t six = fIntFlowCorrelationsHist->GetBinContent(3); // <<6>> 
14027  Double_t eight = fIntFlowCorrelationsHist->GetBinContent(4); // <<8>>  
14028  // Statistical errors of average 2-, 4-, 6- and 8-particle azimuthal correlations:
14029  Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1); // statistical error of <2>  
14030  Double_t fourError = fIntFlowCorrelationsHist->GetBinError(2); // statistical error of <4>   
14031  Double_t sixError = fIntFlowCorrelationsHist->GetBinError(3); // statistical error of <6> 
14032  Double_t eightError = fIntFlowCorrelationsHist->GetBinError(4); // statistical error of <8> 
14033  // Covariances (multiplied by prefactor depending on weights - see comments in CalculateCovariancesIntFlow()):
14034  Double_t wCov24 = 0.; // Cov(<2>,<4>) * prefactor(w_<2>,w_<4>)
14035  Double_t wCov26 = 0.; // Cov(<2>,<6>) * prefactor(w_<2>,w_<6>)
14036  Double_t wCov28 = 0.; // Cov(<2>,<8>) * prefactor(w_<2>,w_<8>)
14037  Double_t wCov46 = 0.; // Cov(<4>,<6>) * prefactor(w_<4>,w_<6>)
14038  Double_t wCov48 = 0.; // Cov(<4>,<8>) * prefactor(w_<4>,w_<8>)
14039  Double_t wCov68 = 0.; // Cov(<6>,<8>) * prefactor(w_<6>,w_<8>)  
14040  if(!fForgetAboutCovariances)
14041  {
14042   wCov24 = fIntFlowCovariances->GetBinContent(1); // Cov(<2>,<4>) * prefactor(w_<2>,w_<4>)
14043   wCov26 = fIntFlowCovariances->GetBinContent(2); // Cov(<2>,<6>) * prefactor(w_<2>,w_<6>)
14044   wCov28 = fIntFlowCovariances->GetBinContent(3); // Cov(<2>,<8>) * prefactor(w_<2>,w_<8>)
14045   wCov46 = fIntFlowCovariances->GetBinContent(4); // Cov(<4>,<6>) * prefactor(w_<4>,w_<6>)
14046   wCov48 = fIntFlowCovariances->GetBinContent(5); // Cov(<4>,<8>) * prefactor(w_<4>,w_<8>)
14047   wCov68 = fIntFlowCovariances->GetBinContent(6); // Cov(<6>,<8>) * prefactor(w_<6>,w_<8>) 
14048  }
14049  // Q-cumulants: 
14050  Double_t qc2 = 0.; // QC{2}
14051  Double_t qc4 = 0.; // QC{4}
14052  Double_t qc6 = 0.; // QC{6}
14053  Double_t qc8 = 0.; // QC{8}
14054  if(TMath::Abs(two) > 0.){qc2 = two;} 
14055  if(TMath::Abs(four) > 0.){qc4 = four-2.*pow(two,2.);} 
14056  if(TMath::Abs(six) > 0.){qc6 = six-9.*two*four+12.*pow(two,3.);} 
14057  if(TMath::Abs(eight) > 0.){qc8 = eight-16.*two*six-18.*pow(four,2.)+144.*pow(two,2.)*four-144.*pow(two,4.);} 
14058  // Statistical errors of Q-cumulants:       
14059  Double_t qc2Error = 0.;
14060  Double_t qc4Error = 0.;
14061  Double_t qc6Error = 0.;
14062  Double_t qc8Error = 0.; 
14063  // Squared statistical errors of Q-cumulants:       
14064  //Double_t qc2ErrorSquared = 0.;
14065  Double_t qc4ErrorSquared = 0.;
14066  Double_t qc6ErrorSquared = 0.;
14067  Double_t qc8ErrorSquared = 0.;        
14068  // Statistical error of QC{2}:              
14069  qc2Error = twoError;                                                 
14070  // Statistical error of QC{4}:              
14071  qc4ErrorSquared = 16.*pow(two,2.)*pow(twoError,2)+pow(fourError,2.)
14072                  - 8.*two*wCov24;                     
14073  if(qc4ErrorSquared>0.)
14074  {
14075   qc4Error = pow(qc4ErrorSquared,0.5);
14076  } else 
14077    {
14078     cout<<" WARNING (QC): Statistical error of QC{4} is imaginary !!!!"<<endl;
14079    }                                           
14080  // Statistical error of QC{6}:              
14081  qc6ErrorSquared = 81.*pow(4.*pow(two,2.)-four,2.)*pow(twoError,2.)
14082                  + 81.*pow(two,2.)*pow(fourError,2.)
14083                  + pow(sixError,2.)
14084                  - 162.*two*(4.*pow(two,2.)-four)*wCov24
14085                  + 18.*(4.*pow(two,2.)-four)*wCov26
14086                  - 18.*two*wCov46;                     
14087  if(qc6ErrorSquared>0.)
14088  {
14089   qc6Error = pow(qc6ErrorSquared,0.5);
14090  } else 
14091    {
14092     cout<<" WARNING (QC): Statistical error of QC{6} is imaginary !!!!"<<endl;
14093    }                       
14094  // Statistical error of QC{8}:              
14095  qc8ErrorSquared = 256.*pow(36.*pow(two,3.)-18.*four*two+six,2.)*pow(twoError,2.)
14096                  + 1296.*pow(4.*pow(two,2.)-four,2.)*pow(fourError,2.)
14097                  + 256.*pow(two,2.)*pow(sixError,2.)
14098                  + pow(eightError,2.)
14099                  - 1152.*(36.*pow(two,3.)-18.*four*two+six)*(4.*pow(two,2.)-four)*wCov24
14100                  + 512.*two*(36.*pow(two,3.)-18.*four*two+six)*wCov26
14101                  - 32.*(36.*pow(two,3.)-18.*four*two+six)*wCov28
14102                  - 1152.*two*(4.*pow(two,2.)-four)*wCov46
14103                  + 72.*(4.*pow(two,2.)-four)*wCov48
14104                  - 32.*two*wCov68;      
14105  if(qc8ErrorSquared>0.)
14106  {
14107   qc8Error = pow(qc8ErrorSquared,0.5);
14108  } else 
14109    {
14110     cout<<"WARNING (QC): Statistical error of QC{8} is imaginary !!!!"<<endl;
14111    }
14112  // Store the results and statistical errors for Q-cumulants:
14113  if(TMath::Abs(qc2)>0.)
14114  {
14115   fIntFlowQcumulants->SetBinContent(1,qc2);
14116   fIntFlowQcumulants->SetBinError(1,qc2Error);
14117  }
14118  if(TMath::Abs(qc4)>0.)
14119  {
14120   fIntFlowQcumulants->SetBinContent(2,qc4);
14121   fIntFlowQcumulants->SetBinError(2,qc4Error);
14122  }
14123  if(TMath::Abs(qc6)>0.)
14124  {
14125   fIntFlowQcumulants->SetBinContent(3,qc6);
14126   fIntFlowQcumulants->SetBinError(3,qc6Error);
14127  }
14128  if(TMath::Abs(qc8)>0.)
14129  {
14130   fIntFlowQcumulants->SetBinContent(4,qc8); 
14131   fIntFlowQcumulants->SetBinError(4,qc8Error);
14132  } 
14133  
14134  // Versus multiplicity: 
14135  if(!fCalculateCumulantsVsM){return;}
14136  Int_t nBins = fIntFlowCorrelationsVsMPro[0]->GetNbinsX(); // to be improved (hardwired 0) 
14137  Double_t value[4] = {0.}; // QCs vs M
14138  Double_t error[4] = {0.}; // error of QCs vs M
14139  Double_t dSum1[4] = {0.}; // sum value_i/(error_i)^2
14140  Double_t dSum2[4] = {0.}; // sum 1/(error_i)^2
14141  for(Int_t b=1;b<=nBins;b++)
14142  {
14143   // Correlations:
14144   two = fIntFlowCorrelationsVsMHist[0]->GetBinContent(b); // <<2>> 
14145   four = fIntFlowCorrelationsVsMHist[1]->GetBinContent(b); // <<4>>  
14146   six = fIntFlowCorrelationsVsMHist[2]->GetBinContent(b); // <<6>> 
14147   eight = fIntFlowCorrelationsVsMHist[3]->GetBinContent(b); // <<8>>  
14148   // Statistical errors of average 2-, 4-, 6- and 8-particle azimuthal correlations:
14149   twoError = fIntFlowCorrelationsVsMHist[0]->GetBinError(b); // statistical error of <2>  
14150   fourError = fIntFlowCorrelationsVsMHist[1]->GetBinError(b); // statistical error of <4>   
14151   sixError = fIntFlowCorrelationsVsMHist[2]->GetBinError(b); // statistical error of <6> 
14152   eightError = fIntFlowCorrelationsVsMHist[3]->GetBinError(b); // statistical error of <8> 
14153   // Covariances (multiplied by prefactor depending on weights - see comments in CalculateCovariancesIntFlow()):
14154   if(!fForgetAboutCovariances)
14155   {
14156    wCov24 = fIntFlowCovariancesVsM[0]->GetBinContent(b); // Cov(<2>,<4>) * prefactor(w_<2>,w_<4>)
14157    wCov26 = fIntFlowCovariancesVsM[1]->GetBinContent(b); // Cov(<2>,<6>) * prefactor(w_<2>,w_<6>)
14158    wCov28 = fIntFlowCovariancesVsM[2]->GetBinContent(b); // Cov(<2>,<8>) * prefactor(w_<2>,w_<8>)
14159    wCov46 = fIntFlowCovariancesVsM[3]->GetBinContent(b); // Cov(<4>,<6>) * prefactor(w_<4>,w_<6>)
14160    wCov48 = fIntFlowCovariancesVsM[4]->GetBinContent(b); // Cov(<4>,<8>) * prefactor(w_<4>,w_<8>)
14161    wCov68 = fIntFlowCovariancesVsM[5]->GetBinContent(b); // Cov(<6>,<8>) * prefactor(w_<6>,w_<8>) 
14162   }
14163   // Q-cumulants: 
14164   qc2 = 0.; // QC{2}
14165   qc4 = 0.; // QC{4}
14166   qc6 = 0.; // QC{6}
14167   qc8 = 0.; // QC{8}
14168   if(TMath::Abs(two) > 0.){qc2 = two;} 
14169   if(TMath::Abs(four) > 0.){qc4 = four-2.*pow(two,2.);} 
14170   if(TMath::Abs(six) > 0.){qc6 = six-9.*two*four+12.*pow(two,3.);} 
14171   if(TMath::Abs(eight) > 0.){qc8 = eight-16.*two*six-18.*pow(four,2.)+144.*pow(two,2.)*four-144.*pow(two,4.);}  
14172   // Statistical errors of Q-cumulants:       
14173   qc2Error = 0.;
14174   qc4Error = 0.;
14175   qc6Error = 0.;
14176   qc8Error = 0.; 
14177   // Squared statistical errors of Q-cumulants:       
14178   //Double_t qc2ErrorSquared = 0.;
14179   qc4ErrorSquared = 0.;
14180   qc6ErrorSquared = 0.;
14181   qc8ErrorSquared = 0.;    
14182   // Statistical error of QC{2}:              
14183   qc2Error = twoError;                                             
14184   // Statistical error of QC{4}:              
14185   qc4ErrorSquared = 16.*pow(two,2.)*pow(twoError,2)+pow(fourError,2.)
14186                   - 8.*two*wCov24;                     
14187   if(qc4ErrorSquared>0.)
14188   {
14189    qc4Error = pow(qc4ErrorSquared,0.5);
14190   } else 
14191     {
14192      // cout<<"WARNING: Statistical error of QC{4} is imaginary in multiplicity bin "<<b<<" !!!!"<<endl;
14193     }                                       
14194   // Statistical error of QC{6}:              
14195   qc6ErrorSquared = 81.*pow(4.*pow(two,2.)-four,2.)*pow(twoError,2.)
14196                   + 81.*pow(two,2.)*pow(fourError,2.)
14197                   + pow(sixError,2.)
14198                   - 162.*two*(4.*pow(two,2.)-four)*wCov24
14199                   + 18.*(4.*pow(two,2.)-four)*wCov26
14200                   - 18.*two*wCov46;                     
14201   if(qc6ErrorSquared>0.)
14202   {
14203    qc6Error = pow(qc6ErrorSquared,0.5);
14204   } else 
14205     {
14206      // cout<<"WARNING: Statistical error of QC{6} is imaginary in multiplicity bin "<<b<<" !!!!"<<endl;
14207     }                            
14208   // Statistical error of QC{8}:              
14209   qc8ErrorSquared = 256.*pow(36.*pow(two,3.)-18.*four*two+six,2.)*pow(twoError,2.)
14210                   + 1296.*pow(4.*pow(two,2.)-four,2.)*pow(fourError,2.)
14211                   + 256.*pow(two,2.)*pow(sixError,2.)
14212                   + pow(eightError,2.)
14213                   - 1152.*(36.*pow(two,3.)-18.*four*two+six)*(4.*pow(two,2.)-four)*wCov24
14214                   + 512.*two*(36.*pow(two,3.)-18.*four*two+six)*wCov26
14215                   - 32.*(36.*pow(two,3.)-18.*four*two+six)*wCov28
14216                   - 1152.*two*(4.*pow(two,2.)-four)*wCov46
14217                   + 72.*(4.*pow(two,2.)-four)*wCov48
14218                   - 32.*two*wCov68;      
14219   if(qc8ErrorSquared>0.)
14220   {
14221    qc8Error = pow(qc8ErrorSquared,0.5);
14222   } else 
14223     {
14224      // cout<<"WARNING: Statistical error of QC{8} is imaginary in multiplicity bin "<<b<<" !!!!"<<endl;
14225     }
14226   // Store the results and statistical errors for Q-cumulants:
14227   if(TMath::Abs(qc2)>0.)
14228   {
14229    fIntFlowQcumulantsVsM[0]->SetBinContent(b,qc2);
14230    fIntFlowQcumulantsVsM[0]->SetBinError(b,qc2Error);  
14231   }
14232   if(TMath::Abs(qc4)>0.)
14233   {
14234    fIntFlowQcumulantsVsM[1]->SetBinContent(b,qc4);  
14235    fIntFlowQcumulantsVsM[1]->SetBinError(b,qc4Error);
14236   }
14237   if(TMath::Abs(qc6)>0.)
14238   {
14239    fIntFlowQcumulantsVsM[2]->SetBinContent(b,qc6); 
14240    fIntFlowQcumulantsVsM[2]->SetBinError(b,qc6Error);
14241   }
14242   if(TMath::Abs(qc8)>0.)
14243   {  
14244    fIntFlowQcumulantsVsM[3]->SetBinContent(b,qc8);
14245    fIntFlowQcumulantsVsM[3]->SetBinError(b,qc8Error);
14246   } 
14247   // Rebin in M:
14248   for(Int_t co=0;co<4;co++)
14249   {
14250    if(fIntFlowCorrelationsVsMPro[co]->GetBinEffectiveEntries(b)<2){continue;}
14251    value[co] = fIntFlowQcumulantsVsM[co]->GetBinContent(b);
14252    error[co] = fIntFlowQcumulantsVsM[co]->GetBinError(b);
14253    if(error[co]>0.)
14254    {
14255     dSum1[co]+=value[co]/(error[co]*error[co]);
14256     dSum2[co]+=1./(error[co]*error[co]);
14257    }
14258   } // end of for(Int_t co=0;co<4;co++) 
14259  } // end of for(Int_t b=1;b<=nBins;b++)
14260  // Store rebinned Q-cumulants:
14261  for(Int_t co=0;co<4;co++)
14262  {
14263   if(dSum2[co]>0.)
14264   {
14265    fIntFlowQcumulantsRebinnedInM->SetBinContent(co+1,dSum1[co]/dSum2[co]);
14266    fIntFlowQcumulantsRebinnedInM->SetBinError(co+1,pow(1./dSum2[co],0.5));
14267   }
14268  } // end of for(Int_t co=0;co<4;co++)
14269  
14270 } // end of AliFlowAnalysisWithQCumulants::CalculateCumulantsIntFlow()
14271
14272 //================================================================================================================================ 
14273
14274 void AliFlowAnalysisWithQCumulants::CalculateReferenceFlow()
14275 {
14276  // a) Calculate the final results for reference flow estimates from Q-cumulants;
14277  // b) Propagate the statistical errors to reference flow estimates from statistical error of Q-cumulants; 
14278  // c) Store the results and statistical errors of reference flow estimates in histogram fIntFlow.
14279  //    Binning of fIntFlow is organized as follows:
14280  //
14281  //            1st bin: v{2,QC}
14282  //            2nd bin: v{4,QC}
14283  //            3rd bin: v{6,QC}
14284  //            4th bin: v{8,QC}
14285  //
14286  
14287  // Reference flow estimates:
14288  Double_t v2 = 0.; // v{2,QC}  
14289  Double_t v4 = 0.; // v{4,QC}  
14290  Double_t v6 = 0.; // v{6,QC}  
14291  Double_t v8 = 0.; // v{8,QC}
14292  // Reference flow's statistical errors:
14293  Double_t v2Error = 0.; // v{2,QC} stat. error 
14294  Double_t v4Error = 0.; // v{4,QC} stat. error
14295  Double_t v6Error = 0.; // v{6,QC} stat. error
14296  Double_t v8Error = 0.; // v{8,QC} stat. error
14297   
14298  // Q-cumulants:
14299  Double_t qc2 = fIntFlowQcumulants->GetBinContent(1); // QC{2}  
14300  Double_t qc4 = fIntFlowQcumulants->GetBinContent(2); // QC{4}  
14301  Double_t qc6 = fIntFlowQcumulants->GetBinContent(3); // QC{6}  
14302  Double_t qc8 = fIntFlowQcumulants->GetBinContent(4); // QC{8}
14303  // Q-cumulants's statistical errors: 
14304  Double_t qc2Error = fIntFlowQcumulants->GetBinError(1); // QC{2} stat. error  
14305  Double_t qc4Error = fIntFlowQcumulants->GetBinError(2); // QC{4} stat. error  
14306  Double_t qc6Error = fIntFlowQcumulants->GetBinError(3); // QC{6} stat. error  
14307  Double_t qc8Error = fIntFlowQcumulants->GetBinError(4); // QC{8} stat. error
14308  // Calculate reference flow estimates from Q-cumulants: 
14309  if(qc2>=0.){v2 = pow(qc2,0.5);} 
14310  if(qc4<=0.){v4 = pow(-1.*qc4,1./4.);} 
14311  if(qc6>=0.){v6 = pow((1./4.)*qc6,1./6.);}
14312  if(qc8<=0.){v8 = pow((-1./33.)*qc8,1./8.);}  
14313  // Calculate stat. error for reference flow estimates from stat. error of Q-cumulants:  
14314  if(qc2>0.){v2Error = (1./2.)*pow(qc2,-0.5)*qc2Error;} 
14315  if(qc4<0.){v4Error = (1./4.)*pow(-qc4,-3./4.)*qc4Error;} 
14316  if(qc6>0.){v6Error = (1./6.)*pow(2.,-1./3.)*pow(qc6,-5./6.)*qc6Error;}   
14317  if(qc8<0.){v8Error = (1./8.)*pow(33.,-1./8.)*pow(-qc8,-7./8.)*qc8Error;}   
14318  // Print warnings for the 'wrong sign' cumulants: 
14319  if(TMath::Abs(v2) < 1.e-44)
14320  {
14321   cout<<" WARNING: Wrong sign QC{2}, couldn't calculate v{2,QC} !!!!"<<endl;
14322  }
14323  if(TMath::Abs(v4) < 1.e-44)
14324  {
14325   cout<<" WARNING: Wrong sign QC{4}, couldn't calculate v{4,QC} !!!!"<<endl;
14326  } 
14327  if(TMath::Abs(v6) < 1.e-44)
14328  {
14329   cout<<" WARNING: Wrong sign QC{6}, couldn't calculate v{6,QC} !!!!"<<endl; 
14330  }
14331  if(TMath::Abs(v8) < 1.e-44)
14332  {
14333   cout<<" WARNING: Wrong sign QC{8}, couldn't calculate v{8,QC} !!!!"<<endl;
14334  }                       
14335  // Store the results and statistical errors of integrated flow estimates:
14336  fIntFlow->SetBinContent(1,v2);
14337  fIntFlow->SetBinError(1,v2Error);
14338  fIntFlow->SetBinContent(2,v4);
14339  fIntFlow->SetBinError(2,v4Error);
14340  fIntFlow->SetBinContent(3,v6);
14341  fIntFlow->SetBinError(3,v6Error);
14342  fIntFlow->SetBinContent(4,v8);
14343  fIntFlow->SetBinError(4,v8Error);  
14344   
14345  // Versus multiplicity: 
14346  if(!fCalculateCumulantsVsM){return;} 
14347  Int_t nBins = fIntFlowCorrelationsVsMPro[0]->GetNbinsX(); // to be improved (hardwired 0) 
14348  for(Int_t b=1;b<=nBins;b++)
14349  {
14350   // Q-cumulants:
14351   Double_t qc2VsM = fIntFlowQcumulantsVsM[0]->GetBinContent(b); // QC{2}  
14352   Double_t qc4VsM = fIntFlowQcumulantsVsM[1]->GetBinContent(b); // QC{4}  
14353   Double_t qc6VsM = fIntFlowQcumulantsVsM[2]->GetBinContent(b); // QC{6}  
14354   Double_t qc8VsM = fIntFlowQcumulantsVsM[3]->GetBinContent(b); // QC{8}
14355   // Q-cumulants's statistical errors: 
14356   Double_t qc2ErrorVsM = fIntFlowQcumulantsVsM[0]->GetBinError(b); // QC{2} stat. error  
14357   Double_t qc4ErrorVsM = fIntFlowQcumulantsVsM[1]->GetBinError(b); // QC{4} stat. error  
14358   Double_t qc6ErrorVsM = fIntFlowQcumulantsVsM[2]->GetBinError(b); // QC{6} stat. error  
14359   Double_t qc8ErrorVsM = fIntFlowQcumulantsVsM[3]->GetBinError(b); // QC{8} stat. error
14360   // Reference flow estimates:
14361   Double_t v2VsM = 0.; // v{2,QC}  
14362   Double_t v4VsM = 0.; // v{4,QC}  
14363   Double_t v6VsM = 0.; // v{6,QC}  
14364   Double_t v8VsM = 0.; // v{8,QC}
14365   // Reference flow estimates errors:
14366   Double_t v2ErrorVsM = 0.; // v{2,QC} stat. error  
14367   Double_t v4ErrorVsM = 0.; // v{4,QC} stat. error
14368   Double_t v6ErrorVsM = 0.; // v{6,QC} stat. error  
14369   Double_t v8ErrorVsM = 0.; // v{8,QC} stat. error
14370   // Calculate reference flow estimates from Q-cumulants: 
14371   if(qc2VsM>=0.){v2VsM = pow(qc2VsM,0.5);} 
14372   if(qc4VsM<=0.){v4VsM = pow(-1.*qc4VsM,1./4.);} 
14373   if(qc6VsM>=0.){v6VsM = pow((1./4.)*qc6VsM,1./6.);}
14374   if(qc8VsM<=0.){v8VsM = pow((-1./33.)*qc8VsM,1./8.);}  
14375   // Calculate stat. error for reference flow estimates from stat. error of Q-cumulants: 
14376   if(qc2VsM>0.){v2ErrorVsM = (1./2.)*pow(qc2VsM,-0.5)*qc2ErrorVsM;} 
14377   if(qc4VsM<0.){v4ErrorVsM = (1./4.)*pow(-qc4VsM,-3./4.)*qc4ErrorVsM;} 
14378   if(qc6VsM>0.){v6ErrorVsM = (1./6.)*pow(2.,-1./3.)*pow(qc6VsM,-5./6.)*qc6ErrorVsM;}   
14379   if(qc8VsM<0.){v8ErrorVsM = (1./8.)*pow(33.,-1./8.)*pow(-qc8VsM,-7./8.)*qc8ErrorVsM;}                       
14380   // Store the results and statistical errors of integrated flow estimates:
14381   fIntFlowVsM[0]->SetBinContent(b,v2VsM);
14382   fIntFlowVsM[0]->SetBinError(b,v2ErrorVsM);
14383   fIntFlowVsM[1]->SetBinContent(b,v4VsM);
14384   fIntFlowVsM[1]->SetBinError(b,v4ErrorVsM);
14385   fIntFlowVsM[2]->SetBinContent(b,v6VsM);
14386   fIntFlowVsM[2]->SetBinError(b,v6ErrorVsM);
14387   fIntFlowVsM[3]->SetBinContent(b,v8VsM);
14388   fIntFlowVsM[3]->SetBinError(b,v8ErrorVsM);
14389  } // end of for(Int_t b=1;b<=nBins;b++)
14390  
14391  // 'Rebinned in M' calculation: // to be improved - this can be implemented better:   
14392  // Reference flow estimates:
14393  Double_t v2RebinnedInM = 0.; // v{2,QC}  
14394  Double_t v4RebinnedInM = 0.; // v{4,QC}  
14395  Double_t v6RebinnedInM = 0.; // v{6,QC}  
14396  Double_t v8RebinnedInM = 0.; // v{8,QC}
14397  // Reference flow's statistical errors:
14398  Double_t v2ErrorRebinnedInM = 0.; // v{2,QC} stat. error 
14399  Double_t v4ErrorRebinnedInM = 0.; // v{4,QC} stat. error
14400  Double_t v6ErrorRebinnedInM = 0.; // v{6,QC} stat. error
14401  Double_t v8ErrorRebinnedInM = 0.; // v{8,QC} stat. error
14402  // Q-cumulants:
14403  Double_t qc2RebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinContent(1); // QC{2}  
14404  Double_t qc4RebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinContent(2); // QC{4}  
14405  Double_t qc6RebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinContent(3); // QC{6}  
14406  Double_t qc8RebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinContent(4); // QC{8}
14407  // Q-cumulants's statistical errors: 
14408  Double_t qc2ErrorRebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinError(1); // QC{2} stat. error  
14409  Double_t qc4ErrorRebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinError(2); // QC{4} stat. error  
14410  Double_t qc6ErrorRebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinError(3); // QC{6} stat. error  
14411  Double_t qc8ErrorRebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinError(4); // QC{8} stat. error
14412  // Calculate reference flow estimates from Q-cumulants: 
14413  if(qc2RebinnedInM>=0.){v2RebinnedInM = pow(qc2RebinnedInM,0.5);} 
14414  if(qc4RebinnedInM<=0.){v4RebinnedInM = pow(-1.*qc4RebinnedInM,1./4.);} 
14415  if(qc6RebinnedInM>=0.){v6RebinnedInM = pow((1./4.)*qc6RebinnedInM,1./6.);}
14416  if(qc8RebinnedInM<=0.){v8RebinnedInM = pow((-1./33.)*qc8RebinnedInM,1./8.);}  
14417  // Calculate stat. error for reference flow estimates from stat. error of Q-cumulants: 
14418  if(qc2RebinnedInM>0.){v2ErrorRebinnedInM = (1./2.)*pow(qc2RebinnedInM,-0.5)*qc2ErrorRebinnedInM;} 
14419  if(qc4RebinnedInM<0.){v4ErrorRebinnedInM = (1./4.)*pow(-qc4RebinnedInM,-3./4.)*qc4ErrorRebinnedInM;} 
14420  if(qc6RebinnedInM>0.){v6ErrorRebinnedInM = (1./6.)*pow(2.,-1./3.)*pow(qc6RebinnedInM,-5./6.)*qc6ErrorRebinnedInM;}   
14421  if(qc8RebinnedInM<0.){v8ErrorRebinnedInM = (1./8.)*pow(33.,-1./8.)*pow(-qc8RebinnedInM,-7./8.)*qc8ErrorRebinnedInM;}   
14422  // Print warnings for the 'wrong sign' cumulants: 
14423  if(TMath::Abs(v2RebinnedInM) < 1.e-44)
14424  {
14425   cout<<" WARNING: Wrong sign QC{2} rebinned in M, couldn't calculate v{2,QC} !!!!"<<endl;
14426  }
14427  if(TMath::Abs(v4RebinnedInM) < 1.e-44)
14428  {
14429   cout<<" WARNING: Wrong sign QC{4} rebinned in M, couldn't calculate v{4,QC} !!!!"<<endl;
14430  }
14431  if(TMath::Abs(v6RebinnedInM) < 1.e-44)
14432  {
14433   cout<<" WARNING: Wrong sign QC{6} rebinned in M, couldn't calculate v{6,QC} !!!!"<<endl;
14434  }
14435  if(TMath::Abs(v8RebinnedInM) < 1.e-44)
14436  {
14437   cout<<" WARNING: Wrong sign QC{8} rebinned in M, couldn't calculate v{8,QC} !!!!"<<endl;
14438  }                       
14439  // Store the results and statistical errors of integrated flow estimates:
14440  fIntFlowRebinnedInM->SetBinContent(1,v2RebinnedInM);
14441  fIntFlowRebinnedInM->SetBinError(1,v2ErrorRebinnedInM);
14442  fIntFlowRebinnedInM->SetBinContent(2,v4RebinnedInM);
14443  fIntFlowRebinnedInM->SetBinError(2,v4ErrorRebinnedInM);
14444  fIntFlowRebinnedInM->SetBinContent(3,v6RebinnedInM);
14445  fIntFlowRebinnedInM->SetBinError(3,v6ErrorRebinnedInM);
14446  fIntFlowRebinnedInM->SetBinContent(4,v8RebinnedInM);
14447  fIntFlowRebinnedInM->SetBinError(4,v8ErrorRebinnedInM);    
14448   
14449 } // end of AliFlowAnalysisWithQCumulants::CalculateReferenceFlow()
14450
14451 //================================================================================================================================ 
14452
14453 void AliFlowAnalysisWithQCumulants::FillCommonHistResultsIntFlow()
14454 {
14455  // Fill in AliFlowCommonHistResults histograms relevant for reference flow.
14456  
14457  // There are two possibilities here:
14458  // a) Store minimum bias reference flow - use SetMinimumBiasReferenceFlow(kTRUE). This result is 
14459  //    biased by the interplay between nonflow correlations and multiplicity fluctuations and is 
14460  //    also stored in local histogram fIntFlow; 
14461  // b) Store reference flow obtained from flow analysis performed at fixed multiplicity and 
14462  //    rebinned only at the end of the day - use SetMinimumBiasReferenceFlow(kFALSE). This result
14463  //    is also stored in local histogram fIntFlowRebinnedInM.
14464  
14465  // Reference flow estimates:
14466  Double_t v[4] = {0.};
14467  // Statistical errors of reference flow estimates:
14468  Double_t vError[4] = {0.};
14469   
14470  for(Int_t b=0;b<4;b++)
14471  {
14472   if(fMinimumBiasReferenceFlow)
14473   { 
14474    v[b] = fIntFlow->GetBinContent(b+1);
14475    vError[b] = fIntFlow->GetBinError(b+1);
14476   } else
14477     {
14478      v[b] = fIntFlowRebinnedInM->GetBinContent(b+1);
14479      vError[b] = fIntFlowRebinnedInM->GetBinError(b+1);
14480     }
14481  } // end of for(Int_t b=0;b<4;b++)
14482   
14483  // Fill AliFlowCommonHistResults histogram:
14484  fCommonHistsResults2nd->FillIntegratedFlow(v[0],vError[0]); // to be improved (hardwired 2nd in the name)  
14485  fCommonHistsResults4th->FillIntegratedFlow(v[1],vError[1]); // to be improved (hardwired 4th in the name)
14486  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)) // to be improved (calculate also 6th and 8th order)
14487  {
14488   fCommonHistsResults6th->FillIntegratedFlow(v[2],vError[2]); // to be improved (hardwired 6th in the name)
14489   fCommonHistsResults8th->FillIntegratedFlow(v[3],vError[3]); // to be improved (hardwired 8th in the name) 
14490  }
14491  
14492 } // end of AliFlowAnalysisWithQCumulants::FillCommonHistResultsIntFlow()
14493
14494 //================================================================================================================================ 
14495
14496 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelationsUsingParticleWeights()
14497 {
14498  // Calculate all correlations needed for integrated flow using particle weights.
14499   
14500  // Remark 1: When particle weights are used the binning of fIntFlowCorrelationAllPro is organized as follows:
14501  //
14502  //  1st bin: <2>_{1n|1n} = two1n1nW1W1 = <w1 w2 cos(n*(phi1-phi2))>
14503  //  2nd bin: <2>_{2n|2n} = two2n2nW2W2 = <w1^2 w2^2 cos(2n*(phi1-phi2))>
14504  //  3rd bin: <2>_{3n|3n} = two3n3nW3W3 = <w1^3 w2^3 cos(3n*(phi1-phi2))> 
14505  //  4th bin: <2>_{4n|4n} = two4n4nW4W4 = <w1^4 w2^4 cos(4n*(phi1-phi2))>
14506  //  5th bin:           ----  EMPTY ----
14507  //  6th bin: <3>_{2n|1n,1n} = three2n1n1nW2W1W1 = <w1^2 w2 w3 cos(n*(2phi1-phi2-phi3))>
14508  //  7th bin: <3>_{3n|2n,1n} = ...
14509  //  8th bin: <3>_{4n|2n,2n} = ...
14510  //  9th bin: <3>_{4n|3n,1n} = ...
14511  // 10th bin:           ----  EMPTY ----
14512  // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1nW1W1W1W1 = <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))>
14513  // 12th bin: <4>_{2n,1n|2n,1n} = ...
14514  // 13th bin: <4>_{2n,2n|2n,2n} = ...
14515  // 14th bin: <4>_{3n|1n,1n,1n} = ... 
14516  // 15th bin: <4>_{3n,1n|3n,1n} = ...
14517  // 16th bin: <4>_{3n,1n|2n,2n} = ...
14518  // 17th bin: <4>_{4n|2n,1n,1n} = ... 
14519  // 18th bin:           ----  EMPTY ----
14520  // 19th bin: <5>_{2n|1n,1n,1n,1n} = ...
14521  // 20th bin: <5>_{2n,2n|2n,1n,1n} = ...
14522  // 21st bin: <5>_{3n,1n|2n,1n,1n} = ...
14523  // 22nd bin: <5>_{4n|1n,1n,1n,1n} = ...
14524  // 23rd bin:           ----  EMPTY ----
14525  // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = ...
14526  // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = ...
14527  // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = ...
14528  // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = ...
14529  // 28th bin:           ----  EMPTY ----
14530  // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = ...
14531  // 30th bin:           ----  EMPTY ----
14532  // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = ...
14533  
14534  // Remark 2: When particle weights are used there are some extra correlations. They are stored in 
14535  // fIntFlowExtraCorrelationsPro binning of which is organized as follows:
14536  
14537  // 1st bin: two1n1nW3W1 = <w1^3 w2 cos(n*(phi1-phi2))>
14538  // 2nd bin: two1n1nW1W1W2 = <w1 w2 w3^2 cos(n*(phi1-phi2))>  
14539  
14540  // multiplicity (number of particles used to determine the reaction plane)
14541  Double_t dMult = (*fSpk)(0,0);
14542  
14543  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
14544  Double_t dReQ1n1k = (*fReQ)(0,1);
14545  Double_t dReQ2n2k = (*fReQ)(1,2);
14546  Double_t dReQ3n3k = (*fReQ)(2,3);
14547  Double_t dReQ4n4k = (*fReQ)(3,4);
14548  Double_t dReQ1n3k = (*fReQ)(0,3);
14549  Double_t dImQ1n1k = (*fImQ)(0,1);
14550  Double_t dImQ2n2k = (*fImQ)(1,2);
14551  Double_t dImQ3n3k = (*fImQ)(2,3);
14552  Double_t dImQ4n4k = (*fImQ)(3,4);
14553  Double_t dImQ1n3k = (*fImQ)(0,3);
14554
14555  // dMs are variables introduced in order to simplify some Eqs. bellow:
14556  //..............................................................................................
14557  Double_t dM11 = (*fSpk)(1,1)-(*fSpk)(0,2); // dM11 = sum_{i,j=1,i!=j}^M w_i w_j
14558  Double_t dM22 = (*fSpk)(1,2)-(*fSpk)(0,4); // dM22 = sum_{i,j=1,i!=j}^M w_i^2 w_j^2
14559  Double_t dM33 = (*fSpk)(1,3)-(*fSpk)(0,6); // dM33 = sum_{i,j=1,i!=j}^M w_i^3 w_j^3
14560  Double_t dM44 = (*fSpk)(1,4)-(*fSpk)(0,8); // dM44 = sum_{i,j=1,i!=j}^M w_i^4 w_j^4
14561  Double_t dM31 = (*fSpk)(0,3)*(*fSpk)(0,1)-(*fSpk)(0,4); // dM31 = sum_{i,j=1,i!=j}^M w_i^3 w_j
14562  Double_t dM211 = (*fSpk)(0,2)*(*fSpk)(1,1)-2.*(*fSpk)(0,3)*(*fSpk)(0,1)
14563                 - (*fSpk)(1,2)+2.*(*fSpk)(0,4); // dM211 = sum_{i,j,k=1,i!=j!=k}^M w_i^2 w_j w_k
14564  Double_t dM1111 = (*fSpk)(3,1)-6.*(*fSpk)(0,2)*(*fSpk)(1,1)  
14565                  + 8.*(*fSpk)(0,3)*(*fSpk)(0,1)
14566                  + 3.*(*fSpk)(1,2)-6.*(*fSpk)(0,4); // dM1111 = sum_{i,j,k,l=1,i!=j!=k!=l}^M w_i w_j w_k w_l
14567  //..............................................................................................
14568
14569  // 2-particle correlations:
14570  Double_t two1n1nW1W1 = 0.; // <w1 w2 cos(n*(phi1-phi2))>
14571  Double_t two2n2nW2W2 = 0.; // <w1^2 w2^2 cos(2n*(phi1-phi2))>
14572  Double_t two3n3nW3W3 = 0.; // <w1^3 w2^3 cos(3n*(phi1-phi2))>
14573  Double_t two4n4nW4W4 = 0.; // <w1^4 w2^4 cos(4n*(phi1-phi2))>
14574  if(dMult>1) 
14575  { 
14576   if(dM11)
14577   {
14578    two1n1nW1W1 = (pow(dReQ1n1k,2)+pow(dImQ1n1k,2)-(*fSpk)(0,2))/dM11;    
14579    // average correlation <w1 w2 cos(n*(phi1-phi2))> for single event: 
14580    fIntFlowCorrelationsEBE->SetBinContent(1,two1n1nW1W1);
14581    fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(1,dM11);
14582    // average correlation <w1 w2 cos(n*(phi1-phi2))> for all events:
14583    fIntFlowCorrelationsPro->Fill(0.5,two1n1nW1W1,dM11);  
14584    // average squared correlation <w1 w2 cos(n*(phi1-phi2))> for all events:
14585    fIntFlowSquaredCorrelationsPro->Fill(0.5,two1n1nW1W1*two1n1nW1W1,dM11); 
14586    fIntFlowCorrelationsAllPro->Fill(0.5,two1n1nW1W1,dM11);   
14587   }
14588   if(dM22)
14589   {
14590    two2n2nW2W2 = (pow(dReQ2n2k,2)+pow(dImQ2n2k,2)-(*fSpk)(0,4))/dM22; 
14591    // ...
14592    // average correlation <w1^2 w2^2 cos(2n*(phi1-phi2))> for all events:
14593    fIntFlowCorrelationsAllPro->Fill(1.5,two2n2nW2W2,dM22);   
14594   }
14595   if(dM33)
14596   {
14597    two3n3nW3W3 = (pow(dReQ3n3k,2)+pow(dImQ3n3k,2)-(*fSpk)(0,6))/dM33;
14598    // ...
14599    // average correlation <w1^3 w2^3 cos(3n*(phi1-phi2))> for all events:
14600    fIntFlowCorrelationsAllPro->Fill(2.5,two3n3nW3W3,dM33);   
14601   }
14602   if(dM44)
14603   {
14604    two4n4nW4W4 = (pow(dReQ4n4k,2)+pow(dImQ4n4k,2)-(*fSpk)(0,8))/dM44; 
14605    // ...
14606    // average correlation <w1^4 w2^4 cos(4n*(phi1-phi2))> for all events:
14607    fIntFlowCorrelationsAllPro->Fill(3.5,two4n4nW4W4,dM44);      
14608   }
14609  } // end of if(dMult>1) 
14610
14611  // extra 2-particle correlations:
14612  Double_t two1n1nW3W1 = 0.; // <w1^3 w2 cos(n*(phi1-phi2))>
14613  Double_t two1n1nW1W1W2 = 0.; // <w1 w2 w3^2 cos(n*(phi1-phi2))> 
14614  if(dMult>1) 
14615  {    
14616   if(dM31)
14617   {
14618    two1n1nW3W1 = (dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k-(*fSpk)(0,4))/dM31; 
14619    fIntFlowExtraCorrelationsPro->Fill(0.5,two1n1nW3W1,dM31);  
14620   } 
14621   if(dM211)
14622   {
14623    two1n1nW1W1W2 = ((*fSpk)(0,2)*(pow(dReQ1n1k,2)+pow(dImQ1n1k,2)-(*fSpk)(0,2))
14624                  - 2.*(dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k
14625                  - (*fSpk)(0,4)))/dM211;
14626    fIntFlowExtraCorrelationsPro->Fill(1.5,two1n1nW1W1W2,dM211);  
14627   }  
14628  } // end of if(dMult>1)
14629  //..............................................................................................
14630  
14631  //..............................................................................................
14632  // 3-particle correlations:
14633  Double_t three2n1n1nW2W1W1 = 0.; // <w1^2 w2 w3 cos(n*(2phi1-phi2-phi3))>
14634  
14635  if(dMult>2) 
14636  { 
14637   if(dM211)
14638   {                                                       
14639    three2n1n1nW2W1W1 = (pow(dReQ1n1k,2.)*dReQ2n2k+2.*dReQ1n1k*dImQ1n1k*dImQ2n2k-pow(dImQ1n1k,2.)*dReQ2n2k
14640                      - 2.*(dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k)
14641                      - pow(dReQ2n2k,2)-pow(dImQ2n2k,2)
14642                      + 2.*(*fSpk)(0,4))/dM211;                                                                               
14643    fIntFlowCorrelationsAllPro->Fill(5.5,three2n1n1nW2W1W1,dM211);
14644   } 
14645  } // end of if(dMult>2) 
14646  //..............................................................................................
14647  
14648  //..............................................................................................
14649  // 4-particle correlations:
14650  Double_t four1n1n1n1nW1W1W1W1 = 0.; // <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))>
14651  if(dMult>3) 
14652  { 
14653   if(dM1111)
14654   {      
14655    four1n1n1n1nW1W1W1W1 = (pow(pow(dReQ1n1k,2.)+pow(dImQ1n1k,2.),2)
14656                         - 2.*(pow(dReQ1n1k,2.)*dReQ2n2k+2.*dReQ1n1k*dImQ1n1k*dImQ2n2k-pow(dImQ1n1k,2.)*dReQ2n2k)
14657                         + 8.*(dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k)
14658                         + (pow(dReQ2n2k,2)+pow(dImQ2n2k,2))
14659                         - 4.*(*fSpk)(0,2)*(pow(dReQ1n1k,2)+pow(dImQ1n1k,2))
14660                         - 6.*(*fSpk)(0,4)+2.*(*fSpk)(1,2))/dM1111;  
14661                           
14662    // average correlation <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))> for single event: 
14663    fIntFlowCorrelationsEBE->SetBinContent(2,four1n1n1n1nW1W1W1W1);
14664    fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(2,dM1111);
14665    // average correlation <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))> for all events:
14666    fIntFlowCorrelationsPro->Fill(1.5,four1n1n1n1nW1W1W1W1,dM1111);   
14667    // average squared correlation <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))> for all events:
14668    fIntFlowSquaredCorrelationsPro->Fill(1.5,four1n1n1n1nW1W1W1W1*four1n1n1n1nW1W1W1W1,dM1111);      
14669    fIntFlowCorrelationsAllPro->Fill(10.5,four1n1n1n1nW1W1W1W1,dM1111);   
14670   } 
14671  } // end of if(dMult>3) 
14672  //..............................................................................................
14673  
14674 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelationsUsingParticleWeights()
14675
14676 //=======================================================================================================================
14677
14678 void AliFlowAnalysisWithQCumulants::InitializeArraysForIntFlow()
14679 {
14680  // Initialize all arrays used to calculate integrated flow.
14681  
14682  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
14683  {
14684   fIntFlowCorrectionTermsForNUAEBE[sc] = NULL;
14685   fIntFlowEventWeightForCorrectionTermsForNUAEBE[sc] = NULL;
14686   fIntFlowCorrectionTermsForNUAPro[sc] = NULL;
14687   fIntFlowCorrectionTermsForNUAHist[sc] = NULL;
14688   for(Int_t ci=0;ci<4;ci++) // correction term index (to be improved - hardwired 4)
14689   {
14690    fIntFlowCorrectionTermsForNUAVsMPro[sc][ci] = NULL;
14691   }
14692   for(Int_t power=0;power<2;power++) // linear or quadratic 
14693   {
14694    fIntFlowSumOfEventWeightsNUA[sc][power] = NULL;
14695   }
14696  }
14697  for(Int_t power=0;power<2;power++) // linear or quadratic 
14698  {
14699   fIntFlowSumOfEventWeights[power] = NULL;    
14700  }
14701  for(Int_t i=0;i<4;i++) // print on the screen the final results (0=RF, 1=RP, 2=POI, 3=RF (rebbined in M))
14702  {
14703   fPrintFinalResults[i] = kTRUE;
14704  }
14705  for(Int_t ci=0;ci<4;ci++) // correlation index or cumulant order
14706  {
14707   fIntFlowCorrelationsVsMPro[ci] = NULL;
14708   fIntFlowSquaredCorrelationsVsMPro[ci] = NULL;
14709   fIntFlowCorrelationsVsMHist[ci] = NULL;
14710   fIntFlowQcumulantsVsM[ci] = NULL;
14711   fIntFlowVsM[ci] = NULL;
14712   fIntFlowDetectorBiasVsM[ci] = NULL;
14713   for(Int_t lc=0;lc<2;lc++)
14714   {
14715    fIntFlowSumOfEventWeightsVsM[ci][lc] = NULL;
14716   }
14717  } 
14718  for(Int_t pi=0;pi<6;pi++) // product or covariance index
14719  {
14720   fIntFlowProductOfCorrelationsVsMPro[pi] = NULL;
14721   fIntFlowCovariancesVsM[pi] = NULL;
14722   fIntFlowSumOfProductOfEventWeightsVsM[pi] = NULL;
14723  } 
14724  for(Int_t ci=0;ci<64;ci++) // correlation index for all correlations vs M profiles (to be improved - hardwired 64)
14725  {
14726   fIntFlowCorrelationsAllVsMPro[ci] = NULL;
14727  } 
14728
14729 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForIntFlow()
14730
14731 //=======================================================================================================================
14732
14733 void AliFlowAnalysisWithQCumulants::InitializeArraysForDiffFlow()
14734 {
14735  // Initialize all arrays needed to calculate differential flow.
14736  //  a) Initialize lists holding profiles;
14737  //  b) Initialize lists holding histograms;
14738  //  c) Initialize event-by-event quantities;
14739  //  d) Initialize profiles;
14740  //  e) Initialize histograms holding final results.
14741  
14742  // a) Initialize lists holding profiles;
14743  for(Int_t t=0;t<2;t++) // type (RP, POI)
14744  {
14745   for(Int_t pe=0;pe<2;pe++) // pt or eta
14746   {
14747    fDiffFlowCorrelationsProList[t][pe] = NULL;
14748    fDiffFlowProductOfCorrelationsProList[t][pe] = NULL;
14749    fDiffFlowCorrectionsProList[t][pe] = NULL;
14750   }
14751   // 2D:
14752   f2DDiffFlowCorrelationsProList[t] = NULL;
14753  }  
14754  
14755  // b) Initialize lists holding histograms;
14756  for(Int_t t=0;t<2;t++) // type (RP, POI)
14757  {
14758   for(Int_t pe=0;pe<2;pe++) // pt or eta
14759   {
14760    fDiffFlowCorrelationsHistList[t][pe] = NULL;
14761    for(Int_t power=0;power<2;power++)
14762    {
14763     fDiffFlowSumOfEventWeightsHistList[t][pe][power] = NULL;
14764    } // end of for(Int_t power=0;power<2;power++)  
14765    fDiffFlowSumOfProductOfEventWeightsHistList[t][pe] = NULL;
14766    fDiffFlowCorrectionsHistList[t][pe] = NULL;
14767    fDiffFlowCovariancesHistList[t][pe] = NULL;
14768    fDiffFlowCumulantsHistList[t][pe] = NULL;
14769    fDiffFlowDetectorBiasHistList[t][pe] = NULL;
14770    fDiffFlowHistList[t][pe] = NULL;
14771   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
14772  } // enf of for(Int_t t=0;t<2;t++) // type (RP, POI) 
14773  
14774  // c) Initialize event-by-event quantities:
14775  // 1D:
14776  for(Int_t t=0;t<3;t++) // type (RP, POI, POI&&RP)
14777  {
14778   for(Int_t pe=0;pe<2;pe++) // pt or eta
14779   { 
14780    for(Int_t m=0;m<4;m++) // multiple of harmonic
14781    {
14782     for(Int_t k=0;k<9;k++) // power of weight
14783     {
14784      fReRPQ1dEBE[t][pe][m][k] = NULL;
14785      fImRPQ1dEBE[t][pe][m][k] = NULL;
14786      fs1dEBE[t][pe][k] = NULL; // to be improved (this doesn't need to be within loop over m)
14787     }   
14788    }
14789   }
14790  }
14791  // 1D:
14792  for(Int_t t=0;t<2;t++) // type (RP or POI)
14793  {
14794   for(Int_t pe=0;pe<2;pe++) // pt or eta
14795   { 
14796    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
14797    {
14798     for(Int_t cti=0;cti<9;cti++) // correction term index
14799     {
14800      fDiffFlowCorrectionTermsForNUAEBE[t][pe][sc][cti] = NULL;
14801     }   
14802    }
14803   }
14804  }
14805  // 2D:  
14806  for(Int_t t=0;t<3;t++) // type (RP, POI, POI&&RP)
14807  {
14808   for(Int_t m=0;m<4;m++) // multiple of harmonic
14809   {
14810    for(Int_t k=0;k<9;k++) // power of weight
14811    {
14812     fReRPQ2dEBE[t][m][k] = NULL;
14813     fImRPQ2dEBE[t][m][k] = NULL;
14814     fs2dEBE[t][k] = NULL; // to be improved (this doesn't need to be within loop over m)
14815    }   
14816   }
14817  }
14818  
14819  // d) Initialize profiles:
14820  for(Int_t t=0;t<2;t++) // type: RP or POI
14821  { 
14822   for(Int_t pe=0;pe<2;pe++) // pt or eta
14823   {
14824    for(Int_t ci=0;ci<4;ci++) // correlation index
14825    {
14826     fDiffFlowCorrelationsPro[t][pe][ci] = NULL;
14827     fDiffFlowSquaredCorrelationsPro[t][pe][ci] = NULL;
14828    } // end of for(Int_t ci=0;ci<4;ci++)   
14829    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
14830    {
14831     for(Int_t mci2=0;mci2<8;mci2++) // mixed correlation index
14832     {
14833      fDiffFlowProductOfCorrelationsPro[t][pe][mci1][mci2] = NULL;
14834     } // end of for(Int_t mci2=0;mci2<8;mci2++) // mixed correlation index
14835    } // end of for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index  
14836    // correction terms for nua:
14837    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
14838    {
14839     for(Int_t cti=0;cti<9;cti++) // correction term index
14840     {
14841      fDiffFlowCorrectionTermsForNUAPro[t][pe][sc][cti] = NULL;
14842     }   
14843    }
14844    // other differential correlators:
14845    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
14846    {
14847     for(Int_t ci=0;ci<1;ci++) // correction term index
14848     {
14849      fOtherDiffCorrelators[t][pe][sc][ci] = NULL;
14850     }   
14851    }
14852   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
14853   for(Int_t ci=0;ci<4;ci++) // correlation index
14854   {
14855    f2DDiffFlowCorrelationsPro[t][ci] = NULL;
14856   }
14857  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
14858   
14859  // e) Initialize histograms holding final results.
14860  for(Int_t t=0;t<2;t++) // type: RP or POI
14861  { 
14862   for(Int_t pe=0;pe<2;pe++) // pt or eta
14863   {
14864    for(Int_t ci=0;ci<4;ci++) // correlation index
14865    {
14866     fDiffFlowCorrelationsHist[t][pe][ci] = NULL;
14867     fDiffFlowCumulants[t][pe][ci] = NULL;
14868     fDiffFlowDetectorBias[t][pe][ci] = NULL;
14869     fDiffFlow[t][pe][ci] = NULL;
14870    } // end of for(Int_t ci=0;ci<4;ci++)    
14871    for(Int_t covarianceIndex=0;covarianceIndex<5;covarianceIndex++) 
14872    {
14873     fDiffFlowCovariances[t][pe][covarianceIndex] = NULL;     
14874    } // end of for(Int_t covarianceIndex=0;covarianceIndex<5;covarianceIndex++) 
14875    // correction terms for nua:
14876    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
14877    {
14878     for(Int_t cti=0;cti<9;cti++) // correction term index
14879     {
14880      fDiffFlowCorrectionTermsForNUAHist[t][pe][sc][cti] = NULL;
14881     }   
14882    }
14883   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
14884   for(Int_t ci=0;ci<4;ci++) // correlation index
14885   {
14886    f2DDiffFlowCumulants[t][ci] = NULL;
14887    f2DDiffFlow[t][ci] = NULL;
14888   }
14889  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
14890  
14891  // sum of event weights for reduced correlations:
14892  for(Int_t t=0;t<2;t++) // type = RP or POI
14893  {
14894   for(Int_t pe=0;pe<2;pe++) // pt or eta
14895   {
14896    for(Int_t p=0;p<2;p++) // power of weight is 1 or 2
14897    {
14898     for(Int_t ew=0;ew<4;ew++) // event weight index for reduced correlations
14899     {
14900      fDiffFlowSumOfEventWeights[t][pe][p][ew] = NULL;
14901     } 
14902    }   
14903   }
14904  }
14905  // product of event weights for both types of correlations:
14906  for(Int_t t=0;t<2;t++) // type = RP or POI
14907  {
14908   for(Int_t pe=0;pe<2;pe++) // pt or eta
14909   {
14910    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
14911    {
14912     for(Int_t mci2=0;mci2<8;mci2++) // mixed correlation index
14913     {
14914      fDiffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2] = NULL;
14915     } 
14916    }   
14917   }
14918  }
14919     
14920 } // end of AliFlowAnalysisWithQCumulants::InitializeArraysForDiffFlow()
14921
14922 //=======================================================================================================================
14923
14924 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCumulants(TString type, TString ptOrEta)
14925 {
14926  // Calculate differential flow cumulants from measured multiparticle correlations.
14927  
14928  // REMARK: Cumulants calculated in this method are NOT corrected for non-uniform acceptance. 
14929  // This correction, if enabled via setter SetApplyCorrectionForNUA(Bool_t), is applied 
14930  // in the method CalculateDiffFlowCumulantsCorrectedForNUA(TString type, TString ptOrEta)
14931  
14932  Int_t t = 0;
14933  Int_t pe = 0;
14934
14935  if(type == "RP")
14936  {
14937   t = 0;
14938  } else if(type == "POI")
14939    {
14940     t = 1;
14941    } 
14942      
14943  if(ptOrEta == "Pt")
14944  {
14945   pe = 0;
14946  } else if(ptOrEta == "Eta")
14947    {
14948     pe = 1;
14949    } 
14950      
14951  // Common:
14952  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
14953  
14954  // Correlation <<2>>: 
14955  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1);
14956  Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1);
14957  
14958  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
14959  {
14960   // Reduced correlations:   
14961   Double_t twoPrime = fDiffFlowCorrelationsHist[t][pe][0]->GetBinContent(b); // <<2'>>
14962   Double_t twoPrimeError = fDiffFlowCorrelationsHist[t][pe][0]->GetBinError(b); // stat. error of <<2'>>
14963   Double_t fourPrime = fDiffFlowCorrelationsHist[t][pe][1]->GetBinContent(b); // <<4'>>
14964   Double_t fourPrimeError = fDiffFlowCorrelationsHist[t][pe][1]->GetBinError(b); // stat. error of <<4'>>
14965   // Covariances:
14966   Double_t wCovTwoTwoReduced = fDiffFlowCovariances[t][pe][0]->GetBinContent(b); // Cov(<2>,<2'>) * prefactor(<2>,<2'>)
14967   Double_t wCovTwoFourReduced = fDiffFlowCovariances[t][pe][1]->GetBinContent(b); // Cov(<2>,<4'>) * prefactor(<2>,<4'>)
14968   Double_t wCovTwoReducedFourReduced = fDiffFlowCovariances[t][pe][4]->GetBinContent(b); // Cov(<2'>,<4'>) * prefactor(<2'>,<4'>)
14969   // QC{2'}:
14970   Double_t qc2Prime = twoPrime; // QC{2'}
14971   Double_t qc2PrimeError = twoPrimeError; // stat. error of QC{2'}
14972   fDiffFlowCumulants[t][pe][0]->SetBinContent(b,qc2Prime); 
14973   fDiffFlowCumulants[t][pe][0]->SetBinError(b,qc2PrimeError); 
14974   // QC{4'}:
14975   Double_t qc4Prime = fourPrime - 2.*twoPrime*two; // QC{4'} = <<4'>> - 2*<<2'>><<2>>
14976   Double_t qc4PrimeError = 0.; // stat. error of QC{4'}
14977   Double_t qc4PrimeErrorSquared = 4.*pow(twoPrime,2.)*pow(twoError,2.)
14978                                 + 4.*pow(two,2.)*pow(twoPrimeError,2.)
14979                                 + pow(fourPrimeError,2.)
14980                                 + 8.*two*twoPrime*wCovTwoTwoReduced
14981                                 - 4.*twoPrime*wCovTwoFourReduced
14982                                 - 4.*two*wCovTwoReducedFourReduced;
14983   if(qc4PrimeErrorSquared>0.)
14984   {
14985    qc4PrimeError = pow(qc4PrimeErrorSquared,0.5);
14986   } 
14987   fDiffFlowCumulants[t][pe][1]->SetBinContent(b,qc4Prime); 
14988   fDiffFlowCumulants[t][pe][1]->SetBinError(b,qc4PrimeError); 
14989  } // end of for(Int_t p=1;p<=fnBinsPt;p++)
14990     
14991 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCumulants(TString type, Bool_t useParticleWeights, TString eventWeights); 
14992
14993 //=======================================================================================================================
14994
14995 void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlowCumulants(TString type)
14996 {
14997  // Calculate 2D differential cumulants.
14998  
14999  // Remark: correction for detector effects and error propagation not implemented yet for 2D differential cumulants.
15000  
15001  Int_t t = 0;
15002
15003  if(type == "RP")
15004  {
15005   t = 0;
15006  } else if(type == "POI")
15007    {
15008     t = 1;
15009    }
15010        
15011  // Reference correlation <<2>>: 
15012  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1);
15013  
15014  // Looping over all (pt,eta) bins and calculating differential flow cumulants: 
15015  for(Int_t p=1;p<=fnBinsPt;p++)
15016  {
15017   for(Int_t e=1;e<=fnBinsEta;e++)
15018   {
15019    // Reduced correlations:   
15020    Double_t twoPrime = f2DDiffFlowCorrelationsPro[t][0]->GetBinContent(f2DDiffFlowCorrelationsPro[t][0]->GetBin(p,e)); // <<2'>>(pt,eta)
15021    Double_t fourPrime = f2DDiffFlowCorrelationsPro[t][1]->GetBinContent(f2DDiffFlowCorrelationsPro[t][1]->GetBin(p,e)); // <<4'>>(pt,eta)
15022    // Cumulants:
15023    Double_t qc2Prime = twoPrime; // QC{2'} = <<2'>>   
15024    f2DDiffFlowCumulants[t][0]->SetBinContent(f2DDiffFlowCumulants[t][0]->GetBin(p,e),qc2Prime); 
15025    Double_t qc4Prime = fourPrime - 2.*twoPrime*two; // QC{4'} = <<4'>> - 2*<<2'>><<2>>
15026    f2DDiffFlowCumulants[t][1]->SetBinContent(f2DDiffFlowCumulants[t][1]->GetBin(p,e),qc4Prime); 
15027   } // end of for(Int_t e=1;e<=fnBinsEta;e++)
15028  } // end of for(Int_t p=1;p<=fnBinsPt;p++)
15029  
15030 } // end of void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlowCumulants(TString type)
15031
15032 //=======================================================================================================================
15033
15034 void AliFlowAnalysisWithQCumulants::CalculateFinalResultsForRPandPOIIntegratedFlow(TString type)
15035 {
15036  // Calculate final results for integrated flow of RPs and POIs. 
15037   
15038  // to be improved - check if the integrated flow calculation here is actually correct 
15039   
15040  Int_t t = 0; // RP = 0, POI = 1
15041
15042  if(type == "RP")
15043  {
15044   t = 0;
15045  } else if(type == "POI")
15046    {
15047     t = 1;
15048    }
15049      
15050  // pt yield:    
15051  TH1F *yield2ndPt = NULL;
15052  TH1F *yield4thPt = NULL;
15053  TH1F *yield6thPt = NULL;
15054  TH1F *yield8thPt = NULL;
15055  
15056  if(type == "POI")
15057  {
15058   if(fFillMultipleControlHistograms)
15059   {
15060    yield2ndPt = (TH1F*)(fCommonHists2nd->GetHistPtPOI())->Clone();
15061    yield4thPt = (TH1F*)(fCommonHists4th->GetHistPtPOI())->Clone();
15062    yield6thPt = (TH1F*)(fCommonHists6th->GetHistPtPOI())->Clone();
15063    yield8thPt = (TH1F*)(fCommonHists8th->GetHistPtPOI())->Clone();  
15064   } else
15065     {
15066      yield2ndPt = (TH1F*)(fCommonHists->GetHistPtPOI())->Clone();
15067      yield4thPt = (TH1F*)(fCommonHists->GetHistPtPOI())->Clone();
15068      yield6thPt = (TH1F*)(fCommonHists->GetHistPtPOI())->Clone();
15069      yield8thPt = (TH1F*)(fCommonHists->GetHistPtPOI())->Clone();     
15070     }
15071  } 
15072  else if(type == "RP")
15073  {
15074   if(fFillMultipleControlHistograms)
15075   {
15076    yield2ndPt = (TH1F*)(fCommonHists2nd->GetHistPtRP())->Clone();
15077    yield4thPt = (TH1F*)(fCommonHists4th->GetHistPtRP())->Clone();
15078    yield6thPt = (TH1F*)(fCommonHists6th->GetHistPtRP())->Clone();
15079    yield8thPt = (TH1F*)(fCommonHists8th->GetHistPtRP())->Clone();  
15080   } else
15081     {
15082      yield2ndPt = (TH1F*)(fCommonHists->GetHistPtRP())->Clone();
15083      yield4thPt = (TH1F*)(fCommonHists->GetHistPtRP())->Clone();
15084      yield6thPt = (TH1F*)(fCommonHists->GetHistPtRP())->Clone();
15085      yield8thPt = (TH1F*)(fCommonHists->GetHistPtRP())->Clone();    
15086     } 
15087  } 
15088  
15089  if(!yield2ndPt){return;}
15090  if(!yield4thPt){return;}
15091  if(!yield6thPt){return;}
15092  if(!yield8thPt){return;} 
15093
15094  Int_t nBinsPt = yield2ndPt->GetNbinsX();
15095  
15096  TH1D *flow2ndPt = NULL;
15097  TH1D *flow4thPt = NULL;
15098  TH1D *flow6thPt = NULL;
15099  TH1D *flow8thPt = NULL;
15100  
15101  // to be improved (hardwired pt index)
15102  flow2ndPt = (TH1D*)fDiffFlow[t][0][0]->Clone();
15103  flow4thPt = (TH1D*)fDiffFlow[t][0][1]->Clone();
15104  flow6thPt = (TH1D*)fDiffFlow[t][0][2]->Clone();
15105  flow8thPt = (TH1D*)fDiffFlow[t][0][3]->Clone(); 
15106
15107  if(!flow2ndPt){return;}
15108  if(!flow4thPt){return;}
15109  if(!flow6thPt){return;}
15110  if(!flow8thPt){return;} 
15111    
15112  Double_t dvn2nd = 0., dvn4th = 0., dvn6th = 0., dvn8th = 0.; // differential flow
15113  Double_t dErrvn2nd = 0., dErrvn4th = 0., dErrvn6th = 0., dErrvn8th = 0.; // error on differential flow
15114  
15115  Double_t dVn2nd = 0., dVn4th = 0., dVn6th = 0., dVn8th = 0.; // integrated flow 
15116  Double_t dErrVn2nd = 0., dErrVn4th = 0., dErrVn6th = 0., dErrVn8th = 0.; // error on integrated flow
15117
15118  Double_t dYield2nd = 0., dYield4th = 0., dYield6th = 0., dYield8th = 0.; // pt yield 
15119  Double_t dSum2nd = 0., dSum4th = 0., dSum6th = 0., dSum8th = 0.; // needed for normalizing integrated flow
15120  
15121  // looping over pt bins:
15122  for(Int_t p=1;p<nBinsPt+1;p++)
15123  {
15124   dvn2nd = flow2ndPt->GetBinContent(p);
15125   dvn4th = flow4thPt->GetBinContent(p);
15126   dvn6th = flow6thPt->GetBinContent(p);
15127   dvn8th = flow8thPt->GetBinContent(p);
15128   
15129   dErrvn2nd = flow2ndPt->GetBinError(p);
15130   dErrvn4th = flow4thPt->GetBinError(p);
15131   dErrvn6th = flow6thPt->GetBinError(p);
15132   dErrvn8th = flow8thPt->GetBinError(p);
15133
15134   dYield2nd = yield2ndPt->GetBinContent(p);  
15135   dYield4th = yield4thPt->GetBinContent(p);
15136   dYield6th = yield6thPt->GetBinContent(p);
15137   dYield8th = yield8thPt->GetBinContent(p);
15138   
15139   dVn2nd += dvn2nd*dYield2nd;
15140   dVn4th += dvn4th*dYield4th;
15141   dVn6th += dvn6th*dYield6th;
15142   dVn8th += dvn8th*dYield8th;
15143   
15144   dSum2nd += dYield2nd;
15145   dSum4th += dYield4th;
15146   dSum6th += dYield6th;
15147   dSum8th += dYield8th;
15148   
15149   dErrVn2nd += dYield2nd*dYield2nd*dErrvn2nd*dErrvn2nd; // ro be improved (check this relation)
15150   dErrVn4th += dYield4th*dYield4th*dErrvn4th*dErrvn4th;
15151   dErrVn6th += dYield6th*dYield6th*dErrvn6th*dErrvn6th;
15152   dErrVn8th += dYield8th*dYield8th*dErrvn8th*dErrvn8th;
15153     
15154  } // end of for(Int_t p=1;p<nBinsPt+1;p++)
15155
15156  // normalizing the results for integrated flow:
15157  if(dSum2nd) 
15158  {
15159   dVn2nd /= dSum2nd;
15160   dErrVn2nd /= (dSum2nd*dSum2nd);
15161   dErrVn2nd = TMath::Sqrt(dErrVn2nd);
15162  } 
15163  if(dSum4th) 
15164  {
15165   dVn4th /= dSum4th;
15166   dErrVn4th /= (dSum4th*dSum4th);
15167   dErrVn4th = TMath::Sqrt(dErrVn4th);
15168  } 
15169  //if(dSum6th) dVn6th/=dSum6th;
15170  //if(dSum8th) dVn8th/=dSum8th;
15171   
15172  // storing the results for integrated flow in common histos: (to be improved: new method for this?)
15173  if(type == "POI")
15174  {
15175   fCommonHistsResults2nd->FillIntegratedFlowPOI(dVn2nd,dErrVn2nd); 
15176   fCommonHistsResults4th->FillIntegratedFlowPOI(dVn4th,dErrVn4th); 
15177   fCommonHistsResults6th->FillIntegratedFlowPOI(dVn6th,0.); // to be improved (errors)
15178   fCommonHistsResults8th->FillIntegratedFlowPOI(dVn8th,0.); // to be improved (errors)
15179  }
15180  else if (type == "RP")
15181  {
15182   fCommonHistsResults2nd->FillIntegratedFlowRP(dVn2nd,dErrVn2nd); 
15183   fCommonHistsResults4th->FillIntegratedFlowRP(dVn4th,dErrVn4th);
15184   fCommonHistsResults6th->FillIntegratedFlowRP(dVn6th,0.); // to be improved (errors)
15185   fCommonHistsResults8th->FillIntegratedFlowRP(dVn8th,0.); // to be improved (errors)
15186  }
15187  
15188  delete flow2ndPt;
15189  delete flow4thPt;
15190  //delete flow6thPt;
15191  //delete flow8thPt;
15192  
15193  delete yield2ndPt;
15194  delete yield4thPt;
15195  delete yield6thPt;
15196  delete yield8thPt;
15197            
15198 } // end of AliFlowAnalysisWithQCumulants::CalculateFinalResultsForRPandPOIIntegratedFlow(TString type)
15199
15200 //=======================================================================================================================
15201
15202 void AliFlowAnalysisWithQCumulants::InitializeArraysForDistributions()
15203 {
15204  // Initialize all arrays used for distributions.
15205  
15206  // a) Initialize arrays of histograms used to hold distributions of correlations; 
15207  // b) Initialize array to hold min and max values of correlations.
15208  
15209  // a) Initialize arrays of histograms used to hold distributions of correlations:
15210  for(Int_t di=0;di<4;di++) // distribution index
15211  {
15212   fDistributions[di] = NULL;
15213  }
15214  
15215  // b) Initialize default min and max values of correlations:
15216  //    (Remark: The default values bellow were chosen for v2=5% and M=500)
15217  fMinValueOfCorrelation[0] = -0.01; // <2>_min 
15218  fMaxValueOfCorrelation[0] = 0.04; // <2>_max 
15219  fMinValueOfCorrelation[1] = -0.00002; // <4>_min 
15220  fMaxValueOfCorrelation[1] = 0.00015; // <4>_max  
15221  fMinValueOfCorrelation[2] = -0.0000003; // <6>_min 
15222  fMaxValueOfCorrelation[2] = 0.0000006; // <6>_max  
15223  fMinValueOfCorrelation[3] = -0.000000006; // <8>_min 
15224  fMaxValueOfCorrelation[3] = 0.000000003; // <8>_max 
15225  
15226 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForDistributions()
15227
15228 //=======================================================================================================================
15229
15230 void AliFlowAnalysisWithQCumulants::InitializeArraysForVarious()
15231 {
15232  // Initialize all arrays used for various unclassified objects.
15233  
15234  for(Int_t p=0;p<4;p++) // [v_min,v_max,refMult_min,refMult_max]
15235  {
15236   fPhiDistributionForOneEventSettings[p] = 0.;
15237  } 
15238    
15239 } //  end of void AliFlowAnalysisWithQCumulants::InitializeArraysForVarious()
15240
15241 //=======================================================================================================================
15242
15243 void AliFlowAnalysisWithQCumulants::BookEverythingForDistributions()
15244 {
15245  // a) Book profile to hold all flags for distributions of correlations;
15246  // b) Book all histograms to hold distributions of correlations.
15247  
15248  TString correlationIndex[4] = {"<2>","<4>","<6>","<8>"}; // to be improved (should I promote this to data members?)
15249   
15250  // a) Book profile to hold all flags for distributions of correlations:
15251  TString distributionsFlagsName = "fDistributionsFlags";
15252  distributionsFlagsName += fAnalysisLabel->Data();
15253  fDistributionsFlags = new TProfile(distributionsFlagsName.Data(),"Flags for Distributions of Correlations",9,0,9);
15254  fDistributionsFlags->SetTickLength(-0.01,"Y");
15255  fDistributionsFlags->SetMarkerStyle(25);
15256  fDistributionsFlags->SetLabelSize(0.05);
15257  fDistributionsFlags->SetLabelOffset(0.02,"Y");
15258  fDistributionsFlags->SetStats(kFALSE);
15259  fDistributionsFlags->GetXaxis()->SetBinLabel(1,"Store or not?");
15260  fDistributionsFlags->GetXaxis()->SetBinLabel(2,"<2>_{min}");
15261  fDistributionsFlags->GetXaxis()->SetBinLabel(3,"<2>_{max}");
15262  fDistributionsFlags->GetXaxis()->SetBinLabel(4,"<4>_{min}");
15263  fDistributionsFlags->GetXaxis()->SetBinLabel(5,"<4>_{max}");
15264  fDistributionsFlags->GetXaxis()->SetBinLabel(6,"<6>_{min}");
15265  fDistributionsFlags->GetXaxis()->SetBinLabel(7,"<6>_{max}");
15266  fDistributionsFlags->GetXaxis()->SetBinLabel(8,"<8>_{min}");
15267  fDistributionsFlags->GetXaxis()->SetBinLabel(9,"<8>_{max}");
15268  fDistributionsList->Add(fDistributionsFlags);
15269  
15270  // b) Book all histograms to hold distributions of correlations.
15271  if(fStoreDistributions)
15272  { 
15273   TString distributionsName = "fDistributions";
15274   distributionsName += fAnalysisLabel->Data();
15275   for(Int_t di=0;di<4;di++) // distribution index
15276   {
15277    fDistributions[di] = new TH1D(Form("Distribution of %s",correlationIndex[di].Data()),Form("Distribution of %s",correlationIndex[di].Data()),10000,fMinValueOfCorrelation[di],fMaxValueOfCorrelation[di]); 
15278    fDistributions[di]->SetXTitle(correlationIndex[di].Data());
15279    fDistributionsList->Add(fDistributions[di]);
15280   } // end of for(Int_t di=0;di<4;di++) // distribution index
15281  } // end of if(fStoreDistributions)
15282  
15283 } // end of void AliFlowAnalysisWithQCumulants::BookEverythingForDistributions()
15284
15285 //=======================================================================================================================
15286
15287 void AliFlowAnalysisWithQCumulants::BookEverythingForVarious()
15288 {
15289  // Book all objects for various unclassified quantities.
15290  
15291  if(!fStorePhiDistributionForOneEvent){return;}
15292  
15293  // a) Book histogram holding phi distribution for single event to illustrate flow.
15294  
15295  // a) Book histogram holding phi distribution for single event to illustrate flow:
15296  fPhiDistributionForOneEvent = new TH1D("fPhiDistributionForOneEvent","",360,0.,TMath::TwoPi());
15297  fPhiDistributionForOneEvent->GetXaxis()->SetTitle("#phi");
15298  fVariousList->Add(fPhiDistributionForOneEvent);
15299  
15300 } // end of void AliFlowAnalysisWithQCumulants::BookEverythingForVarious()
15301
15302 //=======================================================================================================================
15303
15304 void AliFlowAnalysisWithQCumulants::StoreFlagsForDistributions()
15305 {
15306  // Store all flags for distributiuons of correlations in profile fDistributionsFlags.
15307  
15308  if(!fDistributionsFlags)
15309  {
15310   cout<<"WARNING: fDistributionsFlags is NULL in AFAWQC::SDF() !!!!"<<endl;
15311   exit(0);
15312  } 
15313
15314  fDistributionsFlags->Fill(0.5,(Int_t)fStoreDistributions); // histos with distributions of correlations stored or not in the output file
15315  // store min and max values of correlations:
15316  for(Int_t di=0;di<4;di++) // distribution index
15317  {
15318   fDistributionsFlags->Fill(1.5+2.*(Double_t)di,fMinValueOfCorrelation[di]);
15319   fDistributionsFlags->Fill(2.5+2.*(Double_t)di,fMaxValueOfCorrelation[di]);
15320  }
15321      
15322 } // end of void AliFlowAnalysisWithQCumulants::StoreFlagsForDistributions()
15323
15324 //=======================================================================================================================
15325
15326 void AliFlowAnalysisWithQCumulants::StoreDistributionsOfCorrelations()
15327 {
15328  // Store distributions of correlations.
15329  
15330  if(!(fIntFlowCorrelationsEBE && fIntFlowEventWeightsForCorrelationsEBE))
15331  {
15332   cout<<"WARNING: fIntFlowCorrelationsEBE && fIntFlowEventWeightsForCorrelationsEBE"<<endl; 
15333   cout<<"         is NULL in AFAWQC::SDOC() !!!!"<<endl;
15334   exit(0);
15335  }
15336
15337  for(Int_t di=0;di<4;di++) // distribution index
15338  {
15339   if(!fDistributions[di])
15340   { 
15341    cout<<"WARNING: fDistributions[di] is NULL in AFAWQC::SDOC() !!!!"<<endl;
15342    cout<<"di = "<<di<<endl;
15343    exit(0);
15344   } else 
15345     {
15346      fDistributions[di]->Fill(fIntFlowCorrelationsEBE->GetBinContent(di+1),fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(di+1)); 
15347     } 
15348  } // end of for(Int_t di=0;di<4;di++) // distribution index
15349
15350 } // end of void AliFlowAnalysisWithQCumulants::StoreDistributionsOfCorrelations()
15351
15352 //=======================================================================================================================
15353
15354 void AliFlowAnalysisWithQCumulants::BookAndNestAllLists()
15355 {
15356  // Book and nest all lists nested in the base list fHistList.
15357  //  a) Book and nest lists for integrated flow;
15358  //  b) Book and nest lists for differential flow;
15359  //  c) Book and nest list for particle weights;
15360  //  d) Book and nest list for distributions;
15361  //  e) Book and nest list for various unclassified objects; 
15362  //  f) Book and nest list for other differential correlators;
15363  //  g) Book and nest list for nested loops;
15364  //  h) Book and nest lists for mixed harmonics;
15365  //  i) Book and nest lists for control histograms. 
15366  
15367  // a) Book and nest all lists for integrated flow:
15368  //  Base list for integrated flow:
15369  fIntFlowList = new TList();
15370  fIntFlowList->SetName("Integrated Flow");
15371  fIntFlowList->SetOwner(kTRUE);
15372  fHistList->Add(fIntFlowList);
15373  //  List holding profiles: 
15374  fIntFlowProfiles = new TList();
15375  fIntFlowProfiles->SetName("Profiles");
15376  fIntFlowProfiles->SetOwner(kTRUE);
15377  fIntFlowList->Add(fIntFlowProfiles);
15378  //  List holding all profiles with results for correlations vs M:
15379  if(fCalculateAllCorrelationsVsM)
15380  {
15381   fIntFlowAllCorrelationsVsM = new TList();
15382   fIntFlowAllCorrelationsVsM->SetName("Correlations vs M");
15383   fIntFlowAllCorrelationsVsM->SetOwner(kTRUE); 
15384   fIntFlowProfiles->Add(fIntFlowAllCorrelationsVsM);
15385  } // end of if(fCalculateAllCorrelationsVsM)
15386  //  List holding histograms with results:
15387  fIntFlowResults = new TList();
15388  fIntFlowResults->SetName("Results");
15389  fIntFlowResults->SetOwner(kTRUE);
15390  fIntFlowList->Add(fIntFlowResults);
15391  
15392  // b) Book and nest lists for differential flow:
15393  this->BookAndNestListsForDifferentialFlow();
15394  
15395  // c) Book and nest list for particle weights:
15396  fWeightsList->SetName("Weights");
15397  fWeightsList->SetOwner(kTRUE);   
15398  fHistList->Add(fWeightsList); 
15399
15400  // d) Book and nest list for distributions:
15401  fDistributionsList = new TList();
15402  fDistributionsList->SetName("Distributions");
15403  fDistributionsList->SetOwner(kTRUE);
15404  fHistList->Add(fDistributionsList);
15405  
15406  // e) Book and nest list for various unclassified objects:
15407  if(fStorePhiDistributionForOneEvent)
15408  {
15409   fVariousList = new TList();
15410   fVariousList->SetName("Various");
15411   fVariousList->SetOwner(kTRUE);
15412   fHistList->Add(fVariousList);
15413  }
15414   
15415  // f) Book and nest list for other differential correlators:
15416  fOtherDiffCorrelatorsList = new TList();
15417  fOtherDiffCorrelatorsList->SetName("Other differential correlators");
15418  fOtherDiffCorrelatorsList->SetOwner(kTRUE);
15419  if(fCalculateDiffFlow){fHistList->Add(fOtherDiffCorrelatorsList);} // TBI: Use another flag here instead of fCalculateDiffFlow 
15420   
15421  // g) Book and nest list for nested loops:
15422  fNestedLoopsList = new TList();
15423  fNestedLoopsList->SetName("Nested Loops");
15424  fNestedLoopsList->SetOwner(kTRUE);
15425  fHistList->Add(fNestedLoopsList);
15426
15427  // h) Book and nest lists for mixed harmonics:
15428  //  Base list for mixed harmonics:
15429  fMixedHarmonicsList = new TList();
15430  fMixedHarmonicsList->SetName("Mixed Harmonics");
15431  fMixedHarmonicsList->SetOwner(kTRUE);
15432  fHistList->Add(fMixedHarmonicsList);
15433  //  List holding profiles: 
15434  fMixedHarmonicsProfiles = new TList();
15435  fMixedHarmonicsProfiles->SetName("Profiles");
15436  fMixedHarmonicsProfiles->SetOwner(kTRUE);
15437  if(fCalculateMixedHarmonics){fMixedHarmonicsList->Add(fMixedHarmonicsProfiles);}
15438  //  List holding histograms with results:
15439  fMixedHarmonicsResults = new TList();
15440  fMixedHarmonicsResults->SetName("Results");
15441  fMixedHarmonicsResults->SetOwner(kTRUE);
15442  if(fCalculateMixedHarmonics){fMixedHarmonicsList->Add(fMixedHarmonicsResults);}
15443  //  List holding objects for statistical error propagation of mixed harmonics:
15444  fMixedHarmonicsErrorPropagation = new TList();
15445  fMixedHarmonicsErrorPropagation->SetName("Error Propagation");
15446  fMixedHarmonicsErrorPropagation->SetOwner(kTRUE);
15447  if(fCalculateMixedHarmonics){fMixedHarmonicsList->Add(fMixedHarmonicsErrorPropagation);}
15448
15449  // i) Book and nest lists for control histograms:
15450  //  Base list for mixed harmonics:
15451  fControlHistogramsList = new TList();
15452  fControlHistogramsList->SetName("Control Histograms");
15453  fControlHistogramsList->SetOwner(kTRUE);
15454  fHistList->Add(fControlHistogramsList);
15455
15456 } // end of void AliFlowAnalysisWithQCumulants::BookAndNestAllLists()
15457
15458 //=======================================================================================================================
15459
15460 void AliFlowAnalysisWithQCumulants::BookAndNestListsForDifferentialFlow()
15461 {
15462  // Book and nest lists for differential flow.
15463
15464  // Base list for differential flow objects:
15465  fDiffFlowList = new TList();
15466  fDiffFlowList->SetName("Differential Flow");
15467  fDiffFlowList->SetOwner(kTRUE); 
15468  fHistList->Add(fDiffFlowList);
15469  
15470  // Local flags: 
15471  TString typeFlag[2] = {"RP","POI"};  
15472  TString ptEtaFlag[2] = {"p_{T}","#eta"}; 
15473  TString powerFlag[2] = {"linear","quadratic"};   
15474
15475  // 2D:
15476  if(fCalculate2DDiffFlow)
15477  {
15478   fDiffFlow2D = new TList(); 
15479   fDiffFlow2D->SetName("2D");
15480   fDiffFlow2D->SetOwner(kTRUE);
15481   fDiffFlowList->Add(fDiffFlow2D); 
15482   for(Int_t t=0;t<2;t++)
15483   {
15484    f2DDiffFlowCorrelationsProList[t] = new TList();
15485    f2DDiffFlowCorrelationsProList[t]->SetOwner(kTRUE);
15486    f2DDiffFlowCorrelationsProList[t]->SetName(Form("Profiles with 2D correlations (%s)",typeFlag[t].Data()));
15487    fDiffFlow2D->Add(f2DDiffFlowCorrelationsProList[t]);
15488   } // end of for(Int_t t=0;t<2;t++)
15489  } // end of if(fCalculate2DDiffFlow)
15490
15491  // What follows bellow in this method is relevant only for 1D differential flow:
15492  if(!fCalculateDiffFlow){return;}
15493  
15494  // List holding profiles: 
15495  fDiffFlowProfiles = new TList(); 
15496  fDiffFlowProfiles->SetName("Profiles");
15497  fDiffFlowProfiles->SetOwner(kTRUE);
15498  fDiffFlowList->Add(fDiffFlowProfiles);
15499  // List holding histograms with results: 
15500  fDiffFlowResults = new TList();
15501  fDiffFlowResults->SetName("Results");
15502  fDiffFlowResults->SetOwner(kTRUE);
15503  fDiffFlowList->Add(fDiffFlowResults);
15504  // Flags used for naming nested lists in list fDiffFlowProfiles and fDiffFlowResults:  
15505  TList list;
15506  list.SetOwner(kTRUE);
15507  // Nested lists in fDiffFlowProfiles (~/Differential Flow/Profiles):
15508  for(Int_t t=0;t<2;t++) // type: RP or POI
15509  {
15510   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
15511   {
15512    // list holding profiles with correlations:
15513    fDiffFlowCorrelationsProList[t][pe] = (TList*)list.Clone();
15514    fDiffFlowCorrelationsProList[t][pe]->SetName(Form("Profiles with correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15515    fDiffFlowProfiles->Add(fDiffFlowCorrelationsProList[t][pe]);
15516    // list holding profiles with products of correlations:
15517    fDiffFlowProductOfCorrelationsProList[t][pe] = (TList*)list.Clone();
15518    fDiffFlowProductOfCorrelationsProList[t][pe]->SetName(Form("Profiles with products of correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15519    fDiffFlowProfiles->Add(fDiffFlowProductOfCorrelationsProList[t][pe]);
15520    // list holding profiles with corrections:
15521    fDiffFlowCorrectionsProList[t][pe] = (TList*)list.Clone();
15522    fDiffFlowCorrectionsProList[t][pe]->SetName(Form("Profiles with correction terms for NUA (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15523    fDiffFlowProfiles->Add(fDiffFlowCorrectionsProList[t][pe]);   
15524   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
15525  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI   
15526  // nested lists in fDiffFlowResults (~/Differential Flow/Results):
15527  for(Int_t t=0;t<2;t++) // type: RP or POI
15528  {
15529   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
15530   {
15531    // list holding histograms with correlations:
15532    fDiffFlowCorrelationsHistList[t][pe] = (TList*)list.Clone();
15533    fDiffFlowCorrelationsHistList[t][pe]->SetName(Form("Correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15534    fDiffFlowResults->Add(fDiffFlowCorrelationsHistList[t][pe]);
15535    // list holding histograms with corrections:
15536    fDiffFlowCorrectionsHistList[t][pe] = (TList*)list.Clone();
15537    fDiffFlowCorrectionsHistList[t][pe]->SetName(Form("Histograms with correction terms for NUA (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15538    fDiffFlowResults->Add(fDiffFlowCorrectionsHistList[t][pe]);   
15539    for(Int_t power=0;power<2;power++)
15540    {
15541     // list holding histograms with sums of event weights:
15542     fDiffFlowSumOfEventWeightsHistList[t][pe][power] = (TList*)list.Clone();
15543     fDiffFlowSumOfEventWeightsHistList[t][pe][power]->SetName(Form("Sum of %s event weights (%s, %s)",powerFlag[power].Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15544     fDiffFlowResults->Add(fDiffFlowSumOfEventWeightsHistList[t][pe][power]);    
15545    } // end of for(Int_t power=0;power<2;power++)
15546    // list holding histograms with sums of products of event weights:
15547    fDiffFlowSumOfProductOfEventWeightsHistList[t][pe] = (TList*)list.Clone();
15548    fDiffFlowSumOfProductOfEventWeightsHistList[t][pe]->SetName(Form("Sum of products of event weights (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15549    fDiffFlowResults->Add(fDiffFlowSumOfProductOfEventWeightsHistList[t][pe]);
15550    // list holding histograms with covariances of correlations:
15551    fDiffFlowCovariancesHistList[t][pe] = (TList*)list.Clone();
15552    fDiffFlowCovariancesHistList[t][pe]->SetName(Form("Covariances of correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15553    fDiffFlowResults->Add(fDiffFlowCovariancesHistList[t][pe]);
15554    // list holding histograms with differential Q-cumulants:
15555    fDiffFlowCumulantsHistList[t][pe] = (TList*)list.Clone();
15556    fDiffFlowCumulantsHistList[t][pe]->SetName(Form("Differential Q-cumulants (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15557    fDiffFlowResults->Add(fDiffFlowCumulantsHistList[t][pe]);   
15558    // list holding histograms which quantify detector bias to differential Q-cumulants:
15559    fDiffFlowDetectorBiasHistList[t][pe] = (TList*)list.Clone();
15560    fDiffFlowDetectorBiasHistList[t][pe]->SetName(Form("Detector bias (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15561    fDiffFlowResults->Add(fDiffFlowDetectorBiasHistList[t][pe]);   
15562    // list holding histograms with differential flow estimates from Q-cumulants:
15563    fDiffFlowHistList[t][pe] = (TList*)list.Clone();
15564    fDiffFlowHistList[t][pe]->SetName(Form("Differential flow (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15565    fDiffFlowResults->Add(fDiffFlowHistList[t][pe]);      
15566   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
15567  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
15568   
15569 } // end of void AliFlowAnalysisWithQCumulants::BookAndNestListsForDifferentialFlow()
15570
15571 //=======================================================================================================================
15572
15573 void AliFlowAnalysisWithQCumulants::FillCommonHistResultsDiffFlow(TString type)
15574 {
15575  // Fill common result histograms for differential flow.
15576  
15577  Int_t t = 0; 
15578
15579  if(type == "RP")
15580  {
15581   t = 0;
15582  } else if(type == "POI")
15583    {
15584     t = 1;
15585    } 
15586   
15587  // to be improved - check all pointers used in this method
15588      
15589  if(!(fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th))
15590  {
15591   cout<<"WARNING: fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th"<<endl; 
15592   cout<<"         is NULL in AFAWQC::FCHRIF() !!!!"<<endl;
15593   exit(0);
15594  }
15595  
15596  // pt:
15597  for(Int_t p=1;p<=fnBinsPt;p++)
15598  {
15599   Double_t v2 = fDiffFlow[t][0][0]->GetBinContent(p);
15600   Double_t v4 = fDiffFlow[t][0][1]->GetBinContent(p);
15601   Double_t v6 = fDiffFlow[t][0][2]->GetBinContent(p);
15602   Double_t v8 = fDiffFlow[t][0][3]->GetBinContent(p);
15603   
15604   Double_t v2Error = fDiffFlow[t][0][0]->GetBinError(p);
15605   Double_t v4Error = fDiffFlow[t][0][1]->GetBinError(p);
15606   //Double_t v6Error = fFinalFlow1D[t][pW][nua][0][2]->GetBinError(p);
15607   //Double_t v8Error = fFinalFlow1D[t][pW][nua][0][3]->GetBinError(p);
15608  
15609   if(type == "RP")
15610   {
15611    fCommonHistsResults2nd->FillDifferentialFlowPtRP(p,v2,v2Error);
15612    fCommonHistsResults4th->FillDifferentialFlowPtRP(p,v4,v4Error);
15613    fCommonHistsResults6th->FillDifferentialFlowPtRP(p,v6,0.);
15614    fCommonHistsResults8th->FillDifferentialFlowPtRP(p,v8,0.);
15615   } else if(type == "POI")
15616     {
15617      fCommonHistsResults2nd->FillDifferentialFlowPtPOI(p,v2,v2Error);
15618      fCommonHistsResults4th->FillDifferentialFlowPtPOI(p,v4,v4Error);
15619      fCommonHistsResults6th->FillDifferentialFlowPtPOI(p,v6,0.);
15620      fCommonHistsResults8th->FillDifferentialFlowPtPOI(p,v8,0.);
15621     }
15622  } // end of for(Int_t p=1;p<=fnBinsPt;p++)   
15623  
15624  // eta:
15625  if(!fCalculateDiffFlowVsEta){return;}
15626  for(Int_t e=1;e<=fnBinsEta;e++)
15627  {
15628   Double_t v2 = fDiffFlow[t][1][0]->GetBinContent(e);
15629   Double_t v4 = fDiffFlow[t][1][1]->GetBinContent(e);
15630   Double_t v6 = fDiffFlow[t][1][2]->GetBinContent(e);
15631   Double_t v8 = fDiffFlow[t][1][3]->GetBinContent(e);
15632   
15633   Double_t v2Error = fDiffFlow[t][1][0]->GetBinError(e);
15634   Double_t v4Error = fDiffFlow[t][1][1]->GetBinError(e);
15635   //Double_t v6Error = fDiffFlow[t][1][2]->GetBinError(e);
15636   //Double_t v8Error = fDiffFlow[t][1][3]->GetBinError(e);
15637  
15638   if(type == "RP")
15639   {
15640    fCommonHistsResults2nd->FillDifferentialFlowEtaRP(e,v2,v2Error);
15641    fCommonHistsResults4th->FillDifferentialFlowEtaRP(e,v4,v4Error);
15642    fCommonHistsResults6th->FillDifferentialFlowEtaRP(e,v6,0.);
15643    fCommonHistsResults8th->FillDifferentialFlowEtaRP(e,v8,0.);
15644   } else if(type == "POI")
15645     {
15646      fCommonHistsResults2nd->FillDifferentialFlowEtaPOI(e,v2,v2Error);
15647      fCommonHistsResults4th->FillDifferentialFlowEtaPOI(e,v4,v4Error);
15648      fCommonHistsResults6th->FillDifferentialFlowEtaPOI(e,v6,0.);
15649      fCommonHistsResults8th->FillDifferentialFlowEtaPOI(e,v8,0.);
15650     }
15651  } // end of for(Int_t e=1;e<=fnBinsEta;e++)    
15652  
15653 } // end of void AliFlowAnalysisWithQCumulants::FillCommonHistResultsDiffFlow(TString type, Bool_t useParticleWeights, TString eventWeights, Bool_t correctedForNUA)
15654
15655 //=======================================================================================================================
15656
15657 void AliFlowAnalysisWithQCumulants::CommonConstants(TString method)
15658 {
15659  // Access and store common constants.
15660  
15661  // a) If this method was called in Init() access common constants from AliFlowCommonConstants;
15662  // b) If this method was called in Init() book and fill TProfile to hold constants accessed in a);
15663  // c) If this method was called in Finish() access common constants from TProfile booked and filled in b).
15664
15665  if(method == "Init")
15666  {
15667   // a) If this method was called in Init() access common constants from AliFlowCommonConstants:
15668   fnBinsPhi = AliFlowCommonConstants::GetMaster()->GetNbinsPhi();
15669   fPhiMin = AliFlowCommonConstants::GetMaster()->GetPhiMin();        
15670   fPhiMax = AliFlowCommonConstants::GetMaster()->GetPhiMax();
15671   if(fnBinsPhi){fPhiBinWidth = (fPhiMax-fPhiMin)/fnBinsPhi;}  
15672   fnBinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
15673   fPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();          
15674   fPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
15675   if(fnBinsPt){fPtBinWidth = (fPtMax-fPtMin)/fnBinsPt;}  
15676   fnBinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
15677   fEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();        
15678   fEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();
15679   if(fnBinsEta){fEtaBinWidth = (fEtaMax-fEtaMin)/fnBinsEta;}  
15680   
15681   // b) If this method was called in Init() book and fill TProfile to hold constants accessed in a):
15682   TString fCommonConstantsName = "fCommonConstants";
15683   fCommonConstantsName += fAnalysisLabel->Data();
15684   fCommonConstants = new TProfile(fCommonConstantsName.Data(),"Common constants",9,0.,9.);
15685   fCommonConstants->SetLabelSize(0.05);
15686   fCommonConstants->GetXaxis()->SetBinLabel(1,"nBins (#phi)");
15687   fCommonConstants->Fill(0.5,fnBinsPhi);
15688   fCommonConstants->GetXaxis()->SetBinLabel(2,"#phi_{min}");
15689   fCommonConstants->Fill(1.5,fPhiMin);
15690   fCommonConstants->GetXaxis()->SetBinLabel(3,"#phi_{max}");
15691   fCommonConstants->Fill(2.5,fPhiMax);
15692   fCommonConstants->GetXaxis()->SetBinLabel(4,"nBins (p_{t})");
15693   fCommonConstants->Fill(3.5,fnBinsPt);
15694   fCommonConstants->GetXaxis()->SetBinLabel(5,"(p_{t})_{min}");
15695   fCommonConstants->Fill(4.5,fPtMin);
15696   fCommonConstants->GetXaxis()->SetBinLabel(6,"(p_{t})_{max}");
15697   fCommonConstants->Fill(5.5,fPtMax);
15698   fCommonConstants->GetXaxis()->SetBinLabel(7,"nBins (#eta)");
15699   fCommonConstants->Fill(6.5,fnBinsEta);
15700   fCommonConstants->GetXaxis()->SetBinLabel(8,"#eta_{min}");
15701   fCommonConstants->Fill(7.5,fEtaMin);
15702   fCommonConstants->GetXaxis()->SetBinLabel(9,"#eta_{max}");
15703   fCommonConstants->Fill(8.5,fEtaMax);
15704   fHistList->Add(fCommonConstants); 
15705  } // end of if(method == "Init")
15706  else if(method == "Finish")
15707  {
15708   // c) If this method was called in Finish() access common constants from TProfile booked and filled in b):
15709   if(!fCommonConstants)
15710   {
15711    printf("\n WARNING (QC): fCommonConstants is NULL in AFAWQC::AC(\"%s\") !!!!\n\n",method.Data());
15712    exit(0);
15713   } 
15714   fnBinsPhi = (Int_t)fCommonConstants->GetBinContent(1);
15715   fPhiMin = fCommonConstants->GetBinContent(2);      
15716   fPhiMax = fCommonConstants->GetBinContent(3);
15717   if(fnBinsPhi){fPhiBinWidth = (fPhiMax-fPhiMin)/fnBinsPhi;}  
15718   fnBinsPt = (Int_t)fCommonConstants->GetBinContent(4);
15719   fPtMin = fCommonConstants->GetBinContent(5);       
15720   fPtMax = fCommonConstants->GetBinContent(6);
15721   if(fnBinsPt){fPtBinWidth = (fPtMax-fPtMin)/fnBinsPt;}  
15722   fnBinsEta = (Int_t)fCommonConstants->GetBinContent(7);
15723   fEtaMin = fCommonConstants->GetBinContent(8);      
15724   fEtaMax = fCommonConstants->GetBinContent(9);
15725   if(fnBinsEta){fEtaBinWidth = (fEtaMax-fEtaMin)/fnBinsEta;}  
15726  } // end of else if(method == "Finish")
15727
15728 } // end of void AliFlowAnalysisWithQCumulants::CommonConstants(TString method)
15729
15730 //=======================================================================================================================
15731
15732 void AliFlowAnalysisWithQCumulants::CrossCheckSettings()
15733 {
15734  // a) Cross-check if the choice for multiplicity weights make sense;
15735  // b) Cross-check if the choice for multiplicity itself make sense.
15736
15737  // a) Cross-check if the choice for multiplicity weights make sense:
15738  if((!fMultiplicityWeight->Contains("combinations")) && 
15739     (!fMultiplicityWeight->Contains("unit")) &&
15740     (!fMultiplicityWeight->Contains("multiplicity")) )
15741  {
15742   cout<<"WARNING (QC): Multiplicity weight can be either \"combinations\", \"unit\""<<endl;
15743   cout<<"              or \"multiplicity\". Certainly not \""<<fMultiplicityWeight->Data()<<"\"."<<endl;
15744   exit(0);
15745  }   
15746
15747 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckSettings()
15748
15749 //=======================================================================================================================
15750
15751 void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfEventWeights()
15752 {
15753  // Calculate sum of linear and quadratic event weights for correlations.
15754  
15755  // TBI re-think what is the right multiplicity when particle weights are used! 
15756
15757  // Multiplicity bin of an event (relevant for all histos vs M): 
15758  Double_t dMultiplicityBin = 0.;
15759  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
15760  {
15761   dMultiplicityBin = fNumberOfRPsEBE+0.5;
15762  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
15763    {
15764     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
15765    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
15766      {
15767       dMultiplicityBin = fNumberOfPOIsEBE+0.5;
15768      }
15769                         
15770  for(Int_t p=0;p<2;p++) // power-1
15771  {
15772   for(Int_t ci=0;ci<4;ci++) // correlation index
15773   { 
15774    fIntFlowSumOfEventWeights[p]->Fill(ci+0.5,pow(fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci+1),p+1)); 
15775    if(fCalculateCumulantsVsM)
15776    {
15777     fIntFlowSumOfEventWeightsVsM[ci][p]->Fill(dMultiplicityBin,pow(fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci+1),p+1)); // to be improved: dMult => sum of weights?
15778    }
15779   }
15780  }
15781   
15782 } // end of void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfEventWeights()
15783
15784 //=======================================================================================================================
15785
15786 void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfEventWeightsNUA()
15787 {
15788  // Calculate sum of linear and quadratic event weights for NUA terms.
15789                        
15790  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
15791  {
15792   for(Int_t p=0;p<2;p++) // power-1
15793   {
15794    for(Int_t ci=0;ci<4;ci++) // nua term index
15795    { 
15796     fIntFlowSumOfEventWeightsNUA[sc][p]->Fill(ci+0.5,pow(fIntFlowEventWeightForCorrectionTermsForNUAEBE[sc]->GetBinContent(ci+1),p+1)); 
15797    }
15798   }
15799  }
15800   
15801 } // end of void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfEventWeightsNUA()
15802
15803 //=======================================================================================================================
15804
15805 void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfProductOfEventWeights()
15806 {
15807  // Calculate sum of product of event weights for correlations.
15808   
15809  // TBI re-think what is the right multiplicity when particle weights are used!
15810
15811  // Multiplicity bin of an event (relevant for all histos vs M): 
15812  Double_t dMultiplicityBin = 0.;
15813  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
15814  {
15815   dMultiplicityBin = fNumberOfRPsEBE+0.5;
15816  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
15817    {
15818     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
15819    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
15820      {
15821       dMultiplicityBin = fNumberOfPOIsEBE+0.5;
15822      }
15823   
15824  Int_t counter = 0;
15825  
15826  for(Int_t ci1=1;ci1<4;ci1++)
15827  {
15828   for(Int_t ci2=ci1+1;ci2<=4;ci2++)
15829   {
15830    fIntFlowSumOfProductOfEventWeights->Fill(0.5+counter,
15831                                             fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci1)*
15832                                             fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci2));
15833    if(fCalculateCumulantsVsM)
15834    {                                                                                    
15835     fIntFlowSumOfProductOfEventWeightsVsM[counter]->Fill(dMultiplicityBin, // to be improved: dMult => sum of weights?
15836                                                          fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci1)*
15837                                                          fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci2));
15838    } // end of if(fCalculateCumulantsVsM)
15839    counter++;                                         
15840   }
15841  }
15842
15843 } // end of void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfProductOfEventWeights()
15844
15845 //=======================================================================================================================
15846
15847 void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfProductOfEventWeightsNUA()
15848 {
15849  // Calculate sum of product of event weights for NUA terms.
15850   
15851  // w_{<2>} * w_{<cos(#phi)>}:
15852  fIntFlowSumOfProductOfEventWeightsNUA->Fill(0.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
15853                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1));
15854  // w_{<2>} * w_{<sin(#phi)>}:
15855  fIntFlowSumOfProductOfEventWeightsNUA->Fill(1.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
15856                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
15857  // w_{<cos(#phi)> * w_{<sin(#phi)>}:
15858  fIntFlowSumOfProductOfEventWeightsNUA->Fill(2.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
15859                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
15860  // w_{<2>} * w{<cos(phi1+phi2)>}
15861  fIntFlowSumOfProductOfEventWeightsNUA->Fill(3.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
15862                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
15863  // w_{<2>} * w{<sin(phi1+phi2)>}
15864  fIntFlowSumOfProductOfEventWeightsNUA->Fill(4.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
15865                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));
15866  // w_{<2>} * w{<cos(phi1-phi2-phi3)>}
15867  fIntFlowSumOfProductOfEventWeightsNUA->Fill(5.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
15868                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));
15869  // w_{<2>} * w{<sin(phi1-phi2-phi3)>}
15870  fIntFlowSumOfProductOfEventWeightsNUA->Fill(6.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
15871                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));  
15872  // w_{<4>} * w{<cos(phi1)>}
15873  fIntFlowSumOfProductOfEventWeightsNUA->Fill(7.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
15874                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1));
15875  // w_{<4>} * w{<sin(phi1)>}
15876  fIntFlowSumOfProductOfEventWeightsNUA->Fill(8.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
15877                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
15878  // w_{<4>} * w{<cos(phi1+phi2)>}
15879  fIntFlowSumOfProductOfEventWeightsNUA->Fill(9.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
15880                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
15881  // w_{<4>} * w{<sin(phi1+phi2)>}
15882  fIntFlowSumOfProductOfEventWeightsNUA->Fill(10.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
15883                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));
15884  // w_{<4>} * w{<cos(phi1-phi2-phi3)>}
15885  fIntFlowSumOfProductOfEventWeightsNUA->Fill(11.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
15886                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));
15887  // w_{<4>} * w{<sin(phi1-phi2-phi3)>}
15888  fIntFlowSumOfProductOfEventWeightsNUA->Fill(12.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
15889                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));
15890  // w_{<cos(phi1)>} * w{<cos(phi1+phi2)>}
15891  fIntFlowSumOfProductOfEventWeightsNUA->Fill(13.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
15892                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2));
15893  // w_{<cos(phi1)>} * w{<sin(phi1+phi2)>}
15894  fIntFlowSumOfProductOfEventWeightsNUA->Fill(14.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
15895                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
15896  // w_{<cos(phi1)>} * w{<cos(phi1-phi2-phi3)>}
15897  fIntFlowSumOfProductOfEventWeightsNUA->Fill(15.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
15898                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));
15899  // w_{<cos(phi1)>} * w{<sin(phi1-phi2-phi3)>}
15900  fIntFlowSumOfProductOfEventWeightsNUA->Fill(16.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
15901                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));
15902  // w_{<sin(phi1)>} * w{<cos(phi1+phi2)>}
15903  fIntFlowSumOfProductOfEventWeightsNUA->Fill(17.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)*
15904                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2));
15905  // w_{<sin(phi1)>} * w{<sin(phi1+phi2)>}
15906  fIntFlowSumOfProductOfEventWeightsNUA->Fill(18.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)*
15907                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));
15908  // w_{<sin(phi1)>} * w{<cos(phi1-phi2-phi3)>}
15909  fIntFlowSumOfProductOfEventWeightsNUA->Fill(19.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)*
15910                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));
15911  // w_{<sin(phi1)>} * w{<sin(phi1-phi2-phi3)>}
15912  fIntFlowSumOfProductOfEventWeightsNUA->Fill(20.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)*
15913                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
15914  // w_{<cos(phi1+phi2)>} * w{<sin(phi1+phi2))>}
15915  fIntFlowSumOfProductOfEventWeightsNUA->Fill(21.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)*
15916                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
15917  // w_{<cos(phi1+phi2)>} * w{<cos(phi1-phi2-phi3)>}
15918  fIntFlowSumOfProductOfEventWeightsNUA->Fill(22.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)*
15919                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
15920  // w_{<cos(phi1+phi2)>} * w{<sin(phi1-phi2-phi3)>}
15921  fIntFlowSumOfProductOfEventWeightsNUA->Fill(23.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)*
15922                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
15923  // w_{<sin(phi1+phi2)>} * w{<cos(phi1-phi2-phi3)>}
15924  fIntFlowSumOfProductOfEventWeightsNUA->Fill(24.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)*
15925                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
15926  // w_{<sin(phi1+phi2)>} * w{<sin(phi1-phi2-phi3)>}
15927  fIntFlowSumOfProductOfEventWeightsNUA->Fill(25.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)*
15928                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
15929  // w_{<cos(phi1-phi2-phi3)>} * w{<sin(phi1-phi2-phi3)>}
15930  fIntFlowSumOfProductOfEventWeightsNUA->Fill(26.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)*
15931                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));
15932
15933 } // end of void AliFlowAnalysisWithQCumulants::CalculateIntFlowIntFlowSumOfProductOfEventWeightsNUA()
15934
15935 //=======================================================================================================================
15936
15937 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrelations(TString type, TString ptOrEta)
15938 {
15939  // Calculate reduced correlations for RPs or POIs for all pt and eta bins.
15940
15941  // Multiplicity:
15942  Double_t dMult = (*fSpk)(0,0);
15943  
15944  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
15945  Double_t dReQ1n = (*fReQ)(0,0);
15946  Double_t dReQ2n = (*fReQ)(1,0);
15947  //Double_t dReQ3n = (*fReQ)(2,0);
15948  //Double_t dReQ4n = (*fReQ)(3,0);
15949  Double_t dImQ1n = (*fImQ)(0,0);
15950  Double_t dImQ2n = (*fImQ)(1,0);
15951  //Double_t dImQ3n = (*fImQ)(2,0);
15952  //Double_t dImQ4n = (*fImQ)(3,0);
15953
15954  // reduced correlations are stored in fDiffFlowCorrelationsPro[0=RP,1=POI][0=pt,1=eta][correlation index]. Correlation index runs as follows:
15955  // 
15956  // 0: <<2'>>
15957  // 1: <<4'>>
15958  // 2: <<6'>>
15959  // 3: <<8'>>
15960  
15961  //Int_t t = 0; // type flag 
15962  Int_t pe = 0; // ptEta flag
15963  
15964  if(type == "RP")
15965  {
15966   //t = 0;
15967  } else if(type == "POI")
15968    {
15969     //t = 1;
15970    }
15971
15972  if(ptOrEta == "Pt")
15973  {
15974   pe = 0;
15975  } else if(ptOrEta == "Eta")
15976    {
15977     pe = 1;
15978    }
15979     
15980  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
15981  Double_t minPtEta[2] = {fPtMin,fEtaMin};
15982  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
15983  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
15984
15985  // looping over all bins and calculating reduced correlations: 
15986  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
15987  {
15988   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
15989   Double_t p1n0kRe = 0.;
15990   Double_t p1n0kIm = 0.;
15991
15992   // number of POIs in particular pt or eta bin:
15993   Double_t mp = 0.;
15994
15995   // real and imaginary parts of q_{m*n,0} (non-weighted Q-vector evaluated for particles which are both RPs and POIs in particular pt or eta bin):
15996   Double_t q1n0kRe = 0.;
15997   Double_t q1n0kIm = 0.;
15998   Double_t q2n0kRe = 0.;
15999   Double_t q2n0kIm = 0.;
16000
16001   // number of particles which are both RPs and POIs in particular pt or eta bin:
16002   Double_t mq = 0.;
16003    
16004   if(type == "POI")
16005   {
16006    // q_{m*n,0}:
16007    q1n0kRe = fReRPQ1dEBE[2][pe][0][0]->GetBinContent(fReRPQ1dEBE[2][pe][0][0]->GetBin(b))
16008            * fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b));
16009    q1n0kIm = fImRPQ1dEBE[2][pe][0][0]->GetBinContent(fImRPQ1dEBE[2][pe][0][0]->GetBin(b))
16010            * fImRPQ1dEBE[2][pe][0][0]->GetBinEntries(fImRPQ1dEBE[2][pe][0][0]->GetBin(b));
16011    q2n0kRe = fReRPQ1dEBE[2][pe][1][0]->GetBinContent(fReRPQ1dEBE[2][pe][1][0]->GetBin(b))
16012            * fReRPQ1dEBE[2][pe][1][0]->GetBinEntries(fReRPQ1dEBE[2][pe][1][0]->GetBin(b));
16013    q2n0kIm = fImRPQ1dEBE[2][pe][1][0]->GetBinContent(fImRPQ1dEBE[2][pe][1][0]->GetBin(b))
16014            * fImRPQ1dEBE[2][pe][1][0]->GetBinEntries(fImRPQ1dEBE[2][pe][1][0]->GetBin(b));         
16015                  
16016    mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
16017   } 
16018   else if(type == "RP")
16019   {
16020    // q_{m*n,0}:
16021    q1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
16022            * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
16023    q1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))
16024            * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
16025    q2n0kRe = fReRPQ1dEBE[0][pe][1][0]->GetBinContent(fReRPQ1dEBE[0][pe][1][0]->GetBin(b))
16026            * fReRPQ1dEBE[0][pe][1][0]->GetBinEntries(fReRPQ1dEBE[0][pe][1][0]->GetBin(b));
16027    q2n0kIm = fImRPQ1dEBE[0][pe][1][0]->GetBinContent(fImRPQ1dEBE[0][pe][1][0]->GetBin(b))
16028            * fImRPQ1dEBE[0][pe][1][0]->GetBinEntries(fImRPQ1dEBE[0][pe][1][0]->GetBin(b));         
16029                  
16030    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)  
16031   }
16032       
16033    if(type == "POI")
16034    {
16035     // p_{m*n,0}:
16036     p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
16037             * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
16038     p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
16039             * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
16040             
16041     mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
16042     
16043     //t = 1; // typeFlag = RP or POI
16044    }
16045    else if(type == "RP")
16046    {
16047     // p_{m*n,0} = q_{m*n,0}:
16048     p1n0kRe = q1n0kRe; 
16049     p1n0kIm = q1n0kIm; 
16050             
16051     mp = mq; 
16052     
16053     //t = 0; // typeFlag = RP or POI
16054    }
16055       
16056    // 2'-particle correlation for particular pt or eta bin:
16057    Double_t two1n1nPtEta = 0.;
16058    Double_t mWeight2pPrime = 0.; // multiplicity weight for <2'>
16059    if(mp*dMult-mq)
16060    {
16061     two1n1nPtEta = (p1n0kRe*dReQ1n+p1n0kIm*dImQ1n-mq)
16062                  / (mp*dMult-mq);
16063     // determine multiplicity weight:
16064     if(fMultiplicityWeight->Contains("combinations"))
16065     {
16066      mWeight2pPrime = mp*dMult-mq;
16067     } else if(fMultiplicityWeight->Contains("unit"))
16068       {
16069        mWeight2pPrime = 1.;    
16070       } 
16071     if(type == "POI") // to be improved (I do not this if)
16072     { 
16073      // fill profile to get <<2'>> for POIs
16074      fDiffFlowCorrelationsPro[1][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nPtEta,mWeight2pPrime);
16075      // fill profile to get <<2'>^2> for POIs
16076      fDiffFlowSquaredCorrelationsPro[1][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nPtEta*two1n1nPtEta,mWeight2pPrime);   
16077      // histogram to store <2'> for POIs e-b-e (needed in some other methods):
16078      fDiffFlowCorrelationsEBE[1][pe][0]->SetBinContent(b,two1n1nPtEta);      
16079      fDiffFlowEventWeightsForCorrelationsEBE[1][pe][0]->SetBinContent(b,mWeight2pPrime);      
16080     }
16081     else if(type == "RP") // to be improved (I do not this if)
16082     {
16083      // profile to get <<2'>> for RPs:
16084      fDiffFlowCorrelationsPro[0][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nPtEta,mWeight2pPrime);     
16085      // profile to get <<2'>^2> for RPs:
16086      fDiffFlowSquaredCorrelationsPro[0][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nPtEta*two1n1nPtEta,mWeight2pPrime);          
16087      // histogram to store <2'> for RPs e-b-e (needed in some other methods):
16088      fDiffFlowCorrelationsEBE[0][pe][0]->SetBinContent(b,two1n1nPtEta); 
16089      fDiffFlowEventWeightsForCorrelationsEBE[0][pe][0]->SetBinContent(b,mWeight2pPrime); 
16090     }
16091    } // end of if(mp*dMult-mq)
16092   
16093    // 4'-particle correlation:
16094    Double_t four1n1n1n1nPtEta = 0.;
16095    Double_t mWeight4pPrime = 0.; // multiplicity weight for <4'>
16096    if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16097        + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)) // to be improved (introduce a new variable for this expression)
16098    {
16099     four1n1n1n1nPtEta = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)
16100                       - q2n0kRe*(pow(dReQ1n,2.)-pow(dImQ1n,2.))
16101                       - 2.*q2n0kIm*dReQ1n*dImQ1n
16102                       - p1n0kRe*(dReQ1n*dReQ2n+dImQ1n*dImQ2n)
16103                       + p1n0kIm*(dImQ1n*dReQ2n-dReQ1n*dImQ2n)
16104                       - 2.*dMult*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)
16105                       - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*mq                      
16106                       + 6.*(q1n0kRe*dReQ1n+q1n0kIm*dImQ1n)                                            
16107                       + 1.*(q2n0kRe*dReQ2n+q2n0kIm*dImQ2n)                      
16108                       + 2.*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)                       
16109                       + 2.*mq*dMult                      
16110                       - 6.*mq)        
16111                       / ((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16112                           + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
16113     // determine multiplicity weight:
16114     if(fMultiplicityWeight->Contains("combinations"))
16115     {
16116      mWeight4pPrime = (mp-mq)*dMult*(dMult-1.)*(dMult-2.) + mq*(dMult-1.)*(dMult-2.)*(dMult-3.);
16117     } else if(fMultiplicityWeight->Contains("unit"))
16118       {
16119        mWeight4pPrime = 1.;    
16120       }     
16121     if(type == "POI")
16122     {
16123      // profile to get <<4'>> for POIs:
16124      fDiffFlowCorrelationsPro[1][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nPtEta,mWeight4pPrime);      
16125      // profile to get <<4'>^2> for POIs:
16126      fDiffFlowSquaredCorrelationsPro[1][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nPtEta*four1n1n1n1nPtEta,mWeight4pPrime); 
16127      // histogram to store <4'> for POIs e-b-e (needed in some other methods):
16128      fDiffFlowCorrelationsEBE[1][pe][1]->SetBinContent(b,four1n1n1n1nPtEta);                               
16129      fDiffFlowEventWeightsForCorrelationsEBE[1][pe][1]->SetBinContent(b,mWeight4pPrime);                               
16130     }
16131     else if(type == "RP")
16132     {
16133      // profile to get <<4'>> for RPs:
16134      fDiffFlowCorrelationsPro[0][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nPtEta,mWeight4pPrime);    
16135      // profile to get <<4'>^2> for RPs:
16136      fDiffFlowSquaredCorrelationsPro[0][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nPtEta*four1n1n1n1nPtEta,mWeight4pPrime);    
16137      // histogram to store <4'> for RPs e-b-e (needed in some other methods):
16138      fDiffFlowCorrelationsEBE[0][pe][1]->SetBinContent(b,four1n1n1n1nPtEta);                   
16139      fDiffFlowEventWeightsForCorrelationsEBE[0][pe][1]->SetBinContent(b,mWeight4pPrime);                   
16140     }
16141    } // end of if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16142      //            +mq*(dMult-1.)*(dMult-2.)*(dMult-3.))
16143    
16144  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16145  
16146    
16147 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrelations(TString type, TString ptOrEta);
16148
16149 //=======================================================================================================================
16150
16151 void AliFlowAnalysisWithQCumulants::CalculateOtherDiffCorrelators(TString type, TString ptOrEta)
16152 {
16153  // Calculate other differential correlators for RPs or POIs for all pt and eta bins.
16154  
16155  // Multiplicity:
16156  Double_t dMult = (*fSpk)(0,0);
16157  
16158  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
16159  Double_t dReQ1n = (*fReQ)(0,0);
16160  Double_t dReQ2n = (*fReQ)(1,0);
16161  Double_t dReQ3n = (*fReQ)(2,0);
16162  //Double_t dReQ4n = (*fReQ)(3,0);
16163  Double_t dImQ1n = (*fImQ)(0,0);
16164  Double_t dImQ2n = (*fImQ)(1,0);
16165  Double_t dImQ3n = (*fImQ)(2,0);
16166  //Double_t dImQ4n = (*fImQ)(3,0);
16167
16168  // Other correlations are stored in fOtherDiffCorrelators[2][2][2][1], [0=RP,1=POI][0=pt,1=eta][0=sin terms,1=cos terms][correlator index]
16169  // Correlation index runs as follows:
16170  // 
16171  //  0: <exp[in(psi1-3phi2+2phi3)]>
16172  
16173  Int_t t = 0; // type flag 
16174  Int_t pe = 0; // ptEta flag
16175  
16176  if(type == "RP")
16177  {
16178   t = 0;
16179  } else if(type == "POI")
16180    {
16181     t = 1;
16182    }
16183
16184  if(ptOrEta == "Pt")
16185  {
16186   pe = 0;
16187  } else if(ptOrEta == "Eta")
16188    {
16189     pe = 1;
16190    }
16191     
16192  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
16193  Double_t minPtEta[2] = {fPtMin,fEtaMin};
16194  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
16195  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
16196
16197  // looping over all bins and calculating reduced correlations: 
16198  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16199  {
16200   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
16201   Double_t p1n0kRe = 0.;
16202   Double_t p1n0kIm = 0.;
16203
16204   // number of POIs in particular pt or eta bin:
16205   Double_t mp = 0.;
16206
16207   // real and imaginary parts of q_{m*n,0} (non-weighted Q-vector evaluated for particles which are both RPs and POIs in particular pt or eta bin):
16208   Double_t q1n0kRe = 0.;
16209   Double_t q1n0kIm = 0.;
16210   Double_t q2n0kRe = 0.;
16211   Double_t q2n0kIm = 0.;
16212   Double_t q3n0kRe = 0.;
16213   Double_t q3n0kIm = 0.;
16214
16215   // number of particles which are both RPs and POIs in particular pt or eta bin:
16216   Double_t mq = 0.;
16217    
16218   if(type == "POI")
16219   {
16220    // q_{m*n,0}:
16221    q1n0kRe = fReRPQ1dEBE[2][pe][0][0]->GetBinContent(fReRPQ1dEBE[2][pe][0][0]->GetBin(b))
16222            * fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b));
16223    q1n0kIm = fImRPQ1dEBE[2][pe][0][0]->GetBinContent(fImRPQ1dEBE[2][pe][0][0]->GetBin(b))
16224            * fImRPQ1dEBE[2][pe][0][0]->GetBinEntries(fImRPQ1dEBE[2][pe][0][0]->GetBin(b));
16225    q2n0kRe = fReRPQ1dEBE[2][pe][1][0]->GetBinContent(fReRPQ1dEBE[2][pe][1][0]->GetBin(b))
16226            * fReRPQ1dEBE[2][pe][1][0]->GetBinEntries(fReRPQ1dEBE[2][pe][1][0]->GetBin(b));
16227    q2n0kIm = fImRPQ1dEBE[2][pe][1][0]->GetBinContent(fImRPQ1dEBE[2][pe][1][0]->GetBin(b))
16228            * fImRPQ1dEBE[2][pe][1][0]->GetBinEntries(fImRPQ1dEBE[2][pe][1][0]->GetBin(b));                         
16229    q3n0kRe = fReRPQ1dEBE[2][pe][2][0]->GetBinContent(fReRPQ1dEBE[2][pe][2][0]->GetBin(b))
16230            * fReRPQ1dEBE[2][pe][2][0]->GetBinEntries(fReRPQ1dEBE[2][pe][2][0]->GetBin(b));
16231    q3n0kIm = fImRPQ1dEBE[2][pe][2][0]->GetBinContent(fImRPQ1dEBE[2][pe][2][0]->GetBin(b))
16232            * fImRPQ1dEBE[2][pe][2][0]->GetBinEntries(fImRPQ1dEBE[2][pe][2][0]->GetBin(b));         
16233
16234    mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
16235   } 
16236   else if(type == "RP")
16237   {
16238    // q_{m*n,0}:
16239    q1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
16240            * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
16241    q1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))
16242            * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
16243    q2n0kRe = fReRPQ1dEBE[0][pe][1][0]->GetBinContent(fReRPQ1dEBE[0][pe][1][0]->GetBin(b))
16244            * fReRPQ1dEBE[0][pe][1][0]->GetBinEntries(fReRPQ1dEBE[0][pe][1][0]->GetBin(b));
16245    q2n0kIm = fImRPQ1dEBE[0][pe][1][0]->GetBinContent(fImRPQ1dEBE[0][pe][1][0]->GetBin(b))
16246            * fImRPQ1dEBE[0][pe][1][0]->GetBinEntries(fImRPQ1dEBE[0][pe][1][0]->GetBin(b));         
16247    q3n0kRe = fReRPQ1dEBE[0][pe][2][0]->GetBinContent(fReRPQ1dEBE[0][pe][2][0]->GetBin(b))
16248            * fReRPQ1dEBE[0][pe][2][0]->GetBinEntries(fReRPQ1dEBE[0][pe][2][0]->GetBin(b));
16249    q3n0kIm = fImRPQ1dEBE[0][pe][2][0]->GetBinContent(fImRPQ1dEBE[0][pe][2][0]->GetBin(b))
16250            * fImRPQ1dEBE[0][pe][2][0]->GetBinEntries(fImRPQ1dEBE[0][pe][2][0]->GetBin(b));         
16251                  
16252    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)  
16253   }
16254       
16255    if(type == "POI")
16256    {
16257     // p_{m*n,0}:
16258     p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
16259             * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
16260     p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
16261             * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
16262             
16263     mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
16264     
16265     t = 1; // typeFlag = RP or POI
16266    }
16267    else if(type == "RP")
16268    {
16269     // p_{m*n,0} = q_{m*n,0}:
16270     p1n0kRe = q1n0kRe; 
16271     p1n0kIm = q1n0kIm; 
16272             
16273     mp = mq; 
16274     
16275     t = 0; // typeFlag = RP or POI
16276    }
16277       
16278    // 3'-particle correlators:
16279    //  Taeney-Yan correlator:
16280    Double_t dTaeneyYan = 0.;
16281    Double_t mWeightTaeneyYan = 0.; // multiplicity weight for Taeney-Yan correlator
16282    if((mp*dMult-2.*mq)*(dMult-1.) > 0.) // to be improved - is this condition fully justified?
16283    {
16284     dTaeneyYan = (dReQ3n*(p1n0kRe*dReQ2n-p1n0kIm*dImQ2n)+dImQ3n*(p1n0kIm*dReQ2n+p1n0kRe*dImQ2n)
16285                - p1n0kRe*dReQ1n - p1n0kIm*dImQ1n
16286                - q2n0kRe*dReQ2n - q2n0kIm*dImQ2n              
16287                - q3n0kRe*dReQ3n - q3n0kIm*dImQ3n
16288                + 2.*mq)
16289                / ((mp*dMult-2.*mq)*(dMult-1.));
16290     // determine multiplicity weight:
16291     if(fMultiplicityWeight->Contains("combinations"))
16292     {
16293      mWeightTaeneyYan = (mp*dMult-2.*mq)*(dMult-1.);
16294     } else if(fMultiplicityWeight->Contains("unit"))
16295       {
16296        mWeightTaeneyYan = 1.;    
16297       } 
16298     // Fill profiles:
16299     fOtherDiffCorrelators[t][pe][1][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dTaeneyYan,mWeightTaeneyYan);
16300    } // end of if((mp*dMult-2.*mq)*(dMult-1.) > 0.)  
16301    
16302  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16303  
16304 } // end of void AliFlowAnalysisWithQCumulants::CalculateOtherDiffCorrelators(TString type, TString ptOrEta)
16305
16306 //=======================================================================================================================
16307
16308 void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlowCorrelations(TString type)
16309 {
16310  // Calculate all reduced correlations needed for 2D differential flow for each (pt,eta) bin. 
16311  
16312  // Multiplicity:
16313  Double_t dMult = (*fSpk)(0,0);
16314  // Real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
16315  Double_t dReQ1n = (*fReQ)(0,0);
16316  Double_t dReQ2n = (*fReQ)(1,0);
16317  //Double_t dReQ3n = (*fReQ)(2,0);
16318  //Double_t dReQ4n = (*fReQ)(3,0);
16319  Double_t dImQ1n = (*fImQ)(0,0);
16320  Double_t dImQ2n = (*fImQ)(1,0);
16321  //Double_t dImQ3n = (*fImQ)(2,0);
16322  //Double_t dImQ4n = (*fImQ)(3,0);
16323
16324  // 2D reduced correlations are stored in TProfile2D f2DDiffFlowCorrelationsPro[0=RP,1=POI][correlation index]. 
16325  // Correlation index runs as follows:
16326  //  0: <<2'>> 
16327  //  1: <<4'>>
16328  //  2: <<6'>>
16329  //  3: <<8'>>
16330  
16331  Int_t t = 0; // type flag  
16332  if(type == "RP")
16333  {
16334   t = 0;
16335  } else if(type == "POI")
16336    {
16337     t = 1;
16338    }
16339
16340  // Looping over all (pt,eta) bins and calculating correlations needed for differential flow: 
16341  for(Int_t p=1;p<=fnBinsPt;p++)
16342  {
16343   for(Int_t e=1;e<=fnBinsEta;e++)
16344   {
16345    // Real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular (pt,eta) bin): 
16346    Double_t p1n0kRe = 0.;
16347    Double_t p1n0kIm = 0.;
16348    // Number of POIs in particular pt or eta bin:
16349    Double_t mp = 0.;
16350    // Real and imaginary parts of q_{m*n,0} (non-weighted Q-vector evaluated for 'RP && POI particles' in particular pt or eta bin):
16351    Double_t q1n0kRe = 0.;
16352    Double_t q1n0kIm = 0.;
16353    Double_t q2n0kRe = 0.;
16354    Double_t q2n0kIm = 0.; 
16355    // Number of 'RP && POI particles' in particular pt or eta bin:
16356    Double_t mq = 0.;
16357    if(type == "POI")
16358    {
16359     // q_{m*n,0}:
16360     q1n0kRe = fReRPQ2dEBE[2][0][0]->GetBinContent(fReRPQ2dEBE[2][0][0]->GetBin(p,e))
16361             * fReRPQ2dEBE[2][0][0]->GetBinEntries(fReRPQ2dEBE[2][0][0]->GetBin(p,e));
16362     q1n0kIm = fImRPQ2dEBE[2][0][0]->GetBinContent(fImRPQ2dEBE[2][0][0]->GetBin(p,e))
16363             * fImRPQ2dEBE[2][0][0]->GetBinEntries(fImRPQ2dEBE[2][0][0]->GetBin(p,e));
16364     q2n0kRe = fReRPQ2dEBE[2][1][0]->GetBinContent(fReRPQ2dEBE[2][1][0]->GetBin(p,e))
16365             * fReRPQ2dEBE[2][1][0]->GetBinEntries(fReRPQ2dEBE[2][1][0]->GetBin(p,e));
16366     q2n0kIm = fImRPQ2dEBE[2][1][0]->GetBinContent(fImRPQ2dEBE[2][1][0]->GetBin(p,e))
16367             * fImRPQ2dEBE[2][1][0]->GetBinEntries(fImRPQ2dEBE[2][1][0]->GetBin(p,e));         
16368     // m_{q}:             
16369     mq = fReRPQ2dEBE[2][0][0]->GetBinEntries(fReRPQ2dEBE[2][0][0]->GetBin(p,e)); // to be improved (cross-checked by accessing other profiles here)
16370    } // end of if(type == "POI")
16371    else if(type == "RP")
16372    {
16373     // q_{m*n,0}:
16374     q1n0kRe = fReRPQ2dEBE[0][0][0]->GetBinContent(fReRPQ2dEBE[0][0][0]->GetBin(p,e))
16375             * fReRPQ2dEBE[0][0][0]->GetBinEntries(fReRPQ2dEBE[0][0][0]->GetBin(p,e));
16376     q1n0kIm = fImRPQ2dEBE[0][0][0]->GetBinContent(fImRPQ2dEBE[0][0][0]->GetBin(p,e))
16377             * fImRPQ2dEBE[0][0][0]->GetBinEntries(fImRPQ2dEBE[0][0][0]->GetBin(p,e));
16378     q2n0kRe = fReRPQ2dEBE[0][1][0]->GetBinContent(fReRPQ2dEBE[0][1][0]->GetBin(p,e))
16379             * fReRPQ2dEBE[0][1][0]->GetBinEntries(fReRPQ2dEBE[0][1][0]->GetBin(p,e));
16380     q2n0kIm = fImRPQ2dEBE[0][1][0]->GetBinContent(fImRPQ2dEBE[0][1][0]->GetBin(p,e))
16381             * fImRPQ2dEBE[0][1][0]->GetBinEntries(fImRPQ2dEBE[0][1][0]->GetBin(p,e));         
16382     // m_{q}:             
16383     mq = fReRPQ2dEBE[0][0][0]->GetBinEntries(fReRPQ2dEBE[0][0][0]->GetBin(p,e)); // to be improved (cross-checked by accessing other profiles here)  
16384    } // end of else if(type == "RP")
16385    if(type == "POI")
16386    {
16387     // p_{m*n,0}:
16388     p1n0kRe = fReRPQ2dEBE[1][0][0]->GetBinContent(fReRPQ2dEBE[1][0][0]->GetBin(p,e))
16389             * fReRPQ2dEBE[1][0][0]->GetBinEntries(fReRPQ2dEBE[1][0][0]->GetBin(p,e));
16390     p1n0kIm = fImRPQ2dEBE[1][0][0]->GetBinContent(fImRPQ2dEBE[1][0][0]->GetBin(p,e))  
16391             * fImRPQ2dEBE[1][0][0]->GetBinEntries(fImRPQ2dEBE[1][0][0]->GetBin(p,e));
16392     // m_{p}        
16393     mp = fReRPQ2dEBE[1][0][0]->GetBinEntries(fReRPQ2dEBE[1][0][0]->GetBin(p,e)); // to be improved (cross-checked by accessing other profiles here)
16394     
16395     t = 1; // typeFlag = RP or POI
16396    } // end of if(type == "POI")
16397    else if(type == "RP")
16398    {
16399     // p_{m*n,0} = q_{m*n,0}:
16400     p1n0kRe = q1n0kRe; 
16401     p1n0kIm = q1n0kIm; 
16402     // m_{p} = m_{q}:        
16403     mp = mq; 
16404
16405     t = 0; // typeFlag = RP or POI
16406    } // end of if(type == "RP")
16407
16408    // 2'-particle correlation for particular (pt,eta) bin:
16409    Double_t two1n1nPtEta = 0.;
16410    Double_t mWeight2pPrime = 0.; // multiplicity weight for <2'>
16411    if(mp*dMult-mq)
16412    {
16413     two1n1nPtEta = (p1n0kRe*dReQ1n+p1n0kIm*dImQ1n-mq)
16414                  / (mp*dMult-mq);
16415     // Determine multiplicity weight:
16416     if(fMultiplicityWeight->Contains("combinations"))
16417     {
16418      mWeight2pPrime = mp*dMult-mq;
16419     } else if(fMultiplicityWeight->Contains("unit"))
16420       {
16421        mWeight2pPrime = 1.;    
16422       } 
16423     // Fill 2D profile holding <<2'>>:     
16424     f2DDiffFlowCorrelationsPro[t][0]->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,two1n1nPtEta,mWeight2pPrime);
16425    } // end of if(mp*dMult-mq)
16426    
16427    // 4'-particle correlation:
16428    Double_t four1n1n1n1nPtEta = 0.;
16429    Double_t mWeight4pPrime = 0.; // multiplicity weight for <4'>
16430    if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16431        + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)) // to be improved (introduce a new variable for this expression)
16432    {
16433     four1n1n1n1nPtEta = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)
16434                       - q2n0kRe*(pow(dReQ1n,2.)-pow(dImQ1n,2.))
16435                       - 2.*q2n0kIm*dReQ1n*dImQ1n
16436                       - p1n0kRe*(dReQ1n*dReQ2n+dImQ1n*dImQ2n)
16437                       + p1n0kIm*(dImQ1n*dReQ2n-dReQ1n*dImQ2n)
16438                       - 2.*dMult*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)
16439                       - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*mq                      
16440                       + 6.*(q1n0kRe*dReQ1n+q1n0kIm*dImQ1n)                                            
16441                       + 1.*(q2n0kRe*dReQ2n+q2n0kIm*dImQ2n)                      
16442                       + 2.*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)                       
16443                       + 2.*mq*dMult                      
16444                       - 6.*mq)        
16445                       / ((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16446                           + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
16447     // Determine multiplicity weight:
16448     if(fMultiplicityWeight->Contains("combinations"))
16449     {
16450      mWeight4pPrime = (mp-mq)*dMult*(dMult-1.)*(dMult-2.) + mq*(dMult-1.)*(dMult-2.)*(dMult-3.);
16451     } else if(fMultiplicityWeight->Contains("unit"))
16452       {
16453        mWeight4pPrime = 1.;    
16454       }     
16455     // Fill 2D profile holding <<4'>>:
16456     f2DDiffFlowCorrelationsPro[t][1]->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,four1n1n1n1nPtEta,mWeight4pPrime);      
16457    } // end of if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16458      //            +mq*(dMult-1.)*(dMult-2.)*(dMult-3.))
16459   } // end of for(Int_t e=1;e<=fnBinsEta;e++)
16460  } // end of for(Int_t p=1;p<=fnBinsPt;p++)   
16461       
16462 } // end of AliFlowAnalysisWithQCumulants::Calculate2DDiffFlowCorrelations(TString type)
16463
16464 //=======================================================================================================================
16465
16466 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowSumOfEventWeights(TString type, TString ptOrEta)
16467 {
16468  // Calculate sums of various event weights for reduced correlations. 
16469  // (These quantitites are needed in expressions for unbiased estimators relevant for the statistical errors.)
16470
16471  Int_t typeFlag = 0;
16472  Int_t ptEtaFlag = 0;
16473
16474  if(type == "RP")
16475  {
16476   typeFlag = 0;
16477  } else if(type == "POI")
16478    {
16479     typeFlag = 1;
16480    } 
16481      
16482  if(ptOrEta == "Pt")
16483  {
16484   ptEtaFlag = 0;
16485  } else if(ptOrEta == "Eta")
16486    {
16487     ptEtaFlag = 1;
16488    } 
16489    
16490  // shortcuts:
16491  Int_t t = typeFlag;
16492  Int_t pe = ptEtaFlag;
16493  
16494  // binning:
16495  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
16496  Double_t minPtEta[2] = {fPtMin,fEtaMin};
16497  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
16498  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
16499  
16500  for(Int_t rpq=0;rpq<3;rpq++)
16501  {
16502   for(Int_t m=0;m<4;m++)
16503   {
16504    for(Int_t k=0;k<9;k++)
16505    {
16506     if(!fReRPQ1dEBE[rpq][pe][m][k])
16507     {
16508      cout<<"WARNING: fReRPQ1dEBE[rpq][pe][m][k] is NULL in AFAWQC::CSAPOEWFDF() !!!!"<<endl;
16509      cout<<"pe  = "<<pe<<endl;
16510      cout<<"rpq = "<<rpq<<endl;
16511      cout<<"m   = "<<m<<endl;
16512      cout<<"k   = "<<k<<endl;
16513      exit(0); 
16514     }
16515    }
16516   }
16517  }  
16518
16519  // multiplicities:
16520  Double_t dMult = (*fSpk)(0,0); // total event multiplicity
16521  //Double_t mr = 0.; // number of RPs in particular pt or eta bin
16522  Double_t mp = 0.; // number of POIs in particular pt or eta bin 
16523  Double_t mq = 0.; // number of particles which are both RPs and POIs in particular pt or eta bin
16524  
16525  // event weights for reduced correlations:
16526  Double_t dw2 = 0.; // event weight for <2'>
16527  Double_t dw4 = 0.; // event weight for <4'>
16528  //Double_t dw6 = 0.; // event weight for <6'>
16529  //Double_t dw8 = 0.; // event weight for <8'>
16530
16531  // looping over bins:
16532  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16533  {
16534   if(type == "RP")
16535   {
16536    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(b);
16537    mp = mq; // trick to use the very same Eqs. bellow both for RP's and POI's diff. flow
16538   } else if(type == "POI")
16539     {
16540      mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(b);
16541      mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(b);    
16542     }
16543   
16544   // event weight for <2'>:
16545   dw2 = mp*dMult-mq;  
16546   fDiffFlowSumOfEventWeights[t][pe][0][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2);
16547   fDiffFlowSumOfEventWeights[t][pe][1][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw2,2.));
16548   
16549   // event weight for <4'>:
16550   dw4 = (mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16551      + mq*(dMult-1.)*(dMult-2.)*(dMult-3.);  
16552   fDiffFlowSumOfEventWeights[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4);
16553   fDiffFlowSumOfEventWeights[t][pe][1][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw4,2.));
16554   
16555   // event weight for <6'>:
16556   //dw6 = ...;  
16557   //fDiffFlowSumOfEventWeights[t][pe][0][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw6);
16558   //fDiffFlowSumOfEventWeights[t][pe][t][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw6,2.));
16559   
16560   // event weight for <8'>:
16561   //dw8 = ...;  
16562   //fDiffFlowSumOfEventWeights[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw8);
16563   //fDiffFlowSumOfEventWeights[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw8,2.));   
16564  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++) 
16565  
16566 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowSumOfEventWeights()
16567
16568
16569 //=======================================================================================================================
16570
16571
16572 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowSumOfProductOfEventWeights(TString type, TString ptOrEta)
16573 {
16574  // Calculate sum of products of various event weights for both types of correlations (the ones for int. and diff. flow). 
16575  // (These quantitites are needed in expressions for unbiased estimators relevant for the statistical errors.)
16576  //
16577  // Important: To fill fDiffFlowSumOfProductOfEventWeights[][][][] use bellow table (i,j) with following constraints: 
16578  // 1.) i<j  
16579  // 2.) do not store terms which DO NOT include reduced correlations;
16580  // Table:
16581  // [0=<2>,1=<2'>,2=<4>,3=<4'>,4=<6>,5=<6'>,6=<8>,7=<8'>] x [0=<2>,1=<2'>,2=<4>,3=<4'>,4=<6>,5=<6'>,6=<8>,7=<8'>]
16582   
16583  Int_t typeFlag = 0;
16584  Int_t ptEtaFlag = 0;
16585
16586  if(type == "RP")
16587  {
16588   typeFlag = 0;
16589  } else if(type == "POI")
16590    {
16591     typeFlag = 1;
16592    } 
16593      
16594  if(ptOrEta == "Pt")
16595  {
16596   ptEtaFlag = 0;
16597  } else if(ptOrEta == "Eta")
16598    {
16599     ptEtaFlag = 1;
16600    } 
16601      
16602  // shortcuts:
16603  Int_t t = typeFlag;
16604  Int_t pe = ptEtaFlag;
16605   
16606  // binning:
16607  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
16608  Double_t minPtEta[2] = {fPtMin,fEtaMin};
16609  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
16610  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
16611  
16612  // protection:
16613  for(Int_t rpq=0;rpq<3;rpq++)
16614  {
16615   for(Int_t m=0;m<4;m++)
16616   {
16617    for(Int_t k=0;k<9;k++)
16618    {
16619     if(!fReRPQ1dEBE[rpq][pe][m][k])
16620     {
16621      cout<<"WARNING: fReRPQ1dEBE[rpq][pe][m][k] is NULL in AFAWQC::CSAPOEWFDF() !!!!"<<endl;
16622      cout<<"pe  = "<<pe<<endl;
16623      cout<<"rpq = "<<rpq<<endl;
16624      cout<<"m   = "<<m<<endl;
16625      cout<<"k   = "<<k<<endl;
16626      exit(0); 
16627     }
16628    }
16629   }
16630  }  
16631  
16632  // multiplicities:
16633  Double_t dMult = (*fSpk)(0,0); // total event multiplicity
16634  //Double_t mr = 0.; // number of RPs in particular pt or eta bin
16635  Double_t mp = 0.; // number of POIs in particular pt or eta bin 
16636  Double_t mq = 0.; // number of particles which are both RPs and POIs in particular pt or eta bin
16637  
16638  // event weights for correlations:
16639  Double_t dW2 = dMult*(dMult-1); // event weight for <2> 
16640  Double_t dW4 = dMult*(dMult-1)*(dMult-2)*(dMult-3); // event weight for <4> 
16641  Double_t dW6 = dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-4)*(dMult-5); // event weight for <6> 
16642  Double_t dW8 = dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-4)*(dMult-5)*(dMult-6)*(dMult-7); // event weight for <8> 
16643
16644  // event weights for reduced correlations:
16645  Double_t dw2 = 0.; // event weight for <2'>
16646  Double_t dw4 = 0.; // event weight for <4'>
16647  //Double_t dw6 = 0.; // event weight for <6'>
16648  //Double_t dw8 = 0.; // event weight for <8'>
16649  
16650  // looping over bins:
16651  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16652  {
16653   if(type == "RP")
16654   {
16655    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(b);
16656    mp = mq; // trick to use the very same Eqs. bellow both for RP's and POI's diff. flow
16657   } else if(type == "POI")
16658     {
16659      mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(b);
16660      mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(b);    
16661     }
16662   
16663   // event weight for <2'>:
16664   dw2 = mp*dMult-mq;  
16665   fDiffFlowSumOfProductOfEventWeights[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW2*dw2); // storing product of even weights for <2> and <2'>
16666   fDiffFlowSumOfProductOfEventWeights[t][pe][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dW4); // storing product of even weights for <4> and <2'>
16667   fDiffFlowSumOfProductOfEventWeights[t][pe][1][4]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dW6); // storing product of even weights for <6> and <2'>
16668   fDiffFlowSumOfProductOfEventWeights[t][pe][1][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dW8); // storing product of even weights for <8> and <2'>
16669   
16670   // event weight for <4'>:
16671   dw4 = (mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16672      + mq*(dMult-1.)*(dMult-2.)*(dMult-3.);  
16673   fDiffFlowSumOfProductOfEventWeights[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW2*dw4); // storing product of even weights for <2> and <4'>
16674   fDiffFlowSumOfProductOfEventWeights[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dw4); // storing product of even weights for <2'> and <4'>
16675   fDiffFlowSumOfProductOfEventWeights[t][pe][2][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW4*dw4); // storing product of even weights for <4> and <4'>
16676   fDiffFlowSumOfProductOfEventWeights[t][pe][3][4]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4*dW6); // storing product of even weights for <6> and <4'> 
16677   fDiffFlowSumOfProductOfEventWeights[t][pe][3][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4*dW8); // storing product of even weights for <8> and <4'>
16678
16679   // event weight for <6'>:
16680   //dw6 = ...;  
16681   //fDiffFlowSumOfProductOfEventWeights[t][pe][0][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW2*dw6); // storing product of even weights for <2> and <6'>
16682   //fDiffFlowSumOfProductOfEventWeights[t][pe][1][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dw6); // storing product of even weights for <2'> and <6'>
16683   //fDiffFlowSumOfProductOfEventWeights[t][pe][2][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW4*dw6); // storing product of even weights for <4> and <6'>
16684   //fDiffFlowSumOfProductOfEventWeights[t][pe][3][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4*dw6); // storing product of even weights for <4'> and <6'> 
16685   //fDiffFlowSumOfProductOfEventWeights[t][pe][4][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW6*dw6); // storing product of even weights for <6> and <6'>
16686   //fDiffFlowSumOfProductOfEventWeights[t][pe][5][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw6*dW8); // storing product of even weights for <6'> and <8>
16687   //fDiffFlowSumOfProductOfEventWeights[t][pe][5][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw6*dw8); // storing product of even weights for <6'> and <8'>
16688
16689   // event weight for <8'>:
16690   //dw8 = ...;  
16691   //fDiffFlowSumOfProductOfEventWeights[t][pe][0][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW2*dw8); // storing product of even weights for <2> and <8'>
16692   //fDiffFlowSumOfProductOfEventWeights[t][pe][1][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dw8); // storing product of even weights for <2'> and <8'>
16693   //fDiffFlowSumOfProductOfEventWeights[t][pe][2][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW4*dw8); // storing product of even weights for <4> and <8'>
16694   //fDiffFlowSumOfProductOfEventWeights[t][pe][3][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4*dw8); // storing product of even weights for <4'> and <8'> 
16695   //fDiffFlowSumOfProductOfEventWeights[t][pe][4][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW6*dw8); // storing product of even weights for <6> and <8'>
16696   //fDiffFlowSumOfProductOfEventWeights[t][pe][5][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw6*dw8); // storing product of even weights for <6'> and <8'>
16697   //fDiffFlowSumOfProductOfEventWeights[t][pe][6][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW8*dw8); // storing product of even weights for <8> and <8'>
16698   
16699   // Table:
16700   // [0=<2>,1=<2'>,2=<4>,3=<4'>,4=<6>,5=<6'>,6=<8>,7=<8'>] x [0=<2>,1=<2'>,2=<4>,3=<4'>,4=<6>,5=<6'>,6=<8>,7=<8'>]
16701    
16702  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16703  
16704
16705
16706 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowSumOfProductOfEventWeights(TString type, TString ptOrEta)
16707
16708 //=======================================================================================================================
16709
16710 void AliFlowAnalysisWithQCumulants::FinalizeReducedCorrelations(TString type, TString ptOrEta)
16711 {
16712  // Transfer profiles into histograms and calculate statistical errors correctly.
16713
16714  Int_t t = 0; // RP or POI
16715  Int_t pe = 0; // pt or eta
16716
16717  if(type == "RP")
16718  {
16719   t = 0;
16720  } else if(type == "POI")
16721    {
16722     t = 1;
16723    } 
16724      
16725  if(ptOrEta == "Pt")
16726  {
16727   pe = 0;
16728  } else if(ptOrEta == "Eta")
16729    {
16730     pe = 1;
16731    } 
16732                
16733  for(Int_t rci=0;rci<4;rci++) // to be improved - moved into the method CheckPointersUsedInFinish()
16734  {
16735   if(!fDiffFlowCorrelationsPro[t][pe][rci])
16736   {
16737    cout<<"WARNING: fDiffFlowCorrelationsPro[t][pe][rci] is NULL in AFAWQC::FRC() !!!!"<<endl;
16738    cout<<"t   = "<<t<<endl; 
16739    cout<<"pe  = "<<pe<<endl; 
16740    cout<<"rci = "<<rci<<endl;
16741    exit(0); 
16742   }
16743   if(!fDiffFlowSquaredCorrelationsPro[t][pe][rci])
16744   {
16745    cout<<"WARNING: fDiffFlowSquaredCorrelationsPro[t][pe][rci] is NULL in AFAWQC::FRC() !!!!"<<endl;
16746    cout<<"t   = "<<t<<endl; 
16747    cout<<"pe  = "<<pe<<endl; 
16748    cout<<"rci = "<<rci<<endl;
16749    exit(0); 
16750   }
16751   for(Int_t power=0;power<2;power++)
16752   {
16753    if(!fDiffFlowSumOfEventWeights[t][pe][power][rci])
16754    {
16755     cout<<"WARNING: fDiffFlowSumOfEventWeights[t][pe][power][rci] is NULL in AFAWQC::FRC() !!!!"<<endl;
16756     cout<<"t     = "<<t<<endl; 
16757     cout<<"pe    = "<<pe<<endl;
16758     cout<<"power = "<<power<<endl; 
16759     cout<<"rci   = "<<rci<<endl;
16760     exit(0); 
16761    }   
16762   } // end of for(Int_t power=0;power<2;power++)
16763  } // end of for(Int_t rci=0;rci<4;rci++)
16764     
16765  // common:
16766  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta}; 
16767  // transfer 1D profile into 1D histogram:
16768  Double_t correlation = 0.;
16769  Double_t squaredCorrelation = 0.;
16770  Double_t spread = 0.;
16771  Double_t sumOfWeights = 0.; // sum of weights for particular reduced correlations for particular pt or eta bin
16772  Double_t sumOfSquaredWeights = 0.; // sum of squared weights for particular reduced correlations for particular pt or eta bin
16773  Double_t error = 0.; // error = termA * spread * termB
16774                       // termA = (sqrt(sumOfSquaredWeights)/sumOfWeights) 
16775                       // termB = 1/pow(1-termA^2,0.5)
16776  Double_t termA = 0.;                      
16777  Double_t termB = 0.;                      
16778  for(Int_t rci=0;rci<4;rci++) // index of reduced correlation
16779  {
16780   for(Int_t b=1;b<=nBinsPtEta[pe];b++) // number of pt or eta bins
16781   {
16782    if(fDiffFlowCorrelationsPro[t][pe][rci]->GetBinEffectiveEntries(b) < 2 || 
16783       fDiffFlowSquaredCorrelationsPro[t][pe][rci]->GetBinEffectiveEntries(b) < 2)
16784    {
16785     fDiffFlowCorrelationsPro[t][pe][rci]->SetBinError(b,0.);
16786     fDiffFlowSquaredCorrelationsPro[t][pe][rci]->SetBinError(b,0.);
16787     continue; // to be improved - should I ignore results in pt bins with one entry for reduced correlations or not?
16788    }  
16789    correlation = fDiffFlowCorrelationsPro[t][pe][rci]->GetBinContent(b); 
16790    squaredCorrelation = fDiffFlowSquaredCorrelationsPro[t][pe][rci]->GetBinContent(b); 
16791    if(squaredCorrelation-correlation*correlation >= 0.)
16792    {
16793     spread = pow(squaredCorrelation-correlation*correlation,0.5);
16794    } else
16795      {
16796       cout<<endl;
16797       cout<<Form(" WARNING: Imaginary 'spread' for rci = %d, pe = %d, bin = %d !!!!",rci,pe,b)<<endl;
16798       cout<<endl;
16799      }
16800    sumOfWeights = fDiffFlowSumOfEventWeights[t][pe][0][rci]->GetBinContent(b);
16801    sumOfSquaredWeights = fDiffFlowSumOfEventWeights[t][pe][1][rci]->GetBinContent(b);
16802    if(TMath::Abs(sumOfWeights)>0.){termA = (pow(sumOfSquaredWeights,0.5)/sumOfWeights);}
16803    if(1.-pow(termA,2.)>0.){termB = 1./pow(1.-pow(termA,2.),0.5);} 
16804    error = termA*spread*termB; // final error (unbiased estimator for standard deviation)
16805    fDiffFlowCorrelationsHist[t][pe][rci]->SetBinContent(b,correlation); 
16806    fDiffFlowCorrelationsHist[t][pe][rci]->SetBinError(b,error); 
16807   } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16808  } // end of for(Int_t rci=0;rci<4;rci++)
16809  
16810 } // end of void AliFlowAnalysisWithQCumulants::FinalizeReducedCorrelations(TString type, TString ptOrEta)
16811
16812 //=======================================================================================================================
16813
16814 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowProductOfCorrelations(TString type, TString ptOrEta)
16815 {
16816  // store products: <2><2'>, <2><4'>, <2><6'>, <2><8'>, <2'><4>, 
16817  //                 <2'><4'>, <2'><6>, <2'><6'>, <2'><8>, <2'><8'>,
16818  //                 <4><4'>, <4><6'>, <4><8'>, <4'><6>, <4'><6'>, 
16819  //                 <4'><8>, <4'><8'>, <6><6'>, <6><8'>, <6'><8>, 
16820  //                 <6'><8'>, <8><8'>.
16821   
16822  Int_t typeFlag = 0;
16823  Int_t ptEtaFlag = 0;
16824
16825  if(type == "RP")
16826  {
16827   typeFlag = 0;
16828  } else if(type == "POI")
16829    {
16830     typeFlag = 1;
16831    } 
16832      
16833  if(ptOrEta == "Pt")
16834  {
16835   ptEtaFlag = 0;
16836  } else if(ptOrEta == "Eta")
16837    {
16838     ptEtaFlag = 1;
16839    } 
16840   
16841  // shortcuts:
16842  Int_t t = typeFlag;
16843  Int_t pe = ptEtaFlag;
16844      
16845  // common:
16846  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
16847  Double_t minPtEta[2] = {fPtMin,fEtaMin};
16848  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
16849    
16850  // protections // to be improved (add protection for all pointers in this method)
16851  if(!fIntFlowCorrelationsEBE)
16852  {
16853   cout<<"WARNING: fIntFlowCorrelationsEBE is NULL in AFAWQC::CDFPOC() !!!!"<<endl;
16854   exit(0);
16855  } 
16856  
16857  /*    
16858  Double_t dMult = (*fSpk)(0,0); // multiplicity (number of particles used to determine the reaction plane)
16859  //Double_t mr = 0.; // number of RPs in particular pt or eta bin
16860  Double_t mp = 0.; // number of POIs in particular pt or eta bin 
16861  Double_t mq = 0.; // number of particles which are both RPs and POIs in particular pt or eta bin
16862  */
16863
16864  // e-b-e correlations:
16865  Double_t twoEBE = fIntFlowCorrelationsEBE->GetBinContent(1); // <2>
16866  Double_t fourEBE = fIntFlowCorrelationsEBE->GetBinContent(2); // <4>
16867  Double_t sixEBE = fIntFlowCorrelationsEBE->GetBinContent(3); // <6>
16868  Double_t eightEBE = fIntFlowCorrelationsEBE->GetBinContent(4); // <8>
16869  
16870  // event weights for correlations:
16871  Double_t dW2 = fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1); // event weight for <2> 
16872  Double_t dW4 = fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2); // event weight for <4> 
16873  Double_t dW6 = fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(3); // event weight for <6> 
16874  Double_t dW8 = fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(4); // event weight for <8> 
16875   
16876  // e-b-e reduced correlations:
16877  Double_t twoReducedEBE = 0.; // <2'>
16878  Double_t fourReducedEBE = 0.; // <4'>
16879  //Double_t sixReducedEBE = 0.; // <6'>
16880  //Double_t eightReducedEBE = 0.; // <8'> 
16881  
16882  // event weights for reduced correlations:
16883  Double_t dw2 = 0.; // event weight for <2'>
16884  Double_t dw4 = 0.; // event weight for <4'>
16885  //Double_t dw6 = 0.; // event weight for <6'>
16886  //Double_t dw8 = 0.; // event weight for <8'>
16887
16888  // looping over bins:
16889  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16890  {
16891   // e-b-e reduced correlations:
16892   twoReducedEBE = fDiffFlowCorrelationsEBE[t][pe][0]->GetBinContent(b);
16893   fourReducedEBE = fDiffFlowCorrelationsEBE[t][pe][1]->GetBinContent(b);
16894   //sixReducedEBE = fDiffFlowCorrelationsEBE[t][pe][2]->GetBinContent(b);
16895   //eightReducedEBE = fDiffFlowCorrelationsEBE[t][pe][3]->GetBinContent(b);
16896   
16897   /*
16898   // to be improved (I should not do this here again)
16899   if(type == "RP")
16900   {
16901    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(b);
16902    mp = mq; // trick to use the very same Eqs. bellow both for RP's and POI's diff. flow
16903   } else if(type == "POI")
16904     {
16905      mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(b);
16906      mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(b);    
16907     }
16908   
16909   // event weights for reduced correlations:
16910   dw2 = mp*dMult-mq; // weight for <2'> 
16911   dw4 = (mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16912      + mq*(dMult-1.)*(dMult-2.)*(dMult-3.); // weight for <4'>
16913   //dw6 = ...     
16914   //dw8 = ...     
16915   
16916   */
16917   
16918   dw2 = fDiffFlowEventWeightsForCorrelationsEBE[t][pe][0]->GetBinContent(b);
16919   dw4 = fDiffFlowEventWeightsForCorrelationsEBE[t][pe][1]->GetBinContent(b);
16920  
16921   // storing all products:
16922   fDiffFlowProductOfCorrelationsPro[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoEBE*twoReducedEBE,dW2*dw2); // storing <2><2'>
16923   fDiffFlowProductOfCorrelationsPro[t][pe][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourEBE*twoReducedEBE,dW4*dw2); // storing <4><2'>
16924   fDiffFlowProductOfCorrelationsPro[t][pe][1][4]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixEBE*twoReducedEBE,dW6*dw2); // storing <6><2'>
16925   fDiffFlowProductOfCorrelationsPro[t][pe][1][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],eightEBE*twoReducedEBE,dW8*dw2); // storing <8><2'>
16926   
16927   // event weight for <4'>:
16928   fDiffFlowProductOfCorrelationsPro[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoEBE*fourReducedEBE,dW2*dw4); // storing <2><4'>
16929   fDiffFlowProductOfCorrelationsPro[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoReducedEBE*fourReducedEBE,dw2*dw4); // storing <2'><4'>
16930   fDiffFlowProductOfCorrelationsPro[t][pe][2][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourEBE*fourReducedEBE,dW4*dw4); // storing <4><4'>
16931   fDiffFlowProductOfCorrelationsPro[t][pe][3][4]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixEBE*fourReducedEBE,dW6*dw4); // storing <6><4'> 
16932   fDiffFlowProductOfCorrelationsPro[t][pe][3][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],eightEBE*fourReducedEBE,dW8*dw4); // storing <8><4'>
16933
16934   // event weight for <6'>:
16935   //dw6 = ...;  
16936   //fDiffFlowProductOfCorrelationsPro[t][pe][0][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoEBE*sixReducedEBE,dW2*dw6); // storing <2><6'>
16937   //fDiffFlowProductOfCorrelationsPro[t][pe][1][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoReducedEBE*sixReducedEBE,dw2*dw6); // storing <2'><6'>
16938   //fDiffFlowProductOfCorrelationsPro[t][pe][2][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourEBE*sixReducedEBE,dW4*dw6); // storing <4><6'>
16939   //fDiffFlowProductOfCorrelationsPro[t][pe][3][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourReducedEBE*sixReducedEBE,dw4*dw6); // storing <4'><6'> 
16940   //fDiffFlowProductOfCorrelationsPro[t][pe][4][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixEBE*sixReducedEBE,dW6*dw6); // storing <6><6'>
16941   //fDiffFlowProductOfCorrelationsPro[t][pe][5][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixReducedEBE*eightEBE,dw6*dW8); // storing <6'><8>
16942   //fDiffFlowProductOfCorrelationsPro[t][pe][5][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixReducedEBE*eightReducedEBE,dw6*dw8); // storing <6'><8'>
16943
16944   // event weight for <8'>:
16945   //dw8 = ...;  
16946   //fDiffFlowProductOfCorrelationsPro[t][pe][0][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoEBE*eightReducedEBE,dW2*dw8); // storing <2><8'>
16947   //fDiffFlowProductOfCorrelationsPro[t][pe][1][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoReducedEBE*eightReducedEBE,dw2*dw8); // storing <2'><8'>
16948   //fDiffFlowProductOfCorrelationsPro[t][pe][2][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourEBE*eightReducedEBE,dW4*dw8); // storing <4><8'>
16949   //fDiffFlowProductOfCorrelationsPro[t][pe][3][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourReducedEBE*eightReducedEBE,dw4*dw8); // storing <4'><8'> 
16950   //fDiffFlowProductOfCorrelationsPro[t][pe][4][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixEBE*eightReducedEBE,dW6*dw8); // storing <6><8'>
16951   //fDiffFlowProductOfCorrelationsPro[t][pe][5][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixReducedEBE*eightReducedEBE,dw6*dw8); // storing <6'><8'>
16952   //fDiffFlowProductOfCorrelationsPro[t][pe][6][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],eightEBE*eightReducedEBE,dW8*dw8); // storing <8><8'> 
16953  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++       
16954      
16955 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowProductOfCorrelations(TString type, TString ptOrEta)
16956
16957 //=======================================================================================================================
16958     
16959 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCovariances(TString type, TString ptOrEta) // to be improved (reimplemented)
16960 {
16961  // a) Calculate unbiased estimators Cov(<2>,<2'>), Cov(<2>,<4'>), Cov(<4>,<2'>), Cov(<4>,<4'>) and Cov(<2'>,<4'>)
16962  //    for covariances V(<2>,<2'>), V(<2>,<4'>), V(<4>,<2'>), V(<4>,<4'>) and V(<2'>,<4'>).  
16963  // b) Store in histogram fDiffFlowCovariances[t][pe][index] for instance the following: 
16964  //
16965  //             Cov(<2>,<2'>) * (sum_{i=1}^{N} w_{<2>}_i w_{<2'>}_i )/[(sum_{i=1}^{N} w_{<2>}_i) * (sum_{j=1}^{N} w_{<2'>}_j)]
16966  // 
16967  //     where N is the number of events, w_{<2>} is event weight for <2> and w_{<2'>} is event weight for <2'>.
16968  // c) Binning of fDiffFlowCovariances[t][pe][index] is organized as follows:
16969  // 
16970  //     1st bin: Cov(<2>,<2'>) * (sum_{i=1}^{N} w_{<2>}_i w_{<2'>}_i )/[(sum_{i=1}^{N} w_{<2>}_i) * (sum_{j=1}^{N} w_{<2'>}_j)] 
16971  //     2nd bin: Cov(<2>,<4'>) * (sum_{i=1}^{N} w_{<2>}_i w_{<4'>}_i )/[(sum_{i=1}^{N} w_{<2>}_i) * (sum_{j=1}^{N} w_{<4'>}_j)] 
16972  //     3rd bin: Cov(<4>,<2'>) * (sum_{i=1}^{N} w_{<4>}_i w_{<2'>}_i )/[(sum_{i=1}^{N} w_{<4>}_i) * (sum_{j=1}^{N} w_{<2'>}_j)] 
16973  //     4th bin: Cov(<4>,<4'>) * (sum_{i=1}^{N} w_{<4>}_i w_{<4'>}_i )/[(sum_{i=1}^{N} w_{<4>}_i) * (sum_{j=1}^{N} w_{<4'>}_j)] 
16974  //     5th bin: Cov(<2'>,<4'>) * (sum_{i=1}^{N} w_{<2'>}_i w_{<4'>}_i )/[(sum_{i=1}^{N} w_{<2'>}_i) * (sum_{j=1}^{N} w_{<4'>}_j)] 
16975  //     ...
16976   
16977  Int_t typeFlag = 0;
16978  Int_t ptEtaFlag = 0;
16979
16980  if(type == "RP")
16981  {
16982   typeFlag = 0;
16983  } else if(type == "POI")
16984    {
16985     typeFlag = 1;
16986    } 
16987      
16988  if(ptOrEta == "Pt")
16989  {
16990   ptEtaFlag = 0;
16991  } else if(ptOrEta == "Eta")
16992    {
16993     ptEtaFlag = 1;
16994    } 
16995   
16996  // shortcuts:
16997  Int_t t = typeFlag;
16998  Int_t pe = ptEtaFlag;
16999      
17000  // common:
17001  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
17002  //Double_t minPtEta[2] = {fPtMin,fEtaMin};
17003  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
17004  //Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
17005  
17006  // average correlations:
17007  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>>
17008  Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>>
17009  //Double_t six = fIntFlowCorrelationsHist->GetBinContent(3); // <<6>>
17010  //Double_t eight = fIntFlowCorrelationsHist->GetBinContent(4); // <<8>>
17011  
17012  // sum of weights for correlation:
17013  Double_t sumOfWeightsForTwo = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // sum_{i=1}^{N} w_{<2>}
17014  Double_t sumOfWeightsForFour = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // sum_{i=1}^{N} w_{<4>}
17015  //Double_t sumOfWeightsForSix = fIntFlowSumOfEventWeights[0]->GetBinContent(3); // sum_{i=1}^{N} w_{<6>}
17016  //Double_t sumOfWeightsForEight = fIntFlowSumOfEventWeights[0]->GetBinContent(4); // sum_{i=1}^{N} w_{<8>}
17017  
17018  // average reduced correlations:
17019  Double_t twoReduced = 0.; // <<2'>> 
17020  Double_t fourReduced = 0.; // <<4'>>
17021  //Double_t sixReduced = 0.; // <<6'>>
17022  //Double_t eightReduced = 0.; // <<8'>>
17023
17024  // sum of weights for reduced correlation:
17025  Double_t sumOfWeightsForTwoReduced = 0.; // sum_{i=1}^{N} w_{<2'>}
17026  Double_t sumOfWeightsForFourReduced = 0.; // sum_{i=1}^{N} w_{<4'>}
17027  //Double_t sumOfWeightsForSixReduced = 0.; // sum_{i=1}^{N} w_{<6'>}
17028  //Double_t sumOfWeightsForEightReduced = 0.; // sum_{i=1}^{N} w_{<8'>}
17029   
17030  // product of weights for reduced correlation:
17031  Double_t productOfWeightsForTwoTwoReduced = 0.; // sum_{i=1}^{N} w_{<2>}w_{<2'>}
17032  Double_t productOfWeightsForTwoFourReduced = 0.; // sum_{i=1}^{N} w_{<2>}w_{<4'>}
17033  Double_t productOfWeightsForFourTwoReduced = 0.; // sum_{i=1}^{N} w_{<4>}w_{<2'>}
17034  Double_t productOfWeightsForFourFourReduced = 0.; // sum_{i=1}^{N} w_{<4>}w_{<4'>}
17035  Double_t productOfWeightsForTwoReducedFourReduced = 0.; // sum_{i=1}^{N} w_{<2'>}w_{<4'>}
17036  // ...
17037  
17038  // products for differential flow:
17039  Double_t twoTwoReduced = 0; // <<2><2'>> 
17040  Double_t twoFourReduced = 0; // <<2><4'>> 
17041  Double_t fourTwoReduced = 0; // <<4><2'>> 
17042  Double_t fourFourReduced = 0; // <<4><4'>> 
17043  Double_t twoReducedFourReduced = 0; // <<2'><4'>> 
17044
17045  // denominators in the expressions for the unbiased estimators for covariances:
17046  // denominator = 1 - term1/(term2*term3)
17047  // prefactor = term1/(term2*term3)
17048  Double_t denominator = 0.; 
17049  Double_t prefactor = 0.;
17050  Double_t term1 = 0.; 
17051  Double_t term2 = 0.; 
17052  Double_t term3 = 0.; 
17053  
17054  // unbiased estimators for covariances for differential flow:
17055  Double_t covTwoTwoReduced = 0.; // Cov(<2>,<2'>)
17056  Double_t wCovTwoTwoReduced = 0.; // Cov(<2>,<2'>) * prefactor(w_{<2>},w_{<2'>})
17057  Double_t covTwoFourReduced = 0.; // Cov(<2>,<4'>)
17058  Double_t wCovTwoFourReduced = 0.; // Cov(<2>,<4'>) * prefactor(w_{<2>},w_{<4'>})
17059  Double_t covFourTwoReduced = 0.; // Cov(<4>,<2'>)
17060  Double_t wCovFourTwoReduced = 0.; // Cov(<4>,<2'>) * prefactor(w_{<4>},w_{<2'>})
17061  Double_t covFourFourReduced = 0.; // Cov(<4>,<4'>)
17062  Double_t wCovFourFourReduced = 0.; // Cov(<4>,<4'>) * prefactor(w_{<4>},w_{<4'>})
17063  Double_t covTwoReducedFourReduced = 0.; // Cov(<2'>,<4'>)
17064  Double_t wCovTwoReducedFourReduced = 0.; // Cov(<2'>,<4'>) * prefactor(w_{<2'>},w_{<4'>})
17065  
17066  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17067  {
17068   // average reduced corelations:
17069   twoReduced = fDiffFlowCorrelationsHist[t][pe][0]->GetBinContent(b);
17070   fourReduced = fDiffFlowCorrelationsHist[t][pe][1]->GetBinContent(b);
17071   // average products:
17072   twoTwoReduced = fDiffFlowProductOfCorrelationsPro[t][pe][0][1]->GetBinContent(b);
17073   twoFourReduced = fDiffFlowProductOfCorrelationsPro[t][pe][0][3]->GetBinContent(b);
17074   fourTwoReduced = fDiffFlowProductOfCorrelationsPro[t][pe][1][2]->GetBinContent(b);
17075   fourFourReduced = fDiffFlowProductOfCorrelationsPro[t][pe][2][3]->GetBinContent(b);
17076   twoReducedFourReduced = fDiffFlowProductOfCorrelationsPro[t][pe][1][3]->GetBinContent(b);  
17077   // sum of weights for reduced correlations:
17078   sumOfWeightsForTwoReduced = fDiffFlowSumOfEventWeights[t][pe][0][0]->GetBinContent(b);
17079   sumOfWeightsForFourReduced = fDiffFlowSumOfEventWeights[t][pe][0][1]->GetBinContent(b);
17080   // products of weights for correlations:
17081   productOfWeightsForTwoTwoReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][0][1]->GetBinContent(b); 
17082   productOfWeightsForTwoFourReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][0][3]->GetBinContent(b);
17083   productOfWeightsForFourTwoReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][1][2]->GetBinContent(b);
17084   productOfWeightsForFourFourReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][2][3]->GetBinContent(b);
17085   productOfWeightsForTwoReducedFourReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][1][3]->GetBinContent(b);
17086   // denominator for the unbiased estimator for covariances: 1 - term1/(term2*term3) 
17087   // prefactor (multiplies Cov's) = term1/(term2*term3)       
17088   // <2>,<2'>:
17089   term1 = productOfWeightsForTwoTwoReduced;      
17090   term2 = sumOfWeightsForTwo;
17091   term3 = sumOfWeightsForTwoReduced;        
17092   if(term2*term3>0.)
17093   {
17094    denominator = 1.-term1/(term2*term3);
17095    prefactor = term1/(term2*term3);
17096    if(TMath::Abs(denominator)>1.e-6)
17097    {
17098     covTwoTwoReduced = (twoTwoReduced-two*twoReduced)/denominator;            
17099     wCovTwoTwoReduced = covTwoTwoReduced*prefactor; 
17100     fDiffFlowCovariances[t][pe][0]->SetBinContent(b,wCovTwoTwoReduced);
17101    }
17102   }
17103   // <2>,<4'>:
17104   term1 = productOfWeightsForTwoFourReduced;      
17105   term2 = sumOfWeightsForTwo;
17106   term3 = sumOfWeightsForFourReduced;        
17107   if(term2*term3>0.)
17108   {
17109    denominator = 1.-term1/(term2*term3);
17110    prefactor = term1/(term2*term3);
17111    if(TMath::Abs(denominator)>1.e-6)
17112    {
17113     covTwoFourReduced = (twoFourReduced-two*fourReduced)/denominator;            
17114     wCovTwoFourReduced = covTwoFourReduced*prefactor; 
17115     fDiffFlowCovariances[t][pe][1]->SetBinContent(b,wCovTwoFourReduced);
17116    }
17117   }
17118   // <4>,<2'>:
17119   term1 = productOfWeightsForFourTwoReduced;      
17120   term2 = sumOfWeightsForFour;
17121   term3 = sumOfWeightsForTwoReduced;        
17122   if(term2*term3>0.)
17123   {
17124    denominator = 1.-term1/(term2*term3);
17125    prefactor = term1/(term2*term3);
17126    if(TMath::Abs(denominator)>1.e-6)
17127    {
17128     covFourTwoReduced = (fourTwoReduced-four*twoReduced)/denominator;            
17129     wCovFourTwoReduced = covFourTwoReduced*prefactor; 
17130     fDiffFlowCovariances[t][pe][2]->SetBinContent(b,wCovFourTwoReduced);
17131    }
17132   }
17133   // <4>,<4'>:
17134   term1 = productOfWeightsForFourFourReduced;      
17135   term2 = sumOfWeightsForFour;
17136   term3 = sumOfWeightsForFourReduced;        
17137   if(term2*term3>0.)
17138   {
17139    denominator = 1.-term1/(term2*term3);
17140    prefactor = term1/(term2*term3);
17141    if(TMath::Abs(denominator)>1.e-6)
17142    {
17143     covFourFourReduced = (fourFourReduced-four*fourReduced)/denominator;            
17144     wCovFourFourReduced = covFourFourReduced*prefactor; 
17145     fDiffFlowCovariances[t][pe][3]->SetBinContent(b,wCovFourFourReduced);
17146    }
17147   }
17148   // <2'>,<4'>:
17149   term1 = productOfWeightsForTwoReducedFourReduced;      
17150   term2 = sumOfWeightsForTwoReduced;
17151   term3 = sumOfWeightsForFourReduced;        
17152   if(term2*term3>0.)
17153   {
17154    denominator = 1.-term1/(term2*term3);
17155    prefactor = term1/(term2*term3);
17156    if(TMath::Abs(denominator)>1.e-6)
17157    {
17158     covTwoReducedFourReduced = (twoReducedFourReduced-twoReduced*fourReduced)/denominator;            
17159     wCovTwoReducedFourReduced = covTwoReducedFourReduced*prefactor; 
17160     fDiffFlowCovariances[t][pe][4]->SetBinContent(b,wCovTwoReducedFourReduced);
17161    }
17162   }   
17163  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17164   
17165 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCovariances(TString type, TString ptOrEta)
17166
17167 //=======================================================================================================================
17168
17169 void AliFlowAnalysisWithQCumulants::CalculateDiffFlow(TString type, TString ptOrEta)
17170 {
17171  // Calculate final results for differential flow.
17172  
17173  // REMARK: Differential flow calculated in this method is NOT corrected for non-uniform acceptance. 
17174  // This correction, if enabled via setter SetApplyCorrectionForNUA(Bool_t), is applied in the method 
17175  // CalculateDiffFlowCorrectedForNUA(TString type, TString ptOrEta)
17176   
17177  Int_t t = 0; // RP or POI
17178  Int_t pe = 0; // pt or eta
17179
17180  if(type == "RP")
17181  {
17182   t = 0;
17183  } else if(type == "POI")
17184    {
17185     t = 1;
17186    } 
17187      
17188  if(ptOrEta == "Pt")
17189  {
17190   pe = 0;
17191  } else if(ptOrEta == "Eta")
17192    {
17193     pe = 1;
17194    } 
17195        
17196  // Common:
17197  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
17198  // Correlations:
17199  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>>
17200  Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>> 
17201  // Statistical errors of correlations:
17202  Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1);
17203  Double_t fourError = fIntFlowCorrelationsHist->GetBinError(2);   
17204  // Reduced correlations:
17205  Double_t twoReduced = 0.; // <<2'>>
17206  Double_t fourReduced = 0.; // <<4'>>
17207  // Statistical errors of reduced correlations:
17208  Double_t twoReducedError = 0.; 
17209  Double_t fourReducedError = 0.; 
17210  // Covariances:
17211  Double_t wCovTwoFour = 0.; // Cov(<2>,<4>) * prefactor(<2>,<4>)
17212  if(!fForgetAboutCovariances)
17213  {
17214   wCovTwoFour = fIntFlowCovariances->GetBinContent(1); // Cov(<2>,<4>) * prefactor(<2>,<4>)
17215  }
17216  Double_t wCovTwoTwoReduced = 0.; // Cov(<2>,<2'>) * prefactor(<2>,<2'>)
17217  Double_t wCovTwoFourReduced = 0.; // Cov(<2>,<4'>) * prefactor(<2>,<4'>)
17218  Double_t wCovFourTwoReduced = 0.; // Cov(<4>,<2'>) * prefactor(<4>,<2'>)
17219  Double_t wCovFourFourReduced = 0.; // Cov(<4>,<4'>) * prefactor(<4>,<4'>)
17220  Double_t wCovTwoReducedFourReduced = 0.; // Cov(<2'>,<4'>) * prefactor(<2'>,<4'>)
17221  // Differential flow:
17222  Double_t v2Prime = 0.; // v'{2}                   
17223  Double_t v4Prime = 0.; // v'{4}
17224  // Statistical error of differential flow:
17225  Double_t v2PrimeError = 0.;                    
17226  Double_t v4PrimeError = 0.; 
17227  // Squared statistical error of differential flow:
17228  Double_t v2PrimeErrorSquared = 0.;                    
17229  Double_t v4PrimeErrorSquared = 0.; 
17230  // Loop over pt or eta bins:
17231  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17232  {
17233   // Reduced correlations and statistical errors:
17234   twoReduced = fDiffFlowCorrelationsHist[t][pe][0]->GetBinContent(b);
17235   twoReducedError = fDiffFlowCorrelationsHist[t][pe][0]->GetBinError(b);
17236   fourReduced = fDiffFlowCorrelationsHist[t][pe][1]->GetBinContent(b);
17237   fourReducedError = fDiffFlowCorrelationsHist[t][pe][1]->GetBinError(b);
17238   // Covariances:
17239   if(!fForgetAboutCovariances)
17240   {
17241    wCovTwoTwoReduced = fDiffFlowCovariances[t][pe][0]->GetBinContent(b);
17242    wCovTwoFourReduced = fDiffFlowCovariances[t][pe][1]->GetBinContent(b);
17243    wCovFourTwoReduced = fDiffFlowCovariances[t][pe][2]->GetBinContent(b);
17244    wCovFourFourReduced = fDiffFlowCovariances[t][pe][3]->GetBinContent(b);
17245    wCovTwoReducedFourReduced = fDiffFlowCovariances[t][pe][4]->GetBinContent(b);
17246   }
17247   // Differential flow:
17248   // v'{2}:
17249   if(two>0.) 
17250   {
17251    v2Prime = twoReduced/pow(two,0.5);
17252    v2PrimeErrorSquared = (1./4.)*pow(two,-3.)*(pow(twoReduced,2.)*pow(twoError,2.)
17253                        + 4.*pow(two,2.)*pow(twoReducedError,2.)
17254                        - 4.*two*twoReduced*wCovTwoTwoReduced);
17255    if(v2PrimeErrorSquared>0.){v2PrimeError = pow(v2PrimeErrorSquared,0.5);}
17256    if(TMath::Abs(v2Prime)>0.)
17257    {
17258     fDiffFlow[t][pe][0]->SetBinContent(b,v2Prime); 
17259     fDiffFlow[t][pe][0]->SetBinError(b,v2PrimeError);    
17260    }  
17261   } // end of if(two>0.) 
17262   // differential flow:
17263   // v'{4}
17264   if(2.*pow(two,2.)-four > 0.) 
17265   {
17266    v4Prime = (2.*two*twoReduced-fourReduced)/pow(2.*pow(two,2.)-four,3./4.);
17267    v4PrimeErrorSquared = pow(2.*pow(two,2.)-four,-7./2.)
17268                        * (pow(2.*pow(two,2.)*twoReduced-3.*two*fourReduced+2.*four*twoReduced,2.)*pow(twoError,2.)
17269                        + (9./16.)*pow(2.*two*twoReduced-fourReduced,2.)*pow(fourError,2.)
17270                        + 4.*pow(two,2.)*pow(2.*pow(two,2.)-four,2.)*pow(twoReducedError,2.)
17271                        + pow(2.*pow(two,2.)-four,2.)*pow(fourReducedError,2.)                          
17272                        - (3./2.)*(2.*two*twoReduced-fourReduced)
17273                        * (2.*pow(two,2.)*twoReduced-3.*two*fourReduced+2.*four*twoReduced)*wCovTwoFour
17274                        - 4.*two*(2.*pow(two,2.)-four)
17275                        * (2.*pow(two,2.)*twoReduced-3.*two*fourReduced+2.*four*twoReduced)*wCovTwoTwoReduced
17276                        + 2.*(2.*pow(two,2.)-four)
17277                        * (2.*pow(two,2.)*twoReduced-3.*two*fourReduced+2.*four*twoReduced)*wCovTwoFourReduced
17278                        + 3.*two*(2.*pow(two,2.)-four)*(2.*two*twoReduced-fourReduced)*wCovFourTwoReduced
17279                        - (3./2.)*(2.*pow(two,2.)-four)*(2.*two*twoReduced-fourReduced)*wCovFourFourReduced 
17280                        - 4.*two*pow(2.*pow(two,2.)-four,2.)*wCovTwoReducedFourReduced);  
17281    if(v4PrimeErrorSquared>0.){v4PrimeError = pow(v4PrimeErrorSquared,0.5);}        
17282    if(TMath::Abs(v4Prime)>0.)
17283    {
17284     fDiffFlow[t][pe][1]->SetBinContent(b,v4Prime);
17285     fDiffFlow[t][pe][1]->SetBinError(b,v4PrimeError);     
17286    }
17287   } // end of if(2.*pow(two,2.)-four > 0.)  
17288  } // end of for(Int_t b=1;b<=fnBinsPtEta[pe];b++)
17289
17290 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlow(TString type, Bool_t useParticleWeights)
17291
17292 //=======================================================================================================================
17293
17294 void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlow(TString type)
17295 {
17296  // Calculate final results for 2D diferential flow.
17297
17298  // to be improved - check pointers used in this method
17299
17300  Int_t t = 0; // RP or POI
17301
17302  if(type == "RP")
17303  {
17304   t = 0;
17305  } else if(type == "POI")
17306    {
17307     t = 1;
17308    } 
17309  
17310  // Differential flow:
17311  Double_t v2Prime = 0.; // v'{2}                   
17312  Double_t v4Prime = 0.; // v'{4}
17313  // Differential cumulants:
17314  Double_t qc2Prime = 0.; // QC{2'}                   
17315  Double_t qc4Prime = 0.; // QC{4'}
17316  // Looping over all (pt,eta) bins and calculating differential flow: 
17317  for(Int_t p=1;p<=fnBinsPt;p++)
17318  {
17319   for(Int_t e=1;e<=fnBinsEta;e++)
17320   {
17321    // QC{2'}:
17322    qc2Prime = f2DDiffFlowCumulants[t][0]->GetBinContent(f2DDiffFlowCumulants[t][0]->GetBin(p,e));
17323    if(qc2Prime>=0.)
17324    {
17325     v2Prime = pow(qc2Prime,0.5);
17326     f2DDiffFlow[t][0]->SetBinContent(f2DDiffFlow[t][0]->GetBin(p,e),v2Prime); 
17327    } 
17328    // QC{4'}:
17329    qc4Prime = f2DDiffFlowCumulants[t][1]->GetBinContent(f2DDiffFlowCumulants[t][1]->GetBin(p,e));
17330    if(qc4Prime<=0.)
17331    {
17332     v4Prime = pow(-1.*qc4Prime,1./4.);
17333     f2DDiffFlow[t][1]->SetBinContent(f2DDiffFlow[t][1]->GetBin(p,e),v4Prime); 
17334    }   
17335   } // end of for(Int_t e=1;e<=fnBinsEta;e++)
17336  } // end of for(Int_t p=1;p<=fnBinsPt;p++)
17337  
17338 } // end of void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlow(TString type)  
17339
17340 //=======================================================================================================================
17341
17342 void AliFlowAnalysisWithQCumulants::StoreIntFlowFlags()
17343 {
17344  // a) Store all flags for integrated flow in profile fIntFlowFlags.
17345  
17346  if(!fIntFlowFlags)
17347  {
17348   cout<<"WARNING: fIntFlowFlags is NULL in AFAWQC::SFFIF() !!!!"<<endl;
17349   exit(0);
17350  } 
17351
17352  // particle weights used or not:
17353  fIntFlowFlags->Fill(0.5,(Int_t)fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights);
17354  // which event weights were used:
17355  if(fMultiplicityWeight->Contains("combinations"))
17356  {
17357   fIntFlowFlags->Fill(1.5,0); // 0 = "combinations" (default)
17358  } else if(fMultiplicityWeight->Contains("unit"))
17359    {
17360     fIntFlowFlags->Fill(1.5,1); // 1 = "unit"   
17361    } else if(fMultiplicityWeight->Contains("multiplicity"))
17362      {
17363       fIntFlowFlags->Fill(1.5,2); // 2 = "multiplicity"        
17364      } 
17365  fIntFlowFlags->Fill(2.5,(Int_t)fApplyCorrectionForNUA);
17366  fIntFlowFlags->Fill(3.5,(Int_t)fPrintFinalResults[0]);
17367  fIntFlowFlags->Fill(4.5,(Int_t)fPrintFinalResults[1]);
17368  fIntFlowFlags->Fill(5.5,(Int_t)fPrintFinalResults[2]);
17369  fIntFlowFlags->Fill(6.5,(Int_t)fPrintFinalResults[3]);
17370  fIntFlowFlags->Fill(7.5,(Int_t)fApplyCorrectionForNUAVsM);
17371  fIntFlowFlags->Fill(8.5,(Int_t)fPropagateErrorAlsoFromNIT);
17372  fIntFlowFlags->Fill(9.5,(Int_t)fCalculateCumulantsVsM);
17373  fIntFlowFlags->Fill(10.5,(Int_t)fMinimumBiasReferenceFlow);
17374  fIntFlowFlags->Fill(11.5,(Int_t)fForgetAboutCovariances);
17375  fIntFlowFlags->Fill(12.5,(Int_t)fStorePhiDistributionForOneEvent); 
17376  fIntFlowFlags->Fill(13.5,(Int_t)fFillMultipleControlHistograms);  
17377  fIntFlowFlags->Fill(14.5,(Int_t)fCalculateAllCorrelationsVsM);  
17378  // which multiplicity was used:
17379  if(fMultiplicityIs==AliFlowCommonConstants::kRP) // # of Reference Particles
17380  {
17381   fIntFlowFlags->Fill(15.5,0); // 0 = # of Reference Particles
17382  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
17383    {
17384     fIntFlowFlags->Fill(15.5,1); // 1 = ref. mult. from ESD
17385    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
17386      {
17387       fIntFlowFlags->Fill(15.5,2); // 2 = # of Particles of Interest
17388      } 
17389
17390 } // end of void AliFlowAnalysisWithQCumulants::StoreIntFlowFlags()
17391
17392 //=======================================================================================================================
17393
17394 void AliFlowAnalysisWithQCumulants::StoreDiffFlowFlags()
17395 {
17396  // Store all flags for differential flow in the profile fDiffFlowFlags.
17397   
17398  if(!fDiffFlowFlags)
17399  {
17400   printf("\n WARNING (QC): fDiffFlowFlags is NULL in AFAWQC::SDFF() !!!!\n\n");
17401   exit(0);
17402  } 
17403  
17404  fDiffFlowFlags->Fill(0.5,fCalculateDiffFlow); // calculate differential flow
17405  fDiffFlowFlags->Fill(1.5,fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights); // particle weights used or not?
17406  //fDiffFlowFlags->Fill(2.5,""); // which event weight was used? ("combinations", "unit" or "multiplicity") to be improved - finalized
17407  fDiffFlowFlags->Fill(3.5,fApplyCorrectionForNUA); // corrected for non-uniform acceptance or not
17408  fDiffFlowFlags->Fill(4.5,fCalculate2DDiffFlow); // calculate also 2D differential flow vs (pt,eta) 
17409  fDiffFlowFlags->Fill(5.5,fCalculateDiffFlowVsEta); // if you set kFALSE only differential flow vs pt is calculated
17410      
17411 } // end of void AliFlowAnalysisWithQCumulants::StoreDiffFlowFlags()
17412
17413 //=======================================================================================================================
17414
17415 void AliFlowAnalysisWithQCumulants::StoreMixedHarmonicsFlags()
17416 {
17417  // Store all flags for mixed harmonics in profile fMixedHarmonicsFlags.
17418  
17419  if(!fMixedHarmonicsFlags)
17420  {
17421   cout<<"WARNING: fMixedHarmonicsFlags is NULL in AFAWQC::SMHF() !!!!"<<endl;
17422   exit(0);
17423  } 
17424
17425  fMixedHarmonicsFlags->Fill(0.5,(Int_t)fCalculateMixedHarmonics);
17426  fMixedHarmonicsFlags->Fill(1.5,(Int_t)fHarmonic);
17427  fMixedHarmonicsFlags->Fill(2.5,(Int_t)fCalculateMixedHarmonicsVsM);
17428  // Which multiplicity weight was used?:
17429
17430  if(fMultiplicityWeight->Contains("combinations"))
17431  {
17432   fMixedHarmonicsFlags->Fill(3.5,0); // 0 = "combinations" (default)
17433  } else if(fMultiplicityWeight->Contains("unit"))
17434    {
17435     fMixedHarmonicsFlags->Fill(3.5,1); // 1 = "unit"   
17436    } else if(fMultiplicityWeight->Contains("multiplicity"))
17437      {
17438       fMixedHarmonicsFlags->Fill(3.5,2); // 2 = "multiplicity"        
17439      } 
17440
17441 } // end of void AliFlowAnalysisWithQCumulants::StoreMixedHarmonicsFlags()
17442
17443 //=======================================================================================================================
17444
17445 void AliFlowAnalysisWithQCumulants::GetPointersForCommonHistograms() 
17446 {
17447  // Access all pointers to common control and common result histograms and profiles.
17448  
17449  TString sCommonConstantsName = "fCommonConstants";
17450  sCommonConstantsName += fAnalysisLabel->Data();
17451  fCommonConstants = dynamic_cast<TProfile*>(fHistList->FindObject(sCommonConstantsName.Data()));
17452  if(!fCommonConstants)
17453  {
17454   printf("\n WARNING (QC): fCommonConstants is NULL in AFAWQC::GPFCH() !!!!\n\n");
17455   exit(0);
17456  }
17457  
17458  // to be improved - lines bellow can be implemented better.
17459  
17460  TString commonHistsName = "AliFlowCommonHistQC";
17461  commonHistsName += fAnalysisLabel->Data();
17462  AliFlowCommonHist *commonHist = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHistsName.Data()));
17463  if(commonHist) 
17464  {
17465   this->SetCommonHists(commonHist); 
17466   if(fCommonHists->GetHarmonic())
17467   {
17468    fHarmonic = (Int_t)(fCommonHists->GetHarmonic())->GetBinContent(1);
17469   } 
17470  } // end of if(commonHist) 
17471  TString commonHists2ndOrderName = "AliFlowCommonHist2ndOrderQC";
17472  commonHists2ndOrderName += fAnalysisLabel->Data();
17473  AliFlowCommonHist *commonHist2nd = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHists2ndOrderName.Data()));
17474  if(commonHist2nd) this->SetCommonHists2nd(commonHist2nd);   
17475  TString commonHists4thOrderName = "AliFlowCommonHist4thOrderQC";
17476  commonHists4thOrderName += fAnalysisLabel->Data();
17477  AliFlowCommonHist *commonHist4th = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHists4thOrderName.Data()));
17478  if(commonHist4th) this->SetCommonHists4th(commonHist4th);  
17479  TString commonHists6thOrderName = "AliFlowCommonHist6thOrderQC";
17480  commonHists6thOrderName += fAnalysisLabel->Data();
17481  AliFlowCommonHist *commonHist6th = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHists6thOrderName.Data()));
17482  if(commonHist6th) this->SetCommonHists6th(commonHist6th);  
17483  TString commonHists8thOrderName = "AliFlowCommonHist8thOrderQC";
17484  commonHists8thOrderName += fAnalysisLabel->Data();
17485  AliFlowCommonHist *commonHist8th = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHists8thOrderName.Data()));
17486  if(commonHist8th) this->SetCommonHists8th(commonHist8th); 
17487   
17488  TString commonHistResults2ndOrderName = "AliFlowCommonHistResults2ndOrderQC"; 
17489  commonHistResults2ndOrderName += fAnalysisLabel->Data(); 
17490  AliFlowCommonHistResults *commonHistRes2nd = dynamic_cast<AliFlowCommonHistResults*>
17491                                               (fHistList->FindObject(commonHistResults2ndOrderName.Data()));
17492  if(commonHistRes2nd) this->SetCommonHistsResults2nd(commonHistRes2nd);   
17493  TString commonHistResults4thOrderName = "AliFlowCommonHistResults4thOrderQC";
17494  commonHistResults4thOrderName += fAnalysisLabel->Data();
17495  AliFlowCommonHistResults *commonHistRes4th = dynamic_cast<AliFlowCommonHistResults*>
17496                                               (fHistList->FindObject(commonHistResults4thOrderName.Data()));
17497  if(commonHistRes4th) this->SetCommonHistsResults4th(commonHistRes4th);  
17498  TString commonHistResults6thOrderName = "AliFlowCommonHistResults6thOrderQC";
17499  commonHistResults6thOrderName += fAnalysisLabel->Data();
17500  AliFlowCommonHistResults *commonHistRes6th = dynamic_cast<AliFlowCommonHistResults*>
17501                                               (fHistList->FindObject(commonHistResults6thOrderName.Data()));
17502  if(commonHistRes6th) this->SetCommonHistsResults6th(commonHistRes6th);  
17503  TString commonHistResults8thOrderName = "AliFlowCommonHistResults8thOrderQC";
17504  commonHistResults8thOrderName += fAnalysisLabel->Data();
17505  AliFlowCommonHistResults *commonHistRes8th = dynamic_cast<AliFlowCommonHistResults*>
17506                                               (fHistList->FindObject(commonHistResults8thOrderName.Data()));  
17507  if(commonHistRes8th) this->SetCommonHistsResults8th(commonHistRes8th);
17508        
17509 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForCommonHistograms() 
17510
17511 //=======================================================================================================================
17512
17513 void AliFlowAnalysisWithQCumulants::GetPointersForParticleWeightsHistograms() 
17514 {
17515  // Get pointers for histograms with particle weights.
17516
17517  TList *weightsList = dynamic_cast<TList*>(fHistList->FindObject("Weights"));
17518  if(!weightsList){printf("\n WARNING (QC): weightsList is NULL in AFAWQC::GPFPWH() !!!!\n");exit(0);}
17519  this->SetWeightsList(weightsList);
17520  TString fUseParticleWeightsName = "fUseParticleWeightsQC"; // to be improved (hirdwired label QC)
17521  fUseParticleWeightsName += fAnalysisLabel->Data();
17522  TProfile *useParticleWeights = dynamic_cast<TProfile*>(weightsList->FindObject(fUseParticleWeightsName.Data()));
17523  if(useParticleWeights)
17524  {
17525   this->SetUseParticleWeights(useParticleWeights);  
17526   fUsePhiWeights = (Int_t)fUseParticleWeights->GetBinContent(1); 
17527   fUsePtWeights = (Int_t)fUseParticleWeights->GetBinContent(2); 
17528   fUseEtaWeights = (Int_t)fUseParticleWeights->GetBinContent(3);  
17529   fUseTrackWeights = (Int_t)fUseParticleWeights->GetBinContent(4);  
17530  }
17531 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForParticleWeightsHistograms(); 
17532
17533 //=======================================================================================================================
17534
17535 void AliFlowAnalysisWithQCumulants::GetPointersForIntFlowHistograms() 
17536 {
17537  // Get pointers for histograms and profiles relevant for integrated flow:
17538  //  a) Get pointer to base list for integrated flow holding profile fIntFlowFlags and lists fIntFlowProfiles and fIntFlowResults.
17539  //  b) Get pointer to profile fIntFlowFlags holding all flags for integrated flow.
17540  //  c) Get pointer to list fIntFlowProfiles and pointers to all objects that she holds. 
17541  //  d) Get pointer to list fIntFlowResults and pointers to all objects that she holds. 
17542   
17543  TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data member?)
17544  TString powerFlag[2] = {"linear","quadratic"}; // to be improved (should I promote this to data member?)
17545  TString correlationFlag[4] = {"#LT#LT2#GT#GT","#LT#LT4#GT#GT","#LT#LT6#GT#GT","#LT#LT8#GT#GT"}; // to be improved (should I promote this to data member?)
17546  TString squaredCorrelationFlag[4] = {"#LT#LT2#GT^{2}#GT","#LT#LT4#GT^{2}#GT","#LT#LT6#GT^{2}#GT","#LT#LT8#GT^{2}#GT"}; // to be improved (should I promote this to data member?)
17547  
17548  // a) Get pointer to base list for integrated flow holding profile fIntFlowFlags and lists fIntFlowProfiles and fIntFlowResults:
17549  TList *intFlowList = NULL;
17550  intFlowList = dynamic_cast<TList*>(fHistList->FindObject("Integrated Flow"));
17551  if(!intFlowList) 
17552  {
17553   cout<<"WARNING: intFlowList is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17554   exit(0); 
17555  }  
17556   
17557  // b) Get pointer to profile fIntFlowFlags holding all flags for integrated flow:
17558  TString intFlowFlagsName = "fIntFlowFlags";
17559  intFlowFlagsName += fAnalysisLabel->Data();
17560  TProfile *intFlowFlags = dynamic_cast<TProfile*>(intFlowList->FindObject(intFlowFlagsName.Data()));
17561  if(intFlowFlags)
17562  {
17563   this->SetIntFlowFlags(intFlowFlags);  
17564   fApplyCorrectionForNUA = (Bool_t)intFlowFlags->GetBinContent(3); 
17565   fApplyCorrectionForNUAVsM = (Bool_t)intFlowFlags->GetBinContent(8); 
17566   fCalculateCumulantsVsM = (Bool_t)intFlowFlags->GetBinContent(10);  
17567  } else 
17568    {
17569     cout<<"WARNING: intFlowFlags is NULL in FAWQC::GPFIFH() !!!!"<<endl;
17570    }
17571   
17572   // c) Get pointer to list fIntFlowProfiles and pointers to all objects that she holds:
17573   TList *intFlowProfiles = NULL;
17574   intFlowProfiles = dynamic_cast<TList*>(intFlowList->FindObject("Profiles"));
17575   if(intFlowProfiles)  
17576   {
17577    // average multiplicities:
17578    TString avMultiplicityName = "fAvMultiplicity";
17579    avMultiplicityName += fAnalysisLabel->Data();
17580    TProfile *avMultiplicity = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(avMultiplicityName.Data()));
17581    if(avMultiplicity) 
17582    {
17583     this->SetAvMultiplicity(avMultiplicity);
17584    } else 
17585      {
17586       cout<<"WARNING: avMultiplicity is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17587      }
17588    // average correlations <<2>>, <<4>>, <<6>> and <<8>> (with wrong errors!):
17589    TString intFlowCorrelationsProName = "fIntFlowCorrelationsPro";
17590    intFlowCorrelationsProName += fAnalysisLabel->Data();
17591    TProfile *intFlowCorrelationsPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowCorrelationsProName.Data()));
17592    if(intFlowCorrelationsPro) 
17593    {
17594     this->SetIntFlowCorrelationsPro(intFlowCorrelationsPro);
17595    } else 
17596      {
17597       cout<<"WARNING: intFlowCorrelationsPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17598      }      
17599    // average squared correlations <<2>^2>, <<4>^2>, <<6>^2> and <<8^2>>:
17600    TString intFlowSquaredCorrelationsProName = "fIntFlowSquaredCorrelationsPro";
17601    intFlowSquaredCorrelationsProName += fAnalysisLabel->Data();
17602    TProfile *intFlowSquaredCorrelationsPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowSquaredCorrelationsProName.Data()));
17603    if(intFlowSquaredCorrelationsPro) 
17604    {
17605     this->SetIntFlowSquaredCorrelationsPro(intFlowSquaredCorrelationsPro);
17606    } else 
17607      {
17608       cout<<"WARNING: intFlowSquaredCorrelationsPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17609      }             
17610    if(fCalculateCumulantsVsM)
17611    {
17612     // Average correlations <<2>>, <<4>>, <<6>> and <<8>> versus multiplicity for all events (error is wrong here):   
17613     TString intFlowCorrelationsVsMProName = "fIntFlowCorrelationsVsMPro";
17614     intFlowCorrelationsVsMProName += fAnalysisLabel->Data();
17615     for(Int_t ci=0;ci<4;ci++) // correlation index
17616     {
17617      TProfile *intFlowCorrelationsVsMPro = dynamic_cast<TProfile*>
17618                                         (intFlowProfiles->FindObject(Form("%s, %s",intFlowCorrelationsVsMProName.Data(),correlationFlag[ci].Data())));
17619      if(intFlowCorrelationsVsMPro)
17620      {
17621       this->SetIntFlowCorrelationsVsMPro(intFlowCorrelationsVsMPro,ci);
17622      } else
17623        {
17624         cout<<"WARNING: "<<Form("intFlowCorrelationsVsMPro[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17625        }   
17626     } // end of for(Int_t ci=0;ci<4;ci++) // correlation index 
17627     // Average squared correlations <<2>^2>, <<4>^2>, <<6>^2> and <<8>^2> versus multiplicity for all events:   
17628     TString intFlowSquaredCorrelationsVsMProName = "fIntFlowSquaredCorrelationsVsMPro";
17629     intFlowSquaredCorrelationsVsMProName += fAnalysisLabel->Data();
17630     for(Int_t ci=0;ci<4;ci++) // correlation index
17631     {
17632      TProfile *intFlowSquaredCorrelationsVsMPro = dynamic_cast<TProfile*>
17633                       (intFlowProfiles->FindObject(Form("%s, %s",intFlowSquaredCorrelationsVsMProName.Data(),squaredCorrelationFlag[ci].Data())));
17634      if(intFlowSquaredCorrelationsVsMPro)
17635      {
17636       this->SetIntFlowSquaredCorrelationsVsMPro(intFlowSquaredCorrelationsVsMPro,ci);
17637      } else
17638        {
17639         cout<<"WARNING: "<<Form("intFlowSquaredCorrelationsVsMPro[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17640        }   
17641     } // end of for(Int_t ci=0;ci<4;ci++) // correlation index 
17642    } // end of if(fCalculateCumulantsVsM)
17643    // average all correlations for integrated flow (with wrong errors!):
17644    TString intFlowCorrelationsAllProName = "fIntFlowCorrelationsAllPro";
17645    intFlowCorrelationsAllProName += fAnalysisLabel->Data();
17646    TProfile *intFlowCorrelationsAllPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowCorrelationsAllProName.Data()));
17647    if(intFlowCorrelationsAllPro) 
17648    {
17649     this->SetIntFlowCorrelationsAllPro(intFlowCorrelationsAllPro);
17650    } else 
17651      {
17652       cout<<"WARNING: intFlowCorrelationsAllPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17653      }     
17654    // average extra correlations for integrated flow (which appear only when particle weights are used):
17655    // (to be improved: Weak point in implementation, I am assuming here that method GetPointersForParticleWeightsHistograms() was called)
17656    if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
17657    {
17658     TString intFlowExtraCorrelationsProName = "fIntFlowExtraCorrelationsPro";
17659     intFlowExtraCorrelationsProName += fAnalysisLabel->Data();
17660     TProfile *intFlowExtraCorrelationsPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowExtraCorrelationsProName.Data()));
17661     if(intFlowExtraCorrelationsPro) 
17662     {
17663      this->SetIntFlowExtraCorrelationsPro(intFlowExtraCorrelationsPro);
17664     } else 
17665       {
17666        cout<<"WARNING: intFlowExtraCorrelationsPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17667       }
17668    } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)        
17669    // average products of correlations <2>, <4>, <6> and <8>:  
17670    TString intFlowProductOfCorrelationsProName = "fIntFlowProductOfCorrelationsPro";
17671    intFlowProductOfCorrelationsProName += fAnalysisLabel->Data();
17672    TProfile *intFlowProductOfCorrelationsPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowProductOfCorrelationsProName.Data()));
17673    if(intFlowProductOfCorrelationsPro) 
17674    {
17675     this->SetIntFlowProductOfCorrelationsPro(intFlowProductOfCorrelationsPro);
17676    } else 
17677      {
17678       cout<<"WARNING: intFlowProductOfCorrelationsPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17679      }               
17680    // average product of correlations <2>, <4>, <6> and <8> versus multiplicity  
17681    // [0=<<2><4>>,1=<<2><6>>,2=<<2><8>>,3=<<4><6>>,4=<<4><8>>,5=<<6><8>>]  
17682    if(fCalculateCumulantsVsM)
17683    {
17684     TString intFlowProductOfCorrelationsVsMProName = "fIntFlowProductOfCorrelationsVsMPro";
17685     intFlowProductOfCorrelationsVsMProName += fAnalysisLabel->Data();
17686     TString productFlag[6] = {"#LT#LT2#GT#LT4#GT#GT","#LT#LT2#GT#LT6#GT#GT","#LT#LT2#GT#LT8#GT#GT",
17687                               "#LT#LT4#GT#LT6#GT#GT","#LT#LT4#GT#LT8#GT#GT","#LT#LT6#GT#LT8#GT#GT"};
17688     for(Int_t pi=0;pi<6;pi++)
17689     { 
17690      TProfile *intFlowProductOfCorrelationsVsMPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(Form("%s, %s",intFlowProductOfCorrelationsVsMProName.Data(),productFlag[pi].Data())));
17691      if(intFlowProductOfCorrelationsVsMPro)
17692      {
17693       this->SetIntFlowProductOfCorrelationsVsMPro(intFlowProductOfCorrelationsVsMPro,pi);
17694      } else
17695        {
17696         cout<<"WARNING: "<<Form("intFlowProductOfCorrelationsVsMPro[%d]",pi)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17697        }
17698     } // end of for(Int_t pi=0;pi<6;pi++)
17699    } // end of if(fCalculateCumulantsVsM)
17700    // average correction terms for non-uniform acceptance (with wrong errors!):
17701    for(Int_t sc=0;sc<2;sc++)
17702    {
17703     TString intFlowCorrectionTermsForNUAProName = "fIntFlowCorrectionTermsForNUAPro";
17704     intFlowCorrectionTermsForNUAProName += fAnalysisLabel->Data();
17705     TProfile *intFlowCorrectionTermsForNUAPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject((Form("%s: %s terms",intFlowCorrectionTermsForNUAProName.Data(),sinCosFlag[sc].Data()))));
17706     if(intFlowCorrectionTermsForNUAPro) 
17707     {
17708      this->SetIntFlowCorrectionTermsForNUAPro(intFlowCorrectionTermsForNUAPro,sc);
17709     } else 
17710       {
17711        cout<<"WARNING: intFlowCorrectionTermsForNUAPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17712        cout<<"sc = "<<sc<<endl;
17713       } 
17714     // versus multiplicity:
17715     if(fCalculateCumulantsVsM)
17716     {
17717      TString correctionTermFlag[4] = {"(n(phi1))","(n(phi1+phi2))","(n(phi1-phi2-phi3))","(n(2phi1-phi2))"}; // to be improved - hardwired 4
17718      TString intFlowCorrectionTermsForNUAVsMProName = "fIntFlowCorrectionTermsForNUAVsMPro";
17719      intFlowCorrectionTermsForNUAVsMProName += fAnalysisLabel->Data();
17720      for(Int_t ci=0;ci<4;ci++) // correction term index (to be improved - hardwired 4)
17721      {
17722       TProfile *intFlowCorrectionTermsForNUAVsMPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(Form("%s: #LT#LT%s%s#GT#GT",intFlowCorrectionTermsForNUAVsMProName.Data(),sinCosFlag[sc].Data(),correctionTermFlag[ci].Data())));
17723       if(intFlowCorrectionTermsForNUAVsMPro) 
17724       {
17725        this->SetIntFlowCorrectionTermsForNUAVsMPro(intFlowCorrectionTermsForNUAVsMPro,sc,ci);
17726       } else 
17727         {
17728          cout<<"WARNING: intFlowCorrectionTermsForNUAVsMPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17729          cout<<"sc = "<<sc<<endl;
17730          cout<<"ci = "<<ci<<endl;
17731         }       
17732      } // end of for(Int_t ci=0;ci<4;ci++) // correction term index (to be improved - hardwired 4)
17733     } // end of if(fCalculateCumulantsVsM)
17734    } // end of for(Int_t sc=0;sc<2;sc++)           
17735    // average products of correction terms for NUA:  
17736    TString intFlowProductOfCorrectionTermsForNUAProName = "fIntFlowProductOfCorrectionTermsForNUAPro";
17737    intFlowProductOfCorrectionTermsForNUAProName += fAnalysisLabel->Data();
17738    TProfile *intFlowProductOfCorrectionTermsForNUAPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowProductOfCorrectionTermsForNUAProName.Data()));
17739    if(intFlowProductOfCorrectionTermsForNUAPro) 
17740    {
17741     this->SetIntFlowProductOfCorrectionTermsForNUAPro(intFlowProductOfCorrectionTermsForNUAPro);
17742    } else 
17743      {
17744       cout<<"WARNING: intFlowProductOfCorrectionTermsForNUAPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17745      }     
17746   } else // to if(intFlowProfiles)  
17747     {
17748      cout<<"WARNING: intFlowProfiles is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17749     }
17750    
17751   //  d) Get pointer to list fIntFlowResults and pointers to all objects that she holds. 
17752   TList *intFlowResults = NULL;
17753   intFlowResults = dynamic_cast<TList*>(intFlowList->FindObject("Results"));
17754   if(intFlowResults)
17755   {
17756    // average correlations <<2>>, <<4>>, <<6>> and <<8>> (with correct errors!):
17757    TString intFlowCorrelationsHistName = "fIntFlowCorrelationsHist";
17758    intFlowCorrelationsHistName += fAnalysisLabel->Data();
17759    TH1D *intFlowCorrelationsHist = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowCorrelationsHistName.Data()));
17760    if(intFlowCorrelationsHist) 
17761    {
17762     this->SetIntFlowCorrelationsHist(intFlowCorrelationsHist);
17763    } else 
17764      {
17765       cout<<"WARNING: intFlowCorrelationsHist is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17766      } 
17767    // average correlations <<2>>, <<4>>, <<6>> and <<8>> (with correct errors!) vs M:    
17768    if(fCalculateCumulantsVsM)
17769    {
17770     TString intFlowCorrelationsVsMHistName = "fIntFlowCorrelationsVsMHist";
17771     intFlowCorrelationsVsMHistName += fAnalysisLabel->Data();
17772     for(Int_t ci=0;ci<4;ci++) // correlation index
17773     {
17774      TH1D *intFlowCorrelationsVsMHist = dynamic_cast<TH1D*>
17775                                         (intFlowResults->FindObject(Form("%s, %s",intFlowCorrelationsVsMHistName.Data(),correlationFlag[ci].Data())));
17776      if(intFlowCorrelationsVsMHist)
17777      {
17778       this->SetIntFlowCorrelationsVsMHist(intFlowCorrelationsVsMHist,ci);
17779      } else
17780        {
17781         cout<<"WARNING: "<<Form("intFlowCorrelationsVsMHist[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17782        }   
17783     } // end of for(Int_t ci=0;ci<4;ci++) // correlation index   
17784    } // end of if(fCalculateCumulantsVsM)
17785    // average all correlations for integrated flow (with correct errors!):
17786    TString intFlowCorrelationsAllHistName = "fIntFlowCorrelationsAllHist";
17787    intFlowCorrelationsAllHistName += fAnalysisLabel->Data();
17788    TH1D *intFlowCorrelationsAllHist = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowCorrelationsAllHistName.Data()));
17789    if(intFlowCorrelationsAllHist) 
17790    {
17791     this->SetIntFlowCorrelationsAllHist(intFlowCorrelationsAllHist);
17792    } else 
17793      {
17794       cout<<"WARNING: intFlowCorrelationsAllHist is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17795      }  
17796    // average correction terms for non-uniform acceptance (with correct errors!):
17797    TString intFlowCorrectionTermsForNUAHistName = "fIntFlowCorrectionTermsForNUAHist";
17798    intFlowCorrectionTermsForNUAHistName += fAnalysisLabel->Data();
17799    for(Int_t sc=0;sc<2;sc++)
17800    {
17801     TH1D *intFlowCorrectionTermsForNUAHist = dynamic_cast<TH1D*>(intFlowResults->FindObject((Form("%s: %s terms",intFlowCorrectionTermsForNUAHistName.Data(),sinCosFlag[sc].Data()))));
17802     if(intFlowCorrectionTermsForNUAHist) 
17803     {
17804      this->SetIntFlowCorrectionTermsForNUAHist(intFlowCorrectionTermsForNUAHist,sc);
17805     } else 
17806       {
17807        cout<<"WARNING: intFlowCorrectionTermsForNUAHist is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17808        cout<<"sc = "<<sc<<endl;
17809       } 
17810    } // end of for(Int_t sc=0;sc<2;sc++)           
17811    // covariances (multiplied with weight dependent prefactor):
17812    TString intFlowCovariancesName = "fIntFlowCovariances";
17813    intFlowCovariancesName += fAnalysisLabel->Data();
17814    TH1D *intFlowCovariances = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowCovariancesName.Data()));
17815    if(intFlowCovariances) 
17816    {
17817     this->SetIntFlowCovariances(intFlowCovariances); 
17818    } else 
17819      {
17820       cout<<"WARNING: intFlowCovariances is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17821      } 
17822    // sum of linear and quadratic event weights for <2>, <4>, <6> and <8>:
17823    TString intFlowSumOfEventWeightsName = "fIntFlowSumOfEventWeights";
17824    intFlowSumOfEventWeightsName += fAnalysisLabel->Data();
17825    for(Int_t power=0;power<2;power++)
17826    {
17827     TH1D *intFlowSumOfEventWeights = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s: %s",intFlowSumOfEventWeightsName.Data(),powerFlag[power].Data())));
17828     if(intFlowSumOfEventWeights) 
17829     {
17830      this->SetIntFlowSumOfEventWeights(intFlowSumOfEventWeights,power);
17831     } else 
17832       {
17833        cout<<"WARNING: intFlowSumOfEventWeights is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17834        cout<<"power = "<<power<<endl;
17835       }                                   
17836    } // end of for(Int_t power=0;power<2;power++)                                                                  
17837    // sum of products of event weights for correlations <2>, <4>, <6> and <8>:  
17838    TString intFlowSumOfProductOfEventWeightsName = "fIntFlowSumOfProductOfEventWeights";
17839    intFlowSumOfProductOfEventWeightsName += fAnalysisLabel->Data();
17840    TH1D *intFlowSumOfProductOfEventWeights = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowSumOfProductOfEventWeightsName.Data()));
17841    if(intFlowSumOfProductOfEventWeights) 
17842    {
17843     this->SetIntFlowSumOfProductOfEventWeights(intFlowSumOfProductOfEventWeights);
17844    } else 
17845      {
17846       cout<<"WARNING: intFlowSumOfProductOfEventWeights is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17847      } 
17848    // final result for covariances of correlations (multiplied with weight dependent prefactor) versus M
17849    // [0=Cov(2,4),1=Cov(2,6),2=Cov(2,8),3=Cov(4,6),4=Cov(4,8),5=Cov(6,8)]:
17850    if(fCalculateCumulantsVsM)
17851    {
17852     TString intFlowCovariancesVsMName = "fIntFlowCovariancesVsM";
17853     intFlowCovariancesVsMName += fAnalysisLabel->Data();
17854     TString covarianceFlag[6] = {"Cov(<2>,<4>)","Cov(<2>,<6>)","Cov(<2>,<8>)","Cov(<4>,<6>)","Cov(<4>,<8>)","Cov(<6>,<8>)"};
17855     for(Int_t ci=0;ci<6;ci++)
17856     { 
17857      TH1D *intFlowCovariancesVsM = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s, %s",intFlowCovariancesVsMName.Data(),covarianceFlag[ci].Data())));
17858      if(intFlowCovariancesVsM)
17859      {
17860       this->SetIntFlowCovariancesVsM(intFlowCovariancesVsM,ci);
17861      } else
17862        {
17863         cout<<"WARNING: "<<Form("intFlowCovariancesVsM[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17864        }    
17865     } // end of for(Int_t ci=0;ci<6;ci++)
17866    } // end of if(fCalculateCumulantsVsM)
17867    // sum of linear and quadratic event weights for <2>, <4>, <6> and <8> versus multiplicity
17868    // [0=sum{w_{<2>}},1=sum{w_{<4>}},2=sum{w_{<6>}},3=sum{w_{<8>}}][0=linear 1,1=quadratic]:
17869    if(fCalculateCumulantsVsM)
17870    {
17871     TString intFlowSumOfEventWeightsVsMName = "fIntFlowSumOfEventWeightsVsM";
17872     intFlowSumOfEventWeightsVsMName += fAnalysisLabel->Data();
17873     TString sumFlag[2][4] = {{"#sum_{i=1}^{N} w_{<2>}","#sum_{i=1}^{N} w_{<4>}","#sum_{i=1}^{N} w_{<6>}","#sum_{i=1}^{N} w_{<8>}"},
17874                              {"#sum_{i=1}^{N} w_{<2>}^{2}","#sum_{i=1}^{N} w_{<4>}^{2}","#sum_{i=1}^{N} w_{<6>}^{2}","#sum_{i=1}^{N} w_{<8>}^{2}"}};
17875     for(Int_t si=0;si<4;si++)
17876     {
17877      for(Int_t power=0;power<2;power++)
17878      {
17879       TH1D *intFlowSumOfEventWeightsVsM = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s, %s",intFlowSumOfEventWeightsVsMName.Data(),sumFlag[power][si].Data())));
17880       if(intFlowSumOfEventWeightsVsM)
17881       {
17882        this->SetIntFlowSumOfEventWeightsVsM(intFlowSumOfEventWeightsVsM,si,power);
17883       } else
17884         {
17885          cout<<"WARNING: "<<Form("intFlowSumOfEventWeightsVsM[%d][%d]",si,power)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17886         }    
17887      } // end of for(Int_t power=0;power<2;power++)
17888     } // end of for(Int_t si=0;si<4;si++)   
17889    } // end of if(fCalculateCumulantsVsM)
17890    // sum of products of event weights for correlations <2>, <4>, <6> and <8> vs M
17891    // [0=sum{w_{<2>}w_{<4>}},1=sum{w_{<2>}w_{<6>}},2=sum{w_{<2>}w_{<8>}},
17892    //  3=sum{w_{<4>}w_{<6>}},4=sum{w_{<4>}w_{<8>}},5=sum{w_{<6>}w_{<8>}}]:  
17893    if(fCalculateCumulantsVsM)
17894    {
17895     TString intFlowSumOfProductOfEventWeightsVsMName = "fIntFlowSumOfProductOfEventWeightsVsM";
17896     intFlowSumOfProductOfEventWeightsVsMName += fAnalysisLabel->Data();
17897     TString sopowFlag[6] = {"#sum_{i=1}^{N} w_{<2>} w_{<4>}","#sum_{i=1}^{N} w_{<2>} w_{<6>}","#sum_{i=1}^{N} w_{<2>} w_{<8>}",
17898                             "#sum_{i=1}^{N} w_{<4>} w_{<6>}","#sum_{i=1}^{N} w_{<4>} w_{<8>}","#sum_{i=1}^{N} w_{<6>} w_{<8>}"}; 
17899     for(Int_t pi=0;pi<6;pi++)
17900     {
17901      TH1D *intFlowSumOfProductOfEventWeightsVsM = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s, %s",intFlowSumOfProductOfEventWeightsVsMName.Data(),sopowFlag[pi].Data())));
17902      if(intFlowSumOfProductOfEventWeightsVsM)
17903      {
17904       this->SetIntFlowSumOfProductOfEventWeightsVsM(intFlowSumOfProductOfEventWeightsVsM,pi);
17905      } else
17906        {
17907         cout<<"WARNING: "<<Form("intFlowSumOfProductOfEventWeightsVsM[%d]",pi)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17908        }
17909     } // end of for(Int_t pi=0;pi<6;pi++)        
17910    } // end of if(fCalculateCumulantsVsM)
17911    // covariances for NUA (multiplied with weight dependent prefactor):
17912    TString intFlowCovariancesNUAName = "fIntFlowCovariancesNUA";
17913    intFlowCovariancesNUAName += fAnalysisLabel->Data();
17914    TH1D *intFlowCovariancesNUA = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowCovariancesNUAName.Data()));
17915    if(intFlowCovariancesNUA) 
17916    {
17917     this->SetIntFlowCovariancesNUA(intFlowCovariancesNUA); 
17918    } else 
17919      {
17920       cout<<"WARNING: intFlowCovariancesNUA is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17921      } 
17922    // sum of linear and quadratic event weights NUA terms:
17923    TString intFlowSumOfEventWeightsNUAName = "fIntFlowSumOfEventWeightsNUA";
17924    intFlowSumOfEventWeightsNUAName += fAnalysisLabel->Data();
17925    for(Int_t sc=0;sc<2;sc++)
17926    {
17927     for(Int_t power=0;power<2;power++)
17928     {
17929      TH1D *intFlowSumOfEventWeightsNUA = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s: %s, %s",intFlowSumOfEventWeightsNUAName.Data(),powerFlag[power].Data(),sinCosFlag[sc].Data())));
17930      if(intFlowSumOfEventWeightsNUA) 
17931      {
17932       this->SetIntFlowSumOfEventWeightsNUA(intFlowSumOfEventWeightsNUA,sc,power);
17933      } else 
17934        {
17935         cout<<"WARNING: intFlowSumOfEventWeightsNUA is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17936         cout<<"sc    = "<<sc<<endl;
17937         cout<<"power = "<<power<<endl;
17938        }                                   
17939     } // end of for(Int_t power=0;power<2;power++)                                                                  
17940    } // end of for(Int_t sc=0;sc<2;sc++)     
17941    // sum of products of event weights for NUA terms:  
17942    TString intFlowSumOfProductOfEventWeightsNUAName = "fIntFlowSumOfProductOfEventWeightsNUA";
17943    intFlowSumOfProductOfEventWeightsNUAName += fAnalysisLabel->Data();
17944    TH1D *intFlowSumOfProductOfEventWeightsNUA = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowSumOfProductOfEventWeightsNUAName.Data()));
17945    if(intFlowSumOfProductOfEventWeightsNUA) 
17946    {
17947     this->SetIntFlowSumOfProductOfEventWeightsNUA(intFlowSumOfProductOfEventWeightsNUA);
17948    } else 
17949      {
17950       cout<<"WARNING: intFlowSumOfProductOfEventWeightsNUA is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17951      } 
17952    // Final results for reference Q-cumulants:
17953    TString intFlowQcumulantsName = "fIntFlowQcumulants";
17954    intFlowQcumulantsName += fAnalysisLabel->Data();
17955    TH1D *intFlowQcumulants = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowQcumulantsName.Data()));
17956    if(intFlowQcumulants) 
17957    {
17958     this->SetIntFlowQcumulants(intFlowQcumulants);
17959    } else 
17960      {
17961       cout<<"WARNING: intFlowQcumulants is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17962      }  
17963    // Final results for reference Q-cumulants rebinned in M:
17964    if(fCalculateCumulantsVsM)
17965    {
17966     TString intFlowQcumulantsRebinnedInMName = "fIntFlowQcumulantsRebinnedInM";
17967     intFlowQcumulantsRebinnedInMName += fAnalysisLabel->Data();
17968     TH1D *intFlowQcumulantsRebinnedInM = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowQcumulantsRebinnedInMName.Data()));
17969     if(intFlowQcumulantsRebinnedInM) 
17970     {
17971      this->SetIntFlowQcumulantsRebinnedInM(intFlowQcumulantsRebinnedInM);
17972     } else 
17973       {
17974        cout<<"WARNING: intFlowQcumulantsRebinnedInM is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17975       }  
17976    } // end of if(fCalculateCumulantsVsM)
17977    // Ratio between error squared: with/without non-isotropic terms:
17978    TString intFlowQcumulantsErrorSquaredRatioName = "fIntFlowQcumulantsErrorSquaredRatio";
17979    intFlowQcumulantsErrorSquaredRatioName += fAnalysisLabel->Data();
17980    TH1D *intFlowQcumulantsErrorSquaredRatio = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowQcumulantsErrorSquaredRatioName.Data()));
17981    if(intFlowQcumulantsErrorSquaredRatio) 
17982    {
17983     this->SetIntFlowQcumulantsErrorSquaredRatio(intFlowQcumulantsErrorSquaredRatio);
17984    } else 
17985      {
17986       cout<<" WARNING: intntFlowQcumulantsErrorSquaredRatio is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17987      }  
17988    // final results for integrated Q-cumulants versus multiplicity:
17989    TString cumulantFlag[4] = {"QC{2}","QC{4}","QC{6}","QC{8}"};
17990    if(fCalculateCumulantsVsM)
17991    {
17992     TString intFlowQcumulantsVsMName = "fIntFlowQcumulantsVsM";
17993     intFlowQcumulantsVsMName += fAnalysisLabel->Data();
17994     for(Int_t co=0;co<4;co++) // cumulant order
17995     {
17996      TH1D *intFlowQcumulantsVsM = dynamic_cast<TH1D*>
17997                                   (intFlowResults->FindObject(Form("%s, %s",intFlowQcumulantsVsMName.Data(),cumulantFlag[co].Data())));
17998      if(intFlowQcumulantsVsM)
17999      {
18000       this->SetIntFlowQcumulantsVsM(intFlowQcumulantsVsM,co);
18001      } else
18002        {
18003         cout<<"WARNING: "<<Form("intFlowQcumulantsVsM[%d]",co)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18004        }
18005     } // end of for(Int_t co=0;co<4;co++) // cumulant order
18006    } // end of if(fCalculateCumulantsVsM)
18007    // Final reference flow estimates from Q-cumulants:
18008    TString intFlowName = "fIntFlow";
18009    intFlowName += fAnalysisLabel->Data();
18010    TH1D *intFlow = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowName.Data()));
18011    if(intFlow) 
18012    {
18013     this->SetIntFlow(intFlow);
18014    } else 
18015      {
18016       cout<<"WARNING: intFlow is NULL in AFAWQC::GPFIFH() !!!!"<<endl; 
18017      } 
18018    // Final reference flow estimates from Q-cumulants vs M rebinned in M:
18019    if(fCalculateCumulantsVsM)
18020    {
18021     TString intFlowRebinnedInMName = "fIntFlowRebinnedInM";
18022     intFlowRebinnedInMName += fAnalysisLabel->Data();
18023     TH1D *intFlowRebinnedInM = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowRebinnedInMName.Data()));
18024     if(intFlowRebinnedInM) 
18025     {
18026      this->SetIntFlowRebinnedInM(intFlowRebinnedInM);
18027     } else 
18028       {
18029        cout<<"WARNING: intFlowRebinnedInM is NULL in AFAWQC::GPFIFH() !!!!"<<endl; 
18030       } 
18031    } // end of if(fCalculateCumulantsVsM)
18032    // integrated flow from Q-cumulants versus multiplicity:
18033    if(fCalculateCumulantsVsM)
18034    {
18035     TString intFlowVsMName = "fIntFlowVsM";
18036     intFlowVsMName += fAnalysisLabel->Data();
18037     TString flowFlag[4] = {Form("v_{%d}{2,QC}",fHarmonic),Form("v_{%d}{4,QC}",fHarmonic),Form("v_{%d}{6,QC}",fHarmonic),Form("v_{%d}{8,QC}",fHarmonic)};
18038     for(Int_t co=0;co<4;co++) // cumulant order
18039     {
18040      TH1D *intFlowVsM = dynamic_cast<TH1D*>
18041                         (intFlowResults->FindObject(Form("%s, %s",intFlowVsMName.Data(),flowFlag[co].Data())));            
18042      if(intFlowVsM)
18043      {
18044       this->SetIntFlowVsM(intFlowVsM,co);
18045      } else
18046        {
18047         cout<<"WARNING: "<<Form("intFlowVsM[%d]",co)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;      
18048        }
18049     } // end of for(Int_t co=0;co<4;co++) // cumulant order
18050    } // end of if(fCalculateCumulantsVsM)
18051    // quantifying detector effects effects to correlations:
18052    TString intFlowDetectorBiasName = "fIntFlowDetectorBias";
18053    intFlowDetectorBiasName += fAnalysisLabel->Data();
18054    TH1D *intFlowDetectorBias = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowDetectorBiasName.Data()));
18055    if(intFlowDetectorBias) 
18056    {
18057     this->SetIntFlowDetectorBias(intFlowDetectorBias);
18058    } else 
18059      {
18060       cout<<"WARNING: intFlowDetectorBias is NULL in AFAWQC::GPFIFH() !!!!"<<endl; 
18061      } 
18062    // quantifying detector effects effects to correlations vs multiplicity:
18063    if(fCalculateCumulantsVsM)
18064    {
18065     TString intFlowDetectorBiasVsMName = "fIntFlowDetectorBiasVsM";
18066     intFlowDetectorBiasVsMName += fAnalysisLabel->Data();
18067     for(Int_t ci=0;ci<4;ci++) // correlation index
18068     {
18069      TH1D *intFlowDetectorBiasVsM = dynamic_cast<TH1D*>
18070                                     (intFlowResults->FindObject(Form("%s for %s",intFlowDetectorBiasVsMName.Data(),cumulantFlag[ci].Data())));
18071      if(intFlowDetectorBiasVsM)
18072      {
18073       this->SetIntFlowDetectorBiasVsM(intFlowDetectorBiasVsM,ci);
18074      } else
18075        {
18076         cout<<"WARNING: "<<Form("intFlowDetectorBiasVsM[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;      
18077        }
18078     } // end of for(Int_t ci=0;ci<4;ci++) // correlation index   
18079    } // end of if(fCalculateCumulantsVsM)
18080   } else // to if(intFlowResults)
18081     {
18082      cout<<"WARNING: intFlowResults is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18083     }
18084     
18085 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForIntFlowHistograms()
18086
18087 //=======================================================================================================================
18088
18089 void AliFlowAnalysisWithQCumulants::GetPointersFor2DDiffFlowHistograms()
18090 {
18091  // Get pointers for 2D differential flow histograms.
18092  //  a) Check pointers used in this method;
18093  //  b) Get pointers to 2D differential flow lists;
18094  //  c) Get pointers to 2D differential flow profiles;
18095  //  d) Get pointers to 2D differential flow histograms. 
18096
18097  // a) Check pointers used in this method:
18098  if(!fDiffFlowList)
18099  { 
18100   printf("\n WARNING (QC): fDiffFlowList is NULL in AFAWQC::GPF2DDFH() !!!!\n");
18101   printf("               Call method GetPointersForDiffFlowHistograms() first.\n\n");
18102   exit(0);
18103  }
18104  if(!fDiffFlowFlags)
18105  { 
18106   printf("\n WARNING (QC): fDiffFlowFlags is NULL in AFAWQC::GPF2DDFH() !!!!\n\n");
18107   printf("               Call method GetPointersForDiffFlowHistograms() first.\n\n");
18108   exit(0);
18109  }
18110  
18111  // b) Get pointers to 2D differential flow lists:
18112  this->SetCalculate2DDiffFlow((Bool_t)fDiffFlowFlags->GetBinContent(5)); // to be improved - hardwired 5
18113  if(!fCalculate2DDiffFlow){return;}
18114  TString typeFlag[2] = {"RP","POI"}; 
18115  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"};
18116  TString differentialCumulantIndex[4] = {"QC{2'}","QC{4'}","QC{6'}","QC{8'}"};  
18117  TString differentialFlowIndex[4] = {"v'{2}","v'{4}","v'{6}","v'{8}"};  
18118  // Base list: 
18119  TString diffFlow2DListName = "2D"; 
18120  diffFlow2DListName += fAnalysisLabel->Data();
18121  fDiffFlow2D = dynamic_cast<TList*>(fDiffFlowList->FindObject(diffFlow2DListName.Data()));
18122  if(!fDiffFlow2D)
18123  { 
18124   printf("\n WARNING (QC): fDiffFlow2D is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18125   exit(0);
18126  }
18127  // Lists holding profiles with 2D correlations: 
18128  TString s2DDiffFlowCorrelationsProListName = "Profiles with 2D correlations"; 
18129  s2DDiffFlowCorrelationsProListName += fAnalysisLabel->Data(); // to be improved
18130  for(Int_t t=0;t<2;t++)
18131  {
18132   f2DDiffFlowCorrelationsProList[t] = dynamic_cast<TList*>(fDiffFlow2D->FindObject(Form("Profiles with 2D correlations (%s)",typeFlag[t].Data())));
18133   if(!f2DDiffFlowCorrelationsProList[t])
18134   { 
18135    printf("\n WARNING (QC): f2DDiffFlowCorrelationsProList[%i] is NULL in AFAWQC::GPF2DFH() !!!!\n\n",t);
18136    exit(0);
18137   }
18138  } // end of for(Int_t t=0;t<2;t++) 
18139  
18140  // c) Get pointers to 2D differential flow profiles:
18141  TString s2DDiffFlowCorrelationsProName = "f2DDiffFlowCorrelationsPro";
18142  s2DDiffFlowCorrelationsProName += fAnalysisLabel->Data();
18143  for(Int_t t=0;t<2;t++) // type: RP or POI
18144  { 
18145   for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18146   {
18147    f2DDiffFlowCorrelationsPro[t][rci] = dynamic_cast<TProfile2D*>(f2DDiffFlowCorrelationsProList[t]->FindObject(Form("%s, %s, %s",s2DDiffFlowCorrelationsProName.Data(),typeFlag[t].Data(),reducedCorrelationIndex[rci].Data())));
18148    if(!f2DDiffFlowCorrelationsPro[t][rci])
18149    {
18150     printf("\n WARNING (QC): f2DDiffFlowCorrelationsPro[%i][%i] is NULL in AFAWQC::GPF2DFH() !!!!\n\n",t,rci);
18151     exit(0);   
18152    } else
18153      {
18154       this->Set2DDiffFlowCorrelationsPro(f2DDiffFlowCorrelationsPro[t][rci],t,rci);
18155      } 
18156   } // end of for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18157  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI 
18158
18159  // d) Get pointers to 2D differential flow histograms: 
18160  TString s2DDiffFlowCumulantsName = "f2DDiffFlowCumulants";
18161  s2DDiffFlowCumulantsName += fAnalysisLabel->Data();
18162  TString s2DDiffFlowName = "f2DDiffFlow";
18163  s2DDiffFlowName += fAnalysisLabel->Data();
18164  for(Int_t t=0;t<2;t++) // type: RP or POI
18165  { 
18166   for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18167   {
18168    // 2D differential cumulants:
18169    f2DDiffFlowCumulants[t][rci] = dynamic_cast<TH2D*>(f2DDiffFlowCorrelationsProList[t]->FindObject(Form("%s, %s, %s",s2DDiffFlowCumulantsName.Data(),typeFlag[t].Data(),differentialCumulantIndex[rci].Data())));
18170    if(!f2DDiffFlowCumulants[t][rci])
18171    {
18172     printf("\n WARNING (QC): f2DDiffFlowCumulants[%i][%i] is NULL in AFAWQC::GPF2DFH() !!!!\n\n",t,rci);
18173     exit(0);   
18174    } else
18175      {
18176       this->Set2DDiffFlowCumulants(f2DDiffFlowCumulants[t][rci],t,rci);
18177      } 
18178    // 2D differential flow:
18179    f2DDiffFlow[t][rci] = dynamic_cast<TH2D*>(f2DDiffFlowCorrelationsProList[t]->FindObject(Form("%s, %s, %s",s2DDiffFlowName.Data(),typeFlag[t].Data(),differentialFlowIndex[rci].Data())));
18180    if(!f2DDiffFlow[t][rci])
18181    {
18182     printf("\n WARNING (QC): f2DDiffFlow[%i][%i] is NULL in AFAWQC::GPF2DFH() !!!!\n\n",t,rci);
18183     exit(0);   
18184    } else
18185      {
18186       this->Set2DDiffFlow(f2DDiffFlow[t][rci],t,rci);
18187      } 
18188   } // end of for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18189  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI 
18190   
18191 } // end of void AliFlowAnalysisWithQCumulants::GetPointersFor2DDiffFlowHistograms()
18192
18193 //=======================================================================================================================
18194
18195 void AliFlowAnalysisWithQCumulants::GetPointersForOtherDiffCorrelators()
18196 {
18197  // Get pointers for other differential correlators.
18198  //  a) Get pointer to list with other differential correlators;
18199  //  b) Declare local flags;
18200  //  c) Get pointers to other differential profiles.
18201
18202  if(!fCalculateDiffFlow){return;} // TBI: This must eventually be moved somewhere else 
18203
18204  // a) Get pointer to list with other differential correlators:
18205  fOtherDiffCorrelatorsList = dynamic_cast<TList*>(fHistList->FindObject("Other differential correlators"));  
18206  if(!fOtherDiffCorrelatorsList)
18207  { 
18208   printf("\n WARNING (QC): fOtherDiffCorrelatorsList is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18209   exit(0);
18210  }
18211  
18212  // b) Declare local flags: // (to be improved - promoted to data members)
18213  TString typeFlag[2] = {"RP","POI"}; 
18214  TString ptEtaFlag[2] = {"p_{T}","#eta"};
18215  TString sinCosFlag[2] = {"sin","cos"}; 
18216   
18217  // c) Get pointers to other differential profiles:
18218  TString otherDiffCorrelatorsName = "fOtherDiffCorrelators";
18219  otherDiffCorrelatorsName += fAnalysisLabel->Data();
18220  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
18221  { 
18222   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18223   {
18224    for(Int_t sc=0;sc<2;sc++) // sin or cos
18225    {
18226     for(Int_t ci=0;ci<1;ci++) // correlator index
18227     {
18228      fOtherDiffCorrelators[t][pe][sc][ci] = dynamic_cast<TProfile*>(fOtherDiffCorrelatorsList->FindObject(Form("%s, %s, %s, %s, ci = %d",otherDiffCorrelatorsName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),sinCosFlag[sc].Data(),ci+1))); 
18229      if(!fOtherDiffCorrelators[t][pe][sc][ci])
18230      {
18231       printf("\n WARNING (QC): fOtherDiffCorrelators[%i][%i][%i][%i] is NULL in AFAWQC::GPFODC() !!!!\n\n",t,pe,sc,ci);
18232       exit(0);       
18233      } else
18234        {
18235         this->SetOtherDiffCorrelators(fOtherDiffCorrelators[t][pe][sc][ci],t,pe,sc,ci);     
18236        } 
18237     } // end of for(Int_t ci=0;ci<1;ci++) // correlator index
18238    } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
18239   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
18240  } // end of for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
18241   
18242 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForOtherDiffCorrelators()
18243
18244 //=======================================================================================================================
18245
18246 void AliFlowAnalysisWithQCumulants::GetPointersForDiffFlowHistograms()
18247 {
18248  // Get pointer to all objects relevant for differential flow.
18249  //  a) Get pointer to base list for differential flow fDiffFlowList;
18250  //  b) Get pointer to profile fDiffFlowFlags holding all flags for differential flow. Access and set some flags;
18251  //  c) Get pointers to nested lists fDiffFlowListProfiles and fDiffFlowListResults;
18252  //  d) Define flags locally (to be improved: should I promote these flags to data members?);
18253  //  e) Get pointers to all nested lists in fDiffFlowListProfiles and to profiles which they hold;
18254  //  f) Get pointers to all nested lists in fDiffFlowListResults and to histograms which they hold.
18255  
18256  // a) Get pointer to base list for differential flow fDiffFlowList:
18257  fDiffFlowList = dynamic_cast<TList*>(fHistList->FindObject("Differential Flow"));  
18258  if(!fDiffFlowList)
18259  { 
18260   printf("\n WARNING (QC): fDiffFlowList is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18261   exit(0);
18262  }
18263  
18264  // b) Get pointer to profile fDiffFlowFlags holding all flags for differential flow. Access and set some flags:
18265  TString diffFlowFlagsName = "fDiffFlowFlags";
18266  diffFlowFlagsName += fAnalysisLabel->Data();
18267  fDiffFlowFlags = dynamic_cast<TProfile*>(fDiffFlowList->FindObject(diffFlowFlagsName.Data()));
18268  if(fDiffFlowFlags)
18269  {
18270   this->SetCalculateDiffFlow((Bool_t)fDiffFlowFlags->GetBinContent(1)); // to be improved - hardwired 1
18271   this->SetCalculateDiffFlowVsEta((Bool_t)fDiffFlowFlags->GetBinContent(6)); // to be improved - hardwired 6
18272  } else
18273    {
18274     printf("\n WARNING (QC): fDiffFlowFlags is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18275     printf("\n             Flags in method Finish() are wrong.\n\n");
18276     exit(0);
18277    } 
18278    
18279  if(!fCalculateDiffFlow){return;} // IMPORTANT: do not move this anywhere above in this method (to be improved)   
18280   
18281  // c) Get pointers to nested lists fDiffFlowListProfiles and fDiffFlowListResults:
18282  //  List holding nested lists holding profiles:
18283  TList *diffFlowListProfiles = NULL;
18284  diffFlowListProfiles = dynamic_cast<TList*>(fDiffFlowList->FindObject("Profiles"));
18285  if(!diffFlowListProfiles)
18286  { 
18287   printf("\n WARNING (QC): diffFlowListProfiles is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18288   exit(0);
18289  }
18290  //  List holding nested lists holding histograms with final results:
18291  TList *diffFlowListResults = NULL;
18292  diffFlowListResults = dynamic_cast<TList*>(fDiffFlowList->FindObject("Results"));
18293  if(!diffFlowListResults)
18294  { 
18295   printf("\n WARNING (QC): diffFlowListResults is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18296   exit(0);
18297  }
18298  
18299  // d) Define flags locally (to be improved: should I promote these flags to data members?):
18300  TString typeFlag[2] = {"RP","POI"}; 
18301  TString ptEtaFlag[2] = {"p_{T}","#eta"};
18302  TString powerFlag[2] = {"linear","quadratic"};
18303  TString sinCosFlag[2] = {"sin","cos"};
18304  TString differentialCumulantIndex[4] = {"QC{2'}","QC{4'}","QC{6'}","QC{8'}"};  
18305  TString differentialFlowIndex[4] = {"v'{2}","v'{4}","v'{6}","v'{8}"};  
18306  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"};
18307  TString reducedSquaredCorrelationIndex[4] = {"<2'>^{2}","<4'>^{2}","<6'>^{2}","<8'>^{2}"}; 
18308  TString mixedCorrelationIndex[8] = {"<2>","<2'>","<4>","<4'>","<6>","<6'>","<8>","<8'>"};
18309  TString covarianceName[5] = {"Cov(<2>,<2'>)","Cov(<2>,<4'>)","Cov(<4>,<2'>)","Cov(<4>,<4'>)","Cov(<2'>,<4'>)"}; 
18310   
18311  // e) Get pointers to all nested lists in fDiffFlowListProfiles and to profiles which they hold:
18312  // correlations:
18313  TList *diffFlowCorrelationsProList[2][2] = {{NULL}};
18314  TString diffFlowCorrelationsProName = "fDiffFlowCorrelationsPro";
18315  diffFlowCorrelationsProName += fAnalysisLabel->Data();
18316  TProfile *diffFlowCorrelationsPro[2][2][4] = {{{NULL}}}; 
18317  // squared correlations:  
18318  TString diffFlowSquaredCorrelationsProName = "fDiffFlowSquaredCorrelationsPro";
18319  diffFlowSquaredCorrelationsProName += fAnalysisLabel->Data(); 
18320  TProfile *diffFlowSquaredCorrelationsPro[2][2][4] = {{{NULL}}};  
18321  // products of correlations:
18322  TList *diffFlowProductOfCorrelationsProList[2][2] = {{NULL}};
18323  TString diffFlowProductOfCorrelationsProName = "fDiffFlowProductOfCorrelationsPro";
18324  diffFlowProductOfCorrelationsProName += fAnalysisLabel->Data();  
18325  TProfile *diffFlowProductOfCorrelationsPro[2][2][8][8] = {{{{NULL}}}};   
18326  // corrections:
18327  TList *diffFlowCorrectionsProList[2][2] = {{NULL}};
18328  TString diffFlowCorrectionTermsForNUAProName = "fDiffFlowCorrectionTermsForNUAPro";
18329  diffFlowCorrectionTermsForNUAProName += fAnalysisLabel->Data();  
18330  TProfile *diffFlowCorrectionTermsForNUAPro[2][2][2][10] = {{{{NULL}}}};   
18331  for(Int_t t=0;t<2;t++)
18332  {
18333   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++)
18334   {
18335    diffFlowCorrelationsProList[t][pe] = dynamic_cast<TList*>(diffFlowListProfiles->FindObject(Form("Profiles with correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18336    if(!diffFlowCorrelationsProList[t][pe])
18337    { 
18338     cout<<"WARNING: diffFlowCorrelationsProList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18339     cout<<"t = "<<t<<endl;
18340     cout<<"pe = "<<pe<<endl;
18341     exit(0);
18342    }
18343    for(Int_t ci=0;ci<4;ci++) // correlation index
18344    {
18345     // reduced correlations:
18346     diffFlowCorrelationsPro[t][pe][ci] = dynamic_cast<TProfile*>(diffFlowCorrelationsProList[t][pe]->FindObject(Form("%s, %s, %s, %s",diffFlowCorrelationsProName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),reducedCorrelationIndex[ci].Data())));
18347     if(diffFlowCorrelationsPro[t][pe][ci])
18348     {
18349      this->SetDiffFlowCorrelationsPro(diffFlowCorrelationsPro[t][pe][ci],t,pe,ci);
18350     } else
18351       {
18352        cout<<"WARNING: diffFlowCorrelationsPro[t][pe][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18353        cout<<"t  = "<<t<<endl;
18354        cout<<"pe = "<<pe<<endl;   
18355        cout<<"ci = "<<ci<<endl;
18356       }     
18357     // reduced squared correlations:
18358     diffFlowSquaredCorrelationsPro[t][pe][ci] = dynamic_cast<TProfile*>(diffFlowCorrelationsProList[t][pe]->FindObject(Form("%s, %s, %s, %s",diffFlowSquaredCorrelationsProName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),reducedSquaredCorrelationIndex[ci].Data())));
18359     if(diffFlowSquaredCorrelationsPro[t][pe][ci])
18360     {
18361      this->SetDiffFlowSquaredCorrelationsPro(diffFlowSquaredCorrelationsPro[t][pe][ci],t,pe,ci);
18362     } else
18363       {
18364        cout<<"WARNING: diffFlowSquaredCorrelationsPro[t][pe][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18365        cout<<"t  = "<<t<<endl;
18366        cout<<"pe = "<<pe<<endl;   
18367        cout<<"ci = "<<ci<<endl;
18368       }       
18369    } // end of for(Int_t ci=0;ci<4;ci++) // correlation index  
18370    // products of correlations:    
18371    diffFlowProductOfCorrelationsProList[t][pe] = dynamic_cast<TList*>(diffFlowListProfiles->FindObject(Form("Profiles with products of correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()))); 
18372    if(!diffFlowProductOfCorrelationsProList[t][pe])
18373    { 
18374     cout<<"WARNING: ddiffFlowProductOfCorrelationsProList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18375     cout<<"t = "<<t<<endl;
18376     cout<<"pe = "<<pe<<endl;
18377     exit(0);
18378    }
18379    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
18380    {
18381     for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
18382     {
18383      diffFlowProductOfCorrelationsPro[t][pe][mci1][mci2] = dynamic_cast<TProfile*>(diffFlowProductOfCorrelationsProList[t][pe]->FindObject(Form("%s, %s, %s, %s, %s",diffFlowProductOfCorrelationsProName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),mixedCorrelationIndex[mci1].Data(),mixedCorrelationIndex[mci2].Data())));
18384      if(diffFlowProductOfCorrelationsPro[t][pe][mci1][mci2])
18385      {
18386       this->SetDiffFlowProductOfCorrelationsPro(diffFlowProductOfCorrelationsPro[t][pe][mci1][mci2],t,pe,mci1,mci2);
18387      } else
18388        {
18389         cout<<"WARNING: diffFlowProductOfCorrelationsPro[t][pe][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18390         cout<<"t    = "<<t<<endl;
18391         cout<<"pe   = "<<pe<<endl;   
18392         cout<<"mci1 = "<<mci1<<endl;
18393         cout<<"mci2 = "<<mci2<<endl;
18394        }
18395      if(mci1%2 == 0) mci2++; // products which DO NOT include reduced correlations are not stored here
18396     } // end of for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
18397    } // end of for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index    
18398    // corrections:
18399    diffFlowCorrectionsProList[t][pe] = dynamic_cast<TList*>(diffFlowListProfiles->FindObject(Form("Profiles with correction terms for NUA (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18400    if(!diffFlowCorrectionsProList[t][pe])
18401    { 
18402     cout<<"WARNING: diffFlowCorrectionsProList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18403     cout<<"t = "<<t<<endl;
18404     cout<<"pe = "<<pe<<endl;
18405     exit(0);
18406    }
18407    // correction terms for NUA:
18408    for(Int_t sc=0;sc<2;sc++) // sin or cos
18409    {
18410     for(Int_t cti=0;cti<9;cti++) // correction term index
18411     {
18412      diffFlowCorrectionTermsForNUAPro[t][pe][sc][cti] = dynamic_cast<TProfile*>(diffFlowCorrectionsProList[t][pe]->FindObject(Form("%s, %s, %s, %s, cti = %d",diffFlowCorrectionTermsForNUAProName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),sinCosFlag[sc].Data(),cti+1)));
18413      if(diffFlowCorrectionTermsForNUAPro[t][pe][sc][cti])
18414      {
18415       this->SetDiffFlowCorrectionTermsForNUAPro(diffFlowCorrectionTermsForNUAPro[t][pe][sc][cti],t,pe,sc,cti);
18416      } else
18417        {
18418         cout<<"WARNING: diffFlowCorrectionTermsForNUAPro[t][pe][sc][cti] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18419         cout<<"t   = "<<t<<endl;
18420         cout<<"pe  = "<<pe<<endl;   
18421         cout<<"sc  = "<<sc<<endl;
18422         cout<<"cti = "<<cti<<endl;
18423        }    
18424     } // end of for(Int_t cti=0;cti<9;cti++) // correction term index
18425    } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
18426    // ...
18427   } // end of for(Int_t pe=0;pe<2;pe++)
18428  } // end of for(Int_t t=0;t<2;t++)
18429   
18430  // f) Get pointers to all nested lists in fDiffFlowListResults and to histograms which they hold:
18431  // reduced correlations:
18432  TList *diffFlowCorrelationsHistList[2][2] = {{NULL}};
18433  TString diffFlowCorrelationsHistName = "fDiffFlowCorrelationsHist";
18434  diffFlowCorrelationsHistName += fAnalysisLabel->Data();  
18435  TH1D *diffFlowCorrelationsHist[2][2][4] = {{{NULL}}};
18436  // corrections for NUA:
18437  TList *diffFlowCorrectionsHistList[2][2] = {{NULL}};
18438  TString diffFlowCorrectionTermsForNUAHistName = "fDiffFlowCorrectionTermsForNUAHist";
18439  diffFlowCorrectionTermsForNUAHistName += fAnalysisLabel->Data();  
18440  TH1D *diffFlowCorrectionTermsForNUAHist[2][2][2][10] = {{{{NULL}}}};
18441  // differential Q-cumulants:
18442  TList *diffFlowCumulantsHistList[2][2] = {{NULL}};
18443  TString diffFlowCumulantsName = "fDiffFlowCumulants";
18444  diffFlowCumulantsName += fAnalysisLabel->Data();  
18445  TH1D *diffFlowCumulants[2][2][4] = {{{NULL}}};
18446  // detector bias to differential Q-cumulants:
18447  TList *diffFlowDetectorBiasHistList[2][2] = {{NULL}};
18448  TString diffFlowDetectorBiasName = "fDiffFlowDetectorBias";
18449  diffFlowDetectorBiasName += fAnalysisLabel->Data();  
18450  TH1D *diffFlowDetectorBias[2][2][4] = {{{NULL}}}; 
18451  // differential flow estimates from Q-cumulants:
18452  TList *diffFlowHistList[2][2] = {{NULL}};
18453  TString diffFlowName = "fDiffFlow";
18454  diffFlowName += fAnalysisLabel->Data();  
18455  TH1D *diffFlow[2][2][4] = {{{NULL}}};
18456  // differential covariances:
18457  TList *diffFlowCovariancesHistList[2][2] = {{NULL}};
18458  TString diffFlowCovariancesName = "fDiffFlowCovariances";
18459  diffFlowCovariancesName += fAnalysisLabel->Data();  
18460  TH1D *diffFlowCovariances[2][2][5] = {{{NULL}}};
18461  for(Int_t t=0;t<2;t++) // type: RP or POI
18462  { 
18463   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18464   {
18465    // reduced correlations:
18466    diffFlowCorrelationsHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18467    if(!diffFlowCorrelationsHistList[t][pe])
18468    { 
18469     cout<<"WARNING: diffFlowCorrelationsHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18470     cout<<"t = "<<t<<endl;
18471     cout<<"pe = "<<pe<<endl;
18472     exit(0);
18473    }
18474    for(Int_t index=0;index<4;index++) 
18475    {
18476     diffFlowCorrelationsHist[t][pe][index] = dynamic_cast<TH1D*>(diffFlowCorrelationsHistList[t][pe]->FindObject(Form("%s, %s, %s, %s",diffFlowCorrelationsHistName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),reducedCorrelationIndex[index].Data())));
18477     if(diffFlowCorrelationsHist[t][pe][index])
18478     {
18479      this->SetDiffFlowCorrelationsHist(diffFlowCorrelationsHist[t][pe][index],t,pe,index);
18480     } else 
18481       {
18482        cout<<"WARNING: diffFlowCorrelationsHist[t][pe][index] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18483        cout<<"t     = "<<t<<endl;
18484        cout<<"pe    = "<<pe<<endl;
18485        cout<<"index = "<<index<<endl;
18486        exit(0);       
18487       } 
18488    } // end of for(Int_t index=0;index<4;index++)
18489    // corrections:
18490    diffFlowCorrectionsHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Histograms with correction terms for NUA (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18491    if(!diffFlowCorrectionsHistList[t][pe])
18492    { 
18493     cout<<"WARNING: diffFlowCorrectionsHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18494     cout<<"t = "<<t<<endl;
18495     cout<<"pe = "<<pe<<endl;
18496     exit(0);
18497    }
18498    // correction terms for NUA:
18499    for(Int_t sc=0;sc<2;sc++) // sin or cos
18500    {
18501     for(Int_t cti=0;cti<9;cti++) // correction term index
18502     {
18503      diffFlowCorrectionTermsForNUAHist[t][pe][sc][cti] = dynamic_cast<TH1D*>(diffFlowCorrectionsHistList[t][pe]->FindObject(Form("%s, %s, %s, %s, cti = %d",diffFlowCorrectionTermsForNUAHistName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),sinCosFlag[sc].Data(),cti+1)));
18504      if(diffFlowCorrectionTermsForNUAHist[t][pe][sc][cti])
18505      {
18506       this->SetDiffFlowCorrectionTermsForNUAHist(diffFlowCorrectionTermsForNUAHist[t][pe][sc][cti],t,pe,sc,cti);
18507      } else
18508        {
18509         cout<<"WARNING: diffFlowCorrectionTermsForNUAHist[t][pe][sc][cti] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18510         cout<<"t   = "<<t<<endl;
18511         cout<<"pe  = "<<pe<<endl;   
18512         cout<<"sc  = "<<sc<<endl;
18513         cout<<"cti = "<<cti<<endl;
18514        }    
18515     } // end of for(Int_t cti=0;cti<9;cti++) // correction term index
18516    } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
18517    // ...
18518    // differential Q-cumulants:
18519    diffFlowCumulantsHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Differential Q-cumulants (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18520    if(!diffFlowCumulantsHistList[t][pe])
18521    { 
18522     cout<<"WARNING: diffFlowCumulantsHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18523     cout<<"t  = "<<t<<endl;
18524     cout<<"pe = "<<pe<<endl;
18525     exit(0);
18526    }
18527    for(Int_t index=0;index<4;index++) 
18528    {
18529     diffFlowCumulants[t][pe][index] = dynamic_cast<TH1D*>(diffFlowCumulantsHistList[t][pe]->FindObject(Form("%s, %s, %s, %s",diffFlowCumulantsName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),differentialCumulantIndex[index].Data())));
18530     if(diffFlowCumulants[t][pe][index])
18531     {
18532      this->SetDiffFlowCumulants(diffFlowCumulants[t][pe][index],t,pe,index);
18533     } else 
18534       {
18535        cout<<"WARNING: diffFlowCumulants[t][pe][index] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18536        cout<<"t     = "<<t<<endl;
18537        cout<<"pe    = "<<pe<<endl;
18538        cout<<"index = "<<index<<endl;
18539        exit(0);       
18540       } 
18541    } // end of for(Int_t index=0;index<4;index++)
18542    // Detector bias to differential Q-cumulants:
18543    diffFlowDetectorBiasHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Detector bias (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18544    if(!diffFlowDetectorBiasHistList[t][pe])
18545    { 
18546     cout<<"WARNING: diffFlowDetectorBiasHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18547     cout<<"t  = "<<t<<endl;
18548     cout<<"pe = "<<pe<<endl;
18549     exit(0);
18550    }
18551    for(Int_t index=0;index<4;index++) 
18552    {
18553     diffFlowDetectorBias[t][pe][index] = dynamic_cast<TH1D*>(diffFlowDetectorBiasHistList[t][pe]->FindObject(Form("%s, %s, %s, %s",diffFlowDetectorBiasName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),differentialCumulantIndex[index].Data())));
18554     if(diffFlowDetectorBias[t][pe][index])
18555     {
18556      this->SetDiffFlowDetectorBias(diffFlowDetectorBias[t][pe][index],t,pe,index);
18557     } else 
18558       {
18559        cout<<"WARNING: diffFlowDetectorBias[t][pe][index] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18560        cout<<"t     = "<<t<<endl;
18561        cout<<"pe    = "<<pe<<endl;
18562        cout<<"index = "<<index<<endl;
18563        exit(0);       
18564       } 
18565    } // end of for(Int_t index=0;index<4;index++)
18566    // differential flow estimates from Q-cumulants:
18567    diffFlowHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Differential flow (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18568    if(!diffFlowHistList[t][pe])
18569    { 
18570     cout<<"WARNING: diffFlowHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18571     cout<<"t  = "<<t<<endl;
18572     cout<<"pe = "<<pe<<endl;
18573     exit(0);
18574    }
18575    for(Int_t index=0;index<4;index++) 
18576    {
18577     diffFlow[t][pe][index] = dynamic_cast<TH1D*>(diffFlowHistList[t][pe]->FindObject(Form("%s, %s, %s, %s",diffFlowName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),differentialFlowIndex[index].Data())));
18578     if(diffFlow[t][pe][index])
18579     {
18580      this->SetDiffFlow(diffFlow[t][pe][index],t,pe,index);
18581     } else 
18582       {
18583        cout<<"WARNING: diffFlow[t][pe][index] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18584        cout<<"t     = "<<t<<endl;
18585        cout<<"pe    = "<<pe<<endl;
18586        cout<<"index = "<<index<<endl;
18587        exit(0);       
18588       } 
18589    } // end of for(Int_t index=0;index<4;index++)
18590    // differential covariances:
18591    diffFlowCovariancesHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Covariances of correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18592    if(!diffFlowCovariancesHistList[t][pe])
18593    { 
18594     cout<<"WARNING: diffFlowCovariancesHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18595     cout<<"t  = "<<t<<endl;
18596     cout<<"pe = "<<pe<<endl;
18597     exit(0);
18598    }
18599    for(Int_t covIndex=0;covIndex<5;covIndex++) 
18600    {
18601     diffFlowCovariances[t][pe][covIndex] = dynamic_cast<TH1D*>(diffFlowCovariancesHistList[t][pe]->FindObject(Form("%s, %s, %s, %s",diffFlowCovariancesName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),covarianceName[covIndex].Data())));
18602     if(diffFlowCovariances[t][pe][covIndex])
18603     {
18604      this->SetDiffFlowCovariances(diffFlowCovariances[t][pe][covIndex],t,pe,covIndex);
18605     } else 
18606       {
18607        cout<<"WARNING: diffFlowCovariances[t][pe][covIndex] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18608        cout<<"t        = "<<t<<endl;
18609        cout<<"pe       = "<<pe<<endl;
18610        cout<<"covIndex = "<<covIndex<<endl;
18611        exit(0);       
18612       } 
18613    } // end of for(Int_t covIndex=0;covIndex<5;covIndex++) // covariance index    
18614   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
18615  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI 
18616  // sum of event weights for reduced correlations:
18617  TList *diffFlowSumOfEventWeightsHistList[2][2][2] = {{{NULL}}};
18618  TString diffFlowSumOfEventWeightsName = "fDiffFlowSumOfEventWeights";
18619  diffFlowSumOfEventWeightsName += fAnalysisLabel->Data();  
18620  TH1D *diffFlowSumOfEventWeights[2][2][2][4] = {{{{NULL}}}};
18621  for(Int_t t=0;t<2;t++) // type is RP or POI
18622  { 
18623   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18624   { 
18625    for(Int_t p=0;p<2;p++) // power of event weights is either 1 or 2
18626    {
18627     diffFlowSumOfEventWeightsHistList[t][pe][p] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Sum of %s event weights (%s, %s)",powerFlag[p].Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18628     if(!diffFlowSumOfEventWeightsHistList[t][pe][p])
18629     { 
18630      cout<<"WARNING: diffFlowSumOfEventWeightsHistList[t][pe][p] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18631      cout<<"t     = "<<t<<endl;
18632      cout<<"pe    = "<<pe<<endl;
18633      cout<<"power = "<<p<<endl;
18634      exit(0);
18635     }
18636     for(Int_t ew=0;ew<4;ew++) // index of reduced correlation
18637     {
18638      diffFlowSumOfEventWeights[t][pe][p][ew] = dynamic_cast<TH1D*>(diffFlowSumOfEventWeightsHistList[t][pe][p]->FindObject(Form("%s, %s, %s, %s, %s",diffFlowSumOfEventWeightsName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),powerFlag[p].Data(),reducedCorrelationIndex[ew].Data())));    
18639      if(diffFlowSumOfEventWeights[t][pe][p][ew])
18640      {
18641       this->SetDiffFlowSumOfEventWeights(diffFlowSumOfEventWeights[t][pe][p][ew],t,pe,p,ew);
18642      } else 
18643        {
18644         cout<<"WARNING: diffFlowSumOfEventWeights[t][pe][p][ew] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18645         cout<<"t     = "<<t<<endl;
18646         cout<<"pe    = "<<pe<<endl;
18647         cout<<"power = "<<p<<endl;
18648         cout<<"ew    = "<<ew<<endl;
18649         exit(0);       
18650        } 
18651     }
18652    } // end of for(Int_t p=0;p<2;p++) // power of event weights is either 1 or 2
18653   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
18654  } // end of for(Int_t t=0;t<2;t++) // type is RP or POI
18655  //  
18656  TList *diffFlowSumOfProductOfEventWeightsHistList[2][2] = {{NULL}};
18657  TString diffFlowSumOfProductOfEventWeightsName = "fDiffFlowSumOfProductOfEventWeights";
18658  diffFlowSumOfProductOfEventWeightsName += fAnalysisLabel->Data();  
18659  TH1D *diffFlowSumOfProductOfEventWeights[2][2][8][8] = {{{{NULL}}}};
18660  for(Int_t t=0;t<2;t++) // type is RP or POI
18661  { 
18662   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18663   { 
18664    diffFlowSumOfProductOfEventWeightsHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Sum of products of event weights (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18665    if(!diffFlowSumOfProductOfEventWeightsHistList[t][pe])
18666    { 
18667     cout<<"WARNING: diffFlowSumOfProductOfEventWeightsHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18668     cout<<"t     = "<<t<<endl;
18669     cout<<"pe    = "<<pe<<endl;
18670     exit(0);
18671    }
18672    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
18673    {
18674     for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
18675     {
18676      diffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2] = dynamic_cast<TH1D*>(diffFlowSumOfProductOfEventWeightsHistList[t][pe]->FindObject(Form("%s, %s, %s, %s, %s",diffFlowSumOfProductOfEventWeightsName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),mixedCorrelationIndex[mci1].Data(),mixedCorrelationIndex[mci2].Data())));    
18677       if(diffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2])
18678       {
18679        this->SetDiffFlowSumOfProductOfEventWeights(diffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2],t,pe,mci1,mci2);
18680       } else 
18681         {
18682          cout<<"WARNING: diffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18683          cout<<"t    = "<<t<<endl;
18684          cout<<"pe   = "<<pe<<endl;
18685          cout<<"mci1 = "<<mci1<<endl;
18686          cout<<"mci2 = "<<mci2<<endl;
18687          exit(0);       
18688         } 
18689      if(mci1%2 == 0) mci2++; // products which DO NOT include reduced correlations are not stored here
18690     } // end of for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
18691    } // end of for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
18692   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
18693  } // end of for(Int_t t=0;t<2;t++) // type is RP or POI
18694
18695 } // end void AliFlowAnalysisWithQCumulants::GetPointersForDiffFlowHistograms()
18696
18697 //=======================================================================================================================
18698
18699 void AliFlowAnalysisWithQCumulants::BookEverythingFor2DDifferentialFlow()
18700 {
18701  // Book all objects needed for 2D differential flow.
18702  //  a) Define flags locally (to be improved: should I promote flags to data members?);
18703  //  b) Book e-b-e quantities;
18704  //  c) Book 2D profiles;
18705  //  d) Book 2D histograms.
18706  
18707  if(!fCalculate2DDiffFlow){return;}
18708
18709  // a) Define flags locally (to be improved: should I promote flags to data members?):
18710  TString typeFlag[2] = {"RP","POI"}; 
18711  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"};
18712  TString differentialCumulantIndex[4] = {"QC{2'}","QC{4'}","QC{6'}","QC{8'}"};  
18713  TString differentialFlowIndex[4] = {"v'{2}","v'{4}","v'{6}","v'{8}"};  
18714   
18715  // b) Book e-b-e quantities: 
18716  TProfile2D styleRe("typeMultiplePowerRe","typeMultiplePowerRe",fnBinsPt,fPtMin,fPtMax,fnBinsEta,fEtaMin,fEtaMax);
18717  TProfile2D styleIm("typeMultiplePowerIm","typeMultiplePowerIm",fnBinsPt,fPtMin,fPtMax,fnBinsEta,fEtaMin,fEtaMax);
18718  for(Int_t t=0;t<3;t++) // typeFlag (0 = RP, 1 = POI, 2 = RP&&POI )
18719  { 
18720   for(Int_t m=0;m<4;m++)
18721   {
18722    for(Int_t k=0;k<9;k++)
18723    {
18724     fReRPQ2dEBE[t][m][k] = (TProfile2D*)styleRe.Clone(Form("typeFlag%dmultiple%dpower%dRe",t,m,k)); 
18725     fImRPQ2dEBE[t][m][k] = (TProfile2D*)styleIm.Clone(Form("typeFlag%dmultiple%dpower%dIm",t,m,k));
18726    }
18727   } 
18728  } 
18729  TProfile2D styleS("typePower","typePower",fnBinsPt,fPtMin,fPtMax,fnBinsEta,fEtaMin,fEtaMax);
18730  for(Int_t t=0;t<3;t++) // typeFlag (0 = RP, 1 = POI, 2 = RP&&POI )
18731  { 
18732   for(Int_t k=0;k<9;k++)
18733   {
18734    fs2dEBE[t][k] = (TProfile2D*)styleS.Clone(Form("typeFlag%dpower%d",t,k));
18735   }
18736  }
18737
18738  // c) Book 2D profiles:
18739  TString s2DDiffFlowCorrelationsProName = "f2DDiffFlowCorrelationsPro";
18740  s2DDiffFlowCorrelationsProName += fAnalysisLabel->Data();
18741  for(Int_t t=0;t<2;t++) // type: RP or POI
18742  { 
18743   for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18744   {
18745    f2DDiffFlowCorrelationsPro[t][rci] = new TProfile2D(Form("%s, %s, %s",s2DDiffFlowCorrelationsProName.Data(),typeFlag[t].Data(),reducedCorrelationIndex[rci].Data()),Form("%s, %s, %s",s2DDiffFlowCorrelationsProName.Data(),typeFlag[t].Data(),reducedCorrelationIndex[rci].Data()),fnBinsPt,fPtMin,fPtMax,fnBinsEta,fEtaMin,fEtaMax,"");
18746    f2DDiffFlowCorrelationsPro[t][rci]->Sumw2();
18747    f2DDiffFlowCorrelationsPro[t][rci]->SetXTitle("p_{t}");
18748    f2DDiffFlowCorrelationsPro[t][rci]->SetYTitle("#eta");
18749    f2DDiffFlowCorrelationsProList[t]->Add(f2DDiffFlowCorrelationsPro[t][rci]); 
18750   } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
18751  } // end of for(Int_t t=0;t<2;t++) // type: RP or POIs
18752
18753  // d) Book 2D histograms:
18754  TString s2DDiffFlowCumulantsName = "f2DDiffFlowCumulants";
18755  s2DDiffFlowCumulantsName += fAnalysisLabel->Data();
18756  TString s2DDiffFlowName = "f2DDiffFlow";
18757  s2DDiffFlowName += fAnalysisLabel->Data();
18758  for(Int_t t=0;t<2;t++) // type: RP or POI
18759  { 
18760   for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18761   {
18762    // 2D diferential cumulants:
18763    f2DDiffFlowCumulants[t][rci] = new TH2D(Form("%s, %s, %s",s2DDiffFlowCumulantsName.Data(),typeFlag[t].Data(),differentialCumulantIndex[rci].Data()),Form("%s, %s, %s",s2DDiffFlowCumulantsName.Data(),typeFlag[t].Data(),differentialCumulantIndex[rci].Data()),fnBinsPt,fPtMin,fPtMax,fnBinsEta,fEtaMin,fEtaMax);
18764    f2DDiffFlowCumulants[t][rci]->SetXTitle("p_{t}");
18765    f2DDiffFlowCumulants[t][rci]->SetYTitle("#eta");
18766    f2DDiffFlowCorrelationsProList[t]->Add(f2DDiffFlowCumulants[t][rci]); //  to be improved - moved to another list 
18767    // 2D differential flow:
18768    f2DDiffFlow[t][rci] = new TH2D(Form("%s, %s, %s",s2DDiffFlowName.Data(),typeFlag[t].Data(),differentialFlowIndex[rci].Data()),Form("%s, %s, %s",s2DDiffFlowName.Data(),typeFlag[t].Data(),differentialFlowIndex[rci].Data()),fnBinsPt,fPtMin,fPtMax,fnBinsEta,fEtaMin,fEtaMax);
18769    f2DDiffFlow[t][rci]->SetXTitle("p_{t}");
18770    f2DDiffFlow[t][rci]->SetYTitle("#eta");
18771    f2DDiffFlowCorrelationsProList[t]->Add(f2DDiffFlow[t][rci]); //  to be improved - moved to another list 
18772   } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
18773  } // end of for(Int_t t=0;t<2;t++) // type: RP or POIs
18774
18775 } // void AliFlowAnalysisWithQCumulants::BookEverythingFor2DDifferentialFlow()
18776
18777 //=======================================================================================================================
18778
18779 void AliFlowAnalysisWithQCumulants::BookEverythingForDifferentialFlow()
18780 {
18781  // Book all histograms and profiles needed for differential flow.
18782  //  a) Book profile to hold all flags for differential flow;
18783  //  b) Define flags locally (to be improved: should I promote flags to data members?);
18784  //  c) Book e-b-e quantities;
18785  //  d) Book profiles;
18786  //  e) Book histograms holding final results. 
18787  
18788  // a) Book profile to hold all flags for differential flow:
18789  TString diffFlowFlagsName = "fDiffFlowFlags";
18790  diffFlowFlagsName += fAnalysisLabel->Data();
18791  fDiffFlowFlags = new TProfile(diffFlowFlagsName.Data(),"Flags for differential flow",6,0,6);
18792  fDiffFlowFlags->SetTickLength(-0.01,"Y");
18793  fDiffFlowFlags->SetMarkerStyle(25);
18794  fDiffFlowFlags->SetLabelSize(0.04,"X");
18795  fDiffFlowFlags->SetLabelOffset(0.02,"Y");
18796  fDiffFlowFlags->SetStats(kFALSE);
18797  fDiffFlowFlags->GetXaxis()->SetBinLabel(1,"Calculate diff. flow"); 
18798  fDiffFlowFlags->GetXaxis()->SetBinLabel(2,"Particle weights");
18799  fDiffFlowFlags->GetXaxis()->SetBinLabel(3,"Event weights");
18800  fDiffFlowFlags->GetXaxis()->SetBinLabel(4,"Correct for NUA");
18801  fDiffFlowFlags->GetXaxis()->SetBinLabel(5,"Calculate 2D diff. flow");
18802  fDiffFlowFlags->GetXaxis()->SetBinLabel(6,"Calculate diff. flow vs eta");
18803  fDiffFlowList->Add(fDiffFlowFlags);
18804
18805  if(!fCalculateDiffFlow){return;}
18806   
18807  // b) Define flags locally (to be improved: should I promote flags to data members?): 
18808  TString typeFlag[2] = {"RP","POI"}; 
18809  TString ptEtaFlag[2] = {"p_{T}","#eta"};
18810  TString powerFlag[2] = {"linear","quadratic"};
18811  TString sinCosFlag[2] = {"sin","cos"};
18812  TString differentialCumulantIndex[4] = {"QC{2'}","QC{4'}","QC{6'}","QC{8'}"};  
18813  TString differentialFlowIndex[4] = {"v'{2}","v'{4}","v'{6}","v'{8}"};  
18814  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"};
18815  TString reducedSquaredCorrelationIndex[4] = {"<2'>^{2}","<4'>^{2}","<6'>^{2}","<8'>^{2}"};
18816  TString mixedCorrelationIndex[8] = {"<2>","<2'>","<4>","<4'>","<6>","<6'>","<8>","<8'>"};
18817  TString covarianceName[5] = {"Cov(<2>,<2'>)","Cov(<2>,<4'>)","Cov(<4>,<2'>)","Cov(<4>,<4'>)","Cov(<2'>,<4'>)"}; 
18818  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
18819  Double_t minPtEta[2] = {fPtMin,fEtaMin};
18820  Double_t maxPtEta[2] = {fPtMax,fEtaMax};
18821    
18822  // c) Book e-b-e quantities:
18823  // Event-by-event r_{m*n,k}(pt,eta), p_{m*n,k}(pt,eta) and q_{m*n,k}(pt,eta)
18824  // Explanantion of notation:
18825  //  1.) n is harmonic, m is multiple of harmonic;
18826  //  2.) k is power of particle weight;
18827  //  3.) r_{m*n,k}(pt,eta) = Q-vector evaluated in harmonic m*n for RPs in particular (pt,eta) bin (i-th RP is weighted with w_i^k);   
18828  //  4.) p_{m*n,k}(pt,eta) = Q-vector evaluated in harmonic m*n for POIs in particular (pt,eta) bin 
18829  //                          (if i-th POI is also RP, than it is weighted with w_i^k);   
18830  //  5.) q_{m*n,k}(pt,eta) = Q-vector evaluated in harmonic m*n for particles which are both RPs and POIs in particular (pt,eta) bin 
18831  //                          (i-th RP&&POI is weighted with w_i^k)            
18832   
18833  // 1D:
18834  for(Int_t t=0;t<3;t++) // typeFlag (0 = RP, 1 = POI, 2 = RP && POI )
18835  { 
18836   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18837   {
18838    for(Int_t m=0;m<4;m++) // multiple of harmonic
18839    {
18840     for(Int_t k=0;k<9;k++) // power of particle weight
18841     {
18842      fReRPQ1dEBE[t][pe][m][k] = new TProfile(Form("TypeFlag%dpteta%dmultiple%dpower%dRe",t,pe,m,k),
18843                                              Form("TypeFlag%dpteta%dmultiple%dpower%dRe",t,pe,m,k),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
18844      fImRPQ1dEBE[t][pe][m][k] = new TProfile(Form("TypeFlag%dpteta%dmultiple%dpower%dIm",t,pe,m,k),
18845                                              Form("TypeFlag%dpteta%dmultiple%dpower%dIm",t,pe,m,k),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
18846     }
18847    }
18848   }
18849  } 
18850  // to be improved (add explanation of fs1dEBE[t][pe][k]):   
18851  for(Int_t t=0;t<3;t++) // typeFlag (0 = RP, 1 = POI, 2 = RP&&POI )
18852  { 
18853   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18854   {
18855    for(Int_t k=0;k<9;k++) // power of particle weight
18856    {
18857     fs1dEBE[t][pe][k] = new TProfile(Form("TypeFlag%dpteta%dmultiple%d",t,pe,k),
18858                                      Form("TypeFlag%dpteta%dmultiple%d",t,pe,k),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
18859    }
18860   }
18861  }
18862  // correction terms for nua:
18863  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
18864  { 
18865   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18866   {
18867    for(Int_t sc=0;sc<2;sc++) // sin or cos
18868    {
18869     for(Int_t cti=0;cti<9;cti++) // correction term index
18870     {
18871      fDiffFlowCorrectionTermsForNUAEBE[t][pe][sc][cti] = new TH1D(Form("typeFlag%d pteta%d sincos%d cti%d",t,pe,sc,cti),
18872                                              Form("typeFlag%d pteta%d sincos%d cti%d",t,pe,sc,cti),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
18873     }
18874    }
18875   }
18876  } 
18877  // reduced correlations e-b-e:
18878  TString diffFlowCorrelationsEBEName = "fDiffFlowCorrelationsEBE";
18879  diffFlowCorrelationsEBEName += fAnalysisLabel->Data();
18880  for(Int_t t=0;t<2;t++) // type: RP or POI
18881  { 
18882   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18883   {
18884    for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18885    {
18886     fDiffFlowCorrelationsEBE[t][pe][rci] = new TH1D(Form("%s, %s, %s, %s",diffFlowCorrelationsEBEName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),reducedCorrelationIndex[rci].Data()),Form("%s, %s, %s, %s",diffFlowCorrelationsEBEName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),reducedCorrelationIndex[rci].Data()),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]);
18887    } // end of for(Int_t ci=0;ci<4;ci++) // correlation index
18888   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
18889  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
18890  // event weights for reduced correlations e-b-e:
18891  TString diffFlowEventWeightsForCorrelationsEBEName = "fDiffFlowEventWeightsForCorrelationsEBE";
18892  diffFlowEventWeightsForCorrelationsEBEName += fAnalysisLabel->Data();
18893  for(Int_t t=0;t<2;t++) // type: RP or POI
18894  { 
18895   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18896   {
18897    for(Int_t rci=0;rci<4;rci++) // event weight for reduced correlation index
18898    {
18899     fDiffFlowEventWeightsForCorrelationsEBE[t][pe][rci] = new TH1D(Form("%s, %s, %s, eW for %s",diffFlowEventWeightsForCorrelationsEBEName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),reducedCorrelationIndex[rci].Data()),Form("%s, %s, %s, eW for %s",diffFlowEventWeightsForCorrelationsEBEName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),reducedCorrelationIndex[rci].Data()),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]);
18900    } // end of for(Int_t ci=0;ci<4;ci++) // correlation index
18901   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
18902  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
18903       
18904  // d) Book profiles;
18905  // reduced correlations:
18906  TString diffFlowCorrelationsProName = "fDiffFlowCorrelationsPro";
18907  diffFlowCorrelationsProName += fAnalysisLabel->Data();
18908  // reduced squared correlations:
18909  TString diffFlowSquaredCorrelationsProName = "fDiffFlowSquaredCorrelationsPro";
18910  diffFlowSquaredCorrelationsProName += fAnalysisLabel->Data();
18911  // corrections terms:
18912  TString diffFlowCorrectionTermsForNUAProName = "fDiffFlowCorrectionTermsForNUAPro";
18913  diffFlowCorrectionTermsForNUAProName += fAnalysisLabel->Data();
18914  // reduced correlations:
18915  for(Int_t t=0;t<2;t++) // type: RP or POI
18916  { 
18917   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18918   {
18919    for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18920    {
18921     fDiffFlowCorrelationsPro[t][pe][rci] = new TProfile(Form("%s, %s, %s, %s",diffFlowCorrelationsProName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),reducedCorrelationIndex[rci].Data()),Form("%s, %s, %s, %s",diffFlowCorrelationsProName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),reducedCorrelationIndex[rci].Data()),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe],"s");
18922     fDiffFlowCorrelationsPro[t][pe][rci]->Sumw2();
18923     fDiffFlowCorrelationsPro[t][pe][rci]->SetXTitle(ptEtaFlag[pe].Data());
18924     fDiffFlowCorrelationsProList[t][pe]->Add(fDiffFlowCorrelationsPro[t][pe][rci]); // to be improved (add dedicated list to hold reduced correlations)
18925    } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
18926   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
18927  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
18928  // reduced squared correlations:
18929  for(Int_t t=0;t<2;t++) // type: RP or POI
18930  { 
18931   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18932   {
18933    for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18934    {
18935     fDiffFlowSquaredCorrelationsPro[t][pe][rci] = new TProfile(Form("%s, %s, %s, %s",diffFlowSquaredCorrelationsProName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),reducedSquaredCorrelationIndex[rci].Data()),Form("%s, %s, %s, %s",diffFlowSquaredCorrelationsProName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),reducedSquaredCorrelationIndex[rci].Data()),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe],"s");
18936     fDiffFlowSquaredCorrelationsPro[t][pe][rci]->Sumw2();
18937     fDiffFlowSquaredCorrelationsPro[t][pe][rci]->SetXTitle(ptEtaFlag[pe].Data());
18938     fDiffFlowCorrelationsProList[t][pe]->Add(fDiffFlowSquaredCorrelationsPro[t][pe][rci]); // to be improved (add dedicated list to hold reduced correlations)
18939    } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
18940   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
18941  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
18942  // correction terms for nua:
18943  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
18944  { 
18945   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18946   {
18947    for(Int_t sc=0;sc<2;sc++) // sin or cos
18948    {
18949     for(Int_t cti=0;cti<9;cti++) // correction term index
18950     {
18951      fDiffFlowCorrectionTermsForNUAPro[t][pe][sc][cti] = new TProfile(Form("%s, %s, %s, %s, cti = %d",diffFlowCorrectionTermsForNUAProName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),sinCosFlag[sc].Data(),cti+1),Form("%s, %s, %s, %s, cti = %d",diffFlowCorrectionTermsForNUAProName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),sinCosFlag[sc].Data(),cti+1),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
18952      fDiffFlowCorrectionsProList[t][pe]->Add(fDiffFlowCorrectionTermsForNUAPro[t][pe][sc][cti]);
18953     }
18954    }
18955   }
18956  } 
18957  // Other differential correlators:
18958  TString otherDiffCorrelatorsName = "fOtherDiffCorrelators";
18959  otherDiffCorrelatorsName += fAnalysisLabel->Data();
18960  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
18961  { 
18962   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18963   {
18964    for(Int_t sc=0;sc<2;sc++) // sin or cos
18965    {
18966     for(Int_t ci=0;ci<1;ci++) // correlator index
18967     {
18968      fOtherDiffCorrelators[t][pe][sc][ci] = new TProfile(Form("%s, %s, %s, %s, ci = %d",otherDiffCorrelatorsName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),sinCosFlag[sc].Data(),ci+1),Form("%s, %s, %s, %s, ci = %d",otherDiffCorrelatorsName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),sinCosFlag[sc].Data(),ci+1),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
18969      fOtherDiffCorrelators[t][pe][sc][ci]->Sumw2();
18970      fOtherDiffCorrelatorsList->Add(fOtherDiffCorrelators[t][pe][sc][ci]);
18971     }
18972    }
18973   }
18974  }  
18975  // e) Book histograms holding final results. 
18976  // reduced correlations:
18977  TString diffFlowCorrelationsHistName = "fDiffFlowCorrelationsHist";
18978  diffFlowCorrelationsHistName += fAnalysisLabel->Data();
18979  // corrections terms:
18980  TString diffFlowCorrectionTermsForNUAHistName = "fDiffFlowCorrectionTermsForNUAHist";
18981  diffFlowCorrectionTermsForNUAHistName += fAnalysisLabel->Data();
18982  // differential covariances:
18983  TString diffFlowCovariancesName = "fDiffFlowCovariances";
18984  diffFlowCovariancesName += fAnalysisLabel->Data();
18985  // differential Q-cumulants:
18986  TString diffFlowCumulantsName = "fDiffFlowCumulants";
18987  diffFlowCumulantsName += fAnalysisLabel->Data();
18988  // Detector bias to differential Q-cumulants:
18989  TString diffFlowDetectorBiasName = "fDiffFlowDetectorBias";
18990  diffFlowDetectorBiasName += fAnalysisLabel->Data();
18991  // differential flow:
18992  TString diffFlowName = "fDiffFlow";
18993  diffFlowName += fAnalysisLabel->Data();
18994  for(Int_t t=0;t<2;t++) // type: RP or POI
18995  { 
18996   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18997   {
18998    for(Int_t index=0;index<4;index++) 
18999    {
19000     // reduced correlations:
19001     fDiffFlowCorrelationsHist[t][pe][index] = new TH1D(Form("%s, %s, %s, %s",diffFlowCorrelationsHistName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),reducedCorrelationIndex[index].Data()),Form("%s, %s, %s, %s",diffFlowCorrelationsHistName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),reducedCorrelationIndex[index].Data()),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]);
19002     fDiffFlowCorrelationsHist[t][pe][index]->SetXTitle(ptEtaFlag[pe].Data());
19003     fDiffFlowCorrelationsHistList[t][pe]->Add(fDiffFlowCorrelationsHist[t][pe][index]); 
19004     // differential Q-cumulants:
19005     fDiffFlowCumulants[t][pe][index] = new TH1D(Form("%s, %s, %s, %s",diffFlowCumulantsName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),differentialCumulantIndex[index].Data()),Form("%s, %s, %s, %s",diffFlowCumulantsName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),differentialCumulantIndex[index].Data()),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]);
19006     fDiffFlowCumulants[t][pe][index]->SetXTitle(ptEtaFlag[pe].Data());
19007     fDiffFlowCumulantsHistList[t][pe]->Add(fDiffFlowCumulants[t][pe][index]); 
19008     // Detector bias to differential Q-cumulants:
19009     fDiffFlowDetectorBias[t][pe][index] = new TH1D(Form("%s, %s, %s, %s",diffFlowDetectorBiasName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),differentialCumulantIndex[index].Data()),Form("%s, %s, %s, %s",diffFlowDetectorBiasName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),differentialCumulantIndex[index].Data()),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]);
19010     fDiffFlowDetectorBias[t][pe][index]->SetXTitle(ptEtaFlag[pe].Data());
19011     fDiffFlowDetectorBias[t][pe][index]->SetTitle(Form("#frac{corrected}{measured} %s",differentialCumulantIndex[index].Data()));
19012     fDiffFlowDetectorBiasHistList[t][pe]->Add(fDiffFlowDetectorBias[t][pe][index]); 
19013     // differential flow estimates from Q-cumulants:
19014     fDiffFlow[t][pe][index] = new TH1D(Form("%s, %s, %s, %s",diffFlowName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),differentialFlowIndex[index].Data()),Form("%s, %s, %s, %s",diffFlowName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),differentialFlowIndex[index].Data()),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]);
19015     fDiffFlow[t][pe][index]->SetXTitle(ptEtaFlag[pe].Data());
19016     fDiffFlowHistList[t][pe]->Add(fDiffFlow[t][pe][index]); 
19017    } // end of for(Int_t index=0;index<4;index++) 
19018    for(Int_t covIndex=0;covIndex<5;covIndex++) // covariance index 
19019    {
19020     // differential covariances:
19021     fDiffFlowCovariances[t][pe][covIndex] = new TH1D(Form("%s, %s, %s, %s",diffFlowCovariancesName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),covarianceName[covIndex].Data()),Form("%s, %s, %s, %s",diffFlowCovariancesName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),covarianceName[covIndex].Data()),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]);
19022     fDiffFlowCovariances[t][pe][covIndex]->SetXTitle(ptEtaFlag[pe].Data());
19023     fDiffFlowCovariancesHistList[t][pe]->Add(fDiffFlowCovariances[t][pe][covIndex]); 
19024    } // end of for(Int_t covIndex=0;covIndex<5;covIndex++) // covariance index
19025    // products of both types of correlations: 
19026    TString diffFlowProductOfCorrelationsProName = "fDiffFlowProductOfCorrelationsPro";
19027    diffFlowProductOfCorrelationsProName += fAnalysisLabel->Data();  
19028    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
19029    {
19030     for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
19031     {
19032      fDiffFlowProductOfCorrelationsPro[t][pe][mci1][mci2] = new TProfile(Form("%s, %s, %s, %s, %s",diffFlowProductOfCorrelationsProName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),mixedCorrelationIndex[mci1].Data(),mixedCorrelationIndex[mci2].Data()),Form("%s, %s, %s, %s #times %s",diffFlowProductOfCorrelationsProName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),mixedCorrelationIndex[mci1].Data(),mixedCorrelationIndex[mci2].Data()),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
19033      fDiffFlowProductOfCorrelationsPro[t][pe][mci1][mci2]->SetXTitle(ptEtaFlag[pe].Data());
19034      fDiffFlowProductOfCorrelationsProList[t][pe]->Add(fDiffFlowProductOfCorrelationsPro[t][pe][mci1][mci2]); 
19035      if(mci1%2 == 0) mci2++; // products which DO NOT include reduced correlations are not stored here
19036     } // end of for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
19037    } // end of for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index    
19038   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
19039  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
19040  // sums of event weights for reduced correlations: 
19041  TString diffFlowSumOfEventWeightsName = "fDiffFlowSumOfEventWeights";
19042  diffFlowSumOfEventWeightsName += fAnalysisLabel->Data();  
19043  for(Int_t t=0;t<2;t++) // type is RP or POI
19044  { 
19045   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19046   { 
19047    for(Int_t p=0;p<2;p++) // power of weights is either 1 or 2
19048    {
19049     for(Int_t ew=0;ew<4;ew++) // index of reduced correlation
19050     {
19051      fDiffFlowSumOfEventWeights[t][pe][p][ew] = new TH1D(Form("%s, %s, %s, %s, %s",diffFlowSumOfEventWeightsName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),powerFlag[p].Data(),reducedCorrelationIndex[ew].Data()),Form("%s, %s, %s, power = %s, %s",diffFlowSumOfEventWeightsName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),powerFlag[p].Data(),reducedCorrelationIndex[ew].Data()),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
19052      fDiffFlowSumOfEventWeights[t][pe][p][ew]->SetXTitle(ptEtaFlag[pe].Data());
19053      fDiffFlowSumOfEventWeightsHistList[t][pe][p]->Add(fDiffFlowSumOfEventWeights[t][pe][p][ew]); // to be improved (add dedicated list to hold all this)
19054     }
19055    }
19056   }
19057  } 
19058  // sum of products of event weights for both types of correlations: 
19059  TString diffFlowSumOfProductOfEventWeightsName = "fDiffFlowSumOfProductOfEventWeights";
19060  diffFlowSumOfProductOfEventWeightsName += fAnalysisLabel->Data();  
19061  for(Int_t t=0;t<2;t++) // type is RP or POI
19062  {
19063   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19064   { 
19065    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
19066    {
19067     for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
19068     {
19069      fDiffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2] = new TH1D(Form("%s, %s, %s, %s, %s",diffFlowSumOfProductOfEventWeightsName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),mixedCorrelationIndex[mci1].Data(),mixedCorrelationIndex[mci2].Data()),Form("%s, %s, %s, %s #times %s",diffFlowSumOfProductOfEventWeightsName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),mixedCorrelationIndex[mci1].Data(),mixedCorrelationIndex[mci2].Data()),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
19070      fDiffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2]->SetXTitle(ptEtaFlag[pe].Data());
19071      fDiffFlowSumOfProductOfEventWeightsHistList[t][pe]->Add(fDiffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2]); 
19072      if(mci1%2 == 0) mci2++; // products which DO NOT include reduced correlations are not stored here
19073     }
19074    }
19075   }
19076  } 
19077  // correction terms for nua:
19078  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
19079  { 
19080   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19081   {
19082    for(Int_t sc=0;sc<2;sc++) // sin or cos
19083    {
19084     for(Int_t cti=0;cti<9;cti++) // correction term index
19085     {
19086      fDiffFlowCorrectionTermsForNUAHist[t][pe][sc][cti] = new TH1D(Form("%s, %s, %s, %s, cti = %d",diffFlowCorrectionTermsForNUAHistName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),sinCosFlag[sc].Data(),cti+1),Form("%s, %s, %s, %s, cti = %d",diffFlowCorrectionTermsForNUAHistName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),sinCosFlag[sc].Data(),cti+1),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
19087      fDiffFlowCorrectionsHistList[t][pe]->Add(fDiffFlowCorrectionTermsForNUAHist[t][pe][sc][cti]);
19088     }
19089    }
19090   }
19091  } 
19092           
19093 } // end of AliFlowAnalysisWithQCumulants::BookEverythingForDifferentialFlow()
19094
19095 //=======================================================================================================================
19096
19097 void AliFlowAnalysisWithQCumulants::CalculateQcumulantsCorrectedForNUAIntFlow()
19098 {
19099  // Calculate generalized Q-cumulants (cumulants corrected for non-unifom acceptance).
19100  
19101  // Isotropic cumulants:
19102  Double_t QC2 = fIntFlowQcumulants->GetBinContent(1);
19103  Double_t QC2Error = fIntFlowQcumulants->GetBinError(1);
19104  Double_t QC4 = fIntFlowQcumulants->GetBinContent(2);
19105  Double_t QC4Error = fIntFlowQcumulants->GetBinError(2);
19106  //Double_t QC6 = fIntFlowQcumulants->GetBinContent(3);
19107  //Double_t QC6Error = fIntFlowQcumulants->GetBinError(3);
19108  //Double_t QC8 = fIntFlowQcumulants->GetBinContent(4);
19109  //Double_t QC8Error = fIntFlowQcumulants->GetBinError(4);
19110  
19111  // Measured 2-, 4-, 6- and 8-particle correlations:
19112  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>>
19113  Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1); // statistical error of <<2>>
19114  Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>>
19115  Double_t fourError = fIntFlowCorrelationsHist->GetBinError(2); // statistical error of <<4>>
19116  //Double_t six = fIntFlowCorrelationsHist->GetBinContent(3); // <<6>>
19117  //Double_t sixError = fIntFlowCorrelationsHist->GetBinError(3); // statistical error of <<6>>
19118  //Double_t eight = fIntFlowCorrelationsHist->GetBinContent(4); // <<8>>
19119  //Double_t eightError = fIntFlowCorrelationsHist->GetBinError(4); // statistical error of <<8>>
19120   
19121  // Non-isotropic terms:
19122  Double_t c1 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(1); // <<cos(n*phi1)>>
19123  Double_t c1Error = fIntFlowCorrectionTermsForNUAHist[1]->GetBinError(1); // statistical error of <<cos(n*phi1)>>
19124  Double_t c2 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(2); // <<cos(n*(phi1+phi2))>>
19125  Double_t c2Error = fIntFlowCorrectionTermsForNUAHist[1]->GetBinError(2); // statistical error of <<cos(n*(phi1+phi2))>>
19126  Double_t c3 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(3); // <<cos(n*(phi1-phi2-phi3))>>
19127  Double_t c3Error = fIntFlowCorrectionTermsForNUAHist[1]->GetBinError(3); // statistical error of <<cos(n*(phi1-phi2-phi3))>>
19128  Double_t s1 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(1); // <<sin(n*phi1)>>
19129  Double_t s1Error = fIntFlowCorrectionTermsForNUAHist[0]->GetBinError(1); // statistical error of <<sin(n*phi1)>>
19130  Double_t s2 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(2); // <<sin(n*(phi1+phi2))>>
19131  Double_t s2Error = fIntFlowCorrectionTermsForNUAHist[0]->GetBinError(2); // statistical error of <<sin(n*(phi1+phi2))>>
19132  Double_t s3 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(3); // <<sin(n*(phi1-phi2-phi3))>>
19133  Double_t s3Error = fIntFlowCorrectionTermsForNUAHist[0]->GetBinError(3); // statistical error of <<sin(n*(phi1-phi2-phi3))>>
19134  
19135  // Shortcuts:
19136  Double_t a1 = 2.*pow(c1,2.)+2.*pow(s1,2.)-two;
19137  Double_t a2 = 6.*pow(c1,3.)-2.*c1*c2+c3+6.*c1*pow(s1,2.)-2.*s1*s2-4.*c1*two;
19138  Double_t a3 = 2.*pow(s1,2.)-2.*pow(c1,2.)+c2;
19139  Double_t a4 = 6.*pow(s1,3.)+6.*pow(c1,2.)*s1+2.*c2*s1-2.*c1*s2-s3-4.*s1*two;
19140  Double_t a5 = 4.*c1*s1-s2;
19141  
19142  // Covariances (including weight dependent prefactor):
19143  Double_t wCov1 = 0.; // w*Cov(<2>,<cos(phi)) 
19144  Double_t wCov2 = 0.; // w*Cov(<2>,<sin(phi))
19145  Double_t wCov3 = 0.; // w*Cov(<cos(phi),<sin(phi))
19146  Double_t wCov4 = 0.; // w*Cov(<2>,<4>) 
19147  Double_t wCov5 = 0.; // w*Cov(<2>,<cos(#phi_{1}+#phi_{2})>)
19148  Double_t wCov6 = 0.; // w*Cov(<2>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19149  Double_t wCov7 = 0.; // w*Cov(<2>,<sin(#phi_{1}+#phi_{2})>)
19150  Double_t wCov8 = 0.; // w*Cov(<2>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19151  Double_t wCov9 = 0.; // w*Cov(<4>,<cos(#phi)>
19152  Double_t wCov10 = 0.; // w*Cov(<4>,<cos(#phi_{1}+#phi_{2})>)
19153  Double_t wCov11 = 0.; // w*Cov(<4>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19154  Double_t wCov12 = 0.; // w*Cov(<4>,<sin(#phi)>
19155  Double_t wCov13 = 0.; // w*Cov(<4>,<sin(#phi_{1}+#phi_{2})>)
19156  Double_t wCov14 = 0.; // w*Cov(<4>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19157  Double_t wCov15 = 0.; // w*Cov(<cos(#phi)>,<cos(#phi_{1}+#phi_{2})>)
19158  Double_t wCov16 = 0.; // w*Cov(<cos(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19159  Double_t wCov17 = 0.; // w*Cov(<cos(#phi)>,<sin(#phi_{1}+#phi_{2})>)
19160  Double_t wCov18 = 0.; // w*Cov(<cos(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19161  Double_t wCov19 = 0.; // w*Cov(<cos(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19162  Double_t wCov20 = 0.; // w*Cov(<sin(#phi)>,<cos(#phi_{1}+#phi_{2})>)
19163  Double_t wCov21 = 0.; // w*Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}+#phi_{2})>)
19164  Double_t wCov22 = 0.; // w*Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19165  Double_t wCov23 = 0.; // w*Cov(<sin(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19166  Double_t wCov24 = 0.; // w*Cov(<sin(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19167  Double_t wCov25 = 0.; // w*Cov(<cos(#phi_{1}-#phi_{2}-#phi_{3}>,<sin(#phi_{1}-#phi_{2}-#phi_{3}>)
19168  Double_t wCov26 = 0.; // w*Cov(<sin(#phi)>,<sin(#phi_{1}+#phi_{2})>)
19169  Double_t wCov27 = 0.; // w*Cov(<sin(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19170  Double_t wCov28 = 0.; // w*Cov(<sin(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19171  if(!fForgetAboutCovariances)
19172  {
19173   wCov1 = fIntFlowCovariancesNUA->GetBinContent(1); // w*Cov(<2>,<cos(phi)) 
19174   wCov2 = fIntFlowCovariancesNUA->GetBinContent(2); // w*Cov(<2>,<sin(phi))
19175   wCov3 = fIntFlowCovariancesNUA->GetBinContent(3); // w*Cov(<cos(phi),<sin(phi))
19176   wCov4 = fIntFlowCovariances->GetBinContent(1); // w*Cov(<2>,<4>) 
19177   wCov5 = fIntFlowCovariancesNUA->GetBinContent(4); // w*Cov(<2>,<cos(#phi_{1}+#phi_{2})>)
19178   wCov6 = fIntFlowCovariancesNUA->GetBinContent(6); // w*Cov(<2>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19179   wCov7 = fIntFlowCovariancesNUA->GetBinContent(5); // w*Cov(<2>,<sin(#phi_{1}+#phi_{2})>)
19180   wCov8 = fIntFlowCovariancesNUA->GetBinContent(7); // w*Cov(<2>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19181   wCov9 = fIntFlowCovariancesNUA->GetBinContent(8); // w*Cov(<4>,<cos(#phi)>
19182   wCov10 = fIntFlowCovariancesNUA->GetBinContent(10); // w*Cov(<4>,<cos(#phi_{1}+#phi_{2})>)
19183   wCov11 = fIntFlowCovariancesNUA->GetBinContent(12); // w*Cov(<4>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19184   wCov12 = fIntFlowCovariancesNUA->GetBinContent(9); // w*Cov(<4>,<sin(#phi)>
19185   wCov13 = fIntFlowCovariancesNUA->GetBinContent(11); // w*Cov(<4>,<sin(#phi_{1}+#phi_{2})>)
19186   wCov14 = fIntFlowCovariancesNUA->GetBinContent(13); // w*Cov(<4>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19187   wCov15 = fIntFlowCovariancesNUA->GetBinContent(14); // w*Cov(<cos(#phi)>,<cos(#phi_{1}+#phi_{2})>)
19188   wCov16 = fIntFlowCovariancesNUA->GetBinContent(16); // w*Cov(<cos(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19189   wCov17 = fIntFlowCovariancesNUA->GetBinContent(15); // w*Cov(<cos(#phi)>,<sin(#phi_{1}+#phi_{2})>)
19190   wCov18 = fIntFlowCovariancesNUA->GetBinContent(17); // w*Cov(<cos(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19191   wCov19 = fIntFlowCovariancesNUA->GetBinContent(23); // w*Cov(<cos(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19192   wCov20 = fIntFlowCovariancesNUA->GetBinContent(18); // w*Cov(<sin(#phi)>,<cos(#phi_{1}+#phi_{2})>)
19193   wCov21 = fIntFlowCovariancesNUA->GetBinContent(22); // w*Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}+#phi_{2})>)
19194   wCov22 = fIntFlowCovariancesNUA->GetBinContent(24); // w*Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19195   wCov23 = fIntFlowCovariancesNUA->GetBinContent(20); // w*Cov(<sin(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19196   wCov24 = fIntFlowCovariancesNUA->GetBinContent(25); // w*Cov(<sin(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19197   wCov25 = fIntFlowCovariancesNUA->GetBinContent(27); // w*Cov(<cos(#phi_{1}-#phi_{2}-#phi_{3}>,<sin(#phi_{1}-#phi_{2}-#phi_{3}>)
19198   wCov26 = fIntFlowCovariancesNUA->GetBinContent(19); // w*Cov(<sin(#phi)>,<sin(#phi_{1}+#phi_{2})>)
19199   wCov27 = fIntFlowCovariancesNUA->GetBinContent(21); // w*Cov(<sin(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19200   wCov28 = fIntFlowCovariancesNUA->GetBinContent(26); // w*Cov(<sin(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19201  } // end of if(!fForgetAboutCovariances)
19202  
19203  // Calculating generalized QC{2}:
19204  //  Generalized QC{2}:
19205  Double_t gQC2 = two - pow(c1,2.) - pow(s1,2.);
19206  if(fApplyCorrectionForNUA){fIntFlowQcumulants->SetBinContent(1,gQC2);} 
19207  //  Statistical error of generalized QC{2}:
19208  Double_t gQC2ErrorSquared = pow(twoError,2.)+4.*pow(c1,2.)*pow(c1Error,2.)
19209                            + 4.*pow(s1,2.)*pow(s1Error,2.)
19210                            - 4*c1*wCov1-4*s1*wCov2 
19211                            + 8.*c1*s1*wCov3;
19212  //  Store ratio of error squared - with/without NUA terms:
19213  Double_t ratioErrorSquaredQC2 = 0.;
19214  if(fIntFlowQcumulants->GetBinError(1)>0.)
19215  { 
19216   ratioErrorSquaredQC2 = (gQC2ErrorSquared/pow(fIntFlowQcumulants->GetBinError(1),2.));
19217   fIntFlowQcumulantsErrorSquaredRatio->SetBinContent(1,ratioErrorSquaredQC2);
19218  }
19219  //  If enabled, store error by including non-isotropic terms:                         
19220  if(fApplyCorrectionForNUA && fPropagateErrorAlsoFromNIT)
19221  {
19222   if(gQC2ErrorSquared>=0.)
19223   {
19224    fIntFlowQcumulants->SetBinError(1,pow(gQC2ErrorSquared,0.5));
19225   } else
19226     {
19227      fIntFlowQcumulants->SetBinError(1,0.);
19228      cout<<endl;
19229      cout<<" WARNING (QC): Statistical error of generalized QC{2} is imaginary !!!!"<<endl;
19230      cout<<endl;
19231     }   
19232  } // end of if(fApplyCorrectionForNUA && fPropagateErrorAlsoFromNIT)
19233  // Quantify detector bias to QC{2}:
19234  if(TMath::Abs(QC2)>0.)
19235  {
19236   fIntFlowDetectorBias->SetBinContent(1,gQC2/QC2); 
19237   if(QC2Error>0.)
19238   {
19239    Double_t errorSquared = gQC2ErrorSquared/pow(QC2,2.)+pow(gQC2,2.)*pow(QC2Error,2.)/pow(QC2,4.);
19240    if(errorSquared>0.)
19241    {
19242     fIntFlowDetectorBias->SetBinError(1,pow(errorSquared,0.5));  
19243    }
19244   }
19245  } // end of if(TMath::Abs(QC2)>0.)
19246
19247  // Calculating generalized QC{4}:
19248  //  Generalized QC{4}:
19249  Double_t gQC4 = four-2.*pow(two,2.)
19250                - 4.*c1*c3+4.*s1*s3-pow(c2,2.)-pow(s2,2.)
19251                + 4.*c2*(pow(c1,2.)-pow(s1,2.))+8.*s2*s1*c1
19252                + 8.*two*(pow(c1,2.)+pow(s1,2.))-6.*pow((pow(c1,2.)+pow(s1,2.)),2.);
19253  if(fApplyCorrectionForNUA){fIntFlowQcumulants->SetBinContent(2,gQC4);}   
19254  //  Statistical error of generalized QC{4}:
19255  Double_t gQC4ErrorSquared = 16.*pow(a1,2.)*pow(twoError,2.)+pow(fourError,2.)+16.*pow(a2,2.)*pow(c1Error,2.)
19256                            + 4.*pow(a3,2.)*pow(c2Error,2.)+16.*pow(c1,2.)*pow(c3Error,2.)
19257                            + 16.*pow(a4,2.)*pow(s1Error,2.)+4.*pow(a5,2.)*pow(s2Error,2.)
19258                            + 16.*pow(s1,2.)*pow(s3Error,2.)+8.*a1*wCov4-32.*a1*a2*wCov1
19259                            - 16.*a3*a1*wCov5-32.*c1*a1*wCov6-32.*a1*a4*wCov2+16.*a5*a1*wCov7
19260                            + 32.*s1*a1*wCov8-8.*a2*wCov9-4.*a3*wCov10-8.*c1*wCov11-8.*a4*wCov12
19261                            + 4.*a5*wCov13+8.*s1*wCov14+16.*a3*a2*wCov15+32.*c1*a2*wCov16+32.*a2*a4*wCov3
19262                            - 16.*a5*a2*wCov17-32.*s1*a2*wCov18+16.*c1*a3*wCov19+16.*a3*a4*wCov20
19263                            - 8.*a3*a5*wCov21-16.*s1*a3*wCov22+32.*c1*a4*wCov23-16.*c1*a5*wCov24
19264                            - 32.*c1*s1*wCov25-16.*a5*a4*wCov26-32.*s1*a4*wCov27+16.*s1*a5*wCov28;
19265  //  Store ratio of error squared - with/without NUA terms:
19266  Double_t ratioErrorSquaredQC4 = 0.;
19267  if(fIntFlowQcumulants->GetBinError(2)>0.)
19268  { 
19269   ratioErrorSquaredQC4 = (gQC4ErrorSquared/pow(fIntFlowQcumulants->GetBinError(2),2.));
19270   fIntFlowQcumulantsErrorSquaredRatio->SetBinContent(2,ratioErrorSquaredQC4);
19271  }                          
19272  if(fApplyCorrectionForNUA && fPropagateErrorAlsoFromNIT)
19273  {
19274   if(gQC4ErrorSquared>=0.)
19275   {
19276    fIntFlowQcumulants->SetBinError(2,pow(gQC4ErrorSquared,0.5));
19277   } else
19278     {
19279      fIntFlowQcumulants->SetBinError(2,0.);
19280      cout<<endl;
19281      cout<<" WARNING (QC): Statistical error of generalized QC{4} is imaginary !!!!"<<endl;
19282      cout<<endl;
19283     }   
19284  } // end of if(fApplyCorrectionForNUA && fPropagateErrorAlsoFromNIT)
19285  // Quantify detector bias to QC{4}:
19286  if(TMath::Abs(QC4)>0.)
19287  {
19288   fIntFlowDetectorBias->SetBinContent(2,gQC4/QC4); 
19289   if(QC4Error>0.)
19290   {
19291    Double_t errorSquared = gQC4ErrorSquared/pow(QC4,2.)+pow(gQC4,2.)*pow(QC4Error,2.)/pow(QC4,4.);
19292    if(errorSquared>0.)
19293    {
19294     fIntFlowDetectorBias->SetBinError(2,pow(errorSquared,0.5));  
19295    }
19296   }
19297  } // end of if(TMath::Abs(QC4)>0.)
19298
19299
19300  // .... to be improved (continued for 6th and 8th order) ....            
19301  
19302      
19303  // versus multiplicity:
19304  if(fCalculateCumulantsVsM) // to be improved - propagate error for nua terms vs M
19305  { 
19306   Int_t nBins = fIntFlowCorrelationsVsMPro[0]->GetNbinsX(); // to be improved (hardwired 0) 
19307   Double_t value[4] = {0.}; // QCs vs M
19308   Double_t error[4] = {0.}; // error of QCs vs M
19309   Double_t dSum1[4] = {0.}; // sum value_i/(error_i)^2
19310   Double_t dSum2[4] = {0.}; // sum 1/(error_i)^2
19311   for(Int_t b=1;b<=nBins;b++)
19312   {
19313    // Measured correlations:
19314    two = fIntFlowCorrelationsVsMHist[0]->GetBinContent(b); // <<2>> vs M
19315    four = fIntFlowCorrelationsVsMHist[1]->GetBinContent(b); // <<4>> vs M
19316    // Isotropic cumulants:
19317    QC2 = two;
19318    QC4 = four-2.*pow(two,2.);
19319    // Non-isotropic terms:
19320    c1 = fIntFlowCorrectionTermsForNUAVsMPro[1][0]->GetBinContent(b); // <<cos(n*phi1)>>
19321    c2 = fIntFlowCorrectionTermsForNUAVsMPro[1][1]->GetBinContent(b); // <<cos(n*(phi1+phi2))>>
19322    c3 = fIntFlowCorrectionTermsForNUAVsMPro[1][2]->GetBinContent(b); // <<cos(n*(phi1-phi2-phi3))>>
19323    s1 = fIntFlowCorrectionTermsForNUAVsMPro[0][0]->GetBinContent(b); // <<sin(n*phi1)>>
19324    s2 = fIntFlowCorrectionTermsForNUAVsMPro[0][1]->GetBinContent(b); // <<sin(n*(phi1+phi2))>>
19325    s3 = fIntFlowCorrectionTermsForNUAVsMPro[0][2]->GetBinContent(b); // <<sin(n*(phi1-phi2-phi3))>>
19326    // Generalized QC{2} vs M:
19327    gQC2 = two - pow(c1,2.) - pow(s1,2.); 
19328    if(fApplyCorrectionForNUAVsM){fIntFlowQcumulantsVsM[0]->SetBinContent(b,gQC2);}   
19329    // Generalized QC{4} vs M:  
19330    gQC4 = four-2.*pow(two,2.)
19331                  - 4.*c1*c3+4.*s1*s3-pow(c2,2.)-pow(s2,2.)
19332                  + 4.*c2*(pow(c1,2.)-pow(s1,2.))+8.*s2*s1*c1
19333                  + 8.*two*(pow(c1,2.)+pow(s1,2.))-6.*pow((pow(c1,2.)+pow(s1,2.)),2.);
19334    if(fApplyCorrectionForNUAVsM){fIntFlowQcumulantsVsM[1]->SetBinContent(b,gQC4);}   
19335    // Detector bias vs M:
19336    if(TMath::Abs(QC2)>0.)
19337    {
19338     fIntFlowDetectorBiasVsM[0]->SetBinContent(b,gQC2/QC2); 
19339    } // end of if(TMath::Abs(QC2)>0.)
19340    if(TMath::Abs(QC4)>0.)
19341    {
19342     fIntFlowDetectorBiasVsM[1]->SetBinContent(b,gQC4/QC4); 
19343    } // end of if(TMath::Abs(QC4)>0.)  
19344    // Rebin in M:
19345    for(Int_t co=0;co<4;co++)
19346    {
19347     value[co] = fIntFlowQcumulantsVsM[co]->GetBinContent(b);
19348     error[co] = fIntFlowQcumulantsVsM[co]->GetBinError(b);
19349     if(error[co]>0.)
19350     {
19351      dSum1[co]+=value[co]/(error[co]*error[co]);
19352      dSum2[co]+=1./(error[co]*error[co]);
19353     }
19354    } // end of for(Int_t co=0;co<4;co++) 
19355   } // end of for(Int_t b=1;b<=nBins;b++)
19356   // Store rebinned Q-cumulants:
19357   if(fApplyCorrectionForNUAVsM)
19358   {
19359    for(Int_t co=0;co<4;co++)
19360    {
19361     if(dSum2[co]>0.)
19362     {
19363      fIntFlowQcumulantsRebinnedInM->SetBinContent(co+1,dSum1[co]/dSum2[co]);
19364      fIntFlowQcumulantsRebinnedInM->SetBinError(co+1,pow(1./dSum2[co],0.5));
19365     }
19366    } // end of for(Int_t co=0;co<4;co++)
19367   } // end of if(fApplyCorrectionForNUAVsM)
19368  } // end of if(fCalculateCumulantsVsM) 
19369      
19370 } // end of void AliFlowAnalysisWithQCumulants::CalculateQcumulantsCorrectedForNUAIntFlow()
19371  
19372 //=======================================================================================================================
19373
19374 void AliFlowAnalysisWithQCumulants::FinalizeCorrectionTermsForNUAIntFlow() 
19375 {
19376  // From profile fIntFlowCorrectionTermsForNUAPro[sc] access measured correction terms for NUA
19377  // and their spread, correctly calculate the statistical errors and store the final 
19378  // results and statistical errors for correction terms for NUA in histogram fIntFlowCorrectionTermsForNUAHist[sc].
19379  //
19380  // Remark: Statistical error of correction temrs is calculated as:
19381  //
19382  //          statistical error = termA * spread * termB:
19383  //          termA = sqrt{sum_{i=1}^{N} w^2}/(sum_{i=1}^{N} w)
19384  //          termB = 1/sqrt(1-termA^2)   
19385  
19386  TString sinCosFlag[2] = {"sin","cos"}; // to be improved - promore this to data member?
19387  TString nonisotropicTermFlag[4] = {"(n(phi1))","(n(phi1+phi2))","(n(phi1-phi2-phi3))","(n(2phi1-phi2))"}; // to be improved - hardwired 4
19388     
19389  for(Int_t sc=0;sc<2;sc++) // sin or cos correction terms 
19390  {
19391   for(Int_t ci=1;ci<=4;ci++) // correction term index (to be improved - hardwired 4)
19392   {
19393    Double_t correction = fIntFlowCorrectionTermsForNUAPro[sc]->GetBinContent(ci);
19394    Double_t spread = fIntFlowCorrectionTermsForNUAPro[sc]->GetBinError(ci);
19395    Double_t sumOfLinearEventWeights = fIntFlowSumOfEventWeightsNUA[sc][0]->GetBinContent(ci);
19396    Double_t sumOfQuadraticEventWeights = fIntFlowSumOfEventWeightsNUA[sc][1]->GetBinContent(ci);
19397    Double_t termA = 0.;
19398    Double_t termB = 0.;
19399    if(TMath::Abs(sumOfLinearEventWeights)>1.e-44)
19400    {
19401     termA = pow(sumOfQuadraticEventWeights,0.5)/sumOfLinearEventWeights;
19402    } else
19403      {
19404       cout<<" WARNING (QC): sumOfLinearEventWeights == 0 in AFAWQC::FCTFNIF() !!!!"<<endl;
19405       cout<<Form("               (for <<%s[%s]>> non-isotropic term)",sinCosFlag[sc].Data(),nonisotropicTermFlag[ci-1].Data())<<endl;
19406      }
19407    if(1.-pow(termA,2.) > 0.)
19408    {
19409     termB = 1./pow(1-pow(termA,2.),0.5);
19410    } else
19411      {
19412       cout<<" WARNING (QC): 1.-pow(termA,2.) <= 0 in AFAWQC::FCTFNIF() !!!!"<<endl;   
19413       cout<<Form("               (for <<%s[%s]>> non-isotropic term)",sinCosFlag[sc].Data(),nonisotropicTermFlag[ci-1].Data())<<endl;
19414      }     
19415    Double_t statisticalError = termA * spread * termB;
19416    fIntFlowCorrectionTermsForNUAHist[sc]->SetBinContent(ci,correction);
19417    fIntFlowCorrectionTermsForNUAHist[sc]->SetBinError(ci,statisticalError);
19418   } // end of for(Int_t ci=1;ci<=4;ci++) // correction term index
19419  } // end of for(Int sc=0;sc<2;sc++) // sin or cos correction terms 
19420                                                                                                                                                                                                
19421 } // end of void AliFlowAnalysisWithQCumulants::FinalizeCorrectionTermsForNUAIntFlow()
19422
19423 //=======================================================================================================================
19424
19425 void AliFlowAnalysisWithQCumulants::GetPointersForNestedLoopsHistograms()
19426 {
19427  // Get pointers to all objects relevant for calculations with nested loops.
19428    
19429  TList *nestedLoopsList = dynamic_cast<TList*>(fHistList->FindObject("Nested Loops"));
19430  if(nestedLoopsList) 
19431  {
19432   this->SetNestedLoopsList(nestedLoopsList);
19433  } else
19434    {
19435     cout<<"WARNING: nestedLoopsList is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
19436     exit(0);
19437    }
19438     
19439   TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data members?)
19440   TString typeFlag[2] = {"RP","POI"}; // to be improved (should I promote this to data members?)
19441   TString ptEtaFlag[2] = {"p_{T}","#eta"}; // to be improved (should I promote this to data members?)
19442   TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"}; // to be improved (should I promote this to data members?)
19443    
19444   TString evaluateNestedLoopsName = "fEvaluateNestedLoops";
19445   evaluateNestedLoopsName += fAnalysisLabel->Data();  
19446   TProfile *evaluateNestedLoops = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(evaluateNestedLoopsName.Data()));
19447   Bool_t bEvaluateIntFlowNestedLoops = kFALSE;
19448   Bool_t bEvaluateDiffFlowNestedLoops = kFALSE;
19449   if(evaluateNestedLoops)
19450   {
19451    this->SetEvaluateNestedLoops(evaluateNestedLoops);
19452    bEvaluateIntFlowNestedLoops = (Int_t)evaluateNestedLoops->GetBinContent(1);
19453    bEvaluateDiffFlowNestedLoops = (Int_t)evaluateNestedLoops->GetBinContent(2);
19454   }
19455   // nested loops relevant for integrated flow:  
19456   if(bEvaluateIntFlowNestedLoops)
19457   {
19458    // correlations:
19459    TString intFlowDirectCorrelationsName = "fIntFlowDirectCorrelations";
19460    intFlowDirectCorrelationsName += fAnalysisLabel->Data();
19461    TProfile *intFlowDirectCorrelations = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(intFlowDirectCorrelationsName.Data()));
19462    if(intFlowDirectCorrelations) 
19463    { 
19464     this->SetIntFlowDirectCorrelations(intFlowDirectCorrelations);
19465    } else
19466      {
19467       cout<<"WARNING: intFlowDirectCorrelations is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
19468       exit(0);
19469      }
19470    if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)  
19471    {
19472     TString intFlowExtraDirectCorrelationsName = "fIntFlowExtraDirectCorrelations";
19473     intFlowExtraDirectCorrelationsName += fAnalysisLabel->Data();
19474     TProfile *intFlowExtraDirectCorrelations = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(intFlowExtraDirectCorrelationsName.Data()));
19475     if(intFlowExtraDirectCorrelations) 
19476     { 
19477      this->SetIntFlowExtraDirectCorrelations(intFlowExtraDirectCorrelations);
19478     } else
19479       {
19480        cout<<"WARNING: intFlowExtraDirectCorrelations is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
19481        exit(0);
19482       }       
19483    } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)  
19484    // correction terms for non-uniform acceptance:
19485    TString intFlowDirectCorrectionTermsForNUAName = "fIntFlowDirectCorrectionTermsForNUA";
19486    intFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();
19487    TProfile *intFlowDirectCorrectionTermsForNUA[2] = {NULL};
19488    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
19489    {
19490     intFlowDirectCorrectionTermsForNUA[sc] = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(Form("%s: %s terms",intFlowDirectCorrectionTermsForNUAName.Data(),sinCosFlag[sc].Data())));
19491     if(intFlowDirectCorrectionTermsForNUA[sc]) 
19492     { 
19493      this->SetIntFlowDirectCorrectionTermsForNUA(intFlowDirectCorrectionTermsForNUA[sc],sc);
19494     } else
19495       {
19496        cout<<"WARNING: intFlowDirectCorrectionTermsForNUA[sc] is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
19497        cout<<"sc = "<<sc<<endl;
19498        exit(0);
19499       }
19500    } // end of for(Int_t sc=0;sc<2;sc++) 
19501    // Mixed harmonics:
19502    if(fCalculateMixedHarmonics)
19503    {
19504     TString mixedHarmonicsNestedLoopsName = "fMixedHarmonicsNestedLoops";
19505     mixedHarmonicsNestedLoopsName += fAnalysisLabel->Data();
19506     TProfile *mixedHarmonicsNestedLoops = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(mixedHarmonicsNestedLoopsName.Data()));
19507     if(mixedHarmonicsNestedLoops) 
19508     { 
19509      this->SetMixedHarmonicsNestedLoops(mixedHarmonicsNestedLoops);
19510     } else
19511       {
19512        cout<<"WARNING: mixedHarmonicsNestedLoops is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
19513        exit(0);
19514       }
19515    } // end of if(fCalculateMixedHarmonics)
19516   } // end of if(bEvaluateIntFlowNestedLoops)
19517     
19518   // nested loops relevant for differential flow:  
19519   if(bEvaluateDiffFlowNestedLoops)
19520   {
19521    // correlations:
19522    TString diffFlowDirectCorrelationsName = "fDiffFlowDirectCorrelations";
19523    diffFlowDirectCorrelationsName += fAnalysisLabel->Data();
19524    TProfile *diffFlowDirectCorrelations[2][2][4] = {{{NULL}}};
19525    for(Int_t t=0;t<2;t++)
19526    {
19527     for(Int_t pe=0;pe<2;pe++)
19528     {
19529      for(Int_t ci=0;ci<4;ci++) // correlation index
19530      {
19531       diffFlowDirectCorrelations[t][pe][ci] = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(Form("%s, %s, %s, %s",diffFlowDirectCorrelationsName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),reducedCorrelationIndex[ci].Data())));
19532       if(diffFlowDirectCorrelations[t][pe][ci])
19533       {
19534        this->SetDiffFlowDirectCorrelations(diffFlowDirectCorrelations[t][pe][ci],t,pe,ci);
19535       } else
19536         {
19537          cout<<"WARNING: diffFlowDirectCorrelations[t][pe][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19538          cout<<"t  = "<<t<<endl;
19539          cout<<"pe = "<<pe<<endl;   
19540          cout<<"ci = "<<ci<<endl;
19541         }     
19542      } // end of for(Int_t ci=0;ci<4;ci++) // correlation index  
19543     } // end of for(Int_t pe=0;pe<2;pe++)
19544    } // end of for(Int_t t=0;t<2;t++)   
19545    // correction terms for non-uniform acceptance:
19546    TString diffFlowDirectCorrectionTermsForNUAName = "fDiffFlowDirectCorrectionTermsForNUA";
19547    diffFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();  
19548    TProfile *diffFlowDirectCorrectionTermsForNUA[2][2][2][10] = {{{{NULL}}}};   
19549    for(Int_t t=0;t<2;t++)
19550    {
19551     for(Int_t pe=0;pe<2;pe++)
19552     {
19553      // correction terms for NUA:
19554      for(Int_t sc=0;sc<2;sc++) // sin or cos
19555      {
19556       for(Int_t cti=0;cti<9;cti++) // correction term index
19557       {
19558        diffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti] = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(Form("%s, %s, %s, %s, cti = %d",diffFlowDirectCorrectionTermsForNUAName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),sinCosFlag[sc].Data(),cti+1)));
19559        if(diffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti])
19560        {
19561         this->SetDiffFlowDirectCorrectionTermsForNUA(diffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti],t,pe,sc,cti);
19562        } else
19563          {
19564           cout<<"WARNING: diffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19565           cout<<"t   = "<<t<<endl;
19566           cout<<"pe  = "<<pe<<endl;   
19567           cout<<"sc  = "<<sc<<endl;
19568           cout<<"cti = "<<cti<<endl;
19569          }    
19570       } // end of for(Int_t cti=0;cti<9;cti++) // correction term index
19571      } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
19572     } // end of for(Int_t pe=0;pe<2;pe++)
19573    } // end of for(Int_t t=0;t<2;t++)
19574    // other differential correlators:
19575    TString otherDirectDiffCorrelatorsName = "fOtherDirectDiffCorrelators";
19576    otherDirectDiffCorrelatorsName += fAnalysisLabel->Data();  
19577    TProfile *otherDirectDiffCorrelators[2][2][2][1] = {{{{NULL}}}};   
19578    for(Int_t t=0;t<2;t++)
19579    {
19580     for(Int_t pe=0;pe<2;pe++)
19581     {
19582      // correction terms for NUA:
19583      for(Int_t sc=0;sc<2;sc++) // sin or cos
19584      {
19585       for(Int_t ci=0;ci<1;ci++) // correlator index
19586       {
19587        otherDirectDiffCorrelators[t][pe][sc][ci] = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(Form("%s, %s, %s, %s, ci = %d",otherDirectDiffCorrelatorsName.Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data(),sinCosFlag[sc].Data(),ci+1)));
19588        if(otherDirectDiffCorrelators[t][pe][sc][ci])
19589        {
19590         this->SetOtherDirectDiffCorrelators(otherDirectDiffCorrelators[t][pe][sc][ci],t,pe,sc,ci);
19591        } else
19592          {
19593           cout<<"WARNING: otherDirectDiffCorrelators[t][pe][sc][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19594           cout<<"t   = "<<t<<endl;
19595           cout<<"pe  = "<<pe<<endl;   
19596           cout<<"sc  = "<<sc<<endl;
19597           cout<<"ci = "<<ci<<endl;
19598          }    
19599       } // end of for(Int_t ci=0;ci<9;ci++) // correction term index
19600      } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
19601     } // end of for(Int_t pe=0;pe<2;pe++)
19602    } // end of for(Int_t t=0;t<2;t++)
19603    // number of RPs and POIs in selected pt and eta bins for cross-checkings:
19604    TString noOfParticlesInBinName = "fNoOfParticlesInBin";
19605    TH1D *noOfParticlesInBin = NULL;
19606    noOfParticlesInBin = dynamic_cast<TH1D*>(nestedLoopsList->FindObject(noOfParticlesInBinName.Data()));
19607    if(noOfParticlesInBin)
19608    {
19609     this->SetNoOfParticlesInBin(noOfParticlesInBin);
19610    } else
19611      {
19612       cout<<endl;
19613       cout<<" WARNING (QC): noOfParticlesInBin is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19614       cout<<endl;
19615      }
19616   } // end of if(bEvaluateDiffFlowNestedLoops)
19617
19618 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForNestedLoopsHistograms()
19619
19620 //=======================================================================================================================
19621
19622 void AliFlowAnalysisWithQCumulants::GetPointersForMixedHarmonicsHistograms()
19623 {
19624  // Get pointers to all objects relevant for mixed harmonics.
19625    
19626  // a) Get pointer to base list for mixed harmonics;
19627  // b) Get pointer to TProfile fMixedHarmonicsFlags holding all flags for mixed harmonics;
19628  // c) Get pointer to list fMixedHarmonicsProfiles and pointers to all objects that she holds; 
19629  // d) Get pointer to list fMixedHarmonicsResults and pointers to all objects that she holds;
19630  // e) Get pointer to list fMixedHarmonicsErrorPropagation and pointers to all objects that she holds.
19631
19632  // a) Get pointer to base list for mixed harmonics:
19633  TList *mixedHarmonicsList = dynamic_cast<TList*>(fHistList->FindObject("Mixed Harmonics"));
19634  if(mixedHarmonicsList) 
19635  {
19636   this->SetMixedHarmonicsList(mixedHarmonicsList);
19637  } else
19638    {
19639     cout<<"WARNING: mixedHarmonicsList is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19640     exit(0);
19641    }
19642
19643  // b) Get pointer to TProfile fMixedHarmonicsFlags holding all flags for mixed harmonics:
19644  TString mixedHarmonicsFlagsName = "fMixedHarmonicsFlags";
19645  mixedHarmonicsFlagsName += fAnalysisLabel->Data();
19646  TProfile *mixedHarmonicsFlags = dynamic_cast<TProfile*>
19647                                  (mixedHarmonicsList->FindObject(mixedHarmonicsFlagsName.Data()));
19648  if(mixedHarmonicsFlags)
19649  {
19650   this->SetMixedHarmonicsFlags(mixedHarmonicsFlags);  
19651   fCalculateMixedHarmonics = (Bool_t)mixedHarmonicsFlags->GetBinContent(1); 
19652   fCalculateMixedHarmonicsVsM = (Bool_t)mixedHarmonicsFlags->GetBinContent(3); 
19653  } else 
19654    {
19655     cout<<"WARNING: mixedHarmonicsFlags is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19656     exit(0);
19657    }
19658   
19659  if(!fCalculateMixedHarmonics){return;}
19660
19661  // c) Get pointer to list fMixedHarmonicsProfiles and pointers to all objects that she holds:
19662  TList *mixedHarmonicsProfiles = NULL;
19663  mixedHarmonicsProfiles = dynamic_cast<TList*>(mixedHarmonicsList->FindObject("Profiles"));
19664  if(mixedHarmonicsProfiles)  
19665  {
19666   // 2p:
19667   TString s2pCorrelationsName = "f2pCorrelations";
19668   s2pCorrelationsName += fAnalysisLabel->Data();
19669   TProfile *p2pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s2pCorrelationsName.Data()));
19670   if(p2pCorrelations) 
19671   {
19672    this->Set2pCorrelations(p2pCorrelations);
19673   } else 
19674     {
19675      cout<<"WARNING: p2pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19676      exit(0);
19677     } 
19678   // 3p:
19679   TString s3pCorrelationsName = "f3pCorrelations";
19680   s3pCorrelationsName += fAnalysisLabel->Data();
19681   TProfile *p3pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s3pCorrelationsName.Data()));
19682   if(p3pCorrelations) 
19683   {
19684    this->Set3pCorrelations(p3pCorrelations);
19685   } else 
19686     {
19687      cout<<"WARNING: p3pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19688      exit(0);
19689     } 
19690   // 4p:
19691   TString s4pCorrelationsName = "f4pCorrelations";
19692   s4pCorrelationsName += fAnalysisLabel->Data();
19693   TProfile *p4pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s4pCorrelationsName.Data()));
19694   if(p4pCorrelations) 
19695   {
19696    this->Set4pCorrelations(p4pCorrelations);
19697   } else 
19698     {
19699      cout<<"WARNING: p4pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19700      exit(0);
19701     } 
19702   // 5p:
19703   TString s5pCorrelationsName = "f5pCorrelations";
19704   s5pCorrelationsName += fAnalysisLabel->Data();
19705   TProfile *p5pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s5pCorrelationsName.Data()));
19706   if(p5pCorrelations) 
19707   {
19708    this->Set5pCorrelations(p5pCorrelations);
19709   } else 
19710     {
19711      cout<<"WARNING: p5pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19712      exit(0);
19713     } 
19714   /* TBI not needed for the time being
19715   // 6p:
19716   TString s6pCorrelationsName = "f6pCorrelations";
19717   s6pCorrelationsName += fAnalysisLabel->Data();
19718   TProfile *p6pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s6pCorrelationsName.Data()));
19719   if(p6pCorrelations) 
19720   {
19721    this->Set6pCorrelations(p6pCorrelations);
19722   } else 
19723     {
19724      cout<<"WARNING: p6pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19725      exit(0);
19726     } 
19727   // 7p:
19728   TString s7pCorrelationsName = "f7pCorrelations";
19729   s7pCorrelationsName += fAnalysisLabel->Data();
19730   TProfile *p7pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s7pCorrelationsName.Data()));
19731   if(p7pCorrelations) 
19732   {
19733    this->Set7pCorrelations(p7pCorrelations);
19734   } else 
19735     {
19736      cout<<"WARNING: p7pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19737      exit(0);
19738     } 
19739   // 8p:
19740   TString s8pCorrelationsName = "f8pCorrelations";
19741   s8pCorrelationsName += fAnalysisLabel->Data();
19742   TProfile *p8pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s8pCorrelationsName.Data()));
19743   if(p8pCorrelations) 
19744   {
19745    this->Set8pCorrelations(p8pCorrelations);
19746   } else 
19747     {
19748      cout<<"WARNING: p8pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19749      exit(0);
19750     }
19751  */
19752  } else // to if(mixedHarmonicsProfiles)
19753    {
19754     cout<<"WARNING: mixedHarmonicsProfiles is NULL in FAWQC::GPFMHH() !!!!"<<endl;
19755     exit(0);
19756    }
19757
19758  // d) Get pointer to list fMixedHarmonicsResults and pointers to all objects that she holds.
19759  TList *mixedHarmonicsResults = NULL;
19760  mixedHarmonicsResults = dynamic_cast<TList*>(mixedHarmonicsList->FindObject("Results"));
19761  if(mixedHarmonicsResults)  
19762  {
19763   // 2p:
19764   TString s2pCumulantsName = "f2pCumulants";
19765   s2pCumulantsName += fAnalysisLabel->Data();
19766   TH1D *p2pCumulants = dynamic_cast<TH1D*>(mixedHarmonicsResults->FindObject(s2pCumulantsName.Data()));
19767   if(p2pCumulants) 
19768   {
19769    this->Set2pCumulants(p2pCumulants);
19770   } else 
19771     {
19772      cout<<"WARNING: p2pCumulants is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19773      exit(0);
19774     } 
19775   // 3p:
19776   TString s3pCumulantsName = "f3pCumulants";
19777   s3pCumulantsName += fAnalysisLabel->Data();
19778   TH1D *p3pCumulants = dynamic_cast<TH1D*>(mixedHarmonicsResults->FindObject(s3pCumulantsName.Data()));
19779   if(p3pCumulants) 
19780   {
19781    this->Set3pCumulants(p3pCumulants);
19782   } else 
19783     {
19784      cout<<"WARNING: p3pCumulants is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19785      exit(0);
19786     } 
19787   // 4p:
19788   TString s4pCumulantsName = "f4pCumulants";
19789   s4pCumulantsName += fAnalysisLabel->Data();
19790   TH1D *p4pCumulants = dynamic_cast<TH1D*>(mixedHarmonicsResults->FindObject(s4pCumulantsName.Data()));
19791   if(p4pCumulants) 
19792   {
19793    this->Set4pCumulants(p4pCumulants);
19794   } else 
19795     {
19796      cout<<"WARNING: p4pCumulants is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19797      exit(0);
19798     } 
19799   // 5p:
19800   TString s5pCumulantsName = "f5pCumulants";
19801   s5pCumulantsName += fAnalysisLabel->Data();
19802   TH1D *p5pCumulants = dynamic_cast<TH1D*>(mixedHarmonicsResults->FindObject(s5pCumulantsName.Data()));
19803   if(p5pCumulants) 
19804   {
19805    this->Set5pCumulants(p5pCumulants);
19806   } else 
19807     {
19808      cout<<"WARNING: p5pCumulants is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19809      exit(0);
19810     } 
19811  } else // to if(mixedHarmonicsResults)
19812    {
19813     cout<<"WARNING: mixedHarmonicsResults is NULL in FAWQC::GPFMHH() !!!!"<<endl;
19814    }
19815
19816  // e) Get pointer to list fMixedHarmonicsErrorPropagation and pointers to all objects that she holds:
19817  TList *mixedHarmonicsErrorPropagation = NULL;
19818  mixedHarmonicsErrorPropagation = dynamic_cast<TList*>(mixedHarmonicsList->FindObject("Error Propagation"));
19819  if(mixedHarmonicsErrorPropagation)  
19820  {   
19821   TString sMixedHarmonicEventWeightsName = "fMixedHarmonicEventWeights";
19822   sMixedHarmonicEventWeightsName += fAnalysisLabel->Data();
19823   TString powerFlag[2] = {"linear","quadratic"};
19824   for(Int_t power=0;power<2;power++)
19825   {
19826    TH1D *hMixedHarmonicEventWeights = dynamic_cast<TH1D*>(mixedHarmonicsErrorPropagation->FindObject(Form("%s: %s",sMixedHarmonicEventWeightsName.Data(),powerFlag[power].Data())));
19827    if(hMixedHarmonicEventWeights) 
19828    {
19829     this->SetMixedHarmonicEventWeights(hMixedHarmonicEventWeights,power);
19830    } else 
19831      {
19832       cout<<"WARNING: hMixedHarmonicEventWeights is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
19833       cout<<"power = "<<power<<endl;
19834       exit(0);
19835      }                                   
19836   } // end of for(Int_t power=0;power<2;power++)
19837   TString sMixedHarmonicProductOfEventWeightsName = "fMixedHarmonicProductOfEventWeights";
19838   sMixedHarmonicProductOfEventWeightsName += fAnalysisLabel->Data();
19839   TH2D *hMixedHarmonicProductOfEventWeights = dynamic_cast<TH2D*>(mixedHarmonicsErrorPropagation->FindObject(sMixedHarmonicProductOfEventWeightsName.Data()));
19840   if(hMixedHarmonicProductOfEventWeights) 
19841   {
19842    this->SetMixedHarmonicProductOfEventWeights(hMixedHarmonicProductOfEventWeights);
19843   } else 
19844     {
19845      cout<<"WARNING: hMixedHarmonicProductOfEventWeights is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19846      exit(0);
19847     } 
19848   TString sMixedHarmonicProductOfCorrelationsName = "fMixedHarmonicProductOfCorrelations";
19849   sMixedHarmonicProductOfCorrelationsName += fAnalysisLabel->Data();
19850   TProfile2D *hMixedHarmonicProductOfCorrelations = dynamic_cast<TProfile2D*>(mixedHarmonicsErrorPropagation->FindObject(sMixedHarmonicProductOfCorrelationsName.Data()));
19851   if(hMixedHarmonicProductOfCorrelations) 
19852   {
19853    this->SetMixedHarmonicProductOfCorrelations(hMixedHarmonicProductOfCorrelations);
19854   } else 
19855     {
19856      cout<<"WARNING: hMixedHarmonicProductOfCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19857      exit(0);
19858     } 
19859  } // end of if(mixedHarmonicsErrorPropagation) 
19860  
19861 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForMixedHarmonicsHistograms()
19862
19863 //=======================================================================================================================
19864
19865 void AliFlowAnalysisWithQCumulants::StoreHarmonic()
19866 {
19867  // Store flow harmonic in common control histograms.
19868
19869  (fCommonHists->GetHarmonic())->Fill(0.5,fHarmonic);
19870  if(fFillMultipleControlHistograms)
19871  {
19872   (fCommonHists2nd->GetHarmonic())->Fill(0.5,fHarmonic);
19873   (fCommonHists4th->GetHarmonic())->Fill(0.5,fHarmonic);
19874   (fCommonHists6th->GetHarmonic())->Fill(0.5,fHarmonic);
19875   (fCommonHists8th->GetHarmonic())->Fill(0.5,fHarmonic);
19876  }
19877  
19878 } // end of void AliFlowAnalysisWithQCumulants::StoreHarmonic()
19879
19880 //=======================================================================================================================
19881
19882 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrelationsUsingParticleWeights(TString type, TString ptOrEta) // type = RP or POI 
19883 {
19884  // Calculate all correlations needed for differential flow using particle weights.
19885  
19886  Int_t t = 0; // type flag 
19887  Int_t pe = 0; // ptEta flag
19888  
19889  if(type == "RP")
19890  {
19891   t = 0;
19892  } else if(type == "POI")
19893    {
19894     t = 1;
19895    }
19896
19897  if(ptOrEta == "Pt")
19898  {
19899   pe = 0;
19900  } else if(ptOrEta == "Eta")
19901    {
19902     pe = 1;
19903    }
19904     
19905  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
19906  Double_t minPtEta[2] = {fPtMin,fEtaMin};
19907  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
19908  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
19909
19910  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
19911  Double_t dReQ1n1k = (*fReQ)(0,1);
19912  Double_t dReQ2n2k = (*fReQ)(1,2);
19913  Double_t dReQ1n3k = (*fReQ)(0,3);
19914  //Double_t dReQ4n4k = (*fReQ)(3,4);
19915  Double_t dImQ1n1k = (*fImQ)(0,1);
19916  Double_t dImQ2n2k = (*fImQ)(1,2);
19917  Double_t dImQ1n3k = (*fImQ)(0,3);
19918  //Double_t dImQ4n4k = (*fImQ)(3,4);
19919  
19920  // S^M_{p,k} (see .h file for the definition of fSpk):
19921  Double_t dSM1p1k = (*fSpk)(0,1);
19922  Double_t dSM1p2k = (*fSpk)(0,2);
19923  Double_t dSM1p3k = (*fSpk)(0,3);
19924  Double_t dSM2p1k = (*fSpk)(1,1);
19925  Double_t dSM3p1k = (*fSpk)(2,1);
19926  
19927  // looping over all bins and calculating reduced correlations: 
19928  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
19929  {
19930   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular (pt,eta) bin):  
19931   Double_t p1n0kRe = 0.;
19932   Double_t p1n0kIm = 0.;
19933
19934   // number of POIs in particular (pt,eta) bin):
19935   Double_t mp = 0.;
19936
19937   // real and imaginary parts of q_{m*n,k}: 
19938   // (weighted Q-vector evaluated for particles which are both RPs and POIs in particular (pt,eta) bin)
19939   Double_t q1n2kRe = 0.;
19940   Double_t q1n2kIm = 0.;
19941   Double_t q2n1kRe = 0.;
19942   Double_t q2n1kIm = 0.;
19943
19944   // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
19945   Double_t s1p1k = 0.; 
19946   Double_t s1p2k = 0.; 
19947   Double_t s1p3k = 0.; 
19948    
19949   // M0111 from Eq. (118) in QC2c (to be improved (notation))
19950   Double_t dM0111 = 0.;
19951  
19952   if(type == "POI")
19953   {
19954    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
19955            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
19956    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
19957            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
19958             
19959    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
19960     
19961    t = 1; // typeFlag = RP or POI
19962     
19963    // q_{m*n,k}: (Remark: m=1 is 0, k=0 iz zero (to be improved!)) 
19964    q1n2kRe = fReRPQ1dEBE[2][pe][0][2]->GetBinContent(fReRPQ1dEBE[2][pe][0][2]->GetBin(b))
19965            * fReRPQ1dEBE[2][pe][0][2]->GetBinEntries(fReRPQ1dEBE[2][pe][0][2]->GetBin(b));
19966    q1n2kIm = fImRPQ1dEBE[2][pe][0][2]->GetBinContent(fImRPQ1dEBE[2][pe][0][2]->GetBin(b))
19967            * fImRPQ1dEBE[2][pe][0][2]->GetBinEntries(fImRPQ1dEBE[2][pe][0][2]->GetBin(b));
19968    q2n1kRe = fReRPQ1dEBE[2][pe][1][1]->GetBinContent(fReRPQ1dEBE[2][pe][1][1]->GetBin(b))
19969            * fReRPQ1dEBE[2][pe][1][1]->GetBinEntries(fReRPQ1dEBE[2][pe][1][1]->GetBin(b));
19970    q2n1kIm = fImRPQ1dEBE[2][pe][1][1]->GetBinContent(fImRPQ1dEBE[2][pe][1][1]->GetBin(b))
19971            * fImRPQ1dEBE[2][pe][1][1]->GetBinEntries(fImRPQ1dEBE[2][pe][1][1]->GetBin(b));
19972        
19973    // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
19974    s1p1k = pow(fs1dEBE[2][pe][1]->GetBinContent(b)*fs1dEBE[2][pe][1]->GetBinEntries(b),1.); 
19975    s1p2k = pow(fs1dEBE[2][pe][2]->GetBinContent(b)*fs1dEBE[2][pe][2]->GetBinEntries(b),1.); 
19976    s1p3k = pow(fs1dEBE[2][pe][3]->GetBinContent(b)*fs1dEBE[2][pe][3]->GetBinEntries(b),1.); 
19977      
19978    // M0111 from Eq. (118) in QC2c (to be improved (notation)):
19979    dM0111 = mp*(dSM3p1k-3.*dSM1p1k*dSM1p2k+2.*dSM1p3k)
19980           - 3.*(s1p1k*(dSM2p1k-dSM1p2k)
19981           + 2.*(s1p3k-s1p2k*dSM1p1k));
19982   }
19983    else if(type == "RP")
19984    {
19985     // q_{m*n,k}: (Remark: m=1 is 0, k=0 iz zero (to be improved!)) 
19986     q1n2kRe = fReRPQ1dEBE[0][pe][0][2]->GetBinContent(fReRPQ1dEBE[0][pe][0][2]->GetBin(b))
19987             * fReRPQ1dEBE[0][pe][0][2]->GetBinEntries(fReRPQ1dEBE[0][pe][0][2]->GetBin(b));
19988     q1n2kIm = fImRPQ1dEBE[0][pe][0][2]->GetBinContent(fImRPQ1dEBE[0][pe][0][2]->GetBin(b))
19989             * fImRPQ1dEBE[0][pe][0][2]->GetBinEntries(fImRPQ1dEBE[0][pe][0][2]->GetBin(b));
19990     q2n1kRe = fReRPQ1dEBE[0][pe][1][1]->GetBinContent(fReRPQ1dEBE[0][pe][1][1]->GetBin(b))
19991             * fReRPQ1dEBE[0][pe][1][1]->GetBinEntries(fReRPQ1dEBE[0][pe][1][1]->GetBin(b));
19992     q2n1kIm = fImRPQ1dEBE[0][pe][1][1]->GetBinContent(fImRPQ1dEBE[0][pe][1][1]->GetBin(b))
19993             * fImRPQ1dEBE[0][pe][1][1]->GetBinEntries(fImRPQ1dEBE[0][pe][1][1]->GetBin(b));
19994
19995     // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
19996     s1p1k = pow(fs1dEBE[0][pe][1]->GetBinContent(b)*fs1dEBE[0][pe][1]->GetBinEntries(b),1.); 
19997     s1p2k = pow(fs1dEBE[0][pe][2]->GetBinContent(b)*fs1dEBE[0][pe][2]->GetBinEntries(b),1.); 
19998     s1p3k = pow(fs1dEBE[0][pe][3]->GetBinContent(b)*fs1dEBE[0][pe][3]->GetBinEntries(b),1.); 
19999     
20000     // to be improved (cross-checked):
20001     p1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
20002             * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
20003     p1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))  
20004             * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
20005             
20006     mp = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
20007      
20008     t = 0; // typeFlag = RP or POI
20009     
20010     // M0111 from Eq. (118) in QC2c (to be improved (notation)):
20011     dM0111 = mp*(dSM3p1k-3.*dSM1p1k*dSM1p2k+2.*dSM1p3k)
20012            - 3.*(s1p1k*(dSM2p1k-dSM1p2k)
20013            + 2.*(s1p3k-s1p2k*dSM1p1k));
20014     //...............................................................................................   
20015    }
20016    
20017    // 2'-particle correlation:
20018    Double_t two1n1nW0W1 = 0.;
20019    if(mp*dSM1p1k-s1p1k)
20020    {
20021     two1n1nW0W1 = (p1n0kRe*dReQ1n1k+p1n0kIm*dImQ1n1k-s1p1k)
20022                 / (mp*dSM1p1k-s1p1k);
20023    
20024     // fill profile to get <<2'>>     
20025     fDiffFlowCorrelationsPro[t][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nW0W1,mp*dSM1p1k-s1p1k);    
20026     // fill profile to get <<2'>^2>     
20027     fDiffFlowSquaredCorrelationsPro[t][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nW0W1*two1n1nW0W1,mp*dSM1p1k-s1p1k);        
20028     // histogram to store <2'> e-b-e (needed in some other methods):
20029     fDiffFlowCorrelationsEBE[t][pe][0]->SetBinContent(b,two1n1nW0W1);      
20030     fDiffFlowEventWeightsForCorrelationsEBE[t][pe][0]->SetBinContent(b,mp*dSM1p1k-s1p1k);      
20031    } // end of if(mp*dSM1p1k-s1p1k)
20032    
20033    // 4'-particle correlation:
20034    Double_t four1n1n1n1nW0W1W1W1 = 0.;
20035    if(dM0111)
20036    {
20037     four1n1n1n1nW0W1W1W1 = ((pow(dReQ1n1k,2.)+pow(dImQ1n1k,2.))*(p1n0kRe*dReQ1n1k+p1n0kIm*dImQ1n1k)
20038                          - q2n1kRe*(pow(dReQ1n1k,2.)-pow(dImQ1n1k,2.))
20039                          - 2.*q2n1kIm*dReQ1n1k*dImQ1n1k
20040                          - p1n0kRe*(dReQ1n1k*dReQ2n2k+dImQ1n1k*dImQ2n2k)
20041                          + p1n0kIm*(dImQ1n1k*dReQ2n2k-dReQ1n1k*dImQ2n2k)
20042                          - 2.*dSM1p2k*(p1n0kRe*dReQ1n1k+p1n0kIm*dImQ1n1k)
20043                          - 2.*(pow(dReQ1n1k,2.)+pow(dImQ1n1k,2.))*s1p1k                                            
20044                          + 6.*(q1n2kRe*dReQ1n1k+q1n2kIm*dImQ1n1k)                                           
20045                          + 1.*(q2n1kRe*dReQ2n2k+q2n1kIm*dImQ2n2k)                         
20046                          + 2.*(p1n0kRe*dReQ1n3k+p1n0kIm*dImQ1n3k)                      
20047                          + 2.*s1p1k*dSM1p2k                                      
20048                          - 6.*s1p3k)        
20049                          / dM0111; // to be improved (notation of dM0111)
20050    
20051     // fill profile to get <<4'>>     
20052     fDiffFlowCorrelationsPro[t][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nW0W1W1W1,dM0111);    
20053     // fill profile to get <<4'>^2>     
20054     fDiffFlowSquaredCorrelationsPro[t][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nW0W1W1W1*four1n1n1n1nW0W1W1W1,dM0111);        
20055     // histogram to store <4'> e-b-e (needed in some other methods):
20056     fDiffFlowCorrelationsEBE[t][pe][1]->SetBinContent(b,four1n1n1n1nW0W1W1W1);      
20057     fDiffFlowEventWeightsForCorrelationsEBE[t][pe][1]->SetBinContent(b,dM0111);      
20058    } // end of if(dM0111)
20059  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20060
20061 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrelationsUsingParticleWeights(TString type, TString ptOrEta); // type = RP or POI 
20062
20063 //=======================================================================================================================
20064
20065 void AliFlowAnalysisWithQCumulants::FillCommonControlHistograms(AliFlowEventSimple *anEvent)
20066 {
20067  // Fill common control histograms.
20068  
20069  Int_t nRP = anEvent->GetNumberOfRPs(); // number of Reference Particles 
20070  fCommonHists->FillControlHistograms(anEvent); 
20071  if(fFillMultipleControlHistograms)
20072  {
20073   if(nRP>1)
20074   {
20075    fCommonHists2nd->FillControlHistograms(anEvent);                                        
20076    if(nRP>3)
20077    {
20078     fCommonHists4th->FillControlHistograms(anEvent);                                        
20079     if(nRP>5)
20080     {
20081      fCommonHists6th->FillControlHistograms(anEvent);                                        
20082      if(nRP>7)
20083      {
20084       fCommonHists8th->FillControlHistograms(anEvent);                                        
20085      } // end of if(nRP>7)  
20086     } // end of if(nRP>5) 
20087    } // end of if(nRP>3)                                                                                                                      
20088   } // end of if(nRP>1) 
20089  } // end of if(fFillMultipleControlHistograms)
20090  
20091 } // end of void AliFlowAnalysisWithQCumulants::FillCommonControlHistograms(AliFlowEventSimple *anEvent)
20092
20093 //=======================================================================================================================
20094
20095 void AliFlowAnalysisWithQCumulants::FillControlHistograms(AliFlowEventSimple *anEvent)
20096 {
20097  // Fill common control histograms.
20098  
20099  Int_t nRPs = anEvent->GetNumberOfRPs(); // number of Reference Particles
20100  Int_t nPOIs = anEvent->GetNumberOfPOIs(); // number of Particles Of Interest
20101  Int_t nRefMult = anEvent->GetReferenceMultiplicity(); // reference multiplicity for current event (TBI: This call is not really needed here, use fReferenceMultiplicityEBE instead)
20102
20103  fCorrelationNoRPsVsRefMult->Fill(nRPs,nRefMult);
20104  fCorrelationNoPOIsVsRefMult->Fill(nPOIs,nRefMult);
20105  fCorrelationNoRPsVsNoPOIs->Fill(nRPs,nPOIs);
20106  
20107 } // end of void AliFlowAnalysisWithQCumulants::FillControlHistograms(AliFlowEventSimple *anEvent)
20108
20109 //=======================================================================================================================
20110
20111 void AliFlowAnalysisWithQCumulants::ResetEventByEventQuantities()
20112 {
20113  // Reset all event by event quantities.
20114  
20115  // Reference flow:
20116  fReQ->Zero();
20117  fImQ->Zero();
20118  fSpk->Zero();
20119  fIntFlowCorrelationsEBE->Reset();
20120  fIntFlowEventWeightsForCorrelationsEBE->Reset();
20121  fIntFlowCorrelationsAllEBE->Reset();
20122  
20123  for(Int_t sc=0;sc<2;sc++)
20124  {
20125   fIntFlowCorrectionTermsForNUAEBE[sc]->Reset();
20126   fIntFlowEventWeightForCorrectionTermsForNUAEBE[sc]->Reset(); 
20127  }
20128     
20129  // Differential flow:
20130  if(fCalculateDiffFlow)
20131  {
20132   for(Int_t t=0;t<3;t++) // type (RP, POI, POI&&RP)
20133   {
20134    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // 1D in pt or eta
20135    {
20136     for(Int_t m=0;m<4;m++) // multiple of harmonic
20137     {
20138      for(Int_t k=0;k<9;k++) // power of weight
20139      {
20140       if(fReRPQ1dEBE[t][pe][m][k]) fReRPQ1dEBE[t][pe][m][k]->Reset();
20141       if(fImRPQ1dEBE[t][pe][m][k]) fImRPQ1dEBE[t][pe][m][k]->Reset();
20142      }   
20143     } 
20144    }
20145   } 
20146   for(Int_t t=0;t<3;t++) // type (0 = RP, 1 = POI, 2 = RP&&POI )
20147   { 
20148    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // 1D in pt or eta
20149    {
20150     for(Int_t k=0;k<9;k++)
20151     {
20152      if(fs1dEBE[t][pe][k]) fs1dEBE[t][pe][k]->Reset();
20153     }
20154    }
20155   }
20156   // e-b-e reduced correlations:
20157   for(Int_t t=0;t<2;t++) // type (0 = RP, 1 = POI)
20158   {  
20159    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
20160    {
20161     for(Int_t rci=0;rci<4;rci++) // reduced correlation index
20162     {
20163      if(fDiffFlowCorrelationsEBE[t][pe][rci]) fDiffFlowCorrelationsEBE[t][pe][rci]->Reset();
20164      if(fDiffFlowEventWeightsForCorrelationsEBE[t][pe][rci]) fDiffFlowEventWeightsForCorrelationsEBE[t][pe][rci]->Reset();
20165     }
20166    }
20167   }  
20168   // correction terms for NUA:
20169   for(Int_t t=0;t<2;t++) // type (0 = RP, 1 = POI)
20170   {  
20171    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
20172    {
20173     for(Int_t sc=0;sc<2;sc++) // sin or cos
20174     {
20175      for(Int_t cti=0;cti<9;cti++) // correction term index
20176      {
20177      fDiffFlowCorrectionTermsForNUAEBE[t][pe][sc][cti]->Reset();  
20178      }
20179     }
20180    }      
20181   }
20182  } // end of if(fCalculateDiffFlow)   
20183
20184  // 2D (pt,eta)
20185  if(fCalculate2DDiffFlow)
20186  {
20187   for(Int_t t=0;t<3;t++) // type (RP, POI, POI&&RP)
20188   {
20189    for(Int_t m=0;m<4;m++) // multiple of harmonic
20190    {
20191     for(Int_t k=0;k<9;k++) // power of weight
20192     {
20193      if(fReRPQ2dEBE[t][m][k]){fReRPQ2dEBE[t][m][k]->Reset();}
20194      if(fImRPQ2dEBE[t][m][k]){fImRPQ2dEBE[t][m][k]->Reset();}
20195     }   
20196    }
20197   }
20198   for(Int_t t=0;t<3;t++) // type (0 = RP, 1 = POI, 2 = RP&&POI )
20199   { 
20200    for(Int_t k=0;k<9;k++)
20201    {
20202     if(fs2dEBE[t][k]){fs2dEBE[t][k]->Reset();}
20203    }
20204   }  
20205  } // end of if(fCalculate2DDiffFlow) 
20206
20207 } // end of void AliFlowAnalysisWithQCumulants::ResetEventByEventQuantities();
20208
20209 //=======================================================================================================================
20210
20211 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUASinTerms(TString type, TString ptOrEta)
20212 {
20213  // Calculate correction terms for non-uniform acceptance for differential flow (sin terms).
20214  
20215  // Results are stored in fDiffFlowCorrectionTermsForNUAPro[t][pe][0][cti], where cti runs as follows:
20216  //  0: <<sin n(psi1)>>
20217  //  1: <<sin n(psi1+phi2)>>
20218  //  2: <<sin n(psi1+phi2-phi3)>>
20219  //  3: <<sin n(psi1-phi2-phi3)>>:
20220  //  4:
20221  //  5:
20222  //  6:
20223  
20224  // multiplicity:
20225  Double_t dMult = (*fSpk)(0,0);
20226  
20227  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
20228  Double_t dReQ1n = (*fReQ)(0,0);
20229  Double_t dReQ2n = (*fReQ)(1,0);
20230  //Double_t dReQ3n = (*fReQ)(2,0);
20231  //Double_t dReQ4n = (*fReQ)(3,0);
20232  Double_t dImQ1n = (*fImQ)(0,0);
20233  Double_t dImQ2n = (*fImQ)(1,0);
20234  //Double_t dImQ3n = (*fImQ)(2,0);
20235  //Double_t dImQ4n = (*fImQ)(3,0);
20236
20237  Int_t t = 0; // type flag 
20238  Int_t pe = 0; // ptEta flag
20239  
20240  if(type == "RP")
20241  {
20242   t = 0;
20243  } else if(type == "POI")
20244    {
20245     t = 1;
20246    }
20247
20248  if(ptOrEta == "Pt")
20249  {
20250   pe = 0;
20251  } else if(ptOrEta == "Eta")
20252    {
20253     pe = 1;
20254    }
20255     
20256  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
20257  Double_t minPtEta[2] = {fPtMin,fEtaMin};
20258  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
20259  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
20260
20261  // looping over all bins and calculating correction terms: 
20262  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20263  {
20264   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
20265   Double_t p1n0kRe = 0.;
20266   Double_t p1n0kIm = 0.;
20267
20268   // number of POIs in particular pt or eta bin:
20269   Double_t mp = 0.;
20270
20271   // real and imaginary parts of q_{m*n,0} (non-weighted Q-vector evaluated for particles which are both RPs and POIs in particular pt or eta bin):
20272   Double_t q1n0kRe = 0.;
20273   Double_t q1n0kIm = 0.;
20274   Double_t q2n0kRe = 0.;
20275   Double_t q2n0kIm = 0.;
20276
20277   // number of particles which are both RPs and POIs in particular pt or eta bin:
20278   Double_t mq = 0.;
20279    
20280   if(type == "POI")
20281   {
20282    // q_{m*n,0}:
20283    q1n0kRe = fReRPQ1dEBE[2][pe][0][0]->GetBinContent(fReRPQ1dEBE[2][pe][0][0]->GetBin(b))
20284            * fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b));
20285    q1n0kIm = fImRPQ1dEBE[2][pe][0][0]->GetBinContent(fImRPQ1dEBE[2][pe][0][0]->GetBin(b))
20286            * fImRPQ1dEBE[2][pe][0][0]->GetBinEntries(fImRPQ1dEBE[2][pe][0][0]->GetBin(b));
20287    q2n0kRe = fReRPQ1dEBE[2][pe][1][0]->GetBinContent(fReRPQ1dEBE[2][pe][1][0]->GetBin(b))
20288            * fReRPQ1dEBE[2][pe][1][0]->GetBinEntries(fReRPQ1dEBE[2][pe][1][0]->GetBin(b));
20289    q2n0kIm = fImRPQ1dEBE[2][pe][1][0]->GetBinContent(fImRPQ1dEBE[2][pe][1][0]->GetBin(b))
20290            * fImRPQ1dEBE[2][pe][1][0]->GetBinEntries(fImRPQ1dEBE[2][pe][1][0]->GetBin(b));         
20291                  
20292    mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
20293   } 
20294   else if(type == "RP")
20295   {
20296    // q_{m*n,0}:
20297    q1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
20298            * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
20299    q1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))
20300            * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
20301    q2n0kRe = fReRPQ1dEBE[0][pe][1][0]->GetBinContent(fReRPQ1dEBE[0][pe][1][0]->GetBin(b))
20302            * fReRPQ1dEBE[0][pe][1][0]->GetBinEntries(fReRPQ1dEBE[0][pe][1][0]->GetBin(b));
20303    q2n0kIm = fImRPQ1dEBE[0][pe][1][0]->GetBinContent(fImRPQ1dEBE[0][pe][1][0]->GetBin(b))
20304            * fImRPQ1dEBE[0][pe][1][0]->GetBinEntries(fImRPQ1dEBE[0][pe][1][0]->GetBin(b));         
20305                  
20306    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)  
20307   }    
20308   if(type == "POI")
20309   {
20310    // p_{m*n,0}:
20311    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
20312            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
20313    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
20314            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
20315             
20316    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
20317     
20318    t = 1; // typeFlag = RP or POI
20319   }
20320   else if(type == "RP")
20321   {
20322    // p_{m*n,0} = q_{m*n,0}:
20323    p1n0kRe = q1n0kRe; 
20324    p1n0kIm = q1n0kIm; 
20325            
20326    mp = mq; 
20327    
20328    t = 0; // typeFlag = RP or POI
20329   }
20330
20331   // <<sin n(psi1)>>:
20332   Double_t sinP1nPsi = 0.;
20333   if(mp)
20334   {
20335    sinP1nPsi = p1n0kIm/mp;
20336    // fill profile for <<sin n(psi1)>>:
20337    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi,mp);
20338    // histogram to store <sin n(psi1)> e-b-e (needed in some other methods):
20339    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][0]->SetBinContent(b,sinP1nPsi);
20340   } // end of if(mp)   
20341   
20342   // <<sin n(psi1+phi2)>>:
20343   Double_t sinP1nPsiP1nPhi = 0.;
20344   if(mp*dMult-mq)
20345   {
20346    sinP1nPsiP1nPhi = (p1n0kRe*dImQ1n+p1n0kIm*dReQ1n-q2n0kIm)/(mp*dMult-mq);
20347    // fill profile for <<sin n(psi1+phi2)>>:
20348    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsiP1nPhi,mp*dMult-mq);
20349    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
20350    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][1]->SetBinContent(b,sinP1nPsiP1nPhi);
20351   } // end of if(mp*dMult-mq)   
20352   
20353   // <<sin n(psi1+phi2-phi3)>>:
20354   Double_t sinP1nPsi1P1nPhi2MPhi3 = 0.;
20355   if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))
20356   {
20357    sinP1nPsi1P1nPhi2MPhi3 = (p1n0kIm*(pow(dImQ1n,2.)+pow(dReQ1n,2.)-dMult)
20358                           - 1.*(q2n0kIm*dReQ1n-q2n0kRe*dImQ1n)  
20359                           - mq*dImQ1n+2.*q1n0kIm)
20360                           / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
20361    // fill profile for <<sin n(psi1+phi2)>>:
20362    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1P1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
20363    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
20364    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][2]->SetBinContent(b,sinP1nPsi1P1nPhi2MPhi3);
20365   } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   
20366   
20367   // <<sin n(psi1-phi2-phi3)>>:
20368   Double_t sinP1nPsi1M1nPhi2MPhi3 = 0.;
20369   if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))
20370   {
20371    sinP1nPsi1M1nPhi2MPhi3 = (p1n0kIm*(pow(dReQ1n,2.)-pow(dImQ1n,2.))-2.*p1n0kRe*dReQ1n*dImQ1n
20372                           - 1.*(p1n0kIm*dReQ2n-p1n0kRe*dImQ2n)
20373                           + 2.*mq*dImQ1n-2.*q1n0kIm)
20374                           / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
20375    // fill profile for <<sin n(psi1+phi2)>>:
20376    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1M1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
20377    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
20378    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][3]->SetBinContent(b,sinP1nPsi1M1nPhi2MPhi3);
20379   } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   
20380  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20381  
20382 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUASinTerms(TString type, TString ptOrEta)
20383
20384
20385 //=======================================================================================================================
20386
20387
20388 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTerms(TString type, TString ptOrEta)
20389 {
20390  // Calculate correction terms for non-uniform acceptance for differential flow (cos terms).
20391  
20392  // Results are stored in fDiffFlowCorrectionTermsForNUAPro[t][pe][1][cti], where cti runs as follows:
20393  //  0: <<cos n(psi)>>
20394  //  1: <<cos n(psi1+phi2)>>
20395  //  2: <<cos n(psi1+phi2-phi3)>>
20396  //  3: <<cos n(psi1-phi2-phi3)>>
20397  //  4:
20398  //  5:
20399  //  6:
20400  
20401  // multiplicity:
20402  Double_t dMult = (*fSpk)(0,0);
20403  
20404  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
20405  Double_t dReQ1n = (*fReQ)(0,0);
20406  Double_t dReQ2n = (*fReQ)(1,0);
20407  //Double_t dReQ3n = (*fReQ)(2,0);
20408  //Double_t dReQ4n = (*fReQ)(3,0);
20409  Double_t dImQ1n = (*fImQ)(0,0);
20410  Double_t dImQ2n = (*fImQ)(1,0);
20411  //Double_t dImQ3n = (*fImQ)(2,0);
20412  //Double_t dImQ4n = (*fImQ)(3,0);
20413
20414  Int_t t = 0; // type flag 
20415  Int_t pe = 0; // ptEta flag
20416  
20417  if(type == "RP")
20418  {
20419   t = 0;
20420  } else if(type == "POI")
20421    {
20422     t = 1;
20423    }
20424
20425  if(ptOrEta == "Pt")
20426  {
20427   pe = 0;
20428  } else if(ptOrEta == "Eta")
20429    {
20430     pe = 1;
20431    }
20432     
20433  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
20434  Double_t minPtEta[2] = {fPtMin,fEtaMin};
20435  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
20436  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
20437
20438  // looping over all bins and calculating correction terms: 
20439  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20440  {
20441   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
20442   Double_t p1n0kRe = 0.;
20443   Double_t p1n0kIm = 0.;
20444
20445   // number of POIs in particular pt or eta bin:
20446   Double_t mp = 0.;
20447
20448   // real and imaginary parts of q_{m*n,0} (non-weighted Q-vector evaluated for particles which are both RPs and POIs in particular pt or eta bin):
20449   Double_t q1n0kRe = 0.;
20450   Double_t q1n0kIm = 0.;
20451   Double_t q2n0kRe = 0.;
20452   Double_t q2n0kIm = 0.;
20453
20454   // number of particles which are both RPs and POIs in particular pt or eta bin:
20455   Double_t mq = 0.;
20456    
20457   if(type == "POI")
20458   {
20459    // q_{m*n,0}:
20460    q1n0kRe = fReRPQ1dEBE[2][pe][0][0]->GetBinContent(fReRPQ1dEBE[2][pe][0][0]->GetBin(b))
20461            * fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b));
20462    q1n0kIm = fImRPQ1dEBE[2][pe][0][0]->GetBinContent(fImRPQ1dEBE[2][pe][0][0]->GetBin(b))
20463            * fImRPQ1dEBE[2][pe][0][0]->GetBinEntries(fImRPQ1dEBE[2][pe][0][0]->GetBin(b));
20464    q2n0kRe = fReRPQ1dEBE[2][pe][1][0]->GetBinContent(fReRPQ1dEBE[2][pe][1][0]->GetBin(b))
20465            * fReRPQ1dEBE[2][pe][1][0]->GetBinEntries(fReRPQ1dEBE[2][pe][1][0]->GetBin(b));
20466    q2n0kIm = fImRPQ1dEBE[2][pe][1][0]->GetBinContent(fImRPQ1dEBE[2][pe][1][0]->GetBin(b))
20467            * fImRPQ1dEBE[2][pe][1][0]->GetBinEntries(fImRPQ1dEBE[2][pe][1][0]->GetBin(b));         
20468                  
20469    mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
20470   } 
20471   else if(type == "RP")
20472   {
20473    // q_{m*n,0}:
20474    q1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
20475            * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
20476    q1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))
20477            * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
20478    q2n0kRe = fReRPQ1dEBE[0][pe][1][0]->GetBinContent(fReRPQ1dEBE[0][pe][1][0]->GetBin(b))
20479            * fReRPQ1dEBE[0][pe][1][0]->GetBinEntries(fReRPQ1dEBE[0][pe][1][0]->GetBin(b));
20480    q2n0kIm = fImRPQ1dEBE[0][pe][1][0]->GetBinContent(fImRPQ1dEBE[0][pe][1][0]->GetBin(b))
20481            * fImRPQ1dEBE[0][pe][1][0]->GetBinEntries(fImRPQ1dEBE[0][pe][1][0]->GetBin(b));         
20482                  
20483    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)  
20484   }    
20485   if(type == "POI")
20486   {
20487    // p_{m*n,0}:
20488    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
20489            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
20490    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
20491            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
20492             
20493    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
20494     
20495    t = 1; // typeFlag = RP or POI
20496   }
20497   else if(type == "RP")
20498   {
20499    // p_{m*n,0} = q_{m*n,0}:
20500    p1n0kRe = q1n0kRe; 
20501    p1n0kIm = q1n0kIm; 
20502            
20503    mp = mq; 
20504    
20505    t = 0; // typeFlag = RP or POI
20506   }
20507
20508   // <<cos n(psi1)>>:
20509   Double_t cosP1nPsi = 0.;
20510   if(mp)
20511   {
20512    cosP1nPsi = p1n0kRe/mp;
20513    
20514    // fill profile for <<cos n(psi1)>>:
20515    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi,mp);
20516    // histogram to store <cos n(psi1)> e-b-e (needed in some other methods):
20517    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][0]->SetBinContent(b,cosP1nPsi);
20518   } // end of if(mp)   
20519   
20520   // <<cos n(psi1+phi2)>>:
20521   Double_t cosP1nPsiP1nPhi = 0.;
20522   if(mp*dMult-mq)
20523   {
20524    cosP1nPsiP1nPhi = (p1n0kRe*dReQ1n-p1n0kIm*dImQ1n-q2n0kRe)/(mp*dMult-mq);
20525    // fill profile for <<sin n(psi1+phi2)>>:
20526    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsiP1nPhi,mp*dMult-mq);
20527    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
20528    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][1]->SetBinContent(b,cosP1nPsiP1nPhi);
20529   } // end of if(mp*dMult-mq)   
20530   
20531   // <<cos n(psi1+phi2-phi3)>>:
20532   Double_t cosP1nPsi1P1nPhi2MPhi3 = 0.;
20533   if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))
20534   {
20535    cosP1nPsi1P1nPhi2MPhi3 = (p1n0kRe*(pow(dImQ1n,2.)+pow(dReQ1n,2.)-dMult)
20536                           - 1.*(q2n0kRe*dReQ1n+q2n0kIm*dImQ1n)  
20537                           - mq*dReQ1n+2.*q1n0kRe)
20538                           / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
20539    // fill profile for <<sin n(psi1+phi2)>>:
20540    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1P1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
20541    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
20542    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][2]->SetBinContent(b,cosP1nPsi1P1nPhi2MPhi3);
20543   } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   
20544   
20545   // <<cos n(psi1-phi2-phi3)>>:
20546   Double_t cosP1nPsi1M1nPhi2MPhi3 = 0.;
20547   if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))
20548   {
20549    cosP1nPsi1M1nPhi2MPhi3 = (p1n0kRe*(pow(dReQ1n,2.)-pow(dImQ1n,2.))+2.*p1n0kIm*dReQ1n*dImQ1n
20550                           - 1.*(p1n0kRe*dReQ2n+p1n0kIm*dImQ2n)  
20551                           - 2.*mq*dReQ1n+2.*q1n0kRe)
20552                           / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
20553    // fill profile for <<sin n(psi1+phi2)>>:
20554    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1M1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
20555    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
20556    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][3]->SetBinContent(b,cosP1nPsi1M1nPhi2MPhi3);
20557   } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   
20558  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20559  
20560 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTerms(TString type, TString ptOrEta)
20561
20562 //=========================================================================================================================
20563
20564 void AliFlowAnalysisWithQCumulants::FinalizeCorrectionTermsForNUADiffFlow(TString type, TString ptOrEta)
20565 {
20566  // Transfer profiles into histogams and correctly propagate the error.
20567  
20568  Int_t t = 0; // type flag 
20569  Int_t pe = 0; // ptEta flag
20570  
20571  if(type == "RP")
20572  {
20573   t = 0;
20574  } else if(type == "POI")
20575    {
20576     t = 1;
20577    }
20578
20579  if(ptOrEta == "Pt")
20580  {
20581   pe = 0;
20582  } else if(ptOrEta == "Eta")
20583    {
20584     pe = 1;
20585    }
20586     
20587  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
20588  //Double_t minPtEta[2] = {fPtMin,fEtaMin};
20589  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
20590  //Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
20591
20592  for(Int_t sc=0;sc<2;sc++) // sin or cos
20593  {
20594   for(Int_t cti=0;cti<9;cti++) // correction term index
20595   {
20596    for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20597    {
20598     Double_t correctionTerm = fDiffFlowCorrectionTermsForNUAPro[t][pe][sc][cti]->GetBinContent(b);
20599     fDiffFlowCorrectionTermsForNUAHist[t][pe][sc][cti]->SetBinContent(b,correctionTerm);
20600     // to be improved (propagate error correctly)
20601     // ...
20602    } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20603   } // correction term index
20604  } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
20605
20606 }// end of void AliFlowAnalysisWithQCumulants::FinalizeCorrectionTermsForNUADiffFlow(TString type, TString ptOrEta)
20607
20608 //=========================================================================================================================
20609
20610 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCumulantsCorrectedForNUA(TString type, TString ptOrEta)
20611
20612  // Calculate generalized differential flow cumulants (corrected for non-uniform acceptance).
20613  
20614  // to be improved - propagate error also from non-isotropic terms
20615   
20616  Int_t t = 0; // RP = 0, POI = 1
20617  Int_t pe = 0; // pt = 0, eta = 1
20618
20619  if(type == "RP")
20620  {
20621   t = 0;
20622  } else if(type == "POI")
20623    {
20624     t = 1;
20625    } 
20626      
20627  if(ptOrEta == "Pt")
20628  {
20629   pe = 0;
20630  } else if(ptOrEta == "Eta")
20631    {
20632     pe = 1;
20633    } 
20634        
20635  // Common:
20636  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
20637  // 2-particle correlation:
20638  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>>
20639  // sinus terms coming from reference flow: 
20640  Double_t sinP1nPhi = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(1); // <<sin(n*phi1)>>
20641  Double_t sinP1nPhi1P1nPhi2 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(2); // <<sin(n*(phi1+phi2))>>
20642  Double_t sinP1nPhi1M1nPhi2M1nPhi3 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(3); // <<sin(n*(phi1-phi2-phi3))>>
20643  // cosinus terms coming from reference flow: 
20644  Double_t cosP1nPhi = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(1); // <<cos(n*phi1)>>
20645  Double_t cosP1nPhi1P1nPhi2 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(2); // <<cos(n*(phi1+phi2))>>
20646  Double_t cosP1nPhi1M1nPhi2M1nPhi3 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(3); // <<cos(n*(phi1-phi2-phi3))>>
20647
20648  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20649  {
20650   Double_t twoPrime = fDiffFlowCorrelationsHist[t][pe][0]->GetBinContent(b); // <<2'>>
20651   Double_t fourPrime = fDiffFlowCorrelationsHist[t][pe][1]->GetBinContent(b); // <<4'>>
20652   Double_t sinP1nPsi = fDiffFlowCorrectionTermsForNUAHist[t][pe][0][0]->GetBinContent(b); // <<sin n(Psi)>> 
20653   Double_t cosP1nPsi = fDiffFlowCorrectionTermsForNUAHist[t][pe][1][0]->GetBinContent(b); // <<cos n(Psi)>> 
20654   Double_t sinP1nPsi1P1nPhi2 = fDiffFlowCorrectionTermsForNUAHist[t][pe][0][1]->GetBinContent(b); // <<sin n(psi1+phi2)>> 
20655   Double_t cosP1nPsi1P1nPhi2 = fDiffFlowCorrectionTermsForNUAHist[t][pe][1][1]->GetBinContent(b); // <<cos n(psi1+phi2)>> 
20656   Double_t sinP1nPsi1P1nPhi2M1nPhi3 = fDiffFlowCorrectionTermsForNUAHist[t][pe][0][2]->GetBinContent(b); // <<sin n(psi1+phi2-phi3)>> 
20657   Double_t cosP1nPsi1P1nPhi2M1nPhi3 = fDiffFlowCorrectionTermsForNUAHist[t][pe][1][2]->GetBinContent(b); // <<cos n(psi1+phi2-phi3)>> 
20658   Double_t sinP1nPsi1M1nPhi2M1nPhi3 = fDiffFlowCorrectionTermsForNUAHist[t][pe][0][3]->GetBinContent(b); // <<sin n(psi1-phi2-phi3)>> 
20659   Double_t cosP1nPsi1M1nPhi2M1nPhi3 = fDiffFlowCorrectionTermsForNUAHist[t][pe][1][3]->GetBinContent(b); // <<cos n(psi1-phi2-phi3)>> 
20660   // Generalized QC{2'}:
20661   Double_t qc2Prime = twoPrime - sinP1nPsi*sinP1nPhi - cosP1nPsi*cosP1nPhi;
20662   if(fApplyCorrectionForNUA)
20663   {
20664    fDiffFlowCumulants[t][pe][0]->SetBinContent(b,qc2Prime);
20665   }
20666   if(TMath::Abs(twoPrime)>0.)
20667   {
20668    fDiffFlowDetectorBias[t][pe][0]->SetBinContent(b,qc2Prime/twoPrime); // detector bias = generalized/isotropic cumulant.   
20669   }
20670   // Generalized QC{4'}:
20671   Double_t qc4Prime = fourPrime-2.*twoPrime*two
20672                     - cosP1nPsi*cosP1nPhi1M1nPhi2M1nPhi3
20673                     + sinP1nPsi*sinP1nPhi1M1nPhi2M1nPhi3
20674                     - cosP1nPhi*cosP1nPsi1M1nPhi2M1nPhi3
20675                     + sinP1nPhi*sinP1nPsi1M1nPhi2M1nPhi3
20676                     - 2.*cosP1nPhi*cosP1nPsi1P1nPhi2M1nPhi3
20677                     - 2.*sinP1nPhi*sinP1nPsi1P1nPhi2M1nPhi3
20678                     - cosP1nPsi1P1nPhi2*cosP1nPhi1P1nPhi2
20679                     - sinP1nPsi1P1nPhi2*sinP1nPhi1P1nPhi2
20680                     + 2.*cosP1nPhi1P1nPhi2*(cosP1nPsi*cosP1nPhi-sinP1nPsi*sinP1nPhi)
20681                     + 2.*sinP1nPhi1P1nPhi2*(cosP1nPsi*sinP1nPhi+sinP1nPsi*cosP1nPhi)
20682                     + 4.*two*(cosP1nPsi*cosP1nPhi+sinP1nPsi*sinP1nPhi)
20683                     + 2.*cosP1nPsi1P1nPhi2*(pow(cosP1nPhi,2.)-pow(sinP1nPhi,2.))
20684                     + 4.*sinP1nPsi1P1nPhi2*cosP1nPhi*sinP1nPhi
20685                     + 4.*twoPrime*(pow(cosP1nPhi,2.)+pow(sinP1nPhi,2.))
20686                     - 6.*(pow(cosP1nPhi,2.)-pow(sinP1nPhi,2.)) 
20687                     * (cosP1nPsi*cosP1nPhi-sinP1nPsi*sinP1nPhi)
20688                     - 12.*cosP1nPhi*sinP1nPhi
20689                     * (sinP1nPsi*cosP1nPhi+cosP1nPsi*sinP1nPhi);
20690   if(fApplyCorrectionForNUA)
20691   {
20692    fDiffFlowCumulants[t][pe][1]->SetBinContent(b,qc4Prime);   
20693   }
20694   if(TMath::Abs(fourPrime-2.*twoPrime*two)>0.)
20695   {
20696    fDiffFlowDetectorBias[t][pe][1]->SetBinContent(b,qc4Prime/(fourPrime-2.*twoPrime*two)); // detector bias = generalized/isotropic cumulant.   
20697   }
20698  } // end of for(Int_t p=1;p<=fnBinsPt;p++)
20699  
20700 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCumulantsCorrectedForNUA(TString type, TString ptOrEta)
20701
20702 //==================================================================================================================================    
20703
20704 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectedForNUA(TString type, TString ptOrEta)
20705 {
20706  // Calculate differential flow corrected for non-uniform acceptance.
20707  
20708  // to be improved: eventually I will have to access here masured correlations and NUA terms
20709  //                 instead of cumulants in order to propagate statistical error correctly also 
20710  //                 to NUA terms (propagating errors directly from cumulants is WRONG for 
20711  //                 differential flow becuase that doesn't account at all cross-covariance terms) 
20712  
20713  // REMARK: When NUA correction is apllied error for differential flow DOES NOT get corrected,
20714  //         i.e. only value is being corrected, error is still the one relevant for isotropic
20715  //         case. This eventually will be resolved. 
20716   
20717  
20718  Int_t t = 0; // RP or POI
20719  Int_t pe = 0; // pt or eta
20720
20721  if(type == "RP")
20722  {
20723   t = 0;
20724  } else if(type == "POI")
20725    {
20726     t = 1;
20727    }     
20728  if(ptOrEta == "Pt")
20729  {
20730   pe = 0;
20731  } else if(ptOrEta == "Eta")
20732    {
20733     pe = 1;
20734    } 
20735   
20736  // Common:
20737  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
20738  // Reference Q-cumulants
20739  Double_t qc2 = fIntFlowQcumulants->GetBinContent(1); // QC{2} 
20740  Double_t qc4 = fIntFlowQcumulants->GetBinContent(2); // QC{4}
20741  // Loop over pt or eta bins:
20742  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20743  {
20744   // Differential Q-cumulants:
20745   Double_t qc2Prime = fDiffFlowCumulants[t][pe][0]->GetBinContent(b); // QC{2'}
20746   Double_t qc4Prime = fDiffFlowCumulants[t][pe][1]->GetBinContent(b); // QC{4'}
20747   // v'{2}:
20748   if(qc2>0.)
20749   { 
20750    Double_t v2Prime = qc2Prime/pow(qc2,0.5);
20751    if(TMath::Abs(v2Prime)>0.){fDiffFlow[t][pe][0]->SetBinContent(b,v2Prime);} 
20752   }  
20753   // v'{4}:
20754   if(qc4<0.)
20755   { 
20756    Double_t v4Prime = -qc4Prime/pow(-qc4,3./4.);
20757    if(TMath::Abs(v4Prime)>0.){fDiffFlow[t][pe][1]->SetBinContent(b,v4Prime);} 
20758   }  
20759  } // end of for(Int_t b=1;b<=fnBinsPtEta[pe];b++)
20760   
20761 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectedForNUA(TString type, TString ptOrEta); 
20762
20763 //=========================================================================================================================
20764
20765 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrelationsWithNestedLoops(AliFlowEventSimple * const anEvent)
20766 {
20767  // Evaluate with nested loops multiparticle correlations for integrated flow (without using the particle weights). 
20768
20769  // Remark: Results are stored in profile fIntFlowDirectCorrelations whose binning is organized as follows:
20770  // 
20771  //  1st bin: <2>_{1n|1n} = two1n1n = cos(n*(phi1-phi2))>
20772  //  2nd bin: <2>_{2n|2n} = two2n2n = cos(2n*(phi1-phi2))>
20773  //  3rd bin: <2>_{3n|3n} = two3n3n = cos(3n*(phi1-phi2))> 
20774  //  4th bin: <2>_{4n|4n} = two4n4n = cos(4n*(phi1-phi2))>
20775  //  5th bin:           ----  EMPTY ----
20776  //  6th bin: <3>_{2n|1n,1n} = three2n1n1n = <cos(n*(2.*phi1-phi2-phi3))>
20777  //  7th bin: <3>_{3n|2n,1n} = three3n2n1n = <cos(n*(3.*phi1-2.*phi2-phi3))>
20778  //  8th bin: <3>_{4n|2n,2n} = three4n2n2n = <cos(n*(4.*phi1-2.*phi2-2.*phi3))>
20779  //  9th bin: <3>_{4n|3n,1n} = three4n3n1n = <cos(n*(4.*phi1-3.*phi2-phi3))>
20780  // 10th bin:           ----  EMPTY ----
20781  // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1n = <cos(n*(phi1+phi2-phi3-phi4))>
20782  // 12th bin: <4>_{2n,1n|2n,1n} = four2n1n2n1n = <cos(2.*n*(phi1+phi2-phi3-phi4))>
20783  // 13th bin: <4>_{2n,2n|2n,2n} = four2n2n2n2n = <cos(n*(2.*phi1+phi2-2.*phi3-phi4))>
20784  // 14th bin: <4>_{3n|1n,1n,1n} = four3n1n1n1n = <cos(n*(3.*phi1-phi2-phi3-phi4))> 
20785  // 15th bin: <4>_{3n,1n|3n,1n} = four3n1n3n1n = <cos(n*(4.*phi1-2.*phi2-phi3-phi4))>
20786  // 16th bin: <4>_{3n,1n|2n,2n} = four3n1n2n2n = <cos(n*(3.*phi1+phi2-2.*phi3-2.*phi4))>
20787  // 17th bin: <4>_{4n|2n,1n,1n} = four4n2n1n1n = <cos(n*(3.*phi1+phi2-3.*phi3-phi4))> 
20788  // 18th bin:           ----  EMPTY ----
20789  // 19th bin: <5>_{2n|1n,1n,1n,1n} = five2n1n1n1n1n = <cos(n*(2.*phi1+phi2-phi3-phi4-phi5))>
20790  // 20th bin: <5>_{2n,2n|2n,1n,1n} = five2n2n2n1n1n = <cos(n*(2.*phi1+2.*phi2-2.*phi3-phi4-phi5))>
20791  // 21st bin: <5>_{3n,1n|2n,1n,1n} = five3n1n2n1n1n = <cos(n*(3.*phi1+phi2-2.*phi3-phi4-phi5))>
20792  // 22nd bin: <5>_{4n|1n,1n,1n,1n} = five4n1n1n1n1n = <cos(n*(4.*phi1-phi2-phi3-phi4-phi5))>
20793  // 23rd bin:           ----  EMPTY ----
20794  // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = six1n1n1n1n1n1n = <cos(n*(phi1+phi2+phi3-phi4-phi5-phi6))>
20795  // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = six2n1n1n2n1n1n = <cos(n*(2.*phi1+2.*phi2-phi3-phi4-phi5-phi6))>
20796  // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = six2n2n1n1n1n1n = <cos(n*(3.*phi1+phi2-phi3-phi4-phi5-phi6))>
20797  // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = six3n1n1n1n1n1n = <cos(n*(2.*phi1+phi2+phi3-2.*phi4-phi5-phi6))>
20798  // 28th bin:           ----  EMPTY ----
20799  // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = seven2n1n1n1n1n1n1n =  <cos(n*(2.*phi1+phi2+phi3-phi4-phi5-phi6-phi7))>
20800  // 30th bin:           ----  EMPTY ----
20801  // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = eight1n1n1n1n1n1n1n1n = <cos(n*(phi1+phi2+phi3+phi4-phi5-phi6-phi7-phi8))>
20802  // 32nd bin:           ----  EMPTY ----
20803   //  Extra correlations for 3p TY study: 
20804  // 33rd bin: <4>_{4n,2n|3n,3n}= four4n2n3n3n = <cos(n*(4.*phi1+2.*phi2-3.*phi3-3.*phi4))>
20805  // 34th bin: <5>_{3n,3n|2n,2n,2n} = five3n3n2n2n2n = <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-2*phi5))> 
20806   //  Extra correlations for 6p TY study: 
20807  // 35th bin: <2>_{5n|5n} = two5n5n = <cos(5n*(phi1-phi2)> T
20808  // 36th bin: <2>_{6n|6n} = two6n6n = <cos(6n*(phi1-phi2)> T
20809  // 37th bin: <3>_{5n|3n,2n} = three5n3n2n = <cos(n*(5*phi1-3*phi2-2*phi3)> 
20810  // 38th bin: <3>_{5n|4n,1n} = three5n4n1n = <cos(n*(5*phi1-4*phi2-1*phi3)> 
20811  // 39th bin: <3>_{6n|3n,3n} = three6n3n3n = <cos(n*(6*phi1-3*phi2-3*phi3)> T 
20812  // 40th bin: <3>_{6n|4n,2n} = three6n4n2n = <cos(n*(6*phi1-4*phi2-2*phi3)> T
20813  // 41st bin: <3>_{6n|5n,1n} = three6n5n1n = <cos(n*(6*phi1-5*phi2-1*phi3)>
20814  // 42nd bin: <4>_{6n|3n,2n,1n} = four6n3n2n1n = <cos(n*(6*phi1-3*phi2-2*phi3-1*phi4)>
20815  // 43rd bin: <4>_{3n,2n|3n,2n} = four3n2n3n2n = <cos(n*(3*phi1+2*phi2-3*phi3-2*phi4)>
20816  // 44th bin: <4>_{4n,1n|3n,2n} = four4n1n3n2n = <cos(n*(4*phi1+1*phi2-3*phi3-2*phi4)>
20817  // 45th bin: <4>_{3n,3n|3n,3n} = four3n3n3n3n = <cos(3.*n*(phi1+phi2-phi3-phi4))> T
20818  // 46th bin: <4>_{4n,2n|3n,3n} = four4n2n3n3n = <cos(n*(4*phi1+2*phi2-3*phi3-3*phi4)>
20819  // 47th bin: <4>_{5n,1n|3n,3n} = four5n1n3n3n = <cos(n*(5*phi1+1*phi2-3*phi3-3*phi4)>
20820  // 48th bin: <4>_{4n,2n|4n,2n} = four4n2n4n2n = <cos(n*(4*phi1+2*phi2-4*phi3-2*phi4)> T
20821  // 49th bin: <4>_{5n,1n|4n,2n} = four5n1n4n2n = <cos(n*(5*phi1+1*phi2-4*phi3-2*phi4)>
20822  // 50th bin: <4>_{5n|3n,1n,1n} = four5n3n1n1n = <cos(n*(5*phi1-3*phi2-1*phi3-1*phi4)>
20823  // 51st bin: <4>_{5n|2n,2n,1n} = four5n2n2n1n = <cos(n*(5*phi1-2*phi2-2*phi3-1*phi4)>
20824  // 52nd bin: <4>_{5n,1n|5n,1n} = four5n1n5n1n = <cos(n*(5*phi1+1*phi2-5*phi3-1*phi4)>
20825  // 53rd bin: <5>_{3n,3n|3n,2n,1n} = four3n3n3n2n1n = <cos(n*(3*phi1+3*phi2-3*phi3-2*phi4-1*phi5)>
20826  // 54th bin: <5>_{4n,2n|3n,2n,1n} = four4n2n3n2n1n = <cos(n*(4*phi1+2*phi2-3*phi3-2*phi4-1*phi5)>
20827  // 55th bin: <5>_{3n,2n|3n,1n,1n} = four3n2n3n1n1n = <cos(n*(3*phi1+2*phi2-3*phi3-1*phi4-1*phi5)>
20828  // 56th bin: <5>_{3n,2n|2n,2n,1n} = four3n2n2n2n1n = <cos(n*(3*phi1+2*phi2-2*phi3-2*phi4-1*phi5)>
20829  // 57th bin: <5>_{5n,1n|3n,2n,1n} = four5n1n3n2n1n = <cos(n*(5*phi1+1*phi2-3*phi3-2*phi4-1*phi5)>
20830  // 58th bin: <6>_{3n,2n,1n|3n,2n,1n} = six3n2n1n3n2n1n = <cos(n*(3*phi1+2*phi2+1*phi3-3*phi4-2*phi5-1*phi6)>
20831   
20832  Int_t nPrim = anEvent->NumberOfTracks(); 
20833  AliFlowTrackSimple *aftsTrack = NULL; 
20834  Double_t phi1=0., phi2=0., phi3=0., phi4=0., phi5=0., phi6=0., phi7=0., phi8=0.; 
20835  Int_t n = fHarmonic; 
20836  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // to be improved (is this casting safe in general?)
20837  Double_t dMult = (*fSpk)(0,0);
20838  cout<<endl;
20839  cout<<"Multiparticle correlations: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
20840  if(dMult<2)
20841  {
20842   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
20843  } else if (dMult>fMaxAllowedMultiplicity)
20844    {
20845     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
20846    } else 
20847      { 
20848       cout<<"... evaluating nested loops (without using particle weights)..."<<endl;
20849      } 
20850  
20851  // 2-particle correlations:       
20852  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
20853  {
20854   for(Int_t i1=0;i1<nPrim;i1++)
20855   {
20856    aftsTrack=anEvent->GetTrack(i1);
20857    if(!(aftsTrack->InRPSelection())) continue;
20858    phi1=aftsTrack->Phi(); 
20859    for(Int_t i2=0;i2<nPrim;i2++)
20860    {
20861     if(i2==i1)continue;
20862     aftsTrack=anEvent->GetTrack(i2);
20863     if(!(aftsTrack->InRPSelection())) continue;
20864     phi2=aftsTrack->Phi();
20865     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
20866     // fill the profile with 2-p correlations: 
20867     fIntFlowDirectCorrelations->Fill(0.5,cos(n*(phi1-phi2)),1.);     // <cos(n*(phi1-phi2))>
20868     fIntFlowDirectCorrelations->Fill(1.5,cos(2.*n*(phi1-phi2)),1.);  // <cos(2n*(phi1-phi2))>
20869     fIntFlowDirectCorrelations->Fill(2.5,cos(3.*n*(phi1-phi2)),1.);  // <cos(3n*(phi1-phi2))>
20870     fIntFlowDirectCorrelations->Fill(3.5,cos(4.*n*(phi1-phi2)),1.);  // <cos(4n*(phi1-phi2))>   
20871     fIntFlowDirectCorrelations->Fill(34.5,cos(5.*n*(phi1-phi2)),1.); // <cos(5n*(phi1-phi2))>
20872     fIntFlowDirectCorrelations->Fill(35.5,cos(6.*n*(phi1-phi2)),1.); // <cos(6n*(phi1-phi2))>   
20873    } // end of for(Int_t i2=0;i2<nPrim;i2++)
20874   } // end of for(Int_t i1=0;i1<nPrim;i1++)
20875  } // end of if(nPrim>=2)
20876  
20877  // 3-particle correlations:         
20878  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
20879  {
20880   for(Int_t i1=0;i1<nPrim;i1++)
20881   {
20882    aftsTrack=anEvent->GetTrack(i1);
20883    if(!(aftsTrack->InRPSelection())) continue;
20884    phi1=aftsTrack->Phi();
20885    for(Int_t i2=0;i2<nPrim;i2++)
20886    {
20887     if(i2==i1)continue;
20888     aftsTrack=anEvent->GetTrack(i2);
20889     if(!(aftsTrack->InRPSelection())) continue;
20890     phi2=aftsTrack->Phi();
20891     for(Int_t i3=0;i3<nPrim;i3++)
20892     {
20893      if(i3==i1||i3==i2)continue;
20894      aftsTrack=anEvent->GetTrack(i3);
20895      if(!(aftsTrack->InRPSelection())) continue;
20896      phi3=aftsTrack->Phi();
20897      if(nPrim==3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush;
20898      // fill the profile with 3-p correlations:   
20899      fIntFlowDirectCorrelations->Fill(5.,cos(2.*n*phi1-n*(phi2+phi3)),1.);         //<3>_{2n|nn,n}
20900      fIntFlowDirectCorrelations->Fill(6.,cos(3.*n*phi1-2.*n*phi2-n*phi3),1.);      //<3>_{3n|2n,n}
20901      fIntFlowDirectCorrelations->Fill(7.,cos(4.*n*phi1-2.*n*phi2-2.*n*phi3),1.);   //<3>_{4n|2n,2n}
20902      fIntFlowDirectCorrelations->Fill(8.,cos(4.*n*phi1-3.*n*phi2-n*phi3),1.);      //<3>_{4n|3n,n}
20903      fIntFlowDirectCorrelations->Fill(36.5,cos(5.*n*phi1-3.*n*phi2-2.*n*phi3),1.); //<3>_{5n|3n,2n}
20904      fIntFlowDirectCorrelations->Fill(37.5,cos(5.*n*phi1-4.*n*phi2-1.*n*phi3),1.); //<3>_{5n|4n,1n}
20905      fIntFlowDirectCorrelations->Fill(38.5,cos(6.*n*phi1-3.*n*phi2-3.*n*phi3),1.); //<3>_{6n|3n,3n}
20906      fIntFlowDirectCorrelations->Fill(39.5,cos(6.*n*phi1-4.*n*phi2-2.*n*phi3),1.); //<3>_{6n|4n,2n}     
20907      fIntFlowDirectCorrelations->Fill(40.5,cos(6.*n*phi1-5.*n*phi2-1.*n*phi3),1.); //<3>_{6n|5n,1n}
20908     } // end of for(Int_t i3=0;i3<nPrim;i3++)
20909    } // end of for(Int_t i2=0;i2<nPrim;i2++)
20910   } // end of for(Int_t i1=0;i1<nPrim;i1++)
20911  } // end of if(nPrim>=3)
20912
20913  // 4-particle correlations:
20914  if(nPrim>=4 && nPrim<=fMaxAllowedMultiplicity)
20915  {       
20916   for(Int_t i1=0;i1<nPrim;i1++)
20917   { 
20918    aftsTrack=anEvent->GetTrack(i1);
20919    if(!(aftsTrack->InRPSelection())) continue;
20920    phi1=aftsTrack->Phi();
20921    for(Int_t i2=0;i2<nPrim;i2++)
20922    {
20923     if(i2==i1)continue;
20924     aftsTrack=anEvent->GetTrack(i2);
20925     if(!(aftsTrack->InRPSelection())) continue;
20926     phi2=aftsTrack->Phi();
20927     for(Int_t i3=0;i3<nPrim;i3++)
20928     {
20929      if(i3==i1||i3==i2)continue;
20930      aftsTrack=anEvent->GetTrack(i3);
20931      if(!(aftsTrack->InRPSelection())) continue;
20932      phi3=aftsTrack->Phi();
20933      for(Int_t i4=0;i4<nPrim;i4++)
20934      {
20935       if(i4==i1||i4==i2||i4==i3)continue;
20936       aftsTrack=anEvent->GetTrack(i4);
20937       if(!(aftsTrack->InRPSelection())) continue;
20938       phi4=aftsTrack->Phi();
20939       if(nPrim==4) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<"\r"<<flush;
20940       // fill the profile with 4-p correlations:   
20941       fIntFlowDirectCorrelations->Fill(10.,cos(n*phi1+n*phi2-n*phi3-n*phi4),1.);            // <4>_{n,n|n,n} 
20942       fIntFlowDirectCorrelations->Fill(11.,cos(2.*n*phi1+n*phi2-2.*n*phi3-n*phi4),1.);      // <4>_{2n,n|2n,n}
20943       fIntFlowDirectCorrelations->Fill(12.,cos(2.*n*phi1+2*n*phi2-2.*n*phi3-2.*n*phi4),1.); // <4>_{2n,2n|2n,2n}
20944       fIntFlowDirectCorrelations->Fill(13.,cos(3.*n*phi1-n*phi2-n*phi3-n*phi4),1.);         // <4>_{3n|n,n,n}
20945       fIntFlowDirectCorrelations->Fill(14.,cos(3.*n*phi1+n*phi2-3.*n*phi3-n*phi4),1.);      // <4>_{3n,n|3n,n}   
20946       fIntFlowDirectCorrelations->Fill(15.,cos(3.*n*phi1+n*phi2-2.*n*phi3-2.*n*phi4),1.);   // <4>_{3n,n|2n,2n}
20947       fIntFlowDirectCorrelations->Fill(16.,cos(4.*n*phi1-2.*n*phi2-n*phi3-n*phi4),1.);      // <4>_{4n|2n,n,n}     
20948       fIntFlowDirectCorrelations->Fill(32.,cos(n*(4.*phi1+2.*phi2-3.*phi3-3.*phi4)),1.);    // <4>_{4n,2n|3n,3n}        
20949       fIntFlowDirectCorrelations->Fill(41.5,cos(n*(6.*phi1-3.*phi2-2.*phi3-1.*phi4)),1.);    // <4>_{6n|3n,2n,1n}  
20950       fIntFlowDirectCorrelations->Fill(42.5,cos(n*(3.*phi1+2.*phi2-3.*phi3-2.*phi4)),1.);    // <4>_{3n,2n|3n,2n}  
20951       fIntFlowDirectCorrelations->Fill(43.5,cos(n*(4.*phi1+1.*phi2-3.*phi3-2.*phi4)),1.);    // <4>_{4n,1n|3n,2n}  
20952       fIntFlowDirectCorrelations->Fill(44.5,cos(n*(3.*phi1+3.*phi2-3.*phi3-3.*phi4)),1.);    // <4>_{3n,3n|3n,3n}  
20953       fIntFlowDirectCorrelations->Fill(45.5,cos(n*(4.*phi1+2.*phi2-3.*phi3-3.*phi4)),1.);    // <4>_{4n,2n|3n,3n}  
20954       fIntFlowDirectCorrelations->Fill(46.5,cos(n*(5.*phi1+1.*phi2-3.*phi3-3.*phi4)),1.);    // <4>_{5n,1n|3n,3n}  
20955       fIntFlowDirectCorrelations->Fill(47.5,cos(n*(4.*phi1+2.*phi2-4.*phi3-2.*phi4)),1.);    // <4>_{4n,2n|4n,2n}     
20956       fIntFlowDirectCorrelations->Fill(48.5,cos(n*(5.*phi1+1.*phi2-4.*phi3-2.*phi4)),1.);    // <4>_{5n,1n|4n,2n}  
20957       fIntFlowDirectCorrelations->Fill(49.5,cos(n*(5.*phi1-3.*phi2-1.*phi3-1.*phi4)),1.);    // <4>_{5n|3n,1n,1n}  
20958       fIntFlowDirectCorrelations->Fill(50.5,cos(n*(5.*phi1-2.*phi2-2.*phi3-1.*phi4)),1.);    // <4>_{5n|2n,2n,1n}  
20959       fIntFlowDirectCorrelations->Fill(51.5,cos(n*(5.*phi1+1.*phi2-5.*phi3-1.*phi4)),1.);    // <4>_{5n,1n|5n,1n}        
20960       fIntFlowDirectCorrelations->Fill(58.5,cos(n*(6.*phi1-4.*phi2-1.*phi3-1.*phi4)),1.);    // <4>_{6n|4n,1n,1n}  
20961       fIntFlowDirectCorrelations->Fill(59.5,cos(n*(6.*phi1-2.*phi2-2.*phi3-2.*phi4)),1.);    // <4>_{6n|2n,2n,2n}  
20962      } // end of for(Int_t i4=0;i4<nPrim;i4++) 
20963     } // end of for(Int_t i3=0;i3<nPrim;i3++)
20964    } // end of for(Int_t i2=0;i2<nPrim;i2++)
20965   } // end of for(Int_t i1=0;i1<nPrim;i1++)
20966  } // end of if(nPrim>=)
20967
20968  // 5-particle correlations:      
20969  if(nPrim>=5 && nPrim<=fMaxAllowedMultiplicity)
20970  {
20971   for(Int_t i1=0;i1<nPrim;i1++)
20972   {
20973    aftsTrack=anEvent->GetTrack(i1);
20974    if(!(aftsTrack->InRPSelection())) continue;  
20975    phi1=aftsTrack->Phi();
20976    for(Int_t i2=0;i2<nPrim;i2++)
20977    {
20978     if(i2==i1)continue;
20979     aftsTrack=anEvent->GetTrack(i2);
20980     if(!(aftsTrack->InRPSelection())) continue;
20981     phi2=aftsTrack->Phi();
20982     for(Int_t i3=0;i3<nPrim;i3++)
20983     {
20984      if(i3==i1||i3==i2)continue;
20985      aftsTrack=anEvent->GetTrack(i3);
20986      if(!(aftsTrack->InRPSelection())) continue;
20987      phi3=aftsTrack->Phi();
20988      for(Int_t i4=0;i4<nPrim;i4++)
20989      {
20990       if(i4==i1||i4==i2||i4==i3)continue;
20991       aftsTrack=anEvent->GetTrack(i4);
20992       if(!(aftsTrack->InRPSelection())) continue;
20993       phi4=aftsTrack->Phi();
20994       for(Int_t i5=0;i5<nPrim;i5++)
20995       {
20996        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
20997        aftsTrack=anEvent->GetTrack(i5);
20998        if(!(aftsTrack->InRPSelection())) continue;
20999        phi5=aftsTrack->Phi();
21000        if(nPrim==5) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<"\r"<<flush;
21001        // fill the profile with 5-p correlations:   
21002        fIntFlowDirectCorrelations->Fill(18.,cos(2.*n*phi1+n*phi2-n*phi3-n*phi4-n*phi5),1.);              // <5>_{2n,n|n,n,n}
21003        fIntFlowDirectCorrelations->Fill(19.,cos(2.*n*phi1+2.*n*phi2-2.*n*phi3-n*phi4-n*phi5),1.);        // <5>_{2n,2n|2n,n,n}
21004        fIntFlowDirectCorrelations->Fill(20.,cos(3.*n*phi1+n*phi2-2.*n*phi3-n*phi4-n*phi5),1.);           // <5>_{3n,n|2n,n,n}
21005        fIntFlowDirectCorrelations->Fill(21.,cos(4.*n*phi1-n*phi2-n*phi3-n*phi4-n*phi5),1.);              // <5>_{4n|n,n,n,n}
21006        fIntFlowDirectCorrelations->Fill(33.,cos(3.*n*phi1+3.*n*phi2-2.*n*phi3-2.*n*phi4-2.*n*phi5),1.);  // <5>_{3n,3n|2n,2n,2n}       
21007        fIntFlowDirectCorrelations->Fill(52.5,cos(3.*n*phi1+3.*n*phi2-3.*n*phi3-2.*n*phi4-1.*n*phi5),1.); // <5>_{3n,3n|3n,2n,1n}      
21008        fIntFlowDirectCorrelations->Fill(53.5,cos(4.*n*phi1+2.*n*phi2-3.*n*phi3-2.*n*phi4-1.*n*phi5),1.); // <5>_{4n,2n|3n,2n,1n}       
21009        fIntFlowDirectCorrelations->Fill(54.5,cos(3.*n*phi1+2.*n*phi2-3.*n*phi3-1.*n*phi4-1.*n*phi5),1.); // <5>_{3n,2n|3n,1n,1n}
21010        fIntFlowDirectCorrelations->Fill(55.5,cos(3.*n*phi1+2.*n*phi2-2.*n*phi3-2.*n*phi4-1.*n*phi5),1.); // <5>_{3n,2n|2n,2n,1n}
21011        fIntFlowDirectCorrelations->Fill(56.5,cos(5.*n*phi1+1.*n*phi2-3.*n*phi3-2.*n*phi4-1.*n*phi5),1.); // <5>_{5n,1n|3n,2n,1n}              
21012        fIntFlowDirectCorrelations->Fill(60.5,cos(6.*n*phi1-2.*n*phi2-2.*n*phi3-1.*n*phi4-1.*n*phi5),1.); // <5>_{6n|2n,2n,1n,1n}
21013        fIntFlowDirectCorrelations->Fill(61.5,cos(4.*n*phi1+1.*n*phi2+1.*n*phi3-3.*n*phi4-3.*n*phi5),1.); // <5>_{4n,1n,1n|3n,3n}              
21014       } // end of for(Int_t i5=0;i5<nPrim;i5++)
21015      } // end of for(Int_t i4=0;i4<nPrim;i4++)  
21016     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21017    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21018   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21019  } // end of if(nPrim>=5)
21020   
21021  // 6-particle correlations:
21022  if(nPrim>=6 && nPrim<=fMaxAllowedMultiplicity)
21023  {
21024   for(Int_t i1=0;i1<nPrim;i1++)
21025   {
21026    aftsTrack=anEvent->GetTrack(i1);
21027    if(!(aftsTrack->InRPSelection())) continue;
21028    phi1=aftsTrack->Phi();
21029    for(Int_t i2=0;i2<nPrim;i2++)
21030    {
21031     if(i2==i1)continue;
21032     aftsTrack=anEvent->GetTrack(i2);
21033     if(!(aftsTrack->InRPSelection())) continue;
21034     phi2=aftsTrack->Phi();
21035     for(Int_t i3=0;i3<nPrim;i3++)
21036     {
21037      if(i3==i1||i3==i2)continue;
21038      aftsTrack=anEvent->GetTrack(i3);
21039      if(!(aftsTrack->InRPSelection())) continue;
21040      phi3=aftsTrack->Phi();
21041      for(Int_t i4=0;i4<nPrim;i4++)
21042      {
21043       if(i4==i1||i4==i2||i4==i3)continue;
21044       aftsTrack=anEvent->GetTrack(i4);
21045       if(!(aftsTrack->InRPSelection())) continue;
21046       phi4=aftsTrack->Phi();
21047       for(Int_t i5=0;i5<nPrim;i5++)
21048       {
21049        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
21050        aftsTrack=anEvent->GetTrack(i5);
21051        if(!(aftsTrack->InRPSelection())) continue;
21052        phi5=aftsTrack->Phi();
21053        for(Int_t i6=0;i6<nPrim;i6++)
21054        {
21055         if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5)continue;
21056         aftsTrack=anEvent->GetTrack(i6);
21057         if(!(aftsTrack->InRPSelection())) continue;
21058         phi6=aftsTrack->Phi(); 
21059         if(nPrim==6) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<" "<<i6<<"\r"<<flush;
21060         // fill the profile with 6-p correlations:   
21061         fIntFlowDirectCorrelations->Fill(23.,cos(n*phi1+n*phi2+n*phi3-n*phi4-n*phi5-n*phi6),1.);                    // <6>_{1n,1n,1n|1n,1n,1n}
21062         fIntFlowDirectCorrelations->Fill(24.,cos(2.*n*phi1+n*phi2+n*phi3-2.*n*phi4-n*phi5-n*phi6),1.);              // <6>_{2n,1n,1n|2n,1n,1n}
21063         fIntFlowDirectCorrelations->Fill(25.,cos(2.*n*phi1+2.*n*phi2-n*phi3-n*phi4-n*phi5-n*phi6),1.);              // <6>_{2n,2n|1n,1n,1n,1n}
21064         fIntFlowDirectCorrelations->Fill(26.,cos(3.*n*phi1+n*phi2-n*phi3-n*phi4-n*phi5-n*phi6),1.);                 // <6>_{3n,1n|1n,1n,1n,1n}  
21065         fIntFlowDirectCorrelations->Fill(57.5,cos(3.*n*phi1+2.*n*phi2+1.*n*phi3-3.*n*phi4-2.*n*phi5-1.*n*phi6),1.); // <6>_{3n,2n,1n|3n,2n,1n}  
21066         fIntFlowDirectCorrelations->Fill(62.5,cos(3.*n*phi1+3.*n*phi2-2.*n*phi3-2.*n*phi4-1.*n*phi5-1.*n*phi6),1.); // <6>_{3n,3n|2n,2n,1n,1n}  
21067        } // end of for(Int_t i6=0;i6<nPrim;i6++)
21068       } // end of for(Int_t i5=0;i5<nPrim;i5++)
21069      } // end of for(Int_t i4=0;i4<nPrim;i4++)
21070     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21071    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21072   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21073  } // end of if(nPrim>=6)
21074   
21075  // 7-particle correlations:
21076  if(nPrim>=7 && nPrim<=fMaxAllowedMultiplicity)
21077  {
21078   for(Int_t i1=0;i1<nPrim;i1++)
21079   { 
21080    aftsTrack=anEvent->GetTrack(i1);
21081    if(!(aftsTrack->InRPSelection())) continue;
21082    phi1=aftsTrack->Phi();
21083    for(Int_t i2=0;i2<nPrim;i2++)
21084    {
21085     if(i2==i1)continue;
21086     aftsTrack=anEvent->GetTrack(i2);
21087     if(!(aftsTrack->InRPSelection())) continue;
21088     phi2=aftsTrack->Phi();
21089     for(Int_t i3=0;i3<nPrim;i3++)
21090     {
21091      if(i3==i1||i3==i2)continue;
21092      aftsTrack=anEvent->GetTrack(i3);
21093      if(!(aftsTrack->InRPSelection())) continue;
21094      phi3=aftsTrack->Phi();
21095      for(Int_t i4=0;i4<nPrim;i4++)
21096      {
21097       if(i4==i1||i4==i2||i4==i3)continue;
21098       aftsTrack=anEvent->GetTrack(i4);
21099       if(!(aftsTrack->InRPSelection())) continue;
21100       phi4=aftsTrack->Phi();
21101       for(Int_t i5=0;i5<nPrim;i5++)
21102       {
21103        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
21104        aftsTrack=anEvent->GetTrack(i5);
21105        if(!(aftsTrack->InRPSelection())) continue;
21106        phi5=aftsTrack->Phi();
21107        for(Int_t i6=0;i6<nPrim;i6++)
21108        {
21109         if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5)continue;
21110         aftsTrack=anEvent->GetTrack(i6);
21111         if(!(aftsTrack->InRPSelection())) continue;
21112         phi6=aftsTrack->Phi(); 
21113         for(Int_t i7=0;i7<nPrim;i7++)
21114         {
21115          if(i7==i1||i7==i2||i7==i3||i7==i4||i7==i5||i7==i6)continue;
21116          aftsTrack=anEvent->GetTrack(i7);
21117          if(!(aftsTrack->InRPSelection())) continue;
21118          phi7=aftsTrack->Phi(); 
21119          if(nPrim==7) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<" "<<i6<<" "<<i7<<"\r"<<flush;
21120          // fill the profile with 7-p correlation:   
21121          fIntFlowDirectCorrelations->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}
21122         } // end of for(Int_t i7=0;i7<nPrim;i7++)
21123        } // end of for(Int_t i6=0;i6<nPrim;i6++) 
21124       } // end of for(Int_t i5=0;i5<nPrim;i5++)
21125      } // end of for(Int_t i4=0;i4<nPrim;i4++)  
21126     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21127    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21128   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21129  } // end of if(nPrim>=7)
21130  
21131  // 8-particle correlations:
21132  if(nPrim>=8 && nPrim<=fMaxAllowedMultiplicity)
21133  {
21134   for(Int_t i1=0;i1<nPrim;i1++)
21135   {
21136    aftsTrack=anEvent->GetTrack(i1);
21137    if(!(aftsTrack->InRPSelection())) continue;
21138    phi1=aftsTrack->Phi();
21139    for(Int_t i2=0;i2<nPrim;i2++)
21140    {
21141     if(i2==i1)continue;
21142     aftsTrack=anEvent->GetTrack(i2);
21143     if(!(aftsTrack->InRPSelection())) continue;
21144     phi2=aftsTrack->Phi();
21145     for(Int_t i3=0;i3<nPrim;i3++)
21146     {
21147      if(i3==i1||i3==i2)continue;
21148      aftsTrack=anEvent->GetTrack(i3);
21149      if(!(aftsTrack->InRPSelection())) continue;
21150      phi3=aftsTrack->Phi();
21151      for(Int_t i4=0;i4<nPrim;i4++)
21152      {
21153       if(i4==i1||i4==i2||i4==i3)continue;
21154       aftsTrack=anEvent->GetTrack(i4);
21155       if(!(aftsTrack->InRPSelection())) continue;
21156       phi4=aftsTrack->Phi();
21157       for(Int_t i5=0;i5<nPrim;i5++)
21158       {
21159        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
21160        aftsTrack=anEvent->GetTrack(i5);
21161        if(!(aftsTrack->InRPSelection())) continue;
21162        phi5=aftsTrack->Phi();
21163        for(Int_t i6=0;i6<nPrim;i6++)
21164        {
21165         if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5)continue;
21166         aftsTrack=anEvent->GetTrack(i6);
21167         if(!(aftsTrack->InRPSelection())) continue;
21168         phi6=aftsTrack->Phi();
21169         for(Int_t i7=0;i7<nPrim;i7++)
21170         {
21171          if(i7==i1||i7==i2||i7==i3||i7==i4||i7==i5||i7==i6)continue;
21172          aftsTrack=anEvent->GetTrack(i7);
21173          if(!(aftsTrack->InRPSelection())) continue;
21174          phi7=aftsTrack->Phi();
21175          for(Int_t i8=0;i8<nPrim;i8++)
21176          {
21177           if(i8==i1||i8==i2||i8==i3||i8==i4||i8==i5||i8==i6||i8==i7)continue;
21178           aftsTrack=anEvent->GetTrack(i8);
21179           if(!(aftsTrack->InRPSelection())) continue;
21180           phi8=aftsTrack->Phi();
21181           cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<" "<<i6<<" "<<i7<<" "<<i8<<"\r"<<flush;
21182           // fill the profile with 8-p correlation:   
21183           fIntFlowDirectCorrelations->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}
21184          } // end of for(Int_t i8=0;i8<nPrim;i8++)
21185         } // end of for(Int_t i7=0;i7<nPrim;i7++) 
21186        } // end of for(Int_t i6=0;i6<nPrim;i6++) 
21187       } // end of for(Int_t i5=0;i5<nPrim;i5++)
21188      } // end of for(Int_t i4=0;i4<nPrim;i4++)  
21189     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21190    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21191   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21192  } // end of if(nPrim>=8)
21193  
21194  cout<<endl;
21195
21196 } // end of AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrelationsWithNestedLoops(AliFlowEventSimple* anEvent)
21197
21198 //================================================================================================================
21199
21200 void AliFlowAnalysisWithQCumulants::EvaluateMixedHarmonicsWithNestedLoops(AliFlowEventSimple * const anEvent)
21201 {
21202  // Evaluate with nested loops multi-particle correlations for mixed harmonics. 
21203   
21204  Int_t nPrim = anEvent->NumberOfTracks(); 
21205  AliFlowTrackSimple *aftsTrack = NULL; 
21206  Double_t phi1=0.;
21207  Double_t phi2=0.; 
21208  Double_t phi3=0.;
21209  Double_t phi4=0.;
21210  Double_t phi5=0.;
21211  /*Double_t phi6=0.;
21212  Double_t phi7=0.;
21213  Double_t phi8=0.;*/ 
21214  Int_t n = fHarmonic; 
21215  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // TBI: is such casting safe in general?
21216  Double_t dMult = (*fSpk)(0,0);
21217  cout<<endl;
21218  cout<<"Multiparticle correlations: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
21219  if(dMult<2)
21220  {
21221   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
21222  } else if (dMult>fMaxAllowedMultiplicity)
21223    {
21224     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
21225    } else 
21226      { 
21227       cout<<"... evaluating nested loops (without using particle weights)..."<<endl;
21228      } 
21229  
21230  // 2-particle correlations:       
21231  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
21232  {
21233   for(Int_t i1=0;i1<nPrim;i1++)
21234   {
21235    aftsTrack=anEvent->GetTrack(i1);
21236    if(!(aftsTrack->InRPSelection())) continue;
21237    phi1=aftsTrack->Phi(); 
21238    for(Int_t i2=0;i2<nPrim;i2++)
21239    {
21240     if(i2==i1)continue;
21241     aftsTrack=anEvent->GetTrack(i2);
21242     if(!(aftsTrack->InRPSelection())) continue;
21243     phi2=aftsTrack->Phi();
21244     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
21245     // Fill the profile fMixedHarmonicsNestedLoops with 2-p correlations: 
21246     fMixedHarmonicsNestedLoops->Fill(0.5,cos(1.*n*(phi1-phi2)),1.); // <cos(1n*(phi1-phi2))>
21247     fMixedHarmonicsNestedLoops->Fill(1.5,cos(2.*n*(phi1-phi2)),1.); // <cos(2n*(phi1-phi2))>
21248     fMixedHarmonicsNestedLoops->Fill(2.5,cos(3.*n*(phi1-phi2)),1.); // <cos(3n*(phi1-phi2))>
21249     fMixedHarmonicsNestedLoops->Fill(3.5,cos(4.*n*(phi1-phi2)),1.); // <cos(4n*(phi1-phi2))>   
21250     fMixedHarmonicsNestedLoops->Fill(4.5,cos(5.*n*(phi1-phi2)),1.); // <cos(5n*(phi1-phi2))>
21251     fMixedHarmonicsNestedLoops->Fill(5.5,cos(6.*n*(phi1-phi2)),1.); // <cos(6n*(phi1-phi2))>   
21252    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21253   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21254  } // end of if(nPrim>=2)
21255  
21256  // 3-particle correlations:         
21257  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
21258  {
21259   for(Int_t i1=0;i1<nPrim;i1++)
21260   {
21261    aftsTrack=anEvent->GetTrack(i1);
21262    if(!(aftsTrack->InRPSelection())) continue;
21263    phi1=aftsTrack->Phi();
21264    for(Int_t i2=0;i2<nPrim;i2++)
21265    {
21266     if(i2==i1)continue;
21267     aftsTrack=anEvent->GetTrack(i2);
21268     if(!(aftsTrack->InRPSelection())) continue;
21269     phi2=aftsTrack->Phi();
21270     for(Int_t i3=0;i3<nPrim;i3++)
21271     {
21272      if(i3==i1||i3==i2)continue;
21273      aftsTrack=anEvent->GetTrack(i3);
21274      if(!(aftsTrack->InRPSelection())) continue;
21275      phi3=aftsTrack->Phi();
21276      if(nPrim==3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush;
21277      // Fill the profile fMixedHarmonicsNestedLoops with 3-p correlations:  
21278      fMixedHarmonicsNestedLoops->Fill( 6.5,cos(2.*n*phi1-n*(phi2+phi3)),1.);       // <3>_{2n|1n,1n}
21279      fMixedHarmonicsNestedLoops->Fill( 7.5,cos(4.*n*phi1-2.*n*phi2-2.*n*phi3),1.); // <3>_{4n|2n,2n}
21280      fMixedHarmonicsNestedLoops->Fill( 8.5,cos(6.*n*phi1-3.*n*phi2-3.*n*phi3),1.); // <3>_{6n|3n,3n}
21281      fMixedHarmonicsNestedLoops->Fill(10.5,cos(3.*n*phi1-2.*n*phi2-n*phi3),1.);    // <3>_{3n|2n,1n}   
21282      fMixedHarmonicsNestedLoops->Fill(11.5,cos(4.*n*phi1-3.*n*phi2-1.*n*phi3),1.); // <3>_{4n|3n,1n}
21283      fMixedHarmonicsNestedLoops->Fill(12.5,cos(5.*n*phi1-3.*n*phi2-2.*n*phi3),1.); // <3>_{5n|3n,2n}
21284      fMixedHarmonicsNestedLoops->Fill(13.5,cos(5.*n*phi1-4.*n*phi2-1.*n*phi3),1.); // <3>_{5n|4n,1n}
21285      fMixedHarmonicsNestedLoops->Fill(14.5,cos(6.*n*phi1-4.*n*phi2-2.*n*phi3),1.); // <3>_{6n|4n,2n}     
21286      fMixedHarmonicsNestedLoops->Fill(15.5,cos(6.*n*phi1-5.*n*phi2-1.*n*phi3),1.); // <3>_{6n|5n,1n}
21287     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21288    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21289   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21290  } // end of if(nPrim>=3)
21291
21292  // 4-particle correlations:
21293  if(nPrim>=4 && nPrim<=fMaxAllowedMultiplicity)
21294  {       
21295   for(Int_t i1=0;i1<nPrim;i1++)
21296   { 
21297    aftsTrack=anEvent->GetTrack(i1);
21298    if(!(aftsTrack->InRPSelection())) continue;
21299    phi1=aftsTrack->Phi();
21300    for(Int_t i2=0;i2<nPrim;i2++)
21301    {
21302     if(i2==i1)continue;
21303     aftsTrack=anEvent->GetTrack(i2);
21304     if(!(aftsTrack->InRPSelection())) continue;
21305     phi2=aftsTrack->Phi();
21306     for(Int_t i3=0;i3<nPrim;i3++)
21307     {
21308      if(i3==i1||i3==i2)continue;
21309      aftsTrack=anEvent->GetTrack(i3);
21310      if(!(aftsTrack->InRPSelection())) continue;
21311      phi3=aftsTrack->Phi();
21312      for(Int_t i4=0;i4<nPrim;i4++)
21313      {
21314       if(i4==i1||i4==i2||i4==i3)continue;
21315       aftsTrack=anEvent->GetTrack(i4);
21316       if(!(aftsTrack->InRPSelection())) continue;
21317       phi4=aftsTrack->Phi();
21318       if(nPrim==4) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<"\r"<<flush;
21319       // fill the profile with 4-p correlations:   
21320       fMixedHarmonicsNestedLoops->Fill(16.5,cos(1.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{1n,1n|1n,1n} 
21321       fMixedHarmonicsNestedLoops->Fill(17.5,cos(2.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{2n,2n|2n,2n} 
21322       fMixedHarmonicsNestedLoops->Fill(18.5,cos(3.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{3n,3n|3n,3n} 
21323       fMixedHarmonicsNestedLoops->Fill(19.5,cos(4.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{4n,4n|4n,4n} 
21324       fMixedHarmonicsNestedLoops->Fill(20.5,cos(5.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{5n,5n|5n,5n} 
21325       fMixedHarmonicsNestedLoops->Fill(21.5,cos(6.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{6n,6n|6n,6n} 
21326       fMixedHarmonicsNestedLoops->Fill(23.5,cos(n*(2.*phi1+1.*phi2-2.*phi3-1.*phi4)),1.); // <4>_{2n,1n|2n,1n} 
21327       fMixedHarmonicsNestedLoops->Fill(24.5,cos(n*(3.*phi1+1.*phi2-3.*phi3-1.*phi4)),1.); // <4>_{3n,1n|3n,1n} 
21328       fMixedHarmonicsNestedLoops->Fill(25.5,cos(n*(3.*phi1+2.*phi2-3.*phi3-2.*phi4)),1.); // <4>_{3n,2n|3n,2n} 
21329       fMixedHarmonicsNestedLoops->Fill(26.5,cos(n*(4.*phi1+1.*phi2-4.*phi3-1.*phi4)),1.); // <4>_{4n,1n|4n,1n} 
21330       fMixedHarmonicsNestedLoops->Fill(27.5,cos(n*(4.*phi1+2.*phi2-4.*phi3-2.*phi4)),1.); // <4>_{4n,2n|4n,2n} 
21331       fMixedHarmonicsNestedLoops->Fill(28.5,cos(n*(4.*phi1+3.*phi2-4.*phi3-3.*phi4)),1.); // <4>_{4n,3n|4n,3n} 
21332       fMixedHarmonicsNestedLoops->Fill(29.5,cos(n*(5.*phi1+1.*phi2-5.*phi3-1.*phi4)),1.); // <4>_{5n,1n|5n,1n} 
21333       fMixedHarmonicsNestedLoops->Fill(30.5,cos(n*(5.*phi1+2.*phi2-5.*phi3-2.*phi4)),1.); // <4>_{5n,2n|5n,2n} 
21334       fMixedHarmonicsNestedLoops->Fill(31.5,cos(n*(5.*phi1+3.*phi2-5.*phi3-3.*phi4)),1.); // <4>_{5n,3n|5n,3n} 
21335       fMixedHarmonicsNestedLoops->Fill(32.5,cos(n*(5.*phi1+4.*phi2-5.*phi3-4.*phi4)),1.); // <4>_{5n,4n|5n,4n} 
21336       fMixedHarmonicsNestedLoops->Fill(33.5,cos(n*(6.*phi1+1.*phi2-6.*phi3-1.*phi4)),1.); // <4>_{6n,1n|6n,1n} 
21337       fMixedHarmonicsNestedLoops->Fill(34.5,cos(n*(6.*phi1+2.*phi2-6.*phi3-2.*phi4)),1.); // <4>_{6n,2n|6n,2n} 
21338       fMixedHarmonicsNestedLoops->Fill(35.5,cos(n*(6.*phi1+3.*phi2-6.*phi3-3.*phi4)),1.); // <4>_{6n,3n|6n,3n} 
21339       fMixedHarmonicsNestedLoops->Fill(36.5,cos(n*(6.*phi1+4.*phi2-6.*phi3-4.*phi4)),1.); // <4>_{6n,4n|6n,4n} 
21340       fMixedHarmonicsNestedLoops->Fill(37.5,cos(n*(6.*phi1+5.*phi2-6.*phi3-5.*phi4)),1.); // <4>_{6n,5n|6n,5n} 
21341       fMixedHarmonicsNestedLoops->Fill(39.5,cos(n*(3.*phi1-1.*phi2-1.*phi3-1.*phi4)),1.); // <4>_{3n|1n,1n,1n} 
21342       fMixedHarmonicsNestedLoops->Fill(40.5,cos(n*(6.*phi1-2.*phi2-2.*phi3-2.*phi4)),1.); // <4>_{6n|2n,2n,2n} 
21343       fMixedHarmonicsNestedLoops->Fill(42.5,cos(n*(3.*phi1+1.*phi2-2.*phi3-2.*phi4)),1.); // <4>_{3n,1n|2n,2n} 
21344       fMixedHarmonicsNestedLoops->Fill(43.5,cos(n*(4.*phi1-2.*phi2-1.*phi3-1.*phi4)),1.); // <4>_{4n|2n,1n,1n} 
21345       fMixedHarmonicsNestedLoops->Fill(44.5,cos(n*(4.*phi1+2.*phi2-3.*phi3-3.*phi4)),1.); // <4>_{4n,2n|3n,3n} 
21346       fMixedHarmonicsNestedLoops->Fill(45.5,cos(n*(5.*phi1-2.*phi2-2.*phi3-1.*phi4)),1.); // <4>_{5n|2n,2n,1n} 
21347       fMixedHarmonicsNestedLoops->Fill(46.5,cos(n*(5.*phi1-3.*phi2-1.*phi3-1.*phi4)),1.); // <4>_{5n|3n,1n,1n} 
21348       fMixedHarmonicsNestedLoops->Fill(47.5,cos(n*(5.*phi1+1.*phi2-3.*phi3-3.*phi4)),1.); // <4>_{5n,1n|3n,3n} 
21349       fMixedHarmonicsNestedLoops->Fill(48.5,cos(n*(5.*phi1+3.*phi2-4.*phi3-4.*phi4)),1.); // <4>_{5n,3n|4n,4n} 
21350       fMixedHarmonicsNestedLoops->Fill(49.5,cos(n*(6.*phi1-4.*phi2-1.*phi3-1.*phi4)),1.); // <4>_{6n|4n,1n,1n} 
21351       fMixedHarmonicsNestedLoops->Fill(50.5,cos(n*(6.*phi1+2.*phi2-4.*phi3-4.*phi4)),1.); // <4>_{6n,2n|4n,4n} 
21352       fMixedHarmonicsNestedLoops->Fill(51.5,cos(n*(6.*phi1+4.*phi2-5.*phi3-5.*phi4)),1.); // <4>_{6n,4n|5n,5n} 
21353       fMixedHarmonicsNestedLoops->Fill(53.5,cos(n*(4.*phi1+1.*phi2-3.*phi3-2.*phi4)),1.); // <4>_{4n,1n|3n,2n} 
21354       fMixedHarmonicsNestedLoops->Fill(54.5,cos(n*(5.*phi1+1.*phi2-4.*phi3-2.*phi4)),1.); // <4>_{5n,1n|4n,2n} 
21355       fMixedHarmonicsNestedLoops->Fill(55.5,cos(n*(5.*phi1+2.*phi2-4.*phi3-3.*phi4)),1.); // <4>_{5n,2n|4n,3n} 
21356       fMixedHarmonicsNestedLoops->Fill(56.5,cos(n*(6.*phi1+1.*phi2-4.*phi3-3.*phi4)),1.); // <4>_{6n,1n|4n,3n} 
21357       fMixedHarmonicsNestedLoops->Fill(57.5,cos(n*(6.*phi1+1.*phi2-5.*phi3-2.*phi4)),1.); // <4>_{6n,1n|5n,2n} 
21358       fMixedHarmonicsNestedLoops->Fill(58.5,cos(n*(6.*phi1-3.*phi2-2.*phi3-1.*phi4)),1.); // <4>_{6n|3n,2n,1n} 
21359       fMixedHarmonicsNestedLoops->Fill(59.5,cos(n*(6.*phi1+2.*phi2-5.*phi3-3.*phi4)),1.); // <4>_{6n,2n|5n,3n} 
21360       fMixedHarmonicsNestedLoops->Fill(60.5,cos(n*(6.*phi1+3.*phi2-5.*phi3-4.*phi4)),1.); // <4>_{6n,3n|5n,4n} 
21361      } // end of for(Int_t i4=0;i4<nPrim;i4++) 
21362     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21363    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21364   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21365  } // end of if(nPrim>=)
21366
21367  // 5-particle correlations:      
21368  if(nPrim>=5 && nPrim<=fMaxAllowedMultiplicity)
21369  {
21370   for(Int_t i1=0;i1<nPrim;i1++)
21371   {
21372    aftsTrack=anEvent->GetTrack(i1);
21373    if(!(aftsTrack->InRPSelection())) continue;  
21374    phi1=aftsTrack->Phi();
21375    for(Int_t i2=0;i2<nPrim;i2++)
21376    {
21377     if(i2==i1)continue;
21378     aftsTrack=anEvent->GetTrack(i2);
21379     if(!(aftsTrack->InRPSelection())) continue;
21380     phi2=aftsTrack->Phi();
21381     for(Int_t i3=0;i3<nPrim;i3++)
21382     {
21383      if(i3==i1||i3==i2)continue;
21384      aftsTrack=anEvent->GetTrack(i3);
21385      if(!(aftsTrack->InRPSelection())) continue;
21386      phi3=aftsTrack->Phi();
21387      for(Int_t i4=0;i4<nPrim;i4++)
21388      {
21389       if(i4==i1||i4==i2||i4==i3)continue;
21390       aftsTrack=anEvent->GetTrack(i4);
21391       if(!(aftsTrack->InRPSelection())) continue;
21392       phi4=aftsTrack->Phi();
21393       for(Int_t i5=0;i5<nPrim;i5++)
21394       {
21395        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
21396        aftsTrack=anEvent->GetTrack(i5);
21397        if(!(aftsTrack->InRPSelection())) continue;
21398        phi5=aftsTrack->Phi();
21399        if(nPrim==5) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<"\r"<<flush;
21400        // fill the profile with 5-p correlations:   
21401        fMixedHarmonicsNestedLoops->Fill(61.5,cos(n*(3.*phi1+2.*phi2-3.*phi3-1.*phi4-1.*phi5)),1.); // <cos(n(3*phi1+2*phi2-3*phi3-1*phi4-1*phi5))>
21402        fMixedHarmonicsNestedLoops->Fill(62.5,cos(n*(4.*phi1+1.*phi2-2.*phi3-2.*phi4-1.*phi5)),1.); // <cos(n(4*phi1+1*phi2-2*phi3-2*phi4-1*phi5))>
21403        fMixedHarmonicsNestedLoops->Fill(63.5,cos(n*(4.*phi1+2.*phi2-3.*phi3-2.*phi4-1.*phi5)),1.); // <cos(n(4*phi1+2*phi2-3*phi3-2*phi4-1*phi5))>
21404        fMixedHarmonicsNestedLoops->Fill(64.5,cos(n*(4.*phi1+3.*phi2-3.*phi3-2.*phi4-2.*phi5)),1.); // <cos(n(4*phi1+3*phi2-3*phi3-2*phi4-2*phi5))>
21405        fMixedHarmonicsNestedLoops->Fill(65.5,cos(n*(4.*phi1+2.*phi2-4.*phi3-1.*phi4-1.*phi5)),1.); // <cos(n(4*phi1+2*phi2-4*phi3-1*phi4-1*phi5))>
21406        fMixedHarmonicsNestedLoops->Fill(66.5,cos(n*(4.*phi1+3.*phi2-4.*phi3-2.*phi4-1.*phi5)),1.); // <cos(n(4*phi1+3*phi2-4*phi3-2*phi4-1*phi5))>
21407        fMixedHarmonicsNestedLoops->Fill(67.5,cos(n*(5.*phi1+1.*phi2-3.*phi3-2.*phi4-1.*phi5)),1.); // <cos(n(5*phi1+1*phi2-3*phi3-2*phi4-1*phi5))>
21408        fMixedHarmonicsNestedLoops->Fill(68.5,cos(n*(5.*phi1+2.*phi2-5.*phi3-1.*phi4-1.*phi5)),1.); // <cos(n(5*phi1+2*phi2-5*phi3-1*phi4-1*phi5))>
21409        fMixedHarmonicsNestedLoops->Fill(69.5,cos(n*(5.*phi1+2.*phi2-4.*phi3-2.*phi4-1.*phi5)),1.); // <cos(n(5*phi1+2*phi2-4*phi3-2*phi4-1*phi5))>
21410        fMixedHarmonicsNestedLoops->Fill(70.5,cos(n*(5.*phi1+3.*phi2-4.*phi3-3.*phi4-1.*phi5)),1.); // <cos(n(5*phi1+3*phi2-4*phi3-3*phi4-1*phi5))>
21411        fMixedHarmonicsNestedLoops->Fill(71.5,cos(n*(5.*phi1+4.*phi2-4.*phi3-3.*phi4-2.*phi5)),1.); // <cos(n(5*phi1+4*phi2-4*phi3-3*phi4-2*phi5))>
21412        fMixedHarmonicsNestedLoops->Fill(72.5,cos(n*(5.*phi1+3.*phi2-5.*phi3-2.*phi4-1.*phi5)),1.); // <cos(n(5*phi1+3*phi2-5*phi3-2*phi4-1*phi5))>
21413        fMixedHarmonicsNestedLoops->Fill(73.5,cos(n*(5.*phi1+4.*phi2-5.*phi3-2.*phi4-2.*phi5)),1.); // <cos(n(5*phi1+4*phi2-5*phi3-2*phi4-2*phi5))>
21414        fMixedHarmonicsNestedLoops->Fill(74.5,cos(n*(5.*phi1+4.*phi2-5.*phi3-3.*phi4-1.*phi5)),1.); // <cos(n(5*phi1+4*phi2-5*phi3-3*phi4-1*phi5))>
21415        fMixedHarmonicsNestedLoops->Fill(75.5,cos(n*(6.*phi1+1.*phi2-3.*phi3-3.*phi4-1.*phi5)),1.); // <cos(n(6*phi1+1*phi2-3*phi3-3*phi4-1*phi5))>
21416        fMixedHarmonicsNestedLoops->Fill(76.5,cos(n*(6.*phi1+2.*phi2-3.*phi3-3.*phi4-2.*phi5)),1.); // <cos(n(6*phi1+2*phi2-3*phi3-3*phi4-2*phi5))>
21417        fMixedHarmonicsNestedLoops->Fill(77.5,cos(n*(6.*phi1+1.*phi2-4.*phi3-2.*phi4-1.*phi5)),1.); // <cos(n(6*phi1+1*phi2-4*phi3-2*phi4-1*phi5))>
21418        fMixedHarmonicsNestedLoops->Fill(78.5,cos(n*(6.*phi1+3.*phi2-4.*phi3-3.*phi4-2.*phi5)),1.); // <cos(n(6*phi1+3*phi2-4*phi3-3*phi4-2*phi5))>
21419        fMixedHarmonicsNestedLoops->Fill(79.5,cos(n*(6.*phi1+4.*phi2-4.*phi3-3.*phi4-3.*phi5)),1.); // <cos(n(6*phi1+4*phi2-4*phi3-3*phi4-3*phi5))>
21420        fMixedHarmonicsNestedLoops->Fill(80.5,cos(n*(6.*phi1+2.*phi2-5.*phi3-2.*phi4-1.*phi5)),1.); // <cos(n(6*phi1+2*phi2-5*phi3-2*phi4-1*phi5))>
21421        fMixedHarmonicsNestedLoops->Fill(81.5,cos(n*(6.*phi1+3.*phi2-5.*phi3-3.*phi4-1.*phi5)),1.); // <cos(n(6*phi1+3*phi2-5*phi3-3*phi4-1*phi5))>
21422        fMixedHarmonicsNestedLoops->Fill(82.5,cos(n*(6.*phi1+4.*phi2-5.*phi3-4.*phi4-1.*phi5)),1.); // <cos(n(6*phi1+4*phi2-5*phi3-4*phi4-1*phi5))>
21423        fMixedHarmonicsNestedLoops->Fill(83.5,cos(n*(6.*phi1+5.*phi2-5.*phi3-3.*phi4-3.*phi5)),1.); // <cos(n(6*phi1+5*phi2-5*phi3-3*phi4-3*phi5))>
21424        fMixedHarmonicsNestedLoops->Fill(84.5,cos(n*(6.*phi1+2.*phi2-6.*phi3-1.*phi4-1.*phi5)),1.); // <cos(n(6*phi1+2*phi2-6*phi3-1*phi4-1*phi5))>
21425        fMixedHarmonicsNestedLoops->Fill(85.5,cos(n*(6.*phi1+3.*phi2-6.*phi3-2.*phi4-1.*phi5)),1.); // <cos(n(6*phi1+3*phi2-6*phi3-2*phi4-1*phi5))>
21426        fMixedHarmonicsNestedLoops->Fill(86.5,cos(n*(6.*phi1+4.*phi2-6.*phi3-2.*phi4-2.*phi5)),1.); // <cos(n(6*phi1+4*phi2-6*phi3-2*phi4-2*phi5))>
21427        fMixedHarmonicsNestedLoops->Fill(87.5,cos(n*(6.*phi1+4.*phi2-6.*phi3-3.*phi4-1.*phi5)),1.); // <cos(n(6*phi1+4*phi2-6*phi3-3*phi4-1*phi5))>
21428        fMixedHarmonicsNestedLoops->Fill(88.5,cos(n*(6.*phi1+5.*phi2-5.*phi3-4.*phi4-2.*phi5)),1.); // <cos(n(6*phi1+5*phi2-5*phi3-4*phi4-2*phi5))>
21429        fMixedHarmonicsNestedLoops->Fill(89.5,cos(n*(6.*phi1+5.*phi2-6.*phi3-3.*phi4-2.*phi5)),1.); // <cos(n(6*phi1+5*phi2-6*phi3-3*phi4-2*phi5))>
21430        fMixedHarmonicsNestedLoops->Fill(90.5,cos(n*(6.*phi1+5.*phi2-6.*phi3-4.*phi4-1.*phi5)),1.); // <cos(n(6*phi1+5*phi2-6*phi3-4*phi4-1*phi5))>
21431        //fMixedHarmonicsNestedLoops->Fill(91.5,-44.,1.); // empty
21432        fMixedHarmonicsNestedLoops->Fill(92.5,cos(n*(2.*phi1+1.*phi2-1.*phi3-1.*phi4-1.*phi5)),1.); // <cos(n(2*phi1+1*phi2-1*phi3-1*phi4-1*phi5))>
21433        fMixedHarmonicsNestedLoops->Fill(93.5,cos(n*(2.*phi1+2.*phi2-2.*phi3-1.*phi4-1.*phi5)),1.); // <cos(n(2*phi1+2*phi2-2*phi3-1*phi4-1*phi5))>
21434        fMixedHarmonicsNestedLoops->Fill(94.5,cos(n*(3.*phi1+3.*phi2-2.*phi3-2.*phi4-2.*phi5)),1.); // <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-2*phi5))>
21435        fMixedHarmonicsNestedLoops->Fill(95.5,cos(n*(4.*phi1-1.*phi2-1.*phi3-1.*phi4-1.*phi5)),1.); // <cos(n(4*phi1-1*phi2-1*phi3-1*phi4-1*phi5))>
21436        fMixedHarmonicsNestedLoops->Fill(96.5,cos(n*(4.*phi1+2.*phi2-2.*phi3-2.*phi4-2.*phi5)),1.); // <cos(n(4*phi1+2*phi2-2*phi3-2*phi4-2*phi5))>
21437        fMixedHarmonicsNestedLoops->Fill(97.5,cos(n*(4.*phi1+4.*phi2-4.*phi3-2.*phi4-2.*phi5)),1.); // <cos(n(4*phi1+4*phi2-4*phi3-2*phi4-2*phi5))>
21438        fMixedHarmonicsNestedLoops->Fill(98.5,cos(n*(6.*phi1+3.*phi2-3.*phi3-3.*phi4-3.*phi5)),1.); // <cos(n(6*phi1+3*phi2-3*phi3-3*phi4-3*phi5))>
21439        fMixedHarmonicsNestedLoops->Fill(99.5,cos(n*(6.*phi1+6.*phi2-4.*phi3-4.*phi4-4.*phi5)),1.); // <cos(n(6*phi1+6*phi2-4*phi3-4*phi4-4*phi5))>
21440        fMixedHarmonicsNestedLoops->Fill(100.5,cos(n*(6.*phi1+6.*phi2-6.*phi3-3.*phi4-3.*phi5)),1.); // <cos(n(6*phi1+6*phi2-6*phi3-3*phi4-3*phi5))>
21441        //fMixedHarmonicsNestedLoops->Fill(101.5,-44.,1.); // empty
21442        fMixedHarmonicsNestedLoops->Fill(102.5,cos(n*(3.*phi1+1.*phi2-2.*phi3-1.*phi4-1.*phi5)),1.); // <cos(n(3*phi1+1*phi2-2*phi3-1*phi4-1*phi5))>
21443        fMixedHarmonicsNestedLoops->Fill(103.5,cos(n*(3.*phi1+2.*phi2-2.*phi3-2.*phi4-1.*phi5)),1.); // <cos(n(3*phi1+2*phi2-2*phi3-2*phi4-1*phi5))>
21444        fMixedHarmonicsNestedLoops->Fill(104.5,cos(n*(3.*phi1+3.*phi2-3.*phi3-2.*phi4-1.*phi5)),1.); // <cos(n(3*phi1+3*phi2-3*phi3-2*phi4-1*phi5))>
21445        fMixedHarmonicsNestedLoops->Fill(105.5,cos(n*(4.*phi1+1.*phi2-3.*phi3-1.*phi4-1.*phi5)),1.); // <cos(n(4*phi1+1*phi2-3*phi3-1*phi4-1*phi5))>
21446        fMixedHarmonicsNestedLoops->Fill(106.5,cos(n*(4.*phi1+1.*phi2+1.*phi3-3.*phi4-3.*phi5)),1.); // <cos(n(4*phi1+1*phi2+1*phi3-3*phi4-3*phi5))>
21447        fMixedHarmonicsNestedLoops->Fill(107.5,cos(n*(4.*phi1+3.*phi2-3.*phi3-3.*phi4-1.*phi5)),1.); // <cos(n(4*phi1+3*phi2-3*phi3-3*phi4-1*phi5))>
21448        fMixedHarmonicsNestedLoops->Fill(108.5,cos(n*(4.*phi1+4.*phi2-3.*phi3-3.*phi4-2.*phi5)),1.); // <cos(n(4*phi1+4*phi2-3*phi3-3*phi4-2*phi5))>
21449        fMixedHarmonicsNestedLoops->Fill(109.5,cos(n*(4.*phi1+4.*phi2-4.*phi3-3.*phi4-1.*phi5)),1.); // <cos(n(4*phi1+4*phi2-4*phi3-3*phi4-1*phi5))>
21450        fMixedHarmonicsNestedLoops->Fill(110.5,cos(n*(5.*phi1-2.*phi2-1.*phi3-1.*phi4-1.*phi5)),1.); // <cos(n(5*phi1-2*phi2-1*phi3-1*phi4-1*phi5))>
21451        fMixedHarmonicsNestedLoops->Fill(111.5,cos(n*(5.*phi1+1.*phi2-2.*phi3-2.*phi4-2.*phi5)),1.); // <cos(n(5*phi1+1*phi2-2*phi3-2*phi4-2*phi5))>
21452        fMixedHarmonicsNestedLoops->Fill(112.5,cos(n*(5.*phi1+2.*phi2-3.*phi3-2.*phi4-2.*phi5)),1.); // <cos(n(5*phi1+2*phi2-3*phi3-2*phi4-2*phi5))>
21453        fMixedHarmonicsNestedLoops->Fill(113.5,cos(n*(5.*phi1+3.*phi2-3.*phi3-3.*phi4-2.*phi5)),1.); // <cos(n(5*phi1+3*phi2-3*phi3-3*phi4-2*phi5))>
21454        fMixedHarmonicsNestedLoops->Fill(114.5,cos(n*(5.*phi1+1.*phi2-4.*phi3-1.*phi4-1.*phi5)),1.); // <cos(n(5*phi1+1*phi2-4*phi3-1*phi4-1*phi5))>
21455        fMixedHarmonicsNestedLoops->Fill(115.5,cos(n*(5.*phi1+4.*phi2-3.*phi3-3.*phi4-3.*phi5)),1.); // <cos(n(5*phi1+4*phi2-3*phi3-3*phi4-3*phi5))>
21456        fMixedHarmonicsNestedLoops->Fill(116.5,cos(n*(5.*phi1+4.*phi2-4.*phi3-4.*phi4-1.*phi5)),1.); // <cos(n(5*phi1+4*phi2-4*phi3-4*phi4-1*phi5))>
21457        fMixedHarmonicsNestedLoops->Fill(117.5,cos(n*(5.*phi1+5.*phi2-4.*phi3-3.*phi4-3.*phi5)),1.); // <cos(n(5*phi1+5*phi2-4*phi3-3*phi4-3*phi5))>
21458        fMixedHarmonicsNestedLoops->Fill(118.5,cos(n*(5.*phi1+5.*phi2-4.*phi3-4.*phi4-2.*phi5)),1.); // <cos(n(5*phi1+5*phi2-4*phi3-4*phi4-2*phi5))>
21459        fMixedHarmonicsNestedLoops->Fill(119.5,cos(n*(5.*phi1+5.*phi2-5.*phi3-3.*phi4-2.*phi5)),1.); // <cos(n(5*phi1+5*phi2-5*phi3-3*phi4-2*phi5))>
21460        fMixedHarmonicsNestedLoops->Fill(120.5,cos(n*(5.*phi1+5.*phi2-5.*phi3-4.*phi4-1.*phi5)),1.); // <cos(n(5*phi1+5*phi2-5*phi3-4*phi4-1*phi5))>
21461        fMixedHarmonicsNestedLoops->Fill(121.5,cos(n*(6.*phi1-2.*phi2-2.*phi3-1.*phi4-1.*phi5)),1.); // <cos(n(6*phi1-2*phi2-2*phi3-1*phi4-1*phi5))>
21462        fMixedHarmonicsNestedLoops->Fill(122.5,cos(n*(6.*phi1-3.*phi2-1.*phi3-1.*phi4-1.*phi5)),1.); // <cos(n(6*phi1-3*phi2-1*phi3-1*phi4-1*phi5))>
21463        fMixedHarmonicsNestedLoops->Fill(123.5,cos(n*(6.*phi1+1.*phi2+1.*phi3-4.*phi4-4.*phi5)),1.); // <cos(n(6*phi1+1*phi2+1*phi3-4*phi4-4*phi5))>
21464        fMixedHarmonicsNestedLoops->Fill(124.5,cos(n*(6.*phi1+1.*phi2-5.*phi3-1.*phi4-1.*phi5)),1.); // <cos(n(6*phi1+1*phi2-5*phi3-1*phi4-1*phi5))>
21465        fMixedHarmonicsNestedLoops->Fill(125.5,cos(n*(6.*phi1+2.*phi2-4.*phi3-2.*phi4-2.*phi5)),1.); // <cos(n(6*phi1+2*phi2-4*phi3-2*phi4-2*phi5))>
21466        fMixedHarmonicsNestedLoops->Fill(126.5,cos(n*(6.*phi1+4.*phi2-4.*phi3-4.*phi4-2.*phi5)),1.); // <cos(n(6*phi1+4*phi2-4*phi3-4*phi4-2*phi5))>
21467        fMixedHarmonicsNestedLoops->Fill(127.5,cos(n*(6.*phi1+2.*phi2+2.*phi3-5.*phi4-5.*phi5)),1.); // <cos(n(6*phi1+2*phi2+2*phi3-5*phi4-5*phi5))>
21468        fMixedHarmonicsNestedLoops->Fill(128.5,cos(n*(6.*phi1+5.*phi2-5.*phi3-5.*phi4-1.*phi5)),1.); // <cos(n(6*phi1+5*phi2-5*phi3-5*phi4-1*phi5))>
21469        fMixedHarmonicsNestedLoops->Fill(129.5,cos(n*(6.*phi1+6.*phi2-5.*phi3-5.*phi4-2.*phi5)),1.); // <cos(n(6*phi1+6*phi2-5*phi3-5*phi4-2*phi5))>
21470        fMixedHarmonicsNestedLoops->Fill(130.5,cos(n*(6.*phi1+6.*phi2-6.*phi3-4.*phi4-2.*phi5)),1.); // <cos(n(6*phi1+6*phi2-6*phi3-4*phi4-2*phi5))>
21471        fMixedHarmonicsNestedLoops->Fill(131.5,cos(n*(6.*phi1+6.*phi2-6.*phi3-5.*phi4-1.*phi5)),1.); // <cos(n(6*phi1+6*phi2-6*phi3-5*phi4-1*phi5))> // TBI swap with the one above
21472        //fMixedHarmonicsNestedLoops->Fill(132.5,-44.,1.); // empty
21473        fMixedHarmonicsNestedLoops->Fill(133.5,cos(n*(5.*phi1+2.*phi2-3.*phi3-3.*phi4-1.*phi5)),1.); // <cos(n(5*phi1+2*phi2-3*phi3-3*phi4-1*phi5))>
21474        fMixedHarmonicsNestedLoops->Fill(134.5,cos(n*(5.*phi1+1.*phi2+1.*phi3-4.*phi4-3.*phi5)),1.); // <cos(n(5*phi1+1*phi2+1*phi3-4*phi4-3*phi5))>
21475        fMixedHarmonicsNestedLoops->Fill(135.5,cos(n*(5.*phi1+3.*phi2-4.*phi3-2.*phi4-2.*phi5)),1.); // <cos(n(5*phi1+3*phi2-4*phi3-2*phi4-2*phi5))>
21476        fMixedHarmonicsNestedLoops->Fill(136.5,cos(n*(5.*phi1+2.*phi2+1.*phi3-4.*phi4-4.*phi5)),1.); // <cos(n(5*phi1+2*phi2+1*phi3-4*phi4-4*phi5))>
21477        fMixedHarmonicsNestedLoops->Fill(137.5,cos(n*(6.*phi1+1.*phi2-3.*phi3-2.*phi4-2.*phi5)),1.); // <cos(n(6*phi1+1*phi2-3*phi3-2*phi4-2*phi5))>
21478        fMixedHarmonicsNestedLoops->Fill(138.5,cos(n*(6.*phi1+3.*phi2-4.*phi3-4.*phi4-1.*phi5)),1.); // <cos(n(6*phi1+3*phi2-4*phi3-4*phi4-1*phi5))>
21479        fMixedHarmonicsNestedLoops->Fill(139.5,cos(n*(6.*phi1+1.*phi2+1.*phi3-5.*phi4-3.*phi5)),1.); // <cos(n(6*phi1+1*phi2+1*phi3-5*phi4-3*phi5))>
21480        fMixedHarmonicsNestedLoops->Fill(140.5,cos(n*(6.*phi1+3.*phi2-5.*phi3-2.*phi4-2.*phi5)),1.); // <cos(n(6*phi1+3*phi2-5*phi3-2*phi4-2*phi5))>
21481        fMixedHarmonicsNestedLoops->Fill(141.5,cos(n*(6.*phi1+5.*phi2-4.*phi3-4.*phi4-3.*phi5)),1.); // <cos(n(6*phi1+5*phi2-4*phi3-4*phi4-3*phi5))>
21482        fMixedHarmonicsNestedLoops->Fill(142.5,cos(n*(6.*phi1+3.*phi2+1.*phi3-5.*phi4-5.*phi5)),1.); // <cos(n(6*phi1+3*phi2+1*phi3-5*phi4-5*phi5))>
21483        fMixedHarmonicsNestedLoops->Fill(143.5,cos(n*(6.*phi1+6.*phi2-5.*phi3-4.*phi4-3.*phi5)),1.); // <cos(n(6*phi1+6*phi2-5*phi3-4*phi4-3*phi5))>
21484        //fMixedHarmonicsNestedLoops->Fill(144.5,-44.,1.); // empty
21485        fMixedHarmonicsNestedLoops->Fill(145.5,cos(n*(6.*phi1+2.*phi2-4.*phi3-3.*phi4-1.*phi5)),1.); // <cos(n(6*phi1+2*phi2-4*phi3-3*phi4-1*phi5))>
21486        fMixedHarmonicsNestedLoops->Fill(146.5,cos(n*(6.*phi1+2.*phi2+1.*phi3-5.*phi4-4.*phi5)),1.); // <cos(n(6*phi1+2*phi2+1*phi3-5*phi4-4*phi5))>
21487        fMixedHarmonicsNestedLoops->Fill(147.5,cos(n*(6.*phi1+4.*phi2-5.*phi3-3.*phi4-2.*phi5)),1.); // <cos(n(6*phi1+4*phi2-5*phi3-3*phi4-2*phi5))>
21488       } // end of for(Int_t i5=0;i5<nPrim;i5++)
21489      } // end of for(Int_t i4=0;i4<nPrim;i4++)  
21490     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21491    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21492   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21493  } // end of if(nPrim>=5)
21494
21495  // QW44
21496
21497 } // end of void AliFlowAnalysisWithQCumulants::EvaluateMixedHarmonicsWithNestedLoops(AliFlowEventSimple * const anEvent)
21498
21499 //================================================================================================================
21500
21501 void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowCorrelations()
21502 {
21503  // Cross-check results for multiparticle correlations needed for int. flow: results from Q-vectors vs results from nested loops.
21504
21505  cout<<endl;
21506  cout<<endl;
21507  cout<<"   *****************************************"<<endl;
21508  cout<<"   **** cross-checking the correlations ****"<<endl;
21509  cout<<"   ****       for integrated flow       ****"<<endl;
21510  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
21511  {
21512   cout<<"   ****   (particle weights not used)   ****"<<endl;
21513  } else
21514    {
21515     cout<<"   ****     (particle weights used)     ****"<<endl;
21516    } 
21517  cout<<"   *****************************************"<<endl;
21518  cout<<endl;
21519  cout<<endl;
21520
21521  Int_t ciMax = 64; // to be improved (removed eventually when I calculate 6th and 8th order with particle weights)
21522  
21523  if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
21524  {
21525   ciMax = 11;
21526  }
21527
21528  for(Int_t ci=1;ci<=ciMax;ci++)
21529  {
21530   if(strcmp((fIntFlowCorrelationsAllPro->GetXaxis())->GetBinLabel(ci), "") == 0) continue; // to be improved (access finalized histogram here)
21531   cout<<(fIntFlowCorrelationsAllPro->GetXaxis())->GetBinLabel(ci)<<":"<<endl; // to be improved (access finalized histogram here)
21532   cout<<"from Q-vectors    = "<<fIntFlowCorrelationsAllPro->GetBinContent(ci)<<endl; // to be improved (access finalized histogram here)
21533   cout<<"from nested loops = "<<fIntFlowDirectCorrelations->GetBinContent(ci)<<endl;
21534   cout<<endl;
21535  }
21536
21537  if(!fCalculateMixedHarmonics){return;}
21538
21539  cout<<endl;
21540  cout<<endl;
21541  cout<<"   *****************************************"<<endl;
21542  cout<<"   **** cross-checking the correlations ****"<<endl;
21543  cout<<"   ****       for mixed harmonics       ****"<<endl;
21544  cout<<"   *****************************************"<<endl;
21545  cout<<endl;
21546  cout<<endl;
21547
21548  // 2-p:
21549  for(Int_t ci=1;ci<=6;ci++)
21550  {
21551   cout<<(f2pCorrelations->GetXaxis())->GetBinLabel(ci)<<":"<<endl;
21552   cout<<"from Q-vectors    = "<<f2pCorrelations->GetBinContent(ci)<<endl; 
21553   cout<<"from nested loops = "<<fMixedHarmonicsNestedLoops->GetBinContent(ci)<<endl;
21554   cout<<endl;
21555  } // end of for(Int_t ci=1;ci<=6;ci++)
21556
21557  // 3-p:
21558  for(Int_t ci=1;ci<=10;ci++)
21559  {
21560   if(4==ci){continue;} // skipping the empty bins
21561   cout<<(f3pCorrelations->GetXaxis())->GetBinLabel(ci)<<":"<<endl;
21562   cout<<"from Q-vectors    = "<<f3pCorrelations->GetBinContent(ci)<<endl; 
21563   cout<<"from nested loops = "<<fMixedHarmonicsNestedLoops->GetBinContent(ci+6)<<endl;
21564   cout<<endl;
21565  } // end of for(Int_t ci=1;ci<=10;ci++)
21566
21567  // 4-p:
21568  for(Int_t ci=1;ci<=45;ci++)
21569  {
21570   if(7==ci||23==ci||26==ci||37==ci){continue;} // skipping the empty bins
21571   cout<<(f4pCorrelations->GetXaxis())->GetBinLabel(ci)<<":"<<endl;
21572   cout<<"from Q-vectors    = "<<f4pCorrelations->GetBinContent(ci)<<endl; 
21573   cout<<"from nested loops = "<<fMixedHarmonicsNestedLoops->GetBinContent(ci+6+10)<<endl;
21574   //if(TMath::Abs(f4pCorrelations->GetBinContent(ci)-fMixedHarmonicsNestedLoops->GetBinContent(ci+6+10))
21575   //   > 1.e-10){exit(0);}
21576   cout<<endl;
21577  } // end of for(Int_t ci=1;ci<=45;ci++)
21578
21579  for(Int_t ci=1;ci<=87;ci++)
21580  {
21581   if(31==ci||41==ci||72==ci||84==ci){continue;} // skipping the empty bins
21582   cout<<(f5pCorrelations->GetXaxis())->GetBinLabel(ci)<<":"<<endl;
21583   cout<<"from Q-vectors    = "<<f5pCorrelations->GetBinContent(ci)<<endl; 
21584   cout<<"from nested loops = "<<fMixedHarmonicsNestedLoops->GetBinContent(ci+6+10+45)<<endl;
21585   if(TMath::Abs(f5pCorrelations->GetBinContent(ci)-fMixedHarmonicsNestedLoops->GetBinContent(ci+6+10+45))
21586      > 1.e-10){exit(0);}
21587   cout<<endl;
21588  } // end of for(Int_t ci=1;ci<=87;ci++)
21589
21590  return;
21591
21592 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowCorrelations()
21593
21594 //=======================================================================================================================
21595
21596 void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowCorrectionTermsForNUA()
21597 {
21598  // Cross-check results for corrections terms for non-uniform acceptance needed for int. flow: results from Q-vectors vs results from nested loops.
21599
21600  cout<<endl;
21601  cout<<endl;
21602  cout<<"   *********************************************"<<endl;
21603  cout<<"   **** cross-checking the correction terms ****"<<endl;
21604  cout<<"   **** for non-uniform acceptance relevant ****"<<endl;
21605  cout<<"   ****         for integrated flow         ****"<<endl;
21606  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
21607  {
21608   cout<<"   ****     (particle weights not used)     ****"<<endl;
21609  } else
21610    {
21611     cout<<"   ****       (particle weights used)       ****"<<endl;
21612    } 
21613  cout<<"   *********************************************"<<endl;
21614  cout<<endl;
21615  cout<<endl;
21616
21617  for(Int_t ci=1;ci<=4;ci++) // correction term index (to be improved - hardwired 4)
21618  {
21619   for(Int_t sc=0;sc<2;sc++) // sin or cos term
21620   {
21621    if(strcmp((fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->GetBinLabel(ci), "") == 0) continue; // to be improved (access finalized histogram here)
21622    cout<<(fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->GetBinLabel(ci)<<":"<<endl; // to be improved (access finalized histogram here)
21623    cout<<"from Q-vectors    = "<<fIntFlowCorrectionTermsForNUAPro[sc]->GetBinContent(ci)<<endl; // to be improved (access finalized histogram here)
21624    cout<<"from nested loops = "<<fIntFlowDirectCorrectionTermsForNUA[sc]->GetBinContent(ci)<<endl;
21625    cout<<endl;
21626   } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos term
21627  } // end of for(Int_t ci=1;ci<=10;ci++) // correction term index
21628   
21629 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowCorrectionTermsForNUA() 
21630
21631 //=======================================================================================================================
21632
21633 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrelationsWithNestedLoopsUsingParticleWeights(AliFlowEventSimple * const anEvent)
21634 {
21635  // Evaluate with nested loops multiparticle correlations for integrated flow (using the particle weights). 
21636
21637  // Results are stored in profile fIntFlowDirectCorrelations. 
21638  // Remark 1: When particle weights are used the binning of fIntFlowDirectCorrelations is organized as follows:
21639  //
21640  //  1st bin: <2>_{1n|1n} = two1n1nW1W1 = <w1 w2 cos(n*(phi1-phi2))>
21641  //  2nd bin: <2>_{2n|2n} = two2n2nW2W2 = <w1^2 w2^2 cos(2n*(phi1-phi2))>
21642  //  3rd bin: <2>_{3n|3n} = two3n3nW3W3 = <w1^3 w2^3 cos(3n*(phi1-phi2))> 
21643  //  4th bin: <2>_{4n|4n} = two4n4nW4W4 = <w1^4 w2^4 cos(4n*(phi1-phi2))>
21644  //  5th bin:           ----  EMPTY ----
21645  //  6th bin: <3>_{2n|1n,1n} = three2n1n1nW2W1W1 = <w1^2 w2 w3 cos(n*(2phi1-phi2-phi3))>
21646  //  7th bin: <3>_{3n|2n,1n} = ...
21647  //  8th bin: <3>_{4n|2n,2n} = ...
21648  //  9th bin: <3>_{4n|3n,1n} = ...
21649  // 10th bin:           ----  EMPTY ----
21650  // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1nW1W1W1W1 = <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))>
21651  // 12th bin: <4>_{2n,1n|2n,1n} = ...
21652  // 13th bin: <4>_{2n,2n|2n,2n} = ...
21653  // 14th bin: <4>_{3n|1n,1n,1n} = ... 
21654  // 15th bin: <4>_{3n,1n|3n,1n} = ...
21655  // 16th bin: <4>_{3n,1n|2n,2n} = ...
21656  // 17th bin: <4>_{4n|2n,1n,1n} = ... 
21657  // 18th bin:           ----  EMPTY ----
21658  // 19th bin: <5>_{2n|1n,1n,1n,1n} = ...
21659  // 20th bin: <5>_{2n,2n|2n,1n,1n} = ...
21660  // 21st bin: <5>_{3n,1n|2n,1n,1n} = ...
21661  // 22nd bin: <5>_{4n|1n,1n,1n,1n} = ...
21662  // 23rd bin:           ----  EMPTY ----
21663  // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = ...
21664  // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = ...
21665  // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = ...
21666  // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = ...
21667  // 28th bin:           ----  EMPTY ----
21668  // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = ...
21669  // 30th bin:           ----  EMPTY ----
21670  // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = ...
21671  
21672  // Remark 2: When particle weights are used there are some extra correlations. They are stored in 
21673  // fIntFlowExtraDirectCorrelations binning of which is organized as follows:
21674  
21675  // 1st bin: two1n1nW3W1 = <w1^3 w2 cos(n*(phi1-phi2))>
21676  // 2nd bin: two1n1nW1W1W2 = <w1 w2 w3^2 cos(n*(phi1-phi2))>  
21677  // ...
21678  
21679  Int_t nPrim = anEvent->NumberOfTracks(); 
21680  AliFlowTrackSimple *aftsTrack = NULL;
21681  //Double_t phi1=0., phi2=0., phi3=0., phi4=0., phi5=0., phi6=0., phi7=0., phi8=0.;
21682  //Double_t wPhi1=1., wPhi2=1., wPhi3=1., wPhi4=1., wPhi5=1., wPhi6=1., wPhi7=1., wPhi8=1.;
21683  Double_t phi1=0., phi2=0., phi3=0., phi4=0.;
21684  Double_t wPhi1=1., wPhi2=1., wPhi3=1., wPhi4=1.;
21685  Int_t n = fHarmonic; 
21686  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // to be improved (is this casting safe in general?)
21687  Double_t dMult = (*fSpk)(0,0);
21688  cout<<endl;
21689  cout<<"Multiparticle correlations: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
21690  if(dMult<2)
21691  {
21692   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
21693  } else if (dMult>fMaxAllowedMultiplicity)
21694    {
21695     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
21696    } else 
21697      { 
21698       cout<<"... evaluating nested loops (using particle weights) ..."<<endl;
21699      } 
21700       
21701  // 2-particle correlations:       
21702  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
21703  {
21704   // 2 nested loops multiparticle correlations using particle weights:       
21705   for(Int_t i1=0;i1<nPrim;i1++)
21706   {
21707    aftsTrack=anEvent->GetTrack(i1);
21708    if(!(aftsTrack->InRPSelection())) continue;
21709    phi1=aftsTrack->Phi();
21710    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
21711    for(Int_t i2=0;i2<nPrim;i2++)
21712    {
21713     if(i2==i1)continue;
21714     aftsTrack=anEvent->GetTrack(i2);
21715     if(!(aftsTrack->InRPSelection())) continue;
21716     phi2=aftsTrack->Phi();
21717     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));   
21718     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
21719     // 2-p correlations using particle weights:
21720     if(fUsePhiWeights) fIntFlowDirectCorrelations->Fill(0.5,cos(n*(phi1-phi2)),wPhi1*wPhi2);                  // <w1   w2   cos( n*(phi1-phi2))>
21721     if(fUsePhiWeights) fIntFlowDirectCorrelations->Fill(1.5,cos(2.*n*(phi1-phi2)),pow(wPhi1,2)*pow(wPhi2,2)); // <w1^2 w2^2 cos(2n*(phi1-phi2))>
21722     if(fUsePhiWeights) fIntFlowDirectCorrelations->Fill(2.5,cos(3.*n*(phi1-phi2)),pow(wPhi1,3)*pow(wPhi2,3)); // <w1^3 w2^3 cos(3n*(phi1-phi2))>
21723     if(fUsePhiWeights) fIntFlowDirectCorrelations->Fill(3.5,cos(4.*n*(phi1-phi2)),pow(wPhi1,4)*pow(wPhi2,4)); // <w1^4 w2^4 cos(4n*(phi1-phi2))> 
21724     // extra correlations: 
21725     // 2-p extra correlations (do not appear if particle weights are not used):
21726     if(fUsePhiWeights) fIntFlowExtraDirectCorrelations->Fill(0.5,cos(n*(phi1-phi2)),pow(wPhi1,3)*wPhi2); // <w1^3 w2 cos(n*(phi1-phi2))>
21727     // ...
21728    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21729   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21730  } // end of if(nPrim>=2)
21731
21732  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
21733  { 
21734   // 3 nested loops multiparticle correlations using particle weights:       
21735   for(Int_t i1=0;i1<nPrim;i1++)
21736   {
21737    aftsTrack=anEvent->GetTrack(i1);
21738    if(!(aftsTrack->InRPSelection())) continue;
21739    phi1=aftsTrack->Phi();
21740    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
21741    for(Int_t i2=0;i2<nPrim;i2++)
21742    {
21743     if(i2==i1)continue;
21744     aftsTrack=anEvent->GetTrack(i2);
21745     if(!(aftsTrack->InRPSelection())) continue;
21746     phi2=aftsTrack->Phi();
21747     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
21748     for(Int_t i3=0;i3<nPrim;i3++)
21749     {
21750      if(i3==i1||i3==i2)continue;
21751      aftsTrack=anEvent->GetTrack(i3);
21752      if(!(aftsTrack->InRPSelection())) continue;
21753      phi3=aftsTrack->Phi();
21754      if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
21755      if(nPrim==3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush;
21756      // 3-p correlations using particle weights:
21757      if(fUsePhiWeights) fIntFlowDirectCorrelations->Fill(5.5,cos(2.*n*phi1-n*(phi2+phi3)),pow(wPhi1,2)*wPhi2*wPhi3); // <w1^2 w2 w3 cos(n*(2phi1-phi2-phi3))>
21758      // ...
21759      // extra correlations: 
21760      // 2-p extra correlations (do not appear if particle weights are not used):
21761       if(fUsePhiWeights) fIntFlowExtraDirectCorrelations->Fill(1.5,cos(n*(phi1-phi2)),wPhi1*wPhi2*pow(wPhi3,2)); // <w1 w2 w3^2 cos(n*(phi1-phi2))>
21762      // ...
21763      // 3-p extra correlations (do not appear if particle weights are not used):
21764      // ...
21765     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21766    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21767   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21768  } // end of if(nPrim>=3)
21769  
21770  if(nPrim>=4 && nPrim<=fMaxAllowedMultiplicity)
21771  {
21772   // 4 nested loops multiparticle correlations using particle weights:       
21773   for(Int_t i1=0;i1<nPrim;i1++)
21774   {
21775    aftsTrack=anEvent->GetTrack(i1);
21776    if(!(aftsTrack->InRPSelection())) continue;
21777    phi1=aftsTrack->Phi();
21778    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
21779    for(Int_t i2=0;i2<nPrim;i2++)
21780    {
21781     if(i2==i1)continue;
21782     aftsTrack=anEvent->GetTrack(i2);
21783     if(!(aftsTrack->InRPSelection())) continue;
21784     phi2=aftsTrack->Phi();
21785     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
21786     for(Int_t i3=0;i3<nPrim;i3++)
21787     {
21788      if(i3==i1||i3==i2)continue;
21789      aftsTrack=anEvent->GetTrack(i3);
21790      if(!(aftsTrack->InRPSelection())) continue;
21791      phi3=aftsTrack->Phi();
21792      if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
21793      for(Int_t i4=0;i4<nPrim;i4++)
21794      {
21795       if(i4==i1||i4==i2||i4==i3)continue;
21796       aftsTrack=anEvent->GetTrack(i4);
21797       if(!(aftsTrack->InRPSelection())) continue;
21798       phi4=aftsTrack->Phi();
21799       if(fUsePhiWeights && fPhiWeights) wPhi4 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi4*fnBinsPhi/TMath::TwoPi())));
21800       if(nPrim>=4) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<"\r"<<flush; // to be improved (replace eventually this if statement with if(nPrim==4))
21801       // 4-p correlations using particle weights:
21802       if(fUsePhiWeights) fIntFlowDirectCorrelations->Fill(10.5,cos(n*phi1+n*phi2-n*phi3-n*phi4),wPhi1*wPhi2*wPhi3*wPhi4); 
21803       // extra correlations: 
21804       // 2-p extra correlations (do not appear if particle weights are not used):
21805       // ...
21806       // 3-p extra correlations (do not appear if particle weights are not used):
21807       // ...
21808       // 4-p extra correlations (do not appear if particle weights are not used):
21809       // ...
21810      } // end of for(Int_t i4=0;i4<nPrim;i4++) 
21811     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21812    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21813   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21814  } // end of if(nPrim>=4)
21815
21816  cout<<endl; 
21817
21818 } // end of void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrelationsWithNestedLoopsUsingParticleWeights(AliFlowEventSimple* anEvent)
21819
21820 //=======================================================================================================================
21821
21822 void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowExtraCorrelations()
21823 {
21824  // Cross-check results for extra multiparticle correlations needed for int. flow 
21825  // which appear only when particle weights are used: results from Q-vectors vs results from nested loops.
21826
21827  cout<<endl;
21828  cout<<endl;
21829  cout<<"   ***********************************************"<<endl;
21830  cout<<"   **** cross-checking the extra correlations ****"<<endl;
21831  cout<<"   ****          for integrated flow          ****"<<endl;
21832  cout<<"   ***********************************************"<<endl;
21833  cout<<endl;
21834  cout<<endl;
21835  
21836  for(Int_t eci=1;eci<=2;eci++) // to be improved (increased eciMax eventually when I calculate 6th and 8th)
21837  {
21838   if(strcmp((fIntFlowExtraCorrelationsPro->GetXaxis())->GetBinLabel(eci), "") == 0) continue;
21839   cout<<(fIntFlowExtraCorrelationsPro->GetXaxis())->GetBinLabel(eci)<<":"<<endl;
21840   cout<<"from Q-vectors    = "<<fIntFlowExtraCorrelationsPro->GetBinContent(eci)<<endl;
21841   cout<<"from nested loops = "<<fIntFlowExtraDirectCorrelations->GetBinContent(eci)<<endl;
21842   cout<<endl;
21843  }
21844
21845 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowExtraCorrelations()
21846
21847 //=======================================================================================================================
21848
21849 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrectionsForNUAWithNestedLoops(AliFlowEventSimple * const anEvent)
21850 {
21851  // Evaluate with nested loops correction terms for non-uniform acceptance relevant for NONAME integrated flow (to be improved (name)).
21852  //
21853  // Remark: Both sin and cos correction terms are calculated in this method. Sin terms are stored in fIntFlowDirectCorrectionTermsForNUA[0],
21854  // and cos terms in fIntFlowDirectCorrectionTermsForNUA[1]. Binning of fIntFlowDirectCorrectionTermsForNUA[sc] is organized as follows 
21855  // (sc stands for either sin or cos):
21856  
21857  //  1st bin: <<sc(n*(phi1))>> 
21858  //  2nd bin: <<sc(n*(phi1+phi2))>> 
21859  //  3rd bin: <<sc(n*(phi1-phi2-phi3))>>
21860  //  4th bin: <<sc(n*(2phi1-phi2))>>
21861  
21862  Int_t nPrim = anEvent->NumberOfTracks(); 
21863  AliFlowTrackSimple *aftsTrack = NULL;
21864  Double_t phi1=0., phi2=0., phi3=0.;
21865  Int_t n = fHarmonic; 
21866  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // to be improved (is this casting safe in general?)
21867  Double_t dMult = (*fSpk)(0,0);
21868  cout<<endl;
21869  cout<<"Correction terms for non-uniform acceptance: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
21870  if(dMult<1)
21871  {
21872   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
21873  } else if (dMult>fMaxAllowedMultiplicity)
21874    {
21875     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
21876    } else 
21877      { 
21878       cout<<"... evaluating nested loops (without using particle weights)..."<<endl;
21879      }
21880  
21881  if(nPrim>=1 && nPrim<=fMaxAllowedMultiplicity)
21882  {
21883   // 1-particle correction terms for non-uniform acceptance:       
21884   for(Int_t i1=0;i1<nPrim;i1++)
21885   {
21886    aftsTrack=anEvent->GetTrack(i1);
21887    if(!(aftsTrack->InRPSelection())) continue;
21888    phi1=aftsTrack->Phi();
21889    if(nPrim==1) cout<<i1<<"\r"<<flush;
21890    // sin terms:
21891    fIntFlowDirectCorrectionTermsForNUA[0]->Fill(0.5,sin(n*phi1),1.); // <sin(n*phi1)>  
21892    // cos terms:
21893    fIntFlowDirectCorrectionTermsForNUA[1]->Fill(0.5,cos(n*phi1),1.); // <cos(n*phi1)>
21894   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21895  } // end of if(nPrim>=1) 
21896   
21897  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
21898  {
21899   // 2-particle correction terms for non-uniform acceptance:       
21900   for(Int_t i1=0;i1<nPrim;i1++)
21901   {
21902    aftsTrack=anEvent->GetTrack(i1);
21903    if(!(aftsTrack->InRPSelection())) continue;
21904    phi1=aftsTrack->Phi();  
21905    for(Int_t i2=0;i2<nPrim;i2++)
21906    {
21907     if(i2==i1)continue;
21908     aftsTrack=anEvent->GetTrack(i2);
21909     if(!(aftsTrack->InRPSelection())) continue;
21910     phi2=aftsTrack->Phi();
21911     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
21912     // sin terms:
21913     fIntFlowDirectCorrectionTermsForNUA[0]->Fill(1.5,sin(n*(phi1+phi2)),1.); // <<sin(n*(phi1+phi2))>>
21914     fIntFlowDirectCorrectionTermsForNUA[0]->Fill(3.5,sin(n*(2*phi1-phi2)),1.); // <<sin(n*(2*phi1-phi2))>>
21915     // cos terms:
21916     fIntFlowDirectCorrectionTermsForNUA[1]->Fill(1.5,cos(n*(phi1+phi2)),1.); // <<cos(n*(phi1+phi2))>>
21917     fIntFlowDirectCorrectionTermsForNUA[1]->Fill(3.5,cos(n*(2*phi1-phi2)),1.); // <<cos(n*(2*phi1-phi2))>>
21918    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21919   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21920  } // end of if(nPrim>=2)
21921
21922  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
21923  {
21924   // 3-particle correction terms for non-uniform acceptance:       
21925   for(Int_t i1=0;i1<nPrim;i1++)
21926   {
21927    aftsTrack=anEvent->GetTrack(i1);
21928    if(!(aftsTrack->InRPSelection())) continue;
21929    phi1=aftsTrack->Phi();
21930    for(Int_t i2=0;i2<nPrim;i2++)
21931    {
21932     if(i2==i1)continue;
21933     aftsTrack=anEvent->GetTrack(i2);
21934     if(!(aftsTrack->InRPSelection())) continue;
21935     phi2=aftsTrack->Phi();
21936     for(Int_t i3=0;i3<nPrim;i3++)
21937     {
21938      if(i3==i1||i3==i2)continue;
21939      aftsTrack=anEvent->GetTrack(i3);
21940      if(!(aftsTrack->InRPSelection())) continue;
21941      phi3=aftsTrack->Phi();
21942      if(nPrim>=3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush; // to be improved (eventually I will change this if statement)
21943      // sin terms:
21944      fIntFlowDirectCorrectionTermsForNUA[0]->Fill(2.5,sin(n*(phi1-phi2-phi3)),1.); // <<sin(n*(phi1-phi2-phi3))>>
21945      // cos terms:
21946      fIntFlowDirectCorrectionTermsForNUA[1]->Fill(2.5,cos(n*(phi1-phi2-phi3)),1.); // <<cos(n*(phi1-phi2-phi3))>>
21947     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21948    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21949   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21950  } // end of if(nPrim>=3)
21951
21952  cout<<endl;
21953 }
21954
21955 //=======================================================================================================================
21956
21957 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrelationsWithNestedLoops(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
21958 {
21959  // Evaluate reduced correlations with nested loops without using the particle weights.
21960  
21961  // Remark 1: Reduced correlations are evaluated in pt bin number fCrossCheckInPtBinNo and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
21962  // Remark 2: Results are stored in 1 bin profiles fDiffFlowDirectCorrelations[t][pe][ci], where indices runs as follows:
21963  //           [0=RP,1=POI][0=Pt,1=Eta][0=<2'>,1=<4'>,2=<6'>,3=<8'>] 
21964  // Remark 3: <2'> = <cos(n*(psi1-phi2))>
21965  //           <4'> = <cos(n*(psi1+phi2-phi3-phi4))>
21966  // ...
21967  
21968  Int_t typeFlag = 0;
21969  Int_t ptEtaFlag = 0;
21970  if(type == "RP")
21971  {
21972   typeFlag = 0;
21973  } else if(type == "POI")
21974    {
21975     typeFlag = 1;
21976    }      
21977  if(ptOrEta == "Pt")
21978  {
21979   ptEtaFlag = 0;
21980  } else if(ptOrEta == "Eta")
21981    {
21982     ptEtaFlag = 1;
21983    } 
21984  // shortcuts:
21985  Int_t t = typeFlag;
21986  Int_t pe = ptEtaFlag;
21987       
21988  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
21989  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
21990  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
21991  
21992  Int_t nPrim = anEvent->NumberOfTracks(); 
21993  AliFlowTrackSimple *aftsTrack = NULL;
21994  
21995  Double_t psi1=0., phi2=0., phi3=0., phi4=0.;// phi5=0., phi6=0., phi7=0., phi8=0.;
21996  
21997  Int_t n = fHarmonic; 
21998   
21999  // 2'-particle correlations:
22000  for(Int_t i1=0;i1<nPrim;i1++)
22001  {
22002   aftsTrack=anEvent->GetTrack(i1);
22003   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22004   if(typeFlag==1) // this is diff flow of POIs 
22005   {
22006    if(ptOrEta == "Pt")
22007    { 
22008     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22009    } else if (ptOrEta == "Eta")
22010      {
22011       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22012      }
22013   } else // this is diff flow of RPs 
22014     {
22015      if(ptOrEta == "Pt")
22016      { 
22017       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22018      } else if (ptOrEta == "Eta")
22019        {
22020         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22021        }
22022     }
22023        
22024   psi1=aftsTrack->Phi(); 
22025   for(Int_t i2=0;i2<nPrim;i2++)
22026   {
22027    if(i2==i1)continue;
22028    aftsTrack=anEvent->GetTrack(i2);
22029    // RP condition (!(first) particle in the correlator must be RP):
22030    if(!(aftsTrack->InRPSelection()))continue;
22031    phi2=aftsTrack->Phi();   
22032    // 2'-particle correlations: 
22033    fDiffFlowDirectCorrelations[t][pe][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(1.*n*(psi1-phi2)),1.); // <cos(n*(psi1-phi2))  
22034   }//end of for(Int_t i2=0;i2<nPrim;i2++)
22035  }//end of for(Int_t i1=0;i1<nPrim;i1++)
22036  
22037  /*
22038  
22039  // 3'-particle correlations:
22040  for(Int_t i1=0;i1<nPrim;i1++)
22041  {
22042   aftsTrack=anEvent->GetTrack(i1);
22043   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22044   if(ptOrEta == "Pt")
22045   { 
22046    if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22047   } else if (ptOrEta == "Eta")
22048     {
22049      if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22050     }
22051   psi1=aftsTrack->Phi();
22052   for(Int_t i2=0;i2<nPrim;i2++)
22053   {
22054    if(i2==i1)continue;
22055    aftsTrack=anEvent->GetTrack(i2);
22056    // RP condition (!(first) particle in the correlator must be RP):
22057    if(!(aftsTrack->InRPSelection())) continue;
22058    phi2=aftsTrack->Phi();
22059    for(Int_t i3=0;i3<nPrim;i3++)
22060    {
22061     if(i3==i1||i3==i2)continue;
22062     aftsTrack=anEvent->GetTrack(i3);
22063     // RP condition (!(first) particle in the correlator must be RP):
22064     if(!(aftsTrack->InRPSelection())) continue;
22065     phi3=aftsTrack->Phi();
22066     // to be improved : where to store it? ->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(2.*phi1-phi2-phi3)),1.); // <w1 w2 w3 cos(n(2psi1-phi2-phi3))> 
22067    }//end of for(Int_t i3=0;i3<nPrim;i3++)  
22068   }//end of for(Int_t i2=0;i2<nPrim;i2++)  
22069  }//end of for(Int_t i1=0;i1<nPrim;i1++)
22070  
22071  */
22072  
22073  // 4'-particle correlations:
22074  for(Int_t i1=0;i1<nPrim;i1++)
22075  {
22076   aftsTrack=anEvent->GetTrack(i1);
22077   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22078   if(typeFlag==1) // this is diff flow of POIs 
22079   {
22080    if(ptOrEta == "Pt")
22081    { 
22082     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22083    } else if (ptOrEta == "Eta")
22084      {
22085       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22086      }
22087   } else // this is diff flow of RPs 
22088     {
22089      if(ptOrEta == "Pt")
22090      { 
22091       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22092      } else if (ptOrEta == "Eta")
22093        {
22094         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22095        }
22096     }
22097     
22098   psi1=aftsTrack->Phi();
22099   for(Int_t i2=0;i2<nPrim;i2++)
22100   {
22101    if(i2==i1) continue;
22102    aftsTrack=anEvent->GetTrack(i2);
22103    // RP condition (!(first) particle in the correlator must be RP): 
22104    if(!(aftsTrack->InRPSelection())) continue;
22105    phi2=aftsTrack->Phi();
22106    for(Int_t i3=0;i3<nPrim;i3++)
22107    { 
22108     if(i3==i1||i3==i2) continue;
22109     aftsTrack=anEvent->GetTrack(i3);
22110     // RP condition (!(first) particle in the correlator must be RP):
22111     if(!(aftsTrack->InRPSelection())) continue;
22112     phi3=aftsTrack->Phi();
22113     for(Int_t i4=0;i4<nPrim;i4++)
22114     {
22115      if(i4==i1||i4==i2||i4==i3) continue;
22116      aftsTrack=anEvent->GetTrack(i4);
22117      // RP condition (!(first) particle in the correlator must be RP):
22118      if(!(aftsTrack->InRPSelection())) continue;  
22119      phi4=aftsTrack->Phi();
22120      // 4'-particle correlations:
22121      fDiffFlowDirectCorrelations[t][pe][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2-phi3-phi4)),1.); // <cos(n(psi1+phi2-phi3-phi4))>     
22122     }//end of for(Int_t i4=0;i4<nPrim;i4++)
22123    }//end of for(Int_t i3=0;i3<nPrim;i3++)
22124   }//end of for(Int_t i2=0;i2<nPrim;i2++) 
22125  }//end of for(Int_t i1=0;i1<nPrim;i1++)
22126       
22127  // count # of RPs and POIs in selected pt and eta bins for cross-checkings:
22128  for(Int_t i=0;i<nPrim;i++)
22129  {
22130   aftsTrack=anEvent->GetTrack(i); 
22131   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22132   if(typeFlag==1) // this is diff flow of POIs 
22133   {
22134    if(ptOrEta == "Pt")
22135    { 
22136     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22137    } else if (ptOrEta == "Eta")
22138      {
22139       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22140      }
22141   } else // this is diff flow of RPs 
22142     {
22143      if(ptOrEta == "Pt")
22144      { 
22145       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22146      } else if (ptOrEta == "Eta")
22147        {
22148         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22149        }
22150     }
22151   if(t==1)t++; 
22152   fNoOfParticlesInBin->Fill(t+pe+0.5);  
22153  }
22154
22155 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrelationsWithNestedLoops(AliFlowEventSimple* anEvent, TString type, TString ptOrEta)
22156
22157 //=======================================================================================================================
22158
22159 void AliFlowAnalysisWithQCumulants::EvaluateOtherDiffCorrelatorsWithNestedLoops(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
22160 {
22161  // Evaluate other differential correlators with nested loops without using the particle weights.
22162
22163  // Remark 1: Other differential correlators are evaluated in pt bin number fCrossCheckInPtBinNo 
22164  //           and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
22165  // Remark 2: Results are stored in 1 bin profiles fOtherDirectDiffCorrelators[t][pe][sc][ci], where indices runs as follows:
22166  //           [0=RP,1=POI][0=Pt,1=Eta][0=sin terms,1=cos terms][ci = correlator index] 
22167  // Remark 3: Correlator index 'ci' runs as follows:
22168  //            0: <exp(n*(psi1-3phi2+2phi3))> (Teaney-Yan correlator)
22169   
22170  Int_t typeFlag = 0;
22171  Int_t ptEtaFlag = 0;
22172  if(type == "RP")
22173  {
22174   typeFlag = 0;
22175  } else if(type == "POI")
22176    {
22177     typeFlag = 1;
22178    }      
22179  if(ptOrEta == "Pt")
22180  {
22181   ptEtaFlag = 0;
22182  } else if(ptOrEta == "Eta")
22183    {
22184     ptEtaFlag = 1;
22185    } 
22186  // shortcuts:
22187  Int_t t = typeFlag;
22188  Int_t pe = ptEtaFlag;
22189       
22190  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
22191  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
22192  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
22193  
22194  Int_t nPrim = anEvent->NumberOfTracks(); 
22195  AliFlowTrackSimple *aftsTrack = NULL;
22196  
22197  Double_t psi1=0., phi2=0., phi3=0.;
22198  
22199  Int_t n = fHarmonic; 
22200
22201  // 3-p correlators:
22202  for(Int_t i1=0;i1<nPrim;i1++)
22203  {
22204   aftsTrack=anEvent->GetTrack(i1);
22205   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22206   if(typeFlag==1) // this is diff flow of POIs 
22207   {
22208    if(ptOrEta == "Pt")
22209    { 
22210     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22211    } else if (ptOrEta == "Eta")
22212      {
22213       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22214      }
22215   } else // this is diff flow of RPs 
22216     {
22217      if(ptOrEta == "Pt")
22218      { 
22219       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22220      } else if (ptOrEta == "Eta")
22221        {
22222         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22223        }
22224     }
22225   psi1=aftsTrack->Phi();
22226   for(Int_t i2=0;i2<nPrim;i2++)
22227   {
22228    if(i2==i1) continue;
22229    aftsTrack=anEvent->GetTrack(i2);
22230    // RP condition (!(first) particle in the correlator must be RP): 
22231    if(!(aftsTrack->InRPSelection())) continue;
22232    phi2=aftsTrack->Phi();
22233    for(Int_t i3=0;i3<nPrim;i3++)
22234    { 
22235     if(i3==i1||i3==i2) continue;
22236     aftsTrack=anEvent->GetTrack(i3);
22237     // RP condition (!(first) particle in the correlator must be RP):
22238     if(!(aftsTrack->InRPSelection())) continue;
22239     phi3=aftsTrack->Phi();
22240     // Fill 3-p correlators:
22241     fOtherDirectDiffCorrelators[t][pe][1][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1-3.*phi2+2.*phi3)),1.); // <cos(n(psi1-3.*phi2+2.*phi3))>     
22242    }//end of for(Int_t i3=0;i3<nPrim;i3++)
22243   }//end of for(Int_t i2=0;i2<nPrim;i2++) 
22244  }//end of for(Int_t i1=0;i1<nPrim;i1++)   
22245 } // end of void AliFlowAnalysisWithQCumulants::EvaluateOtherDiffCorrelatorsWithNestedLoops(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
22246
22247 //=======================================================================================================================
22248
22249 void AliFlowAnalysisWithQCumulants::CrossCheckDiffFlowCorrelations(TString type, TString ptOrEta)
22250 {
22251  // Compare correlations needed for diff. flow calculated with nested loops and those calculated from Q-vectors
22252  
22253  Int_t typeFlag = 0;
22254  Int_t ptEtaFlag = 0;
22255  if(type == "RP")
22256  {
22257   typeFlag = 0;
22258  } else if(type == "POI")
22259    {
22260     typeFlag = 1;
22261    }      
22262  if(ptOrEta == "Pt")
22263  {
22264   ptEtaFlag = 0;
22265  } else if(ptOrEta == "Eta")
22266    {
22267     ptEtaFlag = 1;
22268    } 
22269  // shortcuts:
22270  Int_t t = typeFlag;
22271  Int_t pe = ptEtaFlag;
22272       
22273  TString rpORpoiString[2] = {"RP ","POI"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
22274  TString ptORetaString[2] = {"pt","eta"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
22275  TString reducedCorrelations[4] = {"<<cos(n(psi1-phi2))>>","<<cos(n(psi1+phi2-phi3-phi4))>>","",""}; // to be improved (access this from pro or hist)
22276  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
22277  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
22278  
22279  Int_t crossCheckInPtEtaBinNo[2] = {fCrossCheckInPtBinNo,fCrossCheckInEtaBinNo};
22280  
22281
22282  cout<<endl;
22283  cout<<"   *****************************************"<<endl;
22284  cout<<"   **** cross-checking the correlations ****"<<endl;
22285  cout<<"   ****   for differential flow ("<<rpORpoiString[t]<<")   ****"<<endl;
22286  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
22287  {
22288   cout<<"   ****   (particle weights not used)   ****"<<endl;
22289  } else
22290    {
22291     cout<<"   ****    (particle weights used)      ****"<<endl;
22292    } 
22293  cout<<"   *****************************************"<<endl; 
22294  cout<<endl;
22295  cout<<"           "<<ptORetaString[pe]<<" bin: "<<lowerPtEtaEdge[pe]<<" <= "<<ptORetaString[pe]<<" < "<<upperPtEtaEdge[pe]<<endl;
22296  cout<<endl;
22297  
22298  for(Int_t rci=0;rci<2;rci++) // to be improved (calculate 6th and 8th order)
22299  {
22300   cout<<"      "<<reducedCorrelations[rci].Data()<<":"<<endl;
22301   cout<<"      from Q-vectors    = "<<fDiffFlowCorrelationsPro[t][pe][rci]->GetBinContent(crossCheckInPtEtaBinNo[pe])<<endl;
22302   cout<<"      from nested loops = "<<fDiffFlowDirectCorrelations[t][pe][rci]->GetBinContent(1)<<endl;
22303   cout<<endl;  
22304  } // end of for(Int_t rci=0;rci<4;rci++)
22305         
22306 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckDiffFlowCorrelations(TString type, TString ptOrEta)
22307
22308 //=======================================================================================================================
22309
22310 void AliFlowAnalysisWithQCumulants::CrossCheckOtherDiffCorrelators(TString type, TString ptOrEta)
22311 {
22312  // Compare correlations needed for diff. flow calculated with nested loops and those calculated from Q-vectors
22313  
22314  Int_t typeFlag = 0;
22315  Int_t ptEtaFlag = 0;
22316  if(type == "RP")
22317  {
22318   typeFlag = 0;
22319  } else if(type == "POI")
22320    {
22321     typeFlag = 1;
22322    }      
22323  if(ptOrEta == "Pt")
22324  {
22325   ptEtaFlag = 0;
22326  } else if(ptOrEta == "Eta")
22327    {
22328     ptEtaFlag = 1;
22329    } 
22330  // shortcuts:
22331  Int_t t = typeFlag;
22332  Int_t pe = ptEtaFlag;
22333       
22334  TString rpORpoiString[2] = {"RP ","POI"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
22335  TString ptORetaString[2] = {"pt","eta"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
22336  TString otherCorrelators[1] = {"<<cos(n(psi1-3phi2+2phi3))>>"}; // to be improved (access this from pro or hist)
22337  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
22338  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
22339  
22340  Int_t crossCheckInPtEtaBinNo[2] = {fCrossCheckInPtBinNo,fCrossCheckInEtaBinNo};
22341
22342  cout<<endl;
22343  cout<<"   *****************************************"<<endl;
22344  cout<<"   ****   cross-checking the other      ****"<<endl;
22345  cout<<"   ****   diff. correlators ("<<rpORpoiString[t]<<")       ****"<<endl;
22346  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
22347  {
22348   cout<<"   ****   (particle weights not used)   ****"<<endl;
22349  } else
22350    {
22351     cout<<"   ****    (particle weights used)      ****"<<endl;
22352    } 
22353  cout<<"   *****************************************"<<endl; 
22354  cout<<endl;
22355  cout<<"           "<<ptORetaString[pe]<<" bin: "<<lowerPtEtaEdge[pe]<<" <= "<<ptORetaString[pe]<<" < "<<upperPtEtaEdge[pe]<<endl;
22356  cout<<endl;
22357  
22358  for(Int_t ci=0;ci<1;ci++) 
22359  {
22360   cout<<"      "<<otherCorrelators[ci].Data()<<":"<<endl;
22361   cout<<"      from Q-vectors    = "<<fOtherDiffCorrelators[t][pe][1][ci]->GetBinContent(crossCheckInPtEtaBinNo[pe])<<endl;
22362   cout<<"      from nested loops = "<<fOtherDirectDiffCorrelators[t][pe][1][ci]->GetBinContent(1)<<endl;
22363   cout<<endl;  
22364  } // end of for(Int_t ci=0;ci<1;ci++)
22365         
22366 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckOtherDiffCorrelators(TString type, TString ptOrEta)
22367
22368 //=======================================================================================================================
22369
22370 void AliFlowAnalysisWithQCumulants::PrintNumberOfParticlesInSelectedBin()
22371 {
22372  // Print on the screen number of RPs and POIs in selected pt and eta bin for cross checkings.
22373  
22374  cout<<endl;
22375  cout<<"Number of RPs in selected pt bin   = "<<fNoOfParticlesInBin->GetBinContent(1)<<endl;
22376  cout<<"Number of RPs in selected eta bin  = "<<fNoOfParticlesInBin->GetBinContent(2)<<endl;
22377  cout<<"Number of POIs in selected pt bin  = "<<fNoOfParticlesInBin->GetBinContent(3)<<endl;
22378  cout<<"Number of POIs in selected eta bin = "<<fNoOfParticlesInBin->GetBinContent(4)<<endl;
22379  
22380 } // end of void AliFlowAnalysisWithQCumulants::PrintNumberOfParticlesInSelectedBin()
22381
22382 //=======================================================================================================================
22383
22384 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
22385 {
22386  // Evaluate reduced correlations with nested loops without using the particle weights.
22387  
22388  // Remark 1: Reduced correlations are evaluated in pt bin number fCrossCheckInPtBinNo and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
22389  // Remark 2: Results are stored in 1 bin profiles fDiffFlowDirectCorrelations[t][pe][ci], where indices runs as follows:
22390  //           [0=RP,1=POI][0=Pt,1=Eta][0=<2'>,1=<4'>,2=<6'>,3=<8'>] 
22391  // Remark 3: <2'> = <w2 cos(n*(psi1-phi2))>
22392  //           <4'> = <w2 w3 w4 cos(n*(psi1+phi2-phi3-phi4))>
22393  // ...
22394   
22395  Int_t typeFlag = 0;
22396  Int_t ptEtaFlag = 0;
22397  if(type == "RP")
22398  {
22399   typeFlag = 0;
22400  } else if(type == "POI")
22401    {
22402     typeFlag = 1;
22403    }      
22404  if(ptOrEta == "Pt")
22405  {
22406   ptEtaFlag = 0;
22407  } else if(ptOrEta == "Eta")
22408    {
22409     ptEtaFlag = 1;
22410    } 
22411  // shortcuts:
22412  Int_t t = typeFlag;
22413  Int_t pe = ptEtaFlag;
22414       
22415  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
22416  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
22417  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
22418  
22419  Int_t nPrim = anEvent->NumberOfTracks(); 
22420  AliFlowTrackSimple *aftsTrack = NULL;
22421  
22422  Double_t psi1=0., phi2=0., phi3=0., phi4=0.;// phi5=0., phi6=0., phi7=0., phi8=0.;
22423  Double_t wPhi2=1., wPhi3=1., wPhi4=1.;// wPhi5=1., wPhi6=1., wPhi7=1., wPhi8=1.;
22424  
22425  Int_t n = fHarmonic; 
22426  
22427  // 2'-particle correlations:
22428  for(Int_t i1=0;i1<nPrim;i1++)
22429  {
22430   aftsTrack=anEvent->GetTrack(i1);
22431   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22432   if(typeFlag==1) // this is diff flow of POIs 
22433   {
22434    if(ptOrEta == "Pt")
22435    { 
22436     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22437    } else if (ptOrEta == "Eta")
22438      {
22439       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22440      }
22441   } else // this is diff flow of RPs 
22442     {
22443      if(ptOrEta == "Pt")
22444      { 
22445       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22446      } else if (ptOrEta == "Eta")
22447        {
22448         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22449        }
22450     }
22451   psi1=aftsTrack->Phi(); 
22452   for(Int_t i2=0;i2<nPrim;i2++)
22453   {
22454    if(i2==i1) continue;
22455    aftsTrack=anEvent->GetTrack(i2);
22456    // RP condition (!(first) particle in the correlator must be RP):
22457    if(!(aftsTrack->InRPSelection())) continue;
22458    phi2=aftsTrack->Phi();   
22459    if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
22460    // 2'-particle correlations: 
22461    fDiffFlowDirectCorrelations[t][pe][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(1.*n*(psi1-phi2)),wPhi2); // <w2 cos(n*(psi1-phi2))  
22462   }//end of for(Int_t i2=0;i2<nPrim;i2++)
22463  }//end of for(Int_t i1=0;i1<nPrim;i1++)
22464  
22465  // 4'-particle correlations:
22466  for(Int_t i1=0;i1<nPrim;i1++)
22467  {
22468   aftsTrack=anEvent->GetTrack(i1);
22469   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22470   if(typeFlag==1) // this is diff flow of POIs 
22471   {
22472    if(ptOrEta == "Pt")
22473    { 
22474     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22475    } else if (ptOrEta == "Eta")
22476      {
22477       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22478      }
22479   } else // this is diff flow of RPs 
22480     {
22481      if(ptOrEta == "Pt")
22482      { 
22483       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22484      } else if (ptOrEta == "Eta")
22485        {
22486         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22487        }
22488     }
22489   psi1=aftsTrack->Phi();
22490   for(Int_t i2=0;i2<nPrim;i2++)
22491   {
22492    if(i2==i1) continue;
22493    aftsTrack=anEvent->GetTrack(i2);
22494    // RP condition (!(first) particle in the correlator must be RP): 
22495    if(!(aftsTrack->InRPSelection())) continue;
22496    phi2=aftsTrack->Phi();
22497    if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
22498    for(Int_t i3=0;i3<nPrim;i3++)
22499    { 
22500     if(i3==i1||i3==i2) continue;
22501     aftsTrack=anEvent->GetTrack(i3);
22502     // RP condition (!(first) particle in the correlator must be RP):
22503     if(!(aftsTrack->InRPSelection())) continue;
22504     phi3=aftsTrack->Phi();
22505     if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
22506     for(Int_t i4=0;i4<nPrim;i4++)
22507     {
22508      if(i4==i1||i4==i2||i4==i3) continue;
22509      aftsTrack=anEvent->GetTrack(i4);
22510      // RP condition (!(first) particle in the correlator must be RP):
22511      if(!(aftsTrack->InRPSelection())) continue;  
22512      phi4=aftsTrack->Phi();
22513      if(fUsePhiWeights && fPhiWeights) wPhi4 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi4*fnBinsPhi/TMath::TwoPi())));
22514      // 4'-particle correlations <w2 w3 w4 cos(n(psi1+phi2-phi3-phi4))>:
22515      fDiffFlowDirectCorrelations[t][pe][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2-phi3-phi4)),wPhi2*wPhi3*wPhi4); 
22516     }//end of for(Int_t i4=0;i4<nPrim;i4++)
22517    }//end of for(Int_t i3=0;i3<nPrim;i3++)
22518   }//end of for(Int_t i2=0;i2<nPrim;i2++) 
22519  }//end of for(Int_t i1=0;i1<nPrim;i1++)      
22520  
22521  // count # of RPs and POIs in selected pt and eta bins for cross-checkings: (to be improved - moved to dedicated method)
22522  for(Int_t i=0;i<nPrim;i++)
22523  {
22524   aftsTrack=anEvent->GetTrack(i); 
22525   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22526   if(typeFlag==1) // this is diff flow of POIs 
22527   {
22528    if(ptOrEta == "Pt")
22529    { 
22530     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22531    } else if (ptOrEta == "Eta")
22532      {
22533       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22534      }
22535   } else // this is diff flow of RPs 
22536     {
22537      if(ptOrEta == "Pt")
22538      { 
22539       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22540      } else if (ptOrEta == "Eta")
22541        {
22542         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22543        }
22544     }
22545   if(t==1)t++; 
22546   fNoOfParticlesInBin->Fill(t+pe+0.5);  
22547  }
22548  
22549 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(AliFlowEventSimple* anEvent, TString type, TString ptOrEta)
22550
22551 //=======================================================================================================================
22552
22553 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
22554 {
22555  // Evaluate with nested loops correction terms for non-uniform acceptance (both sin and cos terms) relevant for differential flow.
22556  
22557  // Remark 1: Reduced correction terms for non-uniform acceptance are evaluated in pt bin number fCrossCheckInPtBinNo 
22558  //           and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
22559  // Remark 2: Results are stored in 1 bin profiles fDiffFlowDirectCorrections[t][pe][sc][cti], where first three indices runs as: 
22560  //           [0=RP,1=POI][0=Pt,1=Eta][0=sin terms,1=cos terms], whilst the cti (correction term index) runs as follows: 
22561  //  cti: 
22562  //    0: <<sc n(psi1)>>
22563  //    1: <<sc n(psi1+phi2)>> 
22564  //    2: <<sc n(psi1+phi2-phi3)>>
22565  //    3: <<sc n(psi1-phi2-phi3)>>
22566  //    4:
22567  //    5:
22568  //    6:
22569   
22570  Int_t typeFlag = 0;
22571  Int_t ptEtaFlag = 0;
22572  if(type == "RP")
22573  {
22574   typeFlag = 0;
22575  } else if(type == "POI")
22576    {
22577     typeFlag = 1;
22578    }      
22579  if(ptOrEta == "Pt")
22580  {
22581   ptEtaFlag = 0;
22582  } else if(ptOrEta == "Eta")
22583    {
22584     ptEtaFlag = 1;
22585    } 
22586  // shortcuts:
22587  Int_t t = typeFlag;
22588  Int_t pe = ptEtaFlag;
22589       
22590  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
22591  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
22592  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
22593  
22594  Int_t nPrim = anEvent->NumberOfTracks(); 
22595  AliFlowTrackSimple *aftsTrack = NULL;
22596  
22597  Double_t psi1=0., phi2=0., phi3=0.;// phi4=0.;// phi5=0., phi6=0., phi7=0., phi8=0.;
22598  
22599  Int_t n = fHarmonic; 
22600  
22601  // 1-particle correction terms:
22602  for(Int_t i1=0;i1<nPrim;i1++)
22603  {
22604   aftsTrack=anEvent->GetTrack(i1);
22605   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22606   if(typeFlag==1) // this is diff flow of POIs 
22607   {
22608    if(ptOrEta == "Pt")
22609    { 
22610     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22611    } else if (ptOrEta == "Eta")
22612      {
22613       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22614      }
22615   } else // this is diff flow of RPs 
22616     {
22617      if(ptOrEta == "Pt")
22618      { 
22619       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22620      } else if (ptOrEta == "Eta")
22621        {
22622         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22623        }
22624     }
22625   psi1=aftsTrack->Phi(); 
22626   // sin terms: 
22627   fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*psi1),1.); // <<sin(n*(psi1))>>  
22628   // cos terms: 
22629   fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*psi1),1.); // <<cos(n*(psi1))>>  
22630  }//end of for(Int_t i1=0;i1<nPrim;i1++)
22631    
22632  // 2-particle correction terms:
22633  for(Int_t i1=0;i1<nPrim;i1++)
22634  {
22635   aftsTrack=anEvent->GetTrack(i1);
22636    // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22637   if(typeFlag==1) // this is diff flow of POIs 
22638   {
22639    if(ptOrEta == "Pt")
22640    { 
22641     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22642    } else if (ptOrEta == "Eta")
22643      {
22644       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22645      }
22646   } else // this is diff flow of RPs 
22647     {
22648      if(ptOrEta == "Pt")
22649      { 
22650       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22651      } else if (ptOrEta == "Eta")
22652        {
22653         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22654        }
22655     }
22656   psi1=aftsTrack->Phi(); 
22657   for(Int_t i2=0;i2<nPrim;i2++)
22658   {
22659    if(i2==i1) continue;
22660    aftsTrack=anEvent->GetTrack(i2);
22661    // RP condition (!(first) particle in the correlator must be RP):
22662    if(!(aftsTrack->InRPSelection())) continue;
22663    phi2=aftsTrack->Phi();   
22664    // sin terms: 
22665    fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1+phi2)),1.); // <<sin(n*(psi1+phi2))>>  
22666    // cos terms: 
22667    fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2)),1.); // <<cos(n*(psi1+phi2))>>  
22668   }//end of for(Int_t i2=0;i2<nPrim;i2++)
22669  }//end of for(Int_t i1=0;i1<nPrim;i1++)   
22670  
22671  // 3-particle correction terms:
22672  for(Int_t i1=0;i1<nPrim;i1++)
22673  {
22674   aftsTrack=anEvent->GetTrack(i1);
22675    // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22676   if(typeFlag==1) // this is diff flow of POIs 
22677   {
22678    if(ptOrEta == "Pt")
22679    { 
22680     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22681    } else if (ptOrEta == "Eta")
22682      {
22683       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22684      }
22685   } else // this is diff flow of RPs 
22686     {
22687      if(ptOrEta == "Pt")
22688      { 
22689       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22690      } else if (ptOrEta == "Eta")
22691        {
22692         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22693        }
22694     }
22695   psi1=aftsTrack->Phi();
22696   for(Int_t i2=0;i2<nPrim;i2++)
22697   {
22698    if(i2==i1) continue;
22699    aftsTrack=anEvent->GetTrack(i2);
22700    // RP condition (!(first) particle in the correlator must be RP):
22701    if(!(aftsTrack->InRPSelection())) continue;
22702    phi2=aftsTrack->Phi();
22703    for(Int_t i3=0;i3<nPrim;i3++)
22704    {
22705     if(i3==i1||i3==i2) continue;
22706     aftsTrack=anEvent->GetTrack(i3);
22707     // RP condition (!(first) particle in the correlator must be RP):
22708     if(!(aftsTrack->InRPSelection())) continue;
22709     phi3=aftsTrack->Phi();
22710     // sin terms: 
22711     fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][2]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1+phi2-phi3)),1.); // <<sin(n*(psi1+phi2-phi3))>>  
22712     fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][3]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1-phi2-phi3)),1.); // <<sin(n*(psi1-phi2-phi3))>>  
22713     // cos terms: 
22714     fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][2]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2-phi3)),1.); // <<cos(n*(psi1+phi2-phi3))>>  
22715     fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][3]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1-phi2-phi3)),1.); // <<cos(n*(psi1-phi2-phi3))>>  
22716    }//end of for(Int_t i3=0;i3<nPrim;i3++)  
22717   }//end of for(Int_t i2=0;i2<nPrim;i2++)  
22718  }//end of for(Int_t i1=0;i1<nPrim;i1++)
22719    
22720 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(AliFlowEventSimple* anEvent, TString type, TString ptOrEta)
22721
22722
22723 //=======================================================================================================================
22724
22725
22726 void AliFlowAnalysisWithQCumulants::CrossCheckDiffFlowCorrectionTermsForNUA(TString type, TString ptOrEta)
22727 {
22728  // Compare corrections temrs for non-uniform acceptance needed for diff. flow calculated with nested loops and those calculated from Q-vectors
22729  
22730  Int_t typeFlag = 0;
22731  Int_t ptEtaFlag = 0;
22732  if(type == "RP")
22733  {
22734   typeFlag = 0;
22735  } else if(type == "POI")
22736    {
22737     typeFlag = 1;
22738    }      
22739  if(ptOrEta == "Pt")
22740  {
22741   ptEtaFlag = 0;
22742  } else if(ptOrEta == "Eta")
22743    {
22744     ptEtaFlag = 1;
22745    } 
22746  // shortcuts:
22747  Int_t t = typeFlag;
22748  Int_t pe = ptEtaFlag;
22749       
22750  TString rpORpoiString[2] = {"RP ","POI"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
22751  TString ptORetaString[2] = {"pt","eta"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
22752  //TString sinCosFlag[2] = {"sin","cos"}; // to be improved (eventually promote to data member)
22753  TString reducedCorrectionSinTerms[4] = {"<<sin(n(psi1))>>","<<sin(n(psi1+phi2))>>","<<sin(n*(psi1+phi2-phi3))>>","<<sin(n*(psi1-phi2-phi3))>>"}; // to be improved (access this from pro or hist)
22754  TString reducedCorrectionCosTerms[4] = {"<<cos(n(psi1))>>","<<cos(n(psi1+phi2))>>","<<cos(n*(psi1+phi2-phi3))>>","<<cos(n*(psi1-phi2-phi3))>>"}; // to be improved (access this from pro or hist)
22755  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
22756  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
22757  
22758  Int_t crossCheckInPtEtaBinNo[2] = {fCrossCheckInPtBinNo,fCrossCheckInEtaBinNo};
22759  
22760  cout<<endl;
22761  cout<<"   ******************************************"<<endl;
22762  cout<<"   ****  cross-checking the correction   ****"<<endl;
22763  cout<<"   **** terms for non-uniform acceptance ****"<<endl; 
22764  cout<<"   ****    for differential flow ("<<rpORpoiString[t]<<")   ****"<<endl;
22765  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
22766  {
22767   cout<<"   ****    (particle weights not used)   ****"<<endl;
22768  } else
22769    {
22770     cout<<"   ****     (particle weights used)      ****"<<endl;
22771    } 
22772  cout<<"   ******************************************"<<endl; 
22773  cout<<endl;
22774  cout<<"           "<<ptORetaString[pe]<<" bin: "<<lowerPtEtaEdge[pe]<<" <= "<<ptORetaString[pe]<<" < "<<upperPtEtaEdge[pe]<<endl;
22775  cout<<endl;
22776  
22777  for(Int_t cti=0;cti<4;cti++) // correction term index
22778  {
22779   for(Int_t sc=0;sc<2;sc++) // sin or cos terms
22780   {
22781    if(sc==0) // to be improved (this can be implemented better)
22782    { 
22783     cout<<"      "<<reducedCorrectionSinTerms[cti].Data()<<":"<<endl;
22784    } else
22785      {
22786       cout<<"      "<<reducedCorrectionCosTerms[cti].Data()<<":"<<endl;     
22787      }
22788    cout<<"      from Q-vectors    = "<<fDiffFlowCorrectionTermsForNUAPro[t][pe][sc][cti]->GetBinContent(crossCheckInPtEtaBinNo[pe])<<endl;
22789    cout<<"      from nested loops = "<<fDiffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti]->GetBinContent(1)<<endl;
22790    cout<<endl;  
22791   } 
22792  } // end of for(Int_t rci=0;rci<4;rci++)
22793
22794 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckDiffFlowCorrectionTermsForNUA(TString type, TString ptOrEta)
22795
22796 //=======================================================================================================================
22797
22798 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTermsUsingParticleWeights()
22799 {
22800  // Calculate corrections using particle weights for non-uniform acceptance of the detector for no-name integrated flow (cos terms).
22801  
22802  //                                  **********************************************************************
22803  //                                  **** weighted corrections for non-uniform acceptance (cos terms): ****
22804  //                                  **********************************************************************
22805  
22806  // Remark 1: When particle weights are used the binning of fIntFlowCorrectionTermsForNUAPro[1] is organized as follows:
22807  //
22808  // 1st bin: <<w1 cos(n*(phi1))>> = cosP1nW1
22809  // 2nd bin: <<w1 w2 cos(n*(phi1+phi2))>> = cosP1nP1nW1W1
22810  // 3rd bin: <<w1 w2 w3 cos(n*(phi1-phi2-phi3))>> = cosP1nM1nM1nW1W1W1 
22811  // ...
22812
22813  // multiplicity (number of particles used to determine the reaction plane)
22814  Double_t dMult = (*fSpk)(0,0);
22815  
22816  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
22817  Double_t dReQ1n1k = (*fReQ)(0,1);
22818  Double_t dReQ2n2k = (*fReQ)(1,2);
22819  //Double_t dReQ3n3k = (*fReQ)(2,3);
22820  //Double_t dReQ4n4k = (*fReQ)(3,4);
22821  Double_t dReQ1n3k = (*fReQ)(0,3);
22822  Double_t dImQ1n1k = (*fImQ)(0,1);
22823  Double_t dImQ2n2k = (*fImQ)(1,2);
22824  //Double_t dImQ3n3k = (*fImQ)(2,3);
22825  //Double_t dImQ4n4k = (*fImQ)(3,4);
22826  //Double_t dImQ1n3k = (*fImQ)(0,3);
22827
22828  // dMs are variables introduced in order to simplify some Eqs. bellow:
22829  //..............................................................................................
22830  Double_t dM11 = (*fSpk)(1,1)-(*fSpk)(0,2); // dM11 = sum_{i,j=1,i!=j}^M w_i w_j
22831  Double_t dM111 = (*fSpk)(2,1)-3.*(*fSpk)(0,2)*(*fSpk)(0,1)
22832                 + 2.*(*fSpk)(0,3); // dM111 = sum_{i,j,k=1,i!=j!=k}^M w_i w_j w_k
22833  //..............................................................................................
22834          // 1-particle:
22835  Double_t cosP1nW1 = 0.; // <<w1 cos(n*(phi1))>>
22836    
22837  if(dMult>0 && TMath::Abs((*fSpk)(0,1))>1.e-6)
22838  {
22839   cosP1nW1 = dReQ1n1k/(*fSpk)(0,1); 
22840   
22841   // average weighted 1-particle correction (cos terms) for non-uniform acceptance for single event:
22842   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(1,cosP1nW1);
22843   
22844   // final average weighted 1-particle correction (cos terms) for non-uniform acceptance for all events:
22845   fIntFlowCorrectionTermsForNUAPro[1]->Fill(0.5,cosP1nW1,(*fSpk)(0,1));  
22846  } 
22847  
22848  // 2-particle:
22849  Double_t cosP1nP1nW1W1 = 0.; // <<w1 w2 cos(n*(phi1+phi2))>>
22850  
22851  if(dMult>1 && TMath::Abs(dM11)>1.e-6)
22852  {
22853   cosP1nP1nW1W1 = (pow(dReQ1n1k,2)-pow(dImQ1n1k,2)-dReQ2n2k)/dM11; 
22854   
22855   // average weighted 2-particle correction (cos terms) for non-uniform acceptance for single event:
22856   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(2,cosP1nP1nW1W1);
22857   
22858   // final average weighted 2-particle correction (cos terms) for non-uniform acceptance for all events:
22859   fIntFlowCorrectionTermsForNUAPro[1]->Fill(1.5,cosP1nP1nW1W1,dM11);  
22860  } 
22861  
22862  // 3-particle:
22863  Double_t cosP1nM1nM1nW1W1W1 = 0.; // <<w1 w2 w3 cos(n*(phi1-phi2-phi3))>>
22864  
22865  if(dMult>2 && TMath::Abs(dM111)>1.e-6)
22866  {
22867   cosP1nM1nM1nW1W1W1 = (dReQ1n1k*(pow(dReQ1n1k,2)+pow(dImQ1n1k,2))
22868                      - dReQ1n1k*dReQ2n2k-dImQ1n1k*dImQ2n2k
22869                      - 2.*((*fSpk)(0,2))*dReQ1n1k
22870                      + 2.*dReQ1n3k) 
22871                      / dM111; 
22872   
22873   // average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for single event:
22874   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(3,cosP1nM1nM1nW1W1W1);
22875   
22876   // final average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for all events:
22877   fIntFlowCorrectionTermsForNUAPro[1]->Fill(2.5,cosP1nM1nM1nW1W1W1,dM111);  
22878  } 
22879  
22880 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTermsUsingParticleWeights()
22881
22882
22883 //=======================================================================================================================
22884
22885
22886 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTermsUsingParticleWeights()
22887 {
22888  // calculate corrections using particle weights for non-uniform acceptance of the detector for no-name integrated flow (sin terms)
22889  
22890  //                                  **********************************************************************
22891  //                                  **** weighted corrections for non-uniform acceptance (sin terms): ****
22892  //                                  **********************************************************************
22893  
22894  // Remark 1: When particle weights are used the binning of fIntFlowCorrectionTermsForNUAPro[0] is organized as follows:
22895  //
22896  // 1st bin: <<w1 sin(n*(phi1))>> = sinP1nW1
22897  // 2nd bin: <<w1 w2 sin(n*(phi1+phi2))>> = sinP1nP1nW1W1
22898  // 3rd bin: <<w1 w2 w3 sin(n*(phi1-phi2-phi3))>> = sinP1nM1nM1nW1W1W1 
22899  // ...
22900
22901  // multiplicity (number of particles used to determine the reaction plane)
22902  Double_t dMult = (*fSpk)(0,0);
22903  
22904  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
22905  Double_t dReQ1n1k = (*fReQ)(0,1);
22906  Double_t dReQ2n2k = (*fReQ)(1,2);
22907  //Double_t dReQ3n3k = (*fReQ)(2,3);
22908  //Double_t dReQ4n4k = (*fReQ)(3,4);
22909  //Double_t dReQ1n3k = (*fReQ)(0,3);
22910  Double_t dImQ1n1k = (*fImQ)(0,1);
22911  Double_t dImQ2n2k = (*fImQ)(1,2);
22912  //Double_t dImQ3n3k = (*fImQ)(2,3);
22913  //Double_t dImQ4n4k = (*fImQ)(3,4);
22914  Double_t dImQ1n3k = (*fImQ)(0,3);
22915
22916  // dMs are variables introduced in order to simplify some Eqs. bellow:
22917  //..............................................................................................
22918  Double_t dM11 = (*fSpk)(1,1)-(*fSpk)(0,2); // dM11 = sum_{i,j=1,i!=j}^M w_i w_j
22919  Double_t dM111 = (*fSpk)(2,1)-3.*(*fSpk)(0,2)*(*fSpk)(0,1)
22920                 + 2.*(*fSpk)(0,3); // dM111 = sum_{i,j,k=1,i!=j!=k}^M w_i w_j w_k
22921  //..............................................................................................
22922  
22923  // 1-particle:
22924  Double_t sinP1nW1 = 0.; // <<w1 sin(n*(phi1))>>
22925  
22926  if(dMult>0 && TMath::Abs((*fSpk)(0,1))>1.e-6)
22927  {
22928   sinP1nW1 = dImQ1n1k/((*fSpk)(0,1)); 
22929      
22930   // average weighted 1-particle correction (sin terms) for non-uniform acceptance for single event:
22931   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(1,sinP1nW1);
22932   
22933   // final average weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:   
22934   fIntFlowCorrectionTermsForNUAPro[0]->Fill(0.5,sinP1nW1,(*fSpk)(0,1));  
22935  } 
22936  
22937  // 2-particle:
22938  Double_t sinP1nP1nW1W1 = 0.; // <<w1 w2 sin(n*(phi1+phi2))>>
22939  
22940  if(dMult>1 && TMath::Abs(dM11)>1.e-6)
22941  {
22942   sinP1nP1nW1W1 = (2.*dReQ1n1k*dImQ1n1k-dImQ2n2k)/dM11; 
22943      
22944   // average weighted 2-particle correction (sin terms) for non-uniform acceptance for single event:
22945   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(2,sinP1nP1nW1W1);
22946   
22947   // final average weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:      
22948   fIntFlowCorrectionTermsForNUAPro[0]->Fill(1.5,sinP1nP1nW1W1,dM11);  
22949  } 
22950  
22951  // 3-particle:
22952  Double_t sinP1nM1nM1nW1W1W1 = 0.; // <<w1 w2 w3 sin(n*(phi1-phi2-phi3))>>
22953  
22954  if(dMult>2 && TMath::Abs(dM111)>1.e-6)
22955  {
22956   sinP1nM1nM1nW1W1W1 = (-dImQ1n1k*(pow(dReQ1n1k,2)+pow(dImQ1n1k,2))
22957                      + dReQ1n1k*dImQ2n2k-dImQ1n1k*dReQ2n2k
22958                      + 2.*((*fSpk)(0,2))*dImQ1n1k
22959                      - 2.*dImQ1n3k)
22960                      / dM111; 
22961   
22962   // average weighted 3-particle correction (sin terms) for non-uniform acceptance for single event:
22963   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(3,sinP1nM1nM1nW1W1W1);
22964   
22965   // final average weighted 3-particle correction (sin terms) for non-uniform acceptance for all events:  
22966   fIntFlowCorrectionTermsForNUAPro[0]->Fill(2.5,sinP1nM1nM1nW1W1W1,dM111);  
22967  } 
22968  
22969 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTermsUsingParticleWeights()
22970
22971 //=======================================================================================================================
22972
22973 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrectionsForNUAWithNestedLoopsUsingParticleWeights(AliFlowEventSimple * const anEvent)
22974 {
22975  // Evaluate with nested loops correction terms for non-uniform acceptance for integrated flow (using the particle weights). 
22976
22977  // Results are stored in profiles fIntFlowDirectCorrectionTermsForNUA[0] (sin terms) and
22978  // fIntFlowDirectCorrectionTermsForNUA[1] (cos terms). 
22979  
22980  // Remark 1: When particle weights are used the binning of fIntFlowDirectCorrectionTermsForNUA[sc] is 
22981  // organized as follows (sc stands for either sin or cos):
22982  //
22983  // 1st bin: <<w1 sc(n*(phi1))>> = scP1nW1
22984  // 2nd bin: <<w1 w2 sc(n*(phi1+phi2))>> = scP1nP1nW1W1
22985  // 3rd bin: <<w1 w2 w3 sc(n*(phi1-phi2-phi3))>> = scP1nM1nM1nW1W1W1 
22986  // ...
22987   
22988  Int_t nPrim = anEvent->NumberOfTracks(); 
22989  AliFlowTrackSimple *aftsTrack = NULL;
22990  //Double_t phi1=0., phi2=0., phi3=0., phi4=0., phi5=0., phi6=0., phi7=0., phi8=0.;
22991  //Double_t wPhi1=1., wPhi2=1., wPhi3=1., wPhi4=1., wPhi5=1., wPhi6=1., wPhi7=1., wPhi8=1.;
22992  Double_t phi1=0., phi2=0., phi3=0.;
22993  Double_t wPhi1=1., wPhi2=1., wPhi3=1.;
22994  Int_t n = fHarmonic; 
22995  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // to be improved (is this casting safe in general?)
22996  Double_t dMult = (*fSpk)(0,0);
22997  cout<<endl;
22998  cout<<"Correction terms for non-uniform acceptance: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
22999  if(dMult<1)
23000  {
23001   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
23002  } else if (dMult>fMaxAllowedMultiplicity)
23003    {
23004     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
23005    } else 
23006      { 
23007       cout<<"... evaluating nested loops (using particle weights) ..."<<endl;
23008      } 
23009       
23010  // 1-particle correction terms using particle weights:       
23011  if(nPrim>=1 && nPrim<=fMaxAllowedMultiplicity)
23012  {
23013   for(Int_t i1=0;i1<nPrim;i1++)
23014   {
23015    aftsTrack=anEvent->GetTrack(i1);
23016    if(!(aftsTrack->InRPSelection())) continue;
23017    phi1=aftsTrack->Phi();
23018    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
23019    // 1-particle correction terms using particle weights:
23020    if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[0]->Fill(0.5,sin(n*phi1),wPhi1); // <w1 sin(n*phi1)>
23021    if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[1]->Fill(0.5,cos(n*phi1),wPhi1); // <w1 cos(n*phi1)>
23022   } // end of for(Int_t i1=0;i1<nPrim;i1++)
23023  } // end of if(nPrim>=1 && nPrim<=fMaxAllowedMultiplicity) 
23024  
23025  // 2-particle correction terms using particle weights:       
23026  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
23027  {
23028   for(Int_t i1=0;i1<nPrim;i1++)
23029   {
23030    aftsTrack=anEvent->GetTrack(i1);
23031    if(!(aftsTrack->InRPSelection())) continue;
23032    phi1=aftsTrack->Phi();
23033    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
23034    for(Int_t i2=0;i2<nPrim;i2++)
23035    {
23036     if(i2==i1)continue;
23037     aftsTrack=anEvent->GetTrack(i2);
23038     if(!(aftsTrack->InRPSelection())) continue;
23039     phi2=aftsTrack->Phi();
23040     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));   
23041     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
23042     // 2-p correction terms using particle weights:    
23043     if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[0]->Fill(1.5,sin(n*(phi1+phi2)),wPhi1*wPhi2); // <w1 w2 sin(n*(phi1+phi2))>
23044     if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[1]->Fill(1.5,cos(n*(phi1+phi2)),wPhi1*wPhi2); // <w1 w2 cos(n*(phi1+phi2))>
23045    } // end of for(Int_t i2=0;i2<nPrim;i2++)
23046   } // end of for(Int_t i1=0;i1<nPrim;i1++)
23047  } // end of if(nPrim>=2)
23048
23049  // 3-particle correction terms using particle weights:       
23050  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
23051  { 
23052   for(Int_t i1=0;i1<nPrim;i1++)
23053   {
23054    aftsTrack=anEvent->GetTrack(i1);
23055    if(!(aftsTrack->InRPSelection())) continue;
23056    phi1=aftsTrack->Phi();
23057    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
23058    for(Int_t i2=0;i2<nPrim;i2++)
23059    {
23060     if(i2==i1)continue;
23061     aftsTrack=anEvent->GetTrack(i2);
23062     if(!(aftsTrack->InRPSelection())) continue;
23063     phi2=aftsTrack->Phi();
23064     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
23065     for(Int_t i3=0;i3<nPrim;i3++)
23066     {
23067      if(i3==i1||i3==i2)continue;
23068      aftsTrack=anEvent->GetTrack(i3);
23069      if(!(aftsTrack->InRPSelection())) continue;
23070      phi3=aftsTrack->Phi();
23071      if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
23072      if(nPrim==3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush;
23073      // 3-p correction terms using particle weights:    
23074      if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[0]->Fill(2.5,sin(n*(phi1-phi2-phi3)),wPhi1*wPhi2*wPhi3); // <w1 w2 w3 sin(n*(phi1-phi2-phi3))>
23075      if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[1]->Fill(2.5,cos(n*(phi1-phi2-phi3)),wPhi1*wPhi2*wPhi3); // <w1 w2 w3 cos(n*(phi1-phi2-phi3))>
23076     } // end of for(Int_t i3=0;i3<nPrim;i3++)
23077    } // end of for(Int_t i2=0;i2<nPrim;i2++)
23078   } // end of for(Int_t i1=0;i1<nPrim;i1++)
23079  } // end of if(nPrim>=3)
23080  
23081  /*
23082  
23083  if(nPrim>=4 && nPrim<=fMaxAllowedMultiplicity)
23084  {
23085   // 4 nested loops multiparticle correlations using particle weights:       
23086   for(Int_t i1=0;i1<nPrim;i1++)
23087   {
23088    aftsTrack=anEvent->GetTrack(i1);
23089    if(!(aftsTrack->InRPSelection())) continue;
23090    phi1=aftsTrack->Phi();
23091    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
23092    for(Int_t i2=0;i2<nPrim;i2++)
23093    {
23094     if(i2==i1)continue;
23095     aftsTrack=anEvent->GetTrack(i2);
23096     if(!(aftsTrack->InRPSelection())) continue;
23097     phi2=aftsTrack->Phi();
23098     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
23099     for(Int_t i3=0;i3<nPrim;i3++)
23100     {
23101      if(i3==i1||i3==i2)continue;
23102      aftsTrack=anEvent->GetTrack(i3);
23103      if(!(aftsTrack->InRPSelection())) continue;
23104      phi3=aftsTrack->Phi();
23105      if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
23106      for(Int_t i4=0;i4<nPrim;i4++)
23107      {
23108       if(i4==i1||i4==i2||i4==i3)continue;
23109       aftsTrack=anEvent->GetTrack(i4);
23110       if(!(aftsTrack->InRPSelection())) continue;
23111       phi4=aftsTrack->Phi();
23112       if(fUsePhiWeights && fPhiWeights) wPhi4 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi4*fnBinsPhi/TMath::TwoPi())));
23113       if(nPrim>=4) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<"\r"<<flush; // to be improved (replace eventually this if statement with if(nPrim==4))
23114       // 4-p correlations using particle weights:
23115       if(fUsePhiWeights) fIntFlowDirectCorrelations->Fill(10.5,cos(n*phi1+n*phi2-n*phi3-n*phi4),wPhi1*wPhi2*wPhi3*wPhi4); 
23116       // extra correlations: 
23117       // 2-p extra correlations (do not appear if particle weights are not used):
23118       // ...
23119       // 3-p extra correlations (do not appear if particle weights are not used):
23120       // ...
23121       // 4-p extra correlations (do not appear if particle weights are not used):
23122       // ...
23123      } // end of for(Int_t i4=0;i4<nPrim;i4++) 
23124     } // end of for(Int_t i3=0;i3<nPrim;i3++)
23125    } // end of for(Int_t i2=0;i2<nPrim;i2++)
23126   } // end of for(Int_t i1=0;i1<nPrim;i1++)
23127  } // end of if(nPrim>=4)
23128
23129  */
23130
23131  cout<<endl; 
23132
23133 } // end of void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrectionsForNUAWithNestedLoopsUsingParticleWeights(AliFlowEventSimple* anEvent)
23134
23135 //=======================================================================================================================
23136
23137 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights(TString type, TString ptOrEta)
23138 {
23139  // Calculate correction terms for non-uniform acceptance for differential flow (cos terms) using particle weights.
23140  
23141  // Results are stored in fDiffFlowCorrectionTermsForNUAPro[t][pe][1][cti], where cti runs as follows:
23142  //
23143  //  0: <<cos n(psi)>>
23144  //  1: <<w2 cos n(psi1+phi2)>>
23145  //  2: <<w2 w3 cos n(psi1+phi2-phi3)>>
23146  //  3: <<w2 w3 cos n(psi1-phi2-phi3)>>
23147  //  4:
23148  //  5:
23149  //  6:
23150  
23151  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
23152  Double_t dReQ1n1k = (*fReQ)(0,1);
23153  Double_t dReQ2n2k = (*fReQ)(1,2);
23154  //Double_t dReQ1n3k = (*fReQ)(0,3);
23155  //Double_t dReQ4n4k = (*fReQ)(3,4);
23156  Double_t dImQ1n1k = (*fImQ)(0,1);
23157  Double_t dImQ2n2k = (*fImQ)(1,2);
23158  //Double_t dImQ1n3k = (*fImQ)(0,3);
23159  //Double_t dImQ4n4k = (*fImQ)(3,4);
23160  
23161  // S^M_{p,k} (see .h file for the definition of fSpk):
23162  Double_t dSM1p1k = (*fSpk)(0,1);
23163  Double_t dSM1p2k = (*fSpk)(0,2);
23164  Double_t dSM2p1k = (*fSpk)(1,1);
23165
23166  Int_t t = 0; // type flag 
23167  Int_t pe = 0; // ptEta flag
23168  
23169  if(type == "RP")
23170  {
23171   t = 0;
23172  } else if(type == "POI")
23173    {
23174     t = 1;
23175    }
23176
23177  if(ptOrEta == "Pt")
23178  {
23179   pe = 0;
23180  } else if(ptOrEta == "Eta")
23181    {
23182     pe = 1;
23183    }
23184     
23185  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
23186  Double_t minPtEta[2] = {fPtMin,fEtaMin};
23187  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
23188  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
23189  
23190  // looping over all bins and calculating correction terms: 
23191  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
23192  {
23193   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
23194   Double_t p1n0kRe = 0.;
23195   Double_t p1n0kIm = 0.;
23196
23197   // number of POIs in particular pt or eta bin:
23198   Double_t mp = 0.;
23199
23200   // real and imaginary parts of q_{m*n,0} (weighted Q-vector evaluated for particles which are both RPs and POIs in particular pt or eta bin):
23201   Double_t q1n2kRe = 0.;
23202   //Double_t q1n2kIm = 0.;
23203   Double_t q2n1kRe = 0.;
23204   Double_t q2n1kIm = 0.;
23205     
23206   // s_{1,1}, s_{1,2} // to be improved (add explanation)  
23207   Double_t s1p1k = 0.; 
23208   Double_t s1p2k = 0.; 
23209   
23210   // number of particles which are both RPs and POIs in particular pt or eta bin:
23211   //Double_t mq = 0.;
23212   
23213   // M0111 from Eq. (118) in QC2c (to be improved (notation))
23214   Double_t dM01 = 0.;
23215   Double_t dM011 = 0.;
23216   
23217   if(type == "POI")
23218   {           
23219    // q_{m*n,k}:
23220    q1n2kRe = fReRPQ1dEBE[2][pe][0][2]->GetBinContent(fReRPQ1dEBE[2][pe][0][2]->GetBin(b))
23221            * fReRPQ1dEBE[2][pe][0][2]->GetBinEntries(fReRPQ1dEBE[2][pe][0][2]->GetBin(b));
23222    //q1n2kIm = fImRPQ1dEBE[2][pe][0][2]->GetBinContent(fImRPQ1dEBE[2][pe][0][2]->GetBin(b))
23223    //        * fImRPQ1dEBE[2][pe][0][2]->GetBinEntries(fImRPQ1dEBE[2][pe][0][2]->GetBin(b));         
23224    q2n1kRe = fReRPQ1dEBE[2][pe][1][1]->GetBinContent(fReRPQ1dEBE[2][pe][1][1]->GetBin(b))
23225            * fReRPQ1dEBE[2][pe][1][1]->GetBinEntries(fReRPQ1dEBE[2][pe][1][1]->GetBin(b));
23226    q2n1kIm = fImRPQ1dEBE[2][pe][1][1]->GetBinContent(fImRPQ1dEBE[2][pe][1][1]->GetBin(b))
23227            * fImRPQ1dEBE[2][pe][1][1]->GetBinEntries(fImRPQ1dEBE[2][pe][1][1]->GetBin(b));         
23228    //mq = fReRPQ1dEBE[2][pe][1][1]->GetBinEntries(fReRPQ1dEBE[2][pe][1][1]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
23229    
23230    s1p1k = pow(fs1dEBE[2][pe][1]->GetBinContent(b)*fs1dEBE[2][pe][1]->GetBinEntries(b),1.); 
23231    s1p2k = pow(fs1dEBE[2][pe][2]->GetBinContent(b)*fs1dEBE[2][pe][2]->GetBinEntries(b),1.); 
23232   }else if(type == "RP")
23233    {
23234     // q_{m*n,k}: (Remark: m=1 is 0, k=0 iz zero (to be improved!)) 
23235     q1n2kRe = fReRPQ1dEBE[0][pe][0][2]->GetBinContent(fReRPQ1dEBE[0][pe][0][2]->GetBin(b))
23236             * fReRPQ1dEBE[0][pe][0][2]->GetBinEntries(fReRPQ1dEBE[0][pe][0][2]->GetBin(b));
23237     //q1n2kIm = fImRPQ1dEBE[0][pe][0][2]->GetBinContent(fImRPQ1dEBE[0][pe][0][2]->GetBin(b))
23238     //        * fImRPQ1dEBE[0][pe][0][2]->GetBinEntries(fImRPQ1dEBE[0][pe][0][2]->GetBin(b));
23239     q2n1kRe = fReRPQ1dEBE[0][pe][1][1]->GetBinContent(fReRPQ1dEBE[0][pe][1][1]->GetBin(b))
23240             * fReRPQ1dEBE[0][pe][1][1]->GetBinEntries(fReRPQ1dEBE[0][pe][1][1]->GetBin(b));
23241     q2n1kIm = fImRPQ1dEBE[0][pe][1][1]->GetBinContent(fImRPQ1dEBE[0][pe][1][1]->GetBin(b))
23242             * fImRPQ1dEBE[0][pe][1][1]->GetBinEntries(fImRPQ1dEBE[0][pe][1][1]->GetBin(b));
23243     // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
23244     s1p1k = pow(fs1dEBE[0][pe][1]->GetBinContent(b)*fs1dEBE[0][pe][1]->GetBinEntries(b),1.); 
23245     s1p2k = pow(fs1dEBE[0][pe][2]->GetBinContent(b)*fs1dEBE[0][pe][2]->GetBinEntries(b),1.); 
23246     //s1p3k = pow(fs1dEBE[0][pe][3]->GetBinContent(b)*fs1dEBE[0][pe][3]->GetBinEntries(b),1.);  
23247     
23248     //mq = fReRPQ1dEBE[0][pe][1][1]->GetBinEntries(fReRPQ1dEBE[0][pe][1][1]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here) 
23249   }    
23250   
23251   if(type == "POI")
23252   {
23253    // p_{m*n,k}:   
23254    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
23255            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
23256    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
23257            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
23258    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here) 
23259    // M01 from Eq. (118) in QC2c (to be improved (notation)):
23260    dM01 = mp*dSM1p1k-s1p1k;
23261    dM011 = mp*(dSM2p1k-dSM1p2k)
23262          - 2.*(s1p1k*dSM1p1k-s1p2k);
23263        
23264    // typeFlag = RP (0) or POI (1):   
23265    t = 1; 
23266   } else if(type == "RP")
23267     {  
23268      // to be improved (cross-checked):
23269      p1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
23270              * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
23271      p1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))  
23272              * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
23273      mp = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
23274      // M01 from Eq. (118) in QC2c (to be improved (notation)):
23275      dM01 = mp*dSM1p1k-s1p1k;
23276      dM011 = mp*(dSM2p1k-dSM1p2k)
23277            - 2.*(s1p1k*dSM1p1k-s1p2k); 
23278      // typeFlag = RP (0) or POI (1): 
23279      t = 0;
23280     }
23281   
23282   // <<cos n(psi1)>>:
23283   Double_t cosP1nPsi = 0.;
23284   if(mp)
23285   {
23286    cosP1nPsi = p1n0kRe/mp;
23287    
23288    // fill profile for <<cos n(psi1)>>:
23289    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi,mp);
23290    // histogram to store <cos n(psi1)> e-b-e (needed in some other methods):
23291    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][0]->SetBinContent(b,cosP1nPsi);
23292   } // end of if(mp)   
23293   
23294   // <<w2 cos n(psi1+phi2)>>:
23295   Double_t cosP1nPsiP1nPhiW2 = 0.;
23296   if(dM01)
23297   {
23298    cosP1nPsiP1nPhiW2 = (p1n0kRe*dReQ1n1k-p1n0kIm*dImQ1n1k-q2n1kRe)/(dM01);
23299    // fill profile for <<w2 cos n(psi1+phi2)>>:
23300    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsiP1nPhiW2,dM01);
23301    // histogram to store <w2 cos n(psi1+phi2)> e-b-e (needed in some other methods):
23302    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][1]->SetBinContent(b,cosP1nPsiP1nPhiW2);
23303   } // end of if(dM01)   
23304   
23305   // <<w2 w3 cos n(psi1+phi2-phi3)>>:
23306   Double_t cosP1nPsi1P1nPhi2MPhi3W2W3 = 0.;
23307   if(dM011)
23308   {
23309    cosP1nPsi1P1nPhi2MPhi3W2W3 = (p1n0kRe*(pow(dImQ1n1k,2.)+pow(dReQ1n1k,2.))
23310                               - p1n0kRe*dSM1p2k
23311                               - q2n1kRe*dReQ1n1k-q2n1kIm*dImQ1n1k
23312                               - s1p1k*dReQ1n1k
23313                               + 2.*q1n2kRe)
23314                               / dM011;  
23315    // fill profile for <<w1 w2 w3 cos n(psi1+phi2)>>:
23316    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1P1nPhi2MPhi3W2W3,dM011);
23317    // histogram to store <w1 w2 w3 cos n(psi1+phi2)> e-b-e (needed in some other methods):
23318    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][2]->SetBinContent(b,cosP1nPsi1P1nPhi2MPhi3W2W3);
23319   } // end of if(dM011)   
23320   
23321   // <<w2 w3 cos n(psi1-phi2-phi3)>>:
23322   Double_t cosP1nPsi1M1nPhi2MPhi3W2W3 = 0.;
23323   if(dM011)
23324   {
23325    cosP1nPsi1M1nPhi2MPhi3W2W3 = (p1n0kRe*(pow(dReQ1n1k,2.)-pow(dImQ1n1k,2.))+2.*p1n0kIm*dReQ1n1k*dImQ1n1k
23326                               - 1.*(p1n0kRe*dReQ2n2k+p1n0kIm*dImQ2n2k)  
23327                               - 2.*s1p1k*dReQ1n1k
23328                               + 2.*q1n2kRe)
23329                               / dM011;
23330    // fill profile for <<w1 w2 w3 cos n(psi1+phi2)>>:
23331    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1M1nPhi2MPhi3W2W3,dM011);
23332    // histogram to store <w1 w2 w3 cos n(psi1+phi2)> e-b-e (needed in some other methods):
23333    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][3]->SetBinContent(b,cosP1nPsi1M1nPhi2MPhi3W2W3);
23334   } // end of if(dM011)   
23335  
23336  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
23337    
23338 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights(TString type, TString ptOrEta)
23339
23340
23341 //=======================================================================================================================
23342
23343
23344 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights(TString type, TString ptOrEta)
23345 {
23346  // Calculate correction terms for non-uniform acceptance for differential flow (sin terms).
23347   
23348  // Results are stored in fDiffFlowCorrectionTermsForNUAPro[t][pe][0][cti], where cti runs as follows:
23349  //  0: <<sin n(psi1)>>
23350  //  1: <<w2 sin n(psi1+phi2)>>
23351  //  2: <<w2 w3 sin n(psi1+phi2-phi3)>>
23352  //  3: <<w2 w3 sin n(psi1-phi2-phi3)>>:
23353  //  4:
23354  //  5:
23355  //  6:
23356  
23357  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
23358  Double_t dReQ1n1k = (*fReQ)(0,1);
23359  Double_t dReQ2n2k = (*fReQ)(1,2);
23360  //Double_t dReQ1n3k = (*fReQ)(0,3);
23361  //Double_t dReQ4n4k = (*fReQ)(3,4);
23362  Double_t dImQ1n1k = (*fImQ)(0,1);
23363  Double_t dImQ2n2k = (*fImQ)(1,2);
23364  //Double_t dImQ1n3k = (*fImQ)(0,3);
23365  //Double_t dImQ4n4k = (*fImQ)(3,4);
23366  
23367  // S^M_{p,k} (see .h file for the definition of fSpk):
23368  Double_t dSM1p1k = (*fSpk)(0,1);
23369  Double_t dSM1p2k = (*fSpk)(0,2);
23370  Double_t dSM2p1k = (*fSpk)(1,1);
23371
23372  Int_t t = 0; // type flag 
23373  Int_t pe = 0; // ptEta flag
23374  
23375  if(type == "RP")
23376  {
23377   t = 0;
23378  } else if(type == "POI")
23379    {
23380     t = 1;
23381    }
23382
23383  if(ptOrEta == "Pt")
23384  {
23385   pe = 0;
23386  } else if(ptOrEta == "Eta")
23387    {
23388     pe = 1;
23389    }
23390     
23391  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
23392  Double_t minPtEta[2] = {fPtMin,fEtaMin};
23393  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
23394  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
23395
23396  // looping over all bins and calculating correction terms: 
23397  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
23398  {
23399   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
23400   Double_t p1n0kRe = 0.;
23401   Double_t p1n0kIm = 0.;
23402
23403   // number of POIs in particular pt or eta bin:
23404   Double_t mp = 0.;
23405
23406   // real and imaginary parts of q_{m*n,0} (weighted Q-vector evaluated for particles which are both RPs and POIs in particular pt or eta bin):
23407   //Double_t q1n2kRe = 0.;
23408   Double_t q1n2kIm = 0.;
23409   Double_t q2n1kRe = 0.;
23410   Double_t q2n1kIm = 0.;
23411     
23412   // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
23413   Double_t s1p1k = 0.; 
23414   Double_t s1p2k = 0.; 
23415   
23416   // number of particles which are both RPs and POIs in particular pt or eta bin:
23417   //Double_t mq = 0.;
23418   
23419   // M0111 from Eq. (118) in QC2c (to be improved (notation))
23420   Double_t dM01 = 0.;
23421   Double_t dM011 = 0.;
23422
23423   if(type == "POI")
23424   {    
23425    // q_{m*n,k}:
23426    //q1n2kRe = fReRPQ1dEBE[2][pe][0][2]->GetBinContent(fReRPQ1dEBE[2][pe][0][2]->GetBin(b))
23427    //        * fReRPQ1dEBE[2][pe][0][2]->GetBinEntries(fReRPQ1dEBE[2][pe][0][2]->GetBin(b));
23428    q1n2kIm = fImRPQ1dEBE[2][pe][0][2]->GetBinContent(fImRPQ1dEBE[2][pe][0][2]->GetBin(b))
23429            * fImRPQ1dEBE[2][pe][0][2]->GetBinEntries(fImRPQ1dEBE[2][pe][0][2]->GetBin(b));         
23430    q2n1kRe = fReRPQ1dEBE[2][pe][1][1]->GetBinContent(fReRPQ1dEBE[2][pe][1][1]->GetBin(b))
23431            * fReRPQ1dEBE[2][pe][1][1]->GetBinEntries(fReRPQ1dEBE[2][pe][1][1]->GetBin(b));
23432    q2n1kIm = fImRPQ1dEBE[2][pe][1][1]->GetBinContent(fImRPQ1dEBE[2][pe][1][1]->GetBin(b))
23433            * fImRPQ1dEBE[2][pe][1][1]->GetBinEntries(fImRPQ1dEBE[2][pe][1][1]->GetBin(b));         
23434    //mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
23435    
23436    s1p1k = pow(fs1dEBE[2][pe][1]->GetBinContent(b)*fs1dEBE[2][pe][1]->GetBinEntries(b),1.); 
23437    s1p2k = pow(fs1dEBE[2][pe][2]->GetBinContent(b)*fs1dEBE[2][pe][2]->GetBinEntries(b),1.); 
23438   }else if(type == "RP")
23439    {
23440     // q_{m*n,k}: (Remark: m=1 is 0, k=0 iz zero (to be improved!)) 
23441     //q1n2kRe = fReRPQ1dEBE[0][pe][0][2]->GetBinContent(fReRPQ1dEBE[0][pe][0][2]->GetBin(b))
23442     //        * fReRPQ1dEBE[0][pe][0][2]->GetBinEntries(fReRPQ1dEBE[0][pe][0][2]->GetBin(b));
23443     q1n2kIm = fImRPQ1dEBE[0][pe][0][2]->GetBinContent(fImRPQ1dEBE[0][pe][0][2]->GetBin(b))
23444             * fImRPQ1dEBE[0][pe][0][2]->GetBinEntries(fImRPQ1dEBE[0][pe][0][2]->GetBin(b));
23445     q2n1kRe = fReRPQ1dEBE[0][pe][1][1]->GetBinContent(fReRPQ1dEBE[0][pe][1][1]->GetBin(b))
23446             * fReRPQ1dEBE[0][pe][1][1]->GetBinEntries(fReRPQ1dEBE[0][pe][1][1]->GetBin(b));
23447     q2n1kIm = fImRPQ1dEBE[0][pe][1][1]->GetBinContent(fImRPQ1dEBE[0][pe][1][1]->GetBin(b))
23448             * fImRPQ1dEBE[0][pe][1][1]->GetBinEntries(fImRPQ1dEBE[0][pe][1][1]->GetBin(b));
23449     // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
23450     s1p1k = pow(fs1dEBE[0][pe][1]->GetBinContent(b)*fs1dEBE[0][pe][1]->GetBinEntries(b),1.); 
23451     s1p2k = pow(fs1dEBE[0][pe][2]->GetBinContent(b)*fs1dEBE[0][pe][2]->GetBinEntries(b),1.); 
23452     //s1p3k = pow(fs1dEBE[0][pe][3]->GetBinContent(b)*fs1dEBE[0][pe][3]->GetBinEntries(b),1.); 
23453   }    
23454   
23455   if(type == "POI")
23456   {
23457    // p_{m*n,k}:   
23458    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
23459            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
23460    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
23461            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
23462    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here) 
23463    // M01 from Eq. (118) in QC2c (to be improved (notation)):
23464    dM01 = mp*dSM1p1k-s1p1k;
23465    dM011 = mp*(dSM2p1k-dSM1p2k)
23466          - 2.*(s1p1k*dSM1p1k-s1p2k);  
23467    // typeFlag = RP (0) or POI (1):   
23468    t = 1;           
23469   } else if(type == "RP")
23470     { 
23471      // to be improved (cross-checked):
23472      p1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
23473              * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
23474      p1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))  
23475              * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
23476      mp = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)    
23477      // M01 from Eq. (118) in QC2c (to be improved (notation)):
23478      dM01 = mp*dSM1p1k-s1p1k;
23479      dM011 = mp*(dSM2p1k-dSM1p2k)
23480            - 2.*(s1p1k*dSM1p1k-s1p2k); 
23481      // typeFlag = RP (0) or POI (1): 
23482      t = 0;
23483     }
23484   
23485   // <<sin n(psi1)>>:
23486   Double_t sinP1nPsi = 0.;
23487   if(mp)
23488   {
23489    sinP1nPsi = p1n0kIm/mp;
23490    
23491    // fill profile for <<sin n(psi1)>>:
23492    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi,mp);
23493    // histogram to store <sin n(psi1)> e-b-e (needed in some other methods):
23494    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][0]->SetBinContent(b,sinP1nPsi);
23495   } // end of if(mp)   
23496   
23497   // <<w2 sin n(psi1+phi2)>>:
23498   Double_t sinP1nPsiP1nPhiW2 = 0.;
23499   if(dM01)
23500   {
23501    sinP1nPsiP1nPhiW2 = (p1n0kRe*dImQ1n1k+p1n0kIm*dReQ1n1k-q2n1kIm)/(dM01);
23502    // fill profile for <<w2 sin n(psi1+phi2)>>:
23503    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsiP1nPhiW2,dM01);
23504    // histogram to store <w2 sin n(psi1+phi2)> e-b-e (needed in some other methods):
23505    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][1]->SetBinContent(b,sinP1nPsiP1nPhiW2);
23506   } // end of if(mp*dMult-mq)   
23507   
23508   // <<w2 w3 sin n(psi1+phi2-phi3)>>:
23509   Double_t sinP1nPsi1P1nPhi2MPhi3W2W3 = 0.;
23510   if(dM011)
23511   {
23512    sinP1nPsi1P1nPhi2MPhi3W2W3 = (p1n0kIm*(pow(dImQ1n1k,2.)+pow(dReQ1n1k,2.))
23513                               - p1n0kIm*dSM1p2k
23514                               + q2n1kRe*dImQ1n1k-q2n1kIm*dReQ1n1k
23515                               - s1p1k*dImQ1n1k
23516                               + 2.*q1n2kIm)
23517                               / dM011;  
23518    // fill profile for <<w2 w3 sin n(psi1+phi2-phi3)>>:
23519    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1P1nPhi2MPhi3W2W3,dM011);
23520    // histogram to store <w2 w3 sin n(psi1+phi2-phi3)> e-b-e (needed in some other methods):
23521    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][2]->SetBinContent(b,sinP1nPsi1P1nPhi2MPhi3W2W3);
23522   } // end of if(dM011)   
23523   
23524   // <<w2 w3 sin n(psi1-phi2-phi3)>>:
23525   Double_t sinP1nPsi1M1nPhi2MPhi3W2W3 = 0.;
23526   if(dM011)
23527   {
23528    sinP1nPsi1M1nPhi2MPhi3W2W3 = (p1n0kIm*(pow(dReQ1n1k,2.)-pow(dImQ1n1k,2.))-2.*p1n0kRe*dReQ1n1k*dImQ1n1k
23529                               + 1.*(p1n0kRe*dImQ2n2k-p1n0kIm*dReQ2n2k)  
23530                               + 2.*s1p1k*dImQ1n1k
23531                               - 2.*q1n2kIm)
23532                               / dM011;
23533    // fill profile for <<w2 w3 sin n(psi1-phi2-phi3)>>:
23534    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1M1nPhi2MPhi3W2W3,dM011);
23535    // histogram to store <w2 w3 sin n(psi1-phi2-phi3)> e-b-e (needed in some other methods):
23536    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][3]->SetBinContent(b,sinP1nPsi1M1nPhi2MPhi3W2W3);
23537   } // end of if(dM011)   
23538   
23539  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
23540
23541 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights(TString type, TString ptOrEta)
23542
23543 //=======================================================================================================================
23544    
23545 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
23546 {
23547  // Evaluate with nested loops correction terms for non-uniform acceptance 
23548  // with using particle weights (both sin and cos terms) relevant for differential flow.
23549  
23550  // Remark 1: "w1" in expressions bellow is a particle weight used only for particles which were 
23551  //           flagged both as POI and RP.
23552  // Remark 2: Reduced correction terms for non-uniform acceptance are evaluated in pt bin number fCrossCheckInPtBinNo 
23553  //           and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
23554  // Remark 3: Results are stored in 1 bin profiles fDiffFlowDirectCorrections[t][pe][sc][cti], where first three indices runs as: 
23555  //           [0=RP,1=POI][0=Pt,1=Eta][0=sin terms,1=cos terms], whilst the cti (correction term index) runs as follows: 
23556  //  cti: 
23557  //    0: <<sc n(psi1)>>
23558  //    1: <<w2 sc n(psi1+phi2)>> 
23559  //    2: <<w2 w3 sc n(psi1+phi2-phi3)>>
23560  //    3: <<w2 w3 sc n(psi1-phi2-phi3)>>
23561  //    4:
23562  //    5:
23563  //    6:
23564      
23565  Int_t typeFlag = 0;
23566  Int_t ptEtaFlag = 0;
23567  if(type == "RP")
23568  {
23569   typeFlag = 0;
23570  } else if(type == "POI")
23571    {
23572     typeFlag = 1;
23573    }      
23574  if(ptOrEta == "Pt")
23575  {
23576   ptEtaFlag = 0;
23577  } else if(ptOrEta == "Eta")
23578    {
23579     ptEtaFlag = 1;
23580    } 
23581  // shortcuts:
23582  Int_t t = typeFlag;
23583  Int_t pe = ptEtaFlag;
23584       
23585  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
23586  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
23587  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
23588  
23589  Int_t nPrim = anEvent->NumberOfTracks(); 
23590  AliFlowTrackSimple *aftsTrack = NULL;
23591  
23592  Double_t psi1=0., phi2=0., phi3=0.;// phi4=0.;// phi5=0., phi6=0., phi7=0., phi8=0.;
23593  Double_t wPhi2=1., wPhi3=1.;
23594  
23595  Int_t n = fHarmonic; 
23596  
23597  // 1'-particle correction terms:
23598  for(Int_t i1=0;i1<nPrim;i1++)
23599  {
23600   aftsTrack=anEvent->GetTrack(i1);
23601   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23602   if(typeFlag==1) // this is diff flow of POIs 
23603   {
23604    if(ptOrEta == "Pt")
23605    { 
23606     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23607    } else if (ptOrEta == "Eta")
23608      {
23609       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23610      }
23611   } else // this is diff flow of RPs 
23612     {
23613      if(ptOrEta == "Pt")
23614      { 
23615       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23616      } else if (ptOrEta == "Eta")
23617        {
23618         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23619        }
23620     }
23621   psi1=aftsTrack->Phi(); 
23622   // sin terms: 
23623   fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*psi1),1.); // <<sin(n*(psi1))>>  
23624   // cos terms: 
23625   fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*psi1),1.); // <<cos(n*(psi1))>>  
23626  }//end of for(Int_t i1=0;i1<nPrim;i1++)
23627    
23628  // 2'-particle correction terms:
23629  for(Int_t i1=0;i1<nPrim;i1++)
23630  {
23631   aftsTrack=anEvent->GetTrack(i1);
23632   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23633   if(typeFlag==1) // this is diff flow of POIs 
23634   {
23635    if(ptOrEta == "Pt")
23636    { 
23637     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23638    } else if (ptOrEta == "Eta")
23639      {
23640       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23641      }
23642   } else // this is diff flow of RPs 
23643     {
23644      if(ptOrEta == "Pt")
23645      { 
23646       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23647      } else if (ptOrEta == "Eta")
23648        {
23649         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23650        }
23651     }
23652   psi1=aftsTrack->Phi(); 
23653   for(Int_t i2=0;i2<nPrim;i2++)
23654   {
23655    if(i2==i1) continue;
23656    aftsTrack=anEvent->GetTrack(i2);
23657    // RP condition (!(first) particle in the correlator must be RP):
23658    if(!(aftsTrack->InRPSelection())) continue;
23659    phi2=aftsTrack->Phi();
23660    if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));   
23661    // sin terms: 
23662    fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1+phi2)),wPhi2); // <<w2 sin(n*(psi1+phi2))>>  
23663    // cos terms: 
23664    fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2)),wPhi2); // <<w2 cos(n*(psi1+phi2))>>  
23665   }//end of for(Int_t i2=0;i2<nPrim;i2++)
23666  }//end of for(Int_t i1=0;i1<nPrim;i1++)   
23667  
23668  // 3'-particle correction terms:
23669  for(Int_t i1=0;i1<nPrim;i1++)
23670  {
23671   aftsTrack=anEvent->GetTrack(i1);
23672   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23673   if(typeFlag==1) // this is diff flow of POIs 
23674   {
23675    if(ptOrEta == "Pt")
23676    { 
23677     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23678    } else if (ptOrEta == "Eta")
23679      {
23680       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23681      }
23682   } else // this is diff flow of RPs 
23683     {
23684      if(ptOrEta == "Pt")
23685      { 
23686       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23687      } else if (ptOrEta == "Eta")
23688        {
23689         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23690        }
23691     }
23692   psi1=aftsTrack->Phi();
23693   for(Int_t i2=0;i2<nPrim;i2++)
23694   {
23695    if(i2==i1) continue;
23696    aftsTrack=anEvent->GetTrack(i2);
23697    // RP condition (!(first) particle in the correlator must be RP):
23698    if(!(aftsTrack->InRPSelection())) continue;
23699    phi2=aftsTrack->Phi();
23700    if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));   
23701    for(Int_t i3=0;i3<nPrim;i3++)
23702    {
23703     if(i3==i1||i3==i2) continue;
23704     aftsTrack=anEvent->GetTrack(i3);
23705     // RP condition (!(first) particle in the correlator must be RP):
23706     if(!(aftsTrack->InRPSelection())) continue;
23707     phi3=aftsTrack->Phi();
23708     if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));   
23709     // sin terms: 
23710     fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][2]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1+phi2-phi3)),wPhi2*wPhi3); // <<wPhi2*wPhi3 sin(n*(psi1+phi2-phi3))>>  
23711     fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][3]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1-phi2-phi3)),wPhi2*wPhi3); // <<wPhi2*wPhi3 sin(n*(psi1-phi2-phi3))>>  
23712     // cos terms: 
23713     fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][2]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2-phi3)),wPhi2*wPhi3); // <<wPhi2*wPhi3 cos(n*(psi1+phi2-phi3))>>  
23714     fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][3]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1-phi2-phi3)),wPhi2*wPhi3); // <<wPhi2*wPhi3 cos(n*(psi1-phi2-phi3))>>  
23715    }//end of for(Int_t i3=0;i3<nPrim;i3++)  
23716   }//end of for(Int_t i2=0;i2<nPrim;i2++)  
23717  }//end of for(Int_t i1=0;i1<nPrim;i1++)
23718                
23719 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(AliFlowEventSimple* anEvent, TString type, TString ptOrEta)
23720
23721 //=======================================================================================================================
23722
23723 void AliFlowAnalysisWithQCumulants::CheckPointersUsedInFinish()
23724 {
23725  // Check all pointers used in method Finish().
23726  
23727  if(!fAvMultiplicity)
23728  {
23729   cout<<endl;
23730   cout<<" WARNING (QC): fAvMultiplicity is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23731   cout<<endl;
23732   exit(0);
23733  }
23734  if(!fIntFlowCorrelationsPro)
23735  {
23736   cout<<endl;
23737   cout<<" WARNING (QC): fIntFlowCorrelationsPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23738   cout<<endl;
23739   exit(0); 
23740  }
23741  if(!fIntFlowSquaredCorrelationsPro)
23742  {
23743   cout<<endl;
23744   cout<<" WARNING (QC): fIntFlowSquaredCorrelationsPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23745   cout<<endl;
23746   exit(0); 
23747  } 
23748  if(!fIntFlowCorrelationsHist)
23749  {
23750   cout<<endl;
23751   cout<<" WARNING (QC): fIntFlowCorrelationsHist is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23752   cout<<endl;
23753   exit(0); 
23754  }
23755  if((fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights) && !fIntFlowExtraCorrelationsPro) 
23756  {
23757   cout<<endl;
23758   cout<<" WARNING (QC): fIntFlowExtraCorrelationsPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23759   cout<<endl;
23760   exit(0); 
23761  } 
23762  for(Int_t power=0;power<2;power++)
23763  { 
23764   if(!fIntFlowSumOfEventWeights[power]) 
23765   {
23766    cout<<endl;
23767    cout<<Form(" WARNING (QC): fIntFlowSumOfEventWeights[%d] is NULL in CheckPointersUsedInFinish() !!!!",power)<<endl;
23768    cout<<endl;
23769    exit(0);
23770   }
23771  } // end of for(Int_t power=0;power<2;power++)
23772  if(!fIntFlowProductOfCorrelationsPro)
23773  {
23774   cout<<endl;
23775   cout<<" WARNING (QC): fIntFlowProductOfCorrelationsPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23776   cout<<endl;
23777   exit(0); 
23778  } 
23779  if(!fIntFlowSumOfProductOfEventWeights)
23780  {
23781   cout<<endl;
23782   cout<<" WARNING (QC): fIntFlowSumOfProductOfEventWeights is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23783   cout<<endl;
23784   exit(0); 
23785  }
23786  if(!fIntFlowCovariances)
23787  {
23788   cout<<endl;
23789   cout<<" WARNING (QC): fIntFlowCovariances is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23790   cout<<endl;
23791   exit(0); 
23792  }  
23793  if(!fIntFlowQcumulants)
23794  {
23795   cout<<endl;
23796   cout<<" WARNING (QC): fIntFlowQcumulants is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23797   cout<<endl;
23798   exit(0); 
23799  }  
23800  if(!fIntFlow)
23801  {
23802   cout<<endl;
23803   cout<<" WARNING (QC): fIntFlow is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23804   cout<<endl;
23805   exit(0); 
23806  }
23807  if(!fCommonHists)
23808  {
23809   cout<<endl;
23810   cout<<" WARNING (QC): fCommonHists is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23811   cout<<endl;
23812   exit(0); 
23813  }
23814  if(!(fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th))
23815  {
23816   cout<<endl;
23817   cout<<" WARNING (QC): fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th"<<endl; 
23818   cout<<"               && fCommonHistsResults8th is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23819   cout<<endl;
23820   exit(0);
23821  } 
23822
23823  // NUA stuff:
23824  for(Int_t sc=0;sc<2;sc++) // sin/cos
23825  { 
23826   if(!fIntFlowCorrectionTermsForNUAPro[sc]) 
23827   {
23828    cout<<endl;
23829    cout<<Form(" WARNING (QC): fIntFlowCorrectionTermsForNUAPro[%d] is NULL in CheckPointersUsedInFinish() !!!!",sc)<<endl;
23830    cout<<endl;
23831    exit(0);
23832   }
23833   if(!fIntFlowCorrectionTermsForNUAHist[sc]) 
23834   {
23835    cout<<endl;
23836    cout<<Form(" WARNING (QC): fIntFlowCorrectionTermsForNUAHist[%d] is NULL in CheckPointersUsedInFinish() !!!!",sc)<<endl;
23837    cout<<endl;
23838    exit(0);
23839   }
23840   for(Int_t lq=0;lq<2;lq++) // linear/quadratic
23841   {
23842    if(!fIntFlowSumOfEventWeightsNUA[sc][lq]) 
23843    {
23844     cout<<endl;
23845     cout<<Form(" WARNING (QC): fIntFlowSumOfEventWeightsNUA[%d][%d] is NULL in CheckPointersUsedInFinish() !!!!",sc,lq)<<endl;
23846     cout<<endl;
23847     exit(0);
23848    }
23849   } // end of for(Int_t lq=0;lq<2;lq++) // linear/quadratic
23850  } // end of for(Int_t power=0;power<2;power++) 
23851  if(!fIntFlowProductOfCorrectionTermsForNUAPro)
23852  {
23853   cout<<endl;
23854   cout<<" WARNING (QC): fIntFlowProductOfCorrectionTermsForNUAPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23855   cout<<endl;
23856   exit(0); 
23857  } 
23858  if(!fIntFlowSumOfProductOfEventWeightsNUA)
23859  {
23860   cout<<endl;
23861   cout<<" WARNING (QC): fIntFlowSumOfProductOfEventWeightsNUA is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23862   cout<<endl;
23863   exit(0); 
23864  } 
23865  if(!fIntFlowCovariancesNUA)
23866  {
23867   cout<<endl;
23868   cout<<" WARNING (QC): fIntFlowCovariancesNUA is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23869   cout<<endl;
23870   exit(0); 
23871  } 
23872  if(!fIntFlowQcumulantsErrorSquaredRatio)
23873  {
23874   cout<<endl;
23875   cout<<" WARNING (QC): fIntFlowQcumulantsErrorSquaredRatio is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23876   cout<<endl;
23877   exit(0); 
23878  } 
23879  if(!fIntFlowDetectorBias)
23880  {
23881   cout<<endl;
23882   cout<<" WARNING (QC): fIntFlowDetectorBias is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23883   cout<<endl;
23884   exit(0); 
23885  }
23886  
23887  if(fCalculateMixedHarmonics)
23888  {
23889   if(!(fMixedHarmonicsFlags))
23890   {
23891    cout<<endl;
23892    cout<<" WARNING (QC): fMixedHarmonicsFlags is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23893    cout<<endl;
23894    exit(0); 
23895   }
23896   if(!(f2pCorrelations && f3pCorrelations && f4pCorrelations && f5pCorrelations))
23897   {
23898    cout<<endl;
23899    cout<<" WARNING (QC): f2pCorrelations && f3pCorrelations && f4pCorrelations && f5pCorrelations is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23900    cout<<endl;
23901    exit(0); 
23902   }
23903   if(!(f2pCumulants && f3pCumulants && f4pCumulants && f5pCumulants))
23904   {
23905    cout<<endl;
23906    cout<<" WARNING (QC): f2pCumulants && f3pCumulants && f4pCumulants && f5pCumulants is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23907    cout<<endl;
23908    exit(0); 
23909   }
23910   for(Int_t power=0;power<2;power++)
23911   { 
23912    if(!fMixedHarmonicEventWeights[power]) 
23913    {
23914     cout<<endl;
23915     cout<<Form(" WARNING (QC): fMixedHarmonicEventWeights[%d] is NULL in CheckPointersUsedInFinish() !!!!",power)<<endl;
23916     cout<<endl;
23917     exit(0);
23918    }
23919   } // end of for(Int_t power=0;power<2;power++)
23920   if(!(fMixedHarmonicProductOfEventWeights))
23921   {
23922    cout<<endl;
23923    cout<<" WARNING (QC): fMixedHarmonicProductOfEventWeights is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23924    cout<<endl;
23925    exit(0); 
23926   }
23927   if(!(fMixedHarmonicProductOfCorrelations))
23928   {
23929    cout<<endl;
23930    cout<<" WARNING (QC): fMixedHarmonicProductOfCorrelations is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23931    cout<<endl;
23932    exit(0); 
23933   }
23934  } // end of if(fCalculateMixedHarmonics)
23935
23936  // Versus multiplicity:
23937  if(!fCalculateCumulantsVsM){return;}
23938  for(Int_t co=0;co<=3;co++) // cumulant order
23939  {
23940   if(!fIntFlowQcumulantsVsM[co])
23941   {
23942    cout<<endl;
23943    cout<<Form(" WARNING (QC): fIntFlowQcumulantsVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",co)<<endl;
23944    cout<<endl;
23945    exit(0); 
23946   }
23947   if(!fIntFlowVsM[co])
23948   {
23949    cout<<endl;
23950    cout<<Form(" WARNING (QC): fIntFlowVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",co)<<endl;
23951    cout<<endl;
23952    exit(0); 
23953   }
23954   if(!fIntFlowDetectorBiasVsM[co])
23955   {
23956    cout<<endl;
23957    cout<<Form(" WARNING (QC): fIntFlowDetectorBiasVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",co)<<endl;
23958    cout<<endl;
23959    exit(0); 
23960   }
23961  } // end of for(Int_t c0=0;c0<=3;c0++) // cumulant order
23962  for(Int_t ci=0;ci<=3;ci++) // correlation index
23963  {
23964   if(!fIntFlowCorrelationsVsMPro[ci])
23965   {
23966    cout<<endl;
23967    cout<<Form(" WARNING (QC): fIntFlowCorrelationsVsMPro[%d] is NULL in CheckPointersUsedInFinish() !!!!",ci)<<endl;
23968    cout<<endl;
23969    exit(0); 
23970   }
23971   if(!fIntFlowSquaredCorrelationsVsMPro[ci])
23972   {
23973    cout<<endl;
23974    cout<<Form(" WARNING (QC): fIntFlowSquaredCorrelationsVsMPro[%d] is NULL in CheckPointersUsedInFinish() !!!!",ci)<<endl;
23975    cout<<endl;
23976    exit(0); 
23977   }  
23978   if(!fIntFlowCorrelationsVsMHist[ci])
23979   {
23980    cout<<endl;
23981    cout<<Form(" WARNING (QC): fIntFlowCorrelationsVsMHist[%d] is NULL in CheckPointersUsedInFinish() !!!!",ci)<<endl;
23982    cout<<endl;
23983    exit(0); 
23984   }
23985   for(Int_t power=0;power<2;power++) 
23986   {
23987    if(!fIntFlowSumOfEventWeightsVsM[ci][power])
23988    {
23989     cout<<endl;
23990     cout<<Form(" WARNING (QC): fIntFlowSumOfEventWeightsVsM[%d][%d] is NULL in CheckPointersUsedInFinish() !!!!",ci,power)<<endl;
23991     cout<<endl;
23992     exit(0);   
23993    }
23994   } // end of for(Int_t power=0;power<2;power++) 
23995  } // end of for(Int_t ci=0;ci<=3;ci++) // correlation index
23996  for(Int_t i=0;i<6;i++)
23997  {
23998   if(!fIntFlowProductOfCorrelationsVsMPro[i])
23999   {
24000    cout<<endl;
24001    cout<<Form(" WARNING (QC): fIntFlowProductOfCorrelationsVsMPro[%d] is NULL in CheckPointersUsedInFinish() !!!!",i)<<endl;
24002    cout<<endl;
24003    exit(0); 
24004   }
24005   if(!fIntFlowSumOfProductOfEventWeightsVsM[i])
24006   {
24007    cout<<endl;
24008    cout<<Form(" WARNING (QC): fIntFlowSumOfProductOfEventWeightsVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",i)<<endl;
24009    cout<<endl;
24010    exit(0); 
24011   }
24012   if(!fIntFlowCovariancesVsM[i])
24013   {
24014    cout<<endl;
24015    cout<<Form(" WARNING (QC): fIntFlowCovariancesVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",i)<<endl;
24016    cout<<endl;
24017    exit(0); 
24018   }
24019  } // end of for(Int_t i=0;i<6;i++) 
24020  if(!fIntFlowRebinnedInM)
24021  {
24022   cout<<endl;
24023   cout<<" WARNING (QC): fIntFlowRebinnedInM is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24024   cout<<endl;
24025   exit(0); 
24026  }
24027  if(!fIntFlowQcumulantsRebinnedInM)
24028  {
24029   cout<<endl;
24030   cout<<" WARNING (QC): fIntFlowQcumulantsRebinnedInM is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24031   cout<<endl;
24032   exit(0); 
24033  }  
24034  
24035 } // end of void AliFlowAnalysisWithQCumulants::CheckPointersUsedInFinish()
24036
24037 //=======================================================================================================================
24038
24039 void AliFlowAnalysisWithQCumulants::CheckPointersUsedInMake()
24040 {
24041  // Check all pointers used in method Make(). // to be improved - check other pointers as well
24042  
24043  if(!fAvMultiplicity)
24044  {
24045   printf("\n WARNING (QC): fAvMultiplicity is NULL in CheckPointersUsedInMake() !!!!\n\n");
24046   exit(0);
24047  }
24048  if((fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights) && !fIntFlowExtraCorrelationsPro) 
24049  {
24050   printf("\n WARNING (QC): fIntFlowExtraCorrelationsPro is NULL in CheckPointersUsedInMake() !!!!\n\n");
24051   exit(0); 
24052  } 
24053  // 2D:
24054  if(fCalculate2DDiffFlow)
24055  {
24056   for(Int_t t=0;t<2;t++) // type = RP or POI
24057   { 
24058    for(Int_t rci=0;rci<4;rci++) // reduced correlation index
24059    {
24060     if(!f2DDiffFlowCorrelationsPro[t][rci])
24061     {
24062      printf("\n WARNING (QC): f2DDiffFlowCorrelationsPro[%i][%i] is NULL in CheckPointersUsedInMake() !!!!\n\n",t,rci);
24063      exit(0);     
24064     } // end of if(!f2DDiffFlowCorrelationsPro[t][rci])  
24065    } // end of for(Int_t rci=0;rci<4;rci++) // reduced correlation index
24066   } // end of for(Int_t t=0;t<2;t++)
24067  } // end of if(fCalculate2DDiffFlow)  
24068
24069 } // end of void AliFlowAnalysisWithQCumulants::CheckPointersUsedInMake()
24070  
24071