]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/FLOW/Base/AliFlowAnalysisWithQCumulants.cxx
Merge branch 'feature-movesplit'
[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  fExactNoRPs(0),
133  fUse2DHistograms(kFALSE),
134  fFillProfilesVsMUsingWeights(kTRUE),
135  fUseQvectorTerms(kFALSE),
136  fReQ(NULL),
137  fImQ(NULL),
138  fSpk(NULL),
139  fIntFlowCorrelationsEBE(NULL),
140  fIntFlowEventWeightsForCorrelationsEBE(NULL),
141  fIntFlowCorrelationsAllEBE(NULL),
142  fNumberOfRPsEBE(0.),
143  fNumberOfPOIsEBE(0.),
144  fReferenceMultiplicityEBE(0.),  
145  fAvMultiplicity(NULL),
146  fIntFlowCorrelationsPro(NULL),
147  fIntFlowSquaredCorrelationsPro(NULL),
148  fIntFlowCorrelationsAllPro(NULL),
149  fIntFlowExtraCorrelationsPro(NULL),
150  fIntFlowProductOfCorrelationsPro(NULL),
151  fIntFlowProductOfCorrectionTermsForNUAPro(NULL),
152  fIntFlowCorrelationsHist(NULL),
153  fIntFlowCorrelationsAllHist(NULL),
154  fIntFlowCovariances(NULL),
155  fIntFlowSumOfProductOfEventWeights(NULL),
156  fIntFlowCovariancesNUA(NULL),
157  fIntFlowSumOfProductOfEventWeightsNUA(NULL),
158  fIntFlowQcumulants(NULL),
159  fIntFlowQcumulantsRebinnedInM(NULL), 
160  fIntFlowQcumulantsErrorSquaredRatio(NULL), 
161  fIntFlow(NULL),
162  fIntFlowRebinnedInM(NULL),
163  fIntFlowDetectorBias(NULL),
164  // 4.) differential flow:
165  fDiffFlowList(NULL),
166  fDiffFlowProfiles(NULL),
167  fDiffFlowResults(NULL),
168  fDiffFlow2D(NULL),
169  fDiffFlowFlags(NULL),
170  fCalculateDiffFlow(kTRUE),
171  fCalculate2DDiffFlow(kFALSE),
172  fCalculateDiffFlowVsEta(kTRUE),
173  // 5.) other differential correlators:
174  fOtherDiffCorrelatorsList(NULL),
175  // 6.) distributions:
176  fDistributionsList(NULL),
177  fDistributionsFlags(NULL),
178  fStoreDistributions(kFALSE),
179  fnBinsForCorrelations(10000),
180  // 7.) various:
181  fVariousList(NULL),
182  fPhiDistributionForOneEvent(NULL),
183  // 8.) debugging and cross-checking:
184  fNestedLoopsList(NULL),
185  fEvaluateIntFlowNestedLoops(kFALSE),
186  fEvaluateDiffFlowNestedLoops(kFALSE),
187  fMaxAllowedMultiplicity(10),
188  fEvaluateNestedLoops(NULL),
189  fIntFlowDirectCorrelations(NULL),
190  fIntFlowExtraDirectCorrelations(NULL),
191  fCrossCheckInPtBinNo(10),
192  fCrossCheckInEtaBinNo(20),
193  fNoOfParticlesInBin(NULL),
194  fMixedHarmonicsNestedLoops(NULL),
195  // 9.) mixed harmonics: 
196  fMixedHarmonicsList(NULL),
197  fMixedHarmonicsProfiles(NULL),
198  fMixedHarmonicsResults(NULL),
199  fMixedHarmonicsErrorPropagation(NULL),
200  fMixedHarmonicsFlags(NULL),
201  fCalculateMixedHarmonics(kFALSE),
202  fCalculateMixedHarmonicsVsM(kFALSE),
203  f2pCorrelations(NULL),
204  f3pCorrelations(NULL),
205  f4pCorrelations(NULL),
206  f5pCorrelations(NULL),
207  f6pCorrelations(NULL),
208  f7pCorrelations(NULL),
209  f8pCorrelations(NULL),
210  f2pCumulants(NULL),
211  f3pCumulants(NULL),
212  f4pCumulants(NULL),
213  f5pCumulants(NULL),
214  f6pCumulants(NULL),
215  f7pCumulants(NULL),
216  f8pCumulants(NULL),
217  fMixedHarmonicProductOfEventWeights(NULL),
218  fMixedHarmonicProductOfCorrelations(NULL),
219  // 10.) Control histograms:
220  fControlHistogramsList(NULL), 
221  fControlHistogramsFlags(NULL),
222  fStoreControlHistograms(kFALSE),
223  fCorrelationNoRPsVsRefMult(NULL), 
224  fCorrelationNoPOIsVsRefMult(NULL),
225  fCorrelationNoRPsVsNoPOIs(NULL),
226  // 11.) Bootstrap:
227  fBootstrapList(NULL),
228  fBootstrapProfilesList(NULL),
229  fBootstrapResultsList(NULL),
230  fBootstrapFlags(NULL),
231  fUseBootstrap(kFALSE),
232  fUseBootstrapVsM(kFALSE),
233  fnSubsamples(10),
234  fRandom(NULL),
235  fBootstrapCorrelations(NULL),
236  fBootstrapCumulants(NULL)
237  {
238   // constructor  
239   
240   // base list to hold all output objects:
241   fHistList = new TList();
242   fHistList->SetName("cobjQC");
243   fHistList->SetOwner(kTRUE);
244   
245   // list to hold histograms with phi, pt and eta weights:      
246   fWeightsList = new TList();
247   
248   // multiplicity weight:
249   fMultiplicityWeight = new TString("combinations");
250
251   // analysis label;
252   fAnalysisLabel = new TString();
253       
254   // initialize all arrays:  
255   this->InitializeArraysForIntFlow();
256   this->InitializeArraysForDiffFlow();
257   this->InitializeArraysForDistributions();
258   this->InitializeArraysForVarious();
259   this->InitializeArraysForNestedLoops();
260   this->InitializeArraysForMixedHarmonics();
261   this->InitializeArraysForControlHistograms();
262   this->InitializeArraysForBootstrap();
263   
264  } // end of constructor
265  
266 //================================================================================================================  
267
268 AliFlowAnalysisWithQCumulants::~AliFlowAnalysisWithQCumulants()
269 {
270  // destructor
271  
272  delete fHistList;
273
274 } // end of AliFlowAnalysisWithQCumulants::~AliFlowAnalysisWithQCumulants()
275
276 //================================================================================================================
277
278 void AliFlowAnalysisWithQCumulants::Init()
279 {
280  // a) Cross check if the settings make sense before starting the QC adventure;
281  // b) Access all common constants;
282  // c) Book all objects;
283  // d) Store flags for integrated and differential flow;
284  // e) Store flags for distributions of corelations;
285  // f) Store harmonic which will be estimated;
286  // g) Store flags for mixed harmonics;
287  // h) Store flags for control histograms;
288  // i) Store bootstrap flags.
289   
290  //save old value and prevent histograms from being added to directory
291  //to avoid name clashes in case multiple analaysis objects are used
292  //in an analysis
293  Bool_t oldHistAddStatus = TH1::AddDirectoryStatus();
294  TH1::AddDirectory(kFALSE);
295  
296  // a) Cross check if the settings make sense before starting the QC adventure; 
297  this->CrossCheckSettings();
298  // b) Access all common constants and book a profile to hold them:
299  this->CommonConstants("Init");
300  // c) Book all objects:
301  this->BookAndFillWeightsHistograms(); 
302  this->BookAndNestAllLists();
303  this->BookCommonHistograms();
304  this->BookEverythingForIntegratedFlow(); 
305  this->BookEverythingForDifferentialFlow(); 
306  this->BookEverythingFor2DDifferentialFlow(); 
307  this->BookEverythingForDistributions();
308  this->BookEverythingForVarious();
309  this->BookEverythingForNestedLoops();
310  this->BookEverythingForMixedHarmonics();
311  this->BookEverythingForControlHistograms();
312  this->BookEverythingForBootstrap();
313
314  // d) Store flags for integrated and differential flow:
315  this->StoreIntFlowFlags();
316  this->StoreDiffFlowFlags();
317  // e) Store flags for distributions of corelations:
318  this->StoreFlagsForDistributions();
319  // f) Store harmonic which will be estimated:
320  this->StoreHarmonic();
321  // g) Store flags for mixed harmonics:
322  this->StoreMixedHarmonicsFlags();
323  // h) Store flags for control histograms:
324  this->StoreControlHistogramsFlags();
325  // i) Store bootstrap flags:
326  this->StoreBootstrapFlags();
327
328  TH1::AddDirectory(oldHistAddStatus);
329
330 } // end of void AliFlowAnalysisWithQCumulants::Init()
331
332 //================================================================================================================
333
334 void AliFlowAnalysisWithQCumulants::Make(AliFlowEventSimple* anEvent)
335 {
336  // Running over data only in this method.
337  
338  // a) Check all pointers used in this method;
339  // b) Define local variables;
340  // c) Fill the common control histograms and call the method to fill fAvMultiplicity;
341  // d) Loop over data and calculate e-b-e quantities Q_{n,k}, S_{p,k} and s_{p,k};
342  // e) Calculate the final expressions for S_{p,k} and s_{p,k} (important !!!!); 
343  // f) Call the methods which calculate correlations for reference flow;
344  // g) Call the methods which calculate correlations for differential flow;
345  // h) Call the methods which calculate correlations for 2D differential flow;
346  // i) Call the methods which calculate other differential correlators;
347  // j) Distributions of correlations;
348  // k) Store phi distribution for one event to illustrate flow;
349  // l) Cross-check with nested loops correlators for reference flow;
350  // m) Cross-check with nested loops correlators for differential flow;
351  // n) Reset all event-by-event quantities (very important !!!!). 
352
353  // a) Check all pointers used in this method:
354  this->CheckPointersUsedInMake();
355  
356  // b) Define local variables:
357  Double_t dPhi = 0.; // azimuthal angle in the laboratory frame
358  Double_t dPt  = 0.; // transverse momentum
359  Double_t dEta = 0.; // pseudorapidity
360  Double_t wPhi = 1.; // phi weight
361  Double_t wPt  = 1.; // pt weight
362  Double_t wEta = 1.; // eta weight
363  Double_t wTrack = 1.; // track weight
364  Int_t nCounterNoRPs = 0; // needed only for shuffling
365  fNumberOfRPsEBE = anEvent->GetNumberOfRPs(); // number of RPs (i.e. number of reference particles)
366  if(fExactNoRPs > 0 && fNumberOfRPsEBE<fExactNoRPs){return;}
367  fNumberOfPOIsEBE = anEvent->GetNumberOfPOIs(); // number of POIs (i.e. number of particles of interest)
368  fReferenceMultiplicityEBE = anEvent->GetReferenceMultiplicity(); // reference multiplicity for current event
369  //Printf("Reference multiplicity (QC): %.1f",fReferenceMultiplicityEBE);
370  Double_t ptEta[2] = {0.,0.}; // 0 = dPt, 1 = dEta
371   
372  // c) Fill the common control histograms and call the method to fill fAvMultiplicity:
373  this->FillCommonControlHistograms(anEvent);                                                               
374  this->FillAverageMultiplicities((Int_t)(fNumberOfRPsEBE)); 
375  if(fStoreControlHistograms){this->FillControlHistograms(anEvent);}                                                              
376                                                                                                                                                                                                                                                                                         
377  // d) Loop over data and calculate e-b-e quantities Q_{n,k}, S_{p,k} and s_{p,k}:
378  Int_t nPrim = anEvent->NumberOfTracks();  // nPrim = total number of primary tracks
379  AliFlowTrackSimple *aftsTrack = NULL;
380  Int_t n = fHarmonic; // shortcut for the harmonic 
381  for(Int_t i=0;i<nPrim;i++) 
382  { 
383   if(fExactNoRPs > 0 && nCounterNoRPs>fExactNoRPs){continue;}
384   aftsTrack=anEvent->GetTrack(i);
385   if(aftsTrack)
386   {
387    if(!(aftsTrack->InRPSelection() || aftsTrack->InPOISelection())){continue;} // safety measure: consider only tracks which are RPs or POIs
388    if(aftsTrack->InRPSelection()) // RP condition:
389    {    
390     nCounterNoRPs++;
391     dPhi = aftsTrack->Phi();
392     dPt  = aftsTrack->Pt();
393     dEta = aftsTrack->Eta();
394     if(fUsePhiWeights && fPhiWeights && fnBinsPhi) // determine phi weight for this particle:
395     {
396      wPhi = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*fnBinsPhi/TMath::TwoPi())));
397     }
398     if(fUsePtWeights && fPtWeights && fnBinsPt) // determine pt weight for this particle:
399     {
400      wPt = fPtWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-fPtMin)/fPtBinWidth))); 
401     }              
402     if(fUseEtaWeights && fEtaWeights && fEtaBinWidth) // determine eta weight for this particle: 
403     {
404      wEta = fEtaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-fEtaMin)/fEtaBinWidth))); 
405     }      
406     // Access track weight:
407     if(fUseTrackWeights)
408     {
409      wTrack = aftsTrack->Weight(); 
410     }
411     // Calculate Re[Q_{m*n,k}] and Im[Q_{m*n,k}] for this event (m = 1,2,...,12, k = 0,1,...,8):
412     for(Int_t m=0;m<12;m++) // to be improved - hardwired 6 
413     {
414      for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
415      {
416       (*fReQ)(m,k)+=pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1)*n*dPhi); 
417       (*fImQ)(m,k)+=pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1)*n*dPhi); 
418      } 
419     }
420     // Calculate S_{p,k} for this event (Remark: final calculation of S_{p,k} follows after the loop over data bellow):
421     for(Int_t p=0;p<8;p++)
422     {
423      for(Int_t k=0;k<9;k++)
424      {     
425       (*fSpk)(p,k)+=pow(wPhi*wPt*wEta*wTrack,k);
426      }
427     } 
428     // Differential flow:
429     if(fCalculateDiffFlow || fCalculate2DDiffFlow)
430     {
431      ptEta[0] = dPt; 
432      ptEta[1] = dEta; 
433      // Calculate r_{m*n,k} and s_{p,k} (r_{m,k} is 'p-vector' for RPs): 
434      for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
435      {
436       for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
437       {
438        if(fCalculateDiffFlow)
439        {
440         for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
441         {
442          fReRPQ1dEBE[0][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
443          fImRPQ1dEBE[0][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);          
444          if(m==0) // s_{p,k} does not depend on index m
445          {
446           fs1dEBE[0][pe][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k),1.);
447          } // end of if(m==0) // s_{p,k} does not depend on index m
448         } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
449        } // end of if(fCalculateDiffFlow) 
450        if(fCalculate2DDiffFlow)
451        {
452         fReRPQ2dEBE[0][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
453         fImRPQ2dEBE[0][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);      
454         if(m==0) // s_{p,k} does not depend on index m
455         {
456          fs2dEBE[0][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k),1.);
457         } // end of if(m==0) // s_{p,k} does not depend on index m
458        } // end of if(fCalculate2DDiffFlow)
459       } // end of for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
460      } // end of for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
461      // Checking if RP particle is also POI particle:      
462      if(aftsTrack->InPOISelection())
463      {
464       // Calculate q_{m*n,k} and s_{p,k} ('q-vector' and 's' for RPs && POIs): 
465       for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
466       {
467        for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
468        {
469         if(fCalculateDiffFlow)
470         {
471          for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
472          {
473           fReRPQ1dEBE[2][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
474           fImRPQ1dEBE[2][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);          
475           if(m==0) // s_{p,k} does not depend on index m
476           {
477            fs1dEBE[2][pe][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k),1.);
478           } // end of if(m==0) // s_{p,k} does not depend on index m
479          } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
480         } // end of if(fCalculateDiffFlow) 
481         if(fCalculate2DDiffFlow)
482         {
483          fReRPQ2dEBE[2][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
484          fImRPQ2dEBE[2][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);      
485          if(m==0) // s_{p,k} does not depend on index m
486          {
487           fs2dEBE[2][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k),1.);
488          } // end of if(m==0) // s_{p,k} does not depend on index m
489         } // end of if(fCalculate2DDiffFlow)
490        } // end of for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
491       } // end of for(Int_t k=0;k<9;k++) // to be improved - hardwired 9    
492      } // end of if(aftsTrack->InPOISelection())  
493     } // end of if(fCalculateDiffFlow || fCalculate2DDiffFlow)         
494    } // end of if(pTrack->InRPSelection())
495    if(aftsTrack->InPOISelection())
496    {
497     dPhi = aftsTrack->Phi();
498     dPt  = aftsTrack->Pt();
499     dEta = aftsTrack->Eta();
500     wPhi = 1.;
501     wPt  = 1.;
502     wEta = 1.;
503     wTrack = 1.;
504     if(fUsePhiWeights && fPhiWeights && fnBinsPhi && aftsTrack->InRPSelection()) // determine phi weight for POI && RP particle:
505     {
506      wPhi = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*fnBinsPhi/TMath::TwoPi())));
507     }
508     if(fUsePtWeights && fPtWeights && fnBinsPt && aftsTrack->InRPSelection()) // determine pt weight for POI && RP particle:
509     {
510      wPt = fPtWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-fPtMin)/fPtBinWidth))); 
511     }              
512     if(fUseEtaWeights && fEtaWeights && fEtaBinWidth && aftsTrack->InRPSelection()) // determine eta weight for POI && RP particle: 
513     {
514      wEta = fEtaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-fEtaMin)/fEtaBinWidth))); 
515     }      
516     // Access track weight for POI && RP particle:
517     if(aftsTrack->InRPSelection() && fUseTrackWeights)
518     {
519      wTrack = aftsTrack->Weight(); 
520     }
521     ptEta[0] = dPt;
522     ptEta[1] = dEta;
523     // Calculate p_{m*n,k} ('p-vector' for POIs): 
524     for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
525     {
526      for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
527      {
528       if(fCalculateDiffFlow)
529       {
530        for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
531        {
532         fReRPQ1dEBE[1][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
533         fImRPQ1dEBE[1][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);          
534        } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
535       } // end of if(fCalculateDiffFlow) 
536       if(fCalculate2DDiffFlow)
537       {
538        fReRPQ2dEBE[1][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
539        fImRPQ2dEBE[1][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);      
540       } // end of if(fCalculate2DDiffFlow)
541      } // end of for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
542     } // end of for(Int_t k=0;k<9;k++) // to be improved - hardwired 9    
543    } // end of if(pTrack->InPOISelection())    
544   } else // to if(aftsTrack)
545     {
546      printf("\n WARNING (QC): No particle (i.e. aftsTrack is a NULL pointer in AFAWQC::Make())!!!!\n\n");
547     }
548  } // end of for(Int_t i=0;i<nPrim;i++) 
549
550  // e) Calculate the final expressions for S_{p,k} and s_{p,k} (important !!!!):
551  for(Int_t p=0;p<8;p++)
552  {
553   for(Int_t k=0;k<9;k++)
554   {
555    (*fSpk)(p,k)=pow((*fSpk)(p,k),p+1);
556    // ... for the time being s_{p,k} dosn't need higher powers, so no need to finalize it here ...
557   } // end of for(Int_t k=0;k<9;k++)  
558  } // end of for(Int_t p=0;p<8;p++)
559  
560  // f) Call the methods which calculate correlations for reference flow:
561  if(!fEvaluateIntFlowNestedLoops)
562  {
563   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
564   {
565    if(fNumberOfRPsEBE>1){this->CalculateIntFlowCorrelations();} // without using particle weights
566   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
567     {
568      if(fNumberOfRPsEBE>1){this->CalculateIntFlowCorrelationsUsingParticleWeights();} // with using particle weights   
569     }        
570   // Whether or not using particle weights the following is calculated in the same way:  
571   if(fNumberOfRPsEBE>3){this->CalculateIntFlowProductOfCorrelations();}
572   if(fNumberOfRPsEBE>1){this->CalculateIntFlowSumOfEventWeights();}
573   if(fNumberOfRPsEBE>1){this->CalculateIntFlowSumOfProductOfEventWeights();}  
574   // Non-isotropic terms:
575   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
576   {
577    if(fNumberOfRPsEBE>0){this->CalculateIntFlowCorrectionsForNUASinTerms();}
578    if(fNumberOfRPsEBE>0){this->CalculateIntFlowCorrectionsForNUACosTerms();}
579   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
580     {
581      if(fNumberOfRPsEBE>0){this->CalculateIntFlowCorrectionsForNUASinTermsUsingParticleWeights();}
582      if(fNumberOfRPsEBE>0){this->CalculateIntFlowCorrectionsForNUACosTermsUsingParticleWeights();}     
583     }      
584   // Whether or not using particle weights the following is calculated in the same way:  
585   if(fNumberOfRPsEBE>0){this->CalculateIntFlowProductOfCorrectionTermsForNUA();}     
586   if(fNumberOfRPsEBE>0){this->CalculateIntFlowSumOfEventWeightsNUA();}     
587   if(fNumberOfRPsEBE>0){this->CalculateIntFlowSumOfProductOfEventWeightsNUA();}     
588   // Mixed harmonics:
589   if(fCalculateMixedHarmonics){this->CalculateMixedHarmonics();}
590  } // end of if(!fEvaluateIntFlowNestedLoops)
591
592  // g) Call the methods which calculate correlations for differential flow:
593  if(!fEvaluateDiffFlowNestedLoops && fCalculateDiffFlow)
594  {
595   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
596   {
597    // Without using particle weights:
598    this->CalculateDiffFlowCorrelations("RP","Pt"); 
599    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrelations("RP","Eta");}
600    this->CalculateDiffFlowCorrelations("POI","Pt");
601    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrelations("POI","Eta");}
602    // Non-isotropic terms:
603    this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Pt");
604    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Eta");}
605    this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Pt");
606    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Eta");}
607    this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Pt");
608    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Eta");}
609    this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Pt");
610    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Eta");}   
611   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
612     {
613      // With using particle weights:   
614      this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Pt"); 
615      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Eta");} 
616      this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Pt"); 
617      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Eta");} 
618      // Non-isotropic terms:
619      this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("RP","Pt");
620      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("RP","Eta");}
621      this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("POI","Pt");
622      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("POI","Eta");}
623      this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("RP","Pt");
624      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("RP","Eta");}
625      this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("POI","Pt");
626      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("POI","Eta");}   
627     }     
628   // Whether or not using particle weights the following is calculated in the same way:  
629   this->CalculateDiffFlowProductOfCorrelations("RP","Pt");
630   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowProductOfCorrelations("RP","Eta");}
631   this->CalculateDiffFlowProductOfCorrelations("POI","Pt");
632   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowProductOfCorrelations("POI","Eta");}
633   this->CalculateDiffFlowSumOfEventWeights("RP","Pt");
634   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowSumOfEventWeights("RP","Eta");}
635   this->CalculateDiffFlowSumOfEventWeights("POI","Pt");
636   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowSumOfEventWeights("POI","Eta");}
637   this->CalculateDiffFlowSumOfProductOfEventWeights("RP","Pt");
638   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowSumOfProductOfEventWeights("RP","Eta");}
639   this->CalculateDiffFlowSumOfProductOfEventWeights("POI","Pt");
640   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowSumOfProductOfEventWeights("POI","Eta");}   
641  } // end of if(!fEvaluateDiffFlowNestedLoops && fCalculateDiffFlow)
642
643  // h) Call the methods which calculate correlations for 2D differential flow:
644  if(!fEvaluateDiffFlowNestedLoops && fCalculate2DDiffFlow)
645  {
646   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
647   {
648    // Without using particle weights:
649    this->Calculate2DDiffFlowCorrelations("RP"); 
650    this->Calculate2DDiffFlowCorrelations("POI");
651    // Non-isotropic terms:
652    // ... to be ctd ...
653   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
654     {
655      // With using particle weights:   
656      // ... to be ctd ...  
657      // Non-isotropic terms:
658      // ... to be ctd ...
659     }     
660   // Whether or not using particle weights the following is calculated in the same way:  
661   // ... to be ctd ...   
662  } // end of if(!fEvaluateDiffFlowNestedLoops && fCalculate2DDiffFlow)
663  
664  // i) Call the methods which calculate other differential correlators:
665  if(!fEvaluateDiffFlowNestedLoops && fCalculateDiffFlow)
666  {
667   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
668   {
669    // Without using particle weights:
670    this->CalculateOtherDiffCorrelators("RP","Pt"); 
671    if(fCalculateDiffFlowVsEta){this->CalculateOtherDiffCorrelators("RP","Eta");}
672    this->CalculateOtherDiffCorrelators("POI","Pt"); 
673    if(fCalculateDiffFlowVsEta){this->CalculateOtherDiffCorrelators("POI","Eta");}     
674   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
675     {
676      // With using particle weights:   
677      // ... to be ctd ...  
678     }     
679   // Whether or not using particle weights the following is calculated in the same way:  
680   // ... to be ctd ...   
681  } // end of if(!fEvaluateDiffFlowNestedLoops)
682  
683  // j) Distributions of correlations:
684  if(fStoreDistributions){this->StoreDistributionsOfCorrelations();}
685  
686  // k) Store phi distribution for one event to illustrate flow: 
687  if(fStorePhiDistributionForOneEvent){this->StorePhiDistributionForOneEvent(anEvent);}
688    
689  // l) Cross-check with nested loops correlators for reference flow:
690  if(fEvaluateIntFlowNestedLoops){this->EvaluateIntFlowNestedLoops(anEvent);} 
691
692  // m) Cross-check with nested loops correlators for differential flow:
693  if(fEvaluateDiffFlowNestedLoops){this->EvaluateDiffFlowNestedLoops(anEvent);} 
694  
695  // n) Reset all event-by-event quantities (very important !!!!):
696  this->ResetEventByEventQuantities();
697  
698 } // end of AliFlowAnalysisWithQCumulants::Make(AliFlowEventSimple* anEvent)
699
700 //=======================================================================================================================
701
702 void AliFlowAnalysisWithQCumulants::Finish()
703 {
704  // Calculate the final results.
705
706  // a) Check all pointers used in this method;
707  // b) Access the constants;
708  // c) Access the flags;
709  // d) Calculate reference cumulants (not corrected for detector effects);
710  // e) Correct reference cumulants for detector effects;
711  // f) Calculate reference flow;
712  // g) Store results for reference flow in AliFlowCommonHistResults and print them on the screen;
713  // h) Calculate the final results for differential flow (without/with weights);
714  // i) Correct the results for differential flow (without/with weights) for effects of non-uniform acceptance (NUA);
715  // j) Calculate the final results for integrated flow (RP/POI) and store in AliFlowCommonHistResults;
716  // k) Store results for differential flow in AliFlowCommonHistResults;
717  // l) Print the final results for integrated flow (RP/POI) on the screen; 
718  // m) Cross-checking: Results from Q-vectors vs results from nested loops;
719  // i) Calculate cumulants for mixed harmonics;
720  // j) Calculate cumulants for bootstrap.
721
722  // a) Check all pointers used in this method:
723  this->CheckPointersUsedInFinish();
724   
725  // b) Access the constants:
726  this->CommonConstants("Finish");          
727  
728  if(fCommonHists && fCommonHists->GetHarmonic()) // to be improved (moved somewhere else)
729  {
730   fHarmonic = (Int_t)(fCommonHists->GetHarmonic())->GetBinContent(1);
731  } 
732  
733  // c) Access the flags: // tbi (implement a method for this? should I store again the flags because they can get modified with redoFinish?)
734  fUsePhiWeights = (Bool_t)fUseParticleWeights->GetBinContent(1); 
735  fUsePtWeights = (Bool_t)fUseParticleWeights->GetBinContent(2); 
736  fUseEtaWeights = (Bool_t)fUseParticleWeights->GetBinContent(3);  
737  fUseTrackWeights = (Bool_t)fUseParticleWeights->GetBinContent(4);  
738  fApplyCorrectionForNUA = (Bool_t)fIntFlowFlags->GetBinContent(3); 
739  fPrintFinalResults[0] = (Bool_t)fIntFlowFlags->GetBinContent(4);
740  fPrintFinalResults[1] = (Bool_t)fIntFlowFlags->GetBinContent(5);
741  fPrintFinalResults[2] = (Bool_t)fIntFlowFlags->GetBinContent(6);
742  fPrintFinalResults[3] = (Bool_t)fIntFlowFlags->GetBinContent(7);
743  fApplyCorrectionForNUAVsM = (Bool_t)fIntFlowFlags->GetBinContent(8);  
744  fPropagateErrorAlsoFromNIT = (Bool_t)fIntFlowFlags->GetBinContent(9);  
745  fCalculateCumulantsVsM = (Bool_t)fIntFlowFlags->GetBinContent(10); 
746  fMinimumBiasReferenceFlow = (Bool_t)fIntFlowFlags->GetBinContent(11); 
747  fForgetAboutCovariances = (Bool_t)fIntFlowFlags->GetBinContent(12);
748  fStorePhiDistributionForOneEvent = (Bool_t)fIntFlowFlags->GetBinContent(13);
749  fFillMultipleControlHistograms = (Bool_t)fIntFlowFlags->GetBinContent(14); 
750  fCalculateAllCorrelationsVsM = (Bool_t)fIntFlowFlags->GetBinContent(15);
751  fUse2DHistograms = (Bool_t)fIntFlowFlags->GetBinContent(18);
752  fFillProfilesVsMUsingWeights = (Bool_t)fIntFlowFlags->GetBinContent(19);
753  fUseQvectorTerms = (Bool_t)fIntFlowFlags->GetBinContent(20);
754  fEvaluateIntFlowNestedLoops = (Bool_t)fEvaluateNestedLoops->GetBinContent(1);
755  fEvaluateDiffFlowNestedLoops = (Bool_t)fEvaluateNestedLoops->GetBinContent(2); 
756  fCrossCheckInPtBinNo = (Int_t)fEvaluateNestedLoops->GetBinContent(3);
757  fCrossCheckInEtaBinNo = (Int_t)fEvaluateNestedLoops->GetBinContent(4); 
758  fCalculateMixedHarmonics = (Bool_t)fMixedHarmonicsFlags->GetBinContent(1);
759  //fHarmonic = (Int_t)fMixedHarmonicsFlags->GetBinContent(2); // TBI should I add inpdependent generic harmonic here?
760  fCalculateMixedHarmonicsVsM = (Bool_t)fMixedHarmonicsFlags->GetBinContent(3);
761  fUseBootstrap = (Bool_t)fBootstrapFlags->GetBinContent(1); 
762  fUseBootstrapVsM = (Bool_t)fBootstrapFlags->GetBinContent(2); 
763  fnSubsamples = (Int_t)fBootstrapFlags->GetBinContent(3); 
764
765  // d) Calculate reference cumulants (not corrected for detector effects):
766  this->FinalizeCorrelationsIntFlow();
767  this->CalculateCovariancesIntFlow();
768  this->CalculateCumulantsIntFlow();
769
770  // e) Correct reference cumulants for detector effects:
771  this->FinalizeCorrectionTermsForNUAIntFlow();
772  this->CalculateCovariancesNUAIntFlow(); 
773  this->CalculateQcumulantsCorrectedForNUAIntFlow();  
774
775  // f) Calculate reference flow:
776  this->CalculateReferenceFlow(); 
777   
778  // g) Store results for reference flow in AliFlowCommonHistResults and print them on the screen:
779  this->FillCommonHistResultsIntFlow();  
780  if(fPrintFinalResults[0]){this->PrintFinalResultsForIntegratedFlow("RF");}
781  if(fPrintFinalResults[3] && fCalculateCumulantsVsM){this->PrintFinalResultsForIntegratedFlow("RF, rebinned in M");}
782  
783  // h) Calculate the final results for differential flow (without/with weights):
784  if(fCalculateDiffFlow)
785  {
786   this->FinalizeReducedCorrelations("RP","Pt"); 
787   if(fCalculateDiffFlowVsEta){this->FinalizeReducedCorrelations("RP","Eta");} 
788   this->FinalizeReducedCorrelations("POI","Pt"); 
789   if(fCalculateDiffFlowVsEta){this->FinalizeReducedCorrelations("POI","Eta");}
790   this->CalculateDiffFlowCovariances("RP","Pt");
791   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCovariances("RP","Eta");}
792   this->CalculateDiffFlowCovariances("POI","Pt");
793   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCovariances("POI","Eta");}
794   this->CalculateDiffFlowCumulants("RP","Pt");
795   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCumulants("RP","Eta");}
796   this->CalculateDiffFlowCumulants("POI","Pt");
797   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCumulants("POI","Eta");}
798   this->CalculateDiffFlow("RP","Pt");
799   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlow("RP","Eta");}
800   this->CalculateDiffFlow("POI","Pt");
801   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlow("POI","Eta");}
802  } // if(fCalculateDiffFlow)
803  
804  // i) Correct the results for differential flow (without/with weights) for effects of non-uniform acceptance (NUA):
805  if(fCalculateDiffFlow)
806  {
807   this->FinalizeCorrectionTermsForNUADiffFlow("RP","Pt");
808   if(fCalculateDiffFlowVsEta){this->FinalizeCorrectionTermsForNUADiffFlow("RP","Eta");}
809   this->FinalizeCorrectionTermsForNUADiffFlow("POI","Pt");
810   if(fCalculateDiffFlowVsEta){this->FinalizeCorrectionTermsForNUADiffFlow("POI","Eta");}      
811   this->CalculateDiffFlowCumulantsCorrectedForNUA("RP","Pt");   
812   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCumulantsCorrectedForNUA("RP","Eta");}   
813   this->CalculateDiffFlowCumulantsCorrectedForNUA("POI","Pt");   
814   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCumulantsCorrectedForNUA("POI","Eta");}  
815   if(fApplyCorrectionForNUA)
816   {
817    this->CalculateDiffFlowCorrectedForNUA("RP","Pt"); 
818    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectedForNUA("RP","Eta");} 
819    this->CalculateDiffFlowCorrectedForNUA("POI","Pt"); 
820    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectedForNUA("POI","Eta");} 
821   }
822  } // end of if(fCalculateDiffFlow && fApplyCorrectionForNUA)
823  
824  // i) Calcualate final results for 2D differential flow: 
825  if(fCalculate2DDiffFlow)
826  {
827   this->Calculate2DDiffFlowCumulants("RP");
828   this->Calculate2DDiffFlowCumulants("POI");
829   this->Calculate2DDiffFlow("RP");  
830   this->Calculate2DDiffFlow("POI");  
831  } // end of if(fCalculate2DDiffFlow)
832     
833  // j) Calculate the final results for integrated flow (RP/POI) and store in AliFlowCommonHistResults:
834  if(fCalculateDiffFlow)
835  {
836   this->CalculateFinalResultsForRPandPOIIntegratedFlow("RP");
837   this->CalculateFinalResultsForRPandPOIIntegratedFlow("POI");
838  }
839  
840  // k) Store results for differential flow in AliFlowCommonHistResults:
841  if(fCalculateDiffFlow)
842  {
843   this->FillCommonHistResultsDiffFlow("RP");
844   this->FillCommonHistResultsDiffFlow("POI");
845  }
846  
847  // l) Print the final results for integrated flow (RP/POI) on the screen:
848  if(fPrintFinalResults[1] && fCalculateDiffFlow){this->PrintFinalResultsForIntegratedFlow("RP");} 
849  if(fPrintFinalResults[2] && fCalculateDiffFlow){this->PrintFinalResultsForIntegratedFlow("POI");}
850     
851  // m) Cross-checking: Results from Q-vectors vs results from nested loops:
852  //  m1) Reference flow:
853  if(fEvaluateIntFlowNestedLoops)
854  {
855   this->CrossCheckIntFlowCorrelations();
856   this->CrossCheckIntFlowCorrectionTermsForNUA(); 
857   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights){this->CrossCheckIntFlowExtraCorrelations();}
858   if(fCalculateMixedHarmonics){this->CrossCheckIntFlowCorrelations();}     
859  } // end of if(fEvaluateIntFlowNestedLoops)  
860  //  m2) Differential flow: 
861  if(fEvaluateDiffFlowNestedLoops && fCalculateDiffFlow) 
862  {
863   // Correlations:
864   this->PrintNumberOfParticlesInSelectedBin();
865   this->CrossCheckDiffFlowCorrelations("RP","Pt");  
866   if(fCalculateDiffFlowVsEta){this->CrossCheckDiffFlowCorrelations("RP","Eta");} 
867   this->CrossCheckDiffFlowCorrelations("POI","Pt");  
868   if(fCalculateDiffFlowVsEta){this->CrossCheckDiffFlowCorrelations("POI","Eta");}
869   // Correction terms for non-uniform acceptance:
870   this->CrossCheckDiffFlowCorrectionTermsForNUA("RP","Pt");      
871   if(fCalculateDiffFlowVsEta){this->CrossCheckDiffFlowCorrectionTermsForNUA("RP","Eta");}       
872   this->CrossCheckDiffFlowCorrectionTermsForNUA("POI","Pt");      
873   if(fCalculateDiffFlowVsEta){this->CrossCheckDiffFlowCorrectionTermsForNUA("POI","Eta");}
874   // Other differential correlators:       
875   this->CrossCheckOtherDiffCorrelators("RP","Pt");  
876   if(fCalculateDiffFlowVsEta){this->CrossCheckOtherDiffCorrelators("RP","Eta");} 
877   this->CrossCheckOtherDiffCorrelators("POI","Pt");  
878   if(fCalculateDiffFlowVsEta){this->CrossCheckOtherDiffCorrelators("POI","Eta");}
879  } // end of if(fEvaluateDiffFlowNestedLoops)
880                                                                                 
881  // i) Calculate cumulants for mixed harmonics: 
882  if(fCalculateMixedHarmonics){this->CalculateCumulantsMixedHarmonics();} 
883
884  // j) Calculate cumulants for bootstrap:
885  if(fUseBootstrap||fUseBootstrapVsM){this->CalculateCumulantsForBootstrap();} 
886
887 } // end of AliFlowAnalysisWithQCumulants::Finish()
888
889 //=======================================================================================================================
890
891 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowNestedLoops(AliFlowEventSimple* anEvent)
892 {
893  // Evaluate all correlators for reference flow with nested loops.
894  
895  Int_t nPrim = anEvent->NumberOfTracks(); // number of primaries
896  if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity) // by default fMaxAllowedMultiplicity = 10 
897  {
898   // Without using particle weights:
899   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
900   {
901    // Correlations:
902    this->CalculateIntFlowCorrelations(); // from Q-vectors
903    this->EvaluateIntFlowCorrelationsWithNestedLoops(anEvent); // from nested loops (TBI: do I have to pass here anEvent or not?)
904    // Correction for non-uniform acceptance:
905    this->CalculateIntFlowCorrectionsForNUASinTerms(); // from Q-vectors (sin terms)
906    this->CalculateIntFlowCorrectionsForNUACosTerms(); // from Q-vectors (cos terms)
907    this->EvaluateIntFlowCorrectionsForNUAWithNestedLoops(anEvent); // from nested loops (both sin and cos terms)
908    // Mixed harmonics:
909    if(fCalculateMixedHarmonics)
910    {
911     this->CalculateMixedHarmonics(); // from Q-vectors  
912     this->EvaluateMixedHarmonicsWithNestedLoops(anEvent); // from nested loops (TBI: do I have to pass here anEvent or not?)
913    } // end of if(fCalculateMixedHarmonics)
914   }
915   // Using particle weights:
916   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
917   {
918    // Correlations
919    this->CalculateIntFlowCorrelationsUsingParticleWeights(); // from Q-vectors
920    this->EvaluateIntFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent); // from nested loops (to be improved: do I have to pass here anEvent or not?)
921    // Correction for non-uniform acceptance:
922    this->CalculateIntFlowCorrectionsForNUASinTermsUsingParticleWeights(); // from Q-vectors (sin terms)
923    this->CalculateIntFlowCorrectionsForNUACosTermsUsingParticleWeights(); // from Q-vectors (cos terms)
924    this->EvaluateIntFlowCorrectionsForNUAWithNestedLoopsUsingParticleWeights(anEvent); // from nested loops (both sin and cos terms)   
925   }
926  } else if(nPrim>fMaxAllowedMultiplicity) // to if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity)
927    {
928     cout<<endl;
929     cout<<"Skipping the event because multiplicity is "<<nPrim<<". Too high to evaluate nested loops!"<<endl;
930    } else
931      {
932       cout<<endl;
933       cout<<"Skipping the event because multiplicity is "<<nPrim<<"."<<endl;      
934      } 
935
936 } // end of void AliFlowAnalysisWithQCumulants::EvaluateIntFlowNestedLoops(AliFlowEventSimple* anEvent)
937
938 //=======================================================================================================================
939
940 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowNestedLoops(AliFlowEventSimple* anEvent)
941 {
942  // Evalauted all correlators for differential flow with nested loops.
943
944  if(!fCalculateDiffFlow){return;}
945
946  Int_t nPrim = anEvent->NumberOfTracks(); // number of primaries
947  if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity) // by default fMaxAllowedMultiplicity = 10
948  {
949   // Without using particle weights:
950   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
951   {
952    // 1.) Reduced correlations:
953    //  Q-vectors:
954    this->CalculateDiffFlowCorrelations("RP","Pt");
955    this->CalculateDiffFlowCorrelations("RP","Eta");
956    this->CalculateDiffFlowCorrelations("POI","Pt");
957    this->CalculateDiffFlowCorrelations("POI","Eta");
958    //  Nested loops:
959    this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"RP","Pt"); 
960    this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"RP","Eta"); 
961    this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"POI","Pt"); 
962    this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"POI","Eta"); 
963    // 2.) Reduced corrections for non-uniform acceptance:
964    //  Q-vectors:
965    this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Pt");
966    this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Eta");
967    this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Pt");
968    this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Eta");
969    this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Pt");
970    this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Eta");
971    this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Pt");
972    this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Eta");
973    //  Nested loops:
974    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"RP","Pt");
975    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"RP","Eta");
976    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"POI","Pt"); 
977    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"POI","Eta"); 
978    // 3.) Other differential correlators:
979    //  Q-vectors:
980    this->CalculateOtherDiffCorrelators("RP","Pt");
981    this->CalculateOtherDiffCorrelators("RP","Eta");
982    this->CalculateOtherDiffCorrelators("POI","Pt");
983    this->CalculateOtherDiffCorrelators("POI","Eta");   
984    //  Nested loops:
985    this->EvaluateOtherDiffCorrelatorsWithNestedLoops(anEvent,"RP","Pt");
986    this->EvaluateOtherDiffCorrelatorsWithNestedLoops(anEvent,"RP","Eta");
987    this->EvaluateOtherDiffCorrelatorsWithNestedLoops(anEvent,"POI","Pt");
988    this->EvaluateOtherDiffCorrelatorsWithNestedLoops(anEvent,"POI","Eta");   
989   } // end of if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
990   // Using particle weights:
991   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
992   {
993    this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Pt"); 
994    this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Eta"); 
995    this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Pt"); 
996    this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Eta"); 
997    this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("RP","Pt");
998    this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("RP","Eta");
999    this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("POI","Pt");
1000    this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("POI","Eta");
1001    this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("RP","Pt");
1002    this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("RP","Eta");
1003    this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("POI","Pt");
1004    this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("POI","Eta");
1005    this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"RP","Pt"); 
1006    this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"RP","Eta");
1007    this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"POI","Pt"); 
1008    this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"POI","Eta");   
1009    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(anEvent,"RP","Pt"); 
1010    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(anEvent,"RP","Eta"); 
1011    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(anEvent,"POI","Pt"); 
1012    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(anEvent,"POI","Eta"); 
1013   } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
1014  } // end of if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity) // by default fMaxAllowedMultiplicity = 10
1015
1016 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowNestedLoops(AliFlowEventSimple* anEvent)
1017
1018 //=======================================================================================================================
1019
1020 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTerms()
1021 {
1022  // Calculate correction terms for non-uniform acceptance of the detector for reference flow (cos terms).
1023  
1024  // multiplicity:
1025  Double_t dMult = (*fSpk)(0,0);
1026  
1027  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
1028  Double_t dReQ1n = (*fReQ)(0,0);
1029  Double_t dReQ2n = (*fReQ)(1,0);
1030  //Double_t dReQ3n = (*fReQ)(2,0);
1031  //Double_t dReQ4n = (*fReQ)(3,0);
1032  Double_t dImQ1n = (*fImQ)(0,0);
1033  Double_t dImQ2n = (*fImQ)(1,0);
1034  //Double_t dImQ3n = (*fImQ)(2,0);
1035  //Double_t dImQ4n = (*fImQ)(3,0);
1036
1037  // Multiplicity bin of an event (relevant for all histos vs M): 
1038  Double_t dMultiplicityBin = 0.;
1039  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
1040  {
1041   dMultiplicityBin = fNumberOfRPsEBE+0.5;
1042  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
1043    {
1044     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
1045    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
1046      {
1047       dMultiplicityBin = fNumberOfPOIsEBE+0.5;
1048      } 
1049
1050  //                                  *************************************************************
1051  //                                  **** corrections for non-uniform acceptance (cos terms): ****
1052  //                                  *************************************************************
1053  //
1054  // Remark 1: corrections for non-uniform acceptance (cos terms) calculated with non-weighted Q-vectors 
1055  //           are stored in 1D profile fQCorrectionsCos.
1056  // Remark 2: binning of fIntFlowCorrectionTermsForNUAPro[1] is organized as follows:
1057  // --------------------------------------------------------------------------------------------------------------------
1058  // 1st bin: <<cos(n*(phi1))>> = cosP1n
1059  // 2nd bin: <<cos(n*(phi1+phi2))>> = cosP1nP1n
1060  // 3rd bin: <<cos(n*(phi1-phi2-phi3))>> = cosP1nM1nM1n
1061  // 4th bin: <<cos(n*(2phi1-phi2))>> = cosP2nM1n
1062  // --------------------------------------------------------------------------------------------------------------------
1063   
1064  // 1-particle:
1065  Double_t cosP1n = 0.; // <<cos(n*(phi1))>>
1066    
1067  if(dMult>0)
1068  {
1069   cosP1n = dReQ1n/dMult; 
1070   
1071   // average non-weighted 1-particle correction (cos terms) for non-uniform acceptance for single event:
1072   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(1,cosP1n);
1073   // event weights for NUA terms:
1074   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->SetBinContent(1,dMult);
1075   
1076   // final average non-weighted 1-particle correction (cos terms) for non-uniform acceptance for all events:
1077   fIntFlowCorrectionTermsForNUAPro[1]->Fill(0.5,cosP1n,dMult);  
1078   if(fCalculateCumulantsVsM){fIntFlowCorrectionTermsForNUAVsMPro[1][0]->Fill(dMultiplicityBin,cosP1n,dMult);}    
1079  } 
1080  
1081  // 2-particle:
1082  Double_t cosP1nP1n = 0.; // <<cos(n*(phi1+phi2))>>
1083  Double_t cosP2nM1n = 0.; // <<cos(n*(2phi1-phi2))>>
1084  
1085  if(dMult>1)
1086  {
1087   cosP1nP1n = (pow(dReQ1n,2)-pow(dImQ1n,2)-dReQ2n)/(dMult*(dMult-1)); 
1088   cosP2nM1n = (dReQ2n*dReQ1n+dImQ2n*dImQ1n-dReQ1n)/(dMult*(dMult-1)); 
1089   
1090   // average non-weighted 2-particle correction (cos terms) for non-uniform acceptance for single event:
1091   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(2,cosP1nP1n);
1092   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(4,cosP2nM1n);
1093   // event weights for NUA terms:
1094   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->SetBinContent(2,dMult*(dMult-1));
1095   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->SetBinContent(4,dMult*(dMult-1));
1096       
1097   // final average non-weighted 2-particle correction (cos terms) for non-uniform acceptance for all events:
1098   fIntFlowCorrectionTermsForNUAPro[1]->Fill(1.5,cosP1nP1n,dMult*(dMult-1));  
1099   fIntFlowCorrectionTermsForNUAPro[1]->Fill(3.5,cosP2nM1n,dMult*(dMult-1));
1100   if(fCalculateCumulantsVsM)
1101   {
1102    fIntFlowCorrectionTermsForNUAVsMPro[1][1]->Fill(dMultiplicityBin,cosP1nP1n,dMult*(dMult-1));  
1103    fIntFlowCorrectionTermsForNUAVsMPro[1][3]->Fill(dMultiplicityBin,cosP2nM1n,dMult*(dMult-1));
1104   }
1105  } 
1106  
1107  // 3-particle:
1108  Double_t cosP1nM1nM1n = 0.; // <<cos(n*(phi1-phi2-phi3))>>
1109  
1110  if(dMult>2)
1111  {
1112   cosP1nM1nM1n = (dReQ1n*(pow(dReQ1n,2)+pow(dImQ1n,2))-dReQ1n*dReQ2n-dImQ1n*dImQ2n-2.*(dMult-1)*dReQ1n)
1113                / (dMult*(dMult-1)*(dMult-2)); 
1114   
1115   // average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for single event:
1116   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(3,cosP1nM1nM1n);
1117   // event weights for NUA terms:
1118   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->SetBinContent(3,dMult*(dMult-1)*(dMult-2));
1119   
1120   // final average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for all events:
1121   fIntFlowCorrectionTermsForNUAPro[1]->Fill(2.5,cosP1nM1nM1n,dMult*(dMult-1)*(dMult-2));
1122   if(fCalculateCumulantsVsM){fIntFlowCorrectionTermsForNUAVsMPro[1][2]->Fill(dMultiplicityBin,cosP1nM1nM1n,dMult*(dMult-1)*(dMult-2));}  
1123  } 
1124  
1125 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTerms()
1126
1127 //=======================================================================================================================
1128
1129 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTerms()
1130 {
1131  // calculate corrections for non-uniform acceptance of the detector for no-name integrated flow (sin terms)
1132  
1133  // multiplicity:
1134  Double_t dMult = (*fSpk)(0,0);
1135  
1136  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
1137  Double_t dReQ1n = (*fReQ)(0,0);
1138  Double_t dReQ2n = (*fReQ)(1,0);
1139  //Double_t dReQ3n = (*fReQ)(2,0);
1140  //Double_t dReQ4n = (*fReQ)(3,0);
1141  Double_t dImQ1n = (*fImQ)(0,0);
1142  Double_t dImQ2n = (*fImQ)(1,0);
1143  //Double_t dImQ3n = (*fImQ)(2,0);
1144  //Double_t dImQ4n = (*fImQ)(3,0);
1145         
1146  // Multiplicity bin of an event (relevant for all histos vs M): 
1147  Double_t dMultiplicityBin = 0.;
1148  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
1149  {
1150   dMultiplicityBin = fNumberOfRPsEBE+0.5;
1151  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
1152    {
1153     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
1154    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
1155      {
1156       dMultiplicityBin = fNumberOfPOIsEBE+0.5;
1157      } 
1158
1159  //                                  *************************************************************
1160  //                                  **** corrections for non-uniform acceptance (sin terms): ****
1161  //                                  *************************************************************
1162  //
1163  // Remark 1: corrections for non-uniform acceptance (sin terms) calculated with non-weighted Q-vectors 
1164  //           are stored in 1D profile fQCorrectionsSin.
1165  // Remark 2: binning of fIntFlowCorrectionTermsForNUAPro[0] is organized as follows:
1166  // --------------------------------------------------------------------------------------------------------------------
1167  // 1st bin: <<sin(n*(phi1))>> = sinP1n
1168  // 2nd bin: <<sin(n*(phi1+phi2))>> = sinP1nP1n
1169  // 3rd bin: <<sin(n*(phi1-phi2-phi3))>> = sinP1nM1nM1n
1170  // 4th bin: <<sin(n*(2phi1-phi2))>> = sinP2nM1n
1171  // --------------------------------------------------------------------------------------------------------------------
1172  
1173  // 1-particle:
1174  Double_t sinP1n = 0.; // <sin(n*(phi1))>
1175  
1176  if(dMult>0)
1177  {
1178   sinP1n = dImQ1n/dMult; 
1179      
1180   // average non-weighted 1-particle correction (sin terms) for non-uniform acceptance for single event:
1181   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(1,sinP1n);  
1182   // event weights for NUA terms:
1183   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->SetBinContent(1,dMult);
1184   
1185   // final average non-weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:   
1186   fIntFlowCorrectionTermsForNUAPro[0]->Fill(0.5,sinP1n,dMult);  
1187   if(fCalculateCumulantsVsM){fIntFlowCorrectionTermsForNUAVsMPro[0][0]->Fill(dMultiplicityBin,sinP1n,dMult);} 
1188  } 
1189  
1190  // 2-particle:
1191  Double_t sinP1nP1n = 0.; // <<sin(n*(phi1+phi2))>>
1192  Double_t sinP2nM1n = 0.; // <<sin(n*(2phi1-phi2))>>
1193  if(dMult>1)
1194  {
1195   sinP1nP1n = (2.*dReQ1n*dImQ1n-dImQ2n)/(dMult*(dMult-1)); 
1196   sinP2nM1n = (dImQ2n*dReQ1n-dReQ2n*dImQ1n-dImQ1n)/(dMult*(dMult-1)); 
1197      
1198   // average non-weighted 2-particle correction (sin terms) for non-uniform acceptance for single event:
1199   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(2,sinP1nP1n);
1200   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(4,sinP2nM1n);
1201   // event weights for NUA terms:
1202   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->SetBinContent(2,dMult*(dMult-1));
1203   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->SetBinContent(4,dMult*(dMult-1));
1204   
1205   // final average non-weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:      
1206   fIntFlowCorrectionTermsForNUAPro[0]->Fill(1.5,sinP1nP1n,dMult*(dMult-1));  
1207   fIntFlowCorrectionTermsForNUAPro[0]->Fill(3.5,sinP2nM1n,dMult*(dMult-1));  
1208   if(fCalculateCumulantsVsM)
1209   {
1210    fIntFlowCorrectionTermsForNUAVsMPro[0][1]->Fill(dMultiplicityBin,sinP1nP1n,dMult*(dMult-1));  
1211    fIntFlowCorrectionTermsForNUAVsMPro[0][3]->Fill(dMultiplicityBin,sinP2nM1n,dMult*(dMult-1));    
1212   }
1213  } 
1214  
1215  // 3-particle:
1216  Double_t sinP1nM1nM1n = 0.; // <<sin(n*(phi1-phi2-phi3))>>
1217  
1218  if(dMult>2)
1219  {
1220   sinP1nM1nM1n = (-dImQ1n*(pow(dReQ1n,2)+pow(dImQ1n,2))+dReQ1n*dImQ2n-dImQ1n*dReQ2n+2.*(dMult-1)*dImQ1n)
1221                / (dMult*(dMult-1)*(dMult-2)); 
1222   
1223   // average non-weighted 3-particle correction (sin terms) for non-uniform acceptance for single event:
1224   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(3,sinP1nM1nM1n);
1225   // event weights for NUA terms:
1226   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->SetBinContent(3,dMult*(dMult-1)*(dMult-2));
1227   
1228   // final average non-weighted 3-particle correction (sin terms) for non-uniform acceptance for all events:  
1229   fIntFlowCorrectionTermsForNUAPro[0]->Fill(2.5,sinP1nM1nM1n,dMult*(dMult-1)*(dMult-2));
1230   if(fCalculateCumulantsVsM){fIntFlowCorrectionTermsForNUAVsMPro[0][2]->Fill(dMultiplicityBin,sinP1nM1nM1n,dMult*(dMult-1)*(dMult-2));}  
1231  } 
1232  
1233 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTerms()
1234
1235 //=======================================================================================================================
1236
1237 void AliFlowAnalysisWithQCumulants::GetOutputHistograms(TList *outputListHistos)
1238 {
1239  // a) Get pointers for common control and common result histograms;
1240  // b) Get pointers for histograms holding particle weights;
1241  // c) Get pointers for reference flow histograms;
1242  // d) Get pointers for differential flow histograms;
1243  // e) Get pointers for 2D differential flow histograms;
1244  // f) Get pointers for other differential correlators;
1245  // g) Get pointers for mixed harmonics histograms;
1246  // h) Get pointers for nested loops' histograms;
1247  // i) Get pointers for control histograms;
1248  // j) Get pointers for bootstrap.
1249  
1250  if(outputListHistos)
1251  {      
1252   this->SetHistList(outputListHistos);
1253   if(!fHistList)
1254   {
1255    printf("\n WARNING (QC): fHistList is NULL in AFAWQC::GOH() !!!!\n\n");
1256    exit(0);
1257   }
1258   this->GetPointersForCommonHistograms(); 
1259   this->GetPointersForParticleWeightsHistograms(); 
1260   this->GetPointersForIntFlowHistograms();
1261   this->GetPointersForDiffFlowHistograms(); 
1262   this->GetPointersFor2DDiffFlowHistograms(); 
1263   this->GetPointersForOtherDiffCorrelators();  
1264   this->GetPointersForMixedHarmonicsHistograms(); 
1265   this->GetPointersForNestedLoopsHistograms(); 
1266   this->GetPointersForControlHistograms();
1267   this->GetPointersForBootstrap();
1268  } else 
1269    {
1270     printf("\n WARNING (QC): outputListHistos is NULL in AFAWQC::GOH() !!!!\n\n");
1271     exit(0);
1272    }
1273    
1274 } // end of void AliFlowAnalysisWithQCumulants::GetOutputHistograms(TList *outputListHistos)
1275
1276 //=======================================================================================================================
1277
1278 TProfile* AliFlowAnalysisWithQCumulants::MakePtProjection(TProfile2D *profilePtEta) const
1279 {
1280  // project 2D profile onto pt axis to get 1D profile
1281  
1282  Int_t nBinsPt   = profilePtEta->GetNbinsX();
1283  Double_t dPtMin = (profilePtEta->GetXaxis())->GetXmin();
1284  Double_t dPtMax = (profilePtEta->GetXaxis())->GetXmax();
1285  
1286  Int_t nBinsEta   = profilePtEta->GetNbinsY();
1287  
1288  TProfile *profilePt = new TProfile("","",nBinsPt,dPtMin,dPtMax); 
1289  
1290  for(Int_t p=1;p<=nBinsPt;p++)
1291  {
1292   Double_t contentPt = 0.;
1293   Double_t entryPt = 0.;
1294   Double_t spreadPt = 0.;
1295   Double_t sum1 = 0.;
1296   Double_t sum2 = 0.;
1297   Double_t sum3 = 0.;
1298   for(Int_t e=1;e<=nBinsEta;e++)
1299   {
1300    contentPt += (profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)))
1301               * (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1302    entryPt   += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1303    
1304    sum1 += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)))
1305          * (pow(profilePtEta->GetBinError(profilePtEta->GetBin(p,e)),2.)
1306             + pow(profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)),2.)); 
1307    sum2 += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1308    sum3 += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)))
1309          * (profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)));            
1310   }
1311   if(sum2>0. && sum1/sum2-pow(sum3/sum2,2.) > 0.)
1312   {
1313    spreadPt = pow(sum1/sum2-pow(sum3/sum2,2.),0.5);
1314   }
1315   profilePt->SetBinContent(p,contentPt);
1316   profilePt->SetBinEntries(p,entryPt);
1317   {
1318    profilePt->SetBinError(p,spreadPt);
1319   }
1320   
1321  }
1322  
1323  return profilePt;
1324  
1325 } // end of TProfile* AliFlowAnalysisWithQCumulants::MakePtProjection(TProfile2D *profilePtEta)
1326
1327
1328 //=======================================================================================================================
1329
1330
1331 TProfile* AliFlowAnalysisWithQCumulants::MakeEtaProjection(TProfile2D *profilePtEta) const
1332 {
1333  // project 2D profile onto eta axis to get 1D profile
1334  
1335  Int_t nBinsEta   = profilePtEta->GetNbinsY();
1336  Double_t dEtaMin = (profilePtEta->GetYaxis())->GetXmin();
1337  Double_t dEtaMax = (profilePtEta->GetYaxis())->GetXmax();
1338  
1339  Int_t nBinsPt = profilePtEta->GetNbinsX();
1340  
1341  TProfile *profileEta = new TProfile("","",nBinsEta,dEtaMin,dEtaMax); 
1342  
1343  for(Int_t e=1;e<=nBinsEta;e++)
1344  {
1345   Double_t contentEta = 0.;
1346   Double_t entryEta = 0.;
1347   for(Int_t p=1;p<=nBinsPt;p++)
1348   {
1349    contentEta += (profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)))
1350               * (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1351    entryEta   += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1352   }
1353   profileEta->SetBinContent(e,contentEta);
1354   profileEta->SetBinEntries(e,entryEta);
1355  }
1356  
1357  return profileEta;
1358  
1359 } // end of TProfile* AliFlowAnalysisWithQCumulants::MakeEtaProjection(TProfile2D *profilePtEta)
1360
1361 //=======================================================================================================================
1362
1363 void AliFlowAnalysisWithQCumulants::PrintFinalResultsForIntegratedFlow(TString type)
1364 {
1365  // Printing on the screen the final results for integrated flow (RF, POI and RP). 
1366  
1367  Int_t n = fHarmonic; 
1368  
1369  Double_t dVn[4] = {0.}; // array to hold Vn{2}, Vn{4}, Vn{6} and Vn{8}   
1370  Double_t dVnErr[4] = {0.}; // array to hold errors of Vn{2}, Vn{4}, Vn{6} and Vn{8}   
1371  
1372  if(type == "RF")
1373  {
1374   for(Int_t b=0;b<4;b++)
1375   {
1376    dVn[0] = (fCommonHistsResults2nd->GetHistIntFlow())->GetBinContent(1); 
1377    dVnErr[0] = (fCommonHistsResults2nd->GetHistIntFlow())->GetBinError(1); 
1378    dVn[1] = (fCommonHistsResults4th->GetHistIntFlow())->GetBinContent(1); 
1379    dVnErr[1] = (fCommonHistsResults4th->GetHistIntFlow())->GetBinError(1); 
1380    dVn[2] = (fCommonHistsResults6th->GetHistIntFlow())->GetBinContent(1); 
1381    dVnErr[2] = (fCommonHistsResults6th->GetHistIntFlow())->GetBinError(1); 
1382    dVn[3] = (fCommonHistsResults8th->GetHistIntFlow())->GetBinContent(1); 
1383    dVnErr[3] = (fCommonHistsResults8th->GetHistIntFlow())->GetBinError(1);    
1384   }  
1385  } else if(type == "RP")
1386    {
1387     dVn[0] = (fCommonHistsResults2nd->GetHistIntFlowRP())->GetBinContent(1); 
1388     dVnErr[0] = (fCommonHistsResults2nd->GetHistIntFlowRP())->GetBinError(1); 
1389     dVn[1] = (fCommonHistsResults4th->GetHistIntFlowRP())->GetBinContent(1); 
1390     dVnErr[1] = (fCommonHistsResults4th->GetHistIntFlowRP())->GetBinError(1); 
1391     dVn[2] = (fCommonHistsResults6th->GetHistIntFlowRP())->GetBinContent(1); 
1392     dVnErr[2] = (fCommonHistsResults6th->GetHistIntFlowRP())->GetBinError(1); 
1393     dVn[3] = (fCommonHistsResults8th->GetHistIntFlowRP())->GetBinContent(1); 
1394     dVnErr[3] = (fCommonHistsResults8th->GetHistIntFlowRP())->GetBinError(1); 
1395    } else if(type == "POI")
1396      {
1397       dVn[0] = (fCommonHistsResults2nd->GetHistIntFlowPOI())->GetBinContent(1); 
1398       dVnErr[0] = (fCommonHistsResults2nd->GetHistIntFlowPOI())->GetBinError(1); 
1399       dVn[1] = (fCommonHistsResults4th->GetHistIntFlowPOI())->GetBinContent(1); 
1400       dVnErr[1] = (fCommonHistsResults4th->GetHistIntFlowPOI())->GetBinError(1); 
1401       dVn[2] = (fCommonHistsResults6th->GetHistIntFlowPOI())->GetBinContent(1); 
1402       dVnErr[2] = (fCommonHistsResults6th->GetHistIntFlowPOI())->GetBinError(1); 
1403       dVn[3] = (fCommonHistsResults8th->GetHistIntFlowPOI())->GetBinContent(1); 
1404       dVnErr[3] = (fCommonHistsResults8th->GetHistIntFlowPOI())->GetBinError(1); 
1405      } else if(type == "RF, rebinned in M" && fCalculateCumulantsVsM)
1406        {
1407         for(Int_t b=0;b<4;b++)
1408         {
1409          dVn[b] = fIntFlowRebinnedInM->GetBinContent(b+1); 
1410          dVnErr[b] = fIntFlowRebinnedInM->GetBinError(b+1);
1411         }  
1412        }
1413  
1414  TString title = " flow estimates from Q-cumulants"; 
1415  TString subtitle = "    ("; 
1416  TString subtitle2 = "       (rebinned in M)"; 
1417  
1418  if(type != "RF, rebinned in M")
1419  {
1420   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
1421   {
1422    subtitle.Append(type);
1423    subtitle.Append(", without weights)");
1424   } else  
1425     {
1426      subtitle.Append(type);
1427      subtitle.Append(", with weights)");
1428     }
1429  } else
1430    {
1431     if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
1432     {
1433      subtitle.Append("RF");
1434      subtitle.Append(", without weights)");
1435     } else  
1436       {
1437        subtitle.Append("RF");
1438        subtitle.Append(", with weights)");      
1439       }
1440    } 
1441    
1442  cout<<endl;
1443  cout<<"*************************************"<<endl;
1444  cout<<"*************************************"<<endl;
1445  cout<<title.Data()<<endl; 
1446  cout<<subtitle.Data()<<endl; 
1447  if(type == "RF, rebinned in M"){cout<<subtitle2.Data()<<endl;}
1448  cout<<endl;
1449   
1450  for(Int_t i=0;i<4;i++)
1451  {
1452   cout<<"  v_"<<n<<"{"<<2*(i+1)<<"} = "<<dVn[i]<<" +/- "<<dVnErr[i]<<endl;
1453  }
1454  
1455  cout<<endl;
1456  if(type == "RF")
1457  {
1458   if(fApplyCorrectionForNUA)
1459   {
1460    cout<<" detector bias (corrected for): "<<endl;
1461   } else
1462     {
1463      cout<<" detector bias (not corrected for):"<<endl;  
1464     }
1465   cout<<"  to QC{2}: "<<fIntFlowDetectorBias->GetBinContent(1)<<" +/- "<<fIntFlowDetectorBias->GetBinError(1)<<endl;
1466   cout<<"  to QC{4}: "<<fIntFlowDetectorBias->GetBinContent(2)<<" +/- "<<fIntFlowDetectorBias->GetBinError(2)<<endl;
1467   cout<<endl;
1468  }
1469  if(type == "RF" || type == "RF, rebinned in M")
1470  {
1471   cout<<"     nEvts = "<<(Int_t)fCommonHists->GetHistMultRP()->GetEntries()<<", <M> = "<<(Double_t)fCommonHists->GetHistMultRP()->GetMean()<<endl; 
1472  }
1473  else if (type == "RP")
1474  {
1475   cout<<"     nEvts = "<<(Int_t)fCommonHists->GetHistMultRP()->GetEntries()<<", <M> = "<<(Double_t)fCommonHists->GetHistMultRP()->GetMean()<<endl;  
1476  } 
1477  else if (type == "POI")
1478  {
1479   cout<<"     nEvts = "<<(Int_t)fCommonHists->GetHistMultPOI()->GetEntries()<<", <M> = "<<(Double_t)fCommonHists->GetHistMultPOI()->GetMean()<<endl;
1480  }  
1481  
1482  cout<<"*************************************"<<endl;
1483  cout<<"*************************************"<<endl;
1484  cout<<endl; 
1485   
1486 }// end of AliFlowAnalysisWithQCumulants::PrintFinalResultsForIntegratedFlow(TString type="RF");
1487
1488 //=======================================================================================================================
1489
1490 void AliFlowAnalysisWithQCumulants::WriteHistograms(TString outputFileName)
1491 {
1492  //store the final results in output .root file
1493  TFile *output = new TFile(outputFileName.Data(),"RECREATE");
1494  //output->WriteObject(fHistList, "cobjQC","SingleKey");
1495  fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
1496  delete output;
1497 }
1498
1499
1500 //=======================================================================================================================
1501
1502
1503 void AliFlowAnalysisWithQCumulants::WriteHistograms(TDirectoryFile *outputFileName)
1504 {
1505  //store the final results in output .root file
1506  fHistList->SetName("cobjQC");
1507  fHistList->SetOwner(kTRUE);
1508  outputFileName->Add(fHistList);
1509  outputFileName->Write(outputFileName->GetName(), TObject::kSingleKey);
1510 }
1511
1512 //=======================================================================================================================
1513
1514 void AliFlowAnalysisWithQCumulants::BookCommonHistograms()
1515 {
1516  // Book common control histograms and common histograms for final results.
1517  //  a) Book common control histograms;
1518  //  b) Book common result histograms.
1519  
1520  // a) Book common control histograms: 
1521  //  Common control histograms (all events):
1522  TString commonHistsName = "AliFlowCommonHistQC";
1523  commonHistsName += fAnalysisLabel->Data();
1524  fCommonHists = new AliFlowCommonHist(commonHistsName.Data(),commonHistsName.Data(),fBookOnlyBasicCCH);
1525  fHistList->Add(fCommonHists);  
1526  //  Common control histograms (selected events):
1527  if(fFillMultipleControlHistograms)
1528  {
1529   // Common control histogram filled for events with 2 and more reference particles:
1530   TString commonHists2ndOrderName = "AliFlowCommonHist2ndOrderQC";
1531   commonHists2ndOrderName += fAnalysisLabel->Data();
1532   fCommonHists2nd = new AliFlowCommonHist(commonHists2ndOrderName.Data(),commonHists2ndOrderName.Data(),fBookOnlyBasicCCH);
1533   fHistList->Add(fCommonHists2nd);  
1534   // Common control histogram filled for events with 2 and more reference particles:
1535   TString commonHists4thOrderName = "AliFlowCommonHist4thOrderQC";
1536   commonHists4thOrderName += fAnalysisLabel->Data();
1537   fCommonHists4th = new AliFlowCommonHist(commonHists4thOrderName.Data(),commonHists4thOrderName.Data(),fBookOnlyBasicCCH);
1538   fHistList->Add(fCommonHists4th);  
1539   // Common control histogram filled for events with 6 and more reference particles:
1540   TString commonHists6thOrderName = "AliFlowCommonHist6thOrderQC";
1541   commonHists6thOrderName += fAnalysisLabel->Data();
1542   fCommonHists6th = new AliFlowCommonHist(commonHists6thOrderName.Data(),commonHists6thOrderName.Data(),fBookOnlyBasicCCH);
1543   fHistList->Add(fCommonHists6th);  
1544   // Common control histogram filled for events with 8 and more reference particles:
1545   TString commonHists8thOrderName = "AliFlowCommonHist8thOrderQC";
1546   commonHists8thOrderName += fAnalysisLabel->Data();
1547   fCommonHists8th = new AliFlowCommonHist(commonHists8thOrderName.Data(),commonHists8thOrderName.Data(),fBookOnlyBasicCCH);
1548   fHistList->Add(fCommonHists8th);    
1549  } // end of if(fFillMultipleControlHistograms)
1550  
1551  // b) Book common result histograms: 
1552  //  Common result histograms for QC{2}:
1553  TString commonHistResults2ndOrderName = "AliFlowCommonHistResults2ndOrderQC";
1554  commonHistResults2ndOrderName += fAnalysisLabel->Data();
1555  fCommonHistsResults2nd = new AliFlowCommonHistResults(commonHistResults2ndOrderName.Data(),"",fHarmonic);
1556  fHistList->Add(fCommonHistsResults2nd);  
1557  //  Common result histograms for QC{4}:
1558  TString commonHistResults4thOrderName = "AliFlowCommonHistResults4thOrderQC";
1559  commonHistResults4thOrderName += fAnalysisLabel->Data();
1560  fCommonHistsResults4th = new AliFlowCommonHistResults(commonHistResults4thOrderName.Data(),"",fHarmonic);
1561  fHistList->Add(fCommonHistsResults4th); 
1562  //  Common result histograms for QC{6}:
1563  TString commonHistResults6thOrderName = "AliFlowCommonHistResults6thOrderQC";
1564  commonHistResults6thOrderName += fAnalysisLabel->Data();
1565  fCommonHistsResults6th = new AliFlowCommonHistResults(commonHistResults6thOrderName.Data(),"",fHarmonic);
1566  fHistList->Add(fCommonHistsResults6th);  
1567  //  Common result histograms for QC{8}:
1568  TString commonHistResults8thOrderName = "AliFlowCommonHistResults8thOrderQC";
1569  commonHistResults8thOrderName += fAnalysisLabel->Data();
1570  fCommonHistsResults8th = new AliFlowCommonHistResults(commonHistResults8thOrderName.Data(),"",fHarmonic);
1571  fHistList->Add(fCommonHistsResults8th); 
1572  
1573 } // end of void AliFlowAnalysisWithQCumulants::BookCommonHistograms()
1574
1575 //=======================================================================================================================
1576
1577 void AliFlowAnalysisWithQCumulants::BookAndFillWeightsHistograms()
1578 {
1579  // Book and fill histograms which hold phi, pt and eta weights.
1580
1581  if(!fWeightsList)
1582  {
1583   printf("\n WARNING (QC): fWeightsList is NULL in AFAWQC::BAFWH() !!!! \n\n");
1584   exit(0);  
1585  }
1586     
1587  TString fUseParticleWeightsName = "fUseParticleWeightsQC";
1588  fUseParticleWeightsName += fAnalysisLabel->Data();
1589  fUseParticleWeights = new TProfile(fUseParticleWeightsName.Data(),"0 = particle weight not used, 1 = particle weight used ",4,0,4);
1590  fUseParticleWeights->SetLabelSize(0.06);
1591  fUseParticleWeights->SetStats(kFALSE);
1592  (fUseParticleWeights->GetXaxis())->SetBinLabel(1,"w_{#phi}");
1593  (fUseParticleWeights->GetXaxis())->SetBinLabel(2,"w_{p_{T}}");
1594  (fUseParticleWeights->GetXaxis())->SetBinLabel(3,"w_{#eta}");
1595  (fUseParticleWeights->GetXaxis())->SetBinLabel(4,"w_{track}");
1596  fUseParticleWeights->Fill(0.5,(Int_t)fUsePhiWeights);
1597  fUseParticleWeights->Fill(1.5,(Int_t)fUsePtWeights);
1598  fUseParticleWeights->Fill(2.5,(Int_t)fUseEtaWeights);
1599  fUseParticleWeights->Fill(3.5,(Int_t)fUseTrackWeights);
1600  fWeightsList->Add(fUseParticleWeights); 
1601   
1602  if(fUsePhiWeights)
1603  {
1604   if(fWeightsList->FindObject("phi_weights"))
1605   {
1606    fPhiWeights = dynamic_cast<TH1F*>(fWeightsList->FindObject("phi_weights"));
1607    if(!fPhiWeights)
1608    {
1609     printf("\n WARNING (QC): fPhiWeights is NULL in AFAWQC::BAFWH() !!!!\n\n");
1610     exit(0);
1611    }
1612    if(TMath::Abs(fPhiWeights->GetBinWidth(1)-fPhiBinWidth)>pow(10.,-6.))
1613    {
1614     cout<<endl;
1615     cout<<"WARNING (QC): Inconsistent binning in histograms for phi-weights throughout the code."<<endl;
1616     cout<<endl;
1617     //exit(0);
1618    }
1619   } else 
1620     {
1621      cout<<"WARNING: fWeightsList->FindObject(\"phi_weights\") is NULL in AFAWQC::BAFWH() !!!!"<<endl;
1622      exit(0);
1623     }
1624  } // end of if(fUsePhiWeights)
1625  
1626  if(fUsePtWeights) 
1627  {
1628   if(fWeightsList->FindObject("pt_weights"))
1629   {
1630    fPtWeights = dynamic_cast<TH1D*>(fWeightsList->FindObject("pt_weights"));
1631    if(!fPtWeights)
1632    {
1633     printf("\n WARNING (QC): fPtWeights is NULL in AFAWQC::BAFWH() !!!!\n\n");
1634     exit(0);
1635    }
1636    if(TMath::Abs(fPtWeights->GetBinWidth(1)-fPtBinWidth)>pow(10.,-6.))
1637    {
1638     cout<<endl;
1639     cout<<"WARNING (QC): Inconsistent binning in histograms for pt-weights throughout the code."<<endl;
1640     cout<<endl;
1641     //exit(0);
1642    }
1643   } else 
1644     {
1645      cout<<"WARNING: fWeightsList->FindObject(\"pt_weights\") is NULL in AFAWQC::BAFWH() !!!!"<<endl;
1646      exit(0);
1647     }
1648  } // end of if(fUsePtWeights)    
1649
1650  if(fUseEtaWeights) 
1651  {
1652   if(fWeightsList->FindObject("eta_weights"))
1653   {
1654    fEtaWeights = dynamic_cast<TH1D*>(fWeightsList->FindObject("eta_weights"));
1655    if(!fEtaWeights)
1656    {
1657     printf("\n WARNING (QC): fEtaWeights is NULL in AFAWQC::BAFWH() !!!!\n\n");
1658     exit(0);
1659    }
1660    if(TMath::Abs(fEtaWeights->GetBinWidth(1)-fEtaBinWidth)>pow(10.,-6.))
1661    {
1662     cout<<endl;
1663     cout<<"WARNING (QC): Inconsistent binning in histograms for eta-weights throughout the code."<<endl;
1664     cout<<endl;
1665     //exit(0);
1666    }
1667   } else 
1668     {
1669      cout<<"WARNING: fUseEtaWeights && fWeightsList->FindObject(\"eta_weights\") is NULL in AFAWQC::BAFWH() !!!!"<<endl;
1670      exit(0);
1671     }
1672  } // end of if(fUseEtaWeights)
1673  
1674 } // end of AliFlowAnalysisWithQCumulants::BookAndFillWeightsHistograms()
1675
1676 //=======================================================================================================================
1677
1678 void AliFlowAnalysisWithQCumulants::BookEverythingForIntegratedFlow()
1679 {
1680  // Book all objects for integrated flow:
1681  //  a) Book profile to hold all flags for integrated flow;
1682  //  b) Book event-by-event quantities;
1683  //  c) Book profiles; // to be improved (comment)
1684  //  d) Book histograms holding the final results.
1685  
1686  TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data members?)
1687  TString powerFlag[2] = {"linear","quadratic"}; // to be improved (should I promote this to data members?)
1688  
1689  // a) Book profile to hold all flags for integrated flow:
1690  TString intFlowFlagsName = "fIntFlowFlags";
1691  intFlowFlagsName += fAnalysisLabel->Data();
1692  fIntFlowFlags = new TProfile(intFlowFlagsName.Data(),"Flags for Integrated Flow",20,0.,20.);
1693  fIntFlowFlags->SetTickLength(-0.01,"Y");
1694  fIntFlowFlags->SetMarkerStyle(25);
1695  fIntFlowFlags->SetLabelSize(0.04);
1696  fIntFlowFlags->SetLabelOffset(0.02,"Y");
1697  fIntFlowFlags->SetStats(kFALSE);
1698  fIntFlowFlags->GetXaxis()->SetBinLabel(1,"Particle Weights");
1699  fIntFlowFlags->GetXaxis()->SetBinLabel(2,"Event Weights");
1700  fIntFlowFlags->GetXaxis()->SetBinLabel(3,"Corrected for NUA?");
1701  fIntFlowFlags->GetXaxis()->SetBinLabel(4,"Print RF results");
1702  fIntFlowFlags->GetXaxis()->SetBinLabel(5,"Print RP results");
1703  fIntFlowFlags->GetXaxis()->SetBinLabel(6,"Print POI results");
1704  fIntFlowFlags->GetXaxis()->SetBinLabel(7,"Print RF (rebinned in M) results");
1705  fIntFlowFlags->GetXaxis()->SetBinLabel(8,"Corrected for NUA vs M?");
1706  fIntFlowFlags->GetXaxis()->SetBinLabel(9,"Propagate errors to v_{n} from correlations?");
1707  fIntFlowFlags->GetXaxis()->SetBinLabel(10,"Calculate cumulants vs M");
1708  fIntFlowFlags->GetXaxis()->SetBinLabel(11,"fMinimumBiasReferenceFlow");
1709  fIntFlowFlags->GetXaxis()->SetBinLabel(12,"fForgetAboutCovariances");
1710  fIntFlowFlags->GetXaxis()->SetBinLabel(13,"fStorePhiDistributionForOneEvent");
1711  fIntFlowFlags->GetXaxis()->SetBinLabel(14,"fFillMultipleControlHistograms");
1712  fIntFlowFlags->GetXaxis()->SetBinLabel(15,"Calculate all correlations vs M");
1713  fIntFlowFlags->GetXaxis()->SetBinLabel(16,"fMultiplicityIs");
1714  fIntFlowFlags->GetXaxis()->SetBinLabel(17,"fExactNoRPs");
1715  fIntFlowFlags->GetXaxis()->SetBinLabel(18,"fUse2DHistograms");
1716  fIntFlowFlags->GetXaxis()->SetBinLabel(19,"fFillProfilesVsMUsingWeights");
1717  fIntFlowFlags->GetXaxis()->SetBinLabel(20,"fUseQvectorTerms");
1718  fIntFlowList->Add(fIntFlowFlags);
1719
1720  // b) Book event-by-event quantities:
1721  // Re[Q_{m*n,k}], Im[Q_{m*n,k}] and S_{p,k}^M: 
1722  fReQ = new TMatrixD(12,9);
1723  fImQ = new TMatrixD(12,9);
1724  fSpk = new TMatrixD(8,9);
1725  // average correlations <2>, <4>, <6> and <8> for single event (bining is the same as in fIntFlowCorrelationsPro and fIntFlowCorrelationsHist):
1726  TString intFlowCorrelationsEBEName = "fIntFlowCorrelationsEBE";
1727  intFlowCorrelationsEBEName += fAnalysisLabel->Data();
1728  fIntFlowCorrelationsEBE = new TH1D(intFlowCorrelationsEBEName.Data(),intFlowCorrelationsEBEName.Data(),4,0,4);
1729  // weights for average correlations <2>, <4>, <6> and <8> for single event:
1730  TString intFlowEventWeightsForCorrelationsEBEName = "fIntFlowEventWeightsForCorrelationsEBE";
1731  intFlowEventWeightsForCorrelationsEBEName += fAnalysisLabel->Data();
1732  fIntFlowEventWeightsForCorrelationsEBE = new TH1D(intFlowEventWeightsForCorrelationsEBEName.Data(),intFlowEventWeightsForCorrelationsEBEName.Data(),4,0,4);
1733  // average all correlations for single event (bining is the same as in fIntFlowCorrelationsAllPro and fIntFlowCorrelationsAllHist):
1734  TString intFlowCorrelationsAllEBEName = "fIntFlowCorrelationsAllEBE";
1735  intFlowCorrelationsAllEBEName += fAnalysisLabel->Data();
1736  fIntFlowCorrelationsAllEBE = new TH1D(intFlowCorrelationsAllEBEName.Data(),intFlowCorrelationsAllEBEName.Data(),64,0,64);
1737  // average correction terms for non-uniform acceptance for single event 
1738  // (binning is the same as in fIntFlowCorrectionTermsForNUAPro[2] and fIntFlowCorrectionTermsForNUAHist[2]):
1739  TString fIntFlowCorrectionTermsForNUAEBEName = "fIntFlowCorrectionTermsForNUAEBE";
1740  fIntFlowCorrectionTermsForNUAEBEName += fAnalysisLabel->Data();
1741  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
1742  {
1743   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);  
1744  }
1745  // event weights for terms for non-uniform acceptance: 
1746  TString fIntFlowEventWeightForCorrectionTermsForNUAEBEName = "fIntFlowEventWeightForCorrectionTermsForNUAEBE";
1747  fIntFlowEventWeightForCorrectionTermsForNUAEBEName += fAnalysisLabel->Data();
1748  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
1749  {
1750   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  
1751  }
1752  // c) Book profiles: // to be improved (comment)
1753  // profile to hold average multiplicities and number of events for events with nRP>=0, nRP>=1, ... , and nRP>=8:
1754  TString avMultiplicityName = "fAvMultiplicity";
1755  avMultiplicityName += fAnalysisLabel->Data();
1756  fAvMultiplicity = new TProfile(avMultiplicityName.Data(),"Average multiplicities of reference particles (RPs)",9,0,9);
1757  fAvMultiplicity->SetTickLength(-0.01,"Y");
1758  fAvMultiplicity->SetMarkerStyle(25);
1759  fAvMultiplicity->SetLabelSize(0.05);
1760  fAvMultiplicity->SetLabelOffset(0.02,"Y");
1761  fAvMultiplicity->SetYTitle("Average multiplicity");
1762  (fAvMultiplicity->GetXaxis())->SetBinLabel(1,"all evts");
1763  (fAvMultiplicity->GetXaxis())->SetBinLabel(2,"n_{RP} #geq 1");
1764  (fAvMultiplicity->GetXaxis())->SetBinLabel(3,"n_{RP} #geq 2");
1765  (fAvMultiplicity->GetXaxis())->SetBinLabel(4,"n_{RP} #geq 3");
1766  (fAvMultiplicity->GetXaxis())->SetBinLabel(5,"n_{RP} #geq 4");
1767  (fAvMultiplicity->GetXaxis())->SetBinLabel(6,"n_{RP} #geq 5");
1768  (fAvMultiplicity->GetXaxis())->SetBinLabel(7,"n_{RP} #geq 6");
1769  (fAvMultiplicity->GetXaxis())->SetBinLabel(8,"n_{RP} #geq 7");
1770  (fAvMultiplicity->GetXaxis())->SetBinLabel(9,"n_{RP} #geq 8");
1771  fIntFlowProfiles->Add(fAvMultiplicity);
1772  // Average correlations <<2>>, <<4>>, <<6>> and <<8>> for all events (with wrong errors!):
1773  TString correlationFlag[4] = {"#LT#LT2#GT#GT","#LT#LT4#GT#GT","#LT#LT6#GT#GT","#LT#LT8#GT#GT"};
1774  TString intFlowCorrelationsProName = "fIntFlowCorrelationsPro";
1775  intFlowCorrelationsProName += fAnalysisLabel->Data();
1776  fIntFlowCorrelationsPro = new TProfile(intFlowCorrelationsProName.Data(),"Average correlations for all events",4,0,4,"s");
1777  fIntFlowCorrelationsPro->Sumw2();
1778  fIntFlowCorrelationsPro->SetTickLength(-0.01,"Y");
1779  fIntFlowCorrelationsPro->SetMarkerStyle(25);
1780  fIntFlowCorrelationsPro->SetLabelSize(0.06);
1781  fIntFlowCorrelationsPro->SetLabelOffset(0.01,"Y");
1782  for(Int_t b=0;b<4;b++)
1783  {
1784   (fIntFlowCorrelationsPro->GetXaxis())->SetBinLabel(b+1,correlationFlag[b].Data());
1785  }
1786  fIntFlowProfiles->Add(fIntFlowCorrelationsPro);
1787  // Average correlations squared <<2>^2>, <<4>^2>, <<6>^2> and <<8>^2> for all events:
1788  TString squaredCorrelationFlag[4] = {"#LT#LT2#GT^{2}#GT","#LT#LT4#GT^{2}#GT","#LT#LT6#GT^{2}#GT","#LT#LT8#GT^{2}#GT"};
1789  TString intFlowSquaredCorrelationsProName = "fIntFlowSquaredCorrelationsPro";
1790  intFlowSquaredCorrelationsProName += fAnalysisLabel->Data();
1791  fIntFlowSquaredCorrelationsPro = new TProfile(intFlowSquaredCorrelationsProName.Data(),"Average squared correlations for all events",4,0,4,"s");
1792  fIntFlowSquaredCorrelationsPro->Sumw2();
1793  fIntFlowSquaredCorrelationsPro->SetTickLength(-0.01,"Y");
1794  fIntFlowSquaredCorrelationsPro->SetMarkerStyle(25);
1795  fIntFlowSquaredCorrelationsPro->SetLabelSize(0.06);
1796  fIntFlowSquaredCorrelationsPro->SetLabelOffset(0.01,"Y");
1797  for(Int_t b=0;b<4;b++)
1798  {
1799   (fIntFlowSquaredCorrelationsPro->GetXaxis())->SetBinLabel(b+1,squaredCorrelationFlag[b].Data());
1800  }
1801  fIntFlowProfiles->Add(fIntFlowSquaredCorrelationsPro);
1802  if(fCalculateCumulantsVsM)
1803  {
1804   for(Int_t ci=0;ci<4;ci++) // correlation index
1805   {
1806    // average correlations <<2>>, <<4>>, <<6>> and <<8>> versus multiplicity for all events (with wrong errors):
1807    TString intFlowCorrelationsVsMProName = "fIntFlowCorrelationsVsMPro";
1808    intFlowCorrelationsVsMProName += fAnalysisLabel->Data();
1809    fIntFlowCorrelationsVsMPro[ci] = new TProfile(Form("%s, %s",intFlowCorrelationsVsMProName.Data(),correlationFlag[ci].Data()),
1810                                                  Form("%s vs multiplicity",correlationFlag[ci].Data()),
1811                                                  fnBinsMult,fMinMult,fMaxMult,"s");   
1812    fIntFlowCorrelationsVsMPro[ci]->Sumw2();                                                                                       
1813    fIntFlowCorrelationsVsMPro[ci]->GetYaxis()->SetTitle(correlationFlag[ci].Data());
1814    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
1815    {
1816     fIntFlowCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("# RPs"); 
1817    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
1818      {
1819       fIntFlowCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
1820      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
1821        {
1822         fIntFlowCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("# POIs"); 
1823        } 
1824    fIntFlowProfiles->Add(fIntFlowCorrelationsVsMPro[ci]);
1825    // average squared correlations <<2>^2>, <<4>^2>, <<6>^2> and <<8>^2> versus multiplicity for all events:  
1826    TString intFlowSquaredCorrelationsVsMProName = "fIntFlowSquaredCorrelationsVsMPro";
1827    intFlowSquaredCorrelationsVsMProName += fAnalysisLabel->Data();
1828    fIntFlowSquaredCorrelationsVsMPro[ci] = new TProfile(Form("%s, %s",intFlowSquaredCorrelationsVsMProName.Data(),squaredCorrelationFlag[ci].Data()),
1829                                                         Form("%s vs multiplicity",squaredCorrelationFlag[ci].Data()),
1830                                                         fnBinsMult,fMinMult,fMaxMult,"s");   
1831    fIntFlowSquaredCorrelationsVsMPro[ci]->Sumw2();                                                                                              
1832    fIntFlowSquaredCorrelationsVsMPro[ci]->GetYaxis()->SetTitle(squaredCorrelationFlag[ci].Data());
1833    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
1834    {
1835     fIntFlowSquaredCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("# RPs");
1836    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
1837      {
1838       fIntFlowSquaredCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
1839      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
1840        {
1841         fIntFlowSquaredCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("# POIs");
1842        }
1843    fIntFlowProfiles->Add(fIntFlowSquaredCorrelationsVsMPro[ci]);
1844   } // end of for(Int_t ci=0;ci<4;ci++) // correlation index  
1845  } // end of if(fCalculateCumulantsVsM)
1846  // averaged all correlations for all events (with wrong errors!):
1847  TString intFlowCorrelationsAllProName = "fIntFlowCorrelationsAllPro";
1848  intFlowCorrelationsAllProName += fAnalysisLabel->Data();
1849  fIntFlowCorrelationsAllPro = new TProfile(intFlowCorrelationsAllProName.Data(),"Average all correlations for all events",64,0,64);
1850  fIntFlowCorrelationsAllPro->Sumw2();
1851  fIntFlowCorrelationsAllPro->SetTickLength(-0.01,"Y");
1852  fIntFlowCorrelationsAllPro->SetMarkerStyle(25);
1853  fIntFlowCorrelationsAllPro->SetLabelSize(0.03);
1854  fIntFlowCorrelationsAllPro->SetLabelOffset(0.01,"Y");
1855  // 2-p correlations:
1856  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(1,"#LT#LT2#GT#GT_{n|n}");
1857  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(2,"#LT#LT2#GT#GT_{2n|2n}");
1858  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(3,"#LT#LT2#GT#GT_{3n|3n}");
1859  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(4,"#LT#LT2#GT#GT_{4n|4n}");
1860  // 3-p correlations:
1861  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(6,"#LT#LT3#GT#GT_{2n|n,n}");
1862  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(7,"#LT#LT3#GT#GT_{3n|2n,n}");
1863  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(8,"#LT#LT3#GT#GT_{4n|2n,2n}");
1864  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(9,"#LT#LT3#GT#GT_{4n|3n,n}");
1865  // 4-p correlations:
1866  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(11,"#LT#LT4#GT#GT_{n,n|n,n}"); 
1867  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(12,"#LT#LT4#GT#GT_{2n,n|2n,n}");
1868  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(13,"#LT#LT4#GT#GT_{2n,2n|2n,2n}");
1869  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(14,"#LT#LT4#GT#GT_{3n|n,n,n}");
1870  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(15,"#LT#LT4#GT#GT_{3n,n|3n,n}");
1871  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(16,"#LT#LT4#GT#GT_{3n,n|2n,2n}"); 
1872  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(17,"#LT#LT4#GT#GT_{4n|2n,n,n}");
1873  // 5-p correlations:
1874  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(19,"#LT#LT5#GT#GT_{2n,n|n,n,n}"); 
1875  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(20,"#LT#LT5#GT#GT_{2n,2n|2n,n,n}");
1876  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(21,"#LT#LT5#GT#GT_{3n,n|2n,n,n}");
1877  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(22,"#LT#LT5#GT#GT_{4n|n,n,n,n}");
1878  // 6-p correlations:
1879  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(24,"#LT#LT6#GT#GT_{n,n,n|n,n,n}");
1880  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(25,"#LT#LT6#GT#GT_{2n,n,n|2n,n,n}");
1881  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(26,"#LT#LT6#GT#GT_{2n,2n|n,n,n,n}");
1882  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(27,"#LT#LT6#GT#GT_{3n,n|n,n,n,n}");
1883  // 7-p correlations:  
1884  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(29,"#LT#LT7#GT#GT_{2n,n,n|n,n,n,n}");
1885  // 8-p correlations:
1886  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(31,"#LT#LT8#GT#GT_{n,n,n,n|n,n,n,n}");
1887  //  EXTRA correlations for v3{5} study:
1888  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(33,"#LT#LT4#GT#GT_{4n,2n|3n,3n}");
1889  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(34,"#LT#LT5#GT#GT_{3n,3n|2n,2n,2n}");
1890  //  EXTRA correlations for Teaney-Yan study:
1891  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(35,"#LT#LT2#GT#GT_{5n|5n}");
1892  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(36,"#LT#LT2#GT#GT_{6n|6n}");
1893  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(37,"#LT#LT3#GT#GT_{5n|3n,2n}");
1894  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(38,"#LT#LT3#GT#GT_{5n|4n,1n}");
1895  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(39,"#LT#LT3#GT#GT_{6n|3n,3n}");
1896  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(40,"#LT#LT3#GT#GT_{6n|4n,2n}");
1897  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(41,"#LT#LT3#GT#GT_{6n|5n,1n}");
1898  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(42,"#LT#LT4#GT#GT_{6n|3n,2n,1n}");
1899  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(43,"#LT#LT4#GT#GT_{3n,2n|3n,2n}");
1900  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(44,"#LT#LT4#GT#GT_{4n,1n|3n,2n}");
1901  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(45,"#LT#LT4#GT#GT_{3n,3n|3n,3n}");
1902  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(46,"#LT#LT4#GT#GT_{4n,2n|3n,3n}");
1903  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(47,"#LT#LT4#GT#GT_{5n,1n|3n,3n}");
1904  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(48,"#LT#LT4#GT#GT_{4n,2n|4n,2n}");
1905  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(49,"#LT#LT4#GT#GT_{5n,1n|4n,2n}");
1906  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(50,"#LT#LT4#GT#GT_{5n|3n,1n,1n}");
1907  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(51,"#LT#LT4#GT#GT_{5n|2n,2n,1n}");
1908  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(52,"#LT#LT4#GT#GT_{5n,1n|5n,1n}");
1909  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(53,"#LT#LT5#GT#GT_{3n,3n|3n,2n,1n}");
1910  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(54,"#LT#LT5#GT#GT_{4n,2n|3n,2n,1n}");
1911  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(55,"#LT#LT5#GT#GT_{3n,2n|3n,1n,1n}");
1912  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(56,"#LT#LT5#GT#GT_{3n,2n|2n,2n,1n}");
1913  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(57,"#LT#LT5#GT#GT_{5n,1n|3n,2n,1n}");
1914  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(58,"#LT#LT6#GT#GT_{3n,2n,1n|3n,2n,1n}");
1915  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(59,"#LT#LT4#GT#GT_{6n|4n,1n,1n}");
1916  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(60,"#LT#LT4#GT#GT_{6n|2n,2n,2n}");
1917  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(61,"#LT#LT5#GT#GT_{6n|2n,2n,1n,1n}");
1918  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(62,"#LT#LT5#GT#GT_{4n,1n,1n|3n,3n}");
1919  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(63,"#LT#LT6#GT#GT_{3n,3n|2n,2n,1n,1n}");
1920  fIntFlowProfiles->Add(fIntFlowCorrelationsAllPro);
1921  // average all correlations versus multiplicity (errors via Sumw2 - to be improved):
1922  if(fCalculateAllCorrelationsVsM)
1923  {
1924   // 2-p correlations vs M:  
1925   fIntFlowCorrelationsAllVsMPro[0] = new TProfile("two1n1n","#LT#LT2#GT#GT_{n|n}",fnBinsMult,fMinMult,fMaxMult);
1926   fIntFlowCorrelationsAllVsMPro[1] = new TProfile("two2n2n","#LT#LT2#GT#GT_{2n|2n}",fnBinsMult,fMinMult,fMaxMult);
1927   fIntFlowCorrelationsAllVsMPro[2] = new TProfile("two3n3n","#LT#LT2#GT#GT_{3n|3n}",fnBinsMult,fMinMult,fMaxMult);
1928   fIntFlowCorrelationsAllVsMPro[3] = new TProfile("two4n4n","#LT#LT2#GT#GT_{4n|4n}",fnBinsMult,fMinMult,fMaxMult);
1929   // 3-p correlations vs M:
1930   fIntFlowCorrelationsAllVsMPro[5] = new TProfile("three2n1n1n","#LT#LT3#GT#GT_{2n|n,n}",fnBinsMult,fMinMult,fMaxMult);
1931   fIntFlowCorrelationsAllVsMPro[6] = new TProfile("three3n2n1n","#LT#LT3#GT#GT_{3n|2n,n}",fnBinsMult,fMinMult,fMaxMult);
1932   fIntFlowCorrelationsAllVsMPro[7] = new TProfile("three4n2n2n","#LT#LT3#GT#GT_{4n|2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1933   fIntFlowCorrelationsAllVsMPro[8] = new TProfile("three4n3n1n","#LT#LT3#GT#GT_{4n|3n,n}",fnBinsMult,fMinMult,fMaxMult);
1934   // 4-p correlations vs M:
1935   fIntFlowCorrelationsAllVsMPro[10] = new TProfile("four1n1n1n1n","#LT#LT4#GT#GT_{n,n|n,n}",fnBinsMult,fMinMult,fMaxMult);
1936   fIntFlowCorrelationsAllVsMPro[11] = new TProfile("four2n1n2n1n","#LT#LT4#GT#GT_{2n,n|2n,n}",fnBinsMult,fMinMult,fMaxMult);
1937   fIntFlowCorrelationsAllVsMPro[12] = new TProfile("four2n2n2n2n","#LT#LT4#GT#GT_{2n,2n|2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1938   fIntFlowCorrelationsAllVsMPro[13] = new TProfile("four3n1n1n1n","#LT#LT4#GT#GT_{3n|n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1939   fIntFlowCorrelationsAllVsMPro[14] = new TProfile("four3n1n3n1n","#LT#LT4#GT#GT_{3n,n|3n,n}",fnBinsMult,fMinMult,fMaxMult);
1940   fIntFlowCorrelationsAllVsMPro[15] = new TProfile("four3n1n2n2n","#LT#LT4#GT#GT_{3n,n|2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1941   fIntFlowCorrelationsAllVsMPro[16] = new TProfile("four4n2n1n1n","#LT#LT4#GT#GT_{4n|2n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1942   // 5-p correlations vs M:
1943   fIntFlowCorrelationsAllVsMPro[18] = new TProfile("five2n1n1n1n1n","#LT#LT5#GT#GT_{2n,n|n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1944   fIntFlowCorrelationsAllVsMPro[19] = new TProfile("five2n2n2n1n1n","#LT#LT5#GT#GT_{2n,2n|2n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1945   fIntFlowCorrelationsAllVsMPro[20] = new TProfile("five3n1n2n1n1n","#LT#LT5#GT#GT_{3n,n|2n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1946   fIntFlowCorrelationsAllVsMPro[21] = new TProfile("five4n1n1n1n1n","#LT#LT5#GT#GT_{4n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1947   // 6-p correlations vs M:
1948   fIntFlowCorrelationsAllVsMPro[23] = new TProfile("six1n1n1n1n1n1n","#LT#LT6#GT#GT_{n,n,n|n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1949   fIntFlowCorrelationsAllVsMPro[24] = new TProfile("six2n1n1n2n1n1n","#LT#LT6#GT#GT_{2n,n,n|2n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1950   fIntFlowCorrelationsAllVsMPro[25] = new TProfile("six2n2n1n1n1n1n","#LT#LT6#GT#GT_{2n,2n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1951   fIntFlowCorrelationsAllVsMPro[26] = new TProfile("six3n1n1n1n1n1n","#LT#LT6#GT#GT_{3n,n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1952   // 7-p correlations vs M:
1953   fIntFlowCorrelationsAllVsMPro[28] = new TProfile("seven2n1n1n1n1n1n1n","#LT#LT7#GT#GT_{2n,n,n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1954   // 8-p correlations vs M:
1955   fIntFlowCorrelationsAllVsMPro[30] = new TProfile("eight1n1n1n1n1n1n1n1n","#LT#LT8#GT#GT_{n,n,n,n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1956   // EXTRA correlations vs M for v3{5} study (to be improved - put them in a right order somewhere):
1957   fIntFlowCorrelationsAllVsMPro[32] = new TProfile("four4n2n3n3n","#LT#LT4#GT#GT_{4n,2n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1958   fIntFlowCorrelationsAllVsMPro[33] = new TProfile("five3n3n2n2n2n","#LT#LT5#GT#GT_{3n,3n|2n,2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1959   // EXTRA correlations vs M for Teaney-Yan study (to be improved - put them in a right order somewhere):
1960   fIntFlowCorrelationsAllVsMPro[34] = new TProfile("two5n5n","#LT#LT2#GT#GT_{5n|5n}",fnBinsMult,fMinMult,fMaxMult);
1961   fIntFlowCorrelationsAllVsMPro[35] = new TProfile("two6n6n","#LT#LT2#GT#GT_{6n|6n}",fnBinsMult,fMinMult,fMaxMult);
1962   fIntFlowCorrelationsAllVsMPro[36] = new TProfile("three5n3n2n","#LT#LT3#GT#GT_{5n|3n,2n}",fnBinsMult,fMinMult,fMaxMult);
1963   fIntFlowCorrelationsAllVsMPro[37] = new TProfile("three5n4n1n","#LT#LT3#GT#GT_{5n|4n,1n}",fnBinsMult,fMinMult,fMaxMult);
1964   fIntFlowCorrelationsAllVsMPro[38] = new TProfile("three6n3n3n","#LT#LT3#GT#GT_{6n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1965   fIntFlowCorrelationsAllVsMPro[39] = new TProfile("three6n4n2n","#LT#LT3#GT#GT_{6n|4n,2n}",fnBinsMult,fMinMult,fMaxMult);
1966   fIntFlowCorrelationsAllVsMPro[40] = new TProfile("three6n5n1n","#LT#LT3#GT#GT_{6n|5n,1n}",fnBinsMult,fMinMult,fMaxMult);
1967   fIntFlowCorrelationsAllVsMPro[41] = new TProfile("four6n3n2n1n","#LT#LT4#GT#GT_{6n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1968   fIntFlowCorrelationsAllVsMPro[42] = new TProfile("four3n2n3n2n","#LT#LT4#GT#GT_{3n,2n|3n,2n}",fnBinsMult,fMinMult,fMaxMult);
1969   fIntFlowCorrelationsAllVsMPro[43] = new TProfile("four4n1n3n2n","#LT#LT4#GT#GT_{4n,1n|3n,2n}",fnBinsMult,fMinMult,fMaxMult);
1970   fIntFlowCorrelationsAllVsMPro[44] = new TProfile("four3n3n3n3n","#LT#LT4#GT#GT_{3n,3n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1971   fIntFlowCorrelationsAllVsMPro[45] = new TProfile("four4n2n3n3n","#LT#LT4#GT#GT_{4n,2n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1972   fIntFlowCorrelationsAllVsMPro[46] = new TProfile("four5n1n3n3n","#LT#LT4#GT#GT_{5n,1n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1973   fIntFlowCorrelationsAllVsMPro[47] = new TProfile("four4n2n4n2n","#LT#LT4#GT#GT_{4n,2n|4n,2n}",fnBinsMult,fMinMult,fMaxMult);
1974   fIntFlowCorrelationsAllVsMPro[48] = new TProfile("four5n1n4n2n","#LT#LT4#GT#GT_{5n,1n|4n,2n}",fnBinsMult,fMinMult,fMaxMult);
1975   fIntFlowCorrelationsAllVsMPro[49] = new TProfile("four5n3n1n1n","#LT#LT4#GT#GT_{5n|3n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1976   fIntFlowCorrelationsAllVsMPro[50] = new TProfile("four5n2n2n1n","#LT#LT4#GT#GT_{5n|2n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1977   fIntFlowCorrelationsAllVsMPro[51] = new TProfile("four5n1n5n1n","#LT#LT4#GT#GT_{5n,1n|5n,1n}",fnBinsMult,fMinMult,fMaxMult);
1978   fIntFlowCorrelationsAllVsMPro[52] = new TProfile("five3n3n3n2n1n","#LT#LT5#GT#GT_{3n,3n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1979   fIntFlowCorrelationsAllVsMPro[53] = new TProfile("five4n2n3n2n1n","#LT#LT5#GT#GT_{4n,2n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1980   fIntFlowCorrelationsAllVsMPro[54] = new TProfile("five3n2n3n1n1n","#LT#LT5#GT#GT_{3n,2n|3n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1981   fIntFlowCorrelationsAllVsMPro[55] = new TProfile("five3n2n2n2n1n","#LT#LT5#GT#GT_{3n,2n|2n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1982   fIntFlowCorrelationsAllVsMPro[56] = new TProfile("five5n1n3n2n1n","#LT#LT5#GT#GT_{5n,1n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1983   fIntFlowCorrelationsAllVsMPro[57] = new TProfile("six3n2n1n3n2n1n","#LT#LT6#GT#GT_{3n,2n,1n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1984   fIntFlowCorrelationsAllVsMPro[58] = new TProfile("four6n4n1n1n","#LT#LT4#GT#GT_{6n|4n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1985   fIntFlowCorrelationsAllVsMPro[59] = new TProfile("four6n2n2n2n","#LT#LT4#GT#GT_{6n|2n,2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1986   fIntFlowCorrelationsAllVsMPro[60] = new TProfile("five6n2n2n1n1n","#LT#LT5#GT#GT_{6n|2n,2n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1987   fIntFlowCorrelationsAllVsMPro[61] = new TProfile("five4n1n1n3n3n","#LT#LT5#GT#GT_{4n,1n,1n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1988   fIntFlowCorrelationsAllVsMPro[62] = new TProfile("six3n3n2n2n1n1n","#LT#LT6#GT#GT_{3n,3n|2n,2n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1989   for(Int_t n=0;n<63;n++)
1990   {
1991    if(fIntFlowCorrelationsAllVsMPro[n])
1992    {
1993     fIntFlowCorrelationsAllVsMPro[n]->Sumw2();
1994     if(fMultiplicityIs==AliFlowCommonConstants::kRP)
1995     {
1996      fIntFlowCorrelationsAllVsMPro[n]->GetXaxis()->SetTitle("# RPs"); 
1997     } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
1998       {
1999        fIntFlowCorrelationsAllVsMPro[n]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2000       } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2001         {
2002          fIntFlowCorrelationsAllVsMPro[n]->GetXaxis()->SetTitle("# POIs");
2003         }
2004     fIntFlowAllCorrelationsVsM->Add(fIntFlowCorrelationsAllVsMPro[n]);
2005    } // end of if(fIntFlowCorrelationsAllVsMPro[n])
2006   } // end of for(Int_t n=0;n<63;n++)
2007  } // end of if(fCalculateAllCorrelationsVsM)
2008  // when particle weights are used some extra correlations appear:
2009  if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights) 
2010  {
2011   TString intFlowExtraCorrelationsProName = "fIntFlowExtraCorrelationsPro";
2012   intFlowExtraCorrelationsProName += fAnalysisLabel->Data();
2013   fIntFlowExtraCorrelationsPro = new TProfile(intFlowExtraCorrelationsProName.Data(),"Average extra correlations for all events",100,0,100,"s");
2014   fIntFlowExtraCorrelationsPro->SetTickLength(-0.01,"Y");
2015   fIntFlowExtraCorrelationsPro->SetMarkerStyle(25);
2016   fIntFlowExtraCorrelationsPro->SetLabelSize(0.03);
2017   fIntFlowExtraCorrelationsPro->SetLabelOffset(0.01,"Y");
2018   // extra 2-p correlations:
2019   (fIntFlowExtraCorrelationsPro->GetXaxis())->SetBinLabel(1,"<<w1^3 w2 cos(n*(phi1-phi2))>>");
2020   (fIntFlowExtraCorrelationsPro->GetXaxis())->SetBinLabel(2,"<<w1 w2 w3^2 cos(n*(phi1-phi2))>>");
2021   fIntFlowProfiles->Add(fIntFlowExtraCorrelationsPro);
2022  } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
2023  // average product of correlations <2>, <4>, <6> and <8>:  
2024  TString productFlag[6] = {"#LT#LT2#GT#LT4#GT#GT","#LT#LT2#GT#LT6#GT#GT","#LT#LT2#GT#LT8#GT#GT",
2025                            "#LT#LT4#GT#LT6#GT#GT","#LT#LT4#GT#LT8#GT#GT","#LT#LT6#GT#LT8#GT#GT"};
2026  TString intFlowProductOfCorrelationsProName = "fIntFlowProductOfCorrelationsPro";
2027  intFlowProductOfCorrelationsProName += fAnalysisLabel->Data();
2028  fIntFlowProductOfCorrelationsPro = new TProfile(intFlowProductOfCorrelationsProName.Data(),"Average products of correlations",6,0,6);
2029  fIntFlowProductOfCorrelationsPro->SetTickLength(-0.01,"Y");
2030  fIntFlowProductOfCorrelationsPro->SetMarkerStyle(25); 
2031  fIntFlowProductOfCorrelationsPro->SetLabelSize(0.05);
2032  fIntFlowProductOfCorrelationsPro->SetLabelOffset(0.01,"Y");
2033  for(Int_t b=0;b<6;b++)
2034  {
2035   (fIntFlowProductOfCorrelationsPro->GetXaxis())->SetBinLabel(b+1,productFlag[b].Data());
2036  }
2037  fIntFlowProfiles->Add(fIntFlowProductOfCorrelationsPro); 
2038  // average product of correlations <2>, <4>, <6> and <8> versus multiplicity
2039  // [0=<<2><4>>,1=<<2><6>>,2=<<2><8>>,3=<<4><6>>,4=<<4><8>>,5=<<6><8>>]  
2040  if(fCalculateCumulantsVsM)
2041  {
2042   TString intFlowProductOfCorrelationsVsMProName = "fIntFlowProductOfCorrelationsVsMPro";
2043   intFlowProductOfCorrelationsVsMProName += fAnalysisLabel->Data();
2044   for(Int_t pi=0;pi<6;pi++)
2045   { 
2046    fIntFlowProductOfCorrelationsVsMPro[pi] = new TProfile(Form("%s, %s",intFlowProductOfCorrelationsVsMProName.Data(),productFlag[pi].Data()),
2047                                                           Form("%s versus multiplicity",productFlag[pi].Data()),
2048                                                           fnBinsMult,fMinMult,fMaxMult);             
2049    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2050    {
2051     fIntFlowProductOfCorrelationsVsMPro[pi]->GetXaxis()->SetTitle("# RPs");
2052    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2053      {
2054       fIntFlowProductOfCorrelationsVsMPro[pi]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2055      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2056        {
2057         fIntFlowProductOfCorrelationsVsMPro[pi]->GetXaxis()->SetTitle("# POIs");
2058        }
2059    fIntFlowProfiles->Add(fIntFlowProductOfCorrelationsVsMPro[pi]);
2060   } // end of for(Int_t pi=0;pi<6;pi++)
2061  } // end of if(fCalculateCumulantsVsM) 
2062  // average product of correction terms for NUA:  
2063  TString intFlowProductOfCorrectionTermsForNUAProName = "fIntFlowProductOfCorrectionTermsForNUAPro";
2064  intFlowProductOfCorrectionTermsForNUAProName += fAnalysisLabel->Data();
2065  fIntFlowProductOfCorrectionTermsForNUAPro = new TProfile(intFlowProductOfCorrectionTermsForNUAProName.Data(),"Average products of correction terms for NUA",27,0,27);
2066  fIntFlowProductOfCorrectionTermsForNUAPro->SetTickLength(-0.01,"Y");
2067  fIntFlowProductOfCorrectionTermsForNUAPro->SetMarkerStyle(25); 
2068  fIntFlowProductOfCorrectionTermsForNUAPro->SetLabelSize(0.03);
2069  fIntFlowProductOfCorrectionTermsForNUAPro->SetLabelOffset(0.01,"Y");
2070  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(1,"<<2><cos(#phi)>>");
2071  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(2,"<<2><sin(#phi)>>");
2072  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(3,"<<cos(#phi)><sin(#phi)>>");
2073  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(4,"Cov(<2>,<cos(#phi_{1}+#phi_{2})>)");
2074  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(5,"Cov(<2>,<sin(#phi_{1}+#phi_{2})>)");
2075  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(6,"Cov(<2>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2076  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(7,"Cov(<2>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2077  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(8,"Cov(<4>,<cos(#phi)>)");
2078  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(9,"Cov(<4>,<sin(#phi)>)");
2079  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(10,"Cov(<4>,<cos(#phi_{1}+#phi_{2})>)");
2080  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(11,"Cov(<4>,<sin(#phi_{1}+#phi_{2})>)");
2081  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(12,"Cov(<4>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>>)");
2082  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(13,"Cov(<4>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>>)");
2083  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(14,"Cov(<cos(#phi)>,<cos(#phi_{1}+#phi_{2})>)"); 
2084  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(15,"Cov(<cos(#phi)>,<sin(#phi_{1}+#phi_{2})>)");
2085  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(16,"Cov(<cos(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2086  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(17,"Cov(<cos(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2087  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(18,"Cov(<sin(#phi)>,<cos(#phi_{1}+#phi_{2})>)");
2088  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(19,"Cov(<sin(#phi)>,<sin(#phi_{1}+#phi_{2})>)");
2089  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(20,"Cov(<sin(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2090  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(21,"Cov(<sin(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2091  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(22,"Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}+#phi_{2})>)");
2092  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(23,"Cov(<cos(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2093  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(24,"Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2094  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(25,"Cov(<sin(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2095  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(26,"Cov(<sin(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2096  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(27,"Cov(<cos(#phi_{1}-#phi_{2}-#phi_{3}>,<sin(#phi_{1}-#phi_{2}-#phi_{3}>)");
2097  fIntFlowProfiles->Add(fIntFlowProductOfCorrectionTermsForNUAPro);
2098  // average correction terms for non-uniform acceptance (with wrong errors!):
2099  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
2100  {
2101   TString intFlowCorrectionTermsForNUAProName = "fIntFlowCorrectionTermsForNUAPro";
2102   intFlowCorrectionTermsForNUAProName += fAnalysisLabel->Data();
2103   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");
2104   fIntFlowCorrectionTermsForNUAPro[sc]->SetTickLength(-0.01,"Y");
2105   fIntFlowCorrectionTermsForNUAPro[sc]->SetMarkerStyle(25);
2106   fIntFlowCorrectionTermsForNUAPro[sc]->SetLabelSize(0.05);
2107   fIntFlowCorrectionTermsForNUAPro[sc]->SetLabelOffset(0.01,"Y");
2108   (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(1,Form("#LT#LT%s(n(#phi_{1}))#GT#GT",sinCosFlag[sc].Data()));
2109   (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(2,Form("#LT#LT%s(n(#phi_{1}+#phi_{2}))#GT#GT",sinCosFlag[sc].Data()));  
2110   (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(3,Form("#LT#LT%s(n(#phi_{1}-#phi_{2}-#phi_{3}))#GT#GT",sinCosFlag[sc].Data()));  
2111   (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(4,Form("#LT#LT%s(n(2#phi_{1}-#phi_{2}))#GT#GT",sinCosFlag[sc].Data()));  
2112   fIntFlowProfiles->Add(fIntFlowCorrectionTermsForNUAPro[sc]);
2113   // versus multiplicity:
2114   if(fCalculateCumulantsVsM)
2115   {
2116    TString correctionTermFlag[4] = {"(n(phi1))","(n(phi1+phi2))","(n(phi1-phi2-phi3))","(n(2phi1-phi2))"}; // to be improved - hardwired 4
2117    for(Int_t ci=0;ci<4;ci++) // correction term index (to be improved - hardwired 4)
2118    {
2119     TString intFlowCorrectionTermsForNUAVsMProName = "fIntFlowCorrectionTermsForNUAVsMPro";
2120     intFlowCorrectionTermsForNUAVsMProName += fAnalysisLabel->Data();
2121     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");
2122     fIntFlowProfiles->Add(fIntFlowCorrectionTermsForNUAVsMPro[sc][ci]);
2123    }
2124   } // end of if(fCalculateCumulantsVsM)
2125  } // end of for(Int_t sc=0;sc<2;sc++) 
2126  
2127  // d) Book histograms holding the final results:
2128  // average correlations <<2>>, <<4>>, <<6>> and <<8>> for all events (with correct errors!):
2129  TString intFlowCorrelationsHistName = "fIntFlowCorrelationsHist";
2130  intFlowCorrelationsHistName += fAnalysisLabel->Data();
2131  fIntFlowCorrelationsHist = new TH1D(intFlowCorrelationsHistName.Data(),"Average correlations for all events",4,0,4);
2132  fIntFlowCorrelationsHist->SetTickLength(-0.01,"Y");
2133  fIntFlowCorrelationsHist->SetMarkerStyle(25);
2134  fIntFlowCorrelationsHist->SetLabelSize(0.06);
2135  fIntFlowCorrelationsHist->SetLabelOffset(0.01,"Y");
2136  (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(1,"#LT#LT2#GT#GT");
2137  (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(2,"#LT#LT4#GT#GT");
2138  (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(3,"#LT#LT6#GT#GT");
2139  (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(4,"#LT#LT8#GT#GT");
2140  fIntFlowResults->Add(fIntFlowCorrelationsHist);
2141  // average correlations <<2>>, <<4>>, <<6>> and <<8>> for all events (with correct errors!) vs M:
2142  if(fCalculateCumulantsVsM)
2143  {
2144   for(Int_t ci=0;ci<4;ci++) // correlation index
2145   {
2146    TString intFlowCorrelationsVsMHistName = "fIntFlowCorrelationsVsMHist";
2147    intFlowCorrelationsVsMHistName += fAnalysisLabel->Data();
2148    fIntFlowCorrelationsVsMHist[ci] = new TH1D(Form("%s, %s",intFlowCorrelationsVsMHistName.Data(),correlationFlag[ci].Data()),
2149                                               Form("%s vs multiplicity",correlationFlag[ci].Data()),
2150                                               fnBinsMult,fMinMult,fMaxMult);                                            
2151    fIntFlowCorrelationsVsMHist[ci]->GetYaxis()->SetTitle(correlationFlag[ci].Data());
2152    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2153    {
2154     fIntFlowCorrelationsVsMHist[ci]->GetXaxis()->SetTitle("# RPs");
2155    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2156      {
2157       fIntFlowCorrelationsVsMHist[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2158      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2159        {
2160         fIntFlowCorrelationsVsMHist[ci]->GetXaxis()->SetTitle("# POIs");
2161        }
2162    fIntFlowResults->Add(fIntFlowCorrelationsVsMHist[ci]);
2163   } // end of for(Int_t ci=0;ci<4;ci++) // correlation index   
2164  } // end of if(fCalculateCumulantsVsM) 
2165  // average all correlations for all events (with correct errors!):
2166  TString intFlowCorrelationsAllHistName = "fIntFlowCorrelationsAllHist";
2167  intFlowCorrelationsAllHistName += fAnalysisLabel->Data();
2168  fIntFlowCorrelationsAllHist = new TH1D(intFlowCorrelationsAllHistName.Data(),"Average correlations for all events",34,0,34);
2169  fIntFlowCorrelationsAllHist->SetTickLength(-0.01,"Y");
2170  fIntFlowCorrelationsAllHist->SetMarkerStyle(25);
2171  fIntFlowCorrelationsAllHist->SetLabelSize(0.03);
2172  fIntFlowCorrelationsAllHist->SetLabelOffset(0.01,"Y");
2173  // 2-p correlations:
2174  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(1,"<<2>>_{n|n}");
2175  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(2,"<<2>>_{2n|2n}");
2176  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(3,"<<2>>_{3n|3n}");
2177  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(4,"<<2>>_{4n|4n}");
2178  // 3-p correlations:
2179  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(6,"<<3>>_{2n|n,n}");
2180  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(7,"<<3>>_{3n|2n,n}");
2181  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(8,"<<3>>_{4n|2n,2n}");
2182  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(9,"<<3>>_{4n|3n,n}");
2183  // 4-p correlations:
2184  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(11,"<<4>>_{n,n|n,n}"); 
2185  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(12,"<<4>>_{2n,n|2n,n}");
2186  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(13,"<<4>>_{2n,2n|2n,2n}");
2187  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(14,"<<4>>_{3n|n,n,n}");
2188  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(15,"<<4>>_{3n,n|3n,n}");
2189  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(16,"<<4>>_{3n,n|2n,2n}"); 
2190  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(17,"<<4>>_{4n|2n,n,n}");
2191  // 5-p correlations:
2192  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(19,"<<5>>_{2n|n,n,n,n}"); 
2193  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(20,"<<5>>_{2n,2n|2n,n,n}");
2194  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(21,"<<5>>_{3n,n|2n,n,n}");
2195  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(22,"<<5>>_{4n|n,n,n,n}");
2196  // 6-p correlations:
2197  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(24,"<<6>>_{n,n,n|n,n,n}");
2198  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(25,"<<6>>_{2n,n,n|2n,n,n}");
2199  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(26,"<<6>>_{2n,2n|n,n,n,n}");
2200  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(27,"<<6>>_{3n,n|n,n,n,n}");
2201  // 7-p correlations:  
2202  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(29,"<<7>>_{2n,n,n|n,n,n,n}");
2203  // 8-p correlations:
2204  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(31,"<<8>>_{n,n,n,n|n,n,n,n}");
2205  fIntFlowResults->Add(fIntFlowCorrelationsAllHist);
2206  // average correction terms for non-uniform acceptance (with correct errors!):
2207  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
2208  {
2209   TString intFlowCorrectionTermsForNUAHistName = "fIntFlowCorrectionTermsForNUAHist";
2210   intFlowCorrectionTermsForNUAHistName += fAnalysisLabel->Data();
2211   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);
2212   fIntFlowCorrectionTermsForNUAHist[sc]->SetTickLength(-0.01,"Y");
2213   fIntFlowCorrectionTermsForNUAHist[sc]->SetMarkerStyle(25);
2214   fIntFlowCorrectionTermsForNUAHist[sc]->SetLabelSize(0.05);
2215   fIntFlowCorrectionTermsForNUAHist[sc]->SetLabelOffset(0.01,"Y");
2216   (fIntFlowCorrectionTermsForNUAHist[sc]->GetXaxis())->SetBinLabel(1,Form("#LT#LT%s(n(#phi_{1}))#GT#GT",sinCosFlag[sc].Data()));
2217   (fIntFlowCorrectionTermsForNUAHist[sc]->GetXaxis())->SetBinLabel(2,Form("#LT#LT%s(n(#phi_{1}+#phi_{2}))#GT#GT",sinCosFlag[sc].Data()));  
2218   (fIntFlowCorrectionTermsForNUAHist[sc]->GetXaxis())->SetBinLabel(3,Form("#LT#LT%s(n(#phi_{1}-#phi_{2}-#phi_{3}))#GT#GT",sinCosFlag[sc].Data()));  
2219   (fIntFlowCorrectionTermsForNUAHist[sc]->GetXaxis())->SetBinLabel(4,Form("#LT#LT%s(n(2#phi_{1}-#phi_{2}))#GT#GT",sinCosFlag[sc].Data()));   
2220   fIntFlowResults->Add(fIntFlowCorrectionTermsForNUAHist[sc]);
2221  } // end of for(Int_t sc=0;sc<2;sc++) 
2222  // covariances (multiplied with weight dependent prefactor):
2223  TString intFlowCovariancesName = "fIntFlowCovariances";
2224  intFlowCovariancesName += fAnalysisLabel->Data();
2225  fIntFlowCovariances = new TH1D(intFlowCovariancesName.Data(),"Covariances (multiplied with weight dependent prefactor)",6,0,6);
2226  fIntFlowCovariances->SetLabelSize(0.04);
2227  fIntFlowCovariances->SetMarkerStyle(25);
2228  (fIntFlowCovariances->GetXaxis())->SetBinLabel(1,"Cov(#LT2#GT,#LT4#GT)");
2229  (fIntFlowCovariances->GetXaxis())->SetBinLabel(2,"Cov(#LT2#GT,#LT6#GT)");
2230  (fIntFlowCovariances->GetXaxis())->SetBinLabel(3,"Cov(#LT2#GT,#LT8#GT)");
2231  (fIntFlowCovariances->GetXaxis())->SetBinLabel(4,"Cov(#LT4#GT,#LT6#GT)");
2232  (fIntFlowCovariances->GetXaxis())->SetBinLabel(5,"Cov(#LT4#GT,#LT8#GT)");
2233  (fIntFlowCovariances->GetXaxis())->SetBinLabel(6,"Cov(#LT6#GT,#LT8#GT)");  
2234  fIntFlowResults->Add(fIntFlowCovariances);
2235  // sum of linear and quadratic event weights for <2>, <4>, <6> and <8>:
2236  TString intFlowSumOfEventWeightsName = "fIntFlowSumOfEventWeights";
2237  intFlowSumOfEventWeightsName += fAnalysisLabel->Data();
2238  for(Int_t power=0;power<2;power++)
2239  {
2240   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);
2241   fIntFlowSumOfEventWeights[power]->SetLabelSize(0.04);
2242   fIntFlowSumOfEventWeights[power]->SetMarkerStyle(25);
2243   if(power == 0)
2244   {
2245    (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{#LT2#GT}");
2246    (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{#LT4#GT}");
2247    (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{#LT6#GT}");
2248    (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{#LT8#GT}");
2249   } else if (power == 1) 
2250     {
2251      (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{#LT2#GT}^{2}");
2252      (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{#LT4#GT}^{2}");
2253      (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{#LT6#GT}^{2}");
2254      (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{#LT8#GT}^{2}");
2255     }
2256   fIntFlowResults->Add(fIntFlowSumOfEventWeights[power]);
2257  } 
2258  // sum of products of event weights for correlations <2>, <4>, <6> and <8>:  
2259  TString intFlowSumOfProductOfEventWeightsName = "fIntFlowSumOfProductOfEventWeights";
2260  intFlowSumOfProductOfEventWeightsName += fAnalysisLabel->Data();
2261  fIntFlowSumOfProductOfEventWeights = new TH1D(intFlowSumOfProductOfEventWeightsName.Data(),"Sum of product of event weights for correlations",6,0,6);
2262  fIntFlowSumOfProductOfEventWeights->SetLabelSize(0.04);
2263  fIntFlowSumOfProductOfEventWeights->SetMarkerStyle(25);
2264  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LT4#GT}");
2265  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LT6#GT}");
2266  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LT8#GT}");
2267  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LT6#GT}");
2268  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(5,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LT8#GT}");
2269  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(6,"#sum_{i=1}^{N} w_{#LT6#GT} w_{#LT8#GT}");
2270  fIntFlowResults->Add(fIntFlowSumOfProductOfEventWeights);
2271  // final result for covariances of correlations (multiplied with weight dependent prefactor) versus M
2272  // [0=Cov(2,4),1=Cov(2,6),2=Cov(2,8),3=Cov(4,6),4=Cov(4,8),5=Cov(6,8)]:
2273  if(fCalculateCumulantsVsM)
2274  {
2275   TString intFlowCovariancesVsMName = "fIntFlowCovariancesVsM";
2276   intFlowCovariancesVsMName += fAnalysisLabel->Data();
2277   TString covarianceFlag[6] = {"Cov(<2>,<4>)","Cov(<2>,<6>)","Cov(<2>,<8>)","Cov(<4>,<6>)","Cov(<4>,<8>)","Cov(<6>,<8>)"};
2278   for(Int_t ci=0;ci<6;ci++)
2279   {
2280    fIntFlowCovariancesVsM[ci] = new TH1D(Form("%s, %s",intFlowCovariancesVsMName.Data(),covarianceFlag[ci].Data()),
2281                                          Form("%s vs multiplicity",covarianceFlag[ci].Data()),
2282                                          fnBinsMult,fMinMult,fMaxMult);
2283    fIntFlowCovariancesVsM[ci]->GetYaxis()->SetTitle(covarianceFlag[ci].Data());
2284    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2285    {
2286     fIntFlowCovariancesVsM[ci]->GetXaxis()->SetTitle("# RPs");
2287    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2288      {
2289       fIntFlowCovariancesVsM[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2290      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2291        {
2292         fIntFlowCovariancesVsM[ci]->GetXaxis()->SetTitle("# POIs");
2293        }
2294    fIntFlowResults->Add(fIntFlowCovariancesVsM[ci]);
2295   }
2296  } // end of if(fCalculateCumulantsVsM) 
2297  // sum of linear and quadratic event weights for <2>, <4>, <6> and <8> versus multiplicity
2298  // [0=sum{w_{<2>}},1=sum{w_{<4>}},2=sum{w_{<6>}},3=sum{w_{<8>}}][0=linear 1,1=quadratic]:
2299  if(fCalculateCumulantsVsM)
2300  {
2301   TString intFlowSumOfEventWeightsVsMName = "fIntFlowSumOfEventWeightsVsM";
2302   intFlowSumOfEventWeightsVsMName += fAnalysisLabel->Data();
2303   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>}"},
2304                            {"#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}"}};
2305   for(Int_t si=0;si<4;si++)
2306   {
2307    for(Int_t power=0;power<2;power++)
2308    {
2309     fIntFlowSumOfEventWeightsVsM[si][power] = new TH1D(Form("%s, %s",intFlowSumOfEventWeightsVsMName.Data(),sumFlag[power][si].Data()),
2310                                                        Form("%s vs multiplicity",sumFlag[power][si].Data()),
2311                                                        fnBinsMult,fMinMult,fMaxMult);    
2312     fIntFlowSumOfEventWeightsVsM[si][power]->GetYaxis()->SetTitle(sumFlag[power][si].Data());  
2313     if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2314     {
2315      fIntFlowSumOfEventWeightsVsM[si][power]->GetXaxis()->SetTitle("# RPs");
2316     } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2317       {
2318        fIntFlowSumOfEventWeightsVsM[si][power]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2319       } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2320         {
2321          fIntFlowSumOfEventWeightsVsM[si][power]->GetXaxis()->SetTitle("# POIs");
2322         }
2323     fIntFlowResults->Add(fIntFlowSumOfEventWeightsVsM[si][power]);
2324    } // end of for(Int_t power=0;power<2;power++)
2325   } // end of for(Int_t si=0;si<4;si++)   
2326  } // end of if(fCalculateCumulantsVsM)
2327  // sum of products of event weights for correlations <2>, <4>, <6> and <8> vs M
2328  // [0=sum{w_{<2>}w_{<4>}},1=sum{w_{<2>}w_{<6>}},2=sum{w_{<2>}w_{<8>}},
2329  //  3=sum{w_{<4>}w_{<6>}},4=sum{w_{<4>}w_{<8>}},5=sum{w_{<6>}w_{<8>}}]:  
2330  if(fCalculateCumulantsVsM)
2331  {
2332   TString intFlowSumOfProductOfEventWeightsVsMName = "fIntFlowSumOfProductOfEventWeightsVsM";
2333   intFlowSumOfProductOfEventWeightsVsMName += fAnalysisLabel->Data();
2334   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>}",
2335                           "#sum_{i=1}^{N} w_{<4>} w_{<6>}","#sum_{i=1}^{N} w_{<4>} w_{<8>}","#sum_{i=1}^{N} w_{<6>} w_{<8>}"}; 
2336   for(Int_t pi=0;pi<6;pi++)
2337   {
2338    fIntFlowSumOfProductOfEventWeightsVsM[pi] = new TH1D(Form("%s, %s",intFlowSumOfProductOfEventWeightsVsMName.Data(),sopowFlag[pi].Data()),
2339                                                         Form("%s versus multiplicity",sopowFlag[pi].Data()),
2340                                                         fnBinsMult,fMinMult,fMaxMult); 
2341    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2342    {
2343     fIntFlowSumOfProductOfEventWeightsVsM[pi]->GetXaxis()->SetTitle("# RPs"); 
2344    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2345      {
2346       fIntFlowSumOfProductOfEventWeightsVsM[pi]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2347      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2348        {
2349         fIntFlowSumOfProductOfEventWeightsVsM[pi]->GetXaxis()->SetTitle("# POIs");
2350        }
2351    fIntFlowSumOfProductOfEventWeightsVsM[pi]->GetYaxis()->SetTitle(sopowFlag[pi].Data()); 
2352    fIntFlowResults->Add(fIntFlowSumOfProductOfEventWeightsVsM[pi]);
2353   } // end of for(Int_t pi=0;pi<6;pi++) 
2354  } // end of if(fCalculateCumulantsVsM)
2355  // covariances of NUA terms (multiplied with weight dependent prefactor):
2356  TString intFlowCovariancesNUAName = "fIntFlowCovariancesNUA";
2357  intFlowCovariancesNUAName += fAnalysisLabel->Data();
2358  fIntFlowCovariancesNUA = new TH1D(intFlowCovariancesNUAName.Data(),"Covariances for NUA (multiplied with weight dependent prefactor)",27,0,27);
2359  fIntFlowCovariancesNUA->SetLabelSize(0.04);
2360  fIntFlowCovariancesNUA->SetMarkerStyle(25);
2361  fIntFlowCovariancesNUA->GetXaxis()->SetLabelSize(0.02);
2362  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(1,"Cov(<2>,<cos(#phi)>");
2363  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(2,"Cov(<2>,<sin(#phi)>)");
2364  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(3,"Cov(<cos(#phi)>,<sin(#phi)>)");
2365  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(4,"Cov(<2>,<cos(#phi_{1}+#phi_{2})>)");
2366  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(5,"Cov(<2>,<sin(#phi_{1}+#phi_{2})>)");
2367  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(6,"Cov(<2>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2368  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(7,"Cov(<2>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2369  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(8,"Cov(<4>,<cos(#phi)>)");
2370  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(9,"Cov(<4>,<sin(#phi)>)");
2371  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(10,"Cov(<4>,<cos(#phi_{1}+#phi_{2})>)");
2372  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(11,"Cov(<4>,<sin(#phi_{1}+#phi_{2})>)");
2373  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(12,"Cov(<4>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>>)");
2374  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(13,"Cov(<4>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>>)");
2375  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(14,"Cov(<cos(#phi)>,<cos(#phi_{1}+#phi_{2})>)"); 
2376  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(15,"Cov(<cos(#phi)>,<sin(#phi_{1}+#phi_{2})>)");
2377  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(16,"Cov(<cos(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2378  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(17,"Cov(<cos(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2379  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(18,"Cov(<sin(#phi)>,<cos(#phi_{1}+#phi_{2})>)");
2380  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(19,"Cov(<sin(#phi)>,<sin(#phi_{1}+#phi_{2})>)");
2381  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(20,"Cov(<sin(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2382  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(21,"Cov(<sin(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2383  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(22,"Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}+#phi_{2})>)");
2384  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(23,"Cov(<cos(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2385  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(24,"Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2386  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(25,"Cov(<sin(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2387  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(26,"Cov(<sin(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2388  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(27,"Cov(<cos(#phi_{1}-#phi_{2}-#phi_{3}>,<sin(#phi_{1}-#phi_{2}-#phi_{3}>)");
2389  fIntFlowResults->Add(fIntFlowCovariancesNUA);
2390  // sum of linear and quadratic event weights for NUA terms:
2391  TString intFlowSumOfEventWeightsNUAName = "fIntFlowSumOfEventWeightsNUA";
2392  intFlowSumOfEventWeightsNUAName += fAnalysisLabel->Data();
2393  for(Int_t sc=0;sc<2;sc++)
2394  {
2395   for(Int_t power=0;power<2;power++)
2396   {
2397    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
2398    fIntFlowSumOfEventWeightsNUA[sc][power]->SetLabelSize(0.05);
2399    fIntFlowSumOfEventWeightsNUA[sc][power]->SetMarkerStyle(25);
2400    if(power == 0)
2401    {
2402     (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(1,Form("#sum_{i=1}^{N} w_{<%s(#phi)>}",sinCosFlag[sc].Data()));
2403     (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(2,Form("#sum_{i=1}^{N} w_{<%s(#phi_{1}+#phi_{2})>}",sinCosFlag[sc].Data()));
2404     (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(3,Form("#sum_{i=1}^{N} w_{<%s(#phi_{1}-#phi_{2}-#phi_{3})>}",sinCosFlag[sc].Data()));   
2405     (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(4,Form("#sum_{i=1}^{N} w_{<%s(2#phi_{1}-#phi_{2})>}",sinCosFlag[sc].Data()));
2406    } else if(power == 1) 
2407      {
2408       (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(1,Form("#sum_{i=1}^{N} w_{<%s(#phi)>}^{2}",sinCosFlag[sc].Data()));
2409       (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(2,Form("#sum_{i=1}^{N} w_{<%s(#phi_{1}+#phi_{2})>}^{2}",sinCosFlag[sc].Data()));
2410       (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(3,Form("#sum_{i=1}^{N} w_{<%s(#phi_{1}-#phi_{2}-#phi_{3})>}^{2}",sinCosFlag[sc].Data()));
2411       (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(4,Form("#sum_{i=1}^{N} w_{<%s(2#phi_{1}-#phi_{2})>}^{2}",sinCosFlag[sc].Data()));
2412      }
2413    fIntFlowResults->Add(fIntFlowSumOfEventWeightsNUA[sc][power]);
2414   }
2415  }  
2416  // sum of products of event weights for NUA terms:  
2417  TString intFlowSumOfProductOfEventWeightsNUAName = "fIntFlowSumOfProductOfEventWeightsNUA";
2418  intFlowSumOfProductOfEventWeightsNUAName += fAnalysisLabel->Data();
2419  fIntFlowSumOfProductOfEventWeightsNUA = new TH1D(intFlowSumOfProductOfEventWeightsNUAName.Data(),"Sum of product of event weights for NUA terms",27,0,27);
2420  fIntFlowSumOfProductOfEventWeightsNUA->SetLabelSize(0.02);
2421  fIntFlowSumOfProductOfEventWeightsNUA->SetMarkerStyle(25);
2422  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTcos(#phi)#GT}");
2423  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTsin(#phi)#GT}");
2424  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTsin(#phi)#GT}");
2425  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTcos(#phi_{1}+#phi_{2})#GT}");
2426  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(5,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2427  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(6,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2428  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(7,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2429  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(8,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTcos(#phi)#GT}");
2430  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(9,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTsin(#phi)#GT}");
2431  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(10,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTcos(#phi_{1}+#phi_{2})#GT}");
2432  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(11,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2433  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(12,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2434  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(13,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2435  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(14,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTcos(#phi_{1}+#phi_{2})#GT}");
2436  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(15,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2437  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(16,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2438  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(17,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2439  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(18,"#sum_{i=1}^{N} w_{#LTsin(#phi)#GT} w_{#LTcos(#phi_{1}+#phi_{2})#GT}");
2440  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(19,"#sum_{i=1}^{N} w_{#LTsin(#phi)#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2441  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(20,"#sum_{i=1}^{N} w_{#LTsin(#phi)#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2442  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(21,"#sum_{i=1}^{N} w_{#LTsin(#phi)#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2443  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(22,"#sum_{i=1}^{N} w_{#LTcos(#phi_{1}+#phi_{2})#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2444  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(23,"#sum_{i=1}^{N} w_{#LTcos(#phi_{1}+#phi_{2})#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2445  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(24,"#sum_{i=1}^{N} w_{#LTcos(#phi_{1}+#phi_{2})#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2446  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(25,"#sum_{i=1}^{N} w_{#LTsin(#phi_{1}+#phi_{2})#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2447  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(26,"#sum_{i=1}^{N} w_{#LTsin(#phi_{1}+#phi_{2})#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2448  (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}");
2449  fIntFlowResults->Add(fIntFlowSumOfProductOfEventWeightsNUA);
2450  // Final results for reference Q-cumulants:
2451  TString cumulantFlag[4] = {"QC{2}","QC{4}","QC{6}","QC{8}"};
2452  TString intFlowQcumulantsName = "fIntFlowQcumulants";
2453  intFlowQcumulantsName += fAnalysisLabel->Data();
2454  fIntFlowQcumulants = new TH1D(intFlowQcumulantsName.Data(),"Reference Q-cumulants",4,0,4);
2455  if(fPropagateErrorAlsoFromNIT)
2456  {
2457   fIntFlowQcumulants->SetTitle("Reference Q-cumulants (error from non-isotropic terms also propagated)");
2458  }
2459  fIntFlowQcumulants->SetLabelSize(0.05);
2460  fIntFlowQcumulants->SetMarkerStyle(25);
2461  for(Int_t b=0;b<4;b++)
2462  {
2463   (fIntFlowQcumulants->GetXaxis())->SetBinLabel(b+1,cumulantFlag[b].Data());
2464  } 
2465  fIntFlowResults->Add(fIntFlowQcumulants);
2466  // Final results for reference Q-cumulants rebinned in M: 
2467  if(fCalculateCumulantsVsM)
2468  {
2469   TString intFlowQcumulantsRebinnedInMName = "fIntFlowQcumulantsRebinnedInM";
2470   intFlowQcumulantsRebinnedInMName += fAnalysisLabel->Data();
2471   fIntFlowQcumulantsRebinnedInM = new TH1D(intFlowQcumulantsRebinnedInMName.Data(),"Reference Q-cumulants rebinned in M",4,0,4);
2472   fIntFlowQcumulantsRebinnedInM->SetLabelSize(0.05);
2473   fIntFlowQcumulantsRebinnedInM->SetMarkerStyle(25);
2474   for(Int_t b=0;b<4;b++)
2475   {
2476    (fIntFlowQcumulantsRebinnedInM->GetXaxis())->SetBinLabel(b+1,cumulantFlag[b].Data());
2477   } 
2478   fIntFlowResults->Add(fIntFlowQcumulantsRebinnedInM);
2479  } // end of if(fCalculateCumulantsVsM) 
2480  // Ratio between error squared: with/without non-isotropic terms:
2481  TString intFlowQcumulantsErrorSquaredRatioName = "fIntFlowQcumulantsErrorSquaredRatio";
2482  intFlowQcumulantsErrorSquaredRatioName += fAnalysisLabel->Data();
2483  fIntFlowQcumulantsErrorSquaredRatio = new TH1D(intFlowQcumulantsErrorSquaredRatioName.Data(),"Error squared of reference Q-cumulants: #frac{with NUA terms}{without NUA terms}",4,0,4);
2484  fIntFlowQcumulantsErrorSquaredRatio->SetLabelSize(0.05);
2485  fIntFlowQcumulantsErrorSquaredRatio->SetMarkerStyle(25);
2486  for(Int_t b=0;b<4;b++)
2487  {
2488   (fIntFlowQcumulantsErrorSquaredRatio->GetXaxis())->SetBinLabel(b+1,cumulantFlag[b].Data());
2489  } 
2490  fIntFlowResults->Add(fIntFlowQcumulantsErrorSquaredRatio);
2491  // final results for integrated Q-cumulants versus multiplicity:
2492  if(fCalculateCumulantsVsM)
2493  {
2494   TString intFlowQcumulantsVsMName = "fIntFlowQcumulantsVsM";
2495   intFlowQcumulantsVsMName += fAnalysisLabel->Data();
2496   for(Int_t co=0;co<4;co++) // cumulant order
2497   {
2498    fIntFlowQcumulantsVsM[co] = new TH1D(Form("%s, %s",intFlowQcumulantsVsMName.Data(),cumulantFlag[co].Data()),
2499                                         Form("%s vs multiplicity",cumulantFlag[co].Data()),
2500                                         fnBinsMult,fMinMult,fMaxMult);
2501    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2502    {
2503     fIntFlowQcumulantsVsM[co]->GetXaxis()->SetTitle("# RPs");
2504    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2505      {
2506       fIntFlowQcumulantsVsM[co]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2507      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2508        {
2509         fIntFlowQcumulantsVsM[co]->GetXaxis()->SetTitle("# POIs");
2510        }
2511    fIntFlowQcumulantsVsM[co]->GetYaxis()->SetTitle(cumulantFlag[co].Data());  
2512    fIntFlowResults->Add(fIntFlowQcumulantsVsM[co]);                                    
2513   } // end of for(Int_t co=0;co<4;co++) // cumulant order
2514  } // end of if(fCalculateCumulantsVsM)
2515  // final integrated flow estimates from Q-cumulants:
2516  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)};
2517  TString intFlowName = "fIntFlow";
2518  intFlowName += fAnalysisLabel->Data();  
2519  // integrated flow from Q-cumulants:
2520  fIntFlow = new TH1D(intFlowName.Data(),"Reference flow estimates from Q-cumulants",4,0,4);
2521  fIntFlow->SetLabelSize(0.05);
2522  fIntFlow->SetMarkerStyle(25);
2523  for(Int_t b=0;b<4;b++)
2524  {
2525   (fIntFlow->GetXaxis())->SetBinLabel(b+1,flowFlag[b].Data()); 
2526  }
2527  fIntFlowResults->Add(fIntFlow); 
2528  // Reference flow vs M rebinned in one huge bin:
2529  if(fCalculateCumulantsVsM)
2530  { 
2531   TString intFlowRebinnedInMName = "fIntFlowRebinnedInM";
2532   intFlowRebinnedInMName += fAnalysisLabel->Data();  
2533   fIntFlowRebinnedInM = new TH1D(intFlowRebinnedInMName.Data(),"Reference flow estimates from Q-cumulants (rebinned in M)",4,0,4);
2534   fIntFlowRebinnedInM->SetLabelSize(0.05);
2535   fIntFlowRebinnedInM->SetMarkerStyle(25);
2536   for(Int_t b=0;b<4;b++)
2537   {
2538    (fIntFlowRebinnedInM->GetXaxis())->SetBinLabel(b+1,flowFlag[b].Data()); 
2539   }
2540   fIntFlowResults->Add(fIntFlowRebinnedInM); 
2541  } 
2542  // integrated flow from Q-cumulants: versus multiplicity:
2543  if(fCalculateCumulantsVsM)
2544  {
2545   TString intFlowVsMName = "fIntFlowVsM";
2546   intFlowVsMName += fAnalysisLabel->Data();
2547   for(Int_t co=0;co<4;co++) // cumulant order
2548   {
2549    fIntFlowVsM[co] = new TH1D(Form("%s, %s",intFlowVsMName.Data(),flowFlag[co].Data()),
2550                               Form("%s vs multiplicity",flowFlag[co].Data()),
2551                               fnBinsMult,fMinMult,fMaxMult);
2552    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2553    {
2554     fIntFlowVsM[co]->GetXaxis()->SetTitle("# RPs");
2555    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2556      {
2557       fIntFlowVsM[co]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2558      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2559        {
2560         fIntFlowVsM[co]->GetXaxis()->SetTitle("# POIs"); 
2561        }
2562    fIntFlowVsM[co]->GetYaxis()->SetTitle(flowFlag[co].Data());  
2563    fIntFlowResults->Add(fIntFlowVsM[co]);                                    
2564   } // end of for(Int_t co=0;co<4;co++) // cumulant order
2565  } // end of if(fCalculateCumulantsVsM)
2566  // quantifying detector effects effects to correlations:
2567  TString intFlowDetectorBiasName = "fIntFlowDetectorBias";
2568  intFlowDetectorBiasName += fAnalysisLabel->Data();  
2569  fIntFlowDetectorBias = new TH1D(intFlowDetectorBiasName.Data(),"Quantifying detector bias",4,0,4);
2570  fIntFlowDetectorBias->SetLabelSize(0.05);
2571  fIntFlowDetectorBias->SetMarkerStyle(25);
2572  for(Int_t ci=0;ci<4;ci++)
2573  {  
2574   (fIntFlowDetectorBias->GetXaxis())->SetBinLabel(ci+1,Form("#frac{corrected}{measured} %s",cumulantFlag[ci].Data()));
2575  }
2576  fIntFlowResults->Add(fIntFlowDetectorBias); 
2577  // quantifying detector effects to correlations versus multiplicity:
2578  if(fCalculateCumulantsVsM)
2579  {
2580   TString intFlowDetectorBiasVsMName = "fIntFlowDetectorBiasVsM";
2581   intFlowDetectorBiasVsMName += fAnalysisLabel->Data();
2582   for(Int_t ci=0;ci<4;ci++) // correlation index
2583   {
2584    fIntFlowDetectorBiasVsM[ci] = new TH1D(Form("%s for %s",intFlowDetectorBiasVsMName.Data(),cumulantFlag[ci].Data()),
2585                                           Form("Quantifying detector bias for %s vs multiplicity",cumulantFlag[ci].Data()),
2586                                           fnBinsMult,fMinMult,fMaxMult);
2587    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2588    {
2589     fIntFlowDetectorBiasVsM[ci]->GetXaxis()->SetTitle("# RPs"); 
2590    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2591      {
2592       fIntFlowDetectorBiasVsM[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2593      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2594        {
2595         fIntFlowDetectorBiasVsM[ci]->GetXaxis()->SetTitle("# POIs");
2596        }
2597    fIntFlowDetectorBiasVsM[ci]->GetYaxis()->SetTitle("#frac{corrected}{measured}");  
2598    fIntFlowResults->Add(fIntFlowDetectorBiasVsM[ci]);                                    
2599   } // end of for(Int_t co=0;co<4;co++) // cumulant order
2600  } // end of if(fCalculateCumulantsVsM)
2601    
2602 } // end of AliFlowAnalysisWithQCumulants::BookEverythingForIntegratedFlow()
2603
2604 //=======================================================================================================================
2605
2606 void AliFlowAnalysisWithQCumulants::BookEverythingForControlHistograms()
2607 {
2608  // Book all objects for control histograms.
2609
2610  // a) Book profile to hold all flags for control histograms;
2611  // b) Book all control histograms.
2612
2613  // a) Book profile to hold all flags for control histograms:
2614  TString controlHistogramsFlagsName = "fControlHistogramsFlags";
2615  controlHistogramsFlagsName += fAnalysisLabel->Data();
2616  fControlHistogramsFlags = new TProfile(controlHistogramsFlagsName.Data(),"Flags for Control Histograms",2,0,2);
2617  fControlHistogramsFlags->SetTickLength(-0.01,"Y");
2618  fControlHistogramsFlags->SetMarkerStyle(25);
2619  fControlHistogramsFlags->SetLabelSize(0.04);
2620  fControlHistogramsFlags->SetLabelOffset(0.02,"Y");
2621  fControlHistogramsFlags->SetStats(kFALSE);
2622  fControlHistogramsFlags->GetXaxis()->SetBinLabel(1,"fStoreControlHistograms");
2623  fControlHistogramsFlags->GetXaxis()->SetBinLabel(2,"fUseQvectorTerms");
2624  fControlHistogramsList->Add(fControlHistogramsFlags);
2625
2626  if(!fStoreControlHistograms){return;}
2627
2628  // b) Book all control histograms:
2629  //  b1) Correlation between # RPs and ref. mult. determined centrally:
2630  TString sCorrelationNoRPsVsRefMultName = "fCorrelationNoRPsVsRefMult";
2631  sCorrelationNoRPsVsRefMultName += fAnalysisLabel->Data();
2632  fCorrelationNoRPsVsRefMult = new TH2D(sCorrelationNoRPsVsRefMultName.Data(),"# RPs vs. Reference Multiplicity",fnBinsMult,fMinMult,fMaxMult,fnBinsMult,fMinMult,fMaxMult);
2633  fCorrelationNoRPsVsRefMult->SetTickLength(-0.01,"Y");
2634  fCorrelationNoRPsVsRefMult->SetLabelSize(0.04);
2635  fCorrelationNoRPsVsRefMult->SetLabelOffset(0.02,"Y");
2636  fCorrelationNoRPsVsRefMult->SetStats(kTRUE);
2637  fCorrelationNoRPsVsRefMult->GetXaxis()->SetTitle("# RPs");
2638  fCorrelationNoRPsVsRefMult->GetYaxis()->SetTitle("Reference Multiplicity");
2639  fControlHistogramsList->Add(fCorrelationNoRPsVsRefMult);
2640  //  b2) Correlation between # POIs and ref. mult. determined centrally:
2641  TString sCorrelationNoPOIsVsRefMultName = "fCorrelationNoPOIsVsRefMult";
2642  sCorrelationNoPOIsVsRefMultName += fAnalysisLabel->Data();
2643  fCorrelationNoPOIsVsRefMult = new TH2D(sCorrelationNoPOIsVsRefMultName.Data(),"# POIs vs. Reference Multiplicity",fnBinsMult,fMinMult,fMaxMult,fnBinsMult,fMinMult,fMaxMult);
2644  fCorrelationNoPOIsVsRefMult->SetTickLength(-0.01,"Y");
2645  fCorrelationNoPOIsVsRefMult->SetLabelSize(0.04);
2646  fCorrelationNoPOIsVsRefMult->SetLabelOffset(0.02,"Y");
2647  fCorrelationNoPOIsVsRefMult->SetStats(kTRUE);
2648  fCorrelationNoPOIsVsRefMult->GetXaxis()->SetTitle("# POIs");
2649  fCorrelationNoPOIsVsRefMult->GetYaxis()->SetTitle("Reference Multiplicity");
2650  fControlHistogramsList->Add(fCorrelationNoPOIsVsRefMult);
2651  //  b3) Correlation between # RPs and # POIs:
2652  TString sCorrelationNoRPsVsNoPOIsName = "fCorrelationNoRPsVsNoPOIs";
2653  sCorrelationNoRPsVsNoPOIsName += fAnalysisLabel->Data();
2654  fCorrelationNoRPsVsNoPOIs = new TH2D(sCorrelationNoRPsVsNoPOIsName.Data(),"# RPs vs. # POIs",fnBinsMult,fMinMult,fMaxMult,fnBinsMult,fMinMult,fMaxMult);
2655  fCorrelationNoRPsVsNoPOIs->SetTickLength(-0.01,"Y");
2656  fCorrelationNoRPsVsNoPOIs->SetLabelSize(0.04);
2657  fCorrelationNoRPsVsNoPOIs->SetLabelOffset(0.02,"Y");
2658  fCorrelationNoRPsVsNoPOIs->SetStats(kTRUE);
2659  fCorrelationNoRPsVsNoPOIs->GetXaxis()->SetTitle("# RPs");
2660  fCorrelationNoRPsVsNoPOIs->GetYaxis()->SetTitle("# POIs");
2661  fControlHistogramsList->Add(fCorrelationNoRPsVsNoPOIs);
2662  // b4) <2>, <4>, <6> and <8> vs multiplicity (#RPs, #POIs or external):
2663  TString sCorrelation[4] = {"#LT2#GT","#LT4#GT","#LT6#GT","#LT8#GT"};
2664  TString sMultiplicity = "";
2665  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2666  {
2667   sMultiplicity = "# RPs"; 
2668  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2669    {
2670     sMultiplicity = "Reference multiplicity (from ESD)";
2671    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2672      {
2673       sMultiplicity = "# POIs";
2674      }
2675  for(Int_t ci=0;ci<4;ci++)
2676  {
2677   fCorrelation2468VsMult[ci] = new TH2D(Form("%s vs M",sCorrelation[ci].Data()),Form("%s vs M",sCorrelation[ci].Data()),fnBinsMult,fMinMult,fMaxMult,fnBinsForCorrelations,fMinValueOfCorrelation[ci],fMaxValueOfCorrelation[ci]); 
2678   fCorrelation2468VsMult[ci]->SetTickLength(-0.01,"Y");
2679   fCorrelation2468VsMult[ci]->SetLabelSize(0.04);
2680   fCorrelation2468VsMult[ci]->SetLabelOffset(0.02,"Y");
2681   fCorrelation2468VsMult[ci]->SetStats(kTRUE);
2682   fCorrelation2468VsMult[ci]->GetXaxis()->SetTitle(sMultiplicity.Data());
2683   fCorrelation2468VsMult[ci]->GetYaxis()->SetTitle(sCorrelation[ci].Data());
2684   fControlHistogramsList->Add(fCorrelation2468VsMult[ci]); 
2685  } // end of for(Int_t ci=0;ci<4;ci++)
2686  // b5) <2><4>, <2><6>, <2><8>, <4><6> etc. vs multiplicity (#RPs, #POIs or external):
2687  TString sCorrelationProduct[1] = {"#LT2#GT#LT4#GT"}; // TBI: add the other ones when needed first time
2688  for(Int_t cpi=0;cpi<1;cpi++) // TBI: hardwired 1
2689  {
2690   fCorrelationProduct2468VsMult[cpi] = new TH2D(Form("%s vs M",sCorrelationProduct[cpi].Data()),Form("%s vs M",sCorrelationProduct[cpi].Data()),fnBinsMult,fMinMult,fMaxMult,fnBinsForCorrelations,fMinValueOfCorrelationProduct[cpi],fMaxValueOfCorrelationProduct[cpi]);
2691   fCorrelationProduct2468VsMult[cpi]->SetTickLength(-0.01,"Y");
2692   fCorrelationProduct2468VsMult[cpi]->SetLabelSize(0.04);
2693   fCorrelationProduct2468VsMult[cpi]->SetLabelOffset(0.02,"Y");
2694   fCorrelationProduct2468VsMult[cpi]->SetStats(kTRUE);
2695   fCorrelationProduct2468VsMult[cpi]->GetXaxis()->SetTitle(sMultiplicity.Data());
2696   fCorrelationProduct2468VsMult[cpi]->GetYaxis()->SetTitle(sCorrelationProduct[cpi].Data());
2697   fControlHistogramsList->Add(fCorrelationProduct2468VsMult[cpi]); 
2698  } // end of for(Int_t cpi=0;cpi<4;cpi++)
2699  // b6) |Qn|^2/M, |Q2n|^2/M, |Qn|^4/(M(2M-1)), Re[Q2nQn^*Qn^*]/M, ... vs multiplicity (#RPs, #POIs or external)
2700  if(fUseQvectorTerms)
2701  {
2702   TString sQvectorTerms[4] = {"#frac{|Q_{n}|^{2}}{M}","#frac{|Q_{2n}|^{2}}{M}","#frac{|Q_{n}|^{4}}{M(2M-1)}","#frac{Re[Q_{2n}Q_{n}^{*}Q_{n}^{*}]}{M^{3/2}}"}; // TBI: add the other ones when needed first time
2703   for(Int_t qvti=0;qvti<4;qvti++) // TBI: hardwired 4
2704   {
2705    fQvectorTermsVsMult[qvti] = new TH2D(Form("%s vs M",sQvectorTerms[qvti].Data()),Form("%s vs M",sQvectorTerms[qvti].Data()),fnBinsMult,fMinMult,fMaxMult,fnBinsForCorrelations,fMinValueOfQvectorTerms[qvti],fMaxValueOfQvectorTerms[qvti]); 
2706    fQvectorTermsVsMult[qvti]->SetTickLength(-0.01,"Y");
2707    fQvectorTermsVsMult[qvti]->SetLabelSize(0.04);
2708    fQvectorTermsVsMult[qvti]->SetLabelOffset(0.02,"Y");
2709    fQvectorTermsVsMult[qvti]->SetStats(kTRUE);
2710    fQvectorTermsVsMult[qvti]->GetXaxis()->SetTitle(sMultiplicity.Data());
2711    fQvectorTermsVsMult[qvti]->GetYaxis()->SetTitle(sQvectorTerms[qvti].Data());
2712    fControlHistogramsList->Add(fQvectorTermsVsMult[qvti]); 
2713   } // end of for(Int_t qvti=0;qvti<4;qvti++)
2714  } // end of if(fUseQvectorTerms)
2715
2716 } // end of void AliFlowAnalysisWithQCumulants::BookEverythingForControlHistograms()
2717
2718 //=======================================================================================================================
2719
2720 void AliFlowAnalysisWithQCumulants::BookEverythingForBootstrap()
2721 {
2722  // Book all objects needed for bootstrap. 
2723
2724  // a) Book profile to hold all flags for bootstrap;
2725  // b) Book local random generator;
2726  // c) Book all bootstrap objects;
2727  // d) Book all bootstrap objects 'vs M'.
2728
2729  // a) Book profile to hold all flags for bootstrap;
2730  TString bootstrapFlagsName = "fBootstrapFlags";
2731  bootstrapFlagsName += fAnalysisLabel->Data();
2732  fBootstrapFlags = new TProfile(bootstrapFlagsName.Data(),"Flags for bootstrap",3,0,3);
2733  fBootstrapFlags->SetTickLength(-0.01,"Y");
2734  fBootstrapFlags->SetMarkerStyle(25);
2735  fBootstrapFlags->SetLabelSize(0.04);
2736  fBootstrapFlags->SetLabelOffset(0.02,"Y");
2737  fBootstrapFlags->SetStats(kFALSE);
2738  fBootstrapFlags->GetXaxis()->SetBinLabel(1,"fUseBootstrap");
2739  fBootstrapFlags->GetXaxis()->SetBinLabel(2,"fUseBootstrapVsM");
2740  fBootstrapFlags->GetXaxis()->SetBinLabel(3,"fnSubsamples");
2741  fBootstrapList->Add(fBootstrapFlags);
2742
2743  // b) Book local random generator:
2744  if(fUseBootstrap||fUseBootstrapVsM)
2745  { 
2746   fRandom = new TRandom3(0); // if uiSeed is 0, the seed is determined uniquely in space and time via TUUID
2747  }
2748
2749  // c) Book all bootstrap objects:
2750  TString correlationFlag[4] = {"#LT#LT2#GT#GT","#LT#LT4#GT#GT","#LT#LT6#GT#GT","#LT#LT8#GT#GT"};
2751  TString cumulantFlag[4] = {"QC{2}","QC{4}","QC{6}","QC{8}"};
2752  if(fUseBootstrap)
2753  {
2754   // ....
2755   TString bootstrapCorrelationsName = "fBootstrapCorrelations";
2756   bootstrapCorrelationsName += fAnalysisLabel->Data();
2757   fBootstrapCorrelations = new TProfile2D(bootstrapCorrelationsName.Data(),"Bootstrap Correlations",4,0.,4.,fnSubsamples,0,fnSubsamples); // x-axis => <2>, <4>, <6>, <8>; y-axis => subsample # 
2758   fBootstrapCorrelations->SetStats(kFALSE);
2759   for(Int_t ci=0;ci<4;ci++) // correlation index
2760   {
2761    fBootstrapCorrelations->GetXaxis()->SetBinLabel(ci+1,correlationFlag[ci].Data());
2762   } // end of for(Int_t ci=0;ci<4;ci++) // correlation index
2763   for(Int_t ss=0;ss<fnSubsamples;ss++)
2764   {
2765    fBootstrapCorrelations->GetYaxis()->SetBinLabel(ss+1,Form("#%d",ss));
2766   } // end of for(Int_t ss=0;ss<fnSubsamples;ss++)
2767   fBootstrapProfilesList->Add(fBootstrapCorrelations);
2768   // ....
2769   TString bootstrapCumulantsName = "fBootstrapCumulants";
2770   bootstrapCumulantsName += fAnalysisLabel->Data();
2771   fBootstrapCumulants = new TH2D(bootstrapCumulantsName.Data(),"Bootstrap Cumulants",4,0.,4.,fnSubsamples,0,fnSubsamples); // x-axis => QC{2}, QC{4}, QC{6}, QC{8}; y-axis => subsample # 
2772   fBootstrapCumulants->SetStats(kFALSE);
2773   for(Int_t co=0;co<4;co++) // cumulant order
2774   {
2775    fBootstrapCumulants->GetXaxis()->SetBinLabel(co+1,cumulantFlag[co].Data());
2776   } // end of for(Int_t co=0;co<4;co++) // cumulant order
2777   for(Int_t ss=0;ss<fnSubsamples;ss++)
2778   {
2779    fBootstrapCumulants->GetYaxis()->SetBinLabel(ss+1,Form("#%d",ss));
2780   } // end of for(Int_t ss=0;ss<fnSubsamples;ss++)
2781   fBootstrapResultsList->Add(fBootstrapCumulants);
2782  } // end of if(fUseBootstrap)
2783
2784  // d) Book all bootstrap objects 'vs M':
2785  TString sMultiplicity = "";
2786  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2787  {
2788   sMultiplicity = "# RPs"; 
2789  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2790    {
2791     sMultiplicity = "Reference multiplicity (from ESD)";
2792    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2793      {
2794       sMultiplicity = "# POIs";
2795      }
2796  if(fUseBootstrapVsM)
2797  {
2798   // ....
2799   TString bootstrapCorrelationsVsMName = "fBootstrapCorrelationsVsM";
2800   bootstrapCorrelationsVsMName += fAnalysisLabel->Data();
2801   for(Int_t ci=0;ci<4;ci++) // correlation index
2802   {
2803    fBootstrapCorrelationsVsM[ci] = new TProfile2D(Form("%s, %s",bootstrapCorrelationsVsMName.Data(),correlationFlag[ci].Data()),
2804                                        Form("Bootstrap Correlations Vs. M, %s",correlationFlag[ci].Data()),
2805                                        fnBinsMult,fMinMult,fMaxMult,fnSubsamples,0,fnSubsamples); // index => <2>, <4>, <6>, <8>; x-axis => multiplicity; y-axis => subsample # 
2806    fBootstrapCorrelationsVsM[ci]->SetStats(kFALSE);
2807    fBootstrapCorrelationsVsM[ci]->GetXaxis()->SetTitle(sMultiplicity.Data());
2808    for(Int_t ss=0;ss<fnSubsamples;ss++)
2809    {
2810     fBootstrapCorrelationsVsM[ci]->GetYaxis()->SetBinLabel(ss+1,Form("#%d",ss));
2811    } // end of for(Int_t ss=0;ss<fnSubsamples;ss++)
2812    fBootstrapProfilesList->Add(fBootstrapCorrelationsVsM[ci]);
2813   } // end of for(Int_t ci=0;ci<4;ci++) // correlation index 
2814   // ....
2815   TString bootstrapCumulantsVsMName = "fBootstrapCumulantsVsM";
2816   bootstrapCumulantsVsMName += fAnalysisLabel->Data();
2817   for(Int_t co=0;co<4;co++) // cumulant order
2818   {
2819    fBootstrapCumulantsVsM[co] = new TH2D(Form("%s, %s",bootstrapCumulantsVsMName.Data(),cumulantFlag[co].Data()),
2820                                        Form("Bootstrap Cumulants Vs. M, %s",cumulantFlag[co].Data()),
2821                                        fnBinsMult,fMinMult,fMaxMult,fnSubsamples,0,fnSubsamples); // index => <2>, <4>, <6>, <8>; x-axis => multiplicity; y-axis => subsample # 
2822    fBootstrapCumulantsVsM[co]->SetStats(kFALSE);
2823    fBootstrapCumulantsVsM[co]->GetXaxis()->SetTitle(sMultiplicity.Data());
2824    for(Int_t ss=0;ss<fnSubsamples;ss++)
2825    {
2826     fBootstrapCumulantsVsM[co]->GetYaxis()->SetBinLabel(ss+1,Form("#%d",ss));
2827    } // end of for(Int_t ss=0;ss<fnSubsamples;ss++)
2828    fBootstrapResultsList->Add(fBootstrapCumulantsVsM[co]);
2829   } // end of for(Int_t co=0;co<4;co++) // correlation index 
2830  } // end of if(fUseBootstrapVsM)
2831
2832 } // end of void AliFlowAnalysisWithQCumulants::BookEverythingForBootstrap()
2833
2834 //=======================================================================================================================
2835
2836 void AliFlowAnalysisWithQCumulants::BookEverythingForMixedHarmonics()
2837 {
2838  // Book all objects for mixed harmonics.
2839
2840  // a) Book profile to hold all flags for mixed harmonics;
2841  // b) Book all objects in TList fMixedHarmonicsProfiles;
2842  // c) Book all objects in TList fMixedHarmonicsResults;
2843  // d) Book all objects in TList fMixedHarmonicsErrorPropagation.
2844
2845  // a) Book profile to hold all flags for mixed harmonics:
2846  TString mixedHarmonicsFlagsName = "fMixedHarmonicsFlags";
2847  mixedHarmonicsFlagsName += fAnalysisLabel->Data();
2848  fMixedHarmonicsFlags = new TProfile(mixedHarmonicsFlagsName.Data(),"Flags for Mixed Harmonics",4,0,4);
2849  fMixedHarmonicsFlags->SetTickLength(-0.01,"Y");
2850  fMixedHarmonicsFlags->SetMarkerStyle(25);
2851  fMixedHarmonicsFlags->SetLabelSize(0.04);
2852  fMixedHarmonicsFlags->SetLabelOffset(0.02,"Y");
2853  fMixedHarmonicsFlags->SetStats(kFALSE);
2854  fMixedHarmonicsFlags->GetXaxis()->SetBinLabel(1,"Calculate Mixed Harmonics");
2855  fMixedHarmonicsFlags->GetXaxis()->SetBinLabel(2,"Generic Harmonic");
2856  fMixedHarmonicsFlags->GetXaxis()->SetBinLabel(3,"Calculate vs Multiplicity");
2857  fMixedHarmonicsFlags->GetXaxis()->SetBinLabel(4,"Multiplicity Weight");
2858  fMixedHarmonicsList->Add(fMixedHarmonicsFlags);
2859
2860  if(!fCalculateMixedHarmonics){return;}
2861
2862  // b) Book all objects in TList fMixedHarmonicsProfiles:
2863  //  b1) 2-p correlations:
2864  TString s2pCorrelationsName = "f2pCorrelations";
2865  s2pCorrelationsName += fAnalysisLabel->Data();
2866  f2pCorrelations = new TProfile(s2pCorrelationsName.Data(),Form("2-particle correlations (n = %d)",fHarmonic),6,0,6,"s");
2867  f2pCorrelations->SetTickLength(-0.01,"Y");
2868  f2pCorrelations->SetMarkerStyle(25);
2869  f2pCorrelations->SetLabelSize(0.04);
2870  f2pCorrelations->SetLabelOffset(0.02,"Y");
2871  f2pCorrelations->SetStats(kFALSE);
2872  f2pCorrelations->Sumw2();
2873  f2pCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT2#GT#GT_{%dn|%dn}",1*fHarmonic,1*fHarmonic));
2874  f2pCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT2#GT#GT_{%dn|%dn}",2*fHarmonic,2*fHarmonic));
2875  f2pCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT2#GT#GT_{%dn|%dn}",3*fHarmonic,3*fHarmonic));
2876  f2pCorrelations->GetXaxis()->SetBinLabel(4,Form("#LT#LT2#GT#GT_{%dn|%dn}",4*fHarmonic,4*fHarmonic));
2877  f2pCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT2#GT#GT_{%dn|%dn}",5*fHarmonic,5*fHarmonic));
2878  f2pCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT2#GT#GT_{%dn|%dn}",6*fHarmonic,6*fHarmonic));
2879  fMixedHarmonicsProfiles->Add(f2pCorrelations);
2880  //  b2) 3-p correlations (3+6):
2881  TString s3pCorrelationsName = "f3pCorrelations";
2882  s3pCorrelationsName += fAnalysisLabel->Data();
2883  f3pCorrelations = new TProfile(s3pCorrelationsName.Data(),Form("3-particle correlations (n = %d)",fHarmonic),10,0,10,"s"); 
2884  f3pCorrelations->SetTickLength(-0.01,"Y");
2885  f3pCorrelations->SetMarkerStyle(25);
2886  f3pCorrelations->SetLabelSize(0.04);
2887  f3pCorrelations->SetLabelOffset(0.02,"Y");
2888  f3pCorrelations->SetStats(kFALSE);
2889  f3pCorrelations->Sumw2();
2890  // 3-p correlations sensitive to two distinct harmonics (3):
2891  f3pCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic));
2892  f3pCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic));
2893  f3pCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic));
2894  f3pCorrelations->GetXaxis()->SetBinLabel(4,""); // empty
2895  // 3-p correlations sensitive to three distinct harmonics (6):
2896  f3pCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,1*fHarmonic));
2897  f3pCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,1*fHarmonic));
2898  f3pCorrelations->GetXaxis()->SetBinLabel(7,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,2*fHarmonic));
2899  f3pCorrelations->GetXaxis()->SetBinLabel(8,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,1*fHarmonic));
2900  f3pCorrelations->GetXaxis()->SetBinLabel(9,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,2*fHarmonic));
2901  f3pCorrelations->GetXaxis()->SetBinLabel(10,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,1*fHarmonic));
2902  fMixedHarmonicsProfiles->Add(f3pCorrelations);
2903  //  b3) 4-p correlations (6+15+2+10+8):
2904  TString s4pCorrelationsName = "f4pCorrelations";
2905  s4pCorrelationsName += fAnalysisLabel->Data();
2906  f4pCorrelations = new TProfile(s4pCorrelationsName.Data(),Form("4-particle correlations (n = %d)",fHarmonic),45,0,45,"s");
2907  f4pCorrelations->SetTickLength(-0.01,"Y");
2908  f4pCorrelations->SetMarkerStyle(25);
2909  f4pCorrelations->SetLabelSize(0.03);
2910  f4pCorrelations->SetLabelOffset(0.02,"Y");
2911  f4pCorrelations->SetStats(kFALSE);
2912  f4pCorrelations->Sumw2();
2913  // "same harmonic" (6):
2914  f4pCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2915  f4pCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2916  f4pCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
2917  f4pCorrelations->GetXaxis()->SetBinLabel(4,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
2918  f4pCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic));
2919  f4pCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,6*fHarmonic));
2920  f4pCorrelations->GetXaxis()->SetBinLabel(7,""); // empty
2921  // "standard candles" (15):
2922  f4pCorrelations->GetXaxis()->SetBinLabel(8,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic));
2923  f4pCorrelations->GetXaxis()->SetBinLabel(9,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic));
2924  f4pCorrelations->GetXaxis()->SetBinLabel(10,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic));
2925  f4pCorrelations->GetXaxis()->SetBinLabel(11,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic));
2926  f4pCorrelations->GetXaxis()->SetBinLabel(12,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic));
2927  f4pCorrelations->GetXaxis()->SetBinLabel(13,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic));
2928  f4pCorrelations->GetXaxis()->SetBinLabel(14,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic));
2929  f4pCorrelations->GetXaxis()->SetBinLabel(15,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic));
2930  f4pCorrelations->GetXaxis()->SetBinLabel(16,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic));
2931  f4pCorrelations->GetXaxis()->SetBinLabel(17,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic));
2932  f4pCorrelations->GetXaxis()->SetBinLabel(18,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,6*fHarmonic,1*fHarmonic));
2933  f4pCorrelations->GetXaxis()->SetBinLabel(19,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,2*fHarmonic));
2934  f4pCorrelations->GetXaxis()->SetBinLabel(20,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,3*fHarmonic));
2935  f4pCorrelations->GetXaxis()->SetBinLabel(21,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,4*fHarmonic));
2936  f4pCorrelations->GetXaxis()->SetBinLabel(22,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,5*fHarmonic));
2937  f4pCorrelations->GetXaxis()->SetBinLabel(23,""); // empty
2938  // 4-p correlations sensitive to two distinct harmonics (2):
2939  f4pCorrelations->GetXaxis()->SetBinLabel(24,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2940  f4pCorrelations->GetXaxis()->SetBinLabel(25,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2941  f4pCorrelations->GetXaxis()->SetBinLabel(26,""); // empty
2942  // 4-p correlations sensitive to three distinct harmonics (10):
2943  f4pCorrelations->GetXaxis()->SetBinLabel(27,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic));
2944  f4pCorrelations->GetXaxis()->SetBinLabel(28,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
2945  f4pCorrelations->GetXaxis()->SetBinLabel(29,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic));
2946  f4pCorrelations->GetXaxis()->SetBinLabel(30,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
2947  f4pCorrelations->GetXaxis()->SetBinLabel(31,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
2948  f4pCorrelations->GetXaxis()->SetBinLabel(32,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
2949  f4pCorrelations->GetXaxis()->SetBinLabel(33,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic));
2950  f4pCorrelations->GetXaxis()->SetBinLabel(34,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
2951  f4pCorrelations->GetXaxis()->SetBinLabel(35,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,4*fHarmonic));
2952  f4pCorrelations->GetXaxis()->SetBinLabel(36,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,5*fHarmonic));
2953  f4pCorrelations->GetXaxis()->SetBinLabel(37,""); // empty
2954  // 4-p correlations sensitive to four distinct harmonics (8):
2955  f4pCorrelations->GetXaxis()->SetBinLabel(38,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic));
2956  f4pCorrelations->GetXaxis()->SetBinLabel(39,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic));
2957  f4pCorrelations->GetXaxis()->SetBinLabel(40,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic));
2958  f4pCorrelations->GetXaxis()->SetBinLabel(41,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
2959  f4pCorrelations->GetXaxis()->SetBinLabel(42,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,2*fHarmonic));
2960  f4pCorrelations->GetXaxis()->SetBinLabel(43,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
2961  f4pCorrelations->GetXaxis()->SetBinLabel(44,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,3*fHarmonic));
2962  f4pCorrelations->GetXaxis()->SetBinLabel(45,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,4*fHarmonic));
2963  fMixedHarmonicsProfiles->Add(f4pCorrelations);
2964  //  b3) 5-p correlations (30+9+30+11+3):
2965  TString s5pCorrelationsName = "f5pCorrelations";
2966  s5pCorrelationsName += fAnalysisLabel->Data();
2967  f5pCorrelations = new TProfile(s5pCorrelationsName.Data(),Form("5-particle correlations (n = %d)",fHarmonic),87,0,87,"s");
2968  f5pCorrelations->SetTickLength(-0.01,"Y");
2969  f5pCorrelations->SetMarkerStyle(25);
2970  f5pCorrelations->SetLabelSize(0.02);
2971  f5pCorrelations->SetLabelOffset(0.02,"Y");
2972  f5pCorrelations->SetStats(kFALSE);
2973  f5pCorrelations->Sumw2();
2974  // "standard candles" (30):
2975  f5pCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
2976  f5pCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
2977  f5pCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
2978  f5pCorrelations->GetXaxis()->SetBinLabel(4,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
2979  f5pCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
2980  f5pCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
2981  f5pCorrelations->GetXaxis()->SetBinLabel(7,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
2982  f5pCorrelations->GetXaxis()->SetBinLabel(8,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
2983  f5pCorrelations->GetXaxis()->SetBinLabel(9,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
2984  f5pCorrelations->GetXaxis()->SetBinLabel(10,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
2985  f5pCorrelations->GetXaxis()->SetBinLabel(11,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
2986  f5pCorrelations->GetXaxis()->SetBinLabel(12,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
2987  f5pCorrelations->GetXaxis()->SetBinLabel(13,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
2988  f5pCorrelations->GetXaxis()->SetBinLabel(14,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
2989  f5pCorrelations->GetXaxis()->SetBinLabel(15,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
2990  f5pCorrelations->GetXaxis()->SetBinLabel(16,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
2991  f5pCorrelations->GetXaxis()->SetBinLabel(17,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
2992  f5pCorrelations->GetXaxis()->SetBinLabel(18,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
2993  f5pCorrelations->GetXaxis()->SetBinLabel(19,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
2994  f5pCorrelations->GetXaxis()->SetBinLabel(20,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
2995  f5pCorrelations->GetXaxis()->SetBinLabel(21,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
2996  f5pCorrelations->GetXaxis()->SetBinLabel(22,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
2997  f5pCorrelations->GetXaxis()->SetBinLabel(23,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,3*fHarmonic));
2998  f5pCorrelations->GetXaxis()->SetBinLabel(24,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,1*fHarmonic,1*fHarmonic));
2999  f5pCorrelations->GetXaxis()->SetBinLabel(25,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,2*fHarmonic,1*fHarmonic));
3000  f5pCorrelations->GetXaxis()->SetBinLabel(26,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,2*fHarmonic,2*fHarmonic));
3001  f5pCorrelations->GetXaxis()->SetBinLabel(27,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,3*fHarmonic,1*fHarmonic));
3002  f5pCorrelations->GetXaxis()->SetBinLabel(28,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,2*fHarmonic));
3003  f5pCorrelations->GetXaxis()->SetBinLabel(29,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,3*fHarmonic,2*fHarmonic));
3004  f5pCorrelations->GetXaxis()->SetBinLabel(30,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,4*fHarmonic,1*fHarmonic));
3005  f5pCorrelations->GetXaxis()->SetBinLabel(31,""); // empty
3006  // 5-p correlations sensitive to two distinct harmonics (9):
3007  f5pCorrelations->GetXaxis()->SetBinLabel(32,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3008  f5pCorrelations->GetXaxis()->SetBinLabel(33,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3009  f5pCorrelations->GetXaxis()->SetBinLabel(34,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3010  f5pCorrelations->GetXaxis()->SetBinLabel(35,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3011  f5pCorrelations->GetXaxis()->SetBinLabel(36,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3012  f5pCorrelations->GetXaxis()->SetBinLabel(37,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3013  f5pCorrelations->GetXaxis()->SetBinLabel(38,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3014  f5pCorrelations->GetXaxis()->SetBinLabel(39,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
3015  f5pCorrelations->GetXaxis()->SetBinLabel(40,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,3*fHarmonic,3*fHarmonic));
3016  f5pCorrelations->GetXaxis()->SetBinLabel(41,""); // empty
3017  // 5-p correlations sensitive to three distinct harmonics (30):
3018  f5pCorrelations->GetXaxis()->SetBinLabel(42,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3019  f5pCorrelations->GetXaxis()->SetBinLabel(43,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3020  f5pCorrelations->GetXaxis()->SetBinLabel(44,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3021  f5pCorrelations->GetXaxis()->SetBinLabel(45,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3022  f5pCorrelations->GetXaxis()->SetBinLabel(46,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
3023  f5pCorrelations->GetXaxis()->SetBinLabel(47,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3024  f5pCorrelations->GetXaxis()->SetBinLabel(48,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3025  f5pCorrelations->GetXaxis()->SetBinLabel(49,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3026  f5pCorrelations->GetXaxis()->SetBinLabel(50,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3027  f5pCorrelations->GetXaxis()->SetBinLabel(51,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3028  f5pCorrelations->GetXaxis()->SetBinLabel(52,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3029  f5pCorrelations->GetXaxis()->SetBinLabel(53,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3030  f5pCorrelations->GetXaxis()->SetBinLabel(54,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3031  f5pCorrelations->GetXaxis()->SetBinLabel(55,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3032  f5pCorrelations->GetXaxis()->SetBinLabel(56,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
3033  f5pCorrelations->GetXaxis()->SetBinLabel(57,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
3034  f5pCorrelations->GetXaxis()->SetBinLabel(58,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
3035  f5pCorrelations->GetXaxis()->SetBinLabel(59,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
3036  f5pCorrelations->GetXaxis()->SetBinLabel(60,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
3037  f5pCorrelations->GetXaxis()->SetBinLabel(61,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3038  f5pCorrelations->GetXaxis()->SetBinLabel(62,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3039  f5pCorrelations->GetXaxis()->SetBinLabel(63,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
3040  f5pCorrelations->GetXaxis()->SetBinLabel(64,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
3041  f5pCorrelations->GetXaxis()->SetBinLabel(65,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3042  f5pCorrelations->GetXaxis()->SetBinLabel(66,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
3043  f5pCorrelations->GetXaxis()->SetBinLabel(67,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,5*fHarmonic,5*fHarmonic));
3044  f5pCorrelations->GetXaxis()->SetBinLabel(68,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic,1*fHarmonic));
3045  f5pCorrelations->GetXaxis()->SetBinLabel(69,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,5*fHarmonic,2*fHarmonic));
3046  f5pCorrelations->GetXaxis()->SetBinLabel(70,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,4*fHarmonic,2*fHarmonic));
3047  f5pCorrelations->GetXaxis()->SetBinLabel(71,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,5*fHarmonic,1*fHarmonic));
3048  f5pCorrelations->GetXaxis()->SetBinLabel(72,""); // empty
3049  // 5-p correlations sensitive to four distinct harmonics (11):
3050  f5pCorrelations->GetXaxis()->SetBinLabel(73,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3051  f5pCorrelations->GetXaxis()->SetBinLabel(74,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
3052  f5pCorrelations->GetXaxis()->SetBinLabel(75,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3053  f5pCorrelations->GetXaxis()->SetBinLabel(76,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
3054  f5pCorrelations->GetXaxis()->SetBinLabel(77,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3055  f5pCorrelations->GetXaxis()->SetBinLabel(78,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
3056  f5pCorrelations->GetXaxis()->SetBinLabel(79,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,5*fHarmonic,3*fHarmonic));
3057  f5pCorrelations->GetXaxis()->SetBinLabel(80,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
3058  f5pCorrelations->GetXaxis()->SetBinLabel(81,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic));
3059  f5pCorrelations->GetXaxis()->SetBinLabel(82,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,5*fHarmonic,5*fHarmonic));
3060  f5pCorrelations->GetXaxis()->SetBinLabel(83,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic));
3061  f5pCorrelations->GetXaxis()->SetBinLabel(84,""); // empty
3062  // 5-p correlations sensitive to five distinct harmonics (3):
3063  f5pCorrelations->GetXaxis()->SetBinLabel(85,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3064  f5pCorrelations->GetXaxis()->SetBinLabel(86,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,1*fHarmonic,5*fHarmonic,4*fHarmonic));
3065  f5pCorrelations->GetXaxis()->SetBinLabel(87,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
3066  fMixedHarmonicsProfiles->Add(f5pCorrelations);
3067  //  b4) 6-p correlations (??+??+??+??+??):
3068  TString s6pCorrelationsName = "f6pCorrelations";
3069  s6pCorrelationsName += fAnalysisLabel->Data();
3070  f6pCorrelations = new TProfile(s6pCorrelationsName.Data(),Form("6-particle correlations (n = %d)",fHarmonic),1,0.,1.);
3071  f6pCorrelations->SetTickLength(-0.01,"Y");
3072  f6pCorrelations->SetMarkerStyle(25);
3073  f6pCorrelations->SetLabelSize(0.02);
3074  f6pCorrelations->SetLabelOffset(0.02,"Y");
3075  f6pCorrelations->SetStats(kFALSE);
3076  f6pCorrelations->Sumw2(); 
3077  //fMixedHarmonicsProfiles->Add(f6pCorrelations); // TBI
3078  //  b5) 7-p correlations (??+??+??+??+??):
3079  TString s7pCorrelationsName = "f7pCorrelations";
3080  s7pCorrelationsName += fAnalysisLabel->Data();
3081  f7pCorrelations = new TProfile(s7pCorrelationsName.Data(),Form("7-particle correlations (n = %d)",fHarmonic),1,0.,1.);
3082  f7pCorrelations->SetTickLength(-0.01,"Y");
3083  f7pCorrelations->SetMarkerStyle(25);
3084  f7pCorrelations->SetLabelSize(0.02);
3085  f7pCorrelations->SetLabelOffset(0.02,"Y");
3086  f7pCorrelations->SetStats(kFALSE);
3087  f7pCorrelations->Sumw2(); 
3088  //fMixedHarmonicsProfiles->Add(f7pCorrelations); // TBI
3089  //  b6) 8-p correlations (??+??+??+??+??):
3090  TString s8pCorrelationsName = "f8pCorrelations";
3091  s8pCorrelationsName += fAnalysisLabel->Data();
3092  f8pCorrelations = new TProfile(s8pCorrelationsName.Data(),Form("8-particle correlations (n = %d)",fHarmonic),1,0.,1.);
3093  f8pCorrelations->SetTickLength(-0.01,"Y");
3094  f8pCorrelations->SetMarkerStyle(25);
3095  f8pCorrelations->SetLabelSize(0.02);
3096  f8pCorrelations->SetLabelOffset(0.02,"Y");
3097  f8pCorrelations->SetStats(kFALSE);
3098  f8pCorrelations->Sumw2(); 
3099  //fMixedHarmonicsProfiles->Add(f8pCorrelations); // TBI
3100
3101  // c) Book all objects in TList fMixedHarmonicsResults:
3102  // QC{2}:
3103  f2pCumulants = f2pCorrelations->ProjectionX("f2pCumulants");
3104  f2pCumulants->SetTitle(Form("2-particle cumulants (n = %d)",fHarmonic));
3105  f2pCumulants->SetStats(kFALSE);
3106  f2pCumulants->SetMarkerStyle(kFullSquare);
3107  f2pCumulants->SetMarkerColor(kBlack);
3108  f2pCumulants->SetLineColor(kBlack);
3109  fMixedHarmonicsResults->Add(f2pCumulants);
3110  // QC{3}:
3111  f3pCumulants = f3pCorrelations->ProjectionX("f3pCumulants");
3112  f3pCumulants->SetTitle(Form("3-particle cumulants (n = %d)",fHarmonic));
3113  f3pCumulants->SetStats(kFALSE);
3114  f3pCumulants->SetMarkerStyle(kFullSquare);
3115  f3pCumulants->SetMarkerColor(kGreen+2);
3116  f3pCumulants->SetLineColor(kGreen+2);
3117  fMixedHarmonicsResults->Add(f3pCumulants);
3118  // QC{4}:
3119  f4pCumulants = f4pCorrelations->ProjectionX("f4pCumulants");
3120  f4pCumulants->SetTitle(Form("4-particle cumulants (n = %d)",fHarmonic));
3121  f4pCumulants->SetStats(kFALSE);
3122  f4pCumulants->SetMarkerStyle(kFullSquare);
3123  f4pCumulants->SetMarkerColor(kRed);
3124  f4pCumulants->SetLineColor(kRed);
3125  fMixedHarmonicsResults->Add(f4pCumulants);
3126  // QC{5}:
3127  f5pCumulants = f5pCorrelations->ProjectionX("f5pCumulants");
3128  f5pCumulants->SetTitle(Form("5-particle cumulants (n = %d)",fHarmonic));
3129  f5pCumulants->SetStats(kFALSE);
3130  f5pCumulants->SetMarkerStyle(kFullSquare);
3131  f5pCumulants->SetMarkerColor(kBlue);
3132  f5pCumulants->SetLineColor(kBlue);
3133  fMixedHarmonicsResults->Add(f5pCumulants);
3134
3135  // d) Book all objects in TList fMixedHarmonicsErrorPropagation: 
3136  // Sum of linear and quadratic event weights for mixed harmonics => [0=linear 1,1=quadratic]: 
3137  TString mixedHarmonicEventWeightsName = "fMixedHarmonicEventWeights";
3138  mixedHarmonicEventWeightsName += fAnalysisLabel->Data();
3139  TString powerFlag[2] = {"linear","quadratic"}; 
3140  for(Int_t power=0;power<2;power++)
3141  {
3142   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.);
3143   fMixedHarmonicEventWeights[power]->SetLabelSize(0.04);
3144   fMixedHarmonicEventWeights[power]->SetMarkerStyle(25);
3145   fMixedHarmonicEventWeights[power]->SetStats(kFALSE);
3146   if(power == 0)
3147   {
3148    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum w_{#LT1#GT}");
3149    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum w_{#LT2#GT}");
3150    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum w_{#LT3#GT}");
3151    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum w_{#LT4#GT}");
3152    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(5,"#sum w_{#LT5#GT}");
3153    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(6,"#sum w_{#LT6#GT}");
3154    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(7,"#sum w_{#LT7#GT}");
3155    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(8,"#sum w_{#LT8#GT}");
3156   } else if (power == 1) 
3157     {
3158      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum w_{#LT1#GT}^{2}");
3159      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum w_{#LT2#GT}^{2}");
3160      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum w_{#LT3#GT}^{2}");
3161      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum w_{#LT4#GT}^{2}");
3162      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(5,"#sum w_{#LT5#GT}^{2}");
3163      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(6,"#sum w_{#LT6#GT}^{2}");
3164      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(7,"#sum w_{#LT7#GT}^{2}");
3165      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(8,"#sum w_{#LT8#GT}^{2}");
3166     }
3167   fMixedHarmonicsErrorPropagation->Add(fMixedHarmonicEventWeights[power]);
3168  } // end of for(Int_t power=0;power<2;power++)
3169  
3170  // Sums of products of event weights for mixed harmonics:
3171  TString mixedHarmonicProductOfEventWeightsName = "fMixedHarmonicProductOfEventWeights";
3172  mixedHarmonicProductOfEventWeightsName += fAnalysisLabel->Data();
3173  fMixedHarmonicProductOfEventWeights = new TH2D(mixedHarmonicProductOfEventWeightsName.Data(),"Sums of products of event weights",8,0.,8.,8,0.,8.);
3174  fMixedHarmonicProductOfEventWeights->SetStats(kFALSE);
3175  fMixedHarmonicProductOfEventWeights->GetXaxis()->SetLabelSize(0.05);
3176  fMixedHarmonicProductOfEventWeights->GetYaxis()->SetLabelSize(0.05);
3177  for(Int_t b=1;b<=8;b++)
3178  {
3179   fMixedHarmonicProductOfEventWeights->GetXaxis()->SetBinLabel(b,Form("w_{#LT%i#GT}",b)); 
3180   fMixedHarmonicProductOfEventWeights->GetYaxis()->SetBinLabel(b,Form("w_{#LT%i#GT}",b)); 
3181  } 
3182  fMixedHarmonicsErrorPropagation->Add(fMixedHarmonicProductOfEventWeights);
3183
3184  // Averages of products of mixed harmonics correlations:
3185  TString mixedHarmonicProductOfCorrelationsName = "fMixedHarmonicProductOfCorrelations";
3186  mixedHarmonicProductOfCorrelationsName += fAnalysisLabel->Data();
3187  fMixedHarmonicProductOfCorrelations = new TProfile2D(mixedHarmonicProductOfCorrelationsName.Data(),"Averages of products of mixed correlators",139,0.,139.,139,0.,139.);
3188  fMixedHarmonicProductOfCorrelations->Sumw2();
3189  fMixedHarmonicProductOfCorrelations->SetStats(kFALSE);
3190  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetLabelSize(0.015);
3191  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetLabelSize(0.015);
3192  // x-axis:
3193  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT2#GT#GT_{%dn|%dn}",1*fHarmonic,1*fHarmonic));
3194  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT2#GT#GT_{%dn|%dn}",2*fHarmonic,2*fHarmonic));
3195  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT2#GT#GT_{%dn|%dn}",3*fHarmonic,3*fHarmonic));
3196  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(4,Form("#LT#LT2#GT#GT_{%dn|%dn}",4*fHarmonic,4*fHarmonic));
3197  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT2#GT#GT_{%dn|%dn}",5*fHarmonic,5*fHarmonic));
3198  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT2#GT#GT_{%dn|%dn}",6*fHarmonic,6*fHarmonic));
3199  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(7,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic));
3200  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(8,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic));
3201  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(9,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic));
3202  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(10,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,1*fHarmonic));
3203  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(11,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,1*fHarmonic));
3204  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(12,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,2*fHarmonic));
3205  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(13,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,1*fHarmonic));
3206  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(14,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,2*fHarmonic));
3207  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(15,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,1*fHarmonic));
3208  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(16,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3209  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(17,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3210  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(18,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3211  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(19,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
3212  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(20,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic));
3213  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(21,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,6*fHarmonic));
3214  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(22,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic));
3215  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(23,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic));
3216  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(24,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic));
3217  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(25,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic));
3218  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(26,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic));
3219  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(27,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic));
3220  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(28,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic));
3221  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(29,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic));
3222  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(30,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic));
3223  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(31,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic));
3224  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(32,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,6*fHarmonic,1*fHarmonic));
3225  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(33,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,2*fHarmonic));
3226  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(34,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,3*fHarmonic));
3227  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(35,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,4*fHarmonic));
3228  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(36,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,5*fHarmonic));
3229  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(37,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3230  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(38,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3231  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(39,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic));
3232  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(40,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3233  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(41,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic));
3234  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(42,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3235  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(43,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3236  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(44,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
3237  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(45,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic));
3238  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(46,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3239  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(47,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,4*fHarmonic));
3240  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(48,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,5*fHarmonic));
3241  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(49,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic));
3242  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(50,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic));
3243  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(51,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic));
3244  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(52,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
3245  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(53,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,2*fHarmonic));
3246  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(54,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3247  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(55,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,3*fHarmonic));
3248  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(56,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,4*fHarmonic));
3249  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(57,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3250  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(58,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3251  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(59,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3252  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(60,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3253  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(61,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3254  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(62,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3255  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(63,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3256  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(64,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
3257  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(65,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3258  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(66,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3259  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(67,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
3260  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(68,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
3261  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(69,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
3262  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(70,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
3263  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(71,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3264  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(72,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3265  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(73,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3266  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(74,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
3267  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(75,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
3268  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(76,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
3269  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(77,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
3270  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(78,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
3271  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(79,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,3*fHarmonic));
3272  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(80,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,1*fHarmonic,1*fHarmonic));
3273  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(81,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,2*fHarmonic,1*fHarmonic));
3274  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(82,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,2*fHarmonic,2*fHarmonic));
3275  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(83,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,3*fHarmonic,1*fHarmonic));
3276  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(84,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,2*fHarmonic));
3277  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(85,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,3*fHarmonic,2*fHarmonic));
3278  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(86,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,4*fHarmonic,1*fHarmonic));
3279  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(87,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3280  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(88,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3281  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(89,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3282  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(90,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3283  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(91,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3284  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(92,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3285  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(93,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3286  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(94,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
3287  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(95,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,3*fHarmonic,3*fHarmonic));
3288  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(96,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3289  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(97,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3290  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(98,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3291  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(99,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3292  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(100,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
3293  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(101,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3294  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(102,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3295  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(103,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3296  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(104,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3297  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(105,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3298  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(106,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3299  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(107,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3300  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(108,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3301  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(109,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3302  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(110,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
3303  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(111,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
3304  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(112,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
3305  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(113,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
3306  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(114,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
3307  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(115,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3308  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(116,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3309  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(117,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
3310  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(118,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
3311  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(119,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3312  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(120,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
3313  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(121,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,5*fHarmonic,5*fHarmonic));
3314  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(122,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic,1*fHarmonic));
3315  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(123,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,5*fHarmonic,2*fHarmonic));
3316  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(124,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,4*fHarmonic,2*fHarmonic));
3317  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(125,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,5*fHarmonic,1*fHarmonic));
3318  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(126,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3319  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(127,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
3320  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(128,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3321  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(129,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
3322  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(130,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3323  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(131,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
3324  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(132,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,5*fHarmonic,3*fHarmonic));
3325  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(133,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
3326  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(134,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic));
3327  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(135,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,5*fHarmonic,5*fHarmonic));
3328  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(136,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic));
3329  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(137,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3330  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(138,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,1*fHarmonic,5*fHarmonic,4*fHarmonic));
3331  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(139,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
3332  // y-axis:
3333  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(1,Form("#LT#LT2#GT#GT_{%dn|%dn}",1*fHarmonic,1*fHarmonic));
3334  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(2,Form("#LT#LT2#GT#GT_{%dn|%dn}",2*fHarmonic,2*fHarmonic));
3335  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(3,Form("#LT#LT2#GT#GT_{%dn|%dn}",3*fHarmonic,3*fHarmonic));
3336  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(4,Form("#LT#LT2#GT#GT_{%dn|%dn}",4*fHarmonic,4*fHarmonic));
3337  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(5,Form("#LT#LT2#GT#GT_{%dn|%dn}",5*fHarmonic,5*fHarmonic));
3338  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(6,Form("#LT#LT2#GT#GT_{%dn|%dn}",6*fHarmonic,6*fHarmonic));
3339  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(7,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic));
3340  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(8,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic));
3341  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(9,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic));
3342  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(10,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,1*fHarmonic));
3343  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(11,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,1*fHarmonic));
3344  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(12,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,2*fHarmonic));
3345  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(13,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,1*fHarmonic));
3346  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(14,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,2*fHarmonic));
3347  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(15,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,1*fHarmonic));
3348  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(16,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3349  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(17,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3350  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(18,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3351  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(19,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
3352  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(20,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic));
3353  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(21,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,6*fHarmonic));
3354  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(22,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic));
3355  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(23,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic));
3356  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(24,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic));
3357  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(25,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic));
3358  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(26,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic));
3359  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(27,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic));
3360  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(28,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic));
3361  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(29,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic));
3362  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(30,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic));
3363  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(31,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic));
3364  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(32,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,6*fHarmonic,1*fHarmonic));
3365  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(33,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,2*fHarmonic));
3366  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(34,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,3*fHarmonic));
3367  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(35,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,4*fHarmonic));
3368  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(36,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,5*fHarmonic));
3369  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(37,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3370  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(38,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3371  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(39,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic));
3372  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(40,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3373  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(41,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic));
3374  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(42,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3375  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(43,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3376  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(44,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
3377  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(45,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic));
3378  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(46,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3379  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(47,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,4*fHarmonic));
3380  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(48,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,5*fHarmonic));
3381  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(49,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic));
3382  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(50,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic));
3383  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(51,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic));
3384  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(52,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
3385  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(53,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,2*fHarmonic));
3386  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(54,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3387  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(55,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,3*fHarmonic));
3388  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(56,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,4*fHarmonic));
3389  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(57,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3390  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(58,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3391  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(59,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3392  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(60,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3393  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(61,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3394  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(62,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3395  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(63,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3396  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(64,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
3397  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(65,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3398  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(66,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3399  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(67,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
3400  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(68,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
3401  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(69,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
3402  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(70,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
3403  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(71,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3404  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(72,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3405  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(73,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3406  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(74,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
3407  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(75,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
3408  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(76,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
3409  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(77,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
3410  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(78,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
3411  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(79,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,3*fHarmonic));
3412  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(80,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,1*fHarmonic,1*fHarmonic));
3413  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(81,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,2*fHarmonic,1*fHarmonic));
3414  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(82,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,2*fHarmonic,2*fHarmonic));
3415  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(83,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,3*fHarmonic,1*fHarmonic));
3416  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(84,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,2*fHarmonic));
3417  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(85,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,3*fHarmonic,2*fHarmonic));
3418  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(86,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,4*fHarmonic,1*fHarmonic));
3419  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(87,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3420  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(88,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3421  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(89,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3422  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(90,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3423  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(91,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3424  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(92,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3425  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(93,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3426  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(94,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
3427  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(95,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,3*fHarmonic,3*fHarmonic));
3428  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(96,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3429  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(97,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3430  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(98,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3431  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(99,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3432  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(100,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
3433  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(101,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3434  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(102,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3435  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(103,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3436  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(104,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3437  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(105,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3438  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(106,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3439  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(107,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3440  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(108,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3441  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(109,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3442  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(110,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
3443  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(111,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
3444  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(112,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
3445  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(113,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
3446  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(114,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
3447  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(115,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3448  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(116,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3449  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(117,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
3450  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(118,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
3451  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(119,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3452  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(120,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
3453  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(121,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,5*fHarmonic,5*fHarmonic));
3454  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(122,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic,1*fHarmonic));
3455  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(123,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,5*fHarmonic,2*fHarmonic));
3456  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(124,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,4*fHarmonic,2*fHarmonic));
3457  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(125,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,5*fHarmonic,1*fHarmonic));
3458  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(126,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3459  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(127,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
3460  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(128,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3461  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(129,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
3462  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(130,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3463  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(131,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
3464  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(132,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,5*fHarmonic,3*fHarmonic));
3465  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(133,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
3466  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(134,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic));
3467  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(135,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,5*fHarmonic,5*fHarmonic));
3468  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(136,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic));
3469  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(137,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3470  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(138,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,1*fHarmonic,5*fHarmonic,4*fHarmonic));
3471  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(139,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
3472  fMixedHarmonicsErrorPropagation->Add(fMixedHarmonicProductOfCorrelations);
3473
3474 } // end of void AliFlowAnalysisWithQCumulants::BookEverythingForMixedHarmonics()
3475
3476 //=======================================================================================================================
3477
3478 void AliFlowAnalysisWithQCumulants::InitializeArraysForNestedLoops()
3479 {
3480  // Initialize arrays of all objects relevant for calculations with nested loops.
3481  
3482  // integrated flow:
3483  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
3484  {
3485   fIntFlowDirectCorrectionTermsForNUA[sc] = NULL;
3486  } 
3487
3488  // differential flow:  
3489  // correlations:
3490  for(Int_t t=0;t<2;t++) // type: RP or POI
3491  { 
3492   for(Int_t pe=0;pe<2;pe++) // pt or eta
3493   {
3494    for(Int_t ci=0;ci<4;ci++) // correlation index
3495    {
3496     fDiffFlowDirectCorrelations[t][pe][ci] = NULL;
3497    } // end of for(Int_t ci=0;ci<4;ci++) // correlation index  
3498   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
3499  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
3500  // correction terms for non-uniform acceptance:
3501  for(Int_t t=0;t<2;t++) // type: RP or POI
3502  { 
3503   for(Int_t pe=0;pe<2;pe++) // pt or eta
3504   {
3505    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
3506    {
3507     for(Int_t cti=0;cti<9;cti++) // correction term index
3508     {
3509      fDiffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti] = NULL;
3510     }   
3511    }
3512   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
3513  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
3514
3515  // other differential correlators: 
3516  for(Int_t t=0;t<2;t++) // type: RP or POI
3517  { 
3518   for(Int_t pe=0;pe<2;pe++) // pt or eta
3519   {
3520    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
3521    {
3522     for(Int_t ci=0;ci<1;ci++) // correlator index
3523     {
3524      fOtherDirectDiffCorrelators[t][pe][sc][ci] = NULL;
3525     }   
3526    }
3527   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
3528  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
3529
3530 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForNestedLoops()
3531
3532 //=======================================================================================================================
3533
3534 void AliFlowAnalysisWithQCumulants::InitializeArraysForMixedHarmonics()
3535 {
3536  // Initialize arrays of all objects relevant for mixed harmonics.
3537
3538  for(Int_t power=0;power<2;power++) // linear or quadratic 
3539  {
3540   fMixedHarmonicEventWeights[power] = NULL;    
3541  }
3542
3543 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForMixedHarmonics()
3544
3545 //=======================================================================================================================
3546
3547 void AliFlowAnalysisWithQCumulants::InitializeArraysForControlHistograms()
3548 {
3549  // Initialize arrays of all objects relevant for control histograms.
3550
3551  for(Int_t ci=0;ci<4;ci++) // correlation index 
3552  {
3553   fCorrelation2468VsMult[ci] = NULL;    
3554  }
3555  for(Int_t cpi=0;cpi<1;cpi++) // correlation product index TBI: hardwired 1
3556  {
3557   fCorrelationProduct2468VsMult[cpi] = NULL;    
3558  }
3559  for(Int_t qwti=0;qwti<4;qwti++) // q-vector terms index TBI: hardwired 4
3560  {
3561   fQvectorTermsVsMult[qwti] = NULL;    
3562  }
3563
3564 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForControlHistograms()
3565
3566
3567 //=======================================================================================================================
3568
3569 void AliFlowAnalysisWithQCumulants::InitializeArraysForBootstrap()
3570 {
3571  // Initialize arrays of all objects relevant for control histograms.
3572
3573  for(Int_t ci=0;ci<4;ci++) // correlation index 
3574  {
3575   fBootstrapCorrelationsVsM[ci] = NULL;    
3576   fBootstrapCumulantsVsM[ci] = NULL;
3577  }
3578
3579 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForBootstrap()
3580
3581 //=======================================================================================================================
3582
3583 void AliFlowAnalysisWithQCumulants::BookEverythingForNestedLoops()
3584 {
3585  // Book all objects relevant for calculations with nested loops.
3586  
3587  TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data members?)
3588  TString typeFlag[2] = {"RP","POI"}; // to be improved (should I promote this to data members?)
3589  TString ptEtaFlag[2] = {"p_{T}","#eta"}; // to be improved (should I promote this to data members?)
3590  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"}; // to be improved (should I promote this to data members?)
3591  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
3592  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
3593
3594  TString evaluateNestedLoopsName = "fEvaluateNestedLoops";
3595  evaluateNestedLoopsName += fAnalysisLabel->Data();
3596  fEvaluateNestedLoops = new TProfile(evaluateNestedLoopsName.Data(),"Flags for nested loops",4,0,4);
3597  fEvaluateNestedLoops->SetLabelSize(0.03);
3598  fEvaluateNestedLoops->SetStats(kFALSE);
3599  (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(1,"fEvaluateIntFlowNestedLoops");
3600  (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(2,"fEvaluateDiffFlowNestedLoops");
3601  (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(3,"fCrossCheckInPtBinNo");
3602  (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(4,"fCrossCheckInEtaBinNo");
3603  fEvaluateNestedLoops->Fill(0.5,(Int_t)fEvaluateIntFlowNestedLoops);
3604  fEvaluateNestedLoops->Fill(1.5,(Int_t)fEvaluateDiffFlowNestedLoops);
3605  fEvaluateNestedLoops->Fill(2.5,fCrossCheckInPtBinNo);
3606  fEvaluateNestedLoops->Fill(3.5,fCrossCheckInEtaBinNo);
3607  fNestedLoopsList->Add(fEvaluateNestedLoops);
3608  // nested loops for integrated flow:
3609  if(fEvaluateIntFlowNestedLoops)
3610  {
3611   // correlations:
3612   TString intFlowDirectCorrelationsName = "fIntFlowDirectCorrelations";
3613   intFlowDirectCorrelationsName += fAnalysisLabel->Data();
3614   fIntFlowDirectCorrelations = new TProfile(intFlowDirectCorrelationsName.Data(),"Multiparticle correlations calculated with nested loops (for int. flow)",64,0,64,"s");
3615   fNestedLoopsList->Add(fIntFlowDirectCorrelations);
3616   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
3617   {
3618    TString intFlowExtraDirectCorrelationsName = "fIntFlowExtraDirectCorrelations";
3619    intFlowExtraDirectCorrelationsName += fAnalysisLabel->Data();
3620    fIntFlowExtraDirectCorrelations = new TProfile(intFlowExtraDirectCorrelationsName.Data(),"Extra multiparticle correlations calculated with nested loops (for int. flow)",100,0,100,"s");
3621    fNestedLoopsList->Add(fIntFlowExtraDirectCorrelations);  
3622   } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
3623   // correction terms for non-uniform acceptance:
3624   for(Int_t sc=0;sc<2;sc++) // sin or cos terms
3625   {
3626    TString intFlowDirectCorrectionTermsForNUAName = "fIntFlowDirectCorrectionTermsForNUA";
3627    intFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();
3628    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");
3629    fNestedLoopsList->Add(fIntFlowDirectCorrectionTermsForNUA[sc]);
3630   } // end of for(Int_t sc=0;sc<2;sc++) 
3631   // Mixed harmonics:
3632   if(fCalculateMixedHarmonics)
3633   {
3634    TString mixedHarmonicsNestedLoopsName = "fMixedHarmonicsNestedLoops";
3635    mixedHarmonicsNestedLoopsName += fAnalysisLabel->Data();
3636    fMixedHarmonicsNestedLoops = new TProfile(mixedHarmonicsNestedLoopsName.Data(),"Mixed harmonics calculated with nested loops",200,0,200); // TBI hardwired 200
3637    fNestedLoopsList->Add(fMixedHarmonicsNestedLoops);
3638   } // end of if(fCalculateMixedHarmonics)
3639  } // end of if(fEvaluateIntFlowNestedLoops)
3640  
3641  // nested loops for differential flow: 
3642  if(fEvaluateDiffFlowNestedLoops)
3643  {
3644   // reduced correlations:
3645   TString diffFlowDirectCorrelationsName = "fDiffFlowDirectCorrelations";
3646   diffFlowDirectCorrelationsName += fAnalysisLabel->Data();
3647   for(Int_t t=0;t<2;t++) // type: RP or POI
3648   { 
3649    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
3650    {
3651     for(Int_t rci=0;rci<4;rci++) // reduced correlation index
3652     {
3653      // reduced correlations:
3654      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");
3655      fDiffFlowDirectCorrelations[t][pe][rci]->SetXTitle(ptEtaFlag[pe].Data());
3656      fNestedLoopsList->Add(fDiffFlowDirectCorrelations[t][pe][rci]); // to be improved (add dedicated list to hold reduced correlations)
3657     } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
3658    } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
3659   } // end of for(Int_t t=0;t<2;t++) // type: RP or POI 
3660   
3661   // correction terms for non-uniform acceptance:
3662   TString diffFlowDirectCorrectionTermsForNUAName = "fDiffFlowDirectCorrectionTermsForNUA";
3663   diffFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();
3664   for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
3665   { 
3666    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
3667    {
3668     for(Int_t sc=0;sc<2;sc++) // sin or cos
3669     {
3670      for(Int_t cti=0;cti<9;cti++) // correction term index
3671      {
3672       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"); 
3673       fNestedLoopsList->Add(fDiffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti]);
3674      }
3675     }
3676    }
3677   }
3678   // other differential correlators: 
3679   TString otherDirectDiffCorrelatorsName = "fOtherDirectDiffCorrelators";
3680   otherDirectDiffCorrelatorsName += fAnalysisLabel->Data();
3681   for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
3682   { 
3683    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
3684    {
3685     for(Int_t sc=0;sc<2;sc++) // sin or cos
3686     {
3687      for(Int_t ci=0;ci<1;ci++) // correlator index
3688      {
3689       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]); 
3690       fNestedLoopsList->Add(fOtherDirectDiffCorrelators[t][pe][sc][ci]);
3691      }
3692     }
3693    }
3694   }
3695   // number of RPs and POIs in selected pt and eta bins for cross-checkings:
3696   TString noOfParticlesInBinName = "fNoOfParticlesInBin";
3697   fNoOfParticlesInBin = new TH1D(noOfParticlesInBinName.Data(),"Number of RPs and POIs in selected p_{T} and #eta bin",4,0,4);
3698   fNoOfParticlesInBin->GetXaxis()->SetBinLabel(1,"# of RPs in p_{T} bin");
3699   fNoOfParticlesInBin->GetXaxis()->SetBinLabel(2,"# of RPs in #eta bin");
3700   fNoOfParticlesInBin->GetXaxis()->SetBinLabel(3,"# of POIs in p_{T} bin");
3701   fNoOfParticlesInBin->GetXaxis()->SetBinLabel(4,"# of POIs in #eta bin");
3702   fNestedLoopsList->Add(fNoOfParticlesInBin);
3703  } // end of if(fEvaluateDiffFlowNestedLoops)
3704
3705 } // end of AliFlowAnalysisWithQCumulants::BookEverythingForNestedLoops()
3706
3707 //=========================================================================================================
3708
3709 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelations()
3710 {
3711  // Calculate in this method all multiparticle azimuthal correlations.
3712  //
3713  // Remark 1: All multiparticle correlations are stored in TProfile fIntFlowCorrelationsAllPro;
3714  // Remark 2: There is a special TProfile fIntFlowCorrelationsPro holding results 
3715  //           only for same harmonic's correlations <<2>>, <<4>>, <<6>> and <<8>>;  
3716  // Remark 3: Binning of fIntFlowCorrelationsAllPro is organized as follows:
3717  // --------------------------------------------------------------------------------------------------------------------
3718  //  1st bin: <2>_{1n|1n} = two1n1n = cos(1n(phi1-phi2))>
3719  //  2nd bin: <2>_{2n|2n} = two2n2n = cos(2n(phi1-phi2))>
3720  //  3rd bin: <2>_{3n|3n} = two3n3n = cos(3n(phi1-phi2))> 
3721  //  4th bin: <2>_{4n|4n} = two4n4n = cos(4n(phi1-phi2))>
3722  //  5th bin:           ----  EMPTY ----
3723  //  6th bin: <3>_{2n|1n,1n} = three2n1n1n = <cos(n(2*phi1-phi2-phi3))>
3724  //  7th bin: <3>_{3n|2n,1n} = three3n2n1n = <cos(n(3*phi1-2*phi2-phi3))>
3725  //  8th bin: <3>_{4n|2n,2n} = three4n2n2n = <cos(n(4*phi1-2*phi2-2*phi3))>
3726  //  9th bin: <3>_{4n|3n,1n} = three4n3n1n = <cos(n(4*phi1-3*phi2-phi3))>
3727  // 10th bin:           ----  EMPTY ----
3728  // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1n = <cos(n(phi1+phi2-phi3-phi4))>
3729  // 12th bin: <4>_{2n,1n|2n,1n} = four2n1n2n1n = <cos(n(2*phi1+phi2-2*phi3-phi4))>
3730  // 13th bin: <4>_{2n,2n|2n,2n} = four2n2n2n2n = <cos(2n(phi1+phi2-phi3-phi4))>
3731  // 14th bin: <4>_{3n|1n,1n,1n} = four3n1n1n1n = <cos(n(3*phi1-phi2-phi3-phi4))> 
3732  // 15th bin: <4>_{3n,1n|3n,1n} = four3n1n3n1n = <cos(n(3*phi1+phi2-3*phi3-phi4))>
3733  // 16th bin: <4>_{3n,1n|2n,2n} = four3n1n2n2n = <cos(n(3*phi1+phi2-2*phi3-2*phi4))>
3734  // 17th bin: <4>_{4n|2n,1n,1n} = four4n2n1n1n = <cos(n(4*phi1-2*phi2-phi3-phi4))>
3735  // 18th bin:           ----  EMPTY ----
3736  // 19th bin: <5>_{2n,1n|1n,1n,1n} = five2n1n1n1n1n = <cos(n(2*phi1+phi2-phi3-phi4-phi5))>
3737  // 20th bin: <5>_{2n,2n|2n,1n,1n} = five2n2n2n1n1n = <cos(n(2*phi1+2*phi2-2*phi3-phi4-phi5))>
3738  // 21st bin: <5>_{3n,1n|2n,1n,1n} = five3n1n2n1n1n = <cos(n(3*phi1+phi2-2*phi3-phi4-phi5))>
3739  // 22nd bin: <5>_{4n|1n,1n,1n,1n} = five4n1n1n1n1n = <cos(n(4*phi1-phi2-phi3-phi4-phi5))>
3740  // 23rd bin:           ----  EMPTY ----
3741  // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = six1n1n1n1n1n1n = <cos(n(phi1+phi2+phi3-phi4-phi5-phi6))>
3742  // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = six2n1n1n2n1n1n = <cos(n(2*phi1+phi2+phi3-2*phi4-phi5-phi6))>
3743  // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = six2n2n1n1n1n1n = <cos(n(2*phi1+2*phi2-phi3-phi4-phi5-phi6))>
3744  // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = six3n1n1n1n1n1n = <cos(n(3*phi1+phi2-phi3-phi4-phi5-phi6))> 
3745  // 28th bin:           ----  EMPTY ----
3746  // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = seven2n1n1n1n1n1n1n =  <cos(n(2*phi1+phi2+phi3-phi4-phi5-phi6-phi7))>
3747  // 30th bin:           ----  EMPTY ----
3748  // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = eight1n1n1n1n1n1n1n1n = <cos(n(phi1+phi2+phi3+phi4-phi5-phi6-phi7-phi8))>
3749  // 32nd bin:           ----  EMPTY ----
3750  //  Extra correlations for v3{5} study: 
3751  // 33rd bin: <4>_{4n,2n|3n,3n} = four4n2n3n3n = <cos(n(4*phi1+2*phi2-3*phi3-3*phi4))>
3752  // 34th bin: <5>_{3n,3n|2n,2n,2n} = five3n3n2n2n2n = <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-2*phi5))> 
3753  //  Extra correlations for Teaney-Yan study: 
3754  // 35th bin: <2>_{5n|5n} = two5n5n = <cos(5n(phi1-phi2)> 
3755  // 36th bin: <2>_{6n|6n} = two6n6n = <cos(6n(phi1-phi2)> 
3756  // 37th bin: <3>_{5n|3n,2n} = three5n3n2n = <cos(n(5*phi1-3*phi2-2*phi3)> 
3757  // 38th bin: <3>_{5n|4n,1n} = three5n4n1n = <cos(n(5*phi1-4*phi2-1*phi3)> 
3758  // 39th bin: <3>_{6n|3n,3n} = three6n3n3n = <cos(n(6*phi1-3*phi2-3*phi3)> 
3759  // 40th bin: <3>_{6n|4n,2n} = three6n4n2n = <cos(n(6*phi1-4*phi2-2*phi3)> 
3760  // 41st bin: <3>_{6n|5n,1n} = three6n5n1n = <cos(n(6*phi1-5*phi2-1*phi3)>
3761  // 42nd bin: <4>_{6n|3n,2n,1n} = four6n3n2n1n = <cos(n(6*phi1-3*phi2-2*phi3-1*phi4)>
3762  // 43rd bin: <4>_{3n,2n|3n,2n} = four3n2n3n2n = <cos(n(3*phi1+2*phi2-3*phi3-2*phi4)>
3763  // 44th bin: <4>_{4n,1n|3n,2n} = four4n1n3n2n = <cos(n(4*phi1+1*phi2-3*phi3-2*phi4)>
3764  // 45th bin: <4>_{3n,3n|3n,3n} = four3n3n3n3n = <cos(3n*(phi1+phi2-phi3-phi4))> 
3765  // 46th bin: <4>_{4n,2n|3n,3n} = four4n2n3n3n = <cos(n(4*phi1+2*phi2-3*phi3-3*phi4)>
3766  // 47th bin: <4>_{5n,1n|3n,3n} = four5n1n3n3n = <cos(n(5*phi1+1*phi2-3*phi3-3*phi4)>
3767  // 48th bin: <4>_{4n,2n|4n,2n} = four4n2n4n2n = <cos(n(4*phi1+2*phi2-4*phi3-2*phi4)> 
3768  // 49th bin: <4>_{5n,1n|4n,2n} = four5n1n4n2n = <cos(n(5*phi1+1*phi2-4*phi3-2*phi4)>
3769  // 50th bin: <4>_{5n|3n,1n,1n} = four5n3n1n1n = <cos(n(5*phi1-3*phi2-1*phi3-1*phi4)>
3770  // 51st bin: <4>_{5n|2n,2n,1n} = four5n2n2n1n = <cos(n(5*phi1-2*phi2-2*phi3-1*phi4)>
3771  // 52nd bin: <4>_{5n,1n|5n,1n} = four5n1n5n1n = <cos(n(5*phi1+1*phi2-5*phi3-1*phi4)>
3772  // 53rd bin: <5>_{3n,3n|3n,2n,1n} = five3n3n3n2n1n = <cos(n(3*phi1+3*phi2-3*phi3-2*phi4-1*phi5)>
3773  // 54th bin: <5>_{4n,2n|3n,2n,1n} = five4n2n3n2n1n = <cos(n(4*phi1+2*phi2-3*phi3-2*phi4-1*phi5)>
3774  // 55th bin: <5>_{3n,2n|3n,1n,1n} = five3n2n3n1n1n = <cos(n(3*phi1+2*phi2-3*phi3-1*phi4-1*phi5)>
3775  // 56th bin: <5>_{3n,2n|2n,2n,1n} = five3n2n2n2n1n = <cos(n(3*phi1+2*phi2-2*phi3-2*phi4-1*phi5)>
3776  // 57th bin: <5>_{5n,1n|3n,2n,1n} = five5n1n3n2n1n = <cos(n(5*phi1+1*phi2-3*phi3-2*phi4-1*phi5)>
3777  // 58th bin: <6>_{3n,2n,1n|3n,2n,1n} = six3n2n1n3n2n1n = <cos(n(3*phi1+2*phi2+1*phi3-3*phi4-2*phi5-1*phi6)>
3778  //  Extra correlations for Teaney-Yan study (B): 
3779  // 59th bin: <4>_{6n|4n,1n,1n} = four6n4n1n1n = <cos(n(6*phi1-4*phi2-1*phi3-1*phi4)>
3780  // 60th bin: <4>_{6n|2n,2n,2n} = four6n2n2n2n = <cos(n(6*phi1-2*phi2-2*phi3-2*phi4)>
3781  // 61st bin: <5>_{6n|2n,2n,1n,1n} = five6n2n2n1n1n = <cos(n(6*phi1-2*phi2-2*phi3-1*phi4-1*phi5)>
3782  // 62nd bin: <5>_{4n,1n,1n|3n,3n} = five4n1n1n3n3n = <cos(n(4*phi1+1*phi2+1*phi3-3*phi4-3*phi5)>
3783  // 63rd bin: <6>_{3n,3n|2n,2n,1n,1n} = six3n3n2n2n1n1n = <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-1*phi5-1*phi6)>
3784  // --------------------------------------------------------------------------------------------------------------------
3785
3786  // Multiplicity of an event: 
3787  Double_t dMult = (*fSpk)(0,0);
3788  // Real parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n, 4n, 5n and 6n: 
3789  Double_t dReQ1n = (*fReQ)(0,0);
3790  Double_t dReQ2n = (*fReQ)(1,0);
3791  Double_t dReQ3n = (*fReQ)(2,0);
3792  Double_t dReQ4n = (*fReQ)(3,0);
3793  Double_t dReQ5n = (*fReQ)(4,0); 
3794  Double_t dReQ6n = (*fReQ)(5,0);
3795  // Imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n, 4n, 5n and 6n:
3796  Double_t dImQ1n = (*fImQ)(0,0);
3797  Double_t dImQ2n = (*fImQ)(1,0);
3798  Double_t dImQ3n = (*fImQ)(2,0);
3799  Double_t dImQ4n = (*fImQ)(3,0);
3800  Double_t dImQ5n = (*fImQ)(4,0); 
3801  Double_t dImQ6n = (*fImQ)(5,0);
3802
3803  // Multiplicity bin of an event (relevant for all histos vs M): 
3804  Double_t dMultiplicityBin = 0.;
3805  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
3806  {
3807    //Printf("RP multiplicity: %lf",fNumberOfRPsEBE);
3808    dMultiplicityBin = fNumberOfRPsEBE+0.5;
3809  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
3810    {
3811      //Printf("Reference multiplicity: %lf",fReferenceMultiplicityEBE);
3812     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
3813    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
3814      {
3815       dMultiplicityBin = fNumberOfPOIsEBE+0.5;
3816      }
3817  
3818  // Real parts of expressions involving various combinations of Q-vectors which appears
3819  // simultaneously in several equations for multiparticle correlations bellow: 
3820  // Re[Q_{2n}Q_{n}^*Q_{n}^*]
3821  Double_t reQ2nQ1nstarQ1nstar = pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n; 
3822  // Re[Q_{6n}Q_{3n}^*Q_{3n}^*]
3823  Double_t reQ6nQ3nstarQ3nstar = pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n;  
3824  // Re[Q_{4n}Q_{2n}^*Q_{2n}^*]
3825  Double_t reQ4nQ2nstarQ2nstar = pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n;
3826  // Re[Q_{4n}Q_{3n}^*Q_{n}^*]
3827  Double_t reQ4nQ3nstarQ1nstar = dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);
3828  // Re[Q_{3n}Q_{2n}^*Q_{n}^*]
3829  Double_t reQ3nQ2nstarQ1nstar = dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
3830                               + dImQ3n*dImQ2n*dReQ1n; 
3831  // Re[Q_{5n}Q_{3n}^*Q_{2n}^*]
3832  Double_t reQ5nQ3nstarQ2nstar = dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n
3833                               + dImQ5n*dImQ2n*dReQ3n;                             
3834  // Re[Q_{5n}Q_{4n}^*Q_{1n}^*]
3835  Double_t reQ5nQ4nstarQ1nstar = dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n
3836                               + dImQ5n*dImQ4n*dReQ1n;                              
3837  // Re[Q_{6n}Q_{5n}^*Q_{1n}^*]                              
3838  Double_t reQ6nQ5nstarQ1nstar = dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n
3839                               + dImQ6n*dImQ5n*dReQ1n;
3840  // Re[Q_{6n}Q_{4n}^*Q_{2n}^*]                              
3841  Double_t reQ6nQ4nstarQ2nstar = dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
3842                               + dImQ6n*dImQ4n*dReQ2n;
3843  // Re[Q_{3n}Q_{n}Q_{2n}^*Q_{2n}^*]
3844  Double_t reQ3nQ1nQ2nstarQ2nstar = (pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
3845                                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);                                
3846  // Re[Q_{3n}Q_{n}^*Q_{n}^*Q_{n}^*]
3847  Double_t reQ3nQ1nstarQ1nstarQ1nstar = dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
3848                                      + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3);
3849  // Re[Q_{6n}Q_{2n}^*Q_{2n}^*Q_{2n}^*]
3850  Double_t reQ6nQ2nstarQ2nstarQ2nstar = dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
3851                                      + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3);
3852  // Re[Q_{4n}Q_{2n}^*Q_{n}^*Q_{n}^*]
3853  Double_t reQ4nQ2nstarQ1nstarQ1nstar = (dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
3854                                      + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n);  
3855  // Re[Q_{4n}Q_{2n}^*Q_{3n}^*Q_{3n}^*]
3856  Double_t reQ4nQ2nQ3nstarQ3nstar = (dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
3857                                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n;                    
3858  // Re[Q_{4n}Q_{n}Q_{3n}^*Q_{2n}^*]
3859  Double_t reQ4nQ1nQ3nstarQ2nstar = dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
3860                                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
3861                                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
3862                                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n;
3863  // Re[Q_{5n}Q_{n}Q_{4n}^*Q_{2n}^*]
3864  Double_t reQ5nQ1nQ4nstarQ2nstar = dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
3865                                  + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
3866                                  - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n 
3867                                  + dImQ1n*dImQ2n*dReQ4n*dReQ5n+dReQ1n*dReQ2n*dReQ4n*dReQ5n;                                  
3868  // Re[Q_{5n}Q_{n}Q_{3n}^*Q_{3n}^*]                                  
3869  Double_t reQ5nQ1nQ3nstarQ3nstar = dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
3870                                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
3871                                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n;
3872  // Re[Q_{5n}Q_{3n}^*Q_{n}^*Q_{n}^*]                                  
3873  Double_t reQ5nQ3nstarQ1nstarQ1nstar = -pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
3874                                      + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
3875                                      - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n;                     
3876  // Re[Q_{5n}Q_{2n}^*Q_{2n}^*Q_{n}^*]                                  
3877  Double_t reQ5nQ2nstarQ2nstarQ1nstar = -pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
3878                                      + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
3879                                      - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n;                                     
3880  // Re[Q_{6n}Q_{4n}^*Q_{n}^*Q_{n}^*]                                  
3881  Double_t reQ6nQ4nstarQ1nstarQ1nstar = -pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
3882                                      +  2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
3883                                      -  pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n;
3884  // |Q_{2n}|^2 |Q_{n}|^2
3885  Double_t dQ2nQ1nQ2nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
3886  // |Q_{4n}|^2 |Q_{2n}|^2
3887  Double_t dQ4nQ2nQ4nstarQ2nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.));
3888  // |Q_{3n}|^2 |Q_{2n}|^2
3889  Double_t dQ3nQ2nQ3nstarQ2nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.));
3890  // |Q_{5n}|^2 |Q_{n}|^2
3891  Double_t dQ5nQ1nQ5nstarQ1nstar = (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
3892  // |Q_{3n}|^2 |Q_{n}|^2
3893  Double_t dQ3nQ1nQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
3894  // Re[Q_{2n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*]
3895  Double_t reQ2nQ1nQ1nstarQ1nstarQ1nstar = (dReQ2n*dReQ1n-dImQ2n*dImQ1n)*(pow(dReQ1n,3)-3.*dReQ1n*pow(dImQ1n,2))
3896                                         + (dReQ2n*dImQ1n+dReQ1n*dImQ2n)*(3.*dImQ1n*pow(dReQ1n,2)-pow(dImQ1n,3)); 
3897  // Re[Q_{2n}Q_{2n}Q_{2n}^*Q_{n}^*Q_{n}^*]
3898  Double_t reQ2nQ2nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
3899                                         * (dReQ2n*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) + 2.*dImQ2n*dReQ1n*dImQ1n);
3900  // Re[Q_{4n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
3901  Double_t reQ4nQ1nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,4.)*dReQ4n-6.*pow(dReQ1n,2.)*dReQ4n*pow(dImQ1n,2.)
3902                                             + pow(dImQ1n,4.)*dReQ4n+4.*pow(dReQ1n,3.)*dImQ1n*dImQ4n
3903                                             - 4.*pow(dImQ1n,3.)*dReQ1n*dImQ4n;
3904  // Re[Q_{3n}Q_{n}Q_{2n}^*Q_{n}^*Q_{n}^*]
3905  Double_t reQ3nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
3906                                         * (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n
3907                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n);
3908  // Re[Q_{6n}Q_{n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
3909  Double_t reQ6nQ3nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
3910                                      - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
3911                                      + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
3912                                      + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n;
3913  // Re[Q_{3n}Q_{3n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
3914  Double_t reQ3nQ3nQ3nstarQ2nstarQ1nstar = (pow(dImQ3n,2.)+pow(dReQ3n,2.))
3915                                         * (dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n
3916                                         - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n);   
3917  // Re[Q_{3n}Q_{3n}Q_{2n}^*Q_{2n}^*Q_{2n}^*]
3918  Double_t reQ3nQ3nQ2nstarQ2nstarQ2nstar = pow(dReQ2n,3.)*pow(dReQ3n,2.) 
3919                                         - 3.*dReQ2n*pow(dReQ3n,2.)*pow(dImQ2n,2.)
3920                                         + 6.*pow(dReQ2n,2.)*dReQ3n*dImQ2n*dImQ3n 
3921                                         - 2.*dReQ3n*pow(dImQ2n,3.)*dImQ3n-pow(dReQ2n,3.)*pow(dImQ3n,2.) 
3922                                         + 3.*dReQ2n*pow(dImQ2n,2.)*pow(dImQ3n,2.);
3923  // Re[Q_{4n}Q_{2n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
3924  Double_t reQ4nQ2nQ3nstarQ2nstarQ1nstar = (pow(dImQ2n,2.)+pow(dReQ2n,2.))
3925                                         * (dImQ3n*dImQ4n*dReQ1n+dImQ1n*dImQ4n*dReQ3n 
3926                                         - dImQ1n*dImQ3n*dReQ4n+dReQ1n*dReQ3n*dReQ4n);
3927  // Re[Q_{3n}Q_{2n}Q_{3n}^*Q_{n}^*Q_{n}^*]
3928  Double_t reQ3nQ2nQ3nstarQ1nstarQ1nstar = -(pow(dImQ3n,2.)+pow(dReQ3n,2.))
3929                                         * (-2.*dImQ1n*dImQ2n*dReQ1n+pow(dImQ1n,2.)*dReQ2n-pow(dReQ1n,2.)*dReQ2n);                              
3930  // Re[Q_{3n}Q_{2n}Q_{2n}^*Q_{2n}^*Q_{n}^*]
3931  Double_t reQ3nQ2nQ2nstarQ2nstarQ1nstar = (pow(dImQ2n,2.)+pow(dReQ2n,2.))
3932                                         * (dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n 
3933                                         - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n);
3934  // Re[Q_{5n}Q_{n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
3935  Double_t reQ5nQ1nQ3nstarQ2nstarQ1nstar = (pow(dImQ1n,2.)+pow(dReQ1n,2.))
3936                                         * (dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n 
3937                                         - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n);   
3938  // Re[Q_{2n}Q_{2n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
3939  Double_t reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)*dReQ2n-2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)
3940                                                + dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dImQ2n)
3941                                                * (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)
3942                                                - dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n+pow(dImQ1n,2.)*dImQ2n); 
3943  // Re[Q_{3n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
3944  Double_t reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
3945                                                * (pow(dReQ1n,3.)*dReQ3n-3.*dReQ1n*dReQ3n*pow(dImQ1n,2.)
3946                                                + 3.*pow(dReQ1n,2.)*dImQ1n*dImQ3n-pow(dImQ1n,3.)*dImQ3n);
3947  // |Q_{2n}|^2 |Q_{n}|^4
3948  Double_t dQ2nQ1nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.); 
3949  // |Q_{3n}|^2 |Q_{2n}|^2 |Q_{n}|^2
3950  Double_t dQ3nQ2nQ1nQ3nstarQ2nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3951                                           * (pow(dReQ1n,2.)+pow(dImQ1n,2.));
3952  // Re[Q_{2n}Q_{n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
3953  Double_t reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
3954                                                   * (pow(dReQ1n,2.)*dReQ2n-dReQ2n*pow(dImQ1n,2.)
3955                                                   + 2.*dReQ1n*dImQ1n*dImQ2n);                                                  
3956  // Re[Q_{6n}Q_{2n}^*Q_{2n}^*Q_{n}^*Q_{n}^*]
3957  Double_t reQ6nQ2nstarQ2nstarQ1nstarQ1nstar = pow(dReQ1n*dReQ2n,2.)*dReQ6n-pow(dReQ2n*dImQ1n,2.)*dReQ6n
3958                                             - 4.*dReQ1n*dReQ2n*dReQ6n*dImQ1n*dImQ2n 
3959                                             - pow(dReQ1n*dImQ2n,2.)*dReQ6n+pow(dImQ1n*dImQ2n,2.)*dReQ6n
3960                                             + 2.*dReQ1n*pow(dReQ2n,2.)*dImQ1n*dImQ6n
3961                                             + 2.*pow(dReQ1n,2.)*dReQ2n*dImQ2n*dImQ6n 
3962                                             - 2.*dReQ2n*pow(dImQ1n,2.)*dImQ2n*dImQ6n 
3963                                             - 2.*dReQ1n*dImQ1n*pow(dImQ2n,2.)*dImQ6n;       
3964  // Re[Q_{4n}Q_{1n}Q_{1n}Q_{3n}^*Q_{3n}^*]
3965  Double_t reQ4nQ1nQ1nQ3nstarQ3nstar = pow(dReQ1n*dReQ3n,2.)*dReQ4n-pow(dReQ3n*dImQ1n,2.)*dReQ4n  
3966                                     + 4.*dReQ1n*dReQ3n*dReQ4n*dImQ1n*dImQ3n 
3967                                     - pow(dReQ1n*dImQ3n,2.)*dReQ4n+pow(dImQ1n*dImQ3n,2.)*dReQ4n  
3968                                     - 2.*dReQ1n*pow(dReQ3n,2.)*dImQ1n*dImQ4n 
3969                                     + 2.*pow(dReQ1n,2.)*dReQ3n*dImQ3n*dImQ4n 
3970                                     - 2.*dReQ3n*pow(dImQ1n,2.)*dImQ3n*dImQ4n 
3971                                     + 2.*dReQ1n*dImQ1n*pow(dImQ3n,2.)*dImQ4n;
3972  // Re[Q_{3n}Q_{3n}Q_{2n}^*Q_{2n}^*Q_{1n}^*Q_{1n}^*]
3973  Double_t reQ3nQ3nQ2nstarQ2nstarQ1nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ2n*dReQ3n*dImQ1n-dReQ1n*dReQ3n*dImQ2n 
3974                                                - dReQ3n*dImQ1n*dImQ2n+dReQ1n*dReQ2n*dImQ3n+dReQ2n*dImQ1n*dImQ3n 
3975                                                + dReQ1n*dImQ2n*dImQ3n-dImQ1n*dImQ2n*dImQ3n)*(dReQ1n*dReQ2n*dReQ3n 
3976                                                + dReQ2n*dReQ3n*dImQ1n+dReQ1n*dReQ3n*dImQ2n-dReQ3n*dImQ1n*dImQ2n 
3977                                                - dReQ1n*dReQ2n*dImQ3n+dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n 
3978                                                + dImQ1n*dImQ2n*dImQ3n);
3979     
3980  // Results for multiparticle azimuthal correlations:
3981  // 2-particle:
3982  Double_t two1n1n = 0.; // <cos(n(phi1-phi2))>
3983  Double_t two2n2n = 0.; // <cos(2n(phi1-phi2))>
3984  Double_t two3n3n = 0.; // <cos(3n(phi1-phi2))>
3985  Double_t two4n4n = 0.; // <cos(4n(phi1-phi2))>
3986  Double_t mWeight2p = 0.; // multiplicity weight for 2-p correlations
3987  if(dMult>1)
3988  {
3989   two1n1n = (pow(dReQ1n,2.)+pow(dImQ1n,2.)-dMult)/(dMult*(dMult-1.)); 
3990   two2n2n = (pow(dReQ2n,2.)+pow(dImQ2n,2.)-dMult)/(dMult*(dMult-1.)); 
3991   two3n3n = (pow(dReQ3n,2.)+pow(dImQ3n,2.)-dMult)/(dMult*(dMult-1.)); 
3992   two4n4n = (pow(dReQ4n,2.)+pow(dImQ4n,2.)-dMult)/(dMult*(dMult-1.)); 
3993   // Average 2-particle correlations for single event: 
3994   fIntFlowCorrelationsAllEBE->SetBinContent(1,two1n1n);
3995   fIntFlowCorrelationsAllEBE->SetBinContent(2,two2n2n);
3996   fIntFlowCorrelationsAllEBE->SetBinContent(3,two3n3n);
3997   fIntFlowCorrelationsAllEBE->SetBinContent(4,two4n4n);         
3998   // Average 2-particle correlations for all events:      
3999   fIntFlowCorrelationsAllPro->Fill(0.5,two1n1n,dMult*(dMult-1.));
4000   fIntFlowCorrelationsAllPro->Fill(1.5,two2n2n,dMult*(dMult-1.)); 
4001   fIntFlowCorrelationsAllPro->Fill(2.5,two3n3n,dMult*(dMult-1.)); 
4002   fIntFlowCorrelationsAllPro->Fill(3.5,two4n4n,dMult*(dMult-1.)); 
4003   // Store separetately <2>:
4004   fIntFlowCorrelationsEBE->SetBinContent(1,two1n1n); // <2>  
4005   // Testing other multiplicity weights:
4006   if(fMultiplicityWeight->Contains("combinations"))
4007   {
4008    mWeight2p = dMult*(dMult-1.);
4009   } else if(fMultiplicityWeight->Contains("unit"))
4010     {
4011      mWeight2p = 1.;    
4012     } else if(fMultiplicityWeight->Contains("multiplicity"))
4013       {
4014        mWeight2p = dMult;           
4015       }          
4016   fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(1,mWeight2p); // eW_<2>
4017   fIntFlowCorrelationsPro->Fill(0.5,two1n1n,mWeight2p);
4018   fIntFlowSquaredCorrelationsPro->Fill(0.5,two1n1n*two1n1n,mWeight2p);
4019   if(fCalculateCumulantsVsM)
4020   {
4021    if(fFillProfilesVsMUsingWeights)  
4022    {
4023     fIntFlowCorrelationsVsMPro[0]->Fill(dMultiplicityBin,two1n1n,mWeight2p);
4024     fIntFlowSquaredCorrelationsVsMPro[0]->Fill(dMultiplicityBin,two1n1n*two1n1n,mWeight2p);
4025    } else
4026      {
4027       fIntFlowCorrelationsVsMPro[0]->Fill(dMultiplicityBin,two1n1n);
4028       fIntFlowSquaredCorrelationsVsMPro[0]->Fill(dMultiplicityBin,two1n1n*two1n1n);
4029      }
4030   } // end of if(fCalculateCumulantsVsM)
4031   if(fCalculateAllCorrelationsVsM)
4032   {
4033    fIntFlowCorrelationsAllVsMPro[0]->Fill(dMultiplicityBin,two1n1n,mWeight2p);
4034    fIntFlowCorrelationsAllVsMPro[1]->Fill(dMultiplicityBin,two2n2n,mWeight2p);
4035    fIntFlowCorrelationsAllVsMPro[2]->Fill(dMultiplicityBin,two3n3n,mWeight2p);
4036    fIntFlowCorrelationsAllVsMPro[3]->Fill(dMultiplicityBin,two4n4n,mWeight2p);
4037   } 
4038   if(fStoreControlHistograms)
4039   {
4040    fCorrelation2468VsMult[0]->Fill(dMultiplicityBin,two1n1n);
4041   } 
4042  } // end of if(dMult>1)
4043  
4044  // 3-particle:
4045  Double_t three2n1n1n = 0.; // <cos(n(2*phi1-phi2-phi3))>
4046  Double_t three3n2n1n = 0.; // <cos(n(3*phi1-2*phi2-phi3))>
4047  Double_t three4n2n2n = 0.; // <cos(n(4*phi1-2*phi2-2*phi3))>
4048  Double_t three4n3n1n = 0.; // <cos(n(4*phi1-3*phi2-phi3))> 
4049  if(dMult>2)
4050  {
4051   three2n1n1n = (reQ2nQ1nstarQ1nstar-2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4052               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
4053               / (dMult*(dMult-1.)*(dMult-2.));                     
4054   three3n2n1n = (reQ3nQ2nstarQ1nstar-(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4055               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))
4056               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4057               / (dMult*(dMult-1.)*(dMult-2.));
4058   three4n2n2n = (reQ4nQ2nstarQ2nstar-2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4059               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*dMult)
4060               / (dMult*(dMult-1.)*(dMult-2.)); 
4061   three4n3n1n = (reQ4nQ3nstarQ1nstar-(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4062               - (pow(dReQ3n,2.)+pow(dImQ3n,2.))
4063               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4064               / (dMult*(dMult-1.)*(dMult-2.));              
4065   // Average 3-particle correlations for single event: 
4066   fIntFlowCorrelationsAllEBE->SetBinContent(6,three2n1n1n);
4067   fIntFlowCorrelationsAllEBE->SetBinContent(7,three3n2n1n);
4068   fIntFlowCorrelationsAllEBE->SetBinContent(8,three4n2n2n);
4069   fIntFlowCorrelationsAllEBE->SetBinContent(9,three4n3n1n);
4070   // Average 3-particle correlations for all events:                
4071   fIntFlowCorrelationsAllPro->Fill(5.5,three2n1n1n,dMult*(dMult-1.)*(dMult-2.)); 
4072   fIntFlowCorrelationsAllPro->Fill(6.5,three3n2n1n,dMult*(dMult-1.)*(dMult-2.));
4073   fIntFlowCorrelationsAllPro->Fill(7.5,three4n2n2n,dMult*(dMult-1.)*(dMult-2.)); 
4074   fIntFlowCorrelationsAllPro->Fill(8.5,three4n3n1n,dMult*(dMult-1.)*(dMult-2.));  
4075   // Average 3-particle correlations vs M for all events:                
4076   if(fCalculateAllCorrelationsVsM)
4077   {
4078    fIntFlowCorrelationsAllVsMPro[5]->Fill(dMultiplicityBin,three2n1n1n,dMult*(dMult-1.)*(dMult-2.));
4079    fIntFlowCorrelationsAllVsMPro[6]->Fill(dMultiplicityBin,three3n2n1n,dMult*(dMult-1.)*(dMult-2.));
4080    fIntFlowCorrelationsAllVsMPro[7]->Fill(dMultiplicityBin,three4n2n2n,dMult*(dMult-1.)*(dMult-2.));
4081    fIntFlowCorrelationsAllVsMPro[8]->Fill(dMultiplicityBin,three4n3n1n,dMult*(dMult-1.)*(dMult-2.));
4082   }    
4083  } // end of if(dMult>2)
4084  
4085  // 4-particle:
4086  Double_t four1n1n1n1n = 0.; // <cos(n(phi1+phi2-phi3-phi4))>
4087  Double_t four2n2n2n2n = 0.; // <cos(2n(phi1+phi2-phi3-phi4))>
4088  Double_t four2n1n2n1n = 0.; // <cos(n(2*phi1+phi2-2*phi3-phi4))> 
4089  Double_t four3n1n1n1n = 0.; // <cos(n(3*phi1-phi2-phi3-phi4))> 
4090  Double_t four4n2n1n1n = 0.; // <cos(n(4*phi1-2*phi2-phi3-phi4))> 
4091  Double_t four3n1n2n2n = 0.; // <cos(n(3*phi1+phi2-2*phi3-2*phi4))> 
4092  Double_t four3n1n3n1n = 0.; // <cos(n(3*phi1+phi2-3*phi3-phi4))>    
4093  Double_t mWeight4p = 0.; // multiplicity weight for 4-p correlations
4094  if(dMult>3)
4095  {
4096   four1n1n1n1n = (2.*dMult*(dMult-3.)+pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ1n,2.)
4097                + pow(dImQ1n,2.))-2.*reQ2nQ1nstarQ1nstar+(pow(dReQ2n,2.)+pow(dImQ2n,2.)))
4098                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));     
4099   four2n2n2n2n = (2.*dMult*(dMult-3.)+pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ2n,2.)
4100                + pow(dImQ2n,2.))-2.*reQ4nQ2nstarQ2nstar+(pow(dReQ4n,2.)+pow(dImQ4n,2.)))
4101                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));
4102   four2n1n2n1n = (dQ2nQ1nQ2nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar-2.*reQ2nQ1nstarQ1nstar)
4103                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4104                - ((dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4105                + (dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-(pow(dReQ3n,2.)+pow(dImQ3n,2.)))
4106                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4107                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));
4108   four3n1n1n1n = (reQ3nQ1nstarQ1nstarQ1nstar-3.*reQ3nQ2nstarQ1nstar-3.*reQ2nQ1nstarQ1nstar
4109                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4110                + 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
4111                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4112   four4n2n1n1n = (reQ4nQ2nstarQ1nstarQ1nstar-2.*reQ4nQ3nstarQ1nstar-reQ4nQ2nstarQ2nstar-2.*reQ3nQ2nstarQ1nstar)
4113                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4114                - (reQ2nQ1nstarQ1nstar-2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4115                - 3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
4116                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4117                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));
4118   four3n1n2n2n = (reQ3nQ1nQ2nstarQ2nstar-reQ4nQ2nstarQ2nstar-reQ4nQ3nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar)
4119                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4120                - (2.*reQ2nQ1nstarQ1nstar-(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4121                - 4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
4122                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4123                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.)); 
4124   four3n1n3n1n = ((pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4125                - 2.*reQ4nQ3nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar
4126                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4127                + pow(dReQ2n,2.)+pow(dImQ2n,2.)-(dMult-4.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4128                + dMult*(dMult-6.))
4129                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));           
4130   // Average 4-particle correlations for single event: 
4131   fIntFlowCorrelationsAllEBE->SetBinContent(11,four1n1n1n1n);
4132   fIntFlowCorrelationsAllEBE->SetBinContent(12,four2n1n2n1n);
4133   fIntFlowCorrelationsAllEBE->SetBinContent(13,four2n2n2n2n);
4134   fIntFlowCorrelationsAllEBE->SetBinContent(14,four3n1n1n1n);
4135   fIntFlowCorrelationsAllEBE->SetBinContent(15,four3n1n3n1n);
4136   fIntFlowCorrelationsAllEBE->SetBinContent(16,four3n1n2n2n);
4137   fIntFlowCorrelationsAllEBE->SetBinContent(17,four4n2n1n1n);       
4138   // Average 4-particle correlations for all events:                
4139   fIntFlowCorrelationsAllPro->Fill(10.5,four1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4140   fIntFlowCorrelationsAllPro->Fill(11.5,four2n1n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4141   fIntFlowCorrelationsAllPro->Fill(12.5,four2n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4142   fIntFlowCorrelationsAllPro->Fill(13.5,four3n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4143   fIntFlowCorrelationsAllPro->Fill(14.5,four3n1n3n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4144   fIntFlowCorrelationsAllPro->Fill(15.5,four3n1n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
4145   fIntFlowCorrelationsAllPro->Fill(16.5,four4n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
4146   // Average 4-particle correlations vs M for all events:                
4147   if(fCalculateAllCorrelationsVsM)
4148   {
4149    fIntFlowCorrelationsAllVsMPro[10]->Fill(dMultiplicityBin,four1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4150    fIntFlowCorrelationsAllVsMPro[11]->Fill(dMultiplicityBin,four2n1n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4151    fIntFlowCorrelationsAllVsMPro[12]->Fill(dMultiplicityBin,four2n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4152    fIntFlowCorrelationsAllVsMPro[13]->Fill(dMultiplicityBin,four3n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4153    fIntFlowCorrelationsAllVsMPro[14]->Fill(dMultiplicityBin,four3n1n3n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4154    fIntFlowCorrelationsAllVsMPro[15]->Fill(dMultiplicityBin,four3n1n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4155    fIntFlowCorrelationsAllVsMPro[16]->Fill(dMultiplicityBin,four4n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4156   }       
4157   // Store separetately <4>:
4158   fIntFlowCorrelationsEBE->SetBinContent(2,four1n1n1n1n); // <4>
4159   // Testing other multiplicity weights:
4160   if(fMultiplicityWeight->Contains("combinations"))
4161   {
4162    mWeight4p = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.);
4163   } else if(fMultiplicityWeight->Contains("unit"))
4164     {
4165      mWeight4p = 1.;    
4166     } else if(fMultiplicityWeight->Contains("multiplicity"))
4167       {
4168        mWeight4p = dMult;           
4169       }      
4170   fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(2,mWeight4p); // eW_<4>
4171   fIntFlowCorrelationsPro->Fill(1.5,four1n1n1n1n,mWeight4p);
4172   fIntFlowSquaredCorrelationsPro->Fill(1.5,four1n1n1n1n*four1n1n1n1n,mWeight4p);
4173   if(fCalculateCumulantsVsM)
4174   {
4175    if(fFillProfilesVsMUsingWeights)  
4176    {
4177     fIntFlowCorrelationsVsMPro[1]->Fill(dMultiplicityBin,four1n1n1n1n,mWeight4p);
4178     fIntFlowSquaredCorrelationsVsMPro[1]->Fill(dMultiplicityBin,four1n1n1n1n*four1n1n1n1n,mWeight4p);
4179    } else
4180      {
4181       fIntFlowCorrelationsVsMPro[1]->Fill(dMultiplicityBin,four1n1n1n1n);
4182       fIntFlowSquaredCorrelationsVsMPro[1]->Fill(dMultiplicityBin,four1n1n1n1n*four1n1n1n1n);
4183      }
4184   } // end of if(fCalculateCumulantsVsM) 
4185   if(fStoreControlHistograms)
4186   {
4187    fCorrelation2468VsMult[1]->Fill(dMultiplicityBin,four1n1n1n1n);
4188    fCorrelationProduct2468VsMult[0]->Fill(dMultiplicityBin,two1n1n*four1n1n1n1n);
4189   } 
4190  } // end of if(dMult>3)
4191
4192  // 5-particle:
4193  Double_t five2n1n1n1n1n = 0.; // <cos(n(2*phi1+phi2-phi3-phi4-phi5))>
4194  Double_t five2n2n2n1n1n = 0.; // <cos(n(2*phi1+2*phi2-2*phi3-phi4-phi5))>
4195  Double_t five3n1n2n1n1n = 0.; // <cos(n(3*phi1+phi2-2*phi3-phi4-phi5))>
4196  Double_t five4n1n1n1n1n = 0.; // <cos(n(4*phi1-phi2-phi3-phi4-phi5))>
4197  if(dMult>4)
4198  {            
4199   five2n1n1n1n1n = (reQ2nQ1nQ1nstarQ1nstarQ1nstar-reQ3nQ1nstarQ1nstarQ1nstar+5.*reQ3nQ2nstarQ1nstar
4200                  - 3.*(dMult-5.)*reQ2nQ1nstarQ1nstar-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4201                  - 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))     
4202                  + 3.*(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4203                  - 3.*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
4204                  + 6.*(2.*dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult*(dMult-4.))
4205                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4206   five2n2n2n1n1n = (reQ2nQ2nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-2.*reQ3nQ1nQ2nstarQ2nstar
4207                  + 3.*reQ4nQ2nstarQ2nstar+8.*reQ3nQ2nstarQ1nstar+2.*reQ4nQ3nstarQ1nstar
4208                  - 2.*(dMult-6.)*reQ2nQ1nstarQ1nstar
4209                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4210                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)
4211                  + 2.*(3.*dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4212                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4213                  + 4.*(dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
4214                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4215   five4n1n1n1n1n = (reQ4nQ1nstarQ1nstarQ1nstarQ1nstar-6.*reQ4nQ2nstarQ1nstarQ1nstar-4.*reQ3nQ1nstarQ1nstarQ1nstar
4216                  + 8.*reQ4nQ3nstarQ1nstar+3.*reQ4nQ2nstarQ2nstar+12.*reQ3nQ2nstarQ1nstar+12.*reQ2nQ1nstarQ1nstar
4217                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-8.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4218                  - 12.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-24.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+24.*dMult)
4219                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4220   five3n1n2n1n1n = (reQ3nQ1nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ3nQ1nstarQ1nstarQ1nstar
4221                  - reQ3nQ1nQ2nstarQ2nstar+4.*reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar
4222                  - (2.*dMult-13.)*reQ3nQ2nstarQ1nstar+7.*reQ2nQ1nstarQ1nstar
4223                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4224                  + 2.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4225                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4226                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4227                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4228                  - pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
4229                  + 2.*(3.*dMult-11.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
4230                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));                 
4231   // Average 5-particle correlations for single event: 
4232   fIntFlowCorrelationsAllEBE->SetBinContent(19,five2n1n1n1n1n);
4233   fIntFlowCorrelationsAllEBE->SetBinContent(20,five2n2n2n1n1n);
4234   fIntFlowCorrelationsAllEBE->SetBinContent(21,five3n1n2n1n1n);
4235   fIntFlowCorrelationsAllEBE->SetBinContent(22,five4n1n1n1n1n);        
4236   // Average 5-particle correlations for all events:                         
4237   fIntFlowCorrelationsAllPro->Fill(18.5,five2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
4238   fIntFlowCorrelationsAllPro->Fill(19.5,five2n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4239   fIntFlowCorrelationsAllPro->Fill(20.5,five3n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4240   fIntFlowCorrelationsAllPro->Fill(21.5,five4n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
4241   // Average 5-particle correlations vs M for all events:                
4242   if(fCalculateAllCorrelationsVsM)
4243   {
4244    fIntFlowCorrelationsAllVsMPro[18]->Fill(dMultiplicityBin,five2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4245    fIntFlowCorrelationsAllVsMPro[19]->Fill(dMultiplicityBin,five2n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4246    fIntFlowCorrelationsAllVsMPro[20]->Fill(dMultiplicityBin,five3n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4247    fIntFlowCorrelationsAllVsMPro[21]->Fill(dMultiplicityBin,five4n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4248   }    
4249  } // end of if(dMult>4)
4250     
4251  // 6-particle:
4252  Double_t six1n1n1n1n1n1n = 0.; // <cos(n(phi1+phi2+phi3-phi4-phi5-phi6))>
4253  Double_t six2n2n1n1n1n1n = 0.; // <cos(n(2*phi1+2*phi2-phi3-phi4-phi5-phi6))>
4254  Double_t six3n1n1n1n1n1n = 0.; // <cos(n(3*phi1+phi2-phi3-phi4-phi5-phi6))>
4255  Double_t six2n1n1n2n1n1n = 0.; // <cos(n(2*phi1+phi2+phi3-2*phi4-phi5-phi6))>
4256  Double_t mWeight6p = 0.; // multiplicity weight for 6-p correlations
4257  if(dMult>5)
4258  {
4259   six1n1n1n1n1n1n = (pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),3.)-6.*reQ2nQ1nQ1nstarQ1nstarQ1nstar
4260                   + 4.*reQ3nQ1nstarQ1nstarQ1nstar-12.*reQ3nQ2nstarQ1nstar+18.*(dMult-4.)*reQ2nQ1nstarQ1nstar
4261                   + 9.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4262                   + 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-9.*(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4263                   - 9.*(dMult-4.)*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.) 
4264                   + 18.*(dMult*dMult-7.*dMult+10.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4265                   - 6.*dMult*(dMult*dMult-9.*dMult+20.))
4266                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4267   six2n1n1n2n1n1n = (dQ2nQ1nQ1nQ2nstarQ1nstarQ1nstar-4.*reQ3nQ1nQ2nstarQ1nstarQ1nstar
4268                   - 4.*reQ2nQ1nQ1nstarQ1nstarQ1nstar-2.*reQ2nQ2nQ2nstarQ1nstarQ1nstar
4269                   + 4.*reQ4nQ2nstarQ1nstarQ1nstar+4.*reQ3nQ1nQ2nstarQ2nstar+4.*reQ3nQ1nstarQ1nstarQ1nstar
4270                   - 8.*reQ4nQ3nstarQ1nstar-4.*reQ4nQ2nstarQ2nstar+4.*(2.*dMult-13.)*reQ3nQ2nstarQ1nstar
4271                   + 2.*(7.*dMult-34.)*reQ2nQ1nstarQ1nstar+4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4272                   - 4.*(dMult-7.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4273                   + 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4274                   + pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)+(2.*dMult*dMult-27.*dMult+76.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4275                   - (dMult-12.)*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
4276                   + 4.*(dMult*dMult-15.*dMult+34.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4277                   - 2.*dMult*(dMult*dMult-17.*dMult+60.))
4278                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4279   six2n2n1n1n1n1n = (reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar-6.*reQ2nQ2nQ2nstarQ1nstarQ1nstar-reQ4nQ1nstarQ1nstarQ1nstarQ1nstar
4280                   - 8.*reQ2nQ1nQ1nstarQ1nstarQ1nstar+8.*reQ3nQ1nstarQ1nstarQ1nstar+6.*reQ4nQ2nstarQ1nstarQ1nstar
4281                   + 8.*reQ3nQ1nQ2nstarQ2nstar-40.*reQ3nQ2nstarQ1nstar-8.*reQ4nQ3nstarQ1nstar-9.*reQ4nQ2nstarQ2nstar
4282                   + 24.*(dMult-4.)*reQ2nQ1nstarQ1nstar+24.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4283                   + 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+16.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4284                   + 3.*pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)-12.*(2.*dMult-7.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4285                   + 12.*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)-48.*(dMult-3.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4286                   + 24.*dMult*(dMult-5.))
4287                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
4288   six3n1n1n1n1n1n = (reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar-6.*reQ3nQ1nQ2nstarQ1nstarQ1nstar+6.*reQ4nQ2nstarQ1nstarQ1nstar
4289                   - reQ4nQ1nstarQ1nstarQ1nstarQ1nstar-4.*reQ2nQ1nQ1nstarQ1nstarQ1nstar+3.*reQ3nQ1nQ2nstarQ2nstar
4290                   - 4.*(dMult-5.)*reQ3nQ1nstarQ1nstarQ1nstar-14.*reQ4nQ3nstarQ1nstar
4291                   - 3.*reQ4nQ2nstarQ2nstar+4.*(3.*dMult-17.)*reQ3nQ2nstarQ1nstar+12.*(dMult-6.)*reQ2nQ1nstarQ1nstar
4292                   + 12.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))  
4293                   + 8.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))  
4294                   + 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-8.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
4295                   - 12.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-48.*(dMult-3.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4296                   + 12.*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)+24.*dMult*(dMult-5.))
4297                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4298   // Average 6-particle correlations for single event: 
4299   fIntFlowCorrelationsAllEBE->SetBinContent(24,six1n1n1n1n1n1n);
4300   fIntFlowCorrelationsAllEBE->SetBinContent(25,six2n1n1n2n1n1n);
4301   fIntFlowCorrelationsAllEBE->SetBinContent(26,six2n2n1n1n1n1n);
4302   fIntFlowCorrelationsAllEBE->SetBinContent(27,six3n1n1n1n1n1n);
4303   // Average 6-particle correlations for all events:         
4304   fIntFlowCorrelationsAllPro->Fill(23.5,six1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
4305   fIntFlowCorrelationsAllPro->Fill(24.5,six2n1n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
4306   fIntFlowCorrelationsAllPro->Fill(25.5,six2n2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4307   fIntFlowCorrelationsAllPro->Fill(26.5,six3n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
4308   // Average 6-particle correlations vs M for all events:                
4309   if(fCalculateAllCorrelationsVsM)
4310   {
4311    fIntFlowCorrelationsAllVsMPro[23]->Fill(dMultiplicityBin,six1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4312    fIntFlowCorrelationsAllVsMPro[24]->Fill(dMultiplicityBin,six2n1n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4313    fIntFlowCorrelationsAllVsMPro[25]->Fill(dMultiplicityBin,six2n2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4314    fIntFlowCorrelationsAllVsMPro[26]->Fill(dMultiplicityBin,six3n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4315   }    
4316   // Store separetately <6>:
4317   fIntFlowCorrelationsEBE->SetBinContent(3,six1n1n1n1n1n1n); // <6>
4318   // Testing other multiplicity weights:
4319   if(fMultiplicityWeight->Contains("combinations"))
4320   {
4321    mWeight6p = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.);
4322   } else if(fMultiplicityWeight->Contains("unit"))
4323     {
4324      mWeight6p = 1.;    
4325     } else if(fMultiplicityWeight->Contains("multiplicity"))
4326       {
4327        mWeight6p = dMult;           
4328       }
4329   fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(3,mWeight6p); // eW_<6>
4330   fIntFlowCorrelationsPro->Fill(2.5,six1n1n1n1n1n1n,mWeight6p);
4331   fIntFlowSquaredCorrelationsPro->Fill(2.5,six1n1n1n1n1n1n*six1n1n1n1n1n1n,mWeight6p);
4332   if(fCalculateCumulantsVsM)
4333   {
4334    if(fFillProfilesVsMUsingWeights)  
4335    {
4336     fIntFlowCorrelationsVsMPro[2]->Fill(dMultiplicityBin,six1n1n1n1n1n1n,mWeight6p);
4337     fIntFlowSquaredCorrelationsVsMPro[2]->Fill(dMultiplicityBin,six1n1n1n1n1n1n*six1n1n1n1n1n1n,mWeight6p);
4338    } else
4339      {
4340       fIntFlowCorrelationsVsMPro[2]->Fill(dMultiplicityBin,six1n1n1n1n1n1n);
4341       fIntFlowSquaredCorrelationsVsMPro[2]->Fill(dMultiplicityBin,six1n1n1n1n1n1n*six1n1n1n1n1n1n);
4342      }
4343   } // end of if(fCalculateCumulantsVsM)
4344   if(fStoreControlHistograms)
4345   {
4346    fCorrelation2468VsMult[2]->Fill(dMultiplicityBin,six1n1n1n1n1n1n);
4347   }     
4348  } // end of if(dMult>5)
4349  
4350  // 7-particle:
4351  Double_t seven2n1n1n1n1n1n1n = 0.; // <cos(n(2*phi1+phi2+phi3-phi4-phi5-phi6-phi7))>
4352  if(dMult>6)
4353  {
4354   seven2n1n1n1n1n1n1n = (reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar-4.*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),3.)
4355                       - reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar-2.*reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar
4356                       + 9.*reQ2nQ2nQ2nstarQ1nstarQ1nstar+20.*reQ3nQ1nQ2nstarQ1nstarQ1nstar 
4357                       + 2.*reQ4nQ1nstarQ1nstarQ1nstarQ1nstar-8.*(dMult-8.)*reQ2nQ1nQ1nstarQ1nstarQ1nstar
4358                       - 18.*reQ4nQ2nstarQ1nstarQ1nstar-14.*reQ3nQ1nQ2nstarQ2nstar
4359                       + 8.*(dMult-7.)*reQ3nQ1nstarQ1nstarQ1nstar+28.*reQ4nQ3nstarQ1nstar
4360                       + 12.*reQ4nQ2nstarQ2nstar-8.*(5.*dMult-31.)*reQ3nQ2nstarQ1nstar      
4361                       + 12.*(dMult*dMult-15.*dMult+46.)*reQ2nQ1nstarQ1nstar
4362                       - 16.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4363                       - 6.*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4364                       - 3.*pow(pow(dReQ2n,2.)+pow(dImQ2n,2.),2.)
4365                       + 12.*(2.*dMult-13.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4366                       - 12.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+16.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4367                       - 12.*(dMult-8.)*(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4368                       + 12.*(3.*dMult-14.)*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.)
4369                       - 24.*(3.*dMult-7.)*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4370                       + 24.*dMult*(dMult-5.)*(dMult-6.))
4371                       / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.));   
4372   // Average 7-particle correlations for single event: 
4373   fIntFlowCorrelationsAllEBE->SetBinContent(29,seven2n1n1n1n1n1n1n);       
4374   // Average 7-particle correlations for all events:                      
4375   fIntFlowCorrelationsAllPro->Fill(28.5,seven2n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
4376                                                                  *(dMult-4.)*(dMult-5.)*(dMult-6.));
4377   // Average 7-particle correlations vs M for all events:                
4378   if(fCalculateAllCorrelationsVsM)
4379   {
4380    fIntFlowCorrelationsAllVsMPro[28]->Fill(dMultiplicityBin,seven2n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
4381                                                                               *(dMult-4.)*(dMult-5.)*(dMult-6.));
4382   }    
4383  } // end of if(dMult>6)
4384  
4385  // 8-particle:
4386  Double_t eight1n1n1n1n1n1n1n1n = 0.; // <cos(n(phi1+phi2+phi3+phi4-phi5-phi6-phi7-phi8))>
4387  Double_t mWeight8p = 0.; // multiplicity weight for 8-p correlations
4388  if(dMult>7)
4389  {  
4390   eight1n1n1n1n1n1n1n1n = (pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),4.)-12.*reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar
4391                         + 16.*reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar+6.*reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar
4392                         - 12.*reQ4nQ1nstarQ1nstarQ1nstarQ1nstar-36.*reQ2nQ2nQ2nstarQ1nstarQ1nstar
4393                         - 96.*reQ3nQ1nQ2nstarQ1nstarQ1nstar
4394                         + 72.*reQ4nQ2nstarQ1nstarQ1nstar+48.*reQ3nQ1nQ2nstarQ2nstar
4395                         - 64.*(dMult-6.)*reQ3nQ1nstarQ1nstarQ1nstar
4396                         + 96.*(dMult-6.)*reQ2nQ1nQ1nstarQ1nstarQ1nstar
4397                         - 96.*reQ4nQ3nstarQ1nstar-36.*reQ4nQ2nstarQ2nstar
4398                         + 192.*(dMult-6.)*reQ3nQ2nstarQ1nstar
4399                         - 144.*(dMult-7.)*(dMult-4.)*reQ2nQ1nstarQ1nstar
4400                         + 64.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4401                         - 144.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4402                         + 72.*(dMult-7.)*(dMult-4.)*(pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
4403                         - 96.*(dMult-7.)*(dMult-6.)*(dMult-2.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4404                         + 36.*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4405                         + 9.*pow(pow(dReQ2n,2.)+pow(dImQ2n,2.),2.)
4406                         - 64.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4407                         + 36.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4408                         - 16.*(dMult-6.)*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),3.)
4409                         + 24.*dMult*(dMult-7.)*(dMult-6.)*(dMult-5.))
4410                         / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));   
4411   // Average 8-particle correlations for single event: 
4412   fIntFlowCorrelationsAllEBE->SetBinContent(31,eight1n1n1n1n1n1n1n1n);      
4413   // Average 8-particle correlations for all events:                       
4414   fIntFlowCorrelationsAllPro->Fill(30.5,eight1n1n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
4415                                                                    *(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));
4416   // Average 8-particle correlations vs M for all events:                
4417   if(fCalculateAllCorrelationsVsM)
4418   {
4419    fIntFlowCorrelationsAllVsMPro[30]->Fill(dMultiplicityBin,eight1n1n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
4420                                                                                 *(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));
4421   }     
4422   // Store separetately <8>:
4423   fIntFlowCorrelationsEBE->SetBinContent(4,eight1n1n1n1n1n1n1n1n); // <8>
4424   // Testing other multiplicity weights:
4425   if(fMultiplicityWeight->Contains("combinations"))
4426   {
4427    mWeight8p = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.);
4428   } else if(fMultiplicityWeight->Contains("unit"))
4429     {
4430      mWeight8p = 1.;    
4431     } else if(fMultiplicityWeight->Contains("multiplicity"))
4432       {
4433        mWeight8p = dMult;           
4434       }        
4435   fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(4,mWeight8p); // eW_<8>
4436   fIntFlowCorrelationsPro->Fill(3.5,eight1n1n1n1n1n1n1n1n,mWeight8p);
4437   fIntFlowSquaredCorrelationsPro->Fill(3.5,eight1n1n1n1n1n1n1n1n*eight1n1n1n1n1n1n1n1n,mWeight8p);  
4438   if(fCalculateCumulantsVsM)
4439   {
4440    if(fFillProfilesVsMUsingWeights)  
4441    {
4442     fIntFlowCorrelationsVsMPro[3]->Fill(dMultiplicityBin,eight1n1n1n1n1n1n1n1n,mWeight8p);
4443     fIntFlowSquaredCorrelationsVsMPro[3]->Fill(dMultiplicityBin,eight1n1n1n1n1n1n1n1n*eight1n1n1n1n1n1n1n1n,mWeight8p);
4444    } else
4445      {
4446       fIntFlowCorrelationsVsMPro[3]->Fill(dMultiplicityBin,eight1n1n1n1n1n1n1n1n);
4447       fIntFlowSquaredCorrelationsVsMPro[3]->Fill(dMultiplicityBin,eight1n1n1n1n1n1n1n1n*eight1n1n1n1n1n1n1n1n);
4448      } 
4449   } // end of if(fCalculateCumulantsVsM)
4450   if(fStoreControlHistograms)
4451   {
4452    fCorrelation2468VsMult[3]->Fill(dMultiplicityBin,eight1n1n1n1n1n1n1n1n);
4453   } // end of if(fStoreControlHistograms)  
4454  } // end of if(dMult>7) 
4455  
4456  // EXTRA correlations for v3{5} study:
4457  // 4-particle:
4458  Double_t four4n2n3n3n = 0.; // <cos(n(4*phi1+2*phi2-3*phi3-3*phi4))>
4459  if(dMult>3.)
4460  {
4461   four4n2n3n3n = (reQ4nQ2nQ3nstarQ3nstar-reQ6nQ4nstarQ2nstar-reQ6nQ3nstarQ3nstar
4462                - 2.*reQ4nQ3nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar
4463                + (pow(dReQ6n,2.)+pow(dImQ6n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4464                + 2.*(2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4465                + (pow(dReQ1n,2.)+pow(dImQ1n,2.))-3.*dMult))
4466                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));               
4467   fIntFlowCorrelationsAllPro->Fill(32.5,four4n2n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4468   // Average 4-particle correlations vs M for all events:                
4469   if(fCalculateAllCorrelationsVsM)
4470   {
4471    fIntFlowCorrelationsAllVsMPro[32]->Fill(dMultiplicityBin,four4n2n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4472   }    
4473  } // end of if(dMult>3.)
4474  
4475  // 5-particle:
4476  Double_t five3n3n2n2n2n = 0.; // <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-2*phi5))>                                    
4477  if(dMult>4.)
4478  {
4479   five3n3n2n2n2n = (reQ3nQ3nQ2nstarQ2nstarQ2nstar-reQ6nQ2nstarQ2nstarQ2nstar-3.*reQ4nQ2nQ3nstarQ3nstar 
4480                  - 6.*reQ3nQ1nQ2nstarQ2nstar+2.*reQ6nQ3nstarQ3nstar+3.*reQ6nQ4nstarQ2nstar
4481                  + 6.*reQ4nQ3nstarQ1nstar+6.*reQ4nQ2nstarQ2nstar
4482                  + 12.*reQ3nQ2nstarQ1nstar+6.*reQ2nQ1nstarQ1nstar
4483                  - 2.*((pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
4484                  + 3.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4485                  + 6.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
4486                  + 9.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4487                  + 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-12.*dMult))
4488                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4489   fIntFlowCorrelationsAllPro->Fill(33.5,five3n3n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4490   if(fCalculateAllCorrelationsVsM)
4491   {
4492    fIntFlowCorrelationsAllVsMPro[33]->Fill(dMultiplicityBin,five3n3n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4493   }     
4494  } // end of if(dMult>4.)
4495  
4496  // EXTRA correlations for Teaney-Yan study: 
4497  // 2-particle:
4498  Double_t two5n5n = 0.; // <cos(5n(phi1-phi2))>
4499  Double_t two6n6n = 0.; // <cos(6n(phi1-phi2))> 
4500  if(dMult>1)
4501  {
4502   two5n5n = (pow(dReQ5n,2.)+pow(dImQ5n,2.)-dMult)/(dMult*(dMult-1.)); 
4503   two6n6n = (pow(dReQ6n,2.)+pow(dImQ6n,2.)-dMult)/(dMult*(dMult-1.));        
4504   // Average 2-particle correlations for all events:      
4505   fIntFlowCorrelationsAllPro->Fill(34.5,two5n5n,dMult*(dMult-1.));
4506   fIntFlowCorrelationsAllPro->Fill(35.5,two6n6n,dMult*(dMult-1.)); 
4507   if(fCalculateAllCorrelationsVsM)
4508   {
4509    fIntFlowCorrelationsAllVsMPro[34]->Fill(dMultiplicityBin,two5n5n,dMult*(dMult-1.));
4510    fIntFlowCorrelationsAllVsMPro[35]->Fill(dMultiplicityBin,two6n6n,dMult*(dMult-1.));
4511   }       
4512  } // end of if(dMult>1)
4513  
4514  // 3-particle:
4515  Double_t three5n3n2n = 0.; // <cos(n(5*phi1-3*phi2-2*phi3)> 
4516  Double_t three5n4n1n = 0.; // <cos(n(5*phi1-4*phi2-1*phi3)> 
4517  Double_t three6n3n3n = 0.; // <cos(n(6*phi1-3*phi2-3*phi3)> 
4518  Double_t three6n4n2n = 0.; // <cos(n(6*phi1-4*phi2-2*phi3)> 
4519  Double_t three6n5n1n = 0.; // <cos(n(6*phi1-5*phi2-1*phi3)> 
4520  if(dMult>2)
4521  {
4522   three5n3n2n = (reQ5nQ3nstarQ2nstar-(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4523               - (pow(dReQ3n,2.)+pow(dImQ3n,2.))
4524               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
4525               / (dMult*(dMult-1.)*(dMult-2.));           
4526   three5n4n1n = (reQ5nQ4nstarQ1nstar-(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4527               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))
4528               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4529               / (dMult*(dMult-1.)*(dMult-2.));                          
4530   three6n3n3n = (reQ6nQ3nstarQ3nstar-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4531               - (pow(dReQ6n,2.)+pow(dImQ6n,2.))+2.*dMult)
4532               / (dMult*(dMult-1.)*(dMult-2.)); 
4533   three6n4n2n = (reQ6nQ4nstarQ2nstar-(pow(dReQ6n,2.)+pow(dImQ6n,2.))
4534               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))
4535               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
4536               / (dMult*(dMult-1.)*(dMult-2.));
4537   three6n5n1n = (reQ6nQ5nstarQ1nstar-(pow(dReQ6n,2.)+pow(dImQ6n,2.))
4538               - (pow(dReQ5n,2.)+pow(dImQ5n,2.))
4539               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4540               / (dMult*(dMult-1.)*(dMult-2.));            
4541   // Average 3-particle correlations for all events:      
4542   fIntFlowCorrelationsAllPro->Fill(36.5,three5n3n2n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(5*phi1-3*phi2-2*phi3)>> 
4543   fIntFlowCorrelationsAllPro->Fill(37.5,three5n4n1n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(5*phi1-4*phi2-1*phi3)>> 
4544   fIntFlowCorrelationsAllPro->Fill(38.5,three6n3n3n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(6*phi1-3*phi2-3*phi3)>> 
4545   fIntFlowCorrelationsAllPro->Fill(39.5,three6n4n2n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(6*phi1-4*phi2-2*phi3)>>
4546   fIntFlowCorrelationsAllPro->Fill(40.5,three6n5n1n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(6*phi1-5*phi2-1*phi3)>>
4547   if(fCalculateAllCorrelationsVsM)
4548   {
4549    fIntFlowCorrelationsAllVsMPro[36]->Fill(dMultiplicityBin,three5n3n2n,dMult*(dMult-1.)*(dMult-2.));
4550    fIntFlowCorrelationsAllVsMPro[37]->Fill(dMultiplicityBin,three5n4n1n,dMult*(dMult-1.)*(dMult-2.));
4551    fIntFlowCorrelationsAllVsMPro[38]->Fill(dMultiplicityBin,three6n3n3n,dMult*(dMult-1.)*(dMult-2.));
4552    fIntFlowCorrelationsAllVsMPro[39]->Fill(dMultiplicityBin,three6n4n2n,dMult*(dMult-1.)*(dMult-2.));
4553    fIntFlowCorrelationsAllVsMPro[40]->Fill(dMultiplicityBin,three6n5n1n,dMult*(dMult-1.)*(dMult-2.));
4554   }       
4555  } // end of if(dMult>2)
4556  
4557  // 4-particle:
4558  Double_t four6n3n2n1n = 0.; // <cos(n(6*phi1-3*phi2-2*phi3-1*phi4)>
4559  Double_t four3n2n3n2n = 0.; // <cos(n(3*phi1+2*phi2-3*phi3-2*phi4)>
4560  Double_t four4n1n3n2n = 0.; // <cos(n(4*phi1+1*phi2-3*phi3-2*phi4)> 
4561  Double_t four3n3n3n3n = 0.; // <cos(3n(phi1+phi2-phi3-phi4))> 
4562  //Double_t four4n2n3n3n = 0.; // <cos(n(4*phi1+2*phi2-3*phi3-3*phi4)> // I already have this one above
4563  Double_t four5n1n3n3n = 0.; // <cos(n(5*phi1+1*phi2-3*phi3-3*phi4)>
4564  Double_t four4n2n4n2n = 0.; // <cos(n(4*phi1+2*phi2-4*phi3-2*phi4)> 
4565  Double_t four5n1n4n2n = 0.; // <cos(n(5*phi1+1*phi2-4*phi3-2*phi4)> 
4566  Double_t four5n3n1n1n = 0.; // <cos(n(5*phi1-3*phi2-1*phi3-1*phi4)> 
4567  Double_t four5n2n2n1n = 0.; // <cos(n(5*phi1-2*phi2-2*phi3-1*phi4)>
4568  Double_t four5n1n5n1n = 0.; // <cos(n(5*phi1+1*phi2-5*phi3-1*phi4)>
4569  Double_t four6n4n1n1n = 0.; // <cos(n(6*phi1-4*phi2-1*phi3-1*phi4)>
4570  Double_t four6n2n2n2n = 0.; // <cos(n(6*phi1-2*phi2-2*phi3-2*phi4)>
4571  if(dMult>3)
4572  {
4573   four6n3n2n1n = (reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ4nstarQ2nstar-reQ6nQ3nstarQ3nstar-reQ6nQ5nstarQ1nstar
4574                - reQ5nQ3nstarQ2nstar-reQ4nQ3nstarQ1nstar-reQ3nQ2nstarQ1nstar
4575                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+pow(dReQ5n,2.)+pow(dImQ5n,2.)
4576                + pow(dReQ4n,2.)+pow(dImQ4n,2.)+3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4577                + 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
4578                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4579   four3n2n3n2n = (dQ3nQ2nQ3nstarQ2nstar-2.*reQ5nQ3nstarQ2nstar-2.*reQ3nQ2nstarQ1nstar
4580                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)               
4581                -(dMult-4.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
4582                + dMult*(dMult-6.))
4583                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));     
4584   four4n1n3n2n = (reQ4nQ1nQ3nstarQ2nstar-reQ5nQ3nstarQ2nstar-reQ5nQ4nstarQ1nstar-reQ4nQ3nstarQ1nstar
4585                - reQ4nQ2nstarQ2nstar-reQ3nQ2nstarQ1nstar-reQ2nQ1nstarQ1nstar
4586                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4587                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4588                + 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
4589                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));                             
4590   four3n3n3n3n = (2.*dMult*(dMult-3.)+pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ3n,2.)
4591                + pow(dImQ3n,2.))-2.*reQ6nQ3nstarQ3nstar+(pow(dReQ6n,2.)+pow(dImQ6n,2.)))
4592                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));   
4593   //four4n2n3n3n = ; // I already have this one above
4594   four5n1n3n3n = (reQ5nQ1nQ3nstarQ3nstar-reQ6nQ5nstarQ1nstar-reQ6nQ3nstarQ3nstar-2.*reQ5nQ3nstarQ2nstar
4595                - 2.*reQ3nQ2nstarQ1nstar+pow(dReQ6n,2.)+pow(dImQ6n,2.)+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4596                + 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4597                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)                                  
4598                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));   
4599   four4n2n4n2n = (dQ4nQ2nQ4nstarQ2nstar-2.*reQ6nQ4nstarQ2nstar-2.*reQ4nQ2nstarQ2nstar)
4600                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4601                - ((dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4602                + (dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-(pow(dReQ6n,2.)+pow(dImQ6n,2.)))
4603                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4604                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.)); 
4605   four5n1n4n2n = (reQ5nQ1nQ4nstarQ2nstar-reQ6nQ5nstarQ1nstar-reQ6nQ4nstarQ2nstar-reQ5nQ4nstarQ1nstar
4606                - reQ5nQ3nstarQ2nstar-reQ4nQ3nstarQ1nstar-reQ2nQ1nstarQ1nstar+pow(dReQ6n,2.)+pow(dImQ6n,2.)
4607                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4608                + pow(dReQ3n,2.)+pow(dImQ3n,2.)+2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4609                + 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
4610                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));     
4611   four5n3n1n1n = (reQ5nQ3nstarQ1nstarQ1nstar-2.*reQ5nQ4nstarQ1nstar-reQ5nQ3nstarQ2nstar-2.*reQ4nQ3nstarQ1nstar
4612                - reQ2nQ1nstarQ1nstar+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4613                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+pow(dReQ2n,2.)+pow(dImQ2n,2.)
4614                + 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
4615                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));                    
4616   four5n2n2n1n = (reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ4nstarQ1nstar-2.*reQ5nQ3nstarQ2nstar-reQ4nQ2nstarQ2nstar
4617                - 2.*reQ3nQ2nstarQ1nstar+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+pow(dReQ4n,2.)+pow(dImQ4n,2.)
4618                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4619                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
4620                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));   
4621   four5n1n5n1n = (dQ5nQ1nQ5nstarQ1nstar-2.*reQ6nQ5nstarQ1nstar-2.*reQ5nQ4nstarQ1nstar
4622                + pow(dReQ6n,2.)+pow(dImQ6n,2.)-(dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4623                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+dMult*(dMult-6.))  
4624                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));    
4625                               
4626   // TBI: Recursive formula needed:
4627   four6n4n1n1n = (reQ6nQ4nstarQ1nstarQ1nstar
4628                - dMult*(dMult-1.)*(dMult-2.)*(three2n1n1n+2.*three5n4n1n+2.*three6n5n1n+three6n4n2n)
4629                - dMult*(dMult-1.)*(2.*two1n1n+1.*two4n4n+1.*two6n6n+1.*two2n2n+2.*two5n5n)
4630                - 1.*dMult)
4631                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4632   
4633   four6n2n2n2n = (reQ6nQ2nstarQ2nstarQ2nstar-3.*reQ6nQ4nstarQ2nstar-3.*reQ4nQ2nstarQ2nstar
4634                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+3.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4635                + 6.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-6.*dMult)
4636                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4637   // Average 4-particle correlations for all events:      
4638   fIntFlowCorrelationsAllPro->Fill(41.5,four6n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4639   fIntFlowCorrelationsAllPro->Fill(42.5,four3n2n3n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4640   fIntFlowCorrelationsAllPro->Fill(43.5,four4n1n3n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4641   fIntFlowCorrelationsAllPro->Fill(44.5,four3n3n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4642   //fIntFlowCorrelationsAllPro->Fill(45.5,four4n2n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); // I already have this one above
4643   fIntFlowCorrelationsAllPro->Fill(46.5,four5n1n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4644   fIntFlowCorrelationsAllPro->Fill(47.5,four4n2n4n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4645   fIntFlowCorrelationsAllPro->Fill(48.5,four5n1n4n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4646   fIntFlowCorrelationsAllPro->Fill(49.5,four5n3n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4647   fIntFlowCorrelationsAllPro->Fill(50.5,four5n2n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4648   fIntFlowCorrelationsAllPro->Fill(51.5,four5n1n5n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4649   fIntFlowCorrelationsAllPro->Fill(58.5,four6n4n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4650   fIntFlowCorrelationsAllPro->Fill(59.5,four6n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4651   if(fCalculateAllCorrelationsVsM)
4652   {
4653    fIntFlowCorrelationsAllVsMPro[41]->Fill(dMultiplicityBin,four6n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4654    fIntFlowCorrelationsAllVsMPro[42]->Fill(dMultiplicityBin,four3n2n3n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4655    fIntFlowCorrelationsAllVsMPro[43]->Fill(dMultiplicityBin,four4n1n3n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4656    fIntFlowCorrelationsAllVsMPro[44]->Fill(dMultiplicityBin,four3n3n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4657    //fIntFlowCorrelationsAllVsMPro[45]->Fill(dMultiplicityBin,four4n2n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4658    fIntFlowCorrelationsAllVsMPro[46]->Fill(dMultiplicityBin,four5n1n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4659    fIntFlowCorrelationsAllVsMPro[47]->Fill(dMultiplicityBin,four4n2n4n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4660    fIntFlowCorrelationsAllVsMPro[48]->Fill(dMultiplicityBin,four5n1n4n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4661    fIntFlowCorrelationsAllVsMPro[49]->Fill(dMultiplicityBin,four5n3n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4662    fIntFlowCorrelationsAllVsMPro[50]->Fill(dMultiplicityBin,four5n2n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4663    fIntFlowCorrelationsAllVsMPro[51]->Fill(dMultiplicityBin,four5n1n5n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4664    fIntFlowCorrelationsAllVsMPro[58]->Fill(dMultiplicityBin,four6n4n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4665    fIntFlowCorrelationsAllVsMPro[59]->Fill(dMultiplicityBin,four6n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4666   }       
4667  } // end of if(dMult>3)
4668
4669  // 5-particle:
4670  Double_t five3n3n3n2n1n = 0.; // <cos(n(3*phi1+3*phi2-3*phi3-2*phi4-1*phi5)>
4671  Double_t five4n2n3n2n1n = 0.; // <cos(n(4*phi1+2*phi2-3*phi3-2*phi4-1*phi5)>
4672  Double_t five3n2n3n1n1n = 0.; // <cos(n(3*phi1+2*phi2-3*phi3-1*phi4-1*phi5)>
4673  Double_t five3n2n2n2n1n = 0.; // <cos(n(3*phi1+2*phi2-2*phi3-2*phi4-1*phi5)>
4674  Double_t five5n1n3n2n1n = 0.; // <cos(n(5*phi1+1*phi2-3*phi3-2*phi4-1*phi5)>
4675  Double_t five6n2n2n1n1n = 0.; // <cos(n(6*phi1-2*phi2-2*phi3-1*phi4-1*phi5)>
4676  Double_t five4n1n1n3n3n = 0.; // <cos(n(4*phi1+1*phi2+1*phi3-3*phi4-3*phi5)>
4677  if(dMult>4)
4678  { 
4679   five3n3n3n2n1n = (reQ3nQ3nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ5nQ1nQ3nstarQ3nstar-reQ4nQ2nQ3nstarQ3nstar
4680                  + reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+3.*reQ6nQ3nstarQ3nstar+4.*reQ5nQ3nstarQ2nstar+4.*reQ4nQ3nstarQ1nstar
4681                  - 2.*(dMult-6.)*reQ3nQ2nstarQ1nstar-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
4682                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4683                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4684                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(3.*dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4685                  - pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)+2.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4686                  + 2.*(dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
4687                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));                                  
4688   five4n2n3n2n1n = (reQ4nQ2nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar
4689                  - reQ4nQ2nQ3nstarQ3nstar-reQ4nQ1nQ3nstarQ2nstar-reQ4nQ2nstarQ1nstarQ1nstar
4690                  - reQ3nQ1nQ2nstarQ2nstar-(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4691                  + 3.*reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ6nQ3nstarQ3nstar+reQ5nQ4nstarQ1nstar
4692                  + 3.*reQ5nQ3nstarQ2nstar-(dMult-7.)*reQ4nQ3nstarQ1nstar+3.*reQ4nQ2nstarQ2nstar+7.*reQ3nQ2nstarQ1nstar
4693                  + 4.*reQ2nQ1nstarQ1nstar-(pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4694                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4695                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4696                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4697                  + 2.*(dMult-7.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+(dMult-12.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4698                  - 2.*dMult*(dMult-12.))
4699                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));   
4700   five3n2n3n1n1n = (reQ3nQ2nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-2.*reQ4nQ1nQ3nstarQ2nstar-reQ3nQ1nstarQ1nstarQ1nstar
4701                  - 2.*reQ3nQ1nQ2nstarQ2nstar+2.*reQ5nQ4nstarQ1nstar+3.*reQ5nQ3nstarQ2nstar+6.*reQ4nQ3nstarQ1nstar
4702                  + 2.*reQ4nQ2nstarQ2nstar+9.*reQ3nQ2nstarQ1nstar-(dMult-8.)*reQ2nQ1nstarQ1nstar
4703                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
4704                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
4705                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4706                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(dMult-12.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4707                  + 2.*(dMult-9.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.))
4708                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4709   five3n2n2n2n1n = (reQ3nQ2nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ4nQ1nQ3nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar
4710                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+reQ5nQ4nstarQ1nstar
4711                  + 4.*reQ5nQ3nstarQ2nstar+reQ4nQ3nstarQ1nstar+3.*reQ4nQ2nstarQ2nstar-2.*(dMult-6.)*reQ3nQ2nstarQ1nstar
4712                  + 4.*reQ2nQ1nstarQ1nstar-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4713                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4714                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4715                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)+2.*(3.*dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4716                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
4717                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
4718   five5n1n3n2n1n = (reQ5nQ1nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ3nstarQ3nstar
4719                  - reQ4nQ1nQ3nstarQ2nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar 
4720                  + 3.*reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ3nstarQ3nstar+4.*reQ5nQ4nstarQ1nstar
4721                  - (dMult-7.)*reQ5nQ3nstarQ2nstar+4.*reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar+6.*reQ3nQ2nstarQ1nstar
4722                  + 3.*reQ2nQ1nstarQ1nstar-(pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4723                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4724                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4725                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+(dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))  
4726                  - 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4727                  + (dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*(dMult-7.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4728                  - 2.*dMult*(dMult-12.))
4729                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));       
4730   // Peter Jochumzsen:
4731   five6n2n2n1n1n = (reQ6nQ2nstarQ2nstarQ1nstarQ1nstar
4732                  - 12.*pow(dReQ1n,2.)-12.*pow(dImQ1n,2.)
4733                  - 14.*pow(dReQ2n,2.)-14.*pow(dImQ2n,2.)
4734                  - 8.*pow(dReQ3n,2.)-8.*pow(dImQ3n,2.)
4735                  - 6.*pow(dReQ4n,2.)-6.*pow(dImQ4n,2.)
4736                  - 4.*pow(dReQ5n,2.)-4.*pow(dImQ5n,2.)
4737                  - 6.*pow(dReQ6n,2.)-6.*pow(dImQ6n,2.)
4738                  + 2.*reQ2nQ1nstarQ1nstar + 8.*reQ3nQ2nstarQ1nstar
4739                  + 5.*reQ6nQ4nstarQ2nstar - reQ6nQ4nstarQ1nstarQ1nstar
4740                  + 2.*reQ6nQ3nstarQ3nstar - reQ6nQ2nstarQ2nstarQ2nstar 
4741                  + 4.*reQ4nQ2nstarQ2nstar - 2.*reQ4nQ2nstarQ1nstarQ1nstar 
4742                  + 2.*reQ5nQ4nstarQ1nstar - 2.*reQ5nQ2nstarQ2nstarQ1nstar 
4743                  + 4.*reQ4nQ3nstarQ1nstar + 4.*reQ5nQ3nstarQ2nstar
4744                  + 4.*reQ6nQ5nstarQ1nstar - 4.*reQ6nQ3nstarQ2nstarQ1nstar + 24.*dMult)
4745                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));  
4746   // Peter Jochumzsen:
4747   five4n1n1n3n3n = (reQ4nQ1nQ1nQ3nstarQ3nstar-16.*pow(dReQ1n,2.)-16.*pow(dImQ1n,2.)
4748                  - 10.*pow(dReQ2n,2.)-10.*pow(dImQ2n,2.)-12.*pow(dReQ3n,2.)-12.*pow(dImQ3n,2.)
4749                  - 6.*pow(dReQ4n,2.)-6.*pow(dImQ4n,2.)-4.*pow(dReQ5n,2.)-4.*pow(dImQ5n,2.)
4750                  - 2.*pow(dReQ6n,2.)-2.*pow(dImQ6n,2.)+6.*reQ2nQ1nstarQ1nstar 
4751                  - 1.*reQ6nQ4nstarQ1nstarQ1nstar-1.*reQ4nQ2nQ3nstarQ3nstar 
4752                  + 1.*reQ6nQ4nstarQ2nstar-2.*reQ5nQ1nQ3nstarQ3nstar 
4753                  + 2.*reQ4nQ2nstarQ2nstar+4.*reQ4nQ3nstarQ1nstar 
4754                  - 2.*reQ3nQ1nstarQ1nstarQ1nstar+10.*reQ3nQ2nstarQ1nstar 
4755                  + 2.*reQ6nQ5nstarQ1nstar+2.*reQ6nQ3nstarQ3nstar 
4756                  - 4.*reQ4nQ1nQ3nstarQ2nstar+4.*reQ5nQ4nstarQ1nstar
4757                  + 4.*reQ5nQ3nstarQ2nstar + 24.*dMult)
4758                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4759   // Average 5-particle correlations for all events:      
4760   fIntFlowCorrelationsAllPro->Fill(52.5,five3n3n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4761   fIntFlowCorrelationsAllPro->Fill(53.5,five4n2n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4762   fIntFlowCorrelationsAllPro->Fill(54.5,five3n2n3n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4763   fIntFlowCorrelationsAllPro->Fill(55.5,five3n2n2n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4764   fIntFlowCorrelationsAllPro->Fill(56.5,five5n1n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4765   fIntFlowCorrelationsAllPro->Fill(60.5,five6n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4766   fIntFlowCorrelationsAllPro->Fill(61.5,five4n1n1n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4767   if(fCalculateAllCorrelationsVsM)
4768   {
4769    fIntFlowCorrelationsAllVsMPro[52]->Fill(dMultiplicityBin,five3n3n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4770    fIntFlowCorrelationsAllVsMPro[53]->Fill(dMultiplicityBin,five4n2n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4771    fIntFlowCorrelationsAllVsMPro[54]->Fill(dMultiplicityBin,five3n2n3n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4772    fIntFlowCorrelationsAllVsMPro[55]->Fill(dMultiplicityBin,five3n2n2n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4773    fIntFlowCorrelationsAllVsMPro[56]->Fill(dMultiplicityBin,five5n1n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4774    fIntFlowCorrelationsAllVsMPro[60]->Fill(dMultiplicityBin,five6n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4775    fIntFlowCorrelationsAllVsMPro[61]->Fill(dMultiplicityBin,five4n1n1n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4776   }         
4777  } // end of if(dMult>4)
4778
4779  // 6-particle:
4780  Double_t six3n2n1n3n2n1n = 0.; // <cos(n(3*phi1+2*phi2+1*phi3-3*phi4-2*phi5-1*phi6)>
4781  Double_t six3n3n2n2n1n1n = 0.; // <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-1*phi5-1*phi6)>   
4782  if(dMult>5.)
4783  { 
4784   six3n2n1n3n2n1n = (dQ3nQ2nQ1nQ3nstarQ2nstarQ1nstar-2.*reQ3nQ3nQ3nstarQ2nstarQ1nstar
4785                   - 2.*reQ3nQ2nQ2nstarQ2nstarQ1nstar-2.*reQ3nQ1nQ2nstarQ1nstarQ1nstar
4786                   - 2.*reQ3nQ2nQ3nstarQ1nstarQ1nstar-2.*reQ4nQ2nQ3nstarQ2nstarQ1nstar
4787                   - 2.*reQ5nQ1nQ3nstarQ2nstarQ1nstar+4.*reQ6nQ3nstarQ2nstarQ1nstar
4788                   + 2.*reQ5nQ1nQ4nstarQ2nstar+2.*reQ5nQ1nQ3nstarQ3nstar
4789                   + 2.*reQ4nQ2nQ3nstarQ3nstar+6.*reQ4nQ1nQ3nstarQ2nstar
4790                   + 2.*reQ5nQ3nstarQ1nstarQ1nstar+2.*reQ5nQ2nstarQ2nstarQ1nstar
4791                   + 6.*reQ3nQ1nQ2nstarQ2nstar+2.*reQ4nQ2nstarQ1nstarQ1nstar
4792                   - 4.*reQ6nQ5nstarQ1nstar-4.*reQ6nQ4nstarQ2nstar-6.*reQ5nQ4nstarQ1nstar
4793                   - 4.*reQ6nQ3nstarQ3nstar+2.*(dMult-11.)*reQ5nQ3nstarQ2nstar
4794                   + 2.*(dMult-13.)*reQ4nQ3nstarQ1nstar-8.*reQ4nQ2nstarQ2nstar
4795                   + 2.*(5.*dMult-32.)*reQ3nQ2nstarQ1nstar+2.*reQ3nQ1nstarQ1nstarQ1nstar
4796                   + 2.*(dMult-13.)*reQ2nQ1nstarQ1nstar
4797                   - (dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4798                   + (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4799                   + (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4800                   - (dMult-11.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4801                   - (dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4802                   + 4.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-(dMult-12.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4803                   - (dMult-16.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)
4804                   + (dMult*dMult-19.*dMult+68.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4805                   + (dMult*dMult-19.*dMult+72.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4806                   + pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)+pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
4807                   + (dMult*dMult-20.*dMult+80.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4808                   - dMult*(dMult-12.)*(dMult-10.))
4809                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));   
4810   
4811   // Peter Jochumzsen:
4812   six3n3n2n2n1n1n = (reQ3nQ3nQ2nstarQ2nstarQ1nstarQ1nstar
4813                   + (80.-16.*dMult)*pow(dReQ1n,2.)+(80.-16.*dMult)*pow(dImQ1n,2.)
4814                   + (78.-16.*dMult)*pow(dReQ2n,2.)+(78.-16.*dMult)*pow(dImQ2n,2.)
4815                   + (72.-16.*dMult)*pow(dReQ3n,2.)+(72.-16.*dMult)*pow(dImQ3n,2.)
4816                   + 14.*pow(dReQ4n,2.)+14.*pow(dImQ4n,2.)
4817                   + 8.*pow(dReQ5n,2.)+8.*pow(dImQ5n,2.)
4818                   + 6.*pow(dReQ6n,2.)+6.*pow(dImQ6n,2.)
4819                   + 1.*reQ6nQ2nstarQ2nstarQ2nstar - 1.*reQ6nQ2nstarQ2nstarQ1nstarQ1nstar
4820                   - 76.*reQ3nQ2nstarQ1nstar + 4.*reQ3nQ1nstarQ1nstarQ1nstar
4821                   - 8.*reQ3nQ2nstarQ1nstar + 8.*dQ2nQ1nQ2nstarQ1nstar
4822                   + 4.*reQ5nQ2nstarQ2nstarQ1nstar - 2.*reQ6nQ3nstarQ3nstar
4823                   + 4.*reQ6nQ3nstarQ2nstarQ1nstar - 4.*reQ5nQ4nstarQ1nstar
4824                   + 16.*dMult*reQ3nQ2nstarQ1nstar - 2.*reQ4nQ2nstarQ2nstar
4825                   - 4.*reQ3nQ3nQ3nstarQ2nstarQ1nstar -8.*reQ4nQ3nstarQ1nstar
4826                   - 10.*reQ4nQ2nstarQ2nstar + 4.*reQ4nQ2nstarQ1nstarQ1nstar
4827                   - 12.*reQ4nQ3nstarQ1nstar + 8.*dQ3nQ1nQ3nstarQ1nstar
4828                   + 8.*reQ3nQ1nQ2nstarQ2nstar - 4.*reQ3nQ1nQ2nstarQ1nstarQ1nstar
4829                   + 5.*reQ4nQ2nQ3nstarQ3nstar+2.*pow(pow(dReQ2n,2.)+pow(dImQ2n,2.),2.)
4830                   + 4.*reQ5nQ1nQ3nstarQ3nstar+2.*pow(pow(dReQ3n,2.)+pow(dImQ3n,2.),2.)
4831                   - 6.*reQ6nQ3nstarQ3nstar - 14.*reQ2nQ1nstarQ1nstar
4832                   - 1.*reQ3nQ3nQ2nstarQ2nstarQ2nstar-4.*reQ3nQ2nQ2nstarQ2nstarQ1nstar
4833                   - 1.*reQ4nQ1nQ1nQ3nstarQ3nstar-8.*reQ5nQ3nstarQ2nstar
4834                   + 2.*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.) - 10.*reQ2nQ1nstarQ1nstar
4835                   - 4.*reQ6nQ5nstarQ1nstar-5.*reQ6nQ4nstarQ2nstar
4836                   + 1.*reQ6nQ4nstarQ1nstarQ1nstar-8.*reQ5nQ3nstarQ2nstar
4837                   + 4.*reQ4nQ1nQ3nstarQ2nstar+8.*dQ3nQ2nQ3nstarQ2nstar
4838                   - 120.*dMult + 16.*dMult*dMult)
4839                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4840
4841   // Average 6-particle correlations for all events:      
4842   fIntFlowCorrelationsAllPro->Fill(57.5,six3n2n1n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4843   fIntFlowCorrelationsAllPro->Fill(62.5,six3n3n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4844   if(fCalculateAllCorrelationsVsM)
4845   {
4846    fIntFlowCorrelationsAllVsMPro[57]->Fill(dMultiplicityBin,six3n2n1n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4847    fIntFlowCorrelationsAllVsMPro[62]->Fill(dMultiplicityBin,six3n3n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4848   }          
4849  } // end of if(dMult>5.)
4850  
4851  // |Qn|^2/M, |Q2n|^2/M, |Qn|^4/(M(2M-1)), Re[Q2nQn^*Qn^*]/M, ... vs multiplicity (#RPs, #POIs or external):
4852  if(fUseQvectorTerms)
4853  {
4854   Double_t dM = dMultiplicityBin-0.5;
4855   if(dM>1.) // TBI re-think this if statement 
4856   {
4857    fQvectorTermsVsMult[0]->Fill(dMultiplicityBin,(pow(dReQ1n,2.)+pow(dImQ1n,2.))/dM);
4858    fQvectorTermsVsMult[1]->Fill(dMultiplicityBin,(pow(dReQ2n,2.)+pow(dImQ2n,2.))/dM);
4859    fQvectorTermsVsMult[2]->Fill(dMultiplicityBin,(pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.))/(dM*(2.*dM-1.)));
4860    fQvectorTermsVsMult[3]->Fill(dMultiplicityBin,reQ2nQ1nstarQ1nstar/pow(dM,1.5)); // TBI a bit of heuristic inserted here, re-think the rescaling factor 
4861   } // end of if(dM>1.) // TBI re-think this if statement 
4862  } // end of if(fUseQvectorTerms)
4863
4864  // Bootstrap:
4865  if(fUseBootstrap||fUseBootstrapVsM)
4866  {
4867   Double_t nSampleNo = 1.*fRandom->Integer(fnSubsamples) + 0.5;
4868   if(fUseBootstrap)
4869   {
4870    fBootstrapCorrelations->Fill(0.5,nSampleNo,two1n1n,mWeight2p); 
4871    fBootstrapCorrelations->Fill(1.5,nSampleNo,four1n1n1n1n,mWeight4p);
4872    fBootstrapCorrelations->Fill(2.5,nSampleNo,six1n1n1n1n1n1n,mWeight6p); 
4873    fBootstrapCorrelations->Fill(3.5,nSampleNo,eight1n1n1n1n1n1n1n1n,mWeight8p); 
4874   } // end of if(fUseBootstrap)
4875   if(fUseBootstrapVsM)
4876   {
4877    fBootstrapCorrelationsVsM[0]->Fill(dMultiplicityBin,nSampleNo,two1n1n,mWeight2p); 
4878    fBootstrapCorrelationsVsM[1]->Fill(dMultiplicityBin,nSampleNo,four1n1n1n1n,mWeight4p); 
4879    fBootstrapCorrelationsVsM[2]->Fill(dMultiplicityBin,nSampleNo,six1n1n1n1n1n1n,mWeight6p); 
4880    fBootstrapCorrelationsVsM[3]->Fill(dMultiplicityBin,nSampleNo,eight1n1n1n1n1n1n1n1n,mWeight8p); 
4881   } // end of if(fUseBootstrapVsM) 
4882  } // end of if(fUseBootstrap||fUseBootstrapVsM)
4883
4884  return;
4885
4886 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelations()
4887
4888 //=====================================================================================================
4889
4890 void AliFlowAnalysisWithQCumulants::CalculateMixedHarmonics()
4891 {
4892  // Calculate in this method all multi-particle azimuthal correlations in mixed harmonics.
4893  // (Remark: For completeness sake, we also calculate here again correlations in the same harmonic.) 
4894
4895  // a) Access Q-vectors and multiplicity of current event; 
4896  // b) Determine multiplicity weights and fill some histos;
4897  // c) Calculate 2-p correlations; 
4898  // d) Calculate 3-p correlations; 
4899  // e) Calculate 4-p correlations; 
4900  // f) Calculate 5-p correlations; 
4901  // g) Calculate 6-p correlations; 
4902  // h) Calculate 7-p correlations; 
4903  // i) Calculate 8-p correlations.
4904
4905  // a) Access Q-vectors and multiplicity of current event:
4906  // Multiplicity of an event: 
4907  Double_t dMult = (*fSpk)(0,0);
4908  // Real parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n, 4n, 5n and 6n: 
4909  Double_t dReQ1n = (*fReQ)(0,0);
4910  Double_t dReQ2n = (*fReQ)(1,0);
4911  Double_t dReQ3n = (*fReQ)(2,0);
4912  Double_t dReQ4n = (*fReQ)(3,0);
4913  Double_t dReQ5n = (*fReQ)(4,0); 
4914  Double_t dReQ6n = (*fReQ)(5,0);
4915  Double_t dReQ7n = (*fReQ)(6,0);
4916  Double_t dReQ8n = (*fReQ)(7,0);
4917  Double_t dReQ9n = (*fReQ)(8,0);
4918  Double_t dReQ10n = (*fReQ)(9,0);
4919  Double_t dReQ11n = (*fReQ)(10,0);
4920  Double_t dReQ12n = (*fReQ)(11,0);
4921  // Imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n, 4n, 5n and 6n:
4922  Double_t dImQ1n = (*fImQ)(0,0);
4923  Double_t dImQ2n = (*fImQ)(1,0);
4924  Double_t dImQ3n = (*fImQ)(2,0);
4925  Double_t dImQ4n = (*fImQ)(3,0);
4926  Double_t dImQ5n = (*fImQ)(4,0); 
4927  Double_t dImQ6n = (*fImQ)(5,0);
4928  Double_t dImQ7n = (*fImQ)(6,0);
4929  Double_t dImQ8n = (*fImQ)(7,0);
4930  Double_t dImQ9n = (*fImQ)(8,0);
4931  Double_t dImQ10n = (*fImQ)(9,0);
4932  Double_t dImQ11n = (*fImQ)(10,0);
4933  Double_t dImQ12n = (*fImQ)(11,0);
4934  // All mixed correlators:
4935  Double_t allMixedCorrelators[139] = {0.};
4936
4937  // Real parts of expressions involving various combinations of Q-vectors which appears
4938  // simultaneously in several equations for multiparticle correlations bellow: 
4939  // Re[Q_{2n}Q_{n}^*Q_{n}^*]
4940  Double_t reQ2nQ1nstarQ1nstar = pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n; 
4941  // Re[Q_{6n}Q_{3n}^*Q_{3n}^*]
4942  Double_t reQ6nQ3nstarQ3nstar = pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n;  
4943  // Re[Q_{4n}Q_{2n}^*Q_{2n}^*]
4944  Double_t reQ4nQ2nstarQ2nstar = pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n;
4945  // Re[Q_{4n}Q_{3n}^*Q_{n}^*]
4946  Double_t reQ4nQ3nstarQ1nstar = dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);
4947  // Re[Q_{3n}Q_{2n}^*Q_{n}^*]
4948  Double_t reQ3nQ2nstarQ1nstar = dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
4949                               + dImQ3n*dImQ2n*dReQ1n; 
4950  // Re[Q_{5n}Q_{3n}^*Q_{2n}^*]
4951  Double_t reQ5nQ3nstarQ2nstar = dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n
4952                               + dImQ5n*dImQ2n*dReQ3n;                             
4953  // Re[Q_{5n}Q_{4n}^*Q_{1n}^*]
4954  Double_t reQ5nQ4nstarQ1nstar = dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n
4955                               + dImQ5n*dImQ4n*dReQ1n;                              
4956  // Re[Q_{6n}Q_{5n}^*Q_{1n}^*]                              
4957  Double_t reQ6nQ5nstarQ1nstar = dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n
4958                               + dImQ6n*dImQ5n*dReQ1n;
4959  // Re[Q_{6n}Q_{4n}^*Q_{2n}^*]                       
4960  Double_t reQ6nQ4nstarQ2nstar = dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
4961                               + dImQ6n*dImQ4n*dReQ2n;
4962  // Re[Q_{3n}Q_{n}Q_{2n}^*Q_{2n}^*]
4963  Double_t reQ3nQ1nQ2nstarQ2nstar = (pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
4964                                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);                                
4965  // Re[Q_{3n}Q_{n}^*Q_{n}^*Q_{n}^*]
4966  Double_t reQ3nQ1nstarQ1nstarQ1nstar = dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
4967                                      + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3);
4968  // Re[Q_{6n}Q_{2n}^*Q_{2n}^*Q_{2n}^*]
4969  Double_t reQ6nQ2nstarQ2nstarQ2nstar = dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
4970                                      + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3);
4971  // Re[Q_{4n}Q_{2n}^*Q_{n}^*Q_{n}^*]
4972  Double_t reQ4nQ2nstarQ1nstarQ1nstar = (dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
4973                                      + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n);  
4974  // Re[Q_{4n}Q_{2n}^*Q_{3n}^*Q_{3n}^*]
4975  Double_t reQ4nQ2nQ3nstarQ3nstar = (dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
4976                                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n;                    
4977  // Re[Q_{4n}Q_{n}Q_{3n}^*Q_{2n}^*]
4978  Double_t reQ4nQ1nQ3nstarQ2nstar = dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
4979                                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
4980                                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
4981                                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n;
4982
4983  // Re[Q_{5n}Q_{n}Q_{4n}^*Q_{2n}^*]
4984  Double_t reQ5nQ1nQ4nstarQ2nstar = dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
4985                                  + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
4986                                  - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n 
4987                                  + dImQ1n*dImQ2n*dReQ4n*dReQ5n+dReQ1n*dReQ2n*dReQ4n*dReQ5n;                                  
4988  // Re[Q_{5n}Q_{n}Q_{3n}^*Q_{3n}^*]                                  
4989  Double_t reQ5nQ1nQ3nstarQ3nstar = dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
4990                                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
4991                                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n;
4992  // Re[Q_{5n}Q_{3n}^*Q_{n}^*Q_{n}^*]                                  
4993  Double_t reQ5nQ3nstarQ1nstarQ1nstar = -pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
4994                                      + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
4995                                      - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n;                     
4996  // Re[Q_{5n}Q_{2n}^*Q_{2n}^*Q_{n}^*]                                  
4997  Double_t reQ5nQ2nstarQ2nstarQ1nstar = -pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
4998                                      + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
4999                                      - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n;                                     
5000  // Re[Q_{6n}Q_{4n}^*Q_{n}^*Q_{n}^*]                                  
5001  Double_t reQ6nQ4nstarQ1nstarQ1nstar = -pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
5002                                      +  2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
5003                                      -  pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n;
5004  /*// |Q_{2n}|^2 |Q_{n}|^2
5005  Double_t dQ2nQ1nQ2nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
5006  // |Q_{4n}|^2 |Q_{2n}|^2
5007  Double_t dQ4nQ2nQ4nstarQ2nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.));
5008  // |Q_{3n}|^2 |Q_{2n}|^2
5009  Double_t dQ3nQ2nQ3nstarQ2nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.));
5010  // |Q_{5n}|^2 |Q_{n}|^2
5011  Double_t dQ5nQ1nQ5nstarQ1nstar = (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
5012  // |Q_{3n}|^2 |Q_{n}|^2
5013  Double_t dQ3nQ1nQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));*/
5014  // Re[Q_{2n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*]
5015  /*Double_t reQ2nQ1nQ1nstarQ1nstarQ1nstar = (dReQ2n*dReQ1n-dImQ2n*dImQ1n)*(pow(dReQ1n,3)-3.*dReQ1n*pow(dImQ1n,2))
5016                                         + (dReQ2n*dImQ1n+dReQ1n*dImQ2n)*(3.*dImQ1n*pow(dReQ1n,2)-pow(dImQ1n,3));*/ 
5017  // Re[Q_{2n}Q_{2n}Q_{2n}^*Q_{n}^*Q_{n}^*]
5018  /*Double_t reQ2nQ2nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
5019                                         * (dReQ2n*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) + 2.*dImQ2n*dReQ1n*dImQ1n);*/
5020  /*// Re[Q_{4n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
5021  Double_t reQ4nQ1nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,4.)*dReQ4n-6.*pow(dReQ1n,2.)*dReQ4n*pow(dImQ1n,2.)
5022                                             + pow(dImQ1n,4.)*dReQ4n+4.*pow(dReQ1n,3.)*dImQ1n*dImQ4n
5023                                             - 4.*pow(dImQ1n,3.)*dReQ1n*dImQ4n;*/
5024  // Re[Q_{3n}Q_{n}Q_{2n}^*Q_{n}^*Q_{n}^*]
5025  /*Double_t reQ3nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
5026                                         * (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n
5027                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n);*/
5028  // Re[Q_{6n}Q_{n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
5029  Double_t reQ6nQ3nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
5030                                      - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
5031                                      + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
5032                                      + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n;
5033  // Re[Q_{3n}Q_{3n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
5034  /*Double_t reQ3nQ3nQ3nstarQ2nstarQ1nstar = (pow(dImQ3n,2.)+pow(dReQ3n,2.))
5035                                         * (dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n
5036                                         - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n);*/   
5037  /*// Re[Q_{3n}Q_{3n}Q_{2n}^*Q_{2n}^*Q_{2n}^*]
5038  Double_t reQ3nQ3nQ2nstarQ2nstarQ2nstar = pow(dReQ2n,3.)*pow(dReQ3n,2.) 
5039                                         - 3.*dReQ2n*pow(dReQ3n,2.)*pow(dImQ2n,2.)
5040                                         + 6.*pow(dReQ2n,2.)*dReQ3n*dImQ2n*dImQ3n 
5041                                         - 2.*dReQ3n*pow(dImQ2n,3.)*dImQ3n-pow(dReQ2n,3.)*pow(dImQ3n,2.) 
5042                                         + 3.*dReQ2n*pow(dImQ2n,2.)*pow(dImQ3n,2.);*/
5043  // Re[Q_{4n}Q_{2n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
5044  /*Double_t reQ4nQ2nQ3nstarQ2nstarQ1nstar = (pow(dImQ2n,2.)+pow(dReQ2n,2.))
5045                                         * (dImQ3n*dImQ4n*dReQ1n+dImQ1n*dImQ4n*dReQ3n 
5046                                         - dImQ1n*dImQ3n*dReQ4n+dReQ1n*dReQ3n*dReQ4n);*/
5047  // Re[Q_{3n}Q_{2n}Q_{3n}^*Q_{n}^*Q_{n}^*]
5048  /*Double_t reQ3nQ2nQ3nstarQ1nstarQ1nstar = -(pow(dImQ3n,2.)+pow(dReQ3n,2.))
5049                                         * (-2.*dImQ1n*dImQ2n*dReQ1n+pow(dImQ1n,2.)*dReQ2n-pow(dReQ1n,2.)*dReQ2n);*/                              
5050  // Re[Q_{3n}Q_{2n}Q_{2n}^*Q_{2n}^*Q_{n}^*]
5051  /*Double_t reQ3nQ2nQ2nstarQ2nstarQ1nstar = (pow(dImQ2n,2.)+pow(dReQ2n,2.))
5052                                         * (dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n 
5053                                         - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n);*/
5054 /* // Re[Q_{5n}Q_{n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
5055  Double_t reQ5nQ1nQ3nstarQ2nstarQ1nstar = (pow(dImQ1n,2.)+pow(dReQ1n,2.))
5056                                         * (dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n 
5057                                         - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n);   
5058  */
5059  /*
5060  // Re[Q_{2n}Q_{2n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
5061  Double_t reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)*dReQ2n-2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)
5062                                                + dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dImQ2n)
5063                                                * (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)
5064                                                - dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n+pow(dImQ1n,2.)*dImQ2n); 
5065  // Re[Q_{3n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
5066  Double_t reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
5067                                                * (pow(dReQ1n,3.)*dReQ3n-3.*dReQ1n*dReQ3n*pow(dImQ1n,2.)
5068                                                + 3.*pow(dReQ1n,2.)*dImQ1n*dImQ3n-pow(dImQ1n,3.)*dImQ3n);
5069  */
5070  // |Q_{2n}|^2 |Q_{n}|^4
5071  //Double_t dQ2nQ1nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.); 
5072  /*
5073  // |Q_{3n}|^2 |Q_{2n}|^2 |Q_{n}|^2
5074  Double_t dQ3nQ2nQ1nQ3nstarQ2nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5075                                           * (pow(dReQ1n,2.)+pow(dImQ1n,2.));
5076  // Re[Q_{2n}Q_{n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
5077  Double_t reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
5078                                                   * (pow(dReQ1n,2.)*dReQ2n-dReQ2n*pow(dImQ1n,2.)
5079                                                   + 2.*dReQ1n*dImQ1n*dImQ2n);                                                  
5080  */
5081  // Re[Q_{6n}Q_{2n}^*Q_{2n}^*Q_{n}^*Q_{n}^*]
5082  /*Double_t reQ6nQ2nstarQ2nstarQ1nstarQ1nstar = pow(dReQ1n*dReQ2n,2.)*dReQ6n-pow(dReQ2n*dImQ1n,2.)*dReQ6n
5083                                             - 4.*dReQ1n*dReQ2n*dReQ6n*dImQ1n*dImQ2n 
5084                                             - pow(dReQ1n*dImQ2n,2.)*dReQ6n+pow(dImQ1n*dImQ2n,2.)*dReQ6n
5085                                             + 2.*dReQ1n*pow(dReQ2n,2.)*dImQ1n*dImQ6n
5086                                             + 2.*pow(dReQ1n,2.)*dReQ2n*dImQ2n*dImQ6n 
5087                                             - 2.*dReQ2n*pow(dImQ1n,2.)*dImQ2n*dImQ6n 
5088                                             - 2.*dReQ1n*dImQ1n*pow(dImQ2n,2.)*dImQ6n;
5089  */                                                                                      
5090  // Re[Q_{4n}Q_{1n}Q_{1n}Q_{3n}^*Q_{3n}^*]
5091  /*
5092  Double_t reQ4nQ1nQ1nQ3nstarQ3nstar = pow(dReQ1n*dReQ3n,2.)*dReQ4n-pow(dReQ3n*dImQ1n,2.)*dReQ4n  
5093                                     + 4.*dReQ1n*dReQ3n*dReQ4n*dImQ1n*dImQ3n 
5094                                     - pow(dReQ1n*dImQ3n,2.)*dReQ4n+pow(dImQ1n*dImQ3n,2.)*dReQ4n  
5095                                     - 2.*dReQ1n*pow(dReQ3n,2.)*dImQ1n*dImQ4n 
5096                                     + 2.*pow(dReQ1n,2.)*dReQ3n*dImQ3n*dImQ4n 
5097                                     - 2.*dReQ3n*pow(dImQ1n,2.)*dImQ3n*dImQ4n 
5098                                     + 2.*dReQ1n*dImQ1n*pow(dImQ3n,2.)*dImQ4n;*/
5099  /* 
5100  // Re[Q_{3n}Q_{3n}Q_{2n}^*Q_{2n}^*Q_{1n}^*Q_{1n}^*]
5101  Double_t reQ3nQ3nQ2nstarQ2nstarQ1nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ2n*dReQ3n*dImQ1n-dReQ1n*dReQ3n*dImQ2n 
5102                                                - dReQ3n*dImQ1n*dImQ2n+dReQ1n*dReQ2n*dImQ3n+dReQ2n*dImQ1n*dImQ3n 
5103                                                + dReQ1n*dImQ2n*dImQ3n-dImQ1n*dImQ2n*dImQ3n)*(dReQ1n*dReQ2n*dReQ3n 
5104                                                + dReQ2n*dReQ3n*dImQ1n+dReQ1n*dReQ3n*dImQ2n-dReQ3n*dImQ1n*dImQ2n 
5105                                                - dReQ1n*dReQ2n*dImQ3n+dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n 
5106                                                + dImQ1n*dImQ2n*dImQ3n);
5107  */
5108
5109  // b) Determine multiplicity weights and fill some histos:
5110  Double_t d2pMultiplicityWeight = 0.; // weight for <2>_{...} to get <<2>>_{...}
5111  Double_t d3pMultiplicityWeight = 0.; // weight for <3>_{...} to get <<3>>_{...}
5112  Double_t d4pMultiplicityWeight = 0.; // weight for <4>_{...} to get <<4>>_{...}
5113  Double_t d5pMultiplicityWeight = 0.; // weight for <5>_{...} to get <<5>>_{...}
5114  Double_t d6pMultiplicityWeight = 0.; // weight for <6>_{...} to get <<6>>_{...}
5115  Double_t d7pMultiplicityWeight = 0.; // weight for <7>_{...} to get <<7>>_{...}
5116  Double_t d8pMultiplicityWeight = 0.; // weight for <8>_{...} to get <<8>>_{...}
5117  if(fMultiplicityWeight->Contains("combinations")) // default multiplicity weight
5118  {
5119   d2pMultiplicityWeight = dMult*(dMult-1.);
5120   d3pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.);
5121   d4pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.);
5122   d5pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.);
5123   d6pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.);
5124   d7pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.);
5125   d8pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.);
5126  } else if(fMultiplicityWeight->Contains("unit"))
5127    {
5128     d2pMultiplicityWeight = 1.;
5129     d3pMultiplicityWeight = 1.;
5130     d4pMultiplicityWeight = 1.;
5131     d5pMultiplicityWeight = 1.;
5132     d6pMultiplicityWeight = 1.;
5133     d7pMultiplicityWeight = 1.;
5134     d8pMultiplicityWeight = 1.;
5135    } else if(fMultiplicityWeight->Contains("multiplicity"))
5136      {
5137       d2pMultiplicityWeight = dMult;
5138       d3pMultiplicityWeight = dMult;
5139       d4pMultiplicityWeight = dMult;
5140       d5pMultiplicityWeight = dMult;
5141       d6pMultiplicityWeight = dMult;
5142       d7pMultiplicityWeight = dMult;
5143       d8pMultiplicityWeight = dMult; 
5144      }       
5145  for(Int_t p=0;p<=1;p++) // power (0=linear,1=quadratic)
5146  {
5147   fMixedHarmonicEventWeights[p]->Fill(0.5,pow(dMult,p+1));
5148   fMixedHarmonicEventWeights[p]->Fill(1.5,pow(d2pMultiplicityWeight,p+1));
5149   fMixedHarmonicEventWeights[p]->Fill(2.5,pow(d3pMultiplicityWeight,p+1));
5150   fMixedHarmonicEventWeights[p]->Fill(3.5,pow(d4pMultiplicityWeight,p+1));
5151   fMixedHarmonicEventWeights[p]->Fill(4.5,pow(d5pMultiplicityWeight,p+1));
5152   fMixedHarmonicEventWeights[p]->Fill(5.5,pow(d6pMultiplicityWeight,p+1));
5153   fMixedHarmonicEventWeights[p]->Fill(6.5,pow(d7pMultiplicityWeight,p+1));
5154   fMixedHarmonicEventWeights[p]->Fill(7.5,pow(d8pMultiplicityWeight,p+1));
5155  } // end of for(Int_t p=0;p<=1;p++) // power (0=linear,1=quadratic)   
5156  fMixedHarmonicProductOfEventWeights->Fill(0.5,0.5,dMult*dMult);
5157  fMixedHarmonicProductOfEventWeights->Fill(0.5,1.5,dMult*d2pMultiplicityWeight);
5158  fMixedHarmonicProductOfEventWeights->Fill(0.5,2.5,dMult*d3pMultiplicityWeight);
5159  fMixedHarmonicProductOfEventWeights->Fill(0.5,3.5,dMult*d4pMultiplicityWeight);
5160  fMixedHarmonicProductOfEventWeights->Fill(0.5,4.5,dMult*d5pMultiplicityWeight);
5161  fMixedHarmonicProductOfEventWeights->Fill(0.5,5.5,dMult*d6pMultiplicityWeight);
5162  fMixedHarmonicProductOfEventWeights->Fill(0.5,6.5,dMult*d7pMultiplicityWeight);
5163  fMixedHarmonicProductOfEventWeights->Fill(0.5,7.5,dMult*d8pMultiplicityWeight);
5164  fMixedHarmonicProductOfEventWeights->Fill(1.5,1.5,d2pMultiplicityWeight*d2pMultiplicityWeight);
5165  fMixedHarmonicProductOfEventWeights->Fill(1.5,2.5,d2pMultiplicityWeight*d3pMultiplicityWeight);
5166  fMixedHarmonicProductOfEventWeights->Fill(1.5,3.5,d2pMultiplicityWeight*d4pMultiplicityWeight);
5167  fMixedHarmonicProductOfEventWeights->Fill(1.5,4.5,d2pMultiplicityWeight*d5pMultiplicityWeight);
5168  fMixedHarmonicProductOfEventWeights->Fill(1.5,5.5,d2pMultiplicityWeight*d6pMultiplicityWeight);
5169  fMixedHarmonicProductOfEventWeights->Fill(1.5,6.5,d2pMultiplicityWeight*d7pMultiplicityWeight);
5170  fMixedHarmonicProductOfEventWeights->Fill(1.5,7.5,d2pMultiplicityWeight*d8pMultiplicityWeight);
5171  fMixedHarmonicProductOfEventWeights->Fill(2.5,2.5,d3pMultiplicityWeight*d3pMultiplicityWeight);
5172  fMixedHarmonicProductOfEventWeights->Fill(2.5,3.5,d3pMultiplicityWeight*d4pMultiplicityWeight);
5173  fMixedHarmonicProductOfEventWeights->Fill(2.5,4.5,d3pMultiplicityWeight*d5pMultiplicityWeight);
5174  fMixedHarmonicProductOfEventWeights->Fill(2.5,5.5,d3pMultiplicityWeight*d6pMultiplicityWeight);
5175  fMixedHarmonicProductOfEventWeights->Fill(2.5,6.5,d3pMultiplicityWeight*d7pMultiplicityWeight);
5176  fMixedHarmonicProductOfEventWeights->Fill(2.5,7.5,d3pMultiplicityWeight*d8pMultiplicityWeight);
5177  fMixedHarmonicProductOfEventWeights->Fill(3.5,3.5,d4pMultiplicityWeight*d4pMultiplicityWeight);
5178  fMixedHarmonicProductOfEventWeights->Fill(3.5,4.5,d4pMultiplicityWeight*d5pMultiplicityWeight);
5179  fMixedHarmonicProductOfEventWeights->Fill(3.5,5.5,d4pMultiplicityWeight*d6pMultiplicityWeight);
5180  fMixedHarmonicProductOfEventWeights->Fill(3.5,6.5,d4pMultiplicityWeight*d7pMultiplicityWeight);
5181  fMixedHarmonicProductOfEventWeights->Fill(3.5,7.5,d4pMultiplicityWeight*d8pMultiplicityWeight);
5182  fMixedHarmonicProductOfEventWeights->Fill(4.5,4.5,d5pMultiplicityWeight*d5pMultiplicityWeight);
5183  fMixedHarmonicProductOfEventWeights->Fill(4.5,5.5,d5pMultiplicityWeight*d6pMultiplicityWeight);
5184  fMixedHarmonicProductOfEventWeights->Fill(4.5,6.5,d5pMultiplicityWeight*d7pMultiplicityWeight);
5185  fMixedHarmonicProductOfEventWeights->Fill(4.5,7.5,d5pMultiplicityWeight*d8pMultiplicityWeight);
5186  fMixedHarmonicProductOfEventWeights->Fill(5.5,5.5,d6pMultiplicityWeight*d6pMultiplicityWeight);
5187  fMixedHarmonicProductOfEventWeights->Fill(5.5,6.5,d6pMultiplicityWeight*d7pMultiplicityWeight);
5188  fMixedHarmonicProductOfEventWeights->Fill(5.5,7.5,d6pMultiplicityWeight*d8pMultiplicityWeight);
5189  fMixedHarmonicProductOfEventWeights->Fill(6.5,6.5,d7pMultiplicityWeight*d7pMultiplicityWeight); 
5190  fMixedHarmonicProductOfEventWeights->Fill(6.5,7.5,d7pMultiplicityWeight*d8pMultiplicityWeight); 
5191  fMixedHarmonicProductOfEventWeights->Fill(7.5,7.5,d8pMultiplicityWeight*d8pMultiplicityWeight); 
5192  
5193  // c) Calculate 2-p correlations:
5194  Double_t two1n1n = 0.; // <2>_{1n|1n} = <cos(1n(phi1-phi2))>
5195  Double_t two2n2n = 0.; // <2>_{2n|2n} = <cos(2n(phi1-phi2))>
5196  Double_t two3n3n = 0.; // <2>_{3n|3n} = <cos(3n(phi1-phi2))>
5197  Double_t two4n4n = 0.; // <2>_{4n|4n} = <cos(4n(phi1-phi2))>
5198  Double_t two5n5n = 0.; // <2>_{5n|5n} = <cos(5n(phi1-phi2))>
5199  Double_t two6n6n = 0.; // <2>_{6n|6n} = <cos(6n(phi1-phi2))>
5200  if(dMult>1.)
5201  {
5202   two1n1n = (pow(dReQ1n,2.)+pow(dImQ1n,2.)-dMult)/(dMult*(dMult-1.)); 
5203   two2n2n = (pow(dReQ2n,2.)+pow(dImQ2n,2.)-dMult)/(dMult*(dMult-1.)); 
5204   two3n3n = (pow(dReQ3n,2.)+pow(dImQ3n,2.)-dMult)/(dMult*(dMult-1.)); 
5205   two4n4n = (pow(dReQ4n,2.)+pow(dImQ4n,2.)-dMult)/(dMult*(dMult-1.)); 
5206   two5n5n = (pow(dReQ5n,2.)+pow(dImQ5n,2.)-dMult)/(dMult*(dMult-1.)); 
5207   two6n6n = (pow(dReQ6n,2.)+pow(dImQ6n,2.)-dMult)/(dMult*(dMult-1.));   
5208   f2pCorrelations->Fill(0.5,two1n1n,d2pMultiplicityWeight);
5209   f2pCorrelations->Fill(1.5,two2n2n,d2pMultiplicityWeight);
5210   f2pCorrelations->Fill(2.5,two3n3n,d2pMultiplicityWeight);
5211   f2pCorrelations->Fill(3.5,two4n4n,d2pMultiplicityWeight);
5212   f2pCorrelations->Fill(4.5,two5n5n,d2pMultiplicityWeight);
5213   f2pCorrelations->Fill(5.5,two6n6n,d2pMultiplicityWeight);
5214   allMixedCorrelators[0]=two1n1n;
5215   allMixedCorrelators[1]=two2n2n;
5216   allMixedCorrelators[2]=two3n3n;
5217   allMixedCorrelators[3]=two4n4n;
5218   allMixedCorrelators[4]=two5n5n;
5219   allMixedCorrelators[5]=two6n6n;
5220  } // end of if(dMult>1.)
5221
5222  // d) Calculate 3-p correlations:
5223  //  d1) Two distinct harmonics (3): 
5224  Double_t three2n1n1n = 0.; // <3>_{2n|1n,1n} = <cos(n(2*phi1-1*phi2-1*phi3))>
5225  Double_t three4n2n2n = 0.; // <3>_{4n|2n,2n} = <cos(n(4*phi1-2*phi2-2*phi3))>
5226  Double_t three6n3n3n = 0.; // <3>_{6n|3n,3n} = <cos(n(6*phi1-3*phi2-3*phi3))> 
5227  //  d2) Three distinct harmonics (6): 
5228  Double_t three3n2n1n = 0.; // <3>_{3n|2n,1n} = <cos(n(3*phi1-2*phi2-1*phi3))>
5229  Double_t three4n3n1n = 0.; // <3>_{4n|3n,1n} = <cos(n(4*phi1-3*phi2-1*phi3))> 
5230  Double_t three5n3n2n = 0.; // <3>_{5n|3n,2n} = <cos(n(5*phi1-3*phi2-2*phi3))>
5231  Double_t three5n4n1n = 0.; // <3>_{5n|4n,1n} = <cos(n(5*phi1-4*phi2-1*phi3))> 
5232  Double_t three6n4n2n = 0.; // <3>_{6n|4n,2n} = <cos(n(6*phi1-4*phi2-2*phi3))> 
5233  Double_t three6n5n1n = 0.; // <3>_{6n|5n,1n} = <cos(n(6*phi1-5*phi2-1*phi3))>
5234  if(dMult>2.)
5235  {
5236   three2n1n1n = (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n
5237               - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
5238               / (dMult*(dMult-1.)*(dMult-2.)); 
5239   three4n2n2n = (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n
5240               - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*dMult)
5241               / (dMult*(dMult-1.)*(dMult-2.)); 
5242   three6n3n3n = (reQ6nQ3nstarQ3nstar
5243               - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5244               - (pow(dReQ6n,2.)+pow(dImQ6n,2.))+2.*dMult)
5245               / (dMult*(dMult-1.)*(dMult-2.));  
5246   three3n2n1n = (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
5247               + dImQ3n*dImQ2n*dReQ1n-(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5248               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))-(pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
5249               / (dMult*(dMult-1.)*(dMult-2.));
5250   three4n3n1n = (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)
5251               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))-(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5252               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
5253               / (dMult*(dMult-1.)*(dMult-2.));  
5254   three5n3n2n = (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n
5255               + dImQ5n*dImQ2n*dReQ3n-(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5256               - (pow(dReQ3n,2.)+pow(dImQ3n,2.))
5257               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
5258               / (dMult*(dMult-1.)*(dMult-2.)); 
5259   three5n4n1n = (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n
5260               + dImQ5n*dImQ4n*dReQ1n-(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5261               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))
5262               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
5263               / (dMult*(dMult-1.)*(dMult-2.));
5264   three6n4n2n = (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
5265               + dImQ6n*dImQ4n*dReQ2n-(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5266               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))-(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
5267               / (dMult*(dMult-1.)*(dMult-2.));
5268   three6n5n1n = (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n
5269               + dImQ6n*dImQ5n*dReQ1n-(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5270               - (pow(dReQ5n,2.)+pow(dImQ5n,2.))
5271               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
5272               / (dMult*(dMult-1.)*(dMult-2.)); 
5273   f3pCorrelations->Fill(0.5,three2n1n1n,d3pMultiplicityWeight);
5274   f3pCorrelations->Fill(1.5,three4n2n2n,d3pMultiplicityWeight);
5275   f3pCorrelations->Fill(2.5,three6n3n3n,d3pMultiplicityWeight);
5276   //f3pCorrelations->Fill(3.5,0.,d3pMultiplicityWeight); // empty TBI
5277   f3pCorrelations->Fill(4.5,three3n2n1n,d3pMultiplicityWeight);
5278   f3pCorrelations->Fill(5.5,three4n3n1n,d3pMultiplicityWeight);
5279   f3pCorrelations->Fill(6.5,three5n3n2n,d3pMultiplicityWeight);
5280   f3pCorrelations->Fill(7.5,three5n4n1n,d3pMultiplicityWeight);
5281   f3pCorrelations->Fill(8.5,three6n4n2n,d3pMultiplicityWeight);
5282   f3pCorrelations->Fill(9.5,three6n5n1n,d3pMultiplicityWeight);
5283   allMixedCorrelators[6]=three2n1n1n;
5284   allMixedCorrelators[7]=three4n2n2n;
5285   allMixedCorrelators[8]=three6n3n3n;
5286   allMixedCorrelators[9]=three3n2n1n;
5287   allMixedCorrelators[10]=three4n3n1n;
5288   allMixedCorrelators[11]=three5n3n2n;
5289   allMixedCorrelators[12]=three5n4n1n;
5290   allMixedCorrelators[13]=three6n4n2n;
5291   allMixedCorrelators[14]=three6n5n1n;
5292  } // end of if(dMult>2.)
5293
5294  // e) Calculate 4-p correlations:
5295  //  e1) Single harmonic (6): 
5296  Double_t four1n1n1n1n = 0.; // <4>_{1n,1n|1n,1n} = <cos(1*n(phi1+phi2-phi3-phi4))>
5297  Double_t four2n2n2n2n = 0.; // <4>_{2n,2n|2n,2n} = <cos(2*n(phi1+phi2-phi3-phi4))>
5298  Double_t four3n3n3n3n = 0.; // <4>_{3n,3n|3n,3n} = <cos(3*n(phi1+phi2-phi3-phi4))>
5299  Double_t four4n4n4n4n = 0.; // <4>_{4n,4n|4n,4n} = <cos(4*n(phi1+phi2-phi3-phi4))>
5300  Double_t four5n5n5n5n = 0.; // <4>_{5n,5n|5n,5n} = <cos(5*n(phi1+phi2-phi3-phi4))>
5301  Double_t four6n6n6n6n = 0.; // <4>_{6n,6n|6n,6n} = <cos(6*n(phi1+phi2-phi3-phi4))>
5302  //  e2) "Standard candles" (15):
5303  Double_t four2n1n2n1n = 0.; // <4>_{2n,1n|2n,1n} = <cos(n(2*phi1+1*phi2-2*phi3-1*phi4))>
5304  Double_t four3n1n3n1n = 0.; // <4>_{3n,1n|3n,1n} = <cos(n(3*phi1+1*phi2-3*phi3-1*phi4))>
5305  Double_t four3n2n3n2n = 0.; // <4>_{3n,2n|3n,2n} = <cos(n(3*phi1+2*phi2-3*phi3-2*phi4))>
5306  Double_t four4n1n4n1n = 0.; // <4>_{4n,1n|4n,1n} = <cos(n(4*phi1+1*phi2-4*phi3-1*phi4))>
5307  Double_t four4n2n4n2n = 0.; // <4>_{4n,2n|4n,2n} = <cos(n(4*phi1+2*phi2-4*phi3-2*phi4))>
5308  Double_t four4n3n4n3n = 0.; // <4>_{4n,3n|4n,3n} = <cos(n(4*phi1+3*phi2-4*phi3-3*phi4))>
5309  Double_t four5n1n5n1n = 0.; // <4>_{5n,1n|5n,1n} = <cos(n(5*phi1+1*phi2-5*phi3-1*phi4))>
5310  Double_t four5n2n5n2n = 0.; // <4>_{5n,2n|5n,2n} = <cos(n(5*phi1+2*phi2-5*phi3-2*phi4))>
5311  Double_t four5n3n5n3n = 0.; // <4>_{5n,3n|5n,3n} = <cos(n(5*phi1+3*phi2-5*phi3-3*phi4))>
5312  Double_t four5n4n5n4n = 0.; // <4>_{5n,4n|5n,4n} = <cos(n(5*phi1+4*phi2-5*phi3-4*phi4))>
5313  Double_t four6n1n6n1n = 0.; // <4>_{6n,1n|6n,1n} = <cos(n(6*phi1+1*phi2-6*phi3-1*phi4))>
5314  Double_t four6n2n6n2n = 0.; // <4>_{6n,2n|6n,2n} = <cos(n(6*phi1+2*phi2-6*phi3-2*phi4))>
5315  Double_t four6n3n6n3n = 0.; // <4>_{6n,3n|6n,3n} = <cos(n(6*phi1+3*phi2-6*phi3-3*phi4))>
5316  Double_t four6n4n6n4n = 0.; // <4>_{6n,4n|6n,4n} = <cos(n(6*phi1+4*phi2-6*phi3-4*phi4))>
5317  Double_t four6n5n6n5n = 0.; // <4>_{6n,5n|6n,5n} = <cos(n(6*phi1+5*phi2-6*phi3-5*phi4))>
5318  //  e3) Two distinct harmonics (2): 
5319  Double_t four3n1n1n1n = 0.; // <4>_{3n|1n,1n,1n} = <cos(n(3*phi1-1*phi2-1*phi3-1*phi4))>
5320  Double_t four6n2n2n2n = 0.; // <4>_{6n|2n,2n,2n} = <cos(n(6*phi1-2*phi2-2*phi3-2*phi4))>
5321  //  e4) Three distinct harmonics (10): 
5322  Double_t four3n1n2n2n = 0.; // <4>_{3n,1n|2n,2n} = <cos(n(3*phi1+1*phi2-2*phi3-2*phi4))>
5323  Double_t four4n2n1n1n = 0.; // <4>_{4n|2n,1n,1n} = <cos(n(4*phi1-2*phi2-1*phi3-1*phi4))>
5324  Double_t four4n2n3n3n = 0.; // <4>_{4n,2n|3n,3n} = <cos(n(4*phi1+2*phi2-3*phi3-3*phi4))>
5325  Double_t four5n2n2n1n = 0.; // <4>_{5n|2n,2n,1n} = <cos(n(5*phi1-2*phi2-2*phi3-1*phi4))>
5326  Double_t four5n3n1n1n = 0.; // <4>_{5n|3n,1n,1n} = <cos(n(5*phi1-3*phi2-1*phi3-1*phi4))>
5327  Double_t four5n1n3n3n = 0.; // <4>_{5n,1n|3n,3n} = <cos(n(5*phi1+1*phi2-3*phi3-3*phi4))>
5328  Double_t four5n3n4n4n = 0.; // <4>_{5n,3n|4n,4n} = <cos(n(5*phi1+3*phi2-4*phi3-4*phi4))>
5329  Double_t four6n4n1n1n = 0.; // <4>_{6n|4n,1n,1n} = <cos(n(6*phi1-4*phi2-1*phi3-1*phi4))>
5330  Double_t four6n2n4n4n = 0.; // <4>_{6n,2n|4n,4n} = <cos(n(6*phi1+2*phi2-4*phi3-4*phi4))>
5331  Double_t four6n4n5n5n = 0.; // <4>_{6n,4n|5n,5n} = <cos(n(6*phi1+4*phi2-5*phi3-5*phi4))>
5332  //  e5) Four distinct harmonics (8): 
5333  Double_t four4n1n3n2n = 0.; // <4>_{4n,1n|3n,2n} = <cos(n(4*phi1+1*phi2-3*phi3-2*phi4))>
5334  Double_t four5n1n4n2n = 0.; // <4>_{5n,1n|4n,2n} = <cos(n(5*phi1+1*phi2-4*phi3-2*phi4))>
5335  Double_t four5n2n4n3n = 0.; // <4>_{5n,2n|4n,3n} = <cos(n(5*phi1+2*phi2-4*phi3-3*phi4))>
5336  Double_t four6n1n4n3n = 0.; // <4>_{6n,1n|4n,3n} = <cos(n(6*phi1+1*phi2-4*phi3-3*phi4))>
5337  Double_t four6n1n5n2n = 0.; // <4>_{6n,1n|5n,2n} = <cos(n(6*phi1+1*phi2-5*phi3-2*phi4))>
5338  Double_t four6n3n2n1n = 0.; // <4>_{6n|3n,2n,1n} = <cos(n(6*phi1-3*phi2-2*phi3-1*phi4))>
5339  Double_t four6n2n5n3n = 0.; // <4>_{6n,2n|5n,3n} = <cos(n(6*phi1+2*phi2-5*phi3-3*phi4))>
5340  Double_t four6n3n5n4n = 0.; // <4>_{6n,3n|5n,4n} = <cos(n(6*phi1+3*phi2-5*phi3-4*phi4))>
5341  if(dMult>3.)
5342  {
5343   // Single harmonic (6): 
5344   four1n1n1n1n = (2.*dMult*(dMult-3.)+pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ1n,2.)
5345                + pow(dImQ1n,2.))-2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5346                + (pow(dReQ2n,2.)+pow(dImQ2n,2.)))
5347                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));     
5348   four2n2n2n2n = (2.*dMult*(dMult-3.)+pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ2n,2.)
5349                + pow(dImQ2n,2.))-2.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5350                + (pow(dReQ4n,2.)+pow(dImQ4n,2.)))
5351                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.)); 
5352   four3n3n3n3n = (2.*dMult*(dMult-3.)+pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ3n,2.)
5353                + pow(dImQ3n,2.))-2.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5354                + (pow(dReQ6n,2.)+pow(dImQ6n,2.)))
5355                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));     
5356   four4n4n4n4n = (2.*dMult*(dMult-3.)+pow((pow(dReQ4n,2.)+pow(dImQ4n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ4n,2.)
5357                + pow(dImQ4n,2.))-2.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
5358                + (pow(dReQ8n,2.)+pow(dImQ8n,2.)))
5359                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));     
5360   four5n5n5n5n = (2.*dMult*(dMult-3.)+pow((pow(dReQ5n,2.)+pow(dImQ5n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ5n,2.)
5361                + pow(dImQ5n,2.))-2.*(pow(dReQ5n,2.)*dReQ10n+2.*dReQ5n*dImQ5n*dImQ10n-pow(dImQ5n,2.)*dReQ10n)
5362                + (pow(dReQ10n,2.)+pow(dImQ10n,2.)))
5363                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));    
5364   four6n6n6n6n = (2.*dMult*(dMult-3.)+pow((pow(dReQ6n,2.)+pow(dImQ6n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ6n,2.)
5365                + pow(dImQ6n,2.))-2.*(pow(dReQ6n,2.)*dReQ12n+2.*dReQ6n*dImQ6n*dImQ12n-pow(dImQ6n,2.)*dReQ12n)
5366                + (pow(dReQ12n,2.)+pow(dImQ12n,2.)))
5367                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));  
5368   // "Standard candles" (15):
5369   four2n1n2n1n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5370                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
5371                + dImQ3n*dImQ2n*dReQ1n)-2.*(pow(dReQ1n,2.)*dReQ2n
5372                + 2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n))
5373                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5374                - ((dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5375                + (dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-(pow(dReQ3n,2.)+pow(dImQ3n,2.)))
5376                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5377                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));
5378   four3n1n3n1n = ((pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5379                - 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5380                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5381                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5382                + pow(dReQ2n,2.)+pow(dImQ2n,2.)-(dMult-4.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5383                + dMult*(dMult-6.))
5384                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5385   four3n2n3n2n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5386                - 2.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5387                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5388                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)               
5389                - (dMult-4.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
5390                + dMult*(dMult-6.))
5391                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
5392   four4n1n4n1n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
5393                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ1n*dImQ4n+dImQ5n*dImQ1n*dReQ4n)
5394                - 2.*(dReQ3n*dReQ4n*dReQ1n+dImQ3n*dImQ4n*dReQ1n+dReQ3n*dImQ4n*dImQ1n-dImQ3n*dImQ1n*dReQ4n)
5395                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)
5396                - (dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
5397                + dMult*(dMult-6.))
5398                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5399   four4n2n4n2n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5400                - 2.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
5401                + dImQ6n*dImQ4n*dReQ2n)-2.*(pow(dReQ2n,2.)*dReQ4n
5402                + 2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n))
5403                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5404                - ((dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5405                + (dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-(pow(dReQ6n,2.)+pow(dImQ6n,2.)))
5406                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5407                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));
5408   four4n3n4n3n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
5409                - 2.*(dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ3n*dImQ4n+dImQ7n*dImQ3n*dReQ4n)
5410                - 2.*(dReQ1n*dReQ4n*dReQ3n+dImQ1n*dImQ4n*dReQ3n+dReQ1n*dImQ4n*dImQ3n-dImQ1n*dImQ3n*dReQ4n)
5411                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)
5412                - (dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
5413                + dMult*(dMult-6.))
5414                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5415   four5n1n5n1n = (((pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
5416                - 2.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5417                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5418                + pow(dReQ6n,2.)+pow(dImQ6n,2.)-(dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5419                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+dMult*(dMult-6.))  
5420                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5421   four5n2n5n2n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
5422                - 2.*(dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ2n*dImQ5n+dImQ7n*dImQ2n*dReQ5n)
5423                - 2.*(dReQ3n*dReQ5n*dReQ2n+dImQ3n*dImQ5n*dReQ2n+dReQ3n*dImQ5n*dImQ2n-dImQ3n*dImQ2n*dReQ5n)
5424                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)
5425                - (dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
5426                + dMult*(dMult-6.))
5427                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5428   four5n3n5n3n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
5429                - 2.*(dReQ8n*dReQ5n*dReQ3n-dReQ8n*dImQ5n*dImQ3n+dImQ8n*dReQ3n*dImQ5n+dImQ8n*dImQ3n*dReQ5n)
5430                - 2.*(dReQ2n*dReQ5n*dReQ3n+dImQ2n*dImQ5n*dReQ3n+dReQ2n*dImQ5n*dImQ3n-dImQ2n*dImQ3n*dReQ5n)
5431                + pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)
5432                - (dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
5433                + dMult*(dMult-6.))
5434                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5435   four5n4n5n4n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
5436                - 2.*(dReQ9n*dReQ5n*dReQ4n-dReQ9n*dImQ5n*dImQ4n+dImQ9n*dReQ4n*dImQ5n+dImQ9n*dImQ4n*dReQ5n)
5437                - 2.*(dReQ1n*dReQ5n*dReQ4n+dImQ1n*dImQ5n*dReQ4n+dReQ1n*dImQ5n*dImQ4n-dImQ1n*dImQ4n*dReQ5n)
5438                + pow(dReQ9n,2.)+pow(dImQ9n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)
5439                - (dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.))
5440                + dMult*(dMult-6.))
5441                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5442   four6n1n6n1n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
5443                - 2.*(dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ1n*dImQ6n+dImQ7n*dImQ1n*dReQ6n)
5444                - 2.*(dReQ5n*dReQ6n*dReQ1n+dImQ5n*dImQ6n*dReQ1n+dReQ5n*dImQ6n*dImQ1n-dImQ5n*dImQ1n*dReQ6n)
5445                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)
5446                - (dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
5447                + dMult*(dMult-6.))
5448                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5449   four6n2n6n2n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5450                - 2.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
5451                - 2.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5452                + pow(dReQ8n,2.)+pow(dImQ8n,2.)-(dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5453                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5454                + dMult*(dMult-6.))
5455                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5456   four6n3n6n3n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5457                - 2.*(dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n
5458                + dImQ9n*dImQ6n*dReQ3n)-2.*(pow(dReQ3n,2.)*dReQ6n
5459                + 2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n))
5460                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5461                - ((dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5462                + (dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-(pow(dReQ9n,2.)+pow(dImQ9n,2.)))
5463                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5464                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));
5465   four6n4n6n4n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5466                - 2.*(dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
5467                - 2.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5468                + pow(dReQ10n,2.)+pow(dImQ10n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)               
5469                - (dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.))
5470                + dMult*(dMult-6.))
5471                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
5472   four6n5n6n5n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
5473                - 2.*(dReQ11n*dReQ6n*dReQ5n-dReQ11n*dImQ6n*dImQ5n+dImQ11n*dReQ5n*dImQ6n+dImQ11n*dImQ5n*dReQ6n)
5474                - 2.*(dReQ1n*dReQ6n*dReQ5n+dImQ1n*dImQ6n*dReQ5n+dReQ1n*dImQ6n*dImQ5n-dImQ1n*dImQ5n*dReQ6n)
5475                + pow(dReQ11n,2.)+pow(dImQ11n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)
5476                - (dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.))
5477                + dMult*(dMult-6.))
5478                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5479   // Two distinct harmonics (2):
5480   four3n1n1n1n = (dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
5481                + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3)               
5482                - 3.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5483                - 3.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5484                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5485                + 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5486                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5487   four6n2n2n2n = (dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
5488                + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3)               
5489                - 3.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5490                - 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5491                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+3.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5492                + 6.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-6.*dMult)
5493                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5494   // Three distinct harmonics (10): 
5495   four3n1n2n2n = ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
5496                + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)
5497                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5498                - (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5499                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n))
5500                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5501                - (2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5502                - (pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5503                - 4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
5504                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5505                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));
5506   four4n2n1n1n = ((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
5507                + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n)
5508                - 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5509                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5510                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n))
5511                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5512                - ((pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5513                - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5514                - 3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
5515                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5516                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));
5517   four4n2n3n3n = ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
5518                + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n
5519                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5520                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5521                - 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5522                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5523                + (pow(dReQ6n,2.)+pow(dImQ6n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5524                + 2.*(2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5525                + (pow(dReQ1n,2.)+pow(dImQ1n,2.))-3.*dMult))
5526                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
5527   four5n2n2n1n = (-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
5528                + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
5529                - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n
5530                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5531                - 2.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5532                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5533                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5534                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+pow(dReQ4n,2.)+pow(dImQ4n,2.)
5535                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5536                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5537                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5538   four5n3n1n1n = (-pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
5539                + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
5540                - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n
5541                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5542                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5543                - 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5544                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5545                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5546                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+pow(dReQ2n,2.)+pow(dImQ2n,2.)
5547                + 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
5548                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
5549   four5n1n3n3n = (dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
5550                - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
5551                + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n
5552                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5553                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5554                - 2.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5555                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5556                + pow(dReQ6n,2.)+pow(dImQ6n,2.)+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5557                + 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5558                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)                                  
5559                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5560   four5n3n4n4n = ((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ5n*dReQ3n-dImQ5n*dImQ3n) 
5561                + 2.*dReQ4n*dImQ4n*(dReQ5n*dImQ3n+dImQ5n*dReQ3n)
5562                - (dReQ8n*dReQ3n*dReQ5n-dReQ8n*dImQ3n*dImQ5n+dImQ8n*dReQ3n*dImQ5n+dImQ8n*dImQ3n*dReQ5n)
5563                - (pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
5564                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5565                - 2.*(dReQ4n*dReQ3n*dReQ1n-dReQ4n*dImQ3n*dImQ1n+dImQ4n*dReQ3n*dImQ1n+dImQ4n*dImQ3n*dReQ1n)
5566                + pow(dReQ8n,2.)+pow(dImQ8n,2.)+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
5567                + 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
5568                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
5569                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5570   four6n4n1n1n = (-pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
5571                + 2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
5572                - pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n
5573                - 2.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5574                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n) 
5575                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n) 
5576                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n) 
5577                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)
5578                + pow(dReQ4n,2.)+pow(dImQ4n,2.))+pow(dReQ2n,2.)+pow(dImQ2n,2.)
5579                + 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5580                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5581   four6n2n4n4n = ((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
5582                + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n)
5583                - (pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
5584                - (dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
5585                - 2.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n))
5586                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5587                - (2.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5588                - (pow(dReQ8n,2.)+pow(dImQ8n,2.))-2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5589                - 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)))
5590                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5591                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));
5592   four6n4n5n5n = ((pow(dReQ5n,2.)-pow(dImQ5n,2.))*(dReQ6n*dReQ4n-dImQ6n*dImQ4n) 
5593                + 2.*dReQ5n*dImQ5n*(dReQ6n*dImQ4n+dImQ6n*dReQ4n)
5594                - (dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
5595                - (pow(dReQ5n,2.)*dReQ10n+2.*dReQ5n*dImQ5n*dImQ10n-pow(dImQ5n,2.)*dReQ10n)
5596                - 2.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5597                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5598                + pow(dReQ10n,2.)+pow(dImQ10n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5599                + 4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))              
5600                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5601                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5602   // Four distinct harmonics (8): 
5603   four4n1n3n2n = (dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
5604                + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
5605                - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
5606                + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n 
5607                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5608                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5609                - (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5610                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5611                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5612                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5613                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5614                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5615                + 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
5616                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5617   four5n1n4n2n = (dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
5618                + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
5619                - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n+dImQ1n*dImQ2n*dReQ4n*dReQ5n
5620                + dReQ1n*dReQ2n*dReQ4n*dReQ5n
5621                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5622                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5623                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5624                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5625                - (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5626                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5627                + pow(dReQ6n,2.)+pow(dImQ6n,2.)
5628                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5629                + pow(dReQ3n,2.)+pow(dImQ3n,2.)+2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5630                + 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5631                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5632   four5n2n4n3n = (dImQ2n*dImQ3n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ2n*dReQ3n 
5633                + dImQ3n*dImQ5n*dReQ2n*dReQ4n-dImQ2n*dImQ5n*dReQ3n*dReQ4n
5634                - dImQ3n*dImQ4n*dReQ2n*dReQ5n+dImQ2n*dImQ4n*dReQ3n*dReQ5n 
5635                + dImQ2n*dImQ3n*dReQ4n*dReQ5n+dReQ2n*dReQ3n*dReQ4n*dReQ5n
5636                - (dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ5n*dImQ2n+dImQ7n*dImQ5n*dReQ2n)
5637                - (dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
5638                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5639                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5640                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5641                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5642                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5643                + 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5644                + 3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+pow(dReQ1n,2.)+pow(dImQ1n,2.)-6.*dMult)
5645                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5646   four6n1n4n3n = (dImQ1n*dImQ3n*dImQ4n*dImQ6n+dImQ4n*dImQ6n*dReQ1n*dReQ3n 
5647                + dImQ3n*dImQ6n*dReQ1n*dReQ4n-dImQ1n*dImQ6n*dReQ3n*dReQ4n
5648                - dImQ3n*dImQ4n*dReQ1n*dReQ6n+dImQ1n*dImQ4n*dReQ3n*dReQ6n+dImQ1n*dImQ3n*dReQ4n*dReQ6n
5649                + dReQ1n*dReQ3n*dReQ4n*dReQ6n
5650                - (dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
5651                - (dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
5652                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5653                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5654                - (dReQ4n*dReQ1n*dReQ3n-dReQ4n*dImQ1n*dImQ3n+dImQ4n*dReQ1n*dImQ3n+dImQ4n*dImQ1n*dReQ3n)
5655                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5656                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5657                + 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5658                + pow(dReQ2n,2.)+pow(dImQ2n,2.)+2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5659                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5660   four6n1n5n2n = (dImQ1n*dImQ2n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ1n*dReQ2n 
5661                + dImQ2n*dImQ6n*dReQ1n*dReQ5n-dImQ1n*dImQ6n*dReQ2n*dReQ5n
5662                - dImQ2n*dImQ5n*dReQ1n*dReQ6n+dImQ1n*dImQ5n*dReQ2n*dReQ6n+dImQ1n*dImQ2n*dReQ5n*dReQ6n
5663                + dReQ1n*dReQ2n*dReQ5n*dReQ6n
5664                - (dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
5665                - (dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ5n*dImQ2n+dImQ7n*dImQ5n*dReQ2n)
5666                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5667                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5668                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5669                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n) 
5670                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5671                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+pow(dReQ4n,2.)+pow(dImQ4n,2.)
5672                + 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5673                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5674   four6n3n2n1n = (dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
5675                - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
5676                + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
5677                + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n
5678                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5679                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5680                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5681                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5682                - (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5683                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5684                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+pow(dReQ5n,2.)+pow(dImQ5n,2.)
5685                + pow(dReQ4n,2.)+pow(dImQ4n,2.)+3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5686                + 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5687                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5688   four6n2n5n3n = (dImQ2n*dImQ3n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ2n*dReQ3n 
5689                + dImQ3n*dImQ6n*dReQ2n*dReQ5n-dImQ2n*dImQ6n*dReQ3n*dReQ5n
5690                - dImQ3n*dImQ5n*dReQ2n*dReQ6n+dImQ2n*dImQ5n*dReQ3n*dReQ6n+dImQ2n*dImQ3n*dReQ5n*dReQ6n
5691                + dReQ2n*dReQ3n*dReQ5n*dReQ6n
5692                - (dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n+dImQ8n*dImQ6n*dReQ2n)
5693                - (dReQ8n*dReQ5n*dReQ3n-dReQ8n*dImQ5n*dImQ3n+dImQ8n*dReQ5n*dImQ3n+dImQ8n*dImQ5n*dReQ3n)
5694                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5695                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5696                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5697                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5698                + pow(dReQ8n,2.)+pow(dImQ8n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5699                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5700                + 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+pow(dReQ1n,2.)+pow(dImQ1n,2.)-6.*dMult)
5701                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5702   four6n3n5n4n = (dImQ3n*dImQ4n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ3n*dReQ4n 
5703                + dImQ4n*dImQ6n*dReQ3n*dReQ5n-dImQ3n*dImQ6n*dReQ4n*dReQ5n
5704                - dImQ4n*dImQ5n*dReQ3n*dReQ6n+dImQ3n*dImQ5n*dReQ4n*dReQ6n+dImQ3n*dImQ4n*dReQ5n*dReQ6n
5705                + dReQ3n*dReQ4n*dReQ5n*dReQ6n
5706                - (dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n+dImQ9n*dImQ6n*dReQ3n)
5707                - (dReQ9n*dReQ5n*dReQ4n-dReQ9n*dImQ5n*dImQ4n+dImQ9n*dReQ5n*dImQ4n+dImQ9n*dImQ5n*dReQ4n)
5708                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5709                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5710                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5711                - (dReQ4n*dReQ3n*dReQ1n-dReQ4n*dImQ3n*dImQ1n+dImQ4n*dReQ3n*dImQ1n+dImQ4n*dImQ3n*dReQ1n)
5712                + pow(dReQ9n,2.)+pow(dImQ9n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5713                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5714                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+pow(dReQ2n,2.)+pow(dImQ2n,2.)
5715                + pow(dReQ1n,2.)+pow(dImQ1n,2.)-6.*dMult)
5716                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5717   f4pCorrelations->Fill(0.5,four1n1n1n1n,d4pMultiplicityWeight);
5718   f4pCorrelations->Fill(1.5,four2n2n2n2n,d4pMultiplicityWeight);
5719   f4pCorrelations->Fill(2.5,four3n3n3n3n,d4pMultiplicityWeight);
5720   f4pCorrelations->Fill(3.5,four4n4n4n4n,d4pMultiplicityWeight);
5721   f4pCorrelations->Fill(4.5,four5n5n5n5n,d4pMultiplicityWeight);
5722   f4pCorrelations->Fill(5.5,four6n6n6n6n,d4pMultiplicityWeight);
5723   //f4pCorrelations->Fill(6.5,0.,d4pMultiplicityWeight); // empty
5724   f4pCorrelations->Fill(7.5,four2n1n2n1n,d4pMultiplicityWeight);
5725   f4pCorrelations->Fill(8.5,four3n1n3n1n,d4pMultiplicityWeight);
5726   f4pCorrelations->Fill(9.5,four3n2n3n2n,d4pMultiplicityWeight);
5727   f4pCorrelations->Fill(10.5,four4n1n4n1n,d4pMultiplicityWeight);
5728   f4pCorrelations->Fill(11.5,four4n2n4n2n,d4pMultiplicityWeight);
5729   f4pCorrelations->Fill(12.5,four4n3n4n3n,d4pMultiplicityWeight);
5730   f4pCorrelations->Fill(13.5,four5n1n5n1n,d4pMultiplicityWeight);
5731   f4pCorrelations->Fill(14.5,four5n2n5n2n,d4pMultiplicityWeight);
5732   f4pCorrelations->Fill(15.5,four5n3n5n3n,d4pMultiplicityWeight);
5733   f4pCorrelations->Fill(16.5,four5n4n5n4n,d4pMultiplicityWeight);
5734   f4pCorrelations->Fill(17.5,four6n1n6n1n,d4pMultiplicityWeight);
5735   f4pCorrelations->Fill(18.5,four6n2n6n2n,d4pMultiplicityWeight);
5736   f4pCorrelations->Fill(19.5,four6n3n6n3n,d4pMultiplicityWeight);
5737   f4pCorrelations->Fill(20.5,four6n4n6n4n,d4pMultiplicityWeight);
5738   f4pCorrelations->Fill(21.5,four6n5n6n5n,d4pMultiplicityWeight);
5739   //f4pCorrelations->Fill(22.5,0.,d4pMultiplicityWeight); // empty
5740   f4pCorrelations->Fill(23.5,four3n1n1n1n,d4pMultiplicityWeight);
5741   f4pCorrelations->Fill(24.5,four6n2n2n2n,d4pMultiplicityWeight);
5742   //f4pCorrelations->Fill(25.5,0.,d4pMultiplicityWeight); // empty
5743   f4pCorrelations->Fill(26.5,four3n1n2n2n,d4pMultiplicityWeight);
5744   f4pCorrelations->Fill(27.5,four4n2n1n1n,d4pMultiplicityWeight);
5745   f4pCorrelations->Fill(28.5,four4n2n3n3n,d4pMultiplicityWeight);
5746   f4pCorrelations->Fill(29.5,four5n2n2n1n,d4pMultiplicityWeight);
5747   f4pCorrelations->Fill(30.5,four5n3n1n1n,d4pMultiplicityWeight);
5748   f4pCorrelations->Fill(31.5,four5n1n3n3n,d4pMultiplicityWeight);
5749   f4pCorrelations->Fill(32.5,four5n3n4n4n,d4pMultiplicityWeight);
5750   f4pCorrelations->Fill(33.5,four6n4n1n1n,d4pMultiplicityWeight);
5751   f4pCorrelations->Fill(34.5,four6n2n4n4n,d4pMultiplicityWeight);
5752   f4pCorrelations->Fill(35.5,four6n4n5n5n,d4pMultiplicityWeight);
5753   //f4pCorrelations->Fill(36.5,0.,d4pMultiplicityWeight); // empty
5754   f4pCorrelations->Fill(37.5,four4n1n3n2n,d4pMultiplicityWeight); 
5755   f4pCorrelations->Fill(38.5,four5n1n4n2n,d4pMultiplicityWeight); 
5756   f4pCorrelations->Fill(39.5,four5n2n4n3n,d4pMultiplicityWeight); 
5757   f4pCorrelations->Fill(40.5,four6n1n4n3n,d4pMultiplicityWeight); 
5758   f4pCorrelations->Fill(41.5,four6n1n5n2n,d4pMultiplicityWeight); 
5759   f4pCorrelations->Fill(42.5,four6n3n2n1n,d4pMultiplicityWeight); 
5760   f4pCorrelations->Fill(43.5,four6n2n5n3n,d4pMultiplicityWeight); 
5761   f4pCorrelations->Fill(44.5,four6n3n5n4n,d4pMultiplicityWeight); 
5762   allMixedCorrelators[15]=four1n1n1n1n;
5763   allMixedCorrelators[16]=four2n2n2n2n;
5764   allMixedCorrelators[17]=four3n3n3n3n;
5765   allMixedCorrelators[18]=four4n4n4n4n;
5766   allMixedCorrelators[19]=four5n5n5n5n;
5767   allMixedCorrelators[20]=four6n6n6n6n;
5768   allMixedCorrelators[21]=four2n1n2n1n;
5769   allMixedCorrelators[22]=four3n1n3n1n;
5770   allMixedCorrelators[23]=four3n2n3n2n;
5771   allMixedCorrelators[24]=four4n1n4n1n;
5772   allMixedCorrelators[25]=four4n2n4n2n;
5773   allMixedCorrelators[26]=four4n3n4n3n;
5774   allMixedCorrelators[27]=four5n1n5n1n;
5775   allMixedCorrelators[28]=four5n2n5n2n;
5776   allMixedCorrelators[29]=four5n3n5n3n;
5777   allMixedCorrelators[30]=four5n4n5n4n;
5778   allMixedCorrelators[31]=four6n1n6n1n;
5779   allMixedCorrelators[32]=four6n2n6n2n;
5780   allMixedCorrelators[33]=four6n3n6n3n;
5781   allMixedCorrelators[34]=four6n4n6n4n;
5782   allMixedCorrelators[35]=four6n5n6n5n;
5783   allMixedCorrelators[36]=four3n1n1n1n;
5784   allMixedCorrelators[37]=four6n2n2n2n;
5785   allMixedCorrelators[38]=four3n1n2n2n;
5786   allMixedCorrelators[39]=four4n2n1n1n;
5787   allMixedCorrelators[40]=four4n2n3n3n;
5788   allMixedCorrelators[41]=four5n2n2n1n;
5789   allMixedCorrelators[42]=four5n3n1n1n;
5790   allMixedCorrelators[43]=four5n1n3n3n;
5791   allMixedCorrelators[44]=four5n3n4n4n;
5792   allMixedCorrelators[45]=four6n4n1n1n;
5793   allMixedCorrelators[46]=four6n2n4n4n;
5794   allMixedCorrelators[47]=four6n4n5n5n;
5795   allMixedCorrelators[48]=four4n1n3n2n;
5796   allMixedCorrelators[49]=four5n1n4n2n;
5797   allMixedCorrelators[50]=four5n2n4n3n;
5798   allMixedCorrelators[51]=four6n1n4n3n;
5799   allMixedCorrelators[52]=four6n1n5n2n;
5800   allMixedCorrelators[53]=four6n3n2n1n;
5801   allMixedCorrelators[54]=four6n2n5n3n;
5802   allMixedCorrelators[55]=four6n3n5n4n;
5803  } // end of if(dMult>3.)
5804
5805  // f) Calculate 5-p correlations:
5806  //  f1) "Standard candles" (30):
5807  Double_t five3n2n3n1n1n = 0.; // <5>_{3n,2n|3n,1n,1n} = <cos(n(3*phi1+2*phi2-3*phi3-1*phi4-1*phi5))>
5808  Double_t five4n1n2n2n1n = 0.; // <5>_{4n,1n|2n,2n,1n} = <cos(n(4*phi1+1*phi2-2*phi3-2*phi4-1*phi5))>
5809  Double_t five4n2n3n2n1n = 0.; // <5>_{4n,2n|3n,2n,1n} = <cos(n(4*phi1+2*phi2-3*phi3-2*phi4-1*phi5))>
5810  Double_t five4n3n3n2n2n = 0.; // <5>_{4n,3n|3n,2n,2n} = <cos(n(4*phi1+3*phi2-3*phi3-2*phi4-2*phi5))>
5811  Double_t five4n2n4n1n1n = 0.; // <5>_{4n,2n|4n,1n,1n} = <cos(n(4*phi1+2*phi2-4*phi3-1*phi4-1*phi5))>
5812  Double_t five4n3n4n2n1n = 0.; // <5>_{4n,3n|4n,2n,1n} = <cos(n(4*phi1+3*phi2-4*phi3-2*phi4-1*phi5))>
5813  Double_t five5n1n3n2n1n = 0.; // <5>_{5n,1n|3n,2n,1n} = <cos(n(5*phi1+1*phi2-3*phi3-2*phi4-1*phi5))>
5814  Double_t five5n2n5n1n1n = 0.; // <5>_{5n,2n|5n,1n,1n} = <cos(n(5*phi1+2*phi2-5*phi3-1*phi4-1*phi5))>
5815  Double_t five5n2n4n2n1n = 0.; // <5>_{5n,2n|4n,2n,1n} = <cos(n(5*phi1+2*phi2-4*phi3-2*phi4-1*phi5))>
5816  Double_t five5n3n4n3n1n = 0.; // <5>_{5n,3n|4n,3n,1n} = <cos(n(5*phi1+3*phi2-4*phi3-3*phi4-1*phi5))>
5817  Double_t five5n4n4n3n2n = 0.; // <5>_{5n,4n|4n,3n,2n} = <cos(n(5*phi1+4*phi2-4*phi3-3*phi4-2*phi5))>
5818  Double_t five5n3n5n2n1n = 0.; // <5>_{5n,3n|5n,2n,1n} = <cos(n(5*phi1+3*phi2-5*phi3-2*phi4-1*phi5))>
5819  Double_t five5n4n5n2n2n = 0.; // <5>_{5n,4n|5n,2n,2n} = <cos(n(5*phi1+4*phi2-5*phi3-2*phi4-2*phi5))>
5820  Double_t five5n4n5n3n1n = 0.; // <5>_{5n,4n|5n,3n,1n} = <cos(n(5*phi1+4*phi2-5*phi3-3*phi4-1*phi5))>
5821  Double_t five6n1n3n3n1n = 0.; // <5>_{6n,1n|3n,3n,1n} = <cos(n(6*phi1+1*phi2-3*phi3-3*phi4-1*phi5))>
5822  Double_t five6n2n3n3n2n = 0.; // <5>_{6n,2n|3n,3n,2n} = <cos(n(6*phi1+2*phi2-3*phi3-3*phi4-2*phi5))>
5823  Double_t five6n1n4n2n1n = 0.; // <5>_{6n,1n|4n,2n,1n} = <cos(n(6*phi1+1*phi2-4*phi3-2*phi4-1*phi5))>
5824  Double_t five6n3n4n3n2n = 0.; // <5>_{6n,3n|4n,3n,2n} = <cos(n(6*phi1+3*phi2-4*phi3-3*phi4-2*phi5))>
5825  Double_t five6n4n4n3n3n = 0.; // <5>_{6n,4n|4n,3n,3n} = <cos(n(6*phi1+4*phi2-4*phi3-3*phi4-3*phi5))>
5826  Double_t five6n2n5n2n1n = 0.; // <5>_{6n,2n|5n,2n,1n} = <cos(n(6*phi1+2*phi2-5*phi3-2*phi4-1*phi5))>
5827  Double_t five6n3n5n3n1n = 0.; // <5>_{6n,3n|5n,3n,1n} = <cos(n(6*phi1+3*phi2-5*phi3-3*phi4-1*phi5))>
5828  Double_t five6n4n5n4n1n = 0.; // <5>_{6n,4n|5n,4n,1n} = <cos(n(6*phi1+4*phi2-5*phi3-4*phi4-1*phi5))>
5829  Double_t five6n5n5n3n3n = 0.; // <5>_{6n,5n|5n,3n,3n} = <cos(n(6*phi1+5*phi2-5*phi3-3*phi4-3*phi5))>
5830  Double_t five6n2n6n1n1n = 0.; // <5>_{6n,2n|6n,1n,1n} = <cos(n(6*phi1+2*phi2-6*phi3-1*phi4-1*phi5))>
5831  Double_t five6n3n6n2n1n = 0.; // <5>_{6n,3n|6n,2n,1n} = <cos(n(6*phi1+3*phi2-6*phi3-2*phi4-1*phi5))>
5832  Double_t five6n4n6n2n2n = 0.; // <5>_{6n,4n|6n,2n,2n} = <cos(n(6*phi1+4*phi2-6*phi3-2*phi4-2*phi5))>
5833  Double_t five6n4n6n3n1n = 0.; // <5>_{6n,4n|6n,3n,1n} = <cos(n(6*phi1+4*phi2-6*phi3-3*phi4-1*phi5))>
5834  Double_t five6n5n5n4n2n = 0.; // <5>_{6n,5n|5n,4n,2n} = <cos(n(6*phi1+5*phi2-5*phi3-4*phi4-2*phi5))>
5835  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
5836  Double_t five6n5n6n4n1n = 0.; // <5>_{6n,5n|6n,4n,1n} = <cos(n(6*phi1+5*phi2-6*phi3-4*phi4-1*phi5))>
5837  //  f2) Two distinct harmonics (9):
5838  Double_t five2n1n1n1n1n = 0.; // <5>_{2n,1n|1n,1n,1n} = <cos(n(2*phi1+1*phi2-1*phi3-1*phi4-1*phi5))>
5839  Double_t five2n2n2n1n1n = 0.; // <5>_{2n,2n|2n,1n,1n} = <cos(n(2*phi1+2*phi2-2*phi3-1*phi4-1*phi5))>
5840  Double_t five3n3n2n2n2n = 0.; // <5>_{3n,3n|2n,2n,2n} = <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-2*phi5))>
5841  Double_t five4n1n1n1n1n = 0.; // <5>_{4n|1n,1n,1n,1n} = <cos(n(4*phi1-1*phi2-1*phi3-1*phi4-1*phi5))>
5842  Double_t five4n2n2n2n2n = 0.; // <5>_{4n,2n|2n,2n,2n} = <cos(n(4*phi1+2*phi2-2*phi3-2*phi4-2*phi5))>
5843  Double_t five4n4n4n2n2n = 0.; // <5>_{4n,4n|4n,2n,2n} = <cos(n(4*phi1+4*phi2-4*phi3-2*phi4-2*phi5))>
5844  Double_t five6n3n3n3n3n = 0.; // <5>_{6n,3n|3n,3n,3n} = <cos(n(6*phi1+3*phi2-3*phi3-3*phi4-3*phi5))>
5845  Double_t five6n6n4n4n4n = 0.; // <5>_{6n,6n|4n,4n,4n} = <cos(n(6*phi1+6*phi2-4*phi3-4*phi4-4*phi5))>
5846  Double_t five6n6n6n3n3n = 0.; // <5>_{6n,6n|6n,3n,3n} = <cos(n(6*phi1+6*phi2-6*phi3-3*phi4-3*phi5))>
5847  //  f3) Three distinct harmonics (30):
5848  Double_t five3n1n2n1n1n = 0.; // <5>_{3n,1n|2n,1n,1n} = <cos(n(3*phi1+1*phi2-2*phi3-1*phi4-1*phi5))>
5849  Double_t five3n2n2n2n1n = 0.; // <5>_{3n,2n|2n,2n,1n} = <cos(n(3*phi1+2*phi2-2*phi3-2*phi4-1*phi5))>
5850  Double_t five3n3n3n2n1n = 0.; // <5>_{3n,3n|3n,2n,1n} = <cos(n(3*phi1+3*phi2-3*phi3-2*phi4-1*phi5))>
5851  Double_t five4n1n3n1n1n = 0.; // <5>_{4n,1n|3n,1n,1n} = <cos(n(4*phi1+1*phi2-3*phi3-1*phi4-1*phi5))>
5852  Double_t five4n1n1n3n3n = 0.; // <5>_{4n,1n,1n|3n,3n} = <cos(n(4*phi1+1*phi2+1*phi3-3*phi4-3*phi5))>
5853  Double_t five4n3n3n3n1n = 0.; // <5>_{4n,3n|3n,3n,1n} = <cos(n(4*phi1+3*phi2-3*phi3-3*phi4-1*phi5))>
5854  Double_t five4n4n3n3n2n = 0.; // <5>_{4n,4n|3n,3n,2n} = <cos(n(4*phi1+4*phi2-3*phi3-3*phi4-2*phi5))>
5855  Double_t five4n4n4n3n1n = 0.; // <5>_{4n,4n|4n,3n,1n} = <cos(n(4*phi1+4*phi2-4*phi3-3*phi4-1*phi5))>
5856  Double_t five5n2n1n1n1n = 0.; // <5>_{5n|2n,1n,1n,1n} = <cos(n(5*phi1-2*phi2-1*phi3-1*phi4-1*phi5))>
5857  Double_t five5n1n2n2n2n = 0.; // <5>_{5n,1n|2n,2n,2n} = <cos(n(5*phi1+1*phi2-2*phi3-2*phi4-2*phi5))>
5858  Double_t five5n2n3n2n2n = 0.; // <5>_{5n,2n|3n,2n,2n} = <cos(n(5*phi1+2*phi2-3*phi3-2*phi4-2*phi5))>
5859  Double_t five5n3n3n3n2n = 0.; // <5>_{5n,3n|3n,3n,2n} = <cos(n(5*phi1+3*phi2-3*phi3-3*phi4-2*phi5))>
5860  Double_t five5n1n4n1n1n = 0.; // <5>_{5n,1n|4n,1n,1n} = <cos(n(5*phi1+1*phi2-4*phi3-1*phi4-1*phi5))>
5861  Double_t five5n4n3n3n3n = 0.; // <5>_{5n,4n|3n,3n,3n} = <cos(n(5*phi1+4*phi2-3*phi3-3*phi4-3*phi5))>
5862  Double_t five5n4n4n4n1n = 0.; // <5>_{5n,4n|4n,4n,1n} = <cos(n(5*phi1+4*phi2-4*phi3-4*phi4-1*phi5))>
5863  Double_t five5n5n4n3n3n = 0.; // <5>_{5n,5n|4n,3n,3n} = <cos(n(5*phi1+5*phi2-4*phi3-3*phi4-3*phi5))>
5864  Double_t five5n5n4n4n2n = 0.; // <5>_{5n,5n|4n,4n,2n} = <cos(n(5*phi1+5*phi2-4*phi3-4*phi4-2*phi5))>
5865  Double_t five5n5n5n3n2n = 0.; // <5>_{5n,5n|5n,3n,2n} = <cos(n(5*phi1+5*phi2-5*phi3-3*phi4-2*phi5))>
5866  Double_t five5n5n5n4n1n = 0.; // <5>_{5n,5n|5n,4n,1n} = <cos(n(5*phi1+5*phi2-5*phi3-4*phi4-1*phi5))>
5867  Double_t five6n2n2n1n1n = 0.; // <5>_{6n|2n,2n,1n,1n} = <cos(n(6*phi1-2*phi2-2*phi3-1*phi4-1*phi5))>
5868  Double_t five6n3n1n1n1n = 0.; // <5>_{6n|3n,1n,1n,1n} = <cos(n(6*phi1-3*phi2-1*phi3-1*phi4-1*phi5))>
5869  Double_t five6n1n1n4n4n = 0.; // <5>_{6n,1n,1n|4n,4n} = <cos(n(6*phi1+1*phi2+1*phi3-4*phi4-4*phi5))>
5870  Double_t five6n1n5n1n1n = 0.; // <5>_{6n,1n|5n,1n,1n} = <cos(n(6*phi1+1*phi2-5*phi3-1*phi4-1*phi5))>
5871  Double_t five6n2n4n2n2n = 0.; // <5>_{6n,2n|4n,2n,2n} = <cos(n(6*phi1+2*phi2-4*phi3-2*phi4-2*phi5))>
5872  Double_t five6n4n4n4n2n = 0.; // <5>_{6n,4n|4n,4n,2n} = <cos(n(6*phi1+4*phi2-4*phi3-4*phi4-2*phi5))>
5873  Double_t five6n2n2n5n5n = 0.; // <5>_{6n,2n,2n|5n,5n} = <cos(n(6*phi1+2*phi2+2*phi3-5*phi4-5*phi5))>
5874  Double_t five6n5n5n5n1n = 0.; // <5>_{6n,5n|5n,5n,1n} = <cos(n(6*phi1+5*phi2-5*phi3-5*phi4-1*phi5))>
5875  Double_t five6n6n5n5n2n = 0.; // <5>_{6n,6n|5n,5n,2n} = <cos(n(6*phi1+6*phi2-5*phi3-5*phi4-2*phi5))>
5876  Double_t five6n6n6n4n2n = 0.; // <5>_{6n,6n|6n,4n,2n} = <cos(n(6*phi1+6*phi2-6*phi3-4*phi4-2*phi5))>
5877  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
5878  // Four distinct harmonics (11):
5879  Double_t five5n2n3n3n1n = 0.; // <5>_{5n,2n|3n,3n,1n} = <cos(n(5*phi1+2*phi2-3*phi3-3*phi4-1*phi5))>
5880  Double_t five5n1n1n4n3n = 0.; // <5>_{5n,1n,1n|4n,3n} = <cos(n(5*phi1+1*phi2+1*phi3-4*phi4-3*phi5))>
5881  Double_t five5n3n4n2n2n = 0.; // <5>_{5n,3n|4n,2n,2n} = <cos(n(5*phi1+3*phi2-4*phi3-2*phi4-2*phi5))>
5882  Double_t five5n2n1n4n4n = 0.; // <5>_{5n,2n,1n|4n,4n} = <cos(n(5*phi1+2*phi2+1*phi3-4*phi4-4*phi5))>
5883  Double_t five6n1n3n2n2n = 0.; // <5>_{6n,1n|3n,2n,2n} = <cos(n(6*phi1+1*phi2-3*phi3-2*phi4-2*phi5))>
5884  Double_t five6n3n4n4n1n = 0.; // <5>_{6n,3n|4n,4n,1n} = <cos(n(6*phi1+3*phi2-4*phi3-4*phi4-1*phi5))>
5885  Double_t five6n1n1n5n3n = 0.; // <5>_{6n,1n,1n|5n,3n} = <cos(n(6*phi1+1*phi2+1*phi3-5*phi4-3*phi5))>
5886  Double_t five6n3n5n2n2n = 0.; // <5>_{6n,3n|5n,2n,2n} = <cos(n(6*phi1+3*phi2-5*phi3-2*phi4-2*phi5))>
5887  Double_t five6n5n4n4n3n = 0.; // <5>_{6n,5n|4n,4n,3n} = <cos(n(6*phi1+5*phi2-4*phi3-4*phi4-3*phi5))>
5888  Double_t five6n3n1n5n5n = 0.; // <5>_{6n,3n,1n|5n,5n} = <cos(n(6*phi1+3*phi2+1*phi3-5*phi4-5*phi5))>
5889  Double_t five6n6n5n4n3n = 0.; // <5>_{6n,6n|5n,4n,3n} = <cos(n(6*phi1+6*phi2-5*phi3-4*phi4-3*phi5))>
5890  // Five distinct harmonics (3):
5891  Double_t five6n2n4n3n1n = 0.; // <5>_{6n,2n|4n,3n,1n} = <cos(n(6*phi1+2*phi2-4*phi3-3*phi4-1*phi5))>
5892  Double_t five6n2n1n5n4n = 0.; // <5>_{6n,2n,1n|5n,4n} = <cos(n(6*phi1+2*phi2+1*phi3-5*phi4-4*phi5))>
5893  Double_t five6n4n5n3n2n = 0.; // <5>_{6n,4n|5n,3n,2n} = <cos(n(6*phi1+4*phi2-5*phi3-3*phi4-2*phi5))>
5894  if(dMult>4.)
5895  {
5896   five3n2n3n1n1n = (-(pow(dImQ3n,2.)+pow(dReQ3n,2.))
5897                  * (-2.*dImQ1n*dImQ2n*dReQ1n+pow(dImQ1n,2.)*dReQ2n-pow(dReQ1n,2.)*dReQ2n)
5898                  - (-pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
5899                  + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
5900                  - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n)
5901                  - 2.*(dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
5902                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
5903                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
5904                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
5905                  - (dReQ3n*pow(dReQ1n,3.)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2.)
5906                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2.)-dImQ3n*pow(dImQ1n,3.))
5907                  - 2.*((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
5908                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5909                  + 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5910                  + 3.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5911                  + 6.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5912                  + 2.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5913                  + 9.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5914                  - (dMult-8.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5915                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
5916                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
5917                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5918                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(dMult-12.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5919                  + 2.*(dMult-9.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.))
5920                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
5921   five4n1n2n2n1n = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))
5922                  * (pow(dReQ2n,2.)*dReQ4n-pow(dImQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n)
5923                  - 2.*(dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
5924                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
5925                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
5926                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)    
5927                  - 2.*((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) 
5928                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
5929                  - (-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
5930                  + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
5931                  - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n)
5932                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
5933                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5934                  + (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5935                  + 2.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5936                  + 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5937                  + 2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5938                  + 3.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5939                  + 4.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5940                  + 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5941                  + 6.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5942                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5943                  - (dMult-6.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5944                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5945                  - 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5946                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5947                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5948                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5949                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5950                  + 2.*(dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.))
5951                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
5952   five4n2n3n2n1n = ((pow(dImQ2n,2.)+pow(dReQ2n,2.))*(dImQ3n*dImQ4n*dReQ1n+dImQ1n*dImQ4n*dReQ3n 
5953                  - dImQ1n*dImQ3n*dReQ4n+dReQ1n*dReQ3n*dReQ4n)
5954                  - (dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
5955                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
5956                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
5957                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
5958                  - (dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
5959                  + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
5960                  - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n 
5961                  + dImQ1n*dImQ2n*dReQ4n*dReQ5n+dReQ1n*dReQ2n*dReQ4n*dReQ5n)
5962                  - ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
5963                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n)
5964                  - (dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
5965                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
5966                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
5967                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
5968                  - ((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) 
5969                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
5970                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
5971                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5972                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5973                  + 3.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5974                  + (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5975                  + pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n
5976                  + dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n
5977                  + 3.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5978                  - (dMult-7.)*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5979                  + 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5980                  + 7.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5981                  + 4.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5982                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5983                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5984                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5985                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5986                  + 2.*(dMult-7.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+(dMult-12.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5987                  - 2.*dMult*(dMult-12.))
5988                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
5989
5990   // *********************************************************************
5991   Double_t reQ7nQ3nstarQ2nstarQ2nstar = (dReQ7n*dReQ3n+dImQ7n*dImQ3n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
5992                                       + 2.*dReQ2n*dImQ2n*(dImQ7n*dReQ3n-dReQ7n*dImQ3n); 
5993   Double_t reQ5nQ2nQ4nstarQ3nstar = dImQ2n*dImQ3n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ2n*dReQ3n 
5994                                   + dImQ3n*dImQ5n*dReQ2n*dReQ4n-dImQ2n*dImQ5n*dReQ3n*dReQ4n
5995                                   - dImQ3n*dImQ4n*dReQ2n*dReQ5n+dImQ2n*dImQ4n*dReQ3n*dReQ5n 
5996                                   + dImQ2n*dImQ3n*dReQ4n*dReQ5n+dReQ2n*dReQ3n*dReQ4n*dReQ5n;
5997   Double_t reQ7nQ4nstarQ3nstar = dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n
5998                                + dImQ7n*dImQ4n*dReQ3n; 
5999
6000
6001   Double_t reQ7nQ5nstarQ2nstar = dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ5n*dImQ2n
6002                                + dImQ7n*dImQ5n*dReQ2n;
6003
6004   // <5>_{6n,4n|4n,3n,3n}:
6005   Double_t reQ10nQ4nstarQ3nstarQ3nstar = (dReQ10n*dReQ4n+dImQ10n*dImQ4n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
6006                                       + 2.*dReQ3n*dImQ3n*(dImQ10n*dReQ4n-dReQ10n*dImQ4n); 
6007   Double_t reQ7nQ3nQ6nstarQ4nstar = dImQ3n*dImQ4n*dImQ6n*dImQ7n+dImQ6n*dImQ7n*dReQ3n*dReQ4n 
6008                                   + dImQ4n*dImQ7n*dReQ3n*dReQ6n-dImQ3n*dImQ7n*dReQ4n*dReQ6n
6009                                   - dImQ4n*dImQ6n*dReQ3n*dReQ7n+dImQ3n*dImQ6n*dReQ4n*dReQ7n 
6010                                   + dImQ3n*dImQ4n*dReQ6n*dReQ7n+dReQ3n*dReQ4n*dReQ6n*dReQ7n;
6011   Double_t reQ10nQ7nstarQ3nstar = dReQ10n*dReQ7n*dReQ3n-dReQ10n*dImQ7n*dImQ3n+dImQ10n*dReQ7n*dImQ3n
6012                                 + dImQ10n*dImQ7n*dReQ3n; 
6013   Double_t reQ10nQ6nstarQ4nstar = dReQ10n*dReQ6n*dReQ4n-dReQ10n*dImQ6n*dImQ4n+dImQ10n*dReQ6n*dImQ4n
6014                                 + dImQ10n*dImQ6n*dReQ4n; 
6015   Double_t reQ6nQ1nQ4nstarQ3nstar = dImQ1n*dImQ3n*dImQ4n*dImQ6n+dImQ4n*dImQ6n*dReQ1n*dReQ3n 
6016                                   + dImQ3n*dImQ6n*dReQ1n*dReQ4n-dImQ1n*dImQ6n*dReQ3n*dReQ4n
6017                                   - dImQ3n*dImQ4n*dReQ1n*dReQ6n+dImQ1n*dImQ4n*dReQ3n*dReQ6n 
6018                                   + dImQ1n*dImQ3n*dReQ4n*dReQ6n+dReQ1n*dReQ3n*dReQ4n*dReQ6n;
6019   Double_t reQ7nQ6nstarQ1nstar = dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n
6020                                + dImQ7n*dImQ6n*dReQ1n;
6021  // <5>_{6n,5n|5n,3n,3n}:
6022  /*Double_t reQ11nQ5nstarQ3nstarQ3nstar = (dReQ11n*dReQ5n+dImQ11n*dImQ5n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
6023                                       + 2.*dReQ3n*dImQ3n*(dImQ11n*dReQ5n-dReQ11n*dImQ5n); */
6024  Double_t reQ6nQ2nQ5nstarQ3nstar = dImQ2n*dImQ3n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ2n*dReQ3n 
6025                                  + dImQ3n*dImQ6n*dReQ2n*dReQ5n-dImQ2n*dImQ6n*dReQ3n*dReQ5n
6026                                  - dImQ3n*dImQ5n*dReQ2n*dReQ6n+dImQ2n*dImQ5n*dReQ3n*dReQ6n 
6027                                  + dImQ2n*dImQ3n*dReQ5n*dReQ6n+dReQ2n*dReQ3n*dReQ5n*dReQ6n;
6028  Double_t reQ8nQ3nQ6nstarQ5nstar = dImQ3n*dImQ5n*dImQ6n*dImQ8n+dImQ6n*dImQ8n*dReQ3n*dReQ5n 
6029                                  + dImQ5n*dImQ8n*dReQ3n*dReQ6n-dImQ3n*dImQ8n*dReQ5n*dReQ6n
6030                                  - dImQ5n*dImQ6n*dReQ3n*dReQ8n+dImQ3n*dImQ6n*dReQ5n*dReQ8n 
6031                                  + dImQ3n*dImQ5n*dReQ6n*dReQ8n+dReQ3n*dReQ5n*dReQ6n*dReQ8n;
6032  Double_t reQ11nQ6nstarQ5nstar = dReQ11n*dReQ6n*dReQ5n-dReQ11n*dImQ6n*dImQ5n+dImQ11n*dReQ6n*dImQ5n
6033                                + dImQ11n*dImQ6n*dReQ5n;
6034  Double_t reQ8nQ6nstarQ2nstar = dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n
6035                               + dImQ8n*dImQ6n*dReQ2n; 
6036  Double_t reQ11nQ8nstarQ3nstar = dReQ11n*dReQ8n*dReQ3n-dReQ11n*dImQ8n*dImQ3n+dImQ11n*dReQ8n*dImQ3n
6037                                + dImQ11n*dImQ8n*dReQ3n;
6038  Double_t reQ8nQ5nstarQ3nstar = dReQ8n*dReQ5n*dReQ3n-dReQ8n*dImQ5n*dImQ3n+dImQ8n*dReQ5n*dImQ3n
6039                               + dImQ8n*dImQ5n*dReQ3n; 
6040  // <5>_{5n,2n|5n,1n,1n}
6041  Double_t reQ7nQ5nstarQ1nstarQ1nstar = (dReQ7n*dReQ5n+dImQ7n*dImQ5n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
6042                                       + 2.*dReQ1n*dImQ1n*(dImQ7n*dReQ5n-dReQ7n*dImQ5n); 
6043  Double_t reQ6nQ1nQ5nstarQ2nstar = dImQ1n*dImQ2n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ1n*dReQ2n 
6044                                  + dImQ2n*dImQ6n*dReQ1n*dReQ5n-dImQ1n*dImQ6n*dReQ2n*dReQ5n
6045                                  - dImQ2n*dImQ5n*dReQ1n*dReQ6n+dImQ1n*dImQ5n*dReQ2n*dReQ6n 
6046                                  + dImQ1n*dImQ2n*dReQ5n*dReQ6n+dReQ1n*dReQ2n*dReQ5n*dReQ6n;
6047  // <5>_{5n,4n|5n,2n,2n}
6048  Double_t reQ9nQ5nstarQ2nstarQ2nstar = (dReQ9n*dReQ5n+dImQ9n*dImQ5n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
6049                                      + 2.*dReQ2n*dImQ2n*(dImQ9n*dReQ5n-dReQ9n*dImQ5n);
6050  Double_t reQ7nQ2nQ5nstarQ4nstar = dImQ2n*dImQ4n*dImQ5n*dImQ7n+dImQ5n*dImQ7n*dReQ2n*dReQ4n 
6051                                  + dImQ4n*dImQ7n*dReQ2n*dReQ5n-dImQ2n*dImQ7n*dReQ4n*dReQ5n
6052                                  - dImQ4n*dImQ5n*dReQ2n*dReQ7n+dImQ2n*dImQ5n*dReQ4n*dReQ7n 
6053                                  + dImQ2n*dImQ4n*dReQ5n*dReQ7n+dReQ2n*dReQ4n*dReQ5n*dReQ7n;
6054  Double_t reQ9nQ5nstarQ4nstar = dReQ9n*dReQ5n*dReQ4n-dReQ9n*dImQ5n*dImQ4n+dImQ9n*dReQ5n*dImQ4n
6055                               + dImQ9n*dImQ5n*dReQ4n; 
6056  Double_t reQ9nQ7nstarQ2nstar = dReQ9n*dReQ7n*dReQ2n-dReQ9n*dImQ7n*dImQ2n+dImQ9n*dReQ7n*dImQ2n
6057                               + dImQ9n*dImQ7n*dReQ2n; 
6058  // <5>_{6n,2n|6n,1n,1n}
6059  Double_t reQ8nQ6nstarQ1nstarQ1nstar = (dReQ8n*dReQ6n+dImQ8n*dImQ6n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
6060                                      + 2.*dReQ1n*dImQ1n*(dImQ8n*dReQ6n-dReQ8n*dImQ6n);
6061  Double_t reQ7nQ1nQ6nstarQ2nstar = dImQ1n*dImQ2n*dImQ6n*dImQ7n+dImQ6n*dImQ7n*dReQ1n*dReQ2n 
6062                                  + dImQ2n*dImQ7n*dReQ1n*dReQ6n-dImQ1n*dImQ7n*dReQ2n*dReQ6n
6063                                  - dImQ2n*dImQ6n*dReQ1n*dReQ7n+dImQ1n*dImQ6n*dReQ2n*dReQ7n 
6064                                  + dImQ1n*dImQ2n*dReQ6n*dReQ7n+dReQ1n*dReQ2n*dReQ6n*dReQ7n;
6065  Double_t reQ8nQ7nstarQ1nstar = dReQ8n*dReQ7n*dReQ1n-dReQ8n*dImQ7n*dImQ1n+dImQ8n*dReQ7n*dImQ1n
6066                               + dImQ8n*dImQ7n*dReQ1n;
6067  // <5>_{5n,2n|4n,2n,1n}
6068  Double_t reQ5nQ2nQ4nstarQ2nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
6069                                         * (dReQ1n*dReQ4n*dReQ5n-dReQ5n*dImQ1n*dImQ4n 
6070                                         + dReQ4n*dImQ1n*dImQ5n+dReQ1n*dImQ4n*dImQ5n);
6071  Double_t reQ7nQ4nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ4n*dReQ7n-dReQ4n*dReQ7n*dImQ1n*dImQ2n 
6072                                      - dReQ2n*dReQ7n*dImQ1n*dImQ4n-dReQ1n*dReQ7n*dImQ2n*dImQ4n 
6073                                      + dReQ2n*dReQ4n*dImQ1n*dImQ7n+dReQ1n*dReQ4n*dImQ2n*dImQ7n 
6074                                      + dReQ1n*dReQ2n*dImQ4n*dImQ7n-dImQ1n*dImQ2n*dImQ4n*dImQ7n;
6075  // <5>_{4n,3n|4n,2n,1n}:
6076  Double_t reQ4nQ3nQ4nstarQ2nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n 
6077                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n) 
6078                                         * (pow(dReQ4n,2.)+pow(dImQ4n,2.));        
6079  /*
6080  Double_t reQ4nQ1nQ3nstarQ2nstar = dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
6081                                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
6082                                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
6083                                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n;
6084  */
6085  // <5>_{5n,3n|4n,3n,1n}:
6086  Double_t reQ5nQ3nQ4nstarQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))
6087                                         * (dReQ1n*dReQ4n*dReQ5n-dReQ5n*dImQ1n*dImQ4n 
6088                                         + dReQ4n*dImQ1n*dImQ5n+dReQ1n*dImQ4n*dImQ5n);
6089  Double_t reQ5nQ3nQ4nstarQ4nstar = dReQ3n*pow(dReQ4n,2.)*dReQ5n+2.*dReQ4n*dReQ5n*dImQ3n*dImQ4n 
6090                                  - dReQ3n*dReQ5n*pow(dImQ4n,2.)-pow(dReQ4n,2.)*dImQ3n*dImQ5n
6091                                  + 2.*dReQ3n*dReQ4n*dImQ4n*dImQ5n+dImQ3n*pow(dImQ4n,2.)*dImQ5n;
6092  Double_t reQ7nQ1nQ5nstarQ3nstar = dImQ1n*dImQ3n*dImQ5n*dImQ7n+dImQ5n*dImQ7n*dReQ1n*dReQ3n 
6093                                  + dImQ3n*dImQ7n*dReQ1n*dReQ5n-dImQ1n*dImQ7n*dReQ3n*dReQ5n
6094                                  - dImQ3n*dImQ5n*dReQ1n*dReQ7n+dImQ1n*dImQ5n*dReQ3n*dReQ7n 
6095                                  + dImQ1n*dImQ3n*dReQ5n*dReQ7n+dReQ1n*dReQ3n*dReQ5n*dReQ7n;             
6096  Double_t reQ8nQ4nstarQ3nstarQ1nstar = dReQ1n*dReQ3n*dReQ4n*dReQ8n-dReQ4n*dReQ8n*dImQ1n*dImQ3n 
6097                                      - dReQ3n*dReQ8n*dImQ1n*dImQ4n-dReQ1n*dReQ8n*dImQ3n*dImQ4n 
6098                                      + dReQ3n*dReQ4n*dImQ1n*dImQ8n+dReQ1n*dReQ4n*dImQ3n*dImQ8n 
6099                                      + dReQ1n*dReQ3n*dImQ4n*dImQ8n-dImQ1n*dImQ3n*dImQ4n*dImQ8n;
6100  Double_t reQ8nQ4nstarQ4nstar = pow(dReQ4n,2.)*dReQ8n-dReQ8n*pow(dImQ4n,2.)+2.*dReQ4n*dImQ4n*dImQ8n;
6101  // <5>_{5n,4n|4n,3n,2n}:
6102  Double_t reQ5nQ4nQ4nstarQ3nstarQ2nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))
6103                                         * (dReQ2n*dReQ3n*dReQ5n-dReQ5n*dImQ2n*dImQ3n 
6104                                         + dReQ3n*dImQ2n*dImQ5n+dReQ2n*dImQ3n*dImQ5n);
6105  Double_t reQ6nQ3nQ5nstarQ4nstar = dImQ4n*dImQ3n*dImQ6n*dImQ5n+dImQ6n*dImQ5n*dReQ4n*dReQ3n 
6106                                  + dImQ3n*dImQ5n*dReQ4n*dReQ6n-dImQ4n*dImQ5n*dReQ3n*dReQ6n
6107                                  - dImQ3n*dImQ6n*dReQ4n*dReQ5n+dImQ4n*dImQ6n*dReQ3n*dReQ5n 
6108                                  + dImQ4n*dImQ3n*dReQ6n*dReQ5n+dReQ4n*dReQ3n*dReQ6n*dReQ5n;
6109  Double_t reQ9nQ4nstarQ3nstarQ2nstar = dReQ2n*dReQ3n*dReQ4n*dReQ9n-dReQ4n*dReQ9n*dImQ2n*dImQ3n 
6110                                      - dReQ3n*dReQ9n*dImQ2n*dImQ4n-dReQ2n*dReQ9n*dImQ3n*dImQ4n 
6111                                      + dReQ3n*dReQ4n*dImQ2n*dImQ9n+dReQ2n*dReQ4n*dImQ3n*dImQ9n 
6112                                      + dReQ2n*dReQ3n*dImQ4n*dImQ9n-dImQ2n*dImQ3n*dImQ4n*dImQ9n;   
6113  Double_t reQ9nQ6nstarQ3nstar = dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n
6114                               + dImQ9n*dImQ6n*dReQ3n; 
6115  // <5>_{5n,3n|5n,2n,1n}:
6116  Double_t reQ5nQ3nQ5nstarQ2nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n 
6117                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n) 
6118                                         * (pow(dReQ5n,2.)+pow(dImQ5n,2.));
6119  Double_t reQ8nQ5nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ5n*dReQ8n-dReQ5n*dReQ8n*dImQ1n*dImQ2n 
6120                                      - dReQ2n*dReQ8n*dImQ1n*dImQ5n-dReQ1n*dReQ8n*dImQ2n*dImQ5n 
6121                                      + dReQ2n*dReQ5n*dImQ1n*dImQ8n+dReQ1n*dReQ5n*dImQ2n*dImQ8n 
6122                                      + dReQ1n*dReQ2n*dImQ5n*dImQ8n-dImQ1n*dImQ2n*dImQ5n*dImQ8n;
6123  // <5>_{5n,4n|5n,3n,1n}:
6124  Double_t reQ5nQ4nQ5nstarQ3nstarQ1nstar = (dReQ1n*dReQ3n*dReQ4n-dReQ4n*dImQ1n*dImQ3n 
6125                                         + dReQ3n*dImQ1n*dImQ4n+dReQ1n*dImQ3n*dImQ4n) 
6126                                         * (pow(dReQ5n,2.)+pow(dImQ5n,2.));
6127  Double_t reQ8nQ1nQ5nstarQ4nstar = dImQ4n*dImQ1n*dImQ8n*dImQ5n+dImQ8n*dImQ5n*dReQ4n*dReQ1n 
6128                                  + dImQ1n*dImQ5n*dReQ4n*dReQ8n-dImQ4n*dImQ5n*dReQ1n*dReQ8n
6129                                  - dImQ1n*dImQ8n*dReQ4n*dReQ5n+dImQ4n*dImQ8n*dReQ1n*dReQ5n 
6130                                  + dImQ4n*dImQ1n*dReQ8n*dReQ5n+dReQ4n*dReQ1n*dReQ8n*dReQ5n;                      
6131  Double_t reQ9nQ5nstarQ3nstarQ1nstar = dReQ1n*dReQ3n*dReQ5n*dReQ9n-dReQ5n*dReQ9n*dImQ1n*dImQ3n 
6132                                      - dReQ3n*dReQ9n*dImQ1n*dImQ5n-dReQ1n*dReQ9n*dImQ3n*dImQ5n 
6133                                      + dReQ3n*dReQ5n*dImQ1n*dImQ9n+dReQ1n*dReQ5n*dImQ3n*dImQ9n 
6134                                      + dReQ1n*dReQ3n*dImQ5n*dImQ9n-dImQ1n*dImQ3n*dImQ5n*dImQ9n;
6135  Double_t reQ9nQ8nstarQ1nstar = dReQ9n*dReQ8n*dReQ1n-dReQ9n*dImQ8n*dImQ1n+dImQ9n*dReQ8n*dImQ1n
6136                               + dImQ9n*dImQ8n*dReQ1n; 
6137  // <5>_{6n,1n|4n,2n,1n}:
6138  Double_t reQ6nQ1nQ4nstarQ2nstarQ1nstar = (dReQ2n*dReQ4n*dReQ6n-dReQ6n*dImQ2n*dImQ4n 
6139                                         + dReQ4n*dImQ2n*dImQ6n+dReQ2n*dImQ4n*dImQ6n) 
6140                                         * (pow(dReQ1n,2.)+pow(dImQ1n,2.));
6141  // <5>_{6n,3n|4n,3n,2n}:
6142  Double_t reQ6nQ3nQ4nstarQ3nstarQ2nstar = (dReQ2n*dReQ4n*dReQ6n-dReQ6n*dImQ2n*dImQ4n 
6143                                         + dReQ4n*dImQ2n*dImQ6n+dReQ2n*dImQ4n*dImQ6n) 
6144                                         * (pow(dReQ3n,2.)+pow(dImQ3n,2.));
6145  Double_t reQ7nQ2nQ6nstarQ3nstar = dImQ3n*dImQ2n*dImQ7n*dImQ6n+dImQ7n*dImQ6n*dReQ3n*dReQ2n 
6146                                  + dImQ2n*dImQ6n*dReQ3n*dReQ7n-dImQ3n*dImQ6n*dReQ2n*dReQ7n
6147                                  - dImQ2n*dImQ7n*dReQ3n*dReQ6n+dImQ3n*dImQ7n*dReQ2n*dReQ6n 
6148                                  + dImQ3n*dImQ2n*dReQ7n*dReQ6n+dReQ3n*dReQ2n*dReQ7n*dReQ6n;                      
6149  // <5>_{6n,2n|5n,2n,1n}:
6150  Double_t reQ6nQ2nQ5nstarQ2nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
6151                                         * (dReQ1n*dReQ5n*dReQ6n-dReQ6n*dImQ1n*dImQ5n 
6152                                         + dReQ5n*dImQ1n*dImQ6n+dReQ1n*dImQ5n*dImQ6n);
6153  // <5>_{6n,3n|5n,3n,1n}:
6154  Double_t reQ6nQ3nQ5nstarQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))
6155                                         * (dReQ1n*dReQ5n*dReQ6n-dReQ6n*dImQ1n*dImQ5n 
6156                                         + dReQ5n*dImQ1n*dImQ6n+dReQ1n*dImQ5n*dImQ6n);
6157  Double_t reQ8nQ1nQ6nstarQ3nstar = dImQ3n*dImQ1n*dImQ8n*dImQ6n+dImQ8n*dImQ6n*dReQ3n*dReQ1n 
6158                                  + dImQ1n*dImQ6n*dReQ3n*dReQ8n-dImQ3n*dImQ6n*dReQ1n*dReQ8n
6159                                  - dImQ1n*dImQ8n*dReQ3n*dReQ6n+dImQ3n*dImQ8n*dReQ1n*dReQ6n 
6160                                  + dImQ3n*dImQ1n*dReQ8n*dReQ6n+dReQ3n*dReQ1n*dReQ8n*dReQ6n;                      
6161  // <5>_{6n,4n|5n,4n,1n}:
6162  Double_t reQ6nQ4nQ5nstarQ4nstarQ1nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))
6163                                         * (dReQ1n*dReQ5n*dReQ6n-dReQ6n*dImQ1n*dImQ5n 
6164                                         + dReQ5n*dImQ1n*dImQ6n+dReQ1n*dImQ5n*dImQ6n);
6165  Double_t reQ6nQ4nQ5nstarQ5nstar = dReQ4n*pow(dReQ5n,2.)*dReQ6n+2.*dReQ5n*dReQ6n*dImQ4n*dImQ5n 
6166                                  - dReQ4n*dReQ6n*pow(dImQ5n,2.)-pow(dReQ5n,2.)*dImQ4n*dImQ6n
6167                                  + 2.*dReQ4n*dReQ5n*dImQ5n*dImQ6n+dImQ4n*pow(dImQ5n,2.)*dImQ6n;
6168  Double_t reQ9nQ1nQ6nstarQ4nstar = dImQ4n*dImQ1n*dImQ9n*dImQ6n+dImQ9n*dImQ6n*dReQ4n*dReQ1n 
6169                                  + dImQ1n*dImQ6n*dReQ4n*dReQ9n-dImQ4n*dImQ6n*dReQ1n*dReQ9n
6170                                  - dImQ1n*dImQ9n*dReQ4n*dReQ6n+dImQ4n*dImQ9n*dReQ1n*dReQ6n 
6171                                  + dImQ4n*dImQ1n*dReQ9n*dReQ6n+dReQ4n*dReQ1n*dReQ9n*dReQ6n;
6172  Double_t reQ10nQ5nstarQ4nstarQ1nstar = dReQ1n*dReQ4n*dReQ5n*dReQ10n-dReQ5n*dReQ10n*dImQ1n*dImQ4n 
6173                                       - dReQ4n*dReQ10n*dImQ1n*dImQ5n-dReQ1n*dReQ10n*dImQ4n*dImQ5n 
6174                                       + dReQ4n*dReQ5n*dImQ1n*dImQ10n+dReQ1n*dReQ5n*dImQ4n*dImQ10n 
6175                                       + dReQ1n*dReQ4n*dImQ5n*dImQ10n-dImQ1n*dImQ4n*dImQ5n*dImQ10n;
6176  Double_t reQ10nQ9nstarQ1nstar = dReQ10n*dReQ9n*dReQ1n-dReQ10n*dImQ9n*dImQ1n+dImQ10n*dReQ9n*dImQ1n
6177                                + dImQ10n*dImQ9n*dReQ1n;
6178  Double_t reQ10nQ5nstarQ5nstar = pow(dReQ5n,2.)*dReQ10n-dReQ10n*pow(dImQ5n,2.)+2.*dReQ5n*dImQ5n*dImQ10n;
6179  // <5>_{6n,3n|6n,2n,1n}:
6180  Double_t reQ6nQ3nQ6nstarQ2nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n 
6181                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n) 
6182                                         * (pow(dReQ6n,2.)+pow(dImQ6n,2.));
6183  Double_t reQ9nQ6nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ6n*dReQ9n-dReQ6n*dReQ9n*dImQ1n*dImQ2n 
6184                                      - dReQ2n*dReQ9n*dImQ1n*dImQ6n-dReQ1n*dReQ9n*dImQ2n*dImQ6n 
6185                                      + dReQ2n*dReQ6n*dImQ1n*dImQ9n+dReQ1n*dReQ6n*dImQ2n*dImQ9n 
6186                                      + dReQ1n*dReQ2n*dImQ6n*dImQ9n-dImQ1n*dImQ2n*dImQ6n*dImQ9n;
6187  // <5>_{6n,4n|6n,3n,1n}:
6188  Double_t reQ6nQ4nQ6nstarQ3nstarQ1nstar = (dReQ1n*dReQ3n*dReQ4n-dReQ4n*dImQ1n*dImQ3n 
6189                                         + dReQ3n*dImQ1n*dImQ4n+dReQ1n*dImQ3n*dImQ4n) 
6190                                         * (pow(dReQ6n,2.)+pow(dImQ6n,2.));
6191  Double_t reQ10nQ6nstarQ3nstarQ1nstar = dReQ1n*dReQ3n*dReQ6n*dReQ10n-dReQ6n*dReQ10n*dImQ1n*dImQ3n 
6192                                       - dReQ3n*dReQ10n*dImQ1n*dImQ6n-dReQ1n*dReQ10n*dImQ3n*dImQ6n 
6193                                       + dReQ3n*dReQ6n*dImQ1n*dImQ10n+dReQ1n*dReQ6n*dImQ3n*dImQ10n 
6194                                       + dReQ1n*dReQ3n*dImQ6n*dImQ10n-dImQ1n*dImQ3n*dImQ6n*dImQ10n;
6195  // <5>_{6n,5n|5n,4n,2n}:
6196  Double_t reQ6nQ5nQ5nstarQ4nstarQ2nstar = (dReQ2n*dReQ4n*dReQ6n-dReQ6n*dImQ2n*dImQ4n 
6197                                         + dReQ4n*dImQ2n*dImQ6n+dReQ2n*dImQ4n*dImQ6n) 
6198                                         * (pow(dReQ5n,2.)+pow(dImQ5n,2.));
6199  Double_t reQ7nQ4nQ6nstarQ5nstar = dImQ5n*dImQ4n*dImQ7n*dImQ6n+dImQ7n*dImQ6n*dReQ5n*dReQ4n 
6200                                  + dImQ4n*dImQ6n*dReQ5n*dReQ7n-dImQ5n*dImQ6n*dReQ4n*dReQ7n
6201                                  - dImQ4n*dImQ7n*dReQ5n*dReQ6n+dImQ5n*dImQ7n*dReQ4n*dReQ6n 
6202                                  + dImQ5n*dImQ4n*dReQ7n*dReQ6n+dReQ5n*dReQ4n*dReQ7n*dReQ6n;
6203  Double_t reQ9nQ2nQ6nstarQ5nstar = dImQ5n*dImQ2n*dImQ9n*dImQ6n+dImQ9n*dImQ6n*dReQ5n*dReQ2n 
6204                                  + dImQ2n*dImQ6n*dReQ5n*dReQ9n-dImQ5n*dImQ6n*dReQ2n*dReQ9n
6205                                  - dImQ2n*dImQ9n*dReQ5n*dReQ6n+dImQ5n*dImQ9n*dReQ2n*dReQ6n 
6206                                  + dImQ5n*dImQ2n*dReQ9n*dReQ6n+dReQ5n*dReQ2n*dReQ9n*dReQ6n;
6207  Double_t reQ11nQ5nstarQ4nstarQ2nstar = dReQ2n*dReQ4n*dReQ5n*dReQ11n-dReQ5n*dReQ11n*dImQ2n*dImQ4n 
6208                                       - dReQ4n*dReQ11n*dImQ2n*dImQ5n-dReQ2n*dReQ11n*dImQ4n*dImQ5n 
6209                                       + dReQ4n*dReQ5n*dImQ2n*dImQ11n+dReQ2n*dReQ5n*dImQ4n*dImQ11n 
6210                                       + dReQ2n*dReQ4n*dImQ5n*dImQ11n-dImQ2n*dImQ4n*dImQ5n*dImQ11n;
6211  Double_t reQ11nQ9nstarQ2nstar = dReQ11n*dReQ9n*dReQ2n-dReQ11n*dImQ9n*dImQ2n+dImQ11n*dReQ9n*dImQ2n
6212                                + dImQ11n*dImQ9n*dReQ2n;
6213  Double_t reQ11nQ7nstarQ4nstar = dReQ11n*dReQ7n*dReQ4n-dReQ11n*dImQ7n*dImQ4n+dImQ11n*dReQ7n*dImQ4n
6214                                + dImQ11n*dImQ7n*dReQ4n;
6215  // <5>_{6n,5n|6n,3n,2n}:
6216  Double_t reQ6nQ5nQ6nstarQ3nstarQ2nstar = (dReQ2n*dReQ3n*dReQ5n-dReQ5n*dImQ2n*dImQ3n 
6217                                         + dReQ3n*dImQ2n*dImQ5n+dReQ2n*dImQ3n*dImQ5n) 
6218                                         * (pow(dReQ6n,2.)+pow(dImQ6n,2.));
6219  Double_t reQ11nQ6nstarQ3nstarQ2nstar = dReQ2n*dReQ3n*dReQ6n*dReQ11n-dReQ6n*dReQ11n*dImQ2n*dImQ3n 
6220                                       - dReQ3n*dReQ11n*dImQ2n*dImQ6n-dReQ2n*dReQ11n*dImQ3n*dImQ6n 
6221                                       + dReQ3n*dReQ6n*dImQ2n*dImQ11n+dReQ2n*dReQ6n*dImQ3n*dImQ11n 
6222                                       + dReQ2n*dReQ3n*dImQ6n*dImQ11n-dImQ2n*dImQ3n*dImQ6n*dImQ11n;
6223  // <5>_{6n,5n|6n,4n,1n}:
6224  Double_t reQ6nQ5nQ6nstarQ4nstarQ1nstar = (dReQ1n*dReQ4n*dReQ5n-dReQ5n*dImQ1n*dImQ4n 
6225                                         + dReQ4n*dImQ1n*dImQ5n+dReQ1n*dImQ4n*dImQ5n) 
6226                                         * (pow(dReQ6n,2.)+pow(dImQ6n,2.));
6227  Double_t reQ10nQ1nQ6nstarQ5nstar = dImQ5n*dImQ1n*dImQ10n*dImQ6n+dImQ10n*dImQ6n*dReQ5n*dReQ1n 
6228                                   + dImQ1n*dImQ6n*dReQ5n*dReQ10n-dImQ5n*dImQ6n*dReQ1n*dReQ10n
6229                                   - dImQ1n*dImQ10n*dReQ5n*dReQ6n+dImQ5n*dImQ10n*dReQ1n*dReQ6n 
6230                                   + dImQ5n*dImQ1n*dReQ10n*dReQ6n+dReQ5n*dReQ1n*dReQ10n*dReQ6n;
6231  Double_t reQ11nQ10nstarQ1nstar = dReQ11n*dReQ10n*dReQ1n-dReQ11n*dImQ10n*dImQ1n+dImQ11n*dReQ10n*dImQ1n
6232                                 + dImQ11n*dImQ10n*dReQ1n;
6233  Double_t reQ11nQ6nstarQ4nstarQ1nstar = dReQ1n*dReQ4n*dReQ6n*dReQ11n-dReQ6n*dReQ11n*dImQ1n*dImQ4n 
6234                                       - dReQ4n*dReQ11n*dImQ1n*dImQ6n-dReQ1n*dReQ11n*dImQ4n*dImQ6n 
6235                                       + dReQ4n*dReQ6n*dImQ1n*dImQ11n+dReQ1n*dReQ6n*dImQ4n*dImQ11n 
6236                                       + dReQ1n*dReQ4n*dImQ6n*dImQ11n-dImQ1n*dImQ4n*dImQ6n*dImQ11n;
6237  // <5>_{4n,1n|3n,1n,1n}:
6238  Double_t reQ4nQ1nQ3nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
6239                                         * (dReQ1n*dReQ3n*dReQ4n-dReQ4n*dImQ1n*dImQ3n
6240                                         + dReQ3n*dImQ1n*dImQ4n+dReQ1n*dImQ3n*dImQ4n);
6241  Double_t reQ4nQ1nQ4nstarQ1nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
6242  Double_t reQ3nQ1nQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
6243  // <5>_{4n,3n|3n,3n,1n}:
6244  Double_t reQ4nQ3nQ3nstarQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))
6245                                         * (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)); 
6246  Double_t reQ7nQ3nstarQ3nstarQ1nstar = (dReQ7n*dReQ1n+dImQ7n*dImQ1n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
6247                                      + 2.*dReQ3n*dImQ3n*(dImQ7n*dReQ1n-dReQ7n*dImQ1n); 
6248  // <5>_{4n,4n|4n,3n,1n}:
6249  Double_t reQ4nQ4nQ4nstarQ3nstarQ1nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))
6250                                         * reQ4nQ3nstarQ1nstar;
6251  Double_t reQ7nQ1nQ4nstarQ4nstar = dReQ1n*pow(dReQ4n,2.)*dReQ7n+2.*dReQ4n*dReQ7n*dImQ1n*dImQ4n 
6252                                  - dReQ1n*dReQ7n*pow(dImQ4n,2.)-pow(dReQ4n,2.)*dImQ1n*dImQ7n
6253                                  + 2.*dReQ1n*dReQ4n*dImQ4n*dImQ7n+dImQ1n*pow(dImQ4n,2.)*dImQ7n;
6254  // <5>_{5n,2n|3n,2n,2n}:
6255  Double_t reQ5nQ2nQ3nstarQ2nstarQ2nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
6256                                         * reQ5nQ3nstarQ2nstar;
6257  // <5>_{5n,3n|3n,3n,2n}:
6258  Double_t reQ5nQ3nQ3nstarQ3nstarQ2nstar = (pow(dImQ3n,2.)+pow(dReQ3n,2.))
6259                                         * (dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n 
6260                                         - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n);
6261  Double_t reQ8nQ3nstarQ3nstarQ2nstar = (dReQ8n*dReQ2n+dImQ8n*dImQ2n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
6262                                      + 2.*dReQ3n*dImQ3n*(dImQ8n*dReQ2n-dReQ8n*dImQ2n);
6263  /*
6264  Double_t reQ5nQ1nQ3nstarQ2nstar = dImQ2n*dImQ1n*dImQ5n*dImQ3n+dImQ5n*dImQ3n*dReQ2n*dReQ1n 
6265                                  + dImQ1n*dImQ3n*dReQ2n*dReQ5n-dImQ2n*dImQ3n*dReQ1n*dReQ5n
6266                                  - dImQ1n*dImQ5n*dReQ2n*dReQ3n+dImQ2n*dImQ5n*dReQ1n*dReQ3n 
6267                                  + dImQ2n*dImQ1n*dReQ5n*dReQ3n+dReQ2n*dReQ1n*dReQ5n*dReQ3n;
6268  */
6269  // <5>_{5n,1n|4n,1n,1n}:
6270  Double_t reQ5nQ1nQ4nstarQ1nstarQ1nstar = (pow(dImQ1n,2.)+pow(dReQ1n,2.))
6271                                         * (dImQ1n*dImQ5n*dReQ4n+dImQ4n*dImQ5n*dReQ1n 
6272                                         - dImQ4n*dImQ1n*dReQ5n+dReQ4n*dReQ1n*dReQ5n);
6273  // <5>_{5n,4n|4n,4n,1n}:
6274  Double_t reQ5nQ4nQ4nstarQ4nstarQ1nstar = (pow(dImQ4n,2.)+pow(dReQ4n,2.))
6275                                         * (dImQ4n*dImQ5n*dReQ1n+dImQ1n*dImQ5n*dReQ4n 
6276                                         - dImQ1n*dImQ4n*dReQ5n+dReQ1n*dReQ4n*dReQ5n);
6277  Double_t reQ9nQ4nstarQ4nstarQ1nstar = (dReQ9n*dReQ1n+dImQ9n*dImQ1n)*(pow(dReQ4n,2)-pow(dImQ4n,2)) 
6278                                      + 2.*dReQ4n*dImQ4n*(dImQ9n*dReQ1n-dReQ9n*dImQ1n);
6279  // <5>_{5n,5n|5n,3n,2n}:
6280  Double_t reQ5nQ5nQ5nstarQ3nstarQ2nstar = (pow(dImQ5n,2.)+pow(dReQ5n,2.))
6281                                         * (dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n
6282                                         - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n);
6283  Double_t reQ7nQ3nQ5nstarQ5nstar = dReQ3n*pow(dReQ5n,2.)*dReQ7n+2.*dReQ5n*dReQ7n*dImQ3n*dImQ5n 
6284                                  - dReQ3n*dReQ7n*pow(dImQ5n,2.)-pow(dReQ5n,2.)*dImQ3n*dImQ7n
6285                                  + 2.*dReQ3n*dReQ5n*dImQ5n*dImQ7n+dImQ3n*pow(dImQ5n,2.)*dImQ7n;
6286  Double_t reQ8nQ2nQ5nstarQ5nstar = dReQ2n*pow(dReQ5n,2.)*dReQ8n+2.*dReQ5n*dReQ8n*dImQ2n*dImQ5n 
6287                                  - dReQ2n*dReQ8n*pow(dImQ5n,2.)-pow(dReQ5n,2.)*dImQ2n*dImQ8n
6288                                  + 2.*dReQ2n*dReQ5n*dImQ5n*dImQ8n+dImQ2n*pow(dImQ5n,2.)*dImQ8n;
6289  Double_t reQ10nQ5nstarQ3nstarQ2nstar = dReQ2n*dReQ3n*dReQ5n*dReQ10n-dReQ5n*dReQ10n*dImQ2n*dImQ3n 
6290                                       - dReQ3n*dReQ10n*dImQ2n*dImQ5n-dReQ2n*dReQ10n*dImQ3n*dImQ5n 
6291                                       + dReQ3n*dReQ5n*dImQ2n*dImQ10n+dReQ2n*dReQ5n*dImQ3n*dImQ10n 
6292                                       + dReQ2n*dReQ3n*dImQ5n*dImQ10n-dImQ2n*dImQ3n*dImQ5n*dImQ10n;
6293  Double_t reQ10nQ8nstarQ2nstar = dReQ10n*dReQ8n*dReQ2n-dReQ10n*dImQ8n*dImQ2n+dImQ10n*dReQ8n*dImQ2n
6294                                + dImQ10n*dImQ8n*dReQ2n;
6295  // <5>_{5n,5n|5n,4n,1n}:
6296  Double_t reQ5nQ5nQ5nstarQ4nstarQ1nstar = (pow(dImQ5n,2.)+pow(dReQ5n,2.))
6297                                         * (dImQ4n*dImQ5n*dReQ1n+dImQ1n*dImQ5n*dReQ4n
6298                                         - dImQ1n*dImQ4n*dReQ5n+dReQ1n*dReQ4n*dReQ5n);
6299  Double_t reQ9nQ1nQ5nstarQ5nstar = dReQ1n*pow(dReQ5n,2.)*dReQ9n+2.*dReQ5n*dReQ9n*dImQ1n*dImQ5n 
6300                                  - dReQ1n*dReQ9n*pow(dImQ5n,2.)-pow(dReQ5n,2.)*dImQ1n*dImQ9n
6301                                  + 2.*dReQ1n*dReQ5n*dImQ5n*dImQ9n+dImQ1n*pow(dImQ5n,2.)*dImQ9n;
6302  // <5>_{6n,1n|5n,1n,1n}:
6303  Double_t reQ6nQ1nQ5nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
6304                                         * (dReQ1n*dReQ5n*dReQ6n-dReQ6n*dImQ1n*dImQ5n
6305                                         + dReQ5n*dImQ1n*dImQ6n+dReQ1n*dImQ5n*dImQ6n);
6306  // <5>_{6n,5n|5n,5n,1n}:
6307  Double_t reQ6nQ5nQ5nstarQ5nstarQ1nstar = (pow(dImQ5n,2.)+pow(dReQ5n,2.))
6308                                         * (dImQ5n*dImQ6n*dReQ1n+dImQ1n*dImQ6n*dReQ5n 
6309                                         - dImQ1n*dImQ5n*dReQ6n+dReQ1n*dReQ5n*dReQ6n);
6310  Double_t reQ11nQ5nstarQ5nstarQ1nstar = (dReQ11n*dReQ1n+dImQ11n*dImQ1n)*(pow(dReQ5n,2)-pow(dImQ5n,2)) 
6311                                       + 2.*dReQ5n*dImQ5n*(dImQ11n*dReQ1n-dReQ11n*dImQ1n);
6312  // <5>_{6n,6n|6n,5n,1n}:
6313  Double_t reQ6nQ6nQ6nstarQ5nstarQ1nstar = (pow(dReQ6n,2.)+pow(dImQ6n,2.))
6314                                         * reQ6nQ5nstarQ1nstar;
6315  Double_t reQ7nQ5nQ6nstarQ6nstar = dReQ5n*pow(dReQ6n,2.)*dReQ7n+2.*dReQ6n*dReQ7n*dImQ5n*dImQ6n 
6316                                  - dReQ5n*dReQ7n*pow(dImQ6n,2.)-pow(dReQ6n,2.)*dImQ5n*dImQ7n
6317                                  + 2.*dReQ5n*dReQ6n*dImQ6n*dImQ7n+dImQ5n*pow(dImQ6n,2.)*dImQ7n;
6318  Double_t reQ11nQ1nQ6nstarQ6nstar = dReQ1n*pow(dReQ6n,2.)*dReQ11n+2.*dReQ6n*dReQ11n*dImQ1n*dImQ6n 
6319                                   - dReQ1n*dReQ11n*pow(dImQ6n,2.)-pow(dReQ6n,2.)*dImQ1n*dImQ11n
6320                                   + 2.*dReQ1n*dReQ6n*dImQ6n*dImQ11n+dImQ1n*pow(dImQ6n,2.)*dImQ11n;
6321  Double_t reQ12nQ6nstarQ6nstar = pow(dReQ6n,2.)*dReQ12n-dReQ12n*pow(dImQ6n,2.)+2.*dReQ6n*dImQ6n*dImQ12n;
6322  Double_t reQ12nQ11nstarQ1nstar = dReQ12n*dReQ11n*dReQ1n-dReQ12n*dImQ11n*dImQ1n+dImQ12n*dReQ11n*dImQ1n
6323                                 + dImQ12n*dImQ11n*dReQ1n;
6324  Double_t reQ12nQ6nstarQ5nstarQ1nstar = dReQ1n*dReQ5n*dReQ6n*dReQ12n-dReQ6n*dReQ12n*dImQ1n*dImQ5n 
6325                                       - dReQ5n*dReQ12n*dImQ1n*dImQ6n-dReQ1n*dReQ12n*dImQ5n*dImQ6n 
6326                                       + dReQ5n*dReQ6n*dImQ1n*dImQ12n+dReQ1n*dReQ6n*dImQ5n*dImQ12n 
6327                                       + dReQ1n*dReQ5n*dImQ6n*dImQ12n-dImQ1n*dImQ5n*dImQ6n*dImQ12n;
6328  Double_t reQ12nQ7nstarQ5nstar = dReQ12n*dReQ7n*dReQ5n-dReQ12n*dImQ7n*dImQ5n+dImQ12n*dReQ7n*dImQ5n
6329                                + dImQ12n*dImQ7n*dReQ5n;
6330  // <5>_{6n,2n|4n,3n,1n}:
6331  Double_t reQ6nQ2nQ4nstarQ3nstarQ1nstar = dReQ1n*dReQ2n*dReQ3n*dReQ4n*dReQ6n+dReQ3n*dReQ4n*dReQ6n*dImQ1n*dImQ2n 
6332                                         - dReQ2n*dReQ4n*dReQ6n*dImQ1n*dImQ3n+dReQ1n*dReQ4n*dReQ6n*dImQ2n*dImQ3n 
6333                                         - dReQ2n*dReQ3n*dReQ6n*dImQ1n*dImQ4n+dReQ1n*dReQ3n*dReQ6n*dImQ2n*dImQ4n
6334                                         - dReQ1n*dReQ2n*dReQ6n*dImQ3n*dImQ4n-dReQ6n*dImQ1n*dImQ2n*dImQ3n*dImQ4n 
6335                                         + dReQ2n*dReQ3n*dReQ4n*dImQ1n*dImQ6n-dReQ1n*dReQ3n*dReQ4n*dImQ2n*dImQ6n 
6336                                         + dReQ1n*dReQ2n*dReQ4n*dImQ3n*dImQ6n+dReQ4n*dImQ1n*dImQ2n*dImQ3n*dImQ6n 
6337                                         + dReQ1n*dReQ2n*dReQ3n*dImQ4n*dImQ6n+dReQ3n*dImQ1n*dImQ2n*dImQ4n*dImQ6n 
6338                                         - dReQ2n*dImQ1n*dImQ3n*dImQ4n*dImQ6n+dReQ1n*dImQ2n*dImQ3n*dImQ4n*dImQ6n;
6339  Double_t reQ6nQ2nQ4nstarQ4nstar = dReQ2n*pow(dReQ4n,2.)*dReQ6n+2.*dReQ4n*dReQ6n*dImQ2n*dImQ4n 
6340                                  - dReQ2n*dReQ6n*pow(dImQ4n,2.)-pow(dReQ4n,2.)*dImQ2n*dImQ6n
6341                                  + 2.*dReQ2n*dReQ4n*dImQ4n*dImQ6n+dImQ2n*pow(dImQ4n,2.)*dImQ6n;
6342  // <5>_{6n,2n,1n|5n,4n}:
6343  Double_t reQ6nQ2nQ1nQ5nstarQ4nstar = dReQ1n*dReQ2n*dReQ4n*dReQ6n*dReQ5n - dReQ4n*dReQ6n*dReQ5n*dImQ1n*dImQ2n 
6344                                     + dReQ2n*dReQ6n*dReQ5n*dImQ1n*dImQ4n + dReQ1n*dReQ6n*dReQ5n*dImQ2n*dImQ4n
6345                                     - dReQ2n*dReQ4n*dReQ5n*dImQ1n*dImQ6n - dReQ1n*dReQ4n*dReQ5n*dImQ2n*dImQ6n 
6346                                     + dReQ1n*dReQ2n*dReQ5n*dImQ4n*dImQ6n - dReQ5n*dImQ1n*dImQ2n*dImQ4n*dImQ6n 
6347                                     + dReQ2n*dReQ4n*dReQ6n*dImQ1n*dImQ5n + dReQ1n*dReQ4n*dReQ6n*dImQ2n*dImQ5n 
6348                                     - dReQ1n*dReQ2n*dReQ6n*dImQ4n*dImQ5n + dReQ6n*dImQ1n*dImQ2n*dImQ4n*dImQ5n 
6349                                     + dReQ1n*dReQ2n*dReQ4n*dImQ6n*dImQ5n - dReQ4n*dImQ1n*dImQ2n*dImQ6n*dImQ5n 
6350                                     + dReQ2n*dImQ1n*dImQ4n*dImQ6n*dImQ5n + dReQ1n*dImQ2n*dImQ4n*dImQ6n*dImQ5n;
6351
6352  // <5>_{6n,4n|5n,3n,2n}:
6353  Double_t reQ6nQ4nQ5nstarQ3nstarQ2nstar = dReQ2n*dReQ3n*dReQ4n*dReQ5n*dReQ6n - dReQ4n*dReQ5n*dReQ6n*dImQ2n*dImQ3n 
6354                                         + dReQ3n*dReQ5n*dReQ6n*dImQ2n*dImQ4n + dReQ2n*dReQ5n*dReQ6n*dImQ3n*dImQ4n
6355                                         - dReQ3n*dReQ4n*dReQ6n*dImQ2n*dImQ5n - dReQ2n*dReQ4n*dReQ6n*dImQ3n*dImQ5n 
6356                                         + dReQ2n*dReQ3n*dReQ6n*dImQ4n*dImQ5n - dReQ6n*dImQ2n*dImQ3n*dImQ4n*dImQ5n 
6357                                         + dReQ3n*dReQ4n*dReQ5n*dImQ2n*dImQ6n + dReQ2n*dReQ4n*dReQ5n*dImQ3n*dImQ6n 
6358                                         - dReQ2n*dReQ3n*dReQ5n*dImQ4n*dImQ6n + dReQ5n*dImQ2n*dImQ3n*dImQ4n*dImQ6n 
6359                                         + dReQ2n*dReQ3n*dReQ4n*dImQ5n*dImQ6n - dReQ4n*dImQ2n*dImQ3n*dImQ5n*dImQ6n 
6360                                         + dReQ3n*dImQ2n*dImQ4n*dImQ5n*dImQ6n + dReQ2n*dImQ3n*dImQ4n*dImQ5n*dImQ6n;
6361  Double_t reQ8nQ2nQ6nstarQ4nstar = dImQ4n*dImQ2n*dImQ8n*dImQ6n+dImQ8n*dImQ6n*dReQ4n*dReQ2n 
6362                                  + dImQ2n*dImQ6n*dReQ4n*dReQ8n-dImQ4n*dImQ6n*dReQ2n*dReQ8n
6363                                  - dImQ2n*dImQ8n*dReQ4n*dReQ6n+dImQ4n*dImQ8n*dReQ2n*dReQ6n 
6364                                  + dImQ4n*dImQ2n*dReQ8n*dReQ6n+dReQ4n*dReQ2n*dReQ8n*dReQ6n;
6365
6366  // <5>_{4n,4n|3n,3n,2n}:
6367  Double_t reQ4nQ4nQ3nstarQ3nstarQ2nstar = dReQ2n*pow(dReQ3n,2.)*pow(dReQ4n,2.)-2.*dReQ3n*pow(dReQ4n,2.)*dImQ2n*dImQ3n 
6368                                         - dReQ2n*pow(dReQ4n,2.)*pow(dImQ3n,2.)+2.*pow(dReQ3n,2.)*dReQ4n*dImQ2n*dImQ4n 
6369                                         + 4.*dReQ2n*dReQ3n*dReQ4n*dImQ3n*dImQ4n - 2.*dReQ4n*dImQ2n*pow(dImQ3n,2.)*dImQ4n
6370                                         - dReQ2n*pow(dReQ3n,2.)*pow(dImQ4n,2.) + 2.*dReQ3n*dImQ2n*dImQ3n*pow(dImQ4n,2.) 
6371                                         + dReQ2n*pow(dImQ3n,2.)*pow(dImQ4n,2.);
6372
6373  // <5>_{5n|2n,1n,1n,1n}:
6374  Double_t reQ5nQ2nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,3.)*dReQ2n*dReQ5n-3.*dReQ1n*dReQ2n*dReQ5n*pow(dImQ1n,2.) 
6375                                             - 3.*pow(dReQ1n,2.)*dReQ5n*dImQ1n*dImQ2n+dReQ5n*pow(dImQ1n,3.)*dImQ2n 
6376                                             + 3.*pow(dReQ1n,2.)*dReQ2n*dImQ1n*dImQ5n-dReQ2n*pow(dImQ1n,3.)*dImQ5n
6377                                             + pow(dReQ1n,3.)*dImQ2n*dImQ5n-3.*dReQ1n*pow(dImQ1n,2.)*dImQ2n*dImQ5n;
6378
6379  // <5>_{5n,1n|2n,2n,2n}:
6380  Double_t reQ5nQ1nQ2nstarQ2nstarQ2nstar = dReQ1n*pow(dReQ2n,3.)*dReQ5n+3.*pow(dReQ2n,2.)*dReQ5n*dImQ1n*dImQ2n
6381                                         - 3.*dReQ1n*dReQ2n*dReQ5n*pow(dImQ2n,2.)-dReQ5n*dImQ1n*pow(dImQ2n,3.) 
6382                                         - pow(dReQ2n,3.)*dImQ1n*dImQ5n+3.*dReQ1n*pow(dReQ2n,2.)*dImQ2n*dImQ5n 
6383                                         + 3.*dReQ2n*dImQ1n*pow(dImQ2n,2.)*dImQ5n-dReQ1n*pow(dImQ2n,3.)*dImQ5n;
6384
6385
6386  // <5>_{5n,4n|3n,3n,3n}:
6387  Double_t reQ5nQ4nQ3nstarQ3nstarQ3nstar = dReQ4n*pow(dReQ3n,3.)*dReQ5n+3.*pow(dReQ3n,2.)*dReQ5n*dImQ4n*dImQ3n
6388                                         - 3.*dReQ4n*dReQ3n*dReQ5n*pow(dImQ3n,2.)-dReQ5n*dImQ4n*pow(dImQ3n,3.) 
6389                                         - pow(dReQ3n,3.)*dImQ4n*dImQ5n+3.*dReQ4n*pow(dReQ3n,2.)*dImQ3n*dImQ5n 
6390                                         + 3.*dReQ3n*dImQ4n*pow(dImQ3n,2.)*dImQ5n-dReQ4n*pow(dImQ3n,3.)*dImQ5n;
6391
6392  Double_t reQ9nQ3nstarQ3nstarQ3nstar = dReQ9n*pow(dReQ3n,3)-3.*dReQ3n*dReQ9n*pow(dImQ3n,2)
6393                                      + 3.*dImQ3n*dImQ9n*pow(dReQ3n,2)-dImQ9n*pow(dImQ3n,3); 
6394  // <5>_{5n,5n|4n,3n,3n}:
6395  Double_t reQ5nQ5nQ4nstarQ3nstarQ3nstar = dReQ4n*pow(dReQ3n,2.)*pow(dReQ5n,2.) - 2.*dReQ3n*pow(dReQ5n,2.)*dImQ4n*dImQ3n
6396                                         - dReQ4n*pow(dReQ5n,2.)*pow(dImQ3n,2.) + 2.*pow(dReQ3n,2.)*dReQ5n*dImQ4n*dImQ5n 
6397                                         + 4.*dReQ4n*dReQ3n*dReQ5n*dImQ3n*dImQ5n - 2.*dReQ5n*dImQ4n*pow(dImQ3n,2.)*dImQ5n
6398                                         - dReQ4n*pow(dReQ3n,2.)*pow(dImQ5n,2.) + 2.*dReQ3n*dImQ4n*dImQ3n*pow(dImQ5n,2.) 
6399                                         + dReQ4n*pow(dImQ3n,2.)*pow(dImQ5n,2.);
6400
6401  // <5>_{5n,5n|4n,4n,2n}:   
6402  Double_t reQ5nQ5nQ4nstarQ4nstarQ2nstar = dReQ2n*pow(dReQ4n,2.)*pow(dReQ5n,2.) - 2.*dReQ4n*pow(dReQ5n,2.)*dImQ2n*dImQ4n
6403                                         - dReQ2n*pow(dReQ5n,2.)*pow(dImQ4n,2.) + 2.*pow(dReQ4n,2.)*dReQ5n*dImQ2n*dImQ5n 
6404                                         + 4.*dReQ2n*dReQ4n*dReQ5n*dImQ4n*dImQ5n - 2.*dReQ5n*dImQ2n*pow(dImQ4n,2.)*dImQ5n
6405                                         - dReQ2n*pow(dReQ4n,2.)*pow(dImQ5n,2.) + 2.*dReQ4n*dImQ2n*dImQ4n*pow(dImQ5n,2.) 
6406                                         + dReQ2n*pow(dImQ4n,2.)*pow(dImQ5n,2.);
6407  Double_t reQ10nQ4nstarQ4nstarQ2nstar = (dReQ10n*dReQ2n+dImQ10n*dImQ2n)*(pow(dReQ4n,2)-pow(dImQ4n,2)) 
6408                                       + 2.*dReQ4n*dImQ4n*(dImQ10n*dReQ2n-dReQ10n*dImQ2n);
6409  // <5>_{6n|3n,1n,1n,1n}:
6410  Double_t reQ6nQ3nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,3.)*dReQ3n*dReQ6n-3.*dReQ1n*dReQ3n*dReQ6n*pow(dImQ1n,2.) 
6411                                             - 3.*pow(dReQ1n,2.)*dReQ6n*dImQ1n*dImQ3n+dReQ6n*pow(dImQ1n,3.)*dImQ3n 
6412                                             + 3.*pow(dReQ1n,2.)*dReQ3n*dImQ1n*dImQ6n-dReQ3n*pow(dImQ1n,3.)*dImQ6n
6413                                             + pow(dReQ1n,3.)*dImQ3n*dImQ6n-3.*dReQ1n*pow(dImQ1n,2.)*dImQ3n*dImQ6n;
6414  // <5>_{6n,1n,1n|4n,4n}:
6415  Double_t reQ6nQ1nQ1nQ4nstarQ4nstar = pow(dReQ1n,2.)*pow(dReQ4n,2.)*dReQ6n - pow(dReQ4n,2.)*dReQ6n*pow(dImQ1n,2.)
6416                                     + 4.*dReQ1n*dReQ4n*dReQ6n*dImQ1n*dImQ4n - pow(dReQ1n,2.)*dReQ6n*pow(dImQ4n,2.)
6417                                     + dReQ6n*pow(dImQ1n,2.)*pow(dImQ4n,2.) - 2.*dReQ1n*pow(dReQ4n,2.)*dImQ1n*dImQ6n 
6418                                     + 2.*pow(dReQ1n,2.)*dReQ4n*dImQ4n*dImQ6n - 2.*dReQ4n*pow(dImQ1n,2.)*dImQ4n*dImQ6n
6419                                     + 2.*dReQ1n*dImQ1n*pow(dImQ4n,2.)*dImQ6n;
6420
6421
6422  // <5>_{6n,2n,2n|5n,5n}:
6423  Double_t reQ6nQ2nQ2nQ5nstarQ5nstar = pow(dReQ2n,2.)*pow(dReQ5n,2.)*dReQ6n - pow(dReQ5n,2.)*dReQ6n*pow(dImQ2n,2.)
6424                                     + 4.*dReQ2n*dReQ5n*dReQ6n*dImQ2n*dImQ5n - pow(dReQ2n,2.)*dReQ6n*pow(dImQ5n,2.)
6425                                     + dReQ6n*pow(dImQ2n,2.)*pow(dImQ5n,2.) - 2.*dReQ2n*pow(dReQ5n,2.)*dImQ2n*dImQ6n 
6426                                     + 2.*pow(dReQ2n,2.)*dReQ5n*dImQ5n*dImQ6n - 2.*dReQ5n*pow(dImQ2n,2.)*dImQ5n*dImQ6n
6427                                     + 2.*dReQ2n*dImQ2n*pow(dImQ5n,2.)*dImQ6n;
6428  Double_t reQ10nQ6nstarQ2nstarQ2nstar = (dReQ10n*dReQ6n+dImQ10n*dImQ6n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
6429                                       + 2.*dReQ2n*dImQ2n*(dImQ10n*dReQ6n-dReQ10n*dImQ6n);
6430  // <5>_{6n,6n|5n,5n,2n}:
6431  Double_t reQ6nQ6nQ5nstarQ5nstarQ2nstar = dReQ2n*pow(dReQ5n,2.)*pow(dReQ6n,2.) - 2.*dReQ5n*pow(dReQ6n,2.)*dImQ2n*dImQ5n
6432                                         - dReQ2n*pow(dReQ6n,2.)*pow(dImQ5n,2.) + 2.*pow(dReQ5n,2.)*dReQ6n*dImQ2n*dImQ6n 
6433                                         + 4.*dReQ2n*dReQ5n*dReQ6n*dImQ5n*dImQ6n - 2.*dReQ6n*dImQ2n*pow(dImQ5n,2.)*dImQ6n
6434                                         - dReQ2n*pow(dReQ5n,2.)*pow(dImQ6n,2.) + 2.*dReQ5n*dImQ2n*dImQ5n*pow(dImQ6n,2.) 
6435                                         + dReQ2n*pow(dImQ5n,2.)*pow(dImQ6n,2.);
6436  Double_t reQ10nQ2nQ6nstarQ6nstar = dImQ2n*pow(dImQ6n,2.)*dImQ10n+2.*dImQ6n*dImQ10n*dReQ2n*dReQ6n
6437                                   - dImQ2n*dImQ10n*pow(dReQ6n,2.)-pow(dImQ6n,2.)*dReQ2n*dReQ10n 
6438                                   + 2.*dImQ2n*dImQ6n*dReQ6n*dReQ10n+dReQ2n*pow(dReQ6n,2.)*dReQ10n;
6439  Double_t reQ12nQ5nstarQ5nstarQ2nstar = (dReQ12n*dReQ2n+dImQ12n*dImQ2n)*(pow(dReQ5n,2)-pow(dImQ5n,2)) 
6440                                       + 2.*dReQ5n*dImQ5n*(dImQ12n*dReQ2n-dReQ12n*dImQ2n);
6441  Double_t reQ12nQ10nstarQ2nstar = dReQ12n*dReQ10n*dReQ2n-dReQ12n*dImQ10n*dImQ2n+dImQ12n*dReQ10n*dImQ2n
6442                                 + dImQ12n*dImQ10n*dReQ2n;
6443  // <5>_{5n,2n|3n,3n,1n}: 
6444  Double_t reQ5nQ2nQ3nstarQ3nstarQ1nstar = dReQ1n*dReQ2n*pow(dReQ3n,2.)*dReQ5n + pow(dReQ3n,2.)*dReQ5n*dImQ1n*dImQ2n 
6445                                         - 2.*dReQ2n*dReQ3n*dReQ5n*dImQ1n*dImQ3n + 2.*dReQ1n*dReQ3n*dReQ5n*dImQ2n*dImQ3n 
6446                                         - dReQ1n*dReQ2n*dReQ5n*pow(dImQ3n,2.) - dReQ5n*dImQ1n*dImQ2n*pow(dImQ3n,2.) 
6447                                         + dReQ2n*pow(dReQ3n,2.)*dImQ1n*dImQ5n - dReQ1n*pow(dReQ3n,2.)*dImQ2n*dImQ5n
6448                                         + 2.*dReQ1n*dReQ2n*dReQ3n*dImQ3n*dImQ5n + 2.*dReQ3n*dImQ1n*dImQ2n*dImQ3n*dImQ5n
6449                                         - dReQ2n*dImQ1n*pow(dImQ3n,2.)*dImQ5n + dReQ1n*dImQ2n*pow(dImQ3n,2.)*dImQ5n;
6450  // <5>_{5n,1n,1n|4n,3n}:
6451  Double_t reQ5nQ1nQ1nQ4nstarQ3nstar = pow(dReQ1n,2.)*dReQ3n*dReQ4n*dReQ5n - dReQ3n*dReQ4n*dReQ5n*pow(dImQ1n,2.)
6452                                     + 2.*dReQ1n*dReQ4n*dReQ5n*dImQ1n*dImQ3n + 2.*dReQ1n*dReQ3n*dReQ5n*dImQ1n*dImQ4n
6453                                     - pow(dReQ1n,2.)*dReQ5n*dImQ3n*dImQ4n + dReQ5n*pow(dImQ1n,2.)*dImQ3n*dImQ4n
6454                                     - 2.*dReQ1n*dReQ3n*dReQ4n*dImQ1n*dImQ5n + pow(dReQ1n,2.)*dReQ4n*dImQ3n*dImQ5n
6455                                     - dReQ4n*pow(dImQ1n,2.)*dImQ3n*dImQ5n + pow(dReQ1n,2.)*dReQ3n*dImQ4n*dImQ5n
6456                                     - dReQ3n*pow(dImQ1n,2.)*dImQ4n*dImQ5n + 2.*dReQ1n*dImQ1n*dImQ3n*dImQ4n*dImQ5n;
6457  // <5>_{5n,3n|4n,2n,2n}:
6458  Double_t reQ5nQ3nQ4nstarQ2nstarQ2nstar = dReQ4n*dReQ3n*pow(dReQ2n,2.)*dReQ5n + pow(dReQ2n,2.)*dReQ5n*dImQ4n*dImQ3n 
6459                                         - 2.*dReQ3n*dReQ2n*dReQ5n*dImQ4n*dImQ2n + 2.*dReQ4n*dReQ2n*dReQ5n*dImQ3n*dImQ2n 
6460                                         - dReQ4n*dReQ3n*dReQ5n*pow(dImQ2n,2.) - dReQ5n*dImQ4n*dImQ3n*pow(dImQ2n,2.) 
6461                                         + dReQ3n*pow(dReQ2n,2.)*dImQ4n*dImQ5n - dReQ4n*pow(dReQ2n,2.)*dImQ3n*dImQ5n
6462                                         + 2.*dReQ4n*dReQ3n*dReQ2n*dImQ2n*dImQ5n + 2.*dReQ2n*dImQ4n*dImQ3n*dImQ2n*dImQ5n
6463                                         - dReQ3n*dImQ4n*pow(dImQ2n,2.)*dImQ5n + dReQ4n*dImQ3n*pow(dImQ2n,2.)*dImQ5n;
6464  Double_t reQ8nQ4nstarQ2nstarQ2nstar = (dReQ8n*dReQ4n+dImQ8n*dImQ4n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
6465                                      + 2.*dReQ2n*dImQ2n*(dImQ8n*dReQ4n-dReQ8n*dImQ4n);
6466  // <5>_{5n,2n,1n|4n,4n}:
6467  Double_t reQ5nQ2nQ1nQ4nstarQ4nstar = dReQ1n*dReQ2n*pow(dReQ4n,2.)*dReQ5n - pow(dReQ4n,2.)*dReQ5n*dImQ1n*dImQ2n
6468                                     + 2.*dReQ2n*dReQ4n*dReQ5n*dImQ1n*dImQ4n + 2.*dReQ1n*dReQ4n*dReQ5n*dImQ2n*dImQ4n
6469                                     - dReQ1n*dReQ2n*dReQ5n*pow(dImQ4n,2.) + dReQ5n*dImQ1n*dImQ2n*pow(dImQ4n,2.)
6470                                     - dReQ2n*pow(dReQ4n,2.)*dImQ1n*dImQ5n - dReQ1n*pow(dReQ4n,2.)*dImQ2n*dImQ5n
6471                                     + 2.*dReQ1n*dReQ2n*dReQ4n*dImQ4n*dImQ5n - 2.*dReQ4n*dImQ1n*dImQ2n*dImQ4n*dImQ5n
6472                                     + dReQ2n*dImQ1n*pow(dImQ4n,2.)*dImQ5n + dReQ1n*dImQ2n*pow(dImQ4n,2.)*dImQ5n;
6473  // <5>_{6n,1n|3n,2n,2n}:
6474  Double_t reQ6nQ1nQ3nstarQ2nstarQ2nstar = dReQ3n*dReQ1n*pow(dReQ2n,2.)*dReQ6n + pow(dReQ2n,2.)*dReQ6n*dImQ3n*dImQ1n 
6475                                         - 2.*dReQ1n*dReQ2n*dReQ6n*dImQ3n*dImQ2n + 2.*dReQ3n*dReQ2n*dReQ6n*dImQ1n*dImQ2n 
6476                                         - dReQ3n*dReQ1n*dReQ6n*pow(dImQ2n,2.) - dReQ6n*dImQ3n*dImQ1n*pow(dImQ2n,2.) 
6477                                         + dReQ1n*pow(dReQ2n,2.)*dImQ3n*dImQ6n - dReQ3n*pow(dReQ2n,2.)*dImQ1n*dImQ6n
6478                                         + 2.*dReQ3n*dReQ1n*dReQ2n*dImQ2n*dImQ6n + 2.*dReQ2n*dImQ3n*dImQ1n*dImQ2n*dImQ6n
6479                                         - dReQ1n*dImQ3n*pow(dImQ2n,2.)*dImQ6n + dReQ3n*dImQ1n*pow(dImQ2n,2.)*dImQ6n;
6480
6481  // <5>_{6n,3n|4n,4n,1n}:
6482  Double_t reQ6nQ3nQ4nstarQ4nstarQ1nstar = dReQ1n*dReQ3n*pow(dReQ4n,2.)*dReQ6n + pow(dReQ4n,2.)*dReQ6n*dImQ1n*dImQ3n 
6483                                         - 2.*dReQ3n*dReQ4n*dReQ6n*dImQ1n*dImQ4n + 2.*dReQ1n*dReQ4n*dReQ6n*dImQ3n*dImQ4n 
6484                                         - dReQ1n*dReQ3n*dReQ6n*pow(dImQ4n,2.) - dReQ6n*dImQ1n*dImQ3n*pow(dImQ4n,2.) 
6485                                         + dReQ3n*pow(dReQ4n,2.)*dImQ1n*dImQ6n - dReQ1n*pow(dReQ4n,2.)*dImQ3n*dImQ6n
6486                                         + 2.*dReQ1n*dReQ3n*dReQ4n*dImQ4n*dImQ6n + 2.*dReQ4n*dImQ1n*dImQ3n*dImQ4n*dImQ6n
6487                                         - dReQ3n*dImQ1n*pow(dImQ4n,2.)*dImQ6n + dReQ1n*dImQ3n*pow(dImQ4n,2.)*dImQ6n;
6488
6489  // five6n1n1n5n3n = 0.; // <5>_{6n,1n,1n|5n,3n} = <cos(n(6*phi1+1*phi2+1*phi3-5*phi4-3*phi5))>
6490  Double_t reQ6nQ1nQ1nQ5nstarQ3nstar = pow(dReQ1n,2.)*dReQ3n*dReQ5n*dReQ6n - dReQ3n*dReQ5n*dReQ6n*pow(dImQ1n,2.)
6491                                     + 2.*dReQ1n*dReQ5n*dReQ6n*dImQ1n*dImQ3n + 2.*dReQ1n*dReQ3n*dReQ6n*dImQ1n*dImQ5n
6492                                     - pow(dReQ1n,2.)*dReQ6n*dImQ3n*dImQ5n + dReQ6n*pow(dImQ1n,2.)*dImQ3n*dImQ5n
6493                                     - 2.*dReQ1n*dReQ3n*dReQ5n*dImQ1n*dImQ6n + pow(dReQ1n,2.)*dReQ5n*dImQ3n*dImQ6n
6494                                     - dReQ5n*pow(dImQ1n,2.)*dImQ3n*dImQ6n + pow(dReQ1n,2.)*dReQ3n*dImQ5n*dImQ6n
6495                                     - dReQ3n*pow(dImQ1n,2.)*dImQ5n*dImQ6n + 2.*dReQ1n*dImQ1n*dImQ3n*dImQ5n*dImQ6n;
6496
6497  // <5>_{6n,3n|5n,2n,2n}:
6498  Double_t reQ6nQ3nQ5nstarQ2nstarQ2nstar = dReQ5n*dReQ3n*pow(dReQ2n,2.)*dReQ6n + pow(dReQ2n,2.)*dReQ6n*dImQ5n*dImQ3n 
6499                                         - 2.*dReQ3n*dReQ2n*dReQ6n*dImQ5n*dImQ2n + 2.*dReQ5n*dReQ2n*dReQ6n*dImQ3n*dImQ2n 
6500                                         - dReQ5n*dReQ3n*dReQ6n*pow(dImQ2n,2.) - dReQ6n*dImQ5n*dImQ3n*pow(dImQ2n,2.) 
6501                                         + dReQ3n*pow(dReQ2n,2.)*dImQ5n*dImQ6n - dReQ5n*pow(dReQ2n,2.)*dImQ3n*dImQ6n
6502                                         + 2.*dReQ5n*dReQ3n*dReQ2n*dImQ2n*dImQ6n + 2.*dReQ2n*dImQ5n*dImQ3n*dImQ2n*dImQ6n
6503                                         - dReQ3n*dImQ5n*pow(dImQ2n,2.)*dImQ6n + dReQ5n*dImQ3n*pow(dImQ2n,2.)*dImQ6n;
6504
6505  // <5>_{6n,5n|4n,4n,3n}:
6506  Double_t reQ6nQ5nQ4nstarQ4nstarQ3nstar = dReQ3n*dReQ5n*pow(dReQ4n,2.)*dReQ6n + pow(dReQ4n,2.)*dReQ6n*dImQ3n*dImQ5n 
6507                                         - 2.*dReQ5n*dReQ4n*dReQ6n*dImQ3n*dImQ4n + 2.*dReQ3n*dReQ4n*dReQ6n*dImQ5n*dImQ4n 
6508                                         - dReQ3n*dReQ5n*dReQ6n*pow(dImQ4n,2.) - dReQ6n*dImQ3n*dImQ5n*pow(dImQ4n,2.) 
6509                                         + dReQ5n*pow(dReQ4n,2.)*dImQ3n*dImQ6n - dReQ3n*pow(dReQ4n,2.)*dImQ5n*dImQ6n
6510                                         + 2.*dReQ3n*dReQ5n*dReQ4n*dImQ4n*dImQ6n + 2.*dReQ4n*dImQ3n*dImQ5n*dImQ4n*dImQ6n
6511                                         - dReQ5n*dImQ3n*pow(dImQ4n,2.)*dImQ6n + dReQ3n*dImQ5n*pow(dImQ4n,2.)*dImQ6n;
6512  Double_t reQ11nQ4nstarQ4nstarQ3nstar = (dReQ11n*dReQ3n+dImQ11n*dImQ3n)*(pow(dReQ4n,2)-pow(dImQ4n,2)) 
6513                                       + 2.*dReQ4n*dImQ4n*(dImQ11n*dReQ3n-dReQ11n*dImQ3n);
6514
6515  // <5>_{6n,3n,1n|5n,5n}:
6516  Double_t reQ6nQ3nQ1nQ5nstarQ5nstar = dReQ1n*dReQ3n*pow(dReQ5n,2.)*dReQ6n - pow(dReQ5n,2.)*dReQ6n*dImQ1n*dImQ3n
6517                                     + 2.*dReQ3n*dReQ5n*dReQ6n*dImQ1n*dImQ5n + 2.*dReQ1n*dReQ5n*dReQ6n*dImQ3n*dImQ5n
6518                                     - dReQ1n*dReQ3n*dReQ6n*pow(dImQ5n,2.) + dReQ6n*dImQ1n*dImQ3n*pow(dImQ5n,2.)
6519                                     - dReQ3n*pow(dReQ5n,2.)*dImQ1n*dImQ6n - dReQ1n*pow(dReQ5n,2.)*dImQ3n*dImQ6n
6520                                     + 2.*dReQ1n*dReQ3n*dReQ5n*dImQ5n*dImQ6n - 2.*dReQ5n*dImQ1n*dImQ3n*dImQ5n*dImQ6n
6521                                     + dReQ3n*dImQ1n*pow(dImQ5n,2.)*dImQ6n + dReQ1n*dImQ3n*pow(dImQ5n,2.)*dImQ6n;
6522
6523  // <5>_{6n,6n|5n,4n,3n}:
6524  Double_t reQ6nQ6nQ5nstarQ4nstarQ3nstar = dReQ3n*dReQ4n*dReQ5n*pow(dReQ6n,2.) - dReQ5n*pow(dReQ6n,2.)*dImQ3n*dImQ4n
6525                                         - dReQ4n*pow(dReQ6n,2.)*dImQ3n*dImQ5n - dReQ3n*pow(dReQ6n,2.)*dImQ4n*dImQ5n
6526                                         + 2.*dReQ4n*dReQ5n*dReQ6n*dImQ3n*dImQ6n + 2.*dReQ3n*dReQ5n*dReQ6n*dImQ4n*dImQ6n
6527                                         + 2.*dReQ3n*dReQ4n*dReQ6n*dImQ5n*dImQ6n - 2.*dReQ6n*dImQ3n*dImQ4n*dImQ5n*dImQ6n
6528                                         - dReQ3n*dReQ4n*dReQ5n*pow(dImQ6n,2.) + dReQ5n*dImQ3n*dImQ4n*pow(dImQ6n,2.)
6529                                         + dReQ4n*dImQ3n*dImQ5n*pow(dImQ6n,2.) + dReQ3n*dImQ4n*dImQ5n*pow(dImQ6n,2.);
6530
6531
6532  Double_t reQ8nQ4nQ6nstarQ6nstar = dImQ4n*pow(dImQ6n,2.)*dImQ8n+2.*dImQ6n*dImQ8n*dReQ4n*dReQ6n
6533                                  - dImQ4n*dImQ8n*pow(dReQ6n,2.)-pow(dImQ6n,2.)*dReQ4n*dReQ8n 
6534                                  + 2.*dImQ4n*dImQ6n*dReQ6n*dReQ8n+dReQ4n*pow(dReQ6n,2.)*dReQ8n;
6535
6536
6537  Double_t reQ9nQ3nQ6nstarQ6nstar = dImQ3n*pow(dImQ6n,2.)*dImQ9n+2.*dImQ6n*dImQ9n*dReQ3n*dReQ6n
6538                                  - dImQ3n*dImQ9n*pow(dReQ6n,2.)-pow(dImQ6n,2.)*dReQ3n*dReQ9n 
6539                                  + 2.*dImQ3n*dImQ6n*dReQ6n*dReQ9n+dReQ3n*pow(dReQ6n,2.)*dReQ9n;
6540
6541
6542  Double_t reQ12nQ5nstarQ4nstarQ3nstar = dReQ3n*dReQ5n*dReQ4n*dReQ12n-dReQ4n*dReQ12n*dImQ3n*dImQ5n 
6543                                       - dReQ5n*dReQ12n*dImQ3n*dImQ4n-dReQ3n*dReQ12n*dImQ5n*dImQ4n 
6544                                       + dReQ5n*dReQ4n*dImQ3n*dImQ12n+dReQ3n*dReQ4n*dImQ5n*dImQ12n 
6545                                       + dReQ3n*dReQ5n*dImQ4n*dImQ12n-dImQ3n*dImQ5n*dImQ4n*dImQ12n;
6546  Double_t reQ12nQ9nstarQ3nstar = dReQ12n*dReQ9n*dReQ3n-dReQ12n*dImQ9n*dImQ3n+dImQ12n*dReQ9n*dImQ3n
6547                                + dImQ12n*dImQ9n*dReQ3n;
6548  Double_t reQ12nQ8nstarQ4nstar = dReQ12n*dReQ8n*dReQ4n-dReQ12n*dImQ8n*dImQ4n+dImQ12n*dReQ8n*dImQ4n
6549                                + dImQ12n*dImQ8n*dReQ4n;
6550
6551    
6552   five4n3n3n2n2n = ((pow(dReQ3n,2.)+pow(dImQ3n,2.))
6553                  * (pow(dReQ2n,2.)*dReQ4n-pow(dImQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n)
6554                  - ((dReQ7n*dReQ3n+dImQ7n*dImQ3n)*(pow(dReQ2n,2.)-pow(dImQ2n,2.)) 
6555                  + 2.*dReQ2n*dImQ2n*(dImQ7n*dReQ3n-dReQ7n*dImQ3n))
6556                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
6557                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
6558                  - 2.*(dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
6559                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
6560                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
6561                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
6562                  - 2.*(dImQ2n*dImQ3n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ2n*dReQ3n 
6563                  + dImQ3n*dImQ5n*dReQ2n*dReQ4n-dImQ2n*dImQ5n*dReQ3n*dReQ4n
6564                  - dImQ3n*dImQ4n*dReQ2n*dReQ5n+dImQ2n*dImQ4n*dReQ3n*dReQ5n 
6565                  + dImQ2n*dImQ3n*dReQ4n*dReQ5n+dReQ2n*dReQ3n*dReQ4n*dReQ5n)
6566                  + 2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
6567                  + 1.*(dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
6568                  + 3.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
6569                  + 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
6570                  + 2.*(dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ5n*dImQ2n+dImQ7n*dImQ5n*dReQ2n)
6571                  + 2.*(dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
6572                  + 6.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6573                  + 6.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
6574                  - (dMult-6.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
6575                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6576                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6577                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6578                  - 4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6579                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6580                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6581                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6582                  + 2.*(dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6583                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6584                  - 2.*dMult*(dMult-12.)) 
6585                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6586   five4n2n4n1n1n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))
6587                  * (pow(dReQ1n,2.)*dReQ2n-pow(dImQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n)
6588                  - reQ6nQ4nstarQ1nstarQ1nstar
6589                  - reQ4nQ2nstarQ1nstarQ1nstar
6590                  - 2.*reQ4nQ1nQ3nstarQ2nstar
6591                  - 2.*reQ5nQ1nQ4nstarQ2nstar
6592                  + 2.*reQ3nQ2nstarQ1nstar
6593                  + reQ6nQ4nstarQ2nstar
6594                  + 3.*reQ4nQ2nstarQ2nstar
6595                  + 2.*reQ5nQ3nstarQ2nstar
6596                  + 2.*reQ6nQ5nstarQ1nstar
6597                  + 2.*reQ6nQ4nstarQ2nstar
6598                  + 6.*reQ4nQ3nstarQ1nstar
6599                  + 6.*reQ5nQ4nstarQ1nstar
6600                  - (dMult-6.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
6601                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6602                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6603                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6604                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6605                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6606                  + 2.*(dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6607                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
6608                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6609   // to be polished:
6610   five4n3n4n2n1n = (reQ4nQ3nQ4nstarQ2nstarQ1nstar
6611                  - reQ5nQ2nQ4nstarQ3nstar
6612                  - reQ6nQ1nQ4nstarQ3nstar
6613                  - reQ4nQ1nQ3nstarQ2nstar
6614                  - reQ7nQ4nstarQ2nstarQ1nstar
6615                  - reQ4nQ2nstarQ1nstarQ1nstar
6616                  - reQ4nQ2nQ3nstarQ3nstar
6617                  + reQ4nQ3nstarQ1nstar
6618                  + reQ7nQ4nstarQ3nstar
6619                  + 3.*reQ4nQ3nstarQ1nstar
6620                  + 2.*reQ7nQ4nstarQ3nstar
6621                  + reQ5nQ3nstarQ2nstar
6622                  + reQ7nQ5nstarQ2nstar
6623                  + reQ6nQ3nstarQ3nstar
6624                  + reQ4nQ3nstarQ1nstar
6625                  + reQ7nQ6nstarQ1nstar
6626                  + reQ2nQ1nstarQ1nstar
6627                  - (dMult-6.)*reQ3nQ2nstarQ1nstar
6628                  + 3.*reQ5nQ4nstarQ1nstar
6629                  + reQ4nQ3nstarQ1nstar
6630                  + 2.*reQ4nQ2nstarQ2nstar
6631                  + 3.*reQ6nQ4nstarQ2nstar
6632                  + reQ3nQ2nstarQ1nstar
6633                  + reQ4nQ2nstarQ2nstar
6634                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6635                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6636                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6637                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6638                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6639                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
6640                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6641                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6642                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6643                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6644                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6645                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6646                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
6647                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6648   five5n1n3n2n1n = ((pow(dImQ1n,2.)+pow(dReQ1n,2.))*(dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n 
6649                  - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n)
6650                  - (dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
6651                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
6652                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
6653                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
6654                  - (dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
6655                  + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
6656                  - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n 
6657                  + dImQ1n*dImQ2n*dReQ4n*dReQ5n+dReQ1n*dReQ2n*dReQ4n*dReQ5n)
6658                  - (dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
6659                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
6660                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n)
6661                  - (dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
6662                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
6663                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
6664                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
6665                  - (-pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
6666                  + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
6667                  - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n)
6668                  - (-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
6669                  + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
6670                  - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n)
6671                  + 3.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
6672                  + dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n
6673                  + pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n
6674                  + 4.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
6675                  - (dMult-7.)*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
6676                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
6677                  + pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n
6678                  + 6.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6679                  + 3.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
6680                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6681                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6682                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6683                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+(dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))  
6684                  - 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6685                  + (dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*(dMult-7.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6686                  - 2.*dMult*(dMult-12.))
6687                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
6688   // to be polished:
6689   five5n2n5n1n1n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))
6690                  * (pow(dReQ1n,2.)*dReQ2n-pow(dImQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n)
6691                  - reQ7nQ5nstarQ1nstarQ1nstar
6692                  - reQ5nQ3nstarQ1nstarQ1nstar
6693                  - 2.*reQ5nQ1nQ4nstarQ2nstar
6694                  - 2.*reQ6nQ1nQ5nstarQ2nstar
6695                  + 2.*reQ4nQ3nstarQ1nstar
6696                  + reQ7nQ5nstarQ2nstar
6697                  + 3.*reQ5nQ3nstarQ2nstar
6698                  + 2.*reQ6nQ4nstarQ2nstar
6699                  + 2.*reQ7nQ6nstarQ1nstar
6700                  + 2.*reQ7nQ5nstarQ2nstar
6701                  + 6.*reQ5nQ4nstarQ1nstar
6702                  + 6.*reQ6nQ5nstarQ1nstar
6703                  - (dMult-6.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
6704                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6705                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6706                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))-4.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6707                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6708                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6709                  + 2.*(dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6710                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
6711                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6712   // to be polished:
6713   five5n2n4n2n1n = (reQ5nQ2nQ4nstarQ2nstarQ1nstar
6714                  - reQ5nQ2nQ4nstarQ3nstar
6715                  - reQ6nQ1nQ5nstarQ2nstar
6716                  - reQ5nQ2nstarQ2nstarQ1nstar
6717                  - reQ7nQ4nstarQ2nstarQ1nstar
6718                  - reQ4nQ1nQ3nstarQ2nstar
6719                  - reQ5nQ1nQ4nstarQ2nstar
6720                  + reQ2nQ1nstarQ1nstar
6721                  + reQ7nQ5nstarQ2nstar
6722                  + 3.*reQ5nQ3nstarQ2nstar
6723                  + 2.*reQ7nQ5nstarQ2nstar
6724                  + reQ5nQ3nstarQ2nstar
6725                  + reQ7nQ4nstarQ3nstar
6726                  + reQ6nQ5nstarQ1nstar
6727                  + reQ2nQ1nstarQ1nstar
6728                  + reQ7nQ6nstarQ1nstar
6729                  + reQ3nQ2nstarQ1nstar
6730                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
6731                  + 3.*reQ3nQ2nstarQ1nstar
6732                  + reQ2nQ1nstarQ1nstar
6733                  + 2.*reQ4nQ2nstarQ2nstar
6734                  + 3.*reQ6nQ4nstarQ2nstar
6735                  + reQ4nQ3nstarQ1nstar
6736                  + reQ4nQ2nstarQ2nstar
6737                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6738                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6739                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6740                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6741                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6742                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6743                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6744                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6745                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6746                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6747                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6748                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6749                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.)) 
6750                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6751   // to be polished: 
6752   five5n3n4n3n1n = (reQ5nQ3nQ4nstarQ3nstarQ1nstar
6753                  - reQ5nQ3nQ4nstarQ4nstar
6754                  - reQ7nQ1nQ5nstarQ3nstar
6755                  - reQ5nQ3nstarQ1nstarQ1nstar
6756                  - reQ8nQ4nstarQ3nstarQ1nstar
6757                  - reQ4nQ1nQ3nstarQ2nstar
6758                  - reQ5nQ2nQ4nstarQ3nstar
6759                  + reQ3nQ2nstarQ1nstar
6760                  + reQ8nQ5nstarQ3nstar
6761                  + 3.*reQ5nQ3nstarQ2nstar
6762                  + 2.*reQ8nQ5nstarQ3nstar
6763                  + reQ5nQ4nstarQ1nstar
6764                  + reQ8nQ4nstarQ4nstar
6765                  + reQ7nQ5nstarQ2nstar
6766                  + reQ3nQ2nstarQ1nstar
6767                  + reQ8nQ7nstarQ1nstar
6768                  + reQ2nQ1nstarQ1nstar
6769                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
6770                  + 3.*reQ4nQ3nstarQ1nstar
6771                  + reQ3nQ2nstarQ1nstar
6772                  + 2.*reQ4nQ3nstarQ1nstar
6773                  + 3.*reQ7nQ4nstarQ3nstar
6774                  + reQ4nQ2nstarQ2nstar
6775                  + reQ4nQ3nstarQ1nstar
6776                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6777                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6778                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6779                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
6780                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6781                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6782                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6783                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6784                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6785                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6786                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6787                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6788                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
6789                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6790   // to be polished: 
6791   five5n4n4n3n2n = (reQ5nQ4nQ4nstarQ3nstarQ2nstar
6792                  - reQ6nQ3nQ5nstarQ4nstar
6793                  - reQ7nQ2nQ5nstarQ4nstar
6794                  - reQ5nQ1nQ4nstarQ2nstar
6795                  - reQ9nQ4nstarQ3nstarQ2nstar
6796                  - reQ4nQ1nQ3nstarQ2nstar
6797                  - reQ5nQ2nQ4nstarQ3nstar
6798                  + reQ4nQ2nstarQ2nstar
6799                  + reQ9nQ5nstarQ4nstar
6800                  + 3.*reQ5nQ4nstarQ1nstar
6801                  + 2.*reQ9nQ5nstarQ4nstar
6802                  + reQ6nQ5nstarQ1nstar
6803                  + reQ9nQ6nstarQ3nstar
6804                  + reQ7nQ5nstarQ2nstar
6805                  + reQ4nQ2nstarQ2nstar
6806                  + reQ9nQ7nstarQ2nstar
6807                  + reQ2nQ1nstarQ1nstar
6808                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
6809                  + 3.*reQ6nQ4nstarQ2nstar
6810                  + reQ4nQ2nstarQ2nstar
6811                  + 2.*reQ4nQ3nstarQ1nstar
6812                  + 3.*reQ7nQ4nstarQ3nstar
6813                  + reQ3nQ2nstarQ1nstar
6814                  + reQ4nQ3nstarQ1nstar
6815                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6816                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6817                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6818                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
6819                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6820                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6821                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6822                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6823                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6824                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6825                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6826                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6827                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
6828                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6829   // to be polished: 
6830   five5n3n5n2n1n = (reQ5nQ3nQ5nstarQ2nstarQ1nstar
6831                  - reQ6nQ2nQ5nstarQ3nstar
6832                  - reQ7nQ1nQ5nstarQ3nstar
6833                  - reQ5nQ1nQ3nstarQ3nstar
6834                  - reQ8nQ5nstarQ2nstarQ1nstar
6835                  - reQ5nQ2nstarQ2nstarQ1nstar
6836                  - reQ5nQ2nQ4nstarQ3nstar
6837                  + reQ5nQ4nstarQ1nstar
6838                  + reQ8nQ5nstarQ3nstar
6839                  + 3.*reQ5nQ3nstarQ2nstar
6840                  + 2.*reQ8nQ5nstarQ3nstar
6841                  + reQ6nQ3nstarQ3nstar
6842                  + reQ8nQ6nstarQ2nstar
6843                  + reQ7nQ4nstarQ3nstar
6844                  + reQ5nQ4nstarQ1nstar
6845                  + reQ8nQ7nstarQ1nstar
6846                  + reQ3nQ2nstarQ1nstar
6847                  - (dMult-6.)*reQ3nQ2nstarQ1nstar
6848                  + 3.*reQ6nQ5nstarQ1nstar
6849                  + reQ5nQ4nstarQ1nstar
6850                  + 2.*reQ5nQ3nstarQ2nstar
6851                  + 3.*reQ7nQ5nstarQ2nstar
6852                  + reQ4nQ2nstarQ2nstar
6853                  + reQ5nQ3nstarQ2nstar
6854                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6855                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6856                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6857                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
6858                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6859                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6860                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6861                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6862                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6863                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6864                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6865                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6866                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
6867                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6868   // to be polished:
6869   five5n4n5n2n2n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))
6870                  * (pow(dReQ2n,2.)*dReQ4n-pow(dImQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n)
6871                  - reQ9nQ5nstarQ2nstarQ2nstar
6872                  - reQ5nQ2nstarQ2nstarQ1nstar
6873                  - 2.*reQ5nQ2nQ4nstarQ3nstar
6874                  - 2.*reQ7nQ2nQ5nstarQ4nstar
6875                  + 2.*reQ3nQ2nstarQ1nstar
6876                  + reQ9nQ5nstarQ4nstar
6877                  + 3.*reQ5nQ4nstarQ1nstar
6878                  + 2.*reQ7nQ4nstarQ3nstar
6879                  + 2.*reQ9nQ7nstarQ2nstar
6880                  + 2.*reQ9nQ5nstarQ4nstar
6881                  + 6.*reQ5nQ3nstarQ2nstar
6882                  + 6.*reQ7nQ5nstarQ2nstar
6883                  - (dMult-6.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
6884                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6885                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6886                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))-4.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6887                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6888                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6889                  + 2.*(dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6890                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
6891                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6892   // to be polished:
6893   five5n4n5n3n1n = (reQ5nQ4nQ5nstarQ3nstarQ1nstar
6894                  - reQ6nQ3nQ5nstarQ4nstar
6895                  - reQ8nQ1nQ5nstarQ4nstar
6896                  - reQ5nQ1nQ4nstarQ2nstar
6897                  - reQ9nQ5nstarQ3nstarQ1nstar
6898                  - reQ5nQ3nstarQ1nstarQ1nstar
6899                  - reQ5nQ3nQ4nstarQ4nstar
6900                  + reQ5nQ4nstarQ1nstar
6901                  + reQ9nQ5nstarQ4nstar
6902                  + 3.*reQ5nQ4nstarQ1nstar
6903                  + 2.*reQ9nQ5nstarQ4nstar
6904                  + reQ6nQ4nstarQ2nstar
6905                  + reQ9nQ6nstarQ3nstar
6906                  + reQ8nQ4nstarQ4nstar
6907                  + reQ5nQ4nstarQ1nstar
6908                  + reQ9nQ8nstarQ1nstar
6909                  + reQ2nQ1nstarQ1nstar
6910                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
6911                  + 3.*reQ6nQ5nstarQ1nstar
6912                  + reQ5nQ4nstarQ1nstar
6913                  + 2.*reQ5nQ3nstarQ2nstar
6914                  + 3.*reQ8nQ5nstarQ3nstar
6915                  + reQ4nQ3nstarQ1nstar
6916                  + reQ5nQ3nstarQ2nstar
6917                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6918                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6919                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6920                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
6921                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6922                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6923                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6924                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
6925                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6926                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6927                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6928                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6929                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
6930                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
6931   five6n1n3n3n1n = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))
6932                  * (pow(dReQ3n,2.)*dReQ6n-pow(dImQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n)
6933                  - 2.*(dImQ1n*dImQ3n*dImQ4n*dImQ6n+dImQ4n*dImQ6n*dReQ1n*dReQ3n 
6934                  + dImQ3n*dImQ6n*dReQ1n*dReQ4n-dImQ1n*dImQ6n*dReQ3n*dReQ4n
6935                  - dImQ3n*dImQ4n*dReQ1n*dReQ6n+dImQ1n*dImQ4n*dReQ3n*dReQ6n 
6936                  + dImQ1n*dImQ3n*dReQ4n*dReQ6n+dReQ1n*dReQ3n*dReQ4n*dReQ6n)   
6937                  - 2.*(dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
6938                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
6939                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
6940                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
6941                  - (-pow(dImQ3n,2.)*dImQ1n*dImQ7n+dImQ1n*dImQ7n*pow(dReQ3n,2.)
6942                  + 2.*dImQ3n*dImQ7n*dReQ3n*dReQ1n-2.*dImQ3n*dImQ1n*dReQ3n*dReQ7n 
6943                  - pow(dImQ3n,2.)*dReQ1n*dReQ7n+pow(dReQ3n,2.)*dReQ1n*dReQ7n)
6944                  - ((pow(dReQ3n,2.)-pow(dImQ3n,2.))*(dReQ5n*dReQ1n-dImQ5n*dImQ1n) 
6945                  + 2.*dReQ3n*dImQ3n*(dReQ5n*dImQ1n+dImQ5n*dReQ1n))
6946                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6947                  + (dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
6948                  + 2.*(dReQ7n*dReQ3n*dReQ4n-dReQ7n*dImQ3n*dImQ4n+dImQ7n*dReQ3n*dImQ4n+dImQ7n*dImQ3n*dReQ4n)
6949                  + 2.*(dReQ6n*(dReQ4n*dReQ2n-dImQ4n*dImQ2n)+dImQ6n*(dReQ4n*dImQ2n+dImQ4n*dReQ2n))
6950                  + 3.*(dReQ6n*(dReQ5n*dReQ1n-dImQ5n*dImQ1n)+dImQ6n*(dReQ5n*dImQ1n+dImQ5n*dReQ1n))
6951                  + 4.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6952                  + 2.*(dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
6953                  + 6.*(dReQ4n*dReQ3n*dReQ1n-dReQ4n*dImQ3n*dImQ1n+dImQ4n*dReQ3n*dImQ1n+dImQ4n*dImQ3n*dReQ1n)
6954                  + 2.*(dReQ5n*dReQ3n*dReQ2n-dReQ5n*dImQ3n*dImQ2n+dImQ5n*dReQ3n*dImQ2n+dImQ5n*dImQ3n*dReQ2n)
6955                  - (dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
6956                  - 4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6957                  - 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6958                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6959                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6960                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6961                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+(dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6962                  + 2.*(dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.))
6963                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6964   five6n2n3n3n2n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))
6965                  * (pow(dReQ3n,2.)*dReQ6n-pow(dImQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n)
6966                  - 2.*(dImQ2n*dImQ3n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ2n*dReQ3n 
6967                  + dImQ3n*dImQ6n*dReQ2n*dReQ5n-dImQ2n*dImQ6n*dReQ3n*dReQ5n
6968                  - dImQ3n*dImQ5n*dReQ2n*dReQ6n+dImQ2n*dImQ5n*dReQ3n*dReQ6n 
6969                  + dImQ2n*dImQ3n*dReQ5n*dReQ6n+dReQ2n*dReQ3n*dReQ5n*dReQ6n) 
6970                  - 2.*(dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
6971                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
6972                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
6973                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
6974                  - (-pow(dImQ3n,2.)*dImQ2n*dImQ8n+dImQ2n*dImQ8n*pow(dReQ3n,2.)
6975                  + 2.*dImQ3n*dImQ8n*dReQ3n*dReQ2n-2.*dImQ3n*dImQ2n*dReQ3n*dReQ8n 
6976                  - pow(dImQ3n,2.)*dReQ2n*dReQ8n+pow(dReQ3n,2.)*dReQ2n*dReQ8n)
6977                  - ((pow(dReQ3n,2.)-pow(dImQ3n,2.))*(dReQ4n*dReQ2n-dImQ4n*dImQ2n) 
6978                  + 2.*dReQ3n*dImQ3n*(dReQ4n*dImQ2n+dImQ4n*dReQ2n))
6979                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6980                  + (dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n+dImQ8n*dImQ6n*dReQ2n)
6981                  + 2.*(dReQ8n*dReQ3n*dReQ5n-dReQ8n*dImQ3n*dImQ5n+dImQ8n*dReQ3n*dImQ5n+dImQ8n*dImQ3n*dReQ5n)
6982                  + 2.*(dReQ6n*(dReQ5n*dReQ1n-dImQ5n*dImQ1n)+dImQ6n*(dReQ5n*dImQ1n+dImQ5n*dReQ1n))
6983                  + 3.*(dReQ6n*(dReQ4n*dReQ2n-dImQ4n*dImQ2n)+dImQ6n*(dReQ4n*dImQ2n+dImQ4n*dReQ2n))
6984                  + 4.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6985                  + 2.*(dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n+dImQ8n*dImQ6n*dReQ2n)
6986                  + 6.*(dReQ5n*dReQ3n*dReQ2n-dReQ5n*dImQ3n*dImQ2n+dImQ5n*dReQ3n*dImQ2n+dImQ5n*dImQ3n*dReQ2n)
6987                  + 2.*(dReQ4n*dReQ3n*dReQ1n-dReQ4n*dImQ3n*dImQ1n+dImQ4n*dReQ3n*dImQ1n+dImQ4n*dImQ3n*dReQ1n)
6988                  - (dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
6989                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
6990                  - 4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6991                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6992                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6993                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6994                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6995                  + 2.*(dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.))
6996                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6997   // to be polished:
6998   five6n1n4n2n1n = (reQ6nQ1nQ4nstarQ2nstarQ1nstar
6999                  - reQ6nQ1nQ4nstarQ3nstar
7000                  - reQ6nQ1nQ5nstarQ2nstar
7001                  - reQ6nQ3nstarQ2nstarQ1nstar
7002                  - reQ7nQ4nstarQ2nstarQ1nstar
7003                  - reQ5nQ1nQ4nstarQ2nstar
7004                  - reQ6nQ4nstarQ1nstarQ1nstar
7005                  + reQ2nQ1nstarQ1nstar
7006                  + reQ7nQ6nstarQ1nstar
7007                  + 3.*reQ6nQ5nstarQ1nstar
7008                  + 2.*reQ7nQ6nstarQ1nstar
7009                  + reQ6nQ3nstarQ3nstar
7010                  + reQ7nQ4nstarQ3nstar
7011                  + reQ6nQ5nstarQ1nstar
7012                  + reQ2nQ1nstarQ1nstar
7013                  + reQ7nQ5nstarQ2nstar
7014                  + reQ5nQ3nstarQ2nstar
7015                  - (dMult-6.)*reQ6nQ4nstarQ2nstar
7016                  + 3.*reQ3nQ2nstarQ1nstar
7017                  + reQ2nQ1nstarQ1nstar
7018                  + 2.*reQ4nQ3nstarQ1nstar
7019                  + 3.*reQ5nQ4nstarQ1nstar
7020                  + reQ5nQ4nstarQ1nstar
7021                  + reQ4nQ3nstarQ1nstar
7022                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7023                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7024                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7025                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
7026                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7027                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7028                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7029                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7030                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7031                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7032                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7033                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7034                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.)) 
7035                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
7036   // to be polished: 
7037   five6n3n4n3n2n = (reQ6nQ3nQ4nstarQ3nstarQ2nstar
7038                  - reQ6nQ3nQ5nstarQ4nstar
7039                  - reQ7nQ2nQ6nstarQ3nstar
7040                  - reQ6nQ3nstarQ2nstarQ1nstar
7041                  - reQ9nQ4nstarQ3nstarQ2nstar
7042                  - reQ4nQ2nQ3nstarQ3nstar
7043                  - reQ6nQ1nQ4nstarQ3nstar
7044                  + reQ3nQ2nstarQ1nstar
7045                  + reQ9nQ6nstarQ3nstar
7046                  + 3.*reQ6nQ3nstarQ3nstar
7047                  + 2.*reQ9nQ6nstarQ3nstar
7048                  + reQ6nQ5nstarQ1nstar
7049                  + reQ9nQ5nstarQ4nstar
7050                  + reQ7nQ6nstarQ1nstar
7051                  + reQ3nQ2nstarQ1nstar
7052                  + reQ9nQ7nstarQ2nstar
7053                  + reQ3nQ2nstarQ1nstar
7054                  - (dMult-6.)*reQ6nQ4nstarQ2nstar
7055                  + 3.*reQ5nQ3nstarQ2nstar
7056                  + reQ3nQ2nstarQ1nstar
7057                  + 2.*reQ4nQ3nstarQ1nstar
7058                  + 3.*reQ7nQ4nstarQ3nstar
7059                  + reQ4nQ3nstarQ1nstar
7060                  + reQ4nQ3nstarQ1nstar
7061                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7062                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7063                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7064                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
7065                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7066                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7067                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7068                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7069                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7070                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7071                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7072                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7073                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
7074                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7075   five6n4n4n3n3n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))
7076                  * (pow(dReQ3n,2.)*dReQ6n-pow(dImQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n)
7077                  - ((dReQ10n*dReQ4n+dImQ10n*dImQ4n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
7078                  + 2.*dReQ3n*dImQ3n*(dImQ10n*dReQ4n-dReQ10n*dImQ4n))
7079                  - ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
7080                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n)
7081                  - 2.*(dImQ1n*dImQ3n*dImQ4n*dImQ6n+dImQ4n*dImQ6n*dReQ1n*dReQ3n 
7082                  + dImQ3n*dImQ6n*dReQ1n*dReQ4n-dImQ1n*dImQ6n*dReQ3n*dReQ4n
7083                  - dImQ3n*dImQ4n*dReQ1n*dReQ6n+dImQ1n*dImQ4n*dReQ3n*dReQ6n 
7084                  + dImQ1n*dImQ3n*dReQ4n*dReQ6n+dReQ1n*dReQ3n*dReQ4n*dReQ6n)
7085                  - 2.*(dImQ3n*dImQ4n*dImQ6n*dImQ7n+dImQ6n*dImQ7n*dReQ3n*dReQ4n 
7086                  + dImQ4n*dImQ7n*dReQ3n*dReQ6n-dImQ3n*dImQ7n*dReQ4n*dReQ6n
7087                  - dImQ4n*dImQ6n*dReQ3n*dReQ7n+dImQ3n*dImQ6n*dReQ4n*dReQ7n 
7088                  + dImQ3n*dImQ4n*dReQ6n*dReQ7n+dReQ3n*dReQ4n*dReQ6n*dReQ7n)
7089                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7090                  + 1.*(dReQ10n*dReQ6n*dReQ4n-dReQ10n*dImQ6n*dImQ4n+dImQ10n*dReQ6n*dImQ4n+dImQ10n*dImQ6n*dReQ4n)
7091                  + 3.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7092                  + 2.*(dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
7093                  + 2.*(dReQ10n*dReQ7n*dReQ3n-dReQ10n*dImQ7n*dImQ3n+dImQ10n*dReQ7n*dImQ3n+dImQ10n*dImQ7n*dReQ3n)
7094                  + 2.*(dReQ10n*dReQ6n*dReQ4n-dReQ10n*dImQ6n*dImQ4n+dImQ10n*dReQ6n*dImQ4n+dImQ10n*dImQ6n*dReQ4n)
7095                  + 6.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7096                  + 6.*(dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
7097                  - (dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7098                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7099                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7100                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))-4.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
7101                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7102                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7103                  + 2.*(dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7104                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
7105                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7106   // to be polished:
7107   five6n2n5n2n1n = (reQ6nQ2nQ5nstarQ2nstarQ1nstar
7108                  - reQ6nQ2nQ5nstarQ3nstar
7109                  - reQ7nQ1nQ6nstarQ2nstar
7110                  - reQ6nQ3nstarQ2nstarQ1nstar
7111                  - reQ8nQ5nstarQ2nstarQ1nstar
7112                  - reQ5nQ1nQ4nstarQ2nstar
7113                  - reQ6nQ1nQ5nstarQ2nstar
7114                  + reQ2nQ1nstarQ1nstar
7115                  + reQ8nQ6nstarQ2nstar
7116                  + 3.*reQ6nQ4nstarQ2nstar
7117                  + 2.*reQ8nQ6nstarQ2nstar
7118                  + reQ6nQ3nstarQ3nstar
7119                  + reQ8nQ5nstarQ3nstar
7120                  + reQ7nQ6nstarQ1nstar
7121                  + reQ2nQ1nstarQ1nstar
7122                  + reQ8nQ7nstarQ1nstar
7123                  + reQ4nQ3nstarQ1nstar
7124                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
7125                  + 3.*reQ3nQ2nstarQ1nstar
7126                  + reQ2nQ1nstarQ1nstar
7127                  + 2.*reQ5nQ3nstarQ2nstar
7128                  + 3.*reQ7nQ5nstarQ2nstar
7129                  + reQ5nQ4nstarQ1nstar
7130                  + reQ5nQ3nstarQ2nstar
7131                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7132                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7133                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7134                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7135                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7136                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7137                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7138                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7139                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7140                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7141                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7142                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7143                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.)) 
7144                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7145   // to be polished:
7146   five6n3n5n3n1n = (reQ6nQ3nQ5nstarQ3nstarQ1nstar
7147                  - reQ6nQ3nQ5nstarQ4nstar
7148                  - reQ8nQ1nQ6nstarQ3nstar
7149                  - reQ6nQ3nstarQ2nstarQ1nstar
7150                  - reQ9nQ5nstarQ3nstarQ1nstar
7151                  - reQ5nQ1nQ3nstarQ3nstar
7152                  - reQ6nQ2nQ5nstarQ3nstar
7153                  + reQ3nQ2nstarQ1nstar
7154                  + reQ9nQ6nstarQ3nstar
7155                  + 3.*reQ6nQ3nstarQ3nstar
7156                  + 2.*reQ9nQ6nstarQ3nstar
7157                  + reQ6nQ4nstarQ2nstar
7158                  + reQ9nQ5nstarQ4nstar
7159                  + reQ8nQ6nstarQ2nstar
7160                  + reQ3nQ2nstarQ1nstar
7161                  + reQ9nQ8nstarQ1nstar
7162                  + reQ3nQ2nstarQ1nstar
7163                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
7164                  + 3.*reQ4nQ3nstarQ1nstar
7165                  + reQ3nQ2nstarQ1nstar
7166                  + 2.*reQ5nQ3nstarQ2nstar
7167                  + 3.*reQ8nQ5nstarQ3nstar
7168                  + reQ5nQ3nstarQ2nstar
7169                  + reQ5nQ3nstarQ2nstar
7170                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7171                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7172                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7173                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
7174                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7175                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7176                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7177                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
7178                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7179                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7180                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7181                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7182                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
7183                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7184   // to be polished:
7185   five6n4n5n4n1n = (reQ6nQ4nQ5nstarQ4nstarQ1nstar
7186                  - reQ6nQ4nQ5nstarQ5nstar
7187                  - reQ9nQ1nQ6nstarQ4nstar
7188                  - reQ6nQ4nstarQ1nstarQ1nstar
7189                  - reQ10nQ5nstarQ4nstarQ1nstar
7190                  - reQ5nQ1nQ4nstarQ2nstar
7191                  - reQ6nQ3nQ5nstarQ4nstar
7192                  + reQ4nQ3nstarQ1nstar
7193                  + reQ10nQ6nstarQ4nstar
7194                  + 3.*reQ6nQ4nstarQ2nstar
7195                  + 2.*reQ10nQ6nstarQ4nstar
7196                  + reQ6nQ5nstarQ1nstar
7197                  + reQ10nQ5nstarQ5nstar
7198                  + reQ9nQ6nstarQ3nstar
7199                  + reQ4nQ3nstarQ1nstar
7200                  + reQ10nQ9nstarQ1nstar
7201                  + reQ2nQ1nstarQ1nstar
7202                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
7203                  + 3.*reQ5nQ4nstarQ1nstar
7204                  + reQ4nQ3nstarQ1nstar
7205                  + 2.*reQ5nQ4nstarQ1nstar
7206                  + 3.*reQ9nQ5nstarQ4nstar
7207                  + reQ5nQ3nstarQ2nstar
7208                  + reQ5nQ4nstarQ1nstar
7209                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7210                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7211                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7212                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
7213                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7214                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7215                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7216                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
7217                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7218                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7219                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7220                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7221                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
7222                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7223   five6n5n5n3n3n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))
7224                  * (pow(dReQ3n,2.)*dReQ6n-pow(dImQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n)
7225                  - ((dReQ11n*dReQ5n+dImQ11n*dImQ5n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
7226                  + 2.*dReQ3n*dImQ3n*(dImQ11n*dReQ5n-dReQ11n*dImQ5n))
7227                  - (dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
7228                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
7229                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n)
7230                  - 2.*(dImQ2n*dImQ3n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ2n*dReQ3n 
7231                  + dImQ3n*dImQ6n*dReQ2n*dReQ5n-dImQ2n*dImQ6n*dReQ3n*dReQ5n
7232                  - dImQ3n*dImQ5n*dReQ2n*dReQ6n+dImQ2n*dImQ5n*dReQ3n*dReQ6n 
7233                  + dImQ2n*dImQ3n*dReQ5n*dReQ6n+dReQ2n*dReQ3n*dReQ5n*dReQ6n)
7234                  - 2.*(dImQ3n*dImQ5n*dImQ6n*dImQ8n+dImQ6n*dImQ8n*dReQ3n*dReQ5n 
7235                  + dImQ5n*dImQ8n*dReQ3n*dReQ6n-dImQ3n*dImQ8n*dReQ5n*dReQ6n
7236                  - dImQ5n*dImQ6n*dReQ3n*dReQ8n+dImQ3n*dImQ6n*dReQ5n*dReQ8n 
7237                  + dImQ3n*dImQ5n*dReQ6n*dReQ8n+dReQ3n*dReQ5n*dReQ6n*dReQ8n)
7238                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7239                  + 1.*(dReQ11n*dReQ6n*dReQ5n-dReQ11n*dImQ6n*dImQ5n+dImQ11n*dReQ6n*dImQ5n+dImQ11n*dImQ6n*dReQ5n)
7240                  + 3.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
7241                  + 2.*(dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n+dImQ8n*dImQ6n*dReQ2n)
7242                  + 2.*(dReQ11n*dReQ8n*dReQ3n-dReQ11n*dImQ8n*dImQ3n+dImQ11n*dReQ8n*dImQ3n+dImQ11n*dImQ8n*dReQ3n)
7243                  + 2.*(dReQ11n*dReQ6n*dReQ5n-dReQ11n*dImQ6n*dImQ5n+dImQ11n*dReQ6n*dImQ5n+dImQ11n*dImQ6n*dReQ5n)
7244                  + 6.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
7245                  + 6.*(dReQ8n*dReQ5n*dReQ3n-dReQ8n*dImQ5n*dImQ3n+dImQ8n*dReQ5n*dImQ3n+dImQ8n*dImQ5n*dReQ3n)
7246                  - (dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7247                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7248                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7249                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))-4.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7250                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7251                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7252                  + 2.*(dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7253                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
7254                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7255   // to be polished:
7256   five6n2n6n1n1n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))
7257                  * (pow(dReQ1n,2.)*dReQ2n-pow(dImQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n)
7258                  - reQ8nQ6nstarQ1nstarQ1nstar
7259                  - reQ6nQ4nstarQ1nstarQ1nstar
7260                  - 2.*reQ6nQ1nQ5nstarQ2nstar
7261                  - 2.*reQ7nQ1nQ6nstarQ2nstar
7262                  + 2.*reQ5nQ4nstarQ1nstar
7263                  + reQ8nQ6nstarQ2nstar
7264                  + 3.*reQ6nQ4nstarQ2nstar
7265                  + 2.*reQ7nQ5nstarQ2nstar
7266                  + 2.*reQ8nQ7nstarQ1nstar
7267                  + 2.*reQ8nQ6nstarQ2nstar
7268                  + 6.*reQ6nQ5nstarQ1nstar
7269                  + 6.*reQ7nQ6nstarQ1nstar
7270                  - (dMult-6.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7271                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7272                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7273                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))-4.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
7274                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7275                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7276                  + 2.*(dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7277                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
7278                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7279   five6n3n6n2n1n = (reQ6nQ3nQ6nstarQ2nstarQ1nstar
7280                  - reQ7nQ2nQ6nstarQ3nstar
7281                  - reQ8nQ1nQ6nstarQ3nstar
7282                  - reQ6nQ1nQ4nstarQ3nstar
7283                  - reQ9nQ6nstarQ2nstarQ1nstar
7284                  - reQ6nQ3nstarQ2nstarQ1nstar
7285                  - reQ6nQ2nQ5nstarQ3nstar
7286                  + reQ6nQ5nstarQ1nstar
7287                  + reQ9nQ6nstarQ3nstar
7288                  + 3.*reQ6nQ3nstarQ3nstar
7289                  + 2.*reQ9nQ6nstarQ3nstar
7290                  + reQ7nQ4nstarQ3nstar
7291                  + reQ9nQ7nstarQ2nstar
7292                  + reQ8nQ5nstarQ3nstar
7293                  + reQ6nQ5nstarQ1nstar
7294                  + reQ9nQ8nstarQ1nstar
7295                  + reQ4nQ3nstarQ1nstar
7296                  - (dMult-6.)*reQ3nQ2nstarQ1nstar
7297                  + 3.*reQ7nQ6nstarQ1nstar
7298                  + reQ6nQ5nstarQ1nstar
7299                  + 2.*reQ6nQ4nstarQ2nstar
7300                  + 3.*reQ8nQ6nstarQ2nstar
7301                  + reQ5nQ3nstarQ2nstar
7302                  + reQ6nQ4nstarQ2nstar
7303                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7304                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7305                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7306                                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
7307                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7308                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7309                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7310                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
7311                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7312                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7313                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7314                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7315                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
7316                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7317   five6n4n6n2n2n = (-(pow(dImQ6n,2.)+pow(dReQ6n,2.))
7318                  * (-2.*dImQ2n*dImQ4n*dReQ2n+pow(dImQ2n,2.)*dReQ4n-pow(dReQ2n,2.)*dReQ4n)
7319                  - (-pow(dImQ2n,2.)*dImQ6n*dImQ10n+dImQ6n*dImQ10n*pow(dReQ2n,2.)
7320                  + 2.*dImQ2n*dImQ10n*dReQ2n*dReQ6n-2.*dImQ2n*dImQ6n*dReQ2n*dReQ10n 
7321                  - pow(dImQ2n,2.)*dReQ6n*dReQ10n+pow(dReQ2n,2.)*dReQ6n*dReQ10n)
7322                  - 2.*(dImQ2n*dImQ4n*dImQ6n*dImQ8n+dImQ6n*dImQ8n*dReQ2n*dReQ4n 
7323                  + dImQ4n*dImQ8n*dReQ2n*dReQ6n-dImQ2n*dImQ8n*dReQ4n*dReQ6n
7324                  - dImQ4n*dImQ6n*dReQ2n*dReQ8n+dImQ2n*dImQ6n*dReQ4n*dReQ8n 
7325                  + dImQ2n*dImQ4n*dReQ6n*dReQ8n+dReQ2n*dReQ4n*dReQ6n*dReQ8n)
7326                  - (dReQ6n*pow(dReQ2n,3.)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2.)
7327                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2.)-dImQ6n*pow(dImQ2n,3.))
7328                  - 2.*((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
7329                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7330                  + 2.*(dReQ10n*dReQ8n*dReQ2n-dReQ10n*dImQ8n*dImQ2n+dImQ10n*dReQ8n*dImQ2n+dImQ10n*dImQ8n*dReQ2n)
7331                  + 3.*(dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
7332                  + 6.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7333                  + 2.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
7334                  + 9.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7335                  - (dMult-8.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7336                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7337                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7338                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))-4.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7339                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+(dMult-12.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7340                  + 2.*(dMult-9.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.))
7341                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7342   // to be polished:
7343   five6n4n6n3n1n = (reQ6nQ4nQ6nstarQ3nstarQ1nstar
7344                  - reQ7nQ3nQ6nstarQ4nstar
7345                  - reQ9nQ1nQ6nstarQ4nstar
7346                  - reQ6nQ1nQ4nstarQ3nstar
7347                  - reQ10nQ6nstarQ3nstarQ1nstar
7348                  - reQ6nQ3nstarQ2nstarQ1nstar
7349                  - reQ6nQ3nQ5nstarQ4nstar
7350                  + reQ6nQ5nstarQ1nstar
7351                  + reQ10nQ6nstarQ4nstar
7352                  + 3.*reQ6nQ4nstarQ2nstar
7353                  + 2.*reQ10nQ6nstarQ4nstar
7354                  + reQ7nQ4nstarQ3nstar
7355                  + reQ10nQ7nstarQ3nstar
7356                  + reQ9nQ5nstarQ4nstar
7357                  + reQ6nQ5nstarQ1nstar
7358                  + reQ10nQ9nstarQ1nstar
7359                  + reQ3nQ2nstarQ1nstar
7360                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
7361                  + 3.*reQ7nQ6nstarQ1nstar
7362                  + reQ6nQ5nstarQ1nstar
7363                  + 2.*reQ6nQ3nstarQ3nstar
7364                  + 3.*reQ9nQ6nstarQ3nstar
7365                  + reQ5nQ3nstarQ2nstar
7366                  + reQ6nQ3nstarQ3nstar
7367                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7368                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7369                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7370                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
7371                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7372                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7373                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7374                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
7375                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7376                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7377                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7378                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7379                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
7380                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7381   // to be polished:
7382   five6n5n5n4n2n = (reQ6nQ5nQ5nstarQ4nstarQ2nstar
7383                  - reQ7nQ4nQ6nstarQ5nstar
7384                  - reQ9nQ2nQ6nstarQ5nstar
7385                  - reQ6nQ1nQ5nstarQ2nstar
7386                  - reQ11nQ5nstarQ4nstarQ2nstar
7387                  - reQ5nQ1nQ4nstarQ2nstar
7388                  - reQ6nQ3nQ5nstarQ4nstar
7389                  + reQ5nQ3nstarQ2nstar
7390                  + reQ11nQ6nstarQ5nstar
7391                  + 3.*reQ6nQ5nstarQ1nstar
7392                  + 2.*reQ11nQ6nstarQ5nstar
7393                  + reQ7nQ6nstarQ1nstar
7394                  + reQ11nQ7nstarQ4nstar
7395                  + reQ9nQ6nstarQ3nstar
7396                  + reQ5nQ3nstarQ2nstar
7397                  + reQ11nQ9nstarQ2nstar
7398                  + reQ2nQ1nstarQ1nstar
7399                  - (dMult-6.)*reQ6nQ4nstarQ2nstar
7400                  + 3.*reQ7nQ5nstarQ2nstar
7401                  + reQ5nQ3nstarQ2nstar
7402                  + 2.*reQ5nQ4nstarQ1nstar
7403                  + 3.*reQ9nQ5nstarQ4nstar
7404                  + reQ4nQ3nstarQ1nstar
7405                  + reQ5nQ4nstarQ1nstar
7406                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7407                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7408                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7409                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))
7410                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7411                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7412                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7413                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
7414                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7415                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7416                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7417                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7418                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
7419                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7420   // to be polished:
7421   five6n5n6n3n2n = (reQ6nQ5nQ6nstarQ3nstarQ2nstar
7422                  - reQ8nQ3nQ6nstarQ5nstar
7423                  - reQ9nQ2nQ6nstarQ5nstar
7424                  - reQ6nQ2nQ5nstarQ3nstar
7425                  - reQ11nQ6nstarQ3nstarQ2nstar
7426                  - reQ6nQ3nstarQ2nstarQ1nstar
7427                  - reQ6nQ3nQ5nstarQ4nstar
7428                  + reQ6nQ4nstarQ2nstar
7429                  + reQ11nQ6nstarQ5nstar
7430                  + 3.*reQ6nQ5nstarQ1nstar
7431                  + 2.*reQ11nQ6nstarQ5nstar
7432                  + reQ8nQ5nstarQ3nstar
7433                  + reQ11nQ8nstarQ3nstar
7434                  + reQ9nQ5nstarQ4nstar
7435                  + reQ6nQ4nstarQ2nstar
7436                  + reQ11nQ9nstarQ2nstar
7437                  + reQ3nQ2nstarQ1nstar
7438                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
7439                  + 3.*reQ8nQ6nstarQ2nstar
7440                  + reQ6nQ4nstarQ2nstar
7441                  + 2.*reQ6nQ3nstarQ3nstar
7442                  + 3.*reQ9nQ6nstarQ3nstar
7443                  + reQ4nQ3nstarQ1nstar
7444                  + reQ6nQ3nstarQ3nstar
7445                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7446                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7447                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7448                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))
7449                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7450                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
7451                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7452                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
7453                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7454                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7455                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7456                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7457                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
7458                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7459   // to be polished:
7460   five6n5n6n4n1n = (reQ6nQ5nQ6nstarQ4nstarQ1nstar
7461                  - reQ7nQ4nQ6nstarQ5nstar
7462                  - reQ10nQ1nQ6nstarQ5nstar
7463                  - reQ6nQ1nQ5nstarQ2nstar
7464                  - reQ11nQ6nstarQ4nstarQ1nstar
7465                  - reQ6nQ4nstarQ1nstarQ1nstar
7466                  - reQ6nQ4nQ5nstarQ5nstar
7467                  + reQ6nQ5nstarQ1nstar
7468                  + reQ11nQ6nstarQ5nstar
7469                  + 3.*reQ6nQ5nstarQ1nstar
7470                  + 2.*reQ11nQ6nstarQ5nstar
7471                  + reQ7nQ5nstarQ2nstar
7472                  + reQ11nQ7nstarQ4nstar
7473                  + reQ10nQ5nstarQ5nstar
7474                  + reQ6nQ5nstarQ1nstar
7475                  + reQ11nQ10nstarQ1nstar
7476                  + reQ2nQ1nstarQ1nstar
7477                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
7478                  + 3.*reQ7nQ6nstarQ1nstar
7479                  + reQ6nQ5nstarQ1nstar
7480                  + 2.*reQ6nQ4nstarQ2nstar
7481                  + 3.*reQ10nQ6nstarQ4nstar
7482                  + reQ5nQ4nstarQ1nstar
7483                  + reQ6nQ4nstarQ2nstar
7484                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7485                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7486                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7487                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))
7488                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7489                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7490                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7491                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.)) 
7492                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7493                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7494                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7495                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7496                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
7497                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7498   //  f2) Two distinct harmonics (9):
7499   five2n1n1n1n1n = ((dReQ2n*dReQ1n-dImQ2n*dImQ1n)*(pow(dReQ1n,3)-3.*dReQ1n*pow(dImQ1n,2))
7500                  + (dReQ2n*dImQ1n+dReQ1n*dImQ2n)*(3.*dImQ1n*pow(dReQ1n,2)-pow(dImQ1n,3))
7501                  - (dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
7502                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3))
7503                  + 5.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7504                  - 3.*(dMult-5.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7505                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7506                  - 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))     
7507                  + 3.*(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7508                  - 3.*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
7509                  + 6.*(2.*dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult*(dMult-4.))
7510                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7511   five2n2n2n1n1n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))*(dReQ2n*(pow(dReQ1n,2.)-pow(dImQ1n,2.))+2.*dImQ2n*dReQ1n*dImQ1n)
7512                  - ((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
7513                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
7514                  - 2.*((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
7515                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7516                  + 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7517                  + 8.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7518                  + 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7519                  - 2.*(dMult-6.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7520                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7521                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)
7522                  + 2.*(3.*dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7523                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7524                  + 4.*(dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
7525                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7526   five3n3n2n2n2n = (pow(dReQ2n,3.)*pow(dReQ3n,2.)-3.*dReQ2n*pow(dReQ3n,2.)*pow(dImQ2n,2.)
7527                  + 6.*pow(dReQ2n,2.)*dReQ3n*dImQ2n*dImQ3n-2.*dReQ3n*pow(dImQ2n,3.)*dImQ3n
7528                  - pow(dReQ2n,3.)*pow(dImQ3n,2.)+3.*dReQ2n*pow(dImQ2n,2.)*pow(dImQ3n,2.)
7529                  - (dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
7530                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3))
7531                  - 3.*((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
7532                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n)
7533                  - 6.*((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
7534                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7535                  + 2.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7536                  + 3.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7537                  + 6.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7538                  + 6.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7539                  + 12.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7540                  + 6.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7541                  - 2.*((pow(dReQ6n,2.)+pow(dImQ6n,2.))+3.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7542                  + 6.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+9.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7543                  + 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-12.*dMult))
7544                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7545   five4n1n1n1n1n = (pow(dReQ1n,4.)*dReQ4n-6.*pow(dReQ1n,2.)*dReQ4n*pow(dImQ1n,2.)
7546                  + pow(dImQ1n,4.)*dReQ4n+4.*pow(dReQ1n,3.)*dImQ1n*dImQ4n-4.*pow(dImQ1n,3.)*dReQ1n*dImQ4n
7547                  - 6.*((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
7548                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
7549                  - 4.*(dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
7550                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3))
7551                  + 8.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7552                  + 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7553                  + 12.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n) 
7554                  + 12.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7555                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-8.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7556                  - 12.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-24.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+24.*dMult)
7557                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7558   five4n2n2n2n2n = ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(pow(dReQ2n,3)-3.*dReQ2n*pow(dImQ2n,2))
7559                  + (dReQ4n*dImQ2n+dReQ2n*dImQ4n)*(3.*dImQ2n*pow(dReQ2n,2)-pow(dImQ2n,3))
7560                  - (dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
7561                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3))
7562                  + 5.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7563                  - 3.*(dMult-5.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7564                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7565                  - 3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))     
7566                  + 3.*(dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7567                  - 3.*pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)
7568                  + 6.*(2.*dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-6.*dMult*(dMult-4.))
7569                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7570   five4n4n4n2n2n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(dReQ4n*(pow(dReQ2n,2.)-pow(dImQ2n,2.))+2.*dImQ4n*dReQ2n*dImQ2n)
7571                  - ((dReQ8n*dReQ4n+dImQ8n*dImQ4n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
7572                  + 2.*dReQ2n*dImQ2n*(dImQ8n*dReQ4n-dReQ8n*dImQ4n))
7573                  - 2.*((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
7574                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7575                  + 3.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
7576                  + 8.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7577                  + 2.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7578                  - 2.*(dMult-6.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7579                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))-4.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7580                  - pow((pow(dReQ4n,2.)+pow(dImQ4n,2.)),2.)
7581                  + 2.*(3.*dMult-10.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7582                  - 4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7583                  + 4.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*dMult*(dMult-6.))
7584                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7585   five6n3n3n3n3n = ((dReQ6n*dReQ3n-dImQ6n*dImQ3n)*(pow(dReQ3n,3)-3.*dReQ3n*pow(dImQ3n,2))
7586                  + (dReQ6n*dImQ3n+dReQ3n*dImQ6n)*(3.*dImQ3n*pow(dReQ3n,2)-pow(dImQ3n,3))
7587                  - (dReQ9n*pow(dReQ3n,3)-3.*dReQ3n*dReQ9n*pow(dImQ3n,2)
7588                  + 3.*dImQ3n*dImQ9n*pow(dReQ3n,2)-dImQ9n*pow(dImQ3n,3))
7589                  + 5.*(dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n+dImQ9n*dImQ6n*dReQ3n)
7590                  - 3.*(dMult-5.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7591                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
7592                  - 3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))     
7593                  + 3.*(dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7594                  - 3.*pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)
7595                  + 6.*(2.*dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-6.*dMult*(dMult-4.))
7596                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7597   five6n6n4n4n4n = (pow(dReQ4n,3.)*pow(dReQ6n,2.)-3.*dReQ4n*pow(dReQ6n,2.)*pow(dImQ4n,2.)
7598                  + 6.*pow(dReQ4n,2.)*dReQ6n*dImQ4n*dImQ6n-2.*dReQ6n*pow(dImQ4n,3.)*dImQ6n
7599                  - pow(dReQ4n,3.)*pow(dImQ6n,2.)+3.*dReQ4n*pow(dImQ4n,2.)*pow(dImQ6n,2.)
7600                  - (dReQ12n*pow(dReQ4n,3)-3.*dReQ4n*dReQ12n*pow(dImQ4n,2)
7601                  + 3.*dImQ4n*dImQ12n*pow(dReQ4n,2)-dImQ12n*pow(dImQ4n,3))
7602                  - 3.*((dReQ8n*dReQ4n-dImQ8n*dImQ4n)*(dReQ6n*dReQ6n-dImQ6n*dImQ6n)
7603                  + 2.*(dReQ8n*dImQ4n+dImQ8n*dReQ4n)*dReQ6n*dImQ6n)
7604                  - 6.*((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
7605                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7606                  + 2.*(pow(dReQ6n,2.)*dReQ12n+2.*dReQ6n*dImQ6n*dImQ12n-pow(dImQ6n,2.)*dReQ12n)
7607                  + 3.*(dReQ12n*dReQ8n*dReQ4n-dReQ12n*dImQ8n*dImQ4n+dImQ12n*dReQ8n*dImQ4n+dImQ12n*dImQ8n*dReQ4n)
7608                  + 6.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7609                  + 6.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
7610                  + 12.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7611                  + 6.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7612                  - 2.*((pow(dReQ12n,2.)+pow(dImQ12n,2.))+3.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7613                  + 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+9.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7614                  + 6.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-12.*dMult))
7615                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7616   five6n6n6n3n3n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(dReQ6n*(pow(dReQ3n,2.)-pow(dImQ3n,2.))+2.*dImQ6n*dReQ3n*dImQ3n)
7617                  - ((dReQ12n*dReQ6n+dImQ12n*dImQ6n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
7618                  + 2.*dReQ3n*dImQ3n*(dImQ12n*dReQ6n-dReQ12n*dImQ6n))
7619                  - 2.*((pow(dReQ6n,2.)-pow(dImQ6n,2.))*(dReQ9n*dReQ3n-dImQ9n*dImQ3n) 
7620                  + 2.*dReQ6n*dImQ6n*(dReQ9n*dImQ3n+dImQ9n*dReQ3n))
7621                  + 3.*(pow(dReQ6n,2.)*dReQ12n+2.*dReQ6n*dImQ6n*dImQ12n-pow(dImQ6n,2.)*dReQ12n)
7622                  + 8.*(dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n+dImQ9n*dImQ6n*dReQ3n)
7623                  + 2.*(dReQ12n*(dReQ9n*dReQ3n-dImQ9n*dImQ3n)+dImQ12n*(dReQ9n*dImQ3n+dImQ9n*dReQ3n))
7624                  - 2.*(dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7625                  - 2.*(pow(dReQ12n,2.)+pow(dImQ12n,2.))-4.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
7626                  - pow((pow(dReQ6n,2.)+pow(dImQ6n,2.)),2.)
7627                  + 2.*(3.*dMult-10.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7628                  - 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7629                  + 4.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-4.*dMult*(dMult-6.))
7630                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7631   //  f3) Three distinct harmonics (30):
7632   five3n1n2n1n1n = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))*(dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n
7633                  + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n)
7634                  - ((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
7635                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n)) 
7636                  - (dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
7637                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3))
7638                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
7639                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7640                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7641                  + pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n
7642                  - (2.*dMult-13.)*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
7643                  + dImQ3n*dImQ2n*dReQ1n)
7644                  + 7.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7645                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7646                  + 2.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7647                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7648                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7649                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7650                  - pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
7651                  + 2.*(3.*dMult-11.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
7652                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7653   five3n2n2n2n1n = ((pow(dImQ2n,2.)+pow(dReQ2n,2.))*(dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n 
7654                  - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n)
7655                  - (-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
7656                  + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
7657                  - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n)
7658                  - (dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
7659                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
7660                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
7661                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
7662                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
7663                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7664                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7665                  + (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
7666                  + 4.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
7667                  + dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)
7668                  + 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7669                  - 2.*(dMult-6.)*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7670                  + 4.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7671                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7672                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7673                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7674                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)+2.*(3.*dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7675                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
7676                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
7677   five3n3n3n2n1n = ((pow(dImQ3n,2.)+pow(dReQ3n,2.))*(dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n
7678                  - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n)
7679                  - (dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
7680                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
7681                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
7682                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
7683                  - (dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
7684                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
7685                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n)
7686                  - ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
7687                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n)
7688                  + dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n
7689                  + dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n
7690                  + 3.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7691                  + 4.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
7692                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7693                  - 2.*(dMult-6.)*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7694                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7695                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7696                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7697                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(3.*dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7698                  - pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)+2.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7699                  + 2.*(dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
7700                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7701   five4n1n3n1n1n = (reQ4nQ1nQ3nstarQ1nstarQ1nstar
7702                  - reQ4nQ1nQ3nstarQ2nstar
7703                  - reQ4nQ1nQ4nstarQ1nstar
7704                  - reQ4nQ2nstarQ1nstarQ1nstar
7705                  - reQ5nQ3nstarQ1nstarQ1nstar
7706                  - reQ3nQ1nQ3nstarQ1nstar
7707                  - dMult*reQ4nQ3nstarQ1nstar
7708                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7709                  + reQ5nQ4nstarQ1nstar
7710                  + 3.*reQ4nQ3nstarQ1nstar
7711                  + 2.*reQ5nQ4nstarQ1nstar
7712                  + reQ4nQ2nstarQ2nstar
7713                  + reQ5nQ3nstarQ2nstar
7714                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7715                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7716                  + reQ5nQ4nstarQ1nstar
7717                  + reQ3nQ2nstarQ1nstar
7718                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
7719                  + 3.*reQ2nQ1nstarQ1nstar
7720                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7721                  + 2.*reQ3nQ2nstarQ1nstar
7722                  + 3.*reQ4nQ3nstarQ1nstar
7723                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7724                  + reQ3nQ2nstarQ1nstar
7725                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7726                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7727                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7728                                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7729                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7730                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7731                  - 2.*dMult*dMult 
7732                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7733                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7734                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7735                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7736                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7737                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.)) 
7738                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7739   five4n1n1n3n3n = // calculated by Peter Jochumzsen
7740                  (pow(dReQ1n*dReQ3n,2.)*dReQ4n-pow(dReQ3n*dImQ1n,2.)*dReQ4n  
7741                  + 4.*dReQ1n*dReQ3n*dReQ4n*dImQ1n*dImQ3n 
7742                  - pow(dReQ1n*dImQ3n,2.)*dReQ4n+pow(dImQ1n*dImQ3n,2.)*dReQ4n  
7743                  - 2.*dReQ1n*pow(dReQ3n,2.)*dImQ1n*dImQ4n+2.*pow(dReQ1n,2.)*dReQ3n*dImQ3n*dImQ4n 
7744                  - 2.*dReQ3n*pow(dImQ1n,2.)*dImQ3n*dImQ4n+2.*dReQ1n*dImQ1n*pow(dImQ3n,2.)*dImQ4n
7745                  + 6.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7746                  - 1.*(-pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
7747                  + 2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
7748                  - pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n) 
7749                  - 1.*((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
7750                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n) 
7751                  + 1.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7752                  - 2.*(dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
7753                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
7754                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n) 
7755                  + 2.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7756                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)) 
7757                  - 2.*(dReQ3n*pow(dReQ1n,3.)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2.)
7758                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2.)-dImQ3n*pow(dImQ1n,3.))
7759                  + 10.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n) 
7760                  + 2.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
7761                  + 2.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n) 
7762                  - 4.*(dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
7763                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
7764                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
7765                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
7766                  + 4.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
7767                  + 4.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
7768                  - 16.*pow(dReQ1n,2.)-16.*pow(dImQ1n,2.)
7769                  - 10.*pow(dReQ2n,2.)-10.*pow(dImQ2n,2.)-12.*pow(dReQ3n,2.)-12.*pow(dImQ3n,2.)
7770                  - 6.*pow(dReQ4n,2.)-6.*pow(dImQ4n,2.)-4.*pow(dReQ5n,2.)-4.*pow(dImQ5n,2.)
7771                  - 2.*pow(dReQ6n,2.)-2.*pow(dImQ6n,2.)+24.*dMult)
7772                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7773   // to be polished:
7774   five4n3n3n3n1n = (reQ4nQ3nQ3nstarQ3nstarQ1nstar
7775                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7776                  - reQ6nQ1nQ4nstarQ3nstar
7777                  - dMult*reQ4nQ3nstarQ1nstar
7778                  - reQ7nQ3nstarQ3nstarQ1nstar
7779                  - reQ3nQ1nQ3nstarQ1nstar
7780                  - reQ4nQ2nQ3nstarQ3nstar
7781                  + reQ3nQ2nstarQ1nstar
7782                  + reQ7nQ4nstarQ3nstar
7783                  + 3.*reQ4nQ3nstarQ1nstar
7784                  + 2.*reQ7nQ4nstarQ3nstar
7785                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7786                  + reQ7nQ4nstarQ3nstar
7787                  + reQ6nQ4nstarQ2nstar
7788                  + reQ3nQ2nstarQ1nstar
7789                  + reQ7nQ6nstarQ1nstar
7790                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7791                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
7792                  + 3.*reQ4nQ3nstarQ1nstar
7793                  + reQ3nQ2nstarQ1nstar
7794                  + 2.*dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7795                  + 3.*reQ6nQ3nstarQ3nstar
7796                  + reQ3nQ2nstarQ1nstar
7797                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7798                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7799                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7800                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7801                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
7802                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7803                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7804                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7805                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
7806                  - 2.*dMult*dMult 
7807                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7808                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7809                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7810                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
7811                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7812
7813   // to be polished:
7814   five4n4n3n3n2n = (reQ4nQ4nQ3nstarQ3nstarQ2nstar
7815                  - reQ5nQ3nQ4nstarQ4nstar-reQ5nQ3nQ4nstarQ4nstar-reQ6nQ2nQ4nstarQ4nstar
7816                  - reQ4nQ1nQ3nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar-reQ4nQ2nQ3nstarQ3nstar                  
7817                                  - reQ8nQ3nstarQ3nstarQ2nstar-reQ4nQ2nQ3nstarQ3nstar-reQ4nQ1nQ3nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar
7818                  + 2.*(reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ8nQ4nstarQ4nstar)
7819                                  + reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ6nQ4nstarQ2nstar
7820                  + reQ8nQ6nstarQ2nstar+reQ8nQ5nstarQ3nstar+reQ8nQ5nstarQ3nstar
7821                                  + reQ5nQ4nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar                                                           
7822                                  + reQ5nQ4nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar                                                           
7823                                  + reQ6nQ4nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7824                  + 2.*(reQ6nQ3nstarQ3nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar)
7825                  + 2.*(reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar)
7826                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7827                                  - 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.))
7828                                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
7829                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))                                
7830                                  - 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.))
7831                                  + 24.*dMult) 
7832                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7833
7834   /*
7835   // correct recursive formula, not needed for the time being.
7836   five4n4n3n3n2n = (reQ4nQ4nQ3nstarQ3nstarQ2nstar
7837                  - dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
7838                  * (2.*four4n2n3n3n+4.*four4n1n3n2n+1.*four8n3n3n2n+1.*four6n2n4n4n+2.*four5n3n4n4n)
7839                  - dMult*(dMult-1.)*(dMult-2.)
7840                  * (4.*three4n3n1n+2.*three4n2n2n+2.*three5n3n2n+1.*three6n3n3n+1.*three8n4n4n
7841                                  + 4.*three3n2n1n+2.*three2n1n1n+1.*three8n6n2n+2.*three8n5n3n+2.*three6n4n2n+4.*three5n4n1n)
7842                  - dMult*(dMult-1.)
7843                                  * (1.*two2n2n+2.*two3n3n+2.*two4n4n+2.*two5n5n+1.*two6n6n+4.*two1n1n+2.*two2n2n+1.*two8n8n)
7844                                  - dMult)
7845                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
7846   */
7847
7848   // to be polished:
7849   five4n4n4n3n1n = (reQ4nQ4nQ4nstarQ3nstarQ1nstar
7850                  - reQ5nQ3nQ4nstarQ4nstar
7851                  - reQ7nQ1nQ4nstarQ4nstar
7852                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7853                  - reQ8nQ4nstarQ3nstarQ1nstar
7854                  - dMult*reQ4nQ3nstarQ1nstar
7855                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7856                  + reQ4nQ3nstarQ1nstar
7857                  + reQ8nQ4nstarQ4nstar
7858                  + 3.*dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7859                  + 2.*reQ8nQ4nstarQ4nstar
7860                  + reQ5nQ4nstarQ1nstar
7861                  + reQ8nQ5nstarQ3nstar
7862                  + reQ7nQ4nstarQ3nstar
7863                  + reQ4nQ3nstarQ1nstar
7864                  + reQ8nQ7nstarQ1nstar
7865                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7866                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
7867                  + 3.*reQ5nQ4nstarQ1nstar
7868                  + reQ4nQ3nstarQ1nstar
7869                  + 2.*reQ4nQ3nstarQ1nstar
7870                  + 3.*reQ7nQ4nstarQ3nstar
7871                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7872                  + reQ4nQ3nstarQ1nstar
7873                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7874                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7875                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7876                                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7877                  - 2.*dMult*dMult 
7878                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7879                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7880                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7881                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7882                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7883                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7884                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7885                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
7886                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7887   // to be polished:
7888   five5n2n1n1n1n = (reQ5nQ2nstarQ1nstarQ1nstarQ1nstar
7889                      - reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar
7890                                  - reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar
7891                                  - reQ3nQ1nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar
7892                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar)
7893                                  + reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar
7894                                  + reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7895                                  + reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
7896                                  + reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
7897                                  + reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
7898                  + 2.*(reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar)
7899                  + 2.*(reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
7900                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7901                  - 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.))
7902                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
7903                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
7904                                  - 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.))
7905                                  + 24.*dMult) 
7906                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7907   // to be polished:
7908   five5n1n2n2n2n = (reQ5nQ1nQ2nstarQ2nstarQ2nstar
7909                  - reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ4nstarQ2nstar
7910                                  - reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar
7911                                  - reQ6nQ2nstarQ2nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar
7912                                  + 2.*(reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ6nQ5nstarQ1nstar)
7913                                  + reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar
7914                                  + reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar
7915                                  + reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7916                                  + reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7917                                  + reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7918                  + 2.*(reQ4nQ2nstarQ2nstar+reQ4nQ2nstarQ2nstar+reQ4nQ2nstarQ2nstar)
7919                  + 2.*(reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar)
7920                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7921                  - 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.))
7922                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.))
7923                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
7924                                  - 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.))
7925                                  + 24.*dMult) 
7926                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7927   // to be polished:
7928   five5n2n3n2n2n = (reQ5nQ2nQ3nstarQ2nstarQ2nstar
7929                  - reQ5nQ2nQ4nstarQ3nstar
7930                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7931                  - reQ5nQ2nstarQ2nstarQ1nstar
7932                  - reQ7nQ3nstarQ2nstarQ2nstar
7933                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7934                  - dMult*reQ5nQ3nstarQ2nstar
7935                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7936                  + reQ7nQ5nstarQ2nstar
7937                  + 3.*reQ5nQ3nstarQ2nstar
7938                  + 2.*reQ7nQ5nstarQ2nstar
7939                  + reQ5nQ4nstarQ1nstar
7940                  + reQ7nQ4nstarQ3nstar
7941                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7942                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7943                  + reQ7nQ5nstarQ2nstar
7944                  + reQ3nQ2nstarQ1nstar
7945                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
7946                  + 3.*reQ4nQ2nstarQ2nstar
7947                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7948                  + 2.*reQ3nQ2nstarQ1nstar
7949                  + 3.*reQ5nQ3nstarQ2nstar
7950                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7951                  + reQ3nQ2nstarQ1nstar
7952                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7953                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7954                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7955                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
7956                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7957                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7958                  - 2.*dMult*dMult
7959                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7960                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7961                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7962                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7963                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7964                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.)) 
7965                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7966   // to be polished:
7967   five5n3n3n3n2n = (reQ5nQ3nQ3nstarQ3nstarQ2nstar
7968                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7969                  - reQ6nQ2nQ5nstarQ3nstar
7970                  - dMult*reQ5nQ3nstarQ2nstar
7971                  - reQ8nQ3nstarQ3nstarQ2nstar 
7972                                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7973                  - reQ5nQ1nQ3nstarQ3nstar
7974                  + reQ3nQ2nstarQ1nstar
7975                  + reQ8nQ5nstarQ3nstar
7976                  + 3.*reQ5nQ3nstarQ2nstar
7977                  + 2.*reQ8nQ5nstarQ3nstar
7978                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7979                  + reQ8nQ5nstarQ3nstar
7980                  + reQ6nQ5nstarQ1nstar
7981                  + reQ3nQ2nstarQ1nstar
7982                  + reQ8nQ6nstarQ2nstar
7983                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7984                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
7985                  + 3.*reQ5nQ3nstarQ2nstar
7986                  + reQ3nQ2nstarQ1nstar
7987                  + 2.*dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7988                  + 3.*reQ6nQ3nstarQ3nstar
7989                  + reQ3nQ2nstarQ1nstar
7990                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7991                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7992                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7993                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7994                                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7995                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7996                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7997                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7998                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
7999                  - 2.*dMult*dMult 
8000                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8001                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
8002                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8003                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
8004                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8005   // to be polished:
8006   five5n1n4n1n1n = (reQ5nQ1nQ4nstarQ1nstarQ1nstar
8007                  - reQ5nQ1nQ4nstarQ2nstar
8008                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8009                  - reQ5nQ3nstarQ1nstarQ1nstar
8010                  - reQ6nQ4nstarQ1nstarQ1nstar 
8011                                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8012                  - dMult*reQ5nQ4nstarQ1nstar
8013                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8014                  + reQ6nQ5nstarQ1nstar
8015                  + 3.*reQ5nQ4nstarQ1nstar
8016                  + 2.*reQ6nQ5nstarQ1nstar
8017                  + reQ5nQ3nstarQ2nstar
8018                  + reQ6nQ4nstarQ2nstar
8019                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8020                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8021                  + reQ6nQ5nstarQ1nstar
8022                  + reQ4nQ3nstarQ1nstar
8023                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
8024                  + 3.*reQ2nQ1nstarQ1nstar
8025                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8026                  + 2.*reQ4nQ3nstarQ1nstar
8027                  + 3.*reQ5nQ4nstarQ1nstar
8028                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8029                  + reQ4nQ3nstarQ1nstar
8030                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8031                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8032                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8033                                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8034                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
8035                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
8036                  - 2.*dMult*dMult
8037                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
8038                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
8039                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8040                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8041                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8042                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.)) 
8043                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8044   // to be polished:
8045   five5n4n3n3n3n = (reQ5nQ4nQ3nstarQ3nstarQ3nstar
8046                  - reQ6nQ3nQ5nstarQ4nstar-reQ6nQ3nQ5nstarQ4nstar-reQ6nQ3nQ5nstarQ4nstar
8047                                  - reQ5nQ1nQ3nstarQ3nstar-reQ5nQ1nQ3nstarQ3nstar-reQ5nQ1nQ3nstarQ3nstar
8048                          - reQ9nQ3nstarQ3nstarQ3nstar-reQ4nQ2nQ3nstarQ3nstar-reQ4nQ2nQ3nstarQ3nstar-reQ4nQ2nQ3nstarQ3nstar
8049                                  + 2.*(reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ9nQ5nstarQ4nstar)
8050                                  + reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar
8051                                  + reQ9nQ6nstarQ3nstar+reQ9nQ6nstarQ3nstar+reQ9nQ6nstarQ3nstar
8052                                  + reQ6nQ4nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
8053                                  + reQ6nQ4nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
8054                                  + reQ6nQ4nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
8055                  + 2.*(reQ6nQ3nstarQ3nstar+reQ6nQ3nstarQ3nstar+reQ6nQ3nstarQ3nstar)
8056                  + 2.*(reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8057                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8058                                  - 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.))
8059                                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
8060                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8061                                  - 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.))
8062                                  + 24.*dMult) 
8063                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8064   // to be polished:
8065   five5n4n4n4n1n = (reQ5nQ4nQ4nstarQ4nstarQ1nstar
8066                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8067                  - reQ8nQ1nQ5nstarQ4nstar
8068                  - dMult*reQ5nQ4nstarQ1nstar
8069                  - reQ9nQ4nstarQ4nstarQ1nstar 
8070                                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8071                  - reQ5nQ3nQ4nstarQ4nstar
8072                  + reQ4nQ3nstarQ1nstar
8073                  + reQ9nQ5nstarQ4nstar
8074                  + 3.*reQ5nQ4nstarQ1nstar
8075                  + 2.*reQ9nQ5nstarQ4nstar
8076                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8077                  + reQ9nQ5nstarQ4nstar
8078                  + reQ8nQ5nstarQ3nstar
8079                  + reQ4nQ3nstarQ1nstar
8080                  + reQ9nQ8nstarQ1nstar
8081                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8082                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
8083                  + 3.*reQ5nQ4nstarQ1nstar
8084                  + reQ4nQ3nstarQ1nstar
8085                  + 2.*dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8086                  + 3.*reQ8nQ4nstarQ4nstar
8087                  + reQ4nQ3nstarQ1nstar
8088                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8089                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8090                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8091                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8092                                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
8093                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
8094                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
8095                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
8096                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
8097                  - 2.*dMult*dMult 
8098                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8099                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8100                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8101                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
8102                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8103   // to be polished:
8104   five5n5n4n3n3n = (reQ5nQ5nQ4nstarQ3nstarQ3nstar
8105                  - reQ6nQ4nQ5nstarQ5nstar-reQ7nQ3nQ5nstarQ5nstar-reQ7nQ3nQ5nstarQ5nstar
8106                                  - reQ5nQ2nQ4nstarQ3nstar-reQ5nQ1nQ3nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar                  
8107                                  - reQ10nQ4nstarQ3nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar-reQ5nQ1nQ3nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar
8108                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ10nQ5nstarQ5nstar)
8109                                  + reQ6nQ5nstarQ1nstar+reQ7nQ5nstarQ2nstar+reQ7nQ5nstarQ2nstar
8110                                  + reQ10nQ7nstarQ3nstar+reQ10nQ6nstarQ4nstar+reQ10nQ7nstarQ3nstar
8111                                  + reQ6nQ5nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
8112                                  + reQ7nQ5nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ2nstarQ2nstar
8113                                  + reQ7nQ5nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ2nstarQ2nstar
8114                                  + 2.*(reQ7nQ4nstarQ3nstar+reQ7nQ4nstarQ3nstar+reQ6nQ3nstarQ3nstar)
8115                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar)
8116                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8117                                  - 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.))
8118                                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
8119                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8120                                  - 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.))
8121                                  + 24.*dMult) 
8122                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8123   // to be polished:
8124   five5n5n4n4n2n = (reQ5nQ5nQ4nstarQ4nstarQ2nstar
8125                  - reQ6nQ4nQ5nstarQ5nstar-reQ6nQ4nQ5nstarQ5nstar-reQ8nQ2nQ5nstarQ5nstar
8126                                  - reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ4nstarQ2nstar-reQ5nQ3nQ4nstarQ4nstar                  
8127                                  - reQ10nQ4nstarQ4nstarQ2nstar-reQ5nQ3nQ4nstarQ4nstar-reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ4nstarQ2nstar
8128                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ10nQ5nstarQ5nstar)
8129                                  + reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ8nQ5nstarQ3nstar
8130                                  + reQ10nQ8nstarQ2nstar+reQ10nQ6nstarQ4nstar+reQ10nQ6nstarQ4nstar
8131                                  + reQ6nQ5nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ4nQ3nstarQ1nstar
8132                                  + reQ6nQ5nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ4nQ3nstarQ1nstar
8133                                  + reQ8nQ5nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
8134                                  + 2.*(reQ8nQ4nstarQ4nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar)
8135                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar)
8136                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8137                                  - 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.))
8138                                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.))
8139                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8140                                  - 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.))
8141                                  + 24.*dMult) 
8142                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8143   // to be polished:
8144   five5n5n5n3n2n = (reQ5nQ5nQ5nstarQ3nstarQ2nstar
8145                  - reQ7nQ3nQ5nstarQ5nstar
8146                  - reQ8nQ2nQ5nstarQ5nstar
8147                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8148                  - reQ10nQ5nstarQ3nstarQ2nstar 
8149                                  - dMult*reQ5nQ3nstarQ2nstar
8150                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
8151                  + reQ5nQ3nstarQ2nstar
8152                  + reQ10nQ5nstarQ5nstar
8153                  + 3.*dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8154                  + 2.*reQ10nQ5nstarQ5nstar
8155                  + reQ7nQ5nstarQ2nstar
8156                  + reQ10nQ7nstarQ3nstar
8157                  + reQ8nQ5nstarQ3nstar
8158                  + reQ5nQ3nstarQ2nstar
8159                  + reQ10nQ8nstarQ2nstar
8160                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8161                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
8162                  + 3.*reQ7nQ5nstarQ2nstar
8163                  + reQ5nQ3nstarQ2nstar
8164                  + 2.*reQ5nQ3nstarQ2nstar
8165                  + 3.*reQ8nQ5nstarQ3nstar
8166                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
8167                  + reQ5nQ3nstarQ2nstar
8168                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8169                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8170                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
8171                                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
8172                  - 2.*dMult*dMult 
8173                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
8174                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
8175                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
8176                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8177                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8178                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
8179                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8180                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
8181                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8182   // to be polished:
8183   five5n5n5n4n1n = (reQ5nQ5nQ5nstarQ4nstarQ1nstar
8184                  - reQ6nQ4nQ5nstarQ5nstar
8185                  - reQ9nQ1nQ5nstarQ5nstar
8186                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8187                  - reQ10nQ5nstarQ4nstarQ1nstar 
8188                                  - dMult*reQ5nQ4nstarQ1nstar
8189                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8190                  + reQ5nQ4nstarQ1nstar
8191                  + reQ10nQ5nstarQ5nstar
8192                  + 3.*dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8193                  + 2.*reQ10nQ5nstarQ5nstar
8194                  + reQ6nQ5nstarQ1nstar
8195                  + reQ10nQ6nstarQ4nstar
8196                  + reQ9nQ5nstarQ4nstar
8197                  + reQ5nQ4nstarQ1nstar
8198                  + reQ10nQ9nstarQ1nstar
8199                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8200                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
8201                  + 3.*reQ6nQ5nstarQ1nstar
8202                  + reQ5nQ4nstarQ1nstar
8203                  + 2.*reQ5nQ4nstarQ1nstar
8204                  + 3.*reQ9nQ5nstarQ4nstar
8205                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8206                  + reQ5nQ4nstarQ1nstar
8207                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8208                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8209                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8210                                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
8211                  - 2.*dMult*dMult 
8212                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
8213                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8214                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
8215                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8216                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8217                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8218                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8219                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
8220                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8221   five6n2n2n1n1n = // calculated by Peter Jochumzsen 
8222                  (pow(dReQ1n*dReQ2n,2.)*dReQ6n-pow(dReQ2n*dImQ1n,2.)*dReQ6n
8223                  - 4.*dReQ1n*dReQ2n*dReQ6n*dImQ1n*dImQ2n 
8224                  - pow(dReQ1n*dImQ2n,2.)*dReQ6n+pow(dImQ1n*dImQ2n,2.)*dReQ6n
8225                  + 2.*dReQ1n*pow(dReQ2n,2.)*dImQ1n*dImQ6n+2.*pow(dReQ1n,2.)*dReQ2n*dImQ2n*dImQ6n 
8226                  - 2.*dReQ2n*pow(dImQ1n,2.)*dImQ2n*dImQ6n-2.*dReQ1n*dImQ1n*pow(dImQ2n,2.)*dImQ6n
8227                  + 2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n) 
8228                  + 8.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
8229                  + 5.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
8230                  - (-pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
8231                  + 2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
8232                  - pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n)
8233                  + 2.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n) 
8234                  - (dReQ6n*pow(dReQ2n,3.)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2.)
8235                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2.)-dImQ6n*pow(dImQ2n,3.))
8236                  + 4.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n) 
8237                  - 2.*((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) 
8238                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
8239                  + 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
8240                  - 2.*(-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
8241                  + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
8242                  - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n) 
8243                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)) 
8244                  + 4.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
8245                  + 4.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
8246                  - 4.*(dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
8247                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
8248                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
8249                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
8250                  - 12.*pow(dReQ1n,2.)-12.*pow(dImQ1n,2.)-14.*pow(dReQ2n,2.)-14.*pow(dImQ2n,2.)
8251                  - 8.*pow(dReQ3n,2.)-8.*pow(dImQ3n,2.)-6.*pow(dReQ4n,2.)-6.*pow(dImQ4n,2.)
8252                  - 4.*pow(dReQ5n,2.)-4.*pow(dImQ5n,2.)-6.*pow(dReQ6n,2.)-6.*pow(dImQ6n,2.)+24.*dMult)
8253                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8254   // to be polished:
8255   five6n3n1n1n1n = (reQ6nQ3nstarQ1nstarQ1nstarQ1nstar
8256                  - reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar
8257                                  - reQ6nQ4nstarQ1nstarQ1nstar-reQ6nQ4nstarQ1nstarQ1nstar-reQ6nQ4nstarQ1nstarQ1nstar
8258                                  - reQ3nQ1nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar
8259                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ3nstarQ3nstar)
8260                                  + reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar
8261                                  + reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
8262                                  + reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar
8263                                  + reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar
8264                                  + reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar
8265                  + 2.*(reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8266                  + 2.*(reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8267                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8268                  - 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.))
8269                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
8270                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.))
8271                                  - 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.))
8272                                  + 24.*dMult) 
8273                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8274
8275
8276   // to be polished:
8277   five6n1n1n4n4n = (reQ6nQ1nQ1nQ4nstarQ4nstar
8278                      - reQ6nQ2nQ4nstarQ4nstar-reQ7nQ1nQ4nstarQ4nstar-reQ7nQ1nQ4nstarQ4nstar
8279                                  - reQ6nQ1nQ4nstarQ3nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
8280                  - reQ8nQ6nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
8281                                  + 2.*(reQ6nQ4nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ8nQ4nstarQ4nstar)
8282                                  + reQ4nQ2nstarQ2nstar+reQ7nQ4nstarQ3nstar+reQ7nQ4nstarQ3nstar // ?? 1st term
8283                  + reQ8nQ7nstarQ1nstar+reQ8nQ6nstarQ2nstar+reQ8nQ7nstarQ1nstar
8284                                  + reQ4nQ2nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
8285                                  + reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                                                           
8286                  + reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                           
8287                  + 2.*(reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8288                  + 2.*(reQ6nQ4nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8289                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8290                  - 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.))
8291                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
8292                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
8293                                  - 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.))
8294                                  + 24.*dMult) 
8295                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8296   
8297   // to be polished:
8298   five6n1n5n1n1n = (reQ6nQ1nQ5nstarQ1nstarQ1nstar
8299                  - reQ6nQ1nQ5nstarQ2nstar
8300                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8301                  - reQ6nQ4nstarQ1nstarQ1nstar
8302                  - reQ7nQ5nstarQ1nstarQ1nstar 
8303                              - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8304                  - dMult*reQ6nQ5nstarQ1nstar
8305                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8306                  + reQ7nQ6nstarQ1nstar
8307                  + 3.*reQ6nQ5nstarQ1nstar
8308                  + 2.*reQ7nQ6nstarQ1nstar
8309                  + reQ6nQ4nstarQ2nstar
8310                  + reQ7nQ5nstarQ2nstar
8311                  + dMult*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8312                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8313                  + reQ7nQ6nstarQ1nstar
8314                  + reQ5nQ4nstarQ1nstar
8315                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
8316                  + 3.*reQ2nQ1nstarQ1nstar
8317                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8318                  + 2.*reQ5nQ4nstarQ1nstar
8319                  + 3.*reQ6nQ5nstarQ1nstar
8320                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8321                  + reQ5nQ4nstarQ1nstar
8322                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8323                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8324                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8325                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
8326                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8327                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
8328                  - 2.*dMult*dMult
8329                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
8330                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8331                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8332                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8333                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8334                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.)) 
8335                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8336   five6n2n4n2n2n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))*(dReQ2n*dReQ4n*dReQ6n-dReQ6n*dImQ2n*dImQ4n
8337                  + dReQ4n*dImQ2n*dImQ6n+dReQ2n*dImQ4n*dImQ6n)
8338                  - ((dReQ8n*dReQ4n+dImQ8n*dImQ4n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
8339                  + 2.*dReQ2n*dImQ2n*(dImQ8n*dReQ4n-dReQ8n*dImQ4n)) 
8340                  - (dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
8341                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3))
8342                  - ((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
8343                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
8344                  + 4.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
8345                  + pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n
8346                  - (2.*dMult-13.)*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
8347                  + dImQ6n*dImQ4n*dReQ2n)
8348                  + 7.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
8349                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
8350                  + 2.*(dMult-5.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8351                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8352                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8353                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8354                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)
8355                  + 2.*(3.*dMult-11.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*dMult*(dMult-6.))
8356                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8357   five6n4n4n4n2n = ((pow(dImQ4n,2.)+pow(dReQ4n,2.))*(dImQ4n*dImQ6n*dReQ2n+dImQ2n*dImQ6n*dReQ4n 
8358                  - dImQ2n*dImQ4n*dReQ6n+dReQ2n*dReQ4n*dReQ6n)
8359                  - (-pow(dImQ4n,2.)*dImQ2n*dImQ10n+dImQ2n*dImQ10n*pow(dReQ4n,2.)
8360                  + 2.*dImQ4n*dImQ10n*dReQ4n*dReQ2n-2.*dImQ4n*dImQ2n*dReQ4n*dReQ10n 
8361                  - pow(dImQ4n,2.)*dReQ2n*dReQ10n+pow(dReQ4n,2.)*dReQ2n*dReQ10n)
8362                  - (dImQ2n*dImQ4n*dImQ6n*dImQ8n+dImQ6n*dImQ8n*dReQ2n*dReQ4n 
8363                  + dImQ4n*dImQ8n*dReQ2n*dReQ6n-dImQ2n*dImQ8n*dReQ4n*dReQ6n
8364                  - dImQ4n*dImQ6n*dReQ2n*dReQ8n+dImQ2n*dImQ6n*dReQ4n*dReQ8n 
8365                  + dImQ2n*dImQ4n*dReQ6n*dReQ8n+dReQ2n*dReQ4n*dReQ6n*dReQ8n)
8366                  - ((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
8367                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
8368                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8369                  + (dReQ10n*dReQ8n*dReQ2n-dReQ10n*dImQ8n*dImQ2n+dImQ10n*dReQ8n*dImQ2n+dImQ10n*dImQ8n*dReQ2n)
8370                  + 4.*(dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
8371                  + dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n)
8372                  + 3.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
8373                  - 2.*(dMult-6.)*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
8374                  + 4.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
8375                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
8376                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))+2.*(dMult-5.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8377                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8378                  - pow((pow(dReQ4n,2.)+pow(dImQ4n,2.)),2.)+2.*(3.*dMult-10.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8379                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*dMult*(dMult-6.))
8380                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8381   // to be polished:
8382   five6n2n2n5n5n = (reQ6nQ2nQ2nQ5nstarQ5nstar
8383                  - reQ6nQ4nQ5nstarQ5nstar-reQ8nQ2nQ5nstarQ5nstar-reQ8nQ2nQ5nstarQ5nstar
8384                                  - reQ6nQ2nQ5nstarQ3nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ6nQ2nQ5nstarQ3nstar
8385                                  - reQ10nQ6nstarQ2nstarQ2nstar-reQ6nQ2nQ5nstarQ3nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ6nQ2nQ5nstarQ3nstar
8386                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ10nQ5nstarQ5nstar)
8387                                  + reQ5nQ4nstarQ1nstar+reQ8nQ5nstarQ3nstar+reQ8nQ5nstarQ3nstar
8388                  + reQ10nQ8nstarQ2nstar+reQ10nQ6nstarQ4nstar+reQ10nQ8nstarQ2nstar
8389                                  + reQ5nQ4nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
8390                                  + reQ8nQ5nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                                                           
8391                                  + reQ8nQ5nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                           
8392                  + 2.*(reQ8nQ6nstarQ2nstar+reQ8nQ6nstarQ2nstar+reQ4nQ2nstarQ2nstar)
8393                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar)
8394                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8395                  - 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.))
8396                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.))
8397                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8398                                  - 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.))
8399                                  + 24.*dMult) 
8400                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8401   // to be polished:
8402   five6n5n5n5n1n = (reQ6nQ5nQ5nstarQ5nstarQ1nstar
8403                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8404                  - reQ10nQ1nQ6nstarQ5nstar
8405                  - dMult*reQ6nQ5nstarQ1nstar
8406                  - reQ11nQ5nstarQ5nstarQ1nstar 
8407                              - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8408                  - reQ6nQ4nQ5nstarQ5nstar
8409                  + reQ5nQ4nstarQ1nstar
8410                  + reQ11nQ6nstarQ5nstar
8411                  + 3.*reQ6nQ5nstarQ1nstar
8412                  + 2.*reQ11nQ6nstarQ5nstar
8413                  + dMult*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8414                  + reQ11nQ6nstarQ5nstar
8415                  + reQ10nQ6nstarQ4nstar
8416                  + reQ5nQ4nstarQ1nstar
8417                  + reQ11nQ10nstarQ1nstar
8418                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8419                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
8420                  + 3.*reQ6nQ5nstarQ1nstar
8421                  + reQ5nQ4nstarQ1nstar
8422                  + 2.*dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8423                  + 3.*reQ10nQ5nstarQ5nstar
8424                  + reQ5nQ4nstarQ1nstar
8425                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8426                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8427                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8428                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8429                                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))
8430                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8431                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
8432                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8433                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.)) 
8434                  - 2.*dMult*dMult
8435                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8436                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8437                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8438                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
8439                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8440   // to be polished:
8441   five6n6n5n5n2n = (reQ6nQ6nQ5nstarQ5nstarQ2nstar
8442                  - reQ7nQ5nQ6nstarQ6nstar-reQ7nQ5nQ6nstarQ6nstar-reQ10nQ2nQ6nstarQ6nstar
8443                  - reQ6nQ1nQ5nstarQ2nstar-reQ6nQ1nQ5nstarQ2nstar-reQ6nQ4nQ5nstarQ5nstar
8444                                  - reQ12nQ5nstarQ5nstarQ2nstar-reQ6nQ4nQ5nstarQ5nstar-reQ6nQ1nQ5nstarQ2nstar-reQ6nQ1nQ5nstarQ2nstar
8445                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ12nQ6nstarQ6nstar)
8446                                  + reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ10nQ6nstarQ4nstar
8447                  + reQ12nQ10nstarQ2nstar+reQ12nQ7nstarQ5nstar+reQ12nQ7nstarQ5nstar
8448                                  + reQ7nQ6nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ5nQ4nstarQ1nstar                           
8449                                  + reQ7nQ6nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ5nQ4nstarQ1nstar
8450                                  + reQ10nQ6nstarQ4nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar                          
8451                  + 2.*(reQ10nQ5nstarQ5nstar+reQ7nQ5nstarQ2nstar+reQ7nQ5nstarQ2nstar)
8452                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar)
8453                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8454                  - 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.))
8455                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ10n,2.)+pow(dImQ10n,2.))
8456                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8457                                  - 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.))
8458                                  + 24.*dMult) 
8459                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8460   five6n6n6n4n2n = ((pow(dImQ6n,2.)+pow(dReQ6n,2.))*(dImQ4n*dImQ6n*dReQ2n+dImQ2n*dImQ6n*dReQ4n
8461                  - dImQ2n*dImQ4n*dReQ6n+dReQ2n*dReQ4n*dReQ6n)
8462                  - (dReQ2n*dReQ4n*dReQ6n*dReQ12n-dReQ6n*dReQ12n*dImQ2n*dImQ4n
8463                  - dReQ4n*dReQ12n*dImQ2n*dImQ6n-dReQ2n*dReQ12n*dImQ4n*dImQ6n
8464                  + dReQ4n*dReQ6n*dImQ2n*dImQ12n+dReQ2n*dReQ6n*dImQ4n*dImQ12n 
8465                  + dReQ2n*dReQ4n*dImQ6n*dImQ12n-dImQ2n*dImQ4n*dImQ6n*dImQ12n)
8466                  - (dImQ2n*pow(dImQ6n,2.)*dImQ10n+2.*dImQ6n*dImQ10n*dReQ2n*dReQ6n
8467                  - dImQ2n*dImQ10n*pow(dReQ6n,2.)-pow(dImQ6n,2.)*dReQ2n*dReQ10n 
8468                  + 2.*dImQ2n*dImQ6n*dReQ6n*dReQ10n+dReQ2n*pow(dReQ6n,2.)*dReQ10n)
8469                  - ((dReQ8n*dReQ4n-dImQ8n*dImQ4n)*(dReQ6n*dReQ6n-dImQ6n*dImQ6n)
8470                  + 2.*(dReQ8n*dImQ4n+dImQ8n*dReQ4n)*dReQ6n*dImQ6n)
8471                  + dReQ12n*dReQ10n*dReQ2n-dReQ12n*dImQ10n*dImQ2n+dImQ12n*dReQ10n*dImQ2n+dImQ12n*dImQ10n*dReQ2n
8472                  + dReQ12n*dReQ8n*dReQ4n-dReQ12n*dImQ8n*dImQ4n+dImQ12n*dReQ8n*dImQ4n+dImQ12n*dImQ8n*dReQ4n
8473                  + 3.*(pow(dReQ6n,2.)*dReQ12n+2.*dReQ6n*dImQ6n*dImQ12n-pow(dImQ6n,2.)*dReQ12n)
8474                  + 4.*(dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
8475                  + 4.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
8476                  - 2.*(dMult-6.)*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
8477                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
8478                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8479                  - 2.*(pow(dReQ12n,2.)+pow(dImQ12n,2.))-2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
8480                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))+2.*(3.*dMult-10.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8481                  - pow((pow(dReQ6n,2.)+pow(dImQ6n,2.)),2.)+2.*(dMult-5.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8482                  + 2.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*dMult*(dMult-6.))
8483                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8484   // to be polished (and  TBI swap with the one above):
8485   five6n6n6n5n1n = (reQ6nQ6nQ6nstarQ5nstarQ1nstar
8486                  - reQ7nQ5nQ6nstarQ6nstar
8487                  - reQ11nQ1nQ6nstarQ6nstar
8488                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8489                  - reQ12nQ6nstarQ5nstarQ1nstar 
8490                              - dMult*reQ6nQ5nstarQ1nstar
8491                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8492                  + reQ6nQ5nstarQ1nstar
8493                  + reQ12nQ6nstarQ6nstar
8494                  + 3.*dMult*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8495                  + 2.*reQ12nQ6nstarQ6nstar
8496                  + reQ7nQ6nstarQ1nstar
8497                  + reQ12nQ7nstarQ5nstar
8498                  + reQ11nQ6nstarQ5nstar
8499                  + reQ6nQ5nstarQ1nstar
8500                  + reQ12nQ11nstarQ1nstar
8501                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8502                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
8503                  + 3.*reQ7nQ6nstarQ1nstar
8504                  + reQ6nQ5nstarQ1nstar
8505                  + 2.*reQ6nQ5nstarQ1nstar
8506                  + 3.*reQ11nQ6nstarQ5nstar
8507                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8508                  + reQ6nQ5nstarQ1nstar
8509                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8510                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8511                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8512                                  - 2.*(pow(dReQ12n,2.)+pow(dImQ12n,2.))
8513                  - 2.*dMult*dMult
8514                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
8515                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8516                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.)) 
8517                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8518                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8519                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8520                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8521                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
8522                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8523   // Four distinct harmonics (11):
8524   // to be polished:
8525   five5n2n3n3n1n = (reQ5nQ2nQ3nstarQ3nstarQ1nstar
8526                  - reQ5nQ2nQ4nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar-reQ6nQ1nQ5nstarQ2nstar
8527                                  - reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ1nQ3nstarQ3nstar                  
8528                                  - reQ7nQ3nstarQ3nstarQ1nstar-reQ4nQ2nQ3nstarQ3nstar-reQ3nQ1nQ2nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar
8529                                  + 2.*(reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ7nQ5nstarQ2nstar)
8530                                  + reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ6nQ5nstarQ1nstar
8531                                  + reQ7nQ6nstarQ1nstar+reQ7nQ4nstarQ3nstar+reQ7nQ4nstarQ3nstar
8532                                  + reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar
8533                                  + reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar
8534                                  + reQ6nQ4nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
8535                                  + 2.*(reQ6nQ3nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8536                                  + 2.*(reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8537                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8538                                  - 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.))
8539                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
8540                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8541                                  - 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.))
8542                                  + 24.*dMult) 
8543                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8544   // to be polished:
8545   five5n1n1n4n3n = (reQ5nQ1nQ1nQ4nstarQ3nstar
8546                  - reQ5nQ2nQ4nstarQ3nstar-reQ6nQ1nQ4nstarQ3nstar-reQ6nQ1nQ4nstarQ3nstar
8547                                  - reQ5nQ1nQ4nstarQ2nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar
8548                                  - reQ7nQ5nstarQ1nstarQ1nstar-reQ5nQ1nQ3nstarQ3nstar-reQ3nQ1nstarQ1nstarQ1nstar-reQ5nQ1nQ3nstarQ3nstar
8549                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ7nQ4nstarQ3nstar)
8550                                  + reQ4nQ2nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar
8551                  + reQ7nQ6nstarQ1nstar+reQ7nQ5nstarQ2nstar+reQ7nQ6nstarQ1nstar
8552                                  + reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar
8553                                  + reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar                                                                                           
8554                                  + reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar                                                           
8555                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8556                  + 2.*(reQ5nQ3nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8557                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8558                                  - 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.))
8559                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
8560                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
8561                                  - 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.))
8562                                  + 24.*dMult) 
8563                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8564   // to be polished:
8565   five5n3n4n2n2n = (reQ5nQ3nQ4nstarQ2nstarQ2nstar
8566                  - reQ5nQ3nQ4nstarQ4nstar-reQ6nQ2nQ5nstarQ3nstar-reQ6nQ2nQ5nstarQ3nstar
8567                                  - reQ5nQ1nQ4nstarQ2nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar                      
8568                                  - reQ8nQ4nstarQ2nstarQ2nstar-reQ4nQ2nQ3nstarQ3nstar-reQ3nQ1nQ2nstarQ2nstar-reQ4nQ2nQ3nstarQ3nstar
8569                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ8nQ5nstarQ3nstar)
8570                                  + reQ5nQ4nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar
8571                  + reQ8nQ6nstarQ2nstar+reQ8nQ4nstarQ4nstar+reQ8nQ6nstarQ2nstar
8572                                  + reQ4nQ3nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar
8573                                  + reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar
8574                                  + reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar
8575                                  + 2.*(reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ4nQ2nstarQ2nstar)
8576                                  + 2.*(reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8577                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8578                                  - 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.))
8579                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
8580                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8581                                  - 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.))
8582                                  + 24.*dMult) 
8583                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8584
8585   // to be polished!!!:
8586   five5n2n1n4n4n = (reQ5nQ2nQ1nQ4nstarQ4nstar
8587                  - reQ5nQ3nQ4nstarQ4nstar-reQ6nQ2nQ4nstarQ4nstar-reQ7nQ1nQ4nstarQ4nstar
8588                                  - reQ5nQ1nQ4nstarQ2nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ5nQ2nQ4nstarQ3nstar
8589                                  - reQ8nQ5nstarQ2nstarQ1nstar-reQ5nQ2nQ4nstarQ3nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar
8590                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ8nQ4nstarQ4nstar)
8591                                  + reQ4nQ3nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ7nQ4nstarQ3nstar
8592                  + reQ8nQ7nstarQ1nstar+reQ8nQ5nstarQ3nstar+reQ8nQ6nstarQ2nstar
8593                                  + reQ4nQ3nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar
8594                                  + reQ6nQ4nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ5nQ3nstarQ2nstar                                                                                           
8595                                  + reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar                                                           
8596                  + 2.*(reQ7nQ5nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8597                  + 2.*(reQ5nQ4nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar)
8598                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8599                                  - 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.))
8600                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
8601                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8602                                  - 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.))
8603                                  + 24.*dMult) 
8604                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8605
8606
8607   // to be polished:
8608   five6n1n3n2n2n = (reQ6nQ1nQ3nstarQ2nstarQ2nstar
8609                  - reQ6nQ1nQ4nstarQ3nstar-reQ6nQ1nQ5nstarQ2nstar-reQ6nQ1nQ5nstarQ2nstar
8610                  - reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ2nstarQ2nstarQ2nstar-reQ6nQ3nstarQ2nstarQ1nstar                      
8611                                  - reQ7nQ3nstarQ2nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar
8612                                  + 2.*(reQ6nQ3nstarQ3nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ7nQ6nstarQ1nstar)
8613                                  + reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar
8614                  + reQ7nQ5nstarQ2nstar+reQ7nQ4nstarQ3nstar+reQ7nQ5nstarQ2nstar
8615                                  + reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
8616                                  + reQ5nQ4nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar
8617                                  + reQ5nQ4nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar
8618                                  + 2.*(reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ4nQ2nstarQ2nstar)
8619                                  + 2.*(reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8620                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8621                                  - 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.))
8622                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.))
8623                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
8624                                  - 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.))
8625                                  + 24.*dMult) 
8626                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8627
8628
8629   // to be polished:
8630   five6n3n4n4n1n = (reQ6nQ3nQ4nstarQ4nstarQ1nstar
8631                  - reQ8nQ1nQ6nstarQ3nstar-reQ6nQ3nQ5nstarQ4nstar-reQ6nQ3nQ5nstarQ4nstar
8632                                  - reQ6nQ4nstarQ1nstarQ1nstar-reQ6nQ2nQ4nstarQ4nstar-reQ6nQ4nstarQ1nstarQ1nstar                  
8633                                  - reQ9nQ4nstarQ4nstarQ1nstar-reQ4nQ1nQ3nstarQ2nstar-reQ5nQ3nQ4nstarQ4nstar-reQ4nQ1nQ3nstarQ2nstar
8634                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ9nQ6nstarQ3nstar)
8635                                  + reQ8nQ6nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar
8636                  + reQ9nQ5nstarQ4nstar+reQ9nQ8nstarQ1nstar+reQ9nQ5nstarQ4nstar
8637                                  + reQ8nQ5nstarQ3nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar                           
8638                                  + reQ5nQ3nstarQ2nstar+reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar                           
8639                                  + reQ5nQ3nstarQ2nstar+reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar
8640                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ8nQ4nstarQ4nstar)
8641                  + 2.*(reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8642                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8643                                  - 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.))
8644                                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.))
8645                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
8646                                  - 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.))
8647                  + 24.*dMult) 
8648                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8649
8650   // to be polished:
8651   five6n1n1n5n3n = (reQ6nQ1nQ1nQ5nstarQ3nstar
8652                  - reQ6nQ2nQ5nstarQ3nstar-reQ7nQ1nQ5nstarQ3nstar-reQ7nQ1nQ5nstarQ3nstar
8653                  - reQ6nQ1nQ5nstarQ2nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ6nQ1nQ5nstarQ2nstar
8654                                  - reQ8nQ6nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar-reQ3nQ1nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
8655                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ8nQ5nstarQ3nstar)
8656                                  + reQ5nQ3nstarQ2nstar+reQ7nQ5nstarQ2nstar+reQ7nQ5nstarQ2nstar
8657                  + reQ8nQ7nstarQ1nstar+reQ8nQ6nstarQ2nstar+reQ8nQ7nstarQ1nstar
8658                                  + reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar
8659                                  + reQ7nQ4nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ6nQ4nstarQ2nstar                                                                                           
8660                                  + reQ7nQ4nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ6nQ4nstarQ2nstar                                                                                           
8661                  + 2.*(reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8662                  + 2.*(reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8663                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8664                                  - 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.))
8665                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
8666                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
8667                  - 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.))
8668                  + 24.*dMult) 
8669                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8670   // to be polished:
8671   five6n3n5n2n2n = (reQ6nQ3nQ5nstarQ2nstarQ2nstar
8672                  - reQ6nQ3nQ5nstarQ4nstar-reQ7nQ2nQ6nstarQ3nstar-reQ7nQ2nQ6nstarQ3nstar
8673                  - reQ6nQ1nQ5nstarQ2nstar-reQ6nQ2nstarQ2nstarQ2nstar-reQ6nQ1nQ5nstarQ2nstar                      
8674                                  - reQ9nQ5nstarQ2nstarQ2nstar-reQ5nQ2nQ4nstarQ3nstar-reQ3nQ1nQ2nstarQ2nstar-reQ5nQ2nQ4nstarQ3nstar
8675                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ9nQ6nstarQ3nstar)
8676                                  + reQ6nQ4nstarQ2nstar+reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar
8677                  + reQ9nQ7nstarQ2nstar+reQ9nQ5nstarQ4nstar+reQ9nQ7nstarQ2nstar
8678                                  + reQ4nQ3nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar                           
8679                                  + reQ7nQ4nstarQ3nstar+reQ4nQ2nstarQ2nstar+reQ5nQ4nstarQ1nstar                           
8680                                  + reQ7nQ4nstarQ3nstar+reQ4nQ2nstarQ2nstar+reQ5nQ4nstarQ1nstar
8681                  + 2.*(reQ7nQ5nstarQ2nstar+reQ7nQ5nstarQ2nstar+reQ4nQ2nstarQ2nstar)
8682                  + 2.*(reQ5nQ3nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8683                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8684                                  - 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.))
8685                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
8686                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
8687                                  - 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.))
8688                  + 24.*dMult) 
8689                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8690
8691   // to be polished 
8692   five6n5n4n4n3n = (reQ6nQ5nQ4nstarQ4nstarQ3nstar
8693                  - reQ7nQ4nQ6nstarQ5nstar-reQ7nQ4nQ6nstarQ5nstar-reQ8nQ3nQ6nstarQ5nstar
8694                  - reQ6nQ1nQ4nstarQ3nstar-reQ6nQ1nQ4nstarQ3nstar-reQ6nQ2nQ4nstarQ4nstar                  
8695                                  - reQ11nQ4nstarQ4nstarQ3nstar-reQ5nQ3nQ4nstarQ4nstar-reQ5nQ2nQ4nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar
8696                                  + 2.*(reQ6nQ4nstarQ2nstar+reQ6nQ3nstarQ3nstar+reQ6nQ4nstarQ2nstar+reQ11nQ6nstarQ5nstar)
8697                                  + reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ8nQ6nstarQ2nstar
8698                  + reQ11nQ8nstarQ3nstar+reQ11nQ7nstarQ4nstar+reQ11nQ7nstarQ4nstar
8699                                  + reQ7nQ5nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ2nstarQ2nstar                                                           
8700                                  + reQ7nQ5nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ2nstarQ2nstar                           
8701                                  + reQ8nQ5nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
8702                  + 2.*(reQ8nQ4nstarQ4nstar+reQ7nQ4nstarQ3nstar+reQ7nQ4nstarQ3nstar)
8703                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar)
8704                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8705                                  - 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.))
8706                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.))
8707                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))                                
8708                                  - 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.))
8709                                  + 24.*dMult) 
8710                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8711   // to be polished:
8712   five6n3n1n5n5n = (reQ6nQ3nQ1nQ5nstarQ5nstar
8713                  - reQ6nQ4nQ5nstarQ5nstar-reQ7nQ3nQ5nstarQ5nstar-reQ9nQ1nQ5nstarQ5nstar      
8714                                  - reQ6nQ1nQ5nstarQ2nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ6nQ3nQ5nstarQ4nstar
8715                                  - reQ10nQ6nstarQ3nstarQ1nstar-reQ6nQ3nQ5nstarQ4nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ6nQ1nQ5nstarQ2nstar
8716                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ10nQ5nstarQ5nstar)
8717                                  + reQ5nQ4nstarQ1nstar+reQ7nQ5nstarQ2nstar+reQ9nQ5nstarQ4nstar
8718                  + reQ10nQ9nstarQ1nstar+reQ10nQ6nstarQ4nstar+reQ10nQ7nstarQ3nstar
8719                                  + reQ5nQ4nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ4nQ3nstarQ1nstar
8720                                  + reQ7nQ5nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ6nQ4nstarQ2nstar                                                                                           
8721                                  + reQ9nQ5nstarQ4nstar+reQ4nQ3nstarQ1nstar+reQ6nQ4nstarQ2nstar                                                                                           
8722                  + 2.*(reQ9nQ6nstarQ3nstar+reQ7nQ6nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8723                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar)
8724                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8725                                  - 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.))
8726                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ9n,2.)+pow(dImQ9n,2.))
8727                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8728                  - 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.))
8729                  + 24.*dMult) 
8730                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8731   // to be polished:
8732   five6n6n5n4n3n = (reQ6nQ6nQ5nstarQ4nstarQ3nstar
8733                  - reQ7nQ5nQ6nstarQ6nstar-reQ8nQ4nQ6nstarQ6nstar-reQ9nQ3nQ6nstarQ6nstar
8734                                  - reQ6nQ2nQ5nstarQ3nstar-reQ6nQ1nQ4nstarQ3nstar-reQ6nQ3nQ5nstarQ4nstar                  
8735                                  - reQ12nQ5nstarQ4nstarQ3nstar-reQ6nQ3nQ5nstarQ4nstar-reQ6nQ1nQ4nstarQ3nstar-reQ6nQ2nQ5nstarQ3nstar
8736                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ3nstarQ3nstar+reQ6nQ4nstarQ2nstar+reQ12nQ6nstarQ6nstar)
8737                                  + reQ7nQ6nstarQ1nstar+reQ8nQ6nstarQ2nstar+reQ9nQ6nstarQ3nstar
8738                  + reQ12nQ9nstarQ3nstar+reQ12nQ7nstarQ5nstar+reQ12nQ8nstarQ4nstar
8739                                  + reQ7nQ6nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar                                                           
8740                                  + reQ8nQ6nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar                           
8741                                  + reQ9nQ6nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ5nQ3nstarQ2nstar
8742                  + 2.*(reQ9nQ5nstarQ4nstar+reQ8nQ5nstarQ3nstar+reQ7nQ4nstarQ3nstar)
8743                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ3nstarQ3nstar)
8744                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8745                                  - 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.))
8746                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ9n,2.)+pow(dImQ9n,2.))
8747                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))                                
8748                                  - 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.))
8749                                  + 24.*dMult) 
8750                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8751   // Five distinct harmonics (3):
8752
8753   // to be polished:
8754   five6n2n4n3n1n = (reQ6nQ2nQ4nstarQ3nstarQ1nstar
8755                      - reQ6nQ2nQ4nstarQ4nstar-reQ6nQ2nQ5nstarQ3nstar-reQ7nQ1nQ6nstarQ2nstar
8756                      - reQ6nQ4nstarQ1nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
8757                      - reQ8nQ4nstarQ3nstarQ1nstar-reQ5nQ2nQ4nstarQ3nstar-reQ3nQ1nQ2nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar
8758                                  + 2.*(reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ6nQ3nstarQ3nstar+reQ8nQ6nstarQ2nstar)
8759                                  + 1.*(reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ7nQ6nstarQ1nstar)
8760                                  + 1.*(reQ8nQ7nstarQ1nstar+reQ8nQ4nstarQ4nstar+reQ8nQ5nstarQ3nstar)
8761                                  + 1.*(reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8762                                  + 1.*(reQ5nQ3nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8763                                  + 1.*(reQ7nQ5nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar)
8764                                  + 2.*(reQ7nQ4nstarQ3nstar+reQ5nQ4nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8765                                  + 2.*(reQ4nQ2nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar) // 3 - 1
8766                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8767                  - 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.)) 
8768                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
8769                          - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
8770                  - 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.)) 
8771                  + 24.*dMult) 
8772                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8773
8774
8775   // to be polished:
8776   five6n2n1n5n4n = (reQ6nQ2nQ1nQ5nstarQ4nstar
8777                  - reQ6nQ3nQ5nstarQ4nstar-reQ7nQ2nQ5nstarQ4nstar-reQ8nQ1nQ5nstarQ4nstar
8778                                  - reQ6nQ1nQ5nstarQ2nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ6nQ2nQ5nstarQ3nstar                      
8779                                  - reQ9nQ6nstarQ2nstarQ1nstar-reQ6nQ2nQ4nstarQ4nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
8780                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ9nQ5nstarQ4nstar)
8781                                  + reQ5nQ3nstarQ2nstar+reQ7nQ5nstarQ2nstar+reQ8nQ5nstarQ3nstar
8782                  + reQ9nQ8nstarQ1nstar+reQ9nQ6nstarQ3nstar+reQ9nQ7nstarQ2nstar
8783                                  + reQ4nQ3nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar                           
8784                                  + reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                           
8785                                  + reQ8nQ4nstarQ4nstar+reQ4nQ2nstarQ2nstar+reQ6nQ4nstarQ2nstar
8786                  + 2.*(reQ8nQ6nstarQ2nstar+reQ7nQ6nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8787                  + 2.*(reQ6nQ4nstarQ2nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar)
8788                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8789                                  - 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.))
8790                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.))
8791                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
8792                                  - 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.))
8793                  + 24.*dMult) 
8794                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8795
8796
8797
8798   // to be polished:
8799   five6n4n5n3n2n = (reQ6nQ4nQ5nstarQ3nstarQ2nstar
8800                      - reQ6nQ4nQ5nstarQ5nstar-reQ7nQ3nQ6nstarQ4nstar-reQ8nQ2nQ6nstarQ4nstar
8801                      - reQ6nQ1nQ5nstarQ2nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ2nQ5nstarQ3nstar
8802                      - reQ10nQ5nstarQ3nstarQ2nstar-reQ5nQ3nQ4nstarQ4nstar-reQ4nQ1nQ3nstarQ2nstar-reQ5nQ2nQ4nstarQ3nstar
8803                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ3nstarQ3nstar+reQ10nQ6nstarQ4nstar)
8804                                  + 1.*(reQ6nQ5nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ8nQ6nstarQ2nstar)
8805                                  + 1.*(reQ10nQ8nstarQ2nstar+reQ10nQ5nstarQ5nstar+reQ10nQ7nstarQ3nstar)
8806                                  + 1.*(reQ5nQ4nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8807                                  + 1.*(reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar)
8808                                  + 1.*(reQ8nQ4nstarQ4nstar+reQ4nQ3nstarQ1nstar+reQ5nQ4nstarQ1nstar)
8809                                  + 2.*(reQ8nQ5nstarQ3nstar+reQ7nQ5nstarQ2nstar+reQ5nQ3nstarQ2nstar)
8810                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar) // 3 - 1
8811                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8812                  - 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.)) 
8813                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
8814                          - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
8815                  - 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.)) 
8816                  + 24.*dMult) 
8817                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8818
8819
8820
8821   f5pCorrelations->Fill(0.5,five3n2n3n1n1n,d5pMultiplicityWeight);
8822   f5pCorrelations->Fill(1.5,five4n1n2n2n1n,d5pMultiplicityWeight); 
8823   f5pCorrelations->Fill(2.5,five4n2n3n2n1n,d5pMultiplicityWeight);
8824   f5pCorrelations->Fill(3.5,five4n3n3n2n2n,d5pMultiplicityWeight);
8825   f5pCorrelations->Fill(4.5,five4n2n4n1n1n,d5pMultiplicityWeight);
8826   f5pCorrelations->Fill(5.5,five4n3n4n2n1n,d5pMultiplicityWeight);
8827   f5pCorrelations->Fill(6.5,five5n1n3n2n1n,d5pMultiplicityWeight);
8828   f5pCorrelations->Fill(7.5,five5n2n5n1n1n,d5pMultiplicityWeight);
8829   f5pCorrelations->Fill(8.5,five5n2n4n2n1n,d5pMultiplicityWeight);
8830   f5pCorrelations->Fill(9.5,five5n3n4n3n1n,d5pMultiplicityWeight);
8831   f5pCorrelations->Fill(10.5,five5n4n4n3n2n,d5pMultiplicityWeight);
8832   f5pCorrelations->Fill(11.5,five5n3n5n2n1n,d5pMultiplicityWeight);
8833   f5pCorrelations->Fill(12.5,five5n4n5n2n2n,d5pMultiplicityWeight);
8834   f5pCorrelations->Fill(13.5,five5n4n5n3n1n,d5pMultiplicityWeight);
8835   f5pCorrelations->Fill(14.5,five6n1n3n3n1n,d5pMultiplicityWeight);
8836   f5pCorrelations->Fill(15.5,five6n2n3n3n2n,d5pMultiplicityWeight); 
8837   f5pCorrelations->Fill(16.5,five6n1n4n2n1n,d5pMultiplicityWeight); 
8838   f5pCorrelations->Fill(17.5,five6n3n4n3n2n,d5pMultiplicityWeight); 
8839   f5pCorrelations->Fill(18.5,five6n4n4n3n3n,d5pMultiplicityWeight); 
8840   f5pCorrelations->Fill(19.5,five6n2n5n2n1n,d5pMultiplicityWeight); 
8841   f5pCorrelations->Fill(20.5,five6n3n5n3n1n,d5pMultiplicityWeight); 
8842   f5pCorrelations->Fill(21.5,five6n4n5n4n1n,d5pMultiplicityWeight); 
8843   f5pCorrelations->Fill(22.5,five6n5n5n3n3n,d5pMultiplicityWeight); 
8844   f5pCorrelations->Fill(23.5,five6n2n6n1n1n,d5pMultiplicityWeight); 
8845   f5pCorrelations->Fill(24.5,five6n3n6n2n1n,d5pMultiplicityWeight); 
8846   f5pCorrelations->Fill(25.5,five6n4n6n2n2n,d5pMultiplicityWeight); 
8847   f5pCorrelations->Fill(26.5,five6n4n6n3n1n,d5pMultiplicityWeight); 
8848   f5pCorrelations->Fill(27.5,five6n5n5n4n2n,d5pMultiplicityWeight); 
8849   f5pCorrelations->Fill(28.5,five6n5n6n3n2n,d5pMultiplicityWeight); 
8850   f5pCorrelations->Fill(29.5,five6n5n6n4n1n,d5pMultiplicityWeight);
8851   //f5pCorrelations->Fill(30.5,-44.,d5pMultiplicityWeight);
8852   f5pCorrelations->Fill(31.5,five2n1n1n1n1n,d5pMultiplicityWeight);
8853   f5pCorrelations->Fill(32.5,five2n2n2n1n1n,d5pMultiplicityWeight); 
8854   f5pCorrelations->Fill(33.5,five3n3n2n2n2n,d5pMultiplicityWeight);
8855   f5pCorrelations->Fill(34.5,five4n1n1n1n1n,d5pMultiplicityWeight);
8856   f5pCorrelations->Fill(35.5,five4n2n2n2n2n,d5pMultiplicityWeight); 
8857   f5pCorrelations->Fill(36.5,five4n4n4n2n2n,d5pMultiplicityWeight); 
8858   f5pCorrelations->Fill(37.5,five6n3n3n3n3n,d5pMultiplicityWeight); 
8859   f5pCorrelations->Fill(38.5,five6n6n4n4n4n,d5pMultiplicityWeight); 
8860   f5pCorrelations->Fill(39.5,five6n6n6n3n3n,d5pMultiplicityWeight);
8861   //f5pCorrelations->Fill(40.5,-44.,d5pMultiplicityWeight);
8862   f5pCorrelations->Fill(41.5,five3n1n2n1n1n,d5pMultiplicityWeight);
8863   f5pCorrelations->Fill(42.5,five3n2n2n2n1n,d5pMultiplicityWeight);
8864   f5pCorrelations->Fill(43.5,five3n3n3n2n1n,d5pMultiplicityWeight);
8865   f5pCorrelations->Fill(44.5,five4n1n3n1n1n,d5pMultiplicityWeight);
8866   f5pCorrelations->Fill(45.5,five4n1n1n3n3n,d5pMultiplicityWeight);
8867   f5pCorrelations->Fill(46.5,five4n3n3n3n1n,d5pMultiplicityWeight);
8868   f5pCorrelations->Fill(47.5,five4n4n3n3n2n,d5pMultiplicityWeight);
8869   f5pCorrelations->Fill(48.5,five4n4n4n3n1n,d5pMultiplicityWeight);
8870   f5pCorrelations->Fill(49.5,five5n2n1n1n1n,d5pMultiplicityWeight);
8871   f5pCorrelations->Fill(50.5,five5n1n2n2n2n,d5pMultiplicityWeight);
8872   f5pCorrelations->Fill(51.5,five5n2n3n2n2n,d5pMultiplicityWeight);
8873   f5pCorrelations->Fill(52.5,five5n3n3n3n2n,d5pMultiplicityWeight);
8874   f5pCorrelations->Fill(53.5,five5n1n4n1n1n,d5pMultiplicityWeight);
8875   f5pCorrelations->Fill(54.5,five5n4n3n3n3n,d5pMultiplicityWeight);
8876   f5pCorrelations->Fill(55.5,five5n4n4n4n1n,d5pMultiplicityWeight);
8877   f5pCorrelations->Fill(56.5,five5n5n4n3n3n,d5pMultiplicityWeight);
8878   f5pCorrelations->Fill(57.5,five5n5n4n4n2n,d5pMultiplicityWeight);
8879   f5pCorrelations->Fill(58.5,five5n5n5n3n2n,d5pMultiplicityWeight);
8880   f5pCorrelations->Fill(59.5,five5n5n5n4n1n,d5pMultiplicityWeight);
8881   f5pCorrelations->Fill(60.5,five6n2n2n1n1n,d5pMultiplicityWeight);
8882   f5pCorrelations->Fill(61.5,five6n3n1n1n1n,d5pMultiplicityWeight);
8883   f5pCorrelations->Fill(62.5,five6n1n1n4n4n,d5pMultiplicityWeight);
8884   f5pCorrelations->Fill(63.5,five6n1n5n1n1n,d5pMultiplicityWeight);
8885   f5pCorrelations->Fill(64.5,five6n2n4n2n2n,d5pMultiplicityWeight);
8886   f5pCorrelations->Fill(65.5,five6n4n4n4n2n,d5pMultiplicityWeight);
8887   f5pCorrelations->Fill(66.5,five6n2n2n5n5n,d5pMultiplicityWeight);
8888   f5pCorrelations->Fill(67.5,five6n5n5n5n1n,d5pMultiplicityWeight);
8889   f5pCorrelations->Fill(68.5,five6n6n5n5n2n,d5pMultiplicityWeight);
8890   f5pCorrelations->Fill(69.5,five6n6n6n4n2n,d5pMultiplicityWeight);
8891   f5pCorrelations->Fill(70.5,five6n6n6n5n1n,d5pMultiplicityWeight);
8892   //f5pCorrelations->Fill(71.5,-44.,d5pMultiplicityWeight);
8893   f5pCorrelations->Fill(72.5,five5n2n3n3n1n,d5pMultiplicityWeight);
8894   f5pCorrelations->Fill(73.5,five5n1n1n4n3n,d5pMultiplicityWeight);
8895   f5pCorrelations->Fill(74.5,five5n3n4n2n2n,d5pMultiplicityWeight);
8896   f5pCorrelations->Fill(75.5,five5n2n1n4n4n,d5pMultiplicityWeight);
8897   f5pCorrelations->Fill(76.5,five6n1n3n2n2n,d5pMultiplicityWeight);
8898   f5pCorrelations->Fill(77.5,five6n3n4n4n1n,d5pMultiplicityWeight);
8899   f5pCorrelations->Fill(78.5,five6n1n1n5n3n,d5pMultiplicityWeight);
8900   f5pCorrelations->Fill(79.5,five6n3n5n2n2n,d5pMultiplicityWeight);
8901   f5pCorrelations->Fill(80.5,five6n5n4n4n3n,d5pMultiplicityWeight);
8902   f5pCorrelations->Fill(81.5,five6n3n1n5n5n,d5pMultiplicityWeight);
8903   f5pCorrelations->Fill(82.5,five6n6n5n4n3n,d5pMultiplicityWeight);
8904   //f5pCorrelations->Fill(83.5,-44.,d5pMultiplicityWeight);
8905   f5pCorrelations->Fill(84.5,five6n2n4n3n1n,d5pMultiplicityWeight);
8906   f5pCorrelations->Fill(85.5,five6n2n1n5n4n,d5pMultiplicityWeight);
8907   f5pCorrelations->Fill(86.5,five6n4n5n3n2n,d5pMultiplicityWeight);
8908   allMixedCorrelators[56]=five3n2n3n1n1n;
8909   allMixedCorrelators[57]=five4n1n2n2n1n;
8910   allMixedCorrelators[58]=five4n2n3n2n1n;
8911   allMixedCorrelators[59]=five4n3n3n2n2n;
8912   allMixedCorrelators[60]=five4n2n4n1n1n;
8913   allMixedCorrelators[61]=five4n3n4n2n1n;
8914   allMixedCorrelators[62]=five5n1n3n2n1n;
8915   allMixedCorrelators[63]=five5n2n5n1n1n;
8916   allMixedCorrelators[64]=five5n2n4n2n1n;
8917   allMixedCorrelators[65]=five5n3n4n3n1n;
8918   allMixedCorrelators[66]=five5n4n4n3n2n;
8919   allMixedCorrelators[67]=five5n3n5n2n1n;
8920   allMixedCorrelators[68]=five5n4n5n2n2n;
8921   allMixedCorrelators[69]=five5n4n5n3n1n;
8922   allMixedCorrelators[70]=five6n1n3n3n1n;
8923   allMixedCorrelators[71]=five6n2n3n3n2n;
8924   allMixedCorrelators[72]=five6n1n4n2n1n;
8925   allMixedCorrelators[73]=five6n3n4n3n2n;
8926   allMixedCorrelators[74]=five6n4n4n3n3n;
8927   allMixedCorrelators[75]=five6n2n5n2n1n;
8928   allMixedCorrelators[76]=five6n3n5n3n1n;
8929   allMixedCorrelators[77]=five6n4n5n4n1n;
8930   allMixedCorrelators[78]=five6n5n5n3n3n;
8931   allMixedCorrelators[79]=five6n2n6n1n1n;
8932   allMixedCorrelators[80]=five6n3n6n2n1n;
8933   allMixedCorrelators[81]=five6n4n6n2n2n;
8934   allMixedCorrelators[82]=five6n4n6n3n1n;
8935   allMixedCorrelators[83]=five6n5n5n4n2n;
8936   allMixedCorrelators[84]=five6n5n6n3n2n;
8937   allMixedCorrelators[85]=five6n5n6n4n1n;
8938   allMixedCorrelators[86]=five2n1n1n1n1n;
8939   allMixedCorrelators[87]=five2n2n2n1n1n;
8940   allMixedCorrelators[88]=five3n3n2n2n2n;
8941   allMixedCorrelators[89]=five4n1n1n1n1n;
8942   allMixedCorrelators[90]=five4n2n2n2n2n;
8943   allMixedCorrelators[91]=five4n4n4n2n2n;
8944   allMixedCorrelators[92]=five6n3n3n3n3n;
8945   allMixedCorrelators[93]=five6n6n4n4n4n;
8946   allMixedCorrelators[94]=five6n6n6n3n3n;
8947   allMixedCorrelators[95]=five3n1n2n1n1n;
8948   allMixedCorrelators[96]=five3n2n2n2n1n;
8949   allMixedCorrelators[97]=five3n3n3n2n1n;
8950   allMixedCorrelators[98]=five4n1n3n1n1n;
8951   allMixedCorrelators[99]=five4n1n1n3n3n;
8952   allMixedCorrelators[100]=five4n3n3n3n1n;
8953   allMixedCorrelators[101]=five4n4n3n3n2n;
8954   allMixedCorrelators[102]=five4n4n4n3n1n;
8955   allMixedCorrelators[103]=five5n2n1n1n1n;
8956   allMixedCorrelators[104]=five5n1n2n2n2n;
8957   allMixedCorrelators[105]=five5n2n3n2n2n;
8958   allMixedCorrelators[106]=five5n3n3n3n2n;
8959   allMixedCorrelators[107]=five5n1n4n1n1n;
8960   allMixedCorrelators[108]=five5n4n3n3n3n;
8961   allMixedCorrelators[109]=five5n4n4n4n1n;
8962   allMixedCorrelators[110]=five5n5n4n3n3n;
8963   allMixedCorrelators[111]=five5n5n4n4n2n;
8964   allMixedCorrelators[112]=five5n5n5n3n2n;
8965   allMixedCorrelators[113]=five5n5n5n4n1n;
8966   allMixedCorrelators[114]=five6n2n2n1n1n;
8967   allMixedCorrelators[115]=five6n3n1n1n1n;
8968   allMixedCorrelators[116]=five6n1n1n4n4n;
8969   allMixedCorrelators[117]=five6n1n5n1n1n;
8970   allMixedCorrelators[118]=five6n2n4n2n2n;
8971   allMixedCorrelators[119]=five6n4n4n4n2n;
8972   allMixedCorrelators[120]=five6n2n2n5n5n;
8973   allMixedCorrelators[121]=five6n5n5n5n1n;
8974   allMixedCorrelators[122]=five6n6n5n5n2n;
8975   allMixedCorrelators[123]=five6n6n6n4n2n;
8976   allMixedCorrelators[124]=five6n6n6n5n1n;
8977   allMixedCorrelators[125]=five5n2n3n3n1n;
8978   allMixedCorrelators[126]=five5n1n1n4n3n;
8979   allMixedCorrelators[127]=five5n3n4n2n2n;
8980   allMixedCorrelators[128]=five5n2n1n4n4n;
8981   allMixedCorrelators[129]=five6n1n3n2n2n;
8982   allMixedCorrelators[130]=five6n3n4n4n1n;
8983   allMixedCorrelators[131]=five6n1n1n5n3n;
8984   allMixedCorrelators[132]=five6n3n5n2n2n;
8985   allMixedCorrelators[133]=five6n5n4n4n3n;
8986   allMixedCorrelators[134]=five6n3n1n5n5n;
8987   allMixedCorrelators[135]=five6n6n5n4n3n;
8988   allMixedCorrelators[136]=five6n2n4n3n1n;
8989   allMixedCorrelators[137]=five6n2n1n5n4n;
8990   allMixedCorrelators[138]=five6n4n5n3n2n;
8991  } // end of if(dMult>4.)
8992  
8993  // Products of mixed harmonics:
8994  Double_t dwx=0.;
8995  Double_t dwy=0.;
8996  for(Int_t x=1;x<=139;x++)
8997  {  
8998   if(x>=1 && x<7)
8999   {
9000    dwx=d2pMultiplicityWeight;
9001   } else if(x>=7 && x<16)
9002     {
9003      dwx=d3pMultiplicityWeight;
9004     } else if(x>=16 && x<57)
9005       {
9006        dwx=d4pMultiplicityWeight;
9007       } else if(x>=57 && x<140)
9008         {
9009          dwx=d5pMultiplicityWeight;
9010         }
9011   for(Int_t y=x+1;y<=139;y++)
9012   {
9013    if(y>=1 && y<7)
9014    {
9015     dwy=d2pMultiplicityWeight;
9016    } else if(y>=7 && y<16)
9017      {
9018       dwy=d3pMultiplicityWeight;
9019      } else if(y>=16 && y<57)
9020        {
9021         dwy=d4pMultiplicityWeight;
9022        } else if(y>=57 && y<140)
9023          {
9024           dwy=d5pMultiplicityWeight;
9025          }
9026    fMixedHarmonicProductOfCorrelations->Fill(x-0.5,y-0.5,allMixedCorrelators[x-1]*allMixedCorrelators[y-1],dwx*dwy);
9027   } // end of for(Int_t y=x+1;y<=139;y++)
9028  } // end of for(Int_t x=1;x<=139;x++)
9029
9030 } // end of void AliFlowAnalysisWithQCumulants::CalculateMixedHarmonics()
9031
9032 //===================================================================================================================
9033
9034 void AliFlowAnalysisWithQCumulants::CalculateCumulantsMixedHarmonics()
9035 {
9036  // Calculate in this method all multi-particle cumulants for azimuthal correlations in mixed harmonics.
9037  // (Remark: For completeness sake, we also calculate here again cumulants in the same harmonic.) 
9038
9039  // a) Calculate 2-p cumulants; 
9040  // b) Calculate 3-p cumulants; 
9041  // c) Calculate 4-p cumulants; 
9042  // d) Calculate 5-p cumulants. 
9043
9044  // a) Calculate 2-p cumulants: 
9045  for(Int_t b=1;b<=6;b++)
9046  {
9047   f2pCumulants->SetBinContent(b,f2pCorrelations->GetBinContent(b)); 
9048   Double_t dSumWLinear = 0.; // sum of linear event weights
9049   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
9050   Double_t dSpread = 0.; // weighted and biased estimator for sigma
9051   Double_t dError = 0.; // weighted and unbiased estimator for error
9052   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9053   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9054   dSpread = f2pCorrelations->GetBinError(b);
9055   if(pow(dSumWLinear,2.)>dSumWQuadratic)
9056   {
9057    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
9058    f2pCumulants->SetBinError(b,dError); 
9059   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
9060  } // end of for(Int_t b=1;b<=6;b++)
9061
9062  // b) Calculate 3-p cumulants: 
9063  for(Int_t b=1;b<=10;b++)
9064  {
9065   f3pCumulants->SetBinContent(b,f3pCorrelations->GetBinContent(b)); 
9066   Double_t dSumWLinear = 0.; // sum of linear event weights
9067   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
9068   Double_t dSpread = 0.; // weighted and biased estimator for sigma
9069   Double_t dError = 0.; // weighted and unbiased estimator for sigma
9070   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9071   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9072   dSpread = f3pCorrelations->GetBinError(b);
9073   if(pow(dSumWLinear,2.)>dSumWQuadratic)
9074   {
9075    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
9076    f3pCumulants->SetBinError(b,dError); 
9077   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
9078  } // end of for(Int_t b=1;b<=10;b++)
9079
9080  // c) Calculate 4-p cumulants: 
9081  // c1) "Single harmonic":
9082  for(Int_t b=1;b<=6;b++)
9083  {
9084   f4pCumulants->SetBinContent(b,f4pCorrelations->GetBinContent(b)-2.*pow(f2pCorrelations->GetBinContent(b),2.));
9085   Double_t dSumWLinearTwo = 0.; // sum of linear event weights for <2>
9086   Double_t dSumWQuadraticTwo = 0.; // sum of quadratic event weights <2>
9087   Double_t dSpreadTwo = 0.; // weighted and biased estimator for sigma of <2>
9088   Double_t dSumWLinearFour = 0.; // sum of linear event weights for <4>
9089   Double_t dSumWQuadraticFour = 0.; // sum of quadratic event weights <4>
9090   Double_t dSpreadFour = 0.; // weighted and biased estimator for sigma of <4>
9091   dSumWLinearTwo = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9092   dSumWQuadraticTwo = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9093   dSpreadTwo = f2pCorrelations->GetBinError(b);
9094   dSumWLinearFour = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9095   dSumWQuadraticFour = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9096   dSpreadFour = f4pCorrelations->GetBinError(b);
9097   if(pow(dSumWLinearTwo,2.)>dSumWQuadraticTwo && pow(dSumWLinearFour,2.)>dSumWQuadraticFour) 
9098   {
9099    Double_t dError = 16.*pow(f2pCorrelations->GetBinContent(b),2.)
9100                    * pow((pow(dSumWQuadraticTwo,0.5)/dSumWLinearTwo)*dSpreadTwo*pow(pow(dSumWLinearTwo,2.)/(pow(dSumWLinearTwo,2.)-dSumWQuadraticTwo),0.5),2.)
9101                    + pow((pow(dSumWQuadraticFour,0.5)/dSumWLinearFour)*dSpreadFour*pow(pow(dSumWLinearFour,2.)/(pow(dSumWLinearFour,2.)-dSumWQuadraticFour),0.5),2.)
9102                    - 8.*f2pCorrelations->GetBinContent(b)
9103                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9104                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(b,b+15))
9105                    - f2pCorrelations->GetBinContent(b)*f4pCorrelations->GetBinContent(b))
9106                    / (dSumWLinearTwo*dSumWLinearFour-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9107    if(dError>0.)
9108    {
9109     f4pCumulants->SetBinError(b,pow(dError,0.5)); 
9110    }
9111   } // end of if(pow(dSumWLinearTwo,2.)>dSumWQuadraticTwo && pow(dSumWLinearFour,2.)>dSumWQuadraticFour) 
9112  } // end of for(Int_t b=1;b<=6;b++)     
9113  // c2) "Standard candles":
9114  // <4>_{2n,1n|2n,1n}:
9115  f4pCumulants->SetBinContent(8,f4pCorrelations->GetBinContent(8)-f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(1));
9116  {
9117   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
9118   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
9119   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
9120   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
9121   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
9122   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
9123   Double_t dSumWLinearFour2n1n2n1n = 0.; // sum of linear event weights for <4>
9124   Double_t dSumWQuadraticFour2n1n2n1n = 0.; // sum of quadratic event weights <4>
9125   Double_t dSpreadFour2n1n2n1n = 0.; // weighted and biased estimator for sigma of <4>
9126   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9127   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9128   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
9129   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9130   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9131   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
9132   dSumWLinearFour2n1n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9133   dSumWQuadraticFour2n1n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9134   dSpreadFour2n1n2n1n = f4pCorrelations->GetBinError(8);
9135   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
9136      pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
9137      pow(dSumWLinearFour2n1n2n1n,2.)>dSumWQuadraticFour2n1n2n1n)
9138   {
9139    Double_t dError = pow(f2pCorrelations->GetBinContent(2),2.)
9140                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
9141                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
9142                    + pow(f2pCorrelations->GetBinContent(1),2.)
9143                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
9144                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
9145                    + pow((pow(dSumWQuadraticFour2n1n2n1n,0.5)/dSumWLinearFour2n1n2n1n)
9146                    * dSpreadFour2n1n2n1n*pow(pow(dSumWLinearFour2n1n2n1n,2.)/(pow(dSumWLinearFour2n1n2n1n,2.)-dSumWQuadraticFour2n1n2n1n),0.5),2.)
9147                    + 2.*f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(1)
9148                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9149                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,2))
9150                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(2))
9151                    / (dSumWLinearTwo1n1n*dSumWLinearTwo2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9152                    - 2.*f2pCorrelations->GetBinContent(2)
9153                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9154                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,22))
9155                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(8))
9156                    / (dSumWLinearTwo1n1n*dSumWLinearFour2n1n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9157                    - 2.*f2pCorrelations->GetBinContent(1)
9158                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9159                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,22))
9160                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(8))
9161                    / (dSumWLinearTwo2n2n*dSumWLinearFour2n1n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9162    if(dError>0.)
9163    {
9164     f4pCumulants->SetBinError(8,pow(dError,0.5)); 
9165    }
9166   } // end of if(...)
9167  } // end of {
9168  // <4>_{3n,1n|3n,1n}:
9169  f4pCumulants->SetBinContent(9,f4pCorrelations->GetBinContent(9)-f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(1));
9170  {
9171   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
9172   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
9173   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
9174   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9175   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9176   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9177   Double_t dSumWLinearFour3n1n3n1n = 0.; // sum of linear event weights for <4>
9178   Double_t dSumWQuadraticFour3n1n3n1n = 0.; // sum of quadratic event weights <4>
9179   Double_t dSpreadFour3n1n3n1n = 0.; // weighted and biased estimator for sigma of <4>
9180   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9181   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9182   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
9183   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9184   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9185   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9186   dSumWLinearFour3n1n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9187   dSumWQuadraticFour3n1n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9188   dSpreadFour3n1n3n1n = f4pCorrelations->GetBinError(9);
9189   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
9190      pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9191      pow(dSumWLinearFour3n1n3n1n,2.)>dSumWQuadraticFour3n1n3n1n)
9192   {
9193    Double_t dError = pow(f2pCorrelations->GetBinContent(3),2.)
9194                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
9195                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
9196                    + pow(f2pCorrelations->GetBinContent(1),2.)
9197                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9198                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9199                    + pow((pow(dSumWQuadraticFour3n1n3n1n,0.5)/dSumWLinearFour3n1n3n1n)
9200                    * dSpreadFour3n1n3n1n*pow(pow(dSumWLinearFour3n1n3n1n,2.)/(pow(dSumWLinearFour3n1n3n1n,2.)-dSumWQuadraticFour3n1n3n1n),0.5),2.)
9201                    + 2.*f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(1)
9202                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9203                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,3))
9204                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(3))
9205                    / (dSumWLinearTwo1n1n*dSumWLinearTwo3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9206                    - 2.*f2pCorrelations->GetBinContent(3)
9207                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9208                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,23))
9209                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(9))
9210                    / (dSumWLinearTwo1n1n*dSumWLinearFour3n1n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9211                    - 2.*f2pCorrelations->GetBinContent(1)
9212                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9213                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,23))
9214                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(9))
9215                    / (dSumWLinearTwo3n3n*dSumWLinearFour3n1n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9216    if(dError>0.)
9217    {
9218     f4pCumulants->SetBinError(9,pow(dError,0.5)); 
9219    }
9220   } // end of if(...)
9221  } // end of {
9222  // <4>_{3n,2n|3n,2n}:
9223  f4pCumulants->SetBinContent(10,f4pCorrelations->GetBinContent(10)-f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(2));
9224  {
9225   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
9226   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
9227   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
9228   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9229   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9230   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9231   Double_t dSumWLinearFour3n2n3n2n = 0.; // sum of linear event weights for <4>
9232   Double_t dSumWQuadraticFour3n2n3n2n = 0.; // sum of quadratic event weights <4>
9233   Double_t dSpreadFour3n2n3n2n = 0.; // weighted and biased estimator for sigma of <4>
9234   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9235   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9236   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
9237   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9238   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9239   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9240   dSumWLinearFour3n2n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9241   dSumWQuadraticFour3n2n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9242   dSpreadFour3n2n3n2n = f4pCorrelations->GetBinError(10);
9243   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
9244      pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9245      pow(dSumWLinearFour3n2n3n2n,2.)>dSumWQuadraticFour3n2n3n2n)
9246   {
9247    Double_t dError = pow(f2pCorrelations->GetBinContent(3),2.)
9248                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
9249                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
9250                    + pow(f2pCorrelations->GetBinContent(2),2.)
9251                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9252                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9253                    + pow((pow(dSumWQuadraticFour3n2n3n2n,0.5)/dSumWLinearFour3n2n3n2n)
9254                    * dSpreadFour3n2n3n2n*pow(pow(dSumWLinearFour3n2n3n2n,2.)/(pow(dSumWLinearFour3n2n3n2n,2.)-dSumWQuadraticFour3n2n3n2n),0.5),2.)
9255                    + 2.*f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(2)
9256                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9257                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,3))
9258                    - f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(3))
9259                    / (dSumWLinearTwo2n2n*dSumWLinearTwo3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9260                    - 2.*f2pCorrelations->GetBinContent(3)
9261                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9262                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,24))
9263                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(10))
9264                    / (dSumWLinearTwo2n2n*dSumWLinearFour3n2n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9265                    - 2.*f2pCorrelations->GetBinContent(2)
9266                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9267                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,24))
9268                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(10))
9269                    / (dSumWLinearTwo3n3n*dSumWLinearFour3n2n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9270    if(dError>0.)
9271    {
9272     f4pCumulants->SetBinError(10,pow(dError,0.5)); 
9273    }
9274   } // end of if(...)
9275  } // end of {
9276  // <4>_{4n,1n|4n,1n}
9277  f4pCumulants->SetBinContent(11,f4pCorrelations->GetBinContent(11)-f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(1));
9278  {
9279   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
9280   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
9281   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
9282   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9283   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9284   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9285   Double_t dSumWLinearFour4n1n4n1n = 0.; // sum of linear event weights for <4>
9286   Double_t dSumWQuadraticFour4n1n4n1n = 0.; // sum of quadratic event weights <4>
9287   Double_t dSpreadFour4n1n4n1n = 0.; // weighted and biased estimator for sigma of <4>
9288   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9289   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9290   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
9291   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9292   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9293   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9294   dSumWLinearFour4n1n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9295   dSumWQuadraticFour4n1n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9296   dSpreadFour4n1n4n1n = f4pCorrelations->GetBinError(11);
9297   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
9298      pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9299      pow(dSumWLinearFour4n1n4n1n,2.)>dSumWQuadraticFour4n1n4n1n)
9300   {
9301    Double_t dError = pow(f2pCorrelations->GetBinContent(4),2.)
9302                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
9303                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
9304                    + pow(f2pCorrelations->GetBinContent(1),2.)
9305                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9306                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9307                    + pow((pow(dSumWQuadraticFour4n1n4n1n,0.5)/dSumWLinearFour4n1n4n1n)
9308                    * dSpreadFour4n1n4n1n*pow(pow(dSumWLinearFour4n1n4n1n,2.)/(pow(dSumWLinearFour4n1n4n1n,2.)-dSumWQuadraticFour4n1n4n1n),0.5),2.)
9309                    + 2.*f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(1)
9310                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9311                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,4))
9312                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(4))
9313                    / (dSumWLinearTwo1n1n*dSumWLinearTwo4n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9314                    - 2.*f2pCorrelations->GetBinContent(4)
9315                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9316                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,25))
9317                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(11))
9318                    / (dSumWLinearTwo1n1n*dSumWLinearFour4n1n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9319                    - 2.*f2pCorrelations->GetBinContent(1)
9320                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9321                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,25))
9322                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(11))
9323                    / (dSumWLinearTwo4n4n*dSumWLinearFour4n1n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9324    if(dError>0.)
9325    {
9326     f4pCumulants->SetBinError(11,pow(dError,0.5)); 
9327    }
9328   } // end of if(...)
9329  } // end of {
9330  // <4>_{4n,2n|4n,2n}
9331  f4pCumulants->SetBinContent(12,f4pCorrelations->GetBinContent(12)-f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(2));
9332  {
9333   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
9334   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
9335   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
9336   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9337   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9338   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9339   Double_t dSumWLinearFour4n2n4n2n = 0.; // sum of linear event weights for <4>
9340   Double_t dSumWQuadraticFour4n2n4n2n = 0.; // sum of quadratic event weights <4>
9341   Double_t dSpreadFour4n2n4n2n = 0.; // weighted and biased estimator for sigma of <4>
9342   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9343   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9344   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
9345   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9346   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9347   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9348   dSumWLinearFour4n2n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9349   dSumWQuadraticFour4n2n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9350   dSpreadFour4n2n4n2n = f4pCorrelations->GetBinError(12);
9351   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
9352      pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9353      pow(dSumWLinearFour4n2n4n2n,2.)>dSumWQuadraticFour4n2n4n2n)
9354   {
9355    Double_t dError = pow(f2pCorrelations->GetBinContent(4),2.)
9356                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
9357                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
9358                    + pow(f2pCorrelations->GetBinContent(2),2.)
9359                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9360                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9361                    + pow((pow(dSumWQuadraticFour4n2n4n2n,0.5)/dSumWLinearFour4n2n4n2n)
9362                    * dSpreadFour4n2n4n2n*pow(pow(dSumWLinearFour4n2n4n2n,2.)/(pow(dSumWLinearFour4n2n4n2n,2.)-dSumWQuadraticFour4n2n4n2n),0.5),2.)
9363                    + 2.*f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(2)
9364                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9365                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,4))
9366                    - f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(4))
9367                    / (dSumWLinearTwo2n2n*dSumWLinearTwo4n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9368                    - 2.*f2pCorrelations->GetBinContent(4)
9369                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9370                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,25))
9371                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(12))
9372                    / (dSumWLinearTwo2n2n*dSumWLinearFour4n2n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9373                    - 2.*f2pCorrelations->GetBinContent(2)
9374                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9375                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,25))
9376                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(12))
9377                    / (dSumWLinearTwo4n4n*dSumWLinearFour4n2n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9378    if(dError>0.)
9379    {
9380     f4pCumulants->SetBinError(12,pow(dError,0.5)); 
9381    }
9382   } // end of if(...)
9383  } // end of {
9384  // <4>_{4n,3n|4n,3n}
9385  f4pCumulants->SetBinContent(13,f4pCorrelations->GetBinContent(13)-f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(3));
9386  {
9387   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9388   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9389   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9390   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9391   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9392   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9393   Double_t dSumWLinearFour4n3n4n3n = 0.; // sum of linear event weights for <4>
9394   Double_t dSumWQuadraticFour4n3n4n3n = 0.; // sum of quadratic event weights <4>
9395   Double_t dSpreadFour4n3n4n3n = 0.; // weighted and biased estimator for sigma of <4>
9396   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9397   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9398   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9399   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9400   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9401   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9402   dSumWLinearFour4n3n4n3n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9403   dSumWQuadraticFour4n3n4n3n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9404   dSpreadFour4n3n4n3n = f4pCorrelations->GetBinError(13);
9405   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9406      pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9407      pow(dSumWLinearFour4n3n4n3n,2.)>dSumWQuadraticFour4n3n4n3n)
9408   {
9409    Double_t dError = pow(f2pCorrelations->GetBinContent(4),2.)
9410                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9411                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9412                    + pow(f2pCorrelations->GetBinContent(3),2.)
9413                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9414                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9415                    + pow((pow(dSumWQuadraticFour4n3n4n3n,0.5)/dSumWLinearFour4n3n4n3n)
9416                    * dSpreadFour4n3n4n3n*pow(pow(dSumWLinearFour4n3n4n3n,2.)/(pow(dSumWLinearFour4n3n4n3n,2.)-dSumWQuadraticFour4n3n4n3n),0.5),2.)
9417                    + 2.*f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(3)
9418                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9419                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,4))
9420                    - f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(4))
9421                    / (dSumWLinearTwo3n3n*dSumWLinearTwo4n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9422                    - 2.*f2pCorrelations->GetBinContent(4)
9423                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9424                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,26))
9425                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(13))
9426                    / (dSumWLinearTwo3n3n*dSumWLinearFour4n3n4n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9427                    - 2.*f2pCorrelations->GetBinContent(3)
9428                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9429                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,26))
9430                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(13))
9431                    / (dSumWLinearTwo4n4n*dSumWLinearFour4n3n4n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9432    if(dError>0.)
9433    {
9434     f4pCumulants->SetBinError(13,pow(dError,0.5)); 
9435    }
9436   } // end of if(...)
9437  } // end of {
9438  // <4>_{5n,1n|5n,1n}
9439  f4pCumulants->SetBinContent(14,f4pCorrelations->GetBinContent(14)-f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(1));
9440  {
9441   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
9442   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
9443   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
9444   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
9445   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
9446   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
9447   Double_t dSumWLinearFour5n1n5n1n = 0.; // sum of linear event weights for <4>
9448   Double_t dSumWQuadraticFour5n1n5n1n = 0.; // sum of quadratic event weights <4>
9449   Double_t dSpreadFour5n1n5n1n = 0.; // weighted and biased estimator for sigma of <4>
9450   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9451   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9452   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
9453   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9454   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9455   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9456   dSumWLinearFour5n1n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9457   dSumWQuadraticFour5n1n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9458   dSpreadFour5n1n5n1n = f4pCorrelations->GetBinError(14);
9459   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
9460      pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9461      pow(dSumWLinearFour5n1n5n1n,2.)>dSumWQuadraticFour5n1n5n1n)
9462   {
9463    Double_t dError = pow(f2pCorrelations->GetBinContent(5),2.)
9464                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
9465                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
9466                    + pow(f2pCorrelations->GetBinContent(1),2.)
9467                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9468                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9469                    + pow((pow(dSumWQuadraticFour5n1n5n1n,0.5)/dSumWLinearFour5n1n5n1n)
9470                    * dSpreadFour5n1n5n1n*pow(pow(dSumWLinearFour5n1n5n1n,2.)/(pow(dSumWLinearFour5n1n5n1n,2.)-dSumWQuadraticFour5n1n5n1n),0.5),2.)
9471                    + 2.*f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(1)
9472                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9473                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,5))
9474                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(5))
9475                    / (dSumWLinearTwo1n1n*dSumWLinearTwo5n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9476                    - 2.*f2pCorrelations->GetBinContent(5)
9477                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9478                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,28))
9479                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(14))
9480                    / (dSumWLinearTwo1n1n*dSumWLinearFour5n1n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9481                    - 2.*f2pCorrelations->GetBinContent(1)
9482                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9483                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,28))
9484                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(14))
9485                    / (dSumWLinearTwo5n5n*dSumWLinearFour5n1n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9486    if(dError>0.)
9487    {
9488     f4pCumulants->SetBinError(14,pow(dError,0.5)); 
9489    }
9490   } // end of if(...)
9491  } // end of {
9492  // <4>_{5n,2n|5n,2n}
9493  f4pCumulants->SetBinContent(15,f4pCorrelations->GetBinContent(15)-f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(2));
9494  {
9495   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
9496   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
9497   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
9498   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
9499   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
9500   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
9501   Double_t dSumWLinearFour5n2n5n2n = 0.; // sum of linear event weights for <4>
9502   Double_t dSumWQuadraticFour5n2n5n2n = 0.; // sum of quadratic event weights <4>
9503   Double_t dSpreadFour5n2n5n2n = 0.; // weighted and biased estimator for sigma of <4>
9504   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9505   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9506   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
9507   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9508   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9509   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9510   dSumWLinearFour5n2n5n2n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9511   dSumWQuadraticFour5n2n5n2n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9512   dSpreadFour5n2n5n2n = f4pCorrelations->GetBinError(15);
9513   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
9514      pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9515      pow(dSumWLinearFour5n2n5n2n,2.)>dSumWQuadraticFour5n2n5n2n)
9516   {
9517    Double_t dError = pow(f2pCorrelations->GetBinContent(5),2.)
9518                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
9519                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
9520                    + pow(f2pCorrelations->GetBinContent(2),2.)
9521                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9522                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9523                    + pow((pow(dSumWQuadraticFour5n2n5n2n,0.5)/dSumWLinearFour5n2n5n2n)
9524                    * dSpreadFour5n2n5n2n*pow(pow(dSumWLinearFour5n2n5n2n,2.)/(pow(dSumWLinearFour5n2n5n2n,2.)-dSumWQuadraticFour5n2n5n2n),0.5),2.)
9525                    + 2.*f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(2)
9526                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9527                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,5))
9528                    - f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(5))
9529                    / (dSumWLinearTwo2n2n*dSumWLinearTwo5n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9530                    - 2.*f2pCorrelations->GetBinContent(5)
9531                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9532                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,29))
9533                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(15))
9534                    / (dSumWLinearTwo2n2n*dSumWLinearFour5n2n5n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9535                    - 2.*f2pCorrelations->GetBinContent(2)
9536                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9537                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,29))
9538                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(15))
9539                    / (dSumWLinearTwo5n5n*dSumWLinearFour5n2n5n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9540    if(dError>0.)
9541    {
9542     f4pCumulants->SetBinError(15,pow(dError,0.5)); 
9543    }
9544   } // end of if(...)
9545  } // end of {
9546  // <4>_{5n,3n|5n,3n}
9547  f4pCumulants->SetBinContent(16,f4pCorrelations->GetBinContent(16)-f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(3));
9548  {
9549   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9550   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9551   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9552   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
9553   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
9554   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
9555   Double_t dSumWLinearFour5n3n5n3n = 0.; // sum of linear event weights for <4>
9556   Double_t dSumWQuadraticFour5n3n5n3n = 0.; // sum of quadratic event weights <4>
9557   Double_t dSpreadFour5n3n5n3n = 0.; // weighted and biased estimator for sigma of <4>
9558   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9559   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9560   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9561   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9562   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9563   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9564   dSumWLinearFour5n3n5n3n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9565   dSumWQuadraticFour5n3n5n3n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9566   dSpreadFour5n3n5n3n = f4pCorrelations->GetBinError(16);
9567   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9568      pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9569      pow(dSumWLinearFour5n3n5n3n,2.)>dSumWQuadraticFour5n3n5n3n)
9570   {
9571    Double_t dError = pow(f2pCorrelations->GetBinContent(5),2.)
9572                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9573                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9574                    + pow(f2pCorrelations->GetBinContent(3),2.)
9575                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9576                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9577                    + pow((pow(dSumWQuadraticFour5n3n5n3n,0.5)/dSumWLinearFour5n3n5n3n)
9578                    * dSpreadFour5n3n5n3n*pow(pow(dSumWLinearFour5n3n5n3n,2.)/(pow(dSumWLinearFour5n3n5n3n,2.)-dSumWQuadraticFour5n3n5n3n),0.5),2.)
9579                    + 2.*f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(3)
9580                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9581                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,5))
9582                    - f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(5))
9583                    / (dSumWLinearTwo3n3n*dSumWLinearTwo5n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9584                    - 2.*f2pCorrelations->GetBinContent(5)
9585                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9586                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,30))
9587                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(16))
9588                    / (dSumWLinearTwo3n3n*dSumWLinearFour5n3n5n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9589                    - 2.*f2pCorrelations->GetBinContent(3)
9590                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9591                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,30))
9592                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(16))
9593                    / (dSumWLinearTwo5n5n*dSumWLinearFour5n3n5n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9594    if(dError>0.)
9595    {
9596     f4pCumulants->SetBinError(16,pow(dError,0.5)); 
9597    }
9598   } // end of if(...)
9599  } // end of {
9600  // <4>_{5n,4n|5n,4n}
9601  f4pCumulants->SetBinContent(17,f4pCorrelations->GetBinContent(17)-f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(4));
9602  {
9603   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9604   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9605   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9606   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
9607   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
9608   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
9609   Double_t dSumWLinearFour5n4n5n4n = 0.; // sum of linear event weights for <4>
9610   Double_t dSumWQuadraticFour5n4n5n4n = 0.; // sum of quadratic event weights <4>
9611   Double_t dSpreadFour5n4n5n4n = 0.; // weighted and biased estimator for sigma of <4>
9612   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9613   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9614   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9615   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9616   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9617   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9618   dSumWLinearFour5n4n5n4n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9619   dSumWQuadraticFour5n4n5n4n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9620   dSpreadFour5n4n5n4n = f4pCorrelations->GetBinError(17);
9621   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9622      pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9623      pow(dSumWLinearFour5n4n5n4n,2.)>dSumWQuadraticFour5n4n5n4n)
9624   {
9625    Double_t dError = pow(f2pCorrelations->GetBinContent(5),2.)
9626                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9627                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9628                    + pow(f2pCorrelations->GetBinContent(4),2.)
9629                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9630                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9631                    + pow((pow(dSumWQuadraticFour5n4n5n4n,0.5)/dSumWLinearFour5n4n5n4n)
9632                    * dSpreadFour5n4n5n4n*pow(pow(dSumWLinearFour5n4n5n4n,2.)/(pow(dSumWLinearFour5n4n5n4n,2.)-dSumWQuadraticFour5n4n5n4n),0.5),2.)
9633                    + 2.*f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(4)
9634                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9635                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,5))
9636                    - f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(5))
9637                    / (dSumWLinearTwo4n4n*dSumWLinearTwo5n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9638                    - 2.*f2pCorrelations->GetBinContent(5)
9639                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9640                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,31))
9641                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(17))
9642                    / (dSumWLinearTwo4n4n*dSumWLinearFour5n4n5n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9643                    - 2.*f2pCorrelations->GetBinContent(4)
9644                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9645                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,31))
9646                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(17))
9647                    / (dSumWLinearTwo5n5n*dSumWLinearFour5n4n5n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9648    if(dError>0.)
9649    {
9650     f4pCumulants->SetBinError(17,pow(dError,0.5)); 
9651    }
9652   } // end of if(...)
9653  } // end of {
9654  // <4>_{6n,1n|6n,1n}
9655  f4pCumulants->SetBinContent(18,f4pCorrelations->GetBinContent(18)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(1));
9656  {
9657   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
9658   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
9659   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
9660   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9661   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9662   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9663   Double_t dSumWLinearFour6n1n6n1n = 0.; // sum of linear event weights for <4>
9664   Double_t dSumWQuadraticFour6n1n6n1n = 0.; // sum of quadratic event weights <4>
9665   Double_t dSpreadFour6n1n6n1n = 0.; // weighted and biased estimator for sigma of <4>
9666   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9667   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9668   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
9669   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9670   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9671   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9672   dSumWLinearFour6n1n6n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9673   dSumWQuadraticFour6n1n6n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9674   dSpreadFour6n1n6n1n = f4pCorrelations->GetBinError(18);
9675   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
9676      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9677      pow(dSumWLinearFour6n1n6n1n,2.)>dSumWQuadraticFour6n1n6n1n)
9678   {
9679    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9680                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
9681                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
9682                    + pow(f2pCorrelations->GetBinContent(1),2.)
9683                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9684                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9685                    + pow((pow(dSumWQuadraticFour6n1n6n1n,0.5)/dSumWLinearFour6n1n6n1n)
9686                    * dSpreadFour6n1n6n1n*pow(pow(dSumWLinearFour6n1n6n1n,2.)/(pow(dSumWLinearFour6n1n6n1n,2.)-dSumWQuadraticFour6n1n6n1n),0.5),2.)
9687                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(1)
9688                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9689                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,6))
9690                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(6))
9691                    / (dSumWLinearTwo1n1n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9692                    - 2.*f2pCorrelations->GetBinContent(6)
9693                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9694                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,32))
9695                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(18))
9696                    / (dSumWLinearTwo1n1n*dSumWLinearFour6n1n6n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9697                    - 2.*f2pCorrelations->GetBinContent(1)
9698                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9699                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,32))
9700                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(18))
9701                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n1n6n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9702    if(dError>0.)
9703    {
9704     f4pCumulants->SetBinError(18,pow(dError,0.5)); 
9705    }
9706   } // end of if(...)
9707  } // end of {
9708  // <4>_{6n,2n|6n,2n}
9709  f4pCumulants->SetBinContent(19,f4pCorrelations->GetBinContent(19)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(2));
9710  {
9711   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
9712   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
9713   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
9714   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9715   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9716   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9717   Double_t dSumWLinearFour6n2n6n2n = 0.; // sum of linear event weights for <4>
9718   Double_t dSumWQuadraticFour6n2n6n2n = 0.; // sum of quadratic event weights <4>
9719   Double_t dSpreadFour6n2n6n2n = 0.; // weighted and biased estimator for sigma of <4>
9720   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9721   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9722   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
9723   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9724   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9725   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9726   dSumWLinearFour6n2n6n2n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9727   dSumWQuadraticFour6n2n6n2n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9728   dSpreadFour6n2n6n2n = f4pCorrelations->GetBinError(19);
9729   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
9730      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9731      pow(dSumWLinearFour6n2n6n2n,2.)>dSumWQuadraticFour6n2n6n2n)
9732   {
9733    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9734                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
9735                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
9736                    + pow(f2pCorrelations->GetBinContent(2),2.)
9737                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9738                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9739                    + pow((pow(dSumWQuadraticFour6n2n6n2n,0.5)/dSumWLinearFour6n2n6n2n)
9740                    * dSpreadFour6n2n6n2n*pow(pow(dSumWLinearFour6n2n6n2n,2.)/(pow(dSumWLinearFour6n2n6n2n,2.)-dSumWQuadraticFour6n2n6n2n),0.5),2.)
9741                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(2)
9742                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9743                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,6))
9744                    - f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(6))
9745                    / (dSumWLinearTwo2n2n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9746                    - 2.*f2pCorrelations->GetBinContent(6)
9747                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9748                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,33))
9749                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(19))
9750                    / (dSumWLinearTwo2n2n*dSumWLinearFour6n2n6n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9751                    - 2.*f2pCorrelations->GetBinContent(2)
9752                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9753                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,33))
9754                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(19))
9755                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n2n6n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9756    if(dError>0.)
9757    {
9758     f4pCumulants->SetBinError(19,pow(dError,0.5)); 
9759    }
9760   } // end of if(...)
9761  } // end of {
9762  // <4>_{6n,3n|6n,3n}
9763  f4pCumulants->SetBinContent(20,f4pCorrelations->GetBinContent(20)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(3));
9764  {
9765   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9766   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9767   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9768   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9769   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9770   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9771   Double_t dSumWLinearFour6n3n6n3n = 0.; // sum of linear event weights for <4>
9772   Double_t dSumWQuadraticFour6n3n6n3n = 0.; // sum of quadratic event weights <4>
9773   Double_t dSpreadFour6n3n6n3n = 0.; // weighted and biased estimator for sigma of <4>
9774   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9775   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9776   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9777   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9778   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9779   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9780   dSumWLinearFour6n3n6n3n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9781   dSumWQuadraticFour6n3n6n3n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9782   dSpreadFour6n3n6n3n = f4pCorrelations->GetBinError(20);
9783   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9784      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9785      pow(dSumWLinearFour6n3n6n3n,2.)>dSumWQuadraticFour6n3n6n3n)
9786   {
9787    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9788                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9789                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9790                    + pow(f2pCorrelations->GetBinContent(3),2.)
9791                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9792                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9793                    + pow((pow(dSumWQuadraticFour6n3n6n3n,0.5)/dSumWLinearFour6n3n6n3n)
9794                    * dSpreadFour6n3n6n3n*pow(pow(dSumWLinearFour6n3n6n3n,2.)/(pow(dSumWLinearFour6n3n6n3n,2.)-dSumWQuadraticFour6n3n6n3n),0.5),2.)
9795                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(3)
9796                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9797                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,6))
9798                    - f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(6))
9799                    / (dSumWLinearTwo3n3n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9800                    - 2.*f2pCorrelations->GetBinContent(6)
9801                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9802                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,34))
9803                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(20))
9804                    / (dSumWLinearTwo3n3n*dSumWLinearFour6n3n6n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9805                    - 2.*f2pCorrelations->GetBinContent(3)
9806                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9807                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,34))
9808                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(20))
9809                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n3n6n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9810    if(dError>0.)
9811    {
9812     f4pCumulants->SetBinError(20,pow(dError,0.5)); 
9813    }
9814   } // end of if(...)
9815  } // end of {
9816  // <4>_{6n,4n|6n,4n}
9817  f4pCumulants->SetBinContent(21,f4pCorrelations->GetBinContent(21)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(4));
9818  {
9819   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9820   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9821   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9822   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9823   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9824   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9825   Double_t dSumWLinearFour6n4n6n4n = 0.; // sum of linear event weights for <4>
9826   Double_t dSumWQuadraticFour6n4n6n4n = 0.; // sum of quadratic event weights <4>
9827   Double_t dSpreadFour6n4n6n4n = 0.; // weighted and biased estimator for sigma of <4>
9828   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9829   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9830   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9831   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9832   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9833   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9834   dSumWLinearFour6n4n6n4n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9835   dSumWQuadraticFour6n4n6n4n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9836   dSpreadFour6n4n6n4n = f4pCorrelations->GetBinError(21);
9837   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9838      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9839      pow(dSumWLinearFour6n4n6n4n,2.)>dSumWQuadraticFour6n4n6n4n)
9840   {
9841    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9842                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9843                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9844                    + pow(f2pCorrelations->GetBinContent(4),2.)
9845                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9846                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9847                    + pow((pow(dSumWQuadraticFour6n4n6n4n,0.5)/dSumWLinearFour6n4n6n4n)
9848                    * dSpreadFour6n4n6n4n*pow(pow(dSumWLinearFour6n4n6n4n,2.)/(pow(dSumWLinearFour6n4n6n4n,2.)-dSumWQuadraticFour6n4n6n4n),0.5),2.)
9849                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(4)
9850                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9851                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,6))
9852                    - f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(6))
9853                    / (dSumWLinearTwo4n4n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9854                    - 2.*f2pCorrelations->GetBinContent(6)
9855                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9856                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,35))
9857                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(21))
9858                    / (dSumWLinearTwo4n4n*dSumWLinearFour6n4n6n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9859                    - 2.*f2pCorrelations->GetBinContent(4)
9860                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9861                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,35))
9862                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(21))
9863                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n4n6n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9864    if(dError>0.)
9865    {
9866     f4pCumulants->SetBinError(21,pow(dError,0.5)); 
9867    }
9868   } // end of if(...)
9869  } // end of {
9870  // <4>_{6n,5n|6n,5n}
9871  f4pCumulants->SetBinContent(22,f4pCorrelations->GetBinContent(22)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(5));
9872  {
9873   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
9874   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
9875   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
9876   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9877   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9878   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9879   Double_t dSumWLinearFour6n5n6n5n = 0.; // sum of linear event weights for <4>
9880   Double_t dSumWQuadraticFour6n5n6n5n = 0.; // sum of quadratic event weights <4>
9881   Double_t dSpreadFour6n5n6n5n = 0.; // weighted and biased estimator for sigma of <4>
9882   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9883   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9884   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9885   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9886   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9887   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9888   dSumWLinearFour6n5n6n5n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9889   dSumWQuadraticFour6n5n6n5n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9890   dSpreadFour6n5n6n5n = f4pCorrelations->GetBinError(22);
9891   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9892      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9893      pow(dSumWLinearFour6n5n6n5n,2.)>dSumWQuadraticFour6n5n6n5n)
9894   {
9895    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9896                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9897                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9898                    + pow(f2pCorrelations->GetBinContent(5),2.)
9899                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9900                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9901                    + pow((pow(dSumWQuadraticFour6n5n6n5n,0.5)/dSumWLinearFour6n5n6n5n)
9902                    * dSpreadFour6n5n6n5n*pow(pow(dSumWLinearFour6n5n6n5n,2.)/(pow(dSumWLinearFour6n5n6n5n,2.)-dSumWQuadraticFour6n5n6n5n),0.5),2.)
9903                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(5)
9904                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9905                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,6))
9906                    - f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(6))
9907                    / (dSumWLinearTwo5n5n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9908                    - 2.*f2pCorrelations->GetBinContent(6)
9909                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9910                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,36))
9911                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(22))
9912                    / (dSumWLinearTwo5n5n*dSumWLinearFour6n5n6n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9913                    - 2.*f2pCorrelations->GetBinContent(5)
9914                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9915                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,36))
9916                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(22))
9917                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n5n6n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9918    if(dError>0.)
9919    {
9920     f4pCumulants->SetBinError(22,pow(dError,0.5)); 
9921    }
9922   } // end of if(...)
9923  } // end of {
9924
9925  // c3) "Two distinct harmonics":
9926  for(Int_t b=24;b<=25;b++)
9927  {
9928   f4pCumulants->SetBinContent(b,f4pCorrelations->GetBinContent(b));
9929   Double_t dSumWLinear = 0.; // sum of linear event weights
9930   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
9931   Double_t dSpread = 0.; // weighted and biased estimator for sigma
9932   Double_t dError = 0.; // weighted and unbiased estimator for sigma
9933   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9934   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9935   dSpread = f4pCorrelations->GetBinError(b);
9936   if(pow(dSumWLinear,2.)>dSumWQuadratic)
9937   {
9938    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
9939    f4pCumulants->SetBinError(b,dError); 
9940   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
9941  } // end of for(Int_t b=24;b<=25;b++)
9942  // c4) "Three distinct harmonics":
9943  for(Int_t b=27;b<=36;b++)
9944  {
9945   f4pCumulants->SetBinContent(b,f4pCorrelations->GetBinContent(b));
9946   Double_t dSumWLinear = 0.; // sum of linear event weights
9947   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
9948   Double_t dSpread = 0.; // weighted and biased estimator for sigma
9949   Double_t dError = 0.; // weighted and unbiased estimator for sigma
9950   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9951   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9952   dSpread = f4pCorrelations->GetBinError(b);
9953   if(pow(dSumWLinear,2.)>dSumWQuadratic)
9954   {
9955    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
9956    f4pCumulants->SetBinError(b,dError); 
9957   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
9958  } // end of for(Int_t b=27;b<=36;b++)
9959  // c5) "Four distinct harmonics":
9960  for(Int_t b=38;b<=45;b++)
9961  {
9962   f4pCumulants->SetBinContent(b,f4pCorrelations->GetBinContent(b));
9963   Double_t dSumWLinear = 0.; // sum of linear event weights
9964   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
9965   Double_t dSpread = 0.; // weighted and biased estimator for sigma
9966   Double_t dError = 0.; // weighted and unbiased estimator for sigma
9967   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9968   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9969   dSpread = f4pCorrelations->GetBinError(b);
9970   if(pow(dSumWLinear,2.)>dSumWQuadratic)
9971   {
9972    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
9973    f4pCumulants->SetBinError(b,dError); 
9974   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
9975  } // end of for(Int_t b=38;b<=45;b++)
9976
9977  // d) Calculate 5-p cumulants: 
9978  // d1) "Standard candles":
9979  f5pCumulants->SetBinContent(1,f5pCorrelations->GetBinContent(1)-f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(3));
9980  {
9981   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9982   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9983   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9984   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
9985   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
9986   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
9987   Double_t dSumWLinearFive3n2n3n1n1n = 0.; // sum of linear event weights for <4>
9988   Double_t dSumWQuadraticFive3n2n3n1n1n = 0.; // sum of quadratic event weights <4>
9989   Double_t dSpreadFive3n2n3n1n1n = 0.; // weighted and biased estimator for sigma of <4>
9990   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9991   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9992   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9993   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9994   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9995   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
9996   dSumWLinearFive3n2n3n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
9997   dSumWQuadraticFive3n2n3n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
9998   dSpreadFive3n2n3n1n1n = f5pCorrelations->GetBinError(1);
9999   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
10000      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
10001      pow(dSumWLinearFive3n2n3n1n1n,2.)>dSumWQuadraticFive3n2n3n1n1n)
10002   {
10003    Double_t dError = pow(f3pCorrelations->GetBinContent(1),2.)
10004                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
10005                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
10006                    + pow(f2pCorrelations->GetBinContent(3),2.)
10007                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
10008                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
10009                    + pow((pow(dSumWQuadraticFive3n2n3n1n1n,0.5)/dSumWLinearFive3n2n3n1n1n)
10010                    * dSpreadFive3n2n3n1n1n*pow(pow(dSumWLinearFive3n2n3n1n1n,2.)/(pow(dSumWLinearFive3n2n3n1n1n,2.)-dSumWQuadraticFive3n2n3n1n1n),0.5),2.)
10011                    + 2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(3)
10012                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3))
10013                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,7))
10014                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(1))
10015                    / (dSumWLinearTwo3n3n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10016                    - 2.*f3pCorrelations->GetBinContent(1)
10017                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5))
10018                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,57))
10019                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(1))
10020                    / (dSumWLinearTwo3n3n*dSumWLinearFive3n2n3n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10021                    - 2.*f2pCorrelations->GetBinContent(3)
10022                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5))
10023                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,57))
10024                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(1))
10025                    / (dSumWLinearThree2n1n1n*dSumWLinearFive3n2n3n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10026    if(dError>0.)
10027    {
10028     f5pCumulants->SetBinError(1,pow(dError,0.5)); 
10029    }
10030   } // end of if(...)
10031  } // end of {
10032
10033  f5pCumulants->SetBinContent(2,f5pCorrelations->GetBinContent(2)-f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(1));
10034  {
10035   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
10036   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
10037   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
10038   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
10039   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
10040   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
10041   Double_t dSumWLinearFive4n1n2n2n1n = 0.; // sum of linear event weights for <4>
10042   Double_t dSumWQuadraticFive4n1n2n2n1n = 0.; // sum of quadratic event weights <4>
10043   Double_t dSpreadFive4n1n2n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10044   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10045   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10046   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
10047   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10048   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10049   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
10050   dSumWLinearFive4n1n2n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10051   dSumWQuadraticFive4n1n2n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10052   dSpreadFive4n1n2n2n1n = f5pCorrelations->GetBinError(2);
10053   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
10054      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
10055      pow(dSumWLinearFive4n1n2n2n1n,2.)>dSumWQuadraticFive4n1n2n2n1n)
10056   {
10057    Double_t dError = pow(f3pCorrelations->GetBinContent(2),2.)
10058                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
10059                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
10060                    + pow(f2pCorrelations->GetBinContent(1),2.)
10061                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
10062                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
10063                    + pow((pow(dSumWQuadraticFive4n1n2n2n1n,0.5)/dSumWLinearFive4n1n2n2n1n)
10064                    * dSpreadFive4n1n2n2n1n*pow(pow(dSumWLinearFive4n1n2n2n1n,2.)/(pow(dSumWLinearFive4n1n2n2n1n,2.)-dSumWQuadraticFive4n1n2n2n1n),0.5),2.)
10065                    + 2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(1)
10066                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3))
10067                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,8))
10068                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(2))
10069                    / (dSumWLinearTwo1n1n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10070                    - 2.*f3pCorrelations->GetBinContent(2)
10071                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5))
10072                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,58))
10073                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(2))
10074                    / (dSumWLinearTwo1n1n*dSumWLinearFive4n1n2n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10075                    - 2.*f2pCorrelations->GetBinContent(1)
10076                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5))
10077                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,58))
10078                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(2))
10079                    / (dSumWLinearThree4n2n2n*dSumWLinearFive4n1n2n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10080    if(dError>0.)
10081    {
10082     f5pCumulants->SetBinError(2,pow(dError,0.5)); 
10083    }
10084   } // end of if(...)
10085  } // end of {
10086  f5pCumulants->SetBinContent(3,f5pCorrelations->GetBinContent(3)-f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(2));
10087  {
10088   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
10089   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
10090   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
10091   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
10092   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
10093   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
10094   Double_t dSumWLinearFive4n2n3n2n1n = 0.; // sum of linear event weights for <4>
10095   Double_t dSumWQuadraticFive4n2n3n2n1n = 0.; // sum of quadratic event weights <4>
10096   Double_t dSpreadFive4n2n3n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10097   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10098   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10099   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
10100   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10101   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10102   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
10103   dSumWLinearFive4n2n3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10104   dSumWQuadraticFive4n2n3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10105   dSpreadFive4n2n3n2n1n = f5pCorrelations->GetBinError(3);
10106   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
10107      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
10108      pow(dSumWLinearFive4n2n3n2n1n,2.)>dSumWQuadraticFive4n2n3n2n1n)
10109   {
10110    Double_t dError = pow(f3pCorrelations->GetBinContent(6),2.)
10111                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
10112                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
10113                    + pow(f2pCorrelations->GetBinContent(2),2.)
10114                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
10115                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
10116                    + pow((pow(dSumWQuadraticFive4n2n3n2n1n,0.5)/dSumWLinearFive4n2n3n2n1n)
10117                    * dSpreadFive4n2n3n2n1n*pow(pow(dSumWLinearFive4n2n3n2n1n,2.)/(pow(dSumWLinearFive4n2n3n2n1n,2.)-dSumWQuadraticFive4n2n3n2n1n),0.5),2.)
10118                    + 2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(2)
10119                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3))
10120                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,11))
10121                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(6))
10122                    / (dSumWLinearTwo2n2n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10123                    - 2.*f3pCorrelations->GetBinContent(6)
10124                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5))
10125                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,59))
10126                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(3))
10127                    / (dSumWLinearTwo2n2n*dSumWLinearFive4n2n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10128                    - 2.*f2pCorrelations->GetBinContent(2)
10129                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5))
10130                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,59))
10131                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(3))
10132                    / (dSumWLinearThree4n3n1n*dSumWLinearFive4n2n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10133    if(dError>0.)
10134    {
10135     f5pCumulants->SetBinError(3,pow(dError,0.5)); 
10136    }
10137   } // end of if(...)
10138  } // end of {
10139  f5pCumulants->SetBinContent(4,f5pCorrelations->GetBinContent(4)-f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(3));
10140  {
10141   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
10142   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
10143   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
10144   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
10145   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
10146   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
10147   Double_t dSumWLinearFive4n3n3n2n2n = 0.; // sum of linear event weights for <4>
10148   Double_t dSumWQuadraticFive4n3n3n2n2n = 0.; // sum of quadratic event weights <4>
10149   Double_t dSpreadFive4n3n3n2n2n = 0.; // weighted and biased estimator for sigma of <4>
10150   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10151   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10152   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
10153   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10154   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10155   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
10156   dSumWLinearFive4n3n3n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10157   dSumWQuadraticFive4n3n3n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10158   dSpreadFive4n3n3n2n2n = f5pCorrelations->GetBinError(4);
10159   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
10160      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
10161      pow(dSumWLinearFive4n3n3n2n2n,2.)>dSumWQuadraticFive4n3n3n2n2n)
10162   {
10163    Double_t dError = pow(f3pCorrelations->GetBinContent(2),2.)
10164                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
10165                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
10166                    + pow(f2pCorrelations->GetBinContent(3),2.)
10167                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
10168                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
10169                    + pow((pow(dSumWQuadraticFive4n3n3n2n2n,0.5)/dSumWLinearFive4n3n3n2n2n)
10170                    * dSpreadFive4n3n3n2n2n*pow(pow(dSumWLinearFive4n3n3n2n2n,2.)/(pow(dSumWLinearFive4n3n3n2n2n,2.)-dSumWQuadraticFive4n3n3n2n2n),0.5),2.)
10171                    + 2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(3)
10172                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3))
10173                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,8))
10174                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(2))
10175                    / (dSumWLinearTwo3n3n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10176                    - 2.*f3pCorrelations->GetBinContent(2)
10177                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5))
10178                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,60))
10179                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(4))
10180                    / (dSumWLinearTwo3n3n*dSumWLinearFive4n3n3n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10181                    - 2.*f2pCorrelations->GetBinContent(3)
10182                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5))
10183                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,60))
10184                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(4))
10185                    / (dSumWLinearThree4n2n2n*dSumWLinearFive4n3n3n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10186    if(dError>0.)
10187    {
10188     f5pCumulants->SetBinError(4,pow(dError,0.5)); 
10189    }
10190   } // end of if(...)
10191  } // end of {
10192  f5pCumulants->SetBinContent(5,f5pCorrelations->GetBinContent(5)-f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(4));
10193  {
10194   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
10195   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
10196   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
10197   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
10198   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
10199   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
10200   Double_t dSumWLinearFive4n2n4n1n1n = 0.; // sum of linear event weights for <4>
10201   Double_t dSumWQuadraticFive4n2n4n1n1n = 0.; // sum of quadratic event weights <4>
10202   Double_t dSpreadFive4n2n4n1n1n = 0.; // weighted and biased estimator for sigma of <4>
10203   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10204   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10205   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
10206   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10207   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10208   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
10209   dSumWLinearFive4n2n4n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10210   dSumWQuadraticFive4n2n4n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10211   dSpreadFive4n2n4n1n1n = f5pCorrelations->GetBinError(5);
10212   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
10213      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
10214      pow(dSumWLinearFive4n2n4n1n1n,2.)>dSumWQuadraticFive4n2n4n1n1n)
10215   {
10216    Double_t dError = pow(f3pCorrelations->GetBinContent(1),2.)
10217                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
10218                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
10219                    + pow(f2pCorrelations->GetBinContent(4),2.)
10220                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
10221                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
10222                    + pow((pow(dSumWQuadraticFive4n2n4n1n1n,0.5)/dSumWLinearFive4n2n4n1n1n)
10223                    * dSpreadFive4n2n4n1n1n*pow(pow(dSumWLinearFive4n2n4n1n1n,2.)/(pow(dSumWLinearFive4n2n4n1n1n,2.)-dSumWQuadraticFive4n2n4n1n1n),0.5),2.)
10224                    + 2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(4)
10225                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10226                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,7)) 
10227                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(1))
10228                    / (dSumWLinearTwo4n4n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10229                    - 2.*f3pCorrelations->GetBinContent(1)
10230                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10231                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,61))
10232                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(5))
10233                    / (dSumWLinearTwo4n4n*dSumWLinearFive4n2n4n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10234                    - 2.*f2pCorrelations->GetBinContent(4)
10235                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10236                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,61))
10237                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(5))
10238                    / (dSumWLinearThree2n1n1n*dSumWLinearFive4n2n4n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10239    if(dError>0.)
10240    {
10241     f5pCumulants->SetBinError(5,pow(dError,0.5)); 
10242    }
10243   } // end of if(...)
10244  } // end of {
10245  f5pCumulants->SetBinContent(6,f5pCorrelations->GetBinContent(6)-f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(4));
10246  {
10247   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
10248   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
10249   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
10250   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
10251   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
10252   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
10253   Double_t dSumWLinearFive4n3n4n2n1n = 0.; // sum of linear event weights for <4>
10254   Double_t dSumWQuadraticFive4n3n4n2n1n = 0.; // sum of quadratic event weights <4>
10255   Double_t dSpreadFive4n3n4n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10256   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10257   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10258   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
10259   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10260   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10261   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
10262   dSumWLinearFive4n3n4n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10263   dSumWQuadraticFive4n3n4n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10264   dSpreadFive4n3n4n2n1n = f5pCorrelations->GetBinError(6);
10265   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
10266      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
10267      pow(dSumWLinearFive4n3n4n2n1n,2.)>dSumWQuadraticFive4n3n4n2n1n)
10268   {
10269    Double_t dError = pow(f3pCorrelations->GetBinContent(5),2.)
10270                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
10271                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
10272                    + pow(f2pCorrelations->GetBinContent(4),2.)
10273                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
10274                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
10275                    + pow((pow(dSumWQuadraticFive4n3n4n2n1n,0.5)/dSumWLinearFive4n3n4n2n1n)
10276                    * dSpreadFive4n3n4n2n1n*pow(pow(dSumWLinearFive4n3n4n2n1n,2.)/(pow(dSumWLinearFive4n3n4n2n1n,2.)-dSumWQuadraticFive4n3n4n2n1n),0.5),2.)
10277                    + 2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(4)
10278                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10279                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,10)) 
10280                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(5))
10281                    / (dSumWLinearTwo4n4n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10282                    - 2.*f3pCorrelations->GetBinContent(5)
10283                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10284                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,62))
10285                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(6))
10286                    / (dSumWLinearTwo4n4n*dSumWLinearFive4n3n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10287                    - 2.*f2pCorrelations->GetBinContent(4)
10288                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10289                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,62))
10290                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(6))
10291                    / (dSumWLinearThree3n2n1n*dSumWLinearFive4n3n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10292    if(dError>0.)
10293    {
10294     f5pCumulants->SetBinError(6,pow(dError,0.5)); 
10295    }
10296   } // end of if(...)
10297  } // end of {
10298  f5pCumulants->SetBinContent(7,f5pCorrelations->GetBinContent(7)-f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(1));
10299  {
10300   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
10301   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
10302   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
10303   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
10304   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
10305   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
10306   Double_t dSumWLinearFive5n1n3n2n1n = 0.; // sum of linear event weights for <4>
10307   Double_t dSumWQuadraticFive5n1n3n2n1n = 0.; // sum of quadratic event weights <4>
10308   Double_t dSpreadFive5n1n3n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10309   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10310   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10311   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
10312   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10313   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10314   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
10315   dSumWLinearFive5n1n3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10316   dSumWQuadraticFive5n1n3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10317   dSpreadFive5n1n3n2n1n = f5pCorrelations->GetBinError(7);
10318   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
10319      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
10320      pow(dSumWLinearFive5n1n3n2n1n,2.)>dSumWQuadraticFive5n1n3n2n1n)
10321   {
10322    Double_t dError = pow(f3pCorrelations->GetBinContent(7),2.)
10323                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
10324                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
10325                    + pow(f2pCorrelations->GetBinContent(1),2.)
10326                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
10327                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
10328                    + pow((pow(dSumWQuadraticFive5n1n3n2n1n,0.5)/dSumWLinearFive5n1n3n2n1n)
10329                    * dSpreadFive5n1n3n2n1n*pow(pow(dSumWLinearFive5n1n3n2n1n,2.)/(pow(dSumWLinearFive5n1n3n2n1n,2.)-dSumWQuadraticFive5n1n3n2n1n),0.5),2.)
10330                    + 2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(1)
10331                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10332                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,12)) 
10333                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(7))
10334                    / (dSumWLinearTwo1n1n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10335                    - 2.*f3pCorrelations->GetBinContent(7)
10336                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10337                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,63))
10338                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(7))
10339                    / (dSumWLinearTwo1n1n*dSumWLinearFive5n1n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10340                    - 2.*f2pCorrelations->GetBinContent(1)
10341                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10342                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,63))
10343                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(7))
10344                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n1n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10345    if(dError>0.)
10346    {
10347     f5pCumulants->SetBinError(7,pow(dError,0.5)); 
10348    }
10349   } // end of if(...)
10350  } // end of {
10351  f5pCumulants->SetBinContent(8,f5pCorrelations->GetBinContent(8)-f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(5));
10352  {
10353   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
10354   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
10355   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
10356   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
10357   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
10358   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
10359   Double_t dSumWLinearFive5n2n5n1n1n = 0.; // sum of linear event weights for <4>
10360   Double_t dSumWQuadraticFive5n2n5n1n1n = 0.; // sum of quadratic event weights <4>
10361   Double_t dSpreadFive5n2n5n1n1n = 0.; // weighted and biased estimator for sigma of <4>
10362   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10363   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10364   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
10365   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10366   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10367   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
10368   dSumWLinearFive5n2n5n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10369   dSumWQuadraticFive5n2n5n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10370   dSpreadFive5n2n5n1n1n = f5pCorrelations->GetBinError(8);
10371   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
10372      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
10373      pow(dSumWLinearFive5n2n5n1n1n,2.)>dSumWQuadraticFive5n2n5n1n1n)
10374   {
10375    Double_t dError = pow(f3pCorrelations->GetBinContent(1),2.)
10376                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
10377                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
10378                    + pow(f2pCorrelations->GetBinContent(5),2.)
10379                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
10380                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
10381                    + pow((pow(dSumWQuadraticFive5n2n5n1n1n,0.5)/dSumWLinearFive5n2n5n1n1n)
10382                    * dSpreadFive5n2n5n1n1n*pow(pow(dSumWLinearFive5n2n5n1n1n,2.)/(pow(dSumWLinearFive5n2n5n1n1n,2.)-dSumWQuadraticFive5n2n5n1n1n),0.5),2.)
10383                    + 2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(5)
10384                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10385                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,7)) 
10386                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(1))
10387                    / (dSumWLinearTwo5n5n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10388                    - 2.*f3pCorrelations->GetBinContent(1)
10389                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10390                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,64))
10391                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(8))
10392                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n2n5n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10393                    - 2.*f2pCorrelations->GetBinContent(5)
10394                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10395                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,64))
10396                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(8))
10397                    / (dSumWLinearThree2n1n1n*dSumWLinearFive5n2n5n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10398    if(dError>0.)
10399    {
10400     f5pCumulants->SetBinError(8,pow(dError,0.5)); 
10401    }
10402   } // end of if(...)
10403  } // end of {
10404  f5pCumulants->SetBinContent(9,f5pCorrelations->GetBinContent(9)-f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(2));
10405  {
10406   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
10407   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
10408   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
10409   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
10410   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
10411   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
10412   Double_t dSumWLinearFive5n2n4n2n1n = 0.; // sum of linear event weights for <4>
10413   Double_t dSumWQuadraticFive5n2n4n2n1n = 0.; // sum of quadratic event weights <4>
10414   Double_t dSpreadFive5n2n4n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10415   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10416   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10417   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
10418   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10419   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10420   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
10421   dSumWLinearFive5n2n4n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10422   dSumWQuadraticFive5n2n4n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10423   dSpreadFive5n2n4n2n1n = f5pCorrelations->GetBinError(9);
10424   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
10425      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
10426      pow(dSumWLinearFive5n2n4n2n1n,2.)>dSumWQuadraticFive5n2n4n2n1n)
10427   {
10428    Double_t dError = pow(f3pCorrelations->GetBinContent(8),2.)
10429                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
10430                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
10431                    + pow(f2pCorrelations->GetBinContent(2),2.)
10432                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
10433                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
10434                    + pow((pow(dSumWQuadraticFive5n2n4n2n1n,0.5)/dSumWLinearFive5n2n4n2n1n)
10435                    * dSpreadFive5n2n4n2n1n*pow(pow(dSumWLinearFive5n2n4n2n1n,2.)/(pow(dSumWLinearFive5n2n4n2n1n,2.)-dSumWQuadraticFive5n2n4n2n1n),0.5),2.)
10436                    + 2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(2)
10437                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10438                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,13)) 
10439                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(8))
10440                    / (dSumWLinearTwo2n2n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10441                    - 2.*f3pCorrelations->GetBinContent(8)
10442                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10443                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,65))
10444                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(9))
10445                    / (dSumWLinearTwo2n2n*dSumWLinearFive5n2n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10446                    - 2.*f2pCorrelations->GetBinContent(2)
10447                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10448                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,65))
10449                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(9))
10450                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n2n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10451    if(dError>0.)
10452    {
10453     f5pCumulants->SetBinError(9,pow(dError,0.5)); 
10454    }
10455   } // end of if(...)
10456  } // end of {
10457  f5pCumulants->SetBinContent(10,f5pCorrelations->GetBinContent(10)-f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(3));
10458  {
10459   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
10460   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
10461   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
10462   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
10463   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
10464   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
10465   Double_t dSumWLinearFive5n3n4n3n1n = 0.; // sum of linear event weights for <4>
10466   Double_t dSumWQuadraticFive5n3n4n3n1n = 0.; // sum of quadratic event weights <4>
10467   Double_t dSpreadFive5n3n4n3n1n = 0.; // weighted and biased estimator for sigma of <4>
10468   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10469   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10470   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
10471   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10472   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10473   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
10474   dSumWLinearFive5n3n4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10475   dSumWQuadraticFive5n3n4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10476   dSpreadFive5n3n4n3n1n = f5pCorrelations->GetBinError(10);
10477   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
10478      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
10479      pow(dSumWLinearFive5n3n4n3n1n,2.)>dSumWQuadraticFive5n3n4n3n1n)
10480   {
10481    Double_t dError = pow(f3pCorrelations->GetBinContent(8),2.)
10482                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
10483                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
10484                    + pow(f2pCorrelations->GetBinContent(3),2.)
10485                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
10486                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
10487                    + pow((pow(dSumWQuadraticFive5n3n4n3n1n,0.5)/dSumWLinearFive5n3n4n3n1n)
10488                    * dSpreadFive5n3n4n3n1n*pow(pow(dSumWLinearFive5n3n4n3n1n,2.)/(pow(dSumWLinearFive5n3n4n3n1n,2.)-dSumWQuadraticFive5n3n4n3n1n),0.5),2.)
10489                    + 2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(3)
10490                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10491                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,13)) 
10492                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(8))
10493                    / (dSumWLinearTwo3n3n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10494                    - 2.*f3pCorrelations->GetBinContent(8)
10495                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10496                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,66))
10497                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(10))
10498                    / (dSumWLinearTwo3n3n*dSumWLinearFive5n3n4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10499                    - 2.*f2pCorrelations->GetBinContent(3)
10500                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10501                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,66))
10502                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(10))
10503                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n3n4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10504    if(dError>0.)
10505    {
10506     f5pCumulants->SetBinError(10,pow(dError,0.5)); 
10507    }
10508   } // end of if(...)
10509  } // end of {
10510  f5pCumulants->SetBinContent(11,f5pCorrelations->GetBinContent(11)-f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(4));
10511  {
10512   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
10513   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
10514   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
10515   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
10516   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
10517   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
10518   Double_t dSumWLinearFive5n4n4n3n2n = 0.; // sum of linear event weights for <4>
10519   Double_t dSumWQuadraticFive5n4n4n3n2n = 0.; // sum of quadratic event weights <4>
10520   Double_t dSpreadFive5n4n4n3n2n = 0.; // weighted and biased estimator for sigma of <4>
10521   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10522   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10523   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
10524   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10525   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10526   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
10527   dSumWLinearFive5n4n4n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10528   dSumWQuadraticFive5n4n4n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10529   dSpreadFive5n4n4n3n2n = f5pCorrelations->GetBinError(11);
10530   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
10531      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
10532      pow(dSumWLinearFive5n4n4n3n2n,2.)>dSumWQuadraticFive5n4n4n3n2n)
10533   {
10534    Double_t dError = pow(f3pCorrelations->GetBinContent(7),2.)
10535                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
10536                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
10537                    + pow(f2pCorrelations->GetBinContent(4),2.)
10538                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
10539                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
10540                    + pow((pow(dSumWQuadraticFive5n4n4n3n2n,0.5)/dSumWLinearFive5n4n4n3n2n)
10541                    * dSpreadFive5n4n4n3n2n*pow(pow(dSumWLinearFive5n4n4n3n2n,2.)/(pow(dSumWLinearFive5n4n4n3n2n,2.)-dSumWQuadraticFive5n4n4n3n2n),0.5),2.)
10542                    + 2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(4)
10543                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10544                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,12)) 
10545                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(7))
10546                    / (dSumWLinearTwo4n4n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10547                    - 2.*f3pCorrelations->GetBinContent(7)
10548                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10549                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,67))
10550                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(11))
10551                    / (dSumWLinearTwo4n4n*dSumWLinearFive5n4n4n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10552                    - 2.*f2pCorrelations->GetBinContent(4)
10553                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10554                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,67))
10555                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(11))
10556                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n4n4n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10557    if(dError>0.)
10558    {
10559     f5pCumulants->SetBinError(11,pow(dError,0.5)); 
10560    }
10561   } // end of if(...)
10562  } // end of {
10563  f5pCumulants->SetBinContent(12,f5pCorrelations->GetBinContent(12)-f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(5));
10564  {
10565   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
10566   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
10567   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
10568   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
10569   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
10570   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
10571   Double_t dSumWLinearFive5n3n5n2n1n = 0.; // sum of linear event weights for <4>
10572   Double_t dSumWQuadraticFive5n3n5n2n1n = 0.; // sum of quadratic event weights <4>
10573   Double_t dSpreadFive5n3n5n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10574   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10575   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10576   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
10577   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10578   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10579   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
10580   dSumWLinearFive5n3n5n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10581   dSumWQuadraticFive5n3n5n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10582   dSpreadFive5n3n5n2n1n = f5pCorrelations->GetBinError(12);
10583   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
10584      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
10585      pow(dSumWLinearFive5n3n5n2n1n,2.)>dSumWQuadraticFive5n3n5n2n1n)
10586   {
10587    Double_t dError = pow(f3pCorrelations->GetBinContent(5),2.)
10588                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
10589                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
10590                    + pow(f2pCorrelations->GetBinContent(5),2.)
10591                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
10592                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
10593                    + pow((pow(dSumWQuadraticFive5n3n5n2n1n,0.5)/dSumWLinearFive5n3n5n2n1n)
10594                    * dSpreadFive5n3n5n2n1n*pow(pow(dSumWLinearFive5n3n5n2n1n,2.)/(pow(dSumWLinearFive5n3n5n2n1n,2.)-dSumWQuadraticFive5n3n5n2n1n),0.5),2.)
10595                    + 2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(5)
10596                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10597                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,10)) 
10598                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(5))
10599                    / (dSumWLinearTwo5n5n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10600                    - 2.*f3pCorrelations->GetBinContent(5)
10601                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10602                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,68))
10603                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(12))
10604                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n3n5n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10605                    - 2.*f2pCorrelations->GetBinContent(5)
10606                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10607                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,68))
10608                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(12))
10609                    / (dSumWLinearThree3n2n1n*dSumWLinearFive5n3n5n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10610    if(dError>0.)
10611    {
10612     f5pCumulants->SetBinError(12,pow(dError,0.5)); 
10613    }
10614   } // end of if(...)
10615  } // end of {
10616  f5pCumulants->SetBinContent(13,f5pCorrelations->GetBinContent(13)-f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(5));
10617  {
10618   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
10619   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
10620   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
10621   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
10622   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
10623   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
10624   Double_t dSumWLinearFive5n4n5n2n2n = 0.; // sum of linear event weights for <4>
10625   Double_t dSumWQuadraticFive5n4n5n2n2n = 0.; // sum of quadratic event weights <4>
10626   Double_t dSpreadFive5n4n5n2n2n = 0.; // weighted and biased estimator for sigma of <4>
10627   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10628   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10629   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
10630   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10631   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10632   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
10633   dSumWLinearFive5n4n5n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10634   dSumWQuadraticFive5n4n5n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10635   dSpreadFive5n4n5n2n2n = f5pCorrelations->GetBinError(13);
10636   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
10637      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
10638      pow(dSumWLinearFive5n4n5n2n2n,2.)>dSumWQuadraticFive5n4n5n2n2n)
10639   {
10640    Double_t dError = pow(f3pCorrelations->GetBinContent(2),2.)
10641                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
10642                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
10643                    + pow(f2pCorrelations->GetBinContent(5),2.)
10644                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
10645                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
10646                    + pow((pow(dSumWQuadraticFive5n4n5n2n2n,0.5)/dSumWLinearFive5n4n5n2n2n)
10647                    * dSpreadFive5n4n5n2n2n*pow(pow(dSumWLinearFive5n4n5n2n2n,2.)/(pow(dSumWLinearFive5n4n5n2n2n,2.)-dSumWQuadraticFive5n4n5n2n2n),0.5),2.)
10648                    + 2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(5)
10649                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10650                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,8)) 
10651                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(2))
10652                    / (dSumWLinearTwo5n5n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10653                    - 2.*f3pCorrelations->GetBinContent(2)
10654                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10655                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,69))
10656                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(13))
10657                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n4n5n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10658                    - 2.*f2pCorrelations->GetBinContent(5)
10659                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10660                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,69))
10661                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(13))
10662                    / (dSumWLinearThree4n2n2n*dSumWLinearFive5n4n5n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10663    if(dError>0.)
10664    {
10665     f5pCumulants->SetBinError(13,pow(dError,0.5)); 
10666    }
10667   } // end of if(...)
10668  } // end of {
10669  f5pCumulants->SetBinContent(14,f5pCorrelations->GetBinContent(14)-f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(5));
10670  {
10671   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
10672   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
10673   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
10674   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
10675   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
10676   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
10677   Double_t dSumWLinearFive5n4n5n3n1n = 0.; // sum of linear event weights for <4>
10678   Double_t dSumWQuadraticFive5n4n5n3n1n = 0.; // sum of quadratic event weights <4>
10679   Double_t dSpreadFive5n4n5n3n1n = 0.; // weighted and biased estimator for sigma of <4>
10680   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10681   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10682   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
10683   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10684   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10685   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
10686   dSumWLinearFive5n4n5n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10687   dSumWQuadraticFive5n4n5n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10688   dSpreadFive5n4n5n3n1n = f5pCorrelations->GetBinError(14);
10689   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
10690      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
10691      pow(dSumWLinearFive5n4n5n3n1n,2.)>dSumWQuadraticFive5n4n5n3n1n)
10692   {
10693    Double_t dError = pow(f3pCorrelations->GetBinContent(6),2.)
10694                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
10695                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
10696                    + pow(f2pCorrelations->GetBinContent(5),2.)
10697                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
10698                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
10699                    + pow((pow(dSumWQuadraticFive5n4n5n3n1n,0.5)/dSumWLinearFive5n4n5n3n1n)
10700                    * dSpreadFive5n4n5n3n1n*pow(pow(dSumWLinearFive5n4n5n3n1n,2.)/(pow(dSumWLinearFive5n4n5n3n1n,2.)-dSumWQuadraticFive5n4n5n3n1n),0.5),2.)
10701                    + 2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(5)
10702                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10703                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,11)) 
10704                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(6))
10705                    / (dSumWLinearTwo5n5n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10706                    - 2.*f3pCorrelations->GetBinContent(6)
10707                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10708                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,70))
10709                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(14))
10710                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n4n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10711                    - 2.*f2pCorrelations->GetBinContent(5)
10712                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10713                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,70))
10714                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(14))
10715                    / (dSumWLinearThree4n3n1n*dSumWLinearFive5n4n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10716    if(dError>0.)
10717    {
10718     f5pCumulants->SetBinError(14,pow(dError,0.5)); 
10719    }
10720   } // end of if(...)
10721  } // end of {
10722  f5pCumulants->SetBinContent(15,f5pCorrelations->GetBinContent(15)-f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(1));
10723  {
10724   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
10725   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
10726   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
10727   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
10728   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
10729   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
10730   Double_t dSumWLinearFive6n1n3n3n1n = 0.; // sum of linear event weights for <4>
10731   Double_t dSumWQuadraticFive6n1n3n3n1n = 0.; // sum of quadratic event weights <4>
10732   Double_t dSpreadFive6n1n3n3n1n = 0.; // weighted and biased estimator for sigma of <4>
10733   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10734   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10735   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
10736   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10737   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10738   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
10739   dSumWLinearFive6n1n3n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10740   dSumWQuadraticFive6n1n3n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10741   dSpreadFive6n1n3n3n1n = f5pCorrelations->GetBinError(15);
10742   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
10743      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
10744      pow(dSumWLinearFive6n1n3n3n1n,2.)>dSumWQuadraticFive6n1n3n3n1n)
10745   {
10746    Double_t dError = pow(f3pCorrelations->GetBinContent(3),2.)
10747                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
10748                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
10749                    + pow(f2pCorrelations->GetBinContent(1),2.)
10750                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
10751                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
10752                    + pow((pow(dSumWQuadraticFive6n1n3n3n1n,0.5)/dSumWLinearFive6n1n3n3n1n)
10753                    * dSpreadFive6n1n3n3n1n*pow(pow(dSumWLinearFive6n1n3n3n1n,2.)/(pow(dSumWLinearFive6n1n3n3n1n,2.)-dSumWQuadraticFive6n1n3n3n1n),0.5),2.)
10754                    + 2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(1)
10755                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10756                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,9)) 
10757                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(3))
10758                    / (dSumWLinearTwo1n1n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10759                    - 2.*f3pCorrelations->GetBinContent(3)
10760                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10761                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,71))
10762                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(15))
10763                    / (dSumWLinearTwo1n1n*dSumWLinearFive6n1n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10764                    - 2.*f2pCorrelations->GetBinContent(1)
10765                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10766                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,71))
10767                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(15))
10768                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n1n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10769    if(dError>0.)
10770    {
10771     f5pCumulants->SetBinError(15,pow(dError,0.5)); 
10772    }
10773   } // end of if(...)
10774  } // end of {
10775  f5pCumulants->SetBinContent(16,f5pCorrelations->GetBinContent(16)-f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(2));
10776  {
10777   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
10778   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
10779   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
10780   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
10781   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
10782   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
10783   Double_t dSumWLinearFive6n2n3n3n2n = 0.; // sum of linear event weights for <4>
10784   Double_t dSumWQuadraticFive6n2n3n3n2n = 0.; // sum of quadratic event weights <4>
10785   Double_t dSpreadFive6n2n3n3n2n = 0.; // weighted and biased estimator for sigma of <4>
10786   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10787   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10788   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
10789   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10790   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10791   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
10792   dSumWLinearFive6n2n3n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10793   dSumWQuadraticFive6n2n3n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10794   dSpreadFive6n2n3n3n2n = f5pCorrelations->GetBinError(16);
10795   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
10796      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
10797      pow(dSumWLinearFive6n2n3n3n2n,2.)>dSumWQuadraticFive6n2n3n3n2n)
10798   {
10799    Double_t dError = pow(f3pCorrelations->GetBinContent(3),2.)
10800                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
10801                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
10802                    + pow(f2pCorrelations->GetBinContent(2),2.)
10803                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
10804                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
10805                    + pow((pow(dSumWQuadraticFive6n2n3n3n2n,0.5)/dSumWLinearFive6n2n3n3n2n)
10806                    * dSpreadFive6n2n3n3n2n*pow(pow(dSumWLinearFive6n2n3n3n2n,2.)/(pow(dSumWLinearFive6n2n3n3n2n,2.)-dSumWQuadraticFive6n2n3n3n2n),0.5),2.)
10807                    + 2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(2)
10808                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10809                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,9)) 
10810                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(3))
10811                    / (dSumWLinearTwo2n2n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10812                    - 2.*f3pCorrelations->GetBinContent(3)
10813                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10814                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,72))
10815                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(16))
10816                    / (dSumWLinearTwo2n2n*dSumWLinearFive6n2n3n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10817                    - 2.*f2pCorrelations->GetBinContent(2)
10818                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10819                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,72))
10820                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(16))
10821                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n2n3n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10822    if(dError>0.)
10823    {
10824     f5pCumulants->SetBinError(16,pow(dError,0.5)); 
10825    }
10826   } // end of if(...)
10827  } // end of {
10828  f5pCumulants->SetBinContent(17,f5pCorrelations->GetBinContent(17)-f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(1));
10829  {
10830   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
10831   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
10832   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
10833   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
10834   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
10835   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
10836   Double_t dSumWLinearFive6n1n4n2n1n = 0.; // sum of linear event weights for <4>
10837   Double_t dSumWQuadraticFive6n1n4n2n1n = 0.; // sum of quadratic event weights <4>
10838   Double_t dSpreadFive6n1n4n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10839   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10840   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10841   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
10842   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10843   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10844   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
10845   dSumWLinearFive6n1n4n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10846   dSumWQuadraticFive6n1n4n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10847   dSpreadFive6n1n4n2n1n = f5pCorrelations->GetBinError(17);
10848   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
10849      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
10850      pow(dSumWLinearFive6n1n4n2n1n,2.)>dSumWQuadraticFive6n1n4n2n1n)
10851   {
10852    Double_t dError = pow(f3pCorrelations->GetBinContent(9),2.)
10853                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
10854                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
10855                    + pow(f2pCorrelations->GetBinContent(1),2.)
10856                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
10857                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
10858                    + pow((pow(dSumWQuadraticFive6n1n4n2n1n,0.5)/dSumWLinearFive6n1n4n2n1n)
10859                    * dSpreadFive6n1n4n2n1n*pow(pow(dSumWLinearFive6n1n4n2n1n,2.)/(pow(dSumWLinearFive6n1n4n2n1n,2.)-dSumWQuadraticFive6n1n4n2n1n),0.5),2.)
10860                    + 2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(1)
10861                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10862                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,14)) 
10863                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(9))
10864                    / (dSumWLinearTwo1n1n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10865                    - 2.*f3pCorrelations->GetBinContent(9)
10866                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10867                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,73))
10868                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(17))
10869                    / (dSumWLinearTwo1n1n*dSumWLinearFive6n1n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10870                    - 2.*f2pCorrelations->GetBinContent(1)
10871                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10872                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,73))
10873                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(17))
10874                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n1n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10875    if(dError>0.)
10876    {
10877     f5pCumulants->SetBinError(17,pow(dError,0.5)); 
10878    }
10879   } // end of if(...)
10880  } // end of {
10881  f5pCumulants->SetBinContent(18,f5pCorrelations->GetBinContent(18)-f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(3));
10882  {
10883   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
10884   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
10885   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
10886   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
10887   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
10888   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
10889   Double_t dSumWLinearFive6n3n4n3n2n = 0.; // sum of linear event weights for <4>
10890   Double_t dSumWQuadraticFive6n3n4n3n2n = 0.; // sum of quadratic event weights <4>
10891   Double_t dSpreadFive6n3n4n3n2n = 0.; // weighted and biased estimator for sigma of <4>
10892   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10893   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10894   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
10895   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10896   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10897   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
10898   dSumWLinearFive6n3n4n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10899   dSumWQuadraticFive6n3n4n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10900   dSpreadFive6n3n4n3n2n = f5pCorrelations->GetBinError(18);
10901   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
10902      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
10903      pow(dSumWLinearFive6n3n4n3n2n,2.)>dSumWQuadraticFive6n3n4n3n2n)
10904   {
10905    Double_t dError = pow(f3pCorrelations->GetBinContent(9),2.)
10906                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
10907                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
10908                    + pow(f2pCorrelations->GetBinContent(3),2.)
10909                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
10910                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
10911                    + pow((pow(dSumWQuadraticFive6n3n4n3n2n,0.5)/dSumWLinearFive6n3n4n3n2n)
10912                    * dSpreadFive6n3n4n3n2n*pow(pow(dSumWLinearFive6n3n4n3n2n,2.)/(pow(dSumWLinearFive6n3n4n3n2n,2.)-dSumWQuadraticFive6n3n4n3n2n),0.5),2.)
10913                    + 2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(3)
10914                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10915                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,14)) 
10916                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(9))
10917                    / (dSumWLinearTwo3n3n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10918                    - 2.*f3pCorrelations->GetBinContent(9)
10919                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10920                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,74))
10921                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(18))
10922                    / (dSumWLinearTwo3n3n*dSumWLinearFive6n3n4n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10923                    - 2.*f2pCorrelations->GetBinContent(3)
10924                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10925                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,74))
10926                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(18))
10927                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n3n4n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10928    if(dError>0.)
10929    {
10930     f5pCumulants->SetBinError(18,pow(dError,0.5)); 
10931    }
10932   } // end of if(...)
10933  } // end of {
10934  f5pCumulants->SetBinContent(19,f5pCorrelations->GetBinContent(19)-f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(4));
10935  {
10936   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
10937   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
10938   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
10939   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
10940   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
10941   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
10942   Double_t dSumWLinearFive6n4n4n3n3n = 0.; // sum of linear event weights for <4>
10943   Double_t dSumWQuadraticFive6n4n4n3n3n = 0.; // sum of quadratic event weights <4>
10944   Double_t dSpreadFive6n4n4n3n3n = 0.; // weighted and biased estimator for sigma of <4>
10945   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10946   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10947   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
10948   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10949   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10950   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
10951   dSumWLinearFive6n4n4n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10952   dSumWQuadraticFive6n4n4n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10953   dSpreadFive6n4n4n3n3n = f5pCorrelations->GetBinError(19);
10954   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
10955      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
10956      pow(dSumWLinearFive6n4n4n3n3n,2.)>dSumWQuadraticFive6n4n4n3n3n)
10957   {
10958    Double_t dError = pow(f3pCorrelations->GetBinContent(3),2.)
10959                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
10960                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
10961                    + pow(f2pCorrelations->GetBinContent(4),2.)
10962                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
10963                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
10964                    + pow((pow(dSumWQuadraticFive6n4n4n3n3n,0.5)/dSumWLinearFive6n4n4n3n3n)
10965                    * dSpreadFive6n4n4n3n3n*pow(pow(dSumWLinearFive6n4n4n3n3n,2.)/(pow(dSumWLinearFive6n4n4n3n3n,2.)-dSumWQuadraticFive6n4n4n3n3n),0.5),2.)
10966                    + 2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(4)
10967                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10968                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,9)) 
10969                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(3))
10970                    / (dSumWLinearTwo4n4n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10971                    - 2.*f3pCorrelations->GetBinContent(3)
10972                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10973                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,75))
10974                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(19))
10975                    / (dSumWLinearTwo4n4n*dSumWLinearFive6n4n4n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10976                    - 2.*f2pCorrelations->GetBinContent(4)
10977                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10978                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,75))
10979                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(19))
10980                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n4n4n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10981    if(dError>0.)
10982    {
10983     f5pCumulants->SetBinError(19,pow(dError,0.5)); 
10984    }
10985   } // end of if(...)
10986  } // end of {
10987  f5pCumulants->SetBinContent(20,f5pCorrelations->GetBinContent(20)-f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(2));
10988  {
10989   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
10990   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
10991   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
10992   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
10993   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
10994   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
10995   Double_t dSumWLinearFive6n2n5n2n1n = 0.; // sum of linear event weights for <4>
10996   Double_t dSumWQuadraticFive6n2n5n2n1n = 0.; // sum of quadratic event weights <4>
10997   Double_t dSpreadFive6n2n5n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10998   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10999   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11000   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
11001   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11002   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11003   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
11004   dSumWLinearFive6n2n5n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11005   dSumWQuadraticFive6n2n5n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11006   dSpreadFive6n2n5n2n1n = f5pCorrelations->GetBinError(20);
11007   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
11008      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
11009      pow(dSumWLinearFive6n2n5n2n1n,2.)>dSumWQuadraticFive6n2n5n2n1n)
11010   {
11011    Double_t dError = pow(f3pCorrelations->GetBinContent(10),2.)
11012                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
11013                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
11014                    + pow(f2pCorrelations->GetBinContent(2),2.)
11015                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
11016                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
11017                    + pow((pow(dSumWQuadraticFive6n2n5n2n1n,0.5)/dSumWLinearFive6n2n5n2n1n)
11018                    * dSpreadFive6n2n5n2n1n*pow(pow(dSumWLinearFive6n2n5n2n1n,2.)/(pow(dSumWLinearFive6n2n5n2n1n,2.)-dSumWQuadraticFive6n2n5n2n1n),0.5),2.)
11019                    + 2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(2)
11020                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11021                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,15)) 
11022                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(10))
11023                    / (dSumWLinearTwo2n2n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11024                    - 2.*f3pCorrelations->GetBinContent(10)
11025                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11026                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,76))
11027                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(20))
11028                    / (dSumWLinearTwo2n2n*dSumWLinearFive6n2n5n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11029                    - 2.*f2pCorrelations->GetBinContent(2)
11030                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11031                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,76))
11032                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(20))
11033                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n2n5n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11034    if(dError>0.)
11035    {
11036     f5pCumulants->SetBinError(20,pow(dError,0.5)); 
11037    }
11038   } // end of if(...)
11039  } // end of {
11040  f5pCumulants->SetBinContent(21,f5pCorrelations->GetBinContent(21)-f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(3));
11041  {
11042   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
11043   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
11044   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
11045   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
11046   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
11047   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
11048   Double_t dSumWLinearFive6n3n5n3n1n = 0.; // sum of linear event weights for <4>
11049   Double_t dSumWQuadraticFive6n3n5n3n1n = 0.; // sum of quadratic event weights <4>
11050   Double_t dSpreadFive6n3n5n3n1n = 0.; // weighted and biased estimator for sigma of <4>
11051   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11052   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11053   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
11054   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11055   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11056   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
11057   dSumWLinearFive6n3n5n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11058   dSumWQuadraticFive6n3n5n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11059   dSpreadFive6n3n5n3n1n = f5pCorrelations->GetBinError(21);
11060   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
11061      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
11062      pow(dSumWLinearFive6n3n5n3n1n,2.)>dSumWQuadraticFive6n3n5n3n1n)
11063   {
11064    Double_t dError = pow(f3pCorrelations->GetBinContent(10),2.)
11065                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
11066                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
11067                    + pow(f2pCorrelations->GetBinContent(3),2.)
11068                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
11069                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
11070                    + pow((pow(dSumWQuadraticFive6n3n5n3n1n,0.5)/dSumWLinearFive6n3n5n3n1n)
11071                    * dSpreadFive6n3n5n3n1n*pow(pow(dSumWLinearFive6n3n5n3n1n,2.)/(pow(dSumWLinearFive6n3n5n3n1n,2.)-dSumWQuadraticFive6n3n5n3n1n),0.5),2.)
11072                    + 2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(3)
11073                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11074                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,15)) 
11075                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(10))
11076                    / (dSumWLinearTwo3n3n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11077                    - 2.*f3pCorrelations->GetBinContent(10)
11078                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11079                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,77))
11080                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(21))
11081                    / (dSumWLinearTwo3n3n*dSumWLinearFive6n3n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11082                    - 2.*f2pCorrelations->GetBinContent(3)
11083                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11084                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,77))
11085                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(21))
11086                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n3n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11087    if(dError>0.)
11088    {
11089     f5pCumulants->SetBinError(21,pow(dError,0.5)); 
11090    }
11091   } // end of if(...)
11092  } // end of {
11093  f5pCumulants->SetBinContent(22,f5pCorrelations->GetBinContent(22)-f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(4));
11094  {
11095   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
11096   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
11097   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
11098   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
11099   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
11100   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
11101   Double_t dSumWLinearFive6n3n5n3n1n = 0.; // sum of linear event weights for <4>
11102   Double_t dSumWQuadraticFive6n3n5n3n1n = 0.; // sum of quadratic event weights <4>
11103   Double_t dSpreadFive6n3n5n3n1n = 0.; // weighted and biased estimator for sigma of <4>
11104   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11105   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11106   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
11107   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11108   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11109   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
11110   dSumWLinearFive6n3n5n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11111   dSumWQuadraticFive6n3n5n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11112   dSpreadFive6n3n5n3n1n = f5pCorrelations->GetBinError(22);
11113   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
11114      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
11115      pow(dSumWLinearFive6n3n5n3n1n,2.)>dSumWQuadraticFive6n3n5n3n1n)
11116   {
11117    Double_t dError = pow(f3pCorrelations->GetBinContent(10),2.)
11118                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
11119                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
11120                    + pow(f2pCorrelations->GetBinContent(4),2.)
11121                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
11122                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
11123                    + pow((pow(dSumWQuadraticFive6n3n5n3n1n,0.5)/dSumWLinearFive6n3n5n3n1n)
11124                    * dSpreadFive6n3n5n3n1n*pow(pow(dSumWLinearFive6n3n5n3n1n,2.)/(pow(dSumWLinearFive6n3n5n3n1n,2.)-dSumWQuadraticFive6n3n5n3n1n),0.5),2.)
11125                    + 2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(4)
11126                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11127                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,15)) 
11128                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(10))
11129                    / (dSumWLinearTwo4n4n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11130                    - 2.*f3pCorrelations->GetBinContent(10)
11131                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11132                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,78))
11133                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(22))
11134                    / (dSumWLinearTwo4n4n*dSumWLinearFive6n3n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11135                    - 2.*f2pCorrelations->GetBinContent(4)
11136                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11137                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,78))
11138                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(22))
11139                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n3n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11140    if(dError>0.)
11141    {
11142     f5pCumulants->SetBinError(22,pow(dError,0.5)); 
11143    }
11144   } // end of if(...)
11145  } // end of {
11146  f5pCumulants->SetBinContent(23,f5pCorrelations->GetBinContent(23)-f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(5));
11147  {
11148   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
11149   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
11150   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
11151   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
11152   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
11153   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
11154   Double_t dSumWLinearFive6n5n5n3n3n = 0.; // sum of linear event weights for <4>
11155   Double_t dSumWQuadraticFive6n5n5n3n3n = 0.; // sum of quadratic event weights <4>
11156   Double_t dSpreadFive6n5n5n3n3n = 0.; // weighted and biased estimator for sigma of <4>
11157   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11158   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11159   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
11160   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11161   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11162   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
11163   dSumWLinearFive6n5n5n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11164   dSumWQuadraticFive6n5n5n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11165   dSpreadFive6n5n5n3n3n = f5pCorrelations->GetBinError(23);
11166   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
11167      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
11168      pow(dSumWLinearFive6n5n5n3n3n,2.)>dSumWQuadraticFive6n5n5n3n3n)
11169   {
11170    Double_t dError = pow(f3pCorrelations->GetBinContent(3),2.)
11171                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
11172                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
11173                    + pow(f2pCorrelations->GetBinContent(5),2.)
11174                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
11175                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
11176                    + pow((pow(dSumWQuadraticFive6n5n5n3n3n,0.5)/dSumWLinearFive6n5n5n3n3n)
11177                    * dSpreadFive6n5n5n3n3n*pow(pow(dSumWLinearFive6n5n5n3n3n,2.)/(pow(dSumWLinearFive6n5n5n3n3n,2.)-dSumWQuadraticFive6n5n5n3n3n),0.5),2.)
11178                    + 2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(5)
11179                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11180                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,9)) 
11181                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(3))
11182                    / (dSumWLinearTwo5n5n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11183                    - 2.*f3pCorrelations->GetBinContent(3)
11184                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11185                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,79))
11186                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(23))
11187                    / (dSumWLinearTwo5n5n*dSumWLinearFive6n5n5n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11188                    - 2.*f2pCorrelations->GetBinContent(5)
11189                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11190                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,79))
11191                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(23))
11192                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n5n5n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11193    if(dError>0.)
11194    {
11195     f5pCumulants->SetBinError(23,pow(dError,0.5)); 
11196    }
11197   } // end of if(...)
11198  } // end of {
11199  f5pCumulants->SetBinContent(24,f5pCorrelations->GetBinContent(24)-f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(6));
11200  {
11201   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11202   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11203   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11204   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
11205   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
11206   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
11207   Double_t dSumWLinearFive6n2n6n1n1n = 0.; // sum of linear event weights for <4>
11208   Double_t dSumWQuadraticFive6n2n6n1n1n = 0.; // sum of quadratic event weights <4>
11209   Double_t dSpreadFive6n2n6n1n1n = 0.; // weighted and biased estimator for sigma of <4>
11210   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11211   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11212   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11213   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11214   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11215   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
11216   dSumWLinearFive6n2n6n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11217   dSumWQuadraticFive6n2n6n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11218   dSpreadFive6n2n6n1n1n = f5pCorrelations->GetBinError(24);
11219   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11220      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
11221      pow(dSumWLinearFive6n2n6n1n1n,2.)>dSumWQuadraticFive6n2n6n1n1n)
11222   {
11223    Double_t dError = pow(f3pCorrelations->GetBinContent(1),2.)
11224                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11225                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11226                    + pow(f2pCorrelations->GetBinContent(6),2.)
11227                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
11228                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
11229                    + pow((pow(dSumWQuadraticFive6n2n6n1n1n,0.5)/dSumWLinearFive6n2n6n1n1n)
11230                    * dSpreadFive6n2n6n1n1n*pow(pow(dSumWLinearFive6n2n6n1n1n,2.)/(pow(dSumWLinearFive6n2n6n1n1n,2.)-dSumWQuadraticFive6n2n6n1n1n),0.5),2.)
11231                    + 2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(6)
11232                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11233                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,7)) 
11234                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(1))
11235                    / (dSumWLinearTwo6n6n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11236                    - 2.*f3pCorrelations->GetBinContent(1)
11237                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11238                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,80))
11239                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(24))
11240                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n2n6n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11241                    - 2.*f2pCorrelations->GetBinContent(6)
11242                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11243                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,80))
11244                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(24))
11245                    / (dSumWLinearThree2n1n1n*dSumWLinearFive6n2n6n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11246    if(dError>0.)
11247    {
11248     f5pCumulants->SetBinError(24,pow(dError,0.5)); 
11249    }
11250   } // end of if(...)
11251  } // end of {
11252  f5pCumulants->SetBinContent(25,f5pCorrelations->GetBinContent(25)-f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(6));
11253  {
11254   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11255   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11256   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11257   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
11258   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
11259   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
11260   Double_t dSumWLinearFive6n3n6n2n1n = 0.; // sum of linear event weights for <4>
11261   Double_t dSumWQuadraticFive6n3n6n2n1n = 0.; // sum of quadratic event weights <4>
11262   Double_t dSpreadFive6n3n6n2n1n = 0.; // weighted and biased estimator for sigma of <4>
11263   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11264   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11265   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11266   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11267   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11268   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
11269   dSumWLinearFive6n3n6n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11270   dSumWQuadraticFive6n3n6n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11271   dSpreadFive6n3n6n2n1n = f5pCorrelations->GetBinError(25);
11272   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11273      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
11274      pow(dSumWLinearFive6n3n6n2n1n,2.)>dSumWQuadraticFive6n3n6n2n1n)
11275   {
11276    Double_t dError = pow(f3pCorrelations->GetBinContent(5),2.)
11277                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11278                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11279                    + pow(f2pCorrelations->GetBinContent(6),2.)
11280                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
11281                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
11282                    + pow((pow(dSumWQuadraticFive6n3n6n2n1n,0.5)/dSumWLinearFive6n3n6n2n1n)
11283                    * dSpreadFive6n3n6n2n1n*pow(pow(dSumWLinearFive6n3n6n2n1n,2.)/(pow(dSumWLinearFive6n3n6n2n1n,2.)-dSumWQuadraticFive6n3n6n2n1n),0.5),2.)
11284                    + 2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(6)
11285                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11286                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,10)) 
11287                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(5))
11288                    / (dSumWLinearTwo6n6n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11289                    - 2.*f3pCorrelations->GetBinContent(5)
11290                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11291                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,81))
11292                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(25))
11293                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n3n6n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11294                    - 2.*f2pCorrelations->GetBinContent(6)
11295                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11296                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,81))
11297                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(25))
11298                    / (dSumWLinearThree3n2n1n*dSumWLinearFive6n3n6n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11299    if(dError>0.)
11300    {
11301     f5pCumulants->SetBinError(25,pow(dError,0.5)); 
11302    }
11303   } // end of if(...)
11304  } // end of {
11305  f5pCumulants->SetBinContent(26,f5pCorrelations->GetBinContent(26)-f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(6));
11306  {
11307   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11308   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11309   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11310   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
11311   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
11312   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
11313   Double_t dSumWLinearFive6n4n6n2n2n = 0.; // sum of linear event weights for <4>
11314   Double_t dSumWQuadraticFive6n4n6n2n2n = 0.; // sum of quadratic event weights <4>
11315   Double_t dSpreadFive6n4n6n2n2n = 0.; // weighted and biased estimator for sigma of <4>
11316   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11317   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11318   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11319   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11320   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11321   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
11322   dSumWLinearFive6n4n6n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11323   dSumWQuadraticFive6n4n6n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11324   dSpreadFive6n4n6n2n2n = f5pCorrelations->GetBinError(26);
11325   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11326      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
11327      pow(dSumWLinearFive6n4n6n2n2n,2.)>dSumWQuadraticFive6n4n6n2n2n)
11328   {
11329    Double_t dError = pow(f3pCorrelations->GetBinContent(2),2.)
11330                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11331                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11332                    + pow(f2pCorrelations->GetBinContent(6),2.)
11333                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
11334                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
11335                    + pow((pow(dSumWQuadraticFive6n4n6n2n2n,0.5)/dSumWLinearFive6n4n6n2n2n)
11336                    * dSpreadFive6n4n6n2n2n*pow(pow(dSumWLinearFive6n4n6n2n2n,2.)/(pow(dSumWLinearFive6n4n6n2n2n,2.)-dSumWQuadraticFive6n4n6n2n2n),0.5),2.)
11337                    + 2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(6)
11338                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11339                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,8)) 
11340                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(2))
11341                    / (dSumWLinearTwo6n6n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11342                    - 2.*f3pCorrelations->GetBinContent(2)
11343                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11344                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,82))
11345                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(26))
11346                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n4n6n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11347                    - 2.*f2pCorrelations->GetBinContent(6)
11348                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11349                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,82))
11350                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(26))
11351                    / (dSumWLinearThree4n2n2n*dSumWLinearFive6n4n6n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11352    if(dError>0.)
11353    {
11354     f5pCumulants->SetBinError(26,pow(dError,0.5)); 
11355    }
11356   } // end of if(...)
11357  } // end of {
11358  f5pCumulants->SetBinContent(27,f5pCorrelations->GetBinContent(27)-f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(6));
11359  {
11360   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11361   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11362   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11363   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
11364   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
11365   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
11366   Double_t dSumWLinearFive6n4n6n3n1n = 0.; // sum of linear event weights for <4>
11367   Double_t dSumWQuadraticFive6n4n6n3n1n = 0.; // sum of quadratic event weights <4>
11368   Double_t dSpreadFive6n4n6n3n1n = 0.; // weighted and biased estimator for sigma of <4>
11369   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11370   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11371   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11372   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11373   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11374   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
11375   dSumWLinearFive6n4n6n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11376   dSumWQuadraticFive6n4n6n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11377   dSpreadFive6n4n6n3n1n = f5pCorrelations->GetBinError(27);
11378   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11379      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
11380      pow(dSumWLinearFive6n4n6n3n1n,2.)>dSumWQuadraticFive6n4n6n3n1n)
11381   {
11382    Double_t dError = pow(f3pCorrelations->GetBinContent(6),2.)
11383                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11384                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11385                    + pow(f2pCorrelations->GetBinContent(6),2.)
11386                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
11387                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
11388                    + pow((pow(dSumWQuadraticFive6n4n6n3n1n,0.5)/dSumWLinearFive6n4n6n3n1n)
11389                    * dSpreadFive6n4n6n3n1n*pow(pow(dSumWLinearFive6n4n6n3n1n,2.)/(pow(dSumWLinearFive6n4n6n3n1n,2.)-dSumWQuadraticFive6n4n6n3n1n),0.5),2.)
11390                    + 2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(6)
11391                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11392                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,11)) 
11393                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(6))
11394                    / (dSumWLinearTwo6n6n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11395                    - 2.*f3pCorrelations->GetBinContent(6)
11396                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11397                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,83))
11398                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(27))
11399                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n4n6n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11400                    - 2.*f2pCorrelations->GetBinContent(6)
11401                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11402                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,83))
11403                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(27))
11404                    / (dSumWLinearThree4n3n1n*dSumWLinearFive6n4n6n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11405    if(dError>0.)
11406    {
11407     f5pCumulants->SetBinError(27,pow(dError,0.5)); 
11408    }
11409   } // end of if(...)
11410  } // end of {
11411  f5pCumulants->SetBinContent(28,f5pCorrelations->GetBinContent(28)-f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(5));
11412  {
11413   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
11414   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
11415   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
11416   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
11417   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
11418   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
11419   Double_t dSumWLinearFive6n4n6n3n1n = 0.; // sum of linear event weights for <4>
11420   Double_t dSumWQuadraticFive6n4n6n3n1n = 0.; // sum of quadratic event weights <4>
11421   Double_t dSpreadFive6n4n6n3n1n = 0.; // weighted and biased estimator for sigma of <4>
11422   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11423   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11424   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
11425   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11426   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11427   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
11428   dSumWLinearFive6n4n6n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11429   dSumWQuadraticFive6n4n6n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11430   dSpreadFive6n4n6n3n1n = f5pCorrelations->GetBinError(28);
11431   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
11432      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
11433      pow(dSumWLinearFive6n4n6n3n1n,2.)>dSumWQuadraticFive6n4n6n3n1n)
11434   {
11435    Double_t dError = pow(f3pCorrelations->GetBinContent(9),2.)
11436                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
11437                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
11438                    + pow(f2pCorrelations->GetBinContent(5),2.)
11439                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
11440                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
11441                    + pow((pow(dSumWQuadraticFive6n4n6n3n1n,0.5)/dSumWLinearFive6n4n6n3n1n)
11442                    * dSpreadFive6n4n6n3n1n*pow(pow(dSumWLinearFive6n4n6n3n1n,2.)/(pow(dSumWLinearFive6n4n6n3n1n,2.)-dSumWQuadraticFive6n4n6n3n1n),0.5),2.)
11443                    + 2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(5)
11444                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11445                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,14)) 
11446                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(9))
11447                    / (dSumWLinearTwo5n5n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11448                    - 2.*f3pCorrelations->GetBinContent(9)
11449                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11450                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,84))
11451                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(28))
11452                    / (dSumWLinearTwo5n5n*dSumWLinearFive6n4n6n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11453                    - 2.*f2pCorrelations->GetBinContent(5)
11454                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11455                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,84))
11456                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(28))
11457                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n4n6n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11458    if(dError>0.)
11459    {
11460     f5pCumulants->SetBinError(28,pow(dError,0.5)); 
11461    }
11462   } // end of if(...)
11463  } // end of {
11464  f5pCumulants->SetBinContent(29,f5pCorrelations->GetBinContent(29)-f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(6));
11465  { 
11466   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11467   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11468   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11469   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
11470   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
11471   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
11472   Double_t dSumWLinearFive6n5n6n3n2n = 0.; // sum of linear event weights for <4>
11473   Double_t dSumWQuadraticFive6n5n6n3n2n = 0.; // sum of quadratic event weights <4>
11474   Double_t dSpreadFive6n5n6n3n2n = 0.; // weighted and biased estimator for sigma of <4>
11475   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11476   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11477   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11478   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11479   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11480   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
11481   dSumWLinearFive6n5n6n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11482   dSumWQuadraticFive6n5n6n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11483   dSpreadFive6n5n6n3n2n = f5pCorrelations->GetBinError(29);
11484   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11485      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
11486      pow(dSumWLinearFive6n5n6n3n2n,2.)>dSumWQuadraticFive6n5n6n3n2n)
11487   {
11488    Double_t dError = pow(f3pCorrelations->GetBinContent(7),2.)
11489                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11490                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11491                    + pow(f2pCorrelations->GetBinContent(6),2.)
11492                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
11493                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
11494                    + pow((pow(dSumWQuadraticFive6n5n6n3n2n,0.5)/dSumWLinearFive6n5n6n3n2n)
11495                    * dSpreadFive6n5n6n3n2n*pow(pow(dSumWLinearFive6n5n6n3n2n,2.)/(pow(dSumWLinearFive6n5n6n3n2n,2.)-dSumWQuadraticFive6n5n6n3n2n),0.5),2.)
11496                    + 2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(6)
11497                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11498                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,12)) 
11499                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(7))
11500                    / (dSumWLinearTwo6n6n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11501                    - 2.*f3pCorrelations->GetBinContent(7)
11502                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11503                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,85))
11504                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(29))
11505                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n5n6n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11506                    - 2.*f2pCorrelations->GetBinContent(6)
11507                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11508                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,85))
11509                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(29))
11510                    / (dSumWLinearThree5n3n2n*dSumWLinearFive6n5n6n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11511    if(dError>0.)
11512    {
11513     f5pCumulants->SetBinError(29,pow(dError,0.5)); 
11514    }
11515   } // end of if(...)
11516  } // end of {
11517  f5pCumulants->SetBinContent(30,f5pCorrelations->GetBinContent(30)-f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(6));
11518  { 
11519   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11520   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11521   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11522   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
11523   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
11524   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
11525   Double_t dSumWLinearFive6n5n6n4n1n = 0.; // sum of linear event weights for <4>
11526   Double_t dSumWQuadraticFive6n5n6n4n1n = 0.; // sum of quadratic event weights <4>
11527   Double_t dSpreadFive6n5n6n4n1n = 0.; // weighted and biased estimator for sigma of <4>
11528   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11529   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11530   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11531   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11532   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11533   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
11534   dSumWLinearFive6n5n6n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11535   dSumWQuadraticFive6n5n6n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11536   dSpreadFive6n5n6n4n1n = f5pCorrelations->GetBinError(30);
11537   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11538      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
11539      pow(dSumWLinearFive6n5n6n4n1n,2.)>dSumWQuadraticFive6n5n6n4n1n)
11540   {
11541    Double_t dError = pow(f3pCorrelations->GetBinContent(8),2.)
11542                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11543                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11544                    + pow(f2pCorrelations->GetBinContent(6),2.)
11545                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
11546                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
11547                    + pow((pow(dSumWQuadraticFive6n5n6n4n1n,0.5)/dSumWLinearFive6n5n6n4n1n)
11548                    * dSpreadFive6n5n6n4n1n*pow(pow(dSumWLinearFive6n5n6n4n1n,2.)/(pow(dSumWLinearFive6n5n6n4n1n,2.)-dSumWQuadraticFive6n5n6n4n1n),0.5),2.)
11549                    + 2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(6)
11550                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11551                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,13)) 
11552                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(8))
11553                    / (dSumWLinearTwo6n6n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11554                    - 2.*f3pCorrelations->GetBinContent(8)
11555                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11556                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,86))
11557                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(30))
11558                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n5n6n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11559                    - 2.*f2pCorrelations->GetBinContent(6)
11560                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11561                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,86))
11562                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(30))
11563                    / (dSumWLinearThree5n4n1n*dSumWLinearFive6n5n6n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11564    if(dError>0.)
11565    {
11566     f5pCumulants->SetBinError(30,pow(dError,0.5)); 
11567    }
11568   } // end of if(...)
11569  } // end of {
11570  // d2) "Two distinct harmonics":
11571  f5pCumulants->SetBinContent(32,f5pCorrelations->GetBinContent(32)-3.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(1));
11572  { 
11573   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
11574   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
11575   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
11576   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
11577   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
11578   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
11579   Double_t dSumWLinearFive2n1n1n1n1n = 0.; // sum of linear event weights for <4>
11580   Double_t dSumWQuadraticFive2n1n1n1n1n = 0.; // sum of quadratic event weights <4>
11581   Double_t dSpreadFive2n1n1n1n1n = 0.; // weighted and biased estimator for sigma of <4>
11582   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11583   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11584   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
11585   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11586   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11587   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
11588   dSumWLinearFive2n1n1n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11589   dSumWQuadraticFive2n1n1n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11590   dSpreadFive2n1n1n1n1n = f5pCorrelations->GetBinError(32);
11591   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
11592      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
11593      pow(dSumWLinearFive2n1n1n1n1n,2.)>dSumWQuadraticFive2n1n1n1n1n)
11594   {
11595    Double_t dError = 9.*pow(f3pCorrelations->GetBinContent(1),2.)
11596                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
11597                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
11598                    + 9.*pow(f2pCorrelations->GetBinContent(1),2.)
11599                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
11600                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
11601                    + pow((pow(dSumWQuadraticFive2n1n1n1n1n,0.5)/dSumWLinearFive2n1n1n1n1n)
11602                    * dSpreadFive2n1n1n1n1n*pow(pow(dSumWLinearFive2n1n1n1n1n,2.)/(pow(dSumWLinearFive2n1n1n1n1n,2.)-dSumWQuadraticFive2n1n1n1n1n),0.5),2.)
11603                    + 9.*2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(1)
11604                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11605                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,7)) 
11606                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(1))
11607                    / (dSumWLinearTwo1n1n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11608                    - 3.*2.*f3pCorrelations->GetBinContent(1)
11609                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11610                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,87))
11611                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(32))
11612                    / (dSumWLinearTwo1n1n*dSumWLinearFive2n1n1n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11613                    - 3.*2.*f2pCorrelations->GetBinContent(1)
11614                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11615                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,87))
11616                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(32))
11617                    / (dSumWLinearThree2n1n1n*dSumWLinearFive2n1n1n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11618    if(dError>0.)
11619    {
11620     f5pCumulants->SetBinError(32,pow(dError,0.5)); 
11621    }
11622   } // end of if(...)
11623  } // end of {
11624  f5pCumulants->SetBinContent(33,f5pCorrelations->GetBinContent(33)-2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(2));
11625  { 
11626   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
11627   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
11628   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
11629   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
11630   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
11631   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
11632   Double_t dSumWLinearFive2n2n2n1n1n = 0.; // sum of linear event weights for <4>
11633   Double_t dSumWQuadraticFive2n2n2n1n1n = 0.; // sum of quadratic event weights <4>
11634   Double_t dSpreadFive2n2n2n1n1n = 0.; // weighted and biased estimator for sigma of <4>
11635   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11636   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11637   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
11638   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11639   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11640   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
11641   dSumWLinearFive2n2n2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11642   dSumWQuadraticFive2n2n2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11643   dSpreadFive2n2n2n1n1n = f5pCorrelations->GetBinError(33);
11644   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
11645      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
11646      pow(dSumWLinearFive2n2n2n1n1n,2.)>dSumWQuadraticFive2n2n2n1n1n)
11647   {
11648    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(1),2.)
11649                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
11650                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
11651                    + 4.*pow(f2pCorrelations->GetBinContent(2),2.)
11652                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
11653                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
11654                    + pow((pow(dSumWQuadraticFive2n2n2n1n1n,0.5)/dSumWLinearFive2n2n2n1n1n)
11655                    * dSpreadFive2n2n2n1n1n*pow(pow(dSumWLinearFive2n2n2n1n1n,2.)/(pow(dSumWLinearFive2n2n2n1n1n,2.)-dSumWQuadraticFive2n2n2n1n1n),0.5),2.)
11656                    + 4.*2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(2)
11657                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11658                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,7)) 
11659                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(1))
11660                    / (dSumWLinearTwo2n2n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11661                    - 2.*2.*f3pCorrelations->GetBinContent(1)
11662                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11663                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,88))
11664                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(33))
11665                    / (dSumWLinearTwo2n2n*dSumWLinearFive2n2n2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11666                    - 2.*2.*f2pCorrelations->GetBinContent(2)
11667                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11668                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,88))
11669                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(33))
11670                    / (dSumWLinearThree2n1n1n*dSumWLinearFive2n2n2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11671    if(dError>0.)
11672    {
11673     f5pCumulants->SetBinError(33,pow(dError,0.5)); 
11674    }
11675   } // end of if(...)
11676  } // end of {
11677  f5pCumulants->SetBinContent(34,f5pCorrelations->GetBinContent(34));
11678  {
11679   Double_t dSumWLinear = 0.; // sum of linear event weights
11680   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11681   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11682   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11683   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11684   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11685   dSpread = f5pCorrelations->GetBinError(34);
11686   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11687   {
11688    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11689    f5pCumulants->SetBinError(34,dError); 
11690   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11691  } 
11692  f5pCumulants->SetBinContent(35,f5pCorrelations->GetBinContent(35));
11693  {
11694   Double_t dSumWLinear = 0.; // sum of linear event weights
11695   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11696   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11697   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11698   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11699   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11700   dSpread = f5pCorrelations->GetBinError(35);
11701   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11702   {
11703    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11704    f5pCumulants->SetBinError(35,dError); 
11705   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11706  } 
11707  f5pCumulants->SetBinContent(36,f5pCorrelations->GetBinContent(36)-3.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(2));
11708  { 
11709   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
11710   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
11711   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
11712   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
11713   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
11714   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
11715   Double_t dSumWLinearFive4n2n2n2n2n = 0.; // sum of linear event weights for <4>
11716   Double_t dSumWQuadraticFive4n2n2n2n2n = 0.; // sum of quadratic event weights <4>
11717   Double_t dSpreadFive4n2n2n2n2n = 0.; // weighted and biased estimator for sigma of <4>
11718   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11719   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11720   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
11721   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11722   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11723   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
11724   dSumWLinearFive4n2n2n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11725   dSumWQuadraticFive4n2n2n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11726   dSpreadFive4n2n2n2n2n = f5pCorrelations->GetBinError(36);
11727   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
11728      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
11729      pow(dSumWLinearFive4n2n2n2n2n,2.)>dSumWQuadraticFive4n2n2n2n2n)
11730   {
11731    Double_t dError = 9.*pow(f3pCorrelations->GetBinContent(2),2.)
11732                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
11733                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
11734                    + 9.*pow(f2pCorrelations->GetBinContent(2),2.)
11735                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
11736                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
11737                    + pow((pow(dSumWQuadraticFive4n2n2n2n2n,0.5)/dSumWLinearFive4n2n2n2n2n)
11738                    * dSpreadFive4n2n2n2n2n*pow(pow(dSumWLinearFive4n2n2n2n2n,2.)/(pow(dSumWLinearFive4n2n2n2n2n,2.)-dSumWQuadraticFive4n2n2n2n2n),0.5),2.)
11739                    + 9.*2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(2)
11740                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11741                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,8)) 
11742                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(2))
11743                    / (dSumWLinearTwo2n2n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11744                    - 3.*2.*f3pCorrelations->GetBinContent(2)
11745                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11746                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,91))
11747                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(36))
11748                    / (dSumWLinearTwo2n2n*dSumWLinearFive4n2n2n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11749                    - 3.*2.*f2pCorrelations->GetBinContent(2)
11750                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11751                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,91))
11752                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(36))
11753                    / (dSumWLinearThree4n2n2n*dSumWLinearFive4n2n2n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11754    if(dError>0.)
11755    {
11756     f5pCumulants->SetBinError(36,pow(dError,0.5)); 
11757    }
11758   } // end of if(...)
11759  } // end of {
11760  f5pCumulants->SetBinContent(37,f5pCorrelations->GetBinContent(37)-2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(4)); 
11761  { 
11762   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
11763   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
11764   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
11765   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
11766   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
11767   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
11768   Double_t dSumWLinearFive4n4n4n2n2n = 0.; // sum of linear event weights for <4>
11769   Double_t dSumWQuadraticFive4n4n4n2n2n = 0.; // sum of quadratic event weights <4>
11770   Double_t dSpreadFive4n4n4n2n2n = 0.; // weighted and biased estimator for sigma of <4>
11771   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11772   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11773   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
11774   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11775   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11776   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
11777   dSumWLinearFive4n4n4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11778   dSumWQuadraticFive4n4n4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11779   dSpreadFive4n4n4n2n2n = f5pCorrelations->GetBinError(37);
11780   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
11781      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
11782      pow(dSumWLinearFive4n4n4n2n2n,2.)>dSumWQuadraticFive4n4n4n2n2n)
11783   {
11784    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(2),2.)
11785                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
11786                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
11787                    + 4.*pow(f2pCorrelations->GetBinContent(4),2.)
11788                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
11789                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
11790                    + pow((pow(dSumWQuadraticFive4n4n4n2n2n,0.5)/dSumWLinearFive4n4n4n2n2n)
11791                    * dSpreadFive4n4n4n2n2n*pow(pow(dSumWLinearFive4n4n4n2n2n,2.)/(pow(dSumWLinearFive4n4n4n2n2n,2.)-dSumWQuadraticFive4n4n4n2n2n),0.5),2.)
11792                    + 4.*2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(4)
11793                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11794                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,8)) 
11795                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(2))
11796                    / (dSumWLinearTwo4n4n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11797                    - 2.*2.*f3pCorrelations->GetBinContent(2)
11798                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11799                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,92))
11800                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(37))
11801                    / (dSumWLinearTwo4n4n*dSumWLinearFive4n4n4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11802                    - 2.*2.*f2pCorrelations->GetBinContent(4)
11803                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11804                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,92))
11805                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(37))
11806                    / (dSumWLinearThree4n2n2n*dSumWLinearFive4n4n4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11807    if(dError>0.)
11808    {
11809     f5pCumulants->SetBinError(37,pow(dError,0.5)); 
11810    }
11811   } // end of if(...)
11812  } // end of {
11813  f5pCumulants->SetBinContent(38,f5pCorrelations->GetBinContent(38)-3.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(3)); 
11814  { 
11815   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
11816   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
11817   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
11818   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
11819   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
11820   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
11821   Double_t dSumWLinearFive6n3n3n3n3n = 0.; // sum of linear event weights for <4>
11822   Double_t dSumWQuadraticFive6n3n3n3n3n = 0.; // sum of quadratic event weights <4>
11823   Double_t dSpreadFive6n3n3n3n3n = 0.; // weighted and biased estimator for sigma of <4>
11824   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11825   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11826   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
11827   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11828   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11829   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
11830   dSumWLinearFive6n3n3n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11831   dSumWQuadraticFive6n3n3n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11832   dSpreadFive6n3n3n3n3n = f5pCorrelations->GetBinError(38);
11833   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
11834      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
11835      pow(dSumWLinearFive6n3n3n3n3n,2.)>dSumWQuadraticFive6n3n3n3n3n)
11836   {
11837    Double_t dError = 9.*pow(f3pCorrelations->GetBinContent(3),2.)
11838                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
11839                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
11840                    + 9.*pow(f2pCorrelations->GetBinContent(3),2.)
11841                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
11842                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
11843                    + pow((pow(dSumWQuadraticFive6n3n3n3n3n,0.5)/dSumWLinearFive6n3n3n3n3n)
11844                    * dSpreadFive6n3n3n3n3n*pow(pow(dSumWLinearFive6n3n3n3n3n,2.)/(pow(dSumWLinearFive6n3n3n3n3n,2.)-dSumWQuadraticFive6n3n3n3n3n),0.5),2.)
11845                    + 9.*2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(3)
11846                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11847                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,9)) 
11848                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(3))
11849                    / (dSumWLinearTwo3n3n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11850                    - 3.*2.*f3pCorrelations->GetBinContent(3)
11851                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11852                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,93))
11853                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(38))
11854                    / (dSumWLinearTwo3n3n*dSumWLinearFive6n3n3n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11855                    - 3.*2.*f2pCorrelations->GetBinContent(3)
11856                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11857                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,93))
11858                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(38))
11859                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n3n3n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11860    if(dError>0.)
11861    {
11862     f5pCumulants->SetBinError(38,pow(dError,0.5)); 
11863    }
11864   } // end of if(...)
11865  } // end of {
11866  f5pCumulants->SetBinContent(39,f5pCorrelations->GetBinContent(39));
11867  {
11868   Double_t dSumWLinear = 0.; // sum of linear event weights
11869   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11870   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11871   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11872   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11873   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11874   dSpread = f5pCorrelations->GetBinError(39);
11875   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11876   {
11877    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11878    f5pCumulants->SetBinError(39,dError); 
11879   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11880  } 
11881  f5pCumulants->SetBinContent(40,f5pCorrelations->GetBinContent(40)-2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(6)); 
11882  { 
11883   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11884   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11885   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11886   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
11887   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
11888   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
11889   Double_t dSumWLinearFive6n6n6n3n3n = 0.; // sum of linear event weights for <4>
11890   Double_t dSumWQuadraticFive6n6n6n3n3n = 0.; // sum of quadratic event weights <4>
11891   Double_t dSpreadFive6n6n6n3n3n = 0.; // weighted and biased estimator for sigma of <4>
11892   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11893   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11894   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11895   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11896   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11897   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
11898   dSumWLinearFive6n6n6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11899   dSumWQuadraticFive6n6n6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11900   dSpreadFive6n6n6n3n3n = f5pCorrelations->GetBinError(40);
11901   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11902      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
11903      pow(dSumWLinearFive6n6n6n3n3n,2.)>dSumWQuadraticFive6n6n6n3n3n)
11904   {
11905    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(3),2.)
11906                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11907                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11908                    + 4.*pow(f2pCorrelations->GetBinContent(6),2.)
11909                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
11910                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
11911                    + pow((pow(dSumWQuadraticFive6n6n6n3n3n,0.5)/dSumWLinearFive6n6n6n3n3n)
11912                    * dSpreadFive6n6n6n3n3n*pow(pow(dSumWLinearFive6n6n6n3n3n,2.)/(pow(dSumWLinearFive6n6n6n3n3n,2.)-dSumWQuadraticFive6n6n6n3n3n),0.5),2.)
11913                    + 4.*2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(6)
11914                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11915                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,9)) 
11916                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(3))
11917                    / (dSumWLinearTwo6n6n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11918                    - 2.*2.*f3pCorrelations->GetBinContent(3)
11919                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11920                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,95))
11921                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(40))
11922                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n6n6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11923                    - 2.*2.*f2pCorrelations->GetBinContent(6)
11924                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11925                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,95))
11926                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(40))
11927                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n6n6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11928    if(dError>0.)
11929    {
11930     f5pCumulants->SetBinError(40,pow(dError,0.5)); 
11931    }
11932   } // end of if(...)
11933  } // end of {
11934
11935  // d2) "Three distinct harmonics":
11936  f5pCumulants->SetBinContent(42,f5pCorrelations->GetBinContent(42)-2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(1)); 
11937  { 
11938   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
11939   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
11940   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
11941   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
11942   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
11943   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
11944   Double_t dSumWLinearFive3n1n2n1n1n = 0.; // sum of linear event weights for <4>
11945   Double_t dSumWQuadraticFive3n1n2n1n1n = 0.; // sum of quadratic event weights <4>
11946   Double_t dSpreadFive3n1n2n1n1n = 0.; // weighted and biased estimator for sigma of <4>
11947   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11948   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11949   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
11950   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11951   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11952   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
11953   dSumWLinearFive3n1n2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11954   dSumWQuadraticFive3n1n2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11955   dSpreadFive3n1n2n1n1n = f5pCorrelations->GetBinError(42);
11956   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
11957      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
11958      pow(dSumWLinearFive3n1n2n1n1n,2.)>dSumWQuadraticFive3n1n2n1n1n)
11959   {
11960    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(5),2.)
11961                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
11962                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
11963                    + 4.*pow(f2pCorrelations->GetBinContent(1),2.)
11964                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
11965                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
11966                    + pow((pow(dSumWQuadraticFive3n1n2n1n1n,0.5)/dSumWLinearFive3n1n2n1n1n)
11967                    * dSpreadFive3n1n2n1n1n*pow(pow(dSumWLinearFive3n1n2n1n1n,2.)/(pow(dSumWLinearFive3n1n2n1n1n,2.)-dSumWQuadraticFive3n1n2n1n1n),0.5),2.)
11968                    + 4.*2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(1)
11969                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11970                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,10)) 
11971                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(5))
11972                    / (dSumWLinearTwo1n1n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11973                    - 2.*2.*f3pCorrelations->GetBinContent(5)
11974                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11975                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,96))
11976                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(42))
11977                    / (dSumWLinearTwo1n1n*dSumWLinearFive3n1n2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11978                    - 2.*2.*f2pCorrelations->GetBinContent(1)
11979                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11980                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,96))
11981                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(42))
11982                    / (dSumWLinearThree3n2n1n*dSumWLinearFive3n1n2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11983    if(dError>0.)
11984    {
11985     f5pCumulants->SetBinError(42,pow(dError,0.5)); 
11986    }
11987   } // end of if(...)
11988  } // end of {
11989  f5pCumulants->SetBinContent(43,f5pCorrelations->GetBinContent(43)-2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(2)); 
11990  { 
11991   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
11992   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
11993   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
11994   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
11995   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
11996   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
11997   Double_t dSumWLinearFive3n2n2n2n1n = 0.; // sum of linear event weights for <4>
11998   Double_t dSumWQuadraticFive3n2n2n2n1n = 0.; // sum of quadratic event weights <4>
11999   Double_t dSpreadFive3n2n2n2n1n = 0.; // weighted and biased estimator for sigma of <4>
12000   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12001   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12002   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
12003   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12004   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12005   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
12006   dSumWLinearFive3n2n2n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12007   dSumWQuadraticFive3n2n2n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12008   dSpreadFive3n2n2n2n1n = f5pCorrelations->GetBinError(43);
12009   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
12010      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
12011      pow(dSumWLinearFive3n2n2n2n1n,2.)>dSumWQuadraticFive3n2n2n2n1n)
12012   {
12013    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(5),2.)
12014                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
12015                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
12016                    + 4.*pow(f2pCorrelations->GetBinContent(2),2.)
12017                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
12018                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
12019                    + pow((pow(dSumWQuadraticFive3n2n2n2n1n,0.5)/dSumWLinearFive3n2n2n2n1n)
12020                    * dSpreadFive3n2n2n2n1n*pow(pow(dSumWLinearFive3n2n2n2n1n,2.)/(pow(dSumWLinearFive3n2n2n2n1n,2.)-dSumWQuadraticFive3n2n2n2n1n),0.5),2.)
12021                    + 4.*2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(2)
12022                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12023                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,10)) 
12024                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(5))
12025                    / (dSumWLinearTwo2n2n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12026                    - 2.*2.*f3pCorrelations->GetBinContent(5)
12027                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12028                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,97))
12029                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(43))
12030                    / (dSumWLinearTwo2n2n*dSumWLinearFive3n2n2n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12031                    - 2.*2.*f2pCorrelations->GetBinContent(2)
12032                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12033                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,97))
12034                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(43))
12035                    / (dSumWLinearThree3n2n1n*dSumWLinearFive3n2n2n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12036    if(dError>0.)
12037    {
12038     f5pCumulants->SetBinError(43,pow(dError,0.5)); 
12039    }
12040   } // end of if(...)
12041  } // end of {
12042  f5pCumulants->SetBinContent(44,f5pCorrelations->GetBinContent(44)-2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(3)); 
12043  { 
12044   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
12045   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
12046   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
12047   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
12048   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
12049   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
12050   Double_t dSumWLinearFive3n3n3n2n1n = 0.; // sum of linear event weights for <4>
12051   Double_t dSumWQuadraticFive3n3n3n2n1n = 0.; // sum of quadratic event weights <4>
12052   Double_t dSpreadFive3n3n3n2n1n = 0.; // weighted and biased estimator for sigma of <4>
12053   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12054   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12055   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
12056   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12057   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12058   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
12059   dSumWLinearFive3n3n3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12060   dSumWQuadraticFive3n3n3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12061   dSpreadFive3n3n3n2n1n = f5pCorrelations->GetBinError(44);
12062   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
12063      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
12064      pow(dSumWLinearFive3n3n3n2n1n,2.)>dSumWQuadraticFive3n3n3n2n1n)
12065   {
12066    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(5),2.)
12067                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
12068                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
12069                    + 4.*pow(f2pCorrelations->GetBinContent(3),2.)
12070                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
12071                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
12072                    + pow((pow(dSumWQuadraticFive3n3n3n2n1n,0.5)/dSumWLinearFive3n3n3n2n1n)
12073                    * dSpreadFive3n3n3n2n1n*pow(pow(dSumWLinearFive3n3n3n2n1n,2.)/(pow(dSumWLinearFive3n3n3n2n1n,2.)-dSumWQuadraticFive3n3n3n2n1n),0.5),2.)
12074                    + 4.*2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(3)
12075                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12076                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,10)) 
12077                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(5))
12078                    / (dSumWLinearTwo3n3n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12079                    - 2.*2.*f3pCorrelations->GetBinContent(5)
12080                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12081                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,98))
12082                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(44))
12083                    / (dSumWLinearTwo3n3n*dSumWLinearFive3n3n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12084                    - 2.*2.*f2pCorrelations->GetBinContent(3)
12085                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12086                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,98))
12087                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(44))
12088                    / (dSumWLinearThree3n2n1n*dSumWLinearFive3n3n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12089    if(dError>0.)
12090    {
12091     f5pCumulants->SetBinError(44,pow(dError,0.5)); 
12092    }
12093   } // end of if(...)
12094  } // end of {
12095  f5pCumulants->SetBinContent(45,f5pCorrelations->GetBinContent(45)-2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(1)); 
12096  { 
12097   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
12098   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
12099   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
12100   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
12101   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
12102   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
12103   Double_t dSumWLinearFive4n1n3n1n1n = 0.; // sum of linear event weights for <4>
12104   Double_t dSumWQuadraticFive4n1n3n1n1n = 0.; // sum of quadratic event weights <4>
12105   Double_t dSpreadFive4n1n3n1n1n = 0.; // weighted and biased estimator for sigma of <4>
12106   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12107   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12108   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
12109   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12110   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12111   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
12112   dSumWLinearFive4n1n3n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12113   dSumWQuadraticFive4n1n3n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12114   dSpreadFive4n1n3n1n1n = f5pCorrelations->GetBinError(45);
12115   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
12116      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
12117      pow(dSumWLinearFive4n1n3n1n1n,2.)>dSumWQuadraticFive4n1n3n1n1n)
12118   {
12119    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(6),2.)
12120                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
12121                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
12122                    + 4.*pow(f2pCorrelations->GetBinContent(1),2.)
12123                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
12124                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
12125                    + pow((pow(dSumWQuadraticFive4n1n3n1n1n,0.5)/dSumWLinearFive4n1n3n1n1n)
12126                    * dSpreadFive4n1n3n1n1n*pow(pow(dSumWLinearFive4n1n3n1n1n,2.)/(pow(dSumWLinearFive4n1n3n1n1n,2.)-dSumWQuadraticFive4n1n3n1n1n),0.5),2.)
12127                    + 4.*2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(1)
12128                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12129                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,11)) 
12130                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(6))
12131                    / (dSumWLinearTwo1n1n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12132                    - 2.*2.*f3pCorrelations->GetBinContent(6)
12133                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12134                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,99))
12135                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(45))
12136                    / (dSumWLinearTwo1n1n*dSumWLinearFive4n1n3n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12137                    - 2.*2.*f2pCorrelations->GetBinContent(1)
12138                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12139                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,99))
12140                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(45))
12141                    / (dSumWLinearThree4n3n1n*dSumWLinearFive4n1n3n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12142    if(dError>0.)
12143    {
12144     f5pCumulants->SetBinError(45,pow(dError,0.5)); 
12145    }
12146   } // end of if(...)
12147  } // end of {
12148  f5pCumulants->SetBinContent(46,f5pCorrelations->GetBinContent(46));
12149  {
12150   Double_t dSumWLinear = 0.; // sum of linear event weights
12151   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12152   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12153   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12154   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12155   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12156   dSpread = f5pCorrelations->GetBinError(46);
12157   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12158   {
12159    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12160    f5pCumulants->SetBinError(46,dError); 
12161   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12162  } 
12163  f5pCumulants->SetBinContent(47,f5pCorrelations->GetBinContent(47)-2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(3)); 
12164  { 
12165   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
12166   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
12167   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
12168   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
12169   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
12170   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
12171   Double_t dSumWLinearFive4n3n3n3n1n = 0.; // sum of linear event weights for <4>
12172   Double_t dSumWQuadraticFive4n3n3n3n1n = 0.; // sum of quadratic event weights <4>
12173   Double_t dSpreadFive4n3n3n3n1n = 0.; // weighted and biased estimator for sigma of <4>
12174   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12175   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12176   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
12177   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12178   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12179   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
12180   dSumWLinearFive4n3n3n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12181   dSumWQuadraticFive4n3n3n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12182   dSpreadFive4n3n3n3n1n = f5pCorrelations->GetBinError(47);
12183   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
12184      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
12185      pow(dSumWLinearFive4n3n3n3n1n,2.)>dSumWQuadraticFive4n3n3n3n1n)
12186   {
12187    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(6),2.)
12188                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
12189                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
12190                    + 4.*pow(f2pCorrelations->GetBinContent(3),2.)
12191                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
12192                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
12193                    + pow((pow(dSumWQuadraticFive4n3n3n3n1n,0.5)/dSumWLinearFive4n3n3n3n1n)
12194                    * dSpreadFive4n3n3n3n1n*pow(pow(dSumWLinearFive4n3n3n3n1n,2.)/(pow(dSumWLinearFive4n3n3n3n1n,2.)-dSumWQuadraticFive4n3n3n3n1n),0.5),2.)
12195                    + 4.*2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(3)
12196                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12197                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,11)) 
12198                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(6))
12199                    / (dSumWLinearTwo3n3n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12200                    - 2.*2.*f3pCorrelations->GetBinContent(6)
12201                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12202                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,101))
12203                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(47))
12204                    / (dSumWLinearTwo3n3n*dSumWLinearFive4n3n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12205                    - 2.*2.*f2pCorrelations->GetBinContent(3)
12206                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12207                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,101))
12208                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(47))
12209                    / (dSumWLinearThree4n3n1n*dSumWLinearFive4n3n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12210    if(dError>0.)
12211    {
12212     f5pCumulants->SetBinError(47,pow(dError,0.5)); 
12213    }
12214   } // end of if(...)
12215  } // end of {
12216  f5pCumulants->SetBinContent(48,f5pCorrelations->GetBinContent(48));
12217  {
12218   Double_t dSumWLinear = 0.; // sum of linear event weights
12219   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12220   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12221   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12222   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12223   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12224   dSpread = f5pCorrelations->GetBinError(48);
12225   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12226   {
12227    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12228    f5pCumulants->SetBinError(48,dError); 
12229   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12230  } 
12231  f5pCumulants->SetBinContent(49,f5pCorrelations->GetBinContent(49)-2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(4));  
12232  { 
12233   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
12234   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
12235   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
12236   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
12237   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
12238   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
12239   Double_t dSumWLinearFive4n3n3n3n1n = 0.; // sum of linear event weights for <4>
12240   Double_t dSumWQuadraticFive4n3n3n3n1n = 0.; // sum of quadratic event weights <4>
12241   Double_t dSpreadFive4n3n3n3n1n = 0.; // weighted and biased estimator for sigma of <4>
12242   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12243   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12244   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
12245   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12246   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12247   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
12248   dSumWLinearFive4n3n3n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12249   dSumWQuadraticFive4n3n3n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12250   dSpreadFive4n3n3n3n1n = f5pCorrelations->GetBinError(49);
12251   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
12252      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
12253      pow(dSumWLinearFive4n3n3n3n1n,2.)>dSumWQuadraticFive4n3n3n3n1n)
12254   {
12255    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(6),2.)
12256                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
12257                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
12258                    + 4.*pow(f2pCorrelations->GetBinContent(4),2.)
12259                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
12260                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
12261                    + pow((pow(dSumWQuadraticFive4n3n3n3n1n,0.5)/dSumWLinearFive4n3n3n3n1n)
12262                    * dSpreadFive4n3n3n3n1n*pow(pow(dSumWLinearFive4n3n3n3n1n,2.)/(pow(dSumWLinearFive4n3n3n3n1n,2.)-dSumWQuadraticFive4n3n3n3n1n),0.5),2.)
12263                    + 4.*2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(4)
12264                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12265                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,11)) 
12266                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(6))
12267                    / (dSumWLinearTwo4n4n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12268                    - 2.*2.*f3pCorrelations->GetBinContent(6)
12269                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12270                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,103))
12271                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(49))
12272                    / (dSumWLinearTwo4n4n*dSumWLinearFive4n3n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12273                    - 2.*2.*f2pCorrelations->GetBinContent(4)
12274                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12275                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,103))
12276                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(49))
12277                    / (dSumWLinearThree4n3n1n*dSumWLinearFive4n3n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12278    if(dError>0.)
12279    {
12280     f5pCumulants->SetBinError(49,pow(dError,0.5)); 
12281    }
12282   } // end of if(...)
12283  } // end of {
12284  f5pCumulants->SetBinContent(50,f5pCorrelations->GetBinContent(50));
12285  {
12286   Double_t dSumWLinear = 0.; // sum of linear event weights
12287   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12288   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12289   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12290   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12291   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12292   dSpread = f5pCorrelations->GetBinError(50);
12293   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12294   {
12295    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12296    f5pCumulants->SetBinError(50,dError); 
12297   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12298  } 
12299  f5pCumulants->SetBinContent(51,f5pCorrelations->GetBinContent(51));
12300  {
12301   Double_t dSumWLinear = 0.; // sum of linear event weights
12302   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12303   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12304   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12305   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12306   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12307   dSpread = f5pCorrelations->GetBinError(51);
12308   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12309   {
12310    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12311    f5pCumulants->SetBinError(51,dError); 
12312   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12313  } 
12314  f5pCumulants->SetBinContent(52,f5pCorrelations->GetBinContent(52)-2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(2));  
12315  { 
12316   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
12317   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
12318   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
12319   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
12320   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
12321   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
12322   Double_t dSumWLinearFive5n2n3n2n2n = 0.; // sum of linear event weights for <4>
12323   Double_t dSumWQuadraticFive5n2n3n2n2n = 0.; // sum of quadratic event weights <4>
12324   Double_t dSpreadFive5n2n3n2n2n = 0.; // weighted and biased estimator for sigma of <4>
12325   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12326   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12327   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
12328   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12329   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12330   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
12331   dSumWLinearFive5n2n3n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12332   dSumWQuadraticFive5n2n3n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12333   dSpreadFive5n2n3n2n2n = f5pCorrelations->GetBinError(52);
12334   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
12335      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
12336      pow(dSumWLinearFive5n2n3n2n2n,2.)>dSumWQuadraticFive5n2n3n2n2n)
12337   {
12338    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(7),2.)
12339                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
12340                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
12341                    + 4.*pow(f2pCorrelations->GetBinContent(2),2.)
12342                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
12343                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
12344                    + pow((pow(dSumWQuadraticFive5n2n3n2n2n,0.5)/dSumWLinearFive5n2n3n2n2n)
12345                    * dSpreadFive5n2n3n2n2n*pow(pow(dSumWLinearFive5n2n3n2n2n,2.)/(pow(dSumWLinearFive5n2n3n2n2n,2.)-dSumWQuadraticFive5n2n3n2n2n),0.5),2.)
12346                    + 4.*2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(2)
12347                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12348                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,12)) 
12349                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(7))
12350                    / (dSumWLinearTwo2n2n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12351                    - 2.*2.*f3pCorrelations->GetBinContent(7)
12352                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12353                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,106))
12354                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(52))
12355                    / (dSumWLinearTwo2n2n*dSumWLinearFive5n2n3n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12356                    - 2.*2.*f2pCorrelations->GetBinContent(2)
12357                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12358                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,106))
12359                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(52))
12360                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n2n3n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12361    if(dError>0.)
12362    {
12363     f5pCumulants->SetBinError(52,pow(dError,0.5)); 
12364    }
12365   } // end of if(...)
12366  } // end of {
12367  f5pCumulants->SetBinContent(53,f5pCorrelations->GetBinContent(53)-2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(3));  
12368  { 
12369   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
12370   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
12371   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
12372   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
12373   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
12374   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
12375   Double_t dSumWLinearFive5n3n3n3n2n = 0.; // sum of linear event weights for <4>
12376   Double_t dSumWQuadraticFive5n3n3n3n2n = 0.; // sum of quadratic event weights <4>
12377   Double_t dSpreadFive5n3n3n3n2n = 0.; // weighted and biased estimator for sigma of <4>
12378   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12379   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12380   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
12381   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12382   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12383   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
12384   dSumWLinearFive5n3n3n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12385   dSumWQuadraticFive5n3n3n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12386   dSpreadFive5n3n3n3n2n = f5pCorrelations->GetBinError(53);
12387   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
12388      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
12389      pow(dSumWLinearFive5n3n3n3n2n,2.)>dSumWQuadraticFive5n3n3n3n2n)
12390   {
12391    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(7),2.)
12392                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
12393                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
12394                    + 4.*pow(f2pCorrelations->GetBinContent(3),2.)
12395                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
12396                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
12397                    + pow((pow(dSumWQuadraticFive5n3n3n3n2n,0.5)/dSumWLinearFive5n3n3n3n2n)
12398                    * dSpreadFive5n3n3n3n2n*pow(pow(dSumWLinearFive5n3n3n3n2n,2.)/(pow(dSumWLinearFive5n3n3n3n2n,2.)-dSumWQuadraticFive5n3n3n3n2n),0.5),2.)
12399                    + 4.*2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(3)
12400                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12401                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,12)) 
12402                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(7))
12403                    / (dSumWLinearTwo3n3n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12404                    - 2.*2.*f3pCorrelations->GetBinContent(7)
12405                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12406                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,107))
12407                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(53))
12408                    / (dSumWLinearTwo3n3n*dSumWLinearFive5n3n3n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12409                    - 2.*2.*f2pCorrelations->GetBinContent(3)
12410                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12411                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,107))
12412                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(53))
12413                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n3n3n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12414    if(dError>0.)
12415    {
12416     f5pCumulants->SetBinError(53,pow(dError,0.5)); 
12417    }
12418   } // end of if(...)
12419  } // end of {
12420  f5pCumulants->SetBinContent(54,f5pCorrelations->GetBinContent(54)-2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(1)); 
12421  { 
12422   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
12423   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
12424   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
12425   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
12426   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
12427   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
12428   Double_t dSumWLinearFive5n1n4n1n1n = 0.; // sum of linear event weights for <4>
12429   Double_t dSumWQuadraticFive5n1n4n1n1n = 0.; // sum of quadratic event weights <4>
12430   Double_t dSpreadFive5n1n4n1n1n = 0.; // weighted and biased estimator for sigma of <4>
12431   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12432   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12433   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
12434   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12435   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12436   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
12437   dSumWLinearFive5n1n4n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12438   dSumWQuadraticFive5n1n4n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12439   dSpreadFive5n1n4n1n1n = f5pCorrelations->GetBinError(54);
12440   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
12441      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
12442      pow(dSumWLinearFive5n1n4n1n1n,2.)>dSumWQuadraticFive5n1n4n1n1n)
12443   {
12444    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(8),2.)
12445                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
12446                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
12447                    + 4.*pow(f2pCorrelations->GetBinContent(1),2.)
12448                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
12449                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
12450                    + pow((pow(dSumWQuadraticFive5n1n4n1n1n,0.5)/dSumWLinearFive5n1n4n1n1n)
12451                    * dSpreadFive5n1n4n1n1n*pow(pow(dSumWLinearFive5n1n4n1n1n,2.)/(pow(dSumWLinearFive5n1n4n1n1n,2.)-dSumWQuadraticFive5n1n4n1n1n),0.5),2.)
12452                    + 4.*2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(1)
12453                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12454                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,13)) 
12455                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(8))
12456                    / (dSumWLinearTwo1n1n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12457                    - 2.*2.*f3pCorrelations->GetBinContent(8)
12458                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12459                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,108))
12460                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(54))
12461                    / (dSumWLinearTwo1n1n*dSumWLinearFive5n1n4n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12462                    - 2.*2.*f2pCorrelations->GetBinContent(1)
12463                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12464                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,108))
12465                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(54))
12466                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n1n4n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12467    if(dError>0.)
12468    {
12469     f5pCumulants->SetBinError(54,pow(dError,0.5)); 
12470    }
12471   } // end of if(...)
12472  } // end of {
12473
12474  f5pCumulants->SetBinContent(55,f5pCorrelations->GetBinContent(55));
12475  {
12476   Double_t dSumWLinear = 0.; // sum of linear event weights
12477   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12478   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12479   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12480   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12481   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12482   dSpread = f5pCorrelations->GetBinError(55);
12483   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12484   {
12485    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12486    f5pCumulants->SetBinError(55,dError); 
12487   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12488  } 
12489  f5pCumulants->SetBinContent(56,f5pCorrelations->GetBinContent(56)-2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(4));
12490  { 
12491   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
12492   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
12493   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
12494   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
12495   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
12496   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
12497   Double_t dSumWLinearFive5n4n4n4n1n = 0.; // sum of linear event weights for <4>
12498   Double_t dSumWQuadraticFive5n4n4n4n1n = 0.; // sum of quadratic event weights <4>
12499   Double_t dSpreadFive5n4n4n4n1n = 0.; // weighted and biased estimator for sigma of <4>
12500   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12501   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12502   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
12503   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12504   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12505   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
12506   dSumWLinearFive5n4n4n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12507   dSumWQuadraticFive5n4n4n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12508   dSpreadFive5n4n4n4n1n = f5pCorrelations->GetBinError(56);
12509   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
12510      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
12511      pow(dSumWLinearFive5n4n4n4n1n,2.)>dSumWQuadraticFive5n4n4n4n1n)
12512   {
12513    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(8),2.)
12514                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
12515                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
12516                    + 4.*pow(f2pCorrelations->GetBinContent(4),2.)
12517                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
12518                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
12519                    + pow((pow(dSumWQuadraticFive5n4n4n4n1n,0.5)/dSumWLinearFive5n4n4n4n1n)
12520                    * dSpreadFive5n4n4n4n1n*pow(pow(dSumWLinearFive5n4n4n4n1n,2.)/(pow(dSumWLinearFive5n4n4n4n1n,2.)-dSumWQuadraticFive5n4n4n4n1n),0.5),2.)
12521                    + 4.*2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(4)
12522                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12523                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,13)) 
12524                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(8))
12525                    / (dSumWLinearTwo4n4n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12526                    - 2.*2.*f3pCorrelations->GetBinContent(8)
12527                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12528                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,110))
12529                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(56))
12530                    / (dSumWLinearTwo4n4n*dSumWLinearFive5n4n4n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12531                    - 2.*2.*f2pCorrelations->GetBinContent(4)
12532                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12533                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,110))
12534                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(56))
12535                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n4n4n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12536    if(dError>0.)
12537    {
12538     f5pCumulants->SetBinError(56,pow(dError,0.5)); 
12539    }
12540   } // end of if(...)
12541  } // end of {
12542  f5pCumulants->SetBinContent(57,f5pCorrelations->GetBinContent(57));
12543  {
12544   Double_t dSumWLinear = 0.; // sum of linear event weights
12545   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12546   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12547   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12548   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12549   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12550   dSpread = f5pCorrelations->GetBinError(57);
12551   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12552   {
12553    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12554    f5pCumulants->SetBinError(57,dError); 
12555   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12556  } 
12557  f5pCumulants->SetBinContent(58,f5pCorrelations->GetBinContent(58));
12558  {
12559   Double_t dSumWLinear = 0.; // sum of linear event weights
12560   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12561   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12562   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12563   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12564   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12565   dSpread = f5pCorrelations->GetBinError(58);
12566   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12567   {
12568    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12569    f5pCumulants->SetBinError(58,dError); 
12570   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12571  } 
12572  f5pCumulants->SetBinContent(59,f5pCorrelations->GetBinContent(59)-2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(5));  
12573  { 
12574   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
12575   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
12576   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
12577   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
12578   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
12579   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
12580   Double_t dSumWLinearFive5n5n5n3n2n = 0.; // sum of linear event weights for <4>
12581   Double_t dSumWQuadraticFive5n5n5n3n2n = 0.; // sum of quadratic event weights <4>
12582   Double_t dSpreadFive5n5n5n3n2n = 0.; // weighted and biased estimator for sigma of <4>
12583   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12584   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12585   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
12586   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12587   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12588   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
12589   dSumWLinearFive5n5n5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12590   dSumWQuadraticFive5n5n5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12591   dSpreadFive5n5n5n3n2n = f5pCorrelations->GetBinError(59);
12592   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
12593      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
12594      pow(dSumWLinearFive5n5n5n3n2n,2.)>dSumWQuadraticFive5n5n5n3n2n)
12595   {
12596    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(7),2.)
12597                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
12598                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
12599                    + 4.*pow(f2pCorrelations->GetBinContent(5),2.)
12600                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
12601                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
12602                    + pow((pow(dSumWQuadraticFive5n5n5n3n2n,0.5)/dSumWLinearFive5n5n5n3n2n)
12603                    * dSpreadFive5n5n5n3n2n*pow(pow(dSumWLinearFive5n5n5n3n2n,2.)/(pow(dSumWLinearFive5n5n5n3n2n,2.)-dSumWQuadraticFive5n5n5n3n2n),0.5),2.)
12604                    + 4.*2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(5)
12605                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12606                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,12)) 
12607                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(7))
12608                    / (dSumWLinearTwo5n5n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12609                    - 2.*2.*f3pCorrelations->GetBinContent(7)
12610                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12611                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,113))
12612                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(59))
12613                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n5n5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12614                    - 2.*2.*f2pCorrelations->GetBinContent(5)
12615                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12616                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,113))
12617                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(59))
12618                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n5n5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12619    if(dError>0.)
12620    {
12621     f5pCumulants->SetBinError(59,pow(dError,0.5)); 
12622    }
12623   } // end of if(...)
12624  } // end of {
12625  f5pCumulants->SetBinContent(60,f5pCorrelations->GetBinContent(60)-2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(5));  
12626  { 
12627   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
12628   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
12629   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
12630   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
12631   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
12632   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
12633   Double_t dSumWLinearFive5n5n5n4n1n = 0.; // sum of linear event weights for <4>
12634   Double_t dSumWQuadraticFive5n5n5n4n1n = 0.; // sum of quadratic event weights <4>
12635   Double_t dSpreadFive5n5n5n4n1n = 0.; // weighted and biased estimator for sigma of <4>
12636   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12637   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12638   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
12639   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12640   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12641   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
12642   dSumWLinearFive5n5n5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12643   dSumWQuadraticFive5n5n5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12644   dSpreadFive5n5n5n4n1n = f5pCorrelations->GetBinError(60);
12645   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
12646      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
12647      pow(dSumWLinearFive5n5n5n4n1n,2.)>dSumWQuadraticFive5n5n5n4n1n)
12648   {
12649    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(8),2.)
12650                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
12651                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
12652                    + 4.*pow(f2pCorrelations->GetBinContent(5),2.)
12653                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
12654                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
12655                    + pow((pow(dSumWQuadraticFive5n5n5n4n1n,0.5)/dSumWLinearFive5n5n5n4n1n)
12656                    * dSpreadFive5n5n5n4n1n*pow(pow(dSumWLinearFive5n5n5n4n1n,2.)/(pow(dSumWLinearFive5n5n5n4n1n,2.)-dSumWQuadraticFive5n5n5n4n1n),0.5),2.)
12657                    + 4.*2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(5)
12658                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12659                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,13)) 
12660                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(8))
12661                    / (dSumWLinearTwo5n5n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12662                    - 2.*2.*f3pCorrelations->GetBinContent(8)
12663                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12664                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,114))
12665                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(60))
12666                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n5n5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12667                    - 2.*2.*f2pCorrelations->GetBinContent(5)
12668                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12669                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,114))
12670                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(60))
12671                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n5n5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12672    if(dError>0.)
12673    {
12674     f5pCumulants->SetBinError(60,pow(dError,0.5)); 
12675    }
12676   } // end of if(...)
12677  } // end of {
12678  f5pCumulants->SetBinContent(61,f5pCorrelations->GetBinContent(61));
12679  {
12680   Double_t dSumWLinear = 0.; // sum of linear event weights
12681   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12682   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12683   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12684   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12685   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12686   dSpread = f5pCorrelations->GetBinError(61);
12687   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12688   {
12689    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12690    f5pCumulants->SetBinError(61,dError); 
12691   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12692  } 
12693  f5pCumulants->SetBinContent(62,f5pCorrelations->GetBinContent(62));
12694  {
12695   Double_t dSumWLinear = 0.; // sum of linear event weights
12696   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12697   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12698   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12699   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12700   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12701   dSpread = f5pCorrelations->GetBinError(62);
12702   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12703   {
12704    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12705    f5pCumulants->SetBinError(62,dError); 
12706   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12707  } 
12708  f5pCumulants->SetBinContent(63,f5pCorrelations->GetBinContent(63));
12709  {
12710   Double_t dSumWLinear = 0.; // sum of linear event weights
12711   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12712   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12713   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12714   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12715   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12716   dSpread = f5pCorrelations->GetBinError(63);
12717   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12718   {
12719    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12720    f5pCumulants->SetBinError(63,dError); 
12721   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12722  } 
12723  f5pCumulants->SetBinContent(64,f5pCorrelations->GetBinContent(64)-2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(1));  
12724  { 
12725   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
12726   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
12727   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
12728   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
12729   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
12730   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
12731   Double_t dSumWLinearFive6n1n5n1n1n = 0.; // sum of linear event weights for <4>
12732   Double_t dSumWQuadraticFive6n1n5n1n1n = 0.; // sum of quadratic event weights <4>
12733   Double_t dSpreadFive6n1n5n1n1n = 0.; // weighted and biased estimator for sigma of <4>
12734   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12735   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12736   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
12737   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12738   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12739   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
12740   dSumWLinearFive6n1n5n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12741   dSumWQuadraticFive6n1n5n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12742   dSpreadFive6n1n5n1n1n = f5pCorrelations->GetBinError(64);
12743   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
12744      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
12745      pow(dSumWLinearFive6n1n5n1n1n,2.)>dSumWQuadraticFive6n1n5n1n1n)
12746   {
12747    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(10),2.)
12748                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
12749                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
12750                    + 4.*pow(f2pCorrelations->GetBinContent(1),2.)
12751                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
12752                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
12753                    + pow((pow(dSumWQuadraticFive6n1n5n1n1n,0.5)/dSumWLinearFive6n1n5n1n1n)
12754                    * dSpreadFive6n1n5n1n1n*pow(pow(dSumWLinearFive6n1n5n1n1n,2.)/(pow(dSumWLinearFive6n1n5n1n1n,2.)-dSumWQuadraticFive6n1n5n1n1n),0.5),2.)
12755                    + 4.*2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(1)
12756                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12757                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,15)) 
12758                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(10))
12759                    / (dSumWLinearTwo1n1n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12760                    - 2.*2.*f3pCorrelations->GetBinContent(10)
12761                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12762                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,118))
12763                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(64))
12764                    / (dSumWLinearTwo1n1n*dSumWLinearFive6n1n5n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12765                    - 2.*2.*f2pCorrelations->GetBinContent(1)
12766                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12767                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,118))
12768                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(64))
12769                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n1n5n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12770    if(dError>0.)
12771    {
12772     f5pCumulants->SetBinError(64,pow(dError,0.5)); 
12773    }
12774   } // end of if(...)
12775  } // end of {
12776  f5pCumulants->SetBinContent(65,f5pCorrelations->GetBinContent(65)-2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(2));  
12777  { 
12778   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
12779   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
12780   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
12781   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
12782   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
12783   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
12784   Double_t dSumWLinearFive6n2n4n2n2n = 0.; // sum of linear event weights for <4>
12785   Double_t dSumWQuadraticFive6n2n4n2n2n = 0.; // sum of quadratic event weights <4>
12786   Double_t dSpreadFive6n2n4n2n2n = 0.; // weighted and biased estimator for sigma of <4>
12787   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12788   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12789   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
12790   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12791   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12792   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
12793   dSumWLinearFive6n2n4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12794   dSumWQuadraticFive6n2n4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12795   dSpreadFive6n2n4n2n2n = f5pCorrelations->GetBinError(65);
12796   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
12797      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
12798      pow(dSumWLinearFive6n2n4n2n2n,2.)>dSumWQuadraticFive6n2n4n2n2n)
12799   {
12800    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(9),2.)
12801                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
12802                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
12803                    + 4.*pow(f2pCorrelations->GetBinContent(2),2.)
12804                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
12805                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
12806                    + pow((pow(dSumWQuadraticFive6n2n4n2n2n,0.5)/dSumWLinearFive6n2n4n2n2n)
12807                    * dSpreadFive6n2n4n2n2n*pow(pow(dSumWLinearFive6n2n4n2n2n,2.)/(pow(dSumWLinearFive6n2n4n2n2n,2.)-dSumWQuadraticFive6n2n4n2n2n),0.5),2.)
12808                    + 4.*2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(2)
12809                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12810                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,14)) 
12811                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(9))
12812                    / (dSumWLinearTwo2n2n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12813                    - 2.*2.*f3pCorrelations->GetBinContent(9)
12814                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12815                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,119))
12816                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(65))
12817                    / (dSumWLinearTwo2n2n*dSumWLinearFive6n2n4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12818                    - 2.*2.*f2pCorrelations->GetBinContent(2)
12819                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12820                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,119))
12821                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(65))
12822                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n2n4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12823    if(dError>0.)
12824    {
12825     f5pCumulants->SetBinError(65,pow(dError,0.5)); 
12826    }
12827   } // end of if(...)
12828  } // end of {
12829  f5pCumulants->SetBinContent(66,f5pCorrelations->GetBinContent(66)-2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(4));
12830  { 
12831   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
12832   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
12833   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
12834   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
12835   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
12836   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
12837   Double_t dSumWLinearFive6n4n4n4n2n = 0.; // sum of linear event weights for <4>
12838   Double_t dSumWQuadraticFive6n4n4n4n2n = 0.; // sum of quadratic event weights <4>
12839   Double_t dSpreadFive6n4n4n4n2n = 0.; // weighted and biased estimator for sigma of <4>
12840   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12841   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12842   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
12843   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12844   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12845   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
12846   dSumWLinearFive6n4n4n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12847   dSumWQuadraticFive6n4n4n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12848   dSpreadFive6n4n4n4n2n = f5pCorrelations->GetBinError(66);
12849   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
12850      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
12851      pow(dSumWLinearFive6n4n4n4n2n,2.)>dSumWQuadraticFive6n4n4n4n2n)
12852   {
12853    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(9),2.)
12854                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
12855                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
12856                    + 4.*pow(f2pCorrelations->GetBinContent(4),2.)
12857                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
12858                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
12859                    + pow((pow(dSumWQuadraticFive6n4n4n4n2n,0.5)/dSumWLinearFive6n4n4n4n2n)
12860                    * dSpreadFive6n4n4n4n2n*pow(pow(dSumWLinearFive6n4n4n4n2n,2.)/(pow(dSumWLinearFive6n4n4n4n2n,2.)-dSumWQuadraticFive6n4n4n4n2n),0.5),2.)
12861                    + 4.*2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(4)
12862                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12863                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,14)) 
12864                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(9))
12865                    / (dSumWLinearTwo4n4n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12866                    - 2.*2.*f3pCorrelations->GetBinContent(9)
12867                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12868                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,120))
12869                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(66))
12870                    / (dSumWLinearTwo4n4n*dSumWLinearFive6n4n4n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12871                    - 2.*2.*f2pCorrelations->GetBinContent(4)
12872                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12873                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,120))
12874                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(66))
12875                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n4n4n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12876    if(dError>0.)
12877    {
12878     f5pCumulants->SetBinError(66,pow(dError,0.5)); 
12879    }
12880   } // end of if(...)
12881  } // end of {  
12882  f5pCumulants->SetBinContent(67,f5pCorrelations->GetBinContent(67));
12883  {
12884   Double_t dSumWLinear = 0.; // sum of linear event weights
12885   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12886   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12887   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12888   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12889   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12890   dSpread = f5pCorrelations->GetBinError(67);
12891   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12892   {
12893    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12894    f5pCumulants->SetBinError(67,dError); 
12895   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12896  }  
12897  f5pCumulants->SetBinContent(68,f5pCorrelations->GetBinContent(68)-2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(5));  
12898  { 
12899   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
12900   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
12901   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
12902   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
12903   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
12904   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
12905   Double_t dSumWLinearFive6n5n5n5n1n = 0.; // sum of linear event weights for <4>
12906   Double_t dSumWQuadraticFive6n5n5n5n1n = 0.; // sum of quadratic event weights <4>
12907   Double_t dSpreadFive6n5n5n5n1n = 0.; // weighted and biased estimator for sigma of <4>
12908   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12909   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12910   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
12911   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12912   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12913   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
12914   dSumWLinearFive6n5n5n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12915   dSumWQuadraticFive6n5n5n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12916   dSpreadFive6n5n5n5n1n = f5pCorrelations->GetBinError(68);
12917   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
12918      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
12919      pow(dSumWLinearFive6n5n5n5n1n,2.)>dSumWQuadraticFive6n5n5n5n1n)
12920   {
12921    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(10),2.)
12922                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
12923                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
12924                    + 4.*pow(f2pCorrelations->GetBinContent(5),2.)
12925                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
12926                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
12927                    + pow((pow(dSumWQuadraticFive6n5n5n5n1n,0.5)/dSumWLinearFive6n5n5n5n1n)
12928                    * dSpreadFive6n5n5n5n1n*pow(pow(dSumWLinearFive6n5n5n5n1n,2.)/(pow(dSumWLinearFive6n5n5n5n1n,2.)-dSumWQuadraticFive6n5n5n5n1n),0.5),2.)
12929                    + 4.*2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(5)
12930                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12931                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,15)) 
12932                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(10))
12933                    / (dSumWLinearTwo5n5n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12934                    - 2.*2.*f3pCorrelations->GetBinContent(10)
12935                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12936                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,122))
12937                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(68))
12938                    / (dSumWLinearTwo5n5n*dSumWLinearFive6n5n5n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12939                    - 2.*2.*f2pCorrelations->GetBinContent(5)
12940                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12941                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,122))
12942                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(68))
12943                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n5n5n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12944    if(dError>0.)
12945    {
12946     f5pCumulants->SetBinError(68,pow(dError,0.5)); 
12947    }
12948   } // end of if(...)
12949  } // end of {
12950  f5pCumulants->SetBinContent(69,f5pCorrelations->GetBinContent(69));
12951  {
12952   Double_t dSumWLinear = 0.; // sum of linear event weights
12953   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12954   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12955   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12956   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12957   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12958   dSpread = f5pCorrelations->GetBinError(69);
12959   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12960   {
12961    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12962    f5pCumulants->SetBinError(69,dError); 
12963   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12964  } 
12965  f5pCumulants->SetBinContent(70,f5pCorrelations->GetBinContent(70)-2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(6));  
12966  { 
12967   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
12968   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
12969   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
12970   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
12971   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
12972   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
12973   Double_t dSumWLinearFive6n6n6n4n2n = 0.; // sum of linear event weights for <4>
12974   Double_t dSumWQuadraticFive6n6n6n4n2n = 0.; // sum of quadratic event weights <4>
12975   Double_t dSpreadFive6n6n6n4n2n = 0.; // weighted and biased estimator for sigma of <4>
12976   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12977   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12978   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
12979   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12980   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12981   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
12982   dSumWLinearFive6n6n6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12983   dSumWQuadraticFive6n6n6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12984   dSpreadFive6n6n6n4n2n = f5pCorrelations->GetBinError(70);
12985   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
12986      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
12987      pow(dSumWLinearFive6n6n6n4n2n,2.)>dSumWQuadraticFive6n6n6n4n2n)
12988   {
12989    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(9),2.)
12990                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
12991                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
12992                    + 4.*pow(f2pCorrelations->GetBinContent(6),2.)
12993                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
12994                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
12995                    + pow((pow(dSumWQuadraticFive6n6n6n4n2n,0.5)/dSumWLinearFive6n6n6n4n2n)
12996                    * dSpreadFive6n6n6n4n2n*pow(pow(dSumWLinearFive6n6n6n4n2n,2.)/(pow(dSumWLinearFive6n6n6n4n2n,2.)-dSumWQuadraticFive6n6n6n4n2n),0.5),2.)
12997                    + 4.*2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(6)
12998                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12999                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,14)) 
13000                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(9))
13001                    / (dSumWLinearTwo6n6n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
13002                    - 2.*2.*f3pCorrelations->GetBinContent(9)
13003                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
13004                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,124))
13005                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(70))
13006                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n6n6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
13007                    - 2.*2.*f2pCorrelations->GetBinContent(6)
13008                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
13009                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,124))
13010                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(70))
13011                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n6n6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
13012    if(dError>0.)
13013    {
13014     f5pCumulants->SetBinError(70,pow(dError,0.5)); 
13015    }
13016   } // end of if(...)
13017  } // end of {
13018
13019
13020
13021
13022
13023  f5pCumulants->SetBinContent(71,f5pCorrelations->GetBinContent(71)-2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(6));  
13024  { 
13025   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
13026   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
13027   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
13028   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
13029   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
13030   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
13031   Double_t dSumWLinearFive6n6n6n5n1n = 0.; // sum of linear event weights for <4>
13032   Double_t dSumWQuadraticFive6n6n6n5n1n = 0.; // sum of quadratic event weights <4>
13033   Double_t dSpreadFive6n6n6n5n1n = 0.; // weighted and biased estimator for sigma of <4>
13034   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
13035   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
13036   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
13037   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
13038   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
13039   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
13040   dSumWLinearFive6n6n6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
13041   dSumWQuadraticFive6n6n6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
13042   dSpreadFive6n6n6n5n1n = f5pCorrelations->GetBinError(71);
13043   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
13044      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
13045      pow(dSumWLinearFive6n6n6n5n1n,2.)>dSumWQuadraticFive6n6n6n5n1n)
13046   {
13047    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(10),2.)
13048                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
13049                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
13050                    + 4.*pow(f2pCorrelations->GetBinContent(6),2.)
13051                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
13052                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
13053                    + pow((pow(dSumWQuadraticFive6n6n6n5n1n,0.5)/dSumWLinearFive6n6n6n5n1n)
13054                    * dSpreadFive6n6n6n5n1n*pow(pow(dSumWLinearFive6n6n6n5n1n,2.)/(pow(dSumWLinearFive6n6n6n5n1n,2.)-dSumWQuadraticFive6n6n6n5n1n),0.5),2.)
13055                    + 4.*2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(6)
13056                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
13057                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,15)) 
13058                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(10))
13059                    / (dSumWLinearTwo6n6n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
13060                    - 2.*2.*f3pCorrelations->GetBinContent(10)
13061                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
13062                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,125))
13063                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(71))
13064                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n6n6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
13065                    - 2.*2.*f2pCorrelations->GetBinContent(6)
13066                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
13067                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,125))
13068                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(71))
13069                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n6n6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
13070    if(dError>0.)
13071    {
13072     f5pCumulants->SetBinError(71,pow(dError,0.5)); 
13073    }
13074   } // end of if(...)
13075  } // end of {
13076  // d3) "Four distinct harmonics":
13077  for(Int_t b=73;b<=83;b++)
13078  {
13079   f5pCumulants->SetBinContent(b,f5pCorrelations->GetBinContent(b));
13080   Double_t dSumWLinear = 0.; // sum of linear event weights
13081   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
13082   Double_t dSpread = 0.; // weighted and biased estimator for sigma
13083   Double_t dError = 0.; // weighted and unbiased estimator for sigma
13084   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
13085   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
13086   dSpread = f5pCorrelations->GetBinError(b);
13087   if(pow(dSumWLinear,2.)>dSumWQuadratic)
13088   {
13089    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
13090    f5pCumulants->SetBinError(b,dError); 
13091   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
13092  } // end of for(Int_t b=73;b<=83;b++)
13093  // d4) "Five distinct harmonics":
13094  for(Int_t b=85;b<=87;b++)
13095  {
13096   f5pCumulants->SetBinContent(b,f5pCorrelations->GetBinContent(b));
13097   Double_t dSumWLinear = 0.; // sum of linear event weights
13098   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
13099   Double_t dSpread = 0.; // weighted and biased estimator for sigma
13100   Double_t dError = 0.; // weighted and unbiased estimator for sigma
13101   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
13102   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
13103   dSpread = f5pCorrelations->GetBinError(b);
13104   if(pow(dSumWLinear,2.)>dSumWQuadratic)
13105   {
13106    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
13107    f5pCumulants->SetBinError(b,dError); 
13108   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
13109  } // end of for(Int_t b=85;b<=87;b++)
13110
13111 } // end of void AliFlowAnalysisWithQCumulants::CalculateCumulantsMixedHarmonics()
13112
13113 //===================================================================================================================
13114
13115 void AliFlowAnalysisWithQCumulants::StorePhiDistributionForOneEvent(AliFlowEventSimple *anEvent)
13116 {
13117  // Store phi distribution for one event to illustrate flow.
13118  
13119  if(fPhiDistributionForOneEvent->GetEntries()>0){return;} // store only phi distribution for one event
13120  
13121  Double_t vMin = fPhiDistributionForOneEventSettings[0]; 
13122  Double_t vMax = fPhiDistributionForOneEventSettings[1]; 
13123  Double_t refMultMin = fPhiDistributionForOneEventSettings[2]; 
13124  Double_t refMultMax = fPhiDistributionForOneEventSettings[3]; 
13125  
13126  Double_t vEBE = 0.;
13127  Double_t cumulant4thEBE = fIntFlowCorrelationsEBE->GetBinContent(2)-2.*pow(fIntFlowCorrelationsEBE->GetBinContent(1),2.);
13128  if(cumulant4thEBE<0.)
13129  {
13130   vEBE = pow(-1.*cumulant4thEBE,0.25);
13131   if((vEBE>vMin && vEBE<vMax) && (fReferenceMultiplicityEBE>refMultMin && fReferenceMultiplicityEBE<refMultMax))
13132   {
13133    fPhiDistributionForOneEvent->SetTitle(Form("v_{%i} = %f",fHarmonic,vEBE));
13134    for(Int_t p=0;p<anEvent->NumberOfTracks();p++)
13135    {
13136     if(anEvent->GetTrack(p)->InRPSelection())
13137     {
13138      fPhiDistributionForOneEvent->Fill(anEvent->GetTrack(p)->Phi());
13139     }
13140    } // end of for(Int_t p=0;p<anEvent->NumberOfTracks();p++)
13141   } else
13142     {
13143      fPhiDistributionForOneEvent->SetTitle(Form("v_{%i} = %f, out of specified boundaries",fHarmonic,vEBE));  
13144     } 
13145    
13146  } // end of if(cumulant4thEBE<0.)
13147  
13148 } // end of void AliFlowAnalysisWithQCumulants::StorePhiDistributionForOneEvent(AliFlowEventSimple *anEvent)
13149
13150 //===================================================================================================================
13151
13152 void AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrelations()
13153 {
13154  // Calculate averages of products of correlations for integrated flow.
13155
13156  // Multiplicity bin of an event (relevant for all histos vs M): 
13157  Double_t dMultiplicityBin = 0.;
13158  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
13159  {
13160   dMultiplicityBin = fNumberOfRPsEBE+0.5;
13161  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
13162    {
13163     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
13164    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
13165      {
13166       dMultiplicityBin = fNumberOfPOIsEBE+0.5;
13167      }
13168
13169  Int_t counter = 0;
13170  
13171  for(Int_t ci1=1;ci1<4;ci1++)
13172  {
13173   for(Int_t ci2=ci1+1;ci2<=4;ci2++)
13174   {
13175    fIntFlowProductOfCorrelationsPro->Fill(0.5+counter,
13176                                           fIntFlowCorrelationsEBE->GetBinContent(ci1)*
13177                                           fIntFlowCorrelationsEBE->GetBinContent(ci2),
13178                                           fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci1)*
13179                                           fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci2));
13180    // products versus multiplicity:  // [0=<<2><4>>,1=<<2><6>>,2=<<2><8>>,3=<<4><6>>,4=<<4><8>>,5=<<6><8>>]
13181    if(fCalculateCumulantsVsM)
13182    {
13183     if(fFillProfilesVsMUsingWeights) 
13184     {
13185      fIntFlowProductOfCorrelationsVsMPro[counter]->Fill(dMultiplicityBin, // to be improved: dMult => sum of weights ?
13186                                                         fIntFlowCorrelationsEBE->GetBinContent(ci1)*
13187                                                         fIntFlowCorrelationsEBE->GetBinContent(ci2),
13188                                                         fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci1)*
13189                                                         fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci2));
13190     } else
13191       {
13192        fIntFlowProductOfCorrelationsVsMPro[counter]->Fill(dMultiplicityBin, // to be improved: dMult => sum of weights ?
13193                                                           fIntFlowCorrelationsEBE->GetBinContent(ci1)*
13194                                                           fIntFlowCorrelationsEBE->GetBinContent(ci2));
13195       }
13196    } // end of if(fCalculateCumulantsVsM)
13197    counter++;                                                                                                                        
13198   }
13199  }
13200  
13201 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrelations()
13202
13203
13204 //=======================================================================================================================
13205
13206
13207 void AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrectionTermsForNUA()
13208 {
13209  // Calculate averages of products of correction terms for NUA.
13210  
13211  // a) Binning of fIntFlowProductOfCorrectionTermsForNUAPro is organized as follows:
13212  //     1st bin: <<2><cos(phi)>> 
13213  //     2nd bin: <<2><sin(phi)>>
13214  //     3rd bin: <<cos(phi)><sin(phi)>>
13215  //     4th bin: <<2><cos(phi1+phi2)>> 
13216  //     5th bin: <<2><sin(phi1+phi2)>>
13217  //     6th bin: <<2><cos(phi1-phi2-phi3)>> 
13218  //     7th bin: <<2><sin(phi1-phi2-phi3)>>
13219  //     8th bin: <<4><cos(phi1)>>
13220  //     9th bin: <<4><sin(phi1)>>
13221  //    10th bin: <<4><cos(phi1+phi2)>>
13222  //    11th bin: <<4><sin(phi1+phi2)>>
13223  //    12th bin: <<4><cos(phi1-phi2-phi3)>>
13224  //    13th bin: <<4><sin(phi1-phi2-phi3)>>
13225  //    14th bin: <<cos(phi1)><cos(phi1+phi2)>>
13226  //    15th bin: <<cos(phi1)><sin(phi1+phi2)>> 
13227  //    16th bin: <<cos(phi1)><cos(phi1-phi2-phi3)>>
13228  //    17th bin: <<cos(phi1)><sin(phi1-phi2-phi3)>> 
13229  //    18th bin: <<sin(phi1)><cos(phi1+phi2)>>
13230  //    19th bin: <<sin(phi1)><sin(phi1+phi2)>> 
13231  //    20th bin: <<sin(phi1)><cos(phi1-phi2-phi3)>>
13232  //    21st bin: <<sin(phi1)><sin(phi1-phi2-phi3)>>
13233  //    22nd bin: <<cos(phi1+phi2)><sin(phi1+phi2)>>
13234  //    23rd bin: <<cos(phi1+phi2)><cos(phi1-phi2-phi3)>>
13235  //    24th bin: <<cos(phi1+phi2)><sin(phi1-phi2-phi3)>>
13236  //    25th bin: <<sin(phi1+phi2)><cos(phi1-phi2-phi3)>>
13237  //    26th bin: <<sin(phi1+phi2)><sin(phi1-phi2-phi3)>>
13238  //    27th bin: <<cos(phi1-phi2-phi3)><sin(phi1-phi2-phi3)>>
13239  
13240  // <<2><cos(phi)>>:
13241  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(0.5,
13242                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1),
13243                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
13244                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1));
13245  // <<2><sin(phi)>>:
13246  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(1.5,
13247                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1),
13248                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
13249                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
13250  // <<cos(phi)><sin(phi)>>:
13251  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(2.5,
13252                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1),
13253                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
13254                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
13255  // <<2><cos(phi1+phi2)>>:
13256  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(3.5,
13257                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2),
13258                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
13259                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
13260  // <<2><sin(phi1+phi2)>>:
13261  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(4.5,
13262                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
13263                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
13264                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
13265  // <<2><cos(phi1-phi2-phi3)>>:
13266  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(5.5,
13267                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
13268                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
13269                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
13270  // <<2><sin(phi1-phi2-phi3)>>:
13271  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(6.5,
13272                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
13273                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
13274                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
13275  // <<4><cos(phi1)>>:
13276  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(7.5,
13277                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1),
13278                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
13279                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1));
13280  // <<4><sin(phi1)>>:
13281  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(8.5,
13282                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1),
13283                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
13284                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
13285  // <<4><cos(phi1+phi2)>>:
13286  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(9.5,
13287                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2),
13288                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
13289                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
13290  // <<4><sin(phi1+phi2)>>:
13291  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(10.5,
13292                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
13293                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
13294                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));
13295  // <<4><cos(phi1-phi2-phi3)>>:
13296  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(11.5,
13297                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
13298                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
13299                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
13300  // <<4><sin(phi1-phi2-phi3)>>:
13301  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(12.5,
13302                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
13303                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
13304                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));   
13305  // <<cos(phi1)><cos(phi1+phi2)>>:
13306  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(13.5,
13307                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2),
13308                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
13309                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
13310  // <<cos(phi1)><sin(phi1+phi2)>>: 
13311  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(14.5,
13312                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
13313                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
13314                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
13315  // <<cos(phi1)><cos(phi1-phi2-phi3)>>:
13316  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(15.5,
13317                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
13318                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
13319                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
13320  // <<cos(phi1)><sin(phi1-phi2-phi3)>>: 
13321  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(16.5,
13322                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
13323                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
13324                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));  
13325  // <<sin(phi1)><cos(phi1+phi2)>>:
13326  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(17.5,
13327                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2),
13328                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)
13329                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2));  
13330  // <<sin(phi1)><sin(phi1+phi2)>>: 
13331  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(18.5,
13332                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
13333                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)
13334                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));  
13335  // <<sin(phi1)><cos(phi1-phi2-phi3)>>:
13336  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(19.5,
13337                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
13338                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)
13339                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
13340  // <<sin(phi1)><sin(phi1-phi2-phi3)>>:
13341  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(20.5,
13342                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
13343                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)
13344                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
13345  // <<cos(phi1+phi2)><sin(phi1+phi2)>>:
13346  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(21.5,
13347                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
13348                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)
13349                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
13350  // <<cos(phi1+phi2)><cos(phi1-phi2-phi3)>>:
13351  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(22.5,
13352                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
13353                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)
13354                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));   
13355  // <<cos(phi1+phi2)><sin(phi1-phi2-phi3)>>:
13356  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(23.5,
13357                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
13358                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)
13359                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));    
13360  // <<sin(phi1+phi2)><cos(phi1-phi2-phi3)>>:
13361  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(24.5,
13362                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
13363                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)
13364                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));    
13365  // <<sin(phi1+phi2)><sin(phi1-phi2-phi3)>>:
13366  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(25.5,
13367                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
13368                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)
13369                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));    
13370  // <<cos(phi1-phi2-phi3)><sin(phi1-phi2-phi3)>>:
13371  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(26.5,
13372                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
13373                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)
13374                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));    
13375
13376 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrectionTermsForNUA()
13377
13378 //=======================================================================================================================
13379
13380 void AliFlowAnalysisWithQCumulants::CalculateCovariancesIntFlow()
13381 {
13382  // a) Calculate unbiased estimators Cov(<2>,<4>), Cov(<2>,<6>), Cov(<2>,<8>), Cov(<4>,<6>), Cov(<4>,<8>) and Cov(<6>,<8>)
13383  //    for covariances V_(<2>,<4>), V_(<2>,<6>), V_(<2>,<8>), V_(<4>,<6>), V_(<4>,<8>) and V_(<6>,<8>).
13384  // b) Store in histogram fIntFlowCovariances for instance the following: 
13385  //
13386  //             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)]
13387  // 
13388  //    where N is the number of events, w_{<2>} is event weight for <2> and w_{<4>} is event weight for <4>.
13389  // c) Binning of fIntFlowCovariances is organized as follows:
13390  // 
13391  //     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)] 
13392  //     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)]
13393  //     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)]
13394  //     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)]
13395  //     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)]
13396  //     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)]
13397  //
13398     
13399  // Average 2-, 4-, 6- and 8-particle correlations for all events:
13400  Double_t correlation[4] = {0.};
13401  for(Int_t ci=0;ci<4;ci++)
13402  {
13403   correlation[ci] = fIntFlowCorrelationsPro->GetBinContent(ci+1);
13404  } 
13405  // Average products of 2-, 4-, 6- and 8-particle correlations: 
13406  Double_t productOfCorrelations[4][4] = {{0.}};
13407  Int_t productOfCorrelationsLabel = 1;
13408  // Denominators in the expressions for the unbiased estimator for covariance:
13409  Double_t denominator[4][4] = {{0.}};
13410  Int_t sumOfProductOfEventWeightsLabel1 = 1;
13411  // Weight dependent prefactor which multiply unbiased estimators for covariances:
13412  Double_t wPrefactor[4][4] = {{0.}}; 
13413  Int_t sumOfProductOfEventWeightsLabel2 = 1;
13414  for(Int_t c1=0;c1<4;c1++)
13415  {
13416   for(Int_t c2=c1+1;c2<4;c2++)
13417   {
13418    productOfCorrelations[c1][c2] = fIntFlowProductOfCorrelationsPro->GetBinContent(productOfCorrelationsLabel);
13419    if(TMath::Abs(fIntFlowSumOfEventWeights[0]->GetBinContent(c1+1)) > 1.e-44 && TMath::Abs(fIntFlowSumOfEventWeights[0]->GetBinContent(c2+1)) > 1.e-44)
13420    {
13421     denominator[c1][c2] = 1.-(fIntFlowSumOfProductOfEventWeights->GetBinContent(sumOfProductOfEventWeightsLabel1))
13422                         / (fIntFlowSumOfEventWeights[0]->GetBinContent(c1+1) 
13423                         * fIntFlowSumOfEventWeights[0]->GetBinContent(c2+1));                              
13424     wPrefactor[c1][c2] = fIntFlowSumOfProductOfEventWeights->GetBinContent(sumOfProductOfEventWeightsLabel2)
13425                        / (fIntFlowSumOfEventWeights[0]->GetBinContent(c1+1)
13426                        * fIntFlowSumOfEventWeights[0]->GetBinContent(c2+1));                                                       
13427    }
13428    productOfCorrelationsLabel++; // to be improved - do I need here all 3 counters?
13429    sumOfProductOfEventWeightsLabel1++;
13430    sumOfProductOfEventWeightsLabel2++;  
13431   } // end of for(Int_t c2=c1+1;c2<4;c2++)
13432  } // end of for(Int_t c1=0;c1<4;c1++)
13433  
13434  Int_t covarianceLabel = 1;
13435  for(Int_t c1=0;c1<4;c1++)
13436  {
13437   for(Int_t c2=c1+1;c2<4;c2++)
13438   {
13439    if(TMath::Abs(denominator[c1][c2]) > 1.e-44)
13440    {
13441     // Covariances:
13442     Double_t cov = (productOfCorrelations[c1][c2]-correlation[c1]*correlation[c2])/denominator[c1][c2]; 
13443     // Covariances multiplied with weight dependent prefactor:
13444     Double_t wCov = cov * wPrefactor[c1][c2];
13445     fIntFlowCovariances->SetBinContent(covarianceLabel,wCov);
13446    }
13447    covarianceLabel++;
13448   } // end of for(Int_t c2=c1+1;c2<4;c2++) 
13449  } // end of for(Int_t c1=0;c1<4;c1++)
13450  
13451  // Versus multiplicity: 
13452  if(!fCalculateCumulantsVsM){return;}
13453  Int_t nBins = fIntFlowCorrelationsVsMPro[0]->GetNbinsX(); // to be improved (hardwired 0) 
13454  for(Int_t b=1;b<=nBins;b++)
13455  {
13456   // Average 2-, 4-, 6- and 8-particle correlations for all events:
13457   Double_t correlationVsM[4] = {0.};
13458   for(Int_t ci=0;ci<4;ci++)
13459   {
13460    correlationVsM[ci] = fIntFlowCorrelationsVsMPro[ci]->GetBinContent(b);
13461   } // end of for(Int_t ci=0;ci<4;ci++)
13462   // Average products of 2-, 4-, 6- and 8-particle correlations: 
13463   Double_t productOfCorrelationsVsM[4][4] = {{0.}};
13464   Int_t productOfCorrelationsLabelVsM = 1;
13465   // Denominators in the expressions for the unbiased estimator for covariance:
13466   Double_t denominatorVsM[4][4] = {{0.}};
13467   Int_t sumOfProductOfEventWeightsLabel1VsM = 1;
13468   // Weight dependent prefactor which multiply unbiased estimators for covariances:
13469   Double_t wPrefactorVsM[4][4] = {{0.}}; 
13470   Int_t sumOfProductOfEventWeightsLabel2VsM = 1;
13471   for(Int_t c1=0;c1<4;c1++)
13472   {
13473    for(Int_t c2=c1+1;c2<4;c2++)
13474    {
13475     productOfCorrelationsVsM[c1][c2] = fIntFlowProductOfCorrelationsVsMPro[productOfCorrelationsLabelVsM-1]->GetBinContent(b); 
13476     if(TMath::Abs(fIntFlowSumOfEventWeightsVsM[c1][0]->GetBinContent(b)) > 1.e-44 && TMath::Abs(fIntFlowSumOfEventWeightsVsM[c2][0]->GetBinContent(b)) > 1.e-44)
13477     {
13478      denominatorVsM[c1][c2] = 1.-(fIntFlowSumOfProductOfEventWeightsVsM[sumOfProductOfEventWeightsLabel1VsM-1]->GetBinContent(b))
13479                             / (fIntFlowSumOfEventWeightsVsM[c1][0]->GetBinContent(b) 
13480                             * fIntFlowSumOfEventWeightsVsM[c2][0]->GetBinContent(b));                              
13481      wPrefactorVsM[c1][c2] = fIntFlowSumOfProductOfEventWeightsVsM[sumOfProductOfEventWeightsLabel2VsM-1]->GetBinContent(b)
13482                            / (fIntFlowSumOfEventWeightsVsM[c1][0]->GetBinContent(b)
13483                            * fIntFlowSumOfEventWeightsVsM[c2][0]->GetBinContent(b));                                                       
13484     }
13485     productOfCorrelationsLabelVsM++;
13486     sumOfProductOfEventWeightsLabel1VsM++;
13487     sumOfProductOfEventWeightsLabel2VsM++;  
13488    } // end of for(Int_t c1=0;c1<4;c1++) 
13489   } // end of for(Int_t c2=c1+1;c2<4;c2++)
13490  
13491   Int_t covarianceLabelVsM = 1;
13492   for(Int_t c1=0;c1<4;c1++)
13493   {
13494    for(Int_t c2=c1+1;c2<4;c2++)
13495    {
13496     if(TMath::Abs(denominatorVsM[c1][c2]) > 1.e-44)
13497     {
13498      // Covariances:
13499      Double_t covVsM = (productOfCorrelationsVsM[c1][c2]-correlationVsM[c1]*correlationVsM[c2])/denominatorVsM[c1][c2]; 
13500      // Covariances multiplied with weight dependent prefactor:
13501      Double_t wCovVsM = covVsM * wPrefactorVsM[c1][c2];
13502      fIntFlowCovariancesVsM[covarianceLabelVsM-1]->SetBinContent(b,wCovVsM);
13503     }
13504     covarianceLabelVsM++;
13505    } // end of for(Int_t c2=c1+1;c2<4;c2++)
13506   } // end of for(Int_t c1=0;c1<4;c1++)
13507  } // end of for(Int_t b=1;b<=nBins;b++)
13508   
13509 } // end of AliFlowAnalysisWithQCumulants::CalculateCovariancesIntFlow()
13510
13511 //=======================================================================================================================
13512
13513 void AliFlowAnalysisWithQCumulants::CalculateCovariancesNUAIntFlow()
13514 {
13515  // a) Calculate unbiased estimators Cov(*,*) for true covariances V_(*,*) for NUA terms.
13516  // b) Store in histogram fIntFlowCovariancesNUA for instance the following: 
13517  //
13518  //             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)]
13519  // 
13520  //    where N is the number of events, w_{<2>} is event weight for <2> and w_{<cos(phi)>} is event weight for <cos(phi)>.
13521  // c) Binning of fIntFlowCovariancesNUA is organized as follows:
13522  // 
13523  //     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)] 
13524  //     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)]
13525  //     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)]
13526  // ...
13527       
13528  // Cov(<2>,<cos(phi)>):
13529  Double_t product1 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(1); // <<2><cos(phi)>> 
13530  Double_t term1st1 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13531  Double_t term2nd1 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi)>>
13532  Double_t sumOfW1st1 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13533  Double_t sumOfW2nd1 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi)>}
13534  Double_t sumOfWW1 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(1); // W_{<2>} * W_{<cos(phi)>}
13535  // numerator in the expression for the the unbiased estimator for covariance:
13536  Double_t numerator1 = product1 - term1st1*term2nd1; 
13537  // denominator in the expression for the the unbiased estimator for covariance:
13538  Double_t denominator1 = 0.;
13539  if(TMath::Abs(sumOfW1st1*sumOfW2nd1)>0.)
13540  {
13541   denominator1 = 1.-sumOfWW1/(sumOfW1st1*sumOfW2nd1);
13542   if(TMath::Abs(denominator1)>0.)
13543   {
13544    // covariance:
13545    Double_t covariance1 = numerator1/denominator1;
13546    // weight dependent prefactor for covariance:
13547    Double_t wPrefactor1 = sumOfWW1/(sumOfW1st1*sumOfW2nd1);
13548    // finally, store "weighted" covariance:
13549    fIntFlowCovariancesNUA->SetBinContent(1,wPrefactor1*covariance1);
13550   } // end of if(TMath::Abs(denominator)>0.)
13551  } // end of if(TMath::Abs(sumOfW1st1*sumOfW2nd1)>0.)
13552  
13553  // Cov(<2>,<sin(phi)>):
13554  Double_t product2 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(2); // <<2><sin(phi)>> 
13555  Double_t term1st2 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13556  Double_t term2nd2 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi)>>
13557  Double_t sumOfW1st2 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13558  Double_t sumOfW2nd2 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi)>}
13559  Double_t sumOfWW2 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(2); // W_{<2>} * W_{<sin(phi)>}
13560  // numerator in the expression for the the unbiased estimator for covariance:
13561  Double_t numerator2 = product2 - term1st2*term2nd2;
13562  // denominator in the expression for the the unbiased estimator for covariance:
13563  Double_t denominator2 = 0.;
13564  if(TMath::Abs(sumOfW1st2*sumOfW2nd2)>0.)
13565  {  
13566   denominator2 = 1.-sumOfWW2/(sumOfW1st2*sumOfW2nd2);
13567   if(TMath::Abs(denominator2)>0.)
13568   {
13569    // covariance:
13570    Double_t covariance2 = numerator2/denominator2;
13571    // weight dependent prefactor for covariance:
13572    Double_t wPrefactor2 = sumOfWW2/(sumOfW1st2*sumOfW2nd2);
13573    // finally, store "weighted" covariance:
13574    fIntFlowCovariancesNUA->SetBinContent(2,wPrefactor2*covariance2);
13575   } // end of if(TMath::Abs(denominator2)>0.)
13576  } // end of if(TMath::Abs(sumOfW1st2*sumOfW2nd2)>0.)
13577  
13578  // Cov(<cos(phi)>,<sin(phi)>):
13579  Double_t product3 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(3); // <<cos(phi)><sin(phi)>> 
13580  Double_t term1st3 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi)>>
13581  Double_t term2nd3 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi)>>
13582  Double_t sumOfW1st3 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi)>}
13583  Double_t sumOfW2nd3 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi)>}
13584  Double_t sumOfWW3 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(3); // W_{<cos(phi)>} * W_{<sin(phi)>}
13585  // numerator in the expression for the the unbiased estimator for covariance:
13586  Double_t numerator3 = product3 - term1st3*term2nd3; 
13587  // denominator in the expression for the the unbiased estimator for covariance:
13588  Double_t denominator3 = 0;
13589  if(TMath::Abs(sumOfW1st3*sumOfW2nd3)>0.)
13590  { 
13591   denominator3 = 1.-sumOfWW3/(sumOfW1st3*sumOfW2nd3);
13592   if(TMath::Abs(denominator3)>0.)
13593   {
13594    // covariance:
13595    Double_t covariance3 = numerator3/denominator3;
13596    // weight dependent prefactor for covariance:
13597    Double_t wPrefactor3 = sumOfWW3/(sumOfW1st3*sumOfW2nd3);
13598    // finally, store "weighted" covariance:
13599    fIntFlowCovariancesNUA->SetBinContent(3,wPrefactor3*covariance3);
13600   } // end of if(TMath::Abs(denominator3)>0.)
13601  } // end of if(TMath::Abs(sumOfW1st3*sumOfW2nd3)>0.)
13602  
13603  // Cov(<2>,<cos(phi1+phi2)>):
13604  Double_t product4 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(4); // <<2><cos(phi1+phi2)>> 
13605  Double_t term1st4 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13606  Double_t term2nd4 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13607  Double_t sumOfW1st4 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13608  Double_t sumOfW2nd4 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13609  Double_t sumOfWW4 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(4); // W_{<2>} * W_{<cos(phi1+phi2)>}
13610  // numerator in the expression for the the unbiased estimator for covariance:
13611  Double_t numerator4 = product4 - term1st4*term2nd4; 
13612  // denominator in the expression for the the unbiased estimator for covariance:
13613  Double_t denominator4 = 0.;
13614  if(TMath::Abs(sumOfW1st4*sumOfW2nd4)>0.)
13615  { 
13616   denominator4 = 1.-sumOfWW4/(sumOfW1st4*sumOfW2nd4);
13617   if(TMath::Abs(denominator4)>0.)
13618   {  
13619    // covariance:
13620    Double_t covariance4 = numerator4/denominator4;
13621    // weight dependent prefactor for covariance:
13622    Double_t wPrefactor4 = sumOfWW4/(sumOfW1st4*sumOfW2nd4);
13623    // finally, store "weighted" covariance:
13624    fIntFlowCovariancesNUA->SetBinContent(4,wPrefactor4*covariance4);
13625   } // end of if(TMath::Abs(denominator4)>0.)
13626  } // end of if(TMath::Abs(sumOfW1st4*sumOfW2nd4)>0.)
13627  
13628  // Cov(<2>,<sin(phi1+phi2)>):
13629  Double_t product5 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(5); // <<2><sin(phi1+phi2)>> 
13630  Double_t term1st5 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13631  Double_t term2nd5 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13632  Double_t sumOfW1st5 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13633  Double_t sumOfW2nd5 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13634  Double_t sumOfWW5 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(5); // W_{<2>} * W_{<sin(phi1+phi2)>}
13635  // numerator in the expression for the the unbiased estimator for covariance:
13636  Double_t numerator5 = product5 - term1st5*term2nd5; 
13637  // denominator in the expression for the the unbiased estimator for covariance:
13638  Double_t denominator5 = 0.;
13639  if(TMath::Abs(sumOfW1st5*sumOfW2nd5)>0.)
13640  {  
13641   denominator5 = 1.-sumOfWW5/(sumOfW1st5*sumOfW2nd5);
13642   if(TMath::Abs(denominator5)>0.)
13643   {  
13644    // covariance:
13645    Double_t covariance5 = numerator5/denominator5;
13646    // weight dependent prefactor for covariance:
13647    Double_t wPrefactor5 = sumOfWW5/(sumOfW1st5*sumOfW2nd5);
13648    // finally, store "weighted" covariance:
13649    fIntFlowCovariancesNUA->SetBinContent(5,wPrefactor5*covariance5);
13650   } // end of if(TMath::Abs(denominator5)>0.)
13651  } // end of if(TMath::Abs(sumOfW1st5*sumOfW2nd5)>0.)
13652  
13653  // Cov(<2>,<cos(phi1-phi2-phi3)>):
13654  Double_t product6 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(6); // <<2><cos(phi1-phi2-phi3)>> 
13655  Double_t term1st6 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13656  Double_t term2nd6 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13657  Double_t sumOfW1st6 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13658  Double_t sumOfW2nd6 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13659  Double_t sumOfWW6 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(6); // W_{<2>} * W_{<cos(phi1-phi2-phi3)>}
13660  // numerator in the expression for the the unbiased estimator for covariance:
13661  Double_t numerator6 = product6 - term1st6*term2nd6; 
13662  // denominator in the expression for the the unbiased estimator for covariance:
13663  Double_t denominator6 = 0.;
13664  if(TMath::Abs(sumOfW1st6*sumOfW2nd6)>0.)
13665  {  
13666   denominator6 = 1.-sumOfWW6/(sumOfW1st6*sumOfW2nd6);
13667   if(TMath::Abs(denominator6)>0.)
13668   {  
13669    // covariance:
13670    Double_t covariance6 = numerator6/denominator6;
13671    // weight dependent prefactor for covariance:
13672    Double_t wPrefactor6 = sumOfWW6/(sumOfW1st6*sumOfW2nd6);
13673    // finally, store "weighted" covariance:
13674    fIntFlowCovariancesNUA->SetBinContent(6,wPrefactor6*covariance6);
13675   } // end of if(TMath::Abs(denominator6)>0.)
13676  } // end of if(TMath::Abs(sumOfW1st6*sumOfW2nd6)>0.)
13677  
13678  // Cov(<2>,<sin(phi1-phi2-phi3)>):
13679  Double_t product7 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(7); // <<2><sin(phi1-phi2-phi3)>> 
13680  Double_t term1st7 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13681  Double_t term2nd7 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13682  Double_t sumOfW1st7 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13683  Double_t sumOfW2nd7 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13684  Double_t sumOfWW7 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(7); // W_{<2>} * W_{<sin(phi1-phi2-phi3)>}
13685  // numerator in the expression for the the unbiased estimator for covariance:
13686  Double_t numerator7 = product7 - term1st7*term2nd7; 
13687  // denominator in the expression for the the unbiased estimator for covariance:
13688  Double_t denominator7 = 0.;
13689  if(TMath::Abs(sumOfW1st7*sumOfW2nd7)>0.)
13690  {  
13691   denominator7 = 1.-sumOfWW7/(sumOfW1st7*sumOfW2nd7);
13692   if(TMath::Abs(denominator7)>0.)
13693   {   
13694    // covariance:
13695    Double_t covariance7 = numerator7/denominator7;
13696    // weight dependent prefactor for covariance:
13697    Double_t wPrefactor7 = sumOfWW7/(sumOfW1st7*sumOfW2nd7);
13698    // finally, store "weighted" covariance:
13699    fIntFlowCovariancesNUA->SetBinContent(7,wPrefactor7*covariance7);
13700   } // end of if(TMath::Abs(denominator7)>0.)
13701  } // end of if(TMath::Abs(sumOfW1st7*sumOfW2nd7)>0.)
13702  
13703  // Cov(<4>,<cos(phi1>):
13704  Double_t product8 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(8); // <<4><cos(phi1)>> 
13705  Double_t term1st8 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13706  Double_t term2nd8 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13707  Double_t sumOfW1st8 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13708  Double_t sumOfW2nd8 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13709  Double_t sumOfWW8 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(8); // W_{<4>} * W_{<cos(phi1)>}
13710  // numerator in the expression for the the unbiased estimator for covariance:
13711  Double_t numerator8 = product8 - term1st8*term2nd8; 
13712  // denominator in the expression for the the unbiased estimator for covariance:
13713  Double_t denominator8 = 0.;
13714  if(TMath::Abs(sumOfW1st8*sumOfW2nd8)>0.)
13715  { 
13716   denominator8 = 1.-sumOfWW8/(sumOfW1st8*sumOfW2nd8);
13717   if(TMath::Abs(denominator8)>0.)
13718   {     
13719    // covariance:
13720    Double_t covariance8 = numerator8/denominator8;
13721    // weight dependent prefactor for covariance:
13722    Double_t wPrefactor8 = sumOfWW8/(sumOfW1st8*sumOfW2nd8);
13723    // finally, store "weighted" covariance:
13724    fIntFlowCovariancesNUA->SetBinContent(8,wPrefactor8*covariance8);
13725   } // end of if(TMath::Abs(denominator8)>0.)
13726  } // end of if(TMath::Abs(sumOfW1st8*sumOfW2nd8)>0.)
13727  
13728  // Cov(<4>,<sin(phi1)>):
13729  Double_t product9 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(9); // <<4><sin(phi1)>> 
13730  Double_t term1st9 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13731  Double_t term2nd9 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
13732  Double_t sumOfW1st9 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13733  Double_t sumOfW2nd9 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
13734  Double_t sumOfWW9 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(9); // W_{<4>} * W_{<sin(phi1)>}
13735  // numerator in the expression for the the unbiased estimator for covariance:
13736  Double_t numerator9 = product9 - term1st9*term2nd9; 
13737  // denominator in the expression for the the unbiased estimator for covariance:
13738  Double_t denominator9 = 0.;
13739  if(TMath::Abs(sumOfW1st9*sumOfW2nd9)>0.) 
13740  {
13741   denominator9 = 1.-sumOfWW9/(sumOfW1st9*sumOfW2nd9);
13742   if(TMath::Abs(denominator9)>0.)
13743   {     
13744    // covariance:
13745    Double_t covariance9 = numerator9/denominator9;
13746    // weight dependent prefactor for covariance:
13747    Double_t wPrefactor9 = sumOfWW9/(sumOfW1st9*sumOfW2nd9);
13748    // finally, store "weighted" covariance:
13749    fIntFlowCovariancesNUA->SetBinContent(9,wPrefactor9*covariance9); 
13750   }
13751  } // end of if(TMath::Abs(sumOfW1st9*sumOfW2nd9)>0.) 
13752  
13753  // Cov(<4>,<cos(phi1+phi2)>):
13754  Double_t product10 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(10); // <<4><cos(phi1+phi2)>> 
13755  Double_t term1st10 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13756  Double_t term2nd10 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13757  Double_t sumOfW1st10 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13758  Double_t sumOfW2nd10 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13759  Double_t sumOfWW10 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(10); // W_{<4>} * W_{<cos(phi1+phi2)>}
13760  // numerator in the expression for the the unbiased estimator for covariance:
13761  Double_t numerator10 = product10 - term1st10*term2nd10; 
13762  // denominator in the expression for the the unbiased estimator for covariance:
13763  Double_t denominator10 = 0.;
13764  if(TMath::Abs(sumOfW1st10*sumOfW2nd10)>0.) 
13765  { 
13766   denominator10 = 1.-sumOfWW10/(sumOfW1st10*sumOfW2nd10);
13767   if(TMath::Abs(denominator10)>0.) 
13768   { 
13769    // covariance:
13770    Double_t covariance10 = numerator10/denominator10;
13771    // weight dependent prefactor for covariance:
13772    Double_t wPrefactor10 = sumOfWW10/(sumOfW1st10*sumOfW2nd10);
13773    // finally, store "weighted" covariance:
13774    fIntFlowCovariancesNUA->SetBinContent(10,wPrefactor10*covariance10);
13775   } // end of if(TMath::Abs(denominator10)>0.) 
13776  } // end of if(TMath::Abs(sumOfW1st10*sumOfW2nd10)>0.) 
13777  
13778  // Cov(<4>,<sin(phi1+phi2)>):
13779  Double_t product11 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(11); // <<4><sin(phi1+phi2)>> 
13780  Double_t term1st11 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13781  Double_t term2nd11 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13782  Double_t sumOfW1st11 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13783  Double_t sumOfW2nd11 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13784  Double_t sumOfWW11 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(11); // W_{<4>} * W_{<sin(phi1+phi2)>}
13785  // numerator in the expression for the the unbiased estimator for covariance:
13786  Double_t numerator11 = product11 - term1st11*term2nd11; 
13787  // denominator in the expression for the the unbiased estimator for covariance:
13788  Double_t denominator11 = 0.;
13789  if(TMath::Abs(sumOfW1st11*sumOfW2nd11)>0.) 
13790  {  
13791   denominator11 = 1.-sumOfWW11/(sumOfW1st11*sumOfW2nd11);
13792   if(TMath::Abs(denominator11)>0.) 
13793   { 
13794    // covariance:
13795    Double_t covariance11 = numerator11/denominator11;
13796    // weight dependent prefactor for covariance:
13797    Double_t wPrefactor11 = sumOfWW11/(sumOfW1st11*sumOfW2nd11);
13798    // finally, store "weighted" covariance:
13799    fIntFlowCovariancesNUA->SetBinContent(11,wPrefactor11*covariance11);
13800   } // end of if(TMath::Abs(denominator11)>0.) 
13801  } // end of if(TMath::Abs(sumOfW1st11*sumOfW2nd11)>0.) 
13802
13803  // Cov(<4>,<cos(phi1-phi2-phi3)>):
13804  Double_t product12 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(12); // <<4><cos(phi1-phi2-phi3)>> 
13805  Double_t term1st12 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13806  Double_t term2nd12 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13807  Double_t sumOfW1st12 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13808  Double_t sumOfW2nd12 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13809  Double_t sumOfWW12 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(12); // W_{<4>} * W_{<cos(phi1-phi2-phi3)>}
13810  // numerator in the expression for the the unbiased estimator for covariance:
13811  Double_t numerator12 = product12 - term1st12*term2nd12; 
13812  // denominator in the expression for the the unbiased estimator for covariance:
13813  Double_t denominator12 = 0.;
13814  if(TMath::Abs(sumOfW1st12*sumOfW2nd12)>0.) 
13815  {   
13816   denominator12 = 1.-sumOfWW12/(sumOfW1st12*sumOfW2nd12);
13817   if(TMath::Abs(denominator12)>0.) 
13818   { 
13819    // covariance:
13820    Double_t covariance12 = numerator12/denominator12;
13821    // weight dependent prefactor for covariance:
13822    Double_t wPrefactor12 = sumOfWW12/(sumOfW1st12*sumOfW2nd12);
13823    // finally, store "weighted" covariance:
13824    fIntFlowCovariancesNUA->SetBinContent(12,wPrefactor12*covariance12);
13825   } // end of if(TMath::Abs(denominator12)>0.)
13826  } // end of if(TMath::Abs(sumOfW1st12*sumOfW2nd12)>0.)  
13827
13828  // Cov(<4>,<sin(phi1-phi2-phi3)>):
13829  Double_t product13 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(13); // <<4><sin(phi1-phi2-phi3)>> 
13830  Double_t term1st13 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13831  Double_t term2nd13 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13832  Double_t sumOfW1st13 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13833  Double_t sumOfW2nd13 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13834  Double_t sumOfWW13 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(13); // W_{<4>} * W_{<sin(phi1-phi2-phi3)>}
13835  // numerator in the expression for the the unbiased estimator for covariance:
13836  Double_t numerator13 = product13 - term1st13*term2nd13; 
13837  // denominator in the expression for the the unbiased estimator for covariance:
13838  Double_t denominator13 = 0.;
13839  if(TMath::Abs(sumOfW1st13*sumOfW2nd13)>0.) 
13840  {   
13841   denominator13 = 1.-sumOfWW13/(sumOfW1st13*sumOfW2nd13);
13842   if(TMath::Abs(denominator13)>0.) 
13843   { 
13844    // covariance:
13845    Double_t covariance13 = numerator13/denominator13;
13846    // weight dependent prefactor for covariance:
13847    Double_t wPrefactor13 = sumOfWW13/(sumOfW1st13*sumOfW2nd13);
13848    // finally, store "weighted" covariance:
13849    fIntFlowCovariancesNUA->SetBinContent(13,wPrefactor13*covariance13);
13850   } // end of if(TMath::Abs(denominator13)>0.) 
13851  } // end of if(TMath::Abs(sumOfW1st13*sumOfW2nd13)>0.) 
13852
13853  // Cov(<cos(phi1)>,<cos(phi1+phi2)>):
13854  Double_t product14 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(14); // <<cos(phi1)><cos(phi1+phi2)>> 
13855  Double_t term1st14 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13856  Double_t term2nd14 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13857  Double_t sumOfW1st14 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13858  Double_t sumOfW2nd14 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13859  Double_t sumOfWW14 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(14); // W_{<cos(phi1)>} * W_{<cos(phi1+phi2)>}
13860  // numerator in the expression for the the unbiased estimator for covariance:
13861  Double_t numerator14 = product14 - term1st14*term2nd14; 
13862  // denominator in the expression for the the unbiased estimator for covariance:
13863  Double_t denominator14 = 0.;
13864  if(TMath::Abs(sumOfW1st14*sumOfW2nd14)>0.) 
13865  {  
13866   denominator14 = 1.-sumOfWW14/(sumOfW1st14*sumOfW2nd14);
13867   if(TMath::Abs(denominator14)>0.) 
13868   { 
13869    // covariance:
13870    Double_t covariance14 = numerator14/denominator14;
13871    // weight dependent prefactor for covariance:
13872    Double_t wPrefactor14 = sumOfWW14/(sumOfW1st14*sumOfW2nd14);
13873    // finally, store "weighted" covariance:
13874    fIntFlowCovariancesNUA->SetBinContent(14,wPrefactor14*covariance14);
13875   } // end of if(TMath::Abs(denominator14)>0.) 
13876  } // end of if(TMath::Abs(sumOfW1st14*sumOfW2nd14)>0.) 
13877
13878  // Cov(<cos(phi1)>,<sin(phi1+phi2)>):
13879  Double_t product15 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(15); // <<cos(phi1)><sin(phi1+phi2)>> 
13880  Double_t term1st15 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13881  Double_t term2nd15 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13882  Double_t sumOfW1st15 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13883  Double_t sumOfW2nd15 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13884  Double_t sumOfWW15 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(15); // W_{<cos(phi1)>} * W_{<sin(phi1+phi2)>}
13885  // numerator in the expression for the the unbiased estimator for covariance:
13886  Double_t numerator15 = product15 - term1st15*term2nd15; 
13887  // denominator in the expression for the the unbiased estimator for covariance:
13888  Double_t denominator15 = 0.;
13889  if(TMath::Abs(sumOfW1st15*sumOfW2nd15)>0.) 
13890  {  
13891   denominator15 = 1.-sumOfWW15/(sumOfW1st15*sumOfW2nd15);
13892   if(TMath::Abs(denominator15)>0.) 
13893   { 
13894    // covariance:
13895    Double_t covariance15 = numerator15/denominator15;
13896    // weight dependent prefactor for covariance:
13897    Double_t wPrefactor15 = sumOfWW15/(sumOfW1st15*sumOfW2nd15);
13898    // finally, store "weighted" covariance:
13899    fIntFlowCovariancesNUA->SetBinContent(15,wPrefactor15*covariance15);
13900   } // end of if(TMath::Abs(denominator15)>0.)  
13901  } // end of if(TMath::Abs(sumOfW1st15*sumOfW2nd15)>0.)  
13902  
13903  // Cov(<cos(phi1)>,<cos(phi1-phi2-phi3)>):
13904  Double_t product16 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(16); // <<cos(phi1)><cos(phi1-phi2-phi3)>> 
13905  Double_t term1st16 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13906  Double_t term2nd16 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13907  Double_t sumOfW1st16 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13908  Double_t sumOfW2nd16 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13909  Double_t sumOfWW16 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(16); // W_{<cos(phi1)>} * W_{<cos(phi1-phi2-phi3)>}
13910  // numerator in the expression for the the unbiased estimator for covariance:
13911  Double_t numerator16 = product16 - term1st16*term2nd16; 
13912  // denominator in the expression for the the unbiased estimator for covariance:
13913  Double_t denominator16 = 0.;
13914  if(TMath::Abs(sumOfW1st16*sumOfW2nd16)>0.) 
13915  {   
13916   denominator16 = 1.-sumOfWW16/(sumOfW1st16*sumOfW2nd16);
13917   if(TMath::Abs(denominator16)>0.) 
13918   {   
13919    // covariance:
13920    Double_t covariance16 = numerator16/denominator16;
13921    // weight dependent prefactor for covariance:
13922    Double_t wPrefactor16 = sumOfWW16/(sumOfW1st16*sumOfW2nd16);
13923    // finally, store "weighted" covariance:
13924    fIntFlowCovariancesNUA->SetBinContent(16,wPrefactor16*covariance16);
13925   } // end of if(TMath::Abs(denominator16)>0.)
13926  } // end ofif(TMath::Abs(sumOfW1st16*sumOfW2nd16)>0.)  
13927  
13928  // Cov(<cos(phi1)>,<sin(phi1-phi2-phi3)>):
13929  Double_t product17 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(17); // <<cos(phi1)><sin(phi1-phi2-phi3)>> 
13930  Double_t term1st17 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13931  Double_t term2nd17 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13932  Double_t sumOfW1st17 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13933  Double_t sumOfW2nd17 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13934  Double_t sumOfWW17 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(17); // W_{<cos(phi1)>} * W_{<sin(phi1-phi2-phi3)>}
13935  // numerator in the expression for the the unbiased estimator for covariance:
13936  Double_t numerator17 = product17 - term1st17*term2nd17; 
13937  // denominator in the expression for the the unbiased estimator for covariance:
13938  Double_t denominator17 = 0.;
13939  if(TMath::Abs(sumOfW1st17*sumOfW2nd17)>0.) 
13940  {
13941   denominator17 = 1.-sumOfWW17/(sumOfW1st17*sumOfW2nd17);
13942   if(TMath::Abs(denominator17)>0.) 
13943   {   
13944    // covariance:
13945    Double_t covariance17 = numerator17/denominator17;
13946    // weight dependent prefactor for covariance:
13947    Double_t wPrefactor17 = sumOfWW17/(sumOfW1st17*sumOfW2nd17);
13948     // finally, store "weighted" covariance:
13949    fIntFlowCovariancesNUA->SetBinContent(17,wPrefactor17*covariance17);
13950   } // end of if(TMath::Abs(denominator17)>0.) 
13951  } // end of if(TMath::Abs(sumOfW1st17*sumOfW2nd17)>0.) 
13952
13953  // Cov(<sin(phi1)>,<cos(phi1+phi2)>):
13954  Double_t product18 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(18); // <<sin(phi1)><cos(phi1+phi2)>> 
13955  Double_t term1st18 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
13956  Double_t term2nd18 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13957  Double_t sumOfW1st18 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
13958  Double_t sumOfW2nd18 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13959  Double_t sumOfWW18 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(18); // W_{<sin(phi1)>} * W_{<cos(phi1+phi2)>}
13960  // numerator in the expression for the the unbiased estimator for covariance:
13961  Double_t numerator18 = product18 - term1st18*term2nd18; 
13962  // denominator in the expression for the the unbiased estimator for covariance:
13963  Double_t denominator18 = 0.;
13964  if(TMath::Abs(sumOfW1st18*sumOfW2nd18)>0.) 
13965  { 
13966   denominator18 = 1.-sumOfWW18/(sumOfW1st18*sumOfW2nd18);
13967   if(TMath::Abs(denominator18)>0.) 
13968   {   
13969    // covariance:
13970    Double_t covariance18 = numerator18/denominator18;
13971    // weight dependent prefactor for covariance:
13972    Double_t wPrefactor18 = sumOfWW18/(sumOfW1st18*sumOfW2nd18);
13973    // finally, store "weighted" covariance:
13974    fIntFlowCovariancesNUA->SetBinContent(18,wPrefactor18*covariance18); 
13975   } // end of if(TMath::Abs(denominator18)>0.) 
13976  } // end of if(TMath::Abs(sumOfW1st18*sumOfW2nd18)>0.) 
13977
13978  // Cov(<sin(phi1)>,<sin(phi1+phi2)>):
13979  Double_t product19 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(19); // <<sin(phi1)><sin(phi1+phi2)>> 
13980  Double_t term1st19 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
13981  Double_t term2nd19 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13982  Double_t sumOfW1st19 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
13983  Double_t sumOfW2nd19 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13984  Double_t sumOfWW19 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(19); // W_{<sin(phi1)>} * W_{<sin(phi1+phi2)>}
13985  // numerator in the expression for the the unbiased estimator for covariance:
13986  Double_t numerator19 = product19 - term1st19*term2nd19; 
13987  // denominator in the expression for the the unbiased estimator for covariance:
13988  Double_t denominator19 = 0.;
13989  if(TMath::Abs(sumOfW1st19*sumOfW2nd19)>0.) 
13990  { 
13991   denominator19 = 1.-sumOfWW19/(sumOfW1st19*sumOfW2nd19);
13992   if(TMath::Abs(denominator19)>0.) 
13993   {   
13994    // covariance:
13995    Double_t covariance19 = numerator19/denominator19;
13996    // weight dependent prefactor for covariance:
13997    Double_t wPrefactor19 = sumOfWW19/(sumOfW1st19*sumOfW2nd19);
13998    // finally, store "weighted" covariance:
13999    fIntFlowCovariancesNUA->SetBinContent(19,wPrefactor19*covariance19);
14000   } // end of if(TMath::Abs(denominator19)>0.)
14001  } // end of if(TMath::Abs(sumOfW1st19*sumOfW2nd19)>0.)
14002  
14003  // Cov(<sin(phi1)>,<cos(phi1-phi2-phi3)>):
14004  Double_t product20 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(20); // <<sin(phi1)><cos(phi1-phi2-phi3)>> 
14005  Double_t term1st20 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
14006  Double_t term2nd20 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
14007  Double_t sumOfW1st20 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
14008  Double_t sumOfW2nd20 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
14009  Double_t sumOfWW20 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(20); // W_{<sin(phi1)>} * W_{<cos(phi1-phi2-phi3)>}
14010  // numerator in the expression for the the unbiased estimator for covariance:
14011  Double_t numerator20 = product20 - term1st20*term2nd20; 
14012  // denominator in the expression for the the unbiased estimator for covariance:
14013  Double_t denominator20 = 0.;
14014  if(TMath::Abs(sumOfW1st20*sumOfW2nd20)>0.)
14015  { 
14016   denominator20 = 1.-sumOfWW20/(sumOfW1st20*sumOfW2nd20);
14017   if(TMath::Abs(denominator20)>0.) 
14018   { 
14019    // covariance:
14020    Double_t covariance20 = numerator20/denominator20;
14021    // weight dependent prefactor for covariance:
14022    Double_t wPrefactor20 = sumOfWW20/(sumOfW1st20*sumOfW2nd20);
14023    // finally, store "weighted" covariance:
14024    fIntFlowCovariancesNUA->SetBinContent(20,wPrefactor20*covariance20);
14025   } // end of if(TMath::Abs(denominator20)>0.) 
14026  } // end of if(TMath::Abs(sumOfW1st20*sumOfW2nd20)>0.)
14027
14028  // Cov(<sin(phi1)>,<sin(phi1-phi2-phi3)>):
14029  Double_t product21 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(21); // <<sin(phi1)><sin(phi1-phi2-phi3)>> 
14030  Double_t term1st21 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
14031  Double_t term2nd21 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
14032  Double_t sumOfW1st21 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
14033  Double_t sumOfW2nd21 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
14034  Double_t sumOfWW21 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(21); // W_{<sin(phi1)>} * W_{<sin(phi1-phi2-phi3)>}
14035  // numerator in the expression for the the unbiased estimator for covariance:
14036  Double_t numerator21 = product21 - term1st21*term2nd21; 
14037  // denominator in the expression for the the unbiased estimator for covariance:
14038  Double_t denominator21 = 0.;
14039  if(TMath::Abs(sumOfW1st21*sumOfW2nd21)>0.)
14040  { 
14041   denominator21 = 1.-sumOfWW21/(sumOfW1st21*sumOfW2nd21);
14042   if(TMath::Abs(denominator21)>0.) 
14043   {   
14044    // covariance:
14045    Double_t covariance21 = numerator21/denominator21;
14046    // weight dependent prefactor for covariance:
14047    Double_t wPrefactor21 = sumOfWW21/(sumOfW1st21*sumOfW2nd21);
14048    // finally, store "weighted" covariance:
14049    fIntFlowCovariancesNUA->SetBinContent(21,wPrefactor21*covariance21);
14050   } // end of if(TMath::Abs(denominator21)>0.)
14051  } // end of if(TMath::Abs(sumOfW1st21*sumOfW2nd21)>0.)
14052
14053  // Cov(<cos(phi1+phi2)>,<sin(phi1+phi2)>):
14054  Double_t product22 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(22); // <<cos(phi1+phi2)><sin(phi1+phi2)>> 
14055  Double_t term1st22 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
14056  Double_t term2nd22 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
14057  Double_t sumOfW1st22 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
14058  Double_t sumOfW2nd22 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
14059  Double_t sumOfWW22 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(22); // W_{<cos(phi1+phi2)>} * W_{<sin(phi1+phi2)>}
14060  // numerator in the expression for the the unbiased estimator for covariance:
14061  Double_t numerator22 = product22 - term1st22*term2nd22; 
14062  // denominator in the expression for the the unbiased estimator for covariance:
14063  Double_t denominator22 = 0.;
14064  if(TMath::Abs(sumOfW1st22*sumOfW2nd22)>0.)
14065  { 
14066   denominator22 = 1.-sumOfWW22/(sumOfW1st22*sumOfW2nd22);
14067   if(TMath::Abs(denominator22)>0.) 
14068   {   
14069    // covariance:
14070    Double_t covariance22 = numerator22/denominator22;
14071    // weight dependent prefactor for covariance:
14072    Double_t wPrefactor22 = sumOfWW22/(sumOfW1st22*sumOfW2nd22);
14073    // finally, store "weighted" covariance:
14074    fIntFlowCovariancesNUA->SetBinContent(22,wPrefactor22*covariance22);
14075   } // end of if(TMath::Abs(denominator22)>0.) 
14076  } // end of if(TMath::Abs(sumOfW1st22*sumOfW2nd22)>0.) 
14077
14078  // Cov(<cos(phi1+phi2)>,<cos(phi1-phi2-phi3)>):
14079  Double_t product23 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(23); // <<cos(phi1+phi2)><cos(phi1-phi2-phi3)>> 
14080  Double_t term1st23 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
14081  Double_t term2nd23 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
14082  Double_t sumOfW1st23 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
14083  Double_t sumOfW2nd23 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
14084  Double_t sumOfWW23 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(23); // W_{<cos(phi1+phi2)>} * W_{<cos(phi1-phi2-phi3)>}
14085  // numerator in the expression for the the unbiased estimator for covariance:
14086  Double_t numerator23 = product23 - term1st23*term2nd23; 
14087  // denominator in the expression for the the unbiased estimator for covariance:
14088  Double_t denominator23 = 0.;
14089  if(TMath::Abs(sumOfW1st23*sumOfW2nd23)>0.)
14090  {  
14091   denominator23 = 1.-sumOfWW23/(sumOfW1st23*sumOfW2nd23);
14092   if(TMath::Abs(denominator23)>0.) 
14093   {   
14094    // covariance:
14095    Double_t covariance23 = numerator23/denominator23;
14096    // weight dependent prefactor for covariance:
14097    Double_t wPrefactor23 = sumOfWW23/(sumOfW1st23*sumOfW2nd23);
14098    // finally, store "weighted" covariance:
14099    fIntFlowCovariancesNUA->SetBinContent(23,wPrefactor23*covariance23);
14100   } // end of if(TMath::Abs(denominator23)>0.) 
14101  } // end of if(TMath::Abs(sumOfW1st23*sumOfW2nd23)>0.)
14102  
14103  // Cov(<cos(phi1+phi2)>,<sin(phi1-phi2-phi3)>):
14104  Double_t product24 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(24); // <<cos(phi1+phi2)><sin(phi1-phi2-phi3)>> 
14105  Double_t term1st24 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
14106  Double_t term2nd24 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
14107  Double_t sumOfW1st24 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
14108  Double_t sumOfW2nd24 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
14109  Double_t sumOfWW24 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(24); // W_{<cos(phi1+phi2)>} * W_{<sin(phi1-phi2-phi3)>}
14110  // numerator in the expression for the the unbiased estimator for covariance:
14111  Double_t numerator24 = product24 - term1st24*term2nd24; 
14112  // denominator in the expression for the the unbiased estimator for covariance:
14113  Double_t denominator24 = 0.;
14114  if(TMath::Abs(sumOfW1st24*sumOfW2nd24)>0.)
14115  {   
14116   denominator24 = 1.-sumOfWW24/(sumOfW1st24*sumOfW2nd24);
14117   if(TMath::Abs(denominator24)>0.) 
14118   {   
14119    // covariance:
14120    Double_t covariance24 = numerator24/denominator24;
14121    // weight dependent prefactor for covariance:
14122    Double_t wPrefactor24 = sumOfWW24/(sumOfW1st24*sumOfW2nd24);
14123    // finally, store "weighted" covariance:
14124    fIntFlowCovariancesNUA->SetBinContent(24,wPrefactor24*covariance24);
14125   } // end of if(TMath::Abs(denominator24)>0.)  
14126  } // end of if(TMath::Abs(sumOfW1st24*sumOfW2nd24)>0.)
14127
14128  // Cov(<sin(phi1+phi2)>,<cos(phi1-phi2-phi3)>):
14129  Double_t product25 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(25); // <<sin(phi1+phi2)><cos(phi1-phi2-phi3)>> 
14130  Double_t term1st25 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
14131  Double_t term2nd25 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
14132  Double_t sumOfW1st25 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
14133  Double_t sumOfW2nd25 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
14134  Double_t sumOfWW25 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(25); // W_{<sin(phi1+phi2)>} * W_{<cos(phi1-phi2-phi3)>}
14135  // numerator in the expression for the the unbiased estimator for covariance:
14136  Double_t numerator25 = product25 - term1st25*term2nd25; 
14137  // denominator in the expression for the the unbiased estimator for covariance:
14138  Double_t denominator25 = 0.;
14139  if(TMath::Abs(sumOfW1st25*sumOfW2nd25)>0.)
14140  { 
14141   denominator25 = 1.-sumOfWW25/(sumOfW1st25*sumOfW2nd25);
14142   if(TMath::Abs(denominator25)>0.) 
14143   { 
14144    // covariance:
14145    Double_t covariance25 = numerator25/denominator25;
14146    // weight dependent prefactor for covariance:
14147    Double_t wPrefactor25 = sumOfWW25/(sumOfW1st25*sumOfW2nd25);
14148    // finally, store "weighted" covariance:
14149    fIntFlowCovariancesNUA->SetBinContent(25,wPrefactor25*covariance25);
14150   } // end of if(TMath::Abs(denominator25)>0.)
14151  } // end of if(TMath::Abs(sumOfW1st25*sumOfW2nd25)>0.)
14152  
14153  // Cov(<sin(phi1+phi2)>,<sin(phi1-phi2-phi3)>):
14154  Double_t product26 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(26); // <<sin(phi1+phi2)><sin(phi1-phi2-phi3)>> 
14155  Double_t term1st26 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
14156  Double_t term2nd26 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
14157  Double_t sumOfW1st26 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
14158  Double_t sumOfW2nd26 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
14159  Double_t sumOfWW26 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(26); // W_{<sin(phi1+phi2)>} * W_{<sin(phi1-phi2-phi3)>}
14160  // numerator in the expression for the the unbiased estimator for covariance:
14161  Double_t numerator26 = product26 - term1st26*term2nd26; 
14162  // denominator in the expression for the the unbiased estimator for covariance:
14163  Double_t denominator26 = 0.;
14164  if(TMath::Abs(sumOfW1st26*sumOfW2nd26)>0.)
14165  { 
14166   denominator26 = 1.-sumOfWW26/(sumOfW1st26*sumOfW2nd26);
14167   if(TMath::Abs(denominator26)>0.) 
14168   { 
14169    // covariance:
14170    Double_t covariance26 = numerator26/denominator26;
14171    // weight dependent prefactor for covariance:
14172    Double_t wPrefactor26 = sumOfWW26/(sumOfW1st26*sumOfW2nd26);
14173    // finally, store "weighted" covariance:
14174    fIntFlowCovariancesNUA->SetBinContent(26,wPrefactor26*covariance26);
14175   } // end of if(TMath::Abs(denominator26)>0.) 
14176  } // end of if(TMath::Abs(sumOfW1st26*sumOfW2nd26)>0.)
14177  
14178  // Cov(<cos(phi1-phi2-phi3)>,<sin(phi1-phi2-phi3)>):
14179  Double_t product27 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(27); // <<cos(phi1-phi2-phi3)><sin(phi1-phi2-phi3)>> 
14180  Double_t term1st27 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
14181  Double_t term2nd27 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
14182  Double_t sumOfW1st27 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
14183  Double_t sumOfW2nd27 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
14184  Double_t sumOfWW27 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(27); // W_{<cos(phi1-phi2-phi3)>} * W_{<sin(phi1-phi2-phi3)>}
14185  // numerator in the expression for the the unbiased estimator for covariance:
14186  Double_t numerator27 = product27 - term1st27*term2nd27; 
14187  // denominator in the expression for the the unbiased estimator for covariance:
14188  Double_t denominator27 = 0.;
14189  if(TMath::Abs(sumOfW1st27*sumOfW2nd27)>0.)
14190  { 
14191   denominator27 = 1.-sumOfWW27/(sumOfW1st27*sumOfW2nd27);
14192   if(TMath::Abs(denominator27)>0.) 
14193   { 
14194    // covariance:
14195    Double_t covariance27 = numerator27/denominator27;
14196    // weight dependent prefactor for covariance:
14197    Double_t wPrefactor27 = sumOfWW27/(sumOfW1st27*sumOfW2nd27);
14198    // finally, store "weighted" covariance:
14199    fIntFlowCovariancesNUA->SetBinContent(27,wPrefactor27*covariance27);
14200   } // end of if(TMath::Abs(denominator27)>0.) 
14201  } // end of if(TMath::Abs(sumOfW1st27*sumOfW2nd27)>0.)
14202  
14203 } // end of AliFlowAnalysisWithQCumulants::CalculateCovariancesNUAIntFlow()
14204
14205 //=======================================================================================================================
14206
14207 void AliFlowAnalysisWithQCumulants::FinalizeCorrelationsIntFlow() 
14208 {
14209  // From profile fIntFlowCorrelationsPro access measured correlations and spread, 
14210  // correctly calculate the statistical errors and store the final results and 
14211  // statistical errors for correlations in histogram fIntFlowCorrelationsHist.
14212  //
14213  // Remark: Statistical error of correlation is calculated as:
14214  //
14215  //          statistical error = termA * spread * termB:
14216  //          termA = sqrt{sum_{i=1}^{N} w^2}/(sum_{i=1}^{N} w)
14217  //          termB = 1/sqrt(1-termA^2)   
14218  //
14219    
14220  for(Int_t ci=1;ci<=4;ci++) // correlation index
14221  {
14222   if(fIntFlowCorrelationsPro->GetBinEffectiveEntries(ci) < 2 || fIntFlowSquaredCorrelationsPro->GetBinEffectiveEntries(ci) < 2)
14223   {
14224    fIntFlowCorrelationsPro->SetBinError(ci,0.);
14225    fIntFlowSquaredCorrelationsPro->SetBinError(ci,0.);
14226    continue;
14227   } 
14228   Double_t correlation = fIntFlowCorrelationsPro->GetBinContent(ci);
14229   Double_t squaredCorrelation = fIntFlowSquaredCorrelationsPro->GetBinContent(ci);
14230   Double_t spread = 0.;
14231   if(squaredCorrelation-correlation*correlation >= 0.)
14232   {
14233    spread = pow(squaredCorrelation-correlation*correlation,0.5);
14234   } else
14235     {
14236      cout<<endl;
14237      cout<<Form(" WARNING: Imaginary 'spread' for %d-particle correlation!!!! ",2*ci)<<endl;
14238      cout<<endl;
14239     }
14240   Double_t sumOfLinearEventWeights = fIntFlowSumOfEventWeights[0]->GetBinContent(ci);
14241   Double_t sumOfQuadraticEventWeights = fIntFlowSumOfEventWeights[1]->GetBinContent(ci);
14242   Double_t termA = 0.;
14243   Double_t termB = 0.;
14244   if(TMath::Abs(sumOfLinearEventWeights) > 0.) // to be improved - shall I omitt here Abs() ?
14245   {
14246    termA = pow(sumOfQuadraticEventWeights,0.5)/sumOfLinearEventWeights;
14247   } else
14248     {
14249      cout<<endl;
14250      cout<<" WARNING (QC): sumOfLinearEventWeights == 0 in method FinalizeCorrelationsIntFlow() !!!!"<<endl;
14251      cout<<"               (for "<<2*ci<<"-particle correlation)"<<endl;
14252      cout<<endl;
14253     }
14254   if(1.-pow(termA,2.) > 0.)
14255   {
14256    termB = 1./pow(1-pow(termA,2.),0.5);
14257   } else
14258     {
14259      cout<<endl;
14260      cout<<" WARNING (QC): 1.-pow(termA,2.) <= 0 in method FinalizeCorrelationsIntFlow() !!!!"<<endl;   
14261      cout<<"               (for "<<2*ci<<"-particle correlation)"<<endl;
14262      cout<<endl;
14263     }     
14264   Double_t statisticalError = termA * spread * termB;
14265   fIntFlowCorrelationsHist->SetBinContent(ci,correlation);
14266   fIntFlowCorrelationsHist->SetBinError(ci,statisticalError);
14267  } // end of for(Int_t ci=1;ci<=4;ci++) // correlation index     
14268  
14269  // Versus multiplicity: 
14270  if(!fCalculateCumulantsVsM){return;}
14271  for(Int_t ci=0;ci<=3;ci++) // correlation index
14272  {
14273   Int_t nBins = fIntFlowCorrelationsVsMPro[ci]->GetNbinsX(); 
14274   for(Int_t b=1;b<=nBins;b++) // looping over multiplicity bins
14275   {
14276    if(fIntFlowCorrelationsVsMPro[ci]->GetBinEffectiveEntries(b) < 2 || fIntFlowSquaredCorrelationsVsMPro[ci]->GetBinEffectiveEntries(b) < 2)
14277    {
14278     fIntFlowCorrelationsVsMPro[ci]->SetBinError(b,0.);
14279     fIntFlowSquaredCorrelationsVsMPro[ci]->SetBinError(b,0.);
14280     continue;
14281    } 
14282    Double_t correlationVsM = fIntFlowCorrelationsVsMPro[ci]->GetBinContent(b);
14283    Double_t squaredCorrelationVsM = fIntFlowSquaredCorrelationsVsMPro[ci]->GetBinContent(b);
14284    Double_t spreadVsM = 0.;
14285    if(squaredCorrelationVsM-correlationVsM*correlationVsM >= 0.)
14286    {
14287     spreadVsM = pow(squaredCorrelationVsM-correlationVsM*correlationVsM,0.5);
14288    } else
14289      {
14290       cout<<endl;
14291       cout<<Form(" WARNING (QC): Imaginary 'spreadVsM' for ci = %d, bin = %d, entries = %f !!!!",
14292                  ci,b,fIntFlowCorrelationsVsMPro[ci]->GetBinEffectiveEntries(b))<<endl; 
14293       cout<<endl;
14294      }     
14295    Double_t sumOfLinearEventWeightsVsM = fIntFlowSumOfEventWeightsVsM[ci][0]->GetBinContent(b);
14296    Double_t sumOfQuadraticEventWeightsVsM = fIntFlowSumOfEventWeightsVsM[ci][1]->GetBinContent(b);
14297    Double_t termAVsM = 0.;
14298    Double_t termBVsM = 0.;
14299    if(sumOfLinearEventWeightsVsM > 0.) 
14300    {
14301     termAVsM = pow(sumOfQuadraticEventWeightsVsM,0.5)/sumOfLinearEventWeightsVsM;
14302    }
14303    if(1.-pow(termAVsM,2.) > 0.)
14304    {
14305     termBVsM = 1./pow(1-pow(termAVsM,2.),0.5);
14306    }     
14307    Double_t statisticalErrorVsM = termAVsM * spreadVsM * termBVsM;
14308    fIntFlowCorrelationsVsMHist[ci]->SetBinContent(b,correlationVsM);
14309    fIntFlowCorrelationsVsMHist[ci]->SetBinError(b,statisticalErrorVsM);  
14310   } // end of for(Int_t b=1;b<=nBins;b++)
14311  } // end of for(Int_t ci=1;ci<=4;ci++) // correlation index                                                        
14312                                                                                                                            
14313 } // end of AliFlowAnalysisWithQCumulants::FinalizeCorrelationsIntFlow()
14314
14315 //=======================================================================================================================
14316
14317 void AliFlowAnalysisWithQCumulants::FillAverageMultiplicities(Int_t nRP)
14318 {
14319  // Fill profile fAverageMultiplicity to hold average multiplicities and 
14320  // number of events for events with nRP>=0, nRP>=1, ... , and nRP>=8
14321  
14322  // Binning of fAverageMultiplicity is organized as follows:
14323  //  1st bin: all events (including the empty ones)
14324  //  2nd bin: event with # of RPs greater or equal to 1
14325  //  3rd bin: event with # of RPs greater or equal to 2
14326  //  4th bin: event with # of RPs greater or equal to 3
14327  //  5th bin: event with # of RPs greater or equal to 4
14328  //  6th bin: event with # of RPs greater or equal to 5
14329  //  7th bin: event with # of RPs greater or equal to 6
14330  //  8th bin: event with # of RPs greater or equal to 7
14331  //  9th bin: event with # of RPs greater or equal to 8
14332  
14333  if(nRP<0)
14334  {
14335   cout<<endl;
14336   cout<<" WARNING (QC): nRP<0 in in AFAWQC::FAM() !!!!"<<endl;
14337   cout<<endl;
14338   exit(0);
14339  }
14340  
14341  for(Int_t i=0;i<9;i++)
14342  {
14343   if(nRP>=i){fAvMultiplicity->Fill(i+0.5,nRP,1);}
14344  }
14345  
14346 } // end of AliFlowAnalysisWithQCumulants::FillAverageMultiplicities(nRP)
14347
14348 //=======================================================================================================================
14349
14350 void AliFlowAnalysisWithQCumulants::CalculateCumulantsIntFlow()
14351
14352  // a) Calculate Q-cumulants from the measured multiparticle correlations;
14353  // b) Propagate the statistical errors from measured multiparticle correlations to statistical errors of Q-cumulants;  
14354  // c) Remark: Q-cumulants calculated in this method are biased by non-uniform acceptance of detector !!!! 
14355  //            Method CalculateQcumulantsCorrectedForNUAIntFlow() is called afterwards to correct for this bias;
14356  // d) Store the results and statistical error of Q-cumulants in histogram fIntFlowQcumulants.
14357  //    Binning of fIntFlowQcumulants is organized as follows:
14358  //
14359  //            1st bin: QC{2}
14360  //            2nd bin: QC{4}
14361  //            3rd bin: QC{6}
14362  //            4th bin: QC{8}
14363  //
14364  
14365  // Correlations:
14366  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>> 
14367  Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>>  
14368  Double_t six = fIntFlowCorrelationsHist->GetBinContent(3); // <<6>> 
14369  Double_t eight = fIntFlowCorrelationsHist->GetBinContent(4); // <<8>>  
14370  // Statistical errors of average 2-, 4-, 6- and 8-particle azimuthal correlations:
14371  Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1); // statistical error of <2>  
14372  Double_t fourError = fIntFlowCorrelationsHist->GetBinError(2); // statistical error of <4>   
14373  Double_t sixError = fIntFlowCorrelationsHist->GetBinError(3); // statistical error of <6> 
14374  Double_t eightError = fIntFlowCorrelationsHist->GetBinError(4); // statistical error of <8> 
14375  // Covariances (multiplied by prefactor depending on weights - see comments in CalculateCovariancesIntFlow()):
14376  Double_t wCov24 = 0.; // Cov(<2>,<4>) * prefactor(w_<2>,w_<4>)
14377  Double_t wCov26 = 0.; // Cov(<2>,<6>) * prefactor(w_<2>,w_<6>)
14378  Double_t wCov28 = 0.; // Cov(<2>,<8>) * prefactor(w_<2>,w_<8>)
14379  Double_t wCov46 = 0.; // Cov(<4>,<6>) * prefactor(w_<4>,w_<6>)
14380  Double_t wCov48 = 0.; // Cov(<4>,<8>) * prefactor(w_<4>,w_<8>)
14381  Double_t wCov68 = 0.; // Cov(<6>,<8>) * prefactor(w_<6>,w_<8>)  
14382  if(!fForgetAboutCovariances)
14383  {
14384   wCov24 = fIntFlowCovariances->GetBinContent(1); // Cov(<2>,<4>) * prefactor(w_<2>,w_<4>)
14385   wCov26 = fIntFlowCovariances->GetBinContent(2); // Cov(<2>,<6>) * prefactor(w_<2>,w_<6>)
14386   wCov28 = fIntFlowCovariances->GetBinContent(3); // Cov(<2>,<8>) * prefactor(w_<2>,w_<8>)
14387   wCov46 = fIntFlowCovariances->GetBinContent(4); // Cov(<4>,<6>) * prefactor(w_<4>,w_<6>)
14388   wCov48 = fIntFlowCovariances->GetBinContent(5); // Cov(<4>,<8>) * prefactor(w_<4>,w_<8>)
14389   wCov68 = fIntFlowCovariances->GetBinContent(6); // Cov(<6>,<8>) * prefactor(w_<6>,w_<8>) 
14390  }
14391  // Q-cumulants: 
14392  Double_t qc2 = 0.; // QC{2}
14393  Double_t qc4 = 0.; // QC{4}
14394  Double_t qc6 = 0.; // QC{6}
14395  Double_t qc8 = 0.; // QC{8}
14396  if(TMath::Abs(two) > 0.){qc2 = two;} 
14397  if(TMath::Abs(four) > 0.){qc4 = four-2.*pow(two,2.);} 
14398  if(TMath::Abs(six) > 0.){qc6 = six-9.*two*four+12.*pow(two,3.);} 
14399  if(TMath::Abs(eight) > 0.){qc8 = eight-16.*two*six-18.*pow(four,2.)+144.*pow(two,2.)*four-144.*pow(two,4.);} 
14400  // Statistical errors of Q-cumulants:       
14401  Double_t qc2Error = 0.;
14402  Double_t qc4Error = 0.;
14403  Double_t qc6Error = 0.;
14404  Double_t qc8Error = 0.; 
14405  // Squared statistical errors of Q-cumulants:       
14406  //Double_t qc2ErrorSquared = 0.;
14407  Double_t qc4ErrorSquared = 0.;
14408  Double_t qc6ErrorSquared = 0.;
14409  Double_t qc8ErrorSquared = 0.;        
14410  // Statistical error of QC{2}:              
14411  qc2Error = twoError;                                                 
14412  // Statistical error of QC{4}:              
14413  qc4ErrorSquared = 16.*pow(two,2.)*pow(twoError,2)+pow(fourError,2.)
14414                  - 8.*two*wCov24;                     
14415  if(qc4ErrorSquared>0.)
14416  {
14417   qc4Error = pow(qc4ErrorSquared,0.5);
14418  } else 
14419    {
14420     cout<<" WARNING (QC): Statistical error of QC{4} is imaginary !!!!"<<endl;
14421    }                                           
14422  // Statistical error of QC{6}:              
14423  qc6ErrorSquared = 81.*pow(4.*pow(two,2.)-four,2.)*pow(twoError,2.)
14424                  + 81.*pow(two,2.)*pow(fourError,2.)
14425                  + pow(sixError,2.)
14426                  - 162.*two*(4.*pow(two,2.)-four)*wCov24
14427                  + 18.*(4.*pow(two,2.)-four)*wCov26
14428                  - 18.*two*wCov46;                     
14429  if(qc6ErrorSquared>0.)
14430  {
14431   qc6Error = pow(qc6ErrorSquared,0.5);
14432  } else 
14433    {
14434     cout<<" WARNING (QC): Statistical error of QC{6} is imaginary !!!!"<<endl;
14435    }                       
14436  // Statistical error of QC{8}:              
14437  qc8ErrorSquared = 256.*pow(36.*pow(two,3.)-18.*four*two+six,2.)*pow(twoError,2.)
14438                  + 1296.*pow(4.*pow(two,2.)-four,2.)*pow(fourError,2.)
14439                  + 256.*pow(two,2.)*pow(sixError,2.)
14440                  + pow(eightError,2.)
14441                  - 1152.*(36.*pow(two,3.)-18.*four*two+six)*(4.*pow(two,2.)-four)*wCov24
14442                  + 512.*two*(36.*pow(two,3.)-18.*four*two+six)*wCov26
14443                  - 32.*(36.*pow(two,3.)-18.*four*two+six)*wCov28
14444                  - 1152.*two*(4.*pow(two,2.)-four)*wCov46
14445                  + 72.*(4.*pow(two,2.)-four)*wCov48
14446                  - 32.*two*wCov68;      
14447  if(qc8ErrorSquared>0.)
14448  {
14449   qc8Error = pow(qc8ErrorSquared,0.5);
14450  } else 
14451    {
14452     cout<<"WARNING (QC): Statistical error of QC{8} is imaginary !!!!"<<endl;
14453    }
14454  // Store the results and statistical errors for Q-cumulants:
14455  if(TMath::Abs(qc2)>0.)
14456  {
14457   fIntFlowQcumulants->SetBinContent(1,qc2);
14458   fIntFlowQcumulants->SetBinError(1,qc2Error);
14459  }
14460  if(TMath::Abs(qc4)>0.)
14461  {
14462   fIntFlowQcumulants->SetBinContent(2,qc4);
14463   fIntFlowQcumulants->SetBinError(2,qc4Error);
14464  }
14465  if(TMath::Abs(qc6)>0.)
14466  {
14467   fIntFlowQcumulants->SetBinContent(3,qc6);
14468   fIntFlowQcumulants->SetBinError(3,qc6Error);
14469  }
14470  if(TMath::Abs(qc8)>0.)
14471  {
14472   fIntFlowQcumulants->SetBinContent(4,qc8); 
14473   fIntFlowQcumulants->SetBinError(4,qc8Error);
14474  } 
14475  
14476  // Versus multiplicity: 
14477  if(!fCalculateCumulantsVsM){return;}
14478  Int_t nBins = fIntFlowCorrelationsVsMPro[0]->GetNbinsX(); // tbi (hardwired 0) 
14479  Double_t value[4] = {0.}; // QCs vs M
14480  Double_t error[4] = {0.}; // error of QCs vs M
14481  Double_t dSum1[4] = {0.}; // sum value_i/(error_i)^2
14482  Double_t dSum2[4] = {0.}; // sum 1/(error_i)^2
14483  two = 0.; // TBI can be done safer, lines below included 
14484  twoError = 0.;
14485  four = 0.;
14486  fourError = 0.;
14487  six = 0.;
14488  sixError = 0.;
14489  eight = 0.;
14490  eightError = 0.;
14491  wCov24 = 0.;
14492  wCov26 = 0.; 
14493  wCov28 = 0.; 
14494  wCov46 = 0.; 
14495  wCov48 = 0.; 
14496  wCov68 = 0.; 
14497  for(Int_t b=1;b<=nBins;b++)
14498  {
14499   // Correlations:
14500   if(!fUse2DHistograms)
14501   {
14502    if(!fUseQvectorTerms)
14503    {
14504
14505      //cout<<"TProfile"<<endl;
14506
14507     two = fIntFlowCorrelationsVsMHist[0]->GetBinContent(b); // <<2>>  
14508     four = fIntFlowCorrelationsVsMHist[1]->GetBinContent(b); // <<4>>  
14509     six = fIntFlowCorrelationsVsMHist[2]->GetBinContent(b); // <<6>> 
14510     eight = fIntFlowCorrelationsVsMHist[3]->GetBinContent(b); // <<8>>  
14511    } // end of if(!fUseQvectorTerms) 
14512   } else
14513     {
14514      // TH2D:
14515
14516      //cout<<"TH2D"<<endl;
14517
14518      two = fCorrelation2468VsMult[0]->ProjectionY("2",b,b)->GetMean(); // <<2>>  
14519      four = fCorrelation2468VsMult[1]->ProjectionY("4",b,b)->GetMean(); // <<4>>
14520      six = fCorrelation2468VsMult[2]->ProjectionY("6",b,b)->GetMean(); // <<6>>
14521      eight = fCorrelation2468VsMult[3]->ProjectionY("8",b,b)->GetMean(); // <<8>>
14522     } 
14523   if(fUseQvectorTerms)
14524   {
14525    Double_t dM = fIntFlowCorrelationsVsMPro[0]->GetBinLowEdge(b);
14526    if(dM>3.) // TBI re-think this if statement
14527    {
14528
14529     //cout<<"Q-vector terms"<<endl;
14530
14531     two = (fQvectorTermsVsMult[0]->ProjectionY("qvt0a",b,b)->GetMean()-1.)/(dM-1.);    
14532     Double_t dTerm1 = (dM*(2.*dM-1.))*fQvectorTermsVsMult[2]->ProjectionY("qvt2",b,b)->GetMean();
14533     Double_t dTerm2 = dM*fQvectorTermsVsMult[1]->ProjectionY("qvt1",b,b)->GetMean();
14534     Double_t dTerm3 = -2.*pow(dM,1.5)*fQvectorTermsVsMult[3]->ProjectionY("qvt3",b,b)->GetMean();
14535     Double_t dTerm4 = -4.*(dM-2.)*dM*fQvectorTermsVsMult[0]->ProjectionY("qvt0b",b,b)->GetMean();
14536     Double_t dTerm5 = 2.*dM*(dM-3.); 
14537     four = (dTerm1+dTerm2+dTerm3+dTerm4+dTerm5)/(dM*(dM-1.)*(dM-2.)*(dM-3.));
14538    } // end of if(dM>3.) // TBI rethink this if statement
14539   } // end of else if(fUseQvectorTerms) 
14540   // Statistical errors of average 2-, 4-, 6- and 8-particle azimuthal correlations:
14541   if(!fUse2DHistograms)
14542   {
14543    if(!fUseQvectorTerms)
14544    {
14545     twoError = fIntFlowCorrelationsVsMHist[0]->GetBinError(b); // <2> error  
14546     fourError = fIntFlowCorrelationsVsMHist[1]->GetBinError(b); // <4> error    
14547     sixError = fIntFlowCorrelationsVsMHist[2]->GetBinError(b); // <6> error  
14548     eightError = fIntFlowCorrelationsVsMHist[3]->GetBinError(b); // <8> error  
14549    }
14550   } else
14551     {
14552      // TH2D:
14553      twoError = fCorrelation2468VsMult[0]->ProjectionY("2",b,b)->GetMeanError(); // <2> error
14554      fourError = fCorrelation2468VsMult[1]->ProjectionY("4",b,b)->GetMeanError(); // <4> error 
14555      sixError = fCorrelation2468VsMult[2]->ProjectionY("6",b,b)->GetMeanError(); // <6> error 
14556      eightError = fCorrelation2468VsMult[3]->ProjectionY("8",b,b)->GetMeanError(); // <8> error 
14557     } // end of else
14558   if(fUseQvectorTerms)
14559   {
14560    Double_t dM = fIntFlowCorrelationsVsMPro[0]->GetBinLowEdge(b);
14561    if(dM>3.) // TBI re-think this if statement
14562    {
14563     twoError = (fQvectorTermsVsMult[0]->ProjectionY("qvt0a",b,b)->GetMeanError())/(dM-1.); 
14564    }
14565   } // end of if(fUseQvectorTerms)
14566
14567   // Covariances (multiplied by prefactor depending on weights - see comments in CalculateCovariancesIntFlow()):
14568   if(!fForgetAboutCovariances)
14569   {
14570    if(!fUse2DHistograms)
14571    {
14572     if(!fUseQvectorTerms)
14573     {
14574      wCov24 = fIntFlowCovariancesVsM[0]->GetBinContent(b); // Cov(<2>,<4>) * prefactor(w_<2>,w_<4>)
14575      wCov26 = fIntFlowCovariancesVsM[1]->GetBinContent(b); // Cov(<2>,<6>) * prefactor(w_<2>,w_<6>)
14576      wCov28 = fIntFlowCovariancesVsM[2]->GetBinContent(b); // Cov(<2>,<8>) * prefactor(w_<2>,w_<8>)
14577      wCov46 = fIntFlowCovariancesVsM[3]->GetBinContent(b); // Cov(<4>,<6>) * prefactor(w_<4>,w_<6>)
14578      wCov48 = fIntFlowCovariancesVsM[4]->GetBinContent(b); // Cov(<4>,<8>) * prefactor(w_<4>,w_<8>)
14579      wCov68 = fIntFlowCovariancesVsM[5]->GetBinContent(b); // Cov(<6>,<8>) * prefactor(w_<6>,w_<8>) 
14580     }
14581    } else
14582      {
14583       // TH2D:
14584        Int_t nEntries = (Int_t)(fCorrelationProduct2468VsMult[0]->ProjectionY("Cov(2,4)",b,b)->GetEntries());
14585       if(nEntries>0.)
14586       {      
14587        wCov24 = (fCorrelationProduct2468VsMult[0]->ProjectionY("Cov(2,4)",b,b)->GetMean()
14588               - (fCorrelation2468VsMult[0]->ProjectionY("2cov",b,b)->GetMean()) 
14589               * (fCorrelation2468VsMult[1]->ProjectionY("4cov",b,b)->GetMean()))
14590               / nEntries; // w*Cov(<2>,<4>)
14591       } // end of if(nEntries>0. && dn2pCombinations>0. && dn4pCombinations>0.)
14592       // ... TBI add other covariances as well 
14593      }
14594   } // end of if(!fForgetAboutCovariances)
14595   // Q-cumulants: 
14596   qc2 = 0.; // QC{2}
14597   qc4 = 0.; // QC{4}
14598   qc6 = 0.; // QC{6}
14599   qc8 = 0.; // QC{8}
14600   if(TMath::Abs(two) > 0.){qc2 = two;} 
14601   if(TMath::Abs(four) > 0.){qc4 = four-2.*pow(two,2.);} 
14602   if(TMath::Abs(six) > 0.){qc6 = six-9.*two*four+12.*pow(two,3.);} 
14603   if(TMath::Abs(eight) > 0.){qc8 = eight-16.*two*six-18.*pow(four,2.)+144.*pow(two,2.)*four-144.*pow(two,4.);}  
14604   // Statistical errors of Q-cumulants:       
14605   qc2Error = 0.;
14606   qc4Error = 0.;
14607   qc6Error = 0.;
14608   qc8Error = 0.; 
14609   // Squared statistical errors of Q-cumulants:       
14610   //Double_t qc2ErrorSquared = 0.;
14611   qc4ErrorSquared = 0.;
14612   qc6ErrorSquared = 0.;
14613   qc8ErrorSquared = 0.;    
14614   // Statistical error of QC{2}:              
14615   qc2Error = twoError;                                             
14616   // Statistical error of QC{4}:              
14617   qc4ErrorSquared = 16.*pow(two,2.)*pow(twoError,2)+pow(fourError,2.)
14618                   - 8.*two*wCov24;  
14619   if(fUseQvectorTerms){qc4ErrorSquared = 0.01*pow(qc4,2.);} // TBI for the time being use bootstrap and ignore this error completely, this method needs an urgent clean-up, as the code is getting fragile here :'(                   
14620   if(qc4ErrorSquared>0.)
14621   {
14622    qc4Error = pow(qc4ErrorSquared,0.5);
14623   } else 
14624     {
14625      // cout<<"WARNING: Statistical error of QC{4} is imaginary in multiplicity bin "<<b<<" !!!!"<<endl;
14626     }                                       
14627   // Statistical error of QC{6}:              
14628   qc6ErrorSquared = 81.*pow(4.*pow(two,2.)-four,2.)*pow(twoError,2.)
14629                   + 81.*pow(two,2.)*pow(fourError,2.)
14630                   + pow(sixError,2.)
14631                   - 162.*two*(4.*pow(two,2.)-four)*wCov24
14632                   + 18.*(4.*pow(two,2.)-four)*wCov26
14633                   - 18.*two*wCov46;                     
14634   if(qc6ErrorSquared>0.)
14635   {
14636    qc6Error = pow(qc6ErrorSquared,0.5);
14637   } else 
14638     {
14639      // cout<<"WARNING: Statistical error of QC{6} is imaginary in multiplicity bin "<<b<<" !!!!"<<endl;
14640     }                            
14641   // Statistical error of QC{8}:              
14642   qc8ErrorSquared = 256.*pow(36.*pow(two,3.)-18.*four*two+six,2.)*pow(twoError,2.)
14643                   + 1296.*pow(4.*pow(two,2.)-four,2.)*pow(fourError,2.)
14644                   + 256.*pow(two,2.)*pow(sixError,2.)
14645                   + pow(eightError,2.)
14646                   - 1152.*(36.*pow(two,3.)-18.*four*two+six)*(4.*pow(two,2.)-four)*wCov24
14647                   + 512.*two*(36.*pow(two,3.)-18.*four*two+six)*wCov26
14648                   - 32.*(36.*pow(two,3.)-18.*four*two+six)*wCov28
14649                   - 1152.*two*(4.*pow(two,2.)-four)*wCov46
14650                   + 72.*(4.*pow(two,2.)-four)*wCov48
14651                   - 32.*two*wCov68;      
14652   if(qc8ErrorSquared>0.)
14653   {
14654    qc8Error = pow(qc8ErrorSquared,0.5);
14655   } else 
14656     {
14657      // cout<<"WARNING: Statistical error of QC{8} is imaginary in multiplicity bin "<<b<<" !!!!"<<endl;
14658     }
14659   // Store the results and statistical errors for Q-cumulants:
14660   if(TMath::Abs(qc2)>0.)
14661   {
14662    fIntFlowQcumulantsVsM[0]->SetBinContent(b,qc2);
14663    fIntFlowQcumulantsVsM[0]->SetBinError(b,qc2Error);  
14664   }
14665   if(TMath::Abs(qc4)>0.)
14666   {
14667    fIntFlowQcumulantsVsM[1]->SetBinContent(b,qc4);  
14668    fIntFlowQcumulantsVsM[1]->SetBinError(b,qc4Error);
14669   }
14670   if(TMath::Abs(qc6)>0.)
14671   {
14672    fIntFlowQcumulantsVsM[2]->SetBinContent(b,qc6); 
14673    fIntFlowQcumulantsVsM[2]->SetBinError(b,qc6Error);
14674   }
14675   if(TMath::Abs(qc8)>0.)
14676   {  
14677    fIntFlowQcumulantsVsM[3]->SetBinContent(b,qc8);
14678    fIntFlowQcumulantsVsM[3]->SetBinError(b,qc8Error);
14679   } 
14680   // Rebin in M:
14681   for(Int_t co=0;co<4;co++)
14682   {
14683    if(fIntFlowCorrelationsVsMPro[co]->GetBinEffectiveEntries(b)<2){continue;}
14684    value[co] = fIntFlowQcumulantsVsM[co]->GetBinContent(b);
14685    error[co] = fIntFlowQcumulantsVsM[co]->GetBinError(b);
14686    if(error[co]>0.)
14687    {
14688     dSum1[co]+=value[co]/(error[co]*error[co]);
14689     dSum2[co]+=1./(error[co]*error[co]);
14690    }
14691   } // end of for(Int_t co=0;co<4;co++) 
14692  } // end of for(Int_t b=1;b<=nBins;b++)
14693  // Store rebinned Q-cumulants:
14694  for(Int_t co=0;co<4;co++)
14695  {
14696   if(dSum2[co]>0.)
14697   {
14698    fIntFlowQcumulantsRebinnedInM->SetBinContent(co+1,dSum1[co]/dSum2[co]);
14699    fIntFlowQcumulantsRebinnedInM->SetBinError(co+1,pow(1./dSum2[co],0.5));
14700   }
14701  } // end of for(Int_t co=0;co<4;co++)
14702  
14703 } // end of void AliFlowAnalysisWithQCumulants::CalculateCumulantsIntFlow()
14704
14705 //================================================================================================================================ 
14706
14707 void AliFlowAnalysisWithQCumulants::CalculateCumulantsForBootstrap()
14708 {
14709  // Calculate cumulants for bootstrap.
14710
14711  if(fUseBootstrap)
14712  {
14713   for(Int_t ss=0;ss<fnSubsamples;ss++)
14714   {
14715    // Correlations:
14716    Double_t two = fBootstrapCorrelations->GetBinContent(fBootstrapCorrelations->GetBin(1,ss+1)); 
14717    Double_t four = fBootstrapCorrelations->GetBinContent(fBootstrapCorrelations->GetBin(2,ss+1)); 
14718    Double_t six = fBootstrapCorrelations->GetBinContent(fBootstrapCorrelations->GetBin(3,ss+1)); 
14719    Double_t eight = fBootstrapCorrelations->GetBinContent(fBootstrapCorrelations->GetBin(4,ss+1)); 
14720    // Q-cumulants:
14721    Double_t qc2 = 0.; // QC{2}
14722    Double_t qc4 = 0.; // QC{4}
14723    Double_t qc6 = 0.; // QC{6}
14724    Double_t qc8 = 0.; // QC{8}
14725    if(TMath::Abs(two) > 0.){qc2 = two;} 
14726    if(TMath::Abs(four) > 0.){qc4 = four-2.*pow(two,2.);} 
14727    if(TMath::Abs(six) > 0.){qc6 = six-9.*two*four+12.*pow(two,3.);} 
14728    if(TMath::Abs(eight) > 0.){qc8 = eight-16.*two*six-18.*pow(four,2.)+144.*pow(two,2.)*four-144.*pow(two,4.);}  
14729    fBootstrapCumulants->SetBinContent(fBootstrapCumulants->GetBin(1,ss+1),qc2); 
14730    fBootstrapCumulants->SetBinContent(fBootstrapCumulants->GetBin(2,ss+1),qc4); 
14731    fBootstrapCumulants->SetBinContent(fBootstrapCumulants->GetBin(3,ss+1),qc6); 
14732    fBootstrapCumulants->SetBinContent(fBootstrapCumulants->GetBin(4,ss+1),qc8); 
14733    /*
14734    if(qc2>=0.){fBootstrapCumulants->SetBinContent(fBootstrapCumulants->GetBin(1,ss+1),pow(qc2,0.5));}
14735    if(qc4<=0.){fBootstrapCumulants->SetBinContent(fBootstrapCumulants->GetBin(2,ss+1),pow(-1.*qc4,1./4.));} 
14736    if(qc6>=0.){fBootstrapCumulants->SetBinContent(fBootstrapCumulants->GetBin(3,ss+1),pow((1./4.)*qc6,1./6.));}
14737    if(qc8<=0.){fBootstrapCumulants->SetBinContent(fBootstrapCumulants->GetBin(4,ss+1),pow((-1./33.)*qc8,1./8.));}  
14738    cout<<"Subsample #"<<ss<<":"<<endl;   
14739    cout<<"v2{2} = "<<pow(qc2,0.5)<<endl;
14740    cout<<"v2{4} = "<<pow(-1.*qc4,1./4.)<<endl;
14741    cout<<"v2{6} = "<<pow((1./4.)*qc6,1./6.)<<endl;
14742    cout<<"v2{8} = "<<pow((-1./33.)*qc8,1./8.)<<endl;
14743    cout<<endl;
14744    */
14745   } // end of for(Int_t ss=0;ss<fnSubsamples;ss++)
14746  } // end of if(fUseBootstrap)
14747
14748  if(fUseBootstrapVsM)  
14749  {
14750   for(Int_t mb=1;mb<=fnBinsMult;mb++)
14751   {
14752    for(Int_t ss=0;ss<fnSubsamples;ss++) 
14753    {
14754     // Correlations:
14755     Double_t two = fBootstrapCorrelationsVsM[0]->GetBinContent(fBootstrapCorrelationsVsM[0]->GetBin(mb,ss+1)); 
14756     Double_t four = fBootstrapCorrelationsVsM[1]->GetBinContent(fBootstrapCorrelationsVsM[1]->GetBin(mb,ss+1)); 
14757     Double_t six = fBootstrapCorrelationsVsM[2]->GetBinContent(fBootstrapCorrelationsVsM[2]->GetBin(mb,ss+1)); 
14758     Double_t eight = fBootstrapCorrelationsVsM[3]->GetBinContent(fBootstrapCorrelationsVsM[3]->GetBin(mb,ss+1)); 
14759     // Q-cumulants:
14760     Double_t qc2 = 0.; // QC{2}
14761     Double_t qc4 = 0.; // QC{4}
14762     Double_t qc6 = 0.; // QC{6}
14763     Double_t qc8 = 0.; // QC{8}
14764     if(TMath::Abs(two) > 0.){qc2 = two;} 
14765     if(TMath::Abs(four) > 0.){qc4 = four-2.*pow(two,2.);} 
14766     if(TMath::Abs(six) > 0.){qc6 = six-9.*two*four+12.*pow(two,3.);} 
14767     if(TMath::Abs(eight) > 0.){qc8 = eight-16.*two*six-18.*pow(four,2.)+144.*pow(two,2.)*four-144.*pow(two,4.);}  
14768     fBootstrapCumulantsVsM[0]->SetBinContent(fBootstrapCumulantsVsM[0]->GetBin(mb,ss+1),qc2); 
14769     fBootstrapCumulantsVsM[1]->SetBinContent(fBootstrapCumulantsVsM[1]->GetBin(mb,ss+1),qc4); 
14770     fBootstrapCumulantsVsM[2]->SetBinContent(fBootstrapCumulantsVsM[2]->GetBin(mb,ss+1),qc6); 
14771     fBootstrapCumulantsVsM[3]->SetBinContent(fBootstrapCumulantsVsM[3]->GetBin(mb,ss+1),qc8);     
14772     /*
14773     if(qc2>=0.){fBootstrapCumulantsVsM[0]->SetBinContent(fBootstrapCumulantsVsM[0]->GetBin(mb,ss+1),pow(qc2,0.5));}
14774     if(qc4<=0.){fBootstrapCumulantsVsM[1]->SetBinContent(fBootstrapCumulantsVsM[1]->GetBin(mb,ss+1),pow(-1.*qc4,1./4.));} 
14775     if(qc6>=0.){fBootstrapCumulantsVsM[2]->SetBinContent(fBootstrapCumulantsVsM[2]->GetBin(mb,ss+1),pow((1./4.)*qc6,1./6.));}
14776     if(qc8<=0.){fBootstrapCumulantsVsM[3]->SetBinContent(fBootstrapCumulantsVsM[3]->GetBin(mb,ss+1),pow((-1./33.)*qc8,1./8.));}  
14777     */    
14778    } // end of for(Int_t ss=0;ss<fnSubsamples;ss++)
14779   } // end of for(Int_t mb=1;mb<=fnBinsMult;mb++)
14780  } // end of if(fUseBootstrapVsM) 
14781
14782
14783  return;
14784
14785 } // end of void AliFlowAnalysisWithQCumulants::CalculateCumulantsForBootstrap()
14786
14787 //================================================================================================================================ 
14788
14789 void AliFlowAnalysisWithQCumulants::CalculateReferenceFlow()
14790 {
14791  // a) Calculate the final results for reference flow estimates from Q-cumulants;
14792  // b) Propagate the statistical errors to reference flow estimates from statistical error of Q-cumulants; 
14793  // c) Store the results and statistical errors of reference flow estimates in histogram fIntFlow.
14794  //    Binning of fIntFlow is organized as follows:
14795  //
14796  //            1st bin: v{2,QC}
14797  //            2nd bin: v{4,QC}
14798  //            3rd bin: v{6,QC}
14799  //            4th bin: v{8,QC}
14800  //
14801  
14802  // Reference flow estimates:
14803  Double_t v2 = 0.; // v{2,QC}  
14804  Double_t v4 = 0.; // v{4,QC}  
14805  Double_t v6 = 0.; // v{6,QC}  
14806  Double_t v8 = 0.; // v{8,QC}
14807  // Reference flow's statistical errors:
14808  Double_t v2Error = 0.; // v{2,QC} stat. error 
14809  Double_t v4Error = 0.; // v{4,QC} stat. error
14810  Double_t v6Error = 0.; // v{6,QC} stat. error
14811  Double_t v8Error = 0.; // v{8,QC} stat. error
14812   
14813  // Q-cumulants:
14814  Double_t qc2 = fIntFlowQcumulants->GetBinContent(1); // QC{2}  
14815  Double_t qc4 = fIntFlowQcumulants->GetBinContent(2); // QC{4}  
14816  Double_t qc6 = fIntFlowQcumulants->GetBinContent(3); // QC{6}  
14817  Double_t qc8 = fIntFlowQcumulants->GetBinContent(4); // QC{8}
14818  // Q-cumulants's statistical errors: 
14819  Double_t qc2Error = fIntFlowQcumulants->GetBinError(1); // QC{2} stat. error  
14820  Double_t qc4Error = fIntFlowQcumulants->GetBinError(2); // QC{4} stat. error  
14821  Double_t qc6Error = fIntFlowQcumulants->GetBinError(3); // QC{6} stat. error  
14822  Double_t qc8Error = fIntFlowQcumulants->GetBinError(4); // QC{8} stat. error
14823  // Calculate reference flow estimates from Q-cumulants: 
14824  if(qc2>=0.){v2 = pow(qc2,0.5);} 
14825  if(qc4<=0.){v4 = pow(-1.*qc4,1./4.);} 
14826  if(qc6>=0.){v6 = pow((1./4.)*qc6,1./6.);}
14827  if(qc8<=0.){v8 = pow((-1./33.)*qc8,1./8.);}  
14828  // Calculate stat. error for reference flow estimates from stat. error of Q-cumulants:  
14829  if(qc2>0.){v2Error = (1./2.)*pow(qc2,-0.5)*qc2Error;} 
14830  if(qc4<0.){v4Error = (1./4.)*pow(-qc4,-3./4.)*qc4Error;} 
14831  if(qc6>0.){v6Error = (1./6.)*pow(2.,-1./3.)*pow(qc6,-5./6.)*qc6Error;}   
14832  if(qc8<0.){v8Error = (1./8.)*pow(33.,-1./8.)*pow(-qc8,-7./8.)*qc8Error;}   
14833  // Print warnings for the 'wrong sign' cumulants: 
14834  if(TMath::Abs(v2) < 1.e-44)
14835  {
14836   cout<<" WARNING: Wrong sign QC{2}, couldn't calculate v{2,QC} !!!!"<<endl;
14837  }
14838  if(TMath::Abs(v4) < 1.e-44)
14839  {
14840   cout<<" WARNING: Wrong sign QC{4}, couldn't calculate v{4,QC} !!!!"<<endl;
14841  } 
14842  if(TMath::Abs(v6) < 1.e-44)
14843  {
14844   cout<<" WARNING: Wrong sign QC{6}, couldn't calculate v{6,QC} !!!!"<<endl; 
14845  }
14846  if(TMath::Abs(v8) < 1.e-44)
14847  {
14848   cout<<" WARNING: Wrong sign QC{8}, couldn't calculate v{8,QC} !!!!"<<endl;
14849  }                       
14850  // Store the results and statistical errors of integrated flow estimates:
14851  fIntFlow->SetBinContent(1,v2);
14852  fIntFlow->SetBinError(1,v2Error);
14853  fIntFlow->SetBinContent(2,v4);
14854  fIntFlow->SetBinError(2,v4Error);
14855  fIntFlow->SetBinContent(3,v6);
14856  fIntFlow->SetBinError(3,v6Error);
14857  fIntFlow->SetBinContent(4,v8);
14858  fIntFlow->SetBinError(4,v8Error);  
14859   
14860  // Versus multiplicity: 
14861  if(!fCalculateCumulantsVsM){return;} 
14862  Int_t nBins = fIntFlowCorrelationsVsMPro[0]->GetNbinsX(); // to be improved (hardwired 0) 
14863  for(Int_t b=1;b<=nBins;b++)
14864  {
14865   // Q-cumulants:
14866   Double_t qc2VsM = fIntFlowQcumulantsVsM[0]->GetBinContent(b); // QC{2}  
14867   Double_t qc4VsM = fIntFlowQcumulantsVsM[1]->GetBinContent(b); // QC{4}  
14868   Double_t qc6VsM = fIntFlowQcumulantsVsM[2]->GetBinContent(b); // QC{6}  
14869   Double_t qc8VsM = fIntFlowQcumulantsVsM[3]->GetBinContent(b); // QC{8}
14870   // Q-cumulants's statistical errors: 
14871   Double_t qc2ErrorVsM = fIntFlowQcumulantsVsM[0]->GetBinError(b); // QC{2} stat. error  
14872   Double_t qc4ErrorVsM = fIntFlowQcumulantsVsM[1]->GetBinError(b); // QC{4} stat. error  
14873   Double_t qc6ErrorVsM = fIntFlowQcumulantsVsM[2]->GetBinError(b); // QC{6} stat. error  
14874   Double_t qc8ErrorVsM = fIntFlowQcumulantsVsM[3]->GetBinError(b); // QC{8} stat. error
14875   // Reference flow estimates:
14876   Double_t v2VsM = 0.; // v{2,QC}  
14877   Double_t v4VsM = 0.; // v{4,QC}  
14878   Double_t v6VsM = 0.; // v{6,QC}  
14879   Double_t v8VsM = 0.; // v{8,QC}
14880   // Reference flow estimates errors:
14881   Double_t v2ErrorVsM = 0.; // v{2,QC} stat. error  
14882   Double_t v4ErrorVsM = 0.; // v{4,QC} stat. error
14883   Double_t v6ErrorVsM = 0.; // v{6,QC} stat. error  
14884   Double_t v8ErrorVsM = 0.; // v{8,QC} stat. error
14885   // Calculate reference flow estimates from Q-cumulants: 
14886   if(qc2VsM>=0.){v2VsM = pow(qc2VsM,0.5);} 
14887   if(qc4VsM<=0.){v4VsM = pow(-1.*qc4VsM,1./4.);} 
14888   if(qc6VsM>=0.){v6VsM = pow((1./4.)*qc6VsM,1./6.);}
14889   if(qc8VsM<=0.){v8VsM = pow((-1./33.)*qc8VsM,1./8.);}  
14890   // Calculate stat. error for reference flow estimates from stat. error of Q-cumulants: 
14891   if(qc2VsM>0.){v2ErrorVsM = (1./2.)*pow(qc2VsM,-0.5)*qc2ErrorVsM;} 
14892   if(qc4VsM<0.){v4ErrorVsM = (1./4.)*pow(-qc4VsM,-3./4.)*qc4ErrorVsM;} 
14893   if(qc6VsM>0.){v6ErrorVsM = (1./6.)*pow(2.,-1./3.)*pow(qc6VsM,-5./6.)*qc6ErrorVsM;}   
14894   if(qc8VsM<0.){v8ErrorVsM = (1./8.)*pow(33.,-1./8.)*pow(-qc8VsM,-7./8.)*qc8ErrorVsM;}                       
14895   // Store the results and statistical errors of integrated flow estimates:
14896   fIntFlowVsM[0]->SetBinContent(b,v2VsM);
14897   fIntFlowVsM[0]->SetBinError(b,v2ErrorVsM);
14898   fIntFlowVsM[1]->SetBinContent(b,v4VsM);
14899   fIntFlowVsM[1]->SetBinError(b,v4ErrorVsM);
14900   fIntFlowVsM[2]->SetBinContent(b,v6VsM);
14901   fIntFlowVsM[2]->SetBinError(b,v6ErrorVsM);
14902   fIntFlowVsM[3]->SetBinContent(b,v8VsM);
14903   fIntFlowVsM[3]->SetBinError(b,v8ErrorVsM);
14904  } // end of for(Int_t b=1;b<=nBins;b++)
14905  
14906  // 'Rebinned in M' calculation: // to be improved - this can be implemented better:   
14907  // Reference flow estimates:
14908  Double_t v2RebinnedInM = 0.; // v{2,QC}  
14909  Double_t v4RebinnedInM = 0.; // v{4,QC}  
14910  Double_t v6RebinnedInM = 0.; // v{6,QC}  
14911  Double_t v8RebinnedInM = 0.; // v{8,QC}
14912  // Reference flow's statistical errors:
14913  Double_t v2ErrorRebinnedInM = 0.; // v{2,QC} stat. error 
14914  Double_t v4ErrorRebinnedInM = 0.; // v{4,QC} stat. error
14915  Double_t v6ErrorRebinnedInM = 0.; // v{6,QC} stat. error
14916  Double_t v8ErrorRebinnedInM = 0.; // v{8,QC} stat. error
14917  // Q-cumulants:
14918  Double_t qc2RebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinContent(1); // QC{2}  
14919  Double_t qc4RebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinContent(2); // QC{4}  
14920  Double_t qc6RebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinContent(3); // QC{6}  
14921  Double_t qc8RebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinContent(4); // QC{8}
14922  // Q-cumulants's statistical errors: 
14923  Double_t qc2ErrorRebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinError(1); // QC{2} stat. error  
14924  Double_t qc4ErrorRebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinError(2); // QC{4} stat. error  
14925  Double_t qc6ErrorRebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinError(3); // QC{6} stat. error  
14926  Double_t qc8ErrorRebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinError(4); // QC{8} stat. error
14927  // Calculate reference flow estimates from Q-cumulants: 
14928  if(qc2RebinnedInM>=0.){v2RebinnedInM = pow(qc2RebinnedInM,0.5);} 
14929  if(qc4RebinnedInM<=0.){v4RebinnedInM = pow(-1.*qc4RebinnedInM,1./4.);} 
14930  if(qc6RebinnedInM>=0.){v6RebinnedInM = pow((1./4.)*qc6RebinnedInM,1./6.);}
14931  if(qc8RebinnedInM<=0.){v8RebinnedInM = pow((-1./33.)*qc8RebinnedInM,1./8.);}  
14932  // Calculate stat. error for reference flow estimates from stat. error of Q-cumulants: 
14933  if(qc2RebinnedInM>0.){v2ErrorRebinnedInM = (1./2.)*pow(qc2RebinnedInM,-0.5)*qc2ErrorRebinnedInM;} 
14934  if(qc4RebinnedInM<0.){v4ErrorRebinnedInM = (1./4.)*pow(-qc4RebinnedInM,-3./4.)*qc4ErrorRebinnedInM;} 
14935  if(qc6RebinnedInM>0.){v6ErrorRebinnedInM = (1./6.)*pow(2.,-1./3.)*pow(qc6RebinnedInM,-5./6.)*qc6ErrorRebinnedInM;}   
14936  if(qc8RebinnedInM<0.){v8ErrorRebinnedInM = (1./8.)*pow(33.,-1./8.)*pow(-qc8RebinnedInM,-7./8.)*qc8ErrorRebinnedInM;}   
14937  // Print warnings for the 'wrong sign' cumulants: 
14938  if(TMath::Abs(v2RebinnedInM) < 1.e-44)
14939  {
14940   cout<<" WARNING: Wrong sign QC{2} rebinned in M, couldn't calculate v{2,QC} !!!!"<<endl;
14941  }
14942  if(TMath::Abs(v4RebinnedInM) < 1.e-44)
14943  {
14944   cout<<" WARNING: Wrong sign QC{4} rebinned in M, couldn't calculate v{4,QC} !!!!"<<endl;
14945  }
14946  if(TMath::Abs(v6RebinnedInM) < 1.e-44)
14947  {
14948   cout<<" WARNING: Wrong sign QC{6} rebinned in M, couldn't calculate v{6,QC} !!!!"<<endl;
14949  }
14950  if(TMath::Abs(v8RebinnedInM) < 1.e-44)
14951  {
14952   cout<<" WARNING: Wrong sign QC{8} rebinned in M, couldn't calculate v{8,QC} !!!!"<<endl;
14953  }                       
14954  // Store the results and statistical errors of integrated flow estimates:
14955  fIntFlowRebinnedInM->SetBinContent(1,v2RebinnedInM);
14956  fIntFlowRebinnedInM->SetBinError(1,v2ErrorRebinnedInM);
14957  fIntFlowRebinnedInM->SetBinContent(2,v4RebinnedInM);
14958  fIntFlowRebinnedInM->SetBinError(2,v4ErrorRebinnedInM);
14959  fIntFlowRebinnedInM->SetBinContent(3,v6RebinnedInM);
14960  fIntFlowRebinnedInM->SetBinError(3,v6ErrorRebinnedInM);
14961  fIntFlowRebinnedInM->SetBinContent(4,v8RebinnedInM);
14962  fIntFlowRebinnedInM->SetBinError(4,v8ErrorRebinnedInM);    
14963   
14964 } // end of AliFlowAnalysisWithQCumulants::CalculateReferenceFlow()
14965
14966 //================================================================================================================================ 
14967
14968 void AliFlowAnalysisWithQCumulants::FillCommonHistResultsIntFlow()
14969 {
14970  // Fill in AliFlowCommonHistResults histograms relevant for reference flow.
14971  
14972  // There are two possibilities here:
14973  // a) Store minimum bias reference flow - use SetMinimumBiasReferenceFlow(kTRUE). This result is 
14974  //    biased by the interplay between nonflow correlations and multiplicity fluctuations and is 
14975  //    also stored in local histogram fIntFlow; 
14976  // b) Store reference flow obtained from flow analysis performed at fixed multiplicity and 
14977  //    rebinned only at the end of the day - use SetMinimumBiasReferenceFlow(kFALSE). This result
14978  //    is also stored in local histogram fIntFlowRebinnedInM.
14979  
14980  // Reference flow estimates:
14981  Double_t v[4] = {0.};
14982  // Statistical errors of reference flow estimates:
14983  Double_t vError[4] = {0.};
14984   
14985  for(Int_t b=0;b<4;b++)
14986  {
14987   if(fMinimumBiasReferenceFlow)
14988   { 
14989    v[b] = fIntFlow->GetBinContent(b+1);
14990    vError[b] = fIntFlow->GetBinError(b+1);
14991   } else
14992     {
14993      v[b] = fIntFlowRebinnedInM->GetBinContent(b+1);
14994      vError[b] = fIntFlowRebinnedInM->GetBinError(b+1);
14995     }
14996  } // end of for(Int_t b=0;b<4;b++)
14997   
14998  // Fill AliFlowCommonHistResults histogram:
14999  fCommonHistsResults2nd->FillIntegratedFlow(v[0],vError[0]); // to be improved (hardwired 2nd in the name)  
15000  fCommonHistsResults4th->FillIntegratedFlow(v[1],vError[1]); // to be improved (hardwired 4th in the name)
15001  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)) // to be improved (calculate also 6th and 8th order)
15002  {
15003   fCommonHistsResults6th->FillIntegratedFlow(v[2],vError[2]); // to be improved (hardwired 6th in the name)
15004   fCommonHistsResults8th->FillIntegratedFlow(v[3],vError[3]); // to be improved (hardwired 8th in the name) 
15005  }
15006  
15007 } // end of AliFlowAnalysisWithQCumulants::FillCommonHistResultsIntFlow()
15008
15009 //================================================================================================================================ 
15010
15011 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelationsUsingParticleWeights()
15012 {
15013  // Calculate all correlations needed for integrated flow using particle weights.
15014   
15015  // Remark 1: When particle weights are used the binning of fIntFlowCorrelationAllPro is organized as follows:
15016  //
15017  //  1st bin: <2>_{1n|1n} = two1n1nW1W1 = <w1 w2 cos(n*(phi1-phi2))>
15018  //  2nd bin: <2>_{2n|2n} = two2n2nW2W2 = <w1^2 w2^2 cos(2n*(phi1-phi2))>
15019  //  3rd bin: <2>_{3n|3n} = two3n3nW3W3 = <w1^3 w2^3 cos(3n*(phi1-phi2))> 
15020  //  4th bin: <2>_{4n|4n} = two4n4nW4W4 = <w1^4 w2^4 cos(4n*(phi1-phi2))>
15021  //  5th bin:           ----  EMPTY ----
15022  //  6th bin: <3>_{2n|1n,1n} = three2n1n1nW2W1W1 = <w1^2 w2 w3 cos(n*(2phi1-phi2-phi3))>
15023  //  7th bin: <3>_{3n|2n,1n} = ...
15024  //  8th bin: <3>_{4n|2n,2n} = ...
15025  //  9th bin: <3>_{4n|3n,1n} = ...
15026  // 10th bin:           ----  EMPTY ----
15027  // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1nW1W1W1W1 = <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))>
15028  // 12th bin: <4>_{2n,1n|2n,1n} = ...
15029  // 13th bin: <4>_{2n,2n|2n,2n} = ...
15030  // 14th bin: <4>_{3n|1n,1n,1n} = ... 
15031  // 15th bin: <4>_{3n,1n|3n,1n} = ...
15032  // 16th bin: <4>_{3n,1n|2n,2n} = ...
15033  // 17th bin: <4>_{4n|2n,1n,1n} = ... 
15034  // 18th bin:           ----  EMPTY ----
15035  // 19th bin: <5>_{2n|1n,1n,1n,1n} = ...
15036  // 20th bin: <5>_{2n,2n|2n,1n,1n} = ...
15037  // 21st bin: <5>_{3n,1n|2n,1n,1n} = ...
15038  // 22nd bin: <5>_{4n|1n,1n,1n,1n} = ...
15039  // 23rd bin:           ----  EMPTY ----
15040  // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = ...
15041  // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = ...
15042  // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = ...
15043  // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = ...
15044  // 28th bin:           ----  EMPTY ----
15045  // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = ...
15046  // 30th bin:           ----  EMPTY ----
15047  // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = ...
15048  
15049  // Remark 2: When particle weights are used there are some extra correlations. They are stored in 
15050  // fIntFlowExtraCorrelationsPro binning of which is organized as follows:
15051  
15052  // 1st bin: two1n1nW3W1 = <w1^3 w2 cos(n*(phi1-phi2))>
15053  // 2nd bin: two1n1nW1W1W2 = <w1 w2 w3^2 cos(n*(phi1-phi2))>  
15054  
15055  // multiplicity (number of particles used to determine the reaction plane)
15056  Double_t dMult = (*fSpk)(0,0);
15057  
15058  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
15059  Double_t dReQ1n1k = (*fReQ)(0,1);
15060  Double_t dReQ2n2k = (*fReQ)(1,2);
15061  Double_t dReQ3n3k = (*fReQ)(2,3);
15062  Double_t dReQ4n4k = (*fReQ)(3,4);
15063  Double_t dReQ1n3k = (*fReQ)(0,3);
15064  Double_t dImQ1n1k = (*fImQ)(0,1);
15065  Double_t dImQ2n2k = (*fImQ)(1,2);
15066  Double_t dImQ3n3k = (*fImQ)(2,3);
15067  Double_t dImQ4n4k = (*fImQ)(3,4);
15068  Double_t dImQ1n3k = (*fImQ)(0,3);
15069
15070  // dMs are variables introduced in order to simplify some Eqs. bellow:
15071  //..............................................................................................
15072  Double_t dM11 = (*fSpk)(1,1)-(*fSpk)(0,2); // dM11 = sum_{i,j=1,i!=j}^M w_i w_j
15073  Double_t dM22 = (*fSpk)(1,2)-(*fSpk)(0,4); // dM22 = sum_{i,j=1,i!=j}^M w_i^2 w_j^2
15074  Double_t dM33 = (*fSpk)(1,3)-(*fSpk)(0,6); // dM33 = sum_{i,j=1,i!=j}^M w_i^3 w_j^3
15075  Double_t dM44 = (*fSpk)(1,4)-(*fSpk)(0,8); // dM44 = sum_{i,j=1,i!=j}^M w_i^4 w_j^4
15076  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
15077  Double_t dM211 = (*fSpk)(0,2)*(*fSpk)(1,1)-2.*(*fSpk)(0,3)*(*fSpk)(0,1)
15078                 - (*fSpk)(1,2)+2.*(*fSpk)(0,4); // dM211 = sum_{i,j,k=1,i!=j!=k}^M w_i^2 w_j w_k
15079  Double_t dM1111 = (*fSpk)(3,1)-6.*(*fSpk)(0,2)*(*fSpk)(1,1)  
15080                  + 8.*(*fSpk)(0,3)*(*fSpk)(0,1)
15081                  + 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
15082  //..............................................................................................
15083
15084  // 2-particle correlations:
15085  Double_t two1n1nW1W1 = 0.; // <w1 w2 cos(n*(phi1-phi2))>
15086  Double_t two2n2nW2W2 = 0.; // <w1^2 w2^2 cos(2n*(phi1-phi2))>
15087  Double_t two3n3nW3W3 = 0.; // <w1^3 w2^3 cos(3n*(phi1-phi2))>
15088  Double_t two4n4nW4W4 = 0.; // <w1^4 w2^4 cos(4n*(phi1-phi2))>
15089  if(dMult>1) 
15090  { 
15091   if(dM11)
15092   {
15093    two1n1nW1W1 = (pow(dReQ1n1k,2)+pow(dImQ1n1k,2)-(*fSpk)(0,2))/dM11;    
15094    // average correlation <w1 w2 cos(n*(phi1-phi2))> for single event: 
15095    fIntFlowCorrelationsEBE->SetBinContent(1,two1n1nW1W1);
15096    fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(1,dM11);
15097    // average correlation <w1 w2 cos(n*(phi1-phi2))> for all events:
15098    fIntFlowCorrelationsPro->Fill(0.5,two1n1nW1W1,dM11);  
15099    // average squared correlation <w1 w2 cos(n*(phi1-phi2))> for all events:
15100    fIntFlowSquaredCorrelationsPro->Fill(0.5,two1n1nW1W1*two1n1nW1W1,dM11); 
15101    fIntFlowCorrelationsAllPro->Fill(0.5,two1n1nW1W1,dM11);   
15102   }
15103   if(dM22)
15104   {
15105    two2n2nW2W2 = (pow(dReQ2n2k,2)+pow(dImQ2n2k,2)-(*fSpk)(0,4))/dM22; 
15106    // ...
15107    // average correlation <w1^2 w2^2 cos(2n*(phi1-phi2))> for all events:
15108    fIntFlowCorrelationsAllPro->Fill(1.5,two2n2nW2W2,dM22);   
15109   }
15110   if(dM33)
15111   {
15112    two3n3nW3W3 = (pow(dReQ3n3k,2)+pow(dImQ3n3k,2)-(*fSpk)(0,6))/dM33;
15113    // ...
15114    // average correlation <w1^3 w2^3 cos(3n*(phi1-phi2))> for all events:
15115    fIntFlowCorrelationsAllPro->Fill(2.5,two3n3nW3W3,dM33);   
15116   }
15117   if(dM44)
15118   {
15119    two4n4nW4W4 = (pow(dReQ4n4k,2)+pow(dImQ4n4k,2)-(*fSpk)(0,8))/dM44; 
15120    // ...
15121    // average correlation <w1^4 w2^4 cos(4n*(phi1-phi2))> for all events:
15122    fIntFlowCorrelationsAllPro->Fill(3.5,two4n4nW4W4,dM44);      
15123   }
15124  } // end of if(dMult>1) 
15125
15126  // extra 2-particle correlations:
15127  Double_t two1n1nW3W1 = 0.; // <w1^3 w2 cos(n*(phi1-phi2))>
15128  Double_t two1n1nW1W1W2 = 0.; // <w1 w2 w3^2 cos(n*(phi1-phi2))> 
15129  if(dMult>1) 
15130  {    
15131   if(dM31)
15132   {
15133    two1n1nW3W1 = (dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k-(*fSpk)(0,4))/dM31; 
15134    fIntFlowExtraCorrelationsPro->Fill(0.5,two1n1nW3W1,dM31);  
15135   } 
15136   if(dM211)
15137   {
15138    two1n1nW1W1W2 = ((*fSpk)(0,2)*(pow(dReQ1n1k,2)+pow(dImQ1n1k,2)-(*fSpk)(0,2))
15139                  - 2.*(dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k
15140                  - (*fSpk)(0,4)))/dM211;
15141    fIntFlowExtraCorrelationsPro->Fill(1.5,two1n1nW1W1W2,dM211);  
15142   }  
15143  } // end of if(dMult>1)
15144  //..............................................................................................
15145  
15146  //..............................................................................................
15147  // 3-particle correlations:
15148  Double_t three2n1n1nW2W1W1 = 0.; // <w1^2 w2 w3 cos(n*(2phi1-phi2-phi3))>
15149  
15150  if(dMult>2) 
15151  { 
15152   if(dM211)
15153   {                                                       
15154    three2n1n1nW2W1W1 = (pow(dReQ1n1k,2.)*dReQ2n2k+2.*dReQ1n1k*dImQ1n1k*dImQ2n2k-pow(dImQ1n1k,2.)*dReQ2n2k
15155                      - 2.*(dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k)
15156                      - pow(dReQ2n2k,2)-pow(dImQ2n2k,2)
15157                      + 2.*(*fSpk)(0,4))/dM211;                                                                               
15158    fIntFlowCorrelationsAllPro->Fill(5.5,three2n1n1nW2W1W1,dM211);
15159   } 
15160  } // end of if(dMult>2) 
15161  //..............................................................................................
15162  
15163  //..............................................................................................
15164  // 4-particle correlations:
15165  Double_t four1n1n1n1nW1W1W1W1 = 0.; // <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))>
15166  if(dMult>3) 
15167  { 
15168   if(dM1111)
15169   {      
15170    four1n1n1n1nW1W1W1W1 = (pow(pow(dReQ1n1k,2.)+pow(dImQ1n1k,2.),2)
15171                         - 2.*(pow(dReQ1n1k,2.)*dReQ2n2k+2.*dReQ1n1k*dImQ1n1k*dImQ2n2k-pow(dImQ1n1k,2.)*dReQ2n2k)
15172                         + 8.*(dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k)
15173                         + (pow(dReQ2n2k,2)+pow(dImQ2n2k,2))
15174                         - 4.*(*fSpk)(0,2)*(pow(dReQ1n1k,2)+pow(dImQ1n1k,2))
15175                         - 6.*(*fSpk)(0,4)+2.*(*fSpk)(1,2))/dM1111;  
15176                           
15177    // average correlation <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))> for single event: 
15178    fIntFlowCorrelationsEBE->SetBinContent(2,four1n1n1n1nW1W1W1W1);
15179    fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(2,dM1111);
15180    // average correlation <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))> for all events:
15181    fIntFlowCorrelationsPro->Fill(1.5,four1n1n1n1nW1W1W1W1,dM1111);   
15182    // average squared correlation <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))> for all events:
15183    fIntFlowSquaredCorrelationsPro->Fill(1.5,four1n1n1n1nW1W1W1W1*four1n1n1n1nW1W1W1W1,dM1111);      
15184    fIntFlowCorrelationsAllPro->Fill(10.5,four1n1n1n1nW1W1W1W1,dM1111);   
15185   } 
15186  } // end of if(dMult>3) 
15187  //..............................................................................................
15188  
15189 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelationsUsingParticleWeights()
15190
15191 //=======================================================================================================================
15192
15193 void AliFlowAnalysisWithQCumulants::InitializeArraysForIntFlow()
15194 {
15195  // Initialize all arrays used to calculate integrated flow.
15196  
15197  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
15198  {
15199   fIntFlowCorrectionTermsForNUAEBE[sc] = NULL;
15200   fIntFlowEventWeightForCorrectionTermsForNUAEBE[sc] = NULL;
15201   fIntFlowCorrectionTermsForNUAPro[sc] = NULL;
15202   fIntFlowCorrectionTermsForNUAHist[sc] = NULL;
15203   for(Int_t ci=0;ci<4;ci++) // correction term index (to be improved - hardwired 4)
15204   {
15205    fIntFlowCorrectionTermsForNUAVsMPro[sc][ci] = NULL;
15206   }
15207   for(Int_t power=0;power<2;power++) // linear or quadratic 
15208   {
15209    fIntFlowSumOfEventWeightsNUA[sc][power] = NULL;
15210   }
15211  }
15212  for(Int_t power=0;power<2;power++) // linear or quadratic 
15213  {
15214   fIntFlowSumOfEventWeights[power] = NULL;    
15215  }
15216  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))
15217  {
15218   fPrintFinalResults[i] = kTRUE;
15219  }
15220  for(Int_t ci=0;ci<4;ci++) // correlation index or cumulant order
15221  {
15222   fIntFlowCorrelationsVsMPro[ci] = NULL;
15223   fIntFlowSquaredCorrelationsVsMPro[ci] = NULL;
15224   fIntFlowCorrelationsVsMHist[ci] = NULL;
15225   fIntFlowQcumulantsVsM[ci] = NULL;
15226   fIntFlowVsM[ci] = NULL;
15227   fIntFlowDetectorBiasVsM[ci] = NULL;
15228   for(Int_t lc=0;lc<2;lc++)
15229   {
15230    fIntFlowSumOfEventWeightsVsM[ci][lc] = NULL;
15231   }
15232  } 
15233  for(Int_t pi=0;pi<6;pi++) // product or covariance index
15234  {
15235   fIntFlowProductOfCorrelationsVsMPro[pi] = NULL;
15236   fIntFlowCovariancesVsM[pi] = NULL;
15237   fIntFlowSumOfProductOfEventWeightsVsM[pi] = NULL;
15238  } 
15239  for(Int_t ci=0;ci<64;ci++) // correlation index for all correlations vs M profiles (to be improved - hardwired 64)
15240  {
15241   fIntFlowCorrelationsAllVsMPro[ci] = NULL;
15242  } 
15243
15244 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForIntFlow()
15245
15246 //=======================================================================================================================
15247
15248 void AliFlowAnalysisWithQCumulants::InitializeArraysForDiffFlow()
15249 {
15250  // Initialize all arrays needed to calculate differential flow.
15251  //  a) Initialize lists holding profiles;
15252  //  b) Initialize lists holding histograms;
15253  //  c) Initialize event-by-event quantities;
15254  //  d) Initialize profiles;
15255  //  e) Initialize histograms holding final results.
15256  
15257  // a) Initialize lists holding profiles;
15258  for(Int_t t=0;t<2;t++) // type (RP, POI)
15259  {
15260   for(Int_t pe=0;pe<2;pe++) // pt or eta
15261   {
15262    fDiffFlowCorrelationsProList[t][pe] = NULL;
15263    fDiffFlowProductOfCorrelationsProList[t][pe] = NULL;
15264    fDiffFlowCorrectionsProList[t][pe] = NULL;
15265   }
15266   // 2D:
15267   f2DDiffFlowCorrelationsProList[t] = NULL;
15268  }  
15269  
15270  // b) Initialize lists holding histograms;
15271  for(Int_t t=0;t<2;t++) // type (RP, POI)
15272  {
15273   for(Int_t pe=0;pe<2;pe++) // pt or eta
15274   {
15275    fDiffFlowCorrelationsHistList[t][pe] = NULL;
15276    for(Int_t power=0;power<2;power++)
15277    {
15278     fDiffFlowSumOfEventWeightsHistList[t][pe][power] = NULL;
15279    } // end of for(Int_t power=0;power<2;power++)  
15280    fDiffFlowSumOfProductOfEventWeightsHistList[t][pe] = NULL;
15281    fDiffFlowCorrectionsHistList[t][pe] = NULL;
15282    fDiffFlowCovariancesHistList[t][pe] = NULL;
15283    fDiffFlowCumulantsHistList[t][pe] = NULL;
15284    fDiffFlowDetectorBiasHistList[t][pe] = NULL;
15285    fDiffFlowHistList[t][pe] = NULL;
15286   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
15287  } // enf of for(Int_t t=0;t<2;t++) // type (RP, POI) 
15288  
15289  // c) Initialize event-by-event quantities:
15290  // 1D:
15291  for(Int_t t=0;t<3;t++) // type (RP, POI, POI&&RP)
15292  {
15293   for(Int_t pe=0;pe<2;pe++) // pt or eta
15294   { 
15295    for(Int_t m=0;m<4;m++) // multiple of harmonic
15296    {
15297     for(Int_t k=0;k<9;k++) // power of weight
15298     {
15299      fReRPQ1dEBE[t][pe][m][k] = NULL;
15300      fImRPQ1dEBE[t][pe][m][k] = NULL;
15301      fs1dEBE[t][pe][k] = NULL; // to be improved (this doesn't need to be within loop over m)
15302     }   
15303    }
15304   }
15305  }
15306  // 1D:
15307  for(Int_t t=0;t<2;t++) // type (RP or POI)
15308  {
15309   for(Int_t pe=0;pe<2;pe++) // pt or eta
15310   { 
15311    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
15312    {
15313     for(Int_t cti=0;cti<9;cti++) // correction term index
15314     {
15315      fDiffFlowCorrectionTermsForNUAEBE[t][pe][sc][cti] = NULL;
15316     }   
15317    }
15318   }
15319  }
15320  // 2D:  
15321  for(Int_t t=0;t<3;t++) // type (RP, POI, POI&&RP)
15322  {
15323   for(Int_t m=0;m<4;m++) // multiple of harmonic
15324   {
15325    for(Int_t k=0;k<9;k++) // power of weight
15326    {
15327     fReRPQ2dEBE[t][m][k] = NULL;
15328     fImRPQ2dEBE[t][m][k] = NULL;
15329     fs2dEBE[t][k] = NULL; // to be improved (this doesn't need to be within loop over m)
15330    }   
15331   }
15332  }
15333  
15334  // d) Initialize profiles:
15335  for(Int_t t=0;t<2;t++) // type: RP or POI
15336  { 
15337   for(Int_t pe=0;pe<2;pe++) // pt or eta
15338   {
15339    for(Int_t ci=0;ci<4;ci++) // correlation index
15340    {
15341     fDiffFlowCorrelationsPro[t][pe][ci] = NULL;
15342     fDiffFlowSquaredCorrelationsPro[t][pe][ci] = NULL;
15343    } // end of for(Int_t ci=0;ci<4;ci++)   
15344    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
15345    {
15346     for(Int_t mci2=0;mci2<8;mci2++) // mixed correlation index
15347     {
15348      fDiffFlowProductOfCorrelationsPro[t][pe][mci1][mci2] = NULL;
15349     } // end of for(Int_t mci2=0;mci2<8;mci2++) // mixed correlation index
15350    } // end of for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index  
15351    // correction terms for nua:
15352    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
15353    {
15354     for(Int_t cti=0;cti<9;cti++) // correction term index
15355     {
15356      fDiffFlowCorrectionTermsForNUAPro[t][pe][sc][cti] = NULL;
15357     }   
15358    }
15359    // other differential correlators:
15360    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
15361    {
15362     for(Int_t ci=0;ci<1;ci++) // correction term index
15363     {
15364      fOtherDiffCorrelators[t][pe][sc][ci] = NULL;
15365     }   
15366    }
15367   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
15368   for(Int_t ci=0;ci<4;ci++) // correlation index
15369   {
15370    f2DDiffFlowCorrelationsPro[t][ci] = NULL;
15371   }
15372  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
15373   
15374  // e) Initialize histograms holding final results.
15375  for(Int_t t=0;t<2;t++) // type: RP or POI
15376  { 
15377   for(Int_t pe=0;pe<2;pe++) // pt or eta
15378   {
15379    for(Int_t ci=0;ci<4;ci++) // correlation index
15380    {
15381     fDiffFlowCorrelationsHist[t][pe][ci] = NULL;
15382     fDiffFlowCumulants[t][pe][ci] = NULL;
15383     fDiffFlowDetectorBias[t][pe][ci] = NULL;
15384     fDiffFlow[t][pe][ci] = NULL;
15385    } // end of for(Int_t ci=0;ci<4;ci++)    
15386    for(Int_t covarianceIndex=0;covarianceIndex<5;covarianceIndex++) 
15387    {
15388     fDiffFlowCovariances[t][pe][covarianceIndex] = NULL;     
15389    } // end of for(Int_t covarianceIndex=0;covarianceIndex<5;covarianceIndex++) 
15390    // correction terms for nua:
15391    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
15392    {
15393     for(Int_t cti=0;cti<9;cti++) // correction term index
15394     {
15395      fDiffFlowCorrectionTermsForNUAHist[t][pe][sc][cti] = NULL;
15396     }   
15397    }
15398   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
15399   for(Int_t ci=0;ci<4;ci++) // correlation index
15400   {
15401    f2DDiffFlowCumulants[t][ci] = NULL;
15402    f2DDiffFlow[t][ci] = NULL;
15403   }
15404  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
15405  
15406  // sum of event weights for reduced correlations:
15407  for(Int_t t=0;t<2;t++) // type = RP or POI
15408  {
15409   for(Int_t pe=0;pe<2;pe++) // pt or eta
15410   {
15411    for(Int_t p=0;p<2;p++) // power of weight is 1 or 2
15412    {
15413     for(Int_t ew=0;ew<4;ew++) // event weight index for reduced correlations
15414     {
15415      fDiffFlowSumOfEventWeights[t][pe][p][ew] = NULL;
15416     } 
15417    }   
15418   }
15419  }
15420  // product of event weights for both types of correlations:
15421  for(Int_t t=0;t<2;t++) // type = RP or POI
15422  {
15423   for(Int_t pe=0;pe<2;pe++) // pt or eta
15424   {
15425    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
15426    {
15427     for(Int_t mci2=0;mci2<8;mci2++) // mixed correlation index
15428     {
15429      fDiffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2] = NULL;
15430     } 
15431    }   
15432   }
15433  }
15434     
15435 } // end of AliFlowAnalysisWithQCumulants::InitializeArraysForDiffFlow()
15436
15437 //=======================================================================================================================
15438
15439 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCumulants(TString type, TString ptOrEta)
15440 {
15441  // Calculate differential flow cumulants from measured multiparticle correlations.
15442  
15443  // REMARK: Cumulants calculated in this method are NOT corrected for non-uniform acceptance. 
15444  // This correction, if enabled via setter SetApplyCorrectionForNUA(Bool_t), is applied 
15445  // in the method CalculateDiffFlowCumulantsCorrectedForNUA(TString type, TString ptOrEta)
15446  
15447  Int_t t = 0;
15448  Int_t pe = 0;
15449
15450  if(type == "RP")
15451  {
15452   t = 0;
15453  } else if(type == "POI")
15454    {
15455     t = 1;
15456    } 
15457      
15458  if(ptOrEta == "Pt")
15459  {
15460   pe = 0;
15461  } else if(ptOrEta == "Eta")
15462    {
15463     pe = 1;
15464    } 
15465      
15466  // Common:
15467  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
15468  
15469  // Correlation <<2>>: 
15470  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1);
15471  Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1);
15472  
15473  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
15474  {
15475   // Reduced correlations:   
15476   Double_t twoPrime = fDiffFlowCorrelationsHist[t][pe][0]->GetBinContent(b); // <<2'>>
15477   Double_t twoPrimeError = fDiffFlowCorrelationsHist[t][pe][0]->GetBinError(b); // stat. error of <<2'>>
15478   Double_t fourPrime = fDiffFlowCorrelationsHist[t][pe][1]->GetBinContent(b); // <<4'>>
15479   Double_t fourPrimeError = fDiffFlowCorrelationsHist[t][pe][1]->GetBinError(b); // stat. error of <<4'>>
15480   // Covariances:
15481   Double_t wCovTwoTwoReduced = fDiffFlowCovariances[t][pe][0]->GetBinContent(b); // Cov(<2>,<2'>) * prefactor(<2>,<2'>)
15482   Double_t wCovTwoFourReduced = fDiffFlowCovariances[t][pe][1]->GetBinContent(b); // Cov(<2>,<4'>) * prefactor(<2>,<4'>)
15483   Double_t wCovTwoReducedFourReduced = fDiffFlowCovariances[t][pe][4]->GetBinContent(b); // Cov(<2'>,<4'>) * prefactor(<2'>,<4'>)
15484   // QC{2'}:
15485   Double_t qc2Prime = twoPrime; // QC{2'}
15486   Double_t qc2PrimeError = twoPrimeError; // stat. error of QC{2'}
15487   fDiffFlowCumulants[t][pe][0]->SetBinContent(b,qc2Prime); 
15488   fDiffFlowCumulants[t][pe][0]->SetBinError(b,qc2PrimeError); 
15489   // QC{4'}:
15490   Double_t qc4Prime = fourPrime - 2.*twoPrime*two; // QC{4'} = <<4'>> - 2*<<2'>><<2>>
15491   Double_t qc4PrimeError = 0.; // stat. error of QC{4'}
15492   Double_t qc4PrimeErrorSquared = 4.*pow(twoPrime,2.)*pow(twoError,2.)
15493                                 + 4.*pow(two,2.)*pow(twoPrimeError,2.)
15494                                 + pow(fourPrimeError,2.)
15495                                 + 8.*two*twoPrime*wCovTwoTwoReduced
15496                                 - 4.*twoPrime*wCovTwoFourReduced
15497                                 - 4.*two*wCovTwoReducedFourReduced;
15498   if(qc4PrimeErrorSquared>0.)
15499   {
15500    qc4PrimeError = pow(qc4PrimeErrorSquared,0.5);
15501   } 
15502   fDiffFlowCumulants[t][pe][1]->SetBinContent(b,qc4Prime); 
15503   fDiffFlowCumulants[t][pe][1]->SetBinError(b,qc4PrimeError); 
15504  } // end of for(Int_t p=1;p<=fnBinsPt;p++)
15505     
15506 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCumulants(TString type, Bool_t useParticleWeights, TString eventWeights); 
15507
15508 //=======================================================================================================================
15509
15510 void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlowCumulants(TString type)
15511 {
15512  // Calculate 2D differential cumulants.
15513  
15514  // Remark: correction for detector effects and error propagation not implemented yet for 2D differential cumulants.
15515  
15516  Int_t t = 0;
15517
15518  if(type == "RP")
15519  {
15520   t = 0;
15521  } else if(type == "POI")
15522    {
15523     t = 1;
15524    }
15525        
15526  // Reference correlation <<2>>: 
15527  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1);
15528  
15529  // Looping over all (pt,eta) bins and calculating differential flow cumulants: 
15530  for(Int_t p=1;p<=fnBinsPt;p++)
15531  {
15532   for(Int_t e=1;e<=fnBinsEta;e++)
15533   {
15534    // Reduced correlations:   
15535    Double_t twoPrime = f2DDiffFlowCorrelationsPro[t][0]->GetBinContent(f2DDiffFlowCorrelationsPro[t][0]->GetBin(p,e)); // <<2'>>(pt,eta)
15536    Double_t fourPrime = f2DDiffFlowCorrelationsPro[t][1]->GetBinContent(f2DDiffFlowCorrelationsPro[t][1]->GetBin(p,e)); // <<4'>>(pt,eta)
15537    // Cumulants:
15538    Double_t qc2Prime = twoPrime; // QC{2'} = <<2'>>   
15539    f2DDiffFlowCumulants[t][0]->SetBinContent(f2DDiffFlowCumulants[t][0]->GetBin(p,e),qc2Prime); 
15540    Double_t qc4Prime = fourPrime - 2.*twoPrime*two; // QC{4'} = <<4'>> - 2*<<2'>><<2>>
15541    f2DDiffFlowCumulants[t][1]->SetBinContent(f2DDiffFlowCumulants[t][1]->GetBin(p,e),qc4Prime); 
15542   } // end of for(Int_t e=1;e<=fnBinsEta;e++)
15543  } // end of for(Int_t p=1;p<=fnBinsPt;p++)
15544  
15545 } // end of void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlowCumulants(TString type)
15546
15547 //=======================================================================================================================
15548
15549 void AliFlowAnalysisWithQCumulants::CalculateFinalResultsForRPandPOIIntegratedFlow(TString type)
15550 {
15551  // Calculate final results for integrated flow of RPs and POIs. 
15552   
15553  // to be improved - check if the integrated flow calculation here is actually correct 
15554   
15555  Int_t t = 0; // RP = 0, POI = 1
15556
15557  if(type == "RP")
15558  {
15559   t = 0;
15560  } else if(type == "POI")
15561    {
15562     t = 1;
15563    }
15564      
15565  // pt yield:    
15566  TH1F *yield2ndPt = NULL;
15567  TH1F *yield4thPt = NULL;
15568  TH1F *yield6thPt = NULL;
15569  TH1F *yield8thPt = NULL;
15570  
15571  if(type == "POI")
15572  {
15573   if(fFillMultipleControlHistograms)
15574   {
15575    yield2ndPt = (TH1F*)(fCommonHists2nd->GetHistPtPOI())->Clone();
15576    yield4thPt = (TH1F*)(fCommonHists4th->GetHistPtPOI())->Clone();
15577    yield6thPt = (TH1F*)(fCommonHists6th->GetHistPtPOI())->Clone();
15578    yield8thPt = (TH1F*)(fCommonHists8th->GetHistPtPOI())->Clone();  
15579   } else
15580     {
15581      yield2ndPt = (TH1F*)(fCommonHists->GetHistPtPOI())->Clone();
15582      yield4thPt = (TH1F*)(fCommonHists->GetHistPtPOI())->Clone();
15583      yield6thPt = (TH1F*)(fCommonHists->GetHistPtPOI())->Clone();
15584      yield8thPt = (TH1F*)(fCommonHists->GetHistPtPOI())->Clone();     
15585     }
15586  } 
15587  else if(type == "RP")
15588  {
15589   if(fFillMultipleControlHistograms)
15590   {
15591    yield2ndPt = (TH1F*)(fCommonHists2nd->GetHistPtRP())->Clone();
15592    yield4thPt = (TH1F*)(fCommonHists4th->GetHistPtRP())->Clone();
15593    yield6thPt = (TH1F*)(fCommonHists6th->GetHistPtRP())->Clone();
15594    yield8thPt = (TH1F*)(fCommonHists8th->GetHistPtRP())->Clone();  
15595   } else
15596     {
15597      yield2ndPt = (TH1F*)(fCommonHists->GetHistPtRP())->Clone();
15598      yield4thPt = (TH1F*)(fCommonHists->GetHistPtRP())->Clone();
15599      yield6thPt = (TH1F*)(fCommonHists->GetHistPtRP())->Clone();
15600      yield8thPt = (TH1F*)(fCommonHists->GetHistPtRP())->Clone();    
15601     } 
15602  } 
15603  
15604  if(!yield2ndPt){return;}
15605  if(!yield4thPt){return;}
15606  if(!yield6thPt){return;}
15607  if(!yield8thPt){return;} 
15608
15609  Int_t nBinsPt = yield2ndPt->GetNbinsX();
15610  
15611  TH1D *flow2ndPt = NULL;
15612  TH1D *flow4thPt = NULL;
15613  TH1D *flow6thPt = NULL;
15614  TH1D *flow8thPt = NULL;
15615  
15616  // to be improved (hardwired pt index)
15617  flow2ndPt = (TH1D*)fDiffFlow[t][0][0]->Clone();
15618  flow4thPt = (TH1D*)fDiffFlow[t][0][1]->Clone();
15619  flow6thPt = (TH1D*)fDiffFlow[t][0][2]->Clone();
15620  flow8thPt = (TH1D*)fDiffFlow[t][0][3]->Clone(); 
15621
15622  if(!flow2ndPt){return;}
15623  if(!flow4thPt){return;}
15624  if(!flow6thPt){return;}
15625  if(!flow8thPt){return;} 
15626    
15627  Double_t dvn2nd = 0., dvn4th = 0., dvn6th = 0., dvn8th = 0.; // differential flow
15628  Double_t dErrvn2nd = 0., dErrvn4th = 0., dErrvn6th = 0., dErrvn8th = 0.; // error on differential flow
15629  
15630  Double_t dVn2nd = 0., dVn4th = 0., dVn6th = 0., dVn8th = 0.; // integrated flow 
15631  Double_t dErrVn2nd = 0., dErrVn4th = 0., dErrVn6th = 0., dErrVn8th = 0.; // error on integrated flow
15632
15633  Double_t dYield2nd = 0., dYield4th = 0., dYield6th = 0., dYield8th = 0.; // pt yield 
15634  Double_t dSum2nd = 0., dSum4th = 0., dSum6th = 0., dSum8th = 0.; // needed for normalizing integrated flow
15635  
15636  // looping over pt bins:
15637  for(Int_t p=1;p<nBinsPt+1;p++)
15638  {
15639   dvn2nd = flow2ndPt->GetBinContent(p);
15640   dvn4th = flow4thPt->GetBinContent(p);
15641   dvn6th = flow6thPt->GetBinContent(p);
15642   dvn8th = flow8thPt->GetBinContent(p);
15643   
15644   dErrvn2nd = flow2ndPt->GetBinError(p);
15645   dErrvn4th = flow4thPt->GetBinError(p);
15646   dErrvn6th = flow6thPt->GetBinError(p);
15647   dErrvn8th = flow8thPt->GetBinError(p);
15648
15649   dYield2nd = yield2ndPt->GetBinContent(p);  
15650   dYield4th = yield4thPt->GetBinContent(p);
15651   dYield6th = yield6thPt->GetBinContent(p);
15652   dYield8th = yield8thPt->GetBinContent(p);
15653   
15654   dVn2nd += dvn2nd*dYield2nd;
15655   dVn4th += dvn4th*dYield4th;
15656   dVn6th += dvn6th*dYield6th;
15657   dVn8th += dvn8th*dYield8th;
15658   
15659   dSum2nd += dYield2nd;
15660   dSum4th += dYield4th;
15661   dSum6th += dYield6th;
15662   dSum8th += dYield8th;
15663   
15664   dErrVn2nd += dYield2nd*dYield2nd*dErrvn2nd*dErrvn2nd; // ro be improved (check this relation)
15665   dErrVn4th += dYield4th*dYield4th*dErrvn4th*dErrvn4th;
15666   dErrVn6th += dYield6th*dYield6th*dErrvn6th*dErrvn6th;
15667   dErrVn8th += dYield8th*dYield8th*dErrvn8th*dErrvn8th;
15668     
15669  } // end of for(Int_t p=1;p<nBinsPt+1;p++)
15670
15671  // normalizing the results for integrated flow:
15672  if(dSum2nd) 
15673  {
15674   dVn2nd /= dSum2nd;
15675   dErrVn2nd /= (dSum2nd*dSum2nd);
15676   dErrVn2nd = TMath::Sqrt(dErrVn2nd);
15677  } 
15678  if(dSum4th) 
15679  {
15680   dVn4th /= dSum4th;
15681   dErrVn4th /= (dSum4th*dSum4th);
15682   dErrVn4th = TMath::Sqrt(dErrVn4th);
15683  } 
15684  //if(dSum6th) dVn6th/=dSum6th;
15685  //if(dSum8th) dVn8th/=dSum8th;
15686   
15687  // storing the results for integrated flow in common histos: (to be improved: new method for this?)
15688  if(type == "POI")
15689  {
15690   fCommonHistsResults2nd->FillIntegratedFlowPOI(dVn2nd,dErrVn2nd); 
15691   fCommonHistsResults4th->FillIntegratedFlowPOI(dVn4th,dErrVn4th); 
15692   fCommonHistsResults6th->FillIntegratedFlowPOI(dVn6th,0.); // to be improved (errors)
15693   fCommonHistsResults8th->FillIntegratedFlowPOI(dVn8th,0.); // to be improved (errors)
15694  }
15695  else if (type == "RP")
15696  {
15697   fCommonHistsResults2nd->FillIntegratedFlowRP(dVn2nd,dErrVn2nd); 
15698   fCommonHistsResults4th->FillIntegratedFlowRP(dVn4th,dErrVn4th);
15699   fCommonHistsResults6th->FillIntegratedFlowRP(dVn6th,0.); // to be improved (errors)
15700   fCommonHistsResults8th->FillIntegratedFlowRP(dVn8th,0.); // to be improved (errors)
15701  }
15702  
15703  delete flow2ndPt;
15704  delete flow4thPt;
15705  //delete flow6thPt;
15706  //delete flow8thPt;
15707  
15708  delete yield2ndPt;
15709  delete yield4thPt;
15710  delete yield6thPt;
15711  delete yield8thPt;
15712            
15713 } // end of AliFlowAnalysisWithQCumulants::CalculateFinalResultsForRPandPOIIntegratedFlow(TString type)
15714
15715 //=======================================================================================================================
15716
15717 void AliFlowAnalysisWithQCumulants::InitializeArraysForDistributions()
15718 {
15719  // Initialize all arrays used for distributions.
15720  
15721  // a) Initialize arrays of histograms used to hold distributions of correlations; 
15722  // b) Initialize array to hold min and max values of correlations;
15723  // c) Initialize default min and max values of correlation products;
15724  // d) Initialize default min and max values of q-vector terms.
15725  
15726  // a) Initialize arrays of histograms used to hold distributions of correlations:
15727  for(Int_t di=0;di<4;di++) // distribution index
15728  {
15729   fDistributions[di] = NULL;
15730  }
15731  
15732  // b) Initialize default min and max values of correlations:
15733  //    (Remark: The default values bellow were chosen for v2=5% and M=500)
15734  fMinValueOfCorrelation[0] = -0.01; // <2>_min 
15735  fMaxValueOfCorrelation[0] = 0.04; // <2>_max 
15736  fMinValueOfCorrelation[1] = -0.00002; // <4>_min 
15737  fMaxValueOfCorrelation[1] = 0.00015; // <4>_max  
15738  fMinValueOfCorrelation[2] = -0.0000003; // <6>_min 
15739  fMaxValueOfCorrelation[2] = 0.0000006; // <6>_max  
15740  fMinValueOfCorrelation[3] = -0.000000006; // <8>_min 
15741  fMaxValueOfCorrelation[3] = 0.000000003; // <8>_max 
15742
15743  // c) Initialize default min and max values of correlation products:
15744  //    (Remark: The default values bellow were chosen for v2=5% and M=500)
15745  fMinValueOfCorrelationProduct[0] = -0.01; // <2><4>_min 
15746  fMaxValueOfCorrelationProduct[0] = 0.04; // <2><4>_max 
15747
15748  // d) Initialize default min and max values of q-vector terms:
15749  fMinValueOfQvectorTerms[0] = 0.;
15750  fMaxValueOfQvectorTerms[0] = 30.;
15751  fMinValueOfQvectorTerms[1] = 0.;
15752  fMaxValueOfQvectorTerms[1] = 20.;
15753  fMinValueOfQvectorTerms[2] = 0.;
15754  fMaxValueOfQvectorTerms[2] = 200.;
15755  fMinValueOfQvectorTerms[3] = -30.;
15756  fMaxValueOfQvectorTerms[3] = 80.;
15757
15758 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForDistributions()
15759
15760 //=======================================================================================================================
15761
15762 void AliFlowAnalysisWithQCumulants::InitializeArraysForVarious()
15763 {
15764  // Initialize all arrays used for various unclassified objects.
15765  
15766  for(Int_t p=0;p<4;p++) // [v_min,v_max,refMult_min,refMult_max]
15767  {
15768   fPhiDistributionForOneEventSettings[p] = 0.;
15769  } 
15770    
15771 } //  end of void AliFlowAnalysisWithQCumulants::InitializeArraysForVarious()
15772
15773 //=======================================================================================================================
15774
15775 void AliFlowAnalysisWithQCumulants::BookEverythingForDistributions()
15776 {
15777  // a) Book profile to hold all flags for distributions of correlations;
15778  // b) Book all histograms to hold distributions of correlations.
15779  
15780  TString correlationIndex[4] = {"#LT2#GT","#LT4#GT","#LT6#GT","#LT8#GT"}; // TBI (should I promote this to data members?)
15781   
15782  // a) Book profile to hold all flags for distributions of correlations:
15783  TString distributionsFlagsName = "fDistributionsFlags";
15784  distributionsFlagsName += fAnalysisLabel->Data();
15785  fDistributionsFlags = new TProfile(distributionsFlagsName.Data(),"Flags for Distributions of Correlations",10,0,10);
15786  fDistributionsFlags->SetTickLength(-0.01,"Y");
15787  fDistributionsFlags->SetMarkerStyle(25);
15788  fDistributionsFlags->SetLabelSize(0.05);
15789  fDistributionsFlags->SetLabelOffset(0.02,"Y");
15790  fDistributionsFlags->SetStats(kFALSE);
15791  fDistributionsFlags->GetXaxis()->SetBinLabel(1,"Store or not?");
15792  fDistributionsFlags->GetXaxis()->SetBinLabel(2,"#LT2#GT_{min}");
15793  fDistributionsFlags->GetXaxis()->SetBinLabel(3,"#LT2#GT_{max}");
15794  fDistributionsFlags->GetXaxis()->SetBinLabel(4,"#LT4#GT_{min}");
15795  fDistributionsFlags->GetXaxis()->SetBinLabel(5,"#LT4#GT_{max}");
15796  fDistributionsFlags->GetXaxis()->SetBinLabel(6,"#LT6#GT_{min}");
15797  fDistributionsFlags->GetXaxis()->SetBinLabel(7,"#LT6#GT_{max}");
15798  fDistributionsFlags->GetXaxis()->SetBinLabel(8,"#LT8#GT_{min}");
15799  fDistributionsFlags->GetXaxis()->SetBinLabel(9,"#LT8#GT_{max}");
15800  fDistributionsFlags->GetXaxis()->SetBinLabel(10,"fnBinsForCorrelations");
15801  fDistributionsList->Add(fDistributionsFlags);
15802  
15803  // b) Book all histograms to hold distributions of correlations.
15804  if(fStoreDistributions)
15805  { 
15806   TString distributionsName = "fDistributions";
15807   distributionsName += fAnalysisLabel->Data();
15808   for(Int_t di=0;di<4;di++) // distribution index
15809   {
15810    fDistributions[di] = new TH1D(Form("Distribution of %s",correlationIndex[di].Data()),Form("Distribution of %s",correlationIndex[di].Data()),fnBinsForCorrelations,fMinValueOfCorrelation[di],fMaxValueOfCorrelation[di]); 
15811    fDistributions[di]->SetXTitle(correlationIndex[di].Data());
15812    fDistributionsList->Add(fDistributions[di]);
15813   } // end of for(Int_t di=0;di<4;di++) // distribution index
15814  } // end of if(fStoreDistributions)
15815  
15816 } // end of void AliFlowAnalysisWithQCumulants::BookEverythingForDistributions()
15817
15818 //=======================================================================================================================
15819
15820 void AliFlowAnalysisWithQCumulants::BookEverythingForVarious()
15821 {
15822  // Book all objects for various unclassified quantities.
15823  
15824  if(!fStorePhiDistributionForOneEvent){return;}
15825  
15826  // a) Book histogram holding phi distribution for single event to illustrate flow.
15827  
15828  // a) Book histogram holding phi distribution for single event to illustrate flow:
15829  fPhiDistributionForOneEvent = new TH1D("fPhiDistributionForOneEvent","",360,0.,TMath::TwoPi());
15830  fPhiDistributionForOneEvent->GetXaxis()->SetTitle("#phi");
15831  fVariousList->Add(fPhiDistributionForOneEvent);
15832  
15833 } // end of void AliFlowAnalysisWithQCumulants::BookEverythingForVarious()
15834
15835 //=======================================================================================================================
15836
15837 void AliFlowAnalysisWithQCumulants::StoreFlagsForDistributions()
15838 {
15839  // Store all flags for distributiuons of correlations in profile fDistributionsFlags.
15840  
15841  if(!fDistributionsFlags)
15842  {
15843   cout<<"WARNING: fDistributionsFlags is NULL in AFAWQC::SDF() !!!!"<<endl;
15844   exit(0);
15845  } 
15846
15847  fDistributionsFlags->Fill(0.5,(Int_t)fStoreDistributions); // histos with distributions of correlations stored or not in the output file
15848  // store min and max values of correlations:
15849  for(Int_t di=0;di<4;di++) // distribution index
15850  {
15851   fDistributionsFlags->Fill(1.5+2.*(Double_t)di,fMinValueOfCorrelation[di]);
15852   fDistributionsFlags->Fill(2.5+2.*(Double_t)di,fMaxValueOfCorrelation[di]);
15853  }
15854  fDistributionsFlags->Fill(9.5,fnBinsForCorrelations);
15855      
15856 } // end of void AliFlowAnalysisWithQCumulants::StoreFlagsForDistributions()
15857
15858 //=======================================================================================================================
15859
15860 void AliFlowAnalysisWithQCumulants::StoreDistributionsOfCorrelations()
15861 {
15862  // Store distributions of correlations.
15863  
15864  if(!(fIntFlowCorrelationsEBE && fIntFlowEventWeightsForCorrelationsEBE))
15865  {
15866   cout<<"WARNING: fIntFlowCorrelationsEBE && fIntFlowEventWeightsForCorrelationsEBE"<<endl; 
15867   cout<<"         is NULL in AFAWQC::SDOC() !!!!"<<endl;
15868   exit(0);
15869  }
15870
15871  for(Int_t di=0;di<4;di++) // distribution index
15872  {
15873   if(!fDistributions[di])
15874   { 
15875    cout<<"WARNING: fDistributions[di] is NULL in AFAWQC::SDOC() !!!!"<<endl;
15876    cout<<"di = "<<di<<endl;
15877    exit(0);
15878   } else 
15879     {
15880      fDistributions[di]->Fill(fIntFlowCorrelationsEBE->GetBinContent(di+1),fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(di+1)); 
15881     } 
15882  } // end of for(Int_t di=0;di<4;di++) // distribution index
15883
15884 } // end of void AliFlowAnalysisWithQCumulants::StoreDistributionsOfCorrelations()
15885
15886 //=======================================================================================================================
15887
15888 void AliFlowAnalysisWithQCumulants::BookAndNestAllLists()
15889 {
15890  // Book and nest all lists nested in the base list fHistList.
15891  //  a) Book and nest lists for integrated flow;
15892  //  b) Book and nest lists for differential flow;
15893  //  c) Book and nest list for particle weights;
15894  //  d) Book and nest list for distributions;
15895  //  e) Book and nest list for various unclassified objects; 
15896  //  f) Book and nest list for other differential correlators;
15897  //  g) Book and nest list for nested loops;
15898  //  h) Book and nest lists for mixed harmonics;
15899  //  i) Book and nest lists for control histograms;
15900  //  j) Book and nest lists for bootstrap.
15901
15902  // a) Book and nest all lists for integrated flow:
15903  //  Base list for integrated flow:
15904  fIntFlowList = new TList();
15905  fIntFlowList->SetName("Integrated Flow");
15906  fIntFlowList->SetOwner(kTRUE);
15907  fHistList->Add(fIntFlowList);
15908  //  List holding profiles: 
15909  fIntFlowProfiles = new TList();
15910  fIntFlowProfiles->SetName("Profiles");
15911  fIntFlowProfiles->SetOwner(kTRUE);
15912  fIntFlowList->Add(fIntFlowProfiles);
15913  //  List holding all profiles with results for correlations vs M:
15914  if(fCalculateAllCorrelationsVsM)
15915  {
15916   fIntFlowAllCorrelationsVsM = new TList();
15917   fIntFlowAllCorrelationsVsM->SetName("Correlations vs M");
15918   fIntFlowAllCorrelationsVsM->SetOwner(kTRUE); 
15919   fIntFlowProfiles->Add(fIntFlowAllCorrelationsVsM);
15920  } // end of if(fCalculateAllCorrelationsVsM)
15921  //  List holding histograms with results:
15922  fIntFlowResults = new TList();
15923  fIntFlowResults->SetName("Results");
15924  fIntFlowResults->SetOwner(kTRUE);
15925  fIntFlowList->Add(fIntFlowResults);
15926  
15927  // b) Book and nest lists for differential flow:
15928  this->BookAndNestListsForDifferentialFlow();
15929  
15930  // c) Book and nest list for particle weights:
15931  fWeightsList->SetName("Weights");
15932  fWeightsList->SetOwner(kTRUE);   
15933  fHistList->Add(fWeightsList); 
15934
15935  // d) Book and nest list for distributions:
15936  fDistributionsList = new TList();
15937  fDistributionsList->SetName("Distributions");
15938  fDistributionsList->SetOwner(kTRUE);
15939  fHistList->Add(fDistributionsList);
15940  
15941  // e) Book and nest list for various unclassified objects:
15942  if(fStorePhiDistributionForOneEvent)
15943  {
15944   fVariousList = new TList();
15945   fVariousList->SetName("Various");
15946   fVariousList->SetOwner(kTRUE);
15947   fHistList->Add(fVariousList);
15948  }
15949   
15950  // f) Book and nest list for other differential correlators:
15951  fOtherDiffCorrelatorsList = new TList();
15952  fOtherDiffCorrelatorsList->SetName("Other differential correlators");
15953  fOtherDiffCorrelatorsList->SetOwner(kTRUE);
15954  if(fCalculateDiffFlow){fHistList->Add(fOtherDiffCorrelatorsList);} // TBI: Use another flag here instead of fCalculateDiffFlow 
15955   
15956  // g) Book and nest list for nested loops:
15957  fNestedLoopsList = new TList();
15958  fNestedLoopsList->SetName("Nested Loops");
15959  fNestedLoopsList->SetOwner(kTRUE);
15960  fHistList->Add(fNestedLoopsList);
15961
15962  // h) Book and nest lists for mixed harmonics:
15963  //  Base list for mixed harmonics:
15964  fMixedHarmonicsList = new TList();
15965  fMixedHarmonicsList->SetName("Mixed Harmonics");
15966  fMixedHarmonicsList->SetOwner(kTRUE);
15967  fHistList->Add(fMixedHarmonicsList);
15968  //  List holding profiles: 
15969  fMixedHarmonicsProfiles = new TList();
15970  fMixedHarmonicsProfiles->SetName("Profiles");
15971  fMixedHarmonicsProfiles->SetOwner(kTRUE);
15972  if(fCalculateMixedHarmonics){fMixedHarmonicsList->Add(fMixedHarmonicsProfiles);}
15973  //  List holding histograms with results:
15974  fMixedHarmonicsResults = new TList();
15975  fMixedHarmonicsResults->SetName("Results");
15976  fMixedHarmonicsResults->SetOwner(kTRUE);
15977  if(fCalculateMixedHarmonics){fMixedHarmonicsList->Add(fMixedHarmonicsResults);}
15978  //  List holding objects for statistical error propagation of mixed harmonics:
15979  fMixedHarmonicsErrorPropagation = new TList();
15980  fMixedHarmonicsErrorPropagation->SetName("Error Propagation");
15981  fMixedHarmonicsErrorPropagation->SetOwner(kTRUE);
15982  if(fCalculateMixedHarmonics){fMixedHarmonicsList->Add(fMixedHarmonicsErrorPropagation);}
15983
15984  // i) Book and nest lists for control histograms:
15985  //  Base list for mixed harmonics:
15986  fControlHistogramsList = new TList();
15987  fControlHistogramsList->SetName("Control Histograms");
15988  fControlHistogramsList->SetOwner(kTRUE);
15989  fHistList->Add(fControlHistogramsList);
15990
15991  // j) Book and nest lists for bootstrap:
15992  fBootstrapList = new TList();
15993  fBootstrapList->SetName("Bootstrap");
15994  fBootstrapList->SetOwner(kTRUE);
15995  fHistList->Add(fBootstrapList);
15996  //  List holding profiles: 
15997  fBootstrapProfilesList = new TList();
15998  fBootstrapProfilesList->SetName("Profiles");
15999  fBootstrapProfilesList->SetOwner(kTRUE);
16000  if(fUseBootstrap||fUseBootstrapVsM){fBootstrapList->Add(fBootstrapProfilesList);}
16001  //  List holding histograms with results:
16002  fBootstrapResultsList = new TList();
16003  fBootstrapResultsList->SetName("Results");
16004  fBootstrapResultsList->SetOwner(kTRUE);
16005  if(fUseBootstrap||fUseBootstrapVsM){fBootstrapList->Add(fBootstrapResultsList);}
16006
16007 } // end of void AliFlowAnalysisWithQCumulants::BookAndNestAllLists()
16008
16009 //=======================================================================================================================
16010
16011 void AliFlowAnalysisWithQCumulants::BookAndNestListsForDifferentialFlow()
16012 {
16013  // Book and nest lists for differential flow.
16014
16015  // Base list for differential flow objects:
16016  fDiffFlowList = new TList();
16017  fDiffFlowList->SetName("Differential Flow");
16018  fDiffFlowList->SetOwner(kTRUE); 
16019  fHistList->Add(fDiffFlowList);
16020  
16021  // Local flags: 
16022  TString typeFlag[2] = {"RP","POI"};  
16023  TString ptEtaFlag[2] = {"p_{T}","#eta"}; 
16024  TString powerFlag[2] = {"linear","quadratic"};   
16025
16026  // 2D:
16027  if(fCalculate2DDiffFlow)
16028  {
16029   fDiffFlow2D = new TList(); 
16030   fDiffFlow2D->SetName("2D");
16031   fDiffFlow2D->SetOwner(kTRUE);
16032   fDiffFlowList->Add(fDiffFlow2D); 
16033   for(Int_t t=0;t<2;t++)
16034   {
16035    f2DDiffFlowCorrelationsProList[t] = new TList();
16036    f2DDiffFlowCorrelationsProList[t]->SetOwner(kTRUE);
16037    f2DDiffFlowCorrelationsProList[t]->SetName(Form("Profiles with 2D correlations (%s)",typeFlag[t].Data()));
16038    fDiffFlow2D->Add(f2DDiffFlowCorrelationsProList[t]);
16039   } // end of for(Int_t t=0;t<2;t++)
16040  } // end of if(fCalculate2DDiffFlow)
16041
16042  // What follows bellow in this method is relevant only for 1D differential flow:
16043  if(!fCalculateDiffFlow){return;}
16044  
16045  // List holding profiles: 
16046  fDiffFlowProfiles = new TList(); 
16047  fDiffFlowProfiles->SetName("Profiles");
16048  fDiffFlowProfiles->SetOwner(kTRUE);
16049  fDiffFlowList->Add(fDiffFlowProfiles);
16050  // List holding histograms with results: 
16051  fDiffFlowResults = new TList();
16052  fDiffFlowResults->SetName("Results");
16053  fDiffFlowResults->SetOwner(kTRUE);
16054  fDiffFlowList->Add(fDiffFlowResults);
16055  // Flags used for naming nested lists in list fDiffFlowProfiles and fDiffFlowResults:  
16056  TList list;
16057  list.SetOwner(kTRUE);
16058  // Nested lists in fDiffFlowProfiles (~/Differential Flow/Profiles):
16059  for(Int_t t=0;t<2;t++) // type: RP or POI
16060  {
16061   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
16062   {
16063    // list holding profiles with correlations:
16064    fDiffFlowCorrelationsProList[t][pe] = (TList*)list.Clone();
16065    fDiffFlowCorrelationsProList[t][pe]->SetName(Form("Profiles with correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16066    fDiffFlowProfiles->Add(fDiffFlowCorrelationsProList[t][pe]);
16067    // list holding profiles with products of correlations:
16068    fDiffFlowProductOfCorrelationsProList[t][pe] = (TList*)list.Clone();
16069    fDiffFlowProductOfCorrelationsProList[t][pe]->SetName(Form("Profiles with products of correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16070    fDiffFlowProfiles->Add(fDiffFlowProductOfCorrelationsProList[t][pe]);
16071    // list holding profiles with corrections:
16072    fDiffFlowCorrectionsProList[t][pe] = (TList*)list.Clone();
16073    fDiffFlowCorrectionsProList[t][pe]->SetName(Form("Profiles with correction terms for NUA (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16074    fDiffFlowProfiles->Add(fDiffFlowCorrectionsProList[t][pe]);   
16075   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
16076  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI   
16077  // nested lists in fDiffFlowResults (~/Differential Flow/Results):
16078  for(Int_t t=0;t<2;t++) // type: RP or POI
16079  {
16080   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
16081   {
16082    // list holding histograms with correlations:
16083    fDiffFlowCorrelationsHistList[t][pe] = (TList*)list.Clone();
16084    fDiffFlowCorrelationsHistList[t][pe]->SetName(Form("Correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16085    fDiffFlowResults->Add(fDiffFlowCorrelationsHistList[t][pe]);
16086    // list holding histograms with corrections:
16087    fDiffFlowCorrectionsHistList[t][pe] = (TList*)list.Clone();
16088    fDiffFlowCorrectionsHistList[t][pe]->SetName(Form("Histograms with correction terms for NUA (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16089    fDiffFlowResults->Add(fDiffFlowCorrectionsHistList[t][pe]);   
16090    for(Int_t power=0;power<2;power++)
16091    {
16092     // list holding histograms with sums of event weights:
16093     fDiffFlowSumOfEventWeightsHistList[t][pe][power] = (TList*)list.Clone();
16094     fDiffFlowSumOfEventWeightsHistList[t][pe][power]->SetName(Form("Sum of %s event weights (%s, %s)",powerFlag[power].Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16095     fDiffFlowResults->Add(fDiffFlowSumOfEventWeightsHistList[t][pe][power]);    
16096    } // end of for(Int_t power=0;power<2;power++)
16097    // list holding histograms with sums of products of event weights:
16098    fDiffFlowSumOfProductOfEventWeightsHistList[t][pe] = (TList*)list.Clone();
16099    fDiffFlowSumOfProductOfEventWeightsHistList[t][pe]->SetName(Form("Sum of products of event weights (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16100    fDiffFlowResults->Add(fDiffFlowSumOfProductOfEventWeightsHistList[t][pe]);
16101    // list holding histograms with covariances of correlations:
16102    fDiffFlowCovariancesHistList[t][pe] = (TList*)list.Clone();
16103    fDiffFlowCovariancesHistList[t][pe]->SetName(Form("Covariances of correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16104    fDiffFlowResults->Add(fDiffFlowCovariancesHistList[t][pe]);
16105    // list holding histograms with differential Q-cumulants:
16106    fDiffFlowCumulantsHistList[t][pe] = (TList*)list.Clone();
16107    fDiffFlowCumulantsHistList[t][pe]->SetName(Form("Differential Q-cumulants (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16108    fDiffFlowResults->Add(fDiffFlowCumulantsHistList[t][pe]);   
16109    // list holding histograms which quantify detector bias to differential Q-cumulants:
16110    fDiffFlowDetectorBiasHistList[t][pe] = (TList*)list.Clone();
16111    fDiffFlowDetectorBiasHistList[t][pe]->SetName(Form("Detector bias (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16112    fDiffFlowResults->Add(fDiffFlowDetectorBiasHistList[t][pe]);   
16113    // list holding histograms with differential flow estimates from Q-cumulants:
16114    fDiffFlowHistList[t][pe] = (TList*)list.Clone();
16115    fDiffFlowHistList[t][pe]->SetName(Form("Differential flow (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16116    fDiffFlowResults->Add(fDiffFlowHistList[t][pe]);      
16117   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
16118  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
16119   
16120 } // end of void AliFlowAnalysisWithQCumulants::BookAndNestListsForDifferentialFlow()
16121
16122 //=======================================================================================================================
16123
16124 void AliFlowAnalysisWithQCumulants::FillCommonHistResultsDiffFlow(TString type)
16125 {
16126  // Fill common result histograms for differential flow.
16127  
16128  Int_t t = 0; 
16129
16130  if(type == "RP")
16131  {
16132   t = 0;
16133  } else if(type == "POI")
16134    {
16135     t = 1;
16136    } 
16137   
16138  // to be improved - check all pointers used in this method
16139      
16140  if(!(fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th))
16141  {
16142   cout<<"WARNING: fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th"<<endl; 
16143   cout<<"         is NULL in AFAWQC::FCHRIF() !!!!"<<endl;
16144   exit(0);
16145  }
16146  
16147  // pt:
16148  for(Int_t p=1;p<=fnBinsPt;p++)
16149  {
16150   Double_t v2 = fDiffFlow[t][0][0]->GetBinContent(p);
16151   Double_t v4 = fDiffFlow[t][0][1]->GetBinContent(p);
16152   Double_t v6 = fDiffFlow[t][0][2]->GetBinContent(p);
16153   Double_t v8 = fDiffFlow[t][0][3]->GetBinContent(p);
16154   
16155   Double_t v2Error = fDiffFlow[t][0][0]->GetBinError(p);
16156   Double_t v4Error = fDiffFlow[t][0][1]->GetBinError(p);
16157   //Double_t v6Error = fFinalFlow1D[t][pW][nua][0][2]->GetBinError(p);
16158   //Double_t v8Error = fFinalFlow1D[t][pW][nua][0][3]->GetBinError(p);
16159  
16160   if(type == "RP")
16161   {
16162    fCommonHistsResults2nd->FillDifferentialFlowPtRP(p,v2,v2Error);
16163    fCommonHistsResults4th->FillDifferentialFlowPtRP(p,v4,v4Error);
16164    fCommonHistsResults6th->FillDifferentialFlowPtRP(p,v6,0.);
16165    fCommonHistsResults8th->FillDifferentialFlowPtRP(p,v8,0.);
16166   } else if(type == "POI")
16167     {
16168      fCommonHistsResults2nd->FillDifferentialFlowPtPOI(p,v2,v2Error);
16169      fCommonHistsResults4th->FillDifferentialFlowPtPOI(p,v4,v4Error);
16170      fCommonHistsResults6th->FillDifferentialFlowPtPOI(p,v6,0.);
16171      fCommonHistsResults8th->FillDifferentialFlowPtPOI(p,v8,0.);
16172     }
16173  } // end of for(Int_t p=1;p<=fnBinsPt;p++)   
16174  
16175  // eta:
16176  if(!fCalculateDiffFlowVsEta){return;}
16177  for(Int_t e=1;e<=fnBinsEta;e++)
16178  {
16179   Double_t v2 = fDiffFlow[t][1][0]->GetBinContent(e);
16180   Double_t v4 = fDiffFlow[t][1][1]->GetBinContent(e);
16181   Double_t v6 = fDiffFlow[t][1][2]->GetBinContent(e);
16182   Double_t v8 = fDiffFlow[t][1][3]->GetBinContent(e);
16183   
16184   Double_t v2Error = fDiffFlow[t][1][0]->GetBinError(e);
16185   Double_t v4Error = fDiffFlow[t][1][1]->GetBinError(e);
16186   //Double_t v6Error = fDiffFlow[t][1][2]->GetBinError(e);
16187   //Double_t v8Error = fDiffFlow[t][1][3]->GetBinError(e);
16188  
16189   if(type == "RP")
16190   {
16191    fCommonHistsResults2nd->FillDifferentialFlowEtaRP(e,v2,v2Error);
16192    fCommonHistsResults4th->FillDifferentialFlowEtaRP(e,v4,v4Error);
16193    fCommonHistsResults6th->FillDifferentialFlowEtaRP(e,v6,0.);
16194    fCommonHistsResults8th->FillDifferentialFlowEtaRP(e,v8,0.);
16195   } else if(type == "POI")
16196     {
16197      fCommonHistsResults2nd->FillDifferentialFlowEtaPOI(e,v2,v2Error);
16198      fCommonHistsResults4th->FillDifferentialFlowEtaPOI(e,v4,v4Error);
16199      fCommonHistsResults6th->FillDifferentialFlowEtaPOI(e,v6,0.);
16200      fCommonHistsResults8th->FillDifferentialFlowEtaPOI(e,v8,0.);
16201     }
16202  } // end of for(Int_t e=1;e<=fnBinsEta;e++)    
16203  
16204 } // end of void AliFlowAnalysisWithQCumulants::FillCommonHistResultsDiffFlow(TString type, Bool_t useParticleWeights, TString eventWeights, Bool_t correctedForNUA)
16205
16206 //=======================================================================================================================
16207
16208 void AliFlowAnalysisWithQCumulants::CommonConstants(TString method)
16209 {
16210  // Access and store common constants.
16211  
16212  // a) If this method was called in Init() access common constants from AliFlowCommonConstants;
16213  // b) If this method was called in Init() book and fill TProfile to hold constants accessed in a);
16214  // c) If this method was called in Finish() access common constants from TProfile booked and filled in b).
16215
16216  if(method == "Init")
16217  {
16218   // a) If this method was called in Init() access common constants from AliFlowCommonConstants:
16219   fnBinsPhi = AliFlowCommonConstants::GetMaster()->GetNbinsPhi();
16220   fPhiMin = AliFlowCommonConstants::GetMaster()->GetPhiMin();        
16221   fPhiMax = AliFlowCommonConstants::GetMaster()->GetPhiMax();
16222   if(fnBinsPhi){fPhiBinWidth = (fPhiMax-fPhiMin)/fnBinsPhi;}  
16223   fnBinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
16224   fPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();          
16225   fPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
16226   if(fnBinsPt){fPtBinWidth = (fPtMax-fPtMin)/fnBinsPt;}  
16227   fnBinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
16228   fEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();        
16229   fEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();
16230   if(fnBinsEta){fEtaBinWidth = (fEtaMax-fEtaMin)/fnBinsEta;}  
16231   
16232   // b) If this method was called in Init() book and fill TProfile to hold constants accessed in a):
16233   TString fCommonConstantsName = "fCommonConstants";
16234   fCommonConstantsName += fAnalysisLabel->Data();
16235   fCommonConstants = new TProfile(fCommonConstantsName.Data(),"Common constants",9,0.,9.);
16236   fCommonConstants->SetLabelSize(0.05);
16237   fCommonConstants->GetXaxis()->SetBinLabel(1,"nBins (#phi)");
16238   fCommonConstants->Fill(0.5,fnBinsPhi);
16239   fCommonConstants->GetXaxis()->SetBinLabel(2,"#phi_{min}");
16240   fCommonConstants->Fill(1.5,fPhiMin);
16241   fCommonConstants->GetXaxis()->SetBinLabel(3,"#phi_{max}");
16242   fCommonConstants->Fill(2.5,fPhiMax);
16243   fCommonConstants->GetXaxis()->SetBinLabel(4,"nBins (p_{t})");
16244   fCommonConstants->Fill(3.5,fnBinsPt);
16245   fCommonConstants->GetXaxis()->SetBinLabel(5,"(p_{t})_{min}");
16246   fCommonConstants->Fill(4.5,fPtMin);
16247   fCommonConstants->GetXaxis()->SetBinLabel(6,"(p_{t})_{max}");
16248   fCommonConstants->Fill(5.5,fPtMax);
16249   fCommonConstants->GetXaxis()->SetBinLabel(7,"nBins (#eta)");
16250   fCommonConstants->Fill(6.5,fnBinsEta);
16251   fCommonConstants->GetXaxis()->SetBinLabel(8,"#eta_{min}");
16252   fCommonConstants->Fill(7.5,fEtaMin);
16253   fCommonConstants->GetXaxis()->SetBinLabel(9,"#eta_{max}");
16254   fCommonConstants->Fill(8.5,fEtaMax);
16255   fHistList->Add(fCommonConstants); 
16256  } // end of if(method == "Init")
16257  else if(method == "Finish")
16258  {
16259   // c) If this method was called in Finish() access common constants from TProfile booked and filled in b):
16260   if(!fCommonConstants)
16261   {
16262    printf("\n WARNING (QC): fCommonConstants is NULL in AFAWQC::AC(\"%s\") !!!!\n\n",method.Data());
16263    exit(0);
16264   } 
16265   fnBinsPhi = (Int_t)fCommonConstants->GetBinContent(1);
16266   fPhiMin = fCommonConstants->GetBinContent(2);      
16267   fPhiMax = fCommonConstants->GetBinContent(3);
16268   if(fnBinsPhi){fPhiBinWidth = (fPhiMax-fPhiMin)/fnBinsPhi;}  
16269   fnBinsPt = (Int_t)fCommonConstants->GetBinContent(4);
16270   fPtMin = fCommonConstants->GetBinContent(5);       
16271   fPtMax = fCommonConstants->GetBinContent(6);
16272   if(fnBinsPt){fPtBinWidth = (fPtMax-fPtMin)/fnBinsPt;}  
16273   fnBinsEta = (Int_t)fCommonConstants->GetBinContent(7);
16274   fEtaMin = fCommonConstants->GetBinContent(8);      
16275   fEtaMax = fCommonConstants->GetBinContent(9);
16276   if(fnBinsEta){fEtaBinWidth = (fEtaMax-fEtaMin)/fnBinsEta;}  
16277  } // end of else if(method == "Finish")
16278
16279 } // end of void AliFlowAnalysisWithQCumulants::CommonConstants(TString method)
16280
16281 //=======================================================================================================================
16282
16283 void AliFlowAnalysisWithQCumulants::CrossCheckSettings()
16284 {
16285  // a) Cross-check if the choice for multiplicity weights make sense;
16286  // b) Cross-check if the choice for multiplicity itself make sense.
16287
16288  // a) Cross-check if the choice for multiplicity weights make sense:
16289  if((!fMultiplicityWeight->Contains("combinations")) && 
16290     (!fMultiplicityWeight->Contains("unit")) &&
16291     (!fMultiplicityWeight->Contains("multiplicity")) )
16292  {
16293   cout<<"WARNING (QC): Multiplicity weight can be either \"combinations\", \"unit\""<<endl;
16294   cout<<"              or \"multiplicity\". Certainly not \""<<fMultiplicityWeight->Data()<<"\"."<<endl;
16295   exit(0);
16296  }   
16297
16298 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckSettings()
16299
16300 //=======================================================================================================================
16301
16302 void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfEventWeights()
16303 {
16304  // Calculate sum of linear and quadratic event weights for correlations.
16305  
16306  // TBI re-think what is the right multiplicity when particle weights are used! 
16307
16308  // Multiplicity bin of an event (relevant for all histos vs M): 
16309  Double_t dMultiplicityBin = 0.;
16310  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
16311  {
16312   dMultiplicityBin = fNumberOfRPsEBE+0.5;
16313  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
16314    {
16315      dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
16316    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
16317      {
16318       dMultiplicityBin = fNumberOfPOIsEBE+0.5;
16319      }
16320                         
16321  for(Int_t p=0;p<2;p++) // power-1
16322  {
16323   for(Int_t ci=0;ci<4;ci++) // correlation index
16324   { 
16325    fIntFlowSumOfEventWeights[p]->Fill(ci+0.5,pow(fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci+1),p+1)); 
16326    if(fCalculateCumulantsVsM)
16327    {
16328     if(fFillProfilesVsMUsingWeights)
16329     {
16330      fIntFlowSumOfEventWeightsVsM[ci][p]->Fill(dMultiplicityBin,pow(fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci+1),p+1)); // to be improved: dMult => sum of weights?
16331     } else
16332       {
16333        fIntFlowSumOfEventWeightsVsM[ci][p]->Fill(dMultiplicityBin); // to be improved: dMult => sum of weights?
16334       }
16335    } // end of if(fCalculateCumulantsVsM)
16336   } // end of for(Int_t ci=0;ci<4;ci++) // correlation index
16337  } // end of for(Int_t p=0;p<2;p++) // power-1
16338   
16339 } // end of void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfEventWeights()
16340
16341 //=======================================================================================================================
16342
16343 void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfEventWeightsNUA()
16344 {
16345  // Calculate sum of linear and quadratic event weights for NUA terms.
16346                        
16347  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
16348  {
16349   for(Int_t p=0;p<2;p++) // power-1
16350   {
16351    for(Int_t ci=0;ci<4;ci++) // nua term index
16352    { 
16353     fIntFlowSumOfEventWeightsNUA[sc][p]->Fill(ci+0.5,pow(fIntFlowEventWeightForCorrectionTermsForNUAEBE[sc]->GetBinContent(ci+1),p+1)); 
16354    }
16355   }
16356  }
16357   
16358 } // end of void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfEventWeightsNUA()
16359
16360 //=======================================================================================================================
16361
16362 void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfProductOfEventWeights()
16363 {
16364  // Calculate sum of product of event weights for correlations.
16365   
16366  // TBI re-think what is the right multiplicity when particle weights are used!
16367
16368  // Multiplicity bin of an event (relevant for all histos vs M): 
16369  Double_t dMultiplicityBin = 0.;
16370  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
16371  {
16372   dMultiplicityBin = fNumberOfRPsEBE+0.5;
16373  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
16374    {
16375     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
16376    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
16377      {
16378       dMultiplicityBin = fNumberOfPOIsEBE+0.5;
16379      }
16380   
16381  Int_t counter = 0;
16382  
16383  for(Int_t ci1=1;ci1<4;ci1++)
16384  {
16385   for(Int_t ci2=ci1+1;ci2<=4;ci2++)
16386   {
16387    fIntFlowSumOfProductOfEventWeights->Fill(0.5+counter,
16388                                             fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci1)*
16389                                             fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci2));
16390    if(fCalculateCumulantsVsM)
16391    {                                                                                    
16392     if(fFillProfilesVsMUsingWeights)
16393     {
16394      fIntFlowSumOfProductOfEventWeightsVsM[counter]->Fill(dMultiplicityBin, // to be improved: dMult => sum of weights?
16395                                                           fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci1)*
16396                                                           fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci2));
16397     } else
16398       {
16399        fIntFlowSumOfProductOfEventWeightsVsM[counter]->Fill(dMultiplicityBin);
16400       }
16401    } // end of if(fCalculateCumulantsVsM)
16402    counter++;                                         
16403   } // end of for(Int_t ci2=ci1+1;ci2<=4;ci2++)
16404  } // end of for(Int_t ci1=1;ci1<4;ci1++)
16405
16406 } // end of void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfProductOfEventWeights()
16407
16408 //=======================================================================================================================
16409
16410 void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfProductOfEventWeightsNUA()
16411 {
16412  // Calculate sum of product of event weights for NUA terms.
16413   
16414  // w_{<2>} * w_{<cos(#phi)>}:
16415  fIntFlowSumOfProductOfEventWeightsNUA->Fill(0.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
16416                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1));
16417  // w_{<2>} * w_{<sin(#phi)>}:
16418  fIntFlowSumOfProductOfEventWeightsNUA->Fill(1.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
16419                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
16420  // w_{<cos(#phi)> * w_{<sin(#phi)>}:
16421  fIntFlowSumOfProductOfEventWeightsNUA->Fill(2.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
16422                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
16423  // w_{<2>} * w{<cos(phi1+phi2)>}
16424  fIntFlowSumOfProductOfEventWeightsNUA->Fill(3.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
16425                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
16426  // w_{<2>} * w{<sin(phi1+phi2)>}
16427  fIntFlowSumOfProductOfEventWeightsNUA->Fill(4.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
16428                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));
16429  // w_{<2>} * w{<cos(phi1-phi2-phi3)>}
16430  fIntFlowSumOfProductOfEventWeightsNUA->Fill(5.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
16431                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));
16432  // w_{<2>} * w{<sin(phi1-phi2-phi3)>}
16433  fIntFlowSumOfProductOfEventWeightsNUA->Fill(6.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
16434                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));  
16435  // w_{<4>} * w{<cos(phi1)>}
16436  fIntFlowSumOfProductOfEventWeightsNUA->Fill(7.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
16437                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1));
16438  // w_{<4>} * w{<sin(phi1)>}
16439  fIntFlowSumOfProductOfEventWeightsNUA->Fill(8.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
16440                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
16441  // w_{<4>} * w{<cos(phi1+phi2)>}
16442  fIntFlowSumOfProductOfEventWeightsNUA->Fill(9.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
16443                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
16444  // w_{<4>} * w{<sin(phi1+phi2)>}
16445  fIntFlowSumOfProductOfEventWeightsNUA->Fill(10.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
16446                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));
16447  // w_{<4>} * w{<cos(phi1-phi2-phi3)>}
16448  fIntFlowSumOfProductOfEventWeightsNUA->Fill(11.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
16449                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));
16450  // w_{<4>} * w{<sin(phi1-phi2-phi3)>}
16451  fIntFlowSumOfProductOfEventWeightsNUA->Fill(12.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
16452                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));
16453  // w_{<cos(phi1)>} * w{<cos(phi1+phi2)>}
16454  fIntFlowSumOfProductOfEventWeightsNUA->Fill(13.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
16455                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2));
16456  // w_{<cos(phi1)>} * w{<sin(phi1+phi2)>}
16457  fIntFlowSumOfProductOfEventWeightsNUA->Fill(14.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
16458                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
16459  // w_{<cos(phi1)>} * w{<cos(phi1-phi2-phi3)>}
16460  fIntFlowSumOfProductOfEventWeightsNUA->Fill(15.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
16461                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));
16462  // w_{<cos(phi1)>} * w{<sin(phi1-phi2-phi3)>}
16463  fIntFlowSumOfProductOfEventWeightsNUA->Fill(16.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
16464                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));
16465  // w_{<sin(phi1)>} * w{<cos(phi1+phi2)>}
16466  fIntFlowSumOfProductOfEventWeightsNUA->Fill(17.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)*
16467                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2));
16468  // w_{<sin(phi1)>} * w{<sin(phi1+phi2)>}
16469  fIntFlowSumOfProductOfEventWeightsNUA->Fill(18.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)*
16470                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));
16471  // w_{<sin(phi1)>} * w{<cos(phi1-phi2-phi3)>}
16472  fIntFlowSumOfProductOfEventWeightsNUA->Fill(19.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)*
16473                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));
16474  // w_{<sin(phi1)>} * w{<sin(phi1-phi2-phi3)>}
16475  fIntFlowSumOfProductOfEventWeightsNUA->Fill(20.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)*
16476                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
16477  // w_{<cos(phi1+phi2)>} * w{<sin(phi1+phi2))>}
16478  fIntFlowSumOfProductOfEventWeightsNUA->Fill(21.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)*
16479                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
16480  // w_{<cos(phi1+phi2)>} * w{<cos(phi1-phi2-phi3)>}
16481  fIntFlowSumOfProductOfEventWeightsNUA->Fill(22.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)*
16482                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
16483  // w_{<cos(phi1+phi2)>} * w{<sin(phi1-phi2-phi3)>}
16484  fIntFlowSumOfProductOfEventWeightsNUA->Fill(23.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)*
16485                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
16486  // w_{<sin(phi1+phi2)>} * w{<cos(phi1-phi2-phi3)>}
16487  fIntFlowSumOfProductOfEventWeightsNUA->Fill(24.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)*
16488                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
16489  // w_{<sin(phi1+phi2)>} * w{<sin(phi1-phi2-phi3)>}
16490  fIntFlowSumOfProductOfEventWeightsNUA->Fill(25.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)*
16491                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
16492  // w_{<cos(phi1-phi2-phi3)>} * w{<sin(phi1-phi2-phi3)>}
16493  fIntFlowSumOfProductOfEventWeightsNUA->Fill(26.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)*
16494                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));
16495
16496 } // end of void AliFlowAnalysisWithQCumulants::CalculateIntFlowIntFlowSumOfProductOfEventWeightsNUA()
16497
16498 //=======================================================================================================================
16499
16500 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrelations(TString type, TString ptOrEta)
16501 {
16502  // Calculate reduced correlations for RPs or POIs for all pt and eta bins.
16503
16504  // Multiplicity:
16505  Double_t dMult = (*fSpk)(0,0);
16506  
16507  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
16508  Double_t dReQ1n = (*fReQ)(0,0);
16509  Double_t dReQ2n = (*fReQ)(1,0);
16510  //Double_t dReQ3n = (*fReQ)(2,0);
16511  //Double_t dReQ4n = (*fReQ)(3,0);
16512  Double_t dImQ1n = (*fImQ)(0,0);
16513  Double_t dImQ2n = (*fImQ)(1,0);
16514  //Double_t dImQ3n = (*fImQ)(2,0);
16515  //Double_t dImQ4n = (*fImQ)(3,0);
16516
16517  // reduced correlations are stored in fDiffFlowCorrelationsPro[0=RP,1=POI][0=pt,1=eta][correlation index]. Correlation index runs as follows:
16518  // 
16519  // 0: <<2'>>
16520  // 1: <<4'>>
16521  // 2: <<6'>>
16522  // 3: <<8'>>
16523  
16524  //Int_t t = 0; // type flag 
16525  Int_t pe = 0; // ptEta flag
16526  
16527  if(type == "RP")
16528  {
16529   //t = 0;
16530  } else if(type == "POI")
16531    {
16532     //t = 1;
16533    }
16534
16535  if(ptOrEta == "Pt")
16536  {
16537   pe = 0;
16538  } else if(ptOrEta == "Eta")
16539    {
16540     pe = 1;
16541    }
16542     
16543  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
16544  Double_t minPtEta[2] = {fPtMin,fEtaMin};
16545  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
16546  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
16547
16548  // looping over all bins and calculating reduced correlations: 
16549  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16550  {
16551   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
16552   Double_t p1n0kRe = 0.;
16553   Double_t p1n0kIm = 0.;
16554
16555   // number of POIs in particular pt or eta bin:
16556   Double_t mp = 0.;
16557
16558   // 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):
16559   Double_t q1n0kRe = 0.;
16560   Double_t q1n0kIm = 0.;
16561   Double_t q2n0kRe = 0.;
16562   Double_t q2n0kIm = 0.;
16563
16564   // number of particles which are both RPs and POIs in particular pt or eta bin:
16565   Double_t mq = 0.;
16566    
16567   if(type == "POI")
16568   {
16569    // q_{m*n,0}:
16570    q1n0kRe = fReRPQ1dEBE[2][pe][0][0]->GetBinContent(fReRPQ1dEBE[2][pe][0][0]->GetBin(b))
16571            * fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b));
16572    q1n0kIm = fImRPQ1dEBE[2][pe][0][0]->GetBinContent(fImRPQ1dEBE[2][pe][0][0]->GetBin(b))
16573            * fImRPQ1dEBE[2][pe][0][0]->GetBinEntries(fImRPQ1dEBE[2][pe][0][0]->GetBin(b));
16574    q2n0kRe = fReRPQ1dEBE[2][pe][1][0]->GetBinContent(fReRPQ1dEBE[2][pe][1][0]->GetBin(b))
16575            * fReRPQ1dEBE[2][pe][1][0]->GetBinEntries(fReRPQ1dEBE[2][pe][1][0]->GetBin(b));
16576    q2n0kIm = fImRPQ1dEBE[2][pe][1][0]->GetBinContent(fImRPQ1dEBE[2][pe][1][0]->GetBin(b))
16577            * fImRPQ1dEBE[2][pe][1][0]->GetBinEntries(fImRPQ1dEBE[2][pe][1][0]->GetBin(b));         
16578                  
16579    mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
16580   } 
16581   else if(type == "RP")
16582   {
16583    // q_{m*n,0}:
16584    q1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
16585            * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
16586    q1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))
16587            * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
16588    q2n0kRe = fReRPQ1dEBE[0][pe][1][0]->GetBinContent(fReRPQ1dEBE[0][pe][1][0]->GetBin(b))
16589            * fReRPQ1dEBE[0][pe][1][0]->GetBinEntries(fReRPQ1dEBE[0][pe][1][0]->GetBin(b));
16590    q2n0kIm = fImRPQ1dEBE[0][pe][1][0]->GetBinContent(fImRPQ1dEBE[0][pe][1][0]->GetBin(b))
16591            * fImRPQ1dEBE[0][pe][1][0]->GetBinEntries(fImRPQ1dEBE[0][pe][1][0]->GetBin(b));         
16592                  
16593    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)  
16594   }
16595       
16596    if(type == "POI")
16597    {
16598     // p_{m*n,0}:
16599     p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
16600             * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
16601     p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
16602             * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
16603             
16604     mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
16605     
16606     //t = 1; // typeFlag = RP or POI
16607    }
16608    else if(type == "RP")
16609    {
16610     // p_{m*n,0} = q_{m*n,0}:
16611     p1n0kRe = q1n0kRe; 
16612     p1n0kIm = q1n0kIm; 
16613             
16614     mp = mq; 
16615     
16616     //t = 0; // typeFlag = RP or POI
16617    }
16618       
16619    // 2'-particle correlation for particular pt or eta bin:
16620    Double_t two1n1nPtEta = 0.;
16621    Double_t mWeight2pPrime = 0.; // multiplicity weight for <2'>
16622    if(mp*dMult-mq)
16623    {
16624     two1n1nPtEta = (p1n0kRe*dReQ1n+p1n0kIm*dImQ1n-mq)
16625                  / (mp*dMult-mq);
16626     // determine multiplicity weight:
16627     if(fMultiplicityWeight->Contains("combinations"))
16628     {
16629      mWeight2pPrime = mp*dMult-mq;
16630     } else if(fMultiplicityWeight->Contains("unit"))
16631       {
16632        mWeight2pPrime = 1.;    
16633       } 
16634     if(type == "POI") // to be improved (I do not this if)
16635     { 
16636      // fill profile to get <<2'>> for POIs
16637      fDiffFlowCorrelationsPro[1][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nPtEta,mWeight2pPrime);
16638      // fill profile to get <<2'>^2> for POIs
16639      fDiffFlowSquaredCorrelationsPro[1][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nPtEta*two1n1nPtEta,mWeight2pPrime);   
16640      // histogram to store <2'> for POIs e-b-e (needed in some other methods):
16641      fDiffFlowCorrelationsEBE[1][pe][0]->SetBinContent(b,two1n1nPtEta);      
16642      fDiffFlowEventWeightsForCorrelationsEBE[1][pe][0]->SetBinContent(b,mWeight2pPrime);      
16643     }
16644     else if(type == "RP") // to be improved (I do not this if)
16645     {
16646      // profile to get <<2'>> for RPs:
16647      fDiffFlowCorrelationsPro[0][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nPtEta,mWeight2pPrime);     
16648      // profile to get <<2'>^2> for RPs:
16649      fDiffFlowSquaredCorrelationsPro[0][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nPtEta*two1n1nPtEta,mWeight2pPrime);          
16650      // histogram to store <2'> for RPs e-b-e (needed in some other methods):
16651      fDiffFlowCorrelationsEBE[0][pe][0]->SetBinContent(b,two1n1nPtEta); 
16652      fDiffFlowEventWeightsForCorrelationsEBE[0][pe][0]->SetBinContent(b,mWeight2pPrime); 
16653     }
16654    } // end of if(mp*dMult-mq)
16655   
16656    // 4'-particle correlation:
16657    Double_t four1n1n1n1nPtEta = 0.;
16658    Double_t mWeight4pPrime = 0.; // multiplicity weight for <4'>
16659    if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16660        + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)) // to be improved (introduce a new variable for this expression)
16661    {
16662     four1n1n1n1nPtEta = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)
16663                       - q2n0kRe*(pow(dReQ1n,2.)-pow(dImQ1n,2.))
16664                       - 2.*q2n0kIm*dReQ1n*dImQ1n
16665                       - p1n0kRe*(dReQ1n*dReQ2n+dImQ1n*dImQ2n)
16666                       + p1n0kIm*(dImQ1n*dReQ2n-dReQ1n*dImQ2n)
16667                       - 2.*dMult*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)
16668                       - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*mq                      
16669                       + 6.*(q1n0kRe*dReQ1n+q1n0kIm*dImQ1n)                                            
16670                       + 1.*(q2n0kRe*dReQ2n+q2n0kIm*dImQ2n)                      
16671                       + 2.*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)                       
16672                       + 2.*mq*dMult                      
16673                       - 6.*mq)        
16674                       / ((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16675                           + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
16676     // determine multiplicity weight:
16677     if(fMultiplicityWeight->Contains("combinations"))
16678     {
16679      mWeight4pPrime = (mp-mq)*dMult*(dMult-1.)*(dMult-2.) + mq*(dMult-1.)*(dMult-2.)*(dMult-3.);
16680     } else if(fMultiplicityWeight->Contains("unit"))
16681       {
16682        mWeight4pPrime = 1.;    
16683       }     
16684     if(type == "POI")
16685     {
16686      // profile to get <<4'>> for POIs:
16687      fDiffFlowCorrelationsPro[1][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nPtEta,mWeight4pPrime);      
16688      // profile to get <<4'>^2> for POIs:
16689      fDiffFlowSquaredCorrelationsPro[1][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nPtEta*four1n1n1n1nPtEta,mWeight4pPrime); 
16690      // histogram to store <4'> for POIs e-b-e (needed in some other methods):
16691      fDiffFlowCorrelationsEBE[1][pe][1]->SetBinContent(b,four1n1n1n1nPtEta);                               
16692      fDiffFlowEventWeightsForCorrelationsEBE[1][pe][1]->SetBinContent(b,mWeight4pPrime);                               
16693     }
16694     else if(type == "RP")
16695     {
16696      // profile to get <<4'>> for RPs:
16697      fDiffFlowCorrelationsPro[0][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nPtEta,mWeight4pPrime);    
16698      // profile to get <<4'>^2> for RPs:
16699      fDiffFlowSquaredCorrelationsPro[0][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nPtEta*four1n1n1n1nPtEta,mWeight4pPrime);    
16700      // histogram to store <4'> for RPs e-b-e (needed in some other methods):
16701      fDiffFlowCorrelationsEBE[0][pe][1]->SetBinContent(b,four1n1n1n1nPtEta);                   
16702      fDiffFlowEventWeightsForCorrelationsEBE[0][pe][1]->SetBinContent(b,mWeight4pPrime);                   
16703     }
16704    } // end of if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16705      //            +mq*(dMult-1.)*(dMult-2.)*(dMult-3.))
16706    
16707  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16708  
16709    
16710 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrelations(TString type, TString ptOrEta);
16711
16712 //=======================================================================================================================
16713
16714 void AliFlowAnalysisWithQCumulants::CalculateOtherDiffCorrelators(TString type, TString ptOrEta)
16715 {
16716  // Calculate other differential correlators for RPs or POIs for all pt and eta bins.
16717  
16718  // Multiplicity:
16719  Double_t dMult = (*fSpk)(0,0);
16720  
16721  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
16722  Double_t dReQ1n = (*fReQ)(0,0);
16723  Double_t dReQ2n = (*fReQ)(1,0);
16724  Double_t dReQ3n = (*fReQ)(2,0);
16725  //Double_t dReQ4n = (*fReQ)(3,0);
16726  Double_t dImQ1n = (*fImQ)(0,0);
16727  Double_t dImQ2n = (*fImQ)(1,0);
16728  Double_t dImQ3n = (*fImQ)(2,0);
16729  //Double_t dImQ4n = (*fImQ)(3,0);
16730
16731  // 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]
16732  // Correlation index runs as follows:
16733  // 
16734  //  0: <exp[in(psi1-3phi2+2phi3)]>
16735  
16736  Int_t t = 0; // type flag 
16737  Int_t pe = 0; // ptEta flag
16738  
16739  if(type == "RP")
16740  {
16741   t = 0;
16742  } else if(type == "POI")
16743    {
16744     t = 1;
16745    }
16746
16747  if(ptOrEta == "Pt")
16748  {
16749   pe = 0;
16750  } else if(ptOrEta == "Eta")
16751    {
16752     pe = 1;
16753    }
16754     
16755  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
16756  Double_t minPtEta[2] = {fPtMin,fEtaMin};
16757  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
16758  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
16759
16760  // looping over all bins and calculating reduced correlations: 
16761  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16762  {
16763   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
16764   Double_t p1n0kRe = 0.;
16765   Double_t p1n0kIm = 0.;
16766
16767   // number of POIs in particular pt or eta bin:
16768   Double_t mp = 0.;
16769
16770   // 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):
16771   Double_t q1n0kRe = 0.;
16772   Double_t q1n0kIm = 0.;
16773   Double_t q2n0kRe = 0.;
16774   Double_t q2n0kIm = 0.;
16775   Double_t q3n0kRe = 0.;
16776   Double_t q3n0kIm = 0.;
16777
16778   // number of particles which are both RPs and POIs in particular pt or eta bin:
16779   Double_t mq = 0.;
16780    
16781   if(type == "POI")
16782   {
16783    // q_{m*n,0}:
16784    q1n0kRe = fReRPQ1dEBE[2][pe][0][0]->GetBinContent(fReRPQ1dEBE[2][pe][0][0]->GetBin(b))
16785            * fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b));
16786    q1n0kIm = fImRPQ1dEBE[2][pe][0][0]->GetBinContent(fImRPQ1dEBE[2][pe][0][0]->GetBin(b))
16787            * fImRPQ1dEBE[2][pe][0][0]->GetBinEntries(fImRPQ1dEBE[2][pe][0][0]->GetBin(b));
16788    q2n0kRe = fReRPQ1dEBE[2][pe][1][0]->GetBinContent(fReRPQ1dEBE[2][pe][1][0]->GetBin(b))
16789            * fReRPQ1dEBE[2][pe][1][0]->GetBinEntries(fReRPQ1dEBE[2][pe][1][0]->GetBin(b));
16790    q2n0kIm = fImRPQ1dEBE[2][pe][1][0]->GetBinContent(fImRPQ1dEBE[2][pe][1][0]->GetBin(b))
16791            * fImRPQ1dEBE[2][pe][1][0]->GetBinEntries(fImRPQ1dEBE[2][pe][1][0]->GetBin(b));                         
16792    q3n0kRe = fReRPQ1dEBE[2][pe][2][0]->GetBinContent(fReRPQ1dEBE[2][pe][2][0]->GetBin(b))
16793            * fReRPQ1dEBE[2][pe][2][0]->GetBinEntries(fReRPQ1dEBE[2][pe][2][0]->GetBin(b));
16794    q3n0kIm = fImRPQ1dEBE[2][pe][2][0]->GetBinContent(fImRPQ1dEBE[2][pe][2][0]->GetBin(b))
16795            * fImRPQ1dEBE[2][pe][2][0]->GetBinEntries(fImRPQ1dEBE[2][pe][2][0]->GetBin(b));         
16796
16797    mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
16798   } 
16799   else if(type == "RP")
16800   {
16801    // q_{m*n,0}:
16802    q1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
16803            * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
16804    q1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))
16805            * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
16806    q2n0kRe = fReRPQ1dEBE[0][pe][1][0]->GetBinContent(fReRPQ1dEBE[0][pe][1][0]->GetBin(b))
16807            * fReRPQ1dEBE[0][pe][1][0]->GetBinEntries(fReRPQ1dEBE[0][pe][1][0]->GetBin(b));
16808    q2n0kIm = fImRPQ1dEBE[0][pe][1][0]->GetBinContent(fImRPQ1dEBE[0][pe][1][0]->GetBin(b))
16809            * fImRPQ1dEBE[0][pe][1][0]->GetBinEntries(fImRPQ1dEBE[0][pe][1][0]->GetBin(b));         
16810    q3n0kRe = fReRPQ1dEBE[0][pe][2][0]->GetBinContent(fReRPQ1dEBE[0][pe][2][0]->GetBin(b))
16811            * fReRPQ1dEBE[0][pe][2][0]->GetBinEntries(fReRPQ1dEBE[0][pe][2][0]->GetBin(b));
16812    q3n0kIm = fImRPQ1dEBE[0][pe][2][0]->GetBinContent(fImRPQ1dEBE[0][pe][2][0]->GetBin(b))
16813            * fImRPQ1dEBE[0][pe][2][0]->GetBinEntries(fImRPQ1dEBE[0][pe][2][0]->GetBin(b));         
16814                  
16815    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)  
16816   }
16817       
16818    if(type == "POI")
16819    {
16820     // p_{m*n,0}:
16821     p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
16822             * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
16823     p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
16824             * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
16825             
16826     mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
16827     
16828     t = 1; // typeFlag = RP or POI
16829    }
16830    else if(type == "RP")
16831    {
16832     // p_{m*n,0} = q_{m*n,0}:
16833     p1n0kRe = q1n0kRe; 
16834     p1n0kIm = q1n0kIm; 
16835             
16836     mp = mq; 
16837     
16838     t = 0; // typeFlag = RP or POI
16839    }
16840       
16841    // 3'-particle correlators:
16842    //  Taeney-Yan correlator:
16843    Double_t dTaeneyYan = 0.;
16844    Double_t mWeightTaeneyYan = 0.; // multiplicity weight for Taeney-Yan correlator
16845    if((mp*dMult-2.*mq)*(dMult-1.) > 0.) // to be improved - is this condition fully justified?
16846    {
16847     dTaeneyYan = (dReQ3n*(p1n0kRe*dReQ2n-p1n0kIm*dImQ2n)+dImQ3n*(p1n0kIm*dReQ2n+p1n0kRe*dImQ2n)
16848                - p1n0kRe*dReQ1n - p1n0kIm*dImQ1n
16849                - q2n0kRe*dReQ2n - q2n0kIm*dImQ2n              
16850                - q3n0kRe*dReQ3n - q3n0kIm*dImQ3n
16851                + 2.*mq)
16852                / ((mp*dMult-2.*mq)*(dMult-1.));
16853     // determine multiplicity weight:
16854     if(fMultiplicityWeight->Contains("combinations"))
16855     {
16856      mWeightTaeneyYan = (mp*dMult-2.*mq)*(dMult-1.);
16857     } else if(fMultiplicityWeight->Contains("unit"))
16858       {
16859        mWeightTaeneyYan = 1.;    
16860       } 
16861     // Fill profiles:
16862     fOtherDiffCorrelators[t][pe][1][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dTaeneyYan,mWeightTaeneyYan);
16863    } // end of if((mp*dMult-2.*mq)*(dMult-1.) > 0.)  
16864    
16865  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16866  
16867 } // end of void AliFlowAnalysisWithQCumulants::CalculateOtherDiffCorrelators(TString type, TString ptOrEta)
16868
16869 //=======================================================================================================================
16870
16871 void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlowCorrelations(TString type)
16872 {
16873  // Calculate all reduced correlations needed for 2D differential flow for each (pt,eta) bin. 
16874  
16875  // Multiplicity:
16876  Double_t dMult = (*fSpk)(0,0);
16877  // Real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
16878  Double_t dReQ1n = (*fReQ)(0,0);
16879  Double_t dReQ2n = (*fReQ)(1,0);
16880  //Double_t dReQ3n = (*fReQ)(2,0);
16881  //Double_t dReQ4n = (*fReQ)(3,0);
16882  Double_t dImQ1n = (*fImQ)(0,0);
16883  Double_t dImQ2n = (*fImQ)(1,0);
16884  //Double_t dImQ3n = (*fImQ)(2,0);
16885  //Double_t dImQ4n = (*fImQ)(3,0);
16886
16887  // 2D reduced correlations are stored in TProfile2D f2DDiffFlowCorrelationsPro[0=RP,1=POI][correlation index]. 
16888  // Correlation index runs as follows:
16889  //  0: <<2'>> 
16890  //  1: <<4'>>
16891  //  2: <<6'>>
16892  //  3: <<8'>>
16893  
16894  Int_t t = 0; // type flag  
16895  if(type == "RP")
16896  {
16897   t = 0;
16898  } else if(type == "POI")
16899    {
16900     t = 1;
16901    }
16902
16903  // Looping over all (pt,eta) bins and calculating correlations needed for differential flow: 
16904  for(Int_t p=1;p<=fnBinsPt;p++)
16905  {
16906   for(Int_t e=1;e<=fnBinsEta;e++)
16907   {
16908    // Real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular (pt,eta) bin): 
16909    Double_t p1n0kRe = 0.;
16910    Double_t p1n0kIm = 0.;
16911    // Number of POIs in particular pt or eta bin:
16912    Double_t mp = 0.;
16913    // Real and imaginary parts of q_{m*n,0} (non-weighted Q-vector evaluated for 'RP && POI particles' in particular pt or eta bin):
16914    Double_t q1n0kRe = 0.;
16915    Double_t q1n0kIm = 0.;
16916    Double_t q2n0kRe = 0.;
16917    Double_t q2n0kIm = 0.; 
16918    // Number of 'RP && POI particles' in particular pt or eta bin:
16919    Double_t mq = 0.;
16920    if(type == "POI")
16921    {
16922     // q_{m*n,0}:
16923     q1n0kRe = fReRPQ2dEBE[2][0][0]->GetBinContent(fReRPQ2dEBE[2][0][0]->GetBin(p,e))
16924             * fReRPQ2dEBE[2][0][0]->GetBinEntries(fReRPQ2dEBE[2][0][0]->GetBin(p,e));
16925     q1n0kIm = fImRPQ2dEBE[2][0][0]->GetBinContent(fImRPQ2dEBE[2][0][0]->GetBin(p,e))
16926             * fImRPQ2dEBE[2][0][0]->GetBinEntries(fImRPQ2dEBE[2][0][0]->GetBin(p,e));
16927     q2n0kRe = fReRPQ2dEBE[2][1][0]->GetBinContent(fReRPQ2dEBE[2][1][0]->GetBin(p,e))
16928             * fReRPQ2dEBE[2][1][0]->GetBinEntries(fReRPQ2dEBE[2][1][0]->GetBin(p,e));
16929     q2n0kIm = fImRPQ2dEBE[2][1][0]->GetBinContent(fImRPQ2dEBE[2][1][0]->GetBin(p,e))
16930             * fImRPQ2dEBE[2][1][0]->GetBinEntries(fImRPQ2dEBE[2][1][0]->GetBin(p,e));         
16931     // m_{q}:             
16932     mq = fReRPQ2dEBE[2][0][0]->GetBinEntries(fReRPQ2dEBE[2][0][0]->GetBin(p,e)); // to be improved (cross-checked by accessing other profiles here)
16933    } // end of if(type == "POI")
16934    else if(type == "RP")
16935    {
16936     // q_{m*n,0}:
16937     q1n0kRe = fReRPQ2dEBE[0][0][0]->GetBinContent(fReRPQ2dEBE[0][0][0]->GetBin(p,e))
16938             * fReRPQ2dEBE[0][0][0]->GetBinEntries(fReRPQ2dEBE[0][0][0]->GetBin(p,e));
16939     q1n0kIm = fImRPQ2dEBE[0][0][0]->GetBinContent(fImRPQ2dEBE[0][0][0]->GetBin(p,e))
16940             * fImRPQ2dEBE[0][0][0]->GetBinEntries(fImRPQ2dEBE[0][0][0]->GetBin(p,e));
16941     q2n0kRe = fReRPQ2dEBE[0][1][0]->GetBinContent(fReRPQ2dEBE[0][1][0]->GetBin(p,e))
16942             * fReRPQ2dEBE[0][1][0]->GetBinEntries(fReRPQ2dEBE[0][1][0]->GetBin(p,e));
16943     q2n0kIm = fImRPQ2dEBE[0][1][0]->GetBinContent(fImRPQ2dEBE[0][1][0]->GetBin(p,e))
16944             * fImRPQ2dEBE[0][1][0]->GetBinEntries(fImRPQ2dEBE[0][1][0]->GetBin(p,e));         
16945     // m_{q}:             
16946     mq = fReRPQ2dEBE[0][0][0]->GetBinEntries(fReRPQ2dEBE[0][0][0]->GetBin(p,e)); // to be improved (cross-checked by accessing other profiles here)  
16947    } // end of else if(type == "RP")
16948    if(type == "POI")
16949    {
16950     // p_{m*n,0}:
16951     p1n0kRe = fReRPQ2dEBE[1][0][0]->GetBinContent(fReRPQ2dEBE[1][0][0]->GetBin(p,e))
16952             * fReRPQ2dEBE[1][0][0]->GetBinEntries(fReRPQ2dEBE[1][0][0]->GetBin(p,e));
16953     p1n0kIm = fImRPQ2dEBE[1][0][0]->GetBinContent(fImRPQ2dEBE[1][0][0]->GetBin(p,e))  
16954             * fImRPQ2dEBE[1][0][0]->GetBinEntries(fImRPQ2dEBE[1][0][0]->GetBin(p,e));
16955     // m_{p}        
16956     mp = fReRPQ2dEBE[1][0][0]->GetBinEntries(fReRPQ2dEBE[1][0][0]->GetBin(p,e)); // to be improved (cross-checked by accessing other profiles here)
16957     
16958     t = 1; // typeFlag = RP or POI
16959    } // end of if(type == "POI")
16960    else if(type == "RP")
16961    {
16962     // p_{m*n,0} = q_{m*n,0}:
16963     p1n0kRe = q1n0kRe; 
16964     p1n0kIm = q1n0kIm; 
16965     // m_{p} = m_{q}:        
16966     mp = mq; 
16967
16968     t = 0; // typeFlag = RP or POI
16969    } // end of if(type == "RP")
16970
16971    // 2'-particle correlation for particular (pt,eta) bin:
16972    Double_t two1n1nPtEta = 0.;
16973    Double_t mWeight2pPrime = 0.; // multiplicity weight for <2'>
16974    if(mp*dMult-mq)
16975    {
16976     two1n1nPtEta = (p1n0kRe*dReQ1n+p1n0kIm*dImQ1n-mq)
16977                  / (mp*dMult-mq);
16978     // Determine multiplicity weight:
16979     if(fMultiplicityWeight->Contains("combinations"))
16980     {
16981      mWeight2pPrime = mp*dMult-mq;
16982     } else if(fMultiplicityWeight->Contains("unit"))
16983       {
16984        mWeight2pPrime = 1.;    
16985       } 
16986     // Fill 2D profile holding <<2'>>:     
16987     f2DDiffFlowCorrelationsPro[t][0]->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,two1n1nPtEta,mWeight2pPrime);
16988    } // end of if(mp*dMult-mq)
16989    
16990    // 4'-particle correlation:
16991    Double_t four1n1n1n1nPtEta = 0.;
16992    Double_t mWeight4pPrime = 0.; // multiplicity weight for <4'>
16993    if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16994        + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)) // to be improved (introduce a new variable for this expression)
16995    {
16996     four1n1n1n1nPtEta = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)
16997                       - q2n0kRe*(pow(dReQ1n,2.)-pow(dImQ1n,2.))
16998                       - 2.*q2n0kIm*dReQ1n*dImQ1n
16999                       - p1n0kRe*(dReQ1n*dReQ2n+dImQ1n*dImQ2n)
17000                       + p1n0kIm*(dImQ1n*dReQ2n-dReQ1n*dImQ2n)
17001                       - 2.*dMult*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)
17002                       - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*mq                      
17003                       + 6.*(q1n0kRe*dReQ1n+q1n0kIm*dImQ1n)                                            
17004                       + 1.*(q2n0kRe*dReQ2n+q2n0kIm*dImQ2n)                      
17005                       + 2.*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)                       
17006                       + 2.*mq*dMult                      
17007                       - 6.*mq)        
17008                       / ((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
17009                           + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
17010     // Determine multiplicity weight:
17011     if(fMultiplicityWeight->Contains("combinations"))
17012     {
17013      mWeight4pPrime = (mp-mq)*dMult*(dMult-1.)*(dMult-2.) + mq*(dMult-1.)*(dMult-2.)*(dMult-3.);
17014     } else if(fMultiplicityWeight->Contains("unit"))
17015       {
17016        mWeight4pPrime = 1.;    
17017       }     
17018     // Fill 2D profile holding <<4'>>:
17019     f2DDiffFlowCorrelationsPro[t][1]->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,four1n1n1n1nPtEta,mWeight4pPrime);      
17020    } // end of if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
17021      //            +mq*(dMult-1.)*(dMult-2.)*(dMult-3.))
17022   } // end of for(Int_t e=1;e<=fnBinsEta;e++)
17023  } // end of for(Int_t p=1;p<=fnBinsPt;p++)   
17024       
17025 } // end of AliFlowAnalysisWithQCumulants::Calculate2DDiffFlowCorrelations(TString type)
17026
17027 //=======================================================================================================================
17028
17029 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowSumOfEventWeights(TString type, TString ptOrEta)
17030 {
17031  // Calculate sums of various event weights for reduced correlations. 
17032  // (These quantitites are needed in expressions for unbiased estimators relevant for the statistical errors.)
17033
17034  Int_t typeFlag = 0;
17035  Int_t ptEtaFlag = 0;
17036
17037  if(type == "RP")
17038  {
17039   typeFlag = 0;
17040  } else if(type == "POI")
17041    {
17042     typeFlag = 1;
17043    } 
17044      
17045  if(ptOrEta == "Pt")
17046  {
17047   ptEtaFlag = 0;
17048  } else if(ptOrEta == "Eta")
17049    {
17050     ptEtaFlag = 1;
17051    } 
17052    
17053  // shortcuts:
17054  Int_t t = typeFlag;
17055  Int_t pe = ptEtaFlag;
17056  
17057  // binning:
17058  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
17059  Double_t minPtEta[2] = {fPtMin,fEtaMin};
17060  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
17061  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
17062  
17063  for(Int_t rpq=0;rpq<3;rpq++)
17064  {
17065   for(Int_t m=0;m<4;m++)
17066   {
17067    for(Int_t k=0;k<9;k++)
17068    {
17069     if(!fReRPQ1dEBE[rpq][pe][m][k])
17070     {
17071      cout<<"WARNING: fReRPQ1dEBE[rpq][pe][m][k] is NULL in AFAWQC::CSAPOEWFDF() !!!!"<<endl;
17072      cout<<"pe  = "<<pe<<endl;
17073      cout<<"rpq = "<<rpq<<endl;
17074      cout<<"m   = "<<m<<endl;
17075      cout<<"k   = "<<k<<endl;
17076      exit(0); 
17077     }
17078    }
17079   }
17080  }  
17081
17082  // multiplicities:
17083  Double_t dMult = (*fSpk)(0,0); // total event multiplicity
17084  //Double_t mr = 0.; // number of RPs in particular pt or eta bin
17085  Double_t mp = 0.; // number of POIs in particular pt or eta bin 
17086  Double_t mq = 0.; // number of particles which are both RPs and POIs in particular pt or eta bin
17087  
17088  // event weights for reduced correlations:
17089  Double_t dw2 = 0.; // event weight for <2'>
17090  Double_t dw4 = 0.; // event weight for <4'>
17091  //Double_t dw6 = 0.; // event weight for <6'>
17092  //Double_t dw8 = 0.; // event weight for <8'>
17093
17094  // looping over bins:
17095  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17096  {
17097   if(type == "RP")
17098   {
17099    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(b);
17100    mp = mq; // trick to use the very same Eqs. bellow both for RP's and POI's diff. flow
17101   } else if(type == "POI")
17102     {
17103      mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(b);
17104      mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(b);    
17105     }
17106   
17107   // event weight for <2'>:
17108   dw2 = mp*dMult-mq;  
17109   fDiffFlowSumOfEventWeights[t][pe][0][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2);
17110   fDiffFlowSumOfEventWeights[t][pe][1][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw2,2.));
17111   
17112   // event weight for <4'>:
17113   dw4 = (mp-mq)*dMult*(dMult-1.)*(dMult-2.)
17114      + mq*(dMult-1.)*(dMult-2.)*(dMult-3.);  
17115   fDiffFlowSumOfEventWeights[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4);
17116   fDiffFlowSumOfEventWeights[t][pe][1][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw4,2.));
17117   
17118   // event weight for <6'>:
17119   //dw6 = ...;  
17120   //fDiffFlowSumOfEventWeights[t][pe][0][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw6);
17121   //fDiffFlowSumOfEventWeights[t][pe][t][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw6,2.));
17122   
17123   // event weight for <8'>:
17124   //dw8 = ...;  
17125   //fDiffFlowSumOfEventWeights[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw8);
17126   //fDiffFlowSumOfEventWeights[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw8,2.));   
17127  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++) 
17128  
17129 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowSumOfEventWeights()
17130
17131
17132 //=======================================================================================================================
17133
17134
17135 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowSumOfProductOfEventWeights(TString type, TString ptOrEta)
17136 {
17137  // Calculate sum of products of various event weights for both types of correlations (the ones for int. and diff. flow). 
17138  // (These quantitites are needed in expressions for unbiased estimators relevant for the statistical errors.)
17139  //
17140  // Important: To fill fDiffFlowSumOfProductOfEventWeights[][][][] use bellow table (i,j) with following constraints: 
17141  // 1.) i<j  
17142  // 2.) do not store terms which DO NOT include reduced correlations;
17143  // Table:
17144  // [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'>]
17145   
17146  Int_t typeFlag = 0;
17147  Int_t ptEtaFlag = 0;
17148
17149  if(type == "RP")
17150  {
17151   typeFlag = 0;
17152  } else if(type == "POI")
17153    {
17154     typeFlag = 1;
17155    } 
17156      
17157  if(ptOrEta == "Pt")
17158  {
17159   ptEtaFlag = 0;
17160  } else if(ptOrEta == "Eta")
17161    {
17162     ptEtaFlag = 1;
17163    } 
17164      
17165  // shortcuts:
17166  Int_t t = typeFlag;
17167  Int_t pe = ptEtaFlag;
17168   
17169  // binning:
17170  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
17171  Double_t minPtEta[2] = {fPtMin,fEtaMin};
17172  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
17173  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
17174  
17175  // protection:
17176  for(Int_t rpq=0;rpq<3;rpq++)
17177  {
17178   for(Int_t m=0;m<4;m++)
17179   {
17180    for(Int_t k=0;k<9;k++)
17181    {
17182     if(!fReRPQ1dEBE[rpq][pe][m][k])
17183     {
17184      cout<<"WARNING: fReRPQ1dEBE[rpq][pe][m][k] is NULL in AFAWQC::CSAPOEWFDF() !!!!"<<endl;
17185      cout<<"pe  = "<<pe<<endl;
17186      cout<<"rpq = "<<rpq<<endl;
17187      cout<<"m   = "<<m<<endl;
17188      cout<<"k   = "<<k<<endl;
17189      exit(0); 
17190     }
17191    }
17192   }
17193  }  
17194  
17195  // multiplicities:
17196  Double_t dMult = (*fSpk)(0,0); // total event multiplicity
17197  //Double_t mr = 0.; // number of RPs in particular pt or eta bin
17198  Double_t mp = 0.; // number of POIs in particular pt or eta bin 
17199  Double_t mq = 0.; // number of particles which are both RPs and POIs in particular pt or eta bin
17200  
17201  // event weights for correlations:
17202  Double_t dW2 = dMult*(dMult-1); // event weight for <2> 
17203  Double_t dW4 = dMult*(dMult-1)*(dMult-2)*(dMult-3); // event weight for <4> 
17204  Double_t dW6 = dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-4)*(dMult-5); // event weight for <6> 
17205  Double_t dW8 = dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-4)*(dMult-5)*(dMult-6)*(dMult-7); // event weight for <8> 
17206
17207  // event weights for reduced correlations:
17208  Double_t dw2 = 0.; // event weight for <2'>
17209  Double_t dw4 = 0.; // event weight for <4'>
17210  //Double_t dw6 = 0.; // event weight for <6'>
17211  //Double_t dw8 = 0.; // event weight for <8'>
17212  
17213  // looping over bins:
17214  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17215  {
17216   if(type == "RP")
17217   {
17218    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(b);
17219    mp = mq; // trick to use the very same Eqs. bellow both for RP's and POI's diff. flow
17220   } else if(type == "POI")
17221     {
17222      mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(b);
17223      mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(b);    
17224     }
17225   
17226   // event weight for <2'>:
17227   dw2 = mp*dMult-mq;  
17228   fDiffFlowSumOfProductOfEventWeights[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW2*dw2); // storing product of even weights for <2> and <2'>
17229   fDiffFlowSumOfProductOfEventWeights[t][pe][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dW4); // storing product of even weights for <4> and <2'>
17230   fDiffFlowSumOfProductOfEventWeights[t][pe][1][4]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dW6); // storing product of even weights for <6> and <2'>
17231   fDiffFlowSumOfProductOfEventWeights[t][pe][1][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dW8); // storing product of even weights for <8> and <2'>
17232   
17233   // event weight for <4'>:
17234   dw4 = (mp-mq)*dMult*(dMult-1.)*(dMult-2.)
17235      + mq*(dMult-1.)*(dMult-2.)*(dMult-3.);  
17236   fDiffFlowSumOfProductOfEventWeights[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW2*dw4); // storing product of even weights for <2> and <4'>
17237   fDiffFlowSumOfProductOfEventWeights[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dw4); // storing product of even weights for <2'> and <4'>
17238   fDiffFlowSumOfProductOfEventWeights[t][pe][2][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW4*dw4); // storing product of even weights for <4> and <4'>
17239   fDiffFlowSumOfProductOfEventWeights[t][pe][3][4]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4*dW6); // storing product of even weights for <6> and <4'> 
17240   fDiffFlowSumOfProductOfEventWeights[t][pe][3][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4*dW8); // storing product of even weights for <8> and <4'>
17241
17242   // event weight for <6'>:
17243   //dw6 = ...;  
17244   //fDiffFlowSumOfProductOfEventWeights[t][pe][0][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW2*dw6); // storing product of even weights for <2> and <6'>
17245   //fDiffFlowSumOfProductOfEventWeights[t][pe][1][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dw6); // storing product of even weights for <2'> and <6'>
17246   //fDiffFlowSumOfProductOfEventWeights[t][pe][2][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW4*dw6); // storing product of even weights for <4> and <6'>
17247   //fDiffFlowSumOfProductOfEventWeights[t][pe][3][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4*dw6); // storing product of even weights for <4'> and <6'> 
17248   //fDiffFlowSumOfProductOfEventWeights[t][pe][4][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW6*dw6); // storing product of even weights for <6> and <6'>
17249   //fDiffFlowSumOfProductOfEventWeights[t][pe][5][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw6*dW8); // storing product of even weights for <6'> and <8>
17250   //fDiffFlowSumOfProductOfEventWeights[t][pe][5][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw6*dw8); // storing product of even weights for <6'> and <8'>
17251
17252   // event weight for <8'>:
17253   //dw8 = ...;  
17254   //fDiffFlowSumOfProductOfEventWeights[t][pe][0][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW2*dw8); // storing product of even weights for <2> and <8'>
17255   //fDiffFlowSumOfProductOfEventWeights[t][pe][1][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dw8); // storing product of even weights for <2'> and <8'>
17256   //fDiffFlowSumOfProductOfEventWeights[t][pe][2][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW4*dw8); // storing product of even weights for <4> and <8'>
17257   //fDiffFlowSumOfProductOfEventWeights[t][pe][3][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4*dw8); // storing product of even weights for <4'> and <8'> 
17258   //fDiffFlowSumOfProductOfEventWeights[t][pe][4][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW6*dw8); // storing product of even weights for <6> and <8'>
17259   //fDiffFlowSumOfProductOfEventWeights[t][pe][5][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw6*dw8); // storing product of even weights for <6'> and <8'>
17260   //fDiffFlowSumOfProductOfEventWeights[t][pe][6][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW8*dw8); // storing product of even weights for <8> and <8'>
17261   
17262   // Table:
17263   // [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'>]
17264    
17265  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17266  
17267
17268
17269 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowSumOfProductOfEventWeights(TString type, TString ptOrEta)
17270
17271 //=======================================================================================================================
17272
17273 void AliFlowAnalysisWithQCumulants::FinalizeReducedCorrelations(TString type, TString ptOrEta)
17274 {
17275  // Transfer profiles into histograms and calculate statistical errors correctly.
17276
17277  Int_t t = 0; // RP or POI
17278  Int_t pe = 0; // pt or eta
17279
17280  if(type == "RP")
17281  {
17282   t = 0;
17283  } else if(type == "POI")
17284    {
17285     t = 1;
17286    } 
17287      
17288  if(ptOrEta == "Pt")
17289  {
17290   pe = 0;
17291  } else if(ptOrEta == "Eta")
17292    {
17293     pe = 1;
17294    } 
17295                
17296  for(Int_t rci=0;rci<4;rci++) // to be improved - moved into the method CheckPointersUsedInFinish()
17297  {
17298   if(!fDiffFlowCorrelationsPro[t][pe][rci])
17299   {
17300    cout<<"WARNING: fDiffFlowCorrelationsPro[t][pe][rci] is NULL in AFAWQC::FRC() !!!!"<<endl;
17301    cout<<"t   = "<<t<<endl; 
17302    cout<<"pe  = "<<pe<<endl; 
17303    cout<<"rci = "<<rci<<endl;
17304    exit(0); 
17305   }
17306   if(!fDiffFlowSquaredCorrelationsPro[t][pe][rci])
17307   {
17308    cout<<"WARNING: fDiffFlowSquaredCorrelationsPro[t][pe][rci] is NULL in AFAWQC::FRC() !!!!"<<endl;
17309    cout<<"t   = "<<t<<endl; 
17310    cout<<"pe  = "<<pe<<endl; 
17311    cout<<"rci = "<<rci<<endl;
17312    exit(0); 
17313   }
17314   for(Int_t power=0;power<2;power++)
17315   {
17316    if(!fDiffFlowSumOfEventWeights[t][pe][power][rci])
17317    {
17318     cout<<"WARNING: fDiffFlowSumOfEventWeights[t][pe][power][rci] is NULL in AFAWQC::FRC() !!!!"<<endl;
17319     cout<<"t     = "<<t<<endl; 
17320     cout<<"pe    = "<<pe<<endl;
17321     cout<<"power = "<<power<<endl; 
17322     cout<<"rci   = "<<rci<<endl;
17323     exit(0); 
17324    }   
17325   } // end of for(Int_t power=0;power<2;power++)
17326  } // end of for(Int_t rci=0;rci<4;rci++)
17327     
17328  // common:
17329  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta}; 
17330  // transfer 1D profile into 1D histogram:
17331  Double_t correlation = 0.;
17332  Double_t squaredCorrelation = 0.;
17333  Double_t spread = 0.;
17334  Double_t sumOfWeights = 0.; // sum of weights for particular reduced correlations for particular pt or eta bin
17335  Double_t sumOfSquaredWeights = 0.; // sum of squared weights for particular reduced correlations for particular pt or eta bin
17336  Double_t error = 0.; // error = termA * spread * termB
17337                       // termA = (sqrt(sumOfSquaredWeights)/sumOfWeights) 
17338                       // termB = 1/pow(1-termA^2,0.5)
17339  Double_t termA = 0.;                      
17340  Double_t termB = 0.;                      
17341  for(Int_t rci=0;rci<4;rci++) // index of reduced correlation
17342  {
17343   for(Int_t b=1;b<=nBinsPtEta[pe];b++) // number of pt or eta bins
17344   {
17345    if(fDiffFlowCorrelationsPro[t][pe][rci]->GetBinEffectiveEntries(b) < 2 || 
17346       fDiffFlowSquaredCorrelationsPro[t][pe][rci]->GetBinEffectiveEntries(b) < 2)
17347    {
17348     fDiffFlowCorrelationsPro[t][pe][rci]->SetBinError(b,0.);
17349     fDiffFlowSquaredCorrelationsPro[t][pe][rci]->SetBinError(b,0.);
17350     continue; // to be improved - should I ignore results in pt bins with one entry for reduced correlations or not?
17351    }  
17352    correlation = fDiffFlowCorrelationsPro[t][pe][rci]->GetBinContent(b); 
17353    squaredCorrelation = fDiffFlowSquaredCorrelationsPro[t][pe][rci]->GetBinContent(b); 
17354    if(squaredCorrelation-correlation*correlation >= 0.)
17355    {
17356     spread = pow(squaredCorrelation-correlation*correlation,0.5);
17357    } else
17358      {
17359       cout<<endl;
17360       cout<<Form(" WARNING: Imaginary 'spread' for rci = %d, pe = %d, bin = %d !!!!",rci,pe,b)<<endl;
17361       cout<<endl;
17362      }
17363    sumOfWeights = fDiffFlowSumOfEventWeights[t][pe][0][rci]->GetBinContent(b);
17364    sumOfSquaredWeights = fDiffFlowSumOfEventWeights[t][pe][1][rci]->GetBinContent(b);
17365    if(TMath::Abs(sumOfWeights)>0.){termA = (pow(sumOfSquaredWeights,0.5)/sumOfWeights);}
17366    if(1.-pow(termA,2.)>0.){termB = 1./pow(1.-pow(termA,2.),0.5);} 
17367    error = termA*spread*termB; // final error (unbiased estimator for standard deviation)
17368    fDiffFlowCorrelationsHist[t][pe][rci]->SetBinContent(b,correlation); 
17369    fDiffFlowCorrelationsHist[t][pe][rci]->SetBinError(b,error); 
17370   } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17371  } // end of for(Int_t rci=0;rci<4;rci++)
17372  
17373 } // end of void AliFlowAnalysisWithQCumulants::FinalizeReducedCorrelations(TString type, TString ptOrEta)
17374
17375 //=======================================================================================================================
17376
17377 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowProductOfCorrelations(TString type, TString ptOrEta)
17378 {
17379  // store products: <2><2'>, <2><4'>, <2><6'>, <2><8'>, <2'><4>, 
17380  //                 <2'><4'>, <2'><6>, <2'><6'>, <2'><8>, <2'><8'>,
17381  //                 <4><4'>, <4><6'>, <4><8'>, <4'><6>, <4'><6'>, 
17382  //                 <4'><8>, <4'><8'>, <6><6'>, <6><8'>, <6'><8>, 
17383  //                 <6'><8'>, <8><8'>.
17384   
17385  Int_t typeFlag = 0;
17386  Int_t ptEtaFlag = 0;
17387
17388  if(type == "RP")
17389  {
17390   typeFlag = 0;
17391  } else if(type == "POI")
17392    {
17393     typeFlag = 1;
17394    } 
17395      
17396  if(ptOrEta == "Pt")
17397  {
17398   ptEtaFlag = 0;
17399  } else if(ptOrEta == "Eta")
17400    {
17401     ptEtaFlag = 1;
17402    } 
17403   
17404  // shortcuts:
17405  Int_t t = typeFlag;
17406  Int_t pe = ptEtaFlag;
17407      
17408  // common:
17409  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
17410  Double_t minPtEta[2] = {fPtMin,fEtaMin};
17411  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
17412    
17413  // protections // to be improved (add protection for all pointers in this method)
17414  if(!fIntFlowCorrelationsEBE)
17415  {
17416   cout<<"WARNING: fIntFlowCorrelationsEBE is NULL in AFAWQC::CDFPOC() !!!!"<<endl;
17417   exit(0);
17418  } 
17419  
17420  /*    
17421  Double_t dMult = (*fSpk)(0,0); // multiplicity (number of particles used to determine the reaction plane)
17422  //Double_t mr = 0.; // number of RPs in particular pt or eta bin
17423  Double_t mp = 0.; // number of POIs in particular pt or eta bin 
17424  Double_t mq = 0.; // number of particles which are both RPs and POIs in particular pt or eta bin
17425  */
17426
17427  // e-b-e correlations:
17428  Double_t twoEBE = fIntFlowCorrelationsEBE->GetBinContent(1); // <2>
17429  Double_t fourEBE = fIntFlowCorrelationsEBE->GetBinContent(2); // <4>
17430  Double_t sixEBE = fIntFlowCorrelationsEBE->GetBinContent(3); // <6>
17431  Double_t eightEBE = fIntFlowCorrelationsEBE->GetBinContent(4); // <8>
17432  
17433  // event weights for correlations:
17434  Double_t dW2 = fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1); // event weight for <2> 
17435  Double_t dW4 = fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2); // event weight for <4> 
17436  Double_t dW6 = fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(3); // event weight for <6> 
17437  Double_t dW8 = fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(4); // event weight for <8> 
17438   
17439  // e-b-e reduced correlations:
17440  Double_t twoReducedEBE = 0.; // <2'>
17441  Double_t fourReducedEBE = 0.; // <4'>
17442  //Double_t sixReducedEBE = 0.; // <6'>
17443  //Double_t eightReducedEBE = 0.; // <8'> 
17444  
17445  // event weights for reduced correlations:
17446  Double_t dw2 = 0.; // event weight for <2'>
17447  Double_t dw4 = 0.; // event weight for <4'>
17448  //Double_t dw6 = 0.; // event weight for <6'>
17449  //Double_t dw8 = 0.; // event weight for <8'>
17450
17451  // looping over bins:
17452  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17453  {
17454   // e-b-e reduced correlations:
17455   twoReducedEBE = fDiffFlowCorrelationsEBE[t][pe][0]->GetBinContent(b);
17456   fourReducedEBE = fDiffFlowCorrelationsEBE[t][pe][1]->GetBinContent(b);
17457   //sixReducedEBE = fDiffFlowCorrelationsEBE[t][pe][2]->GetBinContent(b);
17458   //eightReducedEBE = fDiffFlowCorrelationsEBE[t][pe][3]->GetBinContent(b);
17459   
17460   /*
17461   // to be improved (I should not do this here again)
17462   if(type == "RP")
17463   {
17464    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(b);
17465    mp = mq; // trick to use the very same Eqs. bellow both for RP's and POI's diff. flow
17466   } else if(type == "POI")
17467     {
17468      mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(b);
17469      mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(b);    
17470     }
17471   
17472   // event weights for reduced correlations:
17473   dw2 = mp*dMult-mq; // weight for <2'> 
17474   dw4 = (mp-mq)*dMult*(dMult-1.)*(dMult-2.)
17475      + mq*(dMult-1.)*(dMult-2.)*(dMult-3.); // weight for <4'>
17476   //dw6 = ...     
17477   //dw8 = ...     
17478   
17479   */
17480   
17481   dw2 = fDiffFlowEventWeightsForCorrelationsEBE[t][pe][0]->GetBinContent(b);
17482   dw4 = fDiffFlowEventWeightsForCorrelationsEBE[t][pe][1]->GetBinContent(b);
17483  
17484   // storing all products:
17485   fDiffFlowProductOfCorrelationsPro[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoEBE*twoReducedEBE,dW2*dw2); // storing <2><2'>
17486   fDiffFlowProductOfCorrelationsPro[t][pe][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourEBE*twoReducedEBE,dW4*dw2); // storing <4><2'>
17487   fDiffFlowProductOfCorrelationsPro[t][pe][1][4]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixEBE*twoReducedEBE,dW6*dw2); // storing <6><2'>
17488   fDiffFlowProductOfCorrelationsPro[t][pe][1][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],eightEBE*twoReducedEBE,dW8*dw2); // storing <8><2'>
17489   
17490   // event weight for <4'>:
17491   fDiffFlowProductOfCorrelationsPro[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoEBE*fourReducedEBE,dW2*dw4); // storing <2><4'>
17492   fDiffFlowProductOfCorrelationsPro[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoReducedEBE*fourReducedEBE,dw2*dw4); // storing <2'><4'>
17493   fDiffFlowProductOfCorrelationsPro[t][pe][2][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourEBE*fourReducedEBE,dW4*dw4); // storing <4><4'>
17494   fDiffFlowProductOfCorrelationsPro[t][pe][3][4]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixEBE*fourReducedEBE,dW6*dw4); // storing <6><4'> 
17495   fDiffFlowProductOfCorrelationsPro[t][pe][3][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],eightEBE*fourReducedEBE,dW8*dw4); // storing <8><4'>
17496
17497   // event weight for <6'>:
17498   //dw6 = ...;  
17499   //fDiffFlowProductOfCorrelationsPro[t][pe][0][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoEBE*sixReducedEBE,dW2*dw6); // storing <2><6'>
17500   //fDiffFlowProductOfCorrelationsPro[t][pe][1][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoReducedEBE*sixReducedEBE,dw2*dw6); // storing <2'><6'>
17501   //fDiffFlowProductOfCorrelationsPro[t][pe][2][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourEBE*sixReducedEBE,dW4*dw6); // storing <4><6'>
17502   //fDiffFlowProductOfCorrelationsPro[t][pe][3][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourReducedEBE*sixReducedEBE,dw4*dw6); // storing <4'><6'> 
17503   //fDiffFlowProductOfCorrelationsPro[t][pe][4][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixEBE*sixReducedEBE,dW6*dw6); // storing <6><6'>
17504   //fDiffFlowProductOfCorrelationsPro[t][pe][5][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixReducedEBE*eightEBE,dw6*dW8); // storing <6'><8>
17505   //fDiffFlowProductOfCorrelationsPro[t][pe][5][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixReducedEBE*eightReducedEBE,dw6*dw8); // storing <6'><8'>
17506
17507   // event weight for <8'>:
17508   //dw8 = ...;  
17509   //fDiffFlowProductOfCorrelationsPro[t][pe][0][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoEBE*eightReducedEBE,dW2*dw8); // storing <2><8'>
17510   //fDiffFlowProductOfCorrelationsPro[t][pe][1][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoReducedEBE*eightReducedEBE,dw2*dw8); // storing <2'><8'>
17511   //fDiffFlowProductOfCorrelationsPro[t][pe][2][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourEBE*eightReducedEBE,dW4*dw8); // storing <4><8'>
17512   //fDiffFlowProductOfCorrelationsPro[t][pe][3][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourReducedEBE*eightReducedEBE,dw4*dw8); // storing <4'><8'> 
17513   //fDiffFlowProductOfCorrelationsPro[t][pe][4][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixEBE*eightReducedEBE,dW6*dw8); // storing <6><8'>
17514   //fDiffFlowProductOfCorrelationsPro[t][pe][5][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixReducedEBE*eightReducedEBE,dw6*dw8); // storing <6'><8'>
17515   //fDiffFlowProductOfCorrelationsPro[t][pe][6][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],eightEBE*eightReducedEBE,dW8*dw8); // storing <8><8'> 
17516  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++       
17517      
17518 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowProductOfCorrelations(TString type, TString ptOrEta)
17519
17520 //=======================================================================================================================
17521     
17522 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCovariances(TString type, TString ptOrEta) // to be improved (reimplemented)
17523 {
17524  // a) Calculate unbiased estimators Cov(<2>,<2'>), Cov(<2>,<4'>), Cov(<4>,<2'>), Cov(<4>,<4'>) and Cov(<2'>,<4'>)
17525  //    for covariances V(<2>,<2'>), V(<2>,<4'>), V(<4>,<2'>), V(<4>,<4'>) and V(<2'>,<4'>).  
17526  // b) Store in histogram fDiffFlowCovariances[t][pe][index] for instance the following: 
17527  //
17528  //             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)]
17529  // 
17530  //     where N is the number of events, w_{<2>} is event weight for <2> and w_{<2'>} is event weight for <2'>.
17531  // c) Binning of fDiffFlowCovariances[t][pe][index] is organized as follows:
17532  // 
17533  //     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)] 
17534  //     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)] 
17535  //     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)] 
17536  //     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)] 
17537  //     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)] 
17538  //     ...
17539   
17540  Int_t typeFlag = 0;
17541  Int_t ptEtaFlag = 0;
17542
17543  if(type == "RP")
17544  {
17545   typeFlag = 0;
17546  } else if(type == "POI")
17547    {
17548     typeFlag = 1;
17549    } 
17550      
17551  if(ptOrEta == "Pt")
17552  {
17553   ptEtaFlag = 0;
17554  } else if(ptOrEta == "Eta")
17555    {
17556     ptEtaFlag = 1;
17557    } 
17558   
17559  // shortcuts:
17560  Int_t t = typeFlag;
17561  Int_t pe = ptEtaFlag;
17562      
17563  // common:
17564  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
17565  //Double_t minPtEta[2] = {fPtMin,fEtaMin};
17566  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
17567  //Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
17568  
17569  // average correlations:
17570  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>>
17571  Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>>
17572  //Double_t six = fIntFlowCorrelationsHist->GetBinContent(3); // <<6>>
17573  //Double_t eight = fIntFlowCorrelationsHist->GetBinContent(4); // <<8>>
17574  
17575  // sum of weights for correlation:
17576  Double_t sumOfWeightsForTwo = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // sum_{i=1}^{N} w_{<2>}
17577  Double_t sumOfWeightsForFour = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // sum_{i=1}^{N} w_{<4>}
17578  //Double_t sumOfWeightsForSix = fIntFlowSumOfEventWeights[0]->GetBinContent(3); // sum_{i=1}^{N} w_{<6>}
17579  //Double_t sumOfWeightsForEight = fIntFlowSumOfEventWeights[0]->GetBinContent(4); // sum_{i=1}^{N} w_{<8>}
17580  
17581  // average reduced correlations:
17582  Double_t twoReduced = 0.; // <<2'>> 
17583  Double_t fourReduced = 0.; // <<4'>>
17584  //Double_t sixReduced = 0.; // <<6'>>
17585  //Double_t eightReduced = 0.; // <<8'>>
17586
17587  // sum of weights for reduced correlation:
17588  Double_t sumOfWeightsForTwoReduced = 0.; // sum_{i=1}^{N} w_{<2'>}
17589  Double_t sumOfWeightsForFourReduced = 0.; // sum_{i=1}^{N} w_{<4'>}
17590  //Double_t sumOfWeightsForSixReduced = 0.; // sum_{i=1}^{N} w_{<6'>}
17591  //Double_t sumOfWeightsForEightReduced = 0.; // sum_{i=1}^{N} w_{<8'>}
17592   
17593  // product of weights for reduced correlation:
17594  Double_t productOfWeightsForTwoTwoReduced = 0.; // sum_{i=1}^{N} w_{<2>}w_{<2'>}
17595  Double_t productOfWeightsForTwoFourReduced = 0.; // sum_{i=1}^{N} w_{<2>}w_{<4'>}
17596  Double_t productOfWeightsForFourTwoReduced = 0.; // sum_{i=1}^{N} w_{<4>}w_{<2'>}
17597  Double_t productOfWeightsForFourFourReduced = 0.; // sum_{i=1}^{N} w_{<4>}w_{<4'>}
17598  Double_t productOfWeightsForTwoReducedFourReduced = 0.; // sum_{i=1}^{N} w_{<2'>}w_{<4'>}
17599  // ...
17600  
17601  // products for differential flow:
17602  Double_t twoTwoReduced = 0; // <<2><2'>> 
17603  Double_t twoFourReduced = 0; // <<2><4'>> 
17604  Double_t fourTwoReduced = 0; // <<4><2'>> 
17605  Double_t fourFourReduced = 0; // <<4><4'>> 
17606  Double_t twoReducedFourReduced = 0; // <<2'><4'>> 
17607
17608  // denominators in the expressions for the unbiased estimators for covariances:
17609  // denominator = 1 - term1/(term2*term3)
17610  // prefactor = term1/(term2*term3)
17611  Double_t denominator = 0.; 
17612  Double_t prefactor = 0.;
17613  Double_t term1 = 0.; 
17614  Double_t term2 = 0.; 
17615  Double_t term3 = 0.; 
17616  
17617  // unbiased estimators for covariances for differential flow:
17618  Double_t covTwoTwoReduced = 0.; // Cov(<2>,<2'>)
17619  Double_t wCovTwoTwoReduced = 0.; // Cov(<2>,<2'>) * prefactor(w_{<2>},w_{<2'>})
17620  Double_t covTwoFourReduced = 0.; // Cov(<2>,<4'>)
17621  Double_t wCovTwoFourReduced = 0.; // Cov(<2>,<4'>) * prefactor(w_{<2>},w_{<4'>})
17622  Double_t covFourTwoReduced = 0.; // Cov(<4>,<2'>)
17623  Double_t wCovFourTwoReduced = 0.; // Cov(<4>,<2'>) * prefactor(w_{<4>},w_{<2'>})
17624  Double_t covFourFourReduced = 0.; // Cov(<4>,<4'>)
17625  Double_t wCovFourFourReduced = 0.; // Cov(<4>,<4'>) * prefactor(w_{<4>},w_{<4'>})
17626  Double_t covTwoReducedFourReduced = 0.; // Cov(<2'>,<4'>)
17627  Double_t wCovTwoReducedFourReduced = 0.; // Cov(<2'>,<4'>) * prefactor(w_{<2'>},w_{<4'>})
17628  
17629  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17630  {
17631   // average reduced corelations:
17632   twoReduced = fDiffFlowCorrelationsHist[t][pe][0]->GetBinContent(b);
17633   fourReduced = fDiffFlowCorrelationsHist[t][pe][1]->GetBinContent(b);
17634   // average products:
17635   twoTwoReduced = fDiffFlowProductOfCorrelationsPro[t][pe][0][1]->GetBinContent(b);
17636   twoFourReduced = fDiffFlowProductOfCorrelationsPro[t][pe][0][3]->GetBinContent(b);
17637   fourTwoReduced = fDiffFlowProductOfCorrelationsPro[t][pe][1][2]->GetBinContent(b);
17638   fourFourReduced = fDiffFlowProductOfCorrelationsPro[t][pe][2][3]->GetBinContent(b);
17639   twoReducedFourReduced = fDiffFlowProductOfCorrelationsPro[t][pe][1][3]->GetBinContent(b);  
17640   // sum of weights for reduced correlations:
17641   sumOfWeightsForTwoReduced = fDiffFlowSumOfEventWeights[t][pe][0][0]->GetBinContent(b);
17642   sumOfWeightsForFourReduced = fDiffFlowSumOfEventWeights[t][pe][0][1]->GetBinContent(b);
17643   // products of weights for correlations:
17644   productOfWeightsForTwoTwoReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][0][1]->GetBinContent(b); 
17645   productOfWeightsForTwoFourReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][0][3]->GetBinContent(b);
17646   productOfWeightsForFourTwoReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][1][2]->GetBinContent(b);
17647   productOfWeightsForFourFourReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][2][3]->GetBinContent(b);
17648   productOfWeightsForTwoReducedFourReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][1][3]->GetBinContent(b);
17649   // denominator for the unbiased estimator for covariances: 1 - term1/(term2*term3) 
17650   // prefactor (multiplies Cov's) = term1/(term2*term3)       
17651   // <2>,<2'>:
17652   term1 = productOfWeightsForTwoTwoReduced;      
17653   term2 = sumOfWeightsForTwo;
17654   term3 = sumOfWeightsForTwoReduced;        
17655   if(term2*term3>0.)
17656   {
17657    denominator = 1.-term1/(term2*term3);
17658    prefactor = term1/(term2*term3);
17659    if(TMath::Abs(denominator)>1.e-6)
17660    {
17661     covTwoTwoReduced = (twoTwoReduced-two*twoReduced)/denominator;            
17662     wCovTwoTwoReduced = covTwoTwoReduced*prefactor; 
17663     fDiffFlowCovariances[t][pe][0]->SetBinContent(b,wCovTwoTwoReduced);
17664    }
17665   }
17666   // <2>,<4'>:
17667   term1 = productOfWeightsForTwoFourReduced;      
17668   term2 = sumOfWeightsForTwo;
17669   term3 = sumOfWeightsForFourReduced;        
17670   if(term2*term3>0.)
17671   {
17672    denominator = 1.-term1/(term2*term3);
17673    prefactor = term1/(term2*term3);
17674    if(TMath::Abs(denominator)>1.e-6)
17675    {
17676     covTwoFourReduced = (twoFourReduced-two*fourReduced)/denominator;            
17677     wCovTwoFourReduced = covTwoFourReduced*prefactor; 
17678     fDiffFlowCovariances[t][pe][1]->SetBinContent(b,wCovTwoFourReduced);
17679    }
17680   }
17681   // <4>,<2'>:
17682   term1 = productOfWeightsForFourTwoReduced;      
17683   term2 = sumOfWeightsForFour;
17684   term3 = sumOfWeightsForTwoReduced;        
17685   if(term2*term3>0.)
17686   {
17687    denominator = 1.-term1/(term2*term3);
17688    prefactor = term1/(term2*term3);
17689    if(TMath::Abs(denominator)>1.e-6)
17690    {
17691     covFourTwoReduced = (fourTwoReduced-four*twoReduced)/denominator;            
17692     wCovFourTwoReduced = covFourTwoReduced*prefactor; 
17693     fDiffFlowCovariances[t][pe][2]->SetBinContent(b,wCovFourTwoReduced);
17694    }
17695   }
17696   // <4>,<4'>:
17697   term1 = productOfWeightsForFourFourReduced;      
17698   term2 = sumOfWeightsForFour;
17699   term3 = sumOfWeightsForFourReduced;        
17700   if(term2*term3>0.)
17701   {
17702    denominator = 1.-term1/(term2*term3);
17703    prefactor = term1/(term2*term3);
17704    if(TMath::Abs(denominator)>1.e-6)
17705    {
17706     covFourFourReduced = (fourFourReduced-four*fourReduced)/denominator;            
17707     wCovFourFourReduced = covFourFourReduced*prefactor; 
17708     fDiffFlowCovariances[t][pe][3]->SetBinContent(b,wCovFourFourReduced);
17709    }
17710   }
17711   // <2'>,<4'>:
17712   term1 = productOfWeightsForTwoReducedFourReduced;      
17713   term2 = sumOfWeightsForTwoReduced;
17714   term3 = sumOfWeightsForFourReduced;        
17715   if(term2*term3>0.)
17716   {
17717    denominator = 1.-term1/(term2*term3);
17718    prefactor = term1/(term2*term3);
17719    if(TMath::Abs(denominator)>1.e-6)
17720    {
17721     covTwoReducedFourReduced = (twoReducedFourReduced-twoReduced*fourReduced)/denominator;            
17722     wCovTwoReducedFourReduced = covTwoReducedFourReduced*prefactor; 
17723     fDiffFlowCovariances[t][pe][4]->SetBinContent(b,wCovTwoReducedFourReduced);
17724    }
17725   }   
17726  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17727   
17728 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCovariances(TString type, TString ptOrEta)
17729
17730 //=======================================================================================================================
17731
17732 void AliFlowAnalysisWithQCumulants::CalculateDiffFlow(TString type, TString ptOrEta)
17733 {
17734  // Calculate final results for differential flow.
17735  
17736  // REMARK: Differential flow calculated in this method is NOT corrected for non-uniform acceptance. 
17737  // This correction, if enabled via setter SetApplyCorrectionForNUA(Bool_t), is applied in the method 
17738  // CalculateDiffFlowCorrectedForNUA(TString type, TString ptOrEta)
17739   
17740  Int_t t = 0; // RP or POI
17741  Int_t pe = 0; // pt or eta
17742
17743  if(type == "RP")
17744  {
17745   t = 0;
17746  } else if(type == "POI")
17747    {
17748     t = 1;
17749    } 
17750      
17751  if(ptOrEta == "Pt")
17752  {
17753   pe = 0;
17754  } else if(ptOrEta == "Eta")
17755    {
17756     pe = 1;
17757    } 
17758        
17759  // Common:
17760  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
17761  // Correlations:
17762  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>>
17763  Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>> 
17764  // Statistical errors of correlations:
17765  Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1);
17766  Double_t fourError = fIntFlowCorrelationsHist->GetBinError(2);   
17767  // Reduced correlations:
17768  Double_t twoReduced = 0.; // <<2'>>
17769  Double_t fourReduced = 0.; // <<4'>>
17770  // Statistical errors of reduced correlations:
17771  Double_t twoReducedError = 0.; 
17772  Double_t fourReducedError = 0.; 
17773  // Covariances:
17774  Double_t wCovTwoFour = 0.; // Cov(<2>,<4>) * prefactor(<2>,<4>)
17775  if(!fForgetAboutCovariances)
17776  {
17777   wCovTwoFour = fIntFlowCovariances->GetBinContent(1); // Cov(<2>,<4>) * prefactor(<2>,<4>)
17778  }
17779  Double_t wCovTwoTwoReduced = 0.; // Cov(<2>,<2'>) * prefactor(<2>,<2'>)
17780  Double_t wCovTwoFourReduced = 0.; // Cov(<2>,<4'>) * prefactor(<2>,<4'>)
17781  Double_t wCovFourTwoReduced = 0.; // Cov(<4>,<2'>) * prefactor(<4>,<2'>)
17782  Double_t wCovFourFourReduced = 0.; // Cov(<4>,<4'>) * prefactor(<4>,<4'>)
17783  Double_t wCovTwoReducedFourReduced = 0.; // Cov(<2'>,<4'>) * prefactor(<2'>,<4'>)
17784  // Differential flow:
17785  Double_t v2Prime = 0.; // v'{2}                   
17786  Double_t v4Prime = 0.; // v'{4}
17787  // Statistical error of differential flow:
17788  Double_t v2PrimeError = 0.;                    
17789  Double_t v4PrimeError = 0.; 
17790  // Squared statistical error of differential flow:
17791  Double_t v2PrimeErrorSquared = 0.;                    
17792  Double_t v4PrimeErrorSquared = 0.; 
17793  // Loop over pt or eta bins:
17794  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17795  {
17796   // Reduced correlations and statistical errors:
17797   twoReduced = fDiffFlowCorrelationsHist[t][pe][0]->GetBinContent(b);
17798   twoReducedError = fDiffFlowCorrelationsHist[t][pe][0]->GetBinError(b);
17799   fourReduced = fDiffFlowCorrelationsHist[t][pe][1]->GetBinContent(b);
17800   fourReducedError = fDiffFlowCorrelationsHist[t][pe][1]->GetBinError(b);
17801   // Covariances:
17802   if(!fForgetAboutCovariances)
17803   {
17804    wCovTwoTwoReduced = fDiffFlowCovariances[t][pe][0]->GetBinContent(b);
17805    wCovTwoFourReduced = fDiffFlowCovariances[t][pe][1]->GetBinContent(b);
17806    wCovFourTwoReduced = fDiffFlowCovariances[t][pe][2]->GetBinContent(b);
17807    wCovFourFourReduced = fDiffFlowCovariances[t][pe][3]->GetBinContent(b);
17808    wCovTwoReducedFourReduced = fDiffFlowCovariances[t][pe][4]->GetBinContent(b);
17809   }
17810   // Differential flow:
17811   // v'{2}:
17812   if(two>0.) 
17813   {
17814    v2Prime = twoReduced/pow(two,0.5);
17815    v2PrimeErrorSquared = (1./4.)*pow(two,-3.)*(pow(twoReduced,2.)*pow(twoError,2.)
17816                        + 4.*pow(two,2.)*pow(twoReducedError,2.)
17817                        - 4.*two*twoReduced*wCovTwoTwoReduced);
17818    if(v2PrimeErrorSquared>0.){v2PrimeError = pow(v2PrimeErrorSquared,0.5);}
17819    if(TMath::Abs(v2Prime)>0.)
17820    {
17821     fDiffFlow[t][pe][0]->SetBinContent(b,v2Prime); 
17822     fDiffFlow[t][pe][0]->SetBinError(b,v2PrimeError);    
17823    }  
17824   } // end of if(two>0.) 
17825   // differential flow:
17826   // v'{4}
17827   if(2.*pow(two,2.)-four > 0.) 
17828   {
17829    v4Prime = (2.*two*twoReduced-fourReduced)/pow(2.*pow(two,2.)-four,3./4.);
17830    v4PrimeErrorSquared = pow(2.*pow(two,2.)-four,-7./2.)
17831                        * (pow(2.*pow(two,2.)*twoReduced-3.*two*fourReduced+2.*four*twoReduced,2.)*pow(twoError,2.)
17832                        + (9./16.)*pow(2.*two*twoReduced-fourReduced,2.)*pow(fourError,2.)
17833                        + 4.*pow(two,2.)*pow(2.*pow(two,2.)-four,2.)*pow(twoReducedError,2.)
17834                        + pow(2.*pow(two,2.)-four,2.)*pow(fourReducedError,2.)                          
17835                        - (3./2.)*(2.*two*twoReduced-fourReduced)
17836                        * (2.*pow(two,2.)*twoReduced-3.*two*fourReduced+2.*four*twoReduced)*wCovTwoFour
17837                        - 4.*two*(2.*pow(two,2.)-four)
17838                        * (2.*pow(two,2.)*twoReduced-3.*two*fourReduced+2.*four*twoReduced)*wCovTwoTwoReduced
17839                        + 2.*(2.*pow(two,2.)-four)
17840                        * (2.*pow(two,2.)*twoReduced-3.*two*fourReduced+2.*four*twoReduced)*wCovTwoFourReduced
17841                        + 3.*two*(2.*pow(two,2.)-four)*(2.*two*twoReduced-fourReduced)*wCovFourTwoReduced
17842                        - (3./2.)*(2.*pow(two,2.)-four)*(2.*two*twoReduced-fourReduced)*wCovFourFourReduced 
17843                        - 4.*two*pow(2.*pow(two,2.)-four,2.)*wCovTwoReducedFourReduced);  
17844    if(v4PrimeErrorSquared>0.){v4PrimeError = pow(v4PrimeErrorSquared,0.5);}        
17845    if(TMath::Abs(v4Prime)>0.)
17846    {
17847     fDiffFlow[t][pe][1]->SetBinContent(b,v4Prime);
17848     fDiffFlow[t][pe][1]->SetBinError(b,v4PrimeError);     
17849    }
17850   } // end of if(2.*pow(two,2.)-four > 0.)  
17851  } // end of for(Int_t b=1;b<=fnBinsPtEta[pe];b++)
17852
17853 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlow(TString type, Bool_t useParticleWeights)
17854
17855 //=======================================================================================================================
17856
17857 void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlow(TString type)
17858 {
17859  // Calculate final results for 2D diferential flow.
17860
17861  // to be improved - check pointers used in this method
17862
17863  Int_t t = 0; // RP or POI
17864
17865  if(type == "RP")
17866  {
17867   t = 0;
17868  } else if(type == "POI")
17869    {
17870     t = 1;
17871    } 
17872  
17873  // Differential flow:
17874  Double_t v2Prime = 0.; // v'{2}                   
17875  Double_t v4Prime = 0.; // v'{4}
17876  // Differential cumulants:
17877  Double_t qc2Prime = 0.; // QC{2'}                   
17878  Double_t qc4Prime = 0.; // QC{4'}
17879  // Looping over all (pt,eta) bins and calculating differential flow: 
17880  for(Int_t p=1;p<=fnBinsPt;p++)
17881  {
17882   for(Int_t e=1;e<=fnBinsEta;e++)
17883   {
17884    // QC{2'}:
17885    qc2Prime = f2DDiffFlowCumulants[t][0]->GetBinContent(f2DDiffFlowCumulants[t][0]->GetBin(p,e));
17886    if(qc2Prime>=0.)
17887    {
17888     v2Prime = pow(qc2Prime,0.5);
17889     f2DDiffFlow[t][0]->SetBinContent(f2DDiffFlow[t][0]->GetBin(p,e),v2Prime); 
17890    } 
17891    // QC{4'}:
17892    qc4Prime = f2DDiffFlowCumulants[t][1]->GetBinContent(f2DDiffFlowCumulants[t][1]->GetBin(p,e));
17893    if(qc4Prime<=0.)
17894    {
17895     v4Prime = pow(-1.*qc4Prime,1./4.);
17896     f2DDiffFlow[t][1]->SetBinContent(f2DDiffFlow[t][1]->GetBin(p,e),v4Prime); 
17897    }   
17898   } // end of for(Int_t e=1;e<=fnBinsEta;e++)
17899  } // end of for(Int_t p=1;p<=fnBinsPt;p++)
17900  
17901 } // end of void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlow(TString type)  
17902
17903 //=======================================================================================================================
17904
17905 void AliFlowAnalysisWithQCumulants::StoreIntFlowFlags()
17906 {
17907  // a) Store all flags for integrated flow in profile fIntFlowFlags.
17908  
17909  if(!fIntFlowFlags)
17910  {
17911   cout<<"WARNING: fIntFlowFlags is NULL in AFAWQC::SFFIF() !!!!"<<endl;
17912   exit(0);
17913  } 
17914
17915  // particle weights used or not:
17916  fIntFlowFlags->Fill(0.5,(Int_t)fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights);
17917  // which event weights were used:
17918  if(fMultiplicityWeight->Contains("combinations"))
17919  {
17920   fIntFlowFlags->Fill(1.5,0); // 0 = "combinations" (default)
17921  } else if(fMultiplicityWeight->Contains("unit"))
17922    {
17923     fIntFlowFlags->Fill(1.5,1); // 1 = "unit"   
17924    } else if(fMultiplicityWeight->Contains("multiplicity"))
17925      {
17926       fIntFlowFlags->Fill(1.5,2); // 2 = "multiplicity"        
17927      } 
17928  fIntFlowFlags->Fill(2.5,(Int_t)fApplyCorrectionForNUA);
17929  fIntFlowFlags->Fill(3.5,(Int_t)fPrintFinalResults[0]);
17930  fIntFlowFlags->Fill(4.5,(Int_t)fPrintFinalResults[1]);
17931  fIntFlowFlags->Fill(5.5,(Int_t)fPrintFinalResults[2]);
17932  fIntFlowFlags->Fill(6.5,(Int_t)fPrintFinalResults[3]);
17933  fIntFlowFlags->Fill(7.5,(Int_t)fApplyCorrectionForNUAVsM);
17934  fIntFlowFlags->Fill(8.5,(Int_t)fPropagateErrorAlsoFromNIT);
17935  fIntFlowFlags->Fill(9.5,(Int_t)fCalculateCumulantsVsM);
17936  fIntFlowFlags->Fill(10.5,(Int_t)fMinimumBiasReferenceFlow);
17937  fIntFlowFlags->Fill(11.5,(Int_t)fForgetAboutCovariances);
17938  fIntFlowFlags->Fill(12.5,(Int_t)fStorePhiDistributionForOneEvent); 
17939  fIntFlowFlags->Fill(13.5,(Int_t)fFillMultipleControlHistograms);  
17940  fIntFlowFlags->Fill(14.5,(Int_t)fCalculateAllCorrelationsVsM);  
17941  // which multiplicity was used:
17942  if(fMultiplicityIs==AliFlowCommonConstants::kRP) // # of Reference Particles
17943  {
17944   fIntFlowFlags->Fill(15.5,0); // 0 = # of Reference Particles
17945  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
17946    {
17947     fIntFlowFlags->Fill(15.5,1); // 1 = ref. mult. from ESD
17948    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
17949      {
17950       fIntFlowFlags->Fill(15.5,2); // 2 = # of Particles of Interest
17951      } 
17952  fIntFlowFlags->Fill(16.5,(Int_t)fExactNoRPs); 
17953  fIntFlowFlags->Fill(17.5,(Int_t)fUse2DHistograms); 
17954  fIntFlowFlags->Fill(18.5,(Int_t)fFillProfilesVsMUsingWeights); 
17955  fIntFlowFlags->Fill(19.5,(Int_t)fUseQvectorTerms); 
17956
17957 } // end of void AliFlowAnalysisWithQCumulants::StoreIntFlowFlags()
17958
17959 //=======================================================================================================================
17960
17961 void AliFlowAnalysisWithQCumulants::StoreDiffFlowFlags()
17962 {
17963  // Store all flags for differential flow in the profile fDiffFlowFlags.
17964   
17965  if(!fDiffFlowFlags)
17966  {
17967   printf("\n WARNING (QC): fDiffFlowFlags is NULL in AFAWQC::SDFF() !!!!\n\n");
17968   exit(0);
17969  } 
17970  
17971  fDiffFlowFlags->Fill(0.5,fCalculateDiffFlow); // calculate differential flow
17972  fDiffFlowFlags->Fill(1.5,fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights); // particle weights used or not?
17973  //fDiffFlowFlags->Fill(2.5,""); // which event weight was used? ("combinations", "unit" or "multiplicity") to be improved - finalized
17974  fDiffFlowFlags->Fill(3.5,fApplyCorrectionForNUA); // corrected for non-uniform acceptance or not
17975  fDiffFlowFlags->Fill(4.5,fCalculate2DDiffFlow); // calculate also 2D differential flow vs (pt,eta) 
17976  fDiffFlowFlags->Fill(5.5,fCalculateDiffFlowVsEta); // if you set kFALSE only differential flow vs pt is calculated
17977      
17978 } // end of void AliFlowAnalysisWithQCumulants::StoreDiffFlowFlags()
17979
17980 //=======================================================================================================================
17981
17982 void AliFlowAnalysisWithQCumulants::StoreMixedHarmonicsFlags()
17983 {
17984  // Store all flags for mixed harmonics in profile fMixedHarmonicsFlags.
17985  
17986  if(!fMixedHarmonicsFlags)
17987  {
17988   cout<<"WARNING: fMixedHarmonicsFlags is NULL in AFAWQC::SMHF() !!!!"<<endl;
17989   exit(0);
17990  } 
17991
17992  fMixedHarmonicsFlags->Fill(0.5,(Int_t)fCalculateMixedHarmonics);
17993  fMixedHarmonicsFlags->Fill(1.5,(Int_t)fHarmonic);
17994  fMixedHarmonicsFlags->Fill(2.5,(Int_t)fCalculateMixedHarmonicsVsM);
17995  // Which multiplicity weight was used?:
17996
17997  if(fMultiplicityWeight->Contains("combinations"))
17998  {
17999   fMixedHarmonicsFlags->Fill(3.5,0); // 0 = "combinations" (default)
18000  } else if(fMultiplicityWeight->Contains("unit"))
18001    {
18002     fMixedHarmonicsFlags->Fill(3.5,1); // 1 = "unit"   
18003    } else if(fMultiplicityWeight->Contains("multiplicity"))
18004      {
18005       fMixedHarmonicsFlags->Fill(3.5,2); // 2 = "multiplicity"        
18006      } 
18007
18008 } // end of void AliFlowAnalysisWithQCumulants::StoreMixedHarmonicsFlags()
18009
18010 //=======================================================================================================================
18011
18012 void AliFlowAnalysisWithQCumulants::StoreControlHistogramsFlags()
18013 {
18014  // Store all flags for control histograms in profile fControlHistogramsFlags.
18015
18016  if(!fControlHistogramsFlags)
18017  {
18018   cout<<"WARNING: fControlHistogramsFlags is NULL in AFAWQC::SCHF() !!!!"<<endl;
18019   exit(0);
18020  } 
18021
18022  fControlHistogramsFlags->Fill(0.5,(Int_t)fStoreControlHistograms);
18023  fControlHistogramsFlags->Fill(1.5,(Int_t)fUseQvectorTerms);
18024
18025 } // end of void AliFlowAnalysisWithQCumulants::StoreControlHistogramsFlags()
18026
18027 //=======================================================================================================================
18028
18029 void AliFlowAnalysisWithQCumulants::StoreBootstrapFlags()
18030 {
18031  // Store all flags for bootstrap in TProfile fBootstrapFlags.
18032
18033  if(!fBootstrapFlags)
18034  {
18035   cout<<"WARNING: fBootstrapFlags is NULL in AFAWQC::SBF() !!!!"<<endl;
18036   exit(0);
18037  } 
18038
18039  fBootstrapFlags->Fill(0.5,(Int_t)fUseBootstrap);
18040  fBootstrapFlags->Fill(1.5,(Int_t)fUseBootstrapVsM);
18041  fBootstrapFlags->Fill(2.5,(Int_t)fnSubsamples);
18042
18043 } // end of void AliFlowAnalysisWithQCumulants::StoreBootstrapFlags()
18044
18045 //=======================================================================================================================
18046
18047 void AliFlowAnalysisWithQCumulants::GetPointersForCommonHistograms() 
18048 {
18049  // Access all pointers to common control and common result histograms and profiles.
18050  
18051  TString sCommonConstantsName = "fCommonConstants";
18052  sCommonConstantsName += fAnalysisLabel->Data();
18053  fCommonConstants = dynamic_cast<TProfile*>(fHistList->FindObject(sCommonConstantsName.Data()));
18054  if(!fCommonConstants)
18055  {
18056   printf("\n WARNING (QC): fCommonConstants is NULL in AFAWQC::GPFCH() !!!!\n\n");
18057   exit(0);
18058  }
18059  
18060  // to be improved - lines bellow can be implemented better.
18061  
18062  TString commonHistsName = "AliFlowCommonHistQC";
18063  commonHistsName += fAnalysisLabel->Data();
18064  AliFlowCommonHist *commonHist = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHistsName.Data()));
18065  if(commonHist) 
18066  {
18067   this->SetCommonHists(commonHist); 
18068   if(fCommonHists->GetHarmonic())
18069   {
18070    fHarmonic = (Int_t)(fCommonHists->GetHarmonic())->GetBinContent(1);
18071   } 
18072  } // end of if(commonHist) 
18073  TString commonHists2ndOrderName = "AliFlowCommonHist2ndOrderQC";
18074  commonHists2ndOrderName += fAnalysisLabel->Data();
18075  AliFlowCommonHist *commonHist2nd = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHists2ndOrderName.Data()));
18076  if(commonHist2nd) this->SetCommonHists2nd(commonHist2nd);   
18077  TString commonHists4thOrderName = "AliFlowCommonHist4thOrderQC";
18078  commonHists4thOrderName += fAnalysisLabel->Data();
18079  AliFlowCommonHist *commonHist4th = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHists4thOrderName.Data()));
18080  if(commonHist4th) this->SetCommonHists4th(commonHist4th);  
18081  TString commonHists6thOrderName = "AliFlowCommonHist6thOrderQC";
18082  commonHists6thOrderName += fAnalysisLabel->Data();
18083  AliFlowCommonHist *commonHist6th = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHists6thOrderName.Data()));
18084  if(commonHist6th) this->SetCommonHists6th(commonHist6th);  
18085  TString commonHists8thOrderName = "AliFlowCommonHist8thOrderQC";
18086  commonHists8thOrderName += fAnalysisLabel->Data();
18087  AliFlowCommonHist *commonHist8th = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHists8thOrderName.Data()));
18088  if(commonHist8th) this->SetCommonHists8th(commonHist8th); 
18089   
18090  TString commonHistResults2ndOrderName = "AliFlowCommonHistResults2ndOrderQC"; 
18091  commonHistResults2ndOrderName += fAnalysisLabel->Data(); 
18092  AliFlowCommonHistResults *commonHistRes2nd = dynamic_cast<AliFlowCommonHistResults*>
18093                                               (fHistList->FindObject(commonHistResults2ndOrderName.Data()));
18094  if(commonHistRes2nd) this->SetCommonHistsResults2nd(commonHistRes2nd);   
18095  TString commonHistResults4thOrderName = "AliFlowCommonHistResults4thOrderQC";
18096  commonHistResults4thOrderName += fAnalysisLabel->Data();
18097  AliFlowCommonHistResults *commonHistRes4th = dynamic_cast<AliFlowCommonHistResults*>
18098                                               (fHistList->FindObject(commonHistResults4thOrderName.Data()));
18099  if(commonHistRes4th) this->SetCommonHistsResults4th(commonHistRes4th);  
18100  TString commonHistResults6thOrderName = "AliFlowCommonHistResults6thOrderQC";
18101  commonHistResults6thOrderName += fAnalysisLabel->Data();
18102  AliFlowCommonHistResults *commonHistRes6th = dynamic_cast<AliFlowCommonHistResults*>
18103                                               (fHistList->FindObject(commonHistResults6thOrderName.Data()));
18104  if(commonHistRes6th) this->SetCommonHistsResults6th(commonHistRes6th);  
18105  TString commonHistResults8thOrderName = "AliFlowCommonHistResults8thOrderQC";
18106  commonHistResults8thOrderName += fAnalysisLabel->Data();
18107  AliFlowCommonHistResults *commonHistRes8th = dynamic_cast<AliFlowCommonHistResults*>
18108                                               (fHistList->FindObject(commonHistResults8thOrderName.Data()));  
18109  if(commonHistRes8th) this->SetCommonHistsResults8th(commonHistRes8th);
18110        
18111 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForCommonHistograms() 
18112
18113 //=======================================================================================================================
18114
18115 void AliFlowAnalysisWithQCumulants::GetPointersForParticleWeightsHistograms() 
18116 {
18117  // Get pointers for histograms with particle weights.
18118
18119  TList *weightsList = dynamic_cast<TList*>(fHistList->FindObject("Weights"));
18120  if(!weightsList){printf("\n WARNING (QC): weightsList is NULL in AFAWQC::GPFPWH() !!!!\n");exit(0);}
18121  this->SetWeightsList(weightsList);
18122  TString fUseParticleWeightsName = "fUseParticleWeightsQC"; // to be improved (hirdwired label QC)
18123  fUseParticleWeightsName += fAnalysisLabel->Data();
18124  TProfile *useParticleWeights = dynamic_cast<TProfile*>(weightsList->FindObject(fUseParticleWeightsName.Data()));
18125  if(useParticleWeights)
18126  {
18127   this->SetUseParticleWeights(useParticleWeights);  
18128   fUsePhiWeights = (Int_t)fUseParticleWeights->GetBinContent(1); 
18129   fUsePtWeights = (Int_t)fUseParticleWeights->GetBinContent(2); 
18130   fUseEtaWeights = (Int_t)fUseParticleWeights->GetBinContent(3);  
18131   fUseTrackWeights = (Int_t)fUseParticleWeights->GetBinContent(4);  
18132  }
18133 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForParticleWeightsHistograms(); 
18134
18135 //=======================================================================================================================
18136
18137 void AliFlowAnalysisWithQCumulants::GetPointersForIntFlowHistograms() 
18138 {
18139  // Get pointers for histograms and profiles relevant for integrated flow:
18140  //  a) Get pointer to base list for integrated flow holding profile fIntFlowFlags and lists fIntFlowProfiles and fIntFlowResults.
18141  //  b) Get pointer to profile fIntFlowFlags holding all flags for integrated flow.
18142  //  c) Get pointer to list fIntFlowProfiles and pointers to all objects that she holds. 
18143  //  d) Get pointer to list fIntFlowResults and pointers to all objects that she holds. 
18144   
18145  TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data member?)
18146  TString powerFlag[2] = {"linear","quadratic"}; // to be improved (should I promote this to data member?)
18147  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?)
18148  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?)
18149  
18150  // a) Get pointer to base list for integrated flow holding profile fIntFlowFlags and lists fIntFlowProfiles and fIntFlowResults:
18151  TList *intFlowList = NULL;
18152  intFlowList = dynamic_cast<TList*>(fHistList->FindObject("Integrated Flow"));
18153  if(!intFlowList) 
18154  {
18155   cout<<"WARNING: intFlowList is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18156   exit(0); 
18157  }  
18158   
18159  // b) Get pointer to profile fIntFlowFlags holding all flags for integrated flow:
18160  TString intFlowFlagsName = "fIntFlowFlags";
18161  intFlowFlagsName += fAnalysisLabel->Data();
18162  TProfile *intFlowFlags = dynamic_cast<TProfile*>(intFlowList->FindObject(intFlowFlagsName.Data()));
18163  if(intFlowFlags)
18164  {
18165   this->SetIntFlowFlags(intFlowFlags);  
18166   fApplyCorrectionForNUA = (Bool_t)intFlowFlags->GetBinContent(3); 
18167   fApplyCorrectionForNUAVsM = (Bool_t)intFlowFlags->GetBinContent(8); 
18168   fCalculateCumulantsVsM = (Bool_t)intFlowFlags->GetBinContent(10);  
18169  } else 
18170    {
18171     cout<<"WARNING: intFlowFlags is NULL in FAWQC::GPFIFH() !!!!"<<endl;
18172    }
18173   
18174   // c) Get pointer to list fIntFlowProfiles and pointers to all objects that she holds:
18175   TList *intFlowProfiles = NULL;
18176   intFlowProfiles = dynamic_cast<TList*>(intFlowList->FindObject("Profiles"));
18177   if(intFlowProfiles)  
18178   {
18179    // average multiplicities:
18180    TString avMultiplicityName = "fAvMultiplicity";
18181    avMultiplicityName += fAnalysisLabel->Data();
18182    TProfile *avMultiplicity = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(avMultiplicityName.Data()));
18183    if(avMultiplicity) 
18184    {
18185     this->SetAvMultiplicity(avMultiplicity);
18186    } else 
18187      {
18188       cout<<"WARNING: avMultiplicity is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18189      }
18190    // average correlations <<2>>, <<4>>, <<6>> and <<8>> (with wrong errors!):
18191    TString intFlowCorrelationsProName = "fIntFlowCorrelationsPro";
18192    intFlowCorrelationsProName += fAnalysisLabel->Data();
18193    TProfile *intFlowCorrelationsPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowCorrelationsProName.Data()));
18194    if(intFlowCorrelationsPro) 
18195    {
18196     this->SetIntFlowCorrelationsPro(intFlowCorrelationsPro);
18197    } else 
18198      {
18199       cout<<"WARNING: intFlowCorrelationsPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18200      }      
18201    // average squared correlations <<2>^2>, <<4>^2>, <<6>^2> and <<8^2>>:
18202    TString intFlowSquaredCorrelationsProName = "fIntFlowSquaredCorrelationsPro";
18203    intFlowSquaredCorrelationsProName += fAnalysisLabel->Data();
18204    TProfile *intFlowSquaredCorrelationsPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowSquaredCorrelationsProName.Data()));
18205    if(intFlowSquaredCorrelationsPro) 
18206    {
18207     this->SetIntFlowSquaredCorrelationsPro(intFlowSquaredCorrelationsPro);
18208    } else 
18209      {
18210       cout<<"WARNING: intFlowSquaredCorrelationsPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18211      }             
18212    if(fCalculateCumulantsVsM)
18213    {
18214     // Average correlations <<2>>, <<4>>, <<6>> and <<8>> versus multiplicity for all events (error is wrong here):   
18215     TString intFlowCorrelationsVsMProName = "fIntFlowCorrelationsVsMPro";
18216     intFlowCorrelationsVsMProName += fAnalysisLabel->Data();
18217     for(Int_t ci=0;ci<4;ci++) // correlation index
18218     {
18219      TProfile *intFlowCorrelationsVsMPro = dynamic_cast<TProfile*>
18220                                         (intFlowProfiles->FindObject(Form("%s, %s",intFlowCorrelationsVsMProName.Data(),correlationFlag[ci].Data())));
18221      if(intFlowCorrelationsVsMPro)
18222      {
18223       this->SetIntFlowCorrelationsVsMPro(intFlowCorrelationsVsMPro,ci);
18224      } else
18225        {
18226         cout<<"WARNING: "<<Form("intFlowCorrelationsVsMPro[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18227        }   
18228     } // end of for(Int_t ci=0;ci<4;ci++) // correlation index 
18229     // Average squared correlations <<2>^2>, <<4>^2>, <<6>^2> and <<8>^2> versus multiplicity for all events:   
18230     TString intFlowSquaredCorrelationsVsMProName = "fIntFlowSquaredCorrelationsVsMPro";
18231     intFlowSquaredCorrelationsVsMProName += fAnalysisLabel->Data();
18232     for(Int_t ci=0;ci<4;ci++) // correlation index
18233     {
18234      TProfile *intFlowSquaredCorrelationsVsMPro = dynamic_cast<TProfile*>
18235                       (intFlowProfiles->FindObject(Form("%s, %s",intFlowSquaredCorrelationsVsMProName.Data(),squaredCorrelationFlag[ci].Data())));
18236      if(intFlowSquaredCorrelationsVsMPro)
18237      {
18238       this->SetIntFlowSquaredCorrelationsVsMPro(intFlowSquaredCorrelationsVsMPro,ci);
18239      } else
18240        {
18241         cout<<"WARNING: "<<Form("intFlowSquaredCorrelationsVsMPro[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18242        }   
18243     } // end of for(Int_t ci=0;ci<4;ci++) // correlation index 
18244    } // end of if(fCalculateCumulantsVsM)
18245    // average all correlations for integrated flow (with wrong errors!):
18246    TString intFlowCorrelationsAllProName = "fIntFlowCorrelationsAllPro";
18247    intFlowCorrelationsAllProName += fAnalysisLabel->Data();
18248    TProfile *intFlowCorrelationsAllPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowCorrelationsAllProName.Data()));
18249    if(intFlowCorrelationsAllPro) 
18250    {
18251     this->SetIntFlowCorrelationsAllPro(intFlowCorrelationsAllPro);
18252    } else 
18253      {
18254       cout<<"WARNING: intFlowCorrelationsAllPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18255      }     
18256    // average extra correlations for integrated flow (which appear only when particle weights are used):
18257    // (to be improved: Weak point in implementation, I am assuming here that method GetPointersForParticleWeightsHistograms() was called)
18258    if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
18259    {
18260     TString intFlowExtraCorrelationsProName = "fIntFlowExtraCorrelationsPro";
18261     intFlowExtraCorrelationsProName += fAnalysisLabel->Data();
18262     TProfile *intFlowExtraCorrelationsPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowExtraCorrelationsProName.Data()));
18263     if(intFlowExtraCorrelationsPro) 
18264     {
18265      this->SetIntFlowExtraCorrelationsPro(intFlowExtraCorrelationsPro);
18266     } else 
18267       {
18268        cout<<"WARNING: intFlowExtraCorrelationsPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18269       }
18270    } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)        
18271    // average products of correlations <2>, <4>, <6> and <8>:  
18272    TString intFlowProductOfCorrelationsProName = "fIntFlowProductOfCorrelationsPro";
18273    intFlowProductOfCorrelationsProName += fAnalysisLabel->Data();
18274    TProfile *intFlowProductOfCorrelationsPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowProductOfCorrelationsProName.Data()));
18275    if(intFlowProductOfCorrelationsPro) 
18276    {
18277     this->SetIntFlowProductOfCorrelationsPro(intFlowProductOfCorrelationsPro);
18278    } else 
18279      {
18280       cout<<"WARNING: intFlowProductOfCorrelationsPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18281      }               
18282    // average product of correlations <2>, <4>, <6> and <8> versus multiplicity  
18283    // [0=<<2><4>>,1=<<2><6>>,2=<<2><8>>,3=<<4><6>>,4=<<4><8>>,5=<<6><8>>]  
18284    if(fCalculateCumulantsVsM)
18285    {
18286     TString intFlowProductOfCorrelationsVsMProName = "fIntFlowProductOfCorrelationsVsMPro";
18287     intFlowProductOfCorrelationsVsMProName += fAnalysisLabel->Data();
18288     TString productFlag[6] = {"#LT#LT2#GT#LT4#GT#GT","#LT#LT2#GT#LT6#GT#GT","#LT#LT2#GT#LT8#GT#GT",
18289                               "#LT#LT4#GT#LT6#GT#GT","#LT#LT4#GT#LT8#GT#GT","#LT#LT6#GT#LT8#GT#GT"};
18290     for(Int_t pi=0;pi<6;pi++)
18291     { 
18292      TProfile *intFlowProductOfCorrelationsVsMPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(Form("%s, %s",intFlowProductOfCorrelationsVsMProName.Data(),productFlag[pi].Data())));
18293      if(intFlowProductOfCorrelationsVsMPro)
18294      {
18295       this->SetIntFlowProductOfCorrelationsVsMPro(intFlowProductOfCorrelationsVsMPro,pi);
18296      } else
18297        {
18298         cout<<"WARNING: "<<Form("intFlowProductOfCorrelationsVsMPro[%d]",pi)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18299        }
18300     } // end of for(Int_t pi=0;pi<6;pi++)
18301    } // end of if(fCalculateCumulantsVsM)
18302    // average correction terms for non-uniform acceptance (with wrong errors!):
18303    for(Int_t sc=0;sc<2;sc++)
18304    {
18305     TString intFlowCorrectionTermsForNUAProName = "fIntFlowCorrectionTermsForNUAPro";
18306     intFlowCorrectionTermsForNUAProName += fAnalysisLabel->Data();
18307     TProfile *intFlowCorrectionTermsForNUAPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject((Form("%s: %s terms",intFlowCorrectionTermsForNUAProName.Data(),sinCosFlag[sc].Data()))));
18308     if(intFlowCorrectionTermsForNUAPro) 
18309     {
18310      this->SetIntFlowCorrectionTermsForNUAPro(intFlowCorrectionTermsForNUAPro,sc);
18311     } else 
18312       {
18313        cout<<"WARNING: intFlowCorrectionTermsForNUAPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18314        cout<<"sc = "<<sc<<endl;
18315       } 
18316     // versus multiplicity:
18317     if(fCalculateCumulantsVsM)
18318     {
18319      TString correctionTermFlag[4] = {"(n(phi1))","(n(phi1+phi2))","(n(phi1-phi2-phi3))","(n(2phi1-phi2))"}; // to be improved - hardwired 4
18320      TString intFlowCorrectionTermsForNUAVsMProName = "fIntFlowCorrectionTermsForNUAVsMPro";
18321      intFlowCorrectionTermsForNUAVsMProName += fAnalysisLabel->Data();
18322      for(Int_t ci=0;ci<4;ci++) // correction term index (to be improved - hardwired 4)
18323      {
18324       TProfile *intFlowCorrectionTermsForNUAVsMPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(Form("%s: #LT#LT%s%s#GT#GT",intFlowCorrectionTermsForNUAVsMProName.Data(),sinCosFlag[sc].Data(),correctionTermFlag[ci].Data())));
18325       if(intFlowCorrectionTermsForNUAVsMPro) 
18326       {
18327        this->SetIntFlowCorrectionTermsForNUAVsMPro(intFlowCorrectionTermsForNUAVsMPro,sc,ci);
18328       } else 
18329         {
18330          cout<<"WARNING: intFlowCorrectionTermsForNUAVsMPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18331          cout<<"sc = "<<sc<<endl;
18332          cout<<"ci = "<<ci<<endl;
18333         }       
18334      } // end of for(Int_t ci=0;ci<4;ci++) // correction term index (to be improved - hardwired 4)
18335     } // end of if(fCalculateCumulantsVsM)
18336    } // end of for(Int_t sc=0;sc<2;sc++)           
18337    // average products of correction terms for NUA:  
18338    TString intFlowProductOfCorrectionTermsForNUAProName = "fIntFlowProductOfCorrectionTermsForNUAPro";
18339    intFlowProductOfCorrectionTermsForNUAProName += fAnalysisLabel->Data();
18340    TProfile *intFlowProductOfCorrectionTermsForNUAPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowProductOfCorrectionTermsForNUAProName.Data()));
18341    if(intFlowProductOfCorrectionTermsForNUAPro) 
18342    {
18343     this->SetIntFlowProductOfCorrectionTermsForNUAPro(intFlowProductOfCorrectionTermsForNUAPro);
18344    } else 
18345      {
18346       cout<<"WARNING: intFlowProductOfCorrectionTermsForNUAPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18347      }     
18348   } else // to if(intFlowProfiles)  
18349     {
18350      cout<<"WARNING: intFlowProfiles is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18351     }
18352    
18353   //  d) Get pointer to list fIntFlowResults and pointers to all objects that she holds. 
18354   TList *intFlowResults = NULL;
18355   intFlowResults = dynamic_cast<TList*>(intFlowList->FindObject("Results"));
18356   if(intFlowResults)
18357   {
18358    // average correlations <<2>>, <<4>>, <<6>> and <<8>> (with correct errors!):
18359    TString intFlowCorrelationsHistName = "fIntFlowCorrelationsHist";
18360    intFlowCorrelationsHistName += fAnalysisLabel->Data();
18361    TH1D *intFlowCorrelationsHist = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowCorrelationsHistName.Data()));
18362    if(intFlowCorrelationsHist) 
18363    {
18364     this->SetIntFlowCorrelationsHist(intFlowCorrelationsHist);
18365    } else 
18366      {
18367       cout<<"WARNING: intFlowCorrelationsHist is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18368      } 
18369    // average correlations <<2>>, <<4>>, <<6>> and <<8>> (with correct errors!) vs M:    
18370    if(fCalculateCumulantsVsM)
18371    {
18372     TString intFlowCorrelationsVsMHistName = "fIntFlowCorrelationsVsMHist";
18373     intFlowCorrelationsVsMHistName += fAnalysisLabel->Data();
18374     for(Int_t ci=0;ci<4;ci++) // correlation index
18375     {
18376      TH1D *intFlowCorrelationsVsMHist = dynamic_cast<TH1D*>
18377                                         (intFlowResults->FindObject(Form("%s, %s",intFlowCorrelationsVsMHistName.Data(),correlationFlag[ci].Data())));
18378      if(intFlowCorrelationsVsMHist)
18379      {
18380       this->SetIntFlowCorrelationsVsMHist(intFlowCorrelationsVsMHist,ci);
18381      } else
18382        {
18383         cout<<"WARNING: "<<Form("intFlowCorrelationsVsMHist[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18384        }   
18385     } // end of for(Int_t ci=0;ci<4;ci++) // correlation index   
18386    } // end of if(fCalculateCumulantsVsM)
18387    // average all correlations for integrated flow (with correct errors!):
18388    TString intFlowCorrelationsAllHistName = "fIntFlowCorrelationsAllHist";
18389    intFlowCorrelationsAllHistName += fAnalysisLabel->Data();
18390    TH1D *intFlowCorrelationsAllHist = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowCorrelationsAllHistName.Data()));
18391    if(intFlowCorrelationsAllHist) 
18392    {
18393     this->SetIntFlowCorrelationsAllHist(intFlowCorrelationsAllHist);
18394    } else 
18395      {
18396       cout<<"WARNING: intFlowCorrelationsAllHist is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18397      }  
18398    // average correction terms for non-uniform acceptance (with correct errors!):
18399    TString intFlowCorrectionTermsForNUAHistName = "fIntFlowCorrectionTermsForNUAHist";
18400    intFlowCorrectionTermsForNUAHistName += fAnalysisLabel->Data();
18401    for(Int_t sc=0;sc<2;sc++)
18402    {
18403     TH1D *intFlowCorrectionTermsForNUAHist = dynamic_cast<TH1D*>(intFlowResults->FindObject((Form("%s: %s terms",intFlowCorrectionTermsForNUAHistName.Data(),sinCosFlag[sc].Data()))));
18404     if(intFlowCorrectionTermsForNUAHist) 
18405     {
18406      this->SetIntFlowCorrectionTermsForNUAHist(intFlowCorrectionTermsForNUAHist,sc);
18407     } else 
18408       {
18409        cout<<"WARNING: intFlowCorrectionTermsForNUAHist is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18410        cout<<"sc = "<<sc<<endl;
18411       } 
18412    } // end of for(Int_t sc=0;sc<2;sc++)           
18413    // covariances (multiplied with weight dependent prefactor):
18414    TString intFlowCovariancesName = "fIntFlowCovariances";
18415    intFlowCovariancesName += fAnalysisLabel->Data();
18416    TH1D *intFlowCovariances = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowCovariancesName.Data()));
18417    if(intFlowCovariances) 
18418    {
18419     this->SetIntFlowCovariances(intFlowCovariances); 
18420    } else 
18421      {
18422       cout<<"WARNING: intFlowCovariances is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18423      } 
18424    // sum of linear and quadratic event weights for <2>, <4>, <6> and <8>:
18425    TString intFlowSumOfEventWeightsName = "fIntFlowSumOfEventWeights";
18426    intFlowSumOfEventWeightsName += fAnalysisLabel->Data();
18427    for(Int_t power=0;power<2;power++)
18428    {
18429     TH1D *intFlowSumOfEventWeights = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s: %s",intFlowSumOfEventWeightsName.Data(),powerFlag[power].Data())));
18430     if(intFlowSumOfEventWeights) 
18431     {
18432      this->SetIntFlowSumOfEventWeights(intFlowSumOfEventWeights,power);
18433     } else 
18434       {
18435        cout<<"WARNING: intFlowSumOfEventWeights is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18436        cout<<"power = "<<power<<endl;
18437       }                                   
18438    } // end of for(Int_t power=0;power<2;power++)                                                                  
18439    // sum of products of event weights for correlations <2>, <4>, <6> and <8>:  
18440    TString intFlowSumOfProductOfEventWeightsName = "fIntFlowSumOfProductOfEventWeights";
18441    intFlowSumOfProductOfEventWeightsName += fAnalysisLabel->Data();
18442    TH1D *intFlowSumOfProductOfEventWeights = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowSumOfProductOfEventWeightsName.Data()));
18443    if(intFlowSumOfProductOfEventWeights) 
18444    {
18445     this->SetIntFlowSumOfProductOfEventWeights(intFlowSumOfProductOfEventWeights);
18446    } else 
18447      {
18448       cout<<"WARNING: intFlowSumOfProductOfEventWeights is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18449      } 
18450    // final result for covariances of correlations (multiplied with weight dependent prefactor) versus M
18451    // [0=Cov(2,4),1=Cov(2,6),2=Cov(2,8),3=Cov(4,6),4=Cov(4,8),5=Cov(6,8)]:
18452    if(fCalculateCumulantsVsM)
18453    {
18454     TString intFlowCovariancesVsMName = "fIntFlowCovariancesVsM";
18455     intFlowCovariancesVsMName += fAnalysisLabel->Data();
18456     TString covarianceFlag[6] = {"Cov(<2>,<4>)","Cov(<2>,<6>)","Cov(<2>,<8>)","Cov(<4>,<6>)","Cov(<4>,<8>)","Cov(<6>,<8>)"};
18457     for(Int_t ci=0;ci<6;ci++)
18458     { 
18459      TH1D *intFlowCovariancesVsM = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s, %s",intFlowCovariancesVsMName.Data(),covarianceFlag[ci].Data())));
18460      if(intFlowCovariancesVsM)
18461      {
18462       this->SetIntFlowCovariancesVsM(intFlowCovariancesVsM,ci);
18463      } else
18464        {
18465         cout<<"WARNING: "<<Form("intFlowCovariancesVsM[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18466        }    
18467     } // end of for(Int_t ci=0;ci<6;ci++)
18468    } // end of if(fCalculateCumulantsVsM)
18469    // sum of linear and quadratic event weights for <2>, <4>, <6> and <8> versus multiplicity
18470    // [0=sum{w_{<2>}},1=sum{w_{<4>}},2=sum{w_{<6>}},3=sum{w_{<8>}}][0=linear 1,1=quadratic]:
18471    if(fCalculateCumulantsVsM)
18472    {
18473     TString intFlowSumOfEventWeightsVsMName = "fIntFlowSumOfEventWeightsVsM";
18474     intFlowSumOfEventWeightsVsMName += fAnalysisLabel->Data();
18475     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>}"},
18476                              {"#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}"}};
18477     for(Int_t si=0;si<4;si++)
18478     {
18479      for(Int_t power=0;power<2;power++)
18480      {
18481       TH1D *intFlowSumOfEventWeightsVsM = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s, %s",intFlowSumOfEventWeightsVsMName.Data(),sumFlag[power][si].Data())));
18482       if(intFlowSumOfEventWeightsVsM)
18483       {
18484        this->SetIntFlowSumOfEventWeightsVsM(intFlowSumOfEventWeightsVsM,si,power);
18485       } else
18486         {
18487          cout<<"WARNING: "<<Form("intFlowSumOfEventWeightsVsM[%d][%d]",si,power)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18488         }    
18489      } // end of for(Int_t power=0;power<2;power++)
18490     } // end of for(Int_t si=0;si<4;si++)   
18491    } // end of if(fCalculateCumulantsVsM)
18492    // sum of products of event weights for correlations <2>, <4>, <6> and <8> vs M
18493    // [0=sum{w_{<2>}w_{<4>}},1=sum{w_{<2>}w_{<6>}},2=sum{w_{<2>}w_{<8>}},
18494    //  3=sum{w_{<4>}w_{<6>}},4=sum{w_{<4>}w_{<8>}},5=sum{w_{<6>}w_{<8>}}]:  
18495    if(fCalculateCumulantsVsM)
18496    {
18497     TString intFlowSumOfProductOfEventWeightsVsMName = "fIntFlowSumOfProductOfEventWeightsVsM";
18498     intFlowSumOfProductOfEventWeightsVsMName += fAnalysisLabel->Data();
18499     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>}",
18500                             "#sum_{i=1}^{N} w_{<4>} w_{<6>}","#sum_{i=1}^{N} w_{<4>} w_{<8>}","#sum_{i=1}^{N} w_{<6>} w_{<8>}"}; 
18501     for(Int_t pi=0;pi<6;pi++)
18502     {
18503      TH1D *intFlowSumOfProductOfEventWeightsVsM = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s, %s",intFlowSumOfProductOfEventWeightsVsMName.Data(),sopowFlag[pi].Data())));
18504      if(intFlowSumOfProductOfEventWeightsVsM)
18505      {
18506       this->SetIntFlowSumOfProductOfEventWeightsVsM(intFlowSumOfProductOfEventWeightsVsM,pi);
18507      } else
18508        {
18509         cout<<"WARNING: "<<Form("intFlowSumOfProductOfEventWeightsVsM[%d]",pi)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18510        }
18511     } // end of for(Int_t pi=0;pi<6;pi++)        
18512    } // end of if(fCalculateCumulantsVsM)
18513    // covariances for NUA (multiplied with weight dependent prefactor):
18514    TString intFlowCovariancesNUAName = "fIntFlowCovariancesNUA";
18515    intFlowCovariancesNUAName += fAnalysisLabel->Data();
18516    TH1D *intFlowCovariancesNUA = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowCovariancesNUAName.Data()));
18517    if(intFlowCovariancesNUA) 
18518    {
18519     this->SetIntFlowCovariancesNUA(intFlowCovariancesNUA); 
18520    } else 
18521      {
18522       cout<<"WARNING: intFlowCovariancesNUA is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18523      } 
18524    // sum of linear and quadratic event weights NUA terms:
18525    TString intFlowSumOfEventWeightsNUAName = "fIntFlowSumOfEventWeightsNUA";
18526    intFlowSumOfEventWeightsNUAName += fAnalysisLabel->Data();
18527    for(Int_t sc=0;sc<2;sc++)
18528    {
18529     for(Int_t power=0;power<2;power++)
18530     {
18531      TH1D *intFlowSumOfEventWeightsNUA = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s: %s, %s",intFlowSumOfEventWeightsNUAName.Data(),powerFlag[power].Data(),sinCosFlag[sc].Data())));
18532      if(intFlowSumOfEventWeightsNUA) 
18533      {
18534       this->SetIntFlowSumOfEventWeightsNUA(intFlowSumOfEventWeightsNUA,sc,power);
18535      } else 
18536        {
18537         cout<<"WARNING: intFlowSumOfEventWeightsNUA is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18538         cout<<"sc    = "<<sc<<endl;
18539         cout<<"power = "<<power<<endl;
18540        }                                   
18541     } // end of for(Int_t power=0;power<2;power++)                                                                  
18542    } // end of for(Int_t sc=0;sc<2;sc++)     
18543    // sum of products of event weights for NUA terms:  
18544    TString intFlowSumOfProductOfEventWeightsNUAName = "fIntFlowSumOfProductOfEventWeightsNUA";
18545    intFlowSumOfProductOfEventWeightsNUAName += fAnalysisLabel->Data();
18546    TH1D *intFlowSumOfProductOfEventWeightsNUA = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowSumOfProductOfEventWeightsNUAName.Data()));
18547    if(intFlowSumOfProductOfEventWeightsNUA) 
18548    {
18549     this->SetIntFlowSumOfProductOfEventWeightsNUA(intFlowSumOfProductOfEventWeightsNUA);
18550    } else 
18551      {
18552       cout<<"WARNING: intFlowSumOfProductOfEventWeightsNUA is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18553      } 
18554    // Final results for reference Q-cumulants:
18555    TString intFlowQcumulantsName = "fIntFlowQcumulants";
18556    intFlowQcumulantsName += fAnalysisLabel->Data();
18557    TH1D *intFlowQcumulants = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowQcumulantsName.Data()));
18558    if(intFlowQcumulants) 
18559    {
18560     this->SetIntFlowQcumulants(intFlowQcumulants);
18561    } else 
18562      {
18563       cout<<"WARNING: intFlowQcumulants is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18564      }  
18565    // Final results for reference Q-cumulants rebinned in M:
18566    if(fCalculateCumulantsVsM)
18567    {
18568     TString intFlowQcumulantsRebinnedInMName = "fIntFlowQcumulantsRebinnedInM";
18569     intFlowQcumulantsRebinnedInMName += fAnalysisLabel->Data();
18570     TH1D *intFlowQcumulantsRebinnedInM = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowQcumulantsRebinnedInMName.Data()));
18571     if(intFlowQcumulantsRebinnedInM) 
18572     {
18573      this->SetIntFlowQcumulantsRebinnedInM(intFlowQcumulantsRebinnedInM);
18574     } else 
18575       {
18576        cout<<"WARNING: intFlowQcumulantsRebinnedInM is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18577       }  
18578    } // end of if(fCalculateCumulantsVsM)
18579    // Ratio between error squared: with/without non-isotropic terms:
18580    TString intFlowQcumulantsErrorSquaredRatioName = "fIntFlowQcumulantsErrorSquaredRatio";
18581    intFlowQcumulantsErrorSquaredRatioName += fAnalysisLabel->Data();
18582    TH1D *intFlowQcumulantsErrorSquaredRatio = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowQcumulantsErrorSquaredRatioName.Data()));
18583    if(intFlowQcumulantsErrorSquaredRatio) 
18584    {
18585     this->SetIntFlowQcumulantsErrorSquaredRatio(intFlowQcumulantsErrorSquaredRatio);
18586    } else 
18587      {
18588       cout<<" WARNING: intntFlowQcumulantsErrorSquaredRatio is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18589      }  
18590    // final results for integrated Q-cumulants versus multiplicity:
18591    TString cumulantFlag[4] = {"QC{2}","QC{4}","QC{6}","QC{8}"};
18592    if(fCalculateCumulantsVsM)
18593    {
18594     TString intFlowQcumulantsVsMName = "fIntFlowQcumulantsVsM";
18595     intFlowQcumulantsVsMName += fAnalysisLabel->Data();
18596     for(Int_t co=0;co<4;co++) // cumulant order
18597     {
18598      TH1D *intFlowQcumulantsVsM = dynamic_cast<TH1D*>
18599                                   (intFlowResults->FindObject(Form("%s, %s",intFlowQcumulantsVsMName.Data(),cumulantFlag[co].Data())));
18600      if(intFlowQcumulantsVsM)
18601      {
18602       this->SetIntFlowQcumulantsVsM(intFlowQcumulantsVsM,co);
18603      } else
18604        {
18605         cout<<"WARNING: "<<Form("intFlowQcumulantsVsM[%d]",co)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18606        }
18607     } // end of for(Int_t co=0;co<4;co++) // cumulant order
18608    } // end of if(fCalculateCumulantsVsM)
18609    // Final reference flow estimates from Q-cumulants:
18610    TString intFlowName = "fIntFlow";
18611    intFlowName += fAnalysisLabel->Data();
18612    TH1D *intFlow = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowName.Data()));
18613    if(intFlow) 
18614    {
18615     this->SetIntFlow(intFlow);
18616    } else 
18617      {
18618       cout<<"WARNING: intFlow is NULL in AFAWQC::GPFIFH() !!!!"<<endl; 
18619      } 
18620    // Final reference flow estimates from Q-cumulants vs M rebinned in M:
18621    if(fCalculateCumulantsVsM)
18622    {
18623     TString intFlowRebinnedInMName = "fIntFlowRebinnedInM";
18624     intFlowRebinnedInMName += fAnalysisLabel->Data();
18625     TH1D *intFlowRebinnedInM = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowRebinnedInMName.Data()));
18626     if(intFlowRebinnedInM) 
18627     {
18628      this->SetIntFlowRebinnedInM(intFlowRebinnedInM);
18629     } else 
18630       {
18631        cout<<"WARNING: intFlowRebinnedInM is NULL in AFAWQC::GPFIFH() !!!!"<<endl; 
18632       } 
18633    } // end of if(fCalculateCumulantsVsM)
18634    // integrated flow from Q-cumulants versus multiplicity:
18635    if(fCalculateCumulantsVsM)
18636    {
18637     TString intFlowVsMName = "fIntFlowVsM";
18638     intFlowVsMName += fAnalysisLabel->Data();
18639     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)};
18640     for(Int_t co=0;co<4;co++) // cumulant order
18641     {
18642      TH1D *intFlowVsM = dynamic_cast<TH1D*>
18643                         (intFlowResults->FindObject(Form("%s, %s",intFlowVsMName.Data(),flowFlag[co].Data())));            
18644      if(intFlowVsM)
18645      {
18646       this->SetIntFlowVsM(intFlowVsM,co);
18647      } else
18648        {
18649         cout<<"WARNING: "<<Form("intFlowVsM[%d]",co)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;      
18650        }
18651     } // end of for(Int_t co=0;co<4;co++) // cumulant order
18652    } // end of if(fCalculateCumulantsVsM)
18653    // quantifying detector effects effects to correlations:
18654    TString intFlowDetectorBiasName = "fIntFlowDetectorBias";
18655    intFlowDetectorBiasName += fAnalysisLabel->Data();
18656    TH1D *intFlowDetectorBias = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowDetectorBiasName.Data()));
18657    if(intFlowDetectorBias) 
18658    {
18659     this->SetIntFlowDetectorBias(intFlowDetectorBias);
18660    } else 
18661      {
18662       cout<<"WARNING: intFlowDetectorBias is NULL in AFAWQC::GPFIFH() !!!!"<<endl; 
18663      } 
18664    // quantifying detector effects effects to correlations vs multiplicity:
18665    if(fCalculateCumulantsVsM)
18666    {
18667     TString intFlowDetectorBiasVsMName = "fIntFlowDetectorBiasVsM";
18668     intFlowDetectorBiasVsMName += fAnalysisLabel->Data();
18669     for(Int_t ci=0;ci<4;ci++) // correlation index
18670     {
18671      TH1D *intFlowDetectorBiasVsM = dynamic_cast<TH1D*>
18672                                     (intFlowResults->FindObject(Form("%s for %s",intFlowDetectorBiasVsMName.Data(),cumulantFlag[ci].Data())));
18673      if(intFlowDetectorBiasVsM)
18674      {
18675       this->SetIntFlowDetectorBiasVsM(intFlowDetectorBiasVsM,ci);
18676      } else
18677        {
18678         cout<<"WARNING: "<<Form("intFlowDetectorBiasVsM[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;      
18679        }
18680     } // end of for(Int_t ci=0;ci<4;ci++) // correlation index   
18681    } // end of if(fCalculateCumulantsVsM)
18682   } else // to if(intFlowResults)
18683     {
18684      cout<<"WARNING: intFlowResults is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18685     }
18686     
18687 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForIntFlowHistograms()
18688
18689 //=======================================================================================================================
18690
18691 void AliFlowAnalysisWithQCumulants::GetPointersFor2DDiffFlowHistograms()
18692 {
18693  // Get pointers for 2D differential flow histograms.
18694  //  a) Check pointers used in this method;
18695  //  b) Get pointers to 2D differential flow lists;
18696  //  c) Get pointers to 2D differential flow profiles;
18697  //  d) Get pointers to 2D differential flow histograms. 
18698
18699  // a) Check pointers used in this method:
18700  if(!fDiffFlowList)
18701  { 
18702   printf("\n WARNING (QC): fDiffFlowList is NULL in AFAWQC::GPF2DDFH() !!!!\n");
18703   printf("               Call method GetPointersForDiffFlowHistograms() first.\n\n");
18704   exit(0);
18705  }
18706  if(!fDiffFlowFlags)
18707  { 
18708   printf("\n WARNING (QC): fDiffFlowFlags is NULL in AFAWQC::GPF2DDFH() !!!!\n\n");
18709   printf("               Call method GetPointersForDiffFlowHistograms() first.\n\n");
18710   exit(0);
18711  }
18712  
18713  // b) Get pointers to 2D differential flow lists:
18714  this->SetCalculate2DDiffFlow((Bool_t)fDiffFlowFlags->GetBinContent(5)); // to be improved - hardwired 5
18715  if(!fCalculate2DDiffFlow){return;}
18716  TString typeFlag[2] = {"RP","POI"}; 
18717  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"};
18718  TString differentialCumulantIndex[4] = {"QC{2'}","QC{4'}","QC{6'}","QC{8'}"};  
18719  TString differentialFlowIndex[4] = {"v'{2}","v'{4}","v'{6}","v'{8}"};  
18720  // Base list: 
18721  TString diffFlow2DListName = "2D"; 
18722  diffFlow2DListName += fAnalysisLabel->Data();
18723  fDiffFlow2D = dynamic_cast<TList*>(fDiffFlowList->FindObject(diffFlow2DListName.Data()));
18724  if(!fDiffFlow2D)
18725  { 
18726   printf("\n WARNING (QC): fDiffFlow2D is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18727   exit(0);
18728  }
18729  // Lists holding profiles with 2D correlations: 
18730  TString s2DDiffFlowCorrelationsProListName = "Profiles with 2D correlations"; 
18731  s2DDiffFlowCorrelationsProListName += fAnalysisLabel->Data(); // to be improved
18732  for(Int_t t=0;t<2;t++)
18733  {
18734   f2DDiffFlowCorrelationsProList[t] = dynamic_cast<TList*>(fDiffFlow2D->FindObject(Form("Profiles with 2D correlations (%s)",typeFlag[t].Data())));
18735   if(!f2DDiffFlowCorrelationsProList[t])
18736   { 
18737    printf("\n WARNING (QC): f2DDiffFlowCorrelationsProList[%i] is NULL in AFAWQC::GPF2DFH() !!!!\n\n",t);
18738    exit(0);
18739   }
18740  } // end of for(Int_t t=0;t<2;t++) 
18741  
18742  // c) Get pointers to 2D differential flow profiles:
18743  TString s2DDiffFlowCorrelationsProName = "f2DDiffFlowCorrelationsPro";
18744  s2DDiffFlowCorrelationsProName += fAnalysisLabel->Data();
18745  for(Int_t t=0;t<2;t++) // type: RP or POI
18746  { 
18747   for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18748   {
18749    f2DDiffFlowCorrelationsPro[t][rci] = dynamic_cast<TProfile2D*>(f2DDiffFlowCorrelationsProList[t]->FindObject(Form("%s, %s, %s",s2DDiffFlowCorrelationsProName.Data(),typeFlag[t].Data(),reducedCorrelationIndex[rci].Data())));
18750    if(!f2DDiffFlowCorrelationsPro[t][rci])
18751    {
18752     printf("\n WARNING (QC): f2DDiffFlowCorrelationsPro[%i][%i] is NULL in AFAWQC::GPF2DFH() !!!!\n\n",t,rci);
18753     exit(0);   
18754    } else
18755      {
18756       this->Set2DDiffFlowCorrelationsPro(f2DDiffFlowCorrelationsPro[t][rci],t,rci);
18757      } 
18758   } // end of for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18759  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI 
18760
18761  // d) Get pointers to 2D differential flow histograms: 
18762  TString s2DDiffFlowCumulantsName = "f2DDiffFlowCumulants";
18763  s2DDiffFlowCumulantsName += fAnalysisLabel->Data();
18764  TString s2DDiffFlowName = "f2DDiffFlow";
18765  s2DDiffFlowName += fAnalysisLabel->Data();
18766  for(Int_t t=0;t<2;t++) // type: RP or POI
18767  { 
18768   for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18769   {
18770    // 2D differential cumulants:
18771    f2DDiffFlowCumulants[t][rci] = dynamic_cast<TH2D*>(f2DDiffFlowCorrelationsProList[t]->FindObject(Form("%s, %s, %s",s2DDiffFlowCumulantsName.Data(),typeFlag[t].Data(),differentialCumulantIndex[rci].Data())));
18772    if(!f2DDiffFlowCumulants[t][rci])
18773    {
18774     printf("\n WARNING (QC): f2DDiffFlowCumulants[%i][%i] is NULL in AFAWQC::GPF2DFH() !!!!\n\n",t,rci);
18775     exit(0);   
18776    } else
18777      {
18778       this->Set2DDiffFlowCumulants(f2DDiffFlowCumulants[t][rci],t,rci);
18779      } 
18780    // 2D differential flow:
18781    f2DDiffFlow[t][rci] = dynamic_cast<TH2D*>(f2DDiffFlowCorrelationsProList[t]->FindObject(Form("%s, %s, %s",s2DDiffFlowName.Data(),typeFlag[t].Data(),differentialFlowIndex[rci].Data())));
18782    if(!f2DDiffFlow[t][rci])
18783    {
18784     printf("\n WARNING (QC): f2DDiffFlow[%i][%i] is NULL in AFAWQC::GPF2DFH() !!!!\n\n",t,rci);
18785     exit(0);   
18786    } else
18787      {
18788       this->Set2DDiffFlow(f2DDiffFlow[t][rci],t,rci);
18789      } 
18790   } // end of for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18791  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI 
18792   
18793 } // end of void AliFlowAnalysisWithQCumulants::GetPointersFor2DDiffFlowHistograms()
18794
18795 //=======================================================================================================================
18796
18797 void AliFlowAnalysisWithQCumulants::GetPointersForOtherDiffCorrelators()
18798 {
18799  // Get pointers for other differential correlators.
18800  //  a) Get pointer to list with other differential correlators;
18801  //  b) Declare local flags;
18802  //  c) Get pointers to other differential profiles.
18803
18804  if(!fCalculateDiffFlow){return;} // TBI: This must eventually be moved somewhere else 
18805
18806  // a) Get pointer to list with other differential correlators:
18807  fOtherDiffCorrelatorsList = dynamic_cast<TList*>(fHistList->FindObject("Other differential correlators"));  
18808  if(!fOtherDiffCorrelatorsList)
18809  { 
18810   printf("\n WARNING (QC): fOtherDiffCorrelatorsList is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18811   exit(0);
18812  }
18813  
18814  // b) Declare local flags: // (to be improved - promoted to data members)
18815  TString typeFlag[2] = {"RP","POI"}; 
18816  TString ptEtaFlag[2] = {"p_{T}","#eta"};
18817  TString sinCosFlag[2] = {"sin","cos"}; 
18818   
18819  // c) Get pointers to other differential profiles:
18820  TString otherDiffCorrelatorsName = "fOtherDiffCorrelators";
18821  otherDiffCorrelatorsName += fAnalysisLabel->Data();
18822  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
18823  { 
18824   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18825   {
18826    for(Int_t sc=0;sc<2;sc++) // sin or cos
18827    {
18828     for(Int_t ci=0;ci<1;ci++) // correlator index
18829     {
18830      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))); 
18831      if(!fOtherDiffCorrelators[t][pe][sc][ci])
18832      {
18833       printf("\n WARNING (QC): fOtherDiffCorrelators[%i][%i][%i][%i] is NULL in AFAWQC::GPFODC() !!!!\n\n",t,pe,sc,ci);
18834       exit(0);       
18835      } else
18836        {
18837         this->SetOtherDiffCorrelators(fOtherDiffCorrelators[t][pe][sc][ci],t,pe,sc,ci);     
18838        } 
18839     } // end of for(Int_t ci=0;ci<1;ci++) // correlator index
18840    } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
18841   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
18842  } // end of for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
18843   
18844 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForOtherDiffCorrelators()
18845
18846 //=======================================================================================================================
18847
18848 void AliFlowAnalysisWithQCumulants::GetPointersForDiffFlowHistograms()
18849 {
18850  // Get pointer to all objects relevant for differential flow.
18851  //  a) Get pointer to base list for differential flow fDiffFlowList;
18852  //  b) Get pointer to profile fDiffFlowFlags holding all flags for differential flow. Access and set some flags;
18853  //  c) Get pointers to nested lists fDiffFlowListProfiles and fDiffFlowListResults;
18854  //  d) Define flags locally (to be improved: should I promote these flags to data members?);
18855  //  e) Get pointers to all nested lists in fDiffFlowListProfiles and to profiles which they hold;
18856  //  f) Get pointers to all nested lists in fDiffFlowListResults and to histograms which they hold.
18857  
18858  // a) Get pointer to base list for differential flow fDiffFlowList:
18859  fDiffFlowList = dynamic_cast<TList*>(fHistList->FindObject("Differential Flow"));  
18860  if(!fDiffFlowList)
18861  { 
18862   printf("\n WARNING (QC): fDiffFlowList is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18863   exit(0);
18864  }
18865  
18866  // b) Get pointer to profile fDiffFlowFlags holding all flags for differential flow. Access and set some flags:
18867  TString diffFlowFlagsName = "fDiffFlowFlags";
18868  diffFlowFlagsName += fAnalysisLabel->Data();
18869  fDiffFlowFlags = dynamic_cast<TProfile*>(fDiffFlowList->FindObject(diffFlowFlagsName.Data()));
18870  if(fDiffFlowFlags)
18871  {
18872   this->SetCalculateDiffFlow((Bool_t)fDiffFlowFlags->GetBinContent(1)); // to be improved - hardwired 1
18873   this->SetCalculateDiffFlowVsEta((Bool_t)fDiffFlowFlags->GetBinContent(6)); // to be improved - hardwired 6
18874  } else
18875    {
18876     printf("\n WARNING (QC): fDiffFlowFlags is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18877     printf("\n             Flags in method Finish() are wrong.\n\n");
18878     exit(0);
18879    } 
18880    
18881  if(!fCalculateDiffFlow){return;} // IMPORTANT: do not move this anywhere above in this method (to be improved)   
18882   
18883  // c) Get pointers to nested lists fDiffFlowListProfiles and fDiffFlowListResults:
18884  //  List holding nested lists holding profiles:
18885  TList *diffFlowListProfiles = NULL;
18886  diffFlowListProfiles = dynamic_cast<TList*>(fDiffFlowList->FindObject("Profiles"));
18887  if(!diffFlowListProfiles)
18888  { 
18889   printf("\n WARNING (QC): diffFlowListProfiles is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18890   exit(0);
18891  }
18892  //  List holding nested lists holding histograms with final results:
18893  TList *diffFlowListResults = NULL;
18894  diffFlowListResults = dynamic_cast<TList*>(fDiffFlowList->FindObject("Results"));
18895  if(!diffFlowListResults)
18896  { 
18897   printf("\n WARNING (QC): diffFlowListResults is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18898   exit(0);
18899  }
18900  
18901  // d) Define flags locally (to be improved: should I promote these flags to data members?):
18902  TString typeFlag[2] = {"RP","POI"}; 
18903  TString ptEtaFlag[2] = {"p_{T}","#eta"};
18904  TString powerFlag[2] = {"linear","quadratic"};
18905  TString sinCosFlag[2] = {"sin","cos"};
18906  TString differentialCumulantIndex[4] = {"QC{2'}","QC{4'}","QC{6'}","QC{8'}"};  
18907  TString differentialFlowIndex[4] = {"v'{2}","v'{4}","v'{6}","v'{8}"};  
18908  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"};
18909  TString reducedSquaredCorrelationIndex[4] = {"<2'>^{2}","<4'>^{2}","<6'>^{2}","<8'>^{2}"}; 
18910  TString mixedCorrelationIndex[8] = {"<2>","<2'>","<4>","<4'>","<6>","<6'>","<8>","<8'>"};
18911  TString covarianceName[5] = {"Cov(<2>,<2'>)","Cov(<2>,<4'>)","Cov(<4>,<2'>)","Cov(<4>,<4'>)","Cov(<2'>,<4'>)"}; 
18912   
18913  // e) Get pointers to all nested lists in fDiffFlowListProfiles and to profiles which they hold:
18914  // correlations:
18915  TList *diffFlowCorrelationsProList[2][2] = {{NULL}};
18916  TString diffFlowCorrelationsProName = "fDiffFlowCorrelationsPro";
18917  diffFlowCorrelationsProName += fAnalysisLabel->Data();
18918  TProfile *diffFlowCorrelationsPro[2][2][4] = {{{NULL}}}; 
18919  // squared correlations:  
18920  TString diffFlowSquaredCorrelationsProName = "fDiffFlowSquaredCorrelationsPro";
18921  diffFlowSquaredCorrelationsProName += fAnalysisLabel->Data(); 
18922  TProfile *diffFlowSquaredCorrelationsPro[2][2][4] = {{{NULL}}};  
18923  // products of correlations:
18924  TList *diffFlowProductOfCorrelationsProList[2][2] = {{NULL}};
18925  TString diffFlowProductOfCorrelationsProName = "fDiffFlowProductOfCorrelationsPro";
18926  diffFlowProductOfCorrelationsProName += fAnalysisLabel->Data();  
18927  TProfile *diffFlowProductOfCorrelationsPro[2][2][8][8] = {{{{NULL}}}};   
18928  // corrections:
18929  TList *diffFlowCorrectionsProList[2][2] = {{NULL}};
18930  TString diffFlowCorrectionTermsForNUAProName = "fDiffFlowCorrectionTermsForNUAPro";
18931  diffFlowCorrectionTermsForNUAProName += fAnalysisLabel->Data();  
18932  TProfile *diffFlowCorrectionTermsForNUAPro[2][2][2][10] = {{{{NULL}}}};   
18933  for(Int_t t=0;t<2;t++)
18934  {
18935   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++)
18936   {
18937    diffFlowCorrelationsProList[t][pe] = dynamic_cast<TList*>(diffFlowListProfiles->FindObject(Form("Profiles with correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18938    if(!diffFlowCorrelationsProList[t][pe])
18939    { 
18940     cout<<"WARNING: diffFlowCorrelationsProList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18941     cout<<"t = "<<t<<endl;
18942     cout<<"pe = "<<pe<<endl;
18943     exit(0);
18944    }
18945    for(Int_t ci=0;ci<4;ci++) // correlation index
18946    {
18947     // reduced correlations:
18948     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())));
18949     if(diffFlowCorrelationsPro[t][pe][ci])
18950     {
18951      this->SetDiffFlowCorrelationsPro(diffFlowCorrelationsPro[t][pe][ci],t,pe,ci);
18952     } else
18953       {
18954        cout<<"WARNING: diffFlowCorrelationsPro[t][pe][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18955        cout<<"t  = "<<t<<endl;
18956        cout<<"pe = "<<pe<<endl;   
18957        cout<<"ci = "<<ci<<endl;
18958       }     
18959     // reduced squared correlations:
18960     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())));
18961     if(diffFlowSquaredCorrelationsPro[t][pe][ci])
18962     {
18963      this->SetDiffFlowSquaredCorrelationsPro(diffFlowSquaredCorrelationsPro[t][pe][ci],t,pe,ci);
18964     } else
18965       {
18966        cout<<"WARNING: diffFlowSquaredCorrelationsPro[t][pe][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18967        cout<<"t  = "<<t<<endl;
18968        cout<<"pe = "<<pe<<endl;   
18969        cout<<"ci = "<<ci<<endl;
18970       }       
18971    } // end of for(Int_t ci=0;ci<4;ci++) // correlation index  
18972    // products of correlations:    
18973    diffFlowProductOfCorrelationsProList[t][pe] = dynamic_cast<TList*>(diffFlowListProfiles->FindObject(Form("Profiles with products of correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()))); 
18974    if(!diffFlowProductOfCorrelationsProList[t][pe])
18975    { 
18976     cout<<"WARNING: ddiffFlowProductOfCorrelationsProList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18977     cout<<"t = "<<t<<endl;
18978     cout<<"pe = "<<pe<<endl;
18979     exit(0);
18980    }
18981    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
18982    {
18983     for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
18984     {
18985      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())));
18986      if(diffFlowProductOfCorrelationsPro[t][pe][mci1][mci2])
18987      {
18988       this->SetDiffFlowProductOfCorrelationsPro(diffFlowProductOfCorrelationsPro[t][pe][mci1][mci2],t,pe,mci1,mci2);
18989      } else
18990        {
18991         cout<<"WARNING: diffFlowProductOfCorrelationsPro[t][pe][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18992         cout<<"t    = "<<t<<endl;
18993         cout<<"pe   = "<<pe<<endl;   
18994         cout<<"mci1 = "<<mci1<<endl;
18995         cout<<"mci2 = "<<mci2<<endl;
18996        }
18997      if(mci1%2 == 0) mci2++; // products which DO NOT include reduced correlations are not stored here
18998     } // end of for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
18999    } // end of for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index    
19000    // corrections:
19001    diffFlowCorrectionsProList[t][pe] = dynamic_cast<TList*>(diffFlowListProfiles->FindObject(Form("Profiles with correction terms for NUA (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
19002    if(!diffFlowCorrectionsProList[t][pe])
19003    { 
19004     cout<<"WARNING: diffFlowCorrectionsProList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19005     cout<<"t = "<<t<<endl;
19006     cout<<"pe = "<<pe<<endl;
19007     exit(0);
19008    }
19009    // correction terms for NUA:
19010    for(Int_t sc=0;sc<2;sc++) // sin or cos
19011    {
19012     for(Int_t cti=0;cti<9;cti++) // correction term index
19013     {
19014      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)));
19015      if(diffFlowCorrectionTermsForNUAPro[t][pe][sc][cti])
19016      {
19017       this->SetDiffFlowCorrectionTermsForNUAPro(diffFlowCorrectionTermsForNUAPro[t][pe][sc][cti],t,pe,sc,cti);
19018      } else
19019        {
19020         cout<<"WARNING: diffFlowCorrectionTermsForNUAPro[t][pe][sc][cti] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19021         cout<<"t   = "<<t<<endl;
19022         cout<<"pe  = "<<pe<<endl;   
19023         cout<<"sc  = "<<sc<<endl;
19024         cout<<"cti = "<<cti<<endl;
19025        }    
19026     } // end of for(Int_t cti=0;cti<9;cti++) // correction term index
19027    } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
19028    // ...
19029   } // end of for(Int_t pe=0;pe<2;pe++)
19030  } // end of for(Int_t t=0;t<2;t++)
19031   
19032  // f) Get pointers to all nested lists in fDiffFlowListResults and to histograms which they hold:
19033  // reduced correlations:
19034  TList *diffFlowCorrelationsHistList[2][2] = {{NULL}};
19035  TString diffFlowCorrelationsHistName = "fDiffFlowCorrelationsHist";
19036  diffFlowCorrelationsHistName += fAnalysisLabel->Data();  
19037  TH1D *diffFlowCorrelationsHist[2][2][4] = {{{NULL}}};
19038  // corrections for NUA:
19039  TList *diffFlowCorrectionsHistList[2][2] = {{NULL}};
19040  TString diffFlowCorrectionTermsForNUAHistName = "fDiffFlowCorrectionTermsForNUAHist";
19041  diffFlowCorrectionTermsForNUAHistName += fAnalysisLabel->Data();  
19042  TH1D *diffFlowCorrectionTermsForNUAHist[2][2][2][10] = {{{{NULL}}}};
19043  // differential Q-cumulants:
19044  TList *diffFlowCumulantsHistList[2][2] = {{NULL}};
19045  TString diffFlowCumulantsName = "fDiffFlowCumulants";
19046  diffFlowCumulantsName += fAnalysisLabel->Data();  
19047  TH1D *diffFlowCumulants[2][2][4] = {{{NULL}}};
19048  // detector bias to differential Q-cumulants:
19049  TList *diffFlowDetectorBiasHistList[2][2] = {{NULL}};
19050  TString diffFlowDetectorBiasName = "fDiffFlowDetectorBias";
19051  diffFlowDetectorBiasName += fAnalysisLabel->Data();  
19052  TH1D *diffFlowDetectorBias[2][2][4] = {{{NULL}}}; 
19053  // differential flow estimates from Q-cumulants:
19054  TList *diffFlowHistList[2][2] = {{NULL}};
19055  TString diffFlowName = "fDiffFlow";
19056  diffFlowName += fAnalysisLabel->Data();  
19057  TH1D *diffFlow[2][2][4] = {{{NULL}}};
19058  // differential covariances:
19059  TList *diffFlowCovariancesHistList[2][2] = {{NULL}};
19060  TString diffFlowCovariancesName = "fDiffFlowCovariances";
19061  diffFlowCovariancesName += fAnalysisLabel->Data();  
19062  TH1D *diffFlowCovariances[2][2][5] = {{{NULL}}};
19063  for(Int_t t=0;t<2;t++) // type: RP or POI
19064  { 
19065   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19066   {
19067    // reduced correlations:
19068    diffFlowCorrelationsHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
19069    if(!diffFlowCorrelationsHistList[t][pe])
19070    { 
19071     cout<<"WARNING: diffFlowCorrelationsHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19072     cout<<"t = "<<t<<endl;
19073     cout<<"pe = "<<pe<<endl;
19074     exit(0);
19075    }
19076    for(Int_t index=0;index<4;index++) 
19077    {
19078     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())));
19079     if(diffFlowCorrelationsHist[t][pe][index])
19080     {
19081      this->SetDiffFlowCorrelationsHist(diffFlowCorrelationsHist[t][pe][index],t,pe,index);
19082     } else 
19083       {
19084        cout<<"WARNING: diffFlowCorrelationsHist[t][pe][index] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19085        cout<<"t     = "<<t<<endl;
19086        cout<<"pe    = "<<pe<<endl;
19087        cout<<"index = "<<index<<endl;
19088        exit(0);       
19089       } 
19090    } // end of for(Int_t index=0;index<4;index++)
19091    // corrections:
19092    diffFlowCorrectionsHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Histograms with correction terms for NUA (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
19093    if(!diffFlowCorrectionsHistList[t][pe])
19094    { 
19095     cout<<"WARNING: diffFlowCorrectionsHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19096     cout<<"t = "<<t<<endl;
19097     cout<<"pe = "<<pe<<endl;
19098     exit(0);
19099    }
19100    // correction terms for NUA:
19101    for(Int_t sc=0;sc<2;sc++) // sin or cos
19102    {
19103     for(Int_t cti=0;cti<9;cti++) // correction term index
19104     {
19105      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)));
19106      if(diffFlowCorrectionTermsForNUAHist[t][pe][sc][cti])
19107      {
19108       this->SetDiffFlowCorrectionTermsForNUAHist(diffFlowCorrectionTermsForNUAHist[t][pe][sc][cti],t,pe,sc,cti);
19109      } else
19110        {
19111         cout<<"WARNING: diffFlowCorrectionTermsForNUAHist[t][pe][sc][cti] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19112         cout<<"t   = "<<t<<endl;
19113         cout<<"pe  = "<<pe<<endl;   
19114         cout<<"sc  = "<<sc<<endl;
19115         cout<<"cti = "<<cti<<endl;
19116        }    
19117     } // end of for(Int_t cti=0;cti<9;cti++) // correction term index
19118    } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
19119    // ...
19120    // differential Q-cumulants:
19121    diffFlowCumulantsHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Differential Q-cumulants (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
19122    if(!diffFlowCumulantsHistList[t][pe])
19123    { 
19124     cout<<"WARNING: diffFlowCumulantsHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19125     cout<<"t  = "<<t<<endl;
19126     cout<<"pe = "<<pe<<endl;
19127     exit(0);
19128    }
19129    for(Int_t index=0;index<4;index++) 
19130    {
19131     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())));
19132     if(diffFlowCumulants[t][pe][index])
19133     {
19134      this->SetDiffFlowCumulants(diffFlowCumulants[t][pe][index],t,pe,index);
19135     } else 
19136       {
19137        cout<<"WARNING: diffFlowCumulants[t][pe][index] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19138        cout<<"t     = "<<t<<endl;
19139        cout<<"pe    = "<<pe<<endl;
19140        cout<<"index = "<<index<<endl;
19141        exit(0);       
19142       } 
19143    } // end of for(Int_t index=0;index<4;index++)
19144    // Detector bias to differential Q-cumulants:
19145    diffFlowDetectorBiasHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Detector bias (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
19146    if(!diffFlowDetectorBiasHistList[t][pe])
19147    { 
19148     cout<<"WARNING: diffFlowDetectorBiasHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19149     cout<<"t  = "<<t<<endl;
19150     cout<<"pe = "<<pe<<endl;
19151     exit(0);
19152    }
19153    for(Int_t index=0;index<4;index++) 
19154    {
19155     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())));
19156     if(diffFlowDetectorBias[t][pe][index])
19157     {
19158      this->SetDiffFlowDetectorBias(diffFlowDetectorBias[t][pe][index],t,pe,index);
19159     } else 
19160       {
19161        cout<<"WARNING: diffFlowDetectorBias[t][pe][index] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19162        cout<<"t     = "<<t<<endl;
19163        cout<<"pe    = "<<pe<<endl;
19164        cout<<"index = "<<index<<endl;
19165        exit(0);       
19166       } 
19167    } // end of for(Int_t index=0;index<4;index++)
19168    // differential flow estimates from Q-cumulants:
19169    diffFlowHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Differential flow (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
19170    if(!diffFlowHistList[t][pe])
19171    { 
19172     cout<<"WARNING: diffFlowHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19173     cout<<"t  = "<<t<<endl;
19174     cout<<"pe = "<<pe<<endl;
19175     exit(0);
19176    }
19177    for(Int_t index=0;index<4;index++) 
19178    {
19179     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())));
19180     if(diffFlow[t][pe][index])
19181     {
19182      this->SetDiffFlow(diffFlow[t][pe][index],t,pe,index);
19183     } else 
19184       {
19185        cout<<"WARNING: diffFlow[t][pe][index] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19186        cout<<"t     = "<<t<<endl;
19187        cout<<"pe    = "<<pe<<endl;
19188        cout<<"index = "<<index<<endl;
19189        exit(0);       
19190       } 
19191    } // end of for(Int_t index=0;index<4;index++)
19192    // differential covariances:
19193    diffFlowCovariancesHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Covariances of correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
19194    if(!diffFlowCovariancesHistList[t][pe])
19195    { 
19196     cout<<"WARNING: diffFlowCovariancesHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19197     cout<<"t  = "<<t<<endl;
19198     cout<<"pe = "<<pe<<endl;
19199     exit(0);
19200    }
19201    for(Int_t covIndex=0;covIndex<5;covIndex++) 
19202    {
19203     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())));
19204     if(diffFlowCovariances[t][pe][covIndex])
19205     {
19206      this->SetDiffFlowCovariances(diffFlowCovariances[t][pe][covIndex],t,pe,covIndex);
19207     } else 
19208       {
19209        cout<<"WARNING: diffFlowCovariances[t][pe][covIndex] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19210        cout<<"t        = "<<t<<endl;
19211        cout<<"pe       = "<<pe<<endl;
19212        cout<<"covIndex = "<<covIndex<<endl;
19213        exit(0);       
19214       } 
19215    } // end of for(Int_t covIndex=0;covIndex<5;covIndex++) // covariance index    
19216   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
19217  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI 
19218  // sum of event weights for reduced correlations:
19219  TList *diffFlowSumOfEventWeightsHistList[2][2][2] = {{{NULL}}};
19220  TString diffFlowSumOfEventWeightsName = "fDiffFlowSumOfEventWeights";
19221  diffFlowSumOfEventWeightsName += fAnalysisLabel->Data();  
19222  TH1D *diffFlowSumOfEventWeights[2][2][2][4] = {{{{NULL}}}};
19223  for(Int_t t=0;t<2;t++) // type is RP or POI
19224  { 
19225   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19226   { 
19227    for(Int_t p=0;p<2;p++) // power of event weights is either 1 or 2
19228    {
19229     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())));
19230     if(!diffFlowSumOfEventWeightsHistList[t][pe][p])
19231     { 
19232      cout<<"WARNING: diffFlowSumOfEventWeightsHistList[t][pe][p] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19233      cout<<"t     = "<<t<<endl;
19234      cout<<"pe    = "<<pe<<endl;
19235      cout<<"power = "<<p<<endl;
19236      exit(0);
19237     }
19238     for(Int_t ew=0;ew<4;ew++) // index of reduced correlation
19239     {
19240      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())));    
19241      if(diffFlowSumOfEventWeights[t][pe][p][ew])
19242      {
19243       this->SetDiffFlowSumOfEventWeights(diffFlowSumOfEventWeights[t][pe][p][ew],t,pe,p,ew);
19244      } else 
19245        {
19246         cout<<"WARNING: diffFlowSumOfEventWeights[t][pe][p][ew] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19247         cout<<"t     = "<<t<<endl;
19248         cout<<"pe    = "<<pe<<endl;
19249         cout<<"power = "<<p<<endl;
19250         cout<<"ew    = "<<ew<<endl;
19251         exit(0);       
19252        } 
19253     }
19254    } // end of for(Int_t p=0;p<2;p++) // power of event weights is either 1 or 2
19255   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
19256  } // end of for(Int_t t=0;t<2;t++) // type is RP or POI
19257  //  
19258  TList *diffFlowSumOfProductOfEventWeightsHistList[2][2] = {{NULL}};
19259  TString diffFlowSumOfProductOfEventWeightsName = "fDiffFlowSumOfProductOfEventWeights";
19260  diffFlowSumOfProductOfEventWeightsName += fAnalysisLabel->Data();  
19261  TH1D *diffFlowSumOfProductOfEventWeights[2][2][8][8] = {{{{NULL}}}};
19262  for(Int_t t=0;t<2;t++) // type is RP or POI
19263  { 
19264   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19265   { 
19266    diffFlowSumOfProductOfEventWeightsHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Sum of products of event weights (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
19267    if(!diffFlowSumOfProductOfEventWeightsHistList[t][pe])
19268    { 
19269     cout<<"WARNING: diffFlowSumOfProductOfEventWeightsHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19270     cout<<"t     = "<<t<<endl;
19271     cout<<"pe    = "<<pe<<endl;
19272     exit(0);
19273    }
19274    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
19275    {
19276     for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
19277     {
19278      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())));    
19279       if(diffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2])
19280       {
19281        this->SetDiffFlowSumOfProductOfEventWeights(diffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2],t,pe,mci1,mci2);
19282       } else 
19283         {
19284          cout<<"WARNING: diffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19285          cout<<"t    = "<<t<<endl;
19286          cout<<"pe   = "<<pe<<endl;
19287          cout<<"mci1 = "<<mci1<<endl;
19288          cout<<"mci2 = "<<mci2<<endl;
19289          exit(0);       
19290         } 
19291      if(mci1%2 == 0) mci2++; // products which DO NOT include reduced correlations are not stored here
19292     } // end of for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
19293    } // end of for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
19294   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
19295  } // end of for(Int_t t=0;t<2;t++) // type is RP or POI
19296
19297 } // end void AliFlowAnalysisWithQCumulants::GetPointersForDiffFlowHistograms()
19298
19299 //=======================================================================================================================
19300
19301 void AliFlowAnalysisWithQCumulants::BookEverythingFor2DDifferentialFlow()
19302 {
19303  // Book all objects needed for 2D differential flow.
19304  //  a) Define flags locally (to be improved: should I promote flags to data members?);
19305  //  b) Book e-b-e quantities;
19306  //  c) Book 2D profiles;
19307  //  d) Book 2D histograms.
19308  
19309  if(!fCalculate2DDiffFlow){return;}
19310
19311  // a) Define flags locally (to be improved: should I promote flags to data members?):
19312  TString typeFlag[2] = {"RP","POI"}; 
19313  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"};
19314  TString differentialCumulantIndex[4] = {"QC{2'}","QC{4'}","QC{6'}","QC{8'}"};  
19315  TString differentialFlowIndex[4] = {"v'{2}","v'{4}","v'{6}","v'{8}"};  
19316   
19317  // b) Book e-b-e quantities: 
19318  TProfile2D styleRe("typeMultiplePowerRe","typeMultiplePowerRe",fnBinsPt,fPtMin,fPtMax,fnBinsEta,fEtaMin,fEtaMax);
19319  TProfile2D styleIm("typeMultiplePowerIm","typeMultiplePowerIm",fnBinsPt,fPtMin,fPtMax,fnBinsEta,fEtaMin,fEtaMax);
19320  for(Int_t t=0;t<3;t++) // typeFlag (0 = RP, 1 = POI, 2 = RP&&POI )
19321  { 
19322   for(Int_t m=0;m<4;m++)
19323   {
19324    for(Int_t k=0;k<9;k++)
19325    {
19326     fReRPQ2dEBE[t][m][k] = (TProfile2D*)styleRe.Clone(Form("typeFlag%dmultiple%dpower%dRe",t,m,k)); 
19327     fImRPQ2dEBE[t][m][k] = (TProfile2D*)styleIm.Clone(Form("typeFlag%dmultiple%dpower%dIm",t,m,k));
19328    }
19329   } 
19330  } 
19331  TProfile2D styleS("typePower","typePower",fnBinsPt,fPtMin,fPtMax,fnBinsEta,fEtaMin,fEtaMax);
19332  for(Int_t t=0;t<3;t++) // typeFlag (0 = RP, 1 = POI, 2 = RP&&POI )
19333  { 
19334   for(Int_t k=0;k<9;k++)
19335   {
19336    fs2dEBE[t][k] = (TProfile2D*)styleS.Clone(Form("typeFlag%dpower%d",t,k));
19337   }
19338  }
19339
19340  // c) Book 2D profiles:
19341  TString s2DDiffFlowCorrelationsProName = "f2DDiffFlowCorrelationsPro";
19342  s2DDiffFlowCorrelationsProName += fAnalysisLabel->Data();
19343  for(Int_t t=0;t<2;t++) // type: RP or POI
19344  { 
19345   for(Int_t rci=0;rci<4;rci++) // reduced correlation index
19346   {
19347    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,"");
19348    f2DDiffFlowCorrelationsPro[t][rci]->Sumw2();
19349    f2DDiffFlowCorrelationsPro[t][rci]->SetXTitle("p_{t}");
19350    f2DDiffFlowCorrelationsPro[t][rci]->SetYTitle("#eta");
19351    f2DDiffFlowCorrelationsProList[t]->Add(f2DDiffFlowCorrelationsPro[t][rci]); 
19352   } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
19353  } // end of for(Int_t t=0;t<2;t++) // type: RP or POIs
19354
19355  // d) Book 2D histograms:
19356  TString s2DDiffFlowCumulantsName = "f2DDiffFlowCumulants";
19357  s2DDiffFlowCumulantsName += fAnalysisLabel->Data();
19358  TString s2DDiffFlowName = "f2DDiffFlow";
19359  s2DDiffFlowName += fAnalysisLabel->Data();
19360  for(Int_t t=0;t<2;t++) // type: RP or POI
19361  { 
19362   for(Int_t rci=0;rci<4;rci++) // reduced correlation index
19363   {
19364    // 2D diferential cumulants:
19365    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);
19366    f2DDiffFlowCumulants[t][rci]->SetXTitle("p_{t}");
19367    f2DDiffFlowCumulants[t][rci]->SetYTitle("#eta");
19368    f2DDiffFlowCorrelationsProList[t]->Add(f2DDiffFlowCumulants[t][rci]); //  to be improved - moved to another list 
19369    // 2D differential flow:
19370    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);
19371    f2DDiffFlow[t][rci]->SetXTitle("p_{t}");
19372    f2DDiffFlow[t][rci]->SetYTitle("#eta");
19373    f2DDiffFlowCorrelationsProList[t]->Add(f2DDiffFlow[t][rci]); //  to be improved - moved to another list 
19374   } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
19375  } // end of for(Int_t t=0;t<2;t++) // type: RP or POIs
19376
19377 } // void AliFlowAnalysisWithQCumulants::BookEverythingFor2DDifferentialFlow()
19378
19379 //=======================================================================================================================
19380
19381 void AliFlowAnalysisWithQCumulants::BookEverythingForDifferentialFlow()
19382 {
19383  // Book all histograms and profiles needed for differential flow.
19384  //  a) Book profile to hold all flags for differential flow;
19385  //  b) Define flags locally (to be improved: should I promote flags to data members?);
19386  //  c) Book e-b-e quantities;
19387  //  d) Book profiles;
19388  //  e) Book histograms holding final results. 
19389  
19390  // a) Book profile to hold all flags for differential flow:
19391  TString diffFlowFlagsName = "fDiffFlowFlags";
19392  diffFlowFlagsName += fAnalysisLabel->Data();
19393  fDiffFlowFlags = new TProfile(diffFlowFlagsName.Data(),"Flags for differential flow",6,0,6);
19394  fDiffFlowFlags->SetTickLength(-0.01,"Y");
19395  fDiffFlowFlags->SetMarkerStyle(25);
19396  fDiffFlowFlags->SetLabelSize(0.04,"X");
19397  fDiffFlowFlags->SetLabelOffset(0.02,"Y");
19398  fDiffFlowFlags->SetStats(kFALSE);
19399  fDiffFlowFlags->GetXaxis()->SetBinLabel(1,"Calculate diff. flow"); 
19400  fDiffFlowFlags->GetXaxis()->SetBinLabel(2,"Particle weights");
19401  fDiffFlowFlags->GetXaxis()->SetBinLabel(3,"Event weights");
19402  fDiffFlowFlags->GetXaxis()->SetBinLabel(4,"Correct for NUA");
19403  fDiffFlowFlags->GetXaxis()->SetBinLabel(5,"Calculate 2D diff. flow");
19404  fDiffFlowFlags->GetXaxis()->SetBinLabel(6,"Calculate diff. flow vs eta");
19405  fDiffFlowList->Add(fDiffFlowFlags);
19406
19407  if(!fCalculateDiffFlow){return;}
19408   
19409  // b) Define flags locally (to be improved: should I promote flags to data members?): 
19410  TString typeFlag[2] = {"RP","POI"}; 
19411  TString ptEtaFlag[2] = {"p_{T}","#eta"};
19412  TString powerFlag[2] = {"linear","quadratic"};
19413  TString sinCosFlag[2] = {"sin","cos"};
19414  TString differentialCumulantIndex[4] = {"QC{2'}","QC{4'}","QC{6'}","QC{8'}"};  
19415  TString differentialFlowIndex[4] = {"v'{2}","v'{4}","v'{6}","v'{8}"};  
19416  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"};
19417  TString reducedSquaredCorrelationIndex[4] = {"<2'>^{2}","<4'>^{2}","<6'>^{2}","<8'>^{2}"};
19418  TString mixedCorrelationIndex[8] = {"<2>","<2'>","<4>","<4'>","<6>","<6'>","<8>","<8'>"};
19419  TString covarianceName[5] = {"Cov(<2>,<2'>)","Cov(<2>,<4'>)","Cov(<4>,<2'>)","Cov(<4>,<4'>)","Cov(<2'>,<4'>)"}; 
19420  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
19421  Double_t minPtEta[2] = {fPtMin,fEtaMin};
19422  Double_t maxPtEta[2] = {fPtMax,fEtaMax};
19423    
19424  // c) Book e-b-e quantities:
19425  // Event-by-event r_{m*n,k}(pt,eta), p_{m*n,k}(pt,eta) and q_{m*n,k}(pt,eta)
19426  // Explanantion of notation:
19427  //  1.) n is harmonic, m is multiple of harmonic;
19428  //  2.) k is power of particle weight;
19429  //  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);   
19430  //  4.) p_{m*n,k}(pt,eta) = Q-vector evaluated in harmonic m*n for POIs in particular (pt,eta) bin 
19431  //                          (if i-th POI is also RP, than it is weighted with w_i^k);   
19432  //  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 
19433  //                          (i-th RP&&POI is weighted with w_i^k)            
19434   
19435  // 1D:
19436  for(Int_t t=0;t<3;t++) // typeFlag (0 = RP, 1 = POI, 2 = RP && POI )
19437  { 
19438   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19439   {
19440    for(Int_t m=0;m<4;m++) // multiple of harmonic
19441    {
19442     for(Int_t k=0;k<9;k++) // power of particle weight
19443     {
19444      fReRPQ1dEBE[t][pe][m][k] = new TProfile(Form("TypeFlag%dpteta%dmultiple%dpower%dRe",t,pe,m,k),
19445                                              Form("TypeFlag%dpteta%dmultiple%dpower%dRe",t,pe,m,k),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
19446      fImRPQ1dEBE[t][pe][m][k] = new TProfile(Form("TypeFlag%dpteta%dmultiple%dpower%dIm",t,pe,m,k),
19447                                              Form("TypeFlag%dpteta%dmultiple%dpower%dIm",t,pe,m,k),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
19448     }
19449    }
19450   }
19451  } 
19452  // to be improved (add explanation of fs1dEBE[t][pe][k]):   
19453  for(Int_t t=0;t<3;t++) // typeFlag (0 = RP, 1 = POI, 2 = RP&&POI )
19454  { 
19455   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19456   {
19457    for(Int_t k=0;k<9;k++) // power of particle weight
19458    {
19459     fs1dEBE[t][pe][k] = new TProfile(Form("TypeFlag%dpteta%dmultiple%d",t,pe,k),
19460                                      Form("TypeFlag%dpteta%dmultiple%d",t,pe,k),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
19461    }
19462   }
19463  }
19464  // correction terms for nua:
19465  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
19466  { 
19467   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19468   {
19469    for(Int_t sc=0;sc<2;sc++) // sin or cos
19470    {
19471     for(Int_t cti=0;cti<9;cti++) // correction term index
19472     {
19473      fDiffFlowCorrectionTermsForNUAEBE[t][pe][sc][cti] = new TH1D(Form("typeFlag%d pteta%d sincos%d cti%d",t,pe,sc,cti),
19474                                              Form("typeFlag%d pteta%d sincos%d cti%d",t,pe,sc,cti),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
19475     }
19476    }
19477   }
19478  } 
19479  // reduced correlations e-b-e:
19480  TString diffFlowCorrelationsEBEName = "fDiffFlowCorrelationsEBE";
19481  diffFlowCorrelationsEBEName += fAnalysisLabel->Data();
19482  for(Int_t t=0;t<2;t++) // type: RP or POI
19483  { 
19484   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19485   {
19486    for(Int_t rci=0;rci<4;rci++) // reduced correlation index
19487    {
19488     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]);
19489    } // end of for(Int_t ci=0;ci<4;ci++) // correlation index
19490   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
19491  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
19492  // event weights for reduced correlations e-b-e:
19493  TString diffFlowEventWeightsForCorrelationsEBEName = "fDiffFlowEventWeightsForCorrelationsEBE";
19494  diffFlowEventWeightsForCorrelationsEBEName += fAnalysisLabel->Data();
19495  for(Int_t t=0;t<2;t++) // type: RP or POI
19496  { 
19497   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19498   {
19499    for(Int_t rci=0;rci<4;rci++) // event weight for reduced correlation index
19500    {
19501     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]);
19502    } // end of for(Int_t ci=0;ci<4;ci++) // correlation index
19503   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
19504  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
19505       
19506  // d) Book profiles;
19507  // reduced correlations:
19508  TString diffFlowCorrelationsProName = "fDiffFlowCorrelationsPro";
19509  diffFlowCorrelationsProName += fAnalysisLabel->Data();
19510  // reduced squared correlations:
19511  TString diffFlowSquaredCorrelationsProName = "fDiffFlowSquaredCorrelationsPro";
19512  diffFlowSquaredCorrelationsProName += fAnalysisLabel->Data();
19513  // corrections terms:
19514  TString diffFlowCorrectionTermsForNUAProName = "fDiffFlowCorrectionTermsForNUAPro";
19515  diffFlowCorrectionTermsForNUAProName += fAnalysisLabel->Data();
19516  // reduced correlations:
19517  for(Int_t t=0;t<2;t++) // type: RP or POI
19518  { 
19519   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19520   {
19521    for(Int_t rci=0;rci<4;rci++) // reduced correlation index
19522    {
19523     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");
19524     fDiffFlowCorrelationsPro[t][pe][rci]->Sumw2();
19525     fDiffFlowCorrelationsPro[t][pe][rci]->SetXTitle(ptEtaFlag[pe].Data());
19526     fDiffFlowCorrelationsProList[t][pe]->Add(fDiffFlowCorrelationsPro[t][pe][rci]); // to be improved (add dedicated list to hold reduced correlations)
19527    } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
19528   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
19529  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
19530  // reduced squared correlations:
19531  for(Int_t t=0;t<2;t++) // type: RP or POI
19532  { 
19533   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19534   {
19535    for(Int_t rci=0;rci<4;rci++) // reduced correlation index
19536    {
19537     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");
19538     fDiffFlowSquaredCorrelationsPro[t][pe][rci]->Sumw2();
19539     fDiffFlowSquaredCorrelationsPro[t][pe][rci]->SetXTitle(ptEtaFlag[pe].Data());
19540     fDiffFlowCorrelationsProList[t][pe]->Add(fDiffFlowSquaredCorrelationsPro[t][pe][rci]); // to be improved (add dedicated list to hold reduced correlations)
19541    } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
19542   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
19543  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
19544  // correction terms for nua:
19545  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
19546  { 
19547   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19548   {
19549    for(Int_t sc=0;sc<2;sc++) // sin or cos
19550    {
19551     for(Int_t cti=0;cti<9;cti++) // correction term index
19552     {
19553      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]); 
19554      fDiffFlowCorrectionsProList[t][pe]->Add(fDiffFlowCorrectionTermsForNUAPro[t][pe][sc][cti]);
19555     }
19556    }
19557   }
19558  } 
19559  // Other differential correlators:
19560  TString otherDiffCorrelatorsName = "fOtherDiffCorrelators";
19561  otherDiffCorrelatorsName += fAnalysisLabel->Data();
19562  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
19563  { 
19564   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19565   {
19566    for(Int_t sc=0;sc<2;sc++) // sin or cos
19567    {
19568     for(Int_t ci=0;ci<1;ci++) // correlator index
19569     {
19570      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]); 
19571      fOtherDiffCorrelators[t][pe][sc][ci]->Sumw2();
19572      fOtherDiffCorrelatorsList->Add(fOtherDiffCorrelators[t][pe][sc][ci]);
19573     }
19574    }
19575   }
19576  }  
19577  // e) Book histograms holding final results. 
19578  // reduced correlations:
19579  TString diffFlowCorrelationsHistName = "fDiffFlowCorrelationsHist";
19580  diffFlowCorrelationsHistName += fAnalysisLabel->Data();
19581  // corrections terms:
19582  TString diffFlowCorrectionTermsForNUAHistName = "fDiffFlowCorrectionTermsForNUAHist";
19583  diffFlowCorrectionTermsForNUAHistName += fAnalysisLabel->Data();
19584  // differential covariances:
19585  TString diffFlowCovariancesName = "fDiffFlowCovariances";
19586  diffFlowCovariancesName += fAnalysisLabel->Data();
19587  // differential Q-cumulants:
19588  TString diffFlowCumulantsName = "fDiffFlowCumulants";
19589  diffFlowCumulantsName += fAnalysisLabel->Data();
19590  // Detector bias to differential Q-cumulants:
19591  TString diffFlowDetectorBiasName = "fDiffFlowDetectorBias";
19592  diffFlowDetectorBiasName += fAnalysisLabel->Data();
19593  // differential flow:
19594  TString diffFlowName = "fDiffFlow";
19595  diffFlowName += fAnalysisLabel->Data();
19596  for(Int_t t=0;t<2;t++) // type: RP or POI
19597  { 
19598   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19599   {
19600    for(Int_t index=0;index<4;index++) 
19601    {
19602     // reduced correlations:
19603     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]);
19604     fDiffFlowCorrelationsHist[t][pe][index]->SetXTitle(ptEtaFlag[pe].Data());
19605     fDiffFlowCorrelationsHistList[t][pe]->Add(fDiffFlowCorrelationsHist[t][pe][index]); 
19606     // differential Q-cumulants:
19607     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]);
19608     fDiffFlowCumulants[t][pe][index]->SetXTitle(ptEtaFlag[pe].Data());
19609     fDiffFlowCumulantsHistList[t][pe]->Add(fDiffFlowCumulants[t][pe][index]); 
19610     // Detector bias to differential Q-cumulants:
19611     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]);
19612     fDiffFlowDetectorBias[t][pe][index]->SetXTitle(ptEtaFlag[pe].Data());
19613     fDiffFlowDetectorBias[t][pe][index]->SetTitle(Form("#frac{corrected}{measured} %s",differentialCumulantIndex[index].Data()));
19614     fDiffFlowDetectorBiasHistList[t][pe]->Add(fDiffFlowDetectorBias[t][pe][index]); 
19615     // differential flow estimates from Q-cumulants:
19616     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]);
19617     fDiffFlow[t][pe][index]->SetXTitle(ptEtaFlag[pe].Data());
19618     fDiffFlowHistList[t][pe]->Add(fDiffFlow[t][pe][index]); 
19619    } // end of for(Int_t index=0;index<4;index++) 
19620    for(Int_t covIndex=0;covIndex<5;covIndex++) // covariance index 
19621    {
19622     // differential covariances:
19623     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]);
19624     fDiffFlowCovariances[t][pe][covIndex]->SetXTitle(ptEtaFlag[pe].Data());
19625     fDiffFlowCovariancesHistList[t][pe]->Add(fDiffFlowCovariances[t][pe][covIndex]); 
19626    } // end of for(Int_t covIndex=0;covIndex<5;covIndex++) // covariance index
19627    // products of both types of correlations: 
19628    TString diffFlowProductOfCorrelationsProName = "fDiffFlowProductOfCorrelationsPro";
19629    diffFlowProductOfCorrelationsProName += fAnalysisLabel->Data();  
19630    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
19631    {
19632     for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
19633     {
19634      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]); 
19635      fDiffFlowProductOfCorrelationsPro[t][pe][mci1][mci2]->SetXTitle(ptEtaFlag[pe].Data());
19636      fDiffFlowProductOfCorrelationsProList[t][pe]->Add(fDiffFlowProductOfCorrelationsPro[t][pe][mci1][mci2]); 
19637      if(mci1%2 == 0) mci2++; // products which DO NOT include reduced correlations are not stored here
19638     } // end of for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
19639    } // end of for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index    
19640   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
19641  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
19642  // sums of event weights for reduced correlations: 
19643  TString diffFlowSumOfEventWeightsName = "fDiffFlowSumOfEventWeights";
19644  diffFlowSumOfEventWeightsName += fAnalysisLabel->Data();  
19645  for(Int_t t=0;t<2;t++) // type is RP or POI
19646  { 
19647   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19648   { 
19649    for(Int_t p=0;p<2;p++) // power of weights is either 1 or 2
19650    {
19651     for(Int_t ew=0;ew<4;ew++) // index of reduced correlation
19652     {
19653      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]); 
19654      fDiffFlowSumOfEventWeights[t][pe][p][ew]->SetXTitle(ptEtaFlag[pe].Data());
19655      fDiffFlowSumOfEventWeightsHistList[t][pe][p]->Add(fDiffFlowSumOfEventWeights[t][pe][p][ew]); // to be improved (add dedicated list to hold all this)
19656     }
19657    }
19658   }
19659  } 
19660  // sum of products of event weights for both types of correlations: 
19661  TString diffFlowSumOfProductOfEventWeightsName = "fDiffFlowSumOfProductOfEventWeights";
19662  diffFlowSumOfProductOfEventWeightsName += fAnalysisLabel->Data();  
19663  for(Int_t t=0;t<2;t++) // type is RP or POI
19664  {
19665   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19666   { 
19667    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
19668    {
19669     for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
19670     {
19671      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]); 
19672      fDiffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2]->SetXTitle(ptEtaFlag[pe].Data());
19673      fDiffFlowSumOfProductOfEventWeightsHistList[t][pe]->Add(fDiffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2]); 
19674      if(mci1%2 == 0) mci2++; // products which DO NOT include reduced correlations are not stored here
19675     }
19676    }
19677   }
19678  } 
19679  // correction terms for nua:
19680  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
19681  { 
19682   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19683   {
19684    for(Int_t sc=0;sc<2;sc++) // sin or cos
19685    {
19686     for(Int_t cti=0;cti<9;cti++) // correction term index
19687     {
19688      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]); 
19689      fDiffFlowCorrectionsHistList[t][pe]->Add(fDiffFlowCorrectionTermsForNUAHist[t][pe][sc][cti]);
19690     }
19691    }
19692   }
19693  } 
19694           
19695 } // end of AliFlowAnalysisWithQCumulants::BookEverythingForDifferentialFlow()
19696
19697 //=======================================================================================================================
19698
19699 void AliFlowAnalysisWithQCumulants::CalculateQcumulantsCorrectedForNUAIntFlow()
19700 {
19701  // Calculate generalized Q-cumulants (cumulants corrected for non-unifom acceptance).
19702  
19703  // Isotropic cumulants:
19704  Double_t QC2 = fIntFlowQcumulants->GetBinContent(1);
19705  Double_t QC2Error = fIntFlowQcumulants->GetBinError(1);
19706  Double_t QC4 = fIntFlowQcumulants->GetBinContent(2);
19707  Double_t QC4Error = fIntFlowQcumulants->GetBinError(2);
19708  //Double_t QC6 = fIntFlowQcumulants->GetBinContent(3);
19709  //Double_t QC6Error = fIntFlowQcumulants->GetBinError(3);
19710  //Double_t QC8 = fIntFlowQcumulants->GetBinContent(4);
19711  //Double_t QC8Error = fIntFlowQcumulants->GetBinError(4);
19712  
19713  // Measured 2-, 4-, 6- and 8-particle correlations:
19714  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>>
19715  Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1); // statistical error of <<2>>
19716  Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>>
19717  Double_t fourError = fIntFlowCorrelationsHist->GetBinError(2); // statistical error of <<4>>
19718  //Double_t six = fIntFlowCorrelationsHist->GetBinContent(3); // <<6>>
19719  //Double_t sixError = fIntFlowCorrelationsHist->GetBinError(3); // statistical error of <<6>>
19720  //Double_t eight = fIntFlowCorrelationsHist->GetBinContent(4); // <<8>>
19721  //Double_t eightError = fIntFlowCorrelationsHist->GetBinError(4); // statistical error of <<8>>
19722   
19723  // Non-isotropic terms:
19724  Double_t c1 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(1); // <<cos(n*phi1)>>
19725  Double_t c1Error = fIntFlowCorrectionTermsForNUAHist[1]->GetBinError(1); // statistical error of <<cos(n*phi1)>>
19726  Double_t c2 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(2); // <<cos(n*(phi1+phi2))>>
19727  Double_t c2Error = fIntFlowCorrectionTermsForNUAHist[1]->GetBinError(2); // statistical error of <<cos(n*(phi1+phi2))>>
19728  Double_t c3 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(3); // <<cos(n*(phi1-phi2-phi3))>>
19729  Double_t c3Error = fIntFlowCorrectionTermsForNUAHist[1]->GetBinError(3); // statistical error of <<cos(n*(phi1-phi2-phi3))>>
19730  Double_t s1 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(1); // <<sin(n*phi1)>>
19731  Double_t s1Error = fIntFlowCorrectionTermsForNUAHist[0]->GetBinError(1); // statistical error of <<sin(n*phi1)>>
19732  Double_t s2 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(2); // <<sin(n*(phi1+phi2))>>
19733  Double_t s2Error = fIntFlowCorrectionTermsForNUAHist[0]->GetBinError(2); // statistical error of <<sin(n*(phi1+phi2))>>
19734  Double_t s3 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(3); // <<sin(n*(phi1-phi2-phi3))>>
19735  Double_t s3Error = fIntFlowCorrectionTermsForNUAHist[0]->GetBinError(3); // statistical error of <<sin(n*(phi1-phi2-phi3))>>
19736  
19737  // Shortcuts:
19738  Double_t a1 = 2.*pow(c1,2.)+2.*pow(s1,2.)-two;
19739  Double_t a2 = 6.*pow(c1,3.)-2.*c1*c2+c3+6.*c1*pow(s1,2.)-2.*s1*s2-4.*c1*two;
19740  Double_t a3 = 2.*pow(s1,2.)-2.*pow(c1,2.)+c2;
19741  Double_t a4 = 6.*pow(s1,3.)+6.*pow(c1,2.)*s1+2.*c2*s1-2.*c1*s2-s3-4.*s1*two;
19742  Double_t a5 = 4.*c1*s1-s2;
19743  
19744  // Covariances (including weight dependent prefactor):
19745  Double_t wCov1 = 0.; // w*Cov(<2>,<cos(phi)) 
19746  Double_t wCov2 = 0.; // w*Cov(<2>,<sin(phi))
19747  Double_t wCov3 = 0.; // w*Cov(<cos(phi),<sin(phi))
19748  Double_t wCov4 = 0.; // w*Cov(<2>,<4>) 
19749  Double_t wCov5 = 0.; // w*Cov(<2>,<cos(#phi_{1}+#phi_{2})>)
19750  Double_t wCov6 = 0.; // w*Cov(<2>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19751  Double_t wCov7 = 0.; // w*Cov(<2>,<sin(#phi_{1}+#phi_{2})>)
19752  Double_t wCov8 = 0.; // w*Cov(<2>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19753  Double_t wCov9 = 0.; // w*Cov(<4>,<cos(#phi)>
19754  Double_t wCov10 = 0.; // w*Cov(<4>,<cos(#phi_{1}+#phi_{2})>)
19755  Double_t wCov11 = 0.; // w*Cov(<4>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19756  Double_t wCov12 = 0.; // w*Cov(<4>,<sin(#phi)>
19757  Double_t wCov13 = 0.; // w*Cov(<4>,<sin(#phi_{1}+#phi_{2})>)
19758  Double_t wCov14 = 0.; // w*Cov(<4>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19759  Double_t wCov15 = 0.; // w*Cov(<cos(#phi)>,<cos(#phi_{1}+#phi_{2})>)
19760  Double_t wCov16 = 0.; // w*Cov(<cos(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19761  Double_t wCov17 = 0.; // w*Cov(<cos(#phi)>,<sin(#phi_{1}+#phi_{2})>)
19762  Double_t wCov18 = 0.; // w*Cov(<cos(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19763  Double_t wCov19 = 0.; // w*Cov(<cos(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19764  Double_t wCov20 = 0.; // w*Cov(<sin(#phi)>,<cos(#phi_{1}+#phi_{2})>)
19765  Double_t wCov21 = 0.; // w*Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}+#phi_{2})>)
19766  Double_t wCov22 = 0.; // w*Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19767  Double_t wCov23 = 0.; // w*Cov(<sin(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19768  Double_t wCov24 = 0.; // w*Cov(<sin(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19769  Double_t wCov25 = 0.; // w*Cov(<cos(#phi_{1}-#phi_{2}-#phi_{3}>,<sin(#phi_{1}-#phi_{2}-#phi_{3}>)
19770  Double_t wCov26 = 0.; // w*Cov(<sin(#phi)>,<sin(#phi_{1}+#phi_{2})>)
19771  Double_t wCov27 = 0.; // w*Cov(<sin(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19772  Double_t wCov28 = 0.; // w*Cov(<sin(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19773  if(!fForgetAboutCovariances)
19774  {
19775   wCov1 = fIntFlowCovariancesNUA->GetBinContent(1); // w*Cov(<2>,<cos(phi)) 
19776   wCov2 = fIntFlowCovariancesNUA->GetBinContent(2); // w*Cov(<2>,<sin(phi))
19777   wCov3 = fIntFlowCovariancesNUA->GetBinContent(3); // w*Cov(<cos(phi),<sin(phi))
19778   wCov4 = fIntFlowCovariances->GetBinContent(1); // w*Cov(<2>,<4>) 
19779   wCov5 = fIntFlowCovariancesNUA->GetBinContent(4); // w*Cov(<2>,<cos(#phi_{1}+#phi_{2})>)
19780   wCov6 = fIntFlowCovariancesNUA->GetBinContent(6); // w*Cov(<2>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19781   wCov7 = fIntFlowCovariancesNUA->GetBinContent(5); // w*Cov(<2>,<sin(#phi_{1}+#phi_{2})>)
19782   wCov8 = fIntFlowCovariancesNUA->GetBinContent(7); // w*Cov(<2>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19783   wCov9 = fIntFlowCovariancesNUA->GetBinContent(8); // w*Cov(<4>,<cos(#phi)>
19784   wCov10 = fIntFlowCovariancesNUA->GetBinContent(10); // w*Cov(<4>,<cos(#phi_{1}+#phi_{2})>)
19785   wCov11 = fIntFlowCovariancesNUA->GetBinContent(12); // w*Cov(<4>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19786   wCov12 = fIntFlowCovariancesNUA->GetBinContent(9); // w*Cov(<4>,<sin(#phi)>
19787   wCov13 = fIntFlowCovariancesNUA->GetBinContent(11); // w*Cov(<4>,<sin(#phi_{1}+#phi_{2})>)
19788   wCov14 = fIntFlowCovariancesNUA->GetBinContent(13); // w*Cov(<4>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19789   wCov15 = fIntFlowCovariancesNUA->GetBinContent(14); // w*Cov(<cos(#phi)>,<cos(#phi_{1}+#phi_{2})>)
19790   wCov16 = fIntFlowCovariancesNUA->GetBinContent(16); // w*Cov(<cos(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19791   wCov17 = fIntFlowCovariancesNUA->GetBinContent(15); // w*Cov(<cos(#phi)>,<sin(#phi_{1}+#phi_{2})>)
19792   wCov18 = fIntFlowCovariancesNUA->GetBinContent(17); // w*Cov(<cos(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19793   wCov19 = fIntFlowCovariancesNUA->GetBinContent(23); // w*Cov(<cos(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19794   wCov20 = fIntFlowCovariancesNUA->GetBinContent(18); // w*Cov(<sin(#phi)>,<cos(#phi_{1}+#phi_{2})>)
19795   wCov21 = fIntFlowCovariancesNUA->GetBinContent(22); // w*Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}+#phi_{2})>)
19796   wCov22 = fIntFlowCovariancesNUA->GetBinContent(24); // w*Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19797   wCov23 = fIntFlowCovariancesNUA->GetBinContent(20); // w*Cov(<sin(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19798   wCov24 = fIntFlowCovariancesNUA->GetBinContent(25); // w*Cov(<sin(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19799   wCov25 = fIntFlowCovariancesNUA->GetBinContent(27); // w*Cov(<cos(#phi_{1}-#phi_{2}-#phi_{3}>,<sin(#phi_{1}-#phi_{2}-#phi_{3}>)
19800   wCov26 = fIntFlowCovariancesNUA->GetBinContent(19); // w*Cov(<sin(#phi)>,<sin(#phi_{1}+#phi_{2})>)
19801   wCov27 = fIntFlowCovariancesNUA->GetBinContent(21); // w*Cov(<sin(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19802   wCov28 = fIntFlowCovariancesNUA->GetBinContent(26); // w*Cov(<sin(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19803  } // end of if(!fForgetAboutCovariances)
19804  
19805  // Calculating generalized QC{2}:
19806  //  Generalized QC{2}:
19807  Double_t gQC2 = two - pow(c1,2.) - pow(s1,2.);
19808  if(fApplyCorrectionForNUA){fIntFlowQcumulants->SetBinContent(1,gQC2);} 
19809  //  Statistical error of generalized QC{2}:
19810  Double_t gQC2ErrorSquared = pow(twoError,2.)+4.*pow(c1,2.)*pow(c1Error,2.)
19811                            + 4.*pow(s1,2.)*pow(s1Error,2.)
19812                            - 4*c1*wCov1-4*s1*wCov2 
19813                            + 8.*c1*s1*wCov3;
19814  //  Store ratio of error squared - with/without NUA terms:
19815  Double_t ratioErrorSquaredQC2 = 0.;
19816  if(fIntFlowQcumulants->GetBinError(1)>0.)
19817  { 
19818   ratioErrorSquaredQC2 = (gQC2ErrorSquared/pow(fIntFlowQcumulants->GetBinError(1),2.));
19819   fIntFlowQcumulantsErrorSquaredRatio->SetBinContent(1,ratioErrorSquaredQC2);
19820  }
19821  //  If enabled, store error by including non-isotropic terms:                         
19822  if(fApplyCorrectionForNUA && fPropagateErrorAlsoFromNIT)
19823  {
19824   if(gQC2ErrorSquared>=0.)
19825   {
19826    fIntFlowQcumulants->SetBinError(1,pow(gQC2ErrorSquared,0.5));
19827   } else
19828     {
19829      fIntFlowQcumulants->SetBinError(1,0.);
19830      cout<<endl;
19831      cout<<" WARNING (QC): Statistical error of generalized QC{2} is imaginary !!!!"<<endl;
19832      cout<<endl;
19833     }   
19834  } // end of if(fApplyCorrectionForNUA && fPropagateErrorAlsoFromNIT)
19835  // Quantify detector bias to QC{2}:
19836  if(TMath::Abs(QC2)>0.)
19837  {
19838   fIntFlowDetectorBias->SetBinContent(1,gQC2/QC2); 
19839   if(QC2Error>0.)
19840   {
19841    Double_t errorSquared = gQC2ErrorSquared/pow(QC2,2.)+pow(gQC2,2.)*pow(QC2Error,2.)/pow(QC2,4.);
19842    if(errorSquared>0.)
19843    {
19844     fIntFlowDetectorBias->SetBinError(1,pow(errorSquared,0.5));  
19845    }
19846   }
19847  } // end of if(TMath::Abs(QC2)>0.)
19848
19849  // Calculating generalized QC{4}:
19850  //  Generalized QC{4}:
19851  Double_t gQC4 = four-2.*pow(two,2.)
19852                - 4.*c1*c3+4.*s1*s3-pow(c2,2.)-pow(s2,2.)
19853                + 4.*c2*(pow(c1,2.)-pow(s1,2.))+8.*s2*s1*c1
19854                + 8.*two*(pow(c1,2.)+pow(s1,2.))-6.*pow((pow(c1,2.)+pow(s1,2.)),2.);
19855  if(fApplyCorrectionForNUA){fIntFlowQcumulants->SetBinContent(2,gQC4);}   
19856  //  Statistical error of generalized QC{4}:
19857  Double_t gQC4ErrorSquared = 16.*pow(a1,2.)*pow(twoError,2.)+pow(fourError,2.)+16.*pow(a2,2.)*pow(c1Error,2.)
19858                            + 4.*pow(a3,2.)*pow(c2Error,2.)+16.*pow(c1,2.)*pow(c3Error,2.)
19859                            + 16.*pow(a4,2.)*pow(s1Error,2.)+4.*pow(a5,2.)*pow(s2Error,2.)
19860                            + 16.*pow(s1,2.)*pow(s3Error,2.)+8.*a1*wCov4-32.*a1*a2*wCov1
19861                            - 16.*a3*a1*wCov5-32.*c1*a1*wCov6-32.*a1*a4*wCov2+16.*a5*a1*wCov7
19862                            + 32.*s1*a1*wCov8-8.*a2*wCov9-4.*a3*wCov10-8.*c1*wCov11-8.*a4*wCov12
19863                            + 4.*a5*wCov13+8.*s1*wCov14+16.*a3*a2*wCov15+32.*c1*a2*wCov16+32.*a2*a4*wCov3
19864                            - 16.*a5*a2*wCov17-32.*s1*a2*wCov18+16.*c1*a3*wCov19+16.*a3*a4*wCov20
19865                            - 8.*a3*a5*wCov21-16.*s1*a3*wCov22+32.*c1*a4*wCov23-16.*c1*a5*wCov24
19866                            - 32.*c1*s1*wCov25-16.*a5*a4*wCov26-32.*s1*a4*wCov27+16.*s1*a5*wCov28;
19867  //  Store ratio of error squared - with/without NUA terms:
19868  Double_t ratioErrorSquaredQC4 = 0.;
19869  if(fIntFlowQcumulants->GetBinError(2)>0.)
19870  { 
19871   ratioErrorSquaredQC4 = (gQC4ErrorSquared/pow(fIntFlowQcumulants->GetBinError(2),2.));
19872   fIntFlowQcumulantsErrorSquaredRatio->SetBinContent(2,ratioErrorSquaredQC4);
19873  }                          
19874  if(fApplyCorrectionForNUA && fPropagateErrorAlsoFromNIT)
19875  {
19876   if(gQC4ErrorSquared>=0.)
19877   {
19878    fIntFlowQcumulants->SetBinError(2,pow(gQC4ErrorSquared,0.5));
19879   } else
19880     {
19881      fIntFlowQcumulants->SetBinError(2,0.);
19882      cout<<endl;
19883      cout<<" WARNING (QC): Statistical error of generalized QC{4} is imaginary !!!!"<<endl;
19884      cout<<endl;
19885     }   
19886  } // end of if(fApplyCorrectionForNUA && fPropagateErrorAlsoFromNIT)
19887  // Quantify detector bias to QC{4}:
19888  if(TMath::Abs(QC4)>0.)
19889  {
19890   fIntFlowDetectorBias->SetBinContent(2,gQC4/QC4); 
19891   if(QC4Error>0.)
19892   {
19893    Double_t errorSquared = gQC4ErrorSquared/pow(QC4,2.)+pow(gQC4,2.)*pow(QC4Error,2.)/pow(QC4,4.);
19894    if(errorSquared>0.)
19895    {
19896     fIntFlowDetectorBias->SetBinError(2,pow(errorSquared,0.5));  
19897    }
19898   }
19899  } // end of if(TMath::Abs(QC4)>0.)
19900
19901
19902  // .... to be improved (continued for 6th and 8th order) ....            
19903  
19904      
19905  // versus multiplicity:
19906  if(fCalculateCumulantsVsM) // to be improved - propagate error for nua terms vs M
19907  { 
19908   Int_t nBins = fIntFlowCorrelationsVsMPro[0]->GetNbinsX(); // to be improved (hardwired 0) 
19909   Double_t value[4] = {0.}; // QCs vs M
19910   Double_t error[4] = {0.}; // error of QCs vs M
19911   Double_t dSum1[4] = {0.}; // sum value_i/(error_i)^2
19912   Double_t dSum2[4] = {0.}; // sum 1/(error_i)^2
19913   for(Int_t b=1;b<=nBins;b++)
19914   {
19915    // Measured correlations:
19916    two = fIntFlowCorrelationsVsMHist[0]->GetBinContent(b); // <<2>> vs M
19917    four = fIntFlowCorrelationsVsMHist[1]->GetBinContent(b); // <<4>> vs M
19918    // Isotropic cumulants:
19919    QC2 = two;
19920    QC4 = four-2.*pow(two,2.);
19921    // Non-isotropic terms:
19922    c1 = fIntFlowCorrectionTermsForNUAVsMPro[1][0]->GetBinContent(b); // <<cos(n*phi1)>>
19923    c2 = fIntFlowCorrectionTermsForNUAVsMPro[1][1]->GetBinContent(b); // <<cos(n*(phi1+phi2))>>
19924    c3 = fIntFlowCorrectionTermsForNUAVsMPro[1][2]->GetBinContent(b); // <<cos(n*(phi1-phi2-phi3))>>
19925    s1 = fIntFlowCorrectionTermsForNUAVsMPro[0][0]->GetBinContent(b); // <<sin(n*phi1)>>
19926    s2 = fIntFlowCorrectionTermsForNUAVsMPro[0][1]->GetBinContent(b); // <<sin(n*(phi1+phi2))>>
19927    s3 = fIntFlowCorrectionTermsForNUAVsMPro[0][2]->GetBinContent(b); // <<sin(n*(phi1-phi2-phi3))>>
19928    // Generalized QC{2} vs M:
19929    gQC2 = two - pow(c1,2.) - pow(s1,2.); 
19930    if(fApplyCorrectionForNUAVsM){fIntFlowQcumulantsVsM[0]->SetBinContent(b,gQC2);}   
19931    // Generalized QC{4} vs M:  
19932    gQC4 = four-2.*pow(two,2.)
19933                  - 4.*c1*c3+4.*s1*s3-pow(c2,2.)-pow(s2,2.)
19934                  + 4.*c2*(pow(c1,2.)-pow(s1,2.))+8.*s2*s1*c1
19935                  + 8.*two*(pow(c1,2.)+pow(s1,2.))-6.*pow((pow(c1,2.)+pow(s1,2.)),2.);
19936    if(fApplyCorrectionForNUAVsM){fIntFlowQcumulantsVsM[1]->SetBinContent(b,gQC4);}   
19937    // Detector bias vs M:
19938    if(TMath::Abs(QC2)>0.)
19939    {
19940     fIntFlowDetectorBiasVsM[0]->SetBinContent(b,gQC2/QC2); 
19941    } // end of if(TMath::Abs(QC2)>0.)
19942    if(TMath::Abs(QC4)>0.)
19943    {
19944     fIntFlowDetectorBiasVsM[1]->SetBinContent(b,gQC4/QC4); 
19945    } // end of if(TMath::Abs(QC4)>0.)  
19946    // Rebin in M:
19947    for(Int_t co=0;co<4;co++)
19948    {
19949     value[co] = fIntFlowQcumulantsVsM[co]->GetBinContent(b);
19950     error[co] = fIntFlowQcumulantsVsM[co]->GetBinError(b);
19951     if(error[co]>0.)
19952     {
19953      dSum1[co]+=value[co]/(error[co]*error[co]);
19954      dSum2[co]+=1./(error[co]*error[co]);
19955     }
19956    } // end of for(Int_t co=0;co<4;co++) 
19957   } // end of for(Int_t b=1;b<=nBins;b++)
19958   // Store rebinned Q-cumulants:
19959   if(fApplyCorrectionForNUAVsM)
19960   {
19961    for(Int_t co=0;co<4;co++)
19962    {
19963     if(dSum2[co]>0.)
19964     {
19965      fIntFlowQcumulantsRebinnedInM->SetBinContent(co+1,dSum1[co]/dSum2[co]);
19966      fIntFlowQcumulantsRebinnedInM->SetBinError(co+1,pow(1./dSum2[co],0.5));
19967     }
19968    } // end of for(Int_t co=0;co<4;co++)
19969   } // end of if(fApplyCorrectionForNUAVsM)
19970  } // end of if(fCalculateCumulantsVsM) 
19971      
19972 } // end of void AliFlowAnalysisWithQCumulants::CalculateQcumulantsCorrectedForNUAIntFlow()
19973  
19974 //=======================================================================================================================
19975
19976 void AliFlowAnalysisWithQCumulants::FinalizeCorrectionTermsForNUAIntFlow() 
19977 {
19978  // From profile fIntFlowCorrectionTermsForNUAPro[sc] access measured correction terms for NUA
19979  // and their spread, correctly calculate the statistical errors and store the final 
19980  // results and statistical errors for correction terms for NUA in histogram fIntFlowCorrectionTermsForNUAHist[sc].
19981  //
19982  // Remark: Statistical error of correction temrs is calculated as:
19983  //
19984  //          statistical error = termA * spread * termB:
19985  //          termA = sqrt{sum_{i=1}^{N} w^2}/(sum_{i=1}^{N} w)
19986  //          termB = 1/sqrt(1-termA^2)   
19987  
19988  TString sinCosFlag[2] = {"sin","cos"}; // to be improved - promore this to data member?
19989  TString nonisotropicTermFlag[4] = {"(n(phi1))","(n(phi1+phi2))","(n(phi1-phi2-phi3))","(n(2phi1-phi2))"}; // to be improved - hardwired 4
19990     
19991  for(Int_t sc=0;sc<2;sc++) // sin or cos correction terms 
19992  {
19993   for(Int_t ci=1;ci<=4;ci++) // correction term index (to be improved - hardwired 4)
19994   {
19995    Double_t correction = fIntFlowCorrectionTermsForNUAPro[sc]->GetBinContent(ci);
19996    Double_t spread = fIntFlowCorrectionTermsForNUAPro[sc]->GetBinError(ci);
19997    Double_t sumOfLinearEventWeights = fIntFlowSumOfEventWeightsNUA[sc][0]->GetBinContent(ci);
19998    Double_t sumOfQuadraticEventWeights = fIntFlowSumOfEventWeightsNUA[sc][1]->GetBinContent(ci);
19999    Double_t termA = 0.;
20000    Double_t termB = 0.;
20001    if(TMath::Abs(sumOfLinearEventWeights)>1.e-44)
20002    {
20003     termA = pow(sumOfQuadraticEventWeights,0.5)/sumOfLinearEventWeights;
20004    } else
20005      {
20006       cout<<" WARNING (QC): sumOfLinearEventWeights == 0 in AFAWQC::FCTFNIF() !!!!"<<endl;
20007       cout<<Form("               (for <<%s[%s]>> non-isotropic term)",sinCosFlag[sc].Data(),nonisotropicTermFlag[ci-1].Data())<<endl;
20008      }
20009    if(1.-pow(termA,2.) > 0.)
20010    {
20011     termB = 1./pow(1-pow(termA,2.),0.5);
20012    } else
20013      {
20014       cout<<" WARNING (QC): 1.-pow(termA,2.) <= 0 in AFAWQC::FCTFNIF() !!!!"<<endl;   
20015       cout<<Form("               (for <<%s[%s]>> non-isotropic term)",sinCosFlag[sc].Data(),nonisotropicTermFlag[ci-1].Data())<<endl;
20016      }     
20017    Double_t statisticalError = termA * spread * termB;
20018    fIntFlowCorrectionTermsForNUAHist[sc]->SetBinContent(ci,correction);
20019    fIntFlowCorrectionTermsForNUAHist[sc]->SetBinError(ci,statisticalError);
20020   } // end of for(Int_t ci=1;ci<=4;ci++) // correction term index
20021  } // end of for(Int sc=0;sc<2;sc++) // sin or cos correction terms 
20022                                                                                                                                                                                                
20023 } // end of void AliFlowAnalysisWithQCumulants::FinalizeCorrectionTermsForNUAIntFlow()
20024
20025 //=======================================================================================================================
20026
20027 void AliFlowAnalysisWithQCumulants::GetPointersForNestedLoopsHistograms()
20028 {
20029  // Get pointers to all objects relevant for calculations with nested loops.
20030    
20031  TList *nestedLoopsList = dynamic_cast<TList*>(fHistList->FindObject("Nested Loops"));
20032  if(nestedLoopsList) 
20033  {
20034   this->SetNestedLoopsList(nestedLoopsList);
20035  } else
20036    {
20037     cout<<"WARNING: nestedLoopsList is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
20038     exit(0);
20039    }
20040     
20041   TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data members?)
20042   TString typeFlag[2] = {"RP","POI"}; // to be improved (should I promote this to data members?)
20043   TString ptEtaFlag[2] = {"p_{T}","#eta"}; // to be improved (should I promote this to data members?)
20044   TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"}; // to be improved (should I promote this to data members?)
20045    
20046   TString evaluateNestedLoopsName = "fEvaluateNestedLoops";
20047   evaluateNestedLoopsName += fAnalysisLabel->Data();  
20048   TProfile *evaluateNestedLoops = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(evaluateNestedLoopsName.Data()));
20049   Bool_t bEvaluateIntFlowNestedLoops = kFALSE;
20050   Bool_t bEvaluateDiffFlowNestedLoops = kFALSE;
20051   if(evaluateNestedLoops)
20052   {
20053    this->SetEvaluateNestedLoops(evaluateNestedLoops);
20054    bEvaluateIntFlowNestedLoops = (Int_t)evaluateNestedLoops->GetBinContent(1);
20055    bEvaluateDiffFlowNestedLoops = (Int_t)evaluateNestedLoops->GetBinContent(2);
20056   }
20057   // nested loops relevant for integrated flow:  
20058   if(bEvaluateIntFlowNestedLoops)
20059   {
20060    // correlations:
20061    TString intFlowDirectCorrelationsName = "fIntFlowDirectCorrelations";
20062    intFlowDirectCorrelationsName += fAnalysisLabel->Data();
20063    TProfile *intFlowDirectCorrelations = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(intFlowDirectCorrelationsName.Data()));
20064    if(intFlowDirectCorrelations) 
20065    { 
20066     this->SetIntFlowDirectCorrelations(intFlowDirectCorrelations);
20067    } else
20068      {
20069       cout<<"WARNING: intFlowDirectCorrelations is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
20070       exit(0);
20071      }
20072    if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)  
20073    {
20074     TString intFlowExtraDirectCorrelationsName = "fIntFlowExtraDirectCorrelations";
20075     intFlowExtraDirectCorrelationsName += fAnalysisLabel->Data();
20076     TProfile *intFlowExtraDirectCorrelations = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(intFlowExtraDirectCorrelationsName.Data()));
20077     if(intFlowExtraDirectCorrelations) 
20078     { 
20079      this->SetIntFlowExtraDirectCorrelations(intFlowExtraDirectCorrelations);
20080     } else
20081       {
20082        cout<<"WARNING: intFlowExtraDirectCorrelations is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
20083        exit(0);
20084       }       
20085    } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)  
20086    // correction terms for non-uniform acceptance:
20087    TString intFlowDirectCorrectionTermsForNUAName = "fIntFlowDirectCorrectionTermsForNUA";
20088    intFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();
20089    TProfile *intFlowDirectCorrectionTermsForNUA[2] = {NULL};
20090    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
20091    {
20092     intFlowDirectCorrectionTermsForNUA[sc] = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(Form("%s: %s terms",intFlowDirectCorrectionTermsForNUAName.Data(),sinCosFlag[sc].Data())));
20093     if(intFlowDirectCorrectionTermsForNUA[sc]) 
20094     { 
20095      this->SetIntFlowDirectCorrectionTermsForNUA(intFlowDirectCorrectionTermsForNUA[sc],sc);
20096     } else
20097       {
20098        cout<<"WARNING: intFlowDirectCorrectionTermsForNUA[sc] is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
20099        cout<<"sc = "<<sc<<endl;
20100        exit(0);
20101       }
20102    } // end of for(Int_t sc=0;sc<2;sc++) 
20103    // Mixed harmonics:
20104    if(fCalculateMixedHarmonics)
20105    {
20106     TString mixedHarmonicsNestedLoopsName = "fMixedHarmonicsNestedLoops";
20107     mixedHarmonicsNestedLoopsName += fAnalysisLabel->Data();
20108     TProfile *mixedHarmonicsNestedLoops = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(mixedHarmonicsNestedLoopsName.Data()));
20109     if(mixedHarmonicsNestedLoops) 
20110     { 
20111      this->SetMixedHarmonicsNestedLoops(mixedHarmonicsNestedLoops);
20112     } else
20113       {
20114        cout<<"WARNING: mixedHarmonicsNestedLoops is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
20115        exit(0);
20116       }
20117    } // end of if(fCalculateMixedHarmonics)
20118   } // end of if(bEvaluateIntFlowNestedLoops)
20119     
20120   // nested loops relevant for differential flow:  
20121   if(bEvaluateDiffFlowNestedLoops)
20122   {
20123    // correlations:
20124    TString diffFlowDirectCorrelationsName = "fDiffFlowDirectCorrelations";
20125    diffFlowDirectCorrelationsName += fAnalysisLabel->Data();
20126    TProfile *diffFlowDirectCorrelations[2][2][4] = {{{NULL}}};
20127    for(Int_t t=0;t<2;t++)
20128    {
20129     for(Int_t pe=0;pe<2;pe++)
20130     {
20131      for(Int_t ci=0;ci<4;ci++) // correlation index
20132      {
20133       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())));
20134       if(diffFlowDirectCorrelations[t][pe][ci])
20135       {
20136        this->SetDiffFlowDirectCorrelations(diffFlowDirectCorrelations[t][pe][ci],t,pe,ci);
20137       } else
20138         {
20139          cout<<"WARNING: diffFlowDirectCorrelations[t][pe][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
20140          cout<<"t  = "<<t<<endl;
20141          cout<<"pe = "<<pe<<endl;   
20142          cout<<"ci = "<<ci<<endl;
20143         }     
20144      } // end of for(Int_t ci=0;ci<4;ci++) // correlation index  
20145     } // end of for(Int_t pe=0;pe<2;pe++)
20146    } // end of for(Int_t t=0;t<2;t++)   
20147    // correction terms for non-uniform acceptance:
20148    TString diffFlowDirectCorrectionTermsForNUAName = "fDiffFlowDirectCorrectionTermsForNUA";
20149    diffFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();  
20150    TProfile *diffFlowDirectCorrectionTermsForNUA[2][2][2][10] = {{{{NULL}}}};   
20151    for(Int_t t=0;t<2;t++)
20152    {
20153     for(Int_t pe=0;pe<2;pe++)
20154     {
20155      // correction terms for NUA:
20156      for(Int_t sc=0;sc<2;sc++) // sin or cos
20157      {
20158       for(Int_t cti=0;cti<9;cti++) // correction term index
20159       {
20160        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)));
20161        if(diffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti])
20162        {
20163         this->SetDiffFlowDirectCorrectionTermsForNUA(diffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti],t,pe,sc,cti);
20164        } else
20165          {
20166           cout<<"WARNING: diffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
20167           cout<<"t   = "<<t<<endl;
20168           cout<<"pe  = "<<pe<<endl;   
20169           cout<<"sc  = "<<sc<<endl;
20170           cout<<"cti = "<<cti<<endl;
20171          }    
20172       } // end of for(Int_t cti=0;cti<9;cti++) // correction term index
20173      } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
20174     } // end of for(Int_t pe=0;pe<2;pe++)
20175    } // end of for(Int_t t=0;t<2;t++)
20176    // other differential correlators:
20177    TString otherDirectDiffCorrelatorsName = "fOtherDirectDiffCorrelators";
20178    otherDirectDiffCorrelatorsName += fAnalysisLabel->Data();  
20179    TProfile *otherDirectDiffCorrelators[2][2][2][1] = {{{{NULL}}}};   
20180    for(Int_t t=0;t<2;t++)
20181    {
20182     for(Int_t pe=0;pe<2;pe++)
20183     {
20184      // correction terms for NUA:
20185      for(Int_t sc=0;sc<2;sc++) // sin or cos
20186      {
20187       for(Int_t ci=0;ci<1;ci++) // correlator index
20188       {
20189        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)));
20190        if(otherDirectDiffCorrelators[t][pe][sc][ci])
20191        {
20192         this->SetOtherDirectDiffCorrelators(otherDirectDiffCorrelators[t][pe][sc][ci],t,pe,sc,ci);
20193        } else
20194          {
20195           cout<<"WARNING: otherDirectDiffCorrelators[t][pe][sc][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
20196           cout<<"t   = "<<t<<endl;
20197           cout<<"pe  = "<<pe<<endl;   
20198           cout<<"sc  = "<<sc<<endl;
20199           cout<<"ci = "<<ci<<endl;
20200          }    
20201       } // end of for(Int_t ci=0;ci<9;ci++) // correction term index
20202      } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
20203     } // end of for(Int_t pe=0;pe<2;pe++)
20204    } // end of for(Int_t t=0;t<2;t++)
20205    // number of RPs and POIs in selected pt and eta bins for cross-checkings:
20206    TString noOfParticlesInBinName = "fNoOfParticlesInBin";
20207    TH1D *noOfParticlesInBin = NULL;
20208    noOfParticlesInBin = dynamic_cast<TH1D*>(nestedLoopsList->FindObject(noOfParticlesInBinName.Data()));
20209    if(noOfParticlesInBin)
20210    {
20211     this->SetNoOfParticlesInBin(noOfParticlesInBin);
20212    } else
20213      {
20214       cout<<endl;
20215       cout<<" WARNING (QC): noOfParticlesInBin is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
20216       cout<<endl;
20217      }
20218   } // end of if(bEvaluateDiffFlowNestedLoops)
20219
20220 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForNestedLoopsHistograms()
20221
20222 //=======================================================================================================================
20223
20224 void AliFlowAnalysisWithQCumulants::GetPointersForMixedHarmonicsHistograms()
20225 {
20226  // Get pointers to all objects relevant for mixed harmonics.
20227    
20228  // a) Get pointer to base list for mixed harmonics;
20229  // b) Get pointer to TProfile fMixedHarmonicsFlags holding all flags for mixed harmonics;
20230  // c) Get pointer to list fMixedHarmonicsProfiles and pointers to all objects that she holds; 
20231  // d) Get pointer to list fMixedHarmonicsResults and pointers to all objects that she holds;
20232  // e) Get pointer to list fMixedHarmonicsErrorPropagation and pointers to all objects that she holds.
20233
20234  // a) Get pointer to base list for mixed harmonics:
20235  TList *mixedHarmonicsList = dynamic_cast<TList*>(fHistList->FindObject("Mixed Harmonics"));
20236  if(mixedHarmonicsList) 
20237  {
20238   this->SetMixedHarmonicsList(mixedHarmonicsList);
20239  } else
20240    {
20241     cout<<"WARNING: mixedHarmonicsList is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20242     exit(0);
20243    }
20244
20245  // b) Get pointer to TProfile fMixedHarmonicsFlags holding all flags for mixed harmonics:
20246  TString mixedHarmonicsFlagsName = "fMixedHarmonicsFlags";
20247  mixedHarmonicsFlagsName += fAnalysisLabel->Data();
20248  TProfile *mixedHarmonicsFlags = dynamic_cast<TProfile*>
20249                                  (mixedHarmonicsList->FindObject(mixedHarmonicsFlagsName.Data()));
20250  if(mixedHarmonicsFlags)
20251  {
20252   this->SetMixedHarmonicsFlags(mixedHarmonicsFlags);  
20253   fCalculateMixedHarmonics = (Bool_t)mixedHarmonicsFlags->GetBinContent(1); 
20254   fCalculateMixedHarmonicsVsM = (Bool_t)mixedHarmonicsFlags->GetBinContent(3); 
20255  } else 
20256    {
20257     cout<<"WARNING: mixedHarmonicsFlags is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20258     exit(0);
20259    }
20260   
20261  if(!fCalculateMixedHarmonics){return;}
20262
20263  // c) Get pointer to list fMixedHarmonicsProfiles and pointers to all objects that she holds:
20264  TList *mixedHarmonicsProfiles = NULL;
20265  mixedHarmonicsProfiles = dynamic_cast<TList*>(mixedHarmonicsList->FindObject("Profiles"));
20266  if(mixedHarmonicsProfiles)  
20267  {
20268   // 2p:
20269   TString s2pCorrelationsName = "f2pCorrelations";
20270   s2pCorrelationsName += fAnalysisLabel->Data();
20271   TProfile *p2pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s2pCorrelationsName.Data()));
20272   if(p2pCorrelations) 
20273   {
20274    this->Set2pCorrelations(p2pCorrelations);
20275   } else 
20276     {
20277      cout<<"WARNING: p2pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20278      exit(0);
20279     } 
20280   // 3p:
20281   TString s3pCorrelationsName = "f3pCorrelations";
20282   s3pCorrelationsName += fAnalysisLabel->Data();
20283   TProfile *p3pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s3pCorrelationsName.Data()));
20284   if(p3pCorrelations) 
20285   {
20286    this->Set3pCorrelations(p3pCorrelations);
20287   } else 
20288     {
20289      cout<<"WARNING: p3pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20290      exit(0);
20291     } 
20292   // 4p:
20293   TString s4pCorrelationsName = "f4pCorrelations";
20294   s4pCorrelationsName += fAnalysisLabel->Data();
20295   TProfile *p4pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s4pCorrelationsName.Data()));
20296   if(p4pCorrelations) 
20297   {
20298    this->Set4pCorrelations(p4pCorrelations);
20299   } else 
20300     {
20301      cout<<"WARNING: p4pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20302      exit(0);
20303     } 
20304   // 5p:
20305   TString s5pCorrelationsName = "f5pCorrelations";
20306   s5pCorrelationsName += fAnalysisLabel->Data();
20307   TProfile *p5pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s5pCorrelationsName.Data()));
20308   if(p5pCorrelations) 
20309   {
20310    this->Set5pCorrelations(p5pCorrelations);
20311   } else 
20312     {
20313      cout<<"WARNING: p5pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20314      exit(0);
20315     } 
20316   /* TBI not needed for the time being
20317   // 6p:
20318   TString s6pCorrelationsName = "f6pCorrelations";
20319   s6pCorrelationsName += fAnalysisLabel->Data();
20320   TProfile *p6pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s6pCorrelationsName.Data()));
20321   if(p6pCorrelations) 
20322   {
20323    this->Set6pCorrelations(p6pCorrelations);
20324   } else 
20325     {
20326      cout<<"WARNING: p6pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20327      exit(0);
20328     } 
20329   // 7p:
20330   TString s7pCorrelationsName = "f7pCorrelations";
20331   s7pCorrelationsName += fAnalysisLabel->Data();
20332   TProfile *p7pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s7pCorrelationsName.Data()));
20333   if(p7pCorrelations) 
20334   {
20335    this->Set7pCorrelations(p7pCorrelations);
20336   } else 
20337     {
20338      cout<<"WARNING: p7pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20339      exit(0);
20340     } 
20341   // 8p:
20342   TString s8pCorrelationsName = "f8pCorrelations";
20343   s8pCorrelationsName += fAnalysisLabel->Data();
20344   TProfile *p8pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s8pCorrelationsName.Data()));
20345   if(p8pCorrelations) 
20346   {
20347    this->Set8pCorrelations(p8pCorrelations);
20348   } else 
20349     {
20350      cout<<"WARNING: p8pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20351      exit(0);
20352     }
20353  */
20354  } else // to if(mixedHarmonicsProfiles)
20355    {
20356     cout<<"WARNING: mixedHarmonicsProfiles is NULL in FAWQC::GPFMHH() !!!!"<<endl;
20357     exit(0);
20358    }
20359
20360  // d) Get pointer to list fMixedHarmonicsResults and pointers to all objects that she holds.
20361  TList *mixedHarmonicsResults = NULL;
20362  mixedHarmonicsResults = dynamic_cast<TList*>(mixedHarmonicsList->FindObject("Results"));
20363  if(mixedHarmonicsResults)  
20364  {
20365   // 2p:
20366   TString s2pCumulantsName = "f2pCumulants";
20367   s2pCumulantsName += fAnalysisLabel->Data();
20368   TH1D *p2pCumulants = dynamic_cast<TH1D*>(mixedHarmonicsResults->FindObject(s2pCumulantsName.Data()));
20369   if(p2pCumulants) 
20370   {
20371    this->Set2pCumulants(p2pCumulants);
20372   } else 
20373     {
20374      cout<<"WARNING: p2pCumulants is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20375      exit(0);
20376     } 
20377   // 3p:
20378   TString s3pCumulantsName = "f3pCumulants";
20379   s3pCumulantsName += fAnalysisLabel->Data();
20380   TH1D *p3pCumulants = dynamic_cast<TH1D*>(mixedHarmonicsResults->FindObject(s3pCumulantsName.Data()));
20381   if(p3pCumulants) 
20382   {
20383    this->Set3pCumulants(p3pCumulants);
20384   } else 
20385     {
20386      cout<<"WARNING: p3pCumulants is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20387      exit(0);
20388     } 
20389   // 4p:
20390   TString s4pCumulantsName = "f4pCumulants";
20391   s4pCumulantsName += fAnalysisLabel->Data();
20392   TH1D *p4pCumulants = dynamic_cast<TH1D*>(mixedHarmonicsResults->FindObject(s4pCumulantsName.Data()));
20393   if(p4pCumulants) 
20394   {
20395    this->Set4pCumulants(p4pCumulants);
20396   } else 
20397     {
20398      cout<<"WARNING: p4pCumulants is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20399      exit(0);
20400     } 
20401   // 5p:
20402   TString s5pCumulantsName = "f5pCumulants";
20403   s5pCumulantsName += fAnalysisLabel->Data();
20404   TH1D *p5pCumulants = dynamic_cast<TH1D*>(mixedHarmonicsResults->FindObject(s5pCumulantsName.Data()));
20405   if(p5pCumulants) 
20406   {
20407    this->Set5pCumulants(p5pCumulants);
20408   } else 
20409     {
20410      cout<<"WARNING: p5pCumulants is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20411      exit(0);
20412     } 
20413  } else // to if(mixedHarmonicsResults)
20414    {
20415     cout<<"WARNING: mixedHarmonicsResults is NULL in FAWQC::GPFMHH() !!!!"<<endl;
20416    }
20417
20418  // e) Get pointer to list fMixedHarmonicsErrorPropagation and pointers to all objects that she holds:
20419  TList *mixedHarmonicsErrorPropagation = NULL;
20420  mixedHarmonicsErrorPropagation = dynamic_cast<TList*>(mixedHarmonicsList->FindObject("Error Propagation"));
20421  if(mixedHarmonicsErrorPropagation)  
20422  {   
20423   TString sMixedHarmonicEventWeightsName = "fMixedHarmonicEventWeights";
20424   sMixedHarmonicEventWeightsName += fAnalysisLabel->Data();
20425   TString powerFlag[2] = {"linear","quadratic"};
20426   for(Int_t power=0;power<2;power++)
20427   {
20428    TH1D *hMixedHarmonicEventWeights = dynamic_cast<TH1D*>(mixedHarmonicsErrorPropagation->FindObject(Form("%s: %s",sMixedHarmonicEventWeightsName.Data(),powerFlag[power].Data())));
20429    if(hMixedHarmonicEventWeights) 
20430    {
20431     this->SetMixedHarmonicEventWeights(hMixedHarmonicEventWeights,power);
20432    } else 
20433      {
20434       cout<<"WARNING: hMixedHarmonicEventWeights is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
20435       cout<<"power = "<<power<<endl;
20436       exit(0);
20437      }                                   
20438   } // end of for(Int_t power=0;power<2;power++)
20439   TString sMixedHarmonicProductOfEventWeightsName = "fMixedHarmonicProductOfEventWeights";
20440   sMixedHarmonicProductOfEventWeightsName += fAnalysisLabel->Data();
20441   TH2D *hMixedHarmonicProductOfEventWeights = dynamic_cast<TH2D*>(mixedHarmonicsErrorPropagation->FindObject(sMixedHarmonicProductOfEventWeightsName.Data()));
20442   if(hMixedHarmonicProductOfEventWeights) 
20443   {
20444    this->SetMixedHarmonicProductOfEventWeights(hMixedHarmonicProductOfEventWeights);
20445   } else 
20446     {
20447      cout<<"WARNING: hMixedHarmonicProductOfEventWeights is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20448      exit(0);
20449     } 
20450   TString sMixedHarmonicProductOfCorrelationsName = "fMixedHarmonicProductOfCorrelations";
20451   sMixedHarmonicProductOfCorrelationsName += fAnalysisLabel->Data();
20452   TProfile2D *hMixedHarmonicProductOfCorrelations = dynamic_cast<TProfile2D*>(mixedHarmonicsErrorPropagation->FindObject(sMixedHarmonicProductOfCorrelationsName.Data()));
20453   if(hMixedHarmonicProductOfCorrelations) 
20454   {
20455    this->SetMixedHarmonicProductOfCorrelations(hMixedHarmonicProductOfCorrelations);
20456   } else 
20457     {
20458      cout<<"WARNING: hMixedHarmonicProductOfCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20459      exit(0);
20460     } 
20461  } // end of if(mixedHarmonicsErrorPropagation) 
20462  
20463 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForMixedHarmonicsHistograms()
20464
20465 //=======================================================================================================================
20466
20467 void AliFlowAnalysisWithQCumulants::GetPointersForControlHistograms()
20468 {
20469  // Get pointers to all control histograms.
20470    
20471  // a) Get pointer to base list for control histograms;
20472  // b) Get pointer to TProfile fControlHistogramsFlags holding all flags for control histograms;
20473  // c) Get pointers to TH2D *fCorrelation2468VsMult[4], TH2D *fCorrelationProduct2468VsMult[1] and TH2D *fQvectorTermsVsMult[4].
20474
20475  // a) Get pointer to base list for control histograms:
20476  TList *controlHistogramsList = dynamic_cast<TList*>(fHistList->FindObject("Control Histograms"));
20477  if(controlHistogramsList) 
20478  {
20479   this->SetControlHistogramsList(controlHistogramsList);
20480  } else
20481    {
20482     cout<<"WARNING: controlHistogramsList is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20483     exit(0);
20484    }
20485
20486  // b) Get pointer to TProfile fControlHistogramsFlags holding all flags for control histograms:
20487  TString controlHistogramsFlagsName = "fControlHistogramsFlags";
20488  controlHistogramsFlagsName += fAnalysisLabel->Data();
20489  TProfile *controlHistogramsFlags = dynamic_cast<TProfile*>
20490                                  (controlHistogramsList->FindObject(controlHistogramsFlagsName.Data()));
20491  if(controlHistogramsFlags)
20492  {
20493   this->SetControlHistogramsFlags(controlHistogramsFlags);  
20494   fStoreControlHistograms = (Bool_t)controlHistogramsFlags->GetBinContent(1); 
20495   fUseQvectorTerms = (Bool_t)controlHistogramsFlags->GetBinContent(2); 
20496  } else 
20497    {
20498     cout<<"WARNING: controlHistogramsFlags is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20499     exit(0);
20500    }
20501   
20502  if(!fStoreControlHistograms){return;}
20503
20504  // c) Get pointers to TH2D *fCorrelation2468VsMult[4], TH2D *fCorrelationProduct2468VsMult[1] and TH2D *fQvectorTermsVsMult[4]:
20505  TString sCorrelation[4] = {"#LT2#GT","#LT4#GT","#LT6#GT","#LT8#GT"};
20506  TString sCorrelation2468VsMultName = "fCorrelation2468VsMult";
20507  sCorrelation2468VsMultName += fAnalysisLabel->Data();
20508  for(Int_t ci=0;ci<4;ci++)
20509  {
20510   TH2D *hCorrelation2468VsMult = dynamic_cast<TH2D*>(controlHistogramsList->FindObject(Form("%s vs M",sCorrelation[ci].Data())));
20511   if(hCorrelation2468VsMult) 
20512   {
20513    this->SetCorrelation2468VsMult(hCorrelation2468VsMult,ci);
20514   } else 
20515     {
20516      cout<<"WARNING: hCorrelation2468VsMult is NULL in AFAWQC::GPFCH() !!!!"<<endl; 
20517      cout<<"ci = "<<ci<<endl;
20518      exit(0);
20519     }                                   
20520  } // end of for(Int_t ci=0;ci<4;ci++)
20521  TString sCorrelationProduct[1] = {"#LT2#GT#LT4#GT"}; // TBI: add the other ones when needed first time
20522  TString sCorrelationProduct2468VsMultName = "fCorrelationProduct2468VsMult";
20523  sCorrelationProduct2468VsMultName += fAnalysisLabel->Data();
20524  for(Int_t cpi=0;cpi<1;cpi++) // TBI: hardwired 1
20525  {
20526   TH2D *hCorrelationProduct2468VsMult = dynamic_cast<TH2D*>(controlHistogramsList->FindObject(Form("%s vs M",sCorrelationProduct[cpi].Data())));
20527   if(hCorrelationProduct2468VsMult) 
20528   {
20529    this->SetCorrelationProduct2468VsMult(hCorrelationProduct2468VsMult,cpi);
20530   } else 
20531     {
20532      cout<<"WARNING: hCorrelationProduct2468VsMult is NULL in AFAWQC::GPFCH() !!!!"<<endl; 
20533      cout<<"cpi = "<<cpi<<endl;
20534      exit(0);
20535     }  
20536  } // end of for(Int_t cpi=0;cpi<1;cpi++) // TBI: hardwired 1
20537
20538  if(!fUseQvectorTerms){return;}
20539  TString sQvectorTerms[4] = {"#frac{|Q_{n}|^{2}}{M}","#frac{|Q_{2n}|^{2}}{M}","#frac{|Q_{n}|^{4}}{M(2M-1)}","#frac{Re[Q_{2n}Q_{n}^{*}Q_{n}^{*}]}{M^{3/2}}"};
20540  TString sQvectorTermsVsMultName = "fQvectorTermsVsMult";
20541  sQvectorTermsVsMultName += fAnalysisLabel->Data();
20542  for(Int_t qwti=0;qwti<4;qwti++) // TBI: hardwired 4
20543  {
20544   TH2D *hQvectorTermsVsMult = dynamic_cast<TH2D*>(controlHistogramsList->FindObject(Form("%s vs M",sQvectorTerms[qwti].Data())));
20545   if(hQvectorTermsVsMult) 
20546   {
20547    this->SetQvectorTermsVsMult(hQvectorTermsVsMult,qwti);
20548   } else 
20549     {
20550      cout<<"WARNING: hQvectorTermsVsMult is NULL in AFAWQC::GPFCH() !!!!"<<endl; 
20551      cout<<"qwti = "<<qwti<<endl;
20552      exit(0);
20553     }  
20554  } // end of for(Int_t qwti=0;qwti<1;qwti++) // TBI: hardwired 4
20555
20556 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForControlHistograms()
20557
20558 //=======================================================================================================================
20559
20560 void AliFlowAnalysisWithQCumulants::GetPointersForBootstrap()
20561 {
20562  // Get pointers to all bootstrap histograms.
20563    
20564  // a) Get pointer to base list for bootstrap histograms;
20565  // b) Get pointer to TProfile fBootstrapFlags holding all flags for bootstrap histograms;
20566  // c) Get pointers to all other lists;
20567  // d) Get pointers to remaining bootstrap profiles and histograms;
20568  // e) Get pointers to remaining bootstrap profiles and histograms 'vs M'.
20569
20570  // a) Get pointer to base list for bootstrap histograms:
20571  TList *bootstrapList = dynamic_cast<TList*>(fHistList->FindObject("Bootstrap"));
20572  if(bootstrapList) 
20573  {
20574   this->SetBootstrapList(bootstrapList);
20575  } else
20576    {
20577     cout<<"WARNING: bootstrapList is NULL in AFAWQC::GPFB() !!!!"<<endl;
20578     exit(0);
20579    }
20580
20581  // b) Get pointer to TProfile fBootstrapFlags holding all flags for bootstrap histograms:
20582  TString bootstrapFlagsName = "fBootstrapFlags";
20583  bootstrapFlagsName += fAnalysisLabel->Data();
20584  TProfile *bootstrapFlags = dynamic_cast<TProfile*>
20585                                  (fBootstrapList->FindObject(bootstrapFlagsName.Data()));
20586  if(bootstrapFlags)
20587  {
20588   this->SetBootstrapFlags(bootstrapFlags);  
20589   fUseBootstrap = (Bool_t)fBootstrapFlags->GetBinContent(1); 
20590   fUseBootstrapVsM = (Bool_t)fBootstrapFlags->GetBinContent(2); 
20591   fnSubsamples = (Int_t)fBootstrapFlags->GetBinContent(3); 
20592  } else 
20593    {
20594     cout<<"WARNING: bootstrapFlags is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20595     exit(0);
20596    }
20597
20598  // c) Get pointers to all other lists:
20599  if(fUseBootstrap || fUseBootstrapVsM)
20600  {
20601   TList *bootstrapProfilesList = dynamic_cast<TList*>(fBootstrapList->FindObject("Profiles"));
20602   if(bootstrapProfilesList) 
20603   {
20604    this->SetBootstrapProfilesList(bootstrapProfilesList);
20605   } else
20606     {
20607      cout<<"WARNING: bootstrapProfilesList is NULL in AFAWQC::GPFB() !!!!"<<endl;
20608      exit(0);
20609     }
20610   TList *bootstrapResultsList = dynamic_cast<TList*>(fBootstrapList->FindObject("Results"));
20611   if(bootstrapResultsList) 
20612   {
20613    this->SetBootstrapResultsList(bootstrapResultsList);
20614   } else
20615     {
20616      cout<<"WARNING: bootstrapResultsList is NULL in AFAWQC::GPFB() !!!!"<<endl;
20617      exit(0);
20618     }
20619  } // end of if(fUseBootstrap || fUseBootstrapVsM)
20620
20621
20622  // d) Get pointers to remaining bootstrap profiles and histograms:
20623  TString correlationFlag[4] = {"#LT#LT2#GT#GT","#LT#LT4#GT#GT","#LT#LT6#GT#GT","#LT#LT8#GT#GT"};
20624  TString cumulantFlag[4] = {"QC{2}","QC{4}","QC{6}","QC{8}"};
20625  if(fUseBootstrap)
20626  { 
20627   TString bootstrapCorrelationsName = "fBootstrapCorrelations";
20628   bootstrapCorrelationsName += fAnalysisLabel->Data();
20629   TProfile2D *pBootstrapCorrelations = dynamic_cast<TProfile2D*>(fBootstrapProfilesList->FindObject(bootstrapCorrelationsName.Data()));
20630   if(pBootstrapCorrelations) 
20631   {
20632    this->SetBootstrapCorrelations(pBootstrapCorrelations);
20633   } else 
20634     {
20635      cout<<"WARNING: pBootstrapCorrelations is NULL in AFAWQC::GPFB() !!!!"<<endl; 
20636      exit(0);
20637     }                                   
20638   TString bootstrapCumulantsName = "fBootstrapCumulants";
20639   bootstrapCumulantsName += fAnalysisLabel->Data();
20640   TH2D *pBootstrapCumulants = dynamic_cast<TH2D*>(fBootstrapResultsList->FindObject(bootstrapCumulantsName.Data()));
20641   if(pBootstrapCumulants) 
20642   {
20643    this->SetBootstrapCumulants(pBootstrapCumulants);
20644   } else 
20645     {
20646      cout<<"WARNING: pBootstrapCumulants is NULL in AFAWQC::GPFB() !!!!"<<endl; 
20647      exit(0);
20648     }                                   
20649  } // end of if(fUseBootstrap)
20650
20651  // e) Get pointers to remaining bootstrap profiles and histograms 'vs M':
20652  if(fUseBootstrapVsM)
20653  { 
20654   TString bootstrapCorrelationsVsMName = "fBootstrapCorrelationsVsM";
20655   bootstrapCorrelationsVsMName += fAnalysisLabel->Data();
20656   for(Int_t ci=0;ci<4;ci++) // correlation index
20657   {
20658    TProfile2D *pBootstrapCorrelationsVsM = dynamic_cast<TProfile2D*>(fBootstrapProfilesList->FindObject(Form("%s, %s",bootstrapCorrelationsVsMName.Data(),correlationFlag[ci].Data())));
20659    if(pBootstrapCorrelationsVsM)
20660    {
20661     this->SetBootstrapCorrelationsVsM(pBootstrapCorrelationsVsM,ci);
20662    } else 
20663      {
20664       cout<<"WARNING: pBootstrapCorrelationsVsM is NULL in AFAWQC::GPFB() !!!!"<<endl; 
20665       cout<<"ci = "<<ci<<endl;
20666       exit(0);
20667      }                                   
20668   } // end of for(Int_t ci=0;ci<4;ci++)
20669   TString bootstrapCumulantsVsMName = "fBootstrapCumulantsVsM";
20670   bootstrapCumulantsVsMName += fAnalysisLabel->Data();
20671   for(Int_t co=0;co<4;co++) // correlation index
20672   {
20673    TH2D *pBootstrapCumulantsVsM = dynamic_cast<TH2D*>(fBootstrapResultsList->FindObject(Form("%s, %s",bootstrapCumulantsVsMName.Data(),cumulantFlag[co].Data())));
20674    if(pBootstrapCumulantsVsM)
20675    {
20676     this->SetBootstrapCumulantsVsM(pBootstrapCumulantsVsM,co);
20677    } else 
20678      {
20679       cout<<"WARNING: pBootstrapCumulantsVsM is NULL in AFAWQC::GPFB() !!!!"<<endl; 
20680       cout<<"co = "<<co<<endl;
20681       exit(0);
20682      }                                   
20683   } // end of for(Int_t co=0;co<4;co++)
20684  } // end of if(fUseBootstrapVsM)
20685
20686 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForBootstrap()
20687
20688 //=======================================================================================================================
20689
20690 void AliFlowAnalysisWithQCumulants::StoreHarmonic()
20691 {
20692  // Store flow harmonic in common control histograms.
20693
20694  (fCommonHists->GetHarmonic())->Fill(0.5,fHarmonic);
20695  if(fFillMultipleControlHistograms)
20696  {
20697   (fCommonHists2nd->GetHarmonic())->Fill(0.5,fHarmonic);
20698   (fCommonHists4th->GetHarmonic())->Fill(0.5,fHarmonic);
20699   (fCommonHists6th->GetHarmonic())->Fill(0.5,fHarmonic);
20700   (fCommonHists8th->GetHarmonic())->Fill(0.5,fHarmonic);
20701  }
20702  
20703 } // end of void AliFlowAnalysisWithQCumulants::StoreHarmonic()
20704
20705 //=======================================================================================================================
20706
20707 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrelationsUsingParticleWeights(TString type, TString ptOrEta) // type = RP or POI 
20708 {
20709  // Calculate all correlations needed for differential flow using particle weights.
20710  
20711  Int_t t = 0; // type flag 
20712  Int_t pe = 0; // ptEta flag
20713  
20714  if(type == "RP")
20715  {
20716   t = 0;
20717  } else if(type == "POI")
20718    {
20719     t = 1;
20720    }
20721
20722  if(ptOrEta == "Pt")
20723  {
20724   pe = 0;
20725  } else if(ptOrEta == "Eta")
20726    {
20727     pe = 1;
20728    }
20729     
20730  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
20731  Double_t minPtEta[2] = {fPtMin,fEtaMin};
20732  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
20733  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
20734
20735  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
20736  Double_t dReQ1n1k = (*fReQ)(0,1);
20737  Double_t dReQ2n2k = (*fReQ)(1,2);
20738  Double_t dReQ1n3k = (*fReQ)(0,3);
20739  //Double_t dReQ4n4k = (*fReQ)(3,4);
20740  Double_t dImQ1n1k = (*fImQ)(0,1);
20741  Double_t dImQ2n2k = (*fImQ)(1,2);
20742  Double_t dImQ1n3k = (*fImQ)(0,3);
20743  //Double_t dImQ4n4k = (*fImQ)(3,4);
20744  
20745  // S^M_{p,k} (see .h file for the definition of fSpk):
20746  Double_t dSM1p1k = (*fSpk)(0,1);
20747  Double_t dSM1p2k = (*fSpk)(0,2);
20748  Double_t dSM1p3k = (*fSpk)(0,3);
20749  Double_t dSM2p1k = (*fSpk)(1,1);
20750  Double_t dSM3p1k = (*fSpk)(2,1);
20751  
20752  // looping over all bins and calculating reduced correlations: 
20753  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20754  {
20755   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular (pt,eta) bin):  
20756   Double_t p1n0kRe = 0.;
20757   Double_t p1n0kIm = 0.;
20758
20759   // number of POIs in particular (pt,eta) bin):
20760   Double_t mp = 0.;
20761
20762   // real and imaginary parts of q_{m*n,k}: 
20763   // (weighted Q-vector evaluated for particles which are both RPs and POIs in particular (pt,eta) bin)
20764   Double_t q1n2kRe = 0.;
20765   Double_t q1n2kIm = 0.;
20766   Double_t q2n1kRe = 0.;
20767   Double_t q2n1kIm = 0.;
20768
20769   // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
20770   Double_t s1p1k = 0.; 
20771   Double_t s1p2k = 0.; 
20772   Double_t s1p3k = 0.; 
20773    
20774   // M0111 from Eq. (118) in QC2c (to be improved (notation))
20775   Double_t dM0111 = 0.;
20776  
20777   if(type == "POI")
20778   {
20779    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
20780            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
20781    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
20782            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
20783             
20784    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
20785     
20786    t = 1; // typeFlag = RP or POI
20787     
20788    // q_{m*n,k}: (Remark: m=1 is 0, k=0 iz zero (to be improved!)) 
20789    q1n2kRe = fReRPQ1dEBE[2][pe][0][2]->GetBinContent(fReRPQ1dEBE[2][pe][0][2]->GetBin(b))
20790            * fReRPQ1dEBE[2][pe][0][2]->GetBinEntries(fReRPQ1dEBE[2][pe][0][2]->GetBin(b));
20791    q1n2kIm = fImRPQ1dEBE[2][pe][0][2]->GetBinContent(fImRPQ1dEBE[2][pe][0][2]->GetBin(b))
20792            * fImRPQ1dEBE[2][pe][0][2]->GetBinEntries(fImRPQ1dEBE[2][pe][0][2]->GetBin(b));
20793    q2n1kRe = fReRPQ1dEBE[2][pe][1][1]->GetBinContent(fReRPQ1dEBE[2][pe][1][1]->GetBin(b))
20794            * fReRPQ1dEBE[2][pe][1][1]->GetBinEntries(fReRPQ1dEBE[2][pe][1][1]->GetBin(b));
20795    q2n1kIm = fImRPQ1dEBE[2][pe][1][1]->GetBinContent(fImRPQ1dEBE[2][pe][1][1]->GetBin(b))
20796            * fImRPQ1dEBE[2][pe][1][1]->GetBinEntries(fImRPQ1dEBE[2][pe][1][1]->GetBin(b));
20797        
20798    // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
20799    s1p1k = pow(fs1dEBE[2][pe][1]->GetBinContent(b)*fs1dEBE[2][pe][1]->GetBinEntries(b),1.); 
20800    s1p2k = pow(fs1dEBE[2][pe][2]->GetBinContent(b)*fs1dEBE[2][pe][2]->GetBinEntries(b),1.); 
20801    s1p3k = pow(fs1dEBE[2][pe][3]->GetBinContent(b)*fs1dEBE[2][pe][3]->GetBinEntries(b),1.); 
20802      
20803    // M0111 from Eq. (118) in QC2c (to be improved (notation)):
20804    dM0111 = mp*(dSM3p1k-3.*dSM1p1k*dSM1p2k+2.*dSM1p3k)
20805           - 3.*(s1p1k*(dSM2p1k-dSM1p2k)
20806           + 2.*(s1p3k-s1p2k*dSM1p1k));
20807   }
20808    else if(type == "RP")
20809    {
20810     // q_{m*n,k}: (Remark: m=1 is 0, k=0 iz zero (to be improved!)) 
20811     q1n2kRe = fReRPQ1dEBE[0][pe][0][2]->GetBinContent(fReRPQ1dEBE[0][pe][0][2]->GetBin(b))
20812             * fReRPQ1dEBE[0][pe][0][2]->GetBinEntries(fReRPQ1dEBE[0][pe][0][2]->GetBin(b));
20813     q1n2kIm = fImRPQ1dEBE[0][pe][0][2]->GetBinContent(fImRPQ1dEBE[0][pe][0][2]->GetBin(b))
20814             * fImRPQ1dEBE[0][pe][0][2]->GetBinEntries(fImRPQ1dEBE[0][pe][0][2]->GetBin(b));
20815     q2n1kRe = fReRPQ1dEBE[0][pe][1][1]->GetBinContent(fReRPQ1dEBE[0][pe][1][1]->GetBin(b))
20816             * fReRPQ1dEBE[0][pe][1][1]->GetBinEntries(fReRPQ1dEBE[0][pe][1][1]->GetBin(b));
20817     q2n1kIm = fImRPQ1dEBE[0][pe][1][1]->GetBinContent(fImRPQ1dEBE[0][pe][1][1]->GetBin(b))
20818             * fImRPQ1dEBE[0][pe][1][1]->GetBinEntries(fImRPQ1dEBE[0][pe][1][1]->GetBin(b));
20819
20820     // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
20821     s1p1k = pow(fs1dEBE[0][pe][1]->GetBinContent(b)*fs1dEBE[0][pe][1]->GetBinEntries(b),1.); 
20822     s1p2k = pow(fs1dEBE[0][pe][2]->GetBinContent(b)*fs1dEBE[0][pe][2]->GetBinEntries(b),1.); 
20823     s1p3k = pow(fs1dEBE[0][pe][3]->GetBinContent(b)*fs1dEBE[0][pe][3]->GetBinEntries(b),1.); 
20824     
20825     // to be improved (cross-checked):
20826     p1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
20827             * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
20828     p1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))  
20829             * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
20830             
20831     mp = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
20832      
20833     t = 0; // typeFlag = RP or POI
20834     
20835     // M0111 from Eq. (118) in QC2c (to be improved (notation)):
20836     dM0111 = mp*(dSM3p1k-3.*dSM1p1k*dSM1p2k+2.*dSM1p3k)
20837            - 3.*(s1p1k*(dSM2p1k-dSM1p2k)
20838            + 2.*(s1p3k-s1p2k*dSM1p1k));
20839     //...............................................................................................   
20840    }
20841    
20842    // 2'-particle correlation:
20843    Double_t two1n1nW0W1 = 0.;
20844    if(mp*dSM1p1k-s1p1k)
20845    {
20846     two1n1nW0W1 = (p1n0kRe*dReQ1n1k+p1n0kIm*dImQ1n1k-s1p1k)
20847                 / (mp*dSM1p1k-s1p1k);
20848    
20849     // fill profile to get <<2'>>     
20850     fDiffFlowCorrelationsPro[t][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nW0W1,mp*dSM1p1k-s1p1k);    
20851     // fill profile to get <<2'>^2>     
20852     fDiffFlowSquaredCorrelationsPro[t][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nW0W1*two1n1nW0W1,mp*dSM1p1k-s1p1k);        
20853     // histogram to store <2'> e-b-e (needed in some other methods):
20854     fDiffFlowCorrelationsEBE[t][pe][0]->SetBinContent(b,two1n1nW0W1);      
20855     fDiffFlowEventWeightsForCorrelationsEBE[t][pe][0]->SetBinContent(b,mp*dSM1p1k-s1p1k);      
20856    } // end of if(mp*dSM1p1k-s1p1k)
20857    
20858    // 4'-particle correlation:
20859    Double_t four1n1n1n1nW0W1W1W1 = 0.;
20860    if(dM0111)
20861    {
20862     four1n1n1n1nW0W1W1W1 = ((pow(dReQ1n1k,2.)+pow(dImQ1n1k,2.))*(p1n0kRe*dReQ1n1k+p1n0kIm*dImQ1n1k)
20863                          - q2n1kRe*(pow(dReQ1n1k,2.)-pow(dImQ1n1k,2.))
20864                          - 2.*q2n1kIm*dReQ1n1k*dImQ1n1k
20865                          - p1n0kRe*(dReQ1n1k*dReQ2n2k+dImQ1n1k*dImQ2n2k)
20866                          + p1n0kIm*(dImQ1n1k*dReQ2n2k-dReQ1n1k*dImQ2n2k)
20867                          - 2.*dSM1p2k*(p1n0kRe*dReQ1n1k+p1n0kIm*dImQ1n1k)
20868                          - 2.*(pow(dReQ1n1k,2.)+pow(dImQ1n1k,2.))*s1p1k                                            
20869                          + 6.*(q1n2kRe*dReQ1n1k+q1n2kIm*dImQ1n1k)                                           
20870                          + 1.*(q2n1kRe*dReQ2n2k+q2n1kIm*dImQ2n2k)                         
20871                          + 2.*(p1n0kRe*dReQ1n3k+p1n0kIm*dImQ1n3k)                      
20872                          + 2.*s1p1k*dSM1p2k                                      
20873                          - 6.*s1p3k)        
20874                          / dM0111; // to be improved (notation of dM0111)
20875    
20876     // fill profile to get <<4'>>     
20877     fDiffFlowCorrelationsPro[t][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nW0W1W1W1,dM0111);    
20878     // fill profile to get <<4'>^2>     
20879     fDiffFlowSquaredCorrelationsPro[t][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nW0W1W1W1*four1n1n1n1nW0W1W1W1,dM0111);        
20880     // histogram to store <4'> e-b-e (needed in some other methods):
20881     fDiffFlowCorrelationsEBE[t][pe][1]->SetBinContent(b,four1n1n1n1nW0W1W1W1);      
20882     fDiffFlowEventWeightsForCorrelationsEBE[t][pe][1]->SetBinContent(b,dM0111);      
20883    } // end of if(dM0111)
20884  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20885
20886 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrelationsUsingParticleWeights(TString type, TString ptOrEta); // type = RP or POI 
20887
20888 //=======================================================================================================================
20889
20890 void AliFlowAnalysisWithQCumulants::FillCommonControlHistograms(AliFlowEventSimple *anEvent)
20891 {
20892  // Fill common control histograms.
20893  
20894  Int_t nRP = anEvent->GetNumberOfRPs(); // number of Reference Particles 
20895  fCommonHists->FillControlHistograms(anEvent); 
20896  if(fFillMultipleControlHistograms)
20897  {
20898   if(nRP>1)
20899   {
20900    fCommonHists2nd->FillControlHistograms(anEvent);                                        
20901    if(nRP>3)
20902    {
20903     fCommonHists4th->FillControlHistograms(anEvent);                                        
20904     if(nRP>5)
20905     {
20906      fCommonHists6th->FillControlHistograms(anEvent);                                        
20907      if(nRP>7)
20908      {
20909       fCommonHists8th->FillControlHistograms(anEvent);                                        
20910      } // end of if(nRP>7)  
20911     } // end of if(nRP>5) 
20912    } // end of if(nRP>3)                                                                                                                      
20913   } // end of if(nRP>1) 
20914  } // end of if(fFillMultipleControlHistograms)
20915  
20916 } // end of void AliFlowAnalysisWithQCumulants::FillCommonControlHistograms(AliFlowEventSimple *anEvent)
20917
20918 //=======================================================================================================================
20919
20920 void AliFlowAnalysisWithQCumulants::FillControlHistograms(AliFlowEventSimple *anEvent)
20921 {
20922  // Fill common control histograms.
20923  
20924  Int_t nRPs = anEvent->GetNumberOfRPs(); // number of Reference Particles
20925  Int_t nPOIs = anEvent->GetNumberOfPOIs(); // number of Particles Of Interest
20926  Int_t nRefMult = anEvent->GetReferenceMultiplicity(); // reference multiplicity for current event (TBI: This call is not really needed here, use fReferenceMultiplicityEBE instead)
20927
20928  fCorrelationNoRPsVsRefMult->Fill(nRPs,nRefMult);
20929  fCorrelationNoPOIsVsRefMult->Fill(nPOIs,nRefMult);
20930  fCorrelationNoRPsVsNoPOIs->Fill(nRPs,nPOIs);
20931  
20932 } // end of void AliFlowAnalysisWithQCumulants::FillControlHistograms(AliFlowEventSimple *anEvent)
20933
20934 //=======================================================================================================================
20935
20936 void AliFlowAnalysisWithQCumulants::ResetEventByEventQuantities()
20937 {
20938  // Reset all event by event quantities.
20939  
20940  // Reference flow:
20941  fReQ->Zero();
20942  fImQ->Zero();
20943  fSpk->Zero();
20944  fIntFlowCorrelationsEBE->Reset();
20945  fIntFlowEventWeightsForCorrelationsEBE->Reset();
20946  fIntFlowCorrelationsAllEBE->Reset();
20947  
20948  for(Int_t sc=0;sc<2;sc++)
20949  {
20950   fIntFlowCorrectionTermsForNUAEBE[sc]->Reset();
20951   fIntFlowEventWeightForCorrectionTermsForNUAEBE[sc]->Reset(); 
20952  }
20953     
20954  // Differential flow:
20955  if(fCalculateDiffFlow)
20956  {
20957   for(Int_t t=0;t<3;t++) // type (RP, POI, POI&&RP)
20958   {
20959    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // 1D in pt or eta
20960    {
20961     for(Int_t m=0;m<4;m++) // multiple of harmonic
20962     {
20963      for(Int_t k=0;k<9;k++) // power of weight
20964      {
20965       if(fReRPQ1dEBE[t][pe][m][k]) fReRPQ1dEBE[t][pe][m][k]->Reset();
20966       if(fImRPQ1dEBE[t][pe][m][k]) fImRPQ1dEBE[t][pe][m][k]->Reset();
20967      }   
20968     } 
20969    }
20970   } 
20971   for(Int_t t=0;t<3;t++) // type (0 = RP, 1 = POI, 2 = RP&&POI )
20972   { 
20973    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // 1D in pt or eta
20974    {
20975     for(Int_t k=0;k<9;k++)
20976     {
20977      if(fs1dEBE[t][pe][k]) fs1dEBE[t][pe][k]->Reset();
20978     }
20979    }
20980   }
20981   // e-b-e reduced correlations:
20982   for(Int_t t=0;t<2;t++) // type (0 = RP, 1 = POI)
20983   {  
20984    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
20985    {
20986     for(Int_t rci=0;rci<4;rci++) // reduced correlation index
20987     {
20988      if(fDiffFlowCorrelationsEBE[t][pe][rci]) fDiffFlowCorrelationsEBE[t][pe][rci]->Reset();
20989      if(fDiffFlowEventWeightsForCorrelationsEBE[t][pe][rci]) fDiffFlowEventWeightsForCorrelationsEBE[t][pe][rci]->Reset();
20990     }
20991    }
20992   }  
20993   // correction terms for NUA:
20994   for(Int_t t=0;t<2;t++) // type (0 = RP, 1 = POI)
20995   {  
20996    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
20997    {
20998     for(Int_t sc=0;sc<2;sc++) // sin or cos
20999     {
21000      for(Int_t cti=0;cti<9;cti++) // correction term index
21001      {
21002      fDiffFlowCorrectionTermsForNUAEBE[t][pe][sc][cti]->Reset();  
21003      }
21004     }
21005    }      
21006   }
21007  } // end of if(fCalculateDiffFlow)   
21008
21009  // 2D (pt,eta)
21010  if(fCalculate2DDiffFlow)
21011  {
21012   for(Int_t t=0;t<3;t++) // type (RP, POI, POI&&RP)
21013   {
21014    for(Int_t m=0;m<4;m++) // multiple of harmonic
21015    {
21016     for(Int_t k=0;k<9;k++) // power of weight
21017     {
21018      if(fReRPQ2dEBE[t][m][k]){fReRPQ2dEBE[t][m][k]->Reset();}
21019      if(fImRPQ2dEBE[t][m][k]){fImRPQ2dEBE[t][m][k]->Reset();}
21020     }   
21021    }
21022   }
21023   for(Int_t t=0;t<3;t++) // type (0 = RP, 1 = POI, 2 = RP&&POI )
21024   { 
21025    for(Int_t k=0;k<9;k++)
21026    {
21027     if(fs2dEBE[t][k]){fs2dEBE[t][k]->Reset();}
21028    }
21029   }  
21030  } // end of if(fCalculate2DDiffFlow) 
21031
21032 } // end of void AliFlowAnalysisWithQCumulants::ResetEventByEventQuantities();
21033
21034 //=======================================================================================================================
21035
21036 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUASinTerms(TString type, TString ptOrEta)
21037 {
21038  // Calculate correction terms for non-uniform acceptance for differential flow (sin terms).
21039  
21040  // Results are stored in fDiffFlowCorrectionTermsForNUAPro[t][pe][0][cti], where cti runs as follows:
21041  //  0: <<sin n(psi1)>>
21042  //  1: <<sin n(psi1+phi2)>>
21043  //  2: <<sin n(psi1+phi2-phi3)>>
21044  //  3: <<sin n(psi1-phi2-phi3)>>:
21045  //  4:
21046  //  5:
21047  //  6:
21048  
21049  // multiplicity:
21050  Double_t dMult = (*fSpk)(0,0);
21051  
21052  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
21053  Double_t dReQ1n = (*fReQ)(0,0);
21054  Double_t dReQ2n = (*fReQ)(1,0);
21055  //Double_t dReQ3n = (*fReQ)(2,0);
21056  //Double_t dReQ4n = (*fReQ)(3,0);
21057  Double_t dImQ1n = (*fImQ)(0,0);
21058  Double_t dImQ2n = (*fImQ)(1,0);
21059  //Double_t dImQ3n = (*fImQ)(2,0);
21060  //Double_t dImQ4n = (*fImQ)(3,0);
21061
21062  Int_t t = 0; // type flag 
21063  Int_t pe = 0; // ptEta flag
21064  
21065  if(type == "RP")
21066  {
21067   t = 0;
21068  } else if(type == "POI")
21069    {
21070     t = 1;
21071    }
21072
21073  if(ptOrEta == "Pt")
21074  {
21075   pe = 0;
21076  } else if(ptOrEta == "Eta")
21077    {
21078     pe = 1;
21079    }
21080     
21081  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
21082  Double_t minPtEta[2] = {fPtMin,fEtaMin};
21083  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
21084  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
21085
21086  // looping over all bins and calculating correction terms: 
21087  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
21088  {
21089   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
21090   Double_t p1n0kRe = 0.;
21091   Double_t p1n0kIm = 0.;
21092
21093   // number of POIs in particular pt or eta bin:
21094   Double_t mp = 0.;
21095
21096   // 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):
21097   Double_t q1n0kRe = 0.;
21098   Double_t q1n0kIm = 0.;
21099   Double_t q2n0kRe = 0.;
21100   Double_t q2n0kIm = 0.;
21101
21102   // number of particles which are both RPs and POIs in particular pt or eta bin:
21103   Double_t mq = 0.;
21104    
21105   if(type == "POI")
21106   {
21107    // q_{m*n,0}:
21108    q1n0kRe = fReRPQ1dEBE[2][pe][0][0]->GetBinContent(fReRPQ1dEBE[2][pe][0][0]->GetBin(b))
21109            * fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b));
21110    q1n0kIm = fImRPQ1dEBE[2][pe][0][0]->GetBinContent(fImRPQ1dEBE[2][pe][0][0]->GetBin(b))
21111            * fImRPQ1dEBE[2][pe][0][0]->GetBinEntries(fImRPQ1dEBE[2][pe][0][0]->GetBin(b));
21112    q2n0kRe = fReRPQ1dEBE[2][pe][1][0]->GetBinContent(fReRPQ1dEBE[2][pe][1][0]->GetBin(b))
21113            * fReRPQ1dEBE[2][pe][1][0]->GetBinEntries(fReRPQ1dEBE[2][pe][1][0]->GetBin(b));
21114    q2n0kIm = fImRPQ1dEBE[2][pe][1][0]->GetBinContent(fImRPQ1dEBE[2][pe][1][0]->GetBin(b))
21115            * fImRPQ1dEBE[2][pe][1][0]->GetBinEntries(fImRPQ1dEBE[2][pe][1][0]->GetBin(b));         
21116                  
21117    mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
21118   } 
21119   else if(type == "RP")
21120   {
21121    // q_{m*n,0}:
21122    q1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
21123            * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
21124    q1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))
21125            * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
21126    q2n0kRe = fReRPQ1dEBE[0][pe][1][0]->GetBinContent(fReRPQ1dEBE[0][pe][1][0]->GetBin(b))
21127            * fReRPQ1dEBE[0][pe][1][0]->GetBinEntries(fReRPQ1dEBE[0][pe][1][0]->GetBin(b));
21128    q2n0kIm = fImRPQ1dEBE[0][pe][1][0]->GetBinContent(fImRPQ1dEBE[0][pe][1][0]->GetBin(b))
21129            * fImRPQ1dEBE[0][pe][1][0]->GetBinEntries(fImRPQ1dEBE[0][pe][1][0]->GetBin(b));         
21130                  
21131    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)  
21132   }    
21133   if(type == "POI")
21134   {
21135    // p_{m*n,0}:
21136    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
21137            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
21138    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
21139            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
21140             
21141    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
21142     
21143    t = 1; // typeFlag = RP or POI
21144   }
21145   else if(type == "RP")
21146   {
21147    // p_{m*n,0} = q_{m*n,0}:
21148    p1n0kRe = q1n0kRe; 
21149    p1n0kIm = q1n0kIm; 
21150            
21151    mp = mq; 
21152    
21153    t = 0; // typeFlag = RP or POI
21154   }
21155
21156   // <<sin n(psi1)>>:
21157   Double_t sinP1nPsi = 0.;
21158   if(mp)
21159   {
21160    sinP1nPsi = p1n0kIm/mp;
21161    // fill profile for <<sin n(psi1)>>:
21162    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi,mp);
21163    // histogram to store <sin n(psi1)> e-b-e (needed in some other methods):
21164    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][0]->SetBinContent(b,sinP1nPsi);
21165   } // end of if(mp)   
21166   
21167   // <<sin n(psi1+phi2)>>:
21168   Double_t sinP1nPsiP1nPhi = 0.;
21169   if(mp*dMult-mq)
21170   {
21171    sinP1nPsiP1nPhi = (p1n0kRe*dImQ1n+p1n0kIm*dReQ1n-q2n0kIm)/(mp*dMult-mq);
21172    // fill profile for <<sin n(psi1+phi2)>>:
21173    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsiP1nPhi,mp*dMult-mq);
21174    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
21175    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][1]->SetBinContent(b,sinP1nPsiP1nPhi);
21176   } // end of if(mp*dMult-mq)   
21177   
21178   // <<sin n(psi1+phi2-phi3)>>:
21179   Double_t sinP1nPsi1P1nPhi2MPhi3 = 0.;
21180   if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))
21181   {
21182    sinP1nPsi1P1nPhi2MPhi3 = (p1n0kIm*(pow(dImQ1n,2.)+pow(dReQ1n,2.)-dMult)
21183                           - 1.*(q2n0kIm*dReQ1n-q2n0kRe*dImQ1n)  
21184                           - mq*dImQ1n+2.*q1n0kIm)
21185                           / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
21186    // fill profile for <<sin n(psi1+phi2)>>:
21187    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1P1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
21188    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
21189    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][2]->SetBinContent(b,sinP1nPsi1P1nPhi2MPhi3);
21190   } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   
21191   
21192   // <<sin n(psi1-phi2-phi3)>>:
21193   Double_t sinP1nPsi1M1nPhi2MPhi3 = 0.;
21194   if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))
21195   {
21196    sinP1nPsi1M1nPhi2MPhi3 = (p1n0kIm*(pow(dReQ1n,2.)-pow(dImQ1n,2.))-2.*p1n0kRe*dReQ1n*dImQ1n
21197                           - 1.*(p1n0kIm*dReQ2n-p1n0kRe*dImQ2n)
21198                           + 2.*mq*dImQ1n-2.*q1n0kIm)
21199                           / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
21200    // fill profile for <<sin n(psi1+phi2)>>:
21201    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1M1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
21202    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
21203    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][3]->SetBinContent(b,sinP1nPsi1M1nPhi2MPhi3);
21204   } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   
21205  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
21206  
21207 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUASinTerms(TString type, TString ptOrEta)
21208
21209
21210 //=======================================================================================================================
21211
21212
21213 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTerms(TString type, TString ptOrEta)
21214 {
21215  // Calculate correction terms for non-uniform acceptance for differential flow (cos terms).
21216  
21217  // Results are stored in fDiffFlowCorrectionTermsForNUAPro[t][pe][1][cti], where cti runs as follows:
21218  //  0: <<cos n(psi)>>
21219  //  1: <<cos n(psi1+phi2)>>
21220  //  2: <<cos n(psi1+phi2-phi3)>>
21221  //  3: <<cos n(psi1-phi2-phi3)>>
21222  //  4:
21223  //  5:
21224  //  6:
21225  
21226  // multiplicity:
21227  Double_t dMult = (*fSpk)(0,0);
21228  
21229  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
21230  Double_t dReQ1n = (*fReQ)(0,0);
21231  Double_t dReQ2n = (*fReQ)(1,0);
21232  //Double_t dReQ3n = (*fReQ)(2,0);
21233  //Double_t dReQ4n = (*fReQ)(3,0);
21234  Double_t dImQ1n = (*fImQ)(0,0);
21235  Double_t dImQ2n = (*fImQ)(1,0);
21236  //Double_t dImQ3n = (*fImQ)(2,0);
21237  //Double_t dImQ4n = (*fImQ)(3,0);
21238
21239  Int_t t = 0; // type flag 
21240  Int_t pe = 0; // ptEta flag
21241  
21242  if(type == "RP")
21243  {
21244   t = 0;
21245  } else if(type == "POI")
21246    {
21247     t = 1;
21248    }
21249
21250  if(ptOrEta == "Pt")
21251  {
21252   pe = 0;
21253  } else if(ptOrEta == "Eta")
21254    {
21255     pe = 1;
21256    }
21257     
21258  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
21259  Double_t minPtEta[2] = {fPtMin,fEtaMin};
21260  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
21261  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
21262
21263  // looping over all bins and calculating correction terms: 
21264  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
21265  {
21266   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
21267   Double_t p1n0kRe = 0.;
21268   Double_t p1n0kIm = 0.;
21269
21270   // number of POIs in particular pt or eta bin:
21271   Double_t mp = 0.;
21272
21273   // 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):
21274   Double_t q1n0kRe = 0.;
21275   Double_t q1n0kIm = 0.;
21276   Double_t q2n0kRe = 0.;
21277   Double_t q2n0kIm = 0.;
21278
21279   // number of particles which are both RPs and POIs in particular pt or eta bin:
21280   Double_t mq = 0.;
21281    
21282   if(type == "POI")
21283   {
21284    // q_{m*n,0}:
21285    q1n0kRe = fReRPQ1dEBE[2][pe][0][0]->GetBinContent(fReRPQ1dEBE[2][pe][0][0]->GetBin(b))
21286            * fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b));
21287    q1n0kIm = fImRPQ1dEBE[2][pe][0][0]->GetBinContent(fImRPQ1dEBE[2][pe][0][0]->GetBin(b))
21288            * fImRPQ1dEBE[2][pe][0][0]->GetBinEntries(fImRPQ1dEBE[2][pe][0][0]->GetBin(b));
21289    q2n0kRe = fReRPQ1dEBE[2][pe][1][0]->GetBinContent(fReRPQ1dEBE[2][pe][1][0]->GetBin(b))
21290            * fReRPQ1dEBE[2][pe][1][0]->GetBinEntries(fReRPQ1dEBE[2][pe][1][0]->GetBin(b));
21291    q2n0kIm = fImRPQ1dEBE[2][pe][1][0]->GetBinContent(fImRPQ1dEBE[2][pe][1][0]->GetBin(b))
21292            * fImRPQ1dEBE[2][pe][1][0]->GetBinEntries(fImRPQ1dEBE[2][pe][1][0]->GetBin(b));         
21293                  
21294    mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
21295   } 
21296   else if(type == "RP")
21297   {
21298    // q_{m*n,0}:
21299    q1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
21300            * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
21301    q1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))
21302            * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
21303    q2n0kRe = fReRPQ1dEBE[0][pe][1][0]->GetBinContent(fReRPQ1dEBE[0][pe][1][0]->GetBin(b))
21304            * fReRPQ1dEBE[0][pe][1][0]->GetBinEntries(fReRPQ1dEBE[0][pe][1][0]->GetBin(b));
21305    q2n0kIm = fImRPQ1dEBE[0][pe][1][0]->GetBinContent(fImRPQ1dEBE[0][pe][1][0]->GetBin(b))
21306            * fImRPQ1dEBE[0][pe][1][0]->GetBinEntries(fImRPQ1dEBE[0][pe][1][0]->GetBin(b));         
21307                  
21308    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)  
21309   }    
21310   if(type == "POI")
21311   {
21312    // p_{m*n,0}:
21313    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
21314            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
21315    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
21316            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
21317             
21318    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
21319     
21320    t = 1; // typeFlag = RP or POI
21321   }
21322   else if(type == "RP")
21323   {
21324    // p_{m*n,0} = q_{m*n,0}:
21325    p1n0kRe = q1n0kRe; 
21326    p1n0kIm = q1n0kIm; 
21327            
21328    mp = mq; 
21329    
21330    t = 0; // typeFlag = RP or POI
21331   }
21332
21333   // <<cos n(psi1)>>:
21334   Double_t cosP1nPsi = 0.;
21335   if(mp)
21336   {
21337    cosP1nPsi = p1n0kRe/mp;
21338    
21339    // fill profile for <<cos n(psi1)>>:
21340    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi,mp);
21341    // histogram to store <cos n(psi1)> e-b-e (needed in some other methods):
21342    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][0]->SetBinContent(b,cosP1nPsi);
21343   } // end of if(mp)   
21344   
21345   // <<cos n(psi1+phi2)>>:
21346   Double_t cosP1nPsiP1nPhi = 0.;
21347   if(mp*dMult-mq)
21348   {
21349    cosP1nPsiP1nPhi = (p1n0kRe*dReQ1n-p1n0kIm*dImQ1n-q2n0kRe)/(mp*dMult-mq);
21350    // fill profile for <<sin n(psi1+phi2)>>:
21351    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsiP1nPhi,mp*dMult-mq);
21352    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
21353    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][1]->SetBinContent(b,cosP1nPsiP1nPhi);
21354   } // end of if(mp*dMult-mq)   
21355   
21356   // <<cos n(psi1+phi2-phi3)>>:
21357   Double_t cosP1nPsi1P1nPhi2MPhi3 = 0.;
21358   if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))
21359   {
21360    cosP1nPsi1P1nPhi2MPhi3 = (p1n0kRe*(pow(dImQ1n,2.)+pow(dReQ1n,2.)-dMult)
21361                           - 1.*(q2n0kRe*dReQ1n+q2n0kIm*dImQ1n)  
21362                           - mq*dReQ1n+2.*q1n0kRe)
21363                           / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
21364    // fill profile for <<sin n(psi1+phi2)>>:
21365    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1P1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
21366    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
21367    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][2]->SetBinContent(b,cosP1nPsi1P1nPhi2MPhi3);
21368   } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   
21369   
21370   // <<cos n(psi1-phi2-phi3)>>:
21371   Double_t cosP1nPsi1M1nPhi2MPhi3 = 0.;
21372   if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))
21373   {
21374    cosP1nPsi1M1nPhi2MPhi3 = (p1n0kRe*(pow(dReQ1n,2.)-pow(dImQ1n,2.))+2.*p1n0kIm*dReQ1n*dImQ1n
21375                           - 1.*(p1n0kRe*dReQ2n+p1n0kIm*dImQ2n)  
21376                           - 2.*mq*dReQ1n+2.*q1n0kRe)
21377                           / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
21378    // fill profile for <<sin n(psi1+phi2)>>:
21379    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1M1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
21380    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
21381    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][3]->SetBinContent(b,cosP1nPsi1M1nPhi2MPhi3);
21382   } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   
21383  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
21384  
21385 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTerms(TString type, TString ptOrEta)
21386
21387 //=========================================================================================================================
21388
21389 void AliFlowAnalysisWithQCumulants::FinalizeCorrectionTermsForNUADiffFlow(TString type, TString ptOrEta)
21390 {
21391  // Transfer profiles into histogams and correctly propagate the error.
21392  
21393  Int_t t = 0; // type flag 
21394  Int_t pe = 0; // ptEta flag
21395  
21396  if(type == "RP")
21397  {
21398   t = 0;
21399  } else if(type == "POI")
21400    {
21401     t = 1;
21402    }
21403
21404  if(ptOrEta == "Pt")
21405  {
21406   pe = 0;
21407  } else if(ptOrEta == "Eta")
21408    {
21409     pe = 1;
21410    }
21411     
21412  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
21413  //Double_t minPtEta[2] = {fPtMin,fEtaMin};
21414  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
21415  //Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
21416
21417  for(Int_t sc=0;sc<2;sc++) // sin or cos
21418  {
21419   for(Int_t cti=0;cti<9;cti++) // correction term index
21420   {
21421    for(Int_t b=1;b<=nBinsPtEta[pe];b++)
21422    {
21423     Double_t correctionTerm = fDiffFlowCorrectionTermsForNUAPro[t][pe][sc][cti]->GetBinContent(b);
21424     fDiffFlowCorrectionTermsForNUAHist[t][pe][sc][cti]->SetBinContent(b,correctionTerm);
21425     // to be improved (propagate error correctly)
21426     // ...
21427    } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
21428   } // correction term index
21429  } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
21430
21431 }// end of void AliFlowAnalysisWithQCumulants::FinalizeCorrectionTermsForNUADiffFlow(TString type, TString ptOrEta)
21432
21433 //=========================================================================================================================
21434
21435 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCumulantsCorrectedForNUA(TString type, TString ptOrEta)
21436
21437  // Calculate generalized differential flow cumulants (corrected for non-uniform acceptance).
21438  
21439  // to be improved - propagate error also from non-isotropic terms
21440   
21441  Int_t t = 0; // RP = 0, POI = 1
21442  Int_t pe = 0; // pt = 0, eta = 1
21443
21444  if(type == "RP")
21445  {
21446   t = 0;
21447  } else if(type == "POI")
21448    {
21449     t = 1;
21450    } 
21451      
21452  if(ptOrEta == "Pt")
21453  {
21454   pe = 0;
21455  } else if(ptOrEta == "Eta")
21456    {
21457     pe = 1;
21458    } 
21459        
21460  // Common:
21461  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
21462  // 2-particle correlation:
21463  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>>
21464  // sinus terms coming from reference flow: 
21465  Double_t sinP1nPhi = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(1); // <<sin(n*phi1)>>
21466  Double_t sinP1nPhi1P1nPhi2 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(2); // <<sin(n*(phi1+phi2))>>
21467  Double_t sinP1nPhi1M1nPhi2M1nPhi3 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(3); // <<sin(n*(phi1-phi2-phi3))>>
21468  // cosinus terms coming from reference flow: 
21469  Double_t cosP1nPhi = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(1); // <<cos(n*phi1)>>
21470  Double_t cosP1nPhi1P1nPhi2 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(2); // <<cos(n*(phi1+phi2))>>
21471  Double_t cosP1nPhi1M1nPhi2M1nPhi3 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(3); // <<cos(n*(phi1-phi2-phi3))>>
21472
21473  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
21474  {
21475   Double_t twoPrime = fDiffFlowCorrelationsHist[t][pe][0]->GetBinContent(b); // <<2'>>
21476   Double_t fourPrime = fDiffFlowCorrelationsHist[t][pe][1]->GetBinContent(b); // <<4'>>
21477   Double_t sinP1nPsi = fDiffFlowCorrectionTermsForNUAHist[t][pe][0][0]->GetBinContent(b); // <<sin n(Psi)>> 
21478   Double_t cosP1nPsi = fDiffFlowCorrectionTermsForNUAHist[t][pe][1][0]->GetBinContent(b); // <<cos n(Psi)>> 
21479   Double_t sinP1nPsi1P1nPhi2 = fDiffFlowCorrectionTermsForNUAHist[t][pe][0][1]->GetBinContent(b); // <<sin n(psi1+phi2)>> 
21480   Double_t cosP1nPsi1P1nPhi2 = fDiffFlowCorrectionTermsForNUAHist[t][pe][1][1]->GetBinContent(b); // <<cos n(psi1+phi2)>> 
21481   Double_t sinP1nPsi1P1nPhi2M1nPhi3 = fDiffFlowCorrectionTermsForNUAHist[t][pe][0][2]->GetBinContent(b); // <<sin n(psi1+phi2-phi3)>> 
21482   Double_t cosP1nPsi1P1nPhi2M1nPhi3 = fDiffFlowCorrectionTermsForNUAHist[t][pe][1][2]->GetBinContent(b); // <<cos n(psi1+phi2-phi3)>> 
21483   Double_t sinP1nPsi1M1nPhi2M1nPhi3 = fDiffFlowCorrectionTermsForNUAHist[t][pe][0][3]->GetBinContent(b); // <<sin n(psi1-phi2-phi3)>> 
21484   Double_t cosP1nPsi1M1nPhi2M1nPhi3 = fDiffFlowCorrectionTermsForNUAHist[t][pe][1][3]->GetBinContent(b); // <<cos n(psi1-phi2-phi3)>> 
21485   // Generalized QC{2'}:
21486   Double_t qc2Prime = twoPrime - sinP1nPsi*sinP1nPhi - cosP1nPsi*cosP1nPhi;
21487   if(fApplyCorrectionForNUA)
21488   {
21489    fDiffFlowCumulants[t][pe][0]->SetBinContent(b,qc2Prime);
21490   }
21491   if(TMath::Abs(twoPrime)>0.)
21492   {
21493    fDiffFlowDetectorBias[t][pe][0]->SetBinContent(b,qc2Prime/twoPrime); // detector bias = generalized/isotropic cumulant.   
21494   }
21495   // Generalized QC{4'}:
21496   Double_t qc4Prime = fourPrime-2.*twoPrime*two
21497                     - cosP1nPsi*cosP1nPhi1M1nPhi2M1nPhi3
21498                     + sinP1nPsi*sinP1nPhi1M1nPhi2M1nPhi3
21499                     - cosP1nPhi*cosP1nPsi1M1nPhi2M1nPhi3
21500                     + sinP1nPhi*sinP1nPsi1M1nPhi2M1nPhi3
21501                     - 2.*cosP1nPhi*cosP1nPsi1P1nPhi2M1nPhi3
21502                     - 2.*sinP1nPhi*sinP1nPsi1P1nPhi2M1nPhi3
21503                     - cosP1nPsi1P1nPhi2*cosP1nPhi1P1nPhi2
21504                     - sinP1nPsi1P1nPhi2*sinP1nPhi1P1nPhi2
21505                     + 2.*cosP1nPhi1P1nPhi2*(cosP1nPsi*cosP1nPhi-sinP1nPsi*sinP1nPhi)
21506                     + 2.*sinP1nPhi1P1nPhi2*(cosP1nPsi*sinP1nPhi+sinP1nPsi*cosP1nPhi)
21507                     + 4.*two*(cosP1nPsi*cosP1nPhi+sinP1nPsi*sinP1nPhi)
21508                     + 2.*cosP1nPsi1P1nPhi2*(pow(cosP1nPhi,2.)-pow(sinP1nPhi,2.))
21509                     + 4.*sinP1nPsi1P1nPhi2*cosP1nPhi*sinP1nPhi
21510                     + 4.*twoPrime*(pow(cosP1nPhi,2.)+pow(sinP1nPhi,2.))
21511                     - 6.*(pow(cosP1nPhi,2.)-pow(sinP1nPhi,2.)) 
21512                     * (cosP1nPsi*cosP1nPhi-sinP1nPsi*sinP1nPhi)
21513                     - 12.*cosP1nPhi*sinP1nPhi
21514                     * (sinP1nPsi*cosP1nPhi+cosP1nPsi*sinP1nPhi);
21515   if(fApplyCorrectionForNUA)
21516   {
21517    fDiffFlowCumulants[t][pe][1]->SetBinContent(b,qc4Prime);   
21518   }
21519   if(TMath::Abs(fourPrime-2.*twoPrime*two)>0.)
21520   {
21521    fDiffFlowDetectorBias[t][pe][1]->SetBinContent(b,qc4Prime/(fourPrime-2.*twoPrime*two)); // detector bias = generalized/isotropic cumulant.   
21522   }
21523  } // end of for(Int_t p=1;p<=fnBinsPt;p++)
21524  
21525 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCumulantsCorrectedForNUA(TString type, TString ptOrEta)
21526
21527 //==================================================================================================================================    
21528
21529 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectedForNUA(TString type, TString ptOrEta)
21530 {
21531  // Calculate differential flow corrected for non-uniform acceptance.
21532  
21533  // to be improved: eventually I will have to access here masured correlations and NUA terms
21534  //                 instead of cumulants in order to propagate statistical error correctly also 
21535  //                 to NUA terms (propagating errors directly from cumulants is WRONG for 
21536  //                 differential flow becuase that doesn't account at all cross-covariance terms) 
21537  
21538  // REMARK: When NUA correction is apllied error for differential flow DOES NOT get corrected,
21539  //         i.e. only value is being corrected, error is still the one relevant for isotropic
21540  //         case. This eventually will be resolved. 
21541   
21542  
21543  Int_t t = 0; // RP or POI
21544  Int_t pe = 0; // pt or eta
21545
21546  if(type == "RP")
21547  {
21548   t = 0;
21549  } else if(type == "POI")
21550    {
21551     t = 1;
21552    }     
21553  if(ptOrEta == "Pt")
21554  {
21555   pe = 0;
21556  } else if(ptOrEta == "Eta")
21557    {
21558     pe = 1;
21559    } 
21560   
21561  // Common:
21562  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
21563  // Reference Q-cumulants
21564  Double_t qc2 = fIntFlowQcumulants->GetBinContent(1); // QC{2} 
21565  Double_t qc4 = fIntFlowQcumulants->GetBinContent(2); // QC{4}
21566  // Loop over pt or eta bins:
21567  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
21568  {
21569   // Differential Q-cumulants:
21570   Double_t qc2Prime = fDiffFlowCumulants[t][pe][0]->GetBinContent(b); // QC{2'}
21571   Double_t qc4Prime = fDiffFlowCumulants[t][pe][1]->GetBinContent(b); // QC{4'}
21572   // v'{2}:
21573   if(qc2>0.)
21574   { 
21575    Double_t v2Prime = qc2Prime/pow(qc2,0.5);
21576    if(TMath::Abs(v2Prime)>0.){fDiffFlow[t][pe][0]->SetBinContent(b,v2Prime);} 
21577   }  
21578   // v'{4}:
21579   if(qc4<0.)
21580   { 
21581    Double_t v4Prime = -qc4Prime/pow(-qc4,3./4.);
21582    if(TMath::Abs(v4Prime)>0.){fDiffFlow[t][pe][1]->SetBinContent(b,v4Prime);} 
21583   }  
21584  } // end of for(Int_t b=1;b<=fnBinsPtEta[pe];b++)
21585   
21586 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectedForNUA(TString type, TString ptOrEta); 
21587
21588 //=========================================================================================================================
21589
21590 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrelationsWithNestedLoops(AliFlowEventSimple * const anEvent)
21591 {
21592  // Evaluate with nested loops multiparticle correlations for integrated flow (without using the particle weights). 
21593
21594  // Remark: Results are stored in profile fIntFlowDirectCorrelations whose binning is organized as follows:
21595  // 
21596  //  1st bin: <2>_{1n|1n} = two1n1n = cos(n*(phi1-phi2))>
21597  //  2nd bin: <2>_{2n|2n} = two2n2n = cos(2n*(phi1-phi2))>
21598  //  3rd bin: <2>_{3n|3n} = two3n3n = cos(3n*(phi1-phi2))> 
21599  //  4th bin: <2>_{4n|4n} = two4n4n = cos(4n*(phi1-phi2))>
21600  //  5th bin:           ----  EMPTY ----
21601  //  6th bin: <3>_{2n|1n,1n} = three2n1n1n = <cos(n*(2.*phi1-phi2-phi3))>
21602  //  7th bin: <3>_{3n|2n,1n} = three3n2n1n = <cos(n*(3.*phi1-2.*phi2-phi3))>
21603  //  8th bin: <3>_{4n|2n,2n} = three4n2n2n = <cos(n*(4.*phi1-2.*phi2-2.*phi3))>
21604  //  9th bin: <3>_{4n|3n,1n} = three4n3n1n = <cos(n*(4.*phi1-3.*phi2-phi3))>
21605  // 10th bin:           ----  EMPTY ----
21606  // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1n = <cos(n*(phi1+phi2-phi3-phi4))>
21607  // 12th bin: <4>_{2n,1n|2n,1n} = four2n1n2n1n = <cos(2.*n*(phi1+phi2-phi3-phi4))>
21608  // 13th bin: <4>_{2n,2n|2n,2n} = four2n2n2n2n = <cos(n*(2.*phi1+phi2-2.*phi3-phi4))>
21609  // 14th bin: <4>_{3n|1n,1n,1n} = four3n1n1n1n = <cos(n*(3.*phi1-phi2-phi3-phi4))> 
21610  // 15th bin: <4>_{3n,1n|3n,1n} = four3n1n3n1n = <cos(n*(4.*phi1-2.*phi2-phi3-phi4))>
21611  // 16th bin: <4>_{3n,1n|2n,2n} = four3n1n2n2n = <cos(n*(3.*phi1+phi2-2.*phi3-2.*phi4))>
21612  // 17th bin: <4>_{4n|2n,1n,1n} = four4n2n1n1n = <cos(n*(3.*phi1+phi2-3.*phi3-phi4))> 
21613  // 18th bin:           ----  EMPTY ----
21614  // 19th bin: <5>_{2n|1n,1n,1n,1n} = five2n1n1n1n1n = <cos(n*(2.*phi1+phi2-phi3-phi4-phi5))>
21615  // 20th bin: <5>_{2n,2n|2n,1n,1n} = five2n2n2n1n1n = <cos(n*(2.*phi1+2.*phi2-2.*phi3-phi4-phi5))>
21616  // 21st bin: <5>_{3n,1n|2n,1n,1n} = five3n1n2n1n1n = <cos(n*(3.*phi1+phi2-2.*phi3-phi4-phi5))>
21617  // 22nd bin: <5>_{4n|1n,1n,1n,1n} = five4n1n1n1n1n = <cos(n*(4.*phi1-phi2-phi3-phi4-phi5))>
21618  // 23rd bin:           ----  EMPTY ----
21619  // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = six1n1n1n1n1n1n = <cos(n*(phi1+phi2+phi3-phi4-phi5-phi6))>
21620  // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = six2n1n1n2n1n1n = <cos(n*(2.*phi1+2.*phi2-phi3-phi4-phi5-phi6))>
21621  // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = six2n2n1n1n1n1n = <cos(n*(3.*phi1+phi2-phi3-phi4-phi5-phi6))>
21622  // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = six3n1n1n1n1n1n = <cos(n*(2.*phi1+phi2+phi3-2.*phi4-phi5-phi6))>
21623  // 28th bin:           ----  EMPTY ----
21624  // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = seven2n1n1n1n1n1n1n =  <cos(n*(2.*phi1+phi2+phi3-phi4-phi5-phi6-phi7))>
21625  // 30th bin:           ----  EMPTY ----
21626  // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = eight1n1n1n1n1n1n1n1n = <cos(n*(phi1+phi2+phi3+phi4-phi5-phi6-phi7-phi8))>
21627  // 32nd bin:           ----  EMPTY ----
21628   //  Extra correlations for 3p TY study: 
21629  // 33rd bin: <4>_{4n,2n|3n,3n}= four4n2n3n3n = <cos(n*(4.*phi1+2.*phi2-3.*phi3-3.*phi4))>
21630  // 34th bin: <5>_{3n,3n|2n,2n,2n} = five3n3n2n2n2n = <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-2*phi5))> 
21631   //  Extra correlations for 6p TY study: 
21632  // 35th bin: <2>_{5n|5n} = two5n5n = <cos(5n*(phi1-phi2)> T
21633  // 36th bin: <2>_{6n|6n} = two6n6n = <cos(6n*(phi1-phi2)> T
21634  // 37th bin: <3>_{5n|3n,2n} = three5n3n2n = <cos(n*(5*phi1-3*phi2-2*phi3)> 
21635  // 38th bin: <3>_{5n|4n,1n} = three5n4n1n = <cos(n*(5*phi1-4*phi2-1*phi3)> 
21636  // 39th bin: <3>_{6n|3n,3n} = three6n3n3n = <cos(n*(6*phi1-3*phi2-3*phi3)> T 
21637  // 40th bin: <3>_{6n|4n,2n} = three6n4n2n = <cos(n*(6*phi1-4*phi2-2*phi3)> T
21638  // 41st bin: <3>_{6n|5n,1n} = three6n5n1n = <cos(n*(6*phi1-5*phi2-1*phi3)>
21639  // 42nd bin: <4>_{6n|3n,2n,1n} = four6n3n2n1n = <cos(n*(6*phi1-3*phi2-2*phi3-1*phi4)>
21640  // 43rd bin: <4>_{3n,2n|3n,2n} = four3n2n3n2n = <cos(n*(3*phi1+2*phi2-3*phi3-2*phi4)>
21641  // 44th bin: <4>_{4n,1n|3n,2n} = four4n1n3n2n = <cos(n*(4*phi1+1*phi2-3*phi3-2*phi4)>
21642  // 45th bin: <4>_{3n,3n|3n,3n} = four3n3n3n3n = <cos(3.*n*(phi1+phi2-phi3-phi4))> T
21643  // 46th bin: <4>_{4n,2n|3n,3n} = four4n2n3n3n = <cos(n*(4*phi1+2*phi2-3*phi3-3*phi4)>
21644  // 47th bin: <4>_{5n,1n|3n,3n} = four5n1n3n3n = <cos(n*(5*phi1+1*phi2-3*phi3-3*phi4)>
21645  // 48th bin: <4>_{4n,2n|4n,2n} = four4n2n4n2n = <cos(n*(4*phi1+2*phi2-4*phi3-2*phi4)> T
21646  // 49th bin: <4>_{5n,1n|4n,2n} = four5n1n4n2n = <cos(n*(5*phi1+1*phi2-4*phi3-2*phi4)>
21647  // 50th bin: <4>_{5n|3n,1n,1n} = four5n3n1n1n = <cos(n*(5*phi1-3*phi2-1*phi3-1*phi4)>
21648  // 51st bin: <4>_{5n|2n,2n,1n} = four5n2n2n1n = <cos(n*(5*phi1-2*phi2-2*phi3-1*phi4)>
21649  // 52nd bin: <4>_{5n,1n|5n,1n} = four5n1n5n1n = <cos(n*(5*phi1+1*phi2-5*phi3-1*phi4)>
21650  // 53rd bin: <5>_{3n,3n|3n,2n,1n} = four3n3n3n2n1n = <cos(n*(3*phi1+3*phi2-3*phi3-2*phi4-1*phi5)>
21651  // 54th bin: <5>_{4n,2n|3n,2n,1n} = four4n2n3n2n1n = <cos(n*(4*phi1+2*phi2-3*phi3-2*phi4-1*phi5)>
21652  // 55th bin: <5>_{3n,2n|3n,1n,1n} = four3n2n3n1n1n = <cos(n*(3*phi1+2*phi2-3*phi3-1*phi4-1*phi5)>
21653  // 56th bin: <5>_{3n,2n|2n,2n,1n} = four3n2n2n2n1n = <cos(n*(3*phi1+2*phi2-2*phi3-2*phi4-1*phi5)>
21654  // 57th bin: <5>_{5n,1n|3n,2n,1n} = four5n1n3n2n1n = <cos(n*(5*phi1+1*phi2-3*phi3-2*phi4-1*phi5)>
21655  // 58th bin: <6>_{3n,2n,1n|3n,2n,1n} = six3n2n1n3n2n1n = <cos(n*(3*phi1+2*phi2+1*phi3-3*phi4-2*phi5-1*phi6)>
21656   
21657  Int_t nPrim = anEvent->NumberOfTracks(); 
21658  AliFlowTrackSimple *aftsTrack = NULL; 
21659  Double_t phi1=0., phi2=0., phi3=0., phi4=0., phi5=0., phi6=0., phi7=0., phi8=0.; 
21660  Int_t n = fHarmonic; 
21661  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // to be improved (is this casting safe in general?)
21662  Double_t dMult = (*fSpk)(0,0);
21663  cout<<endl;
21664  cout<<"Multiparticle correlations: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
21665  if(dMult<2)
21666  {
21667   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
21668  } else if (dMult>fMaxAllowedMultiplicity)
21669    {
21670     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
21671    } else 
21672      { 
21673       cout<<"... evaluating nested loops (without using particle weights)..."<<endl;
21674      } 
21675  
21676  // 2-particle correlations:       
21677  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
21678  {
21679   for(Int_t i1=0;i1<nPrim;i1++)
21680   {
21681    aftsTrack=anEvent->GetTrack(i1);
21682    if(!(aftsTrack->InRPSelection())) continue;
21683    phi1=aftsTrack->Phi(); 
21684    for(Int_t i2=0;i2<nPrim;i2++)
21685    {
21686     if(i2==i1)continue;
21687     aftsTrack=anEvent->GetTrack(i2);
21688     if(!(aftsTrack->InRPSelection())) continue;
21689     phi2=aftsTrack->Phi();
21690     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
21691     // fill the profile with 2-p correlations: 
21692     fIntFlowDirectCorrelations->Fill(0.5,cos(n*(phi1-phi2)),1.);     // <cos(n*(phi1-phi2))>
21693     fIntFlowDirectCorrelations->Fill(1.5,cos(2.*n*(phi1-phi2)),1.);  // <cos(2n*(phi1-phi2))>
21694     fIntFlowDirectCorrelations->Fill(2.5,cos(3.*n*(phi1-phi2)),1.);  // <cos(3n*(phi1-phi2))>
21695     fIntFlowDirectCorrelations->Fill(3.5,cos(4.*n*(phi1-phi2)),1.);  // <cos(4n*(phi1-phi2))>   
21696     fIntFlowDirectCorrelations->Fill(34.5,cos(5.*n*(phi1-phi2)),1.); // <cos(5n*(phi1-phi2))>
21697     fIntFlowDirectCorrelations->Fill(35.5,cos(6.*n*(phi1-phi2)),1.); // <cos(6n*(phi1-phi2))>   
21698    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21699   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21700  } // end of if(nPrim>=2)
21701  
21702  // 3-particle correlations:         
21703  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
21704  {
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    for(Int_t i2=0;i2<nPrim;i2++)
21711    {
21712     if(i2==i1)continue;
21713     aftsTrack=anEvent->GetTrack(i2);
21714     if(!(aftsTrack->InRPSelection())) continue;
21715     phi2=aftsTrack->Phi();
21716     for(Int_t i3=0;i3<nPrim;i3++)
21717     {
21718      if(i3==i1||i3==i2)continue;
21719      aftsTrack=anEvent->GetTrack(i3);
21720      if(!(aftsTrack->InRPSelection())) continue;
21721      phi3=aftsTrack->Phi();
21722      if(nPrim==3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush;
21723      // fill the profile with 3-p correlations:   
21724      fIntFlowDirectCorrelations->Fill(5.,cos(2.*n*phi1-n*(phi2+phi3)),1.);         //<3>_{2n|nn,n}
21725      fIntFlowDirectCorrelations->Fill(6.,cos(3.*n*phi1-2.*n*phi2-n*phi3),1.);      //<3>_{3n|2n,n}
21726      fIntFlowDirectCorrelations->Fill(7.,cos(4.*n*phi1-2.*n*phi2-2.*n*phi3),1.);   //<3>_{4n|2n,2n}
21727      fIntFlowDirectCorrelations->Fill(8.,cos(4.*n*phi1-3.*n*phi2-n*phi3),1.);      //<3>_{4n|3n,n}
21728      fIntFlowDirectCorrelations->Fill(36.5,cos(5.*n*phi1-3.*n*phi2-2.*n*phi3),1.); //<3>_{5n|3n,2n}
21729      fIntFlowDirectCorrelations->Fill(37.5,cos(5.*n*phi1-4.*n*phi2-1.*n*phi3),1.); //<3>_{5n|4n,1n}
21730      fIntFlowDirectCorrelations->Fill(38.5,cos(6.*n*phi1-3.*n*phi2-3.*n*phi3),1.); //<3>_{6n|3n,3n}
21731      fIntFlowDirectCorrelations->Fill(39.5,cos(6.*n*phi1-4.*n*phi2-2.*n*phi3),1.); //<3>_{6n|4n,2n}     
21732      fIntFlowDirectCorrelations->Fill(40.5,cos(6.*n*phi1-5.*n*phi2-1.*n*phi3),1.); //<3>_{6n|5n,1n}
21733     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21734    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21735   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21736  } // end of if(nPrim>=3)
21737
21738  // 4-particle correlations:
21739  if(nPrim>=4 && nPrim<=fMaxAllowedMultiplicity)
21740  {       
21741   for(Int_t i1=0;i1<nPrim;i1++)
21742   { 
21743    aftsTrack=anEvent->GetTrack(i1);
21744    if(!(aftsTrack->InRPSelection())) continue;
21745    phi1=aftsTrack->Phi();
21746    for(Int_t i2=0;i2<nPrim;i2++)
21747    {
21748     if(i2==i1)continue;
21749     aftsTrack=anEvent->GetTrack(i2);
21750     if(!(aftsTrack->InRPSelection())) continue;
21751     phi2=aftsTrack->Phi();
21752     for(Int_t i3=0;i3<nPrim;i3++)
21753     {
21754      if(i3==i1||i3==i2)continue;
21755      aftsTrack=anEvent->GetTrack(i3);
21756      if(!(aftsTrack->InRPSelection())) continue;
21757      phi3=aftsTrack->Phi();
21758      for(Int_t i4=0;i4<nPrim;i4++)
21759      {
21760       if(i4==i1||i4==i2||i4==i3)continue;
21761       aftsTrack=anEvent->GetTrack(i4);
21762       if(!(aftsTrack->InRPSelection())) continue;
21763       phi4=aftsTrack->Phi();
21764       if(nPrim==4) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<"\r"<<flush;
21765       // fill the profile with 4-p correlations:   
21766       fIntFlowDirectCorrelations->Fill(10.,cos(n*phi1+n*phi2-n*phi3-n*phi4),1.);            // <4>_{n,n|n,n} 
21767       fIntFlowDirectCorrelations->Fill(11.,cos(2.*n*phi1+n*phi2-2.*n*phi3-n*phi4),1.);      // <4>_{2n,n|2n,n}
21768       fIntFlowDirectCorrelations->Fill(12.,cos(2.*n*phi1+2*n*phi2-2.*n*phi3-2.*n*phi4),1.); // <4>_{2n,2n|2n,2n}
21769       fIntFlowDirectCorrelations->Fill(13.,cos(3.*n*phi1-n*phi2-n*phi3-n*phi4),1.);         // <4>_{3n|n,n,n}
21770       fIntFlowDirectCorrelations->Fill(14.,cos(3.*n*phi1+n*phi2-3.*n*phi3-n*phi4),1.);      // <4>_{3n,n|3n,n}   
21771       fIntFlowDirectCorrelations->Fill(15.,cos(3.*n*phi1+n*phi2-2.*n*phi3-2.*n*phi4),1.);   // <4>_{3n,n|2n,2n}
21772       fIntFlowDirectCorrelations->Fill(16.,cos(4.*n*phi1-2.*n*phi2-n*phi3-n*phi4),1.);      // <4>_{4n|2n,n,n}     
21773       fIntFlowDirectCorrelations->Fill(32.,cos(n*(4.*phi1+2.*phi2-3.*phi3-3.*phi4)),1.);    // <4>_{4n,2n|3n,3n}        
21774       fIntFlowDirectCorrelations->Fill(41.5,cos(n*(6.*phi1-3.*phi2-2.*phi3-1.*phi4)),1.);    // <4>_{6n|3n,2n,1n}  
21775       fIntFlowDirectCorrelations->Fill(42.5,cos(n*(3.*phi1+2.*phi2-3.*phi3-2.*phi4)),1.);    // <4>_{3n,2n|3n,2n}  
21776       fIntFlowDirectCorrelations->Fill(43.5,cos(n*(4.*phi1+1.*phi2-3.*phi3-2.*phi4)),1.);    // <4>_{4n,1n|3n,2n}  
21777       fIntFlowDirectCorrelations->Fill(44.5,cos(n*(3.*phi1+3.*phi2-3.*phi3-3.*phi4)),1.);    // <4>_{3n,3n|3n,3n}  
21778       fIntFlowDirectCorrelations->Fill(45.5,cos(n*(4.*phi1+2.*phi2-3.*phi3-3.*phi4)),1.);    // <4>_{4n,2n|3n,3n}  
21779       fIntFlowDirectCorrelations->Fill(46.5,cos(n*(5.*phi1+1.*phi2-3.*phi3-3.*phi4)),1.);    // <4>_{5n,1n|3n,3n}  
21780       fIntFlowDirectCorrelations->Fill(47.5,cos(n*(4.*phi1+2.*phi2-4.*phi3-2.*phi4)),1.);    // <4>_{4n,2n|4n,2n}     
21781       fIntFlowDirectCorrelations->Fill(48.5,cos(n*(5.*phi1+1.*phi2-4.*phi3-2.*phi4)),1.);    // <4>_{5n,1n|4n,2n}  
21782       fIntFlowDirectCorrelations->Fill(49.5,cos(n*(5.*phi1-3.*phi2-1.*phi3-1.*phi4)),1.);    // <4>_{5n|3n,1n,1n}  
21783       fIntFlowDirectCorrelations->Fill(50.5,cos(n*(5.*phi1-2.*phi2-2.*phi3-1.*phi4)),1.);    // <4>_{5n|2n,2n,1n}  
21784       fIntFlowDirectCorrelations->Fill(51.5,cos(n*(5.*phi1+1.*phi2-5.*phi3-1.*phi4)),1.);    // <4>_{5n,1n|5n,1n}        
21785       fIntFlowDirectCorrelations->Fill(58.5,cos(n*(6.*phi1-4.*phi2-1.*phi3-1.*phi4)),1.);    // <4>_{6n|4n,1n,1n}  
21786       fIntFlowDirectCorrelations->Fill(59.5,cos(n*(6.*phi1-2.*phi2-2.*phi3-2.*phi4)),1.);    // <4>_{6n|2n,2n,2n}  
21787      } // end of for(Int_t i4=0;i4<nPrim;i4++) 
21788     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21789    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21790   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21791  } // end of if(nPrim>=)
21792
21793  // 5-particle correlations:      
21794  if(nPrim>=5 && nPrim<=fMaxAllowedMultiplicity)
21795  {
21796   for(Int_t i1=0;i1<nPrim;i1++)
21797   {
21798    aftsTrack=anEvent->GetTrack(i1);
21799    if(!(aftsTrack->InRPSelection())) continue;  
21800    phi1=aftsTrack->Phi();
21801    for(Int_t i2=0;i2<nPrim;i2++)
21802    {
21803     if(i2==i1)continue;
21804     aftsTrack=anEvent->GetTrack(i2);
21805     if(!(aftsTrack->InRPSelection())) continue;
21806     phi2=aftsTrack->Phi();
21807     for(Int_t i3=0;i3<nPrim;i3++)
21808     {
21809      if(i3==i1||i3==i2)continue;
21810      aftsTrack=anEvent->GetTrack(i3);
21811      if(!(aftsTrack->InRPSelection())) continue;
21812      phi3=aftsTrack->Phi();
21813      for(Int_t i4=0;i4<nPrim;i4++)
21814      {
21815       if(i4==i1||i4==i2||i4==i3)continue;
21816       aftsTrack=anEvent->GetTrack(i4);
21817       if(!(aftsTrack->InRPSelection())) continue;
21818       phi4=aftsTrack->Phi();
21819       for(Int_t i5=0;i5<nPrim;i5++)
21820       {
21821        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
21822        aftsTrack=anEvent->GetTrack(i5);
21823        if(!(aftsTrack->InRPSelection())) continue;
21824        phi5=aftsTrack->Phi();
21825        if(nPrim==5) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<"\r"<<flush;
21826        // fill the profile with 5-p correlations:   
21827        fIntFlowDirectCorrelations->Fill(18.,cos(2.*n*phi1+n*phi2-n*phi3-n*phi4-n*phi5),1.);              // <5>_{2n,n|n,n,n}
21828        fIntFlowDirectCorrelations->Fill(19.,cos(2.*n*phi1+2.*n*phi2-2.*n*phi3-n*phi4-n*phi5),1.);        // <5>_{2n,2n|2n,n,n}
21829        fIntFlowDirectCorrelations->Fill(20.,cos(3.*n*phi1+n*phi2-2.*n*phi3-n*phi4-n*phi5),1.);           // <5>_{3n,n|2n,n,n}
21830        fIntFlowDirectCorrelations->Fill(21.,cos(4.*n*phi1-n*phi2-n*phi3-n*phi4-n*phi5),1.);              // <5>_{4n|n,n,n,n}
21831        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}       
21832        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}      
21833        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}       
21834        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}
21835        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}
21836        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}              
21837        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}
21838        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}              
21839       } // end of for(Int_t i5=0;i5<nPrim;i5++)
21840      } // end of for(Int_t i4=0;i4<nPrim;i4++)  
21841     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21842    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21843   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21844  } // end of if(nPrim>=5)
21845   
21846  // 6-particle correlations:
21847  if(nPrim>=6 && nPrim<=fMaxAllowedMultiplicity)
21848  {
21849   for(Int_t i1=0;i1<nPrim;i1++)
21850   {
21851    aftsTrack=anEvent->GetTrack(i1);
21852    if(!(aftsTrack->InRPSelection())) continue;
21853    phi1=aftsTrack->Phi();
21854    for(Int_t i2=0;i2<nPrim;i2++)
21855    {
21856     if(i2==i1)continue;
21857     aftsTrack=anEvent->GetTrack(i2);
21858     if(!(aftsTrack->InRPSelection())) continue;
21859     phi2=aftsTrack->Phi();
21860     for(Int_t i3=0;i3<nPrim;i3++)
21861     {
21862      if(i3==i1||i3==i2)continue;
21863      aftsTrack=anEvent->GetTrack(i3);
21864      if(!(aftsTrack->InRPSelection())) continue;
21865      phi3=aftsTrack->Phi();
21866      for(Int_t i4=0;i4<nPrim;i4++)
21867      {
21868       if(i4==i1||i4==i2||i4==i3)continue;
21869       aftsTrack=anEvent->GetTrack(i4);
21870       if(!(aftsTrack->InRPSelection())) continue;
21871       phi4=aftsTrack->Phi();
21872       for(Int_t i5=0;i5<nPrim;i5++)
21873       {
21874        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
21875        aftsTrack=anEvent->GetTrack(i5);
21876        if(!(aftsTrack->InRPSelection())) continue;
21877        phi5=aftsTrack->Phi();
21878        for(Int_t i6=0;i6<nPrim;i6++)
21879        {
21880         if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5)continue;
21881         aftsTrack=anEvent->GetTrack(i6);
21882         if(!(aftsTrack->InRPSelection())) continue;
21883         phi6=aftsTrack->Phi(); 
21884         if(nPrim==6) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<" "<<i6<<"\r"<<flush;
21885         // fill the profile with 6-p correlations:   
21886         fIntFlowDirectCorrelations->Fill(23.,cos(n*phi1+n*phi2+n*phi3-n*phi4-n*phi5-n*phi6),1.);                    // <6>_{1n,1n,1n|1n,1n,1n}
21887         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}
21888         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}
21889         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}  
21890         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}  
21891         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}  
21892        } // end of for(Int_t i6=0;i6<nPrim;i6++)
21893       } // end of for(Int_t i5=0;i5<nPrim;i5++)
21894      } // end of for(Int_t i4=0;i4<nPrim;i4++)
21895     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21896    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21897   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21898  } // end of if(nPrim>=6)
21899   
21900  // 7-particle correlations:
21901  if(nPrim>=7 && nPrim<=fMaxAllowedMultiplicity)
21902  {
21903   for(Int_t i1=0;i1<nPrim;i1++)
21904   { 
21905    aftsTrack=anEvent->GetTrack(i1);
21906    if(!(aftsTrack->InRPSelection())) continue;
21907    phi1=aftsTrack->Phi();
21908    for(Int_t i2=0;i2<nPrim;i2++)
21909    {
21910     if(i2==i1)continue;
21911     aftsTrack=anEvent->GetTrack(i2);
21912     if(!(aftsTrack->InRPSelection())) continue;
21913     phi2=aftsTrack->Phi();
21914     for(Int_t i3=0;i3<nPrim;i3++)
21915     {
21916      if(i3==i1||i3==i2)continue;
21917      aftsTrack=anEvent->GetTrack(i3);
21918      if(!(aftsTrack->InRPSelection())) continue;
21919      phi3=aftsTrack->Phi();
21920      for(Int_t i4=0;i4<nPrim;i4++)
21921      {
21922       if(i4==i1||i4==i2||i4==i3)continue;
21923       aftsTrack=anEvent->GetTrack(i4);
21924       if(!(aftsTrack->InRPSelection())) continue;
21925       phi4=aftsTrack->Phi();
21926       for(Int_t i5=0;i5<nPrim;i5++)
21927       {
21928        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
21929        aftsTrack=anEvent->GetTrack(i5);
21930        if(!(aftsTrack->InRPSelection())) continue;
21931        phi5=aftsTrack->Phi();
21932        for(Int_t i6=0;i6<nPrim;i6++)
21933        {
21934         if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5)continue;
21935         aftsTrack=anEvent->GetTrack(i6);
21936         if(!(aftsTrack->InRPSelection())) continue;
21937         phi6=aftsTrack->Phi(); 
21938         for(Int_t i7=0;i7<nPrim;i7++)
21939         {
21940          if(i7==i1||i7==i2||i7==i3||i7==i4||i7==i5||i7==i6)continue;
21941          aftsTrack=anEvent->GetTrack(i7);
21942          if(!(aftsTrack->InRPSelection())) continue;
21943          phi7=aftsTrack->Phi(); 
21944          if(nPrim==7) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<" "<<i6<<" "<<i7<<"\r"<<flush;
21945          // fill the profile with 7-p correlation:   
21946          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}
21947         } // end of for(Int_t i7=0;i7<nPrim;i7++)
21948        } // end of for(Int_t i6=0;i6<nPrim;i6++) 
21949       } // end of for(Int_t i5=0;i5<nPrim;i5++)
21950      } // end of for(Int_t i4=0;i4<nPrim;i4++)  
21951     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21952    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21953   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21954  } // end of if(nPrim>=7)
21955  
21956  // 8-particle correlations:
21957  if(nPrim>=8 && nPrim<=fMaxAllowedMultiplicity)
21958  {
21959   for(Int_t i1=0;i1<nPrim;i1++)
21960   {
21961    aftsTrack=anEvent->GetTrack(i1);
21962    if(!(aftsTrack->InRPSelection())) continue;
21963    phi1=aftsTrack->Phi();
21964    for(Int_t i2=0;i2<nPrim;i2++)
21965    {
21966     if(i2==i1)continue;
21967     aftsTrack=anEvent->GetTrack(i2);
21968     if(!(aftsTrack->InRPSelection())) continue;
21969     phi2=aftsTrack->Phi();
21970     for(Int_t i3=0;i3<nPrim;i3++)
21971     {
21972      if(i3==i1||i3==i2)continue;
21973      aftsTrack=anEvent->GetTrack(i3);
21974      if(!(aftsTrack->InRPSelection())) continue;
21975      phi3=aftsTrack->Phi();
21976      for(Int_t i4=0;i4<nPrim;i4++)
21977      {
21978       if(i4==i1||i4==i2||i4==i3)continue;
21979       aftsTrack=anEvent->GetTrack(i4);
21980       if(!(aftsTrack->InRPSelection())) continue;
21981       phi4=aftsTrack->Phi();
21982       for(Int_t i5=0;i5<nPrim;i5++)
21983       {
21984        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
21985        aftsTrack=anEvent->GetTrack(i5);
21986        if(!(aftsTrack->InRPSelection())) continue;
21987        phi5=aftsTrack->Phi();
21988        for(Int_t i6=0;i6<nPrim;i6++)
21989        {
21990         if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5)continue;
21991         aftsTrack=anEvent->GetTrack(i6);
21992         if(!(aftsTrack->InRPSelection())) continue;
21993         phi6=aftsTrack->Phi();
21994         for(Int_t i7=0;i7<nPrim;i7++)
21995         {
21996          if(i7==i1||i7==i2||i7==i3||i7==i4||i7==i5||i7==i6)continue;
21997          aftsTrack=anEvent->GetTrack(i7);
21998          if(!(aftsTrack->InRPSelection())) continue;
21999          phi7=aftsTrack->Phi();
22000          for(Int_t i8=0;i8<nPrim;i8++)
22001          {
22002           if(i8==i1||i8==i2||i8==i3||i8==i4||i8==i5||i8==i6||i8==i7)continue;
22003           aftsTrack=anEvent->GetTrack(i8);
22004           if(!(aftsTrack->InRPSelection())) continue;
22005           phi8=aftsTrack->Phi();
22006           cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<" "<<i6<<" "<<i7<<" "<<i8<<"\r"<<flush;
22007           // fill the profile with 8-p correlation:   
22008           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}
22009          } // end of for(Int_t i8=0;i8<nPrim;i8++)
22010         } // end of for(Int_t i7=0;i7<nPrim;i7++) 
22011        } // end of for(Int_t i6=0;i6<nPrim;i6++) 
22012       } // end of for(Int_t i5=0;i5<nPrim;i5++)
22013      } // end of for(Int_t i4=0;i4<nPrim;i4++)  
22014     } // end of for(Int_t i3=0;i3<nPrim;i3++)
22015    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22016   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22017  } // end of if(nPrim>=8)
22018  
22019  cout<<endl;
22020
22021 } // end of AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrelationsWithNestedLoops(AliFlowEventSimple* anEvent)
22022
22023 //================================================================================================================
22024
22025 void AliFlowAnalysisWithQCumulants::EvaluateMixedHarmonicsWithNestedLoops(AliFlowEventSimple * const anEvent)
22026 {
22027  // Evaluate with nested loops multi-particle correlations for mixed harmonics. 
22028   
22029  Int_t nPrim = anEvent->NumberOfTracks(); 
22030  AliFlowTrackSimple *aftsTrack = NULL; 
22031  Double_t phi1=0.;
22032  Double_t phi2=0.; 
22033  Double_t phi3=0.;
22034  Double_t phi4=0.;
22035  Double_t phi5=0.;
22036  /*Double_t phi6=0.;
22037  Double_t phi7=0.;
22038  Double_t phi8=0.;*/ 
22039  Int_t n = fHarmonic; 
22040  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // TBI: is such casting safe in general?
22041  Double_t dMult = (*fSpk)(0,0);
22042  cout<<endl;
22043  cout<<"Multiparticle correlations: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
22044  if(dMult<2)
22045  {
22046   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
22047  } else if (dMult>fMaxAllowedMultiplicity)
22048    {
22049     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
22050    } else 
22051      { 
22052       cout<<"... evaluating nested loops (without using particle weights)..."<<endl;
22053      } 
22054  
22055  // 2-particle correlations:       
22056  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
22057  {
22058   for(Int_t i1=0;i1<nPrim;i1++)
22059   {
22060    aftsTrack=anEvent->GetTrack(i1);
22061    if(!(aftsTrack->InRPSelection())) continue;
22062    phi1=aftsTrack->Phi(); 
22063    for(Int_t i2=0;i2<nPrim;i2++)
22064    {
22065     if(i2==i1)continue;
22066     aftsTrack=anEvent->GetTrack(i2);
22067     if(!(aftsTrack->InRPSelection())) continue;
22068     phi2=aftsTrack->Phi();
22069     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
22070     // Fill the profile fMixedHarmonicsNestedLoops with 2-p correlations: 
22071     fMixedHarmonicsNestedLoops->Fill(0.5,cos(1.*n*(phi1-phi2)),1.); // <cos(1n*(phi1-phi2))>
22072     fMixedHarmonicsNestedLoops->Fill(1.5,cos(2.*n*(phi1-phi2)),1.); // <cos(2n*(phi1-phi2))>
22073     fMixedHarmonicsNestedLoops->Fill(2.5,cos(3.*n*(phi1-phi2)),1.); // <cos(3n*(phi1-phi2))>
22074     fMixedHarmonicsNestedLoops->Fill(3.5,cos(4.*n*(phi1-phi2)),1.); // <cos(4n*(phi1-phi2))>   
22075     fMixedHarmonicsNestedLoops->Fill(4.5,cos(5.*n*(phi1-phi2)),1.); // <cos(5n*(phi1-phi2))>
22076     fMixedHarmonicsNestedLoops->Fill(5.5,cos(6.*n*(phi1-phi2)),1.); // <cos(6n*(phi1-phi2))>   
22077    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22078   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22079  } // end of if(nPrim>=2)
22080  
22081  // 3-particle correlations:         
22082  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
22083  {
22084   for(Int_t i1=0;i1<nPrim;i1++)
22085   {
22086    aftsTrack=anEvent->GetTrack(i1);
22087    if(!(aftsTrack->InRPSelection())) continue;
22088    phi1=aftsTrack->Phi();
22089    for(Int_t i2=0;i2<nPrim;i2++)
22090    {
22091     if(i2==i1)continue;
22092     aftsTrack=anEvent->GetTrack(i2);
22093     if(!(aftsTrack->InRPSelection())) continue;
22094     phi2=aftsTrack->Phi();
22095     for(Int_t i3=0;i3<nPrim;i3++)
22096     {
22097      if(i3==i1||i3==i2)continue;
22098      aftsTrack=anEvent->GetTrack(i3);
22099      if(!(aftsTrack->InRPSelection())) continue;
22100      phi3=aftsTrack->Phi();
22101      if(nPrim==3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush;
22102      // Fill the profile fMixedHarmonicsNestedLoops with 3-p correlations:  
22103      fMixedHarmonicsNestedLoops->Fill( 6.5,cos(2.*n*phi1-n*(phi2+phi3)),1.);       // <3>_{2n|1n,1n}
22104      fMixedHarmonicsNestedLoops->Fill( 7.5,cos(4.*n*phi1-2.*n*phi2-2.*n*phi3),1.); // <3>_{4n|2n,2n}
22105      fMixedHarmonicsNestedLoops->Fill( 8.5,cos(6.*n*phi1-3.*n*phi2-3.*n*phi3),1.); // <3>_{6n|3n,3n}
22106      fMixedHarmonicsNestedLoops->Fill(10.5,cos(3.*n*phi1-2.*n*phi2-n*phi3),1.);    // <3>_{3n|2n,1n}   
22107      fMixedHarmonicsNestedLoops->Fill(11.5,cos(4.*n*phi1-3.*n*phi2-1.*n*phi3),1.); // <3>_{4n|3n,1n}
22108      fMixedHarmonicsNestedLoops->Fill(12.5,cos(5.*n*phi1-3.*n*phi2-2.*n*phi3),1.); // <3>_{5n|3n,2n}
22109      fMixedHarmonicsNestedLoops->Fill(13.5,cos(5.*n*phi1-4.*n*phi2-1.*n*phi3),1.); // <3>_{5n|4n,1n}
22110      fMixedHarmonicsNestedLoops->Fill(14.5,cos(6.*n*phi1-4.*n*phi2-2.*n*phi3),1.); // <3>_{6n|4n,2n}     
22111      fMixedHarmonicsNestedLoops->Fill(15.5,cos(6.*n*phi1-5.*n*phi2-1.*n*phi3),1.); // <3>_{6n|5n,1n}
22112     } // end of for(Int_t i3=0;i3<nPrim;i3++)
22113    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22114   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22115  } // end of if(nPrim>=3)
22116
22117  // 4-particle correlations:
22118  if(nPrim>=4 && nPrim<=fMaxAllowedMultiplicity)
22119  {       
22120   for(Int_t i1=0;i1<nPrim;i1++)
22121   { 
22122    aftsTrack=anEvent->GetTrack(i1);
22123    if(!(aftsTrack->InRPSelection())) continue;
22124    phi1=aftsTrack->Phi();
22125    for(Int_t i2=0;i2<nPrim;i2++)
22126    {
22127     if(i2==i1)continue;
22128     aftsTrack=anEvent->GetTrack(i2);
22129     if(!(aftsTrack->InRPSelection())) continue;
22130     phi2=aftsTrack->Phi();
22131     for(Int_t i3=0;i3<nPrim;i3++)
22132     {
22133      if(i3==i1||i3==i2)continue;
22134      aftsTrack=anEvent->GetTrack(i3);
22135      if(!(aftsTrack->InRPSelection())) continue;
22136      phi3=aftsTrack->Phi();
22137      for(Int_t i4=0;i4<nPrim;i4++)
22138      {
22139       if(i4==i1||i4==i2||i4==i3)continue;
22140       aftsTrack=anEvent->GetTrack(i4);
22141       if(!(aftsTrack->InRPSelection())) continue;
22142       phi4=aftsTrack->Phi();
22143       if(nPrim==4) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<"\r"<<flush;
22144       // fill the profile with 4-p correlations:   
22145       fMixedHarmonicsNestedLoops->Fill(16.5,cos(1.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{1n,1n|1n,1n} 
22146       fMixedHarmonicsNestedLoops->Fill(17.5,cos(2.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{2n,2n|2n,2n} 
22147       fMixedHarmonicsNestedLoops->Fill(18.5,cos(3.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{3n,3n|3n,3n} 
22148       fMixedHarmonicsNestedLoops->Fill(19.5,cos(4.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{4n,4n|4n,4n} 
22149       fMixedHarmonicsNestedLoops->Fill(20.5,cos(5.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{5n,5n|5n,5n} 
22150       fMixedHarmonicsNestedLoops->Fill(21.5,cos(6.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{6n,6n|6n,6n} 
22151       fMixedHarmonicsNestedLoops->Fill(23.5,cos(n*(2.*phi1+1.*phi2-2.*phi3-1.*phi4)),1.); // <4>_{2n,1n|2n,1n} 
22152       fMixedHarmonicsNestedLoops->Fill(24.5,cos(n*(3.*phi1+1.*phi2-3.*phi3-1.*phi4)),1.); // <4>_{3n,1n|3n,1n} 
22153       fMixedHarmonicsNestedLoops->Fill(25.5,cos(n*(3.*phi1+2.*phi2-3.*phi3-2.*phi4)),1.); // <4>_{3n,2n|3n,2n} 
22154       fMixedHarmonicsNestedLoops->Fill(26.5,cos(n*(4.*phi1+1.*phi2-4.*phi3-1.*phi4)),1.); // <4>_{4n,1n|4n,1n} 
22155       fMixedHarmonicsNestedLoops->Fill(27.5,cos(n*(4.*phi1+2.*phi2-4.*phi3-2.*phi4)),1.); // <4>_{4n,2n|4n,2n} 
22156       fMixedHarmonicsNestedLoops->Fill(28.5,cos(n*(4.*phi1+3.*phi2-4.*phi3-3.*phi4)),1.); // <4>_{4n,3n|4n,3n} 
22157       fMixedHarmonicsNestedLoops->Fill(29.5,cos(n*(5.*phi1+1.*phi2-5.*phi3-1.*phi4)),1.); // <4>_{5n,1n|5n,1n} 
22158       fMixedHarmonicsNestedLoops->Fill(30.5,cos(n*(5.*phi1+2.*phi2-5.*phi3-2.*phi4)),1.); // <4>_{5n,2n|5n,2n} 
22159       fMixedHarmonicsNestedLoops->Fill(31.5,cos(n*(5.*phi1+3.*phi2-5.*phi3-3.*phi4)),1.); // <4>_{5n,3n|5n,3n} 
22160       fMixedHarmonicsNestedLoops->Fill(32.5,cos(n*(5.*phi1+4.*phi2-5.*phi3-4.*phi4)),1.); // <4>_{5n,4n|5n,4n} 
22161       fMixedHarmonicsNestedLoops->Fill(33.5,cos(n*(6.*phi1+1.*phi2-6.*phi3-1.*phi4)),1.); // <4>_{6n,1n|6n,1n} 
22162       fMixedHarmonicsNestedLoops->Fill(34.5,cos(n*(6.*phi1+2.*phi2-6.*phi3-2.*phi4)),1.); // <4>_{6n,2n|6n,2n} 
22163       fMixedHarmonicsNestedLoops->Fill(35.5,cos(n*(6.*phi1+3.*phi2-6.*phi3-3.*phi4)),1.); // <4>_{6n,3n|6n,3n} 
22164       fMixedHarmonicsNestedLoops->Fill(36.5,cos(n*(6.*phi1+4.*phi2-6.*phi3-4.*phi4)),1.); // <4>_{6n,4n|6n,4n} 
22165       fMixedHarmonicsNestedLoops->Fill(37.5,cos(n*(6.*phi1+5.*phi2-6.*phi3-5.*phi4)),1.); // <4>_{6n,5n|6n,5n} 
22166       fMixedHarmonicsNestedLoops->Fill(39.5,cos(n*(3.*phi1-1.*phi2-1.*phi3-1.*phi4)),1.); // <4>_{3n|1n,1n,1n} 
22167       fMixedHarmonicsNestedLoops->Fill(40.5,cos(n*(6.*phi1-2.*phi2-2.*phi3-2.*phi4)),1.); // <4>_{6n|2n,2n,2n} 
22168       fMixedHarmonicsNestedLoops->Fill(42.5,cos(n*(3.*phi1+1.*phi2-2.*phi3-2.*phi4)),1.); // <4>_{3n,1n|2n,2n} 
22169       fMixedHarmonicsNestedLoops->Fill(43.5,cos(n*(4.*phi1-2.*phi2-1.*phi3-1.*phi4)),1.); // <4>_{4n|2n,1n,1n} 
22170       fMixedHarmonicsNestedLoops->Fill(44.5,cos(n*(4.*phi1+2.*phi2-3.*phi3-3.*phi4)),1.); // <4>_{4n,2n|3n,3n} 
22171       fMixedHarmonicsNestedLoops->Fill(45.5,cos(n*(5.*phi1-2.*phi2-2.*phi3-1.*phi4)),1.); // <4>_{5n|2n,2n,1n} 
22172       fMixedHarmonicsNestedLoops->Fill(46.5,cos(n*(5.*phi1-3.*phi2-1.*phi3-1.*phi4)),1.); // <4>_{5n|3n,1n,1n} 
22173       fMixedHarmonicsNestedLoops->Fill(47.5,cos(n*(5.*phi1+1.*phi2-3.*phi3-3.*phi4)),1.); // <4>_{5n,1n|3n,3n} 
22174       fMixedHarmonicsNestedLoops->Fill(48.5,cos(n*(5.*phi1+3.*phi2-4.*phi3-4.*phi4)),1.); // <4>_{5n,3n|4n,4n} 
22175       fMixedHarmonicsNestedLoops->Fill(49.5,cos(n*(6.*phi1-4.*phi2-1.*phi3-1.*phi4)),1.); // <4>_{6n|4n,1n,1n} 
22176       fMixedHarmonicsNestedLoops->Fill(50.5,cos(n*(6.*phi1+2.*phi2-4.*phi3-4.*phi4)),1.); // <4>_{6n,2n|4n,4n} 
22177       fMixedHarmonicsNestedLoops->Fill(51.5,cos(n*(6.*phi1+4.*phi2-5.*phi3-5.*phi4)),1.); // <4>_{6n,4n|5n,5n} 
22178       fMixedHarmonicsNestedLoops->Fill(53.5,cos(n*(4.*phi1+1.*phi2-3.*phi3-2.*phi4)),1.); // <4>_{4n,1n|3n,2n} 
22179       fMixedHarmonicsNestedLoops->Fill(54.5,cos(n*(5.*phi1+1.*phi2-4.*phi3-2.*phi4)),1.); // <4>_{5n,1n|4n,2n} 
22180       fMixedHarmonicsNestedLoops->Fill(55.5,cos(n*(5.*phi1+2.*phi2-4.*phi3-3.*phi4)),1.); // <4>_{5n,2n|4n,3n} 
22181       fMixedHarmonicsNestedLoops->Fill(56.5,cos(n*(6.*phi1+1.*phi2-4.*phi3-3.*phi4)),1.); // <4>_{6n,1n|4n,3n} 
22182       fMixedHarmonicsNestedLoops->Fill(57.5,cos(n*(6.*phi1+1.*phi2-5.*phi3-2.*phi4)),1.); // <4>_{6n,1n|5n,2n} 
22183       fMixedHarmonicsNestedLoops->Fill(58.5,cos(n*(6.*phi1-3.*phi2-2.*phi3-1.*phi4)),1.); // <4>_{6n|3n,2n,1n} 
22184       fMixedHarmonicsNestedLoops->Fill(59.5,cos(n*(6.*phi1+2.*phi2-5.*phi3-3.*phi4)),1.); // <4>_{6n,2n|5n,3n} 
22185       fMixedHarmonicsNestedLoops->Fill(60.5,cos(n*(6.*phi1+3.*phi2-5.*phi3-4.*phi4)),1.); // <4>_{6n,3n|5n,4n} 
22186      } // end of for(Int_t i4=0;i4<nPrim;i4++) 
22187     } // end of for(Int_t i3=0;i3<nPrim;i3++)
22188    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22189   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22190  } // end of if(nPrim>=)
22191
22192  // 5-particle correlations:      
22193  if(nPrim>=5 && nPrim<=fMaxAllowedMultiplicity)
22194  {
22195   for(Int_t i1=0;i1<nPrim;i1++)
22196   {
22197    aftsTrack=anEvent->GetTrack(i1);
22198    if(!(aftsTrack->InRPSelection())) continue;  
22199    phi1=aftsTrack->Phi();
22200    for(Int_t i2=0;i2<nPrim;i2++)
22201    {
22202     if(i2==i1)continue;
22203     aftsTrack=anEvent->GetTrack(i2);
22204     if(!(aftsTrack->InRPSelection())) continue;
22205     phi2=aftsTrack->Phi();
22206     for(Int_t i3=0;i3<nPrim;i3++)
22207     {
22208      if(i3==i1||i3==i2)continue;
22209      aftsTrack=anEvent->GetTrack(i3);
22210      if(!(aftsTrack->InRPSelection())) continue;
22211      phi3=aftsTrack->Phi();
22212      for(Int_t i4=0;i4<nPrim;i4++)
22213      {
22214       if(i4==i1||i4==i2||i4==i3)continue;
22215       aftsTrack=anEvent->GetTrack(i4);
22216       if(!(aftsTrack->InRPSelection())) continue;
22217       phi4=aftsTrack->Phi();
22218       for(Int_t i5=0;i5<nPrim;i5++)
22219       {
22220        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
22221        aftsTrack=anEvent->GetTrack(i5);
22222        if(!(aftsTrack->InRPSelection())) continue;
22223        phi5=aftsTrack->Phi();
22224        if(nPrim==5) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<"\r"<<flush;
22225        // fill the profile with 5-p correlations:   
22226        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))>
22227        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))>
22228        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))>
22229        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))>
22230        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))>
22231        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))>
22232        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))>
22233        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))>
22234        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))>
22235        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))>
22236        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))>
22237        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))>
22238        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))>
22239        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))>
22240        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))>
22241        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))>
22242        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))>
22243        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))>
22244        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))>
22245        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))>
22246        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))>
22247        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))>
22248        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))>
22249        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))>
22250        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))>
22251        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))>
22252        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))>
22253        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))>
22254        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))>
22255        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))>
22256        //fMixedHarmonicsNestedLoops->Fill(91.5,-44.,1.); // empty
22257        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))>
22258        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))>
22259        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))>
22260        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))>
22261        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))>
22262        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))>
22263        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))>
22264        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))>
22265        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))>
22266        //fMixedHarmonicsNestedLoops->Fill(101.5,-44.,1.); // empty
22267        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))>
22268        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))>
22269        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))>
22270        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))>
22271        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))>
22272        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))>
22273        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))>
22274        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))>
22275        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))>
22276        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))>
22277        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))>
22278        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))>
22279        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))>
22280        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))>
22281        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))>
22282        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))>
22283        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))>
22284        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))>
22285        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))>
22286        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))>
22287        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))>
22288        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))>
22289        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))>
22290        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))>
22291        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))>
22292        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))>
22293        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))>
22294        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))>
22295        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))>
22296        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
22297        //fMixedHarmonicsNestedLoops->Fill(132.5,-44.,1.); // empty
22298        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))>
22299        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))>
22300        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))>
22301        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))>
22302        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))>
22303        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))>
22304        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))>
22305        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))>
22306        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))>
22307        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))>
22308        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))>
22309        //fMixedHarmonicsNestedLoops->Fill(144.5,-44.,1.); // empty
22310        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))>
22311        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))>
22312        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))>
22313       } // end of for(Int_t i5=0;i5<nPrim;i5++)
22314      } // end of for(Int_t i4=0;i4<nPrim;i4++)  
22315     } // end of for(Int_t i3=0;i3<nPrim;i3++)
22316    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22317   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22318  } // end of if(nPrim>=5)
22319
22320  // QW44
22321
22322 } // end of void AliFlowAnalysisWithQCumulants::EvaluateMixedHarmonicsWithNestedLoops(AliFlowEventSimple * const anEvent)
22323
22324 //================================================================================================================
22325
22326 void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowCorrelations()
22327 {
22328  // Cross-check results for multiparticle correlations needed for int. flow: results from Q-vectors vs results from nested loops.
22329
22330  cout<<endl;
22331  cout<<endl;
22332  cout<<"   *****************************************"<<endl;
22333  cout<<"   **** cross-checking the correlations ****"<<endl;
22334  cout<<"   ****       for integrated flow       ****"<<endl;
22335  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
22336  {
22337   cout<<"   ****   (particle weights not used)   ****"<<endl;
22338  } else
22339    {
22340     cout<<"   ****     (particle weights used)     ****"<<endl;
22341    } 
22342  cout<<"   *****************************************"<<endl;
22343  cout<<endl;
22344  cout<<endl;
22345
22346  Int_t ciMax = 64; // to be improved (removed eventually when I calculate 6th and 8th order with particle weights)
22347  
22348  if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
22349  {
22350   ciMax = 11;
22351  }
22352
22353  for(Int_t ci=1;ci<=ciMax;ci++)
22354  {
22355   if(strcmp((fIntFlowCorrelationsAllPro->GetXaxis())->GetBinLabel(ci), "") == 0) continue; // to be improved (access finalized histogram here)
22356   cout<<(fIntFlowCorrelationsAllPro->GetXaxis())->GetBinLabel(ci)<<":"<<endl; // to be improved (access finalized histogram here)
22357   cout<<"from Q-vectors    = "<<fIntFlowCorrelationsAllPro->GetBinContent(ci)<<endl; // to be improved (access finalized histogram here)
22358   cout<<"from nested loops = "<<fIntFlowDirectCorrelations->GetBinContent(ci)<<endl;
22359   cout<<endl;
22360  }
22361
22362  if(!fCalculateMixedHarmonics){return;}
22363
22364  cout<<endl;
22365  cout<<endl;
22366  cout<<"   *****************************************"<<endl;
22367  cout<<"   **** cross-checking the correlations ****"<<endl;
22368  cout<<"   ****       for mixed harmonics       ****"<<endl;
22369  cout<<"   *****************************************"<<endl;
22370  cout<<endl;
22371  cout<<endl;
22372
22373  // 2-p:
22374  for(Int_t ci=1;ci<=6;ci++)
22375  {
22376   cout<<(f2pCorrelations->GetXaxis())->GetBinLabel(ci)<<":"<<endl;
22377   cout<<"from Q-vectors    = "<<f2pCorrelations->GetBinContent(ci)<<endl; 
22378   cout<<"from nested loops = "<<fMixedHarmonicsNestedLoops->GetBinContent(ci)<<endl;
22379   cout<<endl;
22380  } // end of for(Int_t ci=1;ci<=6;ci++)
22381
22382  // 3-p:
22383  for(Int_t ci=1;ci<=10;ci++)
22384  {
22385   if(4==ci){continue;} // skipping the empty bins
22386   cout<<(f3pCorrelations->GetXaxis())->GetBinLabel(ci)<<":"<<endl;
22387   cout<<"from Q-vectors    = "<<f3pCorrelations->GetBinContent(ci)<<endl; 
22388   cout<<"from nested loops = "<<fMixedHarmonicsNestedLoops->GetBinContent(ci+6)<<endl;
22389   cout<<endl;
22390  } // end of for(Int_t ci=1;ci<=10;ci++)
22391
22392  // 4-p:
22393  for(Int_t ci=1;ci<=45;ci++)
22394  {
22395   if(7==ci||23==ci||26==ci||37==ci){continue;} // skipping the empty bins
22396   cout<<(f4pCorrelations->GetXaxis())->GetBinLabel(ci)<<":"<<endl;
22397   cout<<"from Q-vectors    = "<<f4pCorrelations->GetBinContent(ci)<<endl; 
22398   cout<<"from nested loops = "<<fMixedHarmonicsNestedLoops->GetBinContent(ci+6+10)<<endl;
22399   //if(TMath::Abs(f4pCorrelations->GetBinContent(ci)-fMixedHarmonicsNestedLoops->GetBinContent(ci+6+10))
22400   //   > 1.e-10){exit(0);}
22401   cout<<endl;
22402  } // end of for(Int_t ci=1;ci<=45;ci++)
22403
22404  for(Int_t ci=1;ci<=87;ci++)
22405  {
22406   if(31==ci||41==ci||72==ci||84==ci){continue;} // skipping the empty bins
22407   cout<<(f5pCorrelations->GetXaxis())->GetBinLabel(ci)<<":"<<endl;
22408   cout<<"from Q-vectors    = "<<f5pCorrelations->GetBinContent(ci)<<endl; 
22409   cout<<"from nested loops = "<<fMixedHarmonicsNestedLoops->GetBinContent(ci+6+10+45)<<endl;
22410   if(TMath::Abs(f5pCorrelations->GetBinContent(ci)-fMixedHarmonicsNestedLoops->GetBinContent(ci+6+10+45))
22411      > 1.e-10){exit(0);}
22412   cout<<endl;
22413  } // end of for(Int_t ci=1;ci<=87;ci++)
22414
22415  return;
22416
22417 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowCorrelations()
22418
22419 //=======================================================================================================================
22420
22421 void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowCorrectionTermsForNUA()
22422 {
22423  // Cross-check results for corrections terms for non-uniform acceptance needed for int. flow: results from Q-vectors vs results from nested loops.
22424
22425  cout<<endl;
22426  cout<<endl;
22427  cout<<"   *********************************************"<<endl;
22428  cout<<"   **** cross-checking the correction terms ****"<<endl;
22429  cout<<"   **** for non-uniform acceptance relevant ****"<<endl;
22430  cout<<"   ****         for integrated flow         ****"<<endl;
22431  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
22432  {
22433   cout<<"   ****     (particle weights not used)     ****"<<endl;
22434  } else
22435    {
22436     cout<<"   ****       (particle weights used)       ****"<<endl;
22437    } 
22438  cout<<"   *********************************************"<<endl;
22439  cout<<endl;
22440  cout<<endl;
22441
22442  for(Int_t ci=1;ci<=4;ci++) // correction term index (to be improved - hardwired 4)
22443  {
22444   for(Int_t sc=0;sc<2;sc++) // sin or cos term
22445   {
22446    if(strcmp((fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->GetBinLabel(ci), "") == 0) continue; // to be improved (access finalized histogram here)
22447    cout<<(fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->GetBinLabel(ci)<<":"<<endl; // to be improved (access finalized histogram here)
22448    cout<<"from Q-vectors    = "<<fIntFlowCorrectionTermsForNUAPro[sc]->GetBinContent(ci)<<endl; // to be improved (access finalized histogram here)
22449    cout<<"from nested loops = "<<fIntFlowDirectCorrectionTermsForNUA[sc]->GetBinContent(ci)<<endl;
22450    cout<<endl;
22451   } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos term
22452  } // end of for(Int_t ci=1;ci<=10;ci++) // correction term index
22453   
22454 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowCorrectionTermsForNUA() 
22455
22456 //=======================================================================================================================
22457
22458 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrelationsWithNestedLoopsUsingParticleWeights(AliFlowEventSimple * const anEvent)
22459 {
22460  // Evaluate with nested loops multiparticle correlations for integrated flow (using the particle weights). 
22461
22462  // Results are stored in profile fIntFlowDirectCorrelations. 
22463  // Remark 1: When particle weights are used the binning of fIntFlowDirectCorrelations is organized as follows:
22464  //
22465  //  1st bin: <2>_{1n|1n} = two1n1nW1W1 = <w1 w2 cos(n*(phi1-phi2))>
22466  //  2nd bin: <2>_{2n|2n} = two2n2nW2W2 = <w1^2 w2^2 cos(2n*(phi1-phi2))>
22467  //  3rd bin: <2>_{3n|3n} = two3n3nW3W3 = <w1^3 w2^3 cos(3n*(phi1-phi2))> 
22468  //  4th bin: <2>_{4n|4n} = two4n4nW4W4 = <w1^4 w2^4 cos(4n*(phi1-phi2))>
22469  //  5th bin:           ----  EMPTY ----
22470  //  6th bin: <3>_{2n|1n,1n} = three2n1n1nW2W1W1 = <w1^2 w2 w3 cos(n*(2phi1-phi2-phi3))>
22471  //  7th bin: <3>_{3n|2n,1n} = ...
22472  //  8th bin: <3>_{4n|2n,2n} = ...
22473  //  9th bin: <3>_{4n|3n,1n} = ...
22474  // 10th bin:           ----  EMPTY ----
22475  // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1nW1W1W1W1 = <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))>
22476  // 12th bin: <4>_{2n,1n|2n,1n} = ...
22477  // 13th bin: <4>_{2n,2n|2n,2n} = ...
22478  // 14th bin: <4>_{3n|1n,1n,1n} = ... 
22479  // 15th bin: <4>_{3n,1n|3n,1n} = ...
22480  // 16th bin: <4>_{3n,1n|2n,2n} = ...
22481  // 17th bin: <4>_{4n|2n,1n,1n} = ... 
22482  // 18th bin:           ----  EMPTY ----
22483  // 19th bin: <5>_{2n|1n,1n,1n,1n} = ...
22484  // 20th bin: <5>_{2n,2n|2n,1n,1n} = ...
22485  // 21st bin: <5>_{3n,1n|2n,1n,1n} = ...
22486  // 22nd bin: <5>_{4n|1n,1n,1n,1n} = ...
22487  // 23rd bin:           ----  EMPTY ----
22488  // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = ...
22489  // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = ...
22490  // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = ...
22491  // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = ...
22492  // 28th bin:           ----  EMPTY ----
22493  // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = ...
22494  // 30th bin:           ----  EMPTY ----
22495  // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = ...
22496  
22497  // Remark 2: When particle weights are used there are some extra correlations. They are stored in 
22498  // fIntFlowExtraDirectCorrelations binning of which is organized as follows:
22499  
22500  // 1st bin: two1n1nW3W1 = <w1^3 w2 cos(n*(phi1-phi2))>
22501  // 2nd bin: two1n1nW1W1W2 = <w1 w2 w3^2 cos(n*(phi1-phi2))>  
22502  // ...
22503  
22504  Int_t nPrim = anEvent->NumberOfTracks(); 
22505  AliFlowTrackSimple *aftsTrack = NULL;
22506  //Double_t phi1=0., phi2=0., phi3=0., phi4=0., phi5=0., phi6=0., phi7=0., phi8=0.;
22507  //Double_t wPhi1=1., wPhi2=1., wPhi3=1., wPhi4=1., wPhi5=1., wPhi6=1., wPhi7=1., wPhi8=1.;
22508  Double_t phi1=0., phi2=0., phi3=0., phi4=0.;
22509  Double_t wPhi1=1., wPhi2=1., wPhi3=1., wPhi4=1.;
22510  Int_t n = fHarmonic; 
22511  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // to be improved (is this casting safe in general?)
22512  Double_t dMult = (*fSpk)(0,0);
22513  cout<<endl;
22514  cout<<"Multiparticle correlations: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
22515  if(dMult<2)
22516  {
22517   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
22518  } else if (dMult>fMaxAllowedMultiplicity)
22519    {
22520     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
22521    } else 
22522      { 
22523       cout<<"... evaluating nested loops (using particle weights) ..."<<endl;
22524      } 
22525       
22526  // 2-particle correlations:       
22527  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
22528  {
22529   // 2 nested loops multiparticle correlations using particle weights:       
22530   for(Int_t i1=0;i1<nPrim;i1++)
22531   {
22532    aftsTrack=anEvent->GetTrack(i1);
22533    if(!(aftsTrack->InRPSelection())) continue;
22534    phi1=aftsTrack->Phi();
22535    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
22536    for(Int_t i2=0;i2<nPrim;i2++)
22537    {
22538     if(i2==i1)continue;
22539     aftsTrack=anEvent->GetTrack(i2);
22540     if(!(aftsTrack->InRPSelection())) continue;
22541     phi2=aftsTrack->Phi();
22542     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));   
22543     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
22544     // 2-p correlations using particle weights:
22545     if(fUsePhiWeights) fIntFlowDirectCorrelations->Fill(0.5,cos(n*(phi1-phi2)),wPhi1*wPhi2);                  // <w1   w2   cos( n*(phi1-phi2))>
22546     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))>
22547     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))>
22548     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))> 
22549     // extra correlations: 
22550     // 2-p extra correlations (do not appear if particle weights are not used):
22551     if(fUsePhiWeights) fIntFlowExtraDirectCorrelations->Fill(0.5,cos(n*(phi1-phi2)),pow(wPhi1,3)*wPhi2); // <w1^3 w2 cos(n*(phi1-phi2))>
22552     // ...
22553    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22554   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22555  } // end of if(nPrim>=2)
22556
22557  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
22558  { 
22559   // 3 nested loops multiparticle correlations using particle weights:       
22560   for(Int_t i1=0;i1<nPrim;i1++)
22561   {
22562    aftsTrack=anEvent->GetTrack(i1);
22563    if(!(aftsTrack->InRPSelection())) continue;
22564    phi1=aftsTrack->Phi();
22565    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
22566    for(Int_t i2=0;i2<nPrim;i2++)
22567    {
22568     if(i2==i1)continue;
22569     aftsTrack=anEvent->GetTrack(i2);
22570     if(!(aftsTrack->InRPSelection())) continue;
22571     phi2=aftsTrack->Phi();
22572     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
22573     for(Int_t i3=0;i3<nPrim;i3++)
22574     {
22575      if(i3==i1||i3==i2)continue;
22576      aftsTrack=anEvent->GetTrack(i3);
22577      if(!(aftsTrack->InRPSelection())) continue;
22578      phi3=aftsTrack->Phi();
22579      if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
22580      if(nPrim==3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush;
22581      // 3-p correlations using particle weights:
22582      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))>
22583      // ...
22584      // extra correlations: 
22585      // 2-p extra correlations (do not appear if particle weights are not used):
22586       if(fUsePhiWeights) fIntFlowExtraDirectCorrelations->Fill(1.5,cos(n*(phi1-phi2)),wPhi1*wPhi2*pow(wPhi3,2)); // <w1 w2 w3^2 cos(n*(phi1-phi2))>
22587      // ...
22588      // 3-p extra correlations (do not appear if particle weights are not used):
22589      // ...
22590     } // end of for(Int_t i3=0;i3<nPrim;i3++)
22591    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22592   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22593  } // end of if(nPrim>=3)
22594  
22595  if(nPrim>=4 && nPrim<=fMaxAllowedMultiplicity)
22596  {
22597   // 4 nested loops multiparticle correlations using particle weights:       
22598   for(Int_t i1=0;i1<nPrim;i1++)
22599   {
22600    aftsTrack=anEvent->GetTrack(i1);
22601    if(!(aftsTrack->InRPSelection())) continue;
22602    phi1=aftsTrack->Phi();
22603    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
22604    for(Int_t i2=0;i2<nPrim;i2++)
22605    {
22606     if(i2==i1)continue;
22607     aftsTrack=anEvent->GetTrack(i2);
22608     if(!(aftsTrack->InRPSelection())) continue;
22609     phi2=aftsTrack->Phi();
22610     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
22611     for(Int_t i3=0;i3<nPrim;i3++)
22612     {
22613      if(i3==i1||i3==i2)continue;
22614      aftsTrack=anEvent->GetTrack(i3);
22615      if(!(aftsTrack->InRPSelection())) continue;
22616      phi3=aftsTrack->Phi();
22617      if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
22618      for(Int_t i4=0;i4<nPrim;i4++)
22619      {
22620       if(i4==i1||i4==i2||i4==i3)continue;
22621       aftsTrack=anEvent->GetTrack(i4);
22622       if(!(aftsTrack->InRPSelection())) continue;
22623       phi4=aftsTrack->Phi();
22624       if(fUsePhiWeights && fPhiWeights) wPhi4 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi4*fnBinsPhi/TMath::TwoPi())));
22625       if(nPrim>=4) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<"\r"<<flush; // to be improved (replace eventually this if statement with if(nPrim==4))
22626       // 4-p correlations using particle weights:
22627       if(fUsePhiWeights) fIntFlowDirectCorrelations->Fill(10.5,cos(n*phi1+n*phi2-n*phi3-n*phi4),wPhi1*wPhi2*wPhi3*wPhi4); 
22628       // extra correlations: 
22629       // 2-p extra correlations (do not appear if particle weights are not used):
22630       // ...
22631       // 3-p extra correlations (do not appear if particle weights are not used):
22632       // ...
22633       // 4-p extra correlations (do not appear if particle weights are not used):
22634       // ...
22635      } // end of for(Int_t i4=0;i4<nPrim;i4++) 
22636     } // end of for(Int_t i3=0;i3<nPrim;i3++)
22637    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22638   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22639  } // end of if(nPrim>=4)
22640
22641  cout<<endl; 
22642
22643 } // end of void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrelationsWithNestedLoopsUsingParticleWeights(AliFlowEventSimple* anEvent)
22644
22645 //=======================================================================================================================
22646
22647 void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowExtraCorrelations()
22648 {
22649  // Cross-check results for extra multiparticle correlations needed for int. flow 
22650  // which appear only when particle weights are used: results from Q-vectors vs results from nested loops.
22651
22652  cout<<endl;
22653  cout<<endl;
22654  cout<<"   ***********************************************"<<endl;
22655  cout<<"   **** cross-checking the extra correlations ****"<<endl;
22656  cout<<"   ****          for integrated flow          ****"<<endl;
22657  cout<<"   ***********************************************"<<endl;
22658  cout<<endl;
22659  cout<<endl;
22660  
22661  for(Int_t eci=1;eci<=2;eci++) // to be improved (increased eciMax eventually when I calculate 6th and 8th)
22662  {
22663   if(strcmp((fIntFlowExtraCorrelationsPro->GetXaxis())->GetBinLabel(eci), "") == 0) continue;
22664   cout<<(fIntFlowExtraCorrelationsPro->GetXaxis())->GetBinLabel(eci)<<":"<<endl;
22665   cout<<"from Q-vectors    = "<<fIntFlowExtraCorrelationsPro->GetBinContent(eci)<<endl;
22666   cout<<"from nested loops = "<<fIntFlowExtraDirectCorrelations->GetBinContent(eci)<<endl;
22667   cout<<endl;
22668  }
22669
22670 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowExtraCorrelations()
22671
22672 //=======================================================================================================================
22673
22674 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrectionsForNUAWithNestedLoops(AliFlowEventSimple * const anEvent)
22675 {
22676  // Evaluate with nested loops correction terms for non-uniform acceptance relevant for NONAME integrated flow (to be improved (name)).
22677  //
22678  // Remark: Both sin and cos correction terms are calculated in this method. Sin terms are stored in fIntFlowDirectCorrectionTermsForNUA[0],
22679  // and cos terms in fIntFlowDirectCorrectionTermsForNUA[1]. Binning of fIntFlowDirectCorrectionTermsForNUA[sc] is organized as follows 
22680  // (sc stands for either sin or cos):
22681  
22682  //  1st bin: <<sc(n*(phi1))>> 
22683  //  2nd bin: <<sc(n*(phi1+phi2))>> 
22684  //  3rd bin: <<sc(n*(phi1-phi2-phi3))>>
22685  //  4th bin: <<sc(n*(2phi1-phi2))>>
22686  
22687  Int_t nPrim = anEvent->NumberOfTracks(); 
22688  AliFlowTrackSimple *aftsTrack = NULL;
22689  Double_t phi1=0., phi2=0., phi3=0.;
22690  Int_t n = fHarmonic; 
22691  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // to be improved (is this casting safe in general?)
22692  Double_t dMult = (*fSpk)(0,0);
22693  cout<<endl;
22694  cout<<"Correction terms for non-uniform acceptance: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
22695  if(dMult<1)
22696  {
22697   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
22698  } else if (dMult>fMaxAllowedMultiplicity)
22699    {
22700     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
22701    } else 
22702      { 
22703       cout<<"... evaluating nested loops (without using particle weights)..."<<endl;
22704      }
22705  
22706  if(nPrim>=1 && nPrim<=fMaxAllowedMultiplicity)
22707  {
22708   // 1-particle correction terms for non-uniform acceptance:       
22709   for(Int_t i1=0;i1<nPrim;i1++)
22710   {
22711    aftsTrack=anEvent->GetTrack(i1);
22712    if(!(aftsTrack->InRPSelection())) continue;
22713    phi1=aftsTrack->Phi();
22714    if(nPrim==1) cout<<i1<<"\r"<<flush;
22715    // sin terms:
22716    fIntFlowDirectCorrectionTermsForNUA[0]->Fill(0.5,sin(n*phi1),1.); // <sin(n*phi1)>  
22717    // cos terms:
22718    fIntFlowDirectCorrectionTermsForNUA[1]->Fill(0.5,cos(n*phi1),1.); // <cos(n*phi1)>
22719   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22720  } // end of if(nPrim>=1) 
22721   
22722  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
22723  {
22724   // 2-particle correction terms for non-uniform acceptance:       
22725   for(Int_t i1=0;i1<nPrim;i1++)
22726   {
22727    aftsTrack=anEvent->GetTrack(i1);
22728    if(!(aftsTrack->InRPSelection())) continue;
22729    phi1=aftsTrack->Phi();  
22730    for(Int_t i2=0;i2<nPrim;i2++)
22731    {
22732     if(i2==i1)continue;
22733     aftsTrack=anEvent->GetTrack(i2);
22734     if(!(aftsTrack->InRPSelection())) continue;
22735     phi2=aftsTrack->Phi();
22736     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
22737     // sin terms:
22738     fIntFlowDirectCorrectionTermsForNUA[0]->Fill(1.5,sin(n*(phi1+phi2)),1.); // <<sin(n*(phi1+phi2))>>
22739     fIntFlowDirectCorrectionTermsForNUA[0]->Fill(3.5,sin(n*(2*phi1-phi2)),1.); // <<sin(n*(2*phi1-phi2))>>
22740     // cos terms:
22741     fIntFlowDirectCorrectionTermsForNUA[1]->Fill(1.5,cos(n*(phi1+phi2)),1.); // <<cos(n*(phi1+phi2))>>
22742     fIntFlowDirectCorrectionTermsForNUA[1]->Fill(3.5,cos(n*(2*phi1-phi2)),1.); // <<cos(n*(2*phi1-phi2))>>
22743    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22744   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22745  } // end of if(nPrim>=2)
22746
22747  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
22748  {
22749   // 3-particle correction terms for non-uniform acceptance:       
22750   for(Int_t i1=0;i1<nPrim;i1++)
22751   {
22752    aftsTrack=anEvent->GetTrack(i1);
22753    if(!(aftsTrack->InRPSelection())) continue;
22754    phi1=aftsTrack->Phi();
22755    for(Int_t i2=0;i2<nPrim;i2++)
22756    {
22757     if(i2==i1)continue;
22758     aftsTrack=anEvent->GetTrack(i2);
22759     if(!(aftsTrack->InRPSelection())) continue;
22760     phi2=aftsTrack->Phi();
22761     for(Int_t i3=0;i3<nPrim;i3++)
22762     {
22763      if(i3==i1||i3==i2)continue;
22764      aftsTrack=anEvent->GetTrack(i3);
22765      if(!(aftsTrack->InRPSelection())) continue;
22766      phi3=aftsTrack->Phi();
22767      if(nPrim>=3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush; // to be improved (eventually I will change this if statement)
22768      // sin terms:
22769      fIntFlowDirectCorrectionTermsForNUA[0]->Fill(2.5,sin(n*(phi1-phi2-phi3)),1.); // <<sin(n*(phi1-phi2-phi3))>>
22770      // cos terms:
22771      fIntFlowDirectCorrectionTermsForNUA[1]->Fill(2.5,cos(n*(phi1-phi2-phi3)),1.); // <<cos(n*(phi1-phi2-phi3))>>
22772     } // end of for(Int_t i3=0;i3<nPrim;i3++)
22773    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22774   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22775  } // end of if(nPrim>=3)
22776
22777  cout<<endl;
22778 }
22779
22780 //=======================================================================================================================
22781
22782 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrelationsWithNestedLoops(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
22783 {
22784  // Evaluate reduced correlations with nested loops without using the particle weights.
22785  
22786  // Remark 1: Reduced correlations are evaluated in pt bin number fCrossCheckInPtBinNo and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
22787  // Remark 2: Results are stored in 1 bin profiles fDiffFlowDirectCorrelations[t][pe][ci], where indices runs as follows:
22788  //           [0=RP,1=POI][0=Pt,1=Eta][0=<2'>,1=<4'>,2=<6'>,3=<8'>] 
22789  // Remark 3: <2'> = <cos(n*(psi1-phi2))>
22790  //           <4'> = <cos(n*(psi1+phi2-phi3-phi4))>
22791  // ...
22792  
22793  Int_t typeFlag = 0;
22794  Int_t ptEtaFlag = 0;
22795  if(type == "RP")
22796  {
22797   typeFlag = 0;
22798  } else if(type == "POI")
22799    {
22800     typeFlag = 1;
22801    }      
22802  if(ptOrEta == "Pt")
22803  {
22804   ptEtaFlag = 0;
22805  } else if(ptOrEta == "Eta")
22806    {
22807     ptEtaFlag = 1;
22808    } 
22809  // shortcuts:
22810  Int_t t = typeFlag;
22811  Int_t pe = ptEtaFlag;
22812       
22813  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
22814  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
22815  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
22816  
22817  Int_t nPrim = anEvent->NumberOfTracks(); 
22818  AliFlowTrackSimple *aftsTrack = NULL;
22819  
22820  Double_t psi1=0., phi2=0., phi3=0., phi4=0.;// phi5=0., phi6=0., phi7=0., phi8=0.;
22821  
22822  Int_t n = fHarmonic; 
22823   
22824  // 2'-particle correlations:
22825  for(Int_t i1=0;i1<nPrim;i1++)
22826  {
22827   aftsTrack=anEvent->GetTrack(i1);
22828   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22829   if(typeFlag==1) // this is diff flow of POIs 
22830   {
22831    if(ptOrEta == "Pt")
22832    { 
22833     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22834    } else if (ptOrEta == "Eta")
22835      {
22836       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22837      }
22838   } else // this is diff flow of RPs 
22839     {
22840      if(ptOrEta == "Pt")
22841      { 
22842       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22843      } else if (ptOrEta == "Eta")
22844        {
22845         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22846        }
22847     }
22848        
22849   psi1=aftsTrack->Phi(); 
22850   for(Int_t i2=0;i2<nPrim;i2++)
22851   {
22852    if(i2==i1)continue;
22853    aftsTrack=anEvent->GetTrack(i2);
22854    // RP condition (!(first) particle in the correlator must be RP):
22855    if(!(aftsTrack->InRPSelection()))continue;
22856    phi2=aftsTrack->Phi();   
22857    // 2'-particle correlations: 
22858    fDiffFlowDirectCorrelations[t][pe][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(1.*n*(psi1-phi2)),1.); // <cos(n*(psi1-phi2))  
22859   }//end of for(Int_t i2=0;i2<nPrim;i2++)
22860  }//end of for(Int_t i1=0;i1<nPrim;i1++)
22861  
22862  /*
22863  
22864  // 3'-particle correlations:
22865  for(Int_t i1=0;i1<nPrim;i1++)
22866  {
22867   aftsTrack=anEvent->GetTrack(i1);
22868   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22869   if(ptOrEta == "Pt")
22870   { 
22871    if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22872   } else if (ptOrEta == "Eta")
22873     {
22874      if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22875     }
22876   psi1=aftsTrack->Phi();
22877   for(Int_t i2=0;i2<nPrim;i2++)
22878   {
22879    if(i2==i1)continue;
22880    aftsTrack=anEvent->GetTrack(i2);
22881    // RP condition (!(first) particle in the correlator must be RP):
22882    if(!(aftsTrack->InRPSelection())) continue;
22883    phi2=aftsTrack->Phi();
22884    for(Int_t i3=0;i3<nPrim;i3++)
22885    {
22886     if(i3==i1||i3==i2)continue;
22887     aftsTrack=anEvent->GetTrack(i3);
22888     // RP condition (!(first) particle in the correlator must be RP):
22889     if(!(aftsTrack->InRPSelection())) continue;
22890     phi3=aftsTrack->Phi();
22891     // 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))> 
22892    }//end of for(Int_t i3=0;i3<nPrim;i3++)  
22893   }//end of for(Int_t i2=0;i2<nPrim;i2++)  
22894  }//end of for(Int_t i1=0;i1<nPrim;i1++)
22895  
22896  */
22897  
22898  // 4'-particle correlations:
22899  for(Int_t i1=0;i1<nPrim;i1++)
22900  {
22901   aftsTrack=anEvent->GetTrack(i1);
22902   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22903   if(typeFlag==1) // this is diff flow of POIs 
22904   {
22905    if(ptOrEta == "Pt")
22906    { 
22907     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22908    } else if (ptOrEta == "Eta")
22909      {
22910       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22911      }
22912   } else // this is diff flow of RPs 
22913     {
22914      if(ptOrEta == "Pt")
22915      { 
22916       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22917      } else if (ptOrEta == "Eta")
22918        {
22919         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22920        }
22921     }
22922     
22923   psi1=aftsTrack->Phi();
22924   for(Int_t i2=0;i2<nPrim;i2++)
22925   {
22926    if(i2==i1) continue;
22927    aftsTrack=anEvent->GetTrack(i2);
22928    // RP condition (!(first) particle in the correlator must be RP): 
22929    if(!(aftsTrack->InRPSelection())) continue;
22930    phi2=aftsTrack->Phi();
22931    for(Int_t i3=0;i3<nPrim;i3++)
22932    { 
22933     if(i3==i1||i3==i2) continue;
22934     aftsTrack=anEvent->GetTrack(i3);
22935     // RP condition (!(first) particle in the correlator must be RP):
22936     if(!(aftsTrack->InRPSelection())) continue;
22937     phi3=aftsTrack->Phi();
22938     for(Int_t i4=0;i4<nPrim;i4++)
22939     {
22940      if(i4==i1||i4==i2||i4==i3) continue;
22941      aftsTrack=anEvent->GetTrack(i4);
22942      // RP condition (!(first) particle in the correlator must be RP):
22943      if(!(aftsTrack->InRPSelection())) continue;  
22944      phi4=aftsTrack->Phi();
22945      // 4'-particle correlations:
22946      fDiffFlowDirectCorrelations[t][pe][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2-phi3-phi4)),1.); // <cos(n(psi1+phi2-phi3-phi4))>     
22947     }//end of for(Int_t i4=0;i4<nPrim;i4++)
22948    }//end of for(Int_t i3=0;i3<nPrim;i3++)
22949   }//end of for(Int_t i2=0;i2<nPrim;i2++) 
22950  }//end of for(Int_t i1=0;i1<nPrim;i1++)
22951       
22952  // count # of RPs and POIs in selected pt and eta bins for cross-checkings:
22953  for(Int_t i=0;i<nPrim;i++)
22954  {
22955   aftsTrack=anEvent->GetTrack(i); 
22956   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22957   if(typeFlag==1) // this is diff flow of POIs 
22958   {
22959    if(ptOrEta == "Pt")
22960    { 
22961     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22962    } else if (ptOrEta == "Eta")
22963      {
22964       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22965      }
22966   } else // this is diff flow of RPs 
22967     {
22968      if(ptOrEta == "Pt")
22969      { 
22970       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22971      } else if (ptOrEta == "Eta")
22972        {
22973         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22974        }
22975     }
22976   if(t==1)t++; 
22977   fNoOfParticlesInBin->Fill(t+pe+0.5);  
22978  }
22979
22980 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrelationsWithNestedLoops(AliFlowEventSimple* anEvent, TString type, TString ptOrEta)
22981
22982 //=======================================================================================================================
22983
22984 void AliFlowAnalysisWithQCumulants::EvaluateOtherDiffCorrelatorsWithNestedLoops(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
22985 {
22986  // Evaluate other differential correlators with nested loops without using the particle weights.
22987
22988  // Remark 1: Other differential correlators are evaluated in pt bin number fCrossCheckInPtBinNo 
22989  //           and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
22990  // Remark 2: Results are stored in 1 bin profiles fOtherDirectDiffCorrelators[t][pe][sc][ci], where indices runs as follows:
22991  //           [0=RP,1=POI][0=Pt,1=Eta][0=sin terms,1=cos terms][ci = correlator index] 
22992  // Remark 3: Correlator index 'ci' runs as follows:
22993  //            0: <exp(n*(psi1-3phi2+2phi3))> (Teaney-Yan correlator)
22994   
22995  Int_t typeFlag = 0;
22996  Int_t ptEtaFlag = 0;
22997  if(type == "RP")
22998  {
22999   typeFlag = 0;
23000  } else if(type == "POI")
23001    {
23002     typeFlag = 1;
23003    }      
23004  if(ptOrEta == "Pt")
23005  {
23006   ptEtaFlag = 0;
23007  } else if(ptOrEta == "Eta")
23008    {
23009     ptEtaFlag = 1;
23010    } 
23011  // shortcuts:
23012  Int_t t = typeFlag;
23013  Int_t pe = ptEtaFlag;
23014       
23015  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
23016  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
23017  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
23018  
23019  Int_t nPrim = anEvent->NumberOfTracks(); 
23020  AliFlowTrackSimple *aftsTrack = NULL;
23021  
23022  Double_t psi1=0., phi2=0., phi3=0.;
23023  
23024  Int_t n = fHarmonic; 
23025
23026  // 3-p correlators:
23027  for(Int_t i1=0;i1<nPrim;i1++)
23028  {
23029   aftsTrack=anEvent->GetTrack(i1);
23030   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23031   if(typeFlag==1) // this is diff flow of POIs 
23032   {
23033    if(ptOrEta == "Pt")
23034    { 
23035     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23036    } else if (ptOrEta == "Eta")
23037      {
23038       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23039      }
23040   } else // this is diff flow of RPs 
23041     {
23042      if(ptOrEta == "Pt")
23043      { 
23044       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23045      } else if (ptOrEta == "Eta")
23046        {
23047         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23048        }
23049     }
23050   psi1=aftsTrack->Phi();
23051   for(Int_t i2=0;i2<nPrim;i2++)
23052   {
23053    if(i2==i1) continue;
23054    aftsTrack=anEvent->GetTrack(i2);
23055    // RP condition (!(first) particle in the correlator must be RP): 
23056    if(!(aftsTrack->InRPSelection())) continue;
23057    phi2=aftsTrack->Phi();
23058    for(Int_t i3=0;i3<nPrim;i3++)
23059    { 
23060     if(i3==i1||i3==i2) continue;
23061     aftsTrack=anEvent->GetTrack(i3);
23062     // RP condition (!(first) particle in the correlator must be RP):
23063     if(!(aftsTrack->InRPSelection())) continue;
23064     phi3=aftsTrack->Phi();
23065     // Fill 3-p correlators:
23066     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))>     
23067    }//end of for(Int_t i3=0;i3<nPrim;i3++)
23068   }//end of for(Int_t i2=0;i2<nPrim;i2++) 
23069  }//end of for(Int_t i1=0;i1<nPrim;i1++)   
23070 } // end of void AliFlowAnalysisWithQCumulants::EvaluateOtherDiffCorrelatorsWithNestedLoops(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
23071
23072 //=======================================================================================================================
23073
23074 void AliFlowAnalysisWithQCumulants::CrossCheckDiffFlowCorrelations(TString type, TString ptOrEta)
23075 {
23076  // Compare correlations needed for diff. flow calculated with nested loops and those calculated from Q-vectors
23077  
23078  Int_t typeFlag = 0;
23079  Int_t ptEtaFlag = 0;
23080  if(type == "RP")
23081  {
23082   typeFlag = 0;
23083  } else if(type == "POI")
23084    {
23085     typeFlag = 1;
23086    }      
23087  if(ptOrEta == "Pt")
23088  {
23089   ptEtaFlag = 0;
23090  } else if(ptOrEta == "Eta")
23091    {
23092     ptEtaFlag = 1;
23093    } 
23094  // shortcuts:
23095  Int_t t = typeFlag;
23096  Int_t pe = ptEtaFlag;
23097       
23098  TString rpORpoiString[2] = {"RP ","POI"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
23099  TString ptORetaString[2] = {"pt","eta"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
23100  TString reducedCorrelations[4] = {"<<cos(n(psi1-phi2))>>","<<cos(n(psi1+phi2-phi3-phi4))>>","",""}; // to be improved (access this from pro or hist)
23101  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
23102  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
23103  
23104  Int_t crossCheckInPtEtaBinNo[2] = {fCrossCheckInPtBinNo,fCrossCheckInEtaBinNo};
23105  
23106
23107  cout<<endl;
23108  cout<<"   *****************************************"<<endl;
23109  cout<<"   **** cross-checking the correlations ****"<<endl;
23110  cout<<"   ****   for differential flow ("<<rpORpoiString[t]<<")   ****"<<endl;
23111  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
23112  {
23113   cout<<"   ****   (particle weights not used)   ****"<<endl;
23114  } else
23115    {
23116     cout<<"   ****    (particle weights used)      ****"<<endl;
23117    } 
23118  cout<<"   *****************************************"<<endl; 
23119  cout<<endl;
23120  cout<<"           "<<ptORetaString[pe]<<" bin: "<<lowerPtEtaEdge[pe]<<" <= "<<ptORetaString[pe]<<" < "<<upperPtEtaEdge[pe]<<endl;
23121  cout<<endl;
23122  
23123  for(Int_t rci=0;rci<2;rci++) // to be improved (calculate 6th and 8th order)
23124  {
23125   cout<<"      "<<reducedCorrelations[rci].Data()<<":"<<endl;
23126   cout<<"      from Q-vectors    = "<<fDiffFlowCorrelationsPro[t][pe][rci]->GetBinContent(crossCheckInPtEtaBinNo[pe])<<endl;
23127   cout<<"      from nested loops = "<<fDiffFlowDirectCorrelations[t][pe][rci]->GetBinContent(1)<<endl;
23128   cout<<endl;  
23129  } // end of for(Int_t rci=0;rci<4;rci++)
23130         
23131 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckDiffFlowCorrelations(TString type, TString ptOrEta)
23132
23133 //=======================================================================================================================
23134
23135 void AliFlowAnalysisWithQCumulants::CrossCheckOtherDiffCorrelators(TString type, TString ptOrEta)
23136 {
23137  // Compare correlations needed for diff. flow calculated with nested loops and those calculated from Q-vectors
23138  
23139  Int_t typeFlag = 0;
23140  Int_t ptEtaFlag = 0;
23141  if(type == "RP")
23142  {
23143   typeFlag = 0;
23144  } else if(type == "POI")
23145    {
23146     typeFlag = 1;
23147    }      
23148  if(ptOrEta == "Pt")
23149  {
23150   ptEtaFlag = 0;
23151  } else if(ptOrEta == "Eta")
23152    {
23153     ptEtaFlag = 1;
23154    } 
23155  // shortcuts:
23156  Int_t t = typeFlag;
23157  Int_t pe = ptEtaFlag;
23158       
23159  TString rpORpoiString[2] = {"RP ","POI"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
23160  TString ptORetaString[2] = {"pt","eta"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
23161  TString otherCorrelators[1] = {"<<cos(n(psi1-3phi2+2phi3))>>"}; // to be improved (access this from pro or hist)
23162  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
23163  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
23164  
23165  Int_t crossCheckInPtEtaBinNo[2] = {fCrossCheckInPtBinNo,fCrossCheckInEtaBinNo};
23166
23167  cout<<endl;
23168  cout<<"   *****************************************"<<endl;
23169  cout<<"   ****   cross-checking the other      ****"<<endl;
23170  cout<<"   ****   diff. correlators ("<<rpORpoiString[t]<<")       ****"<<endl;
23171  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
23172  {
23173   cout<<"   ****   (particle weights not used)   ****"<<endl;
23174  } else
23175    {
23176     cout<<"   ****    (particle weights used)      ****"<<endl;
23177    } 
23178  cout<<"   *****************************************"<<endl; 
23179  cout<<endl;
23180  cout<<"           "<<ptORetaString[pe]<<" bin: "<<lowerPtEtaEdge[pe]<<" <= "<<ptORetaString[pe]<<" < "<<upperPtEtaEdge[pe]<<endl;
23181  cout<<endl;
23182  
23183  for(Int_t ci=0;ci<1;ci++) 
23184  {
23185   cout<<"      "<<otherCorrelators[ci].Data()<<":"<<endl;
23186   cout<<"      from Q-vectors    = "<<fOtherDiffCorrelators[t][pe][1][ci]->GetBinContent(crossCheckInPtEtaBinNo[pe])<<endl;
23187   cout<<"      from nested loops = "<<fOtherDirectDiffCorrelators[t][pe][1][ci]->GetBinContent(1)<<endl;
23188   cout<<endl;  
23189  } // end of for(Int_t ci=0;ci<1;ci++)
23190         
23191 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckOtherDiffCorrelators(TString type, TString ptOrEta)
23192
23193 //=======================================================================================================================
23194
23195 void AliFlowAnalysisWithQCumulants::PrintNumberOfParticlesInSelectedBin()
23196 {
23197  // Print on the screen number of RPs and POIs in selected pt and eta bin for cross checkings.
23198  
23199  cout<<endl;
23200  cout<<"Number of RPs in selected pt bin   = "<<fNoOfParticlesInBin->GetBinContent(1)<<endl;
23201  cout<<"Number of RPs in selected eta bin  = "<<fNoOfParticlesInBin->GetBinContent(2)<<endl;
23202  cout<<"Number of POIs in selected pt bin  = "<<fNoOfParticlesInBin->GetBinContent(3)<<endl;
23203  cout<<"Number of POIs in selected eta bin = "<<fNoOfParticlesInBin->GetBinContent(4)<<endl;
23204  
23205 } // end of void AliFlowAnalysisWithQCumulants::PrintNumberOfParticlesInSelectedBin()
23206
23207 //=======================================================================================================================
23208
23209 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
23210 {
23211  // Evaluate reduced correlations with nested loops without using the particle weights.
23212  
23213  // Remark 1: Reduced correlations are evaluated in pt bin number fCrossCheckInPtBinNo and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
23214  // Remark 2: Results are stored in 1 bin profiles fDiffFlowDirectCorrelations[t][pe][ci], where indices runs as follows:
23215  //           [0=RP,1=POI][0=Pt,1=Eta][0=<2'>,1=<4'>,2=<6'>,3=<8'>] 
23216  // Remark 3: <2'> = <w2 cos(n*(psi1-phi2))>
23217  //           <4'> = <w2 w3 w4 cos(n*(psi1+phi2-phi3-phi4))>
23218  // ...
23219   
23220  Int_t typeFlag = 0;
23221  Int_t ptEtaFlag = 0;
23222  if(type == "RP")
23223  {
23224   typeFlag = 0;
23225  } else if(type == "POI")
23226    {
23227     typeFlag = 1;
23228    }      
23229  if(ptOrEta == "Pt")
23230  {
23231   ptEtaFlag = 0;
23232  } else if(ptOrEta == "Eta")
23233    {
23234     ptEtaFlag = 1;
23235    } 
23236  // shortcuts:
23237  Int_t t = typeFlag;
23238  Int_t pe = ptEtaFlag;
23239       
23240  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
23241  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
23242  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
23243  
23244  Int_t nPrim = anEvent->NumberOfTracks(); 
23245  AliFlowTrackSimple *aftsTrack = NULL;
23246  
23247  Double_t psi1=0., phi2=0., phi3=0., phi4=0.;// phi5=0., phi6=0., phi7=0., phi8=0.;
23248  Double_t wPhi2=1., wPhi3=1., wPhi4=1.;// wPhi5=1., wPhi6=1., wPhi7=1., wPhi8=1.;
23249  
23250  Int_t n = fHarmonic; 
23251  
23252  // 2'-particle correlations:
23253  for(Int_t i1=0;i1<nPrim;i1++)
23254  {
23255   aftsTrack=anEvent->GetTrack(i1);
23256   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23257   if(typeFlag==1) // this is diff flow of POIs 
23258   {
23259    if(ptOrEta == "Pt")
23260    { 
23261     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23262    } else if (ptOrEta == "Eta")
23263      {
23264       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23265      }
23266   } else // this is diff flow of RPs 
23267     {
23268      if(ptOrEta == "Pt")
23269      { 
23270       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23271      } else if (ptOrEta == "Eta")
23272        {
23273         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23274        }
23275     }
23276   psi1=aftsTrack->Phi(); 
23277   for(Int_t i2=0;i2<nPrim;i2++)
23278   {
23279    if(i2==i1) continue;
23280    aftsTrack=anEvent->GetTrack(i2);
23281    // RP condition (!(first) particle in the correlator must be RP):
23282    if(!(aftsTrack->InRPSelection())) continue;
23283    phi2=aftsTrack->Phi();   
23284    if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
23285    // 2'-particle correlations: 
23286    fDiffFlowDirectCorrelations[t][pe][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(1.*n*(psi1-phi2)),wPhi2); // <w2 cos(n*(psi1-phi2))  
23287   }//end of for(Int_t i2=0;i2<nPrim;i2++)
23288  }//end of for(Int_t i1=0;i1<nPrim;i1++)
23289  
23290  // 4'-particle correlations:
23291  for(Int_t i1=0;i1<nPrim;i1++)
23292  {
23293   aftsTrack=anEvent->GetTrack(i1);
23294   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23295   if(typeFlag==1) // this is diff flow of POIs 
23296   {
23297    if(ptOrEta == "Pt")
23298    { 
23299     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23300    } else if (ptOrEta == "Eta")
23301      {
23302       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23303      }
23304   } else // this is diff flow of RPs 
23305     {
23306      if(ptOrEta == "Pt")
23307      { 
23308       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23309      } else if (ptOrEta == "Eta")
23310        {
23311         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23312        }
23313     }
23314   psi1=aftsTrack->Phi();
23315   for(Int_t i2=0;i2<nPrim;i2++)
23316   {
23317    if(i2==i1) continue;
23318    aftsTrack=anEvent->GetTrack(i2);
23319    // RP condition (!(first) particle in the correlator must be RP): 
23320    if(!(aftsTrack->InRPSelection())) continue;
23321    phi2=aftsTrack->Phi();
23322    if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
23323    for(Int_t i3=0;i3<nPrim;i3++)
23324    { 
23325     if(i3==i1||i3==i2) continue;
23326     aftsTrack=anEvent->GetTrack(i3);
23327     // RP condition (!(first) particle in the correlator must be RP):
23328     if(!(aftsTrack->InRPSelection())) continue;
23329     phi3=aftsTrack->Phi();
23330     if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
23331     for(Int_t i4=0;i4<nPrim;i4++)
23332     {
23333      if(i4==i1||i4==i2||i4==i3) continue;
23334      aftsTrack=anEvent->GetTrack(i4);
23335      // RP condition (!(first) particle in the correlator must be RP):
23336      if(!(aftsTrack->InRPSelection())) continue;  
23337      phi4=aftsTrack->Phi();
23338      if(fUsePhiWeights && fPhiWeights) wPhi4 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi4*fnBinsPhi/TMath::TwoPi())));
23339      // 4'-particle correlations <w2 w3 w4 cos(n(psi1+phi2-phi3-phi4))>:
23340      fDiffFlowDirectCorrelations[t][pe][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2-phi3-phi4)),wPhi2*wPhi3*wPhi4); 
23341     }//end of for(Int_t i4=0;i4<nPrim;i4++)
23342    }//end of for(Int_t i3=0;i3<nPrim;i3++)
23343   }//end of for(Int_t i2=0;i2<nPrim;i2++) 
23344  }//end of for(Int_t i1=0;i1<nPrim;i1++)      
23345  
23346  // count # of RPs and POIs in selected pt and eta bins for cross-checkings: (to be improved - moved to dedicated method)
23347  for(Int_t i=0;i<nPrim;i++)
23348  {
23349   aftsTrack=anEvent->GetTrack(i); 
23350   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23351   if(typeFlag==1) // this is diff flow of POIs 
23352   {
23353    if(ptOrEta == "Pt")
23354    { 
23355     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23356    } else if (ptOrEta == "Eta")
23357      {
23358       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23359      }
23360   } else // this is diff flow of RPs 
23361     {
23362      if(ptOrEta == "Pt")
23363      { 
23364       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23365      } else if (ptOrEta == "Eta")
23366        {
23367         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23368        }
23369     }
23370   if(t==1)t++; 
23371   fNoOfParticlesInBin->Fill(t+pe+0.5);  
23372  }
23373  
23374 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(AliFlowEventSimple* anEvent, TString type, TString ptOrEta)
23375
23376 //=======================================================================================================================
23377
23378 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
23379 {
23380  // Evaluate with nested loops correction terms for non-uniform acceptance (both sin and cos terms) relevant for differential flow.
23381  
23382  // Remark 1: Reduced correction terms for non-uniform acceptance are evaluated in pt bin number fCrossCheckInPtBinNo 
23383  //           and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
23384  // Remark 2: Results are stored in 1 bin profiles fDiffFlowDirectCorrections[t][pe][sc][cti], where first three indices runs as: 
23385  //           [0=RP,1=POI][0=Pt,1=Eta][0=sin terms,1=cos terms], whilst the cti (correction term index) runs as follows: 
23386  //  cti: 
23387  //    0: <<sc n(psi1)>>
23388  //    1: <<sc n(psi1+phi2)>> 
23389  //    2: <<sc n(psi1+phi2-phi3)>>
23390  //    3: <<sc n(psi1-phi2-phi3)>>
23391  //    4:
23392  //    5:
23393  //    6:
23394   
23395  Int_t typeFlag = 0;
23396  Int_t ptEtaFlag = 0;
23397  if(type == "RP")
23398  {
23399   typeFlag = 0;
23400  } else if(type == "POI")
23401    {
23402     typeFlag = 1;
23403    }      
23404  if(ptOrEta == "Pt")
23405  {
23406   ptEtaFlag = 0;
23407  } else if(ptOrEta == "Eta")
23408    {
23409     ptEtaFlag = 1;
23410    } 
23411  // shortcuts:
23412  Int_t t = typeFlag;
23413  Int_t pe = ptEtaFlag;
23414       
23415  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
23416  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
23417  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
23418  
23419  Int_t nPrim = anEvent->NumberOfTracks(); 
23420  AliFlowTrackSimple *aftsTrack = NULL;
23421  
23422  Double_t psi1=0., phi2=0., phi3=0.;// phi4=0.;// phi5=0., phi6=0., phi7=0., phi8=0.;
23423  
23424  Int_t n = fHarmonic; 
23425  
23426  // 1-particle correction terms:
23427  for(Int_t i1=0;i1<nPrim;i1++)
23428  {
23429   aftsTrack=anEvent->GetTrack(i1);
23430   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23431   if(typeFlag==1) // this is diff flow of POIs 
23432   {
23433    if(ptOrEta == "Pt")
23434    { 
23435     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23436    } else if (ptOrEta == "Eta")
23437      {
23438       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23439      }
23440   } else // this is diff flow of RPs 
23441     {
23442      if(ptOrEta == "Pt")
23443      { 
23444       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23445      } else if (ptOrEta == "Eta")
23446        {
23447         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23448        }
23449     }
23450   psi1=aftsTrack->Phi(); 
23451   // sin terms: 
23452   fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*psi1),1.); // <<sin(n*(psi1))>>  
23453   // cos terms: 
23454   fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*psi1),1.); // <<cos(n*(psi1))>>  
23455  }//end of for(Int_t i1=0;i1<nPrim;i1++)
23456    
23457  // 2-particle correction terms:
23458  for(Int_t i1=0;i1<nPrim;i1++)
23459  {
23460   aftsTrack=anEvent->GetTrack(i1);
23461    // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23462   if(typeFlag==1) // this is diff flow of POIs 
23463   {
23464    if(ptOrEta == "Pt")
23465    { 
23466     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23467    } else if (ptOrEta == "Eta")
23468      {
23469       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23470      }
23471   } else // this is diff flow of RPs 
23472     {
23473      if(ptOrEta == "Pt")
23474      { 
23475       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23476      } else if (ptOrEta == "Eta")
23477        {
23478         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23479        }
23480     }
23481   psi1=aftsTrack->Phi(); 
23482   for(Int_t i2=0;i2<nPrim;i2++)
23483   {
23484    if(i2==i1) continue;
23485    aftsTrack=anEvent->GetTrack(i2);
23486    // RP condition (!(first) particle in the correlator must be RP):
23487    if(!(aftsTrack->InRPSelection())) continue;
23488    phi2=aftsTrack->Phi();   
23489    // sin terms: 
23490    fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1+phi2)),1.); // <<sin(n*(psi1+phi2))>>  
23491    // cos terms: 
23492    fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2)),1.); // <<cos(n*(psi1+phi2))>>  
23493   }//end of for(Int_t i2=0;i2<nPrim;i2++)
23494  }//end of for(Int_t i1=0;i1<nPrim;i1++)   
23495  
23496  // 3-particle correction terms:
23497  for(Int_t i1=0;i1<nPrim;i1++)
23498  {
23499   aftsTrack=anEvent->GetTrack(i1);
23500    // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23501   if(typeFlag==1) // this is diff flow of POIs 
23502   {
23503    if(ptOrEta == "Pt")
23504    { 
23505     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23506    } else if (ptOrEta == "Eta")
23507      {
23508       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23509      }
23510   } else // this is diff flow of RPs 
23511     {
23512      if(ptOrEta == "Pt")
23513      { 
23514       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23515      } else if (ptOrEta == "Eta")
23516        {
23517         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23518        }
23519     }
23520   psi1=aftsTrack->Phi();
23521   for(Int_t i2=0;i2<nPrim;i2++)
23522   {
23523    if(i2==i1) continue;
23524    aftsTrack=anEvent->GetTrack(i2);
23525    // RP condition (!(first) particle in the correlator must be RP):
23526    if(!(aftsTrack->InRPSelection())) continue;
23527    phi2=aftsTrack->Phi();
23528    for(Int_t i3=0;i3<nPrim;i3++)
23529    {
23530     if(i3==i1||i3==i2) continue;
23531     aftsTrack=anEvent->GetTrack(i3);
23532     // RP condition (!(first) particle in the correlator must be RP):
23533     if(!(aftsTrack->InRPSelection())) continue;
23534     phi3=aftsTrack->Phi();
23535     // sin terms: 
23536     fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][2]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1+phi2-phi3)),1.); // <<sin(n*(psi1+phi2-phi3))>>  
23537     fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][3]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1-phi2-phi3)),1.); // <<sin(n*(psi1-phi2-phi3))>>  
23538     // cos terms: 
23539     fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][2]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2-phi3)),1.); // <<cos(n*(psi1+phi2-phi3))>>  
23540     fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][3]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1-phi2-phi3)),1.); // <<cos(n*(psi1-phi2-phi3))>>  
23541    }//end of for(Int_t i3=0;i3<nPrim;i3++)  
23542   }//end of for(Int_t i2=0;i2<nPrim;i2++)  
23543  }//end of for(Int_t i1=0;i1<nPrim;i1++)
23544    
23545 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(AliFlowEventSimple* anEvent, TString type, TString ptOrEta)
23546
23547
23548 //=======================================================================================================================
23549
23550
23551 void AliFlowAnalysisWithQCumulants::CrossCheckDiffFlowCorrectionTermsForNUA(TString type, TString ptOrEta)
23552 {
23553  // Compare corrections temrs for non-uniform acceptance needed for diff. flow calculated with nested loops and those calculated from Q-vectors
23554  
23555  Int_t typeFlag = 0;
23556  Int_t ptEtaFlag = 0;
23557  if(type == "RP")
23558  {
23559   typeFlag = 0;
23560  } else if(type == "POI")
23561    {
23562     typeFlag = 1;
23563    }      
23564  if(ptOrEta == "Pt")
23565  {
23566   ptEtaFlag = 0;
23567  } else if(ptOrEta == "Eta")
23568    {
23569     ptEtaFlag = 1;
23570    } 
23571  // shortcuts:
23572  Int_t t = typeFlag;
23573  Int_t pe = ptEtaFlag;
23574       
23575  TString rpORpoiString[2] = {"RP ","POI"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
23576  TString ptORetaString[2] = {"pt","eta"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
23577  //TString sinCosFlag[2] = {"sin","cos"}; // to be improved (eventually promote to data member)
23578  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)
23579  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)
23580  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
23581  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
23582  
23583  Int_t crossCheckInPtEtaBinNo[2] = {fCrossCheckInPtBinNo,fCrossCheckInEtaBinNo};
23584  
23585  cout<<endl;
23586  cout<<"   ******************************************"<<endl;
23587  cout<<"   ****  cross-checking the correction   ****"<<endl;
23588  cout<<"   **** terms for non-uniform acceptance ****"<<endl; 
23589  cout<<"   ****    for differential flow ("<<rpORpoiString[t]<<")   ****"<<endl;
23590  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
23591  {
23592   cout<<"   ****    (particle weights not used)   ****"<<endl;
23593  } else
23594    {
23595     cout<<"   ****     (particle weights used)      ****"<<endl;
23596    } 
23597  cout<<"   ******************************************"<<endl; 
23598  cout<<endl;
23599  cout<<"           "<<ptORetaString[pe]<<" bin: "<<lowerPtEtaEdge[pe]<<" <= "<<ptORetaString[pe]<<" < "<<upperPtEtaEdge[pe]<<endl;
23600  cout<<endl;
23601  
23602  for(Int_t cti=0;cti<4;cti++) // correction term index
23603  {
23604   for(Int_t sc=0;sc<2;sc++) // sin or cos terms
23605   {
23606    if(sc==0) // to be improved (this can be implemented better)
23607    { 
23608     cout<<"      "<<reducedCorrectionSinTerms[cti].Data()<<":"<<endl;
23609    } else
23610      {
23611       cout<<"      "<<reducedCorrectionCosTerms[cti].Data()<<":"<<endl;     
23612      }
23613    cout<<"      from Q-vectors    = "<<fDiffFlowCorrectionTermsForNUAPro[t][pe][sc][cti]->GetBinContent(crossCheckInPtEtaBinNo[pe])<<endl;
23614    cout<<"      from nested loops = "<<fDiffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti]->GetBinContent(1)<<endl;
23615    cout<<endl;  
23616   } 
23617  } // end of for(Int_t rci=0;rci<4;rci++)
23618
23619 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckDiffFlowCorrectionTermsForNUA(TString type, TString ptOrEta)
23620
23621 //=======================================================================================================================
23622
23623 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTermsUsingParticleWeights()
23624 {
23625  // Calculate corrections using particle weights for non-uniform acceptance of the detector for no-name integrated flow (cos terms).
23626  
23627  //                                  **********************************************************************
23628  //                                  **** weighted corrections for non-uniform acceptance (cos terms): ****
23629  //                                  **********************************************************************
23630  
23631  // Remark 1: When particle weights are used the binning of fIntFlowCorrectionTermsForNUAPro[1] is organized as follows:
23632  //
23633  // 1st bin: <<w1 cos(n*(phi1))>> = cosP1nW1
23634  // 2nd bin: <<w1 w2 cos(n*(phi1+phi2))>> = cosP1nP1nW1W1
23635  // 3rd bin: <<w1 w2 w3 cos(n*(phi1-phi2-phi3))>> = cosP1nM1nM1nW1W1W1 
23636  // ...
23637
23638  // multiplicity (number of particles used to determine the reaction plane)
23639  Double_t dMult = (*fSpk)(0,0);
23640  
23641  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
23642  Double_t dReQ1n1k = (*fReQ)(0,1);
23643  Double_t dReQ2n2k = (*fReQ)(1,2);
23644  //Double_t dReQ3n3k = (*fReQ)(2,3);
23645  //Double_t dReQ4n4k = (*fReQ)(3,4);
23646  Double_t dReQ1n3k = (*fReQ)(0,3);
23647  Double_t dImQ1n1k = (*fImQ)(0,1);
23648  Double_t dImQ2n2k = (*fImQ)(1,2);
23649  //Double_t dImQ3n3k = (*fImQ)(2,3);
23650  //Double_t dImQ4n4k = (*fImQ)(3,4);
23651  //Double_t dImQ1n3k = (*fImQ)(0,3);
23652
23653  // dMs are variables introduced in order to simplify some Eqs. bellow:
23654  //..............................................................................................
23655  Double_t dM11 = (*fSpk)(1,1)-(*fSpk)(0,2); // dM11 = sum_{i,j=1,i!=j}^M w_i w_j
23656  Double_t dM111 = (*fSpk)(2,1)-3.*(*fSpk)(0,2)*(*fSpk)(0,1)
23657                 + 2.*(*fSpk)(0,3); // dM111 = sum_{i,j,k=1,i!=j!=k}^M w_i w_j w_k
23658  //..............................................................................................
23659          // 1-particle:
23660  Double_t cosP1nW1 = 0.; // <<w1 cos(n*(phi1))>>
23661    
23662  if(dMult>0 && TMath::Abs((*fSpk)(0,1))>1.e-6)
23663  {
23664   cosP1nW1 = dReQ1n1k/(*fSpk)(0,1); 
23665   
23666   // average weighted 1-particle correction (cos terms) for non-uniform acceptance for single event:
23667   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(1,cosP1nW1);
23668   
23669   // final average weighted 1-particle correction (cos terms) for non-uniform acceptance for all events:
23670   fIntFlowCorrectionTermsForNUAPro[1]->Fill(0.5,cosP1nW1,(*fSpk)(0,1));  
23671  } 
23672  
23673  // 2-particle:
23674  Double_t cosP1nP1nW1W1 = 0.; // <<w1 w2 cos(n*(phi1+phi2))>>
23675  
23676  if(dMult>1 && TMath::Abs(dM11)>1.e-6)
23677  {
23678   cosP1nP1nW1W1 = (pow(dReQ1n1k,2)-pow(dImQ1n1k,2)-dReQ2n2k)/dM11; 
23679   
23680   // average weighted 2-particle correction (cos terms) for non-uniform acceptance for single event:
23681   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(2,cosP1nP1nW1W1);
23682   
23683   // final average weighted 2-particle correction (cos terms) for non-uniform acceptance for all events:
23684   fIntFlowCorrectionTermsForNUAPro[1]->Fill(1.5,cosP1nP1nW1W1,dM11);  
23685  } 
23686  
23687  // 3-particle:
23688  Double_t cosP1nM1nM1nW1W1W1 = 0.; // <<w1 w2 w3 cos(n*(phi1-phi2-phi3))>>
23689  
23690  if(dMult>2 && TMath::Abs(dM111)>1.e-6)
23691  {
23692   cosP1nM1nM1nW1W1W1 = (dReQ1n1k*(pow(dReQ1n1k,2)+pow(dImQ1n1k,2))
23693                      - dReQ1n1k*dReQ2n2k-dImQ1n1k*dImQ2n2k
23694                      - 2.*((*fSpk)(0,2))*dReQ1n1k
23695                      + 2.*dReQ1n3k) 
23696                      / dM111; 
23697   
23698   // average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for single event:
23699   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(3,cosP1nM1nM1nW1W1W1);
23700   
23701   // final average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for all events:
23702   fIntFlowCorrectionTermsForNUAPro[1]->Fill(2.5,cosP1nM1nM1nW1W1W1,dM111);  
23703  } 
23704  
23705 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTermsUsingParticleWeights()
23706
23707
23708 //=======================================================================================================================
23709
23710
23711 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTermsUsingParticleWeights()
23712 {
23713  // calculate corrections using particle weights for non-uniform acceptance of the detector for no-name integrated flow (sin terms)
23714  
23715  //                                  **********************************************************************
23716  //                                  **** weighted corrections for non-uniform acceptance (sin terms): ****
23717  //                                  **********************************************************************
23718  
23719  // Remark 1: When particle weights are used the binning of fIntFlowCorrectionTermsForNUAPro[0] is organized as follows:
23720  //
23721  // 1st bin: <<w1 sin(n*(phi1))>> = sinP1nW1
23722  // 2nd bin: <<w1 w2 sin(n*(phi1+phi2))>> = sinP1nP1nW1W1
23723  // 3rd bin: <<w1 w2 w3 sin(n*(phi1-phi2-phi3))>> = sinP1nM1nM1nW1W1W1 
23724  // ...
23725
23726  // multiplicity (number of particles used to determine the reaction plane)
23727  Double_t dMult = (*fSpk)(0,0);
23728  
23729  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
23730  Double_t dReQ1n1k = (*fReQ)(0,1);
23731  Double_t dReQ2n2k = (*fReQ)(1,2);
23732  //Double_t dReQ3n3k = (*fReQ)(2,3);
23733  //Double_t dReQ4n4k = (*fReQ)(3,4);
23734  //Double_t dReQ1n3k = (*fReQ)(0,3);
23735  Double_t dImQ1n1k = (*fImQ)(0,1);
23736  Double_t dImQ2n2k = (*fImQ)(1,2);
23737  //Double_t dImQ3n3k = (*fImQ)(2,3);
23738  //Double_t dImQ4n4k = (*fImQ)(3,4);
23739  Double_t dImQ1n3k = (*fImQ)(0,3);
23740
23741  // dMs are variables introduced in order to simplify some Eqs. bellow:
23742  //..............................................................................................
23743  Double_t dM11 = (*fSpk)(1,1)-(*fSpk)(0,2); // dM11 = sum_{i,j=1,i!=j}^M w_i w_j
23744  Double_t dM111 = (*fSpk)(2,1)-3.*(*fSpk)(0,2)*(*fSpk)(0,1)
23745                 + 2.*(*fSpk)(0,3); // dM111 = sum_{i,j,k=1,i!=j!=k}^M w_i w_j w_k
23746  //..............................................................................................
23747  
23748  // 1-particle:
23749  Double_t sinP1nW1 = 0.; // <<w1 sin(n*(phi1))>>
23750  
23751  if(dMult>0 && TMath::Abs((*fSpk)(0,1))>1.e-6)
23752  {
23753   sinP1nW1 = dImQ1n1k/((*fSpk)(0,1)); 
23754      
23755   // average weighted 1-particle correction (sin terms) for non-uniform acceptance for single event:
23756   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(1,sinP1nW1);
23757   
23758   // final average weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:   
23759   fIntFlowCorrectionTermsForNUAPro[0]->Fill(0.5,sinP1nW1,(*fSpk)(0,1));  
23760  } 
23761  
23762  // 2-particle:
23763  Double_t sinP1nP1nW1W1 = 0.; // <<w1 w2 sin(n*(phi1+phi2))>>
23764  
23765  if(dMult>1 && TMath::Abs(dM11)>1.e-6)
23766  {
23767   sinP1nP1nW1W1 = (2.*dReQ1n1k*dImQ1n1k-dImQ2n2k)/dM11; 
23768      
23769   // average weighted 2-particle correction (sin terms) for non-uniform acceptance for single event:
23770   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(2,sinP1nP1nW1W1);
23771   
23772   // final average weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:      
23773   fIntFlowCorrectionTermsForNUAPro[0]->Fill(1.5,sinP1nP1nW1W1,dM11);  
23774  } 
23775  
23776  // 3-particle:
23777  Double_t sinP1nM1nM1nW1W1W1 = 0.; // <<w1 w2 w3 sin(n*(phi1-phi2-phi3))>>
23778  
23779  if(dMult>2 && TMath::Abs(dM111)>1.e-6)
23780  {
23781   sinP1nM1nM1nW1W1W1 = (-dImQ1n1k*(pow(dReQ1n1k,2)+pow(dImQ1n1k,2))
23782                      + dReQ1n1k*dImQ2n2k-dImQ1n1k*dReQ2n2k
23783                      + 2.*((*fSpk)(0,2))*dImQ1n1k
23784                      - 2.*dImQ1n3k)
23785                      / dM111; 
23786   
23787   // average weighted 3-particle correction (sin terms) for non-uniform acceptance for single event:
23788   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(3,sinP1nM1nM1nW1W1W1);
23789   
23790   // final average weighted 3-particle correction (sin terms) for non-uniform acceptance for all events:  
23791   fIntFlowCorrectionTermsForNUAPro[0]->Fill(2.5,sinP1nM1nM1nW1W1W1,dM111);  
23792  } 
23793  
23794 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTermsUsingParticleWeights()
23795
23796 //=======================================================================================================================
23797
23798 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrectionsForNUAWithNestedLoopsUsingParticleWeights(AliFlowEventSimple * const anEvent)
23799 {
23800  // Evaluate with nested loops correction terms for non-uniform acceptance for integrated flow (using the particle weights). 
23801
23802  // Results are stored in profiles fIntFlowDirectCorrectionTermsForNUA[0] (sin terms) and
23803  // fIntFlowDirectCorrectionTermsForNUA[1] (cos terms). 
23804  
23805  // Remark 1: When particle weights are used the binning of fIntFlowDirectCorrectionTermsForNUA[sc] is 
23806  // organized as follows (sc stands for either sin or cos):
23807  //
23808  // 1st bin: <<w1 sc(n*(phi1))>> = scP1nW1
23809  // 2nd bin: <<w1 w2 sc(n*(phi1+phi2))>> = scP1nP1nW1W1
23810  // 3rd bin: <<w1 w2 w3 sc(n*(phi1-phi2-phi3))>> = scP1nM1nM1nW1W1W1 
23811  // ...
23812   
23813  Int_t nPrim = anEvent->NumberOfTracks(); 
23814  AliFlowTrackSimple *aftsTrack = NULL;
23815  //Double_t phi1=0., phi2=0., phi3=0., phi4=0., phi5=0., phi6=0., phi7=0., phi8=0.;
23816  //Double_t wPhi1=1., wPhi2=1., wPhi3=1., wPhi4=1., wPhi5=1., wPhi6=1., wPhi7=1., wPhi8=1.;
23817  Double_t phi1=0., phi2=0., phi3=0.;
23818  Double_t wPhi1=1., wPhi2=1., wPhi3=1.;
23819  Int_t n = fHarmonic; 
23820  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // to be improved (is this casting safe in general?)
23821  Double_t dMult = (*fSpk)(0,0);
23822  cout<<endl;
23823  cout<<"Correction terms for non-uniform acceptance: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
23824  if(dMult<1)
23825  {
23826   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
23827  } else if (dMult>fMaxAllowedMultiplicity)
23828    {
23829     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
23830    } else 
23831      { 
23832       cout<<"... evaluating nested loops (using particle weights) ..."<<endl;
23833      } 
23834       
23835  // 1-particle correction terms using particle weights:       
23836  if(nPrim>=1 && nPrim<=fMaxAllowedMultiplicity)
23837  {
23838   for(Int_t i1=0;i1<nPrim;i1++)
23839   {
23840    aftsTrack=anEvent->GetTrack(i1);
23841    if(!(aftsTrack->InRPSelection())) continue;
23842    phi1=aftsTrack->Phi();
23843    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
23844    // 1-particle correction terms using particle weights:
23845    if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[0]->Fill(0.5,sin(n*phi1),wPhi1); // <w1 sin(n*phi1)>
23846    if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[1]->Fill(0.5,cos(n*phi1),wPhi1); // <w1 cos(n*phi1)>
23847   } // end of for(Int_t i1=0;i1<nPrim;i1++)
23848  } // end of if(nPrim>=1 && nPrim<=fMaxAllowedMultiplicity) 
23849  
23850  // 2-particle correction terms using particle weights:       
23851  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
23852  {
23853   for(Int_t i1=0;i1<nPrim;i1++)
23854   {
23855    aftsTrack=anEvent->GetTrack(i1);
23856    if(!(aftsTrack->InRPSelection())) continue;
23857    phi1=aftsTrack->Phi();
23858    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
23859    for(Int_t i2=0;i2<nPrim;i2++)
23860    {
23861     if(i2==i1)continue;
23862     aftsTrack=anEvent->GetTrack(i2);
23863     if(!(aftsTrack->InRPSelection())) continue;
23864     phi2=aftsTrack->Phi();
23865     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));   
23866     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
23867     // 2-p correction terms using particle weights:    
23868     if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[0]->Fill(1.5,sin(n*(phi1+phi2)),wPhi1*wPhi2); // <w1 w2 sin(n*(phi1+phi2))>
23869     if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[1]->Fill(1.5,cos(n*(phi1+phi2)),wPhi1*wPhi2); // <w1 w2 cos(n*(phi1+phi2))>
23870    } // end of for(Int_t i2=0;i2<nPrim;i2++)
23871   } // end of for(Int_t i1=0;i1<nPrim;i1++)
23872  } // end of if(nPrim>=2)
23873
23874  // 3-particle correction terms using particle weights:       
23875  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
23876  { 
23877   for(Int_t i1=0;i1<nPrim;i1++)
23878   {
23879    aftsTrack=anEvent->GetTrack(i1);
23880    if(!(aftsTrack->InRPSelection())) continue;
23881    phi1=aftsTrack->Phi();
23882    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
23883    for(Int_t i2=0;i2<nPrim;i2++)
23884    {
23885     if(i2==i1)continue;
23886     aftsTrack=anEvent->GetTrack(i2);
23887     if(!(aftsTrack->InRPSelection())) continue;
23888     phi2=aftsTrack->Phi();
23889     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
23890     for(Int_t i3=0;i3<nPrim;i3++)
23891     {
23892      if(i3==i1||i3==i2)continue;
23893      aftsTrack=anEvent->GetTrack(i3);
23894      if(!(aftsTrack->InRPSelection())) continue;
23895      phi3=aftsTrack->Phi();
23896      if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
23897      if(nPrim==3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush;
23898      // 3-p correction terms using particle weights:    
23899      if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[0]->Fill(2.5,sin(n*(phi1-phi2-phi3)),wPhi1*wPhi2*wPhi3); // <w1 w2 w3 sin(n*(phi1-phi2-phi3))>
23900      if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[1]->Fill(2.5,cos(n*(phi1-phi2-phi3)),wPhi1*wPhi2*wPhi3); // <w1 w2 w3 cos(n*(phi1-phi2-phi3))>
23901     } // end of for(Int_t i3=0;i3<nPrim;i3++)
23902    } // end of for(Int_t i2=0;i2<nPrim;i2++)
23903   } // end of for(Int_t i1=0;i1<nPrim;i1++)
23904  } // end of if(nPrim>=3)
23905  
23906  /*
23907  
23908  if(nPrim>=4 && nPrim<=fMaxAllowedMultiplicity)
23909  {
23910   // 4 nested loops multiparticle correlations using particle weights:       
23911   for(Int_t i1=0;i1<nPrim;i1++)
23912   {
23913    aftsTrack=anEvent->GetTrack(i1);
23914    if(!(aftsTrack->InRPSelection())) continue;
23915    phi1=aftsTrack->Phi();
23916    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
23917    for(Int_t i2=0;i2<nPrim;i2++)
23918    {
23919     if(i2==i1)continue;
23920     aftsTrack=anEvent->GetTrack(i2);
23921     if(!(aftsTrack->InRPSelection())) continue;
23922     phi2=aftsTrack->Phi();
23923     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
23924     for(Int_t i3=0;i3<nPrim;i3++)
23925     {
23926      if(i3==i1||i3==i2)continue;
23927      aftsTrack=anEvent->GetTrack(i3);
23928      if(!(aftsTrack->InRPSelection())) continue;
23929      phi3=aftsTrack->Phi();
23930      if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
23931      for(Int_t i4=0;i4<nPrim;i4++)
23932      {
23933       if(i4==i1||i4==i2||i4==i3)continue;
23934       aftsTrack=anEvent->GetTrack(i4);
23935       if(!(aftsTrack->InRPSelection())) continue;
23936       phi4=aftsTrack->Phi();
23937       if(fUsePhiWeights && fPhiWeights) wPhi4 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi4*fnBinsPhi/TMath::TwoPi())));
23938       if(nPrim>=4) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<"\r"<<flush; // to be improved (replace eventually this if statement with if(nPrim==4))
23939       // 4-p correlations using particle weights:
23940       if(fUsePhiWeights) fIntFlowDirectCorrelations->Fill(10.5,cos(n*phi1+n*phi2-n*phi3-n*phi4),wPhi1*wPhi2*wPhi3*wPhi4); 
23941       // extra correlations: 
23942       // 2-p extra correlations (do not appear if particle weights are not used):
23943       // ...
23944       // 3-p extra correlations (do not appear if particle weights are not used):
23945       // ...
23946       // 4-p extra correlations (do not appear if particle weights are not used):
23947       // ...
23948      } // end of for(Int_t i4=0;i4<nPrim;i4++) 
23949     } // end of for(Int_t i3=0;i3<nPrim;i3++)
23950    } // end of for(Int_t i2=0;i2<nPrim;i2++)
23951   } // end of for(Int_t i1=0;i1<nPrim;i1++)
23952  } // end of if(nPrim>=4)
23953
23954  */
23955
23956  cout<<endl; 
23957
23958 } // end of void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrectionsForNUAWithNestedLoopsUsingParticleWeights(AliFlowEventSimple* anEvent)
23959
23960 //=======================================================================================================================
23961
23962 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights(TString type, TString ptOrEta)
23963 {
23964  // Calculate correction terms for non-uniform acceptance for differential flow (cos terms) using particle weights.
23965  
23966  // Results are stored in fDiffFlowCorrectionTermsForNUAPro[t][pe][1][cti], where cti runs as follows:
23967  //
23968  //  0: <<cos n(psi)>>
23969  //  1: <<w2 cos n(psi1+phi2)>>
23970  //  2: <<w2 w3 cos n(psi1+phi2-phi3)>>
23971  //  3: <<w2 w3 cos n(psi1-phi2-phi3)>>
23972  //  4:
23973  //  5:
23974  //  6:
23975  
23976  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
23977  Double_t dReQ1n1k = (*fReQ)(0,1);
23978  Double_t dReQ2n2k = (*fReQ)(1,2);
23979  //Double_t dReQ1n3k = (*fReQ)(0,3);
23980  //Double_t dReQ4n4k = (*fReQ)(3,4);
23981  Double_t dImQ1n1k = (*fImQ)(0,1);
23982  Double_t dImQ2n2k = (*fImQ)(1,2);
23983  //Double_t dImQ1n3k = (*fImQ)(0,3);
23984  //Double_t dImQ4n4k = (*fImQ)(3,4);
23985  
23986  // S^M_{p,k} (see .h file for the definition of fSpk):
23987  Double_t dSM1p1k = (*fSpk)(0,1);
23988  Double_t dSM1p2k = (*fSpk)(0,2);
23989  Double_t dSM2p1k = (*fSpk)(1,1);
23990
23991  Int_t t = 0; // type flag 
23992  Int_t pe = 0; // ptEta flag
23993  
23994  if(type == "RP")
23995  {
23996   t = 0;
23997  } else if(type == "POI")
23998    {
23999     t = 1;
24000    }
24001
24002  if(ptOrEta == "Pt")
24003  {
24004   pe = 0;
24005  } else if(ptOrEta == "Eta")
24006    {
24007     pe = 1;
24008    }
24009     
24010  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
24011  Double_t minPtEta[2] = {fPtMin,fEtaMin};
24012  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
24013  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
24014  
24015  // looping over all bins and calculating correction terms: 
24016  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
24017  {
24018   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
24019   Double_t p1n0kRe = 0.;
24020   Double_t p1n0kIm = 0.;
24021
24022   // number of POIs in particular pt or eta bin:
24023   Double_t mp = 0.;
24024
24025   // 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):
24026   Double_t q1n2kRe = 0.;
24027   //Double_t q1n2kIm = 0.;
24028   Double_t q2n1kRe = 0.;
24029   Double_t q2n1kIm = 0.;
24030     
24031   // s_{1,1}, s_{1,2} // to be improved (add explanation)  
24032   Double_t s1p1k = 0.; 
24033   Double_t s1p2k = 0.; 
24034   
24035   // number of particles which are both RPs and POIs in particular pt or eta bin:
24036   //Double_t mq = 0.;
24037   
24038   // M0111 from Eq. (118) in QC2c (to be improved (notation))
24039   Double_t dM01 = 0.;
24040   Double_t dM011 = 0.;
24041   
24042   if(type == "POI")
24043   {           
24044    // q_{m*n,k}:
24045    q1n2kRe = fReRPQ1dEBE[2][pe][0][2]->GetBinContent(fReRPQ1dEBE[2][pe][0][2]->GetBin(b))
24046            * fReRPQ1dEBE[2][pe][0][2]->GetBinEntries(fReRPQ1dEBE[2][pe][0][2]->GetBin(b));
24047    //q1n2kIm = fImRPQ1dEBE[2][pe][0][2]->GetBinContent(fImRPQ1dEBE[2][pe][0][2]->GetBin(b))
24048    //        * fImRPQ1dEBE[2][pe][0][2]->GetBinEntries(fImRPQ1dEBE[2][pe][0][2]->GetBin(b));         
24049    q2n1kRe = fReRPQ1dEBE[2][pe][1][1]->GetBinContent(fReRPQ1dEBE[2][pe][1][1]->GetBin(b))
24050            * fReRPQ1dEBE[2][pe][1][1]->GetBinEntries(fReRPQ1dEBE[2][pe][1][1]->GetBin(b));
24051    q2n1kIm = fImRPQ1dEBE[2][pe][1][1]->GetBinContent(fImRPQ1dEBE[2][pe][1][1]->GetBin(b))
24052            * fImRPQ1dEBE[2][pe][1][1]->GetBinEntries(fImRPQ1dEBE[2][pe][1][1]->GetBin(b));         
24053    //mq = fReRPQ1dEBE[2][pe][1][1]->GetBinEntries(fReRPQ1dEBE[2][pe][1][1]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
24054    
24055    s1p1k = pow(fs1dEBE[2][pe][1]->GetBinContent(b)*fs1dEBE[2][pe][1]->GetBinEntries(b),1.); 
24056    s1p2k = pow(fs1dEBE[2][pe][2]->GetBinContent(b)*fs1dEBE[2][pe][2]->GetBinEntries(b),1.); 
24057   }else if(type == "RP")
24058    {
24059     // q_{m*n,k}: (Remark: m=1 is 0, k=0 iz zero (to be improved!)) 
24060     q1n2kRe = fReRPQ1dEBE[0][pe][0][2]->GetBinContent(fReRPQ1dEBE[0][pe][0][2]->GetBin(b))
24061             * fReRPQ1dEBE[0][pe][0][2]->GetBinEntries(fReRPQ1dEBE[0][pe][0][2]->GetBin(b));
24062     //q1n2kIm = fImRPQ1dEBE[0][pe][0][2]->GetBinContent(fImRPQ1dEBE[0][pe][0][2]->GetBin(b))
24063     //        * fImRPQ1dEBE[0][pe][0][2]->GetBinEntries(fImRPQ1dEBE[0][pe][0][2]->GetBin(b));
24064     q2n1kRe = fReRPQ1dEBE[0][pe][1][1]->GetBinContent(fReRPQ1dEBE[0][pe][1][1]->GetBin(b))
24065             * fReRPQ1dEBE[0][pe][1][1]->GetBinEntries(fReRPQ1dEBE[0][pe][1][1]->GetBin(b));
24066     q2n1kIm = fImRPQ1dEBE[0][pe][1][1]->GetBinContent(fImRPQ1dEBE[0][pe][1][1]->GetBin(b))
24067             * fImRPQ1dEBE[0][pe][1][1]->GetBinEntries(fImRPQ1dEBE[0][pe][1][1]->GetBin(b));
24068     // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
24069     s1p1k = pow(fs1dEBE[0][pe][1]->GetBinContent(b)*fs1dEBE[0][pe][1]->GetBinEntries(b),1.); 
24070     s1p2k = pow(fs1dEBE[0][pe][2]->GetBinContent(b)*fs1dEBE[0][pe][2]->GetBinEntries(b),1.); 
24071     //s1p3k = pow(fs1dEBE[0][pe][3]->GetBinContent(b)*fs1dEBE[0][pe][3]->GetBinEntries(b),1.);  
24072     
24073     //mq = fReRPQ1dEBE[0][pe][1][1]->GetBinEntries(fReRPQ1dEBE[0][pe][1][1]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here) 
24074   }    
24075   
24076   if(type == "POI")
24077   {
24078    // p_{m*n,k}:   
24079    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
24080            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
24081    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
24082            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
24083    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here) 
24084    // M01 from Eq. (118) in QC2c (to be improved (notation)):
24085    dM01 = mp*dSM1p1k-s1p1k;
24086    dM011 = mp*(dSM2p1k-dSM1p2k)
24087          - 2.*(s1p1k*dSM1p1k-s1p2k);
24088        
24089    // typeFlag = RP (0) or POI (1):   
24090    t = 1; 
24091   } else if(type == "RP")
24092     {  
24093      // to be improved (cross-checked):
24094      p1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
24095              * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
24096      p1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))  
24097              * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
24098      mp = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
24099      // M01 from Eq. (118) in QC2c (to be improved (notation)):
24100      dM01 = mp*dSM1p1k-s1p1k;
24101      dM011 = mp*(dSM2p1k-dSM1p2k)
24102            - 2.*(s1p1k*dSM1p1k-s1p2k); 
24103      // typeFlag = RP (0) or POI (1): 
24104      t = 0;
24105     }
24106   
24107   // <<cos n(psi1)>>:
24108   Double_t cosP1nPsi = 0.;
24109   if(mp)
24110   {
24111    cosP1nPsi = p1n0kRe/mp;
24112    
24113    // fill profile for <<cos n(psi1)>>:
24114    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi,mp);
24115    // histogram to store <cos n(psi1)> e-b-e (needed in some other methods):
24116    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][0]->SetBinContent(b,cosP1nPsi);
24117   } // end of if(mp)   
24118   
24119   // <<w2 cos n(psi1+phi2)>>:
24120   Double_t cosP1nPsiP1nPhiW2 = 0.;
24121   if(dM01)
24122   {
24123    cosP1nPsiP1nPhiW2 = (p1n0kRe*dReQ1n1k-p1n0kIm*dImQ1n1k-q2n1kRe)/(dM01);
24124    // fill profile for <<w2 cos n(psi1+phi2)>>:
24125    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsiP1nPhiW2,dM01);
24126    // histogram to store <w2 cos n(psi1+phi2)> e-b-e (needed in some other methods):
24127    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][1]->SetBinContent(b,cosP1nPsiP1nPhiW2);
24128   } // end of if(dM01)   
24129   
24130   // <<w2 w3 cos n(psi1+phi2-phi3)>>:
24131   Double_t cosP1nPsi1P1nPhi2MPhi3W2W3 = 0.;
24132   if(dM011)
24133   {
24134    cosP1nPsi1P1nPhi2MPhi3W2W3 = (p1n0kRe*(pow(dImQ1n1k,2.)+pow(dReQ1n1k,2.))
24135                               - p1n0kRe*dSM1p2k
24136                               - q2n1kRe*dReQ1n1k-q2n1kIm*dImQ1n1k
24137                               - s1p1k*dReQ1n1k
24138                               + 2.*q1n2kRe)
24139                               / dM011;  
24140    // fill profile for <<w1 w2 w3 cos n(psi1+phi2)>>:
24141    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1P1nPhi2MPhi3W2W3,dM011);
24142    // histogram to store <w1 w2 w3 cos n(psi1+phi2)> e-b-e (needed in some other methods):
24143    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][2]->SetBinContent(b,cosP1nPsi1P1nPhi2MPhi3W2W3);
24144   } // end of if(dM011)   
24145   
24146   // <<w2 w3 cos n(psi1-phi2-phi3)>>:
24147   Double_t cosP1nPsi1M1nPhi2MPhi3W2W3 = 0.;
24148   if(dM011)
24149   {
24150    cosP1nPsi1M1nPhi2MPhi3W2W3 = (p1n0kRe*(pow(dReQ1n1k,2.)-pow(dImQ1n1k,2.))+2.*p1n0kIm*dReQ1n1k*dImQ1n1k
24151                               - 1.*(p1n0kRe*dReQ2n2k+p1n0kIm*dImQ2n2k)  
24152                               - 2.*s1p1k*dReQ1n1k
24153                               + 2.*q1n2kRe)
24154                               / dM011;
24155    // fill profile for <<w1 w2 w3 cos n(psi1+phi2)>>:
24156    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1M1nPhi2MPhi3W2W3,dM011);
24157    // histogram to store <w1 w2 w3 cos n(psi1+phi2)> e-b-e (needed in some other methods):
24158    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][3]->SetBinContent(b,cosP1nPsi1M1nPhi2MPhi3W2W3);
24159   } // end of if(dM011)   
24160  
24161  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
24162    
24163 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights(TString type, TString ptOrEta)
24164
24165
24166 //=======================================================================================================================
24167
24168
24169 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights(TString type, TString ptOrEta)
24170 {
24171  // Calculate correction terms for non-uniform acceptance for differential flow (sin terms).
24172   
24173  // Results are stored in fDiffFlowCorrectionTermsForNUAPro[t][pe][0][cti], where cti runs as follows:
24174  //  0: <<sin n(psi1)>>
24175  //  1: <<w2 sin n(psi1+phi2)>>
24176  //  2: <<w2 w3 sin n(psi1+phi2-phi3)>>
24177  //  3: <<w2 w3 sin n(psi1-phi2-phi3)>>:
24178  //  4:
24179  //  5:
24180  //  6:
24181  
24182  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
24183  Double_t dReQ1n1k = (*fReQ)(0,1);
24184  Double_t dReQ2n2k = (*fReQ)(1,2);
24185  //Double_t dReQ1n3k = (*fReQ)(0,3);
24186  //Double_t dReQ4n4k = (*fReQ)(3,4);
24187  Double_t dImQ1n1k = (*fImQ)(0,1);
24188  Double_t dImQ2n2k = (*fImQ)(1,2);
24189  //Double_t dImQ1n3k = (*fImQ)(0,3);
24190  //Double_t dImQ4n4k = (*fImQ)(3,4);
24191  
24192  // S^M_{p,k} (see .h file for the definition of fSpk):
24193  Double_t dSM1p1k = (*fSpk)(0,1);
24194  Double_t dSM1p2k = (*fSpk)(0,2);
24195  Double_t dSM2p1k = (*fSpk)(1,1);
24196
24197  Int_t t = 0; // type flag 
24198  Int_t pe = 0; // ptEta flag
24199  
24200  if(type == "RP")
24201  {
24202   t = 0;
24203  } else if(type == "POI")
24204    {
24205     t = 1;
24206    }
24207
24208  if(ptOrEta == "Pt")
24209  {
24210   pe = 0;
24211  } else if(ptOrEta == "Eta")
24212    {
24213     pe = 1;
24214    }
24215     
24216  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
24217  Double_t minPtEta[2] = {fPtMin,fEtaMin};
24218  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
24219  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
24220
24221  // looping over all bins and calculating correction terms: 
24222  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
24223  {
24224   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
24225   Double_t p1n0kRe = 0.;
24226   Double_t p1n0kIm = 0.;
24227
24228   // number of POIs in particular pt or eta bin:
24229   Double_t mp = 0.;
24230
24231   // 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):
24232   //Double_t q1n2kRe = 0.;
24233   Double_t q1n2kIm = 0.;
24234   Double_t q2n1kRe = 0.;
24235   Double_t q2n1kIm = 0.;
24236     
24237   // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
24238   Double_t s1p1k = 0.; 
24239   Double_t s1p2k = 0.; 
24240   
24241   // number of particles which are both RPs and POIs in particular pt or eta bin:
24242   //Double_t mq = 0.;
24243   
24244   // M0111 from Eq. (118) in QC2c (to be improved (notation))
24245   Double_t dM01 = 0.;
24246   Double_t dM011 = 0.;
24247
24248   if(type == "POI")
24249   {    
24250    // q_{m*n,k}:
24251    //q1n2kRe = fReRPQ1dEBE[2][pe][0][2]->GetBinContent(fReRPQ1dEBE[2][pe][0][2]->GetBin(b))
24252    //        * fReRPQ1dEBE[2][pe][0][2]->GetBinEntries(fReRPQ1dEBE[2][pe][0][2]->GetBin(b));
24253    q1n2kIm = fImRPQ1dEBE[2][pe][0][2]->GetBinContent(fImRPQ1dEBE[2][pe][0][2]->GetBin(b))
24254            * fImRPQ1dEBE[2][pe][0][2]->GetBinEntries(fImRPQ1dEBE[2][pe][0][2]->GetBin(b));         
24255    q2n1kRe = fReRPQ1dEBE[2][pe][1][1]->GetBinContent(fReRPQ1dEBE[2][pe][1][1]->GetBin(b))
24256            * fReRPQ1dEBE[2][pe][1][1]->GetBinEntries(fReRPQ1dEBE[2][pe][1][1]->GetBin(b));
24257    q2n1kIm = fImRPQ1dEBE[2][pe][1][1]->GetBinContent(fImRPQ1dEBE[2][pe][1][1]->GetBin(b))
24258            * fImRPQ1dEBE[2][pe][1][1]->GetBinEntries(fImRPQ1dEBE[2][pe][1][1]->GetBin(b));         
24259    //mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
24260    
24261    s1p1k = pow(fs1dEBE[2][pe][1]->GetBinContent(b)*fs1dEBE[2][pe][1]->GetBinEntries(b),1.); 
24262    s1p2k = pow(fs1dEBE[2][pe][2]->GetBinContent(b)*fs1dEBE[2][pe][2]->GetBinEntries(b),1.); 
24263   }else if(type == "RP")
24264    {
24265     // q_{m*n,k}: (Remark: m=1 is 0, k=0 iz zero (to be improved!)) 
24266     //q1n2kRe = fReRPQ1dEBE[0][pe][0][2]->GetBinContent(fReRPQ1dEBE[0][pe][0][2]->GetBin(b))
24267     //        * fReRPQ1dEBE[0][pe][0][2]->GetBinEntries(fReRPQ1dEBE[0][pe][0][2]->GetBin(b));
24268     q1n2kIm = fImRPQ1dEBE[0][pe][0][2]->GetBinContent(fImRPQ1dEBE[0][pe][0][2]->GetBin(b))
24269             * fImRPQ1dEBE[0][pe][0][2]->GetBinEntries(fImRPQ1dEBE[0][pe][0][2]->GetBin(b));
24270     q2n1kRe = fReRPQ1dEBE[0][pe][1][1]->GetBinContent(fReRPQ1dEBE[0][pe][1][1]->GetBin(b))
24271             * fReRPQ1dEBE[0][pe][1][1]->GetBinEntries(fReRPQ1dEBE[0][pe][1][1]->GetBin(b));
24272     q2n1kIm = fImRPQ1dEBE[0][pe][1][1]->GetBinContent(fImRPQ1dEBE[0][pe][1][1]->GetBin(b))
24273             * fImRPQ1dEBE[0][pe][1][1]->GetBinEntries(fImRPQ1dEBE[0][pe][1][1]->GetBin(b));
24274     // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
24275     s1p1k = pow(fs1dEBE[0][pe][1]->GetBinContent(b)*fs1dEBE[0][pe][1]->GetBinEntries(b),1.); 
24276     s1p2k = pow(fs1dEBE[0][pe][2]->GetBinContent(b)*fs1dEBE[0][pe][2]->GetBinEntries(b),1.); 
24277     //s1p3k = pow(fs1dEBE[0][pe][3]->GetBinContent(b)*fs1dEBE[0][pe][3]->GetBinEntries(b),1.); 
24278   }    
24279   
24280   if(type == "POI")
24281   {
24282    // p_{m*n,k}:   
24283    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
24284            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
24285    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
24286            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
24287    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here) 
24288    // M01 from Eq. (118) in QC2c (to be improved (notation)):
24289    dM01 = mp*dSM1p1k-s1p1k;
24290    dM011 = mp*(dSM2p1k-dSM1p2k)
24291          - 2.*(s1p1k*dSM1p1k-s1p2k);  
24292    // typeFlag = RP (0) or POI (1):   
24293    t = 1;           
24294   } else if(type == "RP")
24295     { 
24296      // to be improved (cross-checked):
24297      p1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
24298              * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
24299      p1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))  
24300              * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
24301      mp = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)    
24302      // M01 from Eq. (118) in QC2c (to be improved (notation)):
24303      dM01 = mp*dSM1p1k-s1p1k;
24304      dM011 = mp*(dSM2p1k-dSM1p2k)
24305            - 2.*(s1p1k*dSM1p1k-s1p2k); 
24306      // typeFlag = RP (0) or POI (1): 
24307      t = 0;
24308     }
24309   
24310   // <<sin n(psi1)>>:
24311   Double_t sinP1nPsi = 0.;
24312   if(mp)
24313   {
24314    sinP1nPsi = p1n0kIm/mp;
24315    
24316    // fill profile for <<sin n(psi1)>>:
24317    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi,mp);
24318    // histogram to store <sin n(psi1)> e-b-e (needed in some other methods):
24319    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][0]->SetBinContent(b,sinP1nPsi);
24320   } // end of if(mp)   
24321   
24322   // <<w2 sin n(psi1+phi2)>>:
24323   Double_t sinP1nPsiP1nPhiW2 = 0.;
24324   if(dM01)
24325   {
24326    sinP1nPsiP1nPhiW2 = (p1n0kRe*dImQ1n1k+p1n0kIm*dReQ1n1k-q2n1kIm)/(dM01);
24327    // fill profile for <<w2 sin n(psi1+phi2)>>:
24328    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsiP1nPhiW2,dM01);
24329    // histogram to store <w2 sin n(psi1+phi2)> e-b-e (needed in some other methods):
24330    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][1]->SetBinContent(b,sinP1nPsiP1nPhiW2);
24331   } // end of if(mp*dMult-mq)   
24332   
24333   // <<w2 w3 sin n(psi1+phi2-phi3)>>:
24334   Double_t sinP1nPsi1P1nPhi2MPhi3W2W3 = 0.;
24335   if(dM011)
24336   {
24337    sinP1nPsi1P1nPhi2MPhi3W2W3 = (p1n0kIm*(pow(dImQ1n1k,2.)+pow(dReQ1n1k,2.))
24338                               - p1n0kIm*dSM1p2k
24339                               + q2n1kRe*dImQ1n1k-q2n1kIm*dReQ1n1k
24340                               - s1p1k*dImQ1n1k
24341                               + 2.*q1n2kIm)
24342                               / dM011;  
24343    // fill profile for <<w2 w3 sin n(psi1+phi2-phi3)>>:
24344    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1P1nPhi2MPhi3W2W3,dM011);
24345    // histogram to store <w2 w3 sin n(psi1+phi2-phi3)> e-b-e (needed in some other methods):
24346    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][2]->SetBinContent(b,sinP1nPsi1P1nPhi2MPhi3W2W3);
24347   } // end of if(dM011)   
24348   
24349   // <<w2 w3 sin n(psi1-phi2-phi3)>>:
24350   Double_t sinP1nPsi1M1nPhi2MPhi3W2W3 = 0.;
24351   if(dM011)
24352   {
24353    sinP1nPsi1M1nPhi2MPhi3W2W3 = (p1n0kIm*(pow(dReQ1n1k,2.)-pow(dImQ1n1k,2.))-2.*p1n0kRe*dReQ1n1k*dImQ1n1k
24354                               + 1.*(p1n0kRe*dImQ2n2k-p1n0kIm*dReQ2n2k)  
24355                               + 2.*s1p1k*dImQ1n1k
24356                               - 2.*q1n2kIm)
24357                               / dM011;
24358    // fill profile for <<w2 w3 sin n(psi1-phi2-phi3)>>:
24359    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1M1nPhi2MPhi3W2W3,dM011);
24360    // histogram to store <w2 w3 sin n(psi1-phi2-phi3)> e-b-e (needed in some other methods):
24361    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][3]->SetBinContent(b,sinP1nPsi1M1nPhi2MPhi3W2W3);
24362   } // end of if(dM011)   
24363   
24364  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
24365
24366 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights(TString type, TString ptOrEta)
24367
24368 //=======================================================================================================================
24369    
24370 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
24371 {
24372  // Evaluate with nested loops correction terms for non-uniform acceptance 
24373  // with using particle weights (both sin and cos terms) relevant for differential flow.
24374  
24375  // Remark 1: "w1" in expressions bellow is a particle weight used only for particles which were 
24376  //           flagged both as POI and RP.
24377  // Remark 2: Reduced correction terms for non-uniform acceptance are evaluated in pt bin number fCrossCheckInPtBinNo 
24378  //           and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
24379  // Remark 3: Results are stored in 1 bin profiles fDiffFlowDirectCorrections[t][pe][sc][cti], where first three indices runs as: 
24380  //           [0=RP,1=POI][0=Pt,1=Eta][0=sin terms,1=cos terms], whilst the cti (correction term index) runs as follows: 
24381  //  cti: 
24382  //    0: <<sc n(psi1)>>
24383  //    1: <<w2 sc n(psi1+phi2)>> 
24384  //    2: <<w2 w3 sc n(psi1+phi2-phi3)>>
24385  //    3: <<w2 w3 sc n(psi1-phi2-phi3)>>
24386  //    4:
24387  //    5:
24388  //    6:
24389      
24390  Int_t typeFlag = 0;
24391  Int_t ptEtaFlag = 0;
24392  if(type == "RP")
24393  {
24394   typeFlag = 0;
24395  } else if(type == "POI")
24396    {
24397     typeFlag = 1;
24398    }      
24399  if(ptOrEta == "Pt")
24400  {
24401   ptEtaFlag = 0;
24402  } else if(ptOrEta == "Eta")
24403    {
24404     ptEtaFlag = 1;
24405    } 
24406  // shortcuts:
24407  Int_t t = typeFlag;
24408  Int_t pe = ptEtaFlag;
24409       
24410  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
24411  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
24412  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
24413  
24414  Int_t nPrim = anEvent->NumberOfTracks(); 
24415  AliFlowTrackSimple *aftsTrack = NULL;
24416  
24417  Double_t psi1=0., phi2=0., phi3=0.;// phi4=0.;// phi5=0., phi6=0., phi7=0., phi8=0.;
24418  Double_t wPhi2=1., wPhi3=1.;
24419  
24420  Int_t n = fHarmonic; 
24421  
24422  // 1'-particle correction terms:
24423  for(Int_t i1=0;i1<nPrim;i1++)
24424  {
24425   aftsTrack=anEvent->GetTrack(i1);
24426   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
24427   if(typeFlag==1) // this is diff flow of POIs 
24428   {
24429    if(ptOrEta == "Pt")
24430    { 
24431     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
24432    } else if (ptOrEta == "Eta")
24433      {
24434       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
24435      }
24436   } else // this is diff flow of RPs 
24437     {
24438      if(ptOrEta == "Pt")
24439      { 
24440       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
24441      } else if (ptOrEta == "Eta")
24442        {
24443         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
24444        }
24445     }
24446   psi1=aftsTrack->Phi(); 
24447   // sin terms: 
24448   fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*psi1),1.); // <<sin(n*(psi1))>>  
24449   // cos terms: 
24450   fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*psi1),1.); // <<cos(n*(psi1))>>  
24451  }//end of for(Int_t i1=0;i1<nPrim;i1++)
24452    
24453  // 2'-particle correction terms:
24454  for(Int_t i1=0;i1<nPrim;i1++)
24455  {
24456   aftsTrack=anEvent->GetTrack(i1);
24457   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
24458   if(typeFlag==1) // this is diff flow of POIs 
24459   {
24460    if(ptOrEta == "Pt")
24461    { 
24462     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
24463    } else if (ptOrEta == "Eta")
24464      {
24465       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
24466      }
24467   } else // this is diff flow of RPs 
24468     {
24469      if(ptOrEta == "Pt")
24470      { 
24471       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
24472      } else if (ptOrEta == "Eta")
24473        {
24474         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
24475        }
24476     }
24477   psi1=aftsTrack->Phi(); 
24478   for(Int_t i2=0;i2<nPrim;i2++)
24479   {
24480    if(i2==i1) continue;
24481    aftsTrack=anEvent->GetTrack(i2);
24482    // RP condition (!(first) particle in the correlator must be RP):
24483    if(!(aftsTrack->InRPSelection())) continue;
24484    phi2=aftsTrack->Phi();
24485    if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));   
24486    // sin terms: 
24487    fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1+phi2)),wPhi2); // <<w2 sin(n*(psi1+phi2))>>  
24488    // cos terms: 
24489    fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2)),wPhi2); // <<w2 cos(n*(psi1+phi2))>>  
24490   }//end of for(Int_t i2=0;i2<nPrim;i2++)
24491  }//end of for(Int_t i1=0;i1<nPrim;i1++)   
24492  
24493  // 3'-particle correction terms:
24494  for(Int_t i1=0;i1<nPrim;i1++)
24495  {
24496   aftsTrack=anEvent->GetTrack(i1);
24497   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
24498   if(typeFlag==1) // this is diff flow of POIs 
24499   {
24500    if(ptOrEta == "Pt")
24501    { 
24502     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
24503    } else if (ptOrEta == "Eta")
24504      {
24505       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
24506      }
24507   } else // this is diff flow of RPs 
24508     {
24509      if(ptOrEta == "Pt")
24510      { 
24511       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
24512      } else if (ptOrEta == "Eta")
24513        {
24514         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
24515        }
24516     }
24517   psi1=aftsTrack->Phi();
24518   for(Int_t i2=0;i2<nPrim;i2++)
24519   {
24520    if(i2==i1) continue;
24521    aftsTrack=anEvent->GetTrack(i2);
24522    // RP condition (!(first) particle in the correlator must be RP):
24523    if(!(aftsTrack->InRPSelection())) continue;
24524    phi2=aftsTrack->Phi();
24525    if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));   
24526    for(Int_t i3=0;i3<nPrim;i3++)
24527    {
24528     if(i3==i1||i3==i2) continue;
24529     aftsTrack=anEvent->GetTrack(i3);
24530     // RP condition (!(first) particle in the correlator must be RP):
24531     if(!(aftsTrack->InRPSelection())) continue;
24532     phi3=aftsTrack->Phi();
24533     if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));   
24534     // sin terms: 
24535     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))>>  
24536     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))>>  
24537     // cos terms: 
24538     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))>>  
24539     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))>>  
24540    }//end of for(Int_t i3=0;i3<nPrim;i3++)  
24541   }//end of for(Int_t i2=0;i2<nPrim;i2++)  
24542  }//end of for(Int_t i1=0;i1<nPrim;i1++)
24543                
24544 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(AliFlowEventSimple* anEvent, TString type, TString ptOrEta)
24545
24546 //=======================================================================================================================
24547
24548 void AliFlowAnalysisWithQCumulants::CheckPointersUsedInFinish()
24549 {
24550  // Check all pointers used in method Finish().
24551  
24552  if(!fAvMultiplicity)
24553  {
24554   cout<<endl;
24555   cout<<" WARNING (QC): fAvMultiplicity is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24556   cout<<endl;
24557   exit(0);
24558  }
24559  if(!fIntFlowCorrelationsPro)
24560  {
24561   cout<<endl;
24562   cout<<" WARNING (QC): fIntFlowCorrelationsPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24563   cout<<endl;
24564   exit(0); 
24565  }
24566  if(!fIntFlowSquaredCorrelationsPro)
24567  {
24568   cout<<endl;
24569   cout<<" WARNING (QC): fIntFlowSquaredCorrelationsPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24570   cout<<endl;
24571   exit(0); 
24572  } 
24573  if(!fIntFlowCorrelationsHist)
24574  {
24575   cout<<endl;
24576   cout<<" WARNING (QC): fIntFlowCorrelationsHist is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24577   cout<<endl;
24578   exit(0); 
24579  }
24580  if((fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights) && !fIntFlowExtraCorrelationsPro) 
24581  {
24582   cout<<endl;
24583   cout<<" WARNING (QC): fIntFlowExtraCorrelationsPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24584   cout<<endl;
24585   exit(0); 
24586  } 
24587  for(Int_t power=0;power<2;power++)
24588  { 
24589   if(!fIntFlowSumOfEventWeights[power]) 
24590   {
24591    cout<<endl;
24592    cout<<Form(" WARNING (QC): fIntFlowSumOfEventWeights[%d] is NULL in CheckPointersUsedInFinish() !!!!",power)<<endl;
24593    cout<<endl;
24594    exit(0);
24595   }
24596  } // end of for(Int_t power=0;power<2;power++)
24597  if(!fIntFlowProductOfCorrelationsPro)
24598  {
24599   cout<<endl;
24600   cout<<" WARNING (QC): fIntFlowProductOfCorrelationsPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24601   cout<<endl;
24602   exit(0); 
24603  } 
24604  if(!fIntFlowSumOfProductOfEventWeights)
24605  {
24606   cout<<endl;
24607   cout<<" WARNING (QC): fIntFlowSumOfProductOfEventWeights is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24608   cout<<endl;
24609   exit(0); 
24610  }
24611  if(!fIntFlowCovariances)
24612  {
24613   cout<<endl;
24614   cout<<" WARNING (QC): fIntFlowCovariances is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24615   cout<<endl;
24616   exit(0); 
24617  }  
24618  if(!fIntFlowQcumulants)
24619  {
24620   cout<<endl;
24621   cout<<" WARNING (QC): fIntFlowQcumulants is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24622   cout<<endl;
24623   exit(0); 
24624  }  
24625  if(!fIntFlow)
24626  {
24627   cout<<endl;
24628   cout<<" WARNING (QC): fIntFlow is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24629   cout<<endl;
24630   exit(0); 
24631  }
24632  if(!fCommonHists)
24633  {
24634   cout<<endl;
24635   cout<<" WARNING (QC): fCommonHists is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24636   cout<<endl;
24637   exit(0); 
24638  }
24639  if(!(fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th))
24640  {
24641   cout<<endl;
24642   cout<<" WARNING (QC): fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th"<<endl; 
24643   cout<<"               && fCommonHistsResults8th is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24644   cout<<endl;
24645   exit(0);
24646  } 
24647
24648  // NUA stuff:
24649  for(Int_t sc=0;sc<2;sc++) // sin/cos
24650  { 
24651   if(!fIntFlowCorrectionTermsForNUAPro[sc]) 
24652   {
24653    cout<<endl;
24654    cout<<Form(" WARNING (QC): fIntFlowCorrectionTermsForNUAPro[%d] is NULL in CheckPointersUsedInFinish() !!!!",sc)<<endl;
24655    cout<<endl;
24656    exit(0);
24657   }
24658   if(!fIntFlowCorrectionTermsForNUAHist[sc]) 
24659   {
24660    cout<<endl;
24661    cout<<Form(" WARNING (QC): fIntFlowCorrectionTermsForNUAHist[%d] is NULL in CheckPointersUsedInFinish() !!!!",sc)<<endl;
24662    cout<<endl;
24663    exit(0);
24664   }
24665   for(Int_t lq=0;lq<2;lq++) // linear/quadratic
24666   {
24667    if(!fIntFlowSumOfEventWeightsNUA[sc][lq]) 
24668    {
24669     cout<<endl;
24670     cout<<Form(" WARNING (QC): fIntFlowSumOfEventWeightsNUA[%d][%d] is NULL in CheckPointersUsedInFinish() !!!!",sc,lq)<<endl;
24671     cout<<endl;
24672     exit(0);
24673    }
24674   } // end of for(Int_t lq=0;lq<2;lq++) // linear/quadratic
24675  } // end of for(Int_t power=0;power<2;power++) 
24676  if(!fIntFlowProductOfCorrectionTermsForNUAPro)
24677  {
24678   cout<<endl;
24679   cout<<" WARNING (QC): fIntFlowProductOfCorrectionTermsForNUAPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24680   cout<<endl;
24681   exit(0); 
24682  } 
24683  if(!fIntFlowSumOfProductOfEventWeightsNUA)
24684  {
24685   cout<<endl;
24686   cout<<" WARNING (QC): fIntFlowSumOfProductOfEventWeightsNUA is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24687   cout<<endl;
24688   exit(0); 
24689  } 
24690  if(!fIntFlowCovariancesNUA)
24691  {
24692   cout<<endl;
24693   cout<<" WARNING (QC): fIntFlowCovariancesNUA is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24694   cout<<endl;
24695   exit(0); 
24696  } 
24697  if(!fIntFlowQcumulantsErrorSquaredRatio)
24698  {
24699   cout<<endl;
24700   cout<<" WARNING (QC): fIntFlowQcumulantsErrorSquaredRatio is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24701   cout<<endl;
24702   exit(0); 
24703  } 
24704  if(!fIntFlowDetectorBias)
24705  {
24706   cout<<endl;
24707   cout<<" WARNING (QC): fIntFlowDetectorBias is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24708   cout<<endl;
24709   exit(0); 
24710  }
24711  
24712  if(fCalculateMixedHarmonics)
24713  {
24714   if(!(fMixedHarmonicsFlags))
24715   {
24716    cout<<endl;
24717    cout<<" WARNING (QC): fMixedHarmonicsFlags is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24718    cout<<endl;
24719    exit(0); 
24720   }
24721   if(!(f2pCorrelations && f3pCorrelations && f4pCorrelations && f5pCorrelations))
24722   {
24723    cout<<endl;
24724    cout<<" WARNING (QC): f2pCorrelations && f3pCorrelations && f4pCorrelations && f5pCorrelations is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24725    cout<<endl;
24726    exit(0); 
24727   }
24728   if(!(f2pCumulants && f3pCumulants && f4pCumulants && f5pCumulants))
24729   {
24730    cout<<endl;
24731    cout<<" WARNING (QC): f2pCumulants && f3pCumulants && f4pCumulants && f5pCumulants is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24732    cout<<endl;
24733    exit(0); 
24734   }
24735   for(Int_t power=0;power<2;power++)
24736   { 
24737    if(!fMixedHarmonicEventWeights[power]) 
24738    {
24739     cout<<endl;
24740     cout<<Form(" WARNING (QC): fMixedHarmonicEventWeights[%d] is NULL in CheckPointersUsedInFinish() !!!!",power)<<endl;
24741     cout<<endl;
24742     exit(0);
24743    }
24744   } // end of for(Int_t power=0;power<2;power++)
24745   if(!(fMixedHarmonicProductOfEventWeights))
24746   {
24747    cout<<endl;
24748    cout<<" WARNING (QC): fMixedHarmonicProductOfEventWeights is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24749    cout<<endl;
24750    exit(0); 
24751   }
24752   if(!(fMixedHarmonicProductOfCorrelations))
24753   {
24754    cout<<endl;
24755    cout<<" WARNING (QC): fMixedHarmonicProductOfCorrelations is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24756    cout<<endl;
24757    exit(0); 
24758   }
24759  } // end of if(fCalculateMixedHarmonics)
24760
24761  // Versus multiplicity:
24762  if(!fCalculateCumulantsVsM){return;}
24763  for(Int_t co=0;co<=3;co++) // cumulant order
24764  {
24765   if(!fIntFlowQcumulantsVsM[co])
24766   {
24767    cout<<endl;
24768    cout<<Form(" WARNING (QC): fIntFlowQcumulantsVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",co)<<endl;
24769    cout<<endl;
24770    exit(0); 
24771   }
24772   if(!fIntFlowVsM[co])
24773   {
24774    cout<<endl;
24775    cout<<Form(" WARNING (QC): fIntFlowVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",co)<<endl;
24776    cout<<endl;
24777    exit(0); 
24778   }
24779   if(!fIntFlowDetectorBiasVsM[co])
24780   {
24781    cout<<endl;
24782    cout<<Form(" WARNING (QC): fIntFlowDetectorBiasVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",co)<<endl;
24783    cout<<endl;
24784    exit(0); 
24785   }
24786  } // end of for(Int_t c0=0;c0<=3;c0++) // cumulant order
24787  for(Int_t ci=0;ci<=3;ci++) // correlation index
24788  {
24789   if(!fIntFlowCorrelationsVsMPro[ci])
24790   {
24791    cout<<endl;
24792    cout<<Form(" WARNING (QC): fIntFlowCorrelationsVsMPro[%d] is NULL in CheckPointersUsedInFinish() !!!!",ci)<<endl;
24793    cout<<endl;
24794    exit(0); 
24795   }
24796   if(!fIntFlowSquaredCorrelationsVsMPro[ci])
24797   {
24798    cout<<endl;
24799    cout<<Form(" WARNING (QC): fIntFlowSquaredCorrelationsVsMPro[%d] is NULL in CheckPointersUsedInFinish() !!!!",ci)<<endl;
24800    cout<<endl;
24801    exit(0); 
24802   }  
24803   if(!fIntFlowCorrelationsVsMHist[ci])
24804   {
24805    cout<<endl;
24806    cout<<Form(" WARNING (QC): fIntFlowCorrelationsVsMHist[%d] is NULL in CheckPointersUsedInFinish() !!!!",ci)<<endl;
24807    cout<<endl;
24808    exit(0); 
24809   }
24810   for(Int_t power=0;power<2;power++) 
24811   {
24812    if(!fIntFlowSumOfEventWeightsVsM[ci][power])
24813    {
24814     cout<<endl;
24815     cout<<Form(" WARNING (QC): fIntFlowSumOfEventWeightsVsM[%d][%d] is NULL in CheckPointersUsedInFinish() !!!!",ci,power)<<endl;
24816     cout<<endl;
24817     exit(0);   
24818    }
24819   } // end of for(Int_t power=0;power<2;power++) 
24820  } // end of for(Int_t ci=0;ci<=3;ci++) // correlation index
24821  for(Int_t i=0;i<6;i++)
24822  {
24823   if(!fIntFlowProductOfCorrelationsVsMPro[i])
24824   {
24825    cout<<endl;
24826    cout<<Form(" WARNING (QC): fIntFlowProductOfCorrelationsVsMPro[%d] is NULL in CheckPointersUsedInFinish() !!!!",i)<<endl;
24827    cout<<endl;
24828    exit(0); 
24829   }
24830   if(!fIntFlowSumOfProductOfEventWeightsVsM[i])
24831   {
24832    cout<<endl;
24833    cout<<Form(" WARNING (QC): fIntFlowSumOfProductOfEventWeightsVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",i)<<endl;
24834    cout<<endl;
24835    exit(0); 
24836   }
24837   if(!fIntFlowCovariancesVsM[i])
24838   {
24839    cout<<endl;
24840    cout<<Form(" WARNING (QC): fIntFlowCovariancesVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",i)<<endl;
24841    cout<<endl;
24842    exit(0); 
24843   }
24844  } // end of for(Int_t i=0;i<6;i++) 
24845  if(!fIntFlowRebinnedInM)
24846  {
24847   cout<<endl;
24848   cout<<" WARNING (QC): fIntFlowRebinnedInM is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24849   cout<<endl;
24850   exit(0); 
24851  }
24852  if(!fIntFlowQcumulantsRebinnedInM)
24853  {
24854   cout<<endl;
24855   cout<<" WARNING (QC): fIntFlowQcumulantsRebinnedInM is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24856   cout<<endl;
24857   exit(0); 
24858  }  
24859  
24860 } // end of void AliFlowAnalysisWithQCumulants::CheckPointersUsedInFinish()
24861
24862 //=======================================================================================================================
24863
24864 void AliFlowAnalysisWithQCumulants::CheckPointersUsedInMake()
24865 {
24866  // Check all pointers used in method Make(). // to be improved - check other pointers as well
24867  
24868  if(!fAvMultiplicity)
24869  {
24870   printf("\n WARNING (QC): fAvMultiplicity is NULL in CheckPointersUsedInMake() !!!!\n\n");
24871   exit(0);
24872  }
24873  if((fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights) && !fIntFlowExtraCorrelationsPro) 
24874  {
24875   printf("\n WARNING (QC): fIntFlowExtraCorrelationsPro is NULL in CheckPointersUsedInMake() !!!!\n\n");
24876   exit(0); 
24877  } 
24878  // 2D:
24879  if(fCalculate2DDiffFlow)
24880  {
24881   for(Int_t t=0;t<2;t++) // type = RP or POI
24882   { 
24883    for(Int_t rci=0;rci<4;rci++) // reduced correlation index
24884    {
24885     if(!f2DDiffFlowCorrelationsPro[t][rci])
24886     {
24887      printf("\n WARNING (QC): f2DDiffFlowCorrelationsPro[%i][%i] is NULL in CheckPointersUsedInMake() !!!!\n\n",t,rci);
24888      exit(0);     
24889     } // end of if(!f2DDiffFlowCorrelationsPro[t][rci])  
24890    } // end of for(Int_t rci=0;rci<4;rci++) // reduced correlation index
24891   } // end of for(Int_t t=0;t<2;t++)
24892  } // end of if(fCalculate2DDiffFlow)  
24893
24894 } // end of void AliFlowAnalysisWithQCumulants::CheckPointersUsedInMake()
24895  
24896