]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/FLOW/Base/AliFlowAnalysisWithQCumulants.cxx
fdc046ce3d97f70d447d4e85456d633d93867abb
[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  // 3.) integrated flow:
115  fIntFlowList(NULL), 
116  fIntFlowProfiles(NULL),
117  fIntFlowResults(NULL),
118  fIntFlowAllCorrelationsVsM(NULL),
119  fIntFlowFlags(NULL),
120  fApplyCorrectionForNUA(kFALSE),  
121  fApplyCorrectionForNUAVsM(kFALSE),
122  fnBinsMult(10000),
123  fMinMult(0.),  
124  fMaxMult(10000.), 
125  fPropagateErrorAlsoFromNIT(kFALSE), 
126  fCalculateCumulantsVsM(kFALSE),
127  fCalculateAllCorrelationsVsM(kFALSE), 
128  fMultiplicityIsRefMultiplicity(kFALSE),
129  fMinimumBiasReferenceFlow(kTRUE), 
130  fForgetAboutCovariances(kFALSE), 
131  fStorePhiDistributionForOneEvent(kFALSE),
132  fReQ(NULL),
133  fImQ(NULL),
134  fSpk(NULL),
135  fIntFlowCorrelationsEBE(NULL),
136  fIntFlowEventWeightsForCorrelationsEBE(NULL),
137  fIntFlowCorrelationsAllEBE(NULL),
138  fReferenceMultiplicityEBE(0.),  
139  fAvMultiplicity(NULL),
140  fIntFlowCorrelationsPro(NULL),
141  fIntFlowSquaredCorrelationsPro(NULL),
142  fIntFlowCorrelationsAllPro(NULL),
143  fIntFlowExtraCorrelationsPro(NULL),
144  fIntFlowProductOfCorrelationsPro(NULL),
145  fIntFlowProductOfCorrectionTermsForNUAPro(NULL),
146  fIntFlowCorrelationsHist(NULL),
147  fIntFlowCorrelationsAllHist(NULL),
148  fIntFlowCovariances(NULL),
149  fIntFlowSumOfProductOfEventWeights(NULL),
150  fIntFlowCovariancesNUA(NULL),
151  fIntFlowSumOfProductOfEventWeightsNUA(NULL),
152  fIntFlowQcumulants(NULL),
153  fIntFlowQcumulantsRebinnedInM(NULL), 
154  fIntFlowQcumulantsErrorSquaredRatio(NULL), 
155  fIntFlow(NULL),
156  fIntFlowRebinnedInM(NULL),
157  fIntFlowDetectorBias(NULL),
158  // 4.) differential flow:
159  fDiffFlowList(NULL),
160  fDiffFlowProfiles(NULL),
161  fDiffFlowResults(NULL),
162  fDiffFlow2D(NULL),
163  fDiffFlowFlags(NULL),
164  fCalculateDiffFlow(kTRUE),
165  fCalculate2DDiffFlow(kFALSE),
166  fCalculateDiffFlowVsEta(kTRUE),
167  // 5.) other differential correlators:
168  fOtherDiffCorrelatorsList(NULL),
169  // 6.) distributions:
170  fDistributionsList(NULL),
171  fDistributionsFlags(NULL),
172  fStoreDistributions(kFALSE),
173  // 7.) various:
174  fVariousList(NULL),
175  fPhiDistributionForOneEvent(NULL),
176  // 8.) debugging and cross-checking:
177  fNestedLoopsList(NULL),
178  fEvaluateIntFlowNestedLoops(kFALSE),
179  fEvaluateDiffFlowNestedLoops(kFALSE),
180  fMaxAllowedMultiplicity(10),
181  fEvaluateNestedLoops(NULL),
182  fIntFlowDirectCorrelations(NULL),
183  fIntFlowExtraDirectCorrelations(NULL),
184  fCrossCheckInPtBinNo(10),
185  fCrossCheckInEtaBinNo(20),
186  fNoOfParticlesInBin(NULL),
187  fMixedHarmonicsNestedLoops(NULL),
188  // 9.) mixed harmonics: 
189  fMixedHarmonicsList(NULL),
190  fMixedHarmonicsProfiles(NULL),
191  fMixedHarmonicsResults(NULL),
192  fMixedHarmonicsErrorPropagation(NULL),
193  fMixedHarmonicsFlags(NULL),
194  fCalculateMixedHarmonics(kFALSE),
195  fCalculateMixedHarmonicsVsM(kFALSE),
196  f2pCorrelations(NULL),
197  f3pCorrelations(NULL),
198  f4pCorrelations(NULL),
199  f5pCorrelations(NULL),
200  f6pCorrelations(NULL),
201  f7pCorrelations(NULL),
202  f8pCorrelations(NULL),
203  f2pCumulants(NULL),
204  f3pCumulants(NULL),
205  f4pCumulants(NULL),
206  f5pCumulants(NULL),
207  f6pCumulants(NULL),
208  f7pCumulants(NULL),
209  f8pCumulants(NULL),
210  fMixedHarmonicProductOfEventWeights(NULL),
211  fMixedHarmonicProductOfCorrelations(NULL)
212  {
213   // constructor  
214   
215   // base list to hold all output objects:
216   fHistList = new TList();
217   fHistList->SetName("cobjQC");
218   fHistList->SetOwner(kTRUE);
219   
220   // list to hold histograms with phi, pt and eta weights:      
221   fWeightsList = new TList();
222   
223   // multiplicity weight:
224   fMultiplicityWeight = new TString("combinations");
225     
226   // analysis label;
227   fAnalysisLabel = new TString();
228       
229   // initialize all arrays:  
230   this->InitializeArraysForIntFlow();
231   this->InitializeArraysForDiffFlow();
232   this->InitializeArraysForDistributions();
233   this->InitializeArraysForVarious();
234   this->InitializeArraysForNestedLoops();
235   this->InitializeArraysForMixedHarmonics();
236   
237  } // end of constructor
238  
239 //================================================================================================================  
240
241 AliFlowAnalysisWithQCumulants::~AliFlowAnalysisWithQCumulants()
242 {
243  // destructor
244  
245  delete fHistList;
246
247 } // end of AliFlowAnalysisWithQCumulants::~AliFlowAnalysisWithQCumulants()
248
249 //================================================================================================================
250
251 void AliFlowAnalysisWithQCumulants::Init()
252 {
253  // a) Cross check if the settings make sense before starting the QC adventure;
254  // b) Access all common constants;
255  // c) Book all objects;
256  // d) Store flags for integrated and differential flow;
257  // e) Store flags for distributions of corelations;
258  // f) Store harmonic which will be estimated;
259  // g) Store flags for mixed harmonics.
260   
261  //save old value and prevent histograms from being added to directory
262  //to avoid name clashes in case multiple analaysis objects are used
263  //in an analysis
264  Bool_t oldHistAddStatus = TH1::AddDirectoryStatus();
265  TH1::AddDirectory(kFALSE);
266  
267  // a) Cross check if the settings make sense before starting the QC adventure; 
268  this->CrossCheckSettings();
269  // b) Access all common constants and book a profile to hold them:
270  this->CommonConstants("Init");
271  // c) Book all objects:
272  this->BookAndFillWeightsHistograms(); 
273  this->BookAndNestAllLists();
274  this->BookCommonHistograms();
275  this->BookEverythingForIntegratedFlow(); 
276  this->BookEverythingForDifferentialFlow(); 
277  this->BookEverythingFor2DDifferentialFlow(); 
278  this->BookEverythingForDistributions();
279  this->BookEverythingForVarious();
280  this->BookEverythingForNestedLoops();
281  this->BookEverythingForMixedHarmonics();
282
283  // d) Store flags for integrated and differential flow:
284  this->StoreIntFlowFlags();
285  this->StoreDiffFlowFlags();
286  // e) Store flags for distributions of corelations:
287  this->StoreFlagsForDistributions();
288  // f) Store harmonic which will be estimated:
289  this->StoreHarmonic();
290  // g) Store flags for mixed harmonics:
291  this->StoreMixedHarmonicsFlags();
292  
293  TH1::AddDirectory(oldHistAddStatus);
294 } // end of void AliFlowAnalysisWithQCumulants::Init()
295
296 //================================================================================================================
297
298 void AliFlowAnalysisWithQCumulants::Make(AliFlowEventSimple* anEvent)
299 {
300  // Running over data only in this method.
301  
302  // a) Check all pointers used in this method;
303  // b) Define local variables;
304  // c) Fill the common control histograms and call the method to fill fAvMultiplicity;
305  // d) Loop over data and calculate e-b-e quantities Q_{n,k}, S_{p,k} and s_{p,k};
306  // e) Calculate the final expressions for S_{p,k} and s_{p,k} (important !!!!); 
307  // f) Call the methods which calculate correlations for reference flow;
308  // g) Call the methods which calculate correlations for differential flow;
309  // h) Call the methods which calculate correlations for 2D differential flow;
310  // i) Call the methods which calculate other differential correlators;
311  // j) Distributions of correlations;
312  // k) Store phi distribution for one event to illustrate flow;
313  // l) Cross-check with nested loops correlators for reference flow;
314  // m) Cross-check with nested loops correlators for differential flow;
315  // n) Reset all event-by-event quantities (very important !!!!). 
316  
317  // a) Check all pointers used in this method:
318  this->CheckPointersUsedInMake();
319  
320  // b) Define local variables:
321  Double_t dPhi = 0.; // azimuthal angle in the laboratory frame
322  Double_t dPt  = 0.; // transverse momentum
323  Double_t dEta = 0.; // pseudorapidity
324  Double_t wPhi = 1.; // phi weight
325  Double_t wPt  = 1.; // pt weight
326  Double_t wEta = 1.; // eta weight
327  Double_t wTrack = 1.; // track weight
328  Int_t nRP = anEvent->GetEventNSelTracksRP(); // number of RPs (i.e. number of reference particles)
329  fReferenceMultiplicityEBE = anEvent->GetReferenceMultiplicity(); // reference multiplicity for current event
330  Double_t ptEta[2] = {0.,0.}; // 0 = dPt, 1 = dEta
331   
332  // c) Fill the common control histograms and call the method to fill fAvMultiplicity:
333  this->FillCommonControlHistograms(anEvent);                                                               
334  this->FillAverageMultiplicities(nRP);                                                                  
335                                                                                                                                                                                                                                                                                         
336  // d) Loop over data and calculate e-b-e quantities Q_{n,k}, S_{p,k} and s_{p,k}:
337  Int_t nPrim = anEvent->NumberOfTracks();  // nPrim = total number of primary tracks, i.e. nPrim = nRP + nPOI where:
338                                            //  nRP   = # of reference particles;
339                                            //  nPOI  = # of particles of interest.
340  AliFlowTrackSimple *aftsTrack = NULL;
341  Int_t n = fHarmonic; // shortcut for the harmonic 
342  for(Int_t i=0;i<nPrim;i++) 
343  { 
344   aftsTrack=anEvent->GetTrack(i);
345   if(aftsTrack)
346   {
347    if(!(aftsTrack->InRPSelection() || aftsTrack->InPOISelection())){continue;} // safety measure: consider only tracks which are RPs or POIs
348    if(aftsTrack->InRPSelection()) // RP condition:
349    {    
350     dPhi = aftsTrack->Phi();
351     dPt  = aftsTrack->Pt();
352     dEta = aftsTrack->Eta();
353     if(fUsePhiWeights && fPhiWeights && fnBinsPhi) // determine phi weight for this particle:
354     {
355      wPhi = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*fnBinsPhi/TMath::TwoPi())));
356     }
357     if(fUsePtWeights && fPtWeights && fnBinsPt) // determine pt weight for this particle:
358     {
359      wPt = fPtWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-fPtMin)/fPtBinWidth))); 
360     }              
361     if(fUseEtaWeights && fEtaWeights && fEtaBinWidth) // determine eta weight for this particle: 
362     {
363      wEta = fEtaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-fEtaMin)/fEtaBinWidth))); 
364     }      
365     // Access track weight:
366     if(fUseTrackWeights)
367     {
368      wTrack = aftsTrack->Weight(); 
369     }
370     // Calculate Re[Q_{m*n,k}] and Im[Q_{m*n,k}] for this event (m = 1,2,...,12, k = 0,1,...,8):
371     for(Int_t m=0;m<12;m++) // to be improved - hardwired 6 
372     {
373      for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
374      {
375       (*fReQ)(m,k)+=pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1)*n*dPhi); 
376       (*fImQ)(m,k)+=pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1)*n*dPhi); 
377      } 
378     }
379     // Calculate S_{p,k} for this event (Remark: final calculation of S_{p,k} follows after the loop over data bellow):
380     for(Int_t p=0;p<8;p++)
381     {
382      for(Int_t k=0;k<9;k++)
383      {     
384       (*fSpk)(p,k)+=pow(wPhi*wPt*wEta*wTrack,k);
385      }
386     } 
387     // Differential flow:
388     if(fCalculateDiffFlow || fCalculate2DDiffFlow)
389     {
390      ptEta[0] = dPt; 
391      ptEta[1] = dEta; 
392      // Calculate r_{m*n,k} and s_{p,k} (r_{m,k} is 'p-vector' for RPs): 
393      for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
394      {
395       for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
396       {
397        if(fCalculateDiffFlow)
398        {
399         for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
400         {
401          fReRPQ1dEBE[0][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
402          fImRPQ1dEBE[0][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);          
403          if(m==0) // s_{p,k} does not depend on index m
404          {
405           fs1dEBE[0][pe][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k),1.);
406          } // end of if(m==0) // s_{p,k} does not depend on index m
407         } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
408        } // end of if(fCalculateDiffFlow) 
409        if(fCalculate2DDiffFlow)
410        {
411         fReRPQ2dEBE[0][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
412         fImRPQ2dEBE[0][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);      
413         if(m==0) // s_{p,k} does not depend on index m
414         {
415          fs2dEBE[0][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k),1.);
416         } // end of if(m==0) // s_{p,k} does not depend on index m
417        } // end of if(fCalculate2DDiffFlow)
418       } // end of for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
419      } // end of for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
420      // Checking if RP particle is also POI particle:      
421      if(aftsTrack->InPOISelection())
422      {
423       // Calculate q_{m*n,k} and s_{p,k} ('q-vector' and 's' for RPs && POIs): 
424       for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
425       {
426        for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
427        {
428         if(fCalculateDiffFlow)
429         {
430          for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
431          {
432           fReRPQ1dEBE[2][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
433           fImRPQ1dEBE[2][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);          
434           if(m==0) // s_{p,k} does not depend on index m
435           {
436            fs1dEBE[2][pe][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k),1.);
437           } // end of if(m==0) // s_{p,k} does not depend on index m
438          } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
439         } // end of if(fCalculateDiffFlow) 
440         if(fCalculate2DDiffFlow)
441         {
442          fReRPQ2dEBE[2][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
443          fImRPQ2dEBE[2][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);      
444          if(m==0) // s_{p,k} does not depend on index m
445          {
446           fs2dEBE[2][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k),1.);
447          } // end of if(m==0) // s_{p,k} does not depend on index m
448         } // end of if(fCalculate2DDiffFlow)
449        } // end of for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
450       } // end of for(Int_t k=0;k<9;k++) // to be improved - hardwired 9    
451      } // end of if(aftsTrack->InPOISelection())  
452     } // end of if(fCalculateDiffFlow || fCalculate2DDiffFlow)         
453    } // end of if(pTrack->InRPSelection())
454    if(aftsTrack->InPOISelection())
455    {
456     dPhi = aftsTrack->Phi();
457     dPt  = aftsTrack->Pt();
458     dEta = aftsTrack->Eta();
459     wPhi = 1.;
460     wPt  = 1.;
461     wEta = 1.;
462     wTrack = 1.;
463     if(fUsePhiWeights && fPhiWeights && fnBinsPhi && aftsTrack->InRPSelection()) // determine phi weight for POI && RP particle:
464     {
465      wPhi = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*fnBinsPhi/TMath::TwoPi())));
466     }
467     if(fUsePtWeights && fPtWeights && fnBinsPt && aftsTrack->InRPSelection()) // determine pt weight for POI && RP particle:
468     {
469      wPt = fPtWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-fPtMin)/fPtBinWidth))); 
470     }              
471     if(fUseEtaWeights && fEtaWeights && fEtaBinWidth && aftsTrack->InRPSelection()) // determine eta weight for POI && RP particle: 
472     {
473      wEta = fEtaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-fEtaMin)/fEtaBinWidth))); 
474     }      
475     // Access track weight for POI && RP particle:
476     if(aftsTrack->InRPSelection() && fUseTrackWeights)
477     {
478      wTrack = aftsTrack->Weight(); 
479     }
480     ptEta[0] = dPt;
481     ptEta[1] = dEta;
482     // Calculate p_{m*n,k} ('p-vector' for POIs): 
483     for(Int_t k=0;k<9;k++) // to be improved - hardwired 9
484     {
485      for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
486      {
487       if(fCalculateDiffFlow)
488       {
489        for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
490        {
491         fReRPQ1dEBE[1][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
492         fImRPQ1dEBE[1][pe][m][k]->Fill(ptEta[pe],pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);          
493        } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
494       } // end of if(fCalculateDiffFlow) 
495       if(fCalculate2DDiffFlow)
496       {
497        fReRPQ2dEBE[1][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Cos((m+1.)*n*dPhi),1.);
498        fImRPQ2dEBE[1][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta*wTrack,k)*TMath::Sin((m+1.)*n*dPhi),1.);      
499       } // end of if(fCalculate2DDiffFlow)
500      } // end of for(Int_t m=0;m<4;m++) // to be improved - hardwired 4
501     } // end of for(Int_t k=0;k<9;k++) // to be improved - hardwired 9    
502    } // end of if(pTrack->InPOISelection())    
503   } else // to if(aftsTrack)
504     {
505      printf("\n WARNING (QC): No particle (i.e. aftsTrack is a NULL pointer in AFAWQC::Make())!!!!\n\n");
506     }
507  } // end of for(Int_t i=0;i<nPrim;i++) 
508
509  // e) Calculate the final expressions for S_{p,k} and s_{p,k} (important !!!!):
510  for(Int_t p=0;p<8;p++)
511  {
512   for(Int_t k=0;k<9;k++)
513   {
514    (*fSpk)(p,k)=pow((*fSpk)(p,k),p+1);
515    // ... for the time being s_{p,k} dosn't need higher powers, so no need to finalize it here ...
516   } // end of for(Int_t k=0;k<9;k++)  
517  } // end of for(Int_t p=0;p<8;p++)
518  
519  // f) Call the methods which calculate correlations for reference flow:
520  if(!fEvaluateIntFlowNestedLoops)
521  {
522   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
523   {
524    if(nRP>1){this->CalculateIntFlowCorrelations();} // without using particle weights
525   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
526     {
527      if(nRP>1){this->CalculateIntFlowCorrelationsUsingParticleWeights();} // with using particle weights   
528     }        
529   // Whether or not using particle weights the following is calculated in the same way:  
530   if(nRP>3){this->CalculateIntFlowProductOfCorrelations();}
531   if(nRP>1){this->CalculateIntFlowSumOfEventWeights();}
532   if(nRP>1){this->CalculateIntFlowSumOfProductOfEventWeights();}  
533   // Non-isotropic terms:
534   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
535   {
536    if(nRP>0){this->CalculateIntFlowCorrectionsForNUASinTerms();}
537    if(nRP>0){this->CalculateIntFlowCorrectionsForNUACosTerms();}
538   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
539     {
540      if(nRP>0){this->CalculateIntFlowCorrectionsForNUASinTermsUsingParticleWeights();}
541      if(nRP>0){this->CalculateIntFlowCorrectionsForNUACosTermsUsingParticleWeights();}     
542     }      
543   // Whether or not using particle weights the following is calculated in the same way:  
544   if(nRP>0){this->CalculateIntFlowProductOfCorrectionTermsForNUA();}     
545   if(nRP>0){this->CalculateIntFlowSumOfEventWeightsNUA();}     
546   if(nRP>0){this->CalculateIntFlowSumOfProductOfEventWeightsNUA();}     
547   // Mixed harmonics:
548   if(fCalculateMixedHarmonics){this->CalculateMixedHarmonics();}
549  } // end of if(!fEvaluateIntFlowNestedLoops)
550
551  // g) Call the methods which calculate correlations for differential flow:
552  if(!fEvaluateDiffFlowNestedLoops && fCalculateDiffFlow)
553  {
554   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
555   {
556    // Without using particle weights:
557    this->CalculateDiffFlowCorrelations("RP","Pt"); 
558    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrelations("RP","Eta");}
559    this->CalculateDiffFlowCorrelations("POI","Pt");
560    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrelations("POI","Eta");}
561    // Non-isotropic terms:
562    this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Pt");
563    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Eta");}
564    this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Pt");
565    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Eta");}
566    this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Pt");
567    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Eta");}
568    this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Pt");
569    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Eta");}   
570   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
571     {
572      // With using particle weights:   
573      this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Pt"); 
574      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Eta");} 
575      this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Pt"); 
576      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Eta");} 
577      // Non-isotropic terms:
578      this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("RP","Pt");
579      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("RP","Eta");}
580      this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("POI","Pt");
581      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("POI","Eta");}
582      this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("RP","Pt");
583      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("RP","Eta");}
584      this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("POI","Pt");
585      if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("POI","Eta");}   
586     }     
587   // Whether or not using particle weights the following is calculated in the same way:  
588   this->CalculateDiffFlowProductOfCorrelations("RP","Pt");
589   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowProductOfCorrelations("RP","Eta");}
590   this->CalculateDiffFlowProductOfCorrelations("POI","Pt");
591   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowProductOfCorrelations("POI","Eta");}
592   this->CalculateDiffFlowSumOfEventWeights("RP","Pt");
593   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowSumOfEventWeights("RP","Eta");}
594   this->CalculateDiffFlowSumOfEventWeights("POI","Pt");
595   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowSumOfEventWeights("POI","Eta");}
596   this->CalculateDiffFlowSumOfProductOfEventWeights("RP","Pt");
597   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowSumOfProductOfEventWeights("RP","Eta");}
598   this->CalculateDiffFlowSumOfProductOfEventWeights("POI","Pt");
599   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowSumOfProductOfEventWeights("POI","Eta");}   
600  } // end of if(!fEvaluateDiffFlowNestedLoops && fCalculateDiffFlow)
601
602  // h) Call the methods which calculate correlations for 2D differential flow:
603  if(!fEvaluateDiffFlowNestedLoops && fCalculate2DDiffFlow)
604  {
605   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
606   {
607    // Without using particle weights:
608    this->Calculate2DDiffFlowCorrelations("RP"); 
609    this->Calculate2DDiffFlowCorrelations("POI");
610    // Non-isotropic terms:
611    // ... to be ctd ...
612   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
613     {
614      // With using particle weights:   
615      // ... to be ctd ...  
616      // Non-isotropic terms:
617      // ... to be ctd ...
618     }     
619   // Whether or not using particle weights the following is calculated in the same way:  
620   // ... to be ctd ...   
621  } // end of if(!fEvaluateDiffFlowNestedLoops && fCalculate2DDiffFlow)
622  
623  // i) Call the methods which calculate other differential correlators:
624  if(!fEvaluateDiffFlowNestedLoops && fCalculateDiffFlow)
625  {
626   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
627   {
628    // Without using particle weights:
629    this->CalculateOtherDiffCorrelators("RP","Pt"); 
630    if(fCalculateDiffFlowVsEta){this->CalculateOtherDiffCorrelators("RP","Eta");}
631    this->CalculateOtherDiffCorrelators("POI","Pt"); 
632    if(fCalculateDiffFlowVsEta){this->CalculateOtherDiffCorrelators("POI","Eta");}     
633   } else // to if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
634     {
635      // With using particle weights:   
636      // ... to be ctd ...  
637     }     
638   // Whether or not using particle weights the following is calculated in the same way:  
639   // ... to be ctd ...   
640  } // end of if(!fEvaluateDiffFlowNestedLoops)
641  
642  // j) Distributions of correlations:
643  if(fStoreDistributions){this->StoreDistributionsOfCorrelations();}
644  
645  // k) Store phi distribution for one event to illustrate flow: 
646  if(fStorePhiDistributionForOneEvent){this->StorePhiDistributionForOneEvent(anEvent);}
647    
648  // l) Cross-check with nested loops correlators for reference flow:
649  if(fEvaluateIntFlowNestedLoops){this->EvaluateIntFlowNestedLoops(anEvent);} 
650
651  // m) Cross-check with nested loops correlators for differential flow:
652  if(fEvaluateDiffFlowNestedLoops){this->EvaluateDiffFlowNestedLoops(anEvent);} 
653  
654  // n) Reset all event-by-event quantities (very important !!!!):
655  this->ResetEventByEventQuantities();
656  
657 } // end of AliFlowAnalysisWithQCumulants::Make(AliFlowEventSimple* anEvent)
658
659 //=======================================================================================================================
660
661 void AliFlowAnalysisWithQCumulants::Finish()
662 {
663  // Calculate the final results.
664  
665  // a) Check all pointers used in this method;
666  // b) Access the constants;
667  // c) Access the flags;
668  // d) Calculate reference cumulants (not corrected for detector effects);
669  // e) Correct reference cumulants for detector effects;
670  // f) Calculate reference flow;
671  // g) Store results for reference flow in AliFlowCommonHistResults and print them on the screen;
672  // h) Calculate the final results for differential flow (without/with weights);
673  // i) Correct the results for differential flow (without/with weights) for effects of non-uniform acceptance (NUA);
674  // j) Calculate the final results for integrated flow (RP/POI) and store in AliFlowCommonHistResults;
675  // k) Store results for differential flow in AliFlowCommonHistResults;
676  // l) Print the final results for integrated flow (RP/POI) on the screen; 
677  // m) Cross-checking: Results from Q-vectors vs results from nested loops;
678  // i) Calculate cumulants for mixed harmonics.
679
680  // a) Check all pointers used in this method:
681  this->CheckPointersUsedInFinish();
682   
683  // b) Access the constants:
684  this->CommonConstants("Finish");          
685  
686  if(fCommonHists && fCommonHists->GetHarmonic()) // to be improved (moved somewhere else)
687  {
688   fHarmonic = (Int_t)(fCommonHists->GetHarmonic())->GetBinContent(1);
689  } 
690  
691  // c) Access the flags: // to be improved (implement a method for this? should I store again the flags because they can get modified with redoFinish?)
692  fUsePhiWeights = (Bool_t)fUseParticleWeights->GetBinContent(1); 
693  fUsePtWeights = (Bool_t)fUseParticleWeights->GetBinContent(2); 
694  fUseEtaWeights = (Bool_t)fUseParticleWeights->GetBinContent(3);  
695  fUseTrackWeights = (Bool_t)fUseParticleWeights->GetBinContent(4);  
696  fApplyCorrectionForNUA = (Bool_t)fIntFlowFlags->GetBinContent(3); 
697  fPrintFinalResults[0] = (Bool_t)fIntFlowFlags->GetBinContent(4);
698  fPrintFinalResults[1] = (Bool_t)fIntFlowFlags->GetBinContent(5);
699  fPrintFinalResults[2] = (Bool_t)fIntFlowFlags->GetBinContent(6);
700  fPrintFinalResults[3] = (Bool_t)fIntFlowFlags->GetBinContent(7);
701  fApplyCorrectionForNUAVsM = (Bool_t)fIntFlowFlags->GetBinContent(8);  
702  fPropagateErrorAlsoFromNIT = (Bool_t)fIntFlowFlags->GetBinContent(9);  
703  fCalculateCumulantsVsM = (Bool_t)fIntFlowFlags->GetBinContent(10); 
704  fMinimumBiasReferenceFlow = (Bool_t)fIntFlowFlags->GetBinContent(11); 
705  fForgetAboutCovariances = (Bool_t)fIntFlowFlags->GetBinContent(12);
706  fStorePhiDistributionForOneEvent = (Bool_t)fIntFlowFlags->GetBinContent(13);
707  fFillMultipleControlHistograms = (Bool_t)fIntFlowFlags->GetBinContent(14); 
708  fCalculateAllCorrelationsVsM = (Bool_t)fIntFlowFlags->GetBinContent(15);
709  fMultiplicityIsRefMultiplicity = (Bool_t)fIntFlowFlags->GetBinContent(16);
710  fEvaluateIntFlowNestedLoops = (Bool_t)fEvaluateNestedLoops->GetBinContent(1);
711  fEvaluateDiffFlowNestedLoops = (Bool_t)fEvaluateNestedLoops->GetBinContent(2); 
712  fCrossCheckInPtBinNo = (Int_t)fEvaluateNestedLoops->GetBinContent(3);
713  fCrossCheckInEtaBinNo = (Int_t)fEvaluateNestedLoops->GetBinContent(4); 
714  fCalculateMixedHarmonics = (Bool_t)fMixedHarmonicsFlags->GetBinContent(1);
715  //fHarmonic = (Int_t)fMixedHarmonicsFlags->GetBinContent(2); // TBI should I add inpdependent generic harmonic here?
716  fCalculateMixedHarmonicsVsM = (Bool_t)fMixedHarmonicsFlags->GetBinContent(3);
717
718  // d) Calculate reference cumulants (not corrected for detector effects):
719  this->FinalizeCorrelationsIntFlow();
720  this->CalculateCovariancesIntFlow();
721  this->CalculateCumulantsIntFlow();
722
723  // e) Correct reference cumulants for detector effects:
724  this->FinalizeCorrectionTermsForNUAIntFlow();
725  this->CalculateCovariancesNUAIntFlow(); 
726  this->CalculateQcumulantsCorrectedForNUAIntFlow();  
727
728  // f) Calculate reference flow:
729  this->CalculateReferenceFlow(); 
730   
731  // g) Store results for reference flow in AliFlowCommonHistResults and print them on the screen:
732  this->FillCommonHistResultsIntFlow();  
733  if(fPrintFinalResults[0]){this->PrintFinalResultsForIntegratedFlow("RF");}
734  if(fPrintFinalResults[3] && fCalculateCumulantsVsM){this->PrintFinalResultsForIntegratedFlow("RF, rebinned in M");}
735  
736  // h) Calculate the final results for differential flow (without/with weights):
737  if(fCalculateDiffFlow)
738  {
739   this->FinalizeReducedCorrelations("RP","Pt"); 
740   if(fCalculateDiffFlowVsEta){this->FinalizeReducedCorrelations("RP","Eta");} 
741   this->FinalizeReducedCorrelations("POI","Pt"); 
742   if(fCalculateDiffFlowVsEta){this->FinalizeReducedCorrelations("POI","Eta");}
743   this->CalculateDiffFlowCovariances("RP","Pt");
744   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCovariances("RP","Eta");}
745   this->CalculateDiffFlowCovariances("POI","Pt");
746   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCovariances("POI","Eta");}
747   this->CalculateDiffFlowCumulants("RP","Pt");
748   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCumulants("RP","Eta");}
749   this->CalculateDiffFlowCumulants("POI","Pt");
750   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCumulants("POI","Eta");}
751   this->CalculateDiffFlow("RP","Pt");
752   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlow("RP","Eta");}
753   this->CalculateDiffFlow("POI","Pt");
754   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlow("POI","Eta");}
755  } // if(fCalculateDiffFlow)
756  
757  // i) Correct the results for differential flow (without/with weights) for effects of non-uniform acceptance (NUA):
758  if(fCalculateDiffFlow)
759  {
760   this->FinalizeCorrectionTermsForNUADiffFlow("RP","Pt");
761   if(fCalculateDiffFlowVsEta){this->FinalizeCorrectionTermsForNUADiffFlow("RP","Eta");}
762   this->FinalizeCorrectionTermsForNUADiffFlow("POI","Pt");
763   if(fCalculateDiffFlowVsEta){this->FinalizeCorrectionTermsForNUADiffFlow("POI","Eta");}      
764   this->CalculateDiffFlowCumulantsCorrectedForNUA("RP","Pt");   
765   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCumulantsCorrectedForNUA("RP","Eta");}   
766   this->CalculateDiffFlowCumulantsCorrectedForNUA("POI","Pt");   
767   if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCumulantsCorrectedForNUA("POI","Eta");}  
768   if(fApplyCorrectionForNUA)
769   {
770    this->CalculateDiffFlowCorrectedForNUA("RP","Pt"); 
771    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectedForNUA("RP","Eta");} 
772    this->CalculateDiffFlowCorrectedForNUA("POI","Pt"); 
773    if(fCalculateDiffFlowVsEta){this->CalculateDiffFlowCorrectedForNUA("POI","Eta");} 
774   }
775  } // end of if(fCalculateDiffFlow && fApplyCorrectionForNUA)
776  
777  // i) Calcualate final results for 2D differential flow: 
778  if(fCalculate2DDiffFlow)
779  {
780   this->Calculate2DDiffFlowCumulants("RP");
781   this->Calculate2DDiffFlowCumulants("POI");
782   this->Calculate2DDiffFlow("RP");  
783   this->Calculate2DDiffFlow("POI");  
784  } // end of if(fCalculate2DDiffFlow)
785     
786  // j) Calculate the final results for integrated flow (RP/POI) and store in AliFlowCommonHistResults:
787  if(fCalculateDiffFlow)
788  {
789   this->CalculateFinalResultsForRPandPOIIntegratedFlow("RP");
790   this->CalculateFinalResultsForRPandPOIIntegratedFlow("POI");
791  }
792  
793  // k) Store results for differential flow in AliFlowCommonHistResults:
794  if(fCalculateDiffFlow)
795  {
796   this->FillCommonHistResultsDiffFlow("RP");
797   this->FillCommonHistResultsDiffFlow("POI");
798  }
799  
800  // l) Print the final results for integrated flow (RP/POI) on the screen:
801  if(fPrintFinalResults[1] && fCalculateDiffFlow){this->PrintFinalResultsForIntegratedFlow("RP");} 
802  if(fPrintFinalResults[2] && fCalculateDiffFlow){this->PrintFinalResultsForIntegratedFlow("POI");}
803     
804  // m) Cross-checking: Results from Q-vectors vs results from nested loops:
805  //  m1) Reference flow:
806  if(fEvaluateIntFlowNestedLoops)
807  {
808   this->CrossCheckIntFlowCorrelations();
809   this->CrossCheckIntFlowCorrectionTermsForNUA(); 
810   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights){this->CrossCheckIntFlowExtraCorrelations();}
811   if(fCalculateMixedHarmonics){this->CrossCheckIntFlowCorrelations();}     
812  } // end of if(fEvaluateIntFlowNestedLoops)  
813  //  m2) Differential flow: 
814  if(fEvaluateDiffFlowNestedLoops && fCalculateDiffFlow) 
815  {
816   // Correlations:
817   this->PrintNumberOfParticlesInSelectedBin();
818   this->CrossCheckDiffFlowCorrelations("RP","Pt");  
819   if(fCalculateDiffFlowVsEta){this->CrossCheckDiffFlowCorrelations("RP","Eta");} 
820   this->CrossCheckDiffFlowCorrelations("POI","Pt");  
821   if(fCalculateDiffFlowVsEta){this->CrossCheckDiffFlowCorrelations("POI","Eta");}
822   // Correction terms for non-uniform acceptance:
823   this->CrossCheckDiffFlowCorrectionTermsForNUA("RP","Pt");      
824   if(fCalculateDiffFlowVsEta){this->CrossCheckDiffFlowCorrectionTermsForNUA("RP","Eta");}       
825   this->CrossCheckDiffFlowCorrectionTermsForNUA("POI","Pt");      
826   if(fCalculateDiffFlowVsEta){this->CrossCheckDiffFlowCorrectionTermsForNUA("POI","Eta");}
827   // Other differential correlators:       
828   this->CrossCheckOtherDiffCorrelators("RP","Pt");  
829   if(fCalculateDiffFlowVsEta){this->CrossCheckOtherDiffCorrelators("RP","Eta");} 
830   this->CrossCheckOtherDiffCorrelators("POI","Pt");  
831   if(fCalculateDiffFlowVsEta){this->CrossCheckOtherDiffCorrelators("POI","Eta");}
832  } // end of if(fEvaluateDiffFlowNestedLoops)
833                                                                                 
834  // i) Calculate cumulants for mixed harmonics: 
835  if(fCalculateMixedHarmonics){this->CalculateCumulantsMixedHarmonics();} 
836
837 } // end of AliFlowAnalysisWithQCumulants::Finish()
838
839 //=======================================================================================================================
840
841 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowNestedLoops(AliFlowEventSimple* anEvent)
842 {
843  // Evaluate all correlators for reference flow with nested loops.
844  
845  Int_t nPrim = anEvent->NumberOfTracks(); // nPrim = nRP + nPOI 
846  if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity) // by default fMaxAllowedMultiplicity = 10 
847  {
848   // Without using particle weights:
849   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
850   {
851    // Correlations:
852    this->CalculateIntFlowCorrelations(); // from Q-vectors
853    this->EvaluateIntFlowCorrelationsWithNestedLoops(anEvent); // from nested loops (TBI: do I have to pass here anEvent or not?)
854    // Correction for non-uniform acceptance:
855    this->CalculateIntFlowCorrectionsForNUASinTerms(); // from Q-vectors (sin terms)
856    this->CalculateIntFlowCorrectionsForNUACosTerms(); // from Q-vectors (cos terms)
857    this->EvaluateIntFlowCorrectionsForNUAWithNestedLoops(anEvent); // from nested loops (both sin and cos terms)
858    // Mixed harmonics:
859    if(fCalculateMixedHarmonics)
860    {
861     this->CalculateMixedHarmonics(); // from Q-vectors  
862     this->EvaluateMixedHarmonicsWithNestedLoops(anEvent); // from nested loops (TBI: do I have to pass here anEvent or not?)
863    } // end of if(fCalculateMixedHarmonics)
864   }
865   // Using particle weights:
866   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
867   {
868    // Correlations
869    this->CalculateIntFlowCorrelationsUsingParticleWeights(); // from Q-vectors
870    this->EvaluateIntFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent); // from nested loops (to be improved: do I have to pass here anEvent or not?)
871    // Correction for non-uniform acceptance:
872    this->CalculateIntFlowCorrectionsForNUASinTermsUsingParticleWeights(); // from Q-vectors (sin terms)
873    this->CalculateIntFlowCorrectionsForNUACosTermsUsingParticleWeights(); // from Q-vectors (cos terms)
874    this->EvaluateIntFlowCorrectionsForNUAWithNestedLoopsUsingParticleWeights(anEvent); // from nested loops (both sin and cos terms)   
875   }
876  } else if(nPrim>fMaxAllowedMultiplicity) // to if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity)
877    {
878     cout<<endl;
879     cout<<"Skipping the event because multiplicity is "<<nPrim<<". Too high to evaluate nested loops!"<<endl;
880    } else
881      {
882       cout<<endl;
883       cout<<"Skipping the event because multiplicity is "<<nPrim<<"."<<endl;      
884      } 
885
886 } // end of void AliFlowAnalysisWithQCumulants::EvaluateIntFlowNestedLoops(AliFlowEventSimple* anEvent)
887
888 //=======================================================================================================================
889
890 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowNestedLoops(AliFlowEventSimple* anEvent)
891 {
892  // Evalauted all correlators for differential flow with nested loops.
893
894  if(!fCalculateDiffFlow){return;}
895
896  Int_t nPrim = anEvent->NumberOfTracks(); // nPrim = nRP + nPOI 
897  if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity) // by default fMaxAllowedMultiplicity = 10
898  {
899   // Without using particle weights:
900   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
901   {
902    // 1.) Reduced correlations:
903    //  Q-vectors:
904    this->CalculateDiffFlowCorrelations("RP","Pt");
905    this->CalculateDiffFlowCorrelations("RP","Eta");
906    this->CalculateDiffFlowCorrelations("POI","Pt");
907    this->CalculateDiffFlowCorrelations("POI","Eta");
908    //  Nested loops:
909    this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"RP","Pt"); 
910    this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"RP","Eta"); 
911    this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"POI","Pt"); 
912    this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"POI","Eta"); 
913    // 2.) Reduced corrections for non-uniform acceptance:
914    //  Q-vectors:
915    this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Pt");
916    this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Eta");
917    this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Pt");
918    this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Eta");
919    this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Pt");
920    this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Eta");
921    this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Pt");
922    this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Eta");
923    //  Nested loops:
924    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"RP","Pt");
925    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"RP","Eta");
926    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"POI","Pt"); 
927    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"POI","Eta"); 
928    // 3.) Other differential correlators:
929    //  Q-vectors:
930    this->CalculateOtherDiffCorrelators("RP","Pt");
931    this->CalculateOtherDiffCorrelators("RP","Eta");
932    this->CalculateOtherDiffCorrelators("POI","Pt");
933    this->CalculateOtherDiffCorrelators("POI","Eta");   
934    //  Nested loops:
935    this->EvaluateOtherDiffCorrelatorsWithNestedLoops(anEvent,"RP","Pt");
936    this->EvaluateOtherDiffCorrelatorsWithNestedLoops(anEvent,"RP","Eta");
937    this->EvaluateOtherDiffCorrelatorsWithNestedLoops(anEvent,"POI","Pt");
938    this->EvaluateOtherDiffCorrelatorsWithNestedLoops(anEvent,"POI","Eta");   
939   } // end of if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
940   // Using particle weights:
941   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
942   {
943    this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Pt"); 
944    this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Eta"); 
945    this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Pt"); 
946    this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Eta"); 
947    this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("RP","Pt");
948    this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("RP","Eta");
949    this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("POI","Pt");
950    this->CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights("POI","Eta");
951    this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("RP","Pt");
952    this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("RP","Eta");
953    this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("POI","Pt");
954    this->CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights("POI","Eta");
955    this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"RP","Pt"); 
956    this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"RP","Eta");
957    this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"POI","Pt"); 
958    this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"POI","Eta");   
959    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(anEvent,"RP","Pt"); 
960    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(anEvent,"RP","Eta"); 
961    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(anEvent,"POI","Pt"); 
962    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(anEvent,"POI","Eta"); 
963   } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
964  } // end of if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity) // by default fMaxAllowedMultiplicity = 10
965
966 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowNestedLoops(AliFlowEventSimple* anEvent)
967
968 //=======================================================================================================================
969
970 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTerms()
971 {
972  // Calculate correction terms for non-uniform acceptance of the detector for reference flow (cos terms).
973  
974  // multiplicity:
975  Double_t dMult = (*fSpk)(0,0);
976  
977  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
978  Double_t dReQ1n = (*fReQ)(0,0);
979  Double_t dReQ2n = (*fReQ)(1,0);
980  //Double_t dReQ3n = (*fReQ)(2,0);
981  //Double_t dReQ4n = (*fReQ)(3,0);
982  Double_t dImQ1n = (*fImQ)(0,0);
983  Double_t dImQ2n = (*fImQ)(1,0);
984  //Double_t dImQ3n = (*fImQ)(2,0);
985  //Double_t dImQ4n = (*fImQ)(3,0);
986
987  // Multiplicity bin of an event (relevant for all histos vs M): 
988  Double_t dMultiplicityBin = 0.;
989  if(!fMultiplicityIsRefMultiplicity)
990  {
991   dMultiplicityBin = dMult+0.5;
992  } else
993    {
994     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
995    }
996         
997  //                                  *************************************************************
998  //                                  **** corrections for non-uniform acceptance (cos terms): ****
999  //                                  *************************************************************
1000  //
1001  // Remark 1: corrections for non-uniform acceptance (cos terms) calculated with non-weighted Q-vectors 
1002  //           are stored in 1D profile fQCorrectionsCos.
1003  // Remark 2: binning of fIntFlowCorrectionTermsForNUAPro[1] is organized as follows:
1004  // --------------------------------------------------------------------------------------------------------------------
1005  // 1st bin: <<cos(n*(phi1))>> = cosP1n
1006  // 2nd bin: <<cos(n*(phi1+phi2))>> = cosP1nP1n
1007  // 3rd bin: <<cos(n*(phi1-phi2-phi3))>> = cosP1nM1nM1n
1008  // 4th bin: <<cos(n*(2phi1-phi2))>> = cosP2nM1n
1009  // --------------------------------------------------------------------------------------------------------------------
1010   
1011  // 1-particle:
1012  Double_t cosP1n = 0.; // <<cos(n*(phi1))>>
1013    
1014  if(dMult>0)
1015  {
1016   cosP1n = dReQ1n/dMult; 
1017   
1018   // average non-weighted 1-particle correction (cos terms) for non-uniform acceptance for single event:
1019   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(1,cosP1n);
1020   // event weights for NUA terms:
1021   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->SetBinContent(1,dMult);
1022   
1023   // final average non-weighted 1-particle correction (cos terms) for non-uniform acceptance for all events:
1024   fIntFlowCorrectionTermsForNUAPro[1]->Fill(0.5,cosP1n,dMult);  
1025   if(fCalculateCumulantsVsM){fIntFlowCorrectionTermsForNUAVsMPro[1][0]->Fill(dMultiplicityBin,cosP1n,dMult);}    
1026  } 
1027  
1028  // 2-particle:
1029  Double_t cosP1nP1n = 0.; // <<cos(n*(phi1+phi2))>>
1030  Double_t cosP2nM1n = 0.; // <<cos(n*(2phi1-phi2))>>
1031  
1032  if(dMult>1)
1033  {
1034   cosP1nP1n = (pow(dReQ1n,2)-pow(dImQ1n,2)-dReQ2n)/(dMult*(dMult-1)); 
1035   cosP2nM1n = (dReQ2n*dReQ1n+dImQ2n*dImQ1n-dReQ1n)/(dMult*(dMult-1)); 
1036   
1037   // average non-weighted 2-particle correction (cos terms) for non-uniform acceptance for single event:
1038   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(2,cosP1nP1n);
1039   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(4,cosP2nM1n);
1040   // event weights for NUA terms:
1041   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->SetBinContent(2,dMult*(dMult-1));
1042   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->SetBinContent(4,dMult*(dMult-1));
1043       
1044   // final average non-weighted 2-particle correction (cos terms) for non-uniform acceptance for all events:
1045   fIntFlowCorrectionTermsForNUAPro[1]->Fill(1.5,cosP1nP1n,dMult*(dMult-1));  
1046   fIntFlowCorrectionTermsForNUAPro[1]->Fill(3.5,cosP2nM1n,dMult*(dMult-1));
1047   if(fCalculateCumulantsVsM)
1048   {
1049    fIntFlowCorrectionTermsForNUAVsMPro[1][1]->Fill(dMultiplicityBin,cosP1nP1n,dMult*(dMult-1));  
1050    fIntFlowCorrectionTermsForNUAVsMPro[1][3]->Fill(dMultiplicityBin,cosP2nM1n,dMult*(dMult-1));
1051   }
1052  } 
1053  
1054  // 3-particle:
1055  Double_t cosP1nM1nM1n = 0.; // <<cos(n*(phi1-phi2-phi3))>>
1056  
1057  if(dMult>2)
1058  {
1059   cosP1nM1nM1n = (dReQ1n*(pow(dReQ1n,2)+pow(dImQ1n,2))-dReQ1n*dReQ2n-dImQ1n*dImQ2n-2.*(dMult-1)*dReQ1n)
1060                / (dMult*(dMult-1)*(dMult-2)); 
1061   
1062   // average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for single event:
1063   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(3,cosP1nM1nM1n);
1064   // event weights for NUA terms:
1065   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->SetBinContent(3,dMult*(dMult-1)*(dMult-2));
1066   
1067   // final average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for all events:
1068   fIntFlowCorrectionTermsForNUAPro[1]->Fill(2.5,cosP1nM1nM1n,dMult*(dMult-1)*(dMult-2));
1069   if(fCalculateCumulantsVsM){fIntFlowCorrectionTermsForNUAVsMPro[1][2]->Fill(dMultiplicityBin,cosP1nM1nM1n,dMult*(dMult-1)*(dMult-2));}  
1070  } 
1071  
1072 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTerms()
1073
1074 //=======================================================================================================================
1075
1076 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTerms()
1077 {
1078  // calculate corrections for non-uniform acceptance of the detector for no-name integrated flow (sin terms)
1079  
1080  // multiplicity:
1081  Double_t dMult = (*fSpk)(0,0);
1082  
1083  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
1084  Double_t dReQ1n = (*fReQ)(0,0);
1085  Double_t dReQ2n = (*fReQ)(1,0);
1086  //Double_t dReQ3n = (*fReQ)(2,0);
1087  //Double_t dReQ4n = (*fReQ)(3,0);
1088  Double_t dImQ1n = (*fImQ)(0,0);
1089  Double_t dImQ2n = (*fImQ)(1,0);
1090  //Double_t dImQ3n = (*fImQ)(2,0);
1091  //Double_t dImQ4n = (*fImQ)(3,0);
1092         
1093  // Multiplicity bin of an event (relevant for all histos vs M): 
1094  Double_t dMultiplicityBin = 0.;
1095  if(!fMultiplicityIsRefMultiplicity)
1096  {
1097   dMultiplicityBin = dMult+0.5;
1098  } else
1099    {
1100     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
1101    }
1102
1103  //                                  *************************************************************
1104  //                                  **** corrections for non-uniform acceptance (sin terms): ****
1105  //                                  *************************************************************
1106  //
1107  // Remark 1: corrections for non-uniform acceptance (sin terms) calculated with non-weighted Q-vectors 
1108  //           are stored in 1D profile fQCorrectionsSin.
1109  // Remark 2: binning of fIntFlowCorrectionTermsForNUAPro[0] is organized as follows:
1110  // --------------------------------------------------------------------------------------------------------------------
1111  // 1st bin: <<sin(n*(phi1))>> = sinP1n
1112  // 2nd bin: <<sin(n*(phi1+phi2))>> = sinP1nP1n
1113  // 3rd bin: <<sin(n*(phi1-phi2-phi3))>> = sinP1nM1nM1n
1114  // 4th bin: <<sin(n*(2phi1-phi2))>> = sinP2nM1n
1115  // --------------------------------------------------------------------------------------------------------------------
1116  
1117  // 1-particle:
1118  Double_t sinP1n = 0.; // <sin(n*(phi1))>
1119  
1120  if(dMult>0)
1121  {
1122   sinP1n = dImQ1n/dMult; 
1123      
1124   // average non-weighted 1-particle correction (sin terms) for non-uniform acceptance for single event:
1125   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(1,sinP1n);  
1126   // event weights for NUA terms:
1127   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->SetBinContent(1,dMult);
1128   
1129   // final average non-weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:   
1130   fIntFlowCorrectionTermsForNUAPro[0]->Fill(0.5,sinP1n,dMult);  
1131   if(fCalculateCumulantsVsM){fIntFlowCorrectionTermsForNUAVsMPro[0][0]->Fill(dMultiplicityBin,sinP1n,dMult);} 
1132  } 
1133  
1134  // 2-particle:
1135  Double_t sinP1nP1n = 0.; // <<sin(n*(phi1+phi2))>>
1136  Double_t sinP2nM1n = 0.; // <<sin(n*(2phi1-phi2))>>
1137  if(dMult>1)
1138  {
1139   sinP1nP1n = (2.*dReQ1n*dImQ1n-dImQ2n)/(dMult*(dMult-1)); 
1140   sinP2nM1n = (dImQ2n*dReQ1n-dReQ2n*dImQ1n-dImQ1n)/(dMult*(dMult-1)); 
1141      
1142   // average non-weighted 2-particle correction (sin terms) for non-uniform acceptance for single event:
1143   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(2,sinP1nP1n);
1144   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(4,sinP2nM1n);
1145   // event weights for NUA terms:
1146   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->SetBinContent(2,dMult*(dMult-1));
1147   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->SetBinContent(4,dMult*(dMult-1));
1148   
1149   // final average non-weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:      
1150   fIntFlowCorrectionTermsForNUAPro[0]->Fill(1.5,sinP1nP1n,dMult*(dMult-1));  
1151   fIntFlowCorrectionTermsForNUAPro[0]->Fill(3.5,sinP2nM1n,dMult*(dMult-1));  
1152   if(fCalculateCumulantsVsM)
1153   {
1154    fIntFlowCorrectionTermsForNUAVsMPro[0][1]->Fill(dMultiplicityBin,sinP1nP1n,dMult*(dMult-1));  
1155    fIntFlowCorrectionTermsForNUAVsMPro[0][3]->Fill(dMultiplicityBin,sinP2nM1n,dMult*(dMult-1));    
1156   }
1157  } 
1158  
1159  // 3-particle:
1160  Double_t sinP1nM1nM1n = 0.; // <<sin(n*(phi1-phi2-phi3))>>
1161  
1162  if(dMult>2)
1163  {
1164   sinP1nM1nM1n = (-dImQ1n*(pow(dReQ1n,2)+pow(dImQ1n,2))+dReQ1n*dImQ2n-dImQ1n*dReQ2n+2.*(dMult-1)*dImQ1n)
1165                / (dMult*(dMult-1)*(dMult-2)); 
1166   
1167   // average non-weighted 3-particle correction (sin terms) for non-uniform acceptance for single event:
1168   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(3,sinP1nM1nM1n);
1169   // event weights for NUA terms:
1170   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->SetBinContent(3,dMult*(dMult-1)*(dMult-2));
1171   
1172   // final average non-weighted 3-particle correction (sin terms) for non-uniform acceptance for all events:  
1173   fIntFlowCorrectionTermsForNUAPro[0]->Fill(2.5,sinP1nM1nM1n,dMult*(dMult-1)*(dMult-2));
1174   if(fCalculateCumulantsVsM){fIntFlowCorrectionTermsForNUAVsMPro[0][2]->Fill(dMultiplicityBin,sinP1nM1nM1n,dMult*(dMult-1)*(dMult-2));}  
1175  } 
1176  
1177 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTerms()
1178
1179 //=======================================================================================================================
1180
1181 void AliFlowAnalysisWithQCumulants::GetOutputHistograms(TList *outputListHistos)
1182 {
1183  // a) Get pointers for common control and common result histograms;
1184  // b) Get pointers for histograms holding particle weights;
1185  // c) Get pointers for reference flow histograms;
1186  // d) Get pointers for differential flow histograms;
1187  // e) Get pointers for 2D differential flow histograms;
1188  // f) Get pointers for other differential correlators;
1189  // g) Get pointers for nested loops' histograms;
1190  // h) Get pointers for mixed harmonics histograms.
1191  
1192  if(outputListHistos)
1193  {      
1194   this->SetHistList(outputListHistos);
1195   if(!fHistList)
1196   {
1197    printf("\n WARNING (QC): fHistList is NULL in AFAWQC::GOH() !!!!\n\n");
1198    exit(0);
1199   }
1200   this->GetPointersForCommonHistograms(); 
1201   this->GetPointersForParticleWeightsHistograms(); 
1202   this->GetPointersForIntFlowHistograms();
1203   this->GetPointersForDiffFlowHistograms(); 
1204   this->GetPointersFor2DDiffFlowHistograms(); 
1205   this->GetPointersForOtherDiffCorrelators();  
1206   this->GetPointersForMixedHarmonicsHistograms(); 
1207   this->GetPointersForNestedLoopsHistograms(); 
1208  } else 
1209    {
1210     printf("\n WARNING (QC): outputListHistos is NULL in AFAWQC::GOH() !!!!\n\n");
1211     exit(0);
1212    }
1213    
1214 } // end of void AliFlowAnalysisWithQCumulants::GetOutputHistograms(TList *outputListHistos)
1215
1216 //=======================================================================================================================
1217
1218 TProfile* AliFlowAnalysisWithQCumulants::MakePtProjection(TProfile2D *profilePtEta) const
1219 {
1220  // project 2D profile onto pt axis to get 1D profile
1221  
1222  Int_t nBinsPt   = profilePtEta->GetNbinsX();
1223  Double_t dPtMin = (profilePtEta->GetXaxis())->GetXmin();
1224  Double_t dPtMax = (profilePtEta->GetXaxis())->GetXmax();
1225  
1226  Int_t nBinsEta   = profilePtEta->GetNbinsY();
1227  
1228  TProfile *profilePt = new TProfile("","",nBinsPt,dPtMin,dPtMax); 
1229  
1230  for(Int_t p=1;p<=nBinsPt;p++)
1231  {
1232   Double_t contentPt = 0.;
1233   Double_t entryPt = 0.;
1234   Double_t spreadPt = 0.;
1235   Double_t sum1 = 0.;
1236   Double_t sum2 = 0.;
1237   Double_t sum3 = 0.;
1238   for(Int_t e=1;e<=nBinsEta;e++)
1239   {
1240    contentPt += (profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)))
1241               * (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1242    entryPt   += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1243    
1244    sum1 += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)))
1245          * (pow(profilePtEta->GetBinError(profilePtEta->GetBin(p,e)),2.)
1246             + pow(profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)),2.)); 
1247    sum2 += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1248    sum3 += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)))
1249          * (profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)));            
1250   }
1251   if(sum2>0. && sum1/sum2-pow(sum3/sum2,2.) > 0.)
1252   {
1253    spreadPt = pow(sum1/sum2-pow(sum3/sum2,2.),0.5);
1254   }
1255   profilePt->SetBinContent(p,contentPt);
1256   profilePt->SetBinEntries(p,entryPt);
1257   {
1258    profilePt->SetBinError(p,spreadPt);
1259   }
1260   
1261  }
1262  
1263  return profilePt;
1264  
1265 } // end of TProfile* AliFlowAnalysisWithQCumulants::MakePtProjection(TProfile2D *profilePtEta)
1266
1267
1268 //=======================================================================================================================
1269
1270
1271 TProfile* AliFlowAnalysisWithQCumulants::MakeEtaProjection(TProfile2D *profilePtEta) const
1272 {
1273  // project 2D profile onto eta axis to get 1D profile
1274  
1275  Int_t nBinsEta   = profilePtEta->GetNbinsY();
1276  Double_t dEtaMin = (profilePtEta->GetYaxis())->GetXmin();
1277  Double_t dEtaMax = (profilePtEta->GetYaxis())->GetXmax();
1278  
1279  Int_t nBinsPt = profilePtEta->GetNbinsX();
1280  
1281  TProfile *profileEta = new TProfile("","",nBinsEta,dEtaMin,dEtaMax); 
1282  
1283  for(Int_t e=1;e<=nBinsEta;e++)
1284  {
1285   Double_t contentEta = 0.;
1286   Double_t entryEta = 0.;
1287   for(Int_t p=1;p<=nBinsPt;p++)
1288   {
1289    contentEta += (profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)))
1290               * (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1291    entryEta   += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
1292   }
1293   profileEta->SetBinContent(e,contentEta);
1294   profileEta->SetBinEntries(e,entryEta);
1295  }
1296  
1297  return profileEta;
1298  
1299 } // end of TProfile* AliFlowAnalysisWithQCumulants::MakeEtaProjection(TProfile2D *profilePtEta)
1300
1301 //=======================================================================================================================
1302
1303 void AliFlowAnalysisWithQCumulants::PrintFinalResultsForIntegratedFlow(TString type)
1304 {
1305  // Printing on the screen the final results for integrated flow (RF, POI and RP). 
1306  
1307  Int_t n = fHarmonic; 
1308  
1309  Double_t dVn[4] = {0.}; // array to hold Vn{2}, Vn{4}, Vn{6} and Vn{8}   
1310  Double_t dVnErr[4] = {0.}; // array to hold errors of Vn{2}, Vn{4}, Vn{6} and Vn{8}   
1311  
1312  if(type == "RF")
1313  {
1314   for(Int_t b=0;b<4;b++)
1315   {
1316    dVn[0] = (fCommonHistsResults2nd->GetHistIntFlow())->GetBinContent(1); 
1317    dVnErr[0] = (fCommonHistsResults2nd->GetHistIntFlow())->GetBinError(1); 
1318    dVn[1] = (fCommonHistsResults4th->GetHistIntFlow())->GetBinContent(1); 
1319    dVnErr[1] = (fCommonHistsResults4th->GetHistIntFlow())->GetBinError(1); 
1320    dVn[2] = (fCommonHistsResults6th->GetHistIntFlow())->GetBinContent(1); 
1321    dVnErr[2] = (fCommonHistsResults6th->GetHistIntFlow())->GetBinError(1); 
1322    dVn[3] = (fCommonHistsResults8th->GetHistIntFlow())->GetBinContent(1); 
1323    dVnErr[3] = (fCommonHistsResults8th->GetHistIntFlow())->GetBinError(1);    
1324   }  
1325  } else if(type == "RP")
1326    {
1327     dVn[0] = (fCommonHistsResults2nd->GetHistIntFlowRP())->GetBinContent(1); 
1328     dVnErr[0] = (fCommonHistsResults2nd->GetHistIntFlowRP())->GetBinError(1); 
1329     dVn[1] = (fCommonHistsResults4th->GetHistIntFlowRP())->GetBinContent(1); 
1330     dVnErr[1] = (fCommonHistsResults4th->GetHistIntFlowRP())->GetBinError(1); 
1331     dVn[2] = (fCommonHistsResults6th->GetHistIntFlowRP())->GetBinContent(1); 
1332     dVnErr[2] = (fCommonHistsResults6th->GetHistIntFlowRP())->GetBinError(1); 
1333     dVn[3] = (fCommonHistsResults8th->GetHistIntFlowRP())->GetBinContent(1); 
1334     dVnErr[3] = (fCommonHistsResults8th->GetHistIntFlowRP())->GetBinError(1); 
1335    } else if(type == "POI")
1336      {
1337       dVn[0] = (fCommonHistsResults2nd->GetHistIntFlowPOI())->GetBinContent(1); 
1338       dVnErr[0] = (fCommonHistsResults2nd->GetHistIntFlowPOI())->GetBinError(1); 
1339       dVn[1] = (fCommonHistsResults4th->GetHistIntFlowPOI())->GetBinContent(1); 
1340       dVnErr[1] = (fCommonHistsResults4th->GetHistIntFlowPOI())->GetBinError(1); 
1341       dVn[2] = (fCommonHistsResults6th->GetHistIntFlowPOI())->GetBinContent(1); 
1342       dVnErr[2] = (fCommonHistsResults6th->GetHistIntFlowPOI())->GetBinError(1); 
1343       dVn[3] = (fCommonHistsResults8th->GetHistIntFlowPOI())->GetBinContent(1); 
1344       dVnErr[3] = (fCommonHistsResults8th->GetHistIntFlowPOI())->GetBinError(1); 
1345      } else if(type == "RF, rebinned in M" && fCalculateCumulantsVsM)
1346        {
1347         for(Int_t b=0;b<4;b++)
1348         {
1349          dVn[b] = fIntFlowRebinnedInM->GetBinContent(b+1); 
1350          dVnErr[b] = fIntFlowRebinnedInM->GetBinError(b+1);
1351         }  
1352        }
1353  
1354  TString title = " flow estimates from Q-cumulants"; 
1355  TString subtitle = "    ("; 
1356  TString subtitle2 = "       (rebinned in M)"; 
1357  
1358  if(type != "RF, rebinned in M")
1359  {
1360   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
1361   {
1362    subtitle.Append(type);
1363    subtitle.Append(", without weights)");
1364   } else  
1365     {
1366      subtitle.Append(type);
1367      subtitle.Append(", with weights)");
1368     }
1369  } else
1370    {
1371     if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
1372     {
1373      subtitle.Append("RF");
1374      subtitle.Append(", without weights)");
1375     } else  
1376       {
1377        subtitle.Append("RF");
1378        subtitle.Append(", with weights)");      
1379       }
1380    } 
1381    
1382  cout<<endl;
1383  cout<<"*************************************"<<endl;
1384  cout<<"*************************************"<<endl;
1385  cout<<title.Data()<<endl; 
1386  cout<<subtitle.Data()<<endl; 
1387  if(type == "RF, rebinned in M"){cout<<subtitle2.Data()<<endl;}
1388  cout<<endl;
1389   
1390  for(Int_t i=0;i<4;i++)
1391  {
1392   cout<<"  v_"<<n<<"{"<<2*(i+1)<<"} = "<<dVn[i]<<" +/- "<<dVnErr[i]<<endl;
1393  }
1394  
1395  cout<<endl;
1396  if(type == "RF")
1397  {
1398   if(fApplyCorrectionForNUA)
1399   {
1400    cout<<" detector bias (corrected for): "<<endl;
1401   } else
1402     {
1403      cout<<" detector bias (not corrected for):"<<endl;  
1404     }
1405   cout<<"  to QC{2}: "<<fIntFlowDetectorBias->GetBinContent(1)<<" +/- "<<fIntFlowDetectorBias->GetBinError(1)<<endl;
1406   cout<<"  to QC{4}: "<<fIntFlowDetectorBias->GetBinContent(2)<<" +/- "<<fIntFlowDetectorBias->GetBinError(2)<<endl;
1407   cout<<endl;
1408  }
1409  if(type == "RF" || type == "RF, rebinned in M")
1410  {
1411   cout<<"     nEvts = "<<(Int_t)fCommonHists->GetHistMultRP()->GetEntries()<<", <M> = "<<(Double_t)fCommonHists->GetHistMultRP()->GetMean()<<endl; 
1412  }
1413  else if (type == "RP")
1414  {
1415   cout<<"     nEvts = "<<(Int_t)fCommonHists->GetHistMultRP()->GetEntries()<<", <M> = "<<(Double_t)fCommonHists->GetHistMultRP()->GetMean()<<endl;  
1416  } 
1417  else if (type == "POI")
1418  {
1419   cout<<"     nEvts = "<<(Int_t)fCommonHists->GetHistMultPOI()->GetEntries()<<", <M> = "<<(Double_t)fCommonHists->GetHistMultPOI()->GetMean()<<endl;
1420  }  
1421  
1422  cout<<"*************************************"<<endl;
1423  cout<<"*************************************"<<endl;
1424  cout<<endl; 
1425   
1426 }// end of AliFlowAnalysisWithQCumulants::PrintFinalResultsForIntegratedFlow(TString type="RF");
1427
1428 //=======================================================================================================================
1429
1430 void AliFlowAnalysisWithQCumulants::WriteHistograms(TString outputFileName)
1431 {
1432  //store the final results in output .root file
1433  TFile *output = new TFile(outputFileName.Data(),"RECREATE");
1434  //output->WriteObject(fHistList, "cobjQC","SingleKey");
1435  fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
1436  delete output;
1437 }
1438
1439
1440 //=======================================================================================================================
1441
1442
1443 void AliFlowAnalysisWithQCumulants::WriteHistograms(TDirectoryFile *outputFileName)
1444 {
1445  //store the final results in output .root file
1446  fHistList->SetName("cobjQC");
1447  fHistList->SetOwner(kTRUE);
1448  outputFileName->Add(fHistList);
1449  outputFileName->Write(outputFileName->GetName(), TObject::kSingleKey);
1450 }
1451
1452 //=======================================================================================================================
1453
1454 void AliFlowAnalysisWithQCumulants::BookCommonHistograms()
1455 {
1456  // Book common control histograms and common histograms for final results.
1457  //  a) Book common control histograms;
1458  //  b) Book common result histograms.
1459  
1460  // a) Book common control histograms: 
1461  //  Common control histograms (all events):
1462  TString commonHistsName = "AliFlowCommonHistQC";
1463  commonHistsName += fAnalysisLabel->Data();
1464  fCommonHists = new AliFlowCommonHist(commonHistsName.Data(),commonHistsName.Data(),fBookOnlyBasicCCH);
1465  fHistList->Add(fCommonHists);  
1466  //  Common control histograms (selected events):
1467  if(fFillMultipleControlHistograms)
1468  {
1469   // Common control histogram filled for events with 2 and more reference particles:
1470   TString commonHists2ndOrderName = "AliFlowCommonHist2ndOrderQC";
1471   commonHists2ndOrderName += fAnalysisLabel->Data();
1472   fCommonHists2nd = new AliFlowCommonHist(commonHists2ndOrderName.Data(),commonHists2ndOrderName.Data(),fBookOnlyBasicCCH);
1473   fHistList->Add(fCommonHists2nd);  
1474   // Common control histogram filled for events with 2 and more reference particles:
1475   TString commonHists4thOrderName = "AliFlowCommonHist4thOrderQC";
1476   commonHists4thOrderName += fAnalysisLabel->Data();
1477   fCommonHists4th = new AliFlowCommonHist(commonHists4thOrderName.Data(),commonHists4thOrderName.Data(),fBookOnlyBasicCCH);
1478   fHistList->Add(fCommonHists4th);  
1479   // Common control histogram filled for events with 6 and more reference particles:
1480   TString commonHists6thOrderName = "AliFlowCommonHist6thOrderQC";
1481   commonHists6thOrderName += fAnalysisLabel->Data();
1482   fCommonHists6th = new AliFlowCommonHist(commonHists6thOrderName.Data(),commonHists6thOrderName.Data(),fBookOnlyBasicCCH);
1483   fHistList->Add(fCommonHists6th);  
1484   // Common control histogram filled for events with 8 and more reference particles:
1485   TString commonHists8thOrderName = "AliFlowCommonHist8thOrderQC";
1486   commonHists8thOrderName += fAnalysisLabel->Data();
1487   fCommonHists8th = new AliFlowCommonHist(commonHists8thOrderName.Data(),commonHists8thOrderName.Data(),fBookOnlyBasicCCH);
1488   fHistList->Add(fCommonHists8th);    
1489  } // end of if(fFillMultipleControlHistograms)
1490  
1491  // b) Book common result histograms: 
1492  //  Common result histograms for QC{2}:
1493  TString commonHistResults2ndOrderName = "AliFlowCommonHistResults2ndOrderQC";
1494  commonHistResults2ndOrderName += fAnalysisLabel->Data();
1495  fCommonHistsResults2nd = new AliFlowCommonHistResults(commonHistResults2ndOrderName.Data(),"",fHarmonic);
1496  fHistList->Add(fCommonHistsResults2nd);  
1497  //  Common result histograms for QC{4}:
1498  TString commonHistResults4thOrderName = "AliFlowCommonHistResults4thOrderQC";
1499  commonHistResults4thOrderName += fAnalysisLabel->Data();
1500  fCommonHistsResults4th = new AliFlowCommonHistResults(commonHistResults4thOrderName.Data(),"",fHarmonic);
1501  fHistList->Add(fCommonHistsResults4th); 
1502  //  Common result histograms for QC{6}:
1503  TString commonHistResults6thOrderName = "AliFlowCommonHistResults6thOrderQC";
1504  commonHistResults6thOrderName += fAnalysisLabel->Data();
1505  fCommonHistsResults6th = new AliFlowCommonHistResults(commonHistResults6thOrderName.Data(),"",fHarmonic);
1506  fHistList->Add(fCommonHistsResults6th);  
1507  //  Common result histograms for QC{8}:
1508  TString commonHistResults8thOrderName = "AliFlowCommonHistResults8thOrderQC";
1509  commonHistResults8thOrderName += fAnalysisLabel->Data();
1510  fCommonHistsResults8th = new AliFlowCommonHistResults(commonHistResults8thOrderName.Data(),"",fHarmonic);
1511  fHistList->Add(fCommonHistsResults8th); 
1512  
1513 } // end of void AliFlowAnalysisWithQCumulants::BookCommonHistograms()
1514
1515 //=======================================================================================================================
1516
1517 void AliFlowAnalysisWithQCumulants::BookAndFillWeightsHistograms()
1518 {
1519  // Book and fill histograms which hold phi, pt and eta weights.
1520
1521  if(!fWeightsList)
1522  {
1523   printf("\n WARNING (QC): fWeightsList is NULL in AFAWQC::BAFWH() !!!! \n\n");
1524   exit(0);  
1525  }
1526     
1527  TString fUseParticleWeightsName = "fUseParticleWeightsQC";
1528  fUseParticleWeightsName += fAnalysisLabel->Data();
1529  fUseParticleWeights = new TProfile(fUseParticleWeightsName.Data(),"0 = particle weight not used, 1 = particle weight used ",4,0,4);
1530  fUseParticleWeights->SetLabelSize(0.06);
1531  fUseParticleWeights->SetStats(kFALSE);
1532  (fUseParticleWeights->GetXaxis())->SetBinLabel(1,"w_{#phi}");
1533  (fUseParticleWeights->GetXaxis())->SetBinLabel(2,"w_{p_{T}}");
1534  (fUseParticleWeights->GetXaxis())->SetBinLabel(3,"w_{#eta}");
1535  (fUseParticleWeights->GetXaxis())->SetBinLabel(4,"w_{track}");
1536  fUseParticleWeights->Fill(0.5,(Int_t)fUsePhiWeights);
1537  fUseParticleWeights->Fill(1.5,(Int_t)fUsePtWeights);
1538  fUseParticleWeights->Fill(2.5,(Int_t)fUseEtaWeights);
1539  fUseParticleWeights->Fill(3.5,(Int_t)fUseTrackWeights);
1540  fWeightsList->Add(fUseParticleWeights); 
1541   
1542  if(fUsePhiWeights)
1543  {
1544   if(fWeightsList->FindObject("phi_weights"))
1545   {
1546    fPhiWeights = dynamic_cast<TH1F*>(fWeightsList->FindObject("phi_weights"));
1547    if(!fPhiWeights)
1548    {
1549     printf("\n WARNING (QC): fPhiWeights is NULL in AFAWQC::BAFWH() !!!!\n\n");
1550     exit(0);
1551    }
1552    if(TMath::Abs(fPhiWeights->GetBinWidth(1)-fPhiBinWidth)>pow(10.,-6.))
1553    {
1554     cout<<endl;
1555     cout<<"WARNING (QC): Inconsistent binning in histograms for phi-weights throughout the code."<<endl;
1556     cout<<endl;
1557     //exit(0);
1558    }
1559   } else 
1560     {
1561      cout<<"WARNING: fWeightsList->FindObject(\"phi_weights\") is NULL in AFAWQC::BAFWH() !!!!"<<endl;
1562      exit(0);
1563     }
1564  } // end of if(fUsePhiWeights)
1565  
1566  if(fUsePtWeights) 
1567  {
1568   if(fWeightsList->FindObject("pt_weights"))
1569   {
1570    fPtWeights = dynamic_cast<TH1D*>(fWeightsList->FindObject("pt_weights"));
1571    if(!fPtWeights)
1572    {
1573     printf("\n WARNING (QC): fPtWeights is NULL in AFAWQC::BAFWH() !!!!\n\n");
1574     exit(0);
1575    }
1576    if(TMath::Abs(fPtWeights->GetBinWidth(1)-fPtBinWidth)>pow(10.,-6.))
1577    {
1578     cout<<endl;
1579     cout<<"WARNING (QC): Inconsistent binning in histograms for pt-weights throughout the code."<<endl;
1580     cout<<endl;
1581     //exit(0);
1582    }
1583   } else 
1584     {
1585      cout<<"WARNING: fWeightsList->FindObject(\"pt_weights\") is NULL in AFAWQC::BAFWH() !!!!"<<endl;
1586      exit(0);
1587     }
1588  } // end of if(fUsePtWeights)    
1589
1590  if(fUseEtaWeights) 
1591  {
1592   if(fWeightsList->FindObject("eta_weights"))
1593   {
1594    fEtaWeights = dynamic_cast<TH1D*>(fWeightsList->FindObject("eta_weights"));
1595    if(!fEtaWeights)
1596    {
1597     printf("\n WARNING (QC): fEtaWeights is NULL in AFAWQC::BAFWH() !!!!\n\n");
1598     exit(0);
1599    }
1600    if(TMath::Abs(fEtaWeights->GetBinWidth(1)-fEtaBinWidth)>pow(10.,-6.))
1601    {
1602     cout<<endl;
1603     cout<<"WARNING (QC): Inconsistent binning in histograms for eta-weights throughout the code."<<endl;
1604     cout<<endl;
1605     //exit(0);
1606    }
1607   } else 
1608     {
1609      cout<<"WARNING: fUseEtaWeights && fWeightsList->FindObject(\"eta_weights\") is NULL in AFAWQC::BAFWH() !!!!"<<endl;
1610      exit(0);
1611     }
1612  } // end of if(fUseEtaWeights)
1613  
1614 } // end of AliFlowAnalysisWithQCumulants::BookAndFillWeightsHistograms()
1615
1616 //=======================================================================================================================
1617
1618 void AliFlowAnalysisWithQCumulants::BookEverythingForIntegratedFlow()
1619 {
1620  // Book all objects for integrated flow:
1621  //  a) Book profile to hold all flags for integrated flow;
1622  //  b) Book event-by-event quantities;
1623  //  c) Book profiles; // to be improved (comment)
1624  //  d) Book histograms holding the final results.
1625  
1626  TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data members?)
1627  TString powerFlag[2] = {"linear","quadratic"}; // to be improved (should I promote this to data members?)
1628  
1629  // a) Book profile to hold all flags for integrated flow:
1630  TString intFlowFlagsName = "fIntFlowFlags";
1631  intFlowFlagsName += fAnalysisLabel->Data();
1632  fIntFlowFlags = new TProfile(intFlowFlagsName.Data(),"Flags for Integrated Flow",16,0,16);
1633  fIntFlowFlags->SetTickLength(-0.01,"Y");
1634  fIntFlowFlags->SetMarkerStyle(25);
1635  fIntFlowFlags->SetLabelSize(0.04);
1636  fIntFlowFlags->SetLabelOffset(0.02,"Y");
1637  fIntFlowFlags->SetStats(kFALSE);
1638  fIntFlowFlags->GetXaxis()->SetBinLabel(1,"Particle Weights");
1639  fIntFlowFlags->GetXaxis()->SetBinLabel(2,"Event Weights");
1640  fIntFlowFlags->GetXaxis()->SetBinLabel(3,"Corrected for NUA?");
1641  fIntFlowFlags->GetXaxis()->SetBinLabel(4,"Print RF results");
1642  fIntFlowFlags->GetXaxis()->SetBinLabel(5,"Print RP results");
1643  fIntFlowFlags->GetXaxis()->SetBinLabel(6,"Print POI results");
1644  fIntFlowFlags->GetXaxis()->SetBinLabel(7,"Print RF (rebinned in M) results");
1645  fIntFlowFlags->GetXaxis()->SetBinLabel(8,"Corrected for NUA vs M?");
1646  fIntFlowFlags->GetXaxis()->SetBinLabel(9,"Propagate errors to v_{n} from correlations?");
1647  fIntFlowFlags->GetXaxis()->SetBinLabel(10,"Calculate cumulants vs M");
1648  fIntFlowFlags->GetXaxis()->SetBinLabel(11,"fMinimumBiasReferenceFlow");
1649  fIntFlowFlags->GetXaxis()->SetBinLabel(12,"fForgetAboutCovariances");
1650  fIntFlowFlags->GetXaxis()->SetBinLabel(13,"fStorePhiDistributionForOneEvent");
1651  fIntFlowFlags->GetXaxis()->SetBinLabel(14,"fFillMultipleControlHistograms");
1652  fIntFlowFlags->GetXaxis()->SetBinLabel(15,"Calculate all correlations vs M");
1653  fIntFlowFlags->GetXaxis()->SetBinLabel(16,"fMultiplicityIsRefMultiplicity");
1654  fIntFlowList->Add(fIntFlowFlags);
1655
1656  // b) Book event-by-event quantities:
1657  // Re[Q_{m*n,k}], Im[Q_{m*n,k}] and S_{p,k}^M: 
1658  fReQ = new TMatrixD(12,9);
1659  fImQ = new TMatrixD(12,9);
1660  fSpk = new TMatrixD(8,9);
1661  // average correlations <2>, <4>, <6> and <8> for single event (bining is the same as in fIntFlowCorrelationsPro and fIntFlowCorrelationsHist):
1662  TString intFlowCorrelationsEBEName = "fIntFlowCorrelationsEBE";
1663  intFlowCorrelationsEBEName += fAnalysisLabel->Data();
1664  fIntFlowCorrelationsEBE = new TH1D(intFlowCorrelationsEBEName.Data(),intFlowCorrelationsEBEName.Data(),4,0,4);
1665  // weights for average correlations <2>, <4>, <6> and <8> for single event:
1666  TString intFlowEventWeightsForCorrelationsEBEName = "fIntFlowEventWeightsForCorrelationsEBE";
1667  intFlowEventWeightsForCorrelationsEBEName += fAnalysisLabel->Data();
1668  fIntFlowEventWeightsForCorrelationsEBE = new TH1D(intFlowEventWeightsForCorrelationsEBEName.Data(),intFlowEventWeightsForCorrelationsEBEName.Data(),4,0,4);
1669  // average all correlations for single event (bining is the same as in fIntFlowCorrelationsAllPro and fIntFlowCorrelationsAllHist):
1670  TString intFlowCorrelationsAllEBEName = "fIntFlowCorrelationsAllEBE";
1671  intFlowCorrelationsAllEBEName += fAnalysisLabel->Data();
1672  fIntFlowCorrelationsAllEBE = new TH1D(intFlowCorrelationsAllEBEName.Data(),intFlowCorrelationsAllEBEName.Data(),64,0,64);
1673  // average correction terms for non-uniform acceptance for single event 
1674  // (binning is the same as in fIntFlowCorrectionTermsForNUAPro[2] and fIntFlowCorrectionTermsForNUAHist[2]):
1675  TString fIntFlowCorrectionTermsForNUAEBEName = "fIntFlowCorrectionTermsForNUAEBE";
1676  fIntFlowCorrectionTermsForNUAEBEName += fAnalysisLabel->Data();
1677  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
1678  {
1679   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);  
1680  }
1681  // event weights for terms for non-uniform acceptance: 
1682  TString fIntFlowEventWeightForCorrectionTermsForNUAEBEName = "fIntFlowEventWeightForCorrectionTermsForNUAEBE";
1683  fIntFlowEventWeightForCorrectionTermsForNUAEBEName += fAnalysisLabel->Data();
1684  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
1685  {
1686   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  
1687  }
1688  // c) Book profiles: // to be improved (comment)
1689  // profile to hold average multiplicities and number of events for events with nRP>=0, nRP>=1, ... , and nRP>=8:
1690  TString avMultiplicityName = "fAvMultiplicity";
1691  avMultiplicityName += fAnalysisLabel->Data();
1692  fAvMultiplicity = new TProfile(avMultiplicityName.Data(),"Average multiplicities of reference particles (RPs)",9,0,9);
1693  fAvMultiplicity->SetTickLength(-0.01,"Y");
1694  fAvMultiplicity->SetMarkerStyle(25);
1695  fAvMultiplicity->SetLabelSize(0.05);
1696  fAvMultiplicity->SetLabelOffset(0.02,"Y");
1697  fAvMultiplicity->SetYTitle("Average multiplicity");
1698  (fAvMultiplicity->GetXaxis())->SetBinLabel(1,"all evts");
1699  (fAvMultiplicity->GetXaxis())->SetBinLabel(2,"n_{RP} #geq 1");
1700  (fAvMultiplicity->GetXaxis())->SetBinLabel(3,"n_{RP} #geq 2");
1701  (fAvMultiplicity->GetXaxis())->SetBinLabel(4,"n_{RP} #geq 3");
1702  (fAvMultiplicity->GetXaxis())->SetBinLabel(5,"n_{RP} #geq 4");
1703  (fAvMultiplicity->GetXaxis())->SetBinLabel(6,"n_{RP} #geq 5");
1704  (fAvMultiplicity->GetXaxis())->SetBinLabel(7,"n_{RP} #geq 6");
1705  (fAvMultiplicity->GetXaxis())->SetBinLabel(8,"n_{RP} #geq 7");
1706  (fAvMultiplicity->GetXaxis())->SetBinLabel(9,"n_{RP} #geq 8");
1707  fIntFlowProfiles->Add(fAvMultiplicity);
1708  // Average correlations <<2>>, <<4>>, <<6>> and <<8>> for all events (with wrong errors!):
1709  TString correlationFlag[4] = {"#LT#LT2#GT#GT","#LT#LT4#GT#GT","#LT#LT6#GT#GT","#LT#LT8#GT#GT"};
1710  TString intFlowCorrelationsProName = "fIntFlowCorrelationsPro";
1711  intFlowCorrelationsProName += fAnalysisLabel->Data();
1712  fIntFlowCorrelationsPro = new TProfile(intFlowCorrelationsProName.Data(),"Average correlations for all events",4,0,4,"s");
1713  fIntFlowCorrelationsPro->Sumw2();
1714  fIntFlowCorrelationsPro->SetTickLength(-0.01,"Y");
1715  fIntFlowCorrelationsPro->SetMarkerStyle(25);
1716  fIntFlowCorrelationsPro->SetLabelSize(0.06);
1717  fIntFlowCorrelationsPro->SetLabelOffset(0.01,"Y");
1718  for(Int_t b=0;b<4;b++)
1719  {
1720   (fIntFlowCorrelationsPro->GetXaxis())->SetBinLabel(b+1,correlationFlag[b].Data());
1721  }
1722  fIntFlowProfiles->Add(fIntFlowCorrelationsPro);
1723  // Average correlations squared <<2>^2>, <<4>^2>, <<6>^2> and <<8>^2> for all events:
1724  TString squaredCorrelationFlag[4] = {"#LT#LT2#GT^{2}#GT","#LT#LT4#GT^{2}#GT","#LT#LT6#GT^{2}#GT","#LT#LT8#GT^{2}#GT"};
1725  TString intFlowSquaredCorrelationsProName = "fIntFlowSquaredCorrelationsPro";
1726  intFlowSquaredCorrelationsProName += fAnalysisLabel->Data();
1727  fIntFlowSquaredCorrelationsPro = new TProfile(intFlowSquaredCorrelationsProName.Data(),"Average squared correlations for all events",4,0,4,"s");
1728  fIntFlowSquaredCorrelationsPro->Sumw2();
1729  fIntFlowSquaredCorrelationsPro->SetTickLength(-0.01,"Y");
1730  fIntFlowSquaredCorrelationsPro->SetMarkerStyle(25);
1731  fIntFlowSquaredCorrelationsPro->SetLabelSize(0.06);
1732  fIntFlowSquaredCorrelationsPro->SetLabelOffset(0.01,"Y");
1733  for(Int_t b=0;b<4;b++)
1734  {
1735   (fIntFlowSquaredCorrelationsPro->GetXaxis())->SetBinLabel(b+1,squaredCorrelationFlag[b].Data());
1736  }
1737  fIntFlowProfiles->Add(fIntFlowSquaredCorrelationsPro);
1738  if(fCalculateCumulantsVsM)
1739  {
1740   for(Int_t ci=0;ci<4;ci++) // correlation index
1741   {
1742    // average correlations <<2>>, <<4>>, <<6>> and <<8>> versus multiplicity for all events (with wrong errors):
1743    TString intFlowCorrelationsVsMProName = "fIntFlowCorrelationsVsMPro";
1744    intFlowCorrelationsVsMProName += fAnalysisLabel->Data();
1745    fIntFlowCorrelationsVsMPro[ci] = new TProfile(Form("%s, %s",intFlowCorrelationsVsMProName.Data(),correlationFlag[ci].Data()),
1746                                                  Form("%s vs multiplicity",correlationFlag[ci].Data()),
1747                                                  fnBinsMult,fMinMult,fMaxMult,"s");   
1748    fIntFlowCorrelationsVsMPro[ci]->Sumw2();                                                                                       
1749    fIntFlowCorrelationsVsMPro[ci]->GetYaxis()->SetTitle(correlationFlag[ci].Data());
1750    fIntFlowCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("M");
1751    if(fMultiplicityIsRefMultiplicity){fIntFlowCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");} 
1752    fIntFlowProfiles->Add(fIntFlowCorrelationsVsMPro[ci]);
1753    // average squared correlations <<2>^2>, <<4>^2>, <<6>^2> and <<8>^2> versus multiplicity for all events:  
1754    TString intFlowSquaredCorrelationsVsMProName = "fIntFlowSquaredCorrelationsVsMPro";
1755    intFlowSquaredCorrelationsVsMProName += fAnalysisLabel->Data();
1756    fIntFlowSquaredCorrelationsVsMPro[ci] = new TProfile(Form("%s, %s",intFlowSquaredCorrelationsVsMProName.Data(),squaredCorrelationFlag[ci].Data()),
1757                                                         Form("%s vs multiplicity",squaredCorrelationFlag[ci].Data()),
1758                                                         fnBinsMult,fMinMult,fMaxMult,"s");   
1759    fIntFlowSquaredCorrelationsVsMPro[ci]->Sumw2();                                                                                              
1760    fIntFlowSquaredCorrelationsVsMPro[ci]->GetYaxis()->SetTitle(squaredCorrelationFlag[ci].Data());
1761    fIntFlowSquaredCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("M");
1762    if(fMultiplicityIsRefMultiplicity){fIntFlowSquaredCorrelationsVsMPro[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");} 
1763    fIntFlowProfiles->Add(fIntFlowSquaredCorrelationsVsMPro[ci]);
1764   } // end of for(Int_t ci=0;ci<4;ci++) // correlation index  
1765  } // end of if(fCalculateCumulantsVsM)
1766  // averaged all correlations for all events (with wrong errors!):
1767  TString intFlowCorrelationsAllProName = "fIntFlowCorrelationsAllPro";
1768  intFlowCorrelationsAllProName += fAnalysisLabel->Data();
1769  fIntFlowCorrelationsAllPro = new TProfile(intFlowCorrelationsAllProName.Data(),"Average all correlations for all events",64,0,64);
1770  fIntFlowCorrelationsAllPro->Sumw2();
1771  fIntFlowCorrelationsAllPro->SetTickLength(-0.01,"Y");
1772  fIntFlowCorrelationsAllPro->SetMarkerStyle(25);
1773  fIntFlowCorrelationsAllPro->SetLabelSize(0.03);
1774  fIntFlowCorrelationsAllPro->SetLabelOffset(0.01,"Y");
1775  // 2-p correlations:
1776  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(1,"#LT#LT2#GT#GT_{n|n}");
1777  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(2,"#LT#LT2#GT#GT_{2n|2n}");
1778  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(3,"#LT#LT2#GT#GT_{3n|3n}");
1779  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(4,"#LT#LT2#GT#GT_{4n|4n}");
1780  // 3-p correlations:
1781  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(6,"#LT#LT3#GT#GT_{2n|n,n}");
1782  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(7,"#LT#LT3#GT#GT_{3n|2n,n}");
1783  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(8,"#LT#LT3#GT#GT_{4n|2n,2n}");
1784  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(9,"#LT#LT3#GT#GT_{4n|3n,n}");
1785  // 4-p correlations:
1786  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(11,"#LT#LT4#GT#GT_{n,n|n,n}"); 
1787  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(12,"#LT#LT4#GT#GT_{2n,n|2n,n}");
1788  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(13,"#LT#LT4#GT#GT_{2n,2n|2n,2n}");
1789  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(14,"#LT#LT4#GT#GT_{3n|n,n,n}");
1790  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(15,"#LT#LT4#GT#GT_{3n,n|3n,n}");
1791  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(16,"#LT#LT4#GT#GT_{3n,n|2n,2n}"); 
1792  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(17,"#LT#LT4#GT#GT_{4n|2n,n,n}");
1793  // 5-p correlations:
1794  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(19,"#LT#LT5#GT#GT_{2n,n|n,n,n}"); 
1795  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(20,"#LT#LT5#GT#GT_{2n,2n|2n,n,n}");
1796  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(21,"#LT#LT5#GT#GT_{3n,n|2n,n,n}");
1797  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(22,"#LT#LT5#GT#GT_{4n|n,n,n,n}");
1798  // 6-p correlations:
1799  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(24,"#LT#LT6#GT#GT_{n,n,n|n,n,n}");
1800  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(25,"#LT#LT6#GT#GT_{2n,n,n|2n,n,n}");
1801  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(26,"#LT#LT6#GT#GT_{2n,2n|n,n,n,n}");
1802  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(27,"#LT#LT6#GT#GT_{3n,n|n,n,n,n}");
1803  // 7-p correlations:  
1804  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(29,"#LT#LT7#GT#GT_{2n,n,n|n,n,n,n}");
1805  // 8-p correlations:
1806  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(31,"#LT#LT8#GT#GT_{n,n,n,n|n,n,n,n}");
1807  //  EXTRA correlations for v3{5} study:
1808  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(33,"#LT#LT4#GT#GT_{4n,2n|3n,3n}");
1809  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(34,"#LT#LT5#GT#GT_{3n,3n|2n,2n,2n}");
1810  //  EXTRA correlations for Teaney-Yan study:
1811  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(35,"#LT#LT2#GT#GT_{5n|5n}");
1812  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(36,"#LT#LT2#GT#GT_{6n|6n}");
1813  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(37,"#LT#LT3#GT#GT_{5n|3n,2n}");
1814  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(38,"#LT#LT3#GT#GT_{5n|4n,1n}");
1815  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(39,"#LT#LT3#GT#GT_{6n|3n,3n}");
1816  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(40,"#LT#LT3#GT#GT_{6n|4n,2n}");
1817  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(41,"#LT#LT3#GT#GT_{6n|5n,1n}");
1818  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(42,"#LT#LT4#GT#GT_{6n|3n,2n,1n}");
1819  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(43,"#LT#LT4#GT#GT_{3n,2n|3n,2n}");
1820  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(44,"#LT#LT4#GT#GT_{4n,1n|3n,2n}");
1821  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(45,"#LT#LT4#GT#GT_{3n,3n|3n,3n}");
1822  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(46,"#LT#LT4#GT#GT_{4n,2n|3n,3n}");
1823  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(47,"#LT#LT4#GT#GT_{5n,1n|3n,3n}");
1824  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(48,"#LT#LT4#GT#GT_{4n,2n|4n,2n}");
1825  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(49,"#LT#LT4#GT#GT_{5n,1n|4n,2n}");
1826  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(50,"#LT#LT4#GT#GT_{5n|3n,1n,1n}");
1827  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(51,"#LT#LT4#GT#GT_{5n|2n,2n,1n}");
1828  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(52,"#LT#LT4#GT#GT_{5n,1n|5n,1n}");
1829  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(53,"#LT#LT5#GT#GT_{3n,3n|3n,2n,1n}");
1830  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(54,"#LT#LT5#GT#GT_{4n,2n|3n,2n,1n}");
1831  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(55,"#LT#LT5#GT#GT_{3n,2n|3n,1n,1n}");
1832  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(56,"#LT#LT5#GT#GT_{3n,2n|2n,2n,1n}");
1833  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(57,"#LT#LT5#GT#GT_{5n,1n|3n,2n,1n}");
1834  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(58,"#LT#LT6#GT#GT_{3n,2n,1n|3n,2n,1n}");
1835  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(59,"#LT#LT4#GT#GT_{6n|4n,1n,1n}");
1836  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(60,"#LT#LT4#GT#GT_{6n|2n,2n,2n}");
1837  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(61,"#LT#LT5#GT#GT_{6n|2n,2n,1n,1n}");
1838  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(62,"#LT#LT5#GT#GT_{4n,1n,1n|3n,3n}");
1839  (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(63,"#LT#LT6#GT#GT_{3n,3n|2n,2n,1n,1n}");
1840  fIntFlowProfiles->Add(fIntFlowCorrelationsAllPro);
1841  // average all correlations versus multiplicity (errors via Sumw2 - to be improved):
1842  if(fCalculateAllCorrelationsVsM)
1843  {
1844   // 2-p correlations vs M:  
1845   fIntFlowCorrelationsAllVsMPro[0] = new TProfile("two1n1n","#LT#LT2#GT#GT_{n|n}",fnBinsMult,fMinMult,fMaxMult);
1846   fIntFlowCorrelationsAllVsMPro[1] = new TProfile("two2n2n","#LT#LT2#GT#GT_{2n|2n}",fnBinsMult,fMinMult,fMaxMult);
1847   fIntFlowCorrelationsAllVsMPro[2] = new TProfile("two3n3n","#LT#LT2#GT#GT_{3n|3n}",fnBinsMult,fMinMult,fMaxMult);
1848   fIntFlowCorrelationsAllVsMPro[3] = new TProfile("two4n4n","#LT#LT2#GT#GT_{4n|4n}",fnBinsMult,fMinMult,fMaxMult);
1849   // 3-p correlations vs M:
1850   fIntFlowCorrelationsAllVsMPro[5] = new TProfile("three2n1n1n","#LT#LT3#GT#GT_{2n|n,n}",fnBinsMult,fMinMult,fMaxMult);
1851   fIntFlowCorrelationsAllVsMPro[6] = new TProfile("three3n2n1n","#LT#LT3#GT#GT_{3n|2n,n}",fnBinsMult,fMinMult,fMaxMult);
1852   fIntFlowCorrelationsAllVsMPro[7] = new TProfile("three4n2n2n","#LT#LT3#GT#GT_{4n|2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1853   fIntFlowCorrelationsAllVsMPro[8] = new TProfile("three4n3n1n","#LT#LT3#GT#GT_{4n|3n,n}",fnBinsMult,fMinMult,fMaxMult);
1854   // 4-p correlations vs M:
1855   fIntFlowCorrelationsAllVsMPro[10] = new TProfile("four1n1n1n1n","#LT#LT4#GT#GT_{n,n|n,n}",fnBinsMult,fMinMult,fMaxMult);
1856   fIntFlowCorrelationsAllVsMPro[11] = new TProfile("four2n1n2n1n","#LT#LT4#GT#GT_{2n,n|2n,n}",fnBinsMult,fMinMult,fMaxMult);
1857   fIntFlowCorrelationsAllVsMPro[12] = new TProfile("four2n2n2n2n","#LT#LT4#GT#GT_{2n,2n|2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1858   fIntFlowCorrelationsAllVsMPro[13] = new TProfile("four3n1n1n1n","#LT#LT4#GT#GT_{3n|n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1859   fIntFlowCorrelationsAllVsMPro[14] = new TProfile("four3n1n3n1n","#LT#LT4#GT#GT_{3n,n|3n,n}",fnBinsMult,fMinMult,fMaxMult);
1860   fIntFlowCorrelationsAllVsMPro[15] = new TProfile("four3n1n2n2n","#LT#LT4#GT#GT_{3n,n|2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1861   fIntFlowCorrelationsAllVsMPro[16] = new TProfile("four4n2n1n1n","#LT#LT4#GT#GT_{4n|2n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1862   // 5-p correlations vs M:
1863   fIntFlowCorrelationsAllVsMPro[18] = new TProfile("five2n1n1n1n1n","#LT#LT5#GT#GT_{2n,n|n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1864   fIntFlowCorrelationsAllVsMPro[19] = new TProfile("five2n2n2n1n1n","#LT#LT5#GT#GT_{2n,2n|2n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1865   fIntFlowCorrelationsAllVsMPro[20] = new TProfile("five3n1n2n1n1n","#LT#LT5#GT#GT_{3n,n|2n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1866   fIntFlowCorrelationsAllVsMPro[21] = new TProfile("five4n1n1n1n1n","#LT#LT5#GT#GT_{4n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1867   // 6-p correlations vs M:
1868   fIntFlowCorrelationsAllVsMPro[23] = new TProfile("six1n1n1n1n1n1n","#LT#LT6#GT#GT_{n,n,n|n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1869   fIntFlowCorrelationsAllVsMPro[24] = new TProfile("six2n1n1n2n1n1n","#LT#LT6#GT#GT_{2n,n,n|2n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1870   fIntFlowCorrelationsAllVsMPro[25] = new TProfile("six2n2n1n1n1n1n","#LT#LT6#GT#GT_{2n,2n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1871   fIntFlowCorrelationsAllVsMPro[26] = new TProfile("six3n1n1n1n1n1n","#LT#LT6#GT#GT_{3n,n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1872   // 7-p correlations vs M:
1873   fIntFlowCorrelationsAllVsMPro[28] = new TProfile("seven2n1n1n1n1n1n1n","#LT#LT7#GT#GT_{2n,n,n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1874   // 8-p correlations vs M:
1875   fIntFlowCorrelationsAllVsMPro[30] = new TProfile("eight1n1n1n1n1n1n1n1n","#LT#LT8#GT#GT_{n,n,n,n|n,n,n,n}",fnBinsMult,fMinMult,fMaxMult);
1876   // EXTRA correlations vs M for v3{5} study (to be improved - put them in a right order somewhere):
1877   fIntFlowCorrelationsAllVsMPro[32] = new TProfile("four4n2n3n3n","#LT#LT4#GT#GT_{4n,2n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1878   fIntFlowCorrelationsAllVsMPro[33] = new TProfile("five3n3n2n2n2n","#LT#LT5#GT#GT_{3n,3n|2n,2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1879   // EXTRA correlations vs M for Teaney-Yan study (to be improved - put them in a right order somewhere):
1880   fIntFlowCorrelationsAllVsMPro[34] = new TProfile("two5n5n","#LT#LT2#GT#GT_{5n|5n}",fnBinsMult,fMinMult,fMaxMult);
1881   fIntFlowCorrelationsAllVsMPro[35] = new TProfile("two6n6n","#LT#LT2#GT#GT_{6n|6n}",fnBinsMult,fMinMult,fMaxMult);
1882   fIntFlowCorrelationsAllVsMPro[36] = new TProfile("three5n3n2n","#LT#LT3#GT#GT_{5n|3n,2n}",fnBinsMult,fMinMult,fMaxMult);
1883   fIntFlowCorrelationsAllVsMPro[37] = new TProfile("three5n4n1n","#LT#LT3#GT#GT_{5n|4n,1n}",fnBinsMult,fMinMult,fMaxMult);
1884   fIntFlowCorrelationsAllVsMPro[38] = new TProfile("three6n3n3n","#LT#LT3#GT#GT_{6n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1885   fIntFlowCorrelationsAllVsMPro[39] = new TProfile("three6n4n2n","#LT#LT3#GT#GT_{6n|4n,2n}",fnBinsMult,fMinMult,fMaxMult);
1886   fIntFlowCorrelationsAllVsMPro[40] = new TProfile("three6n5n1n","#LT#LT3#GT#GT_{6n|5n,1n}",fnBinsMult,fMinMult,fMaxMult);
1887   fIntFlowCorrelationsAllVsMPro[41] = new TProfile("four6n3n2n1n","#LT#LT4#GT#GT_{6n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1888   fIntFlowCorrelationsAllVsMPro[42] = new TProfile("four3n2n3n2n","#LT#LT4#GT#GT_{3n,2n|3n,2n}",fnBinsMult,fMinMult,fMaxMult);
1889   fIntFlowCorrelationsAllVsMPro[43] = new TProfile("four4n1n3n2n","#LT#LT4#GT#GT_{4n,1n|3n,2n}",fnBinsMult,fMinMult,fMaxMult);
1890   fIntFlowCorrelationsAllVsMPro[44] = new TProfile("four3n3n3n3n","#LT#LT4#GT#GT_{3n,3n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1891   fIntFlowCorrelationsAllVsMPro[45] = new TProfile("four4n2n3n3n","#LT#LT4#GT#GT_{4n,2n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1892   fIntFlowCorrelationsAllVsMPro[46] = new TProfile("four5n1n3n3n","#LT#LT4#GT#GT_{5n,1n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1893   fIntFlowCorrelationsAllVsMPro[47] = new TProfile("four4n2n4n2n","#LT#LT4#GT#GT_{4n,2n|4n,2n}",fnBinsMult,fMinMult,fMaxMult);
1894   fIntFlowCorrelationsAllVsMPro[48] = new TProfile("four5n1n4n2n","#LT#LT4#GT#GT_{5n,1n|4n,2n}",fnBinsMult,fMinMult,fMaxMult);
1895   fIntFlowCorrelationsAllVsMPro[49] = new TProfile("four5n3n1n1n","#LT#LT4#GT#GT_{5n|3n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1896   fIntFlowCorrelationsAllVsMPro[50] = new TProfile("four5n2n2n1n","#LT#LT4#GT#GT_{5n|2n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1897   fIntFlowCorrelationsAllVsMPro[51] = new TProfile("four5n1n5n1n","#LT#LT4#GT#GT_{5n,1n|5n,1n}",fnBinsMult,fMinMult,fMaxMult);
1898   fIntFlowCorrelationsAllVsMPro[52] = new TProfile("five3n3n3n2n1n","#LT#LT5#GT#GT_{3n,3n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1899   fIntFlowCorrelationsAllVsMPro[53] = new TProfile("five4n2n3n2n1n","#LT#LT5#GT#GT_{4n,2n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1900   fIntFlowCorrelationsAllVsMPro[54] = new TProfile("five3n2n3n1n1n","#LT#LT5#GT#GT_{3n,2n|3n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1901   fIntFlowCorrelationsAllVsMPro[55] = new TProfile("five3n2n2n2n1n","#LT#LT5#GT#GT_{3n,2n|2n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1902   fIntFlowCorrelationsAllVsMPro[56] = new TProfile("five5n1n3n2n1n","#LT#LT5#GT#GT_{5n,1n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1903   fIntFlowCorrelationsAllVsMPro[57] = new TProfile("six3n2n1n3n2n1n","#LT#LT6#GT#GT_{3n,2n,1n|3n,2n,1n}",fnBinsMult,fMinMult,fMaxMult);
1904   fIntFlowCorrelationsAllVsMPro[58] = new TProfile("four6n4n1n1n","#LT#LT4#GT#GT_{6n|4n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1905   fIntFlowCorrelationsAllVsMPro[59] = new TProfile("four6n2n2n2n","#LT#LT4#GT#GT_{6n|2n,2n,2n}",fnBinsMult,fMinMult,fMaxMult);
1906   fIntFlowCorrelationsAllVsMPro[60] = new TProfile("five6n2n2n1n1n","#LT#LT5#GT#GT_{6n|2n,2n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1907   fIntFlowCorrelationsAllVsMPro[61] = new TProfile("five4n1n1n3n3n","#LT#LT5#GT#GT_{4n,1n,1n|3n,3n}",fnBinsMult,fMinMult,fMaxMult);
1908   fIntFlowCorrelationsAllVsMPro[62] = new TProfile("six3n3n2n2n1n1n","#LT#LT6#GT#GT_{3n,3n|2n,2n,1n,1n}",fnBinsMult,fMinMult,fMaxMult);
1909   for(Int_t n=0;n<63;n++)
1910   {
1911    if(fIntFlowCorrelationsAllVsMPro[n])
1912    {
1913     fIntFlowCorrelationsAllVsMPro[n]->Sumw2();
1914     fIntFlowCorrelationsAllVsMPro[n]->GetXaxis()->SetTitle("M");  
1915     if(fMultiplicityIsRefMultiplicity){fIntFlowCorrelationsAllVsMPro[n]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");}  
1916     fIntFlowAllCorrelationsVsM->Add(fIntFlowCorrelationsAllVsMPro[n]);
1917    } // end of if(fIntFlowCorrelationsAllVsMPro[n])
1918   } // end of for(Int_t n=0;n<63;n++)
1919  } // end of if(fCalculateAllCorrelationsVsM)
1920  // when particle weights are used some extra correlations appear:
1921  if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights) 
1922  {
1923   TString intFlowExtraCorrelationsProName = "fIntFlowExtraCorrelationsPro";
1924   intFlowExtraCorrelationsProName += fAnalysisLabel->Data();
1925   fIntFlowExtraCorrelationsPro = new TProfile(intFlowExtraCorrelationsProName.Data(),"Average extra correlations for all events",100,0,100,"s");
1926   fIntFlowExtraCorrelationsPro->SetTickLength(-0.01,"Y");
1927   fIntFlowExtraCorrelationsPro->SetMarkerStyle(25);
1928   fIntFlowExtraCorrelationsPro->SetLabelSize(0.03);
1929   fIntFlowExtraCorrelationsPro->SetLabelOffset(0.01,"Y");
1930   // extra 2-p correlations:
1931   (fIntFlowExtraCorrelationsPro->GetXaxis())->SetBinLabel(1,"<<w1^3 w2 cos(n*(phi1-phi2))>>");
1932   (fIntFlowExtraCorrelationsPro->GetXaxis())->SetBinLabel(2,"<<w1 w2 w3^2 cos(n*(phi1-phi2))>>");
1933   fIntFlowProfiles->Add(fIntFlowExtraCorrelationsPro);
1934  } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
1935  // average product of correlations <2>, <4>, <6> and <8>:  
1936  TString productFlag[6] = {"#LT#LT2#GT#LT4#GT#GT","#LT#LT2#GT#LT6#GT#GT","#LT#LT2#GT#LT8#GT#GT",
1937                            "#LT#LT4#GT#LT6#GT#GT","#LT#LT4#GT#LT8#GT#GT","#LT#LT6#GT#LT8#GT#GT"};
1938  TString intFlowProductOfCorrelationsProName = "fIntFlowProductOfCorrelationsPro";
1939  intFlowProductOfCorrelationsProName += fAnalysisLabel->Data();
1940  fIntFlowProductOfCorrelationsPro = new TProfile(intFlowProductOfCorrelationsProName.Data(),"Average products of correlations",6,0,6);
1941  fIntFlowProductOfCorrelationsPro->SetTickLength(-0.01,"Y");
1942  fIntFlowProductOfCorrelationsPro->SetMarkerStyle(25); 
1943  fIntFlowProductOfCorrelationsPro->SetLabelSize(0.05);
1944  fIntFlowProductOfCorrelationsPro->SetLabelOffset(0.01,"Y");
1945  for(Int_t b=0;b<6;b++)
1946  {
1947   (fIntFlowProductOfCorrelationsPro->GetXaxis())->SetBinLabel(b+1,productFlag[b].Data());
1948  }
1949  fIntFlowProfiles->Add(fIntFlowProductOfCorrelationsPro); 
1950  // average product of correlations <2>, <4>, <6> and <8> versus multiplicity
1951  // [0=<<2><4>>,1=<<2><6>>,2=<<2><8>>,3=<<4><6>>,4=<<4><8>>,5=<<6><8>>]  
1952  if(fCalculateCumulantsVsM)
1953  {
1954   TString intFlowProductOfCorrelationsVsMProName = "fIntFlowProductOfCorrelationsVsMPro";
1955   intFlowProductOfCorrelationsVsMProName += fAnalysisLabel->Data();
1956   for(Int_t pi=0;pi<6;pi++)
1957   { 
1958    fIntFlowProductOfCorrelationsVsMPro[pi] = new TProfile(Form("%s, %s",intFlowProductOfCorrelationsVsMProName.Data(),productFlag[pi].Data()),
1959                                                           Form("%s versus multiplicity",productFlag[pi].Data()),
1960                                                           fnBinsMult,fMinMult,fMaxMult);             
1961    fIntFlowProductOfCorrelationsVsMPro[pi]->GetXaxis()->SetTitle("M");
1962    if(fMultiplicityIsRefMultiplicity){fIntFlowProductOfCorrelationsVsMPro[pi]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");}
1963    fIntFlowProfiles->Add(fIntFlowProductOfCorrelationsVsMPro[pi]);
1964   } // end of for(Int_t pi=0;pi<6;pi++)
1965  } // end of if(fCalculateCumulantsVsM) 
1966  // average product of correction terms for NUA:  
1967  TString intFlowProductOfCorrectionTermsForNUAProName = "fIntFlowProductOfCorrectionTermsForNUAPro";
1968  intFlowProductOfCorrectionTermsForNUAProName += fAnalysisLabel->Data();
1969  fIntFlowProductOfCorrectionTermsForNUAPro = new TProfile(intFlowProductOfCorrectionTermsForNUAProName.Data(),"Average products of correction terms for NUA",27,0,27);
1970  fIntFlowProductOfCorrectionTermsForNUAPro->SetTickLength(-0.01,"Y");
1971  fIntFlowProductOfCorrectionTermsForNUAPro->SetMarkerStyle(25); 
1972  fIntFlowProductOfCorrectionTermsForNUAPro->SetLabelSize(0.03);
1973  fIntFlowProductOfCorrectionTermsForNUAPro->SetLabelOffset(0.01,"Y");
1974  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(1,"<<2><cos(#phi)>>");
1975  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(2,"<<2><sin(#phi)>>");
1976  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(3,"<<cos(#phi)><sin(#phi)>>");
1977  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(4,"Cov(<2>,<cos(#phi_{1}+#phi_{2})>)");
1978  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(5,"Cov(<2>,<sin(#phi_{1}+#phi_{2})>)");
1979  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(6,"Cov(<2>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
1980  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(7,"Cov(<2>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
1981  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(8,"Cov(<4>,<cos(#phi)>)");
1982  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(9,"Cov(<4>,<sin(#phi)>)");
1983  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(10,"Cov(<4>,<cos(#phi_{1}+#phi_{2})>)");
1984  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(11,"Cov(<4>,<sin(#phi_{1}+#phi_{2})>)");
1985  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(12,"Cov(<4>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>>)");
1986  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(13,"Cov(<4>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>>)");
1987  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(14,"Cov(<cos(#phi)>,<cos(#phi_{1}+#phi_{2})>)"); 
1988  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(15,"Cov(<cos(#phi)>,<sin(#phi_{1}+#phi_{2})>)");
1989  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(16,"Cov(<cos(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
1990  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(17,"Cov(<cos(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
1991  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(18,"Cov(<sin(#phi)>,<cos(#phi_{1}+#phi_{2})>)");
1992  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(19,"Cov(<sin(#phi)>,<sin(#phi_{1}+#phi_{2})>)");
1993  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(20,"Cov(<sin(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
1994  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(21,"Cov(<sin(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
1995  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(22,"Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}+#phi_{2})>)");
1996  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(23,"Cov(<cos(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
1997  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(24,"Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
1998  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(25,"Cov(<sin(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
1999  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(26,"Cov(<sin(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2000  (fIntFlowProductOfCorrectionTermsForNUAPro->GetXaxis())->SetBinLabel(27,"Cov(<cos(#phi_{1}-#phi_{2}-#phi_{3}>,<sin(#phi_{1}-#phi_{2}-#phi_{3}>)");
2001  fIntFlowProfiles->Add(fIntFlowProductOfCorrectionTermsForNUAPro);
2002  // average correction terms for non-uniform acceptance (with wrong errors!):
2003  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
2004  {
2005   TString intFlowCorrectionTermsForNUAProName = "fIntFlowCorrectionTermsForNUAPro";
2006   intFlowCorrectionTermsForNUAProName += fAnalysisLabel->Data();
2007   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");
2008   fIntFlowCorrectionTermsForNUAPro[sc]->SetTickLength(-0.01,"Y");
2009   fIntFlowCorrectionTermsForNUAPro[sc]->SetMarkerStyle(25);
2010   fIntFlowCorrectionTermsForNUAPro[sc]->SetLabelSize(0.05);
2011   fIntFlowCorrectionTermsForNUAPro[sc]->SetLabelOffset(0.01,"Y");
2012   (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(1,Form("#LT#LT%s(n(#phi_{1}))#GT#GT",sinCosFlag[sc].Data()));
2013   (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(2,Form("#LT#LT%s(n(#phi_{1}+#phi_{2}))#GT#GT",sinCosFlag[sc].Data()));  
2014   (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(3,Form("#LT#LT%s(n(#phi_{1}-#phi_{2}-#phi_{3}))#GT#GT",sinCosFlag[sc].Data()));  
2015   (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(4,Form("#LT#LT%s(n(2#phi_{1}-#phi_{2}))#GT#GT",sinCosFlag[sc].Data()));  
2016   fIntFlowProfiles->Add(fIntFlowCorrectionTermsForNUAPro[sc]);
2017   // versus multiplicity:
2018   if(fCalculateCumulantsVsM)
2019   {
2020    TString correctionTermFlag[4] = {"(n(phi1))","(n(phi1+phi2))","(n(phi1-phi2-phi3))","(n(2phi1-phi2))"}; // to be improved - hardwired 4
2021    for(Int_t ci=0;ci<4;ci++) // correction term index (to be improved - hardwired 4)
2022    {
2023     TString intFlowCorrectionTermsForNUAVsMProName = "fIntFlowCorrectionTermsForNUAVsMPro";
2024     intFlowCorrectionTermsForNUAVsMProName += fAnalysisLabel->Data();
2025     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");
2026     fIntFlowProfiles->Add(fIntFlowCorrectionTermsForNUAVsMPro[sc][ci]);
2027    }
2028   } // end of if(fCalculateCumulantsVsM)
2029  } // end of for(Int_t sc=0;sc<2;sc++) 
2030  
2031  // d) Book histograms holding the final results:
2032  // average correlations <<2>>, <<4>>, <<6>> and <<8>> for all events (with correct errors!):
2033  TString intFlowCorrelationsHistName = "fIntFlowCorrelationsHist";
2034  intFlowCorrelationsHistName += fAnalysisLabel->Data();
2035  fIntFlowCorrelationsHist = new TH1D(intFlowCorrelationsHistName.Data(),"Average correlations for all events",4,0,4);
2036  fIntFlowCorrelationsHist->SetTickLength(-0.01,"Y");
2037  fIntFlowCorrelationsHist->SetMarkerStyle(25);
2038  fIntFlowCorrelationsHist->SetLabelSize(0.06);
2039  fIntFlowCorrelationsHist->SetLabelOffset(0.01,"Y");
2040  (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(1,"#LT#LT2#GT#GT");
2041  (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(2,"#LT#LT4#GT#GT");
2042  (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(3,"#LT#LT6#GT#GT");
2043  (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(4,"#LT#LT8#GT#GT");
2044  fIntFlowResults->Add(fIntFlowCorrelationsHist);
2045  // average correlations <<2>>, <<4>>, <<6>> and <<8>> for all events (with correct errors!) vs M:
2046  if(fCalculateCumulantsVsM)
2047  {
2048   for(Int_t ci=0;ci<4;ci++) // correlation index
2049   {
2050    TString intFlowCorrelationsVsMHistName = "fIntFlowCorrelationsVsMHist";
2051    intFlowCorrelationsVsMHistName += fAnalysisLabel->Data();
2052    fIntFlowCorrelationsVsMHist[ci] = new TH1D(Form("%s, %s",intFlowCorrelationsVsMHistName.Data(),correlationFlag[ci].Data()),
2053                                               Form("%s vs multiplicity",correlationFlag[ci].Data()),
2054                                               fnBinsMult,fMinMult,fMaxMult);                                            
2055    fIntFlowCorrelationsVsMHist[ci]->GetYaxis()->SetTitle(correlationFlag[ci].Data());
2056    fIntFlowCorrelationsVsMHist[ci]->GetXaxis()->SetTitle("M");
2057    if(fMultiplicityIsRefMultiplicity){fIntFlowCorrelationsVsMHist[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");}
2058    fIntFlowResults->Add(fIntFlowCorrelationsVsMHist[ci]);
2059   } // end of for(Int_t ci=0;ci<4;ci++) // correlation index   
2060  } // end of if(fCalculateCumulantsVsM) 
2061  // average all correlations for all events (with correct errors!):
2062  TString intFlowCorrelationsAllHistName = "fIntFlowCorrelationsAllHist";
2063  intFlowCorrelationsAllHistName += fAnalysisLabel->Data();
2064  fIntFlowCorrelationsAllHist = new TH1D(intFlowCorrelationsAllHistName.Data(),"Average correlations for all events",34,0,34);
2065  fIntFlowCorrelationsAllHist->SetTickLength(-0.01,"Y");
2066  fIntFlowCorrelationsAllHist->SetMarkerStyle(25);
2067  fIntFlowCorrelationsAllHist->SetLabelSize(0.03);
2068  fIntFlowCorrelationsAllHist->SetLabelOffset(0.01,"Y");
2069  // 2-p correlations:
2070  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(1,"<<2>>_{n|n}");
2071  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(2,"<<2>>_{2n|2n}");
2072  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(3,"<<2>>_{3n|3n}");
2073  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(4,"<<2>>_{4n|4n}");
2074  // 3-p correlations:
2075  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(6,"<<3>>_{2n|n,n}");
2076  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(7,"<<3>>_{3n|2n,n}");
2077  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(8,"<<3>>_{4n|2n,2n}");
2078  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(9,"<<3>>_{4n|3n,n}");
2079  // 4-p correlations:
2080  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(11,"<<4>>_{n,n|n,n}"); 
2081  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(12,"<<4>>_{2n,n|2n,n}");
2082  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(13,"<<4>>_{2n,2n|2n,2n}");
2083  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(14,"<<4>>_{3n|n,n,n}");
2084  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(15,"<<4>>_{3n,n|3n,n}");
2085  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(16,"<<4>>_{3n,n|2n,2n}"); 
2086  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(17,"<<4>>_{4n|2n,n,n}");
2087  // 5-p correlations:
2088  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(19,"<<5>>_{2n|n,n,n,n}"); 
2089  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(20,"<<5>>_{2n,2n|2n,n,n}");
2090  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(21,"<<5>>_{3n,n|2n,n,n}");
2091  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(22,"<<5>>_{4n|n,n,n,n}");
2092  // 6-p correlations:
2093  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(24,"<<6>>_{n,n,n|n,n,n}");
2094  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(25,"<<6>>_{2n,n,n|2n,n,n}");
2095  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(26,"<<6>>_{2n,2n|n,n,n,n}");
2096  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(27,"<<6>>_{3n,n|n,n,n,n}");
2097  // 7-p correlations:  
2098  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(29,"<<7>>_{2n,n,n|n,n,n,n}");
2099  // 8-p correlations:
2100  (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(31,"<<8>>_{n,n,n,n|n,n,n,n}");
2101  fIntFlowResults->Add(fIntFlowCorrelationsAllHist);
2102  // average correction terms for non-uniform acceptance (with correct errors!):
2103  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
2104  {
2105   TString intFlowCorrectionTermsForNUAHistName = "fIntFlowCorrectionTermsForNUAHist";
2106   intFlowCorrectionTermsForNUAHistName += fAnalysisLabel->Data();
2107   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);
2108   fIntFlowCorrectionTermsForNUAHist[sc]->SetTickLength(-0.01,"Y");
2109   fIntFlowCorrectionTermsForNUAHist[sc]->SetMarkerStyle(25);
2110   fIntFlowCorrectionTermsForNUAHist[sc]->SetLabelSize(0.05);
2111   fIntFlowCorrectionTermsForNUAHist[sc]->SetLabelOffset(0.01,"Y");
2112   (fIntFlowCorrectionTermsForNUAHist[sc]->GetXaxis())->SetBinLabel(1,Form("#LT#LT%s(n(#phi_{1}))#GT#GT",sinCosFlag[sc].Data()));
2113   (fIntFlowCorrectionTermsForNUAHist[sc]->GetXaxis())->SetBinLabel(2,Form("#LT#LT%s(n(#phi_{1}+#phi_{2}))#GT#GT",sinCosFlag[sc].Data()));  
2114   (fIntFlowCorrectionTermsForNUAHist[sc]->GetXaxis())->SetBinLabel(3,Form("#LT#LT%s(n(#phi_{1}-#phi_{2}-#phi_{3}))#GT#GT",sinCosFlag[sc].Data()));  
2115   (fIntFlowCorrectionTermsForNUAHist[sc]->GetXaxis())->SetBinLabel(4,Form("#LT#LT%s(n(2#phi_{1}-#phi_{2}))#GT#GT",sinCosFlag[sc].Data()));   
2116   fIntFlowResults->Add(fIntFlowCorrectionTermsForNUAHist[sc]);
2117  } // end of for(Int_t sc=0;sc<2;sc++) 
2118  // covariances (multiplied with weight dependent prefactor):
2119  TString intFlowCovariancesName = "fIntFlowCovariances";
2120  intFlowCovariancesName += fAnalysisLabel->Data();
2121  fIntFlowCovariances = new TH1D(intFlowCovariancesName.Data(),"Covariances (multiplied with weight dependent prefactor)",6,0,6);
2122  fIntFlowCovariances->SetLabelSize(0.04);
2123  fIntFlowCovariances->SetMarkerStyle(25);
2124  (fIntFlowCovariances->GetXaxis())->SetBinLabel(1,"Cov(#LT2#GT,#LT4#GT)");
2125  (fIntFlowCovariances->GetXaxis())->SetBinLabel(2,"Cov(#LT2#GT,#LT6#GT)");
2126  (fIntFlowCovariances->GetXaxis())->SetBinLabel(3,"Cov(#LT2#GT,#LT8#GT)");
2127  (fIntFlowCovariances->GetXaxis())->SetBinLabel(4,"Cov(#LT4#GT,#LT6#GT)");
2128  (fIntFlowCovariances->GetXaxis())->SetBinLabel(5,"Cov(#LT4#GT,#LT8#GT)");
2129  (fIntFlowCovariances->GetXaxis())->SetBinLabel(6,"Cov(#LT6#GT,#LT8#GT)");  
2130  fIntFlowResults->Add(fIntFlowCovariances);
2131  // sum of linear and quadratic event weights for <2>, <4>, <6> and <8>:
2132  TString intFlowSumOfEventWeightsName = "fIntFlowSumOfEventWeights";
2133  intFlowSumOfEventWeightsName += fAnalysisLabel->Data();
2134  for(Int_t power=0;power<2;power++)
2135  {
2136   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);
2137   fIntFlowSumOfEventWeights[power]->SetLabelSize(0.04);
2138   fIntFlowSumOfEventWeights[power]->SetMarkerStyle(25);
2139   if(power == 0)
2140   {
2141    (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{#LT2#GT}");
2142    (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{#LT4#GT}");
2143    (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{#LT6#GT}");
2144    (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{#LT8#GT}");
2145   } else if (power == 1) 
2146     {
2147      (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{#LT2#GT}^{2}");
2148      (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{#LT4#GT}^{2}");
2149      (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{#LT6#GT}^{2}");
2150      (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{#LT8#GT}^{2}");
2151     }
2152   fIntFlowResults->Add(fIntFlowSumOfEventWeights[power]);
2153  } 
2154  // sum of products of event weights for correlations <2>, <4>, <6> and <8>:  
2155  TString intFlowSumOfProductOfEventWeightsName = "fIntFlowSumOfProductOfEventWeights";
2156  intFlowSumOfProductOfEventWeightsName += fAnalysisLabel->Data();
2157  fIntFlowSumOfProductOfEventWeights = new TH1D(intFlowSumOfProductOfEventWeightsName.Data(),"Sum of product of event weights for correlations",6,0,6);
2158  fIntFlowSumOfProductOfEventWeights->SetLabelSize(0.04);
2159  fIntFlowSumOfProductOfEventWeights->SetMarkerStyle(25);
2160  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LT4#GT}");
2161  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LT6#GT}");
2162  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LT8#GT}");
2163  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LT6#GT}");
2164  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(5,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LT8#GT}");
2165  (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(6,"#sum_{i=1}^{N} w_{#LT6#GT} w_{#LT8#GT}");
2166  fIntFlowResults->Add(fIntFlowSumOfProductOfEventWeights);
2167  // final result for covariances of correlations (multiplied with weight dependent prefactor) versus M
2168  // [0=Cov(2,4),1=Cov(2,6),2=Cov(2,8),3=Cov(4,6),4=Cov(4,8),5=Cov(6,8)]:
2169  if(fCalculateCumulantsVsM)
2170  {
2171   TString intFlowCovariancesVsMName = "fIntFlowCovariancesVsM";
2172   intFlowCovariancesVsMName += fAnalysisLabel->Data();
2173   TString covarianceFlag[6] = {"Cov(<2>,<4>)","Cov(<2>,<6>)","Cov(<2>,<8>)","Cov(<4>,<6>)","Cov(<4>,<8>)","Cov(<6>,<8>)"};
2174   for(Int_t ci=0;ci<6;ci++)
2175   {
2176    fIntFlowCovariancesVsM[ci] = new TH1D(Form("%s, %s",intFlowCovariancesVsMName.Data(),covarianceFlag[ci].Data()),
2177                                          Form("%s vs multiplicity",covarianceFlag[ci].Data()),
2178                                          fnBinsMult,fMinMult,fMaxMult);
2179    fIntFlowCovariancesVsM[ci]->GetYaxis()->SetTitle(covarianceFlag[ci].Data());
2180    fIntFlowCovariancesVsM[ci]->GetXaxis()->SetTitle("M");
2181    if(fMultiplicityIsRefMultiplicity){fIntFlowCovariancesVsM[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");}
2182    fIntFlowResults->Add(fIntFlowCovariancesVsM[ci]);
2183   }
2184  } // end of if(fCalculateCumulantsVsM) 
2185  // sum of linear and quadratic event weights for <2>, <4>, <6> and <8> versus multiplicity
2186  // [0=sum{w_{<2>}},1=sum{w_{<4>}},2=sum{w_{<6>}},3=sum{w_{<8>}}][0=linear 1,1=quadratic]:
2187  if(fCalculateCumulantsVsM)
2188  {
2189   TString intFlowSumOfEventWeightsVsMName = "fIntFlowSumOfEventWeightsVsM";
2190   intFlowSumOfEventWeightsVsMName += fAnalysisLabel->Data();
2191   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>}"},
2192                            {"#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}"}};
2193   for(Int_t si=0;si<4;si++)
2194   {
2195    for(Int_t power=0;power<2;power++)
2196    {
2197     fIntFlowSumOfEventWeightsVsM[si][power] = new TH1D(Form("%s, %s",intFlowSumOfEventWeightsVsMName.Data(),sumFlag[power][si].Data()),
2198                                                        Form("%s vs multiplicity",sumFlag[power][si].Data()),
2199                                                        fnBinsMult,fMinMult,fMaxMult);    
2200     fIntFlowSumOfEventWeightsVsM[si][power]->GetYaxis()->SetTitle(sumFlag[power][si].Data());  
2201     fIntFlowSumOfEventWeightsVsM[si][power]->GetXaxis()->SetTitle("M"); 
2202     if(fMultiplicityIsRefMultiplicity){fIntFlowSumOfEventWeightsVsM[si][power]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");} 
2203     fIntFlowResults->Add(fIntFlowSumOfEventWeightsVsM[si][power]);
2204    } // end of for(Int_t power=0;power<2;power++)
2205   } // end of for(Int_t si=0;si<4;si++)   
2206  } // end of if(fCalculateCumulantsVsM)
2207  // sum of products of event weights for correlations <2>, <4>, <6> and <8> vs M
2208  // [0=sum{w_{<2>}w_{<4>}},1=sum{w_{<2>}w_{<6>}},2=sum{w_{<2>}w_{<8>}},
2209  //  3=sum{w_{<4>}w_{<6>}},4=sum{w_{<4>}w_{<8>}},5=sum{w_{<6>}w_{<8>}}]:  
2210  if(fCalculateCumulantsVsM)
2211  {
2212   TString intFlowSumOfProductOfEventWeightsVsMName = "fIntFlowSumOfProductOfEventWeightsVsM";
2213   intFlowSumOfProductOfEventWeightsVsMName += fAnalysisLabel->Data();
2214   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>}",
2215                           "#sum_{i=1}^{N} w_{<4>} w_{<6>}","#sum_{i=1}^{N} w_{<4>} w_{<8>}","#sum_{i=1}^{N} w_{<6>} w_{<8>}"}; 
2216   for(Int_t pi=0;pi<6;pi++)
2217   {
2218    fIntFlowSumOfProductOfEventWeightsVsM[pi] = new TH1D(Form("%s, %s",intFlowSumOfProductOfEventWeightsVsMName.Data(),sopowFlag[pi].Data()),
2219                                                         Form("%s versus multiplicity",sopowFlag[pi].Data()),
2220                                                         fnBinsMult,fMinMult,fMaxMult); 
2221    fIntFlowSumOfProductOfEventWeightsVsM[pi]->GetXaxis()->SetTitle("M");
2222    if(fMultiplicityIsRefMultiplicity){fIntFlowSumOfProductOfEventWeightsVsM[pi]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");}
2223    fIntFlowSumOfProductOfEventWeightsVsM[pi]->GetYaxis()->SetTitle(sopowFlag[pi].Data()); 
2224    fIntFlowResults->Add(fIntFlowSumOfProductOfEventWeightsVsM[pi]);
2225   } // end of for(Int_t pi=0;pi<6;pi++) 
2226  } // end of if(fCalculateCumulantsVsM)
2227  // covariances of NUA terms (multiplied with weight dependent prefactor):
2228  TString intFlowCovariancesNUAName = "fIntFlowCovariancesNUA";
2229  intFlowCovariancesNUAName += fAnalysisLabel->Data();
2230  fIntFlowCovariancesNUA = new TH1D(intFlowCovariancesNUAName.Data(),"Covariances for NUA (multiplied with weight dependent prefactor)",27,0,27);
2231  fIntFlowCovariancesNUA->SetLabelSize(0.04);
2232  fIntFlowCovariancesNUA->SetMarkerStyle(25);
2233  fIntFlowCovariancesNUA->GetXaxis()->SetLabelSize(0.02);
2234  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(1,"Cov(<2>,<cos(#phi)>");
2235  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(2,"Cov(<2>,<sin(#phi)>)");
2236  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(3,"Cov(<cos(#phi)>,<sin(#phi)>)");
2237  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(4,"Cov(<2>,<cos(#phi_{1}+#phi_{2})>)");
2238  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(5,"Cov(<2>,<sin(#phi_{1}+#phi_{2})>)");
2239  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(6,"Cov(<2>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2240  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(7,"Cov(<2>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2241  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(8,"Cov(<4>,<cos(#phi)>)");
2242  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(9,"Cov(<4>,<sin(#phi)>)");
2243  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(10,"Cov(<4>,<cos(#phi_{1}+#phi_{2})>)");
2244  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(11,"Cov(<4>,<sin(#phi_{1}+#phi_{2})>)");
2245  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(12,"Cov(<4>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>>)");
2246  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(13,"Cov(<4>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>>)");
2247  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(14,"Cov(<cos(#phi)>,<cos(#phi_{1}+#phi_{2})>)"); 
2248  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(15,"Cov(<cos(#phi)>,<sin(#phi_{1}+#phi_{2})>)");
2249  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(16,"Cov(<cos(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2250  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(17,"Cov(<cos(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2251  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(18,"Cov(<sin(#phi)>,<cos(#phi_{1}+#phi_{2})>)");
2252  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(19,"Cov(<sin(#phi)>,<sin(#phi_{1}+#phi_{2})>)");
2253  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(20,"Cov(<sin(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2254  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(21,"Cov(<sin(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2255  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(22,"Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}+#phi_{2})>)");
2256  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(23,"Cov(<cos(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2257  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(24,"Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2258  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(25,"Cov(<sin(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)");
2259  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(26,"Cov(<sin(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)");
2260  (fIntFlowCovariancesNUA->GetXaxis())->SetBinLabel(27,"Cov(<cos(#phi_{1}-#phi_{2}-#phi_{3}>,<sin(#phi_{1}-#phi_{2}-#phi_{3}>)");
2261  fIntFlowResults->Add(fIntFlowCovariancesNUA);
2262  // sum of linear and quadratic event weights for NUA terms:
2263  TString intFlowSumOfEventWeightsNUAName = "fIntFlowSumOfEventWeightsNUA";
2264  intFlowSumOfEventWeightsNUAName += fAnalysisLabel->Data();
2265  for(Int_t sc=0;sc<2;sc++)
2266  {
2267   for(Int_t power=0;power<2;power++)
2268   {
2269    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
2270    fIntFlowSumOfEventWeightsNUA[sc][power]->SetLabelSize(0.05);
2271    fIntFlowSumOfEventWeightsNUA[sc][power]->SetMarkerStyle(25);
2272    if(power == 0)
2273    {
2274     (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(1,Form("#sum_{i=1}^{N} w_{<%s(#phi)>}",sinCosFlag[sc].Data()));
2275     (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(2,Form("#sum_{i=1}^{N} w_{<%s(#phi_{1}+#phi_{2})>}",sinCosFlag[sc].Data()));
2276     (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(3,Form("#sum_{i=1}^{N} w_{<%s(#phi_{1}-#phi_{2}-#phi_{3})>}",sinCosFlag[sc].Data()));   
2277     (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(4,Form("#sum_{i=1}^{N} w_{<%s(2#phi_{1}-#phi_{2})>}",sinCosFlag[sc].Data()));
2278    } else if(power == 1) 
2279      {
2280       (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(1,Form("#sum_{i=1}^{N} w_{<%s(#phi)>}^{2}",sinCosFlag[sc].Data()));
2281       (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(2,Form("#sum_{i=1}^{N} w_{<%s(#phi_{1}+#phi_{2})>}^{2}",sinCosFlag[sc].Data()));
2282       (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(3,Form("#sum_{i=1}^{N} w_{<%s(#phi_{1}-#phi_{2}-#phi_{3})>}^{2}",sinCosFlag[sc].Data()));
2283       (fIntFlowSumOfEventWeightsNUA[sc][power]->GetXaxis())->SetBinLabel(4,Form("#sum_{i=1}^{N} w_{<%s(2#phi_{1}-#phi_{2})>}^{2}",sinCosFlag[sc].Data()));
2284      }
2285    fIntFlowResults->Add(fIntFlowSumOfEventWeightsNUA[sc][power]);
2286   }
2287  }  
2288  // sum of products of event weights for NUA terms:  
2289  TString intFlowSumOfProductOfEventWeightsNUAName = "fIntFlowSumOfProductOfEventWeightsNUA";
2290  intFlowSumOfProductOfEventWeightsNUAName += fAnalysisLabel->Data();
2291  fIntFlowSumOfProductOfEventWeightsNUA = new TH1D(intFlowSumOfProductOfEventWeightsNUAName.Data(),"Sum of product of event weights for NUA terms",27,0,27);
2292  fIntFlowSumOfProductOfEventWeightsNUA->SetLabelSize(0.02);
2293  fIntFlowSumOfProductOfEventWeightsNUA->SetMarkerStyle(25);
2294  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTcos(#phi)#GT}");
2295  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTsin(#phi)#GT}");
2296  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTsin(#phi)#GT}");
2297  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTcos(#phi_{1}+#phi_{2})#GT}");
2298  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(5,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2299  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(6,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2300  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(7,"#sum_{i=1}^{N} w_{#LT2#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2301  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(8,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTcos(#phi)#GT}");
2302  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(9,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTsin(#phi)#GT}");
2303  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(10,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTcos(#phi_{1}+#phi_{2})#GT}");
2304  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(11,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2305  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(12,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2306  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(13,"#sum_{i=1}^{N} w_{#LT4#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2307  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(14,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTcos(#phi_{1}+#phi_{2})#GT}");
2308  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(15,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2309  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(16,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2310  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(17,"#sum_{i=1}^{N} w_{#LTcos(#phi)#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2311  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(18,"#sum_{i=1}^{N} w_{#LTsin(#phi)#GT} w_{#LTcos(#phi_{1}+#phi_{2})#GT}");
2312  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(19,"#sum_{i=1}^{N} w_{#LTsin(#phi)#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2313  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(20,"#sum_{i=1}^{N} w_{#LTsin(#phi)#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2314  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(21,"#sum_{i=1}^{N} w_{#LTsin(#phi)#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2315  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(22,"#sum_{i=1}^{N} w_{#LTcos(#phi_{1}+#phi_{2})#GT} w_{#LTsin(#phi_{1}+#phi_{2})#GT}");
2316  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(23,"#sum_{i=1}^{N} w_{#LTcos(#phi_{1}+#phi_{2})#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2317  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(24,"#sum_{i=1}^{N} w_{#LTcos(#phi_{1}+#phi_{2})#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2318  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(25,"#sum_{i=1}^{N} w_{#LTsin(#phi_{1}+#phi_{2})#GT} w_{#LTcos(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2319  (fIntFlowSumOfProductOfEventWeightsNUA->GetXaxis())->SetBinLabel(26,"#sum_{i=1}^{N} w_{#LTsin(#phi_{1}+#phi_{2})#GT} w_{#LTsin(#phi_{1}-#phi_{2}-#phi_{3})#GT}");
2320  (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}");
2321  fIntFlowResults->Add(fIntFlowSumOfProductOfEventWeightsNUA);
2322  // Final results for reference Q-cumulants:
2323  TString cumulantFlag[4] = {"QC{2}","QC{4}","QC{6}","QC{8}"};
2324  TString intFlowQcumulantsName = "fIntFlowQcumulants";
2325  intFlowQcumulantsName += fAnalysisLabel->Data();
2326  fIntFlowQcumulants = new TH1D(intFlowQcumulantsName.Data(),"Reference Q-cumulants",4,0,4);
2327  if(fPropagateErrorAlsoFromNIT)
2328  {
2329   fIntFlowQcumulants->SetTitle("Reference Q-cumulants (error from non-isotropic terms also propagated)");
2330  }
2331  fIntFlowQcumulants->SetLabelSize(0.05);
2332  fIntFlowQcumulants->SetMarkerStyle(25);
2333  for(Int_t b=0;b<4;b++)
2334  {
2335   (fIntFlowQcumulants->GetXaxis())->SetBinLabel(b+1,cumulantFlag[b].Data());
2336  } 
2337  fIntFlowResults->Add(fIntFlowQcumulants);
2338  // Final results for reference Q-cumulants rebinned in M: 
2339  if(fCalculateCumulantsVsM)
2340  {
2341   TString intFlowQcumulantsRebinnedInMName = "fIntFlowQcumulantsRebinnedInM";
2342   intFlowQcumulantsRebinnedInMName += fAnalysisLabel->Data();
2343   fIntFlowQcumulantsRebinnedInM = new TH1D(intFlowQcumulantsRebinnedInMName.Data(),"Reference Q-cumulants rebinned in M",4,0,4);
2344   fIntFlowQcumulantsRebinnedInM->SetLabelSize(0.05);
2345   fIntFlowQcumulantsRebinnedInM->SetMarkerStyle(25);
2346   for(Int_t b=0;b<4;b++)
2347   {
2348    (fIntFlowQcumulantsRebinnedInM->GetXaxis())->SetBinLabel(b+1,cumulantFlag[b].Data());
2349   } 
2350   fIntFlowResults->Add(fIntFlowQcumulantsRebinnedInM);
2351  } // end of if(fCalculateCumulantsVsM) 
2352  // Ratio between error squared: with/without non-isotropic terms:
2353  TString intFlowQcumulantsErrorSquaredRatioName = "fIntFlowQcumulantsErrorSquaredRatio";
2354  intFlowQcumulantsErrorSquaredRatioName += fAnalysisLabel->Data();
2355  fIntFlowQcumulantsErrorSquaredRatio = new TH1D(intFlowQcumulantsErrorSquaredRatioName.Data(),"Error squared of reference Q-cumulants: #frac{with NUA terms}{without NUA terms}",4,0,4);
2356  fIntFlowQcumulantsErrorSquaredRatio->SetLabelSize(0.05);
2357  fIntFlowQcumulantsErrorSquaredRatio->SetMarkerStyle(25);
2358  for(Int_t b=0;b<4;b++)
2359  {
2360   (fIntFlowQcumulantsErrorSquaredRatio->GetXaxis())->SetBinLabel(b+1,cumulantFlag[b].Data());
2361  } 
2362  fIntFlowResults->Add(fIntFlowQcumulantsErrorSquaredRatio);
2363  // final results for integrated Q-cumulants versus multiplicity:
2364  if(fCalculateCumulantsVsM)
2365  {
2366   TString intFlowQcumulantsVsMName = "fIntFlowQcumulantsVsM";
2367   intFlowQcumulantsVsMName += fAnalysisLabel->Data();
2368   for(Int_t co=0;co<4;co++) // cumulant order
2369   {
2370    fIntFlowQcumulantsVsM[co] = new TH1D(Form("%s, %s",intFlowQcumulantsVsMName.Data(),cumulantFlag[co].Data()),
2371                                         Form("%s vs multiplicity",cumulantFlag[co].Data()),
2372                                         fnBinsMult,fMinMult,fMaxMult);
2373    fIntFlowQcumulantsVsM[co]->GetXaxis()->SetTitle("M"); 
2374    if(fMultiplicityIsRefMultiplicity){fIntFlowQcumulantsVsM[co]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");}                                    
2375    fIntFlowQcumulantsVsM[co]->GetYaxis()->SetTitle(cumulantFlag[co].Data());  
2376    fIntFlowResults->Add(fIntFlowQcumulantsVsM[co]);                                    
2377   } // end of for(Int_t co=0;co<4;co++) // cumulant order
2378  } // end of if(fCalculateCumulantsVsM)
2379  // final integrated flow estimates from Q-cumulants:
2380  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)};
2381  TString intFlowName = "fIntFlow";
2382  intFlowName += fAnalysisLabel->Data();  
2383  // integrated flow from Q-cumulants:
2384  fIntFlow = new TH1D(intFlowName.Data(),"Reference flow estimates from Q-cumulants",4,0,4);
2385  fIntFlow->SetLabelSize(0.05);
2386  fIntFlow->SetMarkerStyle(25);
2387  for(Int_t b=0;b<4;b++)
2388  {
2389   (fIntFlow->GetXaxis())->SetBinLabel(b+1,flowFlag[b].Data()); 
2390  }
2391  fIntFlowResults->Add(fIntFlow); 
2392  // Reference flow vs M rebinned in one huge bin:
2393  if(fCalculateCumulantsVsM)
2394  { 
2395   TString intFlowRebinnedInMName = "fIntFlowRebinnedInM";
2396   intFlowRebinnedInMName += fAnalysisLabel->Data();  
2397   fIntFlowRebinnedInM = new TH1D(intFlowRebinnedInMName.Data(),"Reference flow estimates from Q-cumulants (rebinned in M)",4,0,4);
2398   fIntFlowRebinnedInM->SetLabelSize(0.05);
2399   fIntFlowRebinnedInM->SetMarkerStyle(25);
2400   for(Int_t b=0;b<4;b++)
2401   {
2402    (fIntFlowRebinnedInM->GetXaxis())->SetBinLabel(b+1,flowFlag[b].Data()); 
2403   }
2404   fIntFlowResults->Add(fIntFlowRebinnedInM); 
2405  } 
2406  // integrated flow from Q-cumulants: versus multiplicity:
2407  if(fCalculateCumulantsVsM)
2408  {
2409   TString intFlowVsMName = "fIntFlowVsM";
2410   intFlowVsMName += fAnalysisLabel->Data();
2411   for(Int_t co=0;co<4;co++) // cumulant order
2412   {
2413    fIntFlowVsM[co] = new TH1D(Form("%s, %s",intFlowVsMName.Data(),flowFlag[co].Data()),
2414                               Form("%s vs multiplicity",flowFlag[co].Data()),
2415                               fnBinsMult,fMinMult,fMaxMult);
2416    fIntFlowVsM[co]->GetXaxis()->SetTitle("M");
2417    if(fMultiplicityIsRefMultiplicity){fIntFlowVsM[co]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");}                                      
2418    fIntFlowVsM[co]->GetYaxis()->SetTitle(flowFlag[co].Data());  
2419    fIntFlowResults->Add(fIntFlowVsM[co]);                                    
2420   } // end of for(Int_t co=0;co<4;co++) // cumulant order
2421  } // end of if(fCalculateCumulantsVsM)
2422  // quantifying detector effects effects to correlations:
2423  TString intFlowDetectorBiasName = "fIntFlowDetectorBias";
2424  intFlowDetectorBiasName += fAnalysisLabel->Data();  
2425  fIntFlowDetectorBias = new TH1D(intFlowDetectorBiasName.Data(),"Quantifying detector bias",4,0,4);
2426  fIntFlowDetectorBias->SetLabelSize(0.05);
2427  fIntFlowDetectorBias->SetMarkerStyle(25);
2428  for(Int_t ci=0;ci<4;ci++)
2429  {  
2430   (fIntFlowDetectorBias->GetXaxis())->SetBinLabel(ci+1,Form("#frac{corrected}{measured} %s",cumulantFlag[ci].Data()));
2431  }
2432  fIntFlowResults->Add(fIntFlowDetectorBias); 
2433  // quantifying detector effects to correlations versus multiplicity:
2434  if(fCalculateCumulantsVsM)
2435  {
2436   TString intFlowDetectorBiasVsMName = "fIntFlowDetectorBiasVsM";
2437   intFlowDetectorBiasVsMName += fAnalysisLabel->Data();
2438   for(Int_t ci=0;ci<4;ci++) // correlation index
2439   {
2440    fIntFlowDetectorBiasVsM[ci] = new TH1D(Form("%s for %s",intFlowDetectorBiasVsMName.Data(),cumulantFlag[ci].Data()),
2441                                           Form("Quantifying detector bias for %s vs multiplicity",cumulantFlag[ci].Data()),
2442                                           fnBinsMult,fMinMult,fMaxMult);
2443    fIntFlowDetectorBiasVsM[ci]->GetXaxis()->SetTitle("M");    
2444    if(fMultiplicityIsRefMultiplicity){fIntFlowDetectorBiasVsM[ci]->GetXaxis()->SetTitle("Reference multiplicity (from ESD)");}                                 
2445    fIntFlowDetectorBiasVsM[ci]->GetYaxis()->SetTitle("#frac{corrected}{measured}");  
2446    fIntFlowResults->Add(fIntFlowDetectorBiasVsM[ci]);                                    
2447   } // end of for(Int_t co=0;co<4;co++) // cumulant order
2448  } // end of if(fCalculateCumulantsVsM)
2449    
2450 } // end of AliFlowAnalysisWithQCumulants::BookEverythingForIntegratedFlow()
2451
2452 //=======================================================================================================================
2453
2454 void AliFlowAnalysisWithQCumulants::BookEverythingForMixedHarmonics()
2455 {
2456  // Book all objects for mixed harmonics.
2457
2458  // a) Book profile to hold all flags for mixed harmonics;
2459  // b) Book all objects in TList fMixedHarmonicsProfiles;
2460  // c) Book all objects in TList fMixedHarmonicsResults;
2461  // d) Book all objects in TList fMixedHarmonicsErrorPropagation.
2462
2463  // a) Book profile to hold all flags for mixed harmonics:
2464  TString mixedHarmonicsFlagsName = "fMixedHarmonicsFlags";
2465  mixedHarmonicsFlagsName += fAnalysisLabel->Data();
2466  fMixedHarmonicsFlags = new TProfile(mixedHarmonicsFlagsName.Data(),"Flags for Mixed Harmonics",4,0,4);
2467  fMixedHarmonicsFlags->SetTickLength(-0.01,"Y");
2468  fMixedHarmonicsFlags->SetMarkerStyle(25);
2469  fMixedHarmonicsFlags->SetLabelSize(0.04);
2470  fMixedHarmonicsFlags->SetLabelOffset(0.02,"Y");
2471  fMixedHarmonicsFlags->SetStats(kFALSE);
2472  fMixedHarmonicsFlags->GetXaxis()->SetBinLabel(1,"Calculate Mixed Harmonics");
2473  fMixedHarmonicsFlags->GetXaxis()->SetBinLabel(2,"Generic Harmonic");
2474  fMixedHarmonicsFlags->GetXaxis()->SetBinLabel(3,"Calculate vs Multiplicity");
2475  fMixedHarmonicsFlags->GetXaxis()->SetBinLabel(4,"Multiplicity Weight");
2476  fMixedHarmonicsList->Add(fMixedHarmonicsFlags);
2477
2478  if(!fCalculateMixedHarmonics){return;}
2479
2480  // b) Book all objects in TList fMixedHarmonicsProfiles:
2481  //  b1) 2-p correlations:
2482  TString s2pCorrelationsName = "f2pCorrelations";
2483  s2pCorrelationsName += fAnalysisLabel->Data();
2484  f2pCorrelations = new TProfile(s2pCorrelationsName.Data(),Form("2-particle correlations (n = %d)",fHarmonic),6,0,6,"s");
2485  f2pCorrelations->SetTickLength(-0.01,"Y");
2486  f2pCorrelations->SetMarkerStyle(25);
2487  f2pCorrelations->SetLabelSize(0.04);
2488  f2pCorrelations->SetLabelOffset(0.02,"Y");
2489  f2pCorrelations->SetStats(kFALSE);
2490  f2pCorrelations->Sumw2();
2491  f2pCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT2#GT#GT_{%dn|%dn}",1*fHarmonic,1*fHarmonic));
2492  f2pCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT2#GT#GT_{%dn|%dn}",2*fHarmonic,2*fHarmonic));
2493  f2pCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT2#GT#GT_{%dn|%dn}",3*fHarmonic,3*fHarmonic));
2494  f2pCorrelations->GetXaxis()->SetBinLabel(4,Form("#LT#LT2#GT#GT_{%dn|%dn}",4*fHarmonic,4*fHarmonic));
2495  f2pCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT2#GT#GT_{%dn|%dn}",5*fHarmonic,5*fHarmonic));
2496  f2pCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT2#GT#GT_{%dn|%dn}",6*fHarmonic,6*fHarmonic));
2497  fMixedHarmonicsProfiles->Add(f2pCorrelations);
2498  //  b2) 3-p correlations (3+6):
2499  TString s3pCorrelationsName = "f3pCorrelations";
2500  s3pCorrelationsName += fAnalysisLabel->Data();
2501  f3pCorrelations = new TProfile(s3pCorrelationsName.Data(),Form("3-particle correlations (n = %d)",fHarmonic),10,0,10,"s"); 
2502  f3pCorrelations->SetTickLength(-0.01,"Y");
2503  f3pCorrelations->SetMarkerStyle(25);
2504  f3pCorrelations->SetLabelSize(0.04);
2505  f3pCorrelations->SetLabelOffset(0.02,"Y");
2506  f3pCorrelations->SetStats(kFALSE);
2507  f3pCorrelations->Sumw2();
2508  // 3-p correlations sensitive to two distinct harmonics (3):
2509  f3pCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic));
2510  f3pCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic));
2511  f3pCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic));
2512  f3pCorrelations->GetXaxis()->SetBinLabel(4,""); // empty
2513  // 3-p correlations sensitive to three distinct harmonics (6):
2514  f3pCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,1*fHarmonic));
2515  f3pCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,1*fHarmonic));
2516  f3pCorrelations->GetXaxis()->SetBinLabel(7,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,2*fHarmonic));
2517  f3pCorrelations->GetXaxis()->SetBinLabel(8,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,1*fHarmonic));
2518  f3pCorrelations->GetXaxis()->SetBinLabel(9,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,2*fHarmonic));
2519  f3pCorrelations->GetXaxis()->SetBinLabel(10,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,1*fHarmonic));
2520  fMixedHarmonicsProfiles->Add(f3pCorrelations);
2521  //  b3) 4-p correlations (6+15+2+10+8):
2522  TString s4pCorrelationsName = "f4pCorrelations";
2523  s4pCorrelationsName += fAnalysisLabel->Data();
2524  f4pCorrelations = new TProfile(s4pCorrelationsName.Data(),Form("4-particle correlations (n = %d)",fHarmonic),45,0,45,"s");
2525  f4pCorrelations->SetTickLength(-0.01,"Y");
2526  f4pCorrelations->SetMarkerStyle(25);
2527  f4pCorrelations->SetLabelSize(0.03);
2528  f4pCorrelations->SetLabelOffset(0.02,"Y");
2529  f4pCorrelations->SetStats(kFALSE);
2530  f4pCorrelations->Sumw2();
2531  // "same harmonic" (6):
2532  f4pCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2533  f4pCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2534  f4pCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
2535  f4pCorrelations->GetXaxis()->SetBinLabel(4,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
2536  f4pCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic));
2537  f4pCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,6*fHarmonic));
2538  f4pCorrelations->GetXaxis()->SetBinLabel(7,""); // empty
2539  // "standard candles" (15):
2540  f4pCorrelations->GetXaxis()->SetBinLabel(8,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic));
2541  f4pCorrelations->GetXaxis()->SetBinLabel(9,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic));
2542  f4pCorrelations->GetXaxis()->SetBinLabel(10,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic));
2543  f4pCorrelations->GetXaxis()->SetBinLabel(11,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic));
2544  f4pCorrelations->GetXaxis()->SetBinLabel(12,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic));
2545  f4pCorrelations->GetXaxis()->SetBinLabel(13,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic));
2546  f4pCorrelations->GetXaxis()->SetBinLabel(14,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic));
2547  f4pCorrelations->GetXaxis()->SetBinLabel(15,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic));
2548  f4pCorrelations->GetXaxis()->SetBinLabel(16,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic));
2549  f4pCorrelations->GetXaxis()->SetBinLabel(17,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic));
2550  f4pCorrelations->GetXaxis()->SetBinLabel(18,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,6*fHarmonic,1*fHarmonic));
2551  f4pCorrelations->GetXaxis()->SetBinLabel(19,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,2*fHarmonic));
2552  f4pCorrelations->GetXaxis()->SetBinLabel(20,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,3*fHarmonic));
2553  f4pCorrelations->GetXaxis()->SetBinLabel(21,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,4*fHarmonic));
2554  f4pCorrelations->GetXaxis()->SetBinLabel(22,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,5*fHarmonic));
2555  f4pCorrelations->GetXaxis()->SetBinLabel(23,""); // empty
2556  // 4-p correlations sensitive to two distinct harmonics (2):
2557  f4pCorrelations->GetXaxis()->SetBinLabel(24,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2558  f4pCorrelations->GetXaxis()->SetBinLabel(25,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2559  f4pCorrelations->GetXaxis()->SetBinLabel(26,""); // empty
2560  // 4-p correlations sensitive to three distinct harmonics (10):
2561  f4pCorrelations->GetXaxis()->SetBinLabel(27,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic));
2562  f4pCorrelations->GetXaxis()->SetBinLabel(28,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
2563  f4pCorrelations->GetXaxis()->SetBinLabel(29,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic));
2564  f4pCorrelations->GetXaxis()->SetBinLabel(30,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
2565  f4pCorrelations->GetXaxis()->SetBinLabel(31,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
2566  f4pCorrelations->GetXaxis()->SetBinLabel(32,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
2567  f4pCorrelations->GetXaxis()->SetBinLabel(33,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic));
2568  f4pCorrelations->GetXaxis()->SetBinLabel(34,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
2569  f4pCorrelations->GetXaxis()->SetBinLabel(35,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,4*fHarmonic));
2570  f4pCorrelations->GetXaxis()->SetBinLabel(36,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,5*fHarmonic));
2571  f4pCorrelations->GetXaxis()->SetBinLabel(37,""); // empty
2572  // 4-p correlations sensitive to four distinct harmonics (8):
2573  f4pCorrelations->GetXaxis()->SetBinLabel(38,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic));
2574  f4pCorrelations->GetXaxis()->SetBinLabel(39,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic));
2575  f4pCorrelations->GetXaxis()->SetBinLabel(40,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic));
2576  f4pCorrelations->GetXaxis()->SetBinLabel(41,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
2577  f4pCorrelations->GetXaxis()->SetBinLabel(42,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,2*fHarmonic));
2578  f4pCorrelations->GetXaxis()->SetBinLabel(43,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
2579  f4pCorrelations->GetXaxis()->SetBinLabel(44,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,3*fHarmonic));
2580  f4pCorrelations->GetXaxis()->SetBinLabel(45,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,4*fHarmonic));
2581  fMixedHarmonicsProfiles->Add(f4pCorrelations);
2582  //  b3) 5-p correlations (30+9+30+11+3):
2583  TString s5pCorrelationsName = "f5pCorrelations";
2584  s5pCorrelationsName += fAnalysisLabel->Data();
2585  f5pCorrelations = new TProfile(s5pCorrelationsName.Data(),Form("5-particle correlations (n = %d)",fHarmonic),87,0,87,"s");
2586  f5pCorrelations->SetTickLength(-0.01,"Y");
2587  f5pCorrelations->SetMarkerStyle(25);
2588  f5pCorrelations->SetLabelSize(0.02);
2589  f5pCorrelations->SetLabelOffset(0.02,"Y");
2590  f5pCorrelations->SetStats(kFALSE);
2591  f5pCorrelations->Sumw2();
2592  // "standard candles" (30):
2593  f5pCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
2594  f5pCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
2595  f5pCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
2596  f5pCorrelations->GetXaxis()->SetBinLabel(4,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
2597  f5pCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
2598  f5pCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
2599  f5pCorrelations->GetXaxis()->SetBinLabel(7,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
2600  f5pCorrelations->GetXaxis()->SetBinLabel(8,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
2601  f5pCorrelations->GetXaxis()->SetBinLabel(9,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
2602  f5pCorrelations->GetXaxis()->SetBinLabel(10,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
2603  f5pCorrelations->GetXaxis()->SetBinLabel(11,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
2604  f5pCorrelations->GetXaxis()->SetBinLabel(12,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
2605  f5pCorrelations->GetXaxis()->SetBinLabel(13,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
2606  f5pCorrelations->GetXaxis()->SetBinLabel(14,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
2607  f5pCorrelations->GetXaxis()->SetBinLabel(15,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
2608  f5pCorrelations->GetXaxis()->SetBinLabel(16,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
2609  f5pCorrelations->GetXaxis()->SetBinLabel(17,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
2610  f5pCorrelations->GetXaxis()->SetBinLabel(18,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
2611  f5pCorrelations->GetXaxis()->SetBinLabel(19,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
2612  f5pCorrelations->GetXaxis()->SetBinLabel(20,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
2613  f5pCorrelations->GetXaxis()->SetBinLabel(21,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
2614  f5pCorrelations->GetXaxis()->SetBinLabel(22,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
2615  f5pCorrelations->GetXaxis()->SetBinLabel(23,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,3*fHarmonic));
2616  f5pCorrelations->GetXaxis()->SetBinLabel(24,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,1*fHarmonic,1*fHarmonic));
2617  f5pCorrelations->GetXaxis()->SetBinLabel(25,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,2*fHarmonic,1*fHarmonic));
2618  f5pCorrelations->GetXaxis()->SetBinLabel(26,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,2*fHarmonic,2*fHarmonic));
2619  f5pCorrelations->GetXaxis()->SetBinLabel(27,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,3*fHarmonic,1*fHarmonic));
2620  f5pCorrelations->GetXaxis()->SetBinLabel(28,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,2*fHarmonic));
2621  f5pCorrelations->GetXaxis()->SetBinLabel(29,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,3*fHarmonic,2*fHarmonic));
2622  f5pCorrelations->GetXaxis()->SetBinLabel(30,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,4*fHarmonic,1*fHarmonic));
2623  f5pCorrelations->GetXaxis()->SetBinLabel(31,""); // empty
2624  // 5-p correlations sensitive to two distinct harmonics (9):
2625  f5pCorrelations->GetXaxis()->SetBinLabel(32,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2626  f5pCorrelations->GetXaxis()->SetBinLabel(33,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
2627  f5pCorrelations->GetXaxis()->SetBinLabel(34,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2628  f5pCorrelations->GetXaxis()->SetBinLabel(35,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2629  f5pCorrelations->GetXaxis()->SetBinLabel(36,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2630  f5pCorrelations->GetXaxis()->SetBinLabel(37,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
2631  f5pCorrelations->GetXaxis()->SetBinLabel(38,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
2632  f5pCorrelations->GetXaxis()->SetBinLabel(39,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
2633  f5pCorrelations->GetXaxis()->SetBinLabel(40,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,3*fHarmonic,3*fHarmonic));
2634  f5pCorrelations->GetXaxis()->SetBinLabel(41,""); // empty
2635  // 5-p correlations sensitive to three distinct harmonics (30):
2636  f5pCorrelations->GetXaxis()->SetBinLabel(42,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
2637  f5pCorrelations->GetXaxis()->SetBinLabel(43,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
2638  f5pCorrelations->GetXaxis()->SetBinLabel(44,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
2639  f5pCorrelations->GetXaxis()->SetBinLabel(45,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
2640  f5pCorrelations->GetXaxis()->SetBinLabel(46,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
2641  f5pCorrelations->GetXaxis()->SetBinLabel(47,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
2642  f5pCorrelations->GetXaxis()->SetBinLabel(48,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
2643  f5pCorrelations->GetXaxis()->SetBinLabel(49,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
2644  f5pCorrelations->GetXaxis()->SetBinLabel(50,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2645  f5pCorrelations->GetXaxis()->SetBinLabel(51,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2646  f5pCorrelations->GetXaxis()->SetBinLabel(52,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
2647  f5pCorrelations->GetXaxis()->SetBinLabel(53,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
2648  f5pCorrelations->GetXaxis()->SetBinLabel(54,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
2649  f5pCorrelations->GetXaxis()->SetBinLabel(55,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
2650  f5pCorrelations->GetXaxis()->SetBinLabel(56,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
2651  f5pCorrelations->GetXaxis()->SetBinLabel(57,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
2652  f5pCorrelations->GetXaxis()->SetBinLabel(58,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
2653  f5pCorrelations->GetXaxis()->SetBinLabel(59,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
2654  f5pCorrelations->GetXaxis()->SetBinLabel(60,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
2655  f5pCorrelations->GetXaxis()->SetBinLabel(61,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
2656  f5pCorrelations->GetXaxis()->SetBinLabel(62,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2657  f5pCorrelations->GetXaxis()->SetBinLabel(63,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
2658  f5pCorrelations->GetXaxis()->SetBinLabel(64,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
2659  f5pCorrelations->GetXaxis()->SetBinLabel(65,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
2660  f5pCorrelations->GetXaxis()->SetBinLabel(66,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
2661  f5pCorrelations->GetXaxis()->SetBinLabel(67,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,5*fHarmonic,5*fHarmonic));
2662  f5pCorrelations->GetXaxis()->SetBinLabel(68,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic,1*fHarmonic));
2663  f5pCorrelations->GetXaxis()->SetBinLabel(69,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,5*fHarmonic,2*fHarmonic));
2664  f5pCorrelations->GetXaxis()->SetBinLabel(70,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,4*fHarmonic,2*fHarmonic));
2665  f5pCorrelations->GetXaxis()->SetBinLabel(71,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,5*fHarmonic,1*fHarmonic));
2666  f5pCorrelations->GetXaxis()->SetBinLabel(72,""); // empty
2667  // 5-p correlations sensitive to four distinct harmonics (11):
2668  f5pCorrelations->GetXaxis()->SetBinLabel(73,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
2669  f5pCorrelations->GetXaxis()->SetBinLabel(74,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
2670  f5pCorrelations->GetXaxis()->SetBinLabel(75,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
2671  f5pCorrelations->GetXaxis()->SetBinLabel(76,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
2672  f5pCorrelations->GetXaxis()->SetBinLabel(77,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
2673  f5pCorrelations->GetXaxis()->SetBinLabel(78,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
2674  f5pCorrelations->GetXaxis()->SetBinLabel(79,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,5*fHarmonic,3*fHarmonic));
2675  f5pCorrelations->GetXaxis()->SetBinLabel(80,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
2676  f5pCorrelations->GetXaxis()->SetBinLabel(81,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic));
2677  f5pCorrelations->GetXaxis()->SetBinLabel(82,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,5*fHarmonic,5*fHarmonic));
2678  f5pCorrelations->GetXaxis()->SetBinLabel(83,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic));
2679  f5pCorrelations->GetXaxis()->SetBinLabel(84,""); // empty
2680  // 5-p correlations sensitive to five distinct harmonics (3):
2681  f5pCorrelations->GetXaxis()->SetBinLabel(85,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
2682  f5pCorrelations->GetXaxis()->SetBinLabel(86,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,1*fHarmonic,5*fHarmonic,4*fHarmonic));
2683  f5pCorrelations->GetXaxis()->SetBinLabel(87,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
2684  fMixedHarmonicsProfiles->Add(f5pCorrelations);
2685  //  b4) 6-p correlations (??+??+??+??+??):
2686  TString s6pCorrelationsName = "f6pCorrelations";
2687  s6pCorrelationsName += fAnalysisLabel->Data();
2688  f6pCorrelations = new TProfile(s6pCorrelationsName.Data(),Form("6-particle correlations (n = %d)",fHarmonic),1,0.,1.);
2689  f6pCorrelations->SetTickLength(-0.01,"Y");
2690  f6pCorrelations->SetMarkerStyle(25);
2691  f6pCorrelations->SetLabelSize(0.02);
2692  f6pCorrelations->SetLabelOffset(0.02,"Y");
2693  f6pCorrelations->SetStats(kFALSE);
2694  f6pCorrelations->Sumw2(); 
2695  //fMixedHarmonicsProfiles->Add(f6pCorrelations); // TBI
2696  //  b5) 7-p correlations (??+??+??+??+??):
2697  TString s7pCorrelationsName = "f7pCorrelations";
2698  s7pCorrelationsName += fAnalysisLabel->Data();
2699  f7pCorrelations = new TProfile(s7pCorrelationsName.Data(),Form("7-particle correlations (n = %d)",fHarmonic),1,0.,1.);
2700  f7pCorrelations->SetTickLength(-0.01,"Y");
2701  f7pCorrelations->SetMarkerStyle(25);
2702  f7pCorrelations->SetLabelSize(0.02);
2703  f7pCorrelations->SetLabelOffset(0.02,"Y");
2704  f7pCorrelations->SetStats(kFALSE);
2705  f7pCorrelations->Sumw2(); 
2706  //fMixedHarmonicsProfiles->Add(f7pCorrelations); // TBI
2707  //  b6) 8-p correlations (??+??+??+??+??):
2708  TString s8pCorrelationsName = "f8pCorrelations";
2709  s8pCorrelationsName += fAnalysisLabel->Data();
2710  f8pCorrelations = new TProfile(s8pCorrelationsName.Data(),Form("8-particle correlations (n = %d)",fHarmonic),1,0.,1.);
2711  f8pCorrelations->SetTickLength(-0.01,"Y");
2712  f8pCorrelations->SetMarkerStyle(25);
2713  f8pCorrelations->SetLabelSize(0.02);
2714  f8pCorrelations->SetLabelOffset(0.02,"Y");
2715  f8pCorrelations->SetStats(kFALSE);
2716  f8pCorrelations->Sumw2(); 
2717  //fMixedHarmonicsProfiles->Add(f8pCorrelations); // TBI
2718
2719  // c) Book all objects in TList fMixedHarmonicsResults:
2720  // QC{2}:
2721  f2pCumulants = f2pCorrelations->ProjectionX("f2pCumulants");
2722  f2pCumulants->SetTitle(Form("2-particle cumulants (n = %d)",fHarmonic));
2723  f2pCumulants->SetStats(kFALSE);
2724  f2pCumulants->SetMarkerStyle(kFullSquare);
2725  f2pCumulants->SetMarkerColor(kBlack);
2726  f2pCumulants->SetLineColor(kBlack);
2727  fMixedHarmonicsResults->Add(f2pCumulants);
2728  // QC{3}:
2729  f3pCumulants = f3pCorrelations->ProjectionX("f3pCumulants");
2730  f3pCumulants->SetTitle(Form("3-particle cumulants (n = %d)",fHarmonic));
2731  f3pCumulants->SetStats(kFALSE);
2732  f3pCumulants->SetMarkerStyle(kFullSquare);
2733  f3pCumulants->SetMarkerColor(kGreen+2);
2734  f3pCumulants->SetLineColor(kGreen+2);
2735  fMixedHarmonicsResults->Add(f3pCumulants);
2736  // QC{4}:
2737  f4pCumulants = f4pCorrelations->ProjectionX("f4pCumulants");
2738  f4pCumulants->SetTitle(Form("4-particle cumulants (n = %d)",fHarmonic));
2739  f4pCumulants->SetStats(kFALSE);
2740  f4pCumulants->SetMarkerStyle(kFullSquare);
2741  f4pCumulants->SetMarkerColor(kRed);
2742  f4pCumulants->SetLineColor(kRed);
2743  fMixedHarmonicsResults->Add(f4pCumulants);
2744  // QC{5}:
2745  f5pCumulants = f5pCorrelations->ProjectionX("f5pCumulants");
2746  f5pCumulants->SetTitle(Form("5-particle cumulants (n = %d)",fHarmonic));
2747  f5pCumulants->SetStats(kFALSE);
2748  f5pCumulants->SetMarkerStyle(kFullSquare);
2749  f5pCumulants->SetMarkerColor(kBlue);
2750  f5pCumulants->SetLineColor(kBlue);
2751  fMixedHarmonicsResults->Add(f5pCumulants);
2752
2753  // d) Book all objects in TList fMixedHarmonicsErrorPropagation: 
2754  // Sum of linear and quadratic event weights for mixed harmonics => [0=linear 1,1=quadratic]: 
2755  TString mixedHarmonicEventWeightsName = "fMixedHarmonicEventWeights";
2756  mixedHarmonicEventWeightsName += fAnalysisLabel->Data();
2757  TString powerFlag[2] = {"linear","quadratic"}; 
2758  for(Int_t power=0;power<2;power++)
2759  {
2760   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.);
2761   fMixedHarmonicEventWeights[power]->SetLabelSize(0.04);
2762   fMixedHarmonicEventWeights[power]->SetMarkerStyle(25);
2763   fMixedHarmonicEventWeights[power]->SetStats(kFALSE);
2764   if(power == 0)
2765   {
2766    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum w_{#LT1#GT}");
2767    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum w_{#LT2#GT}");
2768    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum w_{#LT3#GT}");
2769    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum w_{#LT4#GT}");
2770    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(5,"#sum w_{#LT5#GT}");
2771    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(6,"#sum w_{#LT6#GT}");
2772    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(7,"#sum w_{#LT7#GT}");
2773    (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(8,"#sum w_{#LT8#GT}");
2774   } else if (power == 1) 
2775     {
2776      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum w_{#LT1#GT}^{2}");
2777      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum w_{#LT2#GT}^{2}");
2778      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum w_{#LT3#GT}^{2}");
2779      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum w_{#LT4#GT}^{2}");
2780      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(5,"#sum w_{#LT5#GT}^{2}");
2781      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(6,"#sum w_{#LT6#GT}^{2}");
2782      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(7,"#sum w_{#LT7#GT}^{2}");
2783      (fMixedHarmonicEventWeights[power]->GetXaxis())->SetBinLabel(8,"#sum w_{#LT8#GT}^{2}");
2784     }
2785   fMixedHarmonicsErrorPropagation->Add(fMixedHarmonicEventWeights[power]);
2786  } // end of for(Int_t power=0;power<2;power++)
2787  
2788  // Sums of products of event weights for mixed harmonics:
2789  TString mixedHarmonicProductOfEventWeightsName = "fMixedHarmonicProductOfEventWeights";
2790  mixedHarmonicProductOfEventWeightsName += fAnalysisLabel->Data();
2791  fMixedHarmonicProductOfEventWeights = new TH2D(mixedHarmonicProductOfEventWeightsName.Data(),"Sums of products of event weights",8,0.,8.,8,0.,8.);
2792  fMixedHarmonicProductOfEventWeights->SetStats(kFALSE);
2793  fMixedHarmonicProductOfEventWeights->GetXaxis()->SetLabelSize(0.05);
2794  fMixedHarmonicProductOfEventWeights->GetYaxis()->SetLabelSize(0.05);
2795  for(Int_t b=1;b<=8;b++)
2796  {
2797   fMixedHarmonicProductOfEventWeights->GetXaxis()->SetBinLabel(b,Form("w_{#LT%i#GT}",b)); 
2798   fMixedHarmonicProductOfEventWeights->GetYaxis()->SetBinLabel(b,Form("w_{#LT%i#GT}",b)); 
2799  } 
2800  fMixedHarmonicsErrorPropagation->Add(fMixedHarmonicProductOfEventWeights);
2801
2802  // Averages of products of mixed harmonics correlations:
2803  TString mixedHarmonicProductOfCorrelationsName = "fMixedHarmonicProductOfCorrelations";
2804  mixedHarmonicProductOfCorrelationsName += fAnalysisLabel->Data();
2805  fMixedHarmonicProductOfCorrelations = new TProfile2D(mixedHarmonicProductOfCorrelationsName.Data(),"Averages of products of mixed correlators",139,0.,139.,139,0.,139.);
2806  fMixedHarmonicProductOfCorrelations->Sumw2();
2807  fMixedHarmonicProductOfCorrelations->SetStats(kFALSE);
2808  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetLabelSize(0.015);
2809  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetLabelSize(0.015);
2810  // x-axis:
2811  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(1,Form("#LT#LT2#GT#GT_{%dn|%dn}",1*fHarmonic,1*fHarmonic));
2812  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(2,Form("#LT#LT2#GT#GT_{%dn|%dn}",2*fHarmonic,2*fHarmonic));
2813  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(3,Form("#LT#LT2#GT#GT_{%dn|%dn}",3*fHarmonic,3*fHarmonic));
2814  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(4,Form("#LT#LT2#GT#GT_{%dn|%dn}",4*fHarmonic,4*fHarmonic));
2815  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(5,Form("#LT#LT2#GT#GT_{%dn|%dn}",5*fHarmonic,5*fHarmonic));
2816  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(6,Form("#LT#LT2#GT#GT_{%dn|%dn}",6*fHarmonic,6*fHarmonic));
2817  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(7,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic));
2818  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(8,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic));
2819  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(9,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic));
2820  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(10,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,1*fHarmonic));
2821  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(11,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,1*fHarmonic));
2822  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(12,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,2*fHarmonic));
2823  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(13,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,1*fHarmonic));
2824  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(14,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,2*fHarmonic));
2825  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(15,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,1*fHarmonic));
2826  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(16,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2827  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(17,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2828  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(18,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
2829  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(19,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
2830  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(20,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic));
2831  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(21,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,6*fHarmonic));
2832  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(22,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic));
2833  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(23,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic));
2834  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(24,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic));
2835  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(25,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic));
2836  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(26,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic));
2837  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(27,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic));
2838  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(28,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic));
2839  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(29,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic));
2840  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(30,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic));
2841  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(31,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic));
2842  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(32,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,6*fHarmonic,1*fHarmonic));
2843  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(33,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,2*fHarmonic));
2844  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(34,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,3*fHarmonic));
2845  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(35,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,4*fHarmonic));
2846  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(36,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,5*fHarmonic));
2847  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(37,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2848  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(38,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2849  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(39,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic));
2850  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(40,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
2851  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(41,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic));
2852  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(42,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
2853  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(43,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
2854  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(44,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
2855  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(45,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic));
2856  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(46,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
2857  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(47,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,4*fHarmonic));
2858  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(48,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,5*fHarmonic));
2859  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(49,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic));
2860  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(50,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic));
2861  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(51,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic));
2862  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(52,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
2863  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(53,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,2*fHarmonic));
2864  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(54,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
2865  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(55,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,3*fHarmonic));
2866  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(56,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,4*fHarmonic));
2867  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(57,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
2868  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(58,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
2869  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(59,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
2870  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(60,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
2871  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(61,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
2872  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(62,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
2873  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(63,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
2874  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(64,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
2875  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(65,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
2876  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(66,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
2877  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(67,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
2878  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(68,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
2879  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(69,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
2880  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(70,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
2881  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(71,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
2882  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(72,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
2883  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(73,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
2884  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(74,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
2885  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(75,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
2886  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(76,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
2887  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(77,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
2888  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(78,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
2889  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(79,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,3*fHarmonic));
2890  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(80,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,1*fHarmonic,1*fHarmonic));
2891  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(81,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,2*fHarmonic,1*fHarmonic));
2892  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(82,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,2*fHarmonic,2*fHarmonic));
2893  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(83,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,3*fHarmonic,1*fHarmonic));
2894  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(84,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,2*fHarmonic));
2895  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(85,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,3*fHarmonic,2*fHarmonic));
2896  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(86,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,4*fHarmonic,1*fHarmonic));
2897  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(87,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2898  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(88,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
2899  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(89,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2900  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(90,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2901  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(91,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2902  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(92,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
2903  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(93,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
2904  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(94,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
2905  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(95,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,3*fHarmonic,3*fHarmonic));
2906  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(96,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
2907  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(97,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
2908  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(98,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
2909  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(99,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
2910  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(100,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
2911  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(101,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
2912  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(102,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
2913  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(103,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
2914  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(104,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2915  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(105,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2916  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(106,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
2917  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(107,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
2918  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(108,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
2919  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(109,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
2920  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(110,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
2921  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(111,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
2922  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(112,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
2923  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(113,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
2924  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(114,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
2925  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(115,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
2926  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(116,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2927  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(117,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
2928  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(118,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
2929  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(119,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
2930  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(120,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
2931  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(121,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,5*fHarmonic,5*fHarmonic));
2932  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(122,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic,1*fHarmonic));
2933  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(123,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,5*fHarmonic,2*fHarmonic));
2934  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(124,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,4*fHarmonic,2*fHarmonic));
2935  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(125,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,5*fHarmonic,1*fHarmonic));
2936  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(126,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
2937  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(127,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
2938  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(128,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
2939  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(129,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
2940  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(130,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
2941  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(131,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
2942  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(132,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,5*fHarmonic,3*fHarmonic));
2943  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(133,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
2944  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(134,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic));
2945  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(135,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,5*fHarmonic,5*fHarmonic));
2946  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(136,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic));
2947  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(137,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
2948  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(138,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,1*fHarmonic,5*fHarmonic,4*fHarmonic));
2949  fMixedHarmonicProductOfCorrelations->GetXaxis()->SetBinLabel(139,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
2950  // y-axis:
2951  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(1,Form("#LT#LT2#GT#GT_{%dn|%dn}",1*fHarmonic,1*fHarmonic));
2952  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(2,Form("#LT#LT2#GT#GT_{%dn|%dn}",2*fHarmonic,2*fHarmonic));
2953  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(3,Form("#LT#LT2#GT#GT_{%dn|%dn}",3*fHarmonic,3*fHarmonic));
2954  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(4,Form("#LT#LT2#GT#GT_{%dn|%dn}",4*fHarmonic,4*fHarmonic));
2955  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(5,Form("#LT#LT2#GT#GT_{%dn|%dn}",5*fHarmonic,5*fHarmonic));
2956  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(6,Form("#LT#LT2#GT#GT_{%dn|%dn}",6*fHarmonic,6*fHarmonic));
2957  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(7,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic));
2958  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(8,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic));
2959  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(9,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic));
2960  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(10,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,1*fHarmonic));
2961  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(11,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,1*fHarmonic));
2962  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(12,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,2*fHarmonic));
2963  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(13,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,1*fHarmonic));
2964  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(14,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,2*fHarmonic));
2965  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(15,Form("#LT#LT3#GT#GT_{%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,1*fHarmonic));
2966  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(16,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2967  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(17,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2968  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(18,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
2969  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(19,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
2970  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(20,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic));
2971  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(21,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,6*fHarmonic));
2972  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(22,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",2*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic));
2973  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(23,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic));
2974  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(24,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic));
2975  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(25,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic));
2976  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(26,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic));
2977  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(27,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic));
2978  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(28,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic));
2979  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(29,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic));
2980  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(30,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic));
2981  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(31,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic));
2982  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(32,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,6*fHarmonic,1*fHarmonic));
2983  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(33,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,2*fHarmonic));
2984  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(34,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,3*fHarmonic));
2985  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(35,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,4*fHarmonic));
2986  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(36,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,5*fHarmonic));
2987  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(37,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
2988  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(38,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
2989  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(39,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic));
2990  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(40,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
2991  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(41,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic));
2992  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(42,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
2993  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(43,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
2994  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(44,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
2995  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(45,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic));
2996  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(46,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
2997  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(47,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,4*fHarmonic));
2998  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(48,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,5*fHarmonic));
2999  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(49,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic));
3000  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(50,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic));
3001  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(51,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic));
3002  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(52,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
3003  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(53,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,2*fHarmonic));
3004  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(54,Form("#LT#LT4#GT#GT_{%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3005  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(55,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,3*fHarmonic));
3006  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(56,Form("#LT#LT4#GT#GT_{%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,4*fHarmonic));
3007  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(57,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3008  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(58,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3009  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(59,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3010  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(60,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3011  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(61,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3012  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(62,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3013  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(63,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3014  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(64,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
3015  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(65,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3016  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(66,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3017  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(67,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
3018  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(68,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
3019  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(69,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
3020  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(70,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
3021  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(71,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3022  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(72,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3023  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(73,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,4*fHarmonic,2*fHarmonic,1*fHarmonic));
3024  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(74,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,3*fHarmonic,2*fHarmonic));
3025  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(75,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
3026  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(76,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,5*fHarmonic,2*fHarmonic,1*fHarmonic));
3027  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(77,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,3*fHarmonic,1*fHarmonic));
3028  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(78,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
3029  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(79,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,3*fHarmonic));
3030  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(80,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,6*fHarmonic,1*fHarmonic,1*fHarmonic));
3031  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(81,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,6*fHarmonic,2*fHarmonic,1*fHarmonic));
3032  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(82,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,2*fHarmonic,2*fHarmonic));
3033  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(83,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,6*fHarmonic,3*fHarmonic,1*fHarmonic));
3034  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(84,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,2*fHarmonic));
3035  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(85,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,3*fHarmonic,2*fHarmonic));
3036  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(86,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,6*fHarmonic,4*fHarmonic,1*fHarmonic));
3037  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(87,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3038  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(88,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3039  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(89,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3040  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(90,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3041  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(91,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3042  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(92,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3043  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(93,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3044  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(94,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic));
3045  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(95,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,3*fHarmonic,3*fHarmonic));
3046  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(96,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,1*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3047  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(97,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic));
3048  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(98,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic,1*fHarmonic));
3049  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(99,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,1*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic));
3050  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(100,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",4*fHarmonic,1*fHarmonic,1*fHarmonic,3*fHarmonic,3*fHarmonic));
3051  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(101,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3052  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(102,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3053  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(103,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",4*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3054  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(104,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3055  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(105,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,2*fHarmonic,2*fHarmonic,2*fHarmonic));
3056  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(106,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3057  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(107,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic,2*fHarmonic));
3058  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(108,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,1*fHarmonic,4*fHarmonic,1*fHarmonic,1*fHarmonic));
3059  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(109,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic,3*fHarmonic));
3060  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(110,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
3061  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(111,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic,3*fHarmonic));
3062  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(112,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
3063  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(113,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
3064  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(114,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,5*fHarmonic,5*fHarmonic,4*fHarmonic,1*fHarmonic));
3065  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(115,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,1*fHarmonic,1*fHarmonic));
3066  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(116,Form("#LT#LT5#GT#GT_{%dn|%dn,%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,1*fHarmonic,1*fHarmonic));
3067  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(117,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
3068  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(118,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,5*fHarmonic,1*fHarmonic,1*fHarmonic));
3069  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(119,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3070  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(120,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,4*fHarmonic,4*fHarmonic,2*fHarmonic));
3071  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(121,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,2*fHarmonic,5*fHarmonic,5*fHarmonic));
3072  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(122,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,5*fHarmonic,5*fHarmonic,1*fHarmonic));
3073  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(123,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,5*fHarmonic,2*fHarmonic));
3074  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(124,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,4*fHarmonic,2*fHarmonic));
3075  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(125,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,6*fHarmonic,5*fHarmonic,1*fHarmonic));
3076  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(126,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,2*fHarmonic,3*fHarmonic,3*fHarmonic,1*fHarmonic));
3077  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(127,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,1*fHarmonic,1*fHarmonic,4*fHarmonic,3*fHarmonic));
3078  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(128,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",5*fHarmonic,3*fHarmonic,4*fHarmonic,2*fHarmonic,2*fHarmonic));
3079  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(129,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",5*fHarmonic,2*fHarmonic,1*fHarmonic,4*fHarmonic,4*fHarmonic));
3080  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(130,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,1*fHarmonic,3*fHarmonic,2*fHarmonic,2*fHarmonic));
3081  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(131,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,4*fHarmonic,4*fHarmonic,1*fHarmonic));
3082  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(132,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,1*fHarmonic,1*fHarmonic,5*fHarmonic,3*fHarmonic));
3083  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(133,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,3*fHarmonic,5*fHarmonic,2*fHarmonic,2*fHarmonic));
3084  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(134,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,5*fHarmonic,4*fHarmonic,4*fHarmonic,3*fHarmonic));
3085  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(135,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,3*fHarmonic,1*fHarmonic,5*fHarmonic,5*fHarmonic));
3086  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(136,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,6*fHarmonic,5*fHarmonic,4*fHarmonic,3*fHarmonic));
3087  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(137,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,2*fHarmonic,4*fHarmonic,3*fHarmonic,1*fHarmonic));
3088  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(138,Form("#LT#LT5#GT#GT_{%dn,%dn,%dn|%dn,%dn}",6*fHarmonic,2*fHarmonic,1*fHarmonic,5*fHarmonic,4*fHarmonic));
3089  fMixedHarmonicProductOfCorrelations->GetYaxis()->SetBinLabel(139,Form("#LT#LT5#GT#GT_{%dn,%dn|%dn,%dn,%dn}",6*fHarmonic,4*fHarmonic,5*fHarmonic,3*fHarmonic,2*fHarmonic));
3090  fMixedHarmonicsErrorPropagation->Add(fMixedHarmonicProductOfCorrelations);
3091
3092 } // end of void AliFlowAnalysisWithQCumulants::BookEverythingForMixedHarmonics()
3093
3094 //=======================================================================================================================
3095
3096 void AliFlowAnalysisWithQCumulants::InitializeArraysForNestedLoops()
3097 {
3098  // Initialize arrays of all objects relevant for calculations with nested loops.
3099  
3100  // integrated flow:
3101  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
3102  {
3103   fIntFlowDirectCorrectionTermsForNUA[sc] = NULL;
3104  } 
3105
3106  // differential flow:  
3107  // correlations:
3108  for(Int_t t=0;t<2;t++) // type: RP or POI
3109  { 
3110   for(Int_t pe=0;pe<2;pe++) // pt or eta
3111   {
3112    for(Int_t ci=0;ci<4;ci++) // correlation index
3113    {
3114     fDiffFlowDirectCorrelations[t][pe][ci] = NULL;
3115    } // end of for(Int_t ci=0;ci<4;ci++) // correlation index  
3116   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
3117  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
3118  // correction terms for non-uniform acceptance:
3119  for(Int_t t=0;t<2;t++) // type: RP or POI
3120  { 
3121   for(Int_t pe=0;pe<2;pe++) // pt or eta
3122   {
3123    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
3124    {
3125     for(Int_t cti=0;cti<9;cti++) // correction term index
3126     {
3127      fDiffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti] = NULL;
3128     }   
3129    }
3130   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
3131  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
3132
3133  // other differential correlators: 
3134  for(Int_t t=0;t<2;t++) // type: RP or POI
3135  { 
3136   for(Int_t pe=0;pe<2;pe++) // pt or eta
3137   {
3138    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
3139    {
3140     for(Int_t ci=0;ci<1;ci++) // correlator index
3141     {
3142      fOtherDirectDiffCorrelators[t][pe][sc][ci] = NULL;
3143     }   
3144    }
3145   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
3146  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
3147
3148 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForNestedLoops()
3149
3150 //=======================================================================================================================
3151
3152 void AliFlowAnalysisWithQCumulants::InitializeArraysForMixedHarmonics()
3153 {
3154  // Initialize arrays of all objects relevant for mixed harmonics.
3155
3156  for(Int_t power=0;power<2;power++) // linear or quadratic 
3157  {
3158   fMixedHarmonicEventWeights[power] = NULL;    
3159  }
3160
3161 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForMixedHarmonics()
3162
3163 //=======================================================================================================================
3164
3165 void AliFlowAnalysisWithQCumulants::BookEverythingForNestedLoops()
3166 {
3167  // Book all objects relevant for calculations with nested loops.
3168  
3169  TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data members?)
3170  TString typeFlag[2] = {"RP","POI"}; // to be improved (should I promote this to data members?)
3171  TString ptEtaFlag[2] = {"p_{T}","#eta"}; // to be improved (should I promote this to data members?)
3172  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"}; // to be improved (should I promote this to data members?)
3173  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
3174  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
3175
3176  TString evaluateNestedLoopsName = "fEvaluateNestedLoops";
3177  evaluateNestedLoopsName += fAnalysisLabel->Data();
3178  fEvaluateNestedLoops = new TProfile(evaluateNestedLoopsName.Data(),"Flags for nested loops",4,0,4);
3179  fEvaluateNestedLoops->SetLabelSize(0.03);
3180  fEvaluateNestedLoops->SetStats(kFALSE);
3181  (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(1,"fEvaluateIntFlowNestedLoops");
3182  (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(2,"fEvaluateDiffFlowNestedLoops");
3183  (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(3,"fCrossCheckInPtBinNo");
3184  (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(4,"fCrossCheckInEtaBinNo");
3185  fEvaluateNestedLoops->Fill(0.5,(Int_t)fEvaluateIntFlowNestedLoops);
3186  fEvaluateNestedLoops->Fill(1.5,(Int_t)fEvaluateDiffFlowNestedLoops);
3187  fEvaluateNestedLoops->Fill(2.5,fCrossCheckInPtBinNo);
3188  fEvaluateNestedLoops->Fill(3.5,fCrossCheckInEtaBinNo);
3189  fNestedLoopsList->Add(fEvaluateNestedLoops);
3190  // nested loops for integrated flow:
3191  if(fEvaluateIntFlowNestedLoops)
3192  {
3193   // correlations:
3194   TString intFlowDirectCorrelationsName = "fIntFlowDirectCorrelations";
3195   intFlowDirectCorrelationsName += fAnalysisLabel->Data();
3196   fIntFlowDirectCorrelations = new TProfile(intFlowDirectCorrelationsName.Data(),"Multiparticle correlations calculated with nested loops (for int. flow)",64,0,64,"s");
3197   fNestedLoopsList->Add(fIntFlowDirectCorrelations);
3198   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
3199   {
3200    TString intFlowExtraDirectCorrelationsName = "fIntFlowExtraDirectCorrelations";
3201    intFlowExtraDirectCorrelationsName += fAnalysisLabel->Data();
3202    fIntFlowExtraDirectCorrelations = new TProfile(intFlowExtraDirectCorrelationsName.Data(),"Extra multiparticle correlations calculated with nested loops (for int. flow)",100,0,100,"s");
3203    fNestedLoopsList->Add(fIntFlowExtraDirectCorrelations);  
3204   } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
3205   // correction terms for non-uniform acceptance:
3206   for(Int_t sc=0;sc<2;sc++) // sin or cos terms
3207   {
3208    TString intFlowDirectCorrectionTermsForNUAName = "fIntFlowDirectCorrectionTermsForNUA";
3209    intFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();
3210    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");
3211    fNestedLoopsList->Add(fIntFlowDirectCorrectionTermsForNUA[sc]);
3212   } // end of for(Int_t sc=0;sc<2;sc++) 
3213   // Mixed harmonics:
3214   if(fCalculateMixedHarmonics)
3215   {
3216    TString mixedHarmonicsNestedLoopsName = "fMixedHarmonicsNestedLoops";
3217    mixedHarmonicsNestedLoopsName += fAnalysisLabel->Data();
3218    fMixedHarmonicsNestedLoops = new TProfile(mixedHarmonicsNestedLoopsName.Data(),"Mixed harmonics calculated with nested loops",200,0,200); // TBI hardwired 200
3219    fNestedLoopsList->Add(fMixedHarmonicsNestedLoops);
3220   } // end of if(fCalculateMixedHarmonics)
3221  } // end of if(fEvaluateIntFlowNestedLoops)
3222  
3223  // nested loops for differential flow: 
3224  if(fEvaluateDiffFlowNestedLoops)
3225  {
3226   // reduced correlations:
3227   TString diffFlowDirectCorrelationsName = "fDiffFlowDirectCorrelations";
3228   diffFlowDirectCorrelationsName += fAnalysisLabel->Data();
3229   for(Int_t t=0;t<2;t++) // type: RP or POI
3230   { 
3231    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
3232    {
3233     for(Int_t rci=0;rci<4;rci++) // reduced correlation index
3234     {
3235      // reduced correlations:
3236      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");
3237      fDiffFlowDirectCorrelations[t][pe][rci]->SetXTitle(ptEtaFlag[pe].Data());
3238      fNestedLoopsList->Add(fDiffFlowDirectCorrelations[t][pe][rci]); // to be improved (add dedicated list to hold reduced correlations)
3239     } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
3240    } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
3241   } // end of for(Int_t t=0;t<2;t++) // type: RP or POI 
3242   
3243   // correction terms for non-uniform acceptance:
3244   TString diffFlowDirectCorrectionTermsForNUAName = "fDiffFlowDirectCorrectionTermsForNUA";
3245   diffFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();
3246   for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
3247   { 
3248    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
3249    {
3250     for(Int_t sc=0;sc<2;sc++) // sin or cos
3251     {
3252      for(Int_t cti=0;cti<9;cti++) // correction term index
3253      {
3254       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"); 
3255       fNestedLoopsList->Add(fDiffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti]);
3256      }
3257     }
3258    }
3259   }
3260   // other differential correlators: 
3261   TString otherDirectDiffCorrelatorsName = "fOtherDirectDiffCorrelators";
3262   otherDirectDiffCorrelatorsName += fAnalysisLabel->Data();
3263   for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
3264   { 
3265    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
3266    {
3267     for(Int_t sc=0;sc<2;sc++) // sin or cos
3268     {
3269      for(Int_t ci=0;ci<1;ci++) // correlator index
3270      {
3271       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]); 
3272       fNestedLoopsList->Add(fOtherDirectDiffCorrelators[t][pe][sc][ci]);
3273      }
3274     }
3275    }
3276   }
3277   // number of RPs and POIs in selected pt and eta bins for cross-checkings:
3278   TString noOfParticlesInBinName = "fNoOfParticlesInBin";
3279   fNoOfParticlesInBin = new TH1D(noOfParticlesInBinName.Data(),"Number of RPs and POIs in selected p_{T} and #eta bin",4,0,4);
3280   fNoOfParticlesInBin->GetXaxis()->SetBinLabel(1,"# of RPs in p_{T} bin");
3281   fNoOfParticlesInBin->GetXaxis()->SetBinLabel(2,"# of RPs in #eta bin");
3282   fNoOfParticlesInBin->GetXaxis()->SetBinLabel(3,"# of POIs in p_{T} bin");
3283   fNoOfParticlesInBin->GetXaxis()->SetBinLabel(4,"# of POIs in #eta bin");
3284   fNestedLoopsList->Add(fNoOfParticlesInBin);
3285  } // end of if(fEvaluateDiffFlowNestedLoops)
3286
3287 } // end of AliFlowAnalysisWithQCumulants::BookEverythingForNestedLoops()
3288
3289 //=========================================================================================================
3290
3291 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelations()
3292 {
3293  // Calculate in this method all multiparticle azimuthal correlations.
3294  //
3295  // Remark 1: All multiparticle correlations are stored in TProfile fIntFlowCorrelationsAllPro;
3296  // Remark 2: There is a special TProfile fIntFlowCorrelationsPro holding results 
3297  //           only for same harmonic's correlations <<2>>, <<4>>, <<6>> and <<8>>;  
3298  // Remark 3: Binning of fIntFlowCorrelationsAllPro is organized as follows:
3299  // --------------------------------------------------------------------------------------------------------------------
3300  //  1st bin: <2>_{1n|1n} = two1n1n = cos(1n(phi1-phi2))>
3301  //  2nd bin: <2>_{2n|2n} = two2n2n = cos(2n(phi1-phi2))>
3302  //  3rd bin: <2>_{3n|3n} = two3n3n = cos(3n(phi1-phi2))> 
3303  //  4th bin: <2>_{4n|4n} = two4n4n = cos(4n(phi1-phi2))>
3304  //  5th bin:           ----  EMPTY ----
3305  //  6th bin: <3>_{2n|1n,1n} = three2n1n1n = <cos(n(2*phi1-phi2-phi3))>
3306  //  7th bin: <3>_{3n|2n,1n} = three3n2n1n = <cos(n(3*phi1-2*phi2-phi3))>
3307  //  8th bin: <3>_{4n|2n,2n} = three4n2n2n = <cos(n(4*phi1-2*phi2-2*phi3))>
3308  //  9th bin: <3>_{4n|3n,1n} = three4n3n1n = <cos(n(4*phi1-3*phi2-phi3))>
3309  // 10th bin:           ----  EMPTY ----
3310  // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1n = <cos(n(phi1+phi2-phi3-phi4))>
3311  // 12th bin: <4>_{2n,1n|2n,1n} = four2n1n2n1n = <cos(n(2*phi1+phi2-2*phi3-phi4))>
3312  // 13th bin: <4>_{2n,2n|2n,2n} = four2n2n2n2n = <cos(2n(phi1+phi2-phi3-phi4))>
3313  // 14th bin: <4>_{3n|1n,1n,1n} = four3n1n1n1n = <cos(n(3*phi1-phi2-phi3-phi4))> 
3314  // 15th bin: <4>_{3n,1n|3n,1n} = four3n1n3n1n = <cos(n(3*phi1+phi2-3*phi3-phi4))>
3315  // 16th bin: <4>_{3n,1n|2n,2n} = four3n1n2n2n = <cos(n(3*phi1+phi2-2*phi3-2*phi4))>
3316  // 17th bin: <4>_{4n|2n,1n,1n} = four4n2n1n1n = <cos(n(4*phi1-2*phi2-phi3-phi4))>
3317  // 18th bin:           ----  EMPTY ----
3318  // 19th bin: <5>_{2n,1n|1n,1n,1n} = five2n1n1n1n1n = <cos(n(2*phi1+phi2-phi3-phi4-phi5))>
3319  // 20th bin: <5>_{2n,2n|2n,1n,1n} = five2n2n2n1n1n = <cos(n(2*phi1+2*phi2-2*phi3-phi4-phi5))>
3320  // 21st bin: <5>_{3n,1n|2n,1n,1n} = five3n1n2n1n1n = <cos(n(3*phi1+phi2-2*phi3-phi4-phi5))>
3321  // 22nd bin: <5>_{4n|1n,1n,1n,1n} = five4n1n1n1n1n = <cos(n(4*phi1-phi2-phi3-phi4-phi5))>
3322  // 23rd bin:           ----  EMPTY ----
3323  // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = six1n1n1n1n1n1n = <cos(n(phi1+phi2+phi3-phi4-phi5-phi6))>
3324  // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = six2n1n1n2n1n1n = <cos(n(2*phi1+phi2+phi3-2*phi4-phi5-phi6))>
3325  // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = six2n2n1n1n1n1n = <cos(n(2*phi1+2*phi2-phi3-phi4-phi5-phi6))>
3326  // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = six3n1n1n1n1n1n = <cos(n(3*phi1+phi2-phi3-phi4-phi5-phi6))> 
3327  // 28th bin:           ----  EMPTY ----
3328  // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = seven2n1n1n1n1n1n1n =  <cos(n(2*phi1+phi2+phi3-phi4-phi5-phi6-phi7))>
3329  // 30th bin:           ----  EMPTY ----
3330  // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = eight1n1n1n1n1n1n1n1n = <cos(n(phi1+phi2+phi3+phi4-phi5-phi6-phi7-phi8))>
3331  // 32nd bin:           ----  EMPTY ----
3332  //  Extra correlations for v3{5} study: 
3333  // 33rd bin: <4>_{4n,2n|3n,3n} = four4n2n3n3n = <cos(n(4*phi1+2*phi2-3*phi3-3*phi4))>
3334  // 34th bin: <5>_{3n,3n|2n,2n,2n} = five3n3n2n2n2n = <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-2*phi5))> 
3335  //  Extra correlations for Teaney-Yan study: 
3336  // 35th bin: <2>_{5n|5n} = two5n5n = <cos(5n(phi1-phi2)> 
3337  // 36th bin: <2>_{6n|6n} = two6n6n = <cos(6n(phi1-phi2)> 
3338  // 37th bin: <3>_{5n|3n,2n} = three5n3n2n = <cos(n(5*phi1-3*phi2-2*phi3)> 
3339  // 38th bin: <3>_{5n|4n,1n} = three5n4n1n = <cos(n(5*phi1-4*phi2-1*phi3)> 
3340  // 39th bin: <3>_{6n|3n,3n} = three6n3n3n = <cos(n(6*phi1-3*phi2-3*phi3)> 
3341  // 40th bin: <3>_{6n|4n,2n} = three6n4n2n = <cos(n(6*phi1-4*phi2-2*phi3)> 
3342  // 41st bin: <3>_{6n|5n,1n} = three6n5n1n = <cos(n(6*phi1-5*phi2-1*phi3)>
3343  // 42nd bin: <4>_{6n|3n,2n,1n} = four6n3n2n1n = <cos(n(6*phi1-3*phi2-2*phi3-1*phi4)>
3344  // 43rd bin: <4>_{3n,2n|3n,2n} = four3n2n3n2n = <cos(n(3*phi1+2*phi2-3*phi3-2*phi4)>
3345  // 44th bin: <4>_{4n,1n|3n,2n} = four4n1n3n2n = <cos(n(4*phi1+1*phi2-3*phi3-2*phi4)>
3346  // 45th bin: <4>_{3n,3n|3n,3n} = four3n3n3n3n = <cos(3n*(phi1+phi2-phi3-phi4))> 
3347  // 46th bin: <4>_{4n,2n|3n,3n} = four4n2n3n3n = <cos(n(4*phi1+2*phi2-3*phi3-3*phi4)>
3348  // 47th bin: <4>_{5n,1n|3n,3n} = four5n1n3n3n = <cos(n(5*phi1+1*phi2-3*phi3-3*phi4)>
3349  // 48th bin: <4>_{4n,2n|4n,2n} = four4n2n4n2n = <cos(n(4*phi1+2*phi2-4*phi3-2*phi4)> 
3350  // 49th bin: <4>_{5n,1n|4n,2n} = four5n1n4n2n = <cos(n(5*phi1+1*phi2-4*phi3-2*phi4)>
3351  // 50th bin: <4>_{5n|3n,1n,1n} = four5n3n1n1n = <cos(n(5*phi1-3*phi2-1*phi3-1*phi4)>
3352  // 51st bin: <4>_{5n|2n,2n,1n} = four5n2n2n1n = <cos(n(5*phi1-2*phi2-2*phi3-1*phi4)>
3353  // 52nd bin: <4>_{5n,1n|5n,1n} = four5n1n5n1n = <cos(n(5*phi1+1*phi2-5*phi3-1*phi4)>
3354  // 53rd bin: <5>_{3n,3n|3n,2n,1n} = five3n3n3n2n1n = <cos(n(3*phi1+3*phi2-3*phi3-2*phi4-1*phi5)>
3355  // 54th bin: <5>_{4n,2n|3n,2n,1n} = five4n2n3n2n1n = <cos(n(4*phi1+2*phi2-3*phi3-2*phi4-1*phi5)>
3356  // 55th bin: <5>_{3n,2n|3n,1n,1n} = five3n2n3n1n1n = <cos(n(3*phi1+2*phi2-3*phi3-1*phi4-1*phi5)>
3357  // 56th bin: <5>_{3n,2n|2n,2n,1n} = five3n2n2n2n1n = <cos(n(3*phi1+2*phi2-2*phi3-2*phi4-1*phi5)>
3358  // 57th bin: <5>_{5n,1n|3n,2n,1n} = five5n1n3n2n1n = <cos(n(5*phi1+1*phi2-3*phi3-2*phi4-1*phi5)>
3359  // 58th bin: <6>_{3n,2n,1n|3n,2n,1n} = six3n2n1n3n2n1n = <cos(n(3*phi1+2*phi2+1*phi3-3*phi4-2*phi5-1*phi6)>
3360  //  Extra correlations for Teaney-Yan study (B): 
3361  // 59th bin: <4>_{6n|4n,1n,1n} = four6n4n1n1n = <cos(n(6*phi1-4*phi2-1*phi3-1*phi4)>
3362  // 60th bin: <4>_{6n|2n,2n,2n} = four6n2n2n2n = <cos(n(6*phi1-2*phi2-2*phi3-2*phi4)>
3363  // 61st bin: <5>_{6n|2n,2n,1n,1n} = five6n2n2n1n1n = <cos(n(6*phi1-2*phi2-2*phi3-1*phi4-1*phi5)>
3364  // 62nd bin: <5>_{4n,1n,1n|3n,3n} = five4n1n1n3n3n = <cos(n(4*phi1+1*phi2+1*phi3-3*phi4-3*phi5)>
3365  // 63rd bin: <6>_{3n,3n|2n,2n,1n,1n} = six3n3n2n2n1n1n = <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-1*phi5-1*phi6)>
3366  // --------------------------------------------------------------------------------------------------------------------
3367
3368  // Multiplicity of an event: 
3369  Double_t dMult = (*fSpk)(0,0);
3370  // Real parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n, 4n, 5n and 6n: 
3371  Double_t dReQ1n = (*fReQ)(0,0);
3372  Double_t dReQ2n = (*fReQ)(1,0);
3373  Double_t dReQ3n = (*fReQ)(2,0);
3374  Double_t dReQ4n = (*fReQ)(3,0);
3375  Double_t dReQ5n = (*fReQ)(4,0); 
3376  Double_t dReQ6n = (*fReQ)(5,0);
3377  // Imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n, 4n, 5n and 6n:
3378  Double_t dImQ1n = (*fImQ)(0,0);
3379  Double_t dImQ2n = (*fImQ)(1,0);
3380  Double_t dImQ3n = (*fImQ)(2,0);
3381  Double_t dImQ4n = (*fImQ)(3,0);
3382  Double_t dImQ5n = (*fImQ)(4,0); 
3383  Double_t dImQ6n = (*fImQ)(5,0);
3384
3385  // Multiplicity bin of an event (relevant for all histos vs M): 
3386  Double_t dMultiplicityBin = 0.;
3387  if(!fMultiplicityIsRefMultiplicity)
3388  {
3389   dMultiplicityBin = dMult+0.5;
3390  } else
3391    {
3392     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
3393    }
3394   
3395  // Real parts of expressions involving various combinations of Q-vectors which appears
3396  // simultaneously in several equations for multiparticle correlations bellow: 
3397  // Re[Q_{2n}Q_{n}^*Q_{n}^*]
3398  Double_t reQ2nQ1nstarQ1nstar = pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n; 
3399  // Re[Q_{6n}Q_{3n}^*Q_{3n}^*]
3400  Double_t reQ6nQ3nstarQ3nstar = pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n;  
3401  // Re[Q_{4n}Q_{2n}^*Q_{2n}^*]
3402  Double_t reQ4nQ2nstarQ2nstar = pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n;
3403  // Re[Q_{4n}Q_{3n}^*Q_{n}^*]
3404  Double_t reQ4nQ3nstarQ1nstar = dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);
3405  // Re[Q_{3n}Q_{2n}^*Q_{n}^*]
3406  Double_t reQ3nQ2nstarQ1nstar = dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
3407                               + dImQ3n*dImQ2n*dReQ1n; 
3408  // Re[Q_{5n}Q_{3n}^*Q_{2n}^*]
3409  Double_t reQ5nQ3nstarQ2nstar = dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n
3410                               + dImQ5n*dImQ2n*dReQ3n;                             
3411  // Re[Q_{5n}Q_{4n}^*Q_{1n}^*]
3412  Double_t reQ5nQ4nstarQ1nstar = dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n
3413                               + dImQ5n*dImQ4n*dReQ1n;                              
3414  // Re[Q_{6n}Q_{5n}^*Q_{1n}^*]                              
3415  Double_t reQ6nQ5nstarQ1nstar = dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n
3416                               + dImQ6n*dImQ5n*dReQ1n;
3417  // Re[Q_{6n}Q_{4n}^*Q_{2n}^*]                              
3418  Double_t reQ6nQ4nstarQ2nstar = dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
3419                               + dImQ6n*dImQ4n*dReQ2n;
3420  // Re[Q_{3n}Q_{n}Q_{2n}^*Q_{2n}^*]
3421  Double_t reQ3nQ1nQ2nstarQ2nstar = (pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
3422                                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);                                
3423  // Re[Q_{3n}Q_{n}^*Q_{n}^*Q_{n}^*]
3424  Double_t reQ3nQ1nstarQ1nstarQ1nstar = dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
3425                                      + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3);
3426  // Re[Q_{6n}Q_{2n}^*Q_{2n}^*Q_{2n}^*]
3427  Double_t reQ6nQ2nstarQ2nstarQ2nstar = dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
3428                                      + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3);
3429  // Re[Q_{4n}Q_{2n}^*Q_{n}^*Q_{n}^*]
3430  Double_t reQ4nQ2nstarQ1nstarQ1nstar = (dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
3431                                      + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n);  
3432  // Re[Q_{4n}Q_{2n}^*Q_{3n}^*Q_{3n}^*]
3433  Double_t reQ4nQ2nQ3nstarQ3nstar = (dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
3434                                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n;                    
3435  // Re[Q_{4n}Q_{n}Q_{3n}^*Q_{2n}^*]
3436  Double_t reQ4nQ1nQ3nstarQ2nstar = dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
3437                                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
3438                                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
3439                                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n;
3440  // Re[Q_{5n}Q_{n}Q_{4n}^*Q_{2n}^*]
3441  Double_t reQ5nQ1nQ4nstarQ2nstar = dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
3442                                  + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
3443                                  - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n 
3444                                  + dImQ1n*dImQ2n*dReQ4n*dReQ5n+dReQ1n*dReQ2n*dReQ4n*dReQ5n;                                  
3445  // Re[Q_{5n}Q_{n}Q_{3n}^*Q_{3n}^*]                                  
3446  Double_t reQ5nQ1nQ3nstarQ3nstar = dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
3447                                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
3448                                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n;
3449  // Re[Q_{5n}Q_{3n}^*Q_{n}^*Q_{n}^*]                                  
3450  Double_t reQ5nQ3nstarQ1nstarQ1nstar = -pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
3451                                      + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
3452                                      - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n;                     
3453  // Re[Q_{5n}Q_{2n}^*Q_{2n}^*Q_{n}^*]                                  
3454  Double_t reQ5nQ2nstarQ2nstarQ1nstar = -pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
3455                                      + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
3456                                      - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n;                                     
3457  // Re[Q_{6n}Q_{4n}^*Q_{n}^*Q_{n}^*]                                  
3458  Double_t reQ6nQ4nstarQ1nstarQ1nstar = -pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
3459                                      +  2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
3460                                      -  pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n;
3461  // |Q_{2n}|^2 |Q_{n}|^2
3462  Double_t dQ2nQ1nQ2nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
3463  // |Q_{4n}|^2 |Q_{2n}|^2
3464  Double_t dQ4nQ2nQ4nstarQ2nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.));
3465  // |Q_{3n}|^2 |Q_{2n}|^2
3466  Double_t dQ3nQ2nQ3nstarQ2nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.));
3467  // |Q_{5n}|^2 |Q_{n}|^2
3468  Double_t dQ5nQ1nQ5nstarQ1nstar = (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
3469  // |Q_{3n}|^2 |Q_{n}|^2
3470  Double_t dQ3nQ1nQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
3471  // Re[Q_{2n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*]
3472  Double_t reQ2nQ1nQ1nstarQ1nstarQ1nstar = (dReQ2n*dReQ1n-dImQ2n*dImQ1n)*(pow(dReQ1n,3)-3.*dReQ1n*pow(dImQ1n,2))
3473                                         + (dReQ2n*dImQ1n+dReQ1n*dImQ2n)*(3.*dImQ1n*pow(dReQ1n,2)-pow(dImQ1n,3)); 
3474  // Re[Q_{2n}Q_{2n}Q_{2n}^*Q_{n}^*Q_{n}^*]
3475  Double_t reQ2nQ2nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
3476                                         * (dReQ2n*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) + 2.*dImQ2n*dReQ1n*dImQ1n);
3477  // Re[Q_{4n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
3478  Double_t reQ4nQ1nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,4.)*dReQ4n-6.*pow(dReQ1n,2.)*dReQ4n*pow(dImQ1n,2.)
3479                                             + pow(dImQ1n,4.)*dReQ4n+4.*pow(dReQ1n,3.)*dImQ1n*dImQ4n
3480                                             - 4.*pow(dImQ1n,3.)*dReQ1n*dImQ4n;
3481  // Re[Q_{3n}Q_{n}Q_{2n}^*Q_{n}^*Q_{n}^*]
3482  Double_t reQ3nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
3483                                         * (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n
3484                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n);
3485  // Re[Q_{6n}Q_{n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
3486  Double_t reQ6nQ3nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
3487                                      - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
3488                                      + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
3489                                      + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n;
3490  // Re[Q_{3n}Q_{3n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
3491  Double_t reQ3nQ3nQ3nstarQ2nstarQ1nstar = (pow(dImQ3n,2.)+pow(dReQ3n,2.))
3492                                         * (dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n
3493                                         - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n);   
3494  // Re[Q_{3n}Q_{3n}Q_{2n}^*Q_{2n}^*Q_{2n}^*]
3495  Double_t reQ3nQ3nQ2nstarQ2nstarQ2nstar = pow(dReQ2n,3.)*pow(dReQ3n,2.) 
3496                                         - 3.*dReQ2n*pow(dReQ3n,2.)*pow(dImQ2n,2.)
3497                                         + 6.*pow(dReQ2n,2.)*dReQ3n*dImQ2n*dImQ3n 
3498                                         - 2.*dReQ3n*pow(dImQ2n,3.)*dImQ3n-pow(dReQ2n,3.)*pow(dImQ3n,2.) 
3499                                         + 3.*dReQ2n*pow(dImQ2n,2.)*pow(dImQ3n,2.);
3500  // Re[Q_{4n}Q_{2n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
3501  Double_t reQ4nQ2nQ3nstarQ2nstarQ1nstar = (pow(dImQ2n,2.)+pow(dReQ2n,2.))
3502                                         * (dImQ3n*dImQ4n*dReQ1n+dImQ1n*dImQ4n*dReQ3n 
3503                                         - dImQ1n*dImQ3n*dReQ4n+dReQ1n*dReQ3n*dReQ4n);
3504  // Re[Q_{3n}Q_{2n}Q_{3n}^*Q_{n}^*Q_{n}^*]
3505  Double_t reQ3nQ2nQ3nstarQ1nstarQ1nstar = -(pow(dImQ3n,2.)+pow(dReQ3n,2.))
3506                                         * (-2.*dImQ1n*dImQ2n*dReQ1n+pow(dImQ1n,2.)*dReQ2n-pow(dReQ1n,2.)*dReQ2n);                              
3507  // Re[Q_{3n}Q_{2n}Q_{2n}^*Q_{2n}^*Q_{n}^*]
3508  Double_t reQ3nQ2nQ2nstarQ2nstarQ1nstar = (pow(dImQ2n,2.)+pow(dReQ2n,2.))
3509                                         * (dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n 
3510                                         - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n);
3511  // Re[Q_{5n}Q_{n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
3512  Double_t reQ5nQ1nQ3nstarQ2nstarQ1nstar = (pow(dImQ1n,2.)+pow(dReQ1n,2.))
3513                                         * (dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n 
3514                                         - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n);   
3515  // Re[Q_{2n}Q_{2n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
3516  Double_t reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)*dReQ2n-2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)
3517                                                + dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dImQ2n)
3518                                                * (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)
3519                                                - dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n+pow(dImQ1n,2.)*dImQ2n); 
3520  // Re[Q_{3n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
3521  Double_t reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
3522                                                * (pow(dReQ1n,3.)*dReQ3n-3.*dReQ1n*dReQ3n*pow(dImQ1n,2.)
3523                                                + 3.*pow(dReQ1n,2.)*dImQ1n*dImQ3n-pow(dImQ1n,3.)*dImQ3n);
3524  // |Q_{2n}|^2 |Q_{n}|^4
3525  Double_t dQ2nQ1nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.); 
3526  // |Q_{3n}|^2 |Q_{2n}|^2 |Q_{n}|^2
3527  Double_t dQ3nQ2nQ1nQ3nstarQ2nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3528                                           * (pow(dReQ1n,2.)+pow(dImQ1n,2.));
3529  // Re[Q_{2n}Q_{n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
3530  Double_t reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
3531                                                   * (pow(dReQ1n,2.)*dReQ2n-dReQ2n*pow(dImQ1n,2.)
3532                                                   + 2.*dReQ1n*dImQ1n*dImQ2n);                                                  
3533  // Re[Q_{6n}Q_{2n}^*Q_{2n}^*Q_{n}^*Q_{n}^*]
3534  Double_t reQ6nQ2nstarQ2nstarQ1nstarQ1nstar = pow(dReQ1n*dReQ2n,2.)*dReQ6n-pow(dReQ2n*dImQ1n,2.)*dReQ6n
3535                                             - 4.*dReQ1n*dReQ2n*dReQ6n*dImQ1n*dImQ2n 
3536                                             - pow(dReQ1n*dImQ2n,2.)*dReQ6n+pow(dImQ1n*dImQ2n,2.)*dReQ6n
3537                                             + 2.*dReQ1n*pow(dReQ2n,2.)*dImQ1n*dImQ6n
3538                                             + 2.*pow(dReQ1n,2.)*dReQ2n*dImQ2n*dImQ6n 
3539                                             - 2.*dReQ2n*pow(dImQ1n,2.)*dImQ2n*dImQ6n 
3540                                             - 2.*dReQ1n*dImQ1n*pow(dImQ2n,2.)*dImQ6n;       
3541  // Re[Q_{4n}Q_{1n}Q_{1n}Q_{3n}^*Q_{3n}^*]
3542  Double_t reQ4nQ1nQ1nQ3nstarQ3nstar = pow(dReQ1n*dReQ3n,2.)*dReQ4n-pow(dReQ3n*dImQ1n,2.)*dReQ4n  
3543                                     + 4.*dReQ1n*dReQ3n*dReQ4n*dImQ1n*dImQ3n 
3544                                     - pow(dReQ1n*dImQ3n,2.)*dReQ4n+pow(dImQ1n*dImQ3n,2.)*dReQ4n  
3545                                     - 2.*dReQ1n*pow(dReQ3n,2.)*dImQ1n*dImQ4n 
3546                                     + 2.*pow(dReQ1n,2.)*dReQ3n*dImQ3n*dImQ4n 
3547                                     - 2.*dReQ3n*pow(dImQ1n,2.)*dImQ3n*dImQ4n 
3548                                     + 2.*dReQ1n*dImQ1n*pow(dImQ3n,2.)*dImQ4n;
3549  // Re[Q_{3n}Q_{3n}Q_{2n}^*Q_{2n}^*Q_{1n}^*Q_{1n}^*]
3550  Double_t reQ3nQ3nQ2nstarQ2nstarQ1nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ2n*dReQ3n*dImQ1n-dReQ1n*dReQ3n*dImQ2n 
3551                                                - dReQ3n*dImQ1n*dImQ2n+dReQ1n*dReQ2n*dImQ3n+dReQ2n*dImQ1n*dImQ3n 
3552                                                + dReQ1n*dImQ2n*dImQ3n-dImQ1n*dImQ2n*dImQ3n)*(dReQ1n*dReQ2n*dReQ3n 
3553                                                + dReQ2n*dReQ3n*dImQ1n+dReQ1n*dReQ3n*dImQ2n-dReQ3n*dImQ1n*dImQ2n 
3554                                                - dReQ1n*dReQ2n*dImQ3n+dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n 
3555                                                + dImQ1n*dImQ2n*dImQ3n);
3556     
3557  // Results for multiparticle azimuthal correlations:
3558  // 2-particle:
3559  Double_t two1n1n = 0.; // <cos(n(phi1-phi2))>
3560  Double_t two2n2n = 0.; // <cos(2n(phi1-phi2))>
3561  Double_t two3n3n = 0.; // <cos(3n(phi1-phi2))>
3562  Double_t two4n4n = 0.; // <cos(4n(phi1-phi2))>
3563  if(dMult>1)
3564  {
3565   two1n1n = (pow(dReQ1n,2.)+pow(dImQ1n,2.)-dMult)/(dMult*(dMult-1.)); 
3566   two2n2n = (pow(dReQ2n,2.)+pow(dImQ2n,2.)-dMult)/(dMult*(dMult-1.)); 
3567   two3n3n = (pow(dReQ3n,2.)+pow(dImQ3n,2.)-dMult)/(dMult*(dMult-1.)); 
3568   two4n4n = (pow(dReQ4n,2.)+pow(dImQ4n,2.)-dMult)/(dMult*(dMult-1.)); 
3569   // Average 2-particle correlations for single event: 
3570   fIntFlowCorrelationsAllEBE->SetBinContent(1,two1n1n);
3571   fIntFlowCorrelationsAllEBE->SetBinContent(2,two2n2n);
3572   fIntFlowCorrelationsAllEBE->SetBinContent(3,two3n3n);
3573   fIntFlowCorrelationsAllEBE->SetBinContent(4,two4n4n);         
3574   // Average 2-particle correlations for all events:      
3575   fIntFlowCorrelationsAllPro->Fill(0.5,two1n1n,dMult*(dMult-1.));
3576   fIntFlowCorrelationsAllPro->Fill(1.5,two2n2n,dMult*(dMult-1.)); 
3577   fIntFlowCorrelationsAllPro->Fill(2.5,two3n3n,dMult*(dMult-1.)); 
3578   fIntFlowCorrelationsAllPro->Fill(3.5,two4n4n,dMult*(dMult-1.)); 
3579   // Store separetately <2>:
3580   fIntFlowCorrelationsEBE->SetBinContent(1,two1n1n); // <2>  
3581   // Testing other multiplicity weights:
3582   Double_t mWeight2p = 0.;
3583   if(!strcmp(fMultiplicityWeight->Data(),"combinations"))
3584   {
3585    mWeight2p = dMult*(dMult-1.);
3586   } else if(!strcmp(fMultiplicityWeight->Data(),"unit"))
3587     {
3588      mWeight2p = 1.;    
3589     } else if(!strcmp(fMultiplicityWeight->Data(),"multiplicity"))
3590       {
3591        mWeight2p = dMult;           
3592       }          
3593   fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(1,mWeight2p); // eW_<2>
3594   fIntFlowCorrelationsPro->Fill(0.5,two1n1n,mWeight2p);
3595   fIntFlowSquaredCorrelationsPro->Fill(0.5,two1n1n*two1n1n,mWeight2p);
3596   if(fCalculateCumulantsVsM)
3597   {
3598    fIntFlowCorrelationsVsMPro[0]->Fill(dMultiplicityBin,two1n1n,mWeight2p);
3599    fIntFlowSquaredCorrelationsVsMPro[0]->Fill(dMultiplicityBin,two1n1n*two1n1n,mWeight2p);
3600   } 
3601   if(fCalculateAllCorrelationsVsM)
3602   {
3603    fIntFlowCorrelationsAllVsMPro[0]->Fill(dMultiplicityBin,two1n1n,mWeight2p);
3604    fIntFlowCorrelationsAllVsMPro[1]->Fill(dMultiplicityBin,two2n2n,mWeight2p);
3605    fIntFlowCorrelationsAllVsMPro[2]->Fill(dMultiplicityBin,two3n3n,mWeight2p);
3606    fIntFlowCorrelationsAllVsMPro[3]->Fill(dMultiplicityBin,two4n4n,mWeight2p);
3607   }  
3608  } // end of if(dMult>1)
3609  
3610  // 3-particle:
3611  Double_t three2n1n1n = 0.; // <cos(n(2*phi1-phi2-phi3))>
3612  Double_t three3n2n1n = 0.; // <cos(n(3*phi1-2*phi2-phi3))>
3613  Double_t three4n2n2n = 0.; // <cos(n(4*phi1-2*phi2-2*phi3))>
3614  Double_t three4n3n1n = 0.; // <cos(n(4*phi1-3*phi2-phi3))> 
3615  if(dMult>2)
3616  {
3617   three2n1n1n = (reQ2nQ1nstarQ1nstar-2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3618               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
3619               / (dMult*(dMult-1.)*(dMult-2.));                     
3620   three3n2n1n = (reQ3nQ2nstarQ1nstar-(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3621               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))
3622               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
3623               / (dMult*(dMult-1.)*(dMult-2.));
3624   three4n2n2n = (reQ4nQ2nstarQ2nstar-2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3625               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*dMult)
3626               / (dMult*(dMult-1.)*(dMult-2.)); 
3627   three4n3n1n = (reQ4nQ3nstarQ1nstar-(pow(dReQ4n,2.)+pow(dImQ4n,2.))
3628               - (pow(dReQ3n,2.)+pow(dImQ3n,2.))
3629               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
3630               / (dMult*(dMult-1.)*(dMult-2.));              
3631   // Average 3-particle correlations for single event: 
3632   fIntFlowCorrelationsAllEBE->SetBinContent(6,three2n1n1n);
3633   fIntFlowCorrelationsAllEBE->SetBinContent(7,three3n2n1n);
3634   fIntFlowCorrelationsAllEBE->SetBinContent(8,three4n2n2n);
3635   fIntFlowCorrelationsAllEBE->SetBinContent(9,three4n3n1n);
3636   // Average 3-particle correlations for all events:                
3637   fIntFlowCorrelationsAllPro->Fill(5.5,three2n1n1n,dMult*(dMult-1.)*(dMult-2.)); 
3638   fIntFlowCorrelationsAllPro->Fill(6.5,three3n2n1n,dMult*(dMult-1.)*(dMult-2.));
3639   fIntFlowCorrelationsAllPro->Fill(7.5,three4n2n2n,dMult*(dMult-1.)*(dMult-2.)); 
3640   fIntFlowCorrelationsAllPro->Fill(8.5,three4n3n1n,dMult*(dMult-1.)*(dMult-2.));  
3641   // Average 3-particle correlations vs M for all events:                
3642   if(fCalculateAllCorrelationsVsM)
3643   {
3644    fIntFlowCorrelationsAllVsMPro[5]->Fill(dMultiplicityBin,three2n1n1n,dMult*(dMult-1.)*(dMult-2.));
3645    fIntFlowCorrelationsAllVsMPro[6]->Fill(dMultiplicityBin,three3n2n1n,dMult*(dMult-1.)*(dMult-2.));
3646    fIntFlowCorrelationsAllVsMPro[7]->Fill(dMultiplicityBin,three4n2n2n,dMult*(dMult-1.)*(dMult-2.));
3647    fIntFlowCorrelationsAllVsMPro[8]->Fill(dMultiplicityBin,three4n3n1n,dMult*(dMult-1.)*(dMult-2.));
3648   }    
3649  } // end of if(dMult>2)
3650  
3651  // 4-particle:
3652  Double_t four1n1n1n1n = 0.; // <cos(n(phi1+phi2-phi3-phi4))>
3653  Double_t four2n2n2n2n = 0.; // <cos(2n(phi1+phi2-phi3-phi4))>
3654  Double_t four2n1n2n1n = 0.; // <cos(n(2*phi1+phi2-2*phi3-phi4))> 
3655  Double_t four3n1n1n1n = 0.; // <cos(n(3*phi1-phi2-phi3-phi4))> 
3656  Double_t four4n2n1n1n = 0.; // <cos(n(4*phi1-2*phi2-phi3-phi4))> 
3657  Double_t four3n1n2n2n = 0.; // <cos(n(3*phi1+phi2-2*phi3-2*phi4))> 
3658  Double_t four3n1n3n1n = 0.; // <cos(n(3*phi1+phi2-3*phi3-phi4))>    
3659  if(dMult>3)
3660  {
3661   four1n1n1n1n = (2.*dMult*(dMult-3.)+pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ1n,2.)
3662                + pow(dImQ1n,2.))-2.*reQ2nQ1nstarQ1nstar+(pow(dReQ2n,2.)+pow(dImQ2n,2.)))
3663                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));     
3664   four2n2n2n2n = (2.*dMult*(dMult-3.)+pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ2n,2.)
3665                + pow(dImQ2n,2.))-2.*reQ4nQ2nstarQ2nstar+(pow(dReQ4n,2.)+pow(dImQ4n,2.)))
3666                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));
3667   four2n1n2n1n = (dQ2nQ1nQ2nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar-2.*reQ2nQ1nstarQ1nstar)
3668                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
3669                - ((dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3670                + (dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-(pow(dReQ3n,2.)+pow(dImQ3n,2.)))
3671                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
3672                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));
3673   four3n1n1n1n = (reQ3nQ1nstarQ1nstarQ1nstar-3.*reQ3nQ2nstarQ1nstar-3.*reQ2nQ1nstarQ1nstar
3674                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3675                + 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
3676                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3677   four4n2n1n1n = (reQ4nQ2nstarQ1nstarQ1nstar-2.*reQ4nQ3nstarQ1nstar-reQ4nQ2nstarQ2nstar-2.*reQ3nQ2nstarQ1nstar)
3678                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
3679                - (reQ2nQ1nstarQ1nstar-2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3680                - 3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
3681                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
3682                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));
3683   four3n1n2n2n = (reQ3nQ1nQ2nstarQ2nstar-reQ4nQ2nstarQ2nstar-reQ4nQ3nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar)
3684                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
3685                - (2.*reQ2nQ1nstarQ1nstar-(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3686                - 4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
3687                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
3688                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.)); 
3689   four3n1n3n1n = ((pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3690                - 2.*reQ4nQ3nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar
3691                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3692                + pow(dReQ2n,2.)+pow(dImQ2n,2.)-(dMult-4.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3693                + dMult*(dMult-6.))
3694                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));           
3695   // Average 4-particle correlations for single event: 
3696   fIntFlowCorrelationsAllEBE->SetBinContent(11,four1n1n1n1n);
3697   fIntFlowCorrelationsAllEBE->SetBinContent(12,four2n1n2n1n);
3698   fIntFlowCorrelationsAllEBE->SetBinContent(13,four2n2n2n2n);
3699   fIntFlowCorrelationsAllEBE->SetBinContent(14,four3n1n1n1n);
3700   fIntFlowCorrelationsAllEBE->SetBinContent(15,four3n1n3n1n);
3701   fIntFlowCorrelationsAllEBE->SetBinContent(16,four3n1n2n2n);
3702   fIntFlowCorrelationsAllEBE->SetBinContent(17,four4n2n1n1n);       
3703   // Average 4-particle correlations for all events:                
3704   fIntFlowCorrelationsAllPro->Fill(10.5,four1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3705   fIntFlowCorrelationsAllPro->Fill(11.5,four2n1n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3706   fIntFlowCorrelationsAllPro->Fill(12.5,four2n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3707   fIntFlowCorrelationsAllPro->Fill(13.5,four3n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3708   fIntFlowCorrelationsAllPro->Fill(14.5,four3n1n3n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3709   fIntFlowCorrelationsAllPro->Fill(15.5,four3n1n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
3710   fIntFlowCorrelationsAllPro->Fill(16.5,four4n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
3711   // Average 4-particle correlations vs M for all events:                
3712   if(fCalculateAllCorrelationsVsM)
3713   {
3714    fIntFlowCorrelationsAllVsMPro[10]->Fill(dMultiplicityBin,four1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3715    fIntFlowCorrelationsAllVsMPro[11]->Fill(dMultiplicityBin,four2n1n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3716    fIntFlowCorrelationsAllVsMPro[12]->Fill(dMultiplicityBin,four2n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3717    fIntFlowCorrelationsAllVsMPro[13]->Fill(dMultiplicityBin,four3n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3718    fIntFlowCorrelationsAllVsMPro[14]->Fill(dMultiplicityBin,four3n1n3n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3719    fIntFlowCorrelationsAllVsMPro[15]->Fill(dMultiplicityBin,four3n1n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3720    fIntFlowCorrelationsAllVsMPro[16]->Fill(dMultiplicityBin,four4n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
3721   }       
3722   // Store separetately <4>:
3723   fIntFlowCorrelationsEBE->SetBinContent(2,four1n1n1n1n); // <4>
3724   // Testing other multiplicity weights:
3725   Double_t mWeight4p = 0.;
3726   if(!strcmp(fMultiplicityWeight->Data(),"combinations"))
3727   {
3728    mWeight4p = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.);
3729   } else if(!strcmp(fMultiplicityWeight->Data(),"unit"))
3730     {
3731      mWeight4p = 1.;    
3732     } else if(!strcmp(fMultiplicityWeight->Data(),"multiplicity"))
3733       {
3734        mWeight4p = dMult;           
3735       }      
3736   fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(2,mWeight4p); // eW_<4>
3737   fIntFlowCorrelationsPro->Fill(1.5,four1n1n1n1n,mWeight4p);
3738   fIntFlowSquaredCorrelationsPro->Fill(1.5,four1n1n1n1n*four1n1n1n1n,mWeight4p);
3739   if(fCalculateCumulantsVsM)
3740   {
3741    fIntFlowCorrelationsVsMPro[1]->Fill(dMultiplicityBin,four1n1n1n1n,mWeight4p);
3742    fIntFlowSquaredCorrelationsVsMPro[1]->Fill(dMultiplicityBin,four1n1n1n1n*four1n1n1n1n,mWeight4p);
3743   }   
3744  } // end of if(dMult>3)
3745
3746  // 5-particle:
3747  Double_t five2n1n1n1n1n = 0.; // <cos(n(2*phi1+phi2-phi3-phi4-phi5))>
3748  Double_t five2n2n2n1n1n = 0.; // <cos(n(2*phi1+2*phi2-2*phi3-phi4-phi5))>
3749  Double_t five3n1n2n1n1n = 0.; // <cos(n(3*phi1+phi2-2*phi3-phi4-phi5))>
3750  Double_t five4n1n1n1n1n = 0.; // <cos(n(4*phi1-phi2-phi3-phi4-phi5))>
3751  if(dMult>4)
3752  {            
3753   five2n1n1n1n1n = (reQ2nQ1nQ1nstarQ1nstarQ1nstar-reQ3nQ1nstarQ1nstarQ1nstar+5.*reQ3nQ2nstarQ1nstar
3754                  - 3.*(dMult-5.)*reQ2nQ1nstarQ1nstar-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3755                  - 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))     
3756                  + 3.*(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3757                  - 3.*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
3758                  + 6.*(2.*dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult*(dMult-4.))
3759                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
3760   five2n2n2n1n1n = (reQ2nQ2nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-2.*reQ3nQ1nQ2nstarQ2nstar
3761                  + 3.*reQ4nQ2nstarQ2nstar+8.*reQ3nQ2nstarQ1nstar+2.*reQ4nQ3nstarQ1nstar
3762                  - 2.*(dMult-6.)*reQ2nQ1nstarQ1nstar
3763                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3764                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)
3765                  + 2.*(3.*dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3766                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3767                  + 4.*(dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
3768                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
3769   five4n1n1n1n1n = (reQ4nQ1nstarQ1nstarQ1nstarQ1nstar-6.*reQ4nQ2nstarQ1nstarQ1nstar-4.*reQ3nQ1nstarQ1nstarQ1nstar
3770                  + 8.*reQ4nQ3nstarQ1nstar+3.*reQ4nQ2nstarQ2nstar+12.*reQ3nQ2nstarQ1nstar+12.*reQ2nQ1nstarQ1nstar
3771                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-8.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3772                  - 12.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-24.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+24.*dMult)
3773                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
3774   five3n1n2n1n1n = (reQ3nQ1nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ3nQ1nstarQ1nstarQ1nstar
3775                  - reQ3nQ1nQ2nstarQ2nstar+4.*reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar
3776                  - (2.*dMult-13.)*reQ3nQ2nstarQ1nstar+7.*reQ2nQ1nstarQ1nstar
3777                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
3778                  + 2.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3779                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3780                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3781                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3782                  - pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
3783                  + 2.*(3.*dMult-11.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
3784                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));                 
3785   // Average 5-particle correlations for single event: 
3786   fIntFlowCorrelationsAllEBE->SetBinContent(19,five2n1n1n1n1n);
3787   fIntFlowCorrelationsAllEBE->SetBinContent(20,five2n2n2n1n1n);
3788   fIntFlowCorrelationsAllEBE->SetBinContent(21,five3n1n2n1n1n);
3789   fIntFlowCorrelationsAllEBE->SetBinContent(22,five4n1n1n1n1n);        
3790   // Average 5-particle correlations for all events:                         
3791   fIntFlowCorrelationsAllPro->Fill(18.5,five2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
3792   fIntFlowCorrelationsAllPro->Fill(19.5,five2n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
3793   fIntFlowCorrelationsAllPro->Fill(20.5,five3n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
3794   fIntFlowCorrelationsAllPro->Fill(21.5,five4n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
3795   // Average 5-particle correlations vs M for all events:                
3796   if(fCalculateAllCorrelationsVsM)
3797   {
3798    fIntFlowCorrelationsAllVsMPro[18]->Fill(dMultiplicityBin,five2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
3799    fIntFlowCorrelationsAllVsMPro[19]->Fill(dMultiplicityBin,five2n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
3800    fIntFlowCorrelationsAllVsMPro[20]->Fill(dMultiplicityBin,five3n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
3801    fIntFlowCorrelationsAllVsMPro[21]->Fill(dMultiplicityBin,five4n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
3802   }    
3803  } // end of if(dMult>4)
3804     
3805  // 6-particle:
3806  Double_t six1n1n1n1n1n1n = 0.; // <cos(n(phi1+phi2+phi3-phi4-phi5-phi6))>
3807  Double_t six2n2n1n1n1n1n = 0.; // <cos(n(2*phi1+2*phi2-phi3-phi4-phi5-phi6))>
3808  Double_t six3n1n1n1n1n1n = 0.; // <cos(n(3*phi1+phi2-phi3-phi4-phi5-phi6))>
3809  Double_t six2n1n1n2n1n1n = 0.; // <cos(n(2*phi1+phi2+phi3-2*phi4-phi5-phi6))>
3810  if(dMult>5)
3811  {
3812   six1n1n1n1n1n1n = (pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),3.)-6.*reQ2nQ1nQ1nstarQ1nstarQ1nstar
3813                   + 4.*reQ3nQ1nstarQ1nstarQ1nstar-12.*reQ3nQ2nstarQ1nstar+18.*(dMult-4.)*reQ2nQ1nstarQ1nstar
3814                   + 9.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3815                   + 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-9.*(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3816                   - 9.*(dMult-4.)*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.) 
3817                   + 18.*(dMult*dMult-7.*dMult+10.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3818                   - 6.*dMult*(dMult*dMult-9.*dMult+20.))
3819                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
3820   six2n1n1n2n1n1n = (dQ2nQ1nQ1nQ2nstarQ1nstarQ1nstar-4.*reQ3nQ1nQ2nstarQ1nstarQ1nstar
3821                   - 4.*reQ2nQ1nQ1nstarQ1nstarQ1nstar-2.*reQ2nQ2nQ2nstarQ1nstarQ1nstar
3822                   + 4.*reQ4nQ2nstarQ1nstarQ1nstar+4.*reQ3nQ1nQ2nstarQ2nstar+4.*reQ3nQ1nstarQ1nstarQ1nstar
3823                   - 8.*reQ4nQ3nstarQ1nstar-4.*reQ4nQ2nstarQ2nstar+4.*(2.*dMult-13.)*reQ3nQ2nstarQ1nstar
3824                   + 2.*(7.*dMult-34.)*reQ2nQ1nstarQ1nstar+4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3825                   - 4.*(dMult-7.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3826                   + 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3827                   + pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)+(2.*dMult*dMult-27.*dMult+76.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3828                   - (dMult-12.)*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
3829                   + 4.*(dMult*dMult-15.*dMult+34.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3830                   - 2.*dMult*(dMult*dMult-17.*dMult+60.))
3831                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
3832   six2n2n1n1n1n1n = (reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar-6.*reQ2nQ2nQ2nstarQ1nstarQ1nstar-reQ4nQ1nstarQ1nstarQ1nstarQ1nstar
3833                   - 8.*reQ2nQ1nQ1nstarQ1nstarQ1nstar+8.*reQ3nQ1nstarQ1nstarQ1nstar+6.*reQ4nQ2nstarQ1nstarQ1nstar
3834                   + 8.*reQ3nQ1nQ2nstarQ2nstar-40.*reQ3nQ2nstarQ1nstar-8.*reQ4nQ3nstarQ1nstar-9.*reQ4nQ2nstarQ2nstar
3835                   + 24.*(dMult-4.)*reQ2nQ1nstarQ1nstar+24.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3836                   + 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+16.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3837                   + 3.*pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)-12.*(2.*dMult-7.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3838                   + 12.*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)-48.*(dMult-3.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3839                   + 24.*dMult*(dMult-5.))
3840                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
3841   six3n1n1n1n1n1n = (reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar-6.*reQ3nQ1nQ2nstarQ1nstarQ1nstar+6.*reQ4nQ2nstarQ1nstarQ1nstar
3842                   - reQ4nQ1nstarQ1nstarQ1nstarQ1nstar-4.*reQ2nQ1nQ1nstarQ1nstarQ1nstar+3.*reQ3nQ1nQ2nstarQ2nstar
3843                   - 4.*(dMult-5.)*reQ3nQ1nstarQ1nstarQ1nstar-14.*reQ4nQ3nstarQ1nstar
3844                   - 3.*reQ4nQ2nstarQ2nstar+4.*(3.*dMult-17.)*reQ3nQ2nstarQ1nstar+12.*(dMult-6.)*reQ2nQ1nstarQ1nstar
3845                   + 12.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))  
3846                   + 8.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))  
3847                   + 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-8.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
3848                   - 12.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-48.*(dMult-3.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3849                   + 12.*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)+24.*dMult*(dMult-5.))
3850                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
3851   // Average 6-particle correlations for single event: 
3852   fIntFlowCorrelationsAllEBE->SetBinContent(24,six1n1n1n1n1n1n);
3853   fIntFlowCorrelationsAllEBE->SetBinContent(25,six2n1n1n2n1n1n);
3854   fIntFlowCorrelationsAllEBE->SetBinContent(26,six2n2n1n1n1n1n);
3855   fIntFlowCorrelationsAllEBE->SetBinContent(27,six3n1n1n1n1n1n);
3856   // Average 6-particle correlations for all events:         
3857   fIntFlowCorrelationsAllPro->Fill(23.5,six1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
3858   fIntFlowCorrelationsAllPro->Fill(24.5,six2n1n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
3859   fIntFlowCorrelationsAllPro->Fill(25.5,six2n2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
3860   fIntFlowCorrelationsAllPro->Fill(26.5,six3n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
3861   // Average 6-particle correlations vs M for all events:                
3862   if(fCalculateAllCorrelationsVsM)
3863   {
3864    fIntFlowCorrelationsAllVsMPro[23]->Fill(dMultiplicityBin,six1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
3865    fIntFlowCorrelationsAllVsMPro[24]->Fill(dMultiplicityBin,six2n1n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
3866    fIntFlowCorrelationsAllVsMPro[25]->Fill(dMultiplicityBin,six2n2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
3867    fIntFlowCorrelationsAllVsMPro[26]->Fill(dMultiplicityBin,six3n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
3868   }    
3869   // Store separetately <6>:
3870   fIntFlowCorrelationsEBE->SetBinContent(3,six1n1n1n1n1n1n); // <6>
3871   // Testing other multiplicity weights:
3872   Double_t mWeight6p = 0.;
3873   if(!strcmp(fMultiplicityWeight->Data(),"combinations"))
3874   {
3875    mWeight6p = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.);
3876   } else if(!strcmp(fMultiplicityWeight->Data(),"unit"))
3877     {
3878      mWeight6p = 1.;    
3879     } else if(!strcmp(fMultiplicityWeight->Data(),"multiplicity"))
3880       {
3881        mWeight6p = dMult;           
3882       }
3883   fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(3,mWeight6p); // eW_<6>
3884   fIntFlowCorrelationsPro->Fill(2.5,six1n1n1n1n1n1n,mWeight6p);
3885   fIntFlowSquaredCorrelationsPro->Fill(2.5,six1n1n1n1n1n1n*six1n1n1n1n1n1n,mWeight6p);
3886   if(fCalculateCumulantsVsM)
3887   {
3888    fIntFlowCorrelationsVsMPro[2]->Fill(dMultiplicityBin,six1n1n1n1n1n1n,mWeight6p);
3889    fIntFlowSquaredCorrelationsVsMPro[2]->Fill(dMultiplicityBin,six1n1n1n1n1n1n*six1n1n1n1n1n1n,mWeight6p);
3890   }    
3891  } // end of if(dMult>5)
3892  
3893  // 7-particle:
3894  Double_t seven2n1n1n1n1n1n1n = 0.; // <cos(n(2*phi1+phi2+phi3-phi4-phi5-phi6-phi7))>
3895  if(dMult>6)
3896  {
3897   seven2n1n1n1n1n1n1n = (reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar-4.*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),3.)
3898                       - reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar-2.*reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar
3899                       + 9.*reQ2nQ2nQ2nstarQ1nstarQ1nstar+20.*reQ3nQ1nQ2nstarQ1nstarQ1nstar 
3900                       + 2.*reQ4nQ1nstarQ1nstarQ1nstarQ1nstar-8.*(dMult-8.)*reQ2nQ1nQ1nstarQ1nstarQ1nstar
3901                       - 18.*reQ4nQ2nstarQ1nstarQ1nstar-14.*reQ3nQ1nQ2nstarQ2nstar
3902                       + 8.*(dMult-7.)*reQ3nQ1nstarQ1nstarQ1nstar+28.*reQ4nQ3nstarQ1nstar
3903                       + 12.*reQ4nQ2nstarQ2nstar-8.*(5.*dMult-31.)*reQ3nQ2nstarQ1nstar      
3904                       + 12.*(dMult*dMult-15.*dMult+46.)*reQ2nQ1nstarQ1nstar
3905                       - 16.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3906                       - 6.*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3907                       - 3.*pow(pow(dReQ2n,2.)+pow(dImQ2n,2.),2.)
3908                       + 12.*(2.*dMult-13.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3909                       - 12.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+16.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3910                       - 12.*(dMult-8.)*(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3911                       + 12.*(3.*dMult-14.)*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.)
3912                       - 24.*(3.*dMult-7.)*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3913                       + 24.*dMult*(dMult-5.)*(dMult-6.))
3914                       / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.));   
3915   // Average 7-particle correlations for single event: 
3916   fIntFlowCorrelationsAllEBE->SetBinContent(29,seven2n1n1n1n1n1n1n);       
3917   // Average 7-particle correlations for all events:                      
3918   fIntFlowCorrelationsAllPro->Fill(28.5,seven2n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
3919                                                                  *(dMult-4.)*(dMult-5.)*(dMult-6.));
3920   // Average 7-particle correlations vs M for all events:                
3921   if(fCalculateAllCorrelationsVsM)
3922   {
3923    fIntFlowCorrelationsAllVsMPro[28]->Fill(dMultiplicityBin,seven2n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
3924                                                                               *(dMult-4.)*(dMult-5.)*(dMult-6.));
3925   }    
3926  } // end of if(dMult>6)
3927  
3928  // 8-particle:
3929  Double_t eight1n1n1n1n1n1n1n1n = 0.; // <cos(n(phi1+phi2+phi3+phi4-phi5-phi6-phi7-phi8))>
3930  if(dMult>7)
3931  {  
3932   eight1n1n1n1n1n1n1n1n = (pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),4.)-12.*reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar
3933                         + 16.*reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar+6.*reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar
3934                         - 12.*reQ4nQ1nstarQ1nstarQ1nstarQ1nstar-36.*reQ2nQ2nQ2nstarQ1nstarQ1nstar
3935                         - 96.*reQ3nQ1nQ2nstarQ1nstarQ1nstar
3936                         + 72.*reQ4nQ2nstarQ1nstarQ1nstar+48.*reQ3nQ1nQ2nstarQ2nstar
3937                         - 64.*(dMult-6.)*reQ3nQ1nstarQ1nstarQ1nstar
3938                         + 96.*(dMult-6.)*reQ2nQ1nQ1nstarQ1nstarQ1nstar
3939                         - 96.*reQ4nQ3nstarQ1nstar-36.*reQ4nQ2nstarQ2nstar
3940                         + 192.*(dMult-6.)*reQ3nQ2nstarQ1nstar
3941                         - 144.*(dMult-7.)*(dMult-4.)*reQ2nQ1nstarQ1nstar
3942                         + 64.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3943                         - 144.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3944                         + 72.*(dMult-7.)*(dMult-4.)*(pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
3945                         - 96.*(dMult-7.)*(dMult-6.)*(dMult-2.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
3946                         + 36.*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3947                         + 9.*pow(pow(dReQ2n,2.)+pow(dImQ2n,2.),2.)
3948                         - 64.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
3949                         + 36.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
3950                         - 16.*(dMult-6.)*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),3.)
3951                         + 24.*dMult*(dMult-7.)*(dMult-6.)*(dMult-5.))
3952                         / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));   
3953   // Average 8-particle correlations for single event: 
3954   fIntFlowCorrelationsAllEBE->SetBinContent(31,eight1n1n1n1n1n1n1n1n);      
3955   // Average 8-particle correlations for all events:                       
3956   fIntFlowCorrelationsAllPro->Fill(30.5,eight1n1n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
3957                                                                    *(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));
3958   // Average 8-particle correlations vs M for all events:                
3959   if(fCalculateAllCorrelationsVsM)
3960   {
3961    fIntFlowCorrelationsAllVsMPro[30]->Fill(dMultiplicityBin,eight1n1n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
3962                                                                                 *(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));
3963   }     
3964   // Store separetately <8>:
3965   fIntFlowCorrelationsEBE->SetBinContent(4,eight1n1n1n1n1n1n1n1n); // <8>
3966   // Testing other multiplicity weights:
3967   Double_t mWeight8p = 0.;
3968   if(!strcmp(fMultiplicityWeight->Data(),"combinations"))
3969   {
3970    mWeight8p = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.);
3971   } else if(!strcmp(fMultiplicityWeight->Data(),"unit"))
3972     {
3973      mWeight8p = 1.;    
3974     } else if(!strcmp(fMultiplicityWeight->Data(),"multiplicity"))
3975       {
3976        mWeight8p = dMult;           
3977       }        
3978   fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(4,mWeight8p); // eW_<8>
3979   fIntFlowCorrelationsPro->Fill(3.5,eight1n1n1n1n1n1n1n1n,mWeight8p);
3980   fIntFlowSquaredCorrelationsPro->Fill(3.5,eight1n1n1n1n1n1n1n1n*eight1n1n1n1n1n1n1n1n,mWeight8p);  
3981   if(fCalculateCumulantsVsM)
3982   {
3983    fIntFlowCorrelationsVsMPro[3]->Fill(dMultiplicityBin,eight1n1n1n1n1n1n1n1n,mWeight8p);
3984    fIntFlowSquaredCorrelationsVsMPro[3]->Fill(dMultiplicityBin,eight1n1n1n1n1n1n1n1n*eight1n1n1n1n1n1n1n1n,mWeight8p);
3985   }    
3986  } // end of if(dMult>7) 
3987  
3988  // EXTRA correlations for v3{5} study:
3989  // 4-particle:
3990  Double_t four4n2n3n3n = 0.; // <cos(n(4*phi1+2*phi2-3*phi3-3*phi4))>
3991  if(dMult>3.)
3992  {
3993   four4n2n3n3n = (reQ4nQ2nQ3nstarQ3nstar-reQ6nQ4nstarQ2nstar-reQ6nQ3nstarQ3nstar
3994                - 2.*reQ4nQ3nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar
3995                + (pow(dReQ6n,2.)+pow(dImQ6n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
3996                + 2.*(2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(pow(dReQ2n,2.)+pow(dImQ2n,2.))
3997                + (pow(dReQ1n,2.)+pow(dImQ1n,2.))-3.*dMult))
3998                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));               
3999   fIntFlowCorrelationsAllPro->Fill(32.5,four4n2n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4000   // Average 4-particle correlations vs M for all events:                
4001   if(fCalculateAllCorrelationsVsM)
4002   {
4003    fIntFlowCorrelationsAllVsMPro[32]->Fill(dMultiplicityBin,four4n2n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4004   }    
4005  } // end of if(dMult>3.)
4006  
4007  // 5-particle:
4008  Double_t five3n3n2n2n2n = 0.; // <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-2*phi5))>                                    
4009  if(dMult>4.)
4010  {
4011   five3n3n2n2n2n = (reQ3nQ3nQ2nstarQ2nstarQ2nstar-reQ6nQ2nstarQ2nstarQ2nstar-3.*reQ4nQ2nQ3nstarQ3nstar 
4012                  - 6.*reQ3nQ1nQ2nstarQ2nstar+2.*reQ6nQ3nstarQ3nstar+3.*reQ6nQ4nstarQ2nstar
4013                  + 6.*reQ4nQ3nstarQ1nstar+6.*reQ4nQ2nstarQ2nstar
4014                  + 12.*reQ3nQ2nstarQ1nstar+6.*reQ2nQ1nstarQ1nstar
4015                  - 2.*((pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
4016                  + 3.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4017                  + 6.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
4018                  + 9.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4019                  + 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-12.*dMult))
4020                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4021   fIntFlowCorrelationsAllPro->Fill(33.5,five3n3n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4022   if(fCalculateAllCorrelationsVsM)
4023   {
4024    fIntFlowCorrelationsAllVsMPro[33]->Fill(dMultiplicityBin,five3n3n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4025   }     
4026  } // end of if(dMult>4.)
4027  
4028  // EXTRA correlations for Teaney-Yan study: 
4029  // 2-particle:
4030  Double_t two5n5n = 0.; // <cos(5n(phi1-phi2))>
4031  Double_t two6n6n = 0.; // <cos(6n(phi1-phi2))> 
4032  if(dMult>1)
4033  {
4034   two5n5n = (pow(dReQ5n,2.)+pow(dImQ5n,2.)-dMult)/(dMult*(dMult-1.)); 
4035   two6n6n = (pow(dReQ6n,2.)+pow(dImQ6n,2.)-dMult)/(dMult*(dMult-1.));        
4036   // Average 2-particle correlations for all events:      
4037   fIntFlowCorrelationsAllPro->Fill(34.5,two5n5n,dMult*(dMult-1.));
4038   fIntFlowCorrelationsAllPro->Fill(35.5,two6n6n,dMult*(dMult-1.)); 
4039   if(fCalculateAllCorrelationsVsM)
4040   {
4041    fIntFlowCorrelationsAllVsMPro[34]->Fill(dMultiplicityBin,two5n5n,dMult*(dMult-1.));
4042    fIntFlowCorrelationsAllVsMPro[35]->Fill(dMultiplicityBin,two6n6n,dMult*(dMult-1.));
4043   }       
4044  } // end of if(dMult>1)
4045  
4046  // 3-particle:
4047  Double_t three5n3n2n = 0.; // <cos(n(5*phi1-3*phi2-2*phi3)> 
4048  Double_t three5n4n1n = 0.; // <cos(n(5*phi1-4*phi2-1*phi3)> 
4049  Double_t three6n3n3n = 0.; // <cos(n(6*phi1-3*phi2-3*phi3)> 
4050  Double_t three6n4n2n = 0.; // <cos(n(6*phi1-4*phi2-2*phi3)> 
4051  Double_t three6n5n1n = 0.; // <cos(n(6*phi1-5*phi2-1*phi3)> 
4052  if(dMult>2)
4053  {
4054   three5n3n2n = (reQ5nQ3nstarQ2nstar-(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4055               - (pow(dReQ3n,2.)+pow(dImQ3n,2.))
4056               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
4057               / (dMult*(dMult-1.)*(dMult-2.));           
4058   three5n4n1n = (reQ5nQ4nstarQ1nstar-(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4059               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))
4060               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4061               / (dMult*(dMult-1.)*(dMult-2.));                          
4062   three6n3n3n = (reQ6nQ3nstarQ3nstar-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4063               - (pow(dReQ6n,2.)+pow(dImQ6n,2.))+2.*dMult)
4064               / (dMult*(dMult-1.)*(dMult-2.)); 
4065   three6n4n2n = (reQ6nQ4nstarQ2nstar-(pow(dReQ6n,2.)+pow(dImQ6n,2.))
4066               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))
4067               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
4068               / (dMult*(dMult-1.)*(dMult-2.));
4069   three6n5n1n = (reQ6nQ5nstarQ1nstar-(pow(dReQ6n,2.)+pow(dImQ6n,2.))
4070               - (pow(dReQ5n,2.)+pow(dImQ5n,2.))
4071               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4072               / (dMult*(dMult-1.)*(dMult-2.));            
4073   // Average 3-particle correlations for all events:      
4074   fIntFlowCorrelationsAllPro->Fill(36.5,three5n3n2n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(5*phi1-3*phi2-2*phi3)>> 
4075   fIntFlowCorrelationsAllPro->Fill(37.5,three5n4n1n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(5*phi1-4*phi2-1*phi3)>> 
4076   fIntFlowCorrelationsAllPro->Fill(38.5,three6n3n3n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(6*phi1-3*phi2-3*phi3)>> 
4077   fIntFlowCorrelationsAllPro->Fill(39.5,three6n4n2n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(6*phi1-4*phi2-2*phi3)>>
4078   fIntFlowCorrelationsAllPro->Fill(40.5,three6n5n1n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n(6*phi1-5*phi2-1*phi3)>>
4079   if(fCalculateAllCorrelationsVsM)
4080   {
4081    fIntFlowCorrelationsAllVsMPro[36]->Fill(dMultiplicityBin,three5n3n2n,dMult*(dMult-1.)*(dMult-2.));
4082    fIntFlowCorrelationsAllVsMPro[37]->Fill(dMultiplicityBin,three5n4n1n,dMult*(dMult-1.)*(dMult-2.));
4083    fIntFlowCorrelationsAllVsMPro[38]->Fill(dMultiplicityBin,three6n3n3n,dMult*(dMult-1.)*(dMult-2.));
4084    fIntFlowCorrelationsAllVsMPro[39]->Fill(dMultiplicityBin,three6n4n2n,dMult*(dMult-1.)*(dMult-2.));
4085    fIntFlowCorrelationsAllVsMPro[40]->Fill(dMultiplicityBin,three6n5n1n,dMult*(dMult-1.)*(dMult-2.));
4086   }       
4087  } // end of if(dMult>2)
4088  
4089  // 4-particle:
4090  Double_t four6n3n2n1n = 0.; // <cos(n(6*phi1-3*phi2-2*phi3-1*phi4)>
4091  Double_t four3n2n3n2n = 0.; // <cos(n(3*phi1+2*phi2-3*phi3-2*phi4)>
4092  Double_t four4n1n3n2n = 0.; // <cos(n(4*phi1+1*phi2-3*phi3-2*phi4)> 
4093  Double_t four3n3n3n3n = 0.; // <cos(3n(phi1+phi2-phi3-phi4))> 
4094  //Double_t four4n2n3n3n = 0.; // <cos(n(4*phi1+2*phi2-3*phi3-3*phi4)> // I already have this one above
4095  Double_t four5n1n3n3n = 0.; // <cos(n(5*phi1+1*phi2-3*phi3-3*phi4)>
4096  Double_t four4n2n4n2n = 0.; // <cos(n(4*phi1+2*phi2-4*phi3-2*phi4)> 
4097  Double_t four5n1n4n2n = 0.; // <cos(n(5*phi1+1*phi2-4*phi3-2*phi4)> 
4098  Double_t four5n3n1n1n = 0.; // <cos(n(5*phi1-3*phi2-1*phi3-1*phi4)> 
4099  Double_t four5n2n2n1n = 0.; // <cos(n(5*phi1-2*phi2-2*phi3-1*phi4)>
4100  Double_t four5n1n5n1n = 0.; // <cos(n(5*phi1+1*phi2-5*phi3-1*phi4)>
4101  Double_t four6n4n1n1n = 0.; // <cos(n(6*phi1-4*phi2-1*phi3-1*phi4)>
4102  Double_t four6n2n2n2n = 0.; // <cos(n(6*phi1-2*phi2-2*phi3-2*phi4)>
4103  if(dMult>3)
4104  {
4105   four6n3n2n1n = (reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ4nstarQ2nstar-reQ6nQ3nstarQ3nstar-reQ6nQ5nstarQ1nstar
4106                - reQ5nQ3nstarQ2nstar-reQ4nQ3nstarQ1nstar-reQ3nQ2nstarQ1nstar
4107                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+pow(dReQ5n,2.)+pow(dImQ5n,2.)
4108                + pow(dReQ4n,2.)+pow(dImQ4n,2.)+3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4109                + 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
4110                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4111   four3n2n3n2n = (dQ3nQ2nQ3nstarQ2nstar-2.*reQ5nQ3nstarQ2nstar-2.*reQ3nQ2nstarQ1nstar
4112                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)               
4113                -(dMult-4.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
4114                + dMult*(dMult-6.))
4115                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));     
4116   four4n1n3n2n = (reQ4nQ1nQ3nstarQ2nstar-reQ5nQ3nstarQ2nstar-reQ5nQ4nstarQ1nstar-reQ4nQ3nstarQ1nstar
4117                - reQ4nQ2nstarQ2nstar-reQ3nQ2nstarQ1nstar-reQ2nQ1nstarQ1nstar
4118                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4119                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4120                + 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
4121                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));                             
4122   four3n3n3n3n = (2.*dMult*(dMult-3.)+pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ3n,2.)
4123                + pow(dImQ3n,2.))-2.*reQ6nQ3nstarQ3nstar+(pow(dReQ6n,2.)+pow(dImQ6n,2.)))
4124                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));   
4125   //four4n2n3n3n = ; // I already have this one above
4126   four5n1n3n3n = (reQ5nQ1nQ3nstarQ3nstar-reQ6nQ5nstarQ1nstar-reQ6nQ3nstarQ3nstar-2.*reQ5nQ3nstarQ2nstar
4127                - 2.*reQ3nQ2nstarQ1nstar+pow(dReQ6n,2.)+pow(dImQ6n,2.)+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4128                + 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4129                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)                                  
4130                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));   
4131   four4n2n4n2n = (dQ4nQ2nQ4nstarQ2nstar-2.*reQ6nQ4nstarQ2nstar-2.*reQ4nQ2nstarQ2nstar)
4132                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4133                - ((dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4134                + (dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-(pow(dReQ6n,2.)+pow(dImQ6n,2.)))
4135                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4136                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.)); 
4137   four5n1n4n2n = (reQ5nQ1nQ4nstarQ2nstar-reQ6nQ5nstarQ1nstar-reQ6nQ4nstarQ2nstar-reQ5nQ4nstarQ1nstar
4138                - reQ5nQ3nstarQ2nstar-reQ4nQ3nstarQ1nstar-reQ2nQ1nstarQ1nstar+pow(dReQ6n,2.)+pow(dImQ6n,2.)
4139                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4140                + pow(dReQ3n,2.)+pow(dImQ3n,2.)+2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4141                + 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
4142                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));     
4143   four5n3n1n1n = (reQ5nQ3nstarQ1nstarQ1nstar-2.*reQ5nQ4nstarQ1nstar-reQ5nQ3nstarQ2nstar-2.*reQ4nQ3nstarQ1nstar
4144                - reQ2nQ1nstarQ1nstar+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4145                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+pow(dReQ2n,2.)+pow(dImQ2n,2.)
4146                + 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
4147                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));                    
4148   four5n2n2n1n = (reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ4nstarQ1nstar-2.*reQ5nQ3nstarQ2nstar-reQ4nQ2nstarQ2nstar
4149                - 2.*reQ3nQ2nstarQ1nstar+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+pow(dReQ4n,2.)+pow(dImQ4n,2.)
4150                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4151                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
4152                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));   
4153   four5n1n5n1n = (dQ5nQ1nQ5nstarQ1nstar-2.*reQ6nQ5nstarQ1nstar-2.*reQ5nQ4nstarQ1nstar
4154                + pow(dReQ6n,2.)+pow(dImQ6n,2.)-(dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4155                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+dMult*(dMult-6.))  
4156                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));    
4157                               
4158   // TBI: Recursive formula needed:
4159   four6n4n1n1n = (reQ6nQ4nstarQ1nstarQ1nstar
4160                - dMult*(dMult-1.)*(dMult-2.)*(three2n1n1n+2.*three5n4n1n+2.*three6n5n1n+three6n4n2n)
4161                - dMult*(dMult-1.)*(2.*two1n1n+1.*two4n4n+1.*two6n6n+1.*two2n2n+2.*two5n5n)
4162                - 1.*dMult)
4163                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4164   
4165   four6n2n2n2n = (reQ6nQ2nstarQ2nstarQ2nstar-3.*reQ6nQ4nstarQ2nstar-3.*reQ4nQ2nstarQ2nstar
4166                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+3.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4167                + 6.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-6.*dMult)
4168                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4169   // Average 4-particle correlations for all events:      
4170   fIntFlowCorrelationsAllPro->Fill(41.5,four6n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4171   fIntFlowCorrelationsAllPro->Fill(42.5,four3n2n3n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4172   fIntFlowCorrelationsAllPro->Fill(43.5,four4n1n3n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4173   fIntFlowCorrelationsAllPro->Fill(44.5,four3n3n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4174   //fIntFlowCorrelationsAllPro->Fill(45.5,four4n2n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); // I already have this one above
4175   fIntFlowCorrelationsAllPro->Fill(46.5,four5n1n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4176   fIntFlowCorrelationsAllPro->Fill(47.5,four4n2n4n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4177   fIntFlowCorrelationsAllPro->Fill(48.5,four5n1n4n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4178   fIntFlowCorrelationsAllPro->Fill(49.5,four5n3n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4179   fIntFlowCorrelationsAllPro->Fill(50.5,four5n2n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4180   fIntFlowCorrelationsAllPro->Fill(51.5,four5n1n5n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4181   fIntFlowCorrelationsAllPro->Fill(58.5,four6n4n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4182   fIntFlowCorrelationsAllPro->Fill(59.5,four6n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4183   if(fCalculateAllCorrelationsVsM)
4184   {
4185    fIntFlowCorrelationsAllVsMPro[41]->Fill(dMultiplicityBin,four6n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4186    fIntFlowCorrelationsAllVsMPro[42]->Fill(dMultiplicityBin,four3n2n3n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4187    fIntFlowCorrelationsAllVsMPro[43]->Fill(dMultiplicityBin,four4n1n3n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4188    fIntFlowCorrelationsAllVsMPro[44]->Fill(dMultiplicityBin,four3n3n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4189    //fIntFlowCorrelationsAllVsMPro[45]->Fill(dMultiplicityBin,four4n2n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4190    fIntFlowCorrelationsAllVsMPro[46]->Fill(dMultiplicityBin,four5n1n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4191    fIntFlowCorrelationsAllVsMPro[47]->Fill(dMultiplicityBin,four4n2n4n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4192    fIntFlowCorrelationsAllVsMPro[48]->Fill(dMultiplicityBin,four5n1n4n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4193    fIntFlowCorrelationsAllVsMPro[49]->Fill(dMultiplicityBin,four5n3n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4194    fIntFlowCorrelationsAllVsMPro[50]->Fill(dMultiplicityBin,four5n2n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4195    fIntFlowCorrelationsAllVsMPro[51]->Fill(dMultiplicityBin,four5n1n5n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4196    fIntFlowCorrelationsAllVsMPro[58]->Fill(dMultiplicityBin,four6n4n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4197    fIntFlowCorrelationsAllVsMPro[59]->Fill(dMultiplicityBin,four6n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4198   }       
4199  } // end of if(dMult>3)
4200
4201  // 5-particle:
4202  Double_t five3n3n3n2n1n = 0.; // <cos(n(3*phi1+3*phi2-3*phi3-2*phi4-1*phi5)>
4203  Double_t five4n2n3n2n1n = 0.; // <cos(n(4*phi1+2*phi2-3*phi3-2*phi4-1*phi5)>
4204  Double_t five3n2n3n1n1n = 0.; // <cos(n(3*phi1+2*phi2-3*phi3-1*phi4-1*phi5)>
4205  Double_t five3n2n2n2n1n = 0.; // <cos(n(3*phi1+2*phi2-2*phi3-2*phi4-1*phi5)>
4206  Double_t five5n1n3n2n1n = 0.; // <cos(n(5*phi1+1*phi2-3*phi3-2*phi4-1*phi5)>
4207  Double_t five6n2n2n1n1n = 0.; // <cos(n(6*phi1-2*phi2-2*phi3-1*phi4-1*phi5)>
4208  Double_t five4n1n1n3n3n = 0.; // <cos(n(4*phi1+1*phi2+1*phi3-3*phi4-3*phi5)>
4209  if(dMult>4)
4210  { 
4211   five3n3n3n2n1n = (reQ3nQ3nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ5nQ1nQ3nstarQ3nstar-reQ4nQ2nQ3nstarQ3nstar
4212                  + reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+3.*reQ6nQ3nstarQ3nstar+4.*reQ5nQ3nstarQ2nstar+4.*reQ4nQ3nstarQ1nstar
4213                  - 2.*(dMult-6.)*reQ3nQ2nstarQ1nstar-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
4214                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4215                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4216                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(3.*dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4217                  - pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)+2.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4218                  + 2.*(dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
4219                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));                                  
4220   five4n2n3n2n1n = (reQ4nQ2nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar
4221                  - reQ4nQ2nQ3nstarQ3nstar-reQ4nQ1nQ3nstarQ2nstar-reQ4nQ2nstarQ1nstarQ1nstar
4222                  - reQ3nQ1nQ2nstarQ2nstar-(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4223                  + 3.*reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ6nQ3nstarQ3nstar+reQ5nQ4nstarQ1nstar
4224                  + 3.*reQ5nQ3nstarQ2nstar-(dMult-7.)*reQ4nQ3nstarQ1nstar+3.*reQ4nQ2nstarQ2nstar+7.*reQ3nQ2nstarQ1nstar
4225                  + 4.*reQ2nQ1nstarQ1nstar-(pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4226                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4227                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4228                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4229                  + 2.*(dMult-7.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+(dMult-12.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4230                  - 2.*dMult*(dMult-12.))
4231                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));   
4232   five3n2n3n1n1n = (reQ3nQ2nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-2.*reQ4nQ1nQ3nstarQ2nstar-reQ3nQ1nstarQ1nstarQ1nstar
4233                  - 2.*reQ3nQ1nQ2nstarQ2nstar+2.*reQ5nQ4nstarQ1nstar+3.*reQ5nQ3nstarQ2nstar+6.*reQ4nQ3nstarQ1nstar
4234                  + 2.*reQ4nQ2nstarQ2nstar+9.*reQ3nQ2nstarQ1nstar-(dMult-8.)*reQ2nQ1nstarQ1nstar
4235                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
4236                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
4237                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4238                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(dMult-12.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4239                  + 2.*(dMult-9.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.))
4240                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4241   five3n2n2n2n1n = (reQ3nQ2nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ4nQ1nQ3nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar
4242                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+reQ5nQ4nstarQ1nstar
4243                  + 4.*reQ5nQ3nstarQ2nstar+reQ4nQ3nstarQ1nstar+3.*reQ4nQ2nstarQ2nstar-2.*(dMult-6.)*reQ3nQ2nstarQ1nstar
4244                  + 4.*reQ2nQ1nstarQ1nstar-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4245                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4246                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4247                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)+2.*(3.*dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4248                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
4249                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
4250   five5n1n3n2n1n = (reQ5nQ1nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ3nstarQ3nstar
4251                  - reQ4nQ1nQ3nstarQ2nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar 
4252                  + 3.*reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ3nstarQ3nstar+4.*reQ5nQ4nstarQ1nstar
4253                  - (dMult-7.)*reQ5nQ3nstarQ2nstar+4.*reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar+6.*reQ3nQ2nstarQ1nstar
4254                  + 3.*reQ2nQ1nstarQ1nstar-(pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4255                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4256                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4257                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+(dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))  
4258                  - 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4259                  + (dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*(dMult-7.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4260                  - 2.*dMult*(dMult-12.))
4261                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));       
4262   // Peter Jochumzsen:
4263   five6n2n2n1n1n = (reQ6nQ2nstarQ2nstarQ1nstarQ1nstar
4264                  - 12.*pow(dReQ1n,2.)-12.*pow(dImQ1n,2.)
4265                  - 14.*pow(dReQ2n,2.)-14.*pow(dImQ2n,2.)
4266                  - 8.*pow(dReQ3n,2.)-8.*pow(dImQ3n,2.)
4267                  - 6.*pow(dReQ4n,2.)-6.*pow(dImQ4n,2.)
4268                  - 4.*pow(dReQ5n,2.)-4.*pow(dImQ5n,2.)
4269                  - 6.*pow(dReQ6n,2.)-6.*pow(dImQ6n,2.)
4270                  + 2.*reQ2nQ1nstarQ1nstar + 8.*reQ3nQ2nstarQ1nstar
4271                  + 5.*reQ6nQ4nstarQ2nstar - reQ6nQ4nstarQ1nstarQ1nstar
4272                  + 2.*reQ6nQ3nstarQ3nstar - reQ6nQ2nstarQ2nstarQ2nstar 
4273                  + 4.*reQ4nQ2nstarQ2nstar - 2.*reQ4nQ2nstarQ1nstarQ1nstar 
4274                  + 2.*reQ5nQ4nstarQ1nstar - 2.*reQ5nQ2nstarQ2nstarQ1nstar 
4275                  + 4.*reQ4nQ3nstarQ1nstar + 4.*reQ5nQ3nstarQ2nstar
4276                  + 4.*reQ6nQ5nstarQ1nstar - 4.*reQ6nQ3nstarQ2nstarQ1nstar + 24.*dMult)
4277                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));  
4278   // Peter Jochumzsen:
4279   five4n1n1n3n3n = (reQ4nQ1nQ1nQ3nstarQ3nstar-16.*pow(dReQ1n,2.)-16.*pow(dImQ1n,2.)
4280                  - 10.*pow(dReQ2n,2.)-10.*pow(dImQ2n,2.)-12.*pow(dReQ3n,2.)-12.*pow(dImQ3n,2.)
4281                  - 6.*pow(dReQ4n,2.)-6.*pow(dImQ4n,2.)-4.*pow(dReQ5n,2.)-4.*pow(dImQ5n,2.)
4282                  - 2.*pow(dReQ6n,2.)-2.*pow(dImQ6n,2.)+6.*reQ2nQ1nstarQ1nstar 
4283                  - 1.*reQ6nQ4nstarQ1nstarQ1nstar-1.*reQ4nQ2nQ3nstarQ3nstar 
4284                  + 1.*reQ6nQ4nstarQ2nstar-2.*reQ5nQ1nQ3nstarQ3nstar 
4285                  + 2.*reQ4nQ2nstarQ2nstar+4.*reQ4nQ3nstarQ1nstar 
4286                  - 2.*reQ3nQ1nstarQ1nstarQ1nstar+10.*reQ3nQ2nstarQ1nstar 
4287                  + 2.*reQ6nQ5nstarQ1nstar+2.*reQ6nQ3nstarQ3nstar 
4288                  - 4.*reQ4nQ1nQ3nstarQ2nstar+4.*reQ5nQ4nstarQ1nstar
4289                  + 4.*reQ5nQ3nstarQ2nstar + 24.*dMult)
4290                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4291   // Average 5-particle correlations for all events:      
4292   fIntFlowCorrelationsAllPro->Fill(52.5,five3n3n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4293   fIntFlowCorrelationsAllPro->Fill(53.5,five4n2n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4294   fIntFlowCorrelationsAllPro->Fill(54.5,five3n2n3n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4295   fIntFlowCorrelationsAllPro->Fill(55.5,five3n2n2n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4296   fIntFlowCorrelationsAllPro->Fill(56.5,five5n1n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4297   fIntFlowCorrelationsAllPro->Fill(60.5,five6n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4298   fIntFlowCorrelationsAllPro->Fill(61.5,five4n1n1n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4299   if(fCalculateAllCorrelationsVsM)
4300   {
4301    fIntFlowCorrelationsAllVsMPro[52]->Fill(dMultiplicityBin,five3n3n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4302    fIntFlowCorrelationsAllVsMPro[53]->Fill(dMultiplicityBin,five4n2n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4303    fIntFlowCorrelationsAllVsMPro[54]->Fill(dMultiplicityBin,five3n2n3n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4304    fIntFlowCorrelationsAllVsMPro[55]->Fill(dMultiplicityBin,five3n2n2n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4305    fIntFlowCorrelationsAllVsMPro[56]->Fill(dMultiplicityBin,five5n1n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4306    fIntFlowCorrelationsAllVsMPro[60]->Fill(dMultiplicityBin,five6n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4307    fIntFlowCorrelationsAllVsMPro[61]->Fill(dMultiplicityBin,five4n1n1n3n3n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
4308   }         
4309  } // end of if(dMult>4)
4310
4311  // 6-particle:
4312  Double_t six3n2n1n3n2n1n = 0.; // <cos(n(3*phi1+2*phi2+1*phi3-3*phi4-2*phi5-1*phi6)>
4313  Double_t six3n3n2n2n1n1n = 0.; // <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-1*phi5-1*phi6)>   
4314  if(dMult>5.)
4315  { 
4316   six3n2n1n3n2n1n = (dQ3nQ2nQ1nQ3nstarQ2nstarQ1nstar-2.*reQ3nQ3nQ3nstarQ2nstarQ1nstar
4317                   - 2.*reQ3nQ2nQ2nstarQ2nstarQ1nstar-2.*reQ3nQ1nQ2nstarQ1nstarQ1nstar
4318                   - 2.*reQ3nQ2nQ3nstarQ1nstarQ1nstar-2.*reQ4nQ2nQ3nstarQ2nstarQ1nstar
4319                   - 2.*reQ5nQ1nQ3nstarQ2nstarQ1nstar+4.*reQ6nQ3nstarQ2nstarQ1nstar
4320                   + 2.*reQ5nQ1nQ4nstarQ2nstar+2.*reQ5nQ1nQ3nstarQ3nstar
4321                   + 2.*reQ4nQ2nQ3nstarQ3nstar+6.*reQ4nQ1nQ3nstarQ2nstar
4322                   + 2.*reQ5nQ3nstarQ1nstarQ1nstar+2.*reQ5nQ2nstarQ2nstarQ1nstar
4323                   + 6.*reQ3nQ1nQ2nstarQ2nstar+2.*reQ4nQ2nstarQ1nstarQ1nstar
4324                   - 4.*reQ6nQ5nstarQ1nstar-4.*reQ6nQ4nstarQ2nstar-6.*reQ5nQ4nstarQ1nstar
4325                   - 4.*reQ6nQ3nstarQ3nstar+2.*(dMult-11.)*reQ5nQ3nstarQ2nstar
4326                   + 2.*(dMult-13.)*reQ4nQ3nstarQ1nstar-8.*reQ4nQ2nstarQ2nstar
4327                   + 2.*(5.*dMult-32.)*reQ3nQ2nstarQ1nstar+2.*reQ3nQ1nstarQ1nstarQ1nstar
4328                   + 2.*(dMult-13.)*reQ2nQ1nstarQ1nstar
4329                   - (dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4330                   + (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4331                   + (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4332                   - (dMult-11.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4333                   - (dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4334                   + 4.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-(dMult-12.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4335                   - (dMult-16.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)
4336                   + (dMult*dMult-19.*dMult+68.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4337                   + (dMult*dMult-19.*dMult+72.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4338                   + pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)+pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
4339                   + (dMult*dMult-20.*dMult+80.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4340                   - dMult*(dMult-12.)*(dMult-10.))
4341                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));   
4342   
4343   // Peter Jochumzsen:
4344   six3n3n2n2n1n1n = (reQ3nQ3nQ2nstarQ2nstarQ1nstarQ1nstar
4345                   + (80.-16.*dMult)*pow(dReQ1n,2.)+(80.-16.*dMult)*pow(dImQ1n,2.)
4346                   + (78.-16.*dMult)*pow(dReQ2n,2.)+(78.-16.*dMult)*pow(dImQ2n,2.)
4347                   + (72.-16.*dMult)*pow(dReQ3n,2.)+(72.-16.*dMult)*pow(dImQ3n,2.)
4348                   + 14.*pow(dReQ4n,2.)+14.*pow(dImQ4n,2.)
4349                   + 8.*pow(dReQ5n,2.)+8.*pow(dImQ5n,2.)
4350                   + 6.*pow(dReQ6n,2.)+6.*pow(dImQ6n,2.)
4351                   + 1.*reQ6nQ2nstarQ2nstarQ2nstar - 1.*reQ6nQ2nstarQ2nstarQ1nstarQ1nstar
4352                   - 76.*reQ3nQ2nstarQ1nstar + 4.*reQ3nQ1nstarQ1nstarQ1nstar
4353                   - 8.*reQ3nQ2nstarQ1nstar + 8.*dQ2nQ1nQ2nstarQ1nstar
4354                   + 4.*reQ5nQ2nstarQ2nstarQ1nstar - 2.*reQ6nQ3nstarQ3nstar
4355                   + 4.*reQ6nQ3nstarQ2nstarQ1nstar - 4.*reQ5nQ4nstarQ1nstar
4356                   + 16.*dMult*reQ3nQ2nstarQ1nstar - 2.*reQ4nQ2nstarQ2nstar
4357                   - 4.*reQ3nQ3nQ3nstarQ2nstarQ1nstar -8.*reQ4nQ3nstarQ1nstar
4358                   - 10.*reQ4nQ2nstarQ2nstar + 4.*reQ4nQ2nstarQ1nstarQ1nstar
4359                   - 12.*reQ4nQ3nstarQ1nstar + 8.*dQ3nQ1nQ3nstarQ1nstar
4360                   + 8.*reQ3nQ1nQ2nstarQ2nstar - 4.*reQ3nQ1nQ2nstarQ1nstarQ1nstar
4361                   + 5.*reQ4nQ2nQ3nstarQ3nstar+2.*pow(pow(dReQ2n,2.)+pow(dImQ2n,2.),2.)
4362                   + 4.*reQ5nQ1nQ3nstarQ3nstar+2.*pow(pow(dReQ3n,2.)+pow(dImQ3n,2.),2.)
4363                   - 6.*reQ6nQ3nstarQ3nstar - 14.*reQ2nQ1nstarQ1nstar
4364                   - 1.*reQ3nQ3nQ2nstarQ2nstarQ2nstar-4.*reQ3nQ2nQ2nstarQ2nstarQ1nstar
4365                   - 1.*reQ4nQ1nQ1nQ3nstarQ3nstar-8.*reQ5nQ3nstarQ2nstar
4366                   + 2.*pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),2.) - 10.*reQ2nQ1nstarQ1nstar
4367                   - 4.*reQ6nQ5nstarQ1nstar-5.*reQ6nQ4nstarQ2nstar
4368                   + 1.*reQ6nQ4nstarQ1nstarQ1nstar-8.*reQ5nQ3nstarQ2nstar
4369                   + 4.*reQ4nQ1nQ3nstarQ2nstar+8.*dQ3nQ2nQ3nstarQ2nstar
4370                   - 120.*dMult + 16.*dMult*dMult)
4371                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4372
4373   // Average 6-particle correlations for all events:      
4374   fIntFlowCorrelationsAllPro->Fill(57.5,six3n2n1n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4375   fIntFlowCorrelationsAllPro->Fill(62.5,six3n3n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4376   if(fCalculateAllCorrelationsVsM)
4377   {
4378    fIntFlowCorrelationsAllVsMPro[57]->Fill(dMultiplicityBin,six3n2n1n3n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4379    fIntFlowCorrelationsAllVsMPro[62]->Fill(dMultiplicityBin,six3n3n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
4380   }          
4381  } // end of if(dMult>5.)
4382  
4383 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelations()
4384
4385 //=====================================================================================================
4386
4387 void AliFlowAnalysisWithQCumulants::CalculateMixedHarmonics()
4388 {
4389  // Calculate in this method all multi-particle azimuthal correlations in mixed harmonics.
4390  // (Remark: For completeness sake, we also calculate here again correlations in the same harmonic.) 
4391
4392  // a) Access Q-vectors and multiplicity of current event; 
4393  // b) Determine multiplicity weights and fill some histos;
4394  // c) Calculate 2-p correlations; 
4395  // d) Calculate 3-p correlations; 
4396  // e) Calculate 4-p correlations; 
4397  // f) Calculate 5-p correlations; 
4398  // g) Calculate 6-p correlations; 
4399  // h) Calculate 7-p correlations; 
4400  // i) Calculate 8-p correlations.
4401
4402  // a) Access Q-vectors and multiplicity of current event:
4403  // Multiplicity of an event: 
4404  Double_t dMult = (*fSpk)(0,0);
4405  // Real parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n, 4n, 5n and 6n: 
4406  Double_t dReQ1n = (*fReQ)(0,0);
4407  Double_t dReQ2n = (*fReQ)(1,0);
4408  Double_t dReQ3n = (*fReQ)(2,0);
4409  Double_t dReQ4n = (*fReQ)(3,0);
4410  Double_t dReQ5n = (*fReQ)(4,0); 
4411  Double_t dReQ6n = (*fReQ)(5,0);
4412  Double_t dReQ7n = (*fReQ)(6,0);
4413  Double_t dReQ8n = (*fReQ)(7,0);
4414  Double_t dReQ9n = (*fReQ)(8,0);
4415  Double_t dReQ10n = (*fReQ)(9,0);
4416  Double_t dReQ11n = (*fReQ)(10,0);
4417  Double_t dReQ12n = (*fReQ)(11,0);
4418  // Imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n, 4n, 5n and 6n:
4419  Double_t dImQ1n = (*fImQ)(0,0);
4420  Double_t dImQ2n = (*fImQ)(1,0);
4421  Double_t dImQ3n = (*fImQ)(2,0);
4422  Double_t dImQ4n = (*fImQ)(3,0);
4423  Double_t dImQ5n = (*fImQ)(4,0); 
4424  Double_t dImQ6n = (*fImQ)(5,0);
4425  Double_t dImQ7n = (*fImQ)(6,0);
4426  Double_t dImQ8n = (*fImQ)(7,0);
4427  Double_t dImQ9n = (*fImQ)(8,0);
4428  Double_t dImQ10n = (*fImQ)(9,0);
4429  Double_t dImQ11n = (*fImQ)(10,0);
4430  Double_t dImQ12n = (*fImQ)(11,0);
4431  // All mixed correlators:
4432  Double_t allMixedCorrelators[139] = {0.};
4433
4434  // Real parts of expressions involving various combinations of Q-vectors which appears
4435  // simultaneously in several equations for multiparticle correlations bellow: 
4436  // Re[Q_{2n}Q_{n}^*Q_{n}^*]
4437  Double_t reQ2nQ1nstarQ1nstar = pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n; 
4438  // Re[Q_{6n}Q_{3n}^*Q_{3n}^*]
4439  Double_t reQ6nQ3nstarQ3nstar = pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n;  
4440  // Re[Q_{4n}Q_{2n}^*Q_{2n}^*]
4441  Double_t reQ4nQ2nstarQ2nstar = pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n;
4442  // Re[Q_{4n}Q_{3n}^*Q_{n}^*]
4443  Double_t reQ4nQ3nstarQ1nstar = dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);
4444  // Re[Q_{3n}Q_{2n}^*Q_{n}^*]
4445  Double_t reQ3nQ2nstarQ1nstar = dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
4446                               + dImQ3n*dImQ2n*dReQ1n; 
4447  // Re[Q_{5n}Q_{3n}^*Q_{2n}^*]
4448  Double_t reQ5nQ3nstarQ2nstar = dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n
4449                               + dImQ5n*dImQ2n*dReQ3n;                             
4450  // Re[Q_{5n}Q_{4n}^*Q_{1n}^*]
4451  Double_t reQ5nQ4nstarQ1nstar = dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n
4452                               + dImQ5n*dImQ4n*dReQ1n;                              
4453  // Re[Q_{6n}Q_{5n}^*Q_{1n}^*]                              
4454  Double_t reQ6nQ5nstarQ1nstar = dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n
4455                               + dImQ6n*dImQ5n*dReQ1n;
4456  // Re[Q_{6n}Q_{4n}^*Q_{2n}^*]                       
4457  Double_t reQ6nQ4nstarQ2nstar = dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
4458                               + dImQ6n*dImQ4n*dReQ2n;
4459  // Re[Q_{3n}Q_{n}Q_{2n}^*Q_{2n}^*]
4460  Double_t reQ3nQ1nQ2nstarQ2nstar = (pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
4461                                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);                                
4462  // Re[Q_{3n}Q_{n}^*Q_{n}^*Q_{n}^*]
4463  Double_t reQ3nQ1nstarQ1nstarQ1nstar = dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
4464                                      + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3);
4465  // Re[Q_{6n}Q_{2n}^*Q_{2n}^*Q_{2n}^*]
4466  Double_t reQ6nQ2nstarQ2nstarQ2nstar = dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
4467                                      + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3);
4468  // Re[Q_{4n}Q_{2n}^*Q_{n}^*Q_{n}^*]
4469  Double_t reQ4nQ2nstarQ1nstarQ1nstar = (dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
4470                                      + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n);  
4471  // Re[Q_{4n}Q_{2n}^*Q_{3n}^*Q_{3n}^*]
4472  Double_t reQ4nQ2nQ3nstarQ3nstar = (dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
4473                                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n;                    
4474  // Re[Q_{4n}Q_{n}Q_{3n}^*Q_{2n}^*]
4475  Double_t reQ4nQ1nQ3nstarQ2nstar = dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
4476                                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
4477                                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
4478                                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n;
4479
4480  // Re[Q_{5n}Q_{n}Q_{4n}^*Q_{2n}^*]
4481  Double_t reQ5nQ1nQ4nstarQ2nstar = dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
4482                                  + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
4483                                  - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n 
4484                                  + dImQ1n*dImQ2n*dReQ4n*dReQ5n+dReQ1n*dReQ2n*dReQ4n*dReQ5n;                                  
4485  // Re[Q_{5n}Q_{n}Q_{3n}^*Q_{3n}^*]                                  
4486  Double_t reQ5nQ1nQ3nstarQ3nstar = dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
4487                                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
4488                                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n;
4489  // Re[Q_{5n}Q_{3n}^*Q_{n}^*Q_{n}^*]                                  
4490  Double_t reQ5nQ3nstarQ1nstarQ1nstar = -pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
4491                                      + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
4492                                      - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n;                     
4493  // Re[Q_{5n}Q_{2n}^*Q_{2n}^*Q_{n}^*]                                  
4494  Double_t reQ5nQ2nstarQ2nstarQ1nstar = -pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
4495                                      + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
4496                                      - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n;                                     
4497  // Re[Q_{6n}Q_{4n}^*Q_{n}^*Q_{n}^*]                                  
4498  Double_t reQ6nQ4nstarQ1nstarQ1nstar = -pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
4499                                      +  2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
4500                                      -  pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n;
4501  /*// |Q_{2n}|^2 |Q_{n}|^2
4502  Double_t dQ2nQ1nQ2nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
4503  // |Q_{4n}|^2 |Q_{2n}|^2
4504  Double_t dQ4nQ2nQ4nstarQ2nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.));
4505  // |Q_{3n}|^2 |Q_{2n}|^2
4506  Double_t dQ3nQ2nQ3nstarQ2nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.));
4507  // |Q_{5n}|^2 |Q_{n}|^2
4508  Double_t dQ5nQ1nQ5nstarQ1nstar = (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
4509  // |Q_{3n}|^2 |Q_{n}|^2
4510  Double_t dQ3nQ1nQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));*/
4511  // Re[Q_{2n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*]
4512  /*Double_t reQ2nQ1nQ1nstarQ1nstarQ1nstar = (dReQ2n*dReQ1n-dImQ2n*dImQ1n)*(pow(dReQ1n,3)-3.*dReQ1n*pow(dImQ1n,2))
4513                                         + (dReQ2n*dImQ1n+dReQ1n*dImQ2n)*(3.*dImQ1n*pow(dReQ1n,2)-pow(dImQ1n,3));*/ 
4514  // Re[Q_{2n}Q_{2n}Q_{2n}^*Q_{n}^*Q_{n}^*]
4515  /*Double_t reQ2nQ2nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
4516                                         * (dReQ2n*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) + 2.*dImQ2n*dReQ1n*dImQ1n);*/
4517  /*// Re[Q_{4n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
4518  Double_t reQ4nQ1nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,4.)*dReQ4n-6.*pow(dReQ1n,2.)*dReQ4n*pow(dImQ1n,2.)
4519                                             + pow(dImQ1n,4.)*dReQ4n+4.*pow(dReQ1n,3.)*dImQ1n*dImQ4n
4520                                             - 4.*pow(dImQ1n,3.)*dReQ1n*dImQ4n;*/
4521  // Re[Q_{3n}Q_{n}Q_{2n}^*Q_{n}^*Q_{n}^*]
4522  /*Double_t reQ3nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
4523                                         * (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n
4524                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n);*/
4525  // Re[Q_{6n}Q_{n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
4526  Double_t reQ6nQ3nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
4527                                      - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
4528                                      + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
4529                                      + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n;
4530  // Re[Q_{3n}Q_{3n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
4531  /*Double_t reQ3nQ3nQ3nstarQ2nstarQ1nstar = (pow(dImQ3n,2.)+pow(dReQ3n,2.))
4532                                         * (dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n
4533                                         - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n);*/   
4534  /*// Re[Q_{3n}Q_{3n}Q_{2n}^*Q_{2n}^*Q_{2n}^*]
4535  Double_t reQ3nQ3nQ2nstarQ2nstarQ2nstar = pow(dReQ2n,3.)*pow(dReQ3n,2.) 
4536                                         - 3.*dReQ2n*pow(dReQ3n,2.)*pow(dImQ2n,2.)
4537                                         + 6.*pow(dReQ2n,2.)*dReQ3n*dImQ2n*dImQ3n 
4538                                         - 2.*dReQ3n*pow(dImQ2n,3.)*dImQ3n-pow(dReQ2n,3.)*pow(dImQ3n,2.) 
4539                                         + 3.*dReQ2n*pow(dImQ2n,2.)*pow(dImQ3n,2.);*/
4540  // Re[Q_{4n}Q_{2n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
4541  /*Double_t reQ4nQ2nQ3nstarQ2nstarQ1nstar = (pow(dImQ2n,2.)+pow(dReQ2n,2.))
4542                                         * (dImQ3n*dImQ4n*dReQ1n+dImQ1n*dImQ4n*dReQ3n 
4543                                         - dImQ1n*dImQ3n*dReQ4n+dReQ1n*dReQ3n*dReQ4n);*/
4544  // Re[Q_{3n}Q_{2n}Q_{3n}^*Q_{n}^*Q_{n}^*]
4545  /*Double_t reQ3nQ2nQ3nstarQ1nstarQ1nstar = -(pow(dImQ3n,2.)+pow(dReQ3n,2.))
4546                                         * (-2.*dImQ1n*dImQ2n*dReQ1n+pow(dImQ1n,2.)*dReQ2n-pow(dReQ1n,2.)*dReQ2n);*/                              
4547  // Re[Q_{3n}Q_{2n}Q_{2n}^*Q_{2n}^*Q_{n}^*]
4548  /*Double_t reQ3nQ2nQ2nstarQ2nstarQ1nstar = (pow(dImQ2n,2.)+pow(dReQ2n,2.))
4549                                         * (dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n 
4550                                         - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n);*/
4551 /* // Re[Q_{5n}Q_{n}Q_{3n}^*Q_{2n}^*Q_{n}^*]
4552  Double_t reQ5nQ1nQ3nstarQ2nstarQ1nstar = (pow(dImQ1n,2.)+pow(dReQ1n,2.))
4553                                         * (dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n 
4554                                         - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n);   
4555  */
4556  /*
4557  // Re[Q_{2n}Q_{2n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
4558  Double_t reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)*dReQ2n-2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)
4559                                                + dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dImQ2n)
4560                                                * (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)
4561                                                - dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n+pow(dImQ1n,2.)*dImQ2n); 
4562  // Re[Q_{3n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
4563  Double_t reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
4564                                                * (pow(dReQ1n,3.)*dReQ3n-3.*dReQ1n*dReQ3n*pow(dImQ1n,2.)
4565                                                + 3.*pow(dReQ1n,2.)*dImQ1n*dImQ3n-pow(dImQ1n,3.)*dImQ3n);
4566  */
4567  // |Q_{2n}|^2 |Q_{n}|^4
4568  //Double_t dQ2nQ1nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.); 
4569  /*
4570  // |Q_{3n}|^2 |Q_{2n}|^2 |Q_{n}|^2
4571  Double_t dQ3nQ2nQ1nQ3nstarQ2nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4572                                           * (pow(dReQ1n,2.)+pow(dImQ1n,2.));
4573  // Re[Q_{2n}Q_{n}Q_{n}Q_{n}^*Q_{n}^*Q_{n}^*Q_{n}^*]
4574  Double_t reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
4575                                                   * (pow(dReQ1n,2.)*dReQ2n-dReQ2n*pow(dImQ1n,2.)
4576                                                   + 2.*dReQ1n*dImQ1n*dImQ2n);                                                  
4577  */
4578  // Re[Q_{6n}Q_{2n}^*Q_{2n}^*Q_{n}^*Q_{n}^*]
4579  /*Double_t reQ6nQ2nstarQ2nstarQ1nstarQ1nstar = pow(dReQ1n*dReQ2n,2.)*dReQ6n-pow(dReQ2n*dImQ1n,2.)*dReQ6n
4580                                             - 4.*dReQ1n*dReQ2n*dReQ6n*dImQ1n*dImQ2n 
4581                                             - pow(dReQ1n*dImQ2n,2.)*dReQ6n+pow(dImQ1n*dImQ2n,2.)*dReQ6n
4582                                             + 2.*dReQ1n*pow(dReQ2n,2.)*dImQ1n*dImQ6n
4583                                             + 2.*pow(dReQ1n,2.)*dReQ2n*dImQ2n*dImQ6n 
4584                                             - 2.*dReQ2n*pow(dImQ1n,2.)*dImQ2n*dImQ6n 
4585                                             - 2.*dReQ1n*dImQ1n*pow(dImQ2n,2.)*dImQ6n;
4586  */                                                                                      
4587  // Re[Q_{4n}Q_{1n}Q_{1n}Q_{3n}^*Q_{3n}^*]
4588  /*
4589  Double_t reQ4nQ1nQ1nQ3nstarQ3nstar = pow(dReQ1n*dReQ3n,2.)*dReQ4n-pow(dReQ3n*dImQ1n,2.)*dReQ4n  
4590                                     + 4.*dReQ1n*dReQ3n*dReQ4n*dImQ1n*dImQ3n 
4591                                     - pow(dReQ1n*dImQ3n,2.)*dReQ4n+pow(dImQ1n*dImQ3n,2.)*dReQ4n  
4592                                     - 2.*dReQ1n*pow(dReQ3n,2.)*dImQ1n*dImQ4n 
4593                                     + 2.*pow(dReQ1n,2.)*dReQ3n*dImQ3n*dImQ4n 
4594                                     - 2.*dReQ3n*pow(dImQ1n,2.)*dImQ3n*dImQ4n 
4595                                     + 2.*dReQ1n*dImQ1n*pow(dImQ3n,2.)*dImQ4n;*/
4596  /* 
4597  // Re[Q_{3n}Q_{3n}Q_{2n}^*Q_{2n}^*Q_{1n}^*Q_{1n}^*]
4598  Double_t reQ3nQ3nQ2nstarQ2nstarQ1nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ2n*dReQ3n*dImQ1n-dReQ1n*dReQ3n*dImQ2n 
4599                                                - dReQ3n*dImQ1n*dImQ2n+dReQ1n*dReQ2n*dImQ3n+dReQ2n*dImQ1n*dImQ3n 
4600                                                + dReQ1n*dImQ2n*dImQ3n-dImQ1n*dImQ2n*dImQ3n)*(dReQ1n*dReQ2n*dReQ3n 
4601                                                + dReQ2n*dReQ3n*dImQ1n+dReQ1n*dReQ3n*dImQ2n-dReQ3n*dImQ1n*dImQ2n 
4602                                                - dReQ1n*dReQ2n*dImQ3n+dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n 
4603                                                + dImQ1n*dImQ2n*dImQ3n);
4604  */
4605
4606  // b) Determine multiplicity weights and fill some histos:
4607  Double_t d2pMultiplicityWeight = 0.; // weight for <2>_{...} to get <<2>>_{...}
4608  Double_t d3pMultiplicityWeight = 0.; // weight for <3>_{...} to get <<3>>_{...}
4609  Double_t d4pMultiplicityWeight = 0.; // weight for <4>_{...} to get <<4>>_{...}
4610  Double_t d5pMultiplicityWeight = 0.; // weight for <5>_{...} to get <<5>>_{...}
4611  Double_t d6pMultiplicityWeight = 0.; // weight for <6>_{...} to get <<6>>_{...}
4612  Double_t d7pMultiplicityWeight = 0.; // weight for <7>_{...} to get <<7>>_{...}
4613  Double_t d8pMultiplicityWeight = 0.; // weight for <8>_{...} to get <<8>>_{...}
4614  if(!strcmp(fMultiplicityWeight->Data(),"combinations")) // default multiplicity weight
4615  {
4616   d2pMultiplicityWeight = dMult*(dMult-1.);
4617   d3pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.);
4618   d4pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.);
4619   d5pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.);
4620   d6pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.);
4621   d7pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.);
4622   d8pMultiplicityWeight = dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.);
4623  } else if(!strcmp(fMultiplicityWeight->Data(),"unit"))
4624    {
4625     d2pMultiplicityWeight = 1.;
4626     d3pMultiplicityWeight = 1.;
4627     d4pMultiplicityWeight = 1.;
4628     d5pMultiplicityWeight = 1.;
4629     d6pMultiplicityWeight = 1.;
4630     d7pMultiplicityWeight = 1.;
4631     d8pMultiplicityWeight = 1.;
4632    } else if(!strcmp(fMultiplicityWeight->Data(),"multiplicity"))
4633      {
4634       d2pMultiplicityWeight = dMult;
4635       d3pMultiplicityWeight = dMult;
4636       d4pMultiplicityWeight = dMult;
4637       d5pMultiplicityWeight = dMult;
4638       d6pMultiplicityWeight = dMult;
4639       d7pMultiplicityWeight = dMult;
4640       d8pMultiplicityWeight = dMult; 
4641      }       
4642  for(Int_t p=0;p<=1;p++) // power (0=linear,1=quadratic)
4643  {
4644   fMixedHarmonicEventWeights[p]->Fill(0.5,pow(dMult,p+1));
4645   fMixedHarmonicEventWeights[p]->Fill(1.5,pow(d2pMultiplicityWeight,p+1));
4646   fMixedHarmonicEventWeights[p]->Fill(2.5,pow(d3pMultiplicityWeight,p+1));
4647   fMixedHarmonicEventWeights[p]->Fill(3.5,pow(d4pMultiplicityWeight,p+1));
4648   fMixedHarmonicEventWeights[p]->Fill(4.5,pow(d5pMultiplicityWeight,p+1));
4649   fMixedHarmonicEventWeights[p]->Fill(5.5,pow(d6pMultiplicityWeight,p+1));
4650   fMixedHarmonicEventWeights[p]->Fill(6.5,pow(d7pMultiplicityWeight,p+1));
4651   fMixedHarmonicEventWeights[p]->Fill(7.5,pow(d8pMultiplicityWeight,p+1));
4652  } // end of for(Int_t p=0;p<=1;p++) // power (0=linear,1=quadratic)   
4653  fMixedHarmonicProductOfEventWeights->Fill(0.5,0.5,dMult*dMult);
4654  fMixedHarmonicProductOfEventWeights->Fill(0.5,1.5,dMult*d2pMultiplicityWeight);
4655  fMixedHarmonicProductOfEventWeights->Fill(0.5,2.5,dMult*d3pMultiplicityWeight);
4656  fMixedHarmonicProductOfEventWeights->Fill(0.5,3.5,dMult*d4pMultiplicityWeight);
4657  fMixedHarmonicProductOfEventWeights->Fill(0.5,4.5,dMult*d5pMultiplicityWeight);
4658  fMixedHarmonicProductOfEventWeights->Fill(0.5,5.5,dMult*d6pMultiplicityWeight);
4659  fMixedHarmonicProductOfEventWeights->Fill(0.5,6.5,dMult*d7pMultiplicityWeight);
4660  fMixedHarmonicProductOfEventWeights->Fill(0.5,7.5,dMult*d8pMultiplicityWeight);
4661  fMixedHarmonicProductOfEventWeights->Fill(1.5,1.5,d2pMultiplicityWeight*d2pMultiplicityWeight);
4662  fMixedHarmonicProductOfEventWeights->Fill(1.5,2.5,d2pMultiplicityWeight*d3pMultiplicityWeight);
4663  fMixedHarmonicProductOfEventWeights->Fill(1.5,3.5,d2pMultiplicityWeight*d4pMultiplicityWeight);
4664  fMixedHarmonicProductOfEventWeights->Fill(1.5,4.5,d2pMultiplicityWeight*d5pMultiplicityWeight);
4665  fMixedHarmonicProductOfEventWeights->Fill(1.5,5.5,d2pMultiplicityWeight*d6pMultiplicityWeight);
4666  fMixedHarmonicProductOfEventWeights->Fill(1.5,6.5,d2pMultiplicityWeight*d7pMultiplicityWeight);
4667  fMixedHarmonicProductOfEventWeights->Fill(1.5,7.5,d2pMultiplicityWeight*d8pMultiplicityWeight);
4668  fMixedHarmonicProductOfEventWeights->Fill(2.5,2.5,d3pMultiplicityWeight*d3pMultiplicityWeight);
4669  fMixedHarmonicProductOfEventWeights->Fill(2.5,3.5,d3pMultiplicityWeight*d4pMultiplicityWeight);
4670  fMixedHarmonicProductOfEventWeights->Fill(2.5,4.5,d3pMultiplicityWeight*d5pMultiplicityWeight);
4671  fMixedHarmonicProductOfEventWeights->Fill(2.5,5.5,d3pMultiplicityWeight*d6pMultiplicityWeight);
4672  fMixedHarmonicProductOfEventWeights->Fill(2.5,6.5,d3pMultiplicityWeight*d7pMultiplicityWeight);
4673  fMixedHarmonicProductOfEventWeights->Fill(2.5,7.5,d3pMultiplicityWeight*d8pMultiplicityWeight);
4674  fMixedHarmonicProductOfEventWeights->Fill(3.5,3.5,d4pMultiplicityWeight*d4pMultiplicityWeight);
4675  fMixedHarmonicProductOfEventWeights->Fill(3.5,4.5,d4pMultiplicityWeight*d5pMultiplicityWeight);
4676  fMixedHarmonicProductOfEventWeights->Fill(3.5,5.5,d4pMultiplicityWeight*d6pMultiplicityWeight);
4677  fMixedHarmonicProductOfEventWeights->Fill(3.5,6.5,d4pMultiplicityWeight*d7pMultiplicityWeight);
4678  fMixedHarmonicProductOfEventWeights->Fill(3.5,7.5,d4pMultiplicityWeight*d8pMultiplicityWeight);
4679  fMixedHarmonicProductOfEventWeights->Fill(4.5,4.5,d5pMultiplicityWeight*d5pMultiplicityWeight);
4680  fMixedHarmonicProductOfEventWeights->Fill(4.5,5.5,d5pMultiplicityWeight*d6pMultiplicityWeight);
4681  fMixedHarmonicProductOfEventWeights->Fill(4.5,6.5,d5pMultiplicityWeight*d7pMultiplicityWeight);
4682  fMixedHarmonicProductOfEventWeights->Fill(4.5,7.5,d5pMultiplicityWeight*d8pMultiplicityWeight);
4683  fMixedHarmonicProductOfEventWeights->Fill(5.5,5.5,d6pMultiplicityWeight*d6pMultiplicityWeight);
4684  fMixedHarmonicProductOfEventWeights->Fill(5.5,6.5,d6pMultiplicityWeight*d7pMultiplicityWeight);
4685  fMixedHarmonicProductOfEventWeights->Fill(5.5,7.5,d6pMultiplicityWeight*d8pMultiplicityWeight);
4686  fMixedHarmonicProductOfEventWeights->Fill(6.5,6.5,d7pMultiplicityWeight*d7pMultiplicityWeight); 
4687  fMixedHarmonicProductOfEventWeights->Fill(6.5,7.5,d7pMultiplicityWeight*d8pMultiplicityWeight); 
4688  fMixedHarmonicProductOfEventWeights->Fill(7.5,7.5,d8pMultiplicityWeight*d8pMultiplicityWeight); 
4689  
4690  // c) Calculate 2-p correlations:
4691  Double_t two1n1n = 0.; // <2>_{1n|1n} = <cos(1n(phi1-phi2))>
4692  Double_t two2n2n = 0.; // <2>_{2n|2n} = <cos(2n(phi1-phi2))>
4693  Double_t two3n3n = 0.; // <2>_{3n|3n} = <cos(3n(phi1-phi2))>
4694  Double_t two4n4n = 0.; // <2>_{4n|4n} = <cos(4n(phi1-phi2))>
4695  Double_t two5n5n = 0.; // <2>_{5n|5n} = <cos(5n(phi1-phi2))>
4696  Double_t two6n6n = 0.; // <2>_{6n|6n} = <cos(6n(phi1-phi2))>
4697  if(dMult>1.)
4698  {
4699   two1n1n = (pow(dReQ1n,2.)+pow(dImQ1n,2.)-dMult)/(dMult*(dMult-1.)); 
4700   two2n2n = (pow(dReQ2n,2.)+pow(dImQ2n,2.)-dMult)/(dMult*(dMult-1.)); 
4701   two3n3n = (pow(dReQ3n,2.)+pow(dImQ3n,2.)-dMult)/(dMult*(dMult-1.)); 
4702   two4n4n = (pow(dReQ4n,2.)+pow(dImQ4n,2.)-dMult)/(dMult*(dMult-1.)); 
4703   two5n5n = (pow(dReQ5n,2.)+pow(dImQ5n,2.)-dMult)/(dMult*(dMult-1.)); 
4704   two6n6n = (pow(dReQ6n,2.)+pow(dImQ6n,2.)-dMult)/(dMult*(dMult-1.));   
4705   f2pCorrelations->Fill(0.5,two1n1n,d2pMultiplicityWeight);
4706   f2pCorrelations->Fill(1.5,two2n2n,d2pMultiplicityWeight);
4707   f2pCorrelations->Fill(2.5,two3n3n,d2pMultiplicityWeight);
4708   f2pCorrelations->Fill(3.5,two4n4n,d2pMultiplicityWeight);
4709   f2pCorrelations->Fill(4.5,two5n5n,d2pMultiplicityWeight);
4710   f2pCorrelations->Fill(5.5,two6n6n,d2pMultiplicityWeight);
4711   allMixedCorrelators[0]=two1n1n;
4712   allMixedCorrelators[1]=two2n2n;
4713   allMixedCorrelators[2]=two3n3n;
4714   allMixedCorrelators[3]=two4n4n;
4715   allMixedCorrelators[4]=two5n5n;
4716   allMixedCorrelators[5]=two6n6n;
4717  } // end of if(dMult>1.)
4718
4719  // d) Calculate 3-p correlations:
4720  //  d1) Two distinct harmonics (3): 
4721  Double_t three2n1n1n = 0.; // <3>_{2n|1n,1n} = <cos(n(2*phi1-1*phi2-1*phi3))>
4722  Double_t three4n2n2n = 0.; // <3>_{4n|2n,2n} = <cos(n(4*phi1-2*phi2-2*phi3))>
4723  Double_t three6n3n3n = 0.; // <3>_{6n|3n,3n} = <cos(n(6*phi1-3*phi2-3*phi3))> 
4724  //  d2) Three distinct harmonics (6): 
4725  Double_t three3n2n1n = 0.; // <3>_{3n|2n,1n} = <cos(n(3*phi1-2*phi2-1*phi3))>
4726  Double_t three4n3n1n = 0.; // <3>_{4n|3n,1n} = <cos(n(4*phi1-3*phi2-1*phi3))> 
4727  Double_t three5n3n2n = 0.; // <3>_{5n|3n,2n} = <cos(n(5*phi1-3*phi2-2*phi3))>
4728  Double_t three5n4n1n = 0.; // <3>_{5n|4n,1n} = <cos(n(5*phi1-4*phi2-1*phi3))> 
4729  Double_t three6n4n2n = 0.; // <3>_{6n|4n,2n} = <cos(n(6*phi1-4*phi2-2*phi3))> 
4730  Double_t three6n5n1n = 0.; // <3>_{6n|5n,1n} = <cos(n(6*phi1-5*phi2-1*phi3))>
4731  if(dMult>2.)
4732  {
4733   three2n1n1n = (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n
4734               - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
4735               / (dMult*(dMult-1.)*(dMult-2.)); 
4736   three4n2n2n = (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n
4737               - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*dMult)
4738               / (dMult*(dMult-1.)*(dMult-2.)); 
4739   three6n3n3n = (reQ6nQ3nstarQ3nstar
4740               - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4741               - (pow(dReQ6n,2.)+pow(dImQ6n,2.))+2.*dMult)
4742               / (dMult*(dMult-1.)*(dMult-2.));  
4743   three3n2n1n = (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
4744               + dImQ3n*dImQ2n*dReQ1n-(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4745               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))-(pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4746               / (dMult*(dMult-1.)*(dMult-2.));
4747   three4n3n1n = (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)
4748               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))-(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4749               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4750               / (dMult*(dMult-1.)*(dMult-2.));  
4751   three5n3n2n = (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n
4752               + dImQ5n*dImQ2n*dReQ3n-(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4753               - (pow(dReQ3n,2.)+pow(dImQ3n,2.))
4754               - (pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
4755               / (dMult*(dMult-1.)*(dMult-2.)); 
4756   three5n4n1n = (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n
4757               + dImQ5n*dImQ4n*dReQ1n-(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4758               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))
4759               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4760               / (dMult*(dMult-1.)*(dMult-2.));
4761   three6n4n2n = (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
4762               + dImQ6n*dImQ4n*dReQ2n-(pow(dReQ6n,2.)+pow(dImQ6n,2.))
4763               - (pow(dReQ4n,2.)+pow(dImQ4n,2.))-(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
4764               / (dMult*(dMult-1.)*(dMult-2.));
4765   three6n5n1n = (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n
4766               + dImQ6n*dImQ5n*dReQ1n-(pow(dReQ6n,2.)+pow(dImQ6n,2.))
4767               - (pow(dReQ5n,2.)+pow(dImQ5n,2.))
4768               - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
4769               / (dMult*(dMult-1.)*(dMult-2.)); 
4770   f3pCorrelations->Fill(0.5,three2n1n1n,d3pMultiplicityWeight);
4771   f3pCorrelations->Fill(1.5,three4n2n2n,d3pMultiplicityWeight);
4772   f3pCorrelations->Fill(2.5,three6n3n3n,d3pMultiplicityWeight);
4773   //f3pCorrelations->Fill(3.5,0.,d3pMultiplicityWeight); // empty TBI
4774   f3pCorrelations->Fill(4.5,three3n2n1n,d3pMultiplicityWeight);
4775   f3pCorrelations->Fill(5.5,three4n3n1n,d3pMultiplicityWeight);
4776   f3pCorrelations->Fill(6.5,three5n3n2n,d3pMultiplicityWeight);
4777   f3pCorrelations->Fill(7.5,three5n4n1n,d3pMultiplicityWeight);
4778   f3pCorrelations->Fill(8.5,three6n4n2n,d3pMultiplicityWeight);
4779   f3pCorrelations->Fill(9.5,three6n5n1n,d3pMultiplicityWeight);
4780   allMixedCorrelators[6]=three2n1n1n;
4781   allMixedCorrelators[7]=three4n2n2n;
4782   allMixedCorrelators[8]=three6n3n3n;
4783   allMixedCorrelators[9]=three3n2n1n;
4784   allMixedCorrelators[10]=three4n3n1n;
4785   allMixedCorrelators[11]=three5n3n2n;
4786   allMixedCorrelators[12]=three5n4n1n;
4787   allMixedCorrelators[13]=three6n4n2n;
4788   allMixedCorrelators[14]=three6n5n1n;
4789  } // end of if(dMult>2.)
4790
4791  // e) Calculate 4-p correlations:
4792  //  e1) Single harmonic (6): 
4793  Double_t four1n1n1n1n = 0.; // <4>_{1n,1n|1n,1n} = <cos(1*n(phi1+phi2-phi3-phi4))>
4794  Double_t four2n2n2n2n = 0.; // <4>_{2n,2n|2n,2n} = <cos(2*n(phi1+phi2-phi3-phi4))>
4795  Double_t four3n3n3n3n = 0.; // <4>_{3n,3n|3n,3n} = <cos(3*n(phi1+phi2-phi3-phi4))>
4796  Double_t four4n4n4n4n = 0.; // <4>_{4n,4n|4n,4n} = <cos(4*n(phi1+phi2-phi3-phi4))>
4797  Double_t four5n5n5n5n = 0.; // <4>_{5n,5n|5n,5n} = <cos(5*n(phi1+phi2-phi3-phi4))>
4798  Double_t four6n6n6n6n = 0.; // <4>_{6n,6n|6n,6n} = <cos(6*n(phi1+phi2-phi3-phi4))>
4799  //  e2) "Standard candles" (15):
4800  Double_t four2n1n2n1n = 0.; // <4>_{2n,1n|2n,1n} = <cos(n(2*phi1+1*phi2-2*phi3-1*phi4))>
4801  Double_t four3n1n3n1n = 0.; // <4>_{3n,1n|3n,1n} = <cos(n(3*phi1+1*phi2-3*phi3-1*phi4))>
4802  Double_t four3n2n3n2n = 0.; // <4>_{3n,2n|3n,2n} = <cos(n(3*phi1+2*phi2-3*phi3-2*phi4))>
4803  Double_t four4n1n4n1n = 0.; // <4>_{4n,1n|4n,1n} = <cos(n(4*phi1+1*phi2-4*phi3-1*phi4))>
4804  Double_t four4n2n4n2n = 0.; // <4>_{4n,2n|4n,2n} = <cos(n(4*phi1+2*phi2-4*phi3-2*phi4))>
4805  Double_t four4n3n4n3n = 0.; // <4>_{4n,3n|4n,3n} = <cos(n(4*phi1+3*phi2-4*phi3-3*phi4))>
4806  Double_t four5n1n5n1n = 0.; // <4>_{5n,1n|5n,1n} = <cos(n(5*phi1+1*phi2-5*phi3-1*phi4))>
4807  Double_t four5n2n5n2n = 0.; // <4>_{5n,2n|5n,2n} = <cos(n(5*phi1+2*phi2-5*phi3-2*phi4))>
4808  Double_t four5n3n5n3n = 0.; // <4>_{5n,3n|5n,3n} = <cos(n(5*phi1+3*phi2-5*phi3-3*phi4))>
4809  Double_t four5n4n5n4n = 0.; // <4>_{5n,4n|5n,4n} = <cos(n(5*phi1+4*phi2-5*phi3-4*phi4))>
4810  Double_t four6n1n6n1n = 0.; // <4>_{6n,1n|6n,1n} = <cos(n(6*phi1+1*phi2-6*phi3-1*phi4))>
4811  Double_t four6n2n6n2n = 0.; // <4>_{6n,2n|6n,2n} = <cos(n(6*phi1+2*phi2-6*phi3-2*phi4))>
4812  Double_t four6n3n6n3n = 0.; // <4>_{6n,3n|6n,3n} = <cos(n(6*phi1+3*phi2-6*phi3-3*phi4))>
4813  Double_t four6n4n6n4n = 0.; // <4>_{6n,4n|6n,4n} = <cos(n(6*phi1+4*phi2-6*phi3-4*phi4))>
4814  Double_t four6n5n6n5n = 0.; // <4>_{6n,5n|6n,5n} = <cos(n(6*phi1+5*phi2-6*phi3-5*phi4))>
4815  //  e3) Two distinct harmonics (2): 
4816  Double_t four3n1n1n1n = 0.; // <4>_{3n|1n,1n,1n} = <cos(n(3*phi1-1*phi2-1*phi3-1*phi4))>
4817  Double_t four6n2n2n2n = 0.; // <4>_{6n|2n,2n,2n} = <cos(n(6*phi1-2*phi2-2*phi3-2*phi4))>
4818  //  e4) Three distinct harmonics (10): 
4819  Double_t four3n1n2n2n = 0.; // <4>_{3n,1n|2n,2n} = <cos(n(3*phi1+1*phi2-2*phi3-2*phi4))>
4820  Double_t four4n2n1n1n = 0.; // <4>_{4n|2n,1n,1n} = <cos(n(4*phi1-2*phi2-1*phi3-1*phi4))>
4821  Double_t four4n2n3n3n = 0.; // <4>_{4n,2n|3n,3n} = <cos(n(4*phi1+2*phi2-3*phi3-3*phi4))>
4822  Double_t four5n2n2n1n = 0.; // <4>_{5n|2n,2n,1n} = <cos(n(5*phi1-2*phi2-2*phi3-1*phi4))>
4823  Double_t four5n3n1n1n = 0.; // <4>_{5n|3n,1n,1n} = <cos(n(5*phi1-3*phi2-1*phi3-1*phi4))>
4824  Double_t four5n1n3n3n = 0.; // <4>_{5n,1n|3n,3n} = <cos(n(5*phi1+1*phi2-3*phi3-3*phi4))>
4825  Double_t four5n3n4n4n = 0.; // <4>_{5n,3n|4n,4n} = <cos(n(5*phi1+3*phi2-4*phi3-4*phi4))>
4826  Double_t four6n4n1n1n = 0.; // <4>_{6n|4n,1n,1n} = <cos(n(6*phi1-4*phi2-1*phi3-1*phi4))>
4827  Double_t four6n2n4n4n = 0.; // <4>_{6n,2n|4n,4n} = <cos(n(6*phi1+2*phi2-4*phi3-4*phi4))>
4828  Double_t four6n4n5n5n = 0.; // <4>_{6n,4n|5n,5n} = <cos(n(6*phi1+4*phi2-5*phi3-5*phi4))>
4829  //  e5) Four distinct harmonics (8): 
4830  Double_t four4n1n3n2n = 0.; // <4>_{4n,1n|3n,2n} = <cos(n(4*phi1+1*phi2-3*phi3-2*phi4))>
4831  Double_t four5n1n4n2n = 0.; // <4>_{5n,1n|4n,2n} = <cos(n(5*phi1+1*phi2-4*phi3-2*phi4))>
4832  Double_t four5n2n4n3n = 0.; // <4>_{5n,2n|4n,3n} = <cos(n(5*phi1+2*phi2-4*phi3-3*phi4))>
4833  Double_t four6n1n4n3n = 0.; // <4>_{6n,1n|4n,3n} = <cos(n(6*phi1+1*phi2-4*phi3-3*phi4))>
4834  Double_t four6n1n5n2n = 0.; // <4>_{6n,1n|5n,2n} = <cos(n(6*phi1+1*phi2-5*phi3-2*phi4))>
4835  Double_t four6n3n2n1n = 0.; // <4>_{6n|3n,2n,1n} = <cos(n(6*phi1-3*phi2-2*phi3-1*phi4))>
4836  Double_t four6n2n5n3n = 0.; // <4>_{6n,2n|5n,3n} = <cos(n(6*phi1+2*phi2-5*phi3-3*phi4))>
4837  Double_t four6n3n5n4n = 0.; // <4>_{6n,3n|5n,4n} = <cos(n(6*phi1+3*phi2-5*phi3-4*phi4))>
4838  if(dMult>3.)
4839  {
4840   // Single harmonic (6): 
4841   four1n1n1n1n = (2.*dMult*(dMult-3.)+pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ1n,2.)
4842                + pow(dImQ1n,2.))-2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
4843                + (pow(dReQ2n,2.)+pow(dImQ2n,2.)))
4844                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));     
4845   four2n2n2n2n = (2.*dMult*(dMult-3.)+pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ2n,2.)
4846                + pow(dImQ2n,2.))-2.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
4847                + (pow(dReQ4n,2.)+pow(dImQ4n,2.)))
4848                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.)); 
4849   four3n3n3n3n = (2.*dMult*(dMult-3.)+pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ3n,2.)
4850                + pow(dImQ3n,2.))-2.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
4851                + (pow(dReQ6n,2.)+pow(dImQ6n,2.)))
4852                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));     
4853   four4n4n4n4n = (2.*dMult*(dMult-3.)+pow((pow(dReQ4n,2.)+pow(dImQ4n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ4n,2.)
4854                + pow(dImQ4n,2.))-2.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
4855                + (pow(dReQ8n,2.)+pow(dImQ8n,2.)))
4856                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));     
4857   four5n5n5n5n = (2.*dMult*(dMult-3.)+pow((pow(dReQ5n,2.)+pow(dImQ5n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ5n,2.)
4858                + pow(dImQ5n,2.))-2.*(pow(dReQ5n,2.)*dReQ10n+2.*dReQ5n*dImQ5n*dImQ10n-pow(dImQ5n,2.)*dReQ10n)
4859                + (pow(dReQ10n,2.)+pow(dImQ10n,2.)))
4860                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));    
4861   four6n6n6n6n = (2.*dMult*(dMult-3.)+pow((pow(dReQ6n,2.)+pow(dImQ6n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ6n,2.)
4862                + pow(dImQ6n,2.))-2.*(pow(dReQ6n,2.)*dReQ12n+2.*dReQ6n*dImQ6n*dImQ12n-pow(dImQ6n,2.)*dReQ12n)
4863                + (pow(dReQ12n,2.)+pow(dImQ12n,2.)))
4864                / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));  
4865   // "Standard candles" (15):
4866   four2n1n2n1n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4867                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
4868                + dImQ3n*dImQ2n*dReQ1n)-2.*(pow(dReQ1n,2.)*dReQ2n
4869                + 2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n))
4870                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4871                - ((dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4872                + (dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-(pow(dReQ3n,2.)+pow(dImQ3n,2.)))
4873                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4874                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));
4875   four3n1n3n1n = ((pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4876                - 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
4877                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
4878                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4879                + pow(dReQ2n,2.)+pow(dImQ2n,2.)-(dMult-4.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
4880                + dMult*(dMult-6.))
4881                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4882   four3n2n3n2n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4883                - 2.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
4884                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
4885                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)               
4886                - (dMult-4.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
4887                + dMult*(dMult-6.))
4888                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
4889   four4n1n4n1n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
4890                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ1n*dImQ4n+dImQ5n*dImQ1n*dReQ4n)
4891                - 2.*(dReQ3n*dReQ4n*dReQ1n+dImQ3n*dImQ4n*dReQ1n+dReQ3n*dImQ4n*dImQ1n-dImQ3n*dImQ1n*dReQ4n)
4892                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)
4893                - (dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
4894                + dMult*(dMult-6.))
4895                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
4896   four4n2n4n2n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4897                - 2.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
4898                + dImQ6n*dImQ4n*dReQ2n)-2.*(pow(dReQ2n,2.)*dReQ4n
4899                + 2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n))
4900                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4901                - ((dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4902                + (dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-(pow(dReQ6n,2.)+pow(dImQ6n,2.)))
4903                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4904                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));
4905   four4n3n4n3n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
4906                - 2.*(dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ3n*dImQ4n+dImQ7n*dImQ3n*dReQ4n)
4907                - 2.*(dReQ1n*dReQ4n*dReQ3n+dImQ1n*dImQ4n*dReQ3n+dReQ1n*dImQ4n*dImQ3n-dImQ1n*dImQ3n*dReQ4n)
4908                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)
4909                - (dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
4910                + dMult*(dMult-6.))
4911                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
4912   four5n1n5n1n = (((pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
4913                - 2.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
4914                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
4915                + pow(dReQ6n,2.)+pow(dImQ6n,2.)-(dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
4916                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+dMult*(dMult-6.))  
4917                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4918   four5n2n5n2n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
4919                - 2.*(dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ2n*dImQ5n+dImQ7n*dImQ2n*dReQ5n)
4920                - 2.*(dReQ3n*dReQ5n*dReQ2n+dImQ3n*dImQ5n*dReQ2n+dReQ3n*dImQ5n*dImQ2n-dImQ3n*dImQ2n*dReQ5n)
4921                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)
4922                - (dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
4923                + dMult*(dMult-6.))
4924                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
4925   four5n3n5n3n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
4926                - 2.*(dReQ8n*dReQ5n*dReQ3n-dReQ8n*dImQ5n*dImQ3n+dImQ8n*dReQ3n*dImQ5n+dImQ8n*dImQ3n*dReQ5n)
4927                - 2.*(dReQ2n*dReQ5n*dReQ3n+dImQ2n*dImQ5n*dReQ3n+dReQ2n*dImQ5n*dImQ3n-dImQ2n*dImQ3n*dReQ5n)
4928                + pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)
4929                - (dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
4930                + dMult*(dMult-6.))
4931                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
4932   four5n4n5n4n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
4933                - 2.*(dReQ9n*dReQ5n*dReQ4n-dReQ9n*dImQ5n*dImQ4n+dImQ9n*dReQ4n*dImQ5n+dImQ9n*dImQ4n*dReQ5n)
4934                - 2.*(dReQ1n*dReQ5n*dReQ4n+dImQ1n*dImQ5n*dReQ4n+dReQ1n*dImQ5n*dImQ4n-dImQ1n*dImQ4n*dReQ5n)
4935                + pow(dReQ9n,2.)+pow(dImQ9n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)
4936                - (dMult-4.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.))
4937                + dMult*(dMult-6.))
4938                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
4939   four6n1n6n1n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
4940                - 2.*(dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ1n*dImQ6n+dImQ7n*dImQ1n*dReQ6n)
4941                - 2.*(dReQ5n*dReQ6n*dReQ1n+dImQ5n*dImQ6n*dReQ1n+dReQ5n*dImQ6n*dImQ1n-dImQ5n*dImQ1n*dReQ6n)
4942                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)
4943                - (dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
4944                + dMult*(dMult-6.))
4945                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
4946   four6n2n6n2n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4947                - 2.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
4948                - 2.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
4949                + pow(dReQ8n,2.)+pow(dImQ8n,2.)-(dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
4950                + pow(dReQ4n,2.)+pow(dImQ4n,2.)-(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4951                + dMult*(dMult-6.))
4952                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4953   four6n3n6n3n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4954                - 2.*(dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n
4955                + dImQ9n*dImQ6n*dReQ3n)-2.*(pow(dReQ3n,2.)*dReQ6n
4956                + 2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n))
4957                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4958                - ((dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
4959                + (dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-(pow(dReQ9n,2.)+pow(dImQ9n,2.)))
4960                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4961                + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));
4962   four6n4n6n4n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
4963                - 2.*(dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
4964                - 2.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
4965                + pow(dReQ10n,2.)+pow(dImQ10n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)               
4966                - (dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.))
4967                + dMult*(dMult-6.))
4968                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
4969   four6n5n6n5n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
4970                - 2.*(dReQ11n*dReQ6n*dReQ5n-dReQ11n*dImQ6n*dImQ5n+dImQ11n*dReQ5n*dImQ6n+dImQ11n*dImQ5n*dReQ6n)
4971                - 2.*(dReQ1n*dReQ6n*dReQ5n+dImQ1n*dImQ6n*dReQ5n+dReQ1n*dImQ6n*dImQ5n-dImQ1n*dImQ5n*dReQ6n)
4972                + pow(dReQ11n,2.)+pow(dImQ11n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)
4973                - (dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.))
4974                + dMult*(dMult-6.))
4975                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
4976   // Two distinct harmonics (2):
4977   four3n1n1n1n = (dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
4978                + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3)               
4979                - 3.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
4980                - 3.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
4981                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
4982                + 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
4983                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4984   four6n2n2n2n = (dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
4985                + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3)               
4986                - 3.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
4987                - 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
4988                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+3.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
4989                + 6.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-6.*dMult)
4990                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
4991   // Three distinct harmonics (10): 
4992   four3n1n2n2n = ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
4993                + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)
4994                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
4995                - (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
4996                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n))
4997                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
4998                - (2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
4999                - (pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5000                - 4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
5001                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5002                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));
5003   four4n2n1n1n = ((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
5004                + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n)
5005                - 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5006                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5007                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n))
5008                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5009                - ((pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5010                - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5011                - 3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
5012                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5013                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));
5014   four4n2n3n3n = ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
5015                + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n
5016                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5017                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5018                - 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5019                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5020                + (pow(dReQ6n,2.)+pow(dImQ6n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5021                + 2.*(2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5022                + (pow(dReQ1n,2.)+pow(dImQ1n,2.))-3.*dMult))
5023                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
5024   four5n2n2n1n = (-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
5025                + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
5026                - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n
5027                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5028                - 2.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5029                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5030                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5031                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+pow(dReQ4n,2.)+pow(dImQ4n,2.)
5032                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5033                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5034                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5035   four5n3n1n1n = (-pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
5036                + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
5037                - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n
5038                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5039                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5040                - 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5041                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5042                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5043                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+pow(dReQ2n,2.)+pow(dImQ2n,2.)
5044                + 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
5045                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
5046   four5n1n3n3n = (dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
5047                - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
5048                + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n
5049                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5050                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5051                - 2.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5052                - 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5053                + pow(dReQ6n,2.)+pow(dImQ6n,2.)+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5054                + 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5055                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)                                  
5056                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5057   four5n3n4n4n = ((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ5n*dReQ3n-dImQ5n*dImQ3n) 
5058                + 2.*dReQ4n*dImQ4n*(dReQ5n*dImQ3n+dImQ5n*dReQ3n)
5059                - (dReQ8n*dReQ3n*dReQ5n-dReQ8n*dImQ3n*dImQ5n+dImQ8n*dReQ3n*dImQ5n+dImQ8n*dImQ3n*dReQ5n)
5060                - (pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
5061                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5062                - 2.*(dReQ4n*dReQ3n*dReQ1n-dReQ4n*dImQ3n*dImQ1n+dImQ4n*dReQ3n*dImQ1n+dImQ4n*dImQ3n*dReQ1n)
5063                + pow(dReQ8n,2.)+pow(dImQ8n,2.)+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
5064                + 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
5065                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
5066                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5067   four6n4n1n1n = (-pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
5068                + 2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
5069                - pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n
5070                - 2.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5071                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n) 
5072                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n) 
5073                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n) 
5074                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)
5075                + pow(dReQ4n,2.)+pow(dImQ4n,2.))+pow(dReQ2n,2.)+pow(dImQ2n,2.)
5076                + 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5077                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5078   four6n2n4n4n = ((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
5079                + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n)
5080                - (pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
5081                - (dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
5082                - 2.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n))
5083                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5084                - (2.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5085                - (pow(dReQ8n,2.)+pow(dImQ8n,2.))-2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5086                - 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)))
5087                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
5088                - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));
5089   four6n4n5n5n = ((pow(dReQ5n,2.)-pow(dImQ5n,2.))*(dReQ6n*dReQ4n-dImQ6n*dImQ4n) 
5090                + 2.*dReQ5n*dImQ5n*(dReQ6n*dImQ4n+dImQ6n*dReQ4n)
5091                - (dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
5092                - (pow(dReQ5n,2.)*dReQ10n+2.*dReQ5n*dImQ5n*dImQ10n-pow(dImQ5n,2.)*dReQ10n)
5093                - 2.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5094                - 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5095                + pow(dReQ10n,2.)+pow(dImQ10n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5096                + 4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))              
5097                + 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5098                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
5099   // Four distinct harmonics (8): 
5100   four4n1n3n2n = (dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
5101                + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
5102                - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
5103                + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n 
5104                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5105                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5106                - (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5107                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5108                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5109                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5110                + pow(dReQ5n,2.)+pow(dImQ5n,2.)+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5111                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5112                + 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult) 
5113                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5114   four5n1n4n2n = (dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
5115                + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
5116                - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n+dImQ1n*dImQ2n*dReQ4n*dReQ5n
5117                + dReQ1n*dReQ2n*dReQ4n*dReQ5n
5118                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5119                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5120                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5121                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5122                - (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5123                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5124                + pow(dReQ6n,2.)+pow(dImQ6n,2.)
5125                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5126                + pow(dReQ3n,2.)+pow(dImQ3n,2.)+2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5127                + 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5128                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5129   four5n2n4n3n = (dImQ2n*dImQ3n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ2n*dReQ3n 
5130                + dImQ3n*dImQ5n*dReQ2n*dReQ4n-dImQ2n*dImQ5n*dReQ3n*dReQ4n
5131                - dImQ3n*dImQ4n*dReQ2n*dReQ5n+dImQ2n*dImQ4n*dReQ3n*dReQ5n 
5132                + dImQ2n*dImQ3n*dReQ4n*dReQ5n+dReQ2n*dReQ3n*dReQ4n*dReQ5n
5133                - (dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ5n*dImQ2n+dImQ7n*dImQ5n*dReQ2n)
5134                - (dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
5135                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5136                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5137                - (pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5138                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5139                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5140                + 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5141                + 3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+pow(dReQ1n,2.)+pow(dImQ1n,2.)-6.*dMult)
5142                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5143   four6n1n4n3n = (dImQ1n*dImQ3n*dImQ4n*dImQ6n+dImQ4n*dImQ6n*dReQ1n*dReQ3n 
5144                + dImQ3n*dImQ6n*dReQ1n*dReQ4n-dImQ1n*dImQ6n*dReQ3n*dReQ4n
5145                - dImQ3n*dImQ4n*dReQ1n*dReQ6n+dImQ1n*dImQ4n*dReQ3n*dReQ6n+dImQ1n*dImQ3n*dReQ4n*dReQ6n
5146                + dReQ1n*dReQ3n*dReQ4n*dReQ6n
5147                - (dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
5148                - (dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
5149                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5150                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5151                - (dReQ4n*dReQ1n*dReQ3n-dReQ4n*dImQ1n*dImQ3n+dImQ4n*dReQ1n*dImQ3n+dImQ4n*dImQ1n*dReQ3n)
5152                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5153                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5154                + 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5155                + pow(dReQ2n,2.)+pow(dImQ2n,2.)+2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5156                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5157   four6n1n5n2n = (dImQ1n*dImQ2n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ1n*dReQ2n 
5158                + dImQ2n*dImQ6n*dReQ1n*dReQ5n-dImQ1n*dImQ6n*dReQ2n*dReQ5n
5159                - dImQ2n*dImQ5n*dReQ1n*dReQ6n+dImQ1n*dImQ5n*dReQ2n*dReQ6n+dImQ1n*dImQ2n*dReQ5n*dReQ6n
5160                + dReQ1n*dReQ2n*dReQ5n*dReQ6n
5161                - (dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
5162                - (dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ5n*dImQ2n+dImQ7n*dImQ5n*dReQ2n)
5163                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5164                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5165                - (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5166                - (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n) 
5167                + pow(dReQ7n,2.)+pow(dImQ7n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5168                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+pow(dReQ4n,2.)+pow(dImQ4n,2.)
5169                + 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5170                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5171   four6n3n2n1n = (dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
5172                - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
5173                + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
5174                + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n
5175                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5176                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5177                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5178                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5179                - (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5180                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5181                + 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+pow(dReQ5n,2.)+pow(dImQ5n,2.)
5182                + pow(dReQ4n,2.)+pow(dImQ4n,2.)+3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5183                + 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
5184                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5185   four6n2n5n3n = (dImQ2n*dImQ3n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ2n*dReQ3n 
5186                + dImQ3n*dImQ6n*dReQ2n*dReQ5n-dImQ2n*dImQ6n*dReQ3n*dReQ5n
5187                - dImQ3n*dImQ5n*dReQ2n*dReQ6n+dImQ2n*dImQ5n*dReQ3n*dReQ6n+dImQ2n*dImQ3n*dReQ5n*dReQ6n
5188                + dReQ2n*dReQ3n*dReQ5n*dReQ6n
5189                - (dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n+dImQ8n*dImQ6n*dReQ2n)
5190                - (dReQ8n*dReQ5n*dReQ3n-dReQ8n*dImQ5n*dImQ3n+dImQ8n*dReQ5n*dImQ3n+dImQ8n*dImQ5n*dReQ3n)
5191                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5192                - (pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
5193                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5194                - (dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5195                + pow(dReQ8n,2.)+pow(dImQ8n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5196                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5197                + 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+pow(dReQ1n,2.)+pow(dImQ1n,2.)-6.*dMult)
5198                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5199   four6n3n5n4n = (dImQ3n*dImQ4n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ3n*dReQ4n 
5200                + dImQ4n*dImQ6n*dReQ3n*dReQ5n-dImQ3n*dImQ6n*dReQ4n*dReQ5n
5201                - dImQ4n*dImQ5n*dReQ3n*dReQ6n+dImQ3n*dImQ5n*dReQ4n*dReQ6n+dImQ3n*dImQ4n*dReQ5n*dReQ6n
5202                + dReQ3n*dReQ4n*dReQ5n*dReQ6n
5203                - (dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n+dImQ9n*dImQ6n*dReQ3n)
5204                - (dReQ9n*dReQ5n*dReQ4n-dReQ9n*dImQ5n*dImQ4n+dImQ9n*dReQ5n*dImQ4n+dImQ9n*dImQ5n*dReQ4n)
5205                - (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5206                - (dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5207                - (dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5208                - (dReQ4n*dReQ3n*dReQ1n-dReQ4n*dImQ3n*dImQ1n+dImQ4n*dReQ3n*dImQ1n+dImQ4n*dImQ3n*dReQ1n)
5209                + pow(dReQ9n,2.)+pow(dImQ9n,2.)+2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
5210                + 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5211                + 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+pow(dReQ2n,2.)+pow(dImQ2n,2.)
5212                + pow(dReQ1n,2.)+pow(dImQ1n,2.)-6.*dMult)
5213                / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
5214   f4pCorrelations->Fill(0.5,four1n1n1n1n,d4pMultiplicityWeight);
5215   f4pCorrelations->Fill(1.5,four2n2n2n2n,d4pMultiplicityWeight);
5216   f4pCorrelations->Fill(2.5,four3n3n3n3n,d4pMultiplicityWeight);
5217   f4pCorrelations->Fill(3.5,four4n4n4n4n,d4pMultiplicityWeight);
5218   f4pCorrelations->Fill(4.5,four5n5n5n5n,d4pMultiplicityWeight);
5219   f4pCorrelations->Fill(5.5,four6n6n6n6n,d4pMultiplicityWeight);
5220   //f4pCorrelations->Fill(6.5,0.,d4pMultiplicityWeight); // empty
5221   f4pCorrelations->Fill(7.5,four2n1n2n1n,d4pMultiplicityWeight);
5222   f4pCorrelations->Fill(8.5,four3n1n3n1n,d4pMultiplicityWeight);
5223   f4pCorrelations->Fill(9.5,four3n2n3n2n,d4pMultiplicityWeight);
5224   f4pCorrelations->Fill(10.5,four4n1n4n1n,d4pMultiplicityWeight);
5225   f4pCorrelations->Fill(11.5,four4n2n4n2n,d4pMultiplicityWeight);
5226   f4pCorrelations->Fill(12.5,four4n3n4n3n,d4pMultiplicityWeight);
5227   f4pCorrelations->Fill(13.5,four5n1n5n1n,d4pMultiplicityWeight);
5228   f4pCorrelations->Fill(14.5,four5n2n5n2n,d4pMultiplicityWeight);
5229   f4pCorrelations->Fill(15.5,four5n3n5n3n,d4pMultiplicityWeight);
5230   f4pCorrelations->Fill(16.5,four5n4n5n4n,d4pMultiplicityWeight);
5231   f4pCorrelations->Fill(17.5,four6n1n6n1n,d4pMultiplicityWeight);
5232   f4pCorrelations->Fill(18.5,four6n2n6n2n,d4pMultiplicityWeight);
5233   f4pCorrelations->Fill(19.5,four6n3n6n3n,d4pMultiplicityWeight);
5234   f4pCorrelations->Fill(20.5,four6n4n6n4n,d4pMultiplicityWeight);
5235   f4pCorrelations->Fill(21.5,four6n5n6n5n,d4pMultiplicityWeight);
5236   //f4pCorrelations->Fill(22.5,0.,d4pMultiplicityWeight); // empty
5237   f4pCorrelations->Fill(23.5,four3n1n1n1n,d4pMultiplicityWeight);
5238   f4pCorrelations->Fill(24.5,four6n2n2n2n,d4pMultiplicityWeight);
5239   //f4pCorrelations->Fill(25.5,0.,d4pMultiplicityWeight); // empty
5240   f4pCorrelations->Fill(26.5,four3n1n2n2n,d4pMultiplicityWeight);
5241   f4pCorrelations->Fill(27.5,four4n2n1n1n,d4pMultiplicityWeight);
5242   f4pCorrelations->Fill(28.5,four4n2n3n3n,d4pMultiplicityWeight);
5243   f4pCorrelations->Fill(29.5,four5n2n2n1n,d4pMultiplicityWeight);
5244   f4pCorrelations->Fill(30.5,four5n3n1n1n,d4pMultiplicityWeight);
5245   f4pCorrelations->Fill(31.5,four5n1n3n3n,d4pMultiplicityWeight);
5246   f4pCorrelations->Fill(32.5,four5n3n4n4n,d4pMultiplicityWeight);
5247   f4pCorrelations->Fill(33.5,four6n4n1n1n,d4pMultiplicityWeight);
5248   f4pCorrelations->Fill(34.5,four6n2n4n4n,d4pMultiplicityWeight);
5249   f4pCorrelations->Fill(35.5,four6n4n5n5n,d4pMultiplicityWeight);
5250   //f4pCorrelations->Fill(36.5,0.,d4pMultiplicityWeight); // empty
5251   f4pCorrelations->Fill(37.5,four4n1n3n2n,d4pMultiplicityWeight); 
5252   f4pCorrelations->Fill(38.5,four5n1n4n2n,d4pMultiplicityWeight); 
5253   f4pCorrelations->Fill(39.5,four5n2n4n3n,d4pMultiplicityWeight); 
5254   f4pCorrelations->Fill(40.5,four6n1n4n3n,d4pMultiplicityWeight); 
5255   f4pCorrelations->Fill(41.5,four6n1n5n2n,d4pMultiplicityWeight); 
5256   f4pCorrelations->Fill(42.5,four6n3n2n1n,d4pMultiplicityWeight); 
5257   f4pCorrelations->Fill(43.5,four6n2n5n3n,d4pMultiplicityWeight); 
5258   f4pCorrelations->Fill(44.5,four6n3n5n4n,d4pMultiplicityWeight); 
5259   allMixedCorrelators[15]=four1n1n1n1n;
5260   allMixedCorrelators[16]=four2n2n2n2n;
5261   allMixedCorrelators[17]=four3n3n3n3n;
5262   allMixedCorrelators[18]=four4n4n4n4n;
5263   allMixedCorrelators[19]=four5n5n5n5n;
5264   allMixedCorrelators[20]=four6n6n6n6n;
5265   allMixedCorrelators[21]=four2n1n2n1n;
5266   allMixedCorrelators[22]=four3n1n3n1n;
5267   allMixedCorrelators[23]=four3n2n3n2n;
5268   allMixedCorrelators[24]=four4n1n4n1n;
5269   allMixedCorrelators[25]=four4n2n4n2n;
5270   allMixedCorrelators[26]=four4n3n4n3n;
5271   allMixedCorrelators[27]=four5n1n5n1n;
5272   allMixedCorrelators[28]=four5n2n5n2n;
5273   allMixedCorrelators[29]=four5n3n5n3n;
5274   allMixedCorrelators[30]=four5n4n5n4n;
5275   allMixedCorrelators[31]=four6n1n6n1n;
5276   allMixedCorrelators[32]=four6n2n6n2n;
5277   allMixedCorrelators[33]=four6n3n6n3n;
5278   allMixedCorrelators[34]=four6n4n6n4n;
5279   allMixedCorrelators[35]=four6n5n6n5n;
5280   allMixedCorrelators[36]=four3n1n1n1n;
5281   allMixedCorrelators[37]=four6n2n2n2n;
5282   allMixedCorrelators[38]=four3n1n2n2n;
5283   allMixedCorrelators[39]=four4n2n1n1n;
5284   allMixedCorrelators[40]=four4n2n3n3n;
5285   allMixedCorrelators[41]=four5n2n2n1n;
5286   allMixedCorrelators[42]=four5n3n1n1n;
5287   allMixedCorrelators[43]=four5n1n3n3n;
5288   allMixedCorrelators[44]=four5n3n4n4n;
5289   allMixedCorrelators[45]=four6n4n1n1n;
5290   allMixedCorrelators[46]=four6n2n4n4n;
5291   allMixedCorrelators[47]=four6n4n5n5n;
5292   allMixedCorrelators[48]=four4n1n3n2n;
5293   allMixedCorrelators[49]=four5n1n4n2n;
5294   allMixedCorrelators[50]=four5n2n4n3n;
5295   allMixedCorrelators[51]=four6n1n4n3n;
5296   allMixedCorrelators[52]=four6n1n5n2n;
5297   allMixedCorrelators[53]=four6n3n2n1n;
5298   allMixedCorrelators[54]=four6n2n5n3n;
5299   allMixedCorrelators[55]=four6n3n5n4n;
5300  } // end of if(dMult>3.)
5301
5302  // f) Calculate 5-p correlations:
5303  //  f1) "Standard candles" (30):
5304  Double_t five3n2n3n1n1n = 0.; // <5>_{3n,2n|3n,1n,1n} = <cos(n(3*phi1+2*phi2-3*phi3-1*phi4-1*phi5))>
5305  Double_t five4n1n2n2n1n = 0.; // <5>_{4n,1n|2n,2n,1n} = <cos(n(4*phi1+1*phi2-2*phi3-2*phi4-1*phi5))>
5306  Double_t five4n2n3n2n1n = 0.; // <5>_{4n,2n|3n,2n,1n} = <cos(n(4*phi1+2*phi2-3*phi3-2*phi4-1*phi5))>
5307  Double_t five4n3n3n2n2n = 0.; // <5>_{4n,3n|3n,2n,2n} = <cos(n(4*phi1+3*phi2-3*phi3-2*phi4-2*phi5))>
5308  Double_t five4n2n4n1n1n = 0.; // <5>_{4n,2n|4n,1n,1n} = <cos(n(4*phi1+2*phi2-4*phi3-1*phi4-1*phi5))>
5309  Double_t five4n3n4n2n1n = 0.; // <5>_{4n,3n|4n,2n,1n} = <cos(n(4*phi1+3*phi2-4*phi3-2*phi4-1*phi5))>
5310  Double_t five5n1n3n2n1n = 0.; // <5>_{5n,1n|3n,2n,1n} = <cos(n(5*phi1+1*phi2-3*phi3-2*phi4-1*phi5))>
5311  Double_t five5n2n5n1n1n = 0.; // <5>_{5n,2n|5n,1n,1n} = <cos(n(5*phi1+2*phi2-5*phi3-1*phi4-1*phi5))>
5312  Double_t five5n2n4n2n1n = 0.; // <5>_{5n,2n|4n,2n,1n} = <cos(n(5*phi1+2*phi2-4*phi3-2*phi4-1*phi5))>
5313  Double_t five5n3n4n3n1n = 0.; // <5>_{5n,3n|4n,3n,1n} = <cos(n(5*phi1+3*phi2-4*phi3-3*phi4-1*phi5))>
5314  Double_t five5n4n4n3n2n = 0.; // <5>_{5n,4n|4n,3n,2n} = <cos(n(5*phi1+4*phi2-4*phi3-3*phi4-2*phi5))>
5315  Double_t five5n3n5n2n1n = 0.; // <5>_{5n,3n|5n,2n,1n} = <cos(n(5*phi1+3*phi2-5*phi3-2*phi4-1*phi5))>
5316  Double_t five5n4n5n2n2n = 0.; // <5>_{5n,4n|5n,2n,2n} = <cos(n(5*phi1+4*phi2-5*phi3-2*phi4-2*phi5))>
5317  Double_t five5n4n5n3n1n = 0.; // <5>_{5n,4n|5n,3n,1n} = <cos(n(5*phi1+4*phi2-5*phi3-3*phi4-1*phi5))>
5318  Double_t five6n1n3n3n1n = 0.; // <5>_{6n,1n|3n,3n,1n} = <cos(n(6*phi1+1*phi2-3*phi3-3*phi4-1*phi5))>
5319  Double_t five6n2n3n3n2n = 0.; // <5>_{6n,2n|3n,3n,2n} = <cos(n(6*phi1+2*phi2-3*phi3-3*phi4-2*phi5))>
5320  Double_t five6n1n4n2n1n = 0.; // <5>_{6n,1n|4n,2n,1n} = <cos(n(6*phi1+1*phi2-4*phi3-2*phi4-1*phi5))>
5321  Double_t five6n3n4n3n2n = 0.; // <5>_{6n,3n|4n,3n,2n} = <cos(n(6*phi1+3*phi2-4*phi3-3*phi4-2*phi5))>
5322  Double_t five6n4n4n3n3n = 0.; // <5>_{6n,4n|4n,3n,3n} = <cos(n(6*phi1+4*phi2-4*phi3-3*phi4-3*phi5))>
5323  Double_t five6n2n5n2n1n = 0.; // <5>_{6n,2n|5n,2n,1n} = <cos(n(6*phi1+2*phi2-5*phi3-2*phi4-1*phi5))>
5324  Double_t five6n3n5n3n1n = 0.; // <5>_{6n,3n|5n,3n,1n} = <cos(n(6*phi1+3*phi2-5*phi3-3*phi4-1*phi5))>
5325  Double_t five6n4n5n4n1n = 0.; // <5>_{6n,4n|5n,4n,1n} = <cos(n(6*phi1+4*phi2-5*phi3-4*phi4-1*phi5))>
5326  Double_t five6n5n5n3n3n = 0.; // <5>_{6n,5n|5n,3n,3n} = <cos(n(6*phi1+5*phi2-5*phi3-3*phi4-3*phi5))>
5327  Double_t five6n2n6n1n1n = 0.; // <5>_{6n,2n|6n,1n,1n} = <cos(n(6*phi1+2*phi2-6*phi3-1*phi4-1*phi5))>
5328  Double_t five6n3n6n2n1n = 0.; // <5>_{6n,3n|6n,2n,1n} = <cos(n(6*phi1+3*phi2-6*phi3-2*phi4-1*phi5))>
5329  Double_t five6n4n6n2n2n = 0.; // <5>_{6n,4n|6n,2n,2n} = <cos(n(6*phi1+4*phi2-6*phi3-2*phi4-2*phi5))>
5330  Double_t five6n4n6n3n1n = 0.; // <5>_{6n,4n|6n,3n,1n} = <cos(n(6*phi1+4*phi2-6*phi3-3*phi4-1*phi5))>
5331  Double_t five6n5n5n4n2n = 0.; // <5>_{6n,5n|5n,4n,2n} = <cos(n(6*phi1+5*phi2-5*phi3-4*phi4-2*phi5))>
5332  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
5333  Double_t five6n5n6n4n1n = 0.; // <5>_{6n,5n|6n,4n,1n} = <cos(n(6*phi1+5*phi2-6*phi3-4*phi4-1*phi5))>
5334  //  f2) Two distinct harmonics (9):
5335  Double_t five2n1n1n1n1n = 0.; // <5>_{2n,1n|1n,1n,1n} = <cos(n(2*phi1+1*phi2-1*phi3-1*phi4-1*phi5))>
5336  Double_t five2n2n2n1n1n = 0.; // <5>_{2n,2n|2n,1n,1n} = <cos(n(2*phi1+2*phi2-2*phi3-1*phi4-1*phi5))>
5337  Double_t five3n3n2n2n2n = 0.; // <5>_{3n,3n|2n,2n,2n} = <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-2*phi5))>
5338  Double_t five4n1n1n1n1n = 0.; // <5>_{4n|1n,1n,1n,1n} = <cos(n(4*phi1-1*phi2-1*phi3-1*phi4-1*phi5))>
5339  Double_t five4n2n2n2n2n = 0.; // <5>_{4n,2n|2n,2n,2n} = <cos(n(4*phi1+2*phi2-2*phi3-2*phi4-2*phi5))>
5340  Double_t five4n4n4n2n2n = 0.; // <5>_{4n,4n|4n,2n,2n} = <cos(n(4*phi1+4*phi2-4*phi3-2*phi4-2*phi5))>
5341  Double_t five6n3n3n3n3n = 0.; // <5>_{6n,3n|3n,3n,3n} = <cos(n(6*phi1+3*phi2-3*phi3-3*phi4-3*phi5))>
5342  Double_t five6n6n4n4n4n = 0.; // <5>_{6n,6n|4n,4n,4n} = <cos(n(6*phi1+6*phi2-4*phi3-4*phi4-4*phi5))>
5343  Double_t five6n6n6n3n3n = 0.; // <5>_{6n,6n|6n,3n,3n} = <cos(n(6*phi1+6*phi2-6*phi3-3*phi4-3*phi5))>
5344  //  f3) Three distinct harmonics (30):
5345  Double_t five3n1n2n1n1n = 0.; // <5>_{3n,1n|2n,1n,1n} = <cos(n(3*phi1+1*phi2-2*phi3-1*phi4-1*phi5))>
5346  Double_t five3n2n2n2n1n = 0.; // <5>_{3n,2n|2n,2n,1n} = <cos(n(3*phi1+2*phi2-2*phi3-2*phi4-1*phi5))>
5347  Double_t five3n3n3n2n1n = 0.; // <5>_{3n,3n|3n,2n,1n} = <cos(n(3*phi1+3*phi2-3*phi3-2*phi4-1*phi5))>
5348  Double_t five4n1n3n1n1n = 0.; // <5>_{4n,1n|3n,1n,1n} = <cos(n(4*phi1+1*phi2-3*phi3-1*phi4-1*phi5))>
5349  Double_t five4n1n1n3n3n = 0.; // <5>_{4n,1n,1n|3n,3n} = <cos(n(4*phi1+1*phi2+1*phi3-3*phi4-3*phi5))>
5350  Double_t five4n3n3n3n1n = 0.; // <5>_{4n,3n|3n,3n,1n} = <cos(n(4*phi1+3*phi2-3*phi3-3*phi4-1*phi5))>
5351  Double_t five4n4n3n3n2n = 0.; // <5>_{4n,4n|3n,3n,2n} = <cos(n(4*phi1+4*phi2-3*phi3-3*phi4-2*phi5))>
5352  Double_t five4n4n4n3n1n = 0.; // <5>_{4n,4n|4n,3n,1n} = <cos(n(4*phi1+4*phi2-4*phi3-3*phi4-1*phi5))>
5353  Double_t five5n2n1n1n1n = 0.; // <5>_{5n|2n,1n,1n,1n} = <cos(n(5*phi1-2*phi2-1*phi3-1*phi4-1*phi5))>
5354  Double_t five5n1n2n2n2n = 0.; // <5>_{5n,1n|2n,2n,2n} = <cos(n(5*phi1+1*phi2-2*phi3-2*phi4-2*phi5))>
5355  Double_t five5n2n3n2n2n = 0.; // <5>_{5n,2n|3n,2n,2n} = <cos(n(5*phi1+2*phi2-3*phi3-2*phi4-2*phi5))>
5356  Double_t five5n3n3n3n2n = 0.; // <5>_{5n,3n|3n,3n,2n} = <cos(n(5*phi1+3*phi2-3*phi3-3*phi4-2*phi5))>
5357  Double_t five5n1n4n1n1n = 0.; // <5>_{5n,1n|4n,1n,1n} = <cos(n(5*phi1+1*phi2-4*phi3-1*phi4-1*phi5))>
5358  Double_t five5n4n3n3n3n = 0.; // <5>_{5n,4n|3n,3n,3n} = <cos(n(5*phi1+4*phi2-3*phi3-3*phi4-3*phi5))>
5359  Double_t five5n4n4n4n1n = 0.; // <5>_{5n,4n|4n,4n,1n} = <cos(n(5*phi1+4*phi2-4*phi3-4*phi4-1*phi5))>
5360  Double_t five5n5n4n3n3n = 0.; // <5>_{5n,5n|4n,3n,3n} = <cos(n(5*phi1+5*phi2-4*phi3-3*phi4-3*phi5))>
5361  Double_t five5n5n4n4n2n = 0.; // <5>_{5n,5n|4n,4n,2n} = <cos(n(5*phi1+5*phi2-4*phi3-4*phi4-2*phi5))>
5362  Double_t five5n5n5n3n2n = 0.; // <5>_{5n,5n|5n,3n,2n} = <cos(n(5*phi1+5*phi2-5*phi3-3*phi4-2*phi5))>
5363  Double_t five5n5n5n4n1n = 0.; // <5>_{5n,5n|5n,4n,1n} = <cos(n(5*phi1+5*phi2-5*phi3-4*phi4-1*phi5))>
5364  Double_t five6n2n2n1n1n = 0.; // <5>_{6n|2n,2n,1n,1n} = <cos(n(6*phi1-2*phi2-2*phi3-1*phi4-1*phi5))>
5365  Double_t five6n3n1n1n1n = 0.; // <5>_{6n|3n,1n,1n,1n} = <cos(n(6*phi1-3*phi2-1*phi3-1*phi4-1*phi5))>
5366  Double_t five6n1n1n4n4n = 0.; // <5>_{6n,1n,1n|4n,4n} = <cos(n(6*phi1+1*phi2+1*phi3-4*phi4-4*phi5))>
5367  Double_t five6n1n5n1n1n = 0.; // <5>_{6n,1n|5n,1n,1n} = <cos(n(6*phi1+1*phi2-5*phi3-1*phi4-1*phi5))>
5368  Double_t five6n2n4n2n2n = 0.; // <5>_{6n,2n|4n,2n,2n} = <cos(n(6*phi1+2*phi2-4*phi3-2*phi4-2*phi5))>
5369  Double_t five6n4n4n4n2n = 0.; // <5>_{6n,4n|4n,4n,2n} = <cos(n(6*phi1+4*phi2-4*phi3-4*phi4-2*phi5))>
5370  Double_t five6n2n2n5n5n = 0.; // <5>_{6n,2n,2n|5n,5n} = <cos(n(6*phi1+2*phi2+2*phi3-5*phi4-5*phi5))>
5371  Double_t five6n5n5n5n1n = 0.; // <5>_{6n,5n|5n,5n,1n} = <cos(n(6*phi1+5*phi2-5*phi3-5*phi4-1*phi5))>
5372  Double_t five6n6n5n5n2n = 0.; // <5>_{6n,6n|5n,5n,2n} = <cos(n(6*phi1+6*phi2-5*phi3-5*phi4-2*phi5))>
5373  Double_t five6n6n6n4n2n = 0.; // <5>_{6n,6n|6n,4n,2n} = <cos(n(6*phi1+6*phi2-6*phi3-4*phi4-2*phi5))>
5374  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
5375  // Four distinct harmonics (11):
5376  Double_t five5n2n3n3n1n = 0.; // <5>_{5n,2n|3n,3n,1n} = <cos(n(5*phi1+2*phi2-3*phi3-3*phi4-1*phi5))>
5377  Double_t five5n1n1n4n3n = 0.; // <5>_{5n,1n,1n|4n,3n} = <cos(n(5*phi1+1*phi2+1*phi3-4*phi4-3*phi5))>
5378  Double_t five5n3n4n2n2n = 0.; // <5>_{5n,3n|4n,2n,2n} = <cos(n(5*phi1+3*phi2-4*phi3-2*phi4-2*phi5))>
5379  Double_t five5n2n1n4n4n = 0.; // <5>_{5n,2n,1n|4n,4n} = <cos(n(5*phi1+2*phi2+1*phi3-4*phi4-4*phi5))>
5380  Double_t five6n1n3n2n2n = 0.; // <5>_{6n,1n|3n,2n,2n} = <cos(n(6*phi1+1*phi2-3*phi3-2*phi4-2*phi5))>
5381  Double_t five6n3n4n4n1n = 0.; // <5>_{6n,3n|4n,4n,1n} = <cos(n(6*phi1+3*phi2-4*phi3-4*phi4-1*phi5))>
5382  Double_t five6n1n1n5n3n = 0.; // <5>_{6n,1n,1n|5n,3n} = <cos(n(6*phi1+1*phi2+1*phi3-5*phi4-3*phi5))>
5383  Double_t five6n3n5n2n2n = 0.; // <5>_{6n,3n|5n,2n,2n} = <cos(n(6*phi1+3*phi2-5*phi3-2*phi4-2*phi5))>
5384  Double_t five6n5n4n4n3n = 0.; // <5>_{6n,5n|4n,4n,3n} = <cos(n(6*phi1+5*phi2-4*phi3-4*phi4-3*phi5))>
5385  Double_t five6n3n1n5n5n = 0.; // <5>_{6n,3n,1n|5n,5n} = <cos(n(6*phi1+3*phi2+1*phi3-5*phi4-5*phi5))>
5386  Double_t five6n6n5n4n3n = 0.; // <5>_{6n,6n|5n,4n,3n} = <cos(n(6*phi1+6*phi2-5*phi3-4*phi4-3*phi5))>
5387  // Five distinct harmonics (3):
5388  Double_t five6n2n4n3n1n = 0.; // <5>_{6n,2n|4n,3n,1n} = <cos(n(6*phi1+2*phi2-4*phi3-3*phi4-1*phi5))>
5389  Double_t five6n2n1n5n4n = 0.; // <5>_{6n,2n,1n|5n,4n} = <cos(n(6*phi1+2*phi2+1*phi3-5*phi4-4*phi5))>
5390  Double_t five6n4n5n3n2n = 0.; // <5>_{6n,4n|5n,3n,2n} = <cos(n(6*phi1+4*phi2-5*phi3-3*phi4-2*phi5))>
5391  if(dMult>4.)
5392  {
5393   five3n2n3n1n1n = (-(pow(dImQ3n,2.)+pow(dReQ3n,2.))
5394                  * (-2.*dImQ1n*dImQ2n*dReQ1n+pow(dImQ1n,2.)*dReQ2n-pow(dReQ1n,2.)*dReQ2n)
5395                  - (-pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
5396                  + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
5397                  - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n)
5398                  - 2.*(dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
5399                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
5400                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
5401                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
5402                  - (dReQ3n*pow(dReQ1n,3.)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2.)
5403                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2.)-dImQ3n*pow(dImQ1n,3.))
5404                  - 2.*((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
5405                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5406                  + 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5407                  + 3.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5408                  + 6.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5409                  + 2.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5410                  + 9.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5411                  - (dMult-8.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5412                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
5413                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
5414                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5415                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(dMult-12.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5416                  + 2.*(dMult-9.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.))
5417                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
5418   five4n1n2n2n1n = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))
5419                  * (pow(dReQ2n,2.)*dReQ4n-pow(dImQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n)
5420                  - 2.*(dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
5421                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
5422                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
5423                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)    
5424                  - 2.*((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) 
5425                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
5426                  - (-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
5427                  + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
5428                  - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n)
5429                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
5430                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5431                  + (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5432                  + 2.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5433                  + 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5434                  + 2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5435                  + 3.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5436                  + 4.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5437                  + 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
5438                  + 6.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5439                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5440                  - (dMult-6.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5441                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5442                  - 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5443                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5444                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5445                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5446                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+(dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
5447                  + 2.*(dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.))
5448                   / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
5449   five4n2n3n2n1n = ((pow(dImQ2n,2.)+pow(dReQ2n,2.))*(dImQ3n*dImQ4n*dReQ1n+dImQ1n*dImQ4n*dReQ3n 
5450                  - dImQ1n*dImQ3n*dReQ4n+dReQ1n*dReQ3n*dReQ4n)
5451                  - (dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
5452                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
5453                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
5454                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
5455                  - (dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
5456                  + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
5457                  - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n 
5458                  + dImQ1n*dImQ2n*dReQ4n*dReQ5n+dReQ1n*dReQ2n*dReQ4n*dReQ5n)
5459                  - ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
5460                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n)
5461                  - (dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
5462                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
5463                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
5464                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
5465                  - ((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) 
5466                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
5467                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
5468                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5469                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5470                  + 3.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
5471                  + (dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
5472                  + pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n
5473                  + dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n
5474                  + 3.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
5475                  - (dMult-7.)*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
5476                  + 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
5477                  + 7.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
5478                  + 4.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
5479                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
5480                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5481                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
5482                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
5483                  + 2.*(dMult-7.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+(dMult-12.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
5484                  - 2.*dMult*(dMult-12.))
5485                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
5486
5487   // *********************************************************************
5488   Double_t reQ7nQ3nstarQ2nstarQ2nstar = (dReQ7n*dReQ3n+dImQ7n*dImQ3n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
5489                                       + 2.*dReQ2n*dImQ2n*(dImQ7n*dReQ3n-dReQ7n*dImQ3n); 
5490   Double_t reQ5nQ2nQ4nstarQ3nstar = dImQ2n*dImQ3n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ2n*dReQ3n 
5491                                   + dImQ3n*dImQ5n*dReQ2n*dReQ4n-dImQ2n*dImQ5n*dReQ3n*dReQ4n
5492                                   - dImQ3n*dImQ4n*dReQ2n*dReQ5n+dImQ2n*dImQ4n*dReQ3n*dReQ5n 
5493                                   + dImQ2n*dImQ3n*dReQ4n*dReQ5n+dReQ2n*dReQ3n*dReQ4n*dReQ5n;
5494   Double_t reQ7nQ4nstarQ3nstar = dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n
5495                                + dImQ7n*dImQ4n*dReQ3n; 
5496
5497
5498   Double_t reQ7nQ5nstarQ2nstar = dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ5n*dImQ2n
5499                                + dImQ7n*dImQ5n*dReQ2n;
5500
5501   // <5>_{6n,4n|4n,3n,3n}:
5502   Double_t reQ10nQ4nstarQ3nstarQ3nstar = (dReQ10n*dReQ4n+dImQ10n*dImQ4n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
5503                                       + 2.*dReQ3n*dImQ3n*(dImQ10n*dReQ4n-dReQ10n*dImQ4n); 
5504   Double_t reQ7nQ3nQ6nstarQ4nstar = dImQ3n*dImQ4n*dImQ6n*dImQ7n+dImQ6n*dImQ7n*dReQ3n*dReQ4n 
5505                                   + dImQ4n*dImQ7n*dReQ3n*dReQ6n-dImQ3n*dImQ7n*dReQ4n*dReQ6n
5506                                   - dImQ4n*dImQ6n*dReQ3n*dReQ7n+dImQ3n*dImQ6n*dReQ4n*dReQ7n 
5507                                   + dImQ3n*dImQ4n*dReQ6n*dReQ7n+dReQ3n*dReQ4n*dReQ6n*dReQ7n;
5508   Double_t reQ10nQ7nstarQ3nstar = dReQ10n*dReQ7n*dReQ3n-dReQ10n*dImQ7n*dImQ3n+dImQ10n*dReQ7n*dImQ3n
5509                                 + dImQ10n*dImQ7n*dReQ3n; 
5510   Double_t reQ10nQ6nstarQ4nstar = dReQ10n*dReQ6n*dReQ4n-dReQ10n*dImQ6n*dImQ4n+dImQ10n*dReQ6n*dImQ4n
5511                                 + dImQ10n*dImQ6n*dReQ4n; 
5512   Double_t reQ6nQ1nQ4nstarQ3nstar = dImQ1n*dImQ3n*dImQ4n*dImQ6n+dImQ4n*dImQ6n*dReQ1n*dReQ3n 
5513                                   + dImQ3n*dImQ6n*dReQ1n*dReQ4n-dImQ1n*dImQ6n*dReQ3n*dReQ4n
5514                                   - dImQ3n*dImQ4n*dReQ1n*dReQ6n+dImQ1n*dImQ4n*dReQ3n*dReQ6n 
5515                                   + dImQ1n*dImQ3n*dReQ4n*dReQ6n+dReQ1n*dReQ3n*dReQ4n*dReQ6n;
5516   Double_t reQ7nQ6nstarQ1nstar = dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n
5517                                + dImQ7n*dImQ6n*dReQ1n;
5518  // <5>_{6n,5n|5n,3n,3n}:
5519  /*Double_t reQ11nQ5nstarQ3nstarQ3nstar = (dReQ11n*dReQ5n+dImQ11n*dImQ5n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
5520                                       + 2.*dReQ3n*dImQ3n*(dImQ11n*dReQ5n-dReQ11n*dImQ5n); */
5521  Double_t reQ6nQ2nQ5nstarQ3nstar = dImQ2n*dImQ3n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ2n*dReQ3n 
5522                                  + dImQ3n*dImQ6n*dReQ2n*dReQ5n-dImQ2n*dImQ6n*dReQ3n*dReQ5n
5523                                  - dImQ3n*dImQ5n*dReQ2n*dReQ6n+dImQ2n*dImQ5n*dReQ3n*dReQ6n 
5524                                  + dImQ2n*dImQ3n*dReQ5n*dReQ6n+dReQ2n*dReQ3n*dReQ5n*dReQ6n;
5525  Double_t reQ8nQ3nQ6nstarQ5nstar = dImQ3n*dImQ5n*dImQ6n*dImQ8n+dImQ6n*dImQ8n*dReQ3n*dReQ5n 
5526                                  + dImQ5n*dImQ8n*dReQ3n*dReQ6n-dImQ3n*dImQ8n*dReQ5n*dReQ6n
5527                                  - dImQ5n*dImQ6n*dReQ3n*dReQ8n+dImQ3n*dImQ6n*dReQ5n*dReQ8n 
5528                                  + dImQ3n*dImQ5n*dReQ6n*dReQ8n+dReQ3n*dReQ5n*dReQ6n*dReQ8n;
5529  Double_t reQ11nQ6nstarQ5nstar = dReQ11n*dReQ6n*dReQ5n-dReQ11n*dImQ6n*dImQ5n+dImQ11n*dReQ6n*dImQ5n
5530                                + dImQ11n*dImQ6n*dReQ5n;
5531  Double_t reQ8nQ6nstarQ2nstar = dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n
5532                               + dImQ8n*dImQ6n*dReQ2n; 
5533  Double_t reQ11nQ8nstarQ3nstar = dReQ11n*dReQ8n*dReQ3n-dReQ11n*dImQ8n*dImQ3n+dImQ11n*dReQ8n*dImQ3n
5534                                + dImQ11n*dImQ8n*dReQ3n;
5535  Double_t reQ8nQ5nstarQ3nstar = dReQ8n*dReQ5n*dReQ3n-dReQ8n*dImQ5n*dImQ3n+dImQ8n*dReQ5n*dImQ3n
5536                               + dImQ8n*dImQ5n*dReQ3n; 
5537  // <5>_{5n,2n|5n,1n,1n}
5538  Double_t reQ7nQ5nstarQ1nstarQ1nstar = (dReQ7n*dReQ5n+dImQ7n*dImQ5n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
5539                                       + 2.*dReQ1n*dImQ1n*(dImQ7n*dReQ5n-dReQ7n*dImQ5n); 
5540  Double_t reQ6nQ1nQ5nstarQ2nstar = dImQ1n*dImQ2n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ1n*dReQ2n 
5541                                  + dImQ2n*dImQ6n*dReQ1n*dReQ5n-dImQ1n*dImQ6n*dReQ2n*dReQ5n
5542                                  - dImQ2n*dImQ5n*dReQ1n*dReQ6n+dImQ1n*dImQ5n*dReQ2n*dReQ6n 
5543                                  + dImQ1n*dImQ2n*dReQ5n*dReQ6n+dReQ1n*dReQ2n*dReQ5n*dReQ6n;
5544  // <5>_{5n,4n|5n,2n,2n}
5545  Double_t reQ9nQ5nstarQ2nstarQ2nstar = (dReQ9n*dReQ5n+dImQ9n*dImQ5n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
5546                                      + 2.*dReQ2n*dImQ2n*(dImQ9n*dReQ5n-dReQ9n*dImQ5n);
5547  Double_t reQ7nQ2nQ5nstarQ4nstar = dImQ2n*dImQ4n*dImQ5n*dImQ7n+dImQ5n*dImQ7n*dReQ2n*dReQ4n 
5548                                  + dImQ4n*dImQ7n*dReQ2n*dReQ5n-dImQ2n*dImQ7n*dReQ4n*dReQ5n
5549                                  - dImQ4n*dImQ5n*dReQ2n*dReQ7n+dImQ2n*dImQ5n*dReQ4n*dReQ7n 
5550                                  + dImQ2n*dImQ4n*dReQ5n*dReQ7n+dReQ2n*dReQ4n*dReQ5n*dReQ7n;
5551  Double_t reQ9nQ5nstarQ4nstar = dReQ9n*dReQ5n*dReQ4n-dReQ9n*dImQ5n*dImQ4n+dImQ9n*dReQ5n*dImQ4n
5552                               + dImQ9n*dImQ5n*dReQ4n; 
5553  Double_t reQ9nQ7nstarQ2nstar = dReQ9n*dReQ7n*dReQ2n-dReQ9n*dImQ7n*dImQ2n+dImQ9n*dReQ7n*dImQ2n
5554                               + dImQ9n*dImQ7n*dReQ2n; 
5555  // <5>_{6n,2n|6n,1n,1n}
5556  Double_t reQ8nQ6nstarQ1nstarQ1nstar = (dReQ8n*dReQ6n+dImQ8n*dImQ6n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
5557                                      + 2.*dReQ1n*dImQ1n*(dImQ8n*dReQ6n-dReQ8n*dImQ6n);
5558  Double_t reQ7nQ1nQ6nstarQ2nstar = dImQ1n*dImQ2n*dImQ6n*dImQ7n+dImQ6n*dImQ7n*dReQ1n*dReQ2n 
5559                                  + dImQ2n*dImQ7n*dReQ1n*dReQ6n-dImQ1n*dImQ7n*dReQ2n*dReQ6n
5560                                  - dImQ2n*dImQ6n*dReQ1n*dReQ7n+dImQ1n*dImQ6n*dReQ2n*dReQ7n 
5561                                  + dImQ1n*dImQ2n*dReQ6n*dReQ7n+dReQ1n*dReQ2n*dReQ6n*dReQ7n;
5562  Double_t reQ8nQ7nstarQ1nstar = dReQ8n*dReQ7n*dReQ1n-dReQ8n*dImQ7n*dImQ1n+dImQ8n*dReQ7n*dImQ1n
5563                               + dImQ8n*dImQ7n*dReQ1n;
5564  // <5>_{5n,2n|4n,2n,1n}
5565  Double_t reQ5nQ2nQ4nstarQ2nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
5566                                         * (dReQ1n*dReQ4n*dReQ5n-dReQ5n*dImQ1n*dImQ4n 
5567                                         + dReQ4n*dImQ1n*dImQ5n+dReQ1n*dImQ4n*dImQ5n);
5568  Double_t reQ7nQ4nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ4n*dReQ7n-dReQ4n*dReQ7n*dImQ1n*dImQ2n 
5569                                      - dReQ2n*dReQ7n*dImQ1n*dImQ4n-dReQ1n*dReQ7n*dImQ2n*dImQ4n 
5570                                      + dReQ2n*dReQ4n*dImQ1n*dImQ7n+dReQ1n*dReQ4n*dImQ2n*dImQ7n 
5571                                      + dReQ1n*dReQ2n*dImQ4n*dImQ7n-dImQ1n*dImQ2n*dImQ4n*dImQ7n;
5572  // <5>_{4n,3n|4n,2n,1n}:
5573  Double_t reQ4nQ3nQ4nstarQ2nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n 
5574                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n) 
5575                                         * (pow(dReQ4n,2.)+pow(dImQ4n,2.));        
5576  /*
5577  Double_t reQ4nQ1nQ3nstarQ2nstar = dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
5578                                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
5579                                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
5580                                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n;
5581  */
5582  // <5>_{5n,3n|4n,3n,1n}:
5583  Double_t reQ5nQ3nQ4nstarQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))
5584                                         * (dReQ1n*dReQ4n*dReQ5n-dReQ5n*dImQ1n*dImQ4n 
5585                                         + dReQ4n*dImQ1n*dImQ5n+dReQ1n*dImQ4n*dImQ5n);
5586  Double_t reQ5nQ3nQ4nstarQ4nstar = dReQ3n*pow(dReQ4n,2.)*dReQ5n+2.*dReQ4n*dReQ5n*dImQ3n*dImQ4n 
5587                                  - dReQ3n*dReQ5n*pow(dImQ4n,2.)-pow(dReQ4n,2.)*dImQ3n*dImQ5n
5588                                  + 2.*dReQ3n*dReQ4n*dImQ4n*dImQ5n+dImQ3n*pow(dImQ4n,2.)*dImQ5n;
5589  Double_t reQ7nQ1nQ5nstarQ3nstar = dImQ1n*dImQ3n*dImQ5n*dImQ7n+dImQ5n*dImQ7n*dReQ1n*dReQ3n 
5590                                  + dImQ3n*dImQ7n*dReQ1n*dReQ5n-dImQ1n*dImQ7n*dReQ3n*dReQ5n
5591                                  - dImQ3n*dImQ5n*dReQ1n*dReQ7n+dImQ1n*dImQ5n*dReQ3n*dReQ7n 
5592                                  + dImQ1n*dImQ3n*dReQ5n*dReQ7n+dReQ1n*dReQ3n*dReQ5n*dReQ7n;             
5593  Double_t reQ8nQ4nstarQ3nstarQ1nstar = dReQ1n*dReQ3n*dReQ4n*dReQ8n-dReQ4n*dReQ8n*dImQ1n*dImQ3n 
5594                                      - dReQ3n*dReQ8n*dImQ1n*dImQ4n-dReQ1n*dReQ8n*dImQ3n*dImQ4n 
5595                                      + dReQ3n*dReQ4n*dImQ1n*dImQ8n+dReQ1n*dReQ4n*dImQ3n*dImQ8n 
5596                                      + dReQ1n*dReQ3n*dImQ4n*dImQ8n-dImQ1n*dImQ3n*dImQ4n*dImQ8n;
5597  Double_t reQ8nQ4nstarQ4nstar = pow(dReQ4n,2.)*dReQ8n-dReQ8n*pow(dImQ4n,2.)+2.*dReQ4n*dImQ4n*dImQ8n;
5598  // <5>_{5n,4n|4n,3n,2n}:
5599  Double_t reQ5nQ4nQ4nstarQ3nstarQ2nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))
5600                                         * (dReQ2n*dReQ3n*dReQ5n-dReQ5n*dImQ2n*dImQ3n 
5601                                         + dReQ3n*dImQ2n*dImQ5n+dReQ2n*dImQ3n*dImQ5n);
5602  Double_t reQ6nQ3nQ5nstarQ4nstar = dImQ4n*dImQ3n*dImQ6n*dImQ5n+dImQ6n*dImQ5n*dReQ4n*dReQ3n 
5603                                  + dImQ3n*dImQ5n*dReQ4n*dReQ6n-dImQ4n*dImQ5n*dReQ3n*dReQ6n
5604                                  - dImQ3n*dImQ6n*dReQ4n*dReQ5n+dImQ4n*dImQ6n*dReQ3n*dReQ5n 
5605                                  + dImQ4n*dImQ3n*dReQ6n*dReQ5n+dReQ4n*dReQ3n*dReQ6n*dReQ5n;
5606  Double_t reQ9nQ4nstarQ3nstarQ2nstar = dReQ2n*dReQ3n*dReQ4n*dReQ9n-dReQ4n*dReQ9n*dImQ2n*dImQ3n 
5607                                      - dReQ3n*dReQ9n*dImQ2n*dImQ4n-dReQ2n*dReQ9n*dImQ3n*dImQ4n 
5608                                      + dReQ3n*dReQ4n*dImQ2n*dImQ9n+dReQ2n*dReQ4n*dImQ3n*dImQ9n 
5609                                      + dReQ2n*dReQ3n*dImQ4n*dImQ9n-dImQ2n*dImQ3n*dImQ4n*dImQ9n;   
5610  Double_t reQ9nQ6nstarQ3nstar = dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n
5611                               + dImQ9n*dImQ6n*dReQ3n; 
5612  // <5>_{5n,3n|5n,2n,1n}:
5613  Double_t reQ5nQ3nQ5nstarQ2nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n 
5614                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n) 
5615                                         * (pow(dReQ5n,2.)+pow(dImQ5n,2.));
5616  Double_t reQ8nQ5nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ5n*dReQ8n-dReQ5n*dReQ8n*dImQ1n*dImQ2n 
5617                                      - dReQ2n*dReQ8n*dImQ1n*dImQ5n-dReQ1n*dReQ8n*dImQ2n*dImQ5n 
5618                                      + dReQ2n*dReQ5n*dImQ1n*dImQ8n+dReQ1n*dReQ5n*dImQ2n*dImQ8n 
5619                                      + dReQ1n*dReQ2n*dImQ5n*dImQ8n-dImQ1n*dImQ2n*dImQ5n*dImQ8n;
5620  // <5>_{5n,4n|5n,3n,1n}:
5621  Double_t reQ5nQ4nQ5nstarQ3nstarQ1nstar = (dReQ1n*dReQ3n*dReQ4n-dReQ4n*dImQ1n*dImQ3n 
5622                                         + dReQ3n*dImQ1n*dImQ4n+dReQ1n*dImQ3n*dImQ4n) 
5623                                         * (pow(dReQ5n,2.)+pow(dImQ5n,2.));
5624  Double_t reQ8nQ1nQ5nstarQ4nstar = dImQ4n*dImQ1n*dImQ8n*dImQ5n+dImQ8n*dImQ5n*dReQ4n*dReQ1n 
5625                                  + dImQ1n*dImQ5n*dReQ4n*dReQ8n-dImQ4n*dImQ5n*dReQ1n*dReQ8n
5626                                  - dImQ1n*dImQ8n*dReQ4n*dReQ5n+dImQ4n*dImQ8n*dReQ1n*dReQ5n 
5627                                  + dImQ4n*dImQ1n*dReQ8n*dReQ5n+dReQ4n*dReQ1n*dReQ8n*dReQ5n;                      
5628  Double_t reQ9nQ5nstarQ3nstarQ1nstar = dReQ1n*dReQ3n*dReQ5n*dReQ9n-dReQ5n*dReQ9n*dImQ1n*dImQ3n 
5629                                      - dReQ3n*dReQ9n*dImQ1n*dImQ5n-dReQ1n*dReQ9n*dImQ3n*dImQ5n 
5630                                      + dReQ3n*dReQ5n*dImQ1n*dImQ9n+dReQ1n*dReQ5n*dImQ3n*dImQ9n 
5631                                      + dReQ1n*dReQ3n*dImQ5n*dImQ9n-dImQ1n*dImQ3n*dImQ5n*dImQ9n;
5632  Double_t reQ9nQ8nstarQ1nstar = dReQ9n*dReQ8n*dReQ1n-dReQ9n*dImQ8n*dImQ1n+dImQ9n*dReQ8n*dImQ1n
5633                               + dImQ9n*dImQ8n*dReQ1n; 
5634  // <5>_{6n,1n|4n,2n,1n}:
5635  Double_t reQ6nQ1nQ4nstarQ2nstarQ1nstar = (dReQ2n*dReQ4n*dReQ6n-dReQ6n*dImQ2n*dImQ4n 
5636                                         + dReQ4n*dImQ2n*dImQ6n+dReQ2n*dImQ4n*dImQ6n) 
5637                                         * (pow(dReQ1n,2.)+pow(dImQ1n,2.));
5638  // <5>_{6n,3n|4n,3n,2n}:
5639  Double_t reQ6nQ3nQ4nstarQ3nstarQ2nstar = (dReQ2n*dReQ4n*dReQ6n-dReQ6n*dImQ2n*dImQ4n 
5640                                         + dReQ4n*dImQ2n*dImQ6n+dReQ2n*dImQ4n*dImQ6n) 
5641                                         * (pow(dReQ3n,2.)+pow(dImQ3n,2.));
5642  Double_t reQ7nQ2nQ6nstarQ3nstar = dImQ3n*dImQ2n*dImQ7n*dImQ6n+dImQ7n*dImQ6n*dReQ3n*dReQ2n 
5643                                  + dImQ2n*dImQ6n*dReQ3n*dReQ7n-dImQ3n*dImQ6n*dReQ2n*dReQ7n
5644                                  - dImQ2n*dImQ7n*dReQ3n*dReQ6n+dImQ3n*dImQ7n*dReQ2n*dReQ6n 
5645                                  + dImQ3n*dImQ2n*dReQ7n*dReQ6n+dReQ3n*dReQ2n*dReQ7n*dReQ6n;                      
5646  // <5>_{6n,2n|5n,2n,1n}:
5647  Double_t reQ6nQ2nQ5nstarQ2nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
5648                                         * (dReQ1n*dReQ5n*dReQ6n-dReQ6n*dImQ1n*dImQ5n 
5649                                         + dReQ5n*dImQ1n*dImQ6n+dReQ1n*dImQ5n*dImQ6n);
5650  // <5>_{6n,3n|5n,3n,1n}:
5651  Double_t reQ6nQ3nQ5nstarQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))
5652                                         * (dReQ1n*dReQ5n*dReQ6n-dReQ6n*dImQ1n*dImQ5n 
5653                                         + dReQ5n*dImQ1n*dImQ6n+dReQ1n*dImQ5n*dImQ6n);
5654  Double_t reQ8nQ1nQ6nstarQ3nstar = dImQ3n*dImQ1n*dImQ8n*dImQ6n+dImQ8n*dImQ6n*dReQ3n*dReQ1n 
5655                                  + dImQ1n*dImQ6n*dReQ3n*dReQ8n-dImQ3n*dImQ6n*dReQ1n*dReQ8n
5656                                  - dImQ1n*dImQ8n*dReQ3n*dReQ6n+dImQ3n*dImQ8n*dReQ1n*dReQ6n 
5657                                  + dImQ3n*dImQ1n*dReQ8n*dReQ6n+dReQ3n*dReQ1n*dReQ8n*dReQ6n;                      
5658  // <5>_{6n,4n|5n,4n,1n}:
5659  Double_t reQ6nQ4nQ5nstarQ4nstarQ1nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))
5660                                         * (dReQ1n*dReQ5n*dReQ6n-dReQ6n*dImQ1n*dImQ5n 
5661                                         + dReQ5n*dImQ1n*dImQ6n+dReQ1n*dImQ5n*dImQ6n);
5662  Double_t reQ6nQ4nQ5nstarQ5nstar = dReQ4n*pow(dReQ5n,2.)*dReQ6n+2.*dReQ5n*dReQ6n*dImQ4n*dImQ5n 
5663                                  - dReQ4n*dReQ6n*pow(dImQ5n,2.)-pow(dReQ5n,2.)*dImQ4n*dImQ6n
5664                                  + 2.*dReQ4n*dReQ5n*dImQ5n*dImQ6n+dImQ4n*pow(dImQ5n,2.)*dImQ6n;
5665  Double_t reQ9nQ1nQ6nstarQ4nstar = dImQ4n*dImQ1n*dImQ9n*dImQ6n+dImQ9n*dImQ6n*dReQ4n*dReQ1n 
5666                                  + dImQ1n*dImQ6n*dReQ4n*dReQ9n-dImQ4n*dImQ6n*dReQ1n*dReQ9n
5667                                  - dImQ1n*dImQ9n*dReQ4n*dReQ6n+dImQ4n*dImQ9n*dReQ1n*dReQ6n 
5668                                  + dImQ4n*dImQ1n*dReQ9n*dReQ6n+dReQ4n*dReQ1n*dReQ9n*dReQ6n;
5669  Double_t reQ10nQ5nstarQ4nstarQ1nstar = dReQ1n*dReQ4n*dReQ5n*dReQ10n-dReQ5n*dReQ10n*dImQ1n*dImQ4n 
5670                                       - dReQ4n*dReQ10n*dImQ1n*dImQ5n-dReQ1n*dReQ10n*dImQ4n*dImQ5n 
5671                                       + dReQ4n*dReQ5n*dImQ1n*dImQ10n+dReQ1n*dReQ5n*dImQ4n*dImQ10n 
5672                                       + dReQ1n*dReQ4n*dImQ5n*dImQ10n-dImQ1n*dImQ4n*dImQ5n*dImQ10n;
5673  Double_t reQ10nQ9nstarQ1nstar = dReQ10n*dReQ9n*dReQ1n-dReQ10n*dImQ9n*dImQ1n+dImQ10n*dReQ9n*dImQ1n
5674                                + dImQ10n*dImQ9n*dReQ1n;
5675  Double_t reQ10nQ5nstarQ5nstar = pow(dReQ5n,2.)*dReQ10n-dReQ10n*pow(dImQ5n,2.)+2.*dReQ5n*dImQ5n*dImQ10n;
5676  // <5>_{6n,3n|6n,2n,1n}:
5677  Double_t reQ6nQ3nQ6nstarQ2nstarQ1nstar = (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n 
5678                                         + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n) 
5679                                         * (pow(dReQ6n,2.)+pow(dImQ6n,2.));
5680  Double_t reQ9nQ6nstarQ2nstarQ1nstar = dReQ1n*dReQ2n*dReQ6n*dReQ9n-dReQ6n*dReQ9n*dImQ1n*dImQ2n 
5681                                      - dReQ2n*dReQ9n*dImQ1n*dImQ6n-dReQ1n*dReQ9n*dImQ2n*dImQ6n 
5682                                      + dReQ2n*dReQ6n*dImQ1n*dImQ9n+dReQ1n*dReQ6n*dImQ2n*dImQ9n 
5683                                      + dReQ1n*dReQ2n*dImQ6n*dImQ9n-dImQ1n*dImQ2n*dImQ6n*dImQ9n;
5684  // <5>_{6n,4n|6n,3n,1n}:
5685  Double_t reQ6nQ4nQ6nstarQ3nstarQ1nstar = (dReQ1n*dReQ3n*dReQ4n-dReQ4n*dImQ1n*dImQ3n 
5686                                         + dReQ3n*dImQ1n*dImQ4n+dReQ1n*dImQ3n*dImQ4n) 
5687                                         * (pow(dReQ6n,2.)+pow(dImQ6n,2.));
5688  Double_t reQ10nQ6nstarQ3nstarQ1nstar = dReQ1n*dReQ3n*dReQ6n*dReQ10n-dReQ6n*dReQ10n*dImQ1n*dImQ3n 
5689                                       - dReQ3n*dReQ10n*dImQ1n*dImQ6n-dReQ1n*dReQ10n*dImQ3n*dImQ6n 
5690                                       + dReQ3n*dReQ6n*dImQ1n*dImQ10n+dReQ1n*dReQ6n*dImQ3n*dImQ10n 
5691                                       + dReQ1n*dReQ3n*dImQ6n*dImQ10n-dImQ1n*dImQ3n*dImQ6n*dImQ10n;
5692  // <5>_{6n,5n|5n,4n,2n}:
5693  Double_t reQ6nQ5nQ5nstarQ4nstarQ2nstar = (dReQ2n*dReQ4n*dReQ6n-dReQ6n*dImQ2n*dImQ4n 
5694                                         + dReQ4n*dImQ2n*dImQ6n+dReQ2n*dImQ4n*dImQ6n) 
5695                                         * (pow(dReQ5n,2.)+pow(dImQ5n,2.));
5696  Double_t reQ7nQ4nQ6nstarQ5nstar = dImQ5n*dImQ4n*dImQ7n*dImQ6n+dImQ7n*dImQ6n*dReQ5n*dReQ4n 
5697                                  + dImQ4n*dImQ6n*dReQ5n*dReQ7n-dImQ5n*dImQ6n*dReQ4n*dReQ7n
5698                                  - dImQ4n*dImQ7n*dReQ5n*dReQ6n+dImQ5n*dImQ7n*dReQ4n*dReQ6n 
5699                                  + dImQ5n*dImQ4n*dReQ7n*dReQ6n+dReQ5n*dReQ4n*dReQ7n*dReQ6n;
5700  Double_t reQ9nQ2nQ6nstarQ5nstar = dImQ5n*dImQ2n*dImQ9n*dImQ6n+dImQ9n*dImQ6n*dReQ5n*dReQ2n 
5701                                  + dImQ2n*dImQ6n*dReQ5n*dReQ9n-dImQ5n*dImQ6n*dReQ2n*dReQ9n
5702                                  - dImQ2n*dImQ9n*dReQ5n*dReQ6n+dImQ5n*dImQ9n*dReQ2n*dReQ6n 
5703                                  + dImQ5n*dImQ2n*dReQ9n*dReQ6n+dReQ5n*dReQ2n*dReQ9n*dReQ6n;
5704  Double_t reQ11nQ5nstarQ4nstarQ2nstar = dReQ2n*dReQ4n*dReQ5n*dReQ11n-dReQ5n*dReQ11n*dImQ2n*dImQ4n 
5705                                       - dReQ4n*dReQ11n*dImQ2n*dImQ5n-dReQ2n*dReQ11n*dImQ4n*dImQ5n 
5706                                       + dReQ4n*dReQ5n*dImQ2n*dImQ11n+dReQ2n*dReQ5n*dImQ4n*dImQ11n 
5707                                       + dReQ2n*dReQ4n*dImQ5n*dImQ11n-dImQ2n*dImQ4n*dImQ5n*dImQ11n;
5708  Double_t reQ11nQ9nstarQ2nstar = dReQ11n*dReQ9n*dReQ2n-dReQ11n*dImQ9n*dImQ2n+dImQ11n*dReQ9n*dImQ2n
5709                                + dImQ11n*dImQ9n*dReQ2n;
5710  Double_t reQ11nQ7nstarQ4nstar = dReQ11n*dReQ7n*dReQ4n-dReQ11n*dImQ7n*dImQ4n+dImQ11n*dReQ7n*dImQ4n
5711                                + dImQ11n*dImQ7n*dReQ4n;
5712  // <5>_{6n,5n|6n,3n,2n}:
5713  Double_t reQ6nQ5nQ6nstarQ3nstarQ2nstar = (dReQ2n*dReQ3n*dReQ5n-dReQ5n*dImQ2n*dImQ3n 
5714                                         + dReQ3n*dImQ2n*dImQ5n+dReQ2n*dImQ3n*dImQ5n) 
5715                                         * (pow(dReQ6n,2.)+pow(dImQ6n,2.));
5716  Double_t reQ11nQ6nstarQ3nstarQ2nstar = dReQ2n*dReQ3n*dReQ6n*dReQ11n-dReQ6n*dReQ11n*dImQ2n*dImQ3n 
5717                                       - dReQ3n*dReQ11n*dImQ2n*dImQ6n-dReQ2n*dReQ11n*dImQ3n*dImQ6n 
5718                                       + dReQ3n*dReQ6n*dImQ2n*dImQ11n+dReQ2n*dReQ6n*dImQ3n*dImQ11n 
5719                                       + dReQ2n*dReQ3n*dImQ6n*dImQ11n-dImQ2n*dImQ3n*dImQ6n*dImQ11n;
5720  // <5>_{6n,5n|6n,4n,1n}:
5721  Double_t reQ6nQ5nQ6nstarQ4nstarQ1nstar = (dReQ1n*dReQ4n*dReQ5n-dReQ5n*dImQ1n*dImQ4n 
5722                                         + dReQ4n*dImQ1n*dImQ5n+dReQ1n*dImQ4n*dImQ5n) 
5723                                         * (pow(dReQ6n,2.)+pow(dImQ6n,2.));
5724  Double_t reQ10nQ1nQ6nstarQ5nstar = dImQ5n*dImQ1n*dImQ10n*dImQ6n+dImQ10n*dImQ6n*dReQ5n*dReQ1n 
5725                                   + dImQ1n*dImQ6n*dReQ5n*dReQ10n-dImQ5n*dImQ6n*dReQ1n*dReQ10n
5726                                   - dImQ1n*dImQ10n*dReQ5n*dReQ6n+dImQ5n*dImQ10n*dReQ1n*dReQ6n 
5727                                   + dImQ5n*dImQ1n*dReQ10n*dReQ6n+dReQ5n*dReQ1n*dReQ10n*dReQ6n;
5728  Double_t reQ11nQ10nstarQ1nstar = dReQ11n*dReQ10n*dReQ1n-dReQ11n*dImQ10n*dImQ1n+dImQ11n*dReQ10n*dImQ1n
5729                                 + dImQ11n*dImQ10n*dReQ1n;
5730  Double_t reQ11nQ6nstarQ4nstarQ1nstar = dReQ1n*dReQ4n*dReQ6n*dReQ11n-dReQ6n*dReQ11n*dImQ1n*dImQ4n 
5731                                       - dReQ4n*dReQ11n*dImQ1n*dImQ6n-dReQ1n*dReQ11n*dImQ4n*dImQ6n 
5732                                       + dReQ4n*dReQ6n*dImQ1n*dImQ11n+dReQ1n*dReQ6n*dImQ4n*dImQ11n 
5733                                       + dReQ1n*dReQ4n*dImQ6n*dImQ11n-dImQ1n*dImQ4n*dImQ6n*dImQ11n;
5734  // <5>_{4n,1n|3n,1n,1n}:
5735  Double_t reQ4nQ1nQ3nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
5736                                         * (dReQ1n*dReQ3n*dReQ4n-dReQ4n*dImQ1n*dImQ3n
5737                                         + dReQ3n*dImQ1n*dImQ4n+dReQ1n*dImQ3n*dImQ4n);
5738  Double_t reQ4nQ1nQ4nstarQ1nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
5739  Double_t reQ3nQ1nQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
5740  // <5>_{4n,3n|3n,3n,1n}:
5741  Double_t reQ4nQ3nQ3nstarQ3nstarQ1nstar = (pow(dReQ3n,2.)+pow(dImQ3n,2.))
5742                                         * (dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)); 
5743  Double_t reQ7nQ3nstarQ3nstarQ1nstar = (dReQ7n*dReQ1n+dImQ7n*dImQ1n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
5744                                      + 2.*dReQ3n*dImQ3n*(dImQ7n*dReQ1n-dReQ7n*dImQ1n); 
5745  // <5>_{4n,4n|4n,3n,1n}:
5746  Double_t reQ4nQ4nQ4nstarQ3nstarQ1nstar = (pow(dReQ4n,2.)+pow(dImQ4n,2.))
5747                                         * reQ4nQ3nstarQ1nstar;
5748  Double_t reQ7nQ1nQ4nstarQ4nstar = dReQ1n*pow(dReQ4n,2.)*dReQ7n+2.*dReQ4n*dReQ7n*dImQ1n*dImQ4n 
5749                                  - dReQ1n*dReQ7n*pow(dImQ4n,2.)-pow(dReQ4n,2.)*dImQ1n*dImQ7n
5750                                  + 2.*dReQ1n*dReQ4n*dImQ4n*dImQ7n+dImQ1n*pow(dImQ4n,2.)*dImQ7n;
5751  // <5>_{5n,2n|3n,2n,2n}:
5752  Double_t reQ5nQ2nQ3nstarQ2nstarQ2nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
5753                                         * reQ5nQ3nstarQ2nstar;
5754  // <5>_{5n,3n|3n,3n,2n}:
5755  Double_t reQ5nQ3nQ3nstarQ3nstarQ2nstar = (pow(dImQ3n,2.)+pow(dReQ3n,2.))
5756                                         * (dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n 
5757                                         - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n);
5758  Double_t reQ8nQ3nstarQ3nstarQ2nstar = (dReQ8n*dReQ2n+dImQ8n*dImQ2n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
5759                                      + 2.*dReQ3n*dImQ3n*(dImQ8n*dReQ2n-dReQ8n*dImQ2n);
5760  /*
5761  Double_t reQ5nQ1nQ3nstarQ2nstar = dImQ2n*dImQ1n*dImQ5n*dImQ3n+dImQ5n*dImQ3n*dReQ2n*dReQ1n 
5762                                  + dImQ1n*dImQ3n*dReQ2n*dReQ5n-dImQ2n*dImQ3n*dReQ1n*dReQ5n
5763                                  - dImQ1n*dImQ5n*dReQ2n*dReQ3n+dImQ2n*dImQ5n*dReQ1n*dReQ3n 
5764                                  + dImQ2n*dImQ1n*dReQ5n*dReQ3n+dReQ2n*dReQ1n*dReQ5n*dReQ3n;
5765  */
5766  // <5>_{5n,1n|4n,1n,1n}:
5767  Double_t reQ5nQ1nQ4nstarQ1nstarQ1nstar = (pow(dImQ1n,2.)+pow(dReQ1n,2.))
5768                                         * (dImQ1n*dImQ5n*dReQ4n+dImQ4n*dImQ5n*dReQ1n 
5769                                         - dImQ4n*dImQ1n*dReQ5n+dReQ4n*dReQ1n*dReQ5n);
5770  // <5>_{5n,4n|4n,4n,1n}:
5771  Double_t reQ5nQ4nQ4nstarQ4nstarQ1nstar = (pow(dImQ4n,2.)+pow(dReQ4n,2.))
5772                                         * (dImQ4n*dImQ5n*dReQ1n+dImQ1n*dImQ5n*dReQ4n 
5773                                         - dImQ1n*dImQ4n*dReQ5n+dReQ1n*dReQ4n*dReQ5n);
5774  Double_t reQ9nQ4nstarQ4nstarQ1nstar = (dReQ9n*dReQ1n+dImQ9n*dImQ1n)*(pow(dReQ4n,2)-pow(dImQ4n,2)) 
5775                                      + 2.*dReQ4n*dImQ4n*(dImQ9n*dReQ1n-dReQ9n*dImQ1n);
5776  // <5>_{5n,5n|5n,3n,2n}:
5777  Double_t reQ5nQ5nQ5nstarQ3nstarQ2nstar = (pow(dImQ5n,2.)+pow(dReQ5n,2.))
5778                                         * (dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n
5779                                         - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n);
5780  Double_t reQ7nQ3nQ5nstarQ5nstar = dReQ3n*pow(dReQ5n,2.)*dReQ7n+2.*dReQ5n*dReQ7n*dImQ3n*dImQ5n 
5781                                  - dReQ3n*dReQ7n*pow(dImQ5n,2.)-pow(dReQ5n,2.)*dImQ3n*dImQ7n
5782                                  + 2.*dReQ3n*dReQ5n*dImQ5n*dImQ7n+dImQ3n*pow(dImQ5n,2.)*dImQ7n;
5783  Double_t reQ8nQ2nQ5nstarQ5nstar = dReQ2n*pow(dReQ5n,2.)*dReQ8n+2.*dReQ5n*dReQ8n*dImQ2n*dImQ5n 
5784                                  - dReQ2n*dReQ8n*pow(dImQ5n,2.)-pow(dReQ5n,2.)*dImQ2n*dImQ8n
5785                                  + 2.*dReQ2n*dReQ5n*dImQ5n*dImQ8n+dImQ2n*pow(dImQ5n,2.)*dImQ8n;
5786  Double_t reQ10nQ5nstarQ3nstarQ2nstar = dReQ2n*dReQ3n*dReQ5n*dReQ10n-dReQ5n*dReQ10n*dImQ2n*dImQ3n 
5787                                       - dReQ3n*dReQ10n*dImQ2n*dImQ5n-dReQ2n*dReQ10n*dImQ3n*dImQ5n 
5788                                       + dReQ3n*dReQ5n*dImQ2n*dImQ10n+dReQ2n*dReQ5n*dImQ3n*dImQ10n 
5789                                       + dReQ2n*dReQ3n*dImQ5n*dImQ10n-dImQ2n*dImQ3n*dImQ5n*dImQ10n;
5790  Double_t reQ10nQ8nstarQ2nstar = dReQ10n*dReQ8n*dReQ2n-dReQ10n*dImQ8n*dImQ2n+dImQ10n*dReQ8n*dImQ2n
5791                                + dImQ10n*dImQ8n*dReQ2n;
5792  // <5>_{5n,5n|5n,4n,1n}:
5793  Double_t reQ5nQ5nQ5nstarQ4nstarQ1nstar = (pow(dImQ5n,2.)+pow(dReQ5n,2.))
5794                                         * (dImQ4n*dImQ5n*dReQ1n+dImQ1n*dImQ5n*dReQ4n
5795                                         - dImQ1n*dImQ4n*dReQ5n+dReQ1n*dReQ4n*dReQ5n);
5796  Double_t reQ9nQ1nQ5nstarQ5nstar = dReQ1n*pow(dReQ5n,2.)*dReQ9n+2.*dReQ5n*dReQ9n*dImQ1n*dImQ5n 
5797                                  - dReQ1n*dReQ9n*pow(dImQ5n,2.)-pow(dReQ5n,2.)*dImQ1n*dImQ9n
5798                                  + 2.*dReQ1n*dReQ5n*dImQ5n*dImQ9n+dImQ1n*pow(dImQ5n,2.)*dImQ9n;
5799  // <5>_{6n,1n|5n,1n,1n}:
5800  Double_t reQ6nQ1nQ5nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
5801                                         * (dReQ1n*dReQ5n*dReQ6n-dReQ6n*dImQ1n*dImQ5n
5802                                         + dReQ5n*dImQ1n*dImQ6n+dReQ1n*dImQ5n*dImQ6n);
5803  // <5>_{6n,5n|5n,5n,1n}:
5804  Double_t reQ6nQ5nQ5nstarQ5nstarQ1nstar = (pow(dImQ5n,2.)+pow(dReQ5n,2.))
5805                                         * (dImQ5n*dImQ6n*dReQ1n+dImQ1n*dImQ6n*dReQ5n 
5806                                         - dImQ1n*dImQ5n*dReQ6n+dReQ1n*dReQ5n*dReQ6n);
5807  Double_t reQ11nQ5nstarQ5nstarQ1nstar = (dReQ11n*dReQ1n+dImQ11n*dImQ1n)*(pow(dReQ5n,2)-pow(dImQ5n,2)) 
5808                                       + 2.*dReQ5n*dImQ5n*(dImQ11n*dReQ1n-dReQ11n*dImQ1n);
5809  // <5>_{6n,6n|6n,5n,1n}:
5810  Double_t reQ6nQ6nQ6nstarQ5nstarQ1nstar = (pow(dReQ6n,2.)+pow(dImQ6n,2.))
5811                                         * reQ6nQ5nstarQ1nstar;
5812  Double_t reQ7nQ5nQ6nstarQ6nstar = dReQ5n*pow(dReQ6n,2.)*dReQ7n+2.*dReQ6n*dReQ7n*dImQ5n*dImQ6n 
5813                                  - dReQ5n*dReQ7n*pow(dImQ6n,2.)-pow(dReQ6n,2.)*dImQ5n*dImQ7n
5814                                  + 2.*dReQ5n*dReQ6n*dImQ6n*dImQ7n+dImQ5n*pow(dImQ6n,2.)*dImQ7n;
5815  Double_t reQ11nQ1nQ6nstarQ6nstar = dReQ1n*pow(dReQ6n,2.)*dReQ11n+2.*dReQ6n*dReQ11n*dImQ1n*dImQ6n 
5816                                   - dReQ1n*dReQ11n*pow(dImQ6n,2.)-pow(dReQ6n,2.)*dImQ1n*dImQ11n
5817                                   + 2.*dReQ1n*dReQ6n*dImQ6n*dImQ11n+dImQ1n*pow(dImQ6n,2.)*dImQ11n;
5818  Double_t reQ12nQ6nstarQ6nstar = pow(dReQ6n,2.)*dReQ12n-dReQ12n*pow(dImQ6n,2.)+2.*dReQ6n*dImQ6n*dImQ12n;
5819  Double_t reQ12nQ11nstarQ1nstar = dReQ12n*dReQ11n*dReQ1n-dReQ12n*dImQ11n*dImQ1n+dImQ12n*dReQ11n*dImQ1n
5820                                 + dImQ12n*dImQ11n*dReQ1n;
5821  Double_t reQ12nQ6nstarQ5nstarQ1nstar = dReQ1n*dReQ5n*dReQ6n*dReQ12n-dReQ6n*dReQ12n*dImQ1n*dImQ5n 
5822                                       - dReQ5n*dReQ12n*dImQ1n*dImQ6n-dReQ1n*dReQ12n*dImQ5n*dImQ6n 
5823                                       + dReQ5n*dReQ6n*dImQ1n*dImQ12n+dReQ1n*dReQ6n*dImQ5n*dImQ12n 
5824                                       + dReQ1n*dReQ5n*dImQ6n*dImQ12n-dImQ1n*dImQ5n*dImQ6n*dImQ12n;
5825  Double_t reQ12nQ7nstarQ5nstar = dReQ12n*dReQ7n*dReQ5n-dReQ12n*dImQ7n*dImQ5n+dImQ12n*dReQ7n*dImQ5n
5826                                + dImQ12n*dImQ7n*dReQ5n;
5827  // <5>_{6n,2n|4n,3n,1n}:
5828  Double_t reQ6nQ2nQ4nstarQ3nstarQ1nstar = dReQ1n*dReQ2n*dReQ3n*dReQ4n*dReQ6n+dReQ3n*dReQ4n*dReQ6n*dImQ1n*dImQ2n 
5829                                         - dReQ2n*dReQ4n*dReQ6n*dImQ1n*dImQ3n+dReQ1n*dReQ4n*dReQ6n*dImQ2n*dImQ3n 
5830                                         - dReQ2n*dReQ3n*dReQ6n*dImQ1n*dImQ4n+dReQ1n*dReQ3n*dReQ6n*dImQ2n*dImQ4n
5831                                         - dReQ1n*dReQ2n*dReQ6n*dImQ3n*dImQ4n-dReQ6n*dImQ1n*dImQ2n*dImQ3n*dImQ4n 
5832                                         + dReQ2n*dReQ3n*dReQ4n*dImQ1n*dImQ6n-dReQ1n*dReQ3n*dReQ4n*dImQ2n*dImQ6n 
5833                                         + dReQ1n*dReQ2n*dReQ4n*dImQ3n*dImQ6n+dReQ4n*dImQ1n*dImQ2n*dImQ3n*dImQ6n 
5834                                         + dReQ1n*dReQ2n*dReQ3n*dImQ4n*dImQ6n+dReQ3n*dImQ1n*dImQ2n*dImQ4n*dImQ6n 
5835                                         - dReQ2n*dImQ1n*dImQ3n*dImQ4n*dImQ6n+dReQ1n*dImQ2n*dImQ3n*dImQ4n*dImQ6n;
5836  Double_t reQ6nQ2nQ4nstarQ4nstar = dReQ2n*pow(dReQ4n,2.)*dReQ6n+2.*dReQ4n*dReQ6n*dImQ2n*dImQ4n 
5837                                  - dReQ2n*dReQ6n*pow(dImQ4n,2.)-pow(dReQ4n,2.)*dImQ2n*dImQ6n
5838                                  + 2.*dReQ2n*dReQ4n*dImQ4n*dImQ6n+dImQ2n*pow(dImQ4n,2.)*dImQ6n;
5839  // <5>_{6n,2n,1n|5n,4n}:
5840  Double_t reQ6nQ2nQ1nQ5nstarQ4nstar = dReQ1n*dReQ2n*dReQ4n*dReQ6n*dReQ5n - dReQ4n*dReQ6n*dReQ5n*dImQ1n*dImQ2n 
5841                                     + dReQ2n*dReQ6n*dReQ5n*dImQ1n*dImQ4n + dReQ1n*dReQ6n*dReQ5n*dImQ2n*dImQ4n
5842                                     - dReQ2n*dReQ4n*dReQ5n*dImQ1n*dImQ6n - dReQ1n*dReQ4n*dReQ5n*dImQ2n*dImQ6n 
5843                                     + dReQ1n*dReQ2n*dReQ5n*dImQ4n*dImQ6n - dReQ5n*dImQ1n*dImQ2n*dImQ4n*dImQ6n 
5844                                     + dReQ2n*dReQ4n*dReQ6n*dImQ1n*dImQ5n + dReQ1n*dReQ4n*dReQ6n*dImQ2n*dImQ5n 
5845                                     - dReQ1n*dReQ2n*dReQ6n*dImQ4n*dImQ5n + dReQ6n*dImQ1n*dImQ2n*dImQ4n*dImQ5n 
5846                                     + dReQ1n*dReQ2n*dReQ4n*dImQ6n*dImQ5n - dReQ4n*dImQ1n*dImQ2n*dImQ6n*dImQ5n 
5847                                     + dReQ2n*dImQ1n*dImQ4n*dImQ6n*dImQ5n + dReQ1n*dImQ2n*dImQ4n*dImQ6n*dImQ5n;
5848
5849  // <5>_{6n,4n|5n,3n,2n}:
5850  Double_t reQ6nQ4nQ5nstarQ3nstarQ2nstar = dReQ2n*dReQ3n*dReQ4n*dReQ5n*dReQ6n - dReQ4n*dReQ5n*dReQ6n*dImQ2n*dImQ3n 
5851                                         + dReQ3n*dReQ5n*dReQ6n*dImQ2n*dImQ4n + dReQ2n*dReQ5n*dReQ6n*dImQ3n*dImQ4n
5852                                         - dReQ3n*dReQ4n*dReQ6n*dImQ2n*dImQ5n - dReQ2n*dReQ4n*dReQ6n*dImQ3n*dImQ5n 
5853                                         + dReQ2n*dReQ3n*dReQ6n*dImQ4n*dImQ5n - dReQ6n*dImQ2n*dImQ3n*dImQ4n*dImQ5n 
5854                                         + dReQ3n*dReQ4n*dReQ5n*dImQ2n*dImQ6n + dReQ2n*dReQ4n*dReQ5n*dImQ3n*dImQ6n 
5855                                         - dReQ2n*dReQ3n*dReQ5n*dImQ4n*dImQ6n + dReQ5n*dImQ2n*dImQ3n*dImQ4n*dImQ6n 
5856                                         + dReQ2n*dReQ3n*dReQ4n*dImQ5n*dImQ6n - dReQ4n*dImQ2n*dImQ3n*dImQ5n*dImQ6n 
5857                                         + dReQ3n*dImQ2n*dImQ4n*dImQ5n*dImQ6n + dReQ2n*dImQ3n*dImQ4n*dImQ5n*dImQ6n;
5858  Double_t reQ8nQ2nQ6nstarQ4nstar = dImQ4n*dImQ2n*dImQ8n*dImQ6n+dImQ8n*dImQ6n*dReQ4n*dReQ2n 
5859                                  + dImQ2n*dImQ6n*dReQ4n*dReQ8n-dImQ4n*dImQ6n*dReQ2n*dReQ8n
5860                                  - dImQ2n*dImQ8n*dReQ4n*dReQ6n+dImQ4n*dImQ8n*dReQ2n*dReQ6n 
5861                                  + dImQ4n*dImQ2n*dReQ8n*dReQ6n+dReQ4n*dReQ2n*dReQ8n*dReQ6n;
5862
5863  // <5>_{4n,4n|3n,3n,2n}:
5864  Double_t reQ4nQ4nQ3nstarQ3nstarQ2nstar = dReQ2n*pow(dReQ3n,2.)*pow(dReQ4n,2.)-2.*dReQ3n*pow(dReQ4n,2.)*dImQ2n*dImQ3n 
5865                                         - dReQ2n*pow(dReQ4n,2.)*pow(dImQ3n,2.)+2.*pow(dReQ3n,2.)*dReQ4n*dImQ2n*dImQ4n 
5866                                         + 4.*dReQ2n*dReQ3n*dReQ4n*dImQ3n*dImQ4n - 2.*dReQ4n*dImQ2n*pow(dImQ3n,2.)*dImQ4n
5867                                         - dReQ2n*pow(dReQ3n,2.)*pow(dImQ4n,2.) + 2.*dReQ3n*dImQ2n*dImQ3n*pow(dImQ4n,2.) 
5868                                         + dReQ2n*pow(dImQ3n,2.)*pow(dImQ4n,2.);
5869
5870  // <5>_{5n|2n,1n,1n,1n}:
5871  Double_t reQ5nQ2nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,3.)*dReQ2n*dReQ5n-3.*dReQ1n*dReQ2n*dReQ5n*pow(dImQ1n,2.) 
5872                                             - 3.*pow(dReQ1n,2.)*dReQ5n*dImQ1n*dImQ2n+dReQ5n*pow(dImQ1n,3.)*dImQ2n 
5873                                             + 3.*pow(dReQ1n,2.)*dReQ2n*dImQ1n*dImQ5n-dReQ2n*pow(dImQ1n,3.)*dImQ5n
5874                                             + pow(dReQ1n,3.)*dImQ2n*dImQ5n-3.*dReQ1n*pow(dImQ1n,2.)*dImQ2n*dImQ5n;
5875
5876  // <5>_{5n,1n|2n,2n,2n}:
5877  Double_t reQ5nQ1nQ2nstarQ2nstarQ2nstar = dReQ1n*pow(dReQ2n,3.)*dReQ5n+3.*pow(dReQ2n,2.)*dReQ5n*dImQ1n*dImQ2n
5878                                         - 3.*dReQ1n*dReQ2n*dReQ5n*pow(dImQ2n,2.)-dReQ5n*dImQ1n*pow(dImQ2n,3.) 
5879                                         - pow(dReQ2n,3.)*dImQ1n*dImQ5n+3.*dReQ1n*pow(dReQ2n,2.)*dImQ2n*dImQ5n 
5880                                         + 3.*dReQ2n*dImQ1n*pow(dImQ2n,2.)*dImQ5n-dReQ1n*pow(dImQ2n,3.)*dImQ5n;
5881
5882
5883  // <5>_{5n,4n|3n,3n,3n}:
5884  Double_t reQ5nQ4nQ3nstarQ3nstarQ3nstar = dReQ4n*pow(dReQ3n,3.)*dReQ5n+3.*pow(dReQ3n,2.)*dReQ5n*dImQ4n*dImQ3n
5885                                         - 3.*dReQ4n*dReQ3n*dReQ5n*pow(dImQ3n,2.)-dReQ5n*dImQ4n*pow(dImQ3n,3.) 
5886                                         - pow(dReQ3n,3.)*dImQ4n*dImQ5n+3.*dReQ4n*pow(dReQ3n,2.)*dImQ3n*dImQ5n 
5887                                         + 3.*dReQ3n*dImQ4n*pow(dImQ3n,2.)*dImQ5n-dReQ4n*pow(dImQ3n,3.)*dImQ5n;
5888
5889  Double_t reQ9nQ3nstarQ3nstarQ3nstar = dReQ9n*pow(dReQ3n,3)-3.*dReQ3n*dReQ9n*pow(dImQ3n,2)
5890                                      + 3.*dImQ3n*dImQ9n*pow(dReQ3n,2)-dImQ9n*pow(dImQ3n,3); 
5891  // <5>_{5n,5n|4n,3n,3n}:
5892  Double_t reQ5nQ5nQ4nstarQ3nstarQ3nstar = dReQ4n*pow(dReQ3n,2.)*pow(dReQ5n,2.) - 2.*dReQ3n*pow(dReQ5n,2.)*dImQ4n*dImQ3n
5893                                         - dReQ4n*pow(dReQ5n,2.)*pow(dImQ3n,2.) + 2.*pow(dReQ3n,2.)*dReQ5n*dImQ4n*dImQ5n 
5894                                         + 4.*dReQ4n*dReQ3n*dReQ5n*dImQ3n*dImQ5n - 2.*dReQ5n*dImQ4n*pow(dImQ3n,2.)*dImQ5n
5895                                         - dReQ4n*pow(dReQ3n,2.)*pow(dImQ5n,2.) + 2.*dReQ3n*dImQ4n*dImQ3n*pow(dImQ5n,2.) 
5896                                         + dReQ4n*pow(dImQ3n,2.)*pow(dImQ5n,2.);
5897
5898  // <5>_{5n,5n|4n,4n,2n}:   
5899  Double_t reQ5nQ5nQ4nstarQ4nstarQ2nstar = dReQ2n*pow(dReQ4n,2.)*pow(dReQ5n,2.) - 2.*dReQ4n*pow(dReQ5n,2.)*dImQ2n*dImQ4n
5900                                         - dReQ2n*pow(dReQ5n,2.)*pow(dImQ4n,2.) + 2.*pow(dReQ4n,2.)*dReQ5n*dImQ2n*dImQ5n 
5901                                         + 4.*dReQ2n*dReQ4n*dReQ5n*dImQ4n*dImQ5n - 2.*dReQ5n*dImQ2n*pow(dImQ4n,2.)*dImQ5n
5902                                         - dReQ2n*pow(dReQ4n,2.)*pow(dImQ5n,2.) + 2.*dReQ4n*dImQ2n*dImQ4n*pow(dImQ5n,2.) 
5903                                         + dReQ2n*pow(dImQ4n,2.)*pow(dImQ5n,2.);
5904  Double_t reQ10nQ4nstarQ4nstarQ2nstar = (dReQ10n*dReQ2n+dImQ10n*dImQ2n)*(pow(dReQ4n,2)-pow(dImQ4n,2)) 
5905                                       + 2.*dReQ4n*dImQ4n*(dImQ10n*dReQ2n-dReQ10n*dImQ2n);
5906  // <5>_{6n|3n,1n,1n,1n}:
5907  Double_t reQ6nQ3nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,3.)*dReQ3n*dReQ6n-3.*dReQ1n*dReQ3n*dReQ6n*pow(dImQ1n,2.) 
5908                                             - 3.*pow(dReQ1n,2.)*dReQ6n*dImQ1n*dImQ3n+dReQ6n*pow(dImQ1n,3.)*dImQ3n 
5909                                             + 3.*pow(dReQ1n,2.)*dReQ3n*dImQ1n*dImQ6n-dReQ3n*pow(dImQ1n,3.)*dImQ6n
5910                                             + pow(dReQ1n,3.)*dImQ3n*dImQ6n-3.*dReQ1n*pow(dImQ1n,2.)*dImQ3n*dImQ6n;
5911  // <5>_{6n,1n,1n|4n,4n}:
5912  Double_t reQ6nQ1nQ1nQ4nstarQ4nstar = pow(dReQ1n,2.)*pow(dReQ4n,2.)*dReQ6n - pow(dReQ4n,2.)*dReQ6n*pow(dImQ1n,2.)
5913                                     + 4.*dReQ1n*dReQ4n*dReQ6n*dImQ1n*dImQ4n - pow(dReQ1n,2.)*dReQ6n*pow(dImQ4n,2.)
5914                                     + dReQ6n*pow(dImQ1n,2.)*pow(dImQ4n,2.) - 2.*dReQ1n*pow(dReQ4n,2.)*dImQ1n*dImQ6n 
5915                                     + 2.*pow(dReQ1n,2.)*dReQ4n*dImQ4n*dImQ6n - 2.*dReQ4n*pow(dImQ1n,2.)*dImQ4n*dImQ6n
5916                                     + 2.*dReQ1n*dImQ1n*pow(dImQ4n,2.)*dImQ6n;
5917
5918
5919  // <5>_{6n,2n,2n|5n,5n}:
5920  Double_t reQ6nQ2nQ2nQ5nstarQ5nstar = pow(dReQ2n,2.)*pow(dReQ5n,2.)*dReQ6n - pow(dReQ5n,2.)*dReQ6n*pow(dImQ2n,2.)
5921                                     + 4.*dReQ2n*dReQ5n*dReQ6n*dImQ2n*dImQ5n - pow(dReQ2n,2.)*dReQ6n*pow(dImQ5n,2.)
5922                                     + dReQ6n*pow(dImQ2n,2.)*pow(dImQ5n,2.) - 2.*dReQ2n*pow(dReQ5n,2.)*dImQ2n*dImQ6n 
5923                                     + 2.*pow(dReQ2n,2.)*dReQ5n*dImQ5n*dImQ6n - 2.*dReQ5n*pow(dImQ2n,2.)*dImQ5n*dImQ6n
5924                                     + 2.*dReQ2n*dImQ2n*pow(dImQ5n,2.)*dImQ6n;
5925  Double_t reQ10nQ6nstarQ2nstarQ2nstar = (dReQ10n*dReQ6n+dImQ10n*dImQ6n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
5926                                       + 2.*dReQ2n*dImQ2n*(dImQ10n*dReQ6n-dReQ10n*dImQ6n);
5927  // <5>_{6n,6n|5n,5n,2n}:
5928  Double_t reQ6nQ6nQ5nstarQ5nstarQ2nstar = dReQ2n*pow(dReQ5n,2.)*pow(dReQ6n,2.) - 2.*dReQ5n*pow(dReQ6n,2.)*dImQ2n*dImQ5n
5929                                         - dReQ2n*pow(dReQ6n,2.)*pow(dImQ5n,2.) + 2.*pow(dReQ5n,2.)*dReQ6n*dImQ2n*dImQ6n 
5930                                         + 4.*dReQ2n*dReQ5n*dReQ6n*dImQ5n*dImQ6n - 2.*dReQ6n*dImQ2n*pow(dImQ5n,2.)*dImQ6n
5931                                         - dReQ2n*pow(dReQ5n,2.)*pow(dImQ6n,2.) + 2.*dReQ5n*dImQ2n*dImQ5n*pow(dImQ6n,2.) 
5932                                         + dReQ2n*pow(dImQ5n,2.)*pow(dImQ6n,2.);
5933  Double_t reQ10nQ2nQ6nstarQ6nstar = dImQ2n*pow(dImQ6n,2.)*dImQ10n+2.*dImQ6n*dImQ10n*dReQ2n*dReQ6n
5934                                   - dImQ2n*dImQ10n*pow(dReQ6n,2.)-pow(dImQ6n,2.)*dReQ2n*dReQ10n 
5935                                   + 2.*dImQ2n*dImQ6n*dReQ6n*dReQ10n+dReQ2n*pow(dReQ6n,2.)*dReQ10n;
5936  Double_t reQ12nQ5nstarQ5nstarQ2nstar = (dReQ12n*dReQ2n+dImQ12n*dImQ2n)*(pow(dReQ5n,2)-pow(dImQ5n,2)) 
5937                                       + 2.*dReQ5n*dImQ5n*(dImQ12n*dReQ2n-dReQ12n*dImQ2n);
5938  Double_t reQ12nQ10nstarQ2nstar = dReQ12n*dReQ10n*dReQ2n-dReQ12n*dImQ10n*dImQ2n+dImQ12n*dReQ10n*dImQ2n
5939                                 + dImQ12n*dImQ10n*dReQ2n;
5940  // <5>_{5n,2n|3n,3n,1n}: 
5941  Double_t reQ5nQ2nQ3nstarQ3nstarQ1nstar = dReQ1n*dReQ2n*pow(dReQ3n,2.)*dReQ5n + pow(dReQ3n,2.)*dReQ5n*dImQ1n*dImQ2n 
5942                                         - 2.*dReQ2n*dReQ3n*dReQ5n*dImQ1n*dImQ3n + 2.*dReQ1n*dReQ3n*dReQ5n*dImQ2n*dImQ3n 
5943                                         - dReQ1n*dReQ2n*dReQ5n*pow(dImQ3n,2.) - dReQ5n*dImQ1n*dImQ2n*pow(dImQ3n,2.) 
5944                                         + dReQ2n*pow(dReQ3n,2.)*dImQ1n*dImQ5n - dReQ1n*pow(dReQ3n,2.)*dImQ2n*dImQ5n
5945                                         + 2.*dReQ1n*dReQ2n*dReQ3n*dImQ3n*dImQ5n + 2.*dReQ3n*dImQ1n*dImQ2n*dImQ3n*dImQ5n
5946                                         - dReQ2n*dImQ1n*pow(dImQ3n,2.)*dImQ5n + dReQ1n*dImQ2n*pow(dImQ3n,2.)*dImQ5n;
5947  // <5>_{5n,1n,1n|4n,3n}:
5948  Double_t reQ5nQ1nQ1nQ4nstarQ3nstar = pow(dReQ1n,2.)*dReQ3n*dReQ4n*dReQ5n - dReQ3n*dReQ4n*dReQ5n*pow(dImQ1n,2.)
5949                                     + 2.*dReQ1n*dReQ4n*dReQ5n*dImQ1n*dImQ3n + 2.*dReQ1n*dReQ3n*dReQ5n*dImQ1n*dImQ4n
5950                                     - pow(dReQ1n,2.)*dReQ5n*dImQ3n*dImQ4n + dReQ5n*pow(dImQ1n,2.)*dImQ3n*dImQ4n
5951                                     - 2.*dReQ1n*dReQ3n*dReQ4n*dImQ1n*dImQ5n + pow(dReQ1n,2.)*dReQ4n*dImQ3n*dImQ5n
5952                                     - dReQ4n*pow(dImQ1n,2.)*dImQ3n*dImQ5n + pow(dReQ1n,2.)*dReQ3n*dImQ4n*dImQ5n
5953                                     - dReQ3n*pow(dImQ1n,2.)*dImQ4n*dImQ5n + 2.*dReQ1n*dImQ1n*dImQ3n*dImQ4n*dImQ5n;
5954  // <5>_{5n,3n|4n,2n,2n}:
5955  Double_t reQ5nQ3nQ4nstarQ2nstarQ2nstar = dReQ4n*dReQ3n*pow(dReQ2n,2.)*dReQ5n + pow(dReQ2n,2.)*dReQ5n*dImQ4n*dImQ3n 
5956                                         - 2.*dReQ3n*dReQ2n*dReQ5n*dImQ4n*dImQ2n + 2.*dReQ4n*dReQ2n*dReQ5n*dImQ3n*dImQ2n 
5957                                         - dReQ4n*dReQ3n*dReQ5n*pow(dImQ2n,2.) - dReQ5n*dImQ4n*dImQ3n*pow(dImQ2n,2.) 
5958                                         + dReQ3n*pow(dReQ2n,2.)*dImQ4n*dImQ5n - dReQ4n*pow(dReQ2n,2.)*dImQ3n*dImQ5n
5959                                         + 2.*dReQ4n*dReQ3n*dReQ2n*dImQ2n*dImQ5n + 2.*dReQ2n*dImQ4n*dImQ3n*dImQ2n*dImQ5n
5960                                         - dReQ3n*dImQ4n*pow(dImQ2n,2.)*dImQ5n + dReQ4n*dImQ3n*pow(dImQ2n,2.)*dImQ5n;
5961  Double_t reQ8nQ4nstarQ2nstarQ2nstar = (dReQ8n*dReQ4n+dImQ8n*dImQ4n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
5962                                      + 2.*dReQ2n*dImQ2n*(dImQ8n*dReQ4n-dReQ8n*dImQ4n);
5963  // <5>_{5n,2n,1n|4n,4n}:
5964  Double_t reQ5nQ2nQ1nQ4nstarQ4nstar = dReQ1n*dReQ2n*pow(dReQ4n,2.)*dReQ5n - pow(dReQ4n,2.)*dReQ5n*dImQ1n*dImQ2n
5965                                     + 2.*dReQ2n*dReQ4n*dReQ5n*dImQ1n*dImQ4n + 2.*dReQ1n*dReQ4n*dReQ5n*dImQ2n*dImQ4n
5966                                     - dReQ1n*dReQ2n*dReQ5n*pow(dImQ4n,2.) + dReQ5n*dImQ1n*dImQ2n*pow(dImQ4n,2.)
5967                                     - dReQ2n*pow(dReQ4n,2.)*dImQ1n*dImQ5n - dReQ1n*pow(dReQ4n,2.)*dImQ2n*dImQ5n
5968                                     + 2.*dReQ1n*dReQ2n*dReQ4n*dImQ4n*dImQ5n - 2.*dReQ4n*dImQ1n*dImQ2n*dImQ4n*dImQ5n
5969                                     + dReQ2n*dImQ1n*pow(dImQ4n,2.)*dImQ5n + dReQ1n*dImQ2n*pow(dImQ4n,2.)*dImQ5n;
5970  // <5>_{6n,1n|3n,2n,2n}:
5971  Double_t reQ6nQ1nQ3nstarQ2nstarQ2nstar = dReQ3n*dReQ1n*pow(dReQ2n,2.)*dReQ6n + pow(dReQ2n,2.)*dReQ6n*dImQ3n*dImQ1n 
5972                                         - 2.*dReQ1n*dReQ2n*dReQ6n*dImQ3n*dImQ2n + 2.*dReQ3n*dReQ2n*dReQ6n*dImQ1n*dImQ2n 
5973                                         - dReQ3n*dReQ1n*dReQ6n*pow(dImQ2n,2.) - dReQ6n*dImQ3n*dImQ1n*pow(dImQ2n,2.) 
5974                                         + dReQ1n*pow(dReQ2n,2.)*dImQ3n*dImQ6n - dReQ3n*pow(dReQ2n,2.)*dImQ1n*dImQ6n
5975                                         + 2.*dReQ3n*dReQ1n*dReQ2n*dImQ2n*dImQ6n + 2.*dReQ2n*dImQ3n*dImQ1n*dImQ2n*dImQ6n
5976                                         - dReQ1n*dImQ3n*pow(dImQ2n,2.)*dImQ6n + dReQ3n*dImQ1n*pow(dImQ2n,2.)*dImQ6n;
5977
5978  // <5>_{6n,3n|4n,4n,1n}:
5979  Double_t reQ6nQ3nQ4nstarQ4nstarQ1nstar = dReQ1n*dReQ3n*pow(dReQ4n,2.)*dReQ6n + pow(dReQ4n,2.)*dReQ6n*dImQ1n*dImQ3n 
5980                                         - 2.*dReQ3n*dReQ4n*dReQ6n*dImQ1n*dImQ4n + 2.*dReQ1n*dReQ4n*dReQ6n*dImQ3n*dImQ4n 
5981                                         - dReQ1n*dReQ3n*dReQ6n*pow(dImQ4n,2.) - dReQ6n*dImQ1n*dImQ3n*pow(dImQ4n,2.) 
5982                                         + dReQ3n*pow(dReQ4n,2.)*dImQ1n*dImQ6n - dReQ1n*pow(dReQ4n,2.)*dImQ3n*dImQ6n
5983                                         + 2.*dReQ1n*dReQ3n*dReQ4n*dImQ4n*dImQ6n + 2.*dReQ4n*dImQ1n*dImQ3n*dImQ4n*dImQ6n
5984                                         - dReQ3n*dImQ1n*pow(dImQ4n,2.)*dImQ6n + dReQ1n*dImQ3n*pow(dImQ4n,2.)*dImQ6n;
5985
5986  // five6n1n1n5n3n = 0.; // <5>_{6n,1n,1n|5n,3n} = <cos(n(6*phi1+1*phi2+1*phi3-5*phi4-3*phi5))>
5987  Double_t reQ6nQ1nQ1nQ5nstarQ3nstar = pow(dReQ1n,2.)*dReQ3n*dReQ5n*dReQ6n - dReQ3n*dReQ5n*dReQ6n*pow(dImQ1n,2.)
5988                                     + 2.*dReQ1n*dReQ5n*dReQ6n*dImQ1n*dImQ3n + 2.*dReQ1n*dReQ3n*dReQ6n*dImQ1n*dImQ5n
5989                                     - pow(dReQ1n,2.)*dReQ6n*dImQ3n*dImQ5n + dReQ6n*pow(dImQ1n,2.)*dImQ3n*dImQ5n
5990                                     - 2.*dReQ1n*dReQ3n*dReQ5n*dImQ1n*dImQ6n + pow(dReQ1n,2.)*dReQ5n*dImQ3n*dImQ6n
5991                                     - dReQ5n*pow(dImQ1n,2.)*dImQ3n*dImQ6n + pow(dReQ1n,2.)*dReQ3n*dImQ5n*dImQ6n
5992                                     - dReQ3n*pow(dImQ1n,2.)*dImQ5n*dImQ6n + 2.*dReQ1n*dImQ1n*dImQ3n*dImQ5n*dImQ6n;
5993
5994  // <5>_{6n,3n|5n,2n,2n}:
5995  Double_t reQ6nQ3nQ5nstarQ2nstarQ2nstar = dReQ5n*dReQ3n*pow(dReQ2n,2.)*dReQ6n + pow(dReQ2n,2.)*dReQ6n*dImQ5n*dImQ3n 
5996                                         - 2.*dReQ3n*dReQ2n*dReQ6n*dImQ5n*dImQ2n + 2.*dReQ5n*dReQ2n*dReQ6n*dImQ3n*dImQ2n 
5997                                         - dReQ5n*dReQ3n*dReQ6n*pow(dImQ2n,2.) - dReQ6n*dImQ5n*dImQ3n*pow(dImQ2n,2.) 
5998                                         + dReQ3n*pow(dReQ2n,2.)*dImQ5n*dImQ6n - dReQ5n*pow(dReQ2n,2.)*dImQ3n*dImQ6n
5999                                         + 2.*dReQ5n*dReQ3n*dReQ2n*dImQ2n*dImQ6n + 2.*dReQ2n*dImQ5n*dImQ3n*dImQ2n*dImQ6n
6000                                         - dReQ3n*dImQ5n*pow(dImQ2n,2.)*dImQ6n + dReQ5n*dImQ3n*pow(dImQ2n,2.)*dImQ6n;
6001
6002  // <5>_{6n,5n|4n,4n,3n}:
6003  Double_t reQ6nQ5nQ4nstarQ4nstarQ3nstar = dReQ3n*dReQ5n*pow(dReQ4n,2.)*dReQ6n + pow(dReQ4n,2.)*dReQ6n*dImQ3n*dImQ5n 
6004                                         - 2.*dReQ5n*dReQ4n*dReQ6n*dImQ3n*dImQ4n + 2.*dReQ3n*dReQ4n*dReQ6n*dImQ5n*dImQ4n 
6005                                         - dReQ3n*dReQ5n*dReQ6n*pow(dImQ4n,2.) - dReQ6n*dImQ3n*dImQ5n*pow(dImQ4n,2.) 
6006                                         + dReQ5n*pow(dReQ4n,2.)*dImQ3n*dImQ6n - dReQ3n*pow(dReQ4n,2.)*dImQ5n*dImQ6n
6007                                         + 2.*dReQ3n*dReQ5n*dReQ4n*dImQ4n*dImQ6n + 2.*dReQ4n*dImQ3n*dImQ5n*dImQ4n*dImQ6n
6008                                         - dReQ5n*dImQ3n*pow(dImQ4n,2.)*dImQ6n + dReQ3n*dImQ5n*pow(dImQ4n,2.)*dImQ6n;
6009  Double_t reQ11nQ4nstarQ4nstarQ3nstar = (dReQ11n*dReQ3n+dImQ11n*dImQ3n)*(pow(dReQ4n,2)-pow(dImQ4n,2)) 
6010                                       + 2.*dReQ4n*dImQ4n*(dImQ11n*dReQ3n-dReQ11n*dImQ3n);
6011
6012  // <5>_{6n,3n,1n|5n,5n}:
6013  Double_t reQ6nQ3nQ1nQ5nstarQ5nstar = dReQ1n*dReQ3n*pow(dReQ5n,2.)*dReQ6n - pow(dReQ5n,2.)*dReQ6n*dImQ1n*dImQ3n
6014                                     + 2.*dReQ3n*dReQ5n*dReQ6n*dImQ1n*dImQ5n + 2.*dReQ1n*dReQ5n*dReQ6n*dImQ3n*dImQ5n
6015                                     - dReQ1n*dReQ3n*dReQ6n*pow(dImQ5n,2.) + dReQ6n*dImQ1n*dImQ3n*pow(dImQ5n,2.)
6016                                     - dReQ3n*pow(dReQ5n,2.)*dImQ1n*dImQ6n - dReQ1n*pow(dReQ5n,2.)*dImQ3n*dImQ6n
6017                                     + 2.*dReQ1n*dReQ3n*dReQ5n*dImQ5n*dImQ6n - 2.*dReQ5n*dImQ1n*dImQ3n*dImQ5n*dImQ6n
6018                                     + dReQ3n*dImQ1n*pow(dImQ5n,2.)*dImQ6n + dReQ1n*dImQ3n*pow(dImQ5n,2.)*dImQ6n;
6019
6020  // <5>_{6n,6n|5n,4n,3n}:
6021  Double_t reQ6nQ6nQ5nstarQ4nstarQ3nstar = dReQ3n*dReQ4n*dReQ5n*pow(dReQ6n,2.) - dReQ5n*pow(dReQ6n,2.)*dImQ3n*dImQ4n
6022                                         - dReQ4n*pow(dReQ6n,2.)*dImQ3n*dImQ5n - dReQ3n*pow(dReQ6n,2.)*dImQ4n*dImQ5n
6023                                         + 2.*dReQ4n*dReQ5n*dReQ6n*dImQ3n*dImQ6n + 2.*dReQ3n*dReQ5n*dReQ6n*dImQ4n*dImQ6n
6024                                         + 2.*dReQ3n*dReQ4n*dReQ6n*dImQ5n*dImQ6n - 2.*dReQ6n*dImQ3n*dImQ4n*dImQ5n*dImQ6n
6025                                         - dReQ3n*dReQ4n*dReQ5n*pow(dImQ6n,2.) + dReQ5n*dImQ3n*dImQ4n*pow(dImQ6n,2.)
6026                                         + dReQ4n*dImQ3n*dImQ5n*pow(dImQ6n,2.) + dReQ3n*dImQ4n*dImQ5n*pow(dImQ6n,2.);
6027
6028
6029  Double_t reQ8nQ4nQ6nstarQ6nstar = dImQ4n*pow(dImQ6n,2.)*dImQ8n+2.*dImQ6n*dImQ8n*dReQ4n*dReQ6n
6030                                  - dImQ4n*dImQ8n*pow(dReQ6n,2.)-pow(dImQ6n,2.)*dReQ4n*dReQ8n 
6031                                  + 2.*dImQ4n*dImQ6n*dReQ6n*dReQ8n+dReQ4n*pow(dReQ6n,2.)*dReQ8n;
6032
6033
6034  Double_t reQ9nQ3nQ6nstarQ6nstar = dImQ3n*pow(dImQ6n,2.)*dImQ9n+2.*dImQ6n*dImQ9n*dReQ3n*dReQ6n
6035                                  - dImQ3n*dImQ9n*pow(dReQ6n,2.)-pow(dImQ6n,2.)*dReQ3n*dReQ9n 
6036                                  + 2.*dImQ3n*dImQ6n*dReQ6n*dReQ9n+dReQ3n*pow(dReQ6n,2.)*dReQ9n;
6037
6038
6039  Double_t reQ12nQ5nstarQ4nstarQ3nstar = dReQ3n*dReQ5n*dReQ4n*dReQ12n-dReQ4n*dReQ12n*dImQ3n*dImQ5n 
6040                                       - dReQ5n*dReQ12n*dImQ3n*dImQ4n-dReQ3n*dReQ12n*dImQ5n*dImQ4n 
6041                                       + dReQ5n*dReQ4n*dImQ3n*dImQ12n+dReQ3n*dReQ4n*dImQ5n*dImQ12n 
6042                                       + dReQ3n*dReQ5n*dImQ4n*dImQ12n-dImQ3n*dImQ5n*dImQ4n*dImQ12n;
6043  Double_t reQ12nQ9nstarQ3nstar = dReQ12n*dReQ9n*dReQ3n-dReQ12n*dImQ9n*dImQ3n+dImQ12n*dReQ9n*dImQ3n
6044                                + dImQ12n*dImQ9n*dReQ3n;
6045  Double_t reQ12nQ8nstarQ4nstar = dReQ12n*dReQ8n*dReQ4n-dReQ12n*dImQ8n*dImQ4n+dImQ12n*dReQ8n*dImQ4n
6046                                + dImQ12n*dImQ8n*dReQ4n;
6047
6048    
6049   five4n3n3n2n2n = ((pow(dReQ3n,2.)+pow(dImQ3n,2.))
6050                  * (pow(dReQ2n,2.)*dReQ4n-pow(dImQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n)
6051                  - ((dReQ7n*dReQ3n+dImQ7n*dImQ3n)*(pow(dReQ2n,2.)-pow(dImQ2n,2.)) 
6052                  + 2.*dReQ2n*dImQ2n*(dImQ7n*dReQ3n-dReQ7n*dImQ3n))
6053                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
6054                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
6055                  - 2.*(dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
6056                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
6057                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
6058                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
6059                  - 2.*(dImQ2n*dImQ3n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ2n*dReQ3n 
6060                  + dImQ3n*dImQ5n*dReQ2n*dReQ4n-dImQ2n*dImQ5n*dReQ3n*dReQ4n
6061                  - dImQ3n*dImQ4n*dReQ2n*dReQ5n+dImQ2n*dImQ4n*dReQ3n*dReQ5n 
6062                  + dImQ2n*dImQ3n*dReQ4n*dReQ5n+dReQ2n*dReQ3n*dReQ4n*dReQ5n)
6063                  + 2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
6064                  + 1.*(dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
6065                  + 3.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
6066                  + 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
6067                  + 2.*(dReQ7n*dReQ5n*dReQ2n-dReQ7n*dImQ5n*dImQ2n+dImQ7n*dReQ5n*dImQ2n+dImQ7n*dImQ5n*dReQ2n)
6068                  + 2.*(dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
6069                  + 6.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6070                  + 6.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
6071                  - (dMult-6.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
6072                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6073                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6074                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6075                  - 4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6076                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6077                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6078                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6079                  + 2.*(dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6080                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6081                  - 2.*dMult*(dMult-12.)) 
6082                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6083   five4n2n4n1n1n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))
6084                  * (pow(dReQ1n,2.)*dReQ2n-pow(dImQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n)
6085                  - reQ6nQ4nstarQ1nstarQ1nstar
6086                  - reQ4nQ2nstarQ1nstarQ1nstar
6087                  - 2.*reQ4nQ1nQ3nstarQ2nstar
6088                  - 2.*reQ5nQ1nQ4nstarQ2nstar
6089                  + 2.*reQ3nQ2nstarQ1nstar
6090                  + reQ6nQ4nstarQ2nstar
6091                  + 3.*reQ4nQ2nstarQ2nstar
6092                  + 2.*reQ5nQ3nstarQ2nstar
6093                  + 2.*reQ6nQ5nstarQ1nstar
6094                  + 2.*reQ6nQ4nstarQ2nstar
6095                  + 6.*reQ4nQ3nstarQ1nstar
6096                  + 6.*reQ5nQ4nstarQ1nstar
6097                  - (dMult-6.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
6098                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6099                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6100                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6101                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6102                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6103                  + 2.*(dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6104                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
6105                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6106   // to be polished:
6107   five4n3n4n2n1n = (reQ4nQ3nQ4nstarQ2nstarQ1nstar
6108                  - reQ5nQ2nQ4nstarQ3nstar
6109                  - reQ6nQ1nQ4nstarQ3nstar
6110                  - reQ4nQ1nQ3nstarQ2nstar
6111                  - reQ7nQ4nstarQ2nstarQ1nstar
6112                  - reQ4nQ2nstarQ1nstarQ1nstar
6113                  - reQ4nQ2nQ3nstarQ3nstar
6114                  + reQ4nQ3nstarQ1nstar
6115                  + reQ7nQ4nstarQ3nstar
6116                  + 3.*reQ4nQ3nstarQ1nstar
6117                  + 2.*reQ7nQ4nstarQ3nstar
6118                  + reQ5nQ3nstarQ2nstar
6119                  + reQ7nQ5nstarQ2nstar
6120                  + reQ6nQ3nstarQ3nstar
6121                  + reQ4nQ3nstarQ1nstar
6122                  + reQ7nQ6nstarQ1nstar
6123                  + reQ2nQ1nstarQ1nstar
6124                  - (dMult-6.)*reQ3nQ2nstarQ1nstar
6125                  + 3.*reQ5nQ4nstarQ1nstar
6126                  + reQ4nQ3nstarQ1nstar
6127                  + 2.*reQ4nQ2nstarQ2nstar
6128                  + 3.*reQ6nQ4nstarQ2nstar
6129                  + reQ3nQ2nstarQ1nstar
6130                  + reQ4nQ2nstarQ2nstar
6131                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6132                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6133                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6134                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6135                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6136                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
6137                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6138                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6139                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6140                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6141                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6142                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6143                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
6144                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6145   five5n1n3n2n1n = ((pow(dImQ1n,2.)+pow(dReQ1n,2.))*(dImQ3n*dImQ5n*dReQ2n+dImQ2n*dImQ5n*dReQ3n 
6146                  - dImQ2n*dImQ3n*dReQ5n+dReQ2n*dReQ3n*dReQ5n)
6147                  - (dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
6148                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
6149                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
6150                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
6151                  - (dImQ1n*dImQ2n*dImQ4n*dImQ5n+dImQ4n*dImQ5n*dReQ1n*dReQ2n 
6152                  + dImQ2n*dImQ5n*dReQ1n*dReQ4n-dImQ1n*dImQ5n*dReQ2n*dReQ4n
6153                  - dImQ2n*dImQ4n*dReQ1n*dReQ5n+dImQ1n*dImQ4n*dReQ2n*dReQ5n 
6154                  + dImQ1n*dImQ2n*dReQ4n*dReQ5n+dReQ1n*dReQ2n*dReQ4n*dReQ5n)
6155                  - (dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
6156                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
6157                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n)
6158                  - (dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
6159                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
6160                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
6161                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
6162                  - (-pow(dImQ1n,2.)*dImQ3n*dImQ5n+dImQ3n*dImQ5n*pow(dReQ1n,2.)
6163                  + 2.*dImQ1n*dImQ5n*dReQ1n*dReQ3n-2.*dImQ1n*dImQ3n*dReQ1n*dReQ5n 
6164                  - pow(dImQ1n,2.)*dReQ3n*dReQ5n+pow(dReQ1n,2.)*dReQ3n*dReQ5n)
6165                  - (-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
6166                  + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
6167                  - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n)
6168                  + 3.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
6169                  + dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n
6170                  + pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n
6171                  + 4.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
6172                  - (dMult-7.)*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
6173                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
6174                  + pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n
6175                  + 6.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6176                  + 3.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
6177                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6178                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6179                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6180                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+(dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))  
6181                  - 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6182                  + (dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*(dMult-7.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6183                  - 2.*dMult*(dMult-12.))
6184                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
6185   // to be polished:
6186   five5n2n5n1n1n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))
6187                  * (pow(dReQ1n,2.)*dReQ2n-pow(dImQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n)
6188                  - reQ7nQ5nstarQ1nstarQ1nstar
6189                  - reQ5nQ3nstarQ1nstarQ1nstar
6190                  - 2.*reQ5nQ1nQ4nstarQ2nstar
6191                  - 2.*reQ6nQ1nQ5nstarQ2nstar
6192                  + 2.*reQ4nQ3nstarQ1nstar
6193                  + reQ7nQ5nstarQ2nstar
6194                  + 3.*reQ5nQ3nstarQ2nstar
6195                  + 2.*reQ6nQ4nstarQ2nstar
6196                  + 2.*reQ7nQ6nstarQ1nstar
6197                  + 2.*reQ7nQ5nstarQ2nstar
6198                  + 6.*reQ5nQ4nstarQ1nstar
6199                  + 6.*reQ6nQ5nstarQ1nstar
6200                  - (dMult-6.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
6201                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6202                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6203                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))-4.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6204                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6205                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6206                  + 2.*(dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6207                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
6208                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6209   // to be polished:
6210   five5n2n4n2n1n = (reQ5nQ2nQ4nstarQ2nstarQ1nstar
6211                  - reQ5nQ2nQ4nstarQ3nstar
6212                  - reQ6nQ1nQ5nstarQ2nstar
6213                  - reQ5nQ2nstarQ2nstarQ1nstar
6214                  - reQ7nQ4nstarQ2nstarQ1nstar
6215                  - reQ4nQ1nQ3nstarQ2nstar
6216                  - reQ5nQ1nQ4nstarQ2nstar
6217                  + reQ2nQ1nstarQ1nstar
6218                  + reQ7nQ5nstarQ2nstar
6219                  + 3.*reQ5nQ3nstarQ2nstar
6220                  + 2.*reQ7nQ5nstarQ2nstar
6221                  + reQ5nQ3nstarQ2nstar
6222                  + reQ7nQ4nstarQ3nstar
6223                  + reQ6nQ5nstarQ1nstar
6224                  + reQ2nQ1nstarQ1nstar
6225                  + reQ7nQ6nstarQ1nstar
6226                  + reQ3nQ2nstarQ1nstar
6227                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
6228                  + 3.*reQ3nQ2nstarQ1nstar
6229                  + reQ2nQ1nstarQ1nstar
6230                  + 2.*reQ4nQ2nstarQ2nstar
6231                  + 3.*reQ6nQ4nstarQ2nstar
6232                  + reQ4nQ3nstarQ1nstar
6233                  + reQ4nQ2nstarQ2nstar
6234                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6235                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6236                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6237                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6238                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6239                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6240                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6241                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6242                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6243                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6244                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6245                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6246                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.)) 
6247                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6248   // to be polished: 
6249   five5n3n4n3n1n = (reQ5nQ3nQ4nstarQ3nstarQ1nstar
6250                  - reQ5nQ3nQ4nstarQ4nstar
6251                  - reQ7nQ1nQ5nstarQ3nstar
6252                  - reQ5nQ3nstarQ1nstarQ1nstar
6253                  - reQ8nQ4nstarQ3nstarQ1nstar
6254                  - reQ4nQ1nQ3nstarQ2nstar
6255                  - reQ5nQ2nQ4nstarQ3nstar
6256                  + reQ3nQ2nstarQ1nstar
6257                  + reQ8nQ5nstarQ3nstar
6258                  + 3.*reQ5nQ3nstarQ2nstar
6259                  + 2.*reQ8nQ5nstarQ3nstar
6260                  + reQ5nQ4nstarQ1nstar
6261                  + reQ8nQ4nstarQ4nstar
6262                  + reQ7nQ5nstarQ2nstar
6263                  + reQ3nQ2nstarQ1nstar
6264                  + reQ8nQ7nstarQ1nstar
6265                  + reQ2nQ1nstarQ1nstar
6266                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
6267                  + 3.*reQ4nQ3nstarQ1nstar
6268                  + reQ3nQ2nstarQ1nstar
6269                  + 2.*reQ4nQ3nstarQ1nstar
6270                  + 3.*reQ7nQ4nstarQ3nstar
6271                  + reQ4nQ2nstarQ2nstar
6272                  + reQ4nQ3nstarQ1nstar
6273                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6274                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6275                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6276                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
6277                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6278                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6279                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6280                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6281                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6282                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6283                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6284                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6285                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
6286                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6287   // to be polished: 
6288   five5n4n4n3n2n = (reQ5nQ4nQ4nstarQ3nstarQ2nstar
6289                  - reQ6nQ3nQ5nstarQ4nstar
6290                  - reQ7nQ2nQ5nstarQ4nstar
6291                  - reQ5nQ1nQ4nstarQ2nstar
6292                  - reQ9nQ4nstarQ3nstarQ2nstar
6293                  - reQ4nQ1nQ3nstarQ2nstar
6294                  - reQ5nQ2nQ4nstarQ3nstar
6295                  + reQ4nQ2nstarQ2nstar
6296                  + reQ9nQ5nstarQ4nstar
6297                  + 3.*reQ5nQ4nstarQ1nstar
6298                  + 2.*reQ9nQ5nstarQ4nstar
6299                  + reQ6nQ5nstarQ1nstar
6300                  + reQ9nQ6nstarQ3nstar
6301                  + reQ7nQ5nstarQ2nstar
6302                  + reQ4nQ2nstarQ2nstar
6303                  + reQ9nQ7nstarQ2nstar
6304                  + reQ2nQ1nstarQ1nstar
6305                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
6306                  + 3.*reQ6nQ4nstarQ2nstar
6307                  + reQ4nQ2nstarQ2nstar
6308                  + 2.*reQ4nQ3nstarQ1nstar
6309                  + 3.*reQ7nQ4nstarQ3nstar
6310                  + reQ3nQ2nstarQ1nstar
6311                  + reQ4nQ3nstarQ1nstar
6312                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6313                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6314                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6315                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
6316                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6317                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6318                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6319                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6320                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6321                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6322                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6323                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6324                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
6325                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6326   // to be polished: 
6327   five5n3n5n2n1n = (reQ5nQ3nQ5nstarQ2nstarQ1nstar
6328                  - reQ6nQ2nQ5nstarQ3nstar
6329                  - reQ7nQ1nQ5nstarQ3nstar
6330                  - reQ5nQ1nQ3nstarQ3nstar
6331                  - reQ8nQ5nstarQ2nstarQ1nstar
6332                  - reQ5nQ2nstarQ2nstarQ1nstar
6333                  - reQ5nQ2nQ4nstarQ3nstar
6334                  + reQ5nQ4nstarQ1nstar
6335                  + reQ8nQ5nstarQ3nstar
6336                  + 3.*reQ5nQ3nstarQ2nstar
6337                  + 2.*reQ8nQ5nstarQ3nstar
6338                  + reQ6nQ3nstarQ3nstar
6339                  + reQ8nQ6nstarQ2nstar
6340                  + reQ7nQ4nstarQ3nstar
6341                  + reQ5nQ4nstarQ1nstar
6342                  + reQ8nQ7nstarQ1nstar
6343                  + reQ3nQ2nstarQ1nstar
6344                  - (dMult-6.)*reQ3nQ2nstarQ1nstar
6345                  + 3.*reQ6nQ5nstarQ1nstar
6346                  + reQ5nQ4nstarQ1nstar
6347                  + 2.*reQ5nQ3nstarQ2nstar
6348                  + 3.*reQ7nQ5nstarQ2nstar
6349                  + reQ4nQ2nstarQ2nstar
6350                  + reQ5nQ3nstarQ2nstar
6351                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6352                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6353                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6354                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
6355                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6356                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6357                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6358                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6359                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6360                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6361                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6362                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6363                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
6364                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6365   // to be polished:
6366   five5n4n5n2n2n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))
6367                  * (pow(dReQ2n,2.)*dReQ4n-pow(dImQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n)
6368                  - reQ9nQ5nstarQ2nstarQ2nstar
6369                  - reQ5nQ2nstarQ2nstarQ1nstar
6370                  - 2.*reQ5nQ2nQ4nstarQ3nstar
6371                  - 2.*reQ7nQ2nQ5nstarQ4nstar
6372                  + 2.*reQ3nQ2nstarQ1nstar
6373                  + reQ9nQ5nstarQ4nstar
6374                  + 3.*reQ5nQ4nstarQ1nstar
6375                  + 2.*reQ7nQ4nstarQ3nstar
6376                  + 2.*reQ9nQ7nstarQ2nstar
6377                  + 2.*reQ9nQ5nstarQ4nstar
6378                  + 6.*reQ5nQ3nstarQ2nstar
6379                  + 6.*reQ7nQ5nstarQ2nstar
6380                  - (dMult-6.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
6381                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6382                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6383                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))-4.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6384                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6385                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6386                  + 2.*(dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6387                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
6388                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6389   // to be polished:
6390   five5n4n5n3n1n = (reQ5nQ4nQ5nstarQ3nstarQ1nstar
6391                  - reQ6nQ3nQ5nstarQ4nstar
6392                  - reQ8nQ1nQ5nstarQ4nstar
6393                  - reQ5nQ1nQ4nstarQ2nstar
6394                  - reQ9nQ5nstarQ3nstarQ1nstar
6395                  - reQ5nQ3nstarQ1nstarQ1nstar
6396                  - reQ5nQ3nQ4nstarQ4nstar
6397                  + reQ5nQ4nstarQ1nstar
6398                  + reQ9nQ5nstarQ4nstar
6399                  + 3.*reQ5nQ4nstarQ1nstar
6400                  + 2.*reQ9nQ5nstarQ4nstar
6401                  + reQ6nQ4nstarQ2nstar
6402                  + reQ9nQ6nstarQ3nstar
6403                  + reQ8nQ4nstarQ4nstar
6404                  + reQ5nQ4nstarQ1nstar
6405                  + reQ9nQ8nstarQ1nstar
6406                  + reQ2nQ1nstarQ1nstar
6407                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
6408                  + 3.*reQ6nQ5nstarQ1nstar
6409                  + reQ5nQ4nstarQ1nstar
6410                  + 2.*reQ5nQ3nstarQ2nstar
6411                  + 3.*reQ8nQ5nstarQ3nstar
6412                  + reQ4nQ3nstarQ1nstar
6413                  + reQ5nQ3nstarQ2nstar
6414                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6415                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6416                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6417                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
6418                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6419                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
6420                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6421                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
6422                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6423                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6424                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6425                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6426                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
6427                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
6428   five6n1n3n3n1n = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))
6429                  * (pow(dReQ3n,2.)*dReQ6n-pow(dImQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n)
6430                  - 2.*(dImQ1n*dImQ3n*dImQ4n*dImQ6n+dImQ4n*dImQ6n*dReQ1n*dReQ3n 
6431                  + dImQ3n*dImQ6n*dReQ1n*dReQ4n-dImQ1n*dImQ6n*dReQ3n*dReQ4n
6432                  - dImQ3n*dImQ4n*dReQ1n*dReQ6n+dImQ1n*dImQ4n*dReQ3n*dReQ6n 
6433                  + dImQ1n*dImQ3n*dReQ4n*dReQ6n+dReQ1n*dReQ3n*dReQ4n*dReQ6n)   
6434                  - 2.*(dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
6435                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
6436                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
6437                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
6438                  - (-pow(dImQ3n,2.)*dImQ1n*dImQ7n+dImQ1n*dImQ7n*pow(dReQ3n,2.)
6439                  + 2.*dImQ3n*dImQ7n*dReQ3n*dReQ1n-2.*dImQ3n*dImQ1n*dReQ3n*dReQ7n 
6440                  - pow(dImQ3n,2.)*dReQ1n*dReQ7n+pow(dReQ3n,2.)*dReQ1n*dReQ7n)
6441                  - ((pow(dReQ3n,2.)-pow(dImQ3n,2.))*(dReQ5n*dReQ1n-dImQ5n*dImQ1n) 
6442                  + 2.*dReQ3n*dImQ3n*(dReQ5n*dImQ1n+dImQ5n*dReQ1n))
6443                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6444                  + (dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
6445                  + 2.*(dReQ7n*dReQ3n*dReQ4n-dReQ7n*dImQ3n*dImQ4n+dImQ7n*dReQ3n*dImQ4n+dImQ7n*dImQ3n*dReQ4n)
6446                  + 2.*(dReQ6n*(dReQ4n*dReQ2n-dImQ4n*dImQ2n)+dImQ6n*(dReQ4n*dImQ2n+dImQ4n*dReQ2n))
6447                  + 3.*(dReQ6n*(dReQ5n*dReQ1n-dImQ5n*dImQ1n)+dImQ6n*(dReQ5n*dImQ1n+dImQ5n*dReQ1n))
6448                  + 4.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6449                  + 2.*(dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
6450                  + 6.*(dReQ4n*dReQ3n*dReQ1n-dReQ4n*dImQ3n*dImQ1n+dImQ4n*dReQ3n*dImQ1n+dImQ4n*dImQ3n*dReQ1n)
6451                  + 2.*(dReQ5n*dReQ3n*dReQ2n-dReQ5n*dImQ3n*dImQ2n+dImQ5n*dReQ3n*dImQ2n+dImQ5n*dImQ3n*dReQ2n)
6452                  - (dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
6453                  - 4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6454                  - 4.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6455                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6456                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6457                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6458                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))+(dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6459                  + 2.*(dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.))
6460                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6461   five6n2n3n3n2n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))
6462                  * (pow(dReQ3n,2.)*dReQ6n-pow(dImQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n)
6463                  - 2.*(dImQ2n*dImQ3n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ2n*dReQ3n 
6464                  + dImQ3n*dImQ6n*dReQ2n*dReQ5n-dImQ2n*dImQ6n*dReQ3n*dReQ5n
6465                  - dImQ3n*dImQ5n*dReQ2n*dReQ6n+dImQ2n*dImQ5n*dReQ3n*dReQ6n 
6466                  + dImQ2n*dImQ3n*dReQ5n*dReQ6n+dReQ2n*dReQ3n*dReQ5n*dReQ6n) 
6467                  - 2.*(dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
6468                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
6469                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
6470                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
6471                  - (-pow(dImQ3n,2.)*dImQ2n*dImQ8n+dImQ2n*dImQ8n*pow(dReQ3n,2.)
6472                  + 2.*dImQ3n*dImQ8n*dReQ3n*dReQ2n-2.*dImQ3n*dImQ2n*dReQ3n*dReQ8n 
6473                  - pow(dImQ3n,2.)*dReQ2n*dReQ8n+pow(dReQ3n,2.)*dReQ2n*dReQ8n)
6474                  - ((pow(dReQ3n,2.)-pow(dImQ3n,2.))*(dReQ4n*dReQ2n-dImQ4n*dImQ2n) 
6475                  + 2.*dReQ3n*dImQ3n*(dReQ4n*dImQ2n+dImQ4n*dReQ2n))
6476                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6477                  + (dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n+dImQ8n*dImQ6n*dReQ2n)
6478                  + 2.*(dReQ8n*dReQ3n*dReQ5n-dReQ8n*dImQ3n*dImQ5n+dImQ8n*dReQ3n*dImQ5n+dImQ8n*dImQ3n*dReQ5n)
6479                  + 2.*(dReQ6n*(dReQ5n*dReQ1n-dImQ5n*dImQ1n)+dImQ6n*(dReQ5n*dImQ1n+dImQ5n*dReQ1n))
6480                  + 3.*(dReQ6n*(dReQ4n*dReQ2n-dImQ4n*dImQ2n)+dImQ6n*(dReQ4n*dImQ2n+dImQ4n*dReQ2n))
6481                  + 4.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6482                  + 2.*(dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n+dImQ8n*dImQ6n*dReQ2n)
6483                  + 6.*(dReQ5n*dReQ3n*dReQ2n-dReQ5n*dImQ3n*dImQ2n+dImQ5n*dReQ3n*dImQ2n+dImQ5n*dImQ3n*dReQ2n)
6484                  + 2.*(dReQ4n*dReQ3n*dReQ1n-dReQ4n*dImQ3n*dImQ1n+dImQ4n*dReQ3n*dImQ1n+dImQ4n*dImQ3n*dReQ1n)
6485                  - (dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
6486                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
6487                  - 4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6488                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6489                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6490                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6491                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+(dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6492                  + 2.*(dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.))
6493                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6494   // to be polished:
6495   five6n1n4n2n1n = (reQ6nQ1nQ4nstarQ2nstarQ1nstar
6496                  - reQ6nQ1nQ4nstarQ3nstar
6497                  - reQ6nQ1nQ5nstarQ2nstar
6498                  - reQ6nQ3nstarQ2nstarQ1nstar
6499                  - reQ7nQ4nstarQ2nstarQ1nstar
6500                  - reQ5nQ1nQ4nstarQ2nstar
6501                  - reQ6nQ4nstarQ1nstarQ1nstar
6502                  + reQ2nQ1nstarQ1nstar
6503                  + reQ7nQ6nstarQ1nstar
6504                  + 3.*reQ6nQ5nstarQ1nstar
6505                  + 2.*reQ7nQ6nstarQ1nstar
6506                  + reQ6nQ3nstarQ3nstar
6507                  + reQ7nQ4nstarQ3nstar
6508                  + reQ6nQ5nstarQ1nstar
6509                  + reQ2nQ1nstarQ1nstar
6510                  + reQ7nQ5nstarQ2nstar
6511                  + reQ5nQ3nstarQ2nstar
6512                  - (dMult-6.)*reQ6nQ4nstarQ2nstar
6513                  + 3.*reQ3nQ2nstarQ1nstar
6514                  + reQ2nQ1nstarQ1nstar
6515                  + 2.*reQ4nQ3nstarQ1nstar
6516                  + 3.*reQ5nQ4nstarQ1nstar
6517                  + reQ5nQ4nstarQ1nstar
6518                  + reQ4nQ3nstarQ1nstar
6519                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6520                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6521                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6522                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6523                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6524                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6525                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6526                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
6527                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6528                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6529                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6530                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6531                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.)) 
6532                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
6533   // to be polished: 
6534   five6n3n4n3n2n = (reQ6nQ3nQ4nstarQ3nstarQ2nstar
6535                  - reQ6nQ3nQ5nstarQ4nstar
6536                  - reQ7nQ2nQ6nstarQ3nstar
6537                  - reQ6nQ3nstarQ2nstarQ1nstar
6538                  - reQ9nQ4nstarQ3nstarQ2nstar
6539                  - reQ4nQ2nQ3nstarQ3nstar
6540                  - reQ6nQ1nQ4nstarQ3nstar
6541                  + reQ3nQ2nstarQ1nstar
6542                  + reQ9nQ6nstarQ3nstar
6543                  + 3.*reQ6nQ3nstarQ3nstar
6544                  + 2.*reQ9nQ6nstarQ3nstar
6545                  + reQ6nQ5nstarQ1nstar
6546                  + reQ9nQ5nstarQ4nstar
6547                  + reQ7nQ6nstarQ1nstar
6548                  + reQ3nQ2nstarQ1nstar
6549                  + reQ9nQ7nstarQ2nstar
6550                  + reQ3nQ2nstarQ1nstar
6551                  - (dMult-6.)*reQ6nQ4nstarQ2nstar
6552                  + 3.*reQ5nQ3nstarQ2nstar
6553                  + reQ3nQ2nstarQ1nstar
6554                  + 2.*reQ4nQ3nstarQ1nstar
6555                  + 3.*reQ7nQ4nstarQ3nstar
6556                  + reQ4nQ3nstarQ1nstar
6557                  + reQ4nQ3nstarQ1nstar
6558                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6559                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6560                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6561                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
6562                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6563                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
6564                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6565                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6566                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6567                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6568                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6569                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6570                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
6571                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6572   five6n4n4n3n3n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))
6573                  * (pow(dReQ3n,2.)*dReQ6n-pow(dImQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n)
6574                  - ((dReQ10n*dReQ4n+dImQ10n*dImQ4n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
6575                  + 2.*dReQ3n*dImQ3n*(dImQ10n*dReQ4n-dReQ10n*dImQ4n))
6576                  - ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
6577                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n)
6578                  - 2.*(dImQ1n*dImQ3n*dImQ4n*dImQ6n+dImQ4n*dImQ6n*dReQ1n*dReQ3n 
6579                  + dImQ3n*dImQ6n*dReQ1n*dReQ4n-dImQ1n*dImQ6n*dReQ3n*dReQ4n
6580                  - dImQ3n*dImQ4n*dReQ1n*dReQ6n+dImQ1n*dImQ4n*dReQ3n*dReQ6n 
6581                  + dImQ1n*dImQ3n*dReQ4n*dReQ6n+dReQ1n*dReQ3n*dReQ4n*dReQ6n)
6582                  - 2.*(dImQ3n*dImQ4n*dImQ6n*dImQ7n+dImQ6n*dImQ7n*dReQ3n*dReQ4n 
6583                  + dImQ4n*dImQ7n*dReQ3n*dReQ6n-dImQ3n*dImQ7n*dReQ4n*dReQ6n
6584                  - dImQ4n*dImQ6n*dReQ3n*dReQ7n+dImQ3n*dImQ6n*dReQ4n*dReQ7n 
6585                  + dImQ3n*dImQ4n*dReQ6n*dReQ7n+dReQ3n*dReQ4n*dReQ6n*dReQ7n)
6586                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6587                  + 1.*(dReQ10n*dReQ6n*dReQ4n-dReQ10n*dImQ6n*dImQ4n+dImQ10n*dReQ6n*dImQ4n+dImQ10n*dImQ6n*dReQ4n)
6588                  + 3.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
6589                  + 2.*(dReQ7n*dReQ6n*dReQ1n-dReQ7n*dImQ6n*dImQ1n+dImQ7n*dReQ6n*dImQ1n+dImQ7n*dImQ6n*dReQ1n)
6590                  + 2.*(dReQ10n*dReQ7n*dReQ3n-dReQ10n*dImQ7n*dImQ3n+dImQ10n*dReQ7n*dImQ3n+dImQ10n*dImQ7n*dReQ3n)
6591                  + 2.*(dReQ10n*dReQ6n*dReQ4n-dReQ10n*dImQ6n*dImQ4n+dImQ10n*dReQ6n*dImQ4n+dImQ10n*dImQ6n*dReQ4n)
6592                  + 6.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
6593                  + 6.*(dReQ7n*dReQ4n*dReQ3n-dReQ7n*dImQ4n*dImQ3n+dImQ7n*dReQ4n*dImQ3n+dImQ7n*dImQ4n*dReQ3n)
6594                  - (dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
6595                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6596                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6597                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))-4.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6598                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6599                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6600                  + 2.*(dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6601                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
6602                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6603   // to be polished:
6604   five6n2n5n2n1n = (reQ6nQ2nQ5nstarQ2nstarQ1nstar
6605                  - reQ6nQ2nQ5nstarQ3nstar
6606                  - reQ7nQ1nQ6nstarQ2nstar
6607                  - reQ6nQ3nstarQ2nstarQ1nstar
6608                  - reQ8nQ5nstarQ2nstarQ1nstar
6609                  - reQ5nQ1nQ4nstarQ2nstar
6610                  - reQ6nQ1nQ5nstarQ2nstar
6611                  + reQ2nQ1nstarQ1nstar
6612                  + reQ8nQ6nstarQ2nstar
6613                  + 3.*reQ6nQ4nstarQ2nstar
6614                  + 2.*reQ8nQ6nstarQ2nstar
6615                  + reQ6nQ3nstarQ3nstar
6616                  + reQ8nQ5nstarQ3nstar
6617                  + reQ7nQ6nstarQ1nstar
6618                  + reQ2nQ1nstarQ1nstar
6619                  + reQ8nQ7nstarQ1nstar
6620                  + reQ4nQ3nstarQ1nstar
6621                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
6622                  + 3.*reQ3nQ2nstarQ1nstar
6623                  + reQ2nQ1nstarQ1nstar
6624                  + 2.*reQ5nQ3nstarQ2nstar
6625                  + 3.*reQ7nQ5nstarQ2nstar
6626                  + reQ5nQ4nstarQ1nstar
6627                  + reQ5nQ3nstarQ2nstar
6628                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6629                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6630                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6631                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
6632                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6633                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6634                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6635                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6636                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6637                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6638                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6639                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6640                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.)) 
6641                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6642   // to be polished:
6643   five6n3n5n3n1n = (reQ6nQ3nQ5nstarQ3nstarQ1nstar
6644                  - reQ6nQ3nQ5nstarQ4nstar
6645                  - reQ8nQ1nQ6nstarQ3nstar
6646                  - reQ6nQ3nstarQ2nstarQ1nstar
6647                  - reQ9nQ5nstarQ3nstarQ1nstar
6648                  - reQ5nQ1nQ3nstarQ3nstar
6649                  - reQ6nQ2nQ5nstarQ3nstar
6650                  + reQ3nQ2nstarQ1nstar
6651                  + reQ9nQ6nstarQ3nstar
6652                  + 3.*reQ6nQ3nstarQ3nstar
6653                  + 2.*reQ9nQ6nstarQ3nstar
6654                  + reQ6nQ4nstarQ2nstar
6655                  + reQ9nQ5nstarQ4nstar
6656                  + reQ8nQ6nstarQ2nstar
6657                  + reQ3nQ2nstarQ1nstar
6658                  + reQ9nQ8nstarQ1nstar
6659                  + reQ3nQ2nstarQ1nstar
6660                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
6661                  + 3.*reQ4nQ3nstarQ1nstar
6662                  + reQ3nQ2nstarQ1nstar
6663                  + 2.*reQ5nQ3nstarQ2nstar
6664                  + 3.*reQ8nQ5nstarQ3nstar
6665                  + reQ5nQ3nstarQ2nstar
6666                  + reQ5nQ3nstarQ2nstar
6667                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6668                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6669                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6670                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
6671                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6672                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6673                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6674                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
6675                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6676                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6677                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6678                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6679                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
6680                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6681   // to be polished:
6682   five6n4n5n4n1n = (reQ6nQ4nQ5nstarQ4nstarQ1nstar
6683                  - reQ6nQ4nQ5nstarQ5nstar
6684                  - reQ9nQ1nQ6nstarQ4nstar
6685                  - reQ6nQ4nstarQ1nstarQ1nstar
6686                  - reQ10nQ5nstarQ4nstarQ1nstar
6687                  - reQ5nQ1nQ4nstarQ2nstar
6688                  - reQ6nQ3nQ5nstarQ4nstar
6689                  + reQ4nQ3nstarQ1nstar
6690                  + reQ10nQ6nstarQ4nstar
6691                  + 3.*reQ6nQ4nstarQ2nstar
6692                  + 2.*reQ10nQ6nstarQ4nstar
6693                  + reQ6nQ5nstarQ1nstar
6694                  + reQ10nQ5nstarQ5nstar
6695                  + reQ9nQ6nstarQ3nstar
6696                  + reQ4nQ3nstarQ1nstar
6697                  + reQ10nQ9nstarQ1nstar
6698                  + reQ2nQ1nstarQ1nstar
6699                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
6700                  + 3.*reQ5nQ4nstarQ1nstar
6701                  + reQ4nQ3nstarQ1nstar
6702                  + 2.*reQ5nQ4nstarQ1nstar
6703                  + 3.*reQ9nQ5nstarQ4nstar
6704                  + reQ5nQ3nstarQ2nstar
6705                  + reQ5nQ4nstarQ1nstar
6706                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6707                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6708                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6709                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
6710                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6711                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
6712                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6713                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
6714                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6715                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6716                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6717                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6718                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
6719                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6720   five6n5n5n3n3n = ((pow(dReQ5n,2.)+pow(dImQ5n,2.))
6721                  * (pow(dReQ3n,2.)*dReQ6n-pow(dImQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n)
6722                  - ((dReQ11n*dReQ5n+dImQ11n*dImQ5n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
6723                  + 2.*dReQ3n*dImQ3n*(dImQ11n*dReQ5n-dReQ11n*dImQ5n))
6724                  - (dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
6725                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
6726                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n)
6727                  - 2.*(dImQ2n*dImQ3n*dImQ5n*dImQ6n+dImQ5n*dImQ6n*dReQ2n*dReQ3n 
6728                  + dImQ3n*dImQ6n*dReQ2n*dReQ5n-dImQ2n*dImQ6n*dReQ3n*dReQ5n
6729                  - dImQ3n*dImQ5n*dReQ2n*dReQ6n+dImQ2n*dImQ5n*dReQ3n*dReQ6n 
6730                  + dImQ2n*dImQ3n*dReQ5n*dReQ6n+dReQ2n*dReQ3n*dReQ5n*dReQ6n)
6731                  - 2.*(dImQ3n*dImQ5n*dImQ6n*dImQ8n+dImQ6n*dImQ8n*dReQ3n*dReQ5n 
6732                  + dImQ5n*dImQ8n*dReQ3n*dReQ6n-dImQ3n*dImQ8n*dReQ5n*dReQ6n
6733                  - dImQ5n*dImQ6n*dReQ3n*dReQ8n+dImQ3n*dImQ6n*dReQ5n*dReQ8n 
6734                  + dImQ3n*dImQ5n*dReQ6n*dReQ8n+dReQ3n*dReQ5n*dReQ6n*dReQ8n)
6735                  + 2.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
6736                  + 1.*(dReQ11n*dReQ6n*dReQ5n-dReQ11n*dImQ6n*dImQ5n+dImQ11n*dReQ6n*dImQ5n+dImQ11n*dImQ6n*dReQ5n)
6737                  + 3.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
6738                  + 2.*(dReQ8n*dReQ6n*dReQ2n-dReQ8n*dImQ6n*dImQ2n+dImQ8n*dReQ6n*dImQ2n+dImQ8n*dImQ6n*dReQ2n)
6739                  + 2.*(dReQ11n*dReQ8n*dReQ3n-dReQ11n*dImQ8n*dImQ3n+dImQ11n*dReQ8n*dImQ3n+dImQ11n*dImQ8n*dReQ3n)
6740                  + 2.*(dReQ11n*dReQ6n*dReQ5n-dReQ11n*dImQ6n*dImQ5n+dImQ11n*dReQ6n*dImQ5n+dImQ11n*dImQ6n*dReQ5n)
6741                  + 6.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
6742                  + 6.*(dReQ8n*dReQ5n*dReQ3n-dReQ8n*dImQ5n*dImQ3n+dImQ8n*dReQ5n*dImQ3n+dImQ8n*dImQ5n*dReQ3n)
6743                  - (dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
6744                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6745                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6746                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))-4.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
6747                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6748                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6749                  + 2.*(dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6750                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
6751                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6752   // to be polished:
6753   five6n2n6n1n1n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))
6754                  * (pow(dReQ1n,2.)*dReQ2n-pow(dImQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n)
6755                  - reQ8nQ6nstarQ1nstarQ1nstar
6756                  - reQ6nQ4nstarQ1nstarQ1nstar
6757                  - 2.*reQ6nQ1nQ5nstarQ2nstar
6758                  - 2.*reQ7nQ1nQ6nstarQ2nstar
6759                  + 2.*reQ5nQ4nstarQ1nstar
6760                  + reQ8nQ6nstarQ2nstar
6761                  + 3.*reQ6nQ4nstarQ2nstar
6762                  + 2.*reQ7nQ5nstarQ2nstar
6763                  + 2.*reQ8nQ7nstarQ1nstar
6764                  + 2.*reQ8nQ6nstarQ2nstar
6765                  + 6.*reQ6nQ5nstarQ1nstar
6766                  + 6.*reQ7nQ6nstarQ1nstar
6767                  - (dMult-6.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
6768                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6769                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6770                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))-4.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
6771                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
6772                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6773                  + 2.*(dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6774                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
6775                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6776   five6n3n6n2n1n = (reQ6nQ3nQ6nstarQ2nstarQ1nstar
6777                  - reQ7nQ2nQ6nstarQ3nstar
6778                  - reQ8nQ1nQ6nstarQ3nstar
6779                  - reQ6nQ1nQ4nstarQ3nstar
6780                  - reQ9nQ6nstarQ2nstarQ1nstar
6781                  - reQ6nQ3nstarQ2nstarQ1nstar
6782                  - reQ6nQ2nQ5nstarQ3nstar
6783                  + reQ6nQ5nstarQ1nstar
6784                  + reQ9nQ6nstarQ3nstar
6785                  + 3.*reQ6nQ3nstarQ3nstar
6786                  + 2.*reQ9nQ6nstarQ3nstar
6787                  + reQ7nQ4nstarQ3nstar
6788                  + reQ9nQ7nstarQ2nstar
6789                  + reQ8nQ5nstarQ3nstar
6790                  + reQ6nQ5nstarQ1nstar
6791                  + reQ9nQ8nstarQ1nstar
6792                  + reQ4nQ3nstarQ1nstar
6793                  - (dMult-6.)*reQ3nQ2nstarQ1nstar
6794                  + 3.*reQ7nQ6nstarQ1nstar
6795                  + reQ6nQ5nstarQ1nstar
6796                  + 2.*reQ6nQ4nstarQ2nstar
6797                  + 3.*reQ8nQ6nstarQ2nstar
6798                  + reQ5nQ3nstarQ2nstar
6799                  + reQ6nQ4nstarQ2nstar
6800                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6801                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6802                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6803                                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
6804                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6805                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6806                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
6807                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
6808                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6809                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6810                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6811                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6812                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
6813                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6814   five6n4n6n2n2n = (-(pow(dImQ6n,2.)+pow(dReQ6n,2.))
6815                  * (-2.*dImQ2n*dImQ4n*dReQ2n+pow(dImQ2n,2.)*dReQ4n-pow(dReQ2n,2.)*dReQ4n)
6816                  - (-pow(dImQ2n,2.)*dImQ6n*dImQ10n+dImQ6n*dImQ10n*pow(dReQ2n,2.)
6817                  + 2.*dImQ2n*dImQ10n*dReQ2n*dReQ6n-2.*dImQ2n*dImQ6n*dReQ2n*dReQ10n 
6818                  - pow(dImQ2n,2.)*dReQ6n*dReQ10n+pow(dReQ2n,2.)*dReQ6n*dReQ10n)
6819                  - 2.*(dImQ2n*dImQ4n*dImQ6n*dImQ8n+dImQ6n*dImQ8n*dReQ2n*dReQ4n 
6820                  + dImQ4n*dImQ8n*dReQ2n*dReQ6n-dImQ2n*dImQ8n*dReQ4n*dReQ6n
6821                  - dImQ4n*dImQ6n*dReQ2n*dReQ8n+dImQ2n*dImQ6n*dReQ4n*dReQ8n 
6822                  + dImQ2n*dImQ4n*dReQ6n*dReQ8n+dReQ2n*dReQ4n*dReQ6n*dReQ8n)
6823                  - (dReQ6n*pow(dReQ2n,3.)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2.)
6824                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2.)-dImQ6n*pow(dImQ2n,3.))
6825                  - 2.*((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
6826                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
6827                  + 2.*(dReQ10n*dReQ8n*dReQ2n-dReQ10n*dImQ8n*dImQ2n+dImQ10n*dReQ8n*dImQ2n+dImQ10n*dImQ8n*dReQ2n)
6828                  + 3.*(dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
6829                  + 6.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
6830                  + 2.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
6831                  + 9.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
6832                  - (dMult-8.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
6833                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6834                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6835                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))-4.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
6836                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+(dMult-12.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6837                  + 2.*(dMult-9.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.))
6838                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6839   // to be polished:
6840   five6n4n6n3n1n = (reQ6nQ4nQ6nstarQ3nstarQ1nstar
6841                  - reQ7nQ3nQ6nstarQ4nstar
6842                  - reQ9nQ1nQ6nstarQ4nstar
6843                  - reQ6nQ1nQ4nstarQ3nstar
6844                  - reQ10nQ6nstarQ3nstarQ1nstar
6845                  - reQ6nQ3nstarQ2nstarQ1nstar
6846                  - reQ6nQ3nQ5nstarQ4nstar
6847                  + reQ6nQ5nstarQ1nstar
6848                  + reQ10nQ6nstarQ4nstar
6849                  + 3.*reQ6nQ4nstarQ2nstar
6850                  + 2.*reQ10nQ6nstarQ4nstar
6851                  + reQ7nQ4nstarQ3nstar
6852                  + reQ10nQ7nstarQ3nstar
6853                  + reQ9nQ5nstarQ4nstar
6854                  + reQ6nQ5nstarQ1nstar
6855                  + reQ10nQ9nstarQ1nstar
6856                  + reQ3nQ2nstarQ1nstar
6857                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
6858                  + 3.*reQ7nQ6nstarQ1nstar
6859                  + reQ6nQ5nstarQ1nstar
6860                  + 2.*reQ6nQ3nstarQ3nstar
6861                  + 3.*reQ9nQ6nstarQ3nstar
6862                  + reQ5nQ3nstarQ2nstar
6863                  + reQ6nQ3nstarQ3nstar
6864                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6865                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6866                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6867                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
6868                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6869                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6870                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
6871                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
6872                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6873                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6874                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6875                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6876                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
6877                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6878   // to be polished:
6879   five6n5n5n4n2n = (reQ6nQ5nQ5nstarQ4nstarQ2nstar
6880                  - reQ7nQ4nQ6nstarQ5nstar
6881                  - reQ9nQ2nQ6nstarQ5nstar
6882                  - reQ6nQ1nQ5nstarQ2nstar
6883                  - reQ11nQ5nstarQ4nstarQ2nstar
6884                  - reQ5nQ1nQ4nstarQ2nstar
6885                  - reQ6nQ3nQ5nstarQ4nstar
6886                  + reQ5nQ3nstarQ2nstar
6887                  + reQ11nQ6nstarQ5nstar
6888                  + 3.*reQ6nQ5nstarQ1nstar
6889                  + 2.*reQ11nQ6nstarQ5nstar
6890                  + reQ7nQ6nstarQ1nstar
6891                  + reQ11nQ7nstarQ4nstar
6892                  + reQ9nQ6nstarQ3nstar
6893                  + reQ5nQ3nstarQ2nstar
6894                  + reQ11nQ9nstarQ2nstar
6895                  + reQ2nQ1nstarQ1nstar
6896                  - (dMult-6.)*reQ6nQ4nstarQ2nstar
6897                  + 3.*reQ7nQ5nstarQ2nstar
6898                  + reQ5nQ3nstarQ2nstar
6899                  + 2.*reQ5nQ4nstarQ1nstar
6900                  + 3.*reQ9nQ5nstarQ4nstar
6901                  + reQ4nQ3nstarQ1nstar
6902                  + reQ5nQ4nstarQ1nstar
6903                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6904                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6905                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6906                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))
6907                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6908                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6909                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6910                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
6911                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
6912                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
6913                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6914                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6915                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
6916                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6917   // to be polished:
6918   five6n5n6n3n2n = (reQ6nQ5nQ6nstarQ3nstarQ2nstar
6919                  - reQ8nQ3nQ6nstarQ5nstar
6920                  - reQ9nQ2nQ6nstarQ5nstar
6921                  - reQ6nQ2nQ5nstarQ3nstar
6922                  - reQ11nQ6nstarQ3nstarQ2nstar
6923                  - reQ6nQ3nstarQ2nstarQ1nstar
6924                  - reQ6nQ3nQ5nstarQ4nstar
6925                  + reQ6nQ4nstarQ2nstar
6926                  + reQ11nQ6nstarQ5nstar
6927                  + 3.*reQ6nQ5nstarQ1nstar
6928                  + 2.*reQ11nQ6nstarQ5nstar
6929                  + reQ8nQ5nstarQ3nstar
6930                  + reQ11nQ8nstarQ3nstar
6931                  + reQ9nQ5nstarQ4nstar
6932                  + reQ6nQ4nstarQ2nstar
6933                  + reQ11nQ9nstarQ2nstar
6934                  + reQ3nQ2nstarQ1nstar
6935                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
6936                  + 3.*reQ8nQ6nstarQ2nstar
6937                  + reQ6nQ4nstarQ2nstar
6938                  + 2.*reQ6nQ3nstarQ3nstar
6939                  + 3.*reQ9nQ6nstarQ3nstar
6940                  + reQ4nQ3nstarQ1nstar
6941                  + reQ6nQ3nstarQ3nstar
6942                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6943                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6944                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6945                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))
6946                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6947                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
6948                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
6949                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
6950                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
6951                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6952                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
6953                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
6954                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
6955                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6956   // to be polished:
6957   five6n5n6n4n1n = (reQ6nQ5nQ6nstarQ4nstarQ1nstar
6958                  - reQ7nQ4nQ6nstarQ5nstar
6959                  - reQ10nQ1nQ6nstarQ5nstar
6960                  - reQ6nQ1nQ5nstarQ2nstar
6961                  - reQ11nQ6nstarQ4nstarQ1nstar
6962                  - reQ6nQ4nstarQ1nstarQ1nstar
6963                  - reQ6nQ4nQ5nstarQ5nstar
6964                  + reQ6nQ5nstarQ1nstar
6965                  + reQ11nQ6nstarQ5nstar
6966                  + 3.*reQ6nQ5nstarQ1nstar
6967                  + 2.*reQ11nQ6nstarQ5nstar
6968                  + reQ7nQ5nstarQ2nstar
6969                  + reQ11nQ7nstarQ4nstar
6970                  + reQ10nQ5nstarQ5nstar
6971                  + reQ6nQ5nstarQ1nstar
6972                  + reQ11nQ10nstarQ1nstar
6973                  + reQ2nQ1nstarQ1nstar
6974                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
6975                  + 3.*reQ7nQ6nstarQ1nstar
6976                  + reQ6nQ5nstarQ1nstar
6977                  + 2.*reQ6nQ4nstarQ2nstar
6978                  + 3.*reQ10nQ6nstarQ4nstar
6979                  + reQ5nQ4nstarQ1nstar
6980                  + reQ6nQ4nstarQ2nstar
6981                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6982                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6983                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6984                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))
6985                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6986                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
6987                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
6988                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.)) 
6989                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
6990                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
6991                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
6992                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
6993                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
6994                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
6995   //  f2) Two distinct harmonics (9):
6996   five2n1n1n1n1n = ((dReQ2n*dReQ1n-dImQ2n*dImQ1n)*(pow(dReQ1n,3)-3.*dReQ1n*pow(dImQ1n,2))
6997                  + (dReQ2n*dImQ1n+dReQ1n*dImQ2n)*(3.*dImQ1n*pow(dReQ1n,2)-pow(dImQ1n,3))
6998                  - (dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
6999                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3))
7000                  + 5.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7001                  - 3.*(dMult-5.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7002                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7003                  - 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))     
7004                  + 3.*(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7005                  - 3.*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
7006                  + 6.*(2.*dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult*(dMult-4.))
7007                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7008   five2n2n2n1n1n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))*(dReQ2n*(pow(dReQ1n,2.)-pow(dImQ1n,2.))+2.*dImQ2n*dReQ1n*dImQ1n)
7009                  - ((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
7010                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
7011                  - 2.*((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
7012                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7013                  + 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7014                  + 8.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7015                  + 2.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7016                  - 2.*(dMult-6.)*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7017                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7018                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)
7019                  + 2.*(3.*dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7020                  - 4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7021                  + 4.*(dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
7022                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7023   five3n3n2n2n2n = (pow(dReQ2n,3.)*pow(dReQ3n,2.)-3.*dReQ2n*pow(dReQ3n,2.)*pow(dImQ2n,2.)
7024                  + 6.*pow(dReQ2n,2.)*dReQ3n*dImQ2n*dImQ3n-2.*dReQ3n*pow(dImQ2n,3.)*dImQ3n
7025                  - pow(dReQ2n,3.)*pow(dImQ3n,2.)+3.*dReQ2n*pow(dImQ2n,2.)*pow(dImQ3n,2.)
7026                  - (dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
7027                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3))
7028                  - 3.*((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
7029                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n)
7030                  - 6.*((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
7031                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7032                  + 2.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7033                  + 3.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7034                  + 6.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7035                  + 6.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7036                  + 12.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7037                  + 6.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7038                  - 2.*((pow(dReQ6n,2.)+pow(dImQ6n,2.))+3.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7039                  + 6.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+9.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7040                  + 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-12.*dMult))
7041                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7042   five4n1n1n1n1n = (pow(dReQ1n,4.)*dReQ4n-6.*pow(dReQ1n,2.)*dReQ4n*pow(dImQ1n,2.)
7043                  + pow(dImQ1n,4.)*dReQ4n+4.*pow(dReQ1n,3.)*dImQ1n*dImQ4n-4.*pow(dImQ1n,3.)*dReQ1n*dImQ4n
7044                  - 6.*((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
7045                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
7046                  - 4.*(dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
7047                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3))
7048                  + 8.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7049                  + 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7050                  + 12.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n) 
7051                  + 12.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7052                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-8.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7053                  - 12.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-24.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+24.*dMult)
7054                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7055   five4n2n2n2n2n = ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(pow(dReQ2n,3)-3.*dReQ2n*pow(dImQ2n,2))
7056                  + (dReQ4n*dImQ2n+dReQ2n*dImQ4n)*(3.*dImQ2n*pow(dReQ2n,2)-pow(dImQ2n,3))
7057                  - (dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
7058                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3))
7059                  + 5.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7060                  - 3.*(dMult-5.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7061                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7062                  - 3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))     
7063                  + 3.*(dMult-4.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7064                  - 3.*pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)
7065                  + 6.*(2.*dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-6.*dMult*(dMult-4.))
7066                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7067   five4n4n4n2n2n = ((pow(dReQ4n,2.)+pow(dImQ4n,2.))*(dReQ4n*(pow(dReQ2n,2.)-pow(dImQ2n,2.))+2.*dImQ4n*dReQ2n*dImQ2n)
7068                  - ((dReQ8n*dReQ4n+dImQ8n*dImQ4n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
7069                  + 2.*dReQ2n*dImQ2n*(dImQ8n*dReQ4n-dReQ8n*dImQ4n))
7070                  - 2.*((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
7071                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7072                  + 3.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
7073                  + 8.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7074                  + 2.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7075                  - 2.*(dMult-6.)*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7076                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))-4.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7077                  - pow((pow(dReQ4n,2.)+pow(dImQ4n,2.)),2.)
7078                  + 2.*(3.*dMult-10.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7079                  - 4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7080                  + 4.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*dMult*(dMult-6.))
7081                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7082   five6n3n3n3n3n = ((dReQ6n*dReQ3n-dImQ6n*dImQ3n)*(pow(dReQ3n,3)-3.*dReQ3n*pow(dImQ3n,2))
7083                  + (dReQ6n*dImQ3n+dReQ3n*dImQ6n)*(3.*dImQ3n*pow(dReQ3n,2)-pow(dImQ3n,3))
7084                  - (dReQ9n*pow(dReQ3n,3)-3.*dReQ3n*dReQ9n*pow(dImQ3n,2)
7085                  + 3.*dImQ3n*dImQ9n*pow(dReQ3n,2)-dImQ9n*pow(dImQ3n,3))
7086                  + 5.*(dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n+dImQ9n*dImQ6n*dReQ3n)
7087                  - 3.*(dMult-5.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7088                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
7089                  - 3.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))     
7090                  + 3.*(dMult-4.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7091                  - 3.*pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)
7092                  + 6.*(2.*dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-6.*dMult*(dMult-4.))
7093                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7094   five6n6n4n4n4n = (pow(dReQ4n,3.)*pow(dReQ6n,2.)-3.*dReQ4n*pow(dReQ6n,2.)*pow(dImQ4n,2.)
7095                  + 6.*pow(dReQ4n,2.)*dReQ6n*dImQ4n*dImQ6n-2.*dReQ6n*pow(dImQ4n,3.)*dImQ6n
7096                  - pow(dReQ4n,3.)*pow(dImQ6n,2.)+3.*dReQ4n*pow(dImQ4n,2.)*pow(dImQ6n,2.)
7097                  - (dReQ12n*pow(dReQ4n,3)-3.*dReQ4n*dReQ12n*pow(dImQ4n,2)
7098                  + 3.*dImQ4n*dImQ12n*pow(dReQ4n,2)-dImQ12n*pow(dImQ4n,3))
7099                  - 3.*((dReQ8n*dReQ4n-dImQ8n*dImQ4n)*(dReQ6n*dReQ6n-dImQ6n*dImQ6n)
7100                  + 2.*(dReQ8n*dImQ4n+dImQ8n*dReQ4n)*dReQ6n*dImQ6n)
7101                  - 6.*((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
7102                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7103                  + 2.*(pow(dReQ6n,2.)*dReQ12n+2.*dReQ6n*dImQ6n*dImQ12n-pow(dImQ6n,2.)*dReQ12n)
7104                  + 3.*(dReQ12n*dReQ8n*dReQ4n-dReQ12n*dImQ8n*dImQ4n+dImQ12n*dReQ8n*dImQ4n+dImQ12n*dImQ8n*dReQ4n)
7105                  + 6.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7106                  + 6.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
7107                  + 12.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7108                  + 6.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7109                  - 2.*((pow(dReQ12n,2.)+pow(dImQ12n,2.))+3.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7110                  + 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))+9.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7111                  + 6.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-12.*dMult))
7112                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7113   five6n6n6n3n3n = ((pow(dReQ6n,2.)+pow(dImQ6n,2.))*(dReQ6n*(pow(dReQ3n,2.)-pow(dImQ3n,2.))+2.*dImQ6n*dReQ3n*dImQ3n)
7114                  - ((dReQ12n*dReQ6n+dImQ12n*dImQ6n)*(pow(dReQ3n,2)-pow(dImQ3n,2)) 
7115                  + 2.*dReQ3n*dImQ3n*(dImQ12n*dReQ6n-dReQ12n*dImQ6n))
7116                  - 2.*((pow(dReQ6n,2.)-pow(dImQ6n,2.))*(dReQ9n*dReQ3n-dImQ9n*dImQ3n) 
7117                  + 2.*dReQ6n*dImQ6n*(dReQ9n*dImQ3n+dImQ9n*dReQ3n))
7118                  + 3.*(pow(dReQ6n,2.)*dReQ12n+2.*dReQ6n*dImQ6n*dImQ12n-pow(dImQ6n,2.)*dReQ12n)
7119                  + 8.*(dReQ9n*dReQ6n*dReQ3n-dReQ9n*dImQ6n*dImQ3n+dImQ9n*dReQ6n*dImQ3n+dImQ9n*dImQ6n*dReQ3n)
7120                  + 2.*(dReQ12n*(dReQ9n*dReQ3n-dImQ9n*dImQ3n)+dImQ12n*(dReQ9n*dImQ3n+dImQ9n*dReQ3n))
7121                  - 2.*(dMult-6.)*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7122                  - 2.*(pow(dReQ12n,2.)+pow(dImQ12n,2.))-4.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
7123                  - pow((pow(dReQ6n,2.)+pow(dImQ6n,2.)),2.)
7124                  + 2.*(3.*dMult-10.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7125                  - 4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7126                  + 4.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-4.*dMult*(dMult-6.))
7127                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7128   //  f3) Three distinct harmonics (30):
7129   five3n1n2n1n1n = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))*(dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n
7130                  + dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n)
7131                  - ((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2)) 
7132                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n)) 
7133                  - (dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
7134                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3))
7135                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
7136                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7137                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7138                  + pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n
7139                  - (2.*dMult-13.)*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
7140                  + dImQ3n*dImQ2n*dReQ1n)
7141                  + 7.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7142                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7143                  + 2.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7144                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7145                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7146                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7147                  - pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
7148                  + 2.*(3.*dMult-11.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
7149                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7150   five3n2n2n2n1n = ((pow(dImQ2n,2.)+pow(dReQ2n,2.))*(dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n 
7151                  - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n)
7152                  - (-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
7153                  + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
7154                  - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n)
7155                  - (dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
7156                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
7157                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
7158                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
7159                  - ((pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
7160                  + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7161                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7162                  + (dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
7163                  + 4.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
7164                  + dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)
7165                  + 3.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7166                  - 2.*(dMult-6.)*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7167                  + 4.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7168                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7169                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7170                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7171                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)+2.*(3.*dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7172                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
7173                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
7174   five3n3n3n2n1n = ((pow(dImQ3n,2.)+pow(dReQ3n,2.))*(dImQ2n*dImQ3n*dReQ1n+dImQ1n*dImQ3n*dReQ2n
7175                  - dImQ1n*dImQ2n*dReQ3n+dReQ1n*dReQ2n*dReQ3n)
7176                  - (dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
7177                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
7178                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
7179                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
7180                  - (dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
7181                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
7182                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n)
7183                  - ((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
7184                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n)
7185                  + dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n
7186                  + dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n
7187                  + 3.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n)
7188                  + 4.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
7189                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n))
7190                  - 2.*(dMult-6.)*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7191                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7192                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7193                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7194                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*(3.*dMult-10.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7195                  - pow((pow(dReQ3n,2.)+pow(dImQ3n,2.)),2.)+2.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7196                  + 2.*(dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-4.*dMult*(dMult-6.))
7197                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7198   five4n1n3n1n1n = (reQ4nQ1nQ3nstarQ1nstarQ1nstar
7199                  - reQ4nQ1nQ3nstarQ2nstar
7200                  - reQ4nQ1nQ4nstarQ1nstar
7201                  - reQ4nQ2nstarQ1nstarQ1nstar
7202                  - reQ5nQ3nstarQ1nstarQ1nstar
7203                  - reQ3nQ1nQ3nstarQ1nstar
7204                  - dMult*reQ4nQ3nstarQ1nstar
7205                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7206                  + reQ5nQ4nstarQ1nstar
7207                  + 3.*reQ4nQ3nstarQ1nstar
7208                  + 2.*reQ5nQ4nstarQ1nstar
7209                  + reQ4nQ2nstarQ2nstar
7210                  + reQ5nQ3nstarQ2nstar
7211                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7212                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7213                  + reQ5nQ4nstarQ1nstar
7214                  + reQ3nQ2nstarQ1nstar
7215                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
7216                  + 3.*reQ2nQ1nstarQ1nstar
7217                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7218                  + 2.*reQ3nQ2nstarQ1nstar
7219                  + 3.*reQ4nQ3nstarQ1nstar
7220                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7221                  + reQ3nQ2nstarQ1nstar
7222                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7223                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7224                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7225                                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7226                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7227                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7228                  - 2.*dMult*dMult 
7229                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7230                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7231                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7232                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7233                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7234                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.)) 
7235                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7236   five4n1n1n3n3n = // calculated by Peter Jochumzsen
7237                  (pow(dReQ1n*dReQ3n,2.)*dReQ4n-pow(dReQ3n*dImQ1n,2.)*dReQ4n  
7238                  + 4.*dReQ1n*dReQ3n*dReQ4n*dImQ1n*dImQ3n 
7239                  - pow(dReQ1n*dImQ3n,2.)*dReQ4n+pow(dImQ1n*dImQ3n,2.)*dReQ4n  
7240                  - 2.*dReQ1n*pow(dReQ3n,2.)*dImQ1n*dImQ4n+2.*pow(dReQ1n,2.)*dReQ3n*dImQ3n*dImQ4n 
7241                  - 2.*dReQ3n*pow(dImQ1n,2.)*dImQ3n*dImQ4n+2.*dReQ1n*dImQ1n*pow(dImQ3n,2.)*dImQ4n
7242                  + 6.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n)
7243                  - 1.*(-pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
7244                  + 2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
7245                  - pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n) 
7246                  - 1.*((dReQ4n*dReQ2n-dImQ4n*dImQ2n)*(dReQ3n*dReQ3n-dImQ3n*dImQ3n)
7247                  + 2.*(dReQ4n*dImQ2n+dImQ4n*dReQ2n)*dReQ3n*dImQ3n) 
7248                  + 1.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7249                  - 2.*(dImQ1n*pow(dImQ3n,2.)*dImQ5n+2.*dImQ3n*dImQ5n*dReQ1n*dReQ3n
7250                  - dImQ1n*dImQ5n*pow(dReQ3n,2.)-pow(dImQ3n,2.)*dReQ1n*dReQ5n 
7251                  + 2.*dImQ1n*dImQ3n*dReQ3n*dReQ5n+dReQ1n*pow(dReQ3n,2.)*dReQ5n) 
7252                  + 2.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7253                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)) 
7254                  - 2.*(dReQ3n*pow(dReQ1n,3.)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2.)
7255                  + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2.)-dImQ3n*pow(dImQ1n,3.))
7256                  + 10.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n) 
7257                  + 2.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
7258                  + 2.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n) 
7259                  - 4.*(dImQ1n*dImQ2n*dImQ3n*dImQ4n+dImQ3n*dImQ4n*dReQ1n*dReQ2n 
7260                  + dImQ2n*dImQ4n*dReQ1n*dReQ3n-dImQ1n*dImQ4n*dReQ2n*dReQ3n
7261                  - dImQ2n*dImQ3n*dReQ1n*dReQ4n+dImQ1n*dImQ3n*dReQ2n*dReQ4n 
7262                  + dImQ1n*dImQ2n*dReQ3n*dReQ4n+dReQ1n*dReQ2n*dReQ3n*dReQ4n)
7263                  + 4.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
7264                  + 4.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
7265                  - 16.*pow(dReQ1n,2.)-16.*pow(dImQ1n,2.)
7266                  - 10.*pow(dReQ2n,2.)-10.*pow(dImQ2n,2.)-12.*pow(dReQ3n,2.)-12.*pow(dImQ3n,2.)
7267                  - 6.*pow(dReQ4n,2.)-6.*pow(dImQ4n,2.)-4.*pow(dReQ5n,2.)-4.*pow(dImQ5n,2.)
7268                  - 2.*pow(dReQ6n,2.)-2.*pow(dImQ6n,2.)+24.*dMult)
7269                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7270   // to be polished:
7271   five4n3n3n3n1n = (reQ4nQ3nQ3nstarQ3nstarQ1nstar
7272                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7273                  - reQ6nQ1nQ4nstarQ3nstar
7274                  - dMult*reQ4nQ3nstarQ1nstar
7275                  - reQ7nQ3nstarQ3nstarQ1nstar
7276                  - reQ3nQ1nQ3nstarQ1nstar
7277                  - reQ4nQ2nQ3nstarQ3nstar
7278                  + reQ3nQ2nstarQ1nstar
7279                  + reQ7nQ4nstarQ3nstar
7280                  + 3.*reQ4nQ3nstarQ1nstar
7281                  + 2.*reQ7nQ4nstarQ3nstar
7282                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7283                  + reQ7nQ4nstarQ3nstar
7284                  + reQ6nQ4nstarQ2nstar
7285                  + reQ3nQ2nstarQ1nstar
7286                  + reQ7nQ6nstarQ1nstar
7287                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7288                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
7289                  + 3.*reQ4nQ3nstarQ1nstar
7290                  + reQ3nQ2nstarQ1nstar
7291                  + 2.*dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7292                  + 3.*reQ6nQ3nstarQ3nstar
7293                  + reQ3nQ2nstarQ1nstar
7294                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7295                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7296                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7297                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7298                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
7299                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7300                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7301                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7302                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
7303                  - 2.*dMult*dMult 
7304                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7305                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7306                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7307                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
7308                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7309
7310   // to be polished:
7311   five4n4n3n3n2n = (reQ4nQ4nQ3nstarQ3nstarQ2nstar
7312                  - reQ5nQ3nQ4nstarQ4nstar-reQ5nQ3nQ4nstarQ4nstar-reQ6nQ2nQ4nstarQ4nstar
7313                  - reQ4nQ1nQ3nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar-reQ4nQ2nQ3nstarQ3nstar                  
7314                                  - reQ8nQ3nstarQ3nstarQ2nstar-reQ4nQ2nQ3nstarQ3nstar-reQ4nQ1nQ3nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar
7315                  + 2.*(reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ8nQ4nstarQ4nstar)
7316                                  + reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ6nQ4nstarQ2nstar
7317                  + reQ8nQ6nstarQ2nstar+reQ8nQ5nstarQ3nstar+reQ8nQ5nstarQ3nstar
7318                                  + reQ5nQ4nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar                                                           
7319                                  + reQ5nQ4nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar                                                           
7320                                  + reQ6nQ4nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7321                  + 2.*(reQ6nQ3nstarQ3nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar)
7322                  + 2.*(reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar)
7323                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7324                                  - 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.))
7325                                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
7326                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))                                
7327                                  - 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.))
7328                                  + 24.*dMult) 
7329                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7330
7331   /*
7332   // correct recursive formula, not needed for the time being.
7333   five4n4n3n3n2n = (reQ4nQ4nQ3nstarQ3nstarQ2nstar
7334                  - dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
7335                  * (2.*four4n2n3n3n+4.*four4n1n3n2n+1.*four8n3n3n2n+1.*four6n2n4n4n+2.*four5n3n4n4n)
7336                  - dMult*(dMult-1.)*(dMult-2.)
7337                  * (4.*three4n3n1n+2.*three4n2n2n+2.*three5n3n2n+1.*three6n3n3n+1.*three8n4n4n
7338                                  + 4.*three3n2n1n+2.*three2n1n1n+1.*three8n6n2n+2.*three8n5n3n+2.*three6n4n2n+4.*three5n4n1n)
7339                  - dMult*(dMult-1.)
7340                                  * (1.*two2n2n+2.*two3n3n+2.*two4n4n+2.*two5n5n+1.*two6n6n+4.*two1n1n+2.*two2n2n+1.*two8n8n)
7341                                  - dMult)
7342                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
7343   */
7344
7345   // to be polished:
7346   five4n4n4n3n1n = (reQ4nQ4nQ4nstarQ3nstarQ1nstar
7347                  - reQ5nQ3nQ4nstarQ4nstar
7348                  - reQ7nQ1nQ4nstarQ4nstar
7349                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7350                  - reQ8nQ4nstarQ3nstarQ1nstar
7351                  - dMult*reQ4nQ3nstarQ1nstar
7352                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7353                  + reQ4nQ3nstarQ1nstar
7354                  + reQ8nQ4nstarQ4nstar
7355                  + 3.*dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7356                  + 2.*reQ8nQ4nstarQ4nstar
7357                  + reQ5nQ4nstarQ1nstar
7358                  + reQ8nQ5nstarQ3nstar
7359                  + reQ7nQ4nstarQ3nstar
7360                  + reQ4nQ3nstarQ1nstar
7361                  + reQ8nQ7nstarQ1nstar
7362                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7363                  - (dMult-6.)*reQ4nQ3nstarQ1nstar
7364                  + 3.*reQ5nQ4nstarQ1nstar
7365                  + reQ4nQ3nstarQ1nstar
7366                  + 2.*reQ4nQ3nstarQ1nstar
7367                  + 3.*reQ7nQ4nstarQ3nstar
7368                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7369                  + reQ4nQ3nstarQ1nstar
7370                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7371                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7372                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7373                                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7374                  - 2.*dMult*dMult 
7375                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7376                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7377                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7378                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7379                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7380                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7381                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7382                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
7383                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7384   // to be polished:
7385   five5n2n1n1n1n = (reQ5nQ2nstarQ1nstarQ1nstarQ1nstar
7386                      - reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar
7387                                  - reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar
7388                                  - reQ3nQ1nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar
7389                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar)
7390                                  + reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar
7391                                  + reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7392                                  + reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
7393                                  + reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
7394                                  + reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
7395                  + 2.*(reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar)
7396                  + 2.*(reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
7397                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7398                  - 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.))
7399                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
7400                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
7401                                  - 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.))
7402                                  + 24.*dMult) 
7403                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7404   // to be polished:
7405   five5n1n2n2n2n = (reQ5nQ1nQ2nstarQ2nstarQ2nstar
7406                  - reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ4nstarQ2nstar
7407                                  - reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ2nstarQ2nstarQ1nstar
7408                                  - reQ6nQ2nstarQ2nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar
7409                                  + 2.*(reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ6nQ5nstarQ1nstar)
7410                                  + reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar
7411                                  + reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar
7412                                  + reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7413                                  + reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7414                                  + reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7415                  + 2.*(reQ4nQ2nstarQ2nstar+reQ4nQ2nstarQ2nstar+reQ4nQ2nstarQ2nstar)
7416                  + 2.*(reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar)
7417                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7418                  - 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.))
7419                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.))
7420                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
7421                                  - 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.))
7422                                  + 24.*dMult) 
7423                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7424   // to be polished:
7425   five5n2n3n2n2n = (reQ5nQ2nQ3nstarQ2nstarQ2nstar
7426                  - reQ5nQ2nQ4nstarQ3nstar
7427                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7428                  - reQ5nQ2nstarQ2nstarQ1nstar
7429                  - reQ7nQ3nstarQ2nstarQ2nstar
7430                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7431                  - dMult*reQ5nQ3nstarQ2nstar
7432                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7433                  + reQ7nQ5nstarQ2nstar
7434                  + 3.*reQ5nQ3nstarQ2nstar
7435                  + 2.*reQ7nQ5nstarQ2nstar
7436                  + reQ5nQ4nstarQ1nstar
7437                  + reQ7nQ4nstarQ3nstar
7438                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7439                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7440                  + reQ7nQ5nstarQ2nstar
7441                  + reQ3nQ2nstarQ1nstar
7442                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
7443                  + 3.*reQ4nQ2nstarQ2nstar
7444                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7445                  + 2.*reQ3nQ2nstarQ1nstar
7446                  + 3.*reQ5nQ3nstarQ2nstar
7447                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7448                  + reQ3nQ2nstarQ1nstar
7449                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7450                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7451                  - (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7452                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
7453                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7454                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7455                  - 2.*dMult*dMult
7456                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7457                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7458                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7459                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7460                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7461                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-2.*dMult*(dMult-12.)) 
7462                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7463   // to be polished:
7464   five5n3n3n3n2n = (reQ5nQ3nQ3nstarQ3nstarQ2nstar
7465                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7466                  - reQ6nQ2nQ5nstarQ3nstar
7467                  - dMult*reQ5nQ3nstarQ2nstar
7468                  - reQ8nQ3nstarQ3nstarQ2nstar 
7469                                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7470                  - reQ5nQ1nQ3nstarQ3nstar
7471                  + reQ3nQ2nstarQ1nstar
7472                  + reQ8nQ5nstarQ3nstar
7473                  + 3.*reQ5nQ3nstarQ2nstar
7474                  + 2.*reQ8nQ5nstarQ3nstar
7475                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7476                  + reQ8nQ5nstarQ3nstar
7477                  + reQ6nQ5nstarQ1nstar
7478                  + reQ3nQ2nstarQ1nstar
7479                  + reQ8nQ6nstarQ2nstar
7480                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7481                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
7482                  + 3.*reQ5nQ3nstarQ2nstar
7483                  + reQ3nQ2nstarQ1nstar
7484                  + 2.*dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7485                  + 3.*reQ6nQ3nstarQ3nstar
7486                  + reQ3nQ2nstarQ1nstar
7487                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7488                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7489                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7490                  - (pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7491                                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7492                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7493                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7494                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7495                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
7496                  - 2.*dMult*dMult 
7497                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7498                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7499                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7500                  + 2.*(dMult-6.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))-2.*dMult*(dMult-12.)) 
7501                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7502   // to be polished:
7503   five5n1n4n1n1n = (reQ5nQ1nQ4nstarQ1nstarQ1nstar
7504                  - reQ5nQ1nQ4nstarQ2nstar
7505                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7506                  - reQ5nQ3nstarQ1nstarQ1nstar
7507                  - reQ6nQ4nstarQ1nstarQ1nstar 
7508                                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7509                  - dMult*reQ5nQ4nstarQ1nstar
7510                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7511                  + reQ6nQ5nstarQ1nstar
7512                  + 3.*reQ5nQ4nstarQ1nstar
7513                  + 2.*reQ6nQ5nstarQ1nstar
7514                  + reQ5nQ3nstarQ2nstar
7515                  + reQ6nQ4nstarQ2nstar
7516                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7517                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7518                  + reQ6nQ5nstarQ1nstar
7519                  + reQ4nQ3nstarQ1nstar
7520                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
7521                  + 3.*reQ2nQ1nstarQ1nstar
7522                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7523                  + 2.*reQ4nQ3nstarQ1nstar
7524                  + 3.*reQ5nQ4nstarQ1nstar
7525                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7526                  + reQ4nQ3nstarQ1nstar
7527                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7528                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7529                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7530                                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7531                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7532                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7533                  - 2.*dMult*dMult
7534                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7535                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)) 
7536                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7537                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7538                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7539                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.)) 
7540                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7541   // to be polished:
7542   five5n4n3n3n3n = (reQ5nQ4nQ3nstarQ3nstarQ3nstar
7543                  - reQ6nQ3nQ5nstarQ4nstar-reQ6nQ3nQ5nstarQ4nstar-reQ6nQ3nQ5nstarQ4nstar
7544                                  - reQ5nQ1nQ3nstarQ3nstar-reQ5nQ1nQ3nstarQ3nstar-reQ5nQ1nQ3nstarQ3nstar
7545                          - reQ9nQ3nstarQ3nstarQ3nstar-reQ4nQ2nQ3nstarQ3nstar-reQ4nQ2nQ3nstarQ3nstar-reQ4nQ2nQ3nstarQ3nstar
7546                                  + 2.*(reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ9nQ5nstarQ4nstar)
7547                                  + reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar
7548                                  + reQ9nQ6nstarQ3nstar+reQ9nQ6nstarQ3nstar+reQ9nQ6nstarQ3nstar
7549                                  + reQ6nQ4nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7550                                  + reQ6nQ4nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7551                                  + reQ6nQ4nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7552                  + 2.*(reQ6nQ3nstarQ3nstar+reQ6nQ3nstarQ3nstar+reQ6nQ3nstarQ3nstar)
7553                  + 2.*(reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
7554                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7555                                  - 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.))
7556                                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
7557                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
7558                                  - 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.))
7559                                  + 24.*dMult) 
7560                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7561   // to be polished:
7562   five5n4n4n4n1n = (reQ5nQ4nQ4nstarQ4nstarQ1nstar
7563                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7564                  - reQ8nQ1nQ5nstarQ4nstar
7565                  - dMult*reQ5nQ4nstarQ1nstar
7566                  - reQ9nQ4nstarQ4nstarQ1nstar 
7567                                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7568                  - reQ5nQ3nQ4nstarQ4nstar
7569                  + reQ4nQ3nstarQ1nstar
7570                  + reQ9nQ5nstarQ4nstar
7571                  + 3.*reQ5nQ4nstarQ1nstar
7572                  + 2.*reQ9nQ5nstarQ4nstar
7573                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7574                  + reQ9nQ5nstarQ4nstar
7575                  + reQ8nQ5nstarQ3nstar
7576                  + reQ4nQ3nstarQ1nstar
7577                  + reQ9nQ8nstarQ1nstar
7578                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7579                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
7580                  + 3.*reQ5nQ4nstarQ1nstar
7581                  + reQ4nQ3nstarQ1nstar
7582                  + 2.*dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7583                  + 3.*reQ8nQ4nstarQ4nstar
7584                  + reQ4nQ3nstarQ1nstar
7585                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7586                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7587                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7588                  - (pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7589                                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.))
7590                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
7591                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)) 
7592                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7593                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
7594                  - 2.*dMult*dMult 
7595                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7596                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7597                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7598                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*dMult*(dMult-12.)) 
7599                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7600   // to be polished:
7601   five5n5n4n3n3n = (reQ5nQ5nQ4nstarQ3nstarQ3nstar
7602                  - reQ6nQ4nQ5nstarQ5nstar-reQ7nQ3nQ5nstarQ5nstar-reQ7nQ3nQ5nstarQ5nstar
7603                                  - reQ5nQ2nQ4nstarQ3nstar-reQ5nQ1nQ3nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar                  
7604                                  - reQ10nQ4nstarQ3nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar-reQ5nQ1nQ3nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar
7605                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ10nQ5nstarQ5nstar)
7606                                  + reQ6nQ5nstarQ1nstar+reQ7nQ5nstarQ2nstar+reQ7nQ5nstarQ2nstar
7607                                  + reQ10nQ7nstarQ3nstar+reQ10nQ6nstarQ4nstar+reQ10nQ7nstarQ3nstar
7608                                  + reQ6nQ5nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7609                                  + reQ7nQ5nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ2nstarQ2nstar
7610                                  + reQ7nQ5nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ2nstarQ2nstar
7611                                  + 2.*(reQ7nQ4nstarQ3nstar+reQ7nQ4nstarQ3nstar+reQ6nQ3nstarQ3nstar)
7612                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar)
7613                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7614                                  - 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.))
7615                                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
7616                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
7617                                  - 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.))
7618                                  + 24.*dMult) 
7619                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7620   // to be polished:
7621   five5n5n4n4n2n = (reQ5nQ5nQ4nstarQ4nstarQ2nstar
7622                  - reQ6nQ4nQ5nstarQ5nstar-reQ6nQ4nQ5nstarQ5nstar-reQ8nQ2nQ5nstarQ5nstar
7623                                  - reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ4nstarQ2nstar-reQ5nQ3nQ4nstarQ4nstar                  
7624                                  - reQ10nQ4nstarQ4nstarQ2nstar-reQ5nQ3nQ4nstarQ4nstar-reQ5nQ1nQ4nstarQ2nstar-reQ5nQ1nQ4nstarQ2nstar
7625                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ10nQ5nstarQ5nstar)
7626                                  + reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ8nQ5nstarQ3nstar
7627                                  + reQ10nQ8nstarQ2nstar+reQ10nQ6nstarQ4nstar+reQ10nQ6nstarQ4nstar
7628                                  + reQ6nQ5nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ4nQ3nstarQ1nstar
7629                                  + reQ6nQ5nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ4nQ3nstarQ1nstar
7630                                  + reQ8nQ5nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
7631                                  + 2.*(reQ8nQ4nstarQ4nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar)
7632                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar)
7633                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7634                                  - 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.))
7635                                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.))
7636                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
7637                                  - 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.))
7638                                  + 24.*dMult) 
7639                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7640   // to be polished:
7641   five5n5n5n3n2n = (reQ5nQ5nQ5nstarQ3nstarQ2nstar
7642                  - reQ7nQ3nQ5nstarQ5nstar
7643                  - reQ8nQ2nQ5nstarQ5nstar
7644                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7645                  - reQ10nQ5nstarQ3nstarQ2nstar 
7646                                  - dMult*reQ5nQ3nstarQ2nstar
7647                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7648                  + reQ5nQ3nstarQ2nstar
7649                  + reQ10nQ5nstarQ5nstar
7650                  + 3.*dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7651                  + 2.*reQ10nQ5nstarQ5nstar
7652                  + reQ7nQ5nstarQ2nstar
7653                  + reQ10nQ7nstarQ3nstar
7654                  + reQ8nQ5nstarQ3nstar
7655                  + reQ5nQ3nstarQ2nstar
7656                  + reQ10nQ8nstarQ2nstar
7657                  + dMult*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7658                  - (dMult-6.)*reQ5nQ3nstarQ2nstar
7659                  + 3.*reQ7nQ5nstarQ2nstar
7660                  + reQ5nQ3nstarQ2nstar
7661                  + 2.*reQ5nQ3nstarQ2nstar
7662                  + 3.*reQ8nQ5nstarQ3nstar
7663                  + dMult*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7664                  + reQ5nQ3nstarQ2nstar
7665                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7666                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7667                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7668                                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
7669                  - 2.*dMult*dMult 
7670                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
7671                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7672                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
7673                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7674                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7675                  + (dMult-8.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
7676                  + (dMult-8.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7677                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
7678                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7679   // to be polished:
7680   five5n5n5n4n1n = (reQ5nQ5nQ5nstarQ4nstarQ1nstar
7681                  - reQ6nQ4nQ5nstarQ5nstar
7682                  - reQ9nQ1nQ5nstarQ5nstar
7683                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7684                  - reQ10nQ5nstarQ4nstarQ1nstar 
7685                                  - dMult*reQ5nQ4nstarQ1nstar
7686                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7687                  + reQ5nQ4nstarQ1nstar
7688                  + reQ10nQ5nstarQ5nstar
7689                  + 3.*dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7690                  + 2.*reQ10nQ5nstarQ5nstar
7691                  + reQ6nQ5nstarQ1nstar
7692                  + reQ10nQ6nstarQ4nstar
7693                  + reQ9nQ5nstarQ4nstar
7694                  + reQ5nQ4nstarQ1nstar
7695                  + reQ10nQ9nstarQ1nstar
7696                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7697                  - (dMult-6.)*reQ5nQ4nstarQ1nstar
7698                  + 3.*reQ6nQ5nstarQ1nstar
7699                  + reQ5nQ4nstarQ1nstar
7700                  + 2.*reQ5nQ4nstarQ1nstar
7701                  + 3.*reQ9nQ5nstarQ4nstar
7702                  + dMult*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7703                  + reQ5nQ4nstarQ1nstar
7704                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7705                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7706                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7707                                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
7708                  - 2.*dMult*dMult 
7709                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
7710                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7711                  - 2.*(pow(dReQ9n,2.)+pow(dImQ9n,2.)) 
7712                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7713                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7714                  + (dMult-8.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7715                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7716                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
7717                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7718   five6n2n2n1n1n = // calculated by Peter Jochumzsen 
7719                  (pow(dReQ1n*dReQ2n,2.)*dReQ6n-pow(dReQ2n*dImQ1n,2.)*dReQ6n
7720                  - 4.*dReQ1n*dReQ2n*dReQ6n*dImQ1n*dImQ2n 
7721                  - pow(dReQ1n*dImQ2n,2.)*dReQ6n+pow(dImQ1n*dImQ2n,2.)*dReQ6n
7722                  + 2.*dReQ1n*pow(dReQ2n,2.)*dImQ1n*dImQ6n+2.*pow(dReQ1n,2.)*dReQ2n*dImQ2n*dImQ6n 
7723                  - 2.*dReQ2n*pow(dImQ1n,2.)*dImQ2n*dImQ6n-2.*dReQ1n*dImQ1n*pow(dImQ2n,2.)*dImQ6n
7724                  + 2.*(pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dReQ2n) 
7725                  + 8.*(dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n+dImQ3n*dImQ2n*dReQ1n)
7726                  + 5.*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7727                  - (-pow(dImQ1n,2.)*dImQ4n*dImQ6n+dImQ4n*dImQ6n*pow(dReQ1n,2.) 
7728                  + 2.*dImQ1n*dImQ6n*dReQ1n*dReQ4n-2.*dImQ1n*dImQ4n*dReQ1n*dReQ6n 
7729                  - pow(dImQ1n,2.)*dReQ4n*dReQ6n+pow(dReQ1n,2.)*dReQ4n*dReQ6n)
7730                  + 2.*(pow(dReQ3n,2.)*dReQ6n+2.*dReQ3n*dImQ3n*dImQ6n-pow(dImQ3n,2.)*dReQ6n) 
7731                  - (dReQ6n*pow(dReQ2n,3.)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2.)
7732                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2.)-dImQ6n*pow(dImQ2n,3.))
7733                  + 4.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n) 
7734                  - 2.*((dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) 
7735                  + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n))
7736                  + 2.*(dReQ5n*dReQ4n*dReQ1n-dReQ5n*dImQ4n*dImQ1n+dImQ5n*dReQ4n*dImQ1n+dImQ5n*dImQ4n*dReQ1n)
7737                  - 2.*(-pow(dImQ2n,2.)*dImQ1n*dImQ5n+dImQ1n*dImQ5n*pow(dReQ2n,2.)
7738                  + 2.*dImQ2n*dImQ5n*dReQ2n*dReQ1n-2.*dImQ2n*dImQ1n*dReQ2n*dReQ5n 
7739                  - pow(dImQ2n,2.)*dReQ1n*dReQ5n+pow(dReQ2n,2.)*dReQ1n*dReQ5n) 
7740                  + 4.*(dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n)) 
7741                  + 4.*(dReQ5n*dReQ2n*dReQ3n-dReQ5n*dImQ2n*dImQ3n+dImQ5n*dReQ2n*dImQ3n+dImQ5n*dImQ2n*dReQ3n)
7742                  + 4.*(dReQ6n*dReQ5n*dReQ1n-dReQ6n*dImQ5n*dImQ1n+dImQ6n*dReQ5n*dImQ1n+dImQ6n*dImQ5n*dReQ1n)
7743                  - 4.*(dReQ1n*dReQ2n*dReQ3n*dReQ6n-dReQ3n*dReQ6n*dImQ1n*dImQ2n
7744                  - dReQ2n*dReQ6n*dImQ1n*dImQ3n-dReQ1n*dReQ6n*dImQ2n*dImQ3n
7745                  + dReQ2n*dReQ3n*dImQ1n*dImQ6n+dReQ1n*dReQ3n*dImQ2n*dImQ6n 
7746                  + dReQ1n*dReQ2n*dImQ3n*dImQ6n-dImQ1n*dImQ2n*dImQ3n*dImQ6n)
7747                  - 12.*pow(dReQ1n,2.)-12.*pow(dImQ1n,2.)-14.*pow(dReQ2n,2.)-14.*pow(dImQ2n,2.)
7748                  - 8.*pow(dReQ3n,2.)-8.*pow(dImQ3n,2.)-6.*pow(dReQ4n,2.)-6.*pow(dImQ4n,2.)
7749                  - 4.*pow(dReQ5n,2.)-4.*pow(dImQ5n,2.)-6.*pow(dReQ6n,2.)-6.*pow(dImQ6n,2.)+24.*dMult)
7750                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7751   // to be polished:
7752   five6n3n1n1n1n = (reQ6nQ3nstarQ1nstarQ1nstarQ1nstar
7753                  - reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar
7754                                  - reQ6nQ4nstarQ1nstarQ1nstar-reQ6nQ4nstarQ1nstarQ1nstar-reQ6nQ4nstarQ1nstarQ1nstar
7755                                  - reQ3nQ1nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar
7756                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ3nstarQ3nstar)
7757                                  + reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar
7758                                  + reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7759                                  + reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar
7760                                  + reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar
7761                                  + reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar
7762                  + 2.*(reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar)
7763                  + 2.*(reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
7764                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7765                  - 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.))
7766                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
7767                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.))
7768                                  - 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.))
7769                                  + 24.*dMult) 
7770                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7771
7772
7773   // to be polished:
7774   five6n1n1n4n4n = (reQ6nQ1nQ1nQ4nstarQ4nstar
7775                      - reQ6nQ2nQ4nstarQ4nstar-reQ7nQ1nQ4nstarQ4nstar-reQ7nQ1nQ4nstarQ4nstar
7776                                  - reQ6nQ1nQ4nstarQ3nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
7777                  - reQ8nQ6nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
7778                                  + 2.*(reQ6nQ4nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ8nQ4nstarQ4nstar)
7779                                  + reQ4nQ2nstarQ2nstar+reQ7nQ4nstarQ3nstar+reQ7nQ4nstarQ3nstar // ?? 1st term
7780                  + reQ8nQ7nstarQ1nstar+reQ8nQ6nstarQ2nstar+reQ8nQ7nstarQ1nstar
7781                                  + reQ4nQ2nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7782                                  + reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                                                           
7783                  + reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                           
7784                  + 2.*(reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ2nQ1nstarQ1nstar)
7785                  + 2.*(reQ6nQ4nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
7786                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7787                  - 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.))
7788                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
7789                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
7790                                  - 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.))
7791                                  + 24.*dMult) 
7792                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7793   
7794   // to be polished:
7795   five6n1n5n1n1n = (reQ6nQ1nQ5nstarQ1nstarQ1nstar
7796                  - reQ6nQ1nQ5nstarQ2nstar
7797                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7798                  - reQ6nQ4nstarQ1nstarQ1nstar
7799                  - reQ7nQ5nstarQ1nstarQ1nstar 
7800                              - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7801                  - dMult*reQ6nQ5nstarQ1nstar
7802                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7803                  + reQ7nQ6nstarQ1nstar
7804                  + 3.*reQ6nQ5nstarQ1nstar
7805                  + 2.*reQ7nQ6nstarQ1nstar
7806                  + reQ6nQ4nstarQ2nstar
7807                  + reQ7nQ5nstarQ2nstar
7808                  + dMult*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7809                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7810                  + reQ7nQ6nstarQ1nstar
7811                  + reQ5nQ4nstarQ1nstar
7812                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
7813                  + 3.*reQ2nQ1nstarQ1nstar
7814                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7815                  + 2.*reQ5nQ4nstarQ1nstar
7816                  + 3.*reQ6nQ5nstarQ1nstar
7817                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7818                  + reQ5nQ4nstarQ1nstar
7819                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7820                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7821                  - (pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7822                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.))
7823                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7824                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
7825                  - 2.*dMult*dMult
7826                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
7827                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7828                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7829                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7830                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7831                  + 2.*(dMult-6.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-2.*dMult*(dMult-12.)) 
7832                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7833   five6n2n4n2n2n = ((pow(dReQ2n,2.)+pow(dImQ2n,2.))*(dReQ2n*dReQ4n*dReQ6n-dReQ6n*dImQ2n*dImQ4n
7834                  + dReQ4n*dImQ2n*dImQ6n+dReQ2n*dImQ4n*dImQ6n)
7835                  - ((dReQ8n*dReQ4n+dImQ8n*dImQ4n)*(pow(dReQ2n,2)-pow(dImQ2n,2)) 
7836                  + 2.*dReQ2n*dImQ2n*(dImQ8n*dReQ4n-dReQ8n*dImQ4n)) 
7837                  - (dReQ6n*pow(dReQ2n,3)-3.*dReQ2n*dReQ6n*pow(dImQ2n,2)
7838                  + 3.*dImQ2n*dImQ6n*pow(dReQ2n,2)-dImQ6n*pow(dImQ2n,3))
7839                  - ((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
7840                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7841                  + 4.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7842                  + pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n
7843                  - (2.*dMult-13.)*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n
7844                  + dImQ6n*dImQ4n*dReQ2n)
7845                  + 7.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7846                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))
7847                  + 2.*(dMult-5.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7848                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7849                  + 2.*(dMult-6.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7850                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7851                  - pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)
7852                  + 2.*(3.*dMult-11.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*dMult*(dMult-6.))
7853                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7854   five6n4n4n4n2n = ((pow(dImQ4n,2.)+pow(dReQ4n,2.))*(dImQ4n*dImQ6n*dReQ2n+dImQ2n*dImQ6n*dReQ4n 
7855                  - dImQ2n*dImQ4n*dReQ6n+dReQ2n*dReQ4n*dReQ6n)
7856                  - (-pow(dImQ4n,2.)*dImQ2n*dImQ10n+dImQ2n*dImQ10n*pow(dReQ4n,2.)
7857                  + 2.*dImQ4n*dImQ10n*dReQ4n*dReQ2n-2.*dImQ4n*dImQ2n*dReQ4n*dReQ10n 
7858                  - pow(dImQ4n,2.)*dReQ2n*dReQ10n+pow(dReQ4n,2.)*dReQ2n*dReQ10n)
7859                  - (dImQ2n*dImQ4n*dImQ6n*dImQ8n+dImQ6n*dImQ8n*dReQ2n*dReQ4n 
7860                  + dImQ4n*dImQ8n*dReQ2n*dReQ6n-dImQ2n*dImQ8n*dReQ4n*dReQ6n
7861                  - dImQ4n*dImQ6n*dReQ2n*dReQ8n+dImQ2n*dImQ6n*dReQ4n*dReQ8n 
7862                  + dImQ2n*dImQ4n*dReQ6n*dReQ8n+dReQ2n*dReQ4n*dReQ6n*dReQ8n)
7863                  - ((pow(dReQ4n,2.)-pow(dImQ4n,2.))*(dReQ6n*dReQ2n-dImQ6n*dImQ2n) 
7864                  + 2.*dReQ4n*dImQ4n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7865                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7866                  + (dReQ10n*dReQ8n*dReQ2n-dReQ10n*dImQ8n*dImQ2n+dImQ10n*dReQ8n*dImQ2n+dImQ10n*dImQ8n*dReQ2n)
7867                  + 4.*(dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
7868                  + dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n)
7869                  + 3.*(pow(dReQ4n,2.)*dReQ8n+2.*dReQ4n*dImQ4n*dImQ8n-pow(dImQ4n,2.)*dReQ8n)
7870                  - 2.*(dMult-6.)*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7871                  + 4.*(pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n)
7872                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
7873                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))+2.*(dMult-5.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7874                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7875                  - pow((pow(dReQ4n,2.)+pow(dImQ4n,2.)),2.)+2.*(3.*dMult-10.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7876                  + 2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*dMult*(dMult-6.))
7877                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7878   // to be polished:
7879   five6n2n2n5n5n = (reQ6nQ2nQ2nQ5nstarQ5nstar
7880                  - reQ6nQ4nQ5nstarQ5nstar-reQ8nQ2nQ5nstarQ5nstar-reQ8nQ2nQ5nstarQ5nstar
7881                                  - reQ6nQ2nQ5nstarQ3nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ6nQ2nQ5nstarQ3nstar
7882                                  - reQ10nQ6nstarQ2nstarQ2nstar-reQ6nQ2nQ5nstarQ3nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ6nQ2nQ5nstarQ3nstar
7883                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ10nQ5nstarQ5nstar)
7884                                  + reQ5nQ4nstarQ1nstar+reQ8nQ5nstarQ3nstar+reQ8nQ5nstarQ3nstar
7885                  + reQ10nQ8nstarQ2nstar+reQ10nQ6nstarQ4nstar+reQ10nQ8nstarQ2nstar
7886                                  + reQ5nQ4nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
7887                                  + reQ8nQ5nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                                                           
7888                                  + reQ8nQ5nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                           
7889                  + 2.*(reQ8nQ6nstarQ2nstar+reQ8nQ6nstarQ2nstar+reQ4nQ2nstarQ2nstar)
7890                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar)
7891                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7892                  - 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.))
7893                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.))
7894                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
7895                                  - 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.))
7896                                  + 24.*dMult) 
7897                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7898   // to be polished:
7899   five6n5n5n5n1n = (reQ6nQ5nQ5nstarQ5nstarQ1nstar
7900                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7901                  - reQ10nQ1nQ6nstarQ5nstar
7902                  - dMult*reQ6nQ5nstarQ1nstar
7903                  - reQ11nQ5nstarQ5nstarQ1nstar 
7904                              - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7905                  - reQ6nQ4nQ5nstarQ5nstar
7906                  + reQ5nQ4nstarQ1nstar
7907                  + reQ11nQ6nstarQ5nstar
7908                  + 3.*reQ6nQ5nstarQ1nstar
7909                  + 2.*reQ11nQ6nstarQ5nstar
7910                  + dMult*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7911                  + reQ11nQ6nstarQ5nstar
7912                  + reQ10nQ6nstarQ4nstar
7913                  + reQ5nQ4nstarQ1nstar
7914                  + reQ11nQ10nstarQ1nstar
7915                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7916                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
7917                  + 3.*reQ6nQ5nstarQ1nstar
7918                  + reQ5nQ4nstarQ1nstar
7919                  + 2.*dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7920                  + 3.*reQ10nQ5nstarQ5nstar
7921                  + reQ5nQ4nstarQ1nstar
7922                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7923                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7924                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7925                  - (pow(dReQ5n,2.)+pow(dImQ5n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7926                                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.))
7927                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7928                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.)) 
7929                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7930                  - 2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.)) 
7931                  - 2.*dMult*dMult
7932                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7933                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7934                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7935                  + 2.*(dMult-6.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))-2.*dMult*(dMult-12.)) 
7936                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7937   // to be polished:
7938   five6n6n5n5n2n = (reQ6nQ6nQ5nstarQ5nstarQ2nstar
7939                  - reQ7nQ5nQ6nstarQ6nstar-reQ7nQ5nQ6nstarQ6nstar-reQ10nQ2nQ6nstarQ6nstar
7940                  - reQ6nQ1nQ5nstarQ2nstar-reQ6nQ1nQ5nstarQ2nstar-reQ6nQ4nQ5nstarQ5nstar
7941                                  - reQ12nQ5nstarQ5nstarQ2nstar-reQ6nQ4nQ5nstarQ5nstar-reQ6nQ1nQ5nstarQ2nstar-reQ6nQ1nQ5nstarQ2nstar
7942                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ12nQ6nstarQ6nstar)
7943                                  + reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ10nQ6nstarQ4nstar
7944                  + reQ12nQ10nstarQ2nstar+reQ12nQ7nstarQ5nstar+reQ12nQ7nstarQ5nstar
7945                                  + reQ7nQ6nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ5nQ4nstarQ1nstar                           
7946                                  + reQ7nQ6nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ5nQ4nstarQ1nstar
7947                                  + reQ10nQ6nstarQ4nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar                          
7948                  + 2.*(reQ10nQ5nstarQ5nstar+reQ7nQ5nstarQ2nstar+reQ7nQ5nstarQ2nstar)
7949                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar)
7950                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7951                  - 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.))
7952                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ10n,2.)+pow(dImQ10n,2.))
7953                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
7954                                  - 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.))
7955                                  + 24.*dMult) 
7956                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7957   five6n6n6n4n2n = ((pow(dImQ6n,2.)+pow(dReQ6n,2.))*(dImQ4n*dImQ6n*dReQ2n+dImQ2n*dImQ6n*dReQ4n
7958                  - dImQ2n*dImQ4n*dReQ6n+dReQ2n*dReQ4n*dReQ6n)
7959                  - (dReQ2n*dReQ4n*dReQ6n*dReQ12n-dReQ6n*dReQ12n*dImQ2n*dImQ4n
7960                  - dReQ4n*dReQ12n*dImQ2n*dImQ6n-dReQ2n*dReQ12n*dImQ4n*dImQ6n
7961                  + dReQ4n*dReQ6n*dImQ2n*dImQ12n+dReQ2n*dReQ6n*dImQ4n*dImQ12n 
7962                  + dReQ2n*dReQ4n*dImQ6n*dImQ12n-dImQ2n*dImQ4n*dImQ6n*dImQ12n)
7963                  - (dImQ2n*pow(dImQ6n,2.)*dImQ10n+2.*dImQ6n*dImQ10n*dReQ2n*dReQ6n
7964                  - dImQ2n*dImQ10n*pow(dReQ6n,2.)-pow(dImQ6n,2.)*dReQ2n*dReQ10n 
7965                  + 2.*dImQ2n*dImQ6n*dReQ6n*dReQ10n+dReQ2n*pow(dReQ6n,2.)*dReQ10n)
7966                  - ((dReQ8n*dReQ4n-dImQ8n*dImQ4n)*(dReQ6n*dReQ6n-dImQ6n*dImQ6n)
7967                  + 2.*(dReQ8n*dImQ4n+dImQ8n*dReQ4n)*dReQ6n*dImQ6n)
7968                  + dReQ12n*dReQ10n*dReQ2n-dReQ12n*dImQ10n*dImQ2n+dImQ12n*dReQ10n*dImQ2n+dImQ12n*dImQ10n*dReQ2n
7969                  + dReQ12n*dReQ8n*dReQ4n-dReQ12n*dImQ8n*dImQ4n+dImQ12n*dReQ8n*dImQ4n+dImQ12n*dImQ8n*dReQ4n
7970                  + 3.*(pow(dReQ6n,2.)*dReQ12n+2.*dReQ6n*dImQ6n*dImQ12n-pow(dImQ6n,2.)*dReQ12n)
7971                  + 4.*(dReQ10n*dReQ4n*dReQ6n-dReQ10n*dImQ4n*dImQ6n+dImQ10n*dReQ4n*dImQ6n+dImQ10n*dImQ4n*dReQ6n)
7972                  + 4.*(dReQ8n*(dReQ6n*dReQ2n-dImQ6n*dImQ2n)+dImQ8n*(dReQ6n*dImQ2n+dImQ6n*dReQ2n))
7973                  - 2.*(dMult-6.)*(dReQ6n*dReQ4n*dReQ2n-dReQ6n*dImQ4n*dImQ2n+dImQ6n*dReQ4n*dImQ2n+dImQ6n*dImQ4n*dReQ2n)
7974                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ4n,2.)+pow(dImQ4n,2.)) 
7975                  - 2.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
7976                  - 2.*(pow(dReQ12n,2.)+pow(dImQ12n,2.))-2.*(pow(dReQ10n,2.)+pow(dImQ10n,2.))
7977                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.))+2.*(3.*dMult-10.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7978                  - pow((pow(dReQ6n,2.)+pow(dImQ6n,2.)),2.)+2.*(dMult-5.)*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
7979                  + 2.*(dMult-5.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*dMult*(dMult-6.))
7980                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
7981   // to be polished (and  TBI swap with the one above):
7982   five6n6n6n5n1n = (reQ6nQ6nQ6nstarQ5nstarQ1nstar
7983                  - reQ7nQ5nQ6nstarQ6nstar
7984                  - reQ11nQ1nQ6nstarQ6nstar
7985                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7986                  - reQ12nQ6nstarQ5nstarQ1nstar 
7987                              - dMult*reQ6nQ5nstarQ1nstar
7988                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
7989                  + reQ6nQ5nstarQ1nstar
7990                  + reQ12nQ6nstarQ6nstar
7991                  + 3.*dMult*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
7992                  + 2.*reQ12nQ6nstarQ6nstar
7993                  + reQ7nQ6nstarQ1nstar
7994                  + reQ12nQ7nstarQ5nstar
7995                  + reQ11nQ6nstarQ5nstar
7996                  + reQ6nQ5nstarQ1nstar
7997                  + reQ12nQ11nstarQ1nstar
7998                  + dMult*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
7999                  - (dMult-6.)*reQ6nQ5nstarQ1nstar
8000                  + 3.*reQ7nQ6nstarQ1nstar
8001                  + reQ6nQ5nstarQ1nstar
8002                  + 2.*reQ6nQ5nstarQ1nstar
8003                  + 3.*reQ11nQ6nstarQ5nstar
8004                  + dMult*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8005                  + reQ6nQ5nstarQ1nstar
8006                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8007                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8008                  - (pow(dReQ6n,2.)+pow(dImQ6n,2.))*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8009                                  - 2.*(pow(dReQ12n,2.)+pow(dImQ12n,2.))
8010                  - 2.*dMult*dMult
8011                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
8012                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8013                  - 2.*(pow(dReQ11n,2.)+pow(dImQ11n,2.)) 
8014                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8015                  + (dMult-8.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8016                  + (dMult-8.)*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8017                  + (dMult-8.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
8018                  + 2.*(dMult-6.)*(pow(dReQ6n,2.)+pow(dImQ6n,2.))-2.*dMult*(dMult-12.)) 
8019                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8020   // Four distinct harmonics (11):
8021   // to be polished:
8022   five5n2n3n3n1n = (reQ5nQ2nQ3nstarQ3nstarQ1nstar
8023                  - reQ5nQ2nQ4nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar-reQ6nQ1nQ5nstarQ2nstar
8024                                  - reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ5nQ1nQ3nstarQ3nstar                  
8025                                  - reQ7nQ3nstarQ3nstarQ1nstar-reQ4nQ2nQ3nstarQ3nstar-reQ3nQ1nQ2nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar
8026                                  + 2.*(reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ7nQ5nstarQ2nstar)
8027                                  + reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ6nQ5nstarQ1nstar
8028                                  + reQ7nQ6nstarQ1nstar+reQ7nQ4nstarQ3nstar+reQ7nQ4nstarQ3nstar
8029                                  + reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar
8030                                  + reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar
8031                                  + reQ6nQ4nstarQ2nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
8032                                  + 2.*(reQ6nQ3nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8033                                  + 2.*(reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8034                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8035                                  - 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.))
8036                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
8037                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8038                                  - 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.))
8039                                  + 24.*dMult) 
8040                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8041   // to be polished:
8042   five5n1n1n4n3n = (reQ5nQ1nQ1nQ4nstarQ3nstar
8043                  - reQ5nQ2nQ4nstarQ3nstar-reQ6nQ1nQ4nstarQ3nstar-reQ6nQ1nQ4nstarQ3nstar
8044                                  - reQ5nQ1nQ4nstarQ2nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar
8045                                  - reQ7nQ5nstarQ1nstarQ1nstar-reQ5nQ1nQ3nstarQ3nstar-reQ3nQ1nstarQ1nstarQ1nstar-reQ5nQ1nQ3nstarQ3nstar
8046                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ7nQ4nstarQ3nstar)
8047                                  + reQ4nQ2nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar
8048                  + reQ7nQ6nstarQ1nstar+reQ7nQ5nstarQ2nstar+reQ7nQ6nstarQ1nstar
8049                                  + reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar
8050                                  + reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar                                                                                           
8051                                  + reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar                                                           
8052                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8053                  + 2.*(reQ5nQ3nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8054                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8055                                  - 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.))
8056                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
8057                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))
8058                                  - 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.))
8059                                  + 24.*dMult) 
8060                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8061   // to be polished:
8062   five5n3n4n2n2n = (reQ5nQ3nQ4nstarQ2nstarQ2nstar
8063                  - reQ5nQ3nQ4nstarQ4nstar-reQ6nQ2nQ5nstarQ3nstar-reQ6nQ2nQ5nstarQ3nstar
8064                                  - reQ5nQ1nQ4nstarQ2nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar                      
8065                                  - reQ8nQ4nstarQ2nstarQ2nstar-reQ4nQ2nQ3nstarQ3nstar-reQ3nQ1nQ2nstarQ2nstar-reQ4nQ2nQ3nstarQ3nstar
8066                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ8nQ5nstarQ3nstar)
8067                                  + reQ5nQ4nstarQ1nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar
8068                  + reQ8nQ6nstarQ2nstar+reQ8nQ4nstarQ4nstar+reQ8nQ6nstarQ2nstar
8069                                  + reQ4nQ3nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar
8070                                  + reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar
8071                                  + reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar
8072                                  + 2.*(reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ4nQ2nstarQ2nstar)
8073                                  + 2.*(reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8074                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8075                                  - 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.))
8076                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.))
8077                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8078                                  - 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.))
8079                                  + 24.*dMult) 
8080                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8081
8082   // to be polished!!!:
8083   five5n2n1n4n4n = (reQ5nQ2nQ1nQ4nstarQ4nstar
8084                  - reQ5nQ3nQ4nstarQ4nstar-reQ6nQ2nQ4nstarQ4nstar-reQ7nQ1nQ4nstarQ4nstar
8085                                  - reQ5nQ1nQ4nstarQ2nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ5nQ2nQ4nstarQ3nstar
8086                                  - reQ8nQ5nstarQ2nstarQ1nstar-reQ5nQ2nQ4nstarQ3nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ5nQ1nQ4nstarQ2nstar
8087                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ8nQ4nstarQ4nstar)
8088                                  + reQ4nQ3nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ7nQ4nstarQ3nstar
8089                  + reQ8nQ7nstarQ1nstar+reQ8nQ5nstarQ3nstar+reQ8nQ6nstarQ2nstar
8090                                  + reQ4nQ3nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar
8091                                  + reQ6nQ4nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ5nQ3nstarQ2nstar                                                                                           
8092                                  + reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar                                                           
8093                  + 2.*(reQ7nQ5nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8094                  + 2.*(reQ5nQ4nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar)
8095                                  - 6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
8096                                  - 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.))
8097                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ6n,2.)+pow(dImQ6n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
8098                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8099                                  - 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.))
8100                                  + 24.*dMult) 
8101                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8102
8103
8104   // to be polished:
8105   five6n1n3n2n2n = (reQ6nQ1nQ3nstarQ2nstarQ2nstar
8106                  - reQ6nQ1nQ4nstarQ3nstar-reQ6nQ1nQ5nstarQ2nstar-reQ6nQ1nQ5nstarQ2nstar
8107                  - reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ2nstarQ2nstarQ2nstar-reQ6nQ3nstarQ2nstarQ1nstar                      
8108                                  - reQ7nQ3nstarQ2nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar-reQ3nQ1nQ2nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar
8109                                  + 2.*(reQ6nQ3nstarQ3nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ7nQ6nstarQ1nstar)
8110                                  + reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar
8111                  + reQ7nQ5nstarQ2nstar+reQ7nQ4nstarQ3nstar+reQ7nQ5nstarQ2nstar
8112                                  + reQ4nQ3nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar
8113                                  + reQ5nQ4nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar
8114                                  + reQ5nQ4nstarQ1nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar
8115                                  + 2.*(reQ5nQ3nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ4nQ2nstarQ2nstar)
8116                                  + 2.*(reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8117                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8118                                  - 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.))
8119                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.))
8120                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
8121                                  - 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.))
8122                                  + 24.*dMult) 
8123                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8124
8125
8126   // to be polished:
8127   five6n3n4n4n1n = (reQ6nQ3nQ4nstarQ4nstarQ1nstar
8128                  - reQ8nQ1nQ6nstarQ3nstar-reQ6nQ3nQ5nstarQ4nstar-reQ6nQ3nQ5nstarQ4nstar
8129                                  - reQ6nQ4nstarQ1nstarQ1nstar-reQ6nQ2nQ4nstarQ4nstar-reQ6nQ4nstarQ1nstarQ1nstar                  
8130                                  - reQ9nQ4nstarQ4nstarQ1nstar-reQ4nQ1nQ3nstarQ2nstar-reQ5nQ3nQ4nstarQ4nstar-reQ4nQ1nQ3nstarQ2nstar
8131                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ9nQ6nstarQ3nstar)
8132                                  + reQ8nQ6nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ6nQ5nstarQ1nstar
8133                  + reQ9nQ5nstarQ4nstar+reQ9nQ8nstarQ1nstar+reQ9nQ5nstarQ4nstar
8134                                  + reQ8nQ5nstarQ3nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar                           
8135                                  + reQ5nQ3nstarQ2nstar+reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar                           
8136                                  + reQ5nQ3nstarQ2nstar+reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar
8137                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ8nQ4nstarQ4nstar)
8138                  + 2.*(reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8139                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8140                                  - 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.))
8141                                  - 2.*(pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.))
8142                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
8143                                  - 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.))
8144                  + 24.*dMult) 
8145                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8146
8147   // to be polished:
8148   five6n1n1n5n3n = (reQ6nQ1nQ1nQ5nstarQ3nstar
8149                  - reQ6nQ2nQ5nstarQ3nstar-reQ7nQ1nQ5nstarQ3nstar-reQ7nQ1nQ5nstarQ3nstar
8150                  - reQ6nQ1nQ5nstarQ2nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ6nQ1nQ5nstarQ2nstar
8151                                  - reQ8nQ6nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar-reQ3nQ1nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
8152                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ8nQ5nstarQ3nstar)
8153                                  + reQ5nQ3nstarQ2nstar+reQ7nQ5nstarQ2nstar+reQ7nQ5nstarQ2nstar
8154                  + reQ8nQ7nstarQ1nstar+reQ8nQ6nstarQ2nstar+reQ8nQ7nstarQ1nstar
8155                                  + reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar
8156                                  + reQ7nQ4nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ6nQ4nstarQ2nstar                                                                                           
8157                                  + reQ7nQ4nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ6nQ4nstarQ2nstar                                                                                           
8158                  + 2.*(reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ2nQ1nstarQ1nstar)
8159                  + 2.*(reQ6nQ3nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8160                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8161                                  - 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.))
8162                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
8163                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ3n,2.)+pow(dImQ3n,2.))
8164                  - 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.))
8165                  + 24.*dMult) 
8166                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8167   // to be polished:
8168   five6n3n5n2n2n = (reQ6nQ3nQ5nstarQ2nstarQ2nstar
8169                  - reQ6nQ3nQ5nstarQ4nstar-reQ7nQ2nQ6nstarQ3nstar-reQ7nQ2nQ6nstarQ3nstar
8170                  - reQ6nQ1nQ5nstarQ2nstar-reQ6nQ2nstarQ2nstarQ2nstar-reQ6nQ1nQ5nstarQ2nstar                      
8171                                  - reQ9nQ5nstarQ2nstarQ2nstar-reQ5nQ2nQ4nstarQ3nstar-reQ3nQ1nQ2nstarQ2nstar-reQ5nQ2nQ4nstarQ3nstar
8172                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ4nstarQ2nstar+reQ9nQ6nstarQ3nstar)
8173                                  + reQ6nQ4nstarQ2nstar+reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar
8174                  + reQ9nQ7nstarQ2nstar+reQ9nQ5nstarQ4nstar+reQ9nQ7nstarQ2nstar
8175                                  + reQ4nQ3nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ2nQ1nstarQ1nstar                           
8176                                  + reQ7nQ4nstarQ3nstar+reQ4nQ2nstarQ2nstar+reQ5nQ4nstarQ1nstar                           
8177                                  + reQ7nQ4nstarQ3nstar+reQ4nQ2nstarQ2nstar+reQ5nQ4nstarQ1nstar
8178                  + 2.*(reQ7nQ5nstarQ2nstar+reQ7nQ5nstarQ2nstar+reQ4nQ2nstarQ2nstar)
8179                  + 2.*(reQ5nQ3nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8180                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8181                                  - 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.))
8182                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.))
8183                                  - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
8184                                  - 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.))
8185                  + 24.*dMult) 
8186                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8187
8188   // to be polished 
8189   five6n5n4n4n3n = (reQ6nQ5nQ4nstarQ4nstarQ3nstar
8190                  - reQ7nQ4nQ6nstarQ5nstar-reQ7nQ4nQ6nstarQ5nstar-reQ8nQ3nQ6nstarQ5nstar
8191                  - reQ6nQ1nQ4nstarQ3nstar-reQ6nQ1nQ4nstarQ3nstar-reQ6nQ2nQ4nstarQ4nstar                  
8192                                  - reQ11nQ4nstarQ4nstarQ3nstar-reQ5nQ3nQ4nstarQ4nstar-reQ5nQ2nQ4nstarQ3nstar-reQ5nQ2nQ4nstarQ3nstar
8193                                  + 2.*(reQ6nQ4nstarQ2nstar+reQ6nQ3nstarQ3nstar+reQ6nQ4nstarQ2nstar+reQ11nQ6nstarQ5nstar)
8194                                  + reQ7nQ6nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ8nQ6nstarQ2nstar
8195                  + reQ11nQ8nstarQ3nstar+reQ11nQ7nstarQ4nstar+reQ11nQ7nstarQ4nstar
8196                                  + reQ7nQ5nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ2nstarQ2nstar                                                           
8197                                  + reQ7nQ5nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ2nstarQ2nstar                           
8198                                  + reQ8nQ5nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ4nQ3nstarQ1nstar
8199                  + 2.*(reQ8nQ4nstarQ4nstar+reQ7nQ4nstarQ3nstar+reQ7nQ4nstarQ3nstar)
8200                  + 2.*(reQ5nQ4nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar)
8201                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8202                                  - 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.))
8203                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.))
8204                                  - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))                                
8205                                  - 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.))
8206                                  + 24.*dMult) 
8207                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8208   // to be polished:
8209   five6n3n1n5n5n = (reQ6nQ3nQ1nQ5nstarQ5nstar
8210                  - reQ6nQ4nQ5nstarQ5nstar-reQ7nQ3nQ5nstarQ5nstar-reQ9nQ1nQ5nstarQ5nstar      
8211                                  - reQ6nQ1nQ5nstarQ2nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ6nQ3nQ5nstarQ4nstar
8212                                  - reQ10nQ6nstarQ3nstarQ1nstar-reQ6nQ3nQ5nstarQ4nstar-reQ5nQ3nstarQ1nstarQ1nstar-reQ6nQ1nQ5nstarQ2nstar
8213                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ10nQ5nstarQ5nstar)
8214                                  + reQ5nQ4nstarQ1nstar+reQ7nQ5nstarQ2nstar+reQ9nQ5nstarQ4nstar
8215                  + reQ10nQ9nstarQ1nstar+reQ10nQ6nstarQ4nstar+reQ10nQ7nstarQ3nstar
8216                                  + reQ5nQ4nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ4nQ3nstarQ1nstar
8217                                  + reQ7nQ5nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ6nQ4nstarQ2nstar                                                                                           
8218                                  + reQ9nQ5nstarQ4nstar+reQ4nQ3nstarQ1nstar+reQ6nQ4nstarQ2nstar                                                                                           
8219                  + 2.*(reQ9nQ6nstarQ3nstar+reQ7nQ6nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8220                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar)
8221                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8222                                  - 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.))
8223                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ9n,2.)+pow(dImQ9n,2.))
8224                                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))
8225                  - 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.))
8226                  + 24.*dMult) 
8227                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8228   // to be polished:
8229   five6n6n5n4n3n = (reQ6nQ6nQ5nstarQ4nstarQ3nstar
8230                  - reQ7nQ5nQ6nstarQ6nstar-reQ8nQ4nQ6nstarQ6nstar-reQ9nQ3nQ6nstarQ6nstar
8231                                  - reQ6nQ2nQ5nstarQ3nstar-reQ6nQ1nQ4nstarQ3nstar-reQ6nQ3nQ5nstarQ4nstar                  
8232                                  - reQ12nQ5nstarQ4nstarQ3nstar-reQ6nQ3nQ5nstarQ4nstar-reQ6nQ1nQ4nstarQ3nstar-reQ6nQ2nQ5nstarQ3nstar
8233                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ3nstarQ3nstar+reQ6nQ4nstarQ2nstar+reQ12nQ6nstarQ6nstar)
8234                                  + reQ7nQ6nstarQ1nstar+reQ8nQ6nstarQ2nstar+reQ9nQ6nstarQ3nstar
8235                  + reQ12nQ9nstarQ3nstar+reQ12nQ7nstarQ5nstar+reQ12nQ8nstarQ4nstar
8236                                  + reQ7nQ6nstarQ1nstar+reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar                                                           
8237                                  + reQ8nQ6nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar                           
8238                                  + reQ9nQ6nstarQ3nstar+reQ4nQ3nstarQ1nstar+reQ5nQ3nstarQ2nstar
8239                  + 2.*(reQ9nQ5nstarQ4nstar+reQ8nQ5nstarQ3nstar+reQ7nQ4nstarQ3nstar)
8240                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ3nstarQ3nstar)
8241                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8242                                  - 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.))
8243                                  - 2.*(pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.)+pow(dReQ9n,2.)+pow(dImQ9n,2.))
8244                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.))                                
8245                                  - 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.))
8246                                  + 24.*dMult) 
8247                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8248   // Five distinct harmonics (3):
8249
8250   // to be polished:
8251   five6n2n4n3n1n = (reQ6nQ2nQ4nstarQ3nstarQ1nstar
8252                      - reQ6nQ2nQ4nstarQ4nstar-reQ6nQ2nQ5nstarQ3nstar-reQ7nQ1nQ6nstarQ2nstar
8253                      - reQ6nQ4nstarQ1nstarQ1nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
8254                      - reQ8nQ4nstarQ3nstarQ1nstar-reQ5nQ2nQ4nstarQ3nstar-reQ3nQ1nQ2nstarQ2nstar-reQ4nQ1nQ3nstarQ2nstar
8255                                  + 2.*(reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ6nQ3nstarQ3nstar+reQ8nQ6nstarQ2nstar)
8256                                  + 1.*(reQ6nQ4nstarQ2nstar+reQ6nQ5nstarQ1nstar+reQ7nQ6nstarQ1nstar)
8257                                  + 1.*(reQ8nQ7nstarQ1nstar+reQ8nQ4nstarQ4nstar+reQ8nQ5nstarQ3nstar)
8258                                  + 1.*(reQ4nQ2nstarQ2nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8259                                  + 1.*(reQ5nQ3nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8260                                  + 1.*(reQ7nQ5nstarQ2nstar+reQ5nQ3nstarQ2nstar+reQ5nQ4nstarQ1nstar)
8261                                  + 2.*(reQ7nQ4nstarQ3nstar+reQ5nQ4nstarQ1nstar+reQ4nQ3nstarQ1nstar)
8262                                  + 2.*(reQ4nQ2nstarQ2nstar+reQ3nQ2nstarQ1nstar+reQ2nQ1nstarQ1nstar) // 3 - 1
8263                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8264                  - 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.)) 
8265                  - 2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.)+pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)) 
8266                          - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)) 
8267                  - 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.)) 
8268                  + 24.*dMult) 
8269                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8270
8271
8272   // to be polished:
8273   five6n2n1n5n4n = (reQ6nQ2nQ1nQ5nstarQ4nstar
8274                  - reQ6nQ3nQ5nstarQ4nstar-reQ7nQ2nQ5nstarQ4nstar-reQ8nQ1nQ5nstarQ4nstar
8275                                  - reQ6nQ1nQ5nstarQ2nstar-reQ5nQ2nstarQ2nstarQ1nstar-reQ6nQ2nQ5nstarQ3nstar                      
8276                                  - reQ9nQ6nstarQ2nstarQ1nstar-reQ6nQ2nQ4nstarQ4nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ6nQ1nQ4nstarQ3nstar
8277                  + 2.*(reQ6nQ5nstarQ1nstar+reQ5nQ4nstarQ1nstar+reQ5nQ3nstarQ2nstar+reQ9nQ5nstarQ4nstar)
8278                                  + reQ5nQ3nstarQ2nstar+reQ7nQ5nstarQ2nstar+reQ8nQ5nstarQ3nstar
8279                  + reQ9nQ8nstarQ1nstar+reQ9nQ6nstarQ3nstar+reQ9nQ7nstarQ2nstar
8280                                  + reQ4nQ3nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar                           
8281                                  + reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ6nQ3nstarQ3nstar                           
8282                                  + reQ8nQ4nstarQ4nstar+reQ4nQ2nstarQ2nstar+reQ6nQ4nstarQ2nstar
8283                  + 2.*(reQ8nQ6nstarQ2nstar+reQ7nQ6nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8284                  + 2.*(reQ6nQ4nstarQ2nstar+reQ4nQ2nstarQ2nstar+reQ4nQ3nstarQ1nstar)
8285                                  - 6.*(pow(dReQ5n,2.)+pow(dImQ5n,2.))
8286                                  - 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.))
8287                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.))
8288                                  - 2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ2n,2.)+pow(dImQ2n,2.))                                
8289                                  - 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.))
8290                  + 24.*dMult) 
8291                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8292
8293
8294
8295   // to be polished:
8296   five6n4n5n3n2n = (reQ6nQ4nQ5nstarQ3nstarQ2nstar
8297                      - reQ6nQ4nQ5nstarQ5nstar-reQ7nQ3nQ6nstarQ4nstar-reQ8nQ2nQ6nstarQ4nstar
8298                      - reQ6nQ1nQ5nstarQ2nstar-reQ6nQ3nstarQ2nstarQ1nstar-reQ6nQ2nQ5nstarQ3nstar
8299                      - reQ10nQ5nstarQ3nstarQ2nstar-reQ5nQ3nQ4nstarQ4nstar-reQ4nQ1nQ3nstarQ2nstar-reQ5nQ2nQ4nstarQ3nstar
8300                                  + 2.*(reQ6nQ5nstarQ1nstar+reQ6nQ4nstarQ2nstar+reQ6nQ3nstarQ3nstar+reQ10nQ6nstarQ4nstar)
8301                                  + 1.*(reQ6nQ5nstarQ1nstar+reQ7nQ6nstarQ1nstar+reQ8nQ6nstarQ2nstar)
8302                                  + 1.*(reQ10nQ8nstarQ2nstar+reQ10nQ5nstarQ5nstar+reQ10nQ7nstarQ3nstar)
8303                                  + 1.*(reQ5nQ4nstarQ1nstar+reQ2nQ1nstarQ1nstar+reQ3nQ2nstarQ1nstar)
8304                                  + 1.*(reQ7nQ4nstarQ3nstar+reQ3nQ2nstarQ1nstar+reQ5nQ3nstarQ2nstar)
8305                                  + 1.*(reQ8nQ4nstarQ4nstar+reQ4nQ3nstarQ1nstar+reQ5nQ4nstarQ1nstar)
8306                                  + 2.*(reQ8nQ5nstarQ3nstar+reQ7nQ5nstarQ2nstar+reQ5nQ3nstarQ2nstar)
8307                                  + 2.*(reQ5nQ4nstarQ1nstar+reQ4nQ3nstarQ1nstar+reQ4nQ2nstarQ2nstar) // 3 - 1
8308                                  - 6.*(pow(dReQ6n,2.)+pow(dImQ6n,2.))
8309                  - 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.)) 
8310                  - 2.*(pow(dReQ5n,2.)+pow(dImQ5n,2.)+pow(dReQ7n,2.)+pow(dImQ7n,2.)+pow(dReQ8n,2.)+pow(dImQ8n,2.)) 
8311                          - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)+pow(dReQ1n,2.)+pow(dImQ1n,2.)) 
8312                  - 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.)) 
8313                  + 24.*dMult) 
8314                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
8315
8316
8317
8318   f5pCorrelations->Fill(0.5,five3n2n3n1n1n,d5pMultiplicityWeight);
8319   f5pCorrelations->Fill(1.5,five4n1n2n2n1n,d5pMultiplicityWeight); 
8320   f5pCorrelations->Fill(2.5,five4n2n3n2n1n,d5pMultiplicityWeight);
8321   f5pCorrelations->Fill(3.5,five4n3n3n2n2n,d5pMultiplicityWeight);
8322   f5pCorrelations->Fill(4.5,five4n2n4n1n1n,d5pMultiplicityWeight);
8323   f5pCorrelations->Fill(5.5,five4n3n4n2n1n,d5pMultiplicityWeight);
8324   f5pCorrelations->Fill(6.5,five5n1n3n2n1n,d5pMultiplicityWeight);
8325   f5pCorrelations->Fill(7.5,five5n2n5n1n1n,d5pMultiplicityWeight);
8326   f5pCorrelations->Fill(8.5,five5n2n4n2n1n,d5pMultiplicityWeight);
8327   f5pCorrelations->Fill(9.5,five5n3n4n3n1n,d5pMultiplicityWeight);
8328   f5pCorrelations->Fill(10.5,five5n4n4n3n2n,d5pMultiplicityWeight);
8329   f5pCorrelations->Fill(11.5,five5n3n5n2n1n,d5pMultiplicityWeight);
8330   f5pCorrelations->Fill(12.5,five5n4n5n2n2n,d5pMultiplicityWeight);
8331   f5pCorrelations->Fill(13.5,five5n4n5n3n1n,d5pMultiplicityWeight);
8332   f5pCorrelations->Fill(14.5,five6n1n3n3n1n,d5pMultiplicityWeight);
8333   f5pCorrelations->Fill(15.5,five6n2n3n3n2n,d5pMultiplicityWeight); 
8334   f5pCorrelations->Fill(16.5,five6n1n4n2n1n,d5pMultiplicityWeight); 
8335   f5pCorrelations->Fill(17.5,five6n3n4n3n2n,d5pMultiplicityWeight); 
8336   f5pCorrelations->Fill(18.5,five6n4n4n3n3n,d5pMultiplicityWeight); 
8337   f5pCorrelations->Fill(19.5,five6n2n5n2n1n,d5pMultiplicityWeight); 
8338   f5pCorrelations->Fill(20.5,five6n3n5n3n1n,d5pMultiplicityWeight); 
8339   f5pCorrelations->Fill(21.5,five6n4n5n4n1n,d5pMultiplicityWeight); 
8340   f5pCorrelations->Fill(22.5,five6n5n5n3n3n,d5pMultiplicityWeight); 
8341   f5pCorrelations->Fill(23.5,five6n2n6n1n1n,d5pMultiplicityWeight); 
8342   f5pCorrelations->Fill(24.5,five6n3n6n2n1n,d5pMultiplicityWeight); 
8343   f5pCorrelations->Fill(25.5,five6n4n6n2n2n,d5pMultiplicityWeight); 
8344   f5pCorrelations->Fill(26.5,five6n4n6n3n1n,d5pMultiplicityWeight); 
8345   f5pCorrelations->Fill(27.5,five6n5n5n4n2n,d5pMultiplicityWeight); 
8346   f5pCorrelations->Fill(28.5,five6n5n6n3n2n,d5pMultiplicityWeight); 
8347   f5pCorrelations->Fill(29.5,five6n5n6n4n1n,d5pMultiplicityWeight);
8348   //f5pCorrelations->Fill(30.5,-44.,d5pMultiplicityWeight);
8349   f5pCorrelations->Fill(31.5,five2n1n1n1n1n,d5pMultiplicityWeight);
8350   f5pCorrelations->Fill(32.5,five2n2n2n1n1n,d5pMultiplicityWeight); 
8351   f5pCorrelations->Fill(33.5,five3n3n2n2n2n,d5pMultiplicityWeight);
8352   f5pCorrelations->Fill(34.5,five4n1n1n1n1n,d5pMultiplicityWeight);
8353   f5pCorrelations->Fill(35.5,five4n2n2n2n2n,d5pMultiplicityWeight); 
8354   f5pCorrelations->Fill(36.5,five4n4n4n2n2n,d5pMultiplicityWeight); 
8355   f5pCorrelations->Fill(37.5,five6n3n3n3n3n,d5pMultiplicityWeight); 
8356   f5pCorrelations->Fill(38.5,five6n6n4n4n4n,d5pMultiplicityWeight); 
8357   f5pCorrelations->Fill(39.5,five6n6n6n3n3n,d5pMultiplicityWeight);
8358   //f5pCorrelations->Fill(40.5,-44.,d5pMultiplicityWeight);
8359   f5pCorrelations->Fill(41.5,five3n1n2n1n1n,d5pMultiplicityWeight);
8360   f5pCorrelations->Fill(42.5,five3n2n2n2n1n,d5pMultiplicityWeight);
8361   f5pCorrelations->Fill(43.5,five3n3n3n2n1n,d5pMultiplicityWeight);
8362   f5pCorrelations->Fill(44.5,five4n1n3n1n1n,d5pMultiplicityWeight);
8363   f5pCorrelations->Fill(45.5,five4n1n1n3n3n,d5pMultiplicityWeight);
8364   f5pCorrelations->Fill(46.5,five4n3n3n3n1n,d5pMultiplicityWeight);
8365   f5pCorrelations->Fill(47.5,five4n4n3n3n2n,d5pMultiplicityWeight);
8366   f5pCorrelations->Fill(48.5,five4n4n4n3n1n,d5pMultiplicityWeight);
8367   f5pCorrelations->Fill(49.5,five5n2n1n1n1n,d5pMultiplicityWeight);
8368   f5pCorrelations->Fill(50.5,five5n1n2n2n2n,d5pMultiplicityWeight);
8369   f5pCorrelations->Fill(51.5,five5n2n3n2n2n,d5pMultiplicityWeight);
8370   f5pCorrelations->Fill(52.5,five5n3n3n3n2n,d5pMultiplicityWeight);
8371   f5pCorrelations->Fill(53.5,five5n1n4n1n1n,d5pMultiplicityWeight);
8372   f5pCorrelations->Fill(54.5,five5n4n3n3n3n,d5pMultiplicityWeight);
8373   f5pCorrelations->Fill(55.5,five5n4n4n4n1n,d5pMultiplicityWeight);
8374   f5pCorrelations->Fill(56.5,five5n5n4n3n3n,d5pMultiplicityWeight);
8375   f5pCorrelations->Fill(57.5,five5n5n4n4n2n,d5pMultiplicityWeight);
8376   f5pCorrelations->Fill(58.5,five5n5n5n3n2n,d5pMultiplicityWeight);
8377   f5pCorrelations->Fill(59.5,five5n5n5n4n1n,d5pMultiplicityWeight);
8378   f5pCorrelations->Fill(60.5,five6n2n2n1n1n,d5pMultiplicityWeight);
8379   f5pCorrelations->Fill(61.5,five6n3n1n1n1n,d5pMultiplicityWeight);
8380   f5pCorrelations->Fill(62.5,five6n1n1n4n4n,d5pMultiplicityWeight);
8381   f5pCorrelations->Fill(63.5,five6n1n5n1n1n,d5pMultiplicityWeight);
8382   f5pCorrelations->Fill(64.5,five6n2n4n2n2n,d5pMultiplicityWeight);
8383   f5pCorrelations->Fill(65.5,five6n4n4n4n2n,d5pMultiplicityWeight);
8384   f5pCorrelations->Fill(66.5,five6n2n2n5n5n,d5pMultiplicityWeight);
8385   f5pCorrelations->Fill(67.5,five6n5n5n5n1n,d5pMultiplicityWeight);
8386   f5pCorrelations->Fill(68.5,five6n6n5n5n2n,d5pMultiplicityWeight);
8387   f5pCorrelations->Fill(69.5,five6n6n6n4n2n,d5pMultiplicityWeight);
8388   f5pCorrelations->Fill(70.5,five6n6n6n5n1n,d5pMultiplicityWeight);
8389   //f5pCorrelations->Fill(71.5,-44.,d5pMultiplicityWeight);
8390   f5pCorrelations->Fill(72.5,five5n2n3n3n1n,d5pMultiplicityWeight);
8391   f5pCorrelations->Fill(73.5,five5n1n1n4n3n,d5pMultiplicityWeight);
8392   f5pCorrelations->Fill(74.5,five5n3n4n2n2n,d5pMultiplicityWeight);
8393   f5pCorrelations->Fill(75.5,five5n2n1n4n4n,d5pMultiplicityWeight);
8394   f5pCorrelations->Fill(76.5,five6n1n3n2n2n,d5pMultiplicityWeight);
8395   f5pCorrelations->Fill(77.5,five6n3n4n4n1n,d5pMultiplicityWeight);
8396   f5pCorrelations->Fill(78.5,five6n1n1n5n3n,d5pMultiplicityWeight);
8397   f5pCorrelations->Fill(79.5,five6n3n5n2n2n,d5pMultiplicityWeight);
8398   f5pCorrelations->Fill(80.5,five6n5n4n4n3n,d5pMultiplicityWeight);
8399   f5pCorrelations->Fill(81.5,five6n3n1n5n5n,d5pMultiplicityWeight);
8400   f5pCorrelations->Fill(82.5,five6n6n5n4n3n,d5pMultiplicityWeight);
8401   //f5pCorrelations->Fill(83.5,-44.,d5pMultiplicityWeight);
8402   f5pCorrelations->Fill(84.5,five6n2n4n3n1n,d5pMultiplicityWeight);
8403   f5pCorrelations->Fill(85.5,five6n2n1n5n4n,d5pMultiplicityWeight);
8404   f5pCorrelations->Fill(86.5,five6n4n5n3n2n,d5pMultiplicityWeight);
8405   allMixedCorrelators[56]=five3n2n3n1n1n;
8406   allMixedCorrelators[57]=five4n1n2n2n1n;
8407   allMixedCorrelators[58]=five4n2n3n2n1n;
8408   allMixedCorrelators[59]=five4n3n3n2n2n;
8409   allMixedCorrelators[60]=five4n2n4n1n1n;
8410   allMixedCorrelators[61]=five4n3n4n2n1n;
8411   allMixedCorrelators[62]=five5n1n3n2n1n;
8412   allMixedCorrelators[63]=five5n2n5n1n1n;
8413   allMixedCorrelators[64]=five5n2n4n2n1n;
8414   allMixedCorrelators[65]=five5n3n4n3n1n;
8415   allMixedCorrelators[66]=five5n4n4n3n2n;
8416   allMixedCorrelators[67]=five5n3n5n2n1n;
8417   allMixedCorrelators[68]=five5n4n5n2n2n;
8418   allMixedCorrelators[69]=five5n4n5n3n1n;
8419   allMixedCorrelators[70]=five6n1n3n3n1n;
8420   allMixedCorrelators[71]=five6n2n3n3n2n;
8421   allMixedCorrelators[72]=five6n1n4n2n1n;
8422   allMixedCorrelators[73]=five6n3n4n3n2n;
8423   allMixedCorrelators[74]=five6n4n4n3n3n;
8424   allMixedCorrelators[75]=five6n2n5n2n1n;
8425   allMixedCorrelators[76]=five6n3n5n3n1n;
8426   allMixedCorrelators[77]=five6n4n5n4n1n;
8427   allMixedCorrelators[78]=five6n5n5n3n3n;
8428   allMixedCorrelators[79]=five6n2n6n1n1n;
8429   allMixedCorrelators[80]=five6n3n6n2n1n;
8430   allMixedCorrelators[81]=five6n4n6n2n2n;
8431   allMixedCorrelators[82]=five6n4n6n3n1n;
8432   allMixedCorrelators[83]=five6n5n5n4n2n;
8433   allMixedCorrelators[84]=five6n5n6n3n2n;
8434   allMixedCorrelators[85]=five6n5n6n4n1n;
8435   allMixedCorrelators[86]=five2n1n1n1n1n;
8436   allMixedCorrelators[87]=five2n2n2n1n1n;
8437   allMixedCorrelators[88]=five3n3n2n2n2n;
8438   allMixedCorrelators[89]=five4n1n1n1n1n;
8439   allMixedCorrelators[90]=five4n2n2n2n2n;
8440   allMixedCorrelators[91]=five4n4n4n2n2n;
8441   allMixedCorrelators[92]=five6n3n3n3n3n;
8442   allMixedCorrelators[93]=five6n6n4n4n4n;
8443   allMixedCorrelators[94]=five6n6n6n3n3n;
8444   allMixedCorrelators[95]=five3n1n2n1n1n;
8445   allMixedCorrelators[96]=five3n2n2n2n1n;
8446   allMixedCorrelators[97]=five3n3n3n2n1n;
8447   allMixedCorrelators[98]=five4n1n3n1n1n;
8448   allMixedCorrelators[99]=five4n1n1n3n3n;
8449   allMixedCorrelators[100]=five4n3n3n3n1n;
8450   allMixedCorrelators[101]=five4n4n3n3n2n;
8451   allMixedCorrelators[102]=five4n4n4n3n1n;
8452   allMixedCorrelators[103]=five5n2n1n1n1n;
8453   allMixedCorrelators[104]=five5n1n2n2n2n;
8454   allMixedCorrelators[105]=five5n2n3n2n2n;
8455   allMixedCorrelators[106]=five5n3n3n3n2n;
8456   allMixedCorrelators[107]=five5n1n4n1n1n;
8457   allMixedCorrelators[108]=five5n4n3n3n3n;
8458   allMixedCorrelators[109]=five5n4n4n4n1n;
8459   allMixedCorrelators[110]=five5n5n4n3n3n;
8460   allMixedCorrelators[111]=five5n5n4n4n2n;
8461   allMixedCorrelators[112]=five5n5n5n3n2n;
8462   allMixedCorrelators[113]=five5n5n5n4n1n;
8463   allMixedCorrelators[114]=five6n2n2n1n1n;
8464   allMixedCorrelators[115]=five6n3n1n1n1n;
8465   allMixedCorrelators[116]=five6n1n1n4n4n;
8466   allMixedCorrelators[117]=five6n1n5n1n1n;
8467   allMixedCorrelators[118]=five6n2n4n2n2n;
8468   allMixedCorrelators[119]=five6n4n4n4n2n;
8469   allMixedCorrelators[120]=five6n2n2n5n5n;
8470   allMixedCorrelators[121]=five6n5n5n5n1n;
8471   allMixedCorrelators[122]=five6n6n5n5n2n;
8472   allMixedCorrelators[123]=five6n6n6n4n2n;
8473   allMixedCorrelators[124]=five6n6n6n5n1n;
8474   allMixedCorrelators[125]=five5n2n3n3n1n;
8475   allMixedCorrelators[126]=five5n1n1n4n3n;
8476   allMixedCorrelators[127]=five5n3n4n2n2n;
8477   allMixedCorrelators[128]=five5n2n1n4n4n;
8478   allMixedCorrelators[129]=five6n1n3n2n2n;
8479   allMixedCorrelators[130]=five6n3n4n4n1n;
8480   allMixedCorrelators[131]=five6n1n1n5n3n;
8481   allMixedCorrelators[132]=five6n3n5n2n2n;
8482   allMixedCorrelators[133]=five6n5n4n4n3n;
8483   allMixedCorrelators[134]=five6n3n1n5n5n;
8484   allMixedCorrelators[135]=five6n6n5n4n3n;
8485   allMixedCorrelators[136]=five6n2n4n3n1n;
8486   allMixedCorrelators[137]=five6n2n1n5n4n;
8487   allMixedCorrelators[138]=five6n4n5n3n2n;
8488  } // end of if(dMult>4.)
8489  
8490  // Products of mixed harmonics:
8491  Double_t dwx=0.;
8492  Double_t dwy=0.;
8493  for(Int_t x=1;x<=139;x++)
8494  {  
8495   if(x>=1 && x<7)
8496   {
8497    dwx=d2pMultiplicityWeight;
8498   } else if(x>=7 && x<16)
8499     {
8500      dwx=d3pMultiplicityWeight;
8501     } else if(x>=16 && x<57)
8502       {
8503        dwx=d4pMultiplicityWeight;
8504       } else if(x>=57 && x<140)
8505         {
8506          dwx=d5pMultiplicityWeight;
8507         }
8508   for(Int_t y=x+1;y<=139;y++)
8509   {
8510    if(y>=1 && y<7)
8511    {
8512     dwy=d2pMultiplicityWeight;
8513    } else if(y>=7 && y<16)
8514      {
8515       dwy=d3pMultiplicityWeight;
8516      } else if(y>=16 && y<57)
8517        {
8518         dwy=d4pMultiplicityWeight;
8519        } else if(y>=57 && y<140)
8520          {
8521           dwy=d5pMultiplicityWeight;
8522          }
8523    fMixedHarmonicProductOfCorrelations->Fill(x-0.5,y-0.5,allMixedCorrelators[x-1]*allMixedCorrelators[y-1],dwx*dwy);
8524   } // end of for(Int_t y=x+1;y<=139;y++)
8525  } // end of for(Int_t x=1;x<=139;x++)
8526
8527 } // end of void AliFlowAnalysisWithQCumulants::CalculateMixedHarmonics()
8528
8529 //===================================================================================================================
8530
8531 void AliFlowAnalysisWithQCumulants::CalculateCumulantsMixedHarmonics()
8532 {
8533  // Calculate in this method all multi-particle cumulants for azimuthal correlations in mixed harmonics.
8534  // (Remark: For completeness sake, we also calculate here again cumulants in the same harmonic.) 
8535
8536  // a) Calculate 2-p cumulants; 
8537  // b) Calculate 3-p cumulants; 
8538  // c) Calculate 4-p cumulants; 
8539  // d) Calculate 5-p cumulants. 
8540
8541  // a) Calculate 2-p cumulants: 
8542  for(Int_t b=1;b<=6;b++)
8543  {
8544   f2pCumulants->SetBinContent(b,f2pCorrelations->GetBinContent(b)); 
8545   Double_t dSumWLinear = 0.; // sum of linear event weights
8546   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
8547   Double_t dSpread = 0.; // weighted and biased estimator for sigma
8548   Double_t dError = 0.; // weighted and unbiased estimator for error
8549   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8550   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8551   dSpread = f2pCorrelations->GetBinError(b);
8552   if(pow(dSumWLinear,2.)>dSumWQuadratic)
8553   {
8554    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
8555    f2pCumulants->SetBinError(b,dError); 
8556   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
8557  } // end of for(Int_t b=1;b<=6;b++)
8558
8559  // b) Calculate 3-p cumulants: 
8560  for(Int_t b=1;b<=10;b++)
8561  {
8562   f3pCumulants->SetBinContent(b,f3pCorrelations->GetBinContent(b)); 
8563   Double_t dSumWLinear = 0.; // sum of linear event weights
8564   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
8565   Double_t dSpread = 0.; // weighted and biased estimator for sigma
8566   Double_t dError = 0.; // weighted and unbiased estimator for sigma
8567   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(3);
8568   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(3);
8569   dSpread = f3pCorrelations->GetBinError(b);
8570   if(pow(dSumWLinear,2.)>dSumWQuadratic)
8571   {
8572    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
8573    f3pCumulants->SetBinError(b,dError); 
8574   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
8575  } // end of for(Int_t b=1;b<=10;b++)
8576
8577  // c) Calculate 4-p cumulants: 
8578  // c1) "Single harmonic":
8579  for(Int_t b=1;b<=6;b++)
8580  {
8581   f4pCumulants->SetBinContent(b,f4pCorrelations->GetBinContent(b)-2.*pow(f2pCorrelations->GetBinContent(b),2.));
8582   Double_t dSumWLinearTwo = 0.; // sum of linear event weights for <2>
8583   Double_t dSumWQuadraticTwo = 0.; // sum of quadratic event weights <2>
8584   Double_t dSpreadTwo = 0.; // weighted and biased estimator for sigma of <2>
8585   Double_t dSumWLinearFour = 0.; // sum of linear event weights for <4>
8586   Double_t dSumWQuadraticFour = 0.; // sum of quadratic event weights <4>
8587   Double_t dSpreadFour = 0.; // weighted and biased estimator for sigma of <4>
8588   dSumWLinearTwo = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8589   dSumWQuadraticTwo = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8590   dSpreadTwo = f2pCorrelations->GetBinError(b);
8591   dSumWLinearFour = fMixedHarmonicEventWeights[0]->GetBinContent(4);
8592   dSumWQuadraticFour = fMixedHarmonicEventWeights[1]->GetBinContent(4);
8593   dSpreadFour = f4pCorrelations->GetBinError(b);
8594   if(pow(dSumWLinearTwo,2.)>dSumWQuadraticTwo && pow(dSumWLinearFour,2.)>dSumWQuadraticFour) 
8595   {
8596    Double_t dError = 16.*pow(f2pCorrelations->GetBinContent(b),2.)
8597                    * pow((pow(dSumWQuadraticTwo,0.5)/dSumWLinearTwo)*dSpreadTwo*pow(pow(dSumWLinearTwo,2.)/(pow(dSumWLinearTwo,2.)-dSumWQuadraticTwo),0.5),2.)
8598                    + pow((pow(dSumWQuadraticFour,0.5)/dSumWLinearFour)*dSpreadFour*pow(pow(dSumWLinearFour,2.)/(pow(dSumWLinearFour,2.)-dSumWQuadraticFour),0.5),2.)
8599                    - 8.*f2pCorrelations->GetBinContent(b)
8600                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8601                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(b,b+15))
8602                    - f2pCorrelations->GetBinContent(b)*f4pCorrelations->GetBinContent(b))
8603                    / (dSumWLinearTwo*dSumWLinearFour-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
8604    if(dError>0.)
8605    {
8606     f4pCumulants->SetBinError(b,pow(dError,0.5)); 
8607    }
8608   } // end of if(pow(dSumWLinearTwo,2.)>dSumWQuadraticTwo && pow(dSumWLinearFour,2.)>dSumWQuadraticFour) 
8609  } // end of for(Int_t b=1;b<=6;b++)     
8610  // c2) "Standard candles":
8611  // <4>_{2n,1n|2n,1n}:
8612  f4pCumulants->SetBinContent(8,f4pCorrelations->GetBinContent(8)-f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(1));
8613  {
8614   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
8615   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
8616   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
8617   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
8618   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
8619   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
8620   Double_t dSumWLinearFour2n1n2n1n = 0.; // sum of linear event weights for <4>
8621   Double_t dSumWQuadraticFour2n1n2n1n = 0.; // sum of quadratic event weights <4>
8622   Double_t dSpreadFour2n1n2n1n = 0.; // weighted and biased estimator for sigma of <4>
8623   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8624   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8625   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
8626   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8627   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8628   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
8629   dSumWLinearFour2n1n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
8630   dSumWQuadraticFour2n1n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
8631   dSpreadFour2n1n2n1n = f4pCorrelations->GetBinError(8);
8632   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
8633      pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
8634      pow(dSumWLinearFour2n1n2n1n,2.)>dSumWQuadraticFour2n1n2n1n)
8635   {
8636    Double_t dError = pow(f2pCorrelations->GetBinContent(2),2.)
8637                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
8638                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
8639                    + pow(f2pCorrelations->GetBinContent(1),2.)
8640                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
8641                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
8642                    + pow((pow(dSumWQuadraticFour2n1n2n1n,0.5)/dSumWLinearFour2n1n2n1n)
8643                    * dSpreadFour2n1n2n1n*pow(pow(dSumWLinearFour2n1n2n1n,2.)/(pow(dSumWLinearFour2n1n2n1n,2.)-dSumWQuadraticFour2n1n2n1n),0.5),2.)
8644                    + 2.*f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(1)
8645                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
8646                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,2))
8647                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(2))
8648                    / (dSumWLinearTwo1n1n*dSumWLinearTwo2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
8649                    - 2.*f2pCorrelations->GetBinContent(2)
8650                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8651                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,22))
8652                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(8))
8653                    / (dSumWLinearTwo1n1n*dSumWLinearFour2n1n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
8654                    - 2.*f2pCorrelations->GetBinContent(1)
8655                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8656                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,22))
8657                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(8))
8658                    / (dSumWLinearTwo2n2n*dSumWLinearFour2n1n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
8659    if(dError>0.)
8660    {
8661     f4pCumulants->SetBinError(8,pow(dError,0.5)); 
8662    }
8663   } // end of if(...)
8664  } // end of {
8665  // <4>_{3n,1n|3n,1n}:
8666  f4pCumulants->SetBinContent(9,f4pCorrelations->GetBinContent(9)-f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(1));
8667  {
8668   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
8669   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
8670   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
8671   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
8672   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
8673   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
8674   Double_t dSumWLinearFour3n1n3n1n = 0.; // sum of linear event weights for <4>
8675   Double_t dSumWQuadraticFour3n1n3n1n = 0.; // sum of quadratic event weights <4>
8676   Double_t dSpreadFour3n1n3n1n = 0.; // weighted and biased estimator for sigma of <4>
8677   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8678   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8679   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
8680   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8681   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8682   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
8683   dSumWLinearFour3n1n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
8684   dSumWQuadraticFour3n1n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
8685   dSpreadFour3n1n3n1n = f4pCorrelations->GetBinError(9);
8686   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
8687      pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
8688      pow(dSumWLinearFour3n1n3n1n,2.)>dSumWQuadraticFour3n1n3n1n)
8689   {
8690    Double_t dError = pow(f2pCorrelations->GetBinContent(3),2.)
8691                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
8692                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
8693                    + pow(f2pCorrelations->GetBinContent(1),2.)
8694                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
8695                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
8696                    + pow((pow(dSumWQuadraticFour3n1n3n1n,0.5)/dSumWLinearFour3n1n3n1n)
8697                    * dSpreadFour3n1n3n1n*pow(pow(dSumWLinearFour3n1n3n1n,2.)/(pow(dSumWLinearFour3n1n3n1n,2.)-dSumWQuadraticFour3n1n3n1n),0.5),2.)
8698                    + 2.*f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(1)
8699                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
8700                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,3))
8701                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(3))
8702                    / (dSumWLinearTwo1n1n*dSumWLinearTwo3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
8703                    - 2.*f2pCorrelations->GetBinContent(3)
8704                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8705                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,23))
8706                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(9))
8707                    / (dSumWLinearTwo1n1n*dSumWLinearFour3n1n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
8708                    - 2.*f2pCorrelations->GetBinContent(1)
8709                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8710                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,23))
8711                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(9))
8712                    / (dSumWLinearTwo3n3n*dSumWLinearFour3n1n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
8713    if(dError>0.)
8714    {
8715     f4pCumulants->SetBinError(9,pow(dError,0.5)); 
8716    }
8717   } // end of if(...)
8718  } // end of {
8719  // <4>_{3n,2n|3n,2n}:
8720  f4pCumulants->SetBinContent(10,f4pCorrelations->GetBinContent(10)-f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(2));
8721  {
8722   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
8723   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
8724   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
8725   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
8726   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
8727   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
8728   Double_t dSumWLinearFour3n2n3n2n = 0.; // sum of linear event weights for <4>
8729   Double_t dSumWQuadraticFour3n2n3n2n = 0.; // sum of quadratic event weights <4>
8730   Double_t dSpreadFour3n2n3n2n = 0.; // weighted and biased estimator for sigma of <4>
8731   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8732   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8733   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
8734   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8735   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8736   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
8737   dSumWLinearFour3n2n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
8738   dSumWQuadraticFour3n2n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
8739   dSpreadFour3n2n3n2n = f4pCorrelations->GetBinError(10);
8740   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
8741      pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
8742      pow(dSumWLinearFour3n2n3n2n,2.)>dSumWQuadraticFour3n2n3n2n)
8743   {
8744    Double_t dError = pow(f2pCorrelations->GetBinContent(3),2.)
8745                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
8746                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
8747                    + pow(f2pCorrelations->GetBinContent(2),2.)
8748                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
8749                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
8750                    + pow((pow(dSumWQuadraticFour3n2n3n2n,0.5)/dSumWLinearFour3n2n3n2n)
8751                    * dSpreadFour3n2n3n2n*pow(pow(dSumWLinearFour3n2n3n2n,2.)/(pow(dSumWLinearFour3n2n3n2n,2.)-dSumWQuadraticFour3n2n3n2n),0.5),2.)
8752                    + 2.*f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(2)
8753                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
8754                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,3))
8755                    - f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(3))
8756                    / (dSumWLinearTwo2n2n*dSumWLinearTwo3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
8757                    - 2.*f2pCorrelations->GetBinContent(3)
8758                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8759                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,24))
8760                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(10))
8761                    / (dSumWLinearTwo2n2n*dSumWLinearFour3n2n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
8762                    - 2.*f2pCorrelations->GetBinContent(2)
8763                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8764                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,24))
8765                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(10))
8766                    / (dSumWLinearTwo3n3n*dSumWLinearFour3n2n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
8767    if(dError>0.)
8768    {
8769     f4pCumulants->SetBinError(10,pow(dError,0.5)); 
8770    }
8771   } // end of if(...)
8772  } // end of {
8773  // <4>_{4n,1n|4n,1n}
8774  f4pCumulants->SetBinContent(11,f4pCorrelations->GetBinContent(11)-f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(1));
8775  {
8776   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
8777   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
8778   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
8779   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
8780   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
8781   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
8782   Double_t dSumWLinearFour4n1n4n1n = 0.; // sum of linear event weights for <4>
8783   Double_t dSumWQuadraticFour4n1n4n1n = 0.; // sum of quadratic event weights <4>
8784   Double_t dSpreadFour4n1n4n1n = 0.; // weighted and biased estimator for sigma of <4>
8785   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8786   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8787   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
8788   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8789   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8790   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
8791   dSumWLinearFour4n1n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
8792   dSumWQuadraticFour4n1n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
8793   dSpreadFour4n1n4n1n = f4pCorrelations->GetBinError(11);
8794   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
8795      pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
8796      pow(dSumWLinearFour4n1n4n1n,2.)>dSumWQuadraticFour4n1n4n1n)
8797   {
8798    Double_t dError = pow(f2pCorrelations->GetBinContent(4),2.)
8799                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
8800                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
8801                    + pow(f2pCorrelations->GetBinContent(1),2.)
8802                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
8803                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
8804                    + pow((pow(dSumWQuadraticFour4n1n4n1n,0.5)/dSumWLinearFour4n1n4n1n)
8805                    * dSpreadFour4n1n4n1n*pow(pow(dSumWLinearFour4n1n4n1n,2.)/(pow(dSumWLinearFour4n1n4n1n,2.)-dSumWQuadraticFour4n1n4n1n),0.5),2.)
8806                    + 2.*f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(1)
8807                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
8808                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,4))
8809                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(4))
8810                    / (dSumWLinearTwo1n1n*dSumWLinearTwo4n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
8811                    - 2.*f2pCorrelations->GetBinContent(4)
8812                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8813                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,25))
8814                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(11))
8815                    / (dSumWLinearTwo1n1n*dSumWLinearFour4n1n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
8816                    - 2.*f2pCorrelations->GetBinContent(1)
8817                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8818                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,25))
8819                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(11))
8820                    / (dSumWLinearTwo4n4n*dSumWLinearFour4n1n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
8821    if(dError>0.)
8822    {
8823     f4pCumulants->SetBinError(11,pow(dError,0.5)); 
8824    }
8825   } // end of if(...)
8826  } // end of {
8827  // <4>_{4n,2n|4n,2n}
8828  f4pCumulants->SetBinContent(12,f4pCorrelations->GetBinContent(12)-f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(2));
8829  {
8830   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
8831   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
8832   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
8833   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
8834   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
8835   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
8836   Double_t dSumWLinearFour4n2n4n2n = 0.; // sum of linear event weights for <4>
8837   Double_t dSumWQuadraticFour4n2n4n2n = 0.; // sum of quadratic event weights <4>
8838   Double_t dSpreadFour4n2n4n2n = 0.; // weighted and biased estimator for sigma of <4>
8839   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8840   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8841   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
8842   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8843   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8844   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
8845   dSumWLinearFour4n2n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
8846   dSumWQuadraticFour4n2n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
8847   dSpreadFour4n2n4n2n = f4pCorrelations->GetBinError(12);
8848   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
8849      pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
8850      pow(dSumWLinearFour4n2n4n2n,2.)>dSumWQuadraticFour4n2n4n2n)
8851   {
8852    Double_t dError = pow(f2pCorrelations->GetBinContent(4),2.)
8853                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
8854                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
8855                    + pow(f2pCorrelations->GetBinContent(2),2.)
8856                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
8857                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
8858                    + pow((pow(dSumWQuadraticFour4n2n4n2n,0.5)/dSumWLinearFour4n2n4n2n)
8859                    * dSpreadFour4n2n4n2n*pow(pow(dSumWLinearFour4n2n4n2n,2.)/(pow(dSumWLinearFour4n2n4n2n,2.)-dSumWQuadraticFour4n2n4n2n),0.5),2.)
8860                    + 2.*f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(2)
8861                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
8862                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,4))
8863                    - f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(4))
8864                    / (dSumWLinearTwo2n2n*dSumWLinearTwo4n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
8865                    - 2.*f2pCorrelations->GetBinContent(4)
8866                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8867                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,25))
8868                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(12))
8869                    / (dSumWLinearTwo2n2n*dSumWLinearFour4n2n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
8870                    - 2.*f2pCorrelations->GetBinContent(2)
8871                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8872                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,25))
8873                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(12))
8874                    / (dSumWLinearTwo4n4n*dSumWLinearFour4n2n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
8875    if(dError>0.)
8876    {
8877     f4pCumulants->SetBinError(12,pow(dError,0.5)); 
8878    }
8879   } // end of if(...)
8880  } // end of {
8881  // <4>_{4n,3n|4n,3n}
8882  f4pCumulants->SetBinContent(13,f4pCorrelations->GetBinContent(13)-f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(3));
8883  {
8884   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
8885   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
8886   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
8887   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
8888   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
8889   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
8890   Double_t dSumWLinearFour4n3n4n3n = 0.; // sum of linear event weights for <4>
8891   Double_t dSumWQuadraticFour4n3n4n3n = 0.; // sum of quadratic event weights <4>
8892   Double_t dSpreadFour4n3n4n3n = 0.; // weighted and biased estimator for sigma of <4>
8893   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8894   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8895   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
8896   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8897   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8898   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
8899   dSumWLinearFour4n3n4n3n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
8900   dSumWQuadraticFour4n3n4n3n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
8901   dSpreadFour4n3n4n3n = f4pCorrelations->GetBinError(13);
8902   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
8903      pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
8904      pow(dSumWLinearFour4n3n4n3n,2.)>dSumWQuadraticFour4n3n4n3n)
8905   {
8906    Double_t dError = pow(f2pCorrelations->GetBinContent(4),2.)
8907                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
8908                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
8909                    + pow(f2pCorrelations->GetBinContent(3),2.)
8910                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
8911                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
8912                    + pow((pow(dSumWQuadraticFour4n3n4n3n,0.5)/dSumWLinearFour4n3n4n3n)
8913                    * dSpreadFour4n3n4n3n*pow(pow(dSumWLinearFour4n3n4n3n,2.)/(pow(dSumWLinearFour4n3n4n3n,2.)-dSumWQuadraticFour4n3n4n3n),0.5),2.)
8914                    + 2.*f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(3)
8915                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
8916                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,4))
8917                    - f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(4))
8918                    / (dSumWLinearTwo3n3n*dSumWLinearTwo4n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
8919                    - 2.*f2pCorrelations->GetBinContent(4)
8920                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8921                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,26))
8922                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(13))
8923                    / (dSumWLinearTwo3n3n*dSumWLinearFour4n3n4n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
8924                    - 2.*f2pCorrelations->GetBinContent(3)
8925                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8926                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,26))
8927                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(13))
8928                    / (dSumWLinearTwo4n4n*dSumWLinearFour4n3n4n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
8929    if(dError>0.)
8930    {
8931     f4pCumulants->SetBinError(13,pow(dError,0.5)); 
8932    }
8933   } // end of if(...)
8934  } // end of {
8935  // <4>_{5n,1n|5n,1n}
8936  f4pCumulants->SetBinContent(14,f4pCorrelations->GetBinContent(14)-f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(1));
8937  {
8938   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
8939   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
8940   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
8941   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
8942   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
8943   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
8944   Double_t dSumWLinearFour5n1n5n1n = 0.; // sum of linear event weights for <4>
8945   Double_t dSumWQuadraticFour5n1n5n1n = 0.; // sum of quadratic event weights <4>
8946   Double_t dSpreadFour5n1n5n1n = 0.; // weighted and biased estimator for sigma of <4>
8947   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8948   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8949   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
8950   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
8951   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
8952   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
8953   dSumWLinearFour5n1n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
8954   dSumWQuadraticFour5n1n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
8955   dSpreadFour5n1n5n1n = f4pCorrelations->GetBinError(14);
8956   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
8957      pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
8958      pow(dSumWLinearFour5n1n5n1n,2.)>dSumWQuadraticFour5n1n5n1n)
8959   {
8960    Double_t dError = pow(f2pCorrelations->GetBinContent(5),2.)
8961                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
8962                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
8963                    + pow(f2pCorrelations->GetBinContent(1),2.)
8964                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
8965                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
8966                    + pow((pow(dSumWQuadraticFour5n1n5n1n,0.5)/dSumWLinearFour5n1n5n1n)
8967                    * dSpreadFour5n1n5n1n*pow(pow(dSumWLinearFour5n1n5n1n,2.)/(pow(dSumWLinearFour5n1n5n1n,2.)-dSumWQuadraticFour5n1n5n1n),0.5),2.)
8968                    + 2.*f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(1)
8969                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
8970                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,5))
8971                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(5))
8972                    / (dSumWLinearTwo1n1n*dSumWLinearTwo5n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
8973                    - 2.*f2pCorrelations->GetBinContent(5)
8974                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8975                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,28))
8976                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(14))
8977                    / (dSumWLinearTwo1n1n*dSumWLinearFour5n1n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
8978                    - 2.*f2pCorrelations->GetBinContent(1)
8979                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
8980                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,28))
8981                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(14))
8982                    / (dSumWLinearTwo5n5n*dSumWLinearFour5n1n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
8983    if(dError>0.)
8984    {
8985     f4pCumulants->SetBinError(14,pow(dError,0.5)); 
8986    }
8987   } // end of if(...)
8988  } // end of {
8989  // <4>_{5n,2n|5n,2n}
8990  f4pCumulants->SetBinContent(15,f4pCorrelations->GetBinContent(15)-f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(2));
8991  {
8992   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
8993   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
8994   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
8995   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
8996   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
8997   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
8998   Double_t dSumWLinearFour5n2n5n2n = 0.; // sum of linear event weights for <4>
8999   Double_t dSumWQuadraticFour5n2n5n2n = 0.; // sum of quadratic event weights <4>
9000   Double_t dSpreadFour5n2n5n2n = 0.; // weighted and biased estimator for sigma of <4>
9001   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9002   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9003   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
9004   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9005   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9006   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9007   dSumWLinearFour5n2n5n2n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9008   dSumWQuadraticFour5n2n5n2n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9009   dSpreadFour5n2n5n2n = f4pCorrelations->GetBinError(15);
9010   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
9011      pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9012      pow(dSumWLinearFour5n2n5n2n,2.)>dSumWQuadraticFour5n2n5n2n)
9013   {
9014    Double_t dError = pow(f2pCorrelations->GetBinContent(5),2.)
9015                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
9016                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
9017                    + pow(f2pCorrelations->GetBinContent(2),2.)
9018                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9019                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9020                    + pow((pow(dSumWQuadraticFour5n2n5n2n,0.5)/dSumWLinearFour5n2n5n2n)
9021                    * dSpreadFour5n2n5n2n*pow(pow(dSumWLinearFour5n2n5n2n,2.)/(pow(dSumWLinearFour5n2n5n2n,2.)-dSumWQuadraticFour5n2n5n2n),0.5),2.)
9022                    + 2.*f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(2)
9023                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9024                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,5))
9025                    - f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(5))
9026                    / (dSumWLinearTwo2n2n*dSumWLinearTwo5n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9027                    - 2.*f2pCorrelations->GetBinContent(5)
9028                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9029                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,29))
9030                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(15))
9031                    / (dSumWLinearTwo2n2n*dSumWLinearFour5n2n5n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9032                    - 2.*f2pCorrelations->GetBinContent(2)
9033                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9034                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,29))
9035                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(15))
9036                    / (dSumWLinearTwo5n5n*dSumWLinearFour5n2n5n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9037    if(dError>0.)
9038    {
9039     f4pCumulants->SetBinError(15,pow(dError,0.5)); 
9040    }
9041   } // end of if(...)
9042  } // end of {
9043  // <4>_{5n,3n|5n,3n}
9044  f4pCumulants->SetBinContent(16,f4pCorrelations->GetBinContent(16)-f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(3));
9045  {
9046   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9047   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9048   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9049   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
9050   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
9051   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
9052   Double_t dSumWLinearFour5n3n5n3n = 0.; // sum of linear event weights for <4>
9053   Double_t dSumWQuadraticFour5n3n5n3n = 0.; // sum of quadratic event weights <4>
9054   Double_t dSpreadFour5n3n5n3n = 0.; // weighted and biased estimator for sigma of <4>
9055   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9056   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9057   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9058   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9059   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9060   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9061   dSumWLinearFour5n3n5n3n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9062   dSumWQuadraticFour5n3n5n3n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9063   dSpreadFour5n3n5n3n = f4pCorrelations->GetBinError(16);
9064   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9065      pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9066      pow(dSumWLinearFour5n3n5n3n,2.)>dSumWQuadraticFour5n3n5n3n)
9067   {
9068    Double_t dError = pow(f2pCorrelations->GetBinContent(5),2.)
9069                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9070                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9071                    + pow(f2pCorrelations->GetBinContent(3),2.)
9072                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9073                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9074                    + pow((pow(dSumWQuadraticFour5n3n5n3n,0.5)/dSumWLinearFour5n3n5n3n)
9075                    * dSpreadFour5n3n5n3n*pow(pow(dSumWLinearFour5n3n5n3n,2.)/(pow(dSumWLinearFour5n3n5n3n,2.)-dSumWQuadraticFour5n3n5n3n),0.5),2.)
9076                    + 2.*f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(3)
9077                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9078                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,5))
9079                    - f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(5))
9080                    / (dSumWLinearTwo3n3n*dSumWLinearTwo5n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9081                    - 2.*f2pCorrelations->GetBinContent(5)
9082                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9083                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,30))
9084                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(16))
9085                    / (dSumWLinearTwo3n3n*dSumWLinearFour5n3n5n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9086                    - 2.*f2pCorrelations->GetBinContent(3)
9087                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9088                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,30))
9089                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(16))
9090                    / (dSumWLinearTwo5n5n*dSumWLinearFour5n3n5n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9091    if(dError>0.)
9092    {
9093     f4pCumulants->SetBinError(16,pow(dError,0.5)); 
9094    }
9095   } // end of if(...)
9096  } // end of {
9097  // <4>_{5n,4n|5n,4n}
9098  f4pCumulants->SetBinContent(17,f4pCorrelations->GetBinContent(17)-f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(4));
9099  {
9100   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9101   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9102   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9103   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
9104   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
9105   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
9106   Double_t dSumWLinearFour5n4n5n4n = 0.; // sum of linear event weights for <4>
9107   Double_t dSumWQuadraticFour5n4n5n4n = 0.; // sum of quadratic event weights <4>
9108   Double_t dSpreadFour5n4n5n4n = 0.; // weighted and biased estimator for sigma of <4>
9109   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9110   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9111   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9112   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9113   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9114   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9115   dSumWLinearFour5n4n5n4n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9116   dSumWQuadraticFour5n4n5n4n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9117   dSpreadFour5n4n5n4n = f4pCorrelations->GetBinError(17);
9118   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9119      pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9120      pow(dSumWLinearFour5n4n5n4n,2.)>dSumWQuadraticFour5n4n5n4n)
9121   {
9122    Double_t dError = pow(f2pCorrelations->GetBinContent(5),2.)
9123                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9124                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9125                    + pow(f2pCorrelations->GetBinContent(4),2.)
9126                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9127                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9128                    + pow((pow(dSumWQuadraticFour5n4n5n4n,0.5)/dSumWLinearFour5n4n5n4n)
9129                    * dSpreadFour5n4n5n4n*pow(pow(dSumWLinearFour5n4n5n4n,2.)/(pow(dSumWLinearFour5n4n5n4n,2.)-dSumWQuadraticFour5n4n5n4n),0.5),2.)
9130                    + 2.*f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(4)
9131                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9132                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,5))
9133                    - f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(5))
9134                    / (dSumWLinearTwo4n4n*dSumWLinearTwo5n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9135                    - 2.*f2pCorrelations->GetBinContent(5)
9136                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9137                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,31))
9138                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(17))
9139                    / (dSumWLinearTwo4n4n*dSumWLinearFour5n4n5n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9140                    - 2.*f2pCorrelations->GetBinContent(4)
9141                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9142                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,31))
9143                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(17))
9144                    / (dSumWLinearTwo5n5n*dSumWLinearFour5n4n5n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9145    if(dError>0.)
9146    {
9147     f4pCumulants->SetBinError(17,pow(dError,0.5)); 
9148    }
9149   } // end of if(...)
9150  } // end of {
9151  // <4>_{6n,1n|6n,1n}
9152  f4pCumulants->SetBinContent(18,f4pCorrelations->GetBinContent(18)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(1));
9153  {
9154   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
9155   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
9156   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
9157   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9158   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9159   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9160   Double_t dSumWLinearFour6n1n6n1n = 0.; // sum of linear event weights for <4>
9161   Double_t dSumWQuadraticFour6n1n6n1n = 0.; // sum of quadratic event weights <4>
9162   Double_t dSpreadFour6n1n6n1n = 0.; // weighted and biased estimator for sigma of <4>
9163   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9164   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9165   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
9166   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9167   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9168   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9169   dSumWLinearFour6n1n6n1n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9170   dSumWQuadraticFour6n1n6n1n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9171   dSpreadFour6n1n6n1n = f4pCorrelations->GetBinError(18);
9172   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
9173      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9174      pow(dSumWLinearFour6n1n6n1n,2.)>dSumWQuadraticFour6n1n6n1n)
9175   {
9176    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9177                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
9178                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
9179                    + pow(f2pCorrelations->GetBinContent(1),2.)
9180                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9181                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9182                    + pow((pow(dSumWQuadraticFour6n1n6n1n,0.5)/dSumWLinearFour6n1n6n1n)
9183                    * dSpreadFour6n1n6n1n*pow(pow(dSumWLinearFour6n1n6n1n,2.)/(pow(dSumWLinearFour6n1n6n1n,2.)-dSumWQuadraticFour6n1n6n1n),0.5),2.)
9184                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(1)
9185                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9186                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,6))
9187                    - f2pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(6))
9188                    / (dSumWLinearTwo1n1n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9189                    - 2.*f2pCorrelations->GetBinContent(6)
9190                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9191                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,32))
9192                    - f2pCorrelations->GetBinContent(1)*f4pCorrelations->GetBinContent(18))
9193                    / (dSumWLinearTwo1n1n*dSumWLinearFour6n1n6n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9194                    - 2.*f2pCorrelations->GetBinContent(1)
9195                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9196                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,32))
9197                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(18))
9198                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n1n6n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9199    if(dError>0.)
9200    {
9201     f4pCumulants->SetBinError(18,pow(dError,0.5)); 
9202    }
9203   } // end of if(...)
9204  } // end of {
9205  // <4>_{6n,2n|6n,2n}
9206  f4pCumulants->SetBinContent(19,f4pCorrelations->GetBinContent(19)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(2));
9207  {
9208   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
9209   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
9210   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
9211   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9212   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9213   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9214   Double_t dSumWLinearFour6n2n6n2n = 0.; // sum of linear event weights for <4>
9215   Double_t dSumWQuadraticFour6n2n6n2n = 0.; // sum of quadratic event weights <4>
9216   Double_t dSpreadFour6n2n6n2n = 0.; // weighted and biased estimator for sigma of <4>
9217   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9218   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9219   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
9220   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9221   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9222   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9223   dSumWLinearFour6n2n6n2n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9224   dSumWQuadraticFour6n2n6n2n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9225   dSpreadFour6n2n6n2n = f4pCorrelations->GetBinError(19);
9226   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
9227      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9228      pow(dSumWLinearFour6n2n6n2n,2.)>dSumWQuadraticFour6n2n6n2n)
9229   {
9230    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9231                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
9232                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
9233                    + pow(f2pCorrelations->GetBinContent(2),2.)
9234                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9235                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9236                    + pow((pow(dSumWQuadraticFour6n2n6n2n,0.5)/dSumWLinearFour6n2n6n2n)
9237                    * dSpreadFour6n2n6n2n*pow(pow(dSumWLinearFour6n2n6n2n,2.)/(pow(dSumWLinearFour6n2n6n2n,2.)-dSumWQuadraticFour6n2n6n2n),0.5),2.)
9238                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(2)
9239                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9240                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,6))
9241                    - f2pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(6))
9242                    / (dSumWLinearTwo2n2n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9243                    - 2.*f2pCorrelations->GetBinContent(6)
9244                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9245                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,33))
9246                    - f2pCorrelations->GetBinContent(2)*f4pCorrelations->GetBinContent(19))
9247                    / (dSumWLinearTwo2n2n*dSumWLinearFour6n2n6n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9248                    - 2.*f2pCorrelations->GetBinContent(2)
9249                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9250                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,33))
9251                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(19))
9252                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n2n6n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9253    if(dError>0.)
9254    {
9255     f4pCumulants->SetBinError(19,pow(dError,0.5)); 
9256    }
9257   } // end of if(...)
9258  } // end of {
9259  // <4>_{6n,3n|6n,3n}
9260  f4pCumulants->SetBinContent(20,f4pCorrelations->GetBinContent(20)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(3));
9261  {
9262   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9263   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9264   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9265   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9266   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9267   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9268   Double_t dSumWLinearFour6n3n6n3n = 0.; // sum of linear event weights for <4>
9269   Double_t dSumWQuadraticFour6n3n6n3n = 0.; // sum of quadratic event weights <4>
9270   Double_t dSpreadFour6n3n6n3n = 0.; // weighted and biased estimator for sigma of <4>
9271   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9272   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9273   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9274   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9275   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9276   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9277   dSumWLinearFour6n3n6n3n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9278   dSumWQuadraticFour6n3n6n3n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9279   dSpreadFour6n3n6n3n = f4pCorrelations->GetBinError(20);
9280   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9281      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9282      pow(dSumWLinearFour6n3n6n3n,2.)>dSumWQuadraticFour6n3n6n3n)
9283   {
9284    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9285                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9286                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9287                    + pow(f2pCorrelations->GetBinContent(3),2.)
9288                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9289                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9290                    + pow((pow(dSumWQuadraticFour6n3n6n3n,0.5)/dSumWLinearFour6n3n6n3n)
9291                    * dSpreadFour6n3n6n3n*pow(pow(dSumWLinearFour6n3n6n3n,2.)/(pow(dSumWLinearFour6n3n6n3n,2.)-dSumWQuadraticFour6n3n6n3n),0.5),2.)
9292                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(3)
9293                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9294                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,6))
9295                    - f2pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(6))
9296                    / (dSumWLinearTwo3n3n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9297                    - 2.*f2pCorrelations->GetBinContent(6)
9298                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9299                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,34))
9300                    - f2pCorrelations->GetBinContent(3)*f4pCorrelations->GetBinContent(20))
9301                    / (dSumWLinearTwo3n3n*dSumWLinearFour6n3n6n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9302                    - 2.*f2pCorrelations->GetBinContent(3)
9303                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9304                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,34))
9305                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(20))
9306                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n3n6n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9307    if(dError>0.)
9308    {
9309     f4pCumulants->SetBinError(20,pow(dError,0.5)); 
9310    }
9311   } // end of if(...)
9312  } // end of {
9313  // <4>_{6n,4n|6n,4n}
9314  f4pCumulants->SetBinContent(21,f4pCorrelations->GetBinContent(21)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(4));
9315  {
9316   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9317   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9318   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9319   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9320   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9321   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9322   Double_t dSumWLinearFour6n4n6n4n = 0.; // sum of linear event weights for <4>
9323   Double_t dSumWQuadraticFour6n4n6n4n = 0.; // sum of quadratic event weights <4>
9324   Double_t dSpreadFour6n4n6n4n = 0.; // weighted and biased estimator for sigma of <4>
9325   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9326   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9327   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9328   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9329   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9330   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9331   dSumWLinearFour6n4n6n4n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9332   dSumWQuadraticFour6n4n6n4n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9333   dSpreadFour6n4n6n4n = f4pCorrelations->GetBinError(21);
9334   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9335      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9336      pow(dSumWLinearFour6n4n6n4n,2.)>dSumWQuadraticFour6n4n6n4n)
9337   {
9338    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9339                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9340                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9341                    + pow(f2pCorrelations->GetBinContent(4),2.)
9342                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9343                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9344                    + pow((pow(dSumWQuadraticFour6n4n6n4n,0.5)/dSumWLinearFour6n4n6n4n)
9345                    * dSpreadFour6n4n6n4n*pow(pow(dSumWLinearFour6n4n6n4n,2.)/(pow(dSumWLinearFour6n4n6n4n,2.)-dSumWQuadraticFour6n4n6n4n),0.5),2.)
9346                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(4)
9347                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9348                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,6))
9349                    - f2pCorrelations->GetBinContent(4)*f2pCorrelations->GetBinContent(6))
9350                    / (dSumWLinearTwo4n4n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9351                    - 2.*f2pCorrelations->GetBinContent(6)
9352                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9353                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,35))
9354                    - f2pCorrelations->GetBinContent(4)*f4pCorrelations->GetBinContent(21))
9355                    / (dSumWLinearTwo4n4n*dSumWLinearFour6n4n6n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9356                    - 2.*f2pCorrelations->GetBinContent(4)
9357                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9358                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,35))
9359                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(21))
9360                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n4n6n4n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9361    if(dError>0.)
9362    {
9363     f4pCumulants->SetBinError(21,pow(dError,0.5)); 
9364    }
9365   } // end of if(...)
9366  } // end of {
9367  // <4>_{6n,5n|6n,5n}
9368  f4pCumulants->SetBinContent(22,f4pCorrelations->GetBinContent(22)-f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(5));
9369  {
9370   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
9371   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
9372   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
9373   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
9374   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
9375   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
9376   Double_t dSumWLinearFour6n5n6n5n = 0.; // sum of linear event weights for <4>
9377   Double_t dSumWQuadraticFour6n5n6n5n = 0.; // sum of quadratic event weights <4>
9378   Double_t dSpreadFour6n5n6n5n = 0.; // weighted and biased estimator for sigma of <4>
9379   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9380   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9381   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9382   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9383   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9384   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
9385   dSumWLinearFour6n5n6n5n = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9386   dSumWQuadraticFour6n5n6n5n = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9387   dSpreadFour6n5n6n5n = f4pCorrelations->GetBinError(22);
9388   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9389      pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
9390      pow(dSumWLinearFour6n5n6n5n,2.)>dSumWQuadraticFour6n5n6n5n)
9391   {
9392    Double_t dError = pow(f2pCorrelations->GetBinContent(6),2.)
9393                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9394                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9395                    + pow(f2pCorrelations->GetBinContent(5),2.)
9396                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
9397                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
9398                    + pow((pow(dSumWQuadraticFour6n5n6n5n,0.5)/dSumWLinearFour6n5n6n5n)
9399                    * dSpreadFour6n5n6n5n*pow(pow(dSumWLinearFour6n5n6n5n,2.)/(pow(dSumWLinearFour6n5n6n5n,2.)-dSumWQuadraticFour6n5n6n5n),0.5),2.)
9400                    + 2.*f2pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(5)
9401                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2))
9402                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,6))
9403                    - f2pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(6))
9404                    / (dSumWLinearTwo5n5n*dSumWLinearTwo6n6n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,2)))
9405                    - 2.*f2pCorrelations->GetBinContent(6)
9406                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9407                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,36))
9408                    - f2pCorrelations->GetBinContent(5)*f4pCorrelations->GetBinContent(22))
9409                    / (dSumWLinearTwo5n5n*dSumWLinearFour6n5n6n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)))
9410                    - 2.*f2pCorrelations->GetBinContent(5)
9411                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4))
9412                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,36))
9413                    - f2pCorrelations->GetBinContent(6)*f4pCorrelations->GetBinContent(22))
9414                    / (dSumWLinearTwo6n6n*dSumWLinearFour6n5n6n5n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,4)));
9415    if(dError>0.)
9416    {
9417     f4pCumulants->SetBinError(22,pow(dError,0.5)); 
9418    }
9419   } // end of if(...)
9420  } // end of {
9421
9422  // c3) "Two distinct harmonics":
9423  for(Int_t b=24;b<=25;b++)
9424  {
9425   f4pCumulants->SetBinContent(b,f4pCorrelations->GetBinContent(b));
9426   Double_t dSumWLinear = 0.; // sum of linear event weights
9427   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
9428   Double_t dSpread = 0.; // weighted and biased estimator for sigma
9429   Double_t dError = 0.; // weighted and unbiased estimator for sigma
9430   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9431   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9432   dSpread = f4pCorrelations->GetBinError(b);
9433   if(pow(dSumWLinear,2.)>dSumWQuadratic)
9434   {
9435    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
9436    f4pCumulants->SetBinError(b,dError); 
9437   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
9438  } // end of for(Int_t b=24;b<=25;b++)
9439  // c4) "Three distinct harmonics":
9440  for(Int_t b=27;b<=36;b++)
9441  {
9442   f4pCumulants->SetBinContent(b,f4pCorrelations->GetBinContent(b));
9443   Double_t dSumWLinear = 0.; // sum of linear event weights
9444   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
9445   Double_t dSpread = 0.; // weighted and biased estimator for sigma
9446   Double_t dError = 0.; // weighted and unbiased estimator for sigma
9447   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9448   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9449   dSpread = f4pCorrelations->GetBinError(b);
9450   if(pow(dSumWLinear,2.)>dSumWQuadratic)
9451   {
9452    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
9453    f4pCumulants->SetBinError(b,dError); 
9454   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
9455  } // end of for(Int_t b=27;b<=36;b++)
9456  // c5) "Four distinct harmonics":
9457  for(Int_t b=38;b<=45;b++)
9458  {
9459   f4pCumulants->SetBinContent(b,f4pCorrelations->GetBinContent(b));
9460   Double_t dSumWLinear = 0.; // sum of linear event weights
9461   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
9462   Double_t dSpread = 0.; // weighted and biased estimator for sigma
9463   Double_t dError = 0.; // weighted and unbiased estimator for sigma
9464   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(4);
9465   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(4);
9466   dSpread = f4pCorrelations->GetBinError(b);
9467   if(pow(dSumWLinear,2.)>dSumWQuadratic)
9468   {
9469    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
9470    f4pCumulants->SetBinError(b,dError); 
9471   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
9472  } // end of for(Int_t b=38;b<=45;b++)
9473
9474  // d) Calculate 5-p cumulants: 
9475  // d1) "Standard candles":
9476  f5pCumulants->SetBinContent(1,f5pCorrelations->GetBinContent(1)-f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(3));
9477  {
9478   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9479   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9480   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9481   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
9482   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
9483   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
9484   Double_t dSumWLinearFive3n2n3n1n1n = 0.; // sum of linear event weights for <4>
9485   Double_t dSumWQuadraticFive3n2n3n1n1n = 0.; // sum of quadratic event weights <4>
9486   Double_t dSpreadFive3n2n3n1n1n = 0.; // weighted and biased estimator for sigma of <4>
9487   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9488   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9489   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9490   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9491   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9492   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
9493   dSumWLinearFive3n2n3n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
9494   dSumWQuadraticFive3n2n3n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
9495   dSpreadFive3n2n3n1n1n = f5pCorrelations->GetBinError(1);
9496   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9497      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
9498      pow(dSumWLinearFive3n2n3n1n1n,2.)>dSumWQuadraticFive3n2n3n1n1n)
9499   {
9500    Double_t dError = pow(f3pCorrelations->GetBinContent(1),2.)
9501                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9502                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9503                    + pow(f2pCorrelations->GetBinContent(3),2.)
9504                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
9505                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
9506                    + pow((pow(dSumWQuadraticFive3n2n3n1n1n,0.5)/dSumWLinearFive3n2n3n1n1n)
9507                    * dSpreadFive3n2n3n1n1n*pow(pow(dSumWLinearFive3n2n3n1n1n,2.)/(pow(dSumWLinearFive3n2n3n1n1n,2.)-dSumWQuadraticFive3n2n3n1n1n),0.5),2.)
9508                    + 2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(3)
9509                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3))
9510                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,7))
9511                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(1))
9512                    / (dSumWLinearTwo3n3n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
9513                    - 2.*f3pCorrelations->GetBinContent(1)
9514                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5))
9515                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,57))
9516                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(1))
9517                    / (dSumWLinearTwo3n3n*dSumWLinearFive3n2n3n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
9518                    - 2.*f2pCorrelations->GetBinContent(3)
9519                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5))
9520                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,57))
9521                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(1))
9522                    / (dSumWLinearThree2n1n1n*dSumWLinearFive3n2n3n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
9523    if(dError>0.)
9524    {
9525     f5pCumulants->SetBinError(1,pow(dError,0.5)); 
9526    }
9527   } // end of if(...)
9528  } // end of {
9529
9530  f5pCumulants->SetBinContent(2,f5pCorrelations->GetBinContent(2)-f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(1));
9531  {
9532   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
9533   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
9534   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
9535   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
9536   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
9537   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
9538   Double_t dSumWLinearFive4n1n2n2n1n = 0.; // sum of linear event weights for <4>
9539   Double_t dSumWQuadraticFive4n1n2n2n1n = 0.; // sum of quadratic event weights <4>
9540   Double_t dSpreadFive4n1n2n2n1n = 0.; // weighted and biased estimator for sigma of <4>
9541   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9542   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9543   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
9544   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9545   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9546   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
9547   dSumWLinearFive4n1n2n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
9548   dSumWQuadraticFive4n1n2n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
9549   dSpreadFive4n1n2n2n1n = f5pCorrelations->GetBinError(2);
9550   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
9551      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
9552      pow(dSumWLinearFive4n1n2n2n1n,2.)>dSumWQuadraticFive4n1n2n2n1n)
9553   {
9554    Double_t dError = pow(f3pCorrelations->GetBinContent(2),2.)
9555                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
9556                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
9557                    + pow(f2pCorrelations->GetBinContent(1),2.)
9558                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
9559                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
9560                    + pow((pow(dSumWQuadraticFive4n1n2n2n1n,0.5)/dSumWLinearFive4n1n2n2n1n)
9561                    * dSpreadFive4n1n2n2n1n*pow(pow(dSumWLinearFive4n1n2n2n1n,2.)/(pow(dSumWLinearFive4n1n2n2n1n,2.)-dSumWQuadraticFive4n1n2n2n1n),0.5),2.)
9562                    + 2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(1)
9563                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3))
9564                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,8))
9565                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(2))
9566                    / (dSumWLinearTwo1n1n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
9567                    - 2.*f3pCorrelations->GetBinContent(2)
9568                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5))
9569                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,58))
9570                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(2))
9571                    / (dSumWLinearTwo1n1n*dSumWLinearFive4n1n2n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
9572                    - 2.*f2pCorrelations->GetBinContent(1)
9573                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5))
9574                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,58))
9575                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(2))
9576                    / (dSumWLinearThree4n2n2n*dSumWLinearFive4n1n2n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
9577    if(dError>0.)
9578    {
9579     f5pCumulants->SetBinError(2,pow(dError,0.5)); 
9580    }
9581   } // end of if(...)
9582  } // end of {
9583  f5pCumulants->SetBinContent(3,f5pCorrelations->GetBinContent(3)-f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(2));
9584  {
9585   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
9586   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
9587   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
9588   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
9589   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
9590   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
9591   Double_t dSumWLinearFive4n2n3n2n1n = 0.; // sum of linear event weights for <4>
9592   Double_t dSumWQuadraticFive4n2n3n2n1n = 0.; // sum of quadratic event weights <4>
9593   Double_t dSpreadFive4n2n3n2n1n = 0.; // weighted and biased estimator for sigma of <4>
9594   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9595   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9596   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
9597   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9598   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9599   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
9600   dSumWLinearFive4n2n3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
9601   dSumWQuadraticFive4n2n3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
9602   dSpreadFive4n2n3n2n1n = f5pCorrelations->GetBinError(3);
9603   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
9604      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
9605      pow(dSumWLinearFive4n2n3n2n1n,2.)>dSumWQuadraticFive4n2n3n2n1n)
9606   {
9607    Double_t dError = pow(f3pCorrelations->GetBinContent(6),2.)
9608                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
9609                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
9610                    + pow(f2pCorrelations->GetBinContent(2),2.)
9611                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
9612                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
9613                    + pow((pow(dSumWQuadraticFive4n2n3n2n1n,0.5)/dSumWLinearFive4n2n3n2n1n)
9614                    * dSpreadFive4n2n3n2n1n*pow(pow(dSumWLinearFive4n2n3n2n1n,2.)/(pow(dSumWLinearFive4n2n3n2n1n,2.)-dSumWQuadraticFive4n2n3n2n1n),0.5),2.)
9615                    + 2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(2)
9616                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3))
9617                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,11))
9618                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(6))
9619                    / (dSumWLinearTwo2n2n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
9620                    - 2.*f3pCorrelations->GetBinContent(6)
9621                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5))
9622                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,59))
9623                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(3))
9624                    / (dSumWLinearTwo2n2n*dSumWLinearFive4n2n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
9625                    - 2.*f2pCorrelations->GetBinContent(2)
9626                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5))
9627                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,59))
9628                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(3))
9629                    / (dSumWLinearThree4n3n1n*dSumWLinearFive4n2n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
9630    if(dError>0.)
9631    {
9632     f5pCumulants->SetBinError(3,pow(dError,0.5)); 
9633    }
9634   } // end of if(...)
9635  } // end of {
9636  f5pCumulants->SetBinContent(4,f5pCorrelations->GetBinContent(4)-f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(3));
9637  {
9638   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9639   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9640   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9641   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
9642   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
9643   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
9644   Double_t dSumWLinearFive4n3n3n2n2n = 0.; // sum of linear event weights for <4>
9645   Double_t dSumWQuadraticFive4n3n3n2n2n = 0.; // sum of quadratic event weights <4>
9646   Double_t dSpreadFive4n3n3n2n2n = 0.; // weighted and biased estimator for sigma of <4>
9647   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9648   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9649   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9650   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9651   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9652   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
9653   dSumWLinearFive4n3n3n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
9654   dSumWQuadraticFive4n3n3n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
9655   dSpreadFive4n3n3n2n2n = f5pCorrelations->GetBinError(4);
9656   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9657      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
9658      pow(dSumWLinearFive4n3n3n2n2n,2.)>dSumWQuadraticFive4n3n3n2n2n)
9659   {
9660    Double_t dError = pow(f3pCorrelations->GetBinContent(2),2.)
9661                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9662                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9663                    + pow(f2pCorrelations->GetBinContent(3),2.)
9664                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
9665                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
9666                    + pow((pow(dSumWQuadraticFive4n3n3n2n2n,0.5)/dSumWLinearFive4n3n3n2n2n)
9667                    * dSpreadFive4n3n3n2n2n*pow(pow(dSumWLinearFive4n3n3n2n2n,2.)/(pow(dSumWLinearFive4n3n3n2n2n,2.)-dSumWQuadraticFive4n3n3n2n2n),0.5),2.)
9668                    + 2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(3)
9669                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3))
9670                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,8))
9671                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(2))
9672                    / (dSumWLinearTwo3n3n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
9673                    - 2.*f3pCorrelations->GetBinContent(2)
9674                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5))
9675                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,60))
9676                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(4))
9677                    / (dSumWLinearTwo3n3n*dSumWLinearFive4n3n3n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
9678                    - 2.*f2pCorrelations->GetBinContent(3)
9679                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5))
9680                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,60))
9681                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(4))
9682                    / (dSumWLinearThree4n2n2n*dSumWLinearFive4n3n3n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
9683    if(dError>0.)
9684    {
9685     f5pCumulants->SetBinError(4,pow(dError,0.5)); 
9686    }
9687   } // end of if(...)
9688  } // end of {
9689  f5pCumulants->SetBinContent(5,f5pCorrelations->GetBinContent(5)-f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(4));
9690  {
9691   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9692   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9693   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9694   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
9695   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
9696   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
9697   Double_t dSumWLinearFive4n2n4n1n1n = 0.; // sum of linear event weights for <4>
9698   Double_t dSumWQuadraticFive4n2n4n1n1n = 0.; // sum of quadratic event weights <4>
9699   Double_t dSpreadFive4n2n4n1n1n = 0.; // weighted and biased estimator for sigma of <4>
9700   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9701   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9702   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9703   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9704   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9705   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
9706   dSumWLinearFive4n2n4n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
9707   dSumWQuadraticFive4n2n4n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
9708   dSpreadFive4n2n4n1n1n = f5pCorrelations->GetBinError(5);
9709   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9710      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
9711      pow(dSumWLinearFive4n2n4n1n1n,2.)>dSumWQuadraticFive4n2n4n1n1n)
9712   {
9713    Double_t dError = pow(f3pCorrelations->GetBinContent(1),2.)
9714                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9715                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9716                    + pow(f2pCorrelations->GetBinContent(4),2.)
9717                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
9718                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
9719                    + pow((pow(dSumWQuadraticFive4n2n4n1n1n,0.5)/dSumWLinearFive4n2n4n1n1n)
9720                    * dSpreadFive4n2n4n1n1n*pow(pow(dSumWLinearFive4n2n4n1n1n,2.)/(pow(dSumWLinearFive4n2n4n1n1n,2.)-dSumWQuadraticFive4n2n4n1n1n),0.5),2.)
9721                    + 2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(4)
9722                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
9723                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,7)) 
9724                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(1))
9725                    / (dSumWLinearTwo4n4n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
9726                    - 2.*f3pCorrelations->GetBinContent(1)
9727                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
9728                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,61))
9729                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(5))
9730                    / (dSumWLinearTwo4n4n*dSumWLinearFive4n2n4n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
9731                    - 2.*f2pCorrelations->GetBinContent(4)
9732                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
9733                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,61))
9734                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(5))
9735                    / (dSumWLinearThree2n1n1n*dSumWLinearFive4n2n4n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
9736    if(dError>0.)
9737    {
9738     f5pCumulants->SetBinError(5,pow(dError,0.5)); 
9739    }
9740   } // end of if(...)
9741  } // end of {
9742  f5pCumulants->SetBinContent(6,f5pCorrelations->GetBinContent(6)-f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(4));
9743  {
9744   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
9745   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
9746   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
9747   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
9748   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
9749   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
9750   Double_t dSumWLinearFive4n3n4n2n1n = 0.; // sum of linear event weights for <4>
9751   Double_t dSumWQuadraticFive4n3n4n2n1n = 0.; // sum of quadratic event weights <4>
9752   Double_t dSpreadFive4n3n4n2n1n = 0.; // weighted and biased estimator for sigma of <4>
9753   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9754   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9755   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
9756   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9757   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9758   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
9759   dSumWLinearFive4n3n4n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
9760   dSumWQuadraticFive4n3n4n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
9761   dSpreadFive4n3n4n2n1n = f5pCorrelations->GetBinError(6);
9762   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
9763      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
9764      pow(dSumWLinearFive4n3n4n2n1n,2.)>dSumWQuadraticFive4n3n4n2n1n)
9765   {
9766    Double_t dError = pow(f3pCorrelations->GetBinContent(5),2.)
9767                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
9768                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
9769                    + pow(f2pCorrelations->GetBinContent(4),2.)
9770                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
9771                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
9772                    + pow((pow(dSumWQuadraticFive4n3n4n2n1n,0.5)/dSumWLinearFive4n3n4n2n1n)
9773                    * dSpreadFive4n3n4n2n1n*pow(pow(dSumWLinearFive4n3n4n2n1n,2.)/(pow(dSumWLinearFive4n3n4n2n1n,2.)-dSumWQuadraticFive4n3n4n2n1n),0.5),2.)
9774                    + 2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(4)
9775                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
9776                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,10)) 
9777                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(5))
9778                    / (dSumWLinearTwo4n4n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
9779                    - 2.*f3pCorrelations->GetBinContent(5)
9780                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
9781                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,62))
9782                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(6))
9783                    / (dSumWLinearTwo4n4n*dSumWLinearFive4n3n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
9784                    - 2.*f2pCorrelations->GetBinContent(4)
9785                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
9786                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,62))
9787                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(6))
9788                    / (dSumWLinearThree3n2n1n*dSumWLinearFive4n3n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
9789    if(dError>0.)
9790    {
9791     f5pCumulants->SetBinError(6,pow(dError,0.5)); 
9792    }
9793   } // end of if(...)
9794  } // end of {
9795  f5pCumulants->SetBinContent(7,f5pCorrelations->GetBinContent(7)-f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(1));
9796  {
9797   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
9798   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
9799   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
9800   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
9801   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
9802   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
9803   Double_t dSumWLinearFive5n1n3n2n1n = 0.; // sum of linear event weights for <4>
9804   Double_t dSumWQuadraticFive5n1n3n2n1n = 0.; // sum of quadratic event weights <4>
9805   Double_t dSpreadFive5n1n3n2n1n = 0.; // weighted and biased estimator for sigma of <4>
9806   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9807   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9808   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
9809   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9810   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9811   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
9812   dSumWLinearFive5n1n3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
9813   dSumWQuadraticFive5n1n3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
9814   dSpreadFive5n1n3n2n1n = f5pCorrelations->GetBinError(7);
9815   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
9816      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
9817      pow(dSumWLinearFive5n1n3n2n1n,2.)>dSumWQuadraticFive5n1n3n2n1n)
9818   {
9819    Double_t dError = pow(f3pCorrelations->GetBinContent(7),2.)
9820                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
9821                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
9822                    + pow(f2pCorrelations->GetBinContent(1),2.)
9823                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
9824                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
9825                    + pow((pow(dSumWQuadraticFive5n1n3n2n1n,0.5)/dSumWLinearFive5n1n3n2n1n)
9826                    * dSpreadFive5n1n3n2n1n*pow(pow(dSumWLinearFive5n1n3n2n1n,2.)/(pow(dSumWLinearFive5n1n3n2n1n,2.)-dSumWQuadraticFive5n1n3n2n1n),0.5),2.)
9827                    + 2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(1)
9828                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
9829                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,12)) 
9830                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(7))
9831                    / (dSumWLinearTwo1n1n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
9832                    - 2.*f3pCorrelations->GetBinContent(7)
9833                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
9834                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,63))
9835                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(7))
9836                    / (dSumWLinearTwo1n1n*dSumWLinearFive5n1n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
9837                    - 2.*f2pCorrelations->GetBinContent(1)
9838                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
9839                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,63))
9840                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(7))
9841                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n1n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
9842    if(dError>0.)
9843    {
9844     f5pCumulants->SetBinError(7,pow(dError,0.5)); 
9845    }
9846   } // end of if(...)
9847  } // end of {
9848  f5pCumulants->SetBinContent(8,f5pCorrelations->GetBinContent(8)-f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(5));
9849  {
9850   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
9851   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
9852   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
9853   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
9854   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
9855   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
9856   Double_t dSumWLinearFive5n2n5n1n1n = 0.; // sum of linear event weights for <4>
9857   Double_t dSumWQuadraticFive5n2n5n1n1n = 0.; // sum of quadratic event weights <4>
9858   Double_t dSpreadFive5n2n5n1n1n = 0.; // weighted and biased estimator for sigma of <4>
9859   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9860   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9861   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
9862   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9863   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9864   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
9865   dSumWLinearFive5n2n5n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
9866   dSumWQuadraticFive5n2n5n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
9867   dSpreadFive5n2n5n1n1n = f5pCorrelations->GetBinError(8);
9868   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
9869      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
9870      pow(dSumWLinearFive5n2n5n1n1n,2.)>dSumWQuadraticFive5n2n5n1n1n)
9871   {
9872    Double_t dError = pow(f3pCorrelations->GetBinContent(1),2.)
9873                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
9874                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
9875                    + pow(f2pCorrelations->GetBinContent(5),2.)
9876                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
9877                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
9878                    + pow((pow(dSumWQuadraticFive5n2n5n1n1n,0.5)/dSumWLinearFive5n2n5n1n1n)
9879                    * dSpreadFive5n2n5n1n1n*pow(pow(dSumWLinearFive5n2n5n1n1n,2.)/(pow(dSumWLinearFive5n2n5n1n1n,2.)-dSumWQuadraticFive5n2n5n1n1n),0.5),2.)
9880                    + 2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(5)
9881                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
9882                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,7)) 
9883                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(1))
9884                    / (dSumWLinearTwo5n5n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
9885                    - 2.*f3pCorrelations->GetBinContent(1)
9886                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
9887                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,64))
9888                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(8))
9889                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n2n5n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
9890                    - 2.*f2pCorrelations->GetBinContent(5)
9891                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
9892                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,64))
9893                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(8))
9894                    / (dSumWLinearThree2n1n1n*dSumWLinearFive5n2n5n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
9895    if(dError>0.)
9896    {
9897     f5pCumulants->SetBinError(8,pow(dError,0.5)); 
9898    }
9899   } // end of if(...)
9900  } // end of {
9901  f5pCumulants->SetBinContent(9,f5pCorrelations->GetBinContent(9)-f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(2));
9902  {
9903   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
9904   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
9905   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
9906   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
9907   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
9908   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
9909   Double_t dSumWLinearFive5n2n4n2n1n = 0.; // sum of linear event weights for <4>
9910   Double_t dSumWQuadraticFive5n2n4n2n1n = 0.; // sum of quadratic event weights <4>
9911   Double_t dSpreadFive5n2n4n2n1n = 0.; // weighted and biased estimator for sigma of <4>
9912   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9913   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9914   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
9915   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9916   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9917   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
9918   dSumWLinearFive5n2n4n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
9919   dSumWQuadraticFive5n2n4n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
9920   dSpreadFive5n2n4n2n1n = f5pCorrelations->GetBinError(9);
9921   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
9922      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
9923      pow(dSumWLinearFive5n2n4n2n1n,2.)>dSumWQuadraticFive5n2n4n2n1n)
9924   {
9925    Double_t dError = pow(f3pCorrelations->GetBinContent(8),2.)
9926                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
9927                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
9928                    + pow(f2pCorrelations->GetBinContent(2),2.)
9929                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
9930                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
9931                    + pow((pow(dSumWQuadraticFive5n2n4n2n1n,0.5)/dSumWLinearFive5n2n4n2n1n)
9932                    * dSpreadFive5n2n4n2n1n*pow(pow(dSumWLinearFive5n2n4n2n1n,2.)/(pow(dSumWLinearFive5n2n4n2n1n,2.)-dSumWQuadraticFive5n2n4n2n1n),0.5),2.)
9933                    + 2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(2)
9934                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
9935                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,13)) 
9936                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(8))
9937                    / (dSumWLinearTwo2n2n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
9938                    - 2.*f3pCorrelations->GetBinContent(8)
9939                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
9940                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,65))
9941                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(9))
9942                    / (dSumWLinearTwo2n2n*dSumWLinearFive5n2n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
9943                    - 2.*f2pCorrelations->GetBinContent(2)
9944                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
9945                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,65))
9946                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(9))
9947                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n2n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
9948    if(dError>0.)
9949    {
9950     f5pCumulants->SetBinError(9,pow(dError,0.5)); 
9951    }
9952   } // end of if(...)
9953  } // end of {
9954  f5pCumulants->SetBinContent(10,f5pCorrelations->GetBinContent(10)-f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(3));
9955  {
9956   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
9957   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
9958   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
9959   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
9960   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
9961   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
9962   Double_t dSumWLinearFive5n3n4n3n1n = 0.; // sum of linear event weights for <4>
9963   Double_t dSumWQuadraticFive5n3n4n3n1n = 0.; // sum of quadratic event weights <4>
9964   Double_t dSpreadFive5n3n4n3n1n = 0.; // weighted and biased estimator for sigma of <4>
9965   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
9966   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
9967   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
9968   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
9969   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
9970   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
9971   dSumWLinearFive5n3n4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
9972   dSumWQuadraticFive5n3n4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
9973   dSpreadFive5n3n4n3n1n = f5pCorrelations->GetBinError(10);
9974   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
9975      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
9976      pow(dSumWLinearFive5n3n4n3n1n,2.)>dSumWQuadraticFive5n3n4n3n1n)
9977   {
9978    Double_t dError = pow(f3pCorrelations->GetBinContent(8),2.)
9979                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
9980                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
9981                    + pow(f2pCorrelations->GetBinContent(3),2.)
9982                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
9983                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
9984                    + pow((pow(dSumWQuadraticFive5n3n4n3n1n,0.5)/dSumWLinearFive5n3n4n3n1n)
9985                    * dSpreadFive5n3n4n3n1n*pow(pow(dSumWLinearFive5n3n4n3n1n,2.)/(pow(dSumWLinearFive5n3n4n3n1n,2.)-dSumWQuadraticFive5n3n4n3n1n),0.5),2.)
9986                    + 2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(3)
9987                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
9988                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,13)) 
9989                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(8))
9990                    / (dSumWLinearTwo3n3n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
9991                    - 2.*f3pCorrelations->GetBinContent(8)
9992                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
9993                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,66))
9994                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(10))
9995                    / (dSumWLinearTwo3n3n*dSumWLinearFive5n3n4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
9996                    - 2.*f2pCorrelations->GetBinContent(3)
9997                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
9998                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,66))
9999                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(10))
10000                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n3n4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10001    if(dError>0.)
10002    {
10003     f5pCumulants->SetBinError(10,pow(dError,0.5)); 
10004    }
10005   } // end of if(...)
10006  } // end of {
10007  f5pCumulants->SetBinContent(11,f5pCorrelations->GetBinContent(11)-f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(4));
10008  {
10009   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
10010   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
10011   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
10012   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
10013   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
10014   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
10015   Double_t dSumWLinearFive5n4n4n3n2n = 0.; // sum of linear event weights for <4>
10016   Double_t dSumWQuadraticFive5n4n4n3n2n = 0.; // sum of quadratic event weights <4>
10017   Double_t dSpreadFive5n4n4n3n2n = 0.; // weighted and biased estimator for sigma of <4>
10018   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10019   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10020   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
10021   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10022   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10023   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
10024   dSumWLinearFive5n4n4n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10025   dSumWQuadraticFive5n4n4n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10026   dSpreadFive5n4n4n3n2n = f5pCorrelations->GetBinError(11);
10027   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
10028      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
10029      pow(dSumWLinearFive5n4n4n3n2n,2.)>dSumWQuadraticFive5n4n4n3n2n)
10030   {
10031    Double_t dError = pow(f3pCorrelations->GetBinContent(7),2.)
10032                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
10033                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
10034                    + pow(f2pCorrelations->GetBinContent(4),2.)
10035                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
10036                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
10037                    + pow((pow(dSumWQuadraticFive5n4n4n3n2n,0.5)/dSumWLinearFive5n4n4n3n2n)
10038                    * dSpreadFive5n4n4n3n2n*pow(pow(dSumWLinearFive5n4n4n3n2n,2.)/(pow(dSumWLinearFive5n4n4n3n2n,2.)-dSumWQuadraticFive5n4n4n3n2n),0.5),2.)
10039                    + 2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(4)
10040                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10041                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,12)) 
10042                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(7))
10043                    / (dSumWLinearTwo4n4n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10044                    - 2.*f3pCorrelations->GetBinContent(7)
10045                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10046                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,67))
10047                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(11))
10048                    / (dSumWLinearTwo4n4n*dSumWLinearFive5n4n4n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10049                    - 2.*f2pCorrelations->GetBinContent(4)
10050                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10051                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,67))
10052                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(11))
10053                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n4n4n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10054    if(dError>0.)
10055    {
10056     f5pCumulants->SetBinError(11,pow(dError,0.5)); 
10057    }
10058   } // end of if(...)
10059  } // end of {
10060  f5pCumulants->SetBinContent(12,f5pCorrelations->GetBinContent(12)-f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(5));
10061  {
10062   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
10063   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
10064   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
10065   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
10066   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
10067   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
10068   Double_t dSumWLinearFive5n3n5n2n1n = 0.; // sum of linear event weights for <4>
10069   Double_t dSumWQuadraticFive5n3n5n2n1n = 0.; // sum of quadratic event weights <4>
10070   Double_t dSpreadFive5n3n5n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10071   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10072   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10073   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
10074   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10075   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10076   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
10077   dSumWLinearFive5n3n5n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10078   dSumWQuadraticFive5n3n5n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10079   dSpreadFive5n3n5n2n1n = f5pCorrelations->GetBinError(12);
10080   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
10081      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
10082      pow(dSumWLinearFive5n3n5n2n1n,2.)>dSumWQuadraticFive5n3n5n2n1n)
10083   {
10084    Double_t dError = pow(f3pCorrelations->GetBinContent(5),2.)
10085                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
10086                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
10087                    + pow(f2pCorrelations->GetBinContent(5),2.)
10088                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
10089                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
10090                    + pow((pow(dSumWQuadraticFive5n3n5n2n1n,0.5)/dSumWLinearFive5n3n5n2n1n)
10091                    * dSpreadFive5n3n5n2n1n*pow(pow(dSumWLinearFive5n3n5n2n1n,2.)/(pow(dSumWLinearFive5n3n5n2n1n,2.)-dSumWQuadraticFive5n3n5n2n1n),0.5),2.)
10092                    + 2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(5)
10093                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10094                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,10)) 
10095                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(5))
10096                    / (dSumWLinearTwo5n5n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10097                    - 2.*f3pCorrelations->GetBinContent(5)
10098                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10099                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,68))
10100                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(12))
10101                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n3n5n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10102                    - 2.*f2pCorrelations->GetBinContent(5)
10103                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10104                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,68))
10105                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(12))
10106                    / (dSumWLinearThree3n2n1n*dSumWLinearFive5n3n5n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10107    if(dError>0.)
10108    {
10109     f5pCumulants->SetBinError(12,pow(dError,0.5)); 
10110    }
10111   } // end of if(...)
10112  } // end of {
10113  f5pCumulants->SetBinContent(13,f5pCorrelations->GetBinContent(13)-f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(5));
10114  {
10115   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
10116   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
10117   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
10118   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
10119   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
10120   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
10121   Double_t dSumWLinearFive5n4n5n2n2n = 0.; // sum of linear event weights for <4>
10122   Double_t dSumWQuadraticFive5n4n5n2n2n = 0.; // sum of quadratic event weights <4>
10123   Double_t dSpreadFive5n4n5n2n2n = 0.; // weighted and biased estimator for sigma of <4>
10124   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10125   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10126   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
10127   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10128   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10129   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
10130   dSumWLinearFive5n4n5n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10131   dSumWQuadraticFive5n4n5n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10132   dSpreadFive5n4n5n2n2n = f5pCorrelations->GetBinError(13);
10133   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
10134      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
10135      pow(dSumWLinearFive5n4n5n2n2n,2.)>dSumWQuadraticFive5n4n5n2n2n)
10136   {
10137    Double_t dError = pow(f3pCorrelations->GetBinContent(2),2.)
10138                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
10139                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
10140                    + pow(f2pCorrelations->GetBinContent(5),2.)
10141                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
10142                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
10143                    + pow((pow(dSumWQuadraticFive5n4n5n2n2n,0.5)/dSumWLinearFive5n4n5n2n2n)
10144                    * dSpreadFive5n4n5n2n2n*pow(pow(dSumWLinearFive5n4n5n2n2n,2.)/(pow(dSumWLinearFive5n4n5n2n2n,2.)-dSumWQuadraticFive5n4n5n2n2n),0.5),2.)
10145                    + 2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(5)
10146                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10147                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,8)) 
10148                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(2))
10149                    / (dSumWLinearTwo5n5n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10150                    - 2.*f3pCorrelations->GetBinContent(2)
10151                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10152                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,69))
10153                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(13))
10154                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n4n5n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10155                    - 2.*f2pCorrelations->GetBinContent(5)
10156                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10157                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,69))
10158                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(13))
10159                    / (dSumWLinearThree4n2n2n*dSumWLinearFive5n4n5n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10160    if(dError>0.)
10161    {
10162     f5pCumulants->SetBinError(13,pow(dError,0.5)); 
10163    }
10164   } // end of if(...)
10165  } // end of {
10166  f5pCumulants->SetBinContent(14,f5pCorrelations->GetBinContent(14)-f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(5));
10167  {
10168   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
10169   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
10170   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
10171   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
10172   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
10173   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
10174   Double_t dSumWLinearFive5n4n5n3n1n = 0.; // sum of linear event weights for <4>
10175   Double_t dSumWQuadraticFive5n4n5n3n1n = 0.; // sum of quadratic event weights <4>
10176   Double_t dSpreadFive5n4n5n3n1n = 0.; // weighted and biased estimator for sigma of <4>
10177   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10178   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10179   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
10180   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10181   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10182   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
10183   dSumWLinearFive5n4n5n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10184   dSumWQuadraticFive5n4n5n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10185   dSpreadFive5n4n5n3n1n = f5pCorrelations->GetBinError(14);
10186   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
10187      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
10188      pow(dSumWLinearFive5n4n5n3n1n,2.)>dSumWQuadraticFive5n4n5n3n1n)
10189   {
10190    Double_t dError = pow(f3pCorrelations->GetBinContent(6),2.)
10191                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
10192                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
10193                    + pow(f2pCorrelations->GetBinContent(5),2.)
10194                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
10195                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
10196                    + pow((pow(dSumWQuadraticFive5n4n5n3n1n,0.5)/dSumWLinearFive5n4n5n3n1n)
10197                    * dSpreadFive5n4n5n3n1n*pow(pow(dSumWLinearFive5n4n5n3n1n,2.)/(pow(dSumWLinearFive5n4n5n3n1n,2.)-dSumWQuadraticFive5n4n5n3n1n),0.5),2.)
10198                    + 2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(5)
10199                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10200                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,11)) 
10201                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(6))
10202                    / (dSumWLinearTwo5n5n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10203                    - 2.*f3pCorrelations->GetBinContent(6)
10204                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10205                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,70))
10206                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(14))
10207                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n4n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10208                    - 2.*f2pCorrelations->GetBinContent(5)
10209                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10210                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,70))
10211                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(14))
10212                    / (dSumWLinearThree4n3n1n*dSumWLinearFive5n4n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10213    if(dError>0.)
10214    {
10215     f5pCumulants->SetBinError(14,pow(dError,0.5)); 
10216    }
10217   } // end of if(...)
10218  } // end of {
10219  f5pCumulants->SetBinContent(15,f5pCorrelations->GetBinContent(15)-f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(1));
10220  {
10221   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
10222   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
10223   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
10224   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
10225   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
10226   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
10227   Double_t dSumWLinearFive6n1n3n3n1n = 0.; // sum of linear event weights for <4>
10228   Double_t dSumWQuadraticFive6n1n3n3n1n = 0.; // sum of quadratic event weights <4>
10229   Double_t dSpreadFive6n1n3n3n1n = 0.; // weighted and biased estimator for sigma of <4>
10230   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10231   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10232   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
10233   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10234   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10235   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
10236   dSumWLinearFive6n1n3n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10237   dSumWQuadraticFive6n1n3n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10238   dSpreadFive6n1n3n3n1n = f5pCorrelations->GetBinError(15);
10239   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
10240      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
10241      pow(dSumWLinearFive6n1n3n3n1n,2.)>dSumWQuadraticFive6n1n3n3n1n)
10242   {
10243    Double_t dError = pow(f3pCorrelations->GetBinContent(3),2.)
10244                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
10245                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
10246                    + pow(f2pCorrelations->GetBinContent(1),2.)
10247                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
10248                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
10249                    + pow((pow(dSumWQuadraticFive6n1n3n3n1n,0.5)/dSumWLinearFive6n1n3n3n1n)
10250                    * dSpreadFive6n1n3n3n1n*pow(pow(dSumWLinearFive6n1n3n3n1n,2.)/(pow(dSumWLinearFive6n1n3n3n1n,2.)-dSumWQuadraticFive6n1n3n3n1n),0.5),2.)
10251                    + 2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(1)
10252                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10253                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,9)) 
10254                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(3))
10255                    / (dSumWLinearTwo1n1n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10256                    - 2.*f3pCorrelations->GetBinContent(3)
10257                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10258                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,71))
10259                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(15))
10260                    / (dSumWLinearTwo1n1n*dSumWLinearFive6n1n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10261                    - 2.*f2pCorrelations->GetBinContent(1)
10262                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10263                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,71))
10264                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(15))
10265                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n1n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10266    if(dError>0.)
10267    {
10268     f5pCumulants->SetBinError(15,pow(dError,0.5)); 
10269    }
10270   } // end of if(...)
10271  } // end of {
10272  f5pCumulants->SetBinContent(16,f5pCorrelations->GetBinContent(16)-f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(2));
10273  {
10274   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
10275   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
10276   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
10277   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
10278   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
10279   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
10280   Double_t dSumWLinearFive6n2n3n3n2n = 0.; // sum of linear event weights for <4>
10281   Double_t dSumWQuadraticFive6n2n3n3n2n = 0.; // sum of quadratic event weights <4>
10282   Double_t dSpreadFive6n2n3n3n2n = 0.; // weighted and biased estimator for sigma of <4>
10283   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10284   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10285   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
10286   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10287   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10288   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
10289   dSumWLinearFive6n2n3n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10290   dSumWQuadraticFive6n2n3n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10291   dSpreadFive6n2n3n3n2n = f5pCorrelations->GetBinError(16);
10292   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
10293      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
10294      pow(dSumWLinearFive6n2n3n3n2n,2.)>dSumWQuadraticFive6n2n3n3n2n)
10295   {
10296    Double_t dError = pow(f3pCorrelations->GetBinContent(3),2.)
10297                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
10298                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
10299                    + pow(f2pCorrelations->GetBinContent(2),2.)
10300                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
10301                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
10302                    + pow((pow(dSumWQuadraticFive6n2n3n3n2n,0.5)/dSumWLinearFive6n2n3n3n2n)
10303                    * dSpreadFive6n2n3n3n2n*pow(pow(dSumWLinearFive6n2n3n3n2n,2.)/(pow(dSumWLinearFive6n2n3n3n2n,2.)-dSumWQuadraticFive6n2n3n3n2n),0.5),2.)
10304                    + 2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(2)
10305                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10306                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,9)) 
10307                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(3))
10308                    / (dSumWLinearTwo2n2n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10309                    - 2.*f3pCorrelations->GetBinContent(3)
10310                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10311                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,72))
10312                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(16))
10313                    / (dSumWLinearTwo2n2n*dSumWLinearFive6n2n3n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10314                    - 2.*f2pCorrelations->GetBinContent(2)
10315                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10316                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,72))
10317                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(16))
10318                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n2n3n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10319    if(dError>0.)
10320    {
10321     f5pCumulants->SetBinError(16,pow(dError,0.5)); 
10322    }
10323   } // end of if(...)
10324  } // end of {
10325  f5pCumulants->SetBinContent(17,f5pCorrelations->GetBinContent(17)-f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(1));
10326  {
10327   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
10328   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
10329   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
10330   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
10331   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
10332   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
10333   Double_t dSumWLinearFive6n1n4n2n1n = 0.; // sum of linear event weights for <4>
10334   Double_t dSumWQuadraticFive6n1n4n2n1n = 0.; // sum of quadratic event weights <4>
10335   Double_t dSpreadFive6n1n4n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10336   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10337   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10338   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
10339   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10340   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10341   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
10342   dSumWLinearFive6n1n4n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10343   dSumWQuadraticFive6n1n4n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10344   dSpreadFive6n1n4n2n1n = f5pCorrelations->GetBinError(17);
10345   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
10346      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
10347      pow(dSumWLinearFive6n1n4n2n1n,2.)>dSumWQuadraticFive6n1n4n2n1n)
10348   {
10349    Double_t dError = pow(f3pCorrelations->GetBinContent(9),2.)
10350                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
10351                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
10352                    + pow(f2pCorrelations->GetBinContent(1),2.)
10353                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
10354                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
10355                    + pow((pow(dSumWQuadraticFive6n1n4n2n1n,0.5)/dSumWLinearFive6n1n4n2n1n)
10356                    * dSpreadFive6n1n4n2n1n*pow(pow(dSumWLinearFive6n1n4n2n1n,2.)/(pow(dSumWLinearFive6n1n4n2n1n,2.)-dSumWQuadraticFive6n1n4n2n1n),0.5),2.)
10357                    + 2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(1)
10358                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10359                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,14)) 
10360                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(9))
10361                    / (dSumWLinearTwo1n1n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10362                    - 2.*f3pCorrelations->GetBinContent(9)
10363                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10364                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,73))
10365                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(17))
10366                    / (dSumWLinearTwo1n1n*dSumWLinearFive6n1n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10367                    - 2.*f2pCorrelations->GetBinContent(1)
10368                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10369                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,73))
10370                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(17))
10371                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n1n4n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10372    if(dError>0.)
10373    {
10374     f5pCumulants->SetBinError(17,pow(dError,0.5)); 
10375    }
10376   } // end of if(...)
10377  } // end of {
10378  f5pCumulants->SetBinContent(18,f5pCorrelations->GetBinContent(18)-f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(3));
10379  {
10380   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
10381   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
10382   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
10383   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
10384   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
10385   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
10386   Double_t dSumWLinearFive6n3n4n3n2n = 0.; // sum of linear event weights for <4>
10387   Double_t dSumWQuadraticFive6n3n4n3n2n = 0.; // sum of quadratic event weights <4>
10388   Double_t dSpreadFive6n3n4n3n2n = 0.; // weighted and biased estimator for sigma of <4>
10389   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10390   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10391   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
10392   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10393   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10394   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
10395   dSumWLinearFive6n3n4n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10396   dSumWQuadraticFive6n3n4n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10397   dSpreadFive6n3n4n3n2n = f5pCorrelations->GetBinError(18);
10398   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
10399      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
10400      pow(dSumWLinearFive6n3n4n3n2n,2.)>dSumWQuadraticFive6n3n4n3n2n)
10401   {
10402    Double_t dError = pow(f3pCorrelations->GetBinContent(9),2.)
10403                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
10404                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
10405                    + pow(f2pCorrelations->GetBinContent(3),2.)
10406                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
10407                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
10408                    + pow((pow(dSumWQuadraticFive6n3n4n3n2n,0.5)/dSumWLinearFive6n3n4n3n2n)
10409                    * dSpreadFive6n3n4n3n2n*pow(pow(dSumWLinearFive6n3n4n3n2n,2.)/(pow(dSumWLinearFive6n3n4n3n2n,2.)-dSumWQuadraticFive6n3n4n3n2n),0.5),2.)
10410                    + 2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(3)
10411                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10412                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,14)) 
10413                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(9))
10414                    / (dSumWLinearTwo3n3n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10415                    - 2.*f3pCorrelations->GetBinContent(9)
10416                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10417                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,74))
10418                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(18))
10419                    / (dSumWLinearTwo3n3n*dSumWLinearFive6n3n4n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10420                    - 2.*f2pCorrelations->GetBinContent(3)
10421                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10422                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,74))
10423                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(18))
10424                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n3n4n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10425    if(dError>0.)
10426    {
10427     f5pCumulants->SetBinError(18,pow(dError,0.5)); 
10428    }
10429   } // end of if(...)
10430  } // end of {
10431  f5pCumulants->SetBinContent(19,f5pCorrelations->GetBinContent(19)-f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(4));
10432  {
10433   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
10434   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
10435   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
10436   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
10437   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
10438   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
10439   Double_t dSumWLinearFive6n4n4n3n3n = 0.; // sum of linear event weights for <4>
10440   Double_t dSumWQuadraticFive6n4n4n3n3n = 0.; // sum of quadratic event weights <4>
10441   Double_t dSpreadFive6n4n4n3n3n = 0.; // weighted and biased estimator for sigma of <4>
10442   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10443   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10444   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
10445   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10446   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10447   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
10448   dSumWLinearFive6n4n4n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10449   dSumWQuadraticFive6n4n4n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10450   dSpreadFive6n4n4n3n3n = f5pCorrelations->GetBinError(19);
10451   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
10452      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
10453      pow(dSumWLinearFive6n4n4n3n3n,2.)>dSumWQuadraticFive6n4n4n3n3n)
10454   {
10455    Double_t dError = pow(f3pCorrelations->GetBinContent(3),2.)
10456                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
10457                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
10458                    + pow(f2pCorrelations->GetBinContent(4),2.)
10459                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
10460                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
10461                    + pow((pow(dSumWQuadraticFive6n4n4n3n3n,0.5)/dSumWLinearFive6n4n4n3n3n)
10462                    * dSpreadFive6n4n4n3n3n*pow(pow(dSumWLinearFive6n4n4n3n3n,2.)/(pow(dSumWLinearFive6n4n4n3n3n,2.)-dSumWQuadraticFive6n4n4n3n3n),0.5),2.)
10463                    + 2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(4)
10464                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10465                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,9)) 
10466                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(3))
10467                    / (dSumWLinearTwo4n4n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10468                    - 2.*f3pCorrelations->GetBinContent(3)
10469                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10470                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,75))
10471                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(19))
10472                    / (dSumWLinearTwo4n4n*dSumWLinearFive6n4n4n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10473                    - 2.*f2pCorrelations->GetBinContent(4)
10474                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10475                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,75))
10476                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(19))
10477                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n4n4n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10478    if(dError>0.)
10479    {
10480     f5pCumulants->SetBinError(19,pow(dError,0.5)); 
10481    }
10482   } // end of if(...)
10483  } // end of {
10484  f5pCumulants->SetBinContent(20,f5pCorrelations->GetBinContent(20)-f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(2));
10485  {
10486   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
10487   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
10488   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
10489   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
10490   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
10491   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
10492   Double_t dSumWLinearFive6n2n5n2n1n = 0.; // sum of linear event weights for <4>
10493   Double_t dSumWQuadraticFive6n2n5n2n1n = 0.; // sum of quadratic event weights <4>
10494   Double_t dSpreadFive6n2n5n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10495   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10496   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10497   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
10498   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10499   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10500   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
10501   dSumWLinearFive6n2n5n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10502   dSumWQuadraticFive6n2n5n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10503   dSpreadFive6n2n5n2n1n = f5pCorrelations->GetBinError(20);
10504   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
10505      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
10506      pow(dSumWLinearFive6n2n5n2n1n,2.)>dSumWQuadraticFive6n2n5n2n1n)
10507   {
10508    Double_t dError = pow(f3pCorrelations->GetBinContent(10),2.)
10509                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
10510                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
10511                    + pow(f2pCorrelations->GetBinContent(2),2.)
10512                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
10513                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
10514                    + pow((pow(dSumWQuadraticFive6n2n5n2n1n,0.5)/dSumWLinearFive6n2n5n2n1n)
10515                    * dSpreadFive6n2n5n2n1n*pow(pow(dSumWLinearFive6n2n5n2n1n,2.)/(pow(dSumWLinearFive6n2n5n2n1n,2.)-dSumWQuadraticFive6n2n5n2n1n),0.5),2.)
10516                    + 2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(2)
10517                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10518                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,15)) 
10519                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(10))
10520                    / (dSumWLinearTwo2n2n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10521                    - 2.*f3pCorrelations->GetBinContent(10)
10522                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10523                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,76))
10524                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(20))
10525                    / (dSumWLinearTwo2n2n*dSumWLinearFive6n2n5n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10526                    - 2.*f2pCorrelations->GetBinContent(2)
10527                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10528                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,76))
10529                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(20))
10530                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n2n5n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10531    if(dError>0.)
10532    {
10533     f5pCumulants->SetBinError(20,pow(dError,0.5)); 
10534    }
10535   } // end of if(...)
10536  } // end of {
10537  f5pCumulants->SetBinContent(21,f5pCorrelations->GetBinContent(21)-f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(3));
10538  {
10539   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
10540   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
10541   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
10542   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
10543   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
10544   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
10545   Double_t dSumWLinearFive6n3n5n3n1n = 0.; // sum of linear event weights for <4>
10546   Double_t dSumWQuadraticFive6n3n5n3n1n = 0.; // sum of quadratic event weights <4>
10547   Double_t dSpreadFive6n3n5n3n1n = 0.; // weighted and biased estimator for sigma of <4>
10548   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10549   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10550   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
10551   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10552   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10553   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
10554   dSumWLinearFive6n3n5n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10555   dSumWQuadraticFive6n3n5n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10556   dSpreadFive6n3n5n3n1n = f5pCorrelations->GetBinError(21);
10557   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
10558      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
10559      pow(dSumWLinearFive6n3n5n3n1n,2.)>dSumWQuadraticFive6n3n5n3n1n)
10560   {
10561    Double_t dError = pow(f3pCorrelations->GetBinContent(10),2.)
10562                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
10563                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
10564                    + pow(f2pCorrelations->GetBinContent(3),2.)
10565                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
10566                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
10567                    + pow((pow(dSumWQuadraticFive6n3n5n3n1n,0.5)/dSumWLinearFive6n3n5n3n1n)
10568                    * dSpreadFive6n3n5n3n1n*pow(pow(dSumWLinearFive6n3n5n3n1n,2.)/(pow(dSumWLinearFive6n3n5n3n1n,2.)-dSumWQuadraticFive6n3n5n3n1n),0.5),2.)
10569                    + 2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(3)
10570                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10571                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,15)) 
10572                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(10))
10573                    / (dSumWLinearTwo3n3n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10574                    - 2.*f3pCorrelations->GetBinContent(10)
10575                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10576                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,77))
10577                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(21))
10578                    / (dSumWLinearTwo3n3n*dSumWLinearFive6n3n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10579                    - 2.*f2pCorrelations->GetBinContent(3)
10580                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10581                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,77))
10582                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(21))
10583                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n3n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10584    if(dError>0.)
10585    {
10586     f5pCumulants->SetBinError(21,pow(dError,0.5)); 
10587    }
10588   } // end of if(...)
10589  } // end of {
10590  f5pCumulants->SetBinContent(22,f5pCorrelations->GetBinContent(22)-f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(4));
10591  {
10592   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
10593   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
10594   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
10595   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
10596   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
10597   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
10598   Double_t dSumWLinearFive6n3n5n3n1n = 0.; // sum of linear event weights for <4>
10599   Double_t dSumWQuadraticFive6n3n5n3n1n = 0.; // sum of quadratic event weights <4>
10600   Double_t dSpreadFive6n3n5n3n1n = 0.; // weighted and biased estimator for sigma of <4>
10601   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10602   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10603   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
10604   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10605   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10606   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
10607   dSumWLinearFive6n3n5n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10608   dSumWQuadraticFive6n3n5n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10609   dSpreadFive6n3n5n3n1n = f5pCorrelations->GetBinError(22);
10610   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
10611      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
10612      pow(dSumWLinearFive6n3n5n3n1n,2.)>dSumWQuadraticFive6n3n5n3n1n)
10613   {
10614    Double_t dError = pow(f3pCorrelations->GetBinContent(10),2.)
10615                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
10616                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
10617                    + pow(f2pCorrelations->GetBinContent(4),2.)
10618                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
10619                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
10620                    + pow((pow(dSumWQuadraticFive6n3n5n3n1n,0.5)/dSumWLinearFive6n3n5n3n1n)
10621                    * dSpreadFive6n3n5n3n1n*pow(pow(dSumWLinearFive6n3n5n3n1n,2.)/(pow(dSumWLinearFive6n3n5n3n1n,2.)-dSumWQuadraticFive6n3n5n3n1n),0.5),2.)
10622                    + 2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(4)
10623                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10624                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,15)) 
10625                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(10))
10626                    / (dSumWLinearTwo4n4n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10627                    - 2.*f3pCorrelations->GetBinContent(10)
10628                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10629                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,78))
10630                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(22))
10631                    / (dSumWLinearTwo4n4n*dSumWLinearFive6n3n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10632                    - 2.*f2pCorrelations->GetBinContent(4)
10633                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10634                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,78))
10635                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(22))
10636                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n3n5n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10637    if(dError>0.)
10638    {
10639     f5pCumulants->SetBinError(22,pow(dError,0.5)); 
10640    }
10641   } // end of if(...)
10642  } // end of {
10643  f5pCumulants->SetBinContent(23,f5pCorrelations->GetBinContent(23)-f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(5));
10644  {
10645   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
10646   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
10647   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
10648   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
10649   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
10650   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
10651   Double_t dSumWLinearFive6n5n5n3n3n = 0.; // sum of linear event weights for <4>
10652   Double_t dSumWQuadraticFive6n5n5n3n3n = 0.; // sum of quadratic event weights <4>
10653   Double_t dSpreadFive6n5n5n3n3n = 0.; // weighted and biased estimator for sigma of <4>
10654   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10655   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10656   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
10657   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10658   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10659   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
10660   dSumWLinearFive6n5n5n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10661   dSumWQuadraticFive6n5n5n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10662   dSpreadFive6n5n5n3n3n = f5pCorrelations->GetBinError(23);
10663   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
10664      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
10665      pow(dSumWLinearFive6n5n5n3n3n,2.)>dSumWQuadraticFive6n5n5n3n3n)
10666   {
10667    Double_t dError = pow(f3pCorrelations->GetBinContent(3),2.)
10668                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
10669                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
10670                    + pow(f2pCorrelations->GetBinContent(5),2.)
10671                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
10672                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
10673                    + pow((pow(dSumWQuadraticFive6n5n5n3n3n,0.5)/dSumWLinearFive6n5n5n3n3n)
10674                    * dSpreadFive6n5n5n3n3n*pow(pow(dSumWLinearFive6n5n5n3n3n,2.)/(pow(dSumWLinearFive6n5n5n3n3n,2.)-dSumWQuadraticFive6n5n5n3n3n),0.5),2.)
10675                    + 2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(5)
10676                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10677                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,9)) 
10678                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(3))
10679                    / (dSumWLinearTwo5n5n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10680                    - 2.*f3pCorrelations->GetBinContent(3)
10681                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10682                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,79))
10683                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(23))
10684                    / (dSumWLinearTwo5n5n*dSumWLinearFive6n5n5n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10685                    - 2.*f2pCorrelations->GetBinContent(5)
10686                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10687                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,79))
10688                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(23))
10689                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n5n5n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10690    if(dError>0.)
10691    {
10692     f5pCumulants->SetBinError(23,pow(dError,0.5)); 
10693    }
10694   } // end of if(...)
10695  } // end of {
10696  f5pCumulants->SetBinContent(24,f5pCorrelations->GetBinContent(24)-f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(6));
10697  {
10698   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
10699   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
10700   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
10701   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
10702   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
10703   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
10704   Double_t dSumWLinearFive6n2n6n1n1n = 0.; // sum of linear event weights for <4>
10705   Double_t dSumWQuadraticFive6n2n6n1n1n = 0.; // sum of quadratic event weights <4>
10706   Double_t dSpreadFive6n2n6n1n1n = 0.; // weighted and biased estimator for sigma of <4>
10707   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10708   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10709   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
10710   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10711   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10712   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
10713   dSumWLinearFive6n2n6n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10714   dSumWQuadraticFive6n2n6n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10715   dSpreadFive6n2n6n1n1n = f5pCorrelations->GetBinError(24);
10716   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
10717      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
10718      pow(dSumWLinearFive6n2n6n1n1n,2.)>dSumWQuadraticFive6n2n6n1n1n)
10719   {
10720    Double_t dError = pow(f3pCorrelations->GetBinContent(1),2.)
10721                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
10722                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
10723                    + pow(f2pCorrelations->GetBinContent(6),2.)
10724                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
10725                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
10726                    + pow((pow(dSumWQuadraticFive6n2n6n1n1n,0.5)/dSumWLinearFive6n2n6n1n1n)
10727                    * dSpreadFive6n2n6n1n1n*pow(pow(dSumWLinearFive6n2n6n1n1n,2.)/(pow(dSumWLinearFive6n2n6n1n1n,2.)-dSumWQuadraticFive6n2n6n1n1n),0.5),2.)
10728                    + 2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(6)
10729                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10730                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,7)) 
10731                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(1))
10732                    / (dSumWLinearTwo6n6n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10733                    - 2.*f3pCorrelations->GetBinContent(1)
10734                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10735                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,80))
10736                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(24))
10737                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n2n6n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10738                    - 2.*f2pCorrelations->GetBinContent(6)
10739                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10740                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,80))
10741                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(24))
10742                    / (dSumWLinearThree2n1n1n*dSumWLinearFive6n2n6n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10743    if(dError>0.)
10744    {
10745     f5pCumulants->SetBinError(24,pow(dError,0.5)); 
10746    }
10747   } // end of if(...)
10748  } // end of {
10749  f5pCumulants->SetBinContent(25,f5pCorrelations->GetBinContent(25)-f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(6));
10750  {
10751   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
10752   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
10753   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
10754   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
10755   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
10756   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
10757   Double_t dSumWLinearFive6n3n6n2n1n = 0.; // sum of linear event weights for <4>
10758   Double_t dSumWQuadraticFive6n3n6n2n1n = 0.; // sum of quadratic event weights <4>
10759   Double_t dSpreadFive6n3n6n2n1n = 0.; // weighted and biased estimator for sigma of <4>
10760   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10761   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10762   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
10763   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10764   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10765   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
10766   dSumWLinearFive6n3n6n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10767   dSumWQuadraticFive6n3n6n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10768   dSpreadFive6n3n6n2n1n = f5pCorrelations->GetBinError(25);
10769   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
10770      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
10771      pow(dSumWLinearFive6n3n6n2n1n,2.)>dSumWQuadraticFive6n3n6n2n1n)
10772   {
10773    Double_t dError = pow(f3pCorrelations->GetBinContent(5),2.)
10774                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
10775                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
10776                    + pow(f2pCorrelations->GetBinContent(6),2.)
10777                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
10778                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
10779                    + pow((pow(dSumWQuadraticFive6n3n6n2n1n,0.5)/dSumWLinearFive6n3n6n2n1n)
10780                    * dSpreadFive6n3n6n2n1n*pow(pow(dSumWLinearFive6n3n6n2n1n,2.)/(pow(dSumWLinearFive6n3n6n2n1n,2.)-dSumWQuadraticFive6n3n6n2n1n),0.5),2.)
10781                    + 2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(6)
10782                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10783                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,10)) 
10784                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(5))
10785                    / (dSumWLinearTwo6n6n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10786                    - 2.*f3pCorrelations->GetBinContent(5)
10787                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10788                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,81))
10789                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(25))
10790                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n3n6n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10791                    - 2.*f2pCorrelations->GetBinContent(6)
10792                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10793                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,81))
10794                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(25))
10795                    / (dSumWLinearThree3n2n1n*dSumWLinearFive6n3n6n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10796    if(dError>0.)
10797    {
10798     f5pCumulants->SetBinError(25,pow(dError,0.5)); 
10799    }
10800   } // end of if(...)
10801  } // end of {
10802  f5pCumulants->SetBinContent(26,f5pCorrelations->GetBinContent(26)-f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(6));
10803  {
10804   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
10805   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
10806   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
10807   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
10808   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
10809   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
10810   Double_t dSumWLinearFive6n4n6n2n2n = 0.; // sum of linear event weights for <4>
10811   Double_t dSumWQuadraticFive6n4n6n2n2n = 0.; // sum of quadratic event weights <4>
10812   Double_t dSpreadFive6n4n6n2n2n = 0.; // weighted and biased estimator for sigma of <4>
10813   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10814   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10815   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
10816   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10817   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10818   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
10819   dSumWLinearFive6n4n6n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10820   dSumWQuadraticFive6n4n6n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10821   dSpreadFive6n4n6n2n2n = f5pCorrelations->GetBinError(26);
10822   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
10823      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
10824      pow(dSumWLinearFive6n4n6n2n2n,2.)>dSumWQuadraticFive6n4n6n2n2n)
10825   {
10826    Double_t dError = pow(f3pCorrelations->GetBinContent(2),2.)
10827                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
10828                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
10829                    + pow(f2pCorrelations->GetBinContent(6),2.)
10830                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
10831                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
10832                    + pow((pow(dSumWQuadraticFive6n4n6n2n2n,0.5)/dSumWLinearFive6n4n6n2n2n)
10833                    * dSpreadFive6n4n6n2n2n*pow(pow(dSumWLinearFive6n4n6n2n2n,2.)/(pow(dSumWLinearFive6n4n6n2n2n,2.)-dSumWQuadraticFive6n4n6n2n2n),0.5),2.)
10834                    + 2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(6)
10835                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10836                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,8)) 
10837                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(2))
10838                    / (dSumWLinearTwo6n6n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10839                    - 2.*f3pCorrelations->GetBinContent(2)
10840                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10841                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,82))
10842                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(26))
10843                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n4n6n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10844                    - 2.*f2pCorrelations->GetBinContent(6)
10845                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10846                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,82))
10847                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(26))
10848                    / (dSumWLinearThree4n2n2n*dSumWLinearFive6n4n6n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10849    if(dError>0.)
10850    {
10851     f5pCumulants->SetBinError(26,pow(dError,0.5)); 
10852    }
10853   } // end of if(...)
10854  } // end of {
10855  f5pCumulants->SetBinContent(27,f5pCorrelations->GetBinContent(27)-f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(6));
10856  {
10857   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
10858   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
10859   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
10860   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
10861   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
10862   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
10863   Double_t dSumWLinearFive6n4n6n3n1n = 0.; // sum of linear event weights for <4>
10864   Double_t dSumWQuadraticFive6n4n6n3n1n = 0.; // sum of quadratic event weights <4>
10865   Double_t dSpreadFive6n4n6n3n1n = 0.; // weighted and biased estimator for sigma of <4>
10866   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10867   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10868   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
10869   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10870   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10871   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
10872   dSumWLinearFive6n4n6n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10873   dSumWQuadraticFive6n4n6n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10874   dSpreadFive6n4n6n3n1n = f5pCorrelations->GetBinError(27);
10875   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
10876      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
10877      pow(dSumWLinearFive6n4n6n3n1n,2.)>dSumWQuadraticFive6n4n6n3n1n)
10878   {
10879    Double_t dError = pow(f3pCorrelations->GetBinContent(6),2.)
10880                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
10881                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
10882                    + pow(f2pCorrelations->GetBinContent(6),2.)
10883                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
10884                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
10885                    + pow((pow(dSumWQuadraticFive6n4n6n3n1n,0.5)/dSumWLinearFive6n4n6n3n1n)
10886                    * dSpreadFive6n4n6n3n1n*pow(pow(dSumWLinearFive6n4n6n3n1n,2.)/(pow(dSumWLinearFive6n4n6n3n1n,2.)-dSumWQuadraticFive6n4n6n3n1n),0.5),2.)
10887                    + 2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(6)
10888                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10889                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,11)) 
10890                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(6))
10891                    / (dSumWLinearTwo6n6n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10892                    - 2.*f3pCorrelations->GetBinContent(6)
10893                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10894                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,83))
10895                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(27))
10896                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n4n6n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10897                    - 2.*f2pCorrelations->GetBinContent(6)
10898                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10899                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,83))
10900                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(27))
10901                    / (dSumWLinearThree4n3n1n*dSumWLinearFive6n4n6n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10902    if(dError>0.)
10903    {
10904     f5pCumulants->SetBinError(27,pow(dError,0.5)); 
10905    }
10906   } // end of if(...)
10907  } // end of {
10908  f5pCumulants->SetBinContent(28,f5pCorrelations->GetBinContent(28)-f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(5));
10909  {
10910   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
10911   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
10912   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
10913   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
10914   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
10915   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
10916   Double_t dSumWLinearFive6n4n6n3n1n = 0.; // sum of linear event weights for <4>
10917   Double_t dSumWQuadraticFive6n4n6n3n1n = 0.; // sum of quadratic event weights <4>
10918   Double_t dSpreadFive6n4n6n3n1n = 0.; // weighted and biased estimator for sigma of <4>
10919   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10920   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10921   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
10922   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10923   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10924   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
10925   dSumWLinearFive6n4n6n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10926   dSumWQuadraticFive6n4n6n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10927   dSpreadFive6n4n6n3n1n = f5pCorrelations->GetBinError(28);
10928   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
10929      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
10930      pow(dSumWLinearFive6n4n6n3n1n,2.)>dSumWQuadraticFive6n4n6n3n1n)
10931   {
10932    Double_t dError = pow(f3pCorrelations->GetBinContent(9),2.)
10933                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
10934                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
10935                    + pow(f2pCorrelations->GetBinContent(5),2.)
10936                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
10937                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
10938                    + pow((pow(dSumWQuadraticFive6n4n6n3n1n,0.5)/dSumWLinearFive6n4n6n3n1n)
10939                    * dSpreadFive6n4n6n3n1n*pow(pow(dSumWLinearFive6n4n6n3n1n,2.)/(pow(dSumWLinearFive6n4n6n3n1n,2.)-dSumWQuadraticFive6n4n6n3n1n),0.5),2.)
10940                    + 2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(5)
10941                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10942                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,14)) 
10943                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(9))
10944                    / (dSumWLinearTwo5n5n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10945                    - 2.*f3pCorrelations->GetBinContent(9)
10946                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
10947                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,84))
10948                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(28))
10949                    / (dSumWLinearTwo5n5n*dSumWLinearFive6n4n6n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
10950                    - 2.*f2pCorrelations->GetBinContent(5)
10951                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
10952                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,84))
10953                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(28))
10954                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n4n6n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
10955    if(dError>0.)
10956    {
10957     f5pCumulants->SetBinError(28,pow(dError,0.5)); 
10958    }
10959   } // end of if(...)
10960  } // end of {
10961  f5pCumulants->SetBinContent(29,f5pCorrelations->GetBinContent(29)-f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(6));
10962  { 
10963   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
10964   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
10965   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
10966   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
10967   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
10968   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
10969   Double_t dSumWLinearFive6n5n6n3n2n = 0.; // sum of linear event weights for <4>
10970   Double_t dSumWQuadraticFive6n5n6n3n2n = 0.; // sum of quadratic event weights <4>
10971   Double_t dSpreadFive6n5n6n3n2n = 0.; // weighted and biased estimator for sigma of <4>
10972   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
10973   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
10974   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
10975   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
10976   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
10977   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
10978   dSumWLinearFive6n5n6n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
10979   dSumWQuadraticFive6n5n6n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
10980   dSpreadFive6n5n6n3n2n = f5pCorrelations->GetBinError(29);
10981   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
10982      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
10983      pow(dSumWLinearFive6n5n6n3n2n,2.)>dSumWQuadraticFive6n5n6n3n2n)
10984   {
10985    Double_t dError = pow(f3pCorrelations->GetBinContent(7),2.)
10986                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
10987                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
10988                    + pow(f2pCorrelations->GetBinContent(6),2.)
10989                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
10990                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
10991                    + pow((pow(dSumWQuadraticFive6n5n6n3n2n,0.5)/dSumWLinearFive6n5n6n3n2n)
10992                    * dSpreadFive6n5n6n3n2n*pow(pow(dSumWLinearFive6n5n6n3n2n,2.)/(pow(dSumWLinearFive6n5n6n3n2n,2.)-dSumWQuadraticFive6n5n6n3n2n),0.5),2.)
10993                    + 2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(6)
10994                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
10995                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,12)) 
10996                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(7))
10997                    / (dSumWLinearTwo6n6n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
10998                    - 2.*f3pCorrelations->GetBinContent(7)
10999                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11000                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,85))
11001                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(29))
11002                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n5n6n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11003                    - 2.*f2pCorrelations->GetBinContent(6)
11004                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11005                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,85))
11006                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(29))
11007                    / (dSumWLinearThree5n3n2n*dSumWLinearFive6n5n6n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11008    if(dError>0.)
11009    {
11010     f5pCumulants->SetBinError(29,pow(dError,0.5)); 
11011    }
11012   } // end of if(...)
11013  } // end of {
11014  f5pCumulants->SetBinContent(30,f5pCorrelations->GetBinContent(30)-f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(6));
11015  { 
11016   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11017   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11018   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11019   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
11020   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
11021   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
11022   Double_t dSumWLinearFive6n5n6n4n1n = 0.; // sum of linear event weights for <4>
11023   Double_t dSumWQuadraticFive6n5n6n4n1n = 0.; // sum of quadratic event weights <4>
11024   Double_t dSpreadFive6n5n6n4n1n = 0.; // weighted and biased estimator for sigma of <4>
11025   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11026   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11027   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11028   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11029   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11030   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
11031   dSumWLinearFive6n5n6n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11032   dSumWQuadraticFive6n5n6n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11033   dSpreadFive6n5n6n4n1n = f5pCorrelations->GetBinError(30);
11034   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11035      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
11036      pow(dSumWLinearFive6n5n6n4n1n,2.)>dSumWQuadraticFive6n5n6n4n1n)
11037   {
11038    Double_t dError = pow(f3pCorrelations->GetBinContent(8),2.)
11039                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11040                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11041                    + pow(f2pCorrelations->GetBinContent(6),2.)
11042                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
11043                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
11044                    + pow((pow(dSumWQuadraticFive6n5n6n4n1n,0.5)/dSumWLinearFive6n5n6n4n1n)
11045                    * dSpreadFive6n5n6n4n1n*pow(pow(dSumWLinearFive6n5n6n4n1n,2.)/(pow(dSumWLinearFive6n5n6n4n1n,2.)-dSumWQuadraticFive6n5n6n4n1n),0.5),2.)
11046                    + 2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(6)
11047                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11048                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,13)) 
11049                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(8))
11050                    / (dSumWLinearTwo6n6n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11051                    - 2.*f3pCorrelations->GetBinContent(8)
11052                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11053                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,86))
11054                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(30))
11055                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n5n6n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11056                    - 2.*f2pCorrelations->GetBinContent(6)
11057                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11058                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,86))
11059                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(30))
11060                    / (dSumWLinearThree5n4n1n*dSumWLinearFive6n5n6n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11061    if(dError>0.)
11062    {
11063     f5pCumulants->SetBinError(30,pow(dError,0.5)); 
11064    }
11065   } // end of if(...)
11066  } // end of {
11067  // d2) "Two distinct harmonics":
11068  f5pCumulants->SetBinContent(32,f5pCorrelations->GetBinContent(32)-3.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(1));
11069  { 
11070   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
11071   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
11072   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
11073   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
11074   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
11075   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
11076   Double_t dSumWLinearFive2n1n1n1n1n = 0.; // sum of linear event weights for <4>
11077   Double_t dSumWQuadraticFive2n1n1n1n1n = 0.; // sum of quadratic event weights <4>
11078   Double_t dSpreadFive2n1n1n1n1n = 0.; // weighted and biased estimator for sigma of <4>
11079   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11080   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11081   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
11082   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11083   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11084   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
11085   dSumWLinearFive2n1n1n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11086   dSumWQuadraticFive2n1n1n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11087   dSpreadFive2n1n1n1n1n = f5pCorrelations->GetBinError(32);
11088   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
11089      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
11090      pow(dSumWLinearFive2n1n1n1n1n,2.)>dSumWQuadraticFive2n1n1n1n1n)
11091   {
11092    Double_t dError = 9.*pow(f3pCorrelations->GetBinContent(1),2.)
11093                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
11094                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
11095                    + 9.*pow(f2pCorrelations->GetBinContent(1),2.)
11096                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
11097                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
11098                    + pow((pow(dSumWQuadraticFive2n1n1n1n1n,0.5)/dSumWLinearFive2n1n1n1n1n)
11099                    * dSpreadFive2n1n1n1n1n*pow(pow(dSumWLinearFive2n1n1n1n1n,2.)/(pow(dSumWLinearFive2n1n1n1n1n,2.)-dSumWQuadraticFive2n1n1n1n1n),0.5),2.)
11100                    + 9.*2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(1)
11101                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11102                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,7)) 
11103                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(1))
11104                    / (dSumWLinearTwo1n1n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11105                    - 3.*2.*f3pCorrelations->GetBinContent(1)
11106                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11107                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,87))
11108                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(32))
11109                    / (dSumWLinearTwo1n1n*dSumWLinearFive2n1n1n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11110                    - 3.*2.*f2pCorrelations->GetBinContent(1)
11111                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11112                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,87))
11113                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(32))
11114                    / (dSumWLinearThree2n1n1n*dSumWLinearFive2n1n1n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11115    if(dError>0.)
11116    {
11117     f5pCumulants->SetBinError(32,pow(dError,0.5)); 
11118    }
11119   } // end of if(...)
11120  } // end of {
11121  f5pCumulants->SetBinContent(33,f5pCorrelations->GetBinContent(33)-2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(2));
11122  { 
11123   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
11124   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
11125   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
11126   Double_t dSumWLinearThree2n1n1n = 0.; // sum of linear event weights for <2>
11127   Double_t dSumWQuadraticThree2n1n1n = 0.; // sum of quadratic event weights <2>
11128   Double_t dSpreadThree2n1n1n = 0.; // weighted and biased estimator for sigma of <2>
11129   Double_t dSumWLinearFive2n2n2n1n1n = 0.; // sum of linear event weights for <4>
11130   Double_t dSumWQuadraticFive2n2n2n1n1n = 0.; // sum of quadratic event weights <4>
11131   Double_t dSpreadFive2n2n2n1n1n = 0.; // weighted and biased estimator for sigma of <4>
11132   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11133   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11134   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
11135   dSumWLinearThree2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11136   dSumWQuadraticThree2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11137   dSpreadThree2n1n1n = f3pCorrelations->GetBinError(1);
11138   dSumWLinearFive2n2n2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11139   dSumWQuadraticFive2n2n2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11140   dSpreadFive2n2n2n1n1n = f5pCorrelations->GetBinError(33);
11141   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
11142      pow(dSumWLinearThree2n1n1n,2.)>dSumWQuadraticThree2n1n1n &&
11143      pow(dSumWLinearFive2n2n2n1n1n,2.)>dSumWQuadraticFive2n2n2n1n1n)
11144   {
11145    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(1),2.)
11146                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
11147                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
11148                    + 4.*pow(f2pCorrelations->GetBinContent(2),2.)
11149                    * pow((pow(dSumWQuadraticThree2n1n1n,0.5)/dSumWLinearThree2n1n1n)
11150                    * dSpreadThree2n1n1n*pow(pow(dSumWLinearThree2n1n1n,2.)/(pow(dSumWLinearThree2n1n1n,2.)-dSumWQuadraticThree2n1n1n),0.5),2.)
11151                    + pow((pow(dSumWQuadraticFive2n2n2n1n1n,0.5)/dSumWLinearFive2n2n2n1n1n)
11152                    * dSpreadFive2n2n2n1n1n*pow(pow(dSumWLinearFive2n2n2n1n1n,2.)/(pow(dSumWLinearFive2n2n2n1n1n,2.)-dSumWQuadraticFive2n2n2n1n1n),0.5),2.)
11153                    + 4.*2.*f3pCorrelations->GetBinContent(1)*f2pCorrelations->GetBinContent(2)
11154                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11155                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,7)) 
11156                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(1))
11157                    / (dSumWLinearTwo2n2n*dSumWLinearThree2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11158                    - 2.*2.*f3pCorrelations->GetBinContent(1)
11159                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11160                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,88))
11161                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(33))
11162                    / (dSumWLinearTwo2n2n*dSumWLinearFive2n2n2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11163                    - 2.*2.*f2pCorrelations->GetBinContent(2)
11164                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11165                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(7,88))
11166                    - f3pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(33))
11167                    / (dSumWLinearThree2n1n1n*dSumWLinearFive2n2n2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11168    if(dError>0.)
11169    {
11170     f5pCumulants->SetBinError(33,pow(dError,0.5)); 
11171    }
11172   } // end of if(...)
11173  } // end of {
11174  f5pCumulants->SetBinContent(34,f5pCorrelations->GetBinContent(34));
11175  {
11176   Double_t dSumWLinear = 0.; // sum of linear event weights
11177   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11178   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11179   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11180   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11181   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11182   dSpread = f5pCorrelations->GetBinError(34);
11183   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11184   {
11185    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11186    f5pCumulants->SetBinError(34,dError); 
11187   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11188  } 
11189  f5pCumulants->SetBinContent(35,f5pCorrelations->GetBinContent(35));
11190  {
11191   Double_t dSumWLinear = 0.; // sum of linear event weights
11192   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11193   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11194   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11195   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11196   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11197   dSpread = f5pCorrelations->GetBinError(35);
11198   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11199   {
11200    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11201    f5pCumulants->SetBinError(35,dError); 
11202   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11203  } 
11204  f5pCumulants->SetBinContent(36,f5pCorrelations->GetBinContent(36)-3.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(2));
11205  { 
11206   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
11207   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
11208   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
11209   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
11210   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
11211   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
11212   Double_t dSumWLinearFive4n2n2n2n2n = 0.; // sum of linear event weights for <4>
11213   Double_t dSumWQuadraticFive4n2n2n2n2n = 0.; // sum of quadratic event weights <4>
11214   Double_t dSpreadFive4n2n2n2n2n = 0.; // weighted and biased estimator for sigma of <4>
11215   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11216   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11217   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
11218   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11219   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11220   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
11221   dSumWLinearFive4n2n2n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11222   dSumWQuadraticFive4n2n2n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11223   dSpreadFive4n2n2n2n2n = f5pCorrelations->GetBinError(36);
11224   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
11225      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
11226      pow(dSumWLinearFive4n2n2n2n2n,2.)>dSumWQuadraticFive4n2n2n2n2n)
11227   {
11228    Double_t dError = 9.*pow(f3pCorrelations->GetBinContent(2),2.)
11229                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
11230                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
11231                    + 9.*pow(f2pCorrelations->GetBinContent(2),2.)
11232                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
11233                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
11234                    + pow((pow(dSumWQuadraticFive4n2n2n2n2n,0.5)/dSumWLinearFive4n2n2n2n2n)
11235                    * dSpreadFive4n2n2n2n2n*pow(pow(dSumWLinearFive4n2n2n2n2n,2.)/(pow(dSumWLinearFive4n2n2n2n2n,2.)-dSumWQuadraticFive4n2n2n2n2n),0.5),2.)
11236                    + 9.*2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(2)
11237                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11238                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,8)) 
11239                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(2))
11240                    / (dSumWLinearTwo2n2n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11241                    - 3.*2.*f3pCorrelations->GetBinContent(2)
11242                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11243                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,91))
11244                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(36))
11245                    / (dSumWLinearTwo2n2n*dSumWLinearFive4n2n2n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11246                    - 3.*2.*f2pCorrelations->GetBinContent(2)
11247                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11248                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,91))
11249                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(36))
11250                    / (dSumWLinearThree4n2n2n*dSumWLinearFive4n2n2n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11251    if(dError>0.)
11252    {
11253     f5pCumulants->SetBinError(36,pow(dError,0.5)); 
11254    }
11255   } // end of if(...)
11256  } // end of {
11257  f5pCumulants->SetBinContent(37,f5pCorrelations->GetBinContent(37)-2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(4)); 
11258  { 
11259   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
11260   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
11261   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
11262   Double_t dSumWLinearThree4n2n2n = 0.; // sum of linear event weights for <2>
11263   Double_t dSumWQuadraticThree4n2n2n = 0.; // sum of quadratic event weights <2>
11264   Double_t dSpreadThree4n2n2n = 0.; // weighted and biased estimator for sigma of <2>
11265   Double_t dSumWLinearFive4n4n4n2n2n = 0.; // sum of linear event weights for <4>
11266   Double_t dSumWQuadraticFive4n4n4n2n2n = 0.; // sum of quadratic event weights <4>
11267   Double_t dSpreadFive4n4n4n2n2n = 0.; // weighted and biased estimator for sigma of <4>
11268   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11269   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11270   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
11271   dSumWLinearThree4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11272   dSumWQuadraticThree4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11273   dSpreadThree4n2n2n = f3pCorrelations->GetBinError(2);
11274   dSumWLinearFive4n4n4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11275   dSumWQuadraticFive4n4n4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11276   dSpreadFive4n4n4n2n2n = f5pCorrelations->GetBinError(37);
11277   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
11278      pow(dSumWLinearThree4n2n2n,2.)>dSumWQuadraticThree4n2n2n &&
11279      pow(dSumWLinearFive4n4n4n2n2n,2.)>dSumWQuadraticFive4n4n4n2n2n)
11280   {
11281    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(2),2.)
11282                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
11283                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
11284                    + 4.*pow(f2pCorrelations->GetBinContent(4),2.)
11285                    * pow((pow(dSumWQuadraticThree4n2n2n,0.5)/dSumWLinearThree4n2n2n)
11286                    * dSpreadThree4n2n2n*pow(pow(dSumWLinearThree4n2n2n,2.)/(pow(dSumWLinearThree4n2n2n,2.)-dSumWQuadraticThree4n2n2n),0.5),2.)
11287                    + pow((pow(dSumWQuadraticFive4n4n4n2n2n,0.5)/dSumWLinearFive4n4n4n2n2n)
11288                    * dSpreadFive4n4n4n2n2n*pow(pow(dSumWLinearFive4n4n4n2n2n,2.)/(pow(dSumWLinearFive4n4n4n2n2n,2.)-dSumWQuadraticFive4n4n4n2n2n),0.5),2.)
11289                    + 4.*2.*f3pCorrelations->GetBinContent(2)*f2pCorrelations->GetBinContent(4)
11290                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11291                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,8)) 
11292                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(2))
11293                    / (dSumWLinearTwo4n4n*dSumWLinearThree4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11294                    - 2.*2.*f3pCorrelations->GetBinContent(2)
11295                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11296                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,92))
11297                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(37))
11298                    / (dSumWLinearTwo4n4n*dSumWLinearFive4n4n4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11299                    - 2.*2.*f2pCorrelations->GetBinContent(4)
11300                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11301                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(8,92))
11302                    - f3pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(37))
11303                    / (dSumWLinearThree4n2n2n*dSumWLinearFive4n4n4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11304    if(dError>0.)
11305    {
11306     f5pCumulants->SetBinError(37,pow(dError,0.5)); 
11307    }
11308   } // end of if(...)
11309  } // end of {
11310  f5pCumulants->SetBinContent(38,f5pCorrelations->GetBinContent(38)-3.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(3)); 
11311  { 
11312   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
11313   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
11314   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
11315   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
11316   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
11317   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
11318   Double_t dSumWLinearFive6n3n3n3n3n = 0.; // sum of linear event weights for <4>
11319   Double_t dSumWQuadraticFive6n3n3n3n3n = 0.; // sum of quadratic event weights <4>
11320   Double_t dSpreadFive6n3n3n3n3n = 0.; // weighted and biased estimator for sigma of <4>
11321   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11322   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11323   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
11324   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11325   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11326   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
11327   dSumWLinearFive6n3n3n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11328   dSumWQuadraticFive6n3n3n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11329   dSpreadFive6n3n3n3n3n = f5pCorrelations->GetBinError(38);
11330   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
11331      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
11332      pow(dSumWLinearFive6n3n3n3n3n,2.)>dSumWQuadraticFive6n3n3n3n3n)
11333   {
11334    Double_t dError = 9.*pow(f3pCorrelations->GetBinContent(3),2.)
11335                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
11336                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
11337                    + 9.*pow(f2pCorrelations->GetBinContent(3),2.)
11338                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
11339                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
11340                    + pow((pow(dSumWQuadraticFive6n3n3n3n3n,0.5)/dSumWLinearFive6n3n3n3n3n)
11341                    * dSpreadFive6n3n3n3n3n*pow(pow(dSumWLinearFive6n3n3n3n3n,2.)/(pow(dSumWLinearFive6n3n3n3n3n,2.)-dSumWQuadraticFive6n3n3n3n3n),0.5),2.)
11342                    + 9.*2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(3)
11343                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11344                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,9)) 
11345                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(3))
11346                    / (dSumWLinearTwo3n3n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11347                    - 3.*2.*f3pCorrelations->GetBinContent(3)
11348                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11349                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,93))
11350                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(38))
11351                    / (dSumWLinearTwo3n3n*dSumWLinearFive6n3n3n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11352                    - 3.*2.*f2pCorrelations->GetBinContent(3)
11353                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11354                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,93))
11355                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(38))
11356                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n3n3n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11357    if(dError>0.)
11358    {
11359     f5pCumulants->SetBinError(38,pow(dError,0.5)); 
11360    }
11361   } // end of if(...)
11362  } // end of {
11363  f5pCumulants->SetBinContent(39,f5pCorrelations->GetBinContent(39));
11364  {
11365   Double_t dSumWLinear = 0.; // sum of linear event weights
11366   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11367   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11368   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11369   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11370   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11371   dSpread = f5pCorrelations->GetBinError(39);
11372   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11373   {
11374    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11375    f5pCumulants->SetBinError(39,dError); 
11376   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11377  } 
11378  f5pCumulants->SetBinContent(40,f5pCorrelations->GetBinContent(40)-2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(6)); 
11379  { 
11380   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
11381   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
11382   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
11383   Double_t dSumWLinearThree6n3n3n = 0.; // sum of linear event weights for <2>
11384   Double_t dSumWQuadraticThree6n3n3n = 0.; // sum of quadratic event weights <2>
11385   Double_t dSpreadThree6n3n3n = 0.; // weighted and biased estimator for sigma of <2>
11386   Double_t dSumWLinearFive6n6n6n3n3n = 0.; // sum of linear event weights for <4>
11387   Double_t dSumWQuadraticFive6n6n6n3n3n = 0.; // sum of quadratic event weights <4>
11388   Double_t dSpreadFive6n6n6n3n3n = 0.; // weighted and biased estimator for sigma of <4>
11389   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11390   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11391   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
11392   dSumWLinearThree6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11393   dSumWQuadraticThree6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11394   dSpreadThree6n3n3n = f3pCorrelations->GetBinError(3);
11395   dSumWLinearFive6n6n6n3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11396   dSumWQuadraticFive6n6n6n3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11397   dSpreadFive6n6n6n3n3n = f5pCorrelations->GetBinError(40);
11398   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
11399      pow(dSumWLinearThree6n3n3n,2.)>dSumWQuadraticThree6n3n3n &&
11400      pow(dSumWLinearFive6n6n6n3n3n,2.)>dSumWQuadraticFive6n6n6n3n3n)
11401   {
11402    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(3),2.)
11403                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
11404                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
11405                    + 4.*pow(f2pCorrelations->GetBinContent(6),2.)
11406                    * pow((pow(dSumWQuadraticThree6n3n3n,0.5)/dSumWLinearThree6n3n3n)
11407                    * dSpreadThree6n3n3n*pow(pow(dSumWLinearThree6n3n3n,2.)/(pow(dSumWLinearThree6n3n3n,2.)-dSumWQuadraticThree6n3n3n),0.5),2.)
11408                    + pow((pow(dSumWQuadraticFive6n6n6n3n3n,0.5)/dSumWLinearFive6n6n6n3n3n)
11409                    * dSpreadFive6n6n6n3n3n*pow(pow(dSumWLinearFive6n6n6n3n3n,2.)/(pow(dSumWLinearFive6n6n6n3n3n,2.)-dSumWQuadraticFive6n6n6n3n3n),0.5),2.)
11410                    + 4.*2.*f3pCorrelations->GetBinContent(3)*f2pCorrelations->GetBinContent(6)
11411                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11412                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,9)) 
11413                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(3))
11414                    / (dSumWLinearTwo6n6n*dSumWLinearThree6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11415                    - 2.*2.*f3pCorrelations->GetBinContent(3)
11416                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11417                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,95))
11418                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(40))
11419                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n6n6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11420                    - 2.*2.*f2pCorrelations->GetBinContent(6)
11421                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11422                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(9,95))
11423                    - f3pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(40))
11424                    / (dSumWLinearThree6n3n3n*dSumWLinearFive6n6n6n3n3n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11425    if(dError>0.)
11426    {
11427     f5pCumulants->SetBinError(40,pow(dError,0.5)); 
11428    }
11429   } // end of if(...)
11430  } // end of {
11431
11432  // d2) "Three distinct harmonics":
11433  f5pCumulants->SetBinContent(42,f5pCorrelations->GetBinContent(42)-2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(1)); 
11434  { 
11435   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
11436   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
11437   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
11438   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
11439   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
11440   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
11441   Double_t dSumWLinearFive3n1n2n1n1n = 0.; // sum of linear event weights for <4>
11442   Double_t dSumWQuadraticFive3n1n2n1n1n = 0.; // sum of quadratic event weights <4>
11443   Double_t dSpreadFive3n1n2n1n1n = 0.; // weighted and biased estimator for sigma of <4>
11444   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11445   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11446   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
11447   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11448   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11449   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
11450   dSumWLinearFive3n1n2n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11451   dSumWQuadraticFive3n1n2n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11452   dSpreadFive3n1n2n1n1n = f5pCorrelations->GetBinError(42);
11453   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
11454      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
11455      pow(dSumWLinearFive3n1n2n1n1n,2.)>dSumWQuadraticFive3n1n2n1n1n)
11456   {
11457    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(5),2.)
11458                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
11459                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
11460                    + 4.*pow(f2pCorrelations->GetBinContent(1),2.)
11461                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
11462                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
11463                    + pow((pow(dSumWQuadraticFive3n1n2n1n1n,0.5)/dSumWLinearFive3n1n2n1n1n)
11464                    * dSpreadFive3n1n2n1n1n*pow(pow(dSumWLinearFive3n1n2n1n1n,2.)/(pow(dSumWLinearFive3n1n2n1n1n,2.)-dSumWQuadraticFive3n1n2n1n1n),0.5),2.)
11465                    + 4.*2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(1)
11466                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11467                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,10)) 
11468                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(5))
11469                    / (dSumWLinearTwo1n1n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11470                    - 2.*2.*f3pCorrelations->GetBinContent(5)
11471                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11472                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,96))
11473                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(42))
11474                    / (dSumWLinearTwo1n1n*dSumWLinearFive3n1n2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11475                    - 2.*2.*f2pCorrelations->GetBinContent(1)
11476                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11477                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,96))
11478                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(42))
11479                    / (dSumWLinearThree3n2n1n*dSumWLinearFive3n1n2n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11480    if(dError>0.)
11481    {
11482     f5pCumulants->SetBinError(42,pow(dError,0.5)); 
11483    }
11484   } // end of if(...)
11485  } // end of {
11486  f5pCumulants->SetBinContent(43,f5pCorrelations->GetBinContent(43)-2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(2)); 
11487  { 
11488   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
11489   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
11490   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
11491   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
11492   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
11493   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
11494   Double_t dSumWLinearFive3n2n2n2n1n = 0.; // sum of linear event weights for <4>
11495   Double_t dSumWQuadraticFive3n2n2n2n1n = 0.; // sum of quadratic event weights <4>
11496   Double_t dSpreadFive3n2n2n2n1n = 0.; // weighted and biased estimator for sigma of <4>
11497   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11498   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11499   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
11500   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11501   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11502   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
11503   dSumWLinearFive3n2n2n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11504   dSumWQuadraticFive3n2n2n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11505   dSpreadFive3n2n2n2n1n = f5pCorrelations->GetBinError(43);
11506   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
11507      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
11508      pow(dSumWLinearFive3n2n2n2n1n,2.)>dSumWQuadraticFive3n2n2n2n1n)
11509   {
11510    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(5),2.)
11511                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
11512                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
11513                    + 4.*pow(f2pCorrelations->GetBinContent(2),2.)
11514                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
11515                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
11516                    + pow((pow(dSumWQuadraticFive3n2n2n2n1n,0.5)/dSumWLinearFive3n2n2n2n1n)
11517                    * dSpreadFive3n2n2n2n1n*pow(pow(dSumWLinearFive3n2n2n2n1n,2.)/(pow(dSumWLinearFive3n2n2n2n1n,2.)-dSumWQuadraticFive3n2n2n2n1n),0.5),2.)
11518                    + 4.*2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(2)
11519                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11520                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,10)) 
11521                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(5))
11522                    / (dSumWLinearTwo2n2n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11523                    - 2.*2.*f3pCorrelations->GetBinContent(5)
11524                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11525                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,97))
11526                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(43))
11527                    / (dSumWLinearTwo2n2n*dSumWLinearFive3n2n2n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11528                    - 2.*2.*f2pCorrelations->GetBinContent(2)
11529                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11530                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,97))
11531                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(43))
11532                    / (dSumWLinearThree3n2n1n*dSumWLinearFive3n2n2n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11533    if(dError>0.)
11534    {
11535     f5pCumulants->SetBinError(43,pow(dError,0.5)); 
11536    }
11537   } // end of if(...)
11538  } // end of {
11539  f5pCumulants->SetBinContent(44,f5pCorrelations->GetBinContent(44)-2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(3)); 
11540  { 
11541   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
11542   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
11543   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
11544   Double_t dSumWLinearThree3n2n1n = 0.; // sum of linear event weights for <2>
11545   Double_t dSumWQuadraticThree3n2n1n = 0.; // sum of quadratic event weights <2>
11546   Double_t dSpreadThree3n2n1n = 0.; // weighted and biased estimator for sigma of <2>
11547   Double_t dSumWLinearFive3n3n3n2n1n = 0.; // sum of linear event weights for <4>
11548   Double_t dSumWQuadraticFive3n3n3n2n1n = 0.; // sum of quadratic event weights <4>
11549   Double_t dSpreadFive3n3n3n2n1n = 0.; // weighted and biased estimator for sigma of <4>
11550   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11551   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11552   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
11553   dSumWLinearThree3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11554   dSumWQuadraticThree3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11555   dSpreadThree3n2n1n = f3pCorrelations->GetBinError(5);
11556   dSumWLinearFive3n3n3n2n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11557   dSumWQuadraticFive3n3n3n2n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11558   dSpreadFive3n3n3n2n1n = f5pCorrelations->GetBinError(44);
11559   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
11560      pow(dSumWLinearThree3n2n1n,2.)>dSumWQuadraticThree3n2n1n &&
11561      pow(dSumWLinearFive3n3n3n2n1n,2.)>dSumWQuadraticFive3n3n3n2n1n)
11562   {
11563    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(5),2.)
11564                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
11565                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
11566                    + 4.*pow(f2pCorrelations->GetBinContent(3),2.)
11567                    * pow((pow(dSumWQuadraticThree3n2n1n,0.5)/dSumWLinearThree3n2n1n)
11568                    * dSpreadThree3n2n1n*pow(pow(dSumWLinearThree3n2n1n,2.)/(pow(dSumWLinearThree3n2n1n,2.)-dSumWQuadraticThree3n2n1n),0.5),2.)
11569                    + pow((pow(dSumWQuadraticFive3n3n3n2n1n,0.5)/dSumWLinearFive3n3n3n2n1n)
11570                    * dSpreadFive3n3n3n2n1n*pow(pow(dSumWLinearFive3n3n3n2n1n,2.)/(pow(dSumWLinearFive3n3n3n2n1n,2.)-dSumWQuadraticFive3n3n3n2n1n),0.5),2.)
11571                    + 4.*2.*f3pCorrelations->GetBinContent(5)*f2pCorrelations->GetBinContent(3)
11572                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11573                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,10)) 
11574                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(5))
11575                    / (dSumWLinearTwo3n3n*dSumWLinearThree3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11576                    - 2.*2.*f3pCorrelations->GetBinContent(5)
11577                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11578                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,98))
11579                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(44))
11580                    / (dSumWLinearTwo3n3n*dSumWLinearFive3n3n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11581                    - 2.*2.*f2pCorrelations->GetBinContent(3)
11582                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11583                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(10,98))
11584                    - f3pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(44))
11585                    / (dSumWLinearThree3n2n1n*dSumWLinearFive3n3n3n2n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11586    if(dError>0.)
11587    {
11588     f5pCumulants->SetBinError(44,pow(dError,0.5)); 
11589    }
11590   } // end of if(...)
11591  } // end of {
11592  f5pCumulants->SetBinContent(45,f5pCorrelations->GetBinContent(45)-2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(1)); 
11593  { 
11594   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
11595   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
11596   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
11597   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
11598   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
11599   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
11600   Double_t dSumWLinearFive4n1n3n1n1n = 0.; // sum of linear event weights for <4>
11601   Double_t dSumWQuadraticFive4n1n3n1n1n = 0.; // sum of quadratic event weights <4>
11602   Double_t dSpreadFive4n1n3n1n1n = 0.; // weighted and biased estimator for sigma of <4>
11603   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11604   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11605   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
11606   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11607   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11608   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
11609   dSumWLinearFive4n1n3n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11610   dSumWQuadraticFive4n1n3n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11611   dSpreadFive4n1n3n1n1n = f5pCorrelations->GetBinError(45);
11612   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
11613      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
11614      pow(dSumWLinearFive4n1n3n1n1n,2.)>dSumWQuadraticFive4n1n3n1n1n)
11615   {
11616    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(6),2.)
11617                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
11618                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
11619                    + 4.*pow(f2pCorrelations->GetBinContent(1),2.)
11620                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
11621                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
11622                    + pow((pow(dSumWQuadraticFive4n1n3n1n1n,0.5)/dSumWLinearFive4n1n3n1n1n)
11623                    * dSpreadFive4n1n3n1n1n*pow(pow(dSumWLinearFive4n1n3n1n1n,2.)/(pow(dSumWLinearFive4n1n3n1n1n,2.)-dSumWQuadraticFive4n1n3n1n1n),0.5),2.)
11624                    + 4.*2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(1)
11625                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11626                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,11)) 
11627                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(6))
11628                    / (dSumWLinearTwo1n1n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11629                    - 2.*2.*f3pCorrelations->GetBinContent(6)
11630                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11631                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,99))
11632                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(45))
11633                    / (dSumWLinearTwo1n1n*dSumWLinearFive4n1n3n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11634                    - 2.*2.*f2pCorrelations->GetBinContent(1)
11635                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11636                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,99))
11637                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(45))
11638                    / (dSumWLinearThree4n3n1n*dSumWLinearFive4n1n3n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11639    if(dError>0.)
11640    {
11641     f5pCumulants->SetBinError(45,pow(dError,0.5)); 
11642    }
11643   } // end of if(...)
11644  } // end of {
11645  f5pCumulants->SetBinContent(46,f5pCorrelations->GetBinContent(46));
11646  {
11647   Double_t dSumWLinear = 0.; // sum of linear event weights
11648   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11649   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11650   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11651   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11652   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11653   dSpread = f5pCorrelations->GetBinError(46);
11654   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11655   {
11656    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11657    f5pCumulants->SetBinError(46,dError); 
11658   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11659  } 
11660  f5pCumulants->SetBinContent(47,f5pCorrelations->GetBinContent(47)-2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(3)); 
11661  { 
11662   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
11663   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
11664   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
11665   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
11666   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
11667   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
11668   Double_t dSumWLinearFive4n3n3n3n1n = 0.; // sum of linear event weights for <4>
11669   Double_t dSumWQuadraticFive4n3n3n3n1n = 0.; // sum of quadratic event weights <4>
11670   Double_t dSpreadFive4n3n3n3n1n = 0.; // weighted and biased estimator for sigma of <4>
11671   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11672   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11673   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
11674   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11675   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11676   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
11677   dSumWLinearFive4n3n3n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11678   dSumWQuadraticFive4n3n3n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11679   dSpreadFive4n3n3n3n1n = f5pCorrelations->GetBinError(47);
11680   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
11681      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
11682      pow(dSumWLinearFive4n3n3n3n1n,2.)>dSumWQuadraticFive4n3n3n3n1n)
11683   {
11684    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(6),2.)
11685                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
11686                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
11687                    + 4.*pow(f2pCorrelations->GetBinContent(3),2.)
11688                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
11689                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
11690                    + pow((pow(dSumWQuadraticFive4n3n3n3n1n,0.5)/dSumWLinearFive4n3n3n3n1n)
11691                    * dSpreadFive4n3n3n3n1n*pow(pow(dSumWLinearFive4n3n3n3n1n,2.)/(pow(dSumWLinearFive4n3n3n3n1n,2.)-dSumWQuadraticFive4n3n3n3n1n),0.5),2.)
11692                    + 4.*2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(3)
11693                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11694                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,11)) 
11695                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(6))
11696                    / (dSumWLinearTwo3n3n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11697                    - 2.*2.*f3pCorrelations->GetBinContent(6)
11698                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11699                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,101))
11700                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(47))
11701                    / (dSumWLinearTwo3n3n*dSumWLinearFive4n3n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11702                    - 2.*2.*f2pCorrelations->GetBinContent(3)
11703                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11704                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,101))
11705                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(47))
11706                    / (dSumWLinearThree4n3n1n*dSumWLinearFive4n3n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11707    if(dError>0.)
11708    {
11709     f5pCumulants->SetBinError(47,pow(dError,0.5)); 
11710    }
11711   } // end of if(...)
11712  } // end of {
11713  f5pCumulants->SetBinContent(48,f5pCorrelations->GetBinContent(48));
11714  {
11715   Double_t dSumWLinear = 0.; // sum of linear event weights
11716   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11717   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11718   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11719   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11720   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11721   dSpread = f5pCorrelations->GetBinError(48);
11722   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11723   {
11724    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11725    f5pCumulants->SetBinError(48,dError); 
11726   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11727  } 
11728  f5pCumulants->SetBinContent(49,f5pCorrelations->GetBinContent(49)-2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(4));  
11729  { 
11730   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
11731   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
11732   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
11733   Double_t dSumWLinearThree4n3n1n = 0.; // sum of linear event weights for <2>
11734   Double_t dSumWQuadraticThree4n3n1n = 0.; // sum of quadratic event weights <2>
11735   Double_t dSpreadThree4n3n1n = 0.; // weighted and biased estimator for sigma of <2>
11736   Double_t dSumWLinearFive4n3n3n3n1n = 0.; // sum of linear event weights for <4>
11737   Double_t dSumWQuadraticFive4n3n3n3n1n = 0.; // sum of quadratic event weights <4>
11738   Double_t dSpreadFive4n3n3n3n1n = 0.; // weighted and biased estimator for sigma of <4>
11739   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11740   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11741   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
11742   dSumWLinearThree4n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11743   dSumWQuadraticThree4n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11744   dSpreadThree4n3n1n = f3pCorrelations->GetBinError(6);
11745   dSumWLinearFive4n3n3n3n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11746   dSumWQuadraticFive4n3n3n3n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11747   dSpreadFive4n3n3n3n1n = f5pCorrelations->GetBinError(49);
11748   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
11749      pow(dSumWLinearThree4n3n1n,2.)>dSumWQuadraticThree4n3n1n &&
11750      pow(dSumWLinearFive4n3n3n3n1n,2.)>dSumWQuadraticFive4n3n3n3n1n)
11751   {
11752    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(6),2.)
11753                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
11754                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
11755                    + 4.*pow(f2pCorrelations->GetBinContent(4),2.)
11756                    * pow((pow(dSumWQuadraticThree4n3n1n,0.5)/dSumWLinearThree4n3n1n)
11757                    * dSpreadThree4n3n1n*pow(pow(dSumWLinearThree4n3n1n,2.)/(pow(dSumWLinearThree4n3n1n,2.)-dSumWQuadraticThree4n3n1n),0.5),2.)
11758                    + pow((pow(dSumWQuadraticFive4n3n3n3n1n,0.5)/dSumWLinearFive4n3n3n3n1n)
11759                    * dSpreadFive4n3n3n3n1n*pow(pow(dSumWLinearFive4n3n3n3n1n,2.)/(pow(dSumWLinearFive4n3n3n3n1n,2.)-dSumWQuadraticFive4n3n3n3n1n),0.5),2.)
11760                    + 4.*2.*f3pCorrelations->GetBinContent(6)*f2pCorrelations->GetBinContent(4)
11761                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11762                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,11)) 
11763                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(6))
11764                    / (dSumWLinearTwo4n4n*dSumWLinearThree4n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11765                    - 2.*2.*f3pCorrelations->GetBinContent(6)
11766                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11767                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,103))
11768                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(49))
11769                    / (dSumWLinearTwo4n4n*dSumWLinearFive4n3n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11770                    - 2.*2.*f2pCorrelations->GetBinContent(4)
11771                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11772                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(11,103))
11773                    - f3pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(49))
11774                    / (dSumWLinearThree4n3n1n*dSumWLinearFive4n3n3n3n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11775    if(dError>0.)
11776    {
11777     f5pCumulants->SetBinError(49,pow(dError,0.5)); 
11778    }
11779   } // end of if(...)
11780  } // end of {
11781  f5pCumulants->SetBinContent(50,f5pCorrelations->GetBinContent(50));
11782  {
11783   Double_t dSumWLinear = 0.; // sum of linear event weights
11784   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11785   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11786   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11787   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11788   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11789   dSpread = f5pCorrelations->GetBinError(50);
11790   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11791   {
11792    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11793    f5pCumulants->SetBinError(50,dError); 
11794   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11795  } 
11796  f5pCumulants->SetBinContent(51,f5pCorrelations->GetBinContent(51));
11797  {
11798   Double_t dSumWLinear = 0.; // sum of linear event weights
11799   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11800   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11801   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11802   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11803   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11804   dSpread = f5pCorrelations->GetBinError(51);
11805   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11806   {
11807    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11808    f5pCumulants->SetBinError(51,dError); 
11809   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11810  } 
11811  f5pCumulants->SetBinContent(52,f5pCorrelations->GetBinContent(52)-2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(2));  
11812  { 
11813   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
11814   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
11815   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
11816   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
11817   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
11818   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
11819   Double_t dSumWLinearFive5n2n3n2n2n = 0.; // sum of linear event weights for <4>
11820   Double_t dSumWQuadraticFive5n2n3n2n2n = 0.; // sum of quadratic event weights <4>
11821   Double_t dSpreadFive5n2n3n2n2n = 0.; // weighted and biased estimator for sigma of <4>
11822   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11823   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11824   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
11825   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11826   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11827   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
11828   dSumWLinearFive5n2n3n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11829   dSumWQuadraticFive5n2n3n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11830   dSpreadFive5n2n3n2n2n = f5pCorrelations->GetBinError(52);
11831   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
11832      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
11833      pow(dSumWLinearFive5n2n3n2n2n,2.)>dSumWQuadraticFive5n2n3n2n2n)
11834   {
11835    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(7),2.)
11836                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
11837                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
11838                    + 4.*pow(f2pCorrelations->GetBinContent(2),2.)
11839                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
11840                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
11841                    + pow((pow(dSumWQuadraticFive5n2n3n2n2n,0.5)/dSumWLinearFive5n2n3n2n2n)
11842                    * dSpreadFive5n2n3n2n2n*pow(pow(dSumWLinearFive5n2n3n2n2n,2.)/(pow(dSumWLinearFive5n2n3n2n2n,2.)-dSumWQuadraticFive5n2n3n2n2n),0.5),2.)
11843                    + 4.*2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(2)
11844                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11845                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,12)) 
11846                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(7))
11847                    / (dSumWLinearTwo2n2n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11848                    - 2.*2.*f3pCorrelations->GetBinContent(7)
11849                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11850                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,106))
11851                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(52))
11852                    / (dSumWLinearTwo2n2n*dSumWLinearFive5n2n3n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11853                    - 2.*2.*f2pCorrelations->GetBinContent(2)
11854                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11855                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,106))
11856                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(52))
11857                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n2n3n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11858    if(dError>0.)
11859    {
11860     f5pCumulants->SetBinError(52,pow(dError,0.5)); 
11861    }
11862   } // end of if(...)
11863  } // end of {
11864  f5pCumulants->SetBinContent(53,f5pCorrelations->GetBinContent(53)-2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(3));  
11865  { 
11866   Double_t dSumWLinearTwo3n3n = 0.; // sum of linear event weights for <2>
11867   Double_t dSumWQuadraticTwo3n3n = 0.; // sum of quadratic event weights <2>
11868   Double_t dSpreadTwo3n3n = 0.; // weighted and biased estimator for sigma of <2>
11869   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
11870   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
11871   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
11872   Double_t dSumWLinearFive5n3n3n3n2n = 0.; // sum of linear event weights for <4>
11873   Double_t dSumWQuadraticFive5n3n3n3n2n = 0.; // sum of quadratic event weights <4>
11874   Double_t dSpreadFive5n3n3n3n2n = 0.; // weighted and biased estimator for sigma of <4>
11875   dSumWLinearTwo3n3n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11876   dSumWQuadraticTwo3n3n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11877   dSpreadTwo3n3n = f2pCorrelations->GetBinError(3);
11878   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11879   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11880   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
11881   dSumWLinearFive5n3n3n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11882   dSumWQuadraticFive5n3n3n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11883   dSpreadFive5n3n3n3n2n = f5pCorrelations->GetBinError(53);
11884   if(pow(dSumWLinearTwo3n3n,2.)>dSumWQuadraticTwo3n3n &&
11885      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
11886      pow(dSumWLinearFive5n3n3n3n2n,2.)>dSumWQuadraticFive5n3n3n3n2n)
11887   {
11888    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(7),2.)
11889                    * pow((pow(dSumWQuadraticTwo3n3n,0.5)/dSumWLinearTwo3n3n)
11890                    * dSpreadTwo3n3n*pow(pow(dSumWLinearTwo3n3n,2.)/(pow(dSumWLinearTwo3n3n,2.)-dSumWQuadraticTwo3n3n),0.5),2.)
11891                    + 4.*pow(f2pCorrelations->GetBinContent(3),2.)
11892                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
11893                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
11894                    + pow((pow(dSumWQuadraticFive5n3n3n3n2n,0.5)/dSumWLinearFive5n3n3n3n2n)
11895                    * dSpreadFive5n3n3n3n2n*pow(pow(dSumWLinearFive5n3n3n3n2n,2.)/(pow(dSumWLinearFive5n3n3n3n2n,2.)-dSumWQuadraticFive5n3n3n3n2n),0.5),2.)
11896                    + 4.*2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(3)
11897                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11898                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,12)) 
11899                    - f2pCorrelations->GetBinContent(3)*f3pCorrelations->GetBinContent(7))
11900                    / (dSumWLinearTwo3n3n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11901                    - 2.*2.*f3pCorrelations->GetBinContent(7)
11902                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11903                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(3,107))
11904                    - f2pCorrelations->GetBinContent(3)*f5pCorrelations->GetBinContent(53))
11905                    / (dSumWLinearTwo3n3n*dSumWLinearFive5n3n3n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11906                    - 2.*2.*f2pCorrelations->GetBinContent(3)
11907                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11908                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,107))
11909                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(53))
11910                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n3n3n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11911    if(dError>0.)
11912    {
11913     f5pCumulants->SetBinError(53,pow(dError,0.5)); 
11914    }
11915   } // end of if(...)
11916  } // end of {
11917  f5pCumulants->SetBinContent(54,f5pCorrelations->GetBinContent(54)-2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(1)); 
11918  { 
11919   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
11920   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
11921   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
11922   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
11923   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
11924   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
11925   Double_t dSumWLinearFive5n1n4n1n1n = 0.; // sum of linear event weights for <4>
11926   Double_t dSumWQuadraticFive5n1n4n1n1n = 0.; // sum of quadratic event weights <4>
11927   Double_t dSpreadFive5n1n4n1n1n = 0.; // weighted and biased estimator for sigma of <4>
11928   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11929   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11930   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
11931   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
11932   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
11933   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
11934   dSumWLinearFive5n1n4n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11935   dSumWQuadraticFive5n1n4n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11936   dSpreadFive5n1n4n1n1n = f5pCorrelations->GetBinError(54);
11937   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
11938      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
11939      pow(dSumWLinearFive5n1n4n1n1n,2.)>dSumWQuadraticFive5n1n4n1n1n)
11940   {
11941    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(8),2.)
11942                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
11943                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
11944                    + 4.*pow(f2pCorrelations->GetBinContent(1),2.)
11945                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
11946                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
11947                    + pow((pow(dSumWQuadraticFive5n1n4n1n1n,0.5)/dSumWLinearFive5n1n4n1n1n)
11948                    * dSpreadFive5n1n4n1n1n*pow(pow(dSumWLinearFive5n1n4n1n1n,2.)/(pow(dSumWLinearFive5n1n4n1n1n,2.)-dSumWQuadraticFive5n1n4n1n1n),0.5),2.)
11949                    + 4.*2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(1)
11950                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
11951                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,13)) 
11952                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(8))
11953                    / (dSumWLinearTwo1n1n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
11954                    - 2.*2.*f3pCorrelations->GetBinContent(8)
11955                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
11956                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,108))
11957                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(54))
11958                    / (dSumWLinearTwo1n1n*dSumWLinearFive5n1n4n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
11959                    - 2.*2.*f2pCorrelations->GetBinContent(1)
11960                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
11961                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,108))
11962                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(54))
11963                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n1n4n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
11964    if(dError>0.)
11965    {
11966     f5pCumulants->SetBinError(54,pow(dError,0.5)); 
11967    }
11968   } // end of if(...)
11969  } // end of {
11970
11971  f5pCumulants->SetBinContent(55,f5pCorrelations->GetBinContent(55));
11972  {
11973   Double_t dSumWLinear = 0.; // sum of linear event weights
11974   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
11975   Double_t dSpread = 0.; // weighted and biased estimator for sigma
11976   Double_t dError = 0.; // weighted and unbiased estimator for sigma
11977   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
11978   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
11979   dSpread = f5pCorrelations->GetBinError(55);
11980   if(pow(dSumWLinear,2.)>dSumWQuadratic)
11981   {
11982    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
11983    f5pCumulants->SetBinError(55,dError); 
11984   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
11985  } 
11986  f5pCumulants->SetBinContent(56,f5pCorrelations->GetBinContent(56)-2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(4));
11987  { 
11988   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
11989   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
11990   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
11991   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
11992   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
11993   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
11994   Double_t dSumWLinearFive5n4n4n4n1n = 0.; // sum of linear event weights for <4>
11995   Double_t dSumWQuadraticFive5n4n4n4n1n = 0.; // sum of quadratic event weights <4>
11996   Double_t dSpreadFive5n4n4n4n1n = 0.; // weighted and biased estimator for sigma of <4>
11997   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
11998   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
11999   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
12000   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12001   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12002   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
12003   dSumWLinearFive5n4n4n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12004   dSumWQuadraticFive5n4n4n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12005   dSpreadFive5n4n4n4n1n = f5pCorrelations->GetBinError(56);
12006   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
12007      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
12008      pow(dSumWLinearFive5n4n4n4n1n,2.)>dSumWQuadraticFive5n4n4n4n1n)
12009   {
12010    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(8),2.)
12011                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
12012                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
12013                    + 4.*pow(f2pCorrelations->GetBinContent(4),2.)
12014                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
12015                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
12016                    + pow((pow(dSumWQuadraticFive5n4n4n4n1n,0.5)/dSumWLinearFive5n4n4n4n1n)
12017                    * dSpreadFive5n4n4n4n1n*pow(pow(dSumWLinearFive5n4n4n4n1n,2.)/(pow(dSumWLinearFive5n4n4n4n1n,2.)-dSumWQuadraticFive5n4n4n4n1n),0.5),2.)
12018                    + 4.*2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(4)
12019                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12020                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,13)) 
12021                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(8))
12022                    / (dSumWLinearTwo4n4n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12023                    - 2.*2.*f3pCorrelations->GetBinContent(8)
12024                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12025                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,110))
12026                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(56))
12027                    / (dSumWLinearTwo4n4n*dSumWLinearFive5n4n4n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12028                    - 2.*2.*f2pCorrelations->GetBinContent(4)
12029                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12030                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,110))
12031                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(56))
12032                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n4n4n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12033    if(dError>0.)
12034    {
12035     f5pCumulants->SetBinError(56,pow(dError,0.5)); 
12036    }
12037   } // end of if(...)
12038  } // end of {
12039  f5pCumulants->SetBinContent(57,f5pCorrelations->GetBinContent(57));
12040  {
12041   Double_t dSumWLinear = 0.; // sum of linear event weights
12042   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12043   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12044   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12045   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12046   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12047   dSpread = f5pCorrelations->GetBinError(57);
12048   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12049   {
12050    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12051    f5pCumulants->SetBinError(57,dError); 
12052   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12053  } 
12054  f5pCumulants->SetBinContent(58,f5pCorrelations->GetBinContent(58));
12055  {
12056   Double_t dSumWLinear = 0.; // sum of linear event weights
12057   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12058   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12059   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12060   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12061   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12062   dSpread = f5pCorrelations->GetBinError(58);
12063   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12064   {
12065    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12066    f5pCumulants->SetBinError(58,dError); 
12067   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12068  } 
12069  f5pCumulants->SetBinContent(59,f5pCorrelations->GetBinContent(59)-2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(5));  
12070  { 
12071   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
12072   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
12073   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
12074   Double_t dSumWLinearThree5n3n2n = 0.; // sum of linear event weights for <2>
12075   Double_t dSumWQuadraticThree5n3n2n = 0.; // sum of quadratic event weights <2>
12076   Double_t dSpreadThree5n3n2n = 0.; // weighted and biased estimator for sigma of <2>
12077   Double_t dSumWLinearFive5n5n5n3n2n = 0.; // sum of linear event weights for <4>
12078   Double_t dSumWQuadraticFive5n5n5n3n2n = 0.; // sum of quadratic event weights <4>
12079   Double_t dSpreadFive5n5n5n3n2n = 0.; // weighted and biased estimator for sigma of <4>
12080   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12081   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12082   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
12083   dSumWLinearThree5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12084   dSumWQuadraticThree5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12085   dSpreadThree5n3n2n = f3pCorrelations->GetBinError(7);
12086   dSumWLinearFive5n5n5n3n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12087   dSumWQuadraticFive5n5n5n3n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12088   dSpreadFive5n5n5n3n2n = f5pCorrelations->GetBinError(59);
12089   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
12090      pow(dSumWLinearThree5n3n2n,2.)>dSumWQuadraticThree5n3n2n &&
12091      pow(dSumWLinearFive5n5n5n3n2n,2.)>dSumWQuadraticFive5n5n5n3n2n)
12092   {
12093    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(7),2.)
12094                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
12095                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
12096                    + 4.*pow(f2pCorrelations->GetBinContent(5),2.)
12097                    * pow((pow(dSumWQuadraticThree5n3n2n,0.5)/dSumWLinearThree5n3n2n)
12098                    * dSpreadThree5n3n2n*pow(pow(dSumWLinearThree5n3n2n,2.)/(pow(dSumWLinearThree5n3n2n,2.)-dSumWQuadraticThree5n3n2n),0.5),2.)
12099                    + pow((pow(dSumWQuadraticFive5n5n5n3n2n,0.5)/dSumWLinearFive5n5n5n3n2n)
12100                    * dSpreadFive5n5n5n3n2n*pow(pow(dSumWLinearFive5n5n5n3n2n,2.)/(pow(dSumWLinearFive5n5n5n3n2n,2.)-dSumWQuadraticFive5n5n5n3n2n),0.5),2.)
12101                    + 4.*2.*f3pCorrelations->GetBinContent(7)*f2pCorrelations->GetBinContent(5)
12102                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12103                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,12)) 
12104                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(7))
12105                    / (dSumWLinearTwo5n5n*dSumWLinearThree5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12106                    - 2.*2.*f3pCorrelations->GetBinContent(7)
12107                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12108                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,113))
12109                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(59))
12110                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n5n5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12111                    - 2.*2.*f2pCorrelations->GetBinContent(5)
12112                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12113                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(12,113))
12114                    - f3pCorrelations->GetBinContent(7)*f5pCorrelations->GetBinContent(59))
12115                    / (dSumWLinearThree5n3n2n*dSumWLinearFive5n5n5n3n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12116    if(dError>0.)
12117    {
12118     f5pCumulants->SetBinError(59,pow(dError,0.5)); 
12119    }
12120   } // end of if(...)
12121  } // end of {
12122  f5pCumulants->SetBinContent(60,f5pCorrelations->GetBinContent(60)-2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(5));  
12123  { 
12124   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
12125   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
12126   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
12127   Double_t dSumWLinearThree5n4n1n = 0.; // sum of linear event weights for <2>
12128   Double_t dSumWQuadraticThree5n4n1n = 0.; // sum of quadratic event weights <2>
12129   Double_t dSpreadThree5n4n1n = 0.; // weighted and biased estimator for sigma of <2>
12130   Double_t dSumWLinearFive5n5n5n4n1n = 0.; // sum of linear event weights for <4>
12131   Double_t dSumWQuadraticFive5n5n5n4n1n = 0.; // sum of quadratic event weights <4>
12132   Double_t dSpreadFive5n5n5n4n1n = 0.; // weighted and biased estimator for sigma of <4>
12133   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12134   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12135   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
12136   dSumWLinearThree5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12137   dSumWQuadraticThree5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12138   dSpreadThree5n4n1n = f3pCorrelations->GetBinError(8);
12139   dSumWLinearFive5n5n5n4n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12140   dSumWQuadraticFive5n5n5n4n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12141   dSpreadFive5n5n5n4n1n = f5pCorrelations->GetBinError(60);
12142   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
12143      pow(dSumWLinearThree5n4n1n,2.)>dSumWQuadraticThree5n4n1n &&
12144      pow(dSumWLinearFive5n5n5n4n1n,2.)>dSumWQuadraticFive5n5n5n4n1n)
12145   {
12146    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(8),2.)
12147                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
12148                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
12149                    + 4.*pow(f2pCorrelations->GetBinContent(5),2.)
12150                    * pow((pow(dSumWQuadraticThree5n4n1n,0.5)/dSumWLinearThree5n4n1n)
12151                    * dSpreadThree5n4n1n*pow(pow(dSumWLinearThree5n4n1n,2.)/(pow(dSumWLinearThree5n4n1n,2.)-dSumWQuadraticThree5n4n1n),0.5),2.)
12152                    + pow((pow(dSumWQuadraticFive5n5n5n4n1n,0.5)/dSumWLinearFive5n5n5n4n1n)
12153                    * dSpreadFive5n5n5n4n1n*pow(pow(dSumWLinearFive5n5n5n4n1n,2.)/(pow(dSumWLinearFive5n5n5n4n1n,2.)-dSumWQuadraticFive5n5n5n4n1n),0.5),2.)
12154                    + 4.*2.*f3pCorrelations->GetBinContent(8)*f2pCorrelations->GetBinContent(5)
12155                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12156                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,13)) 
12157                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(8))
12158                    / (dSumWLinearTwo5n5n*dSumWLinearThree5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12159                    - 2.*2.*f3pCorrelations->GetBinContent(8)
12160                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12161                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,114))
12162                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(60))
12163                    / (dSumWLinearTwo5n5n*dSumWLinearFive5n5n5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12164                    - 2.*2.*f2pCorrelations->GetBinContent(5)
12165                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12166                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(13,114))
12167                    - f3pCorrelations->GetBinContent(8)*f5pCorrelations->GetBinContent(60))
12168                    / (dSumWLinearThree5n4n1n*dSumWLinearFive5n5n5n4n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12169    if(dError>0.)
12170    {
12171     f5pCumulants->SetBinError(60,pow(dError,0.5)); 
12172    }
12173   } // end of if(...)
12174  } // end of {
12175  f5pCumulants->SetBinContent(61,f5pCorrelations->GetBinContent(61));
12176  {
12177   Double_t dSumWLinear = 0.; // sum of linear event weights
12178   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12179   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12180   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12181   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12182   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12183   dSpread = f5pCorrelations->GetBinError(61);
12184   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12185   {
12186    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12187    f5pCumulants->SetBinError(61,dError); 
12188   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12189  } 
12190  f5pCumulants->SetBinContent(62,f5pCorrelations->GetBinContent(62));
12191  {
12192   Double_t dSumWLinear = 0.; // sum of linear event weights
12193   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12194   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12195   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12196   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12197   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12198   dSpread = f5pCorrelations->GetBinError(62);
12199   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12200   {
12201    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12202    f5pCumulants->SetBinError(62,dError); 
12203   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12204  } 
12205  f5pCumulants->SetBinContent(63,f5pCorrelations->GetBinContent(63));
12206  {
12207   Double_t dSumWLinear = 0.; // sum of linear event weights
12208   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12209   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12210   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12211   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12212   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12213   dSpread = f5pCorrelations->GetBinError(63);
12214   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12215   {
12216    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12217    f5pCumulants->SetBinError(63,dError); 
12218   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12219  } 
12220  f5pCumulants->SetBinContent(64,f5pCorrelations->GetBinContent(64)-2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(1));  
12221  { 
12222   Double_t dSumWLinearTwo1n1n = 0.; // sum of linear event weights for <2>
12223   Double_t dSumWQuadraticTwo1n1n = 0.; // sum of quadratic event weights <2>
12224   Double_t dSpreadTwo1n1n = 0.; // weighted and biased estimator for sigma of <2>
12225   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
12226   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
12227   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
12228   Double_t dSumWLinearFive6n1n5n1n1n = 0.; // sum of linear event weights for <4>
12229   Double_t dSumWQuadraticFive6n1n5n1n1n = 0.; // sum of quadratic event weights <4>
12230   Double_t dSpreadFive6n1n5n1n1n = 0.; // weighted and biased estimator for sigma of <4>
12231   dSumWLinearTwo1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12232   dSumWQuadraticTwo1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12233   dSpreadTwo1n1n = f2pCorrelations->GetBinError(1);
12234   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12235   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12236   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
12237   dSumWLinearFive6n1n5n1n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12238   dSumWQuadraticFive6n1n5n1n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12239   dSpreadFive6n1n5n1n1n = f5pCorrelations->GetBinError(64);
12240   if(pow(dSumWLinearTwo1n1n,2.)>dSumWQuadraticTwo1n1n &&
12241      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
12242      pow(dSumWLinearFive6n1n5n1n1n,2.)>dSumWQuadraticFive6n1n5n1n1n)
12243   {
12244    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(10),2.)
12245                    * pow((pow(dSumWQuadraticTwo1n1n,0.5)/dSumWLinearTwo1n1n)
12246                    * dSpreadTwo1n1n*pow(pow(dSumWLinearTwo1n1n,2.)/(pow(dSumWLinearTwo1n1n,2.)-dSumWQuadraticTwo1n1n),0.5),2.)
12247                    + 4.*pow(f2pCorrelations->GetBinContent(1),2.)
12248                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
12249                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
12250                    + pow((pow(dSumWQuadraticFive6n1n5n1n1n,0.5)/dSumWLinearFive6n1n5n1n1n)
12251                    * dSpreadFive6n1n5n1n1n*pow(pow(dSumWLinearFive6n1n5n1n1n,2.)/(pow(dSumWLinearFive6n1n5n1n1n,2.)-dSumWQuadraticFive6n1n5n1n1n),0.5),2.)
12252                    + 4.*2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(1)
12253                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12254                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,15)) 
12255                    - f2pCorrelations->GetBinContent(1)*f3pCorrelations->GetBinContent(10))
12256                    / (dSumWLinearTwo1n1n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12257                    - 2.*2.*f3pCorrelations->GetBinContent(10)
12258                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12259                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(1,118))
12260                    - f2pCorrelations->GetBinContent(1)*f5pCorrelations->GetBinContent(64))
12261                    / (dSumWLinearTwo1n1n*dSumWLinearFive6n1n5n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12262                    - 2.*2.*f2pCorrelations->GetBinContent(1)
12263                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12264                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,118))
12265                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(64))
12266                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n1n5n1n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12267    if(dError>0.)
12268    {
12269     f5pCumulants->SetBinError(64,pow(dError,0.5)); 
12270    }
12271   } // end of if(...)
12272  } // end of {
12273  f5pCumulants->SetBinContent(65,f5pCorrelations->GetBinContent(65)-2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(2));  
12274  { 
12275   Double_t dSumWLinearTwo2n2n = 0.; // sum of linear event weights for <2>
12276   Double_t dSumWQuadraticTwo2n2n = 0.; // sum of quadratic event weights <2>
12277   Double_t dSpreadTwo2n2n = 0.; // weighted and biased estimator for sigma of <2>
12278   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
12279   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
12280   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
12281   Double_t dSumWLinearFive6n2n4n2n2n = 0.; // sum of linear event weights for <4>
12282   Double_t dSumWQuadraticFive6n2n4n2n2n = 0.; // sum of quadratic event weights <4>
12283   Double_t dSpreadFive6n2n4n2n2n = 0.; // weighted and biased estimator for sigma of <4>
12284   dSumWLinearTwo2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12285   dSumWQuadraticTwo2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12286   dSpreadTwo2n2n = f2pCorrelations->GetBinError(2);
12287   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12288   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12289   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
12290   dSumWLinearFive6n2n4n2n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12291   dSumWQuadraticFive6n2n4n2n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12292   dSpreadFive6n2n4n2n2n = f5pCorrelations->GetBinError(65);
12293   if(pow(dSumWLinearTwo2n2n,2.)>dSumWQuadraticTwo2n2n &&
12294      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
12295      pow(dSumWLinearFive6n2n4n2n2n,2.)>dSumWQuadraticFive6n2n4n2n2n)
12296   {
12297    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(9),2.)
12298                    * pow((pow(dSumWQuadraticTwo2n2n,0.5)/dSumWLinearTwo2n2n)
12299                    * dSpreadTwo2n2n*pow(pow(dSumWLinearTwo2n2n,2.)/(pow(dSumWLinearTwo2n2n,2.)-dSumWQuadraticTwo2n2n),0.5),2.)
12300                    + 4.*pow(f2pCorrelations->GetBinContent(2),2.)
12301                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
12302                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
12303                    + pow((pow(dSumWQuadraticFive6n2n4n2n2n,0.5)/dSumWLinearFive6n2n4n2n2n)
12304                    * dSpreadFive6n2n4n2n2n*pow(pow(dSumWLinearFive6n2n4n2n2n,2.)/(pow(dSumWLinearFive6n2n4n2n2n,2.)-dSumWQuadraticFive6n2n4n2n2n),0.5),2.)
12305                    + 4.*2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(2)
12306                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12307                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,14)) 
12308                    - f2pCorrelations->GetBinContent(2)*f3pCorrelations->GetBinContent(9))
12309                    / (dSumWLinearTwo2n2n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12310                    - 2.*2.*f3pCorrelations->GetBinContent(9)
12311                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12312                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(2,119))
12313                    - f2pCorrelations->GetBinContent(2)*f5pCorrelations->GetBinContent(65))
12314                    / (dSumWLinearTwo2n2n*dSumWLinearFive6n2n4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12315                    - 2.*2.*f2pCorrelations->GetBinContent(2)
12316                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12317                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,119))
12318                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(65))
12319                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n2n4n2n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12320    if(dError>0.)
12321    {
12322     f5pCumulants->SetBinError(65,pow(dError,0.5)); 
12323    }
12324   } // end of if(...)
12325  } // end of {
12326  f5pCumulants->SetBinContent(66,f5pCorrelations->GetBinContent(66)-2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(4));
12327  { 
12328   Double_t dSumWLinearTwo4n4n = 0.; // sum of linear event weights for <2>
12329   Double_t dSumWQuadraticTwo4n4n = 0.; // sum of quadratic event weights <2>
12330   Double_t dSpreadTwo4n4n = 0.; // weighted and biased estimator for sigma of <2>
12331   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
12332   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
12333   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
12334   Double_t dSumWLinearFive6n4n4n4n2n = 0.; // sum of linear event weights for <4>
12335   Double_t dSumWQuadraticFive6n4n4n4n2n = 0.; // sum of quadratic event weights <4>
12336   Double_t dSpreadFive6n4n4n4n2n = 0.; // weighted and biased estimator for sigma of <4>
12337   dSumWLinearTwo4n4n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12338   dSumWQuadraticTwo4n4n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12339   dSpreadTwo4n4n = f2pCorrelations->GetBinError(4);
12340   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12341   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12342   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
12343   dSumWLinearFive6n4n4n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12344   dSumWQuadraticFive6n4n4n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12345   dSpreadFive6n4n4n4n2n = f5pCorrelations->GetBinError(66);
12346   if(pow(dSumWLinearTwo4n4n,2.)>dSumWQuadraticTwo4n4n &&
12347      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
12348      pow(dSumWLinearFive6n4n4n4n2n,2.)>dSumWQuadraticFive6n4n4n4n2n)
12349   {
12350    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(9),2.)
12351                    * pow((pow(dSumWQuadraticTwo4n4n,0.5)/dSumWLinearTwo4n4n)
12352                    * dSpreadTwo4n4n*pow(pow(dSumWLinearTwo4n4n,2.)/(pow(dSumWLinearTwo4n4n,2.)-dSumWQuadraticTwo4n4n),0.5),2.)
12353                    + 4.*pow(f2pCorrelations->GetBinContent(4),2.)
12354                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
12355                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
12356                    + pow((pow(dSumWQuadraticFive6n4n4n4n2n,0.5)/dSumWLinearFive6n4n4n4n2n)
12357                    * dSpreadFive6n4n4n4n2n*pow(pow(dSumWLinearFive6n4n4n4n2n,2.)/(pow(dSumWLinearFive6n4n4n4n2n,2.)-dSumWQuadraticFive6n4n4n4n2n),0.5),2.)
12358                    + 4.*2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(4)
12359                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12360                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,14)) 
12361                    - f2pCorrelations->GetBinContent(4)*f3pCorrelations->GetBinContent(9))
12362                    / (dSumWLinearTwo4n4n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12363                    - 2.*2.*f3pCorrelations->GetBinContent(9)
12364                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12365                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(4,120))
12366                    - f2pCorrelations->GetBinContent(4)*f5pCorrelations->GetBinContent(66))
12367                    / (dSumWLinearTwo4n4n*dSumWLinearFive6n4n4n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12368                    - 2.*2.*f2pCorrelations->GetBinContent(4)
12369                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12370                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,120))
12371                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(66))
12372                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n4n4n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12373    if(dError>0.)
12374    {
12375     f5pCumulants->SetBinError(66,pow(dError,0.5)); 
12376    }
12377   } // end of if(...)
12378  } // end of {  
12379  f5pCumulants->SetBinContent(67,f5pCorrelations->GetBinContent(67));
12380  {
12381   Double_t dSumWLinear = 0.; // sum of linear event weights
12382   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12383   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12384   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12385   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12386   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12387   dSpread = f5pCorrelations->GetBinError(67);
12388   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12389   {
12390    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12391    f5pCumulants->SetBinError(67,dError); 
12392   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12393  }  
12394  f5pCumulants->SetBinContent(68,f5pCorrelations->GetBinContent(68)-2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(5));  
12395  { 
12396   Double_t dSumWLinearTwo5n5n = 0.; // sum of linear event weights for <2>
12397   Double_t dSumWQuadraticTwo5n5n = 0.; // sum of quadratic event weights <2>
12398   Double_t dSpreadTwo5n5n = 0.; // weighted and biased estimator for sigma of <2>
12399   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
12400   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
12401   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
12402   Double_t dSumWLinearFive6n5n5n5n1n = 0.; // sum of linear event weights for <4>
12403   Double_t dSumWQuadraticFive6n5n5n5n1n = 0.; // sum of quadratic event weights <4>
12404   Double_t dSpreadFive6n5n5n5n1n = 0.; // weighted and biased estimator for sigma of <4>
12405   dSumWLinearTwo5n5n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12406   dSumWQuadraticTwo5n5n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12407   dSpreadTwo5n5n = f2pCorrelations->GetBinError(5);
12408   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12409   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12410   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
12411   dSumWLinearFive6n5n5n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12412   dSumWQuadraticFive6n5n5n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12413   dSpreadFive6n5n5n5n1n = f5pCorrelations->GetBinError(68);
12414   if(pow(dSumWLinearTwo5n5n,2.)>dSumWQuadraticTwo5n5n &&
12415      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
12416      pow(dSumWLinearFive6n5n5n5n1n,2.)>dSumWQuadraticFive6n5n5n5n1n)
12417   {
12418    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(10),2.)
12419                    * pow((pow(dSumWQuadraticTwo5n5n,0.5)/dSumWLinearTwo5n5n)
12420                    * dSpreadTwo5n5n*pow(pow(dSumWLinearTwo5n5n,2.)/(pow(dSumWLinearTwo5n5n,2.)-dSumWQuadraticTwo5n5n),0.5),2.)
12421                    + 4.*pow(f2pCorrelations->GetBinContent(5),2.)
12422                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
12423                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
12424                    + pow((pow(dSumWQuadraticFive6n5n5n5n1n,0.5)/dSumWLinearFive6n5n5n5n1n)
12425                    * dSpreadFive6n5n5n5n1n*pow(pow(dSumWLinearFive6n5n5n5n1n,2.)/(pow(dSumWLinearFive6n5n5n5n1n,2.)-dSumWQuadraticFive6n5n5n5n1n),0.5),2.)
12426                    + 4.*2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(5)
12427                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12428                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,15)) 
12429                    - f2pCorrelations->GetBinContent(5)*f3pCorrelations->GetBinContent(10))
12430                    / (dSumWLinearTwo5n5n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12431                    - 2.*2.*f3pCorrelations->GetBinContent(10)
12432                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12433                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(5,122))
12434                    - f2pCorrelations->GetBinContent(5)*f5pCorrelations->GetBinContent(68))
12435                    / (dSumWLinearTwo5n5n*dSumWLinearFive6n5n5n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12436                    - 2.*2.*f2pCorrelations->GetBinContent(5)
12437                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12438                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,122))
12439                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(68))
12440                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n5n5n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12441    if(dError>0.)
12442    {
12443     f5pCumulants->SetBinError(68,pow(dError,0.5)); 
12444    }
12445   } // end of if(...)
12446  } // end of {
12447  f5pCumulants->SetBinContent(69,f5pCorrelations->GetBinContent(69));
12448  {
12449   Double_t dSumWLinear = 0.; // sum of linear event weights
12450   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12451   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12452   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12453   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12454   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12455   dSpread = f5pCorrelations->GetBinError(69);
12456   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12457   {
12458    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12459    f5pCumulants->SetBinError(69,dError); 
12460   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12461  } 
12462  f5pCumulants->SetBinContent(70,f5pCorrelations->GetBinContent(70)-2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(6));  
12463  { 
12464   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
12465   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
12466   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
12467   Double_t dSumWLinearThree6n4n2n = 0.; // sum of linear event weights for <2>
12468   Double_t dSumWQuadraticThree6n4n2n = 0.; // sum of quadratic event weights <2>
12469   Double_t dSpreadThree6n4n2n = 0.; // weighted and biased estimator for sigma of <2>
12470   Double_t dSumWLinearFive6n6n6n4n2n = 0.; // sum of linear event weights for <4>
12471   Double_t dSumWQuadraticFive6n6n6n4n2n = 0.; // sum of quadratic event weights <4>
12472   Double_t dSpreadFive6n6n6n4n2n = 0.; // weighted and biased estimator for sigma of <4>
12473   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12474   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12475   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
12476   dSumWLinearThree6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12477   dSumWQuadraticThree6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12478   dSpreadThree6n4n2n = f3pCorrelations->GetBinError(9);
12479   dSumWLinearFive6n6n6n4n2n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12480   dSumWQuadraticFive6n6n6n4n2n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12481   dSpreadFive6n6n6n4n2n = f5pCorrelations->GetBinError(70);
12482   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
12483      pow(dSumWLinearThree6n4n2n,2.)>dSumWQuadraticThree6n4n2n &&
12484      pow(dSumWLinearFive6n6n6n4n2n,2.)>dSumWQuadraticFive6n6n6n4n2n)
12485   {
12486    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(9),2.)
12487                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
12488                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
12489                    + 4.*pow(f2pCorrelations->GetBinContent(6),2.)
12490                    * pow((pow(dSumWQuadraticThree6n4n2n,0.5)/dSumWLinearThree6n4n2n)
12491                    * dSpreadThree6n4n2n*pow(pow(dSumWLinearThree6n4n2n,2.)/(pow(dSumWLinearThree6n4n2n,2.)-dSumWQuadraticThree6n4n2n),0.5),2.)
12492                    + pow((pow(dSumWQuadraticFive6n6n6n4n2n,0.5)/dSumWLinearFive6n6n6n4n2n)
12493                    * dSpreadFive6n6n6n4n2n*pow(pow(dSumWLinearFive6n6n6n4n2n,2.)/(pow(dSumWLinearFive6n6n6n4n2n,2.)-dSumWQuadraticFive6n6n6n4n2n),0.5),2.)
12494                    + 4.*2.*f3pCorrelations->GetBinContent(9)*f2pCorrelations->GetBinContent(6)
12495                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12496                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,14)) 
12497                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(9))
12498                    / (dSumWLinearTwo6n6n*dSumWLinearThree6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12499                    - 2.*2.*f3pCorrelations->GetBinContent(9)
12500                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12501                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,124))
12502                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(70))
12503                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n6n6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12504                    - 2.*2.*f2pCorrelations->GetBinContent(6)
12505                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12506                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(14,124))
12507                    - f3pCorrelations->GetBinContent(9)*f5pCorrelations->GetBinContent(70))
12508                    / (dSumWLinearThree6n4n2n*dSumWLinearFive6n6n6n4n2n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12509    if(dError>0.)
12510    {
12511     f5pCumulants->SetBinError(70,pow(dError,0.5)); 
12512    }
12513   } // end of if(...)
12514  } // end of {
12515
12516
12517
12518
12519
12520  f5pCumulants->SetBinContent(71,f5pCorrelations->GetBinContent(71)-2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(6));  
12521  { 
12522   Double_t dSumWLinearTwo6n6n = 0.; // sum of linear event weights for <2>
12523   Double_t dSumWQuadraticTwo6n6n = 0.; // sum of quadratic event weights <2>
12524   Double_t dSpreadTwo6n6n = 0.; // weighted and biased estimator for sigma of <2>
12525   Double_t dSumWLinearThree6n5n1n = 0.; // sum of linear event weights for <2>
12526   Double_t dSumWQuadraticThree6n5n1n = 0.; // sum of quadratic event weights <2>
12527   Double_t dSpreadThree6n5n1n = 0.; // weighted and biased estimator for sigma of <2>
12528   Double_t dSumWLinearFive6n6n6n5n1n = 0.; // sum of linear event weights for <4>
12529   Double_t dSumWQuadraticFive6n6n6n5n1n = 0.; // sum of quadratic event weights <4>
12530   Double_t dSpreadFive6n6n6n5n1n = 0.; // weighted and biased estimator for sigma of <4>
12531   dSumWLinearTwo6n6n = fMixedHarmonicEventWeights[0]->GetBinContent(2);
12532   dSumWQuadraticTwo6n6n = fMixedHarmonicEventWeights[1]->GetBinContent(2);
12533   dSpreadTwo6n6n = f2pCorrelations->GetBinError(6);
12534   dSumWLinearThree6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(3);
12535   dSumWQuadraticThree6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(3);
12536   dSpreadThree6n5n1n = f3pCorrelations->GetBinError(10);
12537   dSumWLinearFive6n6n6n5n1n = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12538   dSumWQuadraticFive6n6n6n5n1n = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12539   dSpreadFive6n6n6n5n1n = f5pCorrelations->GetBinError(71);
12540   if(pow(dSumWLinearTwo6n6n,2.)>dSumWQuadraticTwo6n6n &&
12541      pow(dSumWLinearThree6n5n1n,2.)>dSumWQuadraticThree6n5n1n &&
12542      pow(dSumWLinearFive6n6n6n5n1n,2.)>dSumWQuadraticFive6n6n6n5n1n)
12543   {
12544    Double_t dError = 4.*pow(f3pCorrelations->GetBinContent(10),2.)
12545                    * pow((pow(dSumWQuadraticTwo6n6n,0.5)/dSumWLinearTwo6n6n)
12546                    * dSpreadTwo6n6n*pow(pow(dSumWLinearTwo6n6n,2.)/(pow(dSumWLinearTwo6n6n,2.)-dSumWQuadraticTwo6n6n),0.5),2.)
12547                    + 4.*pow(f2pCorrelations->GetBinContent(6),2.)
12548                    * pow((pow(dSumWQuadraticThree6n5n1n,0.5)/dSumWLinearThree6n5n1n)
12549                    * dSpreadThree6n5n1n*pow(pow(dSumWLinearThree6n5n1n,2.)/(pow(dSumWLinearThree6n5n1n,2.)-dSumWQuadraticThree6n5n1n),0.5),2.)
12550                    + pow((pow(dSumWQuadraticFive6n6n6n5n1n,0.5)/dSumWLinearFive6n6n6n5n1n)
12551                    * dSpreadFive6n6n6n5n1n*pow(pow(dSumWLinearFive6n6n6n5n1n,2.)/(pow(dSumWLinearFive6n6n6n5n1n,2.)-dSumWQuadraticFive6n6n6n5n1n),0.5),2.)
12552                    + 4.*2.*f3pCorrelations->GetBinContent(10)*f2pCorrelations->GetBinContent(6)
12553                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)) 
12554                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,15)) 
12555                    - f2pCorrelations->GetBinContent(6)*f3pCorrelations->GetBinContent(10))
12556                    / (dSumWLinearTwo6n6n*dSumWLinearThree6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,3)))
12557                    - 2.*2.*f3pCorrelations->GetBinContent(10)
12558                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)) 
12559                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(6,125))
12560                    - f2pCorrelations->GetBinContent(6)*f5pCorrelations->GetBinContent(71))
12561                    / (dSumWLinearTwo6n6n*dSumWLinearFive6n6n6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(2,5)))
12562                    - 2.*2.*f2pCorrelations->GetBinContent(6)
12563                    * fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)) 
12564                    * (fMixedHarmonicProductOfCorrelations->GetBinContent(fMixedHarmonicProductOfCorrelations->GetBin(15,125))
12565                    - f3pCorrelations->GetBinContent(10)*f5pCorrelations->GetBinContent(71))
12566                    / (dSumWLinearThree6n5n1n*dSumWLinearFive6n6n6n5n1n-fMixedHarmonicProductOfEventWeights->GetBinContent(fMixedHarmonicProductOfEventWeights->GetBin(3,5)));
12567    if(dError>0.)
12568    {
12569     f5pCumulants->SetBinError(71,pow(dError,0.5)); 
12570    }
12571   } // end of if(...)
12572  } // end of {
12573  // d3) "Four distinct harmonics":
12574  for(Int_t b=73;b<=83;b++)
12575  {
12576   f5pCumulants->SetBinContent(b,f5pCorrelations->GetBinContent(b));
12577   Double_t dSumWLinear = 0.; // sum of linear event weights
12578   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12579   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12580   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12581   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12582   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12583   dSpread = f5pCorrelations->GetBinError(b);
12584   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12585   {
12586    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12587    f5pCumulants->SetBinError(b,dError); 
12588   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12589  } // end of for(Int_t b=73;b<=83;b++)
12590  // d4) "Five distinct harmonics":
12591  for(Int_t b=85;b<=87;b++)
12592  {
12593   f5pCumulants->SetBinContent(b,f5pCorrelations->GetBinContent(b));
12594   Double_t dSumWLinear = 0.; // sum of linear event weights
12595   Double_t dSumWQuadratic = 0.; // sum of quadratic event weights
12596   Double_t dSpread = 0.; // weighted and biased estimator for sigma
12597   Double_t dError = 0.; // weighted and unbiased estimator for sigma
12598   dSumWLinear = fMixedHarmonicEventWeights[0]->GetBinContent(5);
12599   dSumWQuadratic = fMixedHarmonicEventWeights[1]->GetBinContent(5);
12600   dSpread = f5pCorrelations->GetBinError(b);
12601   if(pow(dSumWLinear,2.)>dSumWQuadratic)
12602   {
12603    dError = (pow(dSumWQuadratic,0.5)/dSumWLinear)*dSpread*pow(pow(dSumWLinear,2.)/(pow(dSumWLinear,2.)-dSumWQuadratic),0.5);
12604    f5pCumulants->SetBinError(b,dError); 
12605   } // end of if(pow(dSumWLinear,2.)>dSumWQuadratic)
12606  } // end of for(Int_t b=85;b<=87;b++)
12607
12608 } // end of void AliFlowAnalysisWithQCumulants::CalculateCumulantsMixedHarmonics()
12609
12610 //===================================================================================================================
12611
12612 void AliFlowAnalysisWithQCumulants::StorePhiDistributionForOneEvent(AliFlowEventSimple *anEvent)
12613 {
12614  // Store phi distribution for one event to illustrate flow.
12615  
12616  if(fPhiDistributionForOneEvent->GetEntries()>0){return;} // store only phi distribution for one event
12617  
12618  Double_t vMin = fPhiDistributionForOneEventSettings[0]; 
12619  Double_t vMax = fPhiDistributionForOneEventSettings[1]; 
12620  Double_t refMultMin = fPhiDistributionForOneEventSettings[2]; 
12621  Double_t refMultMax = fPhiDistributionForOneEventSettings[3]; 
12622  
12623  Double_t vEBE = 0.;
12624  Double_t cumulant4thEBE = fIntFlowCorrelationsEBE->GetBinContent(2)-2.*pow(fIntFlowCorrelationsEBE->GetBinContent(1),2.);
12625  if(cumulant4thEBE<0.)
12626  {
12627   vEBE = pow(-1.*cumulant4thEBE,0.25);
12628   if((vEBE>vMin && vEBE<vMax) && (fReferenceMultiplicityEBE>refMultMin && fReferenceMultiplicityEBE<refMultMax))
12629   {
12630    fPhiDistributionForOneEvent->SetTitle(Form("v_{%i} = %f",fHarmonic,vEBE));
12631    for(Int_t p=0;p<anEvent->NumberOfTracks();p++)
12632    {
12633     if(anEvent->GetTrack(p)->InRPSelection())
12634     {
12635      fPhiDistributionForOneEvent->Fill(anEvent->GetTrack(p)->Phi());
12636     }
12637    } // end of for(Int_t p=0;p<anEvent->NumberOfTracks();p++)
12638   } else
12639     {
12640      fPhiDistributionForOneEvent->SetTitle(Form("v_{%i} = %f, out of specified boundaries",fHarmonic,vEBE));  
12641     } 
12642    
12643  } // end of if(cumulant4thEBE<0.)
12644  
12645 } // end of void AliFlowAnalysisWithQCumulants::StorePhiDistributionForOneEvent(AliFlowEventSimple *anEvent)
12646
12647 //===================================================================================================================
12648
12649 void AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrelations()
12650 {
12651  // Calculate averages of products of correlations for integrated flow.
12652  
12653  // multiplicity:
12654  Double_t dMult = (*fSpk)(0,0);
12655  
12656  // Multiplicity bin of an event (relevant for all histos vs M): 
12657  Double_t dMultiplicityBin = 0.;
12658  if(!fMultiplicityIsRefMultiplicity)
12659  {
12660   dMultiplicityBin = dMult+0.5;
12661  } else
12662    {
12663     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
12664    }
12665
12666  Int_t counter = 0;
12667  
12668  for(Int_t ci1=1;ci1<4;ci1++)
12669  {
12670   for(Int_t ci2=ci1+1;ci2<=4;ci2++)
12671   {
12672    fIntFlowProductOfCorrelationsPro->Fill(0.5+counter,
12673                                           fIntFlowCorrelationsEBE->GetBinContent(ci1)*
12674                                           fIntFlowCorrelationsEBE->GetBinContent(ci2),
12675                                           fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci1)*
12676                                           fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci2));
12677    // products versus multiplicity:  // [0=<<2><4>>,1=<<2><6>>,2=<<2><8>>,3=<<4><6>>,4=<<4><8>>,5=<<6><8>>]
12678    if(fCalculateCumulantsVsM)
12679    {
12680     fIntFlowProductOfCorrelationsVsMPro[counter]->Fill(dMultiplicityBin, // to be improved: dMult => sum of weights ?
12681                                                        fIntFlowCorrelationsEBE->GetBinContent(ci1)*
12682                                                        fIntFlowCorrelationsEBE->GetBinContent(ci2),
12683                                                        fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci1)*
12684                                                        fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci2));
12685    } // end of if(fCalculateCumulantsVsM)
12686    counter++;                                                                                                                        
12687   }
12688  }
12689  
12690 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrelations()
12691
12692
12693 //=======================================================================================================================
12694
12695
12696 void AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrectionTermsForNUA()
12697 {
12698  // Calculate averages of products of correction terms for NUA.
12699  
12700  // a) Binning of fIntFlowProductOfCorrectionTermsForNUAPro is organized as follows:
12701  //     1st bin: <<2><cos(phi)>> 
12702  //     2nd bin: <<2><sin(phi)>>
12703  //     3rd bin: <<cos(phi)><sin(phi)>>
12704  //     4th bin: <<2><cos(phi1+phi2)>> 
12705  //     5th bin: <<2><sin(phi1+phi2)>>
12706  //     6th bin: <<2><cos(phi1-phi2-phi3)>> 
12707  //     7th bin: <<2><sin(phi1-phi2-phi3)>>
12708  //     8th bin: <<4><cos(phi1)>>
12709  //     9th bin: <<4><sin(phi1)>>
12710  //    10th bin: <<4><cos(phi1+phi2)>>
12711  //    11th bin: <<4><sin(phi1+phi2)>>
12712  //    12th bin: <<4><cos(phi1-phi2-phi3)>>
12713  //    13th bin: <<4><sin(phi1-phi2-phi3)>>
12714  //    14th bin: <<cos(phi1)><cos(phi1+phi2)>>
12715  //    15th bin: <<cos(phi1)><sin(phi1+phi2)>> 
12716  //    16th bin: <<cos(phi1)><cos(phi1-phi2-phi3)>>
12717  //    17th bin: <<cos(phi1)><sin(phi1-phi2-phi3)>> 
12718  //    18th bin: <<sin(phi1)><cos(phi1+phi2)>>
12719  //    19th bin: <<sin(phi1)><sin(phi1+phi2)>> 
12720  //    20th bin: <<sin(phi1)><cos(phi1-phi2-phi3)>>
12721  //    21st bin: <<sin(phi1)><sin(phi1-phi2-phi3)>>
12722  //    22nd bin: <<cos(phi1+phi2)><sin(phi1+phi2)>>
12723  //    23rd bin: <<cos(phi1+phi2)><cos(phi1-phi2-phi3)>>
12724  //    24th bin: <<cos(phi1+phi2)><sin(phi1-phi2-phi3)>>
12725  //    25th bin: <<sin(phi1+phi2)><cos(phi1-phi2-phi3)>>
12726  //    26th bin: <<sin(phi1+phi2)><sin(phi1-phi2-phi3)>>
12727  //    27th bin: <<cos(phi1-phi2-phi3)><sin(phi1-phi2-phi3)>>
12728  
12729  // <<2><cos(phi)>>:
12730  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(0.5,
12731                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1),
12732                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
12733                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1));
12734  // <<2><sin(phi)>>:
12735  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(1.5,
12736                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1),
12737                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
12738                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
12739  // <<cos(phi)><sin(phi)>>:
12740  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(2.5,
12741                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1),
12742                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
12743                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
12744  // <<2><cos(phi1+phi2)>>:
12745  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(3.5,
12746                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2),
12747                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
12748                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
12749  // <<2><sin(phi1+phi2)>>:
12750  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(4.5,
12751                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
12752                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
12753                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
12754  // <<2><cos(phi1-phi2-phi3)>>:
12755  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(5.5,
12756                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
12757                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
12758                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
12759  // <<2><sin(phi1-phi2-phi3)>>:
12760  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(6.5,
12761                                                  fIntFlowCorrelationsEBE->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
12762                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)
12763                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
12764  // <<4><cos(phi1)>>:
12765  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(7.5,
12766                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1),
12767                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
12768                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1));
12769  // <<4><sin(phi1)>>:
12770  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(8.5,
12771                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1),
12772                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
12773                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
12774  // <<4><cos(phi1+phi2)>>:
12775  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(9.5,
12776                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2),
12777                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
12778                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
12779  // <<4><sin(phi1+phi2)>>:
12780  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(10.5,
12781                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
12782                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
12783                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));
12784  // <<4><cos(phi1-phi2-phi3)>>:
12785  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(11.5,
12786                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
12787                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
12788                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
12789  // <<4><sin(phi1-phi2-phi3)>>:
12790  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(12.5,
12791                                                  fIntFlowCorrelationsEBE->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
12792                                                  fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)
12793                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));   
12794  // <<cos(phi1)><cos(phi1+phi2)>>:
12795  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(13.5,
12796                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2),
12797                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
12798                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
12799  // <<cos(phi1)><sin(phi1+phi2)>>: 
12800  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(14.5,
12801                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
12802                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
12803                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
12804  // <<cos(phi1)><cos(phi1-phi2-phi3)>>:
12805  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(15.5,
12806                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
12807                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
12808                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
12809  // <<cos(phi1)><sin(phi1-phi2-phi3)>>: 
12810  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(16.5,
12811                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
12812                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)
12813                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));  
12814  // <<sin(phi1)><cos(phi1+phi2)>>:
12815  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(17.5,
12816                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2),
12817                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)
12818                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2));  
12819  // <<sin(phi1)><sin(phi1+phi2)>>: 
12820  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(18.5,
12821                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
12822                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)
12823                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));  
12824  // <<sin(phi1)><cos(phi1-phi2-phi3)>>:
12825  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(19.5,
12826                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
12827                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)
12828                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
12829  // <<sin(phi1)><sin(phi1-phi2-phi3)>>:
12830  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(20.5,
12831                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(1)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
12832                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)
12833                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
12834  // <<cos(phi1+phi2)><sin(phi1+phi2)>>:
12835  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(21.5,
12836                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2),
12837                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)
12838                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
12839  // <<cos(phi1+phi2)><cos(phi1-phi2-phi3)>>:
12840  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(22.5,
12841                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
12842                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)
12843                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));   
12844  // <<cos(phi1+phi2)><sin(phi1-phi2-phi3)>>:
12845  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(23.5,
12846                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
12847                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)
12848                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));    
12849  // <<sin(phi1+phi2)><cos(phi1-phi2-phi3)>>:
12850  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(24.5,
12851                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3),
12852                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)
12853                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));    
12854  // <<sin(phi1+phi2)><sin(phi1-phi2-phi3)>>:
12855  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(25.5,
12856                                                  fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(2)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
12857                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)
12858                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));    
12859  // <<cos(phi1-phi2-phi3)><sin(phi1-phi2-phi3)>>:
12860  fIntFlowProductOfCorrectionTermsForNUAPro->Fill(26.5,
12861                                                  fIntFlowCorrectionTermsForNUAEBE[1]->GetBinContent(3)*fIntFlowCorrectionTermsForNUAEBE[0]->GetBinContent(3),
12862                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)
12863                                                  *fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));    
12864
12865 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrectionTermsForNUA()
12866
12867 //=======================================================================================================================
12868
12869 void AliFlowAnalysisWithQCumulants::CalculateCovariancesIntFlow()
12870 {
12871  // a) Calculate unbiased estimators Cov(<2>,<4>), Cov(<2>,<6>), Cov(<2>,<8>), Cov(<4>,<6>), Cov(<4>,<8>) and Cov(<6>,<8>)
12872  //    for covariances V_(<2>,<4>), V_(<2>,<6>), V_(<2>,<8>), V_(<4>,<6>), V_(<4>,<8>) and V_(<6>,<8>).
12873  // b) Store in histogram fIntFlowCovariances for instance the following: 
12874  //
12875  //             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)]
12876  // 
12877  //    where N is the number of events, w_{<2>} is event weight for <2> and w_{<4>} is event weight for <4>.
12878  // c) Binning of fIntFlowCovariances is organized as follows:
12879  // 
12880  //     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)] 
12881  //     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)]
12882  //     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)]
12883  //     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)]
12884  //     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)]
12885  //     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)]
12886  //
12887     
12888  // Average 2-, 4-, 6- and 8-particle correlations for all events:
12889  Double_t correlation[4] = {0.};
12890  for(Int_t ci=0;ci<4;ci++)
12891  {
12892   correlation[ci] = fIntFlowCorrelationsPro->GetBinContent(ci+1);
12893  } 
12894  // Average products of 2-, 4-, 6- and 8-particle correlations: 
12895  Double_t productOfCorrelations[4][4] = {{0.}};
12896  Int_t productOfCorrelationsLabel = 1;
12897  // Denominators in the expressions for the unbiased estimator for covariance:
12898  Double_t denominator[4][4] = {{0.}};
12899  Int_t sumOfProductOfEventWeightsLabel1 = 1;
12900  // Weight dependent prefactor which multiply unbiased estimators for covariances:
12901  Double_t wPrefactor[4][4] = {{0.}}; 
12902  Int_t sumOfProductOfEventWeightsLabel2 = 1;
12903  for(Int_t c1=0;c1<4;c1++)
12904  {
12905   for(Int_t c2=c1+1;c2<4;c2++)
12906   {
12907    productOfCorrelations[c1][c2] = fIntFlowProductOfCorrelationsPro->GetBinContent(productOfCorrelationsLabel);
12908    if(TMath::Abs(fIntFlowSumOfEventWeights[0]->GetBinContent(c1+1)) > 1.e-44 && TMath::Abs(fIntFlowSumOfEventWeights[0]->GetBinContent(c2+1)) > 1.e-44)
12909    {
12910     denominator[c1][c2] = 1.-(fIntFlowSumOfProductOfEventWeights->GetBinContent(sumOfProductOfEventWeightsLabel1))
12911                         / (fIntFlowSumOfEventWeights[0]->GetBinContent(c1+1) 
12912                         * fIntFlowSumOfEventWeights[0]->GetBinContent(c2+1));                              
12913     wPrefactor[c1][c2] = fIntFlowSumOfProductOfEventWeights->GetBinContent(sumOfProductOfEventWeightsLabel2)
12914                        / (fIntFlowSumOfEventWeights[0]->GetBinContent(c1+1)
12915                        * fIntFlowSumOfEventWeights[0]->GetBinContent(c2+1));                                                       
12916    }
12917    productOfCorrelationsLabel++; // to be improved - do I need here all 3 counters?
12918    sumOfProductOfEventWeightsLabel1++;
12919    sumOfProductOfEventWeightsLabel2++;  
12920   } // end of for(Int_t c2=c1+1;c2<4;c2++)
12921  } // end of for(Int_t c1=0;c1<4;c1++)
12922  
12923  Int_t covarianceLabel = 1;
12924  for(Int_t c1=0;c1<4;c1++)
12925  {
12926   for(Int_t c2=c1+1;c2<4;c2++)
12927   {
12928    if(TMath::Abs(denominator[c1][c2]) > 1.e-44)
12929    {
12930     // Covariances:
12931     Double_t cov = (productOfCorrelations[c1][c2]-correlation[c1]*correlation[c2])/denominator[c1][c2]; 
12932     // Covariances multiplied with weight dependent prefactor:
12933     Double_t wCov = cov * wPrefactor[c1][c2];
12934     fIntFlowCovariances->SetBinContent(covarianceLabel,wCov);
12935    }
12936    covarianceLabel++;
12937   } // end of for(Int_t c2=c1+1;c2<4;c2++) 
12938  } // end of for(Int_t c1=0;c1<4;c1++)
12939  
12940  // Versus multiplicity: 
12941  if(!fCalculateCumulantsVsM){return;}
12942  Int_t nBins = fIntFlowCorrelationsVsMPro[0]->GetNbinsX(); // to be improved (hardwired 0) 
12943  for(Int_t b=1;b<=nBins;b++)
12944  {
12945   // Average 2-, 4-, 6- and 8-particle correlations for all events:
12946   Double_t correlationVsM[4] = {0.};
12947   for(Int_t ci=0;ci<4;ci++)
12948   {
12949    correlationVsM[ci] = fIntFlowCorrelationsVsMPro[ci]->GetBinContent(b);
12950   } // end of for(Int_t ci=0;ci<4;ci++)
12951   // Average products of 2-, 4-, 6- and 8-particle correlations: 
12952   Double_t productOfCorrelationsVsM[4][4] = {{0.}};
12953   Int_t productOfCorrelationsLabelVsM = 1;
12954   // Denominators in the expressions for the unbiased estimator for covariance:
12955   Double_t denominatorVsM[4][4] = {{0.}};
12956   Int_t sumOfProductOfEventWeightsLabel1VsM = 1;
12957   // Weight dependent prefactor which multiply unbiased estimators for covariances:
12958   Double_t wPrefactorVsM[4][4] = {{0.}}; 
12959   Int_t sumOfProductOfEventWeightsLabel2VsM = 1;
12960   for(Int_t c1=0;c1<4;c1++)
12961   {
12962    for(Int_t c2=c1+1;c2<4;c2++)
12963    {
12964     productOfCorrelationsVsM[c1][c2] = fIntFlowProductOfCorrelationsVsMPro[productOfCorrelationsLabelVsM-1]->GetBinContent(b);
12965     if(TMath::Abs(fIntFlowSumOfEventWeightsVsM[c1][0]->GetBinContent(b)) > 1.e-44 && TMath::Abs(fIntFlowSumOfEventWeightsVsM[c2][0]->GetBinContent(b)) > 1.e-44)
12966     {
12967      denominatorVsM[c1][c2] = 1.-(fIntFlowSumOfProductOfEventWeightsVsM[sumOfProductOfEventWeightsLabel1VsM-1]->GetBinContent(b))
12968                             / (fIntFlowSumOfEventWeightsVsM[c1][0]->GetBinContent(b) 
12969                             * fIntFlowSumOfEventWeightsVsM[c2][0]->GetBinContent(b));                              
12970      wPrefactorVsM[c1][c2] = fIntFlowSumOfProductOfEventWeightsVsM[sumOfProductOfEventWeightsLabel2VsM-1]->GetBinContent(b)
12971                            / (fIntFlowSumOfEventWeightsVsM[c1][0]->GetBinContent(b)
12972                            * fIntFlowSumOfEventWeightsVsM[c2][0]->GetBinContent(b));                                                       
12973     }
12974     productOfCorrelationsLabelVsM++;
12975     sumOfProductOfEventWeightsLabel1VsM++;
12976     sumOfProductOfEventWeightsLabel2VsM++;  
12977    } // end of for(Int_t c1=0;c1<4;c1++) 
12978   } // end of for(Int_t c2=c1+1;c2<4;c2++)
12979  
12980   Int_t covarianceLabelVsM = 1;
12981   for(Int_t c1=0;c1<4;c1++)
12982   {
12983    for(Int_t c2=c1+1;c2<4;c2++)
12984    {
12985     if(TMath::Abs(denominatorVsM[c1][c2]) > 1.e-44)
12986     {
12987      // Covariances:
12988      Double_t covVsM = (productOfCorrelationsVsM[c1][c2]-correlationVsM[c1]*correlationVsM[c2])/denominatorVsM[c1][c2]; 
12989      // Covariances multiplied with weight dependent prefactor:
12990      Double_t wCovVsM = covVsM * wPrefactorVsM[c1][c2];
12991      fIntFlowCovariancesVsM[covarianceLabelVsM-1]->SetBinContent(b,wCovVsM);
12992     }
12993     covarianceLabelVsM++;
12994    } // end of for(Int_t c2=c1+1;c2<4;c2++)
12995   } // end of for(Int_t c1=0;c1<4;c1++)
12996  } // end of for(Int_t b=1;b<=nBins;b++)
12997   
12998 } // end of AliFlowAnalysisWithQCumulants::CalculateCovariancesIntFlow()
12999
13000 //=======================================================================================================================
13001
13002 void AliFlowAnalysisWithQCumulants::CalculateCovariancesNUAIntFlow()
13003 {
13004  // a) Calculate unbiased estimators Cov(*,*) for true covariances V_(*,*) for NUA terms.
13005  // b) Store in histogram fIntFlowCovariancesNUA for instance the following: 
13006  //
13007  //             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)]
13008  // 
13009  //    where N is the number of events, w_{<2>} is event weight for <2> and w_{<cos(phi)>} is event weight for <cos(phi)>.
13010  // c) Binning of fIntFlowCovariancesNUA is organized as follows:
13011  // 
13012  //     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)] 
13013  //     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)]
13014  //     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)]
13015  // ...
13016       
13017  // Cov(<2>,<cos(phi)>):
13018  Double_t product1 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(1); // <<2><cos(phi)>> 
13019  Double_t term1st1 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13020  Double_t term2nd1 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi)>>
13021  Double_t sumOfW1st1 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13022  Double_t sumOfW2nd1 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi)>}
13023  Double_t sumOfWW1 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(1); // W_{<2>} * W_{<cos(phi)>}
13024  // numerator in the expression for the the unbiased estimator for covariance:
13025  Double_t numerator1 = product1 - term1st1*term2nd1; 
13026  // denominator in the expression for the the unbiased estimator for covariance:
13027  Double_t denominator1 = 0.;
13028  if(TMath::Abs(sumOfW1st1*sumOfW2nd1)>0.)
13029  {
13030   denominator1 = 1.-sumOfWW1/(sumOfW1st1*sumOfW2nd1);
13031   if(TMath::Abs(denominator1)>0.)
13032   {
13033    // covariance:
13034    Double_t covariance1 = numerator1/denominator1;
13035    // weight dependent prefactor for covariance:
13036    Double_t wPrefactor1 = sumOfWW1/(sumOfW1st1*sumOfW2nd1);
13037    // finally, store "weighted" covariance:
13038    fIntFlowCovariancesNUA->SetBinContent(1,wPrefactor1*covariance1);
13039   } // end of if(TMath::Abs(denominator)>0.)
13040  } // end of if(TMath::Abs(sumOfW1st1*sumOfW2nd1)>0.)
13041  
13042  // Cov(<2>,<sin(phi)>):
13043  Double_t product2 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(2); // <<2><sin(phi)>> 
13044  Double_t term1st2 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13045  Double_t term2nd2 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi)>>
13046  Double_t sumOfW1st2 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13047  Double_t sumOfW2nd2 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi)>}
13048  Double_t sumOfWW2 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(2); // W_{<2>} * W_{<sin(phi)>}
13049  // numerator in the expression for the the unbiased estimator for covariance:
13050  Double_t numerator2 = product2 - term1st2*term2nd2;
13051  // denominator in the expression for the the unbiased estimator for covariance:
13052  Double_t denominator2 = 0.;
13053  if(TMath::Abs(sumOfW1st2*sumOfW2nd2)>0.)
13054  {  
13055   denominator2 = 1.-sumOfWW2/(sumOfW1st2*sumOfW2nd2);
13056   if(TMath::Abs(denominator2)>0.)
13057   {
13058    // covariance:
13059    Double_t covariance2 = numerator2/denominator2;
13060    // weight dependent prefactor for covariance:
13061    Double_t wPrefactor2 = sumOfWW2/(sumOfW1st2*sumOfW2nd2);
13062    // finally, store "weighted" covariance:
13063    fIntFlowCovariancesNUA->SetBinContent(2,wPrefactor2*covariance2);
13064   } // end of if(TMath::Abs(denominator2)>0.)
13065  } // end of if(TMath::Abs(sumOfW1st2*sumOfW2nd2)>0.)
13066  
13067  // Cov(<cos(phi)>,<sin(phi)>):
13068  Double_t product3 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(3); // <<cos(phi)><sin(phi)>> 
13069  Double_t term1st3 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi)>>
13070  Double_t term2nd3 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi)>>
13071  Double_t sumOfW1st3 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi)>}
13072  Double_t sumOfW2nd3 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi)>}
13073  Double_t sumOfWW3 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(3); // W_{<cos(phi)>} * W_{<sin(phi)>}
13074  // numerator in the expression for the the unbiased estimator for covariance:
13075  Double_t numerator3 = product3 - term1st3*term2nd3; 
13076  // denominator in the expression for the the unbiased estimator for covariance:
13077  Double_t denominator3 = 0;
13078  if(TMath::Abs(sumOfW1st3*sumOfW2nd3)>0.)
13079  { 
13080   denominator3 = 1.-sumOfWW3/(sumOfW1st3*sumOfW2nd3);
13081   if(TMath::Abs(denominator3)>0.)
13082   {
13083    // covariance:
13084    Double_t covariance3 = numerator3/denominator3;
13085    // weight dependent prefactor for covariance:
13086    Double_t wPrefactor3 = sumOfWW3/(sumOfW1st3*sumOfW2nd3);
13087    // finally, store "weighted" covariance:
13088    fIntFlowCovariancesNUA->SetBinContent(3,wPrefactor3*covariance3);
13089   } // end of if(TMath::Abs(denominator3)>0.)
13090  } // end of if(TMath::Abs(sumOfW1st3*sumOfW2nd3)>0.)
13091  
13092  // Cov(<2>,<cos(phi1+phi2)>):
13093  Double_t product4 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(4); // <<2><cos(phi1+phi2)>> 
13094  Double_t term1st4 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13095  Double_t term2nd4 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13096  Double_t sumOfW1st4 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13097  Double_t sumOfW2nd4 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13098  Double_t sumOfWW4 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(4); // W_{<2>} * W_{<cos(phi1+phi2)>}
13099  // numerator in the expression for the the unbiased estimator for covariance:
13100  Double_t numerator4 = product4 - term1st4*term2nd4; 
13101  // denominator in the expression for the the unbiased estimator for covariance:
13102  Double_t denominator4 = 0.;
13103  if(TMath::Abs(sumOfW1st4*sumOfW2nd4)>0.)
13104  { 
13105   denominator4 = 1.-sumOfWW4/(sumOfW1st4*sumOfW2nd4);
13106   if(TMath::Abs(denominator4)>0.)
13107   {  
13108    // covariance:
13109    Double_t covariance4 = numerator4/denominator4;
13110    // weight dependent prefactor for covariance:
13111    Double_t wPrefactor4 = sumOfWW4/(sumOfW1st4*sumOfW2nd4);
13112    // finally, store "weighted" covariance:
13113    fIntFlowCovariancesNUA->SetBinContent(4,wPrefactor4*covariance4);
13114   } // end of if(TMath::Abs(denominator4)>0.)
13115  } // end of if(TMath::Abs(sumOfW1st4*sumOfW2nd4)>0.)
13116  
13117  // Cov(<2>,<sin(phi1+phi2)>):
13118  Double_t product5 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(5); // <<2><sin(phi1+phi2)>> 
13119  Double_t term1st5 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13120  Double_t term2nd5 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13121  Double_t sumOfW1st5 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13122  Double_t sumOfW2nd5 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13123  Double_t sumOfWW5 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(5); // W_{<2>} * W_{<sin(phi1+phi2)>}
13124  // numerator in the expression for the the unbiased estimator for covariance:
13125  Double_t numerator5 = product5 - term1st5*term2nd5; 
13126  // denominator in the expression for the the unbiased estimator for covariance:
13127  Double_t denominator5 = 0.;
13128  if(TMath::Abs(sumOfW1st5*sumOfW2nd5)>0.)
13129  {  
13130   denominator5 = 1.-sumOfWW5/(sumOfW1st5*sumOfW2nd5);
13131   if(TMath::Abs(denominator5)>0.)
13132   {  
13133    // covariance:
13134    Double_t covariance5 = numerator5/denominator5;
13135    // weight dependent prefactor for covariance:
13136    Double_t wPrefactor5 = sumOfWW5/(sumOfW1st5*sumOfW2nd5);
13137    // finally, store "weighted" covariance:
13138    fIntFlowCovariancesNUA->SetBinContent(5,wPrefactor5*covariance5);
13139   } // end of if(TMath::Abs(denominator5)>0.)
13140  } // end of if(TMath::Abs(sumOfW1st5*sumOfW2nd5)>0.)
13141  
13142  // Cov(<2>,<cos(phi1-phi2-phi3)>):
13143  Double_t product6 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(6); // <<2><cos(phi1-phi2-phi3)>> 
13144  Double_t term1st6 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13145  Double_t term2nd6 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13146  Double_t sumOfW1st6 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13147  Double_t sumOfW2nd6 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13148  Double_t sumOfWW6 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(6); // W_{<2>} * W_{<cos(phi1-phi2-phi3)>}
13149  // numerator in the expression for the the unbiased estimator for covariance:
13150  Double_t numerator6 = product6 - term1st6*term2nd6; 
13151  // denominator in the expression for the the unbiased estimator for covariance:
13152  Double_t denominator6 = 0.;
13153  if(TMath::Abs(sumOfW1st6*sumOfW2nd6)>0.)
13154  {  
13155   denominator6 = 1.-sumOfWW6/(sumOfW1st6*sumOfW2nd6);
13156   if(TMath::Abs(denominator6)>0.)
13157   {  
13158    // covariance:
13159    Double_t covariance6 = numerator6/denominator6;
13160    // weight dependent prefactor for covariance:
13161    Double_t wPrefactor6 = sumOfWW6/(sumOfW1st6*sumOfW2nd6);
13162    // finally, store "weighted" covariance:
13163    fIntFlowCovariancesNUA->SetBinContent(6,wPrefactor6*covariance6);
13164   } // end of if(TMath::Abs(denominator6)>0.)
13165  } // end of if(TMath::Abs(sumOfW1st6*sumOfW2nd6)>0.)
13166  
13167  // Cov(<2>,<sin(phi1-phi2-phi3)>):
13168  Double_t product7 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(7); // <<2><sin(phi1-phi2-phi3)>> 
13169  Double_t term1st7 = fIntFlowCorrelationsPro->GetBinContent(1); // <<2>>
13170  Double_t term2nd7 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13171  Double_t sumOfW1st7 = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // W_{<2>}
13172  Double_t sumOfW2nd7 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13173  Double_t sumOfWW7 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(7); // W_{<2>} * W_{<sin(phi1-phi2-phi3)>}
13174  // numerator in the expression for the the unbiased estimator for covariance:
13175  Double_t numerator7 = product7 - term1st7*term2nd7; 
13176  // denominator in the expression for the the unbiased estimator for covariance:
13177  Double_t denominator7 = 0.;
13178  if(TMath::Abs(sumOfW1st7*sumOfW2nd7)>0.)
13179  {  
13180   denominator7 = 1.-sumOfWW7/(sumOfW1st7*sumOfW2nd7);
13181   if(TMath::Abs(denominator7)>0.)
13182   {   
13183    // covariance:
13184    Double_t covariance7 = numerator7/denominator7;
13185    // weight dependent prefactor for covariance:
13186    Double_t wPrefactor7 = sumOfWW7/(sumOfW1st7*sumOfW2nd7);
13187    // finally, store "weighted" covariance:
13188    fIntFlowCovariancesNUA->SetBinContent(7,wPrefactor7*covariance7);
13189   } // end of if(TMath::Abs(denominator7)>0.)
13190  } // end of if(TMath::Abs(sumOfW1st7*sumOfW2nd7)>0.)
13191  
13192  // Cov(<4>,<cos(phi1>):
13193  Double_t product8 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(8); // <<4><cos(phi1)>> 
13194  Double_t term1st8 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13195  Double_t term2nd8 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13196  Double_t sumOfW1st8 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13197  Double_t sumOfW2nd8 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13198  Double_t sumOfWW8 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(8); // W_{<4>} * W_{<cos(phi1)>}
13199  // numerator in the expression for the the unbiased estimator for covariance:
13200  Double_t numerator8 = product8 - term1st8*term2nd8; 
13201  // denominator in the expression for the the unbiased estimator for covariance:
13202  Double_t denominator8 = 0.;
13203  if(TMath::Abs(sumOfW1st8*sumOfW2nd8)>0.)
13204  { 
13205   denominator8 = 1.-sumOfWW8/(sumOfW1st8*sumOfW2nd8);
13206   if(TMath::Abs(denominator8)>0.)
13207   {     
13208    // covariance:
13209    Double_t covariance8 = numerator8/denominator8;
13210    // weight dependent prefactor for covariance:
13211    Double_t wPrefactor8 = sumOfWW8/(sumOfW1st8*sumOfW2nd8);
13212    // finally, store "weighted" covariance:
13213    fIntFlowCovariancesNUA->SetBinContent(8,wPrefactor8*covariance8);
13214   } // end of if(TMath::Abs(denominator8)>0.)
13215  } // end of if(TMath::Abs(sumOfW1st8*sumOfW2nd8)>0.)
13216  
13217  // Cov(<4>,<sin(phi1)>):
13218  Double_t product9 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(9); // <<4><sin(phi1)>> 
13219  Double_t term1st9 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13220  Double_t term2nd9 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
13221  Double_t sumOfW1st9 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13222  Double_t sumOfW2nd9 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
13223  Double_t sumOfWW9 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(9); // W_{<4>} * W_{<sin(phi1)>}
13224  // numerator in the expression for the the unbiased estimator for covariance:
13225  Double_t numerator9 = product9 - term1st9*term2nd9; 
13226  // denominator in the expression for the the unbiased estimator for covariance:
13227  Double_t denominator9 = 0.;
13228  if(TMath::Abs(sumOfW1st9*sumOfW2nd9)>0.) 
13229  {
13230   denominator9 = 1.-sumOfWW9/(sumOfW1st9*sumOfW2nd9);
13231   if(TMath::Abs(denominator9)>0.)
13232   {     
13233    // covariance:
13234    Double_t covariance9 = numerator9/denominator9;
13235    // weight dependent prefactor for covariance:
13236    Double_t wPrefactor9 = sumOfWW9/(sumOfW1st9*sumOfW2nd9);
13237    // finally, store "weighted" covariance:
13238    fIntFlowCovariancesNUA->SetBinContent(9,wPrefactor9*covariance9); 
13239   }
13240  } // end of if(TMath::Abs(sumOfW1st9*sumOfW2nd9)>0.) 
13241  
13242  // Cov(<4>,<cos(phi1+phi2)>):
13243  Double_t product10 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(10); // <<4><cos(phi1+phi2)>> 
13244  Double_t term1st10 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13245  Double_t term2nd10 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13246  Double_t sumOfW1st10 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13247  Double_t sumOfW2nd10 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13248  Double_t sumOfWW10 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(10); // W_{<4>} * W_{<cos(phi1+phi2)>}
13249  // numerator in the expression for the the unbiased estimator for covariance:
13250  Double_t numerator10 = product10 - term1st10*term2nd10; 
13251  // denominator in the expression for the the unbiased estimator for covariance:
13252  Double_t denominator10 = 0.;
13253  if(TMath::Abs(sumOfW1st10*sumOfW2nd10)>0.) 
13254  { 
13255   denominator10 = 1.-sumOfWW10/(sumOfW1st10*sumOfW2nd10);
13256   if(TMath::Abs(denominator10)>0.) 
13257   { 
13258    // covariance:
13259    Double_t covariance10 = numerator10/denominator10;
13260    // weight dependent prefactor for covariance:
13261    Double_t wPrefactor10 = sumOfWW10/(sumOfW1st10*sumOfW2nd10);
13262    // finally, store "weighted" covariance:
13263    fIntFlowCovariancesNUA->SetBinContent(10,wPrefactor10*covariance10);
13264   } // end of if(TMath::Abs(denominator10)>0.) 
13265  } // end of if(TMath::Abs(sumOfW1st10*sumOfW2nd10)>0.) 
13266  
13267  // Cov(<4>,<sin(phi1+phi2)>):
13268  Double_t product11 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(11); // <<4><sin(phi1+phi2)>> 
13269  Double_t term1st11 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13270  Double_t term2nd11 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13271  Double_t sumOfW1st11 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13272  Double_t sumOfW2nd11 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13273  Double_t sumOfWW11 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(11); // W_{<4>} * W_{<sin(phi1+phi2)>}
13274  // numerator in the expression for the the unbiased estimator for covariance:
13275  Double_t numerator11 = product11 - term1st11*term2nd11; 
13276  // denominator in the expression for the the unbiased estimator for covariance:
13277  Double_t denominator11 = 0.;
13278  if(TMath::Abs(sumOfW1st11*sumOfW2nd11)>0.) 
13279  {  
13280   denominator11 = 1.-sumOfWW11/(sumOfW1st11*sumOfW2nd11);
13281   if(TMath::Abs(denominator11)>0.) 
13282   { 
13283    // covariance:
13284    Double_t covariance11 = numerator11/denominator11;
13285    // weight dependent prefactor for covariance:
13286    Double_t wPrefactor11 = sumOfWW11/(sumOfW1st11*sumOfW2nd11);
13287    // finally, store "weighted" covariance:
13288    fIntFlowCovariancesNUA->SetBinContent(11,wPrefactor11*covariance11);
13289   } // end of if(TMath::Abs(denominator11)>0.) 
13290  } // end of if(TMath::Abs(sumOfW1st11*sumOfW2nd11)>0.) 
13291
13292  // Cov(<4>,<cos(phi1-phi2-phi3)>):
13293  Double_t product12 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(12); // <<4><cos(phi1-phi2-phi3)>> 
13294  Double_t term1st12 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13295  Double_t term2nd12 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13296  Double_t sumOfW1st12 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13297  Double_t sumOfW2nd12 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13298  Double_t sumOfWW12 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(12); // W_{<4>} * W_{<cos(phi1-phi2-phi3)>}
13299  // numerator in the expression for the the unbiased estimator for covariance:
13300  Double_t numerator12 = product12 - term1st12*term2nd12; 
13301  // denominator in the expression for the the unbiased estimator for covariance:
13302  Double_t denominator12 = 0.;
13303  if(TMath::Abs(sumOfW1st12*sumOfW2nd12)>0.) 
13304  {   
13305   denominator12 = 1.-sumOfWW12/(sumOfW1st12*sumOfW2nd12);
13306   if(TMath::Abs(denominator12)>0.) 
13307   { 
13308    // covariance:
13309    Double_t covariance12 = numerator12/denominator12;
13310    // weight dependent prefactor for covariance:
13311    Double_t wPrefactor12 = sumOfWW12/(sumOfW1st12*sumOfW2nd12);
13312    // finally, store "weighted" covariance:
13313    fIntFlowCovariancesNUA->SetBinContent(12,wPrefactor12*covariance12);
13314   } // end of if(TMath::Abs(denominator12)>0.)
13315  } // end of if(TMath::Abs(sumOfW1st12*sumOfW2nd12)>0.)  
13316
13317  // Cov(<4>,<sin(phi1-phi2-phi3)>):
13318  Double_t product13 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(13); // <<4><sin(phi1-phi2-phi3)>> 
13319  Double_t term1st13 = fIntFlowCorrelationsPro->GetBinContent(2); // <<4>>
13320  Double_t term2nd13 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13321  Double_t sumOfW1st13 = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // W_{<4>}
13322  Double_t sumOfW2nd13 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13323  Double_t sumOfWW13 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(13); // W_{<4>} * W_{<sin(phi1-phi2-phi3)>}
13324  // numerator in the expression for the the unbiased estimator for covariance:
13325  Double_t numerator13 = product13 - term1st13*term2nd13; 
13326  // denominator in the expression for the the unbiased estimator for covariance:
13327  Double_t denominator13 = 0.;
13328  if(TMath::Abs(sumOfW1st13*sumOfW2nd13)>0.) 
13329  {   
13330   denominator13 = 1.-sumOfWW13/(sumOfW1st13*sumOfW2nd13);
13331   if(TMath::Abs(denominator13)>0.) 
13332   { 
13333    // covariance:
13334    Double_t covariance13 = numerator13/denominator13;
13335    // weight dependent prefactor for covariance:
13336    Double_t wPrefactor13 = sumOfWW13/(sumOfW1st13*sumOfW2nd13);
13337    // finally, store "weighted" covariance:
13338    fIntFlowCovariancesNUA->SetBinContent(13,wPrefactor13*covariance13);
13339   } // end of if(TMath::Abs(denominator13)>0.) 
13340  } // end of if(TMath::Abs(sumOfW1st13*sumOfW2nd13)>0.) 
13341
13342  // Cov(<cos(phi1)>,<cos(phi1+phi2)>):
13343  Double_t product14 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(14); // <<cos(phi1)><cos(phi1+phi2)>> 
13344  Double_t term1st14 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13345  Double_t term2nd14 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13346  Double_t sumOfW1st14 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13347  Double_t sumOfW2nd14 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13348  Double_t sumOfWW14 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(14); // W_{<cos(phi1)>} * W_{<cos(phi1+phi2)>}
13349  // numerator in the expression for the the unbiased estimator for covariance:
13350  Double_t numerator14 = product14 - term1st14*term2nd14; 
13351  // denominator in the expression for the the unbiased estimator for covariance:
13352  Double_t denominator14 = 0.;
13353  if(TMath::Abs(sumOfW1st14*sumOfW2nd14)>0.) 
13354  {  
13355   denominator14 = 1.-sumOfWW14/(sumOfW1st14*sumOfW2nd14);
13356   if(TMath::Abs(denominator14)>0.) 
13357   { 
13358    // covariance:
13359    Double_t covariance14 = numerator14/denominator14;
13360    // weight dependent prefactor for covariance:
13361    Double_t wPrefactor14 = sumOfWW14/(sumOfW1st14*sumOfW2nd14);
13362    // finally, store "weighted" covariance:
13363    fIntFlowCovariancesNUA->SetBinContent(14,wPrefactor14*covariance14);
13364   } // end of if(TMath::Abs(denominator14)>0.) 
13365  } // end of if(TMath::Abs(sumOfW1st14*sumOfW2nd14)>0.) 
13366
13367  // Cov(<cos(phi1)>,<sin(phi1+phi2)>):
13368  Double_t product15 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(15); // <<cos(phi1)><sin(phi1+phi2)>> 
13369  Double_t term1st15 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13370  Double_t term2nd15 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13371  Double_t sumOfW1st15 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13372  Double_t sumOfW2nd15 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13373  Double_t sumOfWW15 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(15); // W_{<cos(phi1)>} * W_{<sin(phi1+phi2)>}
13374  // numerator in the expression for the the unbiased estimator for covariance:
13375  Double_t numerator15 = product15 - term1st15*term2nd15; 
13376  // denominator in the expression for the the unbiased estimator for covariance:
13377  Double_t denominator15 = 0.;
13378  if(TMath::Abs(sumOfW1st15*sumOfW2nd15)>0.) 
13379  {  
13380   denominator15 = 1.-sumOfWW15/(sumOfW1st15*sumOfW2nd15);
13381   if(TMath::Abs(denominator15)>0.) 
13382   { 
13383    // covariance:
13384    Double_t covariance15 = numerator15/denominator15;
13385    // weight dependent prefactor for covariance:
13386    Double_t wPrefactor15 = sumOfWW15/(sumOfW1st15*sumOfW2nd15);
13387    // finally, store "weighted" covariance:
13388    fIntFlowCovariancesNUA->SetBinContent(15,wPrefactor15*covariance15);
13389   } // end of if(TMath::Abs(denominator15)>0.)  
13390  } // end of if(TMath::Abs(sumOfW1st15*sumOfW2nd15)>0.)  
13391  
13392  // Cov(<cos(phi1)>,<cos(phi1-phi2-phi3)>):
13393  Double_t product16 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(16); // <<cos(phi1)><cos(phi1-phi2-phi3)>> 
13394  Double_t term1st16 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13395  Double_t term2nd16 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13396  Double_t sumOfW1st16 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13397  Double_t sumOfW2nd16 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13398  Double_t sumOfWW16 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(16); // W_{<cos(phi1)>} * W_{<cos(phi1-phi2-phi3)>}
13399  // numerator in the expression for the the unbiased estimator for covariance:
13400  Double_t numerator16 = product16 - term1st16*term2nd16; 
13401  // denominator in the expression for the the unbiased estimator for covariance:
13402  Double_t denominator16 = 0.;
13403  if(TMath::Abs(sumOfW1st16*sumOfW2nd16)>0.) 
13404  {   
13405   denominator16 = 1.-sumOfWW16/(sumOfW1st16*sumOfW2nd16);
13406   if(TMath::Abs(denominator16)>0.) 
13407   {   
13408    // covariance:
13409    Double_t covariance16 = numerator16/denominator16;
13410    // weight dependent prefactor for covariance:
13411    Double_t wPrefactor16 = sumOfWW16/(sumOfW1st16*sumOfW2nd16);
13412    // finally, store "weighted" covariance:
13413    fIntFlowCovariancesNUA->SetBinContent(16,wPrefactor16*covariance16);
13414   } // end of if(TMath::Abs(denominator16)>0.)
13415  } // end ofif(TMath::Abs(sumOfW1st16*sumOfW2nd16)>0.)  
13416  
13417  // Cov(<cos(phi1)>,<sin(phi1-phi2-phi3)>):
13418  Double_t product17 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(17); // <<cos(phi1)><sin(phi1-phi2-phi3)>> 
13419  Double_t term1st17 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(1); // <<cos(phi1)>>
13420  Double_t term2nd17 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13421  Double_t sumOfW1st17 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(1); // W_{<cos(phi1)>}
13422  Double_t sumOfW2nd17 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13423  Double_t sumOfWW17 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(17); // W_{<cos(phi1)>} * W_{<sin(phi1-phi2-phi3)>}
13424  // numerator in the expression for the the unbiased estimator for covariance:
13425  Double_t numerator17 = product17 - term1st17*term2nd17; 
13426  // denominator in the expression for the the unbiased estimator for covariance:
13427  Double_t denominator17 = 0.;
13428  if(TMath::Abs(sumOfW1st17*sumOfW2nd17)>0.) 
13429  {
13430   denominator17 = 1.-sumOfWW17/(sumOfW1st17*sumOfW2nd17);
13431   if(TMath::Abs(denominator17)>0.) 
13432   {   
13433    // covariance:
13434    Double_t covariance17 = numerator17/denominator17;
13435    // weight dependent prefactor for covariance:
13436    Double_t wPrefactor17 = sumOfWW17/(sumOfW1st17*sumOfW2nd17);
13437     // finally, store "weighted" covariance:
13438    fIntFlowCovariancesNUA->SetBinContent(17,wPrefactor17*covariance17);
13439   } // end of if(TMath::Abs(denominator17)>0.) 
13440  } // end of if(TMath::Abs(sumOfW1st17*sumOfW2nd17)>0.) 
13441
13442  // Cov(<sin(phi1)>,<cos(phi1+phi2)>):
13443  Double_t product18 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(18); // <<sin(phi1)><cos(phi1+phi2)>> 
13444  Double_t term1st18 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
13445  Double_t term2nd18 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13446  Double_t sumOfW1st18 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
13447  Double_t sumOfW2nd18 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13448  Double_t sumOfWW18 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(18); // W_{<sin(phi1)>} * W_{<cos(phi1+phi2)>}
13449  // numerator in the expression for the the unbiased estimator for covariance:
13450  Double_t numerator18 = product18 - term1st18*term2nd18; 
13451  // denominator in the expression for the the unbiased estimator for covariance:
13452  Double_t denominator18 = 0.;
13453  if(TMath::Abs(sumOfW1st18*sumOfW2nd18)>0.) 
13454  { 
13455   denominator18 = 1.-sumOfWW18/(sumOfW1st18*sumOfW2nd18);
13456   if(TMath::Abs(denominator18)>0.) 
13457   {   
13458    // covariance:
13459    Double_t covariance18 = numerator18/denominator18;
13460    // weight dependent prefactor for covariance:
13461    Double_t wPrefactor18 = sumOfWW18/(sumOfW1st18*sumOfW2nd18);
13462    // finally, store "weighted" covariance:
13463    fIntFlowCovariancesNUA->SetBinContent(18,wPrefactor18*covariance18); 
13464   } // end of if(TMath::Abs(denominator18)>0.) 
13465  } // end of if(TMath::Abs(sumOfW1st18*sumOfW2nd18)>0.) 
13466
13467  // Cov(<sin(phi1)>,<sin(phi1+phi2)>):
13468  Double_t product19 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(19); // <<sin(phi1)><sin(phi1+phi2)>> 
13469  Double_t term1st19 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
13470  Double_t term2nd19 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13471  Double_t sumOfW1st19 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
13472  Double_t sumOfW2nd19 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13473  Double_t sumOfWW19 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(19); // W_{<sin(phi1)>} * W_{<sin(phi1+phi2)>}
13474  // numerator in the expression for the the unbiased estimator for covariance:
13475  Double_t numerator19 = product19 - term1st19*term2nd19; 
13476  // denominator in the expression for the the unbiased estimator for covariance:
13477  Double_t denominator19 = 0.;
13478  if(TMath::Abs(sumOfW1st19*sumOfW2nd19)>0.) 
13479  { 
13480   denominator19 = 1.-sumOfWW19/(sumOfW1st19*sumOfW2nd19);
13481   if(TMath::Abs(denominator19)>0.) 
13482   {   
13483    // covariance:
13484    Double_t covariance19 = numerator19/denominator19;
13485    // weight dependent prefactor for covariance:
13486    Double_t wPrefactor19 = sumOfWW19/(sumOfW1st19*sumOfW2nd19);
13487    // finally, store "weighted" covariance:
13488    fIntFlowCovariancesNUA->SetBinContent(19,wPrefactor19*covariance19);
13489   } // end of if(TMath::Abs(denominator19)>0.)
13490  } // end of if(TMath::Abs(sumOfW1st19*sumOfW2nd19)>0.)
13491  
13492  // Cov(<sin(phi1)>,<cos(phi1-phi2-phi3)>):
13493  Double_t product20 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(20); // <<sin(phi1)><cos(phi1-phi2-phi3)>> 
13494  Double_t term1st20 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
13495  Double_t term2nd20 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13496  Double_t sumOfW1st20 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
13497  Double_t sumOfW2nd20 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13498  Double_t sumOfWW20 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(20); // W_{<sin(phi1)>} * W_{<cos(phi1-phi2-phi3)>}
13499  // numerator in the expression for the the unbiased estimator for covariance:
13500  Double_t numerator20 = product20 - term1st20*term2nd20; 
13501  // denominator in the expression for the the unbiased estimator for covariance:
13502  Double_t denominator20 = 0.;
13503  if(TMath::Abs(sumOfW1st20*sumOfW2nd20)>0.)
13504  { 
13505   denominator20 = 1.-sumOfWW20/(sumOfW1st20*sumOfW2nd20);
13506   if(TMath::Abs(denominator20)>0.) 
13507   { 
13508    // covariance:
13509    Double_t covariance20 = numerator20/denominator20;
13510    // weight dependent prefactor for covariance:
13511    Double_t wPrefactor20 = sumOfWW20/(sumOfW1st20*sumOfW2nd20);
13512    // finally, store "weighted" covariance:
13513    fIntFlowCovariancesNUA->SetBinContent(20,wPrefactor20*covariance20);
13514   } // end of if(TMath::Abs(denominator20)>0.) 
13515  } // end of if(TMath::Abs(sumOfW1st20*sumOfW2nd20)>0.)
13516
13517  // Cov(<sin(phi1)>,<sin(phi1-phi2-phi3)>):
13518  Double_t product21 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(21); // <<sin(phi1)><sin(phi1-phi2-phi3)>> 
13519  Double_t term1st21 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(1); // <<sin(phi1)>>
13520  Double_t term2nd21 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13521  Double_t sumOfW1st21 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(1); // W_{<sin(phi1)>}
13522  Double_t sumOfW2nd21 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13523  Double_t sumOfWW21 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(21); // W_{<sin(phi1)>} * W_{<sin(phi1-phi2-phi3)>}
13524  // numerator in the expression for the the unbiased estimator for covariance:
13525  Double_t numerator21 = product21 - term1st21*term2nd21; 
13526  // denominator in the expression for the the unbiased estimator for covariance:
13527  Double_t denominator21 = 0.;
13528  if(TMath::Abs(sumOfW1st21*sumOfW2nd21)>0.)
13529  { 
13530   denominator21 = 1.-sumOfWW21/(sumOfW1st21*sumOfW2nd21);
13531   if(TMath::Abs(denominator21)>0.) 
13532   {   
13533    // covariance:
13534    Double_t covariance21 = numerator21/denominator21;
13535    // weight dependent prefactor for covariance:
13536    Double_t wPrefactor21 = sumOfWW21/(sumOfW1st21*sumOfW2nd21);
13537    // finally, store "weighted" covariance:
13538    fIntFlowCovariancesNUA->SetBinContent(21,wPrefactor21*covariance21);
13539   } // end of if(TMath::Abs(denominator21)>0.)
13540  } // end of if(TMath::Abs(sumOfW1st21*sumOfW2nd21)>0.)
13541
13542  // Cov(<cos(phi1+phi2)>,<sin(phi1+phi2)>):
13543  Double_t product22 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(22); // <<cos(phi1+phi2)><sin(phi1+phi2)>> 
13544  Double_t term1st22 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13545  Double_t term2nd22 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13546  Double_t sumOfW1st22 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13547  Double_t sumOfW2nd22 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13548  Double_t sumOfWW22 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(22); // W_{<cos(phi1+phi2)>} * W_{<sin(phi1+phi2)>}
13549  // numerator in the expression for the the unbiased estimator for covariance:
13550  Double_t numerator22 = product22 - term1st22*term2nd22; 
13551  // denominator in the expression for the the unbiased estimator for covariance:
13552  Double_t denominator22 = 0.;
13553  if(TMath::Abs(sumOfW1st22*sumOfW2nd22)>0.)
13554  { 
13555   denominator22 = 1.-sumOfWW22/(sumOfW1st22*sumOfW2nd22);
13556   if(TMath::Abs(denominator22)>0.) 
13557   {   
13558    // covariance:
13559    Double_t covariance22 = numerator22/denominator22;
13560    // weight dependent prefactor for covariance:
13561    Double_t wPrefactor22 = sumOfWW22/(sumOfW1st22*sumOfW2nd22);
13562    // finally, store "weighted" covariance:
13563    fIntFlowCovariancesNUA->SetBinContent(22,wPrefactor22*covariance22);
13564   } // end of if(TMath::Abs(denominator22)>0.) 
13565  } // end of if(TMath::Abs(sumOfW1st22*sumOfW2nd22)>0.) 
13566
13567  // Cov(<cos(phi1+phi2)>,<cos(phi1-phi2-phi3)>):
13568  Double_t product23 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(23); // <<cos(phi1+phi2)><cos(phi1-phi2-phi3)>> 
13569  Double_t term1st23 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13570  Double_t term2nd23 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13571  Double_t sumOfW1st23 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13572  Double_t sumOfW2nd23 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13573  Double_t sumOfWW23 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(23); // W_{<cos(phi1+phi2)>} * W_{<cos(phi1-phi2-phi3)>}
13574  // numerator in the expression for the the unbiased estimator for covariance:
13575  Double_t numerator23 = product23 - term1st23*term2nd23; 
13576  // denominator in the expression for the the unbiased estimator for covariance:
13577  Double_t denominator23 = 0.;
13578  if(TMath::Abs(sumOfW1st23*sumOfW2nd23)>0.)
13579  {  
13580   denominator23 = 1.-sumOfWW23/(sumOfW1st23*sumOfW2nd23);
13581   if(TMath::Abs(denominator23)>0.) 
13582   {   
13583    // covariance:
13584    Double_t covariance23 = numerator23/denominator23;
13585    // weight dependent prefactor for covariance:
13586    Double_t wPrefactor23 = sumOfWW23/(sumOfW1st23*sumOfW2nd23);
13587    // finally, store "weighted" covariance:
13588    fIntFlowCovariancesNUA->SetBinContent(23,wPrefactor23*covariance23);
13589   } // end of if(TMath::Abs(denominator23)>0.) 
13590  } // end of if(TMath::Abs(sumOfW1st23*sumOfW2nd23)>0.)
13591  
13592  // Cov(<cos(phi1+phi2)>,<sin(phi1-phi2-phi3)>):
13593  Double_t product24 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(24); // <<cos(phi1+phi2)><sin(phi1-phi2-phi3)>> 
13594  Double_t term1st24 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(2); // <<cos(phi1+phi2)>>
13595  Double_t term2nd24 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13596  Double_t sumOfW1st24 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(2); // W_{<cos(phi1+phi2)>}
13597  Double_t sumOfW2nd24 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13598  Double_t sumOfWW24 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(24); // W_{<cos(phi1+phi2)>} * W_{<sin(phi1-phi2-phi3)>}
13599  // numerator in the expression for the the unbiased estimator for covariance:
13600  Double_t numerator24 = product24 - term1st24*term2nd24; 
13601  // denominator in the expression for the the unbiased estimator for covariance:
13602  Double_t denominator24 = 0.;
13603  if(TMath::Abs(sumOfW1st24*sumOfW2nd24)>0.)
13604  {   
13605   denominator24 = 1.-sumOfWW24/(sumOfW1st24*sumOfW2nd24);
13606   if(TMath::Abs(denominator24)>0.) 
13607   {   
13608    // covariance:
13609    Double_t covariance24 = numerator24/denominator24;
13610    // weight dependent prefactor for covariance:
13611    Double_t wPrefactor24 = sumOfWW24/(sumOfW1st24*sumOfW2nd24);
13612    // finally, store "weighted" covariance:
13613    fIntFlowCovariancesNUA->SetBinContent(24,wPrefactor24*covariance24);
13614   } // end of if(TMath::Abs(denominator24)>0.)  
13615  } // end of if(TMath::Abs(sumOfW1st24*sumOfW2nd24)>0.)
13616
13617  // Cov(<sin(phi1+phi2)>,<cos(phi1-phi2-phi3)>):
13618  Double_t product25 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(25); // <<sin(phi1+phi2)><cos(phi1-phi2-phi3)>> 
13619  Double_t term1st25 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13620  Double_t term2nd25 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13621  Double_t sumOfW1st25 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13622  Double_t sumOfW2nd25 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13623  Double_t sumOfWW25 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(25); // W_{<sin(phi1+phi2)>} * W_{<cos(phi1-phi2-phi3)>}
13624  // numerator in the expression for the the unbiased estimator for covariance:
13625  Double_t numerator25 = product25 - term1st25*term2nd25; 
13626  // denominator in the expression for the the unbiased estimator for covariance:
13627  Double_t denominator25 = 0.;
13628  if(TMath::Abs(sumOfW1st25*sumOfW2nd25)>0.)
13629  { 
13630   denominator25 = 1.-sumOfWW25/(sumOfW1st25*sumOfW2nd25);
13631   if(TMath::Abs(denominator25)>0.) 
13632   { 
13633    // covariance:
13634    Double_t covariance25 = numerator25/denominator25;
13635    // weight dependent prefactor for covariance:
13636    Double_t wPrefactor25 = sumOfWW25/(sumOfW1st25*sumOfW2nd25);
13637    // finally, store "weighted" covariance:
13638    fIntFlowCovariancesNUA->SetBinContent(25,wPrefactor25*covariance25);
13639   } // end of if(TMath::Abs(denominator25)>0.)
13640  } // end of if(TMath::Abs(sumOfW1st25*sumOfW2nd25)>0.)
13641  
13642  // Cov(<sin(phi1+phi2)>,<sin(phi1-phi2-phi3)>):
13643  Double_t product26 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(26); // <<sin(phi1+phi2)><sin(phi1-phi2-phi3)>> 
13644  Double_t term1st26 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(2); // <<sin(phi1+phi2)>>
13645  Double_t term2nd26 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13646  Double_t sumOfW1st26 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(2); // W_{<sin(phi1+phi2)>}
13647  Double_t sumOfW2nd26 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13648  Double_t sumOfWW26 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(26); // W_{<sin(phi1+phi2)>} * W_{<sin(phi1-phi2-phi3)>}
13649  // numerator in the expression for the the unbiased estimator for covariance:
13650  Double_t numerator26 = product26 - term1st26*term2nd26; 
13651  // denominator in the expression for the the unbiased estimator for covariance:
13652  Double_t denominator26 = 0.;
13653  if(TMath::Abs(sumOfW1st26*sumOfW2nd26)>0.)
13654  { 
13655   denominator26 = 1.-sumOfWW26/(sumOfW1st26*sumOfW2nd26);
13656   if(TMath::Abs(denominator26)>0.) 
13657   { 
13658    // covariance:
13659    Double_t covariance26 = numerator26/denominator26;
13660    // weight dependent prefactor for covariance:
13661    Double_t wPrefactor26 = sumOfWW26/(sumOfW1st26*sumOfW2nd26);
13662    // finally, store "weighted" covariance:
13663    fIntFlowCovariancesNUA->SetBinContent(26,wPrefactor26*covariance26);
13664   } // end of if(TMath::Abs(denominator26)>0.) 
13665  } // end of if(TMath::Abs(sumOfW1st26*sumOfW2nd26)>0.)
13666  
13667  // Cov(<cos(phi1-phi2-phi3)>,<sin(phi1-phi2-phi3)>):
13668  Double_t product27 = fIntFlowProductOfCorrectionTermsForNUAPro->GetBinContent(27); // <<cos(phi1-phi2-phi3)><sin(phi1-phi2-phi3)>> 
13669  Double_t term1st27 = fIntFlowCorrectionTermsForNUAPro[1]->GetBinContent(3); // <<cos(phi1-phi2-phi3)>>
13670  Double_t term2nd27 = fIntFlowCorrectionTermsForNUAPro[0]->GetBinContent(3); // <<sin(phi1-phi2-phi3)>>
13671  Double_t sumOfW1st27 = fIntFlowSumOfEventWeightsNUA[1][0]->GetBinContent(3); // W_{<cos(phi1-phi2-phi3)>}
13672  Double_t sumOfW2nd27 = fIntFlowSumOfEventWeightsNUA[0][0]->GetBinContent(3); // W_{<sin(phi1-phi2-phi3)>}
13673  Double_t sumOfWW27 = fIntFlowSumOfProductOfEventWeightsNUA->GetBinContent(27); // W_{<cos(phi1-phi2-phi3)>} * W_{<sin(phi1-phi2-phi3)>}
13674  // numerator in the expression for the the unbiased estimator for covariance:
13675  Double_t numerator27 = product27 - term1st27*term2nd27; 
13676  // denominator in the expression for the the unbiased estimator for covariance:
13677  Double_t denominator27 = 0.;
13678  if(TMath::Abs(sumOfW1st27*sumOfW2nd27)>0.)
13679  { 
13680   denominator27 = 1.-sumOfWW27/(sumOfW1st27*sumOfW2nd27);
13681   if(TMath::Abs(denominator27)>0.) 
13682   { 
13683    // covariance:
13684    Double_t covariance27 = numerator27/denominator27;
13685    // weight dependent prefactor for covariance:
13686    Double_t wPrefactor27 = sumOfWW27/(sumOfW1st27*sumOfW2nd27);
13687    // finally, store "weighted" covariance:
13688    fIntFlowCovariancesNUA->SetBinContent(27,wPrefactor27*covariance27);
13689   } // end of if(TMath::Abs(denominator27)>0.) 
13690  } // end of if(TMath::Abs(sumOfW1st27*sumOfW2nd27)>0.)
13691  
13692 } // end of AliFlowAnalysisWithQCumulants::CalculateCovariancesNUAIntFlow()
13693
13694 //=======================================================================================================================
13695
13696 void AliFlowAnalysisWithQCumulants::FinalizeCorrelationsIntFlow() 
13697 {
13698  // From profile fIntFlowCorrelationsPro access measured correlations and spread, 
13699  // correctly calculate the statistical errors and store the final results and 
13700  // statistical errors for correlations in histogram fIntFlowCorrelationsHist.
13701  //
13702  // Remark: Statistical error of correlation is calculated as:
13703  //
13704  //          statistical error = termA * spread * termB:
13705  //          termA = sqrt{sum_{i=1}^{N} w^2}/(sum_{i=1}^{N} w)
13706  //          termB = 1/sqrt(1-termA^2)   
13707  //
13708    
13709  for(Int_t ci=1;ci<=4;ci++) // correlation index
13710  {
13711   if(fIntFlowCorrelationsPro->GetBinEffectiveEntries(ci) < 2 || fIntFlowSquaredCorrelationsPro->GetBinEffectiveEntries(ci) < 2)
13712   {
13713    fIntFlowCorrelationsPro->SetBinError(ci,0.);
13714    fIntFlowSquaredCorrelationsPro->SetBinError(ci,0.);
13715    continue;
13716   } 
13717   Double_t correlation = fIntFlowCorrelationsPro->GetBinContent(ci);
13718   Double_t squaredCorrelation = fIntFlowSquaredCorrelationsPro->GetBinContent(ci);
13719   Double_t spread = 0.;
13720   if(squaredCorrelation-correlation*correlation >= 0.)
13721   {
13722    spread = pow(squaredCorrelation-correlation*correlation,0.5);
13723   } else
13724     {
13725      cout<<endl;
13726      cout<<Form(" WARNING: Imaginary 'spread' for %d-particle correlation!!!! ",2*ci)<<endl;
13727      cout<<endl;
13728     }
13729   Double_t sumOfLinearEventWeights = fIntFlowSumOfEventWeights[0]->GetBinContent(ci);
13730   Double_t sumOfQuadraticEventWeights = fIntFlowSumOfEventWeights[1]->GetBinContent(ci);
13731   Double_t termA = 0.;
13732   Double_t termB = 0.;
13733   if(TMath::Abs(sumOfLinearEventWeights) > 0.) // to be improved - shall I omitt here Abs() ?
13734   {
13735    termA = pow(sumOfQuadraticEventWeights,0.5)/sumOfLinearEventWeights;
13736   } else
13737     {
13738      cout<<endl;
13739      cout<<" WARNING (QC): sumOfLinearEventWeights == 0 in method FinalizeCorrelationsIntFlow() !!!!"<<endl;
13740      cout<<"               (for "<<2*ci<<"-particle correlation)"<<endl;
13741      cout<<endl;
13742     }
13743   if(1.-pow(termA,2.) > 0.)
13744   {
13745    termB = 1./pow(1-pow(termA,2.),0.5);
13746   } else
13747     {
13748      cout<<endl;
13749      cout<<" WARNING (QC): 1.-pow(termA,2.) <= 0 in method FinalizeCorrelationsIntFlow() !!!!"<<endl;   
13750      cout<<"               (for "<<2*ci<<"-particle correlation)"<<endl;
13751      cout<<endl;
13752     }     
13753   Double_t statisticalError = termA * spread * termB;
13754   fIntFlowCorrelationsHist->SetBinContent(ci,correlation);
13755   fIntFlowCorrelationsHist->SetBinError(ci,statisticalError);
13756  } // end of for(Int_t ci=1;ci<=4;ci++) // correlation index     
13757  
13758  // Versus multiplicity: 
13759  if(!fCalculateCumulantsVsM){return;}
13760  for(Int_t ci=0;ci<=3;ci++) // correlation index
13761  {
13762   Int_t nBins = fIntFlowCorrelationsVsMPro[ci]->GetNbinsX(); 
13763   for(Int_t b=1;b<=nBins;b++) // looping over multiplicity bins
13764   {
13765    if(fIntFlowCorrelationsVsMPro[ci]->GetBinEffectiveEntries(b) < 2 || fIntFlowSquaredCorrelationsVsMPro[ci]->GetBinEffectiveEntries(b) < 2)
13766    {
13767     fIntFlowCorrelationsVsMPro[ci]->SetBinError(b,0.);
13768     fIntFlowSquaredCorrelationsVsMPro[ci]->SetBinError(b,0.);
13769     continue;
13770    } 
13771    Double_t correlationVsM = fIntFlowCorrelationsVsMPro[ci]->GetBinContent(b);
13772    Double_t squaredCorrelationVsM = fIntFlowSquaredCorrelationsVsMPro[ci]->GetBinContent(b);
13773    Double_t spreadVsM = 0.;
13774    if(squaredCorrelationVsM-correlationVsM*correlationVsM >= 0.)
13775    {
13776     spreadVsM = pow(squaredCorrelationVsM-correlationVsM*correlationVsM,0.5);
13777    } else
13778      {
13779       cout<<endl;
13780       cout<<Form(" WARNING (QC): Imaginary 'spreadVsM' for ci = %d, bin = %d, entries = %f !!!!",
13781                  ci,b,fIntFlowCorrelationsVsMPro[ci]->GetBinEffectiveEntries(b))<<endl; 
13782       cout<<endl;
13783      }     
13784    Double_t sumOfLinearEventWeightsVsM = fIntFlowSumOfEventWeightsVsM[ci][0]->GetBinContent(b);
13785    Double_t sumOfQuadraticEventWeightsVsM = fIntFlowSumOfEventWeightsVsM[ci][1]->GetBinContent(b);
13786    Double_t termAVsM = 0.;
13787    Double_t termBVsM = 0.;
13788    if(sumOfLinearEventWeightsVsM > 0.) 
13789    {
13790     termAVsM = pow(sumOfQuadraticEventWeightsVsM,0.5)/sumOfLinearEventWeightsVsM;
13791    }
13792    if(1.-pow(termAVsM,2.) > 0.)
13793    {
13794     termBVsM = 1./pow(1-pow(termAVsM,2.),0.5);
13795    }     
13796    Double_t statisticalErrorVsM = termAVsM * spreadVsM * termBVsM;
13797    fIntFlowCorrelationsVsMHist[ci]->SetBinContent(b,correlationVsM);
13798    fIntFlowCorrelationsVsMHist[ci]->SetBinError(b,statisticalErrorVsM);  
13799   } // end of for(Int_t b=1;b<=nBins;b++)
13800  } // end of for(Int_t ci=1;ci<=4;ci++) // correlation index                                                        
13801                                                                                                                            
13802 } // end of AliFlowAnalysisWithQCumulants::FinalizeCorrelationsIntFlow()
13803
13804 //=======================================================================================================================
13805
13806 void AliFlowAnalysisWithQCumulants::FillAverageMultiplicities(Int_t nRP)
13807 {
13808  // Fill profile fAverageMultiplicity to hold average multiplicities and 
13809  // number of events for events with nRP>=0, nRP>=1, ... , and nRP>=8
13810  
13811  // Binning of fAverageMultiplicity is organized as follows:
13812  //  1st bin: all events (including the empty ones)
13813  //  2nd bin: event with # of RPs greater or equal to 1
13814  //  3rd bin: event with # of RPs greater or equal to 2
13815  //  4th bin: event with # of RPs greater or equal to 3
13816  //  5th bin: event with # of RPs greater or equal to 4
13817  //  6th bin: event with # of RPs greater or equal to 5
13818  //  7th bin: event with # of RPs greater or equal to 6
13819  //  8th bin: event with # of RPs greater or equal to 7
13820  //  9th bin: event with # of RPs greater or equal to 8
13821  
13822  if(nRP<0)
13823  {
13824   cout<<endl;
13825   cout<<" WARNING (QC): nRP<0 in in AFAWQC::FAM() !!!!"<<endl;
13826   cout<<endl;
13827   exit(0);
13828  }
13829  
13830  for(Int_t i=0;i<9;i++)
13831  {
13832   if(nRP>=i){fAvMultiplicity->Fill(i+0.5,nRP,1);}
13833  }
13834  
13835 } // end of AliFlowAnalysisWithQCumulants::FillAverageMultiplicities(nRP)
13836
13837 //=======================================================================================================================
13838
13839 void AliFlowAnalysisWithQCumulants::CalculateCumulantsIntFlow()
13840
13841  // a) Calculate Q-cumulants from the measured multiparticle correlations;
13842  // b) Propagate the statistical errors from measured multiparticle correlations to statistical errors of Q-cumulants;  
13843  // c) Remark: Q-cumulants calculated in this method are biased by non-uniform acceptance of detector !!!! 
13844  //            Method CalculateQcumulantsCorrectedForNUAIntFlow() is called afterwards to correct for this bias;
13845  // d) Store the results and statistical error of Q-cumulants in histogram fIntFlowQcumulants.
13846  //    Binning of fIntFlowQcumulants is organized as follows:
13847  //
13848  //            1st bin: QC{2}
13849  //            2nd bin: QC{4}
13850  //            3rd bin: QC{6}
13851  //            4th bin: QC{8}
13852  //
13853  
13854  // Correlations:
13855  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>> 
13856  Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>>  
13857  Double_t six = fIntFlowCorrelationsHist->GetBinContent(3); // <<6>> 
13858  Double_t eight = fIntFlowCorrelationsHist->GetBinContent(4); // <<8>>  
13859  // Statistical errors of average 2-, 4-, 6- and 8-particle azimuthal correlations:
13860  Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1); // statistical error of <2>  
13861  Double_t fourError = fIntFlowCorrelationsHist->GetBinError(2); // statistical error of <4>   
13862  Double_t sixError = fIntFlowCorrelationsHist->GetBinError(3); // statistical error of <6> 
13863  Double_t eightError = fIntFlowCorrelationsHist->GetBinError(4); // statistical error of <8> 
13864  // Covariances (multiplied by prefactor depending on weights - see comments in CalculateCovariancesIntFlow()):
13865  Double_t wCov24 = 0.; // Cov(<2>,<4>) * prefactor(w_<2>,w_<4>)
13866  Double_t wCov26 = 0.; // Cov(<2>,<6>) * prefactor(w_<2>,w_<6>)
13867  Double_t wCov28 = 0.; // Cov(<2>,<8>) * prefactor(w_<2>,w_<8>)
13868  Double_t wCov46 = 0.; // Cov(<4>,<6>) * prefactor(w_<4>,w_<6>)
13869  Double_t wCov48 = 0.; // Cov(<4>,<8>) * prefactor(w_<4>,w_<8>)
13870  Double_t wCov68 = 0.; // Cov(<6>,<8>) * prefactor(w_<6>,w_<8>)  
13871  if(!fForgetAboutCovariances)
13872  {
13873   wCov24 = fIntFlowCovariances->GetBinContent(1); // Cov(<2>,<4>) * prefactor(w_<2>,w_<4>)
13874   wCov26 = fIntFlowCovariances->GetBinContent(2); // Cov(<2>,<6>) * prefactor(w_<2>,w_<6>)
13875   wCov28 = fIntFlowCovariances->GetBinContent(3); // Cov(<2>,<8>) * prefactor(w_<2>,w_<8>)
13876   wCov46 = fIntFlowCovariances->GetBinContent(4); // Cov(<4>,<6>) * prefactor(w_<4>,w_<6>)
13877   wCov48 = fIntFlowCovariances->GetBinContent(5); // Cov(<4>,<8>) * prefactor(w_<4>,w_<8>)
13878   wCov68 = fIntFlowCovariances->GetBinContent(6); // Cov(<6>,<8>) * prefactor(w_<6>,w_<8>) 
13879  }
13880  // Q-cumulants: 
13881  Double_t qc2 = 0.; // QC{2}
13882  Double_t qc4 = 0.; // QC{4}
13883  Double_t qc6 = 0.; // QC{6}
13884  Double_t qc8 = 0.; // QC{8}
13885  if(TMath::Abs(two) > 0.){qc2 = two;} 
13886  if(TMath::Abs(four) > 0.){qc4 = four-2.*pow(two,2.);} 
13887  if(TMath::Abs(six) > 0.){qc6 = six-9.*two*four+12.*pow(two,3.);} 
13888  if(TMath::Abs(eight) > 0.){qc8 = eight-16.*two*six-18.*pow(four,2.)+144.*pow(two,2.)*four-144.*pow(two,4.);} 
13889  // Statistical errors of Q-cumulants:       
13890  Double_t qc2Error = 0.;
13891  Double_t qc4Error = 0.;
13892  Double_t qc6Error = 0.;
13893  Double_t qc8Error = 0.; 
13894  // Squared statistical errors of Q-cumulants:       
13895  //Double_t qc2ErrorSquared = 0.;
13896  Double_t qc4ErrorSquared = 0.;
13897  Double_t qc6ErrorSquared = 0.;
13898  Double_t qc8ErrorSquared = 0.;        
13899  // Statistical error of QC{2}:              
13900  qc2Error = twoError;                                                 
13901  // Statistical error of QC{4}:              
13902  qc4ErrorSquared = 16.*pow(two,2.)*pow(twoError,2)+pow(fourError,2.)
13903                  - 8.*two*wCov24;                     
13904  if(qc4ErrorSquared>0.)
13905  {
13906   qc4Error = pow(qc4ErrorSquared,0.5);
13907  } else 
13908    {
13909     cout<<" WARNING (QC): Statistical error of QC{4} is imaginary !!!!"<<endl;
13910    }                                           
13911  // Statistical error of QC{6}:              
13912  qc6ErrorSquared = 81.*pow(4.*pow(two,2.)-four,2.)*pow(twoError,2.)
13913                  + 81.*pow(two,2.)*pow(fourError,2.)
13914                  + pow(sixError,2.)
13915                  - 162.*two*(4.*pow(two,2.)-four)*wCov24
13916                  + 18.*(4.*pow(two,2.)-four)*wCov26
13917                  - 18.*two*wCov46;                     
13918  if(qc6ErrorSquared>0.)
13919  {
13920   qc6Error = pow(qc6ErrorSquared,0.5);
13921  } else 
13922    {
13923     cout<<" WARNING (QC): Statistical error of QC{6} is imaginary !!!!"<<endl;
13924    }                       
13925  // Statistical error of QC{8}:              
13926  qc8ErrorSquared = 256.*pow(36.*pow(two,3.)-18.*four*two+six,2.)*pow(twoError,2.)
13927                  + 1296.*pow(4.*pow(two,2.)-four,2.)*pow(fourError,2.)
13928                  + 256.*pow(two,2.)*pow(sixError,2.)
13929                  + pow(eightError,2.)
13930                  - 1152.*(36.*pow(two,3.)-18.*four*two+six)*(4.*pow(two,2.)-four)*wCov24
13931                  + 512.*two*(36.*pow(two,3.)-18.*four*two+six)*wCov26
13932                  - 32.*(36.*pow(two,3.)-18.*four*two+six)*wCov28
13933                  - 1152.*two*(4.*pow(two,2.)-four)*wCov46
13934                  + 72.*(4.*pow(two,2.)-four)*wCov48
13935                  - 32.*two*wCov68;      
13936  if(qc8ErrorSquared>0.)
13937  {
13938   qc8Error = pow(qc8ErrorSquared,0.5);
13939  } else 
13940    {
13941     cout<<"WARNING (QC): Statistical error of QC{8} is imaginary !!!!"<<endl;
13942    }
13943  // Store the results and statistical errors for Q-cumulants:
13944  if(TMath::Abs(qc2)>0.)
13945  {
13946   fIntFlowQcumulants->SetBinContent(1,qc2);
13947   fIntFlowQcumulants->SetBinError(1,qc2Error);
13948  }
13949  if(TMath::Abs(qc4)>0.)
13950  {
13951   fIntFlowQcumulants->SetBinContent(2,qc4);
13952   fIntFlowQcumulants->SetBinError(2,qc4Error);
13953  }
13954  if(TMath::Abs(qc6)>0.)
13955  {
13956   fIntFlowQcumulants->SetBinContent(3,qc6);
13957   fIntFlowQcumulants->SetBinError(3,qc6Error);
13958  }
13959  if(TMath::Abs(qc8)>0.)
13960  {
13961   fIntFlowQcumulants->SetBinContent(4,qc8); 
13962   fIntFlowQcumulants->SetBinError(4,qc8Error);
13963  } 
13964  
13965  // Versus multiplicity: 
13966  if(!fCalculateCumulantsVsM){return;}
13967  Int_t nBins = fIntFlowCorrelationsVsMPro[0]->GetNbinsX(); // to be improved (hardwired 0) 
13968  Double_t value[4] = {0.}; // QCs vs M
13969  Double_t error[4] = {0.}; // error of QCs vs M
13970  Double_t dSum1[4] = {0.}; // sum value_i/(error_i)^2
13971  Double_t dSum2[4] = {0.}; // sum 1/(error_i)^2
13972  for(Int_t b=1;b<=nBins;b++)
13973  {
13974   // Correlations:
13975   two = fIntFlowCorrelationsVsMHist[0]->GetBinContent(b); // <<2>> 
13976   four = fIntFlowCorrelationsVsMHist[1]->GetBinContent(b); // <<4>>  
13977   six = fIntFlowCorrelationsVsMHist[2]->GetBinContent(b); // <<6>> 
13978   eight = fIntFlowCorrelationsVsMHist[3]->GetBinContent(b); // <<8>>  
13979   // Statistical errors of average 2-, 4-, 6- and 8-particle azimuthal correlations:
13980   twoError = fIntFlowCorrelationsVsMHist[0]->GetBinError(b); // statistical error of <2>  
13981   fourError = fIntFlowCorrelationsVsMHist[1]->GetBinError(b); // statistical error of <4>   
13982   sixError = fIntFlowCorrelationsVsMHist[2]->GetBinError(b); // statistical error of <6> 
13983   eightError = fIntFlowCorrelationsVsMHist[3]->GetBinError(b); // statistical error of <8> 
13984   // Covariances (multiplied by prefactor depending on weights - see comments in CalculateCovariancesIntFlow()):
13985   if(!fForgetAboutCovariances)
13986   {
13987    wCov24 = fIntFlowCovariancesVsM[0]->GetBinContent(b); // Cov(<2>,<4>) * prefactor(w_<2>,w_<4>)
13988    wCov26 = fIntFlowCovariancesVsM[1]->GetBinContent(b); // Cov(<2>,<6>) * prefactor(w_<2>,w_<6>)
13989    wCov28 = fIntFlowCovariancesVsM[2]->GetBinContent(b); // Cov(<2>,<8>) * prefactor(w_<2>,w_<8>)
13990    wCov46 = fIntFlowCovariancesVsM[3]->GetBinContent(b); // Cov(<4>,<6>) * prefactor(w_<4>,w_<6>)
13991    wCov48 = fIntFlowCovariancesVsM[4]->GetBinContent(b); // Cov(<4>,<8>) * prefactor(w_<4>,w_<8>)
13992    wCov68 = fIntFlowCovariancesVsM[5]->GetBinContent(b); // Cov(<6>,<8>) * prefactor(w_<6>,w_<8>) 
13993   }
13994   // Q-cumulants: 
13995   qc2 = 0.; // QC{2}
13996   qc4 = 0.; // QC{4}
13997   qc6 = 0.; // QC{6}
13998   qc8 = 0.; // QC{8}
13999   if(TMath::Abs(two) > 0.){qc2 = two;} 
14000   if(TMath::Abs(four) > 0.){qc4 = four-2.*pow(two,2.);} 
14001   if(TMath::Abs(six) > 0.){qc6 = six-9.*two*four+12.*pow(two,3.);} 
14002   if(TMath::Abs(eight) > 0.){qc8 = eight-16.*two*six-18.*pow(four,2.)+144.*pow(two,2.)*four-144.*pow(two,4.);}  
14003   // Statistical errors of Q-cumulants:       
14004   qc2Error = 0.;
14005   qc4Error = 0.;
14006   qc6Error = 0.;
14007   qc8Error = 0.; 
14008   // Squared statistical errors of Q-cumulants:       
14009   //Double_t qc2ErrorSquared = 0.;
14010   qc4ErrorSquared = 0.;
14011   qc6ErrorSquared = 0.;
14012   qc8ErrorSquared = 0.;    
14013   // Statistical error of QC{2}:              
14014   qc2Error = twoError;                                             
14015   // Statistical error of QC{4}:              
14016   qc4ErrorSquared = 16.*pow(two,2.)*pow(twoError,2)+pow(fourError,2.)
14017                   - 8.*two*wCov24;                     
14018   if(qc4ErrorSquared>0.)
14019   {
14020    qc4Error = pow(qc4ErrorSquared,0.5);
14021   } else 
14022     {
14023      // cout<<"WARNING: Statistical error of QC{4} is imaginary in multiplicity bin "<<b<<" !!!!"<<endl;
14024     }                                       
14025   // Statistical error of QC{6}:              
14026   qc6ErrorSquared = 81.*pow(4.*pow(two,2.)-four,2.)*pow(twoError,2.)
14027                   + 81.*pow(two,2.)*pow(fourError,2.)
14028                   + pow(sixError,2.)
14029                   - 162.*two*(4.*pow(two,2.)-four)*wCov24
14030                   + 18.*(4.*pow(two,2.)-four)*wCov26
14031                   - 18.*two*wCov46;                     
14032   if(qc6ErrorSquared>0.)
14033   {
14034    qc6Error = pow(qc6ErrorSquared,0.5);
14035   } else 
14036     {
14037      // cout<<"WARNING: Statistical error of QC{6} is imaginary in multiplicity bin "<<b<<" !!!!"<<endl;
14038     }                            
14039   // Statistical error of QC{8}:              
14040   qc8ErrorSquared = 256.*pow(36.*pow(two,3.)-18.*four*two+six,2.)*pow(twoError,2.)
14041                   + 1296.*pow(4.*pow(two,2.)-four,2.)*pow(fourError,2.)
14042                   + 256.*pow(two,2.)*pow(sixError,2.)
14043                   + pow(eightError,2.)
14044                   - 1152.*(36.*pow(two,3.)-18.*four*two+six)*(4.*pow(two,2.)-four)*wCov24
14045                   + 512.*two*(36.*pow(two,3.)-18.*four*two+six)*wCov26
14046                   - 32.*(36.*pow(two,3.)-18.*four*two+six)*wCov28
14047                   - 1152.*two*(4.*pow(two,2.)-four)*wCov46
14048                   + 72.*(4.*pow(two,2.)-four)*wCov48
14049                   - 32.*two*wCov68;      
14050   if(qc8ErrorSquared>0.)
14051   {
14052    qc8Error = pow(qc8ErrorSquared,0.5);
14053   } else 
14054     {
14055      // cout<<"WARNING: Statistical error of QC{8} is imaginary in multiplicity bin "<<b<<" !!!!"<<endl;
14056     }
14057   // Store the results and statistical errors for Q-cumulants:
14058   if(TMath::Abs(qc2)>0.)
14059   {
14060    fIntFlowQcumulantsVsM[0]->SetBinContent(b,qc2);
14061    fIntFlowQcumulantsVsM[0]->SetBinError(b,qc2Error);  
14062   }
14063   if(TMath::Abs(qc4)>0.)
14064   {
14065    fIntFlowQcumulantsVsM[1]->SetBinContent(b,qc4);  
14066    fIntFlowQcumulantsVsM[1]->SetBinError(b,qc4Error);
14067   }
14068   if(TMath::Abs(qc6)>0.)
14069   {
14070    fIntFlowQcumulantsVsM[2]->SetBinContent(b,qc6); 
14071    fIntFlowQcumulantsVsM[2]->SetBinError(b,qc6Error);
14072   }
14073   if(TMath::Abs(qc8)>0.)
14074   {  
14075    fIntFlowQcumulantsVsM[3]->SetBinContent(b,qc8);
14076    fIntFlowQcumulantsVsM[3]->SetBinError(b,qc8Error);
14077   } 
14078   // Rebin in M:
14079   for(Int_t co=0;co<4;co++)
14080   {
14081    if(fIntFlowCorrelationsVsMPro[co]->GetBinEffectiveEntries(b)<2){continue;}
14082    value[co] = fIntFlowQcumulantsVsM[co]->GetBinContent(b);
14083    error[co] = fIntFlowQcumulantsVsM[co]->GetBinError(b);
14084    if(error[co]>0.)
14085    {
14086     dSum1[co]+=value[co]/(error[co]*error[co]);
14087     dSum2[co]+=1./(error[co]*error[co]);
14088    }
14089   } // end of for(Int_t co=0;co<4;co++) 
14090  } // end of for(Int_t b=1;b<=nBins;b++)
14091  // Store rebinned Q-cumulants:
14092  for(Int_t co=0;co<4;co++)
14093  {
14094   if(dSum2[co]>0.)
14095   {
14096    fIntFlowQcumulantsRebinnedInM->SetBinContent(co+1,dSum1[co]/dSum2[co]);
14097    fIntFlowQcumulantsRebinnedInM->SetBinError(co+1,pow(1./dSum2[co],0.5));
14098   }
14099  } // end of for(Int_t co=0;co<4;co++)
14100  
14101 } // end of AliFlowAnalysisWithQCumulants::CalculateCumulantsIntFlow()
14102
14103 //================================================================================================================================ 
14104
14105 void AliFlowAnalysisWithQCumulants::CalculateReferenceFlow()
14106 {
14107  // a) Calculate the final results for reference flow estimates from Q-cumulants;
14108  // b) Propagate the statistical errors to reference flow estimates from statistical error of Q-cumulants; 
14109  // c) Store the results and statistical errors of reference flow estimates in histogram fIntFlow.
14110  //    Binning of fIntFlow is organized as follows:
14111  //
14112  //            1st bin: v{2,QC}
14113  //            2nd bin: v{4,QC}
14114  //            3rd bin: v{6,QC}
14115  //            4th bin: v{8,QC}
14116  //
14117  
14118  // Reference flow estimates:
14119  Double_t v2 = 0.; // v{2,QC}  
14120  Double_t v4 = 0.; // v{4,QC}  
14121  Double_t v6 = 0.; // v{6,QC}  
14122  Double_t v8 = 0.; // v{8,QC}
14123  // Reference flow's statistical errors:
14124  Double_t v2Error = 0.; // v{2,QC} stat. error 
14125  Double_t v4Error = 0.; // v{4,QC} stat. error
14126  Double_t v6Error = 0.; // v{6,QC} stat. error
14127  Double_t v8Error = 0.; // v{8,QC} stat. error
14128   
14129  // Q-cumulants:
14130  Double_t qc2 = fIntFlowQcumulants->GetBinContent(1); // QC{2}  
14131  Double_t qc4 = fIntFlowQcumulants->GetBinContent(2); // QC{4}  
14132  Double_t qc6 = fIntFlowQcumulants->GetBinContent(3); // QC{6}  
14133  Double_t qc8 = fIntFlowQcumulants->GetBinContent(4); // QC{8}
14134  // Q-cumulants's statistical errors: 
14135  Double_t qc2Error = fIntFlowQcumulants->GetBinError(1); // QC{2} stat. error  
14136  Double_t qc4Error = fIntFlowQcumulants->GetBinError(2); // QC{4} stat. error  
14137  Double_t qc6Error = fIntFlowQcumulants->GetBinError(3); // QC{6} stat. error  
14138  Double_t qc8Error = fIntFlowQcumulants->GetBinError(4); // QC{8} stat. error
14139  // Calculate reference flow estimates from Q-cumulants: 
14140  if(qc2>=0.){v2 = pow(qc2,0.5);} 
14141  if(qc4<=0.){v4 = pow(-1.*qc4,1./4.);} 
14142  if(qc6>=0.){v6 = pow((1./4.)*qc6,1./6.);}
14143  if(qc8<=0.){v8 = pow((-1./33.)*qc8,1./8.);}  
14144  // Calculate stat. error for reference flow estimates from stat. error of Q-cumulants:  
14145  if(qc2>0.){v2Error = (1./2.)*pow(qc2,-0.5)*qc2Error;} 
14146  if(qc4<0.){v4Error = (1./4.)*pow(-qc4,-3./4.)*qc4Error;} 
14147  if(qc6>0.){v6Error = (1./6.)*pow(2.,-1./3.)*pow(qc6,-5./6.)*qc6Error;}   
14148  if(qc8<0.){v8Error = (1./8.)*pow(33.,-1./8.)*pow(-qc8,-7./8.)*qc8Error;}   
14149  // Print warnings for the 'wrong sign' cumulants: 
14150  if(TMath::Abs(v2) < 1.e-44)
14151  {
14152   cout<<" WARNING: Wrong sign QC{2}, couldn't calculate v{2,QC} !!!!"<<endl;
14153  }
14154  if(TMath::Abs(v4) < 1.e-44)
14155  {
14156   cout<<" WARNING: Wrong sign QC{4}, couldn't calculate v{4,QC} !!!!"<<endl;
14157  } 
14158  if(TMath::Abs(v6) < 1.e-44)
14159  {
14160   cout<<" WARNING: Wrong sign QC{6}, couldn't calculate v{6,QC} !!!!"<<endl; 
14161  }
14162  if(TMath::Abs(v8) < 1.e-44)
14163  {
14164   cout<<" WARNING: Wrong sign QC{8}, couldn't calculate v{8,QC} !!!!"<<endl;
14165  }                       
14166  // Store the results and statistical errors of integrated flow estimates:
14167  fIntFlow->SetBinContent(1,v2);
14168  fIntFlow->SetBinError(1,v2Error);
14169  fIntFlow->SetBinContent(2,v4);
14170  fIntFlow->SetBinError(2,v4Error);
14171  fIntFlow->SetBinContent(3,v6);
14172  fIntFlow->SetBinError(3,v6Error);
14173  fIntFlow->SetBinContent(4,v8);
14174  fIntFlow->SetBinError(4,v8Error);  
14175   
14176  // Versus multiplicity: 
14177  if(!fCalculateCumulantsVsM){return;} 
14178  Int_t nBins = fIntFlowCorrelationsVsMPro[0]->GetNbinsX(); // to be improved (hardwired 0) 
14179  for(Int_t b=1;b<=nBins;b++)
14180  {
14181   // Q-cumulants:
14182   Double_t qc2VsM = fIntFlowQcumulantsVsM[0]->GetBinContent(b); // QC{2}  
14183   Double_t qc4VsM = fIntFlowQcumulantsVsM[1]->GetBinContent(b); // QC{4}  
14184   Double_t qc6VsM = fIntFlowQcumulantsVsM[2]->GetBinContent(b); // QC{6}  
14185   Double_t qc8VsM = fIntFlowQcumulantsVsM[3]->GetBinContent(b); // QC{8}
14186   // Q-cumulants's statistical errors: 
14187   Double_t qc2ErrorVsM = fIntFlowQcumulantsVsM[0]->GetBinError(b); // QC{2} stat. error  
14188   Double_t qc4ErrorVsM = fIntFlowQcumulantsVsM[1]->GetBinError(b); // QC{4} stat. error  
14189   Double_t qc6ErrorVsM = fIntFlowQcumulantsVsM[2]->GetBinError(b); // QC{6} stat. error  
14190   Double_t qc8ErrorVsM = fIntFlowQcumulantsVsM[3]->GetBinError(b); // QC{8} stat. error
14191   // Reference flow estimates:
14192   Double_t v2VsM = 0.; // v{2,QC}  
14193   Double_t v4VsM = 0.; // v{4,QC}  
14194   Double_t v6VsM = 0.; // v{6,QC}  
14195   Double_t v8VsM = 0.; // v{8,QC}
14196   // Reference flow estimates errors:
14197   Double_t v2ErrorVsM = 0.; // v{2,QC} stat. error  
14198   Double_t v4ErrorVsM = 0.; // v{4,QC} stat. error
14199   Double_t v6ErrorVsM = 0.; // v{6,QC} stat. error  
14200   Double_t v8ErrorVsM = 0.; // v{8,QC} stat. error
14201   // Calculate reference flow estimates from Q-cumulants: 
14202   if(qc2VsM>=0.){v2VsM = pow(qc2VsM,0.5);} 
14203   if(qc4VsM<=0.){v4VsM = pow(-1.*qc4VsM,1./4.);} 
14204   if(qc6VsM>=0.){v6VsM = pow((1./4.)*qc6VsM,1./6.);}
14205   if(qc8VsM<=0.){v8VsM = pow((-1./33.)*qc8VsM,1./8.);}  
14206   // Calculate stat. error for reference flow estimates from stat. error of Q-cumulants: 
14207   if(qc2VsM>0.){v2ErrorVsM = (1./2.)*pow(qc2VsM,-0.5)*qc2ErrorVsM;} 
14208   if(qc4VsM<0.){v4ErrorVsM = (1./4.)*pow(-qc4VsM,-3./4.)*qc4ErrorVsM;} 
14209   if(qc6VsM>0.){v6ErrorVsM = (1./6.)*pow(2.,-1./3.)*pow(qc6VsM,-5./6.)*qc6ErrorVsM;}   
14210   if(qc8VsM<0.){v8ErrorVsM = (1./8.)*pow(33.,-1./8.)*pow(-qc8VsM,-7./8.)*qc8ErrorVsM;}                       
14211   // Store the results and statistical errors of integrated flow estimates:
14212   fIntFlowVsM[0]->SetBinContent(b,v2VsM);
14213   fIntFlowVsM[0]->SetBinError(b,v2ErrorVsM);
14214   fIntFlowVsM[1]->SetBinContent(b,v4VsM);
14215   fIntFlowVsM[1]->SetBinError(b,v4ErrorVsM);
14216   fIntFlowVsM[2]->SetBinContent(b,v6VsM);
14217   fIntFlowVsM[2]->SetBinError(b,v6ErrorVsM);
14218   fIntFlowVsM[3]->SetBinContent(b,v8VsM);
14219   fIntFlowVsM[3]->SetBinError(b,v8ErrorVsM);
14220  } // end of for(Int_t b=1;b<=nBins;b++)
14221  
14222  // 'Rebinned in M' calculation: // to be improved - this can be implemented better:   
14223  // Reference flow estimates:
14224  Double_t v2RebinnedInM = 0.; // v{2,QC}  
14225  Double_t v4RebinnedInM = 0.; // v{4,QC}  
14226  Double_t v6RebinnedInM = 0.; // v{6,QC}  
14227  Double_t v8RebinnedInM = 0.; // v{8,QC}
14228  // Reference flow's statistical errors:
14229  Double_t v2ErrorRebinnedInM = 0.; // v{2,QC} stat. error 
14230  Double_t v4ErrorRebinnedInM = 0.; // v{4,QC} stat. error
14231  Double_t v6ErrorRebinnedInM = 0.; // v{6,QC} stat. error
14232  Double_t v8ErrorRebinnedInM = 0.; // v{8,QC} stat. error
14233  // Q-cumulants:
14234  Double_t qc2RebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinContent(1); // QC{2}  
14235  Double_t qc4RebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinContent(2); // QC{4}  
14236  Double_t qc6RebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinContent(3); // QC{6}  
14237  Double_t qc8RebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinContent(4); // QC{8}
14238  // Q-cumulants's statistical errors: 
14239  Double_t qc2ErrorRebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinError(1); // QC{2} stat. error  
14240  Double_t qc4ErrorRebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinError(2); // QC{4} stat. error  
14241  Double_t qc6ErrorRebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinError(3); // QC{6} stat. error  
14242  Double_t qc8ErrorRebinnedInM = fIntFlowQcumulantsRebinnedInM->GetBinError(4); // QC{8} stat. error
14243  // Calculate reference flow estimates from Q-cumulants: 
14244  if(qc2RebinnedInM>=0.){v2RebinnedInM = pow(qc2RebinnedInM,0.5);} 
14245  if(qc4RebinnedInM<=0.){v4RebinnedInM = pow(-1.*qc4RebinnedInM,1./4.);} 
14246  if(qc6RebinnedInM>=0.){v6RebinnedInM = pow((1./4.)*qc6RebinnedInM,1./6.);}
14247  if(qc8RebinnedInM<=0.){v8RebinnedInM = pow((-1./33.)*qc8RebinnedInM,1./8.);}  
14248  // Calculate stat. error for reference flow estimates from stat. error of Q-cumulants: 
14249  if(qc2RebinnedInM>0.){v2ErrorRebinnedInM = (1./2.)*pow(qc2RebinnedInM,-0.5)*qc2ErrorRebinnedInM;} 
14250  if(qc4RebinnedInM<0.){v4ErrorRebinnedInM = (1./4.)*pow(-qc4RebinnedInM,-3./4.)*qc4ErrorRebinnedInM;} 
14251  if(qc6RebinnedInM>0.){v6ErrorRebinnedInM = (1./6.)*pow(2.,-1./3.)*pow(qc6RebinnedInM,-5./6.)*qc6ErrorRebinnedInM;}   
14252  if(qc8RebinnedInM<0.){v8ErrorRebinnedInM = (1./8.)*pow(33.,-1./8.)*pow(-qc8RebinnedInM,-7./8.)*qc8ErrorRebinnedInM;}   
14253  // Print warnings for the 'wrong sign' cumulants: 
14254  if(TMath::Abs(v2RebinnedInM) < 1.e-44)
14255  {
14256   cout<<" WARNING: Wrong sign QC{2} rebinned in M, couldn't calculate v{2,QC} !!!!"<<endl;
14257  }
14258  if(TMath::Abs(v4RebinnedInM) < 1.e-44)
14259  {
14260   cout<<" WARNING: Wrong sign QC{4} rebinned in M, couldn't calculate v{4,QC} !!!!"<<endl;
14261  }
14262  if(TMath::Abs(v6RebinnedInM) < 1.e-44)
14263  {
14264   cout<<" WARNING: Wrong sign QC{6} rebinned in M, couldn't calculate v{6,QC} !!!!"<<endl;
14265  }
14266  if(TMath::Abs(v8RebinnedInM) < 1.e-44)
14267  {
14268   cout<<" WARNING: Wrong sign QC{8} rebinned in M, couldn't calculate v{8,QC} !!!!"<<endl;
14269  }                       
14270  // Store the results and statistical errors of integrated flow estimates:
14271  fIntFlowRebinnedInM->SetBinContent(1,v2RebinnedInM);
14272  fIntFlowRebinnedInM->SetBinError(1,v2ErrorRebinnedInM);
14273  fIntFlowRebinnedInM->SetBinContent(2,v4RebinnedInM);
14274  fIntFlowRebinnedInM->SetBinError(2,v4ErrorRebinnedInM);
14275  fIntFlowRebinnedInM->SetBinContent(3,v6RebinnedInM);
14276  fIntFlowRebinnedInM->SetBinError(3,v6ErrorRebinnedInM);
14277  fIntFlowRebinnedInM->SetBinContent(4,v8RebinnedInM);
14278  fIntFlowRebinnedInM->SetBinError(4,v8ErrorRebinnedInM);    
14279   
14280 } // end of AliFlowAnalysisWithQCumulants::CalculateReferenceFlow()
14281
14282 //================================================================================================================================ 
14283
14284 void AliFlowAnalysisWithQCumulants::FillCommonHistResultsIntFlow()
14285 {
14286  // Fill in AliFlowCommonHistResults histograms relevant for reference flow.
14287  
14288  // There are two possibilities here:
14289  // a) Store minimum bias reference flow - use SetMinimumBiasReferenceFlow(kTRUE). This result is 
14290  //    biased by the interplay between nonflow correlations and multiplicity fluctuations and is 
14291  //    also stored in local histogram fIntFlow; 
14292  // b) Store reference flow obtained from flow analysis performed at fixed multiplicity and 
14293  //    rebinned only at the end of the day - use SetMinimumBiasReferenceFlow(kFALSE). This result
14294  //    is also stored in local histogram fIntFlowRebinnedInM.
14295  
14296  // Reference flow estimates:
14297  Double_t v[4] = {0.};
14298  // Statistical errors of reference flow estimates:
14299  Double_t vError[4] = {0.};
14300   
14301  for(Int_t b=0;b<4;b++)
14302  {
14303   if(fMinimumBiasReferenceFlow)
14304   { 
14305    v[b] = fIntFlow->GetBinContent(b+1);
14306    vError[b] = fIntFlow->GetBinError(b+1);
14307   } else
14308     {
14309      v[b] = fIntFlowRebinnedInM->GetBinContent(b+1);
14310      vError[b] = fIntFlowRebinnedInM->GetBinError(b+1);
14311     }
14312  } // end of for(Int_t b=0;b<4;b++)
14313   
14314  // Fill AliFlowCommonHistResults histogram:
14315  fCommonHistsResults2nd->FillIntegratedFlow(v[0],vError[0]); // to be improved (hardwired 2nd in the name)  
14316  fCommonHistsResults4th->FillIntegratedFlow(v[1],vError[1]); // to be improved (hardwired 4th in the name)
14317  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)) // to be improved (calculate also 6th and 8th order)
14318  {
14319   fCommonHistsResults6th->FillIntegratedFlow(v[2],vError[2]); // to be improved (hardwired 6th in the name)
14320   fCommonHistsResults8th->FillIntegratedFlow(v[3],vError[3]); // to be improved (hardwired 8th in the name) 
14321  }
14322  
14323 } // end of AliFlowAnalysisWithQCumulants::FillCommonHistResultsIntFlow()
14324
14325 //================================================================================================================================ 
14326
14327 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelationsUsingParticleWeights()
14328 {
14329  // Calculate all correlations needed for integrated flow using particle weights.
14330   
14331  // Remark 1: When particle weights are used the binning of fIntFlowCorrelationAllPro is organized as follows:
14332  //
14333  //  1st bin: <2>_{1n|1n} = two1n1nW1W1 = <w1 w2 cos(n*(phi1-phi2))>
14334  //  2nd bin: <2>_{2n|2n} = two2n2nW2W2 = <w1^2 w2^2 cos(2n*(phi1-phi2))>
14335  //  3rd bin: <2>_{3n|3n} = two3n3nW3W3 = <w1^3 w2^3 cos(3n*(phi1-phi2))> 
14336  //  4th bin: <2>_{4n|4n} = two4n4nW4W4 = <w1^4 w2^4 cos(4n*(phi1-phi2))>
14337  //  5th bin:           ----  EMPTY ----
14338  //  6th bin: <3>_{2n|1n,1n} = three2n1n1nW2W1W1 = <w1^2 w2 w3 cos(n*(2phi1-phi2-phi3))>
14339  //  7th bin: <3>_{3n|2n,1n} = ...
14340  //  8th bin: <3>_{4n|2n,2n} = ...
14341  //  9th bin: <3>_{4n|3n,1n} = ...
14342  // 10th bin:           ----  EMPTY ----
14343  // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1nW1W1W1W1 = <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))>
14344  // 12th bin: <4>_{2n,1n|2n,1n} = ...
14345  // 13th bin: <4>_{2n,2n|2n,2n} = ...
14346  // 14th bin: <4>_{3n|1n,1n,1n} = ... 
14347  // 15th bin: <4>_{3n,1n|3n,1n} = ...
14348  // 16th bin: <4>_{3n,1n|2n,2n} = ...
14349  // 17th bin: <4>_{4n|2n,1n,1n} = ... 
14350  // 18th bin:           ----  EMPTY ----
14351  // 19th bin: <5>_{2n|1n,1n,1n,1n} = ...
14352  // 20th bin: <5>_{2n,2n|2n,1n,1n} = ...
14353  // 21st bin: <5>_{3n,1n|2n,1n,1n} = ...
14354  // 22nd bin: <5>_{4n|1n,1n,1n,1n} = ...
14355  // 23rd bin:           ----  EMPTY ----
14356  // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = ...
14357  // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = ...
14358  // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = ...
14359  // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = ...
14360  // 28th bin:           ----  EMPTY ----
14361  // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = ...
14362  // 30th bin:           ----  EMPTY ----
14363  // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = ...
14364  
14365  // Remark 2: When particle weights are used there are some extra correlations. They are stored in 
14366  // fIntFlowExtraCorrelationsPro binning of which is organized as follows:
14367  
14368  // 1st bin: two1n1nW3W1 = <w1^3 w2 cos(n*(phi1-phi2))>
14369  // 2nd bin: two1n1nW1W1W2 = <w1 w2 w3^2 cos(n*(phi1-phi2))>  
14370  
14371  // multiplicity (number of particles used to determine the reaction plane)
14372  Double_t dMult = (*fSpk)(0,0);
14373  
14374  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
14375  Double_t dReQ1n1k = (*fReQ)(0,1);
14376  Double_t dReQ2n2k = (*fReQ)(1,2);
14377  Double_t dReQ3n3k = (*fReQ)(2,3);
14378  Double_t dReQ4n4k = (*fReQ)(3,4);
14379  Double_t dReQ1n3k = (*fReQ)(0,3);
14380  Double_t dImQ1n1k = (*fImQ)(0,1);
14381  Double_t dImQ2n2k = (*fImQ)(1,2);
14382  Double_t dImQ3n3k = (*fImQ)(2,3);
14383  Double_t dImQ4n4k = (*fImQ)(3,4);
14384  Double_t dImQ1n3k = (*fImQ)(0,3);
14385
14386  // dMs are variables introduced in order to simplify some Eqs. bellow:
14387  //..............................................................................................
14388  Double_t dM11 = (*fSpk)(1,1)-(*fSpk)(0,2); // dM11 = sum_{i,j=1,i!=j}^M w_i w_j
14389  Double_t dM22 = (*fSpk)(1,2)-(*fSpk)(0,4); // dM22 = sum_{i,j=1,i!=j}^M w_i^2 w_j^2
14390  Double_t dM33 = (*fSpk)(1,3)-(*fSpk)(0,6); // dM33 = sum_{i,j=1,i!=j}^M w_i^3 w_j^3
14391  Double_t dM44 = (*fSpk)(1,4)-(*fSpk)(0,8); // dM44 = sum_{i,j=1,i!=j}^M w_i^4 w_j^4
14392  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
14393  Double_t dM211 = (*fSpk)(0,2)*(*fSpk)(1,1)-2.*(*fSpk)(0,3)*(*fSpk)(0,1)
14394                 - (*fSpk)(1,2)+2.*(*fSpk)(0,4); // dM211 = sum_{i,j,k=1,i!=j!=k}^M w_i^2 w_j w_k
14395  Double_t dM1111 = (*fSpk)(3,1)-6.*(*fSpk)(0,2)*(*fSpk)(1,1)  
14396                  + 8.*(*fSpk)(0,3)*(*fSpk)(0,1)
14397                  + 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
14398  //..............................................................................................
14399
14400  // 2-particle correlations:
14401  Double_t two1n1nW1W1 = 0.; // <w1 w2 cos(n*(phi1-phi2))>
14402  Double_t two2n2nW2W2 = 0.; // <w1^2 w2^2 cos(2n*(phi1-phi2))>
14403  Double_t two3n3nW3W3 = 0.; // <w1^3 w2^3 cos(3n*(phi1-phi2))>
14404  Double_t two4n4nW4W4 = 0.; // <w1^4 w2^4 cos(4n*(phi1-phi2))>
14405  if(dMult>1) 
14406  { 
14407   if(dM11)
14408   {
14409    two1n1nW1W1 = (pow(dReQ1n1k,2)+pow(dImQ1n1k,2)-(*fSpk)(0,2))/dM11;    
14410    // average correlation <w1 w2 cos(n*(phi1-phi2))> for single event: 
14411    fIntFlowCorrelationsEBE->SetBinContent(1,two1n1nW1W1);
14412    fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(1,dM11);
14413    // average correlation <w1 w2 cos(n*(phi1-phi2))> for all events:
14414    fIntFlowCorrelationsPro->Fill(0.5,two1n1nW1W1,dM11);  
14415    // average squared correlation <w1 w2 cos(n*(phi1-phi2))> for all events:
14416    fIntFlowSquaredCorrelationsPro->Fill(0.5,two1n1nW1W1*two1n1nW1W1,dM11); 
14417    fIntFlowCorrelationsAllPro->Fill(0.5,two1n1nW1W1,dM11);   
14418   }
14419   if(dM22)
14420   {
14421    two2n2nW2W2 = (pow(dReQ2n2k,2)+pow(dImQ2n2k,2)-(*fSpk)(0,4))/dM22; 
14422    // ...
14423    // average correlation <w1^2 w2^2 cos(2n*(phi1-phi2))> for all events:
14424    fIntFlowCorrelationsAllPro->Fill(1.5,two2n2nW2W2,dM22);   
14425   }
14426   if(dM33)
14427   {
14428    two3n3nW3W3 = (pow(dReQ3n3k,2)+pow(dImQ3n3k,2)-(*fSpk)(0,6))/dM33;
14429    // ...
14430    // average correlation <w1^3 w2^3 cos(3n*(phi1-phi2))> for all events:
14431    fIntFlowCorrelationsAllPro->Fill(2.5,two3n3nW3W3,dM33);   
14432   }
14433   if(dM44)
14434   {
14435    two4n4nW4W4 = (pow(dReQ4n4k,2)+pow(dImQ4n4k,2)-(*fSpk)(0,8))/dM44; 
14436    // ...
14437    // average correlation <w1^4 w2^4 cos(4n*(phi1-phi2))> for all events:
14438    fIntFlowCorrelationsAllPro->Fill(3.5,two4n4nW4W4,dM44);      
14439   }
14440  } // end of if(dMult>1) 
14441
14442  // extra 2-particle correlations:
14443  Double_t two1n1nW3W1 = 0.; // <w1^3 w2 cos(n*(phi1-phi2))>
14444  Double_t two1n1nW1W1W2 = 0.; // <w1 w2 w3^2 cos(n*(phi1-phi2))> 
14445  if(dMult>1) 
14446  {    
14447   if(dM31)
14448   {
14449    two1n1nW3W1 = (dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k-(*fSpk)(0,4))/dM31; 
14450    fIntFlowExtraCorrelationsPro->Fill(0.5,two1n1nW3W1,dM31);  
14451   } 
14452   if(dM211)
14453   {
14454    two1n1nW1W1W2 = ((*fSpk)(0,2)*(pow(dReQ1n1k,2)+pow(dImQ1n1k,2)-(*fSpk)(0,2))
14455                  - 2.*(dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k
14456                  - (*fSpk)(0,4)))/dM211;
14457    fIntFlowExtraCorrelationsPro->Fill(1.5,two1n1nW1W1W2,dM211);  
14458   }  
14459  } // end of if(dMult>1)
14460  //..............................................................................................
14461  
14462  //..............................................................................................
14463  // 3-particle correlations:
14464  Double_t three2n1n1nW2W1W1 = 0.; // <w1^2 w2 w3 cos(n*(2phi1-phi2-phi3))>
14465  
14466  if(dMult>2) 
14467  { 
14468   if(dM211)
14469   {                                                       
14470    three2n1n1nW2W1W1 = (pow(dReQ1n1k,2.)*dReQ2n2k+2.*dReQ1n1k*dImQ1n1k*dImQ2n2k-pow(dImQ1n1k,2.)*dReQ2n2k
14471                      - 2.*(dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k)
14472                      - pow(dReQ2n2k,2)-pow(dImQ2n2k,2)
14473                      + 2.*(*fSpk)(0,4))/dM211;                                                                               
14474    fIntFlowCorrelationsAllPro->Fill(5.5,three2n1n1nW2W1W1,dM211);
14475   } 
14476  } // end of if(dMult>2) 
14477  //..............................................................................................
14478  
14479  //..............................................................................................
14480  // 4-particle correlations:
14481  Double_t four1n1n1n1nW1W1W1W1 = 0.; // <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))>
14482  if(dMult>3) 
14483  { 
14484   if(dM1111)
14485   {      
14486    four1n1n1n1nW1W1W1W1 = (pow(pow(dReQ1n1k,2.)+pow(dImQ1n1k,2.),2)
14487                         - 2.*(pow(dReQ1n1k,2.)*dReQ2n2k+2.*dReQ1n1k*dImQ1n1k*dImQ2n2k-pow(dImQ1n1k,2.)*dReQ2n2k)
14488                         + 8.*(dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k)
14489                         + (pow(dReQ2n2k,2)+pow(dImQ2n2k,2))
14490                         - 4.*(*fSpk)(0,2)*(pow(dReQ1n1k,2)+pow(dImQ1n1k,2))
14491                         - 6.*(*fSpk)(0,4)+2.*(*fSpk)(1,2))/dM1111;  
14492                           
14493    // average correlation <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))> for single event: 
14494    fIntFlowCorrelationsEBE->SetBinContent(2,four1n1n1n1nW1W1W1W1);
14495    fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(2,dM1111);
14496    // average correlation <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))> for all events:
14497    fIntFlowCorrelationsPro->Fill(1.5,four1n1n1n1nW1W1W1W1,dM1111);   
14498    // average squared correlation <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))> for all events:
14499    fIntFlowSquaredCorrelationsPro->Fill(1.5,four1n1n1n1nW1W1W1W1*four1n1n1n1nW1W1W1W1,dM1111);      
14500    fIntFlowCorrelationsAllPro->Fill(10.5,four1n1n1n1nW1W1W1W1,dM1111);   
14501   } 
14502  } // end of if(dMult>3) 
14503  //..............................................................................................
14504  
14505 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelationsUsingParticleWeights()
14506
14507 //=======================================================================================================================
14508
14509 void AliFlowAnalysisWithQCumulants::InitializeArraysForIntFlow()
14510 {
14511  // Initialize all arrays used to calculate integrated flow.
14512  
14513  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
14514  {
14515   fIntFlowCorrectionTermsForNUAEBE[sc] = NULL;
14516   fIntFlowEventWeightForCorrectionTermsForNUAEBE[sc] = NULL;
14517   fIntFlowCorrectionTermsForNUAPro[sc] = NULL;
14518   fIntFlowCorrectionTermsForNUAHist[sc] = NULL;
14519   for(Int_t ci=0;ci<4;ci++) // correction term index (to be improved - hardwired 4)
14520   {
14521    fIntFlowCorrectionTermsForNUAVsMPro[sc][ci] = NULL;
14522   }
14523   for(Int_t power=0;power<2;power++) // linear or quadratic 
14524   {
14525    fIntFlowSumOfEventWeightsNUA[sc][power] = NULL;
14526   }
14527  }
14528  for(Int_t power=0;power<2;power++) // linear or quadratic 
14529  {
14530   fIntFlowSumOfEventWeights[power] = NULL;    
14531  }
14532  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))
14533  {
14534   fPrintFinalResults[i] = kTRUE;
14535  }
14536  for(Int_t ci=0;ci<4;ci++) // correlation index or cumulant order
14537  {
14538   fIntFlowCorrelationsVsMPro[ci] = NULL;
14539   fIntFlowSquaredCorrelationsVsMPro[ci] = NULL;
14540   fIntFlowCorrelationsVsMHist[ci] = NULL;
14541   fIntFlowQcumulantsVsM[ci] = NULL;
14542   fIntFlowVsM[ci] = NULL;
14543   fIntFlowDetectorBiasVsM[ci] = NULL;
14544   for(Int_t lc=0;lc<2;lc++)
14545   {
14546    fIntFlowSumOfEventWeightsVsM[ci][lc] = NULL;
14547   }
14548  } 
14549  for(Int_t pi=0;pi<6;pi++) // product or covariance index
14550  {
14551   fIntFlowProductOfCorrelationsVsMPro[pi] = NULL;
14552   fIntFlowCovariancesVsM[pi] = NULL;
14553   fIntFlowSumOfProductOfEventWeightsVsM[pi] = NULL;
14554  } 
14555  for(Int_t ci=0;ci<64;ci++) // correlation index for all correlations vs M profiles (to be improved - hardwired 64)
14556  {
14557   fIntFlowCorrelationsAllVsMPro[ci] = NULL;
14558  } 
14559
14560 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForIntFlow()
14561
14562 //=======================================================================================================================
14563
14564 void AliFlowAnalysisWithQCumulants::InitializeArraysForDiffFlow()
14565 {
14566  // Initialize all arrays needed to calculate differential flow.
14567  //  a) Initialize lists holding profiles;
14568  //  b) Initialize lists holding histograms;
14569  //  c) Initialize event-by-event quantities;
14570  //  d) Initialize profiles;
14571  //  e) Initialize histograms holding final results.
14572  
14573  // a) Initialize lists holding profiles;
14574  for(Int_t t=0;t<2;t++) // type (RP, POI)
14575  {
14576   for(Int_t pe=0;pe<2;pe++) // pt or eta
14577   {
14578    fDiffFlowCorrelationsProList[t][pe] = NULL;
14579    fDiffFlowProductOfCorrelationsProList[t][pe] = NULL;
14580    fDiffFlowCorrectionsProList[t][pe] = NULL;
14581   }
14582   // 2D:
14583   f2DDiffFlowCorrelationsProList[t] = NULL;
14584  }  
14585  
14586  // b) Initialize lists holding histograms;
14587  for(Int_t t=0;t<2;t++) // type (RP, POI)
14588  {
14589   for(Int_t pe=0;pe<2;pe++) // pt or eta
14590   {
14591    fDiffFlowCorrelationsHistList[t][pe] = NULL;
14592    for(Int_t power=0;power<2;power++)
14593    {
14594     fDiffFlowSumOfEventWeightsHistList[t][pe][power] = NULL;
14595    } // end of for(Int_t power=0;power<2;power++)  
14596    fDiffFlowSumOfProductOfEventWeightsHistList[t][pe] = NULL;
14597    fDiffFlowCorrectionsHistList[t][pe] = NULL;
14598    fDiffFlowCovariancesHistList[t][pe] = NULL;
14599    fDiffFlowCumulantsHistList[t][pe] = NULL;
14600    fDiffFlowDetectorBiasHistList[t][pe] = NULL;
14601    fDiffFlowHistList[t][pe] = NULL;
14602   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
14603  } // enf of for(Int_t t=0;t<2;t++) // type (RP, POI) 
14604  
14605  // c) Initialize event-by-event quantities:
14606  // 1D:
14607  for(Int_t t=0;t<3;t++) // type (RP, POI, POI&&RP)
14608  {
14609   for(Int_t pe=0;pe<2;pe++) // pt or eta
14610   { 
14611    for(Int_t m=0;m<4;m++) // multiple of harmonic
14612    {
14613     for(Int_t k=0;k<9;k++) // power of weight
14614     {
14615      fReRPQ1dEBE[t][pe][m][k] = NULL;
14616      fImRPQ1dEBE[t][pe][m][k] = NULL;
14617      fs1dEBE[t][pe][k] = NULL; // to be improved (this doesn't need to be within loop over m)
14618     }   
14619    }
14620   }
14621  }
14622  // 1D:
14623  for(Int_t t=0;t<2;t++) // type (RP or POI)
14624  {
14625   for(Int_t pe=0;pe<2;pe++) // pt or eta
14626   { 
14627    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
14628    {
14629     for(Int_t cti=0;cti<9;cti++) // correction term index
14630     {
14631      fDiffFlowCorrectionTermsForNUAEBE[t][pe][sc][cti] = NULL;
14632     }   
14633    }
14634   }
14635  }
14636  // 2D:  
14637  for(Int_t t=0;t<3;t++) // type (RP, POI, POI&&RP)
14638  {
14639   for(Int_t m=0;m<4;m++) // multiple of harmonic
14640   {
14641    for(Int_t k=0;k<9;k++) // power of weight
14642    {
14643     fReRPQ2dEBE[t][m][k] = NULL;
14644     fImRPQ2dEBE[t][m][k] = NULL;
14645     fs2dEBE[t][k] = NULL; // to be improved (this doesn't need to be within loop over m)
14646    }   
14647   }
14648  }
14649  
14650  // d) Initialize profiles:
14651  for(Int_t t=0;t<2;t++) // type: RP or POI
14652  { 
14653   for(Int_t pe=0;pe<2;pe++) // pt or eta
14654   {
14655    for(Int_t ci=0;ci<4;ci++) // correlation index
14656    {
14657     fDiffFlowCorrelationsPro[t][pe][ci] = NULL;
14658     fDiffFlowSquaredCorrelationsPro[t][pe][ci] = NULL;
14659    } // end of for(Int_t ci=0;ci<4;ci++)   
14660    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
14661    {
14662     for(Int_t mci2=0;mci2<8;mci2++) // mixed correlation index
14663     {
14664      fDiffFlowProductOfCorrelationsPro[t][pe][mci1][mci2] = NULL;
14665     } // end of for(Int_t mci2=0;mci2<8;mci2++) // mixed correlation index
14666    } // end of for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index  
14667    // correction terms for nua:
14668    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
14669    {
14670     for(Int_t cti=0;cti<9;cti++) // correction term index
14671     {
14672      fDiffFlowCorrectionTermsForNUAPro[t][pe][sc][cti] = NULL;
14673     }   
14674    }
14675    // other differential correlators:
14676    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
14677    {
14678     for(Int_t ci=0;ci<1;ci++) // correction term index
14679     {
14680      fOtherDiffCorrelators[t][pe][sc][ci] = NULL;
14681     }   
14682    }
14683   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
14684   for(Int_t ci=0;ci<4;ci++) // correlation index
14685   {
14686    f2DDiffFlowCorrelationsPro[t][ci] = NULL;
14687   }
14688  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
14689   
14690  // e) Initialize histograms holding final results.
14691  for(Int_t t=0;t<2;t++) // type: RP or POI
14692  { 
14693   for(Int_t pe=0;pe<2;pe++) // pt or eta
14694   {
14695    for(Int_t ci=0;ci<4;ci++) // correlation index
14696    {
14697     fDiffFlowCorrelationsHist[t][pe][ci] = NULL;
14698     fDiffFlowCumulants[t][pe][ci] = NULL;
14699     fDiffFlowDetectorBias[t][pe][ci] = NULL;
14700     fDiffFlow[t][pe][ci] = NULL;
14701    } // end of for(Int_t ci=0;ci<4;ci++)    
14702    for(Int_t covarianceIndex=0;covarianceIndex<5;covarianceIndex++) 
14703    {
14704     fDiffFlowCovariances[t][pe][covarianceIndex] = NULL;     
14705    } // end of for(Int_t covarianceIndex=0;covarianceIndex<5;covarianceIndex++) 
14706    // correction terms for nua:
14707    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
14708    {
14709     for(Int_t cti=0;cti<9;cti++) // correction term index
14710     {
14711      fDiffFlowCorrectionTermsForNUAHist[t][pe][sc][cti] = NULL;
14712     }   
14713    }
14714   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
14715   for(Int_t ci=0;ci<4;ci++) // correlation index
14716   {
14717    f2DDiffFlowCumulants[t][ci] = NULL;
14718    f2DDiffFlow[t][ci] = NULL;
14719   }
14720  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
14721  
14722  // sum of event weights for reduced correlations:
14723  for(Int_t t=0;t<2;t++) // type = RP or POI
14724  {
14725   for(Int_t pe=0;pe<2;pe++) // pt or eta
14726   {
14727    for(Int_t p=0;p<2;p++) // power of weight is 1 or 2
14728    {
14729     for(Int_t ew=0;ew<4;ew++) // event weight index for reduced correlations
14730     {
14731      fDiffFlowSumOfEventWeights[t][pe][p][ew] = NULL;
14732     } 
14733    }   
14734   }
14735  }
14736  // product of event weights for both types of correlations:
14737  for(Int_t t=0;t<2;t++) // type = RP or POI
14738  {
14739   for(Int_t pe=0;pe<2;pe++) // pt or eta
14740   {
14741    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
14742    {
14743     for(Int_t mci2=0;mci2<8;mci2++) // mixed correlation index
14744     {
14745      fDiffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2] = NULL;
14746     } 
14747    }   
14748   }
14749  }
14750     
14751 } // end of AliFlowAnalysisWithQCumulants::InitializeArraysForDiffFlow()
14752
14753 //=======================================================================================================================
14754
14755 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCumulants(TString type, TString ptOrEta)
14756 {
14757  // Calculate differential flow cumulants from measured multiparticle correlations.
14758  
14759  // REMARK: Cumulants calculated in this method are NOT corrected for non-uniform acceptance. 
14760  // This correction, if enabled via setter SetApplyCorrectionForNUA(Bool_t), is applied 
14761  // in the method CalculateDiffFlowCumulantsCorrectedForNUA(TString type, TString ptOrEta)
14762  
14763  Int_t t = 0;
14764  Int_t pe = 0;
14765
14766  if(type == "RP")
14767  {
14768   t = 0;
14769  } else if(type == "POI")
14770    {
14771     t = 1;
14772    } 
14773      
14774  if(ptOrEta == "Pt")
14775  {
14776   pe = 0;
14777  } else if(ptOrEta == "Eta")
14778    {
14779     pe = 1;
14780    } 
14781      
14782  // Common:
14783  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
14784  
14785  // Correlation <<2>>: 
14786  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1);
14787  Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1);
14788  
14789  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
14790  {
14791   // Reduced correlations:   
14792   Double_t twoPrime = fDiffFlowCorrelationsHist[t][pe][0]->GetBinContent(b); // <<2'>>
14793   Double_t twoPrimeError = fDiffFlowCorrelationsHist[t][pe][0]->GetBinError(b); // stat. error of <<2'>>
14794   Double_t fourPrime = fDiffFlowCorrelationsHist[t][pe][1]->GetBinContent(b); // <<4'>>
14795   Double_t fourPrimeError = fDiffFlowCorrelationsHist[t][pe][1]->GetBinError(b); // stat. error of <<4'>>
14796   // Covariances:
14797   Double_t wCovTwoTwoReduced = fDiffFlowCovariances[t][pe][0]->GetBinContent(b); // Cov(<2>,<2'>) * prefactor(<2>,<2'>)
14798   Double_t wCovTwoFourReduced = fDiffFlowCovariances[t][pe][1]->GetBinContent(b); // Cov(<2>,<4'>) * prefactor(<2>,<4'>)
14799   Double_t wCovTwoReducedFourReduced = fDiffFlowCovariances[t][pe][4]->GetBinContent(b); // Cov(<2'>,<4'>) * prefactor(<2'>,<4'>)
14800   // QC{2'}:
14801   Double_t qc2Prime = twoPrime; // QC{2'}
14802   Double_t qc2PrimeError = twoPrimeError; // stat. error of QC{2'}
14803   fDiffFlowCumulants[t][pe][0]->SetBinContent(b,qc2Prime); 
14804   fDiffFlowCumulants[t][pe][0]->SetBinError(b,qc2PrimeError); 
14805   // QC{4'}:
14806   Double_t qc4Prime = fourPrime - 2.*twoPrime*two; // QC{4'} = <<4'>> - 2*<<2'>><<2>>
14807   Double_t qc4PrimeError = 0.; // stat. error of QC{4'}
14808   Double_t qc4PrimeErrorSquared = 4.*pow(twoPrime,2.)*pow(twoError,2.)
14809                                 + 4.*pow(two,2.)*pow(twoPrimeError,2.)
14810                                 + pow(fourPrimeError,2.)
14811                                 + 8.*two*twoPrime*wCovTwoTwoReduced
14812                                 - 4.*twoPrime*wCovTwoFourReduced
14813                                 - 4.*two*wCovTwoReducedFourReduced;
14814   if(qc4PrimeErrorSquared>0.)
14815   {
14816    qc4PrimeError = pow(qc4PrimeErrorSquared,0.5);
14817   } 
14818   fDiffFlowCumulants[t][pe][1]->SetBinContent(b,qc4Prime); 
14819   fDiffFlowCumulants[t][pe][1]->SetBinError(b,qc4PrimeError); 
14820  } // end of for(Int_t p=1;p<=fnBinsPt;p++)
14821     
14822 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCumulants(TString type, Bool_t useParticleWeights, TString eventWeights); 
14823
14824 //=======================================================================================================================
14825
14826 void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlowCumulants(TString type)
14827 {
14828  // Calculate 2D differential cumulants.
14829  
14830  // Remark: correction for detector effects and error propagation not implemented yet for 2D differential cumulants.
14831  
14832  Int_t t = 0;
14833
14834  if(type == "RP")
14835  {
14836   t = 0;
14837  } else if(type == "POI")
14838    {
14839     t = 1;
14840    }
14841        
14842  // Reference correlation <<2>>: 
14843  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1);
14844  
14845  // Looping over all (pt,eta) bins and calculating differential flow cumulants: 
14846  for(Int_t p=1;p<=fnBinsPt;p++)
14847  {
14848   for(Int_t e=1;e<=fnBinsEta;e++)
14849   {
14850    // Reduced correlations:   
14851    Double_t twoPrime = f2DDiffFlowCorrelationsPro[t][0]->GetBinContent(f2DDiffFlowCorrelationsPro[t][0]->GetBin(p,e)); // <<2'>>(pt,eta)
14852    Double_t fourPrime = f2DDiffFlowCorrelationsPro[t][1]->GetBinContent(f2DDiffFlowCorrelationsPro[t][1]->GetBin(p,e)); // <<4'>>(pt,eta)
14853    // Cumulants:
14854    Double_t qc2Prime = twoPrime; // QC{2'} = <<2'>>   
14855    f2DDiffFlowCumulants[t][0]->SetBinContent(f2DDiffFlowCumulants[t][0]->GetBin(p,e),qc2Prime); 
14856    Double_t qc4Prime = fourPrime - 2.*twoPrime*two; // QC{4'} = <<4'>> - 2*<<2'>><<2>>
14857    f2DDiffFlowCumulants[t][1]->SetBinContent(f2DDiffFlowCumulants[t][1]->GetBin(p,e),qc4Prime); 
14858   } // end of for(Int_t e=1;e<=fnBinsEta;e++)
14859  } // end of for(Int_t p=1;p<=fnBinsPt;p++)
14860  
14861 } // end of void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlowCumulants(TString type)
14862
14863 //=======================================================================================================================
14864
14865 void AliFlowAnalysisWithQCumulants::CalculateFinalResultsForRPandPOIIntegratedFlow(TString type)
14866 {
14867  // Calculate final results for integrated flow of RPs and POIs. 
14868   
14869  // to be improved - check if the integrated flow calculation here is actually correct 
14870   
14871  Int_t t = 0; // RP = 0, POI = 1
14872
14873  if(type == "RP")
14874  {
14875   t = 0;
14876  } else if(type == "POI")
14877    {
14878     t = 1;
14879    }
14880      
14881  // pt yield:    
14882  TH1F *yield2ndPt = NULL;
14883  TH1F *yield4thPt = NULL;
14884  TH1F *yield6thPt = NULL;
14885  TH1F *yield8thPt = NULL;
14886  
14887  if(type == "POI")
14888  {
14889   if(fFillMultipleControlHistograms)
14890   {
14891    yield2ndPt = (TH1F*)(fCommonHists2nd->GetHistPtPOI())->Clone();
14892    yield4thPt = (TH1F*)(fCommonHists4th->GetHistPtPOI())->Clone();
14893    yield6thPt = (TH1F*)(fCommonHists6th->GetHistPtPOI())->Clone();
14894    yield8thPt = (TH1F*)(fCommonHists8th->GetHistPtPOI())->Clone();  
14895   } else
14896     {
14897      yield2ndPt = (TH1F*)(fCommonHists->GetHistPtPOI())->Clone();
14898      yield4thPt = (TH1F*)(fCommonHists->GetHistPtPOI())->Clone();
14899      yield6thPt = (TH1F*)(fCommonHists->GetHistPtPOI())->Clone();
14900      yield8thPt = (TH1F*)(fCommonHists->GetHistPtPOI())->Clone();     
14901     }
14902  } 
14903  else if(type == "RP")
14904  {
14905   if(fFillMultipleControlHistograms)
14906   {
14907    yield2ndPt = (TH1F*)(fCommonHists2nd->GetHistPtRP())->Clone();
14908    yield4thPt = (TH1F*)(fCommonHists4th->GetHistPtRP())->Clone();
14909    yield6thPt = (TH1F*)(fCommonHists6th->GetHistPtRP())->Clone();
14910    yield8thPt = (TH1F*)(fCommonHists8th->GetHistPtRP())->Clone();  
14911   } else
14912     {
14913      yield2ndPt = (TH1F*)(fCommonHists->GetHistPtRP())->Clone();
14914      yield4thPt = (TH1F*)(fCommonHists->GetHistPtRP())->Clone();
14915      yield6thPt = (TH1F*)(fCommonHists->GetHistPtRP())->Clone();
14916      yield8thPt = (TH1F*)(fCommonHists->GetHistPtRP())->Clone();    
14917     } 
14918  } 
14919  
14920  if(!yield2ndPt){return;}
14921  if(!yield4thPt){return;}
14922  if(!yield6thPt){return;}
14923  if(!yield8thPt){return;} 
14924
14925  Int_t nBinsPt = yield2ndPt->GetNbinsX();
14926  
14927  TH1D *flow2ndPt = NULL;
14928  TH1D *flow4thPt = NULL;
14929  TH1D *flow6thPt = NULL;
14930  TH1D *flow8thPt = NULL;
14931  
14932  // to be improved (hardwired pt index)
14933  flow2ndPt = (TH1D*)fDiffFlow[t][0][0]->Clone();
14934  flow4thPt = (TH1D*)fDiffFlow[t][0][1]->Clone();
14935  flow6thPt = (TH1D*)fDiffFlow[t][0][2]->Clone();
14936  flow8thPt = (TH1D*)fDiffFlow[t][0][3]->Clone(); 
14937
14938  if(!flow2ndPt){return;}
14939  if(!flow4thPt){return;}
14940  if(!flow6thPt){return;}
14941  if(!flow8thPt){return;} 
14942    
14943  Double_t dvn2nd = 0., dvn4th = 0., dvn6th = 0., dvn8th = 0.; // differential flow
14944  Double_t dErrvn2nd = 0., dErrvn4th = 0., dErrvn6th = 0., dErrvn8th = 0.; // error on differential flow
14945  
14946  Double_t dVn2nd = 0., dVn4th = 0., dVn6th = 0., dVn8th = 0.; // integrated flow 
14947  Double_t dErrVn2nd = 0., dErrVn4th = 0., dErrVn6th = 0., dErrVn8th = 0.; // error on integrated flow
14948
14949  Double_t dYield2nd = 0., dYield4th = 0., dYield6th = 0., dYield8th = 0.; // pt yield 
14950  Double_t dSum2nd = 0., dSum4th = 0., dSum6th = 0., dSum8th = 0.; // needed for normalizing integrated flow
14951  
14952  // looping over pt bins:
14953  for(Int_t p=1;p<nBinsPt+1;p++)
14954  {
14955   dvn2nd = flow2ndPt->GetBinContent(p);
14956   dvn4th = flow4thPt->GetBinContent(p);
14957   dvn6th = flow6thPt->GetBinContent(p);
14958   dvn8th = flow8thPt->GetBinContent(p);
14959   
14960   dErrvn2nd = flow2ndPt->GetBinError(p);
14961   dErrvn4th = flow4thPt->GetBinError(p);
14962   dErrvn6th = flow6thPt->GetBinError(p);
14963   dErrvn8th = flow8thPt->GetBinError(p);
14964
14965   dYield2nd = yield2ndPt->GetBinContent(p);  
14966   dYield4th = yield4thPt->GetBinContent(p);
14967   dYield6th = yield6thPt->GetBinContent(p);
14968   dYield8th = yield8thPt->GetBinContent(p);
14969   
14970   dVn2nd += dvn2nd*dYield2nd;
14971   dVn4th += dvn4th*dYield4th;
14972   dVn6th += dvn6th*dYield6th;
14973   dVn8th += dvn8th*dYield8th;
14974   
14975   dSum2nd += dYield2nd;
14976   dSum4th += dYield4th;
14977   dSum6th += dYield6th;
14978   dSum8th += dYield8th;
14979   
14980   dErrVn2nd += dYield2nd*dYield2nd*dErrvn2nd*dErrvn2nd; // ro be improved (check this relation)
14981   dErrVn4th += dYield4th*dYield4th*dErrvn4th*dErrvn4th;
14982   dErrVn6th += dYield6th*dYield6th*dErrvn6th*dErrvn6th;
14983   dErrVn8th += dYield8th*dYield8th*dErrvn8th*dErrvn8th;
14984     
14985  } // end of for(Int_t p=1;p<nBinsPt+1;p++)
14986
14987  // normalizing the results for integrated flow:
14988  if(dSum2nd) 
14989  {
14990   dVn2nd /= dSum2nd;
14991   dErrVn2nd /= (dSum2nd*dSum2nd);
14992   dErrVn2nd = TMath::Sqrt(dErrVn2nd);
14993  } 
14994  if(dSum4th) 
14995  {
14996   dVn4th /= dSum4th;
14997   dErrVn4th /= (dSum4th*dSum4th);
14998   dErrVn4th = TMath::Sqrt(dErrVn4th);
14999  } 
15000  //if(dSum6th) dVn6th/=dSum6th;
15001  //if(dSum8th) dVn8th/=dSum8th;
15002   
15003  // storing the results for integrated flow in common histos: (to be improved: new method for this?)
15004  if(type == "POI")
15005  {
15006   fCommonHistsResults2nd->FillIntegratedFlowPOI(dVn2nd,dErrVn2nd); 
15007   fCommonHistsResults4th->FillIntegratedFlowPOI(dVn4th,dErrVn4th); 
15008   fCommonHistsResults6th->FillIntegratedFlowPOI(dVn6th,0.); // to be improved (errors)
15009   fCommonHistsResults8th->FillIntegratedFlowPOI(dVn8th,0.); // to be improved (errors)
15010  }
15011  else if (type == "RP")
15012  {
15013   fCommonHistsResults2nd->FillIntegratedFlowRP(dVn2nd,dErrVn2nd); 
15014   fCommonHistsResults4th->FillIntegratedFlowRP(dVn4th,dErrVn4th);
15015   fCommonHistsResults6th->FillIntegratedFlowRP(dVn6th,0.); // to be improved (errors)
15016   fCommonHistsResults8th->FillIntegratedFlowRP(dVn8th,0.); // to be improved (errors)
15017  }
15018  
15019  delete flow2ndPt;
15020  delete flow4thPt;
15021  //delete flow6thPt;
15022  //delete flow8thPt;
15023  
15024  delete yield2ndPt;
15025  delete yield4thPt;
15026  delete yield6thPt;
15027  delete yield8thPt;
15028            
15029 } // end of AliFlowAnalysisWithQCumulants::CalculateFinalResultsForRPandPOIIntegratedFlow(TString type)
15030
15031 //=======================================================================================================================
15032
15033 void AliFlowAnalysisWithQCumulants::InitializeArraysForDistributions()
15034 {
15035  // Initialize all arrays used for distributions.
15036  
15037  // a) Initialize arrays of histograms used to hold distributions of correlations; 
15038  // b) Initialize array to hold min and max values of correlations.
15039  
15040  // a) Initialize arrays of histograms used to hold distributions of correlations:
15041  for(Int_t di=0;di<4;di++) // distribution index
15042  {
15043   fDistributions[di] = NULL;
15044  }
15045  
15046  // b) Initialize default min and max values of correlations:
15047  //    (Remark: The default values bellow were chosen for v2=5% and M=500)
15048  fMinValueOfCorrelation[0] = -0.01; // <2>_min 
15049  fMaxValueOfCorrelation[0] = 0.04; // <2>_max 
15050  fMinValueOfCorrelation[1] = -0.00002; // <4>_min 
15051  fMaxValueOfCorrelation[1] = 0.00015; // <4>_max  
15052  fMinValueOfCorrelation[2] = -0.0000003; // <6>_min 
15053  fMaxValueOfCorrelation[2] = 0.0000006; // <6>_max  
15054  fMinValueOfCorrelation[3] = -0.000000006; // <8>_min 
15055  fMaxValueOfCorrelation[3] = 0.000000003; // <8>_max 
15056  
15057 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForDistributions()
15058
15059 //=======================================================================================================================
15060
15061 void AliFlowAnalysisWithQCumulants::InitializeArraysForVarious()
15062 {
15063  // Initialize all arrays used for various unclassified objects.
15064  
15065  for(Int_t p=0;p<4;p++) // [v_min,v_max,refMult_min,refMult_max]
15066  {
15067   fPhiDistributionForOneEventSettings[p] = 0.;
15068  } 
15069    
15070 } //  end of void AliFlowAnalysisWithQCumulants::InitializeArraysForVarious()
15071
15072 //=======================================================================================================================
15073
15074 void AliFlowAnalysisWithQCumulants::BookEverythingForDistributions()
15075 {
15076  // a) Book profile to hold all flags for distributions of correlations;
15077  // b) Book all histograms to hold distributions of correlations.
15078  
15079  TString correlationIndex[4] = {"<2>","<4>","<6>","<8>"}; // to be improved (should I promote this to data members?)
15080   
15081  // a) Book profile to hold all flags for distributions of correlations:
15082  TString distributionsFlagsName = "fDistributionsFlags";
15083  distributionsFlagsName += fAnalysisLabel->Data();
15084  fDistributionsFlags = new TProfile(distributionsFlagsName.Data(),"Flags for Distributions of Correlations",9,0,9);
15085  fDistributionsFlags->SetTickLength(-0.01,"Y");
15086  fDistributionsFlags->SetMarkerStyle(25);
15087  fDistributionsFlags->SetLabelSize(0.05);
15088  fDistributionsFlags->SetLabelOffset(0.02,"Y");
15089  fDistributionsFlags->SetStats(kFALSE);
15090  fDistributionsFlags->GetXaxis()->SetBinLabel(1,"Store or not?");
15091  fDistributionsFlags->GetXaxis()->SetBinLabel(2,"<2>_{min}");
15092  fDistributionsFlags->GetXaxis()->SetBinLabel(3,"<2>_{max}");
15093  fDistributionsFlags->GetXaxis()->SetBinLabel(4,"<4>_{min}");
15094  fDistributionsFlags->GetXaxis()->SetBinLabel(5,"<4>_{max}");
15095  fDistributionsFlags->GetXaxis()->SetBinLabel(6,"<6>_{min}");
15096  fDistributionsFlags->GetXaxis()->SetBinLabel(7,"<6>_{max}");
15097  fDistributionsFlags->GetXaxis()->SetBinLabel(8,"<8>_{min}");
15098  fDistributionsFlags->GetXaxis()->SetBinLabel(9,"<8>_{max}");
15099  fDistributionsList->Add(fDistributionsFlags);
15100  
15101  // b) Book all histograms to hold distributions of correlations.
15102  if(fStoreDistributions)
15103  { 
15104   TString distributionsName = "fDistributions";
15105   distributionsName += fAnalysisLabel->Data();
15106   for(Int_t di=0;di<4;di++) // distribution index
15107   {
15108    fDistributions[di] = new TH1D(Form("Distribution of %s",correlationIndex[di].Data()),Form("Distribution of %s",correlationIndex[di].Data()),10000,fMinValueOfCorrelation[di],fMaxValueOfCorrelation[di]); 
15109    fDistributions[di]->SetXTitle(correlationIndex[di].Data());
15110    fDistributionsList->Add(fDistributions[di]);
15111   } // end of for(Int_t di=0;di<4;di++) // distribution index
15112  } // end of if(fStoreDistributions)
15113  
15114 } // end of void AliFlowAnalysisWithQCumulants::BookEverythingForDistributions()
15115
15116 //=======================================================================================================================
15117
15118 void AliFlowAnalysisWithQCumulants::BookEverythingForVarious()
15119 {
15120  // Book all objects for various unclassified quantities.
15121  
15122  if(!fStorePhiDistributionForOneEvent){return;}
15123  
15124  // a) Book histogram holding phi distribution for single event to illustrate flow.
15125  
15126  // a) Book histogram holding phi distribution for single event to illustrate flow:
15127  fPhiDistributionForOneEvent = new TH1D("fPhiDistributionForOneEvent","",360,0.,TMath::TwoPi());
15128  fPhiDistributionForOneEvent->GetXaxis()->SetTitle("#phi");
15129  fVariousList->Add(fPhiDistributionForOneEvent);
15130  
15131 } // end of void AliFlowAnalysisWithQCumulants::BookEverythingForVarious()
15132
15133 //=======================================================================================================================
15134
15135 void AliFlowAnalysisWithQCumulants::StoreFlagsForDistributions()
15136 {
15137  // Store all flags for distributiuons of correlations in profile fDistributionsFlags.
15138  
15139  if(!fDistributionsFlags)
15140  {
15141   cout<<"WARNING: fDistributionsFlags is NULL in AFAWQC::SDF() !!!!"<<endl;
15142   exit(0);
15143  } 
15144
15145  fDistributionsFlags->Fill(0.5,(Int_t)fStoreDistributions); // histos with distributions of correlations stored or not in the output file
15146  // store min and max values of correlations:
15147  for(Int_t di=0;di<4;di++) // distribution index
15148  {
15149   fDistributionsFlags->Fill(1.5+2.*(Double_t)di,fMinValueOfCorrelation[di]);
15150   fDistributionsFlags->Fill(2.5+2.*(Double_t)di,fMaxValueOfCorrelation[di]);
15151  }
15152      
15153 } // end of void AliFlowAnalysisWithQCumulants::StoreFlagsForDistributions()
15154
15155 //=======================================================================================================================
15156
15157 void AliFlowAnalysisWithQCumulants::StoreDistributionsOfCorrelations()
15158 {
15159  // Store distributions of correlations.
15160  
15161  if(!(fIntFlowCorrelationsEBE && fIntFlowEventWeightsForCorrelationsEBE))
15162  {
15163   cout<<"WARNING: fIntFlowCorrelationsEBE && fIntFlowEventWeightsForCorrelationsEBE"<<endl; 
15164   cout<<"         is NULL in AFAWQC::SDOC() !!!!"<<endl;
15165   exit(0);
15166  }
15167
15168  for(Int_t di=0;di<4;di++) // distribution index
15169  {
15170   if(!fDistributions[di])
15171   { 
15172    cout<<"WARNING: fDistributions[di] is NULL in AFAWQC::SDOC() !!!!"<<endl;
15173    cout<<"di = "<<di<<endl;
15174    exit(0);
15175   } else 
15176     {
15177      fDistributions[di]->Fill(fIntFlowCorrelationsEBE->GetBinContent(di+1),fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(di+1)); 
15178     } 
15179  } // end of for(Int_t di=0;di<4;di++) // distribution index
15180
15181 } // end of void AliFlowAnalysisWithQCumulants::StoreDistributionsOfCorrelations()
15182
15183 //=======================================================================================================================
15184
15185 void AliFlowAnalysisWithQCumulants::BookAndNestAllLists()
15186 {
15187  // Book and nest all lists nested in the base list fHistList.
15188  //  a) Book and nest lists for integrated flow;
15189  //  b) Book and nest lists for differential flow;
15190  //  c) Book and nest list for particle weights;
15191  //  d) Book and nest list for distributions;
15192  //  e) Book and nest list for various unclassified objects; 
15193  //  f) Book and nest list for other differential correlators;
15194  //  g) Book and nest list for nested loops;
15195  //  h) Book and nest lists for mixed harmonics.
15196  
15197  // a) Book and nest all lists for integrated flow:
15198  //  Base list for integrated flow:
15199  fIntFlowList = new TList();
15200  fIntFlowList->SetName("Integrated Flow");
15201  fIntFlowList->SetOwner(kTRUE);
15202  fHistList->Add(fIntFlowList);
15203  //  List holding profiles: 
15204  fIntFlowProfiles = new TList();
15205  fIntFlowProfiles->SetName("Profiles");
15206  fIntFlowProfiles->SetOwner(kTRUE);
15207  fIntFlowList->Add(fIntFlowProfiles);
15208  //  List holding all profiles with results for correlations vs M:
15209  if(fCalculateAllCorrelationsVsM)
15210  {
15211   fIntFlowAllCorrelationsVsM = new TList();
15212   fIntFlowAllCorrelationsVsM->SetName("Correlations vs M");
15213   fIntFlowAllCorrelationsVsM->SetOwner(kTRUE); 
15214   fIntFlowProfiles->Add(fIntFlowAllCorrelationsVsM);
15215  } // end of if(fCalculateAllCorrelationsVsM)
15216  //  List holding histograms with results:
15217  fIntFlowResults = new TList();
15218  fIntFlowResults->SetName("Results");
15219  fIntFlowResults->SetOwner(kTRUE);
15220  fIntFlowList->Add(fIntFlowResults);
15221  
15222  // b) Book and nest lists for differential flow:
15223  this->BookAndNestListsForDifferentialFlow();
15224  
15225  // c) Book and nest list for particle weights:
15226  fWeightsList->SetName("Weights");
15227  fWeightsList->SetOwner(kTRUE);   
15228  fHistList->Add(fWeightsList); 
15229
15230  // d) Book and nest list for distributions:
15231  fDistributionsList = new TList();
15232  fDistributionsList->SetName("Distributions");
15233  fDistributionsList->SetOwner(kTRUE);
15234  fHistList->Add(fDistributionsList);
15235  
15236  // e) Book and nest list for various unclassified objects:
15237  if(fStorePhiDistributionForOneEvent)
15238  {
15239   fVariousList = new TList();
15240   fVariousList->SetName("Various");
15241   fVariousList->SetOwner(kTRUE);
15242   fHistList->Add(fVariousList);
15243  }
15244   
15245  // f) Book and nest list for other differential correlators:
15246  fOtherDiffCorrelatorsList = new TList();
15247  fOtherDiffCorrelatorsList->SetName("Other differential correlators");
15248  fOtherDiffCorrelatorsList->SetOwner(kTRUE);
15249  if(fCalculateDiffFlow){fHistList->Add(fOtherDiffCorrelatorsList);} // TBI: Use another flag here instead of fCalculateDiffFlow 
15250   
15251  // g) Book and nest list for nested loops:
15252  fNestedLoopsList = new TList();
15253  fNestedLoopsList->SetName("Nested Loops");
15254  fNestedLoopsList->SetOwner(kTRUE);
15255  fHistList->Add(fNestedLoopsList);
15256
15257  // h) Book and nest lists for mixed harmonics:
15258  //  Base list for mixed harmonics:
15259  fMixedHarmonicsList = new TList();
15260  fMixedHarmonicsList->SetName("Mixed Harmonics");
15261  fMixedHarmonicsList->SetOwner(kTRUE);
15262  fHistList->Add(fMixedHarmonicsList);
15263  //  List holding profiles: 
15264  fMixedHarmonicsProfiles = new TList();
15265  fMixedHarmonicsProfiles->SetName("Profiles");
15266  fMixedHarmonicsProfiles->SetOwner(kTRUE);
15267  if(fCalculateMixedHarmonics){fMixedHarmonicsList->Add(fMixedHarmonicsProfiles);}
15268  //  List holding histograms with results:
15269  fMixedHarmonicsResults = new TList();
15270  fMixedHarmonicsResults->SetName("Results");
15271  fMixedHarmonicsResults->SetOwner(kTRUE);
15272  if(fCalculateMixedHarmonics){fMixedHarmonicsList->Add(fMixedHarmonicsResults);}
15273  //  List holding objects for statistical error propagation of mixed harmonics:
15274  fMixedHarmonicsErrorPropagation = new TList();
15275  fMixedHarmonicsErrorPropagation->SetName("Error Propagation");
15276  fMixedHarmonicsErrorPropagation->SetOwner(kTRUE);
15277  if(fCalculateMixedHarmonics){fMixedHarmonicsList->Add(fMixedHarmonicsErrorPropagation);}
15278
15279 } // end of void AliFlowAnalysisWithQCumulants::BookAndNestAllLists()
15280
15281 //=======================================================================================================================
15282
15283 void AliFlowAnalysisWithQCumulants::BookAndNestListsForDifferentialFlow()
15284 {
15285  // Book and nest lists for differential flow.
15286
15287  // Base list for differential flow objects:
15288  fDiffFlowList = new TList();
15289  fDiffFlowList->SetName("Differential Flow");
15290  fDiffFlowList->SetOwner(kTRUE); 
15291  fHistList->Add(fDiffFlowList);
15292  
15293  // Local flags: 
15294  TString typeFlag[2] = {"RP","POI"};  
15295  TString ptEtaFlag[2] = {"p_{T}","#eta"}; 
15296  TString powerFlag[2] = {"linear","quadratic"};   
15297
15298  // 2D:
15299  if(fCalculate2DDiffFlow)
15300  {
15301   fDiffFlow2D = new TList(); 
15302   fDiffFlow2D->SetName("2D");
15303   fDiffFlow2D->SetOwner(kTRUE);
15304   fDiffFlowList->Add(fDiffFlow2D); 
15305   for(Int_t t=0;t<2;t++)
15306   {
15307    f2DDiffFlowCorrelationsProList[t] = new TList();
15308    f2DDiffFlowCorrelationsProList[t]->SetOwner(kTRUE);
15309    f2DDiffFlowCorrelationsProList[t]->SetName(Form("Profiles with 2D correlations (%s)",typeFlag[t].Data()));
15310    fDiffFlow2D->Add(f2DDiffFlowCorrelationsProList[t]);
15311   } // end of for(Int_t t=0;t<2;t++)
15312  } // end of if(fCalculate2DDiffFlow)
15313
15314  // What follows bellow in this method is relevant only for 1D differential flow:
15315  if(!fCalculateDiffFlow){return;}
15316  
15317  // List holding profiles: 
15318  fDiffFlowProfiles = new TList(); 
15319  fDiffFlowProfiles->SetName("Profiles");
15320  fDiffFlowProfiles->SetOwner(kTRUE);
15321  fDiffFlowList->Add(fDiffFlowProfiles);
15322  // List holding histograms with results: 
15323  fDiffFlowResults = new TList();
15324  fDiffFlowResults->SetName("Results");
15325  fDiffFlowResults->SetOwner(kTRUE);
15326  fDiffFlowList->Add(fDiffFlowResults);
15327  // Flags used for naming nested lists in list fDiffFlowProfiles and fDiffFlowResults:  
15328  TList list;
15329  list.SetOwner(kTRUE);
15330  // Nested lists in fDiffFlowProfiles (~/Differential Flow/Profiles):
15331  for(Int_t t=0;t<2;t++) // type: RP or POI
15332  {
15333   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
15334   {
15335    // list holding profiles with correlations:
15336    fDiffFlowCorrelationsProList[t][pe] = (TList*)list.Clone();
15337    fDiffFlowCorrelationsProList[t][pe]->SetName(Form("Profiles with correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15338    fDiffFlowProfiles->Add(fDiffFlowCorrelationsProList[t][pe]);
15339    // list holding profiles with products of correlations:
15340    fDiffFlowProductOfCorrelationsProList[t][pe] = (TList*)list.Clone();
15341    fDiffFlowProductOfCorrelationsProList[t][pe]->SetName(Form("Profiles with products of correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15342    fDiffFlowProfiles->Add(fDiffFlowProductOfCorrelationsProList[t][pe]);
15343    // list holding profiles with corrections:
15344    fDiffFlowCorrectionsProList[t][pe] = (TList*)list.Clone();
15345    fDiffFlowCorrectionsProList[t][pe]->SetName(Form("Profiles with correction terms for NUA (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15346    fDiffFlowProfiles->Add(fDiffFlowCorrectionsProList[t][pe]);   
15347   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
15348  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI   
15349  // nested lists in fDiffFlowResults (~/Differential Flow/Results):
15350  for(Int_t t=0;t<2;t++) // type: RP or POI
15351  {
15352   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
15353   {
15354    // list holding histograms with correlations:
15355    fDiffFlowCorrelationsHistList[t][pe] = (TList*)list.Clone();
15356    fDiffFlowCorrelationsHistList[t][pe]->SetName(Form("Correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15357    fDiffFlowResults->Add(fDiffFlowCorrelationsHistList[t][pe]);
15358    // list holding histograms with corrections:
15359    fDiffFlowCorrectionsHistList[t][pe] = (TList*)list.Clone();
15360    fDiffFlowCorrectionsHistList[t][pe]->SetName(Form("Histograms with correction terms for NUA (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15361    fDiffFlowResults->Add(fDiffFlowCorrectionsHistList[t][pe]);   
15362    for(Int_t power=0;power<2;power++)
15363    {
15364     // list holding histograms with sums of event weights:
15365     fDiffFlowSumOfEventWeightsHistList[t][pe][power] = (TList*)list.Clone();
15366     fDiffFlowSumOfEventWeightsHistList[t][pe][power]->SetName(Form("Sum of %s event weights (%s, %s)",powerFlag[power].Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15367     fDiffFlowResults->Add(fDiffFlowSumOfEventWeightsHistList[t][pe][power]);    
15368    } // end of for(Int_t power=0;power<2;power++)
15369    // list holding histograms with sums of products of event weights:
15370    fDiffFlowSumOfProductOfEventWeightsHistList[t][pe] = (TList*)list.Clone();
15371    fDiffFlowSumOfProductOfEventWeightsHistList[t][pe]->SetName(Form("Sum of products of event weights (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15372    fDiffFlowResults->Add(fDiffFlowSumOfProductOfEventWeightsHistList[t][pe]);
15373    // list holding histograms with covariances of correlations:
15374    fDiffFlowCovariancesHistList[t][pe] = (TList*)list.Clone();
15375    fDiffFlowCovariancesHistList[t][pe]->SetName(Form("Covariances of correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15376    fDiffFlowResults->Add(fDiffFlowCovariancesHistList[t][pe]);
15377    // list holding histograms with differential Q-cumulants:
15378    fDiffFlowCumulantsHistList[t][pe] = (TList*)list.Clone();
15379    fDiffFlowCumulantsHistList[t][pe]->SetName(Form("Differential Q-cumulants (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15380    fDiffFlowResults->Add(fDiffFlowCumulantsHistList[t][pe]);   
15381    // list holding histograms which quantify detector bias to differential Q-cumulants:
15382    fDiffFlowDetectorBiasHistList[t][pe] = (TList*)list.Clone();
15383    fDiffFlowDetectorBiasHistList[t][pe]->SetName(Form("Detector bias (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15384    fDiffFlowResults->Add(fDiffFlowDetectorBiasHistList[t][pe]);   
15385    // list holding histograms with differential flow estimates from Q-cumulants:
15386    fDiffFlowHistList[t][pe] = (TList*)list.Clone();
15387    fDiffFlowHistList[t][pe]->SetName(Form("Differential flow (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));
15388    fDiffFlowResults->Add(fDiffFlowHistList[t][pe]);      
15389   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
15390  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
15391   
15392 } // end of void AliFlowAnalysisWithQCumulants::BookAndNestListsForDifferentialFlow()
15393
15394 //=======================================================================================================================
15395
15396 void AliFlowAnalysisWithQCumulants::FillCommonHistResultsDiffFlow(TString type)
15397 {
15398  // Fill common result histograms for differential flow.
15399  
15400  Int_t t = 0; 
15401
15402  if(type == "RP")
15403  {
15404   t = 0;
15405  } else if(type == "POI")
15406    {
15407     t = 1;
15408    } 
15409   
15410  // to be improved - check all pointers used in this method
15411      
15412  if(!(fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th))
15413  {
15414   cout<<"WARNING: fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th"<<endl; 
15415   cout<<"         is NULL in AFAWQC::FCHRIF() !!!!"<<endl;
15416   exit(0);
15417  }
15418  
15419  // pt:
15420  for(Int_t p=1;p<=fnBinsPt;p++)
15421  {
15422   Double_t v2 = fDiffFlow[t][0][0]->GetBinContent(p);
15423   Double_t v4 = fDiffFlow[t][0][1]->GetBinContent(p);
15424   Double_t v6 = fDiffFlow[t][0][2]->GetBinContent(p);
15425   Double_t v8 = fDiffFlow[t][0][3]->GetBinContent(p);
15426   
15427   Double_t v2Error = fDiffFlow[t][0][0]->GetBinError(p);
15428   Double_t v4Error = fDiffFlow[t][0][1]->GetBinError(p);
15429   //Double_t v6Error = fFinalFlow1D[t][pW][nua][0][2]->GetBinError(p);
15430   //Double_t v8Error = fFinalFlow1D[t][pW][nua][0][3]->GetBinError(p);
15431  
15432   if(type == "RP")
15433   {
15434    fCommonHistsResults2nd->FillDifferentialFlowPtRP(p,v2,v2Error);
15435    fCommonHistsResults4th->FillDifferentialFlowPtRP(p,v4,v4Error);
15436    fCommonHistsResults6th->FillDifferentialFlowPtRP(p,v6,0.);
15437    fCommonHistsResults8th->FillDifferentialFlowPtRP(p,v8,0.);
15438   } else if(type == "POI")
15439     {
15440      fCommonHistsResults2nd->FillDifferentialFlowPtPOI(p,v2,v2Error);
15441      fCommonHistsResults4th->FillDifferentialFlowPtPOI(p,v4,v4Error);
15442      fCommonHistsResults6th->FillDifferentialFlowPtPOI(p,v6,0.);
15443      fCommonHistsResults8th->FillDifferentialFlowPtPOI(p,v8,0.);
15444     }
15445  } // end of for(Int_t p=1;p<=fnBinsPt;p++)   
15446  
15447  // eta:
15448  if(!fCalculateDiffFlowVsEta){return;}
15449  for(Int_t e=1;e<=fnBinsEta;e++)
15450  {
15451   Double_t v2 = fDiffFlow[t][1][0]->GetBinContent(e);
15452   Double_t v4 = fDiffFlow[t][1][1]->GetBinContent(e);
15453   Double_t v6 = fDiffFlow[t][1][2]->GetBinContent(e);
15454   Double_t v8 = fDiffFlow[t][1][3]->GetBinContent(e);
15455   
15456   Double_t v2Error = fDiffFlow[t][1][0]->GetBinError(e);
15457   Double_t v4Error = fDiffFlow[t][1][1]->GetBinError(e);
15458   //Double_t v6Error = fDiffFlow[t][1][2]->GetBinError(e);
15459   //Double_t v8Error = fDiffFlow[t][1][3]->GetBinError(e);
15460  
15461   if(type == "RP")
15462   {
15463    fCommonHistsResults2nd->FillDifferentialFlowEtaRP(e,v2,v2Error);
15464    fCommonHistsResults4th->FillDifferentialFlowEtaRP(e,v4,v4Error);
15465    fCommonHistsResults6th->FillDifferentialFlowEtaRP(e,v6,0.);
15466    fCommonHistsResults8th->FillDifferentialFlowEtaRP(e,v8,0.);
15467   } else if(type == "POI")
15468     {
15469      fCommonHistsResults2nd->FillDifferentialFlowEtaPOI(e,v2,v2Error);
15470      fCommonHistsResults4th->FillDifferentialFlowEtaPOI(e,v4,v4Error);
15471      fCommonHistsResults6th->FillDifferentialFlowEtaPOI(e,v6,0.);
15472      fCommonHistsResults8th->FillDifferentialFlowEtaPOI(e,v8,0.);
15473     }
15474  } // end of for(Int_t e=1;e<=fnBinsEta;e++)    
15475  
15476 } // end of void AliFlowAnalysisWithQCumulants::FillCommonHistResultsDiffFlow(TString type, Bool_t useParticleWeights, TString eventWeights, Bool_t correctedForNUA)
15477
15478 //=======================================================================================================================
15479
15480 void AliFlowAnalysisWithQCumulants::CommonConstants(TString method)
15481 {
15482  // Access and store common constants.
15483  
15484  // a) If this method was called in Init() access common constants from AliFlowCommonConstants;
15485  // b) If this method was called in Init() book and fill TProfile to hold constants accessed in a);
15486  // c) If this method was called in Finish() access common constants from TProfile booked and filled in b).
15487
15488  if(method == "Init")
15489  {
15490   // a) If this method was called in Init() access common constants from AliFlowCommonConstants:
15491   fnBinsPhi = AliFlowCommonConstants::GetMaster()->GetNbinsPhi();
15492   fPhiMin = AliFlowCommonConstants::GetMaster()->GetPhiMin();        
15493   fPhiMax = AliFlowCommonConstants::GetMaster()->GetPhiMax();
15494   if(fnBinsPhi){fPhiBinWidth = (fPhiMax-fPhiMin)/fnBinsPhi;}  
15495   fnBinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
15496   fPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();          
15497   fPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
15498   if(fnBinsPt){fPtBinWidth = (fPtMax-fPtMin)/fnBinsPt;}  
15499   fnBinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
15500   fEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();        
15501   fEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();
15502   if(fnBinsEta){fEtaBinWidth = (fEtaMax-fEtaMin)/fnBinsEta;}  
15503   
15504   // b) If this method was called in Init() book and fill TProfile to hold constants accessed in a):
15505   TString fCommonConstantsName = "fCommonConstants";
15506   fCommonConstantsName += fAnalysisLabel->Data();
15507   fCommonConstants = new TProfile(fCommonConstantsName.Data(),"Common constants",9,0.,9.);
15508   fCommonConstants->SetLabelSize(0.05);
15509   fCommonConstants->GetXaxis()->SetBinLabel(1,"nBins (#phi)");
15510   fCommonConstants->Fill(0.5,fnBinsPhi);
15511   fCommonConstants->GetXaxis()->SetBinLabel(2,"#phi_{min}");
15512   fCommonConstants->Fill(1.5,fPhiMin);
15513   fCommonConstants->GetXaxis()->SetBinLabel(3,"#phi_{max}");
15514   fCommonConstants->Fill(2.5,fPhiMax);
15515   fCommonConstants->GetXaxis()->SetBinLabel(4,"nBins (p_{t})");
15516   fCommonConstants->Fill(3.5,fnBinsPt);
15517   fCommonConstants->GetXaxis()->SetBinLabel(5,"(p_{t})_{min}");
15518   fCommonConstants->Fill(4.5,fPtMin);
15519   fCommonConstants->GetXaxis()->SetBinLabel(6,"(p_{t})_{max}");
15520   fCommonConstants->Fill(5.5,fPtMax);
15521   fCommonConstants->GetXaxis()->SetBinLabel(7,"nBins (#eta)");
15522   fCommonConstants->Fill(6.5,fnBinsEta);
15523   fCommonConstants->GetXaxis()->SetBinLabel(8,"#eta_{min}");
15524   fCommonConstants->Fill(7.5,fEtaMin);
15525   fCommonConstants->GetXaxis()->SetBinLabel(9,"#eta_{max}");
15526   fCommonConstants->Fill(8.5,fEtaMax);
15527   fHistList->Add(fCommonConstants); 
15528  } // end of if(method == "Init")
15529  else if(method == "Finish")
15530  {
15531   // c) If this method was called in Finish() access common constants from TProfile booked and filled in b):
15532   if(!fCommonConstants)
15533   {
15534    printf("\n WARNING (QC): fCommonConstants is NULL in AFAWQC::AC(\"%s\") !!!!\n\n",method.Data());
15535    exit(0);
15536   } 
15537   fnBinsPhi = (Int_t)fCommonConstants->GetBinContent(1);
15538   fPhiMin = fCommonConstants->GetBinContent(2);      
15539   fPhiMax = fCommonConstants->GetBinContent(3);
15540   if(fnBinsPhi){fPhiBinWidth = (fPhiMax-fPhiMin)/fnBinsPhi;}  
15541   fnBinsPt = (Int_t)fCommonConstants->GetBinContent(4);
15542   fPtMin = fCommonConstants->GetBinContent(5);       
15543   fPtMax = fCommonConstants->GetBinContent(6);
15544   if(fnBinsPt){fPtBinWidth = (fPtMax-fPtMin)/fnBinsPt;}  
15545   fnBinsEta = (Int_t)fCommonConstants->GetBinContent(7);
15546   fEtaMin = fCommonConstants->GetBinContent(8);      
15547   fEtaMax = fCommonConstants->GetBinContent(9);
15548   if(fnBinsEta){fEtaBinWidth = (fEtaMax-fEtaMin)/fnBinsEta;}  
15549  } // end of else if(method == "Finish")
15550
15551 } // end of void AliFlowAnalysisWithQCumulants::CommonConstants(TString method)
15552
15553 //=======================================================================================================================
15554
15555 void AliFlowAnalysisWithQCumulants::CrossCheckSettings()
15556 {
15557  // a) Cross check if the choice for multiplicity weights make sense.
15558  
15559  // a) Cross check if the choice for multiplicity weights make sense:
15560  if(strcmp(fMultiplicityWeight->Data(),"combinations") && 
15561     strcmp(fMultiplicityWeight->Data(),"unit") &&
15562     strcmp(fMultiplicityWeight->Data(),"multiplicity"))
15563  {
15564   cout<<"WARNING (QC): Multiplicity weight can be either \"combinations\", \"unit\""<<endl;
15565   cout<<"              or \"multiplicity\". Certainly not \""<<fMultiplicityWeight->Data()<<"\"."<<endl;
15566   exit(0);
15567  }   
15568  
15569 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckSettings()
15570
15571 //=======================================================================================================================
15572
15573 void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfEventWeights()
15574 {
15575  // Calculate sum of linear and quadratic event weights for correlations.
15576  
15577  // multiplicity:
15578  Double_t dMult = (*fSpk)(0,0);
15579
15580  // Multiplicity bin of an event (relevant for all histos vs M): 
15581  Double_t dMultiplicityBin = 0.;
15582  if(!fMultiplicityIsRefMultiplicity)
15583  {
15584   dMultiplicityBin = dMult+0.5;
15585  } else
15586    {
15587     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
15588    }
15589                         
15590  for(Int_t p=0;p<2;p++) // power-1
15591  {
15592   for(Int_t ci=0;ci<4;ci++) // correlation index
15593   { 
15594    fIntFlowSumOfEventWeights[p]->Fill(ci+0.5,pow(fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci+1),p+1)); 
15595    if(fCalculateCumulantsVsM)
15596    {
15597     fIntFlowSumOfEventWeightsVsM[ci][p]->Fill(dMultiplicityBin,pow(fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci+1),p+1)); // to be improved: dMult => sum of weights?
15598    }
15599   }
15600  }
15601   
15602 } // end of void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfEventWeights()
15603
15604 //=======================================================================================================================
15605
15606 void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfEventWeightsNUA()
15607 {
15608  // Calculate sum of linear and quadratic event weights for NUA terms.
15609                        
15610  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
15611  {
15612   for(Int_t p=0;p<2;p++) // power-1
15613   {
15614    for(Int_t ci=0;ci<4;ci++) // nua term index
15615    { 
15616     fIntFlowSumOfEventWeightsNUA[sc][p]->Fill(ci+0.5,pow(fIntFlowEventWeightForCorrectionTermsForNUAEBE[sc]->GetBinContent(ci+1),p+1)); 
15617    }
15618   }
15619  }
15620   
15621 } // end of void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfEventWeightsNUA()
15622
15623 //=======================================================================================================================
15624
15625 void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfProductOfEventWeights()
15626 {
15627  // Calculate sum of product of event weights for correlations.
15628   
15629  // multiplicity:
15630  Double_t dMult = (*fSpk)(0,0);
15631
15632  // Multiplicity bin of an event (relevant for all histos vs M): 
15633  Double_t dMultiplicityBin = 0.;
15634  if(!fMultiplicityIsRefMultiplicity)
15635  {
15636   dMultiplicityBin = dMult+0.5;
15637  } else
15638    {
15639     dMultiplicityBin = fReferenceMultiplicityEBE+0.5;
15640    }
15641   
15642  Int_t counter = 0;
15643  
15644  for(Int_t ci1=1;ci1<4;ci1++)
15645  {
15646   for(Int_t ci2=ci1+1;ci2<=4;ci2++)
15647   {
15648    fIntFlowSumOfProductOfEventWeights->Fill(0.5+counter,
15649                                             fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci1)*
15650                                             fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci2));
15651    if(fCalculateCumulantsVsM)
15652    {                                                                                    
15653     fIntFlowSumOfProductOfEventWeightsVsM[counter]->Fill(dMultiplicityBin, // to be improved: dMult => sum of weights?
15654                                                          fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci1)*
15655                                                          fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci2));
15656    } // end of if(fCalculateCumulantsVsM)
15657    counter++;                                         
15658   }
15659  }
15660
15661 } // end of void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfProductOfEventWeights()
15662
15663 //=======================================================================================================================
15664
15665 void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfProductOfEventWeightsNUA()
15666 {
15667  // Calculate sum of product of event weights for NUA terms.
15668   
15669  // w_{<2>} * w_{<cos(#phi)>}:
15670  fIntFlowSumOfProductOfEventWeightsNUA->Fill(0.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
15671                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1));
15672  // w_{<2>} * w_{<sin(#phi)>}:
15673  fIntFlowSumOfProductOfEventWeightsNUA->Fill(1.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
15674                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
15675  // w_{<cos(#phi)> * w_{<sin(#phi)>}:
15676  fIntFlowSumOfProductOfEventWeightsNUA->Fill(2.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
15677                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
15678  // w_{<2>} * w{<cos(phi1+phi2)>}
15679  fIntFlowSumOfProductOfEventWeightsNUA->Fill(3.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
15680                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
15681  // w_{<2>} * w{<sin(phi1+phi2)>}
15682  fIntFlowSumOfProductOfEventWeightsNUA->Fill(4.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
15683                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));
15684  // w_{<2>} * w{<cos(phi1-phi2-phi3)>}
15685  fIntFlowSumOfProductOfEventWeightsNUA->Fill(5.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
15686                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));
15687  // w_{<2>} * w{<sin(phi1-phi2-phi3)>}
15688  fIntFlowSumOfProductOfEventWeightsNUA->Fill(6.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1)*
15689                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));  
15690  // w_{<4>} * w{<cos(phi1)>}
15691  fIntFlowSumOfProductOfEventWeightsNUA->Fill(7.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
15692                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1));
15693  // w_{<4>} * w{<sin(phi1)>}
15694  fIntFlowSumOfProductOfEventWeightsNUA->Fill(8.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
15695                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1));
15696  // w_{<4>} * w{<cos(phi1+phi2)>}
15697  fIntFlowSumOfProductOfEventWeightsNUA->Fill(9.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
15698                                                  fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)); 
15699  // w_{<4>} * w{<sin(phi1+phi2)>}
15700  fIntFlowSumOfProductOfEventWeightsNUA->Fill(10.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
15701                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));
15702  // w_{<4>} * w{<cos(phi1-phi2-phi3)>}
15703  fIntFlowSumOfProductOfEventWeightsNUA->Fill(11.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
15704                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));
15705  // w_{<4>} * w{<sin(phi1-phi2-phi3)>}
15706  fIntFlowSumOfProductOfEventWeightsNUA->Fill(12.5,fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2)*
15707                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));
15708  // w_{<cos(phi1)>} * w{<cos(phi1+phi2)>}
15709  fIntFlowSumOfProductOfEventWeightsNUA->Fill(13.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
15710                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2));
15711  // w_{<cos(phi1)>} * w{<sin(phi1+phi2)>}
15712  fIntFlowSumOfProductOfEventWeightsNUA->Fill(14.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
15713                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
15714  // w_{<cos(phi1)>} * w{<cos(phi1-phi2-phi3)>}
15715  fIntFlowSumOfProductOfEventWeightsNUA->Fill(15.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
15716                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));
15717  // w_{<cos(phi1)>} * w{<sin(phi1-phi2-phi3)>}
15718  fIntFlowSumOfProductOfEventWeightsNUA->Fill(16.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(1)*
15719                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));
15720  // w_{<sin(phi1)>} * w{<cos(phi1+phi2)>}
15721  fIntFlowSumOfProductOfEventWeightsNUA->Fill(17.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)*
15722                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2));
15723  // w_{<sin(phi1)>} * w{<sin(phi1+phi2)>}
15724  fIntFlowSumOfProductOfEventWeightsNUA->Fill(18.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)*
15725                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2));
15726  // w_{<sin(phi1)>} * w{<cos(phi1-phi2-phi3)>}
15727  fIntFlowSumOfProductOfEventWeightsNUA->Fill(19.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)*
15728                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3));
15729  // w_{<sin(phi1)>} * w{<sin(phi1-phi2-phi3)>}
15730  fIntFlowSumOfProductOfEventWeightsNUA->Fill(20.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(1)*
15731                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
15732  // w_{<cos(phi1+phi2)>} * w{<sin(phi1+phi2))>}
15733  fIntFlowSumOfProductOfEventWeightsNUA->Fill(21.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)*
15734                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)); 
15735  // w_{<cos(phi1+phi2)>} * w{<cos(phi1-phi2-phi3)>}
15736  fIntFlowSumOfProductOfEventWeightsNUA->Fill(22.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)*
15737                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
15738  // w_{<cos(phi1+phi2)>} * w{<sin(phi1-phi2-phi3)>}
15739  fIntFlowSumOfProductOfEventWeightsNUA->Fill(23.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(2)*
15740                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
15741  // w_{<sin(phi1+phi2)>} * w{<cos(phi1-phi2-phi3)>}
15742  fIntFlowSumOfProductOfEventWeightsNUA->Fill(24.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)*
15743                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)); 
15744  // w_{<sin(phi1+phi2)>} * w{<sin(phi1-phi2-phi3)>}
15745  fIntFlowSumOfProductOfEventWeightsNUA->Fill(25.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(2)*
15746                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3)); 
15747  // w_{<cos(phi1-phi2-phi3)>} * w{<sin(phi1-phi2-phi3)>}
15748  fIntFlowSumOfProductOfEventWeightsNUA->Fill(26.5,fIntFlowEventWeightForCorrectionTermsForNUAEBE[1]->GetBinContent(3)*
15749                                                   fIntFlowEventWeightForCorrectionTermsForNUAEBE[0]->GetBinContent(3));
15750
15751 } // end of void AliFlowAnalysisWithQCumulants::CalculateIntFlowIntFlowSumOfProductOfEventWeightsNUA()
15752
15753 //=======================================================================================================================
15754
15755 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrelations(TString type, TString ptOrEta)
15756 {
15757  // Calculate reduced correlations for RPs or POIs for all pt and eta bins.
15758
15759  // Multiplicity:
15760  Double_t dMult = (*fSpk)(0,0);
15761  
15762  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
15763  Double_t dReQ1n = (*fReQ)(0,0);
15764  Double_t dReQ2n = (*fReQ)(1,0);
15765  //Double_t dReQ3n = (*fReQ)(2,0);
15766  //Double_t dReQ4n = (*fReQ)(3,0);
15767  Double_t dImQ1n = (*fImQ)(0,0);
15768  Double_t dImQ2n = (*fImQ)(1,0);
15769  //Double_t dImQ3n = (*fImQ)(2,0);
15770  //Double_t dImQ4n = (*fImQ)(3,0);
15771
15772  // reduced correlations are stored in fDiffFlowCorrelationsPro[0=RP,1=POI][0=pt,1=eta][correlation index]. Correlation index runs as follows:
15773  // 
15774  // 0: <<2'>>
15775  // 1: <<4'>>
15776  // 2: <<6'>>
15777  // 3: <<8'>>
15778  
15779  //Int_t t = 0; // type flag 
15780  Int_t pe = 0; // ptEta flag
15781  
15782  if(type == "RP")
15783  {
15784   //t = 0;
15785  } else if(type == "POI")
15786    {
15787     //t = 1;
15788    }
15789
15790  if(ptOrEta == "Pt")
15791  {
15792   pe = 0;
15793  } else if(ptOrEta == "Eta")
15794    {
15795     pe = 1;
15796    }
15797     
15798  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
15799  Double_t minPtEta[2] = {fPtMin,fEtaMin};
15800  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
15801  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
15802
15803  // looping over all bins and calculating reduced correlations: 
15804  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
15805  {
15806   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
15807   Double_t p1n0kRe = 0.;
15808   Double_t p1n0kIm = 0.;
15809
15810   // number of POIs in particular pt or eta bin:
15811   Double_t mp = 0.;
15812
15813   // 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):
15814   Double_t q1n0kRe = 0.;
15815   Double_t q1n0kIm = 0.;
15816   Double_t q2n0kRe = 0.;
15817   Double_t q2n0kIm = 0.;
15818
15819   // number of particles which are both RPs and POIs in particular pt or eta bin:
15820   Double_t mq = 0.;
15821    
15822   if(type == "POI")
15823   {
15824    // q_{m*n,0}:
15825    q1n0kRe = fReRPQ1dEBE[2][pe][0][0]->GetBinContent(fReRPQ1dEBE[2][pe][0][0]->GetBin(b))
15826            * fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b));
15827    q1n0kIm = fImRPQ1dEBE[2][pe][0][0]->GetBinContent(fImRPQ1dEBE[2][pe][0][0]->GetBin(b))
15828            * fImRPQ1dEBE[2][pe][0][0]->GetBinEntries(fImRPQ1dEBE[2][pe][0][0]->GetBin(b));
15829    q2n0kRe = fReRPQ1dEBE[2][pe][1][0]->GetBinContent(fReRPQ1dEBE[2][pe][1][0]->GetBin(b))
15830            * fReRPQ1dEBE[2][pe][1][0]->GetBinEntries(fReRPQ1dEBE[2][pe][1][0]->GetBin(b));
15831    q2n0kIm = fImRPQ1dEBE[2][pe][1][0]->GetBinContent(fImRPQ1dEBE[2][pe][1][0]->GetBin(b))
15832            * fImRPQ1dEBE[2][pe][1][0]->GetBinEntries(fImRPQ1dEBE[2][pe][1][0]->GetBin(b));         
15833                  
15834    mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
15835   } 
15836   else if(type == "RP")
15837   {
15838    // q_{m*n,0}:
15839    q1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
15840            * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
15841    q1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))
15842            * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
15843    q2n0kRe = fReRPQ1dEBE[0][pe][1][0]->GetBinContent(fReRPQ1dEBE[0][pe][1][0]->GetBin(b))
15844            * fReRPQ1dEBE[0][pe][1][0]->GetBinEntries(fReRPQ1dEBE[0][pe][1][0]->GetBin(b));
15845    q2n0kIm = fImRPQ1dEBE[0][pe][1][0]->GetBinContent(fImRPQ1dEBE[0][pe][1][0]->GetBin(b))
15846            * fImRPQ1dEBE[0][pe][1][0]->GetBinEntries(fImRPQ1dEBE[0][pe][1][0]->GetBin(b));         
15847                  
15848    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)  
15849   }
15850       
15851    if(type == "POI")
15852    {
15853     // p_{m*n,0}:
15854     p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
15855             * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
15856     p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
15857             * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
15858             
15859     mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
15860     
15861     //t = 1; // typeFlag = RP or POI
15862    }
15863    else if(type == "RP")
15864    {
15865     // p_{m*n,0} = q_{m*n,0}:
15866     p1n0kRe = q1n0kRe; 
15867     p1n0kIm = q1n0kIm; 
15868             
15869     mp = mq; 
15870     
15871     //t = 0; // typeFlag = RP or POI
15872    }
15873       
15874    // 2'-particle correlation for particular pt or eta bin:
15875    Double_t two1n1nPtEta = 0.;
15876    Double_t mWeight2pPrime = 0.; // multiplicity weight for <2'>
15877    if(mp*dMult-mq)
15878    {
15879     two1n1nPtEta = (p1n0kRe*dReQ1n+p1n0kIm*dImQ1n-mq)
15880                  / (mp*dMult-mq);
15881     // determine multiplicity weight:
15882     if(!strcmp(fMultiplicityWeight->Data(),"combinations"))
15883     {
15884      mWeight2pPrime = mp*dMult-mq;
15885     } else if(!strcmp(fMultiplicityWeight->Data(),"unit"))
15886       {
15887        mWeight2pPrime = 1.;    
15888       } 
15889     if(type == "POI") // to be improved (I do not this if)
15890     { 
15891      // fill profile to get <<2'>> for POIs
15892      fDiffFlowCorrelationsPro[1][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nPtEta,mWeight2pPrime);
15893      // fill profile to get <<2'>^2> for POIs
15894      fDiffFlowSquaredCorrelationsPro[1][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nPtEta*two1n1nPtEta,mWeight2pPrime);   
15895      // histogram to store <2'> for POIs e-b-e (needed in some other methods):
15896      fDiffFlowCorrelationsEBE[1][pe][0]->SetBinContent(b,two1n1nPtEta);      
15897      fDiffFlowEventWeightsForCorrelationsEBE[1][pe][0]->SetBinContent(b,mWeight2pPrime);      
15898     }
15899     else if(type == "RP") // to be improved (I do not this if)
15900     {
15901      // profile to get <<2'>> for RPs:
15902      fDiffFlowCorrelationsPro[0][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nPtEta,mWeight2pPrime);     
15903      // profile to get <<2'>^2> for RPs:
15904      fDiffFlowSquaredCorrelationsPro[0][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nPtEta*two1n1nPtEta,mWeight2pPrime);          
15905      // histogram to store <2'> for RPs e-b-e (needed in some other methods):
15906      fDiffFlowCorrelationsEBE[0][pe][0]->SetBinContent(b,two1n1nPtEta); 
15907      fDiffFlowEventWeightsForCorrelationsEBE[0][pe][0]->SetBinContent(b,mWeight2pPrime); 
15908     }
15909    } // end of if(mp*dMult-mq)
15910   
15911    // 4'-particle correlation:
15912    Double_t four1n1n1n1nPtEta = 0.;
15913    Double_t mWeight4pPrime = 0.; // multiplicity weight for <4'>
15914    if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
15915        + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)) // to be improved (introduce a new variable for this expression)
15916    {
15917     four1n1n1n1nPtEta = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)
15918                       - q2n0kRe*(pow(dReQ1n,2.)-pow(dImQ1n,2.))
15919                       - 2.*q2n0kIm*dReQ1n*dImQ1n
15920                       - p1n0kRe*(dReQ1n*dReQ2n+dImQ1n*dImQ2n)
15921                       + p1n0kIm*(dImQ1n*dReQ2n-dReQ1n*dImQ2n)
15922                       - 2.*dMult*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)
15923                       - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*mq                      
15924                       + 6.*(q1n0kRe*dReQ1n+q1n0kIm*dImQ1n)                                            
15925                       + 1.*(q2n0kRe*dReQ2n+q2n0kIm*dImQ2n)                      
15926                       + 2.*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)                       
15927                       + 2.*mq*dMult                      
15928                       - 6.*mq)        
15929                       / ((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
15930                           + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
15931     // determine multiplicity weight:
15932     if(!strcmp(fMultiplicityWeight->Data(),"combinations"))
15933     {
15934      mWeight4pPrime = (mp-mq)*dMult*(dMult-1.)*(dMult-2.) + mq*(dMult-1.)*(dMult-2.)*(dMult-3.);
15935     } else if(!strcmp(fMultiplicityWeight->Data(),"unit"))
15936       {
15937        mWeight4pPrime = 1.;    
15938       }     
15939     if(type == "POI")
15940     {
15941      // profile to get <<4'>> for POIs:
15942      fDiffFlowCorrelationsPro[1][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nPtEta,mWeight4pPrime);      
15943      // profile to get <<4'>^2> for POIs:
15944      fDiffFlowSquaredCorrelationsPro[1][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nPtEta*four1n1n1n1nPtEta,mWeight4pPrime); 
15945      // histogram to store <4'> for POIs e-b-e (needed in some other methods):
15946      fDiffFlowCorrelationsEBE[1][pe][1]->SetBinContent(b,four1n1n1n1nPtEta);                               
15947      fDiffFlowEventWeightsForCorrelationsEBE[1][pe][1]->SetBinContent(b,mWeight4pPrime);                               
15948     }
15949     else if(type == "RP")
15950     {
15951      // profile to get <<4'>> for RPs:
15952      fDiffFlowCorrelationsPro[0][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nPtEta,mWeight4pPrime);    
15953      // profile to get <<4'>^2> for RPs:
15954      fDiffFlowSquaredCorrelationsPro[0][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nPtEta*four1n1n1n1nPtEta,mWeight4pPrime);    
15955      // histogram to store <4'> for RPs e-b-e (needed in some other methods):
15956      fDiffFlowCorrelationsEBE[0][pe][1]->SetBinContent(b,four1n1n1n1nPtEta);                   
15957      fDiffFlowEventWeightsForCorrelationsEBE[0][pe][1]->SetBinContent(b,mWeight4pPrime);                   
15958     }
15959    } // end of if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
15960      //            +mq*(dMult-1.)*(dMult-2.)*(dMult-3.))
15961    
15962  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
15963  
15964    
15965 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrelations(TString type, TString ptOrEta);
15966
15967 //=======================================================================================================================
15968
15969 void AliFlowAnalysisWithQCumulants::CalculateOtherDiffCorrelators(TString type, TString ptOrEta)
15970 {
15971  // Calculate other differential correlators for RPs or POIs for all pt and eta bins.
15972  
15973  // Multiplicity:
15974  Double_t dMult = (*fSpk)(0,0);
15975  
15976  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
15977  Double_t dReQ1n = (*fReQ)(0,0);
15978  Double_t dReQ2n = (*fReQ)(1,0);
15979  Double_t dReQ3n = (*fReQ)(2,0);
15980  //Double_t dReQ4n = (*fReQ)(3,0);
15981  Double_t dImQ1n = (*fImQ)(0,0);
15982  Double_t dImQ2n = (*fImQ)(1,0);
15983  Double_t dImQ3n = (*fImQ)(2,0);
15984  //Double_t dImQ4n = (*fImQ)(3,0);
15985
15986  // 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]
15987  // Correlation index runs as follows:
15988  // 
15989  //  0: <exp[in(psi1-3phi2+2phi3)]>
15990  
15991  Int_t t = 0; // type flag 
15992  Int_t pe = 0; // ptEta flag
15993  
15994  if(type == "RP")
15995  {
15996   t = 0;
15997  } else if(type == "POI")
15998    {
15999     t = 1;
16000    }
16001
16002  if(ptOrEta == "Pt")
16003  {
16004   pe = 0;
16005  } else if(ptOrEta == "Eta")
16006    {
16007     pe = 1;
16008    }
16009     
16010  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
16011  Double_t minPtEta[2] = {fPtMin,fEtaMin};
16012  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
16013  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
16014
16015  // looping over all bins and calculating reduced correlations: 
16016  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16017  {
16018   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
16019   Double_t p1n0kRe = 0.;
16020   Double_t p1n0kIm = 0.;
16021
16022   // number of POIs in particular pt or eta bin:
16023   Double_t mp = 0.;
16024
16025   // 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):
16026   Double_t q1n0kRe = 0.;
16027   Double_t q1n0kIm = 0.;
16028   Double_t q2n0kRe = 0.;
16029   Double_t q2n0kIm = 0.;
16030   Double_t q3n0kRe = 0.;
16031   Double_t q3n0kIm = 0.;
16032
16033   // number of particles which are both RPs and POIs in particular pt or eta bin:
16034   Double_t mq = 0.;
16035    
16036   if(type == "POI")
16037   {
16038    // q_{m*n,0}:
16039    q1n0kRe = fReRPQ1dEBE[2][pe][0][0]->GetBinContent(fReRPQ1dEBE[2][pe][0][0]->GetBin(b))
16040            * fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b));
16041    q1n0kIm = fImRPQ1dEBE[2][pe][0][0]->GetBinContent(fImRPQ1dEBE[2][pe][0][0]->GetBin(b))
16042            * fImRPQ1dEBE[2][pe][0][0]->GetBinEntries(fImRPQ1dEBE[2][pe][0][0]->GetBin(b));
16043    q2n0kRe = fReRPQ1dEBE[2][pe][1][0]->GetBinContent(fReRPQ1dEBE[2][pe][1][0]->GetBin(b))
16044            * fReRPQ1dEBE[2][pe][1][0]->GetBinEntries(fReRPQ1dEBE[2][pe][1][0]->GetBin(b));
16045    q2n0kIm = fImRPQ1dEBE[2][pe][1][0]->GetBinContent(fImRPQ1dEBE[2][pe][1][0]->GetBin(b))
16046            * fImRPQ1dEBE[2][pe][1][0]->GetBinEntries(fImRPQ1dEBE[2][pe][1][0]->GetBin(b));                         
16047    q3n0kRe = fReRPQ1dEBE[2][pe][2][0]->GetBinContent(fReRPQ1dEBE[2][pe][2][0]->GetBin(b))
16048            * fReRPQ1dEBE[2][pe][2][0]->GetBinEntries(fReRPQ1dEBE[2][pe][2][0]->GetBin(b));
16049    q3n0kIm = fImRPQ1dEBE[2][pe][2][0]->GetBinContent(fImRPQ1dEBE[2][pe][2][0]->GetBin(b))
16050            * fImRPQ1dEBE[2][pe][2][0]->GetBinEntries(fImRPQ1dEBE[2][pe][2][0]->GetBin(b));         
16051
16052    mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
16053   } 
16054   else if(type == "RP")
16055   {
16056    // q_{m*n,0}:
16057    q1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
16058            * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
16059    q1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))
16060            * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
16061    q2n0kRe = fReRPQ1dEBE[0][pe][1][0]->GetBinContent(fReRPQ1dEBE[0][pe][1][0]->GetBin(b))
16062            * fReRPQ1dEBE[0][pe][1][0]->GetBinEntries(fReRPQ1dEBE[0][pe][1][0]->GetBin(b));
16063    q2n0kIm = fImRPQ1dEBE[0][pe][1][0]->GetBinContent(fImRPQ1dEBE[0][pe][1][0]->GetBin(b))
16064            * fImRPQ1dEBE[0][pe][1][0]->GetBinEntries(fImRPQ1dEBE[0][pe][1][0]->GetBin(b));         
16065    q3n0kRe = fReRPQ1dEBE[0][pe][2][0]->GetBinContent(fReRPQ1dEBE[0][pe][2][0]->GetBin(b))
16066            * fReRPQ1dEBE[0][pe][2][0]->GetBinEntries(fReRPQ1dEBE[0][pe][2][0]->GetBin(b));
16067    q3n0kIm = fImRPQ1dEBE[0][pe][2][0]->GetBinContent(fImRPQ1dEBE[0][pe][2][0]->GetBin(b))
16068            * fImRPQ1dEBE[0][pe][2][0]->GetBinEntries(fImRPQ1dEBE[0][pe][2][0]->GetBin(b));         
16069                  
16070    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)  
16071   }
16072       
16073    if(type == "POI")
16074    {
16075     // p_{m*n,0}:
16076     p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
16077             * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
16078     p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
16079             * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
16080             
16081     mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
16082     
16083     t = 1; // typeFlag = RP or POI
16084    }
16085    else if(type == "RP")
16086    {
16087     // p_{m*n,0} = q_{m*n,0}:
16088     p1n0kRe = q1n0kRe; 
16089     p1n0kIm = q1n0kIm; 
16090             
16091     mp = mq; 
16092     
16093     t = 0; // typeFlag = RP or POI
16094    }
16095       
16096    // 3'-particle correlators:
16097    //  Taeney-Yan correlator:
16098    Double_t dTaeneyYan = 0.;
16099    Double_t mWeightTaeneyYan = 0.; // multiplicity weight for Taeney-Yan correlator
16100    if((mp*dMult-2.*mq)*(dMult-1.) > 0.) // to be improved - is this condition fully justified?
16101    {
16102     dTaeneyYan = (dReQ3n*(p1n0kRe*dReQ2n-p1n0kIm*dImQ2n)+dImQ3n*(p1n0kIm*dReQ2n+p1n0kRe*dImQ2n)
16103                - p1n0kRe*dReQ1n - p1n0kIm*dImQ1n
16104                - q2n0kRe*dReQ2n - q2n0kIm*dImQ2n              
16105                - q3n0kRe*dReQ3n - q3n0kIm*dImQ3n
16106                + 2.*mq)
16107                / ((mp*dMult-2.*mq)*(dMult-1.));
16108     // determine multiplicity weight:
16109     if(!strcmp(fMultiplicityWeight->Data(),"combinations"))
16110     {
16111      mWeightTaeneyYan = (mp*dMult-2.*mq)*(dMult-1.);
16112     } else if(!strcmp(fMultiplicityWeight->Data(),"unit"))
16113       {
16114        mWeightTaeneyYan = 1.;    
16115       } 
16116     // Fill profiles:
16117     fOtherDiffCorrelators[t][pe][1][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dTaeneyYan,mWeightTaeneyYan);
16118    } // end of if((mp*dMult-2.*mq)*(dMult-1.) > 0.)  
16119    
16120  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16121  
16122 } // end of void AliFlowAnalysisWithQCumulants::CalculateOtherDiffCorrelators(TString type, TString ptOrEta)
16123
16124 //=======================================================================================================================
16125
16126 void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlowCorrelations(TString type)
16127 {
16128  // Calculate all reduced correlations needed for 2D differential flow for each (pt,eta) bin. 
16129  
16130  // Multiplicity:
16131  Double_t dMult = (*fSpk)(0,0);
16132  // Real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
16133  Double_t dReQ1n = (*fReQ)(0,0);
16134  Double_t dReQ2n = (*fReQ)(1,0);
16135  //Double_t dReQ3n = (*fReQ)(2,0);
16136  //Double_t dReQ4n = (*fReQ)(3,0);
16137  Double_t dImQ1n = (*fImQ)(0,0);
16138  Double_t dImQ2n = (*fImQ)(1,0);
16139  //Double_t dImQ3n = (*fImQ)(2,0);
16140  //Double_t dImQ4n = (*fImQ)(3,0);
16141
16142  // 2D reduced correlations are stored in TProfile2D f2DDiffFlowCorrelationsPro[0=RP,1=POI][correlation index]. 
16143  // Correlation index runs as follows:
16144  //  0: <<2'>> 
16145  //  1: <<4'>>
16146  //  2: <<6'>>
16147  //  3: <<8'>>
16148  
16149  Int_t t = 0; // type flag  
16150  if(type == "RP")
16151  {
16152   t = 0;
16153  } else if(type == "POI")
16154    {
16155     t = 1;
16156    }
16157
16158  // Looping over all (pt,eta) bins and calculating correlations needed for differential flow: 
16159  for(Int_t p=1;p<=fnBinsPt;p++)
16160  {
16161   for(Int_t e=1;e<=fnBinsEta;e++)
16162   {
16163    // Real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular (pt,eta) bin): 
16164    Double_t p1n0kRe = 0.;
16165    Double_t p1n0kIm = 0.;
16166    // Number of POIs in particular pt or eta bin:
16167    Double_t mp = 0.;
16168    // Real and imaginary parts of q_{m*n,0} (non-weighted Q-vector evaluated for 'RP && POI particles' in particular pt or eta bin):
16169    Double_t q1n0kRe = 0.;
16170    Double_t q1n0kIm = 0.;
16171    Double_t q2n0kRe = 0.;
16172    Double_t q2n0kIm = 0.; 
16173    // Number of 'RP && POI particles' in particular pt or eta bin:
16174    Double_t mq = 0.;
16175    if(type == "POI")
16176    {
16177     // q_{m*n,0}:
16178     q1n0kRe = fReRPQ2dEBE[2][0][0]->GetBinContent(fReRPQ2dEBE[2][0][0]->GetBin(p,e))
16179             * fReRPQ2dEBE[2][0][0]->GetBinEntries(fReRPQ2dEBE[2][0][0]->GetBin(p,e));
16180     q1n0kIm = fImRPQ2dEBE[2][0][0]->GetBinContent(fImRPQ2dEBE[2][0][0]->GetBin(p,e))
16181             * fImRPQ2dEBE[2][0][0]->GetBinEntries(fImRPQ2dEBE[2][0][0]->GetBin(p,e));
16182     q2n0kRe = fReRPQ2dEBE[2][1][0]->GetBinContent(fReRPQ2dEBE[2][1][0]->GetBin(p,e))
16183             * fReRPQ2dEBE[2][1][0]->GetBinEntries(fReRPQ2dEBE[2][1][0]->GetBin(p,e));
16184     q2n0kIm = fImRPQ2dEBE[2][1][0]->GetBinContent(fImRPQ2dEBE[2][1][0]->GetBin(p,e))
16185             * fImRPQ2dEBE[2][1][0]->GetBinEntries(fImRPQ2dEBE[2][1][0]->GetBin(p,e));         
16186     // m_{q}:             
16187     mq = fReRPQ2dEBE[2][0][0]->GetBinEntries(fReRPQ2dEBE[2][0][0]->GetBin(p,e)); // to be improved (cross-checked by accessing other profiles here)
16188    } // end of if(type == "POI")
16189    else if(type == "RP")
16190    {
16191     // q_{m*n,0}:
16192     q1n0kRe = fReRPQ2dEBE[0][0][0]->GetBinContent(fReRPQ2dEBE[0][0][0]->GetBin(p,e))
16193             * fReRPQ2dEBE[0][0][0]->GetBinEntries(fReRPQ2dEBE[0][0][0]->GetBin(p,e));
16194     q1n0kIm = fImRPQ2dEBE[0][0][0]->GetBinContent(fImRPQ2dEBE[0][0][0]->GetBin(p,e))
16195             * fImRPQ2dEBE[0][0][0]->GetBinEntries(fImRPQ2dEBE[0][0][0]->GetBin(p,e));
16196     q2n0kRe = fReRPQ2dEBE[0][1][0]->GetBinContent(fReRPQ2dEBE[0][1][0]->GetBin(p,e))
16197             * fReRPQ2dEBE[0][1][0]->GetBinEntries(fReRPQ2dEBE[0][1][0]->GetBin(p,e));
16198     q2n0kIm = fImRPQ2dEBE[0][1][0]->GetBinContent(fImRPQ2dEBE[0][1][0]->GetBin(p,e))
16199             * fImRPQ2dEBE[0][1][0]->GetBinEntries(fImRPQ2dEBE[0][1][0]->GetBin(p,e));         
16200     // m_{q}:             
16201     mq = fReRPQ2dEBE[0][0][0]->GetBinEntries(fReRPQ2dEBE[0][0][0]->GetBin(p,e)); // to be improved (cross-checked by accessing other profiles here)  
16202    } // end of else if(type == "RP")
16203    if(type == "POI")
16204    {
16205     // p_{m*n,0}:
16206     p1n0kRe = fReRPQ2dEBE[1][0][0]->GetBinContent(fReRPQ2dEBE[1][0][0]->GetBin(p,e))
16207             * fReRPQ2dEBE[1][0][0]->GetBinEntries(fReRPQ2dEBE[1][0][0]->GetBin(p,e));
16208     p1n0kIm = fImRPQ2dEBE[1][0][0]->GetBinContent(fImRPQ2dEBE[1][0][0]->GetBin(p,e))  
16209             * fImRPQ2dEBE[1][0][0]->GetBinEntries(fImRPQ2dEBE[1][0][0]->GetBin(p,e));
16210     // m_{p}        
16211     mp = fReRPQ2dEBE[1][0][0]->GetBinEntries(fReRPQ2dEBE[1][0][0]->GetBin(p,e)); // to be improved (cross-checked by accessing other profiles here)
16212     
16213     t = 1; // typeFlag = RP or POI
16214    } // end of if(type == "POI")
16215    else if(type == "RP")
16216    {
16217     // p_{m*n,0} = q_{m*n,0}:
16218     p1n0kRe = q1n0kRe; 
16219     p1n0kIm = q1n0kIm; 
16220     // m_{p} = m_{q}:        
16221     mp = mq; 
16222
16223     t = 0; // typeFlag = RP or POI
16224    } // end of if(type == "RP")
16225
16226    // 2'-particle correlation for particular (pt,eta) bin:
16227    Double_t two1n1nPtEta = 0.;
16228    Double_t mWeight2pPrime = 0.; // multiplicity weight for <2'>
16229    if(mp*dMult-mq)
16230    {
16231     two1n1nPtEta = (p1n0kRe*dReQ1n+p1n0kIm*dImQ1n-mq)
16232                  / (mp*dMult-mq);
16233     // Determine multiplicity weight:
16234     if(!strcmp(fMultiplicityWeight->Data(),"combinations"))
16235     {
16236      mWeight2pPrime = mp*dMult-mq;
16237     } else if(!strcmp(fMultiplicityWeight->Data(),"unit"))
16238       {
16239        mWeight2pPrime = 1.;    
16240       } 
16241     // Fill 2D profile holding <<2'>>:     
16242     f2DDiffFlowCorrelationsPro[t][0]->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,two1n1nPtEta,mWeight2pPrime);
16243    } // end of if(mp*dMult-mq)
16244    
16245    // 4'-particle correlation:
16246    Double_t four1n1n1n1nPtEta = 0.;
16247    Double_t mWeight4pPrime = 0.; // multiplicity weight for <4'>
16248    if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16249        + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)) // to be improved (introduce a new variable for this expression)
16250    {
16251     four1n1n1n1nPtEta = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)
16252                       - q2n0kRe*(pow(dReQ1n,2.)-pow(dImQ1n,2.))
16253                       - 2.*q2n0kIm*dReQ1n*dImQ1n
16254                       - p1n0kRe*(dReQ1n*dReQ2n+dImQ1n*dImQ2n)
16255                       + p1n0kIm*(dImQ1n*dReQ2n-dReQ1n*dImQ2n)
16256                       - 2.*dMult*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)
16257                       - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*mq                      
16258                       + 6.*(q1n0kRe*dReQ1n+q1n0kIm*dImQ1n)                                            
16259                       + 1.*(q2n0kRe*dReQ2n+q2n0kIm*dImQ2n)                      
16260                       + 2.*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)                       
16261                       + 2.*mq*dMult                      
16262                       - 6.*mq)        
16263                       / ((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16264                           + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
16265     // Determine multiplicity weight:
16266     if(!strcmp(fMultiplicityWeight->Data(),"combinations"))
16267     {
16268      mWeight4pPrime = (mp-mq)*dMult*(dMult-1.)*(dMult-2.) + mq*(dMult-1.)*(dMult-2.)*(dMult-3.);
16269     } else if(!strcmp(fMultiplicityWeight->Data(),"unit"))
16270       {
16271        mWeight4pPrime = 1.;    
16272       }     
16273     // Fill 2D profile holding <<4'>>:
16274     f2DDiffFlowCorrelationsPro[t][1]->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,four1n1n1n1nPtEta,mWeight4pPrime);      
16275    } // end of if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16276      //            +mq*(dMult-1.)*(dMult-2.)*(dMult-3.))
16277   } // end of for(Int_t e=1;e<=fnBinsEta;e++)
16278  } // end of for(Int_t p=1;p<=fnBinsPt;p++)   
16279       
16280 } // end of AliFlowAnalysisWithQCumulants::Calculate2DDiffFlowCorrelations(TString type)
16281
16282 //=======================================================================================================================
16283
16284 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowSumOfEventWeights(TString type, TString ptOrEta)
16285 {
16286  // Calculate sums of various event weights for reduced correlations. 
16287  // (These quantitites are needed in expressions for unbiased estimators relevant for the statistical errors.)
16288
16289  Int_t typeFlag = 0;
16290  Int_t ptEtaFlag = 0;
16291
16292  if(type == "RP")
16293  {
16294   typeFlag = 0;
16295  } else if(type == "POI")
16296    {
16297     typeFlag = 1;
16298    } 
16299      
16300  if(ptOrEta == "Pt")
16301  {
16302   ptEtaFlag = 0;
16303  } else if(ptOrEta == "Eta")
16304    {
16305     ptEtaFlag = 1;
16306    } 
16307    
16308  // shortcuts:
16309  Int_t t = typeFlag;
16310  Int_t pe = ptEtaFlag;
16311  
16312  // binning:
16313  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
16314  Double_t minPtEta[2] = {fPtMin,fEtaMin};
16315  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
16316  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
16317  
16318  for(Int_t rpq=0;rpq<3;rpq++)
16319  {
16320   for(Int_t m=0;m<4;m++)
16321   {
16322    for(Int_t k=0;k<9;k++)
16323    {
16324     if(!fReRPQ1dEBE[rpq][pe][m][k])
16325     {
16326      cout<<"WARNING: fReRPQ1dEBE[rpq][pe][m][k] is NULL in AFAWQC::CSAPOEWFDF() !!!!"<<endl;
16327      cout<<"pe  = "<<pe<<endl;
16328      cout<<"rpq = "<<rpq<<endl;
16329      cout<<"m   = "<<m<<endl;
16330      cout<<"k   = "<<k<<endl;
16331      exit(0); 
16332     }
16333    }
16334   }
16335  }  
16336
16337  // multiplicities:
16338  Double_t dMult = (*fSpk)(0,0); // total event multiplicity
16339  //Double_t mr = 0.; // number of RPs in particular pt or eta bin
16340  Double_t mp = 0.; // number of POIs in particular pt or eta bin 
16341  Double_t mq = 0.; // number of particles which are both RPs and POIs in particular pt or eta bin
16342  
16343  // event weights for reduced correlations:
16344  Double_t dw2 = 0.; // event weight for <2'>
16345  Double_t dw4 = 0.; // event weight for <4'>
16346  //Double_t dw6 = 0.; // event weight for <6'>
16347  //Double_t dw8 = 0.; // event weight for <8'>
16348
16349  // looping over bins:
16350  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16351  {
16352   if(type == "RP")
16353   {
16354    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(b);
16355    mp = mq; // trick to use the very same Eqs. bellow both for RP's and POI's diff. flow
16356   } else if(type == "POI")
16357     {
16358      mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(b);
16359      mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(b);    
16360     }
16361   
16362   // event weight for <2'>:
16363   dw2 = mp*dMult-mq;  
16364   fDiffFlowSumOfEventWeights[t][pe][0][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2);
16365   fDiffFlowSumOfEventWeights[t][pe][1][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw2,2.));
16366   
16367   // event weight for <4'>:
16368   dw4 = (mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16369      + mq*(dMult-1.)*(dMult-2.)*(dMult-3.);  
16370   fDiffFlowSumOfEventWeights[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4);
16371   fDiffFlowSumOfEventWeights[t][pe][1][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw4,2.));
16372   
16373   // event weight for <6'>:
16374   //dw6 = ...;  
16375   //fDiffFlowSumOfEventWeights[t][pe][0][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw6);
16376   //fDiffFlowSumOfEventWeights[t][pe][t][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw6,2.));
16377   
16378   // event weight for <8'>:
16379   //dw8 = ...;  
16380   //fDiffFlowSumOfEventWeights[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw8);
16381   //fDiffFlowSumOfEventWeights[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw8,2.));   
16382  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++) 
16383  
16384 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowSumOfEventWeights()
16385
16386
16387 //=======================================================================================================================
16388
16389
16390 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowSumOfProductOfEventWeights(TString type, TString ptOrEta)
16391 {
16392  // Calculate sum of products of various event weights for both types of correlations (the ones for int. and diff. flow). 
16393  // (These quantitites are needed in expressions for unbiased estimators relevant for the statistical errors.)
16394  //
16395  // Important: To fill fDiffFlowSumOfProductOfEventWeights[][][][] use bellow table (i,j) with following constraints: 
16396  // 1.) i<j  
16397  // 2.) do not store terms which DO NOT include reduced correlations;
16398  // Table:
16399  // [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'>]
16400   
16401  Int_t typeFlag = 0;
16402  Int_t ptEtaFlag = 0;
16403
16404  if(type == "RP")
16405  {
16406   typeFlag = 0;
16407  } else if(type == "POI")
16408    {
16409     typeFlag = 1;
16410    } 
16411      
16412  if(ptOrEta == "Pt")
16413  {
16414   ptEtaFlag = 0;
16415  } else if(ptOrEta == "Eta")
16416    {
16417     ptEtaFlag = 1;
16418    } 
16419      
16420  // shortcuts:
16421  Int_t t = typeFlag;
16422  Int_t pe = ptEtaFlag;
16423   
16424  // binning:
16425  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
16426  Double_t minPtEta[2] = {fPtMin,fEtaMin};
16427  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
16428  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
16429  
16430  // protection:
16431  for(Int_t rpq=0;rpq<3;rpq++)
16432  {
16433   for(Int_t m=0;m<4;m++)
16434   {
16435    for(Int_t k=0;k<9;k++)
16436    {
16437     if(!fReRPQ1dEBE[rpq][pe][m][k])
16438     {
16439      cout<<"WARNING: fReRPQ1dEBE[rpq][pe][m][k] is NULL in AFAWQC::CSAPOEWFDF() !!!!"<<endl;
16440      cout<<"pe  = "<<pe<<endl;
16441      cout<<"rpq = "<<rpq<<endl;
16442      cout<<"m   = "<<m<<endl;
16443      cout<<"k   = "<<k<<endl;
16444      exit(0); 
16445     }
16446    }
16447   }
16448  }  
16449  
16450  // multiplicities:
16451  Double_t dMult = (*fSpk)(0,0); // total event multiplicity
16452  //Double_t mr = 0.; // number of RPs in particular pt or eta bin
16453  Double_t mp = 0.; // number of POIs in particular pt or eta bin 
16454  Double_t mq = 0.; // number of particles which are both RPs and POIs in particular pt or eta bin
16455  
16456  // event weights for correlations:
16457  Double_t dW2 = dMult*(dMult-1); // event weight for <2> 
16458  Double_t dW4 = dMult*(dMult-1)*(dMult-2)*(dMult-3); // event weight for <4> 
16459  Double_t dW6 = dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-4)*(dMult-5); // event weight for <6> 
16460  Double_t dW8 = dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-4)*(dMult-5)*(dMult-6)*(dMult-7); // event weight for <8> 
16461
16462  // event weights for reduced correlations:
16463  Double_t dw2 = 0.; // event weight for <2'>
16464  Double_t dw4 = 0.; // event weight for <4'>
16465  //Double_t dw6 = 0.; // event weight for <6'>
16466  //Double_t dw8 = 0.; // event weight for <8'>
16467  
16468  // looping over bins:
16469  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16470  {
16471   if(type == "RP")
16472   {
16473    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(b);
16474    mp = mq; // trick to use the very same Eqs. bellow both for RP's and POI's diff. flow
16475   } else if(type == "POI")
16476     {
16477      mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(b);
16478      mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(b);    
16479     }
16480   
16481   // event weight for <2'>:
16482   dw2 = mp*dMult-mq;  
16483   fDiffFlowSumOfProductOfEventWeights[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW2*dw2); // storing product of even weights for <2> and <2'>
16484   fDiffFlowSumOfProductOfEventWeights[t][pe][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dW4); // storing product of even weights for <4> and <2'>
16485   fDiffFlowSumOfProductOfEventWeights[t][pe][1][4]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dW6); // storing product of even weights for <6> and <2'>
16486   fDiffFlowSumOfProductOfEventWeights[t][pe][1][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dW8); // storing product of even weights for <8> and <2'>
16487   
16488   // event weight for <4'>:
16489   dw4 = (mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16490      + mq*(dMult-1.)*(dMult-2.)*(dMult-3.);  
16491   fDiffFlowSumOfProductOfEventWeights[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW2*dw4); // storing product of even weights for <2> and <4'>
16492   fDiffFlowSumOfProductOfEventWeights[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dw4); // storing product of even weights for <2'> and <4'>
16493   fDiffFlowSumOfProductOfEventWeights[t][pe][2][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW4*dw4); // storing product of even weights for <4> and <4'>
16494   fDiffFlowSumOfProductOfEventWeights[t][pe][3][4]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4*dW6); // storing product of even weights for <6> and <4'> 
16495   fDiffFlowSumOfProductOfEventWeights[t][pe][3][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4*dW8); // storing product of even weights for <8> and <4'>
16496
16497   // event weight for <6'>:
16498   //dw6 = ...;  
16499   //fDiffFlowSumOfProductOfEventWeights[t][pe][0][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW2*dw6); // storing product of even weights for <2> and <6'>
16500   //fDiffFlowSumOfProductOfEventWeights[t][pe][1][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dw6); // storing product of even weights for <2'> and <6'>
16501   //fDiffFlowSumOfProductOfEventWeights[t][pe][2][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW4*dw6); // storing product of even weights for <4> and <6'>
16502   //fDiffFlowSumOfProductOfEventWeights[t][pe][3][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4*dw6); // storing product of even weights for <4'> and <6'> 
16503   //fDiffFlowSumOfProductOfEventWeights[t][pe][4][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW6*dw6); // storing product of even weights for <6> and <6'>
16504   //fDiffFlowSumOfProductOfEventWeights[t][pe][5][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw6*dW8); // storing product of even weights for <6'> and <8>
16505   //fDiffFlowSumOfProductOfEventWeights[t][pe][5][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw6*dw8); // storing product of even weights for <6'> and <8'>
16506
16507   // event weight for <8'>:
16508   //dw8 = ...;  
16509   //fDiffFlowSumOfProductOfEventWeights[t][pe][0][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW2*dw8); // storing product of even weights for <2> and <8'>
16510   //fDiffFlowSumOfProductOfEventWeights[t][pe][1][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2*dw8); // storing product of even weights for <2'> and <8'>
16511   //fDiffFlowSumOfProductOfEventWeights[t][pe][2][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW4*dw8); // storing product of even weights for <4> and <8'>
16512   //fDiffFlowSumOfProductOfEventWeights[t][pe][3][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4*dw8); // storing product of even weights for <4'> and <8'> 
16513   //fDiffFlowSumOfProductOfEventWeights[t][pe][4][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW6*dw8); // storing product of even weights for <6> and <8'>
16514   //fDiffFlowSumOfProductOfEventWeights[t][pe][5][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw6*dw8); // storing product of even weights for <6'> and <8'>
16515   //fDiffFlowSumOfProductOfEventWeights[t][pe][6][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dW8*dw8); // storing product of even weights for <8> and <8'>
16516   
16517   // Table:
16518   // [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'>]
16519    
16520  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16521  
16522
16523
16524 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowSumOfProductOfEventWeights(TString type, TString ptOrEta)
16525
16526 //=======================================================================================================================
16527
16528 void AliFlowAnalysisWithQCumulants::FinalizeReducedCorrelations(TString type, TString ptOrEta)
16529 {
16530  // Transfer profiles into histograms and calculate statistical errors correctly.
16531
16532  Int_t t = 0; // RP or POI
16533  Int_t pe = 0; // pt or eta
16534
16535  if(type == "RP")
16536  {
16537   t = 0;
16538  } else if(type == "POI")
16539    {
16540     t = 1;
16541    } 
16542      
16543  if(ptOrEta == "Pt")
16544  {
16545   pe = 0;
16546  } else if(ptOrEta == "Eta")
16547    {
16548     pe = 1;
16549    } 
16550                
16551  for(Int_t rci=0;rci<4;rci++) // to be improved - moved into the method CheckPointersUsedInFinish()
16552  {
16553   if(!fDiffFlowCorrelationsPro[t][pe][rci])
16554   {
16555    cout<<"WARNING: fDiffFlowCorrelationsPro[t][pe][rci] is NULL in AFAWQC::FRC() !!!!"<<endl;
16556    cout<<"t   = "<<t<<endl; 
16557    cout<<"pe  = "<<pe<<endl; 
16558    cout<<"rci = "<<rci<<endl;
16559    exit(0); 
16560   }
16561   if(!fDiffFlowSquaredCorrelationsPro[t][pe][rci])
16562   {
16563    cout<<"WARNING: fDiffFlowSquaredCorrelationsPro[t][pe][rci] is NULL in AFAWQC::FRC() !!!!"<<endl;
16564    cout<<"t   = "<<t<<endl; 
16565    cout<<"pe  = "<<pe<<endl; 
16566    cout<<"rci = "<<rci<<endl;
16567    exit(0); 
16568   }
16569   for(Int_t power=0;power<2;power++)
16570   {
16571    if(!fDiffFlowSumOfEventWeights[t][pe][power][rci])
16572    {
16573     cout<<"WARNING: fDiffFlowSumOfEventWeights[t][pe][power][rci] is NULL in AFAWQC::FRC() !!!!"<<endl;
16574     cout<<"t     = "<<t<<endl; 
16575     cout<<"pe    = "<<pe<<endl;
16576     cout<<"power = "<<power<<endl; 
16577     cout<<"rci   = "<<rci<<endl;
16578     exit(0); 
16579    }   
16580   } // end of for(Int_t power=0;power<2;power++)
16581  } // end of for(Int_t rci=0;rci<4;rci++)
16582     
16583  // common:
16584  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta}; 
16585  // transfer 1D profile into 1D histogram:
16586  Double_t correlation = 0.;
16587  Double_t squaredCorrelation = 0.;
16588  Double_t spread = 0.;
16589  Double_t sumOfWeights = 0.; // sum of weights for particular reduced correlations for particular pt or eta bin
16590  Double_t sumOfSquaredWeights = 0.; // sum of squared weights for particular reduced correlations for particular pt or eta bin
16591  Double_t error = 0.; // error = termA * spread * termB
16592                       // termA = (sqrt(sumOfSquaredWeights)/sumOfWeights) 
16593                       // termB = 1/pow(1-termA^2,0.5)
16594  Double_t termA = 0.;                      
16595  Double_t termB = 0.;                      
16596  for(Int_t rci=0;rci<4;rci++) // index of reduced correlation
16597  {
16598   for(Int_t b=1;b<=nBinsPtEta[pe];b++) // number of pt or eta bins
16599   {
16600    if(fDiffFlowCorrelationsPro[t][pe][rci]->GetBinEffectiveEntries(b) < 2 || 
16601       fDiffFlowSquaredCorrelationsPro[t][pe][rci]->GetBinEffectiveEntries(b) < 2)
16602    {
16603     fDiffFlowCorrelationsPro[t][pe][rci]->SetBinError(b,0.);
16604     fDiffFlowSquaredCorrelationsPro[t][pe][rci]->SetBinError(b,0.);
16605     continue; // to be improved - should I ignore results in pt bins with one entry for reduced correlations or not?
16606    }  
16607    correlation = fDiffFlowCorrelationsPro[t][pe][rci]->GetBinContent(b); 
16608    squaredCorrelation = fDiffFlowSquaredCorrelationsPro[t][pe][rci]->GetBinContent(b); 
16609    if(squaredCorrelation-correlation*correlation >= 0.)
16610    {
16611     spread = pow(squaredCorrelation-correlation*correlation,0.5);
16612    } else
16613      {
16614       cout<<endl;
16615       cout<<Form(" WARNING: Imaginary 'spread' for rci = %d, pe = %d, bin = %d !!!!",rci,pe,b)<<endl;
16616       cout<<endl;
16617      }
16618    sumOfWeights = fDiffFlowSumOfEventWeights[t][pe][0][rci]->GetBinContent(b);
16619    sumOfSquaredWeights = fDiffFlowSumOfEventWeights[t][pe][1][rci]->GetBinContent(b);
16620    if(TMath::Abs(sumOfWeights)>0.){termA = (pow(sumOfSquaredWeights,0.5)/sumOfWeights);}
16621    if(1.-pow(termA,2.)>0.){termB = 1./pow(1.-pow(termA,2.),0.5);} 
16622    error = termA*spread*termB; // final error (unbiased estimator for standard deviation)
16623    fDiffFlowCorrelationsHist[t][pe][rci]->SetBinContent(b,correlation); 
16624    fDiffFlowCorrelationsHist[t][pe][rci]->SetBinError(b,error); 
16625   } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16626  } // end of for(Int_t rci=0;rci<4;rci++)
16627  
16628 } // end of void AliFlowAnalysisWithQCumulants::FinalizeReducedCorrelations(TString type, TString ptOrEta)
16629
16630 //=======================================================================================================================
16631
16632 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowProductOfCorrelations(TString type, TString ptOrEta)
16633 {
16634  // store products: <2><2'>, <2><4'>, <2><6'>, <2><8'>, <2'><4>, 
16635  //                 <2'><4'>, <2'><6>, <2'><6'>, <2'><8>, <2'><8'>,
16636  //                 <4><4'>, <4><6'>, <4><8'>, <4'><6>, <4'><6'>, 
16637  //                 <4'><8>, <4'><8'>, <6><6'>, <6><8'>, <6'><8>, 
16638  //                 <6'><8'>, <8><8'>.
16639   
16640  Int_t typeFlag = 0;
16641  Int_t ptEtaFlag = 0;
16642
16643  if(type == "RP")
16644  {
16645   typeFlag = 0;
16646  } else if(type == "POI")
16647    {
16648     typeFlag = 1;
16649    } 
16650      
16651  if(ptOrEta == "Pt")
16652  {
16653   ptEtaFlag = 0;
16654  } else if(ptOrEta == "Eta")
16655    {
16656     ptEtaFlag = 1;
16657    } 
16658   
16659  // shortcuts:
16660  Int_t t = typeFlag;
16661  Int_t pe = ptEtaFlag;
16662      
16663  // common:
16664  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
16665  Double_t minPtEta[2] = {fPtMin,fEtaMin};
16666  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
16667    
16668  // protections // to be improved (add protection for all pointers in this method)
16669  if(!fIntFlowCorrelationsEBE)
16670  {
16671   cout<<"WARNING: fIntFlowCorrelationsEBE is NULL in AFAWQC::CDFPOC() !!!!"<<endl;
16672   exit(0);
16673  } 
16674  
16675  /*    
16676  Double_t dMult = (*fSpk)(0,0); // multiplicity (number of particles used to determine the reaction plane)
16677  //Double_t mr = 0.; // number of RPs in particular pt or eta bin
16678  Double_t mp = 0.; // number of POIs in particular pt or eta bin 
16679  Double_t mq = 0.; // number of particles which are both RPs and POIs in particular pt or eta bin
16680  */
16681
16682  // e-b-e correlations:
16683  Double_t twoEBE = fIntFlowCorrelationsEBE->GetBinContent(1); // <2>
16684  Double_t fourEBE = fIntFlowCorrelationsEBE->GetBinContent(2); // <4>
16685  Double_t sixEBE = fIntFlowCorrelationsEBE->GetBinContent(3); // <6>
16686  Double_t eightEBE = fIntFlowCorrelationsEBE->GetBinContent(4); // <8>
16687  
16688  // event weights for correlations:
16689  Double_t dW2 = fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(1); // event weight for <2> 
16690  Double_t dW4 = fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(2); // event weight for <4> 
16691  Double_t dW6 = fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(3); // event weight for <6> 
16692  Double_t dW8 = fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(4); // event weight for <8> 
16693   
16694  // e-b-e reduced correlations:
16695  Double_t twoReducedEBE = 0.; // <2'>
16696  Double_t fourReducedEBE = 0.; // <4'>
16697  //Double_t sixReducedEBE = 0.; // <6'>
16698  //Double_t eightReducedEBE = 0.; // <8'> 
16699  
16700  // event weights for reduced correlations:
16701  Double_t dw2 = 0.; // event weight for <2'>
16702  Double_t dw4 = 0.; // event weight for <4'>
16703  //Double_t dw6 = 0.; // event weight for <6'>
16704  //Double_t dw8 = 0.; // event weight for <8'>
16705
16706  // looping over bins:
16707  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16708  {
16709   // e-b-e reduced correlations:
16710   twoReducedEBE = fDiffFlowCorrelationsEBE[t][pe][0]->GetBinContent(b);
16711   fourReducedEBE = fDiffFlowCorrelationsEBE[t][pe][1]->GetBinContent(b);
16712   //sixReducedEBE = fDiffFlowCorrelationsEBE[t][pe][2]->GetBinContent(b);
16713   //eightReducedEBE = fDiffFlowCorrelationsEBE[t][pe][3]->GetBinContent(b);
16714   
16715   /*
16716   // to be improved (I should not do this here again)
16717   if(type == "RP")
16718   {
16719    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(b);
16720    mp = mq; // trick to use the very same Eqs. bellow both for RP's and POI's diff. flow
16721   } else if(type == "POI")
16722     {
16723      mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(b);
16724      mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(b);    
16725     }
16726   
16727   // event weights for reduced correlations:
16728   dw2 = mp*dMult-mq; // weight for <2'> 
16729   dw4 = (mp-mq)*dMult*(dMult-1.)*(dMult-2.)
16730      + mq*(dMult-1.)*(dMult-2.)*(dMult-3.); // weight for <4'>
16731   //dw6 = ...     
16732   //dw8 = ...     
16733   
16734   */
16735   
16736   dw2 = fDiffFlowEventWeightsForCorrelationsEBE[t][pe][0]->GetBinContent(b);
16737   dw4 = fDiffFlowEventWeightsForCorrelationsEBE[t][pe][1]->GetBinContent(b);
16738  
16739   // storing all products:
16740   fDiffFlowProductOfCorrelationsPro[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoEBE*twoReducedEBE,dW2*dw2); // storing <2><2'>
16741   fDiffFlowProductOfCorrelationsPro[t][pe][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourEBE*twoReducedEBE,dW4*dw2); // storing <4><2'>
16742   fDiffFlowProductOfCorrelationsPro[t][pe][1][4]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixEBE*twoReducedEBE,dW6*dw2); // storing <6><2'>
16743   fDiffFlowProductOfCorrelationsPro[t][pe][1][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],eightEBE*twoReducedEBE,dW8*dw2); // storing <8><2'>
16744   
16745   // event weight for <4'>:
16746   fDiffFlowProductOfCorrelationsPro[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoEBE*fourReducedEBE,dW2*dw4); // storing <2><4'>
16747   fDiffFlowProductOfCorrelationsPro[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoReducedEBE*fourReducedEBE,dw2*dw4); // storing <2'><4'>
16748   fDiffFlowProductOfCorrelationsPro[t][pe][2][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourEBE*fourReducedEBE,dW4*dw4); // storing <4><4'>
16749   fDiffFlowProductOfCorrelationsPro[t][pe][3][4]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixEBE*fourReducedEBE,dW6*dw4); // storing <6><4'> 
16750   fDiffFlowProductOfCorrelationsPro[t][pe][3][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],eightEBE*fourReducedEBE,dW8*dw4); // storing <8><4'>
16751
16752   // event weight for <6'>:
16753   //dw6 = ...;  
16754   //fDiffFlowProductOfCorrelationsPro[t][pe][0][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoEBE*sixReducedEBE,dW2*dw6); // storing <2><6'>
16755   //fDiffFlowProductOfCorrelationsPro[t][pe][1][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoReducedEBE*sixReducedEBE,dw2*dw6); // storing <2'><6'>
16756   //fDiffFlowProductOfCorrelationsPro[t][pe][2][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourEBE*sixReducedEBE,dW4*dw6); // storing <4><6'>
16757   //fDiffFlowProductOfCorrelationsPro[t][pe][3][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourReducedEBE*sixReducedEBE,dw4*dw6); // storing <4'><6'> 
16758   //fDiffFlowProductOfCorrelationsPro[t][pe][4][5]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixEBE*sixReducedEBE,dW6*dw6); // storing <6><6'>
16759   //fDiffFlowProductOfCorrelationsPro[t][pe][5][6]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixReducedEBE*eightEBE,dw6*dW8); // storing <6'><8>
16760   //fDiffFlowProductOfCorrelationsPro[t][pe][5][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixReducedEBE*eightReducedEBE,dw6*dw8); // storing <6'><8'>
16761
16762   // event weight for <8'>:
16763   //dw8 = ...;  
16764   //fDiffFlowProductOfCorrelationsPro[t][pe][0][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoEBE*eightReducedEBE,dW2*dw8); // storing <2><8'>
16765   //fDiffFlowProductOfCorrelationsPro[t][pe][1][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],twoReducedEBE*eightReducedEBE,dw2*dw8); // storing <2'><8'>
16766   //fDiffFlowProductOfCorrelationsPro[t][pe][2][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourEBE*eightReducedEBE,dW4*dw8); // storing <4><8'>
16767   //fDiffFlowProductOfCorrelationsPro[t][pe][3][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],fourReducedEBE*eightReducedEBE,dw4*dw8); // storing <4'><8'> 
16768   //fDiffFlowProductOfCorrelationsPro[t][pe][4][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixEBE*eightReducedEBE,dW6*dw8); // storing <6><8'>
16769   //fDiffFlowProductOfCorrelationsPro[t][pe][5][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sixReducedEBE*eightReducedEBE,dw6*dw8); // storing <6'><8'>
16770   //fDiffFlowProductOfCorrelationsPro[t][pe][6][7]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],eightEBE*eightReducedEBE,dW8*dw8); // storing <8><8'> 
16771  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++       
16772      
16773 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowProductOfCorrelations(TString type, TString ptOrEta)
16774
16775 //=======================================================================================================================
16776     
16777 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCovariances(TString type, TString ptOrEta) // to be improved (reimplemented)
16778 {
16779  // a) Calculate unbiased estimators Cov(<2>,<2'>), Cov(<2>,<4'>), Cov(<4>,<2'>), Cov(<4>,<4'>) and Cov(<2'>,<4'>)
16780  //    for covariances V(<2>,<2'>), V(<2>,<4'>), V(<4>,<2'>), V(<4>,<4'>) and V(<2'>,<4'>).  
16781  // b) Store in histogram fDiffFlowCovariances[t][pe][index] for instance the following: 
16782  //
16783  //             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)]
16784  // 
16785  //     where N is the number of events, w_{<2>} is event weight for <2> and w_{<2'>} is event weight for <2'>.
16786  // c) Binning of fDiffFlowCovariances[t][pe][index] is organized as follows:
16787  // 
16788  //     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)] 
16789  //     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)] 
16790  //     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)] 
16791  //     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)] 
16792  //     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)] 
16793  //     ...
16794   
16795  Int_t typeFlag = 0;
16796  Int_t ptEtaFlag = 0;
16797
16798  if(type == "RP")
16799  {
16800   typeFlag = 0;
16801  } else if(type == "POI")
16802    {
16803     typeFlag = 1;
16804    } 
16805      
16806  if(ptOrEta == "Pt")
16807  {
16808   ptEtaFlag = 0;
16809  } else if(ptOrEta == "Eta")
16810    {
16811     ptEtaFlag = 1;
16812    } 
16813   
16814  // shortcuts:
16815  Int_t t = typeFlag;
16816  Int_t pe = ptEtaFlag;
16817      
16818  // common:
16819  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
16820  //Double_t minPtEta[2] = {fPtMin,fEtaMin};
16821  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
16822  //Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
16823  
16824  // average correlations:
16825  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>>
16826  Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>>
16827  //Double_t six = fIntFlowCorrelationsHist->GetBinContent(3); // <<6>>
16828  //Double_t eight = fIntFlowCorrelationsHist->GetBinContent(4); // <<8>>
16829  
16830  // sum of weights for correlation:
16831  Double_t sumOfWeightsForTwo = fIntFlowSumOfEventWeights[0]->GetBinContent(1); // sum_{i=1}^{N} w_{<2>}
16832  Double_t sumOfWeightsForFour = fIntFlowSumOfEventWeights[0]->GetBinContent(2); // sum_{i=1}^{N} w_{<4>}
16833  //Double_t sumOfWeightsForSix = fIntFlowSumOfEventWeights[0]->GetBinContent(3); // sum_{i=1}^{N} w_{<6>}
16834  //Double_t sumOfWeightsForEight = fIntFlowSumOfEventWeights[0]->GetBinContent(4); // sum_{i=1}^{N} w_{<8>}
16835  
16836  // average reduced correlations:
16837  Double_t twoReduced = 0.; // <<2'>> 
16838  Double_t fourReduced = 0.; // <<4'>>
16839  //Double_t sixReduced = 0.; // <<6'>>
16840  //Double_t eightReduced = 0.; // <<8'>>
16841
16842  // sum of weights for reduced correlation:
16843  Double_t sumOfWeightsForTwoReduced = 0.; // sum_{i=1}^{N} w_{<2'>}
16844  Double_t sumOfWeightsForFourReduced = 0.; // sum_{i=1}^{N} w_{<4'>}
16845  //Double_t sumOfWeightsForSixReduced = 0.; // sum_{i=1}^{N} w_{<6'>}
16846  //Double_t sumOfWeightsForEightReduced = 0.; // sum_{i=1}^{N} w_{<8'>}
16847   
16848  // product of weights for reduced correlation:
16849  Double_t productOfWeightsForTwoTwoReduced = 0.; // sum_{i=1}^{N} w_{<2>}w_{<2'>}
16850  Double_t productOfWeightsForTwoFourReduced = 0.; // sum_{i=1}^{N} w_{<2>}w_{<4'>}
16851  Double_t productOfWeightsForFourTwoReduced = 0.; // sum_{i=1}^{N} w_{<4>}w_{<2'>}
16852  Double_t productOfWeightsForFourFourReduced = 0.; // sum_{i=1}^{N} w_{<4>}w_{<4'>}
16853  Double_t productOfWeightsForTwoReducedFourReduced = 0.; // sum_{i=1}^{N} w_{<2'>}w_{<4'>}
16854  // ...
16855  
16856  // products for differential flow:
16857  Double_t twoTwoReduced = 0; // <<2><2'>> 
16858  Double_t twoFourReduced = 0; // <<2><4'>> 
16859  Double_t fourTwoReduced = 0; // <<4><2'>> 
16860  Double_t fourFourReduced = 0; // <<4><4'>> 
16861  Double_t twoReducedFourReduced = 0; // <<2'><4'>> 
16862
16863  // denominators in the expressions for the unbiased estimators for covariances:
16864  // denominator = 1 - term1/(term2*term3)
16865  // prefactor = term1/(term2*term3)
16866  Double_t denominator = 0.; 
16867  Double_t prefactor = 0.;
16868  Double_t term1 = 0.; 
16869  Double_t term2 = 0.; 
16870  Double_t term3 = 0.; 
16871  
16872  // unbiased estimators for covariances for differential flow:
16873  Double_t covTwoTwoReduced = 0.; // Cov(<2>,<2'>)
16874  Double_t wCovTwoTwoReduced = 0.; // Cov(<2>,<2'>) * prefactor(w_{<2>},w_{<2'>})
16875  Double_t covTwoFourReduced = 0.; // Cov(<2>,<4'>)
16876  Double_t wCovTwoFourReduced = 0.; // Cov(<2>,<4'>) * prefactor(w_{<2>},w_{<4'>})
16877  Double_t covFourTwoReduced = 0.; // Cov(<4>,<2'>)
16878  Double_t wCovFourTwoReduced = 0.; // Cov(<4>,<2'>) * prefactor(w_{<4>},w_{<2'>})
16879  Double_t covFourFourReduced = 0.; // Cov(<4>,<4'>)
16880  Double_t wCovFourFourReduced = 0.; // Cov(<4>,<4'>) * prefactor(w_{<4>},w_{<4'>})
16881  Double_t covTwoReducedFourReduced = 0.; // Cov(<2'>,<4'>)
16882  Double_t wCovTwoReducedFourReduced = 0.; // Cov(<2'>,<4'>) * prefactor(w_{<2'>},w_{<4'>})
16883  
16884  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16885  {
16886   // average reduced corelations:
16887   twoReduced = fDiffFlowCorrelationsHist[t][pe][0]->GetBinContent(b);
16888   fourReduced = fDiffFlowCorrelationsHist[t][pe][1]->GetBinContent(b);
16889   // average products:
16890   twoTwoReduced = fDiffFlowProductOfCorrelationsPro[t][pe][0][1]->GetBinContent(b);
16891   twoFourReduced = fDiffFlowProductOfCorrelationsPro[t][pe][0][3]->GetBinContent(b);
16892   fourTwoReduced = fDiffFlowProductOfCorrelationsPro[t][pe][1][2]->GetBinContent(b);
16893   fourFourReduced = fDiffFlowProductOfCorrelationsPro[t][pe][2][3]->GetBinContent(b);
16894   twoReducedFourReduced = fDiffFlowProductOfCorrelationsPro[t][pe][1][3]->GetBinContent(b);  
16895   // sum of weights for reduced correlations:
16896   sumOfWeightsForTwoReduced = fDiffFlowSumOfEventWeights[t][pe][0][0]->GetBinContent(b);
16897   sumOfWeightsForFourReduced = fDiffFlowSumOfEventWeights[t][pe][0][1]->GetBinContent(b);
16898   // products of weights for correlations:
16899   productOfWeightsForTwoTwoReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][0][1]->GetBinContent(b); 
16900   productOfWeightsForTwoFourReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][0][3]->GetBinContent(b);
16901   productOfWeightsForFourTwoReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][1][2]->GetBinContent(b);
16902   productOfWeightsForFourFourReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][2][3]->GetBinContent(b);
16903   productOfWeightsForTwoReducedFourReduced = fDiffFlowSumOfProductOfEventWeights[t][pe][1][3]->GetBinContent(b);
16904   // denominator for the unbiased estimator for covariances: 1 - term1/(term2*term3) 
16905   // prefactor (multiplies Cov's) = term1/(term2*term3)       
16906   // <2>,<2'>:
16907   term1 = productOfWeightsForTwoTwoReduced;      
16908   term2 = sumOfWeightsForTwo;
16909   term3 = sumOfWeightsForTwoReduced;        
16910   if(term2*term3>0.)
16911   {
16912    denominator = 1.-term1/(term2*term3);
16913    prefactor = term1/(term2*term3);
16914    if(TMath::Abs(denominator)>1.e-6)
16915    {
16916     covTwoTwoReduced = (twoTwoReduced-two*twoReduced)/denominator;            
16917     wCovTwoTwoReduced = covTwoTwoReduced*prefactor; 
16918     fDiffFlowCovariances[t][pe][0]->SetBinContent(b,wCovTwoTwoReduced);
16919    }
16920   }
16921   // <2>,<4'>:
16922   term1 = productOfWeightsForTwoFourReduced;      
16923   term2 = sumOfWeightsForTwo;
16924   term3 = sumOfWeightsForFourReduced;        
16925   if(term2*term3>0.)
16926   {
16927    denominator = 1.-term1/(term2*term3);
16928    prefactor = term1/(term2*term3);
16929    if(TMath::Abs(denominator)>1.e-6)
16930    {
16931     covTwoFourReduced = (twoFourReduced-two*fourReduced)/denominator;            
16932     wCovTwoFourReduced = covTwoFourReduced*prefactor; 
16933     fDiffFlowCovariances[t][pe][1]->SetBinContent(b,wCovTwoFourReduced);
16934    }
16935   }
16936   // <4>,<2'>:
16937   term1 = productOfWeightsForFourTwoReduced;      
16938   term2 = sumOfWeightsForFour;
16939   term3 = sumOfWeightsForTwoReduced;        
16940   if(term2*term3>0.)
16941   {
16942    denominator = 1.-term1/(term2*term3);
16943    prefactor = term1/(term2*term3);
16944    if(TMath::Abs(denominator)>1.e-6)
16945    {
16946     covFourTwoReduced = (fourTwoReduced-four*twoReduced)/denominator;            
16947     wCovFourTwoReduced = covFourTwoReduced*prefactor; 
16948     fDiffFlowCovariances[t][pe][2]->SetBinContent(b,wCovFourTwoReduced);
16949    }
16950   }
16951   // <4>,<4'>:
16952   term1 = productOfWeightsForFourFourReduced;      
16953   term2 = sumOfWeightsForFour;
16954   term3 = sumOfWeightsForFourReduced;        
16955   if(term2*term3>0.)
16956   {
16957    denominator = 1.-term1/(term2*term3);
16958    prefactor = term1/(term2*term3);
16959    if(TMath::Abs(denominator)>1.e-6)
16960    {
16961     covFourFourReduced = (fourFourReduced-four*fourReduced)/denominator;            
16962     wCovFourFourReduced = covFourFourReduced*prefactor; 
16963     fDiffFlowCovariances[t][pe][3]->SetBinContent(b,wCovFourFourReduced);
16964    }
16965   }
16966   // <2'>,<4'>:
16967   term1 = productOfWeightsForTwoReducedFourReduced;      
16968   term2 = sumOfWeightsForTwoReduced;
16969   term3 = sumOfWeightsForFourReduced;        
16970   if(term2*term3>0.)
16971   {
16972    denominator = 1.-term1/(term2*term3);
16973    prefactor = term1/(term2*term3);
16974    if(TMath::Abs(denominator)>1.e-6)
16975    {
16976     covTwoReducedFourReduced = (twoReducedFourReduced-twoReduced*fourReduced)/denominator;            
16977     wCovTwoReducedFourReduced = covTwoReducedFourReduced*prefactor; 
16978     fDiffFlowCovariances[t][pe][4]->SetBinContent(b,wCovTwoReducedFourReduced);
16979    }
16980   }   
16981  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
16982   
16983 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCovariances(TString type, TString ptOrEta)
16984
16985 //=======================================================================================================================
16986
16987 void AliFlowAnalysisWithQCumulants::CalculateDiffFlow(TString type, TString ptOrEta)
16988 {
16989  // Calculate final results for differential flow.
16990  
16991  // REMARK: Differential flow calculated in this method is NOT corrected for non-uniform acceptance. 
16992  // This correction, if enabled via setter SetApplyCorrectionForNUA(Bool_t), is applied in the method 
16993  // CalculateDiffFlowCorrectedForNUA(TString type, TString ptOrEta)
16994   
16995  Int_t t = 0; // RP or POI
16996  Int_t pe = 0; // pt or eta
16997
16998  if(type == "RP")
16999  {
17000   t = 0;
17001  } else if(type == "POI")
17002    {
17003     t = 1;
17004    } 
17005      
17006  if(ptOrEta == "Pt")
17007  {
17008   pe = 0;
17009  } else if(ptOrEta == "Eta")
17010    {
17011     pe = 1;
17012    } 
17013        
17014  // Common:
17015  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
17016  // Correlations:
17017  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>>
17018  Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>> 
17019  // Statistical errors of correlations:
17020  Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1);
17021  Double_t fourError = fIntFlowCorrelationsHist->GetBinError(2);   
17022  // Reduced correlations:
17023  Double_t twoReduced = 0.; // <<2'>>
17024  Double_t fourReduced = 0.; // <<4'>>
17025  // Statistical errors of reduced correlations:
17026  Double_t twoReducedError = 0.; 
17027  Double_t fourReducedError = 0.; 
17028  // Covariances:
17029  Double_t wCovTwoFour = 0.; // Cov(<2>,<4>) * prefactor(<2>,<4>)
17030  if(!fForgetAboutCovariances)
17031  {
17032   wCovTwoFour = fIntFlowCovariances->GetBinContent(1); // Cov(<2>,<4>) * prefactor(<2>,<4>)
17033  }
17034  Double_t wCovTwoTwoReduced = 0.; // Cov(<2>,<2'>) * prefactor(<2>,<2'>)
17035  Double_t wCovTwoFourReduced = 0.; // Cov(<2>,<4'>) * prefactor(<2>,<4'>)
17036  Double_t wCovFourTwoReduced = 0.; // Cov(<4>,<2'>) * prefactor(<4>,<2'>)
17037  Double_t wCovFourFourReduced = 0.; // Cov(<4>,<4'>) * prefactor(<4>,<4'>)
17038  Double_t wCovTwoReducedFourReduced = 0.; // Cov(<2'>,<4'>) * prefactor(<2'>,<4'>)
17039  // Differential flow:
17040  Double_t v2Prime = 0.; // v'{2}                   
17041  Double_t v4Prime = 0.; // v'{4}
17042  // Statistical error of differential flow:
17043  Double_t v2PrimeError = 0.;                    
17044  Double_t v4PrimeError = 0.; 
17045  // Squared statistical error of differential flow:
17046  Double_t v2PrimeErrorSquared = 0.;                    
17047  Double_t v4PrimeErrorSquared = 0.; 
17048  // Loop over pt or eta bins:
17049  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
17050  {
17051   // Reduced correlations and statistical errors:
17052   twoReduced = fDiffFlowCorrelationsHist[t][pe][0]->GetBinContent(b);
17053   twoReducedError = fDiffFlowCorrelationsHist[t][pe][0]->GetBinError(b);
17054   fourReduced = fDiffFlowCorrelationsHist[t][pe][1]->GetBinContent(b);
17055   fourReducedError = fDiffFlowCorrelationsHist[t][pe][1]->GetBinError(b);
17056   // Covariances:
17057   if(!fForgetAboutCovariances)
17058   {
17059    wCovTwoTwoReduced = fDiffFlowCovariances[t][pe][0]->GetBinContent(b);
17060    wCovTwoFourReduced = fDiffFlowCovariances[t][pe][1]->GetBinContent(b);
17061    wCovFourTwoReduced = fDiffFlowCovariances[t][pe][2]->GetBinContent(b);
17062    wCovFourFourReduced = fDiffFlowCovariances[t][pe][3]->GetBinContent(b);
17063    wCovTwoReducedFourReduced = fDiffFlowCovariances[t][pe][4]->GetBinContent(b);
17064   }
17065   // Differential flow:
17066   // v'{2}:
17067   if(two>0.) 
17068   {
17069    v2Prime = twoReduced/pow(two,0.5);
17070    v2PrimeErrorSquared = (1./4.)*pow(two,-3.)*(pow(twoReduced,2.)*pow(twoError,2.)
17071                        + 4.*pow(two,2.)*pow(twoReducedError,2.)
17072                        - 4.*two*twoReduced*wCovTwoTwoReduced);
17073    if(v2PrimeErrorSquared>0.){v2PrimeError = pow(v2PrimeErrorSquared,0.5);}
17074    if(TMath::Abs(v2Prime)>0.)
17075    {
17076     fDiffFlow[t][pe][0]->SetBinContent(b,v2Prime); 
17077     fDiffFlow[t][pe][0]->SetBinError(b,v2PrimeError);    
17078    }  
17079   } // end of if(two>0.) 
17080   // differential flow:
17081   // v'{4}
17082   if(2.*pow(two,2.)-four > 0.) 
17083   {
17084    v4Prime = (2.*two*twoReduced-fourReduced)/pow(2.*pow(two,2.)-four,3./4.);
17085    v4PrimeErrorSquared = pow(2.*pow(two,2.)-four,-7./2.)
17086                        * (pow(2.*pow(two,2.)*twoReduced-3.*two*fourReduced+2.*four*twoReduced,2.)*pow(twoError,2.)
17087                        + (9./16.)*pow(2.*two*twoReduced-fourReduced,2.)*pow(fourError,2.)
17088                        + 4.*pow(two,2.)*pow(2.*pow(two,2.)-four,2.)*pow(twoReducedError,2.)
17089                        + pow(2.*pow(two,2.)-four,2.)*pow(fourReducedError,2.)                          
17090                        - (3./2.)*(2.*two*twoReduced-fourReduced)
17091                        * (2.*pow(two,2.)*twoReduced-3.*two*fourReduced+2.*four*twoReduced)*wCovTwoFour
17092                        - 4.*two*(2.*pow(two,2.)-four)
17093                        * (2.*pow(two,2.)*twoReduced-3.*two*fourReduced+2.*four*twoReduced)*wCovTwoTwoReduced
17094                        + 2.*(2.*pow(two,2.)-four)
17095                        * (2.*pow(two,2.)*twoReduced-3.*two*fourReduced+2.*four*twoReduced)*wCovTwoFourReduced
17096                        + 3.*two*(2.*pow(two,2.)-four)*(2.*two*twoReduced-fourReduced)*wCovFourTwoReduced
17097                        - (3./2.)*(2.*pow(two,2.)-four)*(2.*two*twoReduced-fourReduced)*wCovFourFourReduced 
17098                        - 4.*two*pow(2.*pow(two,2.)-four,2.)*wCovTwoReducedFourReduced);  
17099    if(v4PrimeErrorSquared>0.){v4PrimeError = pow(v4PrimeErrorSquared,0.5);}        
17100    if(TMath::Abs(v4Prime)>0.)
17101    {
17102     fDiffFlow[t][pe][1]->SetBinContent(b,v4Prime);
17103     fDiffFlow[t][pe][1]->SetBinError(b,v4PrimeError);     
17104    }
17105   } // end of if(2.*pow(two,2.)-four > 0.)  
17106  } // end of for(Int_t b=1;b<=fnBinsPtEta[pe];b++)
17107
17108 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlow(TString type, Bool_t useParticleWeights)
17109
17110 //=======================================================================================================================
17111
17112 void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlow(TString type)
17113 {
17114  // Calculate final results for 2D diferential flow.
17115
17116  // to be improved - check pointers used in this method
17117
17118  Int_t t = 0; // RP or POI
17119
17120  if(type == "RP")
17121  {
17122   t = 0;
17123  } else if(type == "POI")
17124    {
17125     t = 1;
17126    } 
17127  
17128  // Differential flow:
17129  Double_t v2Prime = 0.; // v'{2}                   
17130  Double_t v4Prime = 0.; // v'{4}
17131  // Differential cumulants:
17132  Double_t qc2Prime = 0.; // QC{2'}                   
17133  Double_t qc4Prime = 0.; // QC{4'}
17134  // Looping over all (pt,eta) bins and calculating differential flow: 
17135  for(Int_t p=1;p<=fnBinsPt;p++)
17136  {
17137   for(Int_t e=1;e<=fnBinsEta;e++)
17138   {
17139    // QC{2'}:
17140    qc2Prime = f2DDiffFlowCumulants[t][0]->GetBinContent(f2DDiffFlowCumulants[t][0]->GetBin(p,e));
17141    if(qc2Prime>=0.)
17142    {
17143     v2Prime = pow(qc2Prime,0.5);
17144     f2DDiffFlow[t][0]->SetBinContent(f2DDiffFlow[t][0]->GetBin(p,e),v2Prime); 
17145    } 
17146    // QC{4'}:
17147    qc4Prime = f2DDiffFlowCumulants[t][1]->GetBinContent(f2DDiffFlowCumulants[t][1]->GetBin(p,e));
17148    if(qc4Prime<=0.)
17149    {
17150     v4Prime = pow(-1.*qc4Prime,1./4.);
17151     f2DDiffFlow[t][1]->SetBinContent(f2DDiffFlow[t][1]->GetBin(p,e),v4Prime); 
17152    }   
17153   } // end of for(Int_t e=1;e<=fnBinsEta;e++)
17154  } // end of for(Int_t p=1;p<=fnBinsPt;p++)
17155  
17156 } // end of void AliFlowAnalysisWithQCumulants::Calculate2DDiffFlow(TString type)  
17157
17158 //=======================================================================================================================
17159
17160 void AliFlowAnalysisWithQCumulants::StoreIntFlowFlags()
17161 {
17162  // a) Store all flags for integrated flow in profile fIntFlowFlags.
17163  
17164  if(!fIntFlowFlags)
17165  {
17166   cout<<"WARNING: fIntFlowFlags is NULL in AFAWQC::SFFIF() !!!!"<<endl;
17167   exit(0);
17168  } 
17169
17170  // particle weights used or not:
17171  fIntFlowFlags->Fill(0.5,(Int_t)fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights);
17172  // which event weights were used:
17173  if(!strcmp(fMultiplicityWeight->Data(),"combinations"))
17174  {
17175   fIntFlowFlags->Fill(1.5,0); // 0 = "combinations" (default)
17176  } else if(!strcmp(fMultiplicityWeight->Data(),"unit"))
17177    {
17178     fIntFlowFlags->Fill(1.5,1); // 1 = "unit"   
17179    } else if(!strcmp(fMultiplicityWeight->Data(),"multiplicity"))
17180      {
17181       fIntFlowFlags->Fill(1.5,2); // 2 = "multiplicity"        
17182      } 
17183  fIntFlowFlags->Fill(2.5,(Int_t)fApplyCorrectionForNUA);
17184  fIntFlowFlags->Fill(3.5,(Int_t)fPrintFinalResults[0]);
17185  fIntFlowFlags->Fill(4.5,(Int_t)fPrintFinalResults[1]);
17186  fIntFlowFlags->Fill(5.5,(Int_t)fPrintFinalResults[2]);
17187  fIntFlowFlags->Fill(6.5,(Int_t)fPrintFinalResults[3]);
17188  fIntFlowFlags->Fill(7.5,(Int_t)fApplyCorrectionForNUAVsM);
17189  fIntFlowFlags->Fill(8.5,(Int_t)fPropagateErrorAlsoFromNIT);
17190  fIntFlowFlags->Fill(9.5,(Int_t)fCalculateCumulantsVsM);
17191  fIntFlowFlags->Fill(10.5,(Int_t)fMinimumBiasReferenceFlow);
17192  fIntFlowFlags->Fill(11.5,(Int_t)fForgetAboutCovariances);
17193  fIntFlowFlags->Fill(12.5,(Int_t)fStorePhiDistributionForOneEvent); 
17194  fIntFlowFlags->Fill(13.5,(Int_t)fFillMultipleControlHistograms);  
17195  fIntFlowFlags->Fill(14.5,(Int_t)fCalculateAllCorrelationsVsM);  
17196  fIntFlowFlags->Fill(15.5,(Int_t)fMultiplicityIsRefMultiplicity);  
17197 } // end of void AliFlowAnalysisWithQCumulants::StoreIntFlowFlags()
17198
17199 //=======================================================================================================================
17200
17201 void AliFlowAnalysisWithQCumulants::StoreDiffFlowFlags()
17202 {
17203  // Store all flags for differential flow in the profile fDiffFlowFlags.
17204   
17205  if(!fDiffFlowFlags)
17206  {
17207   printf("\n WARNING (QC): fDiffFlowFlags is NULL in AFAWQC::SDFF() !!!!\n\n");
17208   exit(0);
17209  } 
17210  
17211  fDiffFlowFlags->Fill(0.5,fCalculateDiffFlow); // calculate differential flow
17212  fDiffFlowFlags->Fill(1.5,fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights); // particle weights used or not?
17213  //fDiffFlowFlags->Fill(2.5,""); // which event weight was used? ("combinations", "unit" or "multiplicity") to be improved - finalized
17214  fDiffFlowFlags->Fill(3.5,fApplyCorrectionForNUA); // corrected for non-uniform acceptance or not
17215  fDiffFlowFlags->Fill(4.5,fCalculate2DDiffFlow); // calculate also 2D differential flow vs (pt,eta) 
17216  fDiffFlowFlags->Fill(5.5,fCalculateDiffFlowVsEta); // if you set kFALSE only differential flow vs pt is calculated
17217      
17218 } // end of void AliFlowAnalysisWithQCumulants::StoreDiffFlowFlags()
17219
17220 //=======================================================================================================================
17221
17222 void AliFlowAnalysisWithQCumulants::StoreMixedHarmonicsFlags()
17223 {
17224  // Store all flags for mixed harmonics in profile fMixedHarmonicsFlags.
17225  
17226  if(!fMixedHarmonicsFlags)
17227  {
17228   cout<<"WARNING: fMixedHarmonicsFlags is NULL in AFAWQC::SMHF() !!!!"<<endl;
17229   exit(0);
17230  } 
17231
17232  fMixedHarmonicsFlags->Fill(0.5,(Int_t)fCalculateMixedHarmonics);
17233  fMixedHarmonicsFlags->Fill(1.5,(Int_t)fHarmonic);
17234  fMixedHarmonicsFlags->Fill(2.5,(Int_t)fCalculateMixedHarmonicsVsM);
17235  // Which multiplicity weight was used?:
17236
17237  if(!strcmp(fMultiplicityWeight->Data(),"combinations"))
17238  {
17239   fMixedHarmonicsFlags->Fill(3.5,0); // 0 = "combinations" (default)
17240  } else if(!strcmp(fMultiplicityWeight->Data(),"unit"))
17241    {
17242     fMixedHarmonicsFlags->Fill(3.5,1); // 1 = "unit"   
17243    } else if(!strcmp(fMultiplicityWeight->Data(),"multiplicity"))
17244      {
17245       fMixedHarmonicsFlags->Fill(3.5,2); // 2 = "multiplicity"        
17246      } 
17247
17248 } // end of void AliFlowAnalysisWithQCumulants::StoreMixedHarmonicsFlags()
17249
17250 //=======================================================================================================================
17251
17252 void AliFlowAnalysisWithQCumulants::GetPointersForCommonHistograms() 
17253 {
17254  // Access all pointers to common control and common result histograms and profiles.
17255  
17256  TString sCommonConstantsName = "fCommonConstants";
17257  sCommonConstantsName += fAnalysisLabel->Data();
17258  fCommonConstants = dynamic_cast<TProfile*>(fHistList->FindObject(sCommonConstantsName.Data()));
17259  if(!fCommonConstants)
17260  {
17261   printf("\n WARNING (QC): fCommonConstants is NULL in AFAWQC::GPFCH() !!!!\n\n");
17262   exit(0);
17263  }
17264  
17265  // to be improved - lines bellow can be implemented better.
17266  
17267  TString commonHistsName = "AliFlowCommonHistQC";
17268  commonHistsName += fAnalysisLabel->Data();
17269  AliFlowCommonHist *commonHist = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHistsName.Data()));
17270  if(commonHist) 
17271  {
17272   this->SetCommonHists(commonHist); 
17273   if(fCommonHists->GetHarmonic())
17274   {
17275    fHarmonic = (Int_t)(fCommonHists->GetHarmonic())->GetBinContent(1);
17276   } 
17277  } // end of if(commonHist) 
17278  TString commonHists2ndOrderName = "AliFlowCommonHist2ndOrderQC";
17279  commonHists2ndOrderName += fAnalysisLabel->Data();
17280  AliFlowCommonHist *commonHist2nd = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHists2ndOrderName.Data()));
17281  if(commonHist2nd) this->SetCommonHists2nd(commonHist2nd);   
17282  TString commonHists4thOrderName = "AliFlowCommonHist4thOrderQC";
17283  commonHists4thOrderName += fAnalysisLabel->Data();
17284  AliFlowCommonHist *commonHist4th = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHists4thOrderName.Data()));
17285  if(commonHist4th) this->SetCommonHists4th(commonHist4th);  
17286  TString commonHists6thOrderName = "AliFlowCommonHist6thOrderQC";
17287  commonHists6thOrderName += fAnalysisLabel->Data();
17288  AliFlowCommonHist *commonHist6th = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHists6thOrderName.Data()));
17289  if(commonHist6th) this->SetCommonHists6th(commonHist6th);  
17290  TString commonHists8thOrderName = "AliFlowCommonHist8thOrderQC";
17291  commonHists8thOrderName += fAnalysisLabel->Data();
17292  AliFlowCommonHist *commonHist8th = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHists8thOrderName.Data()));
17293  if(commonHist8th) this->SetCommonHists8th(commonHist8th); 
17294   
17295  TString commonHistResults2ndOrderName = "AliFlowCommonHistResults2ndOrderQC"; 
17296  commonHistResults2ndOrderName += fAnalysisLabel->Data(); 
17297  AliFlowCommonHistResults *commonHistRes2nd = dynamic_cast<AliFlowCommonHistResults*>
17298                                               (fHistList->FindObject(commonHistResults2ndOrderName.Data()));
17299  if(commonHistRes2nd) this->SetCommonHistsResults2nd(commonHistRes2nd);   
17300  TString commonHistResults4thOrderName = "AliFlowCommonHistResults4thOrderQC";
17301  commonHistResults4thOrderName += fAnalysisLabel->Data();
17302  AliFlowCommonHistResults *commonHistRes4th = dynamic_cast<AliFlowCommonHistResults*>
17303                                               (fHistList->FindObject(commonHistResults4thOrderName.Data()));
17304  if(commonHistRes4th) this->SetCommonHistsResults4th(commonHistRes4th);  
17305  TString commonHistResults6thOrderName = "AliFlowCommonHistResults6thOrderQC";
17306  commonHistResults6thOrderName += fAnalysisLabel->Data();
17307  AliFlowCommonHistResults *commonHistRes6th = dynamic_cast<AliFlowCommonHistResults*>
17308                                               (fHistList->FindObject(commonHistResults6thOrderName.Data()));
17309  if(commonHistRes6th) this->SetCommonHistsResults6th(commonHistRes6th);  
17310  TString commonHistResults8thOrderName = "AliFlowCommonHistResults8thOrderQC";
17311  commonHistResults8thOrderName += fAnalysisLabel->Data();
17312  AliFlowCommonHistResults *commonHistRes8th = dynamic_cast<AliFlowCommonHistResults*>
17313                                               (fHistList->FindObject(commonHistResults8thOrderName.Data()));  
17314  if(commonHistRes8th) this->SetCommonHistsResults8th(commonHistRes8th);
17315        
17316 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForCommonHistograms() 
17317
17318 //=======================================================================================================================
17319
17320 void AliFlowAnalysisWithQCumulants::GetPointersForParticleWeightsHistograms() 
17321 {
17322  // Get pointers for histograms with particle weights.
17323
17324  TList *weightsList = dynamic_cast<TList*>(fHistList->FindObject("Weights"));
17325  if(!weightsList){printf("\n WARNING (QC): weightsList is NULL in AFAWQC::GPFPWH() !!!!\n");exit(0);}
17326  this->SetWeightsList(weightsList);
17327  TString fUseParticleWeightsName = "fUseParticleWeightsQC"; // to be improved (hirdwired label QC)
17328  fUseParticleWeightsName += fAnalysisLabel->Data();
17329  TProfile *useParticleWeights = dynamic_cast<TProfile*>(weightsList->FindObject(fUseParticleWeightsName.Data()));
17330  if(useParticleWeights)
17331  {
17332   this->SetUseParticleWeights(useParticleWeights);  
17333   fUsePhiWeights = (Int_t)fUseParticleWeights->GetBinContent(1); 
17334   fUsePtWeights = (Int_t)fUseParticleWeights->GetBinContent(2); 
17335   fUseEtaWeights = (Int_t)fUseParticleWeights->GetBinContent(3);  
17336   fUseTrackWeights = (Int_t)fUseParticleWeights->GetBinContent(4);  
17337  }
17338 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForParticleWeightsHistograms(); 
17339
17340 //=======================================================================================================================
17341
17342 void AliFlowAnalysisWithQCumulants::GetPointersForIntFlowHistograms() 
17343 {
17344  // Get pointers for histograms and profiles relevant for integrated flow:
17345  //  a) Get pointer to base list for integrated flow holding profile fIntFlowFlags and lists fIntFlowProfiles and fIntFlowResults.
17346  //  b) Get pointer to profile fIntFlowFlags holding all flags for integrated flow.
17347  //  c) Get pointer to list fIntFlowProfiles and pointers to all objects that she holds. 
17348  //  d) Get pointer to list fIntFlowResults and pointers to all objects that she holds. 
17349   
17350  TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data member?)
17351  TString powerFlag[2] = {"linear","quadratic"}; // to be improved (should I promote this to data member?)
17352  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?)
17353  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?)
17354  
17355  // a) Get pointer to base list for integrated flow holding profile fIntFlowFlags and lists fIntFlowProfiles and fIntFlowResults:
17356  TList *intFlowList = NULL;
17357  intFlowList = dynamic_cast<TList*>(fHistList->FindObject("Integrated Flow"));
17358  if(!intFlowList) 
17359  {
17360   cout<<"WARNING: intFlowList is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17361   exit(0); 
17362  }  
17363   
17364  // b) Get pointer to profile fIntFlowFlags holding all flags for integrated flow:
17365  TString intFlowFlagsName = "fIntFlowFlags";
17366  intFlowFlagsName += fAnalysisLabel->Data();
17367  TProfile *intFlowFlags = dynamic_cast<TProfile*>(intFlowList->FindObject(intFlowFlagsName.Data()));
17368  if(intFlowFlags)
17369  {
17370   this->SetIntFlowFlags(intFlowFlags);  
17371   fApplyCorrectionForNUA = (Bool_t)intFlowFlags->GetBinContent(3); 
17372   fApplyCorrectionForNUAVsM = (Bool_t)intFlowFlags->GetBinContent(8); 
17373   fCalculateCumulantsVsM = (Bool_t)intFlowFlags->GetBinContent(10);  
17374  } else 
17375    {
17376     cout<<"WARNING: intFlowFlags is NULL in FAWQC::GPFIFH() !!!!"<<endl;
17377    }
17378   
17379   // c) Get pointer to list fIntFlowProfiles and pointers to all objects that she holds:
17380   TList *intFlowProfiles = NULL;
17381   intFlowProfiles = dynamic_cast<TList*>(intFlowList->FindObject("Profiles"));
17382   if(intFlowProfiles)  
17383   {
17384    // average multiplicities:
17385    TString avMultiplicityName = "fAvMultiplicity";
17386    avMultiplicityName += fAnalysisLabel->Data();
17387    TProfile *avMultiplicity = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(avMultiplicityName.Data()));
17388    if(avMultiplicity) 
17389    {
17390     this->SetAvMultiplicity(avMultiplicity);
17391    } else 
17392      {
17393       cout<<"WARNING: avMultiplicity is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17394      }
17395    // average correlations <<2>>, <<4>>, <<6>> and <<8>> (with wrong errors!):
17396    TString intFlowCorrelationsProName = "fIntFlowCorrelationsPro";
17397    intFlowCorrelationsProName += fAnalysisLabel->Data();
17398    TProfile *intFlowCorrelationsPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowCorrelationsProName.Data()));
17399    if(intFlowCorrelationsPro) 
17400    {
17401     this->SetIntFlowCorrelationsPro(intFlowCorrelationsPro);
17402    } else 
17403      {
17404       cout<<"WARNING: intFlowCorrelationsPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17405      }      
17406    // average squared correlations <<2>^2>, <<4>^2>, <<6>^2> and <<8^2>>:
17407    TString intFlowSquaredCorrelationsProName = "fIntFlowSquaredCorrelationsPro";
17408    intFlowSquaredCorrelationsProName += fAnalysisLabel->Data();
17409    TProfile *intFlowSquaredCorrelationsPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowSquaredCorrelationsProName.Data()));
17410    if(intFlowSquaredCorrelationsPro) 
17411    {
17412     this->SetIntFlowSquaredCorrelationsPro(intFlowSquaredCorrelationsPro);
17413    } else 
17414      {
17415       cout<<"WARNING: intFlowSquaredCorrelationsPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17416      }             
17417    if(fCalculateCumulantsVsM)
17418    {
17419     // Average correlations <<2>>, <<4>>, <<6>> and <<8>> versus multiplicity for all events (error is wrong here):   
17420     TString intFlowCorrelationsVsMProName = "fIntFlowCorrelationsVsMPro";
17421     intFlowCorrelationsVsMProName += fAnalysisLabel->Data();
17422     for(Int_t ci=0;ci<4;ci++) // correlation index
17423     {
17424      TProfile *intFlowCorrelationsVsMPro = dynamic_cast<TProfile*>
17425                                         (intFlowProfiles->FindObject(Form("%s, %s",intFlowCorrelationsVsMProName.Data(),correlationFlag[ci].Data())));
17426      if(intFlowCorrelationsVsMPro)
17427      {
17428       this->SetIntFlowCorrelationsVsMPro(intFlowCorrelationsVsMPro,ci);
17429      } else
17430        {
17431         cout<<"WARNING: "<<Form("intFlowCorrelationsVsMPro[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17432        }   
17433     } // end of for(Int_t ci=0;ci<4;ci++) // correlation index 
17434     // Average squared correlations <<2>^2>, <<4>^2>, <<6>^2> and <<8>^2> versus multiplicity for all events:   
17435     TString intFlowSquaredCorrelationsVsMProName = "fIntFlowSquaredCorrelationsVsMPro";
17436     intFlowSquaredCorrelationsVsMProName += fAnalysisLabel->Data();
17437     for(Int_t ci=0;ci<4;ci++) // correlation index
17438     {
17439      TProfile *intFlowSquaredCorrelationsVsMPro = dynamic_cast<TProfile*>
17440                       (intFlowProfiles->FindObject(Form("%s, %s",intFlowSquaredCorrelationsVsMProName.Data(),squaredCorrelationFlag[ci].Data())));
17441      if(intFlowSquaredCorrelationsVsMPro)
17442      {
17443       this->SetIntFlowSquaredCorrelationsVsMPro(intFlowSquaredCorrelationsVsMPro,ci);
17444      } else
17445        {
17446         cout<<"WARNING: "<<Form("intFlowSquaredCorrelationsVsMPro[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17447        }   
17448     } // end of for(Int_t ci=0;ci<4;ci++) // correlation index 
17449    } // end of if(fCalculateCumulantsVsM)
17450    // average all correlations for integrated flow (with wrong errors!):
17451    TString intFlowCorrelationsAllProName = "fIntFlowCorrelationsAllPro";
17452    intFlowCorrelationsAllProName += fAnalysisLabel->Data();
17453    TProfile *intFlowCorrelationsAllPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowCorrelationsAllProName.Data()));
17454    if(intFlowCorrelationsAllPro) 
17455    {
17456     this->SetIntFlowCorrelationsAllPro(intFlowCorrelationsAllPro);
17457    } else 
17458      {
17459       cout<<"WARNING: intFlowCorrelationsAllPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17460      }     
17461    // average extra correlations for integrated flow (which appear only when particle weights are used):
17462    // (to be improved: Weak point in implementation, I am assuming here that method GetPointersForParticleWeightsHistograms() was called)
17463    if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
17464    {
17465     TString intFlowExtraCorrelationsProName = "fIntFlowExtraCorrelationsPro";
17466     intFlowExtraCorrelationsProName += fAnalysisLabel->Data();
17467     TProfile *intFlowExtraCorrelationsPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowExtraCorrelationsProName.Data()));
17468     if(intFlowExtraCorrelationsPro) 
17469     {
17470      this->SetIntFlowExtraCorrelationsPro(intFlowExtraCorrelationsPro);
17471     } else 
17472       {
17473        cout<<"WARNING: intFlowExtraCorrelationsPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17474       }
17475    } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)        
17476    // average products of correlations <2>, <4>, <6> and <8>:  
17477    TString intFlowProductOfCorrelationsProName = "fIntFlowProductOfCorrelationsPro";
17478    intFlowProductOfCorrelationsProName += fAnalysisLabel->Data();
17479    TProfile *intFlowProductOfCorrelationsPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowProductOfCorrelationsProName.Data()));
17480    if(intFlowProductOfCorrelationsPro) 
17481    {
17482     this->SetIntFlowProductOfCorrelationsPro(intFlowProductOfCorrelationsPro);
17483    } else 
17484      {
17485       cout<<"WARNING: intFlowProductOfCorrelationsPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17486      }               
17487    // average product of correlations <2>, <4>, <6> and <8> versus multiplicity  
17488    // [0=<<2><4>>,1=<<2><6>>,2=<<2><8>>,3=<<4><6>>,4=<<4><8>>,5=<<6><8>>]  
17489    if(fCalculateCumulantsVsM)
17490    {
17491     TString intFlowProductOfCorrelationsVsMProName = "fIntFlowProductOfCorrelationsVsMPro";
17492     intFlowProductOfCorrelationsVsMProName += fAnalysisLabel->Data();
17493     TString productFlag[6] = {"#LT#LT2#GT#LT4#GT#GT","#LT#LT2#GT#LT6#GT#GT","#LT#LT2#GT#LT8#GT#GT",
17494                               "#LT#LT4#GT#LT6#GT#GT","#LT#LT4#GT#LT8#GT#GT","#LT#LT6#GT#LT8#GT#GT"};
17495     for(Int_t pi=0;pi<6;pi++)
17496     { 
17497      TProfile *intFlowProductOfCorrelationsVsMPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(Form("%s, %s",intFlowProductOfCorrelationsVsMProName.Data(),productFlag[pi].Data())));
17498      if(intFlowProductOfCorrelationsVsMPro)
17499      {
17500       this->SetIntFlowProductOfCorrelationsVsMPro(intFlowProductOfCorrelationsVsMPro,pi);
17501      } else
17502        {
17503         cout<<"WARNING: "<<Form("intFlowProductOfCorrelationsVsMPro[%d]",pi)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17504        }
17505     } // end of for(Int_t pi=0;pi<6;pi++)
17506    } // end of if(fCalculateCumulantsVsM)
17507    // average correction terms for non-uniform acceptance (with wrong errors!):
17508    for(Int_t sc=0;sc<2;sc++)
17509    {
17510     TString intFlowCorrectionTermsForNUAProName = "fIntFlowCorrectionTermsForNUAPro";
17511     intFlowCorrectionTermsForNUAProName += fAnalysisLabel->Data();
17512     TProfile *intFlowCorrectionTermsForNUAPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject((Form("%s: %s terms",intFlowCorrectionTermsForNUAProName.Data(),sinCosFlag[sc].Data()))));
17513     if(intFlowCorrectionTermsForNUAPro) 
17514     {
17515      this->SetIntFlowCorrectionTermsForNUAPro(intFlowCorrectionTermsForNUAPro,sc);
17516     } else 
17517       {
17518        cout<<"WARNING: intFlowCorrectionTermsForNUAPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17519        cout<<"sc = "<<sc<<endl;
17520       } 
17521     // versus multiplicity:
17522     if(fCalculateCumulantsVsM)
17523     {
17524      TString correctionTermFlag[4] = {"(n(phi1))","(n(phi1+phi2))","(n(phi1-phi2-phi3))","(n(2phi1-phi2))"}; // to be improved - hardwired 4
17525      TString intFlowCorrectionTermsForNUAVsMProName = "fIntFlowCorrectionTermsForNUAVsMPro";
17526      intFlowCorrectionTermsForNUAVsMProName += fAnalysisLabel->Data();
17527      for(Int_t ci=0;ci<4;ci++) // correction term index (to be improved - hardwired 4)
17528      {
17529       TProfile *intFlowCorrectionTermsForNUAVsMPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(Form("%s: #LT#LT%s%s#GT#GT",intFlowCorrectionTermsForNUAVsMProName.Data(),sinCosFlag[sc].Data(),correctionTermFlag[ci].Data())));
17530       if(intFlowCorrectionTermsForNUAVsMPro) 
17531       {
17532        this->SetIntFlowCorrectionTermsForNUAVsMPro(intFlowCorrectionTermsForNUAVsMPro,sc,ci);
17533       } else 
17534         {
17535          cout<<"WARNING: intFlowCorrectionTermsForNUAVsMPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17536          cout<<"sc = "<<sc<<endl;
17537          cout<<"ci = "<<ci<<endl;
17538         }       
17539      } // end of for(Int_t ci=0;ci<4;ci++) // correction term index (to be improved - hardwired 4)
17540     } // end of if(fCalculateCumulantsVsM)
17541    } // end of for(Int_t sc=0;sc<2;sc++)           
17542    // average products of correction terms for NUA:  
17543    TString intFlowProductOfCorrectionTermsForNUAProName = "fIntFlowProductOfCorrectionTermsForNUAPro";
17544    intFlowProductOfCorrectionTermsForNUAProName += fAnalysisLabel->Data();
17545    TProfile *intFlowProductOfCorrectionTermsForNUAPro = dynamic_cast<TProfile*>(intFlowProfiles->FindObject(intFlowProductOfCorrectionTermsForNUAProName.Data()));
17546    if(intFlowProductOfCorrectionTermsForNUAPro) 
17547    {
17548     this->SetIntFlowProductOfCorrectionTermsForNUAPro(intFlowProductOfCorrectionTermsForNUAPro);
17549    } else 
17550      {
17551       cout<<"WARNING: intFlowProductOfCorrectionTermsForNUAPro is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17552      }     
17553   } else // to if(intFlowProfiles)  
17554     {
17555      cout<<"WARNING: intFlowProfiles is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17556     }
17557    
17558   //  d) Get pointer to list fIntFlowResults and pointers to all objects that she holds. 
17559   TList *intFlowResults = NULL;
17560   intFlowResults = dynamic_cast<TList*>(intFlowList->FindObject("Results"));
17561   if(intFlowResults)
17562   {
17563    // average correlations <<2>>, <<4>>, <<6>> and <<8>> (with correct errors!):
17564    TString intFlowCorrelationsHistName = "fIntFlowCorrelationsHist";
17565    intFlowCorrelationsHistName += fAnalysisLabel->Data();
17566    TH1D *intFlowCorrelationsHist = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowCorrelationsHistName.Data()));
17567    if(intFlowCorrelationsHist) 
17568    {
17569     this->SetIntFlowCorrelationsHist(intFlowCorrelationsHist);
17570    } else 
17571      {
17572       cout<<"WARNING: intFlowCorrelationsHist is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17573      } 
17574    // average correlations <<2>>, <<4>>, <<6>> and <<8>> (with correct errors!) vs M:    
17575    if(fCalculateCumulantsVsM)
17576    {
17577     TString intFlowCorrelationsVsMHistName = "fIntFlowCorrelationsVsMHist";
17578     intFlowCorrelationsVsMHistName += fAnalysisLabel->Data();
17579     for(Int_t ci=0;ci<4;ci++) // correlation index
17580     {
17581      TH1D *intFlowCorrelationsVsMHist = dynamic_cast<TH1D*>
17582                                         (intFlowResults->FindObject(Form("%s, %s",intFlowCorrelationsVsMHistName.Data(),correlationFlag[ci].Data())));
17583      if(intFlowCorrelationsVsMHist)
17584      {
17585       this->SetIntFlowCorrelationsVsMHist(intFlowCorrelationsVsMHist,ci);
17586      } else
17587        {
17588         cout<<"WARNING: "<<Form("intFlowCorrelationsVsMHist[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17589        }   
17590     } // end of for(Int_t ci=0;ci<4;ci++) // correlation index   
17591    } // end of if(fCalculateCumulantsVsM)
17592    // average all correlations for integrated flow (with correct errors!):
17593    TString intFlowCorrelationsAllHistName = "fIntFlowCorrelationsAllHist";
17594    intFlowCorrelationsAllHistName += fAnalysisLabel->Data();
17595    TH1D *intFlowCorrelationsAllHist = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowCorrelationsAllHistName.Data()));
17596    if(intFlowCorrelationsAllHist) 
17597    {
17598     this->SetIntFlowCorrelationsAllHist(intFlowCorrelationsAllHist);
17599    } else 
17600      {
17601       cout<<"WARNING: intFlowCorrelationsAllHist is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17602      }  
17603    // average correction terms for non-uniform acceptance (with correct errors!):
17604    TString intFlowCorrectionTermsForNUAHistName = "fIntFlowCorrectionTermsForNUAHist";
17605    intFlowCorrectionTermsForNUAHistName += fAnalysisLabel->Data();
17606    for(Int_t sc=0;sc<2;sc++)
17607    {
17608     TH1D *intFlowCorrectionTermsForNUAHist = dynamic_cast<TH1D*>(intFlowResults->FindObject((Form("%s: %s terms",intFlowCorrectionTermsForNUAHistName.Data(),sinCosFlag[sc].Data()))));
17609     if(intFlowCorrectionTermsForNUAHist) 
17610     {
17611      this->SetIntFlowCorrectionTermsForNUAHist(intFlowCorrectionTermsForNUAHist,sc);
17612     } else 
17613       {
17614        cout<<"WARNING: intFlowCorrectionTermsForNUAHist is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17615        cout<<"sc = "<<sc<<endl;
17616       } 
17617    } // end of for(Int_t sc=0;sc<2;sc++)           
17618    // covariances (multiplied with weight dependent prefactor):
17619    TString intFlowCovariancesName = "fIntFlowCovariances";
17620    intFlowCovariancesName += fAnalysisLabel->Data();
17621    TH1D *intFlowCovariances = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowCovariancesName.Data()));
17622    if(intFlowCovariances) 
17623    {
17624     this->SetIntFlowCovariances(intFlowCovariances); 
17625    } else 
17626      {
17627       cout<<"WARNING: intFlowCovariances is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17628      } 
17629    // sum of linear and quadratic event weights for <2>, <4>, <6> and <8>:
17630    TString intFlowSumOfEventWeightsName = "fIntFlowSumOfEventWeights";
17631    intFlowSumOfEventWeightsName += fAnalysisLabel->Data();
17632    for(Int_t power=0;power<2;power++)
17633    {
17634     TH1D *intFlowSumOfEventWeights = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s: %s",intFlowSumOfEventWeightsName.Data(),powerFlag[power].Data())));
17635     if(intFlowSumOfEventWeights) 
17636     {
17637      this->SetIntFlowSumOfEventWeights(intFlowSumOfEventWeights,power);
17638     } else 
17639       {
17640        cout<<"WARNING: intFlowSumOfEventWeights is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17641        cout<<"power = "<<power<<endl;
17642       }                                   
17643    } // end of for(Int_t power=0;power<2;power++)                                                                  
17644    // sum of products of event weights for correlations <2>, <4>, <6> and <8>:  
17645    TString intFlowSumOfProductOfEventWeightsName = "fIntFlowSumOfProductOfEventWeights";
17646    intFlowSumOfProductOfEventWeightsName += fAnalysisLabel->Data();
17647    TH1D *intFlowSumOfProductOfEventWeights = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowSumOfProductOfEventWeightsName.Data()));
17648    if(intFlowSumOfProductOfEventWeights) 
17649    {
17650     this->SetIntFlowSumOfProductOfEventWeights(intFlowSumOfProductOfEventWeights);
17651    } else 
17652      {
17653       cout<<"WARNING: intFlowSumOfProductOfEventWeights is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17654      } 
17655    // final result for covariances of correlations (multiplied with weight dependent prefactor) versus M
17656    // [0=Cov(2,4),1=Cov(2,6),2=Cov(2,8),3=Cov(4,6),4=Cov(4,8),5=Cov(6,8)]:
17657    if(fCalculateCumulantsVsM)
17658    {
17659     TString intFlowCovariancesVsMName = "fIntFlowCovariancesVsM";
17660     intFlowCovariancesVsMName += fAnalysisLabel->Data();
17661     TString covarianceFlag[6] = {"Cov(<2>,<4>)","Cov(<2>,<6>)","Cov(<2>,<8>)","Cov(<4>,<6>)","Cov(<4>,<8>)","Cov(<6>,<8>)"};
17662     for(Int_t ci=0;ci<6;ci++)
17663     { 
17664      TH1D *intFlowCovariancesVsM = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s, %s",intFlowCovariancesVsMName.Data(),covarianceFlag[ci].Data())));
17665      if(intFlowCovariancesVsM)
17666      {
17667       this->SetIntFlowCovariancesVsM(intFlowCovariancesVsM,ci);
17668      } else
17669        {
17670         cout<<"WARNING: "<<Form("intFlowCovariancesVsM[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17671        }    
17672     } // end of for(Int_t ci=0;ci<6;ci++)
17673    } // end of if(fCalculateCumulantsVsM)
17674    // sum of linear and quadratic event weights for <2>, <4>, <6> and <8> versus multiplicity
17675    // [0=sum{w_{<2>}},1=sum{w_{<4>}},2=sum{w_{<6>}},3=sum{w_{<8>}}][0=linear 1,1=quadratic]:
17676    if(fCalculateCumulantsVsM)
17677    {
17678     TString intFlowSumOfEventWeightsVsMName = "fIntFlowSumOfEventWeightsVsM";
17679     intFlowSumOfEventWeightsVsMName += fAnalysisLabel->Data();
17680     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>}"},
17681                              {"#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}"}};
17682     for(Int_t si=0;si<4;si++)
17683     {
17684      for(Int_t power=0;power<2;power++)
17685      {
17686       TH1D *intFlowSumOfEventWeightsVsM = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s, %s",intFlowSumOfEventWeightsVsMName.Data(),sumFlag[power][si].Data())));
17687       if(intFlowSumOfEventWeightsVsM)
17688       {
17689        this->SetIntFlowSumOfEventWeightsVsM(intFlowSumOfEventWeightsVsM,si,power);
17690       } else
17691         {
17692          cout<<"WARNING: "<<Form("intFlowSumOfEventWeightsVsM[%d][%d]",si,power)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17693         }    
17694      } // end of for(Int_t power=0;power<2;power++)
17695     } // end of for(Int_t si=0;si<4;si++)   
17696    } // end of if(fCalculateCumulantsVsM)
17697    // sum of products of event weights for correlations <2>, <4>, <6> and <8> vs M
17698    // [0=sum{w_{<2>}w_{<4>}},1=sum{w_{<2>}w_{<6>}},2=sum{w_{<2>}w_{<8>}},
17699    //  3=sum{w_{<4>}w_{<6>}},4=sum{w_{<4>}w_{<8>}},5=sum{w_{<6>}w_{<8>}}]:  
17700    if(fCalculateCumulantsVsM)
17701    {
17702     TString intFlowSumOfProductOfEventWeightsVsMName = "fIntFlowSumOfProductOfEventWeightsVsM";
17703     intFlowSumOfProductOfEventWeightsVsMName += fAnalysisLabel->Data();
17704     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>}",
17705                             "#sum_{i=1}^{N} w_{<4>} w_{<6>}","#sum_{i=1}^{N} w_{<4>} w_{<8>}","#sum_{i=1}^{N} w_{<6>} w_{<8>}"}; 
17706     for(Int_t pi=0;pi<6;pi++)
17707     {
17708      TH1D *intFlowSumOfProductOfEventWeightsVsM = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s, %s",intFlowSumOfProductOfEventWeightsVsMName.Data(),sopowFlag[pi].Data())));
17709      if(intFlowSumOfProductOfEventWeightsVsM)
17710      {
17711       this->SetIntFlowSumOfProductOfEventWeightsVsM(intFlowSumOfProductOfEventWeightsVsM,pi);
17712      } else
17713        {
17714         cout<<"WARNING: "<<Form("intFlowSumOfProductOfEventWeightsVsM[%d]",pi)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17715        }
17716     } // end of for(Int_t pi=0;pi<6;pi++)        
17717    } // end of if(fCalculateCumulantsVsM)
17718    // covariances for NUA (multiplied with weight dependent prefactor):
17719    TString intFlowCovariancesNUAName = "fIntFlowCovariancesNUA";
17720    intFlowCovariancesNUAName += fAnalysisLabel->Data();
17721    TH1D *intFlowCovariancesNUA = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowCovariancesNUAName.Data()));
17722    if(intFlowCovariancesNUA) 
17723    {
17724     this->SetIntFlowCovariancesNUA(intFlowCovariancesNUA); 
17725    } else 
17726      {
17727       cout<<"WARNING: intFlowCovariancesNUA is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17728      } 
17729    // sum of linear and quadratic event weights NUA terms:
17730    TString intFlowSumOfEventWeightsNUAName = "fIntFlowSumOfEventWeightsNUA";
17731    intFlowSumOfEventWeightsNUAName += fAnalysisLabel->Data();
17732    for(Int_t sc=0;sc<2;sc++)
17733    {
17734     for(Int_t power=0;power<2;power++)
17735     {
17736      TH1D *intFlowSumOfEventWeightsNUA = dynamic_cast<TH1D*>(intFlowResults->FindObject(Form("%s: %s, %s",intFlowSumOfEventWeightsNUAName.Data(),powerFlag[power].Data(),sinCosFlag[sc].Data())));
17737      if(intFlowSumOfEventWeightsNUA) 
17738      {
17739       this->SetIntFlowSumOfEventWeightsNUA(intFlowSumOfEventWeightsNUA,sc,power);
17740      } else 
17741        {
17742         cout<<"WARNING: intFlowSumOfEventWeightsNUA is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17743         cout<<"sc    = "<<sc<<endl;
17744         cout<<"power = "<<power<<endl;
17745        }                                   
17746     } // end of for(Int_t power=0;power<2;power++)                                                                  
17747    } // end of for(Int_t sc=0;sc<2;sc++)     
17748    // sum of products of event weights for NUA terms:  
17749    TString intFlowSumOfProductOfEventWeightsNUAName = "fIntFlowSumOfProductOfEventWeightsNUA";
17750    intFlowSumOfProductOfEventWeightsNUAName += fAnalysisLabel->Data();
17751    TH1D *intFlowSumOfProductOfEventWeightsNUA = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowSumOfProductOfEventWeightsNUAName.Data()));
17752    if(intFlowSumOfProductOfEventWeightsNUA) 
17753    {
17754     this->SetIntFlowSumOfProductOfEventWeightsNUA(intFlowSumOfProductOfEventWeightsNUA);
17755    } else 
17756      {
17757       cout<<"WARNING: intFlowSumOfProductOfEventWeightsNUA is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17758      } 
17759    // Final results for reference Q-cumulants:
17760    TString intFlowQcumulantsName = "fIntFlowQcumulants";
17761    intFlowQcumulantsName += fAnalysisLabel->Data();
17762    TH1D *intFlowQcumulants = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowQcumulantsName.Data()));
17763    if(intFlowQcumulants) 
17764    {
17765     this->SetIntFlowQcumulants(intFlowQcumulants);
17766    } else 
17767      {
17768       cout<<"WARNING: intFlowQcumulants is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17769      }  
17770    // Final results for reference Q-cumulants rebinned in M:
17771    if(fCalculateCumulantsVsM)
17772    {
17773     TString intFlowQcumulantsRebinnedInMName = "fIntFlowQcumulantsRebinnedInM";
17774     intFlowQcumulantsRebinnedInMName += fAnalysisLabel->Data();
17775     TH1D *intFlowQcumulantsRebinnedInM = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowQcumulantsRebinnedInMName.Data()));
17776     if(intFlowQcumulantsRebinnedInM) 
17777     {
17778      this->SetIntFlowQcumulantsRebinnedInM(intFlowQcumulantsRebinnedInM);
17779     } else 
17780       {
17781        cout<<"WARNING: intFlowQcumulantsRebinnedInM is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17782       }  
17783    } // end of if(fCalculateCumulantsVsM)
17784    // Ratio between error squared: with/without non-isotropic terms:
17785    TString intFlowQcumulantsErrorSquaredRatioName = "fIntFlowQcumulantsErrorSquaredRatio";
17786    intFlowQcumulantsErrorSquaredRatioName += fAnalysisLabel->Data();
17787    TH1D *intFlowQcumulantsErrorSquaredRatio = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowQcumulantsErrorSquaredRatioName.Data()));
17788    if(intFlowQcumulantsErrorSquaredRatio) 
17789    {
17790     this->SetIntFlowQcumulantsErrorSquaredRatio(intFlowQcumulantsErrorSquaredRatio);
17791    } else 
17792      {
17793       cout<<" WARNING: intntFlowQcumulantsErrorSquaredRatio is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17794      }  
17795    // final results for integrated Q-cumulants versus multiplicity:
17796    TString cumulantFlag[4] = {"QC{2}","QC{4}","QC{6}","QC{8}"};
17797    if(fCalculateCumulantsVsM)
17798    {
17799     TString intFlowQcumulantsVsMName = "fIntFlowQcumulantsVsM";
17800     intFlowQcumulantsVsMName += fAnalysisLabel->Data();
17801     for(Int_t co=0;co<4;co++) // cumulant order
17802     {
17803      TH1D *intFlowQcumulantsVsM = dynamic_cast<TH1D*>
17804                                   (intFlowResults->FindObject(Form("%s, %s",intFlowQcumulantsVsMName.Data(),cumulantFlag[co].Data())));
17805      if(intFlowQcumulantsVsM)
17806      {
17807       this->SetIntFlowQcumulantsVsM(intFlowQcumulantsVsM,co);
17808      } else
17809        {
17810         cout<<"WARNING: "<<Form("intFlowQcumulantsVsM[%d]",co)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17811        }
17812     } // end of for(Int_t co=0;co<4;co++) // cumulant order
17813    } // end of if(fCalculateCumulantsVsM)
17814    // Final reference flow estimates from Q-cumulants:
17815    TString intFlowName = "fIntFlow";
17816    intFlowName += fAnalysisLabel->Data();
17817    TH1D *intFlow = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowName.Data()));
17818    if(intFlow) 
17819    {
17820     this->SetIntFlow(intFlow);
17821    } else 
17822      {
17823       cout<<"WARNING: intFlow is NULL in AFAWQC::GPFIFH() !!!!"<<endl; 
17824      } 
17825    // Final reference flow estimates from Q-cumulants vs M rebinned in M:
17826    if(fCalculateCumulantsVsM)
17827    {
17828     TString intFlowRebinnedInMName = "fIntFlowRebinnedInM";
17829     intFlowRebinnedInMName += fAnalysisLabel->Data();
17830     TH1D *intFlowRebinnedInM = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowRebinnedInMName.Data()));
17831     if(intFlowRebinnedInM) 
17832     {
17833      this->SetIntFlowRebinnedInM(intFlowRebinnedInM);
17834     } else 
17835       {
17836        cout<<"WARNING: intFlowRebinnedInM is NULL in AFAWQC::GPFIFH() !!!!"<<endl; 
17837       } 
17838    } // end of if(fCalculateCumulantsVsM)
17839    // integrated flow from Q-cumulants versus multiplicity:
17840    if(fCalculateCumulantsVsM)
17841    {
17842     TString intFlowVsMName = "fIntFlowVsM";
17843     intFlowVsMName += fAnalysisLabel->Data();
17844     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)};
17845     for(Int_t co=0;co<4;co++) // cumulant order
17846     {
17847      TH1D *intFlowVsM = dynamic_cast<TH1D*>
17848                         (intFlowResults->FindObject(Form("%s, %s",intFlowVsMName.Data(),flowFlag[co].Data())));            
17849      if(intFlowVsM)
17850      {
17851       this->SetIntFlowVsM(intFlowVsM,co);
17852      } else
17853        {
17854         cout<<"WARNING: "<<Form("intFlowVsM[%d]",co)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;      
17855        }
17856     } // end of for(Int_t co=0;co<4;co++) // cumulant order
17857    } // end of if(fCalculateCumulantsVsM)
17858    // quantifying detector effects effects to correlations:
17859    TString intFlowDetectorBiasName = "fIntFlowDetectorBias";
17860    intFlowDetectorBiasName += fAnalysisLabel->Data();
17861    TH1D *intFlowDetectorBias = dynamic_cast<TH1D*>(intFlowResults->FindObject(intFlowDetectorBiasName.Data()));
17862    if(intFlowDetectorBias) 
17863    {
17864     this->SetIntFlowDetectorBias(intFlowDetectorBias);
17865    } else 
17866      {
17867       cout<<"WARNING: intFlowDetectorBias is NULL in AFAWQC::GPFIFH() !!!!"<<endl; 
17868      } 
17869    // quantifying detector effects effects to correlations vs multiplicity:
17870    if(fCalculateCumulantsVsM)
17871    {
17872     TString intFlowDetectorBiasVsMName = "fIntFlowDetectorBiasVsM";
17873     intFlowDetectorBiasVsMName += fAnalysisLabel->Data();
17874     for(Int_t ci=0;ci<4;ci++) // correlation index
17875     {
17876      TH1D *intFlowDetectorBiasVsM = dynamic_cast<TH1D*>
17877                                     (intFlowResults->FindObject(Form("%s for %s",intFlowDetectorBiasVsMName.Data(),cumulantFlag[ci].Data())));
17878      if(intFlowDetectorBiasVsM)
17879      {
17880       this->SetIntFlowDetectorBiasVsM(intFlowDetectorBiasVsM,ci);
17881      } else
17882        {
17883         cout<<"WARNING: "<<Form("intFlowDetectorBiasVsM[%d]",ci)<<" is NULL in AFAWQC::GPFIFH() !!!!"<<endl;      
17884        }
17885     } // end of for(Int_t ci=0;ci<4;ci++) // correlation index   
17886    } // end of if(fCalculateCumulantsVsM)
17887   } else // to if(intFlowResults)
17888     {
17889      cout<<"WARNING: intFlowResults is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
17890     }
17891     
17892 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForIntFlowHistograms()
17893
17894 //=======================================================================================================================
17895
17896 void AliFlowAnalysisWithQCumulants::GetPointersFor2DDiffFlowHistograms()
17897 {
17898  // Get pointers for 2D differential flow histograms.
17899  //  a) Check pointers used in this method;
17900  //  b) Get pointers to 2D differential flow lists;
17901  //  c) Get pointers to 2D differential flow profiles;
17902  //  d) Get pointers to 2D differential flow histograms. 
17903
17904  // a) Check pointers used in this method:
17905  if(!fDiffFlowList)
17906  { 
17907   printf("\n WARNING (QC): fDiffFlowList is NULL in AFAWQC::GPF2DDFH() !!!!\n");
17908   printf("               Call method GetPointersForDiffFlowHistograms() first.\n\n");
17909   exit(0);
17910  }
17911  if(!fDiffFlowFlags)
17912  { 
17913   printf("\n WARNING (QC): fDiffFlowFlags is NULL in AFAWQC::GPF2DDFH() !!!!\n\n");
17914   printf("               Call method GetPointersForDiffFlowHistograms() first.\n\n");
17915   exit(0);
17916  }
17917  
17918  // b) Get pointers to 2D differential flow lists:
17919  this->SetCalculate2DDiffFlow((Bool_t)fDiffFlowFlags->GetBinContent(5)); // to be improved - hardwired 5
17920  if(!fCalculate2DDiffFlow){return;}
17921  TString typeFlag[2] = {"RP","POI"}; 
17922  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"};
17923  TString differentialCumulantIndex[4] = {"QC{2'}","QC{4'}","QC{6'}","QC{8'}"};  
17924  TString differentialFlowIndex[4] = {"v'{2}","v'{4}","v'{6}","v'{8}"};  
17925  // Base list: 
17926  TString diffFlow2DListName = "2D"; 
17927  diffFlow2DListName += fAnalysisLabel->Data();
17928  fDiffFlow2D = dynamic_cast<TList*>(fDiffFlowList->FindObject(diffFlow2DListName.Data()));
17929  if(!fDiffFlow2D)
17930  { 
17931   printf("\n WARNING (QC): fDiffFlow2D is NULL in AFAWQC::GPFDFH() !!!!\n\n");
17932   exit(0);
17933  }
17934  // Lists holding profiles with 2D correlations: 
17935  TString s2DDiffFlowCorrelationsProListName = "Profiles with 2D correlations"; 
17936  s2DDiffFlowCorrelationsProListName += fAnalysisLabel->Data(); // to be improved
17937  for(Int_t t=0;t<2;t++)
17938  {
17939   f2DDiffFlowCorrelationsProList[t] = dynamic_cast<TList*>(fDiffFlow2D->FindObject(Form("Profiles with 2D correlations (%s)",typeFlag[t].Data())));
17940   if(!f2DDiffFlowCorrelationsProList[t])
17941   { 
17942    printf("\n WARNING (QC): f2DDiffFlowCorrelationsProList[%i] is NULL in AFAWQC::GPF2DFH() !!!!\n\n",t);
17943    exit(0);
17944   }
17945  } // end of for(Int_t t=0;t<2;t++) 
17946  
17947  // c) Get pointers to 2D differential flow profiles:
17948  TString s2DDiffFlowCorrelationsProName = "f2DDiffFlowCorrelationsPro";
17949  s2DDiffFlowCorrelationsProName += fAnalysisLabel->Data();
17950  for(Int_t t=0;t<2;t++) // type: RP or POI
17951  { 
17952   for(Int_t rci=0;rci<4;rci++) // reduced correlation index
17953   {
17954    f2DDiffFlowCorrelationsPro[t][rci] = dynamic_cast<TProfile2D*>(f2DDiffFlowCorrelationsProList[t]->FindObject(Form("%s, %s, %s",s2DDiffFlowCorrelationsProName.Data(),typeFlag[t].Data(),reducedCorrelationIndex[rci].Data())));
17955    if(!f2DDiffFlowCorrelationsPro[t][rci])
17956    {
17957     printf("\n WARNING (QC): f2DDiffFlowCorrelationsPro[%i][%i] is NULL in AFAWQC::GPF2DFH() !!!!\n\n",t,rci);
17958     exit(0);   
17959    } else
17960      {
17961       this->Set2DDiffFlowCorrelationsPro(f2DDiffFlowCorrelationsPro[t][rci],t,rci);
17962      } 
17963   } // end of for(Int_t rci=0;rci<4;rci++) // reduced correlation index
17964  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI 
17965
17966  // d) Get pointers to 2D differential flow histograms: 
17967  TString s2DDiffFlowCumulantsName = "f2DDiffFlowCumulants";
17968  s2DDiffFlowCumulantsName += fAnalysisLabel->Data();
17969  TString s2DDiffFlowName = "f2DDiffFlow";
17970  s2DDiffFlowName += fAnalysisLabel->Data();
17971  for(Int_t t=0;t<2;t++) // type: RP or POI
17972  { 
17973   for(Int_t rci=0;rci<4;rci++) // reduced correlation index
17974   {
17975    // 2D differential cumulants:
17976    f2DDiffFlowCumulants[t][rci] = dynamic_cast<TH2D*>(f2DDiffFlowCorrelationsProList[t]->FindObject(Form("%s, %s, %s",s2DDiffFlowCumulantsName.Data(),typeFlag[t].Data(),differentialCumulantIndex[rci].Data())));
17977    if(!f2DDiffFlowCumulants[t][rci])
17978    {
17979     printf("\n WARNING (QC): f2DDiffFlowCumulants[%i][%i] is NULL in AFAWQC::GPF2DFH() !!!!\n\n",t,rci);
17980     exit(0);   
17981    } else
17982      {
17983       this->Set2DDiffFlowCumulants(f2DDiffFlowCumulants[t][rci],t,rci);
17984      } 
17985    // 2D differential flow:
17986    f2DDiffFlow[t][rci] = dynamic_cast<TH2D*>(f2DDiffFlowCorrelationsProList[t]->FindObject(Form("%s, %s, %s",s2DDiffFlowName.Data(),typeFlag[t].Data(),differentialFlowIndex[rci].Data())));
17987    if(!f2DDiffFlow[t][rci])
17988    {
17989     printf("\n WARNING (QC): f2DDiffFlow[%i][%i] is NULL in AFAWQC::GPF2DFH() !!!!\n\n",t,rci);
17990     exit(0);   
17991    } else
17992      {
17993       this->Set2DDiffFlow(f2DDiffFlow[t][rci],t,rci);
17994      } 
17995   } // end of for(Int_t rci=0;rci<4;rci++) // reduced correlation index
17996  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI 
17997   
17998 } // end of void AliFlowAnalysisWithQCumulants::GetPointersFor2DDiffFlowHistograms()
17999
18000 //=======================================================================================================================
18001
18002 void AliFlowAnalysisWithQCumulants::GetPointersForOtherDiffCorrelators()
18003 {
18004  // Get pointers for other differential correlators.
18005  //  a) Get pointer to list with other differential correlators;
18006  //  b) Declare local flags;
18007  //  c) Get pointers to other differential profiles.
18008
18009  if(!fCalculateDiffFlow){return;} // TBI: This must eventually be moved somewhere else 
18010
18011  // a) Get pointer to list with other differential correlators:
18012  fOtherDiffCorrelatorsList = dynamic_cast<TList*>(fHistList->FindObject("Other differential correlators"));  
18013  if(!fOtherDiffCorrelatorsList)
18014  { 
18015   printf("\n WARNING (QC): fOtherDiffCorrelatorsList is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18016   exit(0);
18017  }
18018  
18019  // b) Declare local flags: // (to be improved - promoted to data members)
18020  TString typeFlag[2] = {"RP","POI"}; 
18021  TString ptEtaFlag[2] = {"p_{T}","#eta"};
18022  TString sinCosFlag[2] = {"sin","cos"}; 
18023   
18024  // c) Get pointers to other differential profiles:
18025  TString otherDiffCorrelatorsName = "fOtherDiffCorrelators";
18026  otherDiffCorrelatorsName += fAnalysisLabel->Data();
18027  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
18028  { 
18029   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18030   {
18031    for(Int_t sc=0;sc<2;sc++) // sin or cos
18032    {
18033     for(Int_t ci=0;ci<1;ci++) // correlator index
18034     {
18035      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))); 
18036      if(!fOtherDiffCorrelators[t][pe][sc][ci])
18037      {
18038       printf("\n WARNING (QC): fOtherDiffCorrelators[%i][%i][%i][%i] is NULL in AFAWQC::GPFODC() !!!!\n\n",t,pe,sc,ci);
18039       exit(0);       
18040      } else
18041        {
18042         this->SetOtherDiffCorrelators(fOtherDiffCorrelators[t][pe][sc][ci],t,pe,sc,ci);     
18043        } 
18044     } // end of for(Int_t ci=0;ci<1;ci++) // correlator index
18045    } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
18046   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
18047  } // end of for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
18048   
18049 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForOtherDiffCorrelators()
18050
18051 //=======================================================================================================================
18052
18053 void AliFlowAnalysisWithQCumulants::GetPointersForDiffFlowHistograms()
18054 {
18055  // Get pointer to all objects relevant for differential flow.
18056  //  a) Get pointer to base list for differential flow fDiffFlowList;
18057  //  b) Get pointer to profile fDiffFlowFlags holding all flags for differential flow. Access and set some flags;
18058  //  c) Get pointers to nested lists fDiffFlowListProfiles and fDiffFlowListResults;
18059  //  d) Define flags locally (to be improved: should I promote these flags to data members?);
18060  //  e) Get pointers to all nested lists in fDiffFlowListProfiles and to profiles which they hold;
18061  //  f) Get pointers to all nested lists in fDiffFlowListResults and to histograms which they hold.
18062  
18063  // a) Get pointer to base list for differential flow fDiffFlowList:
18064  fDiffFlowList = dynamic_cast<TList*>(fHistList->FindObject("Differential Flow"));  
18065  if(!fDiffFlowList)
18066  { 
18067   printf("\n WARNING (QC): fDiffFlowList is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18068   exit(0);
18069  }
18070  
18071  // b) Get pointer to profile fDiffFlowFlags holding all flags for differential flow. Access and set some flags:
18072  TString diffFlowFlagsName = "fDiffFlowFlags";
18073  diffFlowFlagsName += fAnalysisLabel->Data();
18074  fDiffFlowFlags = dynamic_cast<TProfile*>(fDiffFlowList->FindObject(diffFlowFlagsName.Data()));
18075  if(fDiffFlowFlags)
18076  {
18077   this->SetCalculateDiffFlow((Bool_t)fDiffFlowFlags->GetBinContent(1)); // to be improved - hardwired 1
18078   this->SetCalculateDiffFlowVsEta((Bool_t)fDiffFlowFlags->GetBinContent(6)); // to be improved - hardwired 6
18079  } else
18080    {
18081     printf("\n WARNING (QC): fDiffFlowFlags is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18082     printf("\n             Flags in method Finish() are wrong.\n\n");
18083     exit(0);
18084    } 
18085    
18086  if(!fCalculateDiffFlow){return;} // IMPORTANT: do not move this anywhere above in this method (to be improved)   
18087   
18088  // c) Get pointers to nested lists fDiffFlowListProfiles and fDiffFlowListResults:
18089  //  List holding nested lists holding profiles:
18090  TList *diffFlowListProfiles = NULL;
18091  diffFlowListProfiles = dynamic_cast<TList*>(fDiffFlowList->FindObject("Profiles"));
18092  if(!diffFlowListProfiles)
18093  { 
18094   printf("\n WARNING (QC): diffFlowListProfiles is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18095   exit(0);
18096  }
18097  //  List holding nested lists holding histograms with final results:
18098  TList *diffFlowListResults = NULL;
18099  diffFlowListResults = dynamic_cast<TList*>(fDiffFlowList->FindObject("Results"));
18100  if(!diffFlowListResults)
18101  { 
18102   printf("\n WARNING (QC): diffFlowListResults is NULL in AFAWQC::GPFDFH() !!!!\n\n");
18103   exit(0);
18104  }
18105  
18106  // d) Define flags locally (to be improved: should I promote these flags to data members?):
18107  TString typeFlag[2] = {"RP","POI"}; 
18108  TString ptEtaFlag[2] = {"p_{T}","#eta"};
18109  TString powerFlag[2] = {"linear","quadratic"};
18110  TString sinCosFlag[2] = {"sin","cos"};
18111  TString differentialCumulantIndex[4] = {"QC{2'}","QC{4'}","QC{6'}","QC{8'}"};  
18112  TString differentialFlowIndex[4] = {"v'{2}","v'{4}","v'{6}","v'{8}"};  
18113  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"};
18114  TString reducedSquaredCorrelationIndex[4] = {"<2'>^{2}","<4'>^{2}","<6'>^{2}","<8'>^{2}"}; 
18115  TString mixedCorrelationIndex[8] = {"<2>","<2'>","<4>","<4'>","<6>","<6'>","<8>","<8'>"};
18116  TString covarianceName[5] = {"Cov(<2>,<2'>)","Cov(<2>,<4'>)","Cov(<4>,<2'>)","Cov(<4>,<4'>)","Cov(<2'>,<4'>)"}; 
18117   
18118  // e) Get pointers to all nested lists in fDiffFlowListProfiles and to profiles which they hold:
18119  // correlations:
18120  TList *diffFlowCorrelationsProList[2][2] = {{NULL}};
18121  TString diffFlowCorrelationsProName = "fDiffFlowCorrelationsPro";
18122  diffFlowCorrelationsProName += fAnalysisLabel->Data();
18123  TProfile *diffFlowCorrelationsPro[2][2][4] = {{{NULL}}}; 
18124  // squared correlations:  
18125  TString diffFlowSquaredCorrelationsProName = "fDiffFlowSquaredCorrelationsPro";
18126  diffFlowSquaredCorrelationsProName += fAnalysisLabel->Data(); 
18127  TProfile *diffFlowSquaredCorrelationsPro[2][2][4] = {{{NULL}}};  
18128  // products of correlations:
18129  TList *diffFlowProductOfCorrelationsProList[2][2] = {{NULL}};
18130  TString diffFlowProductOfCorrelationsProName = "fDiffFlowProductOfCorrelationsPro";
18131  diffFlowProductOfCorrelationsProName += fAnalysisLabel->Data();  
18132  TProfile *diffFlowProductOfCorrelationsPro[2][2][8][8] = {{{{NULL}}}};   
18133  // corrections:
18134  TList *diffFlowCorrectionsProList[2][2] = {{NULL}};
18135  TString diffFlowCorrectionTermsForNUAProName = "fDiffFlowCorrectionTermsForNUAPro";
18136  diffFlowCorrectionTermsForNUAProName += fAnalysisLabel->Data();  
18137  TProfile *diffFlowCorrectionTermsForNUAPro[2][2][2][10] = {{{{NULL}}}};   
18138  for(Int_t t=0;t<2;t++)
18139  {
18140   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++)
18141   {
18142    diffFlowCorrelationsProList[t][pe] = dynamic_cast<TList*>(diffFlowListProfiles->FindObject(Form("Profiles with correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18143    if(!diffFlowCorrelationsProList[t][pe])
18144    { 
18145     cout<<"WARNING: diffFlowCorrelationsProList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18146     cout<<"t = "<<t<<endl;
18147     cout<<"pe = "<<pe<<endl;
18148     exit(0);
18149    }
18150    for(Int_t ci=0;ci<4;ci++) // correlation index
18151    {
18152     // reduced correlations:
18153     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())));
18154     if(diffFlowCorrelationsPro[t][pe][ci])
18155     {
18156      this->SetDiffFlowCorrelationsPro(diffFlowCorrelationsPro[t][pe][ci],t,pe,ci);
18157     } else
18158       {
18159        cout<<"WARNING: diffFlowCorrelationsPro[t][pe][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18160        cout<<"t  = "<<t<<endl;
18161        cout<<"pe = "<<pe<<endl;   
18162        cout<<"ci = "<<ci<<endl;
18163       }     
18164     // reduced squared correlations:
18165     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())));
18166     if(diffFlowSquaredCorrelationsPro[t][pe][ci])
18167     {
18168      this->SetDiffFlowSquaredCorrelationsPro(diffFlowSquaredCorrelationsPro[t][pe][ci],t,pe,ci);
18169     } else
18170       {
18171        cout<<"WARNING: diffFlowSquaredCorrelationsPro[t][pe][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18172        cout<<"t  = "<<t<<endl;
18173        cout<<"pe = "<<pe<<endl;   
18174        cout<<"ci = "<<ci<<endl;
18175       }       
18176    } // end of for(Int_t ci=0;ci<4;ci++) // correlation index  
18177    // products of correlations:    
18178    diffFlowProductOfCorrelationsProList[t][pe] = dynamic_cast<TList*>(diffFlowListProfiles->FindObject(Form("Profiles with products of correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()))); 
18179    if(!diffFlowProductOfCorrelationsProList[t][pe])
18180    { 
18181     cout<<"WARNING: ddiffFlowProductOfCorrelationsProList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18182     cout<<"t = "<<t<<endl;
18183     cout<<"pe = "<<pe<<endl;
18184     exit(0);
18185    }
18186    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
18187    {
18188     for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
18189     {
18190      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())));
18191      if(diffFlowProductOfCorrelationsPro[t][pe][mci1][mci2])
18192      {
18193       this->SetDiffFlowProductOfCorrelationsPro(diffFlowProductOfCorrelationsPro[t][pe][mci1][mci2],t,pe,mci1,mci2);
18194      } else
18195        {
18196         cout<<"WARNING: diffFlowProductOfCorrelationsPro[t][pe][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18197         cout<<"t    = "<<t<<endl;
18198         cout<<"pe   = "<<pe<<endl;   
18199         cout<<"mci1 = "<<mci1<<endl;
18200         cout<<"mci2 = "<<mci2<<endl;
18201        }
18202      if(mci1%2 == 0) mci2++; // products which DO NOT include reduced correlations are not stored here
18203     } // end of for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
18204    } // end of for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index    
18205    // corrections:
18206    diffFlowCorrectionsProList[t][pe] = dynamic_cast<TList*>(diffFlowListProfiles->FindObject(Form("Profiles with correction terms for NUA (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18207    if(!diffFlowCorrectionsProList[t][pe])
18208    { 
18209     cout<<"WARNING: diffFlowCorrectionsProList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18210     cout<<"t = "<<t<<endl;
18211     cout<<"pe = "<<pe<<endl;
18212     exit(0);
18213    }
18214    // correction terms for NUA:
18215    for(Int_t sc=0;sc<2;sc++) // sin or cos
18216    {
18217     for(Int_t cti=0;cti<9;cti++) // correction term index
18218     {
18219      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)));
18220      if(diffFlowCorrectionTermsForNUAPro[t][pe][sc][cti])
18221      {
18222       this->SetDiffFlowCorrectionTermsForNUAPro(diffFlowCorrectionTermsForNUAPro[t][pe][sc][cti],t,pe,sc,cti);
18223      } else
18224        {
18225         cout<<"WARNING: diffFlowCorrectionTermsForNUAPro[t][pe][sc][cti] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18226         cout<<"t   = "<<t<<endl;
18227         cout<<"pe  = "<<pe<<endl;   
18228         cout<<"sc  = "<<sc<<endl;
18229         cout<<"cti = "<<cti<<endl;
18230        }    
18231     } // end of for(Int_t cti=0;cti<9;cti++) // correction term index
18232    } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
18233    // ...
18234   } // end of for(Int_t pe=0;pe<2;pe++)
18235  } // end of for(Int_t t=0;t<2;t++)
18236   
18237  // f) Get pointers to all nested lists in fDiffFlowListResults and to histograms which they hold:
18238  // reduced correlations:
18239  TList *diffFlowCorrelationsHistList[2][2] = {{NULL}};
18240  TString diffFlowCorrelationsHistName = "fDiffFlowCorrelationsHist";
18241  diffFlowCorrelationsHistName += fAnalysisLabel->Data();  
18242  TH1D *diffFlowCorrelationsHist[2][2][4] = {{{NULL}}};
18243  // corrections for NUA:
18244  TList *diffFlowCorrectionsHistList[2][2] = {{NULL}};
18245  TString diffFlowCorrectionTermsForNUAHistName = "fDiffFlowCorrectionTermsForNUAHist";
18246  diffFlowCorrectionTermsForNUAHistName += fAnalysisLabel->Data();  
18247  TH1D *diffFlowCorrectionTermsForNUAHist[2][2][2][10] = {{{{NULL}}}};
18248  // differential Q-cumulants:
18249  TList *diffFlowCumulantsHistList[2][2] = {{NULL}};
18250  TString diffFlowCumulantsName = "fDiffFlowCumulants";
18251  diffFlowCumulantsName += fAnalysisLabel->Data();  
18252  TH1D *diffFlowCumulants[2][2][4] = {{{NULL}}};
18253  // detector bias to differential Q-cumulants:
18254  TList *diffFlowDetectorBiasHistList[2][2] = {{NULL}};
18255  TString diffFlowDetectorBiasName = "fDiffFlowDetectorBias";
18256  diffFlowDetectorBiasName += fAnalysisLabel->Data();  
18257  TH1D *diffFlowDetectorBias[2][2][4] = {{{NULL}}}; 
18258  // differential flow estimates from Q-cumulants:
18259  TList *diffFlowHistList[2][2] = {{NULL}};
18260  TString diffFlowName = "fDiffFlow";
18261  diffFlowName += fAnalysisLabel->Data();  
18262  TH1D *diffFlow[2][2][4] = {{{NULL}}};
18263  // differential covariances:
18264  TList *diffFlowCovariancesHistList[2][2] = {{NULL}};
18265  TString diffFlowCovariancesName = "fDiffFlowCovariances";
18266  diffFlowCovariancesName += fAnalysisLabel->Data();  
18267  TH1D *diffFlowCovariances[2][2][5] = {{{NULL}}};
18268  for(Int_t t=0;t<2;t++) // type: RP or POI
18269  { 
18270   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18271   {
18272    // reduced correlations:
18273    diffFlowCorrelationsHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18274    if(!diffFlowCorrelationsHistList[t][pe])
18275    { 
18276     cout<<"WARNING: diffFlowCorrelationsHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18277     cout<<"t = "<<t<<endl;
18278     cout<<"pe = "<<pe<<endl;
18279     exit(0);
18280    }
18281    for(Int_t index=0;index<4;index++) 
18282    {
18283     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())));
18284     if(diffFlowCorrelationsHist[t][pe][index])
18285     {
18286      this->SetDiffFlowCorrelationsHist(diffFlowCorrelationsHist[t][pe][index],t,pe,index);
18287     } else 
18288       {
18289        cout<<"WARNING: diffFlowCorrelationsHist[t][pe][index] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18290        cout<<"t     = "<<t<<endl;
18291        cout<<"pe    = "<<pe<<endl;
18292        cout<<"index = "<<index<<endl;
18293        exit(0);       
18294       } 
18295    } // end of for(Int_t index=0;index<4;index++)
18296    // corrections:
18297    diffFlowCorrectionsHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Histograms with correction terms for NUA (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18298    if(!diffFlowCorrectionsHistList[t][pe])
18299    { 
18300     cout<<"WARNING: diffFlowCorrectionsHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18301     cout<<"t = "<<t<<endl;
18302     cout<<"pe = "<<pe<<endl;
18303     exit(0);
18304    }
18305    // correction terms for NUA:
18306    for(Int_t sc=0;sc<2;sc++) // sin or cos
18307    {
18308     for(Int_t cti=0;cti<9;cti++) // correction term index
18309     {
18310      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)));
18311      if(diffFlowCorrectionTermsForNUAHist[t][pe][sc][cti])
18312      {
18313       this->SetDiffFlowCorrectionTermsForNUAHist(diffFlowCorrectionTermsForNUAHist[t][pe][sc][cti],t,pe,sc,cti);
18314      } else
18315        {
18316         cout<<"WARNING: diffFlowCorrectionTermsForNUAHist[t][pe][sc][cti] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18317         cout<<"t   = "<<t<<endl;
18318         cout<<"pe  = "<<pe<<endl;   
18319         cout<<"sc  = "<<sc<<endl;
18320         cout<<"cti = "<<cti<<endl;
18321        }    
18322     } // end of for(Int_t cti=0;cti<9;cti++) // correction term index
18323    } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
18324    // ...
18325    // differential Q-cumulants:
18326    diffFlowCumulantsHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Differential Q-cumulants (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18327    if(!diffFlowCumulantsHistList[t][pe])
18328    { 
18329     cout<<"WARNING: diffFlowCumulantsHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18330     cout<<"t  = "<<t<<endl;
18331     cout<<"pe = "<<pe<<endl;
18332     exit(0);
18333    }
18334    for(Int_t index=0;index<4;index++) 
18335    {
18336     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())));
18337     if(diffFlowCumulants[t][pe][index])
18338     {
18339      this->SetDiffFlowCumulants(diffFlowCumulants[t][pe][index],t,pe,index);
18340     } else 
18341       {
18342        cout<<"WARNING: diffFlowCumulants[t][pe][index] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18343        cout<<"t     = "<<t<<endl;
18344        cout<<"pe    = "<<pe<<endl;
18345        cout<<"index = "<<index<<endl;
18346        exit(0);       
18347       } 
18348    } // end of for(Int_t index=0;index<4;index++)
18349    // Detector bias to differential Q-cumulants:
18350    diffFlowDetectorBiasHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Detector bias (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18351    if(!diffFlowDetectorBiasHistList[t][pe])
18352    { 
18353     cout<<"WARNING: diffFlowDetectorBiasHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18354     cout<<"t  = "<<t<<endl;
18355     cout<<"pe = "<<pe<<endl;
18356     exit(0);
18357    }
18358    for(Int_t index=0;index<4;index++) 
18359    {
18360     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())));
18361     if(diffFlowDetectorBias[t][pe][index])
18362     {
18363      this->SetDiffFlowDetectorBias(diffFlowDetectorBias[t][pe][index],t,pe,index);
18364     } else 
18365       {
18366        cout<<"WARNING: diffFlowDetectorBias[t][pe][index] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18367        cout<<"t     = "<<t<<endl;
18368        cout<<"pe    = "<<pe<<endl;
18369        cout<<"index = "<<index<<endl;
18370        exit(0);       
18371       } 
18372    } // end of for(Int_t index=0;index<4;index++)
18373    // differential flow estimates from Q-cumulants:
18374    diffFlowHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Differential flow (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18375    if(!diffFlowHistList[t][pe])
18376    { 
18377     cout<<"WARNING: diffFlowHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18378     cout<<"t  = "<<t<<endl;
18379     cout<<"pe = "<<pe<<endl;
18380     exit(0);
18381    }
18382    for(Int_t index=0;index<4;index++) 
18383    {
18384     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())));
18385     if(diffFlow[t][pe][index])
18386     {
18387      this->SetDiffFlow(diffFlow[t][pe][index],t,pe,index);
18388     } else 
18389       {
18390        cout<<"WARNING: diffFlow[t][pe][index] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18391        cout<<"t     = "<<t<<endl;
18392        cout<<"pe    = "<<pe<<endl;
18393        cout<<"index = "<<index<<endl;
18394        exit(0);       
18395       } 
18396    } // end of for(Int_t index=0;index<4;index++)
18397    // differential covariances:
18398    diffFlowCovariancesHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Covariances of correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18399    if(!diffFlowCovariancesHistList[t][pe])
18400    { 
18401     cout<<"WARNING: diffFlowCovariancesHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18402     cout<<"t  = "<<t<<endl;
18403     cout<<"pe = "<<pe<<endl;
18404     exit(0);
18405    }
18406    for(Int_t covIndex=0;covIndex<5;covIndex++) 
18407    {
18408     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())));
18409     if(diffFlowCovariances[t][pe][covIndex])
18410     {
18411      this->SetDiffFlowCovariances(diffFlowCovariances[t][pe][covIndex],t,pe,covIndex);
18412     } else 
18413       {
18414        cout<<"WARNING: diffFlowCovariances[t][pe][covIndex] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18415        cout<<"t        = "<<t<<endl;
18416        cout<<"pe       = "<<pe<<endl;
18417        cout<<"covIndex = "<<covIndex<<endl;
18418        exit(0);       
18419       } 
18420    } // end of for(Int_t covIndex=0;covIndex<5;covIndex++) // covariance index    
18421   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
18422  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI 
18423  // sum of event weights for reduced correlations:
18424  TList *diffFlowSumOfEventWeightsHistList[2][2][2] = {{{NULL}}};
18425  TString diffFlowSumOfEventWeightsName = "fDiffFlowSumOfEventWeights";
18426  diffFlowSumOfEventWeightsName += fAnalysisLabel->Data();  
18427  TH1D *diffFlowSumOfEventWeights[2][2][2][4] = {{{{NULL}}}};
18428  for(Int_t t=0;t<2;t++) // type is RP or POI
18429  { 
18430   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18431   { 
18432    for(Int_t p=0;p<2;p++) // power of event weights is either 1 or 2
18433    {
18434     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())));
18435     if(!diffFlowSumOfEventWeightsHistList[t][pe][p])
18436     { 
18437      cout<<"WARNING: diffFlowSumOfEventWeightsHistList[t][pe][p] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18438      cout<<"t     = "<<t<<endl;
18439      cout<<"pe    = "<<pe<<endl;
18440      cout<<"power = "<<p<<endl;
18441      exit(0);
18442     }
18443     for(Int_t ew=0;ew<4;ew++) // index of reduced correlation
18444     {
18445      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())));    
18446      if(diffFlowSumOfEventWeights[t][pe][p][ew])
18447      {
18448       this->SetDiffFlowSumOfEventWeights(diffFlowSumOfEventWeights[t][pe][p][ew],t,pe,p,ew);
18449      } else 
18450        {
18451         cout<<"WARNING: diffFlowSumOfEventWeights[t][pe][p][ew] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18452         cout<<"t     = "<<t<<endl;
18453         cout<<"pe    = "<<pe<<endl;
18454         cout<<"power = "<<p<<endl;
18455         cout<<"ew    = "<<ew<<endl;
18456         exit(0);       
18457        } 
18458     }
18459    } // end of for(Int_t p=0;p<2;p++) // power of event weights is either 1 or 2
18460   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
18461  } // end of for(Int_t t=0;t<2;t++) // type is RP or POI
18462  //  
18463  TList *diffFlowSumOfProductOfEventWeightsHistList[2][2] = {{NULL}};
18464  TString diffFlowSumOfProductOfEventWeightsName = "fDiffFlowSumOfProductOfEventWeights";
18465  diffFlowSumOfProductOfEventWeightsName += fAnalysisLabel->Data();  
18466  TH1D *diffFlowSumOfProductOfEventWeights[2][2][8][8] = {{{{NULL}}}};
18467  for(Int_t t=0;t<2;t++) // type is RP or POI
18468  { 
18469   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18470   { 
18471    diffFlowSumOfProductOfEventWeightsHistList[t][pe] = dynamic_cast<TList*>(diffFlowListResults->FindObject(Form("Sum of products of event weights (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data())));
18472    if(!diffFlowSumOfProductOfEventWeightsHistList[t][pe])
18473    { 
18474     cout<<"WARNING: diffFlowSumOfProductOfEventWeightsHistList[t][pe] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18475     cout<<"t     = "<<t<<endl;
18476     cout<<"pe    = "<<pe<<endl;
18477     exit(0);
18478    }
18479    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
18480    {
18481     for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
18482     {
18483      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())));    
18484       if(diffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2])
18485       {
18486        this->SetDiffFlowSumOfProductOfEventWeights(diffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2],t,pe,mci1,mci2);
18487       } else 
18488         {
18489          cout<<"WARNING: diffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
18490          cout<<"t    = "<<t<<endl;
18491          cout<<"pe   = "<<pe<<endl;
18492          cout<<"mci1 = "<<mci1<<endl;
18493          cout<<"mci2 = "<<mci2<<endl;
18494          exit(0);       
18495         } 
18496      if(mci1%2 == 0) mci2++; // products which DO NOT include reduced correlations are not stored here
18497     } // end of for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
18498    } // end of for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
18499   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
18500  } // end of for(Int_t t=0;t<2;t++) // type is RP or POI
18501
18502 } // end void AliFlowAnalysisWithQCumulants::GetPointersForDiffFlowHistograms()
18503
18504 //=======================================================================================================================
18505
18506 void AliFlowAnalysisWithQCumulants::BookEverythingFor2DDifferentialFlow()
18507 {
18508  // Book all objects needed for 2D differential flow.
18509  //  a) Define flags locally (to be improved: should I promote flags to data members?);
18510  //  b) Book e-b-e quantities;
18511  //  c) Book 2D profiles;
18512  //  d) Book 2D histograms.
18513  
18514  if(!fCalculate2DDiffFlow){return;}
18515
18516  // a) Define flags locally (to be improved: should I promote flags to data members?):
18517  TString typeFlag[2] = {"RP","POI"}; 
18518  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"};
18519  TString differentialCumulantIndex[4] = {"QC{2'}","QC{4'}","QC{6'}","QC{8'}"};  
18520  TString differentialFlowIndex[4] = {"v'{2}","v'{4}","v'{6}","v'{8}"};  
18521   
18522  // b) Book e-b-e quantities: 
18523  TProfile2D styleRe("typeMultiplePowerRe","typeMultiplePowerRe",fnBinsPt,fPtMin,fPtMax,fnBinsEta,fEtaMin,fEtaMax);
18524  TProfile2D styleIm("typeMultiplePowerIm","typeMultiplePowerIm",fnBinsPt,fPtMin,fPtMax,fnBinsEta,fEtaMin,fEtaMax);
18525  for(Int_t t=0;t<3;t++) // typeFlag (0 = RP, 1 = POI, 2 = RP&&POI )
18526  { 
18527   for(Int_t m=0;m<4;m++)
18528   {
18529    for(Int_t k=0;k<9;k++)
18530    {
18531     fReRPQ2dEBE[t][m][k] = (TProfile2D*)styleRe.Clone(Form("typeFlag%dmultiple%dpower%dRe",t,m,k)); 
18532     fImRPQ2dEBE[t][m][k] = (TProfile2D*)styleIm.Clone(Form("typeFlag%dmultiple%dpower%dIm",t,m,k));
18533    }
18534   } 
18535  } 
18536  TProfile2D styleS("typePower","typePower",fnBinsPt,fPtMin,fPtMax,fnBinsEta,fEtaMin,fEtaMax);
18537  for(Int_t t=0;t<3;t++) // typeFlag (0 = RP, 1 = POI, 2 = RP&&POI )
18538  { 
18539   for(Int_t k=0;k<9;k++)
18540   {
18541    fs2dEBE[t][k] = (TProfile2D*)styleS.Clone(Form("typeFlag%dpower%d",t,k));
18542   }
18543  }
18544
18545  // c) Book 2D profiles:
18546  TString s2DDiffFlowCorrelationsProName = "f2DDiffFlowCorrelationsPro";
18547  s2DDiffFlowCorrelationsProName += fAnalysisLabel->Data();
18548  for(Int_t t=0;t<2;t++) // type: RP or POI
18549  { 
18550   for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18551   {
18552    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,"");
18553    f2DDiffFlowCorrelationsPro[t][rci]->Sumw2();
18554    f2DDiffFlowCorrelationsPro[t][rci]->SetXTitle("p_{t}");
18555    f2DDiffFlowCorrelationsPro[t][rci]->SetYTitle("#eta");
18556    f2DDiffFlowCorrelationsProList[t]->Add(f2DDiffFlowCorrelationsPro[t][rci]); 
18557   } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
18558  } // end of for(Int_t t=0;t<2;t++) // type: RP or POIs
18559
18560  // d) Book 2D histograms:
18561  TString s2DDiffFlowCumulantsName = "f2DDiffFlowCumulants";
18562  s2DDiffFlowCumulantsName += fAnalysisLabel->Data();
18563  TString s2DDiffFlowName = "f2DDiffFlow";
18564  s2DDiffFlowName += fAnalysisLabel->Data();
18565  for(Int_t t=0;t<2;t++) // type: RP or POI
18566  { 
18567   for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18568   {
18569    // 2D diferential cumulants:
18570    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);
18571    f2DDiffFlowCumulants[t][rci]->SetXTitle("p_{t}");
18572    f2DDiffFlowCumulants[t][rci]->SetYTitle("#eta");
18573    f2DDiffFlowCorrelationsProList[t]->Add(f2DDiffFlowCumulants[t][rci]); //  to be improved - moved to another list 
18574    // 2D differential flow:
18575    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);
18576    f2DDiffFlow[t][rci]->SetXTitle("p_{t}");
18577    f2DDiffFlow[t][rci]->SetYTitle("#eta");
18578    f2DDiffFlowCorrelationsProList[t]->Add(f2DDiffFlow[t][rci]); //  to be improved - moved to another list 
18579   } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
18580  } // end of for(Int_t t=0;t<2;t++) // type: RP or POIs
18581
18582 } // void AliFlowAnalysisWithQCumulants::BookEverythingFor2DDifferentialFlow()
18583
18584 //=======================================================================================================================
18585
18586 void AliFlowAnalysisWithQCumulants::BookEverythingForDifferentialFlow()
18587 {
18588  // Book all histograms and profiles needed for differential flow.
18589  //  a) Book profile to hold all flags for differential flow;
18590  //  b) Define flags locally (to be improved: should I promote flags to data members?);
18591  //  c) Book e-b-e quantities;
18592  //  d) Book profiles;
18593  //  e) Book histograms holding final results. 
18594  
18595  // a) Book profile to hold all flags for differential flow:
18596  TString diffFlowFlagsName = "fDiffFlowFlags";
18597  diffFlowFlagsName += fAnalysisLabel->Data();
18598  fDiffFlowFlags = new TProfile(diffFlowFlagsName.Data(),"Flags for differential flow",6,0,6);
18599  fDiffFlowFlags->SetTickLength(-0.01,"Y");
18600  fDiffFlowFlags->SetMarkerStyle(25);
18601  fDiffFlowFlags->SetLabelSize(0.04,"X");
18602  fDiffFlowFlags->SetLabelOffset(0.02,"Y");
18603  fDiffFlowFlags->SetStats(kFALSE);
18604  fDiffFlowFlags->GetXaxis()->SetBinLabel(1,"Calculate diff. flow"); 
18605  fDiffFlowFlags->GetXaxis()->SetBinLabel(2,"Particle weights");
18606  fDiffFlowFlags->GetXaxis()->SetBinLabel(3,"Event weights");
18607  fDiffFlowFlags->GetXaxis()->SetBinLabel(4,"Correct for NUA");
18608  fDiffFlowFlags->GetXaxis()->SetBinLabel(5,"Calculate 2D diff. flow");
18609  fDiffFlowFlags->GetXaxis()->SetBinLabel(6,"Calculate diff. flow vs eta");
18610  fDiffFlowList->Add(fDiffFlowFlags);
18611
18612  if(!fCalculateDiffFlow){return;}
18613   
18614  // b) Define flags locally (to be improved: should I promote flags to data members?): 
18615  TString typeFlag[2] = {"RP","POI"}; 
18616  TString ptEtaFlag[2] = {"p_{T}","#eta"};
18617  TString powerFlag[2] = {"linear","quadratic"};
18618  TString sinCosFlag[2] = {"sin","cos"};
18619  TString differentialCumulantIndex[4] = {"QC{2'}","QC{4'}","QC{6'}","QC{8'}"};  
18620  TString differentialFlowIndex[4] = {"v'{2}","v'{4}","v'{6}","v'{8}"};  
18621  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"};
18622  TString reducedSquaredCorrelationIndex[4] = {"<2'>^{2}","<4'>^{2}","<6'>^{2}","<8'>^{2}"};
18623  TString mixedCorrelationIndex[8] = {"<2>","<2'>","<4>","<4'>","<6>","<6'>","<8>","<8'>"};
18624  TString covarianceName[5] = {"Cov(<2>,<2'>)","Cov(<2>,<4'>)","Cov(<4>,<2'>)","Cov(<4>,<4'>)","Cov(<2'>,<4'>)"}; 
18625  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
18626  Double_t minPtEta[2] = {fPtMin,fEtaMin};
18627  Double_t maxPtEta[2] = {fPtMax,fEtaMax};
18628    
18629  // c) Book e-b-e quantities:
18630  // Event-by-event r_{m*n,k}(pt,eta), p_{m*n,k}(pt,eta) and q_{m*n,k}(pt,eta)
18631  // Explanantion of notation:
18632  //  1.) n is harmonic, m is multiple of harmonic;
18633  //  2.) k is power of particle weight;
18634  //  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);   
18635  //  4.) p_{m*n,k}(pt,eta) = Q-vector evaluated in harmonic m*n for POIs in particular (pt,eta) bin 
18636  //                          (if i-th POI is also RP, than it is weighted with w_i^k);   
18637  //  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 
18638  //                          (i-th RP&&POI is weighted with w_i^k)            
18639   
18640  // 1D:
18641  for(Int_t t=0;t<3;t++) // typeFlag (0 = RP, 1 = POI, 2 = RP && POI )
18642  { 
18643   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18644   {
18645    for(Int_t m=0;m<4;m++) // multiple of harmonic
18646    {
18647     for(Int_t k=0;k<9;k++) // power of particle weight
18648     {
18649      fReRPQ1dEBE[t][pe][m][k] = new TProfile(Form("TypeFlag%dpteta%dmultiple%dpower%dRe",t,pe,m,k),
18650                                              Form("TypeFlag%dpteta%dmultiple%dpower%dRe",t,pe,m,k),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
18651      fImRPQ1dEBE[t][pe][m][k] = new TProfile(Form("TypeFlag%dpteta%dmultiple%dpower%dIm",t,pe,m,k),
18652                                              Form("TypeFlag%dpteta%dmultiple%dpower%dIm",t,pe,m,k),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
18653     }
18654    }
18655   }
18656  } 
18657  // to be improved (add explanation of fs1dEBE[t][pe][k]):   
18658  for(Int_t t=0;t<3;t++) // typeFlag (0 = RP, 1 = POI, 2 = RP&&POI )
18659  { 
18660   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18661   {
18662    for(Int_t k=0;k<9;k++) // power of particle weight
18663    {
18664     fs1dEBE[t][pe][k] = new TProfile(Form("TypeFlag%dpteta%dmultiple%d",t,pe,k),
18665                                      Form("TypeFlag%dpteta%dmultiple%d",t,pe,k),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
18666    }
18667   }
18668  }
18669  // correction terms for nua:
18670  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
18671  { 
18672   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18673   {
18674    for(Int_t sc=0;sc<2;sc++) // sin or cos
18675    {
18676     for(Int_t cti=0;cti<9;cti++) // correction term index
18677     {
18678      fDiffFlowCorrectionTermsForNUAEBE[t][pe][sc][cti] = new TH1D(Form("typeFlag%d pteta%d sincos%d cti%d",t,pe,sc,cti),
18679                                              Form("typeFlag%d pteta%d sincos%d cti%d",t,pe,sc,cti),nBinsPtEta[pe],minPtEta[pe],maxPtEta[pe]); 
18680     }
18681    }
18682   }
18683  } 
18684  // reduced correlations e-b-e:
18685  TString diffFlowCorrelationsEBEName = "fDiffFlowCorrelationsEBE";
18686  diffFlowCorrelationsEBEName += fAnalysisLabel->Data();
18687  for(Int_t t=0;t<2;t++) // type: RP or POI
18688  { 
18689   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18690   {
18691    for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18692    {
18693     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]);
18694    } // end of for(Int_t ci=0;ci<4;ci++) // correlation index
18695   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
18696  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
18697  // event weights for reduced correlations e-b-e:
18698  TString diffFlowEventWeightsForCorrelationsEBEName = "fDiffFlowEventWeightsForCorrelationsEBE";
18699  diffFlowEventWeightsForCorrelationsEBEName += fAnalysisLabel->Data();
18700  for(Int_t t=0;t<2;t++) // type: RP or POI
18701  { 
18702   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18703   {
18704    for(Int_t rci=0;rci<4;rci++) // event weight for reduced correlation index
18705    {
18706     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]);
18707    } // end of for(Int_t ci=0;ci<4;ci++) // correlation index
18708   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
18709  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
18710       
18711  // d) Book profiles;
18712  // reduced correlations:
18713  TString diffFlowCorrelationsProName = "fDiffFlowCorrelationsPro";
18714  diffFlowCorrelationsProName += fAnalysisLabel->Data();
18715  // reduced squared correlations:
18716  TString diffFlowSquaredCorrelationsProName = "fDiffFlowSquaredCorrelationsPro";
18717  diffFlowSquaredCorrelationsProName += fAnalysisLabel->Data();
18718  // corrections terms:
18719  TString diffFlowCorrectionTermsForNUAProName = "fDiffFlowCorrectionTermsForNUAPro";
18720  diffFlowCorrectionTermsForNUAProName += fAnalysisLabel->Data();
18721  // reduced correlations:
18722  for(Int_t t=0;t<2;t++) // type: RP or POI
18723  { 
18724   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18725   {
18726    for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18727    {
18728     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");
18729     fDiffFlowCorrelationsPro[t][pe][rci]->Sumw2();
18730     fDiffFlowCorrelationsPro[t][pe][rci]->SetXTitle(ptEtaFlag[pe].Data());
18731     fDiffFlowCorrelationsProList[t][pe]->Add(fDiffFlowCorrelationsPro[t][pe][rci]); // to be improved (add dedicated list to hold reduced correlations)
18732    } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
18733   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
18734  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
18735  // reduced squared correlations:
18736  for(Int_t t=0;t<2;t++) // type: RP or POI
18737  { 
18738   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18739   {
18740    for(Int_t rci=0;rci<4;rci++) // reduced correlation index
18741    {
18742     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");
18743     fDiffFlowSquaredCorrelationsPro[t][pe][rci]->Sumw2();
18744     fDiffFlowSquaredCorrelationsPro[t][pe][rci]->SetXTitle(ptEtaFlag[pe].Data());
18745     fDiffFlowCorrelationsProList[t][pe]->Add(fDiffFlowSquaredCorrelationsPro[t][pe][rci]); // to be improved (add dedicated list to hold reduced correlations)
18746    } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
18747   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
18748  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
18749  // correction terms for nua:
18750  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
18751  { 
18752   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18753   {
18754    for(Int_t sc=0;sc<2;sc++) // sin or cos
18755    {
18756     for(Int_t cti=0;cti<9;cti++) // correction term index
18757     {
18758      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]); 
18759      fDiffFlowCorrectionsProList[t][pe]->Add(fDiffFlowCorrectionTermsForNUAPro[t][pe][sc][cti]);
18760     }
18761    }
18762   }
18763  } 
18764  // Other differential correlators:
18765  TString otherDiffCorrelatorsName = "fOtherDiffCorrelators";
18766  otherDiffCorrelatorsName += fAnalysisLabel->Data();
18767  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
18768  { 
18769   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18770   {
18771    for(Int_t sc=0;sc<2;sc++) // sin or cos
18772    {
18773     for(Int_t ci=0;ci<1;ci++) // correlator index
18774     {
18775      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]); 
18776      fOtherDiffCorrelators[t][pe][sc][ci]->Sumw2();
18777      fOtherDiffCorrelatorsList->Add(fOtherDiffCorrelators[t][pe][sc][ci]);
18778     }
18779    }
18780   }
18781  }  
18782  // e) Book histograms holding final results. 
18783  // reduced correlations:
18784  TString diffFlowCorrelationsHistName = "fDiffFlowCorrelationsHist";
18785  diffFlowCorrelationsHistName += fAnalysisLabel->Data();
18786  // corrections terms:
18787  TString diffFlowCorrectionTermsForNUAHistName = "fDiffFlowCorrectionTermsForNUAHist";
18788  diffFlowCorrectionTermsForNUAHistName += fAnalysisLabel->Data();
18789  // differential covariances:
18790  TString diffFlowCovariancesName = "fDiffFlowCovariances";
18791  diffFlowCovariancesName += fAnalysisLabel->Data();
18792  // differential Q-cumulants:
18793  TString diffFlowCumulantsName = "fDiffFlowCumulants";
18794  diffFlowCumulantsName += fAnalysisLabel->Data();
18795  // Detector bias to differential Q-cumulants:
18796  TString diffFlowDetectorBiasName = "fDiffFlowDetectorBias";
18797  diffFlowDetectorBiasName += fAnalysisLabel->Data();
18798  // differential flow:
18799  TString diffFlowName = "fDiffFlow";
18800  diffFlowName += fAnalysisLabel->Data();
18801  for(Int_t t=0;t<2;t++) // type: RP or POI
18802  { 
18803   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18804   {
18805    for(Int_t index=0;index<4;index++) 
18806    {
18807     // reduced correlations:
18808     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]);
18809     fDiffFlowCorrelationsHist[t][pe][index]->SetXTitle(ptEtaFlag[pe].Data());
18810     fDiffFlowCorrelationsHistList[t][pe]->Add(fDiffFlowCorrelationsHist[t][pe][index]); 
18811     // differential Q-cumulants:
18812     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]);
18813     fDiffFlowCumulants[t][pe][index]->SetXTitle(ptEtaFlag[pe].Data());
18814     fDiffFlowCumulantsHistList[t][pe]->Add(fDiffFlowCumulants[t][pe][index]); 
18815     // Detector bias to differential Q-cumulants:
18816     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]);
18817     fDiffFlowDetectorBias[t][pe][index]->SetXTitle(ptEtaFlag[pe].Data());
18818     fDiffFlowDetectorBias[t][pe][index]->SetTitle(Form("#frac{corrected}{measured} %s",differentialCumulantIndex[index].Data()));
18819     fDiffFlowDetectorBiasHistList[t][pe]->Add(fDiffFlowDetectorBias[t][pe][index]); 
18820     // differential flow estimates from Q-cumulants:
18821     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]);
18822     fDiffFlow[t][pe][index]->SetXTitle(ptEtaFlag[pe].Data());
18823     fDiffFlowHistList[t][pe]->Add(fDiffFlow[t][pe][index]); 
18824    } // end of for(Int_t index=0;index<4;index++) 
18825    for(Int_t covIndex=0;covIndex<5;covIndex++) // covariance index 
18826    {
18827     // differential covariances:
18828     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]);
18829     fDiffFlowCovariances[t][pe][covIndex]->SetXTitle(ptEtaFlag[pe].Data());
18830     fDiffFlowCovariancesHistList[t][pe]->Add(fDiffFlowCovariances[t][pe][covIndex]); 
18831    } // end of for(Int_t covIndex=0;covIndex<5;covIndex++) // covariance index
18832    // products of both types of correlations: 
18833    TString diffFlowProductOfCorrelationsProName = "fDiffFlowProductOfCorrelationsPro";
18834    diffFlowProductOfCorrelationsProName += fAnalysisLabel->Data();  
18835    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
18836    {
18837     for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
18838     {
18839      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]); 
18840      fDiffFlowProductOfCorrelationsPro[t][pe][mci1][mci2]->SetXTitle(ptEtaFlag[pe].Data());
18841      fDiffFlowProductOfCorrelationsProList[t][pe]->Add(fDiffFlowProductOfCorrelationsPro[t][pe][mci1][mci2]); 
18842      if(mci1%2 == 0) mci2++; // products which DO NOT include reduced correlations are not stored here
18843     } // end of for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
18844    } // end of for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index    
18845   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
18846  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
18847  // sums of event weights for reduced correlations: 
18848  TString diffFlowSumOfEventWeightsName = "fDiffFlowSumOfEventWeights";
18849  diffFlowSumOfEventWeightsName += fAnalysisLabel->Data();  
18850  for(Int_t t=0;t<2;t++) // type is RP or POI
18851  { 
18852   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18853   { 
18854    for(Int_t p=0;p<2;p++) // power of weights is either 1 or 2
18855    {
18856     for(Int_t ew=0;ew<4;ew++) // index of reduced correlation
18857     {
18858      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]); 
18859      fDiffFlowSumOfEventWeights[t][pe][p][ew]->SetXTitle(ptEtaFlag[pe].Data());
18860      fDiffFlowSumOfEventWeightsHistList[t][pe][p]->Add(fDiffFlowSumOfEventWeights[t][pe][p][ew]); // to be improved (add dedicated list to hold all this)
18861     }
18862    }
18863   }
18864  } 
18865  // sum of products of event weights for both types of correlations: 
18866  TString diffFlowSumOfProductOfEventWeightsName = "fDiffFlowSumOfProductOfEventWeights";
18867  diffFlowSumOfProductOfEventWeightsName += fAnalysisLabel->Data();  
18868  for(Int_t t=0;t<2;t++) // type is RP or POI
18869  {
18870   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18871   { 
18872    for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index
18873    {
18874     for(Int_t mci2=mci1+1;mci2<8;mci2++) // mixed correlation index
18875     {
18876      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]); 
18877      fDiffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2]->SetXTitle(ptEtaFlag[pe].Data());
18878      fDiffFlowSumOfProductOfEventWeightsHistList[t][pe]->Add(fDiffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2]); 
18879      if(mci1%2 == 0) mci2++; // products which DO NOT include reduced correlations are not stored here
18880     }
18881    }
18882   }
18883  } 
18884  // correction terms for nua:
18885  for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
18886  { 
18887   for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
18888   {
18889    for(Int_t sc=0;sc<2;sc++) // sin or cos
18890    {
18891     for(Int_t cti=0;cti<9;cti++) // correction term index
18892     {
18893      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]); 
18894      fDiffFlowCorrectionsHistList[t][pe]->Add(fDiffFlowCorrectionTermsForNUAHist[t][pe][sc][cti]);
18895     }
18896    }
18897   }
18898  } 
18899           
18900 } // end of AliFlowAnalysisWithQCumulants::BookEverythingForDifferentialFlow()
18901
18902 //=======================================================================================================================
18903
18904 void AliFlowAnalysisWithQCumulants::CalculateQcumulantsCorrectedForNUAIntFlow()
18905 {
18906  // Calculate generalized Q-cumulants (cumulants corrected for non-unifom acceptance).
18907  
18908  // Isotropic cumulants:
18909  Double_t QC2 = fIntFlowQcumulants->GetBinContent(1);
18910  Double_t QC2Error = fIntFlowQcumulants->GetBinError(1);
18911  Double_t QC4 = fIntFlowQcumulants->GetBinContent(2);
18912  Double_t QC4Error = fIntFlowQcumulants->GetBinError(2);
18913  //Double_t QC6 = fIntFlowQcumulants->GetBinContent(3);
18914  //Double_t QC6Error = fIntFlowQcumulants->GetBinError(3);
18915  //Double_t QC8 = fIntFlowQcumulants->GetBinContent(4);
18916  //Double_t QC8Error = fIntFlowQcumulants->GetBinError(4);
18917  
18918  // Measured 2-, 4-, 6- and 8-particle correlations:
18919  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>>
18920  Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1); // statistical error of <<2>>
18921  Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>>
18922  Double_t fourError = fIntFlowCorrelationsHist->GetBinError(2); // statistical error of <<4>>
18923  //Double_t six = fIntFlowCorrelationsHist->GetBinContent(3); // <<6>>
18924  //Double_t sixError = fIntFlowCorrelationsHist->GetBinError(3); // statistical error of <<6>>
18925  //Double_t eight = fIntFlowCorrelationsHist->GetBinContent(4); // <<8>>
18926  //Double_t eightError = fIntFlowCorrelationsHist->GetBinError(4); // statistical error of <<8>>
18927   
18928  // Non-isotropic terms:
18929  Double_t c1 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(1); // <<cos(n*phi1)>>
18930  Double_t c1Error = fIntFlowCorrectionTermsForNUAHist[1]->GetBinError(1); // statistical error of <<cos(n*phi1)>>
18931  Double_t c2 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(2); // <<cos(n*(phi1+phi2))>>
18932  Double_t c2Error = fIntFlowCorrectionTermsForNUAHist[1]->GetBinError(2); // statistical error of <<cos(n*(phi1+phi2))>>
18933  Double_t c3 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(3); // <<cos(n*(phi1-phi2-phi3))>>
18934  Double_t c3Error = fIntFlowCorrectionTermsForNUAHist[1]->GetBinError(3); // statistical error of <<cos(n*(phi1-phi2-phi3))>>
18935  Double_t s1 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(1); // <<sin(n*phi1)>>
18936  Double_t s1Error = fIntFlowCorrectionTermsForNUAHist[0]->GetBinError(1); // statistical error of <<sin(n*phi1)>>
18937  Double_t s2 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(2); // <<sin(n*(phi1+phi2))>>
18938  Double_t s2Error = fIntFlowCorrectionTermsForNUAHist[0]->GetBinError(2); // statistical error of <<sin(n*(phi1+phi2))>>
18939  Double_t s3 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(3); // <<sin(n*(phi1-phi2-phi3))>>
18940  Double_t s3Error = fIntFlowCorrectionTermsForNUAHist[0]->GetBinError(3); // statistical error of <<sin(n*(phi1-phi2-phi3))>>
18941  
18942  // Shortcuts:
18943  Double_t a1 = 2.*pow(c1,2.)+2.*pow(s1,2.)-two;
18944  Double_t a2 = 6.*pow(c1,3.)-2.*c1*c2+c3+6.*c1*pow(s1,2.)-2.*s1*s2-4.*c1*two;
18945  Double_t a3 = 2.*pow(s1,2.)-2.*pow(c1,2.)+c2;
18946  Double_t a4 = 6.*pow(s1,3.)+6.*pow(c1,2.)*s1+2.*c2*s1-2.*c1*s2-s3-4.*s1*two;
18947  Double_t a5 = 4.*c1*s1-s2;
18948  
18949  // Covariances (including weight dependent prefactor):
18950  Double_t wCov1 = 0.; // w*Cov(<2>,<cos(phi)) 
18951  Double_t wCov2 = 0.; // w*Cov(<2>,<sin(phi))
18952  Double_t wCov3 = 0.; // w*Cov(<cos(phi),<sin(phi))
18953  Double_t wCov4 = 0.; // w*Cov(<2>,<4>) 
18954  Double_t wCov5 = 0.; // w*Cov(<2>,<cos(#phi_{1}+#phi_{2})>)
18955  Double_t wCov6 = 0.; // w*Cov(<2>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
18956  Double_t wCov7 = 0.; // w*Cov(<2>,<sin(#phi_{1}+#phi_{2})>)
18957  Double_t wCov8 = 0.; // w*Cov(<2>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
18958  Double_t wCov9 = 0.; // w*Cov(<4>,<cos(#phi)>
18959  Double_t wCov10 = 0.; // w*Cov(<4>,<cos(#phi_{1}+#phi_{2})>)
18960  Double_t wCov11 = 0.; // w*Cov(<4>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
18961  Double_t wCov12 = 0.; // w*Cov(<4>,<sin(#phi)>
18962  Double_t wCov13 = 0.; // w*Cov(<4>,<sin(#phi_{1}+#phi_{2})>)
18963  Double_t wCov14 = 0.; // w*Cov(<4>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
18964  Double_t wCov15 = 0.; // w*Cov(<cos(#phi)>,<cos(#phi_{1}+#phi_{2})>)
18965  Double_t wCov16 = 0.; // w*Cov(<cos(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
18966  Double_t wCov17 = 0.; // w*Cov(<cos(#phi)>,<sin(#phi_{1}+#phi_{2})>)
18967  Double_t wCov18 = 0.; // w*Cov(<cos(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
18968  Double_t wCov19 = 0.; // w*Cov(<cos(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
18969  Double_t wCov20 = 0.; // w*Cov(<sin(#phi)>,<cos(#phi_{1}+#phi_{2})>)
18970  Double_t wCov21 = 0.; // w*Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}+#phi_{2})>)
18971  Double_t wCov22 = 0.; // w*Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
18972  Double_t wCov23 = 0.; // w*Cov(<sin(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
18973  Double_t wCov24 = 0.; // w*Cov(<sin(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
18974  Double_t wCov25 = 0.; // w*Cov(<cos(#phi_{1}-#phi_{2}-#phi_{3}>,<sin(#phi_{1}-#phi_{2}-#phi_{3}>)
18975  Double_t wCov26 = 0.; // w*Cov(<sin(#phi)>,<sin(#phi_{1}+#phi_{2})>)
18976  Double_t wCov27 = 0.; // w*Cov(<sin(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
18977  Double_t wCov28 = 0.; // w*Cov(<sin(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
18978  if(!fForgetAboutCovariances)
18979  {
18980   wCov1 = fIntFlowCovariancesNUA->GetBinContent(1); // w*Cov(<2>,<cos(phi)) 
18981   wCov2 = fIntFlowCovariancesNUA->GetBinContent(2); // w*Cov(<2>,<sin(phi))
18982   wCov3 = fIntFlowCovariancesNUA->GetBinContent(3); // w*Cov(<cos(phi),<sin(phi))
18983   wCov4 = fIntFlowCovariances->GetBinContent(1); // w*Cov(<2>,<4>) 
18984   wCov5 = fIntFlowCovariancesNUA->GetBinContent(4); // w*Cov(<2>,<cos(#phi_{1}+#phi_{2})>)
18985   wCov6 = fIntFlowCovariancesNUA->GetBinContent(6); // w*Cov(<2>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
18986   wCov7 = fIntFlowCovariancesNUA->GetBinContent(5); // w*Cov(<2>,<sin(#phi_{1}+#phi_{2})>)
18987   wCov8 = fIntFlowCovariancesNUA->GetBinContent(7); // w*Cov(<2>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
18988   wCov9 = fIntFlowCovariancesNUA->GetBinContent(8); // w*Cov(<4>,<cos(#phi)>
18989   wCov10 = fIntFlowCovariancesNUA->GetBinContent(10); // w*Cov(<4>,<cos(#phi_{1}+#phi_{2})>)
18990   wCov11 = fIntFlowCovariancesNUA->GetBinContent(12); // w*Cov(<4>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
18991   wCov12 = fIntFlowCovariancesNUA->GetBinContent(9); // w*Cov(<4>,<sin(#phi)>
18992   wCov13 = fIntFlowCovariancesNUA->GetBinContent(11); // w*Cov(<4>,<sin(#phi_{1}+#phi_{2})>)
18993   wCov14 = fIntFlowCovariancesNUA->GetBinContent(13); // w*Cov(<4>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
18994   wCov15 = fIntFlowCovariancesNUA->GetBinContent(14); // w*Cov(<cos(#phi)>,<cos(#phi_{1}+#phi_{2})>)
18995   wCov16 = fIntFlowCovariancesNUA->GetBinContent(16); // w*Cov(<cos(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
18996   wCov17 = fIntFlowCovariancesNUA->GetBinContent(15); // w*Cov(<cos(#phi)>,<sin(#phi_{1}+#phi_{2})>)
18997   wCov18 = fIntFlowCovariancesNUA->GetBinContent(17); // w*Cov(<cos(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
18998   wCov19 = fIntFlowCovariancesNUA->GetBinContent(23); // w*Cov(<cos(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
18999   wCov20 = fIntFlowCovariancesNUA->GetBinContent(18); // w*Cov(<sin(#phi)>,<cos(#phi_{1}+#phi_{2})>)
19000   wCov21 = fIntFlowCovariancesNUA->GetBinContent(22); // w*Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}+#phi_{2})>)
19001   wCov22 = fIntFlowCovariancesNUA->GetBinContent(24); // w*Cov(<cos(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19002   wCov23 = fIntFlowCovariancesNUA->GetBinContent(20); // w*Cov(<sin(#phi)>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19003   wCov24 = fIntFlowCovariancesNUA->GetBinContent(25); // w*Cov(<sin(#phi_{1}+#phi_{2})>,<cos(#phi_{1}-#phi_{2}-#phi_{3})>)
19004   wCov25 = fIntFlowCovariancesNUA->GetBinContent(27); // w*Cov(<cos(#phi_{1}-#phi_{2}-#phi_{3}>,<sin(#phi_{1}-#phi_{2}-#phi_{3}>)
19005   wCov26 = fIntFlowCovariancesNUA->GetBinContent(19); // w*Cov(<sin(#phi)>,<sin(#phi_{1}+#phi_{2})>)
19006   wCov27 = fIntFlowCovariancesNUA->GetBinContent(21); // w*Cov(<sin(#phi)>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19007   wCov28 = fIntFlowCovariancesNUA->GetBinContent(26); // w*Cov(<sin(#phi_{1}+#phi_{2})>,<sin(#phi_{1}-#phi_{2}-#phi_{3})>)
19008  } // end of if(!fForgetAboutCovariances)
19009  
19010  // Calculating generalized QC{2}:
19011  //  Generalized QC{2}:
19012  Double_t gQC2 = two - pow(c1,2.) - pow(s1,2.);
19013  if(fApplyCorrectionForNUA){fIntFlowQcumulants->SetBinContent(1,gQC2);} 
19014  //  Statistical error of generalized QC{2}:
19015  Double_t gQC2ErrorSquared = pow(twoError,2.)+4.*pow(c1,2.)*pow(c1Error,2.)
19016                            + 4.*pow(s1,2.)*pow(s1Error,2.)
19017                            - 4*c1*wCov1-4*s1*wCov2 
19018                            + 8.*c1*s1*wCov3;
19019  //  Store ratio of error squared - with/without NUA terms:
19020  Double_t ratioErrorSquaredQC2 = 0.;
19021  if(fIntFlowQcumulants->GetBinError(1)>0.)
19022  { 
19023   ratioErrorSquaredQC2 = (gQC2ErrorSquared/pow(fIntFlowQcumulants->GetBinError(1),2.));
19024   fIntFlowQcumulantsErrorSquaredRatio->SetBinContent(1,ratioErrorSquaredQC2);
19025  }
19026  //  If enabled, store error by including non-isotropic terms:                         
19027  if(fApplyCorrectionForNUA && fPropagateErrorAlsoFromNIT)
19028  {
19029   if(gQC2ErrorSquared>=0.)
19030   {
19031    fIntFlowQcumulants->SetBinError(1,pow(gQC2ErrorSquared,0.5));
19032   } else
19033     {
19034      fIntFlowQcumulants->SetBinError(1,0.);
19035      cout<<endl;
19036      cout<<" WARNING (QC): Statistical error of generalized QC{2} is imaginary !!!!"<<endl;
19037      cout<<endl;
19038     }   
19039  } // end of if(fApplyCorrectionForNUA && fPropagateErrorAlsoFromNIT)
19040  // Quantify detector bias to QC{2}:
19041  if(TMath::Abs(QC2)>0.)
19042  {
19043   fIntFlowDetectorBias->SetBinContent(1,gQC2/QC2); 
19044   if(QC2Error>0.)
19045   {
19046    Double_t errorSquared = gQC2ErrorSquared/pow(QC2,2.)+pow(gQC2,2.)*pow(QC2Error,2.)/pow(QC2,4.);
19047    if(errorSquared>0.)
19048    {
19049     fIntFlowDetectorBias->SetBinError(1,pow(errorSquared,0.5));  
19050    }
19051   }
19052  } // end of if(TMath::Abs(QC2)>0.)
19053
19054  // Calculating generalized QC{4}:
19055  //  Generalized QC{4}:
19056  Double_t gQC4 = four-2.*pow(two,2.)
19057                - 4.*c1*c3+4.*s1*s3-pow(c2,2.)-pow(s2,2.)
19058                + 4.*c2*(pow(c1,2.)-pow(s1,2.))+8.*s2*s1*c1
19059                + 8.*two*(pow(c1,2.)+pow(s1,2.))-6.*pow((pow(c1,2.)+pow(s1,2.)),2.);
19060  if(fApplyCorrectionForNUA){fIntFlowQcumulants->SetBinContent(2,gQC4);}   
19061  //  Statistical error of generalized QC{4}:
19062  Double_t gQC4ErrorSquared = 16.*pow(a1,2.)*pow(twoError,2.)+pow(fourError,2.)+16.*pow(a2,2.)*pow(c1Error,2.)
19063                            + 4.*pow(a3,2.)*pow(c2Error,2.)+16.*pow(c1,2.)*pow(c3Error,2.)
19064                            + 16.*pow(a4,2.)*pow(s1Error,2.)+4.*pow(a5,2.)*pow(s2Error,2.)
19065                            + 16.*pow(s1,2.)*pow(s3Error,2.)+8.*a1*wCov4-32.*a1*a2*wCov1
19066                            - 16.*a3*a1*wCov5-32.*c1*a1*wCov6-32.*a1*a4*wCov2+16.*a5*a1*wCov7
19067                            + 32.*s1*a1*wCov8-8.*a2*wCov9-4.*a3*wCov10-8.*c1*wCov11-8.*a4*wCov12
19068                            + 4.*a5*wCov13+8.*s1*wCov14+16.*a3*a2*wCov15+32.*c1*a2*wCov16+32.*a2*a4*wCov3
19069                            - 16.*a5*a2*wCov17-32.*s1*a2*wCov18+16.*c1*a3*wCov19+16.*a3*a4*wCov20
19070                            - 8.*a3*a5*wCov21-16.*s1*a3*wCov22+32.*c1*a4*wCov23-16.*c1*a5*wCov24
19071                            - 32.*c1*s1*wCov25-16.*a5*a4*wCov26-32.*s1*a4*wCov27+16.*s1*a5*wCov28;
19072  //  Store ratio of error squared - with/without NUA terms:
19073  Double_t ratioErrorSquaredQC4 = 0.;
19074  if(fIntFlowQcumulants->GetBinError(2)>0.)
19075  { 
19076   ratioErrorSquaredQC4 = (gQC4ErrorSquared/pow(fIntFlowQcumulants->GetBinError(2),2.));
19077   fIntFlowQcumulantsErrorSquaredRatio->SetBinContent(2,ratioErrorSquaredQC4);
19078  }                          
19079  if(fApplyCorrectionForNUA && fPropagateErrorAlsoFromNIT)
19080  {
19081   if(gQC4ErrorSquared>=0.)
19082   {
19083    fIntFlowQcumulants->SetBinError(2,pow(gQC4ErrorSquared,0.5));
19084   } else
19085     {
19086      fIntFlowQcumulants->SetBinError(2,0.);
19087      cout<<endl;
19088      cout<<" WARNING (QC): Statistical error of generalized QC{4} is imaginary !!!!"<<endl;
19089      cout<<endl;
19090     }   
19091  } // end of if(fApplyCorrectionForNUA && fPropagateErrorAlsoFromNIT)
19092  // Quantify detector bias to QC{4}:
19093  if(TMath::Abs(QC4)>0.)
19094  {
19095   fIntFlowDetectorBias->SetBinContent(2,gQC4/QC4); 
19096   if(QC4Error>0.)
19097   {
19098    Double_t errorSquared = gQC4ErrorSquared/pow(QC4,2.)+pow(gQC4,2.)*pow(QC4Error,2.)/pow(QC4,4.);
19099    if(errorSquared>0.)
19100    {
19101     fIntFlowDetectorBias->SetBinError(2,pow(errorSquared,0.5));  
19102    }
19103   }
19104  } // end of if(TMath::Abs(QC4)>0.)
19105
19106
19107  // .... to be improved (continued for 6th and 8th order) ....            
19108  
19109      
19110  // versus multiplicity:
19111  if(fCalculateCumulantsVsM) // to be improved - propagate error for nua terms vs M
19112  { 
19113   Int_t nBins = fIntFlowCorrelationsVsMPro[0]->GetNbinsX(); // to be improved (hardwired 0) 
19114   Double_t value[4] = {0.}; // QCs vs M
19115   Double_t error[4] = {0.}; // error of QCs vs M
19116   Double_t dSum1[4] = {0.}; // sum value_i/(error_i)^2
19117   Double_t dSum2[4] = {0.}; // sum 1/(error_i)^2
19118   for(Int_t b=1;b<=nBins;b++)
19119   {
19120    // Measured correlations:
19121    two = fIntFlowCorrelationsVsMHist[0]->GetBinContent(b); // <<2>> vs M
19122    four = fIntFlowCorrelationsVsMHist[1]->GetBinContent(b); // <<4>> vs M
19123    // Isotropic cumulants:
19124    QC2 = two;
19125    QC4 = four-2.*pow(two,2.);
19126    // Non-isotropic terms:
19127    c1 = fIntFlowCorrectionTermsForNUAVsMPro[1][0]->GetBinContent(b); // <<cos(n*phi1)>>
19128    c2 = fIntFlowCorrectionTermsForNUAVsMPro[1][1]->GetBinContent(b); // <<cos(n*(phi1+phi2))>>
19129    c3 = fIntFlowCorrectionTermsForNUAVsMPro[1][2]->GetBinContent(b); // <<cos(n*(phi1-phi2-phi3))>>
19130    s1 = fIntFlowCorrectionTermsForNUAVsMPro[0][0]->GetBinContent(b); // <<sin(n*phi1)>>
19131    s2 = fIntFlowCorrectionTermsForNUAVsMPro[0][1]->GetBinContent(b); // <<sin(n*(phi1+phi2))>>
19132    s3 = fIntFlowCorrectionTermsForNUAVsMPro[0][2]->GetBinContent(b); // <<sin(n*(phi1-phi2-phi3))>>
19133    // Generalized QC{2} vs M:
19134    gQC2 = two - pow(c1,2.) - pow(s1,2.); 
19135    if(fApplyCorrectionForNUAVsM){fIntFlowQcumulantsVsM[0]->SetBinContent(b,gQC2);}   
19136    // Generalized QC{4} vs M:  
19137    gQC4 = four-2.*pow(two,2.)
19138                  - 4.*c1*c3+4.*s1*s3-pow(c2,2.)-pow(s2,2.)
19139                  + 4.*c2*(pow(c1,2.)-pow(s1,2.))+8.*s2*s1*c1
19140                  + 8.*two*(pow(c1,2.)+pow(s1,2.))-6.*pow((pow(c1,2.)+pow(s1,2.)),2.);
19141    if(fApplyCorrectionForNUAVsM){fIntFlowQcumulantsVsM[1]->SetBinContent(b,gQC4);}   
19142    // Detector bias vs M:
19143    if(TMath::Abs(QC2)>0.)
19144    {
19145     fIntFlowDetectorBiasVsM[0]->SetBinContent(b,gQC2/QC2); 
19146    } // end of if(TMath::Abs(QC2)>0.)
19147    if(TMath::Abs(QC4)>0.)
19148    {
19149     fIntFlowDetectorBiasVsM[1]->SetBinContent(b,gQC4/QC4); 
19150    } // end of if(TMath::Abs(QC4)>0.)  
19151    // Rebin in M:
19152    for(Int_t co=0;co<4;co++)
19153    {
19154     value[co] = fIntFlowQcumulantsVsM[co]->GetBinContent(b);
19155     error[co] = fIntFlowQcumulantsVsM[co]->GetBinError(b);
19156     if(error[co]>0.)
19157     {
19158      dSum1[co]+=value[co]/(error[co]*error[co]);
19159      dSum2[co]+=1./(error[co]*error[co]);
19160     }
19161    } // end of for(Int_t co=0;co<4;co++) 
19162   } // end of for(Int_t b=1;b<=nBins;b++)
19163   // Store rebinned Q-cumulants:
19164   if(fApplyCorrectionForNUAVsM)
19165   {
19166    for(Int_t co=0;co<4;co++)
19167    {
19168     if(dSum2[co]>0.)
19169     {
19170      fIntFlowQcumulantsRebinnedInM->SetBinContent(co+1,dSum1[co]/dSum2[co]);
19171      fIntFlowQcumulantsRebinnedInM->SetBinError(co+1,pow(1./dSum2[co],0.5));
19172     }
19173    } // end of for(Int_t co=0;co<4;co++)
19174   } // end of if(fApplyCorrectionForNUAVsM)
19175  } // end of if(fCalculateCumulantsVsM) 
19176      
19177 } // end of void AliFlowAnalysisWithQCumulants::CalculateQcumulantsCorrectedForNUAIntFlow()
19178  
19179 //=======================================================================================================================
19180
19181 void AliFlowAnalysisWithQCumulants::FinalizeCorrectionTermsForNUAIntFlow() 
19182 {
19183  // From profile fIntFlowCorrectionTermsForNUAPro[sc] access measured correction terms for NUA
19184  // and their spread, correctly calculate the statistical errors and store the final 
19185  // results and statistical errors for correction terms for NUA in histogram fIntFlowCorrectionTermsForNUAHist[sc].
19186  //
19187  // Remark: Statistical error of correction temrs is calculated as:
19188  //
19189  //          statistical error = termA * spread * termB:
19190  //          termA = sqrt{sum_{i=1}^{N} w^2}/(sum_{i=1}^{N} w)
19191  //          termB = 1/sqrt(1-termA^2)   
19192  
19193  TString sinCosFlag[2] = {"sin","cos"}; // to be improved - promore this to data member?
19194  TString nonisotropicTermFlag[4] = {"(n(phi1))","(n(phi1+phi2))","(n(phi1-phi2-phi3))","(n(2phi1-phi2))"}; // to be improved - hardwired 4
19195     
19196  for(Int_t sc=0;sc<2;sc++) // sin or cos correction terms 
19197  {
19198   for(Int_t ci=1;ci<=4;ci++) // correction term index (to be improved - hardwired 4)
19199   {
19200    Double_t correction = fIntFlowCorrectionTermsForNUAPro[sc]->GetBinContent(ci);
19201    Double_t spread = fIntFlowCorrectionTermsForNUAPro[sc]->GetBinError(ci);
19202    Double_t sumOfLinearEventWeights = fIntFlowSumOfEventWeightsNUA[sc][0]->GetBinContent(ci);
19203    Double_t sumOfQuadraticEventWeights = fIntFlowSumOfEventWeightsNUA[sc][1]->GetBinContent(ci);
19204    Double_t termA = 0.;
19205    Double_t termB = 0.;
19206    if(TMath::Abs(sumOfLinearEventWeights)>1.e-44)
19207    {
19208     termA = pow(sumOfQuadraticEventWeights,0.5)/sumOfLinearEventWeights;
19209    } else
19210      {
19211       cout<<" WARNING (QC): sumOfLinearEventWeights == 0 in AFAWQC::FCTFNIF() !!!!"<<endl;
19212       cout<<Form("               (for <<%s[%s]>> non-isotropic term)",sinCosFlag[sc].Data(),nonisotropicTermFlag[ci-1].Data())<<endl;
19213      }
19214    if(1.-pow(termA,2.) > 0.)
19215    {
19216     termB = 1./pow(1-pow(termA,2.),0.5);
19217    } else
19218      {
19219       cout<<" WARNING (QC): 1.-pow(termA,2.) <= 0 in AFAWQC::FCTFNIF() !!!!"<<endl;   
19220       cout<<Form("               (for <<%s[%s]>> non-isotropic term)",sinCosFlag[sc].Data(),nonisotropicTermFlag[ci-1].Data())<<endl;
19221      }     
19222    Double_t statisticalError = termA * spread * termB;
19223    fIntFlowCorrectionTermsForNUAHist[sc]->SetBinContent(ci,correction);
19224    fIntFlowCorrectionTermsForNUAHist[sc]->SetBinError(ci,statisticalError);
19225   } // end of for(Int_t ci=1;ci<=4;ci++) // correction term index
19226  } // end of for(Int sc=0;sc<2;sc++) // sin or cos correction terms 
19227                                                                                                                                                                                                
19228 } // end of void AliFlowAnalysisWithQCumulants::FinalizeCorrectionTermsForNUAIntFlow()
19229
19230 //=======================================================================================================================
19231
19232 void AliFlowAnalysisWithQCumulants::GetPointersForNestedLoopsHistograms()
19233 {
19234  // Get pointers to all objects relevant for calculations with nested loops.
19235    
19236  TList *nestedLoopsList = dynamic_cast<TList*>(fHistList->FindObject("Nested Loops"));
19237  if(nestedLoopsList) 
19238  {
19239   this->SetNestedLoopsList(nestedLoopsList);
19240  } else
19241    {
19242     cout<<"WARNING: nestedLoopsList is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
19243     exit(0);
19244    }
19245     
19246   TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data members?)
19247   TString typeFlag[2] = {"RP","POI"}; // to be improved (should I promote this to data members?)
19248   TString ptEtaFlag[2] = {"p_{T}","#eta"}; // to be improved (should I promote this to data members?)
19249   TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"}; // to be improved (should I promote this to data members?)
19250    
19251   TString evaluateNestedLoopsName = "fEvaluateNestedLoops";
19252   evaluateNestedLoopsName += fAnalysisLabel->Data();  
19253   TProfile *evaluateNestedLoops = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(evaluateNestedLoopsName.Data()));
19254   Bool_t bEvaluateIntFlowNestedLoops = kFALSE;
19255   Bool_t bEvaluateDiffFlowNestedLoops = kFALSE;
19256   if(evaluateNestedLoops)
19257   {
19258    this->SetEvaluateNestedLoops(evaluateNestedLoops);
19259    bEvaluateIntFlowNestedLoops = (Int_t)evaluateNestedLoops->GetBinContent(1);
19260    bEvaluateDiffFlowNestedLoops = (Int_t)evaluateNestedLoops->GetBinContent(2);
19261   }
19262   // nested loops relevant for integrated flow:  
19263   if(bEvaluateIntFlowNestedLoops)
19264   {
19265    // correlations:
19266    TString intFlowDirectCorrelationsName = "fIntFlowDirectCorrelations";
19267    intFlowDirectCorrelationsName += fAnalysisLabel->Data();
19268    TProfile *intFlowDirectCorrelations = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(intFlowDirectCorrelationsName.Data()));
19269    if(intFlowDirectCorrelations) 
19270    { 
19271     this->SetIntFlowDirectCorrelations(intFlowDirectCorrelations);
19272    } else
19273      {
19274       cout<<"WARNING: intFlowDirectCorrelations is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
19275       exit(0);
19276      }
19277    if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)  
19278    {
19279     TString intFlowExtraDirectCorrelationsName = "fIntFlowExtraDirectCorrelations";
19280     intFlowExtraDirectCorrelationsName += fAnalysisLabel->Data();
19281     TProfile *intFlowExtraDirectCorrelations = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(intFlowExtraDirectCorrelationsName.Data()));
19282     if(intFlowExtraDirectCorrelations) 
19283     { 
19284      this->SetIntFlowExtraDirectCorrelations(intFlowExtraDirectCorrelations);
19285     } else
19286       {
19287        cout<<"WARNING: intFlowExtraDirectCorrelations is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
19288        exit(0);
19289       }       
19290    } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)  
19291    // correction terms for non-uniform acceptance:
19292    TString intFlowDirectCorrectionTermsForNUAName = "fIntFlowDirectCorrectionTermsForNUA";
19293    intFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();
19294    TProfile *intFlowDirectCorrectionTermsForNUA[2] = {NULL};
19295    for(Int_t sc=0;sc<2;sc++) // sin or cos terms
19296    {
19297     intFlowDirectCorrectionTermsForNUA[sc] = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(Form("%s: %s terms",intFlowDirectCorrectionTermsForNUAName.Data(),sinCosFlag[sc].Data())));
19298     if(intFlowDirectCorrectionTermsForNUA[sc]) 
19299     { 
19300      this->SetIntFlowDirectCorrectionTermsForNUA(intFlowDirectCorrectionTermsForNUA[sc],sc);
19301     } else
19302       {
19303        cout<<"WARNING: intFlowDirectCorrectionTermsForNUA[sc] is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
19304        cout<<"sc = "<<sc<<endl;
19305        exit(0);
19306       }
19307    } // end of for(Int_t sc=0;sc<2;sc++) 
19308    // Mixed harmonics:
19309    if(fCalculateMixedHarmonics)
19310    {
19311     TString mixedHarmonicsNestedLoopsName = "fMixedHarmonicsNestedLoops";
19312     mixedHarmonicsNestedLoopsName += fAnalysisLabel->Data();
19313     TProfile *mixedHarmonicsNestedLoops = dynamic_cast<TProfile*>(nestedLoopsList->FindObject(mixedHarmonicsNestedLoopsName.Data()));
19314     if(mixedHarmonicsNestedLoops) 
19315     { 
19316      this->SetMixedHarmonicsNestedLoops(mixedHarmonicsNestedLoops);
19317     } else
19318       {
19319        cout<<"WARNING: mixedHarmonicsNestedLoops is NULL in AFAWQC::GPFNLH() !!!!"<<endl;
19320        exit(0);
19321       }
19322    } // end of if(fCalculateMixedHarmonics)
19323   } // end of if(bEvaluateIntFlowNestedLoops)
19324     
19325   // nested loops relevant for differential flow:  
19326   if(bEvaluateDiffFlowNestedLoops)
19327   {
19328    // correlations:
19329    TString diffFlowDirectCorrelationsName = "fDiffFlowDirectCorrelations";
19330    diffFlowDirectCorrelationsName += fAnalysisLabel->Data();
19331    TProfile *diffFlowDirectCorrelations[2][2][4] = {{{NULL}}};
19332    for(Int_t t=0;t<2;t++)
19333    {
19334     for(Int_t pe=0;pe<2;pe++)
19335     {
19336      for(Int_t ci=0;ci<4;ci++) // correlation index
19337      {
19338       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())));
19339       if(diffFlowDirectCorrelations[t][pe][ci])
19340       {
19341        this->SetDiffFlowDirectCorrelations(diffFlowDirectCorrelations[t][pe][ci],t,pe,ci);
19342       } else
19343         {
19344          cout<<"WARNING: diffFlowDirectCorrelations[t][pe][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19345          cout<<"t  = "<<t<<endl;
19346          cout<<"pe = "<<pe<<endl;   
19347          cout<<"ci = "<<ci<<endl;
19348         }     
19349      } // end of for(Int_t ci=0;ci<4;ci++) // correlation index  
19350     } // end of for(Int_t pe=0;pe<2;pe++)
19351    } // end of for(Int_t t=0;t<2;t++)   
19352    // correction terms for non-uniform acceptance:
19353    TString diffFlowDirectCorrectionTermsForNUAName = "fDiffFlowDirectCorrectionTermsForNUA";
19354    diffFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();  
19355    TProfile *diffFlowDirectCorrectionTermsForNUA[2][2][2][10] = {{{{NULL}}}};   
19356    for(Int_t t=0;t<2;t++)
19357    {
19358     for(Int_t pe=0;pe<2;pe++)
19359     {
19360      // correction terms for NUA:
19361      for(Int_t sc=0;sc<2;sc++) // sin or cos
19362      {
19363       for(Int_t cti=0;cti<9;cti++) // correction term index
19364       {
19365        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)));
19366        if(diffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti])
19367        {
19368         this->SetDiffFlowDirectCorrectionTermsForNUA(diffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti],t,pe,sc,cti);
19369        } else
19370          {
19371           cout<<"WARNING: diffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19372           cout<<"t   = "<<t<<endl;
19373           cout<<"pe  = "<<pe<<endl;   
19374           cout<<"sc  = "<<sc<<endl;
19375           cout<<"cti = "<<cti<<endl;
19376          }    
19377       } // end of for(Int_t cti=0;cti<9;cti++) // correction term index
19378      } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
19379     } // end of for(Int_t pe=0;pe<2;pe++)
19380    } // end of for(Int_t t=0;t<2;t++)
19381    // other differential correlators:
19382    TString otherDirectDiffCorrelatorsName = "fOtherDirectDiffCorrelators";
19383    otherDirectDiffCorrelatorsName += fAnalysisLabel->Data();  
19384    TProfile *otherDirectDiffCorrelators[2][2][2][1] = {{{{NULL}}}};   
19385    for(Int_t t=0;t<2;t++)
19386    {
19387     for(Int_t pe=0;pe<2;pe++)
19388     {
19389      // correction terms for NUA:
19390      for(Int_t sc=0;sc<2;sc++) // sin or cos
19391      {
19392       for(Int_t ci=0;ci<1;ci++) // correlator index
19393       {
19394        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)));
19395        if(otherDirectDiffCorrelators[t][pe][sc][ci])
19396        {
19397         this->SetOtherDirectDiffCorrelators(otherDirectDiffCorrelators[t][pe][sc][ci],t,pe,sc,ci);
19398        } else
19399          {
19400           cout<<"WARNING: otherDirectDiffCorrelators[t][pe][sc][ci] is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19401           cout<<"t   = "<<t<<endl;
19402           cout<<"pe  = "<<pe<<endl;   
19403           cout<<"sc  = "<<sc<<endl;
19404           cout<<"ci = "<<ci<<endl;
19405          }    
19406       } // end of for(Int_t ci=0;ci<9;ci++) // correction term index
19407      } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
19408     } // end of for(Int_t pe=0;pe<2;pe++)
19409    } // end of for(Int_t t=0;t<2;t++)
19410    // number of RPs and POIs in selected pt and eta bins for cross-checkings:
19411    TString noOfParticlesInBinName = "fNoOfParticlesInBin";
19412    TH1D *noOfParticlesInBin = NULL;
19413    noOfParticlesInBin = dynamic_cast<TH1D*>(nestedLoopsList->FindObject(noOfParticlesInBinName.Data()));
19414    if(noOfParticlesInBin)
19415    {
19416     this->SetNoOfParticlesInBin(noOfParticlesInBin);
19417    } else
19418      {
19419       cout<<endl;
19420       cout<<" WARNING (QC): noOfParticlesInBin is NULL in AFAWQC::GPFDFH() !!!!"<<endl;
19421       cout<<endl;
19422      }
19423   } // end of if(bEvaluateDiffFlowNestedLoops)
19424
19425 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForNestedLoopsHistograms()
19426
19427 //=======================================================================================================================
19428
19429 void AliFlowAnalysisWithQCumulants::GetPointersForMixedHarmonicsHistograms()
19430 {
19431  // Get pointers to all objects relevant for mixed harmonics.
19432    
19433  // a) Get pointer to base list for mixed harmonics;
19434  // b) Get pointer to TProfile fMixedHarmonicsFlags holding all flags for mixed harmonics;
19435  // c) Get pointer to list fMixedHarmonicsProfiles and pointers to all objects that she holds; 
19436  // d) Get pointer to list fMixedHarmonicsResults and pointers to all objects that she holds;
19437  // e) Get pointer to list fMixedHarmonicsErrorPropagation and pointers to all objects that she holds.
19438
19439  // a) Get pointer to base list for mixed harmonics:
19440  TList *mixedHarmonicsList = dynamic_cast<TList*>(fHistList->FindObject("Mixed Harmonics"));
19441  if(mixedHarmonicsList) 
19442  {
19443   this->SetMixedHarmonicsList(mixedHarmonicsList);
19444  } else
19445    {
19446     cout<<"WARNING: mixedHarmonicsList is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19447     exit(0);
19448    }
19449
19450  // b) Get pointer to TProfile fMixedHarmonicsFlags holding all flags for mixed harmonics:
19451  TString mixedHarmonicsFlagsName = "fMixedHarmonicsFlags";
19452  mixedHarmonicsFlagsName += fAnalysisLabel->Data();
19453  TProfile *mixedHarmonicsFlags = dynamic_cast<TProfile*>
19454                                  (mixedHarmonicsList->FindObject(mixedHarmonicsFlagsName.Data()));
19455  if(mixedHarmonicsFlags)
19456  {
19457   this->SetMixedHarmonicsFlags(mixedHarmonicsFlags);  
19458   fCalculateMixedHarmonics = (Bool_t)mixedHarmonicsFlags->GetBinContent(1); 
19459   fCalculateMixedHarmonicsVsM = (Bool_t)mixedHarmonicsFlags->GetBinContent(3); 
19460  } else 
19461    {
19462     cout<<"WARNING: mixedHarmonicsFlags is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19463     exit(0);
19464    }
19465   
19466  if(!fCalculateMixedHarmonics){return;}
19467
19468  // c) Get pointer to list fMixedHarmonicsProfiles and pointers to all objects that she holds:
19469  TList *mixedHarmonicsProfiles = NULL;
19470  mixedHarmonicsProfiles = dynamic_cast<TList*>(mixedHarmonicsList->FindObject("Profiles"));
19471  if(mixedHarmonicsProfiles)  
19472  {
19473   // 2p:
19474   TString s2pCorrelationsName = "f2pCorrelations";
19475   s2pCorrelationsName += fAnalysisLabel->Data();
19476   TProfile *p2pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s2pCorrelationsName.Data()));
19477   if(p2pCorrelations) 
19478   {
19479    this->Set2pCorrelations(p2pCorrelations);
19480   } else 
19481     {
19482      cout<<"WARNING: p2pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19483      exit(0);
19484     } 
19485   // 3p:
19486   TString s3pCorrelationsName = "f3pCorrelations";
19487   s3pCorrelationsName += fAnalysisLabel->Data();
19488   TProfile *p3pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s3pCorrelationsName.Data()));
19489   if(p3pCorrelations) 
19490   {
19491    this->Set3pCorrelations(p3pCorrelations);
19492   } else 
19493     {
19494      cout<<"WARNING: p3pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19495      exit(0);
19496     } 
19497   // 4p:
19498   TString s4pCorrelationsName = "f4pCorrelations";
19499   s4pCorrelationsName += fAnalysisLabel->Data();
19500   TProfile *p4pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s4pCorrelationsName.Data()));
19501   if(p4pCorrelations) 
19502   {
19503    this->Set4pCorrelations(p4pCorrelations);
19504   } else 
19505     {
19506      cout<<"WARNING: p4pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19507      exit(0);
19508     } 
19509   // 5p:
19510   TString s5pCorrelationsName = "f5pCorrelations";
19511   s5pCorrelationsName += fAnalysisLabel->Data();
19512   TProfile *p5pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s5pCorrelationsName.Data()));
19513   if(p5pCorrelations) 
19514   {
19515    this->Set5pCorrelations(p5pCorrelations);
19516   } else 
19517     {
19518      cout<<"WARNING: p5pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19519      exit(0);
19520     } 
19521   /* TBI not needed for the time being
19522   // 6p:
19523   TString s6pCorrelationsName = "f6pCorrelations";
19524   s6pCorrelationsName += fAnalysisLabel->Data();
19525   TProfile *p6pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s6pCorrelationsName.Data()));
19526   if(p6pCorrelations) 
19527   {
19528    this->Set6pCorrelations(p6pCorrelations);
19529   } else 
19530     {
19531      cout<<"WARNING: p6pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19532      exit(0);
19533     } 
19534   // 7p:
19535   TString s7pCorrelationsName = "f7pCorrelations";
19536   s7pCorrelationsName += fAnalysisLabel->Data();
19537   TProfile *p7pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s7pCorrelationsName.Data()));
19538   if(p7pCorrelations) 
19539   {
19540    this->Set7pCorrelations(p7pCorrelations);
19541   } else 
19542     {
19543      cout<<"WARNING: p7pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19544      exit(0);
19545     } 
19546   // 8p:
19547   TString s8pCorrelationsName = "f8pCorrelations";
19548   s8pCorrelationsName += fAnalysisLabel->Data();
19549   TProfile *p8pCorrelations = dynamic_cast<TProfile*>(mixedHarmonicsProfiles->FindObject(s8pCorrelationsName.Data()));
19550   if(p8pCorrelations) 
19551   {
19552    this->Set8pCorrelations(p8pCorrelations);
19553   } else 
19554     {
19555      cout<<"WARNING: p8pCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19556      exit(0);
19557     }
19558  */
19559  } else // to if(mixedHarmonicsProfiles)
19560    {
19561     cout<<"WARNING: mixedHarmonicsProfiles is NULL in FAWQC::GPFMHH() !!!!"<<endl;
19562     exit(0);
19563    }
19564
19565  // d) Get pointer to list fMixedHarmonicsResults and pointers to all objects that she holds.
19566  TList *mixedHarmonicsResults = NULL;
19567  mixedHarmonicsResults = dynamic_cast<TList*>(mixedHarmonicsList->FindObject("Results"));
19568  if(mixedHarmonicsResults)  
19569  {
19570   // 2p:
19571   TString s2pCumulantsName = "f2pCumulants";
19572   s2pCumulantsName += fAnalysisLabel->Data();
19573   TH1D *p2pCumulants = dynamic_cast<TH1D*>(mixedHarmonicsResults->FindObject(s2pCumulantsName.Data()));
19574   if(p2pCumulants) 
19575   {
19576    this->Set2pCumulants(p2pCumulants);
19577   } else 
19578     {
19579      cout<<"WARNING: p2pCumulants is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19580      exit(0);
19581     } 
19582   // 3p:
19583   TString s3pCumulantsName = "f3pCumulants";
19584   s3pCumulantsName += fAnalysisLabel->Data();
19585   TH1D *p3pCumulants = dynamic_cast<TH1D*>(mixedHarmonicsResults->FindObject(s3pCumulantsName.Data()));
19586   if(p3pCumulants) 
19587   {
19588    this->Set3pCumulants(p3pCumulants);
19589   } else 
19590     {
19591      cout<<"WARNING: p3pCumulants is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19592      exit(0);
19593     } 
19594   // 4p:
19595   TString s4pCumulantsName = "f4pCumulants";
19596   s4pCumulantsName += fAnalysisLabel->Data();
19597   TH1D *p4pCumulants = dynamic_cast<TH1D*>(mixedHarmonicsResults->FindObject(s4pCumulantsName.Data()));
19598   if(p4pCumulants) 
19599   {
19600    this->Set4pCumulants(p4pCumulants);
19601   } else 
19602     {
19603      cout<<"WARNING: p4pCumulants is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19604      exit(0);
19605     } 
19606   // 5p:
19607   TString s5pCumulantsName = "f5pCumulants";
19608   s5pCumulantsName += fAnalysisLabel->Data();
19609   TH1D *p5pCumulants = dynamic_cast<TH1D*>(mixedHarmonicsResults->FindObject(s5pCumulantsName.Data()));
19610   if(p5pCumulants) 
19611   {
19612    this->Set5pCumulants(p5pCumulants);
19613   } else 
19614     {
19615      cout<<"WARNING: p5pCumulants is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19616      exit(0);
19617     } 
19618  } else // to if(mixedHarmonicsResults)
19619    {
19620     cout<<"WARNING: mixedHarmonicsResults is NULL in FAWQC::GPFMHH() !!!!"<<endl;
19621    }
19622
19623  // e) Get pointer to list fMixedHarmonicsErrorPropagation and pointers to all objects that she holds:
19624  TList *mixedHarmonicsErrorPropagation = NULL;
19625  mixedHarmonicsErrorPropagation = dynamic_cast<TList*>(mixedHarmonicsList->FindObject("Error Propagation"));
19626  if(mixedHarmonicsErrorPropagation)  
19627  {   
19628   TString sMixedHarmonicEventWeightsName = "fMixedHarmonicEventWeights";
19629   sMixedHarmonicEventWeightsName += fAnalysisLabel->Data();
19630   TString powerFlag[2] = {"linear","quadratic"};
19631   for(Int_t power=0;power<2;power++)
19632   {
19633    TH1D *hMixedHarmonicEventWeights = dynamic_cast<TH1D*>(mixedHarmonicsErrorPropagation->FindObject(Form("%s: %s",sMixedHarmonicEventWeightsName.Data(),powerFlag[power].Data())));
19634    if(hMixedHarmonicEventWeights) 
19635    {
19636     this->SetMixedHarmonicEventWeights(hMixedHarmonicEventWeights,power);
19637    } else 
19638      {
19639       cout<<"WARNING: hMixedHarmonicEventWeights is NULL in AFAWQC::GPFIFH() !!!!"<<endl;
19640       cout<<"power = "<<power<<endl;
19641       exit(0);
19642      }                                   
19643   } // end of for(Int_t power=0;power<2;power++)
19644   TString sMixedHarmonicProductOfEventWeightsName = "fMixedHarmonicProductOfEventWeights";
19645   sMixedHarmonicProductOfEventWeightsName += fAnalysisLabel->Data();
19646   TH2D *hMixedHarmonicProductOfEventWeights = dynamic_cast<TH2D*>(mixedHarmonicsErrorPropagation->FindObject(sMixedHarmonicProductOfEventWeightsName.Data()));
19647   if(hMixedHarmonicProductOfEventWeights) 
19648   {
19649    this->SetMixedHarmonicProductOfEventWeights(hMixedHarmonicProductOfEventWeights);
19650   } else 
19651     {
19652      cout<<"WARNING: hMixedHarmonicProductOfEventWeights is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19653      exit(0);
19654     } 
19655   TString sMixedHarmonicProductOfCorrelationsName = "fMixedHarmonicProductOfCorrelations";
19656   sMixedHarmonicProductOfCorrelationsName += fAnalysisLabel->Data();
19657   TProfile2D *hMixedHarmonicProductOfCorrelations = dynamic_cast<TProfile2D*>(mixedHarmonicsErrorPropagation->FindObject(sMixedHarmonicProductOfCorrelationsName.Data()));
19658   if(hMixedHarmonicProductOfCorrelations) 
19659   {
19660    this->SetMixedHarmonicProductOfCorrelations(hMixedHarmonicProductOfCorrelations);
19661   } else 
19662     {
19663      cout<<"WARNING: hMixedHarmonicProductOfCorrelations is NULL in AFAWQC::GPFMHH() !!!!"<<endl;
19664      exit(0);
19665     } 
19666  } // end of if(mixedHarmonicsErrorPropagation) 
19667  
19668 } // end of void AliFlowAnalysisWithQCumulants::GetPointersForMixedHarmonicsHistograms()
19669
19670 //=======================================================================================================================
19671
19672 void AliFlowAnalysisWithQCumulants::StoreHarmonic()
19673 {
19674  // Store flow harmonic in common control histograms.
19675
19676  (fCommonHists->GetHarmonic())->Fill(0.5,fHarmonic);
19677  if(fFillMultipleControlHistograms)
19678  {
19679   (fCommonHists2nd->GetHarmonic())->Fill(0.5,fHarmonic);
19680   (fCommonHists4th->GetHarmonic())->Fill(0.5,fHarmonic);
19681   (fCommonHists6th->GetHarmonic())->Fill(0.5,fHarmonic);
19682   (fCommonHists8th->GetHarmonic())->Fill(0.5,fHarmonic);
19683  }
19684  
19685 } // end of void AliFlowAnalysisWithQCumulants::StoreHarmonic()
19686
19687 //=======================================================================================================================
19688
19689 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrelationsUsingParticleWeights(TString type, TString ptOrEta) // type = RP or POI 
19690 {
19691  // Calculate all correlations needed for differential flow using particle weights.
19692  
19693  Int_t t = 0; // type flag 
19694  Int_t pe = 0; // ptEta flag
19695  
19696  if(type == "RP")
19697  {
19698   t = 0;
19699  } else if(type == "POI")
19700    {
19701     t = 1;
19702    }
19703
19704  if(ptOrEta == "Pt")
19705  {
19706   pe = 0;
19707  } else if(ptOrEta == "Eta")
19708    {
19709     pe = 1;
19710    }
19711     
19712  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
19713  Double_t minPtEta[2] = {fPtMin,fEtaMin};
19714  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
19715  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
19716
19717  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
19718  Double_t dReQ1n1k = (*fReQ)(0,1);
19719  Double_t dReQ2n2k = (*fReQ)(1,2);
19720  Double_t dReQ1n3k = (*fReQ)(0,3);
19721  //Double_t dReQ4n4k = (*fReQ)(3,4);
19722  Double_t dImQ1n1k = (*fImQ)(0,1);
19723  Double_t dImQ2n2k = (*fImQ)(1,2);
19724  Double_t dImQ1n3k = (*fImQ)(0,3);
19725  //Double_t dImQ4n4k = (*fImQ)(3,4);
19726  
19727  // S^M_{p,k} (see .h file for the definition of fSpk):
19728  Double_t dSM1p1k = (*fSpk)(0,1);
19729  Double_t dSM1p2k = (*fSpk)(0,2);
19730  Double_t dSM1p3k = (*fSpk)(0,3);
19731  Double_t dSM2p1k = (*fSpk)(1,1);
19732  Double_t dSM3p1k = (*fSpk)(2,1);
19733  
19734  // looping over all bins and calculating reduced correlations: 
19735  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
19736  {
19737   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular (pt,eta) bin):  
19738   Double_t p1n0kRe = 0.;
19739   Double_t p1n0kIm = 0.;
19740
19741   // number of POIs in particular (pt,eta) bin):
19742   Double_t mp = 0.;
19743
19744   // real and imaginary parts of q_{m*n,k}: 
19745   // (weighted Q-vector evaluated for particles which are both RPs and POIs in particular (pt,eta) bin)
19746   Double_t q1n2kRe = 0.;
19747   Double_t q1n2kIm = 0.;
19748   Double_t q2n1kRe = 0.;
19749   Double_t q2n1kIm = 0.;
19750
19751   // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
19752   Double_t s1p1k = 0.; 
19753   Double_t s1p2k = 0.; 
19754   Double_t s1p3k = 0.; 
19755    
19756   // M0111 from Eq. (118) in QC2c (to be improved (notation))
19757   Double_t dM0111 = 0.;
19758  
19759   if(type == "POI")
19760   {
19761    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
19762            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
19763    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
19764            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
19765             
19766    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
19767     
19768    t = 1; // typeFlag = RP or POI
19769     
19770    // q_{m*n,k}: (Remark: m=1 is 0, k=0 iz zero (to be improved!)) 
19771    q1n2kRe = fReRPQ1dEBE[2][pe][0][2]->GetBinContent(fReRPQ1dEBE[2][pe][0][2]->GetBin(b))
19772            * fReRPQ1dEBE[2][pe][0][2]->GetBinEntries(fReRPQ1dEBE[2][pe][0][2]->GetBin(b));
19773    q1n2kIm = fImRPQ1dEBE[2][pe][0][2]->GetBinContent(fImRPQ1dEBE[2][pe][0][2]->GetBin(b))
19774            * fImRPQ1dEBE[2][pe][0][2]->GetBinEntries(fImRPQ1dEBE[2][pe][0][2]->GetBin(b));
19775    q2n1kRe = fReRPQ1dEBE[2][pe][1][1]->GetBinContent(fReRPQ1dEBE[2][pe][1][1]->GetBin(b))
19776            * fReRPQ1dEBE[2][pe][1][1]->GetBinEntries(fReRPQ1dEBE[2][pe][1][1]->GetBin(b));
19777    q2n1kIm = fImRPQ1dEBE[2][pe][1][1]->GetBinContent(fImRPQ1dEBE[2][pe][1][1]->GetBin(b))
19778            * fImRPQ1dEBE[2][pe][1][1]->GetBinEntries(fImRPQ1dEBE[2][pe][1][1]->GetBin(b));
19779        
19780    // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
19781    s1p1k = pow(fs1dEBE[2][pe][1]->GetBinContent(b)*fs1dEBE[2][pe][1]->GetBinEntries(b),1.); 
19782    s1p2k = pow(fs1dEBE[2][pe][2]->GetBinContent(b)*fs1dEBE[2][pe][2]->GetBinEntries(b),1.); 
19783    s1p3k = pow(fs1dEBE[2][pe][3]->GetBinContent(b)*fs1dEBE[2][pe][3]->GetBinEntries(b),1.); 
19784      
19785    // M0111 from Eq. (118) in QC2c (to be improved (notation)):
19786    dM0111 = mp*(dSM3p1k-3.*dSM1p1k*dSM1p2k+2.*dSM1p3k)
19787           - 3.*(s1p1k*(dSM2p1k-dSM1p2k)
19788           + 2.*(s1p3k-s1p2k*dSM1p1k));
19789   }
19790    else if(type == "RP")
19791    {
19792     // q_{m*n,k}: (Remark: m=1 is 0, k=0 iz zero (to be improved!)) 
19793     q1n2kRe = fReRPQ1dEBE[0][pe][0][2]->GetBinContent(fReRPQ1dEBE[0][pe][0][2]->GetBin(b))
19794             * fReRPQ1dEBE[0][pe][0][2]->GetBinEntries(fReRPQ1dEBE[0][pe][0][2]->GetBin(b));
19795     q1n2kIm = fImRPQ1dEBE[0][pe][0][2]->GetBinContent(fImRPQ1dEBE[0][pe][0][2]->GetBin(b))
19796             * fImRPQ1dEBE[0][pe][0][2]->GetBinEntries(fImRPQ1dEBE[0][pe][0][2]->GetBin(b));
19797     q2n1kRe = fReRPQ1dEBE[0][pe][1][1]->GetBinContent(fReRPQ1dEBE[0][pe][1][1]->GetBin(b))
19798             * fReRPQ1dEBE[0][pe][1][1]->GetBinEntries(fReRPQ1dEBE[0][pe][1][1]->GetBin(b));
19799     q2n1kIm = fImRPQ1dEBE[0][pe][1][1]->GetBinContent(fImRPQ1dEBE[0][pe][1][1]->GetBin(b))
19800             * fImRPQ1dEBE[0][pe][1][1]->GetBinEntries(fImRPQ1dEBE[0][pe][1][1]->GetBin(b));
19801
19802     // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
19803     s1p1k = pow(fs1dEBE[0][pe][1]->GetBinContent(b)*fs1dEBE[0][pe][1]->GetBinEntries(b),1.); 
19804     s1p2k = pow(fs1dEBE[0][pe][2]->GetBinContent(b)*fs1dEBE[0][pe][2]->GetBinEntries(b),1.); 
19805     s1p3k = pow(fs1dEBE[0][pe][3]->GetBinContent(b)*fs1dEBE[0][pe][3]->GetBinEntries(b),1.); 
19806     
19807     // to be improved (cross-checked):
19808     p1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
19809             * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
19810     p1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))  
19811             * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
19812             
19813     mp = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
19814      
19815     t = 0; // typeFlag = RP or POI
19816     
19817     // M0111 from Eq. (118) in QC2c (to be improved (notation)):
19818     dM0111 = mp*(dSM3p1k-3.*dSM1p1k*dSM1p2k+2.*dSM1p3k)
19819            - 3.*(s1p1k*(dSM2p1k-dSM1p2k)
19820            + 2.*(s1p3k-s1p2k*dSM1p1k));
19821     //...............................................................................................   
19822    }
19823    
19824    // 2'-particle correlation:
19825    Double_t two1n1nW0W1 = 0.;
19826    if(mp*dSM1p1k-s1p1k)
19827    {
19828     two1n1nW0W1 = (p1n0kRe*dReQ1n1k+p1n0kIm*dImQ1n1k-s1p1k)
19829                 / (mp*dSM1p1k-s1p1k);
19830    
19831     // fill profile to get <<2'>>     
19832     fDiffFlowCorrelationsPro[t][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nW0W1,mp*dSM1p1k-s1p1k);    
19833     // fill profile to get <<2'>^2>     
19834     fDiffFlowSquaredCorrelationsPro[t][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nW0W1*two1n1nW0W1,mp*dSM1p1k-s1p1k);        
19835     // histogram to store <2'> e-b-e (needed in some other methods):
19836     fDiffFlowCorrelationsEBE[t][pe][0]->SetBinContent(b,two1n1nW0W1);      
19837     fDiffFlowEventWeightsForCorrelationsEBE[t][pe][0]->SetBinContent(b,mp*dSM1p1k-s1p1k);      
19838    } // end of if(mp*dSM1p1k-s1p1k)
19839    
19840    // 4'-particle correlation:
19841    Double_t four1n1n1n1nW0W1W1W1 = 0.;
19842    if(dM0111)
19843    {
19844     four1n1n1n1nW0W1W1W1 = ((pow(dReQ1n1k,2.)+pow(dImQ1n1k,2.))*(p1n0kRe*dReQ1n1k+p1n0kIm*dImQ1n1k)
19845                          - q2n1kRe*(pow(dReQ1n1k,2.)-pow(dImQ1n1k,2.))
19846                          - 2.*q2n1kIm*dReQ1n1k*dImQ1n1k
19847                          - p1n0kRe*(dReQ1n1k*dReQ2n2k+dImQ1n1k*dImQ2n2k)
19848                          + p1n0kIm*(dImQ1n1k*dReQ2n2k-dReQ1n1k*dImQ2n2k)
19849                          - 2.*dSM1p2k*(p1n0kRe*dReQ1n1k+p1n0kIm*dImQ1n1k)
19850                          - 2.*(pow(dReQ1n1k,2.)+pow(dImQ1n1k,2.))*s1p1k                                            
19851                          + 6.*(q1n2kRe*dReQ1n1k+q1n2kIm*dImQ1n1k)                                           
19852                          + 1.*(q2n1kRe*dReQ2n2k+q2n1kIm*dImQ2n2k)                         
19853                          + 2.*(p1n0kRe*dReQ1n3k+p1n0kIm*dImQ1n3k)                      
19854                          + 2.*s1p1k*dSM1p2k                                      
19855                          - 6.*s1p3k)        
19856                          / dM0111; // to be improved (notation of dM0111)
19857    
19858     // fill profile to get <<4'>>     
19859     fDiffFlowCorrelationsPro[t][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nW0W1W1W1,dM0111);    
19860     // fill profile to get <<4'>^2>     
19861     fDiffFlowSquaredCorrelationsPro[t][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nW0W1W1W1*four1n1n1n1nW0W1W1W1,dM0111);        
19862     // histogram to store <4'> e-b-e (needed in some other methods):
19863     fDiffFlowCorrelationsEBE[t][pe][1]->SetBinContent(b,four1n1n1n1nW0W1W1W1);      
19864     fDiffFlowEventWeightsForCorrelationsEBE[t][pe][1]->SetBinContent(b,dM0111);      
19865    } // end of if(dM0111)
19866  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
19867
19868 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrelationsUsingParticleWeights(TString type, TString ptOrEta); // type = RP or POI 
19869
19870 //=======================================================================================================================
19871
19872 void AliFlowAnalysisWithQCumulants::FillCommonControlHistograms(AliFlowEventSimple *anEvent)
19873 {
19874  // Fill common control histograms.
19875  
19876  Int_t nRP = anEvent->GetEventNSelTracksRP(); // number of RPs (i.e. number of particles used to determine the reaction plane)
19877  fCommonHists->FillControlHistograms(anEvent); 
19878  if(fFillMultipleControlHistograms)
19879  {
19880   if(nRP>1)
19881   {
19882    fCommonHists2nd->FillControlHistograms(anEvent);                                        
19883    if(nRP>3)
19884    {
19885     fCommonHists4th->FillControlHistograms(anEvent);                                        
19886     if(nRP>5)
19887     {
19888      fCommonHists6th->FillControlHistograms(anEvent);                                        
19889      if(nRP>7)
19890      {
19891       fCommonHists8th->FillControlHistograms(anEvent);                                        
19892      } // end of if(nRP>7)  
19893     } // end of if(nRP>5) 
19894    } // end of if(nRP>3)                                                                                                                      
19895   } // end of if(nRP>1) 
19896  } // end of if(fFillMultipleControlHistograms)
19897  
19898 } // end of void AliFlowAnalysisWithQCumulants::FillCommonControlHistograms(AliFlowEventSimple *anEvent)
19899
19900 //=======================================================================================================================
19901
19902 void AliFlowAnalysisWithQCumulants::ResetEventByEventQuantities()
19903 {
19904  // Reset all event by event quantities.
19905  
19906  // Reference flow:
19907  fReQ->Zero();
19908  fImQ->Zero();
19909  fSpk->Zero();
19910  fIntFlowCorrelationsEBE->Reset();
19911  fIntFlowEventWeightsForCorrelationsEBE->Reset();
19912  fIntFlowCorrelationsAllEBE->Reset();
19913  
19914  for(Int_t sc=0;sc<2;sc++)
19915  {
19916   fIntFlowCorrectionTermsForNUAEBE[sc]->Reset();
19917   fIntFlowEventWeightForCorrectionTermsForNUAEBE[sc]->Reset(); 
19918  }
19919     
19920  // Differential flow:
19921  if(fCalculateDiffFlow)
19922  {
19923   for(Int_t t=0;t<3;t++) // type (RP, POI, POI&&RP)
19924   {
19925    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // 1D in pt or eta
19926    {
19927     for(Int_t m=0;m<4;m++) // multiple of harmonic
19928     {
19929      for(Int_t k=0;k<9;k++) // power of weight
19930      {
19931       if(fReRPQ1dEBE[t][pe][m][k]) fReRPQ1dEBE[t][pe][m][k]->Reset();
19932       if(fImRPQ1dEBE[t][pe][m][k]) fImRPQ1dEBE[t][pe][m][k]->Reset();
19933      }   
19934     } 
19935    }
19936   } 
19937   for(Int_t t=0;t<3;t++) // type (0 = RP, 1 = POI, 2 = RP&&POI )
19938   { 
19939    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // 1D in pt or eta
19940    {
19941     for(Int_t k=0;k<9;k++)
19942     {
19943      if(fs1dEBE[t][pe][k]) fs1dEBE[t][pe][k]->Reset();
19944     }
19945    }
19946   }
19947   // e-b-e reduced correlations:
19948   for(Int_t t=0;t<2;t++) // type (0 = RP, 1 = POI)
19949   {  
19950    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19951    {
19952     for(Int_t rci=0;rci<4;rci++) // reduced correlation index
19953     {
19954      if(fDiffFlowCorrelationsEBE[t][pe][rci]) fDiffFlowCorrelationsEBE[t][pe][rci]->Reset();
19955      if(fDiffFlowEventWeightsForCorrelationsEBE[t][pe][rci]) fDiffFlowEventWeightsForCorrelationsEBE[t][pe][rci]->Reset();
19956     }
19957    }
19958   }  
19959   // correction terms for NUA:
19960   for(Int_t t=0;t<2;t++) // type (0 = RP, 1 = POI)
19961   {  
19962    for(Int_t pe=0;pe<1+(Int_t)fCalculateDiffFlowVsEta;pe++) // pt or eta
19963    {
19964     for(Int_t sc=0;sc<2;sc++) // sin or cos
19965     {
19966      for(Int_t cti=0;cti<9;cti++) // correction term index
19967      {
19968      fDiffFlowCorrectionTermsForNUAEBE[t][pe][sc][cti]->Reset();  
19969      }
19970     }
19971    }      
19972   }
19973  } // end of if(fCalculateDiffFlow)   
19974
19975  // 2D (pt,eta)
19976  if(fCalculate2DDiffFlow)
19977  {
19978   for(Int_t t=0;t<3;t++) // type (RP, POI, POI&&RP)
19979   {
19980    for(Int_t m=0;m<4;m++) // multiple of harmonic
19981    {
19982     for(Int_t k=0;k<9;k++) // power of weight
19983     {
19984      if(fReRPQ2dEBE[t][m][k]){fReRPQ2dEBE[t][m][k]->Reset();}
19985      if(fImRPQ2dEBE[t][m][k]){fImRPQ2dEBE[t][m][k]->Reset();}
19986     }   
19987    }
19988   }
19989   for(Int_t t=0;t<3;t++) // type (0 = RP, 1 = POI, 2 = RP&&POI )
19990   { 
19991    for(Int_t k=0;k<9;k++)
19992    {
19993     if(fs2dEBE[t][k]){fs2dEBE[t][k]->Reset();}
19994    }
19995   }  
19996  } // end of if(fCalculate2DDiffFlow) 
19997
19998 } // end of void AliFlowAnalysisWithQCumulants::ResetEventByEventQuantities();
19999
20000 //=======================================================================================================================
20001
20002 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUASinTerms(TString type, TString ptOrEta)
20003 {
20004  // Calculate correction terms for non-uniform acceptance for differential flow (sin terms).
20005  
20006  // Results are stored in fDiffFlowCorrectionTermsForNUAPro[t][pe][0][cti], where cti runs as follows:
20007  //  0: <<sin n(psi1)>>
20008  //  1: <<sin n(psi1+phi2)>>
20009  //  2: <<sin n(psi1+phi2-phi3)>>
20010  //  3: <<sin n(psi1-phi2-phi3)>>:
20011  //  4:
20012  //  5:
20013  //  6:
20014  
20015  // multiplicity:
20016  Double_t dMult = (*fSpk)(0,0);
20017  
20018  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
20019  Double_t dReQ1n = (*fReQ)(0,0);
20020  Double_t dReQ2n = (*fReQ)(1,0);
20021  //Double_t dReQ3n = (*fReQ)(2,0);
20022  //Double_t dReQ4n = (*fReQ)(3,0);
20023  Double_t dImQ1n = (*fImQ)(0,0);
20024  Double_t dImQ2n = (*fImQ)(1,0);
20025  //Double_t dImQ3n = (*fImQ)(2,0);
20026  //Double_t dImQ4n = (*fImQ)(3,0);
20027
20028  Int_t t = 0; // type flag 
20029  Int_t pe = 0; // ptEta flag
20030  
20031  if(type == "RP")
20032  {
20033   t = 0;
20034  } else if(type == "POI")
20035    {
20036     t = 1;
20037    }
20038
20039  if(ptOrEta == "Pt")
20040  {
20041   pe = 0;
20042  } else if(ptOrEta == "Eta")
20043    {
20044     pe = 1;
20045    }
20046     
20047  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
20048  Double_t minPtEta[2] = {fPtMin,fEtaMin};
20049  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
20050  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
20051
20052  // looping over all bins and calculating correction terms: 
20053  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20054  {
20055   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
20056   Double_t p1n0kRe = 0.;
20057   Double_t p1n0kIm = 0.;
20058
20059   // number of POIs in particular pt or eta bin:
20060   Double_t mp = 0.;
20061
20062   // 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):
20063   Double_t q1n0kRe = 0.;
20064   Double_t q1n0kIm = 0.;
20065   Double_t q2n0kRe = 0.;
20066   Double_t q2n0kIm = 0.;
20067
20068   // number of particles which are both RPs and POIs in particular pt or eta bin:
20069   Double_t mq = 0.;
20070    
20071   if(type == "POI")
20072   {
20073    // q_{m*n,0}:
20074    q1n0kRe = fReRPQ1dEBE[2][pe][0][0]->GetBinContent(fReRPQ1dEBE[2][pe][0][0]->GetBin(b))
20075            * fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b));
20076    q1n0kIm = fImRPQ1dEBE[2][pe][0][0]->GetBinContent(fImRPQ1dEBE[2][pe][0][0]->GetBin(b))
20077            * fImRPQ1dEBE[2][pe][0][0]->GetBinEntries(fImRPQ1dEBE[2][pe][0][0]->GetBin(b));
20078    q2n0kRe = fReRPQ1dEBE[2][pe][1][0]->GetBinContent(fReRPQ1dEBE[2][pe][1][0]->GetBin(b))
20079            * fReRPQ1dEBE[2][pe][1][0]->GetBinEntries(fReRPQ1dEBE[2][pe][1][0]->GetBin(b));
20080    q2n0kIm = fImRPQ1dEBE[2][pe][1][0]->GetBinContent(fImRPQ1dEBE[2][pe][1][0]->GetBin(b))
20081            * fImRPQ1dEBE[2][pe][1][0]->GetBinEntries(fImRPQ1dEBE[2][pe][1][0]->GetBin(b));         
20082                  
20083    mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
20084   } 
20085   else if(type == "RP")
20086   {
20087    // q_{m*n,0}:
20088    q1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
20089            * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
20090    q1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))
20091            * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
20092    q2n0kRe = fReRPQ1dEBE[0][pe][1][0]->GetBinContent(fReRPQ1dEBE[0][pe][1][0]->GetBin(b))
20093            * fReRPQ1dEBE[0][pe][1][0]->GetBinEntries(fReRPQ1dEBE[0][pe][1][0]->GetBin(b));
20094    q2n0kIm = fImRPQ1dEBE[0][pe][1][0]->GetBinContent(fImRPQ1dEBE[0][pe][1][0]->GetBin(b))
20095            * fImRPQ1dEBE[0][pe][1][0]->GetBinEntries(fImRPQ1dEBE[0][pe][1][0]->GetBin(b));         
20096                  
20097    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)  
20098   }    
20099   if(type == "POI")
20100   {
20101    // p_{m*n,0}:
20102    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
20103            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
20104    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
20105            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
20106             
20107    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
20108     
20109    t = 1; // typeFlag = RP or POI
20110   }
20111   else if(type == "RP")
20112   {
20113    // p_{m*n,0} = q_{m*n,0}:
20114    p1n0kRe = q1n0kRe; 
20115    p1n0kIm = q1n0kIm; 
20116            
20117    mp = mq; 
20118    
20119    t = 0; // typeFlag = RP or POI
20120   }
20121
20122   // <<sin n(psi1)>>:
20123   Double_t sinP1nPsi = 0.;
20124   if(mp)
20125   {
20126    sinP1nPsi = p1n0kIm/mp;
20127    // fill profile for <<sin n(psi1)>>:
20128    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi,mp);
20129    // histogram to store <sin n(psi1)> e-b-e (needed in some other methods):
20130    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][0]->SetBinContent(b,sinP1nPsi);
20131   } // end of if(mp)   
20132   
20133   // <<sin n(psi1+phi2)>>:
20134   Double_t sinP1nPsiP1nPhi = 0.;
20135   if(mp*dMult-mq)
20136   {
20137    sinP1nPsiP1nPhi = (p1n0kRe*dImQ1n+p1n0kIm*dReQ1n-q2n0kIm)/(mp*dMult-mq);
20138    // fill profile for <<sin n(psi1+phi2)>>:
20139    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsiP1nPhi,mp*dMult-mq);
20140    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
20141    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][1]->SetBinContent(b,sinP1nPsiP1nPhi);
20142   } // end of if(mp*dMult-mq)   
20143   
20144   // <<sin n(psi1+phi2-phi3)>>:
20145   Double_t sinP1nPsi1P1nPhi2MPhi3 = 0.;
20146   if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))
20147   {
20148    sinP1nPsi1P1nPhi2MPhi3 = (p1n0kIm*(pow(dImQ1n,2.)+pow(dReQ1n,2.)-dMult)
20149                           - 1.*(q2n0kIm*dReQ1n-q2n0kRe*dImQ1n)  
20150                           - mq*dImQ1n+2.*q1n0kIm)
20151                           / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
20152    // fill profile for <<sin n(psi1+phi2)>>:
20153    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1P1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
20154    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
20155    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][2]->SetBinContent(b,sinP1nPsi1P1nPhi2MPhi3);
20156   } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   
20157   
20158   // <<sin n(psi1-phi2-phi3)>>:
20159   Double_t sinP1nPsi1M1nPhi2MPhi3 = 0.;
20160   if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))
20161   {
20162    sinP1nPsi1M1nPhi2MPhi3 = (p1n0kIm*(pow(dReQ1n,2.)-pow(dImQ1n,2.))-2.*p1n0kRe*dReQ1n*dImQ1n
20163                           - 1.*(p1n0kIm*dReQ2n-p1n0kRe*dImQ2n)
20164                           + 2.*mq*dImQ1n-2.*q1n0kIm)
20165                           / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
20166    // fill profile for <<sin n(psi1+phi2)>>:
20167    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1M1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
20168    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
20169    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][3]->SetBinContent(b,sinP1nPsi1M1nPhi2MPhi3);
20170   } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   
20171  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20172  
20173 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUASinTerms(TString type, TString ptOrEta)
20174
20175
20176 //=======================================================================================================================
20177
20178
20179 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTerms(TString type, TString ptOrEta)
20180 {
20181  // Calculate correction terms for non-uniform acceptance for differential flow (cos terms).
20182  
20183  // Results are stored in fDiffFlowCorrectionTermsForNUAPro[t][pe][1][cti], where cti runs as follows:
20184  //  0: <<cos n(psi)>>
20185  //  1: <<cos n(psi1+phi2)>>
20186  //  2: <<cos n(psi1+phi2-phi3)>>
20187  //  3: <<cos n(psi1-phi2-phi3)>>
20188  //  4:
20189  //  5:
20190  //  6:
20191  
20192  // multiplicity:
20193  Double_t dMult = (*fSpk)(0,0);
20194  
20195  // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
20196  Double_t dReQ1n = (*fReQ)(0,0);
20197  Double_t dReQ2n = (*fReQ)(1,0);
20198  //Double_t dReQ3n = (*fReQ)(2,0);
20199  //Double_t dReQ4n = (*fReQ)(3,0);
20200  Double_t dImQ1n = (*fImQ)(0,0);
20201  Double_t dImQ2n = (*fImQ)(1,0);
20202  //Double_t dImQ3n = (*fImQ)(2,0);
20203  //Double_t dImQ4n = (*fImQ)(3,0);
20204
20205  Int_t t = 0; // type flag 
20206  Int_t pe = 0; // ptEta flag
20207  
20208  if(type == "RP")
20209  {
20210   t = 0;
20211  } else if(type == "POI")
20212    {
20213     t = 1;
20214    }
20215
20216  if(ptOrEta == "Pt")
20217  {
20218   pe = 0;
20219  } else if(ptOrEta == "Eta")
20220    {
20221     pe = 1;
20222    }
20223     
20224  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
20225  Double_t minPtEta[2] = {fPtMin,fEtaMin};
20226  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
20227  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
20228
20229  // looping over all bins and calculating correction terms: 
20230  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20231  {
20232   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
20233   Double_t p1n0kRe = 0.;
20234   Double_t p1n0kIm = 0.;
20235
20236   // number of POIs in particular pt or eta bin:
20237   Double_t mp = 0.;
20238
20239   // 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):
20240   Double_t q1n0kRe = 0.;
20241   Double_t q1n0kIm = 0.;
20242   Double_t q2n0kRe = 0.;
20243   Double_t q2n0kIm = 0.;
20244
20245   // number of particles which are both RPs and POIs in particular pt or eta bin:
20246   Double_t mq = 0.;
20247    
20248   if(type == "POI")
20249   {
20250    // q_{m*n,0}:
20251    q1n0kRe = fReRPQ1dEBE[2][pe][0][0]->GetBinContent(fReRPQ1dEBE[2][pe][0][0]->GetBin(b))
20252            * fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b));
20253    q1n0kIm = fImRPQ1dEBE[2][pe][0][0]->GetBinContent(fImRPQ1dEBE[2][pe][0][0]->GetBin(b))
20254            * fImRPQ1dEBE[2][pe][0][0]->GetBinEntries(fImRPQ1dEBE[2][pe][0][0]->GetBin(b));
20255    q2n0kRe = fReRPQ1dEBE[2][pe][1][0]->GetBinContent(fReRPQ1dEBE[2][pe][1][0]->GetBin(b))
20256            * fReRPQ1dEBE[2][pe][1][0]->GetBinEntries(fReRPQ1dEBE[2][pe][1][0]->GetBin(b));
20257    q2n0kIm = fImRPQ1dEBE[2][pe][1][0]->GetBinContent(fImRPQ1dEBE[2][pe][1][0]->GetBin(b))
20258            * fImRPQ1dEBE[2][pe][1][0]->GetBinEntries(fImRPQ1dEBE[2][pe][1][0]->GetBin(b));         
20259                  
20260    mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
20261   } 
20262   else if(type == "RP")
20263   {
20264    // q_{m*n,0}:
20265    q1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
20266            * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
20267    q1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))
20268            * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
20269    q2n0kRe = fReRPQ1dEBE[0][pe][1][0]->GetBinContent(fReRPQ1dEBE[0][pe][1][0]->GetBin(b))
20270            * fReRPQ1dEBE[0][pe][1][0]->GetBinEntries(fReRPQ1dEBE[0][pe][1][0]->GetBin(b));
20271    q2n0kIm = fImRPQ1dEBE[0][pe][1][0]->GetBinContent(fImRPQ1dEBE[0][pe][1][0]->GetBin(b))
20272            * fImRPQ1dEBE[0][pe][1][0]->GetBinEntries(fImRPQ1dEBE[0][pe][1][0]->GetBin(b));         
20273                  
20274    mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)  
20275   }    
20276   if(type == "POI")
20277   {
20278    // p_{m*n,0}:
20279    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
20280            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
20281    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
20282            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
20283             
20284    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
20285     
20286    t = 1; // typeFlag = RP or POI
20287   }
20288   else if(type == "RP")
20289   {
20290    // p_{m*n,0} = q_{m*n,0}:
20291    p1n0kRe = q1n0kRe; 
20292    p1n0kIm = q1n0kIm; 
20293            
20294    mp = mq; 
20295    
20296    t = 0; // typeFlag = RP or POI
20297   }
20298
20299   // <<cos n(psi1)>>:
20300   Double_t cosP1nPsi = 0.;
20301   if(mp)
20302   {
20303    cosP1nPsi = p1n0kRe/mp;
20304    
20305    // fill profile for <<cos n(psi1)>>:
20306    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi,mp);
20307    // histogram to store <cos n(psi1)> e-b-e (needed in some other methods):
20308    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][0]->SetBinContent(b,cosP1nPsi);
20309   } // end of if(mp)   
20310   
20311   // <<cos n(psi1+phi2)>>:
20312   Double_t cosP1nPsiP1nPhi = 0.;
20313   if(mp*dMult-mq)
20314   {
20315    cosP1nPsiP1nPhi = (p1n0kRe*dReQ1n-p1n0kIm*dImQ1n-q2n0kRe)/(mp*dMult-mq);
20316    // fill profile for <<sin n(psi1+phi2)>>:
20317    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsiP1nPhi,mp*dMult-mq);
20318    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
20319    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][1]->SetBinContent(b,cosP1nPsiP1nPhi);
20320   } // end of if(mp*dMult-mq)   
20321   
20322   // <<cos n(psi1+phi2-phi3)>>:
20323   Double_t cosP1nPsi1P1nPhi2MPhi3 = 0.;
20324   if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))
20325   {
20326    cosP1nPsi1P1nPhi2MPhi3 = (p1n0kRe*(pow(dImQ1n,2.)+pow(dReQ1n,2.)-dMult)
20327                           - 1.*(q2n0kRe*dReQ1n+q2n0kIm*dImQ1n)  
20328                           - mq*dReQ1n+2.*q1n0kRe)
20329                           / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
20330    // fill profile for <<sin n(psi1+phi2)>>:
20331    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1P1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
20332    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
20333    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][2]->SetBinContent(b,cosP1nPsi1P1nPhi2MPhi3);
20334   } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   
20335   
20336   // <<cos n(psi1-phi2-phi3)>>:
20337   Double_t cosP1nPsi1M1nPhi2MPhi3 = 0.;
20338   if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))
20339   {
20340    cosP1nPsi1M1nPhi2MPhi3 = (p1n0kRe*(pow(dReQ1n,2.)-pow(dImQ1n,2.))+2.*p1n0kIm*dReQ1n*dImQ1n
20341                           - 1.*(p1n0kRe*dReQ2n+p1n0kIm*dImQ2n)  
20342                           - 2.*mq*dReQ1n+2.*q1n0kRe)
20343                           / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
20344    // fill profile for <<sin n(psi1+phi2)>>:
20345    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1M1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));
20346    // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):
20347    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][3]->SetBinContent(b,cosP1nPsi1M1nPhi2MPhi3);
20348   } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   
20349  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20350  
20351 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTerms(TString type, TString ptOrEta)
20352
20353 //=========================================================================================================================
20354
20355 void AliFlowAnalysisWithQCumulants::FinalizeCorrectionTermsForNUADiffFlow(TString type, TString ptOrEta)
20356 {
20357  // Transfer profiles into histogams and correctly propagate the error.
20358  
20359  Int_t t = 0; // type flag 
20360  Int_t pe = 0; // ptEta flag
20361  
20362  if(type == "RP")
20363  {
20364   t = 0;
20365  } else if(type == "POI")
20366    {
20367     t = 1;
20368    }
20369
20370  if(ptOrEta == "Pt")
20371  {
20372   pe = 0;
20373  } else if(ptOrEta == "Eta")
20374    {
20375     pe = 1;
20376    }
20377     
20378  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
20379  //Double_t minPtEta[2] = {fPtMin,fEtaMin};
20380  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
20381  //Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
20382
20383  for(Int_t sc=0;sc<2;sc++) // sin or cos
20384  {
20385   for(Int_t cti=0;cti<9;cti++) // correction term index
20386   {
20387    for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20388    {
20389     Double_t correctionTerm = fDiffFlowCorrectionTermsForNUAPro[t][pe][sc][cti]->GetBinContent(b);
20390     fDiffFlowCorrectionTermsForNUAHist[t][pe][sc][cti]->SetBinContent(b,correctionTerm);
20391     // to be improved (propagate error correctly)
20392     // ...
20393    } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20394   } // correction term index
20395  } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos
20396
20397 }// end of void AliFlowAnalysisWithQCumulants::FinalizeCorrectionTermsForNUADiffFlow(TString type, TString ptOrEta)
20398
20399 //=========================================================================================================================
20400
20401 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCumulantsCorrectedForNUA(TString type, TString ptOrEta)
20402
20403  // Calculate generalized differential flow cumulants (corrected for non-uniform acceptance).
20404  
20405  // to be improved - propagate error also from non-isotropic terms
20406   
20407  Int_t t = 0; // RP = 0, POI = 1
20408  Int_t pe = 0; // pt = 0, eta = 1
20409
20410  if(type == "RP")
20411  {
20412   t = 0;
20413  } else if(type == "POI")
20414    {
20415     t = 1;
20416    } 
20417      
20418  if(ptOrEta == "Pt")
20419  {
20420   pe = 0;
20421  } else if(ptOrEta == "Eta")
20422    {
20423     pe = 1;
20424    } 
20425        
20426  // Common:
20427  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
20428  // 2-particle correlation:
20429  Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>>
20430  // sinus terms coming from reference flow: 
20431  Double_t sinP1nPhi = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(1); // <<sin(n*phi1)>>
20432  Double_t sinP1nPhi1P1nPhi2 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(2); // <<sin(n*(phi1+phi2))>>
20433  Double_t sinP1nPhi1M1nPhi2M1nPhi3 = fIntFlowCorrectionTermsForNUAHist[0]->GetBinContent(3); // <<sin(n*(phi1-phi2-phi3))>>
20434  // cosinus terms coming from reference flow: 
20435  Double_t cosP1nPhi = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(1); // <<cos(n*phi1)>>
20436  Double_t cosP1nPhi1P1nPhi2 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(2); // <<cos(n*(phi1+phi2))>>
20437  Double_t cosP1nPhi1M1nPhi2M1nPhi3 = fIntFlowCorrectionTermsForNUAHist[1]->GetBinContent(3); // <<cos(n*(phi1-phi2-phi3))>>
20438
20439  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20440  {
20441   Double_t twoPrime = fDiffFlowCorrelationsHist[t][pe][0]->GetBinContent(b); // <<2'>>
20442   Double_t fourPrime = fDiffFlowCorrelationsHist[t][pe][1]->GetBinContent(b); // <<4'>>
20443   Double_t sinP1nPsi = fDiffFlowCorrectionTermsForNUAHist[t][pe][0][0]->GetBinContent(b); // <<sin n(Psi)>> 
20444   Double_t cosP1nPsi = fDiffFlowCorrectionTermsForNUAHist[t][pe][1][0]->GetBinContent(b); // <<cos n(Psi)>> 
20445   Double_t sinP1nPsi1P1nPhi2 = fDiffFlowCorrectionTermsForNUAHist[t][pe][0][1]->GetBinContent(b); // <<sin n(psi1+phi2)>> 
20446   Double_t cosP1nPsi1P1nPhi2 = fDiffFlowCorrectionTermsForNUAHist[t][pe][1][1]->GetBinContent(b); // <<cos n(psi1+phi2)>> 
20447   Double_t sinP1nPsi1P1nPhi2M1nPhi3 = fDiffFlowCorrectionTermsForNUAHist[t][pe][0][2]->GetBinContent(b); // <<sin n(psi1+phi2-phi3)>> 
20448   Double_t cosP1nPsi1P1nPhi2M1nPhi3 = fDiffFlowCorrectionTermsForNUAHist[t][pe][1][2]->GetBinContent(b); // <<cos n(psi1+phi2-phi3)>> 
20449   Double_t sinP1nPsi1M1nPhi2M1nPhi3 = fDiffFlowCorrectionTermsForNUAHist[t][pe][0][3]->GetBinContent(b); // <<sin n(psi1-phi2-phi3)>> 
20450   Double_t cosP1nPsi1M1nPhi2M1nPhi3 = fDiffFlowCorrectionTermsForNUAHist[t][pe][1][3]->GetBinContent(b); // <<cos n(psi1-phi2-phi3)>> 
20451   // Generalized QC{2'}:
20452   Double_t qc2Prime = twoPrime - sinP1nPsi*sinP1nPhi - cosP1nPsi*cosP1nPhi;
20453   if(fApplyCorrectionForNUA)
20454   {
20455    fDiffFlowCumulants[t][pe][0]->SetBinContent(b,qc2Prime);
20456   }
20457   if(TMath::Abs(twoPrime)>0.)
20458   {
20459    fDiffFlowDetectorBias[t][pe][0]->SetBinContent(b,qc2Prime/twoPrime); // detector bias = generalized/isotropic cumulant.   
20460   }
20461   // Generalized QC{4'}:
20462   Double_t qc4Prime = fourPrime-2.*twoPrime*two
20463                     - cosP1nPsi*cosP1nPhi1M1nPhi2M1nPhi3
20464                     + sinP1nPsi*sinP1nPhi1M1nPhi2M1nPhi3
20465                     - cosP1nPhi*cosP1nPsi1M1nPhi2M1nPhi3
20466                     + sinP1nPhi*sinP1nPsi1M1nPhi2M1nPhi3
20467                     - 2.*cosP1nPhi*cosP1nPsi1P1nPhi2M1nPhi3
20468                     - 2.*sinP1nPhi*sinP1nPsi1P1nPhi2M1nPhi3
20469                     - cosP1nPsi1P1nPhi2*cosP1nPhi1P1nPhi2
20470                     - sinP1nPsi1P1nPhi2*sinP1nPhi1P1nPhi2
20471                     + 2.*cosP1nPhi1P1nPhi2*(cosP1nPsi*cosP1nPhi-sinP1nPsi*sinP1nPhi)
20472                     + 2.*sinP1nPhi1P1nPhi2*(cosP1nPsi*sinP1nPhi+sinP1nPsi*cosP1nPhi)
20473                     + 4.*two*(cosP1nPsi*cosP1nPhi+sinP1nPsi*sinP1nPhi)
20474                     + 2.*cosP1nPsi1P1nPhi2*(pow(cosP1nPhi,2.)-pow(sinP1nPhi,2.))
20475                     + 4.*sinP1nPsi1P1nPhi2*cosP1nPhi*sinP1nPhi
20476                     + 4.*twoPrime*(pow(cosP1nPhi,2.)+pow(sinP1nPhi,2.))
20477                     - 6.*(pow(cosP1nPhi,2.)-pow(sinP1nPhi,2.)) 
20478                     * (cosP1nPsi*cosP1nPhi-sinP1nPsi*sinP1nPhi)
20479                     - 12.*cosP1nPhi*sinP1nPhi
20480                     * (sinP1nPsi*cosP1nPhi+cosP1nPsi*sinP1nPhi);
20481   if(fApplyCorrectionForNUA)
20482   {
20483    fDiffFlowCumulants[t][pe][1]->SetBinContent(b,qc4Prime);   
20484   }
20485   if(TMath::Abs(fourPrime-2.*twoPrime*two)>0.)
20486   {
20487    fDiffFlowDetectorBias[t][pe][1]->SetBinContent(b,qc4Prime/(fourPrime-2.*twoPrime*two)); // detector bias = generalized/isotropic cumulant.   
20488   }
20489  } // end of for(Int_t p=1;p<=fnBinsPt;p++)
20490  
20491 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCumulantsCorrectedForNUA(TString type, TString ptOrEta)
20492
20493 //==================================================================================================================================    
20494
20495 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectedForNUA(TString type, TString ptOrEta)
20496 {
20497  // Calculate differential flow corrected for non-uniform acceptance.
20498  
20499  // to be improved: eventually I will have to access here masured correlations and NUA terms
20500  //                 instead of cumulants in order to propagate statistical error correctly also 
20501  //                 to NUA terms (propagating errors directly from cumulants is WRONG for 
20502  //                 differential flow becuase that doesn't account at all cross-covariance terms) 
20503  
20504  // REMARK: When NUA correction is apllied error for differential flow DOES NOT get corrected,
20505  //         i.e. only value is being corrected, error is still the one relevant for isotropic
20506  //         case. This eventually will be resolved. 
20507   
20508  
20509  Int_t t = 0; // RP or POI
20510  Int_t pe = 0; // pt or eta
20511
20512  if(type == "RP")
20513  {
20514   t = 0;
20515  } else if(type == "POI")
20516    {
20517     t = 1;
20518    }     
20519  if(ptOrEta == "Pt")
20520  {
20521   pe = 0;
20522  } else if(ptOrEta == "Eta")
20523    {
20524     pe = 1;
20525    } 
20526   
20527  // Common:
20528  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
20529  // Reference Q-cumulants
20530  Double_t qc2 = fIntFlowQcumulants->GetBinContent(1); // QC{2} 
20531  Double_t qc4 = fIntFlowQcumulants->GetBinContent(2); // QC{4}
20532  // Loop over pt or eta bins:
20533  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
20534  {
20535   // Differential Q-cumulants:
20536   Double_t qc2Prime = fDiffFlowCumulants[t][pe][0]->GetBinContent(b); // QC{2'}
20537   Double_t qc4Prime = fDiffFlowCumulants[t][pe][1]->GetBinContent(b); // QC{4'}
20538   // v'{2}:
20539   if(qc2>0.)
20540   { 
20541    Double_t v2Prime = qc2Prime/pow(qc2,0.5);
20542    if(TMath::Abs(v2Prime)>0.){fDiffFlow[t][pe][0]->SetBinContent(b,v2Prime);} 
20543   }  
20544   // v'{4}:
20545   if(qc4<0.)
20546   { 
20547    Double_t v4Prime = -qc4Prime/pow(-qc4,3./4.);
20548    if(TMath::Abs(v4Prime)>0.){fDiffFlow[t][pe][1]->SetBinContent(b,v4Prime);} 
20549   }  
20550  } // end of for(Int_t b=1;b<=fnBinsPtEta[pe];b++)
20551   
20552 } // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectedForNUA(TString type, TString ptOrEta); 
20553
20554 //=========================================================================================================================
20555
20556 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrelationsWithNestedLoops(AliFlowEventSimple * const anEvent)
20557 {
20558  // Evaluate with nested loops multiparticle correlations for integrated flow (without using the particle weights). 
20559
20560  // Remark: Results are stored in profile fIntFlowDirectCorrelations whose binning is organized as follows:
20561  // 
20562  //  1st bin: <2>_{1n|1n} = two1n1n = cos(n*(phi1-phi2))>
20563  //  2nd bin: <2>_{2n|2n} = two2n2n = cos(2n*(phi1-phi2))>
20564  //  3rd bin: <2>_{3n|3n} = two3n3n = cos(3n*(phi1-phi2))> 
20565  //  4th bin: <2>_{4n|4n} = two4n4n = cos(4n*(phi1-phi2))>
20566  //  5th bin:           ----  EMPTY ----
20567  //  6th bin: <3>_{2n|1n,1n} = three2n1n1n = <cos(n*(2.*phi1-phi2-phi3))>
20568  //  7th bin: <3>_{3n|2n,1n} = three3n2n1n = <cos(n*(3.*phi1-2.*phi2-phi3))>
20569  //  8th bin: <3>_{4n|2n,2n} = three4n2n2n = <cos(n*(4.*phi1-2.*phi2-2.*phi3))>
20570  //  9th bin: <3>_{4n|3n,1n} = three4n3n1n = <cos(n*(4.*phi1-3.*phi2-phi3))>
20571  // 10th bin:           ----  EMPTY ----
20572  // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1n = <cos(n*(phi1+phi2-phi3-phi4))>
20573  // 12th bin: <4>_{2n,1n|2n,1n} = four2n1n2n1n = <cos(2.*n*(phi1+phi2-phi3-phi4))>
20574  // 13th bin: <4>_{2n,2n|2n,2n} = four2n2n2n2n = <cos(n*(2.*phi1+phi2-2.*phi3-phi4))>
20575  // 14th bin: <4>_{3n|1n,1n,1n} = four3n1n1n1n = <cos(n*(3.*phi1-phi2-phi3-phi4))> 
20576  // 15th bin: <4>_{3n,1n|3n,1n} = four3n1n3n1n = <cos(n*(4.*phi1-2.*phi2-phi3-phi4))>
20577  // 16th bin: <4>_{3n,1n|2n,2n} = four3n1n2n2n = <cos(n*(3.*phi1+phi2-2.*phi3-2.*phi4))>
20578  // 17th bin: <4>_{4n|2n,1n,1n} = four4n2n1n1n = <cos(n*(3.*phi1+phi2-3.*phi3-phi4))> 
20579  // 18th bin:           ----  EMPTY ----
20580  // 19th bin: <5>_{2n|1n,1n,1n,1n} = five2n1n1n1n1n = <cos(n*(2.*phi1+phi2-phi3-phi4-phi5))>
20581  // 20th bin: <5>_{2n,2n|2n,1n,1n} = five2n2n2n1n1n = <cos(n*(2.*phi1+2.*phi2-2.*phi3-phi4-phi5))>
20582  // 21st bin: <5>_{3n,1n|2n,1n,1n} = five3n1n2n1n1n = <cos(n*(3.*phi1+phi2-2.*phi3-phi4-phi5))>
20583  // 22nd bin: <5>_{4n|1n,1n,1n,1n} = five4n1n1n1n1n = <cos(n*(4.*phi1-phi2-phi3-phi4-phi5))>
20584  // 23rd bin:           ----  EMPTY ----
20585  // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = six1n1n1n1n1n1n = <cos(n*(phi1+phi2+phi3-phi4-phi5-phi6))>
20586  // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = six2n1n1n2n1n1n = <cos(n*(2.*phi1+2.*phi2-phi3-phi4-phi5-phi6))>
20587  // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = six2n2n1n1n1n1n = <cos(n*(3.*phi1+phi2-phi3-phi4-phi5-phi6))>
20588  // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = six3n1n1n1n1n1n = <cos(n*(2.*phi1+phi2+phi3-2.*phi4-phi5-phi6))>
20589  // 28th bin:           ----  EMPTY ----
20590  // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = seven2n1n1n1n1n1n1n =  <cos(n*(2.*phi1+phi2+phi3-phi4-phi5-phi6-phi7))>
20591  // 30th bin:           ----  EMPTY ----
20592  // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = eight1n1n1n1n1n1n1n1n = <cos(n*(phi1+phi2+phi3+phi4-phi5-phi6-phi7-phi8))>
20593  // 32nd bin:           ----  EMPTY ----
20594   //  Extra correlations for 3p TY study: 
20595  // 33rd bin: <4>_{4n,2n|3n,3n}= four4n2n3n3n = <cos(n*(4.*phi1+2.*phi2-3.*phi3-3.*phi4))>
20596  // 34th bin: <5>_{3n,3n|2n,2n,2n} = five3n3n2n2n2n = <cos(n(3*phi1+3*phi2-2*phi3-2*phi4-2*phi5))> 
20597   //  Extra correlations for 6p TY study: 
20598  // 35th bin: <2>_{5n|5n} = two5n5n = <cos(5n*(phi1-phi2)> T
20599  // 36th bin: <2>_{6n|6n} = two6n6n = <cos(6n*(phi1-phi2)> T
20600  // 37th bin: <3>_{5n|3n,2n} = three5n3n2n = <cos(n*(5*phi1-3*phi2-2*phi3)> 
20601  // 38th bin: <3>_{5n|4n,1n} = three5n4n1n = <cos(n*(5*phi1-4*phi2-1*phi3)> 
20602  // 39th bin: <3>_{6n|3n,3n} = three6n3n3n = <cos(n*(6*phi1-3*phi2-3*phi3)> T 
20603  // 40th bin: <3>_{6n|4n,2n} = three6n4n2n = <cos(n*(6*phi1-4*phi2-2*phi3)> T
20604  // 41st bin: <3>_{6n|5n,1n} = three6n5n1n = <cos(n*(6*phi1-5*phi2-1*phi3)>
20605  // 42nd bin: <4>_{6n|3n,2n,1n} = four6n3n2n1n = <cos(n*(6*phi1-3*phi2-2*phi3-1*phi4)>
20606  // 43rd bin: <4>_{3n,2n|3n,2n} = four3n2n3n2n = <cos(n*(3*phi1+2*phi2-3*phi3-2*phi4)>
20607  // 44th bin: <4>_{4n,1n|3n,2n} = four4n1n3n2n = <cos(n*(4*phi1+1*phi2-3*phi3-2*phi4)>
20608  // 45th bin: <4>_{3n,3n|3n,3n} = four3n3n3n3n = <cos(3.*n*(phi1+phi2-phi3-phi4))> T
20609  // 46th bin: <4>_{4n,2n|3n,3n} = four4n2n3n3n = <cos(n*(4*phi1+2*phi2-3*phi3-3*phi4)>
20610  // 47th bin: <4>_{5n,1n|3n,3n} = four5n1n3n3n = <cos(n*(5*phi1+1*phi2-3*phi3-3*phi4)>
20611  // 48th bin: <4>_{4n,2n|4n,2n} = four4n2n4n2n = <cos(n*(4*phi1+2*phi2-4*phi3-2*phi4)> T
20612  // 49th bin: <4>_{5n,1n|4n,2n} = four5n1n4n2n = <cos(n*(5*phi1+1*phi2-4*phi3-2*phi4)>
20613  // 50th bin: <4>_{5n|3n,1n,1n} = four5n3n1n1n = <cos(n*(5*phi1-3*phi2-1*phi3-1*phi4)>
20614  // 51st bin: <4>_{5n|2n,2n,1n} = four5n2n2n1n = <cos(n*(5*phi1-2*phi2-2*phi3-1*phi4)>
20615  // 52nd bin: <4>_{5n,1n|5n,1n} = four5n1n5n1n = <cos(n*(5*phi1+1*phi2-5*phi3-1*phi4)>
20616  // 53rd bin: <5>_{3n,3n|3n,2n,1n} = four3n3n3n2n1n = <cos(n*(3*phi1+3*phi2-3*phi3-2*phi4-1*phi5)>
20617  // 54th bin: <5>_{4n,2n|3n,2n,1n} = four4n2n3n2n1n = <cos(n*(4*phi1+2*phi2-3*phi3-2*phi4-1*phi5)>
20618  // 55th bin: <5>_{3n,2n|3n,1n,1n} = four3n2n3n1n1n = <cos(n*(3*phi1+2*phi2-3*phi3-1*phi4-1*phi5)>
20619  // 56th bin: <5>_{3n,2n|2n,2n,1n} = four3n2n2n2n1n = <cos(n*(3*phi1+2*phi2-2*phi3-2*phi4-1*phi5)>
20620  // 57th bin: <5>_{5n,1n|3n,2n,1n} = four5n1n3n2n1n = <cos(n*(5*phi1+1*phi2-3*phi3-2*phi4-1*phi5)>
20621  // 58th bin: <6>_{3n,2n,1n|3n,2n,1n} = six3n2n1n3n2n1n = <cos(n*(3*phi1+2*phi2+1*phi3-3*phi4-2*phi5-1*phi6)>
20622   
20623  Int_t nPrim = anEvent->NumberOfTracks(); 
20624  AliFlowTrackSimple *aftsTrack = NULL; 
20625  Double_t phi1=0., phi2=0., phi3=0., phi4=0., phi5=0., phi6=0., phi7=0., phi8=0.; 
20626  Int_t n = fHarmonic; 
20627  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // to be improved (is this casting safe in general?)
20628  Double_t dMult = (*fSpk)(0,0);
20629  cout<<endl;
20630  cout<<"Multiparticle correlations: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
20631  if(dMult<2)
20632  {
20633   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
20634  } else if (dMult>fMaxAllowedMultiplicity)
20635    {
20636     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
20637    } else 
20638      { 
20639       cout<<"... evaluating nested loops (without using particle weights)..."<<endl;
20640      } 
20641  
20642  // 2-particle correlations:       
20643  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
20644  {
20645   for(Int_t i1=0;i1<nPrim;i1++)
20646   {
20647    aftsTrack=anEvent->GetTrack(i1);
20648    if(!(aftsTrack->InRPSelection())) continue;
20649    phi1=aftsTrack->Phi(); 
20650    for(Int_t i2=0;i2<nPrim;i2++)
20651    {
20652     if(i2==i1)continue;
20653     aftsTrack=anEvent->GetTrack(i2);
20654     if(!(aftsTrack->InRPSelection())) continue;
20655     phi2=aftsTrack->Phi();
20656     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
20657     // fill the profile with 2-p correlations: 
20658     fIntFlowDirectCorrelations->Fill(0.5,cos(n*(phi1-phi2)),1.);     // <cos(n*(phi1-phi2))>
20659     fIntFlowDirectCorrelations->Fill(1.5,cos(2.*n*(phi1-phi2)),1.);  // <cos(2n*(phi1-phi2))>
20660     fIntFlowDirectCorrelations->Fill(2.5,cos(3.*n*(phi1-phi2)),1.);  // <cos(3n*(phi1-phi2))>
20661     fIntFlowDirectCorrelations->Fill(3.5,cos(4.*n*(phi1-phi2)),1.);  // <cos(4n*(phi1-phi2))>   
20662     fIntFlowDirectCorrelations->Fill(34.5,cos(5.*n*(phi1-phi2)),1.); // <cos(5n*(phi1-phi2))>
20663     fIntFlowDirectCorrelations->Fill(35.5,cos(6.*n*(phi1-phi2)),1.); // <cos(6n*(phi1-phi2))>   
20664    } // end of for(Int_t i2=0;i2<nPrim;i2++)
20665   } // end of for(Int_t i1=0;i1<nPrim;i1++)
20666  } // end of if(nPrim>=2)
20667  
20668  // 3-particle correlations:         
20669  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
20670  {
20671   for(Int_t i1=0;i1<nPrim;i1++)
20672   {
20673    aftsTrack=anEvent->GetTrack(i1);
20674    if(!(aftsTrack->InRPSelection())) continue;
20675    phi1=aftsTrack->Phi();
20676    for(Int_t i2=0;i2<nPrim;i2++)
20677    {
20678     if(i2==i1)continue;
20679     aftsTrack=anEvent->GetTrack(i2);
20680     if(!(aftsTrack->InRPSelection())) continue;
20681     phi2=aftsTrack->Phi();
20682     for(Int_t i3=0;i3<nPrim;i3++)
20683     {
20684      if(i3==i1||i3==i2)continue;
20685      aftsTrack=anEvent->GetTrack(i3);
20686      if(!(aftsTrack->InRPSelection())) continue;
20687      phi3=aftsTrack->Phi();
20688      if(nPrim==3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush;
20689      // fill the profile with 3-p correlations:   
20690      fIntFlowDirectCorrelations->Fill(5.,cos(2.*n*phi1-n*(phi2+phi3)),1.);         //<3>_{2n|nn,n}
20691      fIntFlowDirectCorrelations->Fill(6.,cos(3.*n*phi1-2.*n*phi2-n*phi3),1.);      //<3>_{3n|2n,n}
20692      fIntFlowDirectCorrelations->Fill(7.,cos(4.*n*phi1-2.*n*phi2-2.*n*phi3),1.);   //<3>_{4n|2n,2n}
20693      fIntFlowDirectCorrelations->Fill(8.,cos(4.*n*phi1-3.*n*phi2-n*phi3),1.);      //<3>_{4n|3n,n}
20694      fIntFlowDirectCorrelations->Fill(36.5,cos(5.*n*phi1-3.*n*phi2-2.*n*phi3),1.); //<3>_{5n|3n,2n}
20695      fIntFlowDirectCorrelations->Fill(37.5,cos(5.*n*phi1-4.*n*phi2-1.*n*phi3),1.); //<3>_{5n|4n,1n}
20696      fIntFlowDirectCorrelations->Fill(38.5,cos(6.*n*phi1-3.*n*phi2-3.*n*phi3),1.); //<3>_{6n|3n,3n}
20697      fIntFlowDirectCorrelations->Fill(39.5,cos(6.*n*phi1-4.*n*phi2-2.*n*phi3),1.); //<3>_{6n|4n,2n}     
20698      fIntFlowDirectCorrelations->Fill(40.5,cos(6.*n*phi1-5.*n*phi2-1.*n*phi3),1.); //<3>_{6n|5n,1n}
20699     } // end of for(Int_t i3=0;i3<nPrim;i3++)
20700    } // end of for(Int_t i2=0;i2<nPrim;i2++)
20701   } // end of for(Int_t i1=0;i1<nPrim;i1++)
20702  } // end of if(nPrim>=3)
20703
20704  // 4-particle correlations:
20705  if(nPrim>=4 && nPrim<=fMaxAllowedMultiplicity)
20706  {       
20707   for(Int_t i1=0;i1<nPrim;i1++)
20708   { 
20709    aftsTrack=anEvent->GetTrack(i1);
20710    if(!(aftsTrack->InRPSelection())) continue;
20711    phi1=aftsTrack->Phi();
20712    for(Int_t i2=0;i2<nPrim;i2++)
20713    {
20714     if(i2==i1)continue;
20715     aftsTrack=anEvent->GetTrack(i2);
20716     if(!(aftsTrack->InRPSelection())) continue;
20717     phi2=aftsTrack->Phi();
20718     for(Int_t i3=0;i3<nPrim;i3++)
20719     {
20720      if(i3==i1||i3==i2)continue;
20721      aftsTrack=anEvent->GetTrack(i3);
20722      if(!(aftsTrack->InRPSelection())) continue;
20723      phi3=aftsTrack->Phi();
20724      for(Int_t i4=0;i4<nPrim;i4++)
20725      {
20726       if(i4==i1||i4==i2||i4==i3)continue;
20727       aftsTrack=anEvent->GetTrack(i4);
20728       if(!(aftsTrack->InRPSelection())) continue;
20729       phi4=aftsTrack->Phi();
20730       if(nPrim==4) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<"\r"<<flush;
20731       // fill the profile with 4-p correlations:   
20732       fIntFlowDirectCorrelations->Fill(10.,cos(n*phi1+n*phi2-n*phi3-n*phi4),1.);            // <4>_{n,n|n,n} 
20733       fIntFlowDirectCorrelations->Fill(11.,cos(2.*n*phi1+n*phi2-2.*n*phi3-n*phi4),1.);      // <4>_{2n,n|2n,n}
20734       fIntFlowDirectCorrelations->Fill(12.,cos(2.*n*phi1+2*n*phi2-2.*n*phi3-2.*n*phi4),1.); // <4>_{2n,2n|2n,2n}
20735       fIntFlowDirectCorrelations->Fill(13.,cos(3.*n*phi1-n*phi2-n*phi3-n*phi4),1.);         // <4>_{3n|n,n,n}
20736       fIntFlowDirectCorrelations->Fill(14.,cos(3.*n*phi1+n*phi2-3.*n*phi3-n*phi4),1.);      // <4>_{3n,n|3n,n}   
20737       fIntFlowDirectCorrelations->Fill(15.,cos(3.*n*phi1+n*phi2-2.*n*phi3-2.*n*phi4),1.);   // <4>_{3n,n|2n,2n}
20738       fIntFlowDirectCorrelations->Fill(16.,cos(4.*n*phi1-2.*n*phi2-n*phi3-n*phi4),1.);      // <4>_{4n|2n,n,n}     
20739       fIntFlowDirectCorrelations->Fill(32.,cos(n*(4.*phi1+2.*phi2-3.*phi3-3.*phi4)),1.);    // <4>_{4n,2n|3n,3n}        
20740       fIntFlowDirectCorrelations->Fill(41.5,cos(n*(6.*phi1-3.*phi2-2.*phi3-1.*phi4)),1.);    // <4>_{6n|3n,2n,1n}  
20741       fIntFlowDirectCorrelations->Fill(42.5,cos(n*(3.*phi1+2.*phi2-3.*phi3-2.*phi4)),1.);    // <4>_{3n,2n|3n,2n}  
20742       fIntFlowDirectCorrelations->Fill(43.5,cos(n*(4.*phi1+1.*phi2-3.*phi3-2.*phi4)),1.);    // <4>_{4n,1n|3n,2n}  
20743       fIntFlowDirectCorrelations->Fill(44.5,cos(n*(3.*phi1+3.*phi2-3.*phi3-3.*phi4)),1.);    // <4>_{3n,3n|3n,3n}  
20744       fIntFlowDirectCorrelations->Fill(45.5,cos(n*(4.*phi1+2.*phi2-3.*phi3-3.*phi4)),1.);    // <4>_{4n,2n|3n,3n}  
20745       fIntFlowDirectCorrelations->Fill(46.5,cos(n*(5.*phi1+1.*phi2-3.*phi3-3.*phi4)),1.);    // <4>_{5n,1n|3n,3n}  
20746       fIntFlowDirectCorrelations->Fill(47.5,cos(n*(4.*phi1+2.*phi2-4.*phi3-2.*phi4)),1.);    // <4>_{4n,2n|4n,2n}     
20747       fIntFlowDirectCorrelations->Fill(48.5,cos(n*(5.*phi1+1.*phi2-4.*phi3-2.*phi4)),1.);    // <4>_{5n,1n|4n,2n}  
20748       fIntFlowDirectCorrelations->Fill(49.5,cos(n*(5.*phi1-3.*phi2-1.*phi3-1.*phi4)),1.);    // <4>_{5n|3n,1n,1n}  
20749       fIntFlowDirectCorrelations->Fill(50.5,cos(n*(5.*phi1-2.*phi2-2.*phi3-1.*phi4)),1.);    // <4>_{5n|2n,2n,1n}  
20750       fIntFlowDirectCorrelations->Fill(51.5,cos(n*(5.*phi1+1.*phi2-5.*phi3-1.*phi4)),1.);    // <4>_{5n,1n|5n,1n}        
20751       fIntFlowDirectCorrelations->Fill(58.5,cos(n*(6.*phi1-4.*phi2-1.*phi3-1.*phi4)),1.);    // <4>_{6n|4n,1n,1n}  
20752       fIntFlowDirectCorrelations->Fill(59.5,cos(n*(6.*phi1-2.*phi2-2.*phi3-2.*phi4)),1.);    // <4>_{6n|2n,2n,2n}  
20753      } // end of for(Int_t i4=0;i4<nPrim;i4++) 
20754     } // end of for(Int_t i3=0;i3<nPrim;i3++)
20755    } // end of for(Int_t i2=0;i2<nPrim;i2++)
20756   } // end of for(Int_t i1=0;i1<nPrim;i1++)
20757  } // end of if(nPrim>=)
20758
20759  // 5-particle correlations:      
20760  if(nPrim>=5 && nPrim<=fMaxAllowedMultiplicity)
20761  {
20762   for(Int_t i1=0;i1<nPrim;i1++)
20763   {
20764    aftsTrack=anEvent->GetTrack(i1);
20765    if(!(aftsTrack->InRPSelection())) continue;  
20766    phi1=aftsTrack->Phi();
20767    for(Int_t i2=0;i2<nPrim;i2++)
20768    {
20769     if(i2==i1)continue;
20770     aftsTrack=anEvent->GetTrack(i2);
20771     if(!(aftsTrack->InRPSelection())) continue;
20772     phi2=aftsTrack->Phi();
20773     for(Int_t i3=0;i3<nPrim;i3++)
20774     {
20775      if(i3==i1||i3==i2)continue;
20776      aftsTrack=anEvent->GetTrack(i3);
20777      if(!(aftsTrack->InRPSelection())) continue;
20778      phi3=aftsTrack->Phi();
20779      for(Int_t i4=0;i4<nPrim;i4++)
20780      {
20781       if(i4==i1||i4==i2||i4==i3)continue;
20782       aftsTrack=anEvent->GetTrack(i4);
20783       if(!(aftsTrack->InRPSelection())) continue;
20784       phi4=aftsTrack->Phi();
20785       for(Int_t i5=0;i5<nPrim;i5++)
20786       {
20787        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
20788        aftsTrack=anEvent->GetTrack(i5);
20789        if(!(aftsTrack->InRPSelection())) continue;
20790        phi5=aftsTrack->Phi();
20791        if(nPrim==5) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<"\r"<<flush;
20792        // fill the profile with 5-p correlations:   
20793        fIntFlowDirectCorrelations->Fill(18.,cos(2.*n*phi1+n*phi2-n*phi3-n*phi4-n*phi5),1.);              // <5>_{2n,n|n,n,n}
20794        fIntFlowDirectCorrelations->Fill(19.,cos(2.*n*phi1+2.*n*phi2-2.*n*phi3-n*phi4-n*phi5),1.);        // <5>_{2n,2n|2n,n,n}
20795        fIntFlowDirectCorrelations->Fill(20.,cos(3.*n*phi1+n*phi2-2.*n*phi3-n*phi4-n*phi5),1.);           // <5>_{3n,n|2n,n,n}
20796        fIntFlowDirectCorrelations->Fill(21.,cos(4.*n*phi1-n*phi2-n*phi3-n*phi4-n*phi5),1.);              // <5>_{4n|n,n,n,n}
20797        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}       
20798        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}      
20799        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}       
20800        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}
20801        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}
20802        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}              
20803        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}
20804        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}              
20805       } // end of for(Int_t i5=0;i5<nPrim;i5++)
20806      } // end of for(Int_t i4=0;i4<nPrim;i4++)  
20807     } // end of for(Int_t i3=0;i3<nPrim;i3++)
20808    } // end of for(Int_t i2=0;i2<nPrim;i2++)
20809   } // end of for(Int_t i1=0;i1<nPrim;i1++)
20810  } // end of if(nPrim>=5)
20811   
20812  // 6-particle correlations:
20813  if(nPrim>=6 && nPrim<=fMaxAllowedMultiplicity)
20814  {
20815   for(Int_t i1=0;i1<nPrim;i1++)
20816   {
20817    aftsTrack=anEvent->GetTrack(i1);
20818    if(!(aftsTrack->InRPSelection())) continue;
20819    phi1=aftsTrack->Phi();
20820    for(Int_t i2=0;i2<nPrim;i2++)
20821    {
20822     if(i2==i1)continue;
20823     aftsTrack=anEvent->GetTrack(i2);
20824     if(!(aftsTrack->InRPSelection())) continue;
20825     phi2=aftsTrack->Phi();
20826     for(Int_t i3=0;i3<nPrim;i3++)
20827     {
20828      if(i3==i1||i3==i2)continue;
20829      aftsTrack=anEvent->GetTrack(i3);
20830      if(!(aftsTrack->InRPSelection())) continue;
20831      phi3=aftsTrack->Phi();
20832      for(Int_t i4=0;i4<nPrim;i4++)
20833      {
20834       if(i4==i1||i4==i2||i4==i3)continue;
20835       aftsTrack=anEvent->GetTrack(i4);
20836       if(!(aftsTrack->InRPSelection())) continue;
20837       phi4=aftsTrack->Phi();
20838       for(Int_t i5=0;i5<nPrim;i5++)
20839       {
20840        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
20841        aftsTrack=anEvent->GetTrack(i5);
20842        if(!(aftsTrack->InRPSelection())) continue;
20843        phi5=aftsTrack->Phi();
20844        for(Int_t i6=0;i6<nPrim;i6++)
20845        {
20846         if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5)continue;
20847         aftsTrack=anEvent->GetTrack(i6);
20848         if(!(aftsTrack->InRPSelection())) continue;
20849         phi6=aftsTrack->Phi(); 
20850         if(nPrim==6) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<" "<<i6<<"\r"<<flush;
20851         // fill the profile with 6-p correlations:   
20852         fIntFlowDirectCorrelations->Fill(23.,cos(n*phi1+n*phi2+n*phi3-n*phi4-n*phi5-n*phi6),1.);                    // <6>_{1n,1n,1n|1n,1n,1n}
20853         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}
20854         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}
20855         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}  
20856         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}  
20857         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}  
20858        } // end of for(Int_t i6=0;i6<nPrim;i6++)
20859       } // end of for(Int_t i5=0;i5<nPrim;i5++)
20860      } // end of for(Int_t i4=0;i4<nPrim;i4++)
20861     } // end of for(Int_t i3=0;i3<nPrim;i3++)
20862    } // end of for(Int_t i2=0;i2<nPrim;i2++)
20863   } // end of for(Int_t i1=0;i1<nPrim;i1++)
20864  } // end of if(nPrim>=6)
20865   
20866  // 7-particle correlations:
20867  if(nPrim>=7 && nPrim<=fMaxAllowedMultiplicity)
20868  {
20869   for(Int_t i1=0;i1<nPrim;i1++)
20870   { 
20871    aftsTrack=anEvent->GetTrack(i1);
20872    if(!(aftsTrack->InRPSelection())) continue;
20873    phi1=aftsTrack->Phi();
20874    for(Int_t i2=0;i2<nPrim;i2++)
20875    {
20876     if(i2==i1)continue;
20877     aftsTrack=anEvent->GetTrack(i2);
20878     if(!(aftsTrack->InRPSelection())) continue;
20879     phi2=aftsTrack->Phi();
20880     for(Int_t i3=0;i3<nPrim;i3++)
20881     {
20882      if(i3==i1||i3==i2)continue;
20883      aftsTrack=anEvent->GetTrack(i3);
20884      if(!(aftsTrack->InRPSelection())) continue;
20885      phi3=aftsTrack->Phi();
20886      for(Int_t i4=0;i4<nPrim;i4++)
20887      {
20888       if(i4==i1||i4==i2||i4==i3)continue;
20889       aftsTrack=anEvent->GetTrack(i4);
20890       if(!(aftsTrack->InRPSelection())) continue;
20891       phi4=aftsTrack->Phi();
20892       for(Int_t i5=0;i5<nPrim;i5++)
20893       {
20894        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
20895        aftsTrack=anEvent->GetTrack(i5);
20896        if(!(aftsTrack->InRPSelection())) continue;
20897        phi5=aftsTrack->Phi();
20898        for(Int_t i6=0;i6<nPrim;i6++)
20899        {
20900         if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5)continue;
20901         aftsTrack=anEvent->GetTrack(i6);
20902         if(!(aftsTrack->InRPSelection())) continue;
20903         phi6=aftsTrack->Phi(); 
20904         for(Int_t i7=0;i7<nPrim;i7++)
20905         {
20906          if(i7==i1||i7==i2||i7==i3||i7==i4||i7==i5||i7==i6)continue;
20907          aftsTrack=anEvent->GetTrack(i7);
20908          if(!(aftsTrack->InRPSelection())) continue;
20909          phi7=aftsTrack->Phi(); 
20910          if(nPrim==7) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<" "<<i6<<" "<<i7<<"\r"<<flush;
20911          // fill the profile with 7-p correlation:   
20912          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}
20913         } // end of for(Int_t i7=0;i7<nPrim;i7++)
20914        } // end of for(Int_t i6=0;i6<nPrim;i6++) 
20915       } // end of for(Int_t i5=0;i5<nPrim;i5++)
20916      } // end of for(Int_t i4=0;i4<nPrim;i4++)  
20917     } // end of for(Int_t i3=0;i3<nPrim;i3++)
20918    } // end of for(Int_t i2=0;i2<nPrim;i2++)
20919   } // end of for(Int_t i1=0;i1<nPrim;i1++)
20920  } // end of if(nPrim>=7)
20921  
20922  // 8-particle correlations:
20923  if(nPrim>=8 && nPrim<=fMaxAllowedMultiplicity)
20924  {
20925   for(Int_t i1=0;i1<nPrim;i1++)
20926   {
20927    aftsTrack=anEvent->GetTrack(i1);
20928    if(!(aftsTrack->InRPSelection())) continue;
20929    phi1=aftsTrack->Phi();
20930    for(Int_t i2=0;i2<nPrim;i2++)
20931    {
20932     if(i2==i1)continue;
20933     aftsTrack=anEvent->GetTrack(i2);
20934     if(!(aftsTrack->InRPSelection())) continue;
20935     phi2=aftsTrack->Phi();
20936     for(Int_t i3=0;i3<nPrim;i3++)
20937     {
20938      if(i3==i1||i3==i2)continue;
20939      aftsTrack=anEvent->GetTrack(i3);
20940      if(!(aftsTrack->InRPSelection())) continue;
20941      phi3=aftsTrack->Phi();
20942      for(Int_t i4=0;i4<nPrim;i4++)
20943      {
20944       if(i4==i1||i4==i2||i4==i3)continue;
20945       aftsTrack=anEvent->GetTrack(i4);
20946       if(!(aftsTrack->InRPSelection())) continue;
20947       phi4=aftsTrack->Phi();
20948       for(Int_t i5=0;i5<nPrim;i5++)
20949       {
20950        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
20951        aftsTrack=anEvent->GetTrack(i5);
20952        if(!(aftsTrack->InRPSelection())) continue;
20953        phi5=aftsTrack->Phi();
20954        for(Int_t i6=0;i6<nPrim;i6++)
20955        {
20956         if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5)continue;
20957         aftsTrack=anEvent->GetTrack(i6);
20958         if(!(aftsTrack->InRPSelection())) continue;
20959         phi6=aftsTrack->Phi();
20960         for(Int_t i7=0;i7<nPrim;i7++)
20961         {
20962          if(i7==i1||i7==i2||i7==i3||i7==i4||i7==i5||i7==i6)continue;
20963          aftsTrack=anEvent->GetTrack(i7);
20964          if(!(aftsTrack->InRPSelection())) continue;
20965          phi7=aftsTrack->Phi();
20966          for(Int_t i8=0;i8<nPrim;i8++)
20967          {
20968           if(i8==i1||i8==i2||i8==i3||i8==i4||i8==i5||i8==i6||i8==i7)continue;
20969           aftsTrack=anEvent->GetTrack(i8);
20970           if(!(aftsTrack->InRPSelection())) continue;
20971           phi8=aftsTrack->Phi();
20972           cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<" "<<i6<<" "<<i7<<" "<<i8<<"\r"<<flush;
20973           // fill the profile with 8-p correlation:   
20974           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}
20975          } // end of for(Int_t i8=0;i8<nPrim;i8++)
20976         } // end of for(Int_t i7=0;i7<nPrim;i7++) 
20977        } // end of for(Int_t i6=0;i6<nPrim;i6++) 
20978       } // end of for(Int_t i5=0;i5<nPrim;i5++)
20979      } // end of for(Int_t i4=0;i4<nPrim;i4++)  
20980     } // end of for(Int_t i3=0;i3<nPrim;i3++)
20981    } // end of for(Int_t i2=0;i2<nPrim;i2++)
20982   } // end of for(Int_t i1=0;i1<nPrim;i1++)
20983  } // end of if(nPrim>=8)
20984  
20985  cout<<endl;
20986
20987 } // end of AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrelationsWithNestedLoops(AliFlowEventSimple* anEvent)
20988
20989 //================================================================================================================
20990
20991 void AliFlowAnalysisWithQCumulants::EvaluateMixedHarmonicsWithNestedLoops(AliFlowEventSimple * const anEvent)
20992 {
20993  // Evaluate with nested loops multi-particle correlations for mixed harmonics. 
20994   
20995  Int_t nPrim = anEvent->NumberOfTracks(); 
20996  AliFlowTrackSimple *aftsTrack = NULL; 
20997  Double_t phi1=0.;
20998  Double_t phi2=0.; 
20999  Double_t phi3=0.;
21000  Double_t phi4=0.;
21001  Double_t phi5=0.;
21002  /*Double_t phi6=0.;
21003  Double_t phi7=0.;
21004  Double_t phi8=0.;*/ 
21005  Int_t n = fHarmonic; 
21006  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // TBI: is such casting safe in general?
21007  Double_t dMult = (*fSpk)(0,0);
21008  cout<<endl;
21009  cout<<"Multiparticle correlations: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
21010  if(dMult<2)
21011  {
21012   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
21013  } else if (dMult>fMaxAllowedMultiplicity)
21014    {
21015     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
21016    } else 
21017      { 
21018       cout<<"... evaluating nested loops (without using particle weights)..."<<endl;
21019      } 
21020  
21021  // 2-particle correlations:       
21022  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
21023  {
21024   for(Int_t i1=0;i1<nPrim;i1++)
21025   {
21026    aftsTrack=anEvent->GetTrack(i1);
21027    if(!(aftsTrack->InRPSelection())) continue;
21028    phi1=aftsTrack->Phi(); 
21029    for(Int_t i2=0;i2<nPrim;i2++)
21030    {
21031     if(i2==i1)continue;
21032     aftsTrack=anEvent->GetTrack(i2);
21033     if(!(aftsTrack->InRPSelection())) continue;
21034     phi2=aftsTrack->Phi();
21035     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
21036     // Fill the profile fMixedHarmonicsNestedLoops with 2-p correlations: 
21037     fMixedHarmonicsNestedLoops->Fill(0.5,cos(1.*n*(phi1-phi2)),1.); // <cos(1n*(phi1-phi2))>
21038     fMixedHarmonicsNestedLoops->Fill(1.5,cos(2.*n*(phi1-phi2)),1.); // <cos(2n*(phi1-phi2))>
21039     fMixedHarmonicsNestedLoops->Fill(2.5,cos(3.*n*(phi1-phi2)),1.); // <cos(3n*(phi1-phi2))>
21040     fMixedHarmonicsNestedLoops->Fill(3.5,cos(4.*n*(phi1-phi2)),1.); // <cos(4n*(phi1-phi2))>   
21041     fMixedHarmonicsNestedLoops->Fill(4.5,cos(5.*n*(phi1-phi2)),1.); // <cos(5n*(phi1-phi2))>
21042     fMixedHarmonicsNestedLoops->Fill(5.5,cos(6.*n*(phi1-phi2)),1.); // <cos(6n*(phi1-phi2))>   
21043    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21044   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21045  } // end of if(nPrim>=2)
21046  
21047  // 3-particle correlations:         
21048  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
21049  {
21050   for(Int_t i1=0;i1<nPrim;i1++)
21051   {
21052    aftsTrack=anEvent->GetTrack(i1);
21053    if(!(aftsTrack->InRPSelection())) continue;
21054    phi1=aftsTrack->Phi();
21055    for(Int_t i2=0;i2<nPrim;i2++)
21056    {
21057     if(i2==i1)continue;
21058     aftsTrack=anEvent->GetTrack(i2);
21059     if(!(aftsTrack->InRPSelection())) continue;
21060     phi2=aftsTrack->Phi();
21061     for(Int_t i3=0;i3<nPrim;i3++)
21062     {
21063      if(i3==i1||i3==i2)continue;
21064      aftsTrack=anEvent->GetTrack(i3);
21065      if(!(aftsTrack->InRPSelection())) continue;
21066      phi3=aftsTrack->Phi();
21067      if(nPrim==3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush;
21068      // Fill the profile fMixedHarmonicsNestedLoops with 3-p correlations:  
21069      fMixedHarmonicsNestedLoops->Fill( 6.5,cos(2.*n*phi1-n*(phi2+phi3)),1.);       // <3>_{2n|1n,1n}
21070      fMixedHarmonicsNestedLoops->Fill( 7.5,cos(4.*n*phi1-2.*n*phi2-2.*n*phi3),1.); // <3>_{4n|2n,2n}
21071      fMixedHarmonicsNestedLoops->Fill( 8.5,cos(6.*n*phi1-3.*n*phi2-3.*n*phi3),1.); // <3>_{6n|3n,3n}
21072      fMixedHarmonicsNestedLoops->Fill(10.5,cos(3.*n*phi1-2.*n*phi2-n*phi3),1.);    // <3>_{3n|2n,1n}   
21073      fMixedHarmonicsNestedLoops->Fill(11.5,cos(4.*n*phi1-3.*n*phi2-1.*n*phi3),1.); // <3>_{4n|3n,1n}
21074      fMixedHarmonicsNestedLoops->Fill(12.5,cos(5.*n*phi1-3.*n*phi2-2.*n*phi3),1.); // <3>_{5n|3n,2n}
21075      fMixedHarmonicsNestedLoops->Fill(13.5,cos(5.*n*phi1-4.*n*phi2-1.*n*phi3),1.); // <3>_{5n|4n,1n}
21076      fMixedHarmonicsNestedLoops->Fill(14.5,cos(6.*n*phi1-4.*n*phi2-2.*n*phi3),1.); // <3>_{6n|4n,2n}     
21077      fMixedHarmonicsNestedLoops->Fill(15.5,cos(6.*n*phi1-5.*n*phi2-1.*n*phi3),1.); // <3>_{6n|5n,1n}
21078     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21079    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21080   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21081  } // end of if(nPrim>=3)
21082
21083  // 4-particle correlations:
21084  if(nPrim>=4 && nPrim<=fMaxAllowedMultiplicity)
21085  {       
21086   for(Int_t i1=0;i1<nPrim;i1++)
21087   { 
21088    aftsTrack=anEvent->GetTrack(i1);
21089    if(!(aftsTrack->InRPSelection())) continue;
21090    phi1=aftsTrack->Phi();
21091    for(Int_t i2=0;i2<nPrim;i2++)
21092    {
21093     if(i2==i1)continue;
21094     aftsTrack=anEvent->GetTrack(i2);
21095     if(!(aftsTrack->InRPSelection())) continue;
21096     phi2=aftsTrack->Phi();
21097     for(Int_t i3=0;i3<nPrim;i3++)
21098     {
21099      if(i3==i1||i3==i2)continue;
21100      aftsTrack=anEvent->GetTrack(i3);
21101      if(!(aftsTrack->InRPSelection())) continue;
21102      phi3=aftsTrack->Phi();
21103      for(Int_t i4=0;i4<nPrim;i4++)
21104      {
21105       if(i4==i1||i4==i2||i4==i3)continue;
21106       aftsTrack=anEvent->GetTrack(i4);
21107       if(!(aftsTrack->InRPSelection())) continue;
21108       phi4=aftsTrack->Phi();
21109       if(nPrim==4) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<"\r"<<flush;
21110       // fill the profile with 4-p correlations:   
21111       fMixedHarmonicsNestedLoops->Fill(16.5,cos(1.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{1n,1n|1n,1n} 
21112       fMixedHarmonicsNestedLoops->Fill(17.5,cos(2.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{2n,2n|2n,2n} 
21113       fMixedHarmonicsNestedLoops->Fill(18.5,cos(3.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{3n,3n|3n,3n} 
21114       fMixedHarmonicsNestedLoops->Fill(19.5,cos(4.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{4n,4n|4n,4n} 
21115       fMixedHarmonicsNestedLoops->Fill(20.5,cos(5.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{5n,5n|5n,5n} 
21116       fMixedHarmonicsNestedLoops->Fill(21.5,cos(6.*n*(phi1+phi2-phi3-phi4)),1.); // <4>_{6n,6n|6n,6n} 
21117       fMixedHarmonicsNestedLoops->Fill(23.5,cos(n*(2.*phi1+1.*phi2-2.*phi3-1.*phi4)),1.); // <4>_{2n,1n|2n,1n} 
21118       fMixedHarmonicsNestedLoops->Fill(24.5,cos(n*(3.*phi1+1.*phi2-3.*phi3-1.*phi4)),1.); // <4>_{3n,1n|3n,1n} 
21119       fMixedHarmonicsNestedLoops->Fill(25.5,cos(n*(3.*phi1+2.*phi2-3.*phi3-2.*phi4)),1.); // <4>_{3n,2n|3n,2n} 
21120       fMixedHarmonicsNestedLoops->Fill(26.5,cos(n*(4.*phi1+1.*phi2-4.*phi3-1.*phi4)),1.); // <4>_{4n,1n|4n,1n} 
21121       fMixedHarmonicsNestedLoops->Fill(27.5,cos(n*(4.*phi1+2.*phi2-4.*phi3-2.*phi4)),1.); // <4>_{4n,2n|4n,2n} 
21122       fMixedHarmonicsNestedLoops->Fill(28.5,cos(n*(4.*phi1+3.*phi2-4.*phi3-3.*phi4)),1.); // <4>_{4n,3n|4n,3n} 
21123       fMixedHarmonicsNestedLoops->Fill(29.5,cos(n*(5.*phi1+1.*phi2-5.*phi3-1.*phi4)),1.); // <4>_{5n,1n|5n,1n} 
21124       fMixedHarmonicsNestedLoops->Fill(30.5,cos(n*(5.*phi1+2.*phi2-5.*phi3-2.*phi4)),1.); // <4>_{5n,2n|5n,2n} 
21125       fMixedHarmonicsNestedLoops->Fill(31.5,cos(n*(5.*phi1+3.*phi2-5.*phi3-3.*phi4)),1.); // <4>_{5n,3n|5n,3n} 
21126       fMixedHarmonicsNestedLoops->Fill(32.5,cos(n*(5.*phi1+4.*phi2-5.*phi3-4.*phi4)),1.); // <4>_{5n,4n|5n,4n} 
21127       fMixedHarmonicsNestedLoops->Fill(33.5,cos(n*(6.*phi1+1.*phi2-6.*phi3-1.*phi4)),1.); // <4>_{6n,1n|6n,1n} 
21128       fMixedHarmonicsNestedLoops->Fill(34.5,cos(n*(6.*phi1+2.*phi2-6.*phi3-2.*phi4)),1.); // <4>_{6n,2n|6n,2n} 
21129       fMixedHarmonicsNestedLoops->Fill(35.5,cos(n*(6.*phi1+3.*phi2-6.*phi3-3.*phi4)),1.); // <4>_{6n,3n|6n,3n} 
21130       fMixedHarmonicsNestedLoops->Fill(36.5,cos(n*(6.*phi1+4.*phi2-6.*phi3-4.*phi4)),1.); // <4>_{6n,4n|6n,4n} 
21131       fMixedHarmonicsNestedLoops->Fill(37.5,cos(n*(6.*phi1+5.*phi2-6.*phi3-5.*phi4)),1.); // <4>_{6n,5n|6n,5n} 
21132       fMixedHarmonicsNestedLoops->Fill(39.5,cos(n*(3.*phi1-1.*phi2-1.*phi3-1.*phi4)),1.); // <4>_{3n|1n,1n,1n} 
21133       fMixedHarmonicsNestedLoops->Fill(40.5,cos(n*(6.*phi1-2.*phi2-2.*phi3-2.*phi4)),1.); // <4>_{6n|2n,2n,2n} 
21134       fMixedHarmonicsNestedLoops->Fill(42.5,cos(n*(3.*phi1+1.*phi2-2.*phi3-2.*phi4)),1.); // <4>_{3n,1n|2n,2n} 
21135       fMixedHarmonicsNestedLoops->Fill(43.5,cos(n*(4.*phi1-2.*phi2-1.*phi3-1.*phi4)),1.); // <4>_{4n|2n,1n,1n} 
21136       fMixedHarmonicsNestedLoops->Fill(44.5,cos(n*(4.*phi1+2.*phi2-3.*phi3-3.*phi4)),1.); // <4>_{4n,2n|3n,3n} 
21137       fMixedHarmonicsNestedLoops->Fill(45.5,cos(n*(5.*phi1-2.*phi2-2.*phi3-1.*phi4)),1.); // <4>_{5n|2n,2n,1n} 
21138       fMixedHarmonicsNestedLoops->Fill(46.5,cos(n*(5.*phi1-3.*phi2-1.*phi3-1.*phi4)),1.); // <4>_{5n|3n,1n,1n} 
21139       fMixedHarmonicsNestedLoops->Fill(47.5,cos(n*(5.*phi1+1.*phi2-3.*phi3-3.*phi4)),1.); // <4>_{5n,1n|3n,3n} 
21140       fMixedHarmonicsNestedLoops->Fill(48.5,cos(n*(5.*phi1+3.*phi2-4.*phi3-4.*phi4)),1.); // <4>_{5n,3n|4n,4n} 
21141       fMixedHarmonicsNestedLoops->Fill(49.5,cos(n*(6.*phi1-4.*phi2-1.*phi3-1.*phi4)),1.); // <4>_{6n|4n,1n,1n} 
21142       fMixedHarmonicsNestedLoops->Fill(50.5,cos(n*(6.*phi1+2.*phi2-4.*phi3-4.*phi4)),1.); // <4>_{6n,2n|4n,4n} 
21143       fMixedHarmonicsNestedLoops->Fill(51.5,cos(n*(6.*phi1+4.*phi2-5.*phi3-5.*phi4)),1.); // <4>_{6n,4n|5n,5n} 
21144       fMixedHarmonicsNestedLoops->Fill(53.5,cos(n*(4.*phi1+1.*phi2-3.*phi3-2.*phi4)),1.); // <4>_{4n,1n|3n,2n} 
21145       fMixedHarmonicsNestedLoops->Fill(54.5,cos(n*(5.*phi1+1.*phi2-4.*phi3-2.*phi4)),1.); // <4>_{5n,1n|4n,2n} 
21146       fMixedHarmonicsNestedLoops->Fill(55.5,cos(n*(5.*phi1+2.*phi2-4.*phi3-3.*phi4)),1.); // <4>_{5n,2n|4n,3n} 
21147       fMixedHarmonicsNestedLoops->Fill(56.5,cos(n*(6.*phi1+1.*phi2-4.*phi3-3.*phi4)),1.); // <4>_{6n,1n|4n,3n} 
21148       fMixedHarmonicsNestedLoops->Fill(57.5,cos(n*(6.*phi1+1.*phi2-5.*phi3-2.*phi4)),1.); // <4>_{6n,1n|5n,2n} 
21149       fMixedHarmonicsNestedLoops->Fill(58.5,cos(n*(6.*phi1-3.*phi2-2.*phi3-1.*phi4)),1.); // <4>_{6n|3n,2n,1n} 
21150       fMixedHarmonicsNestedLoops->Fill(59.5,cos(n*(6.*phi1+2.*phi2-5.*phi3-3.*phi4)),1.); // <4>_{6n,2n|5n,3n} 
21151       fMixedHarmonicsNestedLoops->Fill(60.5,cos(n*(6.*phi1+3.*phi2-5.*phi3-4.*phi4)),1.); // <4>_{6n,3n|5n,4n} 
21152      } // end of for(Int_t i4=0;i4<nPrim;i4++) 
21153     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21154    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21155   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21156  } // end of if(nPrim>=)
21157
21158  // 5-particle correlations:      
21159  if(nPrim>=5 && nPrim<=fMaxAllowedMultiplicity)
21160  {
21161   for(Int_t i1=0;i1<nPrim;i1++)
21162   {
21163    aftsTrack=anEvent->GetTrack(i1);
21164    if(!(aftsTrack->InRPSelection())) continue;  
21165    phi1=aftsTrack->Phi();
21166    for(Int_t i2=0;i2<nPrim;i2++)
21167    {
21168     if(i2==i1)continue;
21169     aftsTrack=anEvent->GetTrack(i2);
21170     if(!(aftsTrack->InRPSelection())) continue;
21171     phi2=aftsTrack->Phi();
21172     for(Int_t i3=0;i3<nPrim;i3++)
21173     {
21174      if(i3==i1||i3==i2)continue;
21175      aftsTrack=anEvent->GetTrack(i3);
21176      if(!(aftsTrack->InRPSelection())) continue;
21177      phi3=aftsTrack->Phi();
21178      for(Int_t i4=0;i4<nPrim;i4++)
21179      {
21180       if(i4==i1||i4==i2||i4==i3)continue;
21181       aftsTrack=anEvent->GetTrack(i4);
21182       if(!(aftsTrack->InRPSelection())) continue;
21183       phi4=aftsTrack->Phi();
21184       for(Int_t i5=0;i5<nPrim;i5++)
21185       {
21186        if(i5==i1||i5==i2||i5==i3||i5==i4)continue;
21187        aftsTrack=anEvent->GetTrack(i5);
21188        if(!(aftsTrack->InRPSelection())) continue;
21189        phi5=aftsTrack->Phi();
21190        if(nPrim==5) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<" "<<i5<<"\r"<<flush;
21191        // fill the profile with 5-p correlations:   
21192        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))>
21193        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))>
21194        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))>
21195        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))>
21196        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))>
21197        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))>
21198        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))>
21199        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))>
21200        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))>
21201        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))>
21202        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))>
21203        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))>
21204        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))>
21205        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))>
21206        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))>
21207        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))>
21208        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))>
21209        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))>
21210        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))>
21211        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))>
21212        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))>
21213        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))>
21214        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))>
21215        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))>
21216        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))>
21217        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))>
21218        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))>
21219        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))>
21220        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))>
21221        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))>
21222        //fMixedHarmonicsNestedLoops->Fill(91.5,-44.,1.); // empty
21223        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))>
21224        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))>
21225        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))>
21226        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))>
21227        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))>
21228        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))>
21229        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))>
21230        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))>
21231        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))>
21232        //fMixedHarmonicsNestedLoops->Fill(101.5,-44.,1.); // empty
21233        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))>
21234        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))>
21235        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))>
21236        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))>
21237        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))>
21238        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))>
21239        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))>
21240        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))>
21241        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))>
21242        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))>
21243        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))>
21244        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))>
21245        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))>
21246        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))>
21247        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))>
21248        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))>
21249        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))>
21250        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))>
21251        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))>
21252        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))>
21253        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))>
21254        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))>
21255        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))>
21256        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))>
21257        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))>
21258        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))>
21259        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))>
21260        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))>
21261        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))>
21262        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
21263        //fMixedHarmonicsNestedLoops->Fill(132.5,-44.,1.); // empty
21264        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))>
21265        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))>
21266        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))>
21267        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))>
21268        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))>
21269        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))>
21270        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))>
21271        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))>
21272        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))>
21273        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))>
21274        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))>
21275        //fMixedHarmonicsNestedLoops->Fill(144.5,-44.,1.); // empty
21276        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))>
21277        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))>
21278        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))>
21279       } // end of for(Int_t i5=0;i5<nPrim;i5++)
21280      } // end of for(Int_t i4=0;i4<nPrim;i4++)  
21281     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21282    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21283   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21284  } // end of if(nPrim>=5)
21285
21286  // QW44
21287
21288 } // end of void AliFlowAnalysisWithQCumulants::EvaluateMixedHarmonicsWithNestedLoops(AliFlowEventSimple * const anEvent)
21289
21290 //================================================================================================================
21291
21292 void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowCorrelations()
21293 {
21294  // Cross-check results for multiparticle correlations needed for int. flow: results from Q-vectors vs results from nested loops.
21295
21296  cout<<endl;
21297  cout<<endl;
21298  cout<<"   *****************************************"<<endl;
21299  cout<<"   **** cross-checking the correlations ****"<<endl;
21300  cout<<"   ****       for integrated flow       ****"<<endl;
21301  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
21302  {
21303   cout<<"   ****   (particle weights not used)   ****"<<endl;
21304  } else
21305    {
21306     cout<<"   ****     (particle weights used)     ****"<<endl;
21307    } 
21308  cout<<"   *****************************************"<<endl;
21309  cout<<endl;
21310  cout<<endl;
21311
21312  Int_t ciMax = 64; // to be improved (removed eventually when I calculate 6th and 8th order with particle weights)
21313  
21314  if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights)
21315  {
21316   ciMax = 11;
21317  }
21318
21319  for(Int_t ci=1;ci<=ciMax;ci++)
21320  {
21321   if(strcmp((fIntFlowCorrelationsAllPro->GetXaxis())->GetBinLabel(ci), "") == 0) continue; // to be improved (access finalized histogram here)
21322   cout<<(fIntFlowCorrelationsAllPro->GetXaxis())->GetBinLabel(ci)<<":"<<endl; // to be improved (access finalized histogram here)
21323   cout<<"from Q-vectors    = "<<fIntFlowCorrelationsAllPro->GetBinContent(ci)<<endl; // to be improved (access finalized histogram here)
21324   cout<<"from nested loops = "<<fIntFlowDirectCorrelations->GetBinContent(ci)<<endl;
21325   cout<<endl;
21326  }
21327
21328  if(!fCalculateMixedHarmonics){return;}
21329
21330  cout<<endl;
21331  cout<<endl;
21332  cout<<"   *****************************************"<<endl;
21333  cout<<"   **** cross-checking the correlations ****"<<endl;
21334  cout<<"   ****       for mixed harmonics       ****"<<endl;
21335  cout<<"   *****************************************"<<endl;
21336  cout<<endl;
21337  cout<<endl;
21338
21339  // 2-p:
21340  for(Int_t ci=1;ci<=6;ci++)
21341  {
21342   cout<<(f2pCorrelations->GetXaxis())->GetBinLabel(ci)<<":"<<endl;
21343   cout<<"from Q-vectors    = "<<f2pCorrelations->GetBinContent(ci)<<endl; 
21344   cout<<"from nested loops = "<<fMixedHarmonicsNestedLoops->GetBinContent(ci)<<endl;
21345   cout<<endl;
21346  } // end of for(Int_t ci=1;ci<=6;ci++)
21347
21348  // 3-p:
21349  for(Int_t ci=1;ci<=10;ci++)
21350  {
21351   if(4==ci){continue;} // skipping the empty bins
21352   cout<<(f3pCorrelations->GetXaxis())->GetBinLabel(ci)<<":"<<endl;
21353   cout<<"from Q-vectors    = "<<f3pCorrelations->GetBinContent(ci)<<endl; 
21354   cout<<"from nested loops = "<<fMixedHarmonicsNestedLoops->GetBinContent(ci+6)<<endl;
21355   cout<<endl;
21356  } // end of for(Int_t ci=1;ci<=10;ci++)
21357
21358  // 4-p:
21359  for(Int_t ci=1;ci<=45;ci++)
21360  {
21361   if(7==ci||23==ci||26==ci||37==ci){continue;} // skipping the empty bins
21362   cout<<(f4pCorrelations->GetXaxis())->GetBinLabel(ci)<<":"<<endl;
21363   cout<<"from Q-vectors    = "<<f4pCorrelations->GetBinContent(ci)<<endl; 
21364   cout<<"from nested loops = "<<fMixedHarmonicsNestedLoops->GetBinContent(ci+6+10)<<endl;
21365   //if(TMath::Abs(f4pCorrelations->GetBinContent(ci)-fMixedHarmonicsNestedLoops->GetBinContent(ci+6+10))
21366   //   > 1.e-10){exit(0);}
21367   cout<<endl;
21368  } // end of for(Int_t ci=1;ci<=45;ci++)
21369
21370  for(Int_t ci=1;ci<=87;ci++)
21371  {
21372   if(31==ci||41==ci||72==ci||84==ci){continue;} // skipping the empty bins
21373   cout<<(f5pCorrelations->GetXaxis())->GetBinLabel(ci)<<":"<<endl;
21374   cout<<"from Q-vectors    = "<<f5pCorrelations->GetBinContent(ci)<<endl; 
21375   cout<<"from nested loops = "<<fMixedHarmonicsNestedLoops->GetBinContent(ci+6+10+45)<<endl;
21376   if(TMath::Abs(f5pCorrelations->GetBinContent(ci)-fMixedHarmonicsNestedLoops->GetBinContent(ci+6+10+45))
21377      > 1.e-10){exit(0);}
21378   cout<<endl;
21379  } // end of for(Int_t ci=1;ci<=87;ci++)
21380
21381  return;
21382
21383 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowCorrelations()
21384
21385 //=======================================================================================================================
21386
21387 void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowCorrectionTermsForNUA()
21388 {
21389  // Cross-check results for corrections terms for non-uniform acceptance needed for int. flow: results from Q-vectors vs results from nested loops.
21390
21391  cout<<endl;
21392  cout<<endl;
21393  cout<<"   *********************************************"<<endl;
21394  cout<<"   **** cross-checking the correction terms ****"<<endl;
21395  cout<<"   **** for non-uniform acceptance relevant ****"<<endl;
21396  cout<<"   ****         for integrated flow         ****"<<endl;
21397  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
21398  {
21399   cout<<"   ****     (particle weights not used)     ****"<<endl;
21400  } else
21401    {
21402     cout<<"   ****       (particle weights used)       ****"<<endl;
21403    } 
21404  cout<<"   *********************************************"<<endl;
21405  cout<<endl;
21406  cout<<endl;
21407
21408  for(Int_t ci=1;ci<=4;ci++) // correction term index (to be improved - hardwired 4)
21409  {
21410   for(Int_t sc=0;sc<2;sc++) // sin or cos term
21411   {
21412    if(strcmp((fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->GetBinLabel(ci), "") == 0) continue; // to be improved (access finalized histogram here)
21413    cout<<(fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->GetBinLabel(ci)<<":"<<endl; // to be improved (access finalized histogram here)
21414    cout<<"from Q-vectors    = "<<fIntFlowCorrectionTermsForNUAPro[sc]->GetBinContent(ci)<<endl; // to be improved (access finalized histogram here)
21415    cout<<"from nested loops = "<<fIntFlowDirectCorrectionTermsForNUA[sc]->GetBinContent(ci)<<endl;
21416    cout<<endl;
21417   } // end of for(Int_t sc=0;sc<2;sc++) // sin or cos term
21418  } // end of for(Int_t ci=1;ci<=10;ci++) // correction term index
21419   
21420 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowCorrectionTermsForNUA() 
21421
21422 //=======================================================================================================================
21423
21424 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrelationsWithNestedLoopsUsingParticleWeights(AliFlowEventSimple * const anEvent)
21425 {
21426  // Evaluate with nested loops multiparticle correlations for integrated flow (using the particle weights). 
21427
21428  // Results are stored in profile fIntFlowDirectCorrelations. 
21429  // Remark 1: When particle weights are used the binning of fIntFlowDirectCorrelations is organized as follows:
21430  //
21431  //  1st bin: <2>_{1n|1n} = two1n1nW1W1 = <w1 w2 cos(n*(phi1-phi2))>
21432  //  2nd bin: <2>_{2n|2n} = two2n2nW2W2 = <w1^2 w2^2 cos(2n*(phi1-phi2))>
21433  //  3rd bin: <2>_{3n|3n} = two3n3nW3W3 = <w1^3 w2^3 cos(3n*(phi1-phi2))> 
21434  //  4th bin: <2>_{4n|4n} = two4n4nW4W4 = <w1^4 w2^4 cos(4n*(phi1-phi2))>
21435  //  5th bin:           ----  EMPTY ----
21436  //  6th bin: <3>_{2n|1n,1n} = three2n1n1nW2W1W1 = <w1^2 w2 w3 cos(n*(2phi1-phi2-phi3))>
21437  //  7th bin: <3>_{3n|2n,1n} = ...
21438  //  8th bin: <3>_{4n|2n,2n} = ...
21439  //  9th bin: <3>_{4n|3n,1n} = ...
21440  // 10th bin:           ----  EMPTY ----
21441  // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1nW1W1W1W1 = <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))>
21442  // 12th bin: <4>_{2n,1n|2n,1n} = ...
21443  // 13th bin: <4>_{2n,2n|2n,2n} = ...
21444  // 14th bin: <4>_{3n|1n,1n,1n} = ... 
21445  // 15th bin: <4>_{3n,1n|3n,1n} = ...
21446  // 16th bin: <4>_{3n,1n|2n,2n} = ...
21447  // 17th bin: <4>_{4n|2n,1n,1n} = ... 
21448  // 18th bin:           ----  EMPTY ----
21449  // 19th bin: <5>_{2n|1n,1n,1n,1n} = ...
21450  // 20th bin: <5>_{2n,2n|2n,1n,1n} = ...
21451  // 21st bin: <5>_{3n,1n|2n,1n,1n} = ...
21452  // 22nd bin: <5>_{4n|1n,1n,1n,1n} = ...
21453  // 23rd bin:           ----  EMPTY ----
21454  // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = ...
21455  // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = ...
21456  // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = ...
21457  // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = ...
21458  // 28th bin:           ----  EMPTY ----
21459  // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = ...
21460  // 30th bin:           ----  EMPTY ----
21461  // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = ...
21462  
21463  // Remark 2: When particle weights are used there are some extra correlations. They are stored in 
21464  // fIntFlowExtraDirectCorrelations binning of which is organized as follows:
21465  
21466  // 1st bin: two1n1nW3W1 = <w1^3 w2 cos(n*(phi1-phi2))>
21467  // 2nd bin: two1n1nW1W1W2 = <w1 w2 w3^2 cos(n*(phi1-phi2))>  
21468  // ...
21469  
21470  Int_t nPrim = anEvent->NumberOfTracks(); 
21471  AliFlowTrackSimple *aftsTrack = NULL;
21472  //Double_t phi1=0., phi2=0., phi3=0., phi4=0., phi5=0., phi6=0., phi7=0., phi8=0.;
21473  //Double_t wPhi1=1., wPhi2=1., wPhi3=1., wPhi4=1., wPhi5=1., wPhi6=1., wPhi7=1., wPhi8=1.;
21474  Double_t phi1=0., phi2=0., phi3=0., phi4=0.;
21475  Double_t wPhi1=1., wPhi2=1., wPhi3=1., wPhi4=1.;
21476  Int_t n = fHarmonic; 
21477  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // to be improved (is this casting safe in general?)
21478  Double_t dMult = (*fSpk)(0,0);
21479  cout<<endl;
21480  cout<<"Multiparticle correlations: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
21481  if(dMult<2)
21482  {
21483   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
21484  } else if (dMult>fMaxAllowedMultiplicity)
21485    {
21486     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
21487    } else 
21488      { 
21489       cout<<"... evaluating nested loops (using particle weights) ..."<<endl;
21490      } 
21491       
21492  // 2-particle correlations:       
21493  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
21494  {
21495   // 2 nested loops multiparticle correlations using particle weights:       
21496   for(Int_t i1=0;i1<nPrim;i1++)
21497   {
21498    aftsTrack=anEvent->GetTrack(i1);
21499    if(!(aftsTrack->InRPSelection())) continue;
21500    phi1=aftsTrack->Phi();
21501    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
21502    for(Int_t i2=0;i2<nPrim;i2++)
21503    {
21504     if(i2==i1)continue;
21505     aftsTrack=anEvent->GetTrack(i2);
21506     if(!(aftsTrack->InRPSelection())) continue;
21507     phi2=aftsTrack->Phi();
21508     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));   
21509     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
21510     // 2-p correlations using particle weights:
21511     if(fUsePhiWeights) fIntFlowDirectCorrelations->Fill(0.5,cos(n*(phi1-phi2)),wPhi1*wPhi2);                  // <w1   w2   cos( n*(phi1-phi2))>
21512     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))>
21513     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))>
21514     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))> 
21515     // extra correlations: 
21516     // 2-p extra correlations (do not appear if particle weights are not used):
21517     if(fUsePhiWeights) fIntFlowExtraDirectCorrelations->Fill(0.5,cos(n*(phi1-phi2)),pow(wPhi1,3)*wPhi2); // <w1^3 w2 cos(n*(phi1-phi2))>
21518     // ...
21519    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21520   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21521  } // end of if(nPrim>=2)
21522
21523  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
21524  { 
21525   // 3 nested loops multiparticle correlations using particle weights:       
21526   for(Int_t i1=0;i1<nPrim;i1++)
21527   {
21528    aftsTrack=anEvent->GetTrack(i1);
21529    if(!(aftsTrack->InRPSelection())) continue;
21530    phi1=aftsTrack->Phi();
21531    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
21532    for(Int_t i2=0;i2<nPrim;i2++)
21533    {
21534     if(i2==i1)continue;
21535     aftsTrack=anEvent->GetTrack(i2);
21536     if(!(aftsTrack->InRPSelection())) continue;
21537     phi2=aftsTrack->Phi();
21538     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
21539     for(Int_t i3=0;i3<nPrim;i3++)
21540     {
21541      if(i3==i1||i3==i2)continue;
21542      aftsTrack=anEvent->GetTrack(i3);
21543      if(!(aftsTrack->InRPSelection())) continue;
21544      phi3=aftsTrack->Phi();
21545      if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
21546      if(nPrim==3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush;
21547      // 3-p correlations using particle weights:
21548      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))>
21549      // ...
21550      // extra correlations: 
21551      // 2-p extra correlations (do not appear if particle weights are not used):
21552       if(fUsePhiWeights) fIntFlowExtraDirectCorrelations->Fill(1.5,cos(n*(phi1-phi2)),wPhi1*wPhi2*pow(wPhi3,2)); // <w1 w2 w3^2 cos(n*(phi1-phi2))>
21553      // ...
21554      // 3-p extra correlations (do not appear if particle weights are not used):
21555      // ...
21556     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21557    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21558   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21559  } // end of if(nPrim>=3)
21560  
21561  if(nPrim>=4 && nPrim<=fMaxAllowedMultiplicity)
21562  {
21563   // 4 nested loops multiparticle correlations using particle weights:       
21564   for(Int_t i1=0;i1<nPrim;i1++)
21565   {
21566    aftsTrack=anEvent->GetTrack(i1);
21567    if(!(aftsTrack->InRPSelection())) continue;
21568    phi1=aftsTrack->Phi();
21569    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
21570    for(Int_t i2=0;i2<nPrim;i2++)
21571    {
21572     if(i2==i1)continue;
21573     aftsTrack=anEvent->GetTrack(i2);
21574     if(!(aftsTrack->InRPSelection())) continue;
21575     phi2=aftsTrack->Phi();
21576     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
21577     for(Int_t i3=0;i3<nPrim;i3++)
21578     {
21579      if(i3==i1||i3==i2)continue;
21580      aftsTrack=anEvent->GetTrack(i3);
21581      if(!(aftsTrack->InRPSelection())) continue;
21582      phi3=aftsTrack->Phi();
21583      if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
21584      for(Int_t i4=0;i4<nPrim;i4++)
21585      {
21586       if(i4==i1||i4==i2||i4==i3)continue;
21587       aftsTrack=anEvent->GetTrack(i4);
21588       if(!(aftsTrack->InRPSelection())) continue;
21589       phi4=aftsTrack->Phi();
21590       if(fUsePhiWeights && fPhiWeights) wPhi4 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi4*fnBinsPhi/TMath::TwoPi())));
21591       if(nPrim>=4) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<"\r"<<flush; // to be improved (replace eventually this if statement with if(nPrim==4))
21592       // 4-p correlations using particle weights:
21593       if(fUsePhiWeights) fIntFlowDirectCorrelations->Fill(10.5,cos(n*phi1+n*phi2-n*phi3-n*phi4),wPhi1*wPhi2*wPhi3*wPhi4); 
21594       // extra correlations: 
21595       // 2-p extra correlations (do not appear if particle weights are not used):
21596       // ...
21597       // 3-p extra correlations (do not appear if particle weights are not used):
21598       // ...
21599       // 4-p extra correlations (do not appear if particle weights are not used):
21600       // ...
21601      } // end of for(Int_t i4=0;i4<nPrim;i4++) 
21602     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21603    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21604   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21605  } // end of if(nPrim>=4)
21606
21607  cout<<endl; 
21608
21609 } // end of void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrelationsWithNestedLoopsUsingParticleWeights(AliFlowEventSimple* anEvent)
21610
21611 //=======================================================================================================================
21612
21613 void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowExtraCorrelations()
21614 {
21615  // Cross-check results for extra multiparticle correlations needed for int. flow 
21616  // which appear only when particle weights are used: results from Q-vectors vs results from nested loops.
21617
21618  cout<<endl;
21619  cout<<endl;
21620  cout<<"   ***********************************************"<<endl;
21621  cout<<"   **** cross-checking the extra correlations ****"<<endl;
21622  cout<<"   ****          for integrated flow          ****"<<endl;
21623  cout<<"   ***********************************************"<<endl;
21624  cout<<endl;
21625  cout<<endl;
21626  
21627  for(Int_t eci=1;eci<=2;eci++) // to be improved (increased eciMax eventually when I calculate 6th and 8th)
21628  {
21629   if(strcmp((fIntFlowExtraCorrelationsPro->GetXaxis())->GetBinLabel(eci), "") == 0) continue;
21630   cout<<(fIntFlowExtraCorrelationsPro->GetXaxis())->GetBinLabel(eci)<<":"<<endl;
21631   cout<<"from Q-vectors    = "<<fIntFlowExtraCorrelationsPro->GetBinContent(eci)<<endl;
21632   cout<<"from nested loops = "<<fIntFlowExtraDirectCorrelations->GetBinContent(eci)<<endl;
21633   cout<<endl;
21634  }
21635
21636 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckIntFlowExtraCorrelations()
21637
21638 //=======================================================================================================================
21639
21640 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrectionsForNUAWithNestedLoops(AliFlowEventSimple * const anEvent)
21641 {
21642  // Evaluate with nested loops correction terms for non-uniform acceptance relevant for NONAME integrated flow (to be improved (name)).
21643  //
21644  // Remark: Both sin and cos correction terms are calculated in this method. Sin terms are stored in fIntFlowDirectCorrectionTermsForNUA[0],
21645  // and cos terms in fIntFlowDirectCorrectionTermsForNUA[1]. Binning of fIntFlowDirectCorrectionTermsForNUA[sc] is organized as follows 
21646  // (sc stands for either sin or cos):
21647  
21648  //  1st bin: <<sc(n*(phi1))>> 
21649  //  2nd bin: <<sc(n*(phi1+phi2))>> 
21650  //  3rd bin: <<sc(n*(phi1-phi2-phi3))>>
21651  //  4th bin: <<sc(n*(2phi1-phi2))>>
21652  
21653  Int_t nPrim = anEvent->NumberOfTracks(); 
21654  AliFlowTrackSimple *aftsTrack = NULL;
21655  Double_t phi1=0., phi2=0., phi3=0.;
21656  Int_t n = fHarmonic; 
21657  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // to be improved (is this casting safe in general?)
21658  Double_t dMult = (*fSpk)(0,0);
21659  cout<<endl;
21660  cout<<"Correction terms for non-uniform acceptance: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
21661  if(dMult<1)
21662  {
21663   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
21664  } else if (dMult>fMaxAllowedMultiplicity)
21665    {
21666     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
21667    } else 
21668      { 
21669       cout<<"... evaluating nested loops (without using particle weights)..."<<endl;
21670      }
21671  
21672  if(nPrim>=1 && nPrim<=fMaxAllowedMultiplicity)
21673  {
21674   // 1-particle correction terms for non-uniform acceptance:       
21675   for(Int_t i1=0;i1<nPrim;i1++)
21676   {
21677    aftsTrack=anEvent->GetTrack(i1);
21678    if(!(aftsTrack->InRPSelection())) continue;
21679    phi1=aftsTrack->Phi();
21680    if(nPrim==1) cout<<i1<<"\r"<<flush;
21681    // sin terms:
21682    fIntFlowDirectCorrectionTermsForNUA[0]->Fill(0.5,sin(n*phi1),1.); // <sin(n*phi1)>  
21683    // cos terms:
21684    fIntFlowDirectCorrectionTermsForNUA[1]->Fill(0.5,cos(n*phi1),1.); // <cos(n*phi1)>
21685   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21686  } // end of if(nPrim>=1) 
21687   
21688  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
21689  {
21690   // 2-particle correction terms for non-uniform acceptance:       
21691   for(Int_t i1=0;i1<nPrim;i1++)
21692   {
21693    aftsTrack=anEvent->GetTrack(i1);
21694    if(!(aftsTrack->InRPSelection())) continue;
21695    phi1=aftsTrack->Phi();  
21696    for(Int_t i2=0;i2<nPrim;i2++)
21697    {
21698     if(i2==i1)continue;
21699     aftsTrack=anEvent->GetTrack(i2);
21700     if(!(aftsTrack->InRPSelection())) continue;
21701     phi2=aftsTrack->Phi();
21702     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
21703     // sin terms:
21704     fIntFlowDirectCorrectionTermsForNUA[0]->Fill(1.5,sin(n*(phi1+phi2)),1.); // <<sin(n*(phi1+phi2))>>
21705     fIntFlowDirectCorrectionTermsForNUA[0]->Fill(3.5,sin(n*(2*phi1-phi2)),1.); // <<sin(n*(2*phi1-phi2))>>
21706     // cos terms:
21707     fIntFlowDirectCorrectionTermsForNUA[1]->Fill(1.5,cos(n*(phi1+phi2)),1.); // <<cos(n*(phi1+phi2))>>
21708     fIntFlowDirectCorrectionTermsForNUA[1]->Fill(3.5,cos(n*(2*phi1-phi2)),1.); // <<cos(n*(2*phi1-phi2))>>
21709    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21710   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21711  } // end of if(nPrim>=2)
21712
21713  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
21714  {
21715   // 3-particle correction terms for non-uniform acceptance:       
21716   for(Int_t i1=0;i1<nPrim;i1++)
21717   {
21718    aftsTrack=anEvent->GetTrack(i1);
21719    if(!(aftsTrack->InRPSelection())) continue;
21720    phi1=aftsTrack->Phi();
21721    for(Int_t i2=0;i2<nPrim;i2++)
21722    {
21723     if(i2==i1)continue;
21724     aftsTrack=anEvent->GetTrack(i2);
21725     if(!(aftsTrack->InRPSelection())) continue;
21726     phi2=aftsTrack->Phi();
21727     for(Int_t i3=0;i3<nPrim;i3++)
21728     {
21729      if(i3==i1||i3==i2)continue;
21730      aftsTrack=anEvent->GetTrack(i3);
21731      if(!(aftsTrack->InRPSelection())) continue;
21732      phi3=aftsTrack->Phi();
21733      if(nPrim>=3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush; // to be improved (eventually I will change this if statement)
21734      // sin terms:
21735      fIntFlowDirectCorrectionTermsForNUA[0]->Fill(2.5,sin(n*(phi1-phi2-phi3)),1.); // <<sin(n*(phi1-phi2-phi3))>>
21736      // cos terms:
21737      fIntFlowDirectCorrectionTermsForNUA[1]->Fill(2.5,cos(n*(phi1-phi2-phi3)),1.); // <<cos(n*(phi1-phi2-phi3))>>
21738     } // end of for(Int_t i3=0;i3<nPrim;i3++)
21739    } // end of for(Int_t i2=0;i2<nPrim;i2++)
21740   } // end of for(Int_t i1=0;i1<nPrim;i1++)
21741  } // end of if(nPrim>=3)
21742
21743  cout<<endl;
21744 }
21745
21746 //=======================================================================================================================
21747
21748 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrelationsWithNestedLoops(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
21749 {
21750  // Evaluate reduced correlations with nested loops without using the particle weights.
21751  
21752  // Remark 1: Reduced correlations are evaluated in pt bin number fCrossCheckInPtBinNo and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
21753  // Remark 2: Results are stored in 1 bin profiles fDiffFlowDirectCorrelations[t][pe][ci], where indices runs as follows:
21754  //           [0=RP,1=POI][0=Pt,1=Eta][0=<2'>,1=<4'>,2=<6'>,3=<8'>] 
21755  // Remark 3: <2'> = <cos(n*(psi1-phi2))>
21756  //           <4'> = <cos(n*(psi1+phi2-phi3-phi4))>
21757  // ...
21758  
21759  Int_t typeFlag = 0;
21760  Int_t ptEtaFlag = 0;
21761  if(type == "RP")
21762  {
21763   typeFlag = 0;
21764  } else if(type == "POI")
21765    {
21766     typeFlag = 1;
21767    }      
21768  if(ptOrEta == "Pt")
21769  {
21770   ptEtaFlag = 0;
21771  } else if(ptOrEta == "Eta")
21772    {
21773     ptEtaFlag = 1;
21774    } 
21775  // shortcuts:
21776  Int_t t = typeFlag;
21777  Int_t pe = ptEtaFlag;
21778       
21779  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
21780  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
21781  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
21782  
21783  Int_t nPrim = anEvent->NumberOfTracks(); 
21784  AliFlowTrackSimple *aftsTrack = NULL;
21785  
21786  Double_t psi1=0., phi2=0., phi3=0., phi4=0.;// phi5=0., phi6=0., phi7=0., phi8=0.;
21787  
21788  Int_t n = fHarmonic; 
21789   
21790  // 2'-particle correlations:
21791  for(Int_t i1=0;i1<nPrim;i1++)
21792  {
21793   aftsTrack=anEvent->GetTrack(i1);
21794   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
21795   if(typeFlag==1) // this is diff flow of POIs 
21796   {
21797    if(ptOrEta == "Pt")
21798    { 
21799     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
21800    } else if (ptOrEta == "Eta")
21801      {
21802       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
21803      }
21804   } else // this is diff flow of RPs 
21805     {
21806      if(ptOrEta == "Pt")
21807      { 
21808       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
21809      } else if (ptOrEta == "Eta")
21810        {
21811         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
21812        }
21813     }
21814        
21815   psi1=aftsTrack->Phi(); 
21816   for(Int_t i2=0;i2<nPrim;i2++)
21817   {
21818    if(i2==i1)continue;
21819    aftsTrack=anEvent->GetTrack(i2);
21820    // RP condition (!(first) particle in the correlator must be RP):
21821    if(!(aftsTrack->InRPSelection()))continue;
21822    phi2=aftsTrack->Phi();   
21823    // 2'-particle correlations: 
21824    fDiffFlowDirectCorrelations[t][pe][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(1.*n*(psi1-phi2)),1.); // <cos(n*(psi1-phi2))  
21825   }//end of for(Int_t i2=0;i2<nPrim;i2++)
21826  }//end of for(Int_t i1=0;i1<nPrim;i1++)
21827  
21828  /*
21829  
21830  // 3'-particle correlations:
21831  for(Int_t i1=0;i1<nPrim;i1++)
21832  {
21833   aftsTrack=anEvent->GetTrack(i1);
21834   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
21835   if(ptOrEta == "Pt")
21836   { 
21837    if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
21838   } else if (ptOrEta == "Eta")
21839     {
21840      if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
21841     }
21842   psi1=aftsTrack->Phi();
21843   for(Int_t i2=0;i2<nPrim;i2++)
21844   {
21845    if(i2==i1)continue;
21846    aftsTrack=anEvent->GetTrack(i2);
21847    // RP condition (!(first) particle in the correlator must be RP):
21848    if(!(aftsTrack->InRPSelection())) continue;
21849    phi2=aftsTrack->Phi();
21850    for(Int_t i3=0;i3<nPrim;i3++)
21851    {
21852     if(i3==i1||i3==i2)continue;
21853     aftsTrack=anEvent->GetTrack(i3);
21854     // RP condition (!(first) particle in the correlator must be RP):
21855     if(!(aftsTrack->InRPSelection())) continue;
21856     phi3=aftsTrack->Phi();
21857     // 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))> 
21858    }//end of for(Int_t i3=0;i3<nPrim;i3++)  
21859   }//end of for(Int_t i2=0;i2<nPrim;i2++)  
21860  }//end of for(Int_t i1=0;i1<nPrim;i1++)
21861  
21862  */
21863  
21864  // 4'-particle correlations:
21865  for(Int_t i1=0;i1<nPrim;i1++)
21866  {
21867   aftsTrack=anEvent->GetTrack(i1);
21868   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
21869   if(typeFlag==1) // this is diff flow of POIs 
21870   {
21871    if(ptOrEta == "Pt")
21872    { 
21873     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
21874    } else if (ptOrEta == "Eta")
21875      {
21876       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
21877      }
21878   } else // this is diff flow of RPs 
21879     {
21880      if(ptOrEta == "Pt")
21881      { 
21882       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
21883      } else if (ptOrEta == "Eta")
21884        {
21885         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
21886        }
21887     }
21888     
21889   psi1=aftsTrack->Phi();
21890   for(Int_t i2=0;i2<nPrim;i2++)
21891   {
21892    if(i2==i1) continue;
21893    aftsTrack=anEvent->GetTrack(i2);
21894    // RP condition (!(first) particle in the correlator must be RP): 
21895    if(!(aftsTrack->InRPSelection())) continue;
21896    phi2=aftsTrack->Phi();
21897    for(Int_t i3=0;i3<nPrim;i3++)
21898    { 
21899     if(i3==i1||i3==i2) continue;
21900     aftsTrack=anEvent->GetTrack(i3);
21901     // RP condition (!(first) particle in the correlator must be RP):
21902     if(!(aftsTrack->InRPSelection())) continue;
21903     phi3=aftsTrack->Phi();
21904     for(Int_t i4=0;i4<nPrim;i4++)
21905     {
21906      if(i4==i1||i4==i2||i4==i3) continue;
21907      aftsTrack=anEvent->GetTrack(i4);
21908      // RP condition (!(first) particle in the correlator must be RP):
21909      if(!(aftsTrack->InRPSelection())) continue;  
21910      phi4=aftsTrack->Phi();
21911      // 4'-particle correlations:
21912      fDiffFlowDirectCorrelations[t][pe][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2-phi3-phi4)),1.); // <cos(n(psi1+phi2-phi3-phi4))>     
21913     }//end of for(Int_t i4=0;i4<nPrim;i4++)
21914    }//end of for(Int_t i3=0;i3<nPrim;i3++)
21915   }//end of for(Int_t i2=0;i2<nPrim;i2++) 
21916  }//end of for(Int_t i1=0;i1<nPrim;i1++)
21917       
21918  // count # of RPs and POIs in selected pt and eta bins for cross-checkings:
21919  for(Int_t i=0;i<nPrim;i++)
21920  {
21921   aftsTrack=anEvent->GetTrack(i); 
21922   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
21923   if(typeFlag==1) // this is diff flow of POIs 
21924   {
21925    if(ptOrEta == "Pt")
21926    { 
21927     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
21928    } else if (ptOrEta == "Eta")
21929      {
21930       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
21931      }
21932   } else // this is diff flow of RPs 
21933     {
21934      if(ptOrEta == "Pt")
21935      { 
21936       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
21937      } else if (ptOrEta == "Eta")
21938        {
21939         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
21940        }
21941     }
21942   if(t==1)t++; 
21943   fNoOfParticlesInBin->Fill(t+pe+0.5);  
21944  }
21945
21946 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrelationsWithNestedLoops(AliFlowEventSimple* anEvent, TString type, TString ptOrEta)
21947
21948 //=======================================================================================================================
21949
21950 void AliFlowAnalysisWithQCumulants::EvaluateOtherDiffCorrelatorsWithNestedLoops(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
21951 {
21952  // Evaluate other differential correlators with nested loops without using the particle weights.
21953
21954  // Remark 1: Other differential correlators are evaluated in pt bin number fCrossCheckInPtBinNo 
21955  //           and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
21956  // Remark 2: Results are stored in 1 bin profiles fOtherDirectDiffCorrelators[t][pe][sc][ci], where indices runs as follows:
21957  //           [0=RP,1=POI][0=Pt,1=Eta][0=sin terms,1=cos terms][ci = correlator index] 
21958  // Remark 3: Correlator index 'ci' runs as follows:
21959  //            0: <exp(n*(psi1-3phi2+2phi3))> (Teaney-Yan correlator)
21960   
21961  Int_t typeFlag = 0;
21962  Int_t ptEtaFlag = 0;
21963  if(type == "RP")
21964  {
21965   typeFlag = 0;
21966  } else if(type == "POI")
21967    {
21968     typeFlag = 1;
21969    }      
21970  if(ptOrEta == "Pt")
21971  {
21972   ptEtaFlag = 0;
21973  } else if(ptOrEta == "Eta")
21974    {
21975     ptEtaFlag = 1;
21976    } 
21977  // shortcuts:
21978  Int_t t = typeFlag;
21979  Int_t pe = ptEtaFlag;
21980       
21981  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
21982  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
21983  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
21984  
21985  Int_t nPrim = anEvent->NumberOfTracks(); 
21986  AliFlowTrackSimple *aftsTrack = NULL;
21987  
21988  Double_t psi1=0., phi2=0., phi3=0.;
21989  
21990  Int_t n = fHarmonic; 
21991
21992  // 3-p correlators:
21993  for(Int_t i1=0;i1<nPrim;i1++)
21994  {
21995   aftsTrack=anEvent->GetTrack(i1);
21996   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
21997   if(typeFlag==1) // this is diff flow of POIs 
21998   {
21999    if(ptOrEta == "Pt")
22000    { 
22001     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22002    } else if (ptOrEta == "Eta")
22003      {
22004       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22005      }
22006   } else // this is diff flow of RPs 
22007     {
22008      if(ptOrEta == "Pt")
22009      { 
22010       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22011      } else if (ptOrEta == "Eta")
22012        {
22013         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22014        }
22015     }
22016   psi1=aftsTrack->Phi();
22017   for(Int_t i2=0;i2<nPrim;i2++)
22018   {
22019    if(i2==i1) continue;
22020    aftsTrack=anEvent->GetTrack(i2);
22021    // RP condition (!(first) particle in the correlator must be RP): 
22022    if(!(aftsTrack->InRPSelection())) continue;
22023    phi2=aftsTrack->Phi();
22024    for(Int_t i3=0;i3<nPrim;i3++)
22025    { 
22026     if(i3==i1||i3==i2) continue;
22027     aftsTrack=anEvent->GetTrack(i3);
22028     // RP condition (!(first) particle in the correlator must be RP):
22029     if(!(aftsTrack->InRPSelection())) continue;
22030     phi3=aftsTrack->Phi();
22031     // Fill 3-p correlators:
22032     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))>     
22033    }//end of for(Int_t i3=0;i3<nPrim;i3++)
22034   }//end of for(Int_t i2=0;i2<nPrim;i2++) 
22035  }//end of for(Int_t i1=0;i1<nPrim;i1++)   
22036 } // end of void AliFlowAnalysisWithQCumulants::EvaluateOtherDiffCorrelatorsWithNestedLoops(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
22037
22038 //=======================================================================================================================
22039
22040 void AliFlowAnalysisWithQCumulants::CrossCheckDiffFlowCorrelations(TString type, TString ptOrEta)
22041 {
22042  // Compare correlations needed for diff. flow calculated with nested loops and those calculated from Q-vectors
22043  
22044  Int_t typeFlag = 0;
22045  Int_t ptEtaFlag = 0;
22046  if(type == "RP")
22047  {
22048   typeFlag = 0;
22049  } else if(type == "POI")
22050    {
22051     typeFlag = 1;
22052    }      
22053  if(ptOrEta == "Pt")
22054  {
22055   ptEtaFlag = 0;
22056  } else if(ptOrEta == "Eta")
22057    {
22058     ptEtaFlag = 1;
22059    } 
22060  // shortcuts:
22061  Int_t t = typeFlag;
22062  Int_t pe = ptEtaFlag;
22063       
22064  TString rpORpoiString[2] = {"RP ","POI"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
22065  TString ptORetaString[2] = {"pt","eta"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
22066  TString reducedCorrelations[4] = {"<<cos(n(psi1-phi2))>>","<<cos(n(psi1+phi2-phi3-phi4))>>","",""}; // to be improved (access this from pro or hist)
22067  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
22068  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
22069  
22070  Int_t crossCheckInPtEtaBinNo[2] = {fCrossCheckInPtBinNo,fCrossCheckInEtaBinNo};
22071  
22072
22073  cout<<endl;
22074  cout<<"   *****************************************"<<endl;
22075  cout<<"   **** cross-checking the correlations ****"<<endl;
22076  cout<<"   ****   for differential flow ("<<rpORpoiString[t]<<")   ****"<<endl;
22077  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
22078  {
22079   cout<<"   ****   (particle weights not used)   ****"<<endl;
22080  } else
22081    {
22082     cout<<"   ****    (particle weights used)      ****"<<endl;
22083    } 
22084  cout<<"   *****************************************"<<endl; 
22085  cout<<endl;
22086  cout<<"           "<<ptORetaString[pe]<<" bin: "<<lowerPtEtaEdge[pe]<<" <= "<<ptORetaString[pe]<<" < "<<upperPtEtaEdge[pe]<<endl;
22087  cout<<endl;
22088  
22089  for(Int_t rci=0;rci<2;rci++) // to be improved (calculate 6th and 8th order)
22090  {
22091   cout<<"      "<<reducedCorrelations[rci].Data()<<":"<<endl;
22092   cout<<"      from Q-vectors    = "<<fDiffFlowCorrelationsPro[t][pe][rci]->GetBinContent(crossCheckInPtEtaBinNo[pe])<<endl;
22093   cout<<"      from nested loops = "<<fDiffFlowDirectCorrelations[t][pe][rci]->GetBinContent(1)<<endl;
22094   cout<<endl;  
22095  } // end of for(Int_t rci=0;rci<4;rci++)
22096         
22097 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckDiffFlowCorrelations(TString type, TString ptOrEta)
22098
22099 //=======================================================================================================================
22100
22101 void AliFlowAnalysisWithQCumulants::CrossCheckOtherDiffCorrelators(TString type, TString ptOrEta)
22102 {
22103  // Compare correlations needed for diff. flow calculated with nested loops and those calculated from Q-vectors
22104  
22105  Int_t typeFlag = 0;
22106  Int_t ptEtaFlag = 0;
22107  if(type == "RP")
22108  {
22109   typeFlag = 0;
22110  } else if(type == "POI")
22111    {
22112     typeFlag = 1;
22113    }      
22114  if(ptOrEta == "Pt")
22115  {
22116   ptEtaFlag = 0;
22117  } else if(ptOrEta == "Eta")
22118    {
22119     ptEtaFlag = 1;
22120    } 
22121  // shortcuts:
22122  Int_t t = typeFlag;
22123  Int_t pe = ptEtaFlag;
22124       
22125  TString rpORpoiString[2] = {"RP ","POI"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
22126  TString ptORetaString[2] = {"pt","eta"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
22127  TString otherCorrelators[1] = {"<<cos(n(psi1-3phi2+2phi3))>>"}; // to be improved (access this from pro or hist)
22128  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
22129  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
22130  
22131  Int_t crossCheckInPtEtaBinNo[2] = {fCrossCheckInPtBinNo,fCrossCheckInEtaBinNo};
22132
22133  cout<<endl;
22134  cout<<"   *****************************************"<<endl;
22135  cout<<"   ****   cross-checking the other      ****"<<endl;
22136  cout<<"   ****   diff. correlators ("<<rpORpoiString[t]<<")       ****"<<endl;
22137  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
22138  {
22139   cout<<"   ****   (particle weights not used)   ****"<<endl;
22140  } else
22141    {
22142     cout<<"   ****    (particle weights used)      ****"<<endl;
22143    } 
22144  cout<<"   *****************************************"<<endl; 
22145  cout<<endl;
22146  cout<<"           "<<ptORetaString[pe]<<" bin: "<<lowerPtEtaEdge[pe]<<" <= "<<ptORetaString[pe]<<" < "<<upperPtEtaEdge[pe]<<endl;
22147  cout<<endl;
22148  
22149  for(Int_t ci=0;ci<1;ci++) 
22150  {
22151   cout<<"      "<<otherCorrelators[ci].Data()<<":"<<endl;
22152   cout<<"      from Q-vectors    = "<<fOtherDiffCorrelators[t][pe][1][ci]->GetBinContent(crossCheckInPtEtaBinNo[pe])<<endl;
22153   cout<<"      from nested loops = "<<fOtherDirectDiffCorrelators[t][pe][1][ci]->GetBinContent(1)<<endl;
22154   cout<<endl;  
22155  } // end of for(Int_t ci=0;ci<1;ci++)
22156         
22157 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckOtherDiffCorrelators(TString type, TString ptOrEta)
22158
22159 //=======================================================================================================================
22160
22161 void AliFlowAnalysisWithQCumulants::PrintNumberOfParticlesInSelectedBin()
22162 {
22163  // Print on the screen number of RPs and POIs in selected pt and eta bin for cross checkings.
22164  
22165  cout<<endl;
22166  cout<<"Number of RPs in selected pt bin   = "<<fNoOfParticlesInBin->GetBinContent(1)<<endl;
22167  cout<<"Number of RPs in selected eta bin  = "<<fNoOfParticlesInBin->GetBinContent(2)<<endl;
22168  cout<<"Number of POIs in selected pt bin  = "<<fNoOfParticlesInBin->GetBinContent(3)<<endl;
22169  cout<<"Number of POIs in selected eta bin = "<<fNoOfParticlesInBin->GetBinContent(4)<<endl;
22170  
22171 } // end of void AliFlowAnalysisWithQCumulants::PrintNumberOfParticlesInSelectedBin()
22172
22173 //=======================================================================================================================
22174
22175 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
22176 {
22177  // Evaluate reduced correlations with nested loops without using the particle weights.
22178  
22179  // Remark 1: Reduced correlations are evaluated in pt bin number fCrossCheckInPtBinNo and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
22180  // Remark 2: Results are stored in 1 bin profiles fDiffFlowDirectCorrelations[t][pe][ci], where indices runs as follows:
22181  //           [0=RP,1=POI][0=Pt,1=Eta][0=<2'>,1=<4'>,2=<6'>,3=<8'>] 
22182  // Remark 3: <2'> = <w2 cos(n*(psi1-phi2))>
22183  //           <4'> = <w2 w3 w4 cos(n*(psi1+phi2-phi3-phi4))>
22184  // ...
22185   
22186  Int_t typeFlag = 0;
22187  Int_t ptEtaFlag = 0;
22188  if(type == "RP")
22189  {
22190   typeFlag = 0;
22191  } else if(type == "POI")
22192    {
22193     typeFlag = 1;
22194    }      
22195  if(ptOrEta == "Pt")
22196  {
22197   ptEtaFlag = 0;
22198  } else if(ptOrEta == "Eta")
22199    {
22200     ptEtaFlag = 1;
22201    } 
22202  // shortcuts:
22203  Int_t t = typeFlag;
22204  Int_t pe = ptEtaFlag;
22205       
22206  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
22207  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
22208  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
22209  
22210  Int_t nPrim = anEvent->NumberOfTracks(); 
22211  AliFlowTrackSimple *aftsTrack = NULL;
22212  
22213  Double_t psi1=0., phi2=0., phi3=0., phi4=0.;// phi5=0., phi6=0., phi7=0., phi8=0.;
22214  Double_t wPhi2=1., wPhi3=1., wPhi4=1.;// wPhi5=1., wPhi6=1., wPhi7=1., wPhi8=1.;
22215  
22216  Int_t n = fHarmonic; 
22217  
22218  // 2'-particle correlations:
22219  for(Int_t i1=0;i1<nPrim;i1++)
22220  {
22221   aftsTrack=anEvent->GetTrack(i1);
22222   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22223   if(typeFlag==1) // this is diff flow of POIs 
22224   {
22225    if(ptOrEta == "Pt")
22226    { 
22227     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22228    } else if (ptOrEta == "Eta")
22229      {
22230       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22231      }
22232   } else // this is diff flow of RPs 
22233     {
22234      if(ptOrEta == "Pt")
22235      { 
22236       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22237      } else if (ptOrEta == "Eta")
22238        {
22239         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22240        }
22241     }
22242   psi1=aftsTrack->Phi(); 
22243   for(Int_t i2=0;i2<nPrim;i2++)
22244   {
22245    if(i2==i1) continue;
22246    aftsTrack=anEvent->GetTrack(i2);
22247    // RP condition (!(first) particle in the correlator must be RP):
22248    if(!(aftsTrack->InRPSelection())) continue;
22249    phi2=aftsTrack->Phi();   
22250    if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
22251    // 2'-particle correlations: 
22252    fDiffFlowDirectCorrelations[t][pe][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(1.*n*(psi1-phi2)),wPhi2); // <w2 cos(n*(psi1-phi2))  
22253   }//end of for(Int_t i2=0;i2<nPrim;i2++)
22254  }//end of for(Int_t i1=0;i1<nPrim;i1++)
22255  
22256  // 4'-particle correlations:
22257  for(Int_t i1=0;i1<nPrim;i1++)
22258  {
22259   aftsTrack=anEvent->GetTrack(i1);
22260   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22261   if(typeFlag==1) // this is diff flow of POIs 
22262   {
22263    if(ptOrEta == "Pt")
22264    { 
22265     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22266    } else if (ptOrEta == "Eta")
22267      {
22268       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22269      }
22270   } else // this is diff flow of RPs 
22271     {
22272      if(ptOrEta == "Pt")
22273      { 
22274       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22275      } else if (ptOrEta == "Eta")
22276        {
22277         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22278        }
22279     }
22280   psi1=aftsTrack->Phi();
22281   for(Int_t i2=0;i2<nPrim;i2++)
22282   {
22283    if(i2==i1) continue;
22284    aftsTrack=anEvent->GetTrack(i2);
22285    // RP condition (!(first) particle in the correlator must be RP): 
22286    if(!(aftsTrack->InRPSelection())) continue;
22287    phi2=aftsTrack->Phi();
22288    if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
22289    for(Int_t i3=0;i3<nPrim;i3++)
22290    { 
22291     if(i3==i1||i3==i2) continue;
22292     aftsTrack=anEvent->GetTrack(i3);
22293     // RP condition (!(first) particle in the correlator must be RP):
22294     if(!(aftsTrack->InRPSelection())) continue;
22295     phi3=aftsTrack->Phi();
22296     if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
22297     for(Int_t i4=0;i4<nPrim;i4++)
22298     {
22299      if(i4==i1||i4==i2||i4==i3) continue;
22300      aftsTrack=anEvent->GetTrack(i4);
22301      // RP condition (!(first) particle in the correlator must be RP):
22302      if(!(aftsTrack->InRPSelection())) continue;  
22303      phi4=aftsTrack->Phi();
22304      if(fUsePhiWeights && fPhiWeights) wPhi4 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi4*fnBinsPhi/TMath::TwoPi())));
22305      // 4'-particle correlations <w2 w3 w4 cos(n(psi1+phi2-phi3-phi4))>:
22306      fDiffFlowDirectCorrelations[t][pe][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2-phi3-phi4)),wPhi2*wPhi3*wPhi4); 
22307     }//end of for(Int_t i4=0;i4<nPrim;i4++)
22308    }//end of for(Int_t i3=0;i3<nPrim;i3++)
22309   }//end of for(Int_t i2=0;i2<nPrim;i2++) 
22310  }//end of for(Int_t i1=0;i1<nPrim;i1++)      
22311  
22312  // count # of RPs and POIs in selected pt and eta bins for cross-checkings: (to be improved - moved to dedicated method)
22313  for(Int_t i=0;i<nPrim;i++)
22314  {
22315   aftsTrack=anEvent->GetTrack(i); 
22316   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22317   if(typeFlag==1) // this is diff flow of POIs 
22318   {
22319    if(ptOrEta == "Pt")
22320    { 
22321     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22322    } else if (ptOrEta == "Eta")
22323      {
22324       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22325      }
22326   } else // this is diff flow of RPs 
22327     {
22328      if(ptOrEta == "Pt")
22329      { 
22330       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22331      } else if (ptOrEta == "Eta")
22332        {
22333         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22334        }
22335     }
22336   if(t==1)t++; 
22337   fNoOfParticlesInBin->Fill(t+pe+0.5);  
22338  }
22339  
22340 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(AliFlowEventSimple* anEvent, TString type, TString ptOrEta)
22341
22342 //=======================================================================================================================
22343
22344 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
22345 {
22346  // Evaluate with nested loops correction terms for non-uniform acceptance (both sin and cos terms) relevant for differential flow.
22347  
22348  // Remark 1: Reduced correction terms for non-uniform acceptance are evaluated in pt bin number fCrossCheckInPtBinNo 
22349  //           and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
22350  // Remark 2: Results are stored in 1 bin profiles fDiffFlowDirectCorrections[t][pe][sc][cti], where first three indices runs as: 
22351  //           [0=RP,1=POI][0=Pt,1=Eta][0=sin terms,1=cos terms], whilst the cti (correction term index) runs as follows: 
22352  //  cti: 
22353  //    0: <<sc n(psi1)>>
22354  //    1: <<sc n(psi1+phi2)>> 
22355  //    2: <<sc n(psi1+phi2-phi3)>>
22356  //    3: <<sc n(psi1-phi2-phi3)>>
22357  //    4:
22358  //    5:
22359  //    6:
22360   
22361  Int_t typeFlag = 0;
22362  Int_t ptEtaFlag = 0;
22363  if(type == "RP")
22364  {
22365   typeFlag = 0;
22366  } else if(type == "POI")
22367    {
22368     typeFlag = 1;
22369    }      
22370  if(ptOrEta == "Pt")
22371  {
22372   ptEtaFlag = 0;
22373  } else if(ptOrEta == "Eta")
22374    {
22375     ptEtaFlag = 1;
22376    } 
22377  // shortcuts:
22378  Int_t t = typeFlag;
22379  Int_t pe = ptEtaFlag;
22380       
22381  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
22382  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
22383  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
22384  
22385  Int_t nPrim = anEvent->NumberOfTracks(); 
22386  AliFlowTrackSimple *aftsTrack = NULL;
22387  
22388  Double_t psi1=0., phi2=0., phi3=0.;// phi4=0.;// phi5=0., phi6=0., phi7=0., phi8=0.;
22389  
22390  Int_t n = fHarmonic; 
22391  
22392  // 1-particle correction terms:
22393  for(Int_t i1=0;i1<nPrim;i1++)
22394  {
22395   aftsTrack=anEvent->GetTrack(i1);
22396   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22397   if(typeFlag==1) // this is diff flow of POIs 
22398   {
22399    if(ptOrEta == "Pt")
22400    { 
22401     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22402    } else if (ptOrEta == "Eta")
22403      {
22404       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22405      }
22406   } else // this is diff flow of RPs 
22407     {
22408      if(ptOrEta == "Pt")
22409      { 
22410       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22411      } else if (ptOrEta == "Eta")
22412        {
22413         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22414        }
22415     }
22416   psi1=aftsTrack->Phi(); 
22417   // sin terms: 
22418   fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*psi1),1.); // <<sin(n*(psi1))>>  
22419   // cos terms: 
22420   fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*psi1),1.); // <<cos(n*(psi1))>>  
22421  }//end of for(Int_t i1=0;i1<nPrim;i1++)
22422    
22423  // 2-particle correction terms:
22424  for(Int_t i1=0;i1<nPrim;i1++)
22425  {
22426   aftsTrack=anEvent->GetTrack(i1);
22427    // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22428   if(typeFlag==1) // this is diff flow of POIs 
22429   {
22430    if(ptOrEta == "Pt")
22431    { 
22432     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22433    } else if (ptOrEta == "Eta")
22434      {
22435       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22436      }
22437   } else // this is diff flow of RPs 
22438     {
22439      if(ptOrEta == "Pt")
22440      { 
22441       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22442      } else if (ptOrEta == "Eta")
22443        {
22444         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22445        }
22446     }
22447   psi1=aftsTrack->Phi(); 
22448   for(Int_t i2=0;i2<nPrim;i2++)
22449   {
22450    if(i2==i1) continue;
22451    aftsTrack=anEvent->GetTrack(i2);
22452    // RP condition (!(first) particle in the correlator must be RP):
22453    if(!(aftsTrack->InRPSelection())) continue;
22454    phi2=aftsTrack->Phi();   
22455    // sin terms: 
22456    fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1+phi2)),1.); // <<sin(n*(psi1+phi2))>>  
22457    // cos terms: 
22458    fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2)),1.); // <<cos(n*(psi1+phi2))>>  
22459   }//end of for(Int_t i2=0;i2<nPrim;i2++)
22460  }//end of for(Int_t i1=0;i1<nPrim;i1++)   
22461  
22462  // 3-particle correction terms:
22463  for(Int_t i1=0;i1<nPrim;i1++)
22464  {
22465   aftsTrack=anEvent->GetTrack(i1);
22466    // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
22467   if(typeFlag==1) // this is diff flow of POIs 
22468   {
22469    if(ptOrEta == "Pt")
22470    { 
22471     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
22472    } else if (ptOrEta == "Eta")
22473      {
22474       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
22475      }
22476   } else // this is diff flow of RPs 
22477     {
22478      if(ptOrEta == "Pt")
22479      { 
22480       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
22481      } else if (ptOrEta == "Eta")
22482        {
22483         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
22484        }
22485     }
22486   psi1=aftsTrack->Phi();
22487   for(Int_t i2=0;i2<nPrim;i2++)
22488   {
22489    if(i2==i1) continue;
22490    aftsTrack=anEvent->GetTrack(i2);
22491    // RP condition (!(first) particle in the correlator must be RP):
22492    if(!(aftsTrack->InRPSelection())) continue;
22493    phi2=aftsTrack->Phi();
22494    for(Int_t i3=0;i3<nPrim;i3++)
22495    {
22496     if(i3==i1||i3==i2) continue;
22497     aftsTrack=anEvent->GetTrack(i3);
22498     // RP condition (!(first) particle in the correlator must be RP):
22499     if(!(aftsTrack->InRPSelection())) continue;
22500     phi3=aftsTrack->Phi();
22501     // sin terms: 
22502     fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][2]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1+phi2-phi3)),1.); // <<sin(n*(psi1+phi2-phi3))>>  
22503     fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][3]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1-phi2-phi3)),1.); // <<sin(n*(psi1-phi2-phi3))>>  
22504     // cos terms: 
22505     fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][2]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2-phi3)),1.); // <<cos(n*(psi1+phi2-phi3))>>  
22506     fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][3]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1-phi2-phi3)),1.); // <<cos(n*(psi1-phi2-phi3))>>  
22507    }//end of for(Int_t i3=0;i3<nPrim;i3++)  
22508   }//end of for(Int_t i2=0;i2<nPrim;i2++)  
22509  }//end of for(Int_t i1=0;i1<nPrim;i1++)
22510    
22511 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(AliFlowEventSimple* anEvent, TString type, TString ptOrEta)
22512
22513
22514 //=======================================================================================================================
22515
22516
22517 void AliFlowAnalysisWithQCumulants::CrossCheckDiffFlowCorrectionTermsForNUA(TString type, TString ptOrEta)
22518 {
22519  // Compare corrections temrs for non-uniform acceptance needed for diff. flow calculated with nested loops and those calculated from Q-vectors
22520  
22521  Int_t typeFlag = 0;
22522  Int_t ptEtaFlag = 0;
22523  if(type == "RP")
22524  {
22525   typeFlag = 0;
22526  } else if(type == "POI")
22527    {
22528     typeFlag = 1;
22529    }      
22530  if(ptOrEta == "Pt")
22531  {
22532   ptEtaFlag = 0;
22533  } else if(ptOrEta == "Eta")
22534    {
22535     ptEtaFlag = 1;
22536    } 
22537  // shortcuts:
22538  Int_t t = typeFlag;
22539  Int_t pe = ptEtaFlag;
22540       
22541  TString rpORpoiString[2] = {"RP ","POI"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
22542  TString ptORetaString[2] = {"pt","eta"}; // to be improved (name in the same way as in the other methods, eventually promote to data member) 
22543  //TString sinCosFlag[2] = {"sin","cos"}; // to be improved (eventually promote to data member)
22544  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)
22545  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)
22546  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
22547  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
22548  
22549  Int_t crossCheckInPtEtaBinNo[2] = {fCrossCheckInPtBinNo,fCrossCheckInEtaBinNo};
22550  
22551  cout<<endl;
22552  cout<<"   ******************************************"<<endl;
22553  cout<<"   ****  cross-checking the correction   ****"<<endl;
22554  cout<<"   **** terms for non-uniform acceptance ****"<<endl; 
22555  cout<<"   ****    for differential flow ("<<rpORpoiString[t]<<")   ****"<<endl;
22556  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights))
22557  {
22558   cout<<"   ****    (particle weights not used)   ****"<<endl;
22559  } else
22560    {
22561     cout<<"   ****     (particle weights used)      ****"<<endl;
22562    } 
22563  cout<<"   ******************************************"<<endl; 
22564  cout<<endl;
22565  cout<<"           "<<ptORetaString[pe]<<" bin: "<<lowerPtEtaEdge[pe]<<" <= "<<ptORetaString[pe]<<" < "<<upperPtEtaEdge[pe]<<endl;
22566  cout<<endl;
22567  
22568  for(Int_t cti=0;cti<4;cti++) // correction term index
22569  {
22570   for(Int_t sc=0;sc<2;sc++) // sin or cos terms
22571   {
22572    if(sc==0) // to be improved (this can be implemented better)
22573    { 
22574     cout<<"      "<<reducedCorrectionSinTerms[cti].Data()<<":"<<endl;
22575    } else
22576      {
22577       cout<<"      "<<reducedCorrectionCosTerms[cti].Data()<<":"<<endl;     
22578      }
22579    cout<<"      from Q-vectors    = "<<fDiffFlowCorrectionTermsForNUAPro[t][pe][sc][cti]->GetBinContent(crossCheckInPtEtaBinNo[pe])<<endl;
22580    cout<<"      from nested loops = "<<fDiffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti]->GetBinContent(1)<<endl;
22581    cout<<endl;  
22582   } 
22583  } // end of for(Int_t rci=0;rci<4;rci++)
22584
22585 } // end of void AliFlowAnalysisWithQCumulants::CrossCheckDiffFlowCorrectionTermsForNUA(TString type, TString ptOrEta)
22586
22587 //=======================================================================================================================
22588
22589 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTermsUsingParticleWeights()
22590 {
22591  // Calculate corrections using particle weights for non-uniform acceptance of the detector for no-name integrated flow (cos terms).
22592  
22593  //                                  **********************************************************************
22594  //                                  **** weighted corrections for non-uniform acceptance (cos terms): ****
22595  //                                  **********************************************************************
22596  
22597  // Remark 1: When particle weights are used the binning of fIntFlowCorrectionTermsForNUAPro[1] is organized as follows:
22598  //
22599  // 1st bin: <<w1 cos(n*(phi1))>> = cosP1nW1
22600  // 2nd bin: <<w1 w2 cos(n*(phi1+phi2))>> = cosP1nP1nW1W1
22601  // 3rd bin: <<w1 w2 w3 cos(n*(phi1-phi2-phi3))>> = cosP1nM1nM1nW1W1W1 
22602  // ...
22603
22604  // multiplicity (number of particles used to determine the reaction plane)
22605  Double_t dMult = (*fSpk)(0,0);
22606  
22607  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
22608  Double_t dReQ1n1k = (*fReQ)(0,1);
22609  Double_t dReQ2n2k = (*fReQ)(1,2);
22610  //Double_t dReQ3n3k = (*fReQ)(2,3);
22611  //Double_t dReQ4n4k = (*fReQ)(3,4);
22612  Double_t dReQ1n3k = (*fReQ)(0,3);
22613  Double_t dImQ1n1k = (*fImQ)(0,1);
22614  Double_t dImQ2n2k = (*fImQ)(1,2);
22615  //Double_t dImQ3n3k = (*fImQ)(2,3);
22616  //Double_t dImQ4n4k = (*fImQ)(3,4);
22617  //Double_t dImQ1n3k = (*fImQ)(0,3);
22618
22619  // dMs are variables introduced in order to simplify some Eqs. bellow:
22620  //..............................................................................................
22621  Double_t dM11 = (*fSpk)(1,1)-(*fSpk)(0,2); // dM11 = sum_{i,j=1,i!=j}^M w_i w_j
22622  Double_t dM111 = (*fSpk)(2,1)-3.*(*fSpk)(0,2)*(*fSpk)(0,1)
22623                 + 2.*(*fSpk)(0,3); // dM111 = sum_{i,j,k=1,i!=j!=k}^M w_i w_j w_k
22624  //..............................................................................................
22625          // 1-particle:
22626  Double_t cosP1nW1 = 0.; // <<w1 cos(n*(phi1))>>
22627    
22628  if(dMult>0 && TMath::Abs((*fSpk)(0,1))>1.e-6)
22629  {
22630   cosP1nW1 = dReQ1n1k/(*fSpk)(0,1); 
22631   
22632   // average weighted 1-particle correction (cos terms) for non-uniform acceptance for single event:
22633   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(1,cosP1nW1);
22634   
22635   // final average weighted 1-particle correction (cos terms) for non-uniform acceptance for all events:
22636   fIntFlowCorrectionTermsForNUAPro[1]->Fill(0.5,cosP1nW1,(*fSpk)(0,1));  
22637  } 
22638  
22639  // 2-particle:
22640  Double_t cosP1nP1nW1W1 = 0.; // <<w1 w2 cos(n*(phi1+phi2))>>
22641  
22642  if(dMult>1 && TMath::Abs(dM11)>1.e-6)
22643  {
22644   cosP1nP1nW1W1 = (pow(dReQ1n1k,2)-pow(dImQ1n1k,2)-dReQ2n2k)/dM11; 
22645   
22646   // average weighted 2-particle correction (cos terms) for non-uniform acceptance for single event:
22647   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(2,cosP1nP1nW1W1);
22648   
22649   // final average weighted 2-particle correction (cos terms) for non-uniform acceptance for all events:
22650   fIntFlowCorrectionTermsForNUAPro[1]->Fill(1.5,cosP1nP1nW1W1,dM11);  
22651  } 
22652  
22653  // 3-particle:
22654  Double_t cosP1nM1nM1nW1W1W1 = 0.; // <<w1 w2 w3 cos(n*(phi1-phi2-phi3))>>
22655  
22656  if(dMult>2 && TMath::Abs(dM111)>1.e-6)
22657  {
22658   cosP1nM1nM1nW1W1W1 = (dReQ1n1k*(pow(dReQ1n1k,2)+pow(dImQ1n1k,2))
22659                      - dReQ1n1k*dReQ2n2k-dImQ1n1k*dImQ2n2k
22660                      - 2.*((*fSpk)(0,2))*dReQ1n1k
22661                      + 2.*dReQ1n3k) 
22662                      / dM111; 
22663   
22664   // average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for single event:
22665   fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(3,cosP1nM1nM1nW1W1W1);
22666   
22667   // final average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for all events:
22668   fIntFlowCorrectionTermsForNUAPro[1]->Fill(2.5,cosP1nM1nM1nW1W1W1,dM111);  
22669  } 
22670  
22671 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTermsUsingParticleWeights()
22672
22673
22674 //=======================================================================================================================
22675
22676
22677 void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTermsUsingParticleWeights()
22678 {
22679  // calculate corrections using particle weights for non-uniform acceptance of the detector for no-name integrated flow (sin terms)
22680  
22681  //                                  **********************************************************************
22682  //                                  **** weighted corrections for non-uniform acceptance (sin terms): ****
22683  //                                  **********************************************************************
22684  
22685  // Remark 1: When particle weights are used the binning of fIntFlowCorrectionTermsForNUAPro[0] is organized as follows:
22686  //
22687  // 1st bin: <<w1 sin(n*(phi1))>> = sinP1nW1
22688  // 2nd bin: <<w1 w2 sin(n*(phi1+phi2))>> = sinP1nP1nW1W1
22689  // 3rd bin: <<w1 w2 w3 sin(n*(phi1-phi2-phi3))>> = sinP1nM1nM1nW1W1W1 
22690  // ...
22691
22692  // multiplicity (number of particles used to determine the reaction plane)
22693  Double_t dMult = (*fSpk)(0,0);
22694  
22695  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
22696  Double_t dReQ1n1k = (*fReQ)(0,1);
22697  Double_t dReQ2n2k = (*fReQ)(1,2);
22698  //Double_t dReQ3n3k = (*fReQ)(2,3);
22699  //Double_t dReQ4n4k = (*fReQ)(3,4);
22700  //Double_t dReQ1n3k = (*fReQ)(0,3);
22701  Double_t dImQ1n1k = (*fImQ)(0,1);
22702  Double_t dImQ2n2k = (*fImQ)(1,2);
22703  //Double_t dImQ3n3k = (*fImQ)(2,3);
22704  //Double_t dImQ4n4k = (*fImQ)(3,4);
22705  Double_t dImQ1n3k = (*fImQ)(0,3);
22706
22707  // dMs are variables introduced in order to simplify some Eqs. bellow:
22708  //..............................................................................................
22709  Double_t dM11 = (*fSpk)(1,1)-(*fSpk)(0,2); // dM11 = sum_{i,j=1,i!=j}^M w_i w_j
22710  Double_t dM111 = (*fSpk)(2,1)-3.*(*fSpk)(0,2)*(*fSpk)(0,1)
22711                 + 2.*(*fSpk)(0,3); // dM111 = sum_{i,j,k=1,i!=j!=k}^M w_i w_j w_k
22712  //..............................................................................................
22713  
22714  // 1-particle:
22715  Double_t sinP1nW1 = 0.; // <<w1 sin(n*(phi1))>>
22716  
22717  if(dMult>0 && TMath::Abs((*fSpk)(0,1))>1.e-6)
22718  {
22719   sinP1nW1 = dImQ1n1k/((*fSpk)(0,1)); 
22720      
22721   // average weighted 1-particle correction (sin terms) for non-uniform acceptance for single event:
22722   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(1,sinP1nW1);
22723   
22724   // final average weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:   
22725   fIntFlowCorrectionTermsForNUAPro[0]->Fill(0.5,sinP1nW1,(*fSpk)(0,1));  
22726  } 
22727  
22728  // 2-particle:
22729  Double_t sinP1nP1nW1W1 = 0.; // <<w1 w2 sin(n*(phi1+phi2))>>
22730  
22731  if(dMult>1 && TMath::Abs(dM11)>1.e-6)
22732  {
22733   sinP1nP1nW1W1 = (2.*dReQ1n1k*dImQ1n1k-dImQ2n2k)/dM11; 
22734      
22735   // average weighted 2-particle correction (sin terms) for non-uniform acceptance for single event:
22736   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(2,sinP1nP1nW1W1);
22737   
22738   // final average weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:      
22739   fIntFlowCorrectionTermsForNUAPro[0]->Fill(1.5,sinP1nP1nW1W1,dM11);  
22740  } 
22741  
22742  // 3-particle:
22743  Double_t sinP1nM1nM1nW1W1W1 = 0.; // <<w1 w2 w3 sin(n*(phi1-phi2-phi3))>>
22744  
22745  if(dMult>2 && TMath::Abs(dM111)>1.e-6)
22746  {
22747   sinP1nM1nM1nW1W1W1 = (-dImQ1n1k*(pow(dReQ1n1k,2)+pow(dImQ1n1k,2))
22748                      + dReQ1n1k*dImQ2n2k-dImQ1n1k*dReQ2n2k
22749                      + 2.*((*fSpk)(0,2))*dImQ1n1k
22750                      - 2.*dImQ1n3k)
22751                      / dM111; 
22752   
22753   // average weighted 3-particle correction (sin terms) for non-uniform acceptance for single event:
22754   fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(3,sinP1nM1nM1nW1W1W1);
22755   
22756   // final average weighted 3-particle correction (sin terms) for non-uniform acceptance for all events:  
22757   fIntFlowCorrectionTermsForNUAPro[0]->Fill(2.5,sinP1nM1nM1nW1W1W1,dM111);  
22758  } 
22759  
22760 } // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTermsUsingParticleWeights()
22761
22762 //=======================================================================================================================
22763
22764 void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrectionsForNUAWithNestedLoopsUsingParticleWeights(AliFlowEventSimple * const anEvent)
22765 {
22766  // Evaluate with nested loops correction terms for non-uniform acceptance for integrated flow (using the particle weights). 
22767
22768  // Results are stored in profiles fIntFlowDirectCorrectionTermsForNUA[0] (sin terms) and
22769  // fIntFlowDirectCorrectionTermsForNUA[1] (cos terms). 
22770  
22771  // Remark 1: When particle weights are used the binning of fIntFlowDirectCorrectionTermsForNUA[sc] is 
22772  // organized as follows (sc stands for either sin or cos):
22773  //
22774  // 1st bin: <<w1 sc(n*(phi1))>> = scP1nW1
22775  // 2nd bin: <<w1 w2 sc(n*(phi1+phi2))>> = scP1nP1nW1W1
22776  // 3rd bin: <<w1 w2 w3 sc(n*(phi1-phi2-phi3))>> = scP1nM1nM1nW1W1W1 
22777  // ...
22778   
22779  Int_t nPrim = anEvent->NumberOfTracks(); 
22780  AliFlowTrackSimple *aftsTrack = NULL;
22781  //Double_t phi1=0., phi2=0., phi3=0., phi4=0., phi5=0., phi6=0., phi7=0., phi8=0.;
22782  //Double_t wPhi1=1., wPhi2=1., wPhi3=1., wPhi4=1., wPhi5=1., wPhi6=1., wPhi7=1., wPhi8=1.;
22783  Double_t phi1=0., phi2=0., phi3=0.;
22784  Double_t wPhi1=1., wPhi2=1., wPhi3=1.;
22785  Int_t n = fHarmonic; 
22786  Int_t eventNo = (Int_t)fAvMultiplicity->GetBinEntries(1); // to be improved (is this casting safe in general?)
22787  Double_t dMult = (*fSpk)(0,0);
22788  cout<<endl;
22789  cout<<"Correction terms for non-uniform acceptance: Event number: "<<eventNo<<", multiplicity is "<<dMult<<endl;
22790  if(dMult<1)
22791  {
22792   cout<<"... skipping this event (multiplicity too low) ..."<<endl;
22793  } else if (dMult>fMaxAllowedMultiplicity)
22794    {
22795     cout<<"... skipping this event (multiplicity too high) ..."<<endl;
22796    } else 
22797      { 
22798       cout<<"... evaluating nested loops (using particle weights) ..."<<endl;
22799      } 
22800       
22801  // 1-particle correction terms using particle weights:       
22802  if(nPrim>=1 && nPrim<=fMaxAllowedMultiplicity)
22803  {
22804   for(Int_t i1=0;i1<nPrim;i1++)
22805   {
22806    aftsTrack=anEvent->GetTrack(i1);
22807    if(!(aftsTrack->InRPSelection())) continue;
22808    phi1=aftsTrack->Phi();
22809    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
22810    // 1-particle correction terms using particle weights:
22811    if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[0]->Fill(0.5,sin(n*phi1),wPhi1); // <w1 sin(n*phi1)>
22812    if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[1]->Fill(0.5,cos(n*phi1),wPhi1); // <w1 cos(n*phi1)>
22813   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22814  } // end of if(nPrim>=1 && nPrim<=fMaxAllowedMultiplicity) 
22815  
22816  // 2-particle correction terms using particle weights:       
22817  if(nPrim>=2 && nPrim<=fMaxAllowedMultiplicity)
22818  {
22819   for(Int_t i1=0;i1<nPrim;i1++)
22820   {
22821    aftsTrack=anEvent->GetTrack(i1);
22822    if(!(aftsTrack->InRPSelection())) continue;
22823    phi1=aftsTrack->Phi();
22824    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
22825    for(Int_t i2=0;i2<nPrim;i2++)
22826    {
22827     if(i2==i1)continue;
22828     aftsTrack=anEvent->GetTrack(i2);
22829     if(!(aftsTrack->InRPSelection())) continue;
22830     phi2=aftsTrack->Phi();
22831     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));   
22832     if(nPrim==2) cout<<i1<<" "<<i2<<"\r"<<flush;
22833     // 2-p correction terms using particle weights:    
22834     if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[0]->Fill(1.5,sin(n*(phi1+phi2)),wPhi1*wPhi2); // <w1 w2 sin(n*(phi1+phi2))>
22835     if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[1]->Fill(1.5,cos(n*(phi1+phi2)),wPhi1*wPhi2); // <w1 w2 cos(n*(phi1+phi2))>
22836    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22837   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22838  } // end of if(nPrim>=2)
22839
22840  // 3-particle correction terms using particle weights:       
22841  if(nPrim>=3 && nPrim<=fMaxAllowedMultiplicity)
22842  { 
22843   for(Int_t i1=0;i1<nPrim;i1++)
22844   {
22845    aftsTrack=anEvent->GetTrack(i1);
22846    if(!(aftsTrack->InRPSelection())) continue;
22847    phi1=aftsTrack->Phi();
22848    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
22849    for(Int_t i2=0;i2<nPrim;i2++)
22850    {
22851     if(i2==i1)continue;
22852     aftsTrack=anEvent->GetTrack(i2);
22853     if(!(aftsTrack->InRPSelection())) continue;
22854     phi2=aftsTrack->Phi();
22855     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
22856     for(Int_t i3=0;i3<nPrim;i3++)
22857     {
22858      if(i3==i1||i3==i2)continue;
22859      aftsTrack=anEvent->GetTrack(i3);
22860      if(!(aftsTrack->InRPSelection())) continue;
22861      phi3=aftsTrack->Phi();
22862      if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
22863      if(nPrim==3) cout<<i1<<" "<<i2<<" "<<i3<<"\r"<<flush;
22864      // 3-p correction terms using particle weights:    
22865      if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[0]->Fill(2.5,sin(n*(phi1-phi2-phi3)),wPhi1*wPhi2*wPhi3); // <w1 w2 w3 sin(n*(phi1-phi2-phi3))>
22866      if(fUsePhiWeights) fIntFlowDirectCorrectionTermsForNUA[1]->Fill(2.5,cos(n*(phi1-phi2-phi3)),wPhi1*wPhi2*wPhi3); // <w1 w2 w3 cos(n*(phi1-phi2-phi3))>
22867     } // end of for(Int_t i3=0;i3<nPrim;i3++)
22868    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22869   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22870  } // end of if(nPrim>=3)
22871  
22872  /*
22873  
22874  if(nPrim>=4 && nPrim<=fMaxAllowedMultiplicity)
22875  {
22876   // 4 nested loops multiparticle correlations using particle weights:       
22877   for(Int_t i1=0;i1<nPrim;i1++)
22878   {
22879    aftsTrack=anEvent->GetTrack(i1);
22880    if(!(aftsTrack->InRPSelection())) continue;
22881    phi1=aftsTrack->Phi();
22882    if(fUsePhiWeights && fPhiWeights) wPhi1 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi1*fnBinsPhi/TMath::TwoPi())));
22883    for(Int_t i2=0;i2<nPrim;i2++)
22884    {
22885     if(i2==i1)continue;
22886     aftsTrack=anEvent->GetTrack(i2);
22887     if(!(aftsTrack->InRPSelection())) continue;
22888     phi2=aftsTrack->Phi();
22889     if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));
22890     for(Int_t i3=0;i3<nPrim;i3++)
22891     {
22892      if(i3==i1||i3==i2)continue;
22893      aftsTrack=anEvent->GetTrack(i3);
22894      if(!(aftsTrack->InRPSelection())) continue;
22895      phi3=aftsTrack->Phi();
22896      if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));
22897      for(Int_t i4=0;i4<nPrim;i4++)
22898      {
22899       if(i4==i1||i4==i2||i4==i3)continue;
22900       aftsTrack=anEvent->GetTrack(i4);
22901       if(!(aftsTrack->InRPSelection())) continue;
22902       phi4=aftsTrack->Phi();
22903       if(fUsePhiWeights && fPhiWeights) wPhi4 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi4*fnBinsPhi/TMath::TwoPi())));
22904       if(nPrim>=4) cout<<i1<<" "<<i2<<" "<<i3<<" "<<i4<<"\r"<<flush; // to be improved (replace eventually this if statement with if(nPrim==4))
22905       // 4-p correlations using particle weights:
22906       if(fUsePhiWeights) fIntFlowDirectCorrelations->Fill(10.5,cos(n*phi1+n*phi2-n*phi3-n*phi4),wPhi1*wPhi2*wPhi3*wPhi4); 
22907       // extra correlations: 
22908       // 2-p extra correlations (do not appear if particle weights are not used):
22909       // ...
22910       // 3-p extra correlations (do not appear if particle weights are not used):
22911       // ...
22912       // 4-p extra correlations (do not appear if particle weights are not used):
22913       // ...
22914      } // end of for(Int_t i4=0;i4<nPrim;i4++) 
22915     } // end of for(Int_t i3=0;i3<nPrim;i3++)
22916    } // end of for(Int_t i2=0;i2<nPrim;i2++)
22917   } // end of for(Int_t i1=0;i1<nPrim;i1++)
22918  } // end of if(nPrim>=4)
22919
22920  */
22921
22922  cout<<endl; 
22923
22924 } // end of void AliFlowAnalysisWithQCumulants::EvaluateIntFlowCorrectionsForNUAWithNestedLoopsUsingParticleWeights(AliFlowEventSimple* anEvent)
22925
22926 //=======================================================================================================================
22927
22928 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights(TString type, TString ptOrEta)
22929 {
22930  // Calculate correction terms for non-uniform acceptance for differential flow (cos terms) using particle weights.
22931  
22932  // Results are stored in fDiffFlowCorrectionTermsForNUAPro[t][pe][1][cti], where cti runs as follows:
22933  //
22934  //  0: <<cos n(psi)>>
22935  //  1: <<w2 cos n(psi1+phi2)>>
22936  //  2: <<w2 w3 cos n(psi1+phi2-phi3)>>
22937  //  3: <<w2 w3 cos n(psi1-phi2-phi3)>>
22938  //  4:
22939  //  5:
22940  //  6:
22941  
22942  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
22943  Double_t dReQ1n1k = (*fReQ)(0,1);
22944  Double_t dReQ2n2k = (*fReQ)(1,2);
22945  //Double_t dReQ1n3k = (*fReQ)(0,3);
22946  //Double_t dReQ4n4k = (*fReQ)(3,4);
22947  Double_t dImQ1n1k = (*fImQ)(0,1);
22948  Double_t dImQ2n2k = (*fImQ)(1,2);
22949  //Double_t dImQ1n3k = (*fImQ)(0,3);
22950  //Double_t dImQ4n4k = (*fImQ)(3,4);
22951  
22952  // S^M_{p,k} (see .h file for the definition of fSpk):
22953  Double_t dSM1p1k = (*fSpk)(0,1);
22954  Double_t dSM1p2k = (*fSpk)(0,2);
22955  Double_t dSM2p1k = (*fSpk)(1,1);
22956
22957  Int_t t = 0; // type flag 
22958  Int_t pe = 0; // ptEta flag
22959  
22960  if(type == "RP")
22961  {
22962   t = 0;
22963  } else if(type == "POI")
22964    {
22965     t = 1;
22966    }
22967
22968  if(ptOrEta == "Pt")
22969  {
22970   pe = 0;
22971  } else if(ptOrEta == "Eta")
22972    {
22973     pe = 1;
22974    }
22975     
22976  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
22977  Double_t minPtEta[2] = {fPtMin,fEtaMin};
22978  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
22979  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
22980  
22981  // looping over all bins and calculating correction terms: 
22982  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
22983  {
22984   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
22985   Double_t p1n0kRe = 0.;
22986   Double_t p1n0kIm = 0.;
22987
22988   // number of POIs in particular pt or eta bin:
22989   Double_t mp = 0.;
22990
22991   // 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):
22992   Double_t q1n2kRe = 0.;
22993   //Double_t q1n2kIm = 0.;
22994   Double_t q2n1kRe = 0.;
22995   Double_t q2n1kIm = 0.;
22996     
22997   // s_{1,1}, s_{1,2} // to be improved (add explanation)  
22998   Double_t s1p1k = 0.; 
22999   Double_t s1p2k = 0.; 
23000   
23001   // number of particles which are both RPs and POIs in particular pt or eta bin:
23002   //Double_t mq = 0.;
23003   
23004   // M0111 from Eq. (118) in QC2c (to be improved (notation))
23005   Double_t dM01 = 0.;
23006   Double_t dM011 = 0.;
23007   
23008   if(type == "POI")
23009   {           
23010    // q_{m*n,k}:
23011    q1n2kRe = fReRPQ1dEBE[2][pe][0][2]->GetBinContent(fReRPQ1dEBE[2][pe][0][2]->GetBin(b))
23012            * fReRPQ1dEBE[2][pe][0][2]->GetBinEntries(fReRPQ1dEBE[2][pe][0][2]->GetBin(b));
23013    //q1n2kIm = fImRPQ1dEBE[2][pe][0][2]->GetBinContent(fImRPQ1dEBE[2][pe][0][2]->GetBin(b))
23014    //        * fImRPQ1dEBE[2][pe][0][2]->GetBinEntries(fImRPQ1dEBE[2][pe][0][2]->GetBin(b));         
23015    q2n1kRe = fReRPQ1dEBE[2][pe][1][1]->GetBinContent(fReRPQ1dEBE[2][pe][1][1]->GetBin(b))
23016            * fReRPQ1dEBE[2][pe][1][1]->GetBinEntries(fReRPQ1dEBE[2][pe][1][1]->GetBin(b));
23017    q2n1kIm = fImRPQ1dEBE[2][pe][1][1]->GetBinContent(fImRPQ1dEBE[2][pe][1][1]->GetBin(b))
23018            * fImRPQ1dEBE[2][pe][1][1]->GetBinEntries(fImRPQ1dEBE[2][pe][1][1]->GetBin(b));         
23019    //mq = fReRPQ1dEBE[2][pe][1][1]->GetBinEntries(fReRPQ1dEBE[2][pe][1][1]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
23020    
23021    s1p1k = pow(fs1dEBE[2][pe][1]->GetBinContent(b)*fs1dEBE[2][pe][1]->GetBinEntries(b),1.); 
23022    s1p2k = pow(fs1dEBE[2][pe][2]->GetBinContent(b)*fs1dEBE[2][pe][2]->GetBinEntries(b),1.); 
23023   }else if(type == "RP")
23024    {
23025     // q_{m*n,k}: (Remark: m=1 is 0, k=0 iz zero (to be improved!)) 
23026     q1n2kRe = fReRPQ1dEBE[0][pe][0][2]->GetBinContent(fReRPQ1dEBE[0][pe][0][2]->GetBin(b))
23027             * fReRPQ1dEBE[0][pe][0][2]->GetBinEntries(fReRPQ1dEBE[0][pe][0][2]->GetBin(b));
23028     //q1n2kIm = fImRPQ1dEBE[0][pe][0][2]->GetBinContent(fImRPQ1dEBE[0][pe][0][2]->GetBin(b))
23029     //        * fImRPQ1dEBE[0][pe][0][2]->GetBinEntries(fImRPQ1dEBE[0][pe][0][2]->GetBin(b));
23030     q2n1kRe = fReRPQ1dEBE[0][pe][1][1]->GetBinContent(fReRPQ1dEBE[0][pe][1][1]->GetBin(b))
23031             * fReRPQ1dEBE[0][pe][1][1]->GetBinEntries(fReRPQ1dEBE[0][pe][1][1]->GetBin(b));
23032     q2n1kIm = fImRPQ1dEBE[0][pe][1][1]->GetBinContent(fImRPQ1dEBE[0][pe][1][1]->GetBin(b))
23033             * fImRPQ1dEBE[0][pe][1][1]->GetBinEntries(fImRPQ1dEBE[0][pe][1][1]->GetBin(b));
23034     // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
23035     s1p1k = pow(fs1dEBE[0][pe][1]->GetBinContent(b)*fs1dEBE[0][pe][1]->GetBinEntries(b),1.); 
23036     s1p2k = pow(fs1dEBE[0][pe][2]->GetBinContent(b)*fs1dEBE[0][pe][2]->GetBinEntries(b),1.); 
23037     //s1p3k = pow(fs1dEBE[0][pe][3]->GetBinContent(b)*fs1dEBE[0][pe][3]->GetBinEntries(b),1.);  
23038     
23039     //mq = fReRPQ1dEBE[0][pe][1][1]->GetBinEntries(fReRPQ1dEBE[0][pe][1][1]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here) 
23040   }    
23041   
23042   if(type == "POI")
23043   {
23044    // p_{m*n,k}:   
23045    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
23046            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
23047    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
23048            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
23049    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here) 
23050    // M01 from Eq. (118) in QC2c (to be improved (notation)):
23051    dM01 = mp*dSM1p1k-s1p1k;
23052    dM011 = mp*(dSM2p1k-dSM1p2k)
23053          - 2.*(s1p1k*dSM1p1k-s1p2k);
23054        
23055    // typeFlag = RP (0) or POI (1):   
23056    t = 1; 
23057   } else if(type == "RP")
23058     {  
23059      // to be improved (cross-checked):
23060      p1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
23061              * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
23062      p1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))  
23063              * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
23064      mp = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
23065      // M01 from Eq. (118) in QC2c (to be improved (notation)):
23066      dM01 = mp*dSM1p1k-s1p1k;
23067      dM011 = mp*(dSM2p1k-dSM1p2k)
23068            - 2.*(s1p1k*dSM1p1k-s1p2k); 
23069      // typeFlag = RP (0) or POI (1): 
23070      t = 0;
23071     }
23072   
23073   // <<cos n(psi1)>>:
23074   Double_t cosP1nPsi = 0.;
23075   if(mp)
23076   {
23077    cosP1nPsi = p1n0kRe/mp;
23078    
23079    // fill profile for <<cos n(psi1)>>:
23080    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi,mp);
23081    // histogram to store <cos n(psi1)> e-b-e (needed in some other methods):
23082    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][0]->SetBinContent(b,cosP1nPsi);
23083   } // end of if(mp)   
23084   
23085   // <<w2 cos n(psi1+phi2)>>:
23086   Double_t cosP1nPsiP1nPhiW2 = 0.;
23087   if(dM01)
23088   {
23089    cosP1nPsiP1nPhiW2 = (p1n0kRe*dReQ1n1k-p1n0kIm*dImQ1n1k-q2n1kRe)/(dM01);
23090    // fill profile for <<w2 cos n(psi1+phi2)>>:
23091    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsiP1nPhiW2,dM01);
23092    // histogram to store <w2 cos n(psi1+phi2)> e-b-e (needed in some other methods):
23093    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][1]->SetBinContent(b,cosP1nPsiP1nPhiW2);
23094   } // end of if(dM01)   
23095   
23096   // <<w2 w3 cos n(psi1+phi2-phi3)>>:
23097   Double_t cosP1nPsi1P1nPhi2MPhi3W2W3 = 0.;
23098   if(dM011)
23099   {
23100    cosP1nPsi1P1nPhi2MPhi3W2W3 = (p1n0kRe*(pow(dImQ1n1k,2.)+pow(dReQ1n1k,2.))
23101                               - p1n0kRe*dSM1p2k
23102                               - q2n1kRe*dReQ1n1k-q2n1kIm*dImQ1n1k
23103                               - s1p1k*dReQ1n1k
23104                               + 2.*q1n2kRe)
23105                               / dM011;  
23106    // fill profile for <<w1 w2 w3 cos n(psi1+phi2)>>:
23107    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1P1nPhi2MPhi3W2W3,dM011);
23108    // histogram to store <w1 w2 w3 cos n(psi1+phi2)> e-b-e (needed in some other methods):
23109    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][2]->SetBinContent(b,cosP1nPsi1P1nPhi2MPhi3W2W3);
23110   } // end of if(dM011)   
23111   
23112   // <<w2 w3 cos n(psi1-phi2-phi3)>>:
23113   Double_t cosP1nPsi1M1nPhi2MPhi3W2W3 = 0.;
23114   if(dM011)
23115   {
23116    cosP1nPsi1M1nPhi2MPhi3W2W3 = (p1n0kRe*(pow(dReQ1n1k,2.)-pow(dImQ1n1k,2.))+2.*p1n0kIm*dReQ1n1k*dImQ1n1k
23117                               - 1.*(p1n0kRe*dReQ2n2k+p1n0kIm*dImQ2n2k)  
23118                               - 2.*s1p1k*dReQ1n1k
23119                               + 2.*q1n2kRe)
23120                               / dM011;
23121    // fill profile for <<w1 w2 w3 cos n(psi1+phi2)>>:
23122    fDiffFlowCorrectionTermsForNUAPro[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1M1nPhi2MPhi3W2W3,dM011);
23123    // histogram to store <w1 w2 w3 cos n(psi1+phi2)> e-b-e (needed in some other methods):
23124    fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][3]->SetBinContent(b,cosP1nPsi1M1nPhi2MPhi3W2W3);
23125   } // end of if(dM011)   
23126  
23127  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
23128    
23129 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights(TString type, TString ptOrEta)
23130
23131
23132 //=======================================================================================================================
23133
23134
23135 void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights(TString type, TString ptOrEta)
23136 {
23137  // Calculate correction terms for non-uniform acceptance for differential flow (sin terms).
23138   
23139  // Results are stored in fDiffFlowCorrectionTermsForNUAPro[t][pe][0][cti], where cti runs as follows:
23140  //  0: <<sin n(psi1)>>
23141  //  1: <<w2 sin n(psi1+phi2)>>
23142  //  2: <<w2 w3 sin n(psi1+phi2-phi3)>>
23143  //  3: <<w2 w3 sin n(psi1-phi2-phi3)>>:
23144  //  4:
23145  //  5:
23146  //  6:
23147  
23148  // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
23149  Double_t dReQ1n1k = (*fReQ)(0,1);
23150  Double_t dReQ2n2k = (*fReQ)(1,2);
23151  //Double_t dReQ1n3k = (*fReQ)(0,3);
23152  //Double_t dReQ4n4k = (*fReQ)(3,4);
23153  Double_t dImQ1n1k = (*fImQ)(0,1);
23154  Double_t dImQ2n2k = (*fImQ)(1,2);
23155  //Double_t dImQ1n3k = (*fImQ)(0,3);
23156  //Double_t dImQ4n4k = (*fImQ)(3,4);
23157  
23158  // S^M_{p,k} (see .h file for the definition of fSpk):
23159  Double_t dSM1p1k = (*fSpk)(0,1);
23160  Double_t dSM1p2k = (*fSpk)(0,2);
23161  Double_t dSM2p1k = (*fSpk)(1,1);
23162
23163  Int_t t = 0; // type flag 
23164  Int_t pe = 0; // ptEta flag
23165  
23166  if(type == "RP")
23167  {
23168   t = 0;
23169  } else if(type == "POI")
23170    {
23171     t = 1;
23172    }
23173
23174  if(ptOrEta == "Pt")
23175  {
23176   pe = 0;
23177  } else if(ptOrEta == "Eta")
23178    {
23179     pe = 1;
23180    }
23181     
23182  Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};
23183  Double_t minPtEta[2] = {fPtMin,fEtaMin};
23184  //Double_t maxPtEta[2] = {fPtMax,fEtaMax};
23185  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
23186
23187  // looping over all bins and calculating correction terms: 
23188  for(Int_t b=1;b<=nBinsPtEta[pe];b++)
23189  {
23190   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): 
23191   Double_t p1n0kRe = 0.;
23192   Double_t p1n0kIm = 0.;
23193
23194   // number of POIs in particular pt or eta bin:
23195   Double_t mp = 0.;
23196
23197   // 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):
23198   //Double_t q1n2kRe = 0.;
23199   Double_t q1n2kIm = 0.;
23200   Double_t q2n1kRe = 0.;
23201   Double_t q2n1kIm = 0.;
23202     
23203   // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
23204   Double_t s1p1k = 0.; 
23205   Double_t s1p2k = 0.; 
23206   
23207   // number of particles which are both RPs and POIs in particular pt or eta bin:
23208   //Double_t mq = 0.;
23209   
23210   // M0111 from Eq. (118) in QC2c (to be improved (notation))
23211   Double_t dM01 = 0.;
23212   Double_t dM011 = 0.;
23213
23214   if(type == "POI")
23215   {    
23216    // q_{m*n,k}:
23217    //q1n2kRe = fReRPQ1dEBE[2][pe][0][2]->GetBinContent(fReRPQ1dEBE[2][pe][0][2]->GetBin(b))
23218    //        * fReRPQ1dEBE[2][pe][0][2]->GetBinEntries(fReRPQ1dEBE[2][pe][0][2]->GetBin(b));
23219    q1n2kIm = fImRPQ1dEBE[2][pe][0][2]->GetBinContent(fImRPQ1dEBE[2][pe][0][2]->GetBin(b))
23220            * fImRPQ1dEBE[2][pe][0][2]->GetBinEntries(fImRPQ1dEBE[2][pe][0][2]->GetBin(b));         
23221    q2n1kRe = fReRPQ1dEBE[2][pe][1][1]->GetBinContent(fReRPQ1dEBE[2][pe][1][1]->GetBin(b))
23222            * fReRPQ1dEBE[2][pe][1][1]->GetBinEntries(fReRPQ1dEBE[2][pe][1][1]->GetBin(b));
23223    q2n1kIm = fImRPQ1dEBE[2][pe][1][1]->GetBinContent(fImRPQ1dEBE[2][pe][1][1]->GetBin(b))
23224            * fImRPQ1dEBE[2][pe][1][1]->GetBinEntries(fImRPQ1dEBE[2][pe][1][1]->GetBin(b));         
23225    //mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)
23226    
23227    s1p1k = pow(fs1dEBE[2][pe][1]->GetBinContent(b)*fs1dEBE[2][pe][1]->GetBinEntries(b),1.); 
23228    s1p2k = pow(fs1dEBE[2][pe][2]->GetBinContent(b)*fs1dEBE[2][pe][2]->GetBinEntries(b),1.); 
23229   }else if(type == "RP")
23230    {
23231     // q_{m*n,k}: (Remark: m=1 is 0, k=0 iz zero (to be improved!)) 
23232     //q1n2kRe = fReRPQ1dEBE[0][pe][0][2]->GetBinContent(fReRPQ1dEBE[0][pe][0][2]->GetBin(b))
23233     //        * fReRPQ1dEBE[0][pe][0][2]->GetBinEntries(fReRPQ1dEBE[0][pe][0][2]->GetBin(b));
23234     q1n2kIm = fImRPQ1dEBE[0][pe][0][2]->GetBinContent(fImRPQ1dEBE[0][pe][0][2]->GetBin(b))
23235             * fImRPQ1dEBE[0][pe][0][2]->GetBinEntries(fImRPQ1dEBE[0][pe][0][2]->GetBin(b));
23236     q2n1kRe = fReRPQ1dEBE[0][pe][1][1]->GetBinContent(fReRPQ1dEBE[0][pe][1][1]->GetBin(b))
23237             * fReRPQ1dEBE[0][pe][1][1]->GetBinEntries(fReRPQ1dEBE[0][pe][1][1]->GetBin(b));
23238     q2n1kIm = fImRPQ1dEBE[0][pe][1][1]->GetBinContent(fImRPQ1dEBE[0][pe][1][1]->GetBin(b))
23239             * fImRPQ1dEBE[0][pe][1][1]->GetBinEntries(fImRPQ1dEBE[0][pe][1][1]->GetBin(b));
23240     // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  
23241     s1p1k = pow(fs1dEBE[0][pe][1]->GetBinContent(b)*fs1dEBE[0][pe][1]->GetBinEntries(b),1.); 
23242     s1p2k = pow(fs1dEBE[0][pe][2]->GetBinContent(b)*fs1dEBE[0][pe][2]->GetBinEntries(b),1.); 
23243     //s1p3k = pow(fs1dEBE[0][pe][3]->GetBinContent(b)*fs1dEBE[0][pe][3]->GetBinEntries(b),1.); 
23244   }    
23245   
23246   if(type == "POI")
23247   {
23248    // p_{m*n,k}:   
23249    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))
23250            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));
23251    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  
23252            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
23253    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here) 
23254    // M01 from Eq. (118) in QC2c (to be improved (notation)):
23255    dM01 = mp*dSM1p1k-s1p1k;
23256    dM011 = mp*(dSM2p1k-dSM1p2k)
23257          - 2.*(s1p1k*dSM1p1k-s1p2k);  
23258    // typeFlag = RP (0) or POI (1):   
23259    t = 1;           
23260   } else if(type == "RP")
23261     { 
23262      // to be improved (cross-checked):
23263      p1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))
23264              * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));
23265      p1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))  
23266              * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));
23267      mp = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)    
23268      // M01 from Eq. (118) in QC2c (to be improved (notation)):
23269      dM01 = mp*dSM1p1k-s1p1k;
23270      dM011 = mp*(dSM2p1k-dSM1p2k)
23271            - 2.*(s1p1k*dSM1p1k-s1p2k); 
23272      // typeFlag = RP (0) or POI (1): 
23273      t = 0;
23274     }
23275   
23276   // <<sin n(psi1)>>:
23277   Double_t sinP1nPsi = 0.;
23278   if(mp)
23279   {
23280    sinP1nPsi = p1n0kIm/mp;
23281    
23282    // fill profile for <<sin n(psi1)>>:
23283    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi,mp);
23284    // histogram to store <sin n(psi1)> e-b-e (needed in some other methods):
23285    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][0]->SetBinContent(b,sinP1nPsi);
23286   } // end of if(mp)   
23287   
23288   // <<w2 sin n(psi1+phi2)>>:
23289   Double_t sinP1nPsiP1nPhiW2 = 0.;
23290   if(dM01)
23291   {
23292    sinP1nPsiP1nPhiW2 = (p1n0kRe*dImQ1n1k+p1n0kIm*dReQ1n1k-q2n1kIm)/(dM01);
23293    // fill profile for <<w2 sin n(psi1+phi2)>>:
23294    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsiP1nPhiW2,dM01);
23295    // histogram to store <w2 sin n(psi1+phi2)> e-b-e (needed in some other methods):
23296    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][1]->SetBinContent(b,sinP1nPsiP1nPhiW2);
23297   } // end of if(mp*dMult-mq)   
23298   
23299   // <<w2 w3 sin n(psi1+phi2-phi3)>>:
23300   Double_t sinP1nPsi1P1nPhi2MPhi3W2W3 = 0.;
23301   if(dM011)
23302   {
23303    sinP1nPsi1P1nPhi2MPhi3W2W3 = (p1n0kIm*(pow(dImQ1n1k,2.)+pow(dReQ1n1k,2.))
23304                               - p1n0kIm*dSM1p2k
23305                               + q2n1kRe*dImQ1n1k-q2n1kIm*dReQ1n1k
23306                               - s1p1k*dImQ1n1k
23307                               + 2.*q1n2kIm)
23308                               / dM011;  
23309    // fill profile for <<w2 w3 sin n(psi1+phi2-phi3)>>:
23310    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1P1nPhi2MPhi3W2W3,dM011);
23311    // histogram to store <w2 w3 sin n(psi1+phi2-phi3)> e-b-e (needed in some other methods):
23312    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][2]->SetBinContent(b,sinP1nPsi1P1nPhi2MPhi3W2W3);
23313   } // end of if(dM011)   
23314   
23315   // <<w2 w3 sin n(psi1-phi2-phi3)>>:
23316   Double_t sinP1nPsi1M1nPhi2MPhi3W2W3 = 0.;
23317   if(dM011)
23318   {
23319    sinP1nPsi1M1nPhi2MPhi3W2W3 = (p1n0kIm*(pow(dReQ1n1k,2.)-pow(dImQ1n1k,2.))-2.*p1n0kRe*dReQ1n1k*dImQ1n1k
23320                               + 1.*(p1n0kRe*dImQ2n2k-p1n0kIm*dReQ2n2k)  
23321                               + 2.*s1p1k*dImQ1n1k
23322                               - 2.*q1n2kIm)
23323                               / dM011;
23324    // fill profile for <<w2 w3 sin n(psi1-phi2-phi3)>>:
23325    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1M1nPhi2MPhi3W2W3,dM011);
23326    // histogram to store <w2 w3 sin n(psi1-phi2-phi3)> e-b-e (needed in some other methods):
23327    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][3]->SetBinContent(b,sinP1nPsi1M1nPhi2MPhi3W2W3);
23328   } // end of if(dM011)   
23329   
23330  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)
23331
23332 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights(TString type, TString ptOrEta)
23333
23334 //=======================================================================================================================
23335    
23336 void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(AliFlowEventSimple * const anEvent, TString type, TString ptOrEta)
23337 {
23338  // Evaluate with nested loops correction terms for non-uniform acceptance 
23339  // with using particle weights (both sin and cos terms) relevant for differential flow.
23340  
23341  // Remark 1: "w1" in expressions bellow is a particle weight used only for particles which were 
23342  //           flagged both as POI and RP.
23343  // Remark 2: Reduced correction terms for non-uniform acceptance are evaluated in pt bin number fCrossCheckInPtBinNo 
23344  //           and eta bin number fCrossCheckInEtaBinNo both for RPs and POIs.
23345  // Remark 3: Results are stored in 1 bin profiles fDiffFlowDirectCorrections[t][pe][sc][cti], where first three indices runs as: 
23346  //           [0=RP,1=POI][0=Pt,1=Eta][0=sin terms,1=cos terms], whilst the cti (correction term index) runs as follows: 
23347  //  cti: 
23348  //    0: <<sc n(psi1)>>
23349  //    1: <<w2 sc n(psi1+phi2)>> 
23350  //    2: <<w2 w3 sc n(psi1+phi2-phi3)>>
23351  //    3: <<w2 w3 sc n(psi1-phi2-phi3)>>
23352  //    4:
23353  //    5:
23354  //    6:
23355      
23356  Int_t typeFlag = 0;
23357  Int_t ptEtaFlag = 0;
23358  if(type == "RP")
23359  {
23360   typeFlag = 0;
23361  } else if(type == "POI")
23362    {
23363     typeFlag = 1;
23364    }      
23365  if(ptOrEta == "Pt")
23366  {
23367   ptEtaFlag = 0;
23368  } else if(ptOrEta == "Eta")
23369    {
23370     ptEtaFlag = 1;
23371    } 
23372  // shortcuts:
23373  Int_t t = typeFlag;
23374  Int_t pe = ptEtaFlag;
23375       
23376  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
23377  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
23378  Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};
23379  
23380  Int_t nPrim = anEvent->NumberOfTracks(); 
23381  AliFlowTrackSimple *aftsTrack = NULL;
23382  
23383  Double_t psi1=0., phi2=0., phi3=0.;// phi4=0.;// phi5=0., phi6=0., phi7=0., phi8=0.;
23384  Double_t wPhi2=1., wPhi3=1.;
23385  
23386  Int_t n = fHarmonic; 
23387  
23388  // 1'-particle correction terms:
23389  for(Int_t i1=0;i1<nPrim;i1++)
23390  {
23391   aftsTrack=anEvent->GetTrack(i1);
23392   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23393   if(typeFlag==1) // this is diff flow of POIs 
23394   {
23395    if(ptOrEta == "Pt")
23396    { 
23397     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23398    } else if (ptOrEta == "Eta")
23399      {
23400       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23401      }
23402   } else // this is diff flow of RPs 
23403     {
23404      if(ptOrEta == "Pt")
23405      { 
23406       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23407      } else if (ptOrEta == "Eta")
23408        {
23409         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23410        }
23411     }
23412   psi1=aftsTrack->Phi(); 
23413   // sin terms: 
23414   fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*psi1),1.); // <<sin(n*(psi1))>>  
23415   // cos terms: 
23416   fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*psi1),1.); // <<cos(n*(psi1))>>  
23417  }//end of for(Int_t i1=0;i1<nPrim;i1++)
23418    
23419  // 2'-particle correction terms:
23420  for(Int_t i1=0;i1<nPrim;i1++)
23421  {
23422   aftsTrack=anEvent->GetTrack(i1);
23423   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23424   if(typeFlag==1) // this is diff flow of POIs 
23425   {
23426    if(ptOrEta == "Pt")
23427    { 
23428     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23429    } else if (ptOrEta == "Eta")
23430      {
23431       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23432      }
23433   } else // this is diff flow of RPs 
23434     {
23435      if(ptOrEta == "Pt")
23436      { 
23437       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23438      } else if (ptOrEta == "Eta")
23439        {
23440         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23441        }
23442     }
23443   psi1=aftsTrack->Phi(); 
23444   for(Int_t i2=0;i2<nPrim;i2++)
23445   {
23446    if(i2==i1) continue;
23447    aftsTrack=anEvent->GetTrack(i2);
23448    // RP condition (!(first) particle in the correlator must be RP):
23449    if(!(aftsTrack->InRPSelection())) continue;
23450    phi2=aftsTrack->Phi();
23451    if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));   
23452    // sin terms: 
23453    fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1+phi2)),wPhi2); // <<w2 sin(n*(psi1+phi2))>>  
23454    // cos terms: 
23455    fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2)),wPhi2); // <<w2 cos(n*(psi1+phi2))>>  
23456   }//end of for(Int_t i2=0;i2<nPrim;i2++)
23457  }//end of for(Int_t i1=0;i1<nPrim;i1++)   
23458  
23459  // 3'-particle correction terms:
23460  for(Int_t i1=0;i1<nPrim;i1++)
23461  {
23462   aftsTrack=anEvent->GetTrack(i1);
23463   // POI condition (first particle in the correlator must be POI): // to be improved (this can be implemented much better)
23464   if(typeFlag==1) // this is diff flow of POIs 
23465   {
23466    if(ptOrEta == "Pt")
23467    { 
23468     if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;
23469    } else if (ptOrEta == "Eta")
23470      {
23471       if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InPOISelection())))continue;    
23472      }
23473   } else // this is diff flow of RPs 
23474     {
23475      if(ptOrEta == "Pt")
23476      { 
23477       if(!((aftsTrack->Pt()>=lowerPtEtaEdge[pe] && aftsTrack->Pt()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;
23478      } else if (ptOrEta == "Eta")
23479        {
23480         if(!((aftsTrack->Eta()>=lowerPtEtaEdge[pe] && aftsTrack->Eta()<upperPtEtaEdge[pe]) && (aftsTrack->InRPSelection())))continue;    
23481        }
23482     }
23483   psi1=aftsTrack->Phi();
23484   for(Int_t i2=0;i2<nPrim;i2++)
23485   {
23486    if(i2==i1) continue;
23487    aftsTrack=anEvent->GetTrack(i2);
23488    // RP condition (!(first) particle in the correlator must be RP):
23489    if(!(aftsTrack->InRPSelection())) continue;
23490    phi2=aftsTrack->Phi();
23491    if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));   
23492    for(Int_t i3=0;i3<nPrim;i3++)
23493    {
23494     if(i3==i1||i3==i2) continue;
23495     aftsTrack=anEvent->GetTrack(i3);
23496     // RP condition (!(first) particle in the correlator must be RP):
23497     if(!(aftsTrack->InRPSelection())) continue;
23498     phi3=aftsTrack->Phi();
23499     if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));   
23500     // sin terms: 
23501     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))>>  
23502     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))>>  
23503     // cos terms: 
23504     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))>>  
23505     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))>>  
23506    }//end of for(Int_t i3=0;i3<nPrim;i3++)  
23507   }//end of for(Int_t i2=0;i2<nPrim;i2++)  
23508  }//end of for(Int_t i1=0;i1<nPrim;i1++)
23509                
23510 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(AliFlowEventSimple* anEvent, TString type, TString ptOrEta)
23511
23512 //=======================================================================================================================
23513
23514 void AliFlowAnalysisWithQCumulants::CheckPointersUsedInFinish()
23515 {
23516  // Check all pointers used in method Finish().
23517  
23518  if(!fAvMultiplicity)
23519  {
23520   cout<<endl;
23521   cout<<" WARNING (QC): fAvMultiplicity is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23522   cout<<endl;
23523   exit(0);
23524  }
23525  if(!fIntFlowCorrelationsPro)
23526  {
23527   cout<<endl;
23528   cout<<" WARNING (QC): fIntFlowCorrelationsPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23529   cout<<endl;
23530   exit(0); 
23531  }
23532  if(!fIntFlowSquaredCorrelationsPro)
23533  {
23534   cout<<endl;
23535   cout<<" WARNING (QC): fIntFlowSquaredCorrelationsPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23536   cout<<endl;
23537   exit(0); 
23538  } 
23539  if(!fIntFlowCorrelationsHist)
23540  {
23541   cout<<endl;
23542   cout<<" WARNING (QC): fIntFlowCorrelationsHist is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23543   cout<<endl;
23544   exit(0); 
23545  }
23546  if((fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights) && !fIntFlowExtraCorrelationsPro) 
23547  {
23548   cout<<endl;
23549   cout<<" WARNING (QC): fIntFlowExtraCorrelationsPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23550   cout<<endl;
23551   exit(0); 
23552  } 
23553  for(Int_t power=0;power<2;power++)
23554  { 
23555   if(!fIntFlowSumOfEventWeights[power]) 
23556   {
23557    cout<<endl;
23558    cout<<Form(" WARNING (QC): fIntFlowSumOfEventWeights[%d] is NULL in CheckPointersUsedInFinish() !!!!",power)<<endl;
23559    cout<<endl;
23560    exit(0);
23561   }
23562  } // end of for(Int_t power=0;power<2;power++)
23563  if(!fIntFlowProductOfCorrelationsPro)
23564  {
23565   cout<<endl;
23566   cout<<" WARNING (QC): fIntFlowProductOfCorrelationsPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23567   cout<<endl;
23568   exit(0); 
23569  } 
23570  if(!fIntFlowSumOfProductOfEventWeights)
23571  {
23572   cout<<endl;
23573   cout<<" WARNING (QC): fIntFlowSumOfProductOfEventWeights is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23574   cout<<endl;
23575   exit(0); 
23576  }
23577  if(!fIntFlowCovariances)
23578  {
23579   cout<<endl;
23580   cout<<" WARNING (QC): fIntFlowCovariances is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23581   cout<<endl;
23582   exit(0); 
23583  }  
23584  if(!fIntFlowQcumulants)
23585  {
23586   cout<<endl;
23587   cout<<" WARNING (QC): fIntFlowQcumulants is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23588   cout<<endl;
23589   exit(0); 
23590  }  
23591  if(!fIntFlow)
23592  {
23593   cout<<endl;
23594   cout<<" WARNING (QC): fIntFlow is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23595   cout<<endl;
23596   exit(0); 
23597  }
23598  if(!fCommonHists)
23599  {
23600   cout<<endl;
23601   cout<<" WARNING (QC): fCommonHists is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23602   cout<<endl;
23603   exit(0); 
23604  }
23605  if(!(fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th))
23606  {
23607   cout<<endl;
23608   cout<<" WARNING (QC): fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th"<<endl; 
23609   cout<<"               && fCommonHistsResults8th is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23610   cout<<endl;
23611   exit(0);
23612  } 
23613
23614  // NUA stuff:
23615  for(Int_t sc=0;sc<2;sc++) // sin/cos
23616  { 
23617   if(!fIntFlowCorrectionTermsForNUAPro[sc]) 
23618   {
23619    cout<<endl;
23620    cout<<Form(" WARNING (QC): fIntFlowCorrectionTermsForNUAPro[%d] is NULL in CheckPointersUsedInFinish() !!!!",sc)<<endl;
23621    cout<<endl;
23622    exit(0);
23623   }
23624   if(!fIntFlowCorrectionTermsForNUAHist[sc]) 
23625   {
23626    cout<<endl;
23627    cout<<Form(" WARNING (QC): fIntFlowCorrectionTermsForNUAHist[%d] is NULL in CheckPointersUsedInFinish() !!!!",sc)<<endl;
23628    cout<<endl;
23629    exit(0);
23630   }
23631   for(Int_t lq=0;lq<2;lq++) // linear/quadratic
23632   {
23633    if(!fIntFlowSumOfEventWeightsNUA[sc][lq]) 
23634    {
23635     cout<<endl;
23636     cout<<Form(" WARNING (QC): fIntFlowSumOfEventWeightsNUA[%d][%d] is NULL in CheckPointersUsedInFinish() !!!!",sc,lq)<<endl;
23637     cout<<endl;
23638     exit(0);
23639    }
23640   } // end of for(Int_t lq=0;lq<2;lq++) // linear/quadratic
23641  } // end of for(Int_t power=0;power<2;power++) 
23642  if(!fIntFlowProductOfCorrectionTermsForNUAPro)
23643  {
23644   cout<<endl;
23645   cout<<" WARNING (QC): fIntFlowProductOfCorrectionTermsForNUAPro is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23646   cout<<endl;
23647   exit(0); 
23648  } 
23649  if(!fIntFlowSumOfProductOfEventWeightsNUA)
23650  {
23651   cout<<endl;
23652   cout<<" WARNING (QC): fIntFlowSumOfProductOfEventWeightsNUA is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23653   cout<<endl;
23654   exit(0); 
23655  } 
23656  if(!fIntFlowCovariancesNUA)
23657  {
23658   cout<<endl;
23659   cout<<" WARNING (QC): fIntFlowCovariancesNUA is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23660   cout<<endl;
23661   exit(0); 
23662  } 
23663  if(!fIntFlowQcumulantsErrorSquaredRatio)
23664  {
23665   cout<<endl;
23666   cout<<" WARNING (QC): fIntFlowQcumulantsErrorSquaredRatio is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23667   cout<<endl;
23668   exit(0); 
23669  } 
23670  if(!fIntFlowDetectorBias)
23671  {
23672   cout<<endl;
23673   cout<<" WARNING (QC): fIntFlowDetectorBias is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23674   cout<<endl;
23675   exit(0); 
23676  }
23677  
23678  if(fCalculateMixedHarmonics)
23679  {
23680   if(!(fMixedHarmonicsFlags))
23681   {
23682    cout<<endl;
23683    cout<<" WARNING (QC): fMixedHarmonicsFlags is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23684    cout<<endl;
23685    exit(0); 
23686   }
23687   if(!(f2pCorrelations && f3pCorrelations && f4pCorrelations && f5pCorrelations))
23688   {
23689    cout<<endl;
23690    cout<<" WARNING (QC): f2pCorrelations && f3pCorrelations && f4pCorrelations && f5pCorrelations is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23691    cout<<endl;
23692    exit(0); 
23693   }
23694   if(!(f2pCumulants && f3pCumulants && f4pCumulants && f5pCumulants))
23695   {
23696    cout<<endl;
23697    cout<<" WARNING (QC): f2pCumulants && f3pCumulants && f4pCumulants && f5pCumulants is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23698    cout<<endl;
23699    exit(0); 
23700   }
23701   for(Int_t power=0;power<2;power++)
23702   { 
23703    if(!fMixedHarmonicEventWeights[power]) 
23704    {
23705     cout<<endl;
23706     cout<<Form(" WARNING (QC): fMixedHarmonicEventWeights[%d] is NULL in CheckPointersUsedInFinish() !!!!",power)<<endl;
23707     cout<<endl;
23708     exit(0);
23709    }
23710   } // end of for(Int_t power=0;power<2;power++)
23711   if(!(fMixedHarmonicProductOfEventWeights))
23712   {
23713    cout<<endl;
23714    cout<<" WARNING (QC): fMixedHarmonicProductOfEventWeights is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23715    cout<<endl;
23716    exit(0); 
23717   }
23718   if(!(fMixedHarmonicProductOfCorrelations))
23719   {
23720    cout<<endl;
23721    cout<<" WARNING (QC): fMixedHarmonicProductOfCorrelations is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23722    cout<<endl;
23723    exit(0); 
23724   }
23725  } // end of if(fCalculateMixedHarmonics)
23726
23727  // Versus multiplicity:
23728  if(!fCalculateCumulantsVsM){return;}
23729  for(Int_t co=0;co<=3;co++) // cumulant order
23730  {
23731   if(!fIntFlowQcumulantsVsM[co])
23732   {
23733    cout<<endl;
23734    cout<<Form(" WARNING (QC): fIntFlowQcumulantsVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",co)<<endl;
23735    cout<<endl;
23736    exit(0); 
23737   }
23738   if(!fIntFlowVsM[co])
23739   {
23740    cout<<endl;
23741    cout<<Form(" WARNING (QC): fIntFlowVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",co)<<endl;
23742    cout<<endl;
23743    exit(0); 
23744   }
23745   if(!fIntFlowDetectorBiasVsM[co])
23746   {
23747    cout<<endl;
23748    cout<<Form(" WARNING (QC): fIntFlowDetectorBiasVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",co)<<endl;
23749    cout<<endl;
23750    exit(0); 
23751   }
23752  } // end of for(Int_t c0=0;c0<=3;c0++) // cumulant order
23753  for(Int_t ci=0;ci<=3;ci++) // correlation index
23754  {
23755   if(!fIntFlowCorrelationsVsMPro[ci])
23756   {
23757    cout<<endl;
23758    cout<<Form(" WARNING (QC): fIntFlowCorrelationsVsMPro[%d] is NULL in CheckPointersUsedInFinish() !!!!",ci)<<endl;
23759    cout<<endl;
23760    exit(0); 
23761   }
23762   if(!fIntFlowSquaredCorrelationsVsMPro[ci])
23763   {
23764    cout<<endl;
23765    cout<<Form(" WARNING (QC): fIntFlowSquaredCorrelationsVsMPro[%d] is NULL in CheckPointersUsedInFinish() !!!!",ci)<<endl;
23766    cout<<endl;
23767    exit(0); 
23768   }  
23769   if(!fIntFlowCorrelationsVsMHist[ci])
23770   {
23771    cout<<endl;
23772    cout<<Form(" WARNING (QC): fIntFlowCorrelationsVsMHist[%d] is NULL in CheckPointersUsedInFinish() !!!!",ci)<<endl;
23773    cout<<endl;
23774    exit(0); 
23775   }
23776   for(Int_t power=0;power<2;power++) 
23777   {
23778    if(!fIntFlowSumOfEventWeightsVsM[ci][power])
23779    {
23780     cout<<endl;
23781     cout<<Form(" WARNING (QC): fIntFlowSumOfEventWeightsVsM[%d][%d] is NULL in CheckPointersUsedInFinish() !!!!",ci,power)<<endl;
23782     cout<<endl;
23783     exit(0);   
23784    }
23785   } // end of for(Int_t power=0;power<2;power++) 
23786  } // end of for(Int_t ci=0;ci<=3;ci++) // correlation index
23787  for(Int_t i=0;i<6;i++)
23788  {
23789   if(!fIntFlowProductOfCorrelationsVsMPro[i])
23790   {
23791    cout<<endl;
23792    cout<<Form(" WARNING (QC): fIntFlowProductOfCorrelationsVsMPro[%d] is NULL in CheckPointersUsedInFinish() !!!!",i)<<endl;
23793    cout<<endl;
23794    exit(0); 
23795   }
23796   if(!fIntFlowSumOfProductOfEventWeightsVsM[i])
23797   {
23798    cout<<endl;
23799    cout<<Form(" WARNING (QC): fIntFlowSumOfProductOfEventWeightsVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",i)<<endl;
23800    cout<<endl;
23801    exit(0); 
23802   }
23803   if(!fIntFlowCovariancesVsM[i])
23804   {
23805    cout<<endl;
23806    cout<<Form(" WARNING (QC): fIntFlowCovariancesVsM[%d] is NULL in CheckPointersUsedInFinish() !!!!",i)<<endl;
23807    cout<<endl;
23808    exit(0); 
23809   }
23810  } // end of for(Int_t i=0;i<6;i++) 
23811  if(!fIntFlowRebinnedInM)
23812  {
23813   cout<<endl;
23814   cout<<" WARNING (QC): fIntFlowRebinnedInM is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23815   cout<<endl;
23816   exit(0); 
23817  }
23818  if(!fIntFlowQcumulantsRebinnedInM)
23819  {
23820   cout<<endl;
23821   cout<<" WARNING (QC): fIntFlowQcumulantsRebinnedInM is NULL in CheckPointersUsedInFinish() !!!!"<<endl;
23822   cout<<endl;
23823   exit(0); 
23824  }  
23825  
23826 } // end of void AliFlowAnalysisWithQCumulants::CheckPointersUsedInFinish()
23827
23828 //=======================================================================================================================
23829
23830 void AliFlowAnalysisWithQCumulants::CheckPointersUsedInMake()
23831 {
23832  // Check all pointers used in method Make(). // to be improved - check other pointers as well
23833  
23834  if(!fAvMultiplicity)
23835  {
23836   printf("\n WARNING (QC): fAvMultiplicity is NULL in CheckPointersUsedInMake() !!!!\n\n");
23837   exit(0);
23838  }
23839  if((fUsePhiWeights||fUsePtWeights||fUseEtaWeights||fUseTrackWeights) && !fIntFlowExtraCorrelationsPro) 
23840  {
23841   printf("\n WARNING (QC): fIntFlowExtraCorrelationsPro is NULL in CheckPointersUsedInMake() !!!!\n\n");
23842   exit(0); 
23843  } 
23844  // 2D:
23845  if(fCalculate2DDiffFlow)
23846  {
23847   for(Int_t t=0;t<2;t++) // type = RP or POI
23848   { 
23849    for(Int_t rci=0;rci<4;rci++) // reduced correlation index
23850    {
23851     if(!f2DDiffFlowCorrelationsPro[t][rci])
23852     {
23853      printf("\n WARNING (QC): f2DDiffFlowCorrelationsPro[%i][%i] is NULL in CheckPointersUsedInMake() !!!!\n\n",t,rci);
23854      exit(0);     
23855     } // end of if(!f2DDiffFlowCorrelationsPro[t][rci])  
23856    } // end of for(Int_t rci=0;rci<4;rci++) // reduced correlation index
23857   } // end of for(Int_t t=0;t<2;t++)
23858  } // end of if(fCalculate2DDiffFlow)  
23859
23860 } // end of void AliFlowAnalysisWithQCumulants::CheckPointersUsedInMake()
23861  
23862