]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/FLOW/Base/AliFlowAnalysisWithQCumulants.cxx
from Ante Bilandzic:
[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  Double_t ptEta[2] = {0.,0.}; // 0 = dPt, 1 = dEta
370   
371  // c) Fill the common control histograms and call the method to fill fAvMultiplicity:
372  this->FillCommonControlHistograms(anEvent);                                                               
373  this->FillAverageMultiplicities((Int_t)(fNumberOfRPsEBE)); 
374  if(fStoreControlHistograms){this->FillControlHistograms(anEvent);}                                                              
375                                                                                                                                                                                                                                                                                         
376  // d) Loop over data and calculate e-b-e quantities Q_{n,k}, S_{p,k} and s_{p,k}:
377  Int_t nPrim = anEvent->NumberOfTracks();  // nPrim = total number of primary tracks
378  AliFlowTrackSimple *aftsTrack = NULL;
379  Int_t n = fHarmonic; // shortcut for the harmonic 
380  for(Int_t i=0;i<nPrim;i++) 
381  { 
382   if(fExactNoRPs > 0 && nCounterNoRPs>fExactNoRPs){continue;}
383   aftsTrack=anEvent->GetTrack(i);
384   if(aftsTrack)
385   {
386    if(!(aftsTrack->InRPSelection() || aftsTrack->InPOISelection())){continue;} // safety measure: consider only tracks which are RPs or POIs
387    if(aftsTrack->InRPSelection()) // RP condition:
388    {    
389     nCounterNoRPs++;
390     dPhi = aftsTrack->Phi();
391     dPt  = aftsTrack->Pt();
392     dEta = aftsTrack->Eta();
393     if(fUsePhiWeights && fPhiWeights && fnBinsPhi) // determine phi weight for this particle:
394     {
395      wPhi = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*fnBinsPhi/TMath::TwoPi())));
396     }
397     if(fUsePtWeights && fPtWeights && fnBinsPt) // determine pt weight for this particle:
398     {
399      wPt = fPtWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-fPtMin)/fPtBinWidth))); 
400     }              
401     if(fUseEtaWeights && fEtaWeights && fEtaBinWidth) // determine eta weight for this particle: 
402     {
403      wEta = fEtaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-fEtaMin)/fEtaBinWidth))); 
404     }      
405     // Access track weight:
406     if(fUseTrackWeights)
407     {
408      wTrack = aftsTrack->Weight(); 
409     }
410     // Calculate Re[Q_{m*n,k}] and Im[Q_{m*n,k}] for this event (m = 1,2,...,12, k = 0,1,...,8):
411     for(Int_t m=0;m<12;m++) // to be improved - hardwired 6 
412     {
413      for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
414      {
415       (*fReQ)(m,k)+=pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1)*n*dPhi); 
416       (*fImQ)(m,k)+=pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1)*n*dPhi); 
417      } 
418     }
419     // Calculate S_{p,k} for this event (Remark: final calculation of S_{p,k} follows after the loop over data bellow):
420     for(Int_t p=0;p<8;p++)
421     {
422      for(Int_t k=0;k<9;k++)
423      {     
424       (*fSpk)(p,k)+=pow(wPhi*wPt*wEta*wTrack,k);
425      }
426     } 
427     // Differential flow:
428     if(fCalculateDiffFlow || fCalculate2DDiffFlow)
429     {
430      ptEta[0] = dPt; 
431      ptEta[1] = dEta; 
432      // Calculate r_{m*n,k} and s_{p,k} (r_{m,k} is 'p-vector' for RPs): 
433      for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
434      {
435       for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
436       {
437        if(fCalculateDiffFlow)
438        {
439         for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
440         {
441          fReRPQ1dEBE[0][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
442          fImRPQ1dEBE[0][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);          
443          if(m==0) // s_{p,k} does not depend on index m
444          {
445           fs1dEBE[0][pe][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k),1.);
446          } // end of if(m==0) // s_{p,k} does not depend on index m
447         } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
448        } // end of if(fCalculateDiffFlow) 
449        if(fCalculate2DDiffFlow)
450        {
451         fReRPQ2dEBE[0][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
452         fImRPQ2dEBE[0][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);      
453         if(m==0) // s_{p,k} does not depend on index m
454         {
455          fs2dEBE[0][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k),1.);
456         } // end of if(m==0) // s_{p,k} does not depend on index m
457        } // end of if(fCalculate2DDiffFlow)
458       } // end of for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
459      } // end of for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
460      // Checking if RP particle is also POI particle:      
461      if(aftsTrack->InPOISelection())
462      {
463       // Calculate q_{m*n,k} and s_{p,k} ('q-vector' and 's' for RPs && POIs): 
464       for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
465       {
466        for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
467        {
468         if(fCalculateDiffFlow)
469         {
470          for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
471          {
472           fReRPQ1dEBE[2][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
473           fImRPQ1dEBE[2][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);          
474           if(m==0) // s_{p,k} does not depend on index m
475           {
476            fs1dEBE[2][pe][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k),1.);
477           } // end of if(m==0) // s_{p,k} does not depend on index m
478          } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
479         } // end of if(fCalculateDiffFlow) 
480         if(fCalculate2DDiffFlow)
481         {
482          fReRPQ2dEBE[2][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
483          fImRPQ2dEBE[2][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);      
484          if(m==0) // s_{p,k} does not depend on index m
485          {
486           fs2dEBE[2][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k),1.);
487          } // end of if(m==0) // s_{p,k} does not depend on index m
488         } // end of if(fCalculate2DDiffFlow)
489        } // end of for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
490       } // end of for(Int_t k=0;k<9;k++) // to be improved - hardwired 9    
491      } // end of if(aftsTrack->InPOISelection())  
492     } // end of if(fCalculateDiffFlow || fCalculate2DDiffFlow)         
493    } // end of if(pTrack->InRPSelection())
494    if(aftsTrack->InPOISelection())
495    {
496     dPhi = aftsTrack->Phi();
497     dPt  = aftsTrack->Pt();
498     dEta = aftsTrack->Eta();
499     wPhi = 1.;
500     wPt  = 1.;
501     wEta = 1.;
502     wTrack = 1.;
503     if(fUsePhiWeights && fPhiWeights && fnBinsPhi && aftsTrack->InRPSelection()) // determine phi weight for POI && RP particle:
504     {
505      wPhi = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*fnBinsPhi/TMath::TwoPi())));
506     }
507     if(fUsePtWeights && fPtWeights && fnBinsPt && aftsTrack->InRPSelection()) // determine pt weight for POI && RP particle:
508     {
509      wPt = fPtWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-fPtMin)/fPtBinWidth))); 
510     }              
511     if(fUseEtaWeights && fEtaWeights && fEtaBinWidth && aftsTrack->InRPSelection()) // determine eta weight for POI && RP particle: 
512     {
513      wEta = fEtaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-fEtaMin)/fEtaBinWidth))); 
514     }      
515     // Access track weight for POI && RP particle:
516     if(aftsTrack->InRPSelection() && fUseTrackWeights)
517     {
518      wTrack = aftsTrack->Weight(); 
519     }
520     ptEta[0] = dPt;
521     ptEta[1] = dEta;
522     // Calculate p_{m*n,k} ('p-vector' for POIs): 
523     for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
524     {
525      for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
526      {
527       if(fCalculateDiffFlow)
528       {
529        for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
530        {
531         fReRPQ1dEBE[1][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
532         fImRPQ1dEBE[1][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);          
533        } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
534       } // end of if(fCalculateDiffFlow) 
535       if(fCalculate2DDiffFlow)
536       {
537        fReRPQ2dEBE[1][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
538        fImRPQ2dEBE[1][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);      
539       } // end of if(fCalculate2DDiffFlow)
540      } // end of for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
541     } // end of for(Int_t k=0;k<9;k++) // to be improved - hardwired 9    
542    } // end of if(pTrack->InPOISelection())    
543   } else // to if(aftsTrack)
544     {
545      printf("\n WARNING (QC): No particle (i.e. aftsTrack is a NULL pointer in AFAWQC::Make())!!!!\n\n");
546     }
547  } // end of for(Int_t i=0;i<nPrim;i++) 
548
549  // e) Calculate the final expressions for S_{p,k} and s_{p,k} (important !!!!):
550  for(Int_t p=0;p<8;p++)
551  {
552   for(Int_t k=0;k<9;k++)
553   {
554    (*fSpk)(p,k)=pow((*fSpk)(p,k),p+1);
555    // ... for the time being s_{p,k} dosn't need higher powers, so no need to finalize it here ...
556   } // end of for(Int_t k=0;k<9;k++)  
557  } // end of for(Int_t p=0;p<8;p++)
558  
559  // f) Call the methods which calculate correlations for reference flow:
560  if(!fEvaluateIntFlowNestedLoops)
561  {
562   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
563   {
564    if(fNumberOfRPsEBE>1){this->CalculateIntFlowCorrelations();} // without using particle weights
565   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
566     {
567      if(fNumberOfRPsEBE>1){this->CalculateIntFlowCorrelationsUsingParticleWeights();} // with using particle weights   
568     }        
569   // Whether or not using particle weights the following is calculated in the same way:  
570   if(fNumberOfRPsEBE>3){this->CalculateIntFlowProductOfCorrelations();}
571   if(fNumberOfRPsEBE>1){this->CalculateIntFlowSumOfEventWeights();}
572   if(fNumberOfRPsEBE>1){this->CalculateIntFlowSumOfProductOfEventWeights();}  
573   // Non-isotropic terms:
574   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
575   {
576    if(fNumberOfRPsEBE>0){this->CalculateIntFlowCorrectionsForNUASinTerms();}
577    if(fNumberOfRPsEBE>0){this->CalculateIntFlowCorrectionsForNUACosTerms();}
578   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
579     {
580      if(fNumberOfRPsEBE>0){this->CalculateIntFlowCorrectionsForNUASinTermsUsingParticleWeights();}
581      if(fNumberOfRPsEBE>0){this->CalculateIntFlowCorrectionsForNUACosTermsUsingParticleWeights();}     
582     }      
583   // Whether or not using particle weights the following is calculated in the same way:  
584   if(fNumberOfRPsEBE>0){this->CalculateIntFlowProductOfCorrectionTermsForNUA();}     
585   if(fNumberOfRPsEBE>0){this->CalculateIntFlowSumOfEventWeightsNUA();}     
586   if(fNumberOfRPsEBE>0){this->CalculateIntFlowSumOfProductOfEventWeightsNUA();}     
587   // Mixed harmonics:
588   if(fCalculateMixedHarmonics){this->CalculateMixedHarmonics();}
589  } // end of if(!fEvaluateIntFlowNestedLoops)
590
591  // g) Call the methods which calculate correlations for differential flow:
592  if(!fEvaluateDiffFlowNestedLoops && fCalculateDiffFlow)
593  {
594   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
595   {
596    // Without using particle weights:
597    this->CalculateDiffFlowCorrelations("RP","Pt"); 
598    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrelations("RP","Eta");}
599    this->CalculateDiffFlowCorrelations("POI","Pt");
600    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrelations("POI","Eta");}
601    // Non-isotropic terms:
602    this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Pt");
603    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Eta");}
604    this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Pt");
605    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Eta");}
606    this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Pt");
607    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Eta");}
608    this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Pt");
609    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Eta");}   
610   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
611     {
612      // With using particle weights:   
613      this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Pt"); 
614      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Eta");} 
615      this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Pt"); 
616      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Eta");} 
617      // Non-isotropic terms:
618      this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("RP","Pt");
619      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("RP","Eta");}
620      this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("POI","Pt");
621      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("POI","Eta");}
622      this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("RP","Pt");
623      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("RP","Eta");}
624      this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("POI","Pt");
625      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("POI","Eta");}   
626     }     
627   // Whether or not using particle weights the following is calculated in the same way:  
628   this->CalculateDiffFlowProductOfCorrelations("RP","Pt");
629   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowProductOfCorrelations("RP","Eta");}
630   this->CalculateDiffFlowProductOfCorrelations("POI","Pt");
631   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowProductOfCorrelations("POI","Eta");}
632   this->CalculateDiffFlowSumOfEventWeights("RP","Pt");
633   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowSumOfEventWeights("RP","Eta");}
634   this->CalculateDiffFlowSumOfEventWeights("POI","Pt");
635   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowSumOfEventWeights("POI","Eta");}
636   this->CalculateDiffFlowSumOfProductOfEventWeights("RP","Pt");
637   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowSumOfProductOfEventWeights("RP","Eta");}
638   this->CalculateDiffFlowSumOfProductOfEventWeights("POI","Pt");
639   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowSumOfProductOfEventWeights("POI","Eta");}   
640  } // end of if(!fEvaluateDiffFlowNestedLoops && fCalculateDiffFlow)
641
642  // h) Call the methods which calculate correlations for 2D differential flow:
643  if(!fEvaluateDiffFlowNestedLoops && fCalculate2DDiffFlow)
644  {
645   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
646   {
647    // Without using particle weights:
648    this->Calculate2DDiffFlowCorrelations("RP"); 
649    this->Calculate2DDiffFlowCorrelations("POI");
650    // Non-isotropic terms:
651    // ... to be ctd ...
652   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
653     {
654      // With using particle weights:   
655      // ... to be ctd ...  
656      // Non-isotropic terms:
657      // ... to be ctd ...
658     }     
659   // Whether or not using particle weights the following is calculated in the same way:  
660   // ... to be ctd ...   
661  } // end of if(!fEvaluateDiffFlowNestedLoops && fCalculate2DDiffFlow)
662  
663  // i) Call the methods which calculate other differential correlators:
664  if(!fEvaluateDiffFlowNestedLoops && fCalculateDiffFlow)
665  {
666   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
667   {
668    // Without using particle weights:
669    this->CalculateOtherDiffCorrelators("RP","Pt"); 
670    if(fCalculateDiffFlowVsEta){this->CalculateOtherDiffCorrelators("RP","Eta");}
671    this->CalculateOtherDiffCorrelators("POI","Pt"); 
672    if(fCalculateDiffFlowVsEta){this->CalculateOtherDiffCorrelators("POI","Eta");}     
673   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
674     {
675      // With using particle weights:   
676      // ... to be ctd ...  
677     }     
678   // Whether or not using particle weights the following is calculated in the same way:  
679   // ... to be ctd ...   
680  } // end of if(!fEvaluateDiffFlowNestedLoops)
681  
682  // j) Distributions of correlations:
683  if(fStoreDistributions){this->StoreDistributionsOfCorrelations();}
684  
685  // k) Store phi distribution for one event to illustrate flow: 
686  if(fStorePhiDistributionForOneEvent){this->StorePhiDistributionForOneEvent(anEvent);}
687    
688  // l) Cross-check with nested loops correlators for reference flow:
689  if(fEvaluateIntFlowNestedLoops){this->EvaluateIntFlowNestedLoops(anEvent);} 
690
691  // m) Cross-check with nested loops correlators for differential flow:
692  if(fEvaluateDiffFlowNestedLoops){this->EvaluateDiffFlowNestedLoops(anEvent);} 
693  
694  // n) Reset all event-by-event quantities (very important !!!!):
695  this->ResetEventByEventQuantities();
696  
697 } // end of AliFlowAnalysisWithQCumulants::Make(AliFlowEventSimple* anEvent)
698
699 //=======================================================================================================================
700
701 void AliFlowAnalysisWithQCumulants::Finish()
702 {
703  // Calculate the final results.
704
705  // a) Check all pointers used in this method;
706  // b) Access the constants;
707  // c) Access the flags;
708  // d) Calculate reference cumulants (not corrected for detector effects);
709  // e) Correct reference cumulants for detector effects;
710  // f) Calculate reference flow;
711  // g) Store results for reference flow in AliFlowCommonHistResults and print them on the screen;
712  // h) Calculate the final results for differential flow (without/with weights);
713  // i) Correct the results for differential flow (without/with weights) for effects of non-uniform acceptance (NUA);
714  // j) Calculate the final results for integrated flow (RP/POI) and store in AliFlowCommonHistResults;
715  // k) Store results for differential flow in AliFlowCommonHistResults;
716  // l) Print the final results for integrated flow (RP/POI) on the screen; 
717  // m) Cross-checking: Results from Q-vectors vs results from nested loops;
718  // i) Calculate cumulants for mixed harmonics;
719  // j) Calculate cumulants for bootstrap.
720
721  // a) Check all pointers used in this method:
722  this->CheckPointersUsedInFinish();
723   
724  // b) Access the constants:
725  this->CommonConstants("Finish");          
726  
727  if(fCommonHists && fCommonHists->GetHarmonic()) // to be improved (moved somewhere else)
728  {
729   fHarmonic = (Int_t)(fCommonHists->GetHarmonic())->GetBinContent(1);
730  } 
731  
732  // c) Access the flags: // tbi (implement a method for this? should I store again the flags because they can get modified with redoFinish?)
733  fUsePhiWeights = (Bool_t)fUseParticleWeights->GetBinContent(1); 
734  fUsePtWeights = (Bool_t)fUseParticleWeights->GetBinContent(2); 
735  fUseEtaWeights = (Bool_t)fUseParticleWeights->GetBinContent(3);  
736  fUseTrackWeights = (Bool_t)fUseParticleWeights->GetBinContent(4);  
737  fApplyCorrectionForNUA = (Bool_t)fIntFlowFlags->GetBinContent(3); 
738  fPrintFinalResults[0] = (Bool_t)fIntFlowFlags->GetBinContent(4);
739  fPrintFinalResults[1] = (Bool_t)fIntFlowFlags->GetBinContent(5);
740  fPrintFinalResults[2] = (Bool_t)fIntFlowFlags->GetBinContent(6);
741  fPrintFinalResults[3] = (Bool_t)fIntFlowFlags->GetBinContent(7);
742  fApplyCorrectionForNUAVsM = (Bool_t)fIntFlowFlags->GetBinContent(8);  
743  fPropagateErrorAlsoFromNIT = (Bool_t)fIntFlowFlags->GetBinContent(9);  
744  fCalculateCumulantsVsM = (Bool_t)fIntFlowFlags->GetBinContent(10); 
745  fMinimumBiasReferenceFlow = (Bool_t)fIntFlowFlags->GetBinContent(11); 
746  fForgetAboutCovariances = (Bool_t)fIntFlowFlags->GetBinContent(12);
747  fStorePhiDistributionForOneEvent = (Bool_t)fIntFlowFlags->GetBinContent(13);
748  fFillMultipleControlHistograms = (Bool_t)fIntFlowFlags->GetBinContent(14); 
749  fCalculateAllCorrelationsVsM = (Bool_t)fIntFlowFlags->GetBinContent(15);
750  fUse2DHistograms = (Bool_t)fIntFlowFlags->GetBinContent(18);
751  fFillProfilesVsMUsingWeights = (Bool_t)fIntFlowFlags->GetBinContent(19);
752  fUseQvectorTerms = (Bool_t)fIntFlowFlags->GetBinContent(20);
753  fEvaluateIntFlowNestedLoops = (Bool_t)fEvaluateNestedLoops->GetBinContent(1);
754  fEvaluateDiffFlowNestedLoops = (Bool_t)fEvaluateNestedLoops->GetBinContent(2); 
755  fCrossCheckInPtBinNo = (Int_t)fEvaluateNestedLoops->GetBinContent(3);
756  fCrossCheckInEtaBinNo = (Int_t)fEvaluateNestedLoops->GetBinContent(4); 
757  fCalculateMixedHarmonics = (Bool_t)fMixedHarmonicsFlags->GetBinContent(1);
758  //fHarmonic = (Int_t)fMixedHarmonicsFlags->GetBinContent(2); // TBI should I add inpdependent generic harmonic here?
759  fCalculateMixedHarmonicsVsM = (Bool_t)fMixedHarmonicsFlags->GetBinContent(3);
760  fUseBootstrap = (Bool_t)fBootstrapFlags->GetBinContent(1); 
761  fUseBootstrapVsM = (Bool_t)fBootstrapFlags->GetBinContent(2); 
762  fnSubsamples = (Int_t)fBootstrapFlags->GetBinContent(3); 
763
764  // d) Calculate reference cumulants (not corrected for detector effects):
765  this->FinalizeCorrelationsIntFlow();
766  this->CalculateCovariancesIntFlow();
767  this->CalculateCumulantsIntFlow();
768
769  // e) Correct reference cumulants for detector effects:
770  this->FinalizeCorrectionTermsForNUAIntFlow();
771  this->CalculateCovariancesNUAIntFlow(); 
772  this->CalculateQcumulantsCorrectedForNUAIntFlow();  
773
774  // f) Calculate reference flow:
775  this->CalculateReferenceFlow(); 
776   
777  // g) Store results for reference flow in AliFlowCommonHistResults and print them on the screen:
778  this->FillCommonHistResultsIntFlow();  
779  if(fPrintFinalResults[0]){this->PrintFinalResultsForIntegratedFlow("RF");}
780  if(fPrintFinalResults[3] && fCalculateCumulantsVsM){this->PrintFinalResultsForIntegratedFlow("RF, rebinned in M");}
781  
782  // h) Calculate the final results for differential flow (without/with weights):
783  if(fCalculateDiffFlow)
784  {
785   this->FinalizeReducedCorrelations("RP","Pt"); 
786   if(fCalculateDiffFlowVsEta){this->FinalizeReducedCorrelations("RP","Eta");} 
787   this->FinalizeReducedCorrelations("POI","Pt"); 
788   if(fCalculateDiffFlowVsEta){this->FinalizeReducedCorrelations("POI","Eta");}
789   this->CalculateDiffFlowCovariances("RP","Pt");
790   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCovariances("RP","Eta");}
791   this->CalculateDiffFlowCovariances("POI","Pt");
792   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCovariances("POI","Eta");}
793   this->CalculateDiffFlowCumulants("RP","Pt");
794   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCumulants("RP","Eta");}
795   this->CalculateDiffFlowCumulants("POI","Pt");
796   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCumulants("POI","Eta");}
797   this->CalculateDiffFlow("RP","Pt");
798   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlow("RP","Eta");}
799   this->CalculateDiffFlow("POI","Pt");
800   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlow("POI","Eta");}
801  } // if(fCalculateDiffFlow)
802  
803  // i) Correct the results for differential flow (without/with weights) for effects of non-uniform acceptance (NUA):
804  if(fCalculateDiffFlow)
805  {
806   this->FinalizeCorrectionTermsForNUADiffFlow("RP","Pt");
807   if(fCalculateDiffFlowVsEta){this->FinalizeCorrectionTermsForNUADiffFlow("RP","Eta");}
808   this->FinalizeCorrectionTermsForNUADiffFlow("POI","Pt");
809   if(fCalculateDiffFlowVsEta){this->FinalizeCorrectionTermsForNUADiffFlow("POI","Eta");}      
810   this->CalculateDiffFlowCumulantsCorrectedForNUA("RP","Pt");   
811   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCumulantsCorrectedForNUA("RP","Eta");}   
812   this->CalculateDiffFlowCumulantsCorrectedForNUA("POI","Pt");   
813   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCumulantsCorrectedForNUA("POI","Eta");}  
814   if(fApplyCorrectionForNUA)
815   {
816    this->CalculateDiffFlowCorrectedForNUA("RP","Pt"); 
817    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectedForNUA("RP","Eta");} 
818    this->CalculateDiffFlowCorrectedForNUA("POI","Pt"); 
819    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectedForNUA("POI","Eta");} 
820   }
821  } // end of if(fCalculateDiffFlow && fApplyCorrectionForNUA)
822  
823  // i) Calcualate final results for 2D differential flow: 
824  if(fCalculate2DDiffFlow)
825  {
826   this->Calculate2DDiffFlowCumulants("RP");
827   this->Calculate2DDiffFlowCumulants("POI");
828   this->Calculate2DDiffFlow("RP");  
829   this->Calculate2DDiffFlow("POI");  
830  } // end of if(fCalculate2DDiffFlow)
831     
832  // j) Calculate the final results for integrated flow (RP/POI) and store in AliFlowCommonHistResults:
833  if(fCalculateDiffFlow)
834  {
835   this->CalculateFinalResultsForRPandPOIIntegratedFlow("RP");
836   this->CalculateFinalResultsForRPandPOIIntegratedFlow("POI");
837  }
838  
839  // k) Store results for differential flow in AliFlowCommonHistResults:
840  if(fCalculateDiffFlow)
841  {
842   this->FillCommonHistResultsDiffFlow("RP");
843   this->FillCommonHistResultsDiffFlow("POI");
844  }
845  
846  // l) Print the final results for integrated flow (RP/POI) on the screen:
847  if(fPrintFinalResults[1] && fCalculateDiffFlow){this->PrintFinalResultsForIntegratedFlow("RP");} 
848  if(fPrintFinalResults[2] && fCalculateDiffFlow){this->PrintFinalResultsForIntegratedFlow("POI");}
849     
850  // m) Cross-checking: Results from Q-vectors vs results from nested loops:
851  //  m1) Reference flow:
852  if(fEvaluateIntFlowNestedLoops)
853  {
854   this->CrossCheckIntFlowCorrelations();
855   this->CrossCheckIntFlowCorrectionTermsForNUA(); 
856   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights){this->CrossCheckIntFlowExtraCorrelations();}
857   if(fCalculateMixedHarmonics){this->CrossCheckIntFlowCorrelations();}     
858  } // end of if(fEvaluateIntFlowNestedLoops)  
859  //  m2) Differential flow: 
860  if(fEvaluateDiffFlowNestedLoops && fCalculateDiffFlow) 
861  {
862   // Correlations:
863   this->PrintNumberOfParticlesInSelectedBin();
864   this->CrossCheckDiffFlowCorrelations("RP","Pt");  
865   if(fCalculateDiffFlowVsEta){this->CrossCheckDiffFlowCorrelations("RP","Eta");} 
866   this->CrossCheckDiffFlowCorrelations("POI","Pt");  
867   if(fCalculateDiffFlowVsEta){this->CrossCheckDiffFlowCorrelations("POI","Eta");}
868   // Correction terms for non-uniform acceptance:
869   this->CrossCheckDiffFlowCorrectionTermsForNUA("RP","Pt");      
870   if(fCalculateDiffFlowVsEta){this->CrossCheckDiffFlowCorrectionTermsForNUA("RP","Eta");}       
871   this->CrossCheckDiffFlowCorrectionTermsForNUA("POI","Pt");      
872   if(fCalculateDiffFlowVsEta){this->CrossCheckDiffFlowCorrectionTermsForNUA("POI","Eta");}
873   // Other differential correlators:       
874   this->CrossCheckOtherDiffCorrelators("RP","Pt");  
875   if(fCalculateDiffFlowVsEta){this->CrossCheckOtherDiffCorrelators("RP","Eta");} 
876   this->CrossCheckOtherDiffCorrelators("POI","Pt");  
877   if(fCalculateDiffFlowVsEta){this->CrossCheckOtherDiffCorrelators("POI","Eta");}
878  } // end of if(fEvaluateDiffFlowNestedLoops)
879                                                                                 
880  // i) Calculate cumulants for mixed harmonics: 
881  if(fCalculateMixedHarmonics){this->CalculateCumulantsMixedHarmonics();} 
882
883  // j) Calculate cumulants for bootstrap:
884  if(fUseBootstrap||fUseBootstrapVsM){this->CalculateCumulantsForBootstrap();} 
885
886 } // end of AliFlowAnalysisWithQCumulants::Finish()
887
888 //=======================================================================================================================
889
890 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowNestedLoops(AliFlowEventSimple* anEvent)
891 {
892  // Evaluate all correlators for reference flow with nested loops.
893  
894  Int_t nPrim = anEvent->NumberOfTracks(); // number of primaries
895  if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity) // by default fMaxAllowedMultiplicity = 10 
896  {
897   // Without using particle weights:
898   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
899   {
900    // Correlations:
901    this->CalculateIntFlowCorrelations(); // from Q-vectors
902    this->EvaluateIntFlowCorrelationsWithNestedLoops(anEvent); // from nested loops (TBI: do I have to pass here anEvent or not?)
903    // Correction for non-uniform acceptance:
904    this->CalculateIntFlowCorrectionsForNUASinTerms(); // from Q-vectors (sin terms)
905    this->CalculateIntFlowCorrectionsForNUACosTerms(); // from Q-vectors (cos terms)
906    this->EvaluateIntFlowCorrectionsForNUAWithNestedLoops(anEvent); // from nested loops (both sin and cos terms)
907    // Mixed harmonics:
908    if(fCalculateMixedHarmonics)
909    {
910     this->CalculateMixedHarmonics(); // from Q-vectors  
911     this->EvaluateMixedHarmonicsWithNestedLoops(anEvent); // from nested loops (TBI: do I have to pass here anEvent or not?)
912    } // end of if(fCalculateMixedHarmonics)
913   }
914   // Using particle weights:
915   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
916   {
917    // Correlations
918    this->CalculateIntFlowCorrelationsUsingParticleWeights(); // from Q-vectors
919    this->EvaluateIntFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent); // from nested loops (to be improved: do I have to pass here anEvent or not?)
920    // Correction for non-uniform acceptance:
921    this->CalculateIntFlowCorrectionsForNUASinTermsUsingParticleWeights(); // from Q-vectors (sin terms)
922    this->CalculateIntFlowCorrectionsForNUACosTermsUsingParticleWeights(); // from Q-vectors (cos terms)
923    this->EvaluateIntFlowCorrectionsForNUAWithNestedLoopsUsingParticleWeights(anEvent); // from nested loops (both sin and cos terms)   
924   }
925  } else if(nPrim>fMaxAllowedMultiplicity) // to if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity)
926    {
927     cout<<endl;
928     cout<<"Skipping the event because multiplicity is "<<nPrim<<". Too high to evaluate nested loops!"<<endl;
929    } else
930      {
931       cout<<endl;
932       cout<<"Skipping the event because multiplicity is "<<nPrim<<"."<<endl;      
933      } 
934
935 } // end of void AliFlowAnalysisWithQCumulants::EvaluateIntFlowNestedLoops(AliFlowEventSimple* anEvent)
936
937 //=======================================================================================================================
938
939 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowNestedLoops(AliFlowEventSimple* anEvent)
940 {
941  // Evalauted all correlators for differential flow with nested loops.
942
943  if(!fCalculateDiffFlow){return;}
944
945  Int_t nPrim = anEvent->NumberOfTracks(); // number of primaries
946  if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity) // by default fMaxAllowedMultiplicity = 10
947  {
948   // Without using particle weights:
949   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
950   {
951    // 1.) Reduced correlations:
952    //  Q-vectors:
953    this->CalculateDiffFlowCorrelations("RP","Pt");
954    this->CalculateDiffFlowCorrelations("RP","Eta");
955    this->CalculateDiffFlowCorrelations("POI","Pt");
956    this->CalculateDiffFlowCorrelations("POI","Eta");
957    //  Nested loops:
958    this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"RP","Pt"); 
959    this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"RP","Eta"); 
960    this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"POI","Pt"); 
961    this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"POI","Eta"); 
962    // 2.) Reduced corrections for non-uniform acceptance:
963    //  Q-vectors:
964    this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Pt");
965    this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Eta");
966    this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Pt");
967    this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Eta");
968    this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Pt");
969    this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Eta");
970    this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Pt");
971    this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Eta");
972    //  Nested loops:
973    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"RP","Pt");
974    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"RP","Eta");
975    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"POI","Pt"); 
976    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"POI","Eta"); 
977    // 3.) Other differential correlators:
978    //  Q-vectors:
979    this->CalculateOtherDiffCorrelators("RP","Pt");
980    this->CalculateOtherDiffCorrelators("RP","Eta");
981    this->CalculateOtherDiffCorrelators("POI","Pt");
982    this->CalculateOtherDiffCorrelators("POI","Eta");   
983    //  Nested loops:
984    this->EvaluateOtherDiffCorrelatorsWithNestedLoops(anEvent,"RP","Pt");
985    this->EvaluateOtherDiffCorrelatorsWithNestedLoops(anEvent,"RP","Eta");
986    this->EvaluateOtherDiffCorrelatorsWithNestedLoops(anEvent,"POI","Pt");
987    this->EvaluateOtherDiffCorrelatorsWithNestedLoops(anEvent,"POI","Eta");   
988   } // end of if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
989   // Using particle weights:
990   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
991   {
992    this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Pt"); 
993    this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Eta"); 
994    this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Pt"); 
995    this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Eta"); 
996    this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("RP","Pt");
997    this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("RP","Eta");
998    this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("POI","Pt");
999    this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("POI","Eta");
1000    this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("RP","Pt");
1001    this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("RP","Eta");
1002    this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("POI","Pt");
1003    this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("POI","Eta");
1004    this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"RP","Pt"); 
1005    this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"RP","Eta");
1006    this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"POI","Pt"); 
1007    this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"POI","Eta");   
1008    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(anEvent,"RP","Pt"); 
1009    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(anEvent,"RP","Eta"); 
1010    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(anEvent,"POI","Pt"); 
1011    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(anEvent,"POI","Eta"); 
1012   } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
1013  } // end of if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity) // by default fMaxAllowedMultiplicity = 10
1014
1015 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowNestedLoops(AliFlowEventSimple* anEvent)
1016
1017 //=======================================================================================================================
1018
1019 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTerms()
1020 {
1021  // Calculate correction terms for non-uniform acceptance of the detector for reference flow (cos terms).
1022  
1023  // multiplicity:
1024  Double_t dMult = (*fSpk)(0,0);
1025  
1026  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
1027  Double_t dReQ1n = (*fReQ)(0,0);
1028  Double_t dReQ2n = (*fReQ)(1,0);
1029  //Double_t dReQ3n = (*fReQ)(2,0);
1030  //Double_t dReQ4n = (*fReQ)(3,0);
1031  Double_t dImQ1n = (*fImQ)(0,0);
1032  Double_t dImQ2n = (*fImQ)(1,0);
1033  //Double_t dImQ3n = (*fImQ)(2,0);
1034  //Double_t dImQ4n = (*fImQ)(3,0);
1035
1036  // Multiplicity bin of an event (relevant for all histos vs M): 
1037  Double_t dMultiplicityBin = 0.;
1038  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
1039  {
1040   dMultiplicityBin = fNumberOfRPsEBE+0.5;
1041  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
1042    {
1043     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
1044    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
1045      {
1046       dMultiplicityBin = fNumberOfPOIsEBE+0.5;
1047      } 
1048
1049  //                                  *************************************************************
1050  //                                  **** corrections for non-uniform acceptance (cos terms): ****
1051  //                                  *************************************************************
1052  //
1053  // Remark 1: corrections for non-uniform acceptance (cos terms) calculated with non-weighted Q-vectors 
1054  //           are stored in 1D profile fQCorrectionsCos.
1055  // Remark 2: binning of fIntFlowCorrectionTermsForNUAPro[1] is organized as follows:
1056  // --------------------------------------------------------------------------------------------------------------------
1057  // 1st bin: <<cos(n*(phi1))>> = cosP1n
1058  // 2nd bin: <<cos(n*(phi1+phi2))>> = cosP1nP1n
1059  // 3rd bin: <<cos(n*(phi1-phi2-phi3))>> = cosP1nM1nM1n
1060  // 4th bin: <<cos(n*(2phi1-phi2))>> = cosP2nM1n
1061  // --------------------------------------------------------------------------------------------------------------------
1062   
1063  // 1-particle:
1064  Double_t cosP1n = 0.; // <<cos(n*(phi1))>>
1065    
1066  if(dMult>0)
1067  {
1068   cosP1n = dReQ1n/dMult; 
1069   
1070   // average non-weighted 1-particle correction (cos terms) for non-uniform acceptance for single event:
1071   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(1,cosP1n);
1072   // event weights for NUA terms:
1073   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->SetBinContent(1,dMult);
1074   
1075   // final average non-weighted 1-particle correction (cos terms) for non-uniform acceptance for all events:
1076   fIntFlowCorrectionTermsForNUAPro[1]->Fill(0.5,cosP1n,dMult);  
1077   if(fCalculateCumulantsVsM){fIntFlowCorrectionTermsForNUAVsMPro[1][0]->Fill(dMultiplicityBin,cosP1n,dMult);}    
1078  } 
1079  
1080  // 2-particle:
1081  Double_t cosP1nP1n = 0.; // <<cos(n*(phi1+phi2))>>
1082  Double_t cosP2nM1n = 0.; // <<cos(n*(2phi1-phi2))>>
1083  
1084  if(dMult>1)
1085  {
1086   cosP1nP1n = (pow(dReQ1n,2)-pow(dImQ1n,2)-dReQ2n)/(dMult*(dMult-1)); 
1087   cosP2nM1n = (dReQ2n*dReQ1n+dImQ2n*dImQ1n-dReQ1n)/(dMult*(dMult-1)); 
1088   
1089   // average non-weighted 2-particle correction (cos terms) for non-uniform acceptance for single event:
1090   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(2,cosP1nP1n);
1091   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(4,cosP2nM1n);
1092   // event weights for NUA terms:
1093   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->SetBinContent(2,dMult*(dMult-1));
1094   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->SetBinContent(4,dMult*(dMult-1));
1095       
1096   // final average non-weighted 2-particle correction (cos terms) for non-uniform acceptance for all events:
1097   fIntFlowCorrectionTermsForNUAPro[1]->Fill(1.5,cosP1nP1n,dMult*(dMult-1));  
1098   fIntFlowCorrectionTermsForNUAPro[1]->Fill(3.5,cosP2nM1n,dMult*(dMult-1));
1099   if(fCalculateCumulantsVsM)
1100   {
1101    fIntFlowCorrectionTermsForNUAVsMPro[1][1]->Fill(dMultiplicityBin,cosP1nP1n,dMult*(dMult-1));  
1102    fIntFlowCorrectionTermsForNUAVsMPro[1][3]->Fill(dMultiplicityBin,cosP2nM1n,dMult*(dMult-1));
1103   }
1104  } 
1105  
1106  // 3-particle:
1107  Double_t cosP1nM1nM1n = 0.; // <<cos(n*(phi1-phi2-phi3))>>
1108  
1109  if(dMult>2)
1110  {
1111   cosP1nM1nM1n = (dReQ1n*(pow(dReQ1n,2)+pow(dImQ1n,2))-dReQ1n*dReQ2n-dImQ1n*dImQ2n-2.*(dMult-1)*dReQ1n)
1112                / (dMult*(dMult-1)*(dMult-2)); 
1113   
1114   // average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for single event:
1115   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(3,cosP1nM1nM1n);
1116   // event weights for NUA terms:
1117   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->SetBinContent(3,dMult*(dMult-1)*(dMult-2));
1118   
1119   // final average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for all events:
1120   fIntFlowCorrectionTermsForNUAPro[1]->Fill(2.5,cosP1nM1nM1n,dMult*(dMult-1)*(dMult-2));
1121   if(fCalculateCumulantsVsM){fIntFlowCorrectionTermsForNUAVsMPro[1][2]->Fill(dMultiplicityBin,cosP1nM1nM1n,dMult*(dMult-1)*(dMult-2));}  
1122  } 
1123  
1124 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTerms()
1125
1126 //=======================================================================================================================
1127
1128 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTerms()
1129 {
1130  // calculate corrections for non-uniform acceptance of the detector for no-name integrated flow (sin terms)
1131  
1132  // multiplicity:
1133  Double_t dMult = (*fSpk)(0,0);
1134  
1135  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
1136  Double_t dReQ1n = (*fReQ)(0,0);
1137  Double_t dReQ2n = (*fReQ)(1,0);
1138  //Double_t dReQ3n = (*fReQ)(2,0);
1139  //Double_t dReQ4n = (*fReQ)(3,0);
1140  Double_t dImQ1n = (*fImQ)(0,0);
1141  Double_t dImQ2n = (*fImQ)(1,0);
1142  //Double_t dImQ3n = (*fImQ)(2,0);
1143  //Double_t dImQ4n = (*fImQ)(3,0);
1144         
1145  // Multiplicity bin of an event (relevant for all histos vs M): 
1146  Double_t dMultiplicityBin = 0.;
1147  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
1148  {
1149   dMultiplicityBin = fNumberOfRPsEBE+0.5;
1150  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
1151    {
1152     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
1153    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
1154      {
1155       dMultiplicityBin = fNumberOfPOIsEBE+0.5;
1156      } 
1157
1158  //                                  *************************************************************
1159  //                                  **** corrections for non-uniform acceptance (sin terms): ****
1160  //                                  *************************************************************
1161  //
1162  // Remark 1: corrections for non-uniform acceptance (sin terms) calculated with non-weighted Q-vectors 
1163  //           are stored in 1D profile fQCorrectionsSin.
1164  // Remark 2: binning of fIntFlowCorrectionTermsForNUAPro[0] is organized as follows:
1165  // --------------------------------------------------------------------------------------------------------------------
1166  // 1st bin: <<sin(n*(phi1))>> = sinP1n
1167  // 2nd bin: <<sin(n*(phi1+phi2))>> = sinP1nP1n
1168  // 3rd bin: <<sin(n*(phi1-phi2-phi3))>> = sinP1nM1nM1n
1169  // 4th bin: <<sin(n*(2phi1-phi2))>> = sinP2nM1n
1170  // --------------------------------------------------------------------------------------------------------------------
1171  
1172  // 1-particle:
1173  Double_t sinP1n = 0.; // <sin(n*(phi1))>
1174  
1175  if(dMult>0)
1176  {
1177   sinP1n = dImQ1n/dMult; 
1178      
1179   // average non-weighted 1-particle correction (sin terms) for non-uniform acceptance for single event:
1180   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(1,sinP1n);  
1181   // event weights for NUA terms:
1182   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->SetBinContent(1,dMult);
1183   
1184   // final average non-weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:   
1185   fIntFlowCorrectionTermsForNUAPro[0]->Fill(0.5,sinP1n,dMult);  
1186   if(fCalculateCumulantsVsM){fIntFlowCorrectionTermsForNUAVsMPro[0][0]->Fill(dMultiplicityBin,sinP1n,dMult);} 
1187  } 
1188  
1189  // 2-particle:
1190  Double_t sinP1nP1n = 0.; // <<sin(n*(phi1+phi2))>>
1191  Double_t sinP2nM1n = 0.; // <<sin(n*(2phi1-phi2))>>
1192  if(dMult>1)
1193  {
1194   sinP1nP1n = (2.*dReQ1n*dImQ1n-dImQ2n)/(dMult*(dMult-1)); 
1195   sinP2nM1n = (dImQ2n*dReQ1n-dReQ2n*dImQ1n-dImQ1n)/(dMult*(dMult-1)); 
1196      
1197   // average non-weighted 2-particle correction (sin terms) for non-uniform acceptance for single event:
1198   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(2,sinP1nP1n);
1199   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(4,sinP2nM1n);
1200   // event weights for NUA terms:
1201   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->SetBinContent(2,dMult*(dMult-1));
1202   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->SetBinContent(4,dMult*(dMult-1));
1203   
1204   // final average non-weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:      
1205   fIntFlowCorrectionTermsForNUAPro[0]->Fill(1.5,sinP1nP1n,dMult*(dMult-1));  
1206   fIntFlowCorrectionTermsForNUAPro[0]->Fill(3.5,sinP2nM1n,dMult*(dMult-1));  
1207   if(fCalculateCumulantsVsM)
1208   {
1209    fIntFlowCorrectionTermsForNUAVsMPro[0][1]->Fill(dMultiplicityBin,sinP1nP1n,dMult*(dMult-1));  
1210    fIntFlowCorrectionTermsForNUAVsMPro[0][3]->Fill(dMultiplicityBin,sinP2nM1n,dMult*(dMult-1));    
1211   }
1212  } 
1213  
1214  // 3-particle:
1215  Double_t sinP1nM1nM1n = 0.; // <<sin(n*(phi1-phi2-phi3))>>
1216  
1217  if(dMult>2)
1218  {
1219   sinP1nM1nM1n = (-dImQ1n*(pow(dReQ1n,2)+pow(dImQ1n,2))+dReQ1n*dImQ2n-dImQ1n*dReQ2n+2.*(dMult-1)*dImQ1n)
1220                / (dMult*(dMult-1)*(dMult-2)); 
1221   
1222   // average non-weighted 3-particle correction (sin terms) for non-uniform acceptance for single event:
1223   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(3,sinP1nM1nM1n);
1224   // event weights for NUA terms:
1225   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->SetBinContent(3,dMult*(dMult-1)*(dMult-2));
1226   
1227   // final average non-weighted 3-particle correction (sin terms) for non-uniform acceptance for all events:  
1228   fIntFlowCorrectionTermsForNUAPro[0]->Fill(2.5,sinP1nM1nM1n,dMult*(dMult-1)*(dMult-2));
1229   if(fCalculateCumulantsVsM){fIntFlowCorrectionTermsForNUAVsMPro[0][2]->Fill(dMultiplicityBin,sinP1nM1nM1n,dMult*(dMult-1)*(dMult-2));}  
1230  } 
1231  
1232 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTerms()
1233
1234 //=======================================================================================================================
1235
1236 void AliFlowAnalysisWithQCumulants::GetOutputHistograms(TList *outputListHistos)
1237 {
1238  // a) Get pointers for common control and common result histograms;
1239  // b) Get pointers for histograms holding particle weights;
1240  // c) Get pointers for reference flow histograms;
1241  // d) Get pointers for differential flow histograms;
1242  // e) Get pointers for 2D differential flow histograms;
1243  // f) Get pointers for other differential correlators;
1244  // g) Get pointers for mixed harmonics histograms;
1245  // h) Get pointers for nested loops' histograms;
1246  // i) Get pointers for control histograms;
1247  // j) Get pointers for bootstrap.
1248  
1249  if(outputListHistos)
1250  {      
1251   this->SetHistList(outputListHistos);
1252   if(!fHistList)
1253   {
1254    printf("\n WARNING (QC): fHistList is NULL in AFAWQC::GOH() !!!!\n\n");
1255    exit(0);
1256   }
1257   this->GetPointersForCommonHistograms(); 
1258   this->GetPointersForParticleWeightsHistograms(); 
1259   this->GetPointersForIntFlowHistograms();
1260   this->GetPointersForDiffFlowHistograms(); 
1261   this->GetPointersFor2DDiffFlowHistograms(); 
1262   this->GetPointersForOtherDiffCorrelators();  
1263   this->GetPointersForMixedHarmonicsHistograms(); 
1264   this->GetPointersForNestedLoopsHistograms(); 
1265   this->GetPointersForControlHistograms();
1266   this->GetPointersForBootstrap();
1267  } else 
1268    {
1269     printf("\n WARNING (QC): outputListHistos is NULL in AFAWQC::GOH() !!!!\n\n");
1270     exit(0);
1271    }
1272    
1273 } // end of void AliFlowAnalysisWithQCumulants::GetOutputHistograms(TList *outputListHistos)
1274
1275 //=======================================================================================================================
1276
1277 TProfile* AliFlowAnalysisWithQCumulants::MakePtProjection(TProfile2D *profilePtEta) const
1278 {
1279  // project 2D profile onto pt axis to get 1D profile
1280  
1281  Int_t nBinsPt   = profilePtEta->GetNbinsX();
1282  Double_t dPtMin = (profilePtEta->GetXaxis())->GetXmin();
1283  Double_t dPtMax = (profilePtEta->GetXaxis())->GetXmax();
1284  
1285  Int_t nBinsEta   = profilePtEta->GetNbinsY();
1286  
1287  TProfile *profilePt = new TProfile("","",nBinsPt,dPtMin,dPtMax); 
1288  
1289  for(Int_t p=1;p<=nBinsPt;p++)
1290  {
1291   Double_t contentPt = 0.;
1292   Double_t entryPt = 0.;
1293   Double_t spreadPt = 0.;
1294   Double_t sum1 = 0.;
1295   Double_t sum2 = 0.;
1296   Double_t sum3 = 0.;
1297   for(Int_t e=1;e<=nBinsEta;e++)
1298   {
1299    contentPt += (profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)))
1300               * (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1301    entryPt   += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1302    
1303    sum1 += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)))
1304          * (pow(profilePtEta->GetBinError(profilePtEta->GetBin(p,e)),2.)
1305             + pow(profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)),2.)); 
1306    sum2 += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1307    sum3 += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)))
1308          * (profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)));            
1309   }
1310   if(sum2>0. && sum1/sum2-pow(sum3/sum2,2.) > 0.)
1311   {
1312    spreadPt = pow(sum1/sum2-pow(sum3/sum2,2.),0.5);
1313   }
1314   profilePt->SetBinContent(p,contentPt);
1315   profilePt->SetBinEntries(p,entryPt);
1316   {
1317    profilePt->SetBinError(p,spreadPt);
1318   }
1319   
1320  }
1321  
1322  return profilePt;
1323  
1324 } // end of TProfile* AliFlowAnalysisWithQCumulants::MakePtProjection(TProfile2D *profilePtEta)
1325
1326
1327 //=======================================================================================================================
1328
1329
1330 TProfile* AliFlowAnalysisWithQCumulants::MakeEtaProjection(TProfile2D *profilePtEta) const
1331 {
1332  // project 2D profile onto eta axis to get 1D profile
1333  
1334  Int_t nBinsEta   = profilePtEta->GetNbinsY();
1335  Double_t dEtaMin = (profilePtEta->GetYaxis())->GetXmin();
1336  Double_t dEtaMax = (profilePtEta->GetYaxis())->GetXmax();
1337  
1338  Int_t nBinsPt = profilePtEta->GetNbinsX();
1339  
1340  TProfile *profileEta = new TProfile("","",nBinsEta,dEtaMin,dEtaMax); 
1341  
1342  for(Int_t e=1;e<=nBinsEta;e++)
1343  {
1344   Double_t contentEta = 0.;
1345   Double_t entryEta = 0.;
1346   for(Int_t p=1;p<=nBinsPt;p++)
1347   {
1348    contentEta += (profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)))
1349               * (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1350    entryEta   += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1351   }
1352   profileEta->SetBinContent(e,contentEta);
1353   profileEta->SetBinEntries(e,entryEta);
1354  }
1355  
1356  return profileEta;
1357  
1358 } // end of TProfile* AliFlowAnalysisWithQCumulants::MakeEtaProjection(TProfile2D *profilePtEta)
1359
1360 //=======================================================================================================================
1361
1362 void AliFlowAnalysisWithQCumulants::PrintFinalResultsForIntegratedFlow(TString type)
1363 {
1364  // Printing on the screen the final results for integrated flow (RF, POI and RP). 
1365  
1366  Int_t n = fHarmonic; 
1367  
1368  Double_t dVn[4] = {0.}; // array to hold Vn{2}, Vn{4}, Vn{6} and Vn{8}   
1369  Double_t dVnErr[4] = {0.}; // array to hold errors of Vn{2}, Vn{4}, Vn{6} and Vn{8}   
1370  
1371  if(type == "RF")
1372  {
1373   for(Int_t b=0;b<4;b++)
1374   {
1375    dVn[0] = (fCommonHistsResults2nd->GetHistIntFlow())->GetBinContent(1); 
1376    dVnErr[0] = (fCommonHistsResults2nd->GetHistIntFlow())->GetBinError(1); 
1377    dVn[1] = (fCommonHistsResults4th->GetHistIntFlow())->GetBinContent(1); 
1378    dVnErr[1] = (fCommonHistsResults4th->GetHistIntFlow())->GetBinError(1); 
1379    dVn[2] = (fCommonHistsResults6th->GetHistIntFlow())->GetBinContent(1); 
1380    dVnErr[2] = (fCommonHistsResults6th->GetHistIntFlow())->GetBinError(1); 
1381    dVn[3] = (fCommonHistsResults8th->GetHistIntFlow())->GetBinContent(1); 
1382    dVnErr[3] = (fCommonHistsResults8th->GetHistIntFlow())->GetBinError(1);    
1383   }  
1384  } else if(type == "RP")
1385    {
1386     dVn[0] = (fCommonHistsResults2nd->GetHistIntFlowRP())->GetBinContent(1); 
1387     dVnErr[0] = (fCommonHistsResults2nd->GetHistIntFlowRP())->GetBinError(1); 
1388     dVn[1] = (fCommonHistsResults4th->GetHistIntFlowRP())->GetBinContent(1); 
1389     dVnErr[1] = (fCommonHistsResults4th->GetHistIntFlowRP())->GetBinError(1); 
1390     dVn[2] = (fCommonHistsResults6th->GetHistIntFlowRP())->GetBinContent(1); 
1391     dVnErr[2] = (fCommonHistsResults6th->GetHistIntFlowRP())->GetBinError(1); 
1392     dVn[3] = (fCommonHistsResults8th->GetHistIntFlowRP())->GetBinContent(1); 
1393     dVnErr[3] = (fCommonHistsResults8th->GetHistIntFlowRP())->GetBinError(1); 
1394    } else if(type == "POI")
1395      {
1396       dVn[0] = (fCommonHistsResults2nd->GetHistIntFlowPOI())->GetBinContent(1); 
1397       dVnErr[0] = (fCommonHistsResults2nd->GetHistIntFlowPOI())->GetBinError(1); 
1398       dVn[1] = (fCommonHistsResults4th->GetHistIntFlowPOI())->GetBinContent(1); 
1399       dVnErr[1] = (fCommonHistsResults4th->GetHistIntFlowPOI())->GetBinError(1); 
1400       dVn[2] = (fCommonHistsResults6th->GetHistIntFlowPOI())->GetBinContent(1); 
1401       dVnErr[2] = (fCommonHistsResults6th->GetHistIntFlowPOI())->GetBinError(1); 
1402       dVn[3] = (fCommonHistsResults8th->GetHistIntFlowPOI())->GetBinContent(1); 
1403       dVnErr[3] = (fCommonHistsResults8th->GetHistIntFlowPOI())->GetBinError(1); 
1404      } else if(type == "RF, rebinned in M" && fCalculateCumulantsVsM)
1405        {
1406         for(Int_t b=0;b<4;b++)
1407         {
1408          dVn[b] = fIntFlowRebinnedInM->GetBinContent(b+1); 
1409          dVnErr[b] = fIntFlowRebinnedInM->GetBinError(b+1);
1410         }  
1411        }
1412  
1413  TString title = " flow estimates from Q-cumulants"; 
1414  TString subtitle = "    ("; 
1415  TString subtitle2 = "       (rebinned in M)"; 
1416  
1417  if(type != "RF, rebinned in M")
1418  {
1419   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
1420   {
1421    subtitle.Append(type);
1422    subtitle.Append(", without weights)");
1423   } else  
1424     {
1425      subtitle.Append(type);
1426      subtitle.Append(", with weights)");
1427     }
1428  } else
1429    {
1430     if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
1431     {
1432      subtitle.Append("RF");
1433      subtitle.Append(", without weights)");
1434     } else  
1435       {
1436        subtitle.Append("RF");
1437        subtitle.Append(", with weights)");      
1438       }
1439    } 
1440    
1441  cout<<endl;
1442  cout<<"*************************************"<<endl;
1443  cout<<"*************************************"<<endl;
1444  cout<<title.Data()<<endl; 
1445  cout<<subtitle.Data()<<endl; 
1446  if(type == "RF, rebinned in M"){cout<<subtitle2.Data()<<endl;}
1447  cout<<endl;
1448   
1449  for(Int_t i=0;i<4;i++)
1450  {
1451   cout<<"  v_"<<n<<"{"<<2*(i+1)<<"} = "<<dVn[i]<<" +/- "<<dVnErr[i]<<endl;
1452  }
1453  
1454  cout<<endl;
1455  if(type == "RF")
1456  {
1457   if(fApplyCorrectionForNUA)
1458   {
1459    cout<<" detector bias (corrected for): "<<endl;
1460   } else
1461     {
1462      cout<<" detector bias (not corrected for):"<<endl;  
1463     }
1464   cout<<"  to QC{2}: "<<fIntFlowDetectorBias->GetBinContent(1)<<" +/- "<<fIntFlowDetectorBias->GetBinError(1)<<endl;
1465   cout<<"  to QC{4}: "<<fIntFlowDetectorBias->GetBinContent(2)<<" +/- "<<fIntFlowDetectorBias->GetBinError(2)<<endl;
1466   cout<<endl;
1467  }
1468  if(type == "RF" || type == "RF, rebinned in M")
1469  {
1470   cout<<"     nEvts = "<<(Int_t)fCommonHists->GetHistMultRP()->GetEntries()<<", <M> = "<<(Double_t)fCommonHists->GetHistMultRP()->GetMean()<<endl; 
1471  }
1472  else if (type == "RP")
1473  {
1474   cout<<"     nEvts = "<<(Int_t)fCommonHists->GetHistMultRP()->GetEntries()<<", <M> = "<<(Double_t)fCommonHists->GetHistMultRP()->GetMean()<<endl;  
1475  } 
1476  else if (type == "POI")
1477  {
1478   cout<<"     nEvts = "<<(Int_t)fCommonHists->GetHistMultPOI()->GetEntries()<<", <M> = "<<(Double_t)fCommonHists->GetHistMultPOI()->GetMean()<<endl;
1479  }  
1480  
1481  cout<<"*************************************"<<endl;
1482  cout<<"*************************************"<<endl;
1483  cout<<endl; 
1484   
1485 }// end of AliFlowAnalysisWithQCumulants::PrintFinalResultsForIntegratedFlow(TString type="RF");
1486
1487 //=======================================================================================================================
1488
1489 void AliFlowAnalysisWithQCumulants::WriteHistograms(TString outputFileName)
1490 {
1491  //store the final results in output .root file
1492  TFile *output = new TFile(outputFileName.Data(),"RECREATE");
1493  //output->WriteObject(fHistList, "cobjQC","SingleKey");
1494  fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
1495  delete output;
1496 }
1497
1498
1499 //=======================================================================================================================
1500
1501
1502 void AliFlowAnalysisWithQCumulants::WriteHistograms(TDirectoryFile *outputFileName)
1503 {
1504  //store the final results in output .root file
1505  fHistList->SetName("cobjQC");
1506  fHistList->SetOwner(kTRUE);
1507  outputFileName->Add(fHistList);
1508  outputFileName->Write(outputFileName->GetName(), TObject::kSingleKey);
1509 }
1510
1511 //=======================================================================================================================
1512
1513 void AliFlowAnalysisWithQCumulants::BookCommonHistograms()
1514 {
1515  // Book common control histograms and common histograms for final results.
1516  //  a) Book common control histograms;
1517  //  b) Book common result histograms.
1518  
1519  // a) Book common control histograms: 
1520  //  Common control histograms (all events):
1521  TString commonHistsName = "AliFlowCommonHistQC";
1522  commonHistsName += fAnalysisLabel->Data();
1523  fCommonHists = new AliFlowCommonHist(commonHistsName.Data(),commonHistsName.Data(),fBookOnlyBasicCCH);
1524  fHistList->Add(fCommonHists);  
1525  //  Common control histograms (selected events):
1526  if(fFillMultipleControlHistograms)
1527  {
1528   // Common control histogram filled for events with 2 and more reference particles:
1529   TString commonHists2ndOrderName = "AliFlowCommonHist2ndOrderQC";
1530   commonHists2ndOrderName += fAnalysisLabel->Data();
1531   fCommonHists2nd = new AliFlowCommonHist(commonHists2ndOrderName.Data(),commonHists2ndOrderName.Data(),fBookOnlyBasicCCH);
1532   fHistList->Add(fCommonHists2nd);  
1533   // Common control histogram filled for events with 2 and more reference particles:
1534   TString commonHists4thOrderName = "AliFlowCommonHist4thOrderQC";
1535   commonHists4thOrderName += fAnalysisLabel->Data();
1536   fCommonHists4th = new AliFlowCommonHist(commonHists4thOrderName.Data(),commonHists4thOrderName.Data(),fBookOnlyBasicCCH);
1537   fHistList->Add(fCommonHists4th);  
1538   // Common control histogram filled for events with 6 and more reference particles:
1539   TString commonHists6thOrderName = "AliFlowCommonHist6thOrderQC";
1540   commonHists6thOrderName += fAnalysisLabel->Data();
1541   fCommonHists6th = new AliFlowCommonHist(commonHists6thOrderName.Data(),commonHists6thOrderName.Data(),fBookOnlyBasicCCH);
1542   fHistList->Add(fCommonHists6th);  
1543   // Common control histogram filled for events with 8 and more reference particles:
1544   TString commonHists8thOrderName = "AliFlowCommonHist8thOrderQC";
1545   commonHists8thOrderName += fAnalysisLabel->Data();
1546   fCommonHists8th = new AliFlowCommonHist(commonHists8thOrderName.Data(),commonHists8thOrderName.Data(),fBookOnlyBasicCCH);
1547   fHistList->Add(fCommonHists8th);    
1548  } // end of if(fFillMultipleControlHistograms)
1549  
1550  // b) Book common result histograms: 
1551  //  Common result histograms for QC{2}:
1552  TString commonHistResults2ndOrderName = "AliFlowCommonHistResults2ndOrderQC";
1553  commonHistResults2ndOrderName += fAnalysisLabel->Data();
1554  fCommonHistsResults2nd = new AliFlowCommonHistResults(commonHistResults2ndOrderName.Data(),"",fHarmonic);
1555  fHistList->Add(fCommonHistsResults2nd);  
1556  //  Common result histograms for QC{4}:
1557  TString commonHistResults4thOrderName = "AliFlowCommonHistResults4thOrderQC";
1558  commonHistResults4thOrderName += fAnalysisLabel->Data();
1559  fCommonHistsResults4th = new AliFlowCommonHistResults(commonHistResults4thOrderName.Data(),"",fHarmonic);
1560  fHistList->Add(fCommonHistsResults4th); 
1561  //  Common result histograms for QC{6}:
1562  TString commonHistResults6thOrderName = "AliFlowCommonHistResults6thOrderQC";
1563  commonHistResults6thOrderName += fAnalysisLabel->Data();
1564  fCommonHistsResults6th = new AliFlowCommonHistResults(commonHistResults6thOrderName.Data(),"",fHarmonic);
1565  fHistList->Add(fCommonHistsResults6th);  
1566  //  Common result histograms for QC{8}:
1567  TString commonHistResults8thOrderName = "AliFlowCommonHistResults8thOrderQC";
1568  commonHistResults8thOrderName += fAnalysisLabel->Data();
1569  fCommonHistsResults8th = new AliFlowCommonHistResults(commonHistResults8thOrderName.Data(),"",fHarmonic);
1570  fHistList->Add(fCommonHistsResults8th); 
1571  
1572 } // end of void AliFlowAnalysisWithQCumulants::BookCommonHistograms()
1573
1574 //=======================================================================================================================
1575
1576 void AliFlowAnalysisWithQCumulants::BookAndFillWeightsHistograms()
1577 {
1578  // Book and fill histograms which hold phi, pt and eta weights.
1579
1580  if(!fWeightsList)
1581  {
1582   printf("\n WARNING (QC): fWeightsList is NULL in AFAWQC::BAFWH() !!!! \n\n");
1583   exit(0);  
1584  }
1585     
1586  TString fUseParticleWeightsName = "fUseParticleWeightsQC";
1587  fUseParticleWeightsName += fAnalysisLabel->Data();
1588  fUseParticleWeights = new TProfile(fUseParticleWeightsName.Data(),"0 = particle weight not used, 1 = particle weight used ",4,0,4);
1589  fUseParticleWeights->SetLabelSize(0.06);
1590  fUseParticleWeights->SetStats(kFALSE);
1591  (fUseParticleWeights->GetXaxis())->SetBinLabel(1,"w_{#phi}");
1592  (fUseParticleWeights->GetXaxis())->SetBinLabel(2,"w_{p_{T}}");
1593  (fUseParticleWeights->GetXaxis())->SetBinLabel(3,"w_{#eta}");
1594  (fUseParticleWeights->GetXaxis())->SetBinLabel(4,"w_{track}");
1595  fUseParticleWeights->Fill(0.5,(Int_t)fUsePhiWeights);
1596  fUseParticleWeights->Fill(1.5,(Int_t)fUsePtWeights);
1597  fUseParticleWeights->Fill(2.5,(Int_t)fUseEtaWeights);
1598  fUseParticleWeights->Fill(3.5,(Int_t)fUseTrackWeights);
1599  fWeightsList->Add(fUseParticleWeights); 
1600   
1601  if(fUsePhiWeights)
1602  {
1603   if(fWeightsList->FindObject("phi_weights"))
1604   {
1605    fPhiWeights = dynamic_cast<TH1F*>(fWeightsList->FindObject("phi_weights"));
1606    if(!fPhiWeights)
1607    {
1608     printf("\n WARNING (QC): fPhiWeights is NULL in AFAWQC::BAFWH() !!!!\n\n");
1609     exit(0);
1610    }
1611    if(TMath::Abs(fPhiWeights->GetBinWidth(1)-fPhiBinWidth)>pow(10.,-6.))
1612    {
1613     cout<<endl;
1614     cout<<"WARNING (QC): Inconsistent binning in histograms for phi-weights throughout the code."<<endl;
1615     cout<<endl;
1616     //exit(0);
1617    }
1618   } else 
1619     {
1620      cout<<"WARNING: fWeightsList->FindObject(\"phi_weights\") is NULL in AFAWQC::BAFWH() !!!!"<<endl;
1621      exit(0);
1622     }
1623  } // end of if(fUsePhiWeights)
1624  
1625  if(fUsePtWeights) 
1626  {
1627   if(fWeightsList->FindObject("pt_weights"))
1628   {
1629    fPtWeights = dynamic_cast<TH1D*>(fWeightsList->FindObject("pt_weights"));
1630    if(!fPtWeights)
1631    {
1632     printf("\n WARNING (QC): fPtWeights is NULL in AFAWQC::BAFWH() !!!!\n\n");
1633     exit(0);
1634    }
1635    if(TMath::Abs(fPtWeights->GetBinWidth(1)-fPtBinWidth)>pow(10.,-6.))
1636    {
1637     cout<<endl;
1638     cout<<"WARNING (QC): Inconsistent binning in histograms for pt-weights throughout the code."<<endl;
1639     cout<<endl;
1640     //exit(0);
1641    }
1642   } else 
1643     {
1644      cout<<"WARNING: fWeightsList->FindObject(\"pt_weights\") is NULL in AFAWQC::BAFWH() !!!!"<<endl;
1645      exit(0);
1646     }
1647  } // end of if(fUsePtWeights)    
1648
1649  if(fUseEtaWeights) 
1650  {
1651   if(fWeightsList->FindObject("eta_weights"))
1652   {
1653    fEtaWeights = dynamic_cast<TH1D*>(fWeightsList->FindObject("eta_weights"));
1654    if(!fEtaWeights)
1655    {
1656     printf("\n WARNING (QC): fEtaWeights is NULL in AFAWQC::BAFWH() !!!!\n\n");
1657     exit(0);
1658    }
1659    if(TMath::Abs(fEtaWeights->GetBinWidth(1)-fEtaBinWidth)>pow(10.,-6.))
1660    {
1661     cout<<endl;
1662     cout<<"WARNING (QC): Inconsistent binning in histograms for eta-weights throughout the code."<<endl;
1663     cout<<endl;
1664     //exit(0);
1665    }
1666   } else 
1667     {
1668      cout<<"WARNING: fUseEtaWeights && fWeightsList->FindObject(\"eta_weights\") is NULL in AFAWQC::BAFWH() !!!!"<<endl;
1669      exit(0);
1670     }
1671  } // end of if(fUseEtaWeights)
1672  
1673 } // end of AliFlowAnalysisWithQCumulants::BookAndFillWeightsHistograms()
1674
1675 //=======================================================================================================================
1676
1677 void AliFlowAnalysisWithQCumulants::BookEverythingForIntegratedFlow()
1678 {
1679  // Book all objects for integrated flow:
1680  //  a) Book profile to hold all flags for integrated flow;
1681  //  b) Book event-by-event quantities;
1682  //  c) Book profiles; // to be improved (comment)
1683  //  d) Book histograms holding the final results.
1684  
1685  TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data members?)
1686  TString powerFlag[2] = {"linear","quadratic"}; // to be improved (should I promote this to data members?)
1687  
1688  // a) Book profile to hold all flags for integrated flow:
1689  TString intFlowFlagsName = "fIntFlowFlags";
1690  intFlowFlagsName += fAnalysisLabel->Data();
1691  fIntFlowFlags = new TProfile(intFlowFlagsName.Data(),"Flags for Integrated Flow",20,0.,20.);
1692  fIntFlowFlags->SetTickLength(-0.01,"Y");
1693  fIntFlowFlags->SetMarkerStyle(25);
1694  fIntFlowFlags->SetLabelSize(0.04);
1695  fIntFlowFlags->SetLabelOffset(0.02,"Y");
1696  fIntFlowFlags->SetStats(kFALSE);
1697  fIntFlowFlags->GetXaxis()->SetBinLabel(1,"Particle Weights");
1698  fIntFlowFlags->GetXaxis()->SetBinLabel(2,"Event Weights");
1699  fIntFlowFlags->GetXaxis()->SetBinLabel(3,"Corrected for NUA?");
1700  fIntFlowFlags->GetXaxis()->SetBinLabel(4,"Print RF results");
1701  fIntFlowFlags->GetXaxis()->SetBinLabel(5,"Print RP results");
1702  fIntFlowFlags->GetXaxis()->SetBinLabel(6,"Print POI results");
1703  fIntFlowFlags->GetXaxis()->SetBinLabel(7,"Print RF (rebinned in M) results");
1704  fIntFlowFlags->GetXaxis()->SetBinLabel(8,"Corrected for NUA vs M?");
1705  fIntFlowFlags->GetXaxis()->SetBinLabel(9,"Propagate errors to v_{n} from correlations?");
1706  fIntFlowFlags->GetXaxis()->SetBinLabel(10,"Calculate cumulants vs M");
1707  fIntFlowFlags->GetXaxis()->SetBinLabel(11,"fMinimumBiasReferenceFlow");
1708  fIntFlowFlags->GetXaxis()->SetBinLabel(12,"fForgetAboutCovariances");
1709  fIntFlowFlags->GetXaxis()->SetBinLabel(13,"fStorePhiDistributionForOneEvent");
1710  fIntFlowFlags->GetXaxis()->SetBinLabel(14,"fFillMultipleControlHistograms");
1711  fIntFlowFlags->GetXaxis()->SetBinLabel(15,"Calculate all correlations vs M");
1712  fIntFlowFlags->GetXaxis()->SetBinLabel(16,"fMultiplicityIs");
1713  fIntFlowFlags->GetXaxis()->SetBinLabel(17,"fExactNoRPs");
1714  fIntFlowFlags->GetXaxis()->SetBinLabel(18,"fUse2DHistograms");
1715  fIntFlowFlags->GetXaxis()->SetBinLabel(19,"fFillProfilesVsMUsingWeights");
1716  fIntFlowFlags->GetXaxis()->SetBinLabel(20,"fUseQvectorTerms");
1717  fIntFlowList->Add(fIntFlowFlags);
1718
1719  // b) Book event-by-event quantities:
1720  // Re[Q_{m*n,k}], Im[Q_{m*n,k}] and S_{p,k}^M: 
1721  fReQ = new TMatrixD(12,9);
1722  fImQ = new TMatrixD(12,9);
1723  fSpk = new TMatrixD(8,9);
1724  // average correlations <2>, <4>, <6> and <8> for single event (bining is the same as in fIntFlowCorrelationsPro and fIntFlowCorrelationsHist):
1725  TString intFlowCorrelationsEBEName = "fIntFlowCorrelationsEBE";
1726  intFlowCorrelationsEBEName += fAnalysisLabel->Data();
1727  fIntFlowCorrelationsEBE = new TH1D(intFlowCorrelationsEBEName.Data(),intFlowCorrelationsEBEName.Data(),4,0,4);
1728  // weights for average correlations <2>, <4>, <6> and <8> for single event:
1729  TString intFlowEventWeightsForCorrelationsEBEName = "fIntFlowEventWeightsForCorrelationsEBE";
1730  intFlowEventWeightsForCorrelationsEBEName += fAnalysisLabel->Data();
1731  fIntFlowEventWeightsForCorrelationsEBE = new TH1D(intFlowEventWeightsForCorrelationsEBEName.Data(),intFlowEventWeightsForCorrelationsEBEName.Data(),4,0,4);
1732  // average all correlations for single event (bining is the same as in fIntFlowCorrelationsAllPro and fIntFlowCorrelationsAllHist):
1733  TString intFlowCorrelationsAllEBEName = "fIntFlowCorrelationsAllEBE";
1734  intFlowCorrelationsAllEBEName += fAnalysisLabel->Data();
1735  fIntFlowCorrelationsAllEBE = new TH1D(intFlowCorrelationsAllEBEName.Data(),intFlowCorrelationsAllEBEName.Data(),64,0,64);
1736  // average correction terms for non-uniform acceptance for single event 
1737  // (binning is the same as in fIntFlowCorrectionTermsForNUAPro[2] and fIntFlowCorrectionTermsForNUAHist[2]):
1738  TString fIntFlowCorrectionTermsForNUAEBEName = "fIntFlowCorrectionTermsForNUAEBE";
1739  fIntFlowCorrectionTermsForNUAEBEName += fAnalysisLabel->Data();
1740  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
1741  {
1742   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);  
1743  }
1744  // event weights for terms for non-uniform acceptance: 
1745  TString fIntFlowEventWeightForCorrectionTermsForNUAEBEName = "fIntFlowEventWeightForCorrectionTermsForNUAEBE";
1746  fIntFlowEventWeightForCorrectionTermsForNUAEBEName += fAnalysisLabel->Data();
1747  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
1748  {
1749   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  
1750  }
1751  // c) Book profiles: // to be improved (comment)
1752  // profile to hold average multiplicities and number of events for events with nRP>=0, nRP>=1, ... , and nRP>=8:
1753  TString avMultiplicityName = "fAvMultiplicity";
1754  avMultiplicityName += fAnalysisLabel->Data();
1755  fAvMultiplicity = new TProfile(avMultiplicityName.Data(),"Average multiplicities of reference particles (RPs)",9,0,9);
1756  fAvMultiplicity->SetTickLength(-0.01,"Y");
1757  fAvMultiplicity->SetMarkerStyle(25);
1758  fAvMultiplicity->SetLabelSize(0.05);
1759  fAvMultiplicity->SetLabelOffset(0.02,"Y");
1760  fAvMultiplicity->SetYTitle("Average multiplicity");
1761  (fAvMultiplicity->GetXaxis())->SetBinLabel(1,"all evts");
1762  (fAvMultiplicity->GetXaxis())->SetBinLabel(2,"n_{RP} #geq 1");
1763  (fAvMultiplicity->GetXaxis())->SetBinLabel(3,"n_{RP} #geq 2");
1764  (fAvMultiplicity->GetXaxis())->SetBinLabel(4,"n_{RP} #geq 3");
1765  (fAvMultiplicity->GetXaxis())->SetBinLabel(5,"n_{RP} #geq 4");
1766  (fAvMultiplicity->GetXaxis())->SetBinLabel(6,"n_{RP} #geq 5");
1767  (fAvMultiplicity->GetXaxis())->SetBinLabel(7,"n_{RP} #geq 6");
1768  (fAvMultiplicity->GetXaxis())->SetBinLabel(8,"n_{RP} #geq 7");
1769  (fAvMultiplicity->GetXaxis())->SetBinLabel(9,"n_{RP} #geq 8");
1770  fIntFlowProfiles->Add(fAvMultiplicity);
1771  // Average correlations <<2>>, <<4>>, <<6>> and <<8>> for all events (with wrong errors!):
1772  TString correlationFlag[4] = {"#LT#LT2#GT#GT","#LT#LT4#GT#GT","#LT#LT6#GT#GT","#LT#LT8#GT#GT"};
1773  TString intFlowCorrelationsProName = "fIntFlowCorrelationsPro";
1774  intFlowCorrelationsProName += fAnalysisLabel->Data();
1775  fIntFlowCorrelationsPro = new TProfile(intFlowCorrelationsProName.Data(),"Average correlations for all events",4,0,4,"s");
1776  fIntFlowCorrelationsPro->Sumw2();
1777  fIntFlowCorrelationsPro->SetTickLength(-0.01,"Y");
1778  fIntFlowCorrelationsPro->SetMarkerStyle(25);
1779  fIntFlowCorrelationsPro->SetLabelSize(0.06);
1780  fIntFlowCorrelationsPro->SetLabelOffset(0.01,"Y");
1781  for(Int_t b=0;b<4;b++)
1782  {
1783   (fIntFlowCorrelationsPro->GetXaxis())->SetBinLabel(b+1,correlationFlag[b].Data());
1784  }
1785  fIntFlowProfiles->Add(fIntFlowCorrelationsPro);
1786  // Average correlations squared <<2>^2>, <<4>^2>, <<6>^2> and <<8>^2> for all events:
1787  TString squaredCorrelationFlag[4] = {"#LT#LT2#GT^{2}#GT","#LT#LT4#GT^{2}#GT","#LT#LT6#GT^{2}#GT","#LT#LT8#GT^{2}#GT"};
1788  TString intFlowSquaredCorrelationsProName = "fIntFlowSquaredCorrelationsPro";
1789  intFlowSquaredCorrelationsProName += fAnalysisLabel->Data();
1790  fIntFlowSquaredCorrelationsPro = new TProfile(intFlowSquaredCorrelationsProName.Data(),"Average squared correlations for all events",4,0,4,"s");
1791  fIntFlowSquaredCorrelationsPro->Sumw2();
1792  fIntFlowSquaredCorrelationsPro->SetTickLength(-0.01,"Y");
1793  fIntFlowSquaredCorrelationsPro->SetMarkerStyle(25);
1794  fIntFlowSquaredCorrelationsPro->SetLabelSize(0.06);
1795  fIntFlowSquaredCorrelationsPro->SetLabelOffset(0.01,"Y");
1796  for(Int_t b=0;b<4;b++)
1797  {
1798   (fIntFlowSquaredCorrelationsPro->GetXaxis())->SetBinLabel(b+1,squaredCorrelationFlag[b].Data());
1799  }
1800  fIntFlowProfiles->Add(fIntFlowSquaredCorrelationsPro);
1801  if(fCalculateCumulantsVsM)
1802  {
1803   for(Int_t ci=0;ci<4;ci++) // correlation index
1804   {
1805    // average correlations <<2>>, <<4>>, <<6>> and <<8>> versus multiplicity for all events (with wrong errors):
1806    TString intFlowCorrelationsVsMProName = "fIntFlowCorrelationsVsMPro";
1807    intFlowCorrelationsVsMProName += fAnalysisLabel->Data();
1808    fIntFlowCorrelationsVsMPro[ci] = new TProfile(Form("%s, %s",intFlowCorrelationsVsMProName.Data(),correlationFlag[ci].Data()),
1809                                                  Form("%s vs multiplicity",correlationFlag[ci].Data()),
1810                                                  fnBinsMult,fMinMult,fMaxMult,"s");   
1811    fIntFlowCorrelationsVsMPro[ci]->Sumw2();                                                                                       
1812    fIntFlowCorrelationsVsMPro[ci]->GetYaxis()->SetTitle(correlationFlag[ci].Data());
1813    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
1814    {
1815     fIntFlowCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("# RPs"); 
1816    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
1817      {
1818       fIntFlowCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
1819      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
1820        {
1821         fIntFlowCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("# POIs"); 
1822        } 
1823    fIntFlowProfiles->Add(fIntFlowCorrelationsVsMPro[ci]);
1824    // average squared correlations <<2>^2>, <<4>^2>, <<6>^2> and <<8>^2> versus multiplicity for all events:  
1825    TString intFlowSquaredCorrelationsVsMProName = "fIntFlowSquaredCorrelationsVsMPro";
1826    intFlowSquaredCorrelationsVsMProName += fAnalysisLabel->Data();
1827    fIntFlowSquaredCorrelationsVsMPro[ci] = new TProfile(Form("%s, %s",intFlowSquaredCorrelationsVsMProName.Data(),squaredCorrelationFlag[ci].Data()),
1828                                                         Form("%s vs multiplicity",squaredCorrelationFlag[ci].Data()),
1829                                                         fnBinsMult,fMinMult,fMaxMult,"s");   
1830    fIntFlowSquaredCorrelationsVsMPro[ci]->Sumw2();                                                                                              
1831    fIntFlowSquaredCorrelationsVsMPro[ci]->GetYaxis()->SetTitle(squaredCorrelationFlag[ci].Data());
1832    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
1833    {
1834     fIntFlowSquaredCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("# RPs");
1835    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
1836      {
1837       fIntFlowSquaredCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
1838      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
1839        {
1840         fIntFlowSquaredCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("# POIs");
1841        }
1842    fIntFlowProfiles->Add(fIntFlowSquaredCorrelationsVsMPro[ci]);
1843   } // end of for(Int_t ci=0;ci<4;ci++) // correlation index  
1844  } // end of if(fCalculateCumulantsVsM)
1845  // averaged all correlations for all events (with wrong errors!):
1846  TString intFlowCorrelationsAllProName = "fIntFlowCorrelationsAllPro";
1847  intFlowCorrelationsAllProName += fAnalysisLabel->Data();
1848  fIntFlowCorrelationsAllPro = new TProfile(intFlowCorrelationsAllProName.Data(),"Average all correlations for all events",64,0,64);
1849  fIntFlowCorrelationsAllPro->Sumw2();
1850  fIntFlowCorrelationsAllPro->SetTickLength(-0.01,"Y");
1851  fIntFlowCorrelationsAllPro->SetMarkerStyle(25);
1852  fIntFlowCorrelationsAllPro->SetLabelSize(0.03);
1853  fIntFlowCorrelationsAllPro->SetLabelOffset(0.01,"Y");
1854  // 2-p correlations:
1855  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(1,"#LT#LT2#GT#GT_{n|n}");
1856  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(2,"#LT#LT2#GT#GT_{2n|2n}");
1857  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(3,"#LT#LT2#GT#GT_{3n|3n}");
1858  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(4,"#LT#LT2#GT#GT_{4n|4n}");
1859  // 3-p correlations:
1860  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(6,"#LT#LT3#GT#GT_{2n|n,n}");
1861  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(7,"#LT#LT3#GT#GT_{3n|2n,n}");
1862  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(8,"#LT#LT3#GT#GT_{4n|2n,2n}");
1863  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(9,"#LT#LT3#GT#GT_{4n|3n,n}");
1864  // 4-p correlations:
1865  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(11,"#LT#LT4#GT#GT_{n,n|n,n}"); 
1866  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(12,"#LT#LT4#GT#GT_{2n,n|2n,n}");
1867  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(13,"#LT#LT4#GT#GT_{2n,2n|2n,2n}");
1868  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(14,"#LT#LT4#GT#GT_{3n|n,n,n}");
1869  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(15,"#LT#LT4#GT#GT_{3n,n|3n,n}");
1870  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(16,"#LT#LT4#GT#GT_{3n,n|2n,2n}"); 
1871  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(17,"#LT#LT4#GT#GT_{4n|2n,n,n}");
1872  // 5-p correlations:
1873  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(19,"#LT#LT5#GT#GT_{2n,n|n,n,n}"); 
1874  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(20,"#LT#LT5#GT#GT_{2n,2n|2n,n,n}");
1875  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(21,"#LT#LT5#GT#GT_{3n,n|2n,n,n}");
1876  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(22,"#LT#LT5#GT#GT_{4n|n,n,n,n}");
1877  // 6-p correlations:
1878  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(24,"#LT#LT6#GT#GT_{n,n,n|n,n,n}");
1879  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(25,"#LT#LT6#GT#GT_{2n,n,n|2n,n,n}");
1880  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(26,"#LT#LT6#GT#GT_{2n,2n|n,n,n,n}");
1881  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(27,"#LT#LT6#GT#GT_{3n,n|n,n,n,n}");
1882  // 7-p correlations:  
1883  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(29,"#LT#LT7#GT#GT_{2n,n,n|n,n,n,n}");
1884  // 8-p correlations:
1885  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(31,"#LT#LT8#GT#GT_{n,n,n,n|n,n,n,n}");
1886  //  EXTRA correlations for v3{5} study:
1887  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(33,"#LT#LT4#GT#GT_{4n,2n|3n,3n}");
1888  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(34,"#LT#LT5#GT#GT_{3n,3n|2n,2n,2n}");
1889  //  EXTRA correlations for Teaney-Yan study:
1890  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(35,"#LT#LT2#GT#GT_{5n|5n}");
1891  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(36,"#LT#LT2#GT#GT_{6n|6n}");
1892  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(37,"#LT#LT3#GT#GT_{5n|3n,2n}");
1893  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(38,"#LT#LT3#GT#GT_{5n|4n,1n}");
1894  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(39,"#LT#LT3#GT#GT_{6n|3n,3n}");
1895  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(40,"#LT#LT3#GT#GT_{6n|4n,2n}");
1896  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(41,"#LT#LT3#GT#GT_{6n|5n,1n}");
1897  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(42,"#LT#LT4#GT#GT_{6n|3n,2n,1n}");
1898  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(43,"#LT#LT4#GT#GT_{3n,2n|3n,2n}");
1899  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(44,"#LT#LT4#GT#GT_{4n,1n|3n,2n}");
1900  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(45,"#LT#LT4#GT#GT_{3n,3n|3n,3n}");
1901  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(46,"#LT#LT4#GT#GT_{4n,2n|3n,3n}");
1902  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(47,"#LT#LT4#GT#GT_{5n,1n|3n,3n}");
1903  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(48,"#LT#LT4#GT#GT_{4n,2n|4n,2n}");
1904  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(49,"#LT#LT4#GT#GT_{5n,1n|4n,2n}");
1905  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(50,"#LT#LT4#GT#GT_{5n|3n,1n,1n}");
1906  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(51,"#LT#LT4#GT#GT_{5n|2n,2n,1n}");
1907  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(52,"#LT#LT4#GT#GT_{5n,1n|5n,1n}");
1908  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(53,"#LT#LT5#GT#GT_{3n,3n|3n,2n,1n}");
1909  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(54,"#LT#LT5#GT#GT_{4n,2n|3n,2n,1n}");
1910  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(55,"#LT#LT5#GT#GT_{3n,2n|3n,1n,1n}");
1911  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(56,"#LT#LT5#GT#GT_{3n,2n|2n,2n,1n}");
1912  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(57,"#LT#LT5#GT#GT_{5n,1n|3n,2n,1n}");
1913  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(58,"#LT#LT6#GT#GT_{3n,2n,1n|3n,2n,1n}");
1914  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(59,"#LT#LT4#GT#GT_{6n|4n,1n,1n}");
1915  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(60,"#LT#LT4#GT#GT_{6n|2n,2n,2n}");
1916  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(61,"#LT#LT5#GT#GT_{6n|2n,2n,1n,1n}");
1917  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(62,"#LT#LT5#GT#GT_{4n,1n,1n|3n,3n}");
1918  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(63,"#LT#LT6#GT#GT_{3n,3n|2n,2n,1n,1n}");
1919  fIntFlowProfiles->Add(fIntFlowCorrelationsAllPro);
1920  // average all correlations versus multiplicity (errors via Sumw2 - to be improved):
1921  if(fCalculateAllCorrelationsVsM)
1922  {
1923   // 2-p correlations vs M:  
1924   fIntFlowCorrelationsAllVsMPro[0] = new TProfile("two1n1n","#LT#LT2#GT#GT_{n|n}",fnBinsMult,fMinMult,fMaxMult);
1925   fIntFlowCorrelationsAllVsMPro[1] = new TProfile("two2n2n","#LT#LT2#GT#GT_{2n|2n}",fnBinsMult,fMinMult,fMaxMult);
1926   fIntFlowCorrelationsAllVsMPro[2] = new TProfile("two3n3n","#LT#LT2#GT#GT_{3n|3n}",fnBinsMult,fMinMult,fMaxMult);
1927   fIntFlowCorrelationsAllVsMPro[3] = new TProfile("two4n4n","#LT#LT2#GT#GT_{4n|4n}",fnBinsMult,fMinMult,fMaxMult);
1928   // 3-p correlations vs M:
1929   fIntFlowCorrelationsAllVsMPro[5] = new TProfile("three2n1n1n","#LT#LT3#GT#GT_{2n|n,n}",fnBinsMult,fMinMult,fMaxMult);
1930   fIntFlowCorrelationsAllVsMPro[6] = new TProfile("three3n2n1n","#LT#LT3#GT#GT_{3n|2n,n}",fnBinsMult,fMinMult,fMaxMult);
1931   fIntFlowCorrelationsAllVsMPro[7] = new TProfile("three4n2n2n","#LT#LT3#GT#GT_{4n|2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1932   fIntFlowCorrelationsAllVsMPro[8] = new TProfile("three4n3n1n","#LT#LT3#GT#GT_{4n|3n,n}",fnBinsMult,fMinMult,fMaxMult);
1933   // 4-p correlations vs M:
1934   fIntFlowCorrelationsAllVsMPro[10] = new TProfile("four1n1n1n1n","#LT#LT4#GT#GT_{n,n|n,n}",fnBinsMult,fMinMult,fMaxMult);
1935   fIntFlowCorrelationsAllVsMPro[11] = new TProfile("four2n1n2n1n","#LT#LT4#GT#GT_{2n,n|2n,n}",fnBinsMult,fMinMult,fMaxMult);
1936   fIntFlowCorrelationsAllVsMPro[12] = new TProfile("four2n2n2n2n","#LT#LT4#GT#GT_{2n,2n|2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1937   fIntFlowCorrelationsAllVsMPro[13] = new TProfile("four3n1n1n1n","#LT#LT4#GT#GT_{3n|n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1938   fIntFlowCorrelationsAllVsMPro[14] = new TProfile("four3n1n3n1n","#LT#LT4#GT#GT_{3n,n|3n,n}",fnBinsMult,fMinMult,fMaxMult);
1939   fIntFlowCorrelationsAllVsMPro[15] = new TProfile("four3n1n2n2n","#LT#LT4#GT#GT_{3n,n|2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1940   fIntFlowCorrelationsAllVsMPro[16] = new TProfile("four4n2n1n1n","#LT#LT4#GT#GT_{4n|2n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1941   // 5-p correlations vs M:
1942   fIntFlowCorrelationsAllVsMPro[18] = new TProfile("five2n1n1n1n1n","#LT#LT5#GT#GT_{2n,n|n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1943   fIntFlowCorrelationsAllVsMPro[19] = new TProfile("five2n2n2n1n1n","#LT#LT5#GT#GT_{2n,2n|2n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1944   fIntFlowCorrelationsAllVsMPro[20] = new TProfile("five3n1n2n1n1n","#LT#LT5#GT#GT_{3n,n|2n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1945   fIntFlowCorrelationsAllVsMPro[21] = new TProfile("five4n1n1n1n1n","#LT#LT5#GT#GT_{4n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1946   // 6-p correlations vs M:
1947   fIntFlowCorrelationsAllVsMPro[23] = new TProfile("six1n1n1n1n1n1n","#LT#LT6#GT#GT_{n,n,n|n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1948   fIntFlowCorrelationsAllVsMPro[24] = new TProfile("six2n1n1n2n1n1n","#LT#LT6#GT#GT_{2n,n,n|2n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1949   fIntFlowCorrelationsAllVsMPro[25] = new TProfile("six2n2n1n1n1n1n","#LT#LT6#GT#GT_{2n,2n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1950   fIntFlowCorrelationsAllVsMPro[26] = new TProfile("six3n1n1n1n1n1n","#LT#LT6#GT#GT_{3n,n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1951   // 7-p correlations vs M:
1952   fIntFlowCorrelationsAllVsMPro[28] = new TProfile("seven2n1n1n1n1n1n1n","#LT#LT7#GT#GT_{2n,n,n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1953   // 8-p correlations vs M:
1954   fIntFlowCorrelationsAllVsMPro[30] = new TProfile("eight1n1n1n1n1n1n1n1n","#LT#LT8#GT#GT_{n,n,n,n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1955   // EXTRA correlations vs M for v3{5} study (to be improved - put them in a right order somewhere):
1956   fIntFlowCorrelationsAllVsMPro[32] = new TProfile("four4n2n3n3n","#LT#LT4#GT#GT_{4n,2n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1957   fIntFlowCorrelationsAllVsMPro[33] = new TProfile("five3n3n2n2n2n","#LT#LT5#GT#GT_{3n,3n|2n,2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1958   // EXTRA correlations vs M for Teaney-Yan study (to be improved - put them in a right order somewhere):
1959   fIntFlowCorrelationsAllVsMPro[34] = new TProfile("two5n5n","#LT#LT2#GT#GT_{5n|5n}",fnBinsMult,fMinMult,fMaxMult);
1960   fIntFlowCorrelationsAllVsMPro[35] = new TProfile("two6n6n","#LT#LT2#GT#GT_{6n|6n}",fnBinsMult,fMinMult,fMaxMult);
1961   fIntFlowCorrelationsAllVsMPro[36] = new TProfile("three5n3n2n","#LT#LT3#GT#GT_{5n|3n,2n}",fnBinsMult,fMinMult,fMaxMult);
1962   fIntFlowCorrelationsAllVsMPro[37] = new TProfile("three5n4n1n","#LT#LT3#GT#GT_{5n|4n,1n}",fnBinsMult,fMinMult,fMaxMult);
1963   fIntFlowCorrelationsAllVsMPro[38] = new TProfile("three6n3n3n","#LT#LT3#GT#GT_{6n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1964   fIntFlowCorrelationsAllVsMPro[39] = new TProfile("three6n4n2n","#LT#LT3#GT#GT_{6n|4n,2n}",fnBinsMult,fMinMult,fMaxMult);
1965   fIntFlowCorrelationsAllVsMPro[40] = new TProfile("three6n5n1n","#LT#LT3#GT#GT_{6n|5n,1n}",fnBinsMult,fMinMult,fMaxMult);
1966   fIntFlowCorrelationsAllVsMPro[41] = new TProfile("four6n3n2n1n","#LT#LT4#GT#GT_{6n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1967   fIntFlowCorrelationsAllVsMPro[42] = new TProfile("four3n2n3n2n","#LT#LT4#GT#GT_{3n,2n|3n,2n}",fnBinsMult,fMinMult,fMaxMult);
1968   fIntFlowCorrelationsAllVsMPro[43] = new TProfile("four4n1n3n2n","#LT#LT4#GT#GT_{4n,1n|3n,2n}",fnBinsMult,fMinMult,fMaxMult);
1969   fIntFlowCorrelationsAllVsMPro[44] = new TProfile("four3n3n3n3n","#LT#LT4#GT#GT_{3n,3n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1970   fIntFlowCorrelationsAllVsMPro[45] = new TProfile("four4n2n3n3n","#LT#LT4#GT#GT_{4n,2n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1971   fIntFlowCorrelationsAllVsMPro[46] = new TProfile("four5n1n3n3n","#LT#LT4#GT#GT_{5n,1n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1972   fIntFlowCorrelationsAllVsMPro[47] = new TProfile("four4n2n4n2n","#LT#LT4#GT#GT_{4n,2n|4n,2n}",fnBinsMult,fMinMult,fMaxMult);
1973   fIntFlowCorrelationsAllVsMPro[48] = new TProfile("four5n1n4n2n","#LT#LT4#GT#GT_{5n,1n|4n,2n}",fnBinsMult,fMinMult,fMaxMult);
1974   fIntFlowCorrelationsAllVsMPro[49] = new TProfile("four5n3n1n1n","#LT#LT4#GT#GT_{5n|3n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1975   fIntFlowCorrelationsAllVsMPro[50] = new TProfile("four5n2n2n1n","#LT#LT4#GT#GT_{5n|2n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1976   fIntFlowCorrelationsAllVsMPro[51] = new TProfile("four5n1n5n1n","#LT#LT4#GT#GT_{5n,1n|5n,1n}",fnBinsMult,fMinMult,fMaxMult);
1977   fIntFlowCorrelationsAllVsMPro[52] = new TProfile("five3n3n3n2n1n","#LT#LT5#GT#GT_{3n,3n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1978   fIntFlowCorrelationsAllVsMPro[53] = new TProfile("five4n2n3n2n1n","#LT#LT5#GT#GT_{4n,2n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1979   fIntFlowCorrelationsAllVsMPro[54] = new TProfile("five3n2n3n1n1n","#LT#LT5#GT#GT_{3n,2n|3n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1980   fIntFlowCorrelationsAllVsMPro[55] = new TProfile("five3n2n2n2n1n","#LT#LT5#GT#GT_{3n,2n|2n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1981   fIntFlowCorrelationsAllVsMPro[56] = new TProfile("five5n1n3n2n1n","#LT#LT5#GT#GT_{5n,1n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1982   fIntFlowCorrelationsAllVsMPro[57] = new TProfile("six3n2n1n3n2n1n","#LT#LT6#GT#GT_{3n,2n,1n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1983   fIntFlowCorrelationsAllVsMPro[58] = new TProfile("four6n4n1n1n","#LT#LT4#GT#GT_{6n|4n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1984   fIntFlowCorrelationsAllVsMPro[59] = new TProfile("four6n2n2n2n","#LT#LT4#GT#GT_{6n|2n,2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1985   fIntFlowCorrelationsAllVsMPro[60] = new TProfile("five6n2n2n1n1n","#LT#LT5#GT#GT_{6n|2n,2n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1986   fIntFlowCorrelationsAllVsMPro[61] = new TProfile("five4n1n1n3n3n","#LT#LT5#GT#GT_{4n,1n,1n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1987   fIntFlowCorrelationsAllVsMPro[62] = new TProfile("six3n3n2n2n1n1n","#LT#LT6#GT#GT_{3n,3n|2n,2n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1988   for(Int_t n=0;n<63;n++)
1989   {
1990    if(fIntFlowCorrelationsAllVsMPro[n])
1991    {
1992     fIntFlowCorrelationsAllVsMPro[n]->Sumw2();
1993     if(fMultiplicityIs==AliFlowCommonConstants::kRP)
1994     {
1995      fIntFlowCorrelationsAllVsMPro[n]->GetXaxis()->SetTitle("# RPs"); 
1996     } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
1997       {
1998        fIntFlowCorrelationsAllVsMPro[n]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
1999       } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2000         {
2001          fIntFlowCorrelationsAllVsMPro[n]->GetXaxis()->SetTitle("# POIs");
2002         }
2003     fIntFlowAllCorrelationsVsM->Add(fIntFlowCorrelationsAllVsMPro[n]);
2004    } // end of if(fIntFlowCorrelationsAllVsMPro[n])
2005   } // end of for(Int_t n=0;n<63;n++)
2006  } // end of if(fCalculateAllCorrelationsVsM)
2007  // when particle weights are used some extra correlations appear:
2008  if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights) 
2009  {
2010   TString intFlowExtraCorrelationsProName = "fIntFlowExtraCorrelationsPro";
2011   intFlowExtraCorrelationsProName += fAnalysisLabel->Data();
2012   fIntFlowExtraCorrelationsPro = new TProfile(intFlowExtraCorrelationsProName.Data(),"Average extra correlations for all events",100,0,100,"s");
2013   fIntFlowExtraCorrelationsPro->SetTickLength(-0.01,"Y");
2014   fIntFlowExtraCorrelationsPro->SetMarkerStyle(25);
2015   fIntFlowExtraCorrelationsPro->SetLabelSize(0.03);
2016   fIntFlowExtraCorrelationsPro->SetLabelOffset(0.01,"Y");
2017   // extra 2-p correlations:
2018   (fIntFlowExtraCorrelationsPro->GetXaxis())->SetBinLabel(1,"<<w1^3 w2 cos(n*(phi1-phi2))>>");
2019   (fIntFlowExtraCorrelationsPro->GetXaxis())->SetBinLabel(2,"<<w1 w2 w3^2 cos(n*(phi1-phi2))>>");
2020   fIntFlowProfiles->Add(fIntFlowExtraCorrelationsPro);
2021  } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
2022  // average product of correlations <2>, <4>, <6> and <8>:  
2023  TString productFlag[6] = {"#LT#LT2#GT#LT4#GT#GT","#LT#LT2#GT#LT6#GT#GT","#LT#LT2#GT#LT8#GT#GT",
2024                            "#LT#LT4#GT#LT6#GT#GT","#LT#LT4#GT#LT8#GT#GT","#LT#LT6#GT#LT8#GT#GT"};
2025  TString intFlowProductOfCorrelationsProName = "fIntFlowProductOfCorrelationsPro";
2026  intFlowProductOfCorrelationsProName += fAnalysisLabel->Data();
2027  fIntFlowProductOfCorrelationsPro = new TProfile(intFlowProductOfCorrelationsProName.Data(),"Average products of correlations",6,0,6);
2028  fIntFlowProductOfCorrelationsPro->SetTickLength(-0.01,"Y");
2029  fIntFlowProductOfCorrelationsPro->SetMarkerStyle(25); 
2030  fIntFlowProductOfCorrelationsPro->SetLabelSize(0.05);
2031  fIntFlowProductOfCorrelationsPro->SetLabelOffset(0.01,"Y");
2032  for(Int_t b=0;b<6;b++)
2033  {
2034   (fIntFlowProductOfCorrelationsPro->GetXaxis())->SetBinLabel(b+1,productFlag[b].Data());
2035  }
2036  fIntFlowProfiles->Add(fIntFlowProductOfCorrelationsPro); 
2037  // average product of correlations <2>, <4>, <6> and <8> versus multiplicity
2038  // [0=<<2><4>>,1=<<2><6>>,2=<<2><8>>,3=<<4><6>>,4=<<4><8>>,5=<<6><8>>]  
2039  if(fCalculateCumulantsVsM)
2040  {
2041   TString intFlowProductOfCorrelationsVsMProName = "fIntFlowProductOfCorrelationsVsMPro";
2042   intFlowProductOfCorrelationsVsMProName += fAnalysisLabel->Data();
2043   for(Int_t pi=0;pi<6;pi++)
2044   { 
2045    fIntFlowProductOfCorrelationsVsMPro[pi] = new TProfile(Form("%s, %s",intFlowProductOfCorrelationsVsMProName.Data(),productFlag[pi].Data()),
2046                                                           Form("%s versus multiplicity",productFlag[pi].Data()),
2047                                                           fnBinsMult,fMinMult,fMaxMult);             
2048    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2049    {
2050     fIntFlowProductOfCorrelationsVsMPro[pi]->GetXaxis()->SetTitle("# RPs");
2051    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2052      {
2053       fIntFlowProductOfCorrelationsVsMPro[pi]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2054      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2055        {
2056         fIntFlowProductOfCorrelationsVsMPro[pi]->GetXaxis()->SetTitle("# POIs");
2057        }
2058    fIntFlowProfiles->Add(fIntFlowProductOfCorrelationsVsMPro[pi]);
2059   } // end of for(Int_t pi=0;pi<6;pi++)
2060  } // end of if(fCalculateCumulantsVsM) 
2061  // average product of correction terms for NUA:  
2062  TString intFlowProductOfCorrectionTermsForNUAProName = "fIntFlowProductOfCorrectionTermsForNUAPro";
2063  intFlowProductOfCorrectionTermsForNUAProName += fAnalysisLabel->Data();
2064  fIntFlowProductOfCorrectionTermsForNUAPro = new TProfile(intFlowProductOfCorrectionTermsForNUAProName.Data(),"Average products of correction terms for NUA",27,0,27);
2065  fIntFlowProductOfCorrectionTermsForNUAPro->SetTickLength(-0.01,"Y");
2066  fIntFlowProductOfCorrectionTermsForNUAPro->SetMarkerStyle(25); 
2067  fIntFlowProductOfCorrectionTermsForNUAPro->SetLabelSize(0.03);
2068  fIntFlowProductOfCorrectionTermsForNUAPro->SetLabelOffset(0.01,"Y");
2069  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(1,"<<2><cos(#phi)>>");
2070  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(2,"<<2><sin(#phi)>>");
2071  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(3,"<<cos(#phi)><sin(#phi)>>");
2072  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(4,"Cov(<2>,<cos(#phi_{1}+#phi_{2})>)");
2073  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(5,"Cov(<2>,<sin(#phi_{1}+#phi_{2})>)");
2074  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(6,"Cov(<2>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2075  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(7,"Cov(<2>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2076  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(8,"Cov(<4>,<cos(#phi)>)");
2077  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(9,"Cov(<4>,<sin(#phi)>)");
2078  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(10,"Cov(<4>,<cos(#phi_{1}+#phi_{2})>)");
2079  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(11,"Cov(<4>,<sin(#phi_{1}+#phi_{2})>)");
2080  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(12,"Cov(<4>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>>)");
2081  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(13,"Cov(<4>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>>)");
2082  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(14,"Cov(<cos(#phi)>,<cos(#phi_{1}+#phi_{2})>)"); 
2083  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(15,"Cov(<cos(#phi)>,<sin(#phi_{1}+#phi_{2})>)");
2084  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(16,"Cov(<cos(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2085  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(17,"Cov(<cos(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2086  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(18,"Cov(<sin(#phi)>,<cos(#phi_{1}+#phi_{2})>)");
2087  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(19,"Cov(<sin(#phi)>,<sin(#phi_{1}+#phi_{2})>)");
2088  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(20,"Cov(<sin(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2089  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(21,"Cov(<sin(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2090  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(22,"Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}+#phi_{2})>)");
2091  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(23,"Cov(<cos(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2092  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(24,"Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2093  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(25,"Cov(<sin(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2094  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(26,"Cov(<sin(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2095  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(27,"Cov(<cos(#phi_{1}-#phi_{2}-#phi_{3}>,<sin(#phi_{1}-#phi_{2}-#phi_{3}>)");
2096  fIntFlowProfiles->Add(fIntFlowProductOfCorrectionTermsForNUAPro);
2097  // average correction terms for non-uniform acceptance (with wrong errors!):
2098  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
2099  {
2100   TString intFlowCorrectionTermsForNUAProName = "fIntFlowCorrectionTermsForNUAPro";
2101   intFlowCorrectionTermsForNUAProName += fAnalysisLabel->Data();
2102   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");
2103   fIntFlowCorrectionTermsForNUAPro[sc]->SetTickLength(-0.01,"Y");
2104   fIntFlowCorrectionTermsForNUAPro[sc]->SetMarkerStyle(25);
2105   fIntFlowCorrectionTermsForNUAPro[sc]->SetLabelSize(0.05);
2106   fIntFlowCorrectionTermsForNUAPro[sc]->SetLabelOffset(0.01,"Y");
2107   (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(1,Form("#LT#LT%s(n(#phi_{1}))#GT#GT",sinCosFlag[sc].Data()));
2108   (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(2,Form("#LT#LT%s(n(#phi_{1}+#phi_{2}))#GT#GT",sinCosFlag[sc].Data()));  
2109   (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(3,Form("#LT#LT%s(n(#phi_{1}-#phi_{2}-#phi_{3}))#GT#GT",sinCosFlag[sc].Data()));  
2110   (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(4,Form("#LT#LT%s(n(2#phi_{1}-#phi_{2}))#GT#GT",sinCosFlag[sc].Data()));  
2111   fIntFlowProfiles->Add(fIntFlowCorrectionTermsForNUAPro[sc]);
2112   // versus multiplicity:
2113   if(fCalculateCumulantsVsM)
2114   {
2115    TString correctionTermFlag[4] = {"(n(phi1))","(n(phi1+phi2))","(n(phi1-phi2-phi3))","(n(2phi1-phi2))"}; // to be improved - hardwired 4
2116    for(Int_t ci=0;ci<4;ci++) // correction term index (to be improved - hardwired 4)
2117    {
2118     TString intFlowCorrectionTermsForNUAVsMProName = "fIntFlowCorrectionTermsForNUAVsMPro";
2119     intFlowCorrectionTermsForNUAVsMProName += fAnalysisLabel->Data();
2120     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");
2121     fIntFlowProfiles->Add(fIntFlowCorrectionTermsForNUAVsMPro[sc][ci]);
2122    }
2123   } // end of if(fCalculateCumulantsVsM)
2124  } // end of for(Int_t sc=0;sc<2;sc++) 
2125  
2126  // d) Book histograms holding the final results:
2127  // average correlations <<2>>, <<4>>, <<6>> and <<8>> for all events (with correct errors!):
2128  TString intFlowCorrelationsHistName = "fIntFlowCorrelationsHist";
2129  intFlowCorrelationsHistName += fAnalysisLabel->Data();
2130  fIntFlowCorrelationsHist = new TH1D(intFlowCorrelationsHistName.Data(),"Average correlations for all events",4,0,4);
2131  fIntFlowCorrelationsHist->SetTickLength(-0.01,"Y");
2132  fIntFlowCorrelationsHist->SetMarkerStyle(25);
2133  fIntFlowCorrelationsHist->SetLabelSize(0.06);
2134  fIntFlowCorrelationsHist->SetLabelOffset(0.01,"Y");
2135  (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(1,"#LT#LT2#GT#GT");
2136  (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(2,"#LT#LT4#GT#GT");
2137  (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(3,"#LT#LT6#GT#GT");
2138  (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(4,"#LT#LT8#GT#GT");
2139  fIntFlowResults->Add(fIntFlowCorrelationsHist);
2140  // average correlations <<2>>, <<4>>, <<6>> and <<8>> for all events (with correct errors!) vs M:
2141  if(fCalculateCumulantsVsM)
2142  {
2143   for(Int_t ci=0;ci<4;ci++) // correlation index
2144   {
2145    TString intFlowCorrelationsVsMHistName = "fIntFlowCorrelationsVsMHist";
2146    intFlowCorrelationsVsMHistName += fAnalysisLabel->Data();
2147    fIntFlowCorrelationsVsMHist[ci] = new TH1D(Form("%s, %s",intFlowCorrelationsVsMHistName.Data(),correlationFlag[ci].Data()),
2148                                               Form("%s vs multiplicity",correlationFlag[ci].Data()),
2149                                               fnBinsMult,fMinMult,fMaxMult);                                            
2150    fIntFlowCorrelationsVsMHist[ci]->GetYaxis()->SetTitle(correlationFlag[ci].Data());
2151    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2152    {
2153     fIntFlowCorrelationsVsMHist[ci]->GetXaxis()->SetTitle("# RPs");
2154    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2155      {
2156       fIntFlowCorrelationsVsMHist[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2157      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2158        {
2159         fIntFlowCorrelationsVsMHist[ci]->GetXaxis()->SetTitle("# POIs");
2160        }
2161    fIntFlowResults->Add(fIntFlowCorrelationsVsMHist[ci]);
2162   } // end of for(Int_t ci=0;ci<4;ci++) // correlation index   
2163  } // end of if(fCalculateCumulantsVsM) 
2164  // average all correlations for all events (with correct errors!):
2165  TString intFlowCorrelationsAllHistName = "fIntFlowCorrelationsAllHist";
2166  intFlowCorrelationsAllHistName += fAnalysisLabel->Data();
2167  fIntFlowCorrelationsAllHist = new TH1D(intFlowCorrelationsAllHistName.Data(),"Average correlations for all events",34,0,34);
2168  fIntFlowCorrelationsAllHist->SetTickLength(-0.01,"Y");
2169  fIntFlowCorrelationsAllHist->SetMarkerStyle(25);
2170  fIntFlowCorrelationsAllHist->SetLabelSize(0.03);
2171  fIntFlowCorrelationsAllHist->SetLabelOffset(0.01,"Y");
2172  // 2-p correlations:
2173  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(1,"<<2>>_{n|n}");
2174  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(2,"<<2>>_{2n|2n}");
2175  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(3,"<<2>>_{3n|3n}");
2176  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(4,"<<2>>_{4n|4n}");
2177  // 3-p correlations:
2178  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(6,"<<3>>_{2n|n,n}");
2179  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(7,"<<3>>_{3n|2n,n}");
2180  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(8,"<<3>>_{4n|2n,2n}");
2181  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(9,"<<3>>_{4n|3n,n}");
2182  // 4-p correlations:
2183  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(11,"<<4>>_{n,n|n,n}"); 
2184  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(12,"<<4>>_{2n,n|2n,n}");
2185  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(13,"<<4>>_{2n,2n|2n,2n}");
2186  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(14,"<<4>>_{3n|n,n,n}");
2187  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(15,"<<4>>_{3n,n|3n,n}");
2188  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(16,"<<4>>_{3n,n|2n,2n}"); 
2189  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(17,"<<4>>_{4n|2n,n,n}");
2190  // 5-p correlations:
2191  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(19,"<<5>>_{2n|n,n,n,n}"); 
2192  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(20,"<<5>>_{2n,2n|2n,n,n}");
2193  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(21,"<<5>>_{3n,n|2n,n,n}");
2194  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(22,"<<5>>_{4n|n,n,n,n}");
2195  // 6-p correlations:
2196  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(24,"<<6>>_{n,n,n|n,n,n}");
2197  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(25,"<<6>>_{2n,n,n|2n,n,n}");
2198  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(26,"<<6>>_{2n,2n|n,n,n,n}");
2199  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(27,"<<6>>_{3n,n|n,n,n,n}");
2200  // 7-p correlations:  
2201  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(29,"<<7>>_{2n,n,n|n,n,n,n}");
2202  // 8-p correlations:
2203  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(31,"<<8>>_{n,n,n,n|n,n,n,n}");
2204  fIntFlowResults->Add(fIntFlowCorrelationsAllHist);
2205  // average correction terms for non-uniform acceptance (with correct errors!):
2206  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
2207  {
2208   TString intFlowCorrectionTermsForNUAHistName = "fIntFlowCorrectionTermsForNUAHist";
2209   intFlowCorrectionTermsForNUAHistName += fAnalysisLabel->Data();
2210   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);
2211   fIntFlowCorrectionTermsForNUAHist[sc]->SetTickLength(-0.01,"Y");
2212   fIntFlowCorrectionTermsForNUAHist[sc]->SetMarkerStyle(25);
2213   fIntFlowCorrectionTermsForNUAHist[sc]->SetLabelSize(0.05);
2214   fIntFlowCorrectionTermsForNUAHist[sc]->SetLabelOffset(0.01,"Y");
2215   (fIntFlowCorrectionTermsForNUAHist[sc]->GetXaxis())->SetBinLabel(1,Form("#LT#LT%s(n(#phi_{1}))#GT#GT",sinCosFlag[sc].Data()));
2216   (fIntFlowCorrectionTermsForNUAHist[sc]->GetXaxis())->SetBinLabel(2,Form("#LT#LT%s(n(#phi_{1}+#phi_{2}))#GT#GT",sinCosFlag[sc].Data()));  
2217   (fIntFlowCorrectionTermsForNUAHist[sc]->GetXaxis())->SetBinLabel(3,Form("#LT#LT%s(n(#phi_{1}-#phi_{2}-#phi_{3}))#GT#GT",sinCosFlag[sc].Data()));  
2218   (fIntFlowCorrectionTermsForNUAHist[sc]->GetXaxis())->SetBinLabel(4,Form("#LT#LT%s(n(2#phi_{1}-#phi_{2}))#GT#GT",sinCosFlag[sc].Data()));   
2219   fIntFlowResults->Add(fIntFlowCorrectionTermsForNUAHist[sc]);
2220  } // end of for(Int_t sc=0;sc<2;sc++) 
2221  // covariances (multiplied with weight dependent prefactor):
2222  TString intFlowCovariancesName = "fIntFlowCovariances";
2223  intFlowCovariancesName += fAnalysisLabel->Data();
2224  fIntFlowCovariances = new TH1D(intFlowCovariancesName.Data(),"Covariances (multiplied with weight dependent prefactor)",6,0,6);
2225  fIntFlowCovariances->SetLabelSize(0.04);
2226  fIntFlowCovariances->SetMarkerStyle(25);
2227  (fIntFlowCovariances->GetXaxis())->SetBinLabel(1,"Cov(#LT2#GT,#LT4#GT)");
2228  (fIntFlowCovariances->GetXaxis())->SetBinLabel(2,"Cov(#LT2#GT,#LT6#GT)");
2229  (fIntFlowCovariances->GetXaxis())->SetBinLabel(3,"Cov(#LT2#GT,#LT8#GT)");
2230  (fIntFlowCovariances->GetXaxis())->SetBinLabel(4,"Cov(#LT4#GT,#LT6#GT)");
2231  (fIntFlowCovariances->GetXaxis())->SetBinLabel(5,"Cov(#LT4#GT,#LT8#GT)");
2232  (fIntFlowCovariances->GetXaxis())->SetBinLabel(6,"Cov(#LT6#GT,#LT8#GT)");  
2233  fIntFlowResults->Add(fIntFlowCovariances);
2234  // sum of linear and quadratic event weights for <2>, <4>, <6> and <8>:
2235  TString intFlowSumOfEventWeightsName = "fIntFlowSumOfEventWeights";
2236  intFlowSumOfEventWeightsName += fAnalysisLabel->Data();
2237  for(Int_t power=0;power<2;power++)
2238  {
2239   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);
2240   fIntFlowSumOfEventWeights[power]->SetLabelSize(0.04);
2241   fIntFlowSumOfEventWeights[power]->SetMarkerStyle(25);
2242   if(power == 0)
2243   {
2244    (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{#LT2#GT}");
2245    (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{#LT4#GT}");
2246    (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{#LT6#GT}");
2247    (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{#LT8#GT}");
2248   } else if (power == 1) 
2249     {
2250      (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{#LT2#GT}^{2}");
2251      (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{#LT4#GT}^{2}");
2252      (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{#LT6#GT}^{2}");
2253      (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{#LT8#GT}^{2}");
2254     }
2255   fIntFlowResults->Add(fIntFlowSumOfEventWeights[power]);
2256  } 
2257  // sum of products of event weights for correlations <2>, <4>, <6> and <8>:  
2258  TString intFlowSumOfProductOfEventWeightsName = "fIntFlowSumOfProductOfEventWeights";
2259  intFlowSumOfProductOfEventWeightsName += fAnalysisLabel->Data();
2260  fIntFlowSumOfProductOfEventWeights = new TH1D(intFlowSumOfProductOfEventWeightsName.Data(),"Sum of product of event weights for correlations",6,0,6);
2261  fIntFlowSumOfProductOfEventWeights->SetLabelSize(0.04);
2262  fIntFlowSumOfProductOfEventWeights->SetMarkerStyle(25);
2263  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LT4#GT}");
2264  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LT6#GT}");
2265  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LT8#GT}");
2266  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LT6#GT}");
2267  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(5,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LT8#GT}");
2268  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(6,"#sum_{i=1}^{N} w_{#LT6#GT} w_{#LT8#GT}");
2269  fIntFlowResults->Add(fIntFlowSumOfProductOfEventWeights);
2270  // final result for covariances of correlations (multiplied with weight dependent prefactor) versus M
2271  // [0=Cov(2,4),1=Cov(2,6),2=Cov(2,8),3=Cov(4,6),4=Cov(4,8),5=Cov(6,8)]:
2272  if(fCalculateCumulantsVsM)
2273  {
2274   TString intFlowCovariancesVsMName = "fIntFlowCovariancesVsM";
2275   intFlowCovariancesVsMName += fAnalysisLabel->Data();
2276   TString covarianceFlag[6] = {"Cov(<2>,<4>)","Cov(<2>,<6>)","Cov(<2>,<8>)","Cov(<4>,<6>)","Cov(<4>,<8>)","Cov(<6>,<8>)"};
2277   for(Int_t ci=0;ci<6;ci++)
2278   {
2279    fIntFlowCovariancesVsM[ci] = new TH1D(Form("%s, %s",intFlowCovariancesVsMName.Data(),covarianceFlag[ci].Data()),
2280                                          Form("%s vs multiplicity",covarianceFlag[ci].Data()),
2281                                          fnBinsMult,fMinMult,fMaxMult);
2282    fIntFlowCovariancesVsM[ci]->GetYaxis()->SetTitle(covarianceFlag[ci].Data());
2283    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2284    {
2285     fIntFlowCovariancesVsM[ci]->GetXaxis()->SetTitle("# RPs");
2286    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2287      {
2288       fIntFlowCovariancesVsM[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2289      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2290        {
2291         fIntFlowCovariancesVsM[ci]->GetXaxis()->SetTitle("# POIs");
2292        }
2293    fIntFlowResults->Add(fIntFlowCovariancesVsM[ci]);
2294   }
2295  } // end of if(fCalculateCumulantsVsM) 
2296  // sum of linear and quadratic event weights for <2>, <4>, <6> and <8> versus multiplicity
2297  // [0=sum{w_{<2>}},1=sum{w_{<4>}},2=sum{w_{<6>}},3=sum{w_{<8>}}][0=linear 1,1=quadratic]:
2298  if(fCalculateCumulantsVsM)
2299  {
2300   TString intFlowSumOfEventWeightsVsMName = "fIntFlowSumOfEventWeightsVsM";
2301   intFlowSumOfEventWeightsVsMName += fAnalysisLabel->Data();
2302   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>}"},
2303                            {"#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}"}};
2304   for(Int_t si=0;si<4;si++)
2305   {
2306    for(Int_t power=0;power<2;power++)
2307    {
2308     fIntFlowSumOfEventWeightsVsM[si][power] = new TH1D(Form("%s, %s",intFlowSumOfEventWeightsVsMName.Data(),sumFlag[power][si].Data()),
2309                                                        Form("%s vs multiplicity",sumFlag[power][si].Data()),
2310                                                        fnBinsMult,fMinMult,fMaxMult);    
2311     fIntFlowSumOfEventWeightsVsM[si][power]->GetYaxis()->SetTitle(sumFlag[power][si].Data());  
2312     if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2313     {
2314      fIntFlowSumOfEventWeightsVsM[si][power]->GetXaxis()->SetTitle("# RPs");
2315     } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2316       {
2317        fIntFlowSumOfEventWeightsVsM[si][power]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2318       } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2319         {
2320          fIntFlowSumOfEventWeightsVsM[si][power]->GetXaxis()->SetTitle("# POIs");
2321         }
2322     fIntFlowResults->Add(fIntFlowSumOfEventWeightsVsM[si][power]);
2323    } // end of for(Int_t power=0;power<2;power++)
2324   } // end of for(Int_t si=0;si<4;si++)   
2325  } // end of if(fCalculateCumulantsVsM)
2326  // sum of products of event weights for correlations <2>, <4>, <6> and <8> vs M
2327  // [0=sum{w_{<2>}w_{<4>}},1=sum{w_{<2>}w_{<6>}},2=sum{w_{<2>}w_{<8>}},
2328  //  3=sum{w_{<4>}w_{<6>}},4=sum{w_{<4>}w_{<8>}},5=sum{w_{<6>}w_{<8>}}]:  
2329  if(fCalculateCumulantsVsM)
2330  {
2331   TString intFlowSumOfProductOfEventWeightsVsMName = "fIntFlowSumOfProductOfEventWeightsVsM";
2332   intFlowSumOfProductOfEventWeightsVsMName += fAnalysisLabel->Data();
2333   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>}",
2334                           "#sum_{i=1}^{N} w_{<4>} w_{<6>}","#sum_{i=1}^{N} w_{<4>} w_{<8>}","#sum_{i=1}^{N} w_{<6>} w_{<8>}"}; 
2335   for(Int_t pi=0;pi<6;pi++)
2336   {
2337    fIntFlowSumOfProductOfEventWeightsVsM[pi] = new TH1D(Form("%s, %s",intFlowSumOfProductOfEventWeightsVsMName.Data(),sopowFlag[pi].Data()),
2338                                                         Form("%s versus multiplicity",sopowFlag[pi].Data()),
2339                                                         fnBinsMult,fMinMult,fMaxMult); 
2340    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2341    {
2342     fIntFlowSumOfProductOfEventWeightsVsM[pi]->GetXaxis()->SetTitle("# RPs"); 
2343    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2344      {
2345       fIntFlowSumOfProductOfEventWeightsVsM[pi]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2346      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2347        {
2348         fIntFlowSumOfProductOfEventWeightsVsM[pi]->GetXaxis()->SetTitle("# POIs");
2349        }
2350    fIntFlowSumOfProductOfEventWeightsVsM[pi]->GetYaxis()->SetTitle(sopowFlag[pi].Data()); 
2351    fIntFlowResults->Add(fIntFlowSumOfProductOfEventWeightsVsM[pi]);
2352   } // end of for(Int_t pi=0;pi<6;pi++) 
2353  } // end of if(fCalculateCumulantsVsM)
2354  // covariances of NUA terms (multiplied with weight dependent prefactor):
2355  TString intFlowCovariancesNUAName = "fIntFlowCovariancesNUA";
2356  intFlowCovariancesNUAName += fAnalysisLabel->Data();
2357  fIntFlowCovariancesNUA = new TH1D(intFlowCovariancesNUAName.Data(),"Covariances for NUA (multiplied with weight dependent prefactor)",27,0,27);
2358  fIntFlowCovariancesNUA->SetLabelSize(0.04);
2359  fIntFlowCovariancesNUA->SetMarkerStyle(25);
2360  fIntFlowCovariancesNUA->GetXaxis()->SetLabelSize(0.02);
2361  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(1,"Cov(<2>,<cos(#phi)>");
2362  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(2,"Cov(<2>,<sin(#phi)>)");
2363  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(3,"Cov(<cos(#phi)>,<sin(#phi)>)");
2364  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(4,"Cov(<2>,<cos(#phi_{1}+#phi_{2})>)");
2365  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(5,"Cov(<2>,<sin(#phi_{1}+#phi_{2})>)");
2366  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(6,"Cov(<2>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2367  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(7,"Cov(<2>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2368  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(8,"Cov(<4>,<cos(#phi)>)");
2369  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(9,"Cov(<4>,<sin(#phi)>)");
2370  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(10,"Cov(<4>,<cos(#phi_{1}+#phi_{2})>)");
2371  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(11,"Cov(<4>,<sin(#phi_{1}+#phi_{2})>)");
2372  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(12,"Cov(<4>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>>)");
2373  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(13,"Cov(<4>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>>)");
2374  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(14,"Cov(<cos(#phi)>,<cos(#phi_{1}+#phi_{2})>)"); 
2375  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(15,"Cov(<cos(#phi)>,<sin(#phi_{1}+#phi_{2})>)");
2376  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(16,"Cov(<cos(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2377  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(17,"Cov(<cos(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2378  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(18,"Cov(<sin(#phi)>,<cos(#phi_{1}+#phi_{2})>)");
2379  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(19,"Cov(<sin(#phi)>,<sin(#phi_{1}+#phi_{2})>)");
2380  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(20,"Cov(<sin(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2381  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(21,"Cov(<sin(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2382  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(22,"Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}+#phi_{2})>)");
2383  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(23,"Cov(<cos(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2384  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(24,"Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2385  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(25,"Cov(<sin(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2386  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(26,"Cov(<sin(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2387  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(27,"Cov(<cos(#phi_{1}-#phi_{2}-#phi_{3}>,<sin(#phi_{1}-#phi_{2}-#phi_{3}>)");
2388  fIntFlowResults->Add(fIntFlowCovariancesNUA);
2389  // sum of linear and quadratic event weights for NUA terms:
2390  TString intFlowSumOfEventWeightsNUAName = "fIntFlowSumOfEventWeightsNUA";
2391  intFlowSumOfEventWeightsNUAName += fAnalysisLabel->Data();
2392  for(Int_t sc=0;sc<2;sc++)
2393  {
2394   for(Int_t power=0;power<2;power++)
2395   {
2396    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
2397    fIntFlowSumOfEventWeightsNUA[sc][power]->SetLabelSize(0.05);
2398    fIntFlowSumOfEventWeightsNUA[sc][power]->SetMarkerStyle(25);
2399    if(power == 0)
2400    {
2401     (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(1,Form("#sum_{i=1}^{N} w_{<%s(#phi)>}",sinCosFlag[sc].Data()));
2402     (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(2,Form("#sum_{i=1}^{N} w_{<%s(#phi_{1}+#phi_{2})>}",sinCosFlag[sc].Data()));
2403     (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(3,Form("#sum_{i=1}^{N} w_{<%s(#phi_{1}-#phi_{2}-#phi_{3})>}",sinCosFlag[sc].Data()));   
2404     (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(4,Form("#sum_{i=1}^{N} w_{<%s(2#phi_{1}-#phi_{2})>}",sinCosFlag[sc].Data()));
2405    } else if(power == 1) 
2406      {
2407       (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(1,Form("#sum_{i=1}^{N} w_{<%s(#phi)>}^{2}",sinCosFlag[sc].Data()));
2408       (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(2,Form("#sum_{i=1}^{N} w_{<%s(#phi_{1}+#phi_{2})>}^{2}",sinCosFlag[sc].Data()));
2409       (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(3,Form("#sum_{i=1}^{N} w_{<%s(#phi_{1}-#phi_{2}-#phi_{3})>}^{2}",sinCosFlag[sc].Data()));
2410       (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(4,Form("#sum_{i=1}^{N} w_{<%s(2#phi_{1}-#phi_{2})>}^{2}",sinCosFlag[sc].Data()));
2411      }
2412    fIntFlowResults->Add(fIntFlowSumOfEventWeightsNUA[sc][power]);
2413   }
2414  }  
2415  // sum of products of event weights for NUA terms:  
2416  TString intFlowSumOfProductOfEventWeightsNUAName = "fIntFlowSumOfProductOfEventWeightsNUA";
2417  intFlowSumOfProductOfEventWeightsNUAName += fAnalysisLabel->Data();
2418  fIntFlowSumOfProductOfEventWeightsNUA = new TH1D(intFlowSumOfProductOfEventWeightsNUAName.Data(),"Sum of product of event weights for NUA terms",27,0,27);
2419  fIntFlowSumOfProductOfEventWeightsNUA->SetLabelSize(0.02);
2420  fIntFlowSumOfProductOfEventWeightsNUA->SetMarkerStyle(25);
2421  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTcos(#phi)#GT}");
2422  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTsin(#phi)#GT}");
2423  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTsin(#phi)#GT}");
2424  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTcos(#phi_{1}+#phi_{2})#GT}");
2425  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(5,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2426  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(6,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2427  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(7,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2428  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(8,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTcos(#phi)#GT}");
2429  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(9,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTsin(#phi)#GT}");
2430  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(10,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTcos(#phi_{1}+#phi_{2})#GT}");
2431  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(11,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2432  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(12,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2433  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(13,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2434  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(14,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTcos(#phi_{1}+#phi_{2})#GT}");
2435  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(15,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2436  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(16,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2437  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(17,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2438  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(18,"#sum_{i=1}^{N} w_{#LTsin(#phi)#GT} w_{#LTcos(#phi_{1}+#phi_{2})#GT}");
2439  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(19,"#sum_{i=1}^{N} w_{#LTsin(#phi)#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2440  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(20,"#sum_{i=1}^{N} w_{#LTsin(#phi)#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2441  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(21,"#sum_{i=1}^{N} w_{#LTsin(#phi)#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2442  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(22,"#sum_{i=1}^{N} w_{#LTcos(#phi_{1}+#phi_{2})#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2443  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(23,"#sum_{i=1}^{N} w_{#LTcos(#phi_{1}+#phi_{2})#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2444  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(24,"#sum_{i=1}^{N} w_{#LTcos(#phi_{1}+#phi_{2})#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2445  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(25,"#sum_{i=1}^{N} w_{#LTsin(#phi_{1}+#phi_{2})#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2446  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(26,"#sum_{i=1}^{N} w_{#LTsin(#phi_{1}+#phi_{2})#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2447  (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}");
2448  fIntFlowResults->Add(fIntFlowSumOfProductOfEventWeightsNUA);
2449  // Final results for reference Q-cumulants:
2450  TString cumulantFlag[4] = {"QC{2}","QC{4}","QC{6}","QC{8}"};
2451  TString intFlowQcumulantsName = "fIntFlowQcumulants";
2452  intFlowQcumulantsName += fAnalysisLabel->Data();
2453  fIntFlowQcumulants = new TH1D(intFlowQcumulantsName.Data(),"Reference Q-cumulants",4,0,4);
2454  if(fPropagateErrorAlsoFromNIT)
2455  {
2456   fIntFlowQcumulants->SetTitle("Reference Q-cumulants (error from non-isotropic terms also propagated)");
2457  }
2458  fIntFlowQcumulants->SetLabelSize(0.05);
2459  fIntFlowQcumulants->SetMarkerStyle(25);
2460  for(Int_t b=0;b<4;b++)
2461  {
2462   (fIntFlowQcumulants->GetXaxis())->SetBinLabel(b+1,cumulantFlag[b].Data());
2463  } 
2464  fIntFlowResults->Add(fIntFlowQcumulants);
2465  // Final results for reference Q-cumulants rebinned in M: 
2466  if(fCalculateCumulantsVsM)
2467  {
2468   TString intFlowQcumulantsRebinnedInMName = "fIntFlowQcumulantsRebinnedInM";
2469   intFlowQcumulantsRebinnedInMName += fAnalysisLabel->Data();
2470   fIntFlowQcumulantsRebinnedInM = new TH1D(intFlowQcumulantsRebinnedInMName.Data(),"Reference Q-cumulants rebinned in M",4,0,4);
2471   fIntFlowQcumulantsRebinnedInM->SetLabelSize(0.05);
2472   fIntFlowQcumulantsRebinnedInM->SetMarkerStyle(25);
2473   for(Int_t b=0;b<4;b++)
2474   {
2475    (fIntFlowQcumulantsRebinnedInM->GetXaxis())->SetBinLabel(b+1,cumulantFlag[b].Data());
2476   } 
2477   fIntFlowResults->Add(fIntFlowQcumulantsRebinnedInM);
2478  } // end of if(fCalculateCumulantsVsM) 
2479  // Ratio between error squared: with/without non-isotropic terms:
2480  TString intFlowQcumulantsErrorSquaredRatioName = "fIntFlowQcumulantsErrorSquaredRatio";
2481  intFlowQcumulantsErrorSquaredRatioName += fAnalysisLabel->Data();
2482  fIntFlowQcumulantsErrorSquaredRatio = new TH1D(intFlowQcumulantsErrorSquaredRatioName.Data(),"Error squared of reference Q-cumulants: #frac{with NUA terms}{without NUA terms}",4,0,4);
2483  fIntFlowQcumulantsErrorSquaredRatio->SetLabelSize(0.05);
2484  fIntFlowQcumulantsErrorSquaredRatio->SetMarkerStyle(25);
2485  for(Int_t b=0;b<4;b++)
2486  {
2487   (fIntFlowQcumulantsErrorSquaredRatio->GetXaxis())->SetBinLabel(b+1,cumulantFlag[b].Data());
2488  } 
2489  fIntFlowResults->Add(fIntFlowQcumulantsErrorSquaredRatio);
2490  // final results for integrated Q-cumulants versus multiplicity:
2491  if(fCalculateCumulantsVsM)
2492  {
2493   TString intFlowQcumulantsVsMName = "fIntFlowQcumulantsVsM";
2494   intFlowQcumulantsVsMName += fAnalysisLabel->Data();
2495   for(Int_t co=0;co<4;co++) // cumulant order
2496   {
2497    fIntFlowQcumulantsVsM[co] = new TH1D(Form("%s, %s",intFlowQcumulantsVsMName.Data(),cumulantFlag[co].Data()),
2498                                         Form("%s vs multiplicity",cumulantFlag[co].Data()),
2499                                         fnBinsMult,fMinMult,fMaxMult);
2500    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2501    {
2502     fIntFlowQcumulantsVsM[co]->GetXaxis()->SetTitle("# RPs");
2503    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2504      {
2505       fIntFlowQcumulantsVsM[co]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2506      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2507        {
2508         fIntFlowQcumulantsVsM[co]->GetXaxis()->SetTitle("# POIs");
2509        }
2510    fIntFlowQcumulantsVsM[co]->GetYaxis()->SetTitle(cumulantFlag[co].Data());  
2511    fIntFlowResults->Add(fIntFlowQcumulantsVsM[co]);                                    
2512   } // end of for(Int_t co=0;co<4;co++) // cumulant order
2513  } // end of if(fCalculateCumulantsVsM)
2514  // final integrated flow estimates from Q-cumulants:
2515  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)};
2516  TString intFlowName = "fIntFlow";
2517  intFlowName += fAnalysisLabel->Data();  
2518  // integrated flow from Q-cumulants:
2519  fIntFlow = new TH1D(intFlowName.Data(),"Reference flow estimates from Q-cumulants",4,0,4);
2520  fIntFlow->SetLabelSize(0.05);
2521  fIntFlow->SetMarkerStyle(25);
2522  for(Int_t b=0;b<4;b++)
2523  {
2524   (fIntFlow->GetXaxis())->SetBinLabel(b+1,flowFlag[b].Data()); 
2525  }
2526  fIntFlowResults->Add(fIntFlow); 
2527  // Reference flow vs M rebinned in one huge bin:
2528  if(fCalculateCumulantsVsM)
2529  { 
2530   TString intFlowRebinnedInMName = "fIntFlowRebinnedInM";
2531   intFlowRebinnedInMName += fAnalysisLabel->Data();  
2532   fIntFlowRebinnedInM = new TH1D(intFlowRebinnedInMName.Data(),"Reference flow estimates from Q-cumulants (rebinned in M)",4,0,4);
2533   fIntFlowRebinnedInM->SetLabelSize(0.05);
2534   fIntFlowRebinnedInM->SetMarkerStyle(25);
2535   for(Int_t b=0;b<4;b++)
2536   {
2537    (fIntFlowRebinnedInM->GetXaxis())->SetBinLabel(b+1,flowFlag[b].Data()); 
2538   }
2539   fIntFlowResults->Add(fIntFlowRebinnedInM); 
2540  } 
2541  // integrated flow from Q-cumulants: versus multiplicity:
2542  if(fCalculateCumulantsVsM)
2543  {
2544   TString intFlowVsMName = "fIntFlowVsM";
2545   intFlowVsMName += fAnalysisLabel->Data();
2546   for(Int_t co=0;co<4;co++) // cumulant order
2547   {
2548    fIntFlowVsM[co] = new TH1D(Form("%s, %s",intFlowVsMName.Data(),flowFlag[co].Data()),
2549                               Form("%s vs multiplicity",flowFlag[co].Data()),
2550                               fnBinsMult,fMinMult,fMaxMult);
2551    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2552    {
2553     fIntFlowVsM[co]->GetXaxis()->SetTitle("# RPs");
2554    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2555      {
2556       fIntFlowVsM[co]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2557      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2558        {
2559         fIntFlowVsM[co]->GetXaxis()->SetTitle("# POIs"); 
2560        }
2561    fIntFlowVsM[co]->GetYaxis()->SetTitle(flowFlag[co].Data());  
2562    fIntFlowResults->Add(fIntFlowVsM[co]);                                    
2563   } // end of for(Int_t co=0;co<4;co++) // cumulant order
2564  } // end of if(fCalculateCumulantsVsM)
2565  // quantifying detector effects effects to correlations:
2566  TString intFlowDetectorBiasName = "fIntFlowDetectorBias";
2567  intFlowDetectorBiasName += fAnalysisLabel->Data();  
2568  fIntFlowDetectorBias = new TH1D(intFlowDetectorBiasName.Data(),"Quantifying detector bias",4,0,4);
2569  fIntFlowDetectorBias->SetLabelSize(0.05);
2570  fIntFlowDetectorBias->SetMarkerStyle(25);
2571  for(Int_t ci=0;ci<4;ci++)
2572  {  
2573   (fIntFlowDetectorBias->GetXaxis())->SetBinLabel(ci+1,Form("#frac{corrected}{measured} %s",cumulantFlag[ci].Data()));
2574  }
2575  fIntFlowResults->Add(fIntFlowDetectorBias); 
2576  // quantifying detector effects to correlations versus multiplicity:
2577  if(fCalculateCumulantsVsM)
2578  {
2579   TString intFlowDetectorBiasVsMName = "fIntFlowDetectorBiasVsM";
2580   intFlowDetectorBiasVsMName += fAnalysisLabel->Data();
2581   for(Int_t ci=0;ci<4;ci++) // correlation index
2582   {
2583    fIntFlowDetectorBiasVsM[ci] = new TH1D(Form("%s for %s",intFlowDetectorBiasVsMName.Data(),cumulantFlag[ci].Data()),
2584                                           Form("Quantifying detector bias for %s vs multiplicity",cumulantFlag[ci].Data()),
2585                                           fnBinsMult,fMinMult,fMaxMult);
2586    if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2587    {
2588     fIntFlowDetectorBiasVsM[ci]->GetXaxis()->SetTitle("# RPs"); 
2589    } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2590      {
2591       fIntFlowDetectorBiasVsM[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");
2592      } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2593        {
2594         fIntFlowDetectorBiasVsM[ci]->GetXaxis()->SetTitle("# POIs");
2595        }
2596    fIntFlowDetectorBiasVsM[ci]->GetYaxis()->SetTitle("#frac{corrected}{measured}");  
2597    fIntFlowResults->Add(fIntFlowDetectorBiasVsM[ci]);                                    
2598   } // end of for(Int_t co=0;co<4;co++) // cumulant order
2599  } // end of if(fCalculateCumulantsVsM)
2600    
2601 } // end of AliFlowAnalysisWithQCumulants::BookEverythingForIntegratedFlow()
2602
2603 //=======================================================================================================================
2604
2605 void AliFlowAnalysisWithQCumulants::BookEverythingForControlHistograms()
2606 {
2607  // Book all objects for control histograms.
2608
2609  // a) Book profile to hold all flags for control histograms;
2610  // b) Book all control histograms.
2611
2612  // a) Book profile to hold all flags for control histograms:
2613  TString controlHistogramsFlagsName = "fControlHistogramsFlags";
2614  controlHistogramsFlagsName += fAnalysisLabel->Data();
2615  fControlHistogramsFlags = new TProfile(controlHistogramsFlagsName.Data(),"Flags for Control Histograms",2,0,2);
2616  fControlHistogramsFlags->SetTickLength(-0.01,"Y");
2617  fControlHistogramsFlags->SetMarkerStyle(25);
2618  fControlHistogramsFlags->SetLabelSize(0.04);
2619  fControlHistogramsFlags->SetLabelOffset(0.02,"Y");
2620  fControlHistogramsFlags->SetStats(kFALSE);
2621  fControlHistogramsFlags->GetXaxis()->SetBinLabel(1,"fStoreControlHistograms");
2622  fControlHistogramsFlags->GetXaxis()->SetBinLabel(2,"fUseQvectorTerms");
2623  fControlHistogramsList->Add(fControlHistogramsFlags);
2624
2625  if(!fStoreControlHistograms){return;}
2626
2627  // b) Book all control histograms:
2628  //  b1) Correlation between # RPs and ref. mult. determined centrally:
2629  TString sCorrelationNoRPsVsRefMultName = "fCorrelationNoRPsVsRefMult";
2630  sCorrelationNoRPsVsRefMultName += fAnalysisLabel->Data();
2631  fCorrelationNoRPsVsRefMult = new TH2D(sCorrelationNoRPsVsRefMultName.Data(),"# RPs vs. Reference Multiplicity",fnBinsMult,fMinMult,fMaxMult,fnBinsMult,fMinMult,fMaxMult);
2632  fCorrelationNoRPsVsRefMult->SetTickLength(-0.01,"Y");
2633  fCorrelationNoRPsVsRefMult->SetLabelSize(0.04);
2634  fCorrelationNoRPsVsRefMult->SetLabelOffset(0.02,"Y");
2635  fCorrelationNoRPsVsRefMult->SetStats(kTRUE);
2636  fCorrelationNoRPsVsRefMult->GetXaxis()->SetTitle("# RPs");
2637  fCorrelationNoRPsVsRefMult->GetYaxis()->SetTitle("Reference Multiplicity");
2638  fControlHistogramsList->Add(fCorrelationNoRPsVsRefMult);
2639  //  b2) Correlation between # POIs and ref. mult. determined centrally:
2640  TString sCorrelationNoPOIsVsRefMultName = "fCorrelationNoPOIsVsRefMult";
2641  sCorrelationNoPOIsVsRefMultName += fAnalysisLabel->Data();
2642  fCorrelationNoPOIsVsRefMult = new TH2D(sCorrelationNoPOIsVsRefMultName.Data(),"# POIs vs. Reference Multiplicity",fnBinsMult,fMinMult,fMaxMult,fnBinsMult,fMinMult,fMaxMult);
2643  fCorrelationNoPOIsVsRefMult->SetTickLength(-0.01,"Y");
2644  fCorrelationNoPOIsVsRefMult->SetLabelSize(0.04);
2645  fCorrelationNoPOIsVsRefMult->SetLabelOffset(0.02,"Y");
2646  fCorrelationNoPOIsVsRefMult->SetStats(kTRUE);
2647  fCorrelationNoPOIsVsRefMult->GetXaxis()->SetTitle("# POIs");
2648  fCorrelationNoPOIsVsRefMult->GetYaxis()->SetTitle("Reference Multiplicity");
2649  fControlHistogramsList->Add(fCorrelationNoPOIsVsRefMult);
2650  //  b3) Correlation between # RPs and # POIs:
2651  TString sCorrelationNoRPsVsNoPOIsName = "fCorrelationNoRPsVsNoPOIs";
2652  sCorrelationNoRPsVsNoPOIsName += fAnalysisLabel->Data();
2653  fCorrelationNoRPsVsNoPOIs = new TH2D(sCorrelationNoRPsVsNoPOIsName.Data(),"# RPs vs. # POIs",fnBinsMult,fMinMult,fMaxMult,fnBinsMult,fMinMult,fMaxMult);
2654  fCorrelationNoRPsVsNoPOIs->SetTickLength(-0.01,"Y");
2655  fCorrelationNoRPsVsNoPOIs->SetLabelSize(0.04);
2656  fCorrelationNoRPsVsNoPOIs->SetLabelOffset(0.02,"Y");
2657  fCorrelationNoRPsVsNoPOIs->SetStats(kTRUE);
2658  fCorrelationNoRPsVsNoPOIs->GetXaxis()->SetTitle("# RPs");
2659  fCorrelationNoRPsVsNoPOIs->GetYaxis()->SetTitle("# POIs");
2660  fControlHistogramsList->Add(fCorrelationNoRPsVsNoPOIs);
2661  // b4) <2>, <4>, <6> and <8> vs multiplicity (#RPs, #POIs or external):
2662  TString sCorrelation[4] = {"#LT2#GT","#LT4#GT","#LT6#GT","#LT8#GT"};
2663  TString sMultiplicity = "";
2664  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2665  {
2666   sMultiplicity = "# RPs"; 
2667  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2668    {
2669     sMultiplicity = "Reference multiplicity (from ESD)";
2670    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2671      {
2672       sMultiplicity = "# POIs";
2673      }
2674  for(Int_t ci=0;ci<4;ci++)
2675  {
2676   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]); 
2677   fCorrelation2468VsMult[ci]->SetTickLength(-0.01,"Y");
2678   fCorrelation2468VsMult[ci]->SetLabelSize(0.04);
2679   fCorrelation2468VsMult[ci]->SetLabelOffset(0.02,"Y");
2680   fCorrelation2468VsMult[ci]->SetStats(kTRUE);
2681   fCorrelation2468VsMult[ci]->GetXaxis()->SetTitle(sMultiplicity.Data());
2682   fCorrelation2468VsMult[ci]->GetYaxis()->SetTitle(sCorrelation[ci].Data());
2683   fControlHistogramsList->Add(fCorrelation2468VsMult[ci]); 
2684  } // end of for(Int_t ci=0;ci<4;ci++)
2685  // b5) <2><4>, <2><6>, <2><8>, <4><6> etc. vs multiplicity (#RPs, #POIs or external):
2686  TString sCorrelationProduct[1] = {"#LT2#GT#LT4#GT"}; // TBI: add the other ones when needed first time
2687  for(Int_t cpi=0;cpi<1;cpi++) // TBI: hardwired 1
2688  {
2689   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]);
2690   fCorrelationProduct2468VsMult[cpi]->SetTickLength(-0.01,"Y");
2691   fCorrelationProduct2468VsMult[cpi]->SetLabelSize(0.04);
2692   fCorrelationProduct2468VsMult[cpi]->SetLabelOffset(0.02,"Y");
2693   fCorrelationProduct2468VsMult[cpi]->SetStats(kTRUE);
2694   fCorrelationProduct2468VsMult[cpi]->GetXaxis()->SetTitle(sMultiplicity.Data());
2695   fCorrelationProduct2468VsMult[cpi]->GetYaxis()->SetTitle(sCorrelationProduct[cpi].Data());
2696   fControlHistogramsList->Add(fCorrelationProduct2468VsMult[cpi]); 
2697  } // end of for(Int_t cpi=0;cpi<4;cpi++)
2698  // b6) |Qn|^2/M, |Q2n|^2/M, |Qn|^4/(M(2M-1)), Re[Q2nQn^*Qn^*]/M, ... vs multiplicity (#RPs, #POIs or external)
2699  if(fUseQvectorTerms)
2700  {
2701   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
2702   for(Int_t qvti=0;qvti<4;qvti++) // TBI: hardwired 4
2703   {
2704    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]); 
2705    fQvectorTermsVsMult[qvti]->SetTickLength(-0.01,"Y");
2706    fQvectorTermsVsMult[qvti]->SetLabelSize(0.04);
2707    fQvectorTermsVsMult[qvti]->SetLabelOffset(0.02,"Y");
2708    fQvectorTermsVsMult[qvti]->SetStats(kTRUE);
2709    fQvectorTermsVsMult[qvti]->GetXaxis()->SetTitle(sMultiplicity.Data());
2710    fQvectorTermsVsMult[qvti]->GetYaxis()->SetTitle(sQvectorTerms[qvti].Data());
2711    fControlHistogramsList->Add(fQvectorTermsVsMult[qvti]); 
2712   } // end of for(Int_t qvti=0;qvti<4;qvti++)
2713  } // end of if(fUseQvectorTerms)
2714
2715 } // end of void AliFlowAnalysisWithQCumulants::BookEverythingForControlHistograms()
2716
2717 //=======================================================================================================================
2718
2719 void AliFlowAnalysisWithQCumulants::BookEverythingForBootstrap()
2720 {
2721  // Book all objects needed for bootstrap. 
2722
2723  // a) Book profile to hold all flags for bootstrap;
2724  // b) Book local random generator;
2725  // c) Book all bootstrap objects;
2726  // d) Book all bootstrap objects 'vs M'.
2727
2728  // a) Book profile to hold all flags for bootstrap;
2729  TString bootstrapFlagsName = "fBootstrapFlags";
2730  bootstrapFlagsName += fAnalysisLabel->Data();
2731  fBootstrapFlags = new TProfile(bootstrapFlagsName.Data(),"Flags for bootstrap",3,0,3);
2732  fBootstrapFlags->SetTickLength(-0.01,"Y");
2733  fBootstrapFlags->SetMarkerStyle(25);
2734  fBootstrapFlags->SetLabelSize(0.04);
2735  fBootstrapFlags->SetLabelOffset(0.02,"Y");
2736  fBootstrapFlags->SetStats(kFALSE);
2737  fBootstrapFlags->GetXaxis()->SetBinLabel(1,"fUseBootstrap");
2738  fBootstrapFlags->GetXaxis()->SetBinLabel(2,"fUseBootstrapVsM");
2739  fBootstrapFlags->GetXaxis()->SetBinLabel(3,"fnSubsamples");
2740  fBootstrapList->Add(fBootstrapFlags);
2741
2742  // b) Book local random generator:
2743  if(fUseBootstrap||fUseBootstrapVsM)
2744  { 
2745   fRandom = new TRandom3(0); // if uiSeed is 0, the seed is determined uniquely in space and time via TUUID
2746  }
2747
2748  // c) Book all bootstrap objects:
2749  TString correlationFlag[4] = {"#LT#LT2#GT#GT","#LT#LT4#GT#GT","#LT#LT6#GT#GT","#LT#LT8#GT#GT"};
2750  TString cumulantFlag[4] = {"QC{2}","QC{4}","QC{6}","QC{8}"};
2751  if(fUseBootstrap)
2752  {
2753   // ....
2754   TString bootstrapCorrelationsName = "fBootstrapCorrelations";
2755   bootstrapCorrelationsName += fAnalysisLabel->Data();
2756   fBootstrapCorrelations = new TProfile2D(bootstrapCorrelationsName.Data(),"Bootstrap Correlations",4,0.,4.,fnSubsamples,0,fnSubsamples); // x-axis => <2>, <4>, <6>, <8>; y-axis => subsample # 
2757   fBootstrapCorrelations->SetStats(kFALSE);
2758   for(Int_t ci=0;ci<4;ci++) // correlation index
2759   {
2760    fBootstrapCorrelations->GetXaxis()->SetBinLabel(ci+1,correlationFlag[ci].Data());
2761   } // end of for(Int_t ci=0;ci<4;ci++) // correlation index
2762   for(Int_t ss=0;ss<fnSubsamples;ss++)
2763   {
2764    fBootstrapCorrelations->GetYaxis()->SetBinLabel(ss+1,Form("#%d",ss));
2765   } // end of for(Int_t ss=0;ss<fnSubsamples;ss++)
2766   fBootstrapProfilesList->Add(fBootstrapCorrelations);
2767   // ....
2768   TString bootstrapCumulantsName = "fBootstrapCumulants";
2769   bootstrapCumulantsName += fAnalysisLabel->Data();
2770   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 # 
2771   fBootstrapCumulants->SetStats(kFALSE);
2772   for(Int_t co=0;co<4;co++) // cumulant order
2773   {
2774    fBootstrapCumulants->GetXaxis()->SetBinLabel(co+1,cumulantFlag[co].Data());
2775   } // end of for(Int_t co=0;co<4;co++) // cumulant order
2776   for(Int_t ss=0;ss<fnSubsamples;ss++)
2777   {
2778    fBootstrapCumulants->GetYaxis()->SetBinLabel(ss+1,Form("#%d",ss));
2779   } // end of for(Int_t ss=0;ss<fnSubsamples;ss++)
2780   fBootstrapResultsList->Add(fBootstrapCumulants);
2781  } // end of if(fUseBootstrap)
2782
2783  // d) Book all bootstrap objects 'vs M':
2784  TString sMultiplicity = "";
2785  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
2786  {
2787   sMultiplicity = "# RPs"; 
2788  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
2789    {
2790     sMultiplicity = "Reference multiplicity (from ESD)";
2791    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
2792      {
2793       sMultiplicity = "# POIs";
2794      }
2795  if(fUseBootstrapVsM)
2796  {
2797   // ....
2798   TString bootstrapCorrelationsVsMName = "fBootstrapCorrelationsVsM";
2799   bootstrapCorrelationsVsMName += fAnalysisLabel->Data();
2800   for(Int_t ci=0;ci<4;ci++) // correlation index
2801   {
2802    fBootstrapCorrelationsVsM[ci] = new TProfile2D(Form("%s, %s",bootstrapCorrelationsVsMName.Data(),correlationFlag[ci].Data()),
2803                                        Form("Bootstrap Correlations Vs. M, %s",correlationFlag[ci].Data()),
2804                                        fnBinsMult,fMinMult,fMaxMult,fnSubsamples,0,fnSubsamples); // index => <2>, <4>, <6>, <8>; x-axis => multiplicity; y-axis => subsample # 
2805    fBootstrapCorrelationsVsM[ci]->SetStats(kFALSE);
2806    fBootstrapCorrelationsVsM[ci]->GetXaxis()->SetTitle(sMultiplicity.Data());
2807    for(Int_t ss=0;ss<fnSubsamples;ss++)
2808    {
2809     fBootstrapCorrelationsVsM[ci]->GetYaxis()->SetBinLabel(ss+1,Form("#%d",ss));
2810    } // end of for(Int_t ss=0;ss<fnSubsamples;ss++)
2811    fBootstrapProfilesList->Add(fBootstrapCorrelationsVsM[ci]);
2812   } // end of for(Int_t ci=0;ci<4;ci++) // correlation index 
2813   // ....
2814   TString bootstrapCumulantsVsMName = "fBootstrapCumulantsVsM";
2815   bootstrapCumulantsVsMName += fAnalysisLabel->Data();
2816   for(Int_t co=0;co<4;co++) // cumulant order
2817   {
2818    fBootstrapCumulantsVsM[co] = new TH2D(Form("%s, %s",bootstrapCumulantsVsMName.Data(),cumulantFlag[co].Data()),
2819                                        Form("Bootstrap Cumulants Vs. M, %s",cumulantFlag[co].Data()),
2820                                        fnBinsMult,fMinMult,fMaxMult,fnSubsamples,0,fnSubsamples); // index => <2>, <4>, <6>, <8>; x-axis => multiplicity; y-axis => subsample # 
2821    fBootstrapCumulantsVsM[co]->SetStats(kFALSE);
2822    fBootstrapCumulantsVsM[co]->GetXaxis()->SetTitle(sMultiplicity.Data());
2823    for(Int_t ss=0;ss<fnSubsamples;ss++)
2824    {
2825     fBootstrapCumulantsVsM[co]->GetYaxis()->SetBinLabel(ss+1,Form("#%d",ss));
2826    } // end of for(Int_t ss=0;ss<fnSubsamples;ss++)
2827    fBootstrapResultsList->Add(fBootstrapCumulantsVsM[co]);
2828   } // end of for(Int_t co=0;co<4;co++) // correlation index 
2829  } // end of if(fUseBootstrapVsM)
2830
2831 } // end of void AliFlowAnalysisWithQCumulants::BookEverythingForBootstrap()
2832
2833 //=======================================================================================================================
2834
2835 void AliFlowAnalysisWithQCumulants::BookEverythingForMixedHarmonics()
2836 {
2837  // Book all objects for mixed harmonics.
2838
2839  // a) Book profile to hold all flags for mixed harmonics;
2840  // b) Book all objects in TList fMixedHarmonicsProfiles;
2841  // c) Book all objects in TList fMixedHarmonicsResults;
2842  // d) Book all objects in TList fMixedHarmonicsErrorPropagation.
2843
2844  // a) Book profile to hold all flags for mixed harmonics:
2845  TString mixedHarmonicsFlagsName = "fMixedHarmonicsFlags";
2846  mixedHarmonicsFlagsName += fAnalysisLabel->Data();
2847  fMixedHarmonicsFlags = new TProfile(mixedHarmonicsFlagsName.Data(),"Flags for Mixed Harmonics",4,0,4);
2848  fMixedHarmonicsFlags->SetTickLength(-0.01,"Y");
2849  fMixedHarmonicsFlags->SetMarkerStyle(25);
2850  fMixedHarmonicsFlags->SetLabelSize(0.04);
2851  fMixedHarmonicsFlags->SetLabelOffset(0.02,"Y");
2852  fMixedHarmonicsFlags->SetStats(kFALSE);
2853  fMixedHarmonicsFlags->GetXaxis()->SetBinLabel(1,"Calculate Mixed Harmonics");
2854  fMixedHarmonicsFlags->GetXaxis()->SetBinLabel(2,"Generic Harmonic");
2855  fMixedHarmonicsFlags->GetXaxis()->SetBinLabel(3,"Calculate vs Multiplicity");
2856  fMixedHarmonicsFlags->GetXaxis()->SetBinLabel(4,"Multiplicity Weight");
2857  fMixedHarmonicsList->Add(fMixedHarmonicsFlags);
2858
2859  if(!fCalculateMixedHarmonics){return;}
2860
2861  // b) Book all objects in TList fMixedHarmonicsProfiles:
2862  //  b1) 2-p correlations:
2863  TString s2pCorrelationsName = "f2pCorrelations";
2864  s2pCorrelationsName += fAnalysisLabel->Data();
2865  f2pCorrelations = new TProfile(s2pCorrelationsName.Data(),Form("2-particle correlations (n = %d)",fHarmonic),6,0,6,"s");
2866  f2pCorrelations->SetTickLength(-0.01,"Y");
2867  f2pCorrelations->SetMarkerStyle(25);
2868  f2pCorrelations->SetLabelSize(0.04);
2869  f2pCorrelations->SetLabelOffset(0.02,"Y");
2870  f2pCorrelations->SetStats(kFALSE);
2871  f2pCorrelations->Sumw2();
2872  f2pCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT2#GT#GT_{%dn|%dn}",1*fHarmonic,1*fHarmonic));
2873  f2pCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT2#GT#GT_{%dn|%dn}",2*fHarmonic,2*fHarmonic));
2874  f2pCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT2#GT#GT_{%dn|%dn}",3*fHarmonic,3*fHarmonic));
2875  f2pCorrelations->GetXaxis()->SetBinLabel(4,Form("#LT#LT2#GT#GT_{%dn|%dn}",4*fHarmonic,4*fHarmonic));
2876  f2pCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT2#GT#GT_{%dn|%dn}",5*fHarmonic,5*fHarmonic));
2877  f2pCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT2#GT#GT_{%dn|%dn}",6*fHarmonic,6*fHarmonic));
2878  fMixedHarmonicsProfiles->Add(f2pCorrelations);
2879  //  b2) 3-p correlations (3+6):
2880  TString s3pCorrelationsName = "f3pCorrelations";
2881  s3pCorrelationsName += fAnalysisLabel->Data();
2882  f3pCorrelations = new TProfile(s3pCorrelationsName.Data(),Form("3-particle correlations (n = %d)",fHarmonic),10,0,10,"s"); 
2883  f3pCorrelations->SetTickLength(-0.01,"Y");
2884  f3pCorrelations->SetMarkerStyle(25);
2885  f3pCorrelations->SetLabelSize(0.04);
2886  f3pCorrelations->SetLabelOffset(0.02,"Y");
2887  f3pCorrelations->SetStats(kFALSE);
2888  f3pCorrelations->Sumw2();
2889  // 3-p correlations sensitive to two distinct harmonics (3):
2890  f3pCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic));
2891  f3pCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic));
2892  f3pCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic));
2893  f3pCorrelations->GetXaxis()->SetBinLabel(4,""); // empty
2894  // 3-p correlations sensitive to three distinct harmonics (6):
2895  f3pCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,1*fHarmonic));
2896  f3pCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,1*fHarmonic));
2897  f3pCorrelations->GetXaxis()->SetBinLabel(7,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,2*fHarmonic));
2898  f3pCorrelations->GetXaxis()->SetBinLabel(8,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,1*fHarmonic));
2899  f3pCorrelations->GetXaxis()->SetBinLabel(9,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,2*fHarmonic));
2900  f3pCorrelations->GetXaxis()->SetBinLabel(10,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,1*fHarmonic));
2901  fMixedHarmonicsProfiles->Add(f3pCorrelations);
2902  //  b3) 4-p correlations (6+15+2+10+8):
2903  TString s4pCorrelationsName = "f4pCorrelations";
2904  s4pCorrelationsName += fAnalysisLabel->Data();
2905  f4pCorrelations = new TProfile(s4pCorrelationsName.Data(),Form("4-particle correlations (n = %d)",fHarmonic),45,0,45,"s");
2906  f4pCorrelations->SetTickLength(-0.01,"Y");
2907  f4pCorrelations->SetMarkerStyle(25);
2908  f4pCorrelations->SetLabelSize(0.03);
2909  f4pCorrelations->SetLabelOffset(0.02,"Y");
2910  f4pCorrelations->SetStats(kFALSE);
2911  f4pCorrelations->Sumw2();
2912  // "same harmonic" (6):
2913  f4pCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2914  f4pCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2915  f4pCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
2916  f4pCorrelations->GetXaxis()->SetBinLabel(4,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
2917  f4pCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic));
2918  f4pCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,6*fHarmonic));
2919  f4pCorrelations->GetXaxis()->SetBinLabel(7,""); // empty
2920  // "standard candles" (15):
2921  f4pCorrelations->GetXaxis()->SetBinLabel(8,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic));
2922  f4pCorrelations->GetXaxis()->SetBinLabel(9,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic));
2923  f4pCorrelations->GetXaxis()->SetBinLabel(10,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic));
2924  f4pCorrelations->GetXaxis()->SetBinLabel(11,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic));
2925  f4pCorrelations->GetXaxis()->SetBinLabel(12,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic));
2926  f4pCorrelations->GetXaxis()->SetBinLabel(13,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic));
2927  f4pCorrelations->GetXaxis()->SetBinLabel(14,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic));
2928  f4pCorrelations->GetXaxis()->SetBinLabel(15,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic));
2929  f4pCorrelations->GetXaxis()->SetBinLabel(16,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic));
2930  f4pCorrelations->GetXaxis()->SetBinLabel(17,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic));
2931  f4pCorrelations->GetXaxis()->SetBinLabel(18,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,6*fHarmonic,1*fHarmonic));
2932  f4pCorrelations->GetXaxis()->SetBinLabel(19,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,2*fHarmonic));
2933  f4pCorrelations->GetXaxis()->SetBinLabel(20,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,3*fHarmonic));
2934  f4pCorrelations->GetXaxis()->SetBinLabel(21,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,4*fHarmonic));
2935  f4pCorrelations->GetXaxis()->SetBinLabel(22,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,5*fHarmonic));
2936  f4pCorrelations->GetXaxis()->SetBinLabel(23,""); // empty
2937  // 4-p correlations sensitive to two distinct harmonics (2):
2938  f4pCorrelations->GetXaxis()->SetBinLabel(24,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2939  f4pCorrelations->GetXaxis()->SetBinLabel(25,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2940  f4pCorrelations->GetXaxis()->SetBinLabel(26,""); // empty
2941  // 4-p correlations sensitive to three distinct harmonics (10):
2942  f4pCorrelations->GetXaxis()->SetBinLabel(27,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic));
2943  f4pCorrelations->GetXaxis()->SetBinLabel(28,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
2944  f4pCorrelations->GetXaxis()->SetBinLabel(29,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic));
2945  f4pCorrelations->GetXaxis()->SetBinLabel(30,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
2946  f4pCorrelations->GetXaxis()->SetBinLabel(31,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
2947  f4pCorrelations->GetXaxis()->SetBinLabel(32,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
2948  f4pCorrelations->GetXaxis()->SetBinLabel(33,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic));
2949  f4pCorrelations->GetXaxis()->SetBinLabel(34,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
2950  f4pCorrelations->GetXaxis()->SetBinLabel(35,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,4*fHarmonic));
2951  f4pCorrelations->GetXaxis()->SetBinLabel(36,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,5*fHarmonic));
2952  f4pCorrelations->GetXaxis()->SetBinLabel(37,""); // empty
2953  // 4-p correlations sensitive to four distinct harmonics (8):
2954  f4pCorrelations->GetXaxis()->SetBinLabel(38,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic));
2955  f4pCorrelations->GetXaxis()->SetBinLabel(39,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic));
2956  f4pCorrelations->GetXaxis()->SetBinLabel(40,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic));
2957  f4pCorrelations->GetXaxis()->SetBinLabel(41,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
2958  f4pCorrelations->GetXaxis()->SetBinLabel(42,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,2*fHarmonic));
2959  f4pCorrelations->GetXaxis()->SetBinLabel(43,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
2960  f4pCorrelations->GetXaxis()->SetBinLabel(44,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,3*fHarmonic));
2961  f4pCorrelations->GetXaxis()->SetBinLabel(45,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,4*fHarmonic));
2962  fMixedHarmonicsProfiles->Add(f4pCorrelations);
2963  //  b3) 5-p correlations (30+9+30+11+3):
2964  TString s5pCorrelationsName = "f5pCorrelations";
2965  s5pCorrelationsName += fAnalysisLabel->Data();
2966  f5pCorrelations = new TProfile(s5pCorrelationsName.Data(),Form("5-particle correlations (n = %d)",fHarmonic),87,0,87,"s");
2967  f5pCorrelations->SetTickLength(-0.01,"Y");
2968  f5pCorrelations->SetMarkerStyle(25);
2969  f5pCorrelations->SetLabelSize(0.02);
2970  f5pCorrelations->SetLabelOffset(0.02,"Y");
2971  f5pCorrelations->SetStats(kFALSE);
2972  f5pCorrelations->Sumw2();
2973  // "standard candles" (30):
2974  f5pCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
2975  f5pCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
2976  f5pCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
2977  f5pCorrelations->GetXaxis()->SetBinLabel(4,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
2978  f5pCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
2979  f5pCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
2980  f5pCorrelations->GetXaxis()->SetBinLabel(7,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
2981  f5pCorrelations->GetXaxis()->SetBinLabel(8,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
2982  f5pCorrelations->GetXaxis()->SetBinLabel(9,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
2983  f5pCorrelations->GetXaxis()->SetBinLabel(10,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
2984  f5pCorrelations->GetXaxis()->SetBinLabel(11,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
2985  f5pCorrelations->GetXaxis()->SetBinLabel(12,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
2986  f5pCorrelations->GetXaxis()->SetBinLabel(13,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
2987  f5pCorrelations->GetXaxis()->SetBinLabel(14,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
2988  f5pCorrelations->GetXaxis()->SetBinLabel(15,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
2989  f5pCorrelations->GetXaxis()->SetBinLabel(16,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
2990  f5pCorrelations->GetXaxis()->SetBinLabel(17,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
2991  f5pCorrelations->GetXaxis()->SetBinLabel(18,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
2992  f5pCorrelations->GetXaxis()->SetBinLabel(19,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
2993  f5pCorrelations->GetXaxis()->SetBinLabel(20,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
2994  f5pCorrelations->GetXaxis()->SetBinLabel(21,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
2995  f5pCorrelations->GetXaxis()->SetBinLabel(22,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
2996  f5pCorrelations->GetXaxis()->SetBinLabel(23,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,3*fHarmonic));
2997  f5pCorrelations->GetXaxis()->SetBinLabel(24,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,1*fHarmonic,1*fHarmonic));
2998  f5pCorrelations->GetXaxis()->SetBinLabel(25,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,2*fHarmonic,1*fHarmonic));
2999  f5pCorrelations->GetXaxis()->SetBinLabel(26,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,2*fHarmonic,2*fHarmonic));
3000  f5pCorrelations->GetXaxis()->SetBinLabel(27,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,3*fHarmonic,1*fHarmonic));
3001  f5pCorrelations->GetXaxis()->SetBinLabel(28,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,2*fHarmonic));
3002  f5pCorrelations->GetXaxis()->SetBinLabel(29,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,3*fHarmonic,2*fHarmonic));
3003  f5pCorrelations->GetXaxis()->SetBinLabel(30,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,4*fHarmonic,1*fHarmonic));
3004  f5pCorrelations->GetXaxis()->SetBinLabel(31,""); // empty
3005  // 5-p correlations sensitive to two distinct harmonics (9):
3006  f5pCorrelations->GetXaxis()->SetBinLabel(32,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3007  f5pCorrelations->GetXaxis()->SetBinLabel(33,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3008  f5pCorrelations->GetXaxis()->SetBinLabel(34,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3009  f5pCorrelations->GetXaxis()->SetBinLabel(35,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3010  f5pCorrelations->GetXaxis()->SetBinLabel(36,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3011  f5pCorrelations->GetXaxis()->SetBinLabel(37,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3012  f5pCorrelations->GetXaxis()->SetBinLabel(38,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3013  f5pCorrelations->GetXaxis()->SetBinLabel(39,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
3014  f5pCorrelations->GetXaxis()->SetBinLabel(40,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,3*fHarmonic,3*fHarmonic));
3015  f5pCorrelations->GetXaxis()->SetBinLabel(41,""); // empty
3016  // 5-p correlations sensitive to three distinct harmonics (30):
3017  f5pCorrelations->GetXaxis()->SetBinLabel(42,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3018  f5pCorrelations->GetXaxis()->SetBinLabel(43,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3019  f5pCorrelations->GetXaxis()->SetBinLabel(44,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3020  f5pCorrelations->GetXaxis()->SetBinLabel(45,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3021  f5pCorrelations->GetXaxis()->SetBinLabel(46,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
3022  f5pCorrelations->GetXaxis()->SetBinLabel(47,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3023  f5pCorrelations->GetXaxis()->SetBinLabel(48,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3024  f5pCorrelations->GetXaxis()->SetBinLabel(49,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3025  f5pCorrelations->GetXaxis()->SetBinLabel(50,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3026  f5pCorrelations->GetXaxis()->SetBinLabel(51,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3027  f5pCorrelations->GetXaxis()->SetBinLabel(52,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3028  f5pCorrelations->GetXaxis()->SetBinLabel(53,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3029  f5pCorrelations->GetXaxis()->SetBinLabel(54,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3030  f5pCorrelations->GetXaxis()->SetBinLabel(55,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3031  f5pCorrelations->GetXaxis()->SetBinLabel(56,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
3032  f5pCorrelations->GetXaxis()->SetBinLabel(57,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
3033  f5pCorrelations->GetXaxis()->SetBinLabel(58,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
3034  f5pCorrelations->GetXaxis()->SetBinLabel(59,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
3035  f5pCorrelations->GetXaxis()->SetBinLabel(60,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
3036  f5pCorrelations->GetXaxis()->SetBinLabel(61,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3037  f5pCorrelations->GetXaxis()->SetBinLabel(62,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3038  f5pCorrelations->GetXaxis()->SetBinLabel(63,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
3039  f5pCorrelations->GetXaxis()->SetBinLabel(64,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
3040  f5pCorrelations->GetXaxis()->SetBinLabel(65,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3041  f5pCorrelations->GetXaxis()->SetBinLabel(66,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
3042  f5pCorrelations->GetXaxis()->SetBinLabel(67,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,5*fHarmonic,5*fHarmonic));
3043  f5pCorrelations->GetXaxis()->SetBinLabel(68,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic,1*fHarmonic));
3044  f5pCorrelations->GetXaxis()->SetBinLabel(69,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,5*fHarmonic,2*fHarmonic));
3045  f5pCorrelations->GetXaxis()->SetBinLabel(70,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,4*fHarmonic,2*fHarmonic));
3046  f5pCorrelations->GetXaxis()->SetBinLabel(71,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,5*fHarmonic,1*fHarmonic));
3047  f5pCorrelations->GetXaxis()->SetBinLabel(72,""); // empty
3048  // 5-p correlations sensitive to four distinct harmonics (11):
3049  f5pCorrelations->GetXaxis()->SetBinLabel(73,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3050  f5pCorrelations->GetXaxis()->SetBinLabel(74,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
3051  f5pCorrelations->GetXaxis()->SetBinLabel(75,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3052  f5pCorrelations->GetXaxis()->SetBinLabel(76,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
3053  f5pCorrelations->GetXaxis()->SetBinLabel(77,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3054  f5pCorrelations->GetXaxis()->SetBinLabel(78,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
3055  f5pCorrelations->GetXaxis()->SetBinLabel(79,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,5*fHarmonic,3*fHarmonic));
3056  f5pCorrelations->GetXaxis()->SetBinLabel(80,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
3057  f5pCorrelations->GetXaxis()->SetBinLabel(81,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic));
3058  f5pCorrelations->GetXaxis()->SetBinLabel(82,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,5*fHarmonic,5*fHarmonic));
3059  f5pCorrelations->GetXaxis()->SetBinLabel(83,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic));
3060  f5pCorrelations->GetXaxis()->SetBinLabel(84,""); // empty
3061  // 5-p correlations sensitive to five distinct harmonics (3):
3062  f5pCorrelations->GetXaxis()->SetBinLabel(85,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3063  f5pCorrelations->GetXaxis()->SetBinLabel(86,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,1*fHarmonic,5*fHarmonic,4*fHarmonic));
3064  f5pCorrelations->GetXaxis()->SetBinLabel(87,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
3065  fMixedHarmonicsProfiles->Add(f5pCorrelations);
3066  //  b4) 6-p correlations (??+??+??+??+??):
3067  TString s6pCorrelationsName = "f6pCorrelations";
3068  s6pCorrelationsName += fAnalysisLabel->Data();
3069  f6pCorrelations = new TProfile(s6pCorrelationsName.Data(),Form("6-particle correlations (n = %d)",fHarmonic),1,0.,1.);
3070  f6pCorrelations->SetTickLength(-0.01,"Y");
3071  f6pCorrelations->SetMarkerStyle(25);
3072  f6pCorrelations->SetLabelSize(0.02);
3073  f6pCorrelations->SetLabelOffset(0.02,"Y");
3074  f6pCorrelations->SetStats(kFALSE);
3075  f6pCorrelations->Sumw2(); 
3076  //fMixedHarmonicsProfiles->Add(f6pCorrelations); // TBI
3077  //  b5) 7-p correlations (??+??+??+??+??):
3078  TString s7pCorrelationsName = "f7pCorrelations";
3079  s7pCorrelationsName += fAnalysisLabel->Data();
3080  f7pCorrelations = new TProfile(s7pCorrelationsName.Data(),Form("7-particle correlations (n = %d)",fHarmonic),1,0.,1.);
3081  f7pCorrelations->SetTickLength(-0.01,"Y");
3082  f7pCorrelations->SetMarkerStyle(25);
3083  f7pCorrelations->SetLabelSize(0.02);
3084  f7pCorrelations->SetLabelOffset(0.02,"Y");
3085  f7pCorrelations->SetStats(kFALSE);
3086  f7pCorrelations->Sumw2(); 
3087  //fMixedHarmonicsProfiles->Add(f7pCorrelations); // TBI
3088  //  b6) 8-p correlations (??+??+??+??+??):
3089  TString s8pCorrelationsName = "f8pCorrelations";
3090  s8pCorrelationsName += fAnalysisLabel->Data();
3091  f8pCorrelations = new TProfile(s8pCorrelationsName.Data(),Form("8-particle correlations (n = %d)",fHarmonic),1,0.,1.);
3092  f8pCorrelations->SetTickLength(-0.01,"Y");
3093  f8pCorrelations->SetMarkerStyle(25);
3094  f8pCorrelations->SetLabelSize(0.02);
3095  f8pCorrelations->SetLabelOffset(0.02,"Y");
3096  f8pCorrelations->SetStats(kFALSE);
3097  f8pCorrelations->Sumw2(); 
3098  //fMixedHarmonicsProfiles->Add(f8pCorrelations); // TBI
3099
3100  // c) Book all objects in TList fMixedHarmonicsResults:
3101  // QC{2}:
3102  f2pCumulants = f2pCorrelations->ProjectionX("f2pCumulants");
3103  f2pCumulants->SetTitle(Form("2-particle cumulants (n = %d)",fHarmonic));
3104  f2pCumulants->SetStats(kFALSE);
3105  f2pCumulants->SetMarkerStyle(kFullSquare);
3106  f2pCumulants->SetMarkerColor(kBlack);
3107  f2pCumulants->SetLineColor(kBlack);
3108  fMixedHarmonicsResults->Add(f2pCumulants);
3109  // QC{3}:
3110  f3pCumulants = f3pCorrelations->ProjectionX("f3pCumulants");
3111  f3pCumulants->SetTitle(Form("3-particle cumulants (n = %d)",fHarmonic));
3112  f3pCumulants->SetStats(kFALSE);
3113  f3pCumulants->SetMarkerStyle(kFullSquare);
3114  f3pCumulants->SetMarkerColor(kGreen+2);
3115  f3pCumulants->SetLineColor(kGreen+2);
3116  fMixedHarmonicsResults->Add(f3pCumulants);
3117  // QC{4}:
3118  f4pCumulants = f4pCorrelations->ProjectionX("f4pCumulants");
3119  f4pCumulants->SetTitle(Form("4-particle cumulants (n = %d)",fHarmonic));
3120  f4pCumulants->SetStats(kFALSE);
3121  f4pCumulants->SetMarkerStyle(kFullSquare);
3122  f4pCumulants->SetMarkerColor(kRed);
3123  f4pCumulants->SetLineColor(kRed);
3124  fMixedHarmonicsResults->Add(f4pCumulants);
3125  // QC{5}:
3126  f5pCumulants = f5pCorrelations->ProjectionX("f5pCumulants");
3127  f5pCumulants->SetTitle(Form("5-particle cumulants (n = %d)",fHarmonic));
3128  f5pCumulants->SetStats(kFALSE);
3129  f5pCumulants->SetMarkerStyle(kFullSquare);
3130  f5pCumulants->SetMarkerColor(kBlue);
3131  f5pCumulants->SetLineColor(kBlue);
3132  fMixedHarmonicsResults->Add(f5pCumulants);
3133
3134  // d) Book all objects in TList fMixedHarmonicsErrorPropagation: 
3135  // Sum of linear and quadratic event weights for mixed harmonics => [0=linear 1,1=quadratic]: 
3136  TString mixedHarmonicEventWeightsName = "fMixedHarmonicEventWeights";
3137  mixedHarmonicEventWeightsName += fAnalysisLabel->Data();
3138  TString powerFlag[2] = {"linear","quadratic"}; 
3139  for(Int_t power=0;power<2;power++)
3140  {
3141   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.);
3142   fMixedHarmonicEventWeights[power]->SetLabelSize(0.04);
3143   fMixedHarmonicEventWeights[power]->SetMarkerStyle(25);
3144   fMixedHarmonicEventWeights[power]->SetStats(kFALSE);
3145   if(power == 0)
3146   {
3147    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum w_{#LT1#GT}");
3148    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum w_{#LT2#GT}");
3149    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum w_{#LT3#GT}");
3150    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum w_{#LT4#GT}");
3151    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(5,"#sum w_{#LT5#GT}");
3152    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(6,"#sum w_{#LT6#GT}");
3153    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(7,"#sum w_{#LT7#GT}");
3154    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(8,"#sum w_{#LT8#GT}");
3155   } else if (power == 1) 
3156     {
3157      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum w_{#LT1#GT}^{2}");
3158      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum w_{#LT2#GT}^{2}");
3159      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum w_{#LT3#GT}^{2}");
3160      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum w_{#LT4#GT}^{2}");
3161      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(5,"#sum w_{#LT5#GT}^{2}");
3162      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(6,"#sum w_{#LT6#GT}^{2}");
3163      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(7,"#sum w_{#LT7#GT}^{2}");
3164      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(8,"#sum w_{#LT8#GT}^{2}");
3165     }
3166   fMixedHarmonicsErrorPropagation->Add(fMixedHarmonicEventWeights[power]);
3167  } // end of for(Int_t power=0;power<2;power++)
3168  
3169  // Sums of products of event weights for mixed harmonics:
3170  TString mixedHarmonicProductOfEventWeightsName = "fMixedHarmonicProductOfEventWeights";
3171  mixedHarmonicProductOfEventWeightsName += fAnalysisLabel->Data();
3172  fMixedHarmonicProductOfEventWeights = new TH2D(mixedHarmonicProductOfEventWeightsName.Data(),"Sums of products of event weights",8,0.,8.,8,0.,8.);
3173  fMixedHarmonicProductOfEventWeights->SetStats(kFALSE);
3174  fMixedHarmonicProductOfEventWeights->GetXaxis()->SetLabelSize(0.05);
3175  fMixedHarmonicProductOfEventWeights->GetYaxis()->SetLabelSize(0.05);
3176  for(Int_t b=1;b<=8;b++)
3177  {
3178   fMixedHarmonicProductOfEventWeights->GetXaxis()->SetBinLabel(b,Form("w_{#LT%i#GT}",b)); 
3179   fMixedHarmonicProductOfEventWeights->GetYaxis()->SetBinLabel(b,Form("w_{#LT%i#GT}",b)); 
3180  } 
3181  fMixedHarmonicsErrorPropagation->Add(fMixedHarmonicProductOfEventWeights);
3182
3183  // Averages of products of mixed harmonics correlations:
3184  TString mixedHarmonicProductOfCorrelationsName = "fMixedHarmonicProductOfCorrelations";
3185  mixedHarmonicProductOfCorrelationsName += fAnalysisLabel->Data();
3186  fMixedHarmonicProductOfCorrelations = new TProfile2D(mixedHarmonicProductOfCorrelationsName.Data(),"Averages of products of mixed correlators",139,0.,139.,139,0.,139.);
3187  fMixedHarmonicProductOfCorrelations->Sumw2();
3188  fMixedHarmonicProductOfCorrelations->SetStats(kFALSE);
3189  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetLabelSize(0.015);
3190  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetLabelSize(0.015);
3191  // x-axis:
3192  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT2#GT#GT_{%dn|%dn}",1*fHarmonic,1*fHarmonic));
3193  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT2#GT#GT_{%dn|%dn}",2*fHarmonic,2*fHarmonic));
3194  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT2#GT#GT_{%dn|%dn}",3*fHarmonic,3*fHarmonic));
3195  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(4,Form("#LT#LT2#GT#GT_{%dn|%dn}",4*fHarmonic,4*fHarmonic));
3196  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT2#GT#GT_{%dn|%dn}",5*fHarmonic,5*fHarmonic));
3197  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT2#GT#GT_{%dn|%dn}",6*fHarmonic,6*fHarmonic));
3198  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(7,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic));
3199  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(8,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic));
3200  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(9,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic));
3201  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(10,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,1*fHarmonic));
3202  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(11,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,1*fHarmonic));
3203  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(12,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,2*fHarmonic));
3204  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(13,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,1*fHarmonic));
3205  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(14,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,2*fHarmonic));
3206  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(15,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,1*fHarmonic));
3207  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(16,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3208  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(17,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3209  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(18,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3210  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(19,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
3211  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(20,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic));
3212  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(21,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,6*fHarmonic));
3213  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(22,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic));
3214  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(23,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic));
3215  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(24,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic));
3216  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(25,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic));
3217  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(26,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic));
3218  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(27,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic));
3219  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(28,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic));
3220  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(29,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic));
3221  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(30,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic));
3222  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(31,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic));
3223  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(32,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,6*fHarmonic,1*fHarmonic));
3224  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(33,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,2*fHarmonic));
3225  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(34,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,3*fHarmonic));
3226  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(35,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,4*fHarmonic));
3227  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(36,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,5*fHarmonic));
3228  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(37,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3229  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(38,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3230  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(39,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic));
3231  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(40,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3232  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(41,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic));
3233  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(42,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3234  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(43,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3235  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(44,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
3236  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(45,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic));
3237  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(46,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3238  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(47,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,4*fHarmonic));
3239  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(48,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,5*fHarmonic));
3240  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(49,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic));
3241  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(50,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic));
3242  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(51,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic));
3243  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(52,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
3244  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(53,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,2*fHarmonic));
3245  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(54,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3246  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(55,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,3*fHarmonic));
3247  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(56,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,4*fHarmonic));
3248  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(57,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3249  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(58,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3250  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(59,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3251  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(60,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3252  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(61,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3253  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(62,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3254  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(63,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3255  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(64,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
3256  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(65,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3257  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(66,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3258  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(67,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
3259  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(68,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
3260  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(69,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
3261  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(70,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
3262  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(71,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3263  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(72,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3264  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(73,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3265  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(74,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
3266  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(75,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
3267  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(76,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
3268  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(77,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
3269  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(78,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
3270  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(79,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,3*fHarmonic));
3271  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(80,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,1*fHarmonic,1*fHarmonic));
3272  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(81,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,2*fHarmonic,1*fHarmonic));
3273  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(82,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,2*fHarmonic,2*fHarmonic));
3274  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(83,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,3*fHarmonic,1*fHarmonic));
3275  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(84,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,2*fHarmonic));
3276  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(85,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,3*fHarmonic,2*fHarmonic));
3277  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(86,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,4*fHarmonic,1*fHarmonic));
3278  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(87,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3279  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(88,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3280  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(89,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3281  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(90,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3282  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(91,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3283  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(92,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3284  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(93,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3285  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(94,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
3286  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(95,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,3*fHarmonic,3*fHarmonic));
3287  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(96,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3288  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(97,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3289  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(98,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3290  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(99,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3291  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(100,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
3292  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(101,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3293  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(102,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3294  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(103,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3295  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(104,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3296  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(105,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3297  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(106,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3298  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(107,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3299  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(108,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3300  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(109,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3301  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(110,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
3302  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(111,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
3303  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(112,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
3304  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(113,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
3305  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(114,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
3306  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(115,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3307  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(116,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3308  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(117,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
3309  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(118,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
3310  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(119,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3311  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(120,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
3312  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(121,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,5*fHarmonic,5*fHarmonic));
3313  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(122,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic,1*fHarmonic));
3314  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(123,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,5*fHarmonic,2*fHarmonic));
3315  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(124,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,4*fHarmonic,2*fHarmonic));
3316  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(125,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,5*fHarmonic,1*fHarmonic));
3317  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(126,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3318  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(127,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
3319  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(128,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3320  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(129,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
3321  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(130,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3322  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(131,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
3323  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(132,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,5*fHarmonic,3*fHarmonic));
3324  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(133,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
3325  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(134,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic));
3326  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(135,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,5*fHarmonic,5*fHarmonic));
3327  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(136,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic));
3328  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(137,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3329  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(138,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,1*fHarmonic,5*fHarmonic,4*fHarmonic));
3330  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(139,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
3331  // y-axis:
3332  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(1,Form("#LT#LT2#GT#GT_{%dn|%dn}",1*fHarmonic,1*fHarmonic));
3333  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(2,Form("#LT#LT2#GT#GT_{%dn|%dn}",2*fHarmonic,2*fHarmonic));
3334  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(3,Form("#LT#LT2#GT#GT_{%dn|%dn}",3*fHarmonic,3*fHarmonic));
3335  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(4,Form("#LT#LT2#GT#GT_{%dn|%dn}",4*fHarmonic,4*fHarmonic));
3336  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(5,Form("#LT#LT2#GT#GT_{%dn|%dn}",5*fHarmonic,5*fHarmonic));
3337  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(6,Form("#LT#LT2#GT#GT_{%dn|%dn}",6*fHarmonic,6*fHarmonic));
3338  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(7,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic));
3339  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(8,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic));
3340  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(9,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic));
3341  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(10,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,1*fHarmonic));
3342  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(11,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,1*fHarmonic));
3343  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(12,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,2*fHarmonic));
3344  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(13,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,1*fHarmonic));
3345  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(14,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,2*fHarmonic));
3346  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(15,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,1*fHarmonic));
3347  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(16,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3348  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(17,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3349  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(18,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3350  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(19,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
3351  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(20,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic));
3352  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(21,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,6*fHarmonic));
3353  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(22,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic));
3354  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(23,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic));
3355  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(24,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic));
3356  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(25,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic));
3357  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(26,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic));
3358  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(27,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic));
3359  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(28,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic));
3360  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(29,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic));
3361  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(30,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic));
3362  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(31,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic));
3363  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(32,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,6*fHarmonic,1*fHarmonic));
3364  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(33,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,2*fHarmonic));
3365  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(34,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,3*fHarmonic));
3366  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(35,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,4*fHarmonic));
3367  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(36,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,5*fHarmonic));
3368  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(37,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3369  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(38,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3370  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(39,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic));
3371  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(40,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3372  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(41,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic));
3373  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(42,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3374  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(43,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3375  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(44,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
3376  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(45,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic));
3377  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(46,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3378  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(47,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,4*fHarmonic));
3379  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(48,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,5*fHarmonic));
3380  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(49,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic));
3381  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(50,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic));
3382  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(51,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic));
3383  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(52,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
3384  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(53,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,2*fHarmonic));
3385  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(54,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3386  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(55,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,3*fHarmonic));
3387  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(56,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,4*fHarmonic));
3388  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(57,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3389  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(58,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3390  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(59,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3391  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(60,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3392  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(61,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3393  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(62,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3394  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(63,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3395  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(64,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
3396  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(65,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3397  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(66,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3398  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(67,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
3399  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(68,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
3400  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(69,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
3401  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(70,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
3402  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(71,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3403  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(72,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3404  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(73,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3405  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(74,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
3406  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(75,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
3407  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(76,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
3408  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(77,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
3409  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(78,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
3410  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(79,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,3*fHarmonic));
3411  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(80,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,1*fHarmonic,1*fHarmonic));
3412  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(81,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,2*fHarmonic,1*fHarmonic));
3413  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(82,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,2*fHarmonic,2*fHarmonic));
3414  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(83,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,3*fHarmonic,1*fHarmonic));
3415  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(84,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,2*fHarmonic));
3416  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(85,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,3*fHarmonic,2*fHarmonic));
3417  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(86,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,4*fHarmonic,1*fHarmonic));
3418  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(87,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3419  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(88,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3420  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(89,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3421  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(90,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3422  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(91,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3423  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(92,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3424  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(93,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3425  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(94,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
3426  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(95,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,3*fHarmonic,3*fHarmonic));
3427  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(96,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3428  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(97,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3429  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(98,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3430  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(99,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3431  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(100,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
3432  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(101,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3433  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(102,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3434  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(103,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3435  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(104,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3436  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(105,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3437  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(106,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3438  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(107,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3439  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(108,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3440  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(109,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3441  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(110,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
3442  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(111,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
3443  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(112,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
3444  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(113,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
3445  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(114,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
3446  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(115,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3447  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(116,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3448  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(117,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
3449  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(118,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
3450  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(119,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3451  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(120,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
3452  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(121,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,5*fHarmonic,5*fHarmonic));
3453  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(122,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic,1*fHarmonic));
3454  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(123,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,5*fHarmonic,2*fHarmonic));
3455  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(124,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,4*fHarmonic,2*fHarmonic));
3456  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(125,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,5*fHarmonic,1*fHarmonic));
3457  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(126,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3458  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(127,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
3459  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(128,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3460  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(129,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
3461  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(130,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3462  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(131,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
3463  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(132,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,5*fHarmonic,3*fHarmonic));
3464  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(133,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
3465  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(134,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic));
3466  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(135,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,5*fHarmonic,5*fHarmonic));
3467  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(136,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic));
3468  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(137,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3469  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(138,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,1*fHarmonic,5*fHarmonic,4*fHarmonic));
3470  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(139,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
3471  fMixedHarmonicsErrorPropagation->Add(fMixedHarmonicProductOfCorrelations);
3472
3473 } // end of void AliFlowAnalysisWithQCumulants::BookEverythingForMixedHarmonics()
3474
3475 //=======================================================================================================================
3476
3477 void AliFlowAnalysisWithQCumulants::InitializeArraysForNestedLoops()
3478 {
3479  // Initialize arrays of all objects relevant for calculations with nested loops.
3480  
3481  // integrated flow:
3482  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
3483  {
3484   fIntFlowDirectCorrectionTermsForNUA[sc] = NULL;
3485  } 
3486
3487  // differential flow:  
3488  // correlations:
3489  for(Int_t t=0;t<2;t++) // type: RP or POI
3490  { 
3491   for(Int_t pe=0;pe<2;pe++) // pt or eta
3492   {
3493    for(Int_t ci=0;ci<4;ci++) // correlation index
3494    {
3495     fDiffFlowDirectCorrelations[t][pe][ci] = NULL;
3496    } // end of for(Int_t ci=0;ci<4;ci++) // correlation index  
3497   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
3498  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
3499  // correction terms for non-uniform acceptance:
3500  for(Int_t t=0;t<2;t++) // type: RP or POI
3501  { 
3502   for(Int_t pe=0;pe<2;pe++) // pt or eta
3503   {
3504    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
3505    {
3506     for(Int_t cti=0;cti<9;cti++) // correction term index
3507     {
3508      fDiffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti] = NULL;
3509     }   
3510    }
3511   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
3512  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
3513
3514  // other differential correlators: 
3515  for(Int_t t=0;t<2;t++) // type: RP or POI
3516  { 
3517   for(Int_t pe=0;pe<2;pe++) // pt or eta
3518   {
3519    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
3520    {
3521     for(Int_t ci=0;ci<1;ci++) // correlator index
3522     {
3523      fOtherDirectDiffCorrelators[t][pe][sc][ci] = NULL;
3524     }   
3525    }
3526   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
3527  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
3528
3529 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForNestedLoops()
3530
3531 //=======================================================================================================================
3532
3533 void AliFlowAnalysisWithQCumulants::InitializeArraysForMixedHarmonics()
3534 {
3535  // Initialize arrays of all objects relevant for mixed harmonics.
3536
3537  for(Int_t power=0;power<2;power++) // linear or quadratic 
3538  {
3539   fMixedHarmonicEventWeights[power] = NULL;    
3540  }
3541
3542 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForMixedHarmonics()
3543
3544 //=======================================================================================================================
3545
3546 void AliFlowAnalysisWithQCumulants::InitializeArraysForControlHistograms()
3547 {
3548  // Initialize arrays of all objects relevant for control histograms.
3549
3550  for(Int_t ci=0;ci<4;ci++) // correlation index 
3551  {
3552   fCorrelation2468VsMult[ci] = NULL;    
3553  }
3554  for(Int_t cpi=0;cpi<1;cpi++) // correlation product index TBI: hardwired 1
3555  {
3556   fCorrelationProduct2468VsMult[cpi] = NULL;    
3557  }
3558  for(Int_t qwti=0;qwti<4;qwti++) // q-vector terms index TBI: hardwired 4
3559  {
3560   fQvectorTermsVsMult[qwti] = NULL;    
3561  }
3562
3563 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForControlHistograms()
3564
3565
3566 //=======================================================================================================================
3567
3568 void AliFlowAnalysisWithQCumulants::InitializeArraysForBootstrap()
3569 {
3570  // Initialize arrays of all objects relevant for control histograms.
3571
3572  for(Int_t ci=0;ci<4;ci++) // correlation index 
3573  {
3574   fBootstrapCorrelationsVsM[ci] = NULL;    
3575   fBootstrapCumulantsVsM[ci] = NULL;
3576  }
3577
3578 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForBootstrap()
3579
3580 //=======================================================================================================================
3581
3582 void AliFlowAnalysisWithQCumulants::BookEverythingForNestedLoops()
3583 {
3584  // Book all objects relevant for calculations with nested loops.
3585  
3586  TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data members?)
3587  TString typeFlag[2] = {"RP","POI"}; // to be improved (should I promote this to data members?)
3588  TString ptEtaFlag[2] = {"p_{T}","#eta"}; // to be improved (should I promote this to data members?)
3589  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"}; // to be improved (should I promote this to data members?)
3590  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
3591  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
3592
3593  TString evaluateNestedLoopsName = "fEvaluateNestedLoops";
3594  evaluateNestedLoopsName += fAnalysisLabel->Data();
3595  fEvaluateNestedLoops = new TProfile(evaluateNestedLoopsName.Data(),"Flags for nested loops",4,0,4);
3596  fEvaluateNestedLoops->SetLabelSize(0.03);
3597  fEvaluateNestedLoops->SetStats(kFALSE);
3598  (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(1,"fEvaluateIntFlowNestedLoops");
3599  (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(2,"fEvaluateDiffFlowNestedLoops");
3600  (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(3,"fCrossCheckInPtBinNo");
3601  (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(4,"fCrossCheckInEtaBinNo");
3602  fEvaluateNestedLoops->Fill(0.5,(Int_t)fEvaluateIntFlowNestedLoops);
3603  fEvaluateNestedLoops->Fill(1.5,(Int_t)fEvaluateDiffFlowNestedLoops);
3604  fEvaluateNestedLoops->Fill(2.5,fCrossCheckInPtBinNo);
3605  fEvaluateNestedLoops->Fill(3.5,fCrossCheckInEtaBinNo);
3606  fNestedLoopsList->Add(fEvaluateNestedLoops);
3607  // nested loops for integrated flow:
3608  if(fEvaluateIntFlowNestedLoops)
3609  {
3610   // correlations:
3611   TString intFlowDirectCorrelationsName = "fIntFlowDirectCorrelations";
3612   intFlowDirectCorrelationsName += fAnalysisLabel->Data();
3613   fIntFlowDirectCorrelations = new TProfile(intFlowDirectCorrelationsName.Data(),"Multiparticle correlations calculated with nested loops (for int. flow)",64,0,64,"s");
3614   fNestedLoopsList->Add(fIntFlowDirectCorrelations);
3615   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
3616   {
3617    TString intFlowExtraDirectCorrelationsName = "fIntFlowExtraDirectCorrelations";
3618    intFlowExtraDirectCorrelationsName += fAnalysisLabel->Data();
3619    fIntFlowExtraDirectCorrelations = new TProfile(intFlowExtraDirectCorrelationsName.Data(),"Extra multiparticle correlations calculated with nested loops (for int. flow)",100,0,100,"s");
3620    fNestedLoopsList->Add(fIntFlowExtraDirectCorrelations);  
3621   } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
3622   // correction terms for non-uniform acceptance:
3623   for(Int_t sc=0;sc<2;sc++) // sin or cos terms
3624   {
3625    TString intFlowDirectCorrectionTermsForNUAName = "fIntFlowDirectCorrectionTermsForNUA";
3626    intFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();
3627    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");
3628    fNestedLoopsList->Add(fIntFlowDirectCorrectionTermsForNUA[sc]);
3629   } // end of for(Int_t sc=0;sc<2;sc++) 
3630   // Mixed harmonics:
3631   if(fCalculateMixedHarmonics)
3632   {
3633    TString mixedHarmonicsNestedLoopsName = "fMixedHarmonicsNestedLoops";
3634    mixedHarmonicsNestedLoopsName += fAnalysisLabel->Data();
3635    fMixedHarmonicsNestedLoops = new TProfile(mixedHarmonicsNestedLoopsName.Data(),"Mixed harmonics calculated with nested loops",200,0,200); // TBI hardwired 200
3636    fNestedLoopsList->Add(fMixedHarmonicsNestedLoops);
3637   } // end of if(fCalculateMixedHarmonics)
3638  } // end of if(fEvaluateIntFlowNestedLoops)
3639  
3640  // nested loops for differential flow: 
3641  if(fEvaluateDiffFlowNestedLoops)
3642  {
3643   // reduced correlations:
3644   TString diffFlowDirectCorrelationsName = "fDiffFlowDirectCorrelations";
3645   diffFlowDirectCorrelationsName += fAnalysisLabel->Data();
3646   for(Int_t t=0;t<2;t++) // type: RP or POI
3647   { 
3648    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
3649    {
3650     for(Int_t rci=0;rci<4;rci++) // reduced correlation index
3651     {
3652      // reduced correlations:
3653      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");
3654      fDiffFlowDirectCorrelations[t][pe][rci]->SetXTitle(ptEtaFlag[pe].Data());
3655      fNestedLoopsList->Add(fDiffFlowDirectCorrelations[t][pe][rci]); // to be improved (add dedicated list to hold reduced correlations)
3656     } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
3657    } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
3658   } // end of for(Int_t t=0;t<2;t++) // type: RP or POI 
3659   
3660   // correction terms for non-uniform acceptance:
3661   TString diffFlowDirectCorrectionTermsForNUAName = "fDiffFlowDirectCorrectionTermsForNUA";
3662   diffFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();
3663   for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
3664   { 
3665    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
3666    {
3667     for(Int_t sc=0;sc<2;sc++) // sin or cos
3668     {
3669      for(Int_t cti=0;cti<9;cti++) // correction term index
3670      {
3671       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"); 
3672       fNestedLoopsList->Add(fDiffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti]);
3673      }
3674     }
3675    }
3676   }
3677   // other differential correlators: 
3678   TString otherDirectDiffCorrelatorsName = "fOtherDirectDiffCorrelators";
3679   otherDirectDiffCorrelatorsName += fAnalysisLabel->Data();
3680   for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
3681   { 
3682    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
3683    {
3684     for(Int_t sc=0;sc<2;sc++) // sin or cos
3685     {
3686      for(Int_t ci=0;ci<1;ci++) // correlator index
3687      {
3688       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]); 
3689       fNestedLoopsList->Add(fOtherDirectDiffCorrelators[t][pe][sc][ci]);
3690      }
3691     }
3692    }
3693   }
3694   // number of RPs and POIs in selected pt and eta bins for cross-checkings:
3695   TString noOfParticlesInBinName = "fNoOfParticlesInBin";
3696   fNoOfParticlesInBin = new TH1D(noOfParticlesInBinName.Data(),"Number of RPs and POIs in selected p_{T} and #eta bin",4,0,4);
3697   fNoOfParticlesInBin->GetXaxis()->SetBinLabel(1,"# of RPs in p_{T} bin");
3698   fNoOfParticlesInBin->GetXaxis()->SetBinLabel(2,"# of RPs in #eta bin");
3699   fNoOfParticlesInBin->GetXaxis()->SetBinLabel(3,"# of POIs in p_{T} bin");
3700   fNoOfParticlesInBin->GetXaxis()->SetBinLabel(4,"# of POIs in #eta bin");
3701   fNestedLoopsList->Add(fNoOfParticlesInBin);
3702  } // end of if(fEvaluateDiffFlowNestedLoops)
3703
3704 } // end of AliFlowAnalysisWithQCumulants::BookEverythingForNestedLoops()
3705
3706 //=========================================================================================================
3707
3708 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelations()
3709 {
3710  // Calculate in this method all multiparticle azimuthal correlations.
3711  //
3712  // Remark 1: All multiparticle correlations are stored in TProfile fIntFlowCorrelationsAllPro;
3713  // Remark 2: There is a special TProfile fIntFlowCorrelationsPro holding results 
3714  //           only for same harmonic's correlations <<2>>, <<4>>, <<6>> and <<8>>;  
3715  // Remark 3: Binning of fIntFlowCorrelationsAllPro is organized as follows:
3716  // --------------------------------------------------------------------------------------------------------------------
3717  //  1st bin: <2>_{1n|1n} = two1n1n = cos(1n(phi1-phi2))>
3718  //  2nd bin: <2>_{2n|2n} = two2n2n = cos(2n(phi1-phi2))>
3719  //  3rd bin: <2>_{3n|3n} = two3n3n = cos(3n(phi1-phi2))> 
3720  //  4th bin: <2>_{4n|4n} = two4n4n = cos(4n(phi1-phi2))>
3721  //  5th bin:           ----  EMPTY ----
3722  //  6th bin: <3>_{2n|1n,1n} = three2n1n1n = <cos(n(2*phi1-phi2-phi3))>
3723  //  7th bin: <3>_{3n|2n,1n} = three3n2n1n = <cos(n(3*phi1-2*phi2-phi3))>
3724  //  8th bin: <3>_{4n|2n,2n} = three4n2n2n = <cos(n(4*phi1-2*phi2-2*phi3))>
3725  //  9th bin: <3>_{4n|3n,1n} = three4n3n1n = <cos(n(4*phi1-3*phi2-phi3))>
3726  // 10th bin:           ----  EMPTY ----
3727  // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1n = <cos(n(phi1+phi2-phi3-phi4))>
3728  // 12th bin: <4>_{2n,1n|2n,1n} = four2n1n2n1n = <cos(n(2*phi1+phi2-2*phi3-phi4))>
3729  // 13th bin: <4>_{2n,2n|2n,2n} = four2n2n2n2n = <cos(2n(phi1+phi2-phi3-phi4))>
3730  // 14th bin: <4>_{3n|1n,1n,1n} = four3n1n1n1n = <cos(n(3*phi1-phi2-phi3-phi4))> 
3731  // 15th bin: <4>_{3n,1n|3n,1n} = four3n1n3n1n = <cos(n(3*phi1+phi2-3*phi3-phi4))>
3732  // 16th bin: <4>_{3n,1n|2n,2n} = four3n1n2n2n = <cos(n(3*phi1+phi2-2*phi3-2*phi4))>
3733  // 17th bin: <4>_{4n|2n,1n,1n} = four4n2n1n1n = <cos(n(4*phi1-2*phi2-phi3-phi4))>
3734  // 18th bin:           ----  EMPTY ----
3735  // 19th bin: <5>_{2n,1n|1n,1n,1n} = five2n1n1n1n1n = <cos(n(2*phi1+phi2-phi3-phi4-phi5))>
3736  // 20th bin: <5>_{2n,2n|2n,1n,1n} = five2n2n2n1n1n = <cos(n(2*phi1+2*phi2-2*phi3-phi4-phi5))>
3737  // 21st bin: <5>_{3n,1n|2n,1n,1n} = five3n1n2n1n1n = <cos(n(3*phi1+phi2-2*phi3-phi4-phi5))>
3738  // 22nd bin: <5>_{4n|1n,1n,1n,1n} = five4n1n1n1n1n = <cos(n(4*phi1-phi2-phi3-phi4-phi5))>
3739  // 23rd bin:           ----  EMPTY ----
3740  // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = six1n1n1n1n1n1n = <cos(n(phi1+phi2+phi3-phi4-phi5-phi6))>
3741  // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = six2n1n1n2n1n1n = <cos(n(2*phi1+phi2+phi3-2*phi4-phi5-phi6))>
3742  // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = six2n2n1n1n1n1n = <cos(n(2*phi1+2*phi2-phi3-phi4-phi5-phi6))>
3743  // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = six3n1n1n1n1n1n = <cos(n(3*phi1+phi2-phi3-phi4-phi5-phi6))> 
3744  // 28th bin:           ----  EMPTY ----
3745  // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = seven2n1n1n1n1n1n1n =  <cos(n(2*phi1+phi2+phi3-phi4-phi5-phi6-phi7))>
3746  // 30th bin:           ----  EMPTY ----
3747  // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = eight1n1n1n1n1n1n1n1n = <cos(n(phi1+phi2+phi3+phi4-phi5-phi6-phi7-phi8))>
3748  // 32nd bin:           ----  EMPTY ----
3749  //  Extra correlations for v3{5} study: 
3750  // 33rd bin: <4>_{4n,2n|3n,3n} = four4n2n3n3n = <cos(n(4*phi1+2*phi2-3*phi3-3*phi4))>
3751  // 34th bin: <5>_{3n,3n|2n,2n,2n} = five3n3n2n2n2n = <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-2*phi5))> 
3752  //  Extra correlations for Teaney-Yan study: 
3753  // 35th bin: <2>_{5n|5n} = two5n5n = <cos(5n(phi1-phi2)> 
3754  // 36th bin: <2>_{6n|6n} = two6n6n = <cos(6n(phi1-phi2)> 
3755  // 37th bin: <3>_{5n|3n,2n} = three5n3n2n = <cos(n(5*phi1-3*phi2-2*phi3)> 
3756  // 38th bin: <3>_{5n|4n,1n} = three5n4n1n = <cos(n(5*phi1-4*phi2-1*phi3)> 
3757  // 39th bin: <3>_{6n|3n,3n} = three6n3n3n = <cos(n(6*phi1-3*phi2-3*phi3)> 
3758  // 40th bin: <3>_{6n|4n,2n} = three6n4n2n = <cos(n(6*phi1-4*phi2-2*phi3)> 
3759  // 41st bin: <3>_{6n|5n,1n} = three6n5n1n = <cos(n(6*phi1-5*phi2-1*phi3)>
3760  // 42nd bin: <4>_{6n|3n,2n,1n} = four6n3n2n1n = <cos(n(6*phi1-3*phi2-2*phi3-1*phi4)>
3761  // 43rd bin: <4>_{3n,2n|3n,2n} = four3n2n3n2n = <cos(n(3*phi1+2*phi2-3*phi3-2*phi4)>
3762  // 44th bin: <4>_{4n,1n|3n,2n} = four4n1n3n2n = <cos(n(4*phi1+1*phi2-3*phi3-2*phi4)>
3763  // 45th bin: <4>_{3n,3n|3n,3n} = four3n3n3n3n = <cos(3n*(phi1+phi2-phi3-phi4))> 
3764  // 46th bin: <4>_{4n,2n|3n,3n} = four4n2n3n3n = <cos(n(4*phi1+2*phi2-3*phi3-3*phi4)>
3765  // 47th bin: <4>_{5n,1n|3n,3n} = four5n1n3n3n = <cos(n(5*phi1+1*phi2-3*phi3-3*phi4)>
3766  // 48th bin: <4>_{4n,2n|4n,2n} = four4n2n4n2n = <cos(n(4*phi1+2*phi2-4*phi3-2*phi4)> 
3767  // 49th bin: <4>_{5n,1n|4n,2n} = four5n1n4n2n = <cos(n(5*phi1+1*phi2-4*phi3-2*phi4)>
3768  // 50th bin: <4>_{5n|3n,1n,1n} = four5n3n1n1n = <cos(n(5*phi1-3*phi2-1*phi3-1*phi4)>
3769  // 51st bin: <4>_{5n|2n,2n,1n} = four5n2n2n1n = <cos(n(5*phi1-2*phi2-2*phi3-1*phi4)>
3770  // 52nd bin: <4>_{5n,1n|5n,1n} = four5n1n5n1n = <cos(n(5*phi1+1*phi2-5*phi3-1*phi4)>
3771  // 53rd bin: <5>_{3n,3n|3n,2n,1n} = five3n3n3n2n1n = <cos(n(3*phi1+3*phi2-3*phi3-2*phi4-1*phi5)>
3772  // 54th bin: <5>_{4n,2n|3n,2n,1n} = five4n2n3n2n1n = <cos(n(4*phi1+2*phi2-3*phi3-2*phi4-1*phi5)>
3773  // 55th bin: <5>_{3n,2n|3n,1n,1n} = five3n2n3n1n1n = <cos(n(3*phi1+2*phi2-3*phi3-1*phi4-1*phi5)>
3774  // 56th bin: <5>_{3n,2n|2n,2n,1n} = five3n2n2n2n1n = <cos(n(3*phi1+2*phi2-2*phi3-2*phi4-1*phi5)>
3775  // 57th bin: <5>_{5n,1n|3n,2n,1n} = five5n1n3n2n1n = <cos(n(5*phi1+1*phi2-3*phi3-2*phi4-1*phi5)>
3776  // 58th bin: <6>_{3n,2n,1n|3n,2n,1n} = six3n2n1n3n2n1n = <cos(n(3*phi1+2*phi2+1*phi3-3*phi4-2*phi5-1*phi6)>
3777  //  Extra correlations for Teaney-Yan study (B): 
3778  // 59th bin: <4>_{6n|4n,1n,1n} = four6n4n1n1n = <cos(n(6*phi1-4*phi2-1*phi3-1*phi4)>
3779  // 60th bin: <4>_{6n|2n,2n,2n} = four6n2n2n2n = <cos(n(6*phi1-2*phi2-2*phi3-2*phi4)>
3780  // 61st bin: <5>_{6n|2n,2n,1n,1n} = five6n2n2n1n1n = <cos(n(6*phi1-2*phi2-2*phi3-1*phi4-1*phi5)>
3781  // 62nd bin: <5>_{4n,1n,1n|3n,3n} = five4n1n1n3n3n = <cos(n(4*phi1+1*phi2+1*phi3-3*phi4-3*phi5)>
3782  // 63rd bin: <6>_{3n,3n|2n,2n,1n,1n} = six3n3n2n2n1n1n = <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-1*phi5-1*phi6)>
3783  // --------------------------------------------------------------------------------------------------------------------
3784
3785  // Multiplicity of an event: 
3786  Double_t dMult = (*fSpk)(0,0);
3787  // Real parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n, 4n, 5n and 6n: 
3788  Double_t dReQ1n = (*fReQ)(0,0);
3789  Double_t dReQ2n = (*fReQ)(1,0);
3790  Double_t dReQ3n = (*fReQ)(2,0);
3791  Double_t dReQ4n = (*fReQ)(3,0);
3792  Double_t dReQ5n = (*fReQ)(4,0); 
3793  Double_t dReQ6n = (*fReQ)(5,0);
3794  // Imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n, 4n, 5n and 6n:
3795  Double_t dImQ1n = (*fImQ)(0,0);
3796  Double_t dImQ2n = (*fImQ)(1,0);
3797  Double_t dImQ3n = (*fImQ)(2,0);
3798  Double_t dImQ4n = (*fImQ)(3,0);
3799  Double_t dImQ5n = (*fImQ)(4,0); 
3800  Double_t dImQ6n = (*fImQ)(5,0);
3801
3802  // Multiplicity bin of an event (relevant for all histos vs M): 
3803  Double_t dMultiplicityBin = 0.;
3804  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
3805  {
3806    //Printf("RP multiplicity: %lf",fNumberOfRPsEBE);
3807    dMultiplicityBin = fNumberOfRPsEBE+0.5;
3808  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
3809    {
3810      //Printf("Reference multiplicity: %lf",fReferenceMultiplicityEBE);
3811     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
3812    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
3813      {
3814       dMultiplicityBin = fNumberOfPOIsEBE+0.5;
3815      }
3816  
3817  // Real parts of expressions involving various combinations of Q-vectors which appears
3818  // simultaneously in several equations for multiparticle correlations bellow: 
3819  // Re[Q_{2n}Q_{n}^*Q_{n}^*]
3820  Double_t reQ2nQ1nstarQ1nstar = pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n; 
3821  // Re[Q_{6n}Q_{3n}^*Q_{3n}^*]
3822  Double_t reQ6nQ3nstarQ3nstar = pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n;  
3823  // Re[Q_{4n}Q_{2n}^*Q_{2n}^*]
3824  Double_t reQ4nQ2nstarQ2nstar = pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n;
3825  // Re[Q_{4n}Q_{3n}^*Q_{n}^*]
3826  Double_t reQ4nQ3nstarQ1nstar = dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);
3827  // Re[Q_{3n}Q_{2n}^*Q_{n}^*]
3828  Double_t reQ3nQ2nstarQ1nstar = dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
3829                               + dImQ3n*dImQ2n*dReQ1n; 
3830  // Re[Q_{5n}Q_{3n}^*Q_{2n}^*]
3831  Double_t reQ5nQ3nstarQ2nstar = dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n
3832                               + dImQ5n*dImQ2n*dReQ3n;                             
3833  // Re[Q_{5n}Q_{4n}^*Q_{1n}^*]
3834  Double_t reQ5nQ4nstarQ1nstar = dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n
3835                               + dImQ5n*dImQ4n*dReQ1n;                              
3836  // Re[Q_{6n}Q_{5n}^*Q_{1n}^*]                              
3837  Double_t reQ6nQ5nstarQ1nstar = dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n
3838                               + dImQ6n*dImQ5n*dReQ1n;
3839  // Re[Q_{6n}Q_{4n}^*Q_{2n}^*]                              
3840  Double_t reQ6nQ4nstarQ2nstar = dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
3841                               + dImQ6n*dImQ4n*dReQ2n;
3842  // Re[Q_{3n}Q_{n}Q_{2n}^*Q_{2n}^*]
3843  Double_t reQ3nQ1nQ2nstarQ2nstar = (pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
3844                                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);                                
3845  // Re[Q_{3n}Q_{n}^*Q_{n}^*Q_{n}^*]
3846  Double_t reQ3nQ1nstarQ1nstarQ1nstar = dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
3847                                      + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3);
3848  // Re[Q_{6n}Q_{2n}^*Q_{2n}^*Q_{2n}^*]
3849  Double_t reQ6nQ2nstarQ2nstarQ2nstar = dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
3850                                      + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3);
3851  // Re[Q_{4n}Q_{2n}^*Q_{n}^*Q_{n}^*]
3852  Double_t reQ4nQ2nstarQ1nstarQ1nstar = (dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
3853                                      + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n);  
3854  // Re[Q_{4n}Q_{2n}^*Q_{3n}^*Q_{3n}^*]
3855  Double_t reQ4nQ2nQ3nstarQ3nstar = (dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
3856                                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n;                    
3857  // Re[Q_{4n}Q_{n}Q_{3n}^*Q_{2n}^*]
3858  Double_t reQ4nQ1nQ3nstarQ2nstar = dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
3859                                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
3860                                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
3861                                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n;
3862  // Re[Q_{5n}Q_{n}Q_{4n}^*Q_{2n}^*]
3863  Double_t reQ5nQ1nQ4nstarQ2nstar = dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
3864                                  + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
3865                                  - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n 
3866                                  + dImQ1n*dImQ2n*dReQ4n*dReQ5n+dReQ1n*dReQ2n*dReQ4n*dReQ5n;                                  
3867  // Re[Q_{5n}Q_{n}Q_{3n}^*Q_{3n}^*]                                  
3868  Double_t reQ5nQ1nQ3nstarQ3nstar = dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
3869                                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
3870                                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n;
3871  // Re[Q_{5n}Q_{3n}^*Q_{n}^*Q_{n}^*]                                  
3872  Double_t reQ5nQ3nstarQ1nstarQ1nstar = -pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
3873                                      + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
3874                                      - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n;                     
3875  // Re[Q_{5n}Q_{2n}^*Q_{2n}^*Q_{n}^*]                                  
3876  Double_t reQ5nQ2nstarQ2nstarQ1nstar = -pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
3877                                      + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
3878                                      - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n;                                     
3879  // Re[Q_{6n}Q_{4n}^*Q_{n}^*Q_{n}^*]                                  
3880  Double_t reQ6nQ4nstarQ1nstarQ1nstar = -pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
3881                                      +  2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
3882                                      -  pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n;
3883  // |Q_{2n}|^2 |Q_{n}|^2
3884  Double_t dQ2nQ1nQ2nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
3885  // |Q_{4n}|^2 |Q_{2n}|^2
3886  Double_t dQ4nQ2nQ4nstarQ2nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.));
3887  // |Q_{3n}|^2 |Q_{2n}|^2
3888  Double_t dQ3nQ2nQ3nstarQ2nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.));
3889  // |Q_{5n}|^2 |Q_{n}|^2
3890  Double_t dQ5nQ1nQ5nstarQ1nstar = (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
3891  // |Q_{3n}|^2 |Q_{n}|^2
3892  Double_t dQ3nQ1nQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
3893  // Re[Q_{2n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*]
3894  Double_t reQ2nQ1nQ1nstarQ1nstarQ1nstar = (dReQ2n*dReQ1n-dImQ2n*dImQ1n)*(pow(dReQ1n,3)-3.*dReQ1n*pow(dImQ1n,2))
3895                                         + (dReQ2n*dImQ1n+dReQ1n*dImQ2n)*(3.*dImQ1n*pow(dReQ1n,2)-pow(dImQ1n,3)); 
3896  // Re[Q_{2n}Q_{2n}Q_{2n}^*Q_{n}^*Q_{n}^*]
3897  Double_t reQ2nQ2nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
3898                                         * (dReQ2n*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) + 2.*dImQ2n*dReQ1n*dImQ1n);
3899  // Re[Q_{4n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
3900  Double_t reQ4nQ1nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,4.)*dReQ4n-6.*pow(dReQ1n,2.)*dReQ4n*pow(dImQ1n,2.)
3901                                             + pow(dImQ1n,4.)*dReQ4n+4.*pow(dReQ1n,3.)*dImQ1n*dImQ4n
3902                                             - 4.*pow(dImQ1n,3.)*dReQ1n*dImQ4n;
3903  // Re[Q_{3n}Q_{n}Q_{2n}^*Q_{n}^*Q_{n}^*]
3904  Double_t reQ3nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
3905                                         * (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n
3906                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n);
3907  // Re[Q_{6n}Q_{n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
3908  Double_t reQ6nQ3nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
3909                                      - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
3910                                      + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
3911                                      + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n;
3912  // Re[Q_{3n}Q_{3n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
3913  Double_t reQ3nQ3nQ3nstarQ2nstarQ1nstar = (pow(dImQ3n,2.)+pow(dReQ3n,2.))
3914                                         * (dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n
3915                                         - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n);   
3916  // Re[Q_{3n}Q_{3n}Q_{2n}^*Q_{2n}^*Q_{2n}^*]
3917  Double_t reQ3nQ3nQ2nstarQ2nstarQ2nstar = pow(dReQ2n,3.)*pow(dReQ3n,2.) 
3918                                         - 3.*dReQ2n*pow(dReQ3n,2.)*pow(dImQ2n,2.)
3919                                         + 6.*pow(dReQ2n,2.)*dReQ3n*dImQ2n*dImQ3n 
3920                                         - 2.*dReQ3n*pow(dImQ2n,3.)*dImQ3n-pow(dReQ2n,3.)*pow(dImQ3n,2.) 
3921                                         + 3.*dReQ2n*pow(dImQ2n,2.)*pow(dImQ3n,2.);
3922  // Re[Q_{4n}Q_{2n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
3923  Double_t reQ4nQ2nQ3nstarQ2nstarQ1nstar = (pow(dImQ2n,2.)+pow(dReQ2n,2.))
3924                                         * (dImQ3n*dImQ4n*dReQ1n+dImQ1n*dImQ4n*dReQ3n 
3925                                         - dImQ1n*dImQ3n*dReQ4n+dReQ1n*dReQ3n*dReQ4n);
3926  // Re[Q_{3n}Q_{2n}Q_{3n}^*Q_{n}^*Q_{n}^*]
3927  Double_t reQ3nQ2nQ3nstarQ1nstarQ1nstar = -(pow(dImQ3n,2.)+pow(dReQ3n,2.))
3928                                         * (-2.*dImQ1n*dImQ2n*dReQ1n+pow(dImQ1n,2.)*dReQ2n-pow(dReQ1n,2.)*dReQ2n);                              
3929  // Re[Q_{3n}Q_{2n}Q_{2n}^*Q_{2n}^*Q_{n}^*]
3930  Double_t reQ3nQ2nQ2nstarQ2nstarQ1nstar = (pow(dImQ2n,2.)+pow(dReQ2n,2.))
3931                                         * (dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n 
3932                                         - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n);
3933  // Re[Q_{5n}Q_{n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
3934  Double_t reQ5nQ1nQ3nstarQ2nstarQ1nstar = (pow(dImQ1n,2.)+pow(dReQ1n,2.))
3935                                         * (dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n 
3936                                         - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n);   
3937  // Re[Q_{2n}Q_{2n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
3938  Double_t reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)*dReQ2n-2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)
3939                                                + dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dImQ2n)
3940                                                * (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)
3941                                                - dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n+pow(dImQ1n,2.)*dImQ2n); 
3942  // Re[Q_{3n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
3943  Double_t reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
3944                                                * (pow(dReQ1n,3.)*dReQ3n-3.*dReQ1n*dReQ3n*pow(dImQ1n,2.)
3945                                                + 3.*pow(dReQ1n,2.)*dImQ1n*dImQ3n-pow(dImQ1n,3.)*dImQ3n);
3946  // |Q_{2n}|^2 |Q_{n}|^4
3947  Double_t dQ2nQ1nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.); 
3948  // |Q_{3n}|^2 |Q_{2n}|^2 |Q_{n}|^2
3949  Double_t dQ3nQ2nQ1nQ3nstarQ2nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3950                                           * (pow(dReQ1n,2.)+pow(dImQ1n,2.));
3951  // Re[Q_{2n}Q_{n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
3952  Double_t reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
3953                                                   * (pow(dReQ1n,2.)*dReQ2n-dReQ2n*pow(dImQ1n,2.)
3954                                                   + 2.*dReQ1n*dImQ1n*dImQ2n);                                                  
3955  // Re[Q_{6n}Q_{2n}^*Q_{2n}^*Q_{n}^*Q_{n}^*]
3956  Double_t reQ6nQ2nstarQ2nstarQ1nstarQ1nstar = pow(dReQ1n*dReQ2n,2.)*dReQ6n-pow(dReQ2n*dImQ1n,2.)*dReQ6n
3957                                             - 4.*dReQ1n*dReQ2n*dReQ6n*dImQ1n*dImQ2n 
3958                                             - pow(dReQ1n*dImQ2n,2.)*dReQ6n+pow(dImQ1n*dImQ2n,2.)*dReQ6n
3959                                             + 2.*dReQ1n*pow(dReQ2n,2.)*dImQ1n*dImQ6n
3960                                             + 2.*pow(dReQ1n,2.)*dReQ2n*dImQ2n*dImQ6n 
3961                                             - 2.*dReQ2n*pow(dImQ1n,2.)*dImQ2n*dImQ6n 
3962                                             - 2.*dReQ1n*dImQ1n*pow(dImQ2n,2.)*dImQ6n;       
3963  // Re[Q_{4n}Q_{1n}Q_{1n}Q_{3n}^*Q_{3n}^*]
3964  Double_t reQ4nQ1nQ1nQ3nstarQ3nstar = pow(dReQ1n*dReQ3n,2.)*dReQ4n-pow(dReQ3n*dImQ1n,2.)*dReQ4n  
3965                                     + 4.*dReQ1n*dReQ3n*dReQ4n*dImQ1n*dImQ3n 
3966                                     - pow(dReQ1n*dImQ3n,2.)*dReQ4n+pow(dImQ1n*dImQ3n,2.)*dReQ4n  
3967                                     - 2.*dReQ1n*pow(dReQ3n,2.)*dImQ1n*dImQ4n 
3968                                     + 2.*pow(dReQ1n,2.)*dReQ3n*dImQ3n*dImQ4n 
3969                                     - 2.*dReQ3n*pow(dImQ1n,2.)*dImQ3n*dImQ4n 
3970                                     + 2.*dReQ1n*dImQ1n*pow(dImQ3n,2.)*dImQ4n;
3971  // Re[Q_{3n}Q_{3n}Q_{2n}^*Q_{2n}^*Q_{1n}^*Q_{1n}^*]
3972  Double_t reQ3nQ3nQ2nstarQ2nstarQ1nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ2n*dReQ3n*dImQ1n-dReQ1n*dReQ3n*dImQ2n 
3973                                                - dReQ3n*dImQ1n*dImQ2n+dReQ1n*dReQ2n*dImQ3n+dReQ2n*dImQ1n*dImQ3n 
3974                                                + dReQ1n*dImQ2n*dImQ3n-dImQ1n*dImQ2n*dImQ3n)*(dReQ1n*dReQ2n*dReQ3n 
3975                                                + dReQ2n*dReQ3n*dImQ1n+dReQ1n*dReQ3n*dImQ2n-dReQ3n*dImQ1n*dImQ2n 
3976                                                - dReQ1n*dReQ2n*dImQ3n+dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n 
3977                                                + dImQ1n*dImQ2n*dImQ3n);
3978     
3979  // Results for multiparticle azimuthal correlations:
3980  // 2-particle:
3981  Double_t two1n1n = 0.; // <cos(n(phi1-phi2))>
3982  Double_t two2n2n = 0.; // <cos(2n(phi1-phi2))>
3983  Double_t two3n3n = 0.; // <cos(3n(phi1-phi2))>
3984  Double_t two4n4n = 0.; // <cos(4n(phi1-phi2))>
3985  Double_t mWeight2p = 0.; // multiplicity weight for 2-p correlations
3986  if(dMult>1)
3987  {
3988   two1n1n = (pow(dReQ1n,2.)+pow(dImQ1n,2.)-dMult)/(dMult*(dMult-1.)); 
3989   two2n2n = (pow(dReQ2n,2.)+pow(dImQ2n,2.)-dMult)/(dMult*(dMult-1.)); 
3990   two3n3n = (pow(dReQ3n,2.)+pow(dImQ3n,2.)-dMult)/(dMult*(dMult-1.)); 
3991   two4n4n = (pow(dReQ4n,2.)+pow(dImQ4n,2.)-dMult)/(dMult*(dMult-1.)); 
3992   // Average 2-particle correlations for single event: 
3993   fIntFlowCorrelationsAllEBE->SetBinContent(1,two1n1n);
3994   fIntFlowCorrelationsAllEBE->SetBinContent(2,two2n2n);
3995   fIntFlowCorrelationsAllEBE->SetBinContent(3,two3n3n);
3996   fIntFlowCorrelationsAllEBE->SetBinContent(4,two4n4n);         
3997   // Average 2-particle correlations for all events:      
3998   fIntFlowCorrelationsAllPro->Fill(0.5,two1n1n,dMult*(dMult-1.));
3999   fIntFlowCorrelationsAllPro->Fill(1.5,two2n2n,dMult*(dMult-1.)); 
4000   fIntFlowCorrelationsAllPro->Fill(2.5,two3n3n,dMult*(dMult-1.)); 
4001   fIntFlowCorrelationsAllPro->Fill(3.5,two4n4n,dMult*(dMult-1.)); 
4002   // Store separetately <2>:
4003   fIntFlowCorrelationsEBE->SetBinContent(1,two1n1n); // <2>  
4004   // Testing other multiplicity weights:
4005   if(fMultiplicityWeight->Contains("combinations"))
4006   {
4007    mWeight2p = dMult*(dMult-1.);
4008   } else if(fMultiplicityWeight->Contains("unit"))
4009     {
4010      mWeight2p = 1.;    
4011     } else if(fMultiplicityWeight->Contains("multiplicity"))
4012       {
4013        mWeight2p = dMult;           
4014       }          
4015   fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(1,mWeight2p); // eW_<2>
4016   fIntFlowCorrelationsPro->Fill(0.5,two1n1n,mWeight2p);
4017   fIntFlowSquaredCorrelationsPro->Fill(0.5,two1n1n*two1n1n,mWeight2p);
4018   if(fCalculateCumulantsVsM)
4019   {
4020    if(fFillProfilesVsMUsingWeights)  
4021    {
4022     fIntFlowCorrelationsVsMPro[0]->Fill(dMultiplicityBin,two1n1n,mWeight2p);
4023     fIntFlowSquaredCorrelationsVsMPro[0]->Fill(dMultiplicityBin,two1n1n*two1n1n,mWeight2p);
4024    } else
4025      {
4026       fIntFlowCorrelationsVsMPro[0]->Fill(dMultiplicityBin,two1n1n);
4027       fIntFlowSquaredCorrelationsVsMPro[0]->Fill(dMultiplicityBin,two1n1n*two1n1n);
4028      }
4029   } // end of if(fCalculateCumulantsVsM)
4030   if(fCalculateAllCorrelationsVsM)
4031   {
4032    fIntFlowCorrelationsAllVsMPro[0]->Fill(dMultiplicityBin,two1n1n,mWeight2p);
4033    fIntFlowCorrelationsAllVsMPro[1]->Fill(dMultiplicityBin,two2n2n,mWeight2p);
4034    fIntFlowCorrelationsAllVsMPro[2]->Fill(dMultiplicityBin,two3n3n,mWeight2p);
4035    fIntFlowCorrelationsAllVsMPro[3]->Fill(dMultiplicityBin,two4n4n,mWeight2p);
4036   } 
4037   if(fStoreControlHistograms)
4038   {
4039    fCorrelation2468VsMult[0]->Fill(dMultiplicityBin,two1n1n);
4040   } 
4041  } // end of if(dMult>1)
4042  
4043  // 3-particle:
4044  Double_t three2n1n1n = 0.; // <cos(n(2*phi1-phi2-phi3))>
4045  Double_t three3n2n1n = 0.; // <cos(n(3*phi1-2*phi2-phi3))>
4046  Double_t three4n2n2n = 0.; // <cos(n(4*phi1-2*phi2-2*phi3))>
4047  Double_t three4n3n1n = 0.; // <cos(n(4*phi1-3*phi2-phi3))> 
4048  if(dMult>2)
4049  {
4050   three2n1n1n = (reQ2nQ1nstarQ1nstar-2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4051               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
4052               / (dMult*(dMult-1.)*(dMult-2.));                     
4053   three3n2n1n = (reQ3nQ2nstarQ1nstar-(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4054               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))
4055               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4056               / (dMult*(dMult-1.)*(dMult-2.));
4057   three4n2n2n = (reQ4nQ2nstarQ2nstar-2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4058               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*dMult)
4059               / (dMult*(dMult-1.)*(dMult-2.)); 
4060   three4n3n1n = (reQ4nQ3nstarQ1nstar-(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4061               - (pow(dReQ3n,2.)+pow(dImQ3n,2.))
4062               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4063               / (dMult*(dMult-1.)*(dMult-2.));              
4064   // Average 3-particle correlations for single event: 
4065   fIntFlowCorrelationsAllEBE->SetBinContent(6,three2n1n1n);
4066   fIntFlowCorrelationsAllEBE->SetBinContent(7,three3n2n1n);
4067   fIntFlowCorrelationsAllEBE->SetBinContent(8,three4n2n2n);
4068   fIntFlowCorrelationsAllEBE->SetBinContent(9,three4n3n1n);
4069   // Average 3-particle correlations for all events:                
4070   fIntFlowCorrelationsAllPro->Fill(5.5,three2n1n1n,dMult*(dMult-1.)*(dMult-2.)); 
4071   fIntFlowCorrelationsAllPro->Fill(6.5,three3n2n1n,dMult*(dMult-1.)*(dMult-2.));
4072   fIntFlowCorrelationsAllPro->Fill(7.5,three4n2n2n,dMult*(dMult-1.)*(dMult-2.)); 
4073   fIntFlowCorrelationsAllPro->Fill(8.5,three4n3n1n,dMult*(dMult-1.)*(dMult-2.));  
4074   // Average 3-particle correlations vs M for all events:                
4075   if(fCalculateAllCorrelationsVsM)
4076   {
4077    fIntFlowCorrelationsAllVsMPro[5]->Fill(dMultiplicityBin,three2n1n1n,dMult*(dMult-1.)*(dMult-2.));
4078    fIntFlowCorrelationsAllVsMPro[6]->Fill(dMultiplicityBin,three3n2n1n,dMult*(dMult-1.)*(dMult-2.));
4079    fIntFlowCorrelationsAllVsMPro[7]->Fill(dMultiplicityBin,three4n2n2n,dMult*(dMult-1.)*(dMult-2.));
4080    fIntFlowCorrelationsAllVsMPro[8]->Fill(dMultiplicityBin,three4n3n1n,dMult*(dMult-1.)*(dMult-2.));
4081   }    
4082  } // end of if(dMult>2)
4083  
4084  // 4-particle:
4085  Double_t four1n1n1n1n = 0.; // <cos(n(phi1+phi2-phi3-phi4))>
4086  Double_t four2n2n2n2n = 0.; // <cos(2n(phi1+phi2-phi3-phi4))>
4087  Double_t four2n1n2n1n = 0.; // <cos(n(2*phi1+phi2-2*phi3-phi4))> 
4088  Double_t four3n1n1n1n = 0.; // <cos(n(3*phi1-phi2-phi3-phi4))> 
4089  Double_t four4n2n1n1n = 0.; // <cos(n(4*phi1-2*phi2-phi3-phi4))> 
4090  Double_t four3n1n2n2n = 0.; // <cos(n(3*phi1+phi2-2*phi3-2*phi4))> 
4091  Double_t four3n1n3n1n = 0.; // <cos(n(3*phi1+phi2-3*phi3-phi4))>    
4092  Double_t mWeight4p = 0.; // multiplicity weight for 4-p correlations
4093  if(dMult>3)
4094  {
4095   four1n1n1n1n = (2.*dMult*(dMult-3.)+pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ1n,2.)
4096                + pow(dImQ1n,2.))-2.*reQ2nQ1nstarQ1nstar+(pow(dReQ2n,2.)+pow(dImQ2n,2.)))
4097                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));     
4098   four2n2n2n2n = (2.*dMult*(dMult-3.)+pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ2n,2.)
4099                + pow(dImQ2n,2.))-2.*reQ4nQ2nstarQ2nstar+(pow(dReQ4n,2.)+pow(dImQ4n,2.)))
4100                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));
4101   four2n1n2n1n = (dQ2nQ1nQ2nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar-2.*reQ2nQ1nstarQ1nstar)
4102                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4103                - ((dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4104                + (dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-(pow(dReQ3n,2.)+pow(dImQ3n,2.)))
4105                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4106                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));
4107   four3n1n1n1n = (reQ3nQ1nstarQ1nstarQ1nstar-3.*reQ3nQ2nstarQ1nstar-3.*reQ2nQ1nstarQ1nstar
4108                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4109                + 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
4110                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4111   four4n2n1n1n = (reQ4nQ2nstarQ1nstarQ1nstar-2.*reQ4nQ3nstarQ1nstar-reQ4nQ2nstarQ2nstar-2.*reQ3nQ2nstarQ1nstar)
4112                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4113                - (reQ2nQ1nstarQ1nstar-2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4114                - 3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
4115                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4116                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));
4117   four3n1n2n2n = (reQ3nQ1nQ2nstarQ2nstar-reQ4nQ2nstarQ2nstar-reQ4nQ3nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar)
4118                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4119                - (2.*reQ2nQ1nstarQ1nstar-(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4120                - 4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
4121                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4122                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.)); 
4123   four3n1n3n1n = ((pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4124                - 2.*reQ4nQ3nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar
4125                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4126                + pow(dReQ2n,2.)+pow(dImQ2n,2.)-(dMult-4.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4127                + dMult*(dMult-6.))
4128                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));           
4129   // Average 4-particle correlations for single event: 
4130   fIntFlowCorrelationsAllEBE->SetBinContent(11,four1n1n1n1n);
4131   fIntFlowCorrelationsAllEBE->SetBinContent(12,four2n1n2n1n);
4132   fIntFlowCorrelationsAllEBE->SetBinContent(13,four2n2n2n2n);
4133   fIntFlowCorrelationsAllEBE->SetBinContent(14,four3n1n1n1n);
4134   fIntFlowCorrelationsAllEBE->SetBinContent(15,four3n1n3n1n);
4135   fIntFlowCorrelationsAllEBE->SetBinContent(16,four3n1n2n2n);
4136   fIntFlowCorrelationsAllEBE->SetBinContent(17,four4n2n1n1n);       
4137   // Average 4-particle correlations for all events:                
4138   fIntFlowCorrelationsAllPro->Fill(10.5,four1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4139   fIntFlowCorrelationsAllPro->Fill(11.5,four2n1n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4140   fIntFlowCorrelationsAllPro->Fill(12.5,four2n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4141   fIntFlowCorrelationsAllPro->Fill(13.5,four3n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4142   fIntFlowCorrelationsAllPro->Fill(14.5,four3n1n3n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4143   fIntFlowCorrelationsAllPro->Fill(15.5,four3n1n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
4144   fIntFlowCorrelationsAllPro->Fill(16.5,four4n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
4145   // Average 4-particle correlations vs M for all events:                
4146   if(fCalculateAllCorrelationsVsM)
4147   {
4148    fIntFlowCorrelationsAllVsMPro[10]->Fill(dMultiplicityBin,four1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4149    fIntFlowCorrelationsAllVsMPro[11]->Fill(dMultiplicityBin,four2n1n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4150    fIntFlowCorrelationsAllVsMPro[12]->Fill(dMultiplicityBin,four2n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4151    fIntFlowCorrelationsAllVsMPro[13]->Fill(dMultiplicityBin,four3n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4152    fIntFlowCorrelationsAllVsMPro[14]->Fill(dMultiplicityBin,four3n1n3n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4153    fIntFlowCorrelationsAllVsMPro[15]->Fill(dMultiplicityBin,four3n1n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4154    fIntFlowCorrelationsAllVsMPro[16]->Fill(dMultiplicityBin,four4n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4155   }       
4156   // Store separetately <4>:
4157   fIntFlowCorrelationsEBE->SetBinContent(2,four1n1n1n1n); // <4>
4158   // Testing other multiplicity weights:
4159   if(fMultiplicityWeight->Contains("combinations"))
4160   {
4161    mWeight4p = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.);
4162   } else if(fMultiplicityWeight->Contains("unit"))
4163     {
4164      mWeight4p = 1.;    
4165     } else if(fMultiplicityWeight->Contains("multiplicity"))
4166       {
4167        mWeight4p = dMult;           
4168       }      
4169   fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(2,mWeight4p); // eW_<4>
4170   fIntFlowCorrelationsPro->Fill(1.5,four1n1n1n1n,mWeight4p);
4171   fIntFlowSquaredCorrelationsPro->Fill(1.5,four1n1n1n1n*four1n1n1n1n,mWeight4p);
4172   if(fCalculateCumulantsVsM)
4173   {
4174    if(fFillProfilesVsMUsingWeights)  
4175    {
4176     fIntFlowCorrelationsVsMPro[1]->Fill(dMultiplicityBin,four1n1n1n1n,mWeight4p);
4177     fIntFlowSquaredCorrelationsVsMPro[1]->Fill(dMultiplicityBin,four1n1n1n1n*four1n1n1n1n,mWeight4p);
4178    } else
4179      {
4180       fIntFlowCorrelationsVsMPro[1]->Fill(dMultiplicityBin,four1n1n1n1n);
4181       fIntFlowSquaredCorrelationsVsMPro[1]->Fill(dMultiplicityBin,four1n1n1n1n*four1n1n1n1n);
4182      }
4183   } // end of if(fCalculateCumulantsVsM) 
4184   if(fStoreControlHistograms)
4185   {
4186    fCorrelation2468VsMult[1]->Fill(dMultiplicityBin,four1n1n1n1n);
4187    fCorrelationProduct2468VsMult[0]->Fill(dMultiplicityBin,two1n1n*four1n1n1n1n);
4188   } 
4189  } // end of if(dMult>3)
4190
4191  // 5-particle:
4192  Double_t five2n1n1n1n1n = 0.; // <cos(n(2*phi1+phi2-phi3-phi4-phi5))>
4193  Double_t five2n2n2n1n1n = 0.; // <cos(n(2*phi1+2*phi2-2*phi3-phi4-phi5))>
4194  Double_t five3n1n2n1n1n = 0.; // <cos(n(3*phi1+phi2-2*phi3-phi4-phi5))>
4195  Double_t five4n1n1n1n1n = 0.; // <cos(n(4*phi1-phi2-phi3-phi4-phi5))>
4196  if(dMult>4)
4197  {            
4198   five2n1n1n1n1n = (reQ2nQ1nQ1nstarQ1nstarQ1nstar-reQ3nQ1nstarQ1nstarQ1nstar+5.*reQ3nQ2nstarQ1nstar
4199                  - 3.*(dMult-5.)*reQ2nQ1nstarQ1nstar-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4200                  - 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))     
4201                  + 3.*(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4202                  - 3.*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
4203                  + 6.*(2.*dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult*(dMult-4.))
4204                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4205   five2n2n2n1n1n = (reQ2nQ2nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-2.*reQ3nQ1nQ2nstarQ2nstar
4206                  + 3.*reQ4nQ2nstarQ2nstar+8.*reQ3nQ2nstarQ1nstar+2.*reQ4nQ3nstarQ1nstar
4207                  - 2.*(dMult-6.)*reQ2nQ1nstarQ1nstar
4208                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4209                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)
4210                  + 2.*(3.*dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4211                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4212                  + 4.*(dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
4213                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4214   five4n1n1n1n1n = (reQ4nQ1nstarQ1nstarQ1nstarQ1nstar-6.*reQ4nQ2nstarQ1nstarQ1nstar-4.*reQ3nQ1nstarQ1nstarQ1nstar
4215                  + 8.*reQ4nQ3nstarQ1nstar+3.*reQ4nQ2nstarQ2nstar+12.*reQ3nQ2nstarQ1nstar+12.*reQ2nQ1nstarQ1nstar
4216                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-8.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4217                  - 12.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-24.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+24.*dMult)
4218                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4219   five3n1n2n1n1n = (reQ3nQ1nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ3nQ1nstarQ1nstarQ1nstar
4220                  - reQ3nQ1nQ2nstarQ2nstar+4.*reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar
4221                  - (2.*dMult-13.)*reQ3nQ2nstarQ1nstar+7.*reQ2nQ1nstarQ1nstar
4222                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4223                  + 2.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4224                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4225                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4226                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4227                  - pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
4228                  + 2.*(3.*dMult-11.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
4229                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));                 
4230   // Average 5-particle correlations for single event: 
4231   fIntFlowCorrelationsAllEBE->SetBinContent(19,five2n1n1n1n1n);
4232   fIntFlowCorrelationsAllEBE->SetBinContent(20,five2n2n2n1n1n);
4233   fIntFlowCorrelationsAllEBE->SetBinContent(21,five3n1n2n1n1n);
4234   fIntFlowCorrelationsAllEBE->SetBinContent(22,five4n1n1n1n1n);        
4235   // Average 5-particle correlations for all events:                         
4236   fIntFlowCorrelationsAllPro->Fill(18.5,five2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
4237   fIntFlowCorrelationsAllPro->Fill(19.5,five2n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4238   fIntFlowCorrelationsAllPro->Fill(20.5,five3n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4239   fIntFlowCorrelationsAllPro->Fill(21.5,five4n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
4240   // Average 5-particle correlations vs M for all events:                
4241   if(fCalculateAllCorrelationsVsM)
4242   {
4243    fIntFlowCorrelationsAllVsMPro[18]->Fill(dMultiplicityBin,five2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4244    fIntFlowCorrelationsAllVsMPro[19]->Fill(dMultiplicityBin,five2n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4245    fIntFlowCorrelationsAllVsMPro[20]->Fill(dMultiplicityBin,five3n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4246    fIntFlowCorrelationsAllVsMPro[21]->Fill(dMultiplicityBin,five4n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4247   }    
4248  } // end of if(dMult>4)
4249     
4250  // 6-particle:
4251  Double_t six1n1n1n1n1n1n = 0.; // <cos(n(phi1+phi2+phi3-phi4-phi5-phi6))>
4252  Double_t six2n2n1n1n1n1n = 0.; // <cos(n(2*phi1+2*phi2-phi3-phi4-phi5-phi6))>
4253  Double_t six3n1n1n1n1n1n = 0.; // <cos(n(3*phi1+phi2-phi3-phi4-phi5-phi6))>
4254  Double_t six2n1n1n2n1n1n = 0.; // <cos(n(2*phi1+phi2+phi3-2*phi4-phi5-phi6))>
4255  Double_t mWeight6p = 0.; // multiplicity weight for 6-p correlations
4256  if(dMult>5)
4257  {
4258   six1n1n1n1n1n1n = (pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),3.)-6.*reQ2nQ1nQ1nstarQ1nstarQ1nstar
4259                   + 4.*reQ3nQ1nstarQ1nstarQ1nstar-12.*reQ3nQ2nstarQ1nstar+18.*(dMult-4.)*reQ2nQ1nstarQ1nstar
4260                   + 9.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4261                   + 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-9.*(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4262                   - 9.*(dMult-4.)*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.) 
4263                   + 18.*(dMult*dMult-7.*dMult+10.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4264                   - 6.*dMult*(dMult*dMult-9.*dMult+20.))
4265                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4266   six2n1n1n2n1n1n = (dQ2nQ1nQ1nQ2nstarQ1nstarQ1nstar-4.*reQ3nQ1nQ2nstarQ1nstarQ1nstar
4267                   - 4.*reQ2nQ1nQ1nstarQ1nstarQ1nstar-2.*reQ2nQ2nQ2nstarQ1nstarQ1nstar
4268                   + 4.*reQ4nQ2nstarQ1nstarQ1nstar+4.*reQ3nQ1nQ2nstarQ2nstar+4.*reQ3nQ1nstarQ1nstarQ1nstar
4269                   - 8.*reQ4nQ3nstarQ1nstar-4.*reQ4nQ2nstarQ2nstar+4.*(2.*dMult-13.)*reQ3nQ2nstarQ1nstar
4270                   + 2.*(7.*dMult-34.)*reQ2nQ1nstarQ1nstar+4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4271                   - 4.*(dMult-7.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4272                   + 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4273                   + pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)+(2.*dMult*dMult-27.*dMult+76.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4274                   - (dMult-12.)*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
4275                   + 4.*(dMult*dMult-15.*dMult+34.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4276                   - 2.*dMult*(dMult*dMult-17.*dMult+60.))
4277                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4278   six2n2n1n1n1n1n = (reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar-6.*reQ2nQ2nQ2nstarQ1nstarQ1nstar-reQ4nQ1nstarQ1nstarQ1nstarQ1nstar
4279                   - 8.*reQ2nQ1nQ1nstarQ1nstarQ1nstar+8.*reQ3nQ1nstarQ1nstarQ1nstar+6.*reQ4nQ2nstarQ1nstarQ1nstar
4280                   + 8.*reQ3nQ1nQ2nstarQ2nstar-40.*reQ3nQ2nstarQ1nstar-8.*reQ4nQ3nstarQ1nstar-9.*reQ4nQ2nstarQ2nstar
4281                   + 24.*(dMult-4.)*reQ2nQ1nstarQ1nstar+24.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4282                   + 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+16.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4283                   + 3.*pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)-12.*(2.*dMult-7.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4284                   + 12.*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)-48.*(dMult-3.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4285                   + 24.*dMult*(dMult-5.))
4286                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
4287   six3n1n1n1n1n1n = (reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar-6.*reQ3nQ1nQ2nstarQ1nstarQ1nstar+6.*reQ4nQ2nstarQ1nstarQ1nstar
4288                   - reQ4nQ1nstarQ1nstarQ1nstarQ1nstar-4.*reQ2nQ1nQ1nstarQ1nstarQ1nstar+3.*reQ3nQ1nQ2nstarQ2nstar
4289                   - 4.*(dMult-5.)*reQ3nQ1nstarQ1nstarQ1nstar-14.*reQ4nQ3nstarQ1nstar
4290                   - 3.*reQ4nQ2nstarQ2nstar+4.*(3.*dMult-17.)*reQ3nQ2nstarQ1nstar+12.*(dMult-6.)*reQ2nQ1nstarQ1nstar
4291                   + 12.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))  
4292                   + 8.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))  
4293                   + 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-8.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
4294                   - 12.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-48.*(dMult-3.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4295                   + 12.*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)+24.*dMult*(dMult-5.))
4296                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4297   // Average 6-particle correlations for single event: 
4298   fIntFlowCorrelationsAllEBE->SetBinContent(24,six1n1n1n1n1n1n);
4299   fIntFlowCorrelationsAllEBE->SetBinContent(25,six2n1n1n2n1n1n);
4300   fIntFlowCorrelationsAllEBE->SetBinContent(26,six2n2n1n1n1n1n);
4301   fIntFlowCorrelationsAllEBE->SetBinContent(27,six3n1n1n1n1n1n);
4302   // Average 6-particle correlations for all events:         
4303   fIntFlowCorrelationsAllPro->Fill(23.5,six1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
4304   fIntFlowCorrelationsAllPro->Fill(24.5,six2n1n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
4305   fIntFlowCorrelationsAllPro->Fill(25.5,six2n2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4306   fIntFlowCorrelationsAllPro->Fill(26.5,six3n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
4307   // Average 6-particle correlations vs M for all events:                
4308   if(fCalculateAllCorrelationsVsM)
4309   {
4310    fIntFlowCorrelationsAllVsMPro[23]->Fill(dMultiplicityBin,six1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4311    fIntFlowCorrelationsAllVsMPro[24]->Fill(dMultiplicityBin,six2n1n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4312    fIntFlowCorrelationsAllVsMPro[25]->Fill(dMultiplicityBin,six2n2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4313    fIntFlowCorrelationsAllVsMPro[26]->Fill(dMultiplicityBin,six3n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4314   }    
4315   // Store separetately <6>:
4316   fIntFlowCorrelationsEBE->SetBinContent(3,six1n1n1n1n1n1n); // <6>
4317   // Testing other multiplicity weights:
4318   if(fMultiplicityWeight->Contains("combinations"))
4319   {
4320    mWeight6p = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.);
4321   } else if(fMultiplicityWeight->Contains("unit"))
4322     {
4323      mWeight6p = 1.;    
4324     } else if(fMultiplicityWeight->Contains("multiplicity"))
4325       {
4326        mWeight6p = dMult;           
4327       }
4328   fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(3,mWeight6p); // eW_<6>
4329   fIntFlowCorrelationsPro->Fill(2.5,six1n1n1n1n1n1n,mWeight6p);
4330   fIntFlowSquaredCorrelationsPro->Fill(2.5,six1n1n1n1n1n1n*six1n1n1n1n1n1n,mWeight6p);
4331   if(fCalculateCumulantsVsM)
4332   {
4333    if(fFillProfilesVsMUsingWeights)  
4334    {
4335     fIntFlowCorrelationsVsMPro[2]->Fill(dMultiplicityBin,six1n1n1n1n1n1n,mWeight6p);
4336     fIntFlowSquaredCorrelationsVsMPro[2]->Fill(dMultiplicityBin,six1n1n1n1n1n1n*six1n1n1n1n1n1n,mWeight6p);
4337    } else
4338      {
4339       fIntFlowCorrelationsVsMPro[2]->Fill(dMultiplicityBin,six1n1n1n1n1n1n);
4340       fIntFlowSquaredCorrelationsVsMPro[2]->Fill(dMultiplicityBin,six1n1n1n1n1n1n*six1n1n1n1n1n1n);
4341      }
4342   } // end of if(fCalculateCumulantsVsM)
4343   if(fStoreControlHistograms)
4344   {
4345    fCorrelation2468VsMult[2]->Fill(dMultiplicityBin,six1n1n1n1n1n1n);
4346   }     
4347  } // end of if(dMult>5)
4348  
4349  // 7-particle:
4350  Double_t seven2n1n1n1n1n1n1n = 0.; // <cos(n(2*phi1+phi2+phi3-phi4-phi5-phi6-phi7))>
4351  if(dMult>6)
4352  {
4353   seven2n1n1n1n1n1n1n = (reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar-4.*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),3.)
4354                       - reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar-2.*reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar
4355                       + 9.*reQ2nQ2nQ2nstarQ1nstarQ1nstar+20.*reQ3nQ1nQ2nstarQ1nstarQ1nstar 
4356                       + 2.*reQ4nQ1nstarQ1nstarQ1nstarQ1nstar-8.*(dMult-8.)*reQ2nQ1nQ1nstarQ1nstarQ1nstar
4357                       - 18.*reQ4nQ2nstarQ1nstarQ1nstar-14.*reQ3nQ1nQ2nstarQ2nstar
4358                       + 8.*(dMult-7.)*reQ3nQ1nstarQ1nstarQ1nstar+28.*reQ4nQ3nstarQ1nstar
4359                       + 12.*reQ4nQ2nstarQ2nstar-8.*(5.*dMult-31.)*reQ3nQ2nstarQ1nstar      
4360                       + 12.*(dMult*dMult-15.*dMult+46.)*reQ2nQ1nstarQ1nstar
4361                       - 16.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4362                       - 6.*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4363                       - 3.*pow(pow(dReQ2n,2.)+pow(dImQ2n,2.),2.)
4364                       + 12.*(2.*dMult-13.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4365                       - 12.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+16.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4366                       - 12.*(dMult-8.)*(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4367                       + 12.*(3.*dMult-14.)*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.)
4368                       - 24.*(3.*dMult-7.)*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4369                       + 24.*dMult*(dMult-5.)*(dMult-6.))
4370                       / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.));   
4371   // Average 7-particle correlations for single event: 
4372   fIntFlowCorrelationsAllEBE->SetBinContent(29,seven2n1n1n1n1n1n1n);       
4373   // Average 7-particle correlations for all events:                      
4374   fIntFlowCorrelationsAllPro->Fill(28.5,seven2n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
4375                                                                  *(dMult-4.)*(dMult-5.)*(dMult-6.));
4376   // Average 7-particle correlations vs M for all events:                
4377   if(fCalculateAllCorrelationsVsM)
4378   {
4379    fIntFlowCorrelationsAllVsMPro[28]->Fill(dMultiplicityBin,seven2n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
4380                                                                               *(dMult-4.)*(dMult-5.)*(dMult-6.));
4381   }    
4382  } // end of if(dMult>6)
4383  
4384  // 8-particle:
4385  Double_t eight1n1n1n1n1n1n1n1n = 0.; // <cos(n(phi1+phi2+phi3+phi4-phi5-phi6-phi7-phi8))>
4386  Double_t mWeight8p = 0.; // multiplicity weight for 8-p correlations
4387  if(dMult>7)
4388  {  
4389   eight1n1n1n1n1n1n1n1n = (pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),4.)-12.*reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar
4390                         + 16.*reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar+6.*reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar
4391                         - 12.*reQ4nQ1nstarQ1nstarQ1nstarQ1nstar-36.*reQ2nQ2nQ2nstarQ1nstarQ1nstar
4392                         - 96.*reQ3nQ1nQ2nstarQ1nstarQ1nstar
4393                         + 72.*reQ4nQ2nstarQ1nstarQ1nstar+48.*reQ3nQ1nQ2nstarQ2nstar
4394                         - 64.*(dMult-6.)*reQ3nQ1nstarQ1nstarQ1nstar
4395                         + 96.*(dMult-6.)*reQ2nQ1nQ1nstarQ1nstarQ1nstar
4396                         - 96.*reQ4nQ3nstarQ1nstar-36.*reQ4nQ2nstarQ2nstar
4397                         + 192.*(dMult-6.)*reQ3nQ2nstarQ1nstar
4398                         - 144.*(dMult-7.)*(dMult-4.)*reQ2nQ1nstarQ1nstar
4399                         + 64.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4400                         - 144.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4401                         + 72.*(dMult-7.)*(dMult-4.)*(pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
4402                         - 96.*(dMult-7.)*(dMult-6.)*(dMult-2.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4403                         + 36.*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4404                         + 9.*pow(pow(dReQ2n,2.)+pow(dImQ2n,2.),2.)
4405                         - 64.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4406                         + 36.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4407                         - 16.*(dMult-6.)*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),3.)
4408                         + 24.*dMult*(dMult-7.)*(dMult-6.)*(dMult-5.))
4409                         / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));   
4410   // Average 8-particle correlations for single event: 
4411   fIntFlowCorrelationsAllEBE->SetBinContent(31,eight1n1n1n1n1n1n1n1n);      
4412   // Average 8-particle correlations for all events:                       
4413   fIntFlowCorrelationsAllPro->Fill(30.5,eight1n1n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
4414                                                                    *(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));
4415   // Average 8-particle correlations vs M for all events:                
4416   if(fCalculateAllCorrelationsVsM)
4417   {
4418    fIntFlowCorrelationsAllVsMPro[30]->Fill(dMultiplicityBin,eight1n1n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
4419                                                                                 *(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));
4420   }     
4421   // Store separetately <8>:
4422   fIntFlowCorrelationsEBE->SetBinContent(4,eight1n1n1n1n1n1n1n1n); // <8>
4423   // Testing other multiplicity weights:
4424   if(fMultiplicityWeight->Contains("combinations"))
4425   {
4426    mWeight8p = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.);
4427   } else if(fMultiplicityWeight->Contains("unit"))
4428     {
4429      mWeight8p = 1.;    
4430     } else if(fMultiplicityWeight->Contains("multiplicity"))
4431       {
4432        mWeight8p = dMult;           
4433       }        
4434   fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(4,mWeight8p); // eW_<8>
4435   fIntFlowCorrelationsPro->Fill(3.5,eight1n1n1n1n1n1n1n1n,mWeight8p);
4436   fIntFlowSquaredCorrelationsPro->Fill(3.5,eight1n1n1n1n1n1n1n1n*eight1n1n1n1n1n1n1n1n,mWeight8p);  
4437   if(fCalculateCumulantsVsM)
4438   {
4439    if(fFillProfilesVsMUsingWeights)  
4440    {
4441     fIntFlowCorrelationsVsMPro[3]->Fill(dMultiplicityBin,eight1n1n1n1n1n1n1n1n,mWeight8p);
4442     fIntFlowSquaredCorrelationsVsMPro[3]->Fill(dMultiplicityBin,eight1n1n1n1n1n1n1n1n*eight1n1n1n1n1n1n1n1n,mWeight8p);
4443    } else
4444      {
4445       fIntFlowCorrelationsVsMPro[3]->Fill(dMultiplicityBin,eight1n1n1n1n1n1n1n1n);
4446       fIntFlowSquaredCorrelationsVsMPro[3]->Fill(dMultiplicityBin,eight1n1n1n1n1n1n1n1n*eight1n1n1n1n1n1n1n1n);
4447      } 
4448   } // end of if(fCalculateCumulantsVsM)
4449   if(fStoreControlHistograms)
4450   {
4451    fCorrelation2468VsMult[3]->Fill(dMultiplicityBin,eight1n1n1n1n1n1n1n1n);
4452   } // end of if(fStoreControlHistograms)  
4453  } // end of if(dMult>7) 
4454  
4455  // EXTRA correlations for v3{5} study:
4456  // 4-particle:
4457  Double_t four4n2n3n3n = 0.; // <cos(n(4*phi1+2*phi2-3*phi3-3*phi4))>
4458  if(dMult>3.)
4459  {
4460   four4n2n3n3n = (reQ4nQ2nQ3nstarQ3nstar-reQ6nQ4nstarQ2nstar-reQ6nQ3nstarQ3nstar
4461                - 2.*reQ4nQ3nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar
4462                + (pow(dReQ6n,2.)+pow(dImQ6n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4463                + 2.*(2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4464                + (pow(dReQ1n,2.)+pow(dImQ1n,2.))-3.*dMult))
4465                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));               
4466   fIntFlowCorrelationsAllPro->Fill(32.5,four4n2n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4467   // Average 4-particle correlations vs M for all events:                
4468   if(fCalculateAllCorrelationsVsM)
4469   {
4470    fIntFlowCorrelationsAllVsMPro[32]->Fill(dMultiplicityBin,four4n2n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4471   }    
4472  } // end of if(dMult>3.)
4473  
4474  // 5-particle:
4475  Double_t five3n3n2n2n2n = 0.; // <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-2*phi5))>                                    
4476  if(dMult>4.)
4477  {
4478   five3n3n2n2n2n = (reQ3nQ3nQ2nstarQ2nstarQ2nstar-reQ6nQ2nstarQ2nstarQ2nstar-3.*reQ4nQ2nQ3nstarQ3nstar 
4479                  - 6.*reQ3nQ1nQ2nstarQ2nstar+2.*reQ6nQ3nstarQ3nstar+3.*reQ6nQ4nstarQ2nstar
4480                  + 6.*reQ4nQ3nstarQ1nstar+6.*reQ4nQ2nstarQ2nstar
4481                  + 12.*reQ3nQ2nstarQ1nstar+6.*reQ2nQ1nstarQ1nstar
4482                  - 2.*((pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
4483                  + 3.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4484                  + 6.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
4485                  + 9.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4486                  + 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-12.*dMult))
4487                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4488   fIntFlowCorrelationsAllPro->Fill(33.5,five3n3n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4489   if(fCalculateAllCorrelationsVsM)
4490   {
4491    fIntFlowCorrelationsAllVsMPro[33]->Fill(dMultiplicityBin,five3n3n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4492   }     
4493  } // end of if(dMult>4.)
4494  
4495  // EXTRA correlations for Teaney-Yan study: 
4496  // 2-particle:
4497  Double_t two5n5n = 0.; // <cos(5n(phi1-phi2))>
4498  Double_t two6n6n = 0.; // <cos(6n(phi1-phi2))> 
4499  if(dMult>1)
4500  {
4501   two5n5n = (pow(dReQ5n,2.)+pow(dImQ5n,2.)-dMult)/(dMult*(dMult-1.)); 
4502   two6n6n = (pow(dReQ6n,2.)+pow(dImQ6n,2.)-dMult)/(dMult*(dMult-1.));        
4503   // Average 2-particle correlations for all events:      
4504   fIntFlowCorrelationsAllPro->Fill(34.5,two5n5n,dMult*(dMult-1.));
4505   fIntFlowCorrelationsAllPro->Fill(35.5,two6n6n,dMult*(dMult-1.)); 
4506   if(fCalculateAllCorrelationsVsM)
4507   {
4508    fIntFlowCorrelationsAllVsMPro[34]->Fill(dMultiplicityBin,two5n5n,dMult*(dMult-1.));
4509    fIntFlowCorrelationsAllVsMPro[35]->Fill(dMultiplicityBin,two6n6n,dMult*(dMult-1.));
4510   }       
4511  } // end of if(dMult>1)
4512  
4513  // 3-particle:
4514  Double_t three5n3n2n = 0.; // <cos(n(5*phi1-3*phi2-2*phi3)> 
4515  Double_t three5n4n1n = 0.; // <cos(n(5*phi1-4*phi2-1*phi3)> 
4516  Double_t three6n3n3n = 0.; // <cos(n(6*phi1-3*phi2-3*phi3)> 
4517  Double_t three6n4n2n = 0.; // <cos(n(6*phi1-4*phi2-2*phi3)> 
4518  Double_t three6n5n1n = 0.; // <cos(n(6*phi1-5*phi2-1*phi3)> 
4519  if(dMult>2)
4520  {
4521   three5n3n2n = (reQ5nQ3nstarQ2nstar-(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4522               - (pow(dReQ3n,2.)+pow(dImQ3n,2.))
4523               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
4524               / (dMult*(dMult-1.)*(dMult-2.));           
4525   three5n4n1n = (reQ5nQ4nstarQ1nstar-(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4526               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))
4527               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4528               / (dMult*(dMult-1.)*(dMult-2.));                          
4529   three6n3n3n = (reQ6nQ3nstarQ3nstar-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4530               - (pow(dReQ6n,2.)+pow(dImQ6n,2.))+2.*dMult)
4531               / (dMult*(dMult-1.)*(dMult-2.)); 
4532   three6n4n2n = (reQ6nQ4nstarQ2nstar-(pow(dReQ6n,2.)+pow(dImQ6n,2.))
4533               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))
4534               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
4535               / (dMult*(dMult-1.)*(dMult-2.));
4536   three6n5n1n = (reQ6nQ5nstarQ1nstar-(pow(dReQ6n,2.)+pow(dImQ6n,2.))
4537               - (pow(dReQ5n,2.)+pow(dImQ5n,2.))
4538               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4539               / (dMult*(dMult-1.)*(dMult-2.));            
4540   // Average 3-particle correlations for all events:      
4541   fIntFlowCorrelationsAllPro->Fill(36.5,three5n3n2n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(5*phi1-3*phi2-2*phi3)>> 
4542   fIntFlowCorrelationsAllPro->Fill(37.5,three5n4n1n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(5*phi1-4*phi2-1*phi3)>> 
4543   fIntFlowCorrelationsAllPro->Fill(38.5,three6n3n3n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(6*phi1-3*phi2-3*phi3)>> 
4544   fIntFlowCorrelationsAllPro->Fill(39.5,three6n4n2n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(6*phi1-4*phi2-2*phi3)>>
4545   fIntFlowCorrelationsAllPro->Fill(40.5,three6n5n1n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(6*phi1-5*phi2-1*phi3)>>
4546   if(fCalculateAllCorrelationsVsM)
4547   {
4548    fIntFlowCorrelationsAllVsMPro[36]->Fill(dMultiplicityBin,three5n3n2n,dMult*(dMult-1.)*(dMult-2.));
4549    fIntFlowCorrelationsAllVsMPro[37]->Fill(dMultiplicityBin,three5n4n1n,dMult*(dMult-1.)*(dMult-2.));
4550    fIntFlowCorrelationsAllVsMPro[38]->Fill(dMultiplicityBin,three6n3n3n,dMult*(dMult-1.)*(dMult-2.));
4551    fIntFlowCorrelationsAllVsMPro[39]->Fill(dMultiplicityBin,three6n4n2n,dMult*(dMult-1.)*(dMult-2.));
4552    fIntFlowCorrelationsAllVsMPro[40]->Fill(dMultiplicityBin,three6n5n1n,dMult*(dMult-1.)*(dMult-2.));
4553   }       
4554  } // end of if(dMult>2)
4555  
4556  // 4-particle:
4557  Double_t four6n3n2n1n = 0.; // <cos(n(6*phi1-3*phi2-2*phi3-1*phi4)>
4558  Double_t four3n2n3n2n = 0.; // <cos(n(3*phi1+2*phi2-3*phi3-2*phi4)>
4559  Double_t four4n1n3n2n = 0.; // <cos(n(4*phi1+1*phi2-3*phi3-2*phi4)> 
4560  Double_t four3n3n3n3n = 0.; // <cos(3n(phi1+phi2-phi3-phi4))> 
4561  //Double_t four4n2n3n3n = 0.; // <cos(n(4*phi1+2*phi2-3*phi3-3*phi4)> // I already have this one above
4562  Double_t four5n1n3n3n = 0.; // <cos(n(5*phi1+1*phi2-3*phi3-3*phi4)>
4563  Double_t four4n2n4n2n = 0.; // <cos(n(4*phi1+2*phi2-4*phi3-2*phi4)> 
4564  Double_t four5n1n4n2n = 0.; // <cos(n(5*phi1+1*phi2-4*phi3-2*phi4)> 
4565  Double_t four5n3n1n1n = 0.; // <cos(n(5*phi1-3*phi2-1*phi3-1*phi4)> 
4566  Double_t four5n2n2n1n = 0.; // <cos(n(5*phi1-2*phi2-2*phi3-1*phi4)>
4567  Double_t four5n1n5n1n = 0.; // <cos(n(5*phi1+1*phi2-5*phi3-1*phi4)>
4568  Double_t four6n4n1n1n = 0.; // <cos(n(6*phi1-4*phi2-1*phi3-1*phi4)>
4569  Double_t four6n2n2n2n = 0.; // <cos(n(6*phi1-2*phi2-2*phi3-2*phi4)>
4570  if(dMult>3)
4571  {
4572   four6n3n2n1n = (reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ4nstarQ2nstar-reQ6nQ3nstarQ3nstar-reQ6nQ5nstarQ1nstar
4573                - reQ5nQ3nstarQ2nstar-reQ4nQ3nstarQ1nstar-reQ3nQ2nstarQ1nstar
4574                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+pow(dReQ5n,2.)+pow(dImQ5n,2.)
4575                + pow(dReQ4n,2.)+pow(dImQ4n,2.)+3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4576                + 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
4577                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4578   four3n2n3n2n = (dQ3nQ2nQ3nstarQ2nstar-2.*reQ5nQ3nstarQ2nstar-2.*reQ3nQ2nstarQ1nstar
4579                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)               
4580                -(dMult-4.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
4581                + dMult*(dMult-6.))
4582                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));     
4583   four4n1n3n2n = (reQ4nQ1nQ3nstarQ2nstar-reQ5nQ3nstarQ2nstar-reQ5nQ4nstarQ1nstar-reQ4nQ3nstarQ1nstar
4584                - reQ4nQ2nstarQ2nstar-reQ3nQ2nstarQ1nstar-reQ2nQ1nstarQ1nstar
4585                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4586                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4587                + 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
4588                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));                             
4589   four3n3n3n3n = (2.*dMult*(dMult-3.)+pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ3n,2.)
4590                + pow(dImQ3n,2.))-2.*reQ6nQ3nstarQ3nstar+(pow(dReQ6n,2.)+pow(dImQ6n,2.)))
4591                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));   
4592   //four4n2n3n3n = ; // I already have this one above
4593   four5n1n3n3n = (reQ5nQ1nQ3nstarQ3nstar-reQ6nQ5nstarQ1nstar-reQ6nQ3nstarQ3nstar-2.*reQ5nQ3nstarQ2nstar
4594                - 2.*reQ3nQ2nstarQ1nstar+pow(dReQ6n,2.)+pow(dImQ6n,2.)+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4595                + 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4596                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)                                  
4597                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));   
4598   four4n2n4n2n = (dQ4nQ2nQ4nstarQ2nstar-2.*reQ6nQ4nstarQ2nstar-2.*reQ4nQ2nstarQ2nstar)
4599                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4600                - ((dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4601                + (dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-(pow(dReQ6n,2.)+pow(dImQ6n,2.)))
4602                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4603                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.)); 
4604   four5n1n4n2n = (reQ5nQ1nQ4nstarQ2nstar-reQ6nQ5nstarQ1nstar-reQ6nQ4nstarQ2nstar-reQ5nQ4nstarQ1nstar
4605                - reQ5nQ3nstarQ2nstar-reQ4nQ3nstarQ1nstar-reQ2nQ1nstarQ1nstar+pow(dReQ6n,2.)+pow(dImQ6n,2.)
4606                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4607                + pow(dReQ3n,2.)+pow(dImQ3n,2.)+2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4608                + 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
4609                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));     
4610   four5n3n1n1n = (reQ5nQ3nstarQ1nstarQ1nstar-2.*reQ5nQ4nstarQ1nstar-reQ5nQ3nstarQ2nstar-2.*reQ4nQ3nstarQ1nstar
4611                - reQ2nQ1nstarQ1nstar+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4612                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+pow(dReQ2n,2.)+pow(dImQ2n,2.)
4613                + 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
4614                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));                    
4615   four5n2n2n1n = (reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ4nstarQ1nstar-2.*reQ5nQ3nstarQ2nstar-reQ4nQ2nstarQ2nstar
4616                - 2.*reQ3nQ2nstarQ1nstar+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+pow(dReQ4n,2.)+pow(dImQ4n,2.)
4617                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4618                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
4619                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));   
4620   four5n1n5n1n = (dQ5nQ1nQ5nstarQ1nstar-2.*reQ6nQ5nstarQ1nstar-2.*reQ5nQ4nstarQ1nstar
4621                + pow(dReQ6n,2.)+pow(dImQ6n,2.)-(dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4622                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+dMult*(dMult-6.))  
4623                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));    
4624                               
4625   // TBI: Recursive formula needed:
4626   four6n4n1n1n = (reQ6nQ4nstarQ1nstarQ1nstar
4627                - dMult*(dMult-1.)*(dMult-2.)*(three2n1n1n+2.*three5n4n1n+2.*three6n5n1n+three6n4n2n)
4628                - dMult*(dMult-1.)*(2.*two1n1n+1.*two4n4n+1.*two6n6n+1.*two2n2n+2.*two5n5n)
4629                - 1.*dMult)
4630                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4631   
4632   four6n2n2n2n = (reQ6nQ2nstarQ2nstarQ2nstar-3.*reQ6nQ4nstarQ2nstar-3.*reQ4nQ2nstarQ2nstar
4633                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+3.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4634                + 6.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-6.*dMult)
4635                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4636   // Average 4-particle correlations for all events:      
4637   fIntFlowCorrelationsAllPro->Fill(41.5,four6n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4638   fIntFlowCorrelationsAllPro->Fill(42.5,four3n2n3n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4639   fIntFlowCorrelationsAllPro->Fill(43.5,four4n1n3n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4640   fIntFlowCorrelationsAllPro->Fill(44.5,four3n3n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4641   //fIntFlowCorrelationsAllPro->Fill(45.5,four4n2n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); // I already have this one above
4642   fIntFlowCorrelationsAllPro->Fill(46.5,four5n1n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4643   fIntFlowCorrelationsAllPro->Fill(47.5,four4n2n4n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4644   fIntFlowCorrelationsAllPro->Fill(48.5,four5n1n4n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4645   fIntFlowCorrelationsAllPro->Fill(49.5,four5n3n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4646   fIntFlowCorrelationsAllPro->Fill(50.5,four5n2n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4647   fIntFlowCorrelationsAllPro->Fill(51.5,four5n1n5n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4648   fIntFlowCorrelationsAllPro->Fill(58.5,four6n4n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4649   fIntFlowCorrelationsAllPro->Fill(59.5,four6n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4650   if(fCalculateAllCorrelationsVsM)
4651   {
4652    fIntFlowCorrelationsAllVsMPro[41]->Fill(dMultiplicityBin,four6n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4653    fIntFlowCorrelationsAllVsMPro[42]->Fill(dMultiplicityBin,four3n2n3n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4654    fIntFlowCorrelationsAllVsMPro[43]->Fill(dMultiplicityBin,four4n1n3n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4655    fIntFlowCorrelationsAllVsMPro[44]->Fill(dMultiplicityBin,four3n3n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4656    //fIntFlowCorrelationsAllVsMPro[45]->Fill(dMultiplicityBin,four4n2n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4657    fIntFlowCorrelationsAllVsMPro[46]->Fill(dMultiplicityBin,four5n1n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4658    fIntFlowCorrelationsAllVsMPro[47]->Fill(dMultiplicityBin,four4n2n4n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4659    fIntFlowCorrelationsAllVsMPro[48]->Fill(dMultiplicityBin,four5n1n4n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4660    fIntFlowCorrelationsAllVsMPro[49]->Fill(dMultiplicityBin,four5n3n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4661    fIntFlowCorrelationsAllVsMPro[50]->Fill(dMultiplicityBin,four5n2n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4662    fIntFlowCorrelationsAllVsMPro[51]->Fill(dMultiplicityBin,four5n1n5n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4663    fIntFlowCorrelationsAllVsMPro[58]->Fill(dMultiplicityBin,four6n4n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4664    fIntFlowCorrelationsAllVsMPro[59]->Fill(dMultiplicityBin,four6n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4665   }       
4666  } // end of if(dMult>3)
4667
4668  // 5-particle:
4669  Double_t five3n3n3n2n1n = 0.; // <cos(n(3*phi1+3*phi2-3*phi3-2*phi4-1*phi5)>
4670  Double_t five4n2n3n2n1n = 0.; // <cos(n(4*phi1+2*phi2-3*phi3-2*phi4-1*phi5)>
4671  Double_t five3n2n3n1n1n = 0.; // <cos(n(3*phi1+2*phi2-3*phi3-1*phi4-1*phi5)>
4672  Double_t five3n2n2n2n1n = 0.; // <cos(n(3*phi1+2*phi2-2*phi3-2*phi4-1*phi5)>
4673  Double_t five5n1n3n2n1n = 0.; // <cos(n(5*phi1+1*phi2-3*phi3-2*phi4-1*phi5)>
4674  Double_t five6n2n2n1n1n = 0.; // <cos(n(6*phi1-2*phi2-2*phi3-1*phi4-1*phi5)>
4675  Double_t five4n1n1n3n3n = 0.; // <cos(n(4*phi1+1*phi2+1*phi3-3*phi4-3*phi5)>
4676  if(dMult>4)
4677  { 
4678   five3n3n3n2n1n = (reQ3nQ3nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ5nQ1nQ3nstarQ3nstar-reQ4nQ2nQ3nstarQ3nstar
4679                  + reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+3.*reQ6nQ3nstarQ3nstar+4.*reQ5nQ3nstarQ2nstar+4.*reQ4nQ3nstarQ1nstar
4680                  - 2.*(dMult-6.)*reQ3nQ2nstarQ1nstar-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
4681                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4682                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4683                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(3.*dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4684                  - pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)+2.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4685                  + 2.*(dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
4686                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));                                  
4687   five4n2n3n2n1n = (reQ4nQ2nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar
4688                  - reQ4nQ2nQ3nstarQ3nstar-reQ4nQ1nQ3nstarQ2nstar-reQ4nQ2nstarQ1nstarQ1nstar
4689                  - reQ3nQ1nQ2nstarQ2nstar-(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4690                  + 3.*reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ6nQ3nstarQ3nstar+reQ5nQ4nstarQ1nstar
4691                  + 3.*reQ5nQ3nstarQ2nstar-(dMult-7.)*reQ4nQ3nstarQ1nstar+3.*reQ4nQ2nstarQ2nstar+7.*reQ3nQ2nstarQ1nstar
4692                  + 4.*reQ2nQ1nstarQ1nstar-(pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4693                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4694                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4695                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4696                  + 2.*(dMult-7.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+(dMult-12.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4697                  - 2.*dMult*(dMult-12.))
4698                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));   
4699   five3n2n3n1n1n = (reQ3nQ2nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-2.*reQ4nQ1nQ3nstarQ2nstar-reQ3nQ1nstarQ1nstarQ1nstar
4700                  - 2.*reQ3nQ1nQ2nstarQ2nstar+2.*reQ5nQ4nstarQ1nstar+3.*reQ5nQ3nstarQ2nstar+6.*reQ4nQ3nstarQ1nstar
4701                  + 2.*reQ4nQ2nstarQ2nstar+9.*reQ3nQ2nstarQ1nstar-(dMult-8.)*reQ2nQ1nstarQ1nstar
4702                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
4703                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
4704                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4705                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(dMult-12.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4706                  + 2.*(dMult-9.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.))
4707                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4708   five3n2n2n2n1n = (reQ3nQ2nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ4nQ1nQ3nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar
4709                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+reQ5nQ4nstarQ1nstar
4710                  + 4.*reQ5nQ3nstarQ2nstar+reQ4nQ3nstarQ1nstar+3.*reQ4nQ2nstarQ2nstar-2.*(dMult-6.)*reQ3nQ2nstarQ1nstar
4711                  + 4.*reQ2nQ1nstarQ1nstar-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4712                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4713                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4714                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)+2.*(3.*dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4715                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
4716                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
4717   five5n1n3n2n1n = (reQ5nQ1nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ3nstarQ3nstar
4718                  - reQ4nQ1nQ3nstarQ2nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar 
4719                  + 3.*reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ3nstarQ3nstar+4.*reQ5nQ4nstarQ1nstar
4720                  - (dMult-7.)*reQ5nQ3nstarQ2nstar+4.*reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar+6.*reQ3nQ2nstarQ1nstar
4721                  + 3.*reQ2nQ1nstarQ1nstar-(pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4722                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4723                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4724                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+(dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))  
4725                  - 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4726                  + (dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*(dMult-7.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4727                  - 2.*dMult*(dMult-12.))
4728                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));       
4729   // Peter Jochumzsen:
4730   five6n2n2n1n1n = (reQ6nQ2nstarQ2nstarQ1nstarQ1nstar
4731                  - 12.*pow(dReQ1n,2.)-12.*pow(dImQ1n,2.)
4732                  - 14.*pow(dReQ2n,2.)-14.*pow(dImQ2n,2.)
4733                  - 8.*pow(dReQ3n,2.)-8.*pow(dImQ3n,2.)
4734                  - 6.*pow(dReQ4n,2.)-6.*pow(dImQ4n,2.)
4735                  - 4.*pow(dReQ5n,2.)-4.*pow(dImQ5n,2.)
4736                  - 6.*pow(dReQ6n,2.)-6.*pow(dImQ6n,2.)
4737                  + 2.*reQ2nQ1nstarQ1nstar + 8.*reQ3nQ2nstarQ1nstar
4738                  + 5.*reQ6nQ4nstarQ2nstar - reQ6nQ4nstarQ1nstarQ1nstar
4739                  + 2.*reQ6nQ3nstarQ3nstar - reQ6nQ2nstarQ2nstarQ2nstar 
4740                  + 4.*reQ4nQ2nstarQ2nstar - 2.*reQ4nQ2nstarQ1nstarQ1nstar 
4741                  + 2.*reQ5nQ4nstarQ1nstar - 2.*reQ5nQ2nstarQ2nstarQ1nstar 
4742                  + 4.*reQ4nQ3nstarQ1nstar + 4.*reQ5nQ3nstarQ2nstar
4743                  + 4.*reQ6nQ5nstarQ1nstar - 4.*reQ6nQ3nstarQ2nstarQ1nstar + 24.*dMult)
4744                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));  
4745   // Peter Jochumzsen:
4746   five4n1n1n3n3n = (reQ4nQ1nQ1nQ3nstarQ3nstar-16.*pow(dReQ1n,2.)-16.*pow(dImQ1n,2.)
4747                  - 10.*pow(dReQ2n,2.)-10.*pow(dImQ2n,2.)-12.*pow(dReQ3n,2.)-12.*pow(dImQ3n,2.)
4748                  - 6.*pow(dReQ4n,2.)-6.*pow(dImQ4n,2.)-4.*pow(dReQ5n,2.)-4.*pow(dImQ5n,2.)
4749                  - 2.*pow(dReQ6n,2.)-2.*pow(dImQ6n,2.)+6.*reQ2nQ1nstarQ1nstar 
4750                  - 1.*reQ6nQ4nstarQ1nstarQ1nstar-1.*reQ4nQ2nQ3nstarQ3nstar 
4751                  + 1.*reQ6nQ4nstarQ2nstar-2.*reQ5nQ1nQ3nstarQ3nstar 
4752                  + 2.*reQ4nQ2nstarQ2nstar+4.*reQ4nQ3nstarQ1nstar 
4753                  - 2.*reQ3nQ1nstarQ1nstarQ1nstar+10.*reQ3nQ2nstarQ1nstar 
4754                  + 2.*reQ6nQ5nstarQ1nstar+2.*reQ6nQ3nstarQ3nstar 
4755                  - 4.*reQ4nQ1nQ3nstarQ2nstar+4.*reQ5nQ4nstarQ1nstar
4756                  + 4.*reQ5nQ3nstarQ2nstar + 24.*dMult)
4757                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4758   // Average 5-particle correlations for all events:      
4759   fIntFlowCorrelationsAllPro->Fill(52.5,five3n3n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4760   fIntFlowCorrelationsAllPro->Fill(53.5,five4n2n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4761   fIntFlowCorrelationsAllPro->Fill(54.5,five3n2n3n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4762   fIntFlowCorrelationsAllPro->Fill(55.5,five3n2n2n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4763   fIntFlowCorrelationsAllPro->Fill(56.5,five5n1n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4764   fIntFlowCorrelationsAllPro->Fill(60.5,five6n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4765   fIntFlowCorrelationsAllPro->Fill(61.5,five4n1n1n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4766   if(fCalculateAllCorrelationsVsM)
4767   {
4768    fIntFlowCorrelationsAllVsMPro[52]->Fill(dMultiplicityBin,five3n3n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4769    fIntFlowCorrelationsAllVsMPro[53]->Fill(dMultiplicityBin,five4n2n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4770    fIntFlowCorrelationsAllVsMPro[54]->Fill(dMultiplicityBin,five3n2n3n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4771    fIntFlowCorrelationsAllVsMPro[55]->Fill(dMultiplicityBin,five3n2n2n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4772    fIntFlowCorrelationsAllVsMPro[56]->Fill(dMultiplicityBin,five5n1n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4773    fIntFlowCorrelationsAllVsMPro[60]->Fill(dMultiplicityBin,five6n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4774    fIntFlowCorrelationsAllVsMPro[61]->Fill(dMultiplicityBin,five4n1n1n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4775   }         
4776  } // end of if(dMult>4)
4777
4778  // 6-particle:
4779  Double_t six3n2n1n3n2n1n = 0.; // <cos(n(3*phi1+2*phi2+1*phi3-3*phi4-2*phi5-1*phi6)>
4780  Double_t six3n3n2n2n1n1n = 0.; // <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-1*phi5-1*phi6)>   
4781  if(dMult>5.)
4782  { 
4783   six3n2n1n3n2n1n = (dQ3nQ2nQ1nQ3nstarQ2nstarQ1nstar-2.*reQ3nQ3nQ3nstarQ2nstarQ1nstar
4784                   - 2.*reQ3nQ2nQ2nstarQ2nstarQ1nstar-2.*reQ3nQ1nQ2nstarQ1nstarQ1nstar
4785                   - 2.*reQ3nQ2nQ3nstarQ1nstarQ1nstar-2.*reQ4nQ2nQ3nstarQ2nstarQ1nstar
4786                   - 2.*reQ5nQ1nQ3nstarQ2nstarQ1nstar+4.*reQ6nQ3nstarQ2nstarQ1nstar
4787                   + 2.*reQ5nQ1nQ4nstarQ2nstar+2.*reQ5nQ1nQ3nstarQ3nstar
4788                   + 2.*reQ4nQ2nQ3nstarQ3nstar+6.*reQ4nQ1nQ3nstarQ2nstar
4789                   + 2.*reQ5nQ3nstarQ1nstarQ1nstar+2.*reQ5nQ2nstarQ2nstarQ1nstar
4790                   + 6.*reQ3nQ1nQ2nstarQ2nstar+2.*reQ4nQ2nstarQ1nstarQ1nstar
4791                   - 4.*reQ6nQ5nstarQ1nstar-4.*reQ6nQ4nstarQ2nstar-6.*reQ5nQ4nstarQ1nstar
4792                   - 4.*reQ6nQ3nstarQ3nstar+2.*(dMult-11.)*reQ5nQ3nstarQ2nstar
4793                   + 2.*(dMult-13.)*reQ4nQ3nstarQ1nstar-8.*reQ4nQ2nstarQ2nstar
4794                   + 2.*(5.*dMult-32.)*reQ3nQ2nstarQ1nstar+2.*reQ3nQ1nstarQ1nstarQ1nstar
4795                   + 2.*(dMult-13.)*reQ2nQ1nstarQ1nstar
4796                   - (dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4797                   + (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4798                   + (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4799                   - (dMult-11.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4800                   - (dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4801                   + 4.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-(dMult-12.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4802                   - (dMult-16.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)
4803                   + (dMult*dMult-19.*dMult+68.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4804                   + (dMult*dMult-19.*dMult+72.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4805                   + pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)+pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
4806                   + (dMult*dMult-20.*dMult+80.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4807                   - dMult*(dMult-12.)*(dMult-10.))
4808                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));   
4809   
4810   // Peter Jochumzsen:
4811   six3n3n2n2n1n1n = (reQ3nQ3nQ2nstarQ2nstarQ1nstarQ1nstar
4812                   + (80.-16.*dMult)*pow(dReQ1n,2.)+(80.-16.*dMult)*pow(dImQ1n,2.)
4813                   + (78.-16.*dMult)*pow(dReQ2n,2.)+(78.-16.*dMult)*pow(dImQ2n,2.)
4814                   + (72.-16.*dMult)*pow(dReQ3n,2.)+(72.-16.*dMult)*pow(dImQ3n,2.)
4815                   + 14.*pow(dReQ4n,2.)+14.*pow(dImQ4n,2.)
4816                   + 8.*pow(dReQ5n,2.)+8.*pow(dImQ5n,2.)
4817                   + 6.*pow(dReQ6n,2.)+6.*pow(dImQ6n,2.)
4818                   + 1.*reQ6nQ2nstarQ2nstarQ2nstar - 1.*reQ6nQ2nstarQ2nstarQ1nstarQ1nstar
4819                   - 76.*reQ3nQ2nstarQ1nstar + 4.*reQ3nQ1nstarQ1nstarQ1nstar
4820                   - 8.*reQ3nQ2nstarQ1nstar + 8.*dQ2nQ1nQ2nstarQ1nstar
4821                   + 4.*reQ5nQ2nstarQ2nstarQ1nstar - 2.*reQ6nQ3nstarQ3nstar
4822                   + 4.*reQ6nQ3nstarQ2nstarQ1nstar - 4.*reQ5nQ4nstarQ1nstar
4823                   + 16.*dMult*reQ3nQ2nstarQ1nstar - 2.*reQ4nQ2nstarQ2nstar
4824                   - 4.*reQ3nQ3nQ3nstarQ2nstarQ1nstar -8.*reQ4nQ3nstarQ1nstar
4825                   - 10.*reQ4nQ2nstarQ2nstar + 4.*reQ4nQ2nstarQ1nstarQ1nstar
4826                   - 12.*reQ4nQ3nstarQ1nstar + 8.*dQ3nQ1nQ3nstarQ1nstar
4827                   + 8.*reQ3nQ1nQ2nstarQ2nstar - 4.*reQ3nQ1nQ2nstarQ1nstarQ1nstar
4828                   + 5.*reQ4nQ2nQ3nstarQ3nstar+2.*pow(pow(dReQ2n,2.)+pow(dImQ2n,2.),2.)
4829                   + 4.*reQ5nQ1nQ3nstarQ3nstar+2.*pow(pow(dReQ3n,2.)+pow(dImQ3n,2.),2.)
4830                   - 6.*reQ6nQ3nstarQ3nstar - 14.*reQ2nQ1nstarQ1nstar
4831                   - 1.*reQ3nQ3nQ2nstarQ2nstarQ2nstar-4.*reQ3nQ2nQ2nstarQ2nstarQ1nstar
4832                   - 1.*reQ4nQ1nQ1nQ3nstarQ3nstar-8.*reQ5nQ3nstarQ2nstar
4833                   + 2.*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.) - 10.*reQ2nQ1nstarQ1nstar
4834                   - 4.*reQ6nQ5nstarQ1nstar-5.*reQ6nQ4nstarQ2nstar
4835                   + 1.*reQ6nQ4nstarQ1nstarQ1nstar-8.*reQ5nQ3nstarQ2nstar
4836                   + 4.*reQ4nQ1nQ3nstarQ2nstar+8.*dQ3nQ2nQ3nstarQ2nstar
4837                   - 120.*dMult + 16.*dMult*dMult)
4838                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4839
4840   // Average 6-particle correlations for all events:      
4841   fIntFlowCorrelationsAllPro->Fill(57.5,six3n2n1n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4842   fIntFlowCorrelationsAllPro->Fill(62.5,six3n3n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4843   if(fCalculateAllCorrelationsVsM)
4844   {
4845    fIntFlowCorrelationsAllVsMPro[57]->Fill(dMultiplicityBin,six3n2n1n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4846    fIntFlowCorrelationsAllVsMPro[62]->Fill(dMultiplicityBin,six3n3n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4847   }          
4848  } // end of if(dMult>5.)
4849  
4850  // |Qn|^2/M, |Q2n|^2/M, |Qn|^4/(M(2M-1)), Re[Q2nQn^*Qn^*]/M, ... vs multiplicity (#RPs, #POIs or external):
4851  if(fUseQvectorTerms)
4852  {
4853   Double_t dM = dMultiplicityBin-0.5;
4854   if(dM>1.) // TBI re-think this if statement 
4855   {
4856    fQvectorTermsVsMult[0]->Fill(dMultiplicityBin,(pow(dReQ1n,2.)+pow(dImQ1n,2.))/dM);
4857    fQvectorTermsVsMult[1]->Fill(dMultiplicityBin,(pow(dReQ2n,2.)+pow(dImQ2n,2.))/dM);
4858    fQvectorTermsVsMult[2]->Fill(dMultiplicityBin,(pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.))/(dM*(2.*dM-1.)));
4859    fQvectorTermsVsMult[3]->Fill(dMultiplicityBin,reQ2nQ1nstarQ1nstar/pow(dM,1.5)); // TBI a bit of heuristic inserted here, re-think the rescaling factor 
4860   } // end of if(dM>1.) // TBI re-think this if statement 
4861  } // end of if(fUseQvectorTerms)
4862
4863  // Bootstrap:
4864  if(fUseBootstrap||fUseBootstrapVsM)
4865  {
4866   Double_t nSampleNo = 1.*fRandom->Integer(fnSubsamples) + 0.5;
4867   if(fUseBootstrap)
4868   {
4869    fBootstrapCorrelations->Fill(0.5,nSampleNo,two1n1n,mWeight2p); 
4870    fBootstrapCorrelations->Fill(1.5,nSampleNo,four1n1n1n1n,mWeight4p);
4871    fBootstrapCorrelations->Fill(2.5,nSampleNo,six1n1n1n1n1n1n,mWeight6p); 
4872    fBootstrapCorrelations->Fill(3.5,nSampleNo,eight1n1n1n1n1n1n1n1n,mWeight8p); 
4873   } // end of if(fUseBootstrap)
4874   if(fUseBootstrapVsM)
4875   {
4876    fBootstrapCorrelationsVsM[0]->Fill(dMultiplicityBin,nSampleNo,two1n1n,mWeight2p); 
4877    fBootstrapCorrelationsVsM[1]->Fill(dMultiplicityBin,nSampleNo,four1n1n1n1n,mWeight4p); 
4878    fBootstrapCorrelationsVsM[2]->Fill(dMultiplicityBin,nSampleNo,six1n1n1n1n1n1n,mWeight6p); 
4879    fBootstrapCorrelationsVsM[3]->Fill(dMultiplicityBin,nSampleNo,eight1n1n1n1n1n1n1n1n,mWeight8p); 
4880   } // end of if(fUseBootstrapVsM) 
4881  } // end of if(fUseBootstrap||fUseBootstrapVsM)
4882
4883  return;
4884
4885 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelations()
4886
4887 //=====================================================================================================
4888
4889 void AliFlowAnalysisWithQCumulants::CalculateMixedHarmonics()
4890 {
4891  // Calculate in this method all multi-particle azimuthal correlations in mixed harmonics.
4892  // (Remark: For completeness sake, we also calculate here again correlations in the same harmonic.) 
4893
4894  // a) Access Q-vectors and multiplicity of current event; 
4895  // b) Determine multiplicity weights and fill some histos;
4896  // c) Calculate 2-p correlations; 
4897  // d) Calculate 3-p correlations; 
4898  // e) Calculate 4-p correlations; 
4899  // f) Calculate 5-p correlations; 
4900  // g) Calculate 6-p correlations; 
4901  // h) Calculate 7-p correlations; 
4902  // i) Calculate 8-p correlations.
4903
4904  // a) Access Q-vectors and multiplicity of current event:
4905  // Multiplicity of an event: 
4906  Double_t dMult = (*fSpk)(0,0);
4907  // Real parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n, 4n, 5n and 6n: 
4908  Double_t dReQ1n = (*fReQ)(0,0);
4909  Double_t dReQ2n = (*fReQ)(1,0);
4910  Double_t dReQ3n = (*fReQ)(2,0);
4911  Double_t dReQ4n = (*fReQ)(3,0);
4912  Double_t dReQ5n = (*fReQ)(4,0); 
4913  Double_t dReQ6n = (*fReQ)(5,0);
4914  Double_t dReQ7n = (*fReQ)(6,0);
4915  Double_t dReQ8n = (*fReQ)(7,0);
4916  Double_t dReQ9n = (*fReQ)(8,0);
4917  Double_t dReQ10n = (*fReQ)(9,0);
4918  Double_t dReQ11n = (*fReQ)(10,0);
4919  Double_t dReQ12n = (*fReQ)(11,0);
4920  // Imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n, 4n, 5n and 6n:
4921  Double_t dImQ1n = (*fImQ)(0,0);
4922  Double_t dImQ2n = (*fImQ)(1,0);
4923  Double_t dImQ3n = (*fImQ)(2,0);
4924  Double_t dImQ4n = (*fImQ)(3,0);
4925  Double_t dImQ5n = (*fImQ)(4,0); 
4926  Double_t dImQ6n = (*fImQ)(5,0);
4927  Double_t dImQ7n = (*fImQ)(6,0);
4928  Double_t dImQ8n = (*fImQ)(7,0);
4929  Double_t dImQ9n = (*fImQ)(8,0);
4930  Double_t dImQ10n = (*fImQ)(9,0);
4931  Double_t dImQ11n = (*fImQ)(10,0);
4932  Double_t dImQ12n = (*fImQ)(11,0);
4933  // All mixed correlators:
4934  Double_t allMixedCorrelators[139] = {0.};
4935
4936  // Real parts of expressions involving various combinations of Q-vectors which appears
4937  // simultaneously in several equations for multiparticle correlations bellow: 
4938  // Re[Q_{2n}Q_{n}^*Q_{n}^*]
4939  Double_t reQ2nQ1nstarQ1nstar = pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n; 
4940  // Re[Q_{6n}Q_{3n}^*Q_{3n}^*]
4941  Double_t reQ6nQ3nstarQ3nstar = pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n;  
4942  // Re[Q_{4n}Q_{2n}^*Q_{2n}^*]
4943  Double_t reQ4nQ2nstarQ2nstar = pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n;
4944  // Re[Q_{4n}Q_{3n}^*Q_{n}^*]
4945  Double_t reQ4nQ3nstarQ1nstar = dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);
4946  // Re[Q_{3n}Q_{2n}^*Q_{n}^*]
4947  Double_t reQ3nQ2nstarQ1nstar = dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
4948                               + dImQ3n*dImQ2n*dReQ1n; 
4949  // Re[Q_{5n}Q_{3n}^*Q_{2n}^*]
4950  Double_t reQ5nQ3nstarQ2nstar = dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n
4951                               + dImQ5n*dImQ2n*dReQ3n;                             
4952  // Re[Q_{5n}Q_{4n}^*Q_{1n}^*]
4953  Double_t reQ5nQ4nstarQ1nstar = dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n
4954                               + dImQ5n*dImQ4n*dReQ1n;                              
4955  // Re[Q_{6n}Q_{5n}^*Q_{1n}^*]                              
4956  Double_t reQ6nQ5nstarQ1nstar = dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n
4957                               + dImQ6n*dImQ5n*dReQ1n;
4958  // Re[Q_{6n}Q_{4n}^*Q_{2n}^*]                       
4959  Double_t reQ6nQ4nstarQ2nstar = dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
4960                               + dImQ6n*dImQ4n*dReQ2n;
4961  // Re[Q_{3n}Q_{n}Q_{2n}^*Q_{2n}^*]
4962  Double_t reQ3nQ1nQ2nstarQ2nstar = (pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
4963                                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);                                
4964  // Re[Q_{3n}Q_{n}^*Q_{n}^*Q_{n}^*]
4965  Double_t reQ3nQ1nstarQ1nstarQ1nstar = dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
4966                                      + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3);
4967  // Re[Q_{6n}Q_{2n}^*Q_{2n}^*Q_{2n}^*]
4968  Double_t reQ6nQ2nstarQ2nstarQ2nstar = dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
4969                                      + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3);
4970  // Re[Q_{4n}Q_{2n}^*Q_{n}^*Q_{n}^*]
4971  Double_t reQ4nQ2nstarQ1nstarQ1nstar = (dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
4972                                      + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n);  
4973  // Re[Q_{4n}Q_{2n}^*Q_{3n}^*Q_{3n}^*]
4974  Double_t reQ4nQ2nQ3nstarQ3nstar = (dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
4975                                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n;                    
4976  // Re[Q_{4n}Q_{n}Q_{3n}^*Q_{2n}^*]
4977  Double_t reQ4nQ1nQ3nstarQ2nstar = dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
4978                                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
4979                                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
4980                                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n;
4981
4982  // Re[Q_{5n}Q_{n}Q_{4n}^*Q_{2n}^*]
4983  Double_t reQ5nQ1nQ4nstarQ2nstar = dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
4984                                  + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
4985                                  - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n 
4986                                  + dImQ1n*dImQ2n*dReQ4n*dReQ5n+dReQ1n*dReQ2n*dReQ4n*dReQ5n;                                  
4987  // Re[Q_{5n}Q_{n}Q_{3n}^*Q_{3n}^*]                                  
4988  Double_t reQ5nQ1nQ3nstarQ3nstar = dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
4989                                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
4990                                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n;
4991  // Re[Q_{5n}Q_{3n}^*Q_{n}^*Q_{n}^*]                                  
4992  Double_t reQ5nQ3nstarQ1nstarQ1nstar = -pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
4993                                      + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
4994                                      - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n;                     
4995  // Re[Q_{5n}Q_{2n}^*Q_{2n}^*Q_{n}^*]                                  
4996  Double_t reQ5nQ2nstarQ2nstarQ1nstar = -pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
4997                                      + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
4998                                      - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n;                                     
4999  // Re[Q_{6n}Q_{4n}^*Q_{n}^*Q_{n}^*]                                  
5000  Double_t reQ6nQ4nstarQ1nstarQ1nstar = -pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
5001                                      +  2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
5002                                      -  pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n;
5003  /*// |Q_{2n}|^2 |Q_{n}|^2
5004  Double_t dQ2nQ1nQ2nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
5005  // |Q_{4n}|^2 |Q_{2n}|^2
5006  Double_t dQ4nQ2nQ4nstarQ2nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.));
5007  // |Q_{3n}|^2 |Q_{2n}|^2
5008  Double_t dQ3nQ2nQ3nstarQ2nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.));
5009  // |Q_{5n}|^2 |Q_{n}|^2
5010  Double_t dQ5nQ1nQ5nstarQ1nstar = (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
5011  // |Q_{3n}|^2 |Q_{n}|^2
5012  Double_t dQ3nQ1nQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));*/
5013  // Re[Q_{2n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*]
5014  /*Double_t reQ2nQ1nQ1nstarQ1nstarQ1nstar = (dReQ2n*dReQ1n-dImQ2n*dImQ1n)*(pow(dReQ1n,3)-3.*dReQ1n*pow(dImQ1n,2))
5015                                         + (dReQ2n*dImQ1n+dReQ1n*dImQ2n)*(3.*dImQ1n*pow(dReQ1n,2)-pow(dImQ1n,3));*/ 
5016  // Re[Q_{2n}Q_{2n}Q_{2n}^*Q_{n}^*Q_{n}^*]
5017  /*Double_t reQ2nQ2nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
5018                                         * (dReQ2n*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) + 2.*dImQ2n*dReQ1n*dImQ1n);*/
5019  /*// Re[Q_{4n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
5020  Double_t reQ4nQ1nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,4.)*dReQ4n-6.*pow(dReQ1n,2.)*dReQ4n*pow(dImQ1n,2.)
5021                                             + pow(dImQ1n,4.)*dReQ4n+4.*pow(dReQ1n,3.)*dImQ1n*dImQ4n
5022                                             - 4.*pow(dImQ1n,3.)*dReQ1n*dImQ4n;*/
5023  // Re[Q_{3n}Q_{n}Q_{2n}^*Q_{n}^*Q_{n}^*]
5024  /*Double_t reQ3nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
5025                                         * (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n
5026                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n);*/
5027  // Re[Q_{6n}Q_{n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
5028  Double_t reQ6nQ3nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
5029                                      - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
5030                                      + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
5031                                      + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n;
5032  // Re[Q_{3n}Q_{3n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
5033  /*Double_t reQ3nQ3nQ3nstarQ2nstarQ1nstar = (pow(dImQ3n,2.)+pow(dReQ3n,2.))
5034                                         * (dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n
5035                                         - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n);*/   
5036  /*// Re[Q_{3n}Q_{3n}Q_{2n}^*Q_{2n}^*Q_{2n}^*]
5037  Double_t reQ3nQ3nQ2nstarQ2nstarQ2nstar = pow(dReQ2n,3.)*pow(dReQ3n,2.) 
5038                                         - 3.*dReQ2n*pow(dReQ3n,2.)*pow(dImQ2n,2.)
5039                                         + 6.*pow(dReQ2n,2.)*dReQ3n*dImQ2n*dImQ3n 
5040                                         - 2.*dReQ3n*pow(dImQ2n,3.)*dImQ3n-pow(dReQ2n,3.)*pow(dImQ3n,2.) 
5041                                         + 3.*dReQ2n*pow(dImQ2n,2.)*pow(dImQ3n,2.);*/
5042  // Re[Q_{4n}Q_{2n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
5043  /*Double_t reQ4nQ2nQ3nstarQ2nstarQ1nstar = (pow(dImQ2n,2.)+pow(dReQ2n,2.))
5044                                         * (dImQ3n*dImQ4n*dReQ1n+dImQ1n*dImQ4n*dReQ3n 
5045                                         - dImQ1n*dImQ3n*dReQ4n+dReQ1n*dReQ3n*dReQ4n);*/
5046  // Re[Q_{3n}Q_{2n}Q_{3n}^*Q_{n}^*Q_{n}^*]
5047  /*Double_t reQ3nQ2nQ3nstarQ1nstarQ1nstar = -(pow(dImQ3n,2.)+pow(dReQ3n,2.))
5048                                         * (-2.*dImQ1n*dImQ2n*dReQ1n+pow(dImQ1n,2.)*dReQ2n-pow(dReQ1n,2.)*dReQ2n);*/                              
5049  // Re[Q_{3n}Q_{2n}Q_{2n}^*Q_{2n}^*Q_{n}^*]
5050  /*Double_t reQ3nQ2nQ2nstarQ2nstarQ1nstar = (pow(dImQ2n,2.)+pow(dReQ2n,2.))
5051                                         * (dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n 
5052                                         - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n);*/
5053 /* // Re[Q_{5n}Q_{n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
5054  Double_t reQ5nQ1nQ3nstarQ2nstarQ1nstar = (pow(dImQ1n,2.)+pow(dReQ1n,2.))
5055                                         * (dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n 
5056                                         - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n);   
5057  */
5058  /*
5059  // Re[Q_{2n}Q_{2n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
5060  Double_t reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)*dReQ2n-2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)
5061                                                + dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dImQ2n)
5062                                                * (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)
5063                                                - dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n+pow(dImQ1n,2.)*dImQ2n); 
5064  // Re[Q_{3n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
5065  Double_t reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
5066                                                * (pow(dReQ1n,3.)*dReQ3n-3.*dReQ1n*dReQ3n*pow(dImQ1n,2.)
5067                                                + 3.*pow(dReQ1n,2.)*dImQ1n*dImQ3n-pow(dImQ1n,3.)*dImQ3n);
5068  */
5069  // |Q_{2n}|^2 |Q_{n}|^4
5070  //Double_t dQ2nQ1nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.); 
5071  /*
5072  // |Q_{3n}|^2 |Q_{2n}|^2 |Q_{n}|^2
5073  Double_t dQ3nQ2nQ1nQ3nstarQ2nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5074                                           * (pow(dReQ1n,2.)+pow(dImQ1n,2.));
5075  // Re[Q_{2n}Q_{n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
5076  Double_t reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
5077                                                   * (pow(dReQ1n,2.)*dReQ2n-dReQ2n*pow(dImQ1n,2.)
5078                                                   + 2.*dReQ1n*dImQ1n*dImQ2n);                                                  
5079  */
5080  // Re[Q_{6n}Q_{2n}^*Q_{2n}^*Q_{n}^*Q_{n}^*]
5081  /*Double_t reQ6nQ2nstarQ2nstarQ1nstarQ1nstar = pow(dReQ1n*dReQ2n,2.)*dReQ6n-pow(dReQ2n*dImQ1n,2.)*dReQ6n
5082                                             - 4.*dReQ1n*dReQ2n*dReQ6n*dImQ1n*dImQ2n 
5083                                             - pow(dReQ1n*dImQ2n,2.)*dReQ6n+pow(dImQ1n*dImQ2n,2.)*dReQ6n
5084                                             + 2.*dReQ1n*pow(dReQ2n,2.)*dImQ1n*dImQ6n
5085                                             + 2.*pow(dReQ1n,2.)*dReQ2n*dImQ2n*dImQ6n 
5086                                             - 2.*dReQ2n*pow(dImQ1n,2.)*dImQ2n*dImQ6n 
5087                                             - 2.*dReQ1n*dImQ1n*pow(dImQ2n,2.)*dImQ6n;
5088  */                                                                                      
5089  // Re[Q_{4n}Q_{1n}Q_{1n}Q_{3n}^*Q_{3n}^*]
5090  /*
5091  Double_t reQ4nQ1nQ1nQ3nstarQ3nstar = pow(dReQ1n*dReQ3n,2.)*dReQ4n-pow(dReQ3n*dImQ1n,2.)*dReQ4n  
5092                                     + 4.*dReQ1n*dReQ3n*dReQ4n*dImQ1n*dImQ3n 
5093                                     - pow(dReQ1n*dImQ3n,2.)*dReQ4n+pow(dImQ1n*dImQ3n,2.)*dReQ4n  
5094                                     - 2.*dReQ1n*pow(dReQ3n,2.)*dImQ1n*dImQ4n 
5095                                     + 2.*pow(dReQ1n,2.)*dReQ3n*dImQ3n*dImQ4n 
5096                                     - 2.*dReQ3n*pow(dImQ1n,2.)*dImQ3n*dImQ4n 
5097                                     + 2.*dReQ1n*dImQ1n*pow(dImQ3n,2.)*dImQ4n;*/
5098  /* 
5099  // Re[Q_{3n}Q_{3n}Q_{2n}^*Q_{2n}^*Q_{1n}^*Q_{1n}^*]
5100  Double_t reQ3nQ3nQ2nstarQ2nstarQ1nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ2n*dReQ3n*dImQ1n-dReQ1n*dReQ3n*dImQ2n 
5101                                                - dReQ3n*dImQ1n*dImQ2n+dReQ1n*dReQ2n*dImQ3n+dReQ2n*dImQ1n*dImQ3n 
5102                                                + dReQ1n*dImQ2n*dImQ3n-dImQ1n*dImQ2n*dImQ3n)*(dReQ1n*dReQ2n*dReQ3n 
5103                                                + dReQ2n*dReQ3n*dImQ1n+dReQ1n*dReQ3n*dImQ2n-dReQ3n*dImQ1n*dImQ2n 
5104                                                - dReQ1n*dReQ2n*dImQ3n+dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n 
5105                                                + dImQ1n*dImQ2n*dImQ3n);
5106  */
5107
5108  // b) Determine multiplicity weights and fill some histos:
5109  Double_t d2pMultiplicityWeight = 0.; // weight for <2>_{...} to get <<2>>_{...}
5110  Double_t d3pMultiplicityWeight = 0.; // weight for <3>_{...} to get <<3>>_{...}
5111  Double_t d4pMultiplicityWeight = 0.; // weight for <4>_{...} to get <<4>>_{...}
5112  Double_t d5pMultiplicityWeight = 0.; // weight for <5>_{...} to get <<5>>_{...}
5113  Double_t d6pMultiplicityWeight = 0.; // weight for <6>_{...} to get <<6>>_{...}
5114  Double_t d7pMultiplicityWeight = 0.; // weight for <7>_{...} to get <<7>>_{...}
5115  Double_t d8pMultiplicityWeight = 0.; // weight for <8>_{...} to get <<8>>_{...}
5116  if(fMultiplicityWeight->Contains("combinations")) // default multiplicity weight
5117  {
5118   d2pMultiplicityWeight = dMult*(dMult-1.);
5119   d3pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.);
5120   d4pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.);
5121   d5pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.);
5122   d6pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.);
5123   d7pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.);
5124   d8pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.);
5125  } else if(fMultiplicityWeight->Contains("unit"))
5126    {
5127     d2pMultiplicityWeight = 1.;
5128     d3pMultiplicityWeight = 1.;
5129     d4pMultiplicityWeight = 1.;
5130     d5pMultiplicityWeight = 1.;
5131     d6pMultiplicityWeight = 1.;
5132     d7pMultiplicityWeight = 1.;
5133     d8pMultiplicityWeight = 1.;
5134    } else if(fMultiplicityWeight->Contains("multiplicity"))
5135      {
5136       d2pMultiplicityWeight = dMult;
5137       d3pMultiplicityWeight = dMult;
5138       d4pMultiplicityWeight = dMult;
5139       d5pMultiplicityWeight = dMult;
5140       d6pMultiplicityWeight = dMult;
5141       d7pMultiplicityWeight = dMult;
5142       d8pMultiplicityWeight = dMult; 
5143      }       
5144  for(Int_t p=0;p<=1;p++) // power (0=linear,1=quadratic)
5145  {
5146   fMixedHarmonicEventWeights[p]->Fill(0.5,pow(dMult,p+1));
5147   fMixedHarmonicEventWeights[p]->Fill(1.5,pow(d2pMultiplicityWeight,p+1));
5148   fMixedHarmonicEventWeights[p]->Fill(2.5,pow(d3pMultiplicityWeight,p+1));
5149   fMixedHarmonicEventWeights[p]->Fill(3.5,pow(d4pMultiplicityWeight,p+1));
5150   fMixedHarmonicEventWeights[p]->Fill(4.5,pow(d5pMultiplicityWeight,p+1));
5151   fMixedHarmonicEventWeights[p]->Fill(5.5,pow(d6pMultiplicityWeight,p+1));
5152   fMixedHarmonicEventWeights[p]->Fill(6.5,pow(d7pMultiplicityWeight,p+1));
5153   fMixedHarmonicEventWeights[p]->Fill(7.5,pow(d8pMultiplicityWeight,p+1));
5154  } // end of for(Int_t p=0;p<=1;p++) // power (0=linear,1=quadratic)   
5155  fMixedHarmonicProductOfEventWeights->Fill(0.5,0.5,dMult*dMult);
5156  fMixedHarmonicProductOfEventWeights->Fill(0.5,1.5,dMult*d2pMultiplicityWeight);
5157  fMixedHarmonicProductOfEventWeights->Fill(0.5,2.5,dMult*d3pMultiplicityWeight);
5158  fMixedHarmonicProductOfEventWeights->Fill(0.5,3.5,dMult*d4pMultiplicityWeight);
5159  fMixedHarmonicProductOfEventWeights->Fill(0.5,4.5,dMult*d5pMultiplicityWeight);
5160  fMixedHarmonicProductOfEventWeights->Fill(0.5,5.5,dMult*d6pMultiplicityWeight);
5161  fMixedHarmonicProductOfEventWeights->Fill(0.5,6.5,dMult*d7pMultiplicityWeight);
5162  fMixedHarmonicProductOfEventWeights->Fill(0.5,7.5,dMult*d8pMultiplicityWeight);
5163  fMixedHarmonicProductOfEventWeights->Fill(1.5,1.5,d2pMultiplicityWeight*d2pMultiplicityWeight);
5164  fMixedHarmonicProductOfEventWeights->Fill(1.5,2.5,d2pMultiplicityWeight*d3pMultiplicityWeight);
5165  fMixedHarmonicProductOfEventWeights->Fill(1.5,3.5,d2pMultiplicityWeight*d4pMultiplicityWeight);
5166  fMixedHarmonicProductOfEventWeights->Fill(1.5,4.5,d2pMultiplicityWeight*d5pMultiplicityWeight);
5167  fMixedHarmonicProductOfEventWeights->Fill(1.5,5.5,d2pMultiplicityWeight*d6pMultiplicityWeight);
5168  fMixedHarmonicProductOfEventWeights->Fill(1.5,6.5,d2pMultiplicityWeight*d7pMultiplicityWeight);
5169  fMixedHarmonicProductOfEventWeights->Fill(1.5,7.5,d2pMultiplicityWeight*d8pMultiplicityWeight);
5170  fMixedHarmonicProductOfEventWeights->Fill(2.5,2.5,d3pMultiplicityWeight*d3pMultiplicityWeight);
5171  fMixedHarmonicProductOfEventWeights->Fill(2.5,3.5,d3pMultiplicityWeight*d4pMultiplicityWeight);
5172  fMixedHarmonicProductOfEventWeights->Fill(2.5,4.5,d3pMultiplicityWeight*d5pMultiplicityWeight);
5173  fMixedHarmonicProductOfEventWeights->Fill(2.5,5.5,d3pMultiplicityWeight*d6pMultiplicityWeight);
5174  fMixedHarmonicProductOfEventWeights->Fill(2.5,6.5,d3pMultiplicityWeight*d7pMultiplicityWeight);
5175  fMixedHarmonicProductOfEventWeights->Fill(2.5,7.5,d3pMultiplicityWeight*d8pMultiplicityWeight);
5176  fMixedHarmonicProductOfEventWeights->Fill(3.5,3.5,d4pMultiplicityWeight*d4pMultiplicityWeight);
5177  fMixedHarmonicProductOfEventWeights->Fill(3.5,4.5,d4pMultiplicityWeight*d5pMultiplicityWeight);
5178  fMixedHarmonicProductOfEventWeights->Fill(3.5,5.5,d4pMultiplicityWeight*d6pMultiplicityWeight);
5179  fMixedHarmonicProductOfEventWeights->Fill(3.5,6.5,d4pMultiplicityWeight*d7pMultiplicityWeight);
5180  fMixedHarmonicProductOfEventWeights->Fill(3.5,7.5,d4pMultiplicityWeight*d8pMultiplicityWeight);
5181  fMixedHarmonicProductOfEventWeights->Fill(4.5,4.5,d5pMultiplicityWeight*d5pMultiplicityWeight);
5182  fMixedHarmonicProductOfEventWeights->Fill(4.5,5.5,d5pMultiplicityWeight*d6pMultiplicityWeight);
5183  fMixedHarmonicProductOfEventWeights->Fill(4.5,6.5,d5pMultiplicityWeight*d7pMultiplicityWeight);
5184  fMixedHarmonicProductOfEventWeights->Fill(4.5,7.5,d5pMultiplicityWeight*d8pMultiplicityWeight);
5185  fMixedHarmonicProductOfEventWeights->Fill(5.5,5.5,d6pMultiplicityWeight*d6pMultiplicityWeight);
5186  fMixedHarmonicProductOfEventWeights->Fill(5.5,6.5,d6pMultiplicityWeight*d7pMultiplicityWeight);
5187  fMixedHarmonicProductOfEventWeights->Fill(5.5,7.5,d6pMultiplicityWeight*d8pMultiplicityWeight);
5188  fMixedHarmonicProductOfEventWeights->Fill(6.5,6.5,d7pMultiplicityWeight*d7pMultiplicityWeight); 
5189  fMixedHarmonicProductOfEventWeights->Fill(6.5,7.5,d7pMultiplicityWeight*d8pMultiplicityWeight); 
5190  fMixedHarmonicProductOfEventWeights->Fill(7.5,7.5,d8pMultiplicityWeight*d8pMultiplicityWeight); 
5191  
5192  // c) Calculate 2-p correlations:
5193  Double_t two1n1n = 0.; // <2>_{1n|1n} = <cos(1n(phi1-phi2))>
5194  Double_t two2n2n = 0.; // <2>_{2n|2n} = <cos(2n(phi1-phi2))>
5195  Double_t two3n3n = 0.; // <2>_{3n|3n} = <cos(3n(phi1-phi2))>
5196  Double_t two4n4n = 0.; // <2>_{4n|4n} = <cos(4n(phi1-phi2))>
5197  Double_t two5n5n = 0.; // <2>_{5n|5n} = <cos(5n(phi1-phi2))>
5198  Double_t two6n6n = 0.; // <2>_{6n|6n} = <cos(6n(phi1-phi2))>
5199  if(dMult>1.)
5200  {
5201   two1n1n = (pow(dReQ1n,2.)+pow(dImQ1n,2.)-dMult)/(dMult*(dMult-1.)); 
5202   two2n2n = (pow(dReQ2n,2.)+pow(dImQ2n,2.)-dMult)/(dMult*(dMult-1.)); 
5203   two3n3n = (pow(dReQ3n,2.)+pow(dImQ3n,2.)-dMult)/(dMult*(dMult-1.)); 
5204   two4n4n = (pow(dReQ4n,2.)+pow(dImQ4n,2.)-dMult)/(dMult*(dMult-1.)); 
5205   two5n5n = (pow(dReQ5n,2.)+pow(dImQ5n,2.)-dMult)/(dMult*(dMult-1.)); 
5206   two6n6n = (pow(dReQ6n,2.)+pow(dImQ6n,2.)-dMult)/(dMult*(dMult-1.));   
5207   f2pCorrelations->Fill(0.5,two1n1n,d2pMultiplicityWeight);
5208   f2pCorrelations->Fill(1.5,two2n2n,d2pMultiplicityWeight);
5209   f2pCorrelations->Fill(2.5,two3n3n,d2pMultiplicityWeight);
5210   f2pCorrelations->Fill(3.5,two4n4n,d2pMultiplicityWeight);
5211   f2pCorrelations->Fill(4.5,two5n5n,d2pMultiplicityWeight);
5212   f2pCorrelations->Fill(5.5,two6n6n,d2pMultiplicityWeight);
5213   allMixedCorrelators[0]=two1n1n;
5214   allMixedCorrelators[1]=two2n2n;
5215   allMixedCorrelators[2]=two3n3n;
5216   allMixedCorrelators[3]=two4n4n;
5217   allMixedCorrelators[4]=two5n5n;
5218   allMixedCorrelators[5]=two6n6n;
5219  } // end of if(dMult>1.)
5220
5221  // d) Calculate 3-p correlations:
5222  //  d1) Two distinct harmonics (3): 
5223  Double_t three2n1n1n = 0.; // <3>_{2n|1n,1n} = <cos(n(2*phi1-1*phi2-1*phi3))>
5224  Double_t three4n2n2n = 0.; // <3>_{4n|2n,2n} = <cos(n(4*phi1-2*phi2-2*phi3))>
5225  Double_t three6n3n3n = 0.; // <3>_{6n|3n,3n} = <cos(n(6*phi1-3*phi2-3*phi3))> 
5226  //  d2) Three distinct harmonics (6): 
5227  Double_t three3n2n1n = 0.; // <3>_{3n|2n,1n} = <cos(n(3*phi1-2*phi2-1*phi3))>
5228  Double_t three4n3n1n = 0.; // <3>_{4n|3n,1n} = <cos(n(4*phi1-3*phi2-1*phi3))> 
5229  Double_t three5n3n2n = 0.; // <3>_{5n|3n,2n} = <cos(n(5*phi1-3*phi2-2*phi3))>
5230  Double_t three5n4n1n = 0.; // <3>_{5n|4n,1n} = <cos(n(5*phi1-4*phi2-1*phi3))> 
5231  Double_t three6n4n2n = 0.; // <3>_{6n|4n,2n} = <cos(n(6*phi1-4*phi2-2*phi3))> 
5232  Double_t three6n5n1n = 0.; // <3>_{6n|5n,1n} = <cos(n(6*phi1-5*phi2-1*phi3))>
5233  if(dMult>2.)
5234  {
5235   three2n1n1n = (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n
5236               - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
5237               / (dMult*(dMult-1.)*(dMult-2.)); 
5238   three4n2n2n = (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n
5239               - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*dMult)
5240               / (dMult*(dMult-1.)*(dMult-2.)); 
5241   three6n3n3n = (reQ6nQ3nstarQ3nstar
5242               - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5243               - (pow(dReQ6n,2.)+pow(dImQ6n,2.))+2.*dMult)
5244               / (dMult*(dMult-1.)*(dMult-2.));  
5245   three3n2n1n = (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
5246               + dImQ3n*dImQ2n*dReQ1n-(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5247               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))-(pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
5248               / (dMult*(dMult-1.)*(dMult-2.));
5249   three4n3n1n = (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)
5250               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))-(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5251               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
5252               / (dMult*(dMult-1.)*(dMult-2.));  
5253   three5n3n2n = (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n
5254               + dImQ5n*dImQ2n*dReQ3n-(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5255               - (pow(dReQ3n,2.)+pow(dImQ3n,2.))
5256               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
5257               / (dMult*(dMult-1.)*(dMult-2.)); 
5258   three5n4n1n = (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n
5259               + dImQ5n*dImQ4n*dReQ1n-(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5260               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))
5261               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
5262               / (dMult*(dMult-1.)*(dMult-2.));
5263   three6n4n2n = (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
5264               + dImQ6n*dImQ4n*dReQ2n-(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5265               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))-(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
5266               / (dMult*(dMult-1.)*(dMult-2.));
5267   three6n5n1n = (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n
5268               + dImQ6n*dImQ5n*dReQ1n-(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5269               - (pow(dReQ5n,2.)+pow(dImQ5n,2.))
5270               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
5271               / (dMult*(dMult-1.)*(dMult-2.)); 
5272   f3pCorrelations->Fill(0.5,three2n1n1n,d3pMultiplicityWeight);
5273   f3pCorrelations->Fill(1.5,three4n2n2n,d3pMultiplicityWeight);
5274   f3pCorrelations->Fill(2.5,three6n3n3n,d3pMultiplicityWeight);
5275   //f3pCorrelations->Fill(3.5,0.,d3pMultiplicityWeight); // empty TBI
5276   f3pCorrelations->Fill(4.5,three3n2n1n,d3pMultiplicityWeight);
5277   f3pCorrelations->Fill(5.5,three4n3n1n,d3pMultiplicityWeight);
5278   f3pCorrelations->Fill(6.5,three5n3n2n,d3pMultiplicityWeight);
5279   f3pCorrelations->Fill(7.5,three5n4n1n,d3pMultiplicityWeight);
5280   f3pCorrelations->Fill(8.5,three6n4n2n,d3pMultiplicityWeight);
5281   f3pCorrelations->Fill(9.5,three6n5n1n,d3pMultiplicityWeight);
5282   allMixedCorrelators[6]=three2n1n1n;
5283   allMixedCorrelators[7]=three4n2n2n;
5284   allMixedCorrelators[8]=three6n3n3n;
5285   allMixedCorrelators[9]=three3n2n1n;
5286   allMixedCorrelators[10]=three4n3n1n;
5287   allMixedCorrelators[11]=three5n3n2n;
5288   allMixedCorrelators[12]=three5n4n1n;
5289   allMixedCorrelators[13]=three6n4n2n;
5290   allMixedCorrelators[14]=three6n5n1n;
5291  } // end of if(dMult>2.)
5292
5293  // e) Calculate 4-p correlations:
5294  //  e1) Single harmonic (6): 
5295  Double_t four1n1n1n1n = 0.; // <4>_{1n,1n|1n,1n} = <cos(1*n(phi1+phi2-phi3-phi4))>
5296  Double_t four2n2n2n2n = 0.; // <4>_{2n,2n|2n,2n} = <cos(2*n(phi1+phi2-phi3-phi4))>
5297  Double_t four3n3n3n3n = 0.; // <4>_{3n,3n|3n,3n} = <cos(3*n(phi1+phi2-phi3-phi4))>
5298  Double_t four4n4n4n4n = 0.; // <4>_{4n,4n|4n,4n} = <cos(4*n(phi1+phi2-phi3-phi4))>
5299  Double_t four5n5n5n5n = 0.; // <4>_{5n,5n|5n,5n} = <cos(5*n(phi1+phi2-phi3-phi4))>
5300  Double_t four6n6n6n6n = 0.; // <4>_{6n,6n|6n,6n} = <cos(6*n(phi1+phi2-phi3-phi4))>
5301  //  e2) "Standard candles" (15):
5302  Double_t four2n1n2n1n = 0.; // <4>_{2n,1n|2n,1n} = <cos(n(2*phi1+1*phi2-2*phi3-1*phi4))>
5303  Double_t four3n1n3n1n = 0.; // <4>_{3n,1n|3n,1n} = <cos(n(3*phi1+1*phi2-3*phi3-1*phi4))>
5304  Double_t four3n2n3n2n = 0.; // <4>_{3n,2n|3n,2n} = <cos(n(3*phi1+2*phi2-3*phi3-2*phi4))>
5305  Double_t four4n1n4n1n = 0.; // <4>_{4n,1n|4n,1n} = <cos(n(4*phi1+1*phi2-4*phi3-1*phi4))>
5306  Double_t four4n2n4n2n = 0.; // <4>_{4n,2n|4n,2n} = <cos(n(4*phi1+2*phi2-4*phi3-2*phi4))>
5307  Double_t four4n3n4n3n = 0.; // <4>_{4n,3n|4n,3n} = <cos(n(4*phi1+3*phi2-4*phi3-3*phi4))>
5308  Double_t four5n1n5n1n = 0.; // <4>_{5n,1n|5n,1n} = <cos(n(5*phi1+1*phi2-5*phi3-1*phi4))>
5309  Double_t four5n2n5n2n = 0.; // <4>_{5n,2n|5n,2n} = <cos(n(5*phi1+2*phi2-5*phi3-2*phi4))>
5310  Double_t four5n3n5n3n = 0.; // <4>_{5n,3n|5n,3n} = <cos(n(5*phi1+3*phi2-5*phi3-3*phi4))>
5311  Double_t four5n4n5n4n = 0.; // <4>_{5n,4n|5n,4n} = <cos(n(5*phi1+4*phi2-5*phi3-4*phi4))>
5312  Double_t four6n1n6n1n = 0.; // <4>_{6n,1n|6n,1n} = <cos(n(6*phi1+1*phi2-6*phi3-1*phi4))>
5313  Double_t four6n2n6n2n = 0.; // <4>_{6n,2n|6n,2n} = <cos(n(6*phi1+2*phi2-6*phi3-2*phi4))>
5314  Double_t four6n3n6n3n = 0.; // <4>_{6n,3n|6n,3n} = <cos(n(6*phi1+3*phi2-6*phi3-3*phi4))>
5315  Double_t four6n4n6n4n = 0.; // <4>_{6n,4n|6n,4n} = <cos(n(6*phi1+4*phi2-6*phi3-4*phi4))>
5316  Double_t four6n5n6n5n = 0.; // <4>_{6n,5n|6n,5n} = <cos(n(6*phi1+5*phi2-6*phi3-5*phi4))>
5317  //  e3) Two distinct harmonics (2): 
5318  Double_t four3n1n1n1n = 0.; // <4>_{3n|1n,1n,1n} = <cos(n(3*phi1-1*phi2-1*phi3-1*phi4))>
5319  Double_t four6n2n2n2n = 0.; // <4>_{6n|2n,2n,2n} = <cos(n(6*phi1-2*phi2-2*phi3-2*phi4))>
5320  //  e4) Three distinct harmonics (10): 
5321  Double_t four3n1n2n2n = 0.; // <4>_{3n,1n|2n,2n} = <cos(n(3*phi1+1*phi2-2*phi3-2*phi4))>
5322  Double_t four4n2n1n1n = 0.; // <4>_{4n|2n,1n,1n} = <cos(n(4*phi1-2*phi2-1*phi3-1*phi4))>
5323  Double_t four4n2n3n3n = 0.; // <4>_{4n,2n|3n,3n} = <cos(n(4*phi1+2*phi2-3*phi3-3*phi4))>
5324  Double_t four5n2n2n1n = 0.; // <4>_{5n|2n,2n,1n} = <cos(n(5*phi1-2*phi2-2*phi3-1*phi4))>
5325  Double_t four5n3n1n1n = 0.; // <4>_{5n|3n,1n,1n} = <cos(n(5*phi1-3*phi2-1*phi3-1*phi4))>
5326  Double_t four5n1n3n3n = 0.; // <4>_{5n,1n|3n,3n} = <cos(n(5*phi1+1*phi2-3*phi3-3*phi4))>
5327  Double_t four5n3n4n4n = 0.; // <4>_{5n,3n|4n,4n} = <cos(n(5*phi1+3*phi2-4*phi3-4*phi4))>
5328  Double_t four6n4n1n1n = 0.; // <4>_{6n|4n,1n,1n} = <cos(n(6*phi1-4*phi2-1*phi3-1*phi4))>
5329  Double_t four6n2n4n4n = 0.; // <4>_{6n,2n|4n,4n} = <cos(n(6*phi1+2*phi2-4*phi3-4*phi4))>
5330  Double_t four6n4n5n5n = 0.; // <4>_{6n,4n|5n,5n} = <cos(n(6*phi1+4*phi2-5*phi3-5*phi4))>
5331  //  e5) Four distinct harmonics (8): 
5332  Double_t four4n1n3n2n = 0.; // <4>_{4n,1n|3n,2n} = <cos(n(4*phi1+1*phi2-3*phi3-2*phi4))>
5333  Double_t four5n1n4n2n = 0.; // <4>_{5n,1n|4n,2n} = <cos(n(5*phi1+1*phi2-4*phi3-2*phi4))>
5334  Double_t four5n2n4n3n = 0.; // <4>_{5n,2n|4n,3n} = <cos(n(5*phi1+2*phi2-4*phi3-3*phi4))>
5335  Double_t four6n1n4n3n = 0.; // <4>_{6n,1n|4n,3n} = <cos(n(6*phi1+1*phi2-4*phi3-3*phi4))>
5336  Double_t four6n1n5n2n = 0.; // <4>_{6n,1n|5n,2n} = <cos(n(6*phi1+1*phi2-5*phi3-2*phi4))>
5337  Double_t four6n3n2n1n = 0.; // <4>_{6n|3n,2n,1n} = <cos(n(6*phi1-3*phi2-2*phi3-1*phi4))>
5338  Double_t four6n2n5n3n = 0.; // <4>_{6n,2n|5n,3n} = <cos(n(6*phi1+2*phi2-5*phi3-3*phi4))>
5339  Double_t four6n3n5n4n = 0.; // <4>_{6n,3n|5n,4n} = <cos(n(6*phi1+3*phi2-5*phi3-4*phi4))>
5340  if(dMult>3.)
5341  {
5342   // Single harmonic (6): 
5343   four1n1n1n1n = (2.*dMult*(dMult-3.)+pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ1n,2.)
5344                + pow(dImQ1n,2.))-2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5345                + (pow(dReQ2n,2.)+pow(dImQ2n,2.)))
5346                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));     
5347   four2n2n2n2n = (2.*dMult*(dMult-3.)+pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ2n,2.)
5348                + pow(dImQ2n,2.))-2.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5349                + (pow(dReQ4n,2.)+pow(dImQ4n,2.)))
5350                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.)); 
5351   four3n3n3n3n = (2.*dMult*(dMult-3.)+pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ3n,2.)
5352                + pow(dImQ3n,2.))-2.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5353                + (pow(dReQ6n,2.)+pow(dImQ6n,2.)))
5354                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));     
5355   four4n4n4n4n = (2.*dMult*(dMult-3.)+pow((pow(dReQ4n,2.)+pow(dImQ4n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ4n,2.)
5356                + pow(dImQ4n,2.))-2.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
5357                + (pow(dReQ8n,2.)+pow(dImQ8n,2.)))
5358                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));     
5359   four5n5n5n5n = (2.*dMult*(dMult-3.)+pow((pow(dReQ5n,2.)+pow(dImQ5n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ5n,2.)
5360                + pow(dImQ5n,2.))-2.*(pow(dReQ5n,2.)*dReQ10n+2.*dReQ5n*dImQ5n*dImQ10n-pow(dImQ5n,2.)*dReQ10n)
5361                + (pow(dReQ10n,2.)+pow(dImQ10n,2.)))
5362                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));    
5363   four6n6n6n6n = (2.*dMult*(dMult-3.)+pow((pow(dReQ6n,2.)+pow(dImQ6n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ6n,2.)
5364                + pow(dImQ6n,2.))-2.*(pow(dReQ6n,2.)*dReQ12n+2.*dReQ6n*dImQ6n*dImQ12n-pow(dImQ6n,2.)*dReQ12n)
5365                + (pow(dReQ12n,2.)+pow(dImQ12n,2.)))
5366                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));  
5367   // "Standard candles" (15):
5368   four2n1n2n1n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5369                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
5370                + dImQ3n*dImQ2n*dReQ1n)-2.*(pow(dReQ1n,2.)*dReQ2n
5371                + 2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n))
5372                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5373                - ((dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5374                + (dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-(pow(dReQ3n,2.)+pow(dImQ3n,2.)))
5375                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5376                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));
5377   four3n1n3n1n = ((pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5378                - 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5379                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5380                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5381                + pow(dReQ2n,2.)+pow(dImQ2n,2.)-(dMult-4.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5382                + dMult*(dMult-6.))
5383                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5384   four3n2n3n2n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5385                - 2.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5386                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5387                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)               
5388                - (dMult-4.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
5389                + dMult*(dMult-6.))
5390                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
5391   four4n1n4n1n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
5392                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ1n*dImQ4n+dImQ5n*dImQ1n*dReQ4n)
5393                - 2.*(dReQ3n*dReQ4n*dReQ1n+dImQ3n*dImQ4n*dReQ1n+dReQ3n*dImQ4n*dImQ1n-dImQ3n*dImQ1n*dReQ4n)
5394                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)
5395                - (dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
5396                + dMult*(dMult-6.))
5397                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5398   four4n2n4n2n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5399                - 2.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
5400                + dImQ6n*dImQ4n*dReQ2n)-2.*(pow(dReQ2n,2.)*dReQ4n
5401                + 2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n))
5402                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5403                - ((dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5404                + (dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-(pow(dReQ6n,2.)+pow(dImQ6n,2.)))
5405                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5406                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));
5407   four4n3n4n3n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
5408                - 2.*(dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ3n*dImQ4n+dImQ7n*dImQ3n*dReQ4n)
5409                - 2.*(dReQ1n*dReQ4n*dReQ3n+dImQ1n*dImQ4n*dReQ3n+dReQ1n*dImQ4n*dImQ3n-dImQ1n*dImQ3n*dReQ4n)
5410                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)
5411                - (dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
5412                + dMult*(dMult-6.))
5413                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5414   four5n1n5n1n = (((pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
5415                - 2.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5416                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5417                + pow(dReQ6n,2.)+pow(dImQ6n,2.)-(dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5418                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+dMult*(dMult-6.))  
5419                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5420   four5n2n5n2n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
5421                - 2.*(dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ2n*dImQ5n+dImQ7n*dImQ2n*dReQ5n)
5422                - 2.*(dReQ3n*dReQ5n*dReQ2n+dImQ3n*dImQ5n*dReQ2n+dReQ3n*dImQ5n*dImQ2n-dImQ3n*dImQ2n*dReQ5n)
5423                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)
5424                - (dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
5425                + dMult*(dMult-6.))
5426                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5427   four5n3n5n3n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
5428                - 2.*(dReQ8n*dReQ5n*dReQ3n-dReQ8n*dImQ5n*dImQ3n+dImQ8n*dReQ3n*dImQ5n+dImQ8n*dImQ3n*dReQ5n)
5429                - 2.*(dReQ2n*dReQ5n*dReQ3n+dImQ2n*dImQ5n*dReQ3n+dReQ2n*dImQ5n*dImQ3n-dImQ2n*dImQ3n*dReQ5n)
5430                + pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)
5431                - (dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
5432                + dMult*(dMult-6.))
5433                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5434   four5n4n5n4n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
5435                - 2.*(dReQ9n*dReQ5n*dReQ4n-dReQ9n*dImQ5n*dImQ4n+dImQ9n*dReQ4n*dImQ5n+dImQ9n*dImQ4n*dReQ5n)
5436                - 2.*(dReQ1n*dReQ5n*dReQ4n+dImQ1n*dImQ5n*dReQ4n+dReQ1n*dImQ5n*dImQ4n-dImQ1n*dImQ4n*dReQ5n)
5437                + pow(dReQ9n,2.)+pow(dImQ9n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)
5438                - (dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.))
5439                + dMult*(dMult-6.))
5440                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5441   four6n1n6n1n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
5442                - 2.*(dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ1n*dImQ6n+dImQ7n*dImQ1n*dReQ6n)
5443                - 2.*(dReQ5n*dReQ6n*dReQ1n+dImQ5n*dImQ6n*dReQ1n+dReQ5n*dImQ6n*dImQ1n-dImQ5n*dImQ1n*dReQ6n)
5444                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)
5445                - (dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
5446                + dMult*(dMult-6.))
5447                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5448   four6n2n6n2n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5449                - 2.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
5450                - 2.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5451                + pow(dReQ8n,2.)+pow(dImQ8n,2.)-(dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5452                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5453                + dMult*(dMult-6.))
5454                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5455   four6n3n6n3n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5456                - 2.*(dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n
5457                + dImQ9n*dImQ6n*dReQ3n)-2.*(pow(dReQ3n,2.)*dReQ6n
5458                + 2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n))
5459                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5460                - ((dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5461                + (dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-(pow(dReQ9n,2.)+pow(dImQ9n,2.)))
5462                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5463                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));
5464   four6n4n6n4n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5465                - 2.*(dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
5466                - 2.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5467                + pow(dReQ10n,2.)+pow(dImQ10n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)               
5468                - (dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.))
5469                + dMult*(dMult-6.))
5470                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
5471   four6n5n6n5n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
5472                - 2.*(dReQ11n*dReQ6n*dReQ5n-dReQ11n*dImQ6n*dImQ5n+dImQ11n*dReQ5n*dImQ6n+dImQ11n*dImQ5n*dReQ6n)
5473                - 2.*(dReQ1n*dReQ6n*dReQ5n+dImQ1n*dImQ6n*dReQ5n+dReQ1n*dImQ6n*dImQ5n-dImQ1n*dImQ5n*dReQ6n)
5474                + pow(dReQ11n,2.)+pow(dImQ11n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)
5475                - (dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.))
5476                + dMult*(dMult-6.))
5477                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5478   // Two distinct harmonics (2):
5479   four3n1n1n1n = (dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
5480                + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3)               
5481                - 3.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5482                - 3.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5483                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5484                + 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5485                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5486   four6n2n2n2n = (dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
5487                + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3)               
5488                - 3.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5489                - 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5490                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+3.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5491                + 6.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-6.*dMult)
5492                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5493   // Three distinct harmonics (10): 
5494   four3n1n2n2n = ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
5495                + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)
5496                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5497                - (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5498                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n))
5499                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5500                - (2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5501                - (pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5502                - 4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
5503                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5504                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));
5505   four4n2n1n1n = ((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
5506                + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n)
5507                - 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5508                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5509                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n))
5510                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5511                - ((pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5512                - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5513                - 3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
5514                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5515                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));
5516   four4n2n3n3n = ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
5517                + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n
5518                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5519                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5520                - 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5521                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5522                + (pow(dReQ6n,2.)+pow(dImQ6n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5523                + 2.*(2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5524                + (pow(dReQ1n,2.)+pow(dImQ1n,2.))-3.*dMult))
5525                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
5526   four5n2n2n1n = (-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
5527                + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
5528                - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n
5529                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5530                - 2.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5531                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5532                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5533                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+pow(dReQ4n,2.)+pow(dImQ4n,2.)
5534                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5535                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5536                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5537   four5n3n1n1n = (-pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
5538                + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
5539                - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n
5540                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5541                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5542                - 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5543                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5544                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5545                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+pow(dReQ2n,2.)+pow(dImQ2n,2.)
5546                + 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
5547                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
5548   four5n1n3n3n = (dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
5549                - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
5550                + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n
5551                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5552                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5553                - 2.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5554                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5555                + pow(dReQ6n,2.)+pow(dImQ6n,2.)+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5556                + 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5557                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)                                  
5558                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5559   four5n3n4n4n = ((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ5n*dReQ3n-dImQ5n*dImQ3n) 
5560                + 2.*dReQ4n*dImQ4n*(dReQ5n*dImQ3n+dImQ5n*dReQ3n)
5561                - (dReQ8n*dReQ3n*dReQ5n-dReQ8n*dImQ3n*dImQ5n+dImQ8n*dReQ3n*dImQ5n+dImQ8n*dImQ3n*dReQ5n)
5562                - (pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
5563                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5564                - 2.*(dReQ4n*dReQ3n*dReQ1n-dReQ4n*dImQ3n*dImQ1n+dImQ4n*dReQ3n*dImQ1n+dImQ4n*dImQ3n*dReQ1n)
5565                + pow(dReQ8n,2.)+pow(dImQ8n,2.)+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
5566                + 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
5567                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
5568                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5569   four6n4n1n1n = (-pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
5570                + 2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
5571                - pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n
5572                - 2.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5573                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n) 
5574                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n) 
5575                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n) 
5576                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)
5577                + pow(dReQ4n,2.)+pow(dImQ4n,2.))+pow(dReQ2n,2.)+pow(dImQ2n,2.)
5578                + 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5579                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5580   four6n2n4n4n = ((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
5581                + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n)
5582                - (pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
5583                - (dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
5584                - 2.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n))
5585                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5586                - (2.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5587                - (pow(dReQ8n,2.)+pow(dImQ8n,2.))-2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5588                - 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)))
5589                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5590                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));
5591   four6n4n5n5n = ((pow(dReQ5n,2.)-pow(dImQ5n,2.))*(dReQ6n*dReQ4n-dImQ6n*dImQ4n) 
5592                + 2.*dReQ5n*dImQ5n*(dReQ6n*dImQ4n+dImQ6n*dReQ4n)
5593                - (dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
5594                - (pow(dReQ5n,2.)*dReQ10n+2.*dReQ5n*dImQ5n*dImQ10n-pow(dImQ5n,2.)*dReQ10n)
5595                - 2.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5596                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5597                + pow(dReQ10n,2.)+pow(dImQ10n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5598                + 4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))              
5599                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5600                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5601   // Four distinct harmonics (8): 
5602   four4n1n3n2n = (dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
5603                + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
5604                - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
5605                + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n 
5606                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5607                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5608                - (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5609                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5610                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5611                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5612                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5613                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5614                + 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
5615                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5616   four5n1n4n2n = (dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
5617                + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
5618                - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n+dImQ1n*dImQ2n*dReQ4n*dReQ5n
5619                + dReQ1n*dReQ2n*dReQ4n*dReQ5n
5620                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5621                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5622                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5623                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5624                - (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5625                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5626                + pow(dReQ6n,2.)+pow(dImQ6n,2.)
5627                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5628                + pow(dReQ3n,2.)+pow(dImQ3n,2.)+2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5629                + 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5630                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5631   four5n2n4n3n = (dImQ2n*dImQ3n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ2n*dReQ3n 
5632                + dImQ3n*dImQ5n*dReQ2n*dReQ4n-dImQ2n*dImQ5n*dReQ3n*dReQ4n
5633                - dImQ3n*dImQ4n*dReQ2n*dReQ5n+dImQ2n*dImQ4n*dReQ3n*dReQ5n 
5634                + dImQ2n*dImQ3n*dReQ4n*dReQ5n+dReQ2n*dReQ3n*dReQ4n*dReQ5n
5635                - (dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ5n*dImQ2n+dImQ7n*dImQ5n*dReQ2n)
5636                - (dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
5637                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5638                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5639                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5640                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5641                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5642                + 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5643                + 3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+pow(dReQ1n,2.)+pow(dImQ1n,2.)-6.*dMult)
5644                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5645   four6n1n4n3n = (dImQ1n*dImQ3n*dImQ4n*dImQ6n+dImQ4n*dImQ6n*dReQ1n*dReQ3n 
5646                + dImQ3n*dImQ6n*dReQ1n*dReQ4n-dImQ1n*dImQ6n*dReQ3n*dReQ4n
5647                - dImQ3n*dImQ4n*dReQ1n*dReQ6n+dImQ1n*dImQ4n*dReQ3n*dReQ6n+dImQ1n*dImQ3n*dReQ4n*dReQ6n
5648                + dReQ1n*dReQ3n*dReQ4n*dReQ6n
5649                - (dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
5650                - (dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
5651                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5652                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5653                - (dReQ4n*dReQ1n*dReQ3n-dReQ4n*dImQ1n*dImQ3n+dImQ4n*dReQ1n*dImQ3n+dImQ4n*dImQ1n*dReQ3n)
5654                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5655                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5656                + 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5657                + pow(dReQ2n,2.)+pow(dImQ2n,2.)+2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5658                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5659   four6n1n5n2n = (dImQ1n*dImQ2n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ1n*dReQ2n 
5660                + dImQ2n*dImQ6n*dReQ1n*dReQ5n-dImQ1n*dImQ6n*dReQ2n*dReQ5n
5661                - dImQ2n*dImQ5n*dReQ1n*dReQ6n+dImQ1n*dImQ5n*dReQ2n*dReQ6n+dImQ1n*dImQ2n*dReQ5n*dReQ6n
5662                + dReQ1n*dReQ2n*dReQ5n*dReQ6n
5663                - (dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
5664                - (dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ5n*dImQ2n+dImQ7n*dImQ5n*dReQ2n)
5665                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5666                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5667                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5668                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n) 
5669                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5670                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+pow(dReQ4n,2.)+pow(dImQ4n,2.)
5671                + 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5672                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5673   four6n3n2n1n = (dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
5674                - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
5675                + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
5676                + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n
5677                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5678                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5679                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5680                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5681                - (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5682                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5683                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+pow(dReQ5n,2.)+pow(dImQ5n,2.)
5684                + pow(dReQ4n,2.)+pow(dImQ4n,2.)+3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5685                + 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5686                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5687   four6n2n5n3n = (dImQ2n*dImQ3n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ2n*dReQ3n 
5688                + dImQ3n*dImQ6n*dReQ2n*dReQ5n-dImQ2n*dImQ6n*dReQ3n*dReQ5n
5689                - dImQ3n*dImQ5n*dReQ2n*dReQ6n+dImQ2n*dImQ5n*dReQ3n*dReQ6n+dImQ2n*dImQ3n*dReQ5n*dReQ6n
5690                + dReQ2n*dReQ3n*dReQ5n*dReQ6n
5691                - (dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n+dImQ8n*dImQ6n*dReQ2n)
5692                - (dReQ8n*dReQ5n*dReQ3n-dReQ8n*dImQ5n*dImQ3n+dImQ8n*dReQ5n*dImQ3n+dImQ8n*dImQ5n*dReQ3n)
5693                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5694                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5695                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5696                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5697                + pow(dReQ8n,2.)+pow(dImQ8n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5698                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5699                + 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+pow(dReQ1n,2.)+pow(dImQ1n,2.)-6.*dMult)
5700                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5701   four6n3n5n4n = (dImQ3n*dImQ4n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ3n*dReQ4n 
5702                + dImQ4n*dImQ6n*dReQ3n*dReQ5n-dImQ3n*dImQ6n*dReQ4n*dReQ5n
5703                - dImQ4n*dImQ5n*dReQ3n*dReQ6n+dImQ3n*dImQ5n*dReQ4n*dReQ6n+dImQ3n*dImQ4n*dReQ5n*dReQ6n
5704                + dReQ3n*dReQ4n*dReQ5n*dReQ6n
5705                - (dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n+dImQ9n*dImQ6n*dReQ3n)
5706                - (dReQ9n*dReQ5n*dReQ4n-dReQ9n*dImQ5n*dImQ4n+dImQ9n*dReQ5n*dImQ4n+dImQ9n*dImQ5n*dReQ4n)
5707                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5708                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5709                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5710                - (dReQ4n*dReQ3n*dReQ1n-dReQ4n*dImQ3n*dImQ1n+dImQ4n*dReQ3n*dImQ1n+dImQ4n*dImQ3n*dReQ1n)
5711                + pow(dReQ9n,2.)+pow(dImQ9n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5712                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5713                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+pow(dReQ2n,2.)+pow(dImQ2n,2.)
5714                + pow(dReQ1n,2.)+pow(dImQ1n,2.)-6.*dMult)
5715                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5716   f4pCorrelations->Fill(0.5,four1n1n1n1n,d4pMultiplicityWeight);
5717   f4pCorrelations->Fill(1.5,four2n2n2n2n,d4pMultiplicityWeight);
5718   f4pCorrelations->Fill(2.5,four3n3n3n3n,d4pMultiplicityWeight);
5719   f4pCorrelations->Fill(3.5,four4n4n4n4n,d4pMultiplicityWeight);
5720   f4pCorrelations->Fill(4.5,four5n5n5n5n,d4pMultiplicityWeight);
5721   f4pCorrelations->Fill(5.5,four6n6n6n6n,d4pMultiplicityWeight);
5722   //f4pCorrelations->Fill(6.5,0.,d4pMultiplicityWeight); // empty
5723   f4pCorrelations->Fill(7.5,four2n1n2n1n,d4pMultiplicityWeight);
5724   f4pCorrelations->Fill(8.5,four3n1n3n1n,d4pMultiplicityWeight);
5725   f4pCorrelations->Fill(9.5,four3n2n3n2n,d4pMultiplicityWeight);
5726   f4pCorrelations->Fill(10.5,four4n1n4n1n,d4pMultiplicityWeight);
5727   f4pCorrelations->Fill(11.5,four4n2n4n2n,d4pMultiplicityWeight);
5728   f4pCorrelations->Fill(12.5,four4n3n4n3n,d4pMultiplicityWeight);
5729   f4pCorrelations->Fill(13.5,four5n1n5n1n,d4pMultiplicityWeight);
5730   f4pCorrelations->Fill(14.5,four5n2n5n2n,d4pMultiplicityWeight);
5731   f4pCorrelations->Fill(15.5,four5n3n5n3n,d4pMultiplicityWeight);
5732   f4pCorrelations->Fill(16.5,four5n4n5n4n,d4pMultiplicityWeight);
5733   f4pCorrelations->Fill(17.5,four6n1n6n1n,d4pMultiplicityWeight);
5734   f4pCorrelations->Fill(18.5,four6n2n6n2n,d4pMultiplicityWeight);
5735   f4pCorrelations->Fill(19.5,four6n3n6n3n,d4pMultiplicityWeight);
5736   f4pCorrelations->Fill(20.5,four6n4n6n4n,d4pMultiplicityWeight);
5737   f4pCorrelations->Fill(21.5,four6n5n6n5n,d4pMultiplicityWeight);
5738   //f4pCorrelations->Fill(22.5,0.,d4pMultiplicityWeight); // empty
5739   f4pCorrelations->Fill(23.5,four3n1n1n1n,d4pMultiplicityWeight);
5740   f4pCorrelations->Fill(24.5,four6n2n2n2n,d4pMultiplicityWeight);
5741   //f4pCorrelations->Fill(25.5,0.,d4pMultiplicityWeight); // empty
5742   f4pCorrelations->Fill(26.5,four3n1n2n2n,d4pMultiplicityWeight);
5743   f4pCorrelations->Fill(27.5,four4n2n1n1n,d4pMultiplicityWeight);
5744   f4pCorrelations->Fill(28.5,four4n2n3n3n,d4pMultiplicityWeight);
5745   f4pCorrelations->Fill(29.5,four5n2n2n1n,d4pMultiplicityWeight);
5746   f4pCorrelations->Fill(30.5,four5n3n1n1n,d4pMultiplicityWeight);
5747   f4pCorrelations->Fill(31.5,four5n1n3n3n,d4pMultiplicityWeight);
5748   f4pCorrelations->Fill(32.5,four5n3n4n4n,d4pMultiplicityWeight);
5749   f4pCorrelations->Fill(33.5,four6n4n1n1n,d4pMultiplicityWeight);
5750   f4pCorrelations->Fill(34.5,four6n2n4n4n,d4pMultiplicityWeight);
5751   f4pCorrelations->Fill(35.5,four6n4n5n5n,d4pMultiplicityWeight);
5752   //f4pCorrelations->Fill(36.5,0.,d4pMultiplicityWeight); // empty
5753   f4pCorrelations->Fill(37.5,four4n1n3n2n,d4pMultiplicityWeight); 
5754   f4pCorrelations->Fill(38.5,four5n1n4n2n,d4pMultiplicityWeight); 
5755   f4pCorrelations->Fill(39.5,four5n2n4n3n,d4pMultiplicityWeight); 
5756   f4pCorrelations->Fill(40.5,four6n1n4n3n,d4pMultiplicityWeight); 
5757   f4pCorrelations->Fill(41.5,four6n1n5n2n,d4pMultiplicityWeight); 
5758   f4pCorrelations->Fill(42.5,four6n3n2n1n,d4pMultiplicityWeight); 
5759   f4pCorrelations->Fill(43.5,four6n2n5n3n,d4pMultiplicityWeight); 
5760   f4pCorrelations->Fill(44.5,four6n3n5n4n,d4pMultiplicityWeight); 
5761   allMixedCorrelators[15]=four1n1n1n1n;
5762   allMixedCorrelators[16]=four2n2n2n2n;
5763   allMixedCorrelators[17]=four3n3n3n3n;
5764   allMixedCorrelators[18]=four4n4n4n4n;
5765   allMixedCorrelators[19]=four5n5n5n5n;
5766   allMixedCorrelators[20]=four6n6n6n6n;
5767   allMixedCorrelators[21]=four2n1n2n1n;
5768   allMixedCorrelators[22]=four3n1n3n1n;
5769   allMixedCorrelators[23]=four3n2n3n2n;
5770   allMixedCorrelators[24]=four4n1n4n1n;
5771   allMixedCorrelators[25]=four4n2n4n2n;
5772   allMixedCorrelators[26]=four4n3n4n3n;
5773   allMixedCorrelators[27]=four5n1n5n1n;
5774   allMixedCorrelators[28]=four5n2n5n2n;
5775   allMixedCorrelators[29]=four5n3n5n3n;
5776   allMixedCorrelators[30]=four5n4n5n4n;
5777   allMixedCorrelators[31]=four6n1n6n1n;
5778   allMixedCorrelators[32]=four6n2n6n2n;
5779   allMixedCorrelators[33]=four6n3n6n3n;
5780   allMixedCorrelators[34]=four6n4n6n4n;
5781   allMixedCorrelators[35]=four6n5n6n5n;
5782   allMixedCorrelators[36]=four3n1n1n1n;
5783   allMixedCorrelators[37]=four6n2n2n2n;
5784   allMixedCorrelators[38]=four3n1n2n2n;
5785   allMixedCorrelators[39]=four4n2n1n1n;
5786   allMixedCorrelators[40]=four4n2n3n3n;
5787   allMixedCorrelators[41]=four5n2n2n1n;
5788   allMixedCorrelators[42]=four5n3n1n1n;
5789   allMixedCorrelators[43]=four5n1n3n3n;
5790   allMixedCorrelators[44]=four5n3n4n4n;
5791   allMixedCorrelators[45]=four6n4n1n1n;
5792   allMixedCorrelators[46]=four6n2n4n4n;
5793   allMixedCorrelators[47]=four6n4n5n5n;
5794   allMixedCorrelators[48]=four4n1n3n2n;
5795   allMixedCorrelators[49]=four5n1n4n2n;
5796   allMixedCorrelators[50]=four5n2n4n3n;
5797   allMixedCorrelators[51]=four6n1n4n3n;
5798   allMixedCorrelators[52]=four6n1n5n2n;
5799   allMixedCorrelators[53]=four6n3n2n1n;
5800   allMixedCorrelators[54]=four6n2n5n3n;
5801   allMixedCorrelators[55]=four6n3n5n4n;
5802  } // end of if(dMult>3.)
5803
5804  // f) Calculate 5-p correlations:
5805  //  f1) "Standard candles" (30):
5806  Double_t five3n2n3n1n1n = 0.; // <5>_{3n,2n|3n,1n,1n} = <cos(n(3*phi1+2*phi2-3*phi3-1*phi4-1*phi5))>
5807  Double_t five4n1n2n2n1n = 0.; // <5>_{4n,1n|2n,2n,1n} = <cos(n(4*phi1+1*phi2-2*phi3-2*phi4-1*phi5))>
5808  Double_t five4n2n3n2n1n = 0.; // <5>_{4n,2n|3n,2n,1n} = <cos(n(4*phi1+2*phi2-3*phi3-2*phi4-1*phi5))>
5809  Double_t five4n3n3n2n2n = 0.; // <5>_{4n,3n|3n,2n,2n} = <cos(n(4*phi1+3*phi2-3*phi3-2*phi4-2*phi5))>
5810  Double_t five4n2n4n1n1n = 0.; // <5>_{4n,2n|4n,1n,1n} = <cos(n(4*phi1+2*phi2-4*phi3-1*phi4-1*phi5))>
5811  Double_t five4n3n4n2n1n = 0.; // <5>_{4n,3n|4n,2n,1n} = <cos(n(4*phi1+3*phi2-4*phi3-2*phi4-1*phi5))>
5812  Double_t five5n1n3n2n1n = 0.; // <5>_{5n,1n|3n,2n,1n} = <cos(n(5*phi1+1*phi2-3*phi3-2*phi4-1*phi5))>
5813  Double_t five5n2n5n1n1n = 0.; // <5>_{5n,2n|5n,1n,1n} = <cos(n(5*phi1+2*phi2-5*phi3-1*phi4-1*phi5))>
5814  Double_t five5n2n4n2n1n = 0.; // <5>_{5n,2n|4n,2n,1n} = <cos(n(5*phi1+2*phi2-4*phi3-2*phi4-1*phi5))>
5815  Double_t five5n3n4n3n1n = 0.; // <5>_{5n,3n|4n,3n,1n} = <cos(n(5*phi1+3*phi2-4*phi3-3*phi4-1*phi5))>
5816  Double_t five5n4n4n3n2n = 0.; // <5>_{5n,4n|4n,3n,2n} = <cos(n(5*phi1+4*phi2-4*phi3-3*phi4-2*phi5))>
5817  Double_t five5n3n5n2n1n = 0.; // <5>_{5n,3n|5n,2n,1n} = <cos(n(5*phi1+3*phi2-5*phi3-2*phi4-1*phi5))>
5818  Double_t five5n4n5n2n2n = 0.; // <5>_{5n,4n|5n,2n,2n} = <cos(n(5*phi1+4*phi2-5*phi3-2*phi4-2*phi5))>
5819  Double_t five5n4n5n3n1n = 0.; // <5>_{5n,4n|5n,3n,1n} = <cos(n(5*phi1+4*phi2-5*phi3-3*phi4-1*phi5))>
5820  Double_t five6n1n3n3n1n = 0.; // <5>_{6n,1n|3n,3n,1n} = <cos(n(6*phi1+1*phi2-3*phi3-3*phi4-1*phi5))>
5821  Double_t five6n2n3n3n2n = 0.; // <5>_{6n,2n|3n,3n,2n} = <cos(n(6*phi1+2*phi2-3*phi3-3*phi4-2*phi5))>
5822  Double_t five6n1n4n2n1n = 0.; // <5>_{6n,1n|4n,2n,1n} = <cos(n(6*phi1+1*phi2-4*phi3-2*phi4-1*phi5))>
5823  Double_t five6n3n4n3n2n = 0.; // <5>_{6n,3n|4n,3n,2n} = <cos(n(6*phi1+3*phi2-4*phi3-3*phi4-2*phi5))>
5824  Double_t five6n4n4n3n3n = 0.; // <5>_{6n,4n|4n,3n,3n} = <cos(n(6*phi1+4*phi2-4*phi3-3*phi4-3*phi5))>
5825  Double_t five6n2n5n2n1n = 0.; // <5>_{6n,2n|5n,2n,1n} = <cos(n(6*phi1+2*phi2-5*phi3-2*phi4-1*phi5))>
5826  Double_t five6n3n5n3n1n = 0.; // <5>_{6n,3n|5n,3n,1n} = <cos(n(6*phi1+3*phi2-5*phi3-3*phi4-1*phi5))>
5827  Double_t five6n4n5n4n1n = 0.; // <5>_{6n,4n|5n,4n,1n} = <cos(n(6*phi1+4*phi2-5*phi3-4*phi4-1*phi5))>
5828  Double_t five6n5n5n3n3n = 0.; // <5>_{6n,5n|5n,3n,3n} = <cos(n(6*phi1+5*phi2-5*phi3-3*phi4-3*phi5))>
5829  Double_t five6n2n6n1n1n = 0.; // <5>_{6n,2n|6n,1n,1n} = <cos(n(6*phi1+2*phi2-6*phi3-1*phi4-1*phi5))>
5830  Double_t five6n3n6n2n1n = 0.; // <5>_{6n,3n|6n,2n,1n} = <cos(n(6*phi1+3*phi2-6*phi3-2*phi4-1*phi5))>
5831  Double_t five6n4n6n2n2n = 0.; // <5>_{6n,4n|6n,2n,2n} = <cos(n(6*phi1+4*phi2-6*phi3-2*phi4-2*phi5))>
5832  Double_t five6n4n6n3n1n = 0.; // <5>_{6n,4n|6n,3n,1n} = <cos(n(6*phi1+4*phi2-6*phi3-3*phi4-1*phi5))>
5833  Double_t five6n5n5n4n2n = 0.; // <5>_{6n,5n|5n,4n,2n} = <cos(n(6*phi1+5*phi2-5*phi3-4*phi4-2*phi5))>
5834  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
5835  Double_t five6n5n6n4n1n = 0.; // <5>_{6n,5n|6n,4n,1n} = <cos(n(6*phi1+5*phi2-6*phi3-4*phi4-1*phi5))>
5836  //  f2) Two distinct harmonics (9):
5837  Double_t five2n1n1n1n1n = 0.; // <5>_{2n,1n|1n,1n,1n} = <cos(n(2*phi1+1*phi2-1*phi3-1*phi4-1*phi5))>
5838  Double_t five2n2n2n1n1n = 0.; // <5>_{2n,2n|2n,1n,1n} = <cos(n(2*phi1+2*phi2-2*phi3-1*phi4-1*phi5))>
5839  Double_t five3n3n2n2n2n = 0.; // <5>_{3n,3n|2n,2n,2n} = <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-2*phi5))>
5840  Double_t five4n1n1n1n1n = 0.; // <5>_{4n|1n,1n,1n,1n} = <cos(n(4*phi1-1*phi2-1*phi3-1*phi4-1*phi5))>
5841  Double_t five4n2n2n2n2n = 0.; // <5>_{4n,2n|2n,2n,2n} = <cos(n(4*phi1+2*phi2-2*phi3-2*phi4-2*phi5))>
5842  Double_t five4n4n4n2n2n = 0.; // <5>_{4n,4n|4n,2n,2n} = <cos(n(4*phi1+4*phi2-4*phi3-2*phi4-2*phi5))>
5843  Double_t five6n3n3n3n3n = 0.; // <5>_{6n,3n|3n,3n,3n} = <cos(n(6*phi1+3*phi2-3*phi3-3*phi4-3*phi5))>
5844  Double_t five6n6n4n4n4n = 0.; // <5>_{6n,6n|4n,4n,4n} = <cos(n(6*phi1+6*phi2-4*phi3-4*phi4-4*phi5))>
5845  Double_t five6n6n6n3n3n = 0.; // <5>_{6n,6n|6n,3n,3n} = <cos(n(6*phi1+6*phi2-6*phi3-3*phi4-3*phi5))>
5846  //  f3) Three distinct harmonics (30):
5847  Double_t five3n1n2n1n1n = 0.; // <5>_{3n,1n|2n,1n,1n} = <cos(n(3*phi1+1*phi2-2*phi3-1*phi4-1*phi5))>
5848  Double_t five3n2n2n2n1n = 0.; // <5>_{3n,2n|2n,2n,1n} = <cos(n(3*phi1+2*phi2-2*phi3-2*phi4-1*phi5))>
5849  Double_t five3n3n3n2n1n = 0.; // <5>_{3n,3n|3n,2n,1n} = <cos(n(3*phi1+3*phi2-3*phi3-2*phi4-1*phi5))>
5850  Double_t five4n1n3n1n1n = 0.; // <5>_{4n,1n|3n,1n,1n} = <cos(n(4*phi1+1*phi2-3*phi3-1*phi4-1*phi5))>
5851  Double_t five4n1n1n3n3n = 0.; // <5>_{4n,1n,1n|3n,3n} = <cos(n(4*phi1+1*phi2+1*phi3-3*phi4-3*phi5))>
5852  Double_t five4n3n3n3n1n = 0.; // <5>_{4n,3n|3n,3n,1n} = <cos(n(4*phi1+3*phi2-3*phi3-3*phi4-1*phi5))>
5853  Double_t five4n4n3n3n2n = 0.; // <5>_{4n,4n|3n,3n,2n} = <cos(n(4*phi1+4*phi2-3*phi3-3*phi4-2*phi5))>
5854  Double_t five4n4n4n3n1n = 0.; // <5>_{4n,4n|4n,3n,1n} = <cos(n(4*phi1+4*phi2-4*phi3-3*phi4-1*phi5))>
5855  Double_t five5n2n1n1n1n = 0.; // <5>_{5n|2n,1n,1n,1n} = <cos(n(5*phi1-2*phi2-1*phi3-1*phi4-1*phi5))>
5856  Double_t five5n1n2n2n2n = 0.; // <5>_{5n,1n|2n,2n,2n} = <cos(n(5*phi1+1*phi2-2*phi3-2*phi4-2*phi5))>
5857  Double_t five5n2n3n2n2n = 0.; // <5>_{5n,2n|3n,2n,2n} = <cos(n(5*phi1+2*phi2-3*phi3-2*phi4-2*phi5))>
5858  Double_t five5n3n3n3n2n = 0.; // <5>_{5n,3n|3n,3n,2n} = <cos(n(5*phi1+3*phi2-3*phi3-3*phi4-2*phi5))>
5859  Double_t five5n1n4n1n1n = 0.; // <5>_{5n,1n|4n,1n,1n} = <cos(n(5*phi1+1*phi2-4*phi3-1*phi4-1*phi5))>
5860  Double_t five5n4n3n3n3n = 0.; // <5>_{5n,4n|3n,3n,3n} = <cos(n(5*phi1+4*phi2-3*phi3-3*phi4-3*phi5))>
5861  Double_t five5n4n4n4n1n = 0.; // <5>_{5n,4n|4n,4n,1n} = <cos(n(5*phi1+4*phi2-4*phi3-4*phi4-1*phi5))>
5862  Double_t five5n5n4n3n3n = 0.; // <5>_{5n,5n|4n,3n,3n} = <cos(n(5*phi1+5*phi2-4*phi3-3*phi4-3*phi5))>
5863  Double_t five5n5n4n4n2n = 0.; // <5>_{5n,5n|4n,4n,2n} = <cos(n(5*phi1+5*phi2-4*phi3-4*phi4-2*phi5))>
5864  Double_t five5n5n5n3n2n = 0.; // <5>_{5n,5n|5n,3n,2n} = <cos(n(5*phi1+5*phi2-5*phi3-3*phi4-2*phi5))>
5865  Double_t five5n5n5n4n1n = 0.; // <5>_{5n,5n|5n,4n,1n} = <cos(n(5*phi1+5*phi2-5*phi3-4*phi4-1*phi5))>
5866  Double_t five6n2n2n1n1n = 0.; // <5>_{6n|2n,2n,1n,1n} = <cos(n(6*phi1-2*phi2-2*phi3-1*phi4-1*phi5))>
5867  Double_t five6n3n1n1n1n = 0.; // <5>_{6n|3n,1n,1n,1n} = <cos(n(6*phi1-3*phi2-1*phi3-1*phi4-1*phi5))>
5868  Double_t five6n1n1n4n4n = 0.; // <5>_{6n,1n,1n|4n,4n} = <cos(n(6*phi1+1*phi2+1*phi3-4*phi4-4*phi5))>
5869  Double_t five6n1n5n1n1n = 0.; // <5>_{6n,1n|5n,1n,1n} = <cos(n(6*phi1+1*phi2-5*phi3-1*phi4-1*phi5))>
5870  Double_t five6n2n4n2n2n = 0.; // <5>_{6n,2n|4n,2n,2n} = <cos(n(6*phi1+2*phi2-4*phi3-2*phi4-2*phi5))>
5871  Double_t five6n4n4n4n2n = 0.; // <5>_{6n,4n|4n,4n,2n} = <cos(n(6*phi1+4*phi2-4*phi3-4*phi4-2*phi5))>
5872  Double_t five6n2n2n5n5n = 0.; // <5>_{6n,2n,2n|5n,5n} = <cos(n(6*phi1+2*phi2+2*phi3-5*phi4-5*phi5))>
5873  Double_t five6n5n5n5n1n = 0.; // <5>_{6n,5n|5n,5n,1n} = <cos(n(6*phi1+5*phi2-5*phi3-5*phi4-1*phi5))>
5874  Double_t five6n6n5n5n2n = 0.; // <5>_{6n,6n|5n,5n,2n} = <cos(n(6*phi1+6*phi2-5*phi3-5*phi4-2*phi5))>
5875  Double_t five6n6n6n4n2n = 0.; // <5>_{6n,6n|6n,4n,2n} = <cos(n(6*phi1+6*phi2-6*phi3-4*phi4-2*phi5))>
5876  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
5877  // Four distinct harmonics (11):
5878  Double_t five5n2n3n3n1n = 0.; // <5>_{5n,2n|3n,3n,1n} = <cos(n(5*phi1+2*phi2-3*phi3-3*phi4-1*phi5))>
5879  Double_t five5n1n1n4n3n = 0.; // <5>_{5n,1n,1n|4n,3n} = <cos(n(5*phi1+1*phi2+1*phi3-4*phi4-3*phi5))>
5880  Double_t five5n3n4n2n2n = 0.; // <5>_{5n,3n|4n,2n,2n} = <cos(n(5*phi1+3*phi2-4*phi3-2*phi4-2*phi5))>
5881  Double_t five5n2n1n4n4n = 0.; // <5>_{5n,2n,1n|4n,4n} = <cos(n(5*phi1+2*phi2+1*phi3-4*phi4-4*phi5))>
5882  Double_t five6n1n3n2n2n = 0.; // <5>_{6n,1n|3n,2n,2n} = <cos(n(6*phi1+1*phi2-3*phi3-2*phi4-2*phi5))>
5883  Double_t five6n3n4n4n1n = 0.; // <5>_{6n,3n|4n,4n,1n} = <cos(n(6*phi1+3*phi2-4*phi3-4*phi4-1*phi5))>
5884  Double_t five6n1n1n5n3n = 0.; // <5>_{6n,1n,1n|5n,3n} = <cos(n(6*phi1+1*phi2+1*phi3-5*phi4-3*phi5))>
5885  Double_t five6n3n5n2n2n = 0.; // <5>_{6n,3n|5n,2n,2n} = <cos(n(6*phi1+3*phi2-5*phi3-2*phi4-2*phi5))>
5886  Double_t five6n5n4n4n3n = 0.; // <5>_{6n,5n|4n,4n,3n} = <cos(n(6*phi1+5*phi2-4*phi3-4*phi4-3*phi5))>
5887  Double_t five6n3n1n5n5n = 0.; // <5>_{6n,3n,1n|5n,5n} = <cos(n(6*phi1+3*phi2+1*phi3-5*phi4-5*phi5))>
5888  Double_t five6n6n5n4n3n = 0.; // <5>_{6n,6n|5n,4n,3n} = <cos(n(6*phi1+6*phi2-5*phi3-4*phi4-3*phi5))>
5889  // Five distinct harmonics (3):
5890  Double_t five6n2n4n3n1n = 0.; // <5>_{6n,2n|4n,3n,1n} = <cos(n(6*phi1+2*phi2-4*phi3-3*phi4-1*phi5))>
5891  Double_t five6n2n1n5n4n = 0.; // <5>_{6n,2n,1n|5n,4n} = <cos(n(6*phi1+2*phi2+1*phi3-5*phi4-4*phi5))>
5892  Double_t five6n4n5n3n2n = 0.; // <5>_{6n,4n|5n,3n,2n} = <cos(n(6*phi1+4*phi2-5*phi3-3*phi4-2*phi5))>
5893  if(dMult>4.)
5894  {
5895   five3n2n3n1n1n = (-(pow(dImQ3n,2.)+pow(dReQ3n,2.))
5896                  * (-2.*dImQ1n*dImQ2n*dReQ1n+pow(dImQ1n,2.)*dReQ2n-pow(dReQ1n,2.)*dReQ2n)
5897                  - (-pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
5898                  + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
5899                  - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n)
5900                  - 2.*(dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
5901                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
5902                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
5903                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
5904                  - (dReQ3n*pow(dReQ1n,3.)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2.)
5905                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2.)-dImQ3n*pow(dImQ1n,3.))
5906                  - 2.*((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
5907                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5908                  + 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5909                  + 3.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5910                  + 6.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5911                  + 2.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5912                  + 9.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5913                  - (dMult-8.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5914                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
5915                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
5916                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5917                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(dMult-12.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5918                  + 2.*(dMult-9.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.))
5919                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
5920   five4n1n2n2n1n = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))
5921                  * (pow(dReQ2n,2.)*dReQ4n-pow(dImQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n)
5922                  - 2.*(dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
5923                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
5924                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
5925                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)    
5926                  - 2.*((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) 
5927                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
5928                  - (-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
5929                  + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
5930                  - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n)
5931                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
5932                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5933                  + (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5934                  + 2.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5935                  + 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5936                  + 2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5937                  + 3.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5938                  + 4.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5939                  + 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5940                  + 6.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5941                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5942                  - (dMult-6.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5943                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5944                  - 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5945                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5946                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5947                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5948                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5949                  + 2.*(dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.))
5950                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
5951   five4n2n3n2n1n = ((pow(dImQ2n,2.)+pow(dReQ2n,2.))*(dImQ3n*dImQ4n*dReQ1n+dImQ1n*dImQ4n*dReQ3n 
5952                  - dImQ1n*dImQ3n*dReQ4n+dReQ1n*dReQ3n*dReQ4n)
5953                  - (dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
5954                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
5955                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
5956                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
5957                  - (dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
5958                  + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
5959                  - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n 
5960                  + dImQ1n*dImQ2n*dReQ4n*dReQ5n+dReQ1n*dReQ2n*dReQ4n*dReQ5n)
5961                  - ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
5962                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n)
5963                  - (dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
5964                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
5965                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
5966                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
5967                  - ((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) 
5968                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
5969                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
5970                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5971                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5972                  + 3.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5973                  + (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5974                  + pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n
5975                  + dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n
5976                  + 3.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5977                  - (dMult-7.)*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5978                  + 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5979                  + 7.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5980                  + 4.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5981                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5982                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5983                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5984                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5985                  + 2.*(dMult-7.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+(dMult-12.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5986                  - 2.*dMult*(dMult-12.))
5987                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
5988
5989   // *********************************************************************
5990   Double_t reQ7nQ3nstarQ2nstarQ2nstar = (dReQ7n*dReQ3n+dImQ7n*dImQ3n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
5991                                       + 2.*dReQ2n*dImQ2n*(dImQ7n*dReQ3n-dReQ7n*dImQ3n); 
5992   Double_t reQ5nQ2nQ4nstarQ3nstar = dImQ2n*dImQ3n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ2n*dReQ3n 
5993                                   + dImQ3n*dImQ5n*dReQ2n*dReQ4n-dImQ2n*dImQ5n*dReQ3n*dReQ4n
5994                                   - dImQ3n*dImQ4n*dReQ2n*dReQ5n+dImQ2n*dImQ4n*dReQ3n*dReQ5n 
5995                                   + dImQ2n*dImQ3n*dReQ4n*dReQ5n+dReQ2n*dReQ3n*dReQ4n*dReQ5n;
5996   Double_t reQ7nQ4nstarQ3nstar = dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n
5997                                + dImQ7n*dImQ4n*dReQ3n; 
5998
5999
6000   Double_t reQ7nQ5nstarQ2nstar = dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ5n*dImQ2n
6001                                + dImQ7n*dImQ5n*dReQ2n;
6002
6003   // <5>_{6n,4n|4n,3n,3n}:
6004   Double_t reQ10nQ4nstarQ3nstarQ3nstar = (dReQ10n*dReQ4n+dImQ10n*dImQ4n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
6005                                       + 2.*dReQ3n*dImQ3n*(dImQ10n*dReQ4n-dReQ10n*dImQ4n); 
6006   Double_t reQ7nQ3nQ6nstarQ4nstar = dImQ3n*dImQ4n*dImQ6n*dImQ7n+dImQ6n*dImQ7n*dReQ3n*dReQ4n 
6007                                   + dImQ4n*dImQ7n*dReQ3n*dReQ6n-dImQ3n*dImQ7n*dReQ4n*dReQ6n
6008                                   - dImQ4n*dImQ6n*dReQ3n*dReQ7n+dImQ3n*dImQ6n*dReQ4n*dReQ7n 
6009                                   + dImQ3n*dImQ4n*dReQ6n*dReQ7n+dReQ3n*dReQ4n*dReQ6n*dReQ7n;
6010   Double_t reQ10nQ7nstarQ3nstar = dReQ10n*dReQ7n*dReQ3n-dReQ10n*dImQ7n*dImQ3n+dImQ10n*dReQ7n*dImQ3n
6011                                 + dImQ10n*dImQ7n*dReQ3n; 
6012   Double_t reQ10nQ6nstarQ4nstar = dReQ10n*dReQ6n*dReQ4n-dReQ10n*dImQ6n*dImQ4n+dImQ10n*dReQ6n*dImQ4n
6013                                 + dImQ10n*dImQ6n*dReQ4n; 
6014   Double_t reQ6nQ1nQ4nstarQ3nstar = dImQ1n*dImQ3n*dImQ4n*dImQ6n+dImQ4n*dImQ6n*dReQ1n*dReQ3n 
6015                                   + dImQ3n*dImQ6n*dReQ1n*dReQ4n-dImQ1n*dImQ6n*dReQ3n*dReQ4n
6016                                   - dImQ3n*dImQ4n*dReQ1n*dReQ6n+dImQ1n*dImQ4n*dReQ3n*dReQ6n 
6017                                   + dImQ1n*dImQ3n*dReQ4n*dReQ6n+dReQ1n*dReQ3n*dReQ4n*dReQ6n;
6018   Double_t reQ7nQ6nstarQ1nstar = dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n
6019                                + dImQ7n*dImQ6n*dReQ1n;
6020  // <5>_{6n,5n|5n,3n,3n}:
6021  /*Double_t reQ11nQ5nstarQ3nstarQ3nstar = (dReQ11n*dReQ5n+dImQ11n*dImQ5n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
6022                                       + 2.*dReQ3n*dImQ3n*(dImQ11n*dReQ5n-dReQ11n*dImQ5n); */
6023  Double_t reQ6nQ2nQ5nstarQ3nstar = dImQ2n*dImQ3n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ2n*dReQ3n 
6024                                  + dImQ3n*dImQ6n*dReQ2n*dReQ5n-dImQ2n*dImQ6n*dReQ3n*dReQ5n
6025                                  - dImQ3n*dImQ5n*dReQ2n*dReQ6n+dImQ2n*dImQ5n*dReQ3n*dReQ6n 
6026                                  + dImQ2n*dImQ3n*dReQ5n*dReQ6n+dReQ2n*dReQ3n*dReQ5n*dReQ6n;
6027  Double_t reQ8nQ3nQ6nstarQ5nstar = dImQ3n*dImQ5n*dImQ6n*dImQ8n+dImQ6n*dImQ8n*dReQ3n*dReQ5n 
6028                                  + dImQ5n*dImQ8n*dReQ3n*dReQ6n-dImQ3n*dImQ8n*dReQ5n*dReQ6n
6029                                  - dImQ5n*dImQ6n*dReQ3n*dReQ8n+dImQ3n*dImQ6n*dReQ5n*dReQ8n 
6030                                  + dImQ3n*dImQ5n*dReQ6n*dReQ8n+dReQ3n*dReQ5n*dReQ6n*dReQ8n;
6031  Double_t reQ11nQ6nstarQ5nstar = dReQ11n*dReQ6n*dReQ5n-dReQ11n*dImQ6n*dImQ5n+dImQ11n*dReQ6n*dImQ5n
6032                                + dImQ11n*dImQ6n*dReQ5n;
6033  Double_t reQ8nQ6nstarQ2nstar = dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n
6034                               + dImQ8n*dImQ6n*dReQ2n; 
6035  Double_t reQ11nQ8nstarQ3nstar = dReQ11n*dReQ8n*dReQ3n-dReQ11n*dImQ8n*dImQ3n+dImQ11n*dReQ8n*dImQ3n
6036                                + dImQ11n*dImQ8n*dReQ3n;
6037  Double_t reQ8nQ5nstarQ3nstar = dReQ8n*dReQ5n*dReQ3n-dReQ8n*dImQ5n*dImQ3n+dImQ8n*dReQ5n*dImQ3n
6038                               + dImQ8n*dImQ5n*dReQ3n; 
6039  // <5>_{5n,2n|5n,1n,1n}
6040  Double_t reQ7nQ5nstarQ1nstarQ1nstar = (dReQ7n*dReQ5n+dImQ7n*dImQ5n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
6041                                       + 2.*dReQ1n*dImQ1n*(dImQ7n*dReQ5n-dReQ7n*dImQ5n); 
6042  Double_t reQ6nQ1nQ5nstarQ2nstar = dImQ1n*dImQ2n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ1n*dReQ2n 
6043                                  + dImQ2n*dImQ6n*dReQ1n*dReQ5n-dImQ1n*dImQ6n*dReQ2n*dReQ5n
6044                                  - dImQ2n*dImQ5n*dReQ1n*dReQ6n+dImQ1n*dImQ5n*dReQ2n*dReQ6n 
6045                                  + dImQ1n*dImQ2n*dReQ5n*dReQ6n+dReQ1n*dReQ2n*dReQ5n*dReQ6n;
6046  // <5>_{5n,4n|5n,2n,2n}
6047  Double_t reQ9nQ5nstarQ2nstarQ2nstar = (dReQ9n*dReQ5n+dImQ9n*dImQ5n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
6048                                      + 2.*dReQ2n*dImQ2n*(dImQ9n*dReQ5n-dReQ9n*dImQ5n);
6049  Double_t reQ7nQ2nQ5nstarQ4nstar = dImQ2n*dImQ4n*dImQ5n*dImQ7n+dImQ5n*dImQ7n*dReQ2n*dReQ4n 
6050                                  + dImQ4n*dImQ7n*dReQ2n*dReQ5n-dImQ2n*dImQ7n*dReQ4n*dReQ5n
6051                                  - dImQ4n*dImQ5n*dReQ2n*dReQ7n+dImQ2n*dImQ5n*dReQ4n*dReQ7n 
6052                                  + dImQ2n*dImQ4n*dReQ5n*dReQ7n+dReQ2n*dReQ4n*dReQ5n*dReQ7n;
6053  Double_t reQ9nQ5nstarQ4nstar = dReQ9n*dReQ5n*dReQ4n-dReQ9n*dImQ5n*dImQ4n+dImQ9n*dReQ5n*dImQ4n
6054                               + dImQ9n*dImQ5n*dReQ4n; 
6055  Double_t reQ9nQ7nstarQ2nstar = dReQ9n*dReQ7n*dReQ2n-dReQ9n*dImQ7n*dImQ2n+dImQ9n*dReQ7n*dImQ2n
6056                               + dImQ9n*dImQ7n*dReQ2n; 
6057  // <5>_{6n,2n|6n,1n,1n}
6058  Double_t reQ8nQ6nstarQ1nstarQ1nstar = (dReQ8n*dReQ6n+dImQ8n*dImQ6n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
6059                                      + 2.*dReQ1n*dImQ1n*(dImQ8n*dReQ6n-dReQ8n*dImQ6n);
6060  Double_t reQ7nQ1nQ6nstarQ2nstar = dImQ1n*dImQ2n*dImQ6n*dImQ7n+dImQ6n*dImQ7n*dReQ1n*dReQ2n 
6061                                  + dImQ2n*dImQ7n*dReQ1n*dReQ6n-dImQ1n*dImQ7n*dReQ2n*dReQ6n
6062                                  - dImQ2n*dImQ6n*dReQ1n*dReQ7n+dImQ1n*dImQ6n*dReQ2n*dReQ7n 
6063                                  + dImQ1n*dImQ2n*dReQ6n*dReQ7n+dReQ1n*dReQ2n*dReQ6n*dReQ7n;
6064  Double_t reQ8nQ7nstarQ1nstar = dReQ8n*dReQ7n*dReQ1n-dReQ8n*dImQ7n*dImQ1n+dImQ8n*dReQ7n*dImQ1n
6065                               + dImQ8n*dImQ7n*dReQ1n;
6066  // <5>_{5n,2n|4n,2n,1n}
6067  Double_t reQ5nQ2nQ4nstarQ2nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
6068                                         * (dReQ1n*dReQ4n*dReQ5n-dReQ5n*dImQ1n*dImQ4n 
6069                                         + dReQ4n*dImQ1n*dImQ5n+dReQ1n*dImQ4n*dImQ5n);
6070  Double_t reQ7nQ4nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ4n*dReQ7n-dReQ4n*dReQ7n*dImQ1n*dImQ2n 
6071                                      - dReQ2n*dReQ7n*dImQ1n*dImQ4n-dReQ1n*dReQ7n*dImQ2n*dImQ4n 
6072                                      + dReQ2n*dReQ4n*dImQ1n*dImQ7n+dReQ1n*dReQ4n*dImQ2n*dImQ7n 
6073                                      + dReQ1n*dReQ2n*dImQ4n*dImQ7n-dImQ1n*dImQ2n*dImQ4n*dImQ7n;
6074  // <5>_{4n,3n|4n,2n,1n}:
6075  Double_t reQ4nQ3nQ4nstarQ2nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n 
6076                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n) 
6077                                         * (pow(dReQ4n,2.)+pow(dImQ4n,2.));        
6078  /*
6079  Double_t reQ4nQ1nQ3nstarQ2nstar = dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
6080                                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
6081                                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
6082                                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n;
6083  */
6084  // <5>_{5n,3n|4n,3n,1n}:
6085  Double_t reQ5nQ3nQ4nstarQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))
6086                                         * (dReQ1n*dReQ4n*dReQ5n-dReQ5n*dImQ1n*dImQ4n 
6087                                         + dReQ4n*dImQ1n*dImQ5n+dReQ1n*dImQ4n*dImQ5n);
6088  Double_t reQ5nQ3nQ4nstarQ4nstar = dReQ3n*pow(dReQ4n,2.)*dReQ5n+2.*dReQ4n*dReQ5n*dImQ3n*dImQ4n 
6089                                  - dReQ3n*dReQ5n*pow(dImQ4n,2.)-pow(dReQ4n,2.)*dImQ3n*dImQ5n
6090                                  + 2.*dReQ3n*dReQ4n*dImQ4n*dImQ5n+dImQ3n*pow(dImQ4n,2.)*dImQ5n;
6091  Double_t reQ7nQ1nQ5nstarQ3nstar = dImQ1n*dImQ3n*dImQ5n*dImQ7n+dImQ5n*dImQ7n*dReQ1n*dReQ3n 
6092                                  + dImQ3n*dImQ7n*dReQ1n*dReQ5n-dImQ1n*dImQ7n*dReQ3n*dReQ5n
6093                                  - dImQ3n*dImQ5n*dReQ1n*dReQ7n+dImQ1n*dImQ5n*dReQ3n*dReQ7n 
6094                                  + dImQ1n*dImQ3n*dReQ5n*dReQ7n+dReQ1n*dReQ3n*dReQ5n*dReQ7n;             
6095  Double_t reQ8nQ4nstarQ3nstarQ1nstar = dReQ1n*dReQ3n*dReQ4n*dReQ8n-dReQ4n*dReQ8n*dImQ1n*dImQ3n 
6096                                      - dReQ3n*dReQ8n*dImQ1n*dImQ4n-dReQ1n*dReQ8n*dImQ3n*dImQ4n 
6097                                      + dReQ3n*dReQ4n*dImQ1n*dImQ8n+dReQ1n*dReQ4n*dImQ3n*dImQ8n 
6098                                      + dReQ1n*dReQ3n*dImQ4n*dImQ8n-dImQ1n*dImQ3n*dImQ4n*dImQ8n;
6099  Double_t reQ8nQ4nstarQ4nstar = pow(dReQ4n,2.)*dReQ8n-dReQ8n*pow(dImQ4n,2.)+2.*dReQ4n*dImQ4n*dImQ8n;
6100  // <5>_{5n,4n|4n,3n,2n}:
6101  Double_t reQ5nQ4nQ4nstarQ3nstarQ2nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))
6102                                         * (dReQ2n*dReQ3n*dReQ5n-dReQ5n*dImQ2n*dImQ3n 
6103                                         + dReQ3n*dImQ2n*dImQ5n+dReQ2n*dImQ3n*dImQ5n);
6104  Double_t reQ6nQ3nQ5nstarQ4nstar = dImQ4n*dImQ3n*dImQ6n*dImQ5n+dImQ6n*dImQ5n*dReQ4n*dReQ3n 
6105                                  + dImQ3n*dImQ5n*dReQ4n*dReQ6n-dImQ4n*dImQ5n*dReQ3n*dReQ6n
6106                                  - dImQ3n*dImQ6n*dReQ4n*dReQ5n+dImQ4n*dImQ6n*dReQ3n*dReQ5n 
6107                                  + dImQ4n*dImQ3n*dReQ6n*dReQ5n+dReQ4n*dReQ3n*dReQ6n*dReQ5n;
6108  Double_t reQ9nQ4nstarQ3nstarQ2nstar = dReQ2n*dReQ3n*dReQ4n*dReQ9n-dReQ4n*dReQ9n*dImQ2n*dImQ3n 
6109                                      - dReQ3n*dReQ9n*dImQ2n*dImQ4n-dReQ2n*dReQ9n*dImQ3n*dImQ4n 
6110                                      + dReQ3n*dReQ4n*dImQ2n*dImQ9n+dReQ2n*dReQ4n*dImQ3n*dImQ9n 
6111                                      + dReQ2n*dReQ3n*dImQ4n*dImQ9n-dImQ2n*dImQ3n*dImQ4n*dImQ9n;   
6112  Double_t reQ9nQ6nstarQ3nstar = dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n
6113                               + dImQ9n*dImQ6n*dReQ3n; 
6114  // <5>_{5n,3n|5n,2n,1n}:
6115  Double_t reQ5nQ3nQ5nstarQ2nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n 
6116                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n) 
6117                                         * (pow(dReQ5n,2.)+pow(dImQ5n,2.));
6118  Double_t reQ8nQ5nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ5n*dReQ8n-dReQ5n*dReQ8n*dImQ1n*dImQ2n 
6119                                      - dReQ2n*dReQ8n*dImQ1n*dImQ5n-dReQ1n*dReQ8n*dImQ2n*dImQ5n 
6120                                      + dReQ2n*dReQ5n*dImQ1n*dImQ8n+dReQ1n*dReQ5n*dImQ2n*dImQ8n 
6121                                      + dReQ1n*dReQ2n*dImQ5n*dImQ8n-dImQ1n*dImQ2n*dImQ5n*dImQ8n;
6122  // <5>_{5n,4n|5n,3n,1n}:
6123  Double_t reQ5nQ4nQ5nstarQ3nstarQ1nstar = (dReQ1n*dReQ3n*dReQ4n-dReQ4n*dImQ1n*dImQ3n 
6124                                         + dReQ3n*dImQ1n*dImQ4n+dReQ1n*dImQ3n*dImQ4n) 
6125                                         * (pow(dReQ5n,2.)+pow(dImQ5n,2.));
6126  Double_t reQ8nQ1nQ5nstarQ4nstar = dImQ4n*dImQ1n*dImQ8n*dImQ5n+dImQ8n*dImQ5n*dReQ4n*dReQ1n 
6127                                  + dImQ1n*dImQ5n*dReQ4n*dReQ8n-dImQ4n*dImQ5n*dReQ1n*dReQ8n
6128                                  - dImQ1n*dImQ8n*dReQ4n*dReQ5n+dImQ4n*dImQ8n*dReQ1n*dReQ5n 
6129                                  + dImQ4n*dImQ1n*dReQ8n*dReQ5n+dReQ4n*dReQ1n*dReQ8n*dReQ5n;                      
6130  Double_t reQ9nQ5nstarQ3nstarQ1nstar = dReQ1n*dReQ3n*dReQ5n*dReQ9n-dReQ5n*dReQ9n*dImQ1n*dImQ3n 
6131                                      - dReQ3n*dReQ9n*dImQ1n*dImQ5n-dReQ1n*dReQ9n*dImQ3n*dImQ5n 
6132                                      + dReQ3n*dReQ5n*dImQ1n*dImQ9n+dReQ1n*dReQ5n*dImQ3n*dImQ9n 
6133                                      + dReQ1n*dReQ3n*dImQ5n*dImQ9n-dImQ1n*dImQ3n*dImQ5n*dImQ9n;
6134  Double_t reQ9nQ8nstarQ1nstar = dReQ9n*dReQ8n*dReQ1n-dReQ9n*dImQ8n*dImQ1n+dImQ9n*dReQ8n*dImQ1n
6135                               + dImQ9n*dImQ8n*dReQ1n; 
6136  // <5>_{6n,1n|4n,2n,1n}:
6137  Double_t reQ6nQ1nQ4nstarQ2nstarQ1nstar = (dReQ2n*dReQ4n*dReQ6n-dReQ6n*dImQ2n*dImQ4n 
6138                                         + dReQ4n*dImQ2n*dImQ6n+dReQ2n*dImQ4n*dImQ6n) 
6139                                         * (pow(dReQ1n,2.)+pow(dImQ1n,2.));
6140  // <5>_{6n,3n|4n,3n,2n}:
6141  Double_t reQ6nQ3nQ4nstarQ3nstarQ2nstar = (dReQ2n*dReQ4n*dReQ6n-dReQ6n*dImQ2n*dImQ4n 
6142                                         + dReQ4n*dImQ2n*dImQ6n+dReQ2n*dImQ4n*dImQ6n) 
6143                                         * (pow(dReQ3n,2.)+pow(dImQ3n,2.));
6144  Double_t reQ7nQ2nQ6nstarQ3nstar = dImQ3n*dImQ2n*dImQ7n*dImQ6n+dImQ7n*dImQ6n*dReQ3n*dReQ2n 
6145                                  + dImQ2n*dImQ6n*dReQ3n*dReQ7n-dImQ3n*dImQ6n*dReQ2n*dReQ7n
6146                                  - dImQ2n*dImQ7n*dReQ3n*dReQ6n+dImQ3n*dImQ7n*dReQ2n*dReQ6n 
6147                                  + dImQ3n*dImQ2n*dReQ7n*dReQ6n+dReQ3n*dReQ2n*dReQ7n*dReQ6n;                      
6148  // <5>_{6n,2n|5n,2n,1n}:
6149  Double_t reQ6nQ2nQ5nstarQ2nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
6150                                         * (dReQ1n*dReQ5n*dReQ6n-dReQ6n*dImQ1n*dImQ5n 
6151                                         + dReQ5n*dImQ1n*dImQ6n+dReQ1n*dImQ5n*dImQ6n);
6152  // <5>_{6n,3n|5n,3n,1n}:
6153  Double_t reQ6nQ3nQ5nstarQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))
6154                                         * (dReQ1n*dReQ5n*dReQ6n-dReQ6n*dImQ1n*dImQ5n 
6155                                         + dReQ5n*dImQ1n*dImQ6n+dReQ1n*dImQ5n*dImQ6n);
6156  Double_t reQ8nQ1nQ6nstarQ3nstar = dImQ3n*dImQ1n*dImQ8n*dImQ6n+dImQ8n*dImQ6n*dReQ3n*dReQ1n 
6157                                  + dImQ1n*dImQ6n*dReQ3n*dReQ8n-dImQ3n*dImQ6n*dReQ1n*dReQ8n
6158                                  - dImQ1n*dImQ8n*dReQ3n*dReQ6n+dImQ3n*dImQ8n*dReQ1n*dReQ6n 
6159                                  + dImQ3n*dImQ1n*dReQ8n*dReQ6n+dReQ3n*dReQ1n*dReQ8n*dReQ6n;                      
6160  // <5>_{6n,4n|5n,4n,1n}:
6161  Double_t reQ6nQ4nQ5nstarQ4nstarQ1nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))
6162                                         * (dReQ1n*dReQ5n*dReQ6n-dReQ6n*dImQ1n*dImQ5n 
6163                                         + dReQ5n*dImQ1n*dImQ6n+dReQ1n*dImQ5n*dImQ6n);
6164  Double_t reQ6nQ4nQ5nstarQ5nstar = dReQ4n*pow(dReQ5n,2.)*dReQ6n+2.*dReQ5n*dReQ6n*dImQ4n*dImQ5n 
6165                                  - dReQ4n*dReQ6n*pow(dImQ5n,2.)-pow(dReQ5n,2.)*dImQ4n*dImQ6n
6166                                  + 2.*dReQ4n*dReQ5n*dImQ5n*dImQ6n+dImQ4n*pow(dImQ5n,2.)*dImQ6n;
6167  Double_t reQ9nQ1nQ6nstarQ4nstar = dImQ4n*dImQ1n*dImQ9n*dImQ6n+dImQ9n*dImQ6n*dReQ4n*dReQ1n 
6168                                  + dImQ1n*dImQ6n*dReQ4n*dReQ9n-dImQ4n*dImQ6n*dReQ1n*dReQ9n
6169                                  - dImQ1n*dImQ9n*dReQ4n*dReQ6n+dImQ4n*dImQ9n*dReQ1n*dReQ6n 
6170                                  + dImQ4n*dImQ1n*dReQ9n*dReQ6n+dReQ4n*dReQ1n*dReQ9n*dReQ6n;
6171  Double_t reQ10nQ5nstarQ4nstarQ1nstar = dReQ1n*dReQ4n*dReQ5n*dReQ10n-dReQ5n*dReQ10n*dImQ1n*dImQ4n 
6172                                       - dReQ4n*dReQ10n*dImQ1n*dImQ5n-dReQ1n*dReQ10n*dImQ4n*dImQ5n 
6173                                       + dReQ4n*dReQ5n*dImQ1n*dImQ10n+dReQ1n*dReQ5n*dImQ4n*dImQ10n 
6174                                       + dReQ1n*dReQ4n*dImQ5n*dImQ10n-dImQ1n*dImQ4n*dImQ5n*dImQ10n;
6175  Double_t reQ10nQ9nstarQ1nstar = dReQ10n*dReQ9n*dReQ1n-dReQ10n*dImQ9n*dImQ1n+dImQ10n*dReQ9n*dImQ1n
6176                                + dImQ10n*dImQ9n*dReQ1n;
6177  Double_t reQ10nQ5nstarQ5nstar = pow(dReQ5n,2.)*dReQ10n-dReQ10n*pow(dImQ5n,2.)+2.*dReQ5n*dImQ5n*dImQ10n;
6178  // <5>_{6n,3n|6n,2n,1n}:
6179  Double_t reQ6nQ3nQ6nstarQ2nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n 
6180                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n) 
6181                                         * (pow(dReQ6n,2.)+pow(dImQ6n,2.));
6182  Double_t reQ9nQ6nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ6n*dReQ9n-dReQ6n*dReQ9n*dImQ1n*dImQ2n 
6183                                      - dReQ2n*dReQ9n*dImQ1n*dImQ6n-dReQ1n*dReQ9n*dImQ2n*dImQ6n 
6184                                      + dReQ2n*dReQ6n*dImQ1n*dImQ9n+dReQ1n*dReQ6n*dImQ2n*dImQ9n 
6185                                      + dReQ1n*dReQ2n*dImQ6n*dImQ9n-dImQ1n*dImQ2n*dImQ6n*dImQ9n;
6186  // <5>_{6n,4n|6n,3n,1n}:
6187  Double_t reQ6nQ4nQ6nstarQ3nstarQ1nstar = (dReQ1n*dReQ3n*dReQ4n-dReQ4n*dImQ1n*dImQ3n 
6188                                         + dReQ3n*dImQ1n*dImQ4n+dReQ1n*dImQ3n*dImQ4n) 
6189                                         * (pow(dReQ6n,2.)+pow(dImQ6n,2.));
6190  Double_t reQ10nQ6nstarQ3nstarQ1nstar = dReQ1n*dReQ3n*dReQ6n*dReQ10n-dReQ6n*dReQ10n*dImQ1n*dImQ3n 
6191                                       - dReQ3n*dReQ10n*dImQ1n*dImQ6n-dReQ1n*dReQ10n*dImQ3n*dImQ6n 
6192                                       + dReQ3n*dReQ6n*dImQ1n*dImQ10n+dReQ1n*dReQ6n*dImQ3n*dImQ10n 
6193                                       + dReQ1n*dReQ3n*dImQ6n*dImQ10n-dImQ1n*dImQ3n*dImQ6n*dImQ10n;
6194  // <5>_{6n,5n|5n,4n,2n}:
6195  Double_t reQ6nQ5nQ5nstarQ4nstarQ2nstar = (dReQ2n*dReQ4n*dReQ6n-dReQ6n*dImQ2n*dImQ4n 
6196                                         + dReQ4n*dImQ2n*dImQ6n+dReQ2n*dImQ4n*dImQ6n) 
6197                                         * (pow(dReQ5n,2.)+pow(dImQ5n,2.));
6198  Double_t reQ7nQ4nQ6nstarQ5nstar = dImQ5n*dImQ4n*dImQ7n*dImQ6n+dImQ7n*dImQ6n*dReQ5n*dReQ4n 
6199                                  + dImQ4n*dImQ6n*dReQ5n*dReQ7n-dImQ5n*dImQ6n*dReQ4n*dReQ7n
6200                                  - dImQ4n*dImQ7n*dReQ5n*dReQ6n+dImQ5n*dImQ7n*dReQ4n*dReQ6n 
6201                                  + dImQ5n*dImQ4n*dReQ7n*dReQ6n+dReQ5n*dReQ4n*dReQ7n*dReQ6n;
6202  Double_t reQ9nQ2nQ6nstarQ5nstar = dImQ5n*dImQ2n*dImQ9n*dImQ6n+dImQ9n*dImQ6n*dReQ5n*dReQ2n 
6203                                  + dImQ2n*dImQ6n*dReQ5n*dReQ9n-dImQ5n*dImQ6n*dReQ2n*dReQ9n
6204                                  - dImQ2n*dImQ9n*dReQ5n*dReQ6n+dImQ5n*dImQ9n*dReQ2n*dReQ6n 
6205                                  + dImQ5n*dImQ2n*dReQ9n*dReQ6n+dReQ5n*dReQ2n*dReQ9n*dReQ6n;
6206  Double_t reQ11nQ5nstarQ4nstarQ2nstar = dReQ2n*dReQ4n*dReQ5n*dReQ11n-dReQ5n*dReQ11n*dImQ2n*dImQ4n 
6207                                       - dReQ4n*dReQ11n*dImQ2n*dImQ5n-dReQ2n*dReQ11n*dImQ4n*dImQ5n 
6208                                       + dReQ4n*dReQ5n*dImQ2n*dImQ11n+dReQ2n*dReQ5n*dImQ4n*dImQ11n 
6209                                       + dReQ2n*dReQ4n*dImQ5n*dImQ11n-dImQ2n*dImQ4n*dImQ5n*dImQ11n;
6210  Double_t reQ11nQ9nstarQ2nstar = dReQ11n*dReQ9n*dReQ2n-dReQ11n*dImQ9n*dImQ2n+dImQ11n*dReQ9n*dImQ2n
6211                                + dImQ11n*dImQ9n*dReQ2n;
6212  Double_t reQ11nQ7nstarQ4nstar = dReQ11n*dReQ7n*dReQ4n-dReQ11n*dImQ7n*dImQ4n+dImQ11n*dReQ7n*dImQ4n
6213                                + dImQ11n*dImQ7n*dReQ4n;
6214  // <5>_{6n,5n|6n,3n,2n}:
6215  Double_t reQ6nQ5nQ6nstarQ3nstarQ2nstar = (dReQ2n*dReQ3n*dReQ5n-dReQ5n*dImQ2n*dImQ3n 
6216                                         + dReQ3n*dImQ2n*dImQ5n+dReQ2n*dImQ3n*dImQ5n) 
6217                                         * (pow(dReQ6n,2.)+pow(dImQ6n,2.));
6218  Double_t reQ11nQ6nstarQ3nstarQ2nstar = dReQ2n*dReQ3n*dReQ6n*dReQ11n-dReQ6n*dReQ11n*dImQ2n*dImQ3n 
6219                                       - dReQ3n*dReQ11n*dImQ2n*dImQ6n-dReQ2n*dReQ11n*dImQ3n*dImQ6n 
6220                                       + dReQ3n*dReQ6n*dImQ2n*dImQ11n+dReQ2n*dReQ6n*dImQ3n*dImQ11n 
6221                                       + dReQ2n*dReQ3n*dImQ6n*dImQ11n-dImQ2n*dImQ3n*dImQ6n*dImQ11n;
6222  // <5>_{6n,5n|6n,4n,1n}:
6223  Double_t reQ6nQ5nQ6nstarQ4nstarQ1nstar = (dReQ1n*dReQ4n*dReQ5n-dReQ5n*dImQ1n*dImQ4n 
6224                                         + dReQ4n*dImQ1n*dImQ5n+dReQ1n*dImQ4n*dImQ5n) 
6225                                         * (pow(dReQ6n,2.)+pow(dImQ6n,2.));
6226  Double_t reQ10nQ1nQ6nstarQ5nstar = dImQ5n*dImQ1n*dImQ10n*dImQ6n+dImQ10n*dImQ6n*dReQ5n*dReQ1n 
6227                                   + dImQ1n*dImQ6n*dReQ5n*dReQ10n-dImQ5n*dImQ6n*dReQ1n*dReQ10n
6228                                   - dImQ1n*dImQ10n*dReQ5n*dReQ6n+dImQ5n*dImQ10n*dReQ1n*dReQ6n 
6229                                   + dImQ5n*dImQ1n*dReQ10n*dReQ6n+dReQ5n*dReQ1n*dReQ10n*dReQ6n;
6230  Double_t reQ11nQ10nstarQ1nstar = dReQ11n*dReQ10n*dReQ1n-dReQ11n*dImQ10n*dImQ1n+dImQ11n*dReQ10n*dImQ1n
6231                                 + dImQ11n*dImQ10n*dReQ1n;
6232  Double_t reQ11nQ6nstarQ4nstarQ1nstar = dReQ1n*dReQ4n*dReQ6n*dReQ11n-dReQ6n*dReQ11n*dImQ1n*dImQ4n 
6233                                       - dReQ4n*dReQ11n*dImQ1n*dImQ6n-dReQ1n*dReQ11n*dImQ4n*dImQ6n 
6234                                       + dReQ4n*dReQ6n*dImQ1n*dImQ11n+dReQ1n*dReQ6n*dImQ4n*dImQ11n 
6235                                       + dReQ1n*dReQ4n*dImQ6n*dImQ11n-dImQ1n*dImQ4n*dImQ6n*dImQ11n;
6236  // <5>_{4n,1n|3n,1n,1n}:
6237  Double_t reQ4nQ1nQ3nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
6238                                         * (dReQ1n*dReQ3n*dReQ4n-dReQ4n*dImQ1n*dImQ3n
6239                                         + dReQ3n*dImQ1n*dImQ4n+dReQ1n*dImQ3n*dImQ4n);
6240  Double_t reQ4nQ1nQ4nstarQ1nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
6241  Double_t reQ3nQ1nQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
6242  // <5>_{4n,3n|3n,3n,1n}:
6243  Double_t reQ4nQ3nQ3nstarQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))
6244                                         * (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)); 
6245  Double_t reQ7nQ3nstarQ3nstarQ1nstar = (dReQ7n*dReQ1n+dImQ7n*dImQ1n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
6246                                      + 2.*dReQ3n*dImQ3n*(dImQ7n*dReQ1n-dReQ7n*dImQ1n); 
6247  // <5>_{4n,4n|4n,3n,1n}:
6248  Double_t reQ4nQ4nQ4nstarQ3nstarQ1nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))
6249                                         * reQ4nQ3nstarQ1nstar;
6250  Double_t reQ7nQ1nQ4nstarQ4nstar = dReQ1n*pow(dReQ4n,2.)*dReQ7n+2.*dReQ4n*dReQ7n*dImQ1n*dImQ4n 
6251                                  - dReQ1n*dReQ7n*pow(dImQ4n,2.)-pow(dReQ4n,2.)*dImQ1n*dImQ7n
6252                                  + 2.*dReQ1n*dReQ4n*dImQ4n*dImQ7n+dImQ1n*pow(dImQ4n,2.)*dImQ7n;
6253  // <5>_{5n,2n|3n,2n,2n}:
6254  Double_t reQ5nQ2nQ3nstarQ2nstarQ2nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
6255                                         * reQ5nQ3nstarQ2nstar;
6256  // <5>_{5n,3n|3n,3n,2n}:
6257  Double_t reQ5nQ3nQ3nstarQ3nstarQ2nstar = (pow(dImQ3n,2.)+pow(dReQ3n,2.))
6258                                         * (dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n 
6259                                         - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n);
6260  Double_t reQ8nQ3nstarQ3nstarQ2nstar = (dReQ8n*dReQ2n+dImQ8n*dImQ2n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
6261                                      + 2.*dReQ3n*dImQ3n*(dImQ8n*dReQ2n-dReQ8n*dImQ2n);
6262  /*
6263  Double_t reQ5nQ1nQ3nstarQ2nstar = dImQ2n*dImQ1n*dImQ5n*dImQ3n+dImQ5n*dImQ3n*dReQ2n*dReQ1n 
6264                                  + dImQ1n*dImQ3n*dReQ2n*dReQ5n-dImQ2n*dImQ3n*dReQ1n*dReQ5n
6265                                  - dImQ1n*dImQ5n*dReQ2n*dReQ3n+dImQ2n*dImQ5n*dReQ1n*dReQ3n 
6266                                  + dImQ2n*dImQ1n*dReQ5n*dReQ3n+dReQ2n*dReQ1n*dReQ5n*dReQ3n;
6267  */
6268  // <5>_{5n,1n|4n,1n,1n}:
6269  Double_t reQ5nQ1nQ4nstarQ1nstarQ1nstar = (pow(dImQ1n,2.)+pow(dReQ1n,2.))
6270                                         * (dImQ1n*dImQ5n*dReQ4n+dImQ4n*dImQ5n*dReQ1n 
6271                                         - dImQ4n*dImQ1n*dReQ5n+dReQ4n*dReQ1n*dReQ5n);
6272  // <5>_{5n,4n|4n,4n,1n}:
6273  Double_t reQ5nQ4nQ4nstarQ4nstarQ1nstar = (pow(dImQ4n,2.)+pow(dReQ4n,2.))
6274                                         * (dImQ4n*dImQ5n*dReQ1n+dImQ1n*dImQ5n*dReQ4n 
6275                                         - dImQ1n*dImQ4n*dReQ5n+dReQ1n*dReQ4n*dReQ5n);
6276  Double_t reQ9nQ4nstarQ4nstarQ1nstar = (dReQ9n*dReQ1n+dImQ9n*dImQ1n)*(pow(dReQ4n,2)-pow(dImQ4n,2)) 
6277                                      + 2.*dReQ4n*dImQ4n*(dImQ9n*dReQ1n-dReQ9n*dImQ1n);
6278  // <5>_{5n,5n|5n,3n,2n}:
6279  Double_t reQ5nQ5nQ5nstarQ3nstarQ2nstar = (pow(dImQ5n,2.)+pow(dReQ5n,2.))
6280                                         * (dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n
6281                                         - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n);
6282  Double_t reQ7nQ3nQ5nstarQ5nstar = dReQ3n*pow(dReQ5n,2.)*dReQ7n+2.*dReQ5n*dReQ7n*dImQ3n*dImQ5n 
6283                                  - dReQ3n*dReQ7n*pow(dImQ5n,2.)-pow(dReQ5n,2.)*dImQ3n*dImQ7n
6284                                  + 2.*dReQ3n*dReQ5n*dImQ5n*dImQ7n+dImQ3n*pow(dImQ5n,2.)*dImQ7n;
6285  Double_t reQ8nQ2nQ5nstarQ5nstar = dReQ2n*pow(dReQ5n,2.)*dReQ8n+2.*dReQ5n*dReQ8n*dImQ2n*dImQ5n 
6286                                  - dReQ2n*dReQ8n*pow(dImQ5n,2.)-pow(dReQ5n,2.)*dImQ2n*dImQ8n
6287                                  + 2.*dReQ2n*dReQ5n*dImQ5n*dImQ8n+dImQ2n*pow(dImQ5n,2.)*dImQ8n;
6288  Double_t reQ10nQ5nstarQ3nstarQ2nstar = dReQ2n*dReQ3n*dReQ5n*dReQ10n-dReQ5n*dReQ10n*dImQ2n*dImQ3n 
6289                                       - dReQ3n*dReQ10n*dImQ2n*dImQ5n-dReQ2n*dReQ10n*dImQ3n*dImQ5n 
6290                                       + dReQ3n*dReQ5n*dImQ2n*dImQ10n+dReQ2n*dReQ5n*dImQ3n*dImQ10n 
6291                                       + dReQ2n*dReQ3n*dImQ5n*dImQ10n-dImQ2n*dImQ3n*dImQ5n*dImQ10n;
6292  Double_t reQ10nQ8nstarQ2nstar = dReQ10n*dReQ8n*dReQ2n-dReQ10n*dImQ8n*dImQ2n+dImQ10n*dReQ8n*dImQ2n
6293                                + dImQ10n*dImQ8n*dReQ2n;
6294  // <5>_{5n,5n|5n,4n,1n}:
6295  Double_t reQ5nQ5nQ5nstarQ4nstarQ1nstar = (pow(dImQ5n,2.)+pow(dReQ5n,2.))
6296                                         * (dImQ4n*dImQ5n*dReQ1n+dImQ1n*dImQ5n*dReQ4n
6297                                         - dImQ1n*dImQ4n*dReQ5n+dReQ1n*dReQ4n*dReQ5n);
6298  Double_t reQ9nQ1nQ5nstarQ5nstar = dReQ1n*pow(dReQ5n,2.)*dReQ9n+2.*dReQ5n*dReQ9n*dImQ1n*dImQ5n 
6299                                  - dReQ1n*dReQ9n*pow(dImQ5n,2.)-pow(dReQ5n,2.)*dImQ1n*dImQ9n
6300                                  + 2.*dReQ1n*dReQ5n*dImQ5n*dImQ9n+dImQ1n*pow(dImQ5n,2.)*dImQ9n;
6301  // <5>_{6n,1n|5n,1n,1n}:
6302  Double_t reQ6nQ1nQ5nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
6303                                         * (dReQ1n*dReQ5n*dReQ6n-dReQ6n*dImQ1n*dImQ5n
6304                                         + dReQ5n*dImQ1n*dImQ6n+dReQ1n*dImQ5n*dImQ6n);
6305  // <5>_{6n,5n|5n,5n,1n}:
6306  Double_t reQ6nQ5nQ5nstarQ5nstarQ1nstar = (pow(dImQ5n,2.)+pow(dReQ5n,2.))
6307                                         * (dImQ5n*dImQ6n*dReQ1n+dImQ1n*dImQ6n*dReQ5n 
6308                                         - dImQ1n*dImQ5n*dReQ6n+dReQ1n*dReQ5n*dReQ6n);
6309  Double_t reQ11nQ5nstarQ5nstarQ1nstar = (dReQ11n*dReQ1n+dImQ11n*dImQ1n)*(pow(dReQ5n,2)-pow(dImQ5n,2)) 
6310                                       + 2.*dReQ5n*dImQ5n*(dImQ11n*dReQ1n-dReQ11n*dImQ1n);
6311  // <5>_{6n,6n|6n,5n,1n}:
6312  Double_t reQ6nQ6nQ6nstarQ5nstarQ1nstar = (pow(dReQ6n,2.)+pow(dImQ6n,2.))
6313                                         * reQ6nQ5nstarQ1nstar;
6314  Double_t reQ7nQ5nQ6nstarQ6nstar = dReQ5n*pow(dReQ6n,2.)*dReQ7n+2.*dReQ6n*dReQ7n*dImQ5n*dImQ6n 
6315                                  - dReQ5n*dReQ7n*pow(dImQ6n,2.)-pow(dReQ6n,2.)*dImQ5n*dImQ7n
6316                                  + 2.*dReQ5n*dReQ6n*dImQ6n*dImQ7n+dImQ5n*pow(dImQ6n,2.)*dImQ7n;
6317  Double_t reQ11nQ1nQ6nstarQ6nstar = dReQ1n*pow(dReQ6n,2.)*dReQ11n+2.*dReQ6n*dReQ11n*dImQ1n*dImQ6n 
6318                                   - dReQ1n*dReQ11n*pow(dImQ6n,2.)-pow(dReQ6n,2.)*dImQ1n*dImQ11n
6319                                   + 2.*dReQ1n*dReQ6n*dImQ6n*dImQ11n+dImQ1n*pow(dImQ6n,2.)*dImQ11n;
6320  Double_t reQ12nQ6nstarQ6nstar = pow(dReQ6n,2.)*dReQ12n-dReQ12n*pow(dImQ6n,2.)+2.*dReQ6n*dImQ6n*dImQ12n;
6321  Double_t reQ12nQ11nstarQ1nstar = dReQ12n*dReQ11n*dReQ1n-dReQ12n*dImQ11n*dImQ1n+dImQ12n*dReQ11n*dImQ1n
6322                                 + dImQ12n*dImQ11n*dReQ1n;
6323  Double_t reQ12nQ6nstarQ5nstarQ1nstar = dReQ1n*dReQ5n*dReQ6n*dReQ12n-dReQ6n*dReQ12n*dImQ1n*dImQ5n 
6324                                       - dReQ5n*dReQ12n*dImQ1n*dImQ6n-dReQ1n*dReQ12n*dImQ5n*dImQ6n 
6325                                       + dReQ5n*dReQ6n*dImQ1n*dImQ12n+dReQ1n*dReQ6n*dImQ5n*dImQ12n 
6326                                       + dReQ1n*dReQ5n*dImQ6n*dImQ12n-dImQ1n*dImQ5n*dImQ6n*dImQ12n;
6327  Double_t reQ12nQ7nstarQ5nstar = dReQ12n*dReQ7n*dReQ5n-dReQ12n*dImQ7n*dImQ5n+dImQ12n*dReQ7n*dImQ5n
6328                                + dImQ12n*dImQ7n*dReQ5n;
6329  // <5>_{6n,2n|4n,3n,1n}:
6330  Double_t reQ6nQ2nQ4nstarQ3nstarQ1nstar = dReQ1n*dReQ2n*dReQ3n*dReQ4n*dReQ6n+dReQ3n*dReQ4n*dReQ6n*dImQ1n*dImQ2n 
6331                                         - dReQ2n*dReQ4n*dReQ6n*dImQ1n*dImQ3n+dReQ1n*dReQ4n*dReQ6n*dImQ2n*dImQ3n 
6332                                         - dReQ2n*dReQ3n*dReQ6n*dImQ1n*dImQ4n+dReQ1n*dReQ3n*dReQ6n*dImQ2n*dImQ4n
6333                                         - dReQ1n*dReQ2n*dReQ6n*dImQ3n*dImQ4n-dReQ6n*dImQ1n*dImQ2n*dImQ3n*dImQ4n 
6334                                         + dReQ2n*dReQ3n*dReQ4n*dImQ1n*dImQ6n-dReQ1n*dReQ3n*dReQ4n*dImQ2n*dImQ6n 
6335                                         + dReQ1n*dReQ2n*dReQ4n*dImQ3n*dImQ6n+dReQ4n*dImQ1n*dImQ2n*dImQ3n*dImQ6n 
6336                                         + dReQ1n*dReQ2n*dReQ3n*dImQ4n*dImQ6n+dReQ3n*dImQ1n*dImQ2n*dImQ4n*dImQ6n 
6337                                         - dReQ2n*dImQ1n*dImQ3n*dImQ4n*dImQ6n+dReQ1n*dImQ2n*dImQ3n*dImQ4n*dImQ6n;
6338  Double_t reQ6nQ2nQ4nstarQ4nstar = dReQ2n*pow(dReQ4n,2.)*dReQ6n+2.*dReQ4n*dReQ6n*dImQ2n*dImQ4n 
6339                                  - dReQ2n*dReQ6n*pow(dImQ4n,2.)-pow(dReQ4n,2.)*dImQ2n*dImQ6n
6340                                  + 2.*dReQ2n*dReQ4n*dImQ4n*dImQ6n+dImQ2n*pow(dImQ4n,2.)*dImQ6n;
6341  // <5>_{6n,2n,1n|5n,4n}:
6342  Double_t reQ6nQ2nQ1nQ5nstarQ4nstar = dReQ1n*dReQ2n*dReQ4n*dReQ6n*dReQ5n - dReQ4n*dReQ6n*dReQ5n*dImQ1n*dImQ2n 
6343                                     + dReQ2n*dReQ6n*dReQ5n*dImQ1n*dImQ4n + dReQ1n*dReQ6n*dReQ5n*dImQ2n*dImQ4n
6344                                     - dReQ2n*dReQ4n*dReQ5n*dImQ1n*dImQ6n - dReQ1n*dReQ4n*dReQ5n*dImQ2n*dImQ6n 
6345                                     + dReQ1n*dReQ2n*dReQ5n*dImQ4n*dImQ6n - dReQ5n*dImQ1n*dImQ2n*dImQ4n*dImQ6n 
6346                                     + dReQ2n*dReQ4n*dReQ6n*dImQ1n*dImQ5n + dReQ1n*dReQ4n*dReQ6n*dImQ2n*dImQ5n 
6347                                     - dReQ1n*dReQ2n*dReQ6n*dImQ4n*dImQ5n + dReQ6n*dImQ1n*dImQ2n*dImQ4n*dImQ5n 
6348                                     + dReQ1n*dReQ2n*dReQ4n*dImQ6n*dImQ5n - dReQ4n*dImQ1n*dImQ2n*dImQ6n*dImQ5n 
6349                                     + dReQ2n*dImQ1n*dImQ4n*dImQ6n*dImQ5n + dReQ1n*dImQ2n*dImQ4n*dImQ6n*dImQ5n;
6350
6351  // <5>_{6n,4n|5n,3n,2n}:
6352  Double_t reQ6nQ4nQ5nstarQ3nstarQ2nstar = dReQ2n*dReQ3n*dReQ4n*dReQ5n*dReQ6n - dReQ4n*dReQ5n*dReQ6n*dImQ2n*dImQ3n 
6353                                         + dReQ3n*dReQ5n*dReQ6n*dImQ2n*dImQ4n + dReQ2n*dReQ5n*dReQ6n*dImQ3n*dImQ4n
6354                                         - dReQ3n*dReQ4n*dReQ6n*dImQ2n*dImQ5n - dReQ2n*dReQ4n*dReQ6n*dImQ3n*dImQ5n 
6355                                         + dReQ2n*dReQ3n*dReQ6n*dImQ4n*dImQ5n - dReQ6n*dImQ2n*dImQ3n*dImQ4n*dImQ5n 
6356                                         + dReQ3n*dReQ4n*dReQ5n*dImQ2n*dImQ6n + dReQ2n*dReQ4n*dReQ5n*dImQ3n*dImQ6n 
6357                                         - dReQ2n*dReQ3n*dReQ5n*dImQ4n*dImQ6n + dReQ5n*dImQ2n*dImQ3n*dImQ4n*dImQ6n 
6358                                         + dReQ2n*dReQ3n*dReQ4n*dImQ5n*dImQ6n - dReQ4n*dImQ2n*dImQ3n*dImQ5n*dImQ6n 
6359                                         + dReQ3n*dImQ2n*dImQ4n*dImQ5n*dImQ6n + dReQ2n*dImQ3n*dImQ4n*dImQ5n*dImQ6n;
6360  Double_t reQ8nQ2nQ6nstarQ4nstar = dImQ4n*dImQ2n*dImQ8n*dImQ6n+dImQ8n*dImQ6n*dReQ4n*dReQ2n 
6361                                  + dImQ2n*dImQ6n*dReQ4n*dReQ8n-dImQ4n*dImQ6n*dReQ2n*dReQ8n
6362                                  - dImQ2n*dImQ8n*dReQ4n*dReQ6n+dImQ4n*dImQ8n*dReQ2n*dReQ6n 
6363                                  + dImQ4n*dImQ2n*dReQ8n*dReQ6n+dReQ4n*dReQ2n*dReQ8n*dReQ6n;
6364
6365  // <5>_{4n,4n|3n,3n,2n}:
6366  Double_t reQ4nQ4nQ3nstarQ3nstarQ2nstar = dReQ2n*pow(dReQ3n,2.)*pow(dReQ4n,2.)-2.*dReQ3n*pow(dReQ4n,2.)*dImQ2n*dImQ3n 
6367                                         - dReQ2n*pow(dReQ4n,2.)*pow(dImQ3n,2.)+2.*pow(dReQ3n,2.)*dReQ4n*dImQ2n*dImQ4n 
6368                                         + 4.*dReQ2n*dReQ3n*dReQ4n*dImQ3n*dImQ4n - 2.*dReQ4n*dImQ2n*pow(dImQ3n,2.)*dImQ4n
6369                                         - dReQ2n*pow(dReQ3n,2.)*pow(dImQ4n,2.) + 2.*dReQ3n*dImQ2n*dImQ3n*pow(dImQ4n,2.) 
6370                                         + dReQ2n*pow(dImQ3n,2.)*pow(dImQ4n,2.);
6371
6372  // <5>_{5n|2n,1n,1n,1n}:
6373  Double_t reQ5nQ2nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,3.)*dReQ2n*dReQ5n-3.*dReQ1n*dReQ2n*dReQ5n*pow(dImQ1n,2.) 
6374                                             - 3.*pow(dReQ1n,2.)*dReQ5n*dImQ1n*dImQ2n+dReQ5n*pow(dImQ1n,3.)*dImQ2n 
6375                                             + 3.*pow(dReQ1n,2.)*dReQ2n*dImQ1n*dImQ5n-dReQ2n*pow(dImQ1n,3.)*dImQ5n
6376                                             + pow(dReQ1n,3.)*dImQ2n*dImQ5n-3.*dReQ1n*pow(dImQ1n,2.)*dImQ2n*dImQ5n;
6377
6378  // <5>_{5n,1n|2n,2n,2n}:
6379  Double_t reQ5nQ1nQ2nstarQ2nstarQ2nstar = dReQ1n*pow(dReQ2n,3.)*dReQ5n+3.*pow(dReQ2n,2.)*dReQ5n*dImQ1n*dImQ2n
6380                                         - 3.*dReQ1n*dReQ2n*dReQ5n*pow(dImQ2n,2.)-dReQ5n*dImQ1n*pow(dImQ2n,3.) 
6381                                         - pow(dReQ2n,3.)*dImQ1n*dImQ5n+3.*dReQ1n*pow(dReQ2n,2.)*dImQ2n*dImQ5n 
6382                                         + 3.*dReQ2n*dImQ1n*pow(dImQ2n,2.)*dImQ5n-dReQ1n*pow(dImQ2n,3.)*dImQ5n;
6383
6384
6385  // <5>_{5n,4n|3n,3n,3n}:
6386  Double_t reQ5nQ4nQ3nstarQ3nstarQ3nstar = dReQ4n*pow(dReQ3n,3.)*dReQ5n+3.*pow(dReQ3n,2.)*dReQ5n*dImQ4n*dImQ3n
6387                                         - 3.*dReQ4n*dReQ3n*dReQ5n*pow(dImQ3n,2.)-dReQ5n*dImQ4n*pow(dImQ3n,3.) 
6388                                         - pow(dReQ3n,3.)*dImQ4n*dImQ5n+3.*dReQ4n*pow(dReQ3n,2.)*dImQ3n*dImQ5n 
6389                                         + 3.*dReQ3n*dImQ4n*pow(dImQ3n,2.)*dImQ5n-dReQ4n*pow(dImQ3n,3.)*dImQ5n;
6390
6391  Double_t reQ9nQ3nstarQ3nstarQ3nstar = dReQ9n*pow(dReQ3n,3)-3.*dReQ3n*dReQ9n*pow(dImQ3n,2)
6392                                      + 3.*dImQ3n*dImQ9n*pow(dReQ3n,2)-dImQ9n*pow(dImQ3n,3); 
6393  // <5>_{5n,5n|4n,3n,3n}:
6394  Double_t reQ5nQ5nQ4nstarQ3nstarQ3nstar = dReQ4n*pow(dReQ3n,2.)*pow(dReQ5n,2.) - 2.*dReQ3n*pow(dReQ5n,2.)*dImQ4n*dImQ3n
6395                                         - dReQ4n*pow(dReQ5n,2.)*pow(dImQ3n,2.) + 2.*pow(dReQ3n,2.)*dReQ5n*dImQ4n*dImQ5n 
6396                                         + 4.*dReQ4n*dReQ3n*dReQ5n*dImQ3n*dImQ5n - 2.*dReQ5n*dImQ4n*pow(dImQ3n,2.)*dImQ5n
6397                                         - dReQ4n*pow(dReQ3n,2.)*pow(dImQ5n,2.) + 2.*dReQ3n*dImQ4n*dImQ3n*pow(dImQ5n,2.) 
6398                                         + dReQ4n*pow(dImQ3n,2.)*pow(dImQ5n,2.);
6399
6400  // <5>_{5n,5n|4n,4n,2n}:   
6401  Double_t reQ5nQ5nQ4nstarQ4nstarQ2nstar = dReQ2n*pow(dReQ4n,2.)*pow(dReQ5n,2.) - 2.*dReQ4n*pow(dReQ5n,2.)*dImQ2n*dImQ4n
6402                                         - dReQ2n*pow(dReQ5n,2.)*pow(dImQ4n,2.) + 2.*pow(dReQ4n,2.)*dReQ5n*dImQ2n*dImQ5n 
6403                                         + 4.*dReQ2n*dReQ4n*dReQ5n*dImQ4n*dImQ5n - 2.*dReQ5n*dImQ2n*pow(dImQ4n,2.)*dImQ5n
6404                                         - dReQ2n*pow(dReQ4n,2.)*pow(dImQ5n,2.) + 2.*dReQ4n*dImQ2n*dImQ4n*pow(dImQ5n,2.) 
6405                                         + dReQ2n*pow(dImQ4n,2.)*pow(dImQ5n,2.);
6406  Double_t reQ10nQ4nstarQ4nstarQ2nstar = (dReQ10n*dReQ2n+dImQ10n*dImQ2n)*(pow(dReQ4n,2)-pow(dImQ4n,2)) 
6407                                       + 2.*dReQ4n*dImQ4n*(dImQ10n*dReQ2n-dReQ10n*dImQ2n);
6408  // <5>_{6n|3n,1n,1n,1n}:
6409  Double_t reQ6nQ3nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,3.)*dReQ3n*dReQ6n-3.*dReQ1n*dReQ3n*dReQ6n*pow(dImQ1n,2.) 
6410                                             - 3.*pow(dReQ1n,2.)*dReQ6n*dImQ1n*dImQ3n+dReQ6n*pow(dImQ1n,3.)*dImQ3n 
6411                                             + 3.*pow(dReQ1n,2.)*dReQ3n*dImQ1n*dImQ6n-dReQ3n*pow(dImQ1n,3.)*dImQ6n
6412                                             + pow(dReQ1n,3.)*dImQ3n*dImQ6n-3.*dReQ1n*pow(dImQ1n,2.)*dImQ3n*dImQ6n;
6413  // <5>_{6n,1n,1n|4n,4n}:
6414  Double_t reQ6nQ1nQ1nQ4nstarQ4nstar = pow(dReQ1n,2.)*pow(dReQ4n,2.)*dReQ6n - pow(dReQ4n,2.)*dReQ6n*pow(dImQ1n,2.)
6415                                     + 4.*dReQ1n*dReQ4n*dReQ6n*dImQ1n*dImQ4n - pow(dReQ1n,2.)*dReQ6n*pow(dImQ4n,2.)
6416                                     + dReQ6n*pow(dImQ1n,2.)*pow(dImQ4n,2.) - 2.*dReQ1n*pow(dReQ4n,2.)*dImQ1n*dImQ6n 
6417                                     + 2.*pow(dReQ1n,2.)*dReQ4n*dImQ4n*dImQ6n - 2.*dReQ4n*pow(dImQ1n,2.)*dImQ4n*dImQ6n
6418                                     + 2.*dReQ1n*dImQ1n*pow(dImQ4n,2.)*dImQ6n;
6419
6420
6421  // <5>_{6n,2n,2n|5n,5n}:
6422  Double_t reQ6nQ2nQ2nQ5nstarQ5nstar = pow(dReQ2n,2.)*pow(dReQ5n,2.)*dReQ6n - pow(dReQ5n,2.)*dReQ6n*pow(dImQ2n,2.)
6423                                     + 4.*dReQ2n*dReQ5n*dReQ6n*dImQ2n*dImQ5n - pow(dReQ2n,2.)*dReQ6n*pow(dImQ5n,2.)
6424                                     + dReQ6n*pow(dImQ2n,2.)*pow(dImQ5n,2.) - 2.*dReQ2n*pow(dReQ5n,2.)*dImQ2n*dImQ6n 
6425                                     + 2.*pow(dReQ2n,2.)*dReQ5n*dImQ5n*dImQ6n - 2.*dReQ5n*pow(dImQ2n,2.)*dImQ5n*dImQ6n
6426                                     + 2.*dReQ2n*dImQ2n*pow(dImQ5n,2.)*dImQ6n;
6427  Double_t reQ10nQ6nstarQ2nstarQ2nstar = (dReQ10n*dReQ6n+dImQ10n*dImQ6n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
6428                                       + 2.*dReQ2n*dImQ2n*(dImQ10n*dReQ6n-dReQ10n*dImQ6n);
6429  // <5>_{6n,6n|5n,5n,2n}:
6430  Double_t reQ6nQ6nQ5nstarQ5nstarQ2nstar = dReQ2n*pow(dReQ5n,2.)*pow(dReQ6n,2.) - 2.*dReQ5n*pow(dReQ6n,2.)*dImQ2n*dImQ5n
6431                                         - dReQ2n*pow(dReQ6n,2.)*pow(dImQ5n,2.) + 2.*pow(dReQ5n,2.)*dReQ6n*dImQ2n*dImQ6n 
6432                                         + 4.*dReQ2n*dReQ5n*dReQ6n*dImQ5n*dImQ6n - 2.*dReQ6n*dImQ2n*pow(dImQ5n,2.)*dImQ6n
6433                                         - dReQ2n*pow(dReQ5n,2.)*pow(dImQ6n,2.) + 2.*dReQ5n*dImQ2n*dImQ5n*pow(dImQ6n,2.) 
6434                                         + dReQ2n*pow(dImQ5n,2.)*pow(dImQ6n,2.);
6435  Double_t reQ10nQ2nQ6nstarQ6nstar = dImQ2n*pow(dImQ6n,2.)*dImQ10n+2.*dImQ6n*dImQ10n*dReQ2n*dReQ6n
6436                                   - dImQ2n*dImQ10n*pow(dReQ6n,2.)-pow(dImQ6n,2.)*dReQ2n*dReQ10n 
6437                                   + 2.*dImQ2n*dImQ6n*dReQ6n*dReQ10n+dReQ2n*pow(dReQ6n,2.)*dReQ10n;
6438  Double_t reQ12nQ5nstarQ5nstarQ2nstar = (dReQ12n*dReQ2n+dImQ12n*dImQ2n)*(pow(dReQ5n,2)-pow(dImQ5n,2)) 
6439                                       + 2.*dReQ5n*dImQ5n*(dImQ12n*dReQ2n-dReQ12n*dImQ2n);
6440  Double_t reQ12nQ10nstarQ2nstar = dReQ12n*dReQ10n*dReQ2n-dReQ12n*dImQ10n*dImQ2n+dImQ12n*dReQ10n*dImQ2n
6441                                 + dImQ12n*dImQ10n*dReQ2n;
6442  // <5>_{5n,2n|3n,3n,1n}: 
6443  Double_t reQ5nQ2nQ3nstarQ3nstarQ1nstar = dReQ1n*dReQ2n*pow(dReQ3n,2.)*dReQ5n + pow(dReQ3n,2.)*dReQ5n*dImQ1n*dImQ2n 
6444                                         - 2.*dReQ2n*dReQ3n*dReQ5n*dImQ1n*dImQ3n + 2.*dReQ1n*dReQ3n*dReQ5n*dImQ2n*dImQ3n 
6445                                         - dReQ1n*dReQ2n*dReQ5n*pow(dImQ3n,2.) - dReQ5n*dImQ1n*dImQ2n*pow(dImQ3n,2.) 
6446                                         + dReQ2n*pow(dReQ3n,2.)*dImQ1n*dImQ5n - dReQ1n*pow(dReQ3n,2.)*dImQ2n*dImQ5n
6447                                         + 2.*dReQ1n*dReQ2n*dReQ3n*dImQ3n*dImQ5n + 2.*dReQ3n*dImQ1n*dImQ2n*dImQ3n*dImQ5n
6448                                         - dReQ2n*dImQ1n*pow(dImQ3n,2.)*dImQ5n + dReQ1n*dImQ2n*pow(dImQ3n,2.)*dImQ5n;
6449  // <5>_{5n,1n,1n|4n,3n}:
6450  Double_t reQ5nQ1nQ1nQ4nstarQ3nstar = pow(dReQ1n,2.)*dReQ3n*dReQ4n*dReQ5n - dReQ3n*dReQ4n*dReQ5n*pow(dImQ1n,2.)
6451                                     + 2.*dReQ1n*dReQ4n*dReQ5n*dImQ1n*dImQ3n + 2.*dReQ1n*dReQ3n*dReQ5n*dImQ1n*dImQ4n
6452                                     - pow(dReQ1n,2.)*dReQ5n*dImQ3n*dImQ4n + dReQ5n*pow(dImQ1n,2.)*dImQ3n*dImQ4n
6453                                     - 2.*dReQ1n*dReQ3n*dReQ4n*dImQ1n*dImQ5n + pow(dReQ1n,2.)*dReQ4n*dImQ3n*dImQ5n
6454                                     - dReQ4n*pow(dImQ1n,2.)*dImQ3n*dImQ5n + pow(dReQ1n,2.)*dReQ3n*dImQ4n*dImQ5n
6455                                     - dReQ3n*pow(dImQ1n,2.)*dImQ4n*dImQ5n + 2.*dReQ1n*dImQ1n*dImQ3n*dImQ4n*dImQ5n;
6456  // <5>_{5n,3n|4n,2n,2n}:
6457  Double_t reQ5nQ3nQ4nstarQ2nstarQ2nstar = dReQ4n*dReQ3n*pow(dReQ2n,2.)*dReQ5n + pow(dReQ2n,2.)*dReQ5n*dImQ4n*dImQ3n 
6458                                         - 2.*dReQ3n*dReQ2n*dReQ5n*dImQ4n*dImQ2n + 2.*dReQ4n*dReQ2n*dReQ5n*dImQ3n*dImQ2n 
6459                                         - dReQ4n*dReQ3n*dReQ5n*pow(dImQ2n,2.) - dReQ5n*dImQ4n*dImQ3n*pow(dImQ2n,2.) 
6460                                         + dReQ3n*pow(dReQ2n,2.)*dImQ4n*dImQ5n - dReQ4n*pow(dReQ2n,2.)*dImQ3n*dImQ5n
6461                                         + 2.*dReQ4n*dReQ3n*dReQ2n*dImQ2n*dImQ5n + 2.*dReQ2n*dImQ4n*dImQ3n*dImQ2n*dImQ5n
6462                                         - dReQ3n*dImQ4n*pow(dImQ2n,2.)*dImQ5n + dReQ4n*dImQ3n*pow(dImQ2n,2.)*dImQ5n;
6463  Double_t reQ8nQ4nstarQ2nstarQ2nstar = (dReQ8n*dReQ4n+dImQ8n*dImQ4n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
6464                                      + 2.*dReQ2n*dImQ2n*(dImQ8n*dReQ4n-dReQ8n*dImQ4n);
6465  // <5>_{5n,2n,1n|4n,4n}:
6466  Double_t reQ5nQ2nQ1nQ4nstarQ4nstar = dReQ1n*dReQ2n*pow(dReQ4n,2.)*dReQ5n - pow(dReQ4n,2.)*dReQ5n*dImQ1n*dImQ2n
6467                                     + 2.*dReQ2n*dReQ4n*dReQ5n*dImQ1n*dImQ4n + 2.*dReQ1n*dReQ4n*dReQ5n*dImQ2n*dImQ4n
6468                                     - dReQ1n*dReQ2n*dReQ5n*pow(dImQ4n,2.) + dReQ5n*dImQ1n*dImQ2n*pow(dImQ4n,2.)
6469                                     - dReQ2n*pow(dReQ4n,2.)*dImQ1n*dImQ5n - dReQ1n*pow(dReQ4n,2.)*dImQ2n*dImQ5n
6470                                     + 2.*dReQ1n*dReQ2n*dReQ4n*dImQ4n*dImQ5n - 2.*dReQ4n*dImQ1n*dImQ2n*dImQ4n*dImQ5n
6471                                     + dReQ2n*dImQ1n*pow(dImQ4n,2.)*dImQ5n + dReQ1n*dImQ2n*pow(dImQ4n,2.)*dImQ5n;
6472  // <5>_{6n,1n|3n,2n,2n}:
6473  Double_t reQ6nQ1nQ3nstarQ2nstarQ2nstar = dReQ3n*dReQ1n*pow(dReQ2n,2.)*dReQ6n + pow(dReQ2n,2.)*dReQ6n*dImQ3n*dImQ1n 
6474                                         - 2.*dReQ1n*dReQ2n*dReQ6n*dImQ3n*dImQ2n + 2.*dReQ3n*dReQ2n*dReQ6n*dImQ1n*dImQ2n 
6475                                         - dReQ3n*dReQ1n*dReQ6n*pow(dImQ2n,2.) - dReQ6n*dImQ3n*dImQ1n*pow(dImQ2n,2.) 
6476                                         + dReQ1n*pow(dReQ2n,2.)*dImQ3n*dImQ6n - dReQ3n*pow(dReQ2n,2.)*dImQ1n*dImQ6n
6477                                         + 2.*dReQ3n*dReQ1n*dReQ2n*dImQ2n*dImQ6n + 2.*dReQ2n*dImQ3n*dImQ1n*dImQ2n*dImQ6n
6478                                         - dReQ1n*dImQ3n*pow(dImQ2n,2.)*dImQ6n + dReQ3n*dImQ1n*pow(dImQ2n,2.)*dImQ6n;
6479
6480  // <5>_{6n,3n|4n,4n,1n}:
6481  Double_t reQ6nQ3nQ4nstarQ4nstarQ1nstar = dReQ1n*dReQ3n*pow(dReQ4n,2.)*dReQ6n + pow(dReQ4n,2.)*dReQ6n*dImQ1n*dImQ3n 
6482                                         - 2.*dReQ3n*dReQ4n*dReQ6n*dImQ1n*dImQ4n + 2.*dReQ1n*dReQ4n*dReQ6n*dImQ3n*dImQ4n 
6483                                         - dReQ1n*dReQ3n*dReQ6n*pow(dImQ4n,2.) - dReQ6n*dImQ1n*dImQ3n*pow(dImQ4n,2.) 
6484                                         + dReQ3n*pow(dReQ4n,2.)*dImQ1n*dImQ6n - dReQ1n*pow(dReQ4n,2.)*dImQ3n*dImQ6n
6485                                         + 2.*dReQ1n*dReQ3n*dReQ4n*dImQ4n*dImQ6n + 2.*dReQ4n*dImQ1n*dImQ3n*dImQ4n*dImQ6n
6486                                         - dReQ3n*dImQ1n*pow(dImQ4n,2.)*dImQ6n + dReQ1n*dImQ3n*pow(dImQ4n,2.)*dImQ6n;
6487
6488  // five6n1n1n5n3n = 0.; // <5>_{6n,1n,1n|5n,3n} = <cos(n(6*phi1+1*phi2+1*phi3-5*phi4-3*phi5))>
6489  Double_t reQ6nQ1nQ1nQ5nstarQ3nstar = pow(dReQ1n,2.)*dReQ3n*dReQ5n*dReQ6n - dReQ3n*dReQ5n*dReQ6n*pow(dImQ1n,2.)
6490                                     + 2.*dReQ1n*dReQ5n*dReQ6n*dImQ1n*dImQ3n + 2.*dReQ1n*dReQ3n*dReQ6n*dImQ1n*dImQ5n
6491                                     - pow(dReQ1n,2.)*dReQ6n*dImQ3n*dImQ5n + dReQ6n*pow(dImQ1n,2.)*dImQ3n*dImQ5n
6492                                     - 2.*dReQ1n*dReQ3n*dReQ5n*dImQ1n*dImQ6n + pow(dReQ1n,2.)*dReQ5n*dImQ3n*dImQ6n
6493                                     - dReQ5n*pow(dImQ1n,2.)*dImQ3n*dImQ6n + pow(dReQ1n,2.)*dReQ3n*dImQ5n*dImQ6n
6494                                     - dReQ3n*pow(dImQ1n,2.)*dImQ5n*dImQ6n + 2.*dReQ1n*dImQ1n*dImQ3n*dImQ5n*dImQ6n;
6495
6496  // <5>_{6n,3n|5n,2n,2n}:
6497  Double_t reQ6nQ3nQ5nstarQ2nstarQ2nstar = dReQ5n*dReQ3n*pow(dReQ2n,2.)*dReQ6n + pow(dReQ2n,2.)*dReQ6n*dImQ5n*dImQ3n 
6498                                         - 2.*dReQ3n*dReQ2n*dReQ6n*dImQ5n*dImQ2n + 2.*dReQ5n*dReQ2n*dReQ6n*dImQ3n*dImQ2n 
6499                                         - dReQ5n*dReQ3n*dReQ6n*pow(dImQ2n,2.) - dReQ6n*dImQ5n*dImQ3n*pow(dImQ2n,2.) 
6500                                         + dReQ3n*pow(dReQ2n,2.)*dImQ5n*dImQ6n - dReQ5n*pow(dReQ2n,2.)*dImQ3n*dImQ6n
6501                                         + 2.*dReQ5n*dReQ3n*dReQ2n*dImQ2n*dImQ6n + 2.*dReQ2n*dImQ5n*dImQ3n*dImQ2n*dImQ6n
6502                                         - dReQ3n*dImQ5n*pow(dImQ2n,2.)*dImQ6n + dReQ5n*dImQ3n*pow(dImQ2n,2.)*dImQ6n;
6503
6504  // <5>_{6n,5n|4n,4n,3n}:
6505  Double_t reQ6nQ5nQ4nstarQ4nstarQ3nstar = dReQ3n*dReQ5n*pow(dReQ4n,2.)*dReQ6n + pow(dReQ4n,2.)*dReQ6n*dImQ3n*dImQ5n 
6506                                         - 2.*dReQ5n*dReQ4n*dReQ6n*dImQ3n*dImQ4n + 2.*dReQ3n*dReQ4n*dReQ6n*dImQ5n*dImQ4n 
6507                                         - dReQ3n*dReQ5n*dReQ6n*pow(dImQ4n,2.) - dReQ6n*dImQ3n*dImQ5n*pow(dImQ4n,2.) 
6508                                         + dReQ5n*pow(dReQ4n,2.)*dImQ3n*dImQ6n - dReQ3n*pow(dReQ4n,2.)*dImQ5n*dImQ6n
6509                                         + 2.*dReQ3n*dReQ5n*dReQ4n*dImQ4n*dImQ6n + 2.*dReQ4n*dImQ3n*dImQ5n*dImQ4n*dImQ6n
6510                                         - dReQ5n*dImQ3n*pow(dImQ4n,2.)*dImQ6n + dReQ3n*dImQ5n*pow(dImQ4n,2.)*dImQ6n;
6511  Double_t reQ11nQ4nstarQ4nstarQ3nstar = (dReQ11n*dReQ3n+dImQ11n*dImQ3n)*(pow(dReQ4n,2)-pow(dImQ4n,2)) 
6512                                       + 2.*dReQ4n*dImQ4n*(dImQ11n*dReQ3n-dReQ11n*dImQ3n);
6513
6514  // <5>_{6n,3n,1n|5n,5n}:
6515  Double_t reQ6nQ3nQ1nQ5nstarQ5nstar = dReQ1n*dReQ3n*pow(dReQ5n,2.)*dReQ6n - pow(dReQ5n,2.)*dReQ6n*dImQ1n*dImQ3n
6516                                     + 2.*dReQ3n*dReQ5n*dReQ6n*dImQ1n*dImQ5n + 2.*dReQ1n*dReQ5n*dReQ6n*dImQ3n*dImQ5n
6517                                     - dReQ1n*dReQ3n*dReQ6n*pow(dImQ5n,2.) + dReQ6n*dImQ1n*dImQ3n*pow(dImQ5n,2.)
6518                                     - dReQ3n*pow(dReQ5n,2.)*dImQ1n*dImQ6n - dReQ1n*pow(dReQ5n,2.)*dImQ3n*dImQ6n
6519                                     + 2.*dReQ1n*dReQ3n*dReQ5n*dImQ5n*dImQ6n - 2.*dReQ5n*dImQ1n*dImQ3n*dImQ5n*dImQ6n
6520                                     + dReQ3n*dImQ1n*pow(dImQ5n,2.)*dImQ6n + dReQ1n*dImQ3n*pow(dImQ5n,2.)*dImQ6n;
6521
6522  // <5>_{6n,6n|5n,4n,3n}:
6523  Double_t reQ6nQ6nQ5nstarQ4nstarQ3nstar = dReQ3n*dReQ4n*dReQ5n*pow(dReQ6n,2.) - dReQ5n*pow(dReQ6n,2.)*dImQ3n*dImQ4n
6524                                         - dReQ4n*pow(dReQ6n,2.)*dImQ3n*dImQ5n - dReQ3n*pow(dReQ6n,2.)*dImQ4n*dImQ5n
6525                                         + 2.*dReQ4n*dReQ5n*dReQ6n*dImQ3n*dImQ6n + 2.*dReQ3n*dReQ5n*dReQ6n*dImQ4n*dImQ6n
6526                                         + 2.*dReQ3n*dReQ4n*dReQ6n*dImQ5n*dImQ6n - 2.*dReQ6n*dImQ3n*dImQ4n*dImQ5n*dImQ6n
6527                                         - dReQ3n*dReQ4n*dReQ5n*pow(dImQ6n,2.) + dReQ5n*dImQ3n*dImQ4n*pow(dImQ6n,2.)
6528                                         + dReQ4n*dImQ3n*dImQ5n*pow(dImQ6n,2.) + dReQ3n*dImQ4n*dImQ5n*pow(dImQ6n,2.);
6529
6530
6531  Double_t reQ8nQ4nQ6nstarQ6nstar = dImQ4n*pow(dImQ6n,2.)*dImQ8n+2.*dImQ6n*dImQ8n*dReQ4n*dReQ6n
6532                                  - dImQ4n*dImQ8n*pow(dReQ6n,2.)-pow(dImQ6n,2.)*dReQ4n*dReQ8n 
6533                                  + 2.*dImQ4n*dImQ6n*dReQ6n*dReQ8n+dReQ4n*pow(dReQ6n,2.)*dReQ8n;
6534
6535
6536  Double_t reQ9nQ3nQ6nstarQ6nstar = dImQ3n*pow(dImQ6n,2.)*dImQ9n+2.*dImQ6n*dImQ9n*dReQ3n*dReQ6n
6537                                  - dImQ3n*dImQ9n*pow(dReQ6n,2.)-pow(dImQ6n,2.)*dReQ3n*dReQ9n 
6538                                  + 2.*dImQ3n*dImQ6n*dReQ6n*dReQ9n+dReQ3n*pow(dReQ6n,2.)*dReQ9n;
6539
6540
6541  Double_t reQ12nQ5nstarQ4nstarQ3nstar = dReQ3n*dReQ5n*dReQ4n*dReQ12n-dReQ4n*dReQ12n*dImQ3n*dImQ5n 
6542                                       - dReQ5n*dReQ12n*dImQ3n*dImQ4n-dReQ3n*dReQ12n*dImQ5n*dImQ4n 
6543                                       + dReQ5n*dReQ4n*dImQ3n*dImQ12n+dReQ3n*dReQ4n*dImQ5n*dImQ12n 
6544                                       + dReQ3n*dReQ5n*dImQ4n*dImQ12n-dImQ3n*dImQ5n*dImQ4n*dImQ12n;
6545  Double_t reQ12nQ9nstarQ3nstar = dReQ12n*dReQ9n*dReQ3n-dReQ12n*dImQ9n*dImQ3n+dImQ12n*dReQ9n*dImQ3n
6546                                + dImQ12n*dImQ9n*dReQ3n;
6547  Double_t reQ12nQ8nstarQ4nstar = dReQ12n*dReQ8n*dReQ4n-dReQ12n*dImQ8n*dImQ4n+dImQ12n*dReQ8n*dImQ4n
6548                                + dImQ12n*dImQ8n*dReQ4n;
6549
6550    
6551   five4n3n3n2n2n = ((pow(dReQ3n,2.)+pow(dImQ3n,2.))
6552                  * (pow(dReQ2n,2.)*dReQ4n-pow(dImQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n)
6553                  - ((dReQ7n*dReQ3n+dImQ7n*dImQ3n)*(pow(dReQ2n,2.)-pow(dImQ2n,2.)) 
6554                  + 2.*dReQ2n*dImQ2n*(dImQ7n*dReQ3n-dReQ7n*dImQ3n))
6555                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
6556                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
6557                  - 2.*(dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
6558                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
6559                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
6560                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
6561                  - 2.*(dImQ2n*dImQ3n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ2n*dReQ3n 
6562                  + dImQ3n*dImQ5n*dReQ2n*dReQ4n-dImQ2n*dImQ5n*dReQ3n*dReQ4n
6563                  - dImQ3n*dImQ4n*dReQ2n*dReQ5n+dImQ2n*dImQ4n*dReQ3n*dReQ5n 
6564                  + dImQ2n*dImQ3n*dReQ4n*dReQ5n+dReQ2n*dReQ3n*dReQ4n*dReQ5n)
6565                  + 2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
6566                  + 1.*(dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
6567                  + 3.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
6568                  + 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
6569                  + 2.*(dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ5n*dImQ2n+dImQ7n*dImQ5n*dReQ2n)
6570                  + 2.*(dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
6571                  + 6.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6572                  + 6.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
6573                  - (dMult-6.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
6574                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6575                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6576                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6577                  - 4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6578                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6579                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6580                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6581                  + 2.*(dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6582                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6583                  - 2.*dMult*(dMult-12.)) 
6584                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6585   five4n2n4n1n1n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))
6586                  * (pow(dReQ1n,2.)*dReQ2n-pow(dImQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n)
6587                  - reQ6nQ4nstarQ1nstarQ1nstar
6588                  - reQ4nQ2nstarQ1nstarQ1nstar
6589                  - 2.*reQ4nQ1nQ3nstarQ2nstar
6590                  - 2.*reQ5nQ1nQ4nstarQ2nstar
6591                  + 2.*reQ3nQ2nstarQ1nstar
6592                  + reQ6nQ4nstarQ2nstar
6593                  + 3.*reQ4nQ2nstarQ2nstar
6594                  + 2.*reQ5nQ3nstarQ2nstar
6595                  + 2.*reQ6nQ5nstarQ1nstar
6596                  + 2.*reQ6nQ4nstarQ2nstar
6597                  + 6.*reQ4nQ3nstarQ1nstar
6598                  + 6.*reQ5nQ4nstarQ1nstar
6599                  - (dMult-6.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
6600                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6601                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6602                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6603                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6604                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6605                  + 2.*(dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6606                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
6607                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6608   // to be polished:
6609   five4n3n4n2n1n = (reQ4nQ3nQ4nstarQ2nstarQ1nstar
6610                  - reQ5nQ2nQ4nstarQ3nstar
6611                  - reQ6nQ1nQ4nstarQ3nstar
6612                  - reQ4nQ1nQ3nstarQ2nstar
6613                  - reQ7nQ4nstarQ2nstarQ1nstar
6614                  - reQ4nQ2nstarQ1nstarQ1nstar
6615                  - reQ4nQ2nQ3nstarQ3nstar
6616                  + reQ4nQ3nstarQ1nstar
6617                  + reQ7nQ4nstarQ3nstar
6618                  + 3.*reQ4nQ3nstarQ1nstar
6619                  + 2.*reQ7nQ4nstarQ3nstar
6620                  + reQ5nQ3nstarQ2nstar
6621                  + reQ7nQ5nstarQ2nstar
6622                  + reQ6nQ3nstarQ3nstar
6623                  + reQ4nQ3nstarQ1nstar
6624                  + reQ7nQ6nstarQ1nstar
6625                  + reQ2nQ1nstarQ1nstar
6626                  - (dMult-6.)*reQ3nQ2nstarQ1nstar
6627                  + 3.*reQ5nQ4nstarQ1nstar
6628                  + reQ4nQ3nstarQ1nstar
6629                  + 2.*reQ4nQ2nstarQ2nstar
6630                  + 3.*reQ6nQ4nstarQ2nstar
6631                  + reQ3nQ2nstarQ1nstar
6632                  + reQ4nQ2nstarQ2nstar
6633                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6634                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6635                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6636                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6637                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6638                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
6639                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6640                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6641                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6642                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6643                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6644                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6645                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
6646                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6647   five5n1n3n2n1n = ((pow(dImQ1n,2.)+pow(dReQ1n,2.))*(dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n 
6648                  - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n)
6649                  - (dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
6650                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
6651                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
6652                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
6653                  - (dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
6654                  + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
6655                  - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n 
6656                  + dImQ1n*dImQ2n*dReQ4n*dReQ5n+dReQ1n*dReQ2n*dReQ4n*dReQ5n)
6657                  - (dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
6658                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
6659                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n)
6660                  - (dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
6661                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
6662                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
6663                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
6664                  - (-pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
6665                  + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
6666                  - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n)
6667                  - (-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
6668                  + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
6669                  - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n)
6670                  + 3.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
6671                  + dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n
6672                  + pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n
6673                  + 4.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
6674                  - (dMult-7.)*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
6675                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
6676                  + pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n
6677                  + 6.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6678                  + 3.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
6679                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6680                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6681                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6682                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+(dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))  
6683                  - 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6684                  + (dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*(dMult-7.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6685                  - 2.*dMult*(dMult-12.))
6686                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
6687   // to be polished:
6688   five5n2n5n1n1n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))
6689                  * (pow(dReQ1n,2.)*dReQ2n-pow(dImQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n)
6690                  - reQ7nQ5nstarQ1nstarQ1nstar
6691                  - reQ5nQ3nstarQ1nstarQ1nstar
6692                  - 2.*reQ5nQ1nQ4nstarQ2nstar
6693                  - 2.*reQ6nQ1nQ5nstarQ2nstar
6694                  + 2.*reQ4nQ3nstarQ1nstar
6695                  + reQ7nQ5nstarQ2nstar
6696                  + 3.*reQ5nQ3nstarQ2nstar
6697                  + 2.*reQ6nQ4nstarQ2nstar
6698                  + 2.*reQ7nQ6nstarQ1nstar
6699                  + 2.*reQ7nQ5nstarQ2nstar
6700                  + 6.*reQ5nQ4nstarQ1nstar
6701                  + 6.*reQ6nQ5nstarQ1nstar
6702                  - (dMult-6.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
6703                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6704                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6705                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))-4.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6706                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6707                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6708                  + 2.*(dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6709                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
6710                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6711   // to be polished:
6712   five5n2n4n2n1n = (reQ5nQ2nQ4nstarQ2nstarQ1nstar
6713                  - reQ5nQ2nQ4nstarQ3nstar
6714                  - reQ6nQ1nQ5nstarQ2nstar
6715                  - reQ5nQ2nstarQ2nstarQ1nstar
6716                  - reQ7nQ4nstarQ2nstarQ1nstar
6717                  - reQ4nQ1nQ3nstarQ2nstar
6718                  - reQ5nQ1nQ4nstarQ2nstar
6719                  + reQ2nQ1nstarQ1nstar
6720                  + reQ7nQ5nstarQ2nstar
6721                  + 3.*reQ5nQ3nstarQ2nstar
6722                  + 2.*reQ7nQ5nstarQ2nstar
6723                  + reQ5nQ3nstarQ2nstar
6724                  + reQ7nQ4nstarQ3nstar
6725                  + reQ6nQ5nstarQ1nstar
6726                  + reQ2nQ1nstarQ1nstar
6727                  + reQ7nQ6nstarQ1nstar
6728                  + reQ3nQ2nstarQ1nstar
6729                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
6730                  + 3.*reQ3nQ2nstarQ1nstar
6731                  + reQ2nQ1nstarQ1nstar
6732                  + 2.*reQ4nQ2nstarQ2nstar
6733                  + 3.*reQ6nQ4nstarQ2nstar
6734                  + reQ4nQ3nstarQ1nstar
6735                  + reQ4nQ2nstarQ2nstar
6736                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6737                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6738                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6739                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6740                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6741                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6742                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6743                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6744                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6745                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6746                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6747                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6748                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.)) 
6749                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6750   // to be polished: 
6751   five5n3n4n3n1n = (reQ5nQ3nQ4nstarQ3nstarQ1nstar
6752                  - reQ5nQ3nQ4nstarQ4nstar
6753                  - reQ7nQ1nQ5nstarQ3nstar
6754                  - reQ5nQ3nstarQ1nstarQ1nstar
6755                  - reQ8nQ4nstarQ3nstarQ1nstar
6756                  - reQ4nQ1nQ3nstarQ2nstar
6757                  - reQ5nQ2nQ4nstarQ3nstar
6758                  + reQ3nQ2nstarQ1nstar
6759                  + reQ8nQ5nstarQ3nstar
6760                  + 3.*reQ5nQ3nstarQ2nstar
6761                  + 2.*reQ8nQ5nstarQ3nstar
6762                  + reQ5nQ4nstarQ1nstar
6763                  + reQ8nQ4nstarQ4nstar
6764                  + reQ7nQ5nstarQ2nstar
6765                  + reQ3nQ2nstarQ1nstar
6766                  + reQ8nQ7nstarQ1nstar
6767                  + reQ2nQ1nstarQ1nstar
6768                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
6769                  + 3.*reQ4nQ3nstarQ1nstar
6770                  + reQ3nQ2nstarQ1nstar
6771                  + 2.*reQ4nQ3nstarQ1nstar
6772                  + 3.*reQ7nQ4nstarQ3nstar
6773                  + reQ4nQ2nstarQ2nstar
6774                  + reQ4nQ3nstarQ1nstar
6775                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6776                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6777                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6778                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
6779                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6780                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6781                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6782                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6783                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6784                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6785                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6786                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6787                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
6788                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6789   // to be polished: 
6790   five5n4n4n3n2n = (reQ5nQ4nQ4nstarQ3nstarQ2nstar
6791                  - reQ6nQ3nQ5nstarQ4nstar
6792                  - reQ7nQ2nQ5nstarQ4nstar
6793                  - reQ5nQ1nQ4nstarQ2nstar
6794                  - reQ9nQ4nstarQ3nstarQ2nstar
6795                  - reQ4nQ1nQ3nstarQ2nstar
6796                  - reQ5nQ2nQ4nstarQ3nstar
6797                  + reQ4nQ2nstarQ2nstar
6798                  + reQ9nQ5nstarQ4nstar
6799                  + 3.*reQ5nQ4nstarQ1nstar
6800                  + 2.*reQ9nQ5nstarQ4nstar
6801                  + reQ6nQ5nstarQ1nstar
6802                  + reQ9nQ6nstarQ3nstar
6803                  + reQ7nQ5nstarQ2nstar
6804                  + reQ4nQ2nstarQ2nstar
6805                  + reQ9nQ7nstarQ2nstar
6806                  + reQ2nQ1nstarQ1nstar
6807                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
6808                  + 3.*reQ6nQ4nstarQ2nstar
6809                  + reQ4nQ2nstarQ2nstar
6810                  + 2.*reQ4nQ3nstarQ1nstar
6811                  + 3.*reQ7nQ4nstarQ3nstar
6812                  + reQ3nQ2nstarQ1nstar
6813                  + reQ4nQ3nstarQ1nstar
6814                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6815                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6816                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6817                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
6818                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6819                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6820                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6821                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6822                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6823                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6824                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6825                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6826                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
6827                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6828   // to be polished: 
6829   five5n3n5n2n1n = (reQ5nQ3nQ5nstarQ2nstarQ1nstar
6830                  - reQ6nQ2nQ5nstarQ3nstar
6831                  - reQ7nQ1nQ5nstarQ3nstar
6832                  - reQ5nQ1nQ3nstarQ3nstar
6833                  - reQ8nQ5nstarQ2nstarQ1nstar
6834                  - reQ5nQ2nstarQ2nstarQ1nstar
6835                  - reQ5nQ2nQ4nstarQ3nstar
6836                  + reQ5nQ4nstarQ1nstar
6837                  + reQ8nQ5nstarQ3nstar
6838                  + 3.*reQ5nQ3nstarQ2nstar
6839                  + 2.*reQ8nQ5nstarQ3nstar
6840                  + reQ6nQ3nstarQ3nstar
6841                  + reQ8nQ6nstarQ2nstar
6842                  + reQ7nQ4nstarQ3nstar
6843                  + reQ5nQ4nstarQ1nstar
6844                  + reQ8nQ7nstarQ1nstar
6845                  + reQ3nQ2nstarQ1nstar
6846                  - (dMult-6.)*reQ3nQ2nstarQ1nstar
6847                  + 3.*reQ6nQ5nstarQ1nstar
6848                  + reQ5nQ4nstarQ1nstar
6849                  + 2.*reQ5nQ3nstarQ2nstar
6850                  + 3.*reQ7nQ5nstarQ2nstar
6851                  + reQ4nQ2nstarQ2nstar
6852                  + reQ5nQ3nstarQ2nstar
6853                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6854                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6855                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6856                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
6857                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6858                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6859                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6860                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6861                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6862                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6863                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6864                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6865                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
6866                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6867   // to be polished:
6868   five5n4n5n2n2n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))
6869                  * (pow(dReQ2n,2.)*dReQ4n-pow(dImQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n)
6870                  - reQ9nQ5nstarQ2nstarQ2nstar
6871                  - reQ5nQ2nstarQ2nstarQ1nstar
6872                  - 2.*reQ5nQ2nQ4nstarQ3nstar
6873                  - 2.*reQ7nQ2nQ5nstarQ4nstar
6874                  + 2.*reQ3nQ2nstarQ1nstar
6875                  + reQ9nQ5nstarQ4nstar
6876                  + 3.*reQ5nQ4nstarQ1nstar
6877                  + 2.*reQ7nQ4nstarQ3nstar
6878                  + 2.*reQ9nQ7nstarQ2nstar
6879                  + 2.*reQ9nQ5nstarQ4nstar
6880                  + 6.*reQ5nQ3nstarQ2nstar
6881                  + 6.*reQ7nQ5nstarQ2nstar
6882                  - (dMult-6.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
6883                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6884                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6885                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))-4.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6886                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6887                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6888                  + 2.*(dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6889                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
6890                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6891   // to be polished:
6892   five5n4n5n3n1n = (reQ5nQ4nQ5nstarQ3nstarQ1nstar
6893                  - reQ6nQ3nQ5nstarQ4nstar
6894                  - reQ8nQ1nQ5nstarQ4nstar
6895                  - reQ5nQ1nQ4nstarQ2nstar
6896                  - reQ9nQ5nstarQ3nstarQ1nstar
6897                  - reQ5nQ3nstarQ1nstarQ1nstar
6898                  - reQ5nQ3nQ4nstarQ4nstar
6899                  + reQ5nQ4nstarQ1nstar
6900                  + reQ9nQ5nstarQ4nstar
6901                  + 3.*reQ5nQ4nstarQ1nstar
6902                  + 2.*reQ9nQ5nstarQ4nstar
6903                  + reQ6nQ4nstarQ2nstar
6904                  + reQ9nQ6nstarQ3nstar
6905                  + reQ8nQ4nstarQ4nstar
6906                  + reQ5nQ4nstarQ1nstar
6907                  + reQ9nQ8nstarQ1nstar
6908                  + reQ2nQ1nstarQ1nstar
6909                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
6910                  + 3.*reQ6nQ5nstarQ1nstar
6911                  + reQ5nQ4nstarQ1nstar
6912                  + 2.*reQ5nQ3nstarQ2nstar
6913                  + 3.*reQ8nQ5nstarQ3nstar
6914                  + reQ4nQ3nstarQ1nstar
6915                  + reQ5nQ3nstarQ2nstar
6916                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6917                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6918                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6919                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
6920                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6921                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6922                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6923                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
6924                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6925                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6926                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6927                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6928                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
6929                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
6930   five6n1n3n3n1n = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))
6931                  * (pow(dReQ3n,2.)*dReQ6n-pow(dImQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n)
6932                  - 2.*(dImQ1n*dImQ3n*dImQ4n*dImQ6n+dImQ4n*dImQ6n*dReQ1n*dReQ3n 
6933                  + dImQ3n*dImQ6n*dReQ1n*dReQ4n-dImQ1n*dImQ6n*dReQ3n*dReQ4n
6934                  - dImQ3n*dImQ4n*dReQ1n*dReQ6n+dImQ1n*dImQ4n*dReQ3n*dReQ6n 
6935                  + dImQ1n*dImQ3n*dReQ4n*dReQ6n+dReQ1n*dReQ3n*dReQ4n*dReQ6n)   
6936                  - 2.*(dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
6937                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
6938                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
6939                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
6940                  - (-pow(dImQ3n,2.)*dImQ1n*dImQ7n+dImQ1n*dImQ7n*pow(dReQ3n,2.)
6941                  + 2.*dImQ3n*dImQ7n*dReQ3n*dReQ1n-2.*dImQ3n*dImQ1n*dReQ3n*dReQ7n 
6942                  - pow(dImQ3n,2.)*dReQ1n*dReQ7n+pow(dReQ3n,2.)*dReQ1n*dReQ7n)
6943                  - ((pow(dReQ3n,2.)-pow(dImQ3n,2.))*(dReQ5n*dReQ1n-dImQ5n*dImQ1n) 
6944                  + 2.*dReQ3n*dImQ3n*(dReQ5n*dImQ1n+dImQ5n*dReQ1n))
6945                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6946                  + (dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
6947                  + 2.*(dReQ7n*dReQ3n*dReQ4n-dReQ7n*dImQ3n*dImQ4n+dImQ7n*dReQ3n*dImQ4n+dImQ7n*dImQ3n*dReQ4n)
6948                  + 2.*(dReQ6n*(dReQ4n*dReQ2n-dImQ4n*dImQ2n)+dImQ6n*(dReQ4n*dImQ2n+dImQ4n*dReQ2n))
6949                  + 3.*(dReQ6n*(dReQ5n*dReQ1n-dImQ5n*dImQ1n)+dImQ6n*(dReQ5n*dImQ1n+dImQ5n*dReQ1n))
6950                  + 4.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6951                  + 2.*(dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
6952                  + 6.*(dReQ4n*dReQ3n*dReQ1n-dReQ4n*dImQ3n*dImQ1n+dImQ4n*dReQ3n*dImQ1n+dImQ4n*dImQ3n*dReQ1n)
6953                  + 2.*(dReQ5n*dReQ3n*dReQ2n-dReQ5n*dImQ3n*dImQ2n+dImQ5n*dReQ3n*dImQ2n+dImQ5n*dImQ3n*dReQ2n)
6954                  - (dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
6955                  - 4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6956                  - 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6957                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6958                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6959                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6960                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+(dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6961                  + 2.*(dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.))
6962                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6963   five6n2n3n3n2n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))
6964                  * (pow(dReQ3n,2.)*dReQ6n-pow(dImQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n)
6965                  - 2.*(dImQ2n*dImQ3n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ2n*dReQ3n 
6966                  + dImQ3n*dImQ6n*dReQ2n*dReQ5n-dImQ2n*dImQ6n*dReQ3n*dReQ5n
6967                  - dImQ3n*dImQ5n*dReQ2n*dReQ6n+dImQ2n*dImQ5n*dReQ3n*dReQ6n 
6968                  + dImQ2n*dImQ3n*dReQ5n*dReQ6n+dReQ2n*dReQ3n*dReQ5n*dReQ6n) 
6969                  - 2.*(dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
6970                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
6971                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
6972                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
6973                  - (-pow(dImQ3n,2.)*dImQ2n*dImQ8n+dImQ2n*dImQ8n*pow(dReQ3n,2.)
6974                  + 2.*dImQ3n*dImQ8n*dReQ3n*dReQ2n-2.*dImQ3n*dImQ2n*dReQ3n*dReQ8n 
6975                  - pow(dImQ3n,2.)*dReQ2n*dReQ8n+pow(dReQ3n,2.)*dReQ2n*dReQ8n)
6976                  - ((pow(dReQ3n,2.)-pow(dImQ3n,2.))*(dReQ4n*dReQ2n-dImQ4n*dImQ2n) 
6977                  + 2.*dReQ3n*dImQ3n*(dReQ4n*dImQ2n+dImQ4n*dReQ2n))
6978                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6979                  + (dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n+dImQ8n*dImQ6n*dReQ2n)
6980                  + 2.*(dReQ8n*dReQ3n*dReQ5n-dReQ8n*dImQ3n*dImQ5n+dImQ8n*dReQ3n*dImQ5n+dImQ8n*dImQ3n*dReQ5n)
6981                  + 2.*(dReQ6n*(dReQ5n*dReQ1n-dImQ5n*dImQ1n)+dImQ6n*(dReQ5n*dImQ1n+dImQ5n*dReQ1n))
6982                  + 3.*(dReQ6n*(dReQ4n*dReQ2n-dImQ4n*dImQ2n)+dImQ6n*(dReQ4n*dImQ2n+dImQ4n*dReQ2n))
6983                  + 4.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6984                  + 2.*(dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n+dImQ8n*dImQ6n*dReQ2n)
6985                  + 6.*(dReQ5n*dReQ3n*dReQ2n-dReQ5n*dImQ3n*dImQ2n+dImQ5n*dReQ3n*dImQ2n+dImQ5n*dImQ3n*dReQ2n)
6986                  + 2.*(dReQ4n*dReQ3n*dReQ1n-dReQ4n*dImQ3n*dImQ1n+dImQ4n*dReQ3n*dImQ1n+dImQ4n*dImQ3n*dReQ1n)
6987                  - (dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
6988                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
6989                  - 4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6990                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6991                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6992                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6993                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6994                  + 2.*(dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.))
6995                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6996   // to be polished:
6997   five6n1n4n2n1n = (reQ6nQ1nQ4nstarQ2nstarQ1nstar
6998                  - reQ6nQ1nQ4nstarQ3nstar
6999                  - reQ6nQ1nQ5nstarQ2nstar
7000                  - reQ6nQ3nstarQ2nstarQ1nstar
7001                  - reQ7nQ4nstarQ2nstarQ1nstar
7002                  - reQ5nQ1nQ4nstarQ2nstar
7003                  - reQ6nQ4nstarQ1nstarQ1nstar
7004                  + reQ2nQ1nstarQ1nstar
7005                  + reQ7nQ6nstarQ1nstar
7006                  + 3.*reQ6nQ5nstarQ1nstar
7007                  + 2.*reQ7nQ6nstarQ1nstar
7008                  + reQ6nQ3nstarQ3nstar
7009                  + reQ7nQ4nstarQ3nstar
7010                  + reQ6nQ5nstarQ1nstar
7011                  + reQ2nQ1nstarQ1nstar
7012                  + reQ7nQ5nstarQ2nstar
7013                  + reQ5nQ3nstarQ2nstar
7014                  - (dMult-6.)*reQ6nQ4nstarQ2nstar
7015                  + 3.*reQ3nQ2nstarQ1nstar
7016                  + reQ2nQ1nstarQ1nstar
7017                  + 2.*reQ4nQ3nstarQ1nstar
7018                  + 3.*reQ5nQ4nstarQ1nstar
7019                  + reQ5nQ4nstarQ1nstar
7020                  + reQ4nQ3nstarQ1nstar
7021                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7022                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7023                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7024                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
7025                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7026                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7027                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7028                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7029                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7030                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7031                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7032                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7033                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.)) 
7034                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
7035   // to be polished: 
7036   five6n3n4n3n2n = (reQ6nQ3nQ4nstarQ3nstarQ2nstar
7037                  - reQ6nQ3nQ5nstarQ4nstar
7038                  - reQ7nQ2nQ6nstarQ3nstar
7039                  - reQ6nQ3nstarQ2nstarQ1nstar
7040                  - reQ9nQ4nstarQ3nstarQ2nstar
7041                  - reQ4nQ2nQ3nstarQ3nstar
7042                  - reQ6nQ1nQ4nstarQ3nstar
7043                  + reQ3nQ2nstarQ1nstar
7044                  + reQ9nQ6nstarQ3nstar
7045                  + 3.*reQ6nQ3nstarQ3nstar
7046                  + 2.*reQ9nQ6nstarQ3nstar
7047                  + reQ6nQ5nstarQ1nstar
7048                  + reQ9nQ5nstarQ4nstar
7049                  + reQ7nQ6nstarQ1nstar
7050                  + reQ3nQ2nstarQ1nstar
7051                  + reQ9nQ7nstarQ2nstar
7052                  + reQ3nQ2nstarQ1nstar
7053                  - (dMult-6.)*reQ6nQ4nstarQ2nstar
7054                  + 3.*reQ5nQ3nstarQ2nstar
7055                  + reQ3nQ2nstarQ1nstar
7056                  + 2.*reQ4nQ3nstarQ1nstar
7057                  + 3.*reQ7nQ4nstarQ3nstar
7058                  + reQ4nQ3nstarQ1nstar
7059                  + reQ4nQ3nstarQ1nstar
7060                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7061                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7062                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7063                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
7064                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7065                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7066                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7067                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7068                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7069                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7070                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7071                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7072                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
7073                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7074   five6n4n4n3n3n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))
7075                  * (pow(dReQ3n,2.)*dReQ6n-pow(dImQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n)
7076                  - ((dReQ10n*dReQ4n+dImQ10n*dImQ4n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
7077                  + 2.*dReQ3n*dImQ3n*(dImQ10n*dReQ4n-dReQ10n*dImQ4n))
7078                  - ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
7079                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n)
7080                  - 2.*(dImQ1n*dImQ3n*dImQ4n*dImQ6n+dImQ4n*dImQ6n*dReQ1n*dReQ3n 
7081                  + dImQ3n*dImQ6n*dReQ1n*dReQ4n-dImQ1n*dImQ6n*dReQ3n*dReQ4n
7082                  - dImQ3n*dImQ4n*dReQ1n*dReQ6n+dImQ1n*dImQ4n*dReQ3n*dReQ6n 
7083                  + dImQ1n*dImQ3n*dReQ4n*dReQ6n+dReQ1n*dReQ3n*dReQ4n*dReQ6n)
7084                  - 2.*(dImQ3n*dImQ4n*dImQ6n*dImQ7n+dImQ6n*dImQ7n*dReQ3n*dReQ4n 
7085                  + dImQ4n*dImQ7n*dReQ3n*dReQ6n-dImQ3n*dImQ7n*dReQ4n*dReQ6n
7086                  - dImQ4n*dImQ6n*dReQ3n*dReQ7n+dImQ3n*dImQ6n*dReQ4n*dReQ7n 
7087                  + dImQ3n*dImQ4n*dReQ6n*dReQ7n+dReQ3n*dReQ4n*dReQ6n*dReQ7n)
7088                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7089                  + 1.*(dReQ10n*dReQ6n*dReQ4n-dReQ10n*dImQ6n*dImQ4n+dImQ10n*dReQ6n*dImQ4n+dImQ10n*dImQ6n*dReQ4n)
7090                  + 3.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7091                  + 2.*(dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
7092                  + 2.*(dReQ10n*dReQ7n*dReQ3n-dReQ10n*dImQ7n*dImQ3n+dImQ10n*dReQ7n*dImQ3n+dImQ10n*dImQ7n*dReQ3n)
7093                  + 2.*(dReQ10n*dReQ6n*dReQ4n-dReQ10n*dImQ6n*dImQ4n+dImQ10n*dReQ6n*dImQ4n+dImQ10n*dImQ6n*dReQ4n)
7094                  + 6.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7095                  + 6.*(dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
7096                  - (dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7097                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7098                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7099                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))-4.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
7100                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7101                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7102                  + 2.*(dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7103                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
7104                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7105   // to be polished:
7106   five6n2n5n2n1n = (reQ6nQ2nQ5nstarQ2nstarQ1nstar
7107                  - reQ6nQ2nQ5nstarQ3nstar
7108                  - reQ7nQ1nQ6nstarQ2nstar
7109                  - reQ6nQ3nstarQ2nstarQ1nstar
7110                  - reQ8nQ5nstarQ2nstarQ1nstar
7111                  - reQ5nQ1nQ4nstarQ2nstar
7112                  - reQ6nQ1nQ5nstarQ2nstar
7113                  + reQ2nQ1nstarQ1nstar
7114                  + reQ8nQ6nstarQ2nstar
7115                  + 3.*reQ6nQ4nstarQ2nstar
7116                  + 2.*reQ8nQ6nstarQ2nstar
7117                  + reQ6nQ3nstarQ3nstar
7118                  + reQ8nQ5nstarQ3nstar
7119                  + reQ7nQ6nstarQ1nstar
7120                  + reQ2nQ1nstarQ1nstar
7121                  + reQ8nQ7nstarQ1nstar
7122                  + reQ4nQ3nstarQ1nstar
7123                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
7124                  + 3.*reQ3nQ2nstarQ1nstar
7125                  + reQ2nQ1nstarQ1nstar
7126                  + 2.*reQ5nQ3nstarQ2nstar
7127                  + 3.*reQ7nQ5nstarQ2nstar
7128                  + reQ5nQ4nstarQ1nstar
7129                  + reQ5nQ3nstarQ2nstar
7130                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7131                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7132                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7133                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7134                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7135                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7136                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7137                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7138                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7139                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7140                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7141                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7142                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.)) 
7143                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7144   // to be polished:
7145   five6n3n5n3n1n = (reQ6nQ3nQ5nstarQ3nstarQ1nstar
7146                  - reQ6nQ3nQ5nstarQ4nstar
7147                  - reQ8nQ1nQ6nstarQ3nstar
7148                  - reQ6nQ3nstarQ2nstarQ1nstar
7149                  - reQ9nQ5nstarQ3nstarQ1nstar
7150                  - reQ5nQ1nQ3nstarQ3nstar
7151                  - reQ6nQ2nQ5nstarQ3nstar
7152                  + reQ3nQ2nstarQ1nstar
7153                  + reQ9nQ6nstarQ3nstar
7154                  + 3.*reQ6nQ3nstarQ3nstar
7155                  + 2.*reQ9nQ6nstarQ3nstar
7156                  + reQ6nQ4nstarQ2nstar
7157                  + reQ9nQ5nstarQ4nstar
7158                  + reQ8nQ6nstarQ2nstar
7159                  + reQ3nQ2nstarQ1nstar
7160                  + reQ9nQ8nstarQ1nstar
7161                  + reQ3nQ2nstarQ1nstar
7162                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
7163                  + 3.*reQ4nQ3nstarQ1nstar
7164                  + reQ3nQ2nstarQ1nstar
7165                  + 2.*reQ5nQ3nstarQ2nstar
7166                  + 3.*reQ8nQ5nstarQ3nstar
7167                  + reQ5nQ3nstarQ2nstar
7168                  + reQ5nQ3nstarQ2nstar
7169                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7170                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7171                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7172                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
7173                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7174                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7175                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7176                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
7177                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7178                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7179                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7180                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7181                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
7182                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7183   // to be polished:
7184   five6n4n5n4n1n = (reQ6nQ4nQ5nstarQ4nstarQ1nstar
7185                  - reQ6nQ4nQ5nstarQ5nstar
7186                  - reQ9nQ1nQ6nstarQ4nstar
7187                  - reQ6nQ4nstarQ1nstarQ1nstar
7188                  - reQ10nQ5nstarQ4nstarQ1nstar
7189                  - reQ5nQ1nQ4nstarQ2nstar
7190                  - reQ6nQ3nQ5nstarQ4nstar
7191                  + reQ4nQ3nstarQ1nstar
7192                  + reQ10nQ6nstarQ4nstar
7193                  + 3.*reQ6nQ4nstarQ2nstar
7194                  + 2.*reQ10nQ6nstarQ4nstar
7195                  + reQ6nQ5nstarQ1nstar
7196                  + reQ10nQ5nstarQ5nstar
7197                  + reQ9nQ6nstarQ3nstar
7198                  + reQ4nQ3nstarQ1nstar
7199                  + reQ10nQ9nstarQ1nstar
7200                  + reQ2nQ1nstarQ1nstar
7201                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
7202                  + 3.*reQ5nQ4nstarQ1nstar
7203                  + reQ4nQ3nstarQ1nstar
7204                  + 2.*reQ5nQ4nstarQ1nstar
7205                  + 3.*reQ9nQ5nstarQ4nstar
7206                  + reQ5nQ3nstarQ2nstar
7207                  + reQ5nQ4nstarQ1nstar
7208                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7209                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7210                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7211                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
7212                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7213                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7214                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7215                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
7216                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7217                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7218                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7219                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7220                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
7221                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7222   five6n5n5n3n3n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))
7223                  * (pow(dReQ3n,2.)*dReQ6n-pow(dImQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n)
7224                  - ((dReQ11n*dReQ5n+dImQ11n*dImQ5n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
7225                  + 2.*dReQ3n*dImQ3n*(dImQ11n*dReQ5n-dReQ11n*dImQ5n))
7226                  - (dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
7227                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
7228                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n)
7229                  - 2.*(dImQ2n*dImQ3n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ2n*dReQ3n 
7230                  + dImQ3n*dImQ6n*dReQ2n*dReQ5n-dImQ2n*dImQ6n*dReQ3n*dReQ5n
7231                  - dImQ3n*dImQ5n*dReQ2n*dReQ6n+dImQ2n*dImQ5n*dReQ3n*dReQ6n 
7232                  + dImQ2n*dImQ3n*dReQ5n*dReQ6n+dReQ2n*dReQ3n*dReQ5n*dReQ6n)
7233                  - 2.*(dImQ3n*dImQ5n*dImQ6n*dImQ8n+dImQ6n*dImQ8n*dReQ3n*dReQ5n 
7234                  + dImQ5n*dImQ8n*dReQ3n*dReQ6n-dImQ3n*dImQ8n*dReQ5n*dReQ6n
7235                  - dImQ5n*dImQ6n*dReQ3n*dReQ8n+dImQ3n*dImQ6n*dReQ5n*dReQ8n 
7236                  + dImQ3n*dImQ5n*dReQ6n*dReQ8n+dReQ3n*dReQ5n*dReQ6n*dReQ8n)
7237                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7238                  + 1.*(dReQ11n*dReQ6n*dReQ5n-dReQ11n*dImQ6n*dImQ5n+dImQ11n*dReQ6n*dImQ5n+dImQ11n*dImQ6n*dReQ5n)
7239                  + 3.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
7240                  + 2.*(dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n+dImQ8n*dImQ6n*dReQ2n)
7241                  + 2.*(dReQ11n*dReQ8n*dReQ3n-dReQ11n*dImQ8n*dImQ3n+dImQ11n*dReQ8n*dImQ3n+dImQ11n*dImQ8n*dReQ3n)
7242                  + 2.*(dReQ11n*dReQ6n*dReQ5n-dReQ11n*dImQ6n*dImQ5n+dImQ11n*dReQ6n*dImQ5n+dImQ11n*dImQ6n*dReQ5n)
7243                  + 6.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
7244                  + 6.*(dReQ8n*dReQ5n*dReQ3n-dReQ8n*dImQ5n*dImQ3n+dImQ8n*dReQ5n*dImQ3n+dImQ8n*dImQ5n*dReQ3n)
7245                  - (dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7246                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7247                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7248                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))-4.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7249                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7250                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7251                  + 2.*(dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7252                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
7253                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7254   // to be polished:
7255   five6n2n6n1n1n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))
7256                  * (pow(dReQ1n,2.)*dReQ2n-pow(dImQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n)
7257                  - reQ8nQ6nstarQ1nstarQ1nstar
7258                  - reQ6nQ4nstarQ1nstarQ1nstar
7259                  - 2.*reQ6nQ1nQ5nstarQ2nstar
7260                  - 2.*reQ7nQ1nQ6nstarQ2nstar
7261                  + 2.*reQ5nQ4nstarQ1nstar
7262                  + reQ8nQ6nstarQ2nstar
7263                  + 3.*reQ6nQ4nstarQ2nstar
7264                  + 2.*reQ7nQ5nstarQ2nstar
7265                  + 2.*reQ8nQ7nstarQ1nstar
7266                  + 2.*reQ8nQ6nstarQ2nstar
7267                  + 6.*reQ6nQ5nstarQ1nstar
7268                  + 6.*reQ7nQ6nstarQ1nstar
7269                  - (dMult-6.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7270                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7271                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7272                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))-4.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
7273                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7274                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7275                  + 2.*(dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7276                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
7277                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7278   five6n3n6n2n1n = (reQ6nQ3nQ6nstarQ2nstarQ1nstar
7279                  - reQ7nQ2nQ6nstarQ3nstar
7280                  - reQ8nQ1nQ6nstarQ3nstar
7281                  - reQ6nQ1nQ4nstarQ3nstar
7282                  - reQ9nQ6nstarQ2nstarQ1nstar
7283                  - reQ6nQ3nstarQ2nstarQ1nstar
7284                  - reQ6nQ2nQ5nstarQ3nstar
7285                  + reQ6nQ5nstarQ1nstar
7286                  + reQ9nQ6nstarQ3nstar
7287                  + 3.*reQ6nQ3nstarQ3nstar
7288                  + 2.*reQ9nQ6nstarQ3nstar
7289                  + reQ7nQ4nstarQ3nstar
7290                  + reQ9nQ7nstarQ2nstar
7291                  + reQ8nQ5nstarQ3nstar
7292                  + reQ6nQ5nstarQ1nstar
7293                  + reQ9nQ8nstarQ1nstar
7294                  + reQ4nQ3nstarQ1nstar
7295                  - (dMult-6.)*reQ3nQ2nstarQ1nstar
7296                  + 3.*reQ7nQ6nstarQ1nstar
7297                  + reQ6nQ5nstarQ1nstar
7298                  + 2.*reQ6nQ4nstarQ2nstar
7299                  + 3.*reQ8nQ6nstarQ2nstar
7300                  + reQ5nQ3nstarQ2nstar
7301                  + reQ6nQ4nstarQ2nstar
7302                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7303                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7304                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7305                                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
7306                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7307                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7308                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7309                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
7310                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7311                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7312                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7313                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7314                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
7315                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7316   five6n4n6n2n2n = (-(pow(dImQ6n,2.)+pow(dReQ6n,2.))
7317                  * (-2.*dImQ2n*dImQ4n*dReQ2n+pow(dImQ2n,2.)*dReQ4n-pow(dReQ2n,2.)*dReQ4n)
7318                  - (-pow(dImQ2n,2.)*dImQ6n*dImQ10n+dImQ6n*dImQ10n*pow(dReQ2n,2.)
7319                  + 2.*dImQ2n*dImQ10n*dReQ2n*dReQ6n-2.*dImQ2n*dImQ6n*dReQ2n*dReQ10n 
7320                  - pow(dImQ2n,2.)*dReQ6n*dReQ10n+pow(dReQ2n,2.)*dReQ6n*dReQ10n)
7321                  - 2.*(dImQ2n*dImQ4n*dImQ6n*dImQ8n+dImQ6n*dImQ8n*dReQ2n*dReQ4n 
7322                  + dImQ4n*dImQ8n*dReQ2n*dReQ6n-dImQ2n*dImQ8n*dReQ4n*dReQ6n
7323                  - dImQ4n*dImQ6n*dReQ2n*dReQ8n+dImQ2n*dImQ6n*dReQ4n*dReQ8n 
7324                  + dImQ2n*dImQ4n*dReQ6n*dReQ8n+dReQ2n*dReQ4n*dReQ6n*dReQ8n)
7325                  - (dReQ6n*pow(dReQ2n,3.)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2.)
7326                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2.)-dImQ6n*pow(dImQ2n,3.))
7327                  - 2.*((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
7328                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7329                  + 2.*(dReQ10n*dReQ8n*dReQ2n-dReQ10n*dImQ8n*dImQ2n+dImQ10n*dReQ8n*dImQ2n+dImQ10n*dImQ8n*dReQ2n)
7330                  + 3.*(dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
7331                  + 6.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7332                  + 2.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
7333                  + 9.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7334                  - (dMult-8.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7335                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7336                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7337                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))-4.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7338                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+(dMult-12.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7339                  + 2.*(dMult-9.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.))
7340                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7341   // to be polished:
7342   five6n4n6n3n1n = (reQ6nQ4nQ6nstarQ3nstarQ1nstar
7343                  - reQ7nQ3nQ6nstarQ4nstar
7344                  - reQ9nQ1nQ6nstarQ4nstar
7345                  - reQ6nQ1nQ4nstarQ3nstar
7346                  - reQ10nQ6nstarQ3nstarQ1nstar
7347                  - reQ6nQ3nstarQ2nstarQ1nstar
7348                  - reQ6nQ3nQ5nstarQ4nstar
7349                  + reQ6nQ5nstarQ1nstar
7350                  + reQ10nQ6nstarQ4nstar
7351                  + 3.*reQ6nQ4nstarQ2nstar
7352                  + 2.*reQ10nQ6nstarQ4nstar
7353                  + reQ7nQ4nstarQ3nstar
7354                  + reQ10nQ7nstarQ3nstar
7355                  + reQ9nQ5nstarQ4nstar
7356                  + reQ6nQ5nstarQ1nstar
7357                  + reQ10nQ9nstarQ1nstar
7358                  + reQ3nQ2nstarQ1nstar
7359                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
7360                  + 3.*reQ7nQ6nstarQ1nstar
7361                  + reQ6nQ5nstarQ1nstar
7362                  + 2.*reQ6nQ3nstarQ3nstar
7363                  + 3.*reQ9nQ6nstarQ3nstar
7364                  + reQ5nQ3nstarQ2nstar
7365                  + reQ6nQ3nstarQ3nstar
7366                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7367                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7368                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7369                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
7370                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7371                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7372                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7373                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
7374                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7375                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7376                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7377                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7378                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
7379                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7380   // to be polished:
7381   five6n5n5n4n2n = (reQ6nQ5nQ5nstarQ4nstarQ2nstar
7382                  - reQ7nQ4nQ6nstarQ5nstar
7383                  - reQ9nQ2nQ6nstarQ5nstar
7384                  - reQ6nQ1nQ5nstarQ2nstar
7385                  - reQ11nQ5nstarQ4nstarQ2nstar
7386                  - reQ5nQ1nQ4nstarQ2nstar
7387                  - reQ6nQ3nQ5nstarQ4nstar
7388                  + reQ5nQ3nstarQ2nstar
7389                  + reQ11nQ6nstarQ5nstar
7390                  + 3.*reQ6nQ5nstarQ1nstar
7391                  + 2.*reQ11nQ6nstarQ5nstar
7392                  + reQ7nQ6nstarQ1nstar
7393                  + reQ11nQ7nstarQ4nstar
7394                  + reQ9nQ6nstarQ3nstar
7395                  + reQ5nQ3nstarQ2nstar
7396                  + reQ11nQ9nstarQ2nstar
7397                  + reQ2nQ1nstarQ1nstar
7398                  - (dMult-6.)*reQ6nQ4nstarQ2nstar
7399                  + 3.*reQ7nQ5nstarQ2nstar
7400                  + reQ5nQ3nstarQ2nstar
7401                  + 2.*reQ5nQ4nstarQ1nstar
7402                  + 3.*reQ9nQ5nstarQ4nstar
7403                  + reQ4nQ3nstarQ1nstar
7404                  + reQ5nQ4nstarQ1nstar
7405                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7406                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7407                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7408                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))
7409                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7410                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7411                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7412                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
7413                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7414                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7415                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7416                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7417                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
7418                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7419   // to be polished:
7420   five6n5n6n3n2n = (reQ6nQ5nQ6nstarQ3nstarQ2nstar
7421                  - reQ8nQ3nQ6nstarQ5nstar
7422                  - reQ9nQ2nQ6nstarQ5nstar
7423                  - reQ6nQ2nQ5nstarQ3nstar
7424                  - reQ11nQ6nstarQ3nstarQ2nstar
7425                  - reQ6nQ3nstarQ2nstarQ1nstar
7426                  - reQ6nQ3nQ5nstarQ4nstar
7427                  + reQ6nQ4nstarQ2nstar
7428                  + reQ11nQ6nstarQ5nstar
7429                  + 3.*reQ6nQ5nstarQ1nstar
7430                  + 2.*reQ11nQ6nstarQ5nstar
7431                  + reQ8nQ5nstarQ3nstar
7432                  + reQ11nQ8nstarQ3nstar
7433                  + reQ9nQ5nstarQ4nstar
7434                  + reQ6nQ4nstarQ2nstar
7435                  + reQ11nQ9nstarQ2nstar
7436                  + reQ3nQ2nstarQ1nstar
7437                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
7438                  + 3.*reQ8nQ6nstarQ2nstar
7439                  + reQ6nQ4nstarQ2nstar
7440                  + 2.*reQ6nQ3nstarQ3nstar
7441                  + 3.*reQ9nQ6nstarQ3nstar
7442                  + reQ4nQ3nstarQ1nstar
7443                  + reQ6nQ3nstarQ3nstar
7444                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7445                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7446                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7447                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))
7448                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7449                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
7450                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7451                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
7452                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7453                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7454                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7455                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7456                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
7457                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7458   // to be polished:
7459   five6n5n6n4n1n = (reQ6nQ5nQ6nstarQ4nstarQ1nstar
7460                  - reQ7nQ4nQ6nstarQ5nstar
7461                  - reQ10nQ1nQ6nstarQ5nstar
7462                  - reQ6nQ1nQ5nstarQ2nstar
7463                  - reQ11nQ6nstarQ4nstarQ1nstar
7464                  - reQ6nQ4nstarQ1nstarQ1nstar
7465                  - reQ6nQ4nQ5nstarQ5nstar
7466                  + reQ6nQ5nstarQ1nstar
7467                  + reQ11nQ6nstarQ5nstar
7468                  + 3.*reQ6nQ5nstarQ1nstar
7469                  + 2.*reQ11nQ6nstarQ5nstar
7470                  + reQ7nQ5nstarQ2nstar
7471                  + reQ11nQ7nstarQ4nstar
7472                  + reQ10nQ5nstarQ5nstar
7473                  + reQ6nQ5nstarQ1nstar
7474                  + reQ11nQ10nstarQ1nstar
7475                  + reQ2nQ1nstarQ1nstar
7476                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
7477                  + 3.*reQ7nQ6nstarQ1nstar
7478                  + reQ6nQ5nstarQ1nstar
7479                  + 2.*reQ6nQ4nstarQ2nstar
7480                  + 3.*reQ10nQ6nstarQ4nstar
7481                  + reQ5nQ4nstarQ1nstar
7482                  + reQ6nQ4nstarQ2nstar
7483                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7484                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7485                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7486                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))
7487                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7488                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7489                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7490                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.)) 
7491                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7492                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7493                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7494                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7495                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
7496                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7497   //  f2) Two distinct harmonics (9):
7498   five2n1n1n1n1n = ((dReQ2n*dReQ1n-dImQ2n*dImQ1n)*(pow(dReQ1n,3)-3.*dReQ1n*pow(dImQ1n,2))
7499                  + (dReQ2n*dImQ1n+dReQ1n*dImQ2n)*(3.*dImQ1n*pow(dReQ1n,2)-pow(dImQ1n,3))
7500                  - (dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
7501                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3))
7502                  + 5.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7503                  - 3.*(dMult-5.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7504                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7505                  - 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))     
7506                  + 3.*(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7507                  - 3.*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
7508                  + 6.*(2.*dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult*(dMult-4.))
7509                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7510   five2n2n2n1n1n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))*(dReQ2n*(pow(dReQ1n,2.)-pow(dImQ1n,2.))+2.*dImQ2n*dReQ1n*dImQ1n)
7511                  - ((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
7512                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
7513                  - 2.*((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
7514                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7515                  + 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7516                  + 8.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7517                  + 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7518                  - 2.*(dMult-6.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7519                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7520                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)
7521                  + 2.*(3.*dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7522                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7523                  + 4.*(dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
7524                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7525   five3n3n2n2n2n = (pow(dReQ2n,3.)*pow(dReQ3n,2.)-3.*dReQ2n*pow(dReQ3n,2.)*pow(dImQ2n,2.)
7526                  + 6.*pow(dReQ2n,2.)*dReQ3n*dImQ2n*dImQ3n-2.*dReQ3n*pow(dImQ2n,3.)*dImQ3n
7527                  - pow(dReQ2n,3.)*pow(dImQ3n,2.)+3.*dReQ2n*pow(dImQ2n,2.)*pow(dImQ3n,2.)
7528                  - (dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
7529                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3))
7530                  - 3.*((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
7531                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n)
7532                  - 6.*((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
7533                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7534                  + 2.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7535                  + 3.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7536                  + 6.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7537                  + 6.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7538                  + 12.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7539                  + 6.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7540                  - 2.*((pow(dReQ6n,2.)+pow(dImQ6n,2.))+3.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7541                  + 6.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+9.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7542                  + 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-12.*dMult))
7543                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7544   five4n1n1n1n1n = (pow(dReQ1n,4.)*dReQ4n-6.*pow(dReQ1n,2.)*dReQ4n*pow(dImQ1n,2.)
7545                  + pow(dImQ1n,4.)*dReQ4n+4.*pow(dReQ1n,3.)*dImQ1n*dImQ4n-4.*pow(dImQ1n,3.)*dReQ1n*dImQ4n
7546                  - 6.*((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
7547                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
7548                  - 4.*(dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
7549                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3))
7550                  + 8.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7551                  + 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7552                  + 12.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n) 
7553                  + 12.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7554                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-8.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7555                  - 12.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-24.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+24.*dMult)
7556                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7557   five4n2n2n2n2n = ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(pow(dReQ2n,3)-3.*dReQ2n*pow(dImQ2n,2))
7558                  + (dReQ4n*dImQ2n+dReQ2n*dImQ4n)*(3.*dImQ2n*pow(dReQ2n,2)-pow(dImQ2n,3))
7559                  - (dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
7560                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3))
7561                  + 5.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7562                  - 3.*(dMult-5.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7563                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7564                  - 3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))     
7565                  + 3.*(dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7566                  - 3.*pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)
7567                  + 6.*(2.*dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-6.*dMult*(dMult-4.))
7568                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7569   five4n4n4n2n2n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(dReQ4n*(pow(dReQ2n,2.)-pow(dImQ2n,2.))+2.*dImQ4n*dReQ2n*dImQ2n)
7570                  - ((dReQ8n*dReQ4n+dImQ8n*dImQ4n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
7571                  + 2.*dReQ2n*dImQ2n*(dImQ8n*dReQ4n-dReQ8n*dImQ4n))
7572                  - 2.*((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
7573                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7574                  + 3.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
7575                  + 8.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7576                  + 2.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7577                  - 2.*(dMult-6.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7578                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))-4.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7579                  - pow((pow(dReQ4n,2.)+pow(dImQ4n,2.)),2.)
7580                  + 2.*(3.*dMult-10.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7581                  - 4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7582                  + 4.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*dMult*(dMult-6.))
7583                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7584   five6n3n3n3n3n = ((dReQ6n*dReQ3n-dImQ6n*dImQ3n)*(pow(dReQ3n,3)-3.*dReQ3n*pow(dImQ3n,2))
7585                  + (dReQ6n*dImQ3n+dReQ3n*dImQ6n)*(3.*dImQ3n*pow(dReQ3n,2)-pow(dImQ3n,3))
7586                  - (dReQ9n*pow(dReQ3n,3)-3.*dReQ3n*dReQ9n*pow(dImQ3n,2)
7587                  + 3.*dImQ3n*dImQ9n*pow(dReQ3n,2)-dImQ9n*pow(dImQ3n,3))
7588                  + 5.*(dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n+dImQ9n*dImQ6n*dReQ3n)
7589                  - 3.*(dMult-5.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7590                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
7591                  - 3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))     
7592                  + 3.*(dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7593                  - 3.*pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)
7594                  + 6.*(2.*dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-6.*dMult*(dMult-4.))
7595                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7596   five6n6n4n4n4n = (pow(dReQ4n,3.)*pow(dReQ6n,2.)-3.*dReQ4n*pow(dReQ6n,2.)*pow(dImQ4n,2.)
7597                  + 6.*pow(dReQ4n,2.)*dReQ6n*dImQ4n*dImQ6n-2.*dReQ6n*pow(dImQ4n,3.)*dImQ6n
7598                  - pow(dReQ4n,3.)*pow(dImQ6n,2.)+3.*dReQ4n*pow(dImQ4n,2.)*pow(dImQ6n,2.)
7599                  - (dReQ12n*pow(dReQ4n,3)-3.*dReQ4n*dReQ12n*pow(dImQ4n,2)
7600                  + 3.*dImQ4n*dImQ12n*pow(dReQ4n,2)-dImQ12n*pow(dImQ4n,3))
7601                  - 3.*((dReQ8n*dReQ4n-dImQ8n*dImQ4n)*(dReQ6n*dReQ6n-dImQ6n*dImQ6n)
7602                  + 2.*(dReQ8n*dImQ4n+dImQ8n*dReQ4n)*dReQ6n*dImQ6n)
7603                  - 6.*((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
7604                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7605                  + 2.*(pow(dReQ6n,2.)*dReQ12n+2.*dReQ6n*dImQ6n*dImQ12n-pow(dImQ6n,2.)*dReQ12n)
7606                  + 3.*(dReQ12n*dReQ8n*dReQ4n-dReQ12n*dImQ8n*dImQ4n+dImQ12n*dReQ8n*dImQ4n+dImQ12n*dImQ8n*dReQ4n)
7607                  + 6.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7608                  + 6.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
7609                  + 12.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7610                  + 6.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7611                  - 2.*((pow(dReQ12n,2.)+pow(dImQ12n,2.))+3.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7612                  + 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+9.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7613                  + 6.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-12.*dMult))
7614                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7615   five6n6n6n3n3n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(dReQ6n*(pow(dReQ3n,2.)-pow(dImQ3n,2.))+2.*dImQ6n*dReQ3n*dImQ3n)
7616                  - ((dReQ12n*dReQ6n+dImQ12n*dImQ6n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
7617                  + 2.*dReQ3n*dImQ3n*(dImQ12n*dReQ6n-dReQ12n*dImQ6n))
7618                  - 2.*((pow(dReQ6n,2.)-pow(dImQ6n,2.))*(dReQ9n*dReQ3n-dImQ9n*dImQ3n) 
7619                  + 2.*dReQ6n*dImQ6n*(dReQ9n*dImQ3n+dImQ9n*dReQ3n))
7620                  + 3.*(pow(dReQ6n,2.)*dReQ12n+2.*dReQ6n*dImQ6n*dImQ12n-pow(dImQ6n,2.)*dReQ12n)
7621                  + 8.*(dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n+dImQ9n*dImQ6n*dReQ3n)
7622                  + 2.*(dReQ12n*(dReQ9n*dReQ3n-dImQ9n*dImQ3n)+dImQ12n*(dReQ9n*dImQ3n+dImQ9n*dReQ3n))
7623                  - 2.*(dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7624                  - 2.*(pow(dReQ12n,2.)+pow(dImQ12n,2.))-4.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
7625                  - pow((pow(dReQ6n,2.)+pow(dImQ6n,2.)),2.)
7626                  + 2.*(3.*dMult-10.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7627                  - 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7628                  + 4.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-4.*dMult*(dMult-6.))
7629                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7630   //  f3) Three distinct harmonics (30):
7631   five3n1n2n1n1n = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))*(dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n
7632                  + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n)
7633                  - ((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
7634                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n)) 
7635                  - (dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
7636                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3))
7637                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
7638                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7639                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7640                  + pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n
7641                  - (2.*dMult-13.)*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
7642                  + dImQ3n*dImQ2n*dReQ1n)
7643                  + 7.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7644                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7645                  + 2.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7646                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7647                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7648                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7649                  - pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
7650                  + 2.*(3.*dMult-11.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
7651                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7652   five3n2n2n2n1n = ((pow(dImQ2n,2.)+pow(dReQ2n,2.))*(dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n 
7653                  - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n)
7654                  - (-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
7655                  + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
7656                  - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n)
7657                  - (dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
7658                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
7659                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
7660                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
7661                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
7662                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7663                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7664                  + (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
7665                  + 4.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
7666                  + dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)
7667                  + 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7668                  - 2.*(dMult-6.)*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7669                  + 4.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7670                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7671                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7672                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7673                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)+2.*(3.*dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7674                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
7675                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
7676   five3n3n3n2n1n = ((pow(dImQ3n,2.)+pow(dReQ3n,2.))*(dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n
7677                  - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n)
7678                  - (dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
7679                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
7680                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
7681                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
7682                  - (dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
7683                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
7684                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n)
7685                  - ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
7686                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n)
7687                  + dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n
7688                  + dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n
7689                  + 3.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7690                  + 4.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
7691                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7692                  - 2.*(dMult-6.)*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7693                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7694                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7695                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7696                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(3.*dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7697                  - pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)+2.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7698                  + 2.*(dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
7699                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7700   five4n1n3n1n1n = (reQ4nQ1nQ3nstarQ1nstarQ1nstar
7701                  - reQ4nQ1nQ3nstarQ2nstar
7702                  - reQ4nQ1nQ4nstarQ1nstar
7703                  - reQ4nQ2nstarQ1nstarQ1nstar
7704                  - reQ5nQ3nstarQ1nstarQ1nstar
7705                  - reQ3nQ1nQ3nstarQ1nstar
7706                  - dMult*reQ4nQ3nstarQ1nstar
7707                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7708                  + reQ5nQ4nstarQ1nstar
7709                  + 3.*reQ4nQ3nstarQ1nstar
7710                  + 2.*reQ5nQ4nstarQ1nstar
7711                  + reQ4nQ2nstarQ2nstar
7712                  + reQ5nQ3nstarQ2nstar
7713                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7714                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7715                  + reQ5nQ4nstarQ1nstar
7716                  + reQ3nQ2nstarQ1nstar
7717                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
7718                  + 3.*reQ2nQ1nstarQ1nstar
7719                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7720                  + 2.*reQ3nQ2nstarQ1nstar
7721                  + 3.*reQ4nQ3nstarQ1nstar
7722                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7723                  + reQ3nQ2nstarQ1nstar
7724                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7725                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7726                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7727                                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7728                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7729                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7730                  - 2.*dMult*dMult 
7731                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7732                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7733                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7734                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7735                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7736                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.)) 
7737                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7738   five4n1n1n3n3n = // calculated by Peter Jochumzsen
7739                  (pow(dReQ1n*dReQ3n,2.)*dReQ4n-pow(dReQ3n*dImQ1n,2.)*dReQ4n  
7740                  + 4.*dReQ1n*dReQ3n*dReQ4n*dImQ1n*dImQ3n 
7741                  - pow(dReQ1n*dImQ3n,2.)*dReQ4n+pow(dImQ1n*dImQ3n,2.)*dReQ4n  
7742                  - 2.*dReQ1n*pow(dReQ3n,2.)*dImQ1n*dImQ4n+2.*pow(dReQ1n,2.)*dReQ3n*dImQ3n*dImQ4n 
7743                  - 2.*dReQ3n*pow(dImQ1n,2.)*dImQ3n*dImQ4n+2.*dReQ1n*dImQ1n*pow(dImQ3n,2.)*dImQ4n
7744                  + 6.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7745                  - 1.*(-pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
7746                  + 2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
7747                  - pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n) 
7748                  - 1.*((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
7749                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n) 
7750                  + 1.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7751                  - 2.*(dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
7752                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
7753                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n) 
7754                  + 2.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7755                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)) 
7756                  - 2.*(dReQ3n*pow(dReQ1n,3.)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2.)
7757                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2.)-dImQ3n*pow(dImQ1n,3.))
7758                  + 10.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n) 
7759                  + 2.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
7760                  + 2.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n) 
7761                  - 4.*(dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
7762                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
7763                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
7764                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
7765                  + 4.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
7766                  + 4.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
7767                  - 16.*pow(dReQ1n,2.)-16.*pow(dImQ1n,2.)
7768                  - 10.*pow(dReQ2n,2.)-10.*pow(dImQ2n,2.)-12.*pow(dReQ3n,2.)-12.*pow(dImQ3n,2.)
7769                  - 6.*pow(dReQ4n,2.)-6.*pow(dImQ4n,2.)-4.*pow(dReQ5n,2.)-4.*pow(dImQ5n,2.)
7770                  - 2.*pow(dReQ6n,2.)-2.*pow(dImQ6n,2.)+24.*dMult)
7771                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7772   // to be polished:
7773   five4n3n3n3n1n = (reQ4nQ3nQ3nstarQ3nstarQ1nstar
7774                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7775                  - reQ6nQ1nQ4nstarQ3nstar
7776                  - dMult*reQ4nQ3nstarQ1nstar
7777                  - reQ7nQ3nstarQ3nstarQ1nstar
7778                  - reQ3nQ1nQ3nstarQ1nstar
7779                  - reQ4nQ2nQ3nstarQ3nstar
7780                  + reQ3nQ2nstarQ1nstar
7781                  + reQ7nQ4nstarQ3nstar
7782                  + 3.*reQ4nQ3nstarQ1nstar
7783                  + 2.*reQ7nQ4nstarQ3nstar
7784                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7785                  + reQ7nQ4nstarQ3nstar
7786                  + reQ6nQ4nstarQ2nstar
7787                  + reQ3nQ2nstarQ1nstar
7788                  + reQ7nQ6nstarQ1nstar
7789                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7790                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
7791                  + 3.*reQ4nQ3nstarQ1nstar
7792                  + reQ3nQ2nstarQ1nstar
7793                  + 2.*dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7794                  + 3.*reQ6nQ3nstarQ3nstar
7795                  + reQ3nQ2nstarQ1nstar
7796                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7797                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7798                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7799                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7800                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
7801                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7802                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7803                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7804                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
7805                  - 2.*dMult*dMult 
7806                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7807                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7808                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7809                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
7810                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7811
7812   // to be polished:
7813   five4n4n3n3n2n = (reQ4nQ4nQ3nstarQ3nstarQ2nstar
7814                  - reQ5nQ3nQ4nstarQ4nstar-reQ5nQ3nQ4nstarQ4nstar-reQ6nQ2nQ4nstarQ4nstar
7815                  - reQ4nQ1nQ3nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar-reQ4nQ2nQ3nstarQ3nstar                  
7816                                  - reQ8nQ3nstarQ3nstarQ2nstar-reQ4nQ2nQ3nstarQ3nstar-reQ4nQ1nQ3nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar
7817                  + 2.*(reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ8nQ4nstarQ4nstar)
7818                                  + reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ6nQ4nstarQ2nstar
7819                  + reQ8nQ6nstarQ2nstar+reQ8nQ5nstarQ3nstar+reQ8nQ5nstarQ3nstar
7820                                  + reQ5nQ4nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar                                                           
7821                                  + reQ5nQ4nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar                                                           
7822                                  + reQ6nQ4nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7823                  + 2.*(reQ6nQ3nstarQ3nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar)
7824                  + 2.*(reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar)
7825                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7826                                  - 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.))
7827                                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
7828                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))                                
7829                                  - 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.))
7830                                  + 24.*dMult) 
7831                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7832
7833   /*
7834   // correct recursive formula, not needed for the time being.
7835   five4n4n3n3n2n = (reQ4nQ4nQ3nstarQ3nstarQ2nstar
7836                  - dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
7837                  * (2.*four4n2n3n3n+4.*four4n1n3n2n+1.*four8n3n3n2n+1.*four6n2n4n4n+2.*four5n3n4n4n)
7838                  - dMult*(dMult-1.)*(dMult-2.)
7839                  * (4.*three4n3n1n+2.*three4n2n2n+2.*three5n3n2n+1.*three6n3n3n+1.*three8n4n4n
7840                                  + 4.*three3n2n1n+2.*three2n1n1n+1.*three8n6n2n+2.*three8n5n3n+2.*three6n4n2n+4.*three5n4n1n)
7841                  - dMult*(dMult-1.)
7842                                  * (1.*two2n2n+2.*two3n3n+2.*two4n4n+2.*two5n5n+1.*two6n6n+4.*two1n1n+2.*two2n2n+1.*two8n8n)
7843                                  - dMult)
7844                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
7845   */
7846
7847   // to be polished:
7848   five4n4n4n3n1n = (reQ4nQ4nQ4nstarQ3nstarQ1nstar
7849                  - reQ5nQ3nQ4nstarQ4nstar
7850                  - reQ7nQ1nQ4nstarQ4nstar
7851                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7852                  - reQ8nQ4nstarQ3nstarQ1nstar
7853                  - dMult*reQ4nQ3nstarQ1nstar
7854                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7855                  + reQ4nQ3nstarQ1nstar
7856                  + reQ8nQ4nstarQ4nstar
7857                  + 3.*dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7858                  + 2.*reQ8nQ4nstarQ4nstar
7859                  + reQ5nQ4nstarQ1nstar
7860                  + reQ8nQ5nstarQ3nstar
7861                  + reQ7nQ4nstarQ3nstar
7862                  + reQ4nQ3nstarQ1nstar
7863                  + reQ8nQ7nstarQ1nstar
7864                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7865                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
7866                  + 3.*reQ5nQ4nstarQ1nstar
7867                  + reQ4nQ3nstarQ1nstar
7868                  + 2.*reQ4nQ3nstarQ1nstar
7869                  + 3.*reQ7nQ4nstarQ3nstar
7870                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7871                  + reQ4nQ3nstarQ1nstar
7872                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7873                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7874                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7875                                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7876                  - 2.*dMult*dMult 
7877                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7878                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7879                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7880                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7881                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7882                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7883                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7884                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
7885                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7886   // to be polished:
7887   five5n2n1n1n1n = (reQ5nQ2nstarQ1nstarQ1nstarQ1nstar
7888                      - reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar
7889                                  - reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar
7890                                  - reQ3nQ1nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar
7891                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar)
7892                                  + reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar
7893                                  + reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7894                                  + reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
7895                                  + reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
7896                                  + reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
7897                  + 2.*(reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar)
7898                  + 2.*(reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
7899                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7900                  - 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.))
7901                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
7902                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
7903                                  - 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.))
7904                                  + 24.*dMult) 
7905                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7906   // to be polished:
7907   five5n1n2n2n2n = (reQ5nQ1nQ2nstarQ2nstarQ2nstar
7908                  - reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ4nstarQ2nstar
7909                                  - reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar
7910                                  - reQ6nQ2nstarQ2nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar
7911                                  + 2.*(reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ6nQ5nstarQ1nstar)
7912                                  + reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar
7913                                  + reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar
7914                                  + reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7915                                  + reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7916                                  + reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7917                  + 2.*(reQ4nQ2nstarQ2nstar+reQ4nQ2nstarQ2nstar+reQ4nQ2nstarQ2nstar)
7918                  + 2.*(reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar)
7919                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7920                  - 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.))
7921                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.))
7922                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
7923                                  - 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.))
7924                                  + 24.*dMult) 
7925                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7926   // to be polished:
7927   five5n2n3n2n2n = (reQ5nQ2nQ3nstarQ2nstarQ2nstar
7928                  - reQ5nQ2nQ4nstarQ3nstar
7929                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7930                  - reQ5nQ2nstarQ2nstarQ1nstar
7931                  - reQ7nQ3nstarQ2nstarQ2nstar
7932                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7933                  - dMult*reQ5nQ3nstarQ2nstar
7934                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7935                  + reQ7nQ5nstarQ2nstar
7936                  + 3.*reQ5nQ3nstarQ2nstar
7937                  + 2.*reQ7nQ5nstarQ2nstar
7938                  + reQ5nQ4nstarQ1nstar
7939                  + reQ7nQ4nstarQ3nstar
7940                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7941                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7942                  + reQ7nQ5nstarQ2nstar
7943                  + reQ3nQ2nstarQ1nstar
7944                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
7945                  + 3.*reQ4nQ2nstarQ2nstar
7946                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7947                  + 2.*reQ3nQ2nstarQ1nstar
7948                  + 3.*reQ5nQ3nstarQ2nstar
7949                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7950                  + reQ3nQ2nstarQ1nstar
7951                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7952                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7953                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7954                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
7955                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7956                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7957                  - 2.*dMult*dMult
7958                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7959                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7960                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7961                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7962                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7963                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.)) 
7964                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7965   // to be polished:
7966   five5n3n3n3n2n = (reQ5nQ3nQ3nstarQ3nstarQ2nstar
7967                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7968                  - reQ6nQ2nQ5nstarQ3nstar
7969                  - dMult*reQ5nQ3nstarQ2nstar
7970                  - reQ8nQ3nstarQ3nstarQ2nstar 
7971                                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7972                  - reQ5nQ1nQ3nstarQ3nstar
7973                  + reQ3nQ2nstarQ1nstar
7974                  + reQ8nQ5nstarQ3nstar
7975                  + 3.*reQ5nQ3nstarQ2nstar
7976                  + 2.*reQ8nQ5nstarQ3nstar
7977                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7978                  + reQ8nQ5nstarQ3nstar
7979                  + reQ6nQ5nstarQ1nstar
7980                  + reQ3nQ2nstarQ1nstar
7981                  + reQ8nQ6nstarQ2nstar
7982                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7983                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
7984                  + 3.*reQ5nQ3nstarQ2nstar
7985                  + reQ3nQ2nstarQ1nstar
7986                  + 2.*dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7987                  + 3.*reQ6nQ3nstarQ3nstar
7988                  + reQ3nQ2nstarQ1nstar
7989                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7990                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7991                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7992                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7993                                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7994                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7995                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7996                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7997                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
7998                  - 2.*dMult*dMult 
7999                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8000                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
8001                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8002                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
8003                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8004   // to be polished:
8005   five5n1n4n1n1n = (reQ5nQ1nQ4nstarQ1nstarQ1nstar
8006                  - reQ5nQ1nQ4nstarQ2nstar
8007                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8008                  - reQ5nQ3nstarQ1nstarQ1nstar
8009                  - reQ6nQ4nstarQ1nstarQ1nstar 
8010                                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8011                  - dMult*reQ5nQ4nstarQ1nstar
8012                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8013                  + reQ6nQ5nstarQ1nstar
8014                  + 3.*reQ5nQ4nstarQ1nstar
8015                  + 2.*reQ6nQ5nstarQ1nstar
8016                  + reQ5nQ3nstarQ2nstar
8017                  + reQ6nQ4nstarQ2nstar
8018                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8019                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8020                  + reQ6nQ5nstarQ1nstar
8021                  + reQ4nQ3nstarQ1nstar
8022                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
8023                  + 3.*reQ2nQ1nstarQ1nstar
8024                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8025                  + 2.*reQ4nQ3nstarQ1nstar
8026                  + 3.*reQ5nQ4nstarQ1nstar
8027                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8028                  + reQ4nQ3nstarQ1nstar
8029                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8030                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8031                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8032                                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8033                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
8034                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
8035                  - 2.*dMult*dMult
8036                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
8037                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
8038                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8039                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8040                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8041                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.)) 
8042                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8043   // to be polished:
8044   five5n4n3n3n3n = (reQ5nQ4nQ3nstarQ3nstarQ3nstar
8045                  - reQ6nQ3nQ5nstarQ4nstar-reQ6nQ3nQ5nstarQ4nstar-reQ6nQ3nQ5nstarQ4nstar
8046                                  - reQ5nQ1nQ3nstarQ3nstar-reQ5nQ1nQ3nstarQ3nstar-reQ5nQ1nQ3nstarQ3nstar
8047                          - reQ9nQ3nstarQ3nstarQ3nstar-reQ4nQ2nQ3nstarQ3nstar-reQ4nQ2nQ3nstarQ3nstar-reQ4nQ2nQ3nstarQ3nstar
8048                                  + 2.*(reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ9nQ5nstarQ4nstar)
8049                                  + reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar
8050                                  + reQ9nQ6nstarQ3nstar+reQ9nQ6nstarQ3nstar+reQ9nQ6nstarQ3nstar
8051                                  + reQ6nQ4nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
8052                                  + reQ6nQ4nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
8053                                  + reQ6nQ4nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
8054                  + 2.*(reQ6nQ3nstarQ3nstar+reQ6nQ3nstarQ3nstar+reQ6nQ3nstarQ3nstar)
8055                  + 2.*(reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8056                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8057                                  - 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.))
8058                                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
8059                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8060                                  - 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.))
8061                                  + 24.*dMult) 
8062                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8063   // to be polished:
8064   five5n4n4n4n1n = (reQ5nQ4nQ4nstarQ4nstarQ1nstar
8065                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8066                  - reQ8nQ1nQ5nstarQ4nstar
8067                  - dMult*reQ5nQ4nstarQ1nstar
8068                  - reQ9nQ4nstarQ4nstarQ1nstar 
8069                                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8070                  - reQ5nQ3nQ4nstarQ4nstar
8071                  + reQ4nQ3nstarQ1nstar
8072                  + reQ9nQ5nstarQ4nstar
8073                  + 3.*reQ5nQ4nstarQ1nstar
8074                  + 2.*reQ9nQ5nstarQ4nstar
8075                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8076                  + reQ9nQ5nstarQ4nstar
8077                  + reQ8nQ5nstarQ3nstar
8078                  + reQ4nQ3nstarQ1nstar
8079                  + reQ9nQ8nstarQ1nstar
8080                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8081                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
8082                  + 3.*reQ5nQ4nstarQ1nstar
8083                  + reQ4nQ3nstarQ1nstar
8084                  + 2.*dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8085                  + 3.*reQ8nQ4nstarQ4nstar
8086                  + reQ4nQ3nstarQ1nstar
8087                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8088                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8089                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8090                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8091                                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
8092                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
8093                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
8094                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
8095                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
8096                  - 2.*dMult*dMult 
8097                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8098                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8099                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8100                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
8101                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8102   // to be polished:
8103   five5n5n4n3n3n = (reQ5nQ5nQ4nstarQ3nstarQ3nstar
8104                  - reQ6nQ4nQ5nstarQ5nstar-reQ7nQ3nQ5nstarQ5nstar-reQ7nQ3nQ5nstarQ5nstar
8105                                  - reQ5nQ2nQ4nstarQ3nstar-reQ5nQ1nQ3nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar                  
8106                                  - reQ10nQ4nstarQ3nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar-reQ5nQ1nQ3nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar
8107                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ10nQ5nstarQ5nstar)
8108                                  + reQ6nQ5nstarQ1nstar+reQ7nQ5nstarQ2nstar+reQ7nQ5nstarQ2nstar
8109                                  + reQ10nQ7nstarQ3nstar+reQ10nQ6nstarQ4nstar+reQ10nQ7nstarQ3nstar
8110                                  + reQ6nQ5nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
8111                                  + reQ7nQ5nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ2nstarQ2nstar
8112                                  + reQ7nQ5nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ2nstarQ2nstar
8113                                  + 2.*(reQ7nQ4nstarQ3nstar+reQ7nQ4nstarQ3nstar+reQ6nQ3nstarQ3nstar)
8114                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar)
8115                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8116                                  - 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.))
8117                                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
8118                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8119                                  - 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.))
8120                                  + 24.*dMult) 
8121                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8122   // to be polished:
8123   five5n5n4n4n2n = (reQ5nQ5nQ4nstarQ4nstarQ2nstar
8124                  - reQ6nQ4nQ5nstarQ5nstar-reQ6nQ4nQ5nstarQ5nstar-reQ8nQ2nQ5nstarQ5nstar
8125                                  - reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ4nstarQ2nstar-reQ5nQ3nQ4nstarQ4nstar                  
8126                                  - reQ10nQ4nstarQ4nstarQ2nstar-reQ5nQ3nQ4nstarQ4nstar-reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ4nstarQ2nstar
8127                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ10nQ5nstarQ5nstar)
8128                                  + reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ8nQ5nstarQ3nstar
8129                                  + reQ10nQ8nstarQ2nstar+reQ10nQ6nstarQ4nstar+reQ10nQ6nstarQ4nstar
8130                                  + reQ6nQ5nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ4nQ3nstarQ1nstar
8131                                  + reQ6nQ5nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ4nQ3nstarQ1nstar
8132                                  + reQ8nQ5nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
8133                                  + 2.*(reQ8nQ4nstarQ4nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar)
8134                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar)
8135                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8136                                  - 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.))
8137                                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.))
8138                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8139                                  - 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.))
8140                                  + 24.*dMult) 
8141                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8142   // to be polished:
8143   five5n5n5n3n2n = (reQ5nQ5nQ5nstarQ3nstarQ2nstar
8144                  - reQ7nQ3nQ5nstarQ5nstar
8145                  - reQ8nQ2nQ5nstarQ5nstar
8146                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8147                  - reQ10nQ5nstarQ3nstarQ2nstar 
8148                                  - dMult*reQ5nQ3nstarQ2nstar
8149                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
8150                  + reQ5nQ3nstarQ2nstar
8151                  + reQ10nQ5nstarQ5nstar
8152                  + 3.*dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8153                  + 2.*reQ10nQ5nstarQ5nstar
8154                  + reQ7nQ5nstarQ2nstar
8155                  + reQ10nQ7nstarQ3nstar
8156                  + reQ8nQ5nstarQ3nstar
8157                  + reQ5nQ3nstarQ2nstar
8158                  + reQ10nQ8nstarQ2nstar
8159                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8160                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
8161                  + 3.*reQ7nQ5nstarQ2nstar
8162                  + reQ5nQ3nstarQ2nstar
8163                  + 2.*reQ5nQ3nstarQ2nstar
8164                  + 3.*reQ8nQ5nstarQ3nstar
8165                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
8166                  + reQ5nQ3nstarQ2nstar
8167                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8168                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8169                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
8170                                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
8171                  - 2.*dMult*dMult 
8172                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
8173                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
8174                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
8175                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8176                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8177                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
8178                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8179                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
8180                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8181   // to be polished:
8182   five5n5n5n4n1n = (reQ5nQ5nQ5nstarQ4nstarQ1nstar
8183                  - reQ6nQ4nQ5nstarQ5nstar
8184                  - reQ9nQ1nQ5nstarQ5nstar
8185                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8186                  - reQ10nQ5nstarQ4nstarQ1nstar 
8187                                  - dMult*reQ5nQ4nstarQ1nstar
8188                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8189                  + reQ5nQ4nstarQ1nstar
8190                  + reQ10nQ5nstarQ5nstar
8191                  + 3.*dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8192                  + 2.*reQ10nQ5nstarQ5nstar
8193                  + reQ6nQ5nstarQ1nstar
8194                  + reQ10nQ6nstarQ4nstar
8195                  + reQ9nQ5nstarQ4nstar
8196                  + reQ5nQ4nstarQ1nstar
8197                  + reQ10nQ9nstarQ1nstar
8198                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8199                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
8200                  + 3.*reQ6nQ5nstarQ1nstar
8201                  + reQ5nQ4nstarQ1nstar
8202                  + 2.*reQ5nQ4nstarQ1nstar
8203                  + 3.*reQ9nQ5nstarQ4nstar
8204                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8205                  + reQ5nQ4nstarQ1nstar
8206                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8207                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8208                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8209                                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
8210                  - 2.*dMult*dMult 
8211                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
8212                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8213                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
8214                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8215                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8216                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8217                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8218                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
8219                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8220   five6n2n2n1n1n = // calculated by Peter Jochumzsen 
8221                  (pow(dReQ1n*dReQ2n,2.)*dReQ6n-pow(dReQ2n*dImQ1n,2.)*dReQ6n
8222                  - 4.*dReQ1n*dReQ2n*dReQ6n*dImQ1n*dImQ2n 
8223                  - pow(dReQ1n*dImQ2n,2.)*dReQ6n+pow(dImQ1n*dImQ2n,2.)*dReQ6n
8224                  + 2.*dReQ1n*pow(dReQ2n,2.)*dImQ1n*dImQ6n+2.*pow(dReQ1n,2.)*dReQ2n*dImQ2n*dImQ6n 
8225                  - 2.*dReQ2n*pow(dImQ1n,2.)*dImQ2n*dImQ6n-2.*dReQ1n*dImQ1n*pow(dImQ2n,2.)*dImQ6n
8226                  + 2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n) 
8227                  + 8.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
8228                  + 5.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
8229                  - (-pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
8230                  + 2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
8231                  - pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n)
8232                  + 2.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n) 
8233                  - (dReQ6n*pow(dReQ2n,3.)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2.)
8234                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2.)-dImQ6n*pow(dImQ2n,3.))
8235                  + 4.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n) 
8236                  - 2.*((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) 
8237                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
8238                  + 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
8239                  - 2.*(-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
8240                  + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
8241                  - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n) 
8242                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)) 
8243                  + 4.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
8244                  + 4.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
8245                  - 4.*(dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
8246                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
8247                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
8248                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
8249                  - 12.*pow(dReQ1n,2.)-12.*pow(dImQ1n,2.)-14.*pow(dReQ2n,2.)-14.*pow(dImQ2n,2.)
8250                  - 8.*pow(dReQ3n,2.)-8.*pow(dImQ3n,2.)-6.*pow(dReQ4n,2.)-6.*pow(dImQ4n,2.)
8251                  - 4.*pow(dReQ5n,2.)-4.*pow(dImQ5n,2.)-6.*pow(dReQ6n,2.)-6.*pow(dImQ6n,2.)+24.*dMult)
8252                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8253   // to be polished:
8254   five6n3n1n1n1n = (reQ6nQ3nstarQ1nstarQ1nstarQ1nstar
8255                  - reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar
8256                                  - reQ6nQ4nstarQ1nstarQ1nstar-reQ6nQ4nstarQ1nstarQ1nstar-reQ6nQ4nstarQ1nstarQ1nstar
8257                                  - reQ3nQ1nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar
8258                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ3nstarQ3nstar)
8259                                  + reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar
8260                                  + reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
8261                                  + reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar
8262                                  + reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar
8263                                  + reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar
8264                  + 2.*(reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8265                  + 2.*(reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8266                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8267                  - 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.))
8268                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
8269                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.))
8270                                  - 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.))
8271                                  + 24.*dMult) 
8272                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8273
8274
8275   // to be polished:
8276   five6n1n1n4n4n = (reQ6nQ1nQ1nQ4nstarQ4nstar
8277                      - reQ6nQ2nQ4nstarQ4nstar-reQ7nQ1nQ4nstarQ4nstar-reQ7nQ1nQ4nstarQ4nstar
8278                                  - reQ6nQ1nQ4nstarQ3nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
8279                  - reQ8nQ6nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
8280                                  + 2.*(reQ6nQ4nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ8nQ4nstarQ4nstar)
8281                                  + reQ4nQ2nstarQ2nstar+reQ7nQ4nstarQ3nstar+reQ7nQ4nstarQ3nstar // ?? 1st term
8282                  + reQ8nQ7nstarQ1nstar+reQ8nQ6nstarQ2nstar+reQ8nQ7nstarQ1nstar
8283                                  + reQ4nQ2nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
8284                                  + reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                                                           
8285                  + reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                           
8286                  + 2.*(reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8287                  + 2.*(reQ6nQ4nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8288                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8289                  - 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.))
8290                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
8291                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
8292                                  - 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.))
8293                                  + 24.*dMult) 
8294                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8295   
8296   // to be polished:
8297   five6n1n5n1n1n = (reQ6nQ1nQ5nstarQ1nstarQ1nstar
8298                  - reQ6nQ1nQ5nstarQ2nstar
8299                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8300                  - reQ6nQ4nstarQ1nstarQ1nstar
8301                  - reQ7nQ5nstarQ1nstarQ1nstar 
8302                              - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8303                  - dMult*reQ6nQ5nstarQ1nstar
8304                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8305                  + reQ7nQ6nstarQ1nstar
8306                  + 3.*reQ6nQ5nstarQ1nstar
8307                  + 2.*reQ7nQ6nstarQ1nstar
8308                  + reQ6nQ4nstarQ2nstar
8309                  + reQ7nQ5nstarQ2nstar
8310                  + dMult*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8311                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8312                  + reQ7nQ6nstarQ1nstar
8313                  + reQ5nQ4nstarQ1nstar
8314                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
8315                  + 3.*reQ2nQ1nstarQ1nstar
8316                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8317                  + 2.*reQ5nQ4nstarQ1nstar
8318                  + 3.*reQ6nQ5nstarQ1nstar
8319                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8320                  + reQ5nQ4nstarQ1nstar
8321                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8322                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8323                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8324                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
8325                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8326                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
8327                  - 2.*dMult*dMult
8328                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
8329                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8330                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8331                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8332                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8333                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.)) 
8334                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8335   five6n2n4n2n2n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))*(dReQ2n*dReQ4n*dReQ6n-dReQ6n*dImQ2n*dImQ4n
8336                  + dReQ4n*dImQ2n*dImQ6n+dReQ2n*dImQ4n*dImQ6n)
8337                  - ((dReQ8n*dReQ4n+dImQ8n*dImQ4n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
8338                  + 2.*dReQ2n*dImQ2n*(dImQ8n*dReQ4n-dReQ8n*dImQ4n)) 
8339                  - (dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
8340                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3))
8341                  - ((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
8342                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
8343                  + 4.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
8344                  + pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n
8345                  - (2.*dMult-13.)*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
8346                  + dImQ6n*dImQ4n*dReQ2n)
8347                  + 7.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
8348                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
8349                  + 2.*(dMult-5.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8350                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8351                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8352                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8353                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)
8354                  + 2.*(3.*dMult-11.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*dMult*(dMult-6.))
8355                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8356   five6n4n4n4n2n = ((pow(dImQ4n,2.)+pow(dReQ4n,2.))*(dImQ4n*dImQ6n*dReQ2n+dImQ2n*dImQ6n*dReQ4n 
8357                  - dImQ2n*dImQ4n*dReQ6n+dReQ2n*dReQ4n*dReQ6n)
8358                  - (-pow(dImQ4n,2.)*dImQ2n*dImQ10n+dImQ2n*dImQ10n*pow(dReQ4n,2.)
8359                  + 2.*dImQ4n*dImQ10n*dReQ4n*dReQ2n-2.*dImQ4n*dImQ2n*dReQ4n*dReQ10n 
8360                  - pow(dImQ4n,2.)*dReQ2n*dReQ10n+pow(dReQ4n,2.)*dReQ2n*dReQ10n)
8361                  - (dImQ2n*dImQ4n*dImQ6n*dImQ8n+dImQ6n*dImQ8n*dReQ2n*dReQ4n 
8362                  + dImQ4n*dImQ8n*dReQ2n*dReQ6n-dImQ2n*dImQ8n*dReQ4n*dReQ6n
8363                  - dImQ4n*dImQ6n*dReQ2n*dReQ8n+dImQ2n*dImQ6n*dReQ4n*dReQ8n 
8364                  + dImQ2n*dImQ4n*dReQ6n*dReQ8n+dReQ2n*dReQ4n*dReQ6n*dReQ8n)
8365                  - ((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
8366                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
8367                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8368                  + (dReQ10n*dReQ8n*dReQ2n-dReQ10n*dImQ8n*dImQ2n+dImQ10n*dReQ8n*dImQ2n+dImQ10n*dImQ8n*dReQ2n)
8369                  + 4.*(dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
8370                  + dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n)
8371                  + 3.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
8372                  - 2.*(dMult-6.)*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
8373                  + 4.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
8374                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
8375                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))+2.*(dMult-5.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8376                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8377                  - pow((pow(dReQ4n,2.)+pow(dImQ4n,2.)),2.)+2.*(3.*dMult-10.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8378                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*dMult*(dMult-6.))
8379                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8380   // to be polished:
8381   five6n2n2n5n5n = (reQ6nQ2nQ2nQ5nstarQ5nstar
8382                  - reQ6nQ4nQ5nstarQ5nstar-reQ8nQ2nQ5nstarQ5nstar-reQ8nQ2nQ5nstarQ5nstar
8383                                  - reQ6nQ2nQ5nstarQ3nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ6nQ2nQ5nstarQ3nstar
8384                                  - reQ10nQ6nstarQ2nstarQ2nstar-reQ6nQ2nQ5nstarQ3nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ6nQ2nQ5nstarQ3nstar
8385                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ10nQ5nstarQ5nstar)
8386                                  + reQ5nQ4nstarQ1nstar+reQ8nQ5nstarQ3nstar+reQ8nQ5nstarQ3nstar
8387                  + reQ10nQ8nstarQ2nstar+reQ10nQ6nstarQ4nstar+reQ10nQ8nstarQ2nstar
8388                                  + reQ5nQ4nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
8389                                  + reQ8nQ5nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                                                           
8390                                  + reQ8nQ5nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                           
8391                  + 2.*(reQ8nQ6nstarQ2nstar+reQ8nQ6nstarQ2nstar+reQ4nQ2nstarQ2nstar)
8392                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar)
8393                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8394                  - 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.))
8395                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.))
8396                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8397                                  - 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.))
8398                                  + 24.*dMult) 
8399                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8400   // to be polished:
8401   five6n5n5n5n1n = (reQ6nQ5nQ5nstarQ5nstarQ1nstar
8402                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8403                  - reQ10nQ1nQ6nstarQ5nstar
8404                  - dMult*reQ6nQ5nstarQ1nstar
8405                  - reQ11nQ5nstarQ5nstarQ1nstar 
8406                              - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8407                  - reQ6nQ4nQ5nstarQ5nstar
8408                  + reQ5nQ4nstarQ1nstar
8409                  + reQ11nQ6nstarQ5nstar
8410                  + 3.*reQ6nQ5nstarQ1nstar
8411                  + 2.*reQ11nQ6nstarQ5nstar
8412                  + dMult*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8413                  + reQ11nQ6nstarQ5nstar
8414                  + reQ10nQ6nstarQ4nstar
8415                  + reQ5nQ4nstarQ1nstar
8416                  + reQ11nQ10nstarQ1nstar
8417                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8418                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
8419                  + 3.*reQ6nQ5nstarQ1nstar
8420                  + reQ5nQ4nstarQ1nstar
8421                  + 2.*dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8422                  + 3.*reQ10nQ5nstarQ5nstar
8423                  + reQ5nQ4nstarQ1nstar
8424                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8425                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8426                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8427                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8428                                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))
8429                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8430                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
8431                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8432                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.)) 
8433                  - 2.*dMult*dMult
8434                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8435                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8436                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8437                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
8438                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8439   // to be polished:
8440   five6n6n5n5n2n = (reQ6nQ6nQ5nstarQ5nstarQ2nstar
8441                  - reQ7nQ5nQ6nstarQ6nstar-reQ7nQ5nQ6nstarQ6nstar-reQ10nQ2nQ6nstarQ6nstar
8442                  - reQ6nQ1nQ5nstarQ2nstar-reQ6nQ1nQ5nstarQ2nstar-reQ6nQ4nQ5nstarQ5nstar
8443                                  - reQ12nQ5nstarQ5nstarQ2nstar-reQ6nQ4nQ5nstarQ5nstar-reQ6nQ1nQ5nstarQ2nstar-reQ6nQ1nQ5nstarQ2nstar
8444                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ12nQ6nstarQ6nstar)
8445                                  + reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ10nQ6nstarQ4nstar
8446                  + reQ12nQ10nstarQ2nstar+reQ12nQ7nstarQ5nstar+reQ12nQ7nstarQ5nstar
8447                                  + reQ7nQ6nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ5nQ4nstarQ1nstar                           
8448                                  + reQ7nQ6nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ5nQ4nstarQ1nstar
8449                                  + reQ10nQ6nstarQ4nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar                          
8450                  + 2.*(reQ10nQ5nstarQ5nstar+reQ7nQ5nstarQ2nstar+reQ7nQ5nstarQ2nstar)
8451                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar)
8452                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8453                  - 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.))
8454                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ10n,2.)+pow(dImQ10n,2.))
8455                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8456                                  - 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.))
8457                                  + 24.*dMult) 
8458                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8459   five6n6n6n4n2n = ((pow(dImQ6n,2.)+pow(dReQ6n,2.))*(dImQ4n*dImQ6n*dReQ2n+dImQ2n*dImQ6n*dReQ4n
8460                  - dImQ2n*dImQ4n*dReQ6n+dReQ2n*dReQ4n*dReQ6n)
8461                  - (dReQ2n*dReQ4n*dReQ6n*dReQ12n-dReQ6n*dReQ12n*dImQ2n*dImQ4n
8462                  - dReQ4n*dReQ12n*dImQ2n*dImQ6n-dReQ2n*dReQ12n*dImQ4n*dImQ6n
8463                  + dReQ4n*dReQ6n*dImQ2n*dImQ12n+dReQ2n*dReQ6n*dImQ4n*dImQ12n 
8464                  + dReQ2n*dReQ4n*dImQ6n*dImQ12n-dImQ2n*dImQ4n*dImQ6n*dImQ12n)
8465                  - (dImQ2n*pow(dImQ6n,2.)*dImQ10n+2.*dImQ6n*dImQ10n*dReQ2n*dReQ6n
8466                  - dImQ2n*dImQ10n*pow(dReQ6n,2.)-pow(dImQ6n,2.)*dReQ2n*dReQ10n 
8467                  + 2.*dImQ2n*dImQ6n*dReQ6n*dReQ10n+dReQ2n*pow(dReQ6n,2.)*dReQ10n)
8468                  - ((dReQ8n*dReQ4n-dImQ8n*dImQ4n)*(dReQ6n*dReQ6n-dImQ6n*dImQ6n)
8469                  + 2.*(dReQ8n*dImQ4n+dImQ8n*dReQ4n)*dReQ6n*dImQ6n)
8470                  + dReQ12n*dReQ10n*dReQ2n-dReQ12n*dImQ10n*dImQ2n+dImQ12n*dReQ10n*dImQ2n+dImQ12n*dImQ10n*dReQ2n
8471                  + dReQ12n*dReQ8n*dReQ4n-dReQ12n*dImQ8n*dImQ4n+dImQ12n*dReQ8n*dImQ4n+dImQ12n*dImQ8n*dReQ4n
8472                  + 3.*(pow(dReQ6n,2.)*dReQ12n+2.*dReQ6n*dImQ6n*dImQ12n-pow(dImQ6n,2.)*dReQ12n)
8473                  + 4.*(dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
8474                  + 4.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
8475                  - 2.*(dMult-6.)*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
8476                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
8477                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
8478                  - 2.*(pow(dReQ12n,2.)+pow(dImQ12n,2.))-2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
8479                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))+2.*(3.*dMult-10.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8480                  - pow((pow(dReQ6n,2.)+pow(dImQ6n,2.)),2.)+2.*(dMult-5.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8481                  + 2.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*dMult*(dMult-6.))
8482                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8483   // to be polished (and  TBI swap with the one above):
8484   five6n6n6n5n1n = (reQ6nQ6nQ6nstarQ5nstarQ1nstar
8485                  - reQ7nQ5nQ6nstarQ6nstar
8486                  - reQ11nQ1nQ6nstarQ6nstar
8487                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8488                  - reQ12nQ6nstarQ5nstarQ1nstar 
8489                              - dMult*reQ6nQ5nstarQ1nstar
8490                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8491                  + reQ6nQ5nstarQ1nstar
8492                  + reQ12nQ6nstarQ6nstar
8493                  + 3.*dMult*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8494                  + 2.*reQ12nQ6nstarQ6nstar
8495                  + reQ7nQ6nstarQ1nstar
8496                  + reQ12nQ7nstarQ5nstar
8497                  + reQ11nQ6nstarQ5nstar
8498                  + reQ6nQ5nstarQ1nstar
8499                  + reQ12nQ11nstarQ1nstar
8500                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8501                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
8502                  + 3.*reQ7nQ6nstarQ1nstar
8503                  + reQ6nQ5nstarQ1nstar
8504                  + 2.*reQ6nQ5nstarQ1nstar
8505                  + 3.*reQ11nQ6nstarQ5nstar
8506                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8507                  + reQ6nQ5nstarQ1nstar
8508                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8509                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8510                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8511                                  - 2.*(pow(dReQ12n,2.)+pow(dImQ12n,2.))
8512                  - 2.*dMult*dMult
8513                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
8514                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8515                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.)) 
8516                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8517                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8518                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8519                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8520                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
8521                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8522   // Four distinct harmonics (11):
8523   // to be polished:
8524   five5n2n3n3n1n = (reQ5nQ2nQ3nstarQ3nstarQ1nstar
8525                  - reQ5nQ2nQ4nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar-reQ6nQ1nQ5nstarQ2nstar
8526                                  - reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ1nQ3nstarQ3nstar                  
8527                                  - reQ7nQ3nstarQ3nstarQ1nstar-reQ4nQ2nQ3nstarQ3nstar-reQ3nQ1nQ2nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar
8528                                  + 2.*(reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ7nQ5nstarQ2nstar)
8529                                  + reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ6nQ5nstarQ1nstar
8530                                  + reQ7nQ6nstarQ1nstar+reQ7nQ4nstarQ3nstar+reQ7nQ4nstarQ3nstar
8531                                  + reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar
8532                                  + reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar
8533                                  + reQ6nQ4nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
8534                                  + 2.*(reQ6nQ3nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8535                                  + 2.*(reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8536                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8537                                  - 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.))
8538                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
8539                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8540                                  - 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.))
8541                                  + 24.*dMult) 
8542                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8543   // to be polished:
8544   five5n1n1n4n3n = (reQ5nQ1nQ1nQ4nstarQ3nstar
8545                  - reQ5nQ2nQ4nstarQ3nstar-reQ6nQ1nQ4nstarQ3nstar-reQ6nQ1nQ4nstarQ3nstar
8546                                  - reQ5nQ1nQ4nstarQ2nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar
8547                                  - reQ7nQ5nstarQ1nstarQ1nstar-reQ5nQ1nQ3nstarQ3nstar-reQ3nQ1nstarQ1nstarQ1nstar-reQ5nQ1nQ3nstarQ3nstar
8548                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ7nQ4nstarQ3nstar)
8549                                  + reQ4nQ2nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar
8550                  + reQ7nQ6nstarQ1nstar+reQ7nQ5nstarQ2nstar+reQ7nQ6nstarQ1nstar
8551                                  + reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar
8552                                  + reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar                                                                                           
8553                                  + reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar                                                           
8554                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8555                  + 2.*(reQ5nQ3nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8556                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8557                                  - 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.))
8558                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
8559                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
8560                                  - 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.))
8561                                  + 24.*dMult) 
8562                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8563   // to be polished:
8564   five5n3n4n2n2n = (reQ5nQ3nQ4nstarQ2nstarQ2nstar
8565                  - reQ5nQ3nQ4nstarQ4nstar-reQ6nQ2nQ5nstarQ3nstar-reQ6nQ2nQ5nstarQ3nstar
8566                                  - reQ5nQ1nQ4nstarQ2nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar                      
8567                                  - reQ8nQ4nstarQ2nstarQ2nstar-reQ4nQ2nQ3nstarQ3nstar-reQ3nQ1nQ2nstarQ2nstar-reQ4nQ2nQ3nstarQ3nstar
8568                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ8nQ5nstarQ3nstar)
8569                                  + reQ5nQ4nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar
8570                  + reQ8nQ6nstarQ2nstar+reQ8nQ4nstarQ4nstar+reQ8nQ6nstarQ2nstar
8571                                  + reQ4nQ3nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar
8572                                  + reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar
8573                                  + reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar
8574                                  + 2.*(reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ4nQ2nstarQ2nstar)
8575                                  + 2.*(reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8576                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8577                                  - 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.))
8578                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
8579                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8580                                  - 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.))
8581                                  + 24.*dMult) 
8582                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8583
8584   // to be polished!!!:
8585   five5n2n1n4n4n = (reQ5nQ2nQ1nQ4nstarQ4nstar
8586                  - reQ5nQ3nQ4nstarQ4nstar-reQ6nQ2nQ4nstarQ4nstar-reQ7nQ1nQ4nstarQ4nstar
8587                                  - reQ5nQ1nQ4nstarQ2nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ5nQ2nQ4nstarQ3nstar
8588                                  - reQ8nQ5nstarQ2nstarQ1nstar-reQ5nQ2nQ4nstarQ3nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar
8589                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ8nQ4nstarQ4nstar)
8590                                  + reQ4nQ3nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ7nQ4nstarQ3nstar
8591                  + reQ8nQ7nstarQ1nstar+reQ8nQ5nstarQ3nstar+reQ8nQ6nstarQ2nstar
8592                                  + reQ4nQ3nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar
8593                                  + reQ6nQ4nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ5nQ3nstarQ2nstar                                                                                           
8594                                  + reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar                                                           
8595                  + 2.*(reQ7nQ5nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8596                  + 2.*(reQ5nQ4nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar)
8597                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8598                                  - 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.))
8599                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
8600                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8601                                  - 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.))
8602                                  + 24.*dMult) 
8603                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8604
8605
8606   // to be polished:
8607   five6n1n3n2n2n = (reQ6nQ1nQ3nstarQ2nstarQ2nstar
8608                  - reQ6nQ1nQ4nstarQ3nstar-reQ6nQ1nQ5nstarQ2nstar-reQ6nQ1nQ5nstarQ2nstar
8609                  - reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ2nstarQ2nstarQ2nstar-reQ6nQ3nstarQ2nstarQ1nstar                      
8610                                  - reQ7nQ3nstarQ2nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar
8611                                  + 2.*(reQ6nQ3nstarQ3nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ7nQ6nstarQ1nstar)
8612                                  + reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar
8613                  + reQ7nQ5nstarQ2nstar+reQ7nQ4nstarQ3nstar+reQ7nQ5nstarQ2nstar
8614                                  + reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
8615                                  + reQ5nQ4nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar
8616                                  + reQ5nQ4nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar
8617                                  + 2.*(reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ4nQ2nstarQ2nstar)
8618                                  + 2.*(reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8619                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8620                                  - 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.))
8621                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.))
8622                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
8623                                  - 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.))
8624                                  + 24.*dMult) 
8625                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8626
8627
8628   // to be polished:
8629   five6n3n4n4n1n = (reQ6nQ3nQ4nstarQ4nstarQ1nstar
8630                  - reQ8nQ1nQ6nstarQ3nstar-reQ6nQ3nQ5nstarQ4nstar-reQ6nQ3nQ5nstarQ4nstar
8631                                  - reQ6nQ4nstarQ1nstarQ1nstar-reQ6nQ2nQ4nstarQ4nstar-reQ6nQ4nstarQ1nstarQ1nstar                  
8632                                  - reQ9nQ4nstarQ4nstarQ1nstar-reQ4nQ1nQ3nstarQ2nstar-reQ5nQ3nQ4nstarQ4nstar-reQ4nQ1nQ3nstarQ2nstar
8633                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ9nQ6nstarQ3nstar)
8634                                  + reQ8nQ6nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar
8635                  + reQ9nQ5nstarQ4nstar+reQ9nQ8nstarQ1nstar+reQ9nQ5nstarQ4nstar
8636                                  + reQ8nQ5nstarQ3nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar                           
8637                                  + reQ5nQ3nstarQ2nstar+reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar                           
8638                                  + reQ5nQ3nstarQ2nstar+reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar
8639                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ8nQ4nstarQ4nstar)
8640                  + 2.*(reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8641                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8642                                  - 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.))
8643                                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.))
8644                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
8645                                  - 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.))
8646                  + 24.*dMult) 
8647                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8648
8649   // to be polished:
8650   five6n1n1n5n3n = (reQ6nQ1nQ1nQ5nstarQ3nstar
8651                  - reQ6nQ2nQ5nstarQ3nstar-reQ7nQ1nQ5nstarQ3nstar-reQ7nQ1nQ5nstarQ3nstar
8652                  - reQ6nQ1nQ5nstarQ2nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ6nQ1nQ5nstarQ2nstar
8653                                  - reQ8nQ6nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar-reQ3nQ1nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
8654                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ8nQ5nstarQ3nstar)
8655                                  + reQ5nQ3nstarQ2nstar+reQ7nQ5nstarQ2nstar+reQ7nQ5nstarQ2nstar
8656                  + reQ8nQ7nstarQ1nstar+reQ8nQ6nstarQ2nstar+reQ8nQ7nstarQ1nstar
8657                                  + reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar
8658                                  + reQ7nQ4nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ6nQ4nstarQ2nstar                                                                                           
8659                                  + reQ7nQ4nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ6nQ4nstarQ2nstar                                                                                           
8660                  + 2.*(reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8661                  + 2.*(reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8662                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8663                                  - 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.))
8664                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
8665                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
8666                  - 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.))
8667                  + 24.*dMult) 
8668                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8669   // to be polished:
8670   five6n3n5n2n2n = (reQ6nQ3nQ5nstarQ2nstarQ2nstar
8671                  - reQ6nQ3nQ5nstarQ4nstar-reQ7nQ2nQ6nstarQ3nstar-reQ7nQ2nQ6nstarQ3nstar
8672                  - reQ6nQ1nQ5nstarQ2nstar-reQ6nQ2nstarQ2nstarQ2nstar-reQ6nQ1nQ5nstarQ2nstar                      
8673                                  - reQ9nQ5nstarQ2nstarQ2nstar-reQ5nQ2nQ4nstarQ3nstar-reQ3nQ1nQ2nstarQ2nstar-reQ5nQ2nQ4nstarQ3nstar
8674                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ9nQ6nstarQ3nstar)
8675                                  + reQ6nQ4nstarQ2nstar+reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar
8676                  + reQ9nQ7nstarQ2nstar+reQ9nQ5nstarQ4nstar+reQ9nQ7nstarQ2nstar
8677                                  + reQ4nQ3nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar                           
8678                                  + reQ7nQ4nstarQ3nstar+reQ4nQ2nstarQ2nstar+reQ5nQ4nstarQ1nstar                           
8679                                  + reQ7nQ4nstarQ3nstar+reQ4nQ2nstarQ2nstar+reQ5nQ4nstarQ1nstar
8680                  + 2.*(reQ7nQ5nstarQ2nstar+reQ7nQ5nstarQ2nstar+reQ4nQ2nstarQ2nstar)
8681                  + 2.*(reQ5nQ3nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8682                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8683                                  - 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.))
8684                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
8685                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
8686                                  - 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.))
8687                  + 24.*dMult) 
8688                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8689
8690   // to be polished 
8691   five6n5n4n4n3n = (reQ6nQ5nQ4nstarQ4nstarQ3nstar
8692                  - reQ7nQ4nQ6nstarQ5nstar-reQ7nQ4nQ6nstarQ5nstar-reQ8nQ3nQ6nstarQ5nstar
8693                  - reQ6nQ1nQ4nstarQ3nstar-reQ6nQ1nQ4nstarQ3nstar-reQ6nQ2nQ4nstarQ4nstar                  
8694                                  - reQ11nQ4nstarQ4nstarQ3nstar-reQ5nQ3nQ4nstarQ4nstar-reQ5nQ2nQ4nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar
8695                                  + 2.*(reQ6nQ4nstarQ2nstar+reQ6nQ3nstarQ3nstar+reQ6nQ4nstarQ2nstar+reQ11nQ6nstarQ5nstar)
8696                                  + reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ8nQ6nstarQ2nstar
8697                  + reQ11nQ8nstarQ3nstar+reQ11nQ7nstarQ4nstar+reQ11nQ7nstarQ4nstar
8698                                  + reQ7nQ5nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ2nstarQ2nstar                                                           
8699                                  + reQ7nQ5nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ2nstarQ2nstar                           
8700                                  + reQ8nQ5nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
8701                  + 2.*(reQ8nQ4nstarQ4nstar+reQ7nQ4nstarQ3nstar+reQ7nQ4nstarQ3nstar)
8702                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar)
8703                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8704                                  - 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.))
8705                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.))
8706                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))                                
8707                                  - 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.))
8708                                  + 24.*dMult) 
8709                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8710   // to be polished:
8711   five6n3n1n5n5n = (reQ6nQ3nQ1nQ5nstarQ5nstar
8712                  - reQ6nQ4nQ5nstarQ5nstar-reQ7nQ3nQ5nstarQ5nstar-reQ9nQ1nQ5nstarQ5nstar      
8713                                  - reQ6nQ1nQ5nstarQ2nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ6nQ3nQ5nstarQ4nstar
8714                                  - reQ10nQ6nstarQ3nstarQ1nstar-reQ6nQ3nQ5nstarQ4nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ6nQ1nQ5nstarQ2nstar
8715                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ10nQ5nstarQ5nstar)
8716                                  + reQ5nQ4nstarQ1nstar+reQ7nQ5nstarQ2nstar+reQ9nQ5nstarQ4nstar
8717                  + reQ10nQ9nstarQ1nstar+reQ10nQ6nstarQ4nstar+reQ10nQ7nstarQ3nstar
8718                                  + reQ5nQ4nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ4nQ3nstarQ1nstar
8719                                  + reQ7nQ5nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ6nQ4nstarQ2nstar                                                                                           
8720                                  + reQ9nQ5nstarQ4nstar+reQ4nQ3nstarQ1nstar+reQ6nQ4nstarQ2nstar                                                                                           
8721                  + 2.*(reQ9nQ6nstarQ3nstar+reQ7nQ6nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8722                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar)
8723                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8724                                  - 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.))
8725                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ9n,2.)+pow(dImQ9n,2.))
8726                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8727                  - 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.))
8728                  + 24.*dMult) 
8729                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8730   // to be polished:
8731   five6n6n5n4n3n = (reQ6nQ6nQ5nstarQ4nstarQ3nstar
8732                  - reQ7nQ5nQ6nstarQ6nstar-reQ8nQ4nQ6nstarQ6nstar-reQ9nQ3nQ6nstarQ6nstar
8733                                  - reQ6nQ2nQ5nstarQ3nstar-reQ6nQ1nQ4nstarQ3nstar-reQ6nQ3nQ5nstarQ4nstar                  
8734                                  - reQ12nQ5nstarQ4nstarQ3nstar-reQ6nQ3nQ5nstarQ4nstar-reQ6nQ1nQ4nstarQ3nstar-reQ6nQ2nQ5nstarQ3nstar
8735                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ3nstarQ3nstar+reQ6nQ4nstarQ2nstar+reQ12nQ6nstarQ6nstar)
8736                                  + reQ7nQ6nstarQ1nstar+reQ8nQ6nstarQ2nstar+reQ9nQ6nstarQ3nstar
8737                  + reQ12nQ9nstarQ3nstar+reQ12nQ7nstarQ5nstar+reQ12nQ8nstarQ4nstar
8738                                  + reQ7nQ6nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar                                                           
8739                                  + reQ8nQ6nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar                           
8740                                  + reQ9nQ6nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ5nQ3nstarQ2nstar
8741                  + 2.*(reQ9nQ5nstarQ4nstar+reQ8nQ5nstarQ3nstar+reQ7nQ4nstarQ3nstar)
8742                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ3nstarQ3nstar)
8743                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8744                                  - 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.))
8745                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ9n,2.)+pow(dImQ9n,2.))
8746                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))                                
8747                                  - 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.))
8748                                  + 24.*dMult) 
8749                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8750   // Five distinct harmonics (3):
8751
8752   // to be polished:
8753   five6n2n4n3n1n = (reQ6nQ2nQ4nstarQ3nstarQ1nstar
8754                      - reQ6nQ2nQ4nstarQ4nstar-reQ6nQ2nQ5nstarQ3nstar-reQ7nQ1nQ6nstarQ2nstar
8755                      - reQ6nQ4nstarQ1nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
8756                      - reQ8nQ4nstarQ3nstarQ1nstar-reQ5nQ2nQ4nstarQ3nstar-reQ3nQ1nQ2nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar
8757                                  + 2.*(reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ6nQ3nstarQ3nstar+reQ8nQ6nstarQ2nstar)
8758                                  + 1.*(reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ7nQ6nstarQ1nstar)
8759                                  + 1.*(reQ8nQ7nstarQ1nstar+reQ8nQ4nstarQ4nstar+reQ8nQ5nstarQ3nstar)
8760                                  + 1.*(reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8761                                  + 1.*(reQ5nQ3nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8762                                  + 1.*(reQ7nQ5nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar)
8763                                  + 2.*(reQ7nQ4nstarQ3nstar+reQ5nQ4nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8764                                  + 2.*(reQ4nQ2nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar) // 3 - 1
8765                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8766                  - 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.)) 
8767                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
8768                          - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
8769                  - 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.)) 
8770                  + 24.*dMult) 
8771                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8772
8773
8774   // to be polished:
8775   five6n2n1n5n4n = (reQ6nQ2nQ1nQ5nstarQ4nstar
8776                  - reQ6nQ3nQ5nstarQ4nstar-reQ7nQ2nQ5nstarQ4nstar-reQ8nQ1nQ5nstarQ4nstar
8777                                  - reQ6nQ1nQ5nstarQ2nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ6nQ2nQ5nstarQ3nstar                      
8778                                  - reQ9nQ6nstarQ2nstarQ1nstar-reQ6nQ2nQ4nstarQ4nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
8779                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ9nQ5nstarQ4nstar)
8780                                  + reQ5nQ3nstarQ2nstar+reQ7nQ5nstarQ2nstar+reQ8nQ5nstarQ3nstar
8781                  + reQ9nQ8nstarQ1nstar+reQ9nQ6nstarQ3nstar+reQ9nQ7nstarQ2nstar
8782                                  + reQ4nQ3nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar                           
8783                                  + reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                           
8784                                  + reQ8nQ4nstarQ4nstar+reQ4nQ2nstarQ2nstar+reQ6nQ4nstarQ2nstar
8785                  + 2.*(reQ8nQ6nstarQ2nstar+reQ7nQ6nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8786                  + 2.*(reQ6nQ4nstarQ2nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar)
8787                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8788                                  - 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.))
8789                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.))
8790                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
8791                                  - 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.))
8792                  + 24.*dMult) 
8793                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8794
8795
8796
8797   // to be polished:
8798   five6n4n5n3n2n = (reQ6nQ4nQ5nstarQ3nstarQ2nstar
8799                      - reQ6nQ4nQ5nstarQ5nstar-reQ7nQ3nQ6nstarQ4nstar-reQ8nQ2nQ6nstarQ4nstar
8800                      - reQ6nQ1nQ5nstarQ2nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ2nQ5nstarQ3nstar
8801                      - reQ10nQ5nstarQ3nstarQ2nstar-reQ5nQ3nQ4nstarQ4nstar-reQ4nQ1nQ3nstarQ2nstar-reQ5nQ2nQ4nstarQ3nstar
8802                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ3nstarQ3nstar+reQ10nQ6nstarQ4nstar)
8803                                  + 1.*(reQ6nQ5nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ8nQ6nstarQ2nstar)
8804                                  + 1.*(reQ10nQ8nstarQ2nstar+reQ10nQ5nstarQ5nstar+reQ10nQ7nstarQ3nstar)
8805                                  + 1.*(reQ5nQ4nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8806                                  + 1.*(reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar)
8807                                  + 1.*(reQ8nQ4nstarQ4nstar+reQ4nQ3nstarQ1nstar+reQ5nQ4nstarQ1nstar)
8808                                  + 2.*(reQ8nQ5nstarQ3nstar+reQ7nQ5nstarQ2nstar+reQ5nQ3nstarQ2nstar)
8809                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar) // 3 - 1
8810                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8811                  - 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.)) 
8812                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
8813                          - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
8814                  - 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.)) 
8815                  + 24.*dMult) 
8816                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8817
8818
8819
8820   f5pCorrelations->Fill(0.5,five3n2n3n1n1n,d5pMultiplicityWeight);
8821   f5pCorrelations->Fill(1.5,five4n1n2n2n1n,d5pMultiplicityWeight); 
8822   f5pCorrelations->Fill(2.5,five4n2n3n2n1n,d5pMultiplicityWeight);
8823   f5pCorrelations->Fill(3.5,five4n3n3n2n2n,d5pMultiplicityWeight);
8824   f5pCorrelations->Fill(4.5,five4n2n4n1n1n,d5pMultiplicityWeight);
8825   f5pCorrelations->Fill(5.5,five4n3n4n2n1n,d5pMultiplicityWeight);
8826   f5pCorrelations->Fill(6.5,five5n1n3n2n1n,d5pMultiplicityWeight);
8827   f5pCorrelations->Fill(7.5,five5n2n5n1n1n,d5pMultiplicityWeight);
8828   f5pCorrelations->Fill(8.5,five5n2n4n2n1n,d5pMultiplicityWeight);
8829   f5pCorrelations->Fill(9.5,five5n3n4n3n1n,d5pMultiplicityWeight);
8830   f5pCorrelations->Fill(10.5,five5n4n4n3n2n,d5pMultiplicityWeight);
8831   f5pCorrelations->Fill(11.5,five5n3n5n2n1n,d5pMultiplicityWeight);
8832   f5pCorrelations->Fill(12.5,five5n4n5n2n2n,d5pMultiplicityWeight);
8833   f5pCorrelations->Fill(13.5,five5n4n5n3n1n,d5pMultiplicityWeight);
8834   f5pCorrelations->Fill(14.5,five6n1n3n3n1n,d5pMultiplicityWeight);
8835   f5pCorrelations->Fill(15.5,five6n2n3n3n2n,d5pMultiplicityWeight); 
8836   f5pCorrelations->Fill(16.5,five6n1n4n2n1n,d5pMultiplicityWeight); 
8837   f5pCorrelations->Fill(17.5,five6n3n4n3n2n,d5pMultiplicityWeight); 
8838   f5pCorrelations->Fill(18.5,five6n4n4n3n3n,d5pMultiplicityWeight); 
8839   f5pCorrelations->Fill(19.5,five6n2n5n2n1n,d5pMultiplicityWeight); 
8840   f5pCorrelations->Fill(20.5,five6n3n5n3n1n,d5pMultiplicityWeight); 
8841   f5pCorrelations->Fill(21.5,five6n4n5n4n1n,d5pMultiplicityWeight); 
8842   f5pCorrelations->Fill(22.5,five6n5n5n3n3n,d5pMultiplicityWeight); 
8843   f5pCorrelations->Fill(23.5,five6n2n6n1n1n,d5pMultiplicityWeight); 
8844   f5pCorrelations->Fill(24.5,five6n3n6n2n1n,d5pMultiplicityWeight); 
8845   f5pCorrelations->Fill(25.5,five6n4n6n2n2n,d5pMultiplicityWeight); 
8846   f5pCorrelations->Fill(26.5,five6n4n6n3n1n,d5pMultiplicityWeight); 
8847   f5pCorrelations->Fill(27.5,five6n5n5n4n2n,d5pMultiplicityWeight); 
8848   f5pCorrelations->Fill(28.5,five6n5n6n3n2n,d5pMultiplicityWeight); 
8849   f5pCorrelations->Fill(29.5,five6n5n6n4n1n,d5pMultiplicityWeight);
8850   //f5pCorrelations->Fill(30.5,-44.,d5pMultiplicityWeight);
8851   f5pCorrelations->Fill(31.5,five2n1n1n1n1n,d5pMultiplicityWeight);
8852   f5pCorrelations->Fill(32.5,five2n2n2n1n1n,d5pMultiplicityWeight); 
8853   f5pCorrelations->Fill(33.5,five3n3n2n2n2n,d5pMultiplicityWeight);
8854   f5pCorrelations->Fill(34.5,five4n1n1n1n1n,d5pMultiplicityWeight);
8855   f5pCorrelations->Fill(35.5,five4n2n2n2n2n,d5pMultiplicityWeight); 
8856   f5pCorrelations->Fill(36.5,five4n4n4n2n2n,d5pMultiplicityWeight); 
8857   f5pCorrelations->Fill(37.5,five6n3n3n3n3n,d5pMultiplicityWeight); 
8858   f5pCorrelations->Fill(38.5,five6n6n4n4n4n,d5pMultiplicityWeight); 
8859   f5pCorrelations->Fill(39.5,five6n6n6n3n3n,d5pMultiplicityWeight);
8860   //f5pCorrelations->Fill(40.5,-44.,d5pMultiplicityWeight);
8861   f5pCorrelations->Fill(41.5,five3n1n2n1n1n,d5pMultiplicityWeight);
8862   f5pCorrelations->Fill(42.5,five3n2n2n2n1n,d5pMultiplicityWeight);
8863   f5pCorrelations->Fill(43.5,five3n3n3n2n1n,d5pMultiplicityWeight);
8864   f5pCorrelations->Fill(44.5,five4n1n3n1n1n,d5pMultiplicityWeight);
8865   f5pCorrelations->Fill(45.5,five4n1n1n3n3n,d5pMultiplicityWeight);
8866   f5pCorrelations->Fill(46.5,five4n3n3n3n1n,d5pMultiplicityWeight);
8867   f5pCorrelations->Fill(47.5,five4n4n3n3n2n,d5pMultiplicityWeight);
8868   f5pCorrelations->Fill(48.5,five4n4n4n3n1n,d5pMultiplicityWeight);
8869   f5pCorrelations->Fill(49.5,five5n2n1n1n1n,d5pMultiplicityWeight);
8870   f5pCorrelations->Fill(50.5,five5n1n2n2n2n,d5pMultiplicityWeight);
8871   f5pCorrelations->Fill(51.5,five5n2n3n2n2n,d5pMultiplicityWeight);
8872   f5pCorrelations->Fill(52.5,five5n3n3n3n2n,d5pMultiplicityWeight);
8873   f5pCorrelations->Fill(53.5,five5n1n4n1n1n,d5pMultiplicityWeight);
8874   f5pCorrelations->Fill(54.5,five5n4n3n3n3n,d5pMultiplicityWeight);
8875   f5pCorrelations->Fill(55.5,five5n4n4n4n1n,d5pMultiplicityWeight);
8876   f5pCorrelations->Fill(56.5,five5n5n4n3n3n,d5pMultiplicityWeight);
8877   f5pCorrelations->Fill(57.5,five5n5n4n4n2n,d5pMultiplicityWeight);
8878   f5pCorrelations->Fill(58.5,five5n5n5n3n2n,d5pMultiplicityWeight);
8879   f5pCorrelations->Fill(59.5,five5n5n5n4n1n,d5pMultiplicityWeight);
8880   f5pCorrelations->Fill(60.5,five6n2n2n1n1n,d5pMultiplicityWeight);
8881   f5pCorrelations->Fill(61.5,five6n3n1n1n1n,d5pMultiplicityWeight);
8882   f5pCorrelations->Fill(62.5,five6n1n1n4n4n,d5pMultiplicityWeight);
8883   f5pCorrelations->Fill(63.5,five6n1n5n1n1n,d5pMultiplicityWeight);
8884   f5pCorrelations->Fill(64.5,five6n2n4n2n2n,d5pMultiplicityWeight);
8885   f5pCorrelations->Fill(65.5,five6n4n4n4n2n,d5pMultiplicityWeight);
8886   f5pCorrelations->Fill(66.5,five6n2n2n5n5n,d5pMultiplicityWeight);
8887   f5pCorrelations->Fill(67.5,five6n5n5n5n1n,d5pMultiplicityWeight);
8888   f5pCorrelations->Fill(68.5,five6n6n5n5n2n,d5pMultiplicityWeight);
8889   f5pCorrelations->Fill(69.5,five6n6n6n4n2n,d5pMultiplicityWeight);
8890   f5pCorrelations->Fill(70.5,five6n6n6n5n1n,d5pMultiplicityWeight);
8891   //f5pCorrelations->Fill(71.5,-44.,d5pMultiplicityWeight);
8892   f5pCorrelations->Fill(72.5,five5n2n3n3n1n,d5pMultiplicityWeight);
8893   f5pCorrelations->Fill(73.5,five5n1n1n4n3n,d5pMultiplicityWeight);
8894   f5pCorrelations->Fill(74.5,five5n3n4n2n2n,d5pMultiplicityWeight);
8895   f5pCorrelations->Fill(75.5,five5n2n1n4n4n,d5pMultiplicityWeight);
8896   f5pCorrelations->Fill(76.5,five6n1n3n2n2n,d5pMultiplicityWeight);
8897   f5pCorrelations->Fill(77.5,five6n3n4n4n1n,d5pMultiplicityWeight);
8898   f5pCorrelations->Fill(78.5,five6n1n1n5n3n,d5pMultiplicityWeight);
8899   f5pCorrelations->Fill(79.5,five6n3n5n2n2n,d5pMultiplicityWeight);
8900   f5pCorrelations->Fill(80.5,five6n5n4n4n3n,d5pMultiplicityWeight);
8901   f5pCorrelations->Fill(81.5,five6n3n1n5n5n,d5pMultiplicityWeight);
8902   f5pCorrelations->Fill(82.5,five6n6n5n4n3n,d5pMultiplicityWeight);
8903   //f5pCorrelations->Fill(83.5,-44.,d5pMultiplicityWeight);
8904   f5pCorrelations->Fill(84.5,five6n2n4n3n1n,d5pMultiplicityWeight);
8905   f5pCorrelations->Fill(85.5,five6n2n1n5n4n,d5pMultiplicityWeight);
8906   f5pCorrelations->Fill(86.5,five6n4n5n3n2n,d5pMultiplicityWeight);
8907   allMixedCorrelators[56]=five3n2n3n1n1n;
8908   allMixedCorrelators[57]=five4n1n2n2n1n;
8909   allMixedCorrelators[58]=five4n2n3n2n1n;
8910   allMixedCorrelators[59]=five4n3n3n2n2n;
8911   allMixedCorrelators[60]=five4n2n4n1n1n;
8912   allMixedCorrelators[61]=five4n3n4n2n1n;
8913   allMixedCorrelators[62]=five5n1n3n2n1n;
8914   allMixedCorrelators[63]=five5n2n5n1n1n;
8915   allMixedCorrelators[64]=five5n2n4n2n1n;
8916   allMixedCorrelators[65]=five5n3n4n3n1n;
8917   allMixedCorrelators[66]=five5n4n4n3n2n;
8918   allMixedCorrelators[67]=five5n3n5n2n1n;
8919   allMixedCorrelators[68]=five5n4n5n2n2n;
8920   allMixedCorrelators[69]=five5n4n5n3n1n;
8921   allMixedCorrelators[70]=five6n1n3n3n1n;
8922   allMixedCorrelators[71]=five6n2n3n3n2n;
8923   allMixedCorrelators[72]=five6n1n4n2n1n;
8924   allMixedCorrelators[73]=five6n3n4n3n2n;
8925   allMixedCorrelators[74]=five6n4n4n3n3n;
8926   allMixedCorrelators[75]=five6n2n5n2n1n;
8927   allMixedCorrelators[76]=five6n3n5n3n1n;
8928   allMixedCorrelators[77]=five6n4n5n4n1n;
8929   allMixedCorrelators[78]=five6n5n5n3n3n;
8930   allMixedCorrelators[79]=five6n2n6n1n1n;
8931   allMixedCorrelators[80]=five6n3n6n2n1n;
8932   allMixedCorrelators[81]=five6n4n6n2n2n;
8933   allMixedCorrelators[82]=five6n4n6n3n1n;
8934   allMixedCorrelators[83]=five6n5n5n4n2n;
8935   allMixedCorrelators[84]=five6n5n6n3n2n;
8936   allMixedCorrelators[85]=five6n5n6n4n1n;
8937   allMixedCorrelators[86]=five2n1n1n1n1n;
8938   allMixedCorrelators[87]=five2n2n2n1n1n;
8939   allMixedCorrelators[88]=five3n3n2n2n2n;
8940   allMixedCorrelators[89]=five4n1n1n1n1n;
8941   allMixedCorrelators[90]=five4n2n2n2n2n;
8942   allMixedCorrelators[91]=five4n4n4n2n2n;
8943   allMixedCorrelators[92]=five6n3n3n3n3n;
8944   allMixedCorrelators[93]=five6n6n4n4n4n;
8945   allMixedCorrelators[94]=five6n6n6n3n3n;
8946   allMixedCorrelators[95]=five3n1n2n1n1n;
8947   allMixedCorrelators[96]=five3n2n2n2n1n;
8948   allMixedCorrelators[97]=five3n3n3n2n1n;
8949   allMixedCorrelators[98]=five4n1n3n1n1n;
8950   allMixedCorrelators[99]=five4n1n1n3n3n;
8951   allMixedCorrelators[100]=five4n3n3n3n1n;
8952   allMixedCorrelators[101]=five4n4n3n3n2n;
8953   allMixedCorrelators[102]=five4n4n4n3n1n;
8954   allMixedCorrelators[103]=five5n2n1n1n1n;
8955   allMixedCorrelators[104]=five5n1n2n2n2n;
8956   allMixedCorrelators[105]=five5n2n3n2n2n;
8957   allMixedCorrelators[106]=five5n3n3n3n2n;
8958   allMixedCorrelators[107]=five5n1n4n1n1n;
8959   allMixedCorrelators[108]=five5n4n3n3n3n;
8960   allMixedCorrelators[109]=five5n4n4n4n1n;
8961   allMixedCorrelators[110]=five5n5n4n3n3n;
8962   allMixedCorrelators[111]=five5n5n4n4n2n;
8963   allMixedCorrelators[112]=five5n5n5n3n2n;
8964   allMixedCorrelators[113]=five5n5n5n4n1n;
8965   allMixedCorrelators[114]=five6n2n2n1n1n;
8966   allMixedCorrelators[115]=five6n3n1n1n1n;
8967   allMixedCorrelators[116]=five6n1n1n4n4n;
8968   allMixedCorrelators[117]=five6n1n5n1n1n;
8969   allMixedCorrelators[118]=five6n2n4n2n2n;
8970   allMixedCorrelators[119]=five6n4n4n4n2n;
8971   allMixedCorrelators[120]=five6n2n2n5n5n;
8972   allMixedCorrelators[121]=five6n5n5n5n1n;
8973   allMixedCorrelators[122]=five6n6n5n5n2n;
8974   allMixedCorrelators[123]=five6n6n6n4n2n;
8975   allMixedCorrelators[124]=five6n6n6n5n1n;
8976   allMixedCorrelators[125]=five5n2n3n3n1n;
8977   allMixedCorrelators[126]=five5n1n1n4n3n;
8978   allMixedCorrelators[127]=five5n3n4n2n2n;
8979   allMixedCorrelators[128]=five5n2n1n4n4n;
8980   allMixedCorrelators[129]=five6n1n3n2n2n;
8981   allMixedCorrelators[130]=five6n3n4n4n1n;
8982   allMixedCorrelators[131]=five6n1n1n5n3n;
8983   allMixedCorrelators[132]=five6n3n5n2n2n;
8984   allMixedCorrelators[133]=five6n5n4n4n3n;
8985   allMixedCorrelators[134]=five6n3n1n5n5n;
8986   allMixedCorrelators[135]=five6n6n5n4n3n;
8987   allMixedCorrelators[136]=five6n2n4n3n1n;
8988   allMixedCorrelators[137]=five6n2n1n5n4n;
8989   allMixedCorrelators[138]=five6n4n5n3n2n;
8990  } // end of if(dMult>4.)
8991  
8992  // Products of mixed harmonics:
8993  Double_t dwx=0.;
8994  Double_t dwy=0.;
8995  for(Int_t x=1;x<=139;x++)
8996  {  
8997   if(x>=1 && x<7)
8998   {
8999    dwx=d2pMultiplicityWeight;
9000   } else if(x>=7 && x<16)
9001     {
9002      dwx=d3pMultiplicityWeight;
9003     } else if(x>=16 && x<57)
9004       {
9005        dwx=d4pMultiplicityWeight;
9006       } else if(x>=57 && x<140)
9007         {
9008          dwx=d5pMultiplicityWeight;
9009         }
9010   for(Int_t y=x+1;y<=139;y++)
9011   {
9012    if(y>=1 && y<7)
9013    {
9014     dwy=d2pMultiplicityWeight;
9015    } else if(y>=7 && y<16)
9016      {
9017       dwy=d3pMultiplicityWeight;
9018      } else if(y>=16 && y<57)
9019        {
9020         dwy=d4pMultiplicityWeight;
9021        } else if(y>=57 && y<140)
9022          {
9023           dwy=d5pMultiplicityWeight;
9024          }
9025    fMixedHarmonicProductOfCorrelations->Fill(x-0.5,y-0.5,allMixedCorrelators[x-1]*allMixedCorrelators[y-1],dwx*dwy);
9026   } // end of for(Int_t y=x+1;y<=139;y++)
9027  } // end of for(Int_t x=1;x<=139;x++)
9028
9029 } // end of void AliFlowAnalysisWithQCumulants::CalculateMixedHarmonics()
9030
9031 //===================================================================================================================
9032
9033 void AliFlowAnalysisWithQCumulants::CalculateCumulantsMixedHarmonics()
9034 {
9035  // Calculate in this method all multi-particle cumulants for azimuthal correlations in mixed harmonics.
9036  // (Remark: For completeness sake, we also calculate here again cumulants in the same harmonic.) 
9037
9038  // a) Calculate 2-p cumulants; 
9039  // b) Calculate 3-p cumulants; 
9040  // c) Calculate 4-p cumulants; 
9041  // d) Calculate 5-p cumulants. 
9042
9043  // a) Calculate 2-p cumulants: 
9044  for(Int_t b=1;b<=6;b++)
9045  {
9046   f2pCumulants->SetBinContent(b,f2pCorrelations->GetBinContent(b)); 
9047   Double_t dSumWLinear = 0.; // sum of linear event weights
9048   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
9049   Double_t dSpread = 0.; // weighted and biased estimator for sigma
9050   Double_t dError = 0.; // weighted and unbiased estimator for error
9051   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9052   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9053   dSpread = f2pCorrelations->GetBinError(b);
9054   if(pow(dSumWLinear,2.)>dSumWQuadratic)
9055   {
9056    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
9057    f2pCumulants->SetBinError(b,dError); 
9058   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
9059  } // end of for(Int_t b=1;b<=6;b++)
9060
9061  // b) Calculate 3-p cumulants: 
9062  for(Int_t b=1;b<=10;b++)
9063  {
9064   f3pCumulants->SetBinContent(b,f3pCorrelations->GetBinContent(b)); 
9065   Double_t dSumWLinear = 0.; // sum of linear event weights
9066   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
9067   Double_t dSpread = 0.; // weighted and biased estimator for sigma
9068   Double_t dError = 0.; // weighted and unbiased estimator for sigma
9069   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9070   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9071   dSpread = f3pCorrelations->GetBinError(b);
9072   if(pow(dSumWLinear,2.)>dSumWQuadratic)
9073   {
9074    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
9075    f3pCumulants->SetBinError(b,dError); 
9076   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
9077  } // end of for(Int_t b=1;b<=10;b++)
9078
9079  // c) Calculate 4-p cumulants: 
9080  // c1) "Single harmonic":
9081  for(Int_t b=1;b<=6;b++)
9082  {
9083   f4pCumulants->SetBinContent(b,f4pCorrelations->GetBinContent(b)-2.*pow(f2pCorrelations->GetBinContent(b),2.));
9084   Double_t dSumWLinearTwo = 0.; // sum of linear event weights for <2>
9085   Double_t dSumWQuadraticTwo = 0.; // sum of quadratic event weights <2>
9086   Double_t dSpreadTwo = 0.; // weighted and biased estimator for sigma of <2>
9087   Double_t dSumWLinearFour = 0.; // sum of linear event weights for <4>
9088   Double_t dSumWQuadraticFour = 0.; // sum of quadratic event weights <4>
9089   Double_t dSpreadFour = 0.; // weighted and biased estimator for sigma of <4>
9090   dSumWLinearTwo = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9091   dSumWQuadraticTwo = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9092   dSpreadTwo = f2pCorrelations->GetBinError(b);
9093   dSumWLinearFour = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9094   dSumWQuadraticFour = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9095   dSpreadFour = f4pCorrelations->GetBinError(b);
9096   if(pow(dSumWLinearTwo,2.)>dSumWQuadraticTwo && pow(dSumWLinearFour,2.)>dSumWQuadraticFour) 
9097   {
9098    Double_t dError = 16.*pow(f2pCorrelations->GetBinContent(b),2.)
9099                    * pow((pow(dSumWQuadraticTwo,0.5)/dSumWLinearTwo)*dSpreadTwo*pow(pow(dSumWLinearTwo,2.)/(pow(dSumWLinearTwo,2.)-dSumWQuadraticTwo),0.5),2.)
9100                    + pow((pow(dSumWQuadraticFour,0.5)/dSumWLinearFour)*dSpreadFour*pow(pow(dSumWLinearFour,2.)/(pow(dSumWLinearFour,2.)-dSumWQuadraticFour),0.5),2.)
9101                    - 8.*f2pCorrelations->GetBinContent(b)
9102                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9103                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(b,b+15))
9104                    - f2pCorrelations->GetBinContent(b)*f4pCorrelations->GetBinContent(b))
9105                    / (dSumWLinearTwo*dSumWLinearFour-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9106    if(dError>0.)
9107    {
9108     f4pCumulants->SetBinError(b,pow(dError,0.5)); 
9109    }
9110   } // end of if(pow(dSumWLinearTwo,2.)>dSumWQuadraticTwo && pow(dSumWLinearFour,2.)>dSumWQuadraticFour) 
9111  } // end of for(Int_t b=1;b<=6;b++)     
9112  // c2) "Standard candles":
9113  // <4>_{2n,1n|2n,1n}:
9114  f4pCumulants->SetBinContent(8,f4pCorrelations->GetBinContent(8)-f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(1));
9115  {
9116   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
9117   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
9118   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
9119   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
9120   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
9121   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
9122   Double_t dSumWLinearFour2n1n2n1n = 0.; // sum of linear event weights for <4>
9123   Double_t dSumWQuadraticFour2n1n2n1n = 0.; // sum of quadratic event weights <4>
9124   Double_t dSpreadFour2n1n2n1n = 0.; // weighted and biased estimator for sigma of <4>
9125   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9126   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9127   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
9128   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9129   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9130   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
9131   dSumWLinearFour2n1n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9132   dSumWQuadraticFour2n1n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9133   dSpreadFour2n1n2n1n = f4pCorrelations->GetBinError(8);
9134   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
9135      pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
9136      pow(dSumWLinearFour2n1n2n1n,2.)>dSumWQuadraticFour2n1n2n1n)
9137   {
9138    Double_t dError = pow(f2pCorrelations->GetBinContent(2),2.)
9139                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
9140                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
9141                    + pow(f2pCorrelations->GetBinContent(1),2.)
9142                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
9143                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
9144                    + pow((pow(dSumWQuadraticFour2n1n2n1n,0.5)/dSumWLinearFour2n1n2n1n)
9145                    * dSpreadFour2n1n2n1n*pow(pow(dSumWLinearFour2n1n2n1n,2.)/(pow(dSumWLinearFour2n1n2n1n,2.)-dSumWQuadraticFour2n1n2n1n),0.5),2.)
9146                    + 2.*f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(1)
9147                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9148                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,2))
9149                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(2))
9150                    / (dSumWLinearTwo1n1n*dSumWLinearTwo2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9151                    - 2.*f2pCorrelations->GetBinContent(2)
9152                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9153                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,22))
9154                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(8))
9155                    / (dSumWLinearTwo1n1n*dSumWLinearFour2n1n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9156                    - 2.*f2pCorrelations->GetBinContent(1)
9157                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9158                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,22))
9159                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(8))
9160                    / (dSumWLinearTwo2n2n*dSumWLinearFour2n1n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9161    if(dError>0.)
9162    {
9163     f4pCumulants->SetBinError(8,pow(dError,0.5)); 
9164    }
9165   } // end of if(...)
9166  } // end of {
9167  // <4>_{3n,1n|3n,1n}:
9168  f4pCumulants->SetBinContent(9,f4pCorrelations->GetBinContent(9)-f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(1));
9169  {
9170   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
9171   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
9172   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
9173   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9174   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9175   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9176   Double_t dSumWLinearFour3n1n3n1n = 0.; // sum of linear event weights for <4>
9177   Double_t dSumWQuadraticFour3n1n3n1n = 0.; // sum of quadratic event weights <4>
9178   Double_t dSpreadFour3n1n3n1n = 0.; // weighted and biased estimator for sigma of <4>
9179   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9180   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9181   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
9182   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9183   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9184   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9185   dSumWLinearFour3n1n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9186   dSumWQuadraticFour3n1n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9187   dSpreadFour3n1n3n1n = f4pCorrelations->GetBinError(9);
9188   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
9189      pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9190      pow(dSumWLinearFour3n1n3n1n,2.)>dSumWQuadraticFour3n1n3n1n)
9191   {
9192    Double_t dError = pow(f2pCorrelations->GetBinContent(3),2.)
9193                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
9194                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
9195                    + pow(f2pCorrelations->GetBinContent(1),2.)
9196                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9197                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9198                    + pow((pow(dSumWQuadraticFour3n1n3n1n,0.5)/dSumWLinearFour3n1n3n1n)
9199                    * dSpreadFour3n1n3n1n*pow(pow(dSumWLinearFour3n1n3n1n,2.)/(pow(dSumWLinearFour3n1n3n1n,2.)-dSumWQuadraticFour3n1n3n1n),0.5),2.)
9200                    + 2.*f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(1)
9201                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9202                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,3))
9203                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(3))
9204                    / (dSumWLinearTwo1n1n*dSumWLinearTwo3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9205                    - 2.*f2pCorrelations->GetBinContent(3)
9206                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9207                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,23))
9208                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(9))
9209                    / (dSumWLinearTwo1n1n*dSumWLinearFour3n1n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9210                    - 2.*f2pCorrelations->GetBinContent(1)
9211                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9212                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,23))
9213                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(9))
9214                    / (dSumWLinearTwo3n3n*dSumWLinearFour3n1n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9215    if(dError>0.)
9216    {
9217     f4pCumulants->SetBinError(9,pow(dError,0.5)); 
9218    }
9219   } // end of if(...)
9220  } // end of {
9221  // <4>_{3n,2n|3n,2n}:
9222  f4pCumulants->SetBinContent(10,f4pCorrelations->GetBinContent(10)-f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(2));
9223  {
9224   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
9225   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
9226   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
9227   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9228   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9229   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9230   Double_t dSumWLinearFour3n2n3n2n = 0.; // sum of linear event weights for <4>
9231   Double_t dSumWQuadraticFour3n2n3n2n = 0.; // sum of quadratic event weights <4>
9232   Double_t dSpreadFour3n2n3n2n = 0.; // weighted and biased estimator for sigma of <4>
9233   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9234   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9235   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
9236   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9237   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9238   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9239   dSumWLinearFour3n2n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9240   dSumWQuadraticFour3n2n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9241   dSpreadFour3n2n3n2n = f4pCorrelations->GetBinError(10);
9242   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
9243      pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9244      pow(dSumWLinearFour3n2n3n2n,2.)>dSumWQuadraticFour3n2n3n2n)
9245   {
9246    Double_t dError = pow(f2pCorrelations->GetBinContent(3),2.)
9247                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
9248                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
9249                    + pow(f2pCorrelations->GetBinContent(2),2.)
9250                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9251                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9252                    + pow((pow(dSumWQuadraticFour3n2n3n2n,0.5)/dSumWLinearFour3n2n3n2n)
9253                    * dSpreadFour3n2n3n2n*pow(pow(dSumWLinearFour3n2n3n2n,2.)/(pow(dSumWLinearFour3n2n3n2n,2.)-dSumWQuadraticFour3n2n3n2n),0.5),2.)
9254                    + 2.*f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(2)
9255                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9256                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,3))
9257                    - f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(3))
9258                    / (dSumWLinearTwo2n2n*dSumWLinearTwo3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9259                    - 2.*f2pCorrelations->GetBinContent(3)
9260                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9261                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,24))
9262                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(10))
9263                    / (dSumWLinearTwo2n2n*dSumWLinearFour3n2n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9264                    - 2.*f2pCorrelations->GetBinContent(2)
9265                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9266                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,24))
9267                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(10))
9268                    / (dSumWLinearTwo3n3n*dSumWLinearFour3n2n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9269    if(dError>0.)
9270    {
9271     f4pCumulants->SetBinError(10,pow(dError,0.5)); 
9272    }
9273   } // end of if(...)
9274  } // end of {
9275  // <4>_{4n,1n|4n,1n}
9276  f4pCumulants->SetBinContent(11,f4pCorrelations->GetBinContent(11)-f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(1));
9277  {
9278   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
9279   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
9280   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
9281   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9282   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9283   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9284   Double_t dSumWLinearFour4n1n4n1n = 0.; // sum of linear event weights for <4>
9285   Double_t dSumWQuadraticFour4n1n4n1n = 0.; // sum of quadratic event weights <4>
9286   Double_t dSpreadFour4n1n4n1n = 0.; // weighted and biased estimator for sigma of <4>
9287   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9288   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9289   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
9290   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9291   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9292   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9293   dSumWLinearFour4n1n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9294   dSumWQuadraticFour4n1n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9295   dSpreadFour4n1n4n1n = f4pCorrelations->GetBinError(11);
9296   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
9297      pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9298      pow(dSumWLinearFour4n1n4n1n,2.)>dSumWQuadraticFour4n1n4n1n)
9299   {
9300    Double_t dError = pow(f2pCorrelations->GetBinContent(4),2.)
9301                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
9302                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
9303                    + pow(f2pCorrelations->GetBinContent(1),2.)
9304                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9305                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9306                    + pow((pow(dSumWQuadraticFour4n1n4n1n,0.5)/dSumWLinearFour4n1n4n1n)
9307                    * dSpreadFour4n1n4n1n*pow(pow(dSumWLinearFour4n1n4n1n,2.)/(pow(dSumWLinearFour4n1n4n1n,2.)-dSumWQuadraticFour4n1n4n1n),0.5),2.)
9308                    + 2.*f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(1)
9309                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9310                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,4))
9311                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(4))
9312                    / (dSumWLinearTwo1n1n*dSumWLinearTwo4n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9313                    - 2.*f2pCorrelations->GetBinContent(4)
9314                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9315                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,25))
9316                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(11))
9317                    / (dSumWLinearTwo1n1n*dSumWLinearFour4n1n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9318                    - 2.*f2pCorrelations->GetBinContent(1)
9319                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9320                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,25))
9321                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(11))
9322                    / (dSumWLinearTwo4n4n*dSumWLinearFour4n1n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9323    if(dError>0.)
9324    {
9325     f4pCumulants->SetBinError(11,pow(dError,0.5)); 
9326    }
9327   } // end of if(...)
9328  } // end of {
9329  // <4>_{4n,2n|4n,2n}
9330  f4pCumulants->SetBinContent(12,f4pCorrelations->GetBinContent(12)-f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(2));
9331  {
9332   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
9333   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
9334   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
9335   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9336   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9337   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9338   Double_t dSumWLinearFour4n2n4n2n = 0.; // sum of linear event weights for <4>
9339   Double_t dSumWQuadraticFour4n2n4n2n = 0.; // sum of quadratic event weights <4>
9340   Double_t dSpreadFour4n2n4n2n = 0.; // weighted and biased estimator for sigma of <4>
9341   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9342   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9343   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
9344   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9345   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9346   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9347   dSumWLinearFour4n2n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9348   dSumWQuadraticFour4n2n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9349   dSpreadFour4n2n4n2n = f4pCorrelations->GetBinError(12);
9350   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
9351      pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9352      pow(dSumWLinearFour4n2n4n2n,2.)>dSumWQuadraticFour4n2n4n2n)
9353   {
9354    Double_t dError = pow(f2pCorrelations->GetBinContent(4),2.)
9355                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
9356                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
9357                    + pow(f2pCorrelations->GetBinContent(2),2.)
9358                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9359                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9360                    + pow((pow(dSumWQuadraticFour4n2n4n2n,0.5)/dSumWLinearFour4n2n4n2n)
9361                    * dSpreadFour4n2n4n2n*pow(pow(dSumWLinearFour4n2n4n2n,2.)/(pow(dSumWLinearFour4n2n4n2n,2.)-dSumWQuadraticFour4n2n4n2n),0.5),2.)
9362                    + 2.*f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(2)
9363                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9364                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,4))
9365                    - f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(4))
9366                    / (dSumWLinearTwo2n2n*dSumWLinearTwo4n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9367                    - 2.*f2pCorrelations->GetBinContent(4)
9368                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9369                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,25))
9370                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(12))
9371                    / (dSumWLinearTwo2n2n*dSumWLinearFour4n2n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9372                    - 2.*f2pCorrelations->GetBinContent(2)
9373                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9374                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,25))
9375                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(12))
9376                    / (dSumWLinearTwo4n4n*dSumWLinearFour4n2n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9377    if(dError>0.)
9378    {
9379     f4pCumulants->SetBinError(12,pow(dError,0.5)); 
9380    }
9381   } // end of if(...)
9382  } // end of {
9383  // <4>_{4n,3n|4n,3n}
9384  f4pCumulants->SetBinContent(13,f4pCorrelations->GetBinContent(13)-f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(3));
9385  {
9386   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9387   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9388   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9389   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9390   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9391   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9392   Double_t dSumWLinearFour4n3n4n3n = 0.; // sum of linear event weights for <4>
9393   Double_t dSumWQuadraticFour4n3n4n3n = 0.; // sum of quadratic event weights <4>
9394   Double_t dSpreadFour4n3n4n3n = 0.; // weighted and biased estimator for sigma of <4>
9395   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9396   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9397   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9398   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9399   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9400   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9401   dSumWLinearFour4n3n4n3n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9402   dSumWQuadraticFour4n3n4n3n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9403   dSpreadFour4n3n4n3n = f4pCorrelations->GetBinError(13);
9404   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9405      pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9406      pow(dSumWLinearFour4n3n4n3n,2.)>dSumWQuadraticFour4n3n4n3n)
9407   {
9408    Double_t dError = pow(f2pCorrelations->GetBinContent(4),2.)
9409                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9410                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9411                    + pow(f2pCorrelations->GetBinContent(3),2.)
9412                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9413                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9414                    + pow((pow(dSumWQuadraticFour4n3n4n3n,0.5)/dSumWLinearFour4n3n4n3n)
9415                    * dSpreadFour4n3n4n3n*pow(pow(dSumWLinearFour4n3n4n3n,2.)/(pow(dSumWLinearFour4n3n4n3n,2.)-dSumWQuadraticFour4n3n4n3n),0.5),2.)
9416                    + 2.*f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(3)
9417                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9418                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,4))
9419                    - f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(4))
9420                    / (dSumWLinearTwo3n3n*dSumWLinearTwo4n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9421                    - 2.*f2pCorrelations->GetBinContent(4)
9422                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9423                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,26))
9424                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(13))
9425                    / (dSumWLinearTwo3n3n*dSumWLinearFour4n3n4n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9426                    - 2.*f2pCorrelations->GetBinContent(3)
9427                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9428                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,26))
9429                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(13))
9430                    / (dSumWLinearTwo4n4n*dSumWLinearFour4n3n4n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9431    if(dError>0.)
9432    {
9433     f4pCumulants->SetBinError(13,pow(dError,0.5)); 
9434    }
9435   } // end of if(...)
9436  } // end of {
9437  // <4>_{5n,1n|5n,1n}
9438  f4pCumulants->SetBinContent(14,f4pCorrelations->GetBinContent(14)-f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(1));
9439  {
9440   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
9441   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
9442   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
9443   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
9444   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
9445   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
9446   Double_t dSumWLinearFour5n1n5n1n = 0.; // sum of linear event weights for <4>
9447   Double_t dSumWQuadraticFour5n1n5n1n = 0.; // sum of quadratic event weights <4>
9448   Double_t dSpreadFour5n1n5n1n = 0.; // weighted and biased estimator for sigma of <4>
9449   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9450   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9451   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
9452   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9453   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9454   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9455   dSumWLinearFour5n1n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9456   dSumWQuadraticFour5n1n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9457   dSpreadFour5n1n5n1n = f4pCorrelations->GetBinError(14);
9458   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
9459      pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9460      pow(dSumWLinearFour5n1n5n1n,2.)>dSumWQuadraticFour5n1n5n1n)
9461   {
9462    Double_t dError = pow(f2pCorrelations->GetBinContent(5),2.)
9463                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
9464                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
9465                    + pow(f2pCorrelations->GetBinContent(1),2.)
9466                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9467                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9468                    + pow((pow(dSumWQuadraticFour5n1n5n1n,0.5)/dSumWLinearFour5n1n5n1n)
9469                    * dSpreadFour5n1n5n1n*pow(pow(dSumWLinearFour5n1n5n1n,2.)/(pow(dSumWLinearFour5n1n5n1n,2.)-dSumWQuadraticFour5n1n5n1n),0.5),2.)
9470                    + 2.*f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(1)
9471                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9472                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,5))
9473                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(5))
9474                    / (dSumWLinearTwo1n1n*dSumWLinearTwo5n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9475                    - 2.*f2pCorrelations->GetBinContent(5)
9476                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9477                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,28))
9478                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(14))
9479                    / (dSumWLinearTwo1n1n*dSumWLinearFour5n1n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9480                    - 2.*f2pCorrelations->GetBinContent(1)
9481                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9482                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,28))
9483                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(14))
9484                    / (dSumWLinearTwo5n5n*dSumWLinearFour5n1n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9485    if(dError>0.)
9486    {
9487     f4pCumulants->SetBinError(14,pow(dError,0.5)); 
9488    }
9489   } // end of if(...)
9490  } // end of {
9491  // <4>_{5n,2n|5n,2n}
9492  f4pCumulants->SetBinContent(15,f4pCorrelations->GetBinContent(15)-f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(2));
9493  {
9494   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
9495   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
9496   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
9497   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
9498   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
9499   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
9500   Double_t dSumWLinearFour5n2n5n2n = 0.; // sum of linear event weights for <4>
9501   Double_t dSumWQuadraticFour5n2n5n2n = 0.; // sum of quadratic event weights <4>
9502   Double_t dSpreadFour5n2n5n2n = 0.; // weighted and biased estimator for sigma of <4>
9503   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9504   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9505   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
9506   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9507   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9508   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9509   dSumWLinearFour5n2n5n2n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9510   dSumWQuadraticFour5n2n5n2n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9511   dSpreadFour5n2n5n2n = f4pCorrelations->GetBinError(15);
9512   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
9513      pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9514      pow(dSumWLinearFour5n2n5n2n,2.)>dSumWQuadraticFour5n2n5n2n)
9515   {
9516    Double_t dError = pow(f2pCorrelations->GetBinContent(5),2.)
9517                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
9518                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
9519                    + pow(f2pCorrelations->GetBinContent(2),2.)
9520                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9521                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9522                    + pow((pow(dSumWQuadraticFour5n2n5n2n,0.5)/dSumWLinearFour5n2n5n2n)
9523                    * dSpreadFour5n2n5n2n*pow(pow(dSumWLinearFour5n2n5n2n,2.)/(pow(dSumWLinearFour5n2n5n2n,2.)-dSumWQuadraticFour5n2n5n2n),0.5),2.)
9524                    + 2.*f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(2)
9525                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9526                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,5))
9527                    - f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(5))
9528                    / (dSumWLinearTwo2n2n*dSumWLinearTwo5n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9529                    - 2.*f2pCorrelations->GetBinContent(5)
9530                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9531                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,29))
9532                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(15))
9533                    / (dSumWLinearTwo2n2n*dSumWLinearFour5n2n5n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9534                    - 2.*f2pCorrelations->GetBinContent(2)
9535                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9536                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,29))
9537                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(15))
9538                    / (dSumWLinearTwo5n5n*dSumWLinearFour5n2n5n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9539    if(dError>0.)
9540    {
9541     f4pCumulants->SetBinError(15,pow(dError,0.5)); 
9542    }
9543   } // end of if(...)
9544  } // end of {
9545  // <4>_{5n,3n|5n,3n}
9546  f4pCumulants->SetBinContent(16,f4pCorrelations->GetBinContent(16)-f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(3));
9547  {
9548   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9549   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9550   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9551   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
9552   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
9553   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
9554   Double_t dSumWLinearFour5n3n5n3n = 0.; // sum of linear event weights for <4>
9555   Double_t dSumWQuadraticFour5n3n5n3n = 0.; // sum of quadratic event weights <4>
9556   Double_t dSpreadFour5n3n5n3n = 0.; // weighted and biased estimator for sigma of <4>
9557   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9558   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9559   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9560   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9561   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9562   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9563   dSumWLinearFour5n3n5n3n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9564   dSumWQuadraticFour5n3n5n3n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9565   dSpreadFour5n3n5n3n = f4pCorrelations->GetBinError(16);
9566   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9567      pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9568      pow(dSumWLinearFour5n3n5n3n,2.)>dSumWQuadraticFour5n3n5n3n)
9569   {
9570    Double_t dError = pow(f2pCorrelations->GetBinContent(5),2.)
9571                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9572                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9573                    + pow(f2pCorrelations->GetBinContent(3),2.)
9574                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9575                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9576                    + pow((pow(dSumWQuadraticFour5n3n5n3n,0.5)/dSumWLinearFour5n3n5n3n)
9577                    * dSpreadFour5n3n5n3n*pow(pow(dSumWLinearFour5n3n5n3n,2.)/(pow(dSumWLinearFour5n3n5n3n,2.)-dSumWQuadraticFour5n3n5n3n),0.5),2.)
9578                    + 2.*f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(3)
9579                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9580                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,5))
9581                    - f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(5))
9582                    / (dSumWLinearTwo3n3n*dSumWLinearTwo5n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9583                    - 2.*f2pCorrelations->GetBinContent(5)
9584                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9585                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,30))
9586                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(16))
9587                    / (dSumWLinearTwo3n3n*dSumWLinearFour5n3n5n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9588                    - 2.*f2pCorrelations->GetBinContent(3)
9589                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9590                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,30))
9591                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(16))
9592                    / (dSumWLinearTwo5n5n*dSumWLinearFour5n3n5n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9593    if(dError>0.)
9594    {
9595     f4pCumulants->SetBinError(16,pow(dError,0.5)); 
9596    }
9597   } // end of if(...)
9598  } // end of {
9599  // <4>_{5n,4n|5n,4n}
9600  f4pCumulants->SetBinContent(17,f4pCorrelations->GetBinContent(17)-f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(4));
9601  {
9602   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9603   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9604   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9605   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
9606   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
9607   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
9608   Double_t dSumWLinearFour5n4n5n4n = 0.; // sum of linear event weights for <4>
9609   Double_t dSumWQuadraticFour5n4n5n4n = 0.; // sum of quadratic event weights <4>
9610   Double_t dSpreadFour5n4n5n4n = 0.; // weighted and biased estimator for sigma of <4>
9611   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9612   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9613   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9614   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9615   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9616   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9617   dSumWLinearFour5n4n5n4n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9618   dSumWQuadraticFour5n4n5n4n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9619   dSpreadFour5n4n5n4n = f4pCorrelations->GetBinError(17);
9620   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9621      pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9622      pow(dSumWLinearFour5n4n5n4n,2.)>dSumWQuadraticFour5n4n5n4n)
9623   {
9624    Double_t dError = pow(f2pCorrelations->GetBinContent(5),2.)
9625                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9626                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9627                    + pow(f2pCorrelations->GetBinContent(4),2.)
9628                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9629                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9630                    + pow((pow(dSumWQuadraticFour5n4n5n4n,0.5)/dSumWLinearFour5n4n5n4n)
9631                    * dSpreadFour5n4n5n4n*pow(pow(dSumWLinearFour5n4n5n4n,2.)/(pow(dSumWLinearFour5n4n5n4n,2.)-dSumWQuadraticFour5n4n5n4n),0.5),2.)
9632                    + 2.*f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(4)
9633                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9634                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,5))
9635                    - f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(5))
9636                    / (dSumWLinearTwo4n4n*dSumWLinearTwo5n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9637                    - 2.*f2pCorrelations->GetBinContent(5)
9638                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9639                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,31))
9640                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(17))
9641                    / (dSumWLinearTwo4n4n*dSumWLinearFour5n4n5n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9642                    - 2.*f2pCorrelations->GetBinContent(4)
9643                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9644                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,31))
9645                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(17))
9646                    / (dSumWLinearTwo5n5n*dSumWLinearFour5n4n5n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9647    if(dError>0.)
9648    {
9649     f4pCumulants->SetBinError(17,pow(dError,0.5)); 
9650    }
9651   } // end of if(...)
9652  } // end of {
9653  // <4>_{6n,1n|6n,1n}
9654  f4pCumulants->SetBinContent(18,f4pCorrelations->GetBinContent(18)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(1));
9655  {
9656   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
9657   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
9658   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
9659   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9660   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9661   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9662   Double_t dSumWLinearFour6n1n6n1n = 0.; // sum of linear event weights for <4>
9663   Double_t dSumWQuadraticFour6n1n6n1n = 0.; // sum of quadratic event weights <4>
9664   Double_t dSpreadFour6n1n6n1n = 0.; // weighted and biased estimator for sigma of <4>
9665   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9666   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9667   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
9668   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9669   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9670   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9671   dSumWLinearFour6n1n6n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9672   dSumWQuadraticFour6n1n6n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9673   dSpreadFour6n1n6n1n = f4pCorrelations->GetBinError(18);
9674   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
9675      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9676      pow(dSumWLinearFour6n1n6n1n,2.)>dSumWQuadraticFour6n1n6n1n)
9677   {
9678    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9679                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
9680                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
9681                    + pow(f2pCorrelations->GetBinContent(1),2.)
9682                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9683                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9684                    + pow((pow(dSumWQuadraticFour6n1n6n1n,0.5)/dSumWLinearFour6n1n6n1n)
9685                    * dSpreadFour6n1n6n1n*pow(pow(dSumWLinearFour6n1n6n1n,2.)/(pow(dSumWLinearFour6n1n6n1n,2.)-dSumWQuadraticFour6n1n6n1n),0.5),2.)
9686                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(1)
9687                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9688                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,6))
9689                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(6))
9690                    / (dSumWLinearTwo1n1n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9691                    - 2.*f2pCorrelations->GetBinContent(6)
9692                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9693                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,32))
9694                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(18))
9695                    / (dSumWLinearTwo1n1n*dSumWLinearFour6n1n6n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9696                    - 2.*f2pCorrelations->GetBinContent(1)
9697                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9698                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,32))
9699                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(18))
9700                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n1n6n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9701    if(dError>0.)
9702    {
9703     f4pCumulants->SetBinError(18,pow(dError,0.5)); 
9704    }
9705   } // end of if(...)
9706  } // end of {
9707  // <4>_{6n,2n|6n,2n}
9708  f4pCumulants->SetBinContent(19,f4pCorrelations->GetBinContent(19)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(2));
9709  {
9710   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
9711   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
9712   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
9713   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9714   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9715   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9716   Double_t dSumWLinearFour6n2n6n2n = 0.; // sum of linear event weights for <4>
9717   Double_t dSumWQuadraticFour6n2n6n2n = 0.; // sum of quadratic event weights <4>
9718   Double_t dSpreadFour6n2n6n2n = 0.; // weighted and biased estimator for sigma of <4>
9719   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9720   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9721   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
9722   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9723   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9724   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9725   dSumWLinearFour6n2n6n2n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9726   dSumWQuadraticFour6n2n6n2n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9727   dSpreadFour6n2n6n2n = f4pCorrelations->GetBinError(19);
9728   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
9729      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9730      pow(dSumWLinearFour6n2n6n2n,2.)>dSumWQuadraticFour6n2n6n2n)
9731   {
9732    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9733                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
9734                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
9735                    + pow(f2pCorrelations->GetBinContent(2),2.)
9736                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9737                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9738                    + pow((pow(dSumWQuadraticFour6n2n6n2n,0.5)/dSumWLinearFour6n2n6n2n)
9739                    * dSpreadFour6n2n6n2n*pow(pow(dSumWLinearFour6n2n6n2n,2.)/(pow(dSumWLinearFour6n2n6n2n,2.)-dSumWQuadraticFour6n2n6n2n),0.5),2.)
9740                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(2)
9741                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9742                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,6))
9743                    - f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(6))
9744                    / (dSumWLinearTwo2n2n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9745                    - 2.*f2pCorrelations->GetBinContent(6)
9746                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9747                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,33))
9748                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(19))
9749                    / (dSumWLinearTwo2n2n*dSumWLinearFour6n2n6n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9750                    - 2.*f2pCorrelations->GetBinContent(2)
9751                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9752                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,33))
9753                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(19))
9754                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n2n6n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9755    if(dError>0.)
9756    {
9757     f4pCumulants->SetBinError(19,pow(dError,0.5)); 
9758    }
9759   } // end of if(...)
9760  } // end of {
9761  // <4>_{6n,3n|6n,3n}
9762  f4pCumulants->SetBinContent(20,f4pCorrelations->GetBinContent(20)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(3));
9763  {
9764   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9765   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9766   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9767   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9768   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9769   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9770   Double_t dSumWLinearFour6n3n6n3n = 0.; // sum of linear event weights for <4>
9771   Double_t dSumWQuadraticFour6n3n6n3n = 0.; // sum of quadratic event weights <4>
9772   Double_t dSpreadFour6n3n6n3n = 0.; // weighted and biased estimator for sigma of <4>
9773   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9774   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9775   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9776   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9777   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9778   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9779   dSumWLinearFour6n3n6n3n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9780   dSumWQuadraticFour6n3n6n3n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9781   dSpreadFour6n3n6n3n = f4pCorrelations->GetBinError(20);
9782   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9783      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9784      pow(dSumWLinearFour6n3n6n3n,2.)>dSumWQuadraticFour6n3n6n3n)
9785   {
9786    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9787                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9788                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9789                    + pow(f2pCorrelations->GetBinContent(3),2.)
9790                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9791                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9792                    + pow((pow(dSumWQuadraticFour6n3n6n3n,0.5)/dSumWLinearFour6n3n6n3n)
9793                    * dSpreadFour6n3n6n3n*pow(pow(dSumWLinearFour6n3n6n3n,2.)/(pow(dSumWLinearFour6n3n6n3n,2.)-dSumWQuadraticFour6n3n6n3n),0.5),2.)
9794                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(3)
9795                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9796                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,6))
9797                    - f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(6))
9798                    / (dSumWLinearTwo3n3n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9799                    - 2.*f2pCorrelations->GetBinContent(6)
9800                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9801                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,34))
9802                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(20))
9803                    / (dSumWLinearTwo3n3n*dSumWLinearFour6n3n6n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9804                    - 2.*f2pCorrelations->GetBinContent(3)
9805                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9806                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,34))
9807                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(20))
9808                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n3n6n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9809    if(dError>0.)
9810    {
9811     f4pCumulants->SetBinError(20,pow(dError,0.5)); 
9812    }
9813   } // end of if(...)
9814  } // end of {
9815  // <4>_{6n,4n|6n,4n}
9816  f4pCumulants->SetBinContent(21,f4pCorrelations->GetBinContent(21)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(4));
9817  {
9818   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9819   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9820   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9821   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9822   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9823   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9824   Double_t dSumWLinearFour6n4n6n4n = 0.; // sum of linear event weights for <4>
9825   Double_t dSumWQuadraticFour6n4n6n4n = 0.; // sum of quadratic event weights <4>
9826   Double_t dSpreadFour6n4n6n4n = 0.; // weighted and biased estimator for sigma of <4>
9827   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9828   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9829   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9830   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9831   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9832   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9833   dSumWLinearFour6n4n6n4n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9834   dSumWQuadraticFour6n4n6n4n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9835   dSpreadFour6n4n6n4n = f4pCorrelations->GetBinError(21);
9836   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9837      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9838      pow(dSumWLinearFour6n4n6n4n,2.)>dSumWQuadraticFour6n4n6n4n)
9839   {
9840    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9841                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9842                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9843                    + pow(f2pCorrelations->GetBinContent(4),2.)
9844                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9845                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9846                    + pow((pow(dSumWQuadraticFour6n4n6n4n,0.5)/dSumWLinearFour6n4n6n4n)
9847                    * dSpreadFour6n4n6n4n*pow(pow(dSumWLinearFour6n4n6n4n,2.)/(pow(dSumWLinearFour6n4n6n4n,2.)-dSumWQuadraticFour6n4n6n4n),0.5),2.)
9848                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(4)
9849                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9850                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,6))
9851                    - f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(6))
9852                    / (dSumWLinearTwo4n4n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9853                    - 2.*f2pCorrelations->GetBinContent(6)
9854                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9855                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,35))
9856                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(21))
9857                    / (dSumWLinearTwo4n4n*dSumWLinearFour6n4n6n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9858                    - 2.*f2pCorrelations->GetBinContent(4)
9859                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9860                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,35))
9861                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(21))
9862                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n4n6n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9863    if(dError>0.)
9864    {
9865     f4pCumulants->SetBinError(21,pow(dError,0.5)); 
9866    }
9867   } // end of if(...)
9868  } // end of {
9869  // <4>_{6n,5n|6n,5n}
9870  f4pCumulants->SetBinContent(22,f4pCorrelations->GetBinContent(22)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(5));
9871  {
9872   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
9873   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
9874   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
9875   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9876   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9877   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9878   Double_t dSumWLinearFour6n5n6n5n = 0.; // sum of linear event weights for <4>
9879   Double_t dSumWQuadraticFour6n5n6n5n = 0.; // sum of quadratic event weights <4>
9880   Double_t dSpreadFour6n5n6n5n = 0.; // weighted and biased estimator for sigma of <4>
9881   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9882   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9883   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9884   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9885   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9886   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9887   dSumWLinearFour6n5n6n5n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9888   dSumWQuadraticFour6n5n6n5n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9889   dSpreadFour6n5n6n5n = f4pCorrelations->GetBinError(22);
9890   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9891      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9892      pow(dSumWLinearFour6n5n6n5n,2.)>dSumWQuadraticFour6n5n6n5n)
9893   {
9894    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9895                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9896                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9897                    + pow(f2pCorrelations->GetBinContent(5),2.)
9898                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9899                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9900                    + pow((pow(dSumWQuadraticFour6n5n6n5n,0.5)/dSumWLinearFour6n5n6n5n)
9901                    * dSpreadFour6n5n6n5n*pow(pow(dSumWLinearFour6n5n6n5n,2.)/(pow(dSumWLinearFour6n5n6n5n,2.)-dSumWQuadraticFour6n5n6n5n),0.5),2.)
9902                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(5)
9903                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9904                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,6))
9905                    - f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(6))
9906                    / (dSumWLinearTwo5n5n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9907                    - 2.*f2pCorrelations->GetBinContent(6)
9908                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9909                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,36))
9910                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(22))
9911                    / (dSumWLinearTwo5n5n*dSumWLinearFour6n5n6n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9912                    - 2.*f2pCorrelations->GetBinContent(5)
9913                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9914                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,36))
9915                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(22))
9916                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n5n6n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9917    if(dError>0.)
9918    {
9919     f4pCumulants->SetBinError(22,pow(dError,0.5)); 
9920    }
9921   } // end of if(...)
9922  } // end of {
9923
9924  // c3) "Two distinct harmonics":
9925  for(Int_t b=24;b<=25;b++)
9926  {
9927   f4pCumulants->SetBinContent(b,f4pCorrelations->GetBinContent(b));
9928   Double_t dSumWLinear = 0.; // sum of linear event weights
9929   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
9930   Double_t dSpread = 0.; // weighted and biased estimator for sigma
9931   Double_t dError = 0.; // weighted and unbiased estimator for sigma
9932   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9933   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9934   dSpread = f4pCorrelations->GetBinError(b);
9935   if(pow(dSumWLinear,2.)>dSumWQuadratic)
9936   {
9937    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
9938    f4pCumulants->SetBinError(b,dError); 
9939   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
9940  } // end of for(Int_t b=24;b<=25;b++)
9941  // c4) "Three distinct harmonics":
9942  for(Int_t b=27;b<=36;b++)
9943  {
9944   f4pCumulants->SetBinContent(b,f4pCorrelations->GetBinContent(b));
9945   Double_t dSumWLinear = 0.; // sum of linear event weights
9946   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
9947   Double_t dSpread = 0.; // weighted and biased estimator for sigma
9948   Double_t dError = 0.; // weighted and unbiased estimator for sigma
9949   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9950   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9951   dSpread = f4pCorrelations->GetBinError(b);
9952   if(pow(dSumWLinear,2.)>dSumWQuadratic)
9953   {
9954    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
9955    f4pCumulants->SetBinError(b,dError); 
9956   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
9957  } // end of for(Int_t b=27;b<=36;b++)
9958  // c5) "Four distinct harmonics":
9959  for(Int_t b=38;b<=45;b++)
9960  {
9961   f4pCumulants->SetBinContent(b,f4pCorrelations->GetBinContent(b));
9962   Double_t dSumWLinear = 0.; // sum of linear event weights
9963   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
9964   Double_t dSpread = 0.; // weighted and biased estimator for sigma
9965   Double_t dError = 0.; // weighted and unbiased estimator for sigma
9966   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9967   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9968   dSpread = f4pCorrelations->GetBinError(b);
9969   if(pow(dSumWLinear,2.)>dSumWQuadratic)
9970   {
9971    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
9972    f4pCumulants->SetBinError(b,dError); 
9973   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
9974  } // end of for(Int_t b=38;b<=45;b++)
9975
9976  // d) Calculate 5-p cumulants: 
9977  // d1) "Standard candles":
9978  f5pCumulants->SetBinContent(1,f5pCorrelations->GetBinContent(1)-f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(3));
9979  {
9980   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9981   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9982   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9983   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
9984   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
9985   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
9986   Double_t dSumWLinearFive3n2n3n1n1n = 0.; // sum of linear event weights for <4>
9987   Double_t dSumWQuadraticFive3n2n3n1n1n = 0.; // sum of quadratic event weights <4>
9988   Double_t dSpreadFive3n2n3n1n1n = 0.; // weighted and biased estimator for sigma of <4>
9989   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9990   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9991   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9992   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9993   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9994   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
9995   dSumWLinearFive3n2n3n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
9996   dSumWQuadraticFive3n2n3n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
9997   dSpreadFive3n2n3n1n1n = f5pCorrelations->GetBinError(1);
9998   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9999      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
10000      pow(dSumWLinearFive3n2n3n1n1n,2.)>dSumWQuadraticFive3n2n3n1n1n)
10001   {
10002    Double_t dError = pow(f3pCorrelations->GetBinContent(1),2.)
10003                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
10004                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
10005                    + pow(f2pCorrelations->GetBinContent(3),2.)
10006                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
10007                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
10008                    + pow((pow(dSumWQuadraticFive3n2n3n1n1n,0.5)/dSumWLinearFive3n2n3n1n1n)
10009                    * dSpreadFive3n2n3n1n1n*pow(pow(dSumWLinearFive3n2n3n1n1n,2.)/(pow(dSumWLinearFive3n2n3n1n1n,2.)-dSumWQuadraticFive3n2n3n1n1n),0.5),2.)
10010                    + 2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(3)
10011                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3))
10012                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,7))
10013                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(1))
10014                    / (dSumWLinearTwo3n3n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10015                    - 2.*f3pCorrelations->GetBinContent(1)
10016                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5))
10017                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,57))
10018                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(1))
10019                    / (dSumWLinearTwo3n3n*dSumWLinearFive3n2n3n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10020                    - 2.*f2pCorrelations->GetBinContent(3)
10021                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5))
10022                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,57))
10023                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(1))
10024                    / (dSumWLinearThree2n1n1n*dSumWLinearFive3n2n3n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10025    if(dError>0.)
10026    {
10027     f5pCumulants->SetBinError(1,pow(dError,0.5)); 
10028    }
10029   } // end of if(...)
10030  } // end of {
10031
10032  f5pCumulants->SetBinContent(2,f5pCorrelations->GetBinContent(2)-f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(1));
10033  {
10034   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
10035   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
10036   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
10037   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
10038   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
10039   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
10040   Double_t dSumWLinearFive4n1n2n2n1n = 0.; // sum of linear event weights for <4>
10041   Double_t dSumWQuadraticFive4n1n2n2n1n = 0.; // sum of quadratic event weights <4>
10042   Double_t dSpreadFive4n1n2n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10043   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10044   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10045   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
10046   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10047   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10048   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
10049   dSumWLinearFive4n1n2n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10050   dSumWQuadraticFive4n1n2n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10051   dSpreadFive4n1n2n2n1n = f5pCorrelations->GetBinError(2);
10052   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
10053      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
10054      pow(dSumWLinearFive4n1n2n2n1n,2.)>dSumWQuadraticFive4n1n2n2n1n)
10055   {
10056    Double_t dError = pow(f3pCorrelations->GetBinContent(2),2.)
10057                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
10058                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
10059                    + pow(f2pCorrelations->GetBinContent(1),2.)
10060                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
10061                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
10062                    + pow((pow(dSumWQuadraticFive4n1n2n2n1n,0.5)/dSumWLinearFive4n1n2n2n1n)
10063                    * dSpreadFive4n1n2n2n1n*pow(pow(dSumWLinearFive4n1n2n2n1n,2.)/(pow(dSumWLinearFive4n1n2n2n1n,2.)-dSumWQuadraticFive4n1n2n2n1n),0.5),2.)
10064                    + 2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(1)
10065                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3))
10066                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,8))
10067                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(2))
10068                    / (dSumWLinearTwo1n1n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10069                    - 2.*f3pCorrelations->GetBinContent(2)
10070                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5))
10071                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,58))
10072                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(2))
10073                    / (dSumWLinearTwo1n1n*dSumWLinearFive4n1n2n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10074                    - 2.*f2pCorrelations->GetBinContent(1)
10075                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5))
10076                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,58))
10077                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(2))
10078                    / (dSumWLinearThree4n2n2n*dSumWLinearFive4n1n2n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10079    if(dError>0.)
10080    {
10081     f5pCumulants->SetBinError(2,pow(dError,0.5)); 
10082    }
10083   } // end of if(...)
10084  } // end of {
10085  f5pCumulants->SetBinContent(3,f5pCorrelations->GetBinContent(3)-f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(2));
10086  {
10087   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
10088   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
10089   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
10090   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
10091   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
10092   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
10093   Double_t dSumWLinearFive4n2n3n2n1n = 0.; // sum of linear event weights for <4>
10094   Double_t dSumWQuadraticFive4n2n3n2n1n = 0.; // sum of quadratic event weights <4>
10095   Double_t dSpreadFive4n2n3n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10096   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10097   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10098   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
10099   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10100   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10101   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
10102   dSumWLinearFive4n2n3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10103   dSumWQuadraticFive4n2n3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10104   dSpreadFive4n2n3n2n1n = f5pCorrelations->GetBinError(3);
10105   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
10106      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
10107      pow(dSumWLinearFive4n2n3n2n1n,2.)>dSumWQuadraticFive4n2n3n2n1n)
10108   {
10109    Double_t dError = pow(f3pCorrelations->GetBinContent(6),2.)
10110                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
10111                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
10112                    + pow(f2pCorrelations->GetBinContent(2),2.)
10113                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
10114                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
10115                    + pow((pow(dSumWQuadraticFive4n2n3n2n1n,0.5)/dSumWLinearFive4n2n3n2n1n)
10116                    * dSpreadFive4n2n3n2n1n*pow(pow(dSumWLinearFive4n2n3n2n1n,2.)/(pow(dSumWLinearFive4n2n3n2n1n,2.)-dSumWQuadraticFive4n2n3n2n1n),0.5),2.)
10117                    + 2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(2)
10118                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3))
10119                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,11))
10120                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(6))
10121                    / (dSumWLinearTwo2n2n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10122                    - 2.*f3pCorrelations->GetBinContent(6)
10123                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5))
10124                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,59))
10125                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(3))
10126                    / (dSumWLinearTwo2n2n*dSumWLinearFive4n2n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10127                    - 2.*f2pCorrelations->GetBinContent(2)
10128                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5))
10129                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,59))
10130                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(3))
10131                    / (dSumWLinearThree4n3n1n*dSumWLinearFive4n2n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10132    if(dError>0.)
10133    {
10134     f5pCumulants->SetBinError(3,pow(dError,0.5)); 
10135    }
10136   } // end of if(...)
10137  } // end of {
10138  f5pCumulants->SetBinContent(4,f5pCorrelations->GetBinContent(4)-f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(3));
10139  {
10140   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
10141   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
10142   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
10143   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
10144   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
10145   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
10146   Double_t dSumWLinearFive4n3n3n2n2n = 0.; // sum of linear event weights for <4>
10147   Double_t dSumWQuadraticFive4n3n3n2n2n = 0.; // sum of quadratic event weights <4>
10148   Double_t dSpreadFive4n3n3n2n2n = 0.; // weighted and biased estimator for sigma of <4>
10149   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10150   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10151   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
10152   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10153   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10154   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
10155   dSumWLinearFive4n3n3n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10156   dSumWQuadraticFive4n3n3n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10157   dSpreadFive4n3n3n2n2n = f5pCorrelations->GetBinError(4);
10158   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
10159      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
10160      pow(dSumWLinearFive4n3n3n2n2n,2.)>dSumWQuadraticFive4n3n3n2n2n)
10161   {
10162    Double_t dError = pow(f3pCorrelations->GetBinContent(2),2.)
10163                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
10164                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
10165                    + pow(f2pCorrelations->GetBinContent(3),2.)
10166                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
10167                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
10168                    + pow((pow(dSumWQuadraticFive4n3n3n2n2n,0.5)/dSumWLinearFive4n3n3n2n2n)
10169                    * dSpreadFive4n3n3n2n2n*pow(pow(dSumWLinearFive4n3n3n2n2n,2.)/(pow(dSumWLinearFive4n3n3n2n2n,2.)-dSumWQuadraticFive4n3n3n2n2n),0.5),2.)
10170                    + 2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(3)
10171                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3))
10172                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,8))
10173                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(2))
10174                    / (dSumWLinearTwo3n3n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10175                    - 2.*f3pCorrelations->GetBinContent(2)
10176                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5))
10177                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,60))
10178                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(4))
10179                    / (dSumWLinearTwo3n3n*dSumWLinearFive4n3n3n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10180                    - 2.*f2pCorrelations->GetBinContent(3)
10181                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5))
10182                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,60))
10183                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(4))
10184                    / (dSumWLinearThree4n2n2n*dSumWLinearFive4n3n3n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10185    if(dError>0.)
10186    {
10187     f5pCumulants->SetBinError(4,pow(dError,0.5)); 
10188    }
10189   } // end of if(...)
10190  } // end of {
10191  f5pCumulants->SetBinContent(5,f5pCorrelations->GetBinContent(5)-f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(4));
10192  {
10193   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
10194   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
10195   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
10196   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
10197   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
10198   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
10199   Double_t dSumWLinearFive4n2n4n1n1n = 0.; // sum of linear event weights for <4>
10200   Double_t dSumWQuadraticFive4n2n4n1n1n = 0.; // sum of quadratic event weights <4>
10201   Double_t dSpreadFive4n2n4n1n1n = 0.; // weighted and biased estimator for sigma of <4>
10202   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10203   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10204   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
10205   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10206   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10207   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
10208   dSumWLinearFive4n2n4n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10209   dSumWQuadraticFive4n2n4n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10210   dSpreadFive4n2n4n1n1n = f5pCorrelations->GetBinError(5);
10211   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
10212      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
10213      pow(dSumWLinearFive4n2n4n1n1n,2.)>dSumWQuadraticFive4n2n4n1n1n)
10214   {
10215    Double_t dError = pow(f3pCorrelations->GetBinContent(1),2.)
10216                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
10217                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
10218                    + pow(f2pCorrelations->GetBinContent(4),2.)
10219                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
10220                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
10221                    + pow((pow(dSumWQuadraticFive4n2n4n1n1n,0.5)/dSumWLinearFive4n2n4n1n1n)
10222                    * dSpreadFive4n2n4n1n1n*pow(pow(dSumWLinearFive4n2n4n1n1n,2.)/(pow(dSumWLinearFive4n2n4n1n1n,2.)-dSumWQuadraticFive4n2n4n1n1n),0.5),2.)
10223                    + 2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(4)
10224                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10225                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,7)) 
10226                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(1))
10227                    / (dSumWLinearTwo4n4n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10228                    - 2.*f3pCorrelations->GetBinContent(1)
10229                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10230                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,61))
10231                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(5))
10232                    / (dSumWLinearTwo4n4n*dSumWLinearFive4n2n4n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10233                    - 2.*f2pCorrelations->GetBinContent(4)
10234                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10235                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,61))
10236                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(5))
10237                    / (dSumWLinearThree2n1n1n*dSumWLinearFive4n2n4n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10238    if(dError>0.)
10239    {
10240     f5pCumulants->SetBinError(5,pow(dError,0.5)); 
10241    }
10242   } // end of if(...)
10243  } // end of {
10244  f5pCumulants->SetBinContent(6,f5pCorrelations->GetBinContent(6)-f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(4));
10245  {
10246   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
10247   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
10248   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
10249   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
10250   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
10251   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
10252   Double_t dSumWLinearFive4n3n4n2n1n = 0.; // sum of linear event weights for <4>
10253   Double_t dSumWQuadraticFive4n3n4n2n1n = 0.; // sum of quadratic event weights <4>
10254   Double_t dSpreadFive4n3n4n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10255   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10256   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10257   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
10258   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10259   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10260   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
10261   dSumWLinearFive4n3n4n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10262   dSumWQuadraticFive4n3n4n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10263   dSpreadFive4n3n4n2n1n = f5pCorrelations->GetBinError(6);
10264   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
10265      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
10266      pow(dSumWLinearFive4n3n4n2n1n,2.)>dSumWQuadraticFive4n3n4n2n1n)
10267   {
10268    Double_t dError = pow(f3pCorrelations->GetBinContent(5),2.)
10269                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
10270                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
10271                    + pow(f2pCorrelations->GetBinContent(4),2.)
10272                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
10273                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
10274                    + pow((pow(dSumWQuadraticFive4n3n4n2n1n,0.5)/dSumWLinearFive4n3n4n2n1n)
10275                    * dSpreadFive4n3n4n2n1n*pow(pow(dSumWLinearFive4n3n4n2n1n,2.)/(pow(dSumWLinearFive4n3n4n2n1n,2.)-dSumWQuadraticFive4n3n4n2n1n),0.5),2.)
10276                    + 2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(4)
10277                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10278                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,10)) 
10279                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(5))
10280                    / (dSumWLinearTwo4n4n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10281                    - 2.*f3pCorrelations->GetBinContent(5)
10282                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10283                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,62))
10284                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(6))
10285                    / (dSumWLinearTwo4n4n*dSumWLinearFive4n3n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10286                    - 2.*f2pCorrelations->GetBinContent(4)
10287                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10288                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,62))
10289                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(6))
10290                    / (dSumWLinearThree3n2n1n*dSumWLinearFive4n3n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10291    if(dError>0.)
10292    {
10293     f5pCumulants->SetBinError(6,pow(dError,0.5)); 
10294    }
10295   } // end of if(...)
10296  } // end of {
10297  f5pCumulants->SetBinContent(7,f5pCorrelations->GetBinContent(7)-f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(1));
10298  {
10299   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
10300   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
10301   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
10302   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
10303   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
10304   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
10305   Double_t dSumWLinearFive5n1n3n2n1n = 0.; // sum of linear event weights for <4>
10306   Double_t dSumWQuadraticFive5n1n3n2n1n = 0.; // sum of quadratic event weights <4>
10307   Double_t dSpreadFive5n1n3n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10308   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10309   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10310   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
10311   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10312   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10313   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
10314   dSumWLinearFive5n1n3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10315   dSumWQuadraticFive5n1n3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10316   dSpreadFive5n1n3n2n1n = f5pCorrelations->GetBinError(7);
10317   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
10318      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
10319      pow(dSumWLinearFive5n1n3n2n1n,2.)>dSumWQuadraticFive5n1n3n2n1n)
10320   {
10321    Double_t dError = pow(f3pCorrelations->GetBinContent(7),2.)
10322                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
10323                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
10324                    + pow(f2pCorrelations->GetBinContent(1),2.)
10325                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
10326                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
10327                    + pow((pow(dSumWQuadraticFive5n1n3n2n1n,0.5)/dSumWLinearFive5n1n3n2n1n)
10328                    * dSpreadFive5n1n3n2n1n*pow(pow(dSumWLinearFive5n1n3n2n1n,2.)/(pow(dSumWLinearFive5n1n3n2n1n,2.)-dSumWQuadraticFive5n1n3n2n1n),0.5),2.)
10329                    + 2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(1)
10330                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10331                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,12)) 
10332                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(7))
10333                    / (dSumWLinearTwo1n1n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10334                    - 2.*f3pCorrelations->GetBinContent(7)
10335                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10336                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,63))
10337                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(7))
10338                    / (dSumWLinearTwo1n1n*dSumWLinearFive5n1n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10339                    - 2.*f2pCorrelations->GetBinContent(1)
10340                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10341                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,63))
10342                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(7))
10343                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n1n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10344    if(dError>0.)
10345    {
10346     f5pCumulants->SetBinError(7,pow(dError,0.5)); 
10347    }
10348   } // end of if(...)
10349  } // end of {
10350  f5pCumulants->SetBinContent(8,f5pCorrelations->GetBinContent(8)-f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(5));
10351  {
10352   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
10353   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
10354   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
10355   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
10356   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
10357   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
10358   Double_t dSumWLinearFive5n2n5n1n1n = 0.; // sum of linear event weights for <4>
10359   Double_t dSumWQuadraticFive5n2n5n1n1n = 0.; // sum of quadratic event weights <4>
10360   Double_t dSpreadFive5n2n5n1n1n = 0.; // weighted and biased estimator for sigma of <4>
10361   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10362   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10363   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
10364   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10365   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10366   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
10367   dSumWLinearFive5n2n5n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10368   dSumWQuadraticFive5n2n5n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10369   dSpreadFive5n2n5n1n1n = f5pCorrelations->GetBinError(8);
10370   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
10371      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
10372      pow(dSumWLinearFive5n2n5n1n1n,2.)>dSumWQuadraticFive5n2n5n1n1n)
10373   {
10374    Double_t dError = pow(f3pCorrelations->GetBinContent(1),2.)
10375                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
10376                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
10377                    + pow(f2pCorrelations->GetBinContent(5),2.)
10378                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
10379                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
10380                    + pow((pow(dSumWQuadraticFive5n2n5n1n1n,0.5)/dSumWLinearFive5n2n5n1n1n)
10381                    * dSpreadFive5n2n5n1n1n*pow(pow(dSumWLinearFive5n2n5n1n1n,2.)/(pow(dSumWLinearFive5n2n5n1n1n,2.)-dSumWQuadraticFive5n2n5n1n1n),0.5),2.)
10382                    + 2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(5)
10383                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10384                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,7)) 
10385                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(1))
10386                    / (dSumWLinearTwo5n5n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10387                    - 2.*f3pCorrelations->GetBinContent(1)
10388                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10389                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,64))
10390                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(8))
10391                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n2n5n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10392                    - 2.*f2pCorrelations->GetBinContent(5)
10393                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10394                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,64))
10395                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(8))
10396                    / (dSumWLinearThree2n1n1n*dSumWLinearFive5n2n5n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10397    if(dError>0.)
10398    {
10399     f5pCumulants->SetBinError(8,pow(dError,0.5)); 
10400    }
10401   } // end of if(...)
10402  } // end of {
10403  f5pCumulants->SetBinContent(9,f5pCorrelations->GetBinContent(9)-f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(2));
10404  {
10405   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
10406   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
10407   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
10408   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
10409   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
10410   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
10411   Double_t dSumWLinearFive5n2n4n2n1n = 0.; // sum of linear event weights for <4>
10412   Double_t dSumWQuadraticFive5n2n4n2n1n = 0.; // sum of quadratic event weights <4>
10413   Double_t dSpreadFive5n2n4n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10414   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10415   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10416   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
10417   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10418   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10419   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
10420   dSumWLinearFive5n2n4n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10421   dSumWQuadraticFive5n2n4n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10422   dSpreadFive5n2n4n2n1n = f5pCorrelations->GetBinError(9);
10423   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
10424      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
10425      pow(dSumWLinearFive5n2n4n2n1n,2.)>dSumWQuadraticFive5n2n4n2n1n)
10426   {
10427    Double_t dError = pow(f3pCorrelations->GetBinContent(8),2.)
10428                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
10429                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
10430                    + pow(f2pCorrelations->GetBinContent(2),2.)
10431                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
10432                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
10433                    + pow((pow(dSumWQuadraticFive5n2n4n2n1n,0.5)/dSumWLinearFive5n2n4n2n1n)
10434                    * dSpreadFive5n2n4n2n1n*pow(pow(dSumWLinearFive5n2n4n2n1n,2.)/(pow(dSumWLinearFive5n2n4n2n1n,2.)-dSumWQuadraticFive5n2n4n2n1n),0.5),2.)
10435                    + 2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(2)
10436                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10437                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,13)) 
10438                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(8))
10439                    / (dSumWLinearTwo2n2n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10440                    - 2.*f3pCorrelations->GetBinContent(8)
10441                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10442                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,65))
10443                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(9))
10444                    / (dSumWLinearTwo2n2n*dSumWLinearFive5n2n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10445                    - 2.*f2pCorrelations->GetBinContent(2)
10446                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10447                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,65))
10448                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(9))
10449                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n2n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10450    if(dError>0.)
10451    {
10452     f5pCumulants->SetBinError(9,pow(dError,0.5)); 
10453    }
10454   } // end of if(...)
10455  } // end of {
10456  f5pCumulants->SetBinContent(10,f5pCorrelations->GetBinContent(10)-f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(3));
10457  {
10458   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
10459   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
10460   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
10461   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
10462   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
10463   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
10464   Double_t dSumWLinearFive5n3n4n3n1n = 0.; // sum of linear event weights for <4>
10465   Double_t dSumWQuadraticFive5n3n4n3n1n = 0.; // sum of quadratic event weights <4>
10466   Double_t dSpreadFive5n3n4n3n1n = 0.; // weighted and biased estimator for sigma of <4>
10467   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10468   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10469   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
10470   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10471   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10472   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
10473   dSumWLinearFive5n3n4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10474   dSumWQuadraticFive5n3n4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10475   dSpreadFive5n3n4n3n1n = f5pCorrelations->GetBinError(10);
10476   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
10477      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
10478      pow(dSumWLinearFive5n3n4n3n1n,2.)>dSumWQuadraticFive5n3n4n3n1n)
10479   {
10480    Double_t dError = pow(f3pCorrelations->GetBinContent(8),2.)
10481                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
10482                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
10483                    + pow(f2pCorrelations->GetBinContent(3),2.)
10484                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
10485                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
10486                    + pow((pow(dSumWQuadraticFive5n3n4n3n1n,0.5)/dSumWLinearFive5n3n4n3n1n)
10487                    * dSpreadFive5n3n4n3n1n*pow(pow(dSumWLinearFive5n3n4n3n1n,2.)/(pow(dSumWLinearFive5n3n4n3n1n,2.)-dSumWQuadraticFive5n3n4n3n1n),0.5),2.)
10488                    + 2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(3)
10489                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10490                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,13)) 
10491                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(8))
10492                    / (dSumWLinearTwo3n3n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10493                    - 2.*f3pCorrelations->GetBinContent(8)
10494                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10495                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,66))
10496                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(10))
10497                    / (dSumWLinearTwo3n3n*dSumWLinearFive5n3n4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10498                    - 2.*f2pCorrelations->GetBinContent(3)
10499                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10500                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,66))
10501                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(10))
10502                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n3n4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10503    if(dError>0.)
10504    {
10505     f5pCumulants->SetBinError(10,pow(dError,0.5)); 
10506    }
10507   } // end of if(...)
10508  } // end of {
10509  f5pCumulants->SetBinContent(11,f5pCorrelations->GetBinContent(11)-f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(4));
10510  {
10511   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
10512   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
10513   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
10514   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
10515   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
10516   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
10517   Double_t dSumWLinearFive5n4n4n3n2n = 0.; // sum of linear event weights for <4>
10518   Double_t dSumWQuadraticFive5n4n4n3n2n = 0.; // sum of quadratic event weights <4>
10519   Double_t dSpreadFive5n4n4n3n2n = 0.; // weighted and biased estimator for sigma of <4>
10520   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10521   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10522   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
10523   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10524   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10525   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
10526   dSumWLinearFive5n4n4n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10527   dSumWQuadraticFive5n4n4n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10528   dSpreadFive5n4n4n3n2n = f5pCorrelations->GetBinError(11);
10529   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
10530      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
10531      pow(dSumWLinearFive5n4n4n3n2n,2.)>dSumWQuadraticFive5n4n4n3n2n)
10532   {
10533    Double_t dError = pow(f3pCorrelations->GetBinContent(7),2.)
10534                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
10535                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
10536                    + pow(f2pCorrelations->GetBinContent(4),2.)
10537                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
10538                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
10539                    + pow((pow(dSumWQuadraticFive5n4n4n3n2n,0.5)/dSumWLinearFive5n4n4n3n2n)
10540                    * dSpreadFive5n4n4n3n2n*pow(pow(dSumWLinearFive5n4n4n3n2n,2.)/(pow(dSumWLinearFive5n4n4n3n2n,2.)-dSumWQuadraticFive5n4n4n3n2n),0.5),2.)
10541                    + 2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(4)
10542                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10543                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,12)) 
10544                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(7))
10545                    / (dSumWLinearTwo4n4n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10546                    - 2.*f3pCorrelations->GetBinContent(7)
10547                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10548                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,67))
10549                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(11))
10550                    / (dSumWLinearTwo4n4n*dSumWLinearFive5n4n4n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10551                    - 2.*f2pCorrelations->GetBinContent(4)
10552                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10553                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,67))
10554                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(11))
10555                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n4n4n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10556    if(dError>0.)
10557    {
10558     f5pCumulants->SetBinError(11,pow(dError,0.5)); 
10559    }
10560   } // end of if(...)
10561  } // end of {
10562  f5pCumulants->SetBinContent(12,f5pCorrelations->GetBinContent(12)-f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(5));
10563  {
10564   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
10565   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
10566   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
10567   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
10568   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
10569   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
10570   Double_t dSumWLinearFive5n3n5n2n1n = 0.; // sum of linear event weights for <4>
10571   Double_t dSumWQuadraticFive5n3n5n2n1n = 0.; // sum of quadratic event weights <4>
10572   Double_t dSpreadFive5n3n5n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10573   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10574   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10575   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
10576   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10577   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10578   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
10579   dSumWLinearFive5n3n5n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10580   dSumWQuadraticFive5n3n5n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10581   dSpreadFive5n3n5n2n1n = f5pCorrelations->GetBinError(12);
10582   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
10583      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
10584      pow(dSumWLinearFive5n3n5n2n1n,2.)>dSumWQuadraticFive5n3n5n2n1n)
10585   {
10586    Double_t dError = pow(f3pCorrelations->GetBinContent(5),2.)
10587                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
10588                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
10589                    + pow(f2pCorrelations->GetBinContent(5),2.)
10590                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
10591                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
10592                    + pow((pow(dSumWQuadraticFive5n3n5n2n1n,0.5)/dSumWLinearFive5n3n5n2n1n)
10593                    * dSpreadFive5n3n5n2n1n*pow(pow(dSumWLinearFive5n3n5n2n1n,2.)/(pow(dSumWLinearFive5n3n5n2n1n,2.)-dSumWQuadraticFive5n3n5n2n1n),0.5),2.)
10594                    + 2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(5)
10595                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10596                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,10)) 
10597                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(5))
10598                    / (dSumWLinearTwo5n5n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10599                    - 2.*f3pCorrelations->GetBinContent(5)
10600                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10601                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,68))
10602                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(12))
10603                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n3n5n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10604                    - 2.*f2pCorrelations->GetBinContent(5)
10605                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10606                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,68))
10607                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(12))
10608                    / (dSumWLinearThree3n2n1n*dSumWLinearFive5n3n5n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10609    if(dError>0.)
10610    {
10611     f5pCumulants->SetBinError(12,pow(dError,0.5)); 
10612    }
10613   } // end of if(...)
10614  } // end of {
10615  f5pCumulants->SetBinContent(13,f5pCorrelations->GetBinContent(13)-f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(5));
10616  {
10617   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
10618   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
10619   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
10620   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
10621   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
10622   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
10623   Double_t dSumWLinearFive5n4n5n2n2n = 0.; // sum of linear event weights for <4>
10624   Double_t dSumWQuadraticFive5n4n5n2n2n = 0.; // sum of quadratic event weights <4>
10625   Double_t dSpreadFive5n4n5n2n2n = 0.; // weighted and biased estimator for sigma of <4>
10626   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10627   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10628   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
10629   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10630   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10631   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
10632   dSumWLinearFive5n4n5n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10633   dSumWQuadraticFive5n4n5n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10634   dSpreadFive5n4n5n2n2n = f5pCorrelations->GetBinError(13);
10635   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
10636      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
10637      pow(dSumWLinearFive5n4n5n2n2n,2.)>dSumWQuadraticFive5n4n5n2n2n)
10638   {
10639    Double_t dError = pow(f3pCorrelations->GetBinContent(2),2.)
10640                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
10641                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
10642                    + pow(f2pCorrelations->GetBinContent(5),2.)
10643                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
10644                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
10645                    + pow((pow(dSumWQuadraticFive5n4n5n2n2n,0.5)/dSumWLinearFive5n4n5n2n2n)
10646                    * dSpreadFive5n4n5n2n2n*pow(pow(dSumWLinearFive5n4n5n2n2n,2.)/(pow(dSumWLinearFive5n4n5n2n2n,2.)-dSumWQuadraticFive5n4n5n2n2n),0.5),2.)
10647                    + 2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(5)
10648                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10649                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,8)) 
10650                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(2))
10651                    / (dSumWLinearTwo5n5n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10652                    - 2.*f3pCorrelations->GetBinContent(2)
10653                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10654                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,69))
10655                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(13))
10656                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n4n5n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10657                    - 2.*f2pCorrelations->GetBinContent(5)
10658                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10659                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,69))
10660                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(13))
10661                    / (dSumWLinearThree4n2n2n*dSumWLinearFive5n4n5n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10662    if(dError>0.)
10663    {
10664     f5pCumulants->SetBinError(13,pow(dError,0.5)); 
10665    }
10666   } // end of if(...)
10667  } // end of {
10668  f5pCumulants->SetBinContent(14,f5pCorrelations->GetBinContent(14)-f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(5));
10669  {
10670   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
10671   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
10672   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
10673   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
10674   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
10675   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
10676   Double_t dSumWLinearFive5n4n5n3n1n = 0.; // sum of linear event weights for <4>
10677   Double_t dSumWQuadraticFive5n4n5n3n1n = 0.; // sum of quadratic event weights <4>
10678   Double_t dSpreadFive5n4n5n3n1n = 0.; // weighted and biased estimator for sigma of <4>
10679   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10680   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10681   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
10682   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10683   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10684   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
10685   dSumWLinearFive5n4n5n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10686   dSumWQuadraticFive5n4n5n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10687   dSpreadFive5n4n5n3n1n = f5pCorrelations->GetBinError(14);
10688   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
10689      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
10690      pow(dSumWLinearFive5n4n5n3n1n,2.)>dSumWQuadraticFive5n4n5n3n1n)
10691   {
10692    Double_t dError = pow(f3pCorrelations->GetBinContent(6),2.)
10693                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
10694                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
10695                    + pow(f2pCorrelations->GetBinContent(5),2.)
10696                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
10697                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
10698                    + pow((pow(dSumWQuadraticFive5n4n5n3n1n,0.5)/dSumWLinearFive5n4n5n3n1n)
10699                    * dSpreadFive5n4n5n3n1n*pow(pow(dSumWLinearFive5n4n5n3n1n,2.)/(pow(dSumWLinearFive5n4n5n3n1n,2.)-dSumWQuadraticFive5n4n5n3n1n),0.5),2.)
10700                    + 2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(5)
10701                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10702                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,11)) 
10703                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(6))
10704                    / (dSumWLinearTwo5n5n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10705                    - 2.*f3pCorrelations->GetBinContent(6)
10706                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10707                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,70))
10708                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(14))
10709                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n4n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10710                    - 2.*f2pCorrelations->GetBinContent(5)
10711                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10712                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,70))
10713                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(14))
10714                    / (dSumWLinearThree4n3n1n*dSumWLinearFive5n4n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10715    if(dError>0.)
10716    {
10717     f5pCumulants->SetBinError(14,pow(dError,0.5)); 
10718    }
10719   } // end of if(...)
10720  } // end of {
10721  f5pCumulants->SetBinContent(15,f5pCorrelations->GetBinContent(15)-f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(1));
10722  {
10723   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
10724   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
10725   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
10726   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
10727   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
10728   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
10729   Double_t dSumWLinearFive6n1n3n3n1n = 0.; // sum of linear event weights for <4>
10730   Double_t dSumWQuadraticFive6n1n3n3n1n = 0.; // sum of quadratic event weights <4>
10731   Double_t dSpreadFive6n1n3n3n1n = 0.; // weighted and biased estimator for sigma of <4>
10732   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10733   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10734   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
10735   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10736   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10737   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
10738   dSumWLinearFive6n1n3n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10739   dSumWQuadraticFive6n1n3n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10740   dSpreadFive6n1n3n3n1n = f5pCorrelations->GetBinError(15);
10741   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
10742      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
10743      pow(dSumWLinearFive6n1n3n3n1n,2.)>dSumWQuadraticFive6n1n3n3n1n)
10744   {
10745    Double_t dError = pow(f3pCorrelations->GetBinContent(3),2.)
10746                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
10747                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
10748                    + pow(f2pCorrelations->GetBinContent(1),2.)
10749                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
10750                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
10751                    + pow((pow(dSumWQuadraticFive6n1n3n3n1n,0.5)/dSumWLinearFive6n1n3n3n1n)
10752                    * dSpreadFive6n1n3n3n1n*pow(pow(dSumWLinearFive6n1n3n3n1n,2.)/(pow(dSumWLinearFive6n1n3n3n1n,2.)-dSumWQuadraticFive6n1n3n3n1n),0.5),2.)
10753                    + 2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(1)
10754                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10755                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,9)) 
10756                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(3))
10757                    / (dSumWLinearTwo1n1n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10758                    - 2.*f3pCorrelations->GetBinContent(3)
10759                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10760                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,71))
10761                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(15))
10762                    / (dSumWLinearTwo1n1n*dSumWLinearFive6n1n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10763                    - 2.*f2pCorrelations->GetBinContent(1)
10764                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10765                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,71))
10766                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(15))
10767                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n1n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10768    if(dError>0.)
10769    {
10770     f5pCumulants->SetBinError(15,pow(dError,0.5)); 
10771    }
10772   } // end of if(...)
10773  } // end of {
10774  f5pCumulants->SetBinContent(16,f5pCorrelations->GetBinContent(16)-f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(2));
10775  {
10776   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
10777   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
10778   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
10779   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
10780   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
10781   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
10782   Double_t dSumWLinearFive6n2n3n3n2n = 0.; // sum of linear event weights for <4>
10783   Double_t dSumWQuadraticFive6n2n3n3n2n = 0.; // sum of quadratic event weights <4>
10784   Double_t dSpreadFive6n2n3n3n2n = 0.; // weighted and biased estimator for sigma of <4>
10785   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10786   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10787   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
10788   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10789   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10790   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
10791   dSumWLinearFive6n2n3n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10792   dSumWQuadraticFive6n2n3n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10793   dSpreadFive6n2n3n3n2n = f5pCorrelations->GetBinError(16);
10794   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
10795      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
10796      pow(dSumWLinearFive6n2n3n3n2n,2.)>dSumWQuadraticFive6n2n3n3n2n)
10797   {
10798    Double_t dError = pow(f3pCorrelations->GetBinContent(3),2.)
10799                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
10800                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
10801                    + pow(f2pCorrelations->GetBinContent(2),2.)
10802                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
10803                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
10804                    + pow((pow(dSumWQuadraticFive6n2n3n3n2n,0.5)/dSumWLinearFive6n2n3n3n2n)
10805                    * dSpreadFive6n2n3n3n2n*pow(pow(dSumWLinearFive6n2n3n3n2n,2.)/(pow(dSumWLinearFive6n2n3n3n2n,2.)-dSumWQuadraticFive6n2n3n3n2n),0.5),2.)
10806                    + 2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(2)
10807                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10808                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,9)) 
10809                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(3))
10810                    / (dSumWLinearTwo2n2n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10811                    - 2.*f3pCorrelations->GetBinContent(3)
10812                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10813                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,72))
10814                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(16))
10815                    / (dSumWLinearTwo2n2n*dSumWLinearFive6n2n3n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10816                    - 2.*f2pCorrelations->GetBinContent(2)
10817                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10818                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,72))
10819                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(16))
10820                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n2n3n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10821    if(dError>0.)
10822    {
10823     f5pCumulants->SetBinError(16,pow(dError,0.5)); 
10824    }
10825   } // end of if(...)
10826  } // end of {
10827  f5pCumulants->SetBinContent(17,f5pCorrelations->GetBinContent(17)-f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(1));
10828  {
10829   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
10830   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
10831   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
10832   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
10833   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
10834   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
10835   Double_t dSumWLinearFive6n1n4n2n1n = 0.; // sum of linear event weights for <4>
10836   Double_t dSumWQuadraticFive6n1n4n2n1n = 0.; // sum of quadratic event weights <4>
10837   Double_t dSpreadFive6n1n4n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10838   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10839   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10840   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
10841   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10842   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10843   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
10844   dSumWLinearFive6n1n4n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10845   dSumWQuadraticFive6n1n4n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10846   dSpreadFive6n1n4n2n1n = f5pCorrelations->GetBinError(17);
10847   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
10848      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
10849      pow(dSumWLinearFive6n1n4n2n1n,2.)>dSumWQuadraticFive6n1n4n2n1n)
10850   {
10851    Double_t dError = pow(f3pCorrelations->GetBinContent(9),2.)
10852                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
10853                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
10854                    + pow(f2pCorrelations->GetBinContent(1),2.)
10855                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
10856                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
10857                    + pow((pow(dSumWQuadraticFive6n1n4n2n1n,0.5)/dSumWLinearFive6n1n4n2n1n)
10858                    * dSpreadFive6n1n4n2n1n*pow(pow(dSumWLinearFive6n1n4n2n1n,2.)/(pow(dSumWLinearFive6n1n4n2n1n,2.)-dSumWQuadraticFive6n1n4n2n1n),0.5),2.)
10859                    + 2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(1)
10860                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10861                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,14)) 
10862                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(9))
10863                    / (dSumWLinearTwo1n1n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10864                    - 2.*f3pCorrelations->GetBinContent(9)
10865                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10866                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,73))
10867                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(17))
10868                    / (dSumWLinearTwo1n1n*dSumWLinearFive6n1n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10869                    - 2.*f2pCorrelations->GetBinContent(1)
10870                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10871                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,73))
10872                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(17))
10873                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n1n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10874    if(dError>0.)
10875    {
10876     f5pCumulants->SetBinError(17,pow(dError,0.5)); 
10877    }
10878   } // end of if(...)
10879  } // end of {
10880  f5pCumulants->SetBinContent(18,f5pCorrelations->GetBinContent(18)-f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(3));
10881  {
10882   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
10883   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
10884   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
10885   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
10886   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
10887   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
10888   Double_t dSumWLinearFive6n3n4n3n2n = 0.; // sum of linear event weights for <4>
10889   Double_t dSumWQuadraticFive6n3n4n3n2n = 0.; // sum of quadratic event weights <4>
10890   Double_t dSpreadFive6n3n4n3n2n = 0.; // weighted and biased estimator for sigma of <4>
10891   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10892   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10893   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
10894   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10895   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10896   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
10897   dSumWLinearFive6n3n4n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10898   dSumWQuadraticFive6n3n4n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10899   dSpreadFive6n3n4n3n2n = f5pCorrelations->GetBinError(18);
10900   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
10901      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
10902      pow(dSumWLinearFive6n3n4n3n2n,2.)>dSumWQuadraticFive6n3n4n3n2n)
10903   {
10904    Double_t dError = pow(f3pCorrelations->GetBinContent(9),2.)
10905                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
10906                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
10907                    + pow(f2pCorrelations->GetBinContent(3),2.)
10908                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
10909                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
10910                    + pow((pow(dSumWQuadraticFive6n3n4n3n2n,0.5)/dSumWLinearFive6n3n4n3n2n)
10911                    * dSpreadFive6n3n4n3n2n*pow(pow(dSumWLinearFive6n3n4n3n2n,2.)/(pow(dSumWLinearFive6n3n4n3n2n,2.)-dSumWQuadraticFive6n3n4n3n2n),0.5),2.)
10912                    + 2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(3)
10913                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10914                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,14)) 
10915                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(9))
10916                    / (dSumWLinearTwo3n3n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10917                    - 2.*f3pCorrelations->GetBinContent(9)
10918                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10919                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,74))
10920                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(18))
10921                    / (dSumWLinearTwo3n3n*dSumWLinearFive6n3n4n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10922                    - 2.*f2pCorrelations->GetBinContent(3)
10923                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10924                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,74))
10925                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(18))
10926                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n3n4n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10927    if(dError>0.)
10928    {
10929     f5pCumulants->SetBinError(18,pow(dError,0.5)); 
10930    }
10931   } // end of if(...)
10932  } // end of {
10933  f5pCumulants->SetBinContent(19,f5pCorrelations->GetBinContent(19)-f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(4));
10934  {
10935   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
10936   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
10937   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
10938   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
10939   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
10940   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
10941   Double_t dSumWLinearFive6n4n4n3n3n = 0.; // sum of linear event weights for <4>
10942   Double_t dSumWQuadraticFive6n4n4n3n3n = 0.; // sum of quadratic event weights <4>
10943   Double_t dSpreadFive6n4n4n3n3n = 0.; // weighted and biased estimator for sigma of <4>
10944   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10945   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10946   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
10947   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10948   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10949   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
10950   dSumWLinearFive6n4n4n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10951   dSumWQuadraticFive6n4n4n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10952   dSpreadFive6n4n4n3n3n = f5pCorrelations->GetBinError(19);
10953   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
10954      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
10955      pow(dSumWLinearFive6n4n4n3n3n,2.)>dSumWQuadraticFive6n4n4n3n3n)
10956   {
10957    Double_t dError = pow(f3pCorrelations->GetBinContent(3),2.)
10958                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
10959                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
10960                    + pow(f2pCorrelations->GetBinContent(4),2.)
10961                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
10962                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
10963                    + pow((pow(dSumWQuadraticFive6n4n4n3n3n,0.5)/dSumWLinearFive6n4n4n3n3n)
10964                    * dSpreadFive6n4n4n3n3n*pow(pow(dSumWLinearFive6n4n4n3n3n,2.)/(pow(dSumWLinearFive6n4n4n3n3n,2.)-dSumWQuadraticFive6n4n4n3n3n),0.5),2.)
10965                    + 2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(4)
10966                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10967                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,9)) 
10968                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(3))
10969                    / (dSumWLinearTwo4n4n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10970                    - 2.*f3pCorrelations->GetBinContent(3)
10971                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10972                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,75))
10973                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(19))
10974                    / (dSumWLinearTwo4n4n*dSumWLinearFive6n4n4n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10975                    - 2.*f2pCorrelations->GetBinContent(4)
10976                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10977                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,75))
10978                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(19))
10979                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n4n4n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10980    if(dError>0.)
10981    {
10982     f5pCumulants->SetBinError(19,pow(dError,0.5)); 
10983    }
10984   } // end of if(...)
10985  } // end of {
10986  f5pCumulants->SetBinContent(20,f5pCorrelations->GetBinContent(20)-f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(2));
10987  {
10988   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
10989   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
10990   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
10991   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
10992   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
10993   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
10994   Double_t dSumWLinearFive6n2n5n2n1n = 0.; // sum of linear event weights for <4>
10995   Double_t dSumWQuadraticFive6n2n5n2n1n = 0.; // sum of quadratic event weights <4>
10996   Double_t dSpreadFive6n2n5n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10997   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10998   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10999   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
11000   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11001   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11002   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
11003   dSumWLinearFive6n2n5n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11004   dSumWQuadraticFive6n2n5n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11005   dSpreadFive6n2n5n2n1n = f5pCorrelations->GetBinError(20);
11006   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
11007      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
11008      pow(dSumWLinearFive6n2n5n2n1n,2.)>dSumWQuadraticFive6n2n5n2n1n)
11009   {
11010    Double_t dError = pow(f3pCorrelations->GetBinContent(10),2.)
11011                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
11012                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
11013                    + pow(f2pCorrelations->GetBinContent(2),2.)
11014                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
11015                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
11016                    + pow((pow(dSumWQuadraticFive6n2n5n2n1n,0.5)/dSumWLinearFive6n2n5n2n1n)
11017                    * dSpreadFive6n2n5n2n1n*pow(pow(dSumWLinearFive6n2n5n2n1n,2.)/(pow(dSumWLinearFive6n2n5n2n1n,2.)-dSumWQuadraticFive6n2n5n2n1n),0.5),2.)
11018                    + 2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(2)
11019                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11020                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,15)) 
11021                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(10))
11022                    / (dSumWLinearTwo2n2n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11023                    - 2.*f3pCorrelations->GetBinContent(10)
11024                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11025                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,76))
11026                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(20))
11027                    / (dSumWLinearTwo2n2n*dSumWLinearFive6n2n5n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11028                    - 2.*f2pCorrelations->GetBinContent(2)
11029                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11030                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,76))
11031                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(20))
11032                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n2n5n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11033    if(dError>0.)
11034    {
11035     f5pCumulants->SetBinError(20,pow(dError,0.5)); 
11036    }
11037   } // end of if(...)
11038  } // end of {
11039  f5pCumulants->SetBinContent(21,f5pCorrelations->GetBinContent(21)-f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(3));
11040  {
11041   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
11042   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
11043   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
11044   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
11045   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
11046   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
11047   Double_t dSumWLinearFive6n3n5n3n1n = 0.; // sum of linear event weights for <4>
11048   Double_t dSumWQuadraticFive6n3n5n3n1n = 0.; // sum of quadratic event weights <4>
11049   Double_t dSpreadFive6n3n5n3n1n = 0.; // weighted and biased estimator for sigma of <4>
11050   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11051   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11052   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
11053   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11054   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11055   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
11056   dSumWLinearFive6n3n5n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11057   dSumWQuadraticFive6n3n5n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11058   dSpreadFive6n3n5n3n1n = f5pCorrelations->GetBinError(21);
11059   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
11060      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
11061      pow(dSumWLinearFive6n3n5n3n1n,2.)>dSumWQuadraticFive6n3n5n3n1n)
11062   {
11063    Double_t dError = pow(f3pCorrelations->GetBinContent(10),2.)
11064                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
11065                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
11066                    + pow(f2pCorrelations->GetBinContent(3),2.)
11067                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
11068                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
11069                    + pow((pow(dSumWQuadraticFive6n3n5n3n1n,0.5)/dSumWLinearFive6n3n5n3n1n)
11070                    * dSpreadFive6n3n5n3n1n*pow(pow(dSumWLinearFive6n3n5n3n1n,2.)/(pow(dSumWLinearFive6n3n5n3n1n,2.)-dSumWQuadraticFive6n3n5n3n1n),0.5),2.)
11071                    + 2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(3)
11072                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11073                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,15)) 
11074                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(10))
11075                    / (dSumWLinearTwo3n3n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11076                    - 2.*f3pCorrelations->GetBinContent(10)
11077                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11078                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,77))
11079                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(21))
11080                    / (dSumWLinearTwo3n3n*dSumWLinearFive6n3n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11081                    - 2.*f2pCorrelations->GetBinContent(3)
11082                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11083                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,77))
11084                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(21))
11085                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n3n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11086    if(dError>0.)
11087    {
11088     f5pCumulants->SetBinError(21,pow(dError,0.5)); 
11089    }
11090   } // end of if(...)
11091  } // end of {
11092  f5pCumulants->SetBinContent(22,f5pCorrelations->GetBinContent(22)-f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(4));
11093  {
11094   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
11095   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
11096   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
11097   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
11098   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
11099   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
11100   Double_t dSumWLinearFive6n3n5n3n1n = 0.; // sum of linear event weights for <4>
11101   Double_t dSumWQuadraticFive6n3n5n3n1n = 0.; // sum of quadratic event weights <4>
11102   Double_t dSpreadFive6n3n5n3n1n = 0.; // weighted and biased estimator for sigma of <4>
11103   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11104   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11105   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
11106   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11107   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11108   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
11109   dSumWLinearFive6n3n5n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11110   dSumWQuadraticFive6n3n5n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11111   dSpreadFive6n3n5n3n1n = f5pCorrelations->GetBinError(22);
11112   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
11113      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
11114      pow(dSumWLinearFive6n3n5n3n1n,2.)>dSumWQuadraticFive6n3n5n3n1n)
11115   {
11116    Double_t dError = pow(f3pCorrelations->GetBinContent(10),2.)
11117                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
11118                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
11119                    + pow(f2pCorrelations->GetBinContent(4),2.)
11120                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
11121                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
11122                    + pow((pow(dSumWQuadraticFive6n3n5n3n1n,0.5)/dSumWLinearFive6n3n5n3n1n)
11123                    * dSpreadFive6n3n5n3n1n*pow(pow(dSumWLinearFive6n3n5n3n1n,2.)/(pow(dSumWLinearFive6n3n5n3n1n,2.)-dSumWQuadraticFive6n3n5n3n1n),0.5),2.)
11124                    + 2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(4)
11125                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11126                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,15)) 
11127                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(10))
11128                    / (dSumWLinearTwo4n4n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11129                    - 2.*f3pCorrelations->GetBinContent(10)
11130                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11131                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,78))
11132                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(22))
11133                    / (dSumWLinearTwo4n4n*dSumWLinearFive6n3n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11134                    - 2.*f2pCorrelations->GetBinContent(4)
11135                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11136                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,78))
11137                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(22))
11138                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n3n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11139    if(dError>0.)
11140    {
11141     f5pCumulants->SetBinError(22,pow(dError,0.5)); 
11142    }
11143   } // end of if(...)
11144  } // end of {
11145  f5pCumulants->SetBinContent(23,f5pCorrelations->GetBinContent(23)-f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(5));
11146  {
11147   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
11148   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
11149   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
11150   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
11151   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
11152   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
11153   Double_t dSumWLinearFive6n5n5n3n3n = 0.; // sum of linear event weights for <4>
11154   Double_t dSumWQuadraticFive6n5n5n3n3n = 0.; // sum of quadratic event weights <4>
11155   Double_t dSpreadFive6n5n5n3n3n = 0.; // weighted and biased estimator for sigma of <4>
11156   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11157   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11158   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
11159   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11160   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11161   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
11162   dSumWLinearFive6n5n5n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11163   dSumWQuadraticFive6n5n5n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11164   dSpreadFive6n5n5n3n3n = f5pCorrelations->GetBinError(23);
11165   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
11166      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
11167      pow(dSumWLinearFive6n5n5n3n3n,2.)>dSumWQuadraticFive6n5n5n3n3n)
11168   {
11169    Double_t dError = pow(f3pCorrelations->GetBinContent(3),2.)
11170                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
11171                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
11172                    + pow(f2pCorrelations->GetBinContent(5),2.)
11173                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
11174                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
11175                    + pow((pow(dSumWQuadraticFive6n5n5n3n3n,0.5)/dSumWLinearFive6n5n5n3n3n)
11176                    * dSpreadFive6n5n5n3n3n*pow(pow(dSumWLinearFive6n5n5n3n3n,2.)/(pow(dSumWLinearFive6n5n5n3n3n,2.)-dSumWQuadraticFive6n5n5n3n3n),0.5),2.)
11177                    + 2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(5)
11178                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11179                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,9)) 
11180                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(3))
11181                    / (dSumWLinearTwo5n5n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11182                    - 2.*f3pCorrelations->GetBinContent(3)
11183                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11184                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,79))
11185                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(23))
11186                    / (dSumWLinearTwo5n5n*dSumWLinearFive6n5n5n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11187                    - 2.*f2pCorrelations->GetBinContent(5)
11188                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11189                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,79))
11190                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(23))
11191                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n5n5n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11192    if(dError>0.)
11193    {
11194     f5pCumulants->SetBinError(23,pow(dError,0.5)); 
11195    }
11196   } // end of if(...)
11197  } // end of {
11198  f5pCumulants->SetBinContent(24,f5pCorrelations->GetBinContent(24)-f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(6));
11199  {
11200   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11201   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11202   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11203   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
11204   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
11205   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
11206   Double_t dSumWLinearFive6n2n6n1n1n = 0.; // sum of linear event weights for <4>
11207   Double_t dSumWQuadraticFive6n2n6n1n1n = 0.; // sum of quadratic event weights <4>
11208   Double_t dSpreadFive6n2n6n1n1n = 0.; // weighted and biased estimator for sigma of <4>
11209   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11210   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11211   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11212   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11213   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11214   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
11215   dSumWLinearFive6n2n6n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11216   dSumWQuadraticFive6n2n6n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11217   dSpreadFive6n2n6n1n1n = f5pCorrelations->GetBinError(24);
11218   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11219      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
11220      pow(dSumWLinearFive6n2n6n1n1n,2.)>dSumWQuadraticFive6n2n6n1n1n)
11221   {
11222    Double_t dError = pow(f3pCorrelations->GetBinContent(1),2.)
11223                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11224                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11225                    + pow(f2pCorrelations->GetBinContent(6),2.)
11226                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
11227                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
11228                    + pow((pow(dSumWQuadraticFive6n2n6n1n1n,0.5)/dSumWLinearFive6n2n6n1n1n)
11229                    * dSpreadFive6n2n6n1n1n*pow(pow(dSumWLinearFive6n2n6n1n1n,2.)/(pow(dSumWLinearFive6n2n6n1n1n,2.)-dSumWQuadraticFive6n2n6n1n1n),0.5),2.)
11230                    + 2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(6)
11231                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11232                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,7)) 
11233                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(1))
11234                    / (dSumWLinearTwo6n6n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11235                    - 2.*f3pCorrelations->GetBinContent(1)
11236                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11237                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,80))
11238                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(24))
11239                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n2n6n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11240                    - 2.*f2pCorrelations->GetBinContent(6)
11241                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11242                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,80))
11243                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(24))
11244                    / (dSumWLinearThree2n1n1n*dSumWLinearFive6n2n6n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11245    if(dError>0.)
11246    {
11247     f5pCumulants->SetBinError(24,pow(dError,0.5)); 
11248    }
11249   } // end of if(...)
11250  } // end of {
11251  f5pCumulants->SetBinContent(25,f5pCorrelations->GetBinContent(25)-f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(6));
11252  {
11253   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11254   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11255   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11256   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
11257   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
11258   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
11259   Double_t dSumWLinearFive6n3n6n2n1n = 0.; // sum of linear event weights for <4>
11260   Double_t dSumWQuadraticFive6n3n6n2n1n = 0.; // sum of quadratic event weights <4>
11261   Double_t dSpreadFive6n3n6n2n1n = 0.; // weighted and biased estimator for sigma of <4>
11262   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11263   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11264   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11265   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11266   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11267   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
11268   dSumWLinearFive6n3n6n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11269   dSumWQuadraticFive6n3n6n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11270   dSpreadFive6n3n6n2n1n = f5pCorrelations->GetBinError(25);
11271   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11272      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
11273      pow(dSumWLinearFive6n3n6n2n1n,2.)>dSumWQuadraticFive6n3n6n2n1n)
11274   {
11275    Double_t dError = pow(f3pCorrelations->GetBinContent(5),2.)
11276                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11277                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11278                    + pow(f2pCorrelations->GetBinContent(6),2.)
11279                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
11280                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
11281                    + pow((pow(dSumWQuadraticFive6n3n6n2n1n,0.5)/dSumWLinearFive6n3n6n2n1n)
11282                    * dSpreadFive6n3n6n2n1n*pow(pow(dSumWLinearFive6n3n6n2n1n,2.)/(pow(dSumWLinearFive6n3n6n2n1n,2.)-dSumWQuadraticFive6n3n6n2n1n),0.5),2.)
11283                    + 2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(6)
11284                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11285                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,10)) 
11286                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(5))
11287                    / (dSumWLinearTwo6n6n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11288                    - 2.*f3pCorrelations->GetBinContent(5)
11289                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11290                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,81))
11291                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(25))
11292                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n3n6n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11293                    - 2.*f2pCorrelations->GetBinContent(6)
11294                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11295                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,81))
11296                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(25))
11297                    / (dSumWLinearThree3n2n1n*dSumWLinearFive6n3n6n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11298    if(dError>0.)
11299    {
11300     f5pCumulants->SetBinError(25,pow(dError,0.5)); 
11301    }
11302   } // end of if(...)
11303  } // end of {
11304  f5pCumulants->SetBinContent(26,f5pCorrelations->GetBinContent(26)-f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(6));
11305  {
11306   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11307   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11308   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11309   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
11310   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
11311   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
11312   Double_t dSumWLinearFive6n4n6n2n2n = 0.; // sum of linear event weights for <4>
11313   Double_t dSumWQuadraticFive6n4n6n2n2n = 0.; // sum of quadratic event weights <4>
11314   Double_t dSpreadFive6n4n6n2n2n = 0.; // weighted and biased estimator for sigma of <4>
11315   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11316   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11317   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11318   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11319   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11320   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
11321   dSumWLinearFive6n4n6n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11322   dSumWQuadraticFive6n4n6n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11323   dSpreadFive6n4n6n2n2n = f5pCorrelations->GetBinError(26);
11324   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11325      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
11326      pow(dSumWLinearFive6n4n6n2n2n,2.)>dSumWQuadraticFive6n4n6n2n2n)
11327   {
11328    Double_t dError = pow(f3pCorrelations->GetBinContent(2),2.)
11329                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11330                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11331                    + pow(f2pCorrelations->GetBinContent(6),2.)
11332                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
11333                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
11334                    + pow((pow(dSumWQuadraticFive6n4n6n2n2n,0.5)/dSumWLinearFive6n4n6n2n2n)
11335                    * dSpreadFive6n4n6n2n2n*pow(pow(dSumWLinearFive6n4n6n2n2n,2.)/(pow(dSumWLinearFive6n4n6n2n2n,2.)-dSumWQuadraticFive6n4n6n2n2n),0.5),2.)
11336                    + 2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(6)
11337                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11338                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,8)) 
11339                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(2))
11340                    / (dSumWLinearTwo6n6n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11341                    - 2.*f3pCorrelations->GetBinContent(2)
11342                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11343                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,82))
11344                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(26))
11345                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n4n6n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11346                    - 2.*f2pCorrelations->GetBinContent(6)
11347                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11348                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,82))
11349                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(26))
11350                    / (dSumWLinearThree4n2n2n*dSumWLinearFive6n4n6n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11351    if(dError>0.)
11352    {
11353     f5pCumulants->SetBinError(26,pow(dError,0.5)); 
11354    }
11355   } // end of if(...)
11356  } // end of {
11357  f5pCumulants->SetBinContent(27,f5pCorrelations->GetBinContent(27)-f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(6));
11358  {
11359   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11360   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11361   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11362   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
11363   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
11364   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
11365   Double_t dSumWLinearFive6n4n6n3n1n = 0.; // sum of linear event weights for <4>
11366   Double_t dSumWQuadraticFive6n4n6n3n1n = 0.; // sum of quadratic event weights <4>
11367   Double_t dSpreadFive6n4n6n3n1n = 0.; // weighted and biased estimator for sigma of <4>
11368   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11369   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11370   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11371   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11372   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11373   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
11374   dSumWLinearFive6n4n6n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11375   dSumWQuadraticFive6n4n6n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11376   dSpreadFive6n4n6n3n1n = f5pCorrelations->GetBinError(27);
11377   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11378      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
11379      pow(dSumWLinearFive6n4n6n3n1n,2.)>dSumWQuadraticFive6n4n6n3n1n)
11380   {
11381    Double_t dError = pow(f3pCorrelations->GetBinContent(6),2.)
11382                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11383                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11384                    + pow(f2pCorrelations->GetBinContent(6),2.)
11385                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
11386                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
11387                    + pow((pow(dSumWQuadraticFive6n4n6n3n1n,0.5)/dSumWLinearFive6n4n6n3n1n)
11388                    * dSpreadFive6n4n6n3n1n*pow(pow(dSumWLinearFive6n4n6n3n1n,2.)/(pow(dSumWLinearFive6n4n6n3n1n,2.)-dSumWQuadraticFive6n4n6n3n1n),0.5),2.)
11389                    + 2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(6)
11390                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11391                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,11)) 
11392                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(6))
11393                    / (dSumWLinearTwo6n6n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11394                    - 2.*f3pCorrelations->GetBinContent(6)
11395                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11396                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,83))
11397                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(27))
11398                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n4n6n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11399                    - 2.*f2pCorrelations->GetBinContent(6)
11400                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11401                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,83))
11402                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(27))
11403                    / (dSumWLinearThree4n3n1n*dSumWLinearFive6n4n6n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11404    if(dError>0.)
11405    {
11406     f5pCumulants->SetBinError(27,pow(dError,0.5)); 
11407    }
11408   } // end of if(...)
11409  } // end of {
11410  f5pCumulants->SetBinContent(28,f5pCorrelations->GetBinContent(28)-f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(5));
11411  {
11412   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
11413   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
11414   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
11415   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
11416   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
11417   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
11418   Double_t dSumWLinearFive6n4n6n3n1n = 0.; // sum of linear event weights for <4>
11419   Double_t dSumWQuadraticFive6n4n6n3n1n = 0.; // sum of quadratic event weights <4>
11420   Double_t dSpreadFive6n4n6n3n1n = 0.; // weighted and biased estimator for sigma of <4>
11421   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11422   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11423   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
11424   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11425   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11426   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
11427   dSumWLinearFive6n4n6n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11428   dSumWQuadraticFive6n4n6n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11429   dSpreadFive6n4n6n3n1n = f5pCorrelations->GetBinError(28);
11430   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
11431      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
11432      pow(dSumWLinearFive6n4n6n3n1n,2.)>dSumWQuadraticFive6n4n6n3n1n)
11433   {
11434    Double_t dError = pow(f3pCorrelations->GetBinContent(9),2.)
11435                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
11436                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
11437                    + pow(f2pCorrelations->GetBinContent(5),2.)
11438                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
11439                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
11440                    + pow((pow(dSumWQuadraticFive6n4n6n3n1n,0.5)/dSumWLinearFive6n4n6n3n1n)
11441                    * dSpreadFive6n4n6n3n1n*pow(pow(dSumWLinearFive6n4n6n3n1n,2.)/(pow(dSumWLinearFive6n4n6n3n1n,2.)-dSumWQuadraticFive6n4n6n3n1n),0.5),2.)
11442                    + 2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(5)
11443                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11444                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,14)) 
11445                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(9))
11446                    / (dSumWLinearTwo5n5n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11447                    - 2.*f3pCorrelations->GetBinContent(9)
11448                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11449                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,84))
11450                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(28))
11451                    / (dSumWLinearTwo5n5n*dSumWLinearFive6n4n6n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11452                    - 2.*f2pCorrelations->GetBinContent(5)
11453                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11454                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,84))
11455                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(28))
11456                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n4n6n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11457    if(dError>0.)
11458    {
11459     f5pCumulants->SetBinError(28,pow(dError,0.5)); 
11460    }
11461   } // end of if(...)
11462  } // end of {
11463  f5pCumulants->SetBinContent(29,f5pCorrelations->GetBinContent(29)-f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(6));
11464  { 
11465   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11466   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11467   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11468   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
11469   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
11470   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
11471   Double_t dSumWLinearFive6n5n6n3n2n = 0.; // sum of linear event weights for <4>
11472   Double_t dSumWQuadraticFive6n5n6n3n2n = 0.; // sum of quadratic event weights <4>
11473   Double_t dSpreadFive6n5n6n3n2n = 0.; // weighted and biased estimator for sigma of <4>
11474   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11475   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11476   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11477   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11478   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11479   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
11480   dSumWLinearFive6n5n6n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11481   dSumWQuadraticFive6n5n6n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11482   dSpreadFive6n5n6n3n2n = f5pCorrelations->GetBinError(29);
11483   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11484      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
11485      pow(dSumWLinearFive6n5n6n3n2n,2.)>dSumWQuadraticFive6n5n6n3n2n)
11486   {
11487    Double_t dError = pow(f3pCorrelations->GetBinContent(7),2.)
11488                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11489                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11490                    + pow(f2pCorrelations->GetBinContent(6),2.)
11491                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
11492                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
11493                    + pow((pow(dSumWQuadraticFive6n5n6n3n2n,0.5)/dSumWLinearFive6n5n6n3n2n)
11494                    * dSpreadFive6n5n6n3n2n*pow(pow(dSumWLinearFive6n5n6n3n2n,2.)/(pow(dSumWLinearFive6n5n6n3n2n,2.)-dSumWQuadraticFive6n5n6n3n2n),0.5),2.)
11495                    + 2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(6)
11496                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11497                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,12)) 
11498                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(7))
11499                    / (dSumWLinearTwo6n6n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11500                    - 2.*f3pCorrelations->GetBinContent(7)
11501                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11502                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,85))
11503                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(29))
11504                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n5n6n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11505                    - 2.*f2pCorrelations->GetBinContent(6)
11506                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11507                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,85))
11508                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(29))
11509                    / (dSumWLinearThree5n3n2n*dSumWLinearFive6n5n6n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11510    if(dError>0.)
11511    {
11512     f5pCumulants->SetBinError(29,pow(dError,0.5)); 
11513    }
11514   } // end of if(...)
11515  } // end of {
11516  f5pCumulants->SetBinContent(30,f5pCorrelations->GetBinContent(30)-f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(6));
11517  { 
11518   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11519   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11520   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11521   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
11522   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
11523   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
11524   Double_t dSumWLinearFive6n5n6n4n1n = 0.; // sum of linear event weights for <4>
11525   Double_t dSumWQuadraticFive6n5n6n4n1n = 0.; // sum of quadratic event weights <4>
11526   Double_t dSpreadFive6n5n6n4n1n = 0.; // weighted and biased estimator for sigma of <4>
11527   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11528   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11529   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11530   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11531   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11532   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
11533   dSumWLinearFive6n5n6n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11534   dSumWQuadraticFive6n5n6n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11535   dSpreadFive6n5n6n4n1n = f5pCorrelations->GetBinError(30);
11536   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11537      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
11538      pow(dSumWLinearFive6n5n6n4n1n,2.)>dSumWQuadraticFive6n5n6n4n1n)
11539   {
11540    Double_t dError = pow(f3pCorrelations->GetBinContent(8),2.)
11541                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11542                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11543                    + pow(f2pCorrelations->GetBinContent(6),2.)
11544                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
11545                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
11546                    + pow((pow(dSumWQuadraticFive6n5n6n4n1n,0.5)/dSumWLinearFive6n5n6n4n1n)
11547                    * dSpreadFive6n5n6n4n1n*pow(pow(dSumWLinearFive6n5n6n4n1n,2.)/(pow(dSumWLinearFive6n5n6n4n1n,2.)-dSumWQuadraticFive6n5n6n4n1n),0.5),2.)
11548                    + 2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(6)
11549                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11550                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,13)) 
11551                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(8))
11552                    / (dSumWLinearTwo6n6n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11553                    - 2.*f3pCorrelations->GetBinContent(8)
11554                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11555                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,86))
11556                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(30))
11557                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n5n6n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11558                    - 2.*f2pCorrelations->GetBinContent(6)
11559                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11560                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,86))
11561                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(30))
11562                    / (dSumWLinearThree5n4n1n*dSumWLinearFive6n5n6n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11563    if(dError>0.)
11564    {
11565     f5pCumulants->SetBinError(30,pow(dError,0.5)); 
11566    }
11567   } // end of if(...)
11568  } // end of {
11569  // d2) "Two distinct harmonics":
11570  f5pCumulants->SetBinContent(32,f5pCorrelations->GetBinContent(32)-3.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(1));
11571  { 
11572   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
11573   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
11574   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
11575   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
11576   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
11577   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
11578   Double_t dSumWLinearFive2n1n1n1n1n = 0.; // sum of linear event weights for <4>
11579   Double_t dSumWQuadraticFive2n1n1n1n1n = 0.; // sum of quadratic event weights <4>
11580   Double_t dSpreadFive2n1n1n1n1n = 0.; // weighted and biased estimator for sigma of <4>
11581   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11582   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11583   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
11584   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11585   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11586   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
11587   dSumWLinearFive2n1n1n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11588   dSumWQuadraticFive2n1n1n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11589   dSpreadFive2n1n1n1n1n = f5pCorrelations->GetBinError(32);
11590   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
11591      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
11592      pow(dSumWLinearFive2n1n1n1n1n,2.)>dSumWQuadraticFive2n1n1n1n1n)
11593   {
11594    Double_t dError = 9.*pow(f3pCorrelations->GetBinContent(1),2.)
11595                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
11596                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
11597                    + 9.*pow(f2pCorrelations->GetBinContent(1),2.)
11598                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
11599                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
11600                    + pow((pow(dSumWQuadraticFive2n1n1n1n1n,0.5)/dSumWLinearFive2n1n1n1n1n)
11601                    * dSpreadFive2n1n1n1n1n*pow(pow(dSumWLinearFive2n1n1n1n1n,2.)/(pow(dSumWLinearFive2n1n1n1n1n,2.)-dSumWQuadraticFive2n1n1n1n1n),0.5),2.)
11602                    + 9.*2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(1)
11603                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11604                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,7)) 
11605                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(1))
11606                    / (dSumWLinearTwo1n1n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11607                    - 3.*2.*f3pCorrelations->GetBinContent(1)
11608                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11609                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,87))
11610                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(32))
11611                    / (dSumWLinearTwo1n1n*dSumWLinearFive2n1n1n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11612                    - 3.*2.*f2pCorrelations->GetBinContent(1)
11613                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11614                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,87))
11615                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(32))
11616                    / (dSumWLinearThree2n1n1n*dSumWLinearFive2n1n1n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11617    if(dError>0.)
11618    {
11619     f5pCumulants->SetBinError(32,pow(dError,0.5)); 
11620    }
11621   } // end of if(...)
11622  } // end of {
11623  f5pCumulants->SetBinContent(33,f5pCorrelations->GetBinContent(33)-2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(2));
11624  { 
11625   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
11626   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
11627   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
11628   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
11629   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
11630   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
11631   Double_t dSumWLinearFive2n2n2n1n1n = 0.; // sum of linear event weights for <4>
11632   Double_t dSumWQuadraticFive2n2n2n1n1n = 0.; // sum of quadratic event weights <4>
11633   Double_t dSpreadFive2n2n2n1n1n = 0.; // weighted and biased estimator for sigma of <4>
11634   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11635   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11636   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
11637   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11638   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11639   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
11640   dSumWLinearFive2n2n2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11641   dSumWQuadraticFive2n2n2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11642   dSpreadFive2n2n2n1n1n = f5pCorrelations->GetBinError(33);
11643   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
11644      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
11645      pow(dSumWLinearFive2n2n2n1n1n,2.)>dSumWQuadraticFive2n2n2n1n1n)
11646   {
11647    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(1),2.)
11648                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
11649                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
11650                    + 4.*pow(f2pCorrelations->GetBinContent(2),2.)
11651                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
11652                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
11653                    + pow((pow(dSumWQuadraticFive2n2n2n1n1n,0.5)/dSumWLinearFive2n2n2n1n1n)
11654                    * dSpreadFive2n2n2n1n1n*pow(pow(dSumWLinearFive2n2n2n1n1n,2.)/(pow(dSumWLinearFive2n2n2n1n1n,2.)-dSumWQuadraticFive2n2n2n1n1n),0.5),2.)
11655                    + 4.*2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(2)
11656                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11657                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,7)) 
11658                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(1))
11659                    / (dSumWLinearTwo2n2n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11660                    - 2.*2.*f3pCorrelations->GetBinContent(1)
11661                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11662                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,88))
11663                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(33))
11664                    / (dSumWLinearTwo2n2n*dSumWLinearFive2n2n2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11665                    - 2.*2.*f2pCorrelations->GetBinContent(2)
11666                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11667                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,88))
11668                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(33))
11669                    / (dSumWLinearThree2n1n1n*dSumWLinearFive2n2n2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11670    if(dError>0.)
11671    {
11672     f5pCumulants->SetBinError(33,pow(dError,0.5)); 
11673    }
11674   } // end of if(...)
11675  } // end of {
11676  f5pCumulants->SetBinContent(34,f5pCorrelations->GetBinContent(34));
11677  {
11678   Double_t dSumWLinear = 0.; // sum of linear event weights
11679   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11680   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11681   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11682   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11683   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11684   dSpread = f5pCorrelations->GetBinError(34);
11685   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11686   {
11687    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11688    f5pCumulants->SetBinError(34,dError); 
11689   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11690  } 
11691  f5pCumulants->SetBinContent(35,f5pCorrelations->GetBinContent(35));
11692  {
11693   Double_t dSumWLinear = 0.; // sum of linear event weights
11694   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11695   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11696   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11697   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11698   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11699   dSpread = f5pCorrelations->GetBinError(35);
11700   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11701   {
11702    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11703    f5pCumulants->SetBinError(35,dError); 
11704   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11705  } 
11706  f5pCumulants->SetBinContent(36,f5pCorrelations->GetBinContent(36)-3.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(2));
11707  { 
11708   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
11709   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
11710   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
11711   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
11712   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
11713   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
11714   Double_t dSumWLinearFive4n2n2n2n2n = 0.; // sum of linear event weights for <4>
11715   Double_t dSumWQuadraticFive4n2n2n2n2n = 0.; // sum of quadratic event weights <4>
11716   Double_t dSpreadFive4n2n2n2n2n = 0.; // weighted and biased estimator for sigma of <4>
11717   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11718   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11719   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
11720   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11721   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11722   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
11723   dSumWLinearFive4n2n2n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11724   dSumWQuadraticFive4n2n2n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11725   dSpreadFive4n2n2n2n2n = f5pCorrelations->GetBinError(36);
11726   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
11727      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
11728      pow(dSumWLinearFive4n2n2n2n2n,2.)>dSumWQuadraticFive4n2n2n2n2n)
11729   {
11730    Double_t dError = 9.*pow(f3pCorrelations->GetBinContent(2),2.)
11731                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
11732                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
11733                    + 9.*pow(f2pCorrelations->GetBinContent(2),2.)
11734                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
11735                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
11736                    + pow((pow(dSumWQuadraticFive4n2n2n2n2n,0.5)/dSumWLinearFive4n2n2n2n2n)
11737                    * dSpreadFive4n2n2n2n2n*pow(pow(dSumWLinearFive4n2n2n2n2n,2.)/(pow(dSumWLinearFive4n2n2n2n2n,2.)-dSumWQuadraticFive4n2n2n2n2n),0.5),2.)
11738                    + 9.*2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(2)
11739                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11740                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,8)) 
11741                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(2))
11742                    / (dSumWLinearTwo2n2n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11743                    - 3.*2.*f3pCorrelations->GetBinContent(2)
11744                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11745                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,91))
11746                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(36))
11747                    / (dSumWLinearTwo2n2n*dSumWLinearFive4n2n2n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11748                    - 3.*2.*f2pCorrelations->GetBinContent(2)
11749                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11750                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,91))
11751                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(36))
11752                    / (dSumWLinearThree4n2n2n*dSumWLinearFive4n2n2n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11753    if(dError>0.)
11754    {
11755     f5pCumulants->SetBinError(36,pow(dError,0.5)); 
11756    }
11757   } // end of if(...)
11758  } // end of {
11759  f5pCumulants->SetBinContent(37,f5pCorrelations->GetBinContent(37)-2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(4)); 
11760  { 
11761   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
11762   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
11763   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
11764   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
11765   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
11766   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
11767   Double_t dSumWLinearFive4n4n4n2n2n = 0.; // sum of linear event weights for <4>
11768   Double_t dSumWQuadraticFive4n4n4n2n2n = 0.; // sum of quadratic event weights <4>
11769   Double_t dSpreadFive4n4n4n2n2n = 0.; // weighted and biased estimator for sigma of <4>
11770   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11771   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11772   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
11773   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11774   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11775   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
11776   dSumWLinearFive4n4n4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11777   dSumWQuadraticFive4n4n4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11778   dSpreadFive4n4n4n2n2n = f5pCorrelations->GetBinError(37);
11779   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
11780      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
11781      pow(dSumWLinearFive4n4n4n2n2n,2.)>dSumWQuadraticFive4n4n4n2n2n)
11782   {
11783    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(2),2.)
11784                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
11785                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
11786                    + 4.*pow(f2pCorrelations->GetBinContent(4),2.)
11787                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
11788                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
11789                    + pow((pow(dSumWQuadraticFive4n4n4n2n2n,0.5)/dSumWLinearFive4n4n4n2n2n)
11790                    * dSpreadFive4n4n4n2n2n*pow(pow(dSumWLinearFive4n4n4n2n2n,2.)/(pow(dSumWLinearFive4n4n4n2n2n,2.)-dSumWQuadraticFive4n4n4n2n2n),0.5),2.)
11791                    + 4.*2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(4)
11792                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11793                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,8)) 
11794                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(2))
11795                    / (dSumWLinearTwo4n4n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11796                    - 2.*2.*f3pCorrelations->GetBinContent(2)
11797                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11798                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,92))
11799                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(37))
11800                    / (dSumWLinearTwo4n4n*dSumWLinearFive4n4n4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11801                    - 2.*2.*f2pCorrelations->GetBinContent(4)
11802                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11803                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,92))
11804                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(37))
11805                    / (dSumWLinearThree4n2n2n*dSumWLinearFive4n4n4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11806    if(dError>0.)
11807    {
11808     f5pCumulants->SetBinError(37,pow(dError,0.5)); 
11809    }
11810   } // end of if(...)
11811  } // end of {
11812  f5pCumulants->SetBinContent(38,f5pCorrelations->GetBinContent(38)-3.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(3)); 
11813  { 
11814   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
11815   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
11816   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
11817   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
11818   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
11819   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
11820   Double_t dSumWLinearFive6n3n3n3n3n = 0.; // sum of linear event weights for <4>
11821   Double_t dSumWQuadraticFive6n3n3n3n3n = 0.; // sum of quadratic event weights <4>
11822   Double_t dSpreadFive6n3n3n3n3n = 0.; // weighted and biased estimator for sigma of <4>
11823   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11824   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11825   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
11826   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11827   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11828   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
11829   dSumWLinearFive6n3n3n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11830   dSumWQuadraticFive6n3n3n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11831   dSpreadFive6n3n3n3n3n = f5pCorrelations->GetBinError(38);
11832   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
11833      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
11834      pow(dSumWLinearFive6n3n3n3n3n,2.)>dSumWQuadraticFive6n3n3n3n3n)
11835   {
11836    Double_t dError = 9.*pow(f3pCorrelations->GetBinContent(3),2.)
11837                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
11838                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
11839                    + 9.*pow(f2pCorrelations->GetBinContent(3),2.)
11840                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
11841                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
11842                    + pow((pow(dSumWQuadraticFive6n3n3n3n3n,0.5)/dSumWLinearFive6n3n3n3n3n)
11843                    * dSpreadFive6n3n3n3n3n*pow(pow(dSumWLinearFive6n3n3n3n3n,2.)/(pow(dSumWLinearFive6n3n3n3n3n,2.)-dSumWQuadraticFive6n3n3n3n3n),0.5),2.)
11844                    + 9.*2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(3)
11845                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11846                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,9)) 
11847                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(3))
11848                    / (dSumWLinearTwo3n3n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11849                    - 3.*2.*f3pCorrelations->GetBinContent(3)
11850                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11851                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,93))
11852                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(38))
11853                    / (dSumWLinearTwo3n3n*dSumWLinearFive6n3n3n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11854                    - 3.*2.*f2pCorrelations->GetBinContent(3)
11855                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11856                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,93))
11857                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(38))
11858                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n3n3n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11859    if(dError>0.)
11860    {
11861     f5pCumulants->SetBinError(38,pow(dError,0.5)); 
11862    }
11863   } // end of if(...)
11864  } // end of {
11865  f5pCumulants->SetBinContent(39,f5pCorrelations->GetBinContent(39));
11866  {
11867   Double_t dSumWLinear = 0.; // sum of linear event weights
11868   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11869   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11870   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11871   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11872   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11873   dSpread = f5pCorrelations->GetBinError(39);
11874   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11875   {
11876    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11877    f5pCumulants->SetBinError(39,dError); 
11878   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11879  } 
11880  f5pCumulants->SetBinContent(40,f5pCorrelations->GetBinContent(40)-2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(6)); 
11881  { 
11882   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11883   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11884   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11885   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
11886   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
11887   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
11888   Double_t dSumWLinearFive6n6n6n3n3n = 0.; // sum of linear event weights for <4>
11889   Double_t dSumWQuadraticFive6n6n6n3n3n = 0.; // sum of quadratic event weights <4>
11890   Double_t dSpreadFive6n6n6n3n3n = 0.; // weighted and biased estimator for sigma of <4>
11891   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11892   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11893   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11894   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11895   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11896   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
11897   dSumWLinearFive6n6n6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11898   dSumWQuadraticFive6n6n6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11899   dSpreadFive6n6n6n3n3n = f5pCorrelations->GetBinError(40);
11900   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11901      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
11902      pow(dSumWLinearFive6n6n6n3n3n,2.)>dSumWQuadraticFive6n6n6n3n3n)
11903   {
11904    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(3),2.)
11905                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11906                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11907                    + 4.*pow(f2pCorrelations->GetBinContent(6),2.)
11908                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
11909                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
11910                    + pow((pow(dSumWQuadraticFive6n6n6n3n3n,0.5)/dSumWLinearFive6n6n6n3n3n)
11911                    * dSpreadFive6n6n6n3n3n*pow(pow(dSumWLinearFive6n6n6n3n3n,2.)/(pow(dSumWLinearFive6n6n6n3n3n,2.)-dSumWQuadraticFive6n6n6n3n3n),0.5),2.)
11912                    + 4.*2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(6)
11913                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11914                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,9)) 
11915                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(3))
11916                    / (dSumWLinearTwo6n6n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11917                    - 2.*2.*f3pCorrelations->GetBinContent(3)
11918                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11919                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,95))
11920                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(40))
11921                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n6n6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11922                    - 2.*2.*f2pCorrelations->GetBinContent(6)
11923                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11924                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,95))
11925                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(40))
11926                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n6n6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11927    if(dError>0.)
11928    {
11929     f5pCumulants->SetBinError(40,pow(dError,0.5)); 
11930    }
11931   } // end of if(...)
11932  } // end of {
11933
11934  // d2) "Three distinct harmonics":
11935  f5pCumulants->SetBinContent(42,f5pCorrelations->GetBinContent(42)-2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(1)); 
11936  { 
11937   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
11938   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
11939   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
11940   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
11941   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
11942   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
11943   Double_t dSumWLinearFive3n1n2n1n1n = 0.; // sum of linear event weights for <4>
11944   Double_t dSumWQuadraticFive3n1n2n1n1n = 0.; // sum of quadratic event weights <4>
11945   Double_t dSpreadFive3n1n2n1n1n = 0.; // weighted and biased estimator for sigma of <4>
11946   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11947   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11948   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
11949   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11950   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11951   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
11952   dSumWLinearFive3n1n2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11953   dSumWQuadraticFive3n1n2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11954   dSpreadFive3n1n2n1n1n = f5pCorrelations->GetBinError(42);
11955   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
11956      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
11957      pow(dSumWLinearFive3n1n2n1n1n,2.)>dSumWQuadraticFive3n1n2n1n1n)
11958   {
11959    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(5),2.)
11960                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
11961                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
11962                    + 4.*pow(f2pCorrelations->GetBinContent(1),2.)
11963                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
11964                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
11965                    + pow((pow(dSumWQuadraticFive3n1n2n1n1n,0.5)/dSumWLinearFive3n1n2n1n1n)
11966                    * dSpreadFive3n1n2n1n1n*pow(pow(dSumWLinearFive3n1n2n1n1n,2.)/(pow(dSumWLinearFive3n1n2n1n1n,2.)-dSumWQuadraticFive3n1n2n1n1n),0.5),2.)
11967                    + 4.*2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(1)
11968                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11969                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,10)) 
11970                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(5))
11971                    / (dSumWLinearTwo1n1n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11972                    - 2.*2.*f3pCorrelations->GetBinContent(5)
11973                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11974                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,96))
11975                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(42))
11976                    / (dSumWLinearTwo1n1n*dSumWLinearFive3n1n2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11977                    - 2.*2.*f2pCorrelations->GetBinContent(1)
11978                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11979                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,96))
11980                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(42))
11981                    / (dSumWLinearThree3n2n1n*dSumWLinearFive3n1n2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11982    if(dError>0.)
11983    {
11984     f5pCumulants->SetBinError(42,pow(dError,0.5)); 
11985    }
11986   } // end of if(...)
11987  } // end of {
11988  f5pCumulants->SetBinContent(43,f5pCorrelations->GetBinContent(43)-2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(2)); 
11989  { 
11990   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
11991   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
11992   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
11993   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
11994   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
11995   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
11996   Double_t dSumWLinearFive3n2n2n2n1n = 0.; // sum of linear event weights for <4>
11997   Double_t dSumWQuadraticFive3n2n2n2n1n = 0.; // sum of quadratic event weights <4>
11998   Double_t dSpreadFive3n2n2n2n1n = 0.; // weighted and biased estimator for sigma of <4>
11999   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12000   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12001   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
12002   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12003   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12004   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
12005   dSumWLinearFive3n2n2n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12006   dSumWQuadraticFive3n2n2n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12007   dSpreadFive3n2n2n2n1n = f5pCorrelations->GetBinError(43);
12008   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
12009      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
12010      pow(dSumWLinearFive3n2n2n2n1n,2.)>dSumWQuadraticFive3n2n2n2n1n)
12011   {
12012    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(5),2.)
12013                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
12014                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
12015                    + 4.*pow(f2pCorrelations->GetBinContent(2),2.)
12016                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
12017                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
12018                    + pow((pow(dSumWQuadraticFive3n2n2n2n1n,0.5)/dSumWLinearFive3n2n2n2n1n)
12019                    * dSpreadFive3n2n2n2n1n*pow(pow(dSumWLinearFive3n2n2n2n1n,2.)/(pow(dSumWLinearFive3n2n2n2n1n,2.)-dSumWQuadraticFive3n2n2n2n1n),0.5),2.)
12020                    + 4.*2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(2)
12021                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12022                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,10)) 
12023                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(5))
12024                    / (dSumWLinearTwo2n2n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12025                    - 2.*2.*f3pCorrelations->GetBinContent(5)
12026                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12027                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,97))
12028                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(43))
12029                    / (dSumWLinearTwo2n2n*dSumWLinearFive3n2n2n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12030                    - 2.*2.*f2pCorrelations->GetBinContent(2)
12031                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12032                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,97))
12033                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(43))
12034                    / (dSumWLinearThree3n2n1n*dSumWLinearFive3n2n2n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12035    if(dError>0.)
12036    {
12037     f5pCumulants->SetBinError(43,pow(dError,0.5)); 
12038    }
12039   } // end of if(...)
12040  } // end of {
12041  f5pCumulants->SetBinContent(44,f5pCorrelations->GetBinContent(44)-2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(3)); 
12042  { 
12043   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
12044   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
12045   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
12046   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
12047   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
12048   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
12049   Double_t dSumWLinearFive3n3n3n2n1n = 0.; // sum of linear event weights for <4>
12050   Double_t dSumWQuadraticFive3n3n3n2n1n = 0.; // sum of quadratic event weights <4>
12051   Double_t dSpreadFive3n3n3n2n1n = 0.; // weighted and biased estimator for sigma of <4>
12052   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12053   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12054   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
12055   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12056   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12057   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
12058   dSumWLinearFive3n3n3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12059   dSumWQuadraticFive3n3n3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12060   dSpreadFive3n3n3n2n1n = f5pCorrelations->GetBinError(44);
12061   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
12062      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
12063      pow(dSumWLinearFive3n3n3n2n1n,2.)>dSumWQuadraticFive3n3n3n2n1n)
12064   {
12065    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(5),2.)
12066                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
12067                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
12068                    + 4.*pow(f2pCorrelations->GetBinContent(3),2.)
12069                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
12070                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
12071                    + pow((pow(dSumWQuadraticFive3n3n3n2n1n,0.5)/dSumWLinearFive3n3n3n2n1n)
12072                    * dSpreadFive3n3n3n2n1n*pow(pow(dSumWLinearFive3n3n3n2n1n,2.)/(pow(dSumWLinearFive3n3n3n2n1n,2.)-dSumWQuadraticFive3n3n3n2n1n),0.5),2.)
12073                    + 4.*2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(3)
12074                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12075                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,10)) 
12076                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(5))
12077                    / (dSumWLinearTwo3n3n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12078                    - 2.*2.*f3pCorrelations->GetBinContent(5)
12079                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12080                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,98))
12081                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(44))
12082                    / (dSumWLinearTwo3n3n*dSumWLinearFive3n3n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12083                    - 2.*2.*f2pCorrelations->GetBinContent(3)
12084                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12085                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,98))
12086                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(44))
12087                    / (dSumWLinearThree3n2n1n*dSumWLinearFive3n3n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12088    if(dError>0.)
12089    {
12090     f5pCumulants->SetBinError(44,pow(dError,0.5)); 
12091    }
12092   } // end of if(...)
12093  } // end of {
12094  f5pCumulants->SetBinContent(45,f5pCorrelations->GetBinContent(45)-2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(1)); 
12095  { 
12096   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
12097   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
12098   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
12099   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
12100   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
12101   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
12102   Double_t dSumWLinearFive4n1n3n1n1n = 0.; // sum of linear event weights for <4>
12103   Double_t dSumWQuadraticFive4n1n3n1n1n = 0.; // sum of quadratic event weights <4>
12104   Double_t dSpreadFive4n1n3n1n1n = 0.; // weighted and biased estimator for sigma of <4>
12105   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12106   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12107   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
12108   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12109   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12110   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
12111   dSumWLinearFive4n1n3n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12112   dSumWQuadraticFive4n1n3n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12113   dSpreadFive4n1n3n1n1n = f5pCorrelations->GetBinError(45);
12114   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
12115      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
12116      pow(dSumWLinearFive4n1n3n1n1n,2.)>dSumWQuadraticFive4n1n3n1n1n)
12117   {
12118    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(6),2.)
12119                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
12120                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
12121                    + 4.*pow(f2pCorrelations->GetBinContent(1),2.)
12122                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
12123                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
12124                    + pow((pow(dSumWQuadraticFive4n1n3n1n1n,0.5)/dSumWLinearFive4n1n3n1n1n)
12125                    * dSpreadFive4n1n3n1n1n*pow(pow(dSumWLinearFive4n1n3n1n1n,2.)/(pow(dSumWLinearFive4n1n3n1n1n,2.)-dSumWQuadraticFive4n1n3n1n1n),0.5),2.)
12126                    + 4.*2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(1)
12127                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12128                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,11)) 
12129                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(6))
12130                    / (dSumWLinearTwo1n1n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12131                    - 2.*2.*f3pCorrelations->GetBinContent(6)
12132                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12133                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,99))
12134                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(45))
12135                    / (dSumWLinearTwo1n1n*dSumWLinearFive4n1n3n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12136                    - 2.*2.*f2pCorrelations->GetBinContent(1)
12137                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12138                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,99))
12139                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(45))
12140                    / (dSumWLinearThree4n3n1n*dSumWLinearFive4n1n3n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12141    if(dError>0.)
12142    {
12143     f5pCumulants->SetBinError(45,pow(dError,0.5)); 
12144    }
12145   } // end of if(...)
12146  } // end of {
12147  f5pCumulants->SetBinContent(46,f5pCorrelations->GetBinContent(46));
12148  {
12149   Double_t dSumWLinear = 0.; // sum of linear event weights
12150   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12151   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12152   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12153   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12154   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12155   dSpread = f5pCorrelations->GetBinError(46);
12156   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12157   {
12158    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12159    f5pCumulants->SetBinError(46,dError); 
12160   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12161  } 
12162  f5pCumulants->SetBinContent(47,f5pCorrelations->GetBinContent(47)-2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(3)); 
12163  { 
12164   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
12165   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
12166   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
12167   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
12168   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
12169   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
12170   Double_t dSumWLinearFive4n3n3n3n1n = 0.; // sum of linear event weights for <4>
12171   Double_t dSumWQuadraticFive4n3n3n3n1n = 0.; // sum of quadratic event weights <4>
12172   Double_t dSpreadFive4n3n3n3n1n = 0.; // weighted and biased estimator for sigma of <4>
12173   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12174   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12175   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
12176   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12177   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12178   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
12179   dSumWLinearFive4n3n3n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12180   dSumWQuadraticFive4n3n3n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12181   dSpreadFive4n3n3n3n1n = f5pCorrelations->GetBinError(47);
12182   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
12183      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
12184      pow(dSumWLinearFive4n3n3n3n1n,2.)>dSumWQuadraticFive4n3n3n3n1n)
12185   {
12186    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(6),2.)
12187                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
12188                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
12189                    + 4.*pow(f2pCorrelations->GetBinContent(3),2.)
12190                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
12191                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
12192                    + pow((pow(dSumWQuadraticFive4n3n3n3n1n,0.5)/dSumWLinearFive4n3n3n3n1n)
12193                    * dSpreadFive4n3n3n3n1n*pow(pow(dSumWLinearFive4n3n3n3n1n,2.)/(pow(dSumWLinearFive4n3n3n3n1n,2.)-dSumWQuadraticFive4n3n3n3n1n),0.5),2.)
12194                    + 4.*2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(3)
12195                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12196                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,11)) 
12197                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(6))
12198                    / (dSumWLinearTwo3n3n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12199                    - 2.*2.*f3pCorrelations->GetBinContent(6)
12200                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12201                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,101))
12202                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(47))
12203                    / (dSumWLinearTwo3n3n*dSumWLinearFive4n3n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12204                    - 2.*2.*f2pCorrelations->GetBinContent(3)
12205                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12206                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,101))
12207                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(47))
12208                    / (dSumWLinearThree4n3n1n*dSumWLinearFive4n3n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12209    if(dError>0.)
12210    {
12211     f5pCumulants->SetBinError(47,pow(dError,0.5)); 
12212    }
12213   } // end of if(...)
12214  } // end of {
12215  f5pCumulants->SetBinContent(48,f5pCorrelations->GetBinContent(48));
12216  {
12217   Double_t dSumWLinear = 0.; // sum of linear event weights
12218   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12219   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12220   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12221   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12222   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12223   dSpread = f5pCorrelations->GetBinError(48);
12224   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12225   {
12226    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12227    f5pCumulants->SetBinError(48,dError); 
12228   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12229  } 
12230  f5pCumulants->SetBinContent(49,f5pCorrelations->GetBinContent(49)-2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(4));  
12231  { 
12232   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
12233   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
12234   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
12235   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
12236   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
12237   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
12238   Double_t dSumWLinearFive4n3n3n3n1n = 0.; // sum of linear event weights for <4>
12239   Double_t dSumWQuadraticFive4n3n3n3n1n = 0.; // sum of quadratic event weights <4>
12240   Double_t dSpreadFive4n3n3n3n1n = 0.; // weighted and biased estimator for sigma of <4>
12241   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12242   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12243   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
12244   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12245   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12246   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
12247   dSumWLinearFive4n3n3n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12248   dSumWQuadraticFive4n3n3n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12249   dSpreadFive4n3n3n3n1n = f5pCorrelations->GetBinError(49);
12250   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
12251      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
12252      pow(dSumWLinearFive4n3n3n3n1n,2.)>dSumWQuadraticFive4n3n3n3n1n)
12253   {
12254    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(6),2.)
12255                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
12256                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
12257                    + 4.*pow(f2pCorrelations->GetBinContent(4),2.)
12258                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
12259                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
12260                    + pow((pow(dSumWQuadraticFive4n3n3n3n1n,0.5)/dSumWLinearFive4n3n3n3n1n)
12261                    * dSpreadFive4n3n3n3n1n*pow(pow(dSumWLinearFive4n3n3n3n1n,2.)/(pow(dSumWLinearFive4n3n3n3n1n,2.)-dSumWQuadraticFive4n3n3n3n1n),0.5),2.)
12262                    + 4.*2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(4)
12263                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12264                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,11)) 
12265                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(6))
12266                    / (dSumWLinearTwo4n4n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12267                    - 2.*2.*f3pCorrelations->GetBinContent(6)
12268                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12269                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,103))
12270                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(49))
12271                    / (dSumWLinearTwo4n4n*dSumWLinearFive4n3n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12272                    - 2.*2.*f2pCorrelations->GetBinContent(4)
12273                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12274                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,103))
12275                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(49))
12276                    / (dSumWLinearThree4n3n1n*dSumWLinearFive4n3n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12277    if(dError>0.)
12278    {
12279     f5pCumulants->SetBinError(49,pow(dError,0.5)); 
12280    }
12281   } // end of if(...)
12282  } // end of {
12283  f5pCumulants->SetBinContent(50,f5pCorrelations->GetBinContent(50));
12284  {
12285   Double_t dSumWLinear = 0.; // sum of linear event weights
12286   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12287   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12288   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12289   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12290   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12291   dSpread = f5pCorrelations->GetBinError(50);
12292   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12293   {
12294    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12295    f5pCumulants->SetBinError(50,dError); 
12296   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12297  } 
12298  f5pCumulants->SetBinContent(51,f5pCorrelations->GetBinContent(51));
12299  {
12300   Double_t dSumWLinear = 0.; // sum of linear event weights
12301   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12302   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12303   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12304   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12305   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12306   dSpread = f5pCorrelations->GetBinError(51);
12307   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12308   {
12309    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12310    f5pCumulants->SetBinError(51,dError); 
12311   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12312  } 
12313  f5pCumulants->SetBinContent(52,f5pCorrelations->GetBinContent(52)-2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(2));  
12314  { 
12315   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
12316   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
12317   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
12318   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
12319   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
12320   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
12321   Double_t dSumWLinearFive5n2n3n2n2n = 0.; // sum of linear event weights for <4>
12322   Double_t dSumWQuadraticFive5n2n3n2n2n = 0.; // sum of quadratic event weights <4>
12323   Double_t dSpreadFive5n2n3n2n2n = 0.; // weighted and biased estimator for sigma of <4>
12324   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12325   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12326   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
12327   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12328   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12329   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
12330   dSumWLinearFive5n2n3n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12331   dSumWQuadraticFive5n2n3n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12332   dSpreadFive5n2n3n2n2n = f5pCorrelations->GetBinError(52);
12333   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
12334      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
12335      pow(dSumWLinearFive5n2n3n2n2n,2.)>dSumWQuadraticFive5n2n3n2n2n)
12336   {
12337    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(7),2.)
12338                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
12339                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
12340                    + 4.*pow(f2pCorrelations->GetBinContent(2),2.)
12341                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
12342                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
12343                    + pow((pow(dSumWQuadraticFive5n2n3n2n2n,0.5)/dSumWLinearFive5n2n3n2n2n)
12344                    * dSpreadFive5n2n3n2n2n*pow(pow(dSumWLinearFive5n2n3n2n2n,2.)/(pow(dSumWLinearFive5n2n3n2n2n,2.)-dSumWQuadraticFive5n2n3n2n2n),0.5),2.)
12345                    + 4.*2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(2)
12346                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12347                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,12)) 
12348                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(7))
12349                    / (dSumWLinearTwo2n2n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12350                    - 2.*2.*f3pCorrelations->GetBinContent(7)
12351                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12352                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,106))
12353                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(52))
12354                    / (dSumWLinearTwo2n2n*dSumWLinearFive5n2n3n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12355                    - 2.*2.*f2pCorrelations->GetBinContent(2)
12356                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12357                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,106))
12358                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(52))
12359                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n2n3n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12360    if(dError>0.)
12361    {
12362     f5pCumulants->SetBinError(52,pow(dError,0.5)); 
12363    }
12364   } // end of if(...)
12365  } // end of {
12366  f5pCumulants->SetBinContent(53,f5pCorrelations->GetBinContent(53)-2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(3));  
12367  { 
12368   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
12369   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
12370   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
12371   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
12372   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
12373   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
12374   Double_t dSumWLinearFive5n3n3n3n2n = 0.; // sum of linear event weights for <4>
12375   Double_t dSumWQuadraticFive5n3n3n3n2n = 0.; // sum of quadratic event weights <4>
12376   Double_t dSpreadFive5n3n3n3n2n = 0.; // weighted and biased estimator for sigma of <4>
12377   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12378   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12379   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
12380   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12381   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12382   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
12383   dSumWLinearFive5n3n3n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12384   dSumWQuadraticFive5n3n3n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12385   dSpreadFive5n3n3n3n2n = f5pCorrelations->GetBinError(53);
12386   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
12387      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
12388      pow(dSumWLinearFive5n3n3n3n2n,2.)>dSumWQuadraticFive5n3n3n3n2n)
12389   {
12390    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(7),2.)
12391                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
12392                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
12393                    + 4.*pow(f2pCorrelations->GetBinContent(3),2.)
12394                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
12395                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
12396                    + pow((pow(dSumWQuadraticFive5n3n3n3n2n,0.5)/dSumWLinearFive5n3n3n3n2n)
12397                    * dSpreadFive5n3n3n3n2n*pow(pow(dSumWLinearFive5n3n3n3n2n,2.)/(pow(dSumWLinearFive5n3n3n3n2n,2.)-dSumWQuadraticFive5n3n3n3n2n),0.5),2.)
12398                    + 4.*2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(3)
12399                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12400                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,12)) 
12401                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(7))
12402                    / (dSumWLinearTwo3n3n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12403                    - 2.*2.*f3pCorrelations->GetBinContent(7)
12404                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12405                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,107))
12406                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(53))
12407                    / (dSumWLinearTwo3n3n*dSumWLinearFive5n3n3n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12408                    - 2.*2.*f2pCorrelations->GetBinContent(3)
12409                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12410                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,107))
12411                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(53))
12412                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n3n3n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12413    if(dError>0.)
12414    {
12415     f5pCumulants->SetBinError(53,pow(dError,0.5)); 
12416    }
12417   } // end of if(...)
12418  } // end of {
12419  f5pCumulants->SetBinContent(54,f5pCorrelations->GetBinContent(54)-2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(1)); 
12420  { 
12421   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
12422   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
12423   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
12424   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
12425   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
12426   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
12427   Double_t dSumWLinearFive5n1n4n1n1n = 0.; // sum of linear event weights for <4>
12428   Double_t dSumWQuadraticFive5n1n4n1n1n = 0.; // sum of quadratic event weights <4>
12429   Double_t dSpreadFive5n1n4n1n1n = 0.; // weighted and biased estimator for sigma of <4>
12430   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12431   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12432   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
12433   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12434   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12435   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
12436   dSumWLinearFive5n1n4n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12437   dSumWQuadraticFive5n1n4n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12438   dSpreadFive5n1n4n1n1n = f5pCorrelations->GetBinError(54);
12439   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
12440      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
12441      pow(dSumWLinearFive5n1n4n1n1n,2.)>dSumWQuadraticFive5n1n4n1n1n)
12442   {
12443    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(8),2.)
12444                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
12445                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
12446                    + 4.*pow(f2pCorrelations->GetBinContent(1),2.)
12447                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
12448                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
12449                    + pow((pow(dSumWQuadraticFive5n1n4n1n1n,0.5)/dSumWLinearFive5n1n4n1n1n)
12450                    * dSpreadFive5n1n4n1n1n*pow(pow(dSumWLinearFive5n1n4n1n1n,2.)/(pow(dSumWLinearFive5n1n4n1n1n,2.)-dSumWQuadraticFive5n1n4n1n1n),0.5),2.)
12451                    + 4.*2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(1)
12452                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12453                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,13)) 
12454                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(8))
12455                    / (dSumWLinearTwo1n1n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12456                    - 2.*2.*f3pCorrelations->GetBinContent(8)
12457                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12458                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,108))
12459                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(54))
12460                    / (dSumWLinearTwo1n1n*dSumWLinearFive5n1n4n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12461                    - 2.*2.*f2pCorrelations->GetBinContent(1)
12462                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12463                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,108))
12464                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(54))
12465                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n1n4n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12466    if(dError>0.)
12467    {
12468     f5pCumulants->SetBinError(54,pow(dError,0.5)); 
12469    }
12470   } // end of if(...)
12471  } // end of {
12472
12473  f5pCumulants->SetBinContent(55,f5pCorrelations->GetBinContent(55));
12474  {
12475   Double_t dSumWLinear = 0.; // sum of linear event weights
12476   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12477   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12478   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12479   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12480   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12481   dSpread = f5pCorrelations->GetBinError(55);
12482   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12483   {
12484    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12485    f5pCumulants->SetBinError(55,dError); 
12486   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12487  } 
12488  f5pCumulants->SetBinContent(56,f5pCorrelations->GetBinContent(56)-2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(4));
12489  { 
12490   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
12491   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
12492   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
12493   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
12494   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
12495   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
12496   Double_t dSumWLinearFive5n4n4n4n1n = 0.; // sum of linear event weights for <4>
12497   Double_t dSumWQuadraticFive5n4n4n4n1n = 0.; // sum of quadratic event weights <4>
12498   Double_t dSpreadFive5n4n4n4n1n = 0.; // weighted and biased estimator for sigma of <4>
12499   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12500   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12501   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
12502   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12503   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12504   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
12505   dSumWLinearFive5n4n4n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12506   dSumWQuadraticFive5n4n4n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12507   dSpreadFive5n4n4n4n1n = f5pCorrelations->GetBinError(56);
12508   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
12509      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
12510      pow(dSumWLinearFive5n4n4n4n1n,2.)>dSumWQuadraticFive5n4n4n4n1n)
12511   {
12512    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(8),2.)
12513                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
12514                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
12515                    + 4.*pow(f2pCorrelations->GetBinContent(4),2.)
12516                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
12517                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
12518                    + pow((pow(dSumWQuadraticFive5n4n4n4n1n,0.5)/dSumWLinearFive5n4n4n4n1n)
12519                    * dSpreadFive5n4n4n4n1n*pow(pow(dSumWLinearFive5n4n4n4n1n,2.)/(pow(dSumWLinearFive5n4n4n4n1n,2.)-dSumWQuadraticFive5n4n4n4n1n),0.5),2.)
12520                    + 4.*2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(4)
12521                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12522                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,13)) 
12523                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(8))
12524                    / (dSumWLinearTwo4n4n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12525                    - 2.*2.*f3pCorrelations->GetBinContent(8)
12526                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12527                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,110))
12528                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(56))
12529                    / (dSumWLinearTwo4n4n*dSumWLinearFive5n4n4n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12530                    - 2.*2.*f2pCorrelations->GetBinContent(4)
12531                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12532                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,110))
12533                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(56))
12534                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n4n4n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12535    if(dError>0.)
12536    {
12537     f5pCumulants->SetBinError(56,pow(dError,0.5)); 
12538    }
12539   } // end of if(...)
12540  } // end of {
12541  f5pCumulants->SetBinContent(57,f5pCorrelations->GetBinContent(57));
12542  {
12543   Double_t dSumWLinear = 0.; // sum of linear event weights
12544   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12545   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12546   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12547   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12548   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12549   dSpread = f5pCorrelations->GetBinError(57);
12550   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12551   {
12552    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12553    f5pCumulants->SetBinError(57,dError); 
12554   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12555  } 
12556  f5pCumulants->SetBinContent(58,f5pCorrelations->GetBinContent(58));
12557  {
12558   Double_t dSumWLinear = 0.; // sum of linear event weights
12559   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12560   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12561   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12562   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12563   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12564   dSpread = f5pCorrelations->GetBinError(58);
12565   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12566   {
12567    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12568    f5pCumulants->SetBinError(58,dError); 
12569   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12570  } 
12571  f5pCumulants->SetBinContent(59,f5pCorrelations->GetBinContent(59)-2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(5));  
12572  { 
12573   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
12574   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
12575   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
12576   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
12577   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
12578   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
12579   Double_t dSumWLinearFive5n5n5n3n2n = 0.; // sum of linear event weights for <4>
12580   Double_t dSumWQuadraticFive5n5n5n3n2n = 0.; // sum of quadratic event weights <4>
12581   Double_t dSpreadFive5n5n5n3n2n = 0.; // weighted and biased estimator for sigma of <4>
12582   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12583   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12584   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
12585   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12586   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12587   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
12588   dSumWLinearFive5n5n5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12589   dSumWQuadraticFive5n5n5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12590   dSpreadFive5n5n5n3n2n = f5pCorrelations->GetBinError(59);
12591   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
12592      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
12593      pow(dSumWLinearFive5n5n5n3n2n,2.)>dSumWQuadraticFive5n5n5n3n2n)
12594   {
12595    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(7),2.)
12596                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
12597                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
12598                    + 4.*pow(f2pCorrelations->GetBinContent(5),2.)
12599                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
12600                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
12601                    + pow((pow(dSumWQuadraticFive5n5n5n3n2n,0.5)/dSumWLinearFive5n5n5n3n2n)
12602                    * dSpreadFive5n5n5n3n2n*pow(pow(dSumWLinearFive5n5n5n3n2n,2.)/(pow(dSumWLinearFive5n5n5n3n2n,2.)-dSumWQuadraticFive5n5n5n3n2n),0.5),2.)
12603                    + 4.*2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(5)
12604                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12605                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,12)) 
12606                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(7))
12607                    / (dSumWLinearTwo5n5n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12608                    - 2.*2.*f3pCorrelations->GetBinContent(7)
12609                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12610                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,113))
12611                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(59))
12612                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n5n5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12613                    - 2.*2.*f2pCorrelations->GetBinContent(5)
12614                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12615                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,113))
12616                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(59))
12617                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n5n5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12618    if(dError>0.)
12619    {
12620     f5pCumulants->SetBinError(59,pow(dError,0.5)); 
12621    }
12622   } // end of if(...)
12623  } // end of {
12624  f5pCumulants->SetBinContent(60,f5pCorrelations->GetBinContent(60)-2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(5));  
12625  { 
12626   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
12627   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
12628   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
12629   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
12630   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
12631   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
12632   Double_t dSumWLinearFive5n5n5n4n1n = 0.; // sum of linear event weights for <4>
12633   Double_t dSumWQuadraticFive5n5n5n4n1n = 0.; // sum of quadratic event weights <4>
12634   Double_t dSpreadFive5n5n5n4n1n = 0.; // weighted and biased estimator for sigma of <4>
12635   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12636   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12637   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
12638   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12639   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12640   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
12641   dSumWLinearFive5n5n5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12642   dSumWQuadraticFive5n5n5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12643   dSpreadFive5n5n5n4n1n = f5pCorrelations->GetBinError(60);
12644   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
12645      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
12646      pow(dSumWLinearFive5n5n5n4n1n,2.)>dSumWQuadraticFive5n5n5n4n1n)
12647   {
12648    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(8),2.)
12649                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
12650                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
12651                    + 4.*pow(f2pCorrelations->GetBinContent(5),2.)
12652                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
12653                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
12654                    + pow((pow(dSumWQuadraticFive5n5n5n4n1n,0.5)/dSumWLinearFive5n5n5n4n1n)
12655                    * dSpreadFive5n5n5n4n1n*pow(pow(dSumWLinearFive5n5n5n4n1n,2.)/(pow(dSumWLinearFive5n5n5n4n1n,2.)-dSumWQuadraticFive5n5n5n4n1n),0.5),2.)
12656                    + 4.*2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(5)
12657                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12658                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,13)) 
12659                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(8))
12660                    / (dSumWLinearTwo5n5n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12661                    - 2.*2.*f3pCorrelations->GetBinContent(8)
12662                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12663                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,114))
12664                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(60))
12665                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n5n5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12666                    - 2.*2.*f2pCorrelations->GetBinContent(5)
12667                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12668                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,114))
12669                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(60))
12670                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n5n5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12671    if(dError>0.)
12672    {
12673     f5pCumulants->SetBinError(60,pow(dError,0.5)); 
12674    }
12675   } // end of if(...)
12676  } // end of {
12677  f5pCumulants->SetBinContent(61,f5pCorrelations->GetBinContent(61));
12678  {
12679   Double_t dSumWLinear = 0.; // sum of linear event weights
12680   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12681   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12682   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12683   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12684   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12685   dSpread = f5pCorrelations->GetBinError(61);
12686   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12687   {
12688    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12689    f5pCumulants->SetBinError(61,dError); 
12690   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12691  } 
12692  f5pCumulants->SetBinContent(62,f5pCorrelations->GetBinContent(62));
12693  {
12694   Double_t dSumWLinear = 0.; // sum of linear event weights
12695   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12696   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12697   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12698   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12699   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12700   dSpread = f5pCorrelations->GetBinError(62);
12701   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12702   {
12703    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12704    f5pCumulants->SetBinError(62,dError); 
12705   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12706  } 
12707  f5pCumulants->SetBinContent(63,f5pCorrelations->GetBinContent(63));
12708  {
12709   Double_t dSumWLinear = 0.; // sum of linear event weights
12710   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12711   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12712   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12713   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12714   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12715   dSpread = f5pCorrelations->GetBinError(63);
12716   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12717   {
12718    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12719    f5pCumulants->SetBinError(63,dError); 
12720   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12721  } 
12722  f5pCumulants->SetBinContent(64,f5pCorrelations->GetBinContent(64)-2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(1));  
12723  { 
12724   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
12725   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
12726   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
12727   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
12728   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
12729   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
12730   Double_t dSumWLinearFive6n1n5n1n1n = 0.; // sum of linear event weights for <4>
12731   Double_t dSumWQuadraticFive6n1n5n1n1n = 0.; // sum of quadratic event weights <4>
12732   Double_t dSpreadFive6n1n5n1n1n = 0.; // weighted and biased estimator for sigma of <4>
12733   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12734   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12735   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
12736   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12737   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12738   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
12739   dSumWLinearFive6n1n5n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12740   dSumWQuadraticFive6n1n5n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12741   dSpreadFive6n1n5n1n1n = f5pCorrelations->GetBinError(64);
12742   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
12743      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
12744      pow(dSumWLinearFive6n1n5n1n1n,2.)>dSumWQuadraticFive6n1n5n1n1n)
12745   {
12746    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(10),2.)
12747                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
12748                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
12749                    + 4.*pow(f2pCorrelations->GetBinContent(1),2.)
12750                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
12751                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
12752                    + pow((pow(dSumWQuadraticFive6n1n5n1n1n,0.5)/dSumWLinearFive6n1n5n1n1n)
12753                    * dSpreadFive6n1n5n1n1n*pow(pow(dSumWLinearFive6n1n5n1n1n,2.)/(pow(dSumWLinearFive6n1n5n1n1n,2.)-dSumWQuadraticFive6n1n5n1n1n),0.5),2.)
12754                    + 4.*2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(1)
12755                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12756                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,15)) 
12757                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(10))
12758                    / (dSumWLinearTwo1n1n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12759                    - 2.*2.*f3pCorrelations->GetBinContent(10)
12760                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12761                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,118))
12762                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(64))
12763                    / (dSumWLinearTwo1n1n*dSumWLinearFive6n1n5n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12764                    - 2.*2.*f2pCorrelations->GetBinContent(1)
12765                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12766                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,118))
12767                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(64))
12768                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n1n5n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12769    if(dError>0.)
12770    {
12771     f5pCumulants->SetBinError(64,pow(dError,0.5)); 
12772    }
12773   } // end of if(...)
12774  } // end of {
12775  f5pCumulants->SetBinContent(65,f5pCorrelations->GetBinContent(65)-2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(2));  
12776  { 
12777   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
12778   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
12779   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
12780   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
12781   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
12782   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
12783   Double_t dSumWLinearFive6n2n4n2n2n = 0.; // sum of linear event weights for <4>
12784   Double_t dSumWQuadraticFive6n2n4n2n2n = 0.; // sum of quadratic event weights <4>
12785   Double_t dSpreadFive6n2n4n2n2n = 0.; // weighted and biased estimator for sigma of <4>
12786   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12787   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12788   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
12789   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12790   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12791   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
12792   dSumWLinearFive6n2n4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12793   dSumWQuadraticFive6n2n4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12794   dSpreadFive6n2n4n2n2n = f5pCorrelations->GetBinError(65);
12795   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
12796      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
12797      pow(dSumWLinearFive6n2n4n2n2n,2.)>dSumWQuadraticFive6n2n4n2n2n)
12798   {
12799    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(9),2.)
12800                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
12801                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
12802                    + 4.*pow(f2pCorrelations->GetBinContent(2),2.)
12803                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
12804                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
12805                    + pow((pow(dSumWQuadraticFive6n2n4n2n2n,0.5)/dSumWLinearFive6n2n4n2n2n)
12806                    * dSpreadFive6n2n4n2n2n*pow(pow(dSumWLinearFive6n2n4n2n2n,2.)/(pow(dSumWLinearFive6n2n4n2n2n,2.)-dSumWQuadraticFive6n2n4n2n2n),0.5),2.)
12807                    + 4.*2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(2)
12808                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12809                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,14)) 
12810                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(9))
12811                    / (dSumWLinearTwo2n2n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12812                    - 2.*2.*f3pCorrelations->GetBinContent(9)
12813                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12814                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,119))
12815                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(65))
12816                    / (dSumWLinearTwo2n2n*dSumWLinearFive6n2n4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12817                    - 2.*2.*f2pCorrelations->GetBinContent(2)
12818                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12819                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,119))
12820                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(65))
12821                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n2n4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12822    if(dError>0.)
12823    {
12824     f5pCumulants->SetBinError(65,pow(dError,0.5)); 
12825    }
12826   } // end of if(...)
12827  } // end of {
12828  f5pCumulants->SetBinContent(66,f5pCorrelations->GetBinContent(66)-2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(4));
12829  { 
12830   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
12831   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
12832   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
12833   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
12834   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
12835   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
12836   Double_t dSumWLinearFive6n4n4n4n2n = 0.; // sum of linear event weights for <4>
12837   Double_t dSumWQuadraticFive6n4n4n4n2n = 0.; // sum of quadratic event weights <4>
12838   Double_t dSpreadFive6n4n4n4n2n = 0.; // weighted and biased estimator for sigma of <4>
12839   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12840   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12841   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
12842   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12843   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12844   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
12845   dSumWLinearFive6n4n4n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12846   dSumWQuadraticFive6n4n4n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12847   dSpreadFive6n4n4n4n2n = f5pCorrelations->GetBinError(66);
12848   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
12849      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
12850      pow(dSumWLinearFive6n4n4n4n2n,2.)>dSumWQuadraticFive6n4n4n4n2n)
12851   {
12852    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(9),2.)
12853                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
12854                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
12855                    + 4.*pow(f2pCorrelations->GetBinContent(4),2.)
12856                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
12857                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
12858                    + pow((pow(dSumWQuadraticFive6n4n4n4n2n,0.5)/dSumWLinearFive6n4n4n4n2n)
12859                    * dSpreadFive6n4n4n4n2n*pow(pow(dSumWLinearFive6n4n4n4n2n,2.)/(pow(dSumWLinearFive6n4n4n4n2n,2.)-dSumWQuadraticFive6n4n4n4n2n),0.5),2.)
12860                    + 4.*2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(4)
12861                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12862                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,14)) 
12863                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(9))
12864                    / (dSumWLinearTwo4n4n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12865                    - 2.*2.*f3pCorrelations->GetBinContent(9)
12866                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12867                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,120))
12868                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(66))
12869                    / (dSumWLinearTwo4n4n*dSumWLinearFive6n4n4n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12870                    - 2.*2.*f2pCorrelations->GetBinContent(4)
12871                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12872                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,120))
12873                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(66))
12874                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n4n4n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12875    if(dError>0.)
12876    {
12877     f5pCumulants->SetBinError(66,pow(dError,0.5)); 
12878    }
12879   } // end of if(...)
12880  } // end of {  
12881  f5pCumulants->SetBinContent(67,f5pCorrelations->GetBinContent(67));
12882  {
12883   Double_t dSumWLinear = 0.; // sum of linear event weights
12884   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12885   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12886   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12887   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12888   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12889   dSpread = f5pCorrelations->GetBinError(67);
12890   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12891   {
12892    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12893    f5pCumulants->SetBinError(67,dError); 
12894   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12895  }  
12896  f5pCumulants->SetBinContent(68,f5pCorrelations->GetBinContent(68)-2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(5));  
12897  { 
12898   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
12899   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
12900   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
12901   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
12902   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
12903   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
12904   Double_t dSumWLinearFive6n5n5n5n1n = 0.; // sum of linear event weights for <4>
12905   Double_t dSumWQuadraticFive6n5n5n5n1n = 0.; // sum of quadratic event weights <4>
12906   Double_t dSpreadFive6n5n5n5n1n = 0.; // weighted and biased estimator for sigma of <4>
12907   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12908   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12909   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
12910   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12911   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12912   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
12913   dSumWLinearFive6n5n5n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12914   dSumWQuadraticFive6n5n5n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12915   dSpreadFive6n5n5n5n1n = f5pCorrelations->GetBinError(68);
12916   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
12917      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
12918      pow(dSumWLinearFive6n5n5n5n1n,2.)>dSumWQuadraticFive6n5n5n5n1n)
12919   {
12920    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(10),2.)
12921                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
12922                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
12923                    + 4.*pow(f2pCorrelations->GetBinContent(5),2.)
12924                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
12925                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
12926                    + pow((pow(dSumWQuadraticFive6n5n5n5n1n,0.5)/dSumWLinearFive6n5n5n5n1n)
12927                    * dSpreadFive6n5n5n5n1n*pow(pow(dSumWLinearFive6n5n5n5n1n,2.)/(pow(dSumWLinearFive6n5n5n5n1n,2.)-dSumWQuadraticFive6n5n5n5n1n),0.5),2.)
12928                    + 4.*2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(5)
12929                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12930                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,15)) 
12931                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(10))
12932                    / (dSumWLinearTwo5n5n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12933                    - 2.*2.*f3pCorrelations->GetBinContent(10)
12934                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12935                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,122))
12936                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(68))
12937                    / (dSumWLinearTwo5n5n*dSumWLinearFive6n5n5n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12938                    - 2.*2.*f2pCorrelations->GetBinContent(5)
12939                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12940                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,122))
12941                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(68))
12942                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n5n5n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12943    if(dError>0.)
12944    {
12945     f5pCumulants->SetBinError(68,pow(dError,0.5)); 
12946    }
12947   } // end of if(...)
12948  } // end of {
12949  f5pCumulants->SetBinContent(69,f5pCorrelations->GetBinContent(69));
12950  {
12951   Double_t dSumWLinear = 0.; // sum of linear event weights
12952   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12953   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12954   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12955   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12956   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12957   dSpread = f5pCorrelations->GetBinError(69);
12958   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12959   {
12960    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12961    f5pCumulants->SetBinError(69,dError); 
12962   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12963  } 
12964  f5pCumulants->SetBinContent(70,f5pCorrelations->GetBinContent(70)-2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(6));  
12965  { 
12966   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
12967   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
12968   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
12969   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
12970   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
12971   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
12972   Double_t dSumWLinearFive6n6n6n4n2n = 0.; // sum of linear event weights for <4>
12973   Double_t dSumWQuadraticFive6n6n6n4n2n = 0.; // sum of quadratic event weights <4>
12974   Double_t dSpreadFive6n6n6n4n2n = 0.; // weighted and biased estimator for sigma of <4>
12975   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12976   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12977   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
12978   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12979   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12980   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
12981   dSumWLinearFive6n6n6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12982   dSumWQuadraticFive6n6n6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12983   dSpreadFive6n6n6n4n2n = f5pCorrelations->GetBinError(70);
12984   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
12985      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
12986      pow(dSumWLinearFive6n6n6n4n2n,2.)>dSumWQuadraticFive6n6n6n4n2n)
12987   {
12988    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(9),2.)
12989                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
12990                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
12991                    + 4.*pow(f2pCorrelations->GetBinContent(6),2.)
12992                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
12993                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
12994                    + pow((pow(dSumWQuadraticFive6n6n6n4n2n,0.5)/dSumWLinearFive6n6n6n4n2n)
12995                    * dSpreadFive6n6n6n4n2n*pow(pow(dSumWLinearFive6n6n6n4n2n,2.)/(pow(dSumWLinearFive6n6n6n4n2n,2.)-dSumWQuadraticFive6n6n6n4n2n),0.5),2.)
12996                    + 4.*2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(6)
12997                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12998                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,14)) 
12999                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(9))
13000                    / (dSumWLinearTwo6n6n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
13001                    - 2.*2.*f3pCorrelations->GetBinContent(9)
13002                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
13003                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,124))
13004                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(70))
13005                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n6n6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
13006                    - 2.*2.*f2pCorrelations->GetBinContent(6)
13007                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
13008                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,124))
13009                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(70))
13010                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n6n6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
13011    if(dError>0.)
13012    {
13013     f5pCumulants->SetBinError(70,pow(dError,0.5)); 
13014    }
13015   } // end of if(...)
13016  } // end of {
13017
13018
13019
13020
13021
13022  f5pCumulants->SetBinContent(71,f5pCorrelations->GetBinContent(71)-2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(6));  
13023  { 
13024   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
13025   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
13026   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
13027   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
13028   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
13029   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
13030   Double_t dSumWLinearFive6n6n6n5n1n = 0.; // sum of linear event weights for <4>
13031   Double_t dSumWQuadraticFive6n6n6n5n1n = 0.; // sum of quadratic event weights <4>
13032   Double_t dSpreadFive6n6n6n5n1n = 0.; // weighted and biased estimator for sigma of <4>
13033   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
13034   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
13035   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
13036   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
13037   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
13038   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
13039   dSumWLinearFive6n6n6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
13040   dSumWQuadraticFive6n6n6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
13041   dSpreadFive6n6n6n5n1n = f5pCorrelations->GetBinError(71);
13042   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
13043      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
13044      pow(dSumWLinearFive6n6n6n5n1n,2.)>dSumWQuadraticFive6n6n6n5n1n)
13045   {
13046    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(10),2.)
13047                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
13048                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
13049                    + 4.*pow(f2pCorrelations->GetBinContent(6),2.)
13050                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
13051                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
13052                    + pow((pow(dSumWQuadraticFive6n6n6n5n1n,0.5)/dSumWLinearFive6n6n6n5n1n)
13053                    * dSpreadFive6n6n6n5n1n*pow(pow(dSumWLinearFive6n6n6n5n1n,2.)/(pow(dSumWLinearFive6n6n6n5n1n,2.)-dSumWQuadraticFive6n6n6n5n1n),0.5),2.)
13054                    + 4.*2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(6)
13055                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
13056                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,15)) 
13057                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(10))
13058                    / (dSumWLinearTwo6n6n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
13059                    - 2.*2.*f3pCorrelations->GetBinContent(10)
13060                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
13061                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,125))
13062                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(71))
13063                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n6n6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
13064                    - 2.*2.*f2pCorrelations->GetBinContent(6)
13065                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
13066                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,125))
13067                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(71))
13068                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n6n6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
13069    if(dError>0.)
13070    {
13071     f5pCumulants->SetBinError(71,pow(dError,0.5)); 
13072    }
13073   } // end of if(...)
13074  } // end of {
13075  // d3) "Four distinct harmonics":
13076  for(Int_t b=73;b<=83;b++)
13077  {
13078   f5pCumulants->SetBinContent(b,f5pCorrelations->GetBinContent(b));
13079   Double_t dSumWLinear = 0.; // sum of linear event weights
13080   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
13081   Double_t dSpread = 0.; // weighted and biased estimator for sigma
13082   Double_t dError = 0.; // weighted and unbiased estimator for sigma
13083   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
13084   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
13085   dSpread = f5pCorrelations->GetBinError(b);
13086   if(pow(dSumWLinear,2.)>dSumWQuadratic)
13087   {
13088    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
13089    f5pCumulants->SetBinError(b,dError); 
13090   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
13091  } // end of for(Int_t b=73;b<=83;b++)
13092  // d4) "Five distinct harmonics":
13093  for(Int_t b=85;b<=87;b++)
13094  {
13095   f5pCumulants->SetBinContent(b,f5pCorrelations->GetBinContent(b));
13096   Double_t dSumWLinear = 0.; // sum of linear event weights
13097   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
13098   Double_t dSpread = 0.; // weighted and biased estimator for sigma
13099   Double_t dError = 0.; // weighted and unbiased estimator for sigma
13100   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
13101   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
13102   dSpread = f5pCorrelations->GetBinError(b);
13103   if(pow(dSumWLinear,2.)>dSumWQuadratic)
13104   {
13105    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
13106    f5pCumulants->SetBinError(b,dError); 
13107   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
13108  } // end of for(Int_t b=85;b<=87;b++)
13109
13110 } // end of void AliFlowAnalysisWithQCumulants::CalculateCumulantsMixedHarmonics()
13111
13112 //===================================================================================================================
13113
13114 void AliFlowAnalysisWithQCumulants::StorePhiDistributionForOneEvent(AliFlowEventSimple *anEvent)
13115 {
13116  // Store phi distribution for one event to illustrate flow.
13117  
13118  if(fPhiDistributionForOneEvent->GetEntries()>0){return;} // store only phi distribution for one event
13119  
13120  Double_t vMin = fPhiDistributionForOneEventSettings[0]; 
13121  Double_t vMax = fPhiDistributionForOneEventSettings[1]; 
13122  Double_t refMultMin = fPhiDistributionForOneEventSettings[2]; 
13123  Double_t refMultMax = fPhiDistributionForOneEventSettings[3]; 
13124  
13125  Double_t vEBE = 0.;
13126  Double_t cumulant4thEBE = fIntFlowCorrelationsEBE->GetBinContent(2)-2.*pow(fIntFlowCorrelationsEBE->GetBinContent(1),2.);
13127  if(cumulant4thEBE<0.)
13128  {
13129   vEBE = pow(-1.*cumulant4thEBE,0.25);
13130   if((vEBE>vMin && vEBE<vMax) && (fReferenceMultiplicityEBE>refMultMin && fReferenceMultiplicityEBE<refMultMax))
13131   {
13132    fPhiDistributionForOneEvent->SetTitle(Form("v_{%i} = %f",fHarmonic,vEBE));
13133    for(Int_t p=0;p<anEvent->NumberOfTracks();p++)
13134    {
13135     if(anEvent->GetTrack(p)->InRPSelection())
13136     {
13137      fPhiDistributionForOneEvent->Fill(anEvent->GetTrack(p)->Phi());
13138     }
13139    } // end of for(Int_t p=0;p<anEvent->NumberOfTracks();p++)
13140   } else
13141     {
13142      fPhiDistributionForOneEvent->SetTitle(Form("v_{%i} = %f, out of specified boundaries",fHarmonic,vEBE));  
13143     } 
13144    
13145  } // end of if(cumulant4thEBE<0.)
13146  
13147 } // end of void AliFlowAnalysisWithQCumulants::StorePhiDistributionForOneEvent(AliFlowEventSimple *anEvent)
13148
13149 //===================================================================================================================
13150
13151 void AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrelations()
13152 {
13153  // Calculate averages of products of correlations for integrated flow.
13154
13155  // Multiplicity bin of an event (relevant for all histos vs M): 
13156  Double_t dMultiplicityBin = 0.;
13157  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
13158  {
13159   dMultiplicityBin = fNumberOfRPsEBE+0.5;
13160  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
13161    {
13162     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
13163    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
13164      {
13165       dMultiplicityBin = fNumberOfPOIsEBE+0.5;
13166      }
13167
13168  Int_t counter = 0;
13169  
13170  for(Int_t ci1=1;ci1<4;ci1++)
13171  {
13172   for(Int_t ci2=ci1+1;ci2<=4;ci2++)
13173   {
13174    fIntFlowProductOfCorrelationsPro->Fill(0.5+counter,
13175                                           fIntFlowCorrelationsEBE->GetBinContent(ci1)*
13176                                           fIntFlowCorrelationsEBE->GetBinContent(ci2),
13177                                           fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci1)*
13178                                           fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci2));
13179    // products versus multiplicity:  // [0=<<2><4>>,1=<<2><6>>,2=<<2><8>>,3=<<4><6>>,4=<<4><8>>,5=<<6><8>>]
13180    if(fCalculateCumulantsVsM)
13181    {
13182     if(fFillProfilesVsMUsingWeights) 
13183     {
13184      fIntFlowProductOfCorrelationsVsMPro[counter]->Fill(dMultiplicityBin, // to be improved: dMult => sum of weights ?
13185                                                         fIntFlowCorrelationsEBE->GetBinContent(ci1)*
13186                                                         fIntFlowCorrelationsEBE->GetBinContent(ci2),
13187                                                         fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci1)*
13188                                                         fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci2));
13189     } else
13190       {
13191        fIntFlowProductOfCorrelationsVsMPro[counter]->Fill(dMultiplicityBin, // to be improved: dMult => sum of weights ?
13192                                                           fIntFlowCorrelationsEBE->GetBinContent(ci1)*
13193                                                           fIntFlowCorrelationsEBE->GetBinContent(ci2));
13194       }
13195    } // end of if(fCalculateCumulantsVsM)
13196    counter++;                                                                                                                        
13197   }
13198  }
13199  
13200 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrelations()
13201
13202
13203 //=======================================================================================================================
13204
13205
13206 void AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrectionTermsForNUA()
13207 {
13208  // Calculate averages of products of correction terms for NUA.
13209  
13210  // a) Binning of fIntFlowProductOfCorrectionTermsForNUAPro is organized as follows:
13211  //     1st bin: <<2><cos(phi)>> 
13212  //     2nd bin: <<2><sin(phi)>>
13213  //     3rd bin: <<cos(phi)><sin(phi)>>
13214  //     4th bin: <<2><cos(phi1+phi2)>> 
13215  //     5th bin: <<2><sin(phi1+phi2)>>
13216  //     6th bin: <<2><cos(phi1-phi2-phi3)>> 
13217  //     7th bin: <<2><sin(phi1-phi2-phi3)>>
13218  //     8th bin: <<4><cos(phi1)>>
13219  //     9th bin: <<4><sin(phi1)>>
13220  //    10th bin: <<4><cos(phi1+phi2)>>
13221  //    11th bin: <<4><sin(phi1+phi2)>>
13222  //    12th bin: <<4><cos(phi1-phi2-phi3)>>
13223  //    13th bin: <<4><sin(phi1-phi2-phi3)>>
13224  //    14th bin: <<cos(phi1)><cos(phi1+phi2)>>
13225  //    15th bin: <<cos(phi1)><sin(phi1+phi2)>> 
13226  //    16th bin: <<cos(phi1)><cos(phi1-phi2-phi3)>>
13227  //    17th bin: <<cos(phi1)><sin(phi1-phi2-phi3)>> 
13228  //    18th bin: <<sin(phi1)><cos(phi1+phi2)>>
13229  //    19th bin: <<sin(phi1)><sin(phi1+phi2)>> 
13230  //    20th bin: <<sin(phi1)><cos(phi1-phi2-phi3)>>
13231  //    21st bin: <<sin(phi1)><sin(phi1-phi2-phi3)>>
13232  //    22nd bin: <<cos(phi1+phi2)><sin(phi1+phi2)>>
13233  //    23rd bin: <<cos(phi1+phi2)><cos(phi1-phi2-phi3)>>
13234  //    24th bin: <<cos(phi1+phi2)><sin(phi1-phi2-phi3)>>
13235  //    25th bin: <<sin(phi1+phi2)><cos(phi1-phi2-phi3)>>
13236  //    26th bin: <<sin(phi1+phi2)><sin(phi1-phi2-phi3)>>
13237  //    27th bin: <<cos(phi1-phi2-phi3)><sin(phi1-phi2-phi3)>>
13238  
13239  // <<2><cos(phi)>>:
13240  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(0.5,
13241                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1),
13242                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
13243                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1));
13244  // <<2><sin(phi)>>:
13245  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(1.5,
13246                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1),
13247                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
13248                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
13249  // <<cos(phi)><sin(phi)>>:
13250  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(2.5,
13251                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1),
13252                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
13253                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
13254  // <<2><cos(phi1+phi2)>>:
13255  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(3.5,
13256                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2),
13257                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
13258                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
13259  // <<2><sin(phi1+phi2)>>:
13260  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(4.5,
13261                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
13262                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
13263                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
13264  // <<2><cos(phi1-phi2-phi3)>>:
13265  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(5.5,
13266                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
13267                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
13268                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
13269  // <<2><sin(phi1-phi2-phi3)>>:
13270  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(6.5,
13271                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
13272                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
13273                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
13274  // <<4><cos(phi1)>>:
13275  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(7.5,
13276                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1),
13277                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
13278                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1));
13279  // <<4><sin(phi1)>>:
13280  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(8.5,
13281                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1),
13282                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
13283                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
13284  // <<4><cos(phi1+phi2)>>:
13285  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(9.5,
13286                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2),
13287                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
13288                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
13289  // <<4><sin(phi1+phi2)>>:
13290  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(10.5,
13291                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
13292                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
13293                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));
13294  // <<4><cos(phi1-phi2-phi3)>>:
13295  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(11.5,
13296                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
13297                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
13298                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
13299  // <<4><sin(phi1-phi2-phi3)>>:
13300  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(12.5,
13301                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
13302                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
13303                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));   
13304  // <<cos(phi1)><cos(phi1+phi2)>>:
13305  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(13.5,
13306                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2),
13307                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
13308                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
13309  // <<cos(phi1)><sin(phi1+phi2)>>: 
13310  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(14.5,
13311                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
13312                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
13313                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
13314  // <<cos(phi1)><cos(phi1-phi2-phi3)>>:
13315  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(15.5,
13316                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
13317                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
13318                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
13319  // <<cos(phi1)><sin(phi1-phi2-phi3)>>: 
13320  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(16.5,
13321                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
13322                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
13323                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));  
13324  // <<sin(phi1)><cos(phi1+phi2)>>:
13325  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(17.5,
13326                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2),
13327                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)
13328                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2));  
13329  // <<sin(phi1)><sin(phi1+phi2)>>: 
13330  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(18.5,
13331                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
13332                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)
13333                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));  
13334  // <<sin(phi1)><cos(phi1-phi2-phi3)>>:
13335  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(19.5,
13336                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
13337                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)
13338                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
13339  // <<sin(phi1)><sin(phi1-phi2-phi3)>>:
13340  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(20.5,
13341                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
13342                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)
13343                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
13344  // <<cos(phi1+phi2)><sin(phi1+phi2)>>:
13345  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(21.5,
13346                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
13347                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)
13348                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
13349  // <<cos(phi1+phi2)><cos(phi1-phi2-phi3)>>:
13350  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(22.5,
13351                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
13352                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)
13353                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));   
13354  // <<cos(phi1+phi2)><sin(phi1-phi2-phi3)>>:
13355  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(23.5,
13356                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
13357                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)
13358                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));    
13359  // <<sin(phi1+phi2)><cos(phi1-phi2-phi3)>>:
13360  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(24.5,
13361                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
13362                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)
13363                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));    
13364  // <<sin(phi1+phi2)><sin(phi1-phi2-phi3)>>:
13365  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(25.5,
13366                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
13367                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)
13368                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));    
13369  // <<cos(phi1-phi2-phi3)><sin(phi1-phi2-phi3)>>:
13370  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(26.5,
13371                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
13372                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)
13373                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));    
13374
13375 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrectionTermsForNUA()
13376
13377 //=======================================================================================================================
13378
13379 void AliFlowAnalysisWithQCumulants::CalculateCovariancesIntFlow()
13380 {
13381  // a) Calculate unbiased estimators Cov(<2>,<4>), Cov(<2>,<6>), Cov(<2>,<8>), Cov(<4>,<6>), Cov(<4>,<8>) and Cov(<6>,<8>)
13382  //    for covariances V_(<2>,<4>), V_(<2>,<6>), V_(<2>,<8>), V_(<4>,<6>), V_(<4>,<8>) and V_(<6>,<8>).
13383  // b) Store in histogram fIntFlowCovariances for instance the following: 
13384  //
13385  //             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)]
13386  // 
13387  //    where N is the number of events, w_{<2>} is event weight for <2> and w_{<4>} is event weight for <4>.
13388  // c) Binning of fIntFlowCovariances is organized as follows:
13389  // 
13390  //     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)] 
13391  //     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)]
13392  //     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)]
13393  //     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)]
13394  //     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)]
13395  //     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)]
13396  //
13397     
13398  // Average 2-, 4-, 6- and 8-particle correlations for all events:
13399  Double_t correlation[4] = {0.};
13400  for(Int_t ci=0;ci<4;ci++)
13401  {
13402   correlation[ci] = fIntFlowCorrelationsPro->GetBinContent(ci+1);
13403  } 
13404  // Average products of 2-, 4-, 6- and 8-particle correlations: 
13405  Double_t productOfCorrelations[4][4] = {{0.}};
13406  Int_t productOfCorrelationsLabel = 1;
13407  // Denominators in the expressions for the unbiased estimator for covariance:
13408  Double_t denominator[4][4] = {{0.}};
13409  Int_t sumOfProductOfEventWeightsLabel1 = 1;
13410  // Weight dependent prefactor which multiply unbiased estimators for covariances:
13411  Double_t wPrefactor[4][4] = {{0.}}; 
13412  Int_t sumOfProductOfEventWeightsLabel2 = 1;
13413  for(Int_t c1=0;c1<4;c1++)
13414  {
13415   for(Int_t c2=c1+1;c2<4;c2++)
13416   {
13417    productOfCorrelations[c1][c2] = fIntFlowProductOfCorrelationsPro->GetBinContent(productOfCorrelationsLabel);
13418    if(TMath::Abs(fIntFlowSumOfEventWeights[0]->GetBinContent(c1+1)) > 1.e-44 && TMath::Abs(fIntFlowSumOfEventWeights[0]->GetBinContent(c2+1)) > 1.e-44)
13419    {
13420     denominator[c1][c2] = 1.-(fIntFlowSumOfProductOfEventWeights->GetBinContent(sumOfProductOfEventWeightsLabel1))
13421                         / (fIntFlowSumOfEventWeights[0]->GetBinContent(c1+1) 
13422                         * fIntFlowSumOfEventWeights[0]->GetBinContent(c2+1));                              
13423     wPrefactor[c1][c2] = fIntFlowSumOfProductOfEventWeights->GetBinContent(sumOfProductOfEventWeightsLabel2)
13424                        / (fIntFlowSumOfEventWeights[0]->GetBinContent(c1+1)
13425                        * fIntFlowSumOfEventWeights[0]->GetBinContent(c2+1));                                                       
13426    }
13427    productOfCorrelationsLabel++; // to be improved - do I need here all 3 counters?
13428    sumOfProductOfEventWeightsLabel1++;
13429    sumOfProductOfEventWeightsLabel2++;  
13430   } // end of for(Int_t c2=c1+1;c2<4;c2++)
13431  } // end of for(Int_t c1=0;c1<4;c1++)
13432  
13433  Int_t covarianceLabel = 1;
13434  for(Int_t c1=0;c1<4;c1++)
13435  {
13436   for(Int_t c2=c1+1;c2<4;c2++)
13437   {
13438    if(TMath::Abs(denominator[c1][c2]) > 1.e-44)
13439    {
13440     // Covariances:
13441     Double_t cov = (productOfCorrelations[c1][c2]-correlation[c1]*correlation[c2])/denominator[c1][c2]; 
13442     // Covariances multiplied with weight dependent prefactor:
13443     Double_t wCov = cov * wPrefactor[c1][c2];
13444     fIntFlowCovariances->SetBinContent(covarianceLabel,wCov);
13445    }
13446    covarianceLabel++;
13447   } // end of for(Int_t c2=c1+1;c2<4;c2++) 
13448  } // end of for(Int_t c1=0;c1<4;c1++)
13449  
13450  // Versus multiplicity: 
13451  if(!fCalculateCumulantsVsM){return;}
13452  Int_t nBins = fIntFlowCorrelationsVsMPro[0]->GetNbinsX(); // to be improved (hardwired 0) 
13453  for(Int_t b=1;b<=nBins;b++)
13454  {
13455   // Average 2-, 4-, 6- and 8-particle correlations for all events:
13456   Double_t correlationVsM[4] = {0.};
13457   for(Int_t ci=0;ci<4;ci++)
13458   {
13459    correlationVsM[ci] = fIntFlowCorrelationsVsMPro[ci]->GetBinContent(b);
13460   } // end of for(Int_t ci=0;ci<4;ci++)
13461   // Average products of 2-, 4-, 6- and 8-particle correlations: 
13462   Double_t productOfCorrelationsVsM[4][4] = {{0.}};
13463   Int_t productOfCorrelationsLabelVsM = 1;
13464   // Denominators in the expressions for the unbiased estimator for covariance:
13465   Double_t denominatorVsM[4][4] = {{0.}};
13466   Int_t sumOfProductOfEventWeightsLabel1VsM = 1;
13467   // Weight dependent prefactor which multiply unbiased estimators for covariances:
13468   Double_t wPrefactorVsM[4][4] = {{0.}}; 
13469   Int_t sumOfProductOfEventWeightsLabel2VsM = 1;
13470   for(Int_t c1=0;c1<4;c1++)
13471   {
13472    for(Int_t c2=c1+1;c2<4;c2++)
13473    {
13474     productOfCorrelationsVsM[c1][c2] = fIntFlowProductOfCorrelationsVsMPro[productOfCorrelationsLabelVsM-1]->GetBinContent(b); 
13475     if(TMath::Abs(fIntFlowSumOfEventWeightsVsM[c1][0]->GetBinContent(b)) > 1.e-44 && TMath::Abs(fIntFlowSumOfEventWeightsVsM[c2][0]->GetBinContent(b)) > 1.e-44)
13476     {
13477      denominatorVsM[c1][c2] = 1.-(fIntFlowSumOfProductOfEventWeightsVsM[sumOfProductOfEventWeightsLabel1VsM-1]->GetBinContent(b))
13478                             / (fIntFlowSumOfEventWeightsVsM[c1][0]->GetBinContent(b) 
13479                             * fIntFlowSumOfEventWeightsVsM[c2][0]->GetBinContent(b));                              
13480      wPrefactorVsM[c1][c2] = fIntFlowSumOfProductOfEventWeightsVsM[sumOfProductOfEventWeightsLabel2VsM-1]->GetBinContent(b)
13481                            / (fIntFlowSumOfEventWeightsVsM[c1][0]->GetBinContent(b)
13482                            * fIntFlowSumOfEventWeightsVsM[c2][0]->GetBinContent(b));                                                       
13483     }
13484     productOfCorrelationsLabelVsM++;
13485     sumOfProductOfEventWeightsLabel1VsM++;
13486     sumOfProductOfEventWeightsLabel2VsM++;  
13487    } // end of for(Int_t c1=0;c1<4;c1++) 
13488   } // end of for(Int_t c2=c1+1;c2<4;c2++)
13489  
13490   Int_t covarianceLabelVsM = 1;
13491   for(Int_t c1=0;c1<4;c1++)
13492   {
13493    for(Int_t c2=c1+1;c2<4;c2++)
13494    {
13495     if(TMath::Abs(denominatorVsM[c1][c2]) > 1.e-44)
13496     {
13497      // Covariances:
13498      Double_t covVsM = (productOfCorrelationsVsM[c1][c2]-correlationVsM[c1]*correlationVsM[c2])/denominatorVsM[c1][c2]; 
13499      // Covariances multiplied with weight dependent prefactor:
13500      Double_t wCovVsM = covVsM * wPrefactorVsM[c1][c2];
13501      fIntFlowCovariancesVsM[covarianceLabelVsM-1]->SetBinContent(b,wCovVsM);
13502     }
13503     covarianceLabelVsM++;
13504    } // end of for(Int_t c2=c1+1;c2<4;c2++)
13505   } // end of for(Int_t c1=0;c1<4;c1++)
13506  } // end of for(Int_t b=1;b<=nBins;b++)
13507   
13508 } // end of AliFlowAnalysisWithQCumulants::CalculateCovariancesIntFlow()
13509
13510 //=======================================================================================================================
13511
13512 void AliFlowAnalysisWithQCumulants::CalculateCovariancesNUAIntFlow()
13513 {
13514  // a) Calculate unbiased estimators Cov(*,*) for true covariances V_(*,*) for NUA terms.
13515  // b) Store in histogram fIntFlowCovariancesNUA for instance the following: 
13516  //
13517  //             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)]
13518  // 
13519  //    where N is the number of events, w_{<2>} is event weight for <2> and w_{<cos(phi)>} is event weight for <cos(phi)>.
13520  // c) Binning of fIntFlowCovariancesNUA is organized as follows:
13521  // 
13522  //     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)] 
13523  //     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)]
13524  //     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)]
13525  // ...
13526       
13527  // Cov(<2>,<cos(phi)>):
13528  Double_t product1 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(1); // <<2><cos(phi)>> 
13529  Double_t term1st1 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13530  Double_t term2nd1 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi)>>
13531  Double_t sumOfW1st1 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13532  Double_t sumOfW2nd1 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi)>}
13533  Double_t sumOfWW1 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(1); // W_{<2>} * W_{<cos(phi)>}
13534  // numerator in the expression for the the unbiased estimator for covariance:
13535  Double_t numerator1 = product1 - term1st1*term2nd1; 
13536  // denominator in the expression for the the unbiased estimator for covariance:
13537  Double_t denominator1 = 0.;
13538  if(TMath::Abs(sumOfW1st1*sumOfW2nd1)>0.)
13539  {
13540   denominator1 = 1.-sumOfWW1/(sumOfW1st1*sumOfW2nd1);
13541   if(TMath::Abs(denominator1)>0.)
13542   {
13543    // covariance:
13544    Double_t covariance1 = numerator1/denominator1;
13545    // weight dependent prefactor for covariance:
13546    Double_t wPrefactor1 = sumOfWW1/(sumOfW1st1*sumOfW2nd1);
13547    // finally, store "weighted" covariance:
13548    fIntFlowCovariancesNUA->SetBinContent(1,wPrefactor1*covariance1);
13549   } // end of if(TMath::Abs(denominator)>0.)
13550  } // end of if(TMath::Abs(sumOfW1st1*sumOfW2nd1)>0.)
13551  
13552  // Cov(<2>,<sin(phi)>):
13553  Double_t product2 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(2); // <<2><sin(phi)>> 
13554  Double_t term1st2 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13555  Double_t term2nd2 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi)>>
13556  Double_t sumOfW1st2 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13557  Double_t sumOfW2nd2 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi)>}
13558  Double_t sumOfWW2 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(2); // W_{<2>} * W_{<sin(phi)>}
13559  // numerator in the expression for the the unbiased estimator for covariance:
13560  Double_t numerator2 = product2 - term1st2*term2nd2;
13561  // denominator in the expression for the the unbiased estimator for covariance:
13562  Double_t denominator2 = 0.;
13563  if(TMath::Abs(sumOfW1st2*sumOfW2nd2)>0.)
13564  {  
13565   denominator2 = 1.-sumOfWW2/(sumOfW1st2*sumOfW2nd2);
13566   if(TMath::Abs(denominator2)>0.)
13567   {
13568    // covariance:
13569    Double_t covariance2 = numerator2/denominator2;
13570    // weight dependent prefactor for covariance:
13571    Double_t wPrefactor2 = sumOfWW2/(sumOfW1st2*sumOfW2nd2);
13572    // finally, store "weighted" covariance:
13573    fIntFlowCovariancesNUA->SetBinContent(2,wPrefactor2*covariance2);
13574   } // end of if(TMath::Abs(denominator2)>0.)
13575  } // end of if(TMath::Abs(sumOfW1st2*sumOfW2nd2)>0.)
13576  
13577  // Cov(<cos(phi)>,<sin(phi)>):
13578  Double_t product3 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(3); // <<cos(phi)><sin(phi)>> 
13579  Double_t term1st3 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi)>>
13580  Double_t term2nd3 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi)>>
13581  Double_t sumOfW1st3 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi)>}
13582  Double_t sumOfW2nd3 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi)>}
13583  Double_t sumOfWW3 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(3); // W_{<cos(phi)>} * W_{<sin(phi)>}
13584  // numerator in the expression for the the unbiased estimator for covariance:
13585  Double_t numerator3 = product3 - term1st3*term2nd3; 
13586  // denominator in the expression for the the unbiased estimator for covariance:
13587  Double_t denominator3 = 0;
13588  if(TMath::Abs(sumOfW1st3*sumOfW2nd3)>0.)
13589  { 
13590   denominator3 = 1.-sumOfWW3/(sumOfW1st3*sumOfW2nd3);
13591   if(TMath::Abs(denominator3)>0.)
13592   {
13593    // covariance:
13594    Double_t covariance3 = numerator3/denominator3;
13595    // weight dependent prefactor for covariance:
13596    Double_t wPrefactor3 = sumOfWW3/(sumOfW1st3*sumOfW2nd3);
13597    // finally, store "weighted" covariance:
13598    fIntFlowCovariancesNUA->SetBinContent(3,wPrefactor3*covariance3);
13599   } // end of if(TMath::Abs(denominator3)>0.)
13600  } // end of if(TMath::Abs(sumOfW1st3*sumOfW2nd3)>0.)
13601  
13602  // Cov(<2>,<cos(phi1+phi2)>):
13603  Double_t product4 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(4); // <<2><cos(phi1+phi2)>> 
13604  Double_t term1st4 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13605  Double_t term2nd4 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13606  Double_t sumOfW1st4 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13607  Double_t sumOfW2nd4 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13608  Double_t sumOfWW4 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(4); // W_{<2>} * W_{<cos(phi1+phi2)>}
13609  // numerator in the expression for the the unbiased estimator for covariance:
13610  Double_t numerator4 = product4 - term1st4*term2nd4; 
13611  // denominator in the expression for the the unbiased estimator for covariance:
13612  Double_t denominator4 = 0.;
13613  if(TMath::Abs(sumOfW1st4*sumOfW2nd4)>0.)
13614  { 
13615   denominator4 = 1.-sumOfWW4/(sumOfW1st4*sumOfW2nd4);
13616   if(TMath::Abs(denominator4)>0.)
13617   {  
13618    // covariance:
13619    Double_t covariance4 = numerator4/denominator4;
13620    // weight dependent prefactor for covariance:
13621    Double_t wPrefactor4 = sumOfWW4/(sumOfW1st4*sumOfW2nd4);
13622    // finally, store "weighted" covariance:
13623    fIntFlowCovariancesNUA->SetBinContent(4,wPrefactor4*covariance4);
13624   } // end of if(TMath::Abs(denominator4)>0.)
13625  } // end of if(TMath::Abs(sumOfW1st4*sumOfW2nd4)>0.)
13626  
13627  // Cov(<2>,<sin(phi1+phi2)>):
13628  Double_t product5 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(5); // <<2><sin(phi1+phi2)>> 
13629  Double_t term1st5 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13630  Double_t term2nd5 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13631  Double_t sumOfW1st5 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13632  Double_t sumOfW2nd5 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13633  Double_t sumOfWW5 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(5); // W_{<2>} * W_{<sin(phi1+phi2)>}
13634  // numerator in the expression for the the unbiased estimator for covariance:
13635  Double_t numerator5 = product5 - term1st5*term2nd5; 
13636  // denominator in the expression for the the unbiased estimator for covariance:
13637  Double_t denominator5 = 0.;
13638  if(TMath::Abs(sumOfW1st5*sumOfW2nd5)>0.)
13639  {  
13640   denominator5 = 1.-sumOfWW5/(sumOfW1st5*sumOfW2nd5);
13641   if(TMath::Abs(denominator5)>0.)
13642   {  
13643    // covariance:
13644    Double_t covariance5 = numerator5/denominator5;
13645    // weight dependent prefactor for covariance:
13646    Double_t wPrefactor5 = sumOfWW5/(sumOfW1st5*sumOfW2nd5);
13647    // finally, store "weighted" covariance:
13648    fIntFlowCovariancesNUA->SetBinContent(5,wPrefactor5*covariance5);
13649   } // end of if(TMath::Abs(denominator5)>0.)
13650  } // end of if(TMath::Abs(sumOfW1st5*sumOfW2nd5)>0.)
13651  
13652  // Cov(<2>,<cos(phi1-phi2-phi3)>):
13653  Double_t product6 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(6); // <<2><cos(phi1-phi2-phi3)>> 
13654  Double_t term1st6 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13655  Double_t term2nd6 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13656  Double_t sumOfW1st6 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13657  Double_t sumOfW2nd6 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13658  Double_t sumOfWW6 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(6); // W_{<2>} * W_{<cos(phi1-phi2-phi3)>}
13659  // numerator in the expression for the the unbiased estimator for covariance:
13660  Double_t numerator6 = product6 - term1st6*term2nd6; 
13661  // denominator in the expression for the the unbiased estimator for covariance:
13662  Double_t denominator6 = 0.;
13663  if(TMath::Abs(sumOfW1st6*sumOfW2nd6)>0.)
13664  {  
13665   denominator6 = 1.-sumOfWW6/(sumOfW1st6*sumOfW2nd6);
13666   if(TMath::Abs(denominator6)>0.)
13667   {  
13668    // covariance:
13669    Double_t covariance6 = numerator6/denominator6;
13670    // weight dependent prefactor for covariance:
13671    Double_t wPrefactor6 = sumOfWW6/(sumOfW1st6*sumOfW2nd6);
13672    // finally, store "weighted" covariance:
13673    fIntFlowCovariancesNUA->SetBinContent(6,wPrefactor6*covariance6);
13674   } // end of if(TMath::Abs(denominator6)>0.)
13675  } // end of if(TMath::Abs(sumOfW1st6*sumOfW2nd6)>0.)
13676  
13677  // Cov(<2>,<sin(phi1-phi2-phi3)>):
13678  Double_t product7 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(7); // <<2><sin(phi1-phi2-phi3)>> 
13679  Double_t term1st7 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13680  Double_t term2nd7 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13681  Double_t sumOfW1st7 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13682  Double_t sumOfW2nd7 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13683  Double_t sumOfWW7 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(7); // W_{<2>} * W_{<sin(phi1-phi2-phi3)>}
13684  // numerator in the expression for the the unbiased estimator for covariance:
13685  Double_t numerator7 = product7 - term1st7*term2nd7; 
13686  // denominator in the expression for the the unbiased estimator for covariance:
13687  Double_t denominator7 = 0.;
13688  if(TMath::Abs(sumOfW1st7*sumOfW2nd7)>0.)
13689  {  
13690   denominator7 = 1.-sumOfWW7/(sumOfW1st7*sumOfW2nd7);
13691   if(TMath::Abs(denominator7)>0.)
13692   {   
13693    // covariance:
13694    Double_t covariance7 = numerator7/denominator7;
13695    // weight dependent prefactor for covariance:
13696    Double_t wPrefactor7 = sumOfWW7/(sumOfW1st7*sumOfW2nd7);
13697    // finally, store "weighted" covariance:
13698    fIntFlowCovariancesNUA->SetBinContent(7,wPrefactor7*covariance7);
13699   } // end of if(TMath::Abs(denominator7)>0.)
13700  } // end of if(TMath::Abs(sumOfW1st7*sumOfW2nd7)>0.)
13701  
13702  // Cov(<4>,<cos(phi1>):
13703  Double_t product8 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(8); // <<4><cos(phi1)>> 
13704  Double_t term1st8 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13705  Double_t term2nd8 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13706  Double_t sumOfW1st8 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13707  Double_t sumOfW2nd8 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13708  Double_t sumOfWW8 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(8); // W_{<4>} * W_{<cos(phi1)>}
13709  // numerator in the expression for the the unbiased estimator for covariance:
13710  Double_t numerator8 = product8 - term1st8*term2nd8; 
13711  // denominator in the expression for the the unbiased estimator for covariance:
13712  Double_t denominator8 = 0.;
13713  if(TMath::Abs(sumOfW1st8*sumOfW2nd8)>0.)
13714  { 
13715   denominator8 = 1.-sumOfWW8/(sumOfW1st8*sumOfW2nd8);
13716   if(TMath::Abs(denominator8)>0.)
13717   {     
13718    // covariance:
13719    Double_t covariance8 = numerator8/denominator8;
13720    // weight dependent prefactor for covariance:
13721    Double_t wPrefactor8 = sumOfWW8/(sumOfW1st8*sumOfW2nd8);
13722    // finally, store "weighted" covariance:
13723    fIntFlowCovariancesNUA->SetBinContent(8,wPrefactor8*covariance8);
13724   } // end of if(TMath::Abs(denominator8)>0.)
13725  } // end of if(TMath::Abs(sumOfW1st8*sumOfW2nd8)>0.)
13726  
13727  // Cov(<4>,<sin(phi1)>):
13728  Double_t product9 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(9); // <<4><sin(phi1)>> 
13729  Double_t term1st9 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13730  Double_t term2nd9 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
13731  Double_t sumOfW1st9 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13732  Double_t sumOfW2nd9 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
13733  Double_t sumOfWW9 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(9); // W_{<4>} * W_{<sin(phi1)>}
13734  // numerator in the expression for the the unbiased estimator for covariance:
13735  Double_t numerator9 = product9 - term1st9*term2nd9; 
13736  // denominator in the expression for the the unbiased estimator for covariance:
13737  Double_t denominator9 = 0.;
13738  if(TMath::Abs(sumOfW1st9*sumOfW2nd9)>0.) 
13739  {
13740   denominator9 = 1.-sumOfWW9/(sumOfW1st9*sumOfW2nd9);
13741   if(TMath::Abs(denominator9)>0.)
13742   {     
13743    // covariance:
13744    Double_t covariance9 = numerator9/denominator9;
13745    // weight dependent prefactor for covariance:
13746    Double_t wPrefactor9 = sumOfWW9/(sumOfW1st9*sumOfW2nd9);
13747    // finally, store "weighted" covariance:
13748    fIntFlowCovariancesNUA->SetBinContent(9,wPrefactor9*covariance9); 
13749   }
13750  } // end of if(TMath::Abs(sumOfW1st9*sumOfW2nd9)>0.) 
13751  
13752  // Cov(<4>,<cos(phi1+phi2)>):
13753  Double_t product10 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(10); // <<4><cos(phi1+phi2)>> 
13754  Double_t term1st10 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13755  Double_t term2nd10 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13756  Double_t sumOfW1st10 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13757  Double_t sumOfW2nd10 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13758  Double_t sumOfWW10 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(10); // W_{<4>} * W_{<cos(phi1+phi2)>}
13759  // numerator in the expression for the the unbiased estimator for covariance:
13760  Double_t numerator10 = product10 - term1st10*term2nd10; 
13761  // denominator in the expression for the the unbiased estimator for covariance:
13762  Double_t denominator10 = 0.;
13763  if(TMath::Abs(sumOfW1st10*sumOfW2nd10)>0.) 
13764  { 
13765   denominator10 = 1.-sumOfWW10/(sumOfW1st10*sumOfW2nd10);
13766   if(TMath::Abs(denominator10)>0.) 
13767   { 
13768    // covariance:
13769    Double_t covariance10 = numerator10/denominator10;
13770    // weight dependent prefactor for covariance:
13771    Double_t wPrefactor10 = sumOfWW10/(sumOfW1st10*sumOfW2nd10);
13772    // finally, store "weighted" covariance:
13773    fIntFlowCovariancesNUA->SetBinContent(10,wPrefactor10*covariance10);
13774   } // end of if(TMath::Abs(denominator10)>0.) 
13775  } // end of if(TMath::Abs(sumOfW1st10*sumOfW2nd10)>0.) 
13776  
13777  // Cov(<4>,<sin(phi1+phi2)>):
13778  Double_t product11 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(11); // <<4><sin(phi1+phi2)>> 
13779  Double_t term1st11 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13780  Double_t term2nd11 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13781  Double_t sumOfW1st11 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13782  Double_t sumOfW2nd11 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13783  Double_t sumOfWW11 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(11); // W_{<4>} * W_{<sin(phi1+phi2)>}
13784  // numerator in the expression for the the unbiased estimator for covariance:
13785  Double_t numerator11 = product11 - term1st11*term2nd11; 
13786  // denominator in the expression for the the unbiased estimator for covariance:
13787  Double_t denominator11 = 0.;
13788  if(TMath::Abs(sumOfW1st11*sumOfW2nd11)>0.) 
13789  {  
13790   denominator11 = 1.-sumOfWW11/(sumOfW1st11*sumOfW2nd11);
13791   if(TMath::Abs(denominator11)>0.) 
13792   { 
13793    // covariance:
13794    Double_t covariance11 = numerator11/denominator11;
13795    // weight dependent prefactor for covariance:
13796    Double_t wPrefactor11 = sumOfWW11/(sumOfW1st11*sumOfW2nd11);
13797    // finally, store "weighted" covariance:
13798    fIntFlowCovariancesNUA->SetBinContent(11,wPrefactor11*covariance11);
13799   } // end of if(TMath::Abs(denominator11)>0.) 
13800  } // end of if(TMath::Abs(sumOfW1st11*sumOfW2nd11)>0.) 
13801
13802  // Cov(<4>,<cos(phi1-phi2-phi3)>):
13803  Double_t product12 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(12); // <<4><cos(phi1-phi2-phi3)>> 
13804  Double_t term1st12 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13805  Double_t term2nd12 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13806  Double_t sumOfW1st12 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13807  Double_t sumOfW2nd12 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13808  Double_t sumOfWW12 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(12); // W_{<4>} * W_{<cos(phi1-phi2-phi3)>}
13809  // numerator in the expression for the the unbiased estimator for covariance:
13810  Double_t numerator12 = product12 - term1st12*term2nd12; 
13811  // denominator in the expression for the the unbiased estimator for covariance:
13812  Double_t denominator12 = 0.;
13813  if(TMath::Abs(sumOfW1st12*sumOfW2nd12)>0.) 
13814  {   
13815   denominator12 = 1.-sumOfWW12/(sumOfW1st12*sumOfW2nd12);
13816   if(TMath::Abs(denominator12)>0.) 
13817   { 
13818    // covariance:
13819    Double_t covariance12 = numerator12/denominator12;
13820    // weight dependent prefactor for covariance:
13821    Double_t wPrefactor12 = sumOfWW12/(sumOfW1st12*sumOfW2nd12);
13822    // finally, store "weighted" covariance:
13823    fIntFlowCovariancesNUA->SetBinContent(12,wPrefactor12*covariance12);
13824   } // end of if(TMath::Abs(denominator12)>0.)
13825  } // end of if(TMath::Abs(sumOfW1st12*sumOfW2nd12)>0.)  
13826
13827  // Cov(<4>,<sin(phi1-phi2-phi3)>):
13828  Double_t product13 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(13); // <<4><sin(phi1-phi2-phi3)>> 
13829  Double_t term1st13 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13830  Double_t term2nd13 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13831  Double_t sumOfW1st13 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13832  Double_t sumOfW2nd13 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13833  Double_t sumOfWW13 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(13); // W_{<4>} * W_{<sin(phi1-phi2-phi3)>}
13834  // numerator in the expression for the the unbiased estimator for covariance:
13835  Double_t numerator13 = product13 - term1st13*term2nd13; 
13836  // denominator in the expression for the the unbiased estimator for covariance:
13837  Double_t denominator13 = 0.;
13838  if(TMath::Abs(sumOfW1st13*sumOfW2nd13)>0.) 
13839  {   
13840   denominator13 = 1.-sumOfWW13/(sumOfW1st13*sumOfW2nd13);
13841   if(TMath::Abs(denominator13)>0.) 
13842   { 
13843    // covariance:
13844    Double_t covariance13 = numerator13/denominator13;
13845    // weight dependent prefactor for covariance:
13846    Double_t wPrefactor13 = sumOfWW13/(sumOfW1st13*sumOfW2nd13);
13847    // finally, store "weighted" covariance:
13848    fIntFlowCovariancesNUA->SetBinContent(13,wPrefactor13*covariance13);
13849   } // end of if(TMath::Abs(denominator13)>0.) 
13850  } // end of if(TMath::Abs(sumOfW1st13*sumOfW2nd13)>0.) 
13851
13852  // Cov(<cos(phi1)>,<cos(phi1+phi2)>):
13853  Double_t product14 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(14); // <<cos(phi1)><cos(phi1+phi2)>> 
13854  Double_t term1st14 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13855  Double_t term2nd14 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13856  Double_t sumOfW1st14 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13857  Double_t sumOfW2nd14 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13858  Double_t sumOfWW14 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(14); // W_{<cos(phi1)>} * W_{<cos(phi1+phi2)>}
13859  // numerator in the expression for the the unbiased estimator for covariance:
13860  Double_t numerator14 = product14 - term1st14*term2nd14; 
13861  // denominator in the expression for the the unbiased estimator for covariance:
13862  Double_t denominator14 = 0.;
13863  if(TMath::Abs(sumOfW1st14*sumOfW2nd14)>0.) 
13864  {  
13865   denominator14 = 1.-sumOfWW14/(sumOfW1st14*sumOfW2nd14);
13866   if(TMath::Abs(denominator14)>0.) 
13867   { 
13868    // covariance:
13869    Double_t covariance14 = numerator14/denominator14;
13870    // weight dependent prefactor for covariance:
13871    Double_t wPrefactor14 = sumOfWW14/(sumOfW1st14*sumOfW2nd14);
13872    // finally, store "weighted" covariance:
13873    fIntFlowCovariancesNUA->SetBinContent(14,wPrefactor14*covariance14);
13874   } // end of if(TMath::Abs(denominator14)>0.) 
13875  } // end of if(TMath::Abs(sumOfW1st14*sumOfW2nd14)>0.) 
13876
13877  // Cov(<cos(phi1)>,<sin(phi1+phi2)>):
13878  Double_t product15 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(15); // <<cos(phi1)><sin(phi1+phi2)>> 
13879  Double_t term1st15 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13880  Double_t term2nd15 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13881  Double_t sumOfW1st15 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13882  Double_t sumOfW2nd15 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13883  Double_t sumOfWW15 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(15); // W_{<cos(phi1)>} * W_{<sin(phi1+phi2)>}
13884  // numerator in the expression for the the unbiased estimator for covariance:
13885  Double_t numerator15 = product15 - term1st15*term2nd15; 
13886  // denominator in the expression for the the unbiased estimator for covariance:
13887  Double_t denominator15 = 0.;
13888  if(TMath::Abs(sumOfW1st15*sumOfW2nd15)>0.) 
13889  {  
13890   denominator15 = 1.-sumOfWW15/(sumOfW1st15*sumOfW2nd15);
13891   if(TMath::Abs(denominator15)>0.) 
13892   { 
13893    // covariance:
13894    Double_t covariance15 = numerator15/denominator15;
13895    // weight dependent prefactor for covariance:
13896    Double_t wPrefactor15 = sumOfWW15/(sumOfW1st15*sumOfW2nd15);
13897    // finally, store "weighted" covariance:
13898    fIntFlowCovariancesNUA->SetBinContent(15,wPrefactor15*covariance15);
13899   } // end of if(TMath::Abs(denominator15)>0.)  
13900  } // end of if(TMath::Abs(sumOfW1st15*sumOfW2nd15)>0.)  
13901  
13902  // Cov(<cos(phi1)>,<cos(phi1-phi2-phi3)>):
13903  Double_t product16 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(16); // <<cos(phi1)><cos(phi1-phi2-phi3)>> 
13904  Double_t term1st16 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13905  Double_t term2nd16 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13906  Double_t sumOfW1st16 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13907  Double_t sumOfW2nd16 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13908  Double_t sumOfWW16 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(16); // W_{<cos(phi1)>} * W_{<cos(phi1-phi2-phi3)>}
13909  // numerator in the expression for the the unbiased estimator for covariance:
13910  Double_t numerator16 = product16 - term1st16*term2nd16; 
13911  // denominator in the expression for the the unbiased estimator for covariance:
13912  Double_t denominator16 = 0.;
13913  if(TMath::Abs(sumOfW1st16*sumOfW2nd16)>0.) 
13914  {   
13915   denominator16 = 1.-sumOfWW16/(sumOfW1st16*sumOfW2nd16);
13916   if(TMath::Abs(denominator16)>0.) 
13917   {   
13918    // covariance:
13919    Double_t covariance16 = numerator16/denominator16;
13920    // weight dependent prefactor for covariance:
13921    Double_t wPrefactor16 = sumOfWW16/(sumOfW1st16*sumOfW2nd16);
13922    // finally, store "weighted" covariance:
13923    fIntFlowCovariancesNUA->SetBinContent(16,wPrefactor16*covariance16);
13924   } // end of if(TMath::Abs(denominator16)>0.)
13925  } // end ofif(TMath::Abs(sumOfW1st16*sumOfW2nd16)>0.)  
13926  
13927  // Cov(<cos(phi1)>,<sin(phi1-phi2-phi3)>):
13928  Double_t product17 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(17); // <<cos(phi1)><sin(phi1-phi2-phi3)>> 
13929  Double_t term1st17 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13930  Double_t term2nd17 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13931  Double_t sumOfW1st17 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13932  Double_t sumOfW2nd17 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13933  Double_t sumOfWW17 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(17); // W_{<cos(phi1)>} * W_{<sin(phi1-phi2-phi3)>}
13934  // numerator in the expression for the the unbiased estimator for covariance:
13935  Double_t numerator17 = product17 - term1st17*term2nd17; 
13936  // denominator in the expression for the the unbiased estimator for covariance:
13937  Double_t denominator17 = 0.;
13938  if(TMath::Abs(sumOfW1st17*sumOfW2nd17)>0.) 
13939  {
13940   denominator17 = 1.-sumOfWW17/(sumOfW1st17*sumOfW2nd17);
13941   if(TMath::Abs(denominator17)>0.) 
13942   {   
13943    // covariance:
13944    Double_t covariance17 = numerator17/denominator17;
13945    // weight dependent prefactor for covariance:
13946    Double_t wPrefactor17 = sumOfWW17/(sumOfW1st17*sumOfW2nd17);
13947     // finally, store "weighted" covariance:
13948    fIntFlowCovariancesNUA->SetBinContent(17,wPrefactor17*covariance17);
13949   } // end of if(TMath::Abs(denominator17)>0.) 
13950  } // end of if(TMath::Abs(sumOfW1st17*sumOfW2nd17)>0.) 
13951
13952  // Cov(<sin(phi1)>,<cos(phi1+phi2)>):
13953  Double_t product18 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(18); // <<sin(phi1)><cos(phi1+phi2)>> 
13954  Double_t term1st18 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
13955  Double_t term2nd18 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13956  Double_t sumOfW1st18 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
13957  Double_t sumOfW2nd18 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13958  Double_t sumOfWW18 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(18); // W_{<sin(phi1)>} * W_{<cos(phi1+phi2)>}
13959  // numerator in the expression for the the unbiased estimator for covariance:
13960  Double_t numerator18 = product18 - term1st18*term2nd18; 
13961  // denominator in the expression for the the unbiased estimator for covariance:
13962  Double_t denominator18 = 0.;
13963  if(TMath::Abs(sumOfW1st18*sumOfW2nd18)>0.) 
13964  { 
13965   denominator18 = 1.-sumOfWW18/(sumOfW1st18*sumOfW2nd18);
13966   if(TMath::Abs(denominator18)>0.) 
13967   {   
13968    // covariance:
13969    Double_t covariance18 = numerator18/denominator18;
13970    // weight dependent prefactor for covariance:
13971    Double_t wPrefactor18 = sumOfWW18/(sumOfW1st18*sumOfW2nd18);
13972    // finally, store "weighted" covariance:
13973    fIntFlowCovariancesNUA->SetBinContent(18,wPrefactor18*covariance18); 
13974   } // end of if(TMath::Abs(denominator18)>0.) 
13975  } // end of if(TMath::Abs(sumOfW1st18*sumOfW2nd18)>0.) 
13976
13977  // Cov(<sin(phi1)>,<sin(phi1+phi2)>):
13978  Double_t product19 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(19); // <<sin(phi1)><sin(phi1+phi2)>> 
13979  Double_t term1st19 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
13980  Double_t term2nd19 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13981  Double_t sumOfW1st19 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
13982  Double_t sumOfW2nd19 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13983  Double_t sumOfWW19 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(19); // W_{<sin(phi1)>} * W_{<sin(phi1+phi2)>}
13984  // numerator in the expression for the the unbiased estimator for covariance:
13985  Double_t numerator19 = product19 - term1st19*term2nd19; 
13986  // denominator in the expression for the the unbiased estimator for covariance:
13987  Double_t denominator19 = 0.;
13988  if(TMath::Abs(sumOfW1st19*sumOfW2nd19)>0.) 
13989  { 
13990   denominator19 = 1.-sumOfWW19/(sumOfW1st19*sumOfW2nd19);
13991   if(TMath::Abs(denominator19)>0.) 
13992   {   
13993    // covariance:
13994    Double_t covariance19 = numerator19/denominator19;
13995    // weight dependent prefactor for covariance:
13996    Double_t wPrefactor19 = sumOfWW19/(sumOfW1st19*sumOfW2nd19);
13997    // finally, store "weighted" covariance:
13998    fIntFlowCovariancesNUA->SetBinContent(19,wPrefactor19*covariance19);
13999   } // end of if(TMath::Abs(denominator19)>0.)
14000  } // end of if(TMath::Abs(sumOfW1st19*sumOfW2nd19)>0.)
14001  
14002  // Cov(<sin(phi1)>,<cos(phi1-phi2-phi3)>):
14003  Double_t product20 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(20); // <<sin(phi1)><cos(phi1-phi2-phi3)>> 
14004  Double_t term1st20 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
14005  Double_t term2nd20 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
14006  Double_t sumOfW1st20 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
14007  Double_t sumOfW2nd20 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
14008  Double_t sumOfWW20 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(20); // W_{<sin(phi1)>} * W_{<cos(phi1-phi2-phi3)>}
14009  // numerator in the expression for the the unbiased estimator for covariance:
14010  Double_t numerator20 = product20 - term1st20*term2nd20; 
14011  // denominator in the expression for the the unbiased estimator for covariance:
14012  Double_t denominator20 = 0.;
14013  if(TMath::Abs(sumOfW1st20*sumOfW2nd20)>0.)
14014  { 
14015   denominator20 = 1.-sumOfWW20/(sumOfW1st20*sumOfW2nd20);
14016   if(TMath::Abs(denominator20)>0.) 
14017   { 
14018    // covariance:
14019    Double_t covariance20 = numerator20/denominator20;
14020    // weight dependent prefactor for covariance:
14021    Double_t wPrefactor20 = sumOfWW20/(sumOfW1st20*sumOfW2nd20);
14022    // finally, store "weighted" covariance:
14023    fIntFlowCovariancesNUA->SetBinContent(20,wPrefactor20*covariance20);
14024   } // end of if(TMath::Abs(denominator20)>0.) 
14025  } // end of if(TMath::Abs(sumOfW1st20*sumOfW2nd20)>0.)
14026
14027  // Cov(<sin(phi1)>,<sin(phi1-phi2-phi3)>):
14028  Double_t product21 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(21); // <<sin(phi1)><sin(phi1-phi2-phi3)>> 
14029  Double_t term1st21 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
14030  Double_t term2nd21 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
14031  Double_t sumOfW1st21 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
14032  Double_t sumOfW2nd21 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
14033  Double_t sumOfWW21 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(21); // W_{<sin(phi1)>} * W_{<sin(phi1-phi2-phi3)>}
14034  // numerator in the expression for the the unbiased estimator for covariance:
14035  Double_t numerator21 = product21 - term1st21*term2nd21; 
14036  // denominator in the expression for the the unbiased estimator for covariance:
14037  Double_t denominator21 = 0.;
14038  if(TMath::Abs(sumOfW1st21*sumOfW2nd21)>0.)
14039  { 
14040   denominator21 = 1.-sumOfWW21/(sumOfW1st21*sumOfW2nd21);
14041   if(TMath::Abs(denominator21)>0.) 
14042   {   
14043    // covariance:
14044    Double_t covariance21 = numerator21/denominator21;
14045    // weight dependent prefactor for covariance:
14046    Double_t wPrefactor21 = sumOfWW21/(sumOfW1st21*sumOfW2nd21);
14047    // finally, store "weighted" covariance:
14048    fIntFlowCovariancesNUA->SetBinContent(21,wPrefactor21*covariance21);
14049   } // end of if(TMath::Abs(denominator21)>0.)
14050  } // end of if(TMath::Abs(sumOfW1st21*sumOfW2nd21)>0.)
14051
14052  // Cov(<cos(phi1+phi2)>,<sin(phi1+phi2)>):
14053  Double_t product22 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(22); // <<cos(phi1+phi2)><sin(phi1+phi2)>> 
14054  Double_t term1st22 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
14055  Double_t term2nd22 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
14056  Double_t sumOfW1st22 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
14057  Double_t sumOfW2nd22 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
14058  Double_t sumOfWW22 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(22); // W_{<cos(phi1+phi2)>} * W_{<sin(phi1+phi2)>}
14059  // numerator in the expression for the the unbiased estimator for covariance:
14060  Double_t numerator22 = product22 - term1st22*term2nd22; 
14061  // denominator in the expression for the the unbiased estimator for covariance:
14062  Double_t denominator22 = 0.;
14063  if(TMath::Abs(sumOfW1st22*sumOfW2nd22)>0.)
14064  { 
14065   denominator22 = 1.-sumOfWW22/(sumOfW1st22*sumOfW2nd22);
14066   if(TMath::Abs(denominator22)>0.) 
14067   {   
14068    // covariance:
14069    Double_t covariance22 = numerator22/denominator22;
14070    // weight dependent prefactor for covariance:
14071    Double_t wPrefactor22 = sumOfWW22/(sumOfW1st22*sumOfW2nd22);
14072    // finally, store "weighted" covariance:
14073    fIntFlowCovariancesNUA->SetBinContent(22,wPrefactor22*covariance22);
14074   } // end of if(TMath::Abs(denominator22)>0.) 
14075  } // end of if(TMath::Abs(sumOfW1st22*sumOfW2nd22)>0.) 
14076
14077  // Cov(<cos(phi1+phi2)>,<cos(phi1-phi2-phi3)>):
14078  Double_t product23 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(23); // <<cos(phi1+phi2)><cos(phi1-phi2-phi3)>> 
14079  Double_t term1st23 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
14080  Double_t term2nd23 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
14081  Double_t sumOfW1st23 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
14082  Double_t sumOfW2nd23 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
14083  Double_t sumOfWW23 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(23); // W_{<cos(phi1+phi2)>} * W_{<cos(phi1-phi2-phi3)>}
14084  // numerator in the expression for the the unbiased estimator for covariance:
14085  Double_t numerator23 = product23 - term1st23*term2nd23; 
14086  // denominator in the expression for the the unbiased estimator for covariance:
14087  Double_t denominator23 = 0.;
14088  if(TMath::Abs(sumOfW1st23*sumOfW2nd23)>0.)
14089  {  
14090   denominator23 = 1.-sumOfWW23/(sumOfW1st23*sumOfW2nd23);
14091   if(TMath::Abs(denominator23)>0.) 
14092   {   
14093    // covariance:
14094    Double_t covariance23 = numerator23/denominator23;
14095    // weight dependent prefactor for covariance:
14096    Double_t wPrefactor23 = sumOfWW23/(sumOfW1st23*sumOfW2nd23);
14097    // finally, store "weighted" covariance:
14098    fIntFlowCovariancesNUA->SetBinContent(23,wPrefactor23*covariance23);
14099   } // end of if(TMath::Abs(denominator23)>0.) 
14100  } // end of if(TMath::Abs(sumOfW1st23*sumOfW2nd23)>0.)
14101  
14102  // Cov(<cos(phi1+phi2)>,<sin(phi1-phi2-phi3)>):
14103  Double_t product24 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(24); // <<cos(phi1+phi2)><sin(phi1-phi2-phi3)>> 
14104  Double_t term1st24 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
14105  Double_t term2nd24 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
14106  Double_t sumOfW1st24 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
14107  Double_t sumOfW2nd24 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
14108  Double_t sumOfWW24 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(24); // W_{<cos(phi1+phi2)>} * W_{<sin(phi1-phi2-phi3)>}
14109  // numerator in the expression for the the unbiased estimator for covariance:
14110  Double_t numerator24 = product24 - term1st24*term2nd24; 
14111  // denominator in the expression for the the unbiased estimator for covariance:
14112  Double_t denominator24 = 0.;
14113  if(TMath::Abs(sumOfW1st24*sumOfW2nd24)>0.)
14114  {   
14115   denominator24 = 1.-sumOfWW24/(sumOfW1st24*sumOfW2nd24);
14116   if(TMath::Abs(denominator24)>0.) 
14117   {   
14118    // covariance:
14119    Double_t covariance24 = numerator24/denominator24;
14120    // weight dependent prefactor for covariance:
14121    Double_t wPrefactor24 = sumOfWW24/(sumOfW1st24*sumOfW2nd24);
14122    // finally, store "weighted" covariance:
14123    fIntFlowCovariancesNUA->SetBinContent(24,wPrefactor24*covariance24);
14124   } // end of if(TMath::Abs(denominator24)>0.)  
14125  } // end of if(TMath::Abs(sumOfW1st24*sumOfW2nd24)>0.)
14126
14127  // Cov(<sin(phi1+phi2)>,<cos(phi1-phi2-phi3)>):
14128  Double_t product25 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(25); // <<sin(phi1+phi2)><cos(phi1-phi2-phi3)>> 
14129  Double_t term1st25 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
14130  Double_t term2nd25 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
14131  Double_t sumOfW1st25 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
14132  Double_t sumOfW2nd25 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
14133  Double_t sumOfWW25 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(25); // W_{<sin(phi1+phi2)>} * W_{<cos(phi1-phi2-phi3)>}
14134  // numerator in the expression for the the unbiased estimator for covariance:
14135  Double_t numerator25 = product25 - term1st25*term2nd25; 
14136  // denominator in the expression for the the unbiased estimator for covariance:
14137  Double_t denominator25 = 0.;
14138  if(TMath::Abs(sumOfW1st25*sumOfW2nd25)>0.)
14139  { 
14140   denominator25 = 1.-sumOfWW25/(sumOfW1st25*sumOfW2nd25);
14141   if(TMath::Abs(denominator25)>0.) 
14142   { 
14143    // covariance:
14144    Double_t covariance25 = numerator25/denominator25;
14145    // weight dependent prefactor for covariance:
14146    Double_t wPrefactor25 = sumOfWW25/(sumOfW1st25*sumOfW2nd25);
14147    // finally, store "weighted" covariance:
14148    fIntFlowCovariancesNUA->SetBinContent(25,wPrefactor25*covariance25);
14149   } // end of if(TMath::Abs(denominator25)>0.)
14150  } // end of if(TMath::Abs(sumOfW1st25*sumOfW2nd25)>0.)
14151  
14152  // Cov(<sin(phi1+phi2)>,<sin(phi1-phi2-phi3)>):
14153  Double_t product26 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(26); // <<sin(phi1+phi2)><sin(phi1-phi2-phi3)>> 
14154  Double_t term1st26 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
14155  Double_t term2nd26 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
14156  Double_t sumOfW1st26 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
14157  Double_t sumOfW2nd26 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
14158  Double_t sumOfWW26 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(26); // W_{<sin(phi1+phi2)>} * W_{<sin(phi1-phi2-phi3)>}
14159  // numerator in the expression for the the unbiased estimator for covariance:
14160  Double_t numerator26 = product26 - term1st26*term2nd26; 
14161  // denominator in the expression for the the unbiased estimator for covariance:
14162  Double_t denominator26 = 0.;
14163  if(TMath::Abs(sumOfW1st26*sumOfW2nd26)>0.)
14164  { 
14165   denominator26 = 1.-sumOfWW26/(sumOfW1st26*sumOfW2nd26);
14166   if(TMath::Abs(denominator26)>0.) 
14167   { 
14168    // covariance:
14169    Double_t covariance26 = numerator26/denominator26;
14170    // weight dependent prefactor for covariance:
14171    Double_t wPrefactor26 = sumOfWW26/(sumOfW1st26*sumOfW2nd26);
14172    // finally, store "weighted" covariance:
14173    fIntFlowCovariancesNUA->SetBinContent(26,wPrefactor26*covariance26);
14174   } // end of if(TMath::Abs(denominator26)>0.) 
14175  } // end of if(TMath::Abs(sumOfW1st26*sumOfW2nd26)>0.)
14176  
14177  // Cov(<cos(phi1-phi2-phi3)>,<sin(phi1-phi2-phi3)>):
14178  Double_t product27 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(27); // <<cos(phi1-phi2-phi3)><sin(phi1-phi2-phi3)>> 
14179  Double_t term1st27 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
14180  Double_t term2nd27 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
14181  Double_t sumOfW1st27 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
14182  Double_t sumOfW2nd27 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
14183  Double_t sumOfWW27 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(27); // W_{<cos(phi1-phi2-phi3)>} * W_{<sin(phi1-phi2-phi3)>}
14184  // numerator in the expression for the the unbiased estimator for covariance:
14185  Double_t numerator27 = product27 - term1st27*term2nd27; 
14186  // denominator in the expression for the the unbiased estimator for covariance:
14187  Double_t denominator27 = 0.;
14188  if(TMath::Abs(sumOfW1st27*sumOfW2nd27)>0.)
14189  { 
14190   denominator27 = 1.-sumOfWW27/(sumOfW1st27*sumOfW2nd27);
14191   if(TMath::Abs(denominator27)>0.) 
14192   { 
14193    // covariance:
14194    Double_t covariance27 = numerator27/denominator27;
14195    // weight dependent prefactor for covariance:
14196    Double_t wPrefactor27 = sumOfWW27/(sumOfW1st27*sumOfW2nd27);
14197    // finally, store "weighted" covariance:
14198    fIntFlowCovariancesNUA->SetBinContent(27,wPrefactor27*covariance27);
14199   } // end of if(TMath::Abs(denominator27)>0.) 
14200  } // end of if(TMath::Abs(sumOfW1st27*sumOfW2nd27)>0.)
14201  
14202 } // end of AliFlowAnalysisWithQCumulants::CalculateCovariancesNUAIntFlow()
14203
14204 //=======================================================================================================================
14205
14206 void AliFlowAnalysisWithQCumulants::FinalizeCorrelationsIntFlow() 
14207 {
14208  // From profile fIntFlowCorrelationsPro access measured correlations and spread, 
14209  // correctly calculate the statistical errors and store the final results and 
14210  // statistical errors for correlations in histogram fIntFlowCorrelationsHist.
14211  //
14212  // Remark: Statistical error of correlation is calculated as:
14213  //
14214  //          statistical error = termA * spread * termB:
14215  //          termA = sqrt{sum_{i=1}^{N} w^2}/(sum_{i=1}^{N} w)
14216  //          termB = 1/sqrt(1-termA^2)   
14217  //
14218    
14219  for(Int_t ci=1;ci<=4;ci++) // correlation index
14220  {
14221   if(fIntFlowCorrelationsPro->GetBinEffectiveEntries(ci) < 2 || fIntFlowSquaredCorrelationsPro->GetBinEffectiveEntries(ci) < 2)
14222   {
14223    fIntFlowCorrelationsPro->SetBinError(ci,0.);
14224    fIntFlowSquaredCorrelationsPro->SetBinError(ci,0.);
14225    continue;
14226   } 
14227   Double_t correlation = fIntFlowCorrelationsPro->GetBinContent(ci);
14228   Double_t squaredCorrelation = fIntFlowSquaredCorrelationsPro->GetBinContent(ci);
14229   Double_t spread = 0.;
14230   if(squaredCorrelation-correlation*correlation >= 0.)
14231   {
14232    spread = pow(squaredCorrelation-correlation*correlation,0.5);
14233   } else
14234     {
14235      cout<<endl;
14236      cout<<Form(" WARNING: Imaginary 'spread' for %d-particle correlation!!!! ",2*ci)<<endl;
14237      cout<<endl;
14238     }
14239   Double_t sumOfLinearEventWeights = fIntFlowSumOfEventWeights[0]->GetBinContent(ci);
14240   Double_t sumOfQuadraticEventWeights = fIntFlowSumOfEventWeights[1]->GetBinContent(ci);
14241   Double_t termA = 0.;
14242   Double_t termB = 0.;
14243   if(TMath::Abs(sumOfLinearEventWeights) > 0.) // to be improved - shall I omitt here Abs() ?
14244   {
14245    termA = pow(sumOfQuadraticEventWeights,0.5)/sumOfLinearEventWeights;
14246   } else
14247     {
14248      cout<<endl;
14249      cout<<" WARNING (QC): sumOfLinearEventWeights == 0 in method FinalizeCorrelationsIntFlow() !!!!"<<endl;
14250      cout<<"               (for "<<2*ci<<"-particle correlation)"<<endl;
14251      cout<<endl;
14252     }
14253   if(1.-pow(termA,2.) > 0.)
14254   {
14255    termB = 1./pow(1-pow(termA,2.),0.5);
14256   } else
14257     {
14258      cout<<endl;
14259      cout<<" WARNING (QC): 1.-pow(termA,2.) <= 0 in method FinalizeCorrelationsIntFlow() !!!!"<<endl;   
14260      cout<<"               (for "<<2*ci<<"-particle correlation)"<<endl;
14261      cout<<endl;
14262     }     
14263   Double_t statisticalError = termA * spread * termB;
14264   fIntFlowCorrelationsHist->SetBinContent(ci,correlation);
14265   fIntFlowCorrelationsHist->SetBinError(ci,statisticalError);
14266  } // end of for(Int_t ci=1;ci<=4;ci++) // correlation index     
14267  
14268  // Versus multiplicity: 
14269  if(!fCalculateCumulantsVsM){return;}
14270  for(Int_t ci=0;ci<=3;ci++) // correlation index
14271  {
14272   Int_t nBins = fIntFlowCorrelationsVsMPro[ci]->GetNbinsX(); 
14273   for(Int_t b=1;b<=nBins;b++) // looping over multiplicity bins
14274   {
14275    if(fIntFlowCorrelationsVsMPro[ci]->GetBinEffectiveEntries(b) < 2 || fIntFlowSquaredCorrelationsVsMPro[ci]->GetBinEffectiveEntries(b) < 2)
14276    {
14277     fIntFlowCorrelationsVsMPro[ci]->SetBinError(b,0.);
14278     fIntFlowSquaredCorrelationsVsMPro[ci]->SetBinError(b,0.);
14279     continue;
14280    } 
14281    Double_t correlationVsM = fIntFlowCorrelationsVsMPro[ci]->GetBinContent(b);
14282    Double_t squaredCorrelationVsM = fIntFlowSquaredCorrelationsVsMPro[ci]->GetBinContent(b);
14283    Double_t spreadVsM = 0.;
14284    if(squaredCorrelationVsM-correlationVsM*correlationVsM >= 0.)
14285    {
14286     spreadVsM = pow(squaredCorrelationVsM-correlationVsM*correlationVsM,0.5);
14287    } else
14288      {
14289       cout<<endl;
14290       cout<<Form(" WARNING (QC): Imaginary 'spreadVsM' for ci = %d, bin = %d, entries = %f !!!!",
14291                  ci,b,fIntFlowCorrelationsVsMPro[ci]->GetBinEffectiveEntries(b))<<endl; 
14292       cout<<endl;
14293      }     
14294    Double_t sumOfLinearEventWeightsVsM = fIntFlowSumOfEventWeightsVsM[ci][0]->GetBinContent(b);
14295    Double_t sumOfQuadraticEventWeightsVsM = fIntFlowSumOfEventWeightsVsM[ci][1]->GetBinContent(b);
14296    Double_t termAVsM = 0.;
14297    Double_t termBVsM = 0.;
14298    if(sumOfLinearEventWeightsVsM > 0.) 
14299    {
14300     termAVsM = pow(sumOfQuadraticEventWeightsVsM,0.5)/sumOfLinearEventWeightsVsM;
14301    }
14302    if(1.-pow(termAVsM,2.) > 0.)
14303    {
14304     termBVsM = 1./pow(1-pow(termAVsM,2.),0.5);
14305    }     
14306    Double_t statisticalErrorVsM = termAVsM * spreadVsM * termBVsM;
14307    fIntFlowCorrelationsVsMHist[ci]->SetBinContent(b,correlationVsM);
14308    fIntFlowCorrelationsVsMHist[ci]->SetBinError(b,statisticalErrorVsM);  
14309   } // end of for(Int_t b=1;b<=nBins;b++)
14310  } // end of for(Int_t ci=1;ci<=4;ci++) // correlation index                                                        
14311                                                                                                                            
14312 } // end of AliFlowAnalysisWithQCumulants::FinalizeCorrelationsIntFlow()
14313
14314 //=======================================================================================================================
14315
14316 void AliFlowAnalysisWithQCumulants::FillAverageMultiplicities(Int_t nRP)
14317 {
14318  // Fill profile fAverageMultiplicity to hold average multiplicities and 
14319  // number of events for events with nRP>=0, nRP>=1, ... , and nRP>=8
14320  
14321  // Binning of fAverageMultiplicity is organized as follows:
14322  //  1st bin: all events (including the empty ones)
14323  //  2nd bin: event with # of RPs greater or equal to 1
14324  //  3rd bin: event with # of RPs greater or equal to 2
14325  //  4th bin: event with # of RPs greater or equal to 3
14326  //  5th bin: event with # of RPs greater or equal to 4
14327  //  6th bin: event with # of RPs greater or equal to 5
14328  //  7th bin: event with # of RPs greater or equal to 6
14329  //  8th bin: event with # of RPs greater or equal to 7
14330  //  9th bin: event with # of RPs greater or equal to 8
14331  
14332  if(nRP<0)
14333  {
14334   cout<<endl;
14335   cout<<" WARNING (QC): nRP<0 in in AFAWQC::FAM() !!!!"<<endl;
14336   cout<<endl;
14337   exit(0);
14338  }
14339  
14340  for(Int_t i=0;i<9;i++)
14341  {
14342   if(nRP>=i){fAvMultiplicity->Fill(i+0.5,nRP,1);}
14343  }
14344  
14345 } // end of AliFlowAnalysisWithQCumulants::FillAverageMultiplicities(nRP)
14346
14347 //=======================================================================================================================
14348
14349 void AliFlowAnalysisWithQCumulants::CalculateCumulantsIntFlow()
14350
14351  // a) Calculate Q-cumulants from the measured multiparticle correlations;
14352  // b) Propagate the statistical errors from measured multiparticle correlations to statistical errors of Q-cumulants;  
14353  // c) Remark: Q-cumulants calculated in this method are biased by non-uniform acceptance of detector !!!! 
14354  //            Method CalculateQcumulantsCorrectedForNUAIntFlow() is called afterwards to correct for this bias;
14355  // d) Store the results and statistical error of Q-cumulants in histogram fIntFlowQcumulants.
14356  //    Binning of fIntFlowQcumulants is organized as follows:
14357  //
14358  //            1st bin: QC{2}
14359  //            2nd bin: QC{4}
14360  //            3rd bin: QC{6}
14361  //            4th bin: QC{8}
14362  //
14363  
14364  // Correlations:
14365  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>> 
14366  Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>>  
14367  Double_t six = fIntFlowCorrelationsHist->GetBinContent(3); // <<6>> 
14368  Double_t eight = fIntFlowCorrelationsHist->GetBinContent(4); // <<8>>  
14369  // Statistical errors of average 2-, 4-, 6- and 8-particle azimuthal correlations:
14370  Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1); // statistical error of <2>  
14371  Double_t fourError = fIntFlowCorrelationsHist->GetBinError(2); // statistical error of <4>   
14372  Double_t sixError = fIntFlowCorrelationsHist->GetBinError(3); // statistical error of <6> 
14373  Double_t eightError = fIntFlowCorrelationsHist->GetBinError(4); // statistical error of <8> 
14374  // Covariances (multiplied by prefactor depending on weights - see comments in CalculateCovariancesIntFlow()):
14375  Double_t wCov24 = 0.; // Cov(<2>,<4>) * prefactor(w_<2>,w_<4>)
14376  Double_t wCov26 = 0.; // Cov(<2>,<6>) * prefactor(w_<2>,w_<6>)
14377  Double_t wCov28 = 0.; // Cov(<2>,<8>) * prefactor(w_<2>,w_<8>)
14378  Double_t wCov46 = 0.; // Cov(<4>,<6>) * prefactor(w_<4>,w_<6>)
14379  Double_t wCov48 = 0.; // Cov(<4>,<8>) * prefactor(w_<4>,w_<8>)
14380  Double_t wCov68 = 0.; // Cov(<6>,<8>) * prefactor(w_<6>,w_<8>)  
14381  if(!fForgetAboutCovariances)
14382  {
14383   wCov24 = fIntFlowCovariances->GetBinContent(1); // Cov(<2>,<4>) * prefactor(w_<2>,w_<4>)
14384   wCov26 = fIntFlowCovariances->GetBinContent(2); // Cov(<2>,<6>) * prefactor(w_<2>,w_<6>)
14385   wCov28 = fIntFlowCovariances->GetBinContent(3); // Cov(<2>,<8>) * prefactor(w_<2>,w_<8>)
14386   wCov46 = fIntFlowCovariances->GetBinContent(4); // Cov(<4>,<6>) * prefactor(w_<4>,w_<6>)
14387   wCov48 = fIntFlowCovariances->GetBinContent(5); // Cov(<4>,<8>) * prefactor(w_<4>,w_<8>)
14388   wCov68 = fIntFlowCovariances->GetBinContent(6); // Cov(<6>,<8>) * prefactor(w_<6>,w_<8>) 
14389  }
14390  // Q-cumulants: 
14391  Double_t qc2 = 0.; // QC{2}
14392  Double_t qc4 = 0.; // QC{4}
14393  Double_t qc6 = 0.; // QC{6}
14394  Double_t qc8 = 0.; // QC{8}
14395  if(TMath::Abs(two) > 0.){qc2 = two;} 
14396  if(TMath::Abs(four) > 0.){qc4 = four-2.*pow(two,2.);} 
14397  if(TMath::Abs(six) > 0.){qc6 = six-9.*two*four+12.*pow(two,3.);} 
14398  if(TMath::Abs(eight) > 0.){qc8 = eight-16.*two*six-18.*pow(four,2.)+144.*pow(two,2.)*four-144.*pow(two,4.);} 
14399  // Statistical errors of Q-cumulants:       
14400  Double_t qc2Error = 0.;
14401  Double_t qc4Error = 0.;
14402  Double_t qc6Error = 0.;
14403  Double_t qc8Error = 0.; 
14404  // Squared statistical errors of Q-cumulants:       
14405  //Double_t qc2ErrorSquared = 0.;
14406  Double_t qc4ErrorSquared = 0.;
14407  Double_t qc6ErrorSquared = 0.;
14408  Double_t qc8ErrorSquared = 0.;        
14409  // Statistical error of QC{2}:              
14410  qc2Error = twoError;                                                 
14411  // Statistical error of QC{4}:              
14412  qc4ErrorSquared = 16.*pow(two,2.)*pow(twoError,2)+pow(fourError,2.)
14413                  - 8.*two*wCov24;                     
14414  if(qc4ErrorSquared>0.)
14415  {
14416   qc4Error = pow(qc4ErrorSquared,0.5);
14417  } else 
14418    {
14419     cout<<" WARNING (QC): Statistical error of QC{4} is imaginary !!!!"<<endl;
14420    }                                           
14421  // Statistical error of QC{6}:              
14422  qc6ErrorSquared = 81.*pow(4.*pow(two,2.)-four,2.)*pow(twoError,2.)
14423                  + 81.*pow(two,2.)*pow(fourError,2.)
14424                  + pow(sixError,2.)
14425                  - 162.*two*(4.*pow(two,2.)-four)*wCov24
14426                  + 18.*(4.*pow(two,2.)-four)*wCov26
14427                  - 18.*two*wCov46;                     
14428  if(qc6ErrorSquared>0.)
14429  {
14430   qc6Error = pow(qc6ErrorSquared,0.5);
14431  } else 
14432    {
14433     cout<<" WARNING (QC): Statistical error of QC{6} is imaginary !!!!"<<endl;
14434    }                       
14435  // Statistical error of QC{8}:              
14436  qc8ErrorSquared = 256.*pow(36.*pow(two,3.)-18.*four*two+six,2.)*pow(twoError,2.)
14437                  + 1296.*pow(4.*pow(two,2.)-four,2.)*pow(fourError,2.)
14438                  + 256.*pow(two,2.)*pow(sixError,2.)
14439                  + pow(eightError,2.)
14440                  - 1152.*(36.*pow(two,3.)-18.*four*two+six)*(4.*pow(two,2.)-four)*wCov24
14441                  + 512.*two*(36.*pow(two,3.)-18.*four*two+six)*wCov26
14442                  - 32.*(36.*pow(two,3.)-18.*four*two+six)*wCov28
14443                  - 1152.*two*(4.*pow(two,2.)-four)*wCov46
14444                  + 72.*(4.*pow(two,2.)-four)*wCov48
14445                  - 32.*two*wCov68;      
14446  if(qc8ErrorSquared>0.)
14447  {
14448   qc8Error = pow(qc8ErrorSquared,0.5);
14449  } else 
14450    {
14451     cout<<"WARNING (QC): Statistical error of QC{8} is imaginary !!!!"<<endl;
14452    }
14453  // Store the results and statistical errors for Q-cumulants:
14454  if(TMath::Abs(qc2)>0.)
14455  {
14456   fIntFlowQcumulants->SetBinContent(1,qc2);
14457   fIntFlowQcumulants->SetBinError(1,qc2Error);
14458  }
14459  if(TMath::Abs(qc4)>0.)
14460  {
14461   fIntFlowQcumulants->SetBinContent(2,qc4);
14462   fIntFlowQcumulants->SetBinError(2,qc4Error);
14463  }
14464  if(TMath::Abs(qc6)>0.)
14465  {
14466   fIntFlowQcumulants->SetBinContent(3,qc6);
14467   fIntFlowQcumulants->SetBinError(3,qc6Error);
14468  }
14469  if(TMath::Abs(qc8)>0.)
14470  {
14471   fIntFlowQcumulants->SetBinContent(4,qc8); 
14472   fIntFlowQcumulants->SetBinError(4,qc8Error);
14473  } 
14474  
14475  // Versus multiplicity: 
14476  if(!fCalculateCumulantsVsM){return;}
14477  Int_t nBins = fIntFlowCorrelationsVsMPro[0]->GetNbinsX(); // tbi (hardwired 0) 
14478  Double_t value[4] = {0.}; // QCs vs M
14479  Double_t error[4] = {0.}; // error of QCs vs M
14480  Double_t dSum1[4] = {0.}; // sum value_i/(error_i)^2
14481  Double_t dSum2[4] = {0.}; // sum 1/(error_i)^2
14482  two = 0.; // TBI can be done safer, lines below included 
14483  twoError = 0.;
14484  four = 0.;
14485  fourError = 0.;
14486  six = 0.;
14487  sixError = 0.;
14488  eight = 0.;
14489  eightError = 0.;
14490  wCov24 = 0.;
14491  wCov26 = 0.; 
14492  wCov28 = 0.; 
14493  wCov46 = 0.; 
14494  wCov48 = 0.; 
14495  wCov68 = 0.; 
14496  for(Int_t b=1;b<=nBins;b++)
14497  {
14498   // Correlations:
14499   if(!fUse2DHistograms)
14500   {
14501    if(!fUseQvectorTerms)
14502    {
14503
14504      //cout<<"TProfile"<<endl;
14505
14506     two = fIntFlowCorrelationsVsMHist[0]->GetBinContent(b); // <<2>>  
14507     four = fIntFlowCorrelationsVsMHist[1]->GetBinContent(b); // <<4>>  
14508     six = fIntFlowCorrelationsVsMHist[2]->GetBinContent(b); // <<6>> 
14509     eight = fIntFlowCorrelationsVsMHist[3]->GetBinContent(b); // <<8>>  
14510    } // end of if(!fUseQvectorTerms) 
14511   } else
14512     {
14513      // TH2D:
14514
14515      //cout<<"TH2D"<<endl;
14516
14517      two = fCorrelation2468VsMult[0]->ProjectionY("2",b,b)->GetMean(); // <<2>>  
14518      four = fCorrelation2468VsMult[1]->ProjectionY("4",b,b)->GetMean(); // <<4>>
14519      six = fCorrelation2468VsMult[2]->ProjectionY("6",b,b)->GetMean(); // <<6>>
14520      eight = fCorrelation2468VsMult[3]->ProjectionY("8",b,b)->GetMean(); // <<8>>
14521     } 
14522   if(fUseQvectorTerms)
14523   {
14524    Double_t dM = fIntFlowCorrelationsVsMPro[0]->GetBinLowEdge(b);
14525    if(dM>3.) // TBI re-think this if statement
14526    {
14527
14528     //cout<<"Q-vector terms"<<endl;
14529
14530     two = (fQvectorTermsVsMult[0]->ProjectionY("qvt0a",b,b)->GetMean()-1.)/(dM-1.);    
14531     Double_t dTerm1 = (dM*(2.*dM-1.))*fQvectorTermsVsMult[2]->ProjectionY("qvt2",b,b)->GetMean();
14532     Double_t dTerm2 = dM*fQvectorTermsVsMult[1]->ProjectionY("qvt1",b,b)->GetMean();
14533     Double_t dTerm3 = -2.*pow(dM,1.5)*fQvectorTermsVsMult[3]->ProjectionY("qvt3",b,b)->GetMean();
14534     Double_t dTerm4 = -4.*(dM-2.)*dM*fQvectorTermsVsMult[0]->ProjectionY("qvt0b",b,b)->GetMean();
14535     Double_t dTerm5 = 2.*dM*(dM-3.); 
14536     four = (dTerm1+dTerm2+dTerm3+dTerm4+dTerm5)/(dM*(dM-1.)*(dM-2.)*(dM-3.));
14537    } // end of if(dM>3.) // TBI rethink this if statement
14538   } // end of else if(fUseQvectorTerms) 
14539   // Statistical errors of average 2-, 4-, 6- and 8-particle azimuthal correlations:
14540   if(!fUse2DHistograms)
14541   {
14542    if(!fUseQvectorTerms)
14543    {
14544     twoError = fIntFlowCorrelationsVsMHist[0]->GetBinError(b); // <2> error  
14545     fourError = fIntFlowCorrelationsVsMHist[1]->GetBinError(b); // <4> error    
14546     sixError = fIntFlowCorrelationsVsMHist[2]->GetBinError(b); // <6> error  
14547     eightError = fIntFlowCorrelationsVsMHist[3]->GetBinError(b); // <8> error  
14548    }
14549   } else
14550     {
14551      // TH2D:
14552      twoError = fCorrelation2468VsMult[0]->ProjectionY("2",b,b)->GetMeanError(); // <2> error
14553      fourError = fCorrelation2468VsMult[1]->ProjectionY("4",b,b)->GetMeanError(); // <4> error 
14554      sixError = fCorrelation2468VsMult[2]->ProjectionY("6",b,b)->GetMeanError(); // <6> error 
14555      eightError = fCorrelation2468VsMult[3]->ProjectionY("8",b,b)->GetMeanError(); // <8> error 
14556     } // end of else
14557   if(fUseQvectorTerms)
14558   {
14559    Double_t dM = fIntFlowCorrelationsVsMPro[0]->GetBinLowEdge(b);
14560    if(dM>3.) // TBI re-think this if statement
14561    {
14562     twoError = (fQvectorTermsVsMult[0]->ProjectionY("qvt0a",b,b)->GetMeanError())/(dM-1.); 
14563    }
14564   } // end of if(fUseQvectorTerms)
14565
14566   // Covariances (multiplied by prefactor depending on weights - see comments in CalculateCovariancesIntFlow()):
14567   if(!fForgetAboutCovariances)
14568   {
14569    if(!fUse2DHistograms)
14570    {
14571     if(!fUseQvectorTerms)
14572     {
14573      wCov24 = fIntFlowCovariancesVsM[0]->GetBinContent(b); // Cov(<2>,<4>) * prefactor(w_<2>,w_<4>)
14574      wCov26 = fIntFlowCovariancesVsM[1]->GetBinContent(b); // Cov(<2>,<6>) * prefactor(w_<2>,w_<6>)
14575      wCov28 = fIntFlowCovariancesVsM[2]->GetBinContent(b); // Cov(<2>,<8>) * prefactor(w_<2>,w_<8>)
14576      wCov46 = fIntFlowCovariancesVsM[3]->GetBinContent(b); // Cov(<4>,<6>) * prefactor(w_<4>,w_<6>)
14577      wCov48 = fIntFlowCovariancesVsM[4]->GetBinContent(b); // Cov(<4>,<8>) * prefactor(w_<4>,w_<8>)
14578      wCov68 = fIntFlowCovariancesVsM[5]->GetBinContent(b); // Cov(<6>,<8>) * prefactor(w_<6>,w_<8>) 
14579     }
14580    } else
14581      {
14582       // TH2D:
14583        Int_t nEntries = (Int_t)(fCorrelationProduct2468VsMult[0]->ProjectionY("Cov(2,4)",b,b)->GetEntries());
14584       if(nEntries>0.)
14585       {      
14586        wCov24 = (fCorrelationProduct2468VsMult[0]->ProjectionY("Cov(2,4)",b,b)->GetMean()
14587               - (fCorrelation2468VsMult[0]->ProjectionY("2cov",b,b)->GetMean()) 
14588               * (fCorrelation2468VsMult[1]->ProjectionY("4cov",b,b)->GetMean()))
14589               / nEntries; // w*Cov(<2>,<4>)
14590       } // end of if(nEntries>0. && dn2pCombinations>0. && dn4pCombinations>0.)
14591       // ... TBI add other covariances as well 
14592      }
14593   } // end of if(!fForgetAboutCovariances)
14594   // Q-cumulants: 
14595   qc2 = 0.; // QC{2}
14596   qc4 = 0.; // QC{4}
14597   qc6 = 0.; // QC{6}
14598   qc8 = 0.; // QC{8}
14599   if(TMath::Abs(two) > 0.){qc2 = two;} 
14600   if(TMath::Abs(four) > 0.){qc4 = four-2.*pow(two,2.);} 
14601   if(TMath::Abs(six) > 0.){qc6 = six-9.*two*four+12.*pow(two,3.);} 
14602   if(TMath::Abs(eight) > 0.){qc8 = eight-16.*two*six-18.*pow(four,2.)+144.*pow(two,2.)*four-144.*pow(two,4.);}  
14603   // Statistical errors of Q-cumulants:       
14604   qc2Error = 0.;
14605   qc4Error = 0.;
14606   qc6Error = 0.;
14607   qc8Error = 0.; 
14608   // Squared statistical errors of Q-cumulants:       
14609   //Double_t qc2ErrorSquared = 0.;
14610   qc4ErrorSquared = 0.;
14611   qc6ErrorSquared = 0.;
14612   qc8ErrorSquared = 0.;    
14613   // Statistical error of QC{2}:              
14614   qc2Error = twoError;                                             
14615   // Statistical error of QC{4}:              
14616   qc4ErrorSquared = 16.*pow(two,2.)*pow(twoError,2)+pow(fourError,2.)
14617                   - 8.*two*wCov24;  
14618   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 :'(                   
14619   if(qc4ErrorSquared>0.)
14620   {
14621    qc4Error = pow(qc4ErrorSquared,0.5);
14622   } else 
14623     {
14624      // cout<<"WARNING: Statistical error of QC{4} is imaginary in multiplicity bin "<<b<<" !!!!"<<endl;
14625     }                                       
14626   // Statistical error of QC{6}:              
14627   qc6ErrorSquared = 81.*pow(4.*pow(two,2.)-four,2.)*pow(twoError,2.)
14628                   + 81.*pow(two,2.)*pow(fourError,2.)
14629                   + pow(sixError,2.)
14630                   - 162.*two*(4.*pow(two,2.)-four)*wCov24
14631                   + 18.*(4.*pow(two,2.)-four)*wCov26
14632                   - 18.*two*wCov46;                     
14633   if(qc6ErrorSquared>0.)
14634   {
14635    qc6Error = pow(qc6ErrorSquared,0.5);
14636   } else 
14637     {
14638      // cout<<"WARNING: Statistical error of QC{6} is imaginary in multiplicity bin "<<b<<" !!!!"<<endl;
14639     }                            
14640   // Statistical error of QC{8}:              
14641   qc8ErrorSquared = 256.*pow(36.*pow(two,3.)-18.*four*two+six,2.)*pow(twoError,2.)
14642                   + 1296.*pow(4.*pow(two,2.)-four,2.)*pow(fourError,2.)
14643                   + 256.*pow(two,2.)*pow(sixError,2.)
14644                   + pow(eightError,2.)
14645                   - 1152.*(36.*pow(two,3.)-18.*four*two+six)*(4.*pow(two,2.)-four)*wCov24
14646                   + 512.*two*(36.*pow(two,3.)-18.*four*two+six)*wCov26
14647                   - 32.*(36.*pow(two,3.)-18.*four*two+six)*wCov28
14648                   - 1152.*two*(4.*pow(two,2.)-four)*wCov46
14649                   + 72.*(4.*pow(two,2.)-four)*wCov48
14650                   - 32.*two*wCov68;      
14651   if(qc8ErrorSquared>0.)
14652   {
14653    qc8Error = pow(qc8ErrorSquared,0.5);
14654   } else 
14655     {
14656      // cout<<"WARNING: Statistical error of QC{8} is imaginary in multiplicity bin "<<b<<" !!!!"<<endl;
14657     }
14658   // Store the results and statistical errors for Q-cumulants:
14659   if(TMath::Abs(qc2)>0.)
14660   {
14661    fIntFlowQcumulantsVsM[0]->SetBinContent(b,qc2);
14662    fIntFlowQcumulantsVsM[0]->SetBinError(b,qc2Error);  
14663   }
14664   if(TMath::Abs(qc4)>0.)
14665   {
14666    fIntFlowQcumulantsVsM[1]->SetBinContent(b,qc4);  
14667    fIntFlowQcumulantsVsM[1]->SetBinError(b,qc4Error);
14668   }
14669   if(TMath::Abs(qc6)>0.)
14670   {
14671    fIntFlowQcumulantsVsM[2]->SetBinContent(b,qc6); 
14672    fIntFlowQcumulantsVsM[2]->SetBinError(b,qc6Error);
14673   }
14674   if(TMath::Abs(qc8)>0.)
14675   {  
14676    fIntFlowQcumulantsVsM[3]->SetBinContent(b,qc8);
14677    fIntFlowQcumulantsVsM[3]->SetBinError(b,qc8Error);
14678   } 
14679   // Rebin in M:
14680   for(Int_t co=0;co<4;co++)
14681   {
14682    if(fIntFlowCorrelationsVsMPro[co]->GetBinEffectiveEntries(b)<2){continue;}
14683    value[co] = fIntFlowQcumulantsVsM[co]->GetBinContent(b);
14684    error[co] = fIntFlowQcumulantsVsM[co]->GetBinError(b);
14685    if(error[co]>0.)
14686    {
14687     dSum1[co]+=value[co]/(error[co]*error[co]);
14688     dSum2[co]+=1./(error[co]*error[co]);
14689    }
14690   } // end of for(Int_t co=0;co<4;co++) 
14691  } // end of for(Int_t b=1;b<=nBins;b++)
14692  // Store rebinned Q-cumulants:
14693  for(Int_t co=0;co<4;co++)
14694  {
14695   if(dSum2[co]>0.)
14696   {
14697    fIntFlowQcumulantsRebinnedInM->SetBinContent(co+1,dSum1[co]/dSum2[co]);
14698    fIntFlowQcumulantsRebinnedInM->SetBinError(co+1,pow(1./dSum2[co],0.5));
14699   }
14700  } // end of for(Int_t co=0;co<4;co++)
14701  
14702 } // end of void AliFlowAnalysisWithQCumulants::CalculateCumulantsIntFlow()
14703
14704 //================================================================================================================================ 
14705
14706 void AliFlowAnalysisWithQCumulants::CalculateCumulantsForBootstrap()
14707 {
14708  // Calculate cumulants for bootstrap.
14709
14710  if(fUseBootstrap)
14711  {
14712   for(Int_t ss=0;ss<fnSubsamples;ss++)
14713   {
14714    // Correlations:
14715    Double_t two = fBootstrapCorrelations->GetBinContent(fBootstrapCorrelations->GetBin(1,ss+1)); 
14716    Double_t four = fBootstrapCorrelations->GetBinContent(fBootstrapCorrelations->GetBin(2,ss+1)); 
14717    Double_t six = fBootstrapCorrelations->GetBinContent(fBootstrapCorrelations->GetBin(3,ss+1)); 
14718    Double_t eight = fBootstrapCorrelations->GetBinContent(fBootstrapCorrelations->GetBin(4,ss+1)); 
14719    // Q-cumulants:
14720    Double_t qc2 = 0.; // QC{2}
14721    Double_t qc4 = 0.; // QC{4}
14722    Double_t qc6 = 0.; // QC{6}
14723    Double_t qc8 = 0.; // QC{8}
14724    if(TMath::Abs(two) > 0.){qc2 = two;} 
14725    if(TMath::Abs(four) > 0.){qc4 = four-2.*pow(two,2.);} 
14726    if(TMath::Abs(six) > 0.){qc6 = six-9.*two*four+12.*pow(two,3.);} 
14727    if(TMath::Abs(eight) > 0.){qc8 = eight-16.*two*six-18.*pow(four,2.)+144.*pow(two,2.)*four-144.*pow(two,4.);}  
14728    fBootstrapCumulants->SetBinContent(fBootstrapCumulants->GetBin(1,ss+1),qc2); 
14729    fBootstrapCumulants->SetBinContent(fBootstrapCumulants->GetBin(2,ss+1),qc4); 
14730    fBootstrapCumulants->SetBinContent(fBootstrapCumulants->GetBin(3,ss+1),qc6); 
14731    fBootstrapCumulants->SetBinContent(fBootstrapCumulants->GetBin(4,ss+1),qc8); 
14732    /*
14733    if(qc2>=0.){fBootstrapCumulants->SetBinContent(fBootstrapCumulants->GetBin(1,ss+1),pow(qc2,0.5));}
14734    if(qc4<=0.){fBootstrapCumulants->SetBinContent(fBootstrapCumulants->GetBin(2,ss+1),pow(-1.*qc4,1./4.));} 
14735    if(qc6>=0.){fBootstrapCumulants->SetBinContent(fBootstrapCumulants->GetBin(3,ss+1),pow((1./4.)*qc6,1./6.));}
14736    if(qc8<=0.){fBootstrapCumulants->SetBinContent(fBootstrapCumulants->GetBin(4,ss+1),pow((-1./33.)*qc8,1./8.));}  
14737    cout<<"Subsample #"<<ss<<":"<<endl;   
14738    cout<<"v2{2} = "<<pow(qc2,0.5)<<endl;
14739    cout<<"v2{4} = "<<pow(-1.*qc4,1./4.)<<endl;
14740    cout<<"v2{6} = "<<pow((1./4.)*qc6,1./6.)<<endl;
14741    cout<<"v2{8} = "<<pow((-1./33.)*qc8,1./8.)<<endl;
14742    cout<<endl;
14743    */
14744   } // end of for(Int_t ss=0;ss<fnSubsamples;ss++)
14745  } // end of if(fUseBootstrap)
14746
14747  if(fUseBootstrapVsM)  
14748  {
14749   for(Int_t mb=1;mb<=fnBinsMult;mb++)
14750   {
14751    for(Int_t ss=0;ss<fnSubsamples;ss++) 
14752    {
14753     // Correlations:
14754     Double_t two = fBootstrapCorrelationsVsM[0]->GetBinContent(fBootstrapCorrelationsVsM[0]->GetBin(mb,ss+1)); 
14755     Double_t four = fBootstrapCorrelationsVsM[1]->GetBinContent(fBootstrapCorrelationsVsM[1]->GetBin(mb,ss+1)); 
14756     Double_t six = fBootstrapCorrelationsVsM[2]->GetBinContent(fBootstrapCorrelationsVsM[2]->GetBin(mb,ss+1)); 
14757     Double_t eight = fBootstrapCorrelationsVsM[3]->GetBinContent(fBootstrapCorrelationsVsM[3]->GetBin(mb,ss+1)); 
14758     // Q-cumulants:
14759     Double_t qc2 = 0.; // QC{2}
14760     Double_t qc4 = 0.; // QC{4}
14761     Double_t qc6 = 0.; // QC{6}
14762     Double_t qc8 = 0.; // QC{8}
14763     if(TMath::Abs(two) > 0.){qc2 = two;} 
14764     if(TMath::Abs(four) > 0.){qc4 = four-2.*pow(two,2.);} 
14765     if(TMath::Abs(six) > 0.){qc6 = six-9.*two*four+12.*pow(two,3.);} 
14766     if(TMath::Abs(eight) > 0.){qc8 = eight-16.*two*six-18.*pow(four,2.)+144.*pow(two,2.)*four-144.*pow(two,4.);}  
14767     fBootstrapCumulantsVsM[0]->SetBinContent(fBootstrapCumulantsVsM[0]->GetBin(mb,ss+1),qc2); 
14768     fBootstrapCumulantsVsM[1]->SetBinContent(fBootstrapCumulantsVsM[1]->GetBin(mb,ss+1),qc4); 
14769     fBootstrapCumulantsVsM[2]->SetBinContent(fBootstrapCumulantsVsM[2]->GetBin(mb,ss+1),qc6); 
14770     fBootstrapCumulantsVsM[3]->SetBinContent(fBootstrapCumulantsVsM[3]->GetBin(mb,ss+1),qc8);     
14771     /*
14772     if(qc2>=0.){fBootstrapCumulantsVsM[0]->SetBinContent(fBootstrapCumulantsVsM[0]->GetBin(mb,ss+1),pow(qc2,0.5));}
14773     if(qc4<=0.){fBootstrapCumulantsVsM[1]->SetBinContent(fBootstrapCumulantsVsM[1]->GetBin(mb,ss+1),pow(-1.*qc4,1./4.));} 
14774     if(qc6>=0.){fBootstrapCumulantsVsM[2]->SetBinContent(fBootstrapCumulantsVsM[2]->GetBin(mb,ss+1),pow((1./4.)*qc6,1./6.));}
14775     if(qc8<=0.){fBootstrapCumulantsVsM[3]->SetBinContent(fBootstrapCumulantsVsM[3]->GetBin(mb,ss+1),pow((-1./33.)*qc8,1./8.));}  
14776     */    
14777    } // end of for(Int_t ss=0;ss<fnSubsamples;ss++)
14778   } // end of for(Int_t mb=1;mb<=fnBinsMult;mb++)
14779  } // end of if(fUseBootstrapVsM) 
14780
14781
14782  return;
14783
14784 } // end of void AliFlowAnalysisWithQCumulants::CalculateCumulantsForBootstrap()
14785
14786 //================================================================================================================================ 
14787
14788 void AliFlowAnalysisWithQCumulants::CalculateReferenceFlow()
14789 {
14790  // a) Calculate the final results for reference flow estimates from Q-cumulants;
14791  // b) Propagate the statistical errors to reference flow estimates from statistical error of Q-cumulants; 
14792  // c) Store the results and statistical errors of reference flow estimates in histogram fIntFlow.
14793  //    Binning of fIntFlow is organized as follows:
14794  //
14795  //            1st bin: v{2,QC}
14796  //            2nd bin: v{4,QC}
14797  //            3rd bin: v{6,QC}
14798  //            4th bin: v{8,QC}
14799  //
14800  
14801  // Reference flow estimates:
14802  Double_t v2 = 0.; // v{2,QC}  
14803  Double_t v4 = 0.; // v{4,QC}  
14804  Double_t v6 = 0.; // v{6,QC}  
14805  Double_t v8 = 0.; // v{8,QC}
14806  // Reference flow's statistical errors:
14807  Double_t v2Error = 0.; // v{2,QC} stat. error 
14808  Double_t v4Error = 0.; // v{4,QC} stat. error
14809  Double_t v6Error = 0.; // v{6,QC} stat. error
14810  Double_t v8Error = 0.; // v{8,QC} stat. error
14811   
14812  // Q-cumulants:
14813  Double_t qc2 = fIntFlowQcumulants->GetBinContent(1); // QC{2}  
14814  Double_t qc4 = fIntFlowQcumulants->GetBinContent(2); // QC{4}  
14815  Double_t qc6 = fIntFlowQcumulants->GetBinContent(3); // QC{6}  
14816  Double_t qc8 = fIntFlowQcumulants->GetBinContent(4); // QC{8}
14817  // Q-cumulants's statistical errors: 
14818  Double_t qc2Error = fIntFlowQcumulants->GetBinError(1); // QC{2} stat. error  
14819  Double_t qc4Error = fIntFlowQcumulants->GetBinError(2); // QC{4} stat. error  
14820  Double_t qc6Error = fIntFlowQcumulants->GetBinError(3); // QC{6} stat. error  
14821  Double_t qc8Error = fIntFlowQcumulants->GetBinError(4); // QC{8} stat. error
14822  // Calculate reference flow estimates from Q-cumulants: 
14823  if(qc2>=0.){v2 = pow(qc2,0.5);} 
14824  if(qc4<=0.){v4 = pow(-1.*qc4,1./4.);} 
14825  if(qc6>=0.){v6 = pow((1./4.)*qc6,1./6.);}
14826  if(qc8<=0.){v8 = pow((-1./33.)*qc8,1./8.);}  
14827  // Calculate stat. error for reference flow estimates from stat. error of Q-cumulants:  
14828  if(qc2>0.){v2Error = (1./2.)*pow(qc2,-0.5)*qc2Error;} 
14829  if(qc4<0.){v4Error = (1./4.)*pow(-qc4,-3./4.)*qc4Error;} 
14830  if(qc6>0.){v6Error = (1./6.)*pow(2.,-1./3.)*pow(qc6,-5./6.)*qc6Error;}   
14831  if(qc8<0.){v8Error = (1./8.)*pow(33.,-1./8.)*pow(-qc8,-7./8.)*qc8Error;}   
14832  // Print warnings for the 'wrong sign' cumulants: 
14833  if(TMath::Abs(v2) < 1.e-44)
14834  {
14835   cout<<" WARNING: Wrong sign QC{2}, couldn't calculate v{2,QC} !!!!"<<endl;
14836  }
14837  if(TMath::Abs(v4) < 1.e-44)
14838  {
14839   cout<<" WARNING: Wrong sign QC{4}, couldn't calculate v{4,QC} !!!!"<<endl;
14840  } 
14841  if(TMath::Abs(v6) < 1.e-44)
14842  {
14843   cout<<" WARNING: Wrong sign QC{6}, couldn't calculate v{6,QC} !!!!"<<endl; 
14844  }
14845  if(TMath::Abs(v8) < 1.e-44)
14846  {
14847   cout<<" WARNING: Wrong sign QC{8}, couldn't calculate v{8,QC} !!!!"<<endl;
14848  }                       
14849  // Store the results and statistical errors of integrated flow estimates:
14850  fIntFlow->SetBinContent(1,v2);
14851  fIntFlow->SetBinError(1,v2Error);
14852  fIntFlow->SetBinContent(2,v4);
14853  fIntFlow->SetBinError(2,v4Error);
14854  fIntFlow->SetBinContent(3,v6);
14855  fIntFlow->SetBinError(3,v6Error);
14856  fIntFlow->SetBinContent(4,v8);
14857  fIntFlow->SetBinError(4,v8Error);  
14858   
14859  // Versus multiplicity: 
14860  if(!fCalculateCumulantsVsM){return;} 
14861  Int_t nBins = fIntFlowCorrelationsVsMPro[0]->GetNbinsX(); // to be improved (hardwired 0) 
14862  for(Int_t b=1;b<=nBins;b++)
14863  {
14864   // Q-cumulants:
14865   Double_t qc2VsM = fIntFlowQcumulantsVsM[0]->GetBinContent(b); // QC{2}  
14866   Double_t qc4VsM = fIntFlowQcumulantsVsM[1]->GetBinContent(b); // QC{4}  
14867   Double_t qc6VsM = fIntFlowQcumulantsVsM[2]->GetBinContent(b); // QC{6}  
14868   Double_t qc8VsM = fIntFlowQcumulantsVsM[3]->GetBinContent(b); // QC{8}
14869   // Q-cumulants's statistical errors: 
14870   Double_t qc2ErrorVsM = fIntFlowQcumulantsVsM[0]->GetBinError(b); // QC{2} stat. error  
14871   Double_t qc4ErrorVsM = fIntFlowQcumulantsVsM[1]->GetBinError(b); // QC{4} stat. error  
14872   Double_t qc6ErrorVsM = fIntFlowQcumulantsVsM[2]->GetBinError(b); // QC{6} stat. error  
14873   Double_t qc8ErrorVsM = fIntFlowQcumulantsVsM[3]->GetBinError(b); // QC{8} stat. error
14874   // Reference flow estimates:
14875   Double_t v2VsM = 0.; // v{2,QC}  
14876   Double_t v4VsM = 0.; // v{4,QC}  
14877   Double_t v6VsM = 0.; // v{6,QC}  
14878   Double_t v8VsM = 0.; // v{8,QC}
14879   // Reference flow estimates errors:
14880   Double_t v2ErrorVsM = 0.; // v{2,QC} stat. error  
14881   Double_t v4ErrorVsM = 0.; // v{4,QC} stat. error
14882   Double_t v6ErrorVsM = 0.; // v{6,QC} stat. error  
14883   Double_t v8ErrorVsM = 0.; // v{8,QC} stat. error
14884   // Calculate reference flow estimates from Q-cumulants: 
14885   if(qc2VsM>=0.){v2VsM = pow(qc2VsM,0.5);} 
14886   if(qc4VsM<=0.){v4VsM = pow(-1.*qc4VsM,1./4.);} 
14887   if(qc6VsM>=0.){v6VsM = pow((1./4.)*qc6VsM,1./6.);}
14888   if(qc8VsM<=0.){v8VsM = pow((-1./33.)*qc8VsM,1./8.);}  
14889   // Calculate stat. error for reference flow estimates from stat. error of Q-cumulants: 
14890   if(qc2VsM>0.){v2ErrorVsM = (1./2.)*pow(qc2VsM,-0.5)*qc2ErrorVsM;} 
14891   if(qc4VsM<0.){v4ErrorVsM = (1./4.)*pow(-qc4VsM,-3./4.)*qc4ErrorVsM;} 
14892   if(qc6VsM>0.){v6ErrorVsM = (1./6.)*pow(2.,-1./3.)*pow(qc6VsM,-5./6.)*qc6ErrorVsM;}   
14893   if(qc8VsM<0.){v8ErrorVsM = (1./8.)*pow(33.,-1./8.)*pow(-qc8VsM,-7./8.)*qc8ErrorVsM;}                       
14894   // Store the results and statistical errors of integrated flow estimates:
14895   fIntFlowVsM[0]->SetBinContent(b,v2VsM);
14896   fIntFlowVsM[0]->SetBinError(b,v2ErrorVsM);
14897   fIntFlowVsM[1]->SetBinContent(b,v4VsM);
14898   fIntFlowVsM[1]->SetBinError(b,v4ErrorVsM);
14899   fIntFlowVsM[2]->SetBinContent(b,v6VsM);
14900   fIntFlowVsM[2]->SetBinError(b,v6ErrorVsM);
14901   fIntFlowVsM[3]->SetBinContent(b,v8VsM);
14902   fIntFlowVsM[3]->SetBinError(b,v8ErrorVsM);
14903  } // end of for(Int_t b=1;b<=nBins;b++)
14904  
14905  // 'Rebinned in M' calculation: // to be improved - this can be implemented better:   
14906  // Reference flow estimates:
14907  Double_t v2RebinnedInM = 0.; // v{2,QC}  
14908  Double_t v4RebinnedInM = 0.; // v{4,QC}  
14909  Double_t v6RebinnedInM = 0.; // v{6,QC}  
14910  Double_t v8RebinnedInM = 0.; // v{8,QC}
14911  // Reference flow's statistical errors:
14912  Double_t v2ErrorRebinnedInM = 0.; // v{2,QC} stat. error 
14913  Double_t v4ErrorRebinnedInM = 0.; // v{4,QC} stat. error
14914  Double_t v6ErrorRebinnedInM = 0.; // v{6,QC} stat. error
14915  Double_t v8ErrorRebinnedInM = 0.; // v{8,QC} stat. error
14916  // Q-cumulants:
14917  Double_t qc2RebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinContent(1); // QC{2}  
14918  Double_t qc4RebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinContent(2); // QC{4}  
14919  Double_t qc6RebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinContent(3); // QC{6}  
14920  Double_t qc8RebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinContent(4); // QC{8}
14921  // Q-cumulants's statistical errors: 
14922  Double_t qc2ErrorRebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinError(1); // QC{2} stat. error  
14923  Double_t qc4ErrorRebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinError(2); // QC{4} stat. error  
14924  Double_t qc6ErrorRebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinError(3); // QC{6} stat. error  
14925  Double_t qc8ErrorRebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinError(4); // QC{8} stat. error
14926  // Calculate reference flow estimates from Q-cumulants: 
14927  if(qc2RebinnedInM>=0.){v2RebinnedInM = pow(qc2RebinnedInM,0.5);} 
14928  if(qc4RebinnedInM<=0.){v4RebinnedInM = pow(-1.*qc4RebinnedInM,1./4.);} 
14929  if(qc6RebinnedInM>=0.){v6RebinnedInM = pow((1./4.)*qc6RebinnedInM,1./6.);}
14930  if(qc8RebinnedInM<=0.){v8RebinnedInM = pow((-1./33.)*qc8RebinnedInM,1./8.);}  
14931  // Calculate stat. error for reference flow estimates from stat. error of Q-cumulants: 
14932  if(qc2RebinnedInM>0.){v2ErrorRebinnedInM = (1./2.)*pow(qc2RebinnedInM,-0.5)*qc2ErrorRebinnedInM;} 
14933  if(qc4RebinnedInM<0.){v4ErrorRebinnedInM = (1./4.)*pow(-qc4RebinnedInM,-3./4.)*qc4ErrorRebinnedInM;} 
14934  if(qc6RebinnedInM>0.){v6ErrorRebinnedInM = (1./6.)*pow(2.,-1./3.)*pow(qc6RebinnedInM,-5./6.)*qc6ErrorRebinnedInM;}   
14935  if(qc8RebinnedInM<0.){v8ErrorRebinnedInM = (1./8.)*pow(33.,-1./8.)*pow(-qc8RebinnedInM,-7./8.)*qc8ErrorRebinnedInM;}   
14936  // Print warnings for the 'wrong sign' cumulants: 
14937  if(TMath::Abs(v2RebinnedInM) < 1.e-44)
14938  {
14939   cout<<" WARNING: Wrong sign QC{2} rebinned in M, couldn't calculate v{2,QC} !!!!"<<endl;
14940  }
14941  if(TMath::Abs(v4RebinnedInM) < 1.e-44)
14942  {
14943   cout<<" WARNING: Wrong sign QC{4} rebinned in M, couldn't calculate v{4,QC} !!!!"<<endl;
14944  }
14945  if(TMath::Abs(v6RebinnedInM) < 1.e-44)
14946  {
14947   cout<<" WARNING: Wrong sign QC{6} rebinned in M, couldn't calculate v{6,QC} !!!!"<<endl;
14948  }
14949  if(TMath::Abs(v8RebinnedInM) < 1.e-44)
14950  {
14951   cout<<" WARNING: Wrong sign QC{8} rebinned in M, couldn't calculate v{8,QC} !!!!"<<endl;
14952  }                       
14953  // Store the results and statistical errors of integrated flow estimates:
14954  fIntFlowRebinnedInM->SetBinContent(1,v2RebinnedInM);
14955  fIntFlowRebinnedInM->SetBinError(1,v2ErrorRebinnedInM);
14956  fIntFlowRebinnedInM->SetBinContent(2,v4RebinnedInM);
14957  fIntFlowRebinnedInM->SetBinError(2,v4ErrorRebinnedInM);
14958  fIntFlowRebinnedInM->SetBinContent(3,v6RebinnedInM);
14959  fIntFlowRebinnedInM->SetBinError(3,v6ErrorRebinnedInM);
14960  fIntFlowRebinnedInM->SetBinContent(4,v8RebinnedInM);
14961  fIntFlowRebinnedInM->SetBinError(4,v8ErrorRebinnedInM);    
14962   
14963 } // end of AliFlowAnalysisWithQCumulants::CalculateReferenceFlow()
14964
14965 //================================================================================================================================ 
14966
14967 void AliFlowAnalysisWithQCumulants::FillCommonHistResultsIntFlow()
14968 {
14969  // Fill in AliFlowCommonHistResults histograms relevant for reference flow.
14970  
14971  // There are two possibilities here:
14972  // a) Store minimum bias reference flow - use SetMinimumBiasReferenceFlow(kTRUE). This result is 
14973  //    biased by the interplay between nonflow correlations and multiplicity fluctuations and is 
14974  //    also stored in local histogram fIntFlow; 
14975  // b) Store reference flow obtained from flow analysis performed at fixed multiplicity and 
14976  //    rebinned only at the end of the day - use SetMinimumBiasReferenceFlow(kFALSE). This result
14977  //    is also stored in local histogram fIntFlowRebinnedInM.
14978  
14979  // Reference flow estimates:
14980  Double_t v[4] = {0.};
14981  // Statistical errors of reference flow estimates:
14982  Double_t vError[4] = {0.};
14983   
14984  for(Int_t b=0;b<4;b++)
14985  {
14986   if(fMinimumBiasReferenceFlow)
14987   { 
14988    v[b] = fIntFlow->GetBinContent(b+1);
14989    vError[b] = fIntFlow->GetBinError(b+1);
14990   } else
14991     {
14992      v[b] = fIntFlowRebinnedInM->GetBinContent(b+1);
14993      vError[b] = fIntFlowRebinnedInM->GetBinError(b+1);
14994     }
14995  } // end of for(Int_t b=0;b<4;b++)
14996   
14997  // Fill AliFlowCommonHistResults histogram:
14998  fCommonHistsResults2nd->FillIntegratedFlow(v[0],vError[0]); // to be improved (hardwired 2nd in the name)  
14999  fCommonHistsResults4th->FillIntegratedFlow(v[1],vError[1]); // to be improved (hardwired 4th in the name)
15000  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)) // to be improved (calculate also 6th and 8th order)
15001  {
15002   fCommonHistsResults6th->FillIntegratedFlow(v[2],vError[2]); // to be improved (hardwired 6th in the name)
15003   fCommonHistsResults8th->FillIntegratedFlow(v[3],vError[3]); // to be improved (hardwired 8th in the name) 
15004  }
15005  
15006 } // end of AliFlowAnalysisWithQCumulants::FillCommonHistResultsIntFlow()
15007
15008 //================================================================================================================================ 
15009
15010 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelationsUsingParticleWeights()
15011 {
15012  // Calculate all correlations needed for integrated flow using particle weights.
15013   
15014  // Remark 1: When particle weights are used the binning of fIntFlowCorrelationAllPro is organized as follows:
15015  //
15016  //  1st bin: <2>_{1n|1n} = two1n1nW1W1 = <w1 w2 cos(n*(phi1-phi2))>
15017  //  2nd bin: <2>_{2n|2n} = two2n2nW2W2 = <w1^2 w2^2 cos(2n*(phi1-phi2))>
15018  //  3rd bin: <2>_{3n|3n} = two3n3nW3W3 = <w1^3 w2^3 cos(3n*(phi1-phi2))> 
15019  //  4th bin: <2>_{4n|4n} = two4n4nW4W4 = <w1^4 w2^4 cos(4n*(phi1-phi2))>
15020  //  5th bin:           ----  EMPTY ----
15021  //  6th bin: <3>_{2n|1n,1n} = three2n1n1nW2W1W1 = <w1^2 w2 w3 cos(n*(2phi1-phi2-phi3))>
15022  //  7th bin: <3>_{3n|2n,1n} = ...
15023  //  8th bin: <3>_{4n|2n,2n} = ...
15024  //  9th bin: <3>_{4n|3n,1n} = ...
15025  // 10th bin:           ----  EMPTY ----
15026  // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1nW1W1W1W1 = <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))>
15027  // 12th bin: <4>_{2n,1n|2n,1n} = ...
15028  // 13th bin: <4>_{2n,2n|2n,2n} = ...
15029  // 14th bin: <4>_{3n|1n,1n,1n} = ... 
15030  // 15th bin: <4>_{3n,1n|3n,1n} = ...
15031  // 16th bin: <4>_{3n,1n|2n,2n} = ...
15032  // 17th bin: <4>_{4n|2n,1n,1n} = ... 
15033  // 18th bin:           ----  EMPTY ----
15034  // 19th bin: <5>_{2n|1n,1n,1n,1n} = ...
15035  // 20th bin: <5>_{2n,2n|2n,1n,1n} = ...
15036  // 21st bin: <5>_{3n,1n|2n,1n,1n} = ...
15037  // 22nd bin: <5>_{4n|1n,1n,1n,1n} = ...
15038  // 23rd bin:           ----  EMPTY ----
15039  // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = ...
15040  // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = ...
15041  // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = ...
15042  // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = ...
15043  // 28th bin:           ----  EMPTY ----
15044  // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = ...
15045  // 30th bin:           ----  EMPTY ----
15046  // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = ...
15047  
15048  // Remark 2: When particle weights are used there are some extra correlations. They are stored in 
15049  // fIntFlowExtraCorrelationsPro binning of which is organized as follows:
15050  
15051  // 1st bin: two1n1nW3W1 = <w1^3 w2 cos(n*(phi1-phi2))>
15052  // 2nd bin: two1n1nW1W1W2 = <w1 w2 w3^2 cos(n*(phi1-phi2))>  
15053  
15054  // multiplicity (number of particles used to determine the reaction plane)
15055  Double_t dMult = (*fSpk)(0,0);
15056  
15057  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
15058  Double_t dReQ1n1k = (*fReQ)(0,1);
15059  Double_t dReQ2n2k = (*fReQ)(1,2);
15060  Double_t dReQ3n3k = (*fReQ)(2,3);
15061  Double_t dReQ4n4k = (*fReQ)(3,4);
15062  Double_t dReQ1n3k = (*fReQ)(0,3);
15063  Double_t dImQ1n1k = (*fImQ)(0,1);
15064  Double_t dImQ2n2k = (*fImQ)(1,2);
15065  Double_t dImQ3n3k = (*fImQ)(2,3);
15066  Double_t dImQ4n4k = (*fImQ)(3,4);
15067  Double_t dImQ1n3k = (*fImQ)(0,3);
15068
15069  // dMs are variables introduced in order to simplify some Eqs. bellow:
15070  //..............................................................................................
15071  Double_t dM11 = (*fSpk)(1,1)-(*fSpk)(0,2); // dM11 = sum_{i,j=1,i!=j}^M w_i w_j
15072  Double_t dM22 = (*fSpk)(1,2)-(*fSpk)(0,4); // dM22 = sum_{i,j=1,i!=j}^M w_i^2 w_j^2
15073  Double_t dM33 = (*fSpk)(1,3)-(*fSpk)(0,6); // dM33 = sum_{i,j=1,i!=j}^M w_i^3 w_j^3
15074  Double_t dM44 = (*fSpk)(1,4)-(*fSpk)(0,8); // dM44 = sum_{i,j=1,i!=j}^M w_i^4 w_j^4
15075  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
15076  Double_t dM211 = (*fSpk)(0,2)*(*fSpk)(1,1)-2.*(*fSpk)(0,3)*(*fSpk)(0,1)
15077                 - (*fSpk)(1,2)+2.*(*fSpk)(0,4); // dM211 = sum_{i,j,k=1,i!=j!=k}^M w_i^2 w_j w_k
15078  Double_t dM1111 = (*fSpk)(3,1)-6.*(*fSpk)(0,2)*(*fSpk)(1,1)  
15079                  + 8.*(*fSpk)(0,3)*(*fSpk)(0,1)
15080                  + 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
15081  //..............................................................................................
15082
15083  // 2-particle correlations:
15084  Double_t two1n1nW1W1 = 0.; // <w1 w2 cos(n*(phi1-phi2))>
15085  Double_t two2n2nW2W2 = 0.; // <w1^2 w2^2 cos(2n*(phi1-phi2))>
15086  Double_t two3n3nW3W3 = 0.; // <w1^3 w2^3 cos(3n*(phi1-phi2))>
15087  Double_t two4n4nW4W4 = 0.; // <w1^4 w2^4 cos(4n*(phi1-phi2))>
15088  if(dMult>1) 
15089  { 
15090   if(dM11)
15091   {
15092    two1n1nW1W1 = (pow(dReQ1n1k,2)+pow(dImQ1n1k,2)-(*fSpk)(0,2))/dM11;    
15093    // average correlation <w1 w2 cos(n*(phi1-phi2))> for single event: 
15094    fIntFlowCorrelationsEBE->SetBinContent(1,two1n1nW1W1);
15095    fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(1,dM11);
15096    // average correlation <w1 w2 cos(n*(phi1-phi2))> for all events:
15097    fIntFlowCorrelationsPro->Fill(0.5,two1n1nW1W1,dM11);  
15098    // average squared correlation <w1 w2 cos(n*(phi1-phi2))> for all events:
15099    fIntFlowSquaredCorrelationsPro->Fill(0.5,two1n1nW1W1*two1n1nW1W1,dM11); 
15100    fIntFlowCorrelationsAllPro->Fill(0.5,two1n1nW1W1,dM11);   
15101   }
15102   if(dM22)
15103   {
15104    two2n2nW2W2 = (pow(dReQ2n2k,2)+pow(dImQ2n2k,2)-(*fSpk)(0,4))/dM22; 
15105    // ...
15106    // average correlation <w1^2 w2^2 cos(2n*(phi1-phi2))> for all events:
15107    fIntFlowCorrelationsAllPro->Fill(1.5,two2n2nW2W2,dM22);   
15108   }
15109   if(dM33)
15110   {
15111    two3n3nW3W3 = (pow(dReQ3n3k,2)+pow(dImQ3n3k,2)-(*fSpk)(0,6))/dM33;
15112    // ...
15113    // average correlation <w1^3 w2^3 cos(3n*(phi1-phi2))> for all events:
15114    fIntFlowCorrelationsAllPro->Fill(2.5,two3n3nW3W3,dM33);   
15115   }
15116   if(dM44)
15117   {
15118    two4n4nW4W4 = (pow(dReQ4n4k,2)+pow(dImQ4n4k,2)-(*fSpk)(0,8))/dM44; 
15119    // ...
15120    // average correlation <w1^4 w2^4 cos(4n*(phi1-phi2))> for all events:
15121    fIntFlowCorrelationsAllPro->Fill(3.5,two4n4nW4W4,dM44);      
15122   }
15123  } // end of if(dMult>1) 
15124
15125  // extra 2-particle correlations:
15126  Double_t two1n1nW3W1 = 0.; // <w1^3 w2 cos(n*(phi1-phi2))>
15127  Double_t two1n1nW1W1W2 = 0.; // <w1 w2 w3^2 cos(n*(phi1-phi2))> 
15128  if(dMult>1) 
15129  {    
15130   if(dM31)
15131   {
15132    two1n1nW3W1 = (dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k-(*fSpk)(0,4))/dM31; 
15133    fIntFlowExtraCorrelationsPro->Fill(0.5,two1n1nW3W1,dM31);  
15134   } 
15135   if(dM211)
15136   {
15137    two1n1nW1W1W2 = ((*fSpk)(0,2)*(pow(dReQ1n1k,2)+pow(dImQ1n1k,2)-(*fSpk)(0,2))
15138                  - 2.*(dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k
15139                  - (*fSpk)(0,4)))/dM211;
15140    fIntFlowExtraCorrelationsPro->Fill(1.5,two1n1nW1W1W2,dM211);  
15141   }  
15142  } // end of if(dMult>1)
15143  //..............................................................................................
15144  
15145  //..............................................................................................
15146  // 3-particle correlations:
15147  Double_t three2n1n1nW2W1W1 = 0.; // <w1^2 w2 w3 cos(n*(2phi1-phi2-phi3))>
15148  
15149  if(dMult>2) 
15150  { 
15151   if(dM211)
15152   {                                                       
15153    three2n1n1nW2W1W1 = (pow(dReQ1n1k,2.)*dReQ2n2k+2.*dReQ1n1k*dImQ1n1k*dImQ2n2k-pow(dImQ1n1k,2.)*dReQ2n2k
15154                      - 2.*(dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k)
15155                      - pow(dReQ2n2k,2)-pow(dImQ2n2k,2)
15156                      + 2.*(*fSpk)(0,4))/dM211;                                                                               
15157    fIntFlowCorrelationsAllPro->Fill(5.5,three2n1n1nW2W1W1,dM211);
15158   } 
15159  } // end of if(dMult>2) 
15160  //..............................................................................................
15161  
15162  //..............................................................................................
15163  // 4-particle correlations:
15164  Double_t four1n1n1n1nW1W1W1W1 = 0.; // <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))>
15165  if(dMult>3) 
15166  { 
15167   if(dM1111)
15168   {      
15169    four1n1n1n1nW1W1W1W1 = (pow(pow(dReQ1n1k,2.)+pow(dImQ1n1k,2.),2)
15170                         - 2.*(pow(dReQ1n1k,2.)*dReQ2n2k+2.*dReQ1n1k*dImQ1n1k*dImQ2n2k-pow(dImQ1n1k,2.)*dReQ2n2k)
15171                         + 8.*(dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k)
15172                         + (pow(dReQ2n2k,2)+pow(dImQ2n2k,2))
15173                         - 4.*(*fSpk)(0,2)*(pow(dReQ1n1k,2)+pow(dImQ1n1k,2))
15174                         - 6.*(*fSpk)(0,4)+2.*(*fSpk)(1,2))/dM1111;  
15175                           
15176    // average correlation <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))> for single event: 
15177    fIntFlowCorrelationsEBE->SetBinContent(2,four1n1n1n1nW1W1W1W1);
15178    fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(2,dM1111);
15179    // average correlation <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))> for all events:
15180    fIntFlowCorrelationsPro->Fill(1.5,four1n1n1n1nW1W1W1W1,dM1111);   
15181    // average squared correlation <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))> for all events:
15182    fIntFlowSquaredCorrelationsPro->Fill(1.5,four1n1n1n1nW1W1W1W1*four1n1n1n1nW1W1W1W1,dM1111);      
15183    fIntFlowCorrelationsAllPro->Fill(10.5,four1n1n1n1nW1W1W1W1,dM1111);   
15184   } 
15185  } // end of if(dMult>3) 
15186  //..............................................................................................
15187  
15188 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelationsUsingParticleWeights()
15189
15190 //=======================================================================================================================
15191
15192 void AliFlowAnalysisWithQCumulants::InitializeArraysForIntFlow()
15193 {
15194  // Initialize all arrays used to calculate integrated flow.
15195  
15196  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
15197  {
15198   fIntFlowCorrectionTermsForNUAEBE[sc] = NULL;
15199   fIntFlowEventWeightForCorrectionTermsForNUAEBE[sc] = NULL;
15200   fIntFlowCorrectionTermsForNUAPro[sc] = NULL;
15201   fIntFlowCorrectionTermsForNUAHist[sc] = NULL;
15202   for(Int_t ci=0;ci<4;ci++) // correction term index (to be improved - hardwired 4)
15203   {
15204    fIntFlowCorrectionTermsForNUAVsMPro[sc][ci] = NULL;
15205   }
15206   for(Int_t power=0;power<2;power++) // linear or quadratic 
15207   {
15208    fIntFlowSumOfEventWeightsNUA[sc][power] = NULL;
15209   }
15210  }
15211  for(Int_t power=0;power<2;power++) // linear or quadratic 
15212  {
15213   fIntFlowSumOfEventWeights[power] = NULL;    
15214  }
15215  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))
15216  {
15217   fPrintFinalResults[i] = kTRUE;
15218  }
15219  for(Int_t ci=0;ci<4;ci++) // correlation index or cumulant order
15220  {
15221   fIntFlowCorrelationsVsMPro[ci] = NULL;
15222   fIntFlowSquaredCorrelationsVsMPro[ci] = NULL;
15223   fIntFlowCorrelationsVsMHist[ci] = NULL;
15224   fIntFlowQcumulantsVsM[ci] = NULL;
15225   fIntFlowVsM[ci] = NULL;
15226   fIntFlowDetectorBiasVsM[ci] = NULL;
15227   for(Int_t lc=0;lc<2;lc++)
15228   {
15229    fIntFlowSumOfEventWeightsVsM[ci][lc] = NULL;
15230   }
15231  } 
15232  for(Int_t pi=0;pi<6;pi++) // product or covariance index
15233  {
15234   fIntFlowProductOfCorrelationsVsMPro[pi] = NULL;
15235   fIntFlowCovariancesVsM[pi] = NULL;
15236   fIntFlowSumOfProductOfEventWeightsVsM[pi] = NULL;
15237  } 
15238  for(Int_t ci=0;ci<64;ci++) // correlation index for all correlations vs M profiles (to be improved - hardwired 64)
15239  {
15240   fIntFlowCorrelationsAllVsMPro[ci] = NULL;
15241  } 
15242
15243 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForIntFlow()
15244
15245 //=======================================================================================================================
15246
15247 void AliFlowAnalysisWithQCumulants::InitializeArraysForDiffFlow()
15248 {
15249  // Initialize all arrays needed to calculate differential flow.
15250  //  a) Initialize lists holding profiles;
15251  //  b) Initialize lists holding histograms;
15252  //  c) Initialize event-by-event quantities;
15253  //  d) Initialize profiles;
15254  //  e) Initialize histograms holding final results.
15255  
15256  // a) Initialize lists holding profiles;
15257  for(Int_t t=0;t<2;t++) // type (RP, POI)
15258  {
15259   for(Int_t pe=0;pe<2;pe++) // pt or eta
15260   {
15261    fDiffFlowCorrelationsProList[t][pe] = NULL;
15262    fDiffFlowProductOfCorrelationsProList[t][pe] = NULL;
15263    fDiffFlowCorrectionsProList[t][pe] = NULL;
15264   }
15265   // 2D:
15266   f2DDiffFlowCorrelationsProList[t] = NULL;
15267  }  
15268  
15269  // b) Initialize lists holding histograms;
15270  for(Int_t t=0;t<2;t++) // type (RP, POI)
15271  {
15272   for(Int_t pe=0;pe<2;pe++) // pt or eta
15273   {
15274    fDiffFlowCorrelationsHistList[t][pe] = NULL;
15275    for(Int_t power=0;power<2;power++)
15276    {
15277     fDiffFlowSumOfEventWeightsHistList[t][pe][power] = NULL;
15278    } // end of for(Int_t power=0;power<2;power++)  
15279    fDiffFlowSumOfProductOfEventWeightsHistList[t][pe] = NULL;
15280    fDiffFlowCorrectionsHistList[t][pe] = NULL;
15281    fDiffFlowCovariancesHistList[t][pe] = NULL;
15282    fDiffFlowCumulantsHistList[t][pe] = NULL;
15283    fDiffFlowDetectorBiasHistList[t][pe] = NULL;
15284    fDiffFlowHistList[t][pe] = NULL;
15285   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
15286  } // enf of for(Int_t t=0;t<2;t++) // type (RP, POI) 
15287  
15288  // c) Initialize event-by-event quantities:
15289  // 1D:
15290  for(Int_t t=0;t<3;t++) // type (RP, POI, POI&&RP)
15291  {
15292   for(Int_t pe=0;pe<2;pe++) // pt or eta
15293   { 
15294    for(Int_t m=0;m<4;m++) // multiple of harmonic
15295    {
15296     for(Int_t k=0;k<9;k++) // power of weight
15297     {
15298      fReRPQ1dEBE[t][pe][m][k] = NULL;
15299      fImRPQ1dEBE[t][pe][m][k] = NULL;
15300      fs1dEBE[t][pe][k] = NULL; // to be improved (this doesn't need to be within loop over m)
15301     }   
15302    }
15303   }
15304  }
15305  // 1D:
15306  for(Int_t t=0;t<2;t++) // type (RP or POI)
15307  {
15308   for(Int_t pe=0;pe<2;pe++) // pt or eta
15309   { 
15310    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
15311    {
15312     for(Int_t cti=0;cti<9;cti++) // correction term index
15313     {
15314      fDiffFlowCorrectionTermsForNUAEBE[t][pe][sc][cti] = NULL;
15315     }   
15316    }
15317   }
15318  }
15319  // 2D:  
15320  for(Int_t t=0;t<3;t++) // type (RP, POI, POI&&RP)
15321  {
15322   for(Int_t m=0;m<4;m++) // multiple of harmonic
15323   {
15324    for(Int_t k=0;k<9;k++) // power of weight
15325    {
15326     fReRPQ2dEBE[t][m][k] = NULL;
15327     fImRPQ2dEBE[t][m][k] = NULL;
15328     fs2dEBE[t][k] = NULL; // to be improved (this doesn't need to be within loop over m)
15329    }   
15330   }
15331  }
15332  
15333  // d) Initialize profiles:
15334  for(Int_t t=0;t<2;t++) // type: RP or POI
15335  { 
15336   for(Int_t pe=0;pe<2;pe++) // pt or eta
15337   {
15338    for(Int_t ci=0;ci<4;ci++) // correlation index
15339    {
15340     fDiffFlowCorrelationsPro[t][pe][ci] = NULL;
15341     fDiffFlowSquaredCorrelationsPro[t][pe][ci] = NULL;
15342    } // end of for(Int_t ci=0;ci<4;ci++)   
15343    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
15344    {
15345     for(Int_t mci2=0;mci2<8;mci2++) // mixed correlation index
15346     {
15347      fDiffFlowProductOfCorrelationsPro[t][pe][mci1][mci2] = NULL;
15348     } // end of for(Int_t mci2=0;mci2<8;mci2++) // mixed correlation index
15349    } // end of for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index  
15350    // correction terms for nua:
15351    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
15352    {
15353     for(Int_t cti=0;cti<9;cti++) // correction term index
15354     {
15355      fDiffFlowCorrectionTermsForNUAPro[t][pe][sc][cti] = NULL;
15356     }   
15357    }
15358    // other differential correlators:
15359    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
15360    {
15361     for(Int_t ci=0;ci<1;ci++) // correction term index
15362     {
15363      fOtherDiffCorrelators[t][pe][sc][ci] = NULL;
15364     }   
15365    }
15366   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
15367   for(Int_t ci=0;ci<4;ci++) // correlation index
15368   {
15369    f2DDiffFlowCorrelationsPro[t][ci] = NULL;
15370   }
15371  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
15372   
15373  // e) Initialize histograms holding final results.
15374  for(Int_t t=0;t<2;t++) // type: RP or POI
15375  { 
15376   for(Int_t pe=0;pe<2;pe++) // pt or eta
15377   {
15378    for(Int_t ci=0;ci<4;ci++) // correlation index
15379    {
15380     fDiffFlowCorrelationsHist[t][pe][ci] = NULL;
15381     fDiffFlowCumulants[t][pe][ci] = NULL;
15382     fDiffFlowDetectorBias[t][pe][ci] = NULL;
15383     fDiffFlow[t][pe][ci] = NULL;
15384    } // end of for(Int_t ci=0;ci<4;ci++)    
15385    for(Int_t covarianceIndex=0;covarianceIndex<5;covarianceIndex++) 
15386    {
15387     fDiffFlowCovariances[t][pe][covarianceIndex] = NULL;     
15388    } // end of for(Int_t covarianceIndex=0;covarianceIndex<5;covarianceIndex++) 
15389    // correction terms for nua:
15390    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
15391    {
15392     for(Int_t cti=0;cti<9;cti++) // correction term index
15393     {
15394      fDiffFlowCorrectionTermsForNUAHist[t][pe][sc][cti] = NULL;
15395     }   
15396    }
15397   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
15398   for(Int_t ci=0;ci<4;ci++) // correlation index
15399   {
15400    f2DDiffFlowCumulants[t][ci] = NULL;
15401    f2DDiffFlow[t][ci] = NULL;
15402   }
15403  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
15404  
15405  // sum of event weights for reduced correlations:
15406  for(Int_t t=0;t<2;t++) // type = RP or POI
15407  {
15408   for(Int_t pe=0;pe<2;pe++) // pt or eta
15409   {
15410    for(Int_t p=0;p<2;p++) // power of weight is 1 or 2
15411    {
15412     for(Int_t ew=0;ew<4;ew++) // event weight index for reduced correlations
15413     {
15414      fDiffFlowSumOfEventWeights[t][pe][p][ew] = NULL;
15415     } 
15416    }   
15417   }
15418  }
15419  // product of event weights for both types of correlations:
15420  for(Int_t t=0;t<2;t++) // type = RP or POI
15421  {
15422   for(Int_t pe=0;pe<2;pe++) // pt or eta
15423   {
15424    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
15425    {
15426     for(Int_t mci2=0;mci2<8;mci2++) // mixed correlation index
15427     {
15428      fDiffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2] = NULL;
15429     } 
15430    }   
15431   }
15432  }
15433     
15434 } // end of AliFlowAnalysisWithQCumulants::InitializeArraysForDiffFlow()
15435
15436 //=======================================================================================================================
15437
15438 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCumulants(TString type, TString ptOrEta)
15439 {
15440  // Calculate differential flow cumulants from measured multiparticle correlations.
15441  
15442  // REMARK: Cumulants calculated in this method are NOT corrected for non-uniform acceptance. 
15443  // This correction, if enabled via setter SetApplyCorrectionForNUA(Bool_t), is applied 
15444  // in the method CalculateDiffFlowCumulantsCorrectedForNUA(TString type, TString ptOrEta)
15445  
15446  Int_t t = 0;
15447  Int_t pe = 0;
15448
15449  if(type == "RP")
15450  {
15451   t = 0;
15452  } else if(type == "POI")
15453    {
15454     t = 1;
15455    } 
15456      
15457  if(ptOrEta == "Pt")
15458  {
15459   pe = 0;
15460  } else if(ptOrEta == "Eta")
15461    {
15462     pe = 1;
15463    } 
15464      
15465  // Common:
15466  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
15467  
15468  // Correlation <<2>>: 
15469  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1);
15470  Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1);
15471  
15472  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
15473  {
15474   // Reduced correlations:   
15475   Double_t twoPrime = fDiffFlowCorrelationsHist[t][pe][0]->GetBinContent(b); // <<2'>>
15476   Double_t twoPrimeError = fDiffFlowCorrelationsHist[t][pe][0]->GetBinError(b); // stat. error of <<2'>>
15477   Double_t fourPrime = fDiffFlowCorrelationsHist[t][pe][1]->GetBinContent(b); // <<4'>>
15478   Double_t fourPrimeError = fDiffFlowCorrelationsHist[t][pe][1]->GetBinError(b); // stat. error of <<4'>>
15479   // Covariances:
15480   Double_t wCovTwoTwoReduced = fDiffFlowCovariances[t][pe][0]->GetBinContent(b); // Cov(<2>,<2'>) * prefactor(<2>,<2'>)
15481   Double_t wCovTwoFourReduced = fDiffFlowCovariances[t][pe][1]->GetBinContent(b); // Cov(<2>,<4'>) * prefactor(<2>,<4'>)
15482   Double_t wCovTwoReducedFourReduced = fDiffFlowCovariances[t][pe][4]->GetBinContent(b); // Cov(<2'>,<4'>) * prefactor(<2'>,<4'>)
15483   // QC{2'}:
15484   Double_t qc2Prime = twoPrime; // QC{2'}
15485   Double_t qc2PrimeError = twoPrimeError; // stat. error of QC{2'}
15486   fDiffFlowCumulants[t][pe][0]->SetBinContent(b,qc2Prime); 
15487   fDiffFlowCumulants[t][pe][0]->SetBinError(b,qc2PrimeError); 
15488   // QC{4'}:
15489   Double_t qc4Prime = fourPrime - 2.*twoPrime*two; // QC{4'} = <<4'>> - 2*<<2'>><<2>>
15490   Double_t qc4PrimeError = 0.; // stat. error of QC{4'}
15491   Double_t qc4PrimeErrorSquared = 4.*pow(twoPrime,2.)*pow(twoError,2.)
15492                                 + 4.*pow(two,2.)*pow(twoPrimeError,2.)
15493                                 + pow(fourPrimeError,2.)
15494                                 + 8.*two*twoPrime*wCovTwoTwoReduced
15495                                 - 4.*twoPrime*wCovTwoFourReduced
15496                                 - 4.*two*wCovTwoReducedFourReduced;
15497   if(qc4PrimeErrorSquared>0.)
15498   {
15499    qc4PrimeError = pow(qc4PrimeErrorSquared,0.5);
15500   } 
15501   fDiffFlowCumulants[t][pe][1]->SetBinContent(b,qc4Prime); 
15502   fDiffFlowCumulants[t][pe][1]->SetBinError(b,qc4PrimeError); 
15503  } // end of for(Int_t p=1;p<=fnBinsPt;p++)
15504     
15505 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCumulants(TString type, Bool_t useParticleWeights, TString eventWeights); 
15506
15507 //=======================================================================================================================
15508
15509 void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlowCumulants(TString type)
15510 {
15511  // Calculate 2D differential cumulants.
15512  
15513  // Remark: correction for detector effects and error propagation not implemented yet for 2D differential cumulants.
15514  
15515  Int_t t = 0;
15516
15517  if(type == "RP")
15518  {
15519   t = 0;
15520  } else if(type == "POI")
15521    {
15522     t = 1;
15523    }
15524        
15525  // Reference correlation <<2>>: 
15526  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1);
15527  
15528  // Looping over all (pt,eta) bins and calculating differential flow cumulants: 
15529  for(Int_t p=1;p<=fnBinsPt;p++)
15530  {
15531   for(Int_t e=1;e<=fnBinsEta;e++)
15532   {
15533    // Reduced correlations:   
15534    Double_t twoPrime = f2DDiffFlowCorrelationsPro[t][0]->GetBinContent(f2DDiffFlowCorrelationsPro[t][0]->GetBin(p,e)); // <<2'>>(pt,eta)
15535    Double_t fourPrime = f2DDiffFlowCorrelationsPro[t][1]->GetBinContent(f2DDiffFlowCorrelationsPro[t][1]->GetBin(p,e)); // <<4'>>(pt,eta)
15536    // Cumulants:
15537    Double_t qc2Prime = twoPrime; // QC{2'} = <<2'>>   
15538    f2DDiffFlowCumulants[t][0]->SetBinContent(f2DDiffFlowCumulants[t][0]->GetBin(p,e),qc2Prime); 
15539    Double_t qc4Prime = fourPrime - 2.*twoPrime*two; // QC{4'} = <<4'>> - 2*<<2'>><<2>>
15540    f2DDiffFlowCumulants[t][1]->SetBinContent(f2DDiffFlowCumulants[t][1]->GetBin(p,e),qc4Prime); 
15541   } // end of for(Int_t e=1;e<=fnBinsEta;e++)
15542  } // end of for(Int_t p=1;p<=fnBinsPt;p++)
15543  
15544 } // end of void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlowCumulants(TString type)
15545
15546 //=======================================================================================================================
15547
15548 void AliFlowAnalysisWithQCumulants::CalculateFinalResultsForRPandPOIIntegratedFlow(TString type)
15549 {
15550  // Calculate final results for integrated flow of RPs and POIs. 
15551   
15552  // to be improved - check if the integrated flow calculation here is actually correct 
15553   
15554  Int_t t = 0; // RP = 0, POI = 1
15555
15556  if(type == "RP")
15557  {
15558   t = 0;
15559  } else if(type == "POI")
15560    {
15561     t = 1;
15562    }
15563      
15564  // pt yield:    
15565  TH1F *yield2ndPt = NULL;
15566  TH1F *yield4thPt = NULL;
15567  TH1F *yield6thPt = NULL;
15568  TH1F *yield8thPt = NULL;
15569  
15570  if(type == "POI")
15571  {
15572   if(fFillMultipleControlHistograms)
15573   {
15574    yield2ndPt = (TH1F*)(fCommonHists2nd->GetHistPtPOI())->Clone();
15575    yield4thPt = (TH1F*)(fCommonHists4th->GetHistPtPOI())->Clone();
15576    yield6thPt = (TH1F*)(fCommonHists6th->GetHistPtPOI())->Clone();
15577    yield8thPt = (TH1F*)(fCommonHists8th->GetHistPtPOI())->Clone();  
15578   } else
15579     {
15580      yield2ndPt = (TH1F*)(fCommonHists->GetHistPtPOI())->Clone();
15581      yield4thPt = (TH1F*)(fCommonHists->GetHistPtPOI())->Clone();
15582      yield6thPt = (TH1F*)(fCommonHists->GetHistPtPOI())->Clone();
15583      yield8thPt = (TH1F*)(fCommonHists->GetHistPtPOI())->Clone();     
15584     }
15585  } 
15586  else if(type == "RP")
15587  {
15588   if(fFillMultipleControlHistograms)
15589   {
15590    yield2ndPt = (TH1F*)(fCommonHists2nd->GetHistPtRP())->Clone();
15591    yield4thPt = (TH1F*)(fCommonHists4th->GetHistPtRP())->Clone();
15592    yield6thPt = (TH1F*)(fCommonHists6th->GetHistPtRP())->Clone();
15593    yield8thPt = (TH1F*)(fCommonHists8th->GetHistPtRP())->Clone();  
15594   } else
15595     {
15596      yield2ndPt = (TH1F*)(fCommonHists->GetHistPtRP())->Clone();
15597      yield4thPt = (TH1F*)(fCommonHists->GetHistPtRP())->Clone();
15598      yield6thPt = (TH1F*)(fCommonHists->GetHistPtRP())->Clone();
15599      yield8thPt = (TH1F*)(fCommonHists->GetHistPtRP())->Clone();    
15600     } 
15601  } 
15602  
15603  if(!yield2ndPt){return;}
15604  if(!yield4thPt){return;}
15605  if(!yield6thPt){return;}
15606  if(!yield8thPt){return;} 
15607
15608  Int_t nBinsPt = yield2ndPt->GetNbinsX();
15609  
15610  TH1D *flow2ndPt = NULL;
15611  TH1D *flow4thPt = NULL;
15612  TH1D *flow6thPt = NULL;
15613  TH1D *flow8thPt = NULL;
15614  
15615  // to be improved (hardwired pt index)
15616  flow2ndPt = (TH1D*)fDiffFlow[t][0][0]->Clone();
15617  flow4thPt = (TH1D*)fDiffFlow[t][0][1]->Clone();
15618  flow6thPt = (TH1D*)fDiffFlow[t][0][2]->Clone();
15619  flow8thPt = (TH1D*)fDiffFlow[t][0][3]->Clone(); 
15620
15621  if(!flow2ndPt){return;}
15622  if(!flow4thPt){return;}
15623  if(!flow6thPt){return;}
15624  if(!flow8thPt){return;} 
15625    
15626  Double_t dvn2nd = 0., dvn4th = 0., dvn6th = 0., dvn8th = 0.; // differential flow
15627  Double_t dErrvn2nd = 0., dErrvn4th = 0., dErrvn6th = 0., dErrvn8th = 0.; // error on differential flow
15628  
15629  Double_t dVn2nd = 0., dVn4th = 0., dVn6th = 0., dVn8th = 0.; // integrated flow 
15630  Double_t dErrVn2nd = 0., dErrVn4th = 0., dErrVn6th = 0., dErrVn8th = 0.; // error on integrated flow
15631
15632  Double_t dYield2nd = 0., dYield4th = 0., dYield6th = 0., dYield8th = 0.; // pt yield 
15633  Double_t dSum2nd = 0., dSum4th = 0., dSum6th = 0., dSum8th = 0.; // needed for normalizing integrated flow
15634  
15635  // looping over pt bins:
15636  for(Int_t p=1;p<nBinsPt+1;p++)
15637  {
15638   dvn2nd = flow2ndPt->GetBinContent(p);
15639   dvn4th = flow4thPt->GetBinContent(p);
15640   dvn6th = flow6thPt->GetBinContent(p);
15641   dvn8th = flow8thPt->GetBinContent(p);
15642   
15643   dErrvn2nd = flow2ndPt->GetBinError(p);
15644   dErrvn4th = flow4thPt->GetBinError(p);
15645   dErrvn6th = flow6thPt->GetBinError(p);
15646   dErrvn8th = flow8thPt->GetBinError(p);
15647
15648   dYield2nd = yield2ndPt->GetBinContent(p);  
15649   dYield4th = yield4thPt->GetBinContent(p);
15650   dYield6th = yield6thPt->GetBinContent(p);
15651   dYield8th = yield8thPt->GetBinContent(p);
15652   
15653   dVn2nd += dvn2nd*dYield2nd;
15654   dVn4th += dvn4th*dYield4th;
15655   dVn6th += dvn6th*dYield6th;
15656   dVn8th += dvn8th*dYield8th;
15657   
15658   dSum2nd += dYield2nd;
15659   dSum4th += dYield4th;
15660   dSum6th += dYield6th;
15661   dSum8th += dYield8th;
15662   
15663   dErrVn2nd += dYield2nd*dYield2nd*dErrvn2nd*dErrvn2nd; // ro be improved (check this relation)
15664   dErrVn4th += dYield4th*dYield4th*dErrvn4th*dErrvn4th;
15665   dErrVn6th += dYield6th*dYield6th*dErrvn6th*dErrvn6th;
15666   dErrVn8th += dYield8th*dYield8th*dErrvn8th*dErrvn8th;
15667     
15668  } // end of for(Int_t p=1;p<nBinsPt+1;p++)
15669
15670  // normalizing the results for integrated flow:
15671  if(dSum2nd) 
15672  {
15673   dVn2nd /= dSum2nd;
15674   dErrVn2nd /= (dSum2nd*dSum2nd);
15675   dErrVn2nd = TMath::Sqrt(dErrVn2nd);
15676  } 
15677  if(dSum4th) 
15678  {
15679   dVn4th /= dSum4th;
15680   dErrVn4th /= (dSum4th*dSum4th);
15681   dErrVn4th = TMath::Sqrt(dErrVn4th);
15682  } 
15683  //if(dSum6th) dVn6th/=dSum6th;
15684  //if(dSum8th) dVn8th/=dSum8th;
15685   
15686  // storing the results for integrated flow in common histos: (to be improved: new method for this?)
15687  if(type == "POI")
15688  {
15689   fCommonHistsResults2nd->FillIntegratedFlowPOI(dVn2nd,dErrVn2nd); 
15690   fCommonHistsResults4th->FillIntegratedFlowPOI(dVn4th,dErrVn4th); 
15691   fCommonHistsResults6th->FillIntegratedFlowPOI(dVn6th,0.); // to be improved (errors)
15692   fCommonHistsResults8th->FillIntegratedFlowPOI(dVn8th,0.); // to be improved (errors)
15693  }
15694  else if (type == "RP")
15695  {
15696   fCommonHistsResults2nd->FillIntegratedFlowRP(dVn2nd,dErrVn2nd); 
15697   fCommonHistsResults4th->FillIntegratedFlowRP(dVn4th,dErrVn4th);
15698   fCommonHistsResults6th->FillIntegratedFlowRP(dVn6th,0.); // to be improved (errors)
15699   fCommonHistsResults8th->FillIntegratedFlowRP(dVn8th,0.); // to be improved (errors)
15700  }
15701  
15702  delete flow2ndPt;
15703  delete flow4thPt;
15704  //delete flow6thPt;
15705  //delete flow8thPt;
15706  
15707  delete yield2ndPt;
15708  delete yield4thPt;
15709  delete yield6thPt;
15710  delete yield8thPt;
15711            
15712 } // end of AliFlowAnalysisWithQCumulants::CalculateFinalResultsForRPandPOIIntegratedFlow(TString type)
15713
15714 //=======================================================================================================================
15715
15716 void AliFlowAnalysisWithQCumulants::InitializeArraysForDistributions()
15717 {
15718  // Initialize all arrays used for distributions.
15719  
15720  // a) Initialize arrays of histograms used to hold distributions of correlations; 
15721  // b) Initialize array to hold min and max values of correlations;
15722  // c) Initialize default min and max values of correlation products;
15723  // d) Initialize default min and max values of q-vector terms.
15724  
15725  // a) Initialize arrays of histograms used to hold distributions of correlations:
15726  for(Int_t di=0;di<4;di++) // distribution index
15727  {
15728   fDistributions[di] = NULL;
15729  }
15730  
15731  // b) Initialize default min and max values of correlations:
15732  //    (Remark: The default values bellow were chosen for v2=5% and M=500)
15733  fMinValueOfCorrelation[0] = -0.01; // <2>_min 
15734  fMaxValueOfCorrelation[0] = 0.04; // <2>_max 
15735  fMinValueOfCorrelation[1] = -0.00002; // <4>_min 
15736  fMaxValueOfCorrelation[1] = 0.00015; // <4>_max  
15737  fMinValueOfCorrelation[2] = -0.0000003; // <6>_min 
15738  fMaxValueOfCorrelation[2] = 0.0000006; // <6>_max  
15739  fMinValueOfCorrelation[3] = -0.000000006; // <8>_min 
15740  fMaxValueOfCorrelation[3] = 0.000000003; // <8>_max 
15741
15742  // c) Initialize default min and max values of correlation products:
15743  //    (Remark: The default values bellow were chosen for v2=5% and M=500)
15744  fMinValueOfCorrelationProduct[0] = -0.01; // <2><4>_min 
15745  fMaxValueOfCorrelationProduct[0] = 0.04; // <2><4>_max 
15746
15747  // d) Initialize default min and max values of q-vector terms:
15748  fMinValueOfQvectorTerms[0] = 0.;
15749  fMaxValueOfQvectorTerms[0] = 30.;
15750  fMinValueOfQvectorTerms[1] = 0.;
15751  fMaxValueOfQvectorTerms[1] = 20.;
15752  fMinValueOfQvectorTerms[2] = 0.;
15753  fMaxValueOfQvectorTerms[2] = 200.;
15754  fMinValueOfQvectorTerms[3] = -30.;
15755  fMaxValueOfQvectorTerms[3] = 80.;
15756
15757 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForDistributions()
15758
15759 //=======================================================================================================================
15760
15761 void AliFlowAnalysisWithQCumulants::InitializeArraysForVarious()
15762 {
15763  // Initialize all arrays used for various unclassified objects.
15764  
15765  for(Int_t p=0;p<4;p++) // [v_min,v_max,refMult_min,refMult_max]
15766  {
15767   fPhiDistributionForOneEventSettings[p] = 0.;
15768  } 
15769    
15770 } //  end of void AliFlowAnalysisWithQCumulants::InitializeArraysForVarious()
15771
15772 //=======================================================================================================================
15773
15774 void AliFlowAnalysisWithQCumulants::BookEverythingForDistributions()
15775 {
15776  // a) Book profile to hold all flags for distributions of correlations;
15777  // b) Book all histograms to hold distributions of correlations.
15778  
15779  TString correlationIndex[4] = {"#LT2#GT","#LT4#GT","#LT6#GT","#LT8#GT"}; // TBI (should I promote this to data members?)
15780   
15781  // a) Book profile to hold all flags for distributions of correlations:
15782  TString distributionsFlagsName = "fDistributionsFlags";
15783  distributionsFlagsName += fAnalysisLabel->Data();
15784  fDistributionsFlags = new TProfile(distributionsFlagsName.Data(),"Flags for Distributions of Correlations",10,0,10);
15785  fDistributionsFlags->SetTickLength(-0.01,"Y");
15786  fDistributionsFlags->SetMarkerStyle(25);
15787  fDistributionsFlags->SetLabelSize(0.05);
15788  fDistributionsFlags->SetLabelOffset(0.02,"Y");
15789  fDistributionsFlags->SetStats(kFALSE);
15790  fDistributionsFlags->GetXaxis()->SetBinLabel(1,"Store or not?");
15791  fDistributionsFlags->GetXaxis()->SetBinLabel(2,"#LT2#GT_{min}");
15792  fDistributionsFlags->GetXaxis()->SetBinLabel(3,"#LT2#GT_{max}");
15793  fDistributionsFlags->GetXaxis()->SetBinLabel(4,"#LT4#GT_{min}");
15794  fDistributionsFlags->GetXaxis()->SetBinLabel(5,"#LT4#GT_{max}");
15795  fDistributionsFlags->GetXaxis()->SetBinLabel(6,"#LT6#GT_{min}");
15796  fDistributionsFlags->GetXaxis()->SetBinLabel(7,"#LT6#GT_{max}");
15797  fDistributionsFlags->GetXaxis()->SetBinLabel(8,"#LT8#GT_{min}");
15798  fDistributionsFlags->GetXaxis()->SetBinLabel(9,"#LT8#GT_{max}");
15799  fDistributionsFlags->GetXaxis()->SetBinLabel(10,"fnBinsForCorrelations");
15800  fDistributionsList->Add(fDistributionsFlags);
15801  
15802  // b) Book all histograms to hold distributions of correlations.
15803  if(fStoreDistributions)
15804  { 
15805   TString distributionsName = "fDistributions";
15806   distributionsName += fAnalysisLabel->Data();
15807   for(Int_t di=0;di<4;di++) // distribution index
15808   {
15809    fDistributions[di] = new TH1D(Form("Distribution of %s",correlationIndex[di].Data()),Form("Distribution of %s",correlationIndex[di].Data()),fnBinsForCorrelations,fMinValueOfCorrelation[di],fMaxValueOfCorrelation[di]); 
15810    fDistributions[di]->SetXTitle(correlationIndex[di].Data());
15811    fDistributionsList->Add(fDistributions[di]);
15812   } // end of for(Int_t di=0;di<4;di++) // distribution index
15813  } // end of if(fStoreDistributions)
15814  
15815 } // end of void AliFlowAnalysisWithQCumulants::BookEverythingForDistributions()
15816
15817 //=======================================================================================================================
15818
15819 void AliFlowAnalysisWithQCumulants::BookEverythingForVarious()
15820 {
15821  // Book all objects for various unclassified quantities.
15822  
15823  if(!fStorePhiDistributionForOneEvent){return;}
15824  
15825  // a) Book histogram holding phi distribution for single event to illustrate flow.
15826  
15827  // a) Book histogram holding phi distribution for single event to illustrate flow:
15828  fPhiDistributionForOneEvent = new TH1D("fPhiDistributionForOneEvent","",360,0.,TMath::TwoPi());
15829  fPhiDistributionForOneEvent->GetXaxis()->SetTitle("#phi");
15830  fVariousList->Add(fPhiDistributionForOneEvent);
15831  
15832 } // end of void AliFlowAnalysisWithQCumulants::BookEverythingForVarious()
15833
15834 //=======================================================================================================================
15835
15836 void AliFlowAnalysisWithQCumulants::StoreFlagsForDistributions()
15837 {
15838  // Store all flags for distributiuons of correlations in profile fDistributionsFlags.
15839  
15840  if(!fDistributionsFlags)
15841  {
15842   cout<<"WARNING: fDistributionsFlags is NULL in AFAWQC::SDF() !!!!"<<endl;
15843   exit(0);
15844  } 
15845
15846  fDistributionsFlags->Fill(0.5,(Int_t)fStoreDistributions); // histos with distributions of correlations stored or not in the output file
15847  // store min and max values of correlations:
15848  for(Int_t di=0;di<4;di++) // distribution index
15849  {
15850   fDistributionsFlags->Fill(1.5+2.*(Double_t)di,fMinValueOfCorrelation[di]);
15851   fDistributionsFlags->Fill(2.5+2.*(Double_t)di,fMaxValueOfCorrelation[di]);
15852  }
15853  fDistributionsFlags->Fill(9.5,fnBinsForCorrelations);
15854      
15855 } // end of void AliFlowAnalysisWithQCumulants::StoreFlagsForDistributions()
15856
15857 //=======================================================================================================================
15858
15859 void AliFlowAnalysisWithQCumulants::StoreDistributionsOfCorrelations()
15860 {
15861  // Store distributions of correlations.
15862  
15863  if(!(fIntFlowCorrelationsEBE && fIntFlowEventWeightsForCorrelationsEBE))
15864  {
15865   cout<<"WARNING: fIntFlowCorrelationsEBE && fIntFlowEventWeightsForCorrelationsEBE"<<endl; 
15866   cout<<"         is NULL in AFAWQC::SDOC() !!!!"<<endl;
15867   exit(0);
15868  }
15869
15870  for(Int_t di=0;di<4;di++) // distribution index
15871  {
15872   if(!fDistributions[di])
15873   { 
15874    cout<<"WARNING: fDistributions[di] is NULL in AFAWQC::SDOC() !!!!"<<endl;
15875    cout<<"di = "<<di<<endl;
15876    exit(0);
15877   } else 
15878     {
15879      fDistributions[di]->Fill(fIntFlowCorrelationsEBE->GetBinContent(di+1),fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(di+1)); 
15880     } 
15881  } // end of for(Int_t di=0;di<4;di++) // distribution index
15882
15883 } // end of void AliFlowAnalysisWithQCumulants::StoreDistributionsOfCorrelations()
15884
15885 //=======================================================================================================================
15886
15887 void AliFlowAnalysisWithQCumulants::BookAndNestAllLists()
15888 {
15889  // Book and nest all lists nested in the base list fHistList.
15890  //  a) Book and nest lists for integrated flow;
15891  //  b) Book and nest lists for differential flow;
15892  //  c) Book and nest list for particle weights;
15893  //  d) Book and nest list for distributions;
15894  //  e) Book and nest list for various unclassified objects; 
15895  //  f) Book and nest list for other differential correlators;
15896  //  g) Book and nest list for nested loops;
15897  //  h) Book and nest lists for mixed harmonics;
15898  //  i) Book and nest lists for control histograms;
15899  //  j) Book and nest lists for bootstrap.
15900
15901  // a) Book and nest all lists for integrated flow:
15902  //  Base list for integrated flow:
15903  fIntFlowList = new TList();
15904  fIntFlowList->SetName("Integrated Flow");
15905  fIntFlowList->SetOwner(kTRUE);
15906  fHistList->Add(fIntFlowList);
15907  //  List holding profiles: 
15908  fIntFlowProfiles = new TList();
15909  fIntFlowProfiles->SetName("Profiles");
15910  fIntFlowProfiles->SetOwner(kTRUE);
15911  fIntFlowList->Add(fIntFlowProfiles);
15912  //  List holding all profiles with results for correlations vs M:
15913  if(fCalculateAllCorrelationsVsM)
15914  {
15915   fIntFlowAllCorrelationsVsM = new TList();
15916   fIntFlowAllCorrelationsVsM->SetName("Correlations vs M");
15917   fIntFlowAllCorrelationsVsM->SetOwner(kTRUE); 
15918   fIntFlowProfiles->Add(fIntFlowAllCorrelationsVsM);
15919  } // end of if(fCalculateAllCorrelationsVsM)
15920  //  List holding histograms with results:
15921  fIntFlowResults = new TList();
15922  fIntFlowResults->SetName("Results");
15923  fIntFlowResults->SetOwner(kTRUE);
15924  fIntFlowList->Add(fIntFlowResults);
15925  
15926  // b) Book and nest lists for differential flow:
15927  this->BookAndNestListsForDifferentialFlow();
15928  
15929  // c) Book and nest list for particle weights:
15930  fWeightsList->SetName("Weights");
15931  fWeightsList->SetOwner(kTRUE);   
15932  fHistList->Add(fWeightsList); 
15933
15934  // d) Book and nest list for distributions:
15935  fDistributionsList = new TList();
15936  fDistributionsList->SetName("Distributions");
15937  fDistributionsList->SetOwner(kTRUE);
15938  fHistList->Add(fDistributionsList);
15939  
15940  // e) Book and nest list for various unclassified objects:
15941  if(fStorePhiDistributionForOneEvent)
15942  {
15943   fVariousList = new TList();
15944   fVariousList->SetName("Various");
15945   fVariousList->SetOwner(kTRUE);
15946   fHistList->Add(fVariousList);
15947  }
15948   
15949  // f) Book and nest list for other differential correlators:
15950  fOtherDiffCorrelatorsList = new TList();
15951  fOtherDiffCorrelatorsList->SetName("Other differential correlators");
15952  fOtherDiffCorrelatorsList->SetOwner(kTRUE);
15953  if(fCalculateDiffFlow){fHistList->Add(fOtherDiffCorrelatorsList);} // TBI: Use another flag here instead of fCalculateDiffFlow 
15954   
15955  // g) Book and nest list for nested loops:
15956  fNestedLoopsList = new TList();
15957  fNestedLoopsList->SetName("Nested Loops");
15958  fNestedLoopsList->SetOwner(kTRUE);
15959  fHistList->Add(fNestedLoopsList);
15960
15961  // h) Book and nest lists for mixed harmonics:
15962  //  Base list for mixed harmonics:
15963  fMixedHarmonicsList = new TList();
15964  fMixedHarmonicsList->SetName("Mixed Harmonics");
15965  fMixedHarmonicsList->SetOwner(kTRUE);
15966  fHistList->Add(fMixedHarmonicsList);
15967  //  List holding profiles: 
15968  fMixedHarmonicsProfiles = new TList();
15969  fMixedHarmonicsProfiles->SetName("Profiles");
15970  fMixedHarmonicsProfiles->SetOwner(kTRUE);
15971  if(fCalculateMixedHarmonics){fMixedHarmonicsList->Add(fMixedHarmonicsProfiles);}
15972  //  List holding histograms with results:
15973  fMixedHarmonicsResults = new TList();
15974  fMixedHarmonicsResults->SetName("Results");
15975  fMixedHarmonicsResults->SetOwner(kTRUE);
15976  if(fCalculateMixedHarmonics){fMixedHarmonicsList->Add(fMixedHarmonicsResults);}
15977  //  List holding objects for statistical error propagation of mixed harmonics:
15978  fMixedHarmonicsErrorPropagation = new TList();
15979  fMixedHarmonicsErrorPropagation->SetName("Error Propagation");
15980  fMixedHarmonicsErrorPropagation->SetOwner(kTRUE);
15981  if(fCalculateMixedHarmonics){fMixedHarmonicsList->Add(fMixedHarmonicsErrorPropagation);}
15982
15983  // i) Book and nest lists for control histograms:
15984  //  Base list for mixed harmonics:
15985  fControlHistogramsList = new TList();
15986  fControlHistogramsList->SetName("Control Histograms");
15987  fControlHistogramsList->SetOwner(kTRUE);
15988  fHistList->Add(fControlHistogramsList);
15989
15990  // j) Book and nest lists for bootstrap:
15991  fBootstrapList = new TList();
15992  fBootstrapList->SetName("Bootstrap");
15993  fBootstrapList->SetOwner(kTRUE);
15994  fHistList->Add(fBootstrapList);
15995  //  List holding profiles: 
15996  fBootstrapProfilesList = new TList();
15997  fBootstrapProfilesList->SetName("Profiles");
15998  fBootstrapProfilesList->SetOwner(kTRUE);
15999  if(fUseBootstrap||fUseBootstrapVsM){fBootstrapList->Add(fBootstrapProfilesList);}
16000  //  List holding histograms with results:
16001  fBootstrapResultsList = new TList();
16002  fBootstrapResultsList->SetName("Results");
16003  fBootstrapResultsList->SetOwner(kTRUE);
16004  if(fUseBootstrap||fUseBootstrapVsM){fBootstrapList->Add(fBootstrapResultsList);}
16005
16006 } // end of void AliFlowAnalysisWithQCumulants::BookAndNestAllLists()
16007
16008 //=======================================================================================================================
16009
16010 void AliFlowAnalysisWithQCumulants::BookAndNestListsForDifferentialFlow()
16011 {
16012  // Book and nest lists for differential flow.
16013
16014  // Base list for differential flow objects:
16015  fDiffFlowList = new TList();
16016  fDiffFlowList->SetName("Differential Flow");
16017  fDiffFlowList->SetOwner(kTRUE); 
16018  fHistList->Add(fDiffFlowList);
16019  
16020  // Local flags: 
16021  TString typeFlag[2] = {"RP","POI"};  
16022  TString ptEtaFlag[2] = {"p_{T}","#eta"}; 
16023  TString powerFlag[2] = {"linear","quadratic"};   
16024
16025  // 2D:
16026  if(fCalculate2DDiffFlow)
16027  {
16028   fDiffFlow2D = new TList(); 
16029   fDiffFlow2D->SetName("2D");
16030   fDiffFlow2D->SetOwner(kTRUE);
16031   fDiffFlowList->Add(fDiffFlow2D); 
16032   for(Int_t t=0;t<2;t++)
16033   {
16034    f2DDiffFlowCorrelationsProList[t] = new TList();
16035    f2DDiffFlowCorrelationsProList[t]->SetOwner(kTRUE);
16036    f2DDiffFlowCorrelationsProList[t]->SetName(Form("Profiles with 2D correlations (%s)",typeFlag[t].Data()));
16037    fDiffFlow2D->Add(f2DDiffFlowCorrelationsProList[t]);
16038   } // end of for(Int_t t=0;t<2;t++)
16039  } // end of if(fCalculate2DDiffFlow)
16040
16041  // What follows bellow in this method is relevant only for 1D differential flow:
16042  if(!fCalculateDiffFlow){return;}
16043  
16044  // List holding profiles: 
16045  fDiffFlowProfiles = new TList(); 
16046  fDiffFlowProfiles->SetName("Profiles");
16047  fDiffFlowProfiles->SetOwner(kTRUE);
16048  fDiffFlowList->Add(fDiffFlowProfiles);
16049  // List holding histograms with results: 
16050  fDiffFlowResults = new TList();
16051  fDiffFlowResults->SetName("Results");
16052  fDiffFlowResults->SetOwner(kTRUE);
16053  fDiffFlowList->Add(fDiffFlowResults);
16054  // Flags used for naming nested lists in list fDiffFlowProfiles and fDiffFlowResults:  
16055  TList list;
16056  list.SetOwner(kTRUE);
16057  // Nested lists in fDiffFlowProfiles (~/Differential Flow/Profiles):
16058  for(Int_t t=0;t<2;t++) // type: RP or POI
16059  {
16060   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
16061   {
16062    // list holding profiles with correlations:
16063    fDiffFlowCorrelationsProList[t][pe] = (TList*)list.Clone();
16064    fDiffFlowCorrelationsProList[t][pe]->SetName(Form("Profiles with correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16065    fDiffFlowProfiles->Add(fDiffFlowCorrelationsProList[t][pe]);
16066    // list holding profiles with products of correlations:
16067    fDiffFlowProductOfCorrelationsProList[t][pe] = (TList*)list.Clone();
16068    fDiffFlowProductOfCorrelationsProList[t][pe]->SetName(Form("Profiles with products of correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16069    fDiffFlowProfiles->Add(fDiffFlowProductOfCorrelationsProList[t][pe]);
16070    // list holding profiles with corrections:
16071    fDiffFlowCorrectionsProList[t][pe] = (TList*)list.Clone();
16072    fDiffFlowCorrectionsProList[t][pe]->SetName(Form("Profiles with correction terms for NUA (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16073    fDiffFlowProfiles->Add(fDiffFlowCorrectionsProList[t][pe]);   
16074   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
16075  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI   
16076  // nested lists in fDiffFlowResults (~/Differential Flow/Results):
16077  for(Int_t t=0;t<2;t++) // type: RP or POI
16078  {
16079   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
16080   {
16081    // list holding histograms with correlations:
16082    fDiffFlowCorrelationsHistList[t][pe] = (TList*)list.Clone();
16083    fDiffFlowCorrelationsHistList[t][pe]->SetName(Form("Correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16084    fDiffFlowResults->Add(fDiffFlowCorrelationsHistList[t][pe]);
16085    // list holding histograms with corrections:
16086    fDiffFlowCorrectionsHistList[t][pe] = (TList*)list.Clone();
16087    fDiffFlowCorrectionsHistList[t][pe]->SetName(Form("Histograms with correction terms for NUA (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16088    fDiffFlowResults->Add(fDiffFlowCorrectionsHistList[t][pe]);   
16089    for(Int_t power=0;power<2;power++)
16090    {
16091     // list holding histograms with sums of event weights:
16092     fDiffFlowSumOfEventWeightsHistList[t][pe][power] = (TList*)list.Clone();
16093     fDiffFlowSumOfEventWeightsHistList[t][pe][power]->SetName(Form("Sum of %s event weights (%s, %s)",powerFlag[power].Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16094     fDiffFlowResults->Add(fDiffFlowSumOfEventWeightsHistList[t][pe][power]);    
16095    } // end of for(Int_t power=0;power<2;power++)
16096    // list holding histograms with sums of products of event weights:
16097    fDiffFlowSumOfProductOfEventWeightsHistList[t][pe] = (TList*)list.Clone();
16098    fDiffFlowSumOfProductOfEventWeightsHistList[t][pe]->SetName(Form("Sum of products of event weights (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16099    fDiffFlowResults->Add(fDiffFlowSumOfProductOfEventWeightsHistList[t][pe]);
16100    // list holding histograms with covariances of correlations:
16101    fDiffFlowCovariancesHistList[t][pe] = (TList*)list.Clone();
16102    fDiffFlowCovariancesHistList[t][pe]->SetName(Form("Covariances of correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16103    fDiffFlowResults->Add(fDiffFlowCovariancesHistList[t][pe]);
16104    // list holding histograms with differential Q-cumulants:
16105    fDiffFlowCumulantsHistList[t][pe] = (TList*)list.Clone();
16106    fDiffFlowCumulantsHistList[t][pe]->SetName(Form("Differential Q-cumulants (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16107    fDiffFlowResults->Add(fDiffFlowCumulantsHistList[t][pe]);   
16108    // list holding histograms which quantify detector bias to differential Q-cumulants:
16109    fDiffFlowDetectorBiasHistList[t][pe] = (TList*)list.Clone();
16110    fDiffFlowDetectorBiasHistList[t][pe]->SetName(Form("Detector bias (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16111    fDiffFlowResults->Add(fDiffFlowDetectorBiasHistList[t][pe]);   
16112    // list holding histograms with differential flow estimates from Q-cumulants:
16113    fDiffFlowHistList[t][pe] = (TList*)list.Clone();
16114    fDiffFlowHistList[t][pe]->SetName(Form("Differential flow (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
16115    fDiffFlowResults->Add(fDiffFlowHistList[t][pe]);      
16116   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
16117  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
16118   
16119 } // end of void AliFlowAnalysisWithQCumulants::BookAndNestListsForDifferentialFlow()
16120
16121 //=======================================================================================================================
16122
16123 void AliFlowAnalysisWithQCumulants::FillCommonHistResultsDiffFlow(TString type)
16124 {
16125  // Fill common result histograms for differential flow.
16126  
16127  Int_t t = 0; 
16128
16129  if(type == "RP")
16130  {
16131   t = 0;
16132  } else if(type == "POI")
16133    {
16134     t = 1;
16135    } 
16136   
16137  // to be improved - check all pointers used in this method
16138      
16139  if(!(fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th))
16140  {
16141   cout<<"WARNING: fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th"<<endl; 
16142   cout<<"         is NULL in AFAWQC::FCHRIF() !!!!"<<endl;
16143   exit(0);
16144  }
16145  
16146  // pt:
16147  for(Int_t p=1;p<=fnBinsPt;p++)
16148  {
16149   Double_t v2 = fDiffFlow[t][0][0]->GetBinContent(p);
16150   Double_t v4 = fDiffFlow[t][0][1]->GetBinContent(p);
16151   Double_t v6 = fDiffFlow[t][0][2]->GetBinContent(p);
16152   Double_t v8 = fDiffFlow[t][0][3]->GetBinContent(p);
16153   
16154   Double_t v2Error = fDiffFlow[t][0][0]->GetBinError(p);
16155   Double_t v4Error = fDiffFlow[t][0][1]->GetBinError(p);
16156   //Double_t v6Error = fFinalFlow1D[t][pW][nua][0][2]->GetBinError(p);
16157   //Double_t v8Error = fFinalFlow1D[t][pW][nua][0][3]->GetBinError(p);
16158  
16159   if(type == "RP")
16160   {
16161    fCommonHistsResults2nd->FillDifferentialFlowPtRP(p,v2,v2Error);
16162    fCommonHistsResults4th->FillDifferentialFlowPtRP(p,v4,v4Error);
16163    fCommonHistsResults6th->FillDifferentialFlowPtRP(p,v6,0.);
16164    fCommonHistsResults8th->FillDifferentialFlowPtRP(p,v8,0.);
16165   } else if(type == "POI")
16166     {
16167      fCommonHistsResults2nd->FillDifferentialFlowPtPOI(p,v2,v2Error);
16168      fCommonHistsResults4th->FillDifferentialFlowPtPOI(p,v4,v4Error);
16169      fCommonHistsResults6th->FillDifferentialFlowPtPOI(p,v6,0.);
16170      fCommonHistsResults8th->FillDifferentialFlowPtPOI(p,v8,0.);
16171     }
16172  } // end of for(Int_t p=1;p<=fnBinsPt;p++)   
16173  
16174  // eta:
16175  if(!fCalculateDiffFlowVsEta){return;}
16176  for(Int_t e=1;e<=fnBinsEta;e++)
16177  {
16178   Double_t v2 = fDiffFlow[t][1][0]->GetBinContent(e);
16179   Double_t v4 = fDiffFlow[t][1][1]->GetBinContent(e);
16180   Double_t v6 = fDiffFlow[t][1][2]->GetBinContent(e);
16181   Double_t v8 = fDiffFlow[t][1][3]->GetBinContent(e);
16182   
16183   Double_t v2Error = fDiffFlow[t][1][0]->GetBinError(e);
16184   Double_t v4Error = fDiffFlow[t][1][1]->GetBinError(e);
16185   //Double_t v6Error = fDiffFlow[t][1][2]->GetBinError(e);
16186   //Double_t v8Error = fDiffFlow[t][1][3]->GetBinError(e);
16187  
16188   if(type == "RP")
16189   {
16190    fCommonHistsResults2nd->FillDifferentialFlowEtaRP(e,v2,v2Error);
16191    fCommonHistsResults4th->FillDifferentialFlowEtaRP(e,v4,v4Error);
16192    fCommonHistsResults6th->FillDifferentialFlowEtaRP(e,v6,0.);
16193    fCommonHistsResults8th->FillDifferentialFlowEtaRP(e,v8,0.);
16194   } else if(type == "POI")
16195     {
16196      fCommonHistsResults2nd->FillDifferentialFlowEtaPOI(e,v2,v2Error);
16197      fCommonHistsResults4th->FillDifferentialFlowEtaPOI(e,v4,v4Error);
16198      fCommonHistsResults6th->FillDifferentialFlowEtaPOI(e,v6,0.);
16199      fCommonHistsResults8th->FillDifferentialFlowEtaPOI(e,v8,0.);
16200     }
16201  } // end of for(Int_t e=1;e<=fnBinsEta;e++)    
16202  
16203 } // end of void AliFlowAnalysisWithQCumulants::FillCommonHistResultsDiffFlow(TString type, Bool_t useParticleWeights, TString eventWeights, Bool_t correctedForNUA)
16204
16205 //=======================================================================================================================
16206
16207 void AliFlowAnalysisWithQCumulants::CommonConstants(TString method)
16208 {
16209  // Access and store common constants.
16210  
16211  // a) If this method was called in Init() access common constants from AliFlowCommonConstants;
16212  // b) If this method was called in Init() book and fill TProfile to hold constants accessed in a);
16213  // c) If this method was called in Finish() access common constants from TProfile booked and filled in b).
16214
16215  if(method == "Init")
16216  {
16217   // a) If this method was called in Init() access common constants from AliFlowCommonConstants:
16218   fnBinsPhi = AliFlowCommonConstants::GetMaster()->GetNbinsPhi();
16219   fPhiMin = AliFlowCommonConstants::GetMaster()->GetPhiMin();        
16220   fPhiMax = AliFlowCommonConstants::GetMaster()->GetPhiMax();
16221   if(fnBinsPhi){fPhiBinWidth = (fPhiMax-fPhiMin)/fnBinsPhi;}  
16222   fnBinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
16223   fPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();          
16224   fPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
16225   if(fnBinsPt){fPtBinWidth = (fPtMax-fPtMin)/fnBinsPt;}  
16226   fnBinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
16227   fEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();        
16228   fEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();
16229   if(fnBinsEta){fEtaBinWidth = (fEtaMax-fEtaMin)/fnBinsEta;}  
16230   
16231   // b) If this method was called in Init() book and fill TProfile to hold constants accessed in a):
16232   TString fCommonConstantsName = "fCommonConstants";
16233   fCommonConstantsName += fAnalysisLabel->Data();
16234   fCommonConstants = new TProfile(fCommonConstantsName.Data(),"Common constants",9,0.,9.);
16235   fCommonConstants->SetLabelSize(0.05);
16236   fCommonConstants->GetXaxis()->SetBinLabel(1,"nBins (#phi)");
16237   fCommonConstants->Fill(0.5,fnBinsPhi);
16238   fCommonConstants->GetXaxis()->SetBinLabel(2,"#phi_{min}");
16239   fCommonConstants->Fill(1.5,fPhiMin);
16240   fCommonConstants->GetXaxis()->SetBinLabel(3,"#phi_{max}");
16241   fCommonConstants->Fill(2.5,fPhiMax);
16242   fCommonConstants->GetXaxis()->SetBinLabel(4,"nBins (p_{t})");
16243   fCommonConstants->Fill(3.5,fnBinsPt);
16244   fCommonConstants->GetXaxis()->SetBinLabel(5,"(p_{t})_{min}");
16245   fCommonConstants->Fill(4.5,fPtMin);
16246   fCommonConstants->GetXaxis()->SetBinLabel(6,"(p_{t})_{max}");
16247   fCommonConstants->Fill(5.5,fPtMax);
16248   fCommonConstants->GetXaxis()->SetBinLabel(7,"nBins (#eta)");
16249   fCommonConstants->Fill(6.5,fnBinsEta);
16250   fCommonConstants->GetXaxis()->SetBinLabel(8,"#eta_{min}");
16251   fCommonConstants->Fill(7.5,fEtaMin);
16252   fCommonConstants->GetXaxis()->SetBinLabel(9,"#eta_{max}");
16253   fCommonConstants->Fill(8.5,fEtaMax);
16254   fHistList->Add(fCommonConstants); 
16255  } // end of if(method == "Init")
16256  else if(method == "Finish")
16257  {
16258   // c) If this method was called in Finish() access common constants from TProfile booked and filled in b):
16259   if(!fCommonConstants)
16260   {
16261    printf("\n WARNING (QC): fCommonConstants is NULL in AFAWQC::AC(\"%s\") !!!!\n\n",method.Data());
16262    exit(0);
16263   } 
16264   fnBinsPhi = (Int_t)fCommonConstants->GetBinContent(1);
16265   fPhiMin = fCommonConstants->GetBinContent(2);      
16266   fPhiMax = fCommonConstants->GetBinContent(3);
16267   if(fnBinsPhi){fPhiBinWidth = (fPhiMax-fPhiMin)/fnBinsPhi;}  
16268   fnBinsPt = (Int_t)fCommonConstants->GetBinContent(4);
16269   fPtMin = fCommonConstants->GetBinContent(5);       
16270   fPtMax = fCommonConstants->GetBinContent(6);
16271   if(fnBinsPt){fPtBinWidth = (fPtMax-fPtMin)/fnBinsPt;}  
16272   fnBinsEta = (Int_t)fCommonConstants->GetBinContent(7);
16273   fEtaMin = fCommonConstants->GetBinContent(8);      
16274   fEtaMax = fCommonConstants->GetBinContent(9);
16275   if(fnBinsEta){fEtaBinWidth = (fEtaMax-fEtaMin)/fnBinsEta;}  
16276  } // end of else if(method == "Finish")
16277
16278 } // end of void AliFlowAnalysisWithQCumulants::CommonConstants(TString method)
16279
16280 //=======================================================================================================================
16281
16282 void AliFlowAnalysisWithQCumulants::CrossCheckSettings()
16283 {
16284  // a) Cross-check if the choice for multiplicity weights make sense;
16285  // b) Cross-check if the choice for multiplicity itself make sense.
16286
16287  // a) Cross-check if the choice for multiplicity weights make sense:
16288  if((!fMultiplicityWeight->Contains("combinations")) && 
16289     (!fMultiplicityWeight->Contains("unit")) &&
16290     (!fMultiplicityWeight->Contains("multiplicity")) )
16291  {
16292   cout<<"WARNING (QC): Multiplicity weight can be either \"combinations\", \"unit\""<<endl;
16293   cout<<"              or \"multiplicity\". Certainly not \""<<fMultiplicityWeight->Data()<<"\"."<<endl;
16294   exit(0);
16295  }   
16296
16297 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckSettings()
16298
16299 //=======================================================================================================================
16300
16301 void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfEventWeights()
16302 {
16303  // Calculate sum of linear and quadratic event weights for correlations.
16304  
16305  // TBI re-think what is the right multiplicity when particle weights are used! 
16306
16307  // Multiplicity bin of an event (relevant for all histos vs M): 
16308  Double_t dMultiplicityBin = 0.;
16309  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
16310  {
16311   dMultiplicityBin = fNumberOfRPsEBE+0.5;
16312  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
16313    {
16314      dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
16315    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
16316      {
16317       dMultiplicityBin = fNumberOfPOIsEBE+0.5;
16318      }
16319                         
16320  for(Int_t p=0;p<2;p++) // power-1
16321  {
16322   for(Int_t ci=0;ci<4;ci++) // correlation index
16323   { 
16324    fIntFlowSumOfEventWeights[p]->Fill(ci+0.5,pow(fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci+1),p+1)); 
16325    if(fCalculateCumulantsVsM)
16326    {
16327     if(fFillProfilesVsMUsingWeights)
16328     {
16329      fIntFlowSumOfEventWeightsVsM[ci][p]->Fill(dMultiplicityBin,pow(fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci+1),p+1)); // to be improved: dMult => sum of weights?
16330     } else
16331       {
16332        fIntFlowSumOfEventWeightsVsM[ci][p]->Fill(dMultiplicityBin); // to be improved: dMult => sum of weights?
16333       }
16334    } // end of if(fCalculateCumulantsVsM)
16335   } // end of for(Int_t ci=0;ci<4;ci++) // correlation index
16336  } // end of for(Int_t p=0;p<2;p++) // power-1
16337   
16338 } // end of void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfEventWeights()
16339
16340 //=======================================================================================================================
16341
16342 void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfEventWeightsNUA()
16343 {
16344  // Calculate sum of linear and quadratic event weights for NUA terms.
16345                        
16346  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
16347  {
16348   for(Int_t p=0;p<2;p++) // power-1
16349   {
16350    for(Int_t ci=0;ci<4;ci++) // nua term index
16351    { 
16352     fIntFlowSumOfEventWeightsNUA[sc][p]->Fill(ci+0.5,pow(fIntFlowEventWeightForCorrectionTermsForNUAEBE[sc]->GetBinContent(ci+1),p+1)); 
16353    }
16354   }
16355  }
16356   
16357 } // end of void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfEventWeightsNUA()
16358
16359 //=======================================================================================================================
16360
16361 void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfProductOfEventWeights()
16362 {
16363  // Calculate sum of product of event weights for correlations.
16364   
16365  // TBI re-think what is the right multiplicity when particle weights are used!
16366
16367  // Multiplicity bin of an event (relevant for all histos vs M): 
16368  Double_t dMultiplicityBin = 0.;
16369  if(fMultiplicityIs==AliFlowCommonConstants::kRP)
16370  {
16371   dMultiplicityBin = fNumberOfRPsEBE+0.5;
16372  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
16373    {
16374     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
16375    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
16376      {
16377       dMultiplicityBin = fNumberOfPOIsEBE+0.5;
16378      }
16379   
16380  Int_t counter = 0;
16381  
16382  for(Int_t ci1=1;ci1<4;ci1++)
16383  {
16384   for(Int_t ci2=ci1+1;ci2<=4;ci2++)
16385   {
16386    fIntFlowSumOfProductOfEventWeights->Fill(0.5+counter,
16387                                             fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci1)*
16388                                             fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci2));
16389    if(fCalculateCumulantsVsM)
16390    {                                                                                    
16391     if(fFillProfilesVsMUsingWeights)
16392     {
16393      fIntFlowSumOfProductOfEventWeightsVsM[counter]->Fill(dMultiplicityBin, // to be improved: dMult => sum of weights?
16394                                                           fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci1)*
16395                                                           fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci2));
16396     } else
16397       {
16398        fIntFlowSumOfProductOfEventWeightsVsM[counter]->Fill(dMultiplicityBin);
16399       }
16400    } // end of if(fCalculateCumulantsVsM)
16401    counter++;                                         
16402   } // end of for(Int_t ci2=ci1+1;ci2<=4;ci2++)
16403  } // end of for(Int_t ci1=1;ci1<4;ci1++)
16404
16405 } // end of void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfProductOfEventWeights()
16406
16407 //=======================================================================================================================
16408
16409 void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfProductOfEventWeightsNUA()
16410 {
16411  // Calculate sum of product of event weights for NUA terms.
16412   
16413  // w_{<2>} * w_{<cos(#phi)>}:
16414  fIntFlowSumOfProductOfEventWeightsNUA->Fill(0.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
16415                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1));
16416  // w_{<2>} * w_{<sin(#phi)>}:
16417  fIntFlowSumOfProductOfEventWeightsNUA->Fill(1.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
16418                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
16419  // w_{<cos(#phi)> * w_{<sin(#phi)>}:
16420  fIntFlowSumOfProductOfEventWeightsNUA->Fill(2.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
16421                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
16422  // w_{<2>} * w{<cos(phi1+phi2)>}
16423  fIntFlowSumOfProductOfEventWeightsNUA->Fill(3.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
16424                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
16425  // w_{<2>} * w{<sin(phi1+phi2)>}
16426  fIntFlowSumOfProductOfEventWeightsNUA->Fill(4.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
16427                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));
16428  // w_{<2>} * w{<cos(phi1-phi2-phi3)>}
16429  fIntFlowSumOfProductOfEventWeightsNUA->Fill(5.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
16430                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));
16431  // w_{<2>} * w{<sin(phi1-phi2-phi3)>}
16432  fIntFlowSumOfProductOfEventWeightsNUA->Fill(6.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
16433                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));  
16434  // w_{<4>} * w{<cos(phi1)>}
16435  fIntFlowSumOfProductOfEventWeightsNUA->Fill(7.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
16436                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1));
16437  // w_{<4>} * w{<sin(phi1)>}
16438  fIntFlowSumOfProductOfEventWeightsNUA->Fill(8.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
16439                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
16440  // w_{<4>} * w{<cos(phi1+phi2)>}
16441  fIntFlowSumOfProductOfEventWeightsNUA->Fill(9.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
16442                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
16443  // w_{<4>} * w{<sin(phi1+phi2)>}
16444  fIntFlowSumOfProductOfEventWeightsNUA->Fill(10.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
16445                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));
16446  // w_{<4>} * w{<cos(phi1-phi2-phi3)>}
16447  fIntFlowSumOfProductOfEventWeightsNUA->Fill(11.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
16448                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));
16449  // w_{<4>} * w{<sin(phi1-phi2-phi3)>}
16450  fIntFlowSumOfProductOfEventWeightsNUA->Fill(12.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
16451                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));
16452  // w_{<cos(phi1)>} * w{<cos(phi1+phi2)>}
16453  fIntFlowSumOfProductOfEventWeightsNUA->Fill(13.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
16454                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2));
16455  // w_{<cos(phi1)>} * w{<sin(phi1+phi2)>}
16456  fIntFlowSumOfProductOfEventWeightsNUA->Fill(14.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
16457                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
16458  // w_{<cos(phi1)>} * w{<cos(phi1-phi2-phi3)>}
16459  fIntFlowSumOfProductOfEventWeightsNUA->Fill(15.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
16460                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));
16461  // w_{<cos(phi1)>} * w{<sin(phi1-phi2-phi3)>}
16462  fIntFlowSumOfProductOfEventWeightsNUA->Fill(16.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
16463                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));
16464  // w_{<sin(phi1)>} * w{<cos(phi1+phi2)>}
16465  fIntFlowSumOfProductOfEventWeightsNUA->Fill(17.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)*
16466                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2));
16467  // w_{<sin(phi1)>} * w{<sin(phi1+phi2)>}
16468  fIntFlowSumOfProductOfEventWeightsNUA->Fill(18.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)*
16469                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));
16470  // w_{<sin(phi1)>} * w{<cos(phi1-phi2-phi3)>}
16471  fIntFlowSumOfProductOfEventWeightsNUA->Fill(19.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)*
16472                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));
16473  // w_{<sin(phi1)>} * w{<sin(phi1-phi2-phi3)>}
16474  fIntFlowSumOfProductOfEventWeightsNUA->Fill(20.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)*
16475                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
16476  // w_{<cos(phi1+phi2)>} * w{<sin(phi1+phi2))>}
16477  fIntFlowSumOfProductOfEventWeightsNUA->Fill(21.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)*
16478                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
16479  // w_{<cos(phi1+phi2)>} * w{<cos(phi1-phi2-phi3)>}
16480  fIntFlowSumOfProductOfEventWeightsNUA->Fill(22.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)*
16481                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
16482  // w_{<cos(phi1+phi2)>} * w{<sin(phi1-phi2-phi3)>}
16483  fIntFlowSumOfProductOfEventWeightsNUA->Fill(23.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)*
16484                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
16485  // w_{<sin(phi1+phi2)>} * w{<cos(phi1-phi2-phi3)>}
16486  fIntFlowSumOfProductOfEventWeightsNUA->Fill(24.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)*
16487                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
16488  // w_{<sin(phi1+phi2)>} * w{<sin(phi1-phi2-phi3)>}
16489  fIntFlowSumOfProductOfEventWeightsNUA->Fill(25.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)*
16490                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
16491  // w_{<cos(phi1-phi2-phi3)>} * w{<sin(phi1-phi2-phi3)>}
16492  fIntFlowSumOfProductOfEventWeightsNUA->Fill(26.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)*
16493                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));
16494
16495 } // end of void AliFlowAnalysisWithQCumulants::CalculateIntFlowIntFlowSumOfProductOfEventWeightsNUA()
16496
16497 //=======================================================================================================================
16498
16499 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrelations(TString type, TString ptOrEta)
16500 {
16501  // Calculate reduced correlations for RPs or POIs for all pt and eta bins.
16502
16503  // Multiplicity:
16504  Double_t dMult = (*fSpk)(0,0);
16505  
16506  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
16507  Double_t dReQ1n = (*fReQ)(0,0);
16508  Double_t dReQ2n = (*fReQ)(1,0);
16509  //Double_t dReQ3n = (*fReQ)(2,0);
16510  //Double_t dReQ4n = (*fReQ)(3,0);
16511  Double_t dImQ1n = (*fImQ)(0,0);
16512  Double_t dImQ2n = (*fImQ)(1,0);
16513  //Double_t dImQ3n = (*fImQ)(2,0);
16514  //Double_t dImQ4n = (*fImQ)(3,0);
16515
16516  // reduced correlations are stored in fDiffFlowCorrelationsPro[0=RP,1=POI][0=pt,1=eta][correlation index]. Correlation index runs as follows:
16517  // 
16518  // 0: <<2'>>
16519  // 1: <<4'>>
16520  // 2: <<6'>>
16521  // 3: <<8'>>
16522  
16523  //Int_t t = 0; // type flag 
16524  Int_t pe = 0; // ptEta flag
16525  
16526  if(type == "RP")
16527  {
16528   //t = 0;
16529  } else if(type == "POI")
16530    {
16531     //t = 1;
16532    }
16533
16534  if(ptOrEta == "Pt")
16535  {
16536   pe = 0;
16537  } else if(ptOrEta == "Eta")
16538    {
16539     pe = 1;
16540    }
16541     
16542  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
16543  Double_t minPtEta[2] = {fPtMin,fEtaMin};
16544  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
16545  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
16546
16547  // looping over all bins and calculating reduced correlations: 
16548  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16549  {
16550   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
16551   Double_t p1n0kRe = 0.;
16552   Double_t p1n0kIm = 0.;
16553
16554   // number of POIs in particular pt or eta bin:
16555   Double_t mp = 0.;
16556
16557   // 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):
16558   Double_t q1n0kRe = 0.;
16559   Double_t q1n0kIm = 0.;
16560   Double_t q2n0kRe = 0.;
16561   Double_t q2n0kIm = 0.;
16562
16563   // number of particles which are both RPs and POIs in particular pt or eta bin:
16564   Double_t mq = 0.;
16565    
16566   if(type == "POI")
16567   {
16568    // q_{m*n,0}:
16569    q1n0kRe = fReRPQ1dEBE[2][pe][0][0]->GetBinContent(fReRPQ1dEBE[2][pe][0][0]->GetBin(b))
16570            * fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b));
16571    q1n0kIm = fImRPQ1dEBE[2][pe][0][0]->GetBinContent(fImRPQ1dEBE[2][pe][0][0]->GetBin(b))
16572            * fImRPQ1dEBE[2][pe][0][0]->GetBinEntries(fImRPQ1dEBE[2][pe][0][0]->GetBin(b));
16573    q2n0kRe = fReRPQ1dEBE[2][pe][1][0]->GetBinContent(fReRPQ1dEBE[2][pe][1][0]->GetBin(b))
16574            * fReRPQ1dEBE[2][pe][1][0]->GetBinEntries(fReRPQ1dEBE[2][pe][1][0]->GetBin(b));
16575    q2n0kIm = fImRPQ1dEBE[2][pe][1][0]->GetBinContent(fImRPQ1dEBE[2][pe][1][0]->GetBin(b))
16576            * fImRPQ1dEBE[2][pe][1][0]->GetBinEntries(fImRPQ1dEBE[2][pe][1][0]->GetBin(b));         
16577                  
16578    mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
16579   } 
16580   else if(type == "RP")
16581   {
16582    // q_{m*n,0}:
16583    q1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
16584            * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
16585    q1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))
16586            * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
16587    q2n0kRe = fReRPQ1dEBE[0][pe][1][0]->GetBinContent(fReRPQ1dEBE[0][pe][1][0]->GetBin(b))
16588            * fReRPQ1dEBE[0][pe][1][0]->GetBinEntries(fReRPQ1dEBE[0][pe][1][0]->GetBin(b));
16589    q2n0kIm = fImRPQ1dEBE[0][pe][1][0]->GetBinContent(fImRPQ1dEBE[0][pe][1][0]->GetBin(b))
16590            * fImRPQ1dEBE[0][pe][1][0]->GetBinEntries(fImRPQ1dEBE[0][pe][1][0]->GetBin(b));         
16591                  
16592    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)  
16593   }
16594       
16595    if(type == "POI")
16596    {
16597     // p_{m*n,0}:
16598     p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
16599             * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
16600     p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
16601             * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
16602             
16603     mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
16604     
16605     //t = 1; // typeFlag = RP or POI
16606    }
16607    else if(type == "RP")
16608    {
16609     // p_{m*n,0} = q_{m*n,0}:
16610     p1n0kRe = q1n0kRe; 
16611     p1n0kIm = q1n0kIm; 
16612             
16613     mp = mq; 
16614     
16615     //t = 0; // typeFlag = RP or POI
16616    }
16617       
16618    // 2'-particle correlation for particular pt or eta bin:
16619    Double_t two1n1nPtEta = 0.;
16620    Double_t mWeight2pPrime = 0.; // multiplicity weight for <2'>
16621    if(mp*dMult-mq)
16622    {
16623     two1n1nPtEta = (p1n0kRe*dReQ1n+p1n0kIm*dImQ1n-mq)
16624                  / (mp*dMult-mq);
16625     // determine multiplicity weight:
16626     if(fMultiplicityWeight->Contains("combinations"))
16627     {
16628      mWeight2pPrime = mp*dMult-mq;
16629     } else if(fMultiplicityWeight->Contains("unit"))
16630       {
16631        mWeight2pPrime = 1.;    
16632       } 
16633     if(type == "POI") // to be improved (I do not this if)
16634     { 
16635      // fill profile to get <<2'>> for POIs
16636      fDiffFlowCorrelationsPro[1][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nPtEta,mWeight2pPrime);
16637      // fill profile to get <<2'>^2> for POIs
16638      fDiffFlowSquaredCorrelationsPro[1][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nPtEta*two1n1nPtEta,mWeight2pPrime);   
16639      // histogram to store <2'> for POIs e-b-e (needed in some other methods):
16640      fDiffFlowCorrelationsEBE[1][pe][0]->SetBinContent(b,two1n1nPtEta);      
16641      fDiffFlowEventWeightsForCorrelationsEBE[1][pe][0]->SetBinContent(b,mWeight2pPrime);      
16642     }
16643     else if(type == "RP") // to be improved (I do not this if)
16644     {
16645      // profile to get <<2'>> for RPs:
16646      fDiffFlowCorrelationsPro[0][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nPtEta,mWeight2pPrime);     
16647      // profile to get <<2'>^2> for RPs:
16648      fDiffFlowSquaredCorrelationsPro[0][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nPtEta*two1n1nPtEta,mWeight2pPrime);          
16649      // histogram to store <2'> for RPs e-b-e (needed in some other methods):
16650      fDiffFlowCorrelationsEBE[0][pe][0]->SetBinContent(b,two1n1nPtEta); 
16651      fDiffFlowEventWeightsForCorrelationsEBE[0][pe][0]->SetBinContent(b,mWeight2pPrime); 
16652     }
16653    } // end of if(mp*dMult-mq)
16654   
16655    // 4'-particle correlation:
16656    Double_t four1n1n1n1nPtEta = 0.;
16657    Double_t mWeight4pPrime = 0.; // multiplicity weight for <4'>
16658    if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16659        + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)) // to be improved (introduce a new variable for this expression)
16660    {
16661     four1n1n1n1nPtEta = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)
16662                       - q2n0kRe*(pow(dReQ1n,2.)-pow(dImQ1n,2.))
16663                       - 2.*q2n0kIm*dReQ1n*dImQ1n
16664                       - p1n0kRe*(dReQ1n*dReQ2n+dImQ1n*dImQ2n)
16665                       + p1n0kIm*(dImQ1n*dReQ2n-dReQ1n*dImQ2n)
16666                       - 2.*dMult*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)
16667                       - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*mq                      
16668                       + 6.*(q1n0kRe*dReQ1n+q1n0kIm*dImQ1n)                                            
16669                       + 1.*(q2n0kRe*dReQ2n+q2n0kIm*dImQ2n)                      
16670                       + 2.*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)                       
16671                       + 2.*mq*dMult                      
16672                       - 6.*mq)        
16673                       / ((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16674                           + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
16675     // determine multiplicity weight:
16676     if(fMultiplicityWeight->Contains("combinations"))
16677     {
16678      mWeight4pPrime = (mp-mq)*dMult*(dMult-1.)*(dMult-2.) + mq*(dMult-1.)*(dMult-2.)*(dMult-3.);
16679     } else if(fMultiplicityWeight->Contains("unit"))
16680       {
16681        mWeight4pPrime = 1.;    
16682       }     
16683     if(type == "POI")
16684     {
16685      // profile to get <<4'>> for POIs:
16686      fDiffFlowCorrelationsPro[1][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nPtEta,mWeight4pPrime);      
16687      // profile to get <<4'>^2> for POIs:
16688      fDiffFlowSquaredCorrelationsPro[1][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nPtEta*four1n1n1n1nPtEta,mWeight4pPrime); 
16689      // histogram to store <4'> for POIs e-b-e (needed in some other methods):
16690      fDiffFlowCorrelationsEBE[1][pe][1]->SetBinContent(b,four1n1n1n1nPtEta);                               
16691      fDiffFlowEventWeightsForCorrelationsEBE[1][pe][1]->SetBinContent(b,mWeight4pPrime);                               
16692     }
16693     else if(type == "RP")
16694     {
16695      // profile to get <<4'>> for RPs:
16696      fDiffFlowCorrelationsPro[0][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nPtEta,mWeight4pPrime);    
16697      // profile to get <<4'>^2> for RPs:
16698      fDiffFlowSquaredCorrelationsPro[0][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nPtEta*four1n1n1n1nPtEta,mWeight4pPrime);    
16699      // histogram to store <4'> for RPs e-b-e (needed in some other methods):
16700      fDiffFlowCorrelationsEBE[0][pe][1]->SetBinContent(b,four1n1n1n1nPtEta);                   
16701      fDiffFlowEventWeightsForCorrelationsEBE[0][pe][1]->SetBinContent(b,mWeight4pPrime);                   
16702     }
16703    } // end of if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16704      //            +mq*(dMult-1.)*(dMult-2.)*(dMult-3.))
16705    
16706  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16707  
16708    
16709 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrelations(TString type, TString ptOrEta);
16710
16711 //=======================================================================================================================
16712
16713 void AliFlowAnalysisWithQCumulants::CalculateOtherDiffCorrelators(TString type, TString ptOrEta)
16714 {
16715  // Calculate other differential correlators for RPs or POIs for all pt and eta bins.
16716  
16717  // Multiplicity:
16718  Double_t dMult = (*fSpk)(0,0);
16719  
16720  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
16721  Double_t dReQ1n = (*fReQ)(0,0);
16722  Double_t dReQ2n = (*fReQ)(1,0);
16723  Double_t dReQ3n = (*fReQ)(2,0);
16724  //Double_t dReQ4n = (*fReQ)(3,0);
16725  Double_t dImQ1n = (*fImQ)(0,0);
16726  Double_t dImQ2n = (*fImQ)(1,0);
16727  Double_t dImQ3n = (*fImQ)(2,0);
16728  //Double_t dImQ4n = (*fImQ)(3,0);
16729
16730  // 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]
16731  // Correlation index runs as follows:
16732  // 
16733  //  0: <exp[in(psi1-3phi2+2phi3)]>
16734  
16735  Int_t t = 0; // type flag 
16736  Int_t pe = 0; // ptEta flag
16737  
16738  if(type == "RP")
16739  {
16740   t = 0;
16741  } else if(type == "POI")
16742    {
16743     t = 1;
16744    }
16745
16746  if(ptOrEta == "Pt")
16747  {
16748   pe = 0;
16749  } else if(ptOrEta == "Eta")
16750    {
16751     pe = 1;
16752    }
16753     
16754  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
16755  Double_t minPtEta[2] = {fPtMin,fEtaMin};
16756  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
16757  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
16758
16759  // looping over all bins and calculating reduced correlations: 
16760  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16761  {
16762   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
16763   Double_t p1n0kRe = 0.;
16764   Double_t p1n0kIm = 0.;
16765
16766   // number of POIs in particular pt or eta bin:
16767   Double_t mp = 0.;
16768
16769   // 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):
16770   Double_t q1n0kRe = 0.;
16771   Double_t q1n0kIm = 0.;
16772   Double_t q2n0kRe = 0.;
16773   Double_t q2n0kIm = 0.;
16774   Double_t q3n0kRe = 0.;
16775   Double_t q3n0kIm = 0.;
16776
16777   // number of particles which are both RPs and POIs in particular pt or eta bin:
16778   Double_t mq = 0.;
16779    
16780   if(type == "POI")
16781   {
16782    // q_{m*n,0}:
16783    q1n0kRe = fReRPQ1dEBE[2][pe][0][0]->GetBinContent(fReRPQ1dEBE[2][pe][0][0]->GetBin(b))
16784            * fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b));
16785    q1n0kIm = fImRPQ1dEBE[2][pe][0][0]->GetBinContent(fImRPQ1dEBE[2][pe][0][0]->GetBin(b))
16786            * fImRPQ1dEBE[2][pe][0][0]->GetBinEntries(fImRPQ1dEBE[2][pe][0][0]->GetBin(b));
16787    q2n0kRe = fReRPQ1dEBE[2][pe][1][0]->GetBinContent(fReRPQ1dEBE[2][pe][1][0]->GetBin(b))
16788            * fReRPQ1dEBE[2][pe][1][0]->GetBinEntries(fReRPQ1dEBE[2][pe][1][0]->GetBin(b));
16789    q2n0kIm = fImRPQ1dEBE[2][pe][1][0]->GetBinContent(fImRPQ1dEBE[2][pe][1][0]->GetBin(b))
16790            * fImRPQ1dEBE[2][pe][1][0]->GetBinEntries(fImRPQ1dEBE[2][pe][1][0]->GetBin(b));                         
16791    q3n0kRe = fReRPQ1dEBE[2][pe][2][0]->GetBinContent(fReRPQ1dEBE[2][pe][2][0]->GetBin(b))
16792            * fReRPQ1dEBE[2][pe][2][0]->GetBinEntries(fReRPQ1dEBE[2][pe][2][0]->GetBin(b));
16793    q3n0kIm = fImRPQ1dEBE[2][pe][2][0]->GetBinContent(fImRPQ1dEBE[2][pe][2][0]->GetBin(b))
16794            * fImRPQ1dEBE[2][pe][2][0]->GetBinEntries(fImRPQ1dEBE[2][pe][2][0]->GetBin(b));         
16795
16796    mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
16797   } 
16798   else if(type == "RP")
16799   {
16800    // q_{m*n,0}:
16801    q1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
16802            * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
16803    q1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))
16804            * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
16805    q2n0kRe = fReRPQ1dEBE[0][pe][1][0]->GetBinContent(fReRPQ1dEBE[0][pe][1][0]->GetBin(b))
16806            * fReRPQ1dEBE[0][pe][1][0]->GetBinEntries(fReRPQ1dEBE[0][pe][1][0]->GetBin(b));
16807    q2n0kIm = fImRPQ1dEBE[0][pe][1][0]->GetBinContent(fImRPQ1dEBE[0][pe][1][0]->GetBin(b))
16808            * fImRPQ1dEBE[0][pe][1][0]->GetBinEntries(fImRPQ1dEBE[0][pe][1][0]->GetBin(b));         
16809    q3n0kRe = fReRPQ1dEBE[0][pe][2][0]->GetBinContent(fReRPQ1dEBE[0][pe][2][0]->GetBin(b))
16810            * fReRPQ1dEBE[0][pe][2][0]->GetBinEntries(fReRPQ1dEBE[0][pe][2][0]->GetBin(b));
16811    q3n0kIm = fImRPQ1dEBE[0][pe][2][0]->GetBinContent(fImRPQ1dEBE[0][pe][2][0]->GetBin(b))
16812            * fImRPQ1dEBE[0][pe][2][0]->GetBinEntries(fImRPQ1dEBE[0][pe][2][0]->GetBin(b));         
16813                  
16814    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)  
16815   }
16816       
16817    if(type == "POI")
16818    {
16819     // p_{m*n,0}:
16820     p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
16821             * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
16822     p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
16823             * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
16824             
16825     mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
16826     
16827     t = 1; // typeFlag = RP or POI
16828    }
16829    else if(type == "RP")
16830    {
16831     // p_{m*n,0} = q_{m*n,0}:
16832     p1n0kRe = q1n0kRe; 
16833     p1n0kIm = q1n0kIm; 
16834             
16835     mp = mq; 
16836     
16837     t = 0; // typeFlag = RP or POI
16838    }
16839       
16840    // 3'-particle correlators:
16841    //  Taeney-Yan correlator:
16842    Double_t dTaeneyYan = 0.;
16843    Double_t mWeightTaeneyYan = 0.; // multiplicity weight for Taeney-Yan correlator
16844    if((mp*dMult-2.*mq)*(dMult-1.) > 0.) // to be improved - is this condition fully justified?
16845    {
16846     dTaeneyYan = (dReQ3n*(p1n0kRe*dReQ2n-p1n0kIm*dImQ2n)+dImQ3n*(p1n0kIm*dReQ2n+p1n0kRe*dImQ2n)
16847                - p1n0kRe*dReQ1n - p1n0kIm*dImQ1n
16848                - q2n0kRe*dReQ2n - q2n0kIm*dImQ2n              
16849                - q3n0kRe*dReQ3n - q3n0kIm*dImQ3n
16850                + 2.*mq)
16851                / ((mp*dMult-2.*mq)*(dMult-1.));
16852     // determine multiplicity weight:
16853     if(fMultiplicityWeight->Contains("combinations"))
16854     {
16855      mWeightTaeneyYan = (mp*dMult-2.*mq)*(dMult-1.);
16856     } else if(fMultiplicityWeight->Contains("unit"))
16857       {
16858        mWeightTaeneyYan = 1.;    
16859       } 
16860     // Fill profiles:
16861     fOtherDiffCorrelators[t][pe][1][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dTaeneyYan,mWeightTaeneyYan);
16862    } // end of if((mp*dMult-2.*mq)*(dMult-1.) > 0.)  
16863    
16864  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16865  
16866 } // end of void AliFlowAnalysisWithQCumulants::CalculateOtherDiffCorrelators(TString type, TString ptOrEta)
16867
16868 //=======================================================================================================================
16869
16870 void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlowCorrelations(TString type)
16871 {
16872  // Calculate all reduced correlations needed for 2D differential flow for each (pt,eta) bin. 
16873  
16874  // Multiplicity:
16875  Double_t dMult = (*fSpk)(0,0);
16876  // Real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
16877  Double_t dReQ1n = (*fReQ)(0,0);
16878  Double_t dReQ2n = (*fReQ)(1,0);
16879  //Double_t dReQ3n = (*fReQ)(2,0);
16880  //Double_t dReQ4n = (*fReQ)(3,0);
16881  Double_t dImQ1n = (*fImQ)(0,0);
16882  Double_t dImQ2n = (*fImQ)(1,0);
16883  //Double_t dImQ3n = (*fImQ)(2,0);
16884  //Double_t dImQ4n = (*fImQ)(3,0);
16885
16886  // 2D reduced correlations are stored in TProfile2D f2DDiffFlowCorrelationsPro[0=RP,1=POI][correlation index]. 
16887  // Correlation index runs as follows:
16888  //  0: <<2'>> 
16889  //  1: <<4'>>
16890  //  2: <<6'>>
16891  //  3: <<8'>>
16892  
16893  Int_t t = 0; // type flag  
16894  if(type == "RP")
16895  {
16896   t = 0;
16897  } else if(type == "POI")
16898    {
16899     t = 1;
16900    }
16901
16902  // Looping over all (pt,eta) bins and calculating correlations needed for differential flow: 
16903  for(Int_t p=1;p<=fnBinsPt;p++)
16904  {
16905   for(Int_t e=1;e<=fnBinsEta;e++)
16906   {
16907    // Real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular (pt,eta) bin): 
16908    Double_t p1n0kRe = 0.;
16909    Double_t p1n0kIm = 0.;
16910    // Number of POIs in particular pt or eta bin:
16911    Double_t mp = 0.;
16912    // Real and imaginary parts of q_{m*n,0} (non-weighted Q-vector evaluated for 'RP && POI particles' in particular pt or eta bin):
16913    Double_t q1n0kRe = 0.;
16914    Double_t q1n0kIm = 0.;
16915    Double_t q2n0kRe = 0.;
16916    Double_t q2n0kIm = 0.; 
16917    // Number of 'RP && POI particles' in particular pt or eta bin:
16918    Double_t mq = 0.;
16919    if(type == "POI")
16920    {
16921     // q_{m*n,0}:
16922     q1n0kRe = fReRPQ2dEBE[2][0][0]->GetBinContent(fReRPQ2dEBE[2][0][0]->GetBin(p,e))
16923             * fReRPQ2dEBE[2][0][0]->GetBinEntries(fReRPQ2dEBE[2][0][0]->GetBin(p,e));
16924     q1n0kIm = fImRPQ2dEBE[2][0][0]->GetBinContent(fImRPQ2dEBE[2][0][0]->GetBin(p,e))
16925             * fImRPQ2dEBE[2][0][0]->GetBinEntries(fImRPQ2dEBE[2][0][0]->GetBin(p,e));
16926     q2n0kRe = fReRPQ2dEBE[2][1][0]->GetBinContent(fReRPQ2dEBE[2][1][0]->GetBin(p,e))
16927             * fReRPQ2dEBE[2][1][0]->GetBinEntries(fReRPQ2dEBE[2][1][0]->GetBin(p,e));
16928     q2n0kIm = fImRPQ2dEBE[2][1][0]->GetBinContent(fImRPQ2dEBE[2][1][0]->GetBin(p,e))
16929             * fImRPQ2dEBE[2][1][0]->GetBinEntries(fImRPQ2dEBE[2][1][0]->GetBin(p,e));         
16930     // m_{q}:             
16931     mq = fReRPQ2dEBE[2][0][0]->GetBinEntries(fReRPQ2dEBE[2][0][0]->GetBin(p,e)); // to be improved (cross-checked by accessing other profiles here)
16932    } // end of if(type == "POI")
16933    else if(type == "RP")
16934    {
16935     // q_{m*n,0}:
16936     q1n0kRe = fReRPQ2dEBE[0][0][0]->GetBinContent(fReRPQ2dEBE[0][0][0]->GetBin(p,e))
16937             * fReRPQ2dEBE[0][0][0]->GetBinEntries(fReRPQ2dEBE[0][0][0]->GetBin(p,e));
16938     q1n0kIm = fImRPQ2dEBE[0][0][0]->GetBinContent(fImRPQ2dEBE[0][0][0]->GetBin(p,e))
16939             * fImRPQ2dEBE[0][0][0]->GetBinEntries(fImRPQ2dEBE[0][0][0]->GetBin(p,e));
16940     q2n0kRe = fReRPQ2dEBE[0][1][0]->GetBinContent(fReRPQ2dEBE[0][1][0]->GetBin(p,e))
16941             * fReRPQ2dEBE[0][1][0]->GetBinEntries(fReRPQ2dEBE[0][1][0]->GetBin(p,e));
16942     q2n0kIm = fImRPQ2dEBE[0][1][0]->GetBinContent(fImRPQ2dEBE[0][1][0]->GetBin(p,e))
16943             * fImRPQ2dEBE[0][1][0]->GetBinEntries(fImRPQ2dEBE[0][1][0]->GetBin(p,e));         
16944     // m_{q}:             
16945     mq = fReRPQ2dEBE[0][0][0]->GetBinEntries(fReRPQ2dEBE[0][0][0]->GetBin(p,e)); // to be improved (cross-checked by accessing other profiles here)  
16946    } // end of else if(type == "RP")
16947    if(type == "POI")
16948    {
16949     // p_{m*n,0}:
16950     p1n0kRe = fReRPQ2dEBE[1][0][0]->GetBinContent(fReRPQ2dEBE[1][0][0]->GetBin(p,e))
16951             * fReRPQ2dEBE[1][0][0]->GetBinEntries(fReRPQ2dEBE[1][0][0]->GetBin(p,e));
16952     p1n0kIm = fImRPQ2dEBE[1][0][0]->GetBinContent(fImRPQ2dEBE[1][0][0]->GetBin(p,e))  
16953             * fImRPQ2dEBE[1][0][0]->GetBinEntries(fImRPQ2dEBE[1][0][0]->GetBin(p,e));
16954     // m_{p}        
16955     mp = fReRPQ2dEBE[1][0][0]->GetBinEntries(fReRPQ2dEBE[1][0][0]->GetBin(p,e)); // to be improved (cross-checked by accessing other profiles here)
16956     
16957     t = 1; // typeFlag = RP or POI
16958    } // end of if(type == "POI")
16959    else if(type == "RP")
16960    {
16961     // p_{m*n,0} = q_{m*n,0}:
16962     p1n0kRe = q1n0kRe; 
16963     p1n0kIm = q1n0kIm; 
16964     // m_{p} = m_{q}:        
16965     mp = mq; 
16966
16967     t = 0; // typeFlag = RP or POI
16968    } // end of if(type == "RP")
16969
16970    // 2'-particle correlation for particular (pt,eta) bin:
16971    Double_t two1n1nPtEta = 0.;
16972    Double_t mWeight2pPrime = 0.; // multiplicity weight for <2'>
16973    if(mp*dMult-mq)
16974    {
16975     two1n1nPtEta = (p1n0kRe*dReQ1n+p1n0kIm*dImQ1n-mq)
16976                  / (mp*dMult-mq);
16977     // Determine multiplicity weight:
16978     if(fMultiplicityWeight->Contains("combinations"))
16979     {
16980      mWeight2pPrime = mp*dMult-mq;
16981     } else if(fMultiplicityWeight->Contains("unit"))
16982       {
16983        mWeight2pPrime = 1.;    
16984       } 
16985     // Fill 2D profile holding <<2'>>:     
16986     f2DDiffFlowCorrelationsPro[t][0]->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,two1n1nPtEta,mWeight2pPrime);
16987    } // end of if(mp*dMult-mq)
16988    
16989    // 4'-particle correlation:
16990    Double_t four1n1n1n1nPtEta = 0.;
16991    Double_t mWeight4pPrime = 0.; // multiplicity weight for <4'>
16992    if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16993        + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)) // to be improved (introduce a new variable for this expression)
16994    {
16995     four1n1n1n1nPtEta = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)
16996                       - q2n0kRe*(pow(dReQ1n,2.)-pow(dImQ1n,2.))
16997                       - 2.*q2n0kIm*dReQ1n*dImQ1n
16998                       - p1n0kRe*(dReQ1n*dReQ2n+dImQ1n*dImQ2n)
16999                       + p1n0kIm*(dImQ1n*dReQ2n-dReQ1n*dImQ2n)
17000                       - 2.*dMult*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)
17001                       - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*mq                      
17002                       + 6.*(q1n0kRe*dReQ1n+q1n0kIm*dImQ1n)                                            
17003                       + 1.*(q2n0kRe*dReQ2n+q2n0kIm*dImQ2n)                      
17004                       + 2.*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)                       
17005                       + 2.*mq*dMult                      
17006                       - 6.*mq)        
17007                       / ((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
17008                           + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
17009     // Determine multiplicity weight:
17010     if(fMultiplicityWeight->Contains("combinations"))
17011     {
17012      mWeight4pPrime = (mp-mq)*dMult*(dMult-1.)*(dMult-2.) + mq*(dMult-1.)*(dMult-2.)*(dMult-3.);
17013     } else if(fMultiplicityWeight->Contains("unit"))
17014       {
17015        mWeight4pPrime = 1.;    
17016       }     
17017     // Fill 2D profile holding <<4'>>:
17018     f2DDiffFlowCorrelationsPro[t][1]->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,four1n1n1n1nPtEta,mWeight4pPrime);      
17019    } // end of if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
17020      //            +mq*(dMult-1.)*(dMult-2.)*(dMult-3.))
17021   } // end of for(Int_t e=1;e<=fnBinsEta;e++)
17022  } // end of for(Int_t p=1;p<=fnBinsPt;p++)   
17023       
17024 } // end of AliFlowAnalysisWithQCumulants::Calculate2DDiffFlowCorrelations(TString type)
17025
17026 //=======================================================================================================================
17027
17028 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowSumOfEventWeights(TString type, TString ptOrEta)
17029 {
17030  // Calculate sums of various event weights for reduced correlations. 
17031  // (These quantitites are needed in expressions for unbiased estimators relevant for the statistical errors.)
17032
17033  Int_t typeFlag = 0;
17034  Int_t ptEtaFlag = 0;
17035
17036  if(type == "RP")
17037  {
17038   typeFlag = 0;
17039  } else if(type == "POI")
17040    {
17041     typeFlag = 1;
17042    } 
17043      
17044  if(ptOrEta == "Pt")
17045  {
17046   ptEtaFlag = 0;
17047  } else if(ptOrEta == "Eta")
17048    {
17049     ptEtaFlag = 1;
17050    } 
17051    
17052  // shortcuts:
17053  Int_t t = typeFlag;
17054  Int_t pe = ptEtaFlag;
17055  
17056  // binning:
17057  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
17058  Double_t minPtEta[2] = {fPtMin,fEtaMin};
17059  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
17060  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
17061  
17062  for(Int_t rpq=0;rpq<3;rpq++)
17063  {
17064   for(Int_t m=0;m<4;m++)
17065   {
17066    for(Int_t k=0;k<9;k++)
17067    {
17068     if(!fReRPQ1dEBE[rpq][pe][m][k])
17069     {
17070      cout<<"WARNING: fReRPQ1dEBE[rpq][pe][m][k] is NULL in AFAWQC::CSAPOEWFDF() !!!!"<<endl;
17071      cout<<"pe  = "<<pe<<endl;
17072      cout<<"rpq = "<<rpq<<endl;
17073      cout<<"m   = "<<m<<endl;
17074      cout<<"k   = "<<k<<endl;
17075      exit(0); 
17076     }
17077    }
17078   }
17079  }  
17080
17081  // multiplicities:
17082  Double_t dMult = (*fSpk)(0,0); // total event multiplicity
17083  //Double_t mr = 0.; // number of RPs in particular pt or eta bin
17084  Double_t mp = 0.; // number of POIs in particular pt or eta bin 
17085  Double_t mq = 0.; // number of particles which are both RPs and POIs in particular pt or eta bin
17086  
17087  // event weights for reduced correlations:
17088  Double_t dw2 = 0.; // event weight for <2'>
17089  Double_t dw4 = 0.; // event weight for <4'>
17090  //Double_t dw6 = 0.; // event weight for <6'>
17091  //Double_t dw8 = 0.; // event weight for <8'>
17092
17093  // looping over bins:
17094  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17095  {
17096   if(type == "RP")
17097   {
17098    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(b);
17099    mp = mq; // trick to use the very same Eqs. bellow both for RP's and POI's diff. flow
17100   } else if(type == "POI")
17101     {
17102      mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(b);
17103      mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(b);    
17104     }
17105   
17106   // event weight for <2'>:
17107   dw2 = mp*dMult-mq;  
17108   fDiffFlowSumOfEventWeights[t][pe][0][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2);
17109   fDiffFlowSumOfEventWeights[t][pe][1][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw2,2.));
17110   
17111   // event weight for <4'>:
17112   dw4 = (mp-mq)*dMult*(dMult-1.)*(dMult-2.)
17113      + mq*(dMult-1.)*(dMult-2.)*(dMult-3.);  
17114   fDiffFlowSumOfEventWeights[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4);
17115   fDiffFlowSumOfEventWeights[t][pe][1][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw4,2.));
17116   
17117   // event weight for <6'>:
17118   //dw6 = ...;  
17119   //fDiffFlowSumOfEventWeights[t][pe][0][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw6);
17120   //fDiffFlowSumOfEventWeights[t][pe][t][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw6,2.));
17121   
17122   // event weight for <8'>:
17123   //dw8 = ...;  
17124   //fDiffFlowSumOfEventWeights[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw8);
17125   //fDiffFlowSumOfEventWeights[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw8,2.));   
17126  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++) 
17127  
17128 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowSumOfEventWeights()
17129
17130
17131 //=======================================================================================================================
17132
17133
17134 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowSumOfProductOfEventWeights(TString type, TString ptOrEta)
17135 {
17136  // Calculate sum of products of various event weights for both types of correlations (the ones for int. and diff. flow). 
17137  // (These quantitites are needed in expressions for unbiased estimators relevant for the statistical errors.)
17138  //
17139  // Important: To fill fDiffFlowSumOfProductOfEventWeights[][][][] use bellow table (i,j) with following constraints: 
17140  // 1.) i<j  
17141  // 2.) do not store terms which DO NOT include reduced correlations;
17142  // Table:
17143  // [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'>]
17144   
17145  Int_t typeFlag = 0;
17146  Int_t ptEtaFlag = 0;
17147
17148  if(type == "RP")
17149  {
17150   typeFlag = 0;
17151  } else if(type == "POI")
17152    {
17153     typeFlag = 1;
17154    } 
17155      
17156  if(ptOrEta == "Pt")
17157  {
17158   ptEtaFlag = 0;
17159  } else if(ptOrEta == "Eta")
17160    {
17161     ptEtaFlag = 1;
17162    } 
17163      
17164  // shortcuts:
17165  Int_t t = typeFlag;
17166  Int_t pe = ptEtaFlag;
17167   
17168  // binning:
17169  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
17170  Double_t minPtEta[2] = {fPtMin,fEtaMin};
17171  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
17172  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
17173  
17174  // protection:
17175  for(Int_t rpq=0;rpq<3;rpq++)
17176  {
17177   for(Int_t m=0;m<4;m++)
17178   {
17179    for(Int_t k=0;k<9;k++)
17180    {
17181     if(!fReRPQ1dEBE[rpq][pe][m][k])
17182     {
17183      cout<<"WARNING: fReRPQ1dEBE[rpq][pe][m][k] is NULL in AFAWQC::CSAPOEWFDF() !!!!"<<endl;
17184      cout<<"pe  = "<<pe<<endl;
17185      cout<<"rpq = "<<rpq<<endl;
17186      cout<<"m   = "<<m<<endl;
17187      cout<<"k   = "<<k<<endl;
17188      exit(0); 
17189     }
17190    }
17191   }
17192  }  
17193  
17194  // multiplicities:
17195  Double_t dMult = (*fSpk)(0,0); // total event multiplicity
17196  //Double_t mr = 0.; // number of RPs in particular pt or eta bin
17197  Double_t mp = 0.; // number of POIs in particular pt or eta bin 
17198  Double_t mq = 0.; // number of particles which are both RPs and POIs in particular pt or eta bin
17199  
17200  // event weights for correlations:
17201  Double_t dW2 = dMult*(dMult-1); // event weight for <2> 
17202  Double_t dW4 = dMult*(dMult-1)*(dMult-2)*(dMult-3); // event weight for <4> 
17203  Double_t dW6 = dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-4)*(dMult-5); // event weight for <6> 
17204  Double_t dW8 = dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-4)*(dMult-5)*(dMult-6)*(dMult-7); // event weight for <8> 
17205
17206  // event weights for reduced correlations:
17207  Double_t dw2 = 0.; // event weight for <2'>
17208  Double_t dw4 = 0.; // event weight for <4'>
17209  //Double_t dw6 = 0.; // event weight for <6'>
17210  //Double_t dw8 = 0.; // event weight for <8'>
17211  
17212  // looping over bins:
17213  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17214  {
17215   if(type == "RP")
17216   {
17217    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(b);
17218    mp = mq; // trick to use the very same Eqs. bellow both for RP's and POI's diff. flow
17219   } else if(type == "POI")
17220     {
17221      mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(b);
17222      mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(b);    
17223     }
17224   
17225   // event weight for <2'>:
17226   dw2 = mp*dMult-mq;  
17227   fDiffFlowSumOfProductOfEventWeights[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW2*dw2); // storing product of even weights for <2> and <2'>
17228   fDiffFlowSumOfProductOfEventWeights[t][pe][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dW4); // storing product of even weights for <4> and <2'>
17229   fDiffFlowSumOfProductOfEventWeights[t][pe][1][4]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dW6); // storing product of even weights for <6> and <2'>
17230   fDiffFlowSumOfProductOfEventWeights[t][pe][1][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dW8); // storing product of even weights for <8> and <2'>
17231   
17232   // event weight for <4'>:
17233   dw4 = (mp-mq)*dMult*(dMult-1.)*(dMult-2.)
17234      + mq*(dMult-1.)*(dMult-2.)*(dMult-3.);  
17235   fDiffFlowSumOfProductOfEventWeights[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW2*dw4); // storing product of even weights for <2> and <4'>
17236   fDiffFlowSumOfProductOfEventWeights[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dw4); // storing product of even weights for <2'> and <4'>
17237   fDiffFlowSumOfProductOfEventWeights[t][pe][2][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW4*dw4); // storing product of even weights for <4> and <4'>
17238   fDiffFlowSumOfProductOfEventWeights[t][pe][3][4]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4*dW6); // storing product of even weights for <6> and <4'> 
17239   fDiffFlowSumOfProductOfEventWeights[t][pe][3][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4*dW8); // storing product of even weights for <8> and <4'>
17240
17241   // event weight for <6'>:
17242   //dw6 = ...;  
17243   //fDiffFlowSumOfProductOfEventWeights[t][pe][0][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW2*dw6); // storing product of even weights for <2> and <6'>
17244   //fDiffFlowSumOfProductOfEventWeights[t][pe][1][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dw6); // storing product of even weights for <2'> and <6'>
17245   //fDiffFlowSumOfProductOfEventWeights[t][pe][2][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW4*dw6); // storing product of even weights for <4> and <6'>
17246   //fDiffFlowSumOfProductOfEventWeights[t][pe][3][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4*dw6); // storing product of even weights for <4'> and <6'> 
17247   //fDiffFlowSumOfProductOfEventWeights[t][pe][4][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW6*dw6); // storing product of even weights for <6> and <6'>
17248   //fDiffFlowSumOfProductOfEventWeights[t][pe][5][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw6*dW8); // storing product of even weights for <6'> and <8>
17249   //fDiffFlowSumOfProductOfEventWeights[t][pe][5][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw6*dw8); // storing product of even weights for <6'> and <8'>
17250
17251   // event weight for <8'>:
17252   //dw8 = ...;  
17253   //fDiffFlowSumOfProductOfEventWeights[t][pe][0][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW2*dw8); // storing product of even weights for <2> and <8'>
17254   //fDiffFlowSumOfProductOfEventWeights[t][pe][1][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dw8); // storing product of even weights for <2'> and <8'>
17255   //fDiffFlowSumOfProductOfEventWeights[t][pe][2][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW4*dw8); // storing product of even weights for <4> and <8'>
17256   //fDiffFlowSumOfProductOfEventWeights[t][pe][3][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4*dw8); // storing product of even weights for <4'> and <8'> 
17257   //fDiffFlowSumOfProductOfEventWeights[t][pe][4][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW6*dw8); // storing product of even weights for <6> and <8'>
17258   //fDiffFlowSumOfProductOfEventWeights[t][pe][5][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw6*dw8); // storing product of even weights for <6'> and <8'>
17259   //fDiffFlowSumOfProductOfEventWeights[t][pe][6][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW8*dw8); // storing product of even weights for <8> and <8'>
17260   
17261   // Table:
17262   // [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'>]
17263    
17264  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17265  
17266
17267
17268 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowSumOfProductOfEventWeights(TString type, TString ptOrEta)
17269
17270 //=======================================================================================================================
17271
17272 void AliFlowAnalysisWithQCumulants::FinalizeReducedCorrelations(TString type, TString ptOrEta)
17273 {
17274  // Transfer profiles into histograms and calculate statistical errors correctly.
17275
17276  Int_t t = 0; // RP or POI
17277  Int_t pe = 0; // pt or eta
17278
17279  if(type == "RP")
17280  {
17281   t = 0;
17282  } else if(type == "POI")
17283    {
17284     t = 1;
17285    } 
17286      
17287  if(ptOrEta == "Pt")
17288  {
17289   pe = 0;
17290  } else if(ptOrEta == "Eta")
17291    {
17292     pe = 1;
17293    } 
17294                
17295  for(Int_t rci=0;rci<4;rci++) // to be improved - moved into the method CheckPointersUsedInFinish()
17296  {
17297   if(!fDiffFlowCorrelationsPro[t][pe][rci])
17298   {
17299    cout<<"WARNING: fDiffFlowCorrelationsPro[t][pe][rci] is NULL in AFAWQC::FRC() !!!!"<<endl;
17300    cout<<"t   = "<<t<<endl; 
17301    cout<<"pe  = "<<pe<<endl; 
17302    cout<<"rci = "<<rci<<endl;
17303    exit(0); 
17304   }
17305   if(!fDiffFlowSquaredCorrelationsPro[t][pe][rci])
17306   {
17307    cout<<"WARNING: fDiffFlowSquaredCorrelationsPro[t][pe][rci] is NULL in AFAWQC::FRC() !!!!"<<endl;
17308    cout<<"t   = "<<t<<endl; 
17309    cout<<"pe  = "<<pe<<endl; 
17310    cout<<"rci = "<<rci<<endl;
17311    exit(0); 
17312   }
17313   for(Int_t power=0;power<2;power++)
17314   {
17315    if(!fDiffFlowSumOfEventWeights[t][pe][power][rci])
17316    {
17317     cout<<"WARNING: fDiffFlowSumOfEventWeights[t][pe][power][rci] is NULL in AFAWQC::FRC() !!!!"<<endl;
17318     cout<<"t     = "<<t<<endl; 
17319     cout<<"pe    = "<<pe<<endl;
17320     cout<<"power = "<<power<<endl; 
17321     cout<<"rci   = "<<rci<<endl;
17322     exit(0); 
17323    }   
17324   } // end of for(Int_t power=0;power<2;power++)
17325  } // end of for(Int_t rci=0;rci<4;rci++)
17326     
17327  // common:
17328  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta}; 
17329  // transfer 1D profile into 1D histogram:
17330  Double_t correlation = 0.;
17331  Double_t squaredCorrelation = 0.;
17332  Double_t spread = 0.;
17333  Double_t sumOfWeights = 0.; // sum of weights for particular reduced correlations for particular pt or eta bin
17334  Double_t sumOfSquaredWeights = 0.; // sum of squared weights for particular reduced correlations for particular pt or eta bin
17335  Double_t error = 0.; // error = termA * spread * termB
17336                       // termA = (sqrt(sumOfSquaredWeights)/sumOfWeights) 
17337                       // termB = 1/pow(1-termA^2,0.5)
17338  Double_t termA = 0.;                      
17339  Double_t termB = 0.;                      
17340  for(Int_t rci=0;rci<4;rci++) // index of reduced correlation
17341  {
17342   for(Int_t b=1;b<=nBinsPtEta[pe];b++) // number of pt or eta bins
17343   {
17344    if(fDiffFlowCorrelationsPro[t][pe][rci]->GetBinEffectiveEntries(b) < 2 || 
17345       fDiffFlowSquaredCorrelationsPro[t][pe][rci]->GetBinEffectiveEntries(b) < 2)
17346    {
17347     fDiffFlowCorrelationsPro[t][pe][rci]->SetBinError(b,0.);
17348     fDiffFlowSquaredCorrelationsPro[t][pe][rci]->SetBinError(b,0.);
17349     continue; // to be improved - should I ignore results in pt bins with one entry for reduced correlations or not?
17350    }  
17351    correlation = fDiffFlowCorrelationsPro[t][pe][rci]->GetBinContent(b); 
17352    squaredCorrelation = fDiffFlowSquaredCorrelationsPro[t][pe][rci]->GetBinContent(b); 
17353    if(squaredCorrelation-correlation*correlation >= 0.)
17354    {
17355     spread = pow(squaredCorrelation-correlation*correlation,0.5);
17356    } else
17357      {
17358       cout<<endl;
17359       cout<<Form(" WARNING: Imaginary 'spread' for rci = %d, pe = %d, bin = %d !!!!",rci,pe,b)<<endl;
17360       cout<<endl;
17361      }
17362    sumOfWeights = fDiffFlowSumOfEventWeights[t][pe][0][rci]->GetBinContent(b);
17363    sumOfSquaredWeights = fDiffFlowSumOfEventWeights[t][pe][1][rci]->GetBinContent(b);
17364    if(TMath::Abs(sumOfWeights)>0.){termA = (pow(sumOfSquaredWeights,0.5)/sumOfWeights);}
17365    if(1.-pow(termA,2.)>0.){termB = 1./pow(1.-pow(termA,2.),0.5);} 
17366    error = termA*spread*termB; // final error (unbiased estimator for standard deviation)
17367    fDiffFlowCorrelationsHist[t][pe][rci]->SetBinContent(b,correlation); 
17368    fDiffFlowCorrelationsHist[t][pe][rci]->SetBinError(b,error); 
17369   } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17370  } // end of for(Int_t rci=0;rci<4;rci++)
17371  
17372 } // end of void AliFlowAnalysisWithQCumulants::FinalizeReducedCorrelations(TString type, TString ptOrEta)
17373
17374 //=======================================================================================================================
17375
17376 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowProductOfCorrelations(TString type, TString ptOrEta)
17377 {
17378  // store products: <2><2'>, <2><4'>, <2><6'>, <2><8'>, <2'><4>, 
17379  //                 <2'><4'>, <2'><6>, <2'><6'>, <2'><8>, <2'><8'>,
17380  //                 <4><4'>, <4><6'>, <4><8'>, <4'><6>, <4'><6'>, 
17381  //                 <4'><8>, <4'><8'>, <6><6'>, <6><8'>, <6'><8>, 
17382  //                 <6'><8'>, <8><8'>.
17383   
17384  Int_t typeFlag = 0;
17385  Int_t ptEtaFlag = 0;
17386
17387  if(type == "RP")
17388  {
17389   typeFlag = 0;
17390  } else if(type == "POI")
17391    {
17392     typeFlag = 1;
17393    } 
17394      
17395  if(ptOrEta == "Pt")
17396  {
17397   ptEtaFlag = 0;
17398  } else if(ptOrEta == "Eta")
17399    {
17400     ptEtaFlag = 1;
17401    } 
17402   
17403  // shortcuts:
17404  Int_t t = typeFlag;
17405  Int_t pe = ptEtaFlag;
17406      
17407  // common:
17408  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
17409  Double_t minPtEta[2] = {fPtMin,fEtaMin};
17410  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
17411    
17412  // protections // to be improved (add protection for all pointers in this method)
17413  if(!fIntFlowCorrelationsEBE)
17414  {
17415   cout<<"WARNING: fIntFlowCorrelationsEBE is NULL in AFAWQC::CDFPOC() !!!!"<<endl;
17416   exit(0);
17417  } 
17418  
17419  /*    
17420  Double_t dMult = (*fSpk)(0,0); // multiplicity (number of particles used to determine the reaction plane)
17421  //Double_t mr = 0.; // number of RPs in particular pt or eta bin
17422  Double_t mp = 0.; // number of POIs in particular pt or eta bin 
17423  Double_t mq = 0.; // number of particles which are both RPs and POIs in particular pt or eta bin
17424  */
17425
17426  // e-b-e correlations:
17427  Double_t twoEBE = fIntFlowCorrelationsEBE->GetBinContent(1); // <2>
17428  Double_t fourEBE = fIntFlowCorrelationsEBE->GetBinContent(2); // <4>
17429  Double_t sixEBE = fIntFlowCorrelationsEBE->GetBinContent(3); // <6>
17430  Double_t eightEBE = fIntFlowCorrelationsEBE->GetBinContent(4); // <8>
17431  
17432  // event weights for correlations:
17433  Double_t dW2 = fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1); // event weight for <2> 
17434  Double_t dW4 = fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2); // event weight for <4> 
17435  Double_t dW6 = fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(3); // event weight for <6> 
17436  Double_t dW8 = fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(4); // event weight for <8> 
17437   
17438  // e-b-e reduced correlations:
17439  Double_t twoReducedEBE = 0.; // <2'>
17440  Double_t fourReducedEBE = 0.; // <4'>
17441  //Double_t sixReducedEBE = 0.; // <6'>
17442  //Double_t eightReducedEBE = 0.; // <8'> 
17443  
17444  // event weights for reduced correlations:
17445  Double_t dw2 = 0.; // event weight for <2'>
17446  Double_t dw4 = 0.; // event weight for <4'>
17447  //Double_t dw6 = 0.; // event weight for <6'>
17448  //Double_t dw8 = 0.; // event weight for <8'>
17449
17450  // looping over bins:
17451  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17452  {
17453   // e-b-e reduced correlations:
17454   twoReducedEBE = fDiffFlowCorrelationsEBE[t][pe][0]->GetBinContent(b);
17455   fourReducedEBE = fDiffFlowCorrelationsEBE[t][pe][1]->GetBinContent(b);
17456   //sixReducedEBE = fDiffFlowCorrelationsEBE[t][pe][2]->GetBinContent(b);
17457   //eightReducedEBE = fDiffFlowCorrelationsEBE[t][pe][3]->GetBinContent(b);
17458   
17459   /*
17460   // to be improved (I should not do this here again)
17461   if(type == "RP")
17462   {
17463    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(b);
17464    mp = mq; // trick to use the very same Eqs. bellow both for RP's and POI's diff. flow
17465   } else if(type == "POI")
17466     {
17467      mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(b);
17468      mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(b);    
17469     }
17470   
17471   // event weights for reduced correlations:
17472   dw2 = mp*dMult-mq; // weight for <2'> 
17473   dw4 = (mp-mq)*dMult*(dMult-1.)*(dMult-2.)
17474      + mq*(dMult-1.)*(dMult-2.)*(dMult-3.); // weight for <4'>
17475   //dw6 = ...     
17476   //dw8 = ...     
17477   
17478   */
17479   
17480   dw2 = fDiffFlowEventWeightsForCorrelationsEBE[t][pe][0]->GetBinContent(b);
17481   dw4 = fDiffFlowEventWeightsForCorrelationsEBE[t][pe][1]->GetBinContent(b);
17482  
17483   // storing all products:
17484   fDiffFlowProductOfCorrelationsPro[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoEBE*twoReducedEBE,dW2*dw2); // storing <2><2'>
17485   fDiffFlowProductOfCorrelationsPro[t][pe][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourEBE*twoReducedEBE,dW4*dw2); // storing <4><2'>
17486   fDiffFlowProductOfCorrelationsPro[t][pe][1][4]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixEBE*twoReducedEBE,dW6*dw2); // storing <6><2'>
17487   fDiffFlowProductOfCorrelationsPro[t][pe][1][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],eightEBE*twoReducedEBE,dW8*dw2); // storing <8><2'>
17488   
17489   // event weight for <4'>:
17490   fDiffFlowProductOfCorrelationsPro[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoEBE*fourReducedEBE,dW2*dw4); // storing <2><4'>
17491   fDiffFlowProductOfCorrelationsPro[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoReducedEBE*fourReducedEBE,dw2*dw4); // storing <2'><4'>
17492   fDiffFlowProductOfCorrelationsPro[t][pe][2][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourEBE*fourReducedEBE,dW4*dw4); // storing <4><4'>
17493   fDiffFlowProductOfCorrelationsPro[t][pe][3][4]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixEBE*fourReducedEBE,dW6*dw4); // storing <6><4'> 
17494   fDiffFlowProductOfCorrelationsPro[t][pe][3][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],eightEBE*fourReducedEBE,dW8*dw4); // storing <8><4'>
17495
17496   // event weight for <6'>:
17497   //dw6 = ...;  
17498   //fDiffFlowProductOfCorrelationsPro[t][pe][0][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoEBE*sixReducedEBE,dW2*dw6); // storing <2><6'>
17499   //fDiffFlowProductOfCorrelationsPro[t][pe][1][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoReducedEBE*sixReducedEBE,dw2*dw6); // storing <2'><6'>
17500   //fDiffFlowProductOfCorrelationsPro[t][pe][2][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourEBE*sixReducedEBE,dW4*dw6); // storing <4><6'>
17501   //fDiffFlowProductOfCorrelationsPro[t][pe][3][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourReducedEBE*sixReducedEBE,dw4*dw6); // storing <4'><6'> 
17502   //fDiffFlowProductOfCorrelationsPro[t][pe][4][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixEBE*sixReducedEBE,dW6*dw6); // storing <6><6'>
17503   //fDiffFlowProductOfCorrelationsPro[t][pe][5][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixReducedEBE*eightEBE,dw6*dW8); // storing <6'><8>
17504   //fDiffFlowProductOfCorrelationsPro[t][pe][5][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixReducedEBE*eightReducedEBE,dw6*dw8); // storing <6'><8'>
17505
17506   // event weight for <8'>:
17507   //dw8 = ...;  
17508   //fDiffFlowProductOfCorrelationsPro[t][pe][0][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoEBE*eightReducedEBE,dW2*dw8); // storing <2><8'>
17509   //fDiffFlowProductOfCorrelationsPro[t][pe][1][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoReducedEBE*eightReducedEBE,dw2*dw8); // storing <2'><8'>
17510   //fDiffFlowProductOfCorrelationsPro[t][pe][2][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourEBE*eightReducedEBE,dW4*dw8); // storing <4><8'>
17511   //fDiffFlowProductOfCorrelationsPro[t][pe][3][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourReducedEBE*eightReducedEBE,dw4*dw8); // storing <4'><8'> 
17512   //fDiffFlowProductOfCorrelationsPro[t][pe][4][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixEBE*eightReducedEBE,dW6*dw8); // storing <6><8'>
17513   //fDiffFlowProductOfCorrelationsPro[t][pe][5][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixReducedEBE*eightReducedEBE,dw6*dw8); // storing <6'><8'>
17514   //fDiffFlowProductOfCorrelationsPro[t][pe][6][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],eightEBE*eightReducedEBE,dW8*dw8); // storing <8><8'> 
17515  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++       
17516      
17517 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowProductOfCorrelations(TString type, TString ptOrEta)
17518
17519 //=======================================================================================================================
17520     
17521 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCovariances(TString type, TString ptOrEta) // to be improved (reimplemented)
17522 {
17523  // a) Calculate unbiased estimators Cov(<2>,<2'>), Cov(<2>,<4'>), Cov(<4>,<2'>), Cov(<4>,<4'>) and Cov(<2'>,<4'>)
17524  //    for covariances V(<2>,<2'>), V(<2>,<4'>), V(<4>,<2'>), V(<4>,<4'>) and V(<2'>,<4'>).  
17525  // b) Store in histogram fDiffFlowCovariances[t][pe][index] for instance the following: 
17526  //
17527  //             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)]
17528  // 
17529  //     where N is the number of events, w_{<2>} is event weight for <2> and w_{<2'>} is event weight for <2'>.
17530  // c) Binning of fDiffFlowCovariances[t][pe][index] is organized as follows:
17531  // 
17532  //     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)] 
17533  //     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)] 
17534  //     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)] 
17535  //     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)] 
17536  //     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)] 
17537  //     ...
17538   
17539  Int_t typeFlag = 0;
17540  Int_t ptEtaFlag = 0;
17541
17542  if(type == "RP")
17543  {
17544   typeFlag = 0;
17545  } else if(type == "POI")
17546    {
17547     typeFlag = 1;
17548    } 
17549      
17550  if(ptOrEta == "Pt")
17551  {
17552   ptEtaFlag = 0;
17553  } else if(ptOrEta == "Eta")
17554    {
17555     ptEtaFlag = 1;
17556    } 
17557   
17558  // shortcuts:
17559  Int_t t = typeFlag;
17560  Int_t pe = ptEtaFlag;
17561      
17562  // common:
17563  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
17564  //Double_t minPtEta[2] = {fPtMin,fEtaMin};
17565  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
17566  //Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
17567  
17568  // average correlations:
17569  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>>
17570  Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>>
17571  //Double_t six = fIntFlowCorrelationsHist->GetBinContent(3); // <<6>>
17572  //Double_t eight = fIntFlowCorrelationsHist->GetBinContent(4); // <<8>>
17573  
17574  // sum of weights for correlation:
17575  Double_t sumOfWeightsForTwo = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // sum_{i=1}^{N} w_{<2>}
17576  Double_t sumOfWeightsForFour = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // sum_{i=1}^{N} w_{<4>}
17577  //Double_t sumOfWeightsForSix = fIntFlowSumOfEventWeights[0]->GetBinContent(3); // sum_{i=1}^{N} w_{<6>}
17578  //Double_t sumOfWeightsForEight = fIntFlowSumOfEventWeights[0]->GetBinContent(4); // sum_{i=1}^{N} w_{<8>}
17579  
17580  // average reduced correlations:
17581  Double_t twoReduced = 0.; // <<2'>> 
17582  Double_t fourReduced = 0.; // <<4'>>
17583  //Double_t sixReduced = 0.; // <<6'>>
17584  //Double_t eightReduced = 0.; // <<8'>>
17585
17586  // sum of weights for reduced correlation:
17587  Double_t sumOfWeightsForTwoReduced = 0.; // sum_{i=1}^{N} w_{<2'>}
17588  Double_t sumOfWeightsForFourReduced = 0.; // sum_{i=1}^{N} w_{<4'>}
17589  //Double_t sumOfWeightsForSixReduced = 0.; // sum_{i=1}^{N} w_{<6'>}
17590  //Double_t sumOfWeightsForEightReduced = 0.; // sum_{i=1}^{N} w_{<8'>}
17591   
17592  // product of weights for reduced correlation:
17593  Double_t productOfWeightsForTwoTwoReduced = 0.; // sum_{i=1}^{N} w_{<2>}w_{<2'>}
17594  Double_t productOfWeightsForTwoFourReduced = 0.; // sum_{i=1}^{N} w_{<2>}w_{<4'>}
17595  Double_t productOfWeightsForFourTwoReduced = 0.; // sum_{i=1}^{N} w_{<4>}w_{<2'>}
17596  Double_t productOfWeightsForFourFourReduced = 0.; // sum_{i=1}^{N} w_{<4>}w_{<4'>}
17597  Double_t productOfWeightsForTwoReducedFourReduced = 0.; // sum_{i=1}^{N} w_{<2'>}w_{<4'>}
17598  // ...
17599  
17600  // products for differential flow:
17601  Double_t twoTwoReduced = 0; // <<2><2'>> 
17602  Double_t twoFourReduced = 0; // <<2><4'>> 
17603  Double_t fourTwoReduced = 0; // <<4><2'>> 
17604  Double_t fourFourReduced = 0; // <<4><4'>> 
17605  Double_t twoReducedFourReduced = 0; // <<2'><4'>> 
17606
17607  // denominators in the expressions for the unbiased estimators for covariances:
17608  // denominator = 1 - term1/(term2*term3)
17609  // prefactor = term1/(term2*term3)
17610  Double_t denominator = 0.; 
17611  Double_t prefactor = 0.;
17612  Double_t term1 = 0.; 
17613  Double_t term2 = 0.; 
17614  Double_t term3 = 0.; 
17615  
17616  // unbiased estimators for covariances for differential flow:
17617  Double_t covTwoTwoReduced = 0.; // Cov(<2>,<2'>)
17618  Double_t wCovTwoTwoReduced = 0.; // Cov(<2>,<2'>) * prefactor(w_{<2>},w_{<2'>})
17619  Double_t covTwoFourReduced = 0.; // Cov(<2>,<4'>)
17620  Double_t wCovTwoFourReduced = 0.; // Cov(<2>,<4'>) * prefactor(w_{<2>},w_{<4'>})
17621  Double_t covFourTwoReduced = 0.; // Cov(<4>,<2'>)
17622  Double_t wCovFourTwoReduced = 0.; // Cov(<4>,<2'>) * prefactor(w_{<4>},w_{<2'>})
17623  Double_t covFourFourReduced = 0.; // Cov(<4>,<4'>)
17624  Double_t wCovFourFourReduced = 0.; // Cov(<4>,<4'>) * prefactor(w_{<4>},w_{<4'>})
17625  Double_t covTwoReducedFourReduced = 0.; // Cov(<2'>,<4'>)
17626  Double_t wCovTwoReducedFourReduced = 0.; // Cov(<2'>,<4'>) * prefactor(w_{<2'>},w_{<4'>})
17627  
17628  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17629  {
17630   // average reduced corelations:
17631   twoReduced = fDiffFlowCorrelationsHist[t][pe][0]->GetBinContent(b);
17632   fourReduced = fDiffFlowCorrelationsHist[t][pe][1]->GetBinContent(b);
17633   // average products:
17634   twoTwoReduced = fDiffFlowProductOfCorrelationsPro[t][pe][0][1]->GetBinContent(b);
17635   twoFourReduced = fDiffFlowProductOfCorrelationsPro[t][pe][0][3]->GetBinContent(b);
17636   fourTwoReduced = fDiffFlowProductOfCorrelationsPro[t][pe][1][2]->GetBinContent(b);
17637   fourFourReduced = fDiffFlowProductOfCorrelationsPro[t][pe][2][3]->GetBinContent(b);
17638   twoReducedFourReduced = fDiffFlowProductOfCorrelationsPro[t][pe][1][3]->GetBinContent(b);  
17639   // sum of weights for reduced correlations:
17640   sumOfWeightsForTwoReduced = fDiffFlowSumOfEventWeights[t][pe][0][0]->GetBinContent(b);
17641   sumOfWeightsForFourReduced = fDiffFlowSumOfEventWeights[t][pe][0][1]->GetBinContent(b);
17642   // products of weights for correlations:
17643   productOfWeightsForTwoTwoReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][0][1]->GetBinContent(b); 
17644   productOfWeightsForTwoFourReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][0][3]->GetBinContent(b);
17645   productOfWeightsForFourTwoReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][1][2]->GetBinContent(b);
17646   productOfWeightsForFourFourReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][2][3]->GetBinContent(b);
17647   productOfWeightsForTwoReducedFourReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][1][3]->GetBinContent(b);
17648   // denominator for the unbiased estimator for covariances: 1 - term1/(term2*term3) 
17649   // prefactor (multiplies Cov's) = term1/(term2*term3)       
17650   // <2>,<2'>:
17651   term1 = productOfWeightsForTwoTwoReduced;      
17652   term2 = sumOfWeightsForTwo;
17653   term3 = sumOfWeightsForTwoReduced;        
17654   if(term2*term3>0.)
17655   {
17656    denominator = 1.-term1/(term2*term3);
17657    prefactor = term1/(term2*term3);
17658    if(TMath::Abs(denominator)>1.e-6)
17659    {
17660     covTwoTwoReduced = (twoTwoReduced-two*twoReduced)/denominator;            
17661     wCovTwoTwoReduced = covTwoTwoReduced*prefactor; 
17662     fDiffFlowCovariances[t][pe][0]->SetBinContent(b,wCovTwoTwoReduced);
17663    }
17664   }
17665   // <2>,<4'>:
17666   term1 = productOfWeightsForTwoFourReduced;      
17667   term2 = sumOfWeightsForTwo;
17668   term3 = sumOfWeightsForFourReduced;        
17669   if(term2*term3>0.)
17670   {
17671    denominator = 1.-term1/(term2*term3);
17672    prefactor = term1/(term2*term3);
17673    if(TMath::Abs(denominator)>1.e-6)
17674    {
17675     covTwoFourReduced = (twoFourReduced-two*fourReduced)/denominator;            
17676     wCovTwoFourReduced = covTwoFourReduced*prefactor; 
17677     fDiffFlowCovariances[t][pe][1]->SetBinContent(b,wCovTwoFourReduced);
17678    }
17679   }
17680   // <4>,<2'>:
17681   term1 = productOfWeightsForFourTwoReduced;      
17682   term2 = sumOfWeightsForFour;
17683   term3 = sumOfWeightsForTwoReduced;        
17684   if(term2*term3>0.)
17685   {
17686    denominator = 1.-term1/(term2*term3);
17687    prefactor = term1/(term2*term3);
17688    if(TMath::Abs(denominator)>1.e-6)
17689    {
17690     covFourTwoReduced = (fourTwoReduced-four*twoReduced)/denominator;            
17691     wCovFourTwoReduced = covFourTwoReduced*prefactor; 
17692     fDiffFlowCovariances[t][pe][2]->SetBinContent(b,wCovFourTwoReduced);
17693    }
17694   }
17695   // <4>,<4'>:
17696   term1 = productOfWeightsForFourFourReduced;      
17697   term2 = sumOfWeightsForFour;
17698   term3 = sumOfWeightsForFourReduced;        
17699   if(term2*term3>0.)
17700   {
17701    denominator = 1.-term1/(term2*term3);
17702    prefactor = term1/(term2*term3);
17703    if(TMath::Abs(denominator)>1.e-6)
17704    {
17705     covFourFourReduced = (fourFourReduced-four*fourReduced)/denominator;            
17706     wCovFourFourReduced = covFourFourReduced*prefactor; 
17707     fDiffFlowCovariances[t][pe][3]->SetBinContent(b,wCovFourFourReduced);
17708    }
17709   }
17710   // <2'>,<4'>:
17711   term1 = productOfWeightsForTwoReducedFourReduced;      
17712   term2 = sumOfWeightsForTwoReduced;
17713   term3 = sumOfWeightsForFourReduced;        
17714   if(term2*term3>0.)
17715   {
17716    denominator = 1.-term1/(term2*term3);
17717    prefactor = term1/(term2*term3);
17718    if(TMath::Abs(denominator)>1.e-6)
17719    {
17720     covTwoReducedFourReduced = (twoReducedFourReduced-twoReduced*fourReduced)/denominator;            
17721     wCovTwoReducedFourReduced = covTwoReducedFourReduced*prefactor; 
17722     fDiffFlowCovariances[t][pe][4]->SetBinContent(b,wCovTwoReducedFourReduced);
17723    }
17724   }   
17725  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17726   
17727 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCovariances(TString type, TString ptOrEta)
17728
17729 //=======================================================================================================================
17730
17731 void AliFlowAnalysisWithQCumulants::CalculateDiffFlow(TString type, TString ptOrEta)
17732 {
17733  // Calculate final results for differential flow.
17734  
17735  // REMARK: Differential flow calculated in this method is NOT corrected for non-uniform acceptance. 
17736  // This correction, if enabled via setter SetApplyCorrectionForNUA(Bool_t), is applied in the method 
17737  // CalculateDiffFlowCorrectedForNUA(TString type, TString ptOrEta)
17738   
17739  Int_t t = 0; // RP or POI
17740  Int_t pe = 0; // pt or eta
17741
17742  if(type == "RP")
17743  {
17744   t = 0;
17745  } else if(type == "POI")
17746    {
17747     t = 1;
17748    } 
17749      
17750  if(ptOrEta == "Pt")
17751  {
17752   pe = 0;
17753  } else if(ptOrEta == "Eta")
17754    {
17755     pe = 1;
17756    } 
17757        
17758  // Common:
17759  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
17760  // Correlations:
17761  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>>
17762  Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>> 
17763  // Statistical errors of correlations:
17764  Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1);
17765  Double_t fourError = fIntFlowCorrelationsHist->GetBinError(2);   
17766  // Reduced correlations:
17767  Double_t twoReduced = 0.; // <<2'>>
17768  Double_t fourReduced = 0.; // <<4'>>
17769  // Statistical errors of reduced correlations:
17770  Double_t twoReducedError = 0.; 
17771  Double_t fourReducedError = 0.; 
17772  // Covariances:
17773  Double_t wCovTwoFour = 0.; // Cov(<2>,<4>) * prefactor(<2>,<4>)
17774  if(!fForgetAboutCovariances)
17775  {
17776   wCovTwoFour = fIntFlowCovariances->GetBinContent(1); // Cov(<2>,<4>) * prefactor(<2>,<4>)
17777  }
17778  Double_t wCovTwoTwoReduced = 0.; // Cov(<2>,<2'>) * prefactor(<2>,<2'>)
17779  Double_t wCovTwoFourReduced = 0.; // Cov(<2>,<4'>) * prefactor(<2>,<4'>)
17780  Double_t wCovFourTwoReduced = 0.; // Cov(<4>,<2'>) * prefactor(<4>,<2'>)
17781  Double_t wCovFourFourReduced = 0.; // Cov(<4>,<4'>) * prefactor(<4>,<4'>)
17782  Double_t wCovTwoReducedFourReduced = 0.; // Cov(<2'>,<4'>) * prefactor(<2'>,<4'>)
17783  // Differential flow:
17784  Double_t v2Prime = 0.; // v'{2}                   
17785  Double_t v4Prime = 0.; // v'{4}
17786  // Statistical error of differential flow:
17787  Double_t v2PrimeError = 0.;                    
17788  Double_t v4PrimeError = 0.; 
17789  // Squared statistical error of differential flow:
17790  Double_t v2PrimeErrorSquared = 0.;                    
17791  Double_t v4PrimeErrorSquared = 0.; 
17792  // Loop over pt or eta bins:
17793  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17794  {
17795   // Reduced correlations and statistical errors:
17796   twoReduced = fDiffFlowCorrelationsHist[t][pe][0]->GetBinContent(b);
17797   twoReducedError = fDiffFlowCorrelationsHist[t][pe][0]->GetBinError(b);
17798   fourReduced = fDiffFlowCorrelationsHist[t][pe][1]->GetBinContent(b);
17799   fourReducedError = fDiffFlowCorrelationsHist[t][pe][1]->GetBinError(b);
17800   // Covariances:
17801   if(!fForgetAboutCovariances)
17802   {
17803    wCovTwoTwoReduced = fDiffFlowCovariances[t][pe][0]->GetBinContent(b);
17804    wCovTwoFourReduced = fDiffFlowCovariances[t][pe][1]->GetBinContent(b);
17805    wCovFourTwoReduced = fDiffFlowCovariances[t][pe][2]->GetBinContent(b);
17806    wCovFourFourReduced = fDiffFlowCovariances[t][pe][3]->GetBinContent(b);
17807    wCovTwoReducedFourReduced = fDiffFlowCovariances[t][pe][4]->GetBinContent(b);
17808   }
17809   // Differential flow:
17810   // v'{2}:
17811   if(two>0.) 
17812   {
17813    v2Prime = twoReduced/pow(two,0.5);
17814    v2PrimeErrorSquared = (1./4.)*pow(two,-3.)*(pow(twoReduced,2.)*pow(twoError,2.)
17815                        + 4.*pow(two,2.)*pow(twoReducedError,2.)
17816                        - 4.*two*twoReduced*wCovTwoTwoReduced);
17817    if(v2PrimeErrorSquared>0.){v2PrimeError = pow(v2PrimeErrorSquared,0.5);}
17818    if(TMath::Abs(v2Prime)>0.)
17819    {
17820     fDiffFlow[t][pe][0]->SetBinContent(b,v2Prime); 
17821     fDiffFlow[t][pe][0]->SetBinError(b,v2PrimeError);    
17822    }  
17823   } // end of if(two>0.) 
17824   // differential flow:
17825   // v'{4}
17826   if(2.*pow(two,2.)-four > 0.) 
17827   {
17828    v4Prime = (2.*two*twoReduced-fourReduced)/pow(2.*pow(two,2.)-four,3./4.);
17829    v4PrimeErrorSquared = pow(2.*pow(two,2.)-four,-7./2.)
17830                        * (pow(2.*pow(two,2.)*twoReduced-3.*two*fourReduced+2.*four*twoReduced,2.)*pow(twoError,2.)
17831                        + (9./16.)*pow(2.*two*twoReduced-fourReduced,2.)*pow(fourError,2.)
17832                        + 4.*pow(two,2.)*pow(2.*pow(two,2.)-four,2.)*pow(twoReducedError,2.)
17833                        + pow(2.*pow(two,2.)-four,2.)*pow(fourReducedError,2.)                          
17834                        - (3./2.)*(2.*two*twoReduced-fourReduced)
17835                        * (2.*pow(two,2.)*twoReduced-3.*two*fourReduced+2.*four*twoReduced)*wCovTwoFour
17836                        - 4.*two*(2.*pow(two,2.)-four)
17837                        * (2.*pow(two,2.)*twoReduced-3.*two*fourReduced+2.*four*twoReduced)*wCovTwoTwoReduced
17838                        + 2.*(2.*pow(two,2.)-four)
17839                        * (2.*pow(two,2.)*twoReduced-3.*two*fourReduced+2.*four*twoReduced)*wCovTwoFourReduced
17840                        + 3.*two*(2.*pow(two,2.)-four)*(2.*two*twoReduced-fourReduced)*wCovFourTwoReduced
17841                        - (3./2.)*(2.*pow(two,2.)-four)*(2.*two*twoReduced-fourReduced)*wCovFourFourReduced 
17842                        - 4.*two*pow(2.*pow(two,2.)-four,2.)*wCovTwoReducedFourReduced);  
17843    if(v4PrimeErrorSquared>0.){v4PrimeError = pow(v4PrimeErrorSquared,0.5);}        
17844    if(TMath::Abs(v4Prime)>0.)
17845    {
17846     fDiffFlow[t][pe][1]->SetBinContent(b,v4Prime);
17847     fDiffFlow[t][pe][1]->SetBinError(b,v4PrimeError);     
17848    }
17849   } // end of if(2.*pow(two,2.)-four > 0.)  
17850  } // end of for(Int_t b=1;b<=fnBinsPtEta[pe];b++)
17851
17852 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlow(TString type, Bool_t useParticleWeights)
17853
17854 //=======================================================================================================================
17855
17856 void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlow(TString type)
17857 {
17858  // Calculate final results for 2D diferential flow.
17859
17860  // to be improved - check pointers used in this method
17861
17862  Int_t t = 0; // RP or POI
17863
17864  if(type == "RP")
17865  {
17866   t = 0;
17867  } else if(type == "POI")
17868    {
17869     t = 1;
17870    } 
17871  
17872  // Differential flow:
17873  Double_t v2Prime = 0.; // v'{2}                   
17874  Double_t v4Prime = 0.; // v'{4}
17875  // Differential cumulants:
17876  Double_t qc2Prime = 0.; // QC{2'}                   
17877  Double_t qc4Prime = 0.; // QC{4'}
17878  // Looping over all (pt,eta) bins and calculating differential flow: 
17879  for(Int_t p=1;p<=fnBinsPt;p++)
17880  {
17881   for(Int_t e=1;e<=fnBinsEta;e++)
17882   {
17883    // QC{2'}:
17884    qc2Prime = f2DDiffFlowCumulants[t][0]->GetBinContent(f2DDiffFlowCumulants[t][0]->GetBin(p,e));
17885    if(qc2Prime>=0.)
17886    {
17887     v2Prime = pow(qc2Prime,0.5);
17888     f2DDiffFlow[t][0]->SetBinContent(f2DDiffFlow[t][0]->GetBin(p,e),v2Prime); 
17889    } 
17890    // QC{4'}:
17891    qc4Prime = f2DDiffFlowCumulants[t][1]->GetBinContent(f2DDiffFlowCumulants[t][1]->GetBin(p,e));
17892    if(qc4Prime<=0.)
17893    {
17894     v4Prime = pow(-1.*qc4Prime,1./4.);
17895     f2DDiffFlow[t][1]->SetBinContent(f2DDiffFlow[t][1]->GetBin(p,e),v4Prime); 
17896    }   
17897   } // end of for(Int_t e=1;e<=fnBinsEta;e++)
17898  } // end of for(Int_t p=1;p<=fnBinsPt;p++)
17899  
17900 } // end of void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlow(TString type)  
17901
17902 //=======================================================================================================================
17903
17904 void AliFlowAnalysisWithQCumulants::StoreIntFlowFlags()
17905 {
17906  // a) Store all flags for integrated flow in profile fIntFlowFlags.
17907  
17908  if(!fIntFlowFlags)
17909  {
17910   cout<<"WARNING: fIntFlowFlags is NULL in AFAWQC::SFFIF() !!!!"<<endl;
17911   exit(0);
17912  } 
17913
17914  // particle weights used or not:
17915  fIntFlowFlags->Fill(0.5,(Int_t)fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights);
17916  // which event weights were used:
17917  if(fMultiplicityWeight->Contains("combinations"))
17918  {
17919   fIntFlowFlags->Fill(1.5,0); // 0 = "combinations" (default)
17920  } else if(fMultiplicityWeight->Contains("unit"))
17921    {
17922     fIntFlowFlags->Fill(1.5,1); // 1 = "unit"   
17923    } else if(fMultiplicityWeight->Contains("multiplicity"))
17924      {
17925       fIntFlowFlags->Fill(1.5,2); // 2 = "multiplicity"        
17926      } 
17927  fIntFlowFlags->Fill(2.5,(Int_t)fApplyCorrectionForNUA);
17928  fIntFlowFlags->Fill(3.5,(Int_t)fPrintFinalResults[0]);
17929  fIntFlowFlags->Fill(4.5,(Int_t)fPrintFinalResults[1]);
17930  fIntFlowFlags->Fill(5.5,(Int_t)fPrintFinalResults[2]);
17931  fIntFlowFlags->Fill(6.5,(Int_t)fPrintFinalResults[3]);
17932  fIntFlowFlags->Fill(7.5,(Int_t)fApplyCorrectionForNUAVsM);
17933  fIntFlowFlags->Fill(8.5,(Int_t)fPropagateErrorAlsoFromNIT);
17934  fIntFlowFlags->Fill(9.5,(Int_t)fCalculateCumulantsVsM);
17935  fIntFlowFlags->Fill(10.5,(Int_t)fMinimumBiasReferenceFlow);
17936  fIntFlowFlags->Fill(11.5,(Int_t)fForgetAboutCovariances);
17937  fIntFlowFlags->Fill(12.5,(Int_t)fStorePhiDistributionForOneEvent); 
17938  fIntFlowFlags->Fill(13.5,(Int_t)fFillMultipleControlHistograms);  
17939  fIntFlowFlags->Fill(14.5,(Int_t)fCalculateAllCorrelationsVsM);  
17940  // which multiplicity was used:
17941  if(fMultiplicityIs==AliFlowCommonConstants::kRP) // # of Reference Particles
17942  {
17943   fIntFlowFlags->Fill(15.5,0); // 0 = # of Reference Particles
17944  } else if(fMultiplicityIs==AliFlowCommonConstants::kExternal)
17945    {
17946     fIntFlowFlags->Fill(15.5,1); // 1 = ref. mult. from ESD
17947    } else if(fMultiplicityIs==AliFlowCommonConstants::kPOI)
17948      {
17949       fIntFlowFlags->Fill(15.5,2); // 2 = # of Particles of Interest
17950      } 
17951  fIntFlowFlags->Fill(16.5,(Int_t)fExactNoRPs); 
17952  fIntFlowFlags->Fill(17.5,(Int_t)fUse2DHistograms); 
17953  fIntFlowFlags->Fill(18.5,(Int_t)fFillProfilesVsMUsingWeights); 
17954  fIntFlowFlags->Fill(19.5,(Int_t)fUseQvectorTerms); 
17955
17956 } // end of void AliFlowAnalysisWithQCumulants::StoreIntFlowFlags()
17957
17958 //=======================================================================================================================
17959
17960 void AliFlowAnalysisWithQCumulants::StoreDiffFlowFlags()
17961 {
17962  // Store all flags for differential flow in the profile fDiffFlowFlags.
17963   
17964  if(!fDiffFlowFlags)
17965  {
17966   printf("\n WARNING (QC): fDiffFlowFlags is NULL in AFAWQC::SDFF() !!!!\n\n");
17967   exit(0);
17968  } 
17969  
17970  fDiffFlowFlags->Fill(0.5,fCalculateDiffFlow); // calculate differential flow
17971  fDiffFlowFlags->Fill(1.5,fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights); // particle weights used or not?
17972  //fDiffFlowFlags->Fill(2.5,""); // which event weight was used? ("combinations", "unit" or "multiplicity") to be improved - finalized
17973  fDiffFlowFlags->Fill(3.5,fApplyCorrectionForNUA); // corrected for non-uniform acceptance or not
17974  fDiffFlowFlags->Fill(4.5,fCalculate2DDiffFlow); // calculate also 2D differential flow vs (pt,eta) 
17975  fDiffFlowFlags->Fill(5.5,fCalculateDiffFlowVsEta); // if you set kFALSE only differential flow vs pt is calculated
17976      
17977 } // end of void AliFlowAnalysisWithQCumulants::StoreDiffFlowFlags()
17978
17979 //=======================================================================================================================
17980
17981 void AliFlowAnalysisWithQCumulants::StoreMixedHarmonicsFlags()
17982 {
17983  // Store all flags for mixed harmonics in profile fMixedHarmonicsFlags.
17984  
17985  if(!fMixedHarmonicsFlags)
17986  {
17987   cout<<"WARNING: fMixedHarmonicsFlags is NULL in AFAWQC::SMHF() !!!!"<<endl;
17988   exit(0);
17989  } 
17990
17991  fMixedHarmonicsFlags->Fill(0.5,(Int_t)fCalculateMixedHarmonics);
17992  fMixedHarmonicsFlags->Fill(1.5,(Int_t)fHarmonic);
17993  fMixedHarmonicsFlags->Fill(2.5,(Int_t)fCalculateMixedHarmonicsVsM);
17994  // Which multiplicity weight was used?:
17995
17996  if(fMultiplicityWeight->Contains("combinations"))
17997  {
17998   fMixedHarmonicsFlags->Fill(3.5,0); // 0 = "combinations" (default)
17999  } else if(fMultiplicityWeight->Contains("unit"))
18000    {
18001     fMixedHarmonicsFlags->Fill(3.5,1); // 1 = "unit"   
18002    } else if(fMultiplicityWeight->Contains("multiplicity"))
18003      {
18004       fMixedHarmonicsFlags->Fill(3.5,2); // 2 = "multiplicity"        
18005      } 
18006
18007 } // end of void AliFlowAnalysisWithQCumulants::StoreMixedHarmonicsFlags()
18008
18009 //=======================================================================================================================
18010
18011 void AliFlowAnalysisWithQCumulants::StoreControlHistogramsFlags()
18012 {
18013  // Store all flags for control histograms in profile fControlHistogramsFlags.
18014
18015  if(!fControlHistogramsFlags)
18016  {
18017   cout<<"WARNING: fControlHistogramsFlags is NULL in AFAWQC::SCHF() !!!!"<<endl;
18018   exit(0);
18019  } 
18020
18021  fControlHistogramsFlags->Fill(0.5,(Int_t)fStoreControlHistograms);
18022  fControlHistogramsFlags->Fill(1.5,(Int_t)fUseQvectorTerms);
18023
18024 } // end of void AliFlowAnalysisWithQCumulants::StoreControlHistogramsFlags()
18025
18026 //=======================================================================================================================
18027
18028 void AliFlowAnalysisWithQCumulants::StoreBootstrapFlags()
18029 {
18030  // Store all flags for bootstrap in TProfile fBootstrapFlags.
18031
18032  if(!fBootstrapFlags)
18033  {
18034   cout<<"WARNING: fBootstrapFlags is NULL in AFAWQC::SBF() !!!!"<<endl;
18035   exit(0);
18036  } 
18037
18038  fBootstrapFlags->Fill(0.5,(Int_t)fUseBootstrap);
18039  fBootstrapFlags->Fill(1.5,(Int_t)fUseBootstrapVsM);
18040  fBootstrapFlags->Fill(2.5,(Int_t)fnSubsamples);
18041
18042 } // end of void AliFlowAnalysisWithQCumulants::StoreBootstrapFlags()
18043
18044 //=======================================================================================================================
18045
18046 void AliFlowAnalysisWithQCumulants::GetPointersForCommonHistograms() 
18047 {
18048  // Access all pointers to common control and common result histograms and profiles.
18049  
18050  TString sCommonConstantsName = "fCommonConstants";
18051  sCommonConstantsName += fAnalysisLabel->Data();
18052  fCommonConstants = dynamic_cast<TProfile*>(fHistList->FindObject(sCommonConstantsName.Data()));
18053  if(!fCommonConstants)
18054  {
18055   printf("\n WARNING (QC): fCommonConstants is NULL in AFAWQC::GPFCH() !!!!\n\n");
18056   exit(0);
18057  }
18058  
18059  // to be improved - lines bellow can be implemented better.
18060  
18061  TString commonHistsName = "AliFlowCommonHistQC";
18062  commonHistsName += fAnalysisLabel->Data();
18063  AliFlowCommonHist *commonHist = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHistsName.Data()));
18064  if(commonHist) 
18065  {
18066   this->SetCommonHists(commonHist); 
18067   if(fCommonHists->GetHarmonic())
18068   {
18069    fHarmonic = (Int_t)(fCommonHists->GetHarmonic())->GetBinContent(1);
18070   } 
18071  } // end of if(commonHist) 
18072  TString commonHists2ndOrderName = "AliFlowCommonHist2ndOrderQC";
18073  commonHists2ndOrderName += fAnalysisLabel->Data();
18074  AliFlowCommonHist *commonHist2nd = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHists2ndOrderName.Data()));
18075  if(commonHist2nd) this->SetCommonHists2nd(commonHist2nd);   
18076  TString commonHists4thOrderName = "AliFlowCommonHist4thOrderQC";
18077  commonHists4thOrderName += fAnalysisLabel->Data();
18078  AliFlowCommonHist *commonHist4th = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHists4thOrderName.Data()));
18079  if(commonHist4th) this->SetCommonHists4th(commonHist4th);  
18080  TString commonHists6thOrderName = "AliFlowCommonHist6thOrderQC";
18081  commonHists6thOrderName += fAnalysisLabel->Data();
18082  AliFlowCommonHist *commonHist6th = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHists6thOrderName.Data()));
18083  if(commonHist6th) this->SetCommonHists6th(commonHist6th);  
18084  TString commonHists8thOrderName = "AliFlowCommonHist8thOrderQC";
18085  commonHists8thOrderName += fAnalysisLabel->Data();
18086  AliFlowCommonHist *commonHist8th = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHists8thOrderName.Data()));
18087  if(commonHist8th) this->SetCommonHists8th(commonHist8th); 
18088   
18089  TString commonHistResults2ndOrderName = "AliFlowCommonHistResults2ndOrderQC"; 
18090  commonHistResults2ndOrderName += fAnalysisLabel->Data(); 
18091  AliFlowCommonHistResults *commonHistRes2nd = dynamic_cast<AliFlowCommonHistResults*>
18092                                               (fHistList->FindObject(commonHistResults2ndOrderName.Data()));
18093  if(commonHistRes2nd) this->SetCommonHistsResults2nd(commonHistRes2nd);   
18094  TString commonHistResults4thOrderName = "AliFlowCommonHistResults4thOrderQC";
18095  commonHistResults4thOrderName += fAnalysisLabel->Data();
18096  AliFlowCommonHistResults *commonHistRes4th = dynamic_cast<AliFlowCommonHistResults*>
18097                                               (fHistList->FindObject(commonHistResults4thOrderName.Data()));
18098  if(commonHistRes4th) this->SetCommonHistsResults4th(commonHistRes4th);  
18099  TString commonHistResults6thOrderName = "AliFlowCommonHistResults6thOrderQC";
18100  commonHistResults6thOrderName += fAnalysisLabel->Data();
18101  AliFlowCommonHistResults *commonHistRes6th = dynamic_cast<AliFlowCommonHistResults*>
18102                                               (fHistList->FindObject(commonHistResults6thOrderName.Data()));
18103  if(commonHistRes6th) this->SetCommonHistsResults6th(commonHistRes6th);  
18104  TString commonHistResults8thOrderName = "AliFlowCommonHistResults8thOrderQC";
18105  commonHistResults8thOrderName += fAnalysisLabel->Data();
18106  AliFlowCommonHistResults *commonHistRes8th = dynamic_cast<AliFlowCommonHistResults*>
18107                                               (fHistList->FindObject(commonHistResults8thOrderName.Data()));  
18108  if(commonHistRes8th) this->SetCommonHistsResults8th(commonHistRes8th);
18109        
18110 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForCommonHistograms() 
18111
18112 //=======================================================================================================================
18113
18114 void AliFlowAnalysisWithQCumulants::GetPointersForParticleWeightsHistograms() 
18115 {
18116  // Get pointers for histograms with particle weights.
18117
18118  TList *weightsList = dynamic_cast<TList*>(fHistList->FindObject("Weights"));
18119  if(!weightsList){printf("\n WARNING (QC): weightsList is NULL in AFAWQC::GPFPWH() !!!!\n");exit(0);}
18120  this->SetWeightsList(weightsList);
18121  TString fUseParticleWeightsName = "fUseParticleWeightsQC"; // to be improved (hirdwired label QC)
18122  fUseParticleWeightsName += fAnalysisLabel->Data();
18123  TProfile *useParticleWeights = dynamic_cast<TProfile*>(weightsList->FindObject(fUseParticleWeightsName.Data()));
18124  if(useParticleWeights)
18125  {
18126   this->SetUseParticleWeights(useParticleWeights);  
18127   fUsePhiWeights = (Int_t)fUseParticleWeights->GetBinContent(1); 
18128   fUsePtWeights = (Int_t)fUseParticleWeights->GetBinContent(2); 
18129   fUseEtaWeights = (Int_t)fUseParticleWeights->GetBinContent(3);  
18130   fUseTrackWeights = (Int_t)fUseParticleWeights->GetBinContent(4);  
18131  }
18132 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForParticleWeightsHistograms(); 
18133
18134 //=======================================================================================================================
18135
18136 void AliFlowAnalysisWithQCumulants::GetPointersForIntFlowHistograms() 
18137 {
18138  // Get pointers for histograms and profiles relevant for integrated flow:
18139  //  a) Get pointer to base list for integrated flow holding profile fIntFlowFlags and lists fIntFlowProfiles and fIntFlowResults.
18140  //  b) Get pointer to profile fIntFlowFlags holding all flags for integrated flow.
18141  //  c) Get pointer to list fIntFlowProfiles and pointers to all objects that she holds. 
18142  //  d) Get pointer to list fIntFlowResults and pointers to all objects that she holds. 
18143   
18144  TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data member?)
18145  TString powerFlag[2] = {"linear","quadratic"}; // to be improved (should I promote this to data member?)
18146  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?)
18147  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?)
18148  
18149  // a) Get pointer to base list for integrated flow holding profile fIntFlowFlags and lists fIntFlowProfiles and fIntFlowResults:
18150  TList *intFlowList = NULL;
18151  intFlowList = dynamic_cast<TList*>(fHistList->FindObject("Integrated Flow"));
18152  if(!intFlowList) 
18153  {
18154   cout<<"WARNING: intFlowList is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18155   exit(0); 
18156  }  
18157   
18158  // b) Get pointer to profile fIntFlowFlags holding all flags for integrated flow:
18159  TString intFlowFlagsName = "fIntFlowFlags";
18160  intFlowFlagsName += fAnalysisLabel->Data();
18161  TProfile *intFlowFlags = dynamic_cast<TProfile*>(intFlowList->FindObject(intFlowFlagsName.Data()));
18162  if(intFlowFlags)
18163  {
18164   this->SetIntFlowFlags(intFlowFlags);  
18165   fApplyCorrectionForNUA = (Bool_t)intFlowFlags->GetBinContent(3); 
18166   fApplyCorrectionForNUAVsM = (Bool_t)intFlowFlags->GetBinContent(8); 
18167   fCalculateCumulantsVsM = (Bool_t)intFlowFlags->GetBinContent(10);  
18168  } else 
18169    {
18170     cout<<"WARNING: intFlowFlags is NULL in FAWQC::GPFIFH() !!!!"<<endl;
18171    }
18172   
18173   // c) Get pointer to list fIntFlowProfiles and pointers to all objects that she holds:
18174   TList *intFlowProfiles = NULL;
18175   intFlowProfiles = dynamic_cast<TList*>(intFlowList->FindObject("Profiles"));
18176   if(intFlowProfiles)  
18177   {
18178    // average multiplicities:
18179    TString avMultiplicityName = "fAvMultiplicity";
18180    avMultiplicityName += fAnalysisLabel->Data();
18181    TProfile *avMultiplicity = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(avMultiplicityName.Data()));
18182    if(avMultiplicity) 
18183    {
18184     this->SetAvMultiplicity(avMultiplicity);
18185    } else 
18186      {
18187       cout<<"WARNING: avMultiplicity is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18188      }
18189    // average correlations <<2>>, <<4>>, <<6>> and <<8>> (with wrong errors!):
18190    TString intFlowCorrelationsProName = "fIntFlowCorrelationsPro";
18191    intFlowCorrelationsProName += fAnalysisLabel->Data();
18192    TProfile *intFlowCorrelationsPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowCorrelationsProName.Data()));
18193    if(intFlowCorrelationsPro) 
18194    {
18195     this->SetIntFlowCorrelationsPro(intFlowCorrelationsPro);
18196    } else 
18197      {
18198       cout<<"WARNING: intFlowCorrelationsPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18199      }      
18200    // average squared correlations <<2>^2>, <<4>^2>, <<6>^2> and <<8^2>>:
18201    TString intFlowSquaredCorrelationsProName = "fIntFlowSquaredCorrelationsPro";
18202    intFlowSquaredCorrelationsProName += fAnalysisLabel->Data();
18203    TProfile *intFlowSquaredCorrelationsPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowSquaredCorrelationsProName.Data()));
18204    if(intFlowSquaredCorrelationsPro) 
18205    {
18206     this->SetIntFlowSquaredCorrelationsPro(intFlowSquaredCorrelationsPro);
18207    } else 
18208      {
18209       cout<<"WARNING: intFlowSquaredCorrelationsPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18210      }             
18211    if(fCalculateCumulantsVsM)
18212    {
18213     // Average correlations <<2>>, <<4>>, <<6>> and <<8>> versus multiplicity for all events (error is wrong here):   
18214     TString intFlowCorrelationsVsMProName = "fIntFlowCorrelationsVsMPro";
18215     intFlowCorrelationsVsMProName += fAnalysisLabel->Data();
18216     for(Int_t ci=0;ci<4;ci++) // correlation index
18217     {
18218      TProfile *intFlowCorrelationsVsMPro = dynamic_cast<TProfile*>
18219                                         (intFlowProfiles->FindObject(Form("%s, %s",intFlowCorrelationsVsMProName.Data(),correlationFlag[ci].Data())));
18220      if(intFlowCorrelationsVsMPro)
18221      {
18222       this->SetIntFlowCorrelationsVsMPro(intFlowCorrelationsVsMPro,ci);
18223      } else
18224        {
18225         cout<<"WARNING: "<<Form("intFlowCorrelationsVsMPro[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18226        }   
18227     } // end of for(Int_t ci=0;ci<4;ci++) // correlation index 
18228     // Average squared correlations <<2>^2>, <<4>^2>, <<6>^2> and <<8>^2> versus multiplicity for all events:   
18229     TString intFlowSquaredCorrelationsVsMProName = "fIntFlowSquaredCorrelationsVsMPro";
18230     intFlowSquaredCorrelationsVsMProName += fAnalysisLabel->Data();
18231     for(Int_t ci=0;ci<4;ci++) // correlation index
18232     {
18233      TProfile *intFlowSquaredCorrelationsVsMPro = dynamic_cast<TProfile*>
18234                       (intFlowProfiles->FindObject(Form("%s, %s",intFlowSquaredCorrelationsVsMProName.Data(),squaredCorrelationFlag[ci].Data())));
18235      if(intFlowSquaredCorrelationsVsMPro)
18236      {
18237       this->SetIntFlowSquaredCorrelationsVsMPro(intFlowSquaredCorrelationsVsMPro,ci);
18238      } else
18239        {
18240         cout<<"WARNING: "<<Form("intFlowSquaredCorrelationsVsMPro[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18241        }   
18242     } // end of for(Int_t ci=0;ci<4;ci++) // correlation index 
18243    } // end of if(fCalculateCumulantsVsM)
18244    // average all correlations for integrated flow (with wrong errors!):
18245    TString intFlowCorrelationsAllProName = "fIntFlowCorrelationsAllPro";
18246    intFlowCorrelationsAllProName += fAnalysisLabel->Data();
18247    TProfile *intFlowCorrelationsAllPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowCorrelationsAllProName.Data()));
18248    if(intFlowCorrelationsAllPro) 
18249    {
18250     this->SetIntFlowCorrelationsAllPro(intFlowCorrelationsAllPro);
18251    } else 
18252      {
18253       cout<<"WARNING: intFlowCorrelationsAllPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18254      }     
18255    // average extra correlations for integrated flow (which appear only when particle weights are used):
18256    // (to be improved: Weak point in implementation, I am assuming here that method GetPointersForParticleWeightsHistograms() was called)
18257    if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
18258    {
18259     TString intFlowExtraCorrelationsProName = "fIntFlowExtraCorrelationsPro";
18260     intFlowExtraCorrelationsProName += fAnalysisLabel->Data();
18261     TProfile *intFlowExtraCorrelationsPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowExtraCorrelationsProName.Data()));
18262     if(intFlowExtraCorrelationsPro) 
18263     {
18264      this->SetIntFlowExtraCorrelationsPro(intFlowExtraCorrelationsPro);
18265     } else 
18266       {
18267        cout<<"WARNING: intFlowExtraCorrelationsPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18268       }
18269    } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)        
18270    // average products of correlations <2>, <4>, <6> and <8>:  
18271    TString intFlowProductOfCorrelationsProName = "fIntFlowProductOfCorrelationsPro";
18272    intFlowProductOfCorrelationsProName += fAnalysisLabel->Data();
18273    TProfile *intFlowProductOfCorrelationsPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowProductOfCorrelationsProName.Data()));
18274    if(intFlowProductOfCorrelationsPro) 
18275    {
18276     this->SetIntFlowProductOfCorrelationsPro(intFlowProductOfCorrelationsPro);
18277    } else 
18278      {
18279       cout<<"WARNING: intFlowProductOfCorrelationsPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18280      }               
18281    // average product of correlations <2>, <4>, <6> and <8> versus multiplicity  
18282    // [0=<<2><4>>,1=<<2><6>>,2=<<2><8>>,3=<<4><6>>,4=<<4><8>>,5=<<6><8>>]  
18283    if(fCalculateCumulantsVsM)
18284    {
18285     TString intFlowProductOfCorrelationsVsMProName = "fIntFlowProductOfCorrelationsVsMPro";
18286     intFlowProductOfCorrelationsVsMProName += fAnalysisLabel->Data();
18287     TString productFlag[6] = {"#LT#LT2#GT#LT4#GT#GT","#LT#LT2#GT#LT6#GT#GT","#LT#LT2#GT#LT8#GT#GT",
18288                               "#LT#LT4#GT#LT6#GT#GT","#LT#LT4#GT#LT8#GT#GT","#LT#LT6#GT#LT8#GT#GT"};
18289     for(Int_t pi=0;pi<6;pi++)
18290     { 
18291      TProfile *intFlowProductOfCorrelationsVsMPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(Form("%s, %s",intFlowProductOfCorrelationsVsMProName.Data(),productFlag[pi].Data())));
18292      if(intFlowProductOfCorrelationsVsMPro)
18293      {
18294       this->SetIntFlowProductOfCorrelationsVsMPro(intFlowProductOfCorrelationsVsMPro,pi);
18295      } else
18296        {
18297         cout<<"WARNING: "<<Form("intFlowProductOfCorrelationsVsMPro[%d]",pi)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18298        }
18299     } // end of for(Int_t pi=0;pi<6;pi++)
18300    } // end of if(fCalculateCumulantsVsM)
18301    // average correction terms for non-uniform acceptance (with wrong errors!):
18302    for(Int_t sc=0;sc<2;sc++)
18303    {
18304     TString intFlowCorrectionTermsForNUAProName = "fIntFlowCorrectionTermsForNUAPro";
18305     intFlowCorrectionTermsForNUAProName += fAnalysisLabel->Data();
18306     TProfile *intFlowCorrectionTermsForNUAPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject((Form("%s: %s terms",intFlowCorrectionTermsForNUAProName.Data(),sinCosFlag[sc].Data()))));
18307     if(intFlowCorrectionTermsForNUAPro) 
18308     {
18309      this->SetIntFlowCorrectionTermsForNUAPro(intFlowCorrectionTermsForNUAPro,sc);
18310     } else 
18311       {
18312        cout<<"WARNING: intFlowCorrectionTermsForNUAPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18313        cout<<"sc = "<<sc<<endl;
18314       } 
18315     // versus multiplicity:
18316     if(fCalculateCumulantsVsM)
18317     {
18318      TString correctionTermFlag[4] = {"(n(phi1))","(n(phi1+phi2))","(n(phi1-phi2-phi3))","(n(2phi1-phi2))"}; // to be improved - hardwired 4
18319      TString intFlowCorrectionTermsForNUAVsMProName = "fIntFlowCorrectionTermsForNUAVsMPro";
18320      intFlowCorrectionTermsForNUAVsMProName += fAnalysisLabel->Data();
18321      for(Int_t ci=0;ci<4;ci++) // correction term index (to be improved - hardwired 4)
18322      {
18323       TProfile *intFlowCorrectionTermsForNUAVsMPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(Form("%s: #LT#LT%s%s#GT#GT",intFlowCorrectionTermsForNUAVsMProName.Data(),sinCosFlag[sc].Data(),correctionTermFlag[ci].Data())));
18324       if(intFlowCorrectionTermsForNUAVsMPro) 
18325       {
18326        this->SetIntFlowCorrectionTermsForNUAVsMPro(intFlowCorrectionTermsForNUAVsMPro,sc,ci);
18327       } else 
18328         {
18329          cout<<"WARNING: intFlowCorrectionTermsForNUAVsMPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18330          cout<<"sc = "<<sc<<endl;
18331          cout<<"ci = "<<ci<<endl;
18332         }       
18333      } // end of for(Int_t ci=0;ci<4;ci++) // correction term index (to be improved - hardwired 4)
18334     } // end of if(fCalculateCumulantsVsM)
18335    } // end of for(Int_t sc=0;sc<2;sc++)           
18336    // average products of correction terms for NUA:  
18337    TString intFlowProductOfCorrectionTermsForNUAProName = "fIntFlowProductOfCorrectionTermsForNUAPro";
18338    intFlowProductOfCorrectionTermsForNUAProName += fAnalysisLabel->Data();
18339    TProfile *intFlowProductOfCorrectionTermsForNUAPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowProductOfCorrectionTermsForNUAProName.Data()));
18340    if(intFlowProductOfCorrectionTermsForNUAPro) 
18341    {
18342     this->SetIntFlowProductOfCorrectionTermsForNUAPro(intFlowProductOfCorrectionTermsForNUAPro);
18343    } else 
18344      {
18345       cout<<"WARNING: intFlowProductOfCorrectionTermsForNUAPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18346      }     
18347   } else // to if(intFlowProfiles)  
18348     {
18349      cout<<"WARNING: intFlowProfiles is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18350     }
18351    
18352   //  d) Get pointer to list fIntFlowResults and pointers to all objects that she holds. 
18353   TList *intFlowResults = NULL;
18354   intFlowResults = dynamic_cast<TList*>(intFlowList->FindObject("Results"));
18355   if(intFlowResults)
18356   {
18357    // average correlations <<2>>, <<4>>, <<6>> and <<8>> (with correct errors!):
18358    TString intFlowCorrelationsHistName = "fIntFlowCorrelationsHist";
18359    intFlowCorrelationsHistName += fAnalysisLabel->Data();
18360    TH1D *intFlowCorrelationsHist = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowCorrelationsHistName.Data()));
18361    if(intFlowCorrelationsHist) 
18362    {
18363     this->SetIntFlowCorrelationsHist(intFlowCorrelationsHist);
18364    } else 
18365      {
18366       cout<<"WARNING: intFlowCorrelationsHist is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18367      } 
18368    // average correlations <<2>>, <<4>>, <<6>> and <<8>> (with correct errors!) vs M:    
18369    if(fCalculateCumulantsVsM)
18370    {
18371     TString intFlowCorrelationsVsMHistName = "fIntFlowCorrelationsVsMHist";
18372     intFlowCorrelationsVsMHistName += fAnalysisLabel->Data();
18373     for(Int_t ci=0;ci<4;ci++) // correlation index
18374     {
18375      TH1D *intFlowCorrelationsVsMHist = dynamic_cast<TH1D*>
18376                                         (intFlowResults->FindObject(Form("%s, %s",intFlowCorrelationsVsMHistName.Data(),correlationFlag[ci].Data())));
18377      if(intFlowCorrelationsVsMHist)
18378      {
18379       this->SetIntFlowCorrelationsVsMHist(intFlowCorrelationsVsMHist,ci);
18380      } else
18381        {
18382         cout<<"WARNING: "<<Form("intFlowCorrelationsVsMHist[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18383        }   
18384     } // end of for(Int_t ci=0;ci<4;ci++) // correlation index   
18385    } // end of if(fCalculateCumulantsVsM)
18386    // average all correlations for integrated flow (with correct errors!):
18387    TString intFlowCorrelationsAllHistName = "fIntFlowCorrelationsAllHist";
18388    intFlowCorrelationsAllHistName += fAnalysisLabel->Data();
18389    TH1D *intFlowCorrelationsAllHist = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowCorrelationsAllHistName.Data()));
18390    if(intFlowCorrelationsAllHist) 
18391    {
18392     this->SetIntFlowCorrelationsAllHist(intFlowCorrelationsAllHist);
18393    } else 
18394      {
18395       cout<<"WARNING: intFlowCorrelationsAllHist is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18396      }  
18397    // average correction terms for non-uniform acceptance (with correct errors!):
18398    TString intFlowCorrectionTermsForNUAHistName = "fIntFlowCorrectionTermsForNUAHist";
18399    intFlowCorrectionTermsForNUAHistName += fAnalysisLabel->Data();
18400    for(Int_t sc=0;sc<2;sc++)
18401    {
18402     TH1D *intFlowCorrectionTermsForNUAHist = dynamic_cast<TH1D*>(intFlowResults->FindObject((Form("%s: %s terms",intFlowCorrectionTermsForNUAHistName.Data(),sinCosFlag[sc].Data()))));
18403     if(intFlowCorrectionTermsForNUAHist) 
18404     {
18405      this->SetIntFlowCorrectionTermsForNUAHist(intFlowCorrectionTermsForNUAHist,sc);
18406     } else 
18407       {
18408        cout<<"WARNING: intFlowCorrectionTermsForNUAHist is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18409        cout<<"sc = "<<sc<<endl;
18410       } 
18411    } // end of for(Int_t sc=0;sc<2;sc++)           
18412    // covariances (multiplied with weight dependent prefactor):
18413    TString intFlowCovariancesName = "fIntFlowCovariances";
18414    intFlowCovariancesName += fAnalysisLabel->Data();
18415    TH1D *intFlowCovariances = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowCovariancesName.Data()));
18416    if(intFlowCovariances) 
18417    {
18418     this->SetIntFlowCovariances(intFlowCovariances); 
18419    } else 
18420      {
18421       cout<<"WARNING: intFlowCovariances is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18422      } 
18423    // sum of linear and quadratic event weights for <2>, <4>, <6> and <8>:
18424    TString intFlowSumOfEventWeightsName = "fIntFlowSumOfEventWeights";
18425    intFlowSumOfEventWeightsName += fAnalysisLabel->Data();
18426    for(Int_t power=0;power<2;power++)
18427    {
18428     TH1D *intFlowSumOfEventWeights = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s: %s",intFlowSumOfEventWeightsName.Data(),powerFlag[power].Data())));
18429     if(intFlowSumOfEventWeights) 
18430     {
18431      this->SetIntFlowSumOfEventWeights(intFlowSumOfEventWeights,power);
18432     } else 
18433       {
18434        cout<<"WARNING: intFlowSumOfEventWeights is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18435        cout<<"power = "<<power<<endl;
18436       }                                   
18437    } // end of for(Int_t power=0;power<2;power++)                                                                  
18438    // sum of products of event weights for correlations <2>, <4>, <6> and <8>:  
18439    TString intFlowSumOfProductOfEventWeightsName = "fIntFlowSumOfProductOfEventWeights";
18440    intFlowSumOfProductOfEventWeightsName += fAnalysisLabel->Data();
18441    TH1D *intFlowSumOfProductOfEventWeights = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowSumOfProductOfEventWeightsName.Data()));
18442    if(intFlowSumOfProductOfEventWeights) 
18443    {
18444     this->SetIntFlowSumOfProductOfEventWeights(intFlowSumOfProductOfEventWeights);
18445    } else 
18446      {
18447       cout<<"WARNING: intFlowSumOfProductOfEventWeights is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18448      } 
18449    // final result for covariances of correlations (multiplied with weight dependent prefactor) versus M
18450    // [0=Cov(2,4),1=Cov(2,6),2=Cov(2,8),3=Cov(4,6),4=Cov(4,8),5=Cov(6,8)]:
18451    if(fCalculateCumulantsVsM)
18452    {
18453     TString intFlowCovariancesVsMName = "fIntFlowCovariancesVsM";
18454     intFlowCovariancesVsMName += fAnalysisLabel->Data();
18455     TString covarianceFlag[6] = {"Cov(<2>,<4>)","Cov(<2>,<6>)","Cov(<2>,<8>)","Cov(<4>,<6>)","Cov(<4>,<8>)","Cov(<6>,<8>)"};
18456     for(Int_t ci=0;ci<6;ci++)
18457     { 
18458      TH1D *intFlowCovariancesVsM = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s, %s",intFlowCovariancesVsMName.Data(),covarianceFlag[ci].Data())));
18459      if(intFlowCovariancesVsM)
18460      {
18461       this->SetIntFlowCovariancesVsM(intFlowCovariancesVsM,ci);
18462      } else
18463        {
18464         cout<<"WARNING: "<<Form("intFlowCovariancesVsM[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18465        }    
18466     } // end of for(Int_t ci=0;ci<6;ci++)
18467    } // end of if(fCalculateCumulantsVsM)
18468    // sum of linear and quadratic event weights for <2>, <4>, <6> and <8> versus multiplicity
18469    // [0=sum{w_{<2>}},1=sum{w_{<4>}},2=sum{w_{<6>}},3=sum{w_{<8>}}][0=linear 1,1=quadratic]:
18470    if(fCalculateCumulantsVsM)
18471    {
18472     TString intFlowSumOfEventWeightsVsMName = "fIntFlowSumOfEventWeightsVsM";
18473     intFlowSumOfEventWeightsVsMName += fAnalysisLabel->Data();
18474     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>}"},
18475                              {"#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}"}};
18476     for(Int_t si=0;si<4;si++)
18477     {
18478      for(Int_t power=0;power<2;power++)
18479      {
18480       TH1D *intFlowSumOfEventWeightsVsM = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s, %s",intFlowSumOfEventWeightsVsMName.Data(),sumFlag[power][si].Data())));
18481       if(intFlowSumOfEventWeightsVsM)
18482       {
18483        this->SetIntFlowSumOfEventWeightsVsM(intFlowSumOfEventWeightsVsM,si,power);
18484       } else
18485         {
18486          cout<<"WARNING: "<<Form("intFlowSumOfEventWeightsVsM[%d][%d]",si,power)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18487         }    
18488      } // end of for(Int_t power=0;power<2;power++)
18489     } // end of for(Int_t si=0;si<4;si++)   
18490    } // end of if(fCalculateCumulantsVsM)
18491    // sum of products of event weights for correlations <2>, <4>, <6> and <8> vs M
18492    // [0=sum{w_{<2>}w_{<4>}},1=sum{w_{<2>}w_{<6>}},2=sum{w_{<2>}w_{<8>}},
18493    //  3=sum{w_{<4>}w_{<6>}},4=sum{w_{<4>}w_{<8>}},5=sum{w_{<6>}w_{<8>}}]:  
18494    if(fCalculateCumulantsVsM)
18495    {
18496     TString intFlowSumOfProductOfEventWeightsVsMName = "fIntFlowSumOfProductOfEventWeightsVsM";
18497     intFlowSumOfProductOfEventWeightsVsMName += fAnalysisLabel->Data();
18498     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>}",
18499                             "#sum_{i=1}^{N} w_{<4>} w_{<6>}","#sum_{i=1}^{N} w_{<4>} w_{<8>}","#sum_{i=1}^{N} w_{<6>} w_{<8>}"}; 
18500     for(Int_t pi=0;pi<6;pi++)
18501     {
18502      TH1D *intFlowSumOfProductOfEventWeightsVsM = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s, %s",intFlowSumOfProductOfEventWeightsVsMName.Data(),sopowFlag[pi].Data())));
18503      if(intFlowSumOfProductOfEventWeightsVsM)
18504      {
18505       this->SetIntFlowSumOfProductOfEventWeightsVsM(intFlowSumOfProductOfEventWeightsVsM,pi);
18506      } else
18507        {
18508         cout<<"WARNING: "<<Form("intFlowSumOfProductOfEventWeightsVsM[%d]",pi)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18509        }
18510     } // end of for(Int_t pi=0;pi<6;pi++)        
18511    } // end of if(fCalculateCumulantsVsM)
18512    // covariances for NUA (multiplied with weight dependent prefactor):
18513    TString intFlowCovariancesNUAName = "fIntFlowCovariancesNUA";
18514    intFlowCovariancesNUAName += fAnalysisLabel->Data();
18515    TH1D *intFlowCovariancesNUA = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowCovariancesNUAName.Data()));
18516    if(intFlowCovariancesNUA) 
18517    {
18518     this->SetIntFlowCovariancesNUA(intFlowCovariancesNUA); 
18519    } else 
18520      {
18521       cout<<"WARNING: intFlowCovariancesNUA is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18522      } 
18523    // sum of linear and quadratic event weights NUA terms:
18524    TString intFlowSumOfEventWeightsNUAName = "fIntFlowSumOfEventWeightsNUA";
18525    intFlowSumOfEventWeightsNUAName += fAnalysisLabel->Data();
18526    for(Int_t sc=0;sc<2;sc++)
18527    {
18528     for(Int_t power=0;power<2;power++)
18529     {
18530      TH1D *intFlowSumOfEventWeightsNUA = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s: %s, %s",intFlowSumOfEventWeightsNUAName.Data(),powerFlag[power].Data(),sinCosFlag[sc].Data())));
18531      if(intFlowSumOfEventWeightsNUA) 
18532      {
18533       this->SetIntFlowSumOfEventWeightsNUA(intFlowSumOfEventWeightsNUA,sc,power);
18534      } else 
18535        {
18536         cout<<"WARNING: intFlowSumOfEventWeightsNUA is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18537         cout<<"sc    = "<<sc<<endl;
18538         cout<<"power = "<<power<<endl;
18539        }                                   
18540     } // end of for(Int_t power=0;power<2;power++)                                                                  
18541    } // end of for(Int_t sc=0;sc<2;sc++)     
18542    // sum of products of event weights for NUA terms:  
18543    TString intFlowSumOfProductOfEventWeightsNUAName = "fIntFlowSumOfProductOfEventWeightsNUA";
18544    intFlowSumOfProductOfEventWeightsNUAName += fAnalysisLabel->Data();
18545    TH1D *intFlowSumOfProductOfEventWeightsNUA = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowSumOfProductOfEventWeightsNUAName.Data()));
18546    if(intFlowSumOfProductOfEventWeightsNUA) 
18547    {
18548     this->SetIntFlowSumOfProductOfEventWeightsNUA(intFlowSumOfProductOfEventWeightsNUA);
18549    } else 
18550      {
18551       cout<<"WARNING: intFlowSumOfProductOfEventWeightsNUA is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18552      } 
18553    // Final results for reference Q-cumulants:
18554    TString intFlowQcumulantsName = "fIntFlowQcumulants";
18555    intFlowQcumulantsName += fAnalysisLabel->Data();
18556    TH1D *intFlowQcumulants = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowQcumulantsName.Data()));
18557    if(intFlowQcumulants) 
18558    {
18559     this->SetIntFlowQcumulants(intFlowQcumulants);
18560    } else 
18561      {
18562       cout<<"WARNING: intFlowQcumulants is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18563      }  
18564    // Final results for reference Q-cumulants rebinned in M:
18565    if(fCalculateCumulantsVsM)
18566    {
18567     TString intFlowQcumulantsRebinnedInMName = "fIntFlowQcumulantsRebinnedInM";
18568     intFlowQcumulantsRebinnedInMName += fAnalysisLabel->Data();
18569     TH1D *intFlowQcumulantsRebinnedInM = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowQcumulantsRebinnedInMName.Data()));
18570     if(intFlowQcumulantsRebinnedInM) 
18571     {
18572      this->SetIntFlowQcumulantsRebinnedInM(intFlowQcumulantsRebinnedInM);
18573     } else 
18574       {
18575        cout<<"WARNING: intFlowQcumulantsRebinnedInM is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18576       }  
18577    } // end of if(fCalculateCumulantsVsM)
18578    // Ratio between error squared: with/without non-isotropic terms:
18579    TString intFlowQcumulantsErrorSquaredRatioName = "fIntFlowQcumulantsErrorSquaredRatio";
18580    intFlowQcumulantsErrorSquaredRatioName += fAnalysisLabel->Data();
18581    TH1D *intFlowQcumulantsErrorSquaredRatio = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowQcumulantsErrorSquaredRatioName.Data()));
18582    if(intFlowQcumulantsErrorSquaredRatio) 
18583    {
18584     this->SetIntFlowQcumulantsErrorSquaredRatio(intFlowQcumulantsErrorSquaredRatio);
18585    } else 
18586      {
18587       cout<<" WARNING: intntFlowQcumulantsErrorSquaredRatio is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18588      }  
18589    // final results for integrated Q-cumulants versus multiplicity:
18590    TString cumulantFlag[4] = {"QC{2}","QC{4}","QC{6}","QC{8}"};
18591    if(fCalculateCumulantsVsM)
18592    {
18593     TString intFlowQcumulantsVsMName = "fIntFlowQcumulantsVsM";
18594     intFlowQcumulantsVsMName += fAnalysisLabel->Data();
18595     for(Int_t co=0;co<4;co++) // cumulant order
18596     {
18597      TH1D *intFlowQcumulantsVsM = dynamic_cast<TH1D*>
18598                                   (intFlowResults->FindObject(Form("%s, %s",intFlowQcumulantsVsMName.Data(),cumulantFlag[co].Data())));
18599      if(intFlowQcumulantsVsM)
18600      {
18601       this->SetIntFlowQcumulantsVsM(intFlowQcumulantsVsM,co);
18602      } else
18603        {
18604         cout<<"WARNING: "<<Form("intFlowQcumulantsVsM[%d]",co)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18605        }
18606     } // end of for(Int_t co=0;co<4;co++) // cumulant order
18607    } // end of if(fCalculateCumulantsVsM)
18608    // Final reference flow estimates from Q-cumulants:
18609    TString intFlowName = "fIntFlow";
18610    intFlowName += fAnalysisLabel->Data();
18611    TH1D *intFlow = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowName.Data()));
18612    if(intFlow) 
18613    {
18614     this->SetIntFlow(intFlow);
18615    } else 
18616      {
18617       cout<<"WARNING: intFlow is NULL in AFAWQC::GPFIFH() !!!!"<<endl; 
18618      } 
18619    // Final reference flow estimates from Q-cumulants vs M rebinned in M:
18620    if(fCalculateCumulantsVsM)
18621    {
18622     TString intFlowRebinnedInMName = "fIntFlowRebinnedInM";
18623     intFlowRebinnedInMName += fAnalysisLabel->Data();
18624     TH1D *intFlowRebinnedInM = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowRebinnedInMName.Data()));
18625     if(intFlowRebinnedInM) 
18626     {
18627      this->SetIntFlowRebinnedInM(intFlowRebinnedInM);
18628     } else 
18629       {
18630        cout<<"WARNING: intFlowRebinnedInM is NULL in AFAWQC::GPFIFH() !!!!"<<endl; 
18631       } 
18632    } // end of if(fCalculateCumulantsVsM)
18633    // integrated flow from Q-cumulants versus multiplicity:
18634    if(fCalculateCumulantsVsM)
18635    {
18636     TString intFlowVsMName = "fIntFlowVsM";
18637     intFlowVsMName += fAnalysisLabel->Data();
18638     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)};
18639     for(Int_t co=0;co<4;co++) // cumulant order
18640     {
18641      TH1D *intFlowVsM = dynamic_cast<TH1D*>
18642                         (intFlowResults->FindObject(Form("%s, %s",intFlowVsMName.Data(),flowFlag[co].Data())));            
18643      if(intFlowVsM)
18644      {
18645       this->SetIntFlowVsM(intFlowVsM,co);
18646      } else
18647        {
18648         cout<<"WARNING: "<<Form("intFlowVsM[%d]",co)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;      
18649        }
18650     } // end of for(Int_t co=0;co<4;co++) // cumulant order
18651    } // end of if(fCalculateCumulantsVsM)
18652    // quantifying detector effects effects to correlations:
18653    TString intFlowDetectorBiasName = "fIntFlowDetectorBias";
18654    intFlowDetectorBiasName += fAnalysisLabel->Data();
18655    TH1D *intFlowDetectorBias = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowDetectorBiasName.Data()));
18656    if(intFlowDetectorBias) 
18657    {
18658     this->SetIntFlowDetectorBias(intFlowDetectorBias);
18659    } else 
18660      {
18661       cout<<"WARNING: intFlowDetectorBias is NULL in AFAWQC::GPFIFH() !!!!"<<endl; 
18662      } 
18663    // quantifying detector effects effects to correlations vs multiplicity:
18664    if(fCalculateCumulantsVsM)
18665    {
18666     TString intFlowDetectorBiasVsMName = "fIntFlowDetectorBiasVsM";
18667     intFlowDetectorBiasVsMName += fAnalysisLabel->Data();
18668     for(Int_t ci=0;ci<4;ci++) // correlation index
18669     {
18670      TH1D *intFlowDetectorBiasVsM = dynamic_cast<TH1D*>
18671                                     (intFlowResults->FindObject(Form("%s for %s",intFlowDetectorBiasVsMName.Data(),cumulantFlag[ci].Data())));
18672      if(intFlowDetectorBiasVsM)
18673      {
18674       this->SetIntFlowDetectorBiasVsM(intFlowDetectorBiasVsM,ci);
18675      } else
18676        {
18677         cout<<"WARNING: "<<Form("intFlowDetectorBiasVsM[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;      
18678        }
18679     } // end of for(Int_t ci=0;ci<4;ci++) // correlation index   
18680    } // end of if(fCalculateCumulantsVsM)
18681   } else // to if(intFlowResults)
18682     {
18683      cout<<"WARNING: intFlowResults is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
18684     }
18685     
18686 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForIntFlowHistograms()
18687
18688 //=======================================================================================================================
18689
18690 void AliFlowAnalysisWithQCumulants::GetPointersFor2DDiffFlowHistograms()
18691 {
18692  // Get pointers for 2D differential flow histograms.
18693  //  a) Check pointers used in this method;
18694  //  b) Get pointers to 2D differential flow lists;
18695  //  c) Get pointers to 2D differential flow profiles;
18696  //  d) Get pointers to 2D differential flow histograms. 
18697
18698  // a) Check pointers used in this method:
18699  if(!fDiffFlowList)
18700  { 
18701   printf("\n WARNING (QC): fDiffFlowList is NULL in AFAWQC::GPF2DDFH() !!!!\n");
18702   printf("               Call method GetPointersForDiffFlowHistograms() first.\n\n");
18703   exit(0);
18704  }
18705  if(!fDiffFlowFlags)
18706  { 
18707   printf("\n WARNING (QC): fDiffFlowFlags is NULL in AFAWQC::GPF2DDFH() !!!!\n\n");
18708   printf("               Call method GetPointersForDiffFlowHistograms() first.\n\n");
18709   exit(0);
18710  }
18711  
18712  // b) Get pointers to 2D differential flow lists:
18713  this->SetCalculate2DDiffFlow((Bool_t)fDiffFlowFlags->GetBinContent(5)); // to be improved - hardwired 5
18714  if(!fCalculate2DDiffFlow){return;}
18715  TString typeFlag[2] = {"RP","POI"}; 
18716  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"};
18717  TString differentialCumulantIndex[4] = {"QC{2'}","QC{4'}","QC{6'}","QC{8'}"};  
18718  TString differentialFlowIndex[4] = {"v'{2}","v'{4}","v'{6}","v'{8}"};  
18719  // Base list: 
18720  TString diffFlow2DListName = "2D"; 
18721  diffFlow2DListName += fAnalysisLabel->Data();
18722  fDiffFlow2D = dynamic_cast<TList*>(fDiffFlowList->FindObject(diffFlow2DListName.Data()));
18723  if(!fDiffFlow2D)
18724  { 
18725   printf("\n WARNING (QC): fDiffFlow2D is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18726   exit(0);
18727  }
18728  // Lists holding profiles with 2D correlations: 
18729  TString s2DDiffFlowCorrelationsProListName = "Profiles with 2D correlations"; 
18730  s2DDiffFlowCorrelationsProListName += fAnalysisLabel->Data(); // to be improved
18731  for(Int_t t=0;t<2;t++)
18732  {
18733   f2DDiffFlowCorrelationsProList[t] = dynamic_cast<TList*>(fDiffFlow2D->FindObject(Form("Profiles with 2D correlations (%s)",typeFlag[t].Data())));
18734   if(!f2DDiffFlowCorrelationsProList[t])
18735   { 
18736    printf("\n WARNING (QC): f2DDiffFlowCorrelationsProList[%i] is NULL in AFAWQC::GPF2DFH() !!!!\n\n",t);
18737    exit(0);
18738   }
18739  } // end of for(Int_t t=0;t<2;t++) 
18740  
18741  // c) Get pointers to 2D differential flow profiles:
18742  TString s2DDiffFlowCorrelationsProName = "f2DDiffFlowCorrelationsPro";
18743  s2DDiffFlowCorrelationsProName += fAnalysisLabel->Data();
18744  for(Int_t t=0;t<2;t++) // type: RP or POI
18745  { 
18746   for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18747   {
18748    f2DDiffFlowCorrelationsPro[t][rci] = dynamic_cast<TProfile2D*>(f2DDiffFlowCorrelationsProList[t]->FindObject(Form("%s, %s, %s",s2DDiffFlowCorrelationsProName.Data(),typeFlag[t].Data(),reducedCorrelationIndex[rci].Data())));
18749    if(!f2DDiffFlowCorrelationsPro[t][rci])
18750    {
18751     printf("\n WARNING (QC): f2DDiffFlowCorrelationsPro[%i][%i] is NULL in AFAWQC::GPF2DFH() !!!!\n\n",t,rci);
18752     exit(0);   
18753    } else
18754      {
18755       this->Set2DDiffFlowCorrelationsPro(f2DDiffFlowCorrelationsPro[t][rci],t,rci);
18756      } 
18757   } // end of for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18758  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI 
18759
18760  // d) Get pointers to 2D differential flow histograms: 
18761  TString s2DDiffFlowCumulantsName = "f2DDiffFlowCumulants";
18762  s2DDiffFlowCumulantsName += fAnalysisLabel->Data();
18763  TString s2DDiffFlowName = "f2DDiffFlow";
18764  s2DDiffFlowName += fAnalysisLabel->Data();
18765  for(Int_t t=0;t<2;t++) // type: RP or POI
18766  { 
18767   for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18768   {
18769    // 2D differential cumulants:
18770    f2DDiffFlowCumulants[t][rci] = dynamic_cast<TH2D*>(f2DDiffFlowCorrelationsProList[t]->FindObject(Form("%s, %s, %s",s2DDiffFlowCumulantsName.Data(),typeFlag[t].Data(),differentialCumulantIndex[rci].Data())));
18771    if(!f2DDiffFlowCumulants[t][rci])
18772    {
18773     printf("\n WARNING (QC): f2DDiffFlowCumulants[%i][%i] is NULL in AFAWQC::GPF2DFH() !!!!\n\n",t,rci);
18774     exit(0);   
18775    } else
18776      {
18777       this->Set2DDiffFlowCumulants(f2DDiffFlowCumulants[t][rci],t,rci);
18778      } 
18779    // 2D differential flow:
18780    f2DDiffFlow[t][rci] = dynamic_cast<TH2D*>(f2DDiffFlowCorrelationsProList[t]->FindObject(Form("%s, %s, %s",s2DDiffFlowName.Data(),typeFlag[t].Data(),differentialFlowIndex[rci].Data())));
18781    if(!f2DDiffFlow[t][rci])
18782    {
18783     printf("\n WARNING (QC): f2DDiffFlow[%i][%i] is NULL in AFAWQC::GPF2DFH() !!!!\n\n",t,rci);
18784     exit(0);   
18785    } else
18786      {
18787       this->Set2DDiffFlow(f2DDiffFlow[t][rci],t,rci);
18788      } 
18789   } // end of for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18790  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI 
18791   
18792 } // end of void AliFlowAnalysisWithQCumulants::GetPointersFor2DDiffFlowHistograms()
18793
18794 //=======================================================================================================================
18795
18796 void AliFlowAnalysisWithQCumulants::GetPointersForOtherDiffCorrelators()
18797 {
18798  // Get pointers for other differential correlators.
18799  //  a) Get pointer to list with other differential correlators;
18800  //  b) Declare local flags;
18801  //  c) Get pointers to other differential profiles.
18802
18803  if(!fCalculateDiffFlow){return;} // TBI: This must eventually be moved somewhere else 
18804
18805  // a) Get pointer to list with other differential correlators:
18806  fOtherDiffCorrelatorsList = dynamic_cast<TList*>(fHistList->FindObject("Other differential correlators"));  
18807  if(!fOtherDiffCorrelatorsList)
18808  { 
18809   printf("\n WARNING (QC): fOtherDiffCorrelatorsList is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18810   exit(0);
18811  }
18812  
18813  // b) Declare local flags: // (to be improved - promoted to data members)
18814  TString typeFlag[2] = {"RP","POI"}; 
18815  TString ptEtaFlag[2] = {"p_{T}","#eta"};
18816  TString sinCosFlag[2] = {"sin","cos"}; 
18817   
18818  // c) Get pointers to other differential profiles:
18819  TString otherDiffCorrelatorsName = "fOtherDiffCorrelators";
18820  otherDiffCorrelatorsName += fAnalysisLabel->Data();
18821  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
18822  { 
18823   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18824   {
18825    for(Int_t sc=0;sc<2;sc++) // sin or cos
18826    {
18827     for(Int_t ci=0;ci<1;ci++) // correlator index
18828     {
18829      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))); 
18830      if(!fOtherDiffCorrelators[t][pe][sc][ci])
18831      {
18832       printf("\n WARNING (QC): fOtherDiffCorrelators[%i][%i][%i][%i] is NULL in AFAWQC::GPFODC() !!!!\n\n",t,pe,sc,ci);
18833       exit(0);       
18834      } else
18835        {
18836         this->SetOtherDiffCorrelators(fOtherDiffCorrelators[t][pe][sc][ci],t,pe,sc,ci);     
18837        } 
18838     } // end of for(Int_t ci=0;ci<1;ci++) // correlator index
18839    } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
18840   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
18841  } // end of for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
18842   
18843 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForOtherDiffCorrelators()
18844
18845 //=======================================================================================================================
18846
18847 void AliFlowAnalysisWithQCumulants::GetPointersForDiffFlowHistograms()
18848 {
18849  // Get pointer to all objects relevant for differential flow.
18850  //  a) Get pointer to base list for differential flow fDiffFlowList;
18851  //  b) Get pointer to profile fDiffFlowFlags holding all flags for differential flow. Access and set some flags;
18852  //  c) Get pointers to nested lists fDiffFlowListProfiles and fDiffFlowListResults;
18853  //  d) Define flags locally (to be improved: should I promote these flags to data members?);
18854  //  e) Get pointers to all nested lists in fDiffFlowListProfiles and to profiles which they hold;
18855  //  f) Get pointers to all nested lists in fDiffFlowListResults and to histograms which they hold.
18856  
18857  // a) Get pointer to base list for differential flow fDiffFlowList:
18858  fDiffFlowList = dynamic_cast<TList*>(fHistList->FindObject("Differential Flow"));  
18859  if(!fDiffFlowList)
18860  { 
18861   printf("\n WARNING (QC): fDiffFlowList is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18862   exit(0);
18863  }
18864  
18865  // b) Get pointer to profile fDiffFlowFlags holding all flags for differential flow. Access and set some flags:
18866  TString diffFlowFlagsName = "fDiffFlowFlags";
18867  diffFlowFlagsName += fAnalysisLabel->Data();
18868  fDiffFlowFlags = dynamic_cast<TProfile*>(fDiffFlowList->FindObject(diffFlowFlagsName.Data()));
18869  if(fDiffFlowFlags)
18870  {
18871   this->SetCalculateDiffFlow((Bool_t)fDiffFlowFlags->GetBinContent(1)); // to be improved - hardwired 1
18872   this->SetCalculateDiffFlowVsEta((Bool_t)fDiffFlowFlags->GetBinContent(6)); // to be improved - hardwired 6
18873  } else
18874    {
18875     printf("\n WARNING (QC): fDiffFlowFlags is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18876     printf("\n             Flags in method Finish() are wrong.\n\n");
18877     exit(0);
18878    } 
18879    
18880  if(!fCalculateDiffFlow){return;} // IMPORTANT: do not move this anywhere above in this method (to be improved)   
18881   
18882  // c) Get pointers to nested lists fDiffFlowListProfiles and fDiffFlowListResults:
18883  //  List holding nested lists holding profiles:
18884  TList *diffFlowListProfiles = NULL;
18885  diffFlowListProfiles = dynamic_cast<TList*>(fDiffFlowList->FindObject("Profiles"));
18886  if(!diffFlowListProfiles)
18887  { 
18888   printf("\n WARNING (QC): diffFlowListProfiles is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18889   exit(0);
18890  }
18891  //  List holding nested lists holding histograms with final results:
18892  TList *diffFlowListResults = NULL;
18893  diffFlowListResults = dynamic_cast<TList*>(fDiffFlowList->FindObject("Results"));
18894  if(!diffFlowListResults)
18895  { 
18896   printf("\n WARNING (QC): diffFlowListResults is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18897   exit(0);
18898  }
18899  
18900  // d) Define flags locally (to be improved: should I promote these flags to data members?):
18901  TString typeFlag[2] = {"RP","POI"}; 
18902  TString ptEtaFlag[2] = {"p_{T}","#eta"};
18903  TString powerFlag[2] = {"linear","quadratic"};
18904  TString sinCosFlag[2] = {"sin","cos"};
18905  TString differentialCumulantIndex[4] = {"QC{2'}","QC{4'}","QC{6'}","QC{8'}"};  
18906  TString differentialFlowIndex[4] = {"v'{2}","v'{4}","v'{6}","v'{8}"};  
18907  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"};
18908  TString reducedSquaredCorrelationIndex[4] = {"<2'>^{2}","<4'>^{2}","<6'>^{2}","<8'>^{2}"}; 
18909  TString mixedCorrelationIndex[8] = {"<2>","<2'>","<4>","<4'>","<6>","<6'>","<8>","<8'>"};
18910  TString covarianceName[5] = {"Cov(<2>,<2'>)","Cov(<2>,<4'>)","Cov(<4>,<2'>)","Cov(<4>,<4'>)","Cov(<2'>,<4'>)"}; 
18911   
18912  // e) Get pointers to all nested lists in fDiffFlowListProfiles and to profiles which they hold:
18913  // correlations:
18914  TList *diffFlowCorrelationsProList[2][2] = {{NULL}};
18915  TString diffFlowCorrelationsProName = "fDiffFlowCorrelationsPro";
18916  diffFlowCorrelationsProName += fAnalysisLabel->Data();
18917  TProfile *diffFlowCorrelationsPro[2][2][4] = {{{NULL}}}; 
18918  // squared correlations:  
18919  TString diffFlowSquaredCorrelationsProName = "fDiffFlowSquaredCorrelationsPro";
18920  diffFlowSquaredCorrelationsProName += fAnalysisLabel->Data(); 
18921  TProfile *diffFlowSquaredCorrelationsPro[2][2][4] = {{{NULL}}};  
18922  // products of correlations:
18923  TList *diffFlowProductOfCorrelationsProList[2][2] = {{NULL}};
18924  TString diffFlowProductOfCorrelationsProName = "fDiffFlowProductOfCorrelationsPro";
18925  diffFlowProductOfCorrelationsProName += fAnalysisLabel->Data();  
18926  TProfile *diffFlowProductOfCorrelationsPro[2][2][8][8] = {{{{NULL}}}};   
18927  // corrections:
18928  TList *diffFlowCorrectionsProList[2][2] = {{NULL}};
18929  TString diffFlowCorrectionTermsForNUAProName = "fDiffFlowCorrectionTermsForNUAPro";
18930  diffFlowCorrectionTermsForNUAProName += fAnalysisLabel->Data();  
18931  TProfile *diffFlowCorrectionTermsForNUAPro[2][2][2][10] = {{{{NULL}}}};   
18932  for(Int_t t=0;t<2;t++)
18933  {
18934   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++)
18935   {
18936    diffFlowCorrelationsProList[t][pe] = dynamic_cast<TList*>(diffFlowListProfiles->FindObject(Form("Profiles with correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18937    if(!diffFlowCorrelationsProList[t][pe])
18938    { 
18939     cout<<"WARNING: diffFlowCorrelationsProList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18940     cout<<"t = "<<t<<endl;
18941     cout<<"pe = "<<pe<<endl;
18942     exit(0);
18943    }
18944    for(Int_t ci=0;ci<4;ci++) // correlation index
18945    {
18946     // reduced correlations:
18947     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())));
18948     if(diffFlowCorrelationsPro[t][pe][ci])
18949     {
18950      this->SetDiffFlowCorrelationsPro(diffFlowCorrelationsPro[t][pe][ci],t,pe,ci);
18951     } else
18952       {
18953        cout<<"WARNING: diffFlowCorrelationsPro[t][pe][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18954        cout<<"t  = "<<t<<endl;
18955        cout<<"pe = "<<pe<<endl;   
18956        cout<<"ci = "<<ci<<endl;
18957       }     
18958     // reduced squared correlations:
18959     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())));
18960     if(diffFlowSquaredCorrelationsPro[t][pe][ci])
18961     {
18962      this->SetDiffFlowSquaredCorrelationsPro(diffFlowSquaredCorrelationsPro[t][pe][ci],t,pe,ci);
18963     } else
18964       {
18965        cout<<"WARNING: diffFlowSquaredCorrelationsPro[t][pe][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18966        cout<<"t  = "<<t<<endl;
18967        cout<<"pe = "<<pe<<endl;   
18968        cout<<"ci = "<<ci<<endl;
18969       }       
18970    } // end of for(Int_t ci=0;ci<4;ci++) // correlation index  
18971    // products of correlations:    
18972    diffFlowProductOfCorrelationsProList[t][pe] = dynamic_cast<TList*>(diffFlowListProfiles->FindObject(Form("Profiles with products of correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()))); 
18973    if(!diffFlowProductOfCorrelationsProList[t][pe])
18974    { 
18975     cout<<"WARNING: ddiffFlowProductOfCorrelationsProList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18976     cout<<"t = "<<t<<endl;
18977     cout<<"pe = "<<pe<<endl;
18978     exit(0);
18979    }
18980    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
18981    {
18982     for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
18983     {
18984      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())));
18985      if(diffFlowProductOfCorrelationsPro[t][pe][mci1][mci2])
18986      {
18987       this->SetDiffFlowProductOfCorrelationsPro(diffFlowProductOfCorrelationsPro[t][pe][mci1][mci2],t,pe,mci1,mci2);
18988      } else
18989        {
18990         cout<<"WARNING: diffFlowProductOfCorrelationsPro[t][pe][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18991         cout<<"t    = "<<t<<endl;
18992         cout<<"pe   = "<<pe<<endl;   
18993         cout<<"mci1 = "<<mci1<<endl;
18994         cout<<"mci2 = "<<mci2<<endl;
18995        }
18996      if(mci1%2 == 0) mci2++; // products which DO NOT include reduced correlations are not stored here
18997     } // end of for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
18998    } // end of for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index    
18999    // corrections:
19000    diffFlowCorrectionsProList[t][pe] = dynamic_cast<TList*>(diffFlowListProfiles->FindObject(Form("Profiles with correction terms for NUA (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
19001    if(!diffFlowCorrectionsProList[t][pe])
19002    { 
19003     cout<<"WARNING: diffFlowCorrectionsProList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19004     cout<<"t = "<<t<<endl;
19005     cout<<"pe = "<<pe<<endl;
19006     exit(0);
19007    }
19008    // correction terms for NUA:
19009    for(Int_t sc=0;sc<2;sc++) // sin or cos
19010    {
19011     for(Int_t cti=0;cti<9;cti++) // correction term index
19012     {
19013      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)));
19014      if(diffFlowCorrectionTermsForNUAPro[t][pe][sc][cti])
19015      {
19016       this->SetDiffFlowCorrectionTermsForNUAPro(diffFlowCorrectionTermsForNUAPro[t][pe][sc][cti],t,pe,sc,cti);
19017      } else
19018        {
19019         cout<<"WARNING: diffFlowCorrectionTermsForNUAPro[t][pe][sc][cti] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19020         cout<<"t   = "<<t<<endl;
19021         cout<<"pe  = "<<pe<<endl;   
19022         cout<<"sc  = "<<sc<<endl;
19023         cout<<"cti = "<<cti<<endl;
19024        }    
19025     } // end of for(Int_t cti=0;cti<9;cti++) // correction term index
19026    } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
19027    // ...
19028   } // end of for(Int_t pe=0;pe<2;pe++)
19029  } // end of for(Int_t t=0;t<2;t++)
19030   
19031  // f) Get pointers to all nested lists in fDiffFlowListResults and to histograms which they hold:
19032  // reduced correlations:
19033  TList *diffFlowCorrelationsHistList[2][2] = {{NULL}};
19034  TString diffFlowCorrelationsHistName = "fDiffFlowCorrelationsHist";
19035  diffFlowCorrelationsHistName += fAnalysisLabel->Data();  
19036  TH1D *diffFlowCorrelationsHist[2][2][4] = {{{NULL}}};
19037  // corrections for NUA:
19038  TList *diffFlowCorrectionsHistList[2][2] = {{NULL}};
19039  TString diffFlowCorrectionTermsForNUAHistName = "fDiffFlowCorrectionTermsForNUAHist";
19040  diffFlowCorrectionTermsForNUAHistName += fAnalysisLabel->Data();  
19041  TH1D *diffFlowCorrectionTermsForNUAHist[2][2][2][10] = {{{{NULL}}}};
19042  // differential Q-cumulants:
19043  TList *diffFlowCumulantsHistList[2][2] = {{NULL}};
19044  TString diffFlowCumulantsName = "fDiffFlowCumulants";
19045  diffFlowCumulantsName += fAnalysisLabel->Data();  
19046  TH1D *diffFlowCumulants[2][2][4] = {{{NULL}}};
19047  // detector bias to differential Q-cumulants:
19048  TList *diffFlowDetectorBiasHistList[2][2] = {{NULL}};
19049  TString diffFlowDetectorBiasName = "fDiffFlowDetectorBias";
19050  diffFlowDetectorBiasName += fAnalysisLabel->Data();  
19051  TH1D *diffFlowDetectorBias[2][2][4] = {{{NULL}}}; 
19052  // differential flow estimates from Q-cumulants:
19053  TList *diffFlowHistList[2][2] = {{NULL}};
19054  TString diffFlowName = "fDiffFlow";
19055  diffFlowName += fAnalysisLabel->Data();  
19056  TH1D *diffFlow[2][2][4] = {{{NULL}}};
19057  // differential covariances:
19058  TList *diffFlowCovariancesHistList[2][2] = {{NULL}};
19059  TString diffFlowCovariancesName = "fDiffFlowCovariances";
19060  diffFlowCovariancesName += fAnalysisLabel->Data();  
19061  TH1D *diffFlowCovariances[2][2][5] = {{{NULL}}};
19062  for(Int_t t=0;t<2;t++) // type: RP or POI
19063  { 
19064   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19065   {
19066    // reduced correlations:
19067    diffFlowCorrelationsHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
19068    if(!diffFlowCorrelationsHistList[t][pe])
19069    { 
19070     cout<<"WARNING: diffFlowCorrelationsHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19071     cout<<"t = "<<t<<endl;
19072     cout<<"pe = "<<pe<<endl;
19073     exit(0);
19074    }
19075    for(Int_t index=0;index<4;index++) 
19076    {
19077     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())));
19078     if(diffFlowCorrelationsHist[t][pe][index])
19079     {
19080      this->SetDiffFlowCorrelationsHist(diffFlowCorrelationsHist[t][pe][index],t,pe,index);
19081     } else 
19082       {
19083        cout<<"WARNING: diffFlowCorrelationsHist[t][pe][index] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19084        cout<<"t     = "<<t<<endl;
19085        cout<<"pe    = "<<pe<<endl;
19086        cout<<"index = "<<index<<endl;
19087        exit(0);       
19088       } 
19089    } // end of for(Int_t index=0;index<4;index++)
19090    // corrections:
19091    diffFlowCorrectionsHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Histograms with correction terms for NUA (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
19092    if(!diffFlowCorrectionsHistList[t][pe])
19093    { 
19094     cout<<"WARNING: diffFlowCorrectionsHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19095     cout<<"t = "<<t<<endl;
19096     cout<<"pe = "<<pe<<endl;
19097     exit(0);
19098    }
19099    // correction terms for NUA:
19100    for(Int_t sc=0;sc<2;sc++) // sin or cos
19101    {
19102     for(Int_t cti=0;cti<9;cti++) // correction term index
19103     {
19104      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)));
19105      if(diffFlowCorrectionTermsForNUAHist[t][pe][sc][cti])
19106      {
19107       this->SetDiffFlowCorrectionTermsForNUAHist(diffFlowCorrectionTermsForNUAHist[t][pe][sc][cti],t,pe,sc,cti);
19108      } else
19109        {
19110         cout<<"WARNING: diffFlowCorrectionTermsForNUAHist[t][pe][sc][cti] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19111         cout<<"t   = "<<t<<endl;
19112         cout<<"pe  = "<<pe<<endl;   
19113         cout<<"sc  = "<<sc<<endl;
19114         cout<<"cti = "<<cti<<endl;
19115        }    
19116     } // end of for(Int_t cti=0;cti<9;cti++) // correction term index
19117    } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
19118    // ...
19119    // differential Q-cumulants:
19120    diffFlowCumulantsHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Differential Q-cumulants (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
19121    if(!diffFlowCumulantsHistList[t][pe])
19122    { 
19123     cout<<"WARNING: diffFlowCumulantsHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19124     cout<<"t  = "<<t<<endl;
19125     cout<<"pe = "<<pe<<endl;
19126     exit(0);
19127    }
19128    for(Int_t index=0;index<4;index++) 
19129    {
19130     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())));
19131     if(diffFlowCumulants[t][pe][index])
19132     {
19133      this->SetDiffFlowCumulants(diffFlowCumulants[t][pe][index],t,pe,index);
19134     } else 
19135       {
19136        cout<<"WARNING: diffFlowCumulants[t][pe][index] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19137        cout<<"t     = "<<t<<endl;
19138        cout<<"pe    = "<<pe<<endl;
19139        cout<<"index = "<<index<<endl;
19140        exit(0);       
19141       } 
19142    } // end of for(Int_t index=0;index<4;index++)
19143    // Detector bias to differential Q-cumulants:
19144    diffFlowDetectorBiasHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Detector bias (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
19145    if(!diffFlowDetectorBiasHistList[t][pe])
19146    { 
19147     cout<<"WARNING: diffFlowDetectorBiasHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19148     cout<<"t  = "<<t<<endl;
19149     cout<<"pe = "<<pe<<endl;
19150     exit(0);
19151    }
19152    for(Int_t index=0;index<4;index++) 
19153    {
19154     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())));
19155     if(diffFlowDetectorBias[t][pe][index])
19156     {
19157      this->SetDiffFlowDetectorBias(diffFlowDetectorBias[t][pe][index],t,pe,index);
19158     } else 
19159       {
19160        cout<<"WARNING: diffFlowDetectorBias[t][pe][index] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19161        cout<<"t     = "<<t<<endl;
19162        cout<<"pe    = "<<pe<<endl;
19163        cout<<"index = "<<index<<endl;
19164        exit(0);       
19165       } 
19166    } // end of for(Int_t index=0;index<4;index++)
19167    // differential flow estimates from Q-cumulants:
19168    diffFlowHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Differential flow (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
19169    if(!diffFlowHistList[t][pe])
19170    { 
19171     cout<<"WARNING: diffFlowHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19172     cout<<"t  = "<<t<<endl;
19173     cout<<"pe = "<<pe<<endl;
19174     exit(0);
19175    }
19176    for(Int_t index=0;index<4;index++) 
19177    {
19178     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())));
19179     if(diffFlow[t][pe][index])
19180     {
19181      this->SetDiffFlow(diffFlow[t][pe][index],t,pe,index);
19182     } else 
19183       {
19184        cout<<"WARNING: diffFlow[t][pe][index] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19185        cout<<"t     = "<<t<<endl;
19186        cout<<"pe    = "<<pe<<endl;
19187        cout<<"index = "<<index<<endl;
19188        exit(0);       
19189       } 
19190    } // end of for(Int_t index=0;index<4;index++)
19191    // differential covariances:
19192    diffFlowCovariancesHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Covariances of correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
19193    if(!diffFlowCovariancesHistList[t][pe])
19194    { 
19195     cout<<"WARNING: diffFlowCovariancesHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19196     cout<<"t  = "<<t<<endl;
19197     cout<<"pe = "<<pe<<endl;
19198     exit(0);
19199    }
19200    for(Int_t covIndex=0;covIndex<5;covIndex++) 
19201    {
19202     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())));
19203     if(diffFlowCovariances[t][pe][covIndex])
19204     {
19205      this->SetDiffFlowCovariances(diffFlowCovariances[t][pe][covIndex],t,pe,covIndex);
19206     } else 
19207       {
19208        cout<<"WARNING: diffFlowCovariances[t][pe][covIndex] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19209        cout<<"t        = "<<t<<endl;
19210        cout<<"pe       = "<<pe<<endl;
19211        cout<<"covIndex = "<<covIndex<<endl;
19212        exit(0);       
19213       } 
19214    } // end of for(Int_t covIndex=0;covIndex<5;covIndex++) // covariance index    
19215   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
19216  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI 
19217  // sum of event weights for reduced correlations:
19218  TList *diffFlowSumOfEventWeightsHistList[2][2][2] = {{{NULL}}};
19219  TString diffFlowSumOfEventWeightsName = "fDiffFlowSumOfEventWeights";
19220  diffFlowSumOfEventWeightsName += fAnalysisLabel->Data();  
19221  TH1D *diffFlowSumOfEventWeights[2][2][2][4] = {{{{NULL}}}};
19222  for(Int_t t=0;t<2;t++) // type is RP or POI
19223  { 
19224   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19225   { 
19226    for(Int_t p=0;p<2;p++) // power of event weights is either 1 or 2
19227    {
19228     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())));
19229     if(!diffFlowSumOfEventWeightsHistList[t][pe][p])
19230     { 
19231      cout<<"WARNING: diffFlowSumOfEventWeightsHistList[t][pe][p] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19232      cout<<"t     = "<<t<<endl;
19233      cout<<"pe    = "<<pe<<endl;
19234      cout<<"power = "<<p<<endl;
19235      exit(0);
19236     }
19237     for(Int_t ew=0;ew<4;ew++) // index of reduced correlation
19238     {
19239      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())));    
19240      if(diffFlowSumOfEventWeights[t][pe][p][ew])
19241      {
19242       this->SetDiffFlowSumOfEventWeights(diffFlowSumOfEventWeights[t][pe][p][ew],t,pe,p,ew);
19243      } else 
19244        {
19245         cout<<"WARNING: diffFlowSumOfEventWeights[t][pe][p][ew] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19246         cout<<"t     = "<<t<<endl;
19247         cout<<"pe    = "<<pe<<endl;
19248         cout<<"power = "<<p<<endl;
19249         cout<<"ew    = "<<ew<<endl;
19250         exit(0);       
19251        } 
19252     }
19253    } // end of for(Int_t p=0;p<2;p++) // power of event weights is either 1 or 2
19254   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
19255  } // end of for(Int_t t=0;t<2;t++) // type is RP or POI
19256  //  
19257  TList *diffFlowSumOfProductOfEventWeightsHistList[2][2] = {{NULL}};
19258  TString diffFlowSumOfProductOfEventWeightsName = "fDiffFlowSumOfProductOfEventWeights";
19259  diffFlowSumOfProductOfEventWeightsName += fAnalysisLabel->Data();  
19260  TH1D *diffFlowSumOfProductOfEventWeights[2][2][8][8] = {{{{NULL}}}};
19261  for(Int_t t=0;t<2;t++) // type is RP or POI
19262  { 
19263   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19264   { 
19265    diffFlowSumOfProductOfEventWeightsHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Sum of products of event weights (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
19266    if(!diffFlowSumOfProductOfEventWeightsHistList[t][pe])
19267    { 
19268     cout<<"WARNING: diffFlowSumOfProductOfEventWeightsHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19269     cout<<"t     = "<<t<<endl;
19270     cout<<"pe    = "<<pe<<endl;
19271     exit(0);
19272    }
19273    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
19274    {
19275     for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
19276     {
19277      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())));    
19278       if(diffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2])
19279       {
19280        this->SetDiffFlowSumOfProductOfEventWeights(diffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2],t,pe,mci1,mci2);
19281       } else 
19282         {
19283          cout<<"WARNING: diffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19284          cout<<"t    = "<<t<<endl;
19285          cout<<"pe   = "<<pe<<endl;
19286          cout<<"mci1 = "<<mci1<<endl;
19287          cout<<"mci2 = "<<mci2<<endl;
19288          exit(0);       
19289         } 
19290      if(mci1%2 == 0) mci2++; // products which DO NOT include reduced correlations are not stored here
19291     } // end of for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
19292    } // end of for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
19293   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
19294  } // end of for(Int_t t=0;t<2;t++) // type is RP or POI
19295
19296 } // end void AliFlowAnalysisWithQCumulants::GetPointersForDiffFlowHistograms()
19297
19298 //=======================================================================================================================
19299
19300 void AliFlowAnalysisWithQCumulants::BookEverythingFor2DDifferentialFlow()
19301 {
19302  // Book all objects needed for 2D differential flow.
19303  //  a) Define flags locally (to be improved: should I promote flags to data members?);
19304  //  b) Book e-b-e quantities;
19305  //  c) Book 2D profiles;
19306  //  d) Book 2D histograms.
19307  
19308  if(!fCalculate2DDiffFlow){return;}
19309
19310  // a) Define flags locally (to be improved: should I promote flags to data members?):
19311  TString typeFlag[2] = {"RP","POI"}; 
19312  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"};
19313  TString differentialCumulantIndex[4] = {"QC{2'}","QC{4'}","QC{6'}","QC{8'}"};  
19314  TString differentialFlowIndex[4] = {"v'{2}","v'{4}","v'{6}","v'{8}"};  
19315   
19316  // b) Book e-b-e quantities: 
19317  TProfile2D styleRe("typeMultiplePowerRe","typeMultiplePowerRe",fnBinsPt,fPtMin,fPtMax,fnBinsEta,fEtaMin,fEtaMax);
19318  TProfile2D styleIm("typeMultiplePowerIm","typeMultiplePowerIm",fnBinsPt,fPtMin,fPtMax,fnBinsEta,fEtaMin,fEtaMax);
19319  for(Int_t t=0;t<3;t++) // typeFlag (0 = RP, 1 = POI, 2 = RP&&POI )
19320  { 
19321   for(Int_t m=0;m<4;m++)
19322   {
19323    for(Int_t k=0;k<9;k++)
19324    {
19325     fReRPQ2dEBE[t][m][k] = (TProfile2D*)styleRe.Clone(Form("typeFlag%dmultiple%dpower%dRe",t,m,k)); 
19326     fImRPQ2dEBE[t][m][k] = (TProfile2D*)styleIm.Clone(Form("typeFlag%dmultiple%dpower%dIm",t,m,k));
19327    }
19328   } 
19329  } 
19330  TProfile2D styleS("typePower","typePower",fnBinsPt,fPtMin,fPtMax,fnBinsEta,fEtaMin,fEtaMax);
19331  for(Int_t t=0;t<3;t++) // typeFlag (0 = RP, 1 = POI, 2 = RP&&POI )
19332  { 
19333   for(Int_t k=0;k<9;k++)
19334   {
19335    fs2dEBE[t][k] = (TProfile2D*)styleS.Clone(Form("typeFlag%dpower%d",t,k));
19336   }
19337  }
19338
19339  // c) Book 2D profiles:
19340  TString s2DDiffFlowCorrelationsProName = "f2DDiffFlowCorrelationsPro";
19341  s2DDiffFlowCorrelationsProName += fAnalysisLabel->Data();
19342  for(Int_t t=0;t<2;t++) // type: RP or POI
19343  { 
19344   for(Int_t rci=0;rci<4;rci++) // reduced correlation index
19345   {
19346    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,"");
19347    f2DDiffFlowCorrelationsPro[t][rci]->Sumw2();
19348    f2DDiffFlowCorrelationsPro[t][rci]->SetXTitle("p_{t}");
19349    f2DDiffFlowCorrelationsPro[t][rci]->SetYTitle("#eta");
19350    f2DDiffFlowCorrelationsProList[t]->Add(f2DDiffFlowCorrelationsPro[t][rci]); 
19351   } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
19352  } // end of for(Int_t t=0;t<2;t++) // type: RP or POIs
19353
19354  // d) Book 2D histograms:
19355  TString s2DDiffFlowCumulantsName = "f2DDiffFlowCumulants";
19356  s2DDiffFlowCumulantsName += fAnalysisLabel->Data();
19357  TString s2DDiffFlowName = "f2DDiffFlow";
19358  s2DDiffFlowName += fAnalysisLabel->Data();
19359  for(Int_t t=0;t<2;t++) // type: RP or POI
19360  { 
19361   for(Int_t rci=0;rci<4;rci++) // reduced correlation index
19362   {
19363    // 2D diferential cumulants:
19364    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);
19365    f2DDiffFlowCumulants[t][rci]->SetXTitle("p_{t}");
19366    f2DDiffFlowCumulants[t][rci]->SetYTitle("#eta");
19367    f2DDiffFlowCorrelationsProList[t]->Add(f2DDiffFlowCumulants[t][rci]); //  to be improved - moved to another list 
19368    // 2D differential flow:
19369    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);
19370    f2DDiffFlow[t][rci]->SetXTitle("p_{t}");
19371    f2DDiffFlow[t][rci]->SetYTitle("#eta");
19372    f2DDiffFlowCorrelationsProList[t]->Add(f2DDiffFlow[t][rci]); //  to be improved - moved to another list 
19373   } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
19374  } // end of for(Int_t t=0;t<2;t++) // type: RP or POIs
19375
19376 } // void AliFlowAnalysisWithQCumulants::BookEverythingFor2DDifferentialFlow()
19377
19378 //=======================================================================================================================
19379
19380 void AliFlowAnalysisWithQCumulants::BookEverythingForDifferentialFlow()
19381 {
19382  // Book all histograms and profiles needed for differential flow.
19383  //  a) Book profile to hold all flags for differential flow;
19384  //  b) Define flags locally (to be improved: should I promote flags to data members?);
19385  //  c) Book e-b-e quantities;
19386  //  d) Book profiles;
19387  //  e) Book histograms holding final results. 
19388  
19389  // a) Book profile to hold all flags for differential flow:
19390  TString diffFlowFlagsName = "fDiffFlowFlags";
19391  diffFlowFlagsName += fAnalysisLabel->Data();
19392  fDiffFlowFlags = new TProfile(diffFlowFlagsName.Data(),"Flags for differential flow",6,0,6);
19393  fDiffFlowFlags->SetTickLength(-0.01,"Y");
19394  fDiffFlowFlags->SetMarkerStyle(25);
19395  fDiffFlowFlags->SetLabelSize(0.04,"X");
19396  fDiffFlowFlags->SetLabelOffset(0.02,"Y");
19397  fDiffFlowFlags->SetStats(kFALSE);
19398  fDiffFlowFlags->GetXaxis()->SetBinLabel(1,"Calculate diff. flow"); 
19399  fDiffFlowFlags->GetXaxis()->SetBinLabel(2,"Particle weights");
19400  fDiffFlowFlags->GetXaxis()->SetBinLabel(3,"Event weights");
19401  fDiffFlowFlags->GetXaxis()->SetBinLabel(4,"Correct for NUA");
19402  fDiffFlowFlags->GetXaxis()->SetBinLabel(5,"Calculate 2D diff. flow");
19403  fDiffFlowFlags->GetXaxis()->SetBinLabel(6,"Calculate diff. flow vs eta");
19404  fDiffFlowList->Add(fDiffFlowFlags);
19405
19406  if(!fCalculateDiffFlow){return;}
19407   
19408  // b) Define flags locally (to be improved: should I promote flags to data members?): 
19409  TString typeFlag[2] = {"RP","POI"}; 
19410  TString ptEtaFlag[2] = {"p_{T}","#eta"};
19411  TString powerFlag[2] = {"linear","quadratic"};
19412  TString sinCosFlag[2] = {"sin","cos"};
19413  TString differentialCumulantIndex[4] = {"QC{2'}","QC{4'}","QC{6'}","QC{8'}"};  
19414  TString differentialFlowIndex[4] = {"v'{2}","v'{4}","v'{6}","v'{8}"};  
19415  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"};
19416  TString reducedSquaredCorrelationIndex[4] = {"<2'>^{2}","<4'>^{2}","<6'>^{2}","<8'>^{2}"};
19417  TString mixedCorrelationIndex[8] = {"<2>","<2'>","<4>","<4'>","<6>","<6'>","<8>","<8'>"};
19418  TString covarianceName[5] = {"Cov(<2>,<2'>)","Cov(<2>,<4'>)","Cov(<4>,<2'>)","Cov(<4>,<4'>)","Cov(<2'>,<4'>)"}; 
19419  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
19420  Double_t minPtEta[2] = {fPtMin,fEtaMin};
19421  Double_t maxPtEta[2] = {fPtMax,fEtaMax};
19422    
19423  // c) Book e-b-e quantities:
19424  // Event-by-event r_{m*n,k}(pt,eta), p_{m*n,k}(pt,eta) and q_{m*n,k}(pt,eta)
19425  // Explanantion of notation:
19426  //  1.) n is harmonic, m is multiple of harmonic;
19427  //  2.) k is power of particle weight;
19428  //  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);   
19429  //  4.) p_{m*n,k}(pt,eta) = Q-vector evaluated in harmonic m*n for POIs in particular (pt,eta) bin 
19430  //                          (if i-th POI is also RP, than it is weighted with w_i^k);   
19431  //  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 
19432  //                          (i-th RP&&POI is weighted with w_i^k)            
19433   
19434  // 1D:
19435  for(Int_t t=0;t<3;t++) // typeFlag (0 = RP, 1 = POI, 2 = RP && POI )
19436  { 
19437   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19438   {
19439    for(Int_t m=0;m<4;m++) // multiple of harmonic
19440    {
19441     for(Int_t k=0;k<9;k++) // power of particle weight
19442     {
19443      fReRPQ1dEBE[t][pe][m][k] = new TProfile(Form("TypeFlag%dpteta%dmultiple%dpower%dRe",t,pe,m,k),
19444                                              Form("TypeFlag%dpteta%dmultiple%dpower%dRe",t,pe,m,k),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
19445      fImRPQ1dEBE[t][pe][m][k] = new TProfile(Form("TypeFlag%dpteta%dmultiple%dpower%dIm",t,pe,m,k),
19446                                              Form("TypeFlag%dpteta%dmultiple%dpower%dIm",t,pe,m,k),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
19447     }
19448    }
19449   }
19450  } 
19451  // to be improved (add explanation of fs1dEBE[t][pe][k]):   
19452  for(Int_t t=0;t<3;t++) // typeFlag (0 = RP, 1 = POI, 2 = RP&&POI )
19453  { 
19454   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19455   {
19456    for(Int_t k=0;k<9;k++) // power of particle weight
19457    {
19458     fs1dEBE[t][pe][k] = new TProfile(Form("TypeFlag%dpteta%dmultiple%d",t,pe,k),
19459                                      Form("TypeFlag%dpteta%dmultiple%d",t,pe,k),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
19460    }
19461   }
19462  }
19463  // correction terms for nua:
19464  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
19465  { 
19466   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19467   {
19468    for(Int_t sc=0;sc<2;sc++) // sin or cos
19469    {
19470     for(Int_t cti=0;cti<9;cti++) // correction term index
19471     {
19472      fDiffFlowCorrectionTermsForNUAEBE[t][pe][sc][cti] = new TH1D(Form("typeFlag%d pteta%d sincos%d cti%d",t,pe,sc,cti),
19473                                              Form("typeFlag%d pteta%d sincos%d cti%d",t,pe,sc,cti),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
19474     }
19475    }
19476   }
19477  } 
19478  // reduced correlations e-b-e:
19479  TString diffFlowCorrelationsEBEName = "fDiffFlowCorrelationsEBE";
19480  diffFlowCorrelationsEBEName += fAnalysisLabel->Data();
19481  for(Int_t t=0;t<2;t++) // type: RP or POI
19482  { 
19483   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19484   {
19485    for(Int_t rci=0;rci<4;rci++) // reduced correlation index
19486    {
19487     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]);
19488    } // end of for(Int_t ci=0;ci<4;ci++) // correlation index
19489   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
19490  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
19491  // event weights for reduced correlations e-b-e:
19492  TString diffFlowEventWeightsForCorrelationsEBEName = "fDiffFlowEventWeightsForCorrelationsEBE";
19493  diffFlowEventWeightsForCorrelationsEBEName += fAnalysisLabel->Data();
19494  for(Int_t t=0;t<2;t++) // type: RP or POI
19495  { 
19496   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19497   {
19498    for(Int_t rci=0;rci<4;rci++) // event weight for reduced correlation index
19499    {
19500     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]);
19501    } // end of for(Int_t ci=0;ci<4;ci++) // correlation index
19502   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
19503  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
19504       
19505  // d) Book profiles;
19506  // reduced correlations:
19507  TString diffFlowCorrelationsProName = "fDiffFlowCorrelationsPro";
19508  diffFlowCorrelationsProName += fAnalysisLabel->Data();
19509  // reduced squared correlations:
19510  TString diffFlowSquaredCorrelationsProName = "fDiffFlowSquaredCorrelationsPro";
19511  diffFlowSquaredCorrelationsProName += fAnalysisLabel->Data();
19512  // corrections terms:
19513  TString diffFlowCorrectionTermsForNUAProName = "fDiffFlowCorrectionTermsForNUAPro";
19514  diffFlowCorrectionTermsForNUAProName += fAnalysisLabel->Data();
19515  // reduced correlations:
19516  for(Int_t t=0;t<2;t++) // type: RP or POI
19517  { 
19518   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19519   {
19520    for(Int_t rci=0;rci<4;rci++) // reduced correlation index
19521    {
19522     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");
19523     fDiffFlowCorrelationsPro[t][pe][rci]->Sumw2();
19524     fDiffFlowCorrelationsPro[t][pe][rci]->SetXTitle(ptEtaFlag[pe].Data());
19525     fDiffFlowCorrelationsProList[t][pe]->Add(fDiffFlowCorrelationsPro[t][pe][rci]); // to be improved (add dedicated list to hold reduced correlations)
19526    } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
19527   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
19528  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
19529  // reduced squared correlations:
19530  for(Int_t t=0;t<2;t++) // type: RP or POI
19531  { 
19532   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19533   {
19534    for(Int_t rci=0;rci<4;rci++) // reduced correlation index
19535    {
19536     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");
19537     fDiffFlowSquaredCorrelationsPro[t][pe][rci]->Sumw2();
19538     fDiffFlowSquaredCorrelationsPro[t][pe][rci]->SetXTitle(ptEtaFlag[pe].Data());
19539     fDiffFlowCorrelationsProList[t][pe]->Add(fDiffFlowSquaredCorrelationsPro[t][pe][rci]); // to be improved (add dedicated list to hold reduced correlations)
19540    } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
19541   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
19542  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
19543  // correction terms for nua:
19544  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
19545  { 
19546   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19547   {
19548    for(Int_t sc=0;sc<2;sc++) // sin or cos
19549    {
19550     for(Int_t cti=0;cti<9;cti++) // correction term index
19551     {
19552      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]); 
19553      fDiffFlowCorrectionsProList[t][pe]->Add(fDiffFlowCorrectionTermsForNUAPro[t][pe][sc][cti]);
19554     }
19555    }
19556   }
19557  } 
19558  // Other differential correlators:
19559  TString otherDiffCorrelatorsName = "fOtherDiffCorrelators";
19560  otherDiffCorrelatorsName += fAnalysisLabel->Data();
19561  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
19562  { 
19563   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19564   {
19565    for(Int_t sc=0;sc<2;sc++) // sin or cos
19566    {
19567     for(Int_t ci=0;ci<1;ci++) // correlator index
19568     {
19569      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]); 
19570      fOtherDiffCorrelators[t][pe][sc][ci]->Sumw2();
19571      fOtherDiffCorrelatorsList->Add(fOtherDiffCorrelators[t][pe][sc][ci]);
19572     }
19573    }
19574   }
19575  }  
19576  // e) Book histograms holding final results. 
19577  // reduced correlations:
19578  TString diffFlowCorrelationsHistName = "fDiffFlowCorrelationsHist";
19579  diffFlowCorrelationsHistName += fAnalysisLabel->Data();
19580  // corrections terms:
19581  TString diffFlowCorrectionTermsForNUAHistName = "fDiffFlowCorrectionTermsForNUAHist";
19582  diffFlowCorrectionTermsForNUAHistName += fAnalysisLabel->Data();
19583  // differential covariances:
19584  TString diffFlowCovariancesName = "fDiffFlowCovariances";
19585  diffFlowCovariancesName += fAnalysisLabel->Data();
19586  // differential Q-cumulants:
19587  TString diffFlowCumulantsName = "fDiffFlowCumulants";
19588  diffFlowCumulantsName += fAnalysisLabel->Data();
19589  // Detector bias to differential Q-cumulants:
19590  TString diffFlowDetectorBiasName = "fDiffFlowDetectorBias";
19591  diffFlowDetectorBiasName += fAnalysisLabel->Data();
19592  // differential flow:
19593  TString diffFlowName = "fDiffFlow";
19594  diffFlowName += fAnalysisLabel->Data();
19595  for(Int_t t=0;t<2;t++) // type: RP or POI
19596  { 
19597   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19598   {
19599    for(Int_t index=0;index<4;index++) 
19600    {
19601     // reduced correlations:
19602     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]);
19603     fDiffFlowCorrelationsHist[t][pe][index]->SetXTitle(ptEtaFlag[pe].Data());
19604     fDiffFlowCorrelationsHistList[t][pe]->Add(fDiffFlowCorrelationsHist[t][pe][index]); 
19605     // differential Q-cumulants:
19606     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]);
19607     fDiffFlowCumulants[t][pe][index]->SetXTitle(ptEtaFlag[pe].Data());
19608     fDiffFlowCumulantsHistList[t][pe]->Add(fDiffFlowCumulants[t][pe][index]); 
19609     // Detector bias to differential Q-cumulants:
19610     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]);
19611     fDiffFlowDetectorBias[t][pe][index]->SetXTitle(ptEtaFlag[pe].Data());
19612     fDiffFlowDetectorBias[t][pe][index]->SetTitle(Form("#frac{corrected}{measured} %s",differentialCumulantIndex[index].Data()));
19613     fDiffFlowDetectorBiasHistList[t][pe]->Add(fDiffFlowDetectorBias[t][pe][index]); 
19614     // differential flow estimates from Q-cumulants:
19615     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]);
19616     fDiffFlow[t][pe][index]->SetXTitle(ptEtaFlag[pe].Data());
19617     fDiffFlowHistList[t][pe]->Add(fDiffFlow[t][pe][index]); 
19618    } // end of for(Int_t index=0;index<4;index++) 
19619    for(Int_t covIndex=0;covIndex<5;covIndex++) // covariance index 
19620    {
19621     // differential covariances:
19622     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]);
19623     fDiffFlowCovariances[t][pe][covIndex]->SetXTitle(ptEtaFlag[pe].Data());
19624     fDiffFlowCovariancesHistList[t][pe]->Add(fDiffFlowCovariances[t][pe][covIndex]); 
19625    } // end of for(Int_t covIndex=0;covIndex<5;covIndex++) // covariance index
19626    // products of both types of correlations: 
19627    TString diffFlowProductOfCorrelationsProName = "fDiffFlowProductOfCorrelationsPro";
19628    diffFlowProductOfCorrelationsProName += fAnalysisLabel->Data();  
19629    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
19630    {
19631     for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
19632     {
19633      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]); 
19634      fDiffFlowProductOfCorrelationsPro[t][pe][mci1][mci2]->SetXTitle(ptEtaFlag[pe].Data());
19635      fDiffFlowProductOfCorrelationsProList[t][pe]->Add(fDiffFlowProductOfCorrelationsPro[t][pe][mci1][mci2]); 
19636      if(mci1%2 == 0) mci2++; // products which DO NOT include reduced correlations are not stored here
19637     } // end of for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
19638    } // end of for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index    
19639   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
19640  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
19641  // sums of event weights for reduced correlations: 
19642  TString diffFlowSumOfEventWeightsName = "fDiffFlowSumOfEventWeights";
19643  diffFlowSumOfEventWeightsName += fAnalysisLabel->Data();  
19644  for(Int_t t=0;t<2;t++) // type is RP or POI
19645  { 
19646   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19647   { 
19648    for(Int_t p=0;p<2;p++) // power of weights is either 1 or 2
19649    {
19650     for(Int_t ew=0;ew<4;ew++) // index of reduced correlation
19651     {
19652      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]); 
19653      fDiffFlowSumOfEventWeights[t][pe][p][ew]->SetXTitle(ptEtaFlag[pe].Data());
19654      fDiffFlowSumOfEventWeightsHistList[t][pe][p]->Add(fDiffFlowSumOfEventWeights[t][pe][p][ew]); // to be improved (add dedicated list to hold all this)
19655     }
19656    }
19657   }
19658  } 
19659  // sum of products of event weights for both types of correlations: 
19660  TString diffFlowSumOfProductOfEventWeightsName = "fDiffFlowSumOfProductOfEventWeights";
19661  diffFlowSumOfProductOfEventWeightsName += fAnalysisLabel->Data();  
19662  for(Int_t t=0;t<2;t++) // type is RP or POI
19663  {
19664   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19665   { 
19666    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
19667    {
19668     for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
19669     {
19670      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]); 
19671      fDiffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2]->SetXTitle(ptEtaFlag[pe].Data());
19672      fDiffFlowSumOfProductOfEventWeightsHistList[t][pe]->Add(fDiffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2]); 
19673      if(mci1%2 == 0) mci2++; // products which DO NOT include reduced correlations are not stored here
19674     }
19675    }
19676   }
19677  } 
19678  // correction terms for nua:
19679  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
19680  { 
19681   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19682   {
19683    for(Int_t sc=0;sc<2;sc++) // sin or cos
19684    {
19685     for(Int_t cti=0;cti<9;cti++) // correction term index
19686     {
19687      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]); 
19688      fDiffFlowCorrectionsHistList[t][pe]->Add(fDiffFlowCorrectionTermsForNUAHist[t][pe][sc][cti]);
19689     }
19690    }
19691   }
19692  } 
19693           
19694 } // end of AliFlowAnalysisWithQCumulants::BookEverythingForDifferentialFlow()
19695
19696 //=======================================================================================================================
19697
19698 void AliFlowAnalysisWithQCumulants::CalculateQcumulantsCorrectedForNUAIntFlow()
19699 {
19700  // Calculate generalized Q-cumulants (cumulants corrected for non-unifom acceptance).
19701  
19702  // Isotropic cumulants:
19703  Double_t QC2 = fIntFlowQcumulants->GetBinContent(1);
19704  Double_t QC2Error = fIntFlowQcumulants->GetBinError(1);
19705  Double_t QC4 = fIntFlowQcumulants->GetBinContent(2);
19706  Double_t QC4Error = fIntFlowQcumulants->GetBinError(2);
19707  //Double_t QC6 = fIntFlowQcumulants->GetBinContent(3);
19708  //Double_t QC6Error = fIntFlowQcumulants->GetBinError(3);
19709  //Double_t QC8 = fIntFlowQcumulants->GetBinContent(4);
19710  //Double_t QC8Error = fIntFlowQcumulants->GetBinError(4);
19711  
19712  // Measured 2-, 4-, 6- and 8-particle correlations:
19713  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>>
19714  Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1); // statistical error of <<2>>
19715  Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>>
19716  Double_t fourError = fIntFlowCorrelationsHist->GetBinError(2); // statistical error of <<4>>
19717  //Double_t six = fIntFlowCorrelationsHist->GetBinContent(3); // <<6>>
19718  //Double_t sixError = fIntFlowCorrelationsHist->GetBinError(3); // statistical error of <<6>>
19719  //Double_t eight = fIntFlowCorrelationsHist->GetBinContent(4); // <<8>>
19720  //Double_t eightError = fIntFlowCorrelationsHist->GetBinError(4); // statistical error of <<8>>
19721   
19722  // Non-isotropic terms:
19723  Double_t c1 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(1); // <<cos(n*phi1)>>
19724  Double_t c1Error = fIntFlowCorrectionTermsForNUAHist[1]->GetBinError(1); // statistical error of <<cos(n*phi1)>>
19725  Double_t c2 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(2); // <<cos(n*(phi1+phi2))>>
19726  Double_t c2Error = fIntFlowCorrectionTermsForNUAHist[1]->GetBinError(2); // statistical error of <<cos(n*(phi1+phi2))>>
19727  Double_t c3 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(3); // <<cos(n*(phi1-phi2-phi3))>>
19728  Double_t c3Error = fIntFlowCorrectionTermsForNUAHist[1]->GetBinError(3); // statistical error of <<cos(n*(phi1-phi2-phi3))>>
19729  Double_t s1 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(1); // <<sin(n*phi1)>>
19730  Double_t s1Error = fIntFlowCorrectionTermsForNUAHist[0]->GetBinError(1); // statistical error of <<sin(n*phi1)>>
19731  Double_t s2 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(2); // <<sin(n*(phi1+phi2))>>
19732  Double_t s2Error = fIntFlowCorrectionTermsForNUAHist[0]->GetBinError(2); // statistical error of <<sin(n*(phi1+phi2))>>
19733  Double_t s3 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(3); // <<sin(n*(phi1-phi2-phi3))>>
19734  Double_t s3Error = fIntFlowCorrectionTermsForNUAHist[0]->GetBinError(3); // statistical error of <<sin(n*(phi1-phi2-phi3))>>
19735  
19736  // Shortcuts:
19737  Double_t a1 = 2.*pow(c1,2.)+2.*pow(s1,2.)-two;
19738  Double_t a2 = 6.*pow(c1,3.)-2.*c1*c2+c3+6.*c1*pow(s1,2.)-2.*s1*s2-4.*c1*two;
19739  Double_t a3 = 2.*pow(s1,2.)-2.*pow(c1,2.)+c2;
19740  Double_t a4 = 6.*pow(s1,3.)+6.*pow(c1,2.)*s1+2.*c2*s1-2.*c1*s2-s3-4.*s1*two;
19741  Double_t a5 = 4.*c1*s1-s2;
19742  
19743  // Covariances (including weight dependent prefactor):
19744  Double_t wCov1 = 0.; // w*Cov(<2>,<cos(phi)) 
19745  Double_t wCov2 = 0.; // w*Cov(<2>,<sin(phi))
19746  Double_t wCov3 = 0.; // w*Cov(<cos(phi),<sin(phi))
19747  Double_t wCov4 = 0.; // w*Cov(<2>,<4>) 
19748  Double_t wCov5 = 0.; // w*Cov(<2>,<cos(#phi_{1}+#phi_{2})>)
19749  Double_t wCov6 = 0.; // w*Cov(<2>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19750  Double_t wCov7 = 0.; // w*Cov(<2>,<sin(#phi_{1}+#phi_{2})>)
19751  Double_t wCov8 = 0.; // w*Cov(<2>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19752  Double_t wCov9 = 0.; // w*Cov(<4>,<cos(#phi)>
19753  Double_t wCov10 = 0.; // w*Cov(<4>,<cos(#phi_{1}+#phi_{2})>)
19754  Double_t wCov11 = 0.; // w*Cov(<4>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19755  Double_t wCov12 = 0.; // w*Cov(<4>,<sin(#phi)>
19756  Double_t wCov13 = 0.; // w*Cov(<4>,<sin(#phi_{1}+#phi_{2})>)
19757  Double_t wCov14 = 0.; // w*Cov(<4>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19758  Double_t wCov15 = 0.; // w*Cov(<cos(#phi)>,<cos(#phi_{1}+#phi_{2})>)
19759  Double_t wCov16 = 0.; // w*Cov(<cos(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19760  Double_t wCov17 = 0.; // w*Cov(<cos(#phi)>,<sin(#phi_{1}+#phi_{2})>)
19761  Double_t wCov18 = 0.; // w*Cov(<cos(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19762  Double_t wCov19 = 0.; // w*Cov(<cos(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19763  Double_t wCov20 = 0.; // w*Cov(<sin(#phi)>,<cos(#phi_{1}+#phi_{2})>)
19764  Double_t wCov21 = 0.; // w*Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}+#phi_{2})>)
19765  Double_t wCov22 = 0.; // w*Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19766  Double_t wCov23 = 0.; // w*Cov(<sin(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19767  Double_t wCov24 = 0.; // w*Cov(<sin(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19768  Double_t wCov25 = 0.; // w*Cov(<cos(#phi_{1}-#phi_{2}-#phi_{3}>,<sin(#phi_{1}-#phi_{2}-#phi_{3}>)
19769  Double_t wCov26 = 0.; // w*Cov(<sin(#phi)>,<sin(#phi_{1}+#phi_{2})>)
19770  Double_t wCov27 = 0.; // w*Cov(<sin(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19771  Double_t wCov28 = 0.; // w*Cov(<sin(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19772  if(!fForgetAboutCovariances)
19773  {
19774   wCov1 = fIntFlowCovariancesNUA->GetBinContent(1); // w*Cov(<2>,<cos(phi)) 
19775   wCov2 = fIntFlowCovariancesNUA->GetBinContent(2); // w*Cov(<2>,<sin(phi))
19776   wCov3 = fIntFlowCovariancesNUA->GetBinContent(3); // w*Cov(<cos(phi),<sin(phi))
19777   wCov4 = fIntFlowCovariances->GetBinContent(1); // w*Cov(<2>,<4>) 
19778   wCov5 = fIntFlowCovariancesNUA->GetBinContent(4); // w*Cov(<2>,<cos(#phi_{1}+#phi_{2})>)
19779   wCov6 = fIntFlowCovariancesNUA->GetBinContent(6); // w*Cov(<2>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19780   wCov7 = fIntFlowCovariancesNUA->GetBinContent(5); // w*Cov(<2>,<sin(#phi_{1}+#phi_{2})>)
19781   wCov8 = fIntFlowCovariancesNUA->GetBinContent(7); // w*Cov(<2>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19782   wCov9 = fIntFlowCovariancesNUA->GetBinContent(8); // w*Cov(<4>,<cos(#phi)>
19783   wCov10 = fIntFlowCovariancesNUA->GetBinContent(10); // w*Cov(<4>,<cos(#phi_{1}+#phi_{2})>)
19784   wCov11 = fIntFlowCovariancesNUA->GetBinContent(12); // w*Cov(<4>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19785   wCov12 = fIntFlowCovariancesNUA->GetBinContent(9); // w*Cov(<4>,<sin(#phi)>
19786   wCov13 = fIntFlowCovariancesNUA->GetBinContent(11); // w*Cov(<4>,<sin(#phi_{1}+#phi_{2})>)
19787   wCov14 = fIntFlowCovariancesNUA->GetBinContent(13); // w*Cov(<4>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19788   wCov15 = fIntFlowCovariancesNUA->GetBinContent(14); // w*Cov(<cos(#phi)>,<cos(#phi_{1}+#phi_{2})>)
19789   wCov16 = fIntFlowCovariancesNUA->GetBinContent(16); // w*Cov(<cos(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19790   wCov17 = fIntFlowCovariancesNUA->GetBinContent(15); // w*Cov(<cos(#phi)>,<sin(#phi_{1}+#phi_{2})>)
19791   wCov18 = fIntFlowCovariancesNUA->GetBinContent(17); // w*Cov(<cos(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19792   wCov19 = fIntFlowCovariancesNUA->GetBinContent(23); // w*Cov(<cos(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19793   wCov20 = fIntFlowCovariancesNUA->GetBinContent(18); // w*Cov(<sin(#phi)>,<cos(#phi_{1}+#phi_{2})>)
19794   wCov21 = fIntFlowCovariancesNUA->GetBinContent(22); // w*Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}+#phi_{2})>)
19795   wCov22 = fIntFlowCovariancesNUA->GetBinContent(24); // w*Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19796   wCov23 = fIntFlowCovariancesNUA->GetBinContent(20); // w*Cov(<sin(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19797   wCov24 = fIntFlowCovariancesNUA->GetBinContent(25); // w*Cov(<sin(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19798   wCov25 = fIntFlowCovariancesNUA->GetBinContent(27); // w*Cov(<cos(#phi_{1}-#phi_{2}-#phi_{3}>,<sin(#phi_{1}-#phi_{2}-#phi_{3}>)
19799   wCov26 = fIntFlowCovariancesNUA->GetBinContent(19); // w*Cov(<sin(#phi)>,<sin(#phi_{1}+#phi_{2})>)
19800   wCov27 = fIntFlowCovariancesNUA->GetBinContent(21); // w*Cov(<sin(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19801   wCov28 = fIntFlowCovariancesNUA->GetBinContent(26); // w*Cov(<sin(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19802  } // end of if(!fForgetAboutCovariances)
19803  
19804  // Calculating generalized QC{2}:
19805  //  Generalized QC{2}:
19806  Double_t gQC2 = two - pow(c1,2.) - pow(s1,2.);
19807  if(fApplyCorrectionForNUA){fIntFlowQcumulants->SetBinContent(1,gQC2);} 
19808  //  Statistical error of generalized QC{2}:
19809  Double_t gQC2ErrorSquared = pow(twoError,2.)+4.*pow(c1,2.)*pow(c1Error,2.)
19810                            + 4.*pow(s1,2.)*pow(s1Error,2.)
19811                            - 4*c1*wCov1-4*s1*wCov2 
19812                            + 8.*c1*s1*wCov3;
19813  //  Store ratio of error squared - with/without NUA terms:
19814  Double_t ratioErrorSquaredQC2 = 0.;
19815  if(fIntFlowQcumulants->GetBinError(1)>0.)
19816  { 
19817   ratioErrorSquaredQC2 = (gQC2ErrorSquared/pow(fIntFlowQcumulants->GetBinError(1),2.));
19818   fIntFlowQcumulantsErrorSquaredRatio->SetBinContent(1,ratioErrorSquaredQC2);
19819  }
19820  //  If enabled, store error by including non-isotropic terms:                         
19821  if(fApplyCorrectionForNUA && fPropagateErrorAlsoFromNIT)
19822  {
19823   if(gQC2ErrorSquared>=0.)
19824   {
19825    fIntFlowQcumulants->SetBinError(1,pow(gQC2ErrorSquared,0.5));
19826   } else
19827     {
19828      fIntFlowQcumulants->SetBinError(1,0.);
19829      cout<<endl;
19830      cout<<" WARNING (QC): Statistical error of generalized QC{2} is imaginary !!!!"<<endl;
19831      cout<<endl;
19832     }   
19833  } // end of if(fApplyCorrectionForNUA && fPropagateErrorAlsoFromNIT)
19834  // Quantify detector bias to QC{2}:
19835  if(TMath::Abs(QC2)>0.)
19836  {
19837   fIntFlowDetectorBias->SetBinContent(1,gQC2/QC2); 
19838   if(QC2Error>0.)
19839   {
19840    Double_t errorSquared = gQC2ErrorSquared/pow(QC2,2.)+pow(gQC2,2.)*pow(QC2Error,2.)/pow(QC2,4.);
19841    if(errorSquared>0.)
19842    {
19843     fIntFlowDetectorBias->SetBinError(1,pow(errorSquared,0.5));  
19844    }
19845   }
19846  } // end of if(TMath::Abs(QC2)>0.)
19847
19848  // Calculating generalized QC{4}:
19849  //  Generalized QC{4}:
19850  Double_t gQC4 = four-2.*pow(two,2.)
19851                - 4.*c1*c3+4.*s1*s3-pow(c2,2.)-pow(s2,2.)
19852                + 4.*c2*(pow(c1,2.)-pow(s1,2.))+8.*s2*s1*c1
19853                + 8.*two*(pow(c1,2.)+pow(s1,2.))-6.*pow((pow(c1,2.)+pow(s1,2.)),2.);
19854  if(fApplyCorrectionForNUA){fIntFlowQcumulants->SetBinContent(2,gQC4);}   
19855  //  Statistical error of generalized QC{4}:
19856  Double_t gQC4ErrorSquared = 16.*pow(a1,2.)*pow(twoError,2.)+pow(fourError,2.)+16.*pow(a2,2.)*pow(c1Error,2.)
19857                            + 4.*pow(a3,2.)*pow(c2Error,2.)+16.*pow(c1,2.)*pow(c3Error,2.)
19858                            + 16.*pow(a4,2.)*pow(s1Error,2.)+4.*pow(a5,2.)*pow(s2Error,2.)
19859                            + 16.*pow(s1,2.)*pow(s3Error,2.)+8.*a1*wCov4-32.*a1*a2*wCov1
19860                            - 16.*a3*a1*wCov5-32.*c1*a1*wCov6-32.*a1*a4*wCov2+16.*a5*a1*wCov7
19861                            + 32.*s1*a1*wCov8-8.*a2*wCov9-4.*a3*wCov10-8.*c1*wCov11-8.*a4*wCov12
19862                            + 4.*a5*wCov13+8.*s1*wCov14+16.*a3*a2*wCov15+32.*c1*a2*wCov16+32.*a2*a4*wCov3
19863                            - 16.*a5*a2*wCov17-32.*s1*a2*wCov18+16.*c1*a3*wCov19+16.*a3*a4*wCov20
19864                            - 8.*a3*a5*wCov21-16.*s1*a3*wCov22+32.*c1*a4*wCov23-16.*c1*a5*wCov24
19865                            - 32.*c1*s1*wCov25-16.*a5*a4*wCov26-32.*s1*a4*wCov27+16.*s1*a5*wCov28;
19866  //  Store ratio of error squared - with/without NUA terms:
19867  Double_t ratioErrorSquaredQC4 = 0.;
19868  if(fIntFlowQcumulants->GetBinError(2)>0.)
19869  { 
19870   ratioErrorSquaredQC4 = (gQC4ErrorSquared/pow(fIntFlowQcumulants->GetBinError(2),2.));
19871   fIntFlowQcumulantsErrorSquaredRatio->SetBinContent(2,ratioErrorSquaredQC4);
19872  }                          
19873  if(fApplyCorrectionForNUA && fPropagateErrorAlsoFromNIT)
19874  {
19875   if(gQC4ErrorSquared>=0.)
19876   {
19877    fIntFlowQcumulants->SetBinError(2,pow(gQC4ErrorSquared,0.5));
19878   } else
19879     {
19880      fIntFlowQcumulants->SetBinError(2,0.);
19881      cout<<endl;
19882      cout<<" WARNING (QC): Statistical error of generalized QC{4} is imaginary !!!!"<<endl;
19883      cout<<endl;
19884     }   
19885  } // end of if(fApplyCorrectionForNUA && fPropagateErrorAlsoFromNIT)
19886  // Quantify detector bias to QC{4}:
19887  if(TMath::Abs(QC4)>0.)
19888  {
19889   fIntFlowDetectorBias->SetBinContent(2,gQC4/QC4); 
19890   if(QC4Error>0.)
19891   {
19892    Double_t errorSquared = gQC4ErrorSquared/pow(QC4,2.)+pow(gQC4,2.)*pow(QC4Error,2.)/pow(QC4,4.);
19893    if(errorSquared>0.)
19894    {
19895     fIntFlowDetectorBias->SetBinError(2,pow(errorSquared,0.5));  
19896    }
19897   }
19898  } // end of if(TMath::Abs(QC4)>0.)
19899
19900
19901  // .... to be improved (continued for 6th and 8th order) ....            
19902  
19903      
19904  // versus multiplicity:
19905  if(fCalculateCumulantsVsM) // to be improved - propagate error for nua terms vs M
19906  { 
19907   Int_t nBins = fIntFlowCorrelationsVsMPro[0]->GetNbinsX(); // to be improved (hardwired 0) 
19908   Double_t value[4] = {0.}; // QCs vs M
19909   Double_t error[4] = {0.}; // error of QCs vs M
19910   Double_t dSum1[4] = {0.}; // sum value_i/(error_i)^2
19911   Double_t dSum2[4] = {0.}; // sum 1/(error_i)^2
19912   for(Int_t b=1;b<=nBins;b++)
19913   {
19914    // Measured correlations:
19915    two = fIntFlowCorrelationsVsMHist[0]->GetBinContent(b); // <<2>> vs M
19916    four = fIntFlowCorrelationsVsMHist[1]->GetBinContent(b); // <<4>> vs M
19917    // Isotropic cumulants:
19918    QC2 = two;
19919    QC4 = four-2.*pow(two,2.);
19920    // Non-isotropic terms:
19921    c1 = fIntFlowCorrectionTermsForNUAVsMPro[1][0]->GetBinContent(b); // <<cos(n*phi1)>>
19922    c2 = fIntFlowCorrectionTermsForNUAVsMPro[1][1]->GetBinContent(b); // <<cos(n*(phi1+phi2))>>
19923    c3 = fIntFlowCorrectionTermsForNUAVsMPro[1][2]->GetBinContent(b); // <<cos(n*(phi1-phi2-phi3))>>
19924    s1 = fIntFlowCorrectionTermsForNUAVsMPro[0][0]->GetBinContent(b); // <<sin(n*phi1)>>
19925    s2 = fIntFlowCorrectionTermsForNUAVsMPro[0][1]->GetBinContent(b); // <<sin(n*(phi1+phi2))>>
19926    s3 = fIntFlowCorrectionTermsForNUAVsMPro[0][2]->GetBinContent(b); // <<sin(n*(phi1-phi2-phi3))>>
19927    // Generalized QC{2} vs M:
19928    gQC2 = two - pow(c1,2.) - pow(s1,2.); 
19929    if(fApplyCorrectionForNUAVsM){fIntFlowQcumulantsVsM[0]->SetBinContent(b,gQC2);}   
19930    // Generalized QC{4} vs M:  
19931    gQC4 = four-2.*pow(two,2.)
19932                  - 4.*c1*c3+4.*s1*s3-pow(c2,2.)-pow(s2,2.)
19933                  + 4.*c2*(pow(c1,2.)-pow(s1,2.))+8.*s2*s1*c1
19934                  + 8.*two*(pow(c1,2.)+pow(s1,2.))-6.*pow((pow(c1,2.)+pow(s1,2.)),2.);
19935    if(fApplyCorrectionForNUAVsM){fIntFlowQcumulantsVsM[1]->SetBinContent(b,gQC4);}   
19936    // Detector bias vs M:
19937    if(TMath::Abs(QC2)>0.)
19938    {
19939     fIntFlowDetectorBiasVsM[0]->SetBinContent(b,gQC2/QC2); 
19940    } // end of if(TMath::Abs(QC2)>0.)
19941    if(TMath::Abs(QC4)>0.)
19942    {
19943     fIntFlowDetectorBiasVsM[1]->SetBinContent(b,gQC4/QC4); 
19944    } // end of if(TMath::Abs(QC4)>0.)  
19945    // Rebin in M:
19946    for(Int_t co=0;co<4;co++)
19947    {
19948     value[co] = fIntFlowQcumulantsVsM[co]->GetBinContent(b);
19949     error[co] = fIntFlowQcumulantsVsM[co]->GetBinError(b);
19950     if(error[co]>0.)
19951     {
19952      dSum1[co]+=value[co]/(error[co]*error[co]);
19953      dSum2[co]+=1./(error[co]*error[co]);
19954     }
19955    } // end of for(Int_t co=0;co<4;co++) 
19956   } // end of for(Int_t b=1;b<=nBins;b++)
19957   // Store rebinned Q-cumulants:
19958   if(fApplyCorrectionForNUAVsM)
19959   {
19960    for(Int_t co=0;co<4;co++)
19961    {
19962     if(dSum2[co]>0.)
19963     {
19964      fIntFlowQcumulantsRebinnedInM->SetBinContent(co+1,dSum1[co]/dSum2[co]);
19965      fIntFlowQcumulantsRebinnedInM->SetBinError(co+1,pow(1./dSum2[co],0.5));
19966     }
19967    } // end of for(Int_t co=0;co<4;co++)
19968   } // end of if(fApplyCorrectionForNUAVsM)
19969  } // end of if(fCalculateCumulantsVsM) 
19970      
19971 } // end of void AliFlowAnalysisWithQCumulants::CalculateQcumulantsCorrectedForNUAIntFlow()
19972  
19973 //=======================================================================================================================
19974
19975 void AliFlowAnalysisWithQCumulants::FinalizeCorrectionTermsForNUAIntFlow() 
19976 {
19977  // From profile fIntFlowCorrectionTermsForNUAPro[sc] access measured correction terms for NUA
19978  // and their spread, correctly calculate the statistical errors and store the final 
19979  // results and statistical errors for correction terms for NUA in histogram fIntFlowCorrectionTermsForNUAHist[sc].
19980  //
19981  // Remark: Statistical error of correction temrs is calculated as:
19982  //
19983  //          statistical error = termA * spread * termB:
19984  //          termA = sqrt{sum_{i=1}^{N} w^2}/(sum_{i=1}^{N} w)
19985  //          termB = 1/sqrt(1-termA^2)   
19986  
19987  TString sinCosFlag[2] = {"sin","cos"}; // to be improved - promore this to data member?
19988  TString nonisotropicTermFlag[4] = {"(n(phi1))","(n(phi1+phi2))","(n(phi1-phi2-phi3))","(n(2phi1-phi2))"}; // to be improved - hardwired 4
19989     
19990  for(Int_t sc=0;sc<2;sc++) // sin or cos correction terms 
19991  {
19992   for(Int_t ci=1;ci<=4;ci++) // correction term index (to be improved - hardwired 4)
19993   {
19994    Double_t correction = fIntFlowCorrectionTermsForNUAPro[sc]->GetBinContent(ci);
19995    Double_t spread = fIntFlowCorrectionTermsForNUAPro[sc]->GetBinError(ci);
19996    Double_t sumOfLinearEventWeights = fIntFlowSumOfEventWeightsNUA[sc][0]->GetBinContent(ci);
19997    Double_t sumOfQuadraticEventWeights = fIntFlowSumOfEventWeightsNUA[sc][1]->GetBinContent(ci);
19998    Double_t termA = 0.;
19999    Double_t termB = 0.;
20000    if(TMath::Abs(sumOfLinearEventWeights)>1.e-44)
20001    {
20002     termA = pow(sumOfQuadraticEventWeights,0.5)/sumOfLinearEventWeights;
20003    } else
20004      {
20005       cout<<" WARNING (QC): sumOfLinearEventWeights == 0 in AFAWQC::FCTFNIF() !!!!"<<endl;
20006       cout<<Form("               (for <<%s[%s]>> non-isotropic term)",sinCosFlag[sc].Data(),nonisotropicTermFlag[ci-1].Data())<<endl;
20007      }
20008    if(1.-pow(termA,2.) > 0.)
20009    {
20010     termB = 1./pow(1-pow(termA,2.),0.5);
20011    } else
20012      {
20013       cout<<" WARNING (QC): 1.-pow(termA,2.) <= 0 in AFAWQC::FCTFNIF() !!!!"<<endl;   
20014       cout<<Form("               (for <<%s[%s]>> non-isotropic term)",sinCosFlag[sc].Data(),nonisotropicTermFlag[ci-1].Data())<<endl;
20015      }     
20016    Double_t statisticalError = termA * spread * termB;
20017    fIntFlowCorrectionTermsForNUAHist[sc]->SetBinContent(ci,correction);
20018    fIntFlowCorrectionTermsForNUAHist[sc]->SetBinError(ci,statisticalError);
20019   } // end of for(Int_t ci=1;ci<=4;ci++) // correction term index
20020  } // end of for(Int sc=0;sc<2;sc++) // sin or cos correction terms 
20021                                                                                                                                                                                                
20022 } // end of void AliFlowAnalysisWithQCumulants::FinalizeCorrectionTermsForNUAIntFlow()
20023
20024 //=======================================================================================================================
20025
20026 void AliFlowAnalysisWithQCumulants::GetPointersForNestedLoopsHistograms()
20027 {
20028  // Get pointers to all objects relevant for calculations with nested loops.
20029    
20030  TList *nestedLoopsList = dynamic_cast<TList*>(fHistList->FindObject("Nested Loops"));
20031  if(nestedLoopsList) 
20032  {
20033   this->SetNestedLoopsList(nestedLoopsList);
20034  } else
20035    {
20036     cout<<"WARNING: nestedLoopsList is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
20037     exit(0);
20038    }
20039     
20040   TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data members?)
20041   TString typeFlag[2] = {"RP","POI"}; // to be improved (should I promote this to data members?)
20042   TString ptEtaFlag[2] = {"p_{T}","#eta"}; // to be improved (should I promote this to data members?)
20043   TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"}; // to be improved (should I promote this to data members?)
20044    
20045   TString evaluateNestedLoopsName = "fEvaluateNestedLoops";
20046   evaluateNestedLoopsName += fAnalysisLabel->Data();  
20047   TProfile *evaluateNestedLoops = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(evaluateNestedLoopsName.Data()));
20048   Bool_t bEvaluateIntFlowNestedLoops = kFALSE;
20049   Bool_t bEvaluateDiffFlowNestedLoops = kFALSE;
20050   if(evaluateNestedLoops)
20051   {
20052    this->SetEvaluateNestedLoops(evaluateNestedLoops);
20053    bEvaluateIntFlowNestedLoops = (Int_t)evaluateNestedLoops->GetBinContent(1);
20054    bEvaluateDiffFlowNestedLoops = (Int_t)evaluateNestedLoops->GetBinContent(2);
20055   }
20056   // nested loops relevant for integrated flow:  
20057   if(bEvaluateIntFlowNestedLoops)
20058   {
20059    // correlations:
20060    TString intFlowDirectCorrelationsName = "fIntFlowDirectCorrelations";
20061    intFlowDirectCorrelationsName += fAnalysisLabel->Data();
20062    TProfile *intFlowDirectCorrelations = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(intFlowDirectCorrelationsName.Data()));
20063    if(intFlowDirectCorrelations) 
20064    { 
20065     this->SetIntFlowDirectCorrelations(intFlowDirectCorrelations);
20066    } else
20067      {
20068       cout<<"WARNING: intFlowDirectCorrelations is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
20069       exit(0);
20070      }
20071    if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)  
20072    {
20073     TString intFlowExtraDirectCorrelationsName = "fIntFlowExtraDirectCorrelations";
20074     intFlowExtraDirectCorrelationsName += fAnalysisLabel->Data();
20075     TProfile *intFlowExtraDirectCorrelations = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(intFlowExtraDirectCorrelationsName.Data()));
20076     if(intFlowExtraDirectCorrelations) 
20077     { 
20078      this->SetIntFlowExtraDirectCorrelations(intFlowExtraDirectCorrelations);
20079     } else
20080       {
20081        cout<<"WARNING: intFlowExtraDirectCorrelations is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
20082        exit(0);
20083       }       
20084    } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)  
20085    // correction terms for non-uniform acceptance:
20086    TString intFlowDirectCorrectionTermsForNUAName = "fIntFlowDirectCorrectionTermsForNUA";
20087    intFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();
20088    TProfile *intFlowDirectCorrectionTermsForNUA[2] = {NULL};
20089    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
20090    {
20091     intFlowDirectCorrectionTermsForNUA[sc] = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(Form("%s: %s terms",intFlowDirectCorrectionTermsForNUAName.Data(),sinCosFlag[sc].Data())));
20092     if(intFlowDirectCorrectionTermsForNUA[sc]) 
20093     { 
20094      this->SetIntFlowDirectCorrectionTermsForNUA(intFlowDirectCorrectionTermsForNUA[sc],sc);
20095     } else
20096       {
20097        cout<<"WARNING: intFlowDirectCorrectionTermsForNUA[sc] is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
20098        cout<<"sc = "<<sc<<endl;
20099        exit(0);
20100       }
20101    } // end of for(Int_t sc=0;sc<2;sc++) 
20102    // Mixed harmonics:
20103    if(fCalculateMixedHarmonics)
20104    {
20105     TString mixedHarmonicsNestedLoopsName = "fMixedHarmonicsNestedLoops";
20106     mixedHarmonicsNestedLoopsName += fAnalysisLabel->Data();
20107     TProfile *mixedHarmonicsNestedLoops = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(mixedHarmonicsNestedLoopsName.Data()));
20108     if(mixedHarmonicsNestedLoops) 
20109     { 
20110      this->SetMixedHarmonicsNestedLoops(mixedHarmonicsNestedLoops);
20111     } else
20112       {
20113        cout<<"WARNING: mixedHarmonicsNestedLoops is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
20114        exit(0);
20115       }
20116    } // end of if(fCalculateMixedHarmonics)
20117   } // end of if(bEvaluateIntFlowNestedLoops)
20118     
20119   // nested loops relevant for differential flow:  
20120   if(bEvaluateDiffFlowNestedLoops)
20121   {
20122    // correlations:
20123    TString diffFlowDirectCorrelationsName = "fDiffFlowDirectCorrelations";
20124    diffFlowDirectCorrelationsName += fAnalysisLabel->Data();
20125    TProfile *diffFlowDirectCorrelations[2][2][4] = {{{NULL}}};
20126    for(Int_t t=0;t<2;t++)
20127    {
20128     for(Int_t pe=0;pe<2;pe++)
20129     {
20130      for(Int_t ci=0;ci<4;ci++) // correlation index
20131      {
20132       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())));
20133       if(diffFlowDirectCorrelations[t][pe][ci])
20134       {
20135        this->SetDiffFlowDirectCorrelations(diffFlowDirectCorrelations[t][pe][ci],t,pe,ci);
20136       } else
20137         {
20138          cout<<"WARNING: diffFlowDirectCorrelations[t][pe][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
20139          cout<<"t  = "<<t<<endl;
20140          cout<<"pe = "<<pe<<endl;   
20141          cout<<"ci = "<<ci<<endl;
20142         }     
20143      } // end of for(Int_t ci=0;ci<4;ci++) // correlation index  
20144     } // end of for(Int_t pe=0;pe<2;pe++)
20145    } // end of for(Int_t t=0;t<2;t++)   
20146    // correction terms for non-uniform acceptance:
20147    TString diffFlowDirectCorrectionTermsForNUAName = "fDiffFlowDirectCorrectionTermsForNUA";
20148    diffFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();  
20149    TProfile *diffFlowDirectCorrectionTermsForNUA[2][2][2][10] = {{{{NULL}}}};   
20150    for(Int_t t=0;t<2;t++)
20151    {
20152     for(Int_t pe=0;pe<2;pe++)
20153     {
20154      // correction terms for NUA:
20155      for(Int_t sc=0;sc<2;sc++) // sin or cos
20156      {
20157       for(Int_t cti=0;cti<9;cti++) // correction term index
20158       {
20159        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)));
20160        if(diffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti])
20161        {
20162         this->SetDiffFlowDirectCorrectionTermsForNUA(diffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti],t,pe,sc,cti);
20163        } else
20164          {
20165           cout<<"WARNING: diffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
20166           cout<<"t   = "<<t<<endl;
20167           cout<<"pe  = "<<pe<<endl;   
20168           cout<<"sc  = "<<sc<<endl;
20169           cout<<"cti = "<<cti<<endl;
20170          }    
20171       } // end of for(Int_t cti=0;cti<9;cti++) // correction term index
20172      } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
20173     } // end of for(Int_t pe=0;pe<2;pe++)
20174    } // end of for(Int_t t=0;t<2;t++)
20175    // other differential correlators:
20176    TString otherDirectDiffCorrelatorsName = "fOtherDirectDiffCorrelators";
20177    otherDirectDiffCorrelatorsName += fAnalysisLabel->Data();  
20178    TProfile *otherDirectDiffCorrelators[2][2][2][1] = {{{{NULL}}}};   
20179    for(Int_t t=0;t<2;t++)
20180    {
20181     for(Int_t pe=0;pe<2;pe++)
20182     {
20183      // correction terms for NUA:
20184      for(Int_t sc=0;sc<2;sc++) // sin or cos
20185      {
20186       for(Int_t ci=0;ci<1;ci++) // correlator index
20187       {
20188        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)));
20189        if(otherDirectDiffCorrelators[t][pe][sc][ci])
20190        {
20191         this->SetOtherDirectDiffCorrelators(otherDirectDiffCorrelators[t][pe][sc][ci],t,pe,sc,ci);
20192        } else
20193          {
20194           cout<<"WARNING: otherDirectDiffCorrelators[t][pe][sc][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
20195           cout<<"t   = "<<t<<endl;
20196           cout<<"pe  = "<<pe<<endl;   
20197           cout<<"sc  = "<<sc<<endl;
20198           cout<<"ci = "<<ci<<endl;
20199          }    
20200       } // end of for(Int_t ci=0;ci<9;ci++) // correction term index
20201      } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
20202     } // end of for(Int_t pe=0;pe<2;pe++)
20203    } // end of for(Int_t t=0;t<2;t++)
20204    // number of RPs and POIs in selected pt and eta bins for cross-checkings:
20205    TString noOfParticlesInBinName = "fNoOfParticlesInBin";
20206    TH1D *noOfParticlesInBin = NULL;
20207    noOfParticlesInBin = dynamic_cast<TH1D*>(nestedLoopsList->FindObject(noOfParticlesInBinName.Data()));
20208    if(noOfParticlesInBin)
20209    {
20210     this->SetNoOfParticlesInBin(noOfParticlesInBin);
20211    } else
20212      {
20213       cout<<endl;
20214       cout<<" WARNING (QC): noOfParticlesInBin is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
20215       cout<<endl;
20216      }
20217   } // end of if(bEvaluateDiffFlowNestedLoops)
20218
20219 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForNestedLoopsHistograms()
20220
20221 //=======================================================================================================================
20222
20223 void AliFlowAnalysisWithQCumulants::GetPointersForMixedHarmonicsHistograms()
20224 {
20225  // Get pointers to all objects relevant for mixed harmonics.
20226    
20227  // a) Get pointer to base list for mixed harmonics;
20228  // b) Get pointer to TProfile fMixedHarmonicsFlags holding all flags for mixed harmonics;
20229  // c) Get pointer to list fMixedHarmonicsProfiles and pointers to all objects that she holds; 
20230  // d) Get pointer to list fMixedHarmonicsResults and pointers to all objects that she holds;
20231  // e) Get pointer to list fMixedHarmonicsErrorPropagation and pointers to all objects that she holds.
20232
20233  // a) Get pointer to base list for mixed harmonics:
20234  TList *mixedHarmonicsList = dynamic_cast<TList*>(fHistList->FindObject("Mixed Harmonics"));
20235  if(mixedHarmonicsList) 
20236  {
20237   this->SetMixedHarmonicsList(mixedHarmonicsList);
20238  } else
20239    {
20240     cout<<"WARNING: mixedHarmonicsList is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20241     exit(0);
20242    }
20243
20244  // b) Get pointer to TProfile fMixedHarmonicsFlags holding all flags for mixed harmonics:
20245  TString mixedHarmonicsFlagsName = "fMixedHarmonicsFlags";
20246  mixedHarmonicsFlagsName += fAnalysisLabel->Data();
20247  TProfile *mixedHarmonicsFlags = dynamic_cast<TProfile*>
20248                                  (mixedHarmonicsList->FindObject(mixedHarmonicsFlagsName.Data()));
20249  if(mixedHarmonicsFlags)
20250  {
20251   this->SetMixedHarmonicsFlags(mixedHarmonicsFlags);  
20252   fCalculateMixedHarmonics = (Bool_t)mixedHarmonicsFlags->GetBinContent(1); 
20253   fCalculateMixedHarmonicsVsM = (Bool_t)mixedHarmonicsFlags->GetBinContent(3); 
20254  } else 
20255    {
20256     cout<<"WARNING: mixedHarmonicsFlags is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20257     exit(0);
20258    }
20259   
20260  if(!fCalculateMixedHarmonics){return;}
20261
20262  // c) Get pointer to list fMixedHarmonicsProfiles and pointers to all objects that she holds:
20263  TList *mixedHarmonicsProfiles = NULL;
20264  mixedHarmonicsProfiles = dynamic_cast<TList*>(mixedHarmonicsList->FindObject("Profiles"));
20265  if(mixedHarmonicsProfiles)  
20266  {
20267   // 2p:
20268   TString s2pCorrelationsName = "f2pCorrelations";
20269   s2pCorrelationsName += fAnalysisLabel->Data();
20270   TProfile *p2pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s2pCorrelationsName.Data()));
20271   if(p2pCorrelations) 
20272   {
20273    this->Set2pCorrelations(p2pCorrelations);
20274   } else 
20275     {
20276      cout<<"WARNING: p2pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20277      exit(0);
20278     } 
20279   // 3p:
20280   TString s3pCorrelationsName = "f3pCorrelations";
20281   s3pCorrelationsName += fAnalysisLabel->Data();
20282   TProfile *p3pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s3pCorrelationsName.Data()));
20283   if(p3pCorrelations) 
20284   {
20285    this->Set3pCorrelations(p3pCorrelations);
20286   } else 
20287     {
20288      cout<<"WARNING: p3pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20289      exit(0);
20290     } 
20291   // 4p:
20292   TString s4pCorrelationsName = "f4pCorrelations";
20293   s4pCorrelationsName += fAnalysisLabel->Data();
20294   TProfile *p4pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s4pCorrelationsName.Data()));
20295   if(p4pCorrelations) 
20296   {
20297    this->Set4pCorrelations(p4pCorrelations);
20298   } else 
20299     {
20300      cout<<"WARNING: p4pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20301      exit(0);
20302     } 
20303   // 5p:
20304   TString s5pCorrelationsName = "f5pCorrelations";
20305   s5pCorrelationsName += fAnalysisLabel->Data();
20306   TProfile *p5pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s5pCorrelationsName.Data()));
20307   if(p5pCorrelations) 
20308   {
20309    this->Set5pCorrelations(p5pCorrelations);
20310   } else 
20311     {
20312      cout<<"WARNING: p5pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20313      exit(0);
20314     } 
20315   /* TBI not needed for the time being
20316   // 6p:
20317   TString s6pCorrelationsName = "f6pCorrelations";
20318   s6pCorrelationsName += fAnalysisLabel->Data();
20319   TProfile *p6pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s6pCorrelationsName.Data()));
20320   if(p6pCorrelations) 
20321   {
20322    this->Set6pCorrelations(p6pCorrelations);
20323   } else 
20324     {
20325      cout<<"WARNING: p6pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20326      exit(0);
20327     } 
20328   // 7p:
20329   TString s7pCorrelationsName = "f7pCorrelations";
20330   s7pCorrelationsName += fAnalysisLabel->Data();
20331   TProfile *p7pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s7pCorrelationsName.Data()));
20332   if(p7pCorrelations) 
20333   {
20334    this->Set7pCorrelations(p7pCorrelations);
20335   } else 
20336     {
20337      cout<<"WARNING: p7pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20338      exit(0);
20339     } 
20340   // 8p:
20341   TString s8pCorrelationsName = "f8pCorrelations";
20342   s8pCorrelationsName += fAnalysisLabel->Data();
20343   TProfile *p8pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s8pCorrelationsName.Data()));
20344   if(p8pCorrelations) 
20345   {
20346    this->Set8pCorrelations(p8pCorrelations);
20347   } else 
20348     {
20349      cout<<"WARNING: p8pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20350      exit(0);
20351     }
20352  */
20353  } else // to if(mixedHarmonicsProfiles)
20354    {
20355     cout<<"WARNING: mixedHarmonicsProfiles is NULL in FAWQC::GPFMHH() !!!!"<<endl;
20356     exit(0);
20357    }
20358
20359  // d) Get pointer to list fMixedHarmonicsResults and pointers to all objects that she holds.
20360  TList *mixedHarmonicsResults = NULL;
20361  mixedHarmonicsResults = dynamic_cast<TList*>(mixedHarmonicsList->FindObject("Results"));
20362  if(mixedHarmonicsResults)  
20363  {
20364   // 2p:
20365   TString s2pCumulantsName = "f2pCumulants";
20366   s2pCumulantsName += fAnalysisLabel->Data();
20367   TH1D *p2pCumulants = dynamic_cast<TH1D*>(mixedHarmonicsResults->FindObject(s2pCumulantsName.Data()));
20368   if(p2pCumulants) 
20369   {
20370    this->Set2pCumulants(p2pCumulants);
20371   } else 
20372     {
20373      cout<<"WARNING: p2pCumulants is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20374      exit(0);
20375     } 
20376   // 3p:
20377   TString s3pCumulantsName = "f3pCumulants";
20378   s3pCumulantsName += fAnalysisLabel->Data();
20379   TH1D *p3pCumulants = dynamic_cast<TH1D*>(mixedHarmonicsResults->FindObject(s3pCumulantsName.Data()));
20380   if(p3pCumulants) 
20381   {
20382    this->Set3pCumulants(p3pCumulants);
20383   } else 
20384     {
20385      cout<<"WARNING: p3pCumulants is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20386      exit(0);
20387     } 
20388   // 4p:
20389   TString s4pCumulantsName = "f4pCumulants";
20390   s4pCumulantsName += fAnalysisLabel->Data();
20391   TH1D *p4pCumulants = dynamic_cast<TH1D*>(mixedHarmonicsResults->FindObject(s4pCumulantsName.Data()));
20392   if(p4pCumulants) 
20393   {
20394    this->Set4pCumulants(p4pCumulants);
20395   } else 
20396     {
20397      cout<<"WARNING: p4pCumulants is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20398      exit(0);
20399     } 
20400   // 5p:
20401   TString s5pCumulantsName = "f5pCumulants";
20402   s5pCumulantsName += fAnalysisLabel->Data();
20403   TH1D *p5pCumulants = dynamic_cast<TH1D*>(mixedHarmonicsResults->FindObject(s5pCumulantsName.Data()));
20404   if(p5pCumulants) 
20405   {
20406    this->Set5pCumulants(p5pCumulants);
20407   } else 
20408     {
20409      cout<<"WARNING: p5pCumulants is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20410      exit(0);
20411     } 
20412  } else // to if(mixedHarmonicsResults)
20413    {
20414     cout<<"WARNING: mixedHarmonicsResults is NULL in FAWQC::GPFMHH() !!!!"<<endl;
20415    }
20416
20417  // e) Get pointer to list fMixedHarmonicsErrorPropagation and pointers to all objects that she holds:
20418  TList *mixedHarmonicsErrorPropagation = NULL;
20419  mixedHarmonicsErrorPropagation = dynamic_cast<TList*>(mixedHarmonicsList->FindObject("Error Propagation"));
20420  if(mixedHarmonicsErrorPropagation)  
20421  {   
20422   TString sMixedHarmonicEventWeightsName = "fMixedHarmonicEventWeights";
20423   sMixedHarmonicEventWeightsName += fAnalysisLabel->Data();
20424   TString powerFlag[2] = {"linear","quadratic"};
20425   for(Int_t power=0;power<2;power++)
20426   {
20427    TH1D *hMixedHarmonicEventWeights = dynamic_cast<TH1D*>(mixedHarmonicsErrorPropagation->FindObject(Form("%s: %s",sMixedHarmonicEventWeightsName.Data(),powerFlag[power].Data())));
20428    if(hMixedHarmonicEventWeights) 
20429    {
20430     this->SetMixedHarmonicEventWeights(hMixedHarmonicEventWeights,power);
20431    } else 
20432      {
20433       cout<<"WARNING: hMixedHarmonicEventWeights is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
20434       cout<<"power = "<<power<<endl;
20435       exit(0);
20436      }                                   
20437   } // end of for(Int_t power=0;power<2;power++)
20438   TString sMixedHarmonicProductOfEventWeightsName = "fMixedHarmonicProductOfEventWeights";
20439   sMixedHarmonicProductOfEventWeightsName += fAnalysisLabel->Data();
20440   TH2D *hMixedHarmonicProductOfEventWeights = dynamic_cast<TH2D*>(mixedHarmonicsErrorPropagation->FindObject(sMixedHarmonicProductOfEventWeightsName.Data()));
20441   if(hMixedHarmonicProductOfEventWeights) 
20442   {
20443    this->SetMixedHarmonicProductOfEventWeights(hMixedHarmonicProductOfEventWeights);
20444   } else 
20445     {
20446      cout<<"WARNING: hMixedHarmonicProductOfEventWeights is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20447      exit(0);
20448     } 
20449   TString sMixedHarmonicProductOfCorrelationsName = "fMixedHarmonicProductOfCorrelations";
20450   sMixedHarmonicProductOfCorrelationsName += fAnalysisLabel->Data();
20451   TProfile2D *hMixedHarmonicProductOfCorrelations = dynamic_cast<TProfile2D*>(mixedHarmonicsErrorPropagation->FindObject(sMixedHarmonicProductOfCorrelationsName.Data()));
20452   if(hMixedHarmonicProductOfCorrelations) 
20453   {
20454    this->SetMixedHarmonicProductOfCorrelations(hMixedHarmonicProductOfCorrelations);
20455   } else 
20456     {
20457      cout<<"WARNING: hMixedHarmonicProductOfCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20458      exit(0);
20459     } 
20460  } // end of if(mixedHarmonicsErrorPropagation) 
20461  
20462 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForMixedHarmonicsHistograms()
20463
20464 //=======================================================================================================================
20465
20466 void AliFlowAnalysisWithQCumulants::GetPointersForControlHistograms()
20467 {
20468  // Get pointers to all control histograms.
20469    
20470  // a) Get pointer to base list for control histograms;
20471  // b) Get pointer to TProfile fControlHistogramsFlags holding all flags for control histograms;
20472  // c) Get pointers to TH2D *fCorrelation2468VsMult[4], TH2D *fCorrelationProduct2468VsMult[1] and TH2D *fQvectorTermsVsMult[4].
20473
20474  // a) Get pointer to base list for control histograms:
20475  TList *controlHistogramsList = dynamic_cast<TList*>(fHistList->FindObject("Control Histograms"));
20476  if(controlHistogramsList) 
20477  {
20478   this->SetControlHistogramsList(controlHistogramsList);
20479  } else
20480    {
20481     cout<<"WARNING: controlHistogramsList is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20482     exit(0);
20483    }
20484
20485  // b) Get pointer to TProfile fControlHistogramsFlags holding all flags for control histograms:
20486  TString controlHistogramsFlagsName = "fControlHistogramsFlags";
20487  controlHistogramsFlagsName += fAnalysisLabel->Data();
20488  TProfile *controlHistogramsFlags = dynamic_cast<TProfile*>
20489                                  (controlHistogramsList->FindObject(controlHistogramsFlagsName.Data()));
20490  if(controlHistogramsFlags)
20491  {
20492   this->SetControlHistogramsFlags(controlHistogramsFlags);  
20493   fStoreControlHistograms = (Bool_t)controlHistogramsFlags->GetBinContent(1); 
20494   fUseQvectorTerms = (Bool_t)controlHistogramsFlags->GetBinContent(2); 
20495  } else 
20496    {
20497     cout<<"WARNING: controlHistogramsFlags is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20498     exit(0);
20499    }
20500   
20501  if(!fStoreControlHistograms){return;}
20502
20503  // c) Get pointers to TH2D *fCorrelation2468VsMult[4], TH2D *fCorrelationProduct2468VsMult[1] and TH2D *fQvectorTermsVsMult[4]:
20504  TString sCorrelation[4] = {"#LT2#GT","#LT4#GT","#LT6#GT","#LT8#GT"};
20505  TString sCorrelation2468VsMultName = "fCorrelation2468VsMult";
20506  sCorrelation2468VsMultName += fAnalysisLabel->Data();
20507  for(Int_t ci=0;ci<4;ci++)
20508  {
20509   TH2D *hCorrelation2468VsMult = dynamic_cast<TH2D*>(controlHistogramsList->FindObject(Form("%s vs M",sCorrelation[ci].Data())));
20510   if(hCorrelation2468VsMult) 
20511   {
20512    this->SetCorrelation2468VsMult(hCorrelation2468VsMult,ci);
20513   } else 
20514     {
20515      cout<<"WARNING: hCorrelation2468VsMult is NULL in AFAWQC::GPFCH() !!!!"<<endl; 
20516      cout<<"ci = "<<ci<<endl;
20517      exit(0);
20518     }                                   
20519  } // end of for(Int_t ci=0;ci<4;ci++)
20520  TString sCorrelationProduct[1] = {"#LT2#GT#LT4#GT"}; // TBI: add the other ones when needed first time
20521  TString sCorrelationProduct2468VsMultName = "fCorrelationProduct2468VsMult";
20522  sCorrelationProduct2468VsMultName += fAnalysisLabel->Data();
20523  for(Int_t cpi=0;cpi<1;cpi++) // TBI: hardwired 1
20524  {
20525   TH2D *hCorrelationProduct2468VsMult = dynamic_cast<TH2D*>(controlHistogramsList->FindObject(Form("%s vs M",sCorrelationProduct[cpi].Data())));
20526   if(hCorrelationProduct2468VsMult) 
20527   {
20528    this->SetCorrelationProduct2468VsMult(hCorrelationProduct2468VsMult,cpi);
20529   } else 
20530     {
20531      cout<<"WARNING: hCorrelationProduct2468VsMult is NULL in AFAWQC::GPFCH() !!!!"<<endl; 
20532      cout<<"cpi = "<<cpi<<endl;
20533      exit(0);
20534     }  
20535  } // end of for(Int_t cpi=0;cpi<1;cpi++) // TBI: hardwired 1
20536
20537  if(!fUseQvectorTerms){return;}
20538  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}}"};
20539  TString sQvectorTermsVsMultName = "fQvectorTermsVsMult";
20540  sQvectorTermsVsMultName += fAnalysisLabel->Data();
20541  for(Int_t qwti=0;qwti<4;qwti++) // TBI: hardwired 4
20542  {
20543   TH2D *hQvectorTermsVsMult = dynamic_cast<TH2D*>(controlHistogramsList->FindObject(Form("%s vs M",sQvectorTerms[qwti].Data())));
20544   if(hQvectorTermsVsMult) 
20545   {
20546    this->SetQvectorTermsVsMult(hQvectorTermsVsMult,qwti);
20547   } else 
20548     {
20549      cout<<"WARNING: hQvectorTermsVsMult is NULL in AFAWQC::GPFCH() !!!!"<<endl; 
20550      cout<<"qwti = "<<qwti<<endl;
20551      exit(0);
20552     }  
20553  } // end of for(Int_t qwti=0;qwti<1;qwti++) // TBI: hardwired 4
20554
20555 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForControlHistograms()
20556
20557 //=======================================================================================================================
20558
20559 void AliFlowAnalysisWithQCumulants::GetPointersForBootstrap()
20560 {
20561  // Get pointers to all bootstrap histograms.
20562    
20563  // a) Get pointer to base list for bootstrap histograms;
20564  // b) Get pointers to all other lists;
20565  // c) Get pointer to TProfile fBootstrapFlags holding all flags for bootstrap histograms;
20566  // d) Get pointers to remaining bootstrap profiles and histograms;
20567  // e) Get pointers to remaining bootstrap profiles and histograms 'vs M'.
20568
20569  // a) Get pointer to base list for bootstrap histograms:
20570  TList *bootstrapList = dynamic_cast<TList*>(fHistList->FindObject("Bootstrap"));
20571  if(bootstrapList) 
20572  {
20573   this->SetBootstrapList(bootstrapList);
20574  } else
20575    {
20576     cout<<"WARNING: bootstrapList is NULL in AFAWQC::GPFB() !!!!"<<endl;
20577     exit(0);
20578    }
20579
20580  // b) Get pointers to all other lists:
20581  TList *bootstrapProfilesList = dynamic_cast<TList*>(fBootstrapList->FindObject("Profiles"));
20582  if(bootstrapProfilesList) 
20583  {
20584   this->SetBootstrapProfilesList(bootstrapProfilesList);
20585  } else
20586    {
20587     cout<<"WARNING: bootstrapProfilesList is NULL in AFAWQC::GPFB() !!!!"<<endl;
20588     exit(0);
20589    }
20590  TList *bootstrapResultsList = dynamic_cast<TList*>(fBootstrapList->FindObject("Results"));
20591  if(bootstrapResultsList) 
20592  {
20593   this->SetBootstrapResultsList(bootstrapResultsList);
20594  } else
20595    {
20596     cout<<"WARNING: bootstrapResultsList is NULL in AFAWQC::GPFB() !!!!"<<endl;
20597     exit(0);
20598    }
20599
20600  // c) Get pointer to TProfile fBootstrapFlags holding all flags for bootstrap histograms:
20601  TString bootstrapFlagsName = "fBootstrapFlags";
20602  bootstrapFlagsName += fAnalysisLabel->Data();
20603  TProfile *bootstrapFlags = dynamic_cast<TProfile*>
20604                                  (fBootstrapList->FindObject(bootstrapFlagsName.Data()));
20605  if(bootstrapFlags)
20606  {
20607   this->SetBootstrapFlags(bootstrapFlags);  
20608   fUseBootstrap = (Bool_t)fBootstrapFlags->GetBinContent(1); 
20609   fUseBootstrapVsM = (Bool_t)fBootstrapFlags->GetBinContent(2); 
20610   fnSubsamples = (Int_t)fBootstrapFlags->GetBinContent(3); 
20611  } else 
20612    {
20613     cout<<"WARNING: bootstrapFlags is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
20614     exit(0);
20615    }
20616
20617  // d) Get pointers to remaining bootstrap profiles and histograms:
20618  TString correlationFlag[4] = {"#LT#LT2#GT#GT","#LT#LT4#GT#GT","#LT#LT6#GT#GT","#LT#LT8#GT#GT"};
20619  TString cumulantFlag[4] = {"QC{2}","QC{4}","QC{6}","QC{8}"};
20620  if(fUseBootstrap)
20621  { 
20622   TString bootstrapCorrelationsName = "fBootstrapCorrelations";
20623   bootstrapCorrelationsName += fAnalysisLabel->Data();
20624   TProfile2D *pBootstrapCorrelations = dynamic_cast<TProfile2D*>(fBootstrapProfilesList->FindObject(bootstrapCorrelationsName.Data()));
20625   if(pBootstrapCorrelations) 
20626   {
20627    this->SetBootstrapCorrelations(pBootstrapCorrelations);
20628   } else 
20629     {
20630      cout<<"WARNING: pBootstrapCorrelations is NULL in AFAWQC::GPFB() !!!!"<<endl; 
20631      exit(0);
20632     }                                   
20633   TString bootstrapCumulantsName = "fBootstrapCumulants";
20634   bootstrapCumulantsName += fAnalysisLabel->Data();
20635   TH2D *pBootstrapCumulants = dynamic_cast<TH2D*>(fBootstrapResultsList->FindObject(bootstrapCumulantsName.Data()));
20636   if(pBootstrapCumulants) 
20637   {
20638    this->SetBootstrapCumulants(pBootstrapCumulants);
20639   } else 
20640     {
20641      cout<<"WARNING: pBootstrapCumulants is NULL in AFAWQC::GPFB() !!!!"<<endl; 
20642      exit(0);
20643     }                                   
20644  } // end of if(fUseBootstrap)
20645
20646  // e) Get pointers to remaining bootstrap profiles and histograms 'vs M':
20647  if(fUseBootstrapVsM)
20648  { 
20649   TString bootstrapCorrelationsVsMName = "fBootstrapCorrelationsVsM";
20650   bootstrapCorrelationsVsMName += fAnalysisLabel->Data();
20651   for(Int_t ci=0;ci<4;ci++) // correlation index
20652   {
20653    TProfile2D *pBootstrapCorrelationsVsM = dynamic_cast<TProfile2D*>(fBootstrapProfilesList->FindObject(Form("%s, %s",bootstrapCorrelationsVsMName.Data(),correlationFlag[ci].Data())));
20654    if(pBootstrapCorrelationsVsM)
20655    {
20656     this->SetBootstrapCorrelationsVsM(pBootstrapCorrelationsVsM,ci);
20657    } else 
20658      {
20659       cout<<"WARNING: pBootstrapCorrelationsVsM is NULL in AFAWQC::GPFB() !!!!"<<endl; 
20660       cout<<"ci = "<<ci<<endl;
20661       exit(0);
20662      }                                   
20663   } // end of for(Int_t ci=0;ci<4;ci++)
20664   TString bootstrapCumulantsVsMName = "fBootstrapCumulantsVsM";
20665   bootstrapCumulantsVsMName += fAnalysisLabel->Data();
20666   for(Int_t co=0;co<4;co++) // correlation index
20667   {
20668    TH2D *pBootstrapCumulantsVsM = dynamic_cast<TH2D*>(fBootstrapResultsList->FindObject(Form("%s, %s",bootstrapCumulantsVsMName.Data(),cumulantFlag[co].Data())));
20669    if(pBootstrapCumulantsVsM)
20670    {
20671     this->SetBootstrapCumulantsVsM(pBootstrapCumulantsVsM,co);
20672    } else 
20673      {
20674       cout<<"WARNING: pBootstrapCumulantsVsM is NULL in AFAWQC::GPFB() !!!!"<<endl; 
20675       cout<<"co = "<<co<<endl;
20676       exit(0);
20677      }                                   
20678   } // end of for(Int_t co=0;co<4;co++)
20679  } // end of if(fUseBootstrapVsM)
20680
20681 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForBootstrap()
20682
20683 //=======================================================================================================================
20684
20685 void AliFlowAnalysisWithQCumulants::StoreHarmonic()
20686 {
20687  // Store flow harmonic in common control histograms.
20688
20689  (fCommonHists->GetHarmonic())->Fill(0.5,fHarmonic);
20690  if(fFillMultipleControlHistograms)
20691  {
20692   (fCommonHists2nd->GetHarmonic())->Fill(0.5,fHarmonic);
20693   (fCommonHists4th->GetHarmonic())->Fill(0.5,fHarmonic);
20694   (fCommonHists6th->GetHarmonic())->Fill(0.5,fHarmonic);
20695   (fCommonHists8th->GetHarmonic())->Fill(0.5,fHarmonic);
20696  }
20697  
20698 } // end of void AliFlowAnalysisWithQCumulants::StoreHarmonic()
20699
20700 //=======================================================================================================================
20701
20702 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrelationsUsingParticleWeights(TString type, TString ptOrEta) // type = RP or POI 
20703 {
20704  // Calculate all correlations needed for differential flow using particle weights.
20705  
20706  Int_t t = 0; // type flag 
20707  Int_t pe = 0; // ptEta flag
20708  
20709  if(type == "RP")
20710  {
20711   t = 0;
20712  } else if(type == "POI")
20713    {
20714     t = 1;
20715    }
20716
20717  if(ptOrEta == "Pt")
20718  {
20719   pe = 0;
20720  } else if(ptOrEta == "Eta")
20721    {
20722     pe = 1;
20723    }
20724     
20725  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
20726  Double_t minPtEta[2] = {fPtMin,fEtaMin};
20727  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
20728  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
20729
20730  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
20731  Double_t dReQ1n1k = (*fReQ)(0,1);
20732  Double_t dReQ2n2k = (*fReQ)(1,2);
20733  Double_t dReQ1n3k = (*fReQ)(0,3);
20734  //Double_t dReQ4n4k = (*fReQ)(3,4);
20735  Double_t dImQ1n1k = (*fImQ)(0,1);
20736  Double_t dImQ2n2k = (*fImQ)(1,2);
20737  Double_t dImQ1n3k = (*fImQ)(0,3);
20738  //Double_t dImQ4n4k = (*fImQ)(3,4);
20739  
20740  // S^M_{p,k} (see .h file for the definition of fSpk):
20741  Double_t dSM1p1k = (*fSpk)(0,1);
20742  Double_t dSM1p2k = (*fSpk)(0,2);
20743  Double_t dSM1p3k = (*fSpk)(0,3);
20744  Double_t dSM2p1k = (*fSpk)(1,1);
20745  Double_t dSM3p1k = (*fSpk)(2,1);
20746  
20747  // looping over all bins and calculating reduced correlations: 
20748  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20749  {
20750   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular (pt,eta) bin):  
20751   Double_t p1n0kRe = 0.;
20752   Double_t p1n0kIm = 0.;
20753
20754   // number of POIs in particular (pt,eta) bin):
20755   Double_t mp = 0.;
20756
20757   // real and imaginary parts of q_{m*n,k}: 
20758   // (weighted Q-vector evaluated for particles which are both RPs and POIs in particular (pt,eta) bin)
20759   Double_t q1n2kRe = 0.;
20760   Double_t q1n2kIm = 0.;
20761   Double_t q2n1kRe = 0.;
20762   Double_t q2n1kIm = 0.;
20763
20764   // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
20765   Double_t s1p1k = 0.; 
20766   Double_t s1p2k = 0.; 
20767   Double_t s1p3k = 0.; 
20768    
20769   // M0111 from Eq. (118) in QC2c (to be improved (notation))
20770   Double_t dM0111 = 0.;
20771  
20772   if(type == "POI")
20773   {
20774    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
20775            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
20776    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
20777            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
20778             
20779    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
20780     
20781    t = 1; // typeFlag = RP or POI
20782     
20783    // q_{m*n,k}: (Remark: m=1 is 0, k=0 iz zero (to be improved!)) 
20784    q1n2kRe = fReRPQ1dEBE[2][pe][0][2]->GetBinContent(fReRPQ1dEBE[2][pe][0][2]->GetBin(b))
20785            * fReRPQ1dEBE[2][pe][0][2]->GetBinEntries(fReRPQ1dEBE[2][pe][0][2]->GetBin(b));
20786    q1n2kIm = fImRPQ1dEBE[2][pe][0][2]->GetBinContent(fImRPQ1dEBE[2][pe][0][2]->GetBin(b))
20787            * fImRPQ1dEBE[2][pe][0][2]->GetBinEntries(fImRPQ1dEBE[2][pe][0][2]->GetBin(b));
20788    q2n1kRe = fReRPQ1dEBE[2][pe][1][1]->GetBinContent(fReRPQ1dEBE[2][pe][1][1]->GetBin(b))
20789            * fReRPQ1dEBE[2][pe][1][1]->GetBinEntries(fReRPQ1dEBE[2][pe][1][1]->GetBin(b));
20790    q2n1kIm = fImRPQ1dEBE[2][pe][1][1]->GetBinContent(fImRPQ1dEBE[2][pe][1][1]->GetBin(b))
20791            * fImRPQ1dEBE[2][pe][1][1]->GetBinEntries(fImRPQ1dEBE[2][pe][1][1]->GetBin(b));
20792        
20793    // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
20794    s1p1k = pow(fs1dEBE[2][pe][1]->GetBinContent(b)*fs1dEBE[2][pe][1]->GetBinEntries(b),1.); 
20795    s1p2k = pow(fs1dEBE[2][pe][2]->GetBinContent(b)*fs1dEBE[2][pe][2]->GetBinEntries(b),1.); 
20796    s1p3k = pow(fs1dEBE[2][pe][3]->GetBinContent(b)*fs1dEBE[2][pe][3]->GetBinEntries(b),1.); 
20797      
20798    // M0111 from Eq. (118) in QC2c (to be improved (notation)):
20799    dM0111 = mp*(dSM3p1k-3.*dSM1p1k*dSM1p2k+2.*dSM1p3k)
20800           - 3.*(s1p1k*(dSM2p1k-dSM1p2k)
20801           + 2.*(s1p3k-s1p2k*dSM1p1k));
20802   }
20803    else if(type == "RP")
20804    {
20805     // q_{m*n,k}: (Remark: m=1 is 0, k=0 iz zero (to be improved!)) 
20806     q1n2kRe = fReRPQ1dEBE[0][pe][0][2]->GetBinContent(fReRPQ1dEBE[0][pe][0][2]->GetBin(b))
20807             * fReRPQ1dEBE[0][pe][0][2]->GetBinEntries(fReRPQ1dEBE[0][pe][0][2]->GetBin(b));
20808     q1n2kIm = fImRPQ1dEBE[0][pe][0][2]->GetBinContent(fImRPQ1dEBE[0][pe][0][2]->GetBin(b))
20809             * fImRPQ1dEBE[0][pe][0][2]->GetBinEntries(fImRPQ1dEBE[0][pe][0][2]->GetBin(b));
20810     q2n1kRe = fReRPQ1dEBE[0][pe][1][1]->GetBinContent(fReRPQ1dEBE[0][pe][1][1]->GetBin(b))
20811             * fReRPQ1dEBE[0][pe][1][1]->GetBinEntries(fReRPQ1dEBE[0][pe][1][1]->GetBin(b));
20812     q2n1kIm = fImRPQ1dEBE[0][pe][1][1]->GetBinContent(fImRPQ1dEBE[0][pe][1][1]->GetBin(b))
20813             * fImRPQ1dEBE[0][pe][1][1]->GetBinEntries(fImRPQ1dEBE[0][pe][1][1]->GetBin(b));
20814
20815     // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
20816     s1p1k = pow(fs1dEBE[0][pe][1]->GetBinContent(b)*fs1dEBE[0][pe][1]->GetBinEntries(b),1.); 
20817     s1p2k = pow(fs1dEBE[0][pe][2]->GetBinContent(b)*fs1dEBE[0][pe][2]->GetBinEntries(b),1.); 
20818     s1p3k = pow(fs1dEBE[0][pe][3]->GetBinContent(b)*fs1dEBE[0][pe][3]->GetBinEntries(b),1.); 
20819     
20820     // to be improved (cross-checked):
20821     p1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
20822             * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
20823     p1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))  
20824             * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
20825             
20826     mp = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
20827      
20828     t = 0; // typeFlag = RP or POI
20829     
20830     // M0111 from Eq. (118) in QC2c (to be improved (notation)):
20831     dM0111 = mp*(dSM3p1k-3.*dSM1p1k*dSM1p2k+2.*dSM1p3k)
20832            - 3.*(s1p1k*(dSM2p1k-dSM1p2k)
20833            + 2.*(s1p3k-s1p2k*dSM1p1k));
20834     //...............................................................................................   
20835    }
20836    
20837    // 2'-particle correlation:
20838    Double_t two1n1nW0W1 = 0.;
20839    if(mp*dSM1p1k-s1p1k)
20840    {
20841     two1n1nW0W1 = (p1n0kRe*dReQ1n1k+p1n0kIm*dImQ1n1k-s1p1k)
20842                 / (mp*dSM1p1k-s1p1k);
20843    
20844     // fill profile to get <<2'>>     
20845     fDiffFlowCorrelationsPro[t][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nW0W1,mp*dSM1p1k-s1p1k);    
20846     // fill profile to get <<2'>^2>     
20847     fDiffFlowSquaredCorrelationsPro[t][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nW0W1*two1n1nW0W1,mp*dSM1p1k-s1p1k);        
20848     // histogram to store <2'> e-b-e (needed in some other methods):
20849     fDiffFlowCorrelationsEBE[t][pe][0]->SetBinContent(b,two1n1nW0W1);      
20850     fDiffFlowEventWeightsForCorrelationsEBE[t][pe][0]->SetBinContent(b,mp*dSM1p1k-s1p1k);      
20851    } // end of if(mp*dSM1p1k-s1p1k)
20852    
20853    // 4'-particle correlation:
20854    Double_t four1n1n1n1nW0W1W1W1 = 0.;
20855    if(dM0111)
20856    {
20857     four1n1n1n1nW0W1W1W1 = ((pow(dReQ1n1k,2.)+pow(dImQ1n1k,2.))*(p1n0kRe*dReQ1n1k+p1n0kIm*dImQ1n1k)
20858                          - q2n1kRe*(pow(dReQ1n1k,2.)-pow(dImQ1n1k,2.))
20859                          - 2.*q2n1kIm*dReQ1n1k*dImQ1n1k
20860                          - p1n0kRe*(dReQ1n1k*dReQ2n2k+dImQ1n1k*dImQ2n2k)
20861                          + p1n0kIm*(dImQ1n1k*dReQ2n2k-dReQ1n1k*dImQ2n2k)
20862                          - 2.*dSM1p2k*(p1n0kRe*dReQ1n1k+p1n0kIm*dImQ1n1k)
20863                          - 2.*(pow(dReQ1n1k,2.)+pow(dImQ1n1k,2.))*s1p1k                                            
20864                          + 6.*(q1n2kRe*dReQ1n1k+q1n2kIm*dImQ1n1k)                                           
20865                          + 1.*(q2n1kRe*dReQ2n2k+q2n1kIm*dImQ2n2k)                         
20866                          + 2.*(p1n0kRe*dReQ1n3k+p1n0kIm*dImQ1n3k)                      
20867                          + 2.*s1p1k*dSM1p2k                                      
20868                          - 6.*s1p3k)        
20869                          / dM0111; // to be improved (notation of dM0111)
20870    
20871     // fill profile to get <<4'>>     
20872     fDiffFlowCorrelationsPro[t][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nW0W1W1W1,dM0111);    
20873     // fill profile to get <<4'>^2>     
20874     fDiffFlowSquaredCorrelationsPro[t][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nW0W1W1W1*four1n1n1n1nW0W1W1W1,dM0111);        
20875     // histogram to store <4'> e-b-e (needed in some other methods):
20876     fDiffFlowCorrelationsEBE[t][pe][1]->SetBinContent(b,four1n1n1n1nW0W1W1W1);      
20877     fDiffFlowEventWeightsForCorrelationsEBE[t][pe][1]->SetBinContent(b,dM0111);      
20878    } // end of if(dM0111)
20879  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20880
20881 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrelationsUsingParticleWeights(TString type, TString ptOrEta); // type = RP or POI 
20882
20883 //=======================================================================================================================
20884
20885 void AliFlowAnalysisWithQCumulants::FillCommonControlHistograms(AliFlowEventSimple *anEvent)
20886 {
20887  // Fill common control histograms.
20888  
20889  Int_t nRP = anEvent->GetNumberOfRPs(); // number of Reference Particles 
20890  fCommonHists->FillControlHistograms(anEvent); 
20891  if(fFillMultipleControlHistograms)
20892  {
20893   if(nRP>1)
20894   {
20895    fCommonHists2nd->FillControlHistograms(anEvent);                                        
20896    if(nRP>3)
20897    {
20898     fCommonHists4th->FillControlHistograms(anEvent);                                        
20899     if(nRP>5)
20900     {
20901      fCommonHists6th->FillControlHistograms(anEvent);                                        
20902      if(nRP>7)
20903      {
20904       fCommonHists8th->FillControlHistograms(anEvent);                                        
20905      } // end of if(nRP>7)  
20906     } // end of if(nRP>5) 
20907    } // end of if(nRP>3)                                                                                                                      
20908   } // end of if(nRP>1) 
20909  } // end of if(fFillMultipleControlHistograms)
20910  
20911 } // end of void AliFlowAnalysisWithQCumulants::FillCommonControlHistograms(AliFlowEventSimple *anEvent)
20912
20913 //=======================================================================================================================
20914
20915 void AliFlowAnalysisWithQCumulants::FillControlHistograms(AliFlowEventSimple *anEvent)
20916 {
20917  // Fill common control histograms.
20918  
20919  Int_t nRPs = anEvent->GetNumberOfRPs(); // number of Reference Particles
20920  Int_t nPOIs = anEvent->GetNumberOfPOIs(); // number of Particles Of Interest
20921  Int_t nRefMult = anEvent->GetReferenceMultiplicity(); // reference multiplicity for current event (TBI: This call is not really needed here, use fReferenceMultiplicityEBE instead)
20922
20923  fCorrelationNoRPsVsRefMult->Fill(nRPs,nRefMult);
20924  fCorrelationNoPOIsVsRefMult->Fill(nPOIs,nRefMult);
20925  fCorrelationNoRPsVsNoPOIs->Fill(nRPs,nPOIs);
20926  
20927 } // end of void AliFlowAnalysisWithQCumulants::FillControlHistograms(AliFlowEventSimple *anEvent)
20928
20929 //=======================================================================================================================
20930
20931 void AliFlowAnalysisWithQCumulants::ResetEventByEventQuantities()
20932 {
20933  // Reset all event by event quantities.
20934  
20935  // Reference flow:
20936  fReQ->Zero();
20937  fImQ->Zero();
20938  fSpk->Zero();
20939  fIntFlowCorrelationsEBE->Reset();
20940  fIntFlowEventWeightsForCorrelationsEBE->Reset();
20941  fIntFlowCorrelationsAllEBE->Reset();
20942  
20943  for(Int_t sc=0;sc<2;sc++)
20944  {
20945   fIntFlowCorrectionTermsForNUAEBE[sc]->Reset();
20946   fIntFlowEventWeightForCorrectionTermsForNUAEBE[sc]->Reset(); 
20947  }
20948     
20949  // Differential flow:
20950  if(fCalculateDiffFlow)
20951  {
20952   for(Int_t t=0;t<3;t++) // type (RP, POI, POI&&RP)
20953   {
20954    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // 1D in pt or eta
20955    {
20956     for(Int_t m=0;m<4;m++) // multiple of harmonic
20957     {
20958      for(Int_t k=0;k<9;k++) // power of weight
20959      {
20960       if(fReRPQ1dEBE[t][pe][m][k]) fReRPQ1dEBE[t][pe][m][k]->Reset();
20961       if(fImRPQ1dEBE[t][pe][m][k]) fImRPQ1dEBE[t][pe][m][k]->Reset();
20962      }   
20963     } 
20964    }
20965   } 
20966   for(Int_t t=0;t<3;t++) // type (0 = RP, 1 = POI, 2 = RP&&POI )
20967   { 
20968    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // 1D in pt or eta
20969    {
20970     for(Int_t k=0;k<9;k++)
20971     {
20972      if(fs1dEBE[t][pe][k]) fs1dEBE[t][pe][k]->Reset();
20973     }
20974    }
20975   }
20976   // e-b-e reduced correlations:
20977   for(Int_t t=0;t<2;t++) // type (0 = RP, 1 = POI)
20978   {  
20979    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
20980    {
20981     for(Int_t rci=0;rci<4;rci++) // reduced correlation index
20982     {
20983      if(fDiffFlowCorrelationsEBE[t][pe][rci]) fDiffFlowCorrelationsEBE[t][pe][rci]->Reset();
20984      if(fDiffFlowEventWeightsForCorrelationsEBE[t][pe][rci]) fDiffFlowEventWeightsForCorrelationsEBE[t][pe][rci]->Reset();
20985     }
20986    }
20987   }  
20988   // correction terms for NUA:
20989   for(Int_t t=0;t<2;t++) // type (0 = RP, 1 = POI)
20990   {  
20991    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
20992    {
20993     for(Int_t sc=0;sc<2;sc++) // sin or cos
20994     {
20995      for(Int_t cti=0;cti<9;cti++) // correction term index
20996      {
20997      fDiffFlowCorrectionTermsForNUAEBE[t][pe][sc][cti]->Reset();  
20998      }
20999     }
21000    }      
21001   }
21002  } // end of if(fCalculateDiffFlow)   
21003
21004  // 2D (pt,eta)
21005  if(fCalculate2DDiffFlow)
21006  {
21007   for(Int_t t=0;t<3;t++) // type (RP, POI, POI&&RP)
21008   {
21009    for(Int_t m=0;m<4;m++) // multiple of harmonic
21010    {
21011     for(Int_t k=0;k<9;k++) // power of weight
21012     {
21013      if(fReRPQ2dEBE[t][m][k]){fReRPQ2dEBE[t][m][k]->Reset();}
21014      if(fImRPQ2dEBE[t][m][k]){fImRPQ2dEBE[t][m][k]->Reset();}
21015     }   
21016    }
21017   }
21018   for(Int_t t=0;t<3;t++) // type (0 = RP, 1 = POI, 2 = RP&&POI )
21019   { 
21020    for(Int_t k=0;k<9;k++)
21021    {
21022     if(fs2dEBE[t][k]){fs2dEBE[t][k]->Reset();}
21023    }
21024   }  
21025  } // end of if(fCalculate2DDiffFlow) 
21026
21027 } // end of void AliFlowAnalysisWithQCumulants::ResetEventByEventQuantities();
21028
21029 //=======================================================================================================================
21030
21031 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUASinTerms(TString type, TString ptOrEta)
21032 {
21033  // Calculate correction terms for non-uniform acceptance for differential flow (sin terms).
21034  
21035  // Results are stored in fDiffFlowCorrectionTermsForNUAPro[t][pe][0][cti], where cti runs as follows:
21036  //  0: <<sin n(psi1)>>
21037  //  1: <<sin n(psi1+phi2)>>
21038  //  2: <<sin n(psi1+phi2-phi3)>>
21039  //  3: <<sin n(psi1-phi2-phi3)>>:
21040  //  4:
21041  //  5:
21042  //  6:
21043  
21044  // multiplicity:
21045  Double_t dMult = (*fSpk)(0,0);
21046  
21047  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
21048  Double_t dReQ1n = (*fReQ)(0,0);
21049  Double_t dReQ2n = (*fReQ)(1,0);
21050  //Double_t dReQ3n = (*fReQ)(2,0);
21051  //Double_t dReQ4n = (*fReQ)(3,0);
21052  Double_t dImQ1n = (*fImQ)(0,0);
21053  Double_t dImQ2n = (*fImQ)(1,0);
21054  //Double_t dImQ3n = (*fImQ)(2,0);
21055  //Double_t dImQ4n = (*fImQ)(3,0);
21056
21057  Int_t t = 0; // type flag 
21058  Int_t pe = 0; // ptEta flag
21059  
21060  if(type == "RP")
21061  {
21062   t = 0;
21063  } else if(type == "POI")
21064    {
21065     t = 1;
21066    }
21067
21068  if(ptOrEta == "Pt")
21069  {
21070   pe = 0;
21071  } else if(ptOrEta == "Eta")
21072    {
21073     pe = 1;
21074    }
21075     
21076  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
21077  Double_t minPtEta[2] = {fPtMin,fEtaMin};
21078  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
21079  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
21080
21081  // looping over all bins and calculating correction terms: 
21082  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
21083  {
21084   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
21085   Double_t p1n0kRe = 0.;
21086   Double_t p1n0kIm = 0.;
21087
21088   // number of POIs in particular pt or eta bin:
21089   Double_t mp = 0.;
21090
21091   // 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):
21092   Double_t q1n0kRe = 0.;
21093   Double_t q1n0kIm = 0.;
21094   Double_t q2n0kRe = 0.;
21095   Double_t q2n0kIm = 0.;
21096
21097   // number of particles which are both RPs and POIs in particular pt or eta bin:
21098   Double_t mq = 0.;
21099    
21100   if(type == "POI")
21101   {
21102    // q_{m*n,0}:
21103    q1n0kRe = fReRPQ1dEBE[2][pe][0][0]->GetBinContent(fReRPQ1dEBE[2][pe][0][0]->GetBin(b))
21104            * fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b));
21105    q1n0kIm = fImRPQ1dEBE[2][pe][0][0]->GetBinContent(fImRPQ1dEBE[2][pe][0][0]->GetBin(b))
21106            * fImRPQ1dEBE[2][pe][0][0]->GetBinEntries(fImRPQ1dEBE[2][pe][0][0]->GetBin(b));
21107    q2n0kRe = fReRPQ1dEBE[2][pe][1][0]->GetBinContent(fReRPQ1dEBE[2][pe][1][0]->GetBin(b))
21108            * fReRPQ1dEBE[2][pe][1][0]->GetBinEntries(fReRPQ1dEBE[2][pe][1][0]->GetBin(b));
21109    q2n0kIm = fImRPQ1dEBE[2][pe][1][0]->GetBinContent(fImRPQ1dEBE[2][pe][1][0]->GetBin(b))
21110            * fImRPQ1dEBE[2][pe][1][0]->GetBinEntries(fImRPQ1dEBE[2][pe][1][0]->GetBin(b));         
21111                  
21112    mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
21113   } 
21114   else if(type == "RP")
21115   {
21116    // q_{m*n,0}:
21117    q1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
21118            * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
21119    q1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))
21120            * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
21121    q2n0kRe = fReRPQ1dEBE[0][pe][1][0]->GetBinContent(fReRPQ1dEBE[0][pe][1][0]->GetBin(b))
21122            * fReRPQ1dEBE[0][pe][1][0]->GetBinEntries(fReRPQ1dEBE[0][pe][1][0]->GetBin(b));
21123    q2n0kIm = fImRPQ1dEBE[0][pe][1][0]->GetBinContent(fImRPQ1dEBE[0][pe][1][0]->GetBin(b))
21124            * fImRPQ1dEBE[0][pe][1][0]->GetBinEntries(fImRPQ1dEBE[0][pe][1][0]->GetBin(b));         
21125                  
21126    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)  
21127   }    
21128   if(type == "POI")
21129   {
21130    // p_{m*n,0}:
21131    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
21132            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
21133    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
21134            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
21135             
21136    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
21137     
21138    t = 1; // typeFlag = RP or POI
21139   }
21140   else if(type == "RP")
21141   {
21142    // p_{m*n,0} = q_{m*n,0}:
21143    p1n0kRe = q1n0kRe; 
21144    p1n0kIm = q1n0kIm; 
21145            
21146    mp = mq; 
21147    
21148    t = 0; // typeFlag = RP or POI
21149   }
21150
21151   // <<sin n(psi1)>>:
21152   Double_t sinP1nPsi = 0.;
21153   if(mp)
21154   {
21155    sinP1nPsi = p1n0kIm/mp;
21156    // fill profile for <<sin n(psi1)>>:
21157    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi,mp);
21158    // histogram to store <sin n(psi1)> e-b-e (needed in some other methods):
21159    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][0]->SetBinContent(b,sinP1nPsi);
21160   } // end of if(mp)   
21161   
21162   // <<sin n(psi1+phi2)>>:
21163   Double_t sinP1nPsiP1nPhi = 0.;
21164   if(mp*dMult-mq)
21165   {
21166    sinP1nPsiP1nPhi = (p1n0kRe*dImQ1n+p1n0kIm*dReQ1n-q2n0kIm)/(mp*dMult-mq);
21167    // fill profile for <<sin n(psi1+phi2)>>:
21168    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsiP1nPhi,mp*dMult-mq);
21169    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
21170    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][1]->SetBinContent(b,sinP1nPsiP1nPhi);
21171   } // end of if(mp*dMult-mq)   
21172   
21173   // <<sin n(psi1+phi2-phi3)>>:
21174   Double_t sinP1nPsi1P1nPhi2MPhi3 = 0.;
21175   if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))
21176   {
21177    sinP1nPsi1P1nPhi2MPhi3 = (p1n0kIm*(pow(dImQ1n,2.)+pow(dReQ1n,2.)-dMult)
21178                           - 1.*(q2n0kIm*dReQ1n-q2n0kRe*dImQ1n)  
21179                           - mq*dImQ1n+2.*q1n0kIm)
21180                           / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
21181    // fill profile for <<sin n(psi1+phi2)>>:
21182    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1P1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
21183    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
21184    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][2]->SetBinContent(b,sinP1nPsi1P1nPhi2MPhi3);
21185   } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   
21186   
21187   // <<sin n(psi1-phi2-phi3)>>:
21188   Double_t sinP1nPsi1M1nPhi2MPhi3 = 0.;
21189   if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))
21190   {
21191    sinP1nPsi1M1nPhi2MPhi3 = (p1n0kIm*(pow(dReQ1n,2.)-pow(dImQ1n,2.))-2.*p1n0kRe*dReQ1n*dImQ1n
21192                           - 1.*(p1n0kIm*dReQ2n-p1n0kRe*dImQ2n)
21193                           + 2.*mq*dImQ1n-2.*q1n0kIm)
21194                           / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
21195    // fill profile for <<sin n(psi1+phi2)>>:
21196    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1M1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
21197    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
21198    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][3]->SetBinContent(b,sinP1nPsi1M1nPhi2MPhi3);
21199   } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   
21200  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
21201  
21202 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUASinTerms(TString type, TString ptOrEta)
21203
21204
21205 //=======================================================================================================================
21206
21207
21208 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTerms(TString type, TString ptOrEta)
21209 {
21210  // Calculate correction terms for non-uniform acceptance for differential flow (cos terms).
21211  
21212  // Results are stored in fDiffFlowCorrectionTermsForNUAPro[t][pe][1][cti], where cti runs as follows:
21213  //  0: <<cos n(psi)>>
21214  //  1: <<cos n(psi1+phi2)>>
21215  //  2: <<cos n(psi1+phi2-phi3)>>
21216  //  3: <<cos n(psi1-phi2-phi3)>>
21217  //  4:
21218  //  5:
21219  //  6:
21220  
21221  // multiplicity:
21222  Double_t dMult = (*fSpk)(0,0);
21223  
21224  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
21225  Double_t dReQ1n = (*fReQ)(0,0);
21226  Double_t dReQ2n = (*fReQ)(1,0);
21227  //Double_t dReQ3n = (*fReQ)(2,0);
21228  //Double_t dReQ4n = (*fReQ)(3,0);
21229  Double_t dImQ1n = (*fImQ)(0,0);
21230  Double_t dImQ2n = (*fImQ)(1,0);
21231  //Double_t dImQ3n = (*fImQ)(2,0);
21232  //Double_t dImQ4n = (*fImQ)(3,0);
21233
21234  Int_t t = 0; // type flag 
21235  Int_t pe = 0; // ptEta flag
21236  
21237  if(type == "RP")
21238  {
21239   t = 0;
21240  } else if(type == "POI")
21241    {
21242     t = 1;
21243    }
21244
21245  if(ptOrEta == "Pt")
21246  {
21247   pe = 0;
21248  } else if(ptOrEta == "Eta")
21249    {
21250     pe = 1;
21251    }
21252     
21253  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
21254  Double_t minPtEta[2] = {fPtMin,fEtaMin};
21255  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
21256  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
21257
21258  // looping over all bins and calculating correction terms: 
21259  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
21260  {
21261   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
21262   Double_t p1n0kRe = 0.;
21263   Double_t p1n0kIm = 0.;
21264
21265   // number of POIs in particular pt or eta bin:
21266   Double_t mp = 0.;
21267
21268   // 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):
21269   Double_t q1n0kRe = 0.;
21270   Double_t q1n0kIm = 0.;
21271   Double_t q2n0kRe = 0.;
21272   Double_t q2n0kIm = 0.;
21273
21274   // number of particles which are both RPs and POIs in particular pt or eta bin:
21275   Double_t mq = 0.;
21276    
21277   if(type == "POI")
21278   {
21279    // q_{m*n,0}:
21280    q1n0kRe = fReRPQ1dEBE[2][pe][0][0]->GetBinContent(fReRPQ1dEBE[2][pe][0][0]->GetBin(b))
21281            * fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b));
21282    q1n0kIm = fImRPQ1dEBE[2][pe][0][0]->GetBinContent(fImRPQ1dEBE[2][pe][0][0]->GetBin(b))
21283            * fImRPQ1dEBE[2][pe][0][0]->GetBinEntries(fImRPQ1dEBE[2][pe][0][0]->GetBin(b));
21284    q2n0kRe = fReRPQ1dEBE[2][pe][1][0]->GetBinContent(fReRPQ1dEBE[2][pe][1][0]->GetBin(b))
21285            * fReRPQ1dEBE[2][pe][1][0]->GetBinEntries(fReRPQ1dEBE[2][pe][1][0]->GetBin(b));
21286    q2n0kIm = fImRPQ1dEBE[2][pe][1][0]->GetBinContent(fImRPQ1dEBE[2][pe][1][0]->GetBin(b))
21287            * fImRPQ1dEBE[2][pe][1][0]->GetBinEntries(fImRPQ1dEBE[2][pe][1][0]->GetBin(b));         
21288                  
21289    mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
21290   } 
21291   else if(type == "RP")
21292   {
21293    // q_{m*n,0}:
21294    q1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
21295            * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
21296    q1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))
21297            * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
21298    q2n0kRe = fReRPQ1dEBE[0][pe][1][0]->GetBinContent(fReRPQ1dEBE[0][pe][1][0]->GetBin(b))
21299            * fReRPQ1dEBE[0][pe][1][0]->GetBinEntries(fReRPQ1dEBE[0][pe][1][0]->GetBin(b));
21300    q2n0kIm = fImRPQ1dEBE[0][pe][1][0]->GetBinContent(fImRPQ1dEBE[0][pe][1][0]->GetBin(b))
21301            * fImRPQ1dEBE[0][pe][1][0]->GetBinEntries(fImRPQ1dEBE[0][pe][1][0]->GetBin(b));         
21302                  
21303    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)  
21304   }    
21305   if(type == "POI")
21306   {
21307    // p_{m*n,0}:
21308    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
21309            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
21310    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
21311            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
21312             
21313    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
21314     
21315    t = 1; // typeFlag = RP or POI
21316   }
21317   else if(type == "RP")
21318   {
21319    // p_{m*n,0} = q_{m*n,0}:
21320    p1n0kRe = q1n0kRe; 
21321    p1n0kIm = q1n0kIm; 
21322            
21323    mp = mq; 
21324    
21325    t = 0; // typeFlag = RP or POI
21326   }
21327
21328   // <<cos n(psi1)>>:
21329   Double_t cosP1nPsi = 0.;
21330   if(mp)
21331   {
21332    cosP1nPsi = p1n0kRe/mp;
21333    
21334    // fill profile for <<cos n(psi1)>>:
21335    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi,mp);
21336    // histogram to store <cos n(psi1)> e-b-e (needed in some other methods):
21337    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][0]->SetBinContent(b,cosP1nPsi);
21338   } // end of if(mp)   
21339   
21340   // <<cos n(psi1+phi2)>>:
21341   Double_t cosP1nPsiP1nPhi = 0.;
21342   if(mp*dMult-mq)
21343   {
21344    cosP1nPsiP1nPhi = (p1n0kRe*dReQ1n-p1n0kIm*dImQ1n-q2n0kRe)/(mp*dMult-mq);
21345    // fill profile for <<sin n(psi1+phi2)>>:
21346    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsiP1nPhi,mp*dMult-mq);
21347    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
21348    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][1]->SetBinContent(b,cosP1nPsiP1nPhi);
21349   } // end of if(mp*dMult-mq)   
21350   
21351   // <<cos n(psi1+phi2-phi3)>>:
21352   Double_t cosP1nPsi1P1nPhi2MPhi3 = 0.;
21353   if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))
21354   {
21355    cosP1nPsi1P1nPhi2MPhi3 = (p1n0kRe*(pow(dImQ1n,2.)+pow(dReQ1n,2.)-dMult)
21356                           - 1.*(q2n0kRe*dReQ1n+q2n0kIm*dImQ1n)  
21357                           - mq*dReQ1n+2.*q1n0kRe)
21358                           / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
21359    // fill profile for <<sin n(psi1+phi2)>>:
21360    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1P1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
21361    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
21362    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][2]->SetBinContent(b,cosP1nPsi1P1nPhi2MPhi3);
21363   } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   
21364   
21365   // <<cos n(psi1-phi2-phi3)>>:
21366   Double_t cosP1nPsi1M1nPhi2MPhi3 = 0.;
21367   if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))
21368   {
21369    cosP1nPsi1M1nPhi2MPhi3 = (p1n0kRe*(pow(dReQ1n,2.)-pow(dImQ1n,2.))+2.*p1n0kIm*dReQ1n*dImQ1n
21370                           - 1.*(p1n0kRe*dReQ2n+p1n0kIm*dImQ2n)  
21371                           - 2.*mq*dReQ1n+2.*q1n0kRe)
21372                           / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
21373    // fill profile for <<sin n(psi1+phi2)>>:
21374    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1M1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
21375    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
21376    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][3]->SetBinContent(b,cosP1nPsi1M1nPhi2MPhi3);
21377   } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   
21378  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
21379  
21380 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTerms(TString type, TString ptOrEta)
21381
21382 //=========================================================================================================================
21383
21384 void AliFlowAnalysisWithQCumulants::FinalizeCorrectionTermsForNUADiffFlow(TString type, TString ptOrEta)
21385 {
21386  // Transfer profiles into histogams and correctly propagate the error.
21387  
21388  Int_t t = 0; // type flag 
21389  Int_t pe = 0; // ptEta flag
21390  
21391  if(type == "RP")
21392  {
21393   t = 0;
21394  } else if(type == "POI")
21395    {
21396     t = 1;
21397    }
21398
21399  if(ptOrEta == "Pt")
21400  {
21401   pe = 0;
21402  } else if(ptOrEta == "Eta")
21403    {
21404     pe = 1;
21405    }
21406     
21407  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
21408  //Double_t minPtEta[2] = {fPtMin,fEtaMin};
21409  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
21410  //Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
21411
21412  for(Int_t sc=0;sc<2;sc++) // sin or cos
21413  {
21414   for(Int_t cti=0;cti<9;cti++) // correction term index
21415   {
21416    for(Int_t b=1;b<=nBinsPtEta[pe];b++)
21417    {
21418     Double_t correctionTerm = fDiffFlowCorrectionTermsForNUAPro[t][pe][sc][cti]->GetBinContent(b);
21419     fDiffFlowCorrectionTermsForNUAHist[t][pe][sc][cti]->SetBinContent(b,correctionTerm);
21420     // to be improved (propagate error correctly)
21421     // ...
21422    } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
21423   } // correction term index
21424  } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
21425
21426 }// end of void AliFlowAnalysisWithQCumulants::FinalizeCorrectionTermsForNUADiffFlow(TString type, TString ptOrEta)
21427
21428 //=========================================================================================================================
21429
21430 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCumulantsCorrectedForNUA(TString type, TString ptOrEta)
21431
21432  // Calculate generalized differential flow cumulants (corrected for non-uniform acceptance).
21433  
21434  // to be improved - propagate error also from non-isotropic terms
21435   
21436  Int_t t = 0; // RP = 0, POI = 1
21437  Int_t pe = 0; // pt = 0, eta = 1
21438
21439  if(type == "RP")
21440  {
21441   t = 0;
21442  } else if(type == "POI")
21443    {
21444     t = 1;
21445    } 
21446      
21447  if(ptOrEta == "Pt")
21448  {
21449   pe = 0;
21450  } else if(ptOrEta == "Eta")
21451    {
21452     pe = 1;
21453    } 
21454        
21455  // Common:
21456  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
21457  // 2-particle correlation:
21458  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>>
21459  // sinus terms coming from reference flow: 
21460  Double_t sinP1nPhi = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(1); // <<sin(n*phi1)>>
21461  Double_t sinP1nPhi1P1nPhi2 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(2); // <<sin(n*(phi1+phi2))>>
21462  Double_t sinP1nPhi1M1nPhi2M1nPhi3 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(3); // <<sin(n*(phi1-phi2-phi3))>>
21463  // cosinus terms coming from reference flow: 
21464  Double_t cosP1nPhi = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(1); // <<cos(n*phi1)>>
21465  Double_t cosP1nPhi1P1nPhi2 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(2); // <<cos(n*(phi1+phi2))>>
21466  Double_t cosP1nPhi1M1nPhi2M1nPhi3 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(3); // <<cos(n*(phi1-phi2-phi3))>>
21467
21468  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
21469  {
21470   Double_t twoPrime = fDiffFlowCorrelationsHist[t][pe][0]->GetBinContent(b); // <<2'>>
21471   Double_t fourPrime = fDiffFlowCorrelationsHist[t][pe][1]->GetBinContent(b); // <<4'>>
21472   Double_t sinP1nPsi = fDiffFlowCorrectionTermsForNUAHist[t][pe][0][0]->GetBinContent(b); // <<sin n(Psi)>> 
21473   Double_t cosP1nPsi = fDiffFlowCorrectionTermsForNUAHist[t][pe][1][0]->GetBinContent(b); // <<cos n(Psi)>> 
21474   Double_t sinP1nPsi1P1nPhi2 = fDiffFlowCorrectionTermsForNUAHist[t][pe][0][1]->GetBinContent(b); // <<sin n(psi1+phi2)>> 
21475   Double_t cosP1nPsi1P1nPhi2 = fDiffFlowCorrectionTermsForNUAHist[t][pe][1][1]->GetBinContent(b); // <<cos n(psi1+phi2)>> 
21476   Double_t sinP1nPsi1P1nPhi2M1nPhi3 = fDiffFlowCorrectionTermsForNUAHist[t][pe][0][2]->GetBinContent(b); // <<sin n(psi1+phi2-phi3)>> 
21477   Double_t cosP1nPsi1P1nPhi2M1nPhi3 = fDiffFlowCorrectionTermsForNUAHist[t][pe][1][2]->GetBinContent(b); // <<cos n(psi1+phi2-phi3)>> 
21478   Double_t sinP1nPsi1M1nPhi2M1nPhi3 = fDiffFlowCorrectionTermsForNUAHist[t][pe][0][3]->GetBinContent(b); // <<sin n(psi1-phi2-phi3)>> 
21479   Double_t cosP1nPsi1M1nPhi2M1nPhi3 = fDiffFlowCorrectionTermsForNUAHist[t][pe][1][3]->GetBinContent(b); // <<cos n(psi1-phi2-phi3)>> 
21480   // Generalized QC{2'}:
21481   Double_t qc2Prime = twoPrime - sinP1nPsi*sinP1nPhi - cosP1nPsi*cosP1nPhi;
21482   if(fApplyCorrectionForNUA)
21483   {
21484    fDiffFlowCumulants[t][pe][0]->SetBinContent(b,qc2Prime);
21485   }
21486   if(TMath::Abs(twoPrime)>0.)
21487   {
21488    fDiffFlowDetectorBias[t][pe][0]->SetBinContent(b,qc2Prime/twoPrime); // detector bias = generalized/isotropic cumulant.   
21489   }
21490   // Generalized QC{4'}:
21491   Double_t qc4Prime = fourPrime-2.*twoPrime*two
21492                     - cosP1nPsi*cosP1nPhi1M1nPhi2M1nPhi3
21493                     + sinP1nPsi*sinP1nPhi1M1nPhi2M1nPhi3
21494                     - cosP1nPhi*cosP1nPsi1M1nPhi2M1nPhi3
21495                     + sinP1nPhi*sinP1nPsi1M1nPhi2M1nPhi3
21496                     - 2.*cosP1nPhi*cosP1nPsi1P1nPhi2M1nPhi3
21497                     - 2.*sinP1nPhi*sinP1nPsi1P1nPhi2M1nPhi3
21498                     - cosP1nPsi1P1nPhi2*cosP1nPhi1P1nPhi2
21499                     - sinP1nPsi1P1nPhi2*sinP1nPhi1P1nPhi2
21500                     + 2.*cosP1nPhi1P1nPhi2*(cosP1nPsi*cosP1nPhi-sinP1nPsi*sinP1nPhi)
21501                     + 2.*sinP1nPhi1P1nPhi2*(cosP1nPsi*sinP1nPhi+sinP1nPsi*cosP1nPhi)
21502                     + 4.*two*(cosP1nPsi*cosP1nPhi+sinP1nPsi*sinP1nPhi)
21503                     + 2.*cosP1nPsi1P1nPhi2*(pow(cosP1nPhi,2.)-pow(sinP1nPhi,2.))
21504                     + 4.*sinP1nPsi1P1nPhi2*cosP1nPhi*sinP1nPhi
21505                     + 4.*twoPrime*(pow(cosP1nPhi,2.)+pow(sinP1nPhi,2.))
21506                     - 6.*(pow(cosP1nPhi,2.)-pow(sinP1nPhi,2.)) 
21507                     * (cosP1nPsi*cosP1nPhi-sinP1nPsi*sinP1nPhi)
21508                     - 12.*cosP1nPhi*sinP1nPhi
21509                     * (sinP1nPsi*cosP1nPhi+cosP1nPsi*sinP1nPhi);
21510   if(fApplyCorrectionForNUA)
21511   {
21512    fDiffFlowCumulants[t][pe][1]->SetBinContent(b,qc4Prime);   
21513   }
21514   if(TMath::Abs(fourPrime-2.*twoPrime*two)>0.)
21515   {
21516    fDiffFlowDetectorBias[t][pe][1]->SetBinContent(b,qc4Prime/(fourPrime-2.*twoPrime*two)); // detector bias = generalized/isotropic cumulant.   
21517   }
21518  } // end of for(Int_t p=1;p<=fnBinsPt;p++)
21519  
21520 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCumulantsCorrectedForNUA(TString type, TString ptOrEta)
21521
21522 //==================================================================================================================================    
21523
21524 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectedForNUA(TString type, TString ptOrEta)
21525 {
21526  // Calculate differential flow corrected for non-uniform acceptance.
21527  
21528  // to be improved: eventually I will have to access here masured correlations and NUA terms
21529  //                 instead of cumulants in order to propagate statistical error correctly also 
21530  //                 to NUA terms (propagating errors directly from cumulants is WRONG for 
21531  //                 differential flow becuase that doesn't account at all cross-covariance terms) 
21532  
21533  // REMARK: When NUA correction is apllied error for differential flow DOES NOT get corrected,
21534  //         i.e. only value is being corrected, error is still the one relevant for isotropic
21535  //         case. This eventually will be resolved. 
21536   
21537  
21538  Int_t t = 0; // RP or POI
21539  Int_t pe = 0; // pt or eta
21540
21541  if(type == "RP")
21542  {
21543   t = 0;
21544  } else if(type == "POI")
21545    {
21546     t = 1;
21547    }     
21548  if(ptOrEta == "Pt")
21549  {
21550   pe = 0;
21551  } else if(ptOrEta == "Eta")
21552    {
21553     pe = 1;
21554    } 
21555   
21556  // Common:
21557  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
21558  // Reference Q-cumulants
21559  Double_t qc2 = fIntFlowQcumulants->GetBinContent(1); // QC{2} 
21560  Double_t qc4 = fIntFlowQcumulants->GetBinContent(2); // QC{4}
21561  // Loop over pt or eta bins:
21562  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
21563  {
21564   // Differential Q-cumulants:
21565   Double_t qc2Prime = fDiffFlowCumulants[t][pe][0]->GetBinContent(b); // QC{2'}
21566   Double_t qc4Prime = fDiffFlowCumulants[t][pe][1]->GetBinContent(b); // QC{4'}
21567   // v'{2}:
21568   if(qc2>0.)
21569   { 
21570    Double_t v2Prime = qc2Prime/pow(qc2,0.5);
21571    if(TMath::Abs(v2Prime)>0.){fDiffFlow[t][pe][0]->SetBinContent(b,v2Prime);} 
21572   }  
21573   // v'{4}:
21574   if(qc4<0.)
21575   { 
21576    Double_t v4Prime = -qc4Prime/pow(-qc4,3./4.);
21577    if(TMath::Abs(v4Prime)>0.){fDiffFlow[t][pe][1]->SetBinContent(b,v4Prime);} 
21578   }  
21579  } // end of for(Int_t b=1;b<=fnBinsPtEta[pe];b++)
21580   
21581 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectedForNUA(TString type, TString ptOrEta); 
21582
21583 //=========================================================================================================================
21584
21585 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrelationsWithNestedLoops(AliFlowEventSimple * const anEvent)
21586 {
21587  // Evaluate with nested loops multiparticle correlations for integrated flow (without using the particle weights). 
21588
21589  // Remark: Results are stored in profile fIntFlowDirectCorrelations whose binning is organized as follows:
21590  // 
21591  //  1st bin: <2>_{1n|1n} = two1n1n = cos(n*(phi1-phi2))>
21592  //  2nd bin: <2>_{2n|2n} = two2n2n = cos(2n*(phi1-phi2))>
21593  //  3rd bin: <2>_{3n|3n} = two3n3n = cos(3n*(phi1-phi2))> 
21594  //  4th bin: <2>_{4n|4n} = two4n4n = cos(4n*(phi1-phi2))>
21595  //  5th bin:           ----  EMPTY ----
21596  //  6th bin: <3>_{2n|1n,1n} = three2n1n1n = <cos(n*(2.*phi1-phi2-phi3))>
21597  //  7th bin: <3>_{3n|2n,1n} = three3n2n1n = <cos(n*(3.*phi1-2.*phi2-phi3))>
21598  //  8th bin: <3>_{4n|2n,2n} = three4n2n2n = <cos(n*(4.*phi1-2.*phi2-2.*phi3))>
21599  //  9th bin: <3>_{4n|3n,1n} = three4n3n1n = <cos(n*(4.*phi1-3.*phi2-phi3))>
21600  // 10th bin:           ----  EMPTY ----
21601  // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1n = <cos(n*(phi1+phi2-phi3-phi4))>
21602  // 12th bin: <4>_{2n,1n|2n,1n} = four2n1n2n1n = <cos(2.*n*(phi1+phi2-phi3-phi4))>
21603  // 13th bin: <4>_{2n,2n|2n,2n} = four2n2n2n2n = <cos(n*(2.*phi1+phi2-2.*phi3-phi4))>
21604  // 14th bin: <4>_{3n|1n,1n,1n} = four3n1n1n1n = <cos(n*(3.*phi1-phi2-phi3-phi4))> 
21605  // 15th bin: <4>_{3n,1n|3n,1n} = four3n1n3n1n = <cos(n*(4.*phi1-2.*phi2-phi3-phi4))>
21606  // 16th bin: <4>_{3n,1n|2n,2n} = four3n1n2n2n = <cos(n*(3.*phi1+phi2-2.*phi3-2.*phi4))>
21607  // 17th bin: <4>_{4n|2n,1n,1n} = four4n2n1n1n = <cos(n*(3.*phi1+phi2-3.*phi3-phi4))> 
21608  // 18th bin:           ----  EMPTY ----
21609  // 19th bin: <5>_{2n|1n,1n,1n,1n} = five2n1n1n1n1n = <cos(n*(2.*phi1+phi2-phi3-phi4-phi5))>
21610  // 20th bin: <5>_{2n,2n|2n,1n,1n} = five2n2n2n1n1n = <cos(n*(2.*phi1+2.*phi2-2.*phi3-phi4-phi5))>
21611  // 21st bin: <5>_{3n,1n|2n,1n,1n} = five3n1n2n1n1n = <cos(n*(3.*phi1+phi2-2.*phi3-phi4-phi5))>
21612  // 22nd bin: <5>_{4n|1n,1n,1n,1n} = five4n1n1n1n1n = <cos(n*(4.*phi1-phi2-phi3-phi4-phi5))>
21613  // 23rd bin:           ----  EMPTY ----
21614  // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = six1n1n1n1n1n1n = <cos(n*(phi1+phi2+phi3-phi4-phi5-phi6))>
21615  // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = six2n1n1n2n1n1n = <cos(n*(2.*phi1+2.*phi2-phi3-phi4-phi5-phi6))>
21616  // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = six2n2n1n1n1n1n = <cos(n*(3.*phi1+phi2-phi3-phi4-phi5-phi6))>
21617  // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = six3n1n1n1n1n1n = <cos(n*(2.*phi1+phi2+phi3-2.*phi4-phi5-phi6))>
21618  // 28th bin:           ----  EMPTY ----
21619  // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = seven2n1n1n1n1n1n1n =  <cos(n*(2.*phi1+phi2+phi3-phi4-phi5-phi6-phi7))>
21620  // 30th bin:           ----  EMPTY ----
21621  // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = eight1n1n1n1n1n1n1n1n = <cos(n*(phi1+phi2+phi3+phi4-phi5-phi6-phi7-phi8))>
21622  // 32nd bin:           ----  EMPTY ----
21623   //  Extra correlations for 3p TY study: 
21624  // 33rd bin: <4>_{4n,2n|3n,3n}= four4n2n3n3n = <cos(n*(4.*phi1+2.*phi2-3.*phi3-3.*phi4))>
21625  // 34th bin: <5>_{3n,3n|2n,2n,2n} = five3n3n2n2n2n = <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-2*phi5))> 
21626   //  Extra correlations for 6p TY study: 
21627  // 35th bin: <2>_{5n|5n} = two5n5n = <cos(5n*(phi1-phi2)> T
21628  // 36th bin: <2>_{6n|6n} = two6n6n = <cos(6n*(phi1-phi2)> T
21629  // 37th bin: <3>_{5n|3n,2n} = three5n3n2n = <cos(n*(5*phi1-3*phi2-2*phi3)> 
21630  // 38th bin: <3>_{5n|4n,1n} = three5n4n1n = <cos(n*(5*phi1-4*phi2-1*phi3)> 
21631  // 39th bin: <3>_{6n|3n,3n} = three6n3n3n = <cos(n*(6*phi1-3*phi2-3*phi3)> T 
21632  // 40th bin: <3>_{6n|4n,2n} = three6n4n2n = <cos(n*(6*phi1-4*phi2-2*phi3)> T
21633  // 41st bin: <3>_{6n|5n,1n} = three6n5n1n = <cos(n*(6*phi1-5*phi2-1*phi3)>
21634  // 42nd bin: <4>_{6n|3n,2n,1n} = four6n3n2n1n = <cos(n*(6*phi1-3*phi2-2*phi3-1*phi4)>
21635  // 43rd bin: <4>_{3n,2n|3n,2n} = four3n2n3n2n = <cos(n*(3*phi1+2*phi2-3*phi3-2*phi4)>
21636  // 44th bin: <4>_{4n,1n|3n,2n} = four4n1n3n2n = <cos(n*(4*phi1+1*phi2-3*phi3-2*phi4)>
21637  // 45th bin: <4>_{3n,3n|3n,3n} = four3n3n3n3n = <cos(3.*n*(phi1+phi2-phi3-phi4))> T
21638  // 46th bin: <4>_{4n,2n|3n,3n} = four4n2n3n3n = <cos(n*(4*phi1+2*phi2-3*phi3-3*phi4)>
21639  // 47th bin: <4>_{5n,1n|3n,3n} = four5n1n3n3n = <cos(n*(5*phi1+1*phi2-3*phi3-3*phi4)>
21640  // 48th bin: <4>_{4n,2n|4n,2n} = four4n2n4n2n = <cos(n*(4*phi1+2*phi2-4*phi3-2*phi4)> T
21641  // 49th bin: <4>_{5n,1n|4n,2n} = four5n1n4n2n = <cos(n*(5*phi1+1*phi2-4*phi3-2*phi4)>
21642  // 50th bin: <4>_{5n|3n,1n,1n} = four5n3n1n1n = <cos(n*(5*phi1-3*phi2-1*phi3-1*phi4)>
21643  // 51st bin: <4>_{5n|2n,2n,1n} = four5n2n2n1n = <cos(n*(5*phi1-2*phi2-2*phi3-1*phi4)>
21644  // 52nd bin: <4>_{5n,1n|5n,1n} = four5n1n5n1n = <cos(n*(5*phi1+1*phi2-5*phi3-1*phi4)>
21645  // 53rd bin: <5>_{3n,3n|3n,2n,1n} = four3n3n3n2n1n = <cos(n*(3*phi1+3*phi2-3*phi3-2*phi4-1*phi5)>
21646  // 54th bin: <5>_{4n,2n|3n,2n,1n} = four4n2n3n2n1n = <cos(n*(4*phi1+2*phi2-3*phi3-2*phi4-1*phi5)>
21647  // 55th bin: <5>_{3n,2n|3n,1n,1n} = four3n2n3n1n1n = <cos(n*(3*phi1+2*phi2-3*phi3-1*phi4-1*phi5)>
21648  // 56th bin: <5>_{3n,2n|2n,2n,1n} = four3n2n2n2n1n = <cos(n*(3*phi1+2*phi2-2*phi3-2*phi4-1*phi5)>
21649  // 57th bin: <5>_{5n,1n|3n,2n,1n} = four5n1n3n2n1n = <cos(n*(5*phi1+1*phi2-3*phi3-2*phi4-1*phi5)>
21650  // 58th bin: <6>_{3n,2n,1n|3n,2n,1n} = six3n2n1n3n2n1n = <cos(n*(3*phi1+2*phi2+1*phi3-3*phi4-2*phi5-1*phi6)>
21651   
21652  Int_t nPrim = anEvent->NumberOfTracks(); 
21653  AliFlowTrackSimple *aftsTrack = NULL; 
21654  Double_t phi1=0., phi2=0., phi3=0., phi4=0., phi5=0., phi6=0., phi7=0., phi8=0.; 
21655  Int_t n = fHarmonic; 
21656  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // to be improved (is this casting safe in general?)
21657  Double_t dMult = (*fSpk)(0,0);
21658  cout<<endl;
21659  cout<<"Multiparticle correlations: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
21660  if(dMult<2)
21661  {
21662   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
21663  } else if (dMult>fMaxAllowedMultiplicity)
21664    {
21665     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
21666    } else 
21667      { 
21668       cout<<"... evaluating nested loops (without using particle weights)..."<<endl;
21669      } 
21670  
21671  // 2-particle correlations:       
21672  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
21673  {
21674   for(Int_t i1=0;i1<nPrim;i1++)
21675   {
21676    aftsTrack=anEvent->GetTrack(i1);
21677    if(!(aftsTrack->InRPSelection())) continue;
21678    phi1=aftsTrack->Phi(); 
21679    for(Int_t i2=0;i2<nPrim;i2++)
21680    {
21681     if(i2==i1)continue;
21682     aftsTrack=anEvent->GetTrack(i2);
21683     if(!(aftsTrack->InRPSelection())) continue;
21684     phi2=aftsTrack->Phi();
21685     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
21686     // fill the profile with 2-p correlations: 
21687     fIntFlowDirectCorrelations->Fill(0.5,cos(n*(phi1-phi2)),1.);     // <cos(n*(phi1-phi2))>
21688     fIntFlowDirectCorrelations->Fill(1.5,cos(2.*n*(phi1-phi2)),1.);  // <cos(2n*(phi1-phi2))>
21689     fIntFlowDirectCorrelations->Fill(2.5,cos(3.*n*(phi1-phi2)),1.);  // <cos(3n*(phi1-phi2))>
21690     fIntFlowDirectCorrelations->Fill(3.5,cos(4.*n*(phi1-phi2)),1.);  // <cos(4n*(phi1-phi2))>   
21691     fIntFlowDirectCorrelations->Fill(34.5,cos(5.*n*(phi1-phi2)),1.); // <cos(5n*(phi1-phi2))>
21692     fIntFlowDirectCorrelations->Fill(35.5,cos(6.*n*(phi1-phi2)),1.); // <cos(6n*(phi1-phi2))>   
21693    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21694   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21695  } // end of if(nPrim>=2)
21696  
21697  // 3-particle correlations:         
21698  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
21699  {
21700   for(Int_t i1=0;i1<nPrim;i1++)
21701   {
21702    aftsTrack=anEvent->GetTrack(i1);
21703    if(!(aftsTrack->InRPSelection())) continue;
21704    phi1=aftsTrack->Phi();
21705    for(Int_t i2=0;i2<nPrim;i2++)
21706    {
21707     if(i2==i1)continue;
21708     aftsTrack=anEvent->GetTrack(i2);
21709     if(!(aftsTrack->InRPSelection())) continue;
21710     phi2=aftsTrack->Phi();
21711     for(Int_t i3=0;i3<nPrim;i3++)
21712     {
21713      if(i3==i1||i3==i2)continue;
21714      aftsTrack=anEvent->GetTrack(i3);
21715      if(!(aftsTrack->InRPSelection())) continue;
21716      phi3=aftsTrack->Phi();
21717      if(nPrim==3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush;
21718      // fill the profile with 3-p correlations:   
21719      fIntFlowDirectCorrelations->Fill(5.,cos(2.*n*phi1-n*(phi2+phi3)),1.);         //<3>_{2n|nn,n}
21720      fIntFlowDirectCorrelations->Fill(6.,cos(3.*n*phi1-2.*n*phi2-n*phi3),1.);      //<3>_{3n|2n,n}
21721      fIntFlowDirectCorrelations->Fill(7.,cos(4.*n*phi1-2.*n*phi2-2.*n*phi3),1.);   //<3>_{4n|2n,2n}
21722      fIntFlowDirectCorrelations->Fill(8.,cos(4.*n*phi1-3.*n*phi2-n*phi3),1.);      //<3>_{4n|3n,n}
21723      fIntFlowDirectCorrelations->Fill(36.5,cos(5.*n*phi1-3.*n*phi2-2.*n*phi3),1.); //<3>_{5n|3n,2n}
21724      fIntFlowDirectCorrelations->Fill(37.5,cos(5.*n*phi1-4.*n*phi2-1.*n*phi3),1.); //<3>_{5n|4n,1n}
21725      fIntFlowDirectCorrelations->Fill(38.5,cos(6.*n*phi1-3.*n*phi2-3.*n*phi3),1.); //<3>_{6n|3n,3n}
21726      fIntFlowDirectCorrelations->Fill(39.5,cos(6.*n*phi1-4.*n*phi2-2.*n*phi3),1.); //<3>_{6n|4n,2n}     
21727      fIntFlowDirectCorrelations->Fill(40.5,cos(6.*n*phi1-5.*n*phi2-1.*n*phi3),1.); //<3>_{6n|5n,1n}
21728     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21729    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21730   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21731  } // end of if(nPrim>=3)
21732
21733  // 4-particle correlations:
21734  if(nPrim>=4 && nPrim<=fMaxAllowedMultiplicity)
21735  {       
21736   for(Int_t i1=0;i1<nPrim;i1++)
21737   { 
21738    aftsTrack=anEvent->GetTrack(i1);
21739    if(!(aftsTrack->InRPSelection())) continue;
21740    phi1=aftsTrack->Phi();
21741    for(Int_t i2=0;i2<nPrim;i2++)
21742    {
21743     if(i2==i1)continue;
21744     aftsTrack=anEvent->GetTrack(i2);
21745     if(!(aftsTrack->InRPSelection())) continue;
21746     phi2=aftsTrack->Phi();
21747     for(Int_t i3=0;i3<nPrim;i3++)
21748     {
21749      if(i3==i1||i3==i2)continue;
21750      aftsTrack=anEvent->GetTrack(i3);
21751      if(!(aftsTrack->InRPSelection())) continue;
21752      phi3=aftsTrack->Phi();
21753      for(Int_t i4=0;i4<nPrim;i4++)
21754      {
21755       if(i4==i1||i4==i2||i4==i3)continue;
21756       aftsTrack=anEvent->GetTrack(i4);
21757       if(!(aftsTrack->InRPSelection())) continue;
21758       phi4=aftsTrack->Phi();
21759       if(nPrim==4) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<"\r"<<flush;
21760       // fill the profile with 4-p correlations:   
21761       fIntFlowDirectCorrelations->Fill(10.,cos(n*phi1+n*phi2-n*phi3-n*phi4),1.);            // <4>_{n,n|n,n} 
21762       fIntFlowDirectCorrelations->Fill(11.,cos(2.*n*phi1+n*phi2-2.*n*phi3-n*phi4),1.);      // <4>_{2n,n|2n,n}
21763       fIntFlowDirectCorrelations->Fill(12.,cos(2.*n*phi1+2*n*phi2-2.*n*phi3-2.*n*phi4),1.); // <4>_{2n,2n|2n,2n}
21764       fIntFlowDirectCorrelations->Fill(13.,cos(3.*n*phi1-n*phi2-n*phi3-n*phi4),1.);         // <4>_{3n|n,n,n}
21765       fIntFlowDirectCorrelations->Fill(14.,cos(3.*n*phi1+n*phi2-3.*n*phi3-n*phi4),1.);      // <4>_{3n,n|3n,n}   
21766       fIntFlowDirectCorrelations->Fill(15.,cos(3.*n*phi1+n*phi2-2.*n*phi3-2.*n*phi4),1.);   // <4>_{3n,n|2n,2n}
21767       fIntFlowDirectCorrelations->Fill(16.,cos(4.*n*phi1-2.*n*phi2-n*phi3-n*phi4),1.);      // <4>_{4n|2n,n,n}     
21768       fIntFlowDirectCorrelations->Fill(32.,cos(n*(4.*phi1+2.*phi2-3.*phi3-3.*phi4)),1.);    // <4>_{4n,2n|3n,3n}        
21769       fIntFlowDirectCorrelations->Fill(41.5,cos(n*(6.*phi1-3.*phi2-2.*phi3-1.*phi4)),1.);    // <4>_{6n|3n,2n,1n}  
21770       fIntFlowDirectCorrelations->Fill(42.5,cos(n*(3.*phi1+2.*phi2-3.*phi3-2.*phi4)),1.);    // <4>_{3n,2n|3n,2n}  
21771       fIntFlowDirectCorrelations->Fill(43.5,cos(n*(4.*phi1+1.*phi2-3.*phi3-2.*phi4)),1.);    // <4>_{4n,1n|3n,2n}  
21772       fIntFlowDirectCorrelations->Fill(44.5,cos(n*(3.*phi1+3.*phi2-3.*phi3-3.*phi4)),1.);    // <4>_{3n,3n|3n,3n}  
21773       fIntFlowDirectCorrelations->Fill(45.5,cos(n*(4.*phi1+2.*phi2-3.*phi3-3.*phi4)),1.);    // <4>_{4n,2n|3n,3n}  
21774       fIntFlowDirectCorrelations->Fill(46.5,cos(n*(5.*phi1+1.*phi2-3.*phi3-3.*phi4)),1.);    // <4>_{5n,1n|3n,3n}  
21775       fIntFlowDirectCorrelations->Fill(47.5,cos(n*(4.*phi1+2.*phi2-4.*phi3-2.*phi4)),1.);    // <4>_{4n,2n|4n,2n}     
21776       fIntFlowDirectCorrelations->Fill(48.5,cos(n*(5.*phi1+1.*phi2-4.*phi3-2.*phi4)),1.);    // <4>_{5n,1n|4n,2n}  
21777       fIntFlowDirectCorrelations->Fill(49.5,cos(n*(5.*phi1-3.*phi2-1.*phi3-1.*phi4)),1.);    // <4>_{5n|3n,1n,1n}  
21778       fIntFlowDirectCorrelations->Fill(50.5,cos(n*(5.*phi1-2.*phi2-2.*phi3-1.*phi4)),1.);    // <4>_{5n|2n,2n,1n}  
21779       fIntFlowDirectCorrelations->Fill(51.5,cos(n*(5.*phi1+1.*phi2-5.*phi3-1.*phi4)),1.);    // <4>_{5n,1n|5n,1n}        
21780       fIntFlowDirectCorrelations->Fill(58.5,cos(n*(6.*phi1-4.*phi2-1.*phi3-1.*phi4)),1.);    // <4>_{6n|4n,1n,1n}  
21781       fIntFlowDirectCorrelations->Fill(59.5,cos(n*(6.*phi1-2.*phi2-2.*phi3-2.*phi4)),1.);    // <4>_{6n|2n,2n,2n}  
21782      } // end of for(Int_t i4=0;i4<nPrim;i4++) 
21783     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21784    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21785   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21786  } // end of if(nPrim>=)
21787
21788  // 5-particle correlations:      
21789  if(nPrim>=5 && nPrim<=fMaxAllowedMultiplicity)
21790  {
21791   for(Int_t i1=0;i1<nPrim;i1++)
21792   {
21793    aftsTrack=anEvent->GetTrack(i1);
21794    if(!(aftsTrack->InRPSelection())) continue;  
21795    phi1=aftsTrack->Phi();
21796    for(Int_t i2=0;i2<nPrim;i2++)
21797    {
21798     if(i2==i1)continue;
21799     aftsTrack=anEvent->GetTrack(i2);
21800     if(!(aftsTrack->InRPSelection())) continue;
21801     phi2=aftsTrack->Phi();
21802     for(Int_t i3=0;i3<nPrim;i3++)
21803     {
21804      if(i3==i1||i3==i2)continue;
21805      aftsTrack=anEvent->GetTrack(i3);
21806      if(!(aftsTrack->InRPSelection())) continue;
21807      phi3=aftsTrack->Phi();
21808      for(Int_t i4=0;i4<nPrim;i4++)
21809      {
21810       if(i4==i1||i4==i2||i4==i3)continue;
21811       aftsTrack=anEvent->GetTrack(i4);
21812       if(!(aftsTrack->InRPSelection())) continue;
21813       phi4=aftsTrack->Phi();
21814       for(Int_t i5=0;i5<nPrim;i5++)
21815       {
21816        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
21817        aftsTrack=anEvent->GetTrack(i5);
21818        if(!(aftsTrack->InRPSelection())) continue;
21819        phi5=aftsTrack->Phi();
21820        if(nPrim==5) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<"\r"<<flush;
21821        // fill the profile with 5-p correlations:   
21822        fIntFlowDirectCorrelations->Fill(18.,cos(2.*n*phi1+n*phi2-n*phi3-n*phi4-n*phi5),1.);              // <5>_{2n,n|n,n,n}
21823        fIntFlowDirectCorrelations->Fill(19.,cos(2.*n*phi1+2.*n*phi2-2.*n*phi3-n*phi4-n*phi5),1.);        // <5>_{2n,2n|2n,n,n}
21824        fIntFlowDirectCorrelations->Fill(20.,cos(3.*n*phi1+n*phi2-2.*n*phi3-n*phi4-n*phi5),1.);           // <5>_{3n,n|2n,n,n}
21825        fIntFlowDirectCorrelations->Fill(21.,cos(4.*n*phi1-n*phi2-n*phi3-n*phi4-n*phi5),1.);              // <5>_{4n|n,n,n,n}
21826        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}       
21827        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}      
21828        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}       
21829        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}
21830        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}
21831        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}              
21832        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}
21833        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}              
21834       } // end of for(Int_t i5=0;i5<nPrim;i5++)
21835      } // end of for(Int_t i4=0;i4<nPrim;i4++)  
21836     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21837    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21838   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21839  } // end of if(nPrim>=5)
21840   
21841  // 6-particle correlations:
21842  if(nPrim>=6 && nPrim<=fMaxAllowedMultiplicity)
21843  {
21844   for(Int_t i1=0;i1<nPrim;i1++)
21845   {
21846    aftsTrack=anEvent->GetTrack(i1);
21847    if(!(aftsTrack->InRPSelection())) continue;
21848    phi1=aftsTrack->Phi();
21849    for(Int_t i2=0;i2<nPrim;i2++)
21850    {
21851     if(i2==i1)continue;
21852     aftsTrack=anEvent->GetTrack(i2);
21853     if(!(aftsTrack->InRPSelection())) continue;
21854     phi2=aftsTrack->Phi();
21855     for(Int_t i3=0;i3<nPrim;i3++)
21856     {
21857      if(i3==i1||i3==i2)continue;
21858      aftsTrack=anEvent->GetTrack(i3);
21859      if(!(aftsTrack->InRPSelection())) continue;
21860      phi3=aftsTrack->Phi();
21861      for(Int_t i4=0;i4<nPrim;i4++)
21862      {
21863       if(i4==i1||i4==i2||i4==i3)continue;
21864       aftsTrack=anEvent->GetTrack(i4);
21865       if(!(aftsTrack->InRPSelection())) continue;
21866       phi4=aftsTrack->Phi();
21867       for(Int_t i5=0;i5<nPrim;i5++)
21868       {
21869        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
21870        aftsTrack=anEvent->GetTrack(i5);
21871        if(!(aftsTrack->InRPSelection())) continue;
21872        phi5=aftsTrack->Phi();
21873        for(Int_t i6=0;i6<nPrim;i6++)
21874        {
21875         if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5)continue;
21876         aftsTrack=anEvent->GetTrack(i6);
21877         if(!(aftsTrack->InRPSelection())) continue;
21878         phi6=aftsTrack->Phi(); 
21879         if(nPrim==6) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<" "<<i6<<"\r"<<flush;
21880         // fill the profile with 6-p correlations:   
21881         fIntFlowDirectCorrelations->Fill(23.,cos(n*phi1+n*phi2+n*phi3-n*phi4-n*phi5-n*phi6),1.);                    // <6>_{1n,1n,1n|1n,1n,1n}
21882         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}
21883         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}
21884         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}  
21885         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}  
21886         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}  
21887        } // end of for(Int_t i6=0;i6<nPrim;i6++)
21888       } // end of for(Int_t i5=0;i5<nPrim;i5++)
21889      } // end of for(Int_t i4=0;i4<nPrim;i4++)
21890     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21891    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21892   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21893  } // end of if(nPrim>=6)
21894   
21895  // 7-particle correlations:
21896  if(nPrim>=7 && nPrim<=fMaxAllowedMultiplicity)
21897  {
21898   for(Int_t i1=0;i1<nPrim;i1++)
21899   { 
21900    aftsTrack=anEvent->GetTrack(i1);
21901    if(!(aftsTrack->InRPSelection())) continue;
21902    phi1=aftsTrack->Phi();
21903    for(Int_t i2=0;i2<nPrim;i2++)
21904    {
21905     if(i2==i1)continue;
21906     aftsTrack=anEvent->GetTrack(i2);
21907     if(!(aftsTrack->InRPSelection())) continue;
21908     phi2=aftsTrack->Phi();
21909     for(Int_t i3=0;i3<nPrim;i3++)
21910     {
21911      if(i3==i1||i3==i2)continue;
21912      aftsTrack=anEvent->GetTrack(i3);
21913      if(!(aftsTrack->InRPSelection())) continue;
21914      phi3=aftsTrack->Phi();
21915      for(Int_t i4=0;i4<nPrim;i4++)
21916      {
21917       if(i4==i1||i4==i2||i4==i3)continue;
21918       aftsTrack=anEvent->GetTrack(i4);
21919       if(!(aftsTrack->InRPSelection())) continue;
21920       phi4=aftsTrack->Phi();
21921       for(Int_t i5=0;i5<nPrim;i5++)
21922       {
21923        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
21924        aftsTrack=anEvent->GetTrack(i5);
21925        if(!(aftsTrack->InRPSelection())) continue;
21926        phi5=aftsTrack->Phi();
21927        for(Int_t i6=0;i6<nPrim;i6++)
21928        {
21929         if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5)continue;
21930         aftsTrack=anEvent->GetTrack(i6);
21931         if(!(aftsTrack->InRPSelection())) continue;
21932         phi6=aftsTrack->Phi(); 
21933         for(Int_t i7=0;i7<nPrim;i7++)
21934         {
21935          if(i7==i1||i7==i2||i7==i3||i7==i4||i7==i5||i7==i6)continue;
21936          aftsTrack=anEvent->GetTrack(i7);
21937          if(!(aftsTrack->InRPSelection())) continue;
21938          phi7=aftsTrack->Phi(); 
21939          if(nPrim==7) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<" "<<i6<<" "<<i7<<"\r"<<flush;
21940          // fill the profile with 7-p correlation:   
21941          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}
21942         } // end of for(Int_t i7=0;i7<nPrim;i7++)
21943        } // end of for(Int_t i6=0;i6<nPrim;i6++) 
21944       } // end of for(Int_t i5=0;i5<nPrim;i5++)
21945      } // end of for(Int_t i4=0;i4<nPrim;i4++)  
21946     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21947    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21948   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21949  } // end of if(nPrim>=7)
21950  
21951  // 8-particle correlations:
21952  if(nPrim>=8 && nPrim<=fMaxAllowedMultiplicity)
21953  {
21954   for(Int_t i1=0;i1<nPrim;i1++)
21955   {
21956    aftsTrack=anEvent->GetTrack(i1);
21957    if(!(aftsTrack->InRPSelection())) continue;
21958    phi1=aftsTrack->Phi();
21959    for(Int_t i2=0;i2<nPrim;i2++)
21960    {
21961     if(i2==i1)continue;
21962     aftsTrack=anEvent->GetTrack(i2);
21963     if(!(aftsTrack->InRPSelection())) continue;
21964     phi2=aftsTrack->Phi();
21965     for(Int_t i3=0;i3<nPrim;i3++)
21966     {
21967      if(i3==i1||i3==i2)continue;
21968      aftsTrack=anEvent->GetTrack(i3);
21969      if(!(aftsTrack->InRPSelection())) continue;
21970      phi3=aftsTrack->Phi();
21971      for(Int_t i4=0;i4<nPrim;i4++)
21972      {
21973       if(i4==i1||i4==i2||i4==i3)continue;
21974       aftsTrack=anEvent->GetTrack(i4);
21975       if(!(aftsTrack->InRPSelection())) continue;
21976       phi4=aftsTrack->Phi();
21977       for(Int_t i5=0;i5<nPrim;i5++)
21978       {
21979        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
21980        aftsTrack=anEvent->GetTrack(i5);
21981        if(!(aftsTrack->InRPSelection())) continue;
21982        phi5=aftsTrack->Phi();
21983        for(Int_t i6=0;i6<nPrim;i6++)
21984        {
21985         if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5)continue;
21986         aftsTrack=anEvent->GetTrack(i6);
21987         if(!(aftsTrack->InRPSelection())) continue;
21988         phi6=aftsTrack->Phi();
21989         for(Int_t i7=0;i7<nPrim;i7++)
21990         {
21991          if(i7==i1||i7==i2||i7==i3||i7==i4||i7==i5||i7==i6)continue;
21992          aftsTrack=anEvent->GetTrack(i7);
21993          if(!(aftsTrack->InRPSelection())) continue;
21994          phi7=aftsTrack->Phi();
21995          for(Int_t i8=0;i8<nPrim;i8++)
21996          {
21997           if(i8==i1||i8==i2||i8==i3||i8==i4||i8==i5||i8==i6||i8==i7)continue;
21998           aftsTrack=anEvent->GetTrack(i8);
21999           if(!(aftsTrack->InRPSelection())) continue;
22000           phi8=aftsTrack->Phi();
22001           cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<" "<<i6<<" "<<i7<<" "<<i8<<"\r"<<flush;
22002           // fill the profile with 8-p correlation:   
22003           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}
22004          } // end of for(Int_t i8=0;i8<nPrim;i8++)
22005         } // end of for(Int_t i7=0;i7<nPrim;i7++) 
22006        } // end of for(Int_t i6=0;i6<nPrim;i6++) 
22007       } // end of for(Int_t i5=0;i5<nPrim;i5++)
22008      } // end of for(Int_t i4=0;i4<nPrim;i4++)  
22009     } // end of for(Int_t i3=0;i3<nPrim;i3++)
22010    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22011   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22012  } // end of if(nPrim>=8)
22013  
22014  cout<<endl;
22015
22016 } // end of AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrelationsWithNestedLoops(AliFlowEventSimple* anEvent)
22017
22018 //================================================================================================================
22019
22020 void AliFlowAnalysisWithQCumulants::EvaluateMixedHarmonicsWithNestedLoops(AliFlowEventSimple * const anEvent)
22021 {
22022  // Evaluate with nested loops multi-particle correlations for mixed harmonics. 
22023   
22024  Int_t nPrim = anEvent->NumberOfTracks(); 
22025  AliFlowTrackSimple *aftsTrack = NULL; 
22026  Double_t phi1=0.;
22027  Double_t phi2=0.; 
22028  Double_t phi3=0.;
22029  Double_t phi4=0.;
22030  Double_t phi5=0.;
22031  /*Double_t phi6=0.;
22032  Double_t phi7=0.;
22033  Double_t phi8=0.;*/ 
22034  Int_t n = fHarmonic; 
22035  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // TBI: is such casting safe in general?
22036  Double_t dMult = (*fSpk)(0,0);
22037  cout<<endl;
22038  cout<<"Multiparticle correlations: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
22039  if(dMult<2)
22040  {
22041   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
22042  } else if (dMult>fMaxAllowedMultiplicity)
22043    {
22044     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
22045    } else 
22046      { 
22047       cout<<"... evaluating nested loops (without using particle weights)..."<<endl;
22048      } 
22049  
22050  // 2-particle correlations:       
22051  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
22052  {
22053   for(Int_t i1=0;i1<nPrim;i1++)
22054   {
22055    aftsTrack=anEvent->GetTrack(i1);
22056    if(!(aftsTrack->InRPSelection())) continue;
22057    phi1=aftsTrack->Phi(); 
22058    for(Int_t i2=0;i2<nPrim;i2++)
22059    {
22060     if(i2==i1)continue;
22061     aftsTrack=anEvent->GetTrack(i2);
22062     if(!(aftsTrack->InRPSelection())) continue;
22063     phi2=aftsTrack->Phi();
22064     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
22065     // Fill the profile fMixedHarmonicsNestedLoops with 2-p correlations: 
22066     fMixedHarmonicsNestedLoops->Fill(0.5,cos(1.*n*(phi1-phi2)),1.); // <cos(1n*(phi1-phi2))>
22067     fMixedHarmonicsNestedLoops->Fill(1.5,cos(2.*n*(phi1-phi2)),1.); // <cos(2n*(phi1-phi2))>
22068     fMixedHarmonicsNestedLoops->Fill(2.5,cos(3.*n*(phi1-phi2)),1.); // <cos(3n*(phi1-phi2))>
22069     fMixedHarmonicsNestedLoops->Fill(3.5,cos(4.*n*(phi1-phi2)),1.); // <cos(4n*(phi1-phi2))>   
22070     fMixedHarmonicsNestedLoops->Fill(4.5,cos(5.*n*(phi1-phi2)),1.); // <cos(5n*(phi1-phi2))>
22071     fMixedHarmonicsNestedLoops->Fill(5.5,cos(6.*n*(phi1-phi2)),1.); // <cos(6n*(phi1-phi2))>   
22072    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22073   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22074  } // end of if(nPrim>=2)
22075  
22076  // 3-particle correlations:         
22077  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
22078  {
22079   for(Int_t i1=0;i1<nPrim;i1++)
22080   {
22081    aftsTrack=anEvent->GetTrack(i1);
22082    if(!(aftsTrack->InRPSelection())) continue;
22083    phi1=aftsTrack->Phi();
22084    for(Int_t i2=0;i2<nPrim;i2++)
22085    {
22086     if(i2==i1)continue;
22087     aftsTrack=anEvent->GetTrack(i2);
22088     if(!(aftsTrack->InRPSelection())) continue;
22089     phi2=aftsTrack->Phi();
22090     for(Int_t i3=0;i3<nPrim;i3++)
22091     {
22092      if(i3==i1||i3==i2)continue;
22093      aftsTrack=anEvent->GetTrack(i3);
22094      if(!(aftsTrack->InRPSelection())) continue;
22095      phi3=aftsTrack->Phi();
22096      if(nPrim==3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush;
22097      // Fill the profile fMixedHarmonicsNestedLoops with 3-p correlations:  
22098      fMixedHarmonicsNestedLoops->Fill( 6.5,cos(2.*n*phi1-n*(phi2+phi3)),1.);       // <3>_{2n|1n,1n}
22099      fMixedHarmonicsNestedLoops->Fill( 7.5,cos(4.*n*phi1-2.*n*phi2-2.*n*phi3),1.); // <3>_{4n|2n,2n}
22100      fMixedHarmonicsNestedLoops->Fill( 8.5,cos(6.*n*phi1-3.*n*phi2-3.*n*phi3),1.); // <3>_{6n|3n,3n}
22101      fMixedHarmonicsNestedLoops->Fill(10.5,cos(3.*n*phi1-2.*n*phi2-n*phi3),1.);    // <3>_{3n|2n,1n}   
22102      fMixedHarmonicsNestedLoops->Fill(11.5,cos(4.*n*phi1-3.*n*phi2-1.*n*phi3),1.); // <3>_{4n|3n,1n}
22103      fMixedHarmonicsNestedLoops->Fill(12.5,cos(5.*n*phi1-3.*n*phi2-2.*n*phi3),1.); // <3>_{5n|3n,2n}
22104      fMixedHarmonicsNestedLoops->Fill(13.5,cos(5.*n*phi1-4.*n*phi2-1.*n*phi3),1.); // <3>_{5n|4n,1n}
22105      fMixedHarmonicsNestedLoops->Fill(14.5,cos(6.*n*phi1-4.*n*phi2-2.*n*phi3),1.); // <3>_{6n|4n,2n}     
22106      fMixedHarmonicsNestedLoops->Fill(15.5,cos(6.*n*phi1-5.*n*phi2-1.*n*phi3),1.); // <3>_{6n|5n,1n}
22107     } // end of for(Int_t i3=0;i3<nPrim;i3++)
22108    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22109   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22110  } // end of if(nPrim>=3)
22111
22112  // 4-particle correlations:
22113  if(nPrim>=4 && nPrim<=fMaxAllowedMultiplicity)
22114  {       
22115   for(Int_t i1=0;i1<nPrim;i1++)
22116   { 
22117    aftsTrack=anEvent->GetTrack(i1);
22118    if(!(aftsTrack->InRPSelection())) continue;
22119    phi1=aftsTrack->Phi();
22120    for(Int_t i2=0;i2<nPrim;i2++)
22121    {
22122     if(i2==i1)continue;
22123     aftsTrack=anEvent->GetTrack(i2);
22124     if(!(aftsTrack->InRPSelection())) continue;
22125     phi2=aftsTrack->Phi();
22126     for(Int_t i3=0;i3<nPrim;i3++)
22127     {
22128      if(i3==i1||i3==i2)continue;
22129      aftsTrack=anEvent->GetTrack(i3);
22130      if(!(aftsTrack->InRPSelection())) continue;
22131      phi3=aftsTrack->Phi();
22132      for(Int_t i4=0;i4<nPrim;i4++)
22133      {
22134       if(i4==i1||i4==i2||i4==i3)continue;
22135       aftsTrack=anEvent->GetTrack(i4);
22136       if(!(aftsTrack->InRPSelection())) continue;
22137       phi4=aftsTrack->Phi();
22138       if(nPrim==4) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<"\r"<<flush;
22139       // fill the profile with 4-p correlations:   
22140       fMixedHarmonicsNestedLoops->Fill(16.5,cos(1.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{1n,1n|1n,1n} 
22141       fMixedHarmonicsNestedLoops->Fill(17.5,cos(2.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{2n,2n|2n,2n} 
22142       fMixedHarmonicsNestedLoops->Fill(18.5,cos(3.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{3n,3n|3n,3n} 
22143       fMixedHarmonicsNestedLoops->Fill(19.5,cos(4.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{4n,4n|4n,4n} 
22144       fMixedHarmonicsNestedLoops->Fill(20.5,cos(5.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{5n,5n|5n,5n} 
22145       fMixedHarmonicsNestedLoops->Fill(21.5,cos(6.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{6n,6n|6n,6n} 
22146       fMixedHarmonicsNestedLoops->Fill(23.5,cos(n*(2.*phi1+1.*phi2-2.*phi3-1.*phi4)),1.); // <4>_{2n,1n|2n,1n} 
22147       fMixedHarmonicsNestedLoops->Fill(24.5,cos(n*(3.*phi1+1.*phi2-3.*phi3-1.*phi4)),1.); // <4>_{3n,1n|3n,1n} 
22148       fMixedHarmonicsNestedLoops->Fill(25.5,cos(n*(3.*phi1+2.*phi2-3.*phi3-2.*phi4)),1.); // <4>_{3n,2n|3n,2n} 
22149       fMixedHarmonicsNestedLoops->Fill(26.5,cos(n*(4.*phi1+1.*phi2-4.*phi3-1.*phi4)),1.); // <4>_{4n,1n|4n,1n} 
22150       fMixedHarmonicsNestedLoops->Fill(27.5,cos(n*(4.*phi1+2.*phi2-4.*phi3-2.*phi4)),1.); // <4>_{4n,2n|4n,2n} 
22151       fMixedHarmonicsNestedLoops->Fill(28.5,cos(n*(4.*phi1+3.*phi2-4.*phi3-3.*phi4)),1.); // <4>_{4n,3n|4n,3n} 
22152       fMixedHarmonicsNestedLoops->Fill(29.5,cos(n*(5.*phi1+1.*phi2-5.*phi3-1.*phi4)),1.); // <4>_{5n,1n|5n,1n} 
22153       fMixedHarmonicsNestedLoops->Fill(30.5,cos(n*(5.*phi1+2.*phi2-5.*phi3-2.*phi4)),1.); // <4>_{5n,2n|5n,2n} 
22154       fMixedHarmonicsNestedLoops->Fill(31.5,cos(n*(5.*phi1+3.*phi2-5.*phi3-3.*phi4)),1.); // <4>_{5n,3n|5n,3n} 
22155       fMixedHarmonicsNestedLoops->Fill(32.5,cos(n*(5.*phi1+4.*phi2-5.*phi3-4.*phi4)),1.); // <4>_{5n,4n|5n,4n} 
22156       fMixedHarmonicsNestedLoops->Fill(33.5,cos(n*(6.*phi1+1.*phi2-6.*phi3-1.*phi4)),1.); // <4>_{6n,1n|6n,1n} 
22157       fMixedHarmonicsNestedLoops->Fill(34.5,cos(n*(6.*phi1+2.*phi2-6.*phi3-2.*phi4)),1.); // <4>_{6n,2n|6n,2n} 
22158       fMixedHarmonicsNestedLoops->Fill(35.5,cos(n*(6.*phi1+3.*phi2-6.*phi3-3.*phi4)),1.); // <4>_{6n,3n|6n,3n} 
22159       fMixedHarmonicsNestedLoops->Fill(36.5,cos(n*(6.*phi1+4.*phi2-6.*phi3-4.*phi4)),1.); // <4>_{6n,4n|6n,4n} 
22160       fMixedHarmonicsNestedLoops->Fill(37.5,cos(n*(6.*phi1+5.*phi2-6.*phi3-5.*phi4)),1.); // <4>_{6n,5n|6n,5n} 
22161       fMixedHarmonicsNestedLoops->Fill(39.5,cos(n*(3.*phi1-1.*phi2-1.*phi3-1.*phi4)),1.); // <4>_{3n|1n,1n,1n} 
22162       fMixedHarmonicsNestedLoops->Fill(40.5,cos(n*(6.*phi1-2.*phi2-2.*phi3-2.*phi4)),1.); // <4>_{6n|2n,2n,2n} 
22163       fMixedHarmonicsNestedLoops->Fill(42.5,cos(n*(3.*phi1+1.*phi2-2.*phi3-2.*phi4)),1.); // <4>_{3n,1n|2n,2n} 
22164       fMixedHarmonicsNestedLoops->Fill(43.5,cos(n*(4.*phi1-2.*phi2-1.*phi3-1.*phi4)),1.); // <4>_{4n|2n,1n,1n} 
22165       fMixedHarmonicsNestedLoops->Fill(44.5,cos(n*(4.*phi1+2.*phi2-3.*phi3-3.*phi4)),1.); // <4>_{4n,2n|3n,3n} 
22166       fMixedHarmonicsNestedLoops->Fill(45.5,cos(n*(5.*phi1-2.*phi2-2.*phi3-1.*phi4)),1.); // <4>_{5n|2n,2n,1n} 
22167       fMixedHarmonicsNestedLoops->Fill(46.5,cos(n*(5.*phi1-3.*phi2-1.*phi3-1.*phi4)),1.); // <4>_{5n|3n,1n,1n} 
22168       fMixedHarmonicsNestedLoops->Fill(47.5,cos(n*(5.*phi1+1.*phi2-3.*phi3-3.*phi4)),1.); // <4>_{5n,1n|3n,3n} 
22169       fMixedHarmonicsNestedLoops->Fill(48.5,cos(n*(5.*phi1+3.*phi2-4.*phi3-4.*phi4)),1.); // <4>_{5n,3n|4n,4n} 
22170       fMixedHarmonicsNestedLoops->Fill(49.5,cos(n*(6.*phi1-4.*phi2-1.*phi3-1.*phi4)),1.); // <4>_{6n|4n,1n,1n} 
22171       fMixedHarmonicsNestedLoops->Fill(50.5,cos(n*(6.*phi1+2.*phi2-4.*phi3-4.*phi4)),1.); // <4>_{6n,2n|4n,4n} 
22172       fMixedHarmonicsNestedLoops->Fill(51.5,cos(n*(6.*phi1+4.*phi2-5.*phi3-5.*phi4)),1.); // <4>_{6n,4n|5n,5n} 
22173       fMixedHarmonicsNestedLoops->Fill(53.5,cos(n*(4.*phi1+1.*phi2-3.*phi3-2.*phi4)),1.); // <4>_{4n,1n|3n,2n} 
22174       fMixedHarmonicsNestedLoops->Fill(54.5,cos(n*(5.*phi1+1.*phi2-4.*phi3-2.*phi4)),1.); // <4>_{5n,1n|4n,2n} 
22175       fMixedHarmonicsNestedLoops->Fill(55.5,cos(n*(5.*phi1+2.*phi2-4.*phi3-3.*phi4)),1.); // <4>_{5n,2n|4n,3n} 
22176       fMixedHarmonicsNestedLoops->Fill(56.5,cos(n*(6.*phi1+1.*phi2-4.*phi3-3.*phi4)),1.); // <4>_{6n,1n|4n,3n} 
22177       fMixedHarmonicsNestedLoops->Fill(57.5,cos(n*(6.*phi1+1.*phi2-5.*phi3-2.*phi4)),1.); // <4>_{6n,1n|5n,2n} 
22178       fMixedHarmonicsNestedLoops->Fill(58.5,cos(n*(6.*phi1-3.*phi2-2.*phi3-1.*phi4)),1.); // <4>_{6n|3n,2n,1n} 
22179       fMixedHarmonicsNestedLoops->Fill(59.5,cos(n*(6.*phi1+2.*phi2-5.*phi3-3.*phi4)),1.); // <4>_{6n,2n|5n,3n} 
22180       fMixedHarmonicsNestedLoops->Fill(60.5,cos(n*(6.*phi1+3.*phi2-5.*phi3-4.*phi4)),1.); // <4>_{6n,3n|5n,4n} 
22181      } // end of for(Int_t i4=0;i4<nPrim;i4++) 
22182     } // end of for(Int_t i3=0;i3<nPrim;i3++)
22183    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22184   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22185  } // end of if(nPrim>=)
22186
22187  // 5-particle correlations:      
22188  if(nPrim>=5 && nPrim<=fMaxAllowedMultiplicity)
22189  {
22190   for(Int_t i1=0;i1<nPrim;i1++)
22191   {
22192    aftsTrack=anEvent->GetTrack(i1);
22193    if(!(aftsTrack->InRPSelection())) continue;  
22194    phi1=aftsTrack->Phi();
22195    for(Int_t i2=0;i2<nPrim;i2++)
22196    {
22197     if(i2==i1)continue;
22198     aftsTrack=anEvent->GetTrack(i2);
22199     if(!(aftsTrack->InRPSelection())) continue;
22200     phi2=aftsTrack->Phi();
22201     for(Int_t i3=0;i3<nPrim;i3++)
22202     {
22203      if(i3==i1||i3==i2)continue;
22204      aftsTrack=anEvent->GetTrack(i3);
22205      if(!(aftsTrack->InRPSelection())) continue;
22206      phi3=aftsTrack->Phi();
22207      for(Int_t i4=0;i4<nPrim;i4++)
22208      {
22209       if(i4==i1||i4==i2||i4==i3)continue;
22210       aftsTrack=anEvent->GetTrack(i4);
22211       if(!(aftsTrack->InRPSelection())) continue;
22212       phi4=aftsTrack->Phi();
22213       for(Int_t i5=0;i5<nPrim;i5++)
22214       {
22215        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
22216        aftsTrack=anEvent->GetTrack(i5);
22217        if(!(aftsTrack->InRPSelection())) continue;
22218        phi5=aftsTrack->Phi();
22219        if(nPrim==5) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<"\r"<<flush;
22220        // fill the profile with 5-p correlations:   
22221        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))>
22222        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))>
22223        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))>
22224        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))>
22225        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))>
22226        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))>
22227        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))>
22228        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))>
22229        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))>
22230        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))>
22231        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))>
22232        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))>
22233        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))>
22234        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))>
22235        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))>
22236        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))>
22237        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))>
22238        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))>
22239        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))>
22240        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))>
22241        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))>
22242        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))>
22243        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))>
22244        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))>
22245        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))>
22246        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))>
22247        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))>
22248        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))>
22249        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))>
22250        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))>
22251        //fMixedHarmonicsNestedLoops->Fill(91.5,-44.,1.); // empty
22252        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))>
22253        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))>
22254        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))>
22255        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))>
22256        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))>
22257        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))>
22258        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))>
22259        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))>
22260        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))>
22261        //fMixedHarmonicsNestedLoops->Fill(101.5,-44.,1.); // empty
22262        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))>
22263        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))>
22264        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))>
22265        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))>
22266        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))>
22267        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))>
22268        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))>
22269        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))>
22270        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))>
22271        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))>
22272        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))>
22273        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))>
22274        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))>
22275        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))>
22276        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))>
22277        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))>
22278        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))>
22279        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))>
22280        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))>
22281        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))>
22282        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))>
22283        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))>
22284        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))>
22285        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))>
22286        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))>
22287        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))>
22288        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))>
22289        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))>
22290        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))>
22291        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
22292        //fMixedHarmonicsNestedLoops->Fill(132.5,-44.,1.); // empty
22293        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))>
22294        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))>
22295        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))>
22296        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))>
22297        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))>
22298        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))>
22299        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))>
22300        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))>
22301        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))>
22302        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))>
22303        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))>
22304        //fMixedHarmonicsNestedLoops->Fill(144.5,-44.,1.); // empty
22305        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))>
22306        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))>
22307        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))>
22308       } // end of for(Int_t i5=0;i5<nPrim;i5++)
22309      } // end of for(Int_t i4=0;i4<nPrim;i4++)  
22310     } // end of for(Int_t i3=0;i3<nPrim;i3++)
22311    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22312   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22313  } // end of if(nPrim>=5)
22314
22315  // QW44
22316
22317 } // end of void AliFlowAnalysisWithQCumulants::EvaluateMixedHarmonicsWithNestedLoops(AliFlowEventSimple * const anEvent)
22318
22319 //================================================================================================================
22320
22321 void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowCorrelations()
22322 {
22323  // Cross-check results for multiparticle correlations needed for int. flow: results from Q-vectors vs results from nested loops.
22324
22325  cout<<endl;
22326  cout<<endl;
22327  cout<<"   *****************************************"<<endl;
22328  cout<<"   **** cross-checking the correlations ****"<<endl;
22329  cout<<"   ****       for integrated flow       ****"<<endl;
22330  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
22331  {
22332   cout<<"   ****   (particle weights not used)   ****"<<endl;
22333  } else
22334    {
22335     cout<<"   ****     (particle weights used)     ****"<<endl;
22336    } 
22337  cout<<"   *****************************************"<<endl;
22338  cout<<endl;
22339  cout<<endl;
22340
22341  Int_t ciMax = 64; // to be improved (removed eventually when I calculate 6th and 8th order with particle weights)
22342  
22343  if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
22344  {
22345   ciMax = 11;
22346  }
22347
22348  for(Int_t ci=1;ci<=ciMax;ci++)
22349  {
22350   if(strcmp((fIntFlowCorrelationsAllPro->GetXaxis())->GetBinLabel(ci), "") == 0) continue; // to be improved (access finalized histogram here)
22351   cout<<(fIntFlowCorrelationsAllPro->GetXaxis())->GetBinLabel(ci)<<":"<<endl; // to be improved (access finalized histogram here)
22352   cout<<"from Q-vectors    = "<<fIntFlowCorrelationsAllPro->GetBinContent(ci)<<endl; // to be improved (access finalized histogram here)
22353   cout<<"from nested loops = "<<fIntFlowDirectCorrelations->GetBinContent(ci)<<endl;
22354   cout<<endl;
22355  }
22356
22357  if(!fCalculateMixedHarmonics){return;}
22358
22359  cout<<endl;
22360  cout<<endl;
22361  cout<<"   *****************************************"<<endl;
22362  cout<<"   **** cross-checking the correlations ****"<<endl;
22363  cout<<"   ****       for mixed harmonics       ****"<<endl;
22364  cout<<"   *****************************************"<<endl;
22365  cout<<endl;
22366  cout<<endl;
22367
22368  // 2-p:
22369  for(Int_t ci=1;ci<=6;ci++)
22370  {
22371   cout<<(f2pCorrelations->GetXaxis())->GetBinLabel(ci)<<":"<<endl;
22372   cout<<"from Q-vectors    = "<<f2pCorrelations->GetBinContent(ci)<<endl; 
22373   cout<<"from nested loops = "<<fMixedHarmonicsNestedLoops->GetBinContent(ci)<<endl;
22374   cout<<endl;
22375  } // end of for(Int_t ci=1;ci<=6;ci++)
22376
22377  // 3-p:
22378  for(Int_t ci=1;ci<=10;ci++)
22379  {
22380   if(4==ci){continue;} // skipping the empty bins
22381   cout<<(f3pCorrelations->GetXaxis())->GetBinLabel(ci)<<":"<<endl;
22382   cout<<"from Q-vectors    = "<<f3pCorrelations->GetBinContent(ci)<<endl; 
22383   cout<<"from nested loops = "<<fMixedHarmonicsNestedLoops->GetBinContent(ci+6)<<endl;
22384   cout<<endl;
22385  } // end of for(Int_t ci=1;ci<=10;ci++)
22386
22387  // 4-p:
22388  for(Int_t ci=1;ci<=45;ci++)
22389  {
22390   if(7==ci||23==ci||26==ci||37==ci){continue;} // skipping the empty bins
22391   cout<<(f4pCorrelations->GetXaxis())->GetBinLabel(ci)<<":"<<endl;
22392   cout<<"from Q-vectors    = "<<f4pCorrelations->GetBinContent(ci)<<endl; 
22393   cout<<"from nested loops = "<<fMixedHarmonicsNestedLoops->GetBinContent(ci+6+10)<<endl;
22394   //if(TMath::Abs(f4pCorrelations->GetBinContent(ci)-fMixedHarmonicsNestedLoops->GetBinContent(ci+6+10))
22395   //   > 1.e-10){exit(0);}
22396   cout<<endl;
22397  } // end of for(Int_t ci=1;ci<=45;ci++)
22398
22399  for(Int_t ci=1;ci<=87;ci++)
22400  {
22401   if(31==ci||41==ci||72==ci||84==ci){continue;} // skipping the empty bins
22402   cout<<(f5pCorrelations->GetXaxis())->GetBinLabel(ci)<<":"<<endl;
22403   cout<<"from Q-vectors    = "<<f5pCorrelations->GetBinContent(ci)<<endl; 
22404   cout<<"from nested loops = "<<fMixedHarmonicsNestedLoops->GetBinContent(ci+6+10+45)<<endl;
22405   if(TMath::Abs(f5pCorrelations->GetBinContent(ci)-fMixedHarmonicsNestedLoops->GetBinContent(ci+6+10+45))
22406      > 1.e-10){exit(0);}
22407   cout<<endl;
22408  } // end of for(Int_t ci=1;ci<=87;ci++)
22409
22410  return;
22411
22412 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowCorrelations()
22413
22414 //=======================================================================================================================
22415
22416 void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowCorrectionTermsForNUA()
22417 {
22418  // Cross-check results for corrections terms for non-uniform acceptance needed for int. flow: results from Q-vectors vs results from nested loops.
22419
22420  cout<<endl;
22421  cout<<endl;
22422  cout<<"   *********************************************"<<endl;
22423  cout<<"   **** cross-checking the correction terms ****"<<endl;
22424  cout<<"   **** for non-uniform acceptance relevant ****"<<endl;
22425  cout<<"   ****         for integrated flow         ****"<<endl;
22426  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
22427  {
22428   cout<<"   ****     (particle weights not used)     ****"<<endl;
22429  } else
22430    {
22431     cout<<"   ****       (particle weights used)       ****"<<endl;
22432    } 
22433  cout<<"   *********************************************"<<endl;
22434  cout<<endl;
22435  cout<<endl;
22436
22437  for(Int_t ci=1;ci<=4;ci++) // correction term index (to be improved - hardwired 4)
22438  {
22439   for(Int_t sc=0;sc<2;sc++) // sin or cos term
22440   {
22441    if(strcmp((fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->GetBinLabel(ci), "") == 0) continue; // to be improved (access finalized histogram here)
22442    cout<<(fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->GetBinLabel(ci)<<":"<<endl; // to be improved (access finalized histogram here)
22443    cout<<"from Q-vectors    = "<<fIntFlowCorrectionTermsForNUAPro[sc]->GetBinContent(ci)<<endl; // to be improved (access finalized histogram here)
22444    cout<<"from nested loops = "<<fIntFlowDirectCorrectionTermsForNUA[sc]->GetBinContent(ci)<<endl;
22445    cout<<endl;
22446   } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos term
22447  } // end of for(Int_t ci=1;ci<=10;ci++) // correction term index
22448   
22449 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowCorrectionTermsForNUA() 
22450
22451 //=======================================================================================================================
22452
22453 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrelationsWithNestedLoopsUsingParticleWeights(AliFlowEventSimple * const anEvent)
22454 {
22455  // Evaluate with nested loops multiparticle correlations for integrated flow (using the particle weights). 
22456
22457  // Results are stored in profile fIntFlowDirectCorrelations. 
22458  // Remark 1: When particle weights are used the binning of fIntFlowDirectCorrelations is organized as follows:
22459  //
22460  //  1st bin: <2>_{1n|1n} = two1n1nW1W1 = <w1 w2 cos(n*(phi1-phi2))>
22461  //  2nd bin: <2>_{2n|2n} = two2n2nW2W2 = <w1^2 w2^2 cos(2n*(phi1-phi2))>
22462  //  3rd bin: <2>_{3n|3n} = two3n3nW3W3 = <w1^3 w2^3 cos(3n*(phi1-phi2))> 
22463  //  4th bin: <2>_{4n|4n} = two4n4nW4W4 = <w1^4 w2^4 cos(4n*(phi1-phi2))>
22464  //  5th bin:           ----  EMPTY ----
22465  //  6th bin: <3>_{2n|1n,1n} = three2n1n1nW2W1W1 = <w1^2 w2 w3 cos(n*(2phi1-phi2-phi3))>
22466  //  7th bin: <3>_{3n|2n,1n} = ...
22467  //  8th bin: <3>_{4n|2n,2n} = ...
22468  //  9th bin: <3>_{4n|3n,1n} = ...
22469  // 10th bin:           ----  EMPTY ----
22470  // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1nW1W1W1W1 = <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))>
22471  // 12th bin: <4>_{2n,1n|2n,1n} = ...
22472  // 13th bin: <4>_{2n,2n|2n,2n} = ...
22473  // 14th bin: <4>_{3n|1n,1n,1n} = ... 
22474  // 15th bin: <4>_{3n,1n|3n,1n} = ...
22475  // 16th bin: <4>_{3n,1n|2n,2n} = ...
22476  // 17th bin: <4>_{4n|2n,1n,1n} = ... 
22477  // 18th bin:           ----  EMPTY ----
22478  // 19th bin: <5>_{2n|1n,1n,1n,1n} = ...
22479  // 20th bin: <5>_{2n,2n|2n,1n,1n} = ...
22480  // 21st bin: <5>_{3n,1n|2n,1n,1n} = ...
22481  // 22nd bin: <5>_{4n|1n,1n,1n,1n} = ...
22482  // 23rd bin:           ----  EMPTY ----
22483  // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = ...
22484  // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = ...
22485  // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = ...
22486  // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = ...
22487  // 28th bin:           ----  EMPTY ----
22488  // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = ...
22489  // 30th bin:           ----  EMPTY ----
22490  // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = ...
22491  
22492  // Remark 2: When particle weights are used there are some extra correlations. They are stored in 
22493  // fIntFlowExtraDirectCorrelations binning of which is organized as follows:
22494  
22495  // 1st bin: two1n1nW3W1 = <w1^3 w2 cos(n*(phi1-phi2))>
22496  // 2nd bin: two1n1nW1W1W2 = <w1 w2 w3^2 cos(n*(phi1-phi2))>  
22497  // ...
22498  
22499  Int_t nPrim = anEvent->NumberOfTracks(); 
22500  AliFlowTrackSimple *aftsTrack = NULL;
22501  //Double_t phi1=0., phi2=0., phi3=0., phi4=0., phi5=0., phi6=0., phi7=0., phi8=0.;
22502  //Double_t wPhi1=1., wPhi2=1., wPhi3=1., wPhi4=1., wPhi5=1., wPhi6=1., wPhi7=1., wPhi8=1.;
22503  Double_t phi1=0., phi2=0., phi3=0., phi4=0.;
22504  Double_t wPhi1=1., wPhi2=1., wPhi3=1., wPhi4=1.;
22505  Int_t n = fHarmonic; 
22506  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // to be improved (is this casting safe in general?)
22507  Double_t dMult = (*fSpk)(0,0);
22508  cout<<endl;
22509  cout<<"Multiparticle correlations: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
22510  if(dMult<2)
22511  {
22512   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
22513  } else if (dMult>fMaxAllowedMultiplicity)
22514    {
22515     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
22516    } else 
22517      { 
22518       cout<<"... evaluating nested loops (using particle weights) ..."<<endl;
22519      } 
22520       
22521  // 2-particle correlations:       
22522  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
22523  {
22524   // 2 nested loops multiparticle correlations using particle weights:       
22525   for(Int_t i1=0;i1<nPrim;i1++)
22526   {
22527    aftsTrack=anEvent->GetTrack(i1);
22528    if(!(aftsTrack->InRPSelection())) continue;
22529    phi1=aftsTrack->Phi();
22530    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
22531    for(Int_t i2=0;i2<nPrim;i2++)
22532    {
22533     if(i2==i1)continue;
22534     aftsTrack=anEvent->GetTrack(i2);
22535     if(!(aftsTrack->InRPSelection())) continue;
22536     phi2=aftsTrack->Phi();
22537     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));   
22538     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
22539     // 2-p correlations using particle weights:
22540     if(fUsePhiWeights) fIntFlowDirectCorrelations->Fill(0.5,cos(n*(phi1-phi2)),wPhi1*wPhi2);                  // <w1   w2   cos( n*(phi1-phi2))>
22541     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))>
22542     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))>
22543     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))> 
22544     // extra correlations: 
22545     // 2-p extra correlations (do not appear if particle weights are not used):
22546     if(fUsePhiWeights) fIntFlowExtraDirectCorrelations->Fill(0.5,cos(n*(phi1-phi2)),pow(wPhi1,3)*wPhi2); // <w1^3 w2 cos(n*(phi1-phi2))>
22547     // ...
22548    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22549   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22550  } // end of if(nPrim>=2)
22551
22552  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
22553  { 
22554   // 3 nested loops multiparticle correlations using particle weights:       
22555   for(Int_t i1=0;i1<nPrim;i1++)
22556   {
22557    aftsTrack=anEvent->GetTrack(i1);
22558    if(!(aftsTrack->InRPSelection())) continue;
22559    phi1=aftsTrack->Phi();
22560    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
22561    for(Int_t i2=0;i2<nPrim;i2++)
22562    {
22563     if(i2==i1)continue;
22564     aftsTrack=anEvent->GetTrack(i2);
22565     if(!(aftsTrack->InRPSelection())) continue;
22566     phi2=aftsTrack->Phi();
22567     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
22568     for(Int_t i3=0;i3<nPrim;i3++)
22569     {
22570      if(i3==i1||i3==i2)continue;
22571      aftsTrack=anEvent->GetTrack(i3);
22572      if(!(aftsTrack->InRPSelection())) continue;
22573      phi3=aftsTrack->Phi();
22574      if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
22575      if(nPrim==3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush;
22576      // 3-p correlations using particle weights:
22577      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))>
22578      // ...
22579      // extra correlations: 
22580      // 2-p extra correlations (do not appear if particle weights are not used):
22581       if(fUsePhiWeights) fIntFlowExtraDirectCorrelations->Fill(1.5,cos(n*(phi1-phi2)),wPhi1*wPhi2*pow(wPhi3,2)); // <w1 w2 w3^2 cos(n*(phi1-phi2))>
22582      // ...
22583      // 3-p extra correlations (do not appear if particle weights are not used):
22584      // ...
22585     } // end of for(Int_t i3=0;i3<nPrim;i3++)
22586    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22587   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22588  } // end of if(nPrim>=3)
22589  
22590  if(nPrim>=4 && nPrim<=fMaxAllowedMultiplicity)
22591  {
22592   // 4 nested loops multiparticle correlations using particle weights:       
22593   for(Int_t i1=0;i1<nPrim;i1++)
22594   {
22595    aftsTrack=anEvent->GetTrack(i1);
22596    if(!(aftsTrack->InRPSelection())) continue;
22597    phi1=aftsTrack->Phi();
22598    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
22599    for(Int_t i2=0;i2<nPrim;i2++)
22600    {
22601     if(i2==i1)continue;
22602     aftsTrack=anEvent->GetTrack(i2);
22603     if(!(aftsTrack->InRPSelection())) continue;
22604     phi2=aftsTrack->Phi();
22605     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
22606     for(Int_t i3=0;i3<nPrim;i3++)
22607     {
22608      if(i3==i1||i3==i2)continue;
22609      aftsTrack=anEvent->GetTrack(i3);
22610      if(!(aftsTrack->InRPSelection())) continue;
22611      phi3=aftsTrack->Phi();
22612      if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
22613      for(Int_t i4=0;i4<nPrim;i4++)
22614      {
22615       if(i4==i1||i4==i2||i4==i3)continue;
22616       aftsTrack=anEvent->GetTrack(i4);
22617       if(!(aftsTrack->InRPSelection())) continue;
22618       phi4=aftsTrack->Phi();
22619       if(fUsePhiWeights && fPhiWeights) wPhi4 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi4*fnBinsPhi/TMath::TwoPi())));
22620       if(nPrim>=4) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<"\r"<<flush; // to be improved (replace eventually this if statement with if(nPrim==4))
22621       // 4-p correlations using particle weights:
22622       if(fUsePhiWeights) fIntFlowDirectCorrelations->Fill(10.5,cos(n*phi1+n*phi2-n*phi3-n*phi4),wPhi1*wPhi2*wPhi3*wPhi4); 
22623       // extra correlations: 
22624       // 2-p extra correlations (do not appear if particle weights are not used):
22625       // ...
22626       // 3-p extra correlations (do not appear if particle weights are not used):
22627       // ...
22628       // 4-p extra correlations (do not appear if particle weights are not used):
22629       // ...
22630      } // end of for(Int_t i4=0;i4<nPrim;i4++) 
22631     } // end of for(Int_t i3=0;i3<nPrim;i3++)
22632    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22633   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22634  } // end of if(nPrim>=4)
22635
22636  cout<<endl; 
22637
22638 } // end of void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrelationsWithNestedLoopsUsingParticleWeights(AliFlowEventSimple* anEvent)
22639
22640 //=======================================================================================================================
22641
22642 void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowExtraCorrelations()
22643 {
22644  // Cross-check results for extra multiparticle correlations needed for int. flow 
22645  // which appear only when particle weights are used: results from Q-vectors vs results from nested loops.
22646
22647  cout<<endl;
22648  cout<<endl;
22649  cout<<"   ***********************************************"<<endl;
22650  cout<<"   **** cross-checking the extra correlations ****"<<endl;
22651  cout<<"   ****          for integrated flow          ****"<<endl;
22652  cout<<"   ***********************************************"<<endl;
22653  cout<<endl;
22654  cout<<endl;
22655  
22656  for(Int_t eci=1;eci<=2;eci++) // to be improved (increased eciMax eventually when I calculate 6th and 8th)
22657  {
22658   if(strcmp((fIntFlowExtraCorrelationsPro->GetXaxis())->GetBinLabel(eci), "") == 0) continue;
22659   cout<<(fIntFlowExtraCorrelationsPro->GetXaxis())->GetBinLabel(eci)<<":"<<endl;
22660   cout<<"from Q-vectors    = "<<fIntFlowExtraCorrelationsPro->GetBinContent(eci)<<endl;
22661   cout<<"from nested loops = "<<fIntFlowExtraDirectCorrelations->GetBinContent(eci)<<endl;
22662   cout<<endl;
22663  }
22664
22665 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowExtraCorrelations()
22666
22667 //=======================================================================================================================
22668
22669 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrectionsForNUAWithNestedLoops(AliFlowEventSimple * const anEvent)
22670 {
22671  // Evaluate with nested loops correction terms for non-uniform acceptance relevant for NONAME integrated flow (to be improved (name)).
22672  //
22673  // Remark: Both sin and cos correction terms are calculated in this method. Sin terms are stored in fIntFlowDirectCorrectionTermsForNUA[0],
22674  // and cos terms in fIntFlowDirectCorrectionTermsForNUA[1]. Binning of fIntFlowDirectCorrectionTermsForNUA[sc] is organized as follows 
22675  // (sc stands for either sin or cos):
22676  
22677  //  1st bin: <<sc(n*(phi1))>> 
22678  //  2nd bin: <<sc(n*(phi1+phi2))>> 
22679  //  3rd bin: <<sc(n*(phi1-phi2-phi3))>>
22680  //  4th bin: <<sc(n*(2phi1-phi2))>>
22681  
22682  Int_t nPrim = anEvent->NumberOfTracks(); 
22683  AliFlowTrackSimple *aftsTrack = NULL;
22684  Double_t phi1=0., phi2=0., phi3=0.;
22685  Int_t n = fHarmonic; 
22686  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // to be improved (is this casting safe in general?)
22687  Double_t dMult = (*fSpk)(0,0);
22688  cout<<endl;
22689  cout<<"Correction terms for non-uniform acceptance: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
22690  if(dMult<1)
22691  {
22692   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
22693  } else if (dMult>fMaxAllowedMultiplicity)
22694    {
22695     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
22696    } else 
22697      { 
22698       cout<<"... evaluating nested loops (without using particle weights)..."<<endl;
22699      }
22700  
22701  if(nPrim>=1 && nPrim<=fMaxAllowedMultiplicity)
22702  {
22703   // 1-particle correction terms for non-uniform acceptance:       
22704   for(Int_t i1=0;i1<nPrim;i1++)
22705   {
22706    aftsTrack=anEvent->GetTrack(i1);
22707    if(!(aftsTrack->InRPSelection())) continue;
22708    phi1=aftsTrack->Phi();
22709    if(nPrim==1) cout<<i1<<"\r"<<flush;
22710    // sin terms:
22711    fIntFlowDirectCorrectionTermsForNUA[0]->Fill(0.5,sin(n*phi1),1.); // <sin(n*phi1)>  
22712    // cos terms:
22713    fIntFlowDirectCorrectionTermsForNUA[1]->Fill(0.5,cos(n*phi1),1.); // <cos(n*phi1)>
22714   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22715  } // end of if(nPrim>=1) 
22716   
22717  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
22718  {
22719   // 2-particle correction terms for non-uniform acceptance:       
22720   for(Int_t i1=0;i1<nPrim;i1++)
22721   {
22722    aftsTrack=anEvent->GetTrack(i1);
22723    if(!(aftsTrack->InRPSelection())) continue;
22724    phi1=aftsTrack->Phi();  
22725    for(Int_t i2=0;i2<nPrim;i2++)
22726    {
22727     if(i2==i1)continue;
22728     aftsTrack=anEvent->GetTrack(i2);
22729     if(!(aftsTrack->InRPSelection())) continue;
22730     phi2=aftsTrack->Phi();
22731     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
22732     // sin terms:
22733     fIntFlowDirectCorrectionTermsForNUA[0]->Fill(1.5,sin(n*(phi1+phi2)),1.); // <<sin(n*(phi1+phi2))>>
22734     fIntFlowDirectCorrectionTermsForNUA[0]->Fill(3.5,sin(n*(2*phi1-phi2)),1.); // <<sin(n*(2*phi1-phi2))>>
22735     // cos terms:
22736     fIntFlowDirectCorrectionTermsForNUA[1]->Fill(1.5,cos(n*(phi1+phi2)),1.); // <<cos(n*(phi1+phi2))>>
22737     fIntFlowDirectCorrectionTermsForNUA[1]->Fill(3.5,cos(n*(2*phi1-phi2)),1.); // <<cos(n*(2*phi1-phi2))>>
22738    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22739   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22740  } // end of if(nPrim>=2)
22741
22742  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
22743  {
22744   // 3-particle correction terms for non-uniform acceptance:       
22745   for(Int_t i1=0;i1<nPrim;i1++)
22746   {
22747    aftsTrack=anEvent->GetTrack(i1);
22748    if(!(aftsTrack->InRPSelection())) continue;
22749    phi1=aftsTrack->Phi();
22750    for(Int_t i2=0;i2<nPrim;i2++)
22751    {
22752     if(i2==i1)continue;
22753     aftsTrack=anEvent->GetTrack(i2);
22754     if(!(aftsTrack->InRPSelection())) continue;
22755     phi2=aftsTrack->Phi();
22756     for(Int_t i3=0;i3<nPrim;i3++)
22757     {
22758      if(i3==i1||i3==i2)continue;
22759      aftsTrack=anEvent->GetTrack(i3);
22760      if(!(aftsTrack->InRPSelection())) continue;
22761      phi3=aftsTrack->Phi();
22762      if(nPrim>=3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush; // to be improved (eventually I will change this if statement)
22763      // sin terms:
22764      fIntFlowDirectCorrectionTermsForNUA[0]->Fill(2.5,sin(n*(phi1-phi2-phi3)),1.); // <<sin(n*(phi1-phi2-phi3))>>
22765      // cos terms:
22766      fIntFlowDirectCorrectionTermsForNUA[1]->Fill(2.5,cos(n*(phi1-phi2-phi3)),1.); // <<cos(n*(phi1-phi2-phi3))>>
22767     } // end of for(Int_t i3=0;i3<nPrim;i3++)
22768    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22769   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22770  } // end of if(nPrim>=3)
22771
22772  cout<<endl;
22773 }
22774
22775 //=======================================================================================================================
22776
22777 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrelationsWithNestedLoops(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
22778 {
22779  // Evaluate reduced correlations with nested loops without using the particle weights.
22780  
22781  // Remark 1: Reduced correlations are evaluated in pt bin number fCrossCheckInPtBinNo and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
22782  // Remark 2: Results are stored in 1 bin profiles fDiffFlowDirectCorrelations[t][pe][ci], where indices runs as follows:
22783  //           [0=RP,1=POI][0=Pt,1=Eta][0=<2'>,1=<4'>,2=<6'>,3=<8'>] 
22784  // Remark 3: <2'> = <cos(n*(psi1-phi2))>
22785  //           <4'> = <cos(n*(psi1+phi2-phi3-phi4))>
22786  // ...
22787  
22788  Int_t typeFlag = 0;
22789  Int_t ptEtaFlag = 0;
22790  if(type == "RP")
22791  {
22792   typeFlag = 0;
22793  } else if(type == "POI")
22794    {
22795     typeFlag = 1;
22796    }      
22797  if(ptOrEta == "Pt")
22798  {
22799   ptEtaFlag = 0;
22800  } else if(ptOrEta == "Eta")
22801    {
22802     ptEtaFlag = 1;
22803    } 
22804  // shortcuts:
22805  Int_t t = typeFlag;
22806  Int_t pe = ptEtaFlag;
22807       
22808  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
22809  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
22810  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
22811  
22812  Int_t nPrim = anEvent->NumberOfTracks(); 
22813  AliFlowTrackSimple *aftsTrack = NULL;
22814  
22815  Double_t psi1=0., phi2=0., phi3=0., phi4=0.;// phi5=0., phi6=0., phi7=0., phi8=0.;
22816  
22817  Int_t n = fHarmonic; 
22818   
22819  // 2'-particle correlations:
22820  for(Int_t i1=0;i1<nPrim;i1++)
22821  {
22822   aftsTrack=anEvent->GetTrack(i1);
22823   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22824   if(typeFlag==1) // this is diff flow of POIs 
22825   {
22826    if(ptOrEta == "Pt")
22827    { 
22828     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22829    } else if (ptOrEta == "Eta")
22830      {
22831       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22832      }
22833   } else // this is diff flow of RPs 
22834     {
22835      if(ptOrEta == "Pt")
22836      { 
22837       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22838      } else if (ptOrEta == "Eta")
22839        {
22840         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22841        }
22842     }
22843        
22844   psi1=aftsTrack->Phi(); 
22845   for(Int_t i2=0;i2<nPrim;i2++)
22846   {
22847    if(i2==i1)continue;
22848    aftsTrack=anEvent->GetTrack(i2);
22849    // RP condition (!(first) particle in the correlator must be RP):
22850    if(!(aftsTrack->InRPSelection()))continue;
22851    phi2=aftsTrack->Phi();   
22852    // 2'-particle correlations: 
22853    fDiffFlowDirectCorrelations[t][pe][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(1.*n*(psi1-phi2)),1.); // <cos(n*(psi1-phi2))  
22854   }//end of for(Int_t i2=0;i2<nPrim;i2++)
22855  }//end of for(Int_t i1=0;i1<nPrim;i1++)
22856  
22857  /*
22858  
22859  // 3'-particle correlations:
22860  for(Int_t i1=0;i1<nPrim;i1++)
22861  {
22862   aftsTrack=anEvent->GetTrack(i1);
22863   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22864   if(ptOrEta == "Pt")
22865   { 
22866    if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22867   } else if (ptOrEta == "Eta")
22868     {
22869      if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22870     }
22871   psi1=aftsTrack->Phi();
22872   for(Int_t i2=0;i2<nPrim;i2++)
22873   {
22874    if(i2==i1)continue;
22875    aftsTrack=anEvent->GetTrack(i2);
22876    // RP condition (!(first) particle in the correlator must be RP):
22877    if(!(aftsTrack->InRPSelection())) continue;
22878    phi2=aftsTrack->Phi();
22879    for(Int_t i3=0;i3<nPrim;i3++)
22880    {
22881     if(i3==i1||i3==i2)continue;
22882     aftsTrack=anEvent->GetTrack(i3);
22883     // RP condition (!(first) particle in the correlator must be RP):
22884     if(!(aftsTrack->InRPSelection())) continue;
22885     phi3=aftsTrack->Phi();
22886     // 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))> 
22887    }//end of for(Int_t i3=0;i3<nPrim;i3++)  
22888   }//end of for(Int_t i2=0;i2<nPrim;i2++)  
22889  }//end of for(Int_t i1=0;i1<nPrim;i1++)
22890  
22891  */
22892  
22893  // 4'-particle correlations:
22894  for(Int_t i1=0;i1<nPrim;i1++)
22895  {
22896   aftsTrack=anEvent->GetTrack(i1);
22897   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22898   if(typeFlag==1) // this is diff flow of POIs 
22899   {
22900    if(ptOrEta == "Pt")
22901    { 
22902     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22903    } else if (ptOrEta == "Eta")
22904      {
22905       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22906      }
22907   } else // this is diff flow of RPs 
22908     {
22909      if(ptOrEta == "Pt")
22910      { 
22911       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22912      } else if (ptOrEta == "Eta")
22913        {
22914         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22915        }
22916     }
22917     
22918   psi1=aftsTrack->Phi();
22919   for(Int_t i2=0;i2<nPrim;i2++)
22920   {
22921    if(i2==i1) continue;
22922    aftsTrack=anEvent->GetTrack(i2);
22923    // RP condition (!(first) particle in the correlator must be RP): 
22924    if(!(aftsTrack->InRPSelection())) continue;
22925    phi2=aftsTrack->Phi();
22926    for(Int_t i3=0;i3<nPrim;i3++)
22927    { 
22928     if(i3==i1||i3==i2) continue;
22929     aftsTrack=anEvent->GetTrack(i3);
22930     // RP condition (!(first) particle in the correlator must be RP):
22931     if(!(aftsTrack->InRPSelection())) continue;
22932     phi3=aftsTrack->Phi();
22933     for(Int_t i4=0;i4<nPrim;i4++)
22934     {
22935      if(i4==i1||i4==i2||i4==i3) continue;
22936      aftsTrack=anEvent->GetTrack(i4);
22937      // RP condition (!(first) particle in the correlator must be RP):
22938      if(!(aftsTrack->InRPSelection())) continue;  
22939      phi4=aftsTrack->Phi();
22940      // 4'-particle correlations:
22941      fDiffFlowDirectCorrelations[t][pe][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2-phi3-phi4)),1.); // <cos(n(psi1+phi2-phi3-phi4))>     
22942     }//end of for(Int_t i4=0;i4<nPrim;i4++)
22943    }//end of for(Int_t i3=0;i3<nPrim;i3++)
22944   }//end of for(Int_t i2=0;i2<nPrim;i2++) 
22945  }//end of for(Int_t i1=0;i1<nPrim;i1++)
22946       
22947  // count # of RPs and POIs in selected pt and eta bins for cross-checkings:
22948  for(Int_t i=0;i<nPrim;i++)
22949  {
22950   aftsTrack=anEvent->GetTrack(i); 
22951   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22952   if(typeFlag==1) // this is diff flow of POIs 
22953   {
22954    if(ptOrEta == "Pt")
22955    { 
22956     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22957    } else if (ptOrEta == "Eta")
22958      {
22959       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22960      }
22961   } else // this is diff flow of RPs 
22962     {
22963      if(ptOrEta == "Pt")
22964      { 
22965       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22966      } else if (ptOrEta == "Eta")
22967        {
22968         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22969        }
22970     }
22971   if(t==1)t++; 
22972   fNoOfParticlesInBin->Fill(t+pe+0.5);  
22973  }
22974
22975 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrelationsWithNestedLoops(AliFlowEventSimple* anEvent, TString type, TString ptOrEta)
22976
22977 //=======================================================================================================================
22978
22979 void AliFlowAnalysisWithQCumulants::EvaluateOtherDiffCorrelatorsWithNestedLoops(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
22980 {
22981  // Evaluate other differential correlators with nested loops without using the particle weights.
22982
22983  // Remark 1: Other differential correlators are evaluated in pt bin number fCrossCheckInPtBinNo 
22984  //           and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
22985  // Remark 2: Results are stored in 1 bin profiles fOtherDirectDiffCorrelators[t][pe][sc][ci], where indices runs as follows:
22986  //           [0=RP,1=POI][0=Pt,1=Eta][0=sin terms,1=cos terms][ci = correlator index] 
22987  // Remark 3: Correlator index 'ci' runs as follows:
22988  //            0: <exp(n*(psi1-3phi2+2phi3))> (Teaney-Yan correlator)
22989   
22990  Int_t typeFlag = 0;
22991  Int_t ptEtaFlag = 0;
22992  if(type == "RP")
22993  {
22994   typeFlag = 0;
22995  } else if(type == "POI")
22996    {
22997     typeFlag = 1;
22998    }      
22999  if(ptOrEta == "Pt")
23000  {
23001   ptEtaFlag = 0;
23002  } else if(ptOrEta == "Eta")
23003    {
23004     ptEtaFlag = 1;
23005    } 
23006  // shortcuts:
23007  Int_t t = typeFlag;
23008  Int_t pe = ptEtaFlag;
23009       
23010  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
23011  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
23012  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
23013  
23014  Int_t nPrim = anEvent->NumberOfTracks(); 
23015  AliFlowTrackSimple *aftsTrack = NULL;
23016  
23017  Double_t psi1=0., phi2=0., phi3=0.;
23018  
23019  Int_t n = fHarmonic; 
23020
23021  // 3-p correlators:
23022  for(Int_t i1=0;i1<nPrim;i1++)
23023  {
23024   aftsTrack=anEvent->GetTrack(i1);
23025   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23026   if(typeFlag==1) // this is diff flow of POIs 
23027   {
23028    if(ptOrEta == "Pt")
23029    { 
23030     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23031    } else if (ptOrEta == "Eta")
23032      {
23033       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23034      }
23035   } else // this is diff flow of RPs 
23036     {
23037      if(ptOrEta == "Pt")
23038      { 
23039       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23040      } else if (ptOrEta == "Eta")
23041        {
23042         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23043        }
23044     }
23045   psi1=aftsTrack->Phi();
23046   for(Int_t i2=0;i2<nPrim;i2++)
23047   {
23048    if(i2==i1) continue;
23049    aftsTrack=anEvent->GetTrack(i2);
23050    // RP condition (!(first) particle in the correlator must be RP): 
23051    if(!(aftsTrack->InRPSelection())) continue;
23052    phi2=aftsTrack->Phi();
23053    for(Int_t i3=0;i3<nPrim;i3++)
23054    { 
23055     if(i3==i1||i3==i2) continue;
23056     aftsTrack=anEvent->GetTrack(i3);
23057     // RP condition (!(first) particle in the correlator must be RP):
23058     if(!(aftsTrack->InRPSelection())) continue;
23059     phi3=aftsTrack->Phi();
23060     // Fill 3-p correlators:
23061     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))>     
23062    }//end of for(Int_t i3=0;i3<nPrim;i3++)
23063   }//end of for(Int_t i2=0;i2<nPrim;i2++) 
23064  }//end of for(Int_t i1=0;i1<nPrim;i1++)   
23065 } // end of void AliFlowAnalysisWithQCumulants::EvaluateOtherDiffCorrelatorsWithNestedLoops(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
23066
23067 //=======================================================================================================================
23068
23069 void AliFlowAnalysisWithQCumulants::CrossCheckDiffFlowCorrelations(TString type, TString ptOrEta)
23070 {
23071  // Compare correlations needed for diff. flow calculated with nested loops and those calculated from Q-vectors
23072  
23073  Int_t typeFlag = 0;
23074  Int_t ptEtaFlag = 0;
23075  if(type == "RP")
23076  {
23077   typeFlag = 0;
23078  } else if(type == "POI")
23079    {
23080     typeFlag = 1;
23081    }      
23082  if(ptOrEta == "Pt")
23083  {
23084   ptEtaFlag = 0;
23085  } else if(ptOrEta == "Eta")
23086    {
23087     ptEtaFlag = 1;
23088    } 
23089  // shortcuts:
23090  Int_t t = typeFlag;
23091  Int_t pe = ptEtaFlag;
23092       
23093  TString rpORpoiString[2] = {"RP ","POI"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
23094  TString ptORetaString[2] = {"pt","eta"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
23095  TString reducedCorrelations[4] = {"<<cos(n(psi1-phi2))>>","<<cos(n(psi1+phi2-phi3-phi4))>>","",""}; // to be improved (access this from pro or hist)
23096  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
23097  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
23098  
23099  Int_t crossCheckInPtEtaBinNo[2] = {fCrossCheckInPtBinNo,fCrossCheckInEtaBinNo};
23100  
23101
23102  cout<<endl;
23103  cout<<"   *****************************************"<<endl;
23104  cout<<"   **** cross-checking the correlations ****"<<endl;
23105  cout<<"   ****   for differential flow ("<<rpORpoiString[t]<<")   ****"<<endl;
23106  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
23107  {
23108   cout<<"   ****   (particle weights not used)   ****"<<endl;
23109  } else
23110    {
23111     cout<<"   ****    (particle weights used)      ****"<<endl;
23112    } 
23113  cout<<"   *****************************************"<<endl; 
23114  cout<<endl;
23115  cout<<"           "<<ptORetaString[pe]<<" bin: "<<lowerPtEtaEdge[pe]<<" <= "<<ptORetaString[pe]<<" < "<<upperPtEtaEdge[pe]<<endl;
23116  cout<<endl;
23117  
23118  for(Int_t rci=0;rci<2;rci++) // to be improved (calculate 6th and 8th order)
23119  {
23120   cout<<"      "<<reducedCorrelations[rci].Data()<<":"<<endl;
23121   cout<<"      from Q-vectors    = "<<fDiffFlowCorrelationsPro[t][pe][rci]->GetBinContent(crossCheckInPtEtaBinNo[pe])<<endl;
23122   cout<<"      from nested loops = "<<fDiffFlowDirectCorrelations[t][pe][rci]->GetBinContent(1)<<endl;
23123   cout<<endl;  
23124  } // end of for(Int_t rci=0;rci<4;rci++)
23125         
23126 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckDiffFlowCorrelations(TString type, TString ptOrEta)
23127
23128 //=======================================================================================================================
23129
23130 void AliFlowAnalysisWithQCumulants::CrossCheckOtherDiffCorrelators(TString type, TString ptOrEta)
23131 {
23132  // Compare correlations needed for diff. flow calculated with nested loops and those calculated from Q-vectors
23133  
23134  Int_t typeFlag = 0;
23135  Int_t ptEtaFlag = 0;
23136  if(type == "RP")
23137  {
23138   typeFlag = 0;
23139  } else if(type == "POI")
23140    {
23141     typeFlag = 1;
23142    }      
23143  if(ptOrEta == "Pt")
23144  {
23145   ptEtaFlag = 0;
23146  } else if(ptOrEta == "Eta")
23147    {
23148     ptEtaFlag = 1;
23149    } 
23150  // shortcuts:
23151  Int_t t = typeFlag;
23152  Int_t pe = ptEtaFlag;
23153       
23154  TString rpORpoiString[2] = {"RP ","POI"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
23155  TString ptORetaString[2] = {"pt","eta"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
23156  TString otherCorrelators[1] = {"<<cos(n(psi1-3phi2+2phi3))>>"}; // to be improved (access this from pro or hist)
23157  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
23158  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
23159  
23160  Int_t crossCheckInPtEtaBinNo[2] = {fCrossCheckInPtBinNo,fCrossCheckInEtaBinNo};
23161
23162  cout<<endl;
23163  cout<<"   *****************************************"<<endl;
23164  cout<<"   ****   cross-checking the other      ****"<<endl;
23165  cout<<"   ****   diff. correlators ("<<rpORpoiString[t]<<")       ****"<<endl;
23166  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
23167  {
23168   cout<<"   ****   (particle weights not used)   ****"<<endl;
23169  } else
23170    {
23171     cout<<"   ****    (particle weights used)      ****"<<endl;
23172    } 
23173  cout<<"   *****************************************"<<endl; 
23174  cout<<endl;
23175  cout<<"           "<<ptORetaString[pe]<<" bin: "<<lowerPtEtaEdge[pe]<<" <= "<<ptORetaString[pe]<<" < "<<upperPtEtaEdge[pe]<<endl;
23176  cout<<endl;
23177  
23178  for(Int_t ci=0;ci<1;ci++) 
23179  {
23180   cout<<"      "<<otherCorrelators[ci].Data()<<":"<<endl;
23181   cout<<"      from Q-vectors    = "<<fOtherDiffCorrelators[t][pe][1][ci]->GetBinContent(crossCheckInPtEtaBinNo[pe])<<endl;
23182   cout<<"      from nested loops = "<<fOtherDirectDiffCorrelators[t][pe][1][ci]->GetBinContent(1)<<endl;
23183   cout<<endl;  
23184  } // end of for(Int_t ci=0;ci<1;ci++)
23185         
23186 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckOtherDiffCorrelators(TString type, TString ptOrEta)
23187
23188 //=======================================================================================================================
23189
23190 void AliFlowAnalysisWithQCumulants::PrintNumberOfParticlesInSelectedBin()
23191 {
23192  // Print on the screen number of RPs and POIs in selected pt and eta bin for cross checkings.
23193  
23194  cout<<endl;
23195  cout<<"Number of RPs in selected pt bin   = "<<fNoOfParticlesInBin->GetBinContent(1)<<endl;
23196  cout<<"Number of RPs in selected eta bin  = "<<fNoOfParticlesInBin->GetBinContent(2)<<endl;
23197  cout<<"Number of POIs in selected pt bin  = "<<fNoOfParticlesInBin->GetBinContent(3)<<endl;
23198  cout<<"Number of POIs in selected eta bin = "<<fNoOfParticlesInBin->GetBinContent(4)<<endl;
23199  
23200 } // end of void AliFlowAnalysisWithQCumulants::PrintNumberOfParticlesInSelectedBin()
23201
23202 //=======================================================================================================================
23203
23204 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
23205 {
23206  // Evaluate reduced correlations with nested loops without using the particle weights.
23207  
23208  // Remark 1: Reduced correlations are evaluated in pt bin number fCrossCheckInPtBinNo and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
23209  // Remark 2: Results are stored in 1 bin profiles fDiffFlowDirectCorrelations[t][pe][ci], where indices runs as follows:
23210  //           [0=RP,1=POI][0=Pt,1=Eta][0=<2'>,1=<4'>,2=<6'>,3=<8'>] 
23211  // Remark 3: <2'> = <w2 cos(n*(psi1-phi2))>
23212  //           <4'> = <w2 w3 w4 cos(n*(psi1+phi2-phi3-phi4))>
23213  // ...
23214   
23215  Int_t typeFlag = 0;
23216  Int_t ptEtaFlag = 0;
23217  if(type == "RP")
23218  {
23219   typeFlag = 0;
23220  } else if(type == "POI")
23221    {
23222     typeFlag = 1;
23223    }      
23224  if(ptOrEta == "Pt")
23225  {
23226   ptEtaFlag = 0;
23227  } else if(ptOrEta == "Eta")
23228    {
23229     ptEtaFlag = 1;
23230    } 
23231  // shortcuts:
23232  Int_t t = typeFlag;
23233  Int_t pe = ptEtaFlag;
23234       
23235  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
23236  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
23237  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
23238  
23239  Int_t nPrim = anEvent->NumberOfTracks(); 
23240  AliFlowTrackSimple *aftsTrack = NULL;
23241  
23242  Double_t psi1=0., phi2=0., phi3=0., phi4=0.;// phi5=0., phi6=0., phi7=0., phi8=0.;
23243  Double_t wPhi2=1., wPhi3=1., wPhi4=1.;// wPhi5=1., wPhi6=1., wPhi7=1., wPhi8=1.;
23244  
23245  Int_t n = fHarmonic; 
23246  
23247  // 2'-particle correlations:
23248  for(Int_t i1=0;i1<nPrim;i1++)
23249  {
23250   aftsTrack=anEvent->GetTrack(i1);
23251   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23252   if(typeFlag==1) // this is diff flow of POIs 
23253   {
23254    if(ptOrEta == "Pt")
23255    { 
23256     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23257    } else if (ptOrEta == "Eta")
23258      {
23259       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23260      }
23261   } else // this is diff flow of RPs 
23262     {
23263      if(ptOrEta == "Pt")
23264      { 
23265       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23266      } else if (ptOrEta == "Eta")
23267        {
23268         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23269        }
23270     }
23271   psi1=aftsTrack->Phi(); 
23272   for(Int_t i2=0;i2<nPrim;i2++)
23273   {
23274    if(i2==i1) continue;
23275    aftsTrack=anEvent->GetTrack(i2);
23276    // RP condition (!(first) particle in the correlator must be RP):
23277    if(!(aftsTrack->InRPSelection())) continue;
23278    phi2=aftsTrack->Phi();   
23279    if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
23280    // 2'-particle correlations: 
23281    fDiffFlowDirectCorrelations[t][pe][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(1.*n*(psi1-phi2)),wPhi2); // <w2 cos(n*(psi1-phi2))  
23282   }//end of for(Int_t i2=0;i2<nPrim;i2++)
23283  }//end of for(Int_t i1=0;i1<nPrim;i1++)
23284  
23285  // 4'-particle correlations:
23286  for(Int_t i1=0;i1<nPrim;i1++)
23287  {
23288   aftsTrack=anEvent->GetTrack(i1);
23289   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23290   if(typeFlag==1) // this is diff flow of POIs 
23291   {
23292    if(ptOrEta == "Pt")
23293    { 
23294     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23295    } else if (ptOrEta == "Eta")
23296      {
23297       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23298      }
23299   } else // this is diff flow of RPs 
23300     {
23301      if(ptOrEta == "Pt")
23302      { 
23303       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23304      } else if (ptOrEta == "Eta")
23305        {
23306         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23307        }
23308     }
23309   psi1=aftsTrack->Phi();
23310   for(Int_t i2=0;i2<nPrim;i2++)
23311   {
23312    if(i2==i1) continue;
23313    aftsTrack=anEvent->GetTrack(i2);
23314    // RP condition (!(first) particle in the correlator must be RP): 
23315    if(!(aftsTrack->InRPSelection())) continue;
23316    phi2=aftsTrack->Phi();
23317    if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
23318    for(Int_t i3=0;i3<nPrim;i3++)
23319    { 
23320     if(i3==i1||i3==i2) continue;
23321     aftsTrack=anEvent->GetTrack(i3);
23322     // RP condition (!(first) particle in the correlator must be RP):
23323     if(!(aftsTrack->InRPSelection())) continue;
23324     phi3=aftsTrack->Phi();
23325     if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
23326     for(Int_t i4=0;i4<nPrim;i4++)
23327     {
23328      if(i4==i1||i4==i2||i4==i3) continue;
23329      aftsTrack=anEvent->GetTrack(i4);
23330      // RP condition (!(first) particle in the correlator must be RP):
23331      if(!(aftsTrack->InRPSelection())) continue;  
23332      phi4=aftsTrack->Phi();
23333      if(fUsePhiWeights && fPhiWeights) wPhi4 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi4*fnBinsPhi/TMath::TwoPi())));
23334      // 4'-particle correlations <w2 w3 w4 cos(n(psi1+phi2-phi3-phi4))>:
23335      fDiffFlowDirectCorrelations[t][pe][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2-phi3-phi4)),wPhi2*wPhi3*wPhi4); 
23336     }//end of for(Int_t i4=0;i4<nPrim;i4++)
23337    }//end of for(Int_t i3=0;i3<nPrim;i3++)
23338   }//end of for(Int_t i2=0;i2<nPrim;i2++) 
23339  }//end of for(Int_t i1=0;i1<nPrim;i1++)      
23340  
23341  // count # of RPs and POIs in selected pt and eta bins for cross-checkings: (to be improved - moved to dedicated method)
23342  for(Int_t i=0;i<nPrim;i++)
23343  {
23344   aftsTrack=anEvent->GetTrack(i); 
23345   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23346   if(typeFlag==1) // this is diff flow of POIs 
23347   {
23348    if(ptOrEta == "Pt")
23349    { 
23350     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23351    } else if (ptOrEta == "Eta")
23352      {
23353       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23354      }
23355   } else // this is diff flow of RPs 
23356     {
23357      if(ptOrEta == "Pt")
23358      { 
23359       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23360      } else if (ptOrEta == "Eta")
23361        {
23362         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23363        }
23364     }
23365   if(t==1)t++; 
23366   fNoOfParticlesInBin->Fill(t+pe+0.5);  
23367  }
23368  
23369 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(AliFlowEventSimple* anEvent, TString type, TString ptOrEta)
23370
23371 //=======================================================================================================================
23372
23373 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
23374 {
23375  // Evaluate with nested loops correction terms for non-uniform acceptance (both sin and cos terms) relevant for differential flow.
23376  
23377  // Remark 1: Reduced correction terms for non-uniform acceptance are evaluated in pt bin number fCrossCheckInPtBinNo 
23378  //           and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
23379  // Remark 2: Results are stored in 1 bin profiles fDiffFlowDirectCorrections[t][pe][sc][cti], where first three indices runs as: 
23380  //           [0=RP,1=POI][0=Pt,1=Eta][0=sin terms,1=cos terms], whilst the cti (correction term index) runs as follows: 
23381  //  cti: 
23382  //    0: <<sc n(psi1)>>
23383  //    1: <<sc n(psi1+phi2)>> 
23384  //    2: <<sc n(psi1+phi2-phi3)>>
23385  //    3: <<sc n(psi1-phi2-phi3)>>
23386  //    4:
23387  //    5:
23388  //    6:
23389   
23390  Int_t typeFlag = 0;
23391  Int_t ptEtaFlag = 0;
23392  if(type == "RP")
23393  {
23394   typeFlag = 0;
23395  } else if(type == "POI")
23396    {
23397     typeFlag = 1;
23398    }      
23399  if(ptOrEta == "Pt")
23400  {
23401   ptEtaFlag = 0;
23402  } else if(ptOrEta == "Eta")
23403    {
23404     ptEtaFlag = 1;
23405    } 
23406  // shortcuts:
23407  Int_t t = typeFlag;
23408  Int_t pe = ptEtaFlag;
23409       
23410  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
23411  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
23412  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
23413  
23414  Int_t nPrim = anEvent->NumberOfTracks(); 
23415  AliFlowTrackSimple *aftsTrack = NULL;
23416  
23417  Double_t psi1=0., phi2=0., phi3=0.;// phi4=0.;// phi5=0., phi6=0., phi7=0., phi8=0.;
23418  
23419  Int_t n = fHarmonic; 
23420  
23421  // 1-particle correction terms:
23422  for(Int_t i1=0;i1<nPrim;i1++)
23423  {
23424   aftsTrack=anEvent->GetTrack(i1);
23425   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23426   if(typeFlag==1) // this is diff flow of POIs 
23427   {
23428    if(ptOrEta == "Pt")
23429    { 
23430     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23431    } else if (ptOrEta == "Eta")
23432      {
23433       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23434      }
23435   } else // this is diff flow of RPs 
23436     {
23437      if(ptOrEta == "Pt")
23438      { 
23439       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23440      } else if (ptOrEta == "Eta")
23441        {
23442         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23443        }
23444     }
23445   psi1=aftsTrack->Phi(); 
23446   // sin terms: 
23447   fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*psi1),1.); // <<sin(n*(psi1))>>  
23448   // cos terms: 
23449   fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*psi1),1.); // <<cos(n*(psi1))>>  
23450  }//end of for(Int_t i1=0;i1<nPrim;i1++)
23451    
23452  // 2-particle correction terms:
23453  for(Int_t i1=0;i1<nPrim;i1++)
23454  {
23455   aftsTrack=anEvent->GetTrack(i1);
23456    // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23457   if(typeFlag==1) // this is diff flow of POIs 
23458   {
23459    if(ptOrEta == "Pt")
23460    { 
23461     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23462    } else if (ptOrEta == "Eta")
23463      {
23464       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23465      }
23466   } else // this is diff flow of RPs 
23467     {
23468      if(ptOrEta == "Pt")
23469      { 
23470       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23471      } else if (ptOrEta == "Eta")
23472        {
23473         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23474        }
23475     }
23476   psi1=aftsTrack->Phi(); 
23477   for(Int_t i2=0;i2<nPrim;i2++)
23478   {
23479    if(i2==i1) continue;
23480    aftsTrack=anEvent->GetTrack(i2);
23481    // RP condition (!(first) particle in the correlator must be RP):
23482    if(!(aftsTrack->InRPSelection())) continue;
23483    phi2=aftsTrack->Phi();   
23484    // sin terms: 
23485    fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1+phi2)),1.); // <<sin(n*(psi1+phi2))>>  
23486    // cos terms: 
23487    fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2)),1.); // <<cos(n*(psi1+phi2))>>  
23488   }//end of for(Int_t i2=0;i2<nPrim;i2++)
23489  }//end of for(Int_t i1=0;i1<nPrim;i1++)   
23490  
23491  // 3-particle correction terms:
23492  for(Int_t i1=0;i1<nPrim;i1++)
23493  {
23494   aftsTrack=anEvent->GetTrack(i1);
23495    // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23496   if(typeFlag==1) // this is diff flow of POIs 
23497   {
23498    if(ptOrEta == "Pt")
23499    { 
23500     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23501    } else if (ptOrEta == "Eta")
23502      {
23503       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23504      }
23505   } else // this is diff flow of RPs 
23506     {
23507      if(ptOrEta == "Pt")
23508      { 
23509       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23510      } else if (ptOrEta == "Eta")
23511        {
23512         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23513        }
23514     }
23515   psi1=aftsTrack->Phi();
23516   for(Int_t i2=0;i2<nPrim;i2++)
23517   {
23518    if(i2==i1) continue;
23519    aftsTrack=anEvent->GetTrack(i2);
23520    // RP condition (!(first) particle in the correlator must be RP):
23521    if(!(aftsTrack->InRPSelection())) continue;
23522    phi2=aftsTrack->Phi();
23523    for(Int_t i3=0;i3<nPrim;i3++)
23524    {
23525     if(i3==i1||i3==i2) continue;
23526     aftsTrack=anEvent->GetTrack(i3);
23527     // RP condition (!(first) particle in the correlator must be RP):
23528     if(!(aftsTrack->InRPSelection())) continue;
23529     phi3=aftsTrack->Phi();
23530     // sin terms: 
23531     fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][2]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1+phi2-phi3)),1.); // <<sin(n*(psi1+phi2-phi3))>>  
23532     fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][3]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1-phi2-phi3)),1.); // <<sin(n*(psi1-phi2-phi3))>>  
23533     // cos terms: 
23534     fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][2]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2-phi3)),1.); // <<cos(n*(psi1+phi2-phi3))>>  
23535     fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][3]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1-phi2-phi3)),1.); // <<cos(n*(psi1-phi2-phi3))>>  
23536    }//end of for(Int_t i3=0;i3<nPrim;i3++)  
23537   }//end of for(Int_t i2=0;i2<nPrim;i2++)  
23538  }//end of for(Int_t i1=0;i1<nPrim;i1++)
23539    
23540 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(AliFlowEventSimple* anEvent, TString type, TString ptOrEta)
23541
23542
23543 //=======================================================================================================================
23544
23545
23546 void AliFlowAnalysisWithQCumulants::CrossCheckDiffFlowCorrectionTermsForNUA(TString type, TString ptOrEta)
23547 {
23548  // Compare corrections temrs for non-uniform acceptance needed for diff. flow calculated with nested loops and those calculated from Q-vectors
23549  
23550  Int_t typeFlag = 0;
23551  Int_t ptEtaFlag = 0;
23552  if(type == "RP")
23553  {
23554   typeFlag = 0;
23555  } else if(type == "POI")
23556    {
23557     typeFlag = 1;
23558    }      
23559  if(ptOrEta == "Pt")
23560  {
23561   ptEtaFlag = 0;
23562  } else if(ptOrEta == "Eta")
23563    {
23564     ptEtaFlag = 1;
23565    } 
23566  // shortcuts:
23567  Int_t t = typeFlag;
23568  Int_t pe = ptEtaFlag;
23569       
23570  TString rpORpoiString[2] = {"RP ","POI"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
23571  TString ptORetaString[2] = {"pt","eta"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
23572  //TString sinCosFlag[2] = {"sin","cos"}; // to be improved (eventually promote to data member)
23573  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)
23574  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)
23575  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
23576  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
23577  
23578  Int_t crossCheckInPtEtaBinNo[2] = {fCrossCheckInPtBinNo,fCrossCheckInEtaBinNo};
23579  
23580  cout<<endl;
23581  cout<<"   ******************************************"<<endl;
23582  cout<<"   ****  cross-checking the correction   ****"<<endl;
23583  cout<<"   **** terms for non-uniform acceptance ****"<<endl; 
23584  cout<<"   ****    for differential flow ("<<rpORpoiString[t]<<")   ****"<<endl;
23585  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
23586  {
23587   cout<<"   ****    (particle weights not used)   ****"<<endl;
23588  } else
23589    {
23590     cout<<"   ****     (particle weights used)      ****"<<endl;
23591    } 
23592  cout<<"   ******************************************"<<endl; 
23593  cout<<endl;
23594  cout<<"           "<<ptORetaString[pe]<<" bin: "<<lowerPtEtaEdge[pe]<<" <= "<<ptORetaString[pe]<<" < "<<upperPtEtaEdge[pe]<<endl;
23595  cout<<endl;
23596  
23597  for(Int_t cti=0;cti<4;cti++) // correction term index
23598  {
23599   for(Int_t sc=0;sc<2;sc++) // sin or cos terms
23600   {
23601    if(sc==0) // to be improved (this can be implemented better)
23602    { 
23603     cout<<"      "<<reducedCorrectionSinTerms[cti].Data()<<":"<<endl;
23604    } else
23605      {
23606       cout<<"      "<<reducedCorrectionCosTerms[cti].Data()<<":"<<endl;     
23607      }
23608    cout<<"      from Q-vectors    = "<<fDiffFlowCorrectionTermsForNUAPro[t][pe][sc][cti]->GetBinContent(crossCheckInPtEtaBinNo[pe])<<endl;
23609    cout<<"      from nested loops = "<<fDiffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti]->GetBinContent(1)<<endl;
23610    cout<<endl;  
23611   } 
23612  } // end of for(Int_t rci=0;rci<4;rci++)
23613
23614 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckDiffFlowCorrectionTermsForNUA(TString type, TString ptOrEta)
23615
23616 //=======================================================================================================================
23617
23618 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTermsUsingParticleWeights()
23619 {
23620  // Calculate corrections using particle weights for non-uniform acceptance of the detector for no-name integrated flow (cos terms).
23621  
23622  //                                  **********************************************************************
23623  //                                  **** weighted corrections for non-uniform acceptance (cos terms): ****
23624  //                                  **********************************************************************
23625  
23626  // Remark 1: When particle weights are used the binning of fIntFlowCorrectionTermsForNUAPro[1] is organized as follows:
23627  //
23628  // 1st bin: <<w1 cos(n*(phi1))>> = cosP1nW1
23629  // 2nd bin: <<w1 w2 cos(n*(phi1+phi2))>> = cosP1nP1nW1W1
23630  // 3rd bin: <<w1 w2 w3 cos(n*(phi1-phi2-phi3))>> = cosP1nM1nM1nW1W1W1 
23631  // ...
23632
23633  // multiplicity (number of particles used to determine the reaction plane)
23634  Double_t dMult = (*fSpk)(0,0);
23635  
23636  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
23637  Double_t dReQ1n1k = (*fReQ)(0,1);
23638  Double_t dReQ2n2k = (*fReQ)(1,2);
23639  //Double_t dReQ3n3k = (*fReQ)(2,3);
23640  //Double_t dReQ4n4k = (*fReQ)(3,4);
23641  Double_t dReQ1n3k = (*fReQ)(0,3);
23642  Double_t dImQ1n1k = (*fImQ)(0,1);
23643  Double_t dImQ2n2k = (*fImQ)(1,2);
23644  //Double_t dImQ3n3k = (*fImQ)(2,3);
23645  //Double_t dImQ4n4k = (*fImQ)(3,4);
23646  //Double_t dImQ1n3k = (*fImQ)(0,3);
23647
23648  // dMs are variables introduced in order to simplify some Eqs. bellow:
23649  //..............................................................................................
23650  Double_t dM11 = (*fSpk)(1,1)-(*fSpk)(0,2); // dM11 = sum_{i,j=1,i!=j}^M w_i w_j
23651  Double_t dM111 = (*fSpk)(2,1)-3.*(*fSpk)(0,2)*(*fSpk)(0,1)
23652                 + 2.*(*fSpk)(0,3); // dM111 = sum_{i,j,k=1,i!=j!=k}^M w_i w_j w_k
23653  //..............................................................................................
23654          // 1-particle:
23655  Double_t cosP1nW1 = 0.; // <<w1 cos(n*(phi1))>>
23656    
23657  if(dMult>0 && TMath::Abs((*fSpk)(0,1))>1.e-6)
23658  {
23659   cosP1nW1 = dReQ1n1k/(*fSpk)(0,1); 
23660   
23661   // average weighted 1-particle correction (cos terms) for non-uniform acceptance for single event:
23662   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(1,cosP1nW1);
23663   
23664   // final average weighted 1-particle correction (cos terms) for non-uniform acceptance for all events:
23665   fIntFlowCorrectionTermsForNUAPro[1]->Fill(0.5,cosP1nW1,(*fSpk)(0,1));  
23666  } 
23667  
23668  // 2-particle:
23669  Double_t cosP1nP1nW1W1 = 0.; // <<w1 w2 cos(n*(phi1+phi2))>>
23670  
23671  if(dMult>1 && TMath::Abs(dM11)>1.e-6)
23672  {
23673   cosP1nP1nW1W1 = (pow(dReQ1n1k,2)-pow(dImQ1n1k,2)-dReQ2n2k)/dM11; 
23674   
23675   // average weighted 2-particle correction (cos terms) for non-uniform acceptance for single event:
23676   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(2,cosP1nP1nW1W1);
23677   
23678   // final average weighted 2-particle correction (cos terms) for non-uniform acceptance for all events:
23679   fIntFlowCorrectionTermsForNUAPro[1]->Fill(1.5,cosP1nP1nW1W1,dM11);  
23680  } 
23681  
23682  // 3-particle:
23683  Double_t cosP1nM1nM1nW1W1W1 = 0.; // <<w1 w2 w3 cos(n*(phi1-phi2-phi3))>>
23684  
23685  if(dMult>2 && TMath::Abs(dM111)>1.e-6)
23686  {
23687   cosP1nM1nM1nW1W1W1 = (dReQ1n1k*(pow(dReQ1n1k,2)+pow(dImQ1n1k,2))
23688                      - dReQ1n1k*dReQ2n2k-dImQ1n1k*dImQ2n2k
23689                      - 2.*((*fSpk)(0,2))*dReQ1n1k
23690                      + 2.*dReQ1n3k) 
23691                      / dM111; 
23692   
23693   // average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for single event:
23694   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(3,cosP1nM1nM1nW1W1W1);
23695   
23696   // final average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for all events:
23697   fIntFlowCorrectionTermsForNUAPro[1]->Fill(2.5,cosP1nM1nM1nW1W1W1,dM111);  
23698  } 
23699  
23700 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTermsUsingParticleWeights()
23701
23702
23703 //=======================================================================================================================
23704
23705
23706 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTermsUsingParticleWeights()
23707 {
23708  // calculate corrections using particle weights for non-uniform acceptance of the detector for no-name integrated flow (sin terms)
23709  
23710  //                                  **********************************************************************
23711  //                                  **** weighted corrections for non-uniform acceptance (sin terms): ****
23712  //                                  **********************************************************************
23713  
23714  // Remark 1: When particle weights are used the binning of fIntFlowCorrectionTermsForNUAPro[0] is organized as follows:
23715  //
23716  // 1st bin: <<w1 sin(n*(phi1))>> = sinP1nW1
23717  // 2nd bin: <<w1 w2 sin(n*(phi1+phi2))>> = sinP1nP1nW1W1
23718  // 3rd bin: <<w1 w2 w3 sin(n*(phi1-phi2-phi3))>> = sinP1nM1nM1nW1W1W1 
23719  // ...
23720
23721  // multiplicity (number of particles used to determine the reaction plane)
23722  Double_t dMult = (*fSpk)(0,0);
23723  
23724  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
23725  Double_t dReQ1n1k = (*fReQ)(0,1);
23726  Double_t dReQ2n2k = (*fReQ)(1,2);
23727  //Double_t dReQ3n3k = (*fReQ)(2,3);
23728  //Double_t dReQ4n4k = (*fReQ)(3,4);
23729  //Double_t dReQ1n3k = (*fReQ)(0,3);
23730  Double_t dImQ1n1k = (*fImQ)(0,1);
23731  Double_t dImQ2n2k = (*fImQ)(1,2);
23732  //Double_t dImQ3n3k = (*fImQ)(2,3);
23733  //Double_t dImQ4n4k = (*fImQ)(3,4);
23734  Double_t dImQ1n3k = (*fImQ)(0,3);
23735
23736  // dMs are variables introduced in order to simplify some Eqs. bellow:
23737  //..............................................................................................
23738  Double_t dM11 = (*fSpk)(1,1)-(*fSpk)(0,2); // dM11 = sum_{i,j=1,i!=j}^M w_i w_j
23739  Double_t dM111 = (*fSpk)(2,1)-3.*(*fSpk)(0,2)*(*fSpk)(0,1)
23740                 + 2.*(*fSpk)(0,3); // dM111 = sum_{i,j,k=1,i!=j!=k}^M w_i w_j w_k
23741  //..............................................................................................
23742  
23743  // 1-particle:
23744  Double_t sinP1nW1 = 0.; // <<w1 sin(n*(phi1))>>
23745  
23746  if(dMult>0 && TMath::Abs((*fSpk)(0,1))>1.e-6)
23747  {
23748   sinP1nW1 = dImQ1n1k/((*fSpk)(0,1)); 
23749      
23750   // average weighted 1-particle correction (sin terms) for non-uniform acceptance for single event:
23751   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(1,sinP1nW1);
23752   
23753   // final average weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:   
23754   fIntFlowCorrectionTermsForNUAPro[0]->Fill(0.5,sinP1nW1,(*fSpk)(0,1));  
23755  } 
23756  
23757  // 2-particle:
23758  Double_t sinP1nP1nW1W1 = 0.; // <<w1 w2 sin(n*(phi1+phi2))>>
23759  
23760  if(dMult>1 && TMath::Abs(dM11)>1.e-6)
23761  {
23762   sinP1nP1nW1W1 = (2.*dReQ1n1k*dImQ1n1k-dImQ2n2k)/dM11; 
23763      
23764   // average weighted 2-particle correction (sin terms) for non-uniform acceptance for single event:
23765   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(2,sinP1nP1nW1W1);
23766   
23767   // final average weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:      
23768   fIntFlowCorrectionTermsForNUAPro[0]->Fill(1.5,sinP1nP1nW1W1,dM11);  
23769  } 
23770  
23771  // 3-particle:
23772  Double_t sinP1nM1nM1nW1W1W1 = 0.; // <<w1 w2 w3 sin(n*(phi1-phi2-phi3))>>
23773  
23774  if(dMult>2 && TMath::Abs(dM111)>1.e-6)
23775  {
23776   sinP1nM1nM1nW1W1W1 = (-dImQ1n1k*(pow(dReQ1n1k,2)+pow(dImQ1n1k,2))
23777                      + dReQ1n1k*dImQ2n2k-dImQ1n1k*dReQ2n2k
23778                      + 2.*((*fSpk)(0,2))*dImQ1n1k
23779                      - 2.*dImQ1n3k)
23780                      / dM111; 
23781   
23782   // average weighted 3-particle correction (sin terms) for non-uniform acceptance for single event:
23783   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(3,sinP1nM1nM1nW1W1W1);
23784   
23785   // final average weighted 3-particle correction (sin terms) for non-uniform acceptance for all events:  
23786   fIntFlowCorrectionTermsForNUAPro[0]->Fill(2.5,sinP1nM1nM1nW1W1W1,dM111);  
23787  } 
23788  
23789 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTermsUsingParticleWeights()
23790
23791 //=======================================================================================================================
23792
23793 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrectionsForNUAWithNestedLoopsUsingParticleWeights(AliFlowEventSimple * const anEvent)
23794 {
23795  // Evaluate with nested loops correction terms for non-uniform acceptance for integrated flow (using the particle weights). 
23796
23797  // Results are stored in profiles fIntFlowDirectCorrectionTermsForNUA[0] (sin terms) and
23798  // fIntFlowDirectCorrectionTermsForNUA[1] (cos terms). 
23799  
23800  // Remark 1: When particle weights are used the binning of fIntFlowDirectCorrectionTermsForNUA[sc] is 
23801  // organized as follows (sc stands for either sin or cos):
23802  //
23803  // 1st bin: <<w1 sc(n*(phi1))>> = scP1nW1
23804  // 2nd bin: <<w1 w2 sc(n*(phi1+phi2))>> = scP1nP1nW1W1
23805  // 3rd bin: <<w1 w2 w3 sc(n*(phi1-phi2-phi3))>> = scP1nM1nM1nW1W1W1 
23806  // ...
23807   
23808  Int_t nPrim = anEvent->NumberOfTracks(); 
23809  AliFlowTrackSimple *aftsTrack = NULL;
23810  //Double_t phi1=0., phi2=0., phi3=0., phi4=0., phi5=0., phi6=0., phi7=0., phi8=0.;
23811  //Double_t wPhi1=1., wPhi2=1., wPhi3=1., wPhi4=1., wPhi5=1., wPhi6=1., wPhi7=1., wPhi8=1.;
23812  Double_t phi1=0., phi2=0., phi3=0.;
23813  Double_t wPhi1=1., wPhi2=1., wPhi3=1.;
23814  Int_t n = fHarmonic; 
23815  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // to be improved (is this casting safe in general?)
23816  Double_t dMult = (*fSpk)(0,0);
23817  cout<<endl;
23818  cout<<"Correction terms for non-uniform acceptance: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
23819  if(dMult<1)
23820  {
23821   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
23822  } else if (dMult>fMaxAllowedMultiplicity)
23823    {
23824     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
23825    } else 
23826      { 
23827       cout<<"... evaluating nested loops (using particle weights) ..."<<endl;
23828      } 
23829       
23830  // 1-particle correction terms using particle weights:       
23831  if(nPrim>=1 && nPrim<=fMaxAllowedMultiplicity)
23832  {
23833   for(Int_t i1=0;i1<nPrim;i1++)
23834   {
23835    aftsTrack=anEvent->GetTrack(i1);
23836    if(!(aftsTrack->InRPSelection())) continue;
23837    phi1=aftsTrack->Phi();
23838    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
23839    // 1-particle correction terms using particle weights:
23840    if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[0]->Fill(0.5,sin(n*phi1),wPhi1); // <w1 sin(n*phi1)>
23841    if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[1]->Fill(0.5,cos(n*phi1),wPhi1); // <w1 cos(n*phi1)>
23842   } // end of for(Int_t i1=0;i1<nPrim;i1++)
23843  } // end of if(nPrim>=1 && nPrim<=fMaxAllowedMultiplicity) 
23844  
23845  // 2-particle correction terms using particle weights:       
23846  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
23847  {
23848   for(Int_t i1=0;i1<nPrim;i1++)
23849   {
23850    aftsTrack=anEvent->GetTrack(i1);
23851    if(!(aftsTrack->InRPSelection())) continue;
23852    phi1=aftsTrack->Phi();
23853    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
23854    for(Int_t i2=0;i2<nPrim;i2++)
23855    {
23856     if(i2==i1)continue;
23857     aftsTrack=anEvent->GetTrack(i2);
23858     if(!(aftsTrack->InRPSelection())) continue;
23859     phi2=aftsTrack->Phi();
23860     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));   
23861     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
23862     // 2-p correction terms using particle weights:    
23863     if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[0]->Fill(1.5,sin(n*(phi1+phi2)),wPhi1*wPhi2); // <w1 w2 sin(n*(phi1+phi2))>
23864     if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[1]->Fill(1.5,cos(n*(phi1+phi2)),wPhi1*wPhi2); // <w1 w2 cos(n*(phi1+phi2))>
23865    } // end of for(Int_t i2=0;i2<nPrim;i2++)
23866   } // end of for(Int_t i1=0;i1<nPrim;i1++)
23867  } // end of if(nPrim>=2)
23868
23869  // 3-particle correction terms using particle weights:       
23870  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
23871  { 
23872   for(Int_t i1=0;i1<nPrim;i1++)
23873   {
23874    aftsTrack=anEvent->GetTrack(i1);
23875    if(!(aftsTrack->InRPSelection())) continue;
23876    phi1=aftsTrack->Phi();
23877    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
23878    for(Int_t i2=0;i2<nPrim;i2++)
23879    {
23880     if(i2==i1)continue;
23881     aftsTrack=anEvent->GetTrack(i2);
23882     if(!(aftsTrack->InRPSelection())) continue;
23883     phi2=aftsTrack->Phi();
23884     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
23885     for(Int_t i3=0;i3<nPrim;i3++)
23886     {
23887      if(i3==i1||i3==i2)continue;
23888      aftsTrack=anEvent->GetTrack(i3);
23889      if(!(aftsTrack->InRPSelection())) continue;
23890      phi3=aftsTrack->Phi();
23891      if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
23892      if(nPrim==3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush;
23893      // 3-p correction terms using particle weights:    
23894      if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[0]->Fill(2.5,sin(n*(phi1-phi2-phi3)),wPhi1*wPhi2*wPhi3); // <w1 w2 w3 sin(n*(phi1-phi2-phi3))>
23895      if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[1]->Fill(2.5,cos(n*(phi1-phi2-phi3)),wPhi1*wPhi2*wPhi3); // <w1 w2 w3 cos(n*(phi1-phi2-phi3))>
23896     } // end of for(Int_t i3=0;i3<nPrim;i3++)
23897    } // end of for(Int_t i2=0;i2<nPrim;i2++)
23898   } // end of for(Int_t i1=0;i1<nPrim;i1++)
23899  } // end of if(nPrim>=3)
23900  
23901  /*
23902  
23903  if(nPrim>=4 && nPrim<=fMaxAllowedMultiplicity)
23904  {
23905   // 4 nested loops multiparticle correlations using particle weights:       
23906   for(Int_t i1=0;i1<nPrim;i1++)
23907   {
23908    aftsTrack=anEvent->GetTrack(i1);
23909    if(!(aftsTrack->InRPSelection())) continue;
23910    phi1=aftsTrack->Phi();
23911    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
23912    for(Int_t i2=0;i2<nPrim;i2++)
23913    {
23914     if(i2==i1)continue;
23915     aftsTrack=anEvent->GetTrack(i2);
23916     if(!(aftsTrack->InRPSelection())) continue;
23917     phi2=aftsTrack->Phi();
23918     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
23919     for(Int_t i3=0;i3<nPrim;i3++)
23920     {
23921      if(i3==i1||i3==i2)continue;
23922      aftsTrack=anEvent->GetTrack(i3);
23923      if(!(aftsTrack->InRPSelection())) continue;
23924      phi3=aftsTrack->Phi();
23925      if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
23926      for(Int_t i4=0;i4<nPrim;i4++)
23927      {
23928       if(i4==i1||i4==i2||i4==i3)continue;
23929       aftsTrack=anEvent->GetTrack(i4);
23930       if(!(aftsTrack->InRPSelection())) continue;
23931       phi4=aftsTrack->Phi();
23932       if(fUsePhiWeights && fPhiWeights) wPhi4 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi4*fnBinsPhi/TMath::TwoPi())));
23933       if(nPrim>=4) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<"\r"<<flush; // to be improved (replace eventually this if statement with if(nPrim==4))
23934       // 4-p correlations using particle weights:
23935       if(fUsePhiWeights) fIntFlowDirectCorrelations->Fill(10.5,cos(n*phi1+n*phi2-n*phi3-n*phi4),wPhi1*wPhi2*wPhi3*wPhi4); 
23936       // extra correlations: 
23937       // 2-p extra correlations (do not appear if particle weights are not used):
23938       // ...
23939       // 3-p extra correlations (do not appear if particle weights are not used):
23940       // ...
23941       // 4-p extra correlations (do not appear if particle weights are not used):
23942       // ...
23943      } // end of for(Int_t i4=0;i4<nPrim;i4++) 
23944     } // end of for(Int_t i3=0;i3<nPrim;i3++)
23945    } // end of for(Int_t i2=0;i2<nPrim;i2++)
23946   } // end of for(Int_t i1=0;i1<nPrim;i1++)
23947  } // end of if(nPrim>=4)
23948
23949  */
23950
23951  cout<<endl; 
23952
23953 } // end of void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrectionsForNUAWithNestedLoopsUsingParticleWeights(AliFlowEventSimple* anEvent)
23954
23955 //=======================================================================================================================
23956
23957 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights(TString type, TString ptOrEta)
23958 {
23959  // Calculate correction terms for non-uniform acceptance for differential flow (cos terms) using particle weights.
23960  
23961  // Results are stored in fDiffFlowCorrectionTermsForNUAPro[t][pe][1][cti], where cti runs as follows:
23962  //
23963  //  0: <<cos n(psi)>>
23964  //  1: <<w2 cos n(psi1+phi2)>>
23965  //  2: <<w2 w3 cos n(psi1+phi2-phi3)>>
23966  //  3: <<w2 w3 cos n(psi1-phi2-phi3)>>
23967  //  4:
23968  //  5:
23969  //  6:
23970  
23971  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
23972  Double_t dReQ1n1k = (*fReQ)(0,1);
23973  Double_t dReQ2n2k = (*fReQ)(1,2);
23974  //Double_t dReQ1n3k = (*fReQ)(0,3);
23975  //Double_t dReQ4n4k = (*fReQ)(3,4);
23976  Double_t dImQ1n1k = (*fImQ)(0,1);
23977  Double_t dImQ2n2k = (*fImQ)(1,2);
23978  //Double_t dImQ1n3k = (*fImQ)(0,3);
23979  //Double_t dImQ4n4k = (*fImQ)(3,4);
23980  
23981  // S^M_{p,k} (see .h file for the definition of fSpk):
23982  Double_t dSM1p1k = (*fSpk)(0,1);
23983  Double_t dSM1p2k = (*fSpk)(0,2);
23984  Double_t dSM2p1k = (*fSpk)(1,1);
23985
23986  Int_t t = 0; // type flag 
23987  Int_t pe = 0; // ptEta flag
23988  
23989  if(type == "RP")
23990  {
23991   t = 0;
23992  } else if(type == "POI")
23993    {
23994     t = 1;
23995    }
23996
23997  if(ptOrEta == "Pt")
23998  {
23999   pe = 0;
24000  } else if(ptOrEta == "Eta")
24001    {
24002     pe = 1;
24003    }
24004     
24005  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
24006  Double_t minPtEta[2] = {fPtMin,fEtaMin};
24007  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
24008  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
24009  
24010  // looping over all bins and calculating correction terms: 
24011  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
24012  {
24013   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
24014   Double_t p1n0kRe = 0.;
24015   Double_t p1n0kIm = 0.;
24016
24017   // number of POIs in particular pt or eta bin:
24018   Double_t mp = 0.;
24019
24020   // 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):
24021   Double_t q1n2kRe = 0.;
24022   //Double_t q1n2kIm = 0.;
24023   Double_t q2n1kRe = 0.;
24024   Double_t q2n1kIm = 0.;
24025     
24026   // s_{1,1}, s_{1,2} // to be improved (add explanation)  
24027   Double_t s1p1k = 0.; 
24028   Double_t s1p2k = 0.; 
24029   
24030   // number of particles which are both RPs and POIs in particular pt or eta bin:
24031   //Double_t mq = 0.;
24032   
24033   // M0111 from Eq. (118) in QC2c (to be improved (notation))
24034   Double_t dM01 = 0.;
24035   Double_t dM011 = 0.;
24036   
24037   if(type == "POI")
24038   {           
24039    // q_{m*n,k}:
24040    q1n2kRe = fReRPQ1dEBE[2][pe][0][2]->GetBinContent(fReRPQ1dEBE[2][pe][0][2]->GetBin(b))
24041            * fReRPQ1dEBE[2][pe][0][2]->GetBinEntries(fReRPQ1dEBE[2][pe][0][2]->GetBin(b));
24042    //q1n2kIm = fImRPQ1dEBE[2][pe][0][2]->GetBinContent(fImRPQ1dEBE[2][pe][0][2]->GetBin(b))
24043    //        * fImRPQ1dEBE[2][pe][0][2]->GetBinEntries(fImRPQ1dEBE[2][pe][0][2]->GetBin(b));         
24044    q2n1kRe = fReRPQ1dEBE[2][pe][1][1]->GetBinContent(fReRPQ1dEBE[2][pe][1][1]->GetBin(b))
24045            * fReRPQ1dEBE[2][pe][1][1]->GetBinEntries(fReRPQ1dEBE[2][pe][1][1]->GetBin(b));
24046    q2n1kIm = fImRPQ1dEBE[2][pe][1][1]->GetBinContent(fImRPQ1dEBE[2][pe][1][1]->GetBin(b))
24047            * fImRPQ1dEBE[2][pe][1][1]->GetBinEntries(fImRPQ1dEBE[2][pe][1][1]->GetBin(b));         
24048    //mq = fReRPQ1dEBE[2][pe][1][1]->GetBinEntries(fReRPQ1dEBE[2][pe][1][1]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
24049    
24050    s1p1k = pow(fs1dEBE[2][pe][1]->GetBinContent(b)*fs1dEBE[2][pe][1]->GetBinEntries(b),1.); 
24051    s1p2k = pow(fs1dEBE[2][pe][2]->GetBinContent(b)*fs1dEBE[2][pe][2]->GetBinEntries(b),1.); 
24052   }else if(type == "RP")
24053    {
24054     // q_{m*n,k}: (Remark: m=1 is 0, k=0 iz zero (to be improved!)) 
24055     q1n2kRe = fReRPQ1dEBE[0][pe][0][2]->GetBinContent(fReRPQ1dEBE[0][pe][0][2]->GetBin(b))
24056             * fReRPQ1dEBE[0][pe][0][2]->GetBinEntries(fReRPQ1dEBE[0][pe][0][2]->GetBin(b));
24057     //q1n2kIm = fImRPQ1dEBE[0][pe][0][2]->GetBinContent(fImRPQ1dEBE[0][pe][0][2]->GetBin(b))
24058     //        * fImRPQ1dEBE[0][pe][0][2]->GetBinEntries(fImRPQ1dEBE[0][pe][0][2]->GetBin(b));
24059     q2n1kRe = fReRPQ1dEBE[0][pe][1][1]->GetBinContent(fReRPQ1dEBE[0][pe][1][1]->GetBin(b))
24060             * fReRPQ1dEBE[0][pe][1][1]->GetBinEntries(fReRPQ1dEBE[0][pe][1][1]->GetBin(b));
24061     q2n1kIm = fImRPQ1dEBE[0][pe][1][1]->GetBinContent(fImRPQ1dEBE[0][pe][1][1]->GetBin(b))
24062             * fImRPQ1dEBE[0][pe][1][1]->GetBinEntries(fImRPQ1dEBE[0][pe][1][1]->GetBin(b));
24063     // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
24064     s1p1k = pow(fs1dEBE[0][pe][1]->GetBinContent(b)*fs1dEBE[0][pe][1]->GetBinEntries(b),1.); 
24065     s1p2k = pow(fs1dEBE[0][pe][2]->GetBinContent(b)*fs1dEBE[0][pe][2]->GetBinEntries(b),1.); 
24066     //s1p3k = pow(fs1dEBE[0][pe][3]->GetBinContent(b)*fs1dEBE[0][pe][3]->GetBinEntries(b),1.);  
24067     
24068     //mq = fReRPQ1dEBE[0][pe][1][1]->GetBinEntries(fReRPQ1dEBE[0][pe][1][1]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here) 
24069   }    
24070   
24071   if(type == "POI")
24072   {
24073    // p_{m*n,k}:   
24074    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
24075            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
24076    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
24077            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
24078    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here) 
24079    // M01 from Eq. (118) in QC2c (to be improved (notation)):
24080    dM01 = mp*dSM1p1k-s1p1k;
24081    dM011 = mp*(dSM2p1k-dSM1p2k)
24082          - 2.*(s1p1k*dSM1p1k-s1p2k);
24083        
24084    // typeFlag = RP (0) or POI (1):   
24085    t = 1; 
24086   } else if(type == "RP")
24087     {  
24088      // to be improved (cross-checked):
24089      p1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
24090              * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
24091      p1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))  
24092              * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
24093      mp = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
24094      // M01 from Eq. (118) in QC2c (to be improved (notation)):
24095      dM01 = mp*dSM1p1k-s1p1k;
24096      dM011 = mp*(dSM2p1k-dSM1p2k)
24097            - 2.*(s1p1k*dSM1p1k-s1p2k); 
24098      // typeFlag = RP (0) or POI (1): 
24099      t = 0;
24100     }
24101   
24102   // <<cos n(psi1)>>:
24103   Double_t cosP1nPsi = 0.;
24104   if(mp)
24105   {
24106    cosP1nPsi = p1n0kRe/mp;
24107    
24108    // fill profile for <<cos n(psi1)>>:
24109    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi,mp);
24110    // histogram to store <cos n(psi1)> e-b-e (needed in some other methods):
24111    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][0]->SetBinContent(b,cosP1nPsi);
24112   } // end of if(mp)   
24113   
24114   // <<w2 cos n(psi1+phi2)>>:
24115   Double_t cosP1nPsiP1nPhiW2 = 0.;
24116   if(dM01)
24117   {
24118    cosP1nPsiP1nPhiW2 = (p1n0kRe*dReQ1n1k-p1n0kIm*dImQ1n1k-q2n1kRe)/(dM01);
24119    // fill profile for <<w2 cos n(psi1+phi2)>>:
24120    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsiP1nPhiW2,dM01);
24121    // histogram to store <w2 cos n(psi1+phi2)> e-b-e (needed in some other methods):
24122    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][1]->SetBinContent(b,cosP1nPsiP1nPhiW2);
24123   } // end of if(dM01)   
24124   
24125   // <<w2 w3 cos n(psi1+phi2-phi3)>>:
24126   Double_t cosP1nPsi1P1nPhi2MPhi3W2W3 = 0.;
24127   if(dM011)
24128   {
24129    cosP1nPsi1P1nPhi2MPhi3W2W3 = (p1n0kRe*(pow(dImQ1n1k,2.)+pow(dReQ1n1k,2.))
24130                               - p1n0kRe*dSM1p2k
24131                               - q2n1kRe*dReQ1n1k-q2n1kIm*dImQ1n1k
24132                               - s1p1k*dReQ1n1k
24133                               + 2.*q1n2kRe)
24134                               / dM011;  
24135    // fill profile for <<w1 w2 w3 cos n(psi1+phi2)>>:
24136    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1P1nPhi2MPhi3W2W3,dM011);
24137    // histogram to store <w1 w2 w3 cos n(psi1+phi2)> e-b-e (needed in some other methods):
24138    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][2]->SetBinContent(b,cosP1nPsi1P1nPhi2MPhi3W2W3);
24139   } // end of if(dM011)   
24140   
24141   // <<w2 w3 cos n(psi1-phi2-phi3)>>:
24142   Double_t cosP1nPsi1M1nPhi2MPhi3W2W3 = 0.;
24143   if(dM011)
24144   {
24145    cosP1nPsi1M1nPhi2MPhi3W2W3 = (p1n0kRe*(pow(dReQ1n1k,2.)-pow(dImQ1n1k,2.))+2.*p1n0kIm*dReQ1n1k*dImQ1n1k
24146                               - 1.*(p1n0kRe*dReQ2n2k+p1n0kIm*dImQ2n2k)  
24147                               - 2.*s1p1k*dReQ1n1k
24148                               + 2.*q1n2kRe)
24149                               / dM011;
24150    // fill profile for <<w1 w2 w3 cos n(psi1+phi2)>>:
24151    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1M1nPhi2MPhi3W2W3,dM011);
24152    // histogram to store <w1 w2 w3 cos n(psi1+phi2)> e-b-e (needed in some other methods):
24153    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][3]->SetBinContent(b,cosP1nPsi1M1nPhi2MPhi3W2W3);
24154   } // end of if(dM011)   
24155  
24156  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
24157    
24158 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights(TString type, TString ptOrEta)
24159
24160
24161 //=======================================================================================================================
24162
24163
24164 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights(TString type, TString ptOrEta)
24165 {
24166  // Calculate correction terms for non-uniform acceptance for differential flow (sin terms).
24167   
24168  // Results are stored in fDiffFlowCorrectionTermsForNUAPro[t][pe][0][cti], where cti runs as follows:
24169  //  0: <<sin n(psi1)>>
24170  //  1: <<w2 sin n(psi1+phi2)>>
24171  //  2: <<w2 w3 sin n(psi1+phi2-phi3)>>
24172  //  3: <<w2 w3 sin n(psi1-phi2-phi3)>>:
24173  //  4:
24174  //  5:
24175  //  6:
24176  
24177  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
24178  Double_t dReQ1n1k = (*fReQ)(0,1);
24179  Double_t dReQ2n2k = (*fReQ)(1,2);
24180  //Double_t dReQ1n3k = (*fReQ)(0,3);
24181  //Double_t dReQ4n4k = (*fReQ)(3,4);
24182  Double_t dImQ1n1k = (*fImQ)(0,1);
24183  Double_t dImQ2n2k = (*fImQ)(1,2);
24184  //Double_t dImQ1n3k = (*fImQ)(0,3);
24185  //Double_t dImQ4n4k = (*fImQ)(3,4);
24186  
24187  // S^M_{p,k} (see .h file for the definition of fSpk):
24188  Double_t dSM1p1k = (*fSpk)(0,1);
24189  Double_t dSM1p2k = (*fSpk)(0,2);
24190  Double_t dSM2p1k = (*fSpk)(1,1);
24191
24192  Int_t t = 0; // type flag 
24193  Int_t pe = 0; // ptEta flag
24194  
24195  if(type == "RP")
24196  {
24197   t = 0;
24198  } else if(type == "POI")
24199    {
24200     t = 1;
24201    }
24202
24203  if(ptOrEta == "Pt")
24204  {
24205   pe = 0;
24206  } else if(ptOrEta == "Eta")
24207    {
24208     pe = 1;
24209    }
24210     
24211  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
24212  Double_t minPtEta[2] = {fPtMin,fEtaMin};
24213  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
24214  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
24215
24216  // looping over all bins and calculating correction terms: 
24217  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
24218  {
24219   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
24220   Double_t p1n0kRe = 0.;
24221   Double_t p1n0kIm = 0.;
24222
24223   // number of POIs in particular pt or eta bin:
24224   Double_t mp = 0.;
24225
24226   // 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):
24227   //Double_t q1n2kRe = 0.;
24228   Double_t q1n2kIm = 0.;
24229   Double_t q2n1kRe = 0.;
24230   Double_t q2n1kIm = 0.;
24231     
24232   // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
24233   Double_t s1p1k = 0.; 
24234   Double_t s1p2k = 0.; 
24235   
24236   // number of particles which are both RPs and POIs in particular pt or eta bin:
24237   //Double_t mq = 0.;
24238   
24239   // M0111 from Eq. (118) in QC2c (to be improved (notation))
24240   Double_t dM01 = 0.;
24241   Double_t dM011 = 0.;
24242
24243   if(type == "POI")
24244   {    
24245    // q_{m*n,k}:
24246    //q1n2kRe = fReRPQ1dEBE[2][pe][0][2]->GetBinContent(fReRPQ1dEBE[2][pe][0][2]->GetBin(b))
24247    //        * fReRPQ1dEBE[2][pe][0][2]->GetBinEntries(fReRPQ1dEBE[2][pe][0][2]->GetBin(b));
24248    q1n2kIm = fImRPQ1dEBE[2][pe][0][2]->GetBinContent(fImRPQ1dEBE[2][pe][0][2]->GetBin(b))
24249            * fImRPQ1dEBE[2][pe][0][2]->GetBinEntries(fImRPQ1dEBE[2][pe][0][2]->GetBin(b));         
24250    q2n1kRe = fReRPQ1dEBE[2][pe][1][1]->GetBinContent(fReRPQ1dEBE[2][pe][1][1]->GetBin(b))
24251            * fReRPQ1dEBE[2][pe][1][1]->GetBinEntries(fReRPQ1dEBE[2][pe][1][1]->GetBin(b));
24252    q2n1kIm = fImRPQ1dEBE[2][pe][1][1]->GetBinContent(fImRPQ1dEBE[2][pe][1][1]->GetBin(b))
24253            * fImRPQ1dEBE[2][pe][1][1]->GetBinEntries(fImRPQ1dEBE[2][pe][1][1]->GetBin(b));         
24254    //mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
24255    
24256    s1p1k = pow(fs1dEBE[2][pe][1]->GetBinContent(b)*fs1dEBE[2][pe][1]->GetBinEntries(b),1.); 
24257    s1p2k = pow(fs1dEBE[2][pe][2]->GetBinContent(b)*fs1dEBE[2][pe][2]->GetBinEntries(b),1.); 
24258   }else if(type == "RP")
24259    {
24260     // q_{m*n,k}: (Remark: m=1 is 0, k=0 iz zero (to be improved!)) 
24261     //q1n2kRe = fReRPQ1dEBE[0][pe][0][2]->GetBinContent(fReRPQ1dEBE[0][pe][0][2]->GetBin(b))
24262     //        * fReRPQ1dEBE[0][pe][0][2]->GetBinEntries(fReRPQ1dEBE[0][pe][0][2]->GetBin(b));
24263     q1n2kIm = fImRPQ1dEBE[0][pe][0][2]->GetBinContent(fImRPQ1dEBE[0][pe][0][2]->GetBin(b))
24264             * fImRPQ1dEBE[0][pe][0][2]->GetBinEntries(fImRPQ1dEBE[0][pe][0][2]->GetBin(b));
24265     q2n1kRe = fReRPQ1dEBE[0][pe][1][1]->GetBinContent(fReRPQ1dEBE[0][pe][1][1]->GetBin(b))
24266             * fReRPQ1dEBE[0][pe][1][1]->GetBinEntries(fReRPQ1dEBE[0][pe][1][1]->GetBin(b));
24267     q2n1kIm = fImRPQ1dEBE[0][pe][1][1]->GetBinContent(fImRPQ1dEBE[0][pe][1][1]->GetBin(b))
24268             * fImRPQ1dEBE[0][pe][1][1]->GetBinEntries(fImRPQ1dEBE[0][pe][1][1]->GetBin(b));
24269     // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
24270     s1p1k = pow(fs1dEBE[0][pe][1]->GetBinContent(b)*fs1dEBE[0][pe][1]->GetBinEntries(b),1.); 
24271     s1p2k = pow(fs1dEBE[0][pe][2]->GetBinContent(b)*fs1dEBE[0][pe][2]->GetBinEntries(b),1.); 
24272     //s1p3k = pow(fs1dEBE[0][pe][3]->GetBinContent(b)*fs1dEBE[0][pe][3]->GetBinEntries(b),1.); 
24273   }    
24274   
24275   if(type == "POI")
24276   {
24277    // p_{m*n,k}:   
24278    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
24279            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
24280    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
24281            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
24282    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here) 
24283    // M01 from Eq. (118) in QC2c (to be improved (notation)):
24284    dM01 = mp*dSM1p1k-s1p1k;
24285    dM011 = mp*(dSM2p1k-dSM1p2k)
24286          - 2.*(s1p1k*dSM1p1k-s1p2k);  
24287    // typeFlag = RP (0) or POI (1):   
24288    t = 1;           
24289   } else if(type == "RP")
24290     { 
24291      // to be improved (cross-checked):
24292      p1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
24293              * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
24294      p1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))  
24295              * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
24296      mp = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)    
24297      // M01 from Eq. (118) in QC2c (to be improved (notation)):
24298      dM01 = mp*dSM1p1k-s1p1k;
24299      dM011 = mp*(dSM2p1k-dSM1p2k)
24300            - 2.*(s1p1k*dSM1p1k-s1p2k); 
24301      // typeFlag = RP (0) or POI (1): 
24302      t = 0;
24303     }
24304   
24305   // <<sin n(psi1)>>:
24306   Double_t sinP1nPsi = 0.;
24307   if(mp)
24308   {
24309    sinP1nPsi = p1n0kIm/mp;
24310    
24311    // fill profile for <<sin n(psi1)>>:
24312    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi,mp);
24313    // histogram to store <sin n(psi1)> e-b-e (needed in some other methods):
24314    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][0]->SetBinContent(b,sinP1nPsi);
24315   } // end of if(mp)   
24316   
24317   // <<w2 sin n(psi1+phi2)>>:
24318   Double_t sinP1nPsiP1nPhiW2 = 0.;
24319   if(dM01)
24320   {
24321    sinP1nPsiP1nPhiW2 = (p1n0kRe*dImQ1n1k+p1n0kIm*dReQ1n1k-q2n1kIm)/(dM01);
24322    // fill profile for <<w2 sin n(psi1+phi2)>>:
24323    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsiP1nPhiW2,dM01);
24324    // histogram to store <w2 sin n(psi1+phi2)> e-b-e (needed in some other methods):
24325    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][1]->SetBinContent(b,sinP1nPsiP1nPhiW2);
24326   } // end of if(mp*dMult-mq)   
24327   
24328   // <<w2 w3 sin n(psi1+phi2-phi3)>>:
24329   Double_t sinP1nPsi1P1nPhi2MPhi3W2W3 = 0.;
24330   if(dM011)
24331   {
24332    sinP1nPsi1P1nPhi2MPhi3W2W3 = (p1n0kIm*(pow(dImQ1n1k,2.)+pow(dReQ1n1k,2.))
24333                               - p1n0kIm*dSM1p2k
24334                               + q2n1kRe*dImQ1n1k-q2n1kIm*dReQ1n1k
24335                               - s1p1k*dImQ1n1k
24336                               + 2.*q1n2kIm)
24337                               / dM011;  
24338    // fill profile for <<w2 w3 sin n(psi1+phi2-phi3)>>:
24339    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1P1nPhi2MPhi3W2W3,dM011);
24340    // histogram to store <w2 w3 sin n(psi1+phi2-phi3)> e-b-e (needed in some other methods):
24341    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][2]->SetBinContent(b,sinP1nPsi1P1nPhi2MPhi3W2W3);
24342   } // end of if(dM011)   
24343   
24344   // <<w2 w3 sin n(psi1-phi2-phi3)>>:
24345   Double_t sinP1nPsi1M1nPhi2MPhi3W2W3 = 0.;
24346   if(dM011)
24347   {
24348    sinP1nPsi1M1nPhi2MPhi3W2W3 = (p1n0kIm*(pow(dReQ1n1k,2.)-pow(dImQ1n1k,2.))-2.*p1n0kRe*dReQ1n1k*dImQ1n1k
24349                               + 1.*(p1n0kRe*dImQ2n2k-p1n0kIm*dReQ2n2k)  
24350                               + 2.*s1p1k*dImQ1n1k
24351                               - 2.*q1n2kIm)
24352                               / dM011;
24353    // fill profile for <<w2 w3 sin n(psi1-phi2-phi3)>>:
24354    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1M1nPhi2MPhi3W2W3,dM011);
24355    // histogram to store <w2 w3 sin n(psi1-phi2-phi3)> e-b-e (needed in some other methods):
24356    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][3]->SetBinContent(b,sinP1nPsi1M1nPhi2MPhi3W2W3);
24357   } // end of if(dM011)   
24358   
24359  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
24360
24361 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights(TString type, TString ptOrEta)
24362
24363 //=======================================================================================================================
24364    
24365 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
24366 {
24367  // Evaluate with nested loops correction terms for non-uniform acceptance 
24368  // with using particle weights (both sin and cos terms) relevant for differential flow.
24369  
24370  // Remark 1: "w1" in expressions bellow is a particle weight used only for particles which were 
24371  //           flagged both as POI and RP.
24372  // Remark 2: Reduced correction terms for non-uniform acceptance are evaluated in pt bin number fCrossCheckInPtBinNo 
24373  //           and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
24374  // Remark 3: Results are stored in 1 bin profiles fDiffFlowDirectCorrections[t][pe][sc][cti], where first three indices runs as: 
24375  //           [0=RP,1=POI][0=Pt,1=Eta][0=sin terms,1=cos terms], whilst the cti (correction term index) runs as follows: 
24376  //  cti: 
24377  //    0: <<sc n(psi1)>>
24378  //    1: <<w2 sc n(psi1+phi2)>> 
24379  //    2: <<w2 w3 sc n(psi1+phi2-phi3)>>
24380  //    3: <<w2 w3 sc n(psi1-phi2-phi3)>>
24381  //    4:
24382  //    5:
24383  //    6:
24384      
24385  Int_t typeFlag = 0;
24386  Int_t ptEtaFlag = 0;
24387  if(type == "RP")
24388  {
24389   typeFlag = 0;
24390  } else if(type == "POI")
24391    {
24392     typeFlag = 1;
24393    }      
24394  if(ptOrEta == "Pt")
24395  {
24396   ptEtaFlag = 0;
24397  } else if(ptOrEta == "Eta")
24398    {
24399     ptEtaFlag = 1;
24400    } 
24401  // shortcuts:
24402  Int_t t = typeFlag;
24403  Int_t pe = ptEtaFlag;
24404       
24405  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
24406  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
24407  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
24408  
24409  Int_t nPrim = anEvent->NumberOfTracks(); 
24410  AliFlowTrackSimple *aftsTrack = NULL;
24411  
24412  Double_t psi1=0., phi2=0., phi3=0.;// phi4=0.;// phi5=0., phi6=0., phi7=0., phi8=0.;
24413  Double_t wPhi2=1., wPhi3=1.;
24414  
24415  Int_t n = fHarmonic; 
24416  
24417  // 1'-particle correction terms:
24418  for(Int_t i1=0;i1<nPrim;i1++)
24419  {
24420   aftsTrack=anEvent->GetTrack(i1);
24421   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
24422   if(typeFlag==1) // this is diff flow of POIs 
24423   {
24424    if(ptOrEta == "Pt")
24425    { 
24426     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
24427    } else if (ptOrEta == "Eta")
24428      {
24429       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
24430      }
24431   } else // this is diff flow of RPs 
24432     {
24433      if(ptOrEta == "Pt")
24434      { 
24435       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
24436      } else if (ptOrEta == "Eta")
24437        {
24438         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
24439        }
24440     }
24441   psi1=aftsTrack->Phi(); 
24442   // sin terms: 
24443   fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*psi1),1.); // <<sin(n*(psi1))>>  
24444   // cos terms: 
24445   fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*psi1),1.); // <<cos(n*(psi1))>>  
24446  }//end of for(Int_t i1=0;i1<nPrim;i1++)
24447    
24448  // 2'-particle correction terms:
24449  for(Int_t i1=0;i1<nPrim;i1++)
24450  {
24451   aftsTrack=anEvent->GetTrack(i1);
24452   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
24453   if(typeFlag==1) // this is diff flow of POIs 
24454   {
24455    if(ptOrEta == "Pt")
24456    { 
24457     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
24458    } else if (ptOrEta == "Eta")
24459      {
24460       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
24461      }
24462   } else // this is diff flow of RPs 
24463     {
24464      if(ptOrEta == "Pt")
24465      { 
24466       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
24467      } else if (ptOrEta == "Eta")
24468        {
24469         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
24470        }
24471     }
24472   psi1=aftsTrack->Phi(); 
24473   for(Int_t i2=0;i2<nPrim;i2++)
24474   {
24475    if(i2==i1) continue;
24476    aftsTrack=anEvent->GetTrack(i2);
24477    // RP condition (!(first) particle in the correlator must be RP):
24478    if(!(aftsTrack->InRPSelection())) continue;
24479    phi2=aftsTrack->Phi();
24480    if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));   
24481    // sin terms: 
24482    fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1+phi2)),wPhi2); // <<w2 sin(n*(psi1+phi2))>>  
24483    // cos terms: 
24484    fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2)),wPhi2); // <<w2 cos(n*(psi1+phi2))>>  
24485   }//end of for(Int_t i2=0;i2<nPrim;i2++)
24486  }//end of for(Int_t i1=0;i1<nPrim;i1++)   
24487  
24488  // 3'-particle correction terms:
24489  for(Int_t i1=0;i1<nPrim;i1++)
24490  {
24491   aftsTrack=anEvent->GetTrack(i1);
24492   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
24493   if(typeFlag==1) // this is diff flow of POIs 
24494   {
24495    if(ptOrEta == "Pt")
24496    { 
24497     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
24498    } else if (ptOrEta == "Eta")
24499      {
24500       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
24501      }
24502   } else // this is diff flow of RPs 
24503     {
24504      if(ptOrEta == "Pt")
24505      { 
24506       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
24507      } else if (ptOrEta == "Eta")
24508        {
24509         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
24510        }
24511     }
24512   psi1=aftsTrack->Phi();
24513   for(Int_t i2=0;i2<nPrim;i2++)
24514   {
24515    if(i2==i1) continue;
24516    aftsTrack=anEvent->GetTrack(i2);
24517    // RP condition (!(first) particle in the correlator must be RP):
24518    if(!(aftsTrack->InRPSelection())) continue;
24519    phi2=aftsTrack->Phi();
24520    if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));   
24521    for(Int_t i3=0;i3<nPrim;i3++)
24522    {
24523     if(i3==i1||i3==i2) continue;
24524     aftsTrack=anEvent->GetTrack(i3);
24525     // RP condition (!(first) particle in the correlator must be RP):
24526     if(!(aftsTrack->InRPSelection())) continue;
24527     phi3=aftsTrack->Phi();
24528     if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));   
24529     // sin terms: 
24530     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))>>  
24531     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))>>  
24532     // cos terms: 
24533     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))>>  
24534     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))>>  
24535    }//end of for(Int_t i3=0;i3<nPrim;i3++)  
24536   }//end of for(Int_t i2=0;i2<nPrim;i2++)  
24537  }//end of for(Int_t i1=0;i1<nPrim;i1++)
24538                
24539 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(AliFlowEventSimple* anEvent, TString type, TString ptOrEta)
24540
24541 //=======================================================================================================================
24542
24543 void AliFlowAnalysisWithQCumulants::CheckPointersUsedInFinish()
24544 {
24545  // Check all pointers used in method Finish().
24546  
24547  if(!fAvMultiplicity)
24548  {
24549   cout<<endl;
24550   cout<<" WARNING (QC): fAvMultiplicity is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24551   cout<<endl;
24552   exit(0);
24553  }
24554  if(!fIntFlowCorrelationsPro)
24555  {
24556   cout<<endl;
24557   cout<<" WARNING (QC): fIntFlowCorrelationsPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24558   cout<<endl;
24559   exit(0); 
24560  }
24561  if(!fIntFlowSquaredCorrelationsPro)
24562  {
24563   cout<<endl;
24564   cout<<" WARNING (QC): fIntFlowSquaredCorrelationsPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24565   cout<<endl;
24566   exit(0); 
24567  } 
24568  if(!fIntFlowCorrelationsHist)
24569  {
24570   cout<<endl;
24571   cout<<" WARNING (QC): fIntFlowCorrelationsHist is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24572   cout<<endl;
24573   exit(0); 
24574  }
24575  if((fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights) && !fIntFlowExtraCorrelationsPro) 
24576  {
24577   cout<<endl;
24578   cout<<" WARNING (QC): fIntFlowExtraCorrelationsPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24579   cout<<endl;
24580   exit(0); 
24581  } 
24582  for(Int_t power=0;power<2;power++)
24583  { 
24584   if(!fIntFlowSumOfEventWeights[power]) 
24585   {
24586    cout<<endl;
24587    cout<<Form(" WARNING (QC): fIntFlowSumOfEventWeights[%d] is NULL in CheckPointersUsedInFinish() !!!!",power)<<endl;
24588    cout<<endl;
24589    exit(0);
24590   }
24591  } // end of for(Int_t power=0;power<2;power++)
24592  if(!fIntFlowProductOfCorrelationsPro)
24593  {
24594   cout<<endl;
24595   cout<<" WARNING (QC): fIntFlowProductOfCorrelationsPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24596   cout<<endl;
24597   exit(0); 
24598  } 
24599  if(!fIntFlowSumOfProductOfEventWeights)
24600  {
24601   cout<<endl;
24602   cout<<" WARNING (QC): fIntFlowSumOfProductOfEventWeights is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24603   cout<<endl;
24604   exit(0); 
24605  }
24606  if(!fIntFlowCovariances)
24607  {
24608   cout<<endl;
24609   cout<<" WARNING (QC): fIntFlowCovariances is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24610   cout<<endl;
24611   exit(0); 
24612  }  
24613  if(!fIntFlowQcumulants)
24614  {
24615   cout<<endl;
24616   cout<<" WARNING (QC): fIntFlowQcumulants is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24617   cout<<endl;
24618   exit(0); 
24619  }  
24620  if(!fIntFlow)
24621  {
24622   cout<<endl;
24623   cout<<" WARNING (QC): fIntFlow is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24624   cout<<endl;
24625   exit(0); 
24626  }
24627  if(!fCommonHists)
24628  {
24629   cout<<endl;
24630   cout<<" WARNING (QC): fCommonHists is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24631   cout<<endl;
24632   exit(0); 
24633  }
24634  if(!(fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th))
24635  {
24636   cout<<endl;
24637   cout<<" WARNING (QC): fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th"<<endl; 
24638   cout<<"               && fCommonHistsResults8th is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24639   cout<<endl;
24640   exit(0);
24641  } 
24642
24643  // NUA stuff:
24644  for(Int_t sc=0;sc<2;sc++) // sin/cos
24645  { 
24646   if(!fIntFlowCorrectionTermsForNUAPro[sc]) 
24647   {
24648    cout<<endl;
24649    cout<<Form(" WARNING (QC): fIntFlowCorrectionTermsForNUAPro[%d] is NULL in CheckPointersUsedInFinish() !!!!",sc)<<endl;
24650    cout<<endl;
24651    exit(0);
24652   }
24653   if(!fIntFlowCorrectionTermsForNUAHist[sc]) 
24654   {
24655    cout<<endl;
24656    cout<<Form(" WARNING (QC): fIntFlowCorrectionTermsForNUAHist[%d] is NULL in CheckPointersUsedInFinish() !!!!",sc)<<endl;
24657    cout<<endl;
24658    exit(0);
24659   }
24660   for(Int_t lq=0;lq<2;lq++) // linear/quadratic
24661   {
24662    if(!fIntFlowSumOfEventWeightsNUA[sc][lq]) 
24663    {
24664     cout<<endl;
24665     cout<<Form(" WARNING (QC): fIntFlowSumOfEventWeightsNUA[%d][%d] is NULL in CheckPointersUsedInFinish() !!!!",sc,lq)<<endl;
24666     cout<<endl;
24667     exit(0);
24668    }
24669   } // end of for(Int_t lq=0;lq<2;lq++) // linear/quadratic
24670  } // end of for(Int_t power=0;power<2;power++) 
24671  if(!fIntFlowProductOfCorrectionTermsForNUAPro)
24672  {
24673   cout<<endl;
24674   cout<<" WARNING (QC): fIntFlowProductOfCorrectionTermsForNUAPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24675   cout<<endl;
24676   exit(0); 
24677  } 
24678  if(!fIntFlowSumOfProductOfEventWeightsNUA)
24679  {
24680   cout<<endl;
24681   cout<<" WARNING (QC): fIntFlowSumOfProductOfEventWeightsNUA is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24682   cout<<endl;
24683   exit(0); 
24684  } 
24685  if(!fIntFlowCovariancesNUA)
24686  {
24687   cout<<endl;
24688   cout<<" WARNING (QC): fIntFlowCovariancesNUA is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24689   cout<<endl;
24690   exit(0); 
24691  } 
24692  if(!fIntFlowQcumulantsErrorSquaredRatio)
24693  {
24694   cout<<endl;
24695   cout<<" WARNING (QC): fIntFlowQcumulantsErrorSquaredRatio is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24696   cout<<endl;
24697   exit(0); 
24698  } 
24699  if(!fIntFlowDetectorBias)
24700  {
24701   cout<<endl;
24702   cout<<" WARNING (QC): fIntFlowDetectorBias is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24703   cout<<endl;
24704   exit(0); 
24705  }
24706  
24707  if(fCalculateMixedHarmonics)
24708  {
24709   if(!(fMixedHarmonicsFlags))
24710   {
24711    cout<<endl;
24712    cout<<" WARNING (QC): fMixedHarmonicsFlags is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24713    cout<<endl;
24714    exit(0); 
24715   }
24716   if(!(f2pCorrelations && f3pCorrelations && f4pCorrelations && f5pCorrelations))
24717   {
24718    cout<<endl;
24719    cout<<" WARNING (QC): f2pCorrelations && f3pCorrelations && f4pCorrelations && f5pCorrelations is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24720    cout<<endl;
24721    exit(0); 
24722   }
24723   if(!(f2pCumulants && f3pCumulants && f4pCumulants && f5pCumulants))
24724   {
24725    cout<<endl;
24726    cout<<" WARNING (QC): f2pCumulants && f3pCumulants && f4pCumulants && f5pCumulants is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24727    cout<<endl;
24728    exit(0); 
24729   }
24730   for(Int_t power=0;power<2;power++)
24731   { 
24732    if(!fMixedHarmonicEventWeights[power]) 
24733    {
24734     cout<<endl;
24735     cout<<Form(" WARNING (QC): fMixedHarmonicEventWeights[%d] is NULL in CheckPointersUsedInFinish() !!!!",power)<<endl;
24736     cout<<endl;
24737     exit(0);
24738    }
24739   } // end of for(Int_t power=0;power<2;power++)
24740   if(!(fMixedHarmonicProductOfEventWeights))
24741   {
24742    cout<<endl;
24743    cout<<" WARNING (QC): fMixedHarmonicProductOfEventWeights is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24744    cout<<endl;
24745    exit(0); 
24746   }
24747   if(!(fMixedHarmonicProductOfCorrelations))
24748   {
24749    cout<<endl;
24750    cout<<" WARNING (QC): fMixedHarmonicProductOfCorrelations is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24751    cout<<endl;
24752    exit(0); 
24753   }
24754  } // end of if(fCalculateMixedHarmonics)
24755
24756  // Versus multiplicity:
24757  if(!fCalculateCumulantsVsM){return;}
24758  for(Int_t co=0;co<=3;co++) // cumulant order
24759  {
24760   if(!fIntFlowQcumulantsVsM[co])
24761   {
24762    cout<<endl;
24763    cout<<Form(" WARNING (QC): fIntFlowQcumulantsVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",co)<<endl;
24764    cout<<endl;
24765    exit(0); 
24766   }
24767   if(!fIntFlowVsM[co])
24768   {
24769    cout<<endl;
24770    cout<<Form(" WARNING (QC): fIntFlowVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",co)<<endl;
24771    cout<<endl;
24772    exit(0); 
24773   }
24774   if(!fIntFlowDetectorBiasVsM[co])
24775   {
24776    cout<<endl;
24777    cout<<Form(" WARNING (QC): fIntFlowDetectorBiasVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",co)<<endl;
24778    cout<<endl;
24779    exit(0); 
24780   }
24781  } // end of for(Int_t c0=0;c0<=3;c0++) // cumulant order
24782  for(Int_t ci=0;ci<=3;ci++) // correlation index
24783  {
24784   if(!fIntFlowCorrelationsVsMPro[ci])
24785   {
24786    cout<<endl;
24787    cout<<Form(" WARNING (QC): fIntFlowCorrelationsVsMPro[%d] is NULL in CheckPointersUsedInFinish() !!!!",ci)<<endl;
24788    cout<<endl;
24789    exit(0); 
24790   }
24791   if(!fIntFlowSquaredCorrelationsVsMPro[ci])
24792   {
24793    cout<<endl;
24794    cout<<Form(" WARNING (QC): fIntFlowSquaredCorrelationsVsMPro[%d] is NULL in CheckPointersUsedInFinish() !!!!",ci)<<endl;
24795    cout<<endl;
24796    exit(0); 
24797   }  
24798   if(!fIntFlowCorrelationsVsMHist[ci])
24799   {
24800    cout<<endl;
24801    cout<<Form(" WARNING (QC): fIntFlowCorrelationsVsMHist[%d] is NULL in CheckPointersUsedInFinish() !!!!",ci)<<endl;
24802    cout<<endl;
24803    exit(0); 
24804   }
24805   for(Int_t power=0;power<2;power++) 
24806   {
24807    if(!fIntFlowSumOfEventWeightsVsM[ci][power])
24808    {
24809     cout<<endl;
24810     cout<<Form(" WARNING (QC): fIntFlowSumOfEventWeightsVsM[%d][%d] is NULL in CheckPointersUsedInFinish() !!!!",ci,power)<<endl;
24811     cout<<endl;
24812     exit(0);   
24813    }
24814   } // end of for(Int_t power=0;power<2;power++) 
24815  } // end of for(Int_t ci=0;ci<=3;ci++) // correlation index
24816  for(Int_t i=0;i<6;i++)
24817  {
24818   if(!fIntFlowProductOfCorrelationsVsMPro[i])
24819   {
24820    cout<<endl;
24821    cout<<Form(" WARNING (QC): fIntFlowProductOfCorrelationsVsMPro[%d] is NULL in CheckPointersUsedInFinish() !!!!",i)<<endl;
24822    cout<<endl;
24823    exit(0); 
24824   }
24825   if(!fIntFlowSumOfProductOfEventWeightsVsM[i])
24826   {
24827    cout<<endl;
24828    cout<<Form(" WARNING (QC): fIntFlowSumOfProductOfEventWeightsVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",i)<<endl;
24829    cout<<endl;
24830    exit(0); 
24831   }
24832   if(!fIntFlowCovariancesVsM[i])
24833   {
24834    cout<<endl;
24835    cout<<Form(" WARNING (QC): fIntFlowCovariancesVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",i)<<endl;
24836    cout<<endl;
24837    exit(0); 
24838   }
24839  } // end of for(Int_t i=0;i<6;i++) 
24840  if(!fIntFlowRebinnedInM)
24841  {
24842   cout<<endl;
24843   cout<<" WARNING (QC): fIntFlowRebinnedInM is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24844   cout<<endl;
24845   exit(0); 
24846  }
24847  if(!fIntFlowQcumulantsRebinnedInM)
24848  {
24849   cout<<endl;
24850   cout<<" WARNING (QC): fIntFlowQcumulantsRebinnedInM is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
24851   cout<<endl;
24852   exit(0); 
24853  }  
24854  
24855 } // end of void AliFlowAnalysisWithQCumulants::CheckPointersUsedInFinish()
24856
24857 //=======================================================================================================================
24858
24859 void AliFlowAnalysisWithQCumulants::CheckPointersUsedInMake()
24860 {
24861  // Check all pointers used in method Make(). // to be improved - check other pointers as well
24862  
24863  if(!fAvMultiplicity)
24864  {
24865   printf("\n WARNING (QC): fAvMultiplicity is NULL in CheckPointersUsedInMake() !!!!\n\n");
24866   exit(0);
24867  }
24868  if((fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights) && !fIntFlowExtraCorrelationsPro) 
24869  {
24870   printf("\n WARNING (QC): fIntFlowExtraCorrelationsPro is NULL in CheckPointersUsedInMake() !!!!\n\n");
24871   exit(0); 
24872  } 
24873  // 2D:
24874  if(fCalculate2DDiffFlow)
24875  {
24876   for(Int_t t=0;t<2;t++) // type = RP or POI
24877   { 
24878    for(Int_t rci=0;rci<4;rci++) // reduced correlation index
24879    {
24880     if(!f2DDiffFlowCorrelationsPro[t][rci])
24881     {
24882      printf("\n WARNING (QC): f2DDiffFlowCorrelationsPro[%i][%i] is NULL in CheckPointersUsedInMake() !!!!\n\n",t,rci);
24883      exit(0);     
24884     } // end of if(!f2DDiffFlowCorrelationsPro[t][rci])  
24885    } // end of for(Int_t rci=0;rci<4;rci++) // reduced correlation index
24886   } // end of for(Int_t t=0;t<2;t++)
24887  } // end of if(fCalculate2DDiffFlow)  
24888
24889 } // end of void AliFlowAnalysisWithQCumulants::CheckPointersUsedInMake()
24890  
24891