fix formatting for microsoft compiler
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 14 Nov 2009 11:45:07 +0000 (11:45 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 14 Nov 2009 11:45:07 +0000 (11:45 +0000)
PWG2/FLOW/AliFlowCommon/AliFlowAnalysisWithQCumulants.cxx

index 7f8a575..ed3e126 100644 (file)
-/*************************************************************************\r
-* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *\r
-*                                                                        *\r
-* Author: The ALICE Off-line Project.                                    *\r
-* Contributors are mentioned in the code where appropriate.              *\r
-*                                                                        *\r
-* Permission to use, copy, modify and distribute this software and its   *\r
-* documentation strictly for non-commercial purposes is hereby granted   *\r
-* without fee, provided that the above copyright notice appears in all   *\r
-* copies and that both the copyright notice and this permission notice   *\r
-* appear in the supporting documentation. The authors make no claims     *\r
-* about the suitability of this software for any purpose. It is          *\r
-* provided "as is" without express or implied warranty.                  * \r
-**************************************************************************/\r
-\r
-/********************************** \r
- * flow analysis with Q-cumulants * \r
- *                                * \r
- * author:  Ante Bilandzic        * \r
- *           (anteb@nikhef.nl)    *\r
- *********************************/ \r
-\r
-#define AliFlowAnalysisWithQCumulants_cxx\r
-\r
-#include "Riostream.h"\r
-#include "AliFlowCommonConstants.h"\r
-#include "AliFlowCommonHist.h"\r
-#include "AliFlowCommonHistResults.h"\r
+/*************************************************************************
+* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
+*                                                                        *
+* Author: The ALICE Off-line Project.                                    *
+* Contributors are mentioned in the code where appropriate.              *
+*                                                                        *
+* Permission to use, copy, modify and distribute this software and its   *
+* documentation strictly for non-commercial purposes is hereby granted   *
+* without fee, provided that the above copyright notice appears in all   *
+* copies and that both the copyright notice and this permission notice   *
+* appear in the supporting documentation. The authors make no claims     *
+* about the suitability of this software for any purpose. It is          *
+* provided "as is" without express or implied warranty.                  * 
+**************************************************************************/
+
+/********************************** 
+ * flow analysis with Q-cumulants * 
+ *                                * 
+ * author:  Ante Bilandzic        * 
+ *           (anteb@nikhef.nl)    *
+ *********************************/ 
+
+#define AliFlowAnalysisWithQCumulants_cxx
+
+#include "Riostream.h"
+#include "AliFlowCommonConstants.h"
+#include "AliFlowCommonHist.h"
+#include "AliFlowCommonHistResults.h"
 #include "TChain.h"
-\r
-#include "TFile.h"\r
-#include "TList.h"\r
-#include "TGraph.h"\r
-#include "TParticle.h"\r
-#include "TRandom3.h"\r
-#include "TStyle.h"\r
-#include "TProfile.h"\r
-#include "TProfile2D.h" \r
-#include "TProfile3D.h"\r
-#include "TMath.h"\r
-#include "TArrow.h"\r
-#include "TPaveLabel.h"\r
-#include "TCanvas.h"\r
-#include "AliFlowEventSimple.h"\r
-#include "AliFlowTrackSimple.h"\r
-#include "AliFlowAnalysisWithQCumulants.h"\r
-#include "TArrayD.h"\r
-#include "TRandom.h"\r
-#include "TF1.h"\r
-\r
-class TH1;\r
-class TH2;\r
-class TGraph;\r
-class TPave;\r
-class TLatex;\r
-class TMarker;\r
-class TRandom3;\r
-class TObjArray;\r
-class TList;\r
-class TCanvas;\r
-class TSystem;\r
-class TROOT;\r
-class AliFlowVector;\r
-class TVector;\r
-\r
-\r
-//================================================================================================================\r
-\r
-\r
-ClassImp(AliFlowAnalysisWithQCumulants)\r
-\r
-AliFlowAnalysisWithQCumulants::AliFlowAnalysisWithQCumulants(): \r
- // 0.) base:\r
- fHistList(NULL),\r
- // 1.) common:\r
- fCommonHists(NULL),\r
- fCommonHists2nd(NULL), \r
- fCommonHists4th(NULL),\r
- fCommonHists6th(NULL),\r
- fCommonHists8th(NULL),\r
- fCommonHistsResults2nd(NULL),\r
- fCommonHistsResults4th(NULL),\r
- fCommonHistsResults6th(NULL),\r
- fCommonHistsResults8th(NULL),\r
- fnBinsPhi(0),\r
- fPhiMin(0),\r
- fPhiMax(0),\r
- fPhiBinWidth(0),\r
- fnBinsPt(0),\r
- fPtMin(0),\r
- fPtMax(0),\r
- fPtBinWidth(0),\r
- fnBinsEta(0),\r
- fEtaMin(0),\r
- fEtaMax(0),\r
- fEtaBinWidth(0),\r
- fHarmonic(2),\r
- fAnalysisLabel(NULL),\r
- // 2.) weights:\r
- fWeightsList(NULL),\r
- fUsePhiWeights(kFALSE),\r
- fUsePtWeights(kFALSE),\r
- fUseEtaWeights(kFALSE),\r
- fUseParticleWeights(NULL),\r
- fPhiWeights(NULL),\r
- fPtWeights(NULL),\r
- fEtaWeights(NULL),\r
- // 3.) integrated flow:\r
- fIntFlowList(NULL), \r
- fIntFlowProfiles(NULL),\r
- fIntFlowResults(NULL),\r
- fIntFlowFlags(NULL),\r
- fApplyCorrectionForNUA(kTRUE), \r
- fReQ(NULL),\r
- fImQ(NULL),\r
- fSMpk(NULL),\r
- fIntFlowCorrelationsEBE(NULL),\r
- fIntFlowEventWeightsForCorrelationsEBE(NULL),\r
- fIntFlowCorrelationsAllEBE(NULL),\r
- fAvMultiplicity(NULL),\r
- fIntFlowCorrelationsPro(NULL),\r
+
+#include "TFile.h"
+#include "TList.h"
+#include "TGraph.h"
+#include "TParticle.h"
+#include "TRandom3.h"
+#include "TStyle.h"
+#include "TProfile.h"
+#include "TProfile2D.h" 
+#include "TProfile3D.h"
+#include "TMath.h"
+#include "TArrow.h"
+#include "TPaveLabel.h"
+#include "TCanvas.h"
+#include "AliFlowEventSimple.h"
+#include "AliFlowTrackSimple.h"
+#include "AliFlowAnalysisWithQCumulants.h"
+#include "TArrayD.h"
+#include "TRandom.h"
+#include "TF1.h"
+
+class TH1;
+class TH2;
+class TGraph;
+class TPave;
+class TLatex;
+class TMarker;
+class TRandom3;
+class TObjArray;
+class TList;
+class TCanvas;
+class TSystem;
+class TROOT;
+class AliFlowVector;
+class TVector;
+
+
+//================================================================================================================
+
+
+ClassImp(AliFlowAnalysisWithQCumulants)
+
+AliFlowAnalysisWithQCumulants::AliFlowAnalysisWithQCumulants(): 
+ // 0.) base:
+ fHistList(NULL),
+ // 1.) common:
+ fCommonHists(NULL),
+ fCommonHists2nd(NULL), 
+ fCommonHists4th(NULL),
+ fCommonHists6th(NULL),
+ fCommonHists8th(NULL),
+ fCommonHistsResults2nd(NULL),
+ fCommonHistsResults4th(NULL),
+ fCommonHistsResults6th(NULL),
+ fCommonHistsResults8th(NULL),
+ fnBinsPhi(0),
+ fPhiMin(0),
+ fPhiMax(0),
+ fPhiBinWidth(0),
+ fnBinsPt(0),
+ fPtMin(0),
+ fPtMax(0),
+ fPtBinWidth(0),
+ fnBinsEta(0),
+ fEtaMin(0),
+ fEtaMax(0),
+ fEtaBinWidth(0),
+ fHarmonic(2),
+ fAnalysisLabel(NULL),
+ // 2.) weights:
+ fWeightsList(NULL),
+ fUsePhiWeights(kFALSE),
+ fUsePtWeights(kFALSE),
+ fUseEtaWeights(kFALSE),
+ fUseParticleWeights(NULL),
+ fPhiWeights(NULL),
+ fPtWeights(NULL),
+ fEtaWeights(NULL),
+ // 3.) integrated flow:
+ fIntFlowList(NULL), 
+ fIntFlowProfiles(NULL),
+ fIntFlowResults(NULL),
+ fIntFlowFlags(NULL),
+ fApplyCorrectionForNUA(kTRUE), 
+ fReQ(NULL),
+ fImQ(NULL),
+ fSMpk(NULL),
+ fIntFlowCorrelationsEBE(NULL),
+ fIntFlowEventWeightsForCorrelationsEBE(NULL),
+ fIntFlowCorrelationsAllEBE(NULL),
+ fAvMultiplicity(NULL),
+ fIntFlowCorrelationsPro(NULL),
  fIntFlowCorrelationsAllPro(NULL),
- fIntFlowExtraCorrelationsPro(NULL),\r
- fIntFlowProductOfCorrelationsPro(NULL),\r
- fIntFlowCorrelationsHist(NULL),\r
- fIntFlowCorrelationsAllHist(NULL),\r
- fIntFlowCovariances(NULL),\r
- fIntFlowSumOfProductOfEventWeights(NULL),\r
- fIntFlowQcumulants(NULL),\r
- fIntFlow(NULL),\r
- // 4.) differential flow:\r
- fDiffFlowList(NULL),\r
- fDiffFlowProfiles(NULL),\r
- fDiffFlowResults(NULL),\r
- fDiffFlowFlags(NULL),\r
- fCalculate2DFlow(kFALSE),\r
- // 5.) distributions:\r
- fDistributionsList(NULL),\r
- // x.) debugging and cross-checking:\r
- fNestedLoopsList(NULL),\r
- fEvaluateIntFlowNestedLoops(kFALSE),\r
+ fIntFlowExtraCorrelationsPro(NULL),
+ fIntFlowProductOfCorrelationsPro(NULL),
+ fIntFlowCorrelationsHist(NULL),
+ fIntFlowCorrelationsAllHist(NULL),
+ fIntFlowCovariances(NULL),
+ fIntFlowSumOfProductOfEventWeights(NULL),
+ fIntFlowQcumulants(NULL),
+ fIntFlow(NULL),
+ // 4.) differential flow:
+ fDiffFlowList(NULL),
+ fDiffFlowProfiles(NULL),
+ fDiffFlowResults(NULL),
+ fDiffFlowFlags(NULL),
+ fCalculate2DFlow(kFALSE),
+ // 5.) distributions:
+ fDistributionsList(NULL),
+ // x.) debugging and cross-checking:
+ fNestedLoopsList(NULL),
+ fEvaluateIntFlowNestedLoops(kFALSE),
  fEvaluateDiffFlowNestedLoops(kFALSE),
- fMaxAllowedMultiplicity(10),\r
- fEvaluateNestedLoops(NULL),\r
- fIntFlowDirectCorrelations(NULL),\r
+ fMaxAllowedMultiplicity(10),
+ fEvaluateNestedLoops(NULL),
+ fIntFlowDirectCorrelations(NULL),
  fIntFlowExtraDirectCorrelations(NULL),
  fCrossCheckInPtBinNo(10),
  fCrossCheckInEtaBinNo(20)
- {\r
-  // constructor  \r
-  \r
-  // base list to hold all output objects:\r
-  fHistList = new TList();\r
-  fHistList->SetName("cobjQC");\r
-  fHistList->SetOwner(kTRUE);\r
-  \r
-  // list to hold histograms with phi, pt and eta weights:      \r
-  fWeightsList = new TList();\r
-    \r
-  // analysis label;\r
-  fAnalysisLabel = new TString();\r
-      \r
-  // initialize all arrays:  \r
-  this->InitializeArraysForIntFlow();\r
-  this->InitializeArraysForDiffFlow();\r
+ {
+  // constructor  
+  
+  // base list to hold all output objects:
+  fHistList = new TList();
+  fHistList->SetName("cobjQC");
+  fHistList->SetOwner(kTRUE);
+  
+  // list to hold histograms with phi, pt and eta weights:      
+  fWeightsList = new TList();
+    
+  // analysis label;
+  fAnalysisLabel = new TString();
+      
+  // initialize all arrays:  
+  this->InitializeArraysForIntFlow();
+  this->InitializeArraysForDiffFlow();
   this->InitializeArraysForDistributions();
-  this->InitializeArraysForNestedLoops();\r
-  \r
- } // end of constructor\r
\r
-\r
-//================================================================================================================  \r
-\r
-\r
-AliFlowAnalysisWithQCumulants::~AliFlowAnalysisWithQCumulants()\r
-{\r
- // destructor\r
\r
- delete fHistList;\r
-\r
-} // end of AliFlowAnalysisWithQCumulants::~AliFlowAnalysisWithQCumulants()\r
-\r
-\r
-//================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::Init()\r
-{\r
- // a) Access all common constants;\r
- // b) Book all objects;\r
- // c) Store flags for integrated and differential flow;\r
- // d) Store harmonic which will be estimated.\r
-  \r
- // a) Access all common constants:\r
- this->AccessConstants();\r
\r
- // b) Book all objects:\r
- this->BookAndFillWeightsHistograms();\r
- this->BookAndNestAllLists();\r
- this->BookCommonHistograms();\r
- this->BookEverythingForIntegratedFlow(); \r
- this->BookEverythingForDifferentialFlow(); \r
- this->BookEverythingForDistributions();\r
- this->BookEverythingForNestedLoops();\r
\r
- // c) Store flags for integrated and differential flow:\r
- this->StoreIntFlowFlags();\r
- this->StoreDiffFlowFlags();\r
-\r
- // d) Store harmonic which will be estimated:\r
- this->StoreHarmonic();\r
\r
-} // end of void AliFlowAnalysisWithQCumulants::Init()\r
-\r
-\r
-//================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::Make(AliFlowEventSimple* anEvent)\r
-{\r
- // Running over data only in this method.\r
\r
- //  a) Fill the common control histograms and call the method to fill fAvMultiplicity;\r
- //  b) Loop over data and calculate e-b-e quantities;\r
- //  c) call the methods;\r
- //  d) Debugging and cross-checking (evaluate nested loops);\r
- //  e) Reset all event by event quantities. \r
\r
- Double_t dPhi = 0.; // azimuthal angle in the laboratory frame\r
- Double_t dPt  = 0.; // transverse momentum\r
- Double_t dEta = 0.; // pseudorapidity\r
-\r
- Double_t wPhi = 1.; // phi weight\r
- Double_t wPt  = 1.; // pt weight\r
- Double_t wEta = 1.; // eta weight\r
\r
- Int_t nRP = anEvent->GetEventNSelTracksRP(); // number of RPs (i.e. number of particles used to determine the reaction plane)\r
\r
- // a) Fill the common control histograms and call the method to fill fAvMultiplicity:\r
- this->FillCommonControlHistograms(anEvent);                                                               \r
- this->FillAverageMultiplicities(nRP);                                                                  \r
-                                                                                                                                                                                                                                                                                        \r
- // b) Loop over data and calculate e-b-e quantities:\r
- Int_t nPrim = anEvent->NumberOfTracks();  // nPrim = total number of primary tracks, i.e. nPrim = nRP + nPOI + rest, where:\r
-                                           // nRP   = # of particles used to determine the reaction plane;\r
-                                           // nPOI  = # of particles of interest for a detailed flow analysis;\r
-                                           // rest  = # of particles which are not niether RPs nor POIs.  \r
\r
- AliFlowTrackSimple *aftsTrack = NULL;\r
\r
- for(Int_t i=0;i<nPrim;i++) \r
- { \r
-  aftsTrack=anEvent->GetTrack(i);\r
-  if(aftsTrack)\r
-  {\r
-   if(!(aftsTrack->InRPSelection() || aftsTrack->InPOISelection())) continue; // consider only tracks which are RPs or POIs\r
-   Int_t n = fHarmonic; // shortcut for the harmonic\r
-   if(aftsTrack->InRPSelection()) // RP condition:\r
-   {    \r
-    dPhi = aftsTrack->Phi();\r
-    dPt  = aftsTrack->Pt();\r
-    dEta = aftsTrack->Eta();\r
-    if(fUsePhiWeights && fPhiWeights && fnBinsPhi) // determine phi weight for this particle:\r
-    {\r
-     wPhi = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*fnBinsPhi/TMath::TwoPi())));\r
-    }\r
-    if(fUsePtWeights && fPtWeights && fnBinsPt) // determine pt weight for this particle:\r
-    {\r
-     wPt = fPtWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-fPtMin)/fPtBinWidth))); \r
-    }              \r
-    if(fUseEtaWeights && fEtaWeights && fEtaBinWidth) // determine eta weight for this particle: \r
-    {\r
-     wEta = fEtaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-fEtaMin)/fEtaBinWidth))); \r
-    } \r
-      \r
-    // integrated flow: \r
-    // calculate Re[Q_{m*n,k}] and Im[Q_{m*n,k}], m = 1,2,3,4, for this event:\r
-    for(Int_t m=0;m<4;m++)\r
-    {\r
-     for(Int_t k=0;k<9;k++)\r
-     {\r
-      (*fReQ)(m,k)+=pow(wPhi*wPt*wEta,k)*TMath::Cos((m+1)*n*dPhi); \r
-      (*fImQ)(m,k)+=pow(wPhi*wPt*wEta,k)*TMath::Sin((m+1)*n*dPhi); \r
-     } \r
-    }\r
-    // calculate S^{M}_{p,k} for this event \r
-    // Remark: final calculation of S^{M}_{p,k} follows after the loop over data bellow:\r
-    for(Int_t p=0;p<8;p++)\r
-    {\r
-     for(Int_t k=0;k<9;k++)\r
-     {     \r
-      (*fSMpk)(p,k)+=pow(wPhi*wPt*wEta,k);\r
-     }\r
-    } \r
-    \r
-    // differential flow:\r
-    // 1D (pt):\r
-    // (r_{m*m,k}(pt)): \r
-    for(Int_t m=0;m<4;m++)\r
-    {\r
-     for(Int_t k=0;k<9;k++)\r
-     {\r
-      fReRPQ1dEBE[0][0][m][k]->Fill(dPt,pow(wPhi*wPt*wEta,k)*TMath::Cos((m+1.)*n*dPhi),1.);\r
-      fImRPQ1dEBE[0][0][m][k]->Fill(dPt,pow(wPhi*wPt*wEta,k)*TMath::Sin((m+1.)*n*dPhi),1.);\r
-     }\r
-    }\r
-           \r
-    // s_{k}(pt) for RPs // to be improved (clarified)\r
-    // Remark: final calculation of s_{p,k}(pt) follows after the loop over data bellow:\r
-    for(Int_t k=0;k<9;k++)\r
-    {\r
-     fs1dEBE[0][0][k]->Fill(dPt,pow(wPhi*wPt*wEta,k),1.);\r
-    }\r
-    // 1D (eta):\r
-    // (r_{m*m,k}(eta)): \r
-    for(Int_t m=0;m<4;m++)\r
-    {\r
-     for(Int_t k=0;k<9;k++)\r
-     {\r
-      fReRPQ1dEBE[0][1][m][k]->Fill(dEta,pow(wPhi*wPt*wEta,k)*TMath::Cos((m+1.)*n*dPhi),1.);\r
-      fImRPQ1dEBE[0][1][m][k]->Fill(dEta,pow(wPhi*wPt*wEta,k)*TMath::Sin((m+1.)*n*dPhi),1.);\r
-     }\r
-    }   \r
-    // s_{k}(eta) for RPs // to be improved (clarified)\r
-    // Remark: final calculation of s_{p,k}(eta) follows after the loop over data bellow:\r
-    for(Int_t k=0;k<9;k++)\r
-    {\r
-     fs1dEBE[0][1][k]->Fill(dEta,pow(wPhi*wPt*wEta,k),1.);\r
-    }\r
-    \r
-    \r
-    \r
-    /*\r
-    // 2D (pt,eta):\r
-    if(fCalculate2DFlow)\r
-    {\r
-     // (r_{m*m,k}(pt,eta)): \r
-     for(Int_t m=0;m<4;m++)\r
-     {\r
-      for(Int_t k=0;k<9;k++)\r
-      {\r
-       fReRPQ2dEBE[0][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta,k)*TMath::Cos((m+1.)*n*dPhi),1.);\r
-       fImRPQ2dEBE[0][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta,k)*TMath::Sin((m+1.)*n*dPhi),1.);\r
-      }\r
-     }    \r
-     // s_{k}(pt,eta) for RPs // to be improved (clarified)\r
-     // Remark: final calculation of s_{p,k}(pt,eta) follows after the loop over data bellow:\r
-     for(Int_t k=0;k<9;k++)\r
-     {\r
-      fs2dEBE[0][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta,k),1.);\r
-     }\r
-    } // end of if(fCalculate2DFlow)  \r
-    */ \r
-    \r
-      \r
-     \r
-    if(aftsTrack->InPOISelection())\r
-    {\r
-     // 1D (pt): \r
-     // (q_{m*m,k}(pt)): \r
-     for(Int_t m=0;m<4;m++)\r
-     {\r
-      for(Int_t k=0;k<9;k++)\r
-      {\r
-       fReRPQ1dEBE[2][0][m][k]->Fill(dPt,pow(wPhi*wPt*wEta,k)*TMath::Cos((m+1.)*n*dPhi),1.);\r
-       fImRPQ1dEBE[2][0][m][k]->Fill(dPt,pow(wPhi*wPt*wEta,k)*TMath::Sin((m+1.)*n*dPhi),1.);\r
-      }\r
-     } \r
-     // s_{k}(pt) for RP&&POIs // to be improved (clarified)\r
-     // Remark: final calculation of s_{p,k}(pt,eta) follows after the loop over data bellow:\r
-     for(Int_t k=0;k<9;k++)\r
-     {\r
-      fs1dEBE[2][0][k]->Fill(dPt,pow(wPhi*wPt*wEta,k),1.);\r
-     }\r
-     // 1D (eta): \r
-     // (q_{m*m,k}(eta)): \r
-     for(Int_t m=0;m<4;m++)\r
-     {\r
-      for(Int_t k=0;k<9;k++)\r
-      {\r
-       fReRPQ1dEBE[2][1][m][k]->Fill(dEta,pow(wPhi*wPt*wEta,k)*TMath::Cos((m+1.)*n*dPhi),1.);\r
-       fImRPQ1dEBE[2][1][m][k]->Fill(dEta,pow(wPhi*wPt*wEta,k)*TMath::Sin((m+1.)*n*dPhi),1.);\r
-      }\r
-     } \r
-     // s_{k}(eta) for RP&&POIs // to be improved (clarified)\r
-     // Remark: final calculation of s_{p,k}(pt,eta) follows after the loop over data bellow:\r
-     for(Int_t k=0;k<9;k++)\r
-     {\r
-      fs1dEBE[2][1][k]->Fill(dEta,pow(wPhi*wPt*wEta,k),1.);\r
-     }\r
-     \r
-     /*\r
-     // 2D (pt,eta) \r
-     if(fCalculate2DFlow)\r
-     {\r
-      // (q_{m*m,k}(pt,eta)): \r
-      for(Int_t m=0;m<4;m++)\r
-      {\r
-       for(Int_t k=0;k<9;k++)\r
-       {\r
-        fReRPQ2dEBE[2][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta,k)*TMath::Cos((m+1.)*n*dPhi),1.);\r
-        fImRPQ2dEBE[2][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta,k)*TMath::Sin((m+1.)*n*dPhi),1.);\r
-       }\r
-      } \r
-      // s_{k}(pt,eta) for RP&&POIs // to be improved (clarified)\r
-      // Remark: final calculation of s_{p,k}(pt,eta) follows after the loop over data bellow:\r
-      for(Int_t k=0;k<9;k++)\r
-      {\r
-       fs2dEBE[2][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta,k),1.);\r
-      }\r
-     } // end of if(fCalculate2DFlow) \r
-     */\r
-      \r
-    } // end of if(aftsTrack->InPOISelection())\r
-    \r
-\r
-     \r
-   } // end of if(pTrack->InRPSelection())\r
-\r
-  \r
-  \r
-   if(aftsTrack->InPOISelection())\r
-   {\r
-    dPhi = aftsTrack->Phi();\r
-    dPt  = aftsTrack->Pt();\r
-    dEta = aftsTrack->Eta();\r
-    \r
-    // 1D (pt)\r
-    // p_n(m*n,0):   \r
-    for(Int_t m=0;m<4;m++)\r
-    {\r
-     fReRPQ1dEBE[1][0][m][0]->Fill(dPt,TMath::Cos((m+1.)*n*dPhi),1.);\r
-     fImRPQ1dEBE[1][0][m][0]->Fill(dPt,TMath::Sin((m+1.)*n*dPhi),1.);\r
-    }\r
-    // 1D (eta)\r
-    // p_n(m*n,0):   \r
-    for(Int_t m=0;m<4;m++)\r
-    {\r
-     fReRPQ1dEBE[1][1][m][0]->Fill(dEta,TMath::Cos((m+1.)*n*dPhi),1.);\r
-     fImRPQ1dEBE[1][1][m][0]->Fill(dEta,TMath::Sin((m+1.)*n*dPhi),1.);\r
-    }\r
-    \r
-    \r
-    /*\r
-    // 2D (pt,eta):\r
-    if(fCalculate2DFlow)\r
-    {      \r
-     // p_n(m*n,0):   \r
-     for(Int_t m=0;m<4;m++)\r
-     {\r
-      fReRPQ2dEBE[1][m][0]->Fill(dPt,dEta,TMath::Cos((m+1.)*n*dPhi),1.);\r
-      fImRPQ2dEBE[1][m][0]->Fill(dPt,dEta,TMath::Sin((m+1.)*n*dPhi),1.);\r
-     }\r
-    } // end of if(fCalculate2DFlow)  \r
-    */\r
-    \r
-    \r
-   } // end of if(pTrack->InPOISelection() )   \r
\r
-  \r
-  } else // to if(aftsTrack)\r
-    {\r
-     cout<<endl;\r
-     cout<<" WARNING: no particle! (i.e. aftsTrack is a NULL pointer in AFAWQC::Make().)"<<endl;\r
-     cout<<endl;       \r
-    }\r
- } // end of for(Int_t i=0;i<nPrim;i++) \r
-\r
- // calculate the final expressions for S^{M}_{p,k}:\r
- for(Int_t p=0;p<8;p++)\r
- {\r
-  for(Int_t k=0;k<9;k++)\r
-  {\r
-   (*fSMpk)(p,k)=pow((*fSMpk)(p,k),p+1);\r
-  }  \r
- } \r
\r
- // *****************************\r
- // **** CALL THE METHODS *******\r
- // *****************************\r
- // integrated flow:\r
- if(!fEvaluateIntFlowNestedLoops)\r
- {\r
-  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights))\r
-  {\r
-   if(nRP>1) this->CalculateIntFlowCorrelations(); // without using particle weights\r
-  } else \r
-    {\r
-     if(nRP>1) this->CalculateIntFlowCorrelationsUsingParticleWeights(); // with using particle weights   \r
-    } \r
-       \r
-  if(nRP>3) this->CalculateIntFlowProductOfCorrelations();\r
-  if(nRP>1) this->CalculateIntFlowSumOfEventWeights();\r
-  if(nRP>1) this->CalculateIntFlowSumOfProductOfEventWeights();\r
-  if(fApplyCorrectionForNUA && !(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)) // to be improved (enable correction for NUA also when particle weights are used?)\r
-  {\r
-   if(nRP>0) this->CalculateIntFlowCorrectionsForNUASinTerms();\r
-   if(nRP>0) this->CalculateIntFlowCorrectionsForNUACosTerms();\r
-  }\r
- } // end of if(!fEvaluateIntFlowNestedLoops)\r
-\r
- // differential flow:\r
- if(!fEvaluateDiffFlowNestedLoops)\r
- {\r
-  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights))\r
-  {\r
-   if(nRP>1) // to be improved (move this if somewhere else)\r
-   {\r
-    // without using particle weights:\r
-    this->CalculateDiffFlowCorrelations("RP","Pt"); \r
-    this->CalculateDiffFlowCorrelations("RP","Eta");\r
-    this->CalculateDiffFlowCorrelations("POI","Pt");\r
-    this->CalculateDiffFlowCorrelations("POI","Eta");\r
-   }  \r
-  } else\r
-    {\r
-     // with using particle weights:   \r
-     this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Pt"); \r
-     this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Eta"); \r
-     this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Pt"); \r
-     this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Eta"); \r
-    } \r
-    \r
-  this->CalculateDiffFlowProductOfCorrelations("RP","Pt");\r
-  this->CalculateDiffFlowProductOfCorrelations("RP","Eta");\r
-  this->CalculateDiffFlowProductOfCorrelations("POI","Pt");\r
-  this->CalculateDiffFlowProductOfCorrelations("POI","Eta");\r
-  this->CalculateDiffFlowSumOfEventWeights("RP","Pt");\r
-  this->CalculateDiffFlowSumOfEventWeights("RP","Eta");\r
-  this->CalculateDiffFlowSumOfEventWeights("POI","Pt");\r
-  this->CalculateDiffFlowSumOfEventWeights("POI","Eta");\r
-  this->CalculateDiffFlowSumOfProductOfEventWeights("RP","Pt");\r
-  this->CalculateDiffFlowSumOfProductOfEventWeights("RP","Eta");\r
-  this->CalculateDiffFlowSumOfProductOfEventWeights("POI","Pt");\r
-  this->CalculateDiffFlowSumOfProductOfEventWeights("POI","Eta");\r
-  if(fApplyCorrectionForNUA && !(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)) // to be improved (enable correction for NUA also when particle weights are used?)\r
-  {\r
-   this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Pt");\r
-   this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Eta");\r
-   this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Pt");\r
-   this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Eta");\r
-   this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Pt");\r
-   this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Eta");\r
-   this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Pt");\r
-   this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Eta");\r
-  }\r
-  \r
- } // end of if(!fEvaluateDiffFlowNestedLoops)\r
-\r
-\r
-   \r
-  // with weights:\r
-  // ... \r
-  \r
-  /*\r
-  // 2D differential flow\r
-  if(fCalculate2DFlow)\r
-  {\r
-   // without weights:\r
-   if(nRP>1) this->CalculateCorrelationsForDifferentialFlow2D("RP");\r
-   if(nRP>1) this->CalculateCorrelationsForDifferentialFlow2D("POI");\r
-  \r
-   // with weights:\r
-   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)\r
-   {\r
-    if(nRP>1) this->CalculateWeightedCorrelationsForDifferentialFlow2D("RP");\r
-    if(nRP>1) this->CalculateWeightedCorrelationsForDifferentialFlow2D("POI");\r
-   } \r
-  } // end of if(fCalculate2DFlow)\r
-  */\r
-  \r
\r
- // d) Debugging and cross-checking (evaluate nested loops):\r
+  this->InitializeArraysForNestedLoops();
+  
+ } // end of constructor
+
+//================================================================================================================  
+
+
+AliFlowAnalysisWithQCumulants::~AliFlowAnalysisWithQCumulants()
+{
+ // destructor
+ delete fHistList;
+
+} // end of AliFlowAnalysisWithQCumulants::~AliFlowAnalysisWithQCumulants()
+
+
+//================================================================================================================
+
+
+void AliFlowAnalysisWithQCumulants::Init()
+{
+ // a) Access all common constants;
+ // b) Book all objects;
+ // c) Store flags for integrated and differential flow;
+ // d) Store harmonic which will be estimated.
+  
+ // a) Access all common constants:
+ this->AccessConstants();
+ // b) Book all objects:
+ this->BookAndFillWeightsHistograms();
+ this->BookAndNestAllLists();
+ this->BookCommonHistograms();
+ this->BookEverythingForIntegratedFlow(); 
+ this->BookEverythingForDifferentialFlow(); 
+ this->BookEverythingForDistributions();
+ this->BookEverythingForNestedLoops();
+ // c) Store flags for integrated and differential flow:
+ this->StoreIntFlowFlags();
+ this->StoreDiffFlowFlags();
+
+ // d) Store harmonic which will be estimated:
+ this->StoreHarmonic();
+} // end of void AliFlowAnalysisWithQCumulants::Init()
+
+
+//================================================================================================================
+
+
+void AliFlowAnalysisWithQCumulants::Make(AliFlowEventSimple* anEvent)
+{
+ // Running over data only in this method.
+ //  a) Fill the common control histograms and call the method to fill fAvMultiplicity;
+ //  b) Loop over data and calculate e-b-e quantities;
+ //  c) call the methods;
+ //  d) Debugging and cross-checking (evaluate nested loops);
+ //  e) Reset all event by event quantities. 
+ Double_t dPhi = 0.; // azimuthal angle in the laboratory frame
+ Double_t dPt  = 0.; // transverse momentum
+ Double_t dEta = 0.; // pseudorapidity
+
+ Double_t wPhi = 1.; // phi weight
+ Double_t wPt  = 1.; // pt weight
+ Double_t wEta = 1.; // eta weight
+ Int_t nRP = anEvent->GetEventNSelTracksRP(); // number of RPs (i.e. number of particles used to determine the reaction plane)
+ // a) Fill the common control histograms and call the method to fill fAvMultiplicity:
+ this->FillCommonControlHistograms(anEvent);                                                               
+ this->FillAverageMultiplicities(nRP);                                                                  
+                                                                                                                                                                                                                                                                                        
+ // b) Loop over data and calculate e-b-e quantities:
+ Int_t nPrim = anEvent->NumberOfTracks();  // nPrim = total number of primary tracks, i.e. nPrim = nRP + nPOI + rest, where:
+                                           // nRP   = # of particles used to determine the reaction plane;
+                                           // nPOI  = # of particles of interest for a detailed flow analysis;
+                                           // rest  = # of particles which are not niether RPs nor POIs.  
+ AliFlowTrackSimple *aftsTrack = NULL;
+ for(Int_t i=0;i<nPrim;i++) 
+ { 
+  aftsTrack=anEvent->GetTrack(i);
+  if(aftsTrack)
+  {
+   if(!(aftsTrack->InRPSelection() || aftsTrack->InPOISelection())) continue; // consider only tracks which are RPs or POIs
+   Int_t n = fHarmonic; // shortcut for the harmonic
+   if(aftsTrack->InRPSelection()) // RP condition:
+   {    
+    dPhi = aftsTrack->Phi();
+    dPt  = aftsTrack->Pt();
+    dEta = aftsTrack->Eta();
+    if(fUsePhiWeights && fPhiWeights && fnBinsPhi) // determine phi weight for this particle:
+    {
+     wPhi = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*fnBinsPhi/TMath::TwoPi())));
+    }
+    if(fUsePtWeights && fPtWeights && fnBinsPt) // determine pt weight for this particle:
+    {
+     wPt = fPtWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-fPtMin)/fPtBinWidth))); 
+    }              
+    if(fUseEtaWeights && fEtaWeights && fEtaBinWidth) // determine eta weight for this particle: 
+    {
+     wEta = fEtaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-fEtaMin)/fEtaBinWidth))); 
+    } 
+      
+    // integrated flow: 
+    // calculate Re[Q_{m*n,k}] and Im[Q_{m*n,k}], m = 1,2,3,4, for this event:
+    for(Int_t m=0;m<4;m++)
+    {
+     for(Int_t k=0;k<9;k++)
+     {
+      (*fReQ)(m,k)+=pow(wPhi*wPt*wEta,k)*TMath::Cos((m+1)*n*dPhi); 
+      (*fImQ)(m,k)+=pow(wPhi*wPt*wEta,k)*TMath::Sin((m+1)*n*dPhi); 
+     } 
+    }
+    // calculate S^{M}_{p,k} for this event 
+    // Remark: final calculation of S^{M}_{p,k} follows after the loop over data bellow:
+    for(Int_t p=0;p<8;p++)
+    {
+     for(Int_t k=0;k<9;k++)
+     {     
+      (*fSMpk)(p,k)+=pow(wPhi*wPt*wEta,k);
+     }
+    } 
+    
+    // differential flow:
+    // 1D (pt):
+    // (r_{m*m,k}(pt)): 
+    for(Int_t m=0;m<4;m++)
+    {
+     for(Int_t k=0;k<9;k++)
+     {
+      fReRPQ1dEBE[0][0][m][k]->Fill(dPt,pow(wPhi*wPt*wEta,k)*TMath::Cos((m+1.)*n*dPhi),1.);
+      fImRPQ1dEBE[0][0][m][k]->Fill(dPt,pow(wPhi*wPt*wEta,k)*TMath::Sin((m+1.)*n*dPhi),1.);
+     }
+    }
+           
+    // s_{k}(pt) for RPs // to be improved (clarified)
+    // Remark: final calculation of s_{p,k}(pt) follows after the loop over data bellow:
+    for(Int_t k=0;k<9;k++)
+    {
+     fs1dEBE[0][0][k]->Fill(dPt,pow(wPhi*wPt*wEta,k),1.);
+    }
+    // 1D (eta):
+    // (r_{m*m,k}(eta)): 
+    for(Int_t m=0;m<4;m++)
+    {
+     for(Int_t k=0;k<9;k++)
+     {
+      fReRPQ1dEBE[0][1][m][k]->Fill(dEta,pow(wPhi*wPt*wEta,k)*TMath::Cos((m+1.)*n*dPhi),1.);
+      fImRPQ1dEBE[0][1][m][k]->Fill(dEta,pow(wPhi*wPt*wEta,k)*TMath::Sin((m+1.)*n*dPhi),1.);
+     }
+    }   
+    // s_{k}(eta) for RPs // to be improved (clarified)
+    // Remark: final calculation of s_{p,k}(eta) follows after the loop over data bellow:
+    for(Int_t k=0;k<9;k++)
+    {
+     fs1dEBE[0][1][k]->Fill(dEta,pow(wPhi*wPt*wEta,k),1.);
+    }
+    
+    
+    
+    /*
+    // 2D (pt,eta):
+    if(fCalculate2DFlow)
+    {
+     // (r_{m*m,k}(pt,eta)): 
+     for(Int_t m=0;m<4;m++)
+     {
+      for(Int_t k=0;k<9;k++)
+      {
+       fReRPQ2dEBE[0][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta,k)*TMath::Cos((m+1.)*n*dPhi),1.);
+       fImRPQ2dEBE[0][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta,k)*TMath::Sin((m+1.)*n*dPhi),1.);
+      }
+     }    
+     // s_{k}(pt,eta) for RPs // to be improved (clarified)
+     // Remark: final calculation of s_{p,k}(pt,eta) follows after the loop over data bellow:
+     for(Int_t k=0;k<9;k++)
+     {
+      fs2dEBE[0][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta,k),1.);
+     }
+    } // end of if(fCalculate2DFlow)  
+    */ 
+    
+      
+     
+    if(aftsTrack->InPOISelection())
+    {
+     // 1D (pt): 
+     // (q_{m*m,k}(pt)): 
+     for(Int_t m=0;m<4;m++)
+     {
+      for(Int_t k=0;k<9;k++)
+      {
+       fReRPQ1dEBE[2][0][m][k]->Fill(dPt,pow(wPhi*wPt*wEta,k)*TMath::Cos((m+1.)*n*dPhi),1.);
+       fImRPQ1dEBE[2][0][m][k]->Fill(dPt,pow(wPhi*wPt*wEta,k)*TMath::Sin((m+1.)*n*dPhi),1.);
+      }
+     } 
+     // s_{k}(pt) for RP&&POIs // to be improved (clarified)
+     // Remark: final calculation of s_{p,k}(pt,eta) follows after the loop over data bellow:
+     for(Int_t k=0;k<9;k++)
+     {
+      fs1dEBE[2][0][k]->Fill(dPt,pow(wPhi*wPt*wEta,k),1.);
+     }
+     // 1D (eta): 
+     // (q_{m*m,k}(eta)): 
+     for(Int_t m=0;m<4;m++)
+     {
+      for(Int_t k=0;k<9;k++)
+      {
+       fReRPQ1dEBE[2][1][m][k]->Fill(dEta,pow(wPhi*wPt*wEta,k)*TMath::Cos((m+1.)*n*dPhi),1.);
+       fImRPQ1dEBE[2][1][m][k]->Fill(dEta,pow(wPhi*wPt*wEta,k)*TMath::Sin((m+1.)*n*dPhi),1.);
+      }
+     } 
+     // s_{k}(eta) for RP&&POIs // to be improved (clarified)
+     // Remark: final calculation of s_{p,k}(pt,eta) follows after the loop over data bellow:
+     for(Int_t k=0;k<9;k++)
+     {
+      fs1dEBE[2][1][k]->Fill(dEta,pow(wPhi*wPt*wEta,k),1.);
+     }
+     
+     /*
+     // 2D (pt,eta) 
+     if(fCalculate2DFlow)
+     {
+      // (q_{m*m,k}(pt,eta)): 
+      for(Int_t m=0;m<4;m++)
+      {
+       for(Int_t k=0;k<9;k++)
+       {
+        fReRPQ2dEBE[2][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta,k)*TMath::Cos((m+1.)*n*dPhi),1.);
+        fImRPQ2dEBE[2][m][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta,k)*TMath::Sin((m+1.)*n*dPhi),1.);
+       }
+      } 
+      // s_{k}(pt,eta) for RP&&POIs // to be improved (clarified)
+      // Remark: final calculation of s_{p,k}(pt,eta) follows after the loop over data bellow:
+      for(Int_t k=0;k<9;k++)
+      {
+       fs2dEBE[2][k]->Fill(dPt,dEta,pow(wPhi*wPt*wEta,k),1.);
+      }
+     } // end of if(fCalculate2DFlow) 
+     */
+      
+    } // end of if(aftsTrack->InPOISelection())
+    
+
+     
+   } // end of if(pTrack->InRPSelection())
+
+  
+  
+   if(aftsTrack->InPOISelection())
+   {
+    dPhi = aftsTrack->Phi();
+    dPt  = aftsTrack->Pt();
+    dEta = aftsTrack->Eta();
+    
+    // 1D (pt)
+    // p_n(m*n,0):   
+    for(Int_t m=0;m<4;m++)
+    {
+     fReRPQ1dEBE[1][0][m][0]->Fill(dPt,TMath::Cos((m+1.)*n*dPhi),1.);
+     fImRPQ1dEBE[1][0][m][0]->Fill(dPt,TMath::Sin((m+1.)*n*dPhi),1.);
+    }
+    // 1D (eta)
+    // p_n(m*n,0):   
+    for(Int_t m=0;m<4;m++)
+    {
+     fReRPQ1dEBE[1][1][m][0]->Fill(dEta,TMath::Cos((m+1.)*n*dPhi),1.);
+     fImRPQ1dEBE[1][1][m][0]->Fill(dEta,TMath::Sin((m+1.)*n*dPhi),1.);
+    }
+    
+    
+    /*
+    // 2D (pt,eta):
+    if(fCalculate2DFlow)
+    {      
+     // p_n(m*n,0):   
+     for(Int_t m=0;m<4;m++)
+     {
+      fReRPQ2dEBE[1][m][0]->Fill(dPt,dEta,TMath::Cos((m+1.)*n*dPhi),1.);
+      fImRPQ2dEBE[1][m][0]->Fill(dPt,dEta,TMath::Sin((m+1.)*n*dPhi),1.);
+     }
+    } // end of if(fCalculate2DFlow)  
+    */
+    
+    
+   } // end of if(pTrack->InPOISelection() )   
+  
+  } else // to if(aftsTrack)
+    {
+     cout<<endl;
+     cout<<" WARNING: no particle! (i.e. aftsTrack is a NULL pointer in AFAWQC::Make().)"<<endl;
+     cout<<endl;       
+    }
+ } // end of for(Int_t i=0;i<nPrim;i++) 
+
+ // calculate the final expressions for S^{M}_{p,k}:
+ for(Int_t p=0;p<8;p++)
+ {
+  for(Int_t k=0;k<9;k++)
+  {
+   (*fSMpk)(p,k)=pow((*fSMpk)(p,k),p+1);
+  }  
+ } 
+ // *****************************
+ // **** CALL THE METHODS *******
+ // *****************************
+ // integrated flow:
+ if(!fEvaluateIntFlowNestedLoops)
+ {
+  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights))
+  {
+   if(nRP>1) this->CalculateIntFlowCorrelations(); // without using particle weights
+  } else 
+    {
+     if(nRP>1) this->CalculateIntFlowCorrelationsUsingParticleWeights(); // with using particle weights   
+    } 
+       
+  if(nRP>3) this->CalculateIntFlowProductOfCorrelations();
+  if(nRP>1) this->CalculateIntFlowSumOfEventWeights();
+  if(nRP>1) this->CalculateIntFlowSumOfProductOfEventWeights();
+  if(fApplyCorrectionForNUA && !(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)) // to be improved (enable correction for NUA also when particle weights are used?)
+  {
+   if(nRP>0) this->CalculateIntFlowCorrectionsForNUASinTerms();
+   if(nRP>0) this->CalculateIntFlowCorrectionsForNUACosTerms();
+  }
+ } // end of if(!fEvaluateIntFlowNestedLoops)
+
+ // differential flow:
+ if(!fEvaluateDiffFlowNestedLoops)
+ {
+  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights))
+  {
+   if(nRP>1) // to be improved (move this if somewhere else)
+   {
+    // without using particle weights:
+    this->CalculateDiffFlowCorrelations("RP","Pt"); 
+    this->CalculateDiffFlowCorrelations("RP","Eta");
+    this->CalculateDiffFlowCorrelations("POI","Pt");
+    this->CalculateDiffFlowCorrelations("POI","Eta");
+   }  
+  } else
+    {
+     // with using particle weights:   
+     this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Pt"); 
+     this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Eta"); 
+     this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Pt"); 
+     this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Eta"); 
+    } 
+    
+  this->CalculateDiffFlowProductOfCorrelations("RP","Pt");
+  this->CalculateDiffFlowProductOfCorrelations("RP","Eta");
+  this->CalculateDiffFlowProductOfCorrelations("POI","Pt");
+  this->CalculateDiffFlowProductOfCorrelations("POI","Eta");
+  this->CalculateDiffFlowSumOfEventWeights("RP","Pt");
+  this->CalculateDiffFlowSumOfEventWeights("RP","Eta");
+  this->CalculateDiffFlowSumOfEventWeights("POI","Pt");
+  this->CalculateDiffFlowSumOfEventWeights("POI","Eta");
+  this->CalculateDiffFlowSumOfProductOfEventWeights("RP","Pt");
+  this->CalculateDiffFlowSumOfProductOfEventWeights("RP","Eta");
+  this->CalculateDiffFlowSumOfProductOfEventWeights("POI","Pt");
+  this->CalculateDiffFlowSumOfProductOfEventWeights("POI","Eta");
+  if(fApplyCorrectionForNUA && !(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)) // to be improved (enable correction for NUA also when particle weights are used?)
+  {
+   this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Pt");
+   this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Eta");
+   this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Pt");
+   this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Eta");
+   this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Pt");
+   this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Eta");
+   this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Pt");
+   this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Eta");
+  }
+  
+ } // end of if(!fEvaluateDiffFlowNestedLoops)
+
+
+   
+  // with weights:
+  // ... 
+  
+  /*
+  // 2D differential flow
+  if(fCalculate2DFlow)
+  {
+   // without weights:
+   if(nRP>1) this->CalculateCorrelationsForDifferentialFlow2D("RP");
+   if(nRP>1) this->CalculateCorrelationsForDifferentialFlow2D("POI");
+  
+   // with weights:
+   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)
+   {
+    if(nRP>1) this->CalculateWeightedCorrelationsForDifferentialFlow2D("RP");
+    if(nRP>1) this->CalculateWeightedCorrelationsForDifferentialFlow2D("POI");
+   } 
+  } // end of if(fCalculate2DFlow)
+  */
+  
+ // d) Debugging and cross-checking (evaluate nested loops):
  //  d1) cross-checking results for integrated flow:
- if(fEvaluateIntFlowNestedLoops)\r
- {\r
-  if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity) // by default fMaxAllowedMultiplicity = 10 \r
-  {\r
-   // without using particle weights:\r
-   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights))\r
-   {\r
+ if(fEvaluateIntFlowNestedLoops)
+ {
+  if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity) // by default fMaxAllowedMultiplicity = 10 
+  {
+   // without using particle weights:
+   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights))
+   {
     // correlations:
     this->CalculateIntFlowCorrelations(); // from Q-vectors
-    this->EvaluateIntFlowCorrelationsWithNestedLoops(anEvent); // from nested loops (to be improved: do I have to pass here anEvent or not?)\r
-    // correction for non-uniform acceptance:\r
-    this->CalculateIntFlowCorrectionsForNUASinTerms(); // from Q-vectors (sin terms)\r
+    this->EvaluateIntFlowCorrelationsWithNestedLoops(anEvent); // from nested loops (to be improved: do I have to pass here anEvent or not?)
+    // correction for non-uniform acceptance:
+    this->CalculateIntFlowCorrectionsForNUASinTerms(); // from Q-vectors (sin terms)
     this->CalculateIntFlowCorrectionsForNUACosTerms(); // from Q-vectors (cos terms)
-    this->EvaluateIntFlowCorrectionsForNUAWithNestedLoops(anEvent); // from nested loops (both sin and cos terms)\r
-   }\r
-   // using particle weights:\r
-   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)\r
-   {
-    // correlations:\r
-    this->CalculateIntFlowCorrelationsUsingParticleWeights(); // from Q-vectors\r
-    this->EvaluateIntFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent); // from nested loops (to be improved: do I have to pass here anEvent or not?)\r
-   }\r
+    this->EvaluateIntFlowCorrectionsForNUAWithNestedLoops(anEvent); // from nested loops (both sin and cos terms)
+   }
+   // using particle weights:
+   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)
+   {
+    // correlations:
+    this->CalculateIntFlowCorrelationsUsingParticleWeights(); // from Q-vectors
+    this->EvaluateIntFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent); // from nested loops (to be improved: do I have to pass here anEvent or not?)
+   }
   } else if (nPrim>fMaxAllowedMultiplicity) // to if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity)
     {
      cout<<endl;
@@ -602,7361 +602,7363 @@ void AliFlowAnalysisWithQCumulants::Make(AliFlowEventSimple* anEvent)
       {
        cout<<endl;
        cout<<"Skipping the event because multiplicity is "<<nPrim<<"."<<endl;      
-      } \r
- } // end of if(fEvaluateIntFlowNestedLoops) \r
\r
+      } 
+ } // end of if(fEvaluateIntFlowNestedLoops) 
  //  d2) cross-checking results for differential flow:
- if(fEvaluateDiffFlowNestedLoops)\r
- {\r
-  if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity) // by default fMaxAllowedMultiplicity = 10\r
-  {\r
-   // without using particle weights:\r
-   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights))\r
-   {
-    // reduced correlations:\r
+ if(fEvaluateDiffFlowNestedLoops)
+ {
+  if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity) // by default fMaxAllowedMultiplicity = 10
+  {
+   // without using particle weights:
+   if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights))
+   {
+    // reduced correlations:
     // Q-vectors:
-    this->CalculateDiffFlowCorrelations("RP","Pt");\r
-    this->CalculateDiffFlowCorrelations("RP","Eta");\r
-    this->CalculateDiffFlowCorrelations("POI","Pt");\r
+    this->CalculateDiffFlowCorrelations("RP","Pt");
+    this->CalculateDiffFlowCorrelations("RP","Eta");
+    this->CalculateDiffFlowCorrelations("POI","Pt");
     this->CalculateDiffFlowCorrelations("POI","Eta");
     // nested loops:
     //this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"RP","Pt"); // to be improved (enabled eventually)
     //this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"RP","Eta"); // to be improved (enabled eventually)
     this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"POI","Pt"); // to be improved (do I need to pass here anEvent?)
     this->EvaluateDiffFlowCorrelationsWithNestedLoops(anEvent,"POI","Eta"); // to be improved (do I need to pass here anEvent?)
-    // reduced corrections for non-uniform acceptance:\r    // Q-vectors:
-    this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Pt");\r
-    this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Eta");\r
-    this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Pt");\r
-    this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Eta");\r
-    this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Pt");\r
-    this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Eta");\r
-    this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Pt");\r
+    // reduced corrections for non-uniform acceptance:
+    // Q-vectors:
+    this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Pt");
+    this->CalculateDiffFlowCorrectionsForNUASinTerms("RP","Eta");
+    this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Pt");
+    this->CalculateDiffFlowCorrectionsForNUASinTerms("POI","Eta");
+    this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Pt");
+    this->CalculateDiffFlowCorrectionsForNUACosTerms("RP","Eta");
+    this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Pt");
     this->CalculateDiffFlowCorrectionsForNUACosTerms("POI","Eta");
     // nested loops:
-    //this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"RP","Pt"); // to be improved (enabled eventually)\r
-    //this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"RP","Eta"); // to be improved (enabled eventually)\r
-    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"POI","Pt"); // to be improved (do I need to pass here anEvent?)\r
-    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"POI","Eta"); // to be improved (do I need to pass here anEvent?)\r
-   } // end of if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights))\r
-   // using particle weights:\r
-   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)\r
-   {\r
-    this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Pt"); \r
-    this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Eta"); \r
-    this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Pt"); \r
-    this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Eta"); \r
+    //this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"RP","Pt"); // to be improved (enabled eventually)
+    //this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"RP","Eta"); // to be improved (enabled eventually)
+    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"POI","Pt"); // to be improved (do I need to pass here anEvent?)
+    this->EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoops(anEvent,"POI","Eta"); // to be improved (do I need to pass here anEvent?)
+   } // end of if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights))
+   // using particle weights:
+   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)
+   {
+    this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Pt"); 
+    this->CalculateDiffFlowCorrelationsUsingParticleWeights("RP","Eta"); 
+    this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Pt"); 
+    this->CalculateDiffFlowCorrelationsUsingParticleWeights("POI","Eta"); 
     this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"RP","Pt"); // to be improved (enabled eventually)
     this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"RP","Eta"); // to be improved (enabled eventually)
     this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"POI","Pt"); // to be improved (do I need to pass here anEvent?)
     this->EvaluateDiffFlowCorrelationsWithNestedLoopsUsingParticleWeights(anEvent,"POI","Eta"); // to be improved (do I need to pass here anEvent?)
-   } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)\r  } // end of if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity) // by default fMaxAllowedMultiplicity = 10\r
- } // end of if(fEvaluateDiffFlowNestedLoops) \r
\r
- // e) Reset all event by event quantities: \r
- this->ResetEventByEventQuantities();\r
\r
-} // end of AliFlowAnalysisWithQCumulants::Make(AliFlowEventSimple* anEvent)\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::Finish()\r
-{\r
- // Calculate the final results.\r
- //  a) acces the constants;\r
- //  b) access the flags;\r
- //  c) calculate the final results for integrated flow (without and with weights);\r
- //  d) store in AliFlowCommonHistResults and print the final results for integrated flow;\r
- //  e) calculate the final results for differential flow (without and with weights);\r
- //  f) print the final results for integrated flow obtained from differential flow (to be improved (terminology));\r
- //  g) cross-check the results: results from Q-vectors vs results from nested loops\r
\r
- // ******************************\r
- // **** ACCESS THE CONSTANTS ****\r
- // ******************************\r
\r
- this->AccessConstants();          \r
\r
- if(fCommonHists && fCommonHists->GetHarmonic())\r
- {\r
-  fHarmonic = (Int_t)(fCommonHists->GetHarmonic())->GetBinContent(1); // to be improved (moved somewhere else)\r
- } \r
-\r
- // **************************\r
- // **** ACCESS THE FLAGS ****\r
- // **************************    \r
- fUsePhiWeights = (Int_t)fUseParticleWeights->GetBinContent(1); \r
- fUsePtWeights = (Int_t)fUseParticleWeights->GetBinContent(2); \r
- fUseEtaWeights = (Int_t)fUseParticleWeights->GetBinContent(3);  \r
+   } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)
+  } // end of if(nPrim>0 && nPrim<=fMaxAllowedMultiplicity) // by default fMaxAllowedMultiplicity = 10
+ } // end of if(fEvaluateDiffFlowNestedLoops) 
+ // e) Reset all event by event quantities: 
+ this->ResetEventByEventQuantities();
+} // end of AliFlowAnalysisWithQCumulants::Make(AliFlowEventSimple* anEvent)
+
+
+//================================================================================================================================
+
+
+void AliFlowAnalysisWithQCumulants::Finish()
+{
+ // Calculate the final results.
+ //  a) acces the constants;
+ //  b) access the flags;
+ //  c) calculate the final results for integrated flow (without and with weights);
+ //  d) store in AliFlowCommonHistResults and print the final results for integrated flow;
+ //  e) calculate the final results for differential flow (without and with weights);
+ //  f) print the final results for integrated flow obtained from differential flow (to be improved (terminology));
+ //  g) cross-check the results: results from Q-vectors vs results from nested loops
+ // ******************************
+ // **** ACCESS THE CONSTANTS ****
+ // ******************************
+ this->AccessConstants();          
+ if(fCommonHists && fCommonHists->GetHarmonic())
+ {
+  fHarmonic = (Int_t)(fCommonHists->GetHarmonic())->GetBinContent(1); // to be improved (moved somewhere else)
+ } 
+
+ // **************************
+ // **** ACCESS THE FLAGS ****
+ // **************************    
+ fUsePhiWeights = (Int_t)fUseParticleWeights->GetBinContent(1); 
+ fUsePtWeights = (Int_t)fUseParticleWeights->GetBinContent(2); 
+ fUseEtaWeights = (Int_t)fUseParticleWeights->GetBinContent(3);  
  fApplyCorrectionForNUA = (Int_t)fIntFlowFlags->GetBinContent(3); 
- fEvaluateIntFlowNestedLoops = (Int_t)fEvaluateNestedLoops->GetBinContent(1);\r
- fEvaluateDiffFlowNestedLoops = (Int_t)fEvaluateNestedLoops->GetBinContent(2); \r
- fCrossCheckInPtBinNo = (Int_t)fEvaluateNestedLoops->GetBinContent(3);\r
- fCrossCheckInEtaBinNo = (Int_t)fEvaluateNestedLoops->GetBinContent(4); \r
-    \r
- // *********************************************************\r
- // **** CALCULATE THE FINAL RESULTS FOR INTEGRATED FLOW ****\r
- // *********************************************************     \r
\r
- this->FinalizeCorrelationsIntFlow();\r
- this->CalculateCovariancesIntFlow();\r
- this->CalculateCumulantsIntFlow();\r
- this->CalculateIntFlow(); \r
-\r
- if(fApplyCorrectionForNUA && !(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)) // to be improved (reorganized, etc)\r
- {\r
-  this->FinalizeCorrectionTermsForNUAIntFlow();\r
-  this->CalculateQcumulantsCorrectedForNUAIntFlow();   \r
-  this->CalculateIntFlowCorrectedForNUA(); \r
- }\r
-  \r
- // ***************************************************************\r
- // **** STORE AND PRINT THE FINAL RESULTS FOR INTEGRATED FLOW ****\r
- // ***************************************************************\r
\r
- this->FillCommonHistResultsIntFlow();  \r
-  \r
- this->PrintFinalResultsForIntegratedFlow("NONAME"); // to be improved (name)\r
\r
- // ***********************************************************\r
- // **** CALCULATE THE FINAL RESULTS FOR DIFFERENTIAL FLOW ****\r
- // ***********************************************************    \r
\r
- this->FinalizeReducedCorrelations("RP","Pt"); \r
- this->FinalizeReducedCorrelations("RP","Eta"); \r
- this->FinalizeReducedCorrelations("POI","Pt"); \r
- this->FinalizeReducedCorrelations("POI","Eta");\r
- this->CalculateDiffFlowCovariances("RP","Pt");\r
- this->CalculateDiffFlowCovariances("RP","Eta");\r
- this->CalculateDiffFlowCovariances("POI","Pt");\r
- this->CalculateDiffFlowCovariances("POI","Eta");\r
- this->CalculateDiffFlowCumulants("RP","Pt");\r
- this->CalculateDiffFlowCumulants("RP","Eta");\r
- this->CalculateDiffFlowCumulants("POI","Pt");\r
- this->CalculateDiffFlowCumulants("POI","Eta");\r
- this->CalculateDiffFlow("RP","Pt");\r
- this->CalculateDiffFlow("RP","Eta");\r
- this->CalculateDiffFlow("POI","Pt");\r
- this->CalculateDiffFlow("POI","Eta");\r
\r
- if(fApplyCorrectionForNUA && !(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)) // to be improved (reorganized, etc)\r
- {\r
-  this->FinalizeCorrectionTermsForNUADiffFlow("RP","Pt");\r
-  this->FinalizeCorrectionTermsForNUADiffFlow("RP","Eta");\r
-  this->FinalizeCorrectionTermsForNUADiffFlow("POI","Pt");\r
-  this->FinalizeCorrectionTermsForNUADiffFlow("POI","Eta");      \r
-  this->CalculateDiffFlowCumulantsCorrectedForNUA("RP","Pt");   \r
-  this->CalculateDiffFlowCumulantsCorrectedForNUA("RP","Eta");   \r
-  this->CalculateDiffFlowCumulantsCorrectedForNUA("POI","Pt");   \r
-  this->CalculateDiffFlowCumulantsCorrectedForNUA("POI","Eta");  \r
-  this->CalculateDiffFlowCorrectedForNUA("RP","Pt"); \r
-  this->CalculateDiffFlowCorrectedForNUA("RP","Eta"); \r
-  this->CalculateDiffFlowCorrectedForNUA("POI","Pt"); \r
-  this->CalculateDiffFlowCorrectedForNUA("POI","Eta"); \r
- }\r
\r
- this->CalculateFinalResultsForRPandPOIIntegratedFlow("RP");\r
- this->CalculateFinalResultsForRPandPOIIntegratedFlow("POI");\r
-\r
- // *****************************************************************\r
- // **** STORE AND PRINT THE FINAL RESULTS FOR DIFFERENTIAL FLOW ****\r
- // *****************************************************************\r
- this->FillCommonHistResultsDiffFlow("RP");\r
- this->FillCommonHistResultsDiffFlow("POI");\r
-\r
- this->PrintFinalResultsForIntegratedFlow("RP"); \r
- this->PrintFinalResultsForIntegratedFlow("POI"); \r
-  \r
- // g) cross-check the results: results from Q-vectors vs results from nested loops\r
+ fEvaluateIntFlowNestedLoops = (Int_t)fEvaluateNestedLoops->GetBinContent(1);
+ fEvaluateDiffFlowNestedLoops = (Int_t)fEvaluateNestedLoops->GetBinContent(2); 
+ fCrossCheckInPtBinNo = (Int_t)fEvaluateNestedLoops->GetBinContent(3);
+ fCrossCheckInEtaBinNo = (Int_t)fEvaluateNestedLoops->GetBinContent(4); 
+    
+ // *********************************************************
+ // **** CALCULATE THE FINAL RESULTS FOR INTEGRATED FLOW ****
+ // *********************************************************     
+ this->FinalizeCorrelationsIntFlow();
+ this->CalculateCovariancesIntFlow();
+ this->CalculateCumulantsIntFlow();
+ this->CalculateIntFlow(); 
+
+ if(fApplyCorrectionForNUA && !(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)) // to be improved (reorganized, etc)
+ {
+  this->FinalizeCorrectionTermsForNUAIntFlow();
+  this->CalculateQcumulantsCorrectedForNUAIntFlow();   
+  this->CalculateIntFlowCorrectedForNUA(); 
+ }
+  
+ // ***************************************************************
+ // **** STORE AND PRINT THE FINAL RESULTS FOR INTEGRATED FLOW ****
+ // ***************************************************************
+ this->FillCommonHistResultsIntFlow();  
+  
+ this->PrintFinalResultsForIntegratedFlow("NONAME"); // to be improved (name)
+ // ***********************************************************
+ // **** CALCULATE THE FINAL RESULTS FOR DIFFERENTIAL FLOW ****
+ // ***********************************************************    
+ this->FinalizeReducedCorrelations("RP","Pt"); 
+ this->FinalizeReducedCorrelations("RP","Eta"); 
+ this->FinalizeReducedCorrelations("POI","Pt"); 
+ this->FinalizeReducedCorrelations("POI","Eta");
+ this->CalculateDiffFlowCovariances("RP","Pt");
+ this->CalculateDiffFlowCovariances("RP","Eta");
+ this->CalculateDiffFlowCovariances("POI","Pt");
+ this->CalculateDiffFlowCovariances("POI","Eta");
+ this->CalculateDiffFlowCumulants("RP","Pt");
+ this->CalculateDiffFlowCumulants("RP","Eta");
+ this->CalculateDiffFlowCumulants("POI","Pt");
+ this->CalculateDiffFlowCumulants("POI","Eta");
+ this->CalculateDiffFlow("RP","Pt");
+ this->CalculateDiffFlow("RP","Eta");
+ this->CalculateDiffFlow("POI","Pt");
+ this->CalculateDiffFlow("POI","Eta");
+ if(fApplyCorrectionForNUA && !(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)) // to be improved (reorganized, etc)
+ {
+  this->FinalizeCorrectionTermsForNUADiffFlow("RP","Pt");
+  this->FinalizeCorrectionTermsForNUADiffFlow("RP","Eta");
+  this->FinalizeCorrectionTermsForNUADiffFlow("POI","Pt");
+  this->FinalizeCorrectionTermsForNUADiffFlow("POI","Eta");      
+  this->CalculateDiffFlowCumulantsCorrectedForNUA("RP","Pt");   
+  this->CalculateDiffFlowCumulantsCorrectedForNUA("RP","Eta");   
+  this->CalculateDiffFlowCumulantsCorrectedForNUA("POI","Pt");   
+  this->CalculateDiffFlowCumulantsCorrectedForNUA("POI","Eta");  
+  this->CalculateDiffFlowCorrectedForNUA("RP","Pt"); 
+  this->CalculateDiffFlowCorrectedForNUA("RP","Eta"); 
+  this->CalculateDiffFlowCorrectedForNUA("POI","Pt"); 
+  this->CalculateDiffFlowCorrectedForNUA("POI","Eta"); 
+ }
+ this->CalculateFinalResultsForRPandPOIIntegratedFlow("RP");
+ this->CalculateFinalResultsForRPandPOIIntegratedFlow("POI");
+
+ // *****************************************************************
+ // **** STORE AND PRINT THE FINAL RESULTS FOR DIFFERENTIAL FLOW ****
+ // *****************************************************************
+ this->FillCommonHistResultsDiffFlow("RP");
+ this->FillCommonHistResultsDiffFlow("POI");
+
+ this->PrintFinalResultsForIntegratedFlow("RP"); 
+ this->PrintFinalResultsForIntegratedFlow("POI"); 
+  
+ // g) cross-check the results: results from Q-vectors vs results from nested loops
  //  g1) integrated flow:
  if(fEvaluateIntFlowNestedLoops)
  {
-  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)) \r
-  {\r
+  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)) 
+  {
    this->CrossCheckIntFlowCorrelations();
-   this->CrossCheckIntFlowCorrectionTermsForNUA(); \r
+   this->CrossCheckIntFlowCorrectionTermsForNUA(); 
   } else
     {
      this->CrossCheckIntFlowCorrelations();     
      this->CrossCheckIntFlowExtraCorrelations();     
     }
- } // end of if(fEvaluateIntFlowNestedLoops)  \r
- //  g2) differential flow: \r
- if(fEvaluateDiffFlowNestedLoops) \r
- {\r
+ } // end of if(fEvaluateIntFlowNestedLoops)  
+ //  g2) differential flow: 
+ if(fEvaluateDiffFlowNestedLoops) 
+ {
   // correlations:
-  //this->CrossCheckDiffFlowCorrelations("RP","Pt"); // to be improved (enabled eventually)  \r
-  //this->CrossCheckDiffFlowCorrelations("RP","Eta"); // to be improved (enabled eventually)  \r
-  this->CrossCheckDiffFlowCorrelations("POI","Pt");  \r
+  //this->CrossCheckDiffFlowCorrelations("RP","Pt"); // to be improved (enabled eventually)  
+  //this->CrossCheckDiffFlowCorrelations("RP","Eta"); // to be improved (enabled eventually)  
+  this->CrossCheckDiffFlowCorrelations("POI","Pt");  
   this->CrossCheckDiffFlowCorrelations("POI","Eta");
   // correction terms for non-uniform acceptance:
-  //this->CrossCheckDiffFlowCorrectionTermsForNUA("RP","Pt"); // to be improved (enabled eventually)      \r
-  //this->CrossCheckDiffFlowCorrectionTermsForNUA("RP","Eta"); // to be improved (enabled eventually)      \r
-  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)) \r
+  //this->CrossCheckDiffFlowCorrectionTermsForNUA("RP","Pt"); // to be improved (enabled eventually)      
+  //this->CrossCheckDiffFlowCorrectionTermsForNUA("RP","Eta"); // to be improved (enabled eventually)      
+  if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)) 
   {
-   this->CrossCheckDiffFlowCorrectionTermsForNUA("POI","Pt");      \r
-   this->CrossCheckDiffFlowCorrectionTermsForNUA("POI","Eta");      \r
+   this->CrossCheckDiffFlowCorrectionTermsForNUA("POI","Pt");      
+   this->CrossCheckDiffFlowCorrectionTermsForNUA("POI","Eta");      
   } 
- } // end of if(fEvaluateDiffFlowNestedLoops)\r
-                                                                                                                                                                                                                                                                                                                                   \r
-} // end of AliFlowAnalysisWithQCumulants::Finish()\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTerms()\r
-{\r
- // calculate corrections for non-uniform acceptance of the detector for no-name integrated flow (cos terms)\r
\r
- // multiplicity:\r
- Double_t dMult = (*fSMpk)(0,0);\r
\r
- // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: \r
- Double_t dReQ1n = (*fReQ)(0,0);\r
- Double_t dReQ2n = (*fReQ)(1,0);\r
- //Double_t dReQ3n = (*fReQ)(2,0);\r
- //Double_t dReQ4n = (*fReQ)(3,0);\r
- Double_t dImQ1n = (*fImQ)(0,0);\r
- Double_t dImQ2n = (*fImQ)(1,0);\r
- //Double_t dImQ3n = (*fImQ)(2,0);\r
- //Double_t dImQ4n = (*fImQ)(3,0);\r
-        \r
- //                                  *************************************************************\r
- //                                  **** corrections for non-uniform acceptance (cos terms): ****\r
- //                                  *************************************************************\r
- //\r
- // Remark 1: corrections for non-uniform acceptance (cos terms) calculated with non-weighted Q-vectors \r
- //           are stored in 1D profile fQCorrectionsCos.\r
- // Remark 2: binning of fIntFlowCorrectionTermsForNUAPro[1] is organized as follows:\r
- // --------------------------------------------------------------------------------------------------------------------\r
- // 1st bin: <<cos(n*(phi1))>> = cosP1n\r
- // 2nd bin: <<cos(n*(phi1+phi2))>> = cosP1nP1n\r
- // 3rd bin: <<cos(n*(phi1-phi2-phi3))>> = cosP1nM1nM1n\r
- // ...\r
- // --------------------------------------------------------------------------------------------------------------------\r
-  \r
- // 1-particle:\r
- Double_t cosP1n = 0.; // <<cos(n*(phi1))>>\r
-   \r
- if(dMult>0)\r
- {\r
-  cosP1n = dReQ1n/dMult; \r
-  \r
-  // average non-weighted 1-particle correction (cos terms) for non-uniform acceptance for single event:\r
-  fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(1,cosP1n);\r
-  \r
-  // final average non-weighted 1-particle correction (cos terms) for non-uniform acceptance for all events:\r
-  fIntFlowCorrectionTermsForNUAPro[1]->Fill(0.5,cosP1n,dMult);  \r
- } \r
\r
- // 2-particle:\r
- Double_t cosP1nP1n = 0.; // <<cos(n*(phi1+phi2))>>\r
\r
- if(dMult>1)\r
- {\r
-  cosP1nP1n = (pow(dReQ1n,2)-pow(dImQ1n,2)-dReQ2n)/(dMult*(dMult-1)); \r
-  \r
-  // average non-weighted 2-particle correction (cos terms) for non-uniform acceptance for single event:\r
-  fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(2,cosP1nP1n);\r
-  \r
-  // final average non-weighted 2-particle correction (cos terms) for non-uniform acceptance for all events:\r
-  fIntFlowCorrectionTermsForNUAPro[1]->Fill(1.5,cosP1nP1n,dMult*(dMult-1));  \r
- } \r
\r
- // 3-particle:\r
- Double_t cosP1nM1nM1n = 0.; // <<cos(n*(phi1-phi2-phi3))>>\r
\r
- if(dMult>2)\r
- {\r
-  cosP1nM1nM1n = (dReQ1n*(pow(dReQ1n,2)+pow(dImQ1n,2))-dReQ1n*dReQ2n-dImQ1n*dImQ2n-2.*(dMult-1)*dReQ1n)\r
-               / (dMult*(dMult-1)*(dMult-2)); \r
-  \r
-  // average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for single event:\r
-  fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(3,cosP1nM1nM1n);\r
-  \r
-  // final average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for all events:\r
-  fIntFlowCorrectionTermsForNUAPro[1]->Fill(2.5,cosP1nM1nM1n,dMult*(dMult-1)*(dMult-2));  \r
- } \r
\r
-} // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTerms()\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTerms()\r
-{\r
- // calculate corrections for non-uniform acceptance of the detector for no-name integrated flow (sin terms)\r
\r
- // multiplicity:\r
- Double_t dMult = (*fSMpk)(0,0);\r
\r
- // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: \r
- Double_t dReQ1n = (*fReQ)(0,0);\r
- Double_t dReQ2n = (*fReQ)(1,0);\r
- //Double_t dReQ3n = (*fReQ)(2,0);\r
- //Double_t dReQ4n = (*fReQ)(3,0);\r
- Double_t dImQ1n = (*fImQ)(0,0);\r
- Double_t dImQ2n = (*fImQ)(1,0);\r
- //Double_t dImQ3n = (*fImQ)(2,0);\r
- //Double_t dImQ4n = (*fImQ)(3,0);\r
-        \r
- //                                  *************************************************************\r
- //                                  **** corrections for non-uniform acceptance (sin terms): ****\r
- //                                  *************************************************************\r
- //\r
- // Remark 1: corrections for non-uniform acceptance (sin terms) calculated with non-weighted Q-vectors \r
- //           are stored in 1D profile fQCorrectionsSin.\r
- // Remark 2: binning of fIntFlowCorrectionTermsForNUAPro[0] is organized as follows:\r
- // --------------------------------------------------------------------------------------------------------------------\r
- // 1st bin: <<sin(n*(phi1))>> = sinP1n\r
- // 2nd bin: <<sin(n*(phi1+phi2))>> = sinP1nP1n\r
- // 3rd bin: <<sin(n*(phi1-phi2-phi3))>> = sinP1nM1nM1n\r
- // ...\r
- // --------------------------------------------------------------------------------------------------------------------\r
\r
- // 1-particle:\r
- Double_t sinP1n = 0.; // <sin(n*(phi1))>\r
\r
- if(dMult>0)\r
- {\r
-  sinP1n = dImQ1n/dMult; \r
-     \r
-  // average non-weighted 1-particle correction (sin terms) for non-uniform acceptance for single event:\r
-  fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(1,sinP1n);\r
-  \r
-  // final average non-weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:   \r
-  fIntFlowCorrectionTermsForNUAPro[0]->Fill(0.5,sinP1n,dMult);  \r
- } \r
\r
- // 2-particle:\r
- Double_t sinP1nP1n = 0.; // <<sin(n*(phi1+phi2))>>\r
\r
- if(dMult>1)\r
- {\r
-  sinP1nP1n = (2.*dReQ1n*dImQ1n-dImQ2n)/(dMult*(dMult-1)); \r
-     \r
-  // average non-weighted 2-particle correction (sin terms) for non-uniform acceptance for single event:\r
-  fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(2,sinP1nP1n);\r
-  \r
-  // final average non-weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:      \r
-  fIntFlowCorrectionTermsForNUAPro[0]->Fill(1.5,sinP1nP1n,dMult*(dMult-1));  \r
- } \r
\r
- // 3-particle:\r
- Double_t sinP1nM1nM1n = 0.; // <<sin(n*(phi1-phi2-phi3))>>\r
\r
- if(dMult>2)\r
- {\r
-  sinP1nM1nM1n = (-dImQ1n*(pow(dReQ1n,2)+pow(dImQ1n,2))+dReQ1n*dImQ2n-dImQ1n*dReQ2n+2.*(dMult-1)*dImQ1n)\r
-               / (dMult*(dMult-1)*(dMult-2)); \r
-  \r
-  // average non-weighted 3-particle correction (sin terms) for non-uniform acceptance for single event:\r
-  fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(3,sinP1nM1nM1n);\r
-  \r
-  // final average non-weighted 3-particle correction (sin terms) for non-uniform acceptance for all events:  \r
-  fIntFlowCorrectionTermsForNUAPro[0]->Fill(2.5,sinP1nM1nM1n,dMult*(dMult-1)*(dMult-2));  \r
- } \r
\r
-} // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTerms()\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::GetOutputHistograms(TList *outputListHistos)\r
-{\r
- // a) Get pointers for common control and common result histograms and profiles.\r
- // b) Get pointers for histograms with particle weights.\r
- // c) Get pointers for histograms and profiles relevant for integrated flow.\r
- // d) Get pointers for histograms and profiles relevant for differental flow.\r
- // e) Get pointers for histograms and profiles holding results obtained with nested loops.\r
\r
- if(outputListHistos)\r
- {     \r
-  this->GetPointersForCommonHistograms(outputListHistos); // to be improved (no need to pass here argument, use setter for base list instead)\r
-  this->GetPointersForParticleWeightsHistograms(outputListHistos); // to be improved (no need to pass here argument, use setter for base list instead)\r
-  this->GetPointersForIntFlowHistograms(outputListHistos); // to be improved (no need to pass here argument, use setter for base list instead)\r
-  this->GetPointersForDiffFlowHistograms(outputListHistos); // to be improved (no need to pass here argument, use setter for base list instead)\r
-  this->GetPointersForNestedLoopsHistograms(outputListHistos); // to be improved (no need to pass here argument, use setter for base list instead)\r
- }\r
-   \r
-} // end of void AliFlowAnalysisWithQCumulants::GetOutputHistograms(TList *outputListHistos)\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-TProfile* AliFlowAnalysisWithQCumulants::MakePtProjection(TProfile2D *profilePtEta) const\r
-{\r
- // project 2D profile onto pt axis to get 1D profile\r
\r
- Int_t nBinsPt   = profilePtEta->GetNbinsX();\r
- Double_t dPtMin = (profilePtEta->GetXaxis())->GetXmin();\r
- Double_t dPtMax = (profilePtEta->GetXaxis())->GetXmax();\r
\r
- Int_t nBinsEta   = profilePtEta->GetNbinsY();\r
\r
- TProfile *profilePt = new TProfile("","",nBinsPt,dPtMin,dPtMax); \r
\r
- for(Int_t p=1;p<=nBinsPt;p++)\r
- {\r
-  Double_t contentPt = 0.;\r
-  Double_t entryPt = 0.;\r
-  Double_t spreadPt = 0.;\r
-  Double_t sum1 = 0.;\r
-  Double_t sum2 = 0.;\r
-  Double_t sum3 = 0.;\r
-  for(Int_t e=1;e<=nBinsEta;e++)\r
-  {\r
-   contentPt += (profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)))\r
-              * (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));\r
-   entryPt   += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));\r
-   \r
-   sum1 += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)))\r
-         * (pow(profilePtEta->GetBinError(profilePtEta->GetBin(p,e)),2.)\r
-            + pow(profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)),2.)); \r
-   sum2 += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));\r
-   sum3 += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)))\r
-         * (profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)));            \r
-  }\r
-  if(sum2>0. && sum1/sum2-pow(sum3/sum2,2.) > 0.)\r
-  {\r
-   spreadPt = pow(sum1/sum2-pow(sum3/sum2,2.),0.5);\r
-  }\r
-  profilePt->SetBinContent(p,contentPt);\r
-  profilePt->SetBinEntries(p,entryPt);\r
-  {\r
-   profilePt->SetBinError(p,spreadPt);\r
-  }\r
-  \r
- }\r
\r
- return profilePt;\r
\r
-} // end of TProfile* AliFlowAnalysisWithQCumulants::MakePtProjection(TProfile2D *profilePtEta)\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-TProfile* AliFlowAnalysisWithQCumulants::MakeEtaProjection(TProfile2D *profilePtEta) const\r
-{\r
- // project 2D profile onto eta axis to get 1D profile\r
\r
- Int_t nBinsEta   = profilePtEta->GetNbinsY();\r
- Double_t dEtaMin = (profilePtEta->GetYaxis())->GetXmin();\r
- Double_t dEtaMax = (profilePtEta->GetYaxis())->GetXmax();\r
\r
- Int_t nBinsPt = profilePtEta->GetNbinsX();\r
\r
- TProfile *profileEta = new TProfile("","",nBinsEta,dEtaMin,dEtaMax); \r
\r
- for(Int_t e=1;e<=nBinsEta;e++)\r
- {\r
-  Double_t contentEta = 0.;\r
-  Double_t entryEta = 0.;\r
-  for(Int_t p=1;p<=nBinsPt;p++)\r
-  {\r
-   contentEta += (profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)))\r
-              * (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));\r
-   entryEta   += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));\r
-  }\r
-  profileEta->SetBinContent(e,contentEta);\r
-  profileEta->SetBinEntries(e,entryEta);\r
- }\r
\r
- return profileEta;\r
\r
-} // end of TProfile* AliFlowAnalysisWithQCumulants::MakeEtaProjection(TProfile2D *profilePtEta)\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::PrintFinalResultsForIntegratedFlow(TString type)\r
-{\r
- // printing on the screen the final results for integrated flow (NONAME, POI and RP) // to be improved (NONAME) \r
\r
- Int_t n = fHarmonic; \r
\r
- if(type == "NONAME" || type == "RP" || type == "POI")\r
- {\r
-  if(!(fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th))\r
-  {\r
-   cout<<"WARNING: fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th"<<endl;\r
-   cout<<"         is NULL in AFAWQC::PFRFIF() !!!!"<<endl;\r
-  }\r
- } else\r
-   {\r
-    cout<<"WARNING: type in not from {NONAME, RP, POI} in AFAWQC::PFRFIF() !!!!"<<endl;\r
-    exit(0);\r
-   }\r
\r
- Double_t dVn[4] = {0.}; // array to hold Vn{2}, Vn{4}, Vn{6} and Vn{8}   \r
- Double_t dVnErr[4] = {0.}; // array to hold errors of Vn{2}, Vn{4}, Vn{6} and Vn{8}   \r
\r
- if(type == "NONAME")\r
- {\r
-  dVn[0] = (fCommonHistsResults2nd->GetHistIntFlow())->GetBinContent(1); \r
-  dVnErr[0] = (fCommonHistsResults2nd->GetHistIntFlow())->GetBinError(1); \r
-  dVn[1] = (fCommonHistsResults4th->GetHistIntFlow())->GetBinContent(1); \r
-  dVnErr[1] = (fCommonHistsResults4th->GetHistIntFlow())->GetBinError(1); \r
-  dVn[2] = (fCommonHistsResults6th->GetHistIntFlow())->GetBinContent(1); \r
-  dVnErr[2] = (fCommonHistsResults6th->GetHistIntFlow())->GetBinError(1); \r
-  dVn[3] = (fCommonHistsResults8th->GetHistIntFlow())->GetBinContent(1); \r
-  dVnErr[3] = (fCommonHistsResults8th->GetHistIntFlow())->GetBinError(1); \r
- } else if(type == "RP")\r
-   {\r
-    dVn[0] = (fCommonHistsResults2nd->GetHistIntFlowRP())->GetBinContent(1); \r
-    dVnErr[0] = (fCommonHistsResults2nd->GetHistIntFlowRP())->GetBinError(1); \r
-    dVn[1] = (fCommonHistsResults4th->GetHistIntFlowRP())->GetBinContent(1); \r
-    dVnErr[1] = (fCommonHistsResults4th->GetHistIntFlowRP())->GetBinError(1); \r
-    dVn[2] = (fCommonHistsResults6th->GetHistIntFlowRP())->GetBinContent(1); \r
-    dVnErr[2] = (fCommonHistsResults6th->GetHistIntFlowRP())->GetBinError(1); \r
-    dVn[3] = (fCommonHistsResults8th->GetHistIntFlowRP())->GetBinContent(1); \r
-    dVnErr[3] = (fCommonHistsResults8th->GetHistIntFlowRP())->GetBinError(1); \r
-   } else if(type == "POI")\r
-     {\r
-      dVn[0] = (fCommonHistsResults2nd->GetHistIntFlowPOI())->GetBinContent(1); \r
-      dVnErr[0] = (fCommonHistsResults2nd->GetHistIntFlowPOI())->GetBinError(1); \r
-      dVn[1] = (fCommonHistsResults4th->GetHistIntFlowPOI())->GetBinContent(1); \r
-      dVnErr[1] = (fCommonHistsResults4th->GetHistIntFlowPOI())->GetBinError(1); \r
-      dVn[2] = (fCommonHistsResults6th->GetHistIntFlowPOI())->GetBinContent(1); \r
-      dVnErr[2] = (fCommonHistsResults6th->GetHistIntFlowPOI())->GetBinError(1); \r
-      dVn[3] = (fCommonHistsResults8th->GetHistIntFlowPOI())->GetBinContent(1); \r
-      dVnErr[3] = (fCommonHistsResults8th->GetHistIntFlowPOI())->GetBinError(1); \r
-     }\r
\r
- TString title = " flow estimates from Q-cumulants"; \r
- TString subtitle = "    ("; \r
\r
- if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights))\r
- {\r
-  subtitle.Append(type);\r
-  subtitle.Append(", without weights)");\r
- } else  \r
-   {\r
-    subtitle.Append(type);\r
-    subtitle.Append(", with weights)");\r
-   }\r
-  \r
- cout<<endl;\r
- cout<<"*************************************"<<endl;\r
- cout<<"*************************************"<<endl;\r
- cout<<title.Data()<<endl; \r
- cout<<subtitle.Data()<<endl; \r
- cout<<endl;\r
-  \r
- for(Int_t i=0;i<4;i++)\r
- {\r
-  if(dVn[i]>=0.)\r
-  {\r
-   cout<<"  v_"<<n<<"{"<<2*(i+1)<<"} = "<<dVn[i]<<" +/- "<<dVnErr[i]<<endl;\r
-  }\r
-  else\r
-  {\r
-   cout<<"  v_"<<n<<"{"<<2*(i+1)<<"} = Im"<<endl;\r
-  }  \r
- }\r
-\r
- cout<<endl;\r
- /*\r
- if(type == "NONAME")\r
- {\r
-  cout<<"     nEvts = "<<nEvtsNoName<<", AvM = "<<dMultNoName<<endl; // to be improved\r
- }\r
- else if (type == "RP")\r
- {\r
-  cout<<"     nEvts = "<<nEvtsRP<<", AvM = "<<dMultRP<<endl; // to be improved  \r
- } \r
- else if (type == "POI")\r
- {\r
-  cout<<"     nEvts = "<<nEvtsPOI<<", AvM = "<<dMultPOI<<endl; // to be improved  \r
- } \r
- */\r
- cout<<"*************************************"<<endl;\r
- cout<<"*************************************"<<endl;\r
- cout<<endl; \r
-  \r
-}// end of AliFlowAnalysisWithQCumulants::PrintFinalResultsForIntegratedFlow(TString type="NONAME");\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::WriteHistograms(TString outputFileName)\r
-{\r
- //store the final results in output .root file\r
- TFile *output = new TFile(outputFileName.Data(),"RECREATE");\r
- //output->WriteObject(fHistList, "cobjQC","SingleKey");\r
- fHistList->Write(fHistList->GetName(), TObject::kSingleKey);\r
- delete output;\r
-}\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::BookCommonHistograms()\r
-{\r
- // Book common control histograms and common histograms for final results.\r
- // common control histogram (ALL events)\r
- TString commonHistsName = "AliFlowCommonHistQC";\r
- commonHistsName += fAnalysisLabel->Data();\r
- fCommonHists = new AliFlowCommonHist(commonHistsName.Data());\r
- fHistList->Add(fCommonHists);  \r
- // common control histogram (for events with 2 and more particles)\r
- TString commonHists2ndOrderName = "AliFlowCommonHist2ndOrderQC";\r
- commonHists2ndOrderName += fAnalysisLabel->Data();\r
- fCommonHists2nd = new AliFlowCommonHist(commonHists2ndOrderName.Data());\r
- fHistList->Add(fCommonHists2nd);  \r
- // common control histogram (for events with 4 and more particles)\r
- TString commonHists4thOrderName = "AliFlowCommonHist4thOrderQC";\r
- commonHists4thOrderName += fAnalysisLabel->Data();\r
- fCommonHists4th = new AliFlowCommonHist(commonHists4thOrderName.Data());\r
- fHistList->Add(fCommonHists4th);  \r
- // common control histogram (for events with 6 and more particles)\r
- TString commonHists6thOrderName = "AliFlowCommonHist6thOrderQC";\r
- commonHists6thOrderName += fAnalysisLabel->Data();\r
- fCommonHists6th = new AliFlowCommonHist(commonHists6thOrderName.Data());\r
- fHistList->Add(fCommonHists6th);  \r
- // common control histogram (for events with 8 and more particles)\r
- TString commonHists8thOrderName = "AliFlowCommonHist8thOrderQC";\r
- commonHists8thOrderName += fAnalysisLabel->Data();\r
- fCommonHists8th = new AliFlowCommonHist(commonHists8thOrderName.Data());\r
- fHistList->Add(fCommonHists8th);    \r
- // common histograms for final results (calculated for events with 2 and more particles)\r
- TString commonHistResults2ndOrderName = "AliFlowCommonHistResults2ndOrderQC";\r
- commonHistResults2ndOrderName += fAnalysisLabel->Data();\r
- fCommonHistsResults2nd = new AliFlowCommonHistResults(commonHistResults2ndOrderName.Data());\r
- fHistList->Add(fCommonHistsResults2nd);  \r
- // common histograms for final results (calculated for events with 4 and more particles)\r
- TString commonHistResults4thOrderName = "AliFlowCommonHistResults4thOrderQC";\r
- commonHistResults4thOrderName += fAnalysisLabel->Data();\r
- fCommonHistsResults4th = new AliFlowCommonHistResults(commonHistResults4thOrderName.Data());\r
- fHistList->Add(fCommonHistsResults4th); \r
- // common histograms for final results (calculated for events with 6 and more particles)\r
- TString commonHistResults6thOrderName = "AliFlowCommonHistResults6thOrderQC";\r
- commonHistResults6thOrderName += fAnalysisLabel->Data();\r
- fCommonHistsResults6th = new AliFlowCommonHistResults(commonHistResults6thOrderName.Data());\r
- fHistList->Add(fCommonHistsResults6th);  \r
- // common histograms for final results (calculated for events with 8 and more particles)\r
- TString commonHistResults8thOrderName = "AliFlowCommonHistResults8thOrderQC";\r
- commonHistResults8thOrderName += fAnalysisLabel->Data();\r
- fCommonHistsResults8th = new AliFlowCommonHistResults(commonHistResults8thOrderName.Data());\r
- fHistList->Add(fCommonHistsResults8th); \r
\r
-} // end of void AliFlowAnalysisWithQCumulants::BookCommonHistograms()\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::BookAndFillWeightsHistograms()\r
-{\r
- // book and fill histograms which hold phi, pt and eta weights\r
-\r
- if(!fWeightsList)\r
- {\r
-  cout<<"WARNING: fWeightsList is NULL in AFAWQC::BAFWH() !!!!"<<endl;\r
-  exit(0);  \r
- }\r
-    \r
- TString fUseParticleWeightsName = "fUseParticleWeightsQC";\r
- fUseParticleWeightsName += fAnalysisLabel->Data();\r
- fUseParticleWeights = new TProfile(fUseParticleWeightsName.Data(),"0 = particle weight not used, 1 = particle weight used ",3,0,3);\r
- fUseParticleWeights->SetLabelSize(0.06);\r
- (fUseParticleWeights->GetXaxis())->SetBinLabel(1,"w_{#phi}");\r
- (fUseParticleWeights->GetXaxis())->SetBinLabel(2,"w_{p_{T}}");\r
- (fUseParticleWeights->GetXaxis())->SetBinLabel(3,"w_{#eta}");\r
- fUseParticleWeights->Fill(0.5,(Int_t)fUsePhiWeights);\r
- fUseParticleWeights->Fill(1.5,(Int_t)fUsePtWeights);\r
- fUseParticleWeights->Fill(2.5,(Int_t)fUseEtaWeights);\r
- fWeightsList->Add(fUseParticleWeights); \r
-  \r
- if(fUsePhiWeights)\r
- {\r
-  if(fWeightsList->FindObject("phi_weights"))\r
-  {\r
-   fPhiWeights = dynamic_cast<TH1F*>(fWeightsList->FindObject("phi_weights"));\r
-   if(fPhiWeights->GetBinWidth(1) != fPhiBinWidth)\r
-   {\r
-    cout<<"WARNING: fPhiWeights->GetBinWidth(1) != fPhiBinWidth in AFAWQC::BAFWH() !!!!        "<<endl;\r
-    cout<<"         This indicates inconsistent binning in phi histograms throughout the code."<<endl;\r
-    exit(0);\r
-   }\r
-  } else \r
-    {\r
-     cout<<"WARNING: fWeightsList->FindObject(\"phi_weights\") is NULL in AFAWQC::BAFWH() !!!!"<<endl;\r
-     exit(0);\r
-    }\r
- } // end of if(fUsePhiWeights)\r
\r
- if(fUsePtWeights) \r
- {\r
-  if(fWeightsList->FindObject("pt_weights"))\r
-  {\r
-   fPtWeights = dynamic_cast<TH1D*>(fWeightsList->FindObject("pt_weights"));\r
-   if(fPtWeights->GetBinWidth(1) != fPtBinWidth)\r
-   {\r
-    cout<<"WARNING: fPtWeights->GetBinWidth(1) != fPtBinWidth in AFAWQC::BAFWH() !!!!         "<<endl;\r
-    cout<<"         This indicates insconsistent binning in pt histograms throughout the code."<<endl;\r
-    exit(0);\r
-   }\r
-  } else \r
-    {\r
-     cout<<"WARNING: fWeightsList->FindObject(\"pt_weights\") is NULL in AFAWQC::BAFWH() !!!!"<<endl;\r
-     exit(0);\r
-    }\r
- } // end of if(fUsePtWeights)    \r
-\r
- if(fUseEtaWeights) \r
- {\r
-  if(fWeightsList->FindObject("eta_weights"))\r
-  {\r
-   fEtaWeights = dynamic_cast<TH1D*>(fWeightsList->FindObject("eta_weights"));\r
-   if(fEtaWeights->GetBinWidth(1) != fEtaBinWidth)\r
-   {\r
-    cout<<"WARNING: fEtaWeights->GetBinWidth(1) != fEtaBinWidth in AFAWQC::BAFWH() !!!!        "<<endl;\r
-    cout<<"         This indicates insconsistent binning in eta histograms throughout the code."<<endl;\r
-    exit(0);\r
-   }\r
-  } else \r
-    {\r
-     cout<<"WARNING: fUseEtaWeights && fWeightsList->FindObject(\"eta_weights\") is NULL in AFAWQC::BAFWH() !!!!"<<endl;\r
-     exit(0);\r
-    }\r
- } // end of if(fUseEtaWeights)\r
\r
-} // end of AliFlowAnalysisWithQCumulants::BookAndFillWeightsHistograms()\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::BookEverythingForIntegratedFlow()\r
-{\r
- // Book all objects for integrated flow:\r
- //  a) Book profile to hold all flags for integrated flow.\r
- //  b) Book event-by-event quantities.\r
- //  c) Book profiles. // to be improved (comment)\r
- //  d) Book histograms holding the final results.\r
\r
- TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data members?)\r
- TString powerFlag[2] = {"linear","quadratic"}; // to be improved (should I promote this to data members?)\r
\r
- // a) Book profile to hold all flags for integrated flow:\r
- TString intFlowFlagsName = "fIntFlowFlags";\r
- intFlowFlagsName += fAnalysisLabel->Data();\r
- fIntFlowFlags = new TProfile(intFlowFlagsName.Data(),"Flags for Integrated Flow",3,0,3);\r
- fIntFlowFlags->SetTickLength(-0.01,"Y");\r
- fIntFlowFlags->SetMarkerStyle(25);\r
- fIntFlowFlags->SetLabelSize(0.05);\r
- fIntFlowFlags->SetLabelOffset(0.02,"Y");\r
- (fIntFlowFlags->GetXaxis())->SetBinLabel(1,"Particle Weights");\r
- (fIntFlowFlags->GetXaxis())->SetBinLabel(2,"Event Weights");\r
- (fIntFlowFlags->GetXaxis())->SetBinLabel(3,"Corrected for NUA?");\r
- fIntFlowList->Add(fIntFlowFlags);\r
-\r
- // b) Book event-by-event quantities:\r
- // Re[Q_{m*n,k}], Im[Q_{m*n,k}] and S_{p,k}^M: \r
- fReQ  = new TMatrixD(4,9);\r
- fImQ  = new TMatrixD(4,9);\r
- fSMpk = new TMatrixD(8,9);\r
- // average correlations <2>, <4>, <6> and <8> for single event (bining is the same as in fIntFlowCorrelationsPro and fIntFlowCorrelationsHist):\r
- TString intFlowCorrelationsEBEName = "fIntFlowCorrelationsEBE";\r
- intFlowCorrelationsEBEName += fAnalysisLabel->Data();\r
- fIntFlowCorrelationsEBE = new TH1D(intFlowCorrelationsEBEName.Data(),intFlowCorrelationsEBEName.Data(),4,0,4);\r
- // weights for average correlations <2>, <4>, <6> and <8> for single event:\r
- TString intFlowEventWeightsForCorrelationsEBEName = "fIntFlowEventWeightsForCorrelationsEBE";\r
- intFlowEventWeightsForCorrelationsEBEName += fAnalysisLabel->Data();\r
- fIntFlowEventWeightsForCorrelationsEBE = new TH1D(intFlowEventWeightsForCorrelationsEBEName.Data(),intFlowEventWeightsForCorrelationsEBEName.Data(),4,0,4);\r
- // average all correlations for single event (bining is the same as in fIntFlowCorrelationsAllPro and fIntFlowCorrelationsAllHist):\r
- TString intFlowCorrelationsAllEBEName = "fIntFlowCorrelationsAllEBE";\r
- intFlowCorrelationsAllEBEName += fAnalysisLabel->Data();\r
- fIntFlowCorrelationsAllEBE = new TH1D(intFlowCorrelationsAllEBEName.Data(),intFlowCorrelationsAllEBEName.Data(),32,0,32);\r
- // average correction terms for non-uniform acceptance for single event \r
- // (binning is the same as in fIntFlowCorrectionTermsForNUAPro[2] and fIntFlowCorrectionTermsForNUAHist[2]):\r
- TString fIntFlowCorrectionTermsForNUAEBEName = "fIntFlowCorrectionTermsForNUAEBE";\r
- fIntFlowCorrectionTermsForNUAEBEName += fAnalysisLabel->Data();\r
- for(Int_t sc=0;sc<2;sc++) // sin or cos terms\r
- {\r
-  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()),10,0,10);  \r
- }\r
\r
- // c) Book profiles: // to be improved (comment)\r
- // profile to hold average multiplicities and number of events for events with nRP>=0, nRP>=1, ... , and nRP>=8:\r
- TString avMultiplicityName = "fAvMultiplicity";\r
- avMultiplicityName += fAnalysisLabel->Data();\r
- fAvMultiplicity = new TProfile(avMultiplicityName.Data(),"Average Multiplicities of RPs",9,0,9);\r
- fAvMultiplicity->SetTickLength(-0.01,"Y");\r
- fAvMultiplicity->SetMarkerStyle(25);\r
- fAvMultiplicity->SetLabelSize(0.05);\r
- fAvMultiplicity->SetLabelOffset(0.02,"Y");\r
- fAvMultiplicity->SetYTitle("Average Multiplicity");\r
- (fAvMultiplicity->GetXaxis())->SetBinLabel(1,"all evts");\r
- (fAvMultiplicity->GetXaxis())->SetBinLabel(2,"n_{RP} #geq 1");\r
- (fAvMultiplicity->GetXaxis())->SetBinLabel(3,"n_{RP} #geq 2");\r
- (fAvMultiplicity->GetXaxis())->SetBinLabel(4,"n_{RP} #geq 3");\r
- (fAvMultiplicity->GetXaxis())->SetBinLabel(5,"n_{RP} #geq 4");\r
- (fAvMultiplicity->GetXaxis())->SetBinLabel(6,"n_{RP} #geq 5");\r
- (fAvMultiplicity->GetXaxis())->SetBinLabel(7,"n_{RP} #geq 6");\r
- (fAvMultiplicity->GetXaxis())->SetBinLabel(8,"n_{RP} #geq 7");\r
- (fAvMultiplicity->GetXaxis())->SetBinLabel(9,"n_{RP} #geq 8");\r
- fIntFlowProfiles->Add(fAvMultiplicity);\r
- // average correlations <<2>>, <<4>>, <<6>> and <<8>> for all events (with wrong errors!):\r
- TString intFlowCorrelationsProName = "fIntFlowCorrelationsPro";\r
- intFlowCorrelationsProName += fAnalysisLabel->Data();\r
- fIntFlowCorrelationsPro = new TProfile(intFlowCorrelationsProName.Data(),"Average correlations for all events",4,0,4,"s");\r
- fIntFlowCorrelationsPro->SetTickLength(-0.01,"Y");\r
- fIntFlowCorrelationsPro->SetMarkerStyle(25);\r
- fIntFlowCorrelationsPro->SetLabelSize(0.06);\r
- fIntFlowCorrelationsPro->SetLabelOffset(0.01,"Y");\r
- (fIntFlowCorrelationsPro->GetXaxis())->SetBinLabel(1,"<<2>>");\r
- (fIntFlowCorrelationsPro->GetXaxis())->SetBinLabel(2,"<<4>>");\r
- (fIntFlowCorrelationsPro->GetXaxis())->SetBinLabel(3,"<<6>>");\r
- (fIntFlowCorrelationsPro->GetXaxis())->SetBinLabel(4,"<<8>>");\r
- fIntFlowProfiles->Add(fIntFlowCorrelationsPro);\r
- // averaged all correlations for all events (with wrong errors!):\r
- TString intFlowCorrelationsAllProName = "fIntFlowCorrelationsAllPro";\r
- intFlowCorrelationsAllProName += fAnalysisLabel->Data();\r
- fIntFlowCorrelationsAllPro = new TProfile(intFlowCorrelationsAllProName.Data(),"Average correlations for all events",32,0,32,"s");\r
- fIntFlowCorrelationsAllPro->SetTickLength(-0.01,"Y");\r
- fIntFlowCorrelationsAllPro->SetMarkerStyle(25);\r
- fIntFlowCorrelationsAllPro->SetLabelSize(0.03);\r
- fIntFlowCorrelationsAllPro->SetLabelOffset(0.01,"Y");\r
- // 2-p correlations:\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(1,"<<2>>_{n|n}");\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(2,"<<2>>_{2n|2n}");\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(3,"<<2>>_{3n|3n}");\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(4,"<<2>>_{4n|4n}");\r
- // 3-p correlations:\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(6,"<<3>>_{2n|n,n}");\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(7,"<<3>>_{3n|2n,n}");\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(8,"<<3>>_{4n|2n,2n}");\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(9,"<<3>>_{4n|3n,n}");\r
- // 4-p correlations:\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(11,"<<4>>_{n,n|n,n}"); \r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(12,"<<4>>_{2n,n|2n,n}");\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(13,"<<4>>_{2n,2n|2n,2n}");\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(14,"<<4>>_{3n|n,n,n}");\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(15,"<<4>>_{3n,n|3n,n}");\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(16,"<<4>>_{3n,n|2n,2n}"); \r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(17,"<<4>>_{4n|2n,n,n}");\r
- // 5-p correlations:\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(19,"<<5>>_{2n|n,n,n,n}"); \r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(20,"<<5>>_{2n,2n|2n,n,n}");\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(21,"<<5>>_{3n,n|2n,n,n}");\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(22,"<<5>>_{4n|n,n,n,n}");\r
- // 6-p correlations:\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(24,"<<6>>_{n,n,n|n,n,n}");\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(25,"<<6>>_{2n,n,n|2n,n,n}");\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(26,"<<6>>_{2n,2n|n,n,n,n}");\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(27,"<<6>>_{3n,n|n,n,n,n}");\r
- // 7-p correlations:  \r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(29,"<<7>>_{2n,n,n|n,n,n,n}");\r
- // 8-p correlations:\r
- (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(31,"<<8>>_{n,n,n,n|n,n,n,n}");\r
+ } // end of if(fEvaluateDiffFlowNestedLoops)
+                                                                                                                                                                                                                                                                                                                                   
+} // end of AliFlowAnalysisWithQCumulants::Finish()
+
+
+//================================================================================================================================
+
+
+void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTerms()
+{
+ // calculate corrections for non-uniform acceptance of the detector for no-name integrated flow (cos terms)
+ // multiplicity:
+ Double_t dMult = (*fSMpk)(0,0);
+ // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
+ Double_t dReQ1n = (*fReQ)(0,0);
+ Double_t dReQ2n = (*fReQ)(1,0);
+ //Double_t dReQ3n = (*fReQ)(2,0);
+ //Double_t dReQ4n = (*fReQ)(3,0);
+ Double_t dImQ1n = (*fImQ)(0,0);
+ Double_t dImQ2n = (*fImQ)(1,0);
+ //Double_t dImQ3n = (*fImQ)(2,0);
+ //Double_t dImQ4n = (*fImQ)(3,0);
+        
+ //                                  *************************************************************
+ //                                  **** corrections for non-uniform acceptance (cos terms): ****
+ //                                  *************************************************************
+ //
+ // Remark 1: corrections for non-uniform acceptance (cos terms) calculated with non-weighted Q-vectors 
+ //           are stored in 1D profile fQCorrectionsCos.
+ // Remark 2: binning of fIntFlowCorrectionTermsForNUAPro[1] is organized as follows:
+ // --------------------------------------------------------------------------------------------------------------------
+ // 1st bin: <<cos(n*(phi1))>> = cosP1n
+ // 2nd bin: <<cos(n*(phi1+phi2))>> = cosP1nP1n
+ // 3rd bin: <<cos(n*(phi1-phi2-phi3))>> = cosP1nM1nM1n
+ // ...
+ // --------------------------------------------------------------------------------------------------------------------
+  
+ // 1-particle:
+ Double_t cosP1n = 0.; // <<cos(n*(phi1))>>
+   
+ if(dMult>0)
+ {
+  cosP1n = dReQ1n/dMult; 
+  
+  // average non-weighted 1-particle correction (cos terms) for non-uniform acceptance for single event:
+  fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(1,cosP1n);
+  
+  // final average non-weighted 1-particle correction (cos terms) for non-uniform acceptance for all events:
+  fIntFlowCorrectionTermsForNUAPro[1]->Fill(0.5,cosP1n,dMult);  
+ } 
+ // 2-particle:
+ Double_t cosP1nP1n = 0.; // <<cos(n*(phi1+phi2))>>
+ if(dMult>1)
+ {
+  cosP1nP1n = (pow(dReQ1n,2)-pow(dImQ1n,2)-dReQ2n)/(dMult*(dMult-1)); 
+  
+  // average non-weighted 2-particle correction (cos terms) for non-uniform acceptance for single event:
+  fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(2,cosP1nP1n);
+  
+  // final average non-weighted 2-particle correction (cos terms) for non-uniform acceptance for all events:
+  fIntFlowCorrectionTermsForNUAPro[1]->Fill(1.5,cosP1nP1n,dMult*(dMult-1));  
+ } 
+ // 3-particle:
+ Double_t cosP1nM1nM1n = 0.; // <<cos(n*(phi1-phi2-phi3))>>
+ if(dMult>2)
+ {
+  cosP1nM1nM1n = (dReQ1n*(pow(dReQ1n,2)+pow(dImQ1n,2))-dReQ1n*dReQ2n-dImQ1n*dImQ2n-2.*(dMult-1)*dReQ1n)
+               / (dMult*(dMult-1)*(dMult-2)); 
+  
+  // average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for single event:
+  fIntFlowCorrectionTermsForNUAEBE[1]->SetBinContent(3,cosP1nM1nM1n);
+  
+  // final average non-weighted 3-particle correction (cos terms) for non-uniform acceptance for all events:
+  fIntFlowCorrectionTermsForNUAPro[1]->Fill(2.5,cosP1nM1nM1n,dMult*(dMult-1)*(dMult-2));  
+ } 
+} // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUACosTerms()
+
+
+//================================================================================================================================
+
+
+void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTerms()
+{
+ // calculate corrections for non-uniform acceptance of the detector for no-name integrated flow (sin terms)
+ // multiplicity:
+ Double_t dMult = (*fSMpk)(0,0);
+ // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
+ Double_t dReQ1n = (*fReQ)(0,0);
+ Double_t dReQ2n = (*fReQ)(1,0);
+ //Double_t dReQ3n = (*fReQ)(2,0);
+ //Double_t dReQ4n = (*fReQ)(3,0);
+ Double_t dImQ1n = (*fImQ)(0,0);
+ Double_t dImQ2n = (*fImQ)(1,0);
+ //Double_t dImQ3n = (*fImQ)(2,0);
+ //Double_t dImQ4n = (*fImQ)(3,0);
+        
+ //                                  *************************************************************
+ //                                  **** corrections for non-uniform acceptance (sin terms): ****
+ //                                  *************************************************************
+ //
+ // Remark 1: corrections for non-uniform acceptance (sin terms) calculated with non-weighted Q-vectors 
+ //           are stored in 1D profile fQCorrectionsSin.
+ // Remark 2: binning of fIntFlowCorrectionTermsForNUAPro[0] is organized as follows:
+ // --------------------------------------------------------------------------------------------------------------------
+ // 1st bin: <<sin(n*(phi1))>> = sinP1n
+ // 2nd bin: <<sin(n*(phi1+phi2))>> = sinP1nP1n
+ // 3rd bin: <<sin(n*(phi1-phi2-phi3))>> = sinP1nM1nM1n
+ // ...
+ // --------------------------------------------------------------------------------------------------------------------
+ // 1-particle:
+ Double_t sinP1n = 0.; // <sin(n*(phi1))>
+ if(dMult>0)
+ {
+  sinP1n = dImQ1n/dMult; 
+     
+  // average non-weighted 1-particle correction (sin terms) for non-uniform acceptance for single event:
+  fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(1,sinP1n);
+  
+  // final average non-weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:   
+  fIntFlowCorrectionTermsForNUAPro[0]->Fill(0.5,sinP1n,dMult);  
+ } 
+ // 2-particle:
+ Double_t sinP1nP1n = 0.; // <<sin(n*(phi1+phi2))>>
+ if(dMult>1)
+ {
+  sinP1nP1n = (2.*dReQ1n*dImQ1n-dImQ2n)/(dMult*(dMult-1)); 
+     
+  // average non-weighted 2-particle correction (sin terms) for non-uniform acceptance for single event:
+  fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(2,sinP1nP1n);
+  
+  // final average non-weighted 1-particle correction (sin terms) for non-uniform acceptance for all events:      
+  fIntFlowCorrectionTermsForNUAPro[0]->Fill(1.5,sinP1nP1n,dMult*(dMult-1));  
+ } 
+ // 3-particle:
+ Double_t sinP1nM1nM1n = 0.; // <<sin(n*(phi1-phi2-phi3))>>
+ if(dMult>2)
+ {
+  sinP1nM1nM1n = (-dImQ1n*(pow(dReQ1n,2)+pow(dImQ1n,2))+dReQ1n*dImQ2n-dImQ1n*dReQ2n+2.*(dMult-1)*dImQ1n)
+               / (dMult*(dMult-1)*(dMult-2)); 
+  
+  // average non-weighted 3-particle correction (sin terms) for non-uniform acceptance for single event:
+  fIntFlowCorrectionTermsForNUAEBE[0]->SetBinContent(3,sinP1nM1nM1n);
+  
+  // final average non-weighted 3-particle correction (sin terms) for non-uniform acceptance for all events:  
+  fIntFlowCorrectionTermsForNUAPro[0]->Fill(2.5,sinP1nM1nM1n,dMult*(dMult-1)*(dMult-2));  
+ } 
+} // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrectionsForNUASinTerms()
+
+
+//================================================================================================================================
+
+
+void AliFlowAnalysisWithQCumulants::GetOutputHistograms(TList *outputListHistos)
+{
+ // a) Get pointers for common control and common result histograms and profiles.
+ // b) Get pointers for histograms with particle weights.
+ // c) Get pointers for histograms and profiles relevant for integrated flow.
+ // d) Get pointers for histograms and profiles relevant for differental flow.
+ // e) Get pointers for histograms and profiles holding results obtained with nested loops.
+ if(outputListHistos)
+ {     
+  this->GetPointersForCommonHistograms(outputListHistos); // to be improved (no need to pass here argument, use setter for base list instead)
+  this->GetPointersForParticleWeightsHistograms(outputListHistos); // to be improved (no need to pass here argument, use setter for base list instead)
+  this->GetPointersForIntFlowHistograms(outputListHistos); // to be improved (no need to pass here argument, use setter for base list instead)
+  this->GetPointersForDiffFlowHistograms(outputListHistos); // to be improved (no need to pass here argument, use setter for base list instead)
+  this->GetPointersForNestedLoopsHistograms(outputListHistos); // to be improved (no need to pass here argument, use setter for base list instead)
+ }
+   
+} // end of void AliFlowAnalysisWithQCumulants::GetOutputHistograms(TList *outputListHistos)
+
+
+//================================================================================================================================
+
+
+TProfile* AliFlowAnalysisWithQCumulants::MakePtProjection(TProfile2D *profilePtEta) const
+{
+ // project 2D profile onto pt axis to get 1D profile
+ Int_t nBinsPt   = profilePtEta->GetNbinsX();
+ Double_t dPtMin = (profilePtEta->GetXaxis())->GetXmin();
+ Double_t dPtMax = (profilePtEta->GetXaxis())->GetXmax();
+ Int_t nBinsEta   = profilePtEta->GetNbinsY();
+ TProfile *profilePt = new TProfile("","",nBinsPt,dPtMin,dPtMax); 
+ for(Int_t p=1;p<=nBinsPt;p++)
+ {
+  Double_t contentPt = 0.;
+  Double_t entryPt = 0.;
+  Double_t spreadPt = 0.;
+  Double_t sum1 = 0.;
+  Double_t sum2 = 0.;
+  Double_t sum3 = 0.;
+  for(Int_t e=1;e<=nBinsEta;e++)
+  {
+   contentPt += (profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)))
+              * (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
+   entryPt   += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
+   
+   sum1 += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)))
+         * (pow(profilePtEta->GetBinError(profilePtEta->GetBin(p,e)),2.)
+            + pow(profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)),2.)); 
+   sum2 += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
+   sum3 += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)))
+         * (profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)));            
+  }
+  if(sum2>0. && sum1/sum2-pow(sum3/sum2,2.) > 0.)
+  {
+   spreadPt = pow(sum1/sum2-pow(sum3/sum2,2.),0.5);
+  }
+  profilePt->SetBinContent(p,contentPt);
+  profilePt->SetBinEntries(p,entryPt);
+  {
+   profilePt->SetBinError(p,spreadPt);
+  }
+  
+ }
+ return profilePt;
+} // end of TProfile* AliFlowAnalysisWithQCumulants::MakePtProjection(TProfile2D *profilePtEta)
+
+
+//================================================================================================================================
+
+
+TProfile* AliFlowAnalysisWithQCumulants::MakeEtaProjection(TProfile2D *profilePtEta) const
+{
+ // project 2D profile onto eta axis to get 1D profile
+ Int_t nBinsEta   = profilePtEta->GetNbinsY();
+ Double_t dEtaMin = (profilePtEta->GetYaxis())->GetXmin();
+ Double_t dEtaMax = (profilePtEta->GetYaxis())->GetXmax();
+ Int_t nBinsPt = profilePtEta->GetNbinsX();
+ TProfile *profileEta = new TProfile("","",nBinsEta,dEtaMin,dEtaMax); 
+ for(Int_t e=1;e<=nBinsEta;e++)
+ {
+  Double_t contentEta = 0.;
+  Double_t entryEta = 0.;
+  for(Int_t p=1;p<=nBinsPt;p++)
+  {
+   contentEta += (profilePtEta->GetBinContent(profilePtEta->GetBin(p,e)))
+              * (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
+   entryEta   += (profilePtEta->GetBinEntries(profilePtEta->GetBin(p,e)));
+  }
+  profileEta->SetBinContent(e,contentEta);
+  profileEta->SetBinEntries(e,entryEta);
+ }
+ return profileEta;
+} // end of TProfile* AliFlowAnalysisWithQCumulants::MakeEtaProjection(TProfile2D *profilePtEta)
+
+
+//================================================================================================================================
+
+
+void AliFlowAnalysisWithQCumulants::PrintFinalResultsForIntegratedFlow(TString type)
+{
+ // printing on the screen the final results for integrated flow (NONAME, POI and RP) // to be improved (NONAME) 
+ Int_t n = fHarmonic; 
+ if(type == "NONAME" || type == "RP" || type == "POI")
+ {
+  if(!(fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th))
+  {
+   cout<<"WARNING: fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th"<<endl;
+   cout<<"         is NULL in AFAWQC::PFRFIF() !!!!"<<endl;
+  }
+ } else
+   {
+    cout<<"WARNING: type in not from {NONAME, RP, POI} in AFAWQC::PFRFIF() !!!!"<<endl;
+    exit(0);
+   }
+ Double_t dVn[4] = {0.}; // array to hold Vn{2}, Vn{4}, Vn{6} and Vn{8}   
+ Double_t dVnErr[4] = {0.}; // array to hold errors of Vn{2}, Vn{4}, Vn{6} and Vn{8}   
+ if(type == "NONAME")
+ {
+  dVn[0] = (fCommonHistsResults2nd->GetHistIntFlow())->GetBinContent(1); 
+  dVnErr[0] = (fCommonHistsResults2nd->GetHistIntFlow())->GetBinError(1); 
+  dVn[1] = (fCommonHistsResults4th->GetHistIntFlow())->GetBinContent(1); 
+  dVnErr[1] = (fCommonHistsResults4th->GetHistIntFlow())->GetBinError(1); 
+  dVn[2] = (fCommonHistsResults6th->GetHistIntFlow())->GetBinContent(1); 
+  dVnErr[2] = (fCommonHistsResults6th->GetHistIntFlow())->GetBinError(1); 
+  dVn[3] = (fCommonHistsResults8th->GetHistIntFlow())->GetBinContent(1); 
+  dVnErr[3] = (fCommonHistsResults8th->GetHistIntFlow())->GetBinError(1); 
+ } else if(type == "RP")
+   {
+    dVn[0] = (fCommonHistsResults2nd->GetHistIntFlowRP())->GetBinContent(1); 
+    dVnErr[0] = (fCommonHistsResults2nd->GetHistIntFlowRP())->GetBinError(1); 
+    dVn[1] = (fCommonHistsResults4th->GetHistIntFlowRP())->GetBinContent(1); 
+    dVnErr[1] = (fCommonHistsResults4th->GetHistIntFlowRP())->GetBinError(1); 
+    dVn[2] = (fCommonHistsResults6th->GetHistIntFlowRP())->GetBinContent(1); 
+    dVnErr[2] = (fCommonHistsResults6th->GetHistIntFlowRP())->GetBinError(1); 
+    dVn[3] = (fCommonHistsResults8th->GetHistIntFlowRP())->GetBinContent(1); 
+    dVnErr[3] = (fCommonHistsResults8th->GetHistIntFlowRP())->GetBinError(1); 
+   } else if(type == "POI")
+     {
+      dVn[0] = (fCommonHistsResults2nd->GetHistIntFlowPOI())->GetBinContent(1); 
+      dVnErr[0] = (fCommonHistsResults2nd->GetHistIntFlowPOI())->GetBinError(1); 
+      dVn[1] = (fCommonHistsResults4th->GetHistIntFlowPOI())->GetBinContent(1); 
+      dVnErr[1] = (fCommonHistsResults4th->GetHistIntFlowPOI())->GetBinError(1); 
+      dVn[2] = (fCommonHistsResults6th->GetHistIntFlowPOI())->GetBinContent(1); 
+      dVnErr[2] = (fCommonHistsResults6th->GetHistIntFlowPOI())->GetBinError(1); 
+      dVn[3] = (fCommonHistsResults8th->GetHistIntFlowPOI())->GetBinContent(1); 
+      dVnErr[3] = (fCommonHistsResults8th->GetHistIntFlowPOI())->GetBinError(1); 
+     }
+ TString title = " flow estimates from Q-cumulants"; 
+ TString subtitle = "    ("; 
+ if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights))
+ {
+  subtitle.Append(type);
+  subtitle.Append(", without weights)");
+ } else  
+   {
+    subtitle.Append(type);
+    subtitle.Append(", with weights)");
+   }
+  
+ cout<<endl;
+ cout<<"*************************************"<<endl;
+ cout<<"*************************************"<<endl;
+ cout<<title.Data()<<endl; 
+ cout<<subtitle.Data()<<endl; 
+ cout<<endl;
+  
+ for(Int_t i=0;i<4;i++)
+ {
+  if(dVn[i]>=0.)
+  {
+   cout<<"  v_"<<n<<"{"<<2*(i+1)<<"} = "<<dVn[i]<<" +/- "<<dVnErr[i]<<endl;
+  }
+  else
+  {
+   cout<<"  v_"<<n<<"{"<<2*(i+1)<<"} = Im"<<endl;
+  }  
+ }
+
+ cout<<endl;
+ /*
+ if(type == "NONAME")
+ {
+  cout<<"     nEvts = "<<nEvtsNoName<<", AvM = "<<dMultNoName<<endl; // to be improved
+ }
+ else if (type == "RP")
+ {
+  cout<<"     nEvts = "<<nEvtsRP<<", AvM = "<<dMultRP<<endl; // to be improved  
+ } 
+ else if (type == "POI")
+ {
+  cout<<"     nEvts = "<<nEvtsPOI<<", AvM = "<<dMultPOI<<endl; // to be improved  
+ } 
+ */
+ cout<<"*************************************"<<endl;
+ cout<<"*************************************"<<endl;
+ cout<<endl; 
+  
+}// end of AliFlowAnalysisWithQCumulants::PrintFinalResultsForIntegratedFlow(TString type="NONAME");
+
+
+//================================================================================================================================
+
+
+void AliFlowAnalysisWithQCumulants::WriteHistograms(TString outputFileName)
+{
+ //store the final results in output .root file
+ TFile *output = new TFile(outputFileName.Data(),"RECREATE");
+ //output->WriteObject(fHistList, "cobjQC","SingleKey");
+ fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
+ delete output;
+}
+
+
+//================================================================================================================================
+
+
+void AliFlowAnalysisWithQCumulants::BookCommonHistograms()
+{
+ // Book common control histograms and common histograms for final results.
+ // common control histogram (ALL events)
+ TString commonHistsName = "AliFlowCommonHistQC";
+ commonHistsName += fAnalysisLabel->Data();
+ fCommonHists = new AliFlowCommonHist(commonHistsName.Data());
+ fHistList->Add(fCommonHists);  
+ // common control histogram (for events with 2 and more particles)
+ TString commonHists2ndOrderName = "AliFlowCommonHist2ndOrderQC";
+ commonHists2ndOrderName += fAnalysisLabel->Data();
+ fCommonHists2nd = new AliFlowCommonHist(commonHists2ndOrderName.Data());
+ fHistList->Add(fCommonHists2nd);  
+ // common control histogram (for events with 4 and more particles)
+ TString commonHists4thOrderName = "AliFlowCommonHist4thOrderQC";
+ commonHists4thOrderName += fAnalysisLabel->Data();
+ fCommonHists4th = new AliFlowCommonHist(commonHists4thOrderName.Data());
+ fHistList->Add(fCommonHists4th);  
+ // common control histogram (for events with 6 and more particles)
+ TString commonHists6thOrderName = "AliFlowCommonHist6thOrderQC";
+ commonHists6thOrderName += fAnalysisLabel->Data();
+ fCommonHists6th = new AliFlowCommonHist(commonHists6thOrderName.Data());
+ fHistList->Add(fCommonHists6th);  
+ // common control histogram (for events with 8 and more particles)
+ TString commonHists8thOrderName = "AliFlowCommonHist8thOrderQC";
+ commonHists8thOrderName += fAnalysisLabel->Data();
+ fCommonHists8th = new AliFlowCommonHist(commonHists8thOrderName.Data());
+ fHistList->Add(fCommonHists8th);    
+ // common histograms for final results (calculated for events with 2 and more particles)
+ TString commonHistResults2ndOrderName = "AliFlowCommonHistResults2ndOrderQC";
+ commonHistResults2ndOrderName += fAnalysisLabel->Data();
+ fCommonHistsResults2nd = new AliFlowCommonHistResults(commonHistResults2ndOrderName.Data());
+ fHistList->Add(fCommonHistsResults2nd);  
+ // common histograms for final results (calculated for events with 4 and more particles)
+ TString commonHistResults4thOrderName = "AliFlowCommonHistResults4thOrderQC";
+ commonHistResults4thOrderName += fAnalysisLabel->Data();
+ fCommonHistsResults4th = new AliFlowCommonHistResults(commonHistResults4thOrderName.Data());
+ fHistList->Add(fCommonHistsResults4th); 
+ // common histograms for final results (calculated for events with 6 and more particles)
+ TString commonHistResults6thOrderName = "AliFlowCommonHistResults6thOrderQC";
+ commonHistResults6thOrderName += fAnalysisLabel->Data();
+ fCommonHistsResults6th = new AliFlowCommonHistResults(commonHistResults6thOrderName.Data());
+ fHistList->Add(fCommonHistsResults6th);  
+ // common histograms for final results (calculated for events with 8 and more particles)
+ TString commonHistResults8thOrderName = "AliFlowCommonHistResults8thOrderQC";
+ commonHistResults8thOrderName += fAnalysisLabel->Data();
+ fCommonHistsResults8th = new AliFlowCommonHistResults(commonHistResults8thOrderName.Data());
+ fHistList->Add(fCommonHistsResults8th); 
+} // end of void AliFlowAnalysisWithQCumulants::BookCommonHistograms()
+
+
+//================================================================================================================================
+
+
+void AliFlowAnalysisWithQCumulants::BookAndFillWeightsHistograms()
+{
+ // book and fill histograms which hold phi, pt and eta weights
+
+ if(!fWeightsList)
+ {
+  cout<<"WARNING: fWeightsList is NULL in AFAWQC::BAFWH() !!!!"<<endl;
+  exit(0);  
+ }
+    
+ TString fUseParticleWeightsName = "fUseParticleWeightsQC";
+ fUseParticleWeightsName += fAnalysisLabel->Data();
+ fUseParticleWeights = new TProfile(fUseParticleWeightsName.Data(),"0 = particle weight not used, 1 = particle weight used ",3,0,3);
+ fUseParticleWeights->SetLabelSize(0.06);
+ (fUseParticleWeights->GetXaxis())->SetBinLabel(1,"w_{#phi}");
+ (fUseParticleWeights->GetXaxis())->SetBinLabel(2,"w_{p_{T}}");
+ (fUseParticleWeights->GetXaxis())->SetBinLabel(3,"w_{#eta}");
+ fUseParticleWeights->Fill(0.5,(Int_t)fUsePhiWeights);
+ fUseParticleWeights->Fill(1.5,(Int_t)fUsePtWeights);
+ fUseParticleWeights->Fill(2.5,(Int_t)fUseEtaWeights);
+ fWeightsList->Add(fUseParticleWeights); 
+  
+ if(fUsePhiWeights)
+ {
+  if(fWeightsList->FindObject("phi_weights"))
+  {
+   fPhiWeights = dynamic_cast<TH1F*>(fWeightsList->FindObject("phi_weights"));
+   if(fPhiWeights->GetBinWidth(1) != fPhiBinWidth)
+   {
+    cout<<"WARNING: fPhiWeights->GetBinWidth(1) != fPhiBinWidth in AFAWQC::BAFWH() !!!!        "<<endl;
+    cout<<"         This indicates inconsistent binning in phi histograms throughout the code."<<endl;
+    exit(0);
+   }
+  } else 
+    {
+     cout<<"WARNING: fWeightsList->FindObject(\"phi_weights\") is NULL in AFAWQC::BAFWH() !!!!"<<endl;
+     exit(0);
+    }
+ } // end of if(fUsePhiWeights)
+ if(fUsePtWeights) 
+ {
+  if(fWeightsList->FindObject("pt_weights"))
+  {
+   fPtWeights = dynamic_cast<TH1D*>(fWeightsList->FindObject("pt_weights"));
+   if(fPtWeights->GetBinWidth(1) != fPtBinWidth)
+   {
+    cout<<"WARNING: fPtWeights->GetBinWidth(1) != fPtBinWidth in AFAWQC::BAFWH() !!!!         "<<endl;
+    cout<<"         This indicates insconsistent binning in pt histograms throughout the code."<<endl;
+    exit(0);
+   }
+  } else 
+    {
+     cout<<"WARNING: fWeightsList->FindObject(\"pt_weights\") is NULL in AFAWQC::BAFWH() !!!!"<<endl;
+     exit(0);
+    }
+ } // end of if(fUsePtWeights)    
+
+ if(fUseEtaWeights) 
+ {
+  if(fWeightsList->FindObject("eta_weights"))
+  {
+   fEtaWeights = dynamic_cast<TH1D*>(fWeightsList->FindObject("eta_weights"));
+   if(fEtaWeights->GetBinWidth(1) != fEtaBinWidth)
+   {
+    cout<<"WARNING: fEtaWeights->GetBinWidth(1) != fEtaBinWidth in AFAWQC::BAFWH() !!!!        "<<endl;
+    cout<<"         This indicates insconsistent binning in eta histograms throughout the code."<<endl;
+    exit(0);
+   }
+  } else 
+    {
+     cout<<"WARNING: fUseEtaWeights && fWeightsList->FindObject(\"eta_weights\") is NULL in AFAWQC::BAFWH() !!!!"<<endl;
+     exit(0);
+    }
+ } // end of if(fUseEtaWeights)
+} // end of AliFlowAnalysisWithQCumulants::BookAndFillWeightsHistograms()
+
+
+//================================================================================================================================
+
+
+void AliFlowAnalysisWithQCumulants::BookEverythingForIntegratedFlow()
+{
+ // Book all objects for integrated flow:
+ //  a) Book profile to hold all flags for integrated flow.
+ //  b) Book event-by-event quantities.
+ //  c) Book profiles. // to be improved (comment)
+ //  d) Book histograms holding the final results.
+ TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data members?)
+ TString powerFlag[2] = {"linear","quadratic"}; // to be improved (should I promote this to data members?)
+ // a) Book profile to hold all flags for integrated flow:
+ TString intFlowFlagsName = "fIntFlowFlags";
+ intFlowFlagsName += fAnalysisLabel->Data();
+ fIntFlowFlags = new TProfile(intFlowFlagsName.Data(),"Flags for Integrated Flow",3,0,3);
+ fIntFlowFlags->SetTickLength(-0.01,"Y");
+ fIntFlowFlags->SetMarkerStyle(25);
+ fIntFlowFlags->SetLabelSize(0.05);
+ fIntFlowFlags->SetLabelOffset(0.02,"Y");
+ (fIntFlowFlags->GetXaxis())->SetBinLabel(1,"Particle Weights");
+ (fIntFlowFlags->GetXaxis())->SetBinLabel(2,"Event Weights");
+ (fIntFlowFlags->GetXaxis())->SetBinLabel(3,"Corrected for NUA?");
+ fIntFlowList->Add(fIntFlowFlags);
+
+ // b) Book event-by-event quantities:
+ // Re[Q_{m*n,k}], Im[Q_{m*n,k}] and S_{p,k}^M: 
+ fReQ  = new TMatrixD(4,9);
+ fImQ  = new TMatrixD(4,9);
+ fSMpk = new TMatrixD(8,9);
+ // average correlations <2>, <4>, <6> and <8> for single event (bining is the same as in fIntFlowCorrelationsPro and fIntFlowCorrelationsHist):
+ TString intFlowCorrelationsEBEName = "fIntFlowCorrelationsEBE";
+ intFlowCorrelationsEBEName += fAnalysisLabel->Data();
+ fIntFlowCorrelationsEBE = new TH1D(intFlowCorrelationsEBEName.Data(),intFlowCorrelationsEBEName.Data(),4,0,4);
+ // weights for average correlations <2>, <4>, <6> and <8> for single event:
+ TString intFlowEventWeightsForCorrelationsEBEName = "fIntFlowEventWeightsForCorrelationsEBE";
+ intFlowEventWeightsForCorrelationsEBEName += fAnalysisLabel->Data();
+ fIntFlowEventWeightsForCorrelationsEBE = new TH1D(intFlowEventWeightsForCorrelationsEBEName.Data(),intFlowEventWeightsForCorrelationsEBEName.Data(),4,0,4);
+ // average all correlations for single event (bining is the same as in fIntFlowCorrelationsAllPro and fIntFlowCorrelationsAllHist):
+ TString intFlowCorrelationsAllEBEName = "fIntFlowCorrelationsAllEBE";
+ intFlowCorrelationsAllEBEName += fAnalysisLabel->Data();
+ fIntFlowCorrelationsAllEBE = new TH1D(intFlowCorrelationsAllEBEName.Data(),intFlowCorrelationsAllEBEName.Data(),32,0,32);
+ // average correction terms for non-uniform acceptance for single event 
+ // (binning is the same as in fIntFlowCorrectionTermsForNUAPro[2] and fIntFlowCorrectionTermsForNUAHist[2]):
+ TString fIntFlowCorrectionTermsForNUAEBEName = "fIntFlowCorrectionTermsForNUAEBE";
+ fIntFlowCorrectionTermsForNUAEBEName += fAnalysisLabel->Data();
+ for(Int_t sc=0;sc<2;sc++) // sin or cos terms
+ {
+  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()),10,0,10);  
+ }
+ // c) Book profiles: // to be improved (comment)
+ // profile to hold average multiplicities and number of events for events with nRP>=0, nRP>=1, ... , and nRP>=8:
+ TString avMultiplicityName = "fAvMultiplicity";
+ avMultiplicityName += fAnalysisLabel->Data();
+ fAvMultiplicity = new TProfile(avMultiplicityName.Data(),"Average Multiplicities of RPs",9,0,9);
+ fAvMultiplicity->SetTickLength(-0.01,"Y");
+ fAvMultiplicity->SetMarkerStyle(25);
+ fAvMultiplicity->SetLabelSize(0.05);
+ fAvMultiplicity->SetLabelOffset(0.02,"Y");
+ fAvMultiplicity->SetYTitle("Average Multiplicity");
+ (fAvMultiplicity->GetXaxis())->SetBinLabel(1,"all evts");
+ (fAvMultiplicity->GetXaxis())->SetBinLabel(2,"n_{RP} #geq 1");
+ (fAvMultiplicity->GetXaxis())->SetBinLabel(3,"n_{RP} #geq 2");
+ (fAvMultiplicity->GetXaxis())->SetBinLabel(4,"n_{RP} #geq 3");
+ (fAvMultiplicity->GetXaxis())->SetBinLabel(5,"n_{RP} #geq 4");
+ (fAvMultiplicity->GetXaxis())->SetBinLabel(6,"n_{RP} #geq 5");
+ (fAvMultiplicity->GetXaxis())->SetBinLabel(7,"n_{RP} #geq 6");
+ (fAvMultiplicity->GetXaxis())->SetBinLabel(8,"n_{RP} #geq 7");
+ (fAvMultiplicity->GetXaxis())->SetBinLabel(9,"n_{RP} #geq 8");
+ fIntFlowProfiles->Add(fAvMultiplicity);
+ // average correlations <<2>>, <<4>>, <<6>> and <<8>> for all events (with wrong errors!):
+ TString intFlowCorrelationsProName = "fIntFlowCorrelationsPro";
+ intFlowCorrelationsProName += fAnalysisLabel->Data();
+ fIntFlowCorrelationsPro = new TProfile(intFlowCorrelationsProName.Data(),"Average correlations for all events",4,0,4,"s");
+ fIntFlowCorrelationsPro->SetTickLength(-0.01,"Y");
+ fIntFlowCorrelationsPro->SetMarkerStyle(25);
+ fIntFlowCorrelationsPro->SetLabelSize(0.06);
+ fIntFlowCorrelationsPro->SetLabelOffset(0.01,"Y");
+ (fIntFlowCorrelationsPro->GetXaxis())->SetBinLabel(1,"<<2>>");
+ (fIntFlowCorrelationsPro->GetXaxis())->SetBinLabel(2,"<<4>>");
+ (fIntFlowCorrelationsPro->GetXaxis())->SetBinLabel(3,"<<6>>");
+ (fIntFlowCorrelationsPro->GetXaxis())->SetBinLabel(4,"<<8>>");
+ fIntFlowProfiles->Add(fIntFlowCorrelationsPro);
+ // averaged all correlations for all events (with wrong errors!):
+ TString intFlowCorrelationsAllProName = "fIntFlowCorrelationsAllPro";
+ intFlowCorrelationsAllProName += fAnalysisLabel->Data();
+ fIntFlowCorrelationsAllPro = new TProfile(intFlowCorrelationsAllProName.Data(),"Average correlations for all events",32,0,32,"s");
+ fIntFlowCorrelationsAllPro->SetTickLength(-0.01,"Y");
+ fIntFlowCorrelationsAllPro->SetMarkerStyle(25);
+ fIntFlowCorrelationsAllPro->SetLabelSize(0.03);
+ fIntFlowCorrelationsAllPro->SetLabelOffset(0.01,"Y");
+ // 2-p correlations:
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(1,"<<2>>_{n|n}");
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(2,"<<2>>_{2n|2n}");
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(3,"<<2>>_{3n|3n}");
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(4,"<<2>>_{4n|4n}");
+ // 3-p correlations:
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(6,"<<3>>_{2n|n,n}");
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(7,"<<3>>_{3n|2n,n}");
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(8,"<<3>>_{4n|2n,2n}");
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(9,"<<3>>_{4n|3n,n}");
+ // 4-p correlations:
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(11,"<<4>>_{n,n|n,n}"); 
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(12,"<<4>>_{2n,n|2n,n}");
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(13,"<<4>>_{2n,2n|2n,2n}");
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(14,"<<4>>_{3n|n,n,n}");
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(15,"<<4>>_{3n,n|3n,n}");
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(16,"<<4>>_{3n,n|2n,2n}"); 
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(17,"<<4>>_{4n|2n,n,n}");
+ // 5-p correlations:
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(19,"<<5>>_{2n|n,n,n,n}"); 
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(20,"<<5>>_{2n,2n|2n,n,n}");
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(21,"<<5>>_{3n,n|2n,n,n}");
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(22,"<<5>>_{4n|n,n,n,n}");
+ // 6-p correlations:
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(24,"<<6>>_{n,n,n|n,n,n}");
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(25,"<<6>>_{2n,n,n|2n,n,n}");
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(26,"<<6>>_{2n,2n|n,n,n,n}");
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(27,"<<6>>_{3n,n|n,n,n,n}");
+ // 7-p correlations:  
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(29,"<<7>>_{2n,n,n|n,n,n,n}");
+ // 8-p correlations:
+ (fIntFlowCorrelationsAllPro->GetXaxis())->SetBinLabel(31,"<<8>>_{n,n,n,n|n,n,n,n}");
  fIntFlowProfiles->Add(fIntFlowCorrelationsAllPro);
- // when particle weights are used some extra correlations appear:\r
+ // when particle weights are used some extra correlations appear:
  if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights) 
  {
-  TString intFlowExtraCorrelationsProName = "fIntFlowExtraCorrelationsPro";\r
-  intFlowExtraCorrelationsProName += fAnalysisLabel->Data();\r
-  fIntFlowExtraCorrelationsPro = new TProfile(intFlowExtraCorrelationsProName.Data(),"Average extra correlations for all events",100,0,100,"s");\r
-  fIntFlowExtraCorrelationsPro->SetTickLength(-0.01,"Y");\r
-  fIntFlowExtraCorrelationsPro->SetMarkerStyle(25);\r
-  fIntFlowExtraCorrelationsPro->SetLabelSize(0.03);\r
-  fIntFlowExtraCorrelationsPro->SetLabelOffset(0.01,"Y");\r
-  // extra 2-p correlations:\r
-  (fIntFlowExtraCorrelationsPro->GetXaxis())->SetBinLabel(1,"<<w1^3 w2 cos(n*(phi1-phi2))>>");\r
-  (fIntFlowExtraCorrelationsPro->GetXaxis())->SetBinLabel(2,"<<w1 w2 w3^2 cos(n*(phi1-phi2))>>");\r
+  TString intFlowExtraCorrelationsProName = "fIntFlowExtraCorrelationsPro";
+  intFlowExtraCorrelationsProName += fAnalysisLabel->Data();
+  fIntFlowExtraCorrelationsPro = new TProfile(intFlowExtraCorrelationsProName.Data(),"Average extra correlations for all events",100,0,100,"s");
+  fIntFlowExtraCorrelationsPro->SetTickLength(-0.01,"Y");
+  fIntFlowExtraCorrelationsPro->SetMarkerStyle(25);
+  fIntFlowExtraCorrelationsPro->SetLabelSize(0.03);
+  fIntFlowExtraCorrelationsPro->SetLabelOffset(0.01,"Y");
+  // extra 2-p correlations:
+  (fIntFlowExtraCorrelationsPro->GetXaxis())->SetBinLabel(1,"<<w1^3 w2 cos(n*(phi1-phi2))>>");
+  (fIntFlowExtraCorrelationsPro->GetXaxis())->SetBinLabel(2,"<<w1 w2 w3^2 cos(n*(phi1-phi2))>>");
   // ...
   fIntFlowProfiles->Add(fIntFlowExtraCorrelationsPro);
  } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)
- // average product of correlations <2>, <4>, <6> and <8>:  \r
- TString intFlowProductOfCorrelationsProName = "fIntFlowProductOfCorrelationsPro";\r
- intFlowProductOfCorrelationsProName += fAnalysisLabel->Data();\r
- fIntFlowProductOfCorrelationsPro = new TProfile(intFlowProductOfCorrelationsProName.Data(),"Average products of correlations",6,0,6);\r
- fIntFlowProductOfCorrelationsPro->SetTickLength(-0.01,"Y");\r
- fIntFlowProductOfCorrelationsPro->SetMarkerStyle(25); \r
- fIntFlowProductOfCorrelationsPro->SetLabelSize(0.05);\r
- fIntFlowProductOfCorrelationsPro->SetLabelOffset(0.01,"Y");\r
- (fIntFlowProductOfCorrelationsPro->GetXaxis())->SetBinLabel(1,"<<2><4>>");\r
- (fIntFlowProductOfCorrelationsPro->GetXaxis())->SetBinLabel(2,"<<2><6>>");\r
- (fIntFlowProductOfCorrelationsPro->GetXaxis())->SetBinLabel(3,"<<2><8>>");\r
- (fIntFlowProductOfCorrelationsPro->GetXaxis())->SetBinLabel(4,"<<4><6>>");\r
- (fIntFlowProductOfCorrelationsPro->GetXaxis())->SetBinLabel(5,"<<4><8>>");\r
- (fIntFlowProductOfCorrelationsPro->GetXaxis())->SetBinLabel(6,"<<6><8>>");\r
- fIntFlowProfiles->Add(fIntFlowProductOfCorrelationsPro);\r
- // average correction terms for non-uniform acceptance (with wrong errors!):\r
- for(Int_t sc=0;sc<2;sc++) // sin or cos terms\r
- {\r
-  TString intFlowCorrectionTermsForNUAProName = "fIntFlowCorrectionTermsForNUAPro";\r
-  intFlowCorrectionTermsForNUAProName += fAnalysisLabel->Data();\r
-  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()),10,0,10,"s");\r
-  fIntFlowCorrectionTermsForNUAPro[sc]->SetTickLength(-0.01,"Y");\r
-  fIntFlowCorrectionTermsForNUAPro[sc]->SetMarkerStyle(25);\r
-  fIntFlowCorrectionTermsForNUAPro[sc]->SetLabelSize(0.03);\r
-  fIntFlowCorrectionTermsForNUAPro[sc]->SetLabelOffset(0.01,"Y");\r
-  // 1-particle terms:\r
-  (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(1,Form("<<%s(n(phi1))>>",sinCosFlag[sc].Data()));\r
+ // average product of correlations <2>, <4>, <6> and <8>:  
+ TString intFlowProductOfCorrelationsProName = "fIntFlowProductOfCorrelationsPro";
+ intFlowProductOfCorrelationsProName += fAnalysisLabel->Data();
+ fIntFlowProductOfCorrelationsPro = new TProfile(intFlowProductOfCorrelationsProName.Data(),"Average products of correlations",6,0,6);
+ fIntFlowProductOfCorrelationsPro->SetTickLength(-0.01,"Y");
+ fIntFlowProductOfCorrelationsPro->SetMarkerStyle(25); 
+ fIntFlowProductOfCorrelationsPro->SetLabelSize(0.05);
+ fIntFlowProductOfCorrelationsPro->SetLabelOffset(0.01,"Y");
+ (fIntFlowProductOfCorrelationsPro->GetXaxis())->SetBinLabel(1,"<<2><4>>");
+ (fIntFlowProductOfCorrelationsPro->GetXaxis())->SetBinLabel(2,"<<2><6>>");
+ (fIntFlowProductOfCorrelationsPro->GetXaxis())->SetBinLabel(3,"<<2><8>>");
+ (fIntFlowProductOfCorrelationsPro->GetXaxis())->SetBinLabel(4,"<<4><6>>");
+ (fIntFlowProductOfCorrelationsPro->GetXaxis())->SetBinLabel(5,"<<4><8>>");
+ (fIntFlowProductOfCorrelationsPro->GetXaxis())->SetBinLabel(6,"<<6><8>>");
+ fIntFlowProfiles->Add(fIntFlowProductOfCorrelationsPro);
+ // average correction terms for non-uniform acceptance (with wrong errors!):
+ for(Int_t sc=0;sc<2;sc++) // sin or cos terms
+ {
+  TString intFlowCorrectionTermsForNUAProName = "fIntFlowCorrectionTermsForNUAPro";
+  intFlowCorrectionTermsForNUAProName += fAnalysisLabel->Data();
+  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()),10,0,10,"s");
+  fIntFlowCorrectionTermsForNUAPro[sc]->SetTickLength(-0.01,"Y");
+  fIntFlowCorrectionTermsForNUAPro[sc]->SetMarkerStyle(25);
+  fIntFlowCorrectionTermsForNUAPro[sc]->SetLabelSize(0.03);
+  fIntFlowCorrectionTermsForNUAPro[sc]->SetLabelOffset(0.01,"Y");
+  // 1-particle terms:
+  (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(1,Form("<<%s(n(phi1))>>",sinCosFlag[sc].Data()));
   // 2-particle terms:
-  (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(2,Form("<<%s(n(phi1+phi2))>>",sinCosFlag[sc].Data()));  \r
-  // 3-particle terms:\r
-  (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(3,Form("<<%s(n(phi1-phi2-phi3))>>",sinCosFlag[sc].Data()));  \r
-  // ... \r
-  fIntFlowProfiles->Add(fIntFlowCorrectionTermsForNUAPro[sc]);\r
- } // end of for(Int_t sc=0;sc<2;sc++) \r
\r
- // d) Book histograms holding the final results:\r
- // average correlations <<2>>, <<4>>, <<6>> and <<8>> for all events (with correct errors!):\r
- TString intFlowCorrelationsHistName = "fIntFlowCorrelationsHist";\r
- intFlowCorrelationsHistName += fAnalysisLabel->Data();\r
- fIntFlowCorrelationsHist = new TH1D(intFlowCorrelationsHistName.Data(),"Average correlations for all events",4,0,4);\r
- fIntFlowCorrelationsHist->SetTickLength(-0.01,"Y");\r
- fIntFlowCorrelationsHist->SetMarkerStyle(25);\r
- fIntFlowCorrelationsHist->SetLabelSize(0.06);\r
- fIntFlowCorrelationsHist->SetLabelOffset(0.01,"Y");\r
- (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(1,"<<2>>");\r
- (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(2,"<<4>>");\r
- (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(3,"<<6>>");\r
- (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(4,"<<8>>");\r
- fIntFlowResults->Add(fIntFlowCorrelationsHist);\r
- // average all correlations for all events (with correct errors!):\r
- TString intFlowCorrelationsAllHistName = "fIntFlowCorrelationsAllHist";\r
- intFlowCorrelationsAllHistName += fAnalysisLabel->Data();\r
- fIntFlowCorrelationsAllHist = new TH1D(intFlowCorrelationsAllHistName.Data(),"Average correlations for all events",32,0,32);\r
- fIntFlowCorrelationsAllHist->SetTickLength(-0.01,"Y");\r
- fIntFlowCorrelationsAllHist->SetMarkerStyle(25);\r
- fIntFlowCorrelationsAllHist->SetLabelSize(0.03);\r
- fIntFlowCorrelationsAllHist->SetLabelOffset(0.01,"Y");\r
- // 2-p correlations:\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(1,"<<2>>_{n|n}");\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(2,"<<2>>_{2n|2n}");\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(3,"<<2>>_{3n|3n}");\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(4,"<<2>>_{4n|4n}");\r
- // 3-p correlations:\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(6,"<<3>>_{2n|n,n}");\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(7,"<<3>>_{3n|2n,n}");\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(8,"<<3>>_{4n|2n,2n}");\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(9,"<<3>>_{4n|3n,n}");\r
- // 4-p correlations:\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(11,"<<4>>_{n,n|n,n}"); \r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(12,"<<4>>_{2n,n|2n,n}");\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(13,"<<4>>_{2n,2n|2n,2n}");\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(14,"<<4>>_{3n|n,n,n}");\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(15,"<<4>>_{3n,n|3n,n}");\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(16,"<<4>>_{3n,n|2n,2n}"); \r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(17,"<<4>>_{4n|2n,n,n}");\r
- // 5-p correlations:\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(19,"<<5>>_{2n|n,n,n,n}"); \r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(20,"<<5>>_{2n,2n|2n,n,n}");\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(21,"<<5>>_{3n,n|2n,n,n}");\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(22,"<<5>>_{4n|n,n,n,n}");\r
- // 6-p correlations:\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(24,"<<6>>_{n,n,n|n,n,n}");\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(25,"<<6>>_{2n,n,n|2n,n,n}");\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(26,"<<6>>_{2n,2n|n,n,n,n}");\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(27,"<<6>>_{3n,n|n,n,n,n}");\r
- // 7-p correlations:  \r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(29,"<<7>>_{2n,n,n|n,n,n,n}");\r
- // 8-p correlations:\r
- (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(31,"<<8>>_{n,n,n,n|n,n,n,n}");\r
- fIntFlowResults->Add(fIntFlowCorrelationsAllHist);\r
- // average correction terms for non-uniform acceptance (with correct errors!):\r
- for(Int_t sc=0;sc<2;sc++) // sin or cos terms\r
- {\r
-  TString intFlowCorrectionTermsForNUAHistName = "fIntFlowCorrectionTermsForNUAHist";\r
-  intFlowCorrectionTermsForNUAHistName += fAnalysisLabel->Data();\r
-  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()),10,0,10);\r
-  fIntFlowCorrectionTermsForNUAHist[sc]->SetTickLength(-0.01,"Y");\r
-  fIntFlowCorrectionTermsForNUAHist[sc]->SetMarkerStyle(25);\r
-  fIntFlowCorrectionTermsForNUAHist[sc]->SetLabelSize(0.03);\r
-  fIntFlowCorrectionTermsForNUAHist[sc]->SetLabelOffset(0.01,"Y");\r
-  // ......................................................................... \r
-  // 1-p terms:\r
-  (fIntFlowCorrectionTermsForNUAHist[sc]->GetXaxis())->SetBinLabel(1,Form("%s(n(#phi_{1}))>",sinCosFlag[sc].Data()));\r
-  // 2-p terms:\r
-  // 3-p terms:\r
-  // ...\r
-  // ......................................................................... \r
-  fIntFlowResults->Add(fIntFlowCorrectionTermsForNUAHist[sc]);\r
- } // end of for(Int_t sc=0;sc<2;sc++) \r
- // covariances (multiplied with weight dependent prefactor):\r
- TString intFlowCovariancesName = "fIntFlowCovariances";\r
- intFlowCovariancesName += fAnalysisLabel->Data();\r
- fIntFlowCovariances = new TH1D(intFlowCovariancesName.Data(),"Covariances (multiplied with weight dependent prefactor)",6,0,6);\r
- fIntFlowCovariances->SetLabelSize(0.04);\r
- fIntFlowCovariances->SetMarkerStyle(25);\r
- (fIntFlowCovariances->GetXaxis())->SetBinLabel(1,"Cov(<2>,<4>)");\r
- (fIntFlowCovariances->GetXaxis())->SetBinLabel(2,"Cov(<2>,<6>)");\r
- (fIntFlowCovariances->GetXaxis())->SetBinLabel(3,"Cov(<2>,<8>)");\r
- (fIntFlowCovariances->GetXaxis())->SetBinLabel(4,"Cov(<4>,<6>)");\r
- (fIntFlowCovariances->GetXaxis())->SetBinLabel(5,"Cov(<4>,<8>)");\r
- (fIntFlowCovariances->GetXaxis())->SetBinLabel(6,"Cov(<6>,<8>)");  \r
- fIntFlowResults->Add(fIntFlowCovariances);\r
- // sum of linear and quadratic event weights for <2>, <4>, <6> and <8>:\r
- TString intFlowSumOfEventWeightsName = "fIntFlowSumOfEventWeights";\r
- intFlowSumOfEventWeightsName += fAnalysisLabel->Data();\r
- for(Int_t power=0;power<2;power++)\r
- {\r
-  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);\r
-  fIntFlowSumOfEventWeights[power]->SetLabelSize(0.05);\r
-  fIntFlowSumOfEventWeights[power]->SetMarkerStyle(25);\r
-  if(power == 0)\r
-  {\r
-   (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{<2>}");\r
-   (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{<4>}");\r
-   (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{<6>}");\r
-   (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{<8>}");\r
-  } else if (power == 1) \r
-    {\r
-     (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{<2>}^{2}");\r
-     (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{<4>}^{2}");\r
-     (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{<6>}^{2}");\r
-     (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{<8>}^{2}");\r
-    }\r
-  fIntFlowResults->Add(fIntFlowSumOfEventWeights[power]);\r
- } \r
- // sum of products of event weights for correlations <2>, <4>, <6> and <8>:  \r
- TString intFlowSumOfProductOfEventWeightsName = "fIntFlowSumOfProductOfEventWeights";\r
- intFlowSumOfProductOfEventWeightsName += fAnalysisLabel->Data();\r
- fIntFlowSumOfProductOfEventWeights = new TH1D(intFlowSumOfProductOfEventWeightsName.Data(),"Sum of product of event weights for correlations",6,0,6);\r
- fIntFlowSumOfProductOfEventWeights->SetLabelSize(0.05);\r
- fIntFlowSumOfProductOfEventWeights->SetMarkerStyle(25);\r
- (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{<2>} w_{<4>}");\r
- (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{<2>} w_{<6>}");\r
- (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{<2>} w_{<8>}");\r
- (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{<4>} w_{<6>}");\r
- (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(5,"#sum_{i=1}^{N} w_{<4>} w_{<8>}");\r
- (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(6,"#sum_{i=1}^{N} w_{<6>} w_{<8>}");\r
- fIntFlowResults->Add(fIntFlowSumOfProductOfEventWeights);\r
- // final results for integrated Q-cumulants:\r
- TString intFlowQcumulantsName = "fIntFlowQcumulants";\r
- intFlowQcumulantsName += fAnalysisLabel->Data();\r
- fIntFlowQcumulants = new TH1D(intFlowQcumulantsName.Data(),"Integrated Q-cumulants",4,0,4);\r
- fIntFlowQcumulants->SetLabelSize(0.05);\r
- fIntFlowQcumulants->SetMarkerStyle(25);\r
- (fIntFlowQcumulants->GetXaxis())->SetBinLabel(1,"QC{2}");\r
- (fIntFlowQcumulants->GetXaxis())->SetBinLabel(2,"QC{4}");\r
- (fIntFlowQcumulants->GetXaxis())->SetBinLabel(3,"QC{6}");\r
- (fIntFlowQcumulants->GetXaxis())->SetBinLabel(4,"QC{8}");\r
- fIntFlowResults->Add(fIntFlowQcumulants);\r
- // final integrated flow estimates from Q-cumulants:\r
- TString intFlowName = "fIntFlow";\r
- intFlowName += fAnalysisLabel->Data();  \r
- // integrated flow from Q-cumulants:\r
- fIntFlow = new TH1D(intFlowName.Data(),"Integrated flow estimates from Q-cumulants",4,0,4);\r
- fIntFlow->SetLabelSize(0.05);\r
- fIntFlow->SetMarkerStyle(25);\r
- (fIntFlow->GetXaxis())->SetBinLabel(1,"v_{2}{2,QC}");\r
- (fIntFlow->GetXaxis())->SetBinLabel(2,"v_{2}{4,QC}");\r
- (fIntFlow->GetXaxis())->SetBinLabel(3,"v_{2}{6,QC}");\r
- (fIntFlow->GetXaxis())->SetBinLabel(4,"v_{2}{8,QC}");\r
- fIntFlowResults->Add(fIntFlow);\r
-\r
- /* // to be improved (removed):\r
-  // final average weighted multi-particle correlations for all events calculated from Q-vectors\r
-  fQCorrelations[1] = new TProfile("Weighted correlations","final average multi-particle correlations from weighted Q-vectors",200,0,200,"s");\r
-  fQCorrelations[1]->SetTickLength(-0.01,"Y");\r
-  fQCorrelations[1]->SetMarkerStyle(25);\r
-  fQCorrelations[1]->SetLabelSize(0.03);\r
-  fQCorrelations[1]->SetLabelOffset(0.01,"Y");\r
-  // 2-particle correlations:\r
-  (fQCorrelations[1]->GetXaxis())->SetBinLabel(1,"<w_{1}w_{2}cos(n(#phi_{1}-#phi_{2}))>");\r
-  (fQCorrelations[1]->GetXaxis())->SetBinLabel(2,"<w_{1}^{2}w_{2}^{2}cos(2n(#phi_{1}-#phi_{2}))>");\r
-  (fQCorrelations[1]->GetXaxis())->SetBinLabel(3,"<w_{1}^{3}w_{2}^{3}cos(3n(#phi_{1}-#phi_{2}))>");\r
-  (fQCorrelations[1]->GetXaxis())->SetBinLabel(4,"<w_{1}^{4}w_{2}^{4}cos(4n(#phi_{1}-#phi_{2}))>");\r
-  (fQCorrelations[1]->GetXaxis())->SetBinLabel(5,"<w_{1}^{3}w_{2}cos(n(#phi_{1}-#phi_{2}))>");\r
-  (fQCorrelations[1]->GetXaxis())->SetBinLabel(6,"<w_{1}^{2}w_{2}w_{3}cos(n(#phi_{1}-#phi_{2}))>");\r
-  // 3-particle correlations:\r
-  (fQCorrelations[1]->GetXaxis())->SetBinLabel(21,"<w_{1}w_{2}w_{3}^{2}cos(n(2#phi_{1}-#phi_{2}-#phi_{3}))>");\r
-  // 4-particle correlations:\r
-  (fQCorrelations[1]->GetXaxis())->SetBinLabel(41,"<w_{1}w_{2}w_{3}w_{4}cos(n(#phi_{1}+#phi_{2}-#phi_{3}-#phi_{4}))>");\r
-  // add fQCorrelations[1] to the list fIntFlowList:\r
-  fIntFlowList->Add(fQCorrelations[1]); \r
- */\r
-  \r
-} // end of AliFlowAnalysisWithQCumulants::BookEverythingForIntegratedFlow()\r
-\r
-\r
-//================================================================================================================================\r
-\r
+  (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(2,Form("<<%s(n(phi1+phi2))>>",sinCosFlag[sc].Data()));  
+  // 3-particle terms:
+  (fIntFlowCorrectionTermsForNUAPro[sc]->GetXaxis())->SetBinLabel(3,Form("<<%s(n(phi1-phi2-phi3))>>",sinCosFlag[sc].Data()));  
+  // ... 
+  fIntFlowProfiles->Add(fIntFlowCorrectionTermsForNUAPro[sc]);
+ } // end of for(Int_t sc=0;sc<2;sc++) 
+ // d) Book histograms holding the final results:
+ // average correlations <<2>>, <<4>>, <<6>> and <<8>> for all events (with correct errors!):
+ TString intFlowCorrelationsHistName = "fIntFlowCorrelationsHist";
+ intFlowCorrelationsHistName += fAnalysisLabel->Data();
+ fIntFlowCorrelationsHist = new TH1D(intFlowCorrelationsHistName.Data(),"Average correlations for all events",4,0,4);
+ fIntFlowCorrelationsHist->SetTickLength(-0.01,"Y");
+ fIntFlowCorrelationsHist->SetMarkerStyle(25);
+ fIntFlowCorrelationsHist->SetLabelSize(0.06);
+ fIntFlowCorrelationsHist->SetLabelOffset(0.01,"Y");
+ (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(1,"<<2>>");
+ (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(2,"<<4>>");
+ (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(3,"<<6>>");
+ (fIntFlowCorrelationsHist->GetXaxis())->SetBinLabel(4,"<<8>>");
+ fIntFlowResults->Add(fIntFlowCorrelationsHist);
+ // average all correlations for all events (with correct errors!):
+ TString intFlowCorrelationsAllHistName = "fIntFlowCorrelationsAllHist";
+ intFlowCorrelationsAllHistName += fAnalysisLabel->Data();
+ fIntFlowCorrelationsAllHist = new TH1D(intFlowCorrelationsAllHistName.Data(),"Average correlations for all events",32,0,32);
+ fIntFlowCorrelationsAllHist->SetTickLength(-0.01,"Y");
+ fIntFlowCorrelationsAllHist->SetMarkerStyle(25);
+ fIntFlowCorrelationsAllHist->SetLabelSize(0.03);
+ fIntFlowCorrelationsAllHist->SetLabelOffset(0.01,"Y");
+ // 2-p correlations:
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(1,"<<2>>_{n|n}");
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(2,"<<2>>_{2n|2n}");
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(3,"<<2>>_{3n|3n}");
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(4,"<<2>>_{4n|4n}");
+ // 3-p correlations:
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(6,"<<3>>_{2n|n,n}");
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(7,"<<3>>_{3n|2n,n}");
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(8,"<<3>>_{4n|2n,2n}");
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(9,"<<3>>_{4n|3n,n}");
+ // 4-p correlations:
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(11,"<<4>>_{n,n|n,n}"); 
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(12,"<<4>>_{2n,n|2n,n}");
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(13,"<<4>>_{2n,2n|2n,2n}");
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(14,"<<4>>_{3n|n,n,n}");
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(15,"<<4>>_{3n,n|3n,n}");
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(16,"<<4>>_{3n,n|2n,2n}"); 
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(17,"<<4>>_{4n|2n,n,n}");
+ // 5-p correlations:
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(19,"<<5>>_{2n|n,n,n,n}"); 
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(20,"<<5>>_{2n,2n|2n,n,n}");
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(21,"<<5>>_{3n,n|2n,n,n}");
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(22,"<<5>>_{4n|n,n,n,n}");
+ // 6-p correlations:
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(24,"<<6>>_{n,n,n|n,n,n}");
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(25,"<<6>>_{2n,n,n|2n,n,n}");
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(26,"<<6>>_{2n,2n|n,n,n,n}");
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(27,"<<6>>_{3n,n|n,n,n,n}");
+ // 7-p correlations:  
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(29,"<<7>>_{2n,n,n|n,n,n,n}");
+ // 8-p correlations:
+ (fIntFlowCorrelationsAllHist->GetXaxis())->SetBinLabel(31,"<<8>>_{n,n,n,n|n,n,n,n}");
+ fIntFlowResults->Add(fIntFlowCorrelationsAllHist);
+ // average correction terms for non-uniform acceptance (with correct errors!):
+ for(Int_t sc=0;sc<2;sc++) // sin or cos terms
+ {
+  TString intFlowCorrectionTermsForNUAHistName = "fIntFlowCorrectionTermsForNUAHist";
+  intFlowCorrectionTermsForNUAHistName += fAnalysisLabel->Data();
+  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()),10,0,10);
+  fIntFlowCorrectionTermsForNUAHist[sc]->SetTickLength(-0.01,"Y");
+  fIntFlowCorrectionTermsForNUAHist[sc]->SetMarkerStyle(25);
+  fIntFlowCorrectionTermsForNUAHist[sc]->SetLabelSize(0.03);
+  fIntFlowCorrectionTermsForNUAHist[sc]->SetLabelOffset(0.01,"Y");
+  // ......................................................................... 
+  // 1-p terms:
+  (fIntFlowCorrectionTermsForNUAHist[sc]->GetXaxis())->SetBinLabel(1,Form("%s(n(#phi_{1}))>",sinCosFlag[sc].Data()));
+  // 2-p terms:
+  // 3-p terms:
+  // ...
+  // ......................................................................... 
+  fIntFlowResults->Add(fIntFlowCorrectionTermsForNUAHist[sc]);
+ } // end of for(Int_t sc=0;sc<2;sc++) 
+ // covariances (multiplied with weight dependent prefactor):
+ TString intFlowCovariancesName = "fIntFlowCovariances";
+ intFlowCovariancesName += fAnalysisLabel->Data();
+ fIntFlowCovariances = new TH1D(intFlowCovariancesName.Data(),"Covariances (multiplied with weight dependent prefactor)",6,0,6);
+ fIntFlowCovariances->SetLabelSize(0.04);
+ fIntFlowCovariances->SetMarkerStyle(25);
+ (fIntFlowCovariances->GetXaxis())->SetBinLabel(1,"Cov(<2>,<4>)");
+ (fIntFlowCovariances->GetXaxis())->SetBinLabel(2,"Cov(<2>,<6>)");
+ (fIntFlowCovariances->GetXaxis())->SetBinLabel(3,"Cov(<2>,<8>)");
+ (fIntFlowCovariances->GetXaxis())->SetBinLabel(4,"Cov(<4>,<6>)");
+ (fIntFlowCovariances->GetXaxis())->SetBinLabel(5,"Cov(<4>,<8>)");
+ (fIntFlowCovariances->GetXaxis())->SetBinLabel(6,"Cov(<6>,<8>)");  
+ fIntFlowResults->Add(fIntFlowCovariances);
+ // sum of linear and quadratic event weights for <2>, <4>, <6> and <8>:
+ TString intFlowSumOfEventWeightsName = "fIntFlowSumOfEventWeights";
+ intFlowSumOfEventWeightsName += fAnalysisLabel->Data();
+ for(Int_t power=0;power<2;power++)
+ {
+  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);
+  fIntFlowSumOfEventWeights[power]->SetLabelSize(0.05);
+  fIntFlowSumOfEventWeights[power]->SetMarkerStyle(25);
+  if(power == 0)
+  {
+   (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{<2>}");
+   (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{<4>}");
+   (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{<6>}");
+   (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{<8>}");
+  } else if (power == 1) 
+    {
+     (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{<2>}^{2}");
+     (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{<4>}^{2}");
+     (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{<6>}^{2}");
+     (fIntFlowSumOfEventWeights[power]->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{<8>}^{2}");
+    }
+  fIntFlowResults->Add(fIntFlowSumOfEventWeights[power]);
+ } 
+ // sum of products of event weights for correlations <2>, <4>, <6> and <8>:  
+ TString intFlowSumOfProductOfEventWeightsName = "fIntFlowSumOfProductOfEventWeights";
+ intFlowSumOfProductOfEventWeightsName += fAnalysisLabel->Data();
+ fIntFlowSumOfProductOfEventWeights = new TH1D(intFlowSumOfProductOfEventWeightsName.Data(),"Sum of product of event weights for correlations",6,0,6);
+ fIntFlowSumOfProductOfEventWeights->SetLabelSize(0.05);
+ fIntFlowSumOfProductOfEventWeights->SetMarkerStyle(25);
+ (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(1,"#sum_{i=1}^{N} w_{<2>} w_{<4>}");
+ (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(2,"#sum_{i=1}^{N} w_{<2>} w_{<6>}");
+ (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(3,"#sum_{i=1}^{N} w_{<2>} w_{<8>}");
+ (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(4,"#sum_{i=1}^{N} w_{<4>} w_{<6>}");
+ (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(5,"#sum_{i=1}^{N} w_{<4>} w_{<8>}");
+ (fIntFlowSumOfProductOfEventWeights->GetXaxis())->SetBinLabel(6,"#sum_{i=1}^{N} w_{<6>} w_{<8>}");
+ fIntFlowResults->Add(fIntFlowSumOfProductOfEventWeights);
+ // final results for integrated Q-cumulants:
+ TString intFlowQcumulantsName = "fIntFlowQcumulants";
+ intFlowQcumulantsName += fAnalysisLabel->Data();
+ fIntFlowQcumulants = new TH1D(intFlowQcumulantsName.Data(),"Integrated Q-cumulants",4,0,4);
+ fIntFlowQcumulants->SetLabelSize(0.05);
+ fIntFlowQcumulants->SetMarkerStyle(25);
+ (fIntFlowQcumulants->GetXaxis())->SetBinLabel(1,"QC{2}");
+ (fIntFlowQcumulants->GetXaxis())->SetBinLabel(2,"QC{4}");
+ (fIntFlowQcumulants->GetXaxis())->SetBinLabel(3,"QC{6}");
+ (fIntFlowQcumulants->GetXaxis())->SetBinLabel(4,"QC{8}");
+ fIntFlowResults->Add(fIntFlowQcumulants);
+ // final integrated flow estimates from Q-cumulants:
+ TString intFlowName = "fIntFlow";
+ intFlowName += fAnalysisLabel->Data();  
+ // integrated flow from Q-cumulants:
+ fIntFlow = new TH1D(intFlowName.Data(),"Integrated flow estimates from Q-cumulants",4,0,4);
+ fIntFlow->SetLabelSize(0.05);
+ fIntFlow->SetMarkerStyle(25);
+ (fIntFlow->GetXaxis())->SetBinLabel(1,"v_{2}{2,QC}");
+ (fIntFlow->GetXaxis())->SetBinLabel(2,"v_{2}{4,QC}");
+ (fIntFlow->GetXaxis())->SetBinLabel(3,"v_{2}{6,QC}");
+ (fIntFlow->GetXaxis())->SetBinLabel(4,"v_{2}{8,QC}");
+ fIntFlowResults->Add(fIntFlow);
+
+ /* // to be improved (removed):
+  // final average weighted multi-particle correlations for all events calculated from Q-vectors
+  fQCorrelations[1] = new TProfile("Weighted correlations","final average multi-particle correlations from weighted Q-vectors",200,0,200,"s");
+  fQCorrelations[1]->SetTickLength(-0.01,"Y");
+  fQCorrelations[1]->SetMarkerStyle(25);
+  fQCorrelations[1]->SetLabelSize(0.03);
+  fQCorrelations[1]->SetLabelOffset(0.01,"Y");
+  // 2-particle correlations:
+  (fQCorrelations[1]->GetXaxis())->SetBinLabel(1,"<w_{1}w_{2}cos(n(#phi_{1}-#phi_{2}))>");
+  (fQCorrelations[1]->GetXaxis())->SetBinLabel(2,"<w_{1}^{2}w_{2}^{2}cos(2n(#phi_{1}-#phi_{2}))>");
+  (fQCorrelations[1]->GetXaxis())->SetBinLabel(3,"<w_{1}^{3}w_{2}^{3}cos(3n(#phi_{1}-#phi_{2}))>");
+  (fQCorrelations[1]->GetXaxis())->SetBinLabel(4,"<w_{1}^{4}w_{2}^{4}cos(4n(#phi_{1}-#phi_{2}))>");
+  (fQCorrelations[1]->GetXaxis())->SetBinLabel(5,"<w_{1}^{3}w_{2}cos(n(#phi_{1}-#phi_{2}))>");
+  (fQCorrelations[1]->GetXaxis())->SetBinLabel(6,"<w_{1}^{2}w_{2}w_{3}cos(n(#phi_{1}-#phi_{2}))>");
+  // 3-particle correlations:
+  (fQCorrelations[1]->GetXaxis())->SetBinLabel(21,"<w_{1}w_{2}w_{3}^{2}cos(n(2#phi_{1}-#phi_{2}-#phi_{3}))>");
+  // 4-particle correlations:
+  (fQCorrelations[1]->GetXaxis())->SetBinLabel(41,"<w_{1}w_{2}w_{3}w_{4}cos(n(#phi_{1}+#phi_{2}-#phi_{3}-#phi_{4}))>");
+  // add fQCorrelations[1] to the list fIntFlowList:
+  fIntFlowList->Add(fQCorrelations[1]); 
+ */
+  
+} // end of AliFlowAnalysisWithQCumulants::BookEverythingForIntegratedFlow()
+
+
+//================================================================================================================================
+
 
 void AliFlowAnalysisWithQCumulants::InitializeArraysForNestedLoops()
 {
  // Initialize arrays of all objects relevant for calculations with nested loops.
  
  // integrated flow:
- for(Int_t sc=0;sc<2;sc++) // sin or cos terms\r
- {\r
+ for(Int_t sc=0;sc<2;sc++) // sin or cos terms
+ {
   fIntFlowDirectCorrectionTermsForNUA[sc] = NULL;
  } 
 
  // differential flow:  
  // correlations:
- for(Int_t t=0;t<2;t++) // type: RP or POI\r
- { \r
-  for(Int_t pe=0;pe<2;pe++) // pt or eta\r
-  {\r
-   for(Int_t ci=0;ci<4;ci++) // correlation index\r
-   {\r
-    fDiffFlowDirectCorrelations[t][pe][ci] = NULL;\r
-   } // end of for(Int_t ci=0;ci<4;ci++) // correlation index  \r
-  } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta\r
+ for(Int_t t=0;t<2;t++) // type: RP or POI
+ { 
+  for(Int_t pe=0;pe<2;pe++) // pt or eta
+  {
+   for(Int_t ci=0;ci<4;ci++) // correlation index
+   {
+    fDiffFlowDirectCorrelations[t][pe][ci] = NULL;
+   } // end of for(Int_t ci=0;ci<4;ci++) // correlation index  
+  } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
  // correction terms for non-uniform acceptance:
- for(Int_t t=0;t<2;t++) // type: RP or POI\r
- { \r
-  for(Int_t pe=0;pe<2;pe++) // pt or eta\r
-  {\r
-   for(Int_t sc=0;sc<2;sc++) // sin or cos terms\r
-   {\r
-    for(Int_t cti=0;cti<9;cti++) // correction term index\r
-    {\r
-     fDiffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti] = NULL;\r
-    }   \r
-   }\r
-  } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta\r
- } // end of for(Int_t t=0;t<2;t++) // type: RP or POI\r
-\r
+ for(Int_t t=0;t<2;t++) // type: RP or POI
+ { 
+  for(Int_t pe=0;pe<2;pe++) // pt or eta
+  {
+   for(Int_t sc=0;sc<2;sc++) // sin or cos terms
+   {
+    for(Int_t cti=0;cti<9;cti++) // correction term index
+    {
+     fDiffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti] = NULL;
+    }   
+   }
+  } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta
+ } // end of for(Int_t t=0;t<2;t++) // type: RP or POI
+
 
 } // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForNestedLoops()
 
 
-//================================================================================================================================\r
+//================================================================================================================================
 
-\r
-void AliFlowAnalysisWithQCumulants::BookEverythingForNestedLoops()\r
-{\r
+
+void AliFlowAnalysisWithQCumulants::BookEverythingForNestedLoops()
+{
  // Book all objects relevant for calculations with nested loops.
  
- TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data members?)\r
- TString typeFlag[2] = {"RP","POI"}; // to be improved (should I promote this to data members?)\r
+ TString sinCosFlag[2] = {"sin","cos"}; // to be improved (should I promote this to data members?)
+ TString typeFlag[2] = {"RP","POI"}; // to be improved (should I promote this to data members?)
  TString ptEtaFlag[2] = {"p_{T}","#eta"}; // to be improved (should I promote this to data members?)
  TString reducedCorrelationIndex[4] = {"<2'>","<4'>","<6'>","<8'>"}; // to be improved (should I promote this to data members?)
  Double_t lowerPtEtaEdge[2] = {fPtMin+(fCrossCheckInPtBinNo-1)*fPtBinWidth,fEtaMin+(fCrossCheckInEtaBinNo-1)*fEtaBinWidth};
  Double_t upperPtEtaEdge[2] = {fPtMin+fCrossCheckInPtBinNo*fPtBinWidth,fEtaMin+fCrossCheckInEtaBinNo*fEtaBinWidth};
-\r
- TString evaluateNestedLoopsName = "fEvaluateNestedLoops";\r
- evaluateNestedLoopsName += fAnalysisLabel->Data();\r
- fEvaluateNestedLoops = new TProfile(evaluateNestedLoopsName.Data(),"Flags for nested loops",4,0,4);\r
- fEvaluateNestedLoops->SetLabelSize(0.03);\r
- (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(1,"fEvaluateIntFlowNestedLoops");\r
- (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(2,"fEvaluateDiffFlowNestedLoops");\r
- (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(3,"fCrossCheckInPtBinNo");\r
- (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(4,"fCrossCheckInEtaBinNo");\r
- fEvaluateNestedLoops->Fill(0.5,(Int_t)fEvaluateIntFlowNestedLoops);\r
- fEvaluateNestedLoops->Fill(1.5,(Int_t)fEvaluateDiffFlowNestedLoops);\r
- fEvaluateNestedLoops->Fill(2.5,fCrossCheckInPtBinNo);\r
- fEvaluateNestedLoops->Fill(3.5,fCrossCheckInEtaBinNo);\r
- fNestedLoopsList->Add(fEvaluateNestedLoops);\r
- // nested loops for integrated flow:\r
- if(fEvaluateIntFlowNestedLoops)\r
- {\r
+
+ TString evaluateNestedLoopsName = "fEvaluateNestedLoops";
+ evaluateNestedLoopsName += fAnalysisLabel->Data();
+ fEvaluateNestedLoops = new TProfile(evaluateNestedLoopsName.Data(),"Flags for nested loops",4,0,4);
+ fEvaluateNestedLoops->SetLabelSize(0.03);
+ (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(1,"fEvaluateIntFlowNestedLoops");
+ (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(2,"fEvaluateDiffFlowNestedLoops");
+ (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(3,"fCrossCheckInPtBinNo");
+ (fEvaluateNestedLoops->GetXaxis())->SetBinLabel(4,"fCrossCheckInEtaBinNo");
+ fEvaluateNestedLoops->Fill(0.5,(Int_t)fEvaluateIntFlowNestedLoops);
+ fEvaluateNestedLoops->Fill(1.5,(Int_t)fEvaluateDiffFlowNestedLoops);
+ fEvaluateNestedLoops->Fill(2.5,fCrossCheckInPtBinNo);
+ fEvaluateNestedLoops->Fill(3.5,fCrossCheckInEtaBinNo);
+ fNestedLoopsList->Add(fEvaluateNestedLoops);
+ // nested loops for integrated flow:
+ if(fEvaluateIntFlowNestedLoops)
+ {
   // correlations:
-  TString intFlowDirectCorrelationsName = "fIntFlowDirectCorrelations";\r
-  intFlowDirectCorrelationsName += fAnalysisLabel->Data();\r
-  fIntFlowDirectCorrelations = new TProfile(intFlowDirectCorrelationsName.Data(),"Multiparticle correlations calculated with nested loops (for int. flow)",32,0,32,"s");\r
+  TString intFlowDirectCorrelationsName = "fIntFlowDirectCorrelations";
+  intFlowDirectCorrelationsName += fAnalysisLabel->Data();
+  fIntFlowDirectCorrelations = new TProfile(intFlowDirectCorrelationsName.Data(),"Multiparticle correlations calculated with nested loops (for int. flow)",32,0,32,"s");
   fNestedLoopsList->Add(fIntFlowDirectCorrelations);
   if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)
   {
-   TString intFlowExtraDirectCorrelationsName = "fIntFlowExtraDirectCorrelations";\r
-   intFlowExtraDirectCorrelationsName += fAnalysisLabel->Data();\r
-   fIntFlowExtraDirectCorrelations = new TProfile(intFlowExtraDirectCorrelationsName.Data(),"Extra multiparticle correlations calculated with nested loops (for int. flow)",100,0,100,"s");\r
+   TString intFlowExtraDirectCorrelationsName = "fIntFlowExtraDirectCorrelations";
+   intFlowExtraDirectCorrelationsName += fAnalysisLabel->Data();
+   fIntFlowExtraDirectCorrelations = new TProfile(intFlowExtraDirectCorrelationsName.Data(),"Extra multiparticle correlations calculated with nested loops (for int. flow)",100,0,100,"s");
    fNestedLoopsList->Add(fIntFlowExtraDirectCorrelations);  
   } // end of if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)
-  // correction terms for non-uniform acceptance:\r
-  for(Int_t sc=0;sc<2;sc++) // sin or cos terms\r
-  {\r
-   TString intFlowDirectCorrectionTermsForNUAName = "fIntFlowDirectCorrectionTermsForNUA";\r
-   intFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();\r
-   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");\r
-   fNestedLoopsList->Add(fIntFlowDirectCorrectionTermsForNUA[sc]);\r
-  } // end of for(Int_t sc=0;sc<2;sc++) \r
+  // correction terms for non-uniform acceptance:
+  for(Int_t sc=0;sc<2;sc++) // sin or cos terms
+  {
+   TString intFlowDirectCorrectionTermsForNUAName = "fIntFlowDirectCorrectionTermsForNUA";
+   intFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();
+   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");
+   fNestedLoopsList->Add(fIntFlowDirectCorrectionTermsForNUA[sc]);
+  } // end of for(Int_t sc=0;sc<2;sc++) 
  } // end of if(fEvaluateIntFlowNestedLoops)
\r
- // nested loops for differential flow: \r
- if(fEvaluateDiffFlowNestedLoops)\r
- {
-  // reduced correlations:\r
-  TString diffFlowDirectCorrelationsName = "fDiffFlowDirectCorrelations";\r
-  diffFlowDirectCorrelationsName += fAnalysisLabel->Data();\r
-  for(Int_t t=0;t<2;t++) // type: RP or POI\r
-  { \r
-   for(Int_t pe=0;pe<2;pe++) // pt or eta\r
-   {\r
-    for(Int_t rci=0;rci<4;rci++) // reduced correlation index\r
-    {\r
-     // reduced correlations:\r
-     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");\r
-     fDiffFlowDirectCorrelations[t][pe][rci]->SetXTitle(ptEtaFlag[pe].Data());\r
-     fNestedLoopsList->Add(fDiffFlowDirectCorrelations[t][pe][rci]); // to be improved (add dedicated list to hold reduced correlations)\r
-    } // end of for(Int_t rci=0;rci<4;rci++) // correlation index\r
-   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta \r
-  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI \r
+ // nested loops for differential flow: 
+ if(fEvaluateDiffFlowNestedLoops)
+ {
+  // reduced correlations:
+  TString diffFlowDirectCorrelationsName = "fDiffFlowDirectCorrelations";
+  diffFlowDirectCorrelationsName += fAnalysisLabel->Data();
+  for(Int_t t=0;t<2;t++) // type: RP or POI
+  { 
+   for(Int_t pe=0;pe<2;pe++) // pt or eta
+   {
+    for(Int_t rci=0;rci<4;rci++) // reduced correlation index
+    {
+     // reduced correlations:
+     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");
+     fDiffFlowDirectCorrelations[t][pe][rci]->SetXTitle(ptEtaFlag[pe].Data());
+     fNestedLoopsList->Add(fDiffFlowDirectCorrelations[t][pe][rci]); // to be improved (add dedicated list to hold reduced correlations)
+    } // end of for(Int_t rci=0;rci<4;rci++) // correlation index
+   } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta 
+  } // end of for(Int_t t=0;t<2;t++) // type: RP or POI 
  } // end of if(fEvaluateDiffFlowNestedLoops)
- // correction terms for non-uniform acceptance:\r
- TString diffFlowDirectCorrectionTermsForNUAName = "fDiffFlowDirectCorrectionTermsForNUA";\r
- diffFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();\r
- for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)\r
- { \r
-  for(Int_t pe=0;pe<2;pe++) // pt or eta\r
-  {\r
-   for(Int_t sc=0;sc<2;sc++) // sin or cos\r
-   {\r
-    for(Int_t cti=0;cti<9;cti++) // correction term index\r
-    {\r
-     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"); \r
-     fNestedLoopsList->Add(fDiffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti]);\r
-    }\r
-   }\r
-  }\r
- } \r
-\r
-} // end of AliFlowAnalysisWithQCumulants::BookEverythingForNestedLoops()\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelations()\r
-{\r
- // calculate all correlations needed for integrated flow\r
\r
- // multiplicity:\r
- Double_t dMult = (*fSMpk)(0,0);\r
\r
- // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: \r
- Double_t dReQ1n = (*fReQ)(0,0);\r
- Double_t dReQ2n = (*fReQ)(1,0);\r
- Double_t dReQ3n = (*fReQ)(2,0);\r
- Double_t dReQ4n = (*fReQ)(3,0);\r
- Double_t dImQ1n = (*fImQ)(0,0);\r
- Double_t dImQ2n = (*fImQ)(1,0);\r
- Double_t dImQ3n = (*fImQ)(2,0);\r
- Double_t dImQ4n = (*fImQ)(3,0);\r
-  \r
- // real and imaginary parts of some expressions involving various combinations of Q-vectors evaluated in harmonics n, 2n, 3n and 4n:\r
- // (these expression appear in the Eqs. for the multi-particle correlations bellow)\r
\r
- // Re[Q_{2n} Q_{n}^* Q_{n}^*]\r
- Double_t reQ2nQ1nstarQ1nstar = pow(dReQ1n,2.)*dReQ2n + 2.*dReQ1n*dImQ1n*dImQ2n - pow(dImQ1n,2.)*dReQ2n; \r
\r
- // Im[Q_{2n} Q_{n}^* Q_{n}^*]\r
- //Double_t imQ2nQ1nstarQ1nstar = pow(dReQ1n,2.)*dImQ2n-2.*dReQ1n*dImQ1n*dReQ2n-pow(dImQ1n,2.)*dImQ2n; \r
\r
- // Re[Q_{n} Q_{n} Q_{2n}^*] = Re[Q_{2n} Q_{n}^* Q_{n}^*]\r
- Double_t reQ1nQ1nQ2nstar = reQ2nQ1nstarQ1nstar; \r
\r
- // Re[Q_{3n} Q_{n} Q_{2n}^* Q_{2n}^*]\r
- Double_t reQ3nQ1nQ2nstarQ2nstar = (pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) \r
-                                 + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);\r
-\r
- // Im[Q_{3n} Q_{n} Q_{2n}^* Q_{2n}^*]                                                                  \r
- //Double_t imQ3nQ1nQ2nstarQ2nstar = calculate and implement this (deleteMe)\r
-  \r
- // Re[Q_{2n} Q_{2n} Q_{3n}^* Q_{1n}^*] = Re[Q_{3n} Q_{n} Q_{2n}^* Q_{2n}^*]\r
- Double_t reQ2nQ2nQ3nstarQ1nstar = reQ3nQ1nQ2nstarQ2nstar;\r
-  \r
- // Re[Q_{4n} Q_{2n}^* Q_{2n}^*]\r
- Double_t reQ4nQ2nstarQ2nstar = pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n;\r
-\r
- // Im[Q_{4n} Q_{2n}^* Q_{2n}^*]\r
- //Double_t imQ4nQ2nstarQ2nstar = calculate and implement this (deleteMe)\r
\r
- // Re[Q_{2n} Q_{2n} Q_{4n}^*] =  Re[Q_{4n} Q_{2n}^* Q_{2n}^*]\r
- Double_t reQ2nQ2nQ4nstar = reQ4nQ2nstarQ2nstar;\r
\r
- // Re[Q_{4n} Q_{3n}^* Q_{n}^*]\r
- Double_t reQ4nQ3nstarQ1nstar = dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);\r
\r
- // Re[Q_{3n} Q_{n} Q_{4n}^*] = Re[Q_{4n} Q_{3n}^* Q_{n}^*]\r
- Double_t reQ3nQ1nQ4nstar = reQ4nQ3nstarQ1nstar;\r
\r
- // Im[Q_{4n} Q_{3n}^* Q_{n}^*]\r
- //Double_t imQ4nQ3nstarQ1nstar = calculate and implement this (deleteMe)\r
-\r
- // Re[Q_{3n} Q_{2n}^* Q_{n}^*]\r
- Double_t reQ3nQ2nstarQ1nstar = dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n\r
-                              + dImQ3n*dImQ2n*dReQ1n;\r
-                              \r
- // Re[Q_{2n} Q_{n} Q_{3n}^*] = Re[Q_{3n} Q_{2n}^* Q_{n}^*]\r
- Double_t reQ2nQ1nQ3nstar = reQ3nQ2nstarQ1nstar;\r
\r
- // Im[Q_{3n} Q_{2n}^* Q_{n}^*]\r
- //Double_t imQ3nQ2nstarQ1nstar; //calculate and implement this (deleteMe)\r
\r
- // Re[Q_{3n} Q_{n}^* Q_{n}^* Q_{n}^*]\r
- Double_t reQ3nQ1nstarQ1nstarQ1nstar = dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)\r
-                                     + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3);\r
-\r
- // Im[Q_{3n} Q_{n}^* Q_{n}^* Q_{n}^*]\r
- //Double_t imQ3nQ1nstarQ1nstarQ1nstar; //calculate and implement this (deleteMe)\r
\r
- // |Q_{2n}|^2 |Q_{n}|^2\r
- Double_t dQ2nQ1nQ2nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));\r
\r
- // Re[Q_{4n} Q_{2n}^* Q_{n}^* Q_{n}^*]\r
- Double_t reQ4nQ2nstarQ1nstarQ1nstar = (dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2))\r
-                                     + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n); \r
\r
- // Im[Q_{4n} Q_{2n}^* Q_{n}^* Q_{n}^*]\r
- //Double_t imQ4nQ2nstarQ1nstarQ1nstar; //calculate and implement this (deleteMe)\r
\r
- // Re[Q_{2n} Q_{n} Q_{n}^* Q_{n}^* Q_{n}^*]\r
- Double_t reQ2nQ1nQ1nstarQ1nstarQ1nstar = (dReQ2n*dReQ1n-dImQ2n*dImQ1n)*(pow(dReQ1n,3)-3.*dReQ1n*pow(dImQ1n,2))\r
-                                        + (dReQ2n*dImQ1n+dReQ1n*dImQ2n)*(3.*dImQ1n*pow(dReQ1n,2)-pow(dImQ1n,3));\r
-\r
- // Im[Q_{2n} Q_{n} Q_{n}^* Q_{n}^* Q_{n}^*] \r
- //Double_t imQ2nQ1nQ1nstarQ1nstarQ1nstar; //calculate and implement this (deleteMe)\r
\r
- // Re[Q_{2n} Q_{2n} Q_{2n}^* Q_{n}^* Q_{n}^*]\r
- Double_t reQ2nQ2nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))\r
-                                        * (dReQ2n*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) + 2.*dImQ2n*dReQ1n*dImQ1n);\r
-\r
- // Im[Q_{2n} Q_{2n} Q_{2n}^* Q_{n}^* Q_{n}^*]\r
- //Double_t imQ2nQ2nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))\r
- //                                       * (dImQ2n*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) - 2.*dReQ2n*dReQ1n*dImQ1n);\r
\r
- // Re[Q_{4n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]\r
- Double_t reQ4nQ1nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,4.)*dReQ4n-6.*pow(dReQ1n,2.)*dReQ4n*pow(dImQ1n,2.)\r
-                                            + pow(dImQ1n,4.)*dReQ4n+4.*pow(dReQ1n,3.)*dImQ1n*dImQ4n\r
-                                            - 4.*pow(dImQ1n,3.)*dReQ1n*dImQ4n;\r
-                                            \r
- // Im[Q_{4n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]\r
- //Double_t imQ4nQ1nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,4.)*dImQ4n-6.*pow(dReQ1n,2.)*dImQ4n*pow(dImQ1n,2.)\r
- //                                           + pow(dImQ1n,4.)*dImQ4n+4.*pow(dImQ1n,3.)*dReQ1n*dReQ4n\r
- //                                           - 4.*pow(dReQ1n,3.)*dImQ1n*dReQ4n;\r
\r
- // Re[Q_{3n} Q_{n} Q_{2n}^* Q_{n}^* Q_{n}^*]\r
- Double_t reQ3nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))\r
-                                        * (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n+dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n);\r
\r
- // Im[Q_{3n} Q_{n} Q_{2n}^* Q_{n}^* Q_{n}^*]\r
- //Double_t imQ3nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))\r
- //                                       * (-dReQ2n*dReQ3n*dImQ1n-dReQ1n*dReQ3n*dImQ2n+dReQ1n*dReQ2n*dImQ3n-dImQ1n*dImQ2n*dImQ3n);\r
\r
\r
- // Re[Q_{2n} Q_{2n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]\r
- Double_t reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)*dReQ2n-2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)\r
-                                               + dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dImQ2n)\r
-                                               * (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)\r
-                                               - dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n+pow(dImQ1n,2.)*dImQ2n);\r
\r
- // Im[Q_{2n} Q_{2n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]\r
- //Double_t imQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar = 2.*(pow(dReQ1n,2.)*dReQ2n-dReQ2n*pow(dImQ1n,2.)\r
- //                                              + 2.*dReQ1n*dImQ1n*dImQ2n)*(pow(dReQ1n,2.)*dImQ2n\r
- //                                              - 2.*dReQ1n*dImQ1n*dReQ2n-pow(dImQ1n,2.)*dImQ2n);\r
\r
- // Re[Q_{3n} Q_{n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]\r
- Double_t reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))\r
-                                               * (pow(dReQ1n,3.)*dReQ3n-3.*dReQ1n*dReQ3n*pow(dImQ1n,2.)\r
-                                               + 3.*pow(dReQ1n,2.)*dImQ1n*dImQ3n-pow(dImQ1n,3.)*dImQ3n);\r
-  \r
- // Im[Q_{3n} Q_{n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]                                                                                           \r
- //Double_t imQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))\r
- //                                              * (pow(dImQ1n,3.)*dReQ3n-3.*dImQ1n*dReQ3n*pow(dReQ1n,2.)\r
- //                                              - 3.*pow(dImQ1n,2.)*dReQ1n*dImQ3n+pow(dReQ1n,3.)*dImQ3n);\r
\r
- // |Q_{2n}|^2 |Q_{n}|^4\r
- Double_t dQ2nQ1nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.);\r
\r
- // Re[Q_{2n} Q_{n} Q_{n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]\r
- Double_t reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)\r
-                                                  * (pow(dReQ1n,2.)*dReQ2n-dReQ2n*pow(dImQ1n,2.)\r
-                                                  + 2.*dReQ1n*dImQ1n*dImQ2n);\r
-                                                  \r
- // Im[Q_{2n} Q_{n} Q_{n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]                                                  \r
- //Double_t imQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)\r
- //                                                 * (pow(dReQ1n,2.)*dImQ2n-dImQ2n*pow(dImQ1n,2.)\r
- //                                                 - 2.*dReQ1n*dReQ2n*dImQ1n);\r
\r
-  \r
\r
-       \r
- //                                        **************************************\r
- //                                        **** multi-particle correlations: ****\r
- //                                        **************************************\r
- //\r
- // Remark 1: multi-particle correlations calculated with non-weighted Q-vectors are stored in 1D profile fQCorrelations[0]. // to be improved (wrong profiles)\r
- // Remark 2: binning of fQCorrelations[0] is organized as follows: // to be improved (wrong profiles)\r
- // --------------------------------------------------------------------------------------------------------------------\r
- //  1st bin: <2>_{1n|1n} = two1n1n = cos(n*(phi1-phi2))>\r
- //  2nd bin: <2>_{2n|2n} = two2n2n = cos(2n*(phi1-phi2))>\r
- //  3rd bin: <2>_{3n|3n} = two3n3n = cos(3n*(phi1-phi2))> \r
- //  4th bin: <2>_{4n|4n} = two4n4n = cos(4n*(phi1-phi2))>\r
- //  5th bin:           ----  EMPTY ----\r
- //  6th bin: <3>_{2n|1n,1n} = three2n1n1n = <cos(n*(2.*phi1-phi2-phi3))>\r
- //  7th bin: <3>_{3n|2n,1n} = three3n2n1n = <cos(n*(3.*phi1-2.*phi2-phi3))>\r
- //  8th bin: <3>_{4n|2n,2n} = three4n2n2n = <cos(n*(4.*phi1-2.*phi2-2.*phi3))>\r
- //  9th bin: <3>_{4n|3n,1n} = three4n3n1n = <cos(n*(4.*phi1-3.*phi2-phi3))>\r
- // 10th bin:           ----  EMPTY ----\r
- // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1n = <cos(n*(phi1+phi2-phi3-phi4))>\r
- // 12th bin: <4>_{2n,1n|2n,1n} = four2n1n2n1n = <cos(2.*n*(phi1+phi2-phi3-phi4))>\r
- // 13th bin: <4>_{2n,2n|2n,2n} = four2n2n2n2n = <cos(n*(2.*phi1+phi2-2.*phi3-phi4))>\r
- // 14th bin: <4>_{3n|1n,1n,1n} = four3n1n1n1n = <cos(n*(3.*phi1-phi2-phi3-phi4))> \r
- // 15th bin: <4>_{3n,1n|3n,1n} = four3n1n3n1n = <cos(n*(4.*phi1-2.*phi2-phi3-phi4))>\r
- // 16th bin: <4>_{3n,1n|2n,2n} = four3n1n2n2n = <cos(n*(3.*phi1+phi2-2.*phi3-2.*phi4))>\r
- // 17th bin: <4>_{4n|2n,1n,1n} = four4n2n1n1n = <cos(n*(3.*phi1+phi2-3.*phi3-phi4))> \r
- // 18th bin:           ----  EMPTY ----\r
- // 19th bin: <5>_{2n|1n,1n,1n,1n} = five2n1n1n1n1n = <cos(n*(2.*phi1+phi2-phi3-phi4-phi5))>\r
- // 20th bin: <5>_{2n,2n|2n,1n,1n} = five2n2n2n1n1n = <cos(n*(2.*phi1+2.*phi2-2.*phi3-phi4-phi5))>\r
- // 21st bin: <5>_{3n,1n|2n,1n,1n} = five3n1n2n1n1n = <cos(n*(3.*phi1+phi2-2.*phi3-phi4-phi5))>\r
- // 22nd bin: <5>_{4n|1n,1n,1n,1n} = five4n1n1n1n1n = <cos(n*(4.*phi1-phi2-phi3-phi4-phi5))>\r
- // 23rd bin:           ----  EMPTY ----\r
- // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = six1n1n1n1n1n1n = <cos(n*(phi1+phi2+phi3-phi4-phi5-phi6))>\r
- // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = six2n1n1n2n1n1n = <cos(n*(2.*phi1+2.*phi2-phi3-phi4-phi5-phi6))>\r
- // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = six2n2n1n1n1n1n = <cos(n*(3.*phi1+phi2-phi3-phi4-phi5-phi6))>\r
- // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = six3n1n1n1n1n1n = <cos(n*(2.*phi1+phi2+phi3-2.*phi4-phi5-phi6))>\r
- // 28th bin:           ----  EMPTY ----\r
- // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = seven2n1n1n1n1n1n1n =  <cos(n*(2.*phi1+phi2+phi3-phi4-phi5-phi6-phi7))>\r
- // 30th bin:           ----  EMPTY ----\r
- // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = eight1n1n1n1n1n1n1n1n = <cos(n*(phi1+phi2+phi3+phi4-phi5-phi6-phi7-phi8))>\r
- // --------------------------------------------------------------------------------------------------------------------\r
-    \r
- // 2-particle:\r
- Double_t two1n1n = 0.; // <cos(n*(phi1-phi2))>\r
- Double_t two2n2n = 0.; // <cos(2n*(phi1-phi2))>\r
- Double_t two3n3n = 0.; // <cos(3n*(phi1-phi2))>\r
- Double_t two4n4n = 0.; // <cos(4n*(phi1-phi2))>\r
\r
- if(dMult>1)\r
- {\r
-  two1n1n = (pow(dReQ1n,2.)+pow(dImQ1n,2.)-dMult)/(dMult*(dMult-1.)); \r
-  two2n2n = (pow(dReQ2n,2.)+pow(dImQ2n,2.)-dMult)/(dMult*(dMult-1.)); \r
-  two3n3n = (pow(dReQ3n,2.)+pow(dImQ3n,2.)-dMult)/(dMult*(dMult-1.)); \r
-  two4n4n = (pow(dReQ4n,2.)+pow(dImQ4n,2.)-dMult)/(dMult*(dMult-1.)); \r
-  \r
-  // average 2-particle correlations for single event: \r
-  fIntFlowCorrelationsAllEBE->SetBinContent(1,two1n1n);\r
-  fIntFlowCorrelationsAllEBE->SetBinContent(2,two2n2n);\r
-  fIntFlowCorrelationsAllEBE->SetBinContent(3,two3n3n);\r
-  fIntFlowCorrelationsAllEBE->SetBinContent(4,two4n4n);\r
-          \r
-  // average 2-particle correlations for all events:      \r
-  fIntFlowCorrelationsAllPro->Fill(0.5,two1n1n,dMult*(dMult-1.));  \r
-  fIntFlowCorrelationsAllPro->Fill(1.5,two2n2n,dMult*(dMult-1.)); \r
-  fIntFlowCorrelationsAllPro->Fill(2.5,two3n3n,dMult*(dMult-1.)); \r
-  fIntFlowCorrelationsAllPro->Fill(3.5,two4n4n,dMult*(dMult-1.)); \r
-  \r
-  // store separetately <2> (to be improved: do I really need this?)\r
-  fIntFlowCorrelationsEBE->SetBinContent(1,two1n1n); // <2>\r
-  fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(1,dMult*(dMult-1.)); // eW_<2>\r
-  fIntFlowCorrelationsPro->Fill(0.5,two1n1n,dMult*(dMult-1.));\r
-  \r
-  // distribution of <cos(n*(phi1-phi2))>:\r
-  //f2pDistribution->Fill(two1n1n,dMult*(dMult-1.)); \r
- } // end of if(dMult>1)\r
\r
- // 3-particle:\r
- Double_t three2n1n1n = 0.; // <cos(n*(2.*phi1-phi2-phi3))>\r
- Double_t three3n2n1n = 0.; // <cos(n*(3.*phi1-2.*phi2-phi3))>\r
- Double_t three4n2n2n = 0.; // <cos(n*(4.*phi1-2.*phi2-2.*phi3))>\r
- Double_t three4n3n1n = 0.; // <cos(n*(4.*phi1-3.*phi2-phi3))>\r
\r
- if(dMult>2)\r
- {\r
-  three2n1n1n = (reQ2nQ1nstarQ1nstar-2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))\r
-              - (pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)\r
-              / (dMult*(dMult-1.)*(dMult-2.));              \r
-  three3n2n1n = (reQ3nQ2nstarQ1nstar-(pow(dReQ3n,2.)+pow(dImQ3n,2.))\r
-              - (pow(dReQ2n,2.)+pow(dImQ2n,2.))\r
-              - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)\r
-              / (dMult*(dMult-1.)*(dMult-2.));\r
-  three4n2n2n = (reQ4nQ2nstarQ2nstar-2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))\r
-              - (pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*dMult)\r
-              / (dMult*(dMult-1.)*(dMult-2.)); \r
-  three4n3n1n = (reQ4nQ3nstarQ1nstar-(pow(dReQ4n,2.)+pow(dImQ4n,2.))\r
-              - (pow(dReQ3n,2.)+pow(dImQ3n,2.))\r
-              - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)\r
-              / (dMult*(dMult-1.)*(dMult-2.)); \r
-              \r
-  // average 3-particle correlations for single event: \r
-  fIntFlowCorrelationsAllEBE->SetBinContent(6,three2n1n1n);\r
-  fIntFlowCorrelationsAllEBE->SetBinContent(7,three3n2n1n);\r
-  fIntFlowCorrelationsAllEBE->SetBinContent(8,three4n2n2n);\r
-  fIntFlowCorrelationsAllEBE->SetBinContent(9,three4n3n1n);\r
-        \r
-  // average 3-particle correlations for all events:                \r
-  fIntFlowCorrelationsAllPro->Fill(5.5,three2n1n1n,dMult*(dMult-1.)*(dMult-2.)); \r
-  fIntFlowCorrelationsAllPro->Fill(6.5,three3n2n1n,dMult*(dMult-1.)*(dMult-2.));\r
-  fIntFlowCorrelationsAllPro->Fill(7.5,three4n2n2n,dMult*(dMult-1.)*(dMult-2.)); \r
-  fIntFlowCorrelationsAllPro->Fill(8.5,three4n3n1n,dMult*(dMult-1.)*(dMult-2.));    \r
- } // end of if(dMult>2)\r
\r
- // 4-particle:\r
- Double_t four1n1n1n1n = 0.; // <cos(n*(phi1+phi2-phi3-phi4))>\r
- Double_t four2n2n2n2n = 0.; // <cos(2.*n*(phi1+phi2-phi3-phi4))>\r
- Double_t four2n1n2n1n = 0.; // <cos(n*(2.*phi1+phi2-2.*phi3-phi4))> \r
- Double_t four3n1n1n1n = 0.; // <cos(n*(3.*phi1-phi2-phi3-phi4))> \r
- Double_t four4n2n1n1n = 0.; // <cos(n*(4.*phi1-2.*phi2-phi3-phi4))> \r
- Double_t four3n1n2n2n = 0.; // <cos(n*(3.*phi1+phi2-2.*phi3-2.*phi4))> \r
- Double_t four3n1n3n1n = 0.; // <cos(n*(3.*phi1+phi2-3.*phi3-phi4))>   \r
\r
- if(dMult>3)\r
- {\r
-  four1n1n1n1n = (2.*dMult*(dMult-3.)+pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ1n,2.)\r
-               + pow(dImQ1n,2.))-2.*reQ2nQ1nstarQ1nstar+(pow(dReQ2n,2.)+pow(dImQ2n,2.)))\r
-               / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));     \r
-  four2n2n2n2n = (2.*dMult*(dMult-3.)+pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ2n,2.)\r
-               + pow(dImQ2n,2.))-2.*reQ4nQ2nstarQ2nstar+(pow(dReQ4n,2.)+pow(dImQ4n,2.)))\r
-               / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));\r
-  four2n1n2n1n = (dQ2nQ1nQ2nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar-2.*reQ2nQ1nstarQ1nstar)\r
-               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))\r
-               - ((dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))\r
-               + (dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-(pow(dReQ3n,2.)+pow(dImQ3n,2.)))\r
-               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))\r
-               + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));\r
-  four3n1n1n1n = (reQ3nQ1nstarQ1nstarQ1nstar-3.*reQ3nQ2nstarQ1nstar-3.*reQ2nQ1nstarQ1nstar)\r
-               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))\r
-               + (2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))\r
-               + 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)\r
-               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));\r
-  four4n2n1n1n = (reQ4nQ2nstarQ1nstarQ1nstar-2.*reQ4nQ3nstarQ1nstar-reQ4nQ2nstarQ2nstar-2.*reQ3nQ2nstarQ1nstar)\r
-               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))\r
-               - (reQ2nQ1nstarQ1nstar-2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))\r
-               - 3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))\r
-               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))\r
-               - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));\r
-  four3n1n2n2n = (reQ3nQ1nQ2nstarQ2nstar-reQ4nQ2nstarQ2nstar-reQ3nQ1nQ4nstar-2.*reQ3nQ2nstarQ1nstar)\r
-               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))\r
-               - (2.*reQ1nQ1nQ2nstar-(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))\r
-               - 4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))\r
-               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))\r
-               - 6./((dMult-1.)*(dMult-2.)*(dMult-3.)); \r
-  four3n1n3n1n = ((pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))\r
-               - 2.*reQ4nQ3nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar)\r
-               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))\r
-               + ((pow(dReQ4n,2.)+pow(dImQ4n,2.))-(dMult-4.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))\r
-               + (pow(dReQ2n,2.)+pow(dImQ2n,2.))-(dMult-4.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))\r
-               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))\r
-               + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));\r
-               \r
-  // average 4-particle correlations for single event: \r
-  fIntFlowCorrelationsAllEBE->SetBinContent(11,four1n1n1n1n);\r
-  fIntFlowCorrelationsAllEBE->SetBinContent(12,four2n1n2n1n);\r
-  fIntFlowCorrelationsAllEBE->SetBinContent(13,four2n2n2n2n);\r
-  fIntFlowCorrelationsAllEBE->SetBinContent(14,four3n1n1n1n);\r
-  fIntFlowCorrelationsAllEBE->SetBinContent(15,four3n1n3n1n);\r
-  fIntFlowCorrelationsAllEBE->SetBinContent(16,four3n1n2n2n);\r
-  fIntFlowCorrelationsAllEBE->SetBinContent(17,four4n2n1n1n);\r
-        \r
-  // average 4-particle correlations for all events:                \r
-  fIntFlowCorrelationsAllPro->Fill(10.5,four1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));\r
-  fIntFlowCorrelationsAllPro->Fill(11.5,four2n1n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));\r
-  fIntFlowCorrelationsAllPro->Fill(12.5,four2n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));\r
-  fIntFlowCorrelationsAllPro->Fill(13.5,four3n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));\r
-  fIntFlowCorrelationsAllPro->Fill(14.5,four3n1n3n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));\r
-  fIntFlowCorrelationsAllPro->Fill(15.5,four3n1n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  \r
-  fIntFlowCorrelationsAllPro->Fill(16.5,four4n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); \r
-  \r
-  // store separetately <4> (to be improved: do I really need this?)\r
-  fIntFlowCorrelationsEBE->SetBinContent(2,four1n1n1n1n); // <4>\r
-  fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(2,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); // eW_<4>\r
-  fIntFlowCorrelationsPro->Fill(1.5,four1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));\r
-  \r
-  // distribution of <cos(n*(phi1+phi2-phi3-phi4))>\r
-  //f4pDistribution->Fill(four1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));\r
-  \r
- } // end of if(dMult>3)\r
-\r
- // 5-particle:\r
- Double_t five2n1n1n1n1n = 0.; // <cos(n*(2.*phi1+phi2-phi3-phi4-phi5))>\r
- Double_t five2n2n2n1n1n = 0.; // <cos(n*(2.*phi1+2.*phi2-2.*phi3-phi4-phi5))>\r
- Double_t five3n1n2n1n1n = 0.; // <cos(n*(3.*phi1+phi2-2.*phi3-phi4-phi5))>\r
- Double_t five4n1n1n1n1n = 0.; // <cos(n*(4.*phi1-phi2-phi3-phi4-phi5))>\r
\r
- if(dMult>4)\r
- {\r
-  five2n1n1n1n1n = (reQ2nQ1nQ1nstarQ1nstarQ1nstar-reQ3nQ1nstarQ1nstarQ1nstar+6.*reQ3nQ2nstarQ1nstar)\r
-                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))\r
-                 - (reQ2nQ1nQ3nstar+3.*(dMult-6.)*reQ2nQ1nstarQ1nstar+3.*reQ1nQ1nQ2nstar)\r
-                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))\r
-                 - (2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))\r
-                 + 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))     \r
-                 - 3.*(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.)))\r
-                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))\r
-                 - 3.*(pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)\r
-                 - 2.*(2*dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult*(dMult-4.))\r
-                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));\r
-                 \r
-  five2n2n2n1n1n = (reQ2nQ2nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-2.*reQ2nQ2nQ3nstarQ1nstar)\r
-                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))\r
-                 + 2.*(reQ4nQ2nstarQ2nstar+4.*reQ3nQ2nstarQ1nstar+reQ3nQ1nQ4nstar)\r
-                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))\r
-                 + (reQ2nQ2nQ4nstar-2.*(dMult-5.)*reQ2nQ1nstarQ1nstar+2.*reQ1nQ1nQ2nstar)\r
-                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))\r
-                 - (2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))\r
-                 + 1.*pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)\r
-                 - 2.*(3.*dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.)))\r
-                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))\r
-                 - (4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))\r
-                 - 4.*(dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+4.*dMult*(dMult-6.))\r
-                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); \r
-\r
-  five4n1n1n1n1n = (reQ4nQ1nstarQ1nstarQ1nstarQ1nstar-6.*reQ4nQ2nstarQ1nstarQ1nstar-4.*reQ3nQ1nstarQ1nstarQ1nstar)\r
-                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))\r
-                 + (8.*reQ4nQ3nstarQ1nstar+3.*reQ4nQ2nstarQ2nstar+12.*reQ3nQ2nstarQ1nstar+12.*reQ2nQ1nstarQ1nstar)\r
-                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))\r
-                 - (6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+8.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))\r
-                 + 12.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+24.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-24.*dMult)\r
-                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));\r
-  \r
-  five3n1n2n1n1n = (reQ3nQ1nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ3nQ1nstarQ1nstarQ1nstar)\r
-                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))\r
-                 - (reQ3nQ1nQ2nstarQ2nstar-3.*reQ4nQ3nstarQ1nstar-reQ4nQ2nstarQ2nstar)\r
-                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))\r
-                 - ((2.*dMult-13.)*reQ3nQ2nstarQ1nstar-reQ3nQ1nQ4nstar-9.*reQ2nQ1nstarQ1nstar)\r
-                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))\r
-                 - (2.*reQ1nQ1nQ2nstar+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))\r
-                 - 2.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+2.*(pow(dReQ3n,2.)\r
-                 + pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))\r
-                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))\r
-                 + (2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))\r
-                 - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))\r
-                 - pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)\r
-                 + 2.*(3.*dMult-11.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))\r
-                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))\r
-                 - 4.*(dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));\r
-                 \r
-  // average 5-particle correlations for single event: \r
-  fIntFlowCorrelationsAllEBE->SetBinContent(19,five2n1n1n1n1n);\r
-  fIntFlowCorrelationsAllEBE->SetBinContent(20,five2n2n2n1n1n);\r
-  fIntFlowCorrelationsAllEBE->SetBinContent(21,five3n1n2n1n1n);\r
-  fIntFlowCorrelationsAllEBE->SetBinContent(22,five4n1n1n1n1n);\r
-        \r
-  // average 5-particle correlations for all events:                         \r
-  fIntFlowCorrelationsAllPro->Fill(18.5,five2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); \r
-  fIntFlowCorrelationsAllPro->Fill(19.5,five2n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));\r
-  fIntFlowCorrelationsAllPro->Fill(20.5,five3n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));\r
-  fIntFlowCorrelationsAllPro->Fill(21.5,five4n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));\r
- } // end of if(dMult>4)\r
-    \r
- // 6-particle:\r
- Double_t six1n1n1n1n1n1n = 0.; // <cos(n*(phi1+phi2+phi3-phi4-phi5-phi6))>\r
- Double_t six2n2n1n1n1n1n = 0.; // <cos(n*(2.*phi1+2.*phi2-phi3-phi4-phi5-phi6))>\r
- Double_t six3n1n1n1n1n1n = 0.; // <cos(n*(3.*phi1+phi2-phi3-phi4-phi5-phi6))>\r
- Double_t six2n1n1n2n1n1n = 0.; // <cos(n*(2.*phi1+phi2+phi3-2.*phi4-phi5-phi6))>\r
\r
- if(dMult>5)\r
- {\r
-  six1n1n1n1n1n1n = (pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),3.)+9.*dQ2nQ1nQ2nstarQ1nstar-6.*reQ2nQ1nQ1nstarQ1nstarQ1nstar)\r
-                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.))\r
-                  + 4.*(reQ3nQ1nstarQ1nstarQ1nstar-3.*reQ3nQ2nstarQ1nstar)\r
-                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.))\r
-                  + 2.*(9.*(dMult-4.)*reQ2nQ1nstarQ1nstar+2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)))\r
-                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.))\r
-                  - 9.*(pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)+(pow(dReQ2n,2.)+pow(dImQ2n,2.)))\r
-                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-5.))\r
-                  + (18.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))\r
-                  / (dMult*(dMult-1)*(dMult-3)*(dMult-4))\r
-                  - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));\r
-                  \r
-  six2n1n1n2n1n1n = (dQ2nQ1nQ1nQ2nstarQ1nstarQ1nstar-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)\r
-                  * (2.*five2n2n2n1n1n+4.*five2n1n1n1n1n+4.*five3n1n2n1n1n+4.*four2n1n2n1n+1.*four1n1n1n1n)\r
-                  - dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(4.*four1n1n1n1n+4.*two1n1n\r
-                  + 2.*three2n1n1n+2.*three2n1n1n+4.*four3n1n1n1n+8.*three2n1n1n+2.*four4n2n1n1n\r
-                  + 4.*four2n1n2n1n+2.*two2n2n+8.*four2n1n2n1n+4.*four3n1n3n1n+8.*three3n2n1n\r
-                  + 4.*four3n1n2n2n+4.*four1n1n1n1n+4.*four2n1n2n1n+1.*four2n2n2n2n)\r
-                  - dMult*(dMult-1.)*(dMult-2.)*(2.*three2n1n1n+8.*two1n1n+4.*two1n1n+2.\r
-                  + 4.*two1n1n+4.*three2n1n1n+2.*two2n2n+4.*three2n1n1n+8.*three3n2n1n\r
-                  + 8.*two2n2n+4.*three4n3n1n+4.*two3n3n+4.*three3n2n1n+4.*two1n1n\r
-                  + 8.*three2n1n1n+4.*two1n1n+4.*three3n2n1n+4.*three2n1n1n+2.*two2n2n\r
-                  + 4.*three3n2n1n+2.*three4n2n2n)-dMult*(dMult-1.)\r
-                  * (4.*two1n1n+4.+4.*two1n1n+2.*two2n2n+1.+4.*two1n1n+4.*two2n2n+4.*two3n3n\r
-                  + 1.+2.*two2n2n+1.*two4n4n)-dMult)\r
-                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); // to be improved (direct formula needed)\r
\r
-  six2n2n1n1n1n1n = (reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)\r
-                  * (five4n1n1n1n1n+8.*five2n1n1n1n1n+6.*five2n2n2n1n1n)-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)\r
-                  * (4.*four3n1n1n1n+6.*four4n2n1n1n+12.*three2n1n1n+12.*four1n1n1n1n+24.*four2n1n2n1n\r
-                  + 4.*four3n1n2n2n+3.*four2n2n2n2n)-dMult*(dMult-1.)*(dMult-2.)*(6.*three2n1n1n+12.*three3n2n1n\r
-                  + 4.*three4n3n1n+3.*three4n2n2n+8.*three2n1n1n+24.*two1n1n+12.*two2n2n+12.*three2n1n1n+8.*three3n2n1n\r
-                  + 1.*three4n2n2n)-dMult*(dMult-1.)*(4.*two1n1n+6.*two2n2n+4.*two3n3n+1.*two4n4n+2.*two2n2n+8.*two1n1n+6.)-dMult)\r
-                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); // to be improved (direct formula needed)\r
-   \r
-  six3n1n1n1n1n1n = (reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)\r
-                  * (five4n1n1n1n1n+4.*five2n1n1n1n1n+6.*five3n1n2n1n1n+4.*four3n1n1n1n)\r
-                  - dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(4.*four3n1n1n1n+6.*four4n2n1n1n+6.*four1n1n1n1n\r
-                  + 12.*three2n1n1n+12.*four2n1n2n1n+6.*four3n1n1n1n+12.*three3n2n1n+4.*four3n1n3n1n+3.*four3n1n2n2n)\r
-                  - dMult*(dMult-1.)*(dMult-2.)*(6.*three2n1n1n+12.*three3n2n1n+4.*three4n3n1n+3.*three4n2n2n+4.*two1n1n\r
-                  + 12.*two1n1n+6.*three2n1n1n+12.*three2n1n1n+4.*three3n2n1n+12.*two2n2n+4.*three3n2n1n+4.*two3n3n+1.*three4n3n1n\r
-                  + 6.*three3n2n1n)-dMult*(dMult-1.)*(4.*two1n1n+6.*two2n2n+4.*two3n3n+1.*two4n4n+1.*two1n1n+4.+6.*two1n1n+4.*two2n2n\r
-                  + 1.*two3n3n)-dMult)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); // to be improved (direct formula needed)\r
-                                 \r
-  // average 6-particle correlations for single event: \r
-  fIntFlowCorrelationsAllEBE->SetBinContent(24,six1n1n1n1n1n1n);\r
-  fIntFlowCorrelationsAllEBE->SetBinContent(25,six2n1n1n2n1n1n);\r
-  fIntFlowCorrelationsAllEBE->SetBinContent(26,six2n2n1n1n1n1n);\r
-  fIntFlowCorrelationsAllEBE->SetBinContent(27,six3n1n1n1n1n1n);\r
-        \r
-  // average 6-particle correlations for all events:         \r
-  fIntFlowCorrelationsAllPro->Fill(23.5,six1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); \r
-  fIntFlowCorrelationsAllPro->Fill(24.5,six2n1n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); \r
-  fIntFlowCorrelationsAllPro->Fill(25.5,six2n2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));\r
-  fIntFlowCorrelationsAllPro->Fill(26.5,six3n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); \r
-\r
-  // store separetately <6> (to be improved: do I really need this?)\r
-  fIntFlowCorrelationsEBE->SetBinContent(3,six1n1n1n1n1n1n); // <6>\r
-  fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(3,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); // eW_<6>\r
-  fIntFlowCorrelationsPro->Fill(2.5,six1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));\r
\r
-  // distribution of <cos(n*(phi1+phi2+phi3-phi4-phi5-phi6))>\r
-  //f6pDistribution->Fill(six1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); \r
- } // end of if(dMult>5)\r
\r
- // 7-particle:\r
- Double_t seven2n1n1n1n1n1n1n = 0.; // <cos(n*(2.*phi1+phi2+phi3-phi4-phi5-phi6-phi7))>\r
\r
- if(dMult>6)\r
- {\r
-  seven2n1n1n1n1n1n1n = (reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)\r
-                      * (2.*six3n1n1n1n1n1n+4.*six1n1n1n1n1n1n+1.*six2n2n1n1n1n1n+6.*six2n1n1n2n1n1n+8.*five2n1n1n1n1n)\r
-                      - dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(1.*five4n1n1n1n1n +8.*five2n1n1n1n1n+8.*four3n1n1n1n\r
-                      + 12.*five3n1n2n1n1n+4.*five2n1n1n1n1n+3.*five2n2n2n1n1n+6.*five2n2n2n1n1n+6.*four1n1n1n1n+24.*four1n1n1n1n\r
-                      + 12.*five2n1n1n1n1n+12.*five2n1n1n1n1n+12.*three2n1n1n+24.*four2n1n2n1n+4.*five3n1n2n1n1n+4.*five2n1n1n1n1n)\r
-                      - dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(4.*four3n1n1n1n+6.*four4n2n1n1n+12.*four1n1n1n1n+24.*three2n1n1n\r
-                      + 24.*four2n1n2n1n+12.*four3n1n1n1n+24.*three3n2n1n+8.*four3n1n3n1n+6.*four3n1n2n2n+6.*three2n1n1n+12.*four1n1n1n1n\r
-                      + 12.*four2n1n2n1n+6.*three2n1n1n+12.*four2n1n2n1n+4.*four3n1n2n2n+3.*four2n2n2n2n+4.*four1n1n1n1n+6.*three2n1n1n\r
-                      + 24.*two1n1n+24.*four1n1n1n1n+4.*four3n1n1n1n+24.*two1n1n+24.*three2n1n1n+12.*two2n2n+24.*three2n1n1n+12.*four2n1n2n1n\r
-                      + 8.*three3n2n1n+8.*four2n1n2n1n+1.*four4n2n1n1n)-dMult*(dMult-1.)*(dMult-2.)*(6.*three2n1n1n+1.*three2n1n1n+8.*two1n1n\r
-                      + 12.*three3n2n1n+24.*two1n1n+12.*three2n1n1n+4.*three2n1n1n+8.*two1n1n+4.*three4n3n1n+24.*three2n1n1n+8.*three3n2n1n\r
-                      + 12.*two1n1n+12.*two1n1n+3.*three4n2n2n+24.*two2n2n+6.*two2n2n+12.+12.*three3n2n1n+8.*two3n3n+12.*three2n1n1n+24.*two1n1n\r
-                      + 4.*three3n2n1n+8.*three3n2n1n+2.*three4n3n1n+12.*two1n1n+8.*three2n1n1n+4.*three2n1n1n+2.*three3n2n1n+6.*two2n2n+8.*two2n2n\r
-                      + 1.*three4n2n2n+4.*three3n2n1n+6.*three2n1n1n)-dMult*(dMult-1.)*(4.*two1n1n+2.*two1n1n+6.*two2n2n+8.+1.*two2n2n+4.*two3n3n\r
-                      + 12.*two1n1n+4.*two1n1n+1.*two4n4n+8.*two2n2n+6.+2.*two3n3n+4.*two1n1n+1.*two2n2n)-dMult)\r
-                      / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)); // to be improved (direct formula needed)\r
-        \r
-  // average 7-particle correlations for single event: \r
-  fIntFlowCorrelationsAllEBE->SetBinContent(29,seven2n1n1n1n1n1n1n);\r
-       \r
-  // average 7-particle correlations for all events:                      \r
-  fIntFlowCorrelationsAllPro->Fill(28.5,seven2n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.));\r
- } // end of if(dMult>6)\r
\r
- // 8-particle:\r
- Double_t eight1n1n1n1n1n1n1n1n = 0.; // <cos(n*(phi1+phi2+phi3+phi4-phi5-phi6-phi7-phi8))>\r
- if(dMult>7)\r
- {\r
-  eight1n1n1n1n1n1n1n1n = (pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),4.)-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)\r
-                        * (12.*seven2n1n1n1n1n1n1n+16.*six1n1n1n1n1n1n)-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)\r
-                        * (8.*six3n1n1n1n1n1n+48.*six1n1n1n1n1n1n+6.*six2n2n1n1n1n1n+96.*five2n1n1n1n1n+72.*four1n1n1n1n+36.*six2n1n1n2n1n1n)\r
-                        - dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(2.*five4n1n1n1n1n+32.*five2n1n1n1n1n+36.*four1n1n1n1n\r
-                        + 32.*four3n1n1n1n+48.*five2n1n1n1n1n+48.*five3n1n2n1n1n+144.*five2n1n1n1n1n+288.*four1n1n1n1n+36.*five2n2n2n1n1n\r
-                        + 144.*three2n1n1n+96.*two1n1n+144.*four2n1n2n1n)-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)\r
-                        * (8.*four3n1n1n1n+48.*four1n1n1n1n+12.*four4n2n1n1n+96.*four2n1n2n1n+96.*three2n1n1n+72.*three2n1n1n+144.*two1n1n\r
-                        + 16.*four3n1n3n1n+48.*four3n1n1n1n+144.*four1n1n1n1n+72.*four1n1n1n1n+96.*three3n2n1n+24.*four3n1n2n2n+144.*four2n1n2n1n\r
-                        + 288.*two1n1n+288.*three2n1n1n+9.*four2n2n2n2n+72.*two2n2n+24.)-dMult*(dMult-1.)*(dMult-2.)*(12.*three2n1n1n+16.*two1n1n\r
-                        + 24.*three3n2n1n+48.*three2n1n1n+96.*two1n1n+8.*three4n3n1n+32.*three3n2n1n+96.*three2n1n1n+144.*two1n1n+6.*three4n2n2n\r
-                        + 96.*two2n2n+36.*two2n2n+72.+48.*three3n2n1n+16.*two3n3n+72.*three2n1n1n+144.*two1n1n)-dMult*(dMult-1.)*(8.*two1n1n\r
-                        + 12.*two2n2n+16.+8.*two3n3n+48.*two1n1n+1.*two4n4n+16.*two2n2n+18.)-dMult)\r
-                        / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.)); // to be improved (direct formula needed)\r
-  \r
-  // average 8-particle correlations for single event: \r
-  fIntFlowCorrelationsAllEBE->SetBinContent(31,eight1n1n1n1n1n1n1n1n);\r
-       \r
-  // average 8-particle correlations for all events:                       \r
-  fIntFlowCorrelationsAllPro->Fill(30.5,eight1n1n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));\r
\r
-  // store separetately <8> (to be improved: do I really need this?)\r
-  fIntFlowCorrelationsEBE->SetBinContent(4,eight1n1n1n1n1n1n1n1n); // <8>\r
-  fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(4,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.)); // eW_<8>\r
-  fIntFlowCorrelationsPro->Fill(3.5,eight1n1n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));\r
-  \r
-  // distribution of <cos(n*(phi1+phi2+phi3+phi4-phi5-phi6-phi7-phi8))>\r
-  //f8pDistribution->Fill(eight1n1n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));\r
- } // end of if(dMult>7) \r
\r
-} // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelations()\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrelations()\r
-{\r
- // Calculate averages of products of correlations for integrated flow  // to be improved (this method can be implemented better)\r
\r
- // a) Binning of fIntFlowProductOfCorrelationsPro is organized as follows:\r
- //     1st bin: <<2><4>> \r
- //     2nd bin: <<2><6>>\r
- //     3rd bin: <<2><8>>\r
- //     4th bin: <<4><6>>\r
- //     5th bin: <<4><8>>\r
- //     6th bin: <<6><8>>\r
-\r
- /*\r
- Double_t dMult = (*fSMpk)(0,0); // multiplicity \r
-\r
- Double_t twoEBE = fIntFlowCorrelationsEBE->GetBinContent(1); // <2>\r
- Double_t fourEBE = fIntFlowCorrelationsEBE->GetBinContent(2); // <4>\r
- Double_t sixEBE = fIntFlowCorrelationsEBE->GetBinContent(3); // <6>\r
- Double_t eightEBE = fIntFlowCorrelationsEBE->GetBinContent(4); // <8>\r
\r
- Double_t eW2 = 0.; // event weight for <2>\r
- Double_t eW4 = 0.; // event weight for <4>\r
- Double_t eW6 = 0.; // event weight for <6>\r
- Double_t eW8 = 0.; // event weight for <8>\r
\r
- if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights))\r
- {\r
-  eW2 = dMult*(dMult-1);\r
-  eW4 = dMult*(dMult-1)*(dMult-2)*(dMult-3);\r
-  eW6 = dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-4)*(dMult-5);\r
-  eW8 = dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-4)*(dMult-5)*(dMult-6)*(dMult-7);\r
- } else \r
-   {\r
-    eW2 = (*fSMpk)(1,1)-(*fSMpk)(0,2); // dM11 = sum_{i,j=1,i!=j}^M w_i w_j;\r
-    eW4 = (*fSMpk)(3,1)-6.*(*fSMpk)(0,2)*(*fSMpk)(1,1)  \r
-        + 8.*(*fSMpk)(0,3)*(*fSMpk)(0,1)\r
-        + 3.*(*fSMpk)(1,2)-6.*(*fSMpk)(0,4); // dM1111 = sum_{i,j,k,l=1,i!=j!=k!=l}^M w_i w_j w_k w_l\r
-   }\r
-  \r
- fIntFlowProductOfCorrelationsPro->Fill(0.5,twoEBE*fourEBE,eW2*eW4); // <<2><4>> \r
- fIntFlowProductOfCorrelationsPro->Fill(1.5,twoEBE*sixEBE,eW2*eW6); // <<2><6>>\r
- fIntFlowProductOfCorrelationsPro->Fill(2.5,twoEBE*eightEBE,eW2*eW8); // <<2><8>>\r
- fIntFlowProductOfCorrelationsPro->Fill(3.5,fourEBE*sixEBE,eW4*eW6); // <<4><6>>\r
- fIntFlowProductOfCorrelationsPro->Fill(4.5,fourEBE*eightEBE,eW4*eW8); // <<4><8>>\r
- fIntFlowProductOfCorrelationsPro->Fill(5.5,sixEBE*eightEBE,eW6*eW8); // <<6><8>>\r
- */\r
\r
\r
- Int_t counter = 0;\r
\r
- for(Int_t ci1=1;ci1<4;ci1++)\r
- {\r
-  for(Int_t ci2=ci1+1;ci2<=4;ci2++)\r
-  {\r
-   fIntFlowProductOfCorrelationsPro->Fill(0.5+counter++,\r
-                                          fIntFlowCorrelationsEBE->GetBinContent(ci1)*fIntFlowCorrelationsEBE->GetBinContent(ci2),\r
-                                          fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci1)*fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci2));\r
-  }\r
- }\r
\r
-} // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrelations()\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::CalculateCovariancesIntFlow()\r
-{\r
- // a) Calculate unbiased estimators Cov(<2>,<4>), Cov(<2>,<6>), Cov(<2>,<8>), Cov(<4>,<6>), Cov(<4>,<8>) and Cov(<6>,<8>)\r
- //    for covariances V_(<2>,<4>), V_(<2>,<6>), V_(<2>,<8>), V_(<4>,<6>), V_(<4>,<8>) and V_(<6>,<8>).\r
- // b) Store in histogram fIntFlowCovariances for instance the following: \r
- //\r
- //             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)]\r
- // \r
- //    where N is the number of events, w_{<2>} is event weight for <2> and w_{<4>} is event weight for <4>.\r
- // c) Binning of fIntFlowCovariances is organized as follows:\r
- // \r
- //     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)] \r
- //     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)]\r
- //     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)]\r
- //     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)]\r
- //     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)]\r
- //     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)]\r
-    \r
- for(Int_t power=0;power<2;power++)\r
- { \r
-  if(!(fIntFlowCorrelationsPro && fIntFlowProductOfCorrelationsPro \r
-       && fIntFlowSumOfEventWeights[power] && fIntFlowSumOfProductOfEventWeights\r
-       && fIntFlowCovariances)) \r
-  {\r
-   cout<<"WARNING: fIntFlowCorrelationsPro && fIntFlowProductOfCorrelationsPro "<<endl;\r
-   cout<<"         && fIntFlowSumOfEventWeights[power] && fIntFlowSumOfProductOfEventWeights"<<endl;\r
-   cout<<"         && fIntFlowCovariances is NULL in AFAWQC::FCIF() !!!!"<<endl;\r
-   cout<<"power = "<<power<<endl;\r
-   exit(0);\r
-  }\r
- }\r
-   \r
- // average 2-, 4-, 6- and 8-particle correlations for all events:\r
- Double_t correlation[4] = {0.};\r
- for(Int_t ci=0;ci<4;ci++)\r
- {\r
-  correlation[ci] = fIntFlowCorrelationsPro->GetBinContent(ci+1);\r
- } \r
- // average products of 2-, 4-, 6- and 8-particle correlations: \r
- Double_t productOfCorrelations[4][4] = {{0.}};\r
- Int_t productOfCorrelationsLabel = 1;\r
- // denominators in the expressions for the unbiased estimator for covariance:\r
- Double_t denominator[4][4] = {{0.}};\r
- Int_t sumOfProductOfEventWeightsLabel1 = 1;\r
- // weight dependent prefactor which multiply unbiased estimators for covariances:\r
- Double_t wPrefactor[4][4] = {{0.}}; \r
- Int_t sumOfProductOfEventWeightsLabel2 = 1;\r
- for(Int_t c1=0;c1<4;c1++)\r
- {\r
-  for(Int_t c2=c1+1;c2<4;c2++)\r
-  {\r
-   productOfCorrelations[c1][c2] = fIntFlowProductOfCorrelationsPro->GetBinContent(productOfCorrelationsLabel);\r
-   if(fIntFlowSumOfEventWeights[0]->GetBinContent(c1+1) && fIntFlowSumOfEventWeights[0]->GetBinContent(c2+1))\r
-   {\r
-    denominator[c1][c2] = 1.-(fIntFlowSumOfProductOfEventWeights->GetBinContent(sumOfProductOfEventWeightsLabel1))/\r
-                             (fIntFlowSumOfEventWeights[0]->GetBinContent(c1+1) \r
-                              * fIntFlowSumOfEventWeights[0]->GetBinContent(c2+1));\r
-                              \r
-    wPrefactor[c1][c2] =  fIntFlowSumOfProductOfEventWeights->GetBinContent(sumOfProductOfEventWeightsLabel2)/ \r
-                          (fIntFlowSumOfEventWeights[0]->GetBinContent(c1+1)\r
-                            * fIntFlowSumOfEventWeights[0]->GetBinContent(c2+1));\r
-                          \r
-                              \r
-   }\r
-   productOfCorrelationsLabel++;\r
-   sumOfProductOfEventWeightsLabel1++;\r
-   sumOfProductOfEventWeightsLabel2++;  \r
-  }\r
- }\r
\r
- // covariance label:\r
- Int_t covarianceLabel = 1;\r
- for(Int_t c1=0;c1<4;c1++)\r
- {\r
-  for(Int_t c2=c1+1;c2<4;c2++)\r
-  {\r
-   if(denominator[c1][c2])\r
-   {\r
-    // covariances:\r
-    Double_t cov = (productOfCorrelations[c1][c2]-correlation[c1]*correlation[c2])/denominator[c1][c2]; \r
-    // covarianced multiplied with weight dependent prefactor:\r
-    Double_t wCov = cov * wPrefactor[c1][c2];\r
-    fIntFlowCovariances->SetBinContent(covarianceLabel,wCov);\r
-   }\r
-   covarianceLabel++;\r
-  }\r
- }\r
\r
-} // end of AliFlowAnalysisWithQCumulants::CalculateCovariancesIntFlow()\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::FinalizeCorrelationsIntFlow() \r
-{\r
- // From profile fIntFlowCorrelationsPro access measured correlations and spread, \r
- // correctly calculate the statistical errors and store the final results and \r
- // statistical errors for correlations in histogram fIntFlowCorrelationsHist.\r
- //\r
- // Remark: Statistical error of correlation is calculated as:\r
- //\r
- //          statistical error = termA * spread * termB:\r
- //          termA = sqrt{sum_{i=1}^{N} w^2}/(sum_{i=1}^{N} w)\r
- //          termB = 1/sqrt(1-termA^2)   \r
\r
- for(Int_t power=0;power<2;power++)\r
- { \r
-  if(!(fIntFlowCorrelationsHist && fIntFlowCorrelationsPro && fIntFlowSumOfEventWeights[power])) \r
-  {\r
-   cout<<"WARNING: fIntFlowCorrelationsHist && fIntFlowCorrelationsPro && fIntFlowSumOfEventWeights[power] is NULL in AFAWQC::FCIF() !!!!"<<endl;\r
-   cout<<"power = "<<power<<endl;\r
-   exit(0);\r
-  }\r
- }\r
-  \r
- for(Int_t ci=1;ci<=4;ci++) // correlation index\r
- {\r
-  Double_t correlation = fIntFlowCorrelationsPro->GetBinContent(ci);\r
-  Double_t spread = fIntFlowCorrelationsPro->GetBinError(ci);\r
-  Double_t sumOfLinearEventWeights = fIntFlowSumOfEventWeights[0]->GetBinContent(ci);\r
-  Double_t sumOfQuadraticEventWeights = fIntFlowSumOfEventWeights[1]->GetBinContent(ci);\r
-  Double_t termA = 0.;\r
-  Double_t termB = 0.;\r
-  if(sumOfLinearEventWeights)\r
-  {\r
-   termA = pow(sumOfQuadraticEventWeights,0.5)/sumOfLinearEventWeights;\r
-  } else\r
-    {\r
-     cout<<"WARNING: sumOfLinearEventWeights == 0 in AFAWQC::FCIF() !!!!"<<endl;\r
-     cout<<"         (for "<<2*ci<<"-particle correlation)"<<endl;\r
-    }\r
-  if(1.-pow(termA,2.) > 0.)\r
-  {\r
-   termB = 1./pow(1-pow(termA,2.),0.5);\r
-  } else\r
-    {\r
-     cout<<"WARNING: 1.-pow(termA,2.) <= 0 in AFAWQC::FCIF() !!!!"<<endl;   \r
-     cout<<"         (for "<<2*ci<<"-particle correlation)"<<endl;\r
-    }     \r
-  Double_t statisticalError = termA * spread * termB;\r
-  fIntFlowCorrelationsHist->SetBinContent(ci,correlation);\r
-  fIntFlowCorrelationsHist->SetBinError(ci,statisticalError);\r
- } // end of for(Int_t ci=1;ci<=4;ci++) // correlation index                                                                \r
-                                                                                                                              \r
-} // end of AliFlowAnalysisWithQCumulants::FinalizeCorrelationsIntFlow()\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::FillAverageMultiplicities(Int_t nRP)\r
-{\r
- // Fill profile fAverageMultiplicity to hold average multiplicities and number of events for events with nRP>=0, nRP>=1, ... , and nRP>=8\r
\r
- // Binning of fAverageMultiplicity is organized as follows:\r
- //  1st bin: all events (including the empty ones)\r
- //  2nd bin: event with # of RPs greater or equal to 1\r
- //  3rd bin: event with # of RPs greater or equal to 2\r
- //  4th bin: event with # of RPs greater or equal to 3\r
- //  5th bin: event with # of RPs greater or equal to 4\r
- //  6th bin: event with # of RPs greater or equal to 5\r
- //  7th bin: event with # of RPs greater or equal to 6\r
- //  8th bin: event with # of RPs greater or equal to 7\r
- //  9th bin: event with # of RPs greater or equal to 8\r
\r
- if(!fAvMultiplicity)\r
- {\r
-  cout<<"WARNING: fAvMultiplicity is NULL in AFAWQC::FAM() !!!!"<<endl;\r
-  exit(0);\r
- }\r
\r
- if(nRP<0)\r
- {\r
-  cout<<"WARNING: nRP<0 in in AFAWQC::FAM() !!!!"<<endl;\r
-  exit(0);\r
- }\r
\r
- for(Int_t i=0;i<9;i++)\r
- {\r
-  if(nRP>=i) fAvMultiplicity->Fill(i+0.5,nRP,1);\r
- }\r
\r
-} // end of AliFlowAnalysisWithQCumulants::FillAverageMultiplicities(nRP)\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::CalculateCumulantsIntFlow()\r
-{\r
- // a) Calculate Q-cumulants from the measured multiparticle correlations.\r
- // b) Propagate the statistical errors of measured multiparticle correlations to statistical errors of Q-cumulants.  \r
- // c) REMARK: Q-cumulants calculated in this method are biased by non-uniform acceptance of detector !!!! \r
- //            Method ApplyCorrectionForNonUniformAcceptance* (to be improved: finalize the name here)\r
- //            is called afterwards to correct for this bias.   \r
- // d) Store the results and statistical error of Q-cumulants in histogram fCumulants.\r
- //    Binning of fCumulants is organized as follows:\r
- //\r
- //     1st bin: QC{2}\r
- //     2nd bin: QC{4}\r
- //     3rd bin: QC{6}\r
- //     4th bin: QC{8}\r
\r
- if(!(fIntFlowCorrelationsHist && fIntFlowCovariances && fIntFlowQcumulants))\r
- {\r
-  cout<<"WARNING: fIntFlowCorrelationsHist && fIntFlowCovariances && fIntFlowQcumulants is NULL in AFAWQC::CCIF() !!!!"<<endl;\r
-  exit(0);\r
- }\r
\r
- // correlations:\r
- Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>> \r
- Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>>  \r
- Double_t six = fIntFlowCorrelationsHist->GetBinContent(3); // <<6>> \r
- Double_t eight = fIntFlowCorrelationsHist->GetBinContent(4); // <<8>>  \r
\r
- // statistical errors of average 2-, 4-, 6- and 8-particle azimuthal correlations:\r
- Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1); // statistical error of <2>  \r
- Double_t fourError = fIntFlowCorrelationsHist->GetBinError(2); // statistical error of <4>   \r
- Double_t sixError = fIntFlowCorrelationsHist->GetBinError(3); // statistical error of <6> \r
- Double_t eightError = fIntFlowCorrelationsHist->GetBinError(4); // statistical error of <8> \r
\r
- // covariances (multiplied by prefactor depending on weights - see comments in CalculateCovariancesIntFlow()):\r
- Double_t wCov24 = fIntFlowCovariances->GetBinContent(1); // Cov(<2>,<4>) * prefactor(w_<2>,w_<4>)\r
- Double_t wCov26 = fIntFlowCovariances->GetBinContent(2); // Cov(<2>,<6>) * prefactor(w_<2>,w_<6>)\r
- Double_t wCov28 = fIntFlowCovariances->GetBinContent(3); // Cov(<2>,<8>) * prefactor(w_<2>,w_<8>)\r
- Double_t wCov46 = fIntFlowCovariances->GetBinContent(4); // Cov(<4>,<6>) * prefactor(w_<4>,w_<6>)\r
- Double_t wCov48 = fIntFlowCovariances->GetBinContent(5); // Cov(<4>,<8>) * prefactor(w_<4>,w_<8>)\r
- Double_t wCov68 = fIntFlowCovariances->GetBinContent(6); // Cov(<6>,<8>) * prefactor(w_<6>,w_<8>)\r
\r
- // Q-cumulants: \r
- Double_t qc2 = 0.; // QC{2}\r
- Double_t qc4 = 0.; // QC{4}\r
- Double_t qc6 = 0.; // QC{6}\r
- Double_t qc8 = 0.; // QC{8}\r
- if(two) qc2 = two; \r
- if(four) qc4 = four-2.*pow(two,2.); \r
- if(six) qc6 = six-9.*two*four+12.*pow(two,3.); \r
- if(eight) qc8 = eight-16.*two*six-18.*pow(four,2.)+144.*pow(two,2.)*four-144.*pow(two,4.); \r
\r
- // statistical errors of Q-cumulants:       \r
- Double_t qc2Error = 0.;\r
- Double_t qc4Error = 0.;\r
- Double_t qc6Error = 0.;\r
- Double_t qc8Error = 0.;\r
\r
- // squared statistical errors of Q-cumulants:       \r
- //Double_t qc2ErrorSquared = 0.;\r
- Double_t qc4ErrorSquared = 0.;\r
- Double_t qc6ErrorSquared = 0.;\r
- Double_t qc8ErrorSquared = 0.;\r
-        \r
- // statistical error of QC{2}:              \r
- qc2Error = twoError;                     \r
-                             \r
- // statistical error of QC{4}:              \r
- qc4ErrorSquared = 16.*pow(two,2.)*pow(twoError,2)+pow(fourError,2.)\r
-                 - 8.*two*wCov24;                     \r
- if(qc4ErrorSquared>0.)\r
- {\r
-  qc4Error = pow(qc4ErrorSquared,0.5);\r
- } else \r
-   {\r
-    cout<<"WARNING: Statistical error of QC{4} is imaginary !!!!"<<endl;\r
-   }\r
-                                           \r
- // statistical error of QC{6}:              \r
- qc6ErrorSquared = 81.*pow(4.*pow(two,2.)-four,2.)*pow(twoError,2.)\r
-                 + 81.*pow(two,2.)*pow(fourError,2.)\r
-                 + pow(sixError,2.)\r
-                 - 162.*two*(4.*pow(two,2.)-four)*wCov24\r
-                 + 18.*(4.*pow(two,2.)-four)*wCov26\r
-                 - 18.*two*wCov46; \r
-                    \r
- if(qc6ErrorSquared>0.)\r
- {\r
-  qc6Error = pow(qc6ErrorSquared,0.5);\r
- } else \r
-   {\r
-    cout<<"WARNING: Statistical error of QC{6} is imaginary !!!!"<<endl;\r
-   }\r
-                            \r
- // statistical error of QC{8}:              \r
- qc8ErrorSquared = 256.*pow(36.*pow(two,3.)-18.*four*two+six,2.)*pow(twoError,2.)\r
-                 + 1296.*pow(4.*pow(two,2.)-four,2.)*pow(fourError,2.)\r
-                 + 256.*pow(two,2.)*pow(sixError,2.)\r
-                 + pow(eightError,2.)\r
-                 - 1152.*(36.*pow(two,3.)-18.*four*two+six)*(4.*pow(two,2.)-four)*wCov24\r
-                 + 512.*two*(36.*pow(two,3.)-18.*four*two+six)*wCov26\r
-                 - 32.*(36.*pow(two,3.)-18.*four*two+six)*wCov28\r
-                 - 1152.*two*(4.*pow(two,2.)-four)*wCov46\r
-                 + 72.*(4.*pow(two,2.)-four)*wCov48\r
-                 - 32.*two*wCov68;      \r
- if(qc8ErrorSquared>0.)\r
- {\r
-  qc8Error = pow(qc8ErrorSquared,0.5);\r
- } else \r
-   {\r
-    cout<<"WARNING: Statistical error of QC{8} is imaginary !!!!"<<endl;\r
-   }\r
-\r
- // store the results and statistical errors for Q-cumulants:\r
- fIntFlowQcumulants->SetBinContent(1,qc2);\r
- fIntFlowQcumulants->SetBinError(1,qc2Error);\r
- fIntFlowQcumulants->SetBinContent(2,qc4);\r
- fIntFlowQcumulants->SetBinError(2,qc4Error);\r
- fIntFlowQcumulants->SetBinContent(3,qc6);\r
- fIntFlowQcumulants->SetBinError(3,qc6Error);\r
- fIntFlowQcumulants->SetBinContent(4,qc8); \r
- fIntFlowQcumulants->SetBinError(4,qc8Error); \r
-  \r
-} // end of AliFlowAnalysisWithQCumulants::CalculateCumulantsIntFlow()\r
-\r
-\r
-//================================================================================================================================ \r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::CalculateIntFlow()\r
-{\r
- // a) Calculate the final results for integrated flow estimates from Q-cumulants.\r
- // b) Propagate the statistical errors of measured multiparticle correlations to statistical errors of integrated flow estimates.  \r
- // c) Store the results and statistical errors of integrated flow estimates in histogram fIntFlow.\r
- //    Binning of fIntFlow is organized as follows:\r
- //\r
- //     1st bin: v{2,QC}\r
- //     2nd bin: v{4,QC}\r
- //     3rd bin: v{6,QC}\r
- //     4th bin: v{8,QC}\r
\r
- if(!(fIntFlowCorrelationsHist && fIntFlowCovariances && fIntFlowQcumulants && fIntFlow))\r
- {\r
-  cout<<"WARNING: fIntFlowCorrelationsHist && fIntFlowCovariances && fIntFlowQcumulants && fIntFlow is NULL in AFAWQC::CCIF() !!!!"<<endl;\r
-  exit(0);\r
- }\r
-   \r
- // Q-cumulants:\r
- Double_t qc2 = fIntFlowQcumulants->GetBinContent(1); // QC{2}  \r
- Double_t qc4 = fIntFlowQcumulants->GetBinContent(2); // QC{4}  \r
- Double_t qc6 = fIntFlowQcumulants->GetBinContent(3); // QC{6}  \r
- Double_t qc8 = fIntFlowQcumulants->GetBinContent(4); // QC{8}\r
-  \r
- // correlations:\r
- Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>> \r
- Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>>  \r
- Double_t six = fIntFlowCorrelationsHist->GetBinContent(3); // <<6>> \r
- Double_t eight = fIntFlowCorrelationsHist->GetBinContent(4); // <<8>>  \r
\r
- // statistical errors of average 2-, 4-, 6- and 8-particle azimuthal correlations:\r
- Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1); // statistical error of <2>  \r
- Double_t fourError = fIntFlowCorrelationsHist->GetBinError(2); // statistical error of <4>   \r
- Double_t sixError = fIntFlowCorrelationsHist->GetBinError(3); // statistical error of <6> \r
- Double_t eightError = fIntFlowCorrelationsHist->GetBinError(4); // statistical error of <8> \r
\r
- // covariances (multiplied by prefactor depending on weights - see comments in CalculateCovariancesIntFlow()):\r
- Double_t wCov24 = fIntFlowCovariances->GetBinContent(1); // Cov(<2>,<4>) * prefactor(w_<2>,w_<4>)\r
- Double_t wCov26 = fIntFlowCovariances->GetBinContent(2); // Cov(<2>,<6>) * prefactor(w_<2>,w_<6>)\r
- Double_t wCov28 = fIntFlowCovariances->GetBinContent(3); // Cov(<2>,<8>) * prefactor(w_<2>,w_<8>)\r
- Double_t wCov46 = fIntFlowCovariances->GetBinContent(4); // Cov(<4>,<6>) * prefactor(w_<4>,w_<6>)\r
- Double_t wCov48 = fIntFlowCovariances->GetBinContent(5); // Cov(<4>,<8>) * prefactor(w_<4>,w_<8>)\r
- Double_t wCov68 = fIntFlowCovariances->GetBinContent(6); // Cov(<6>,<8>) * prefactor(w_<6>,w_<8>)\r
-  \r
- // integrated flow estimates:\r
- Double_t v2 = 0.; // v{2,QC}  \r
- Double_t v4 = 0.; // v{4,QC}  \r
- Double_t v6 = 0.; // v{6,QC}  \r
- Double_t v8 = 0.; // v{8,QC}\r
\r
- // calculate integrated flow estimates from Q-cumulants: \r
- if(qc2>=0.) v2 = pow(qc2,1./2.); \r
- if(qc4<=0.) v4 = pow(-1.*qc4,1./4.); \r
- if(qc6>=0.) v6 = pow((1./4.)*qc6,1./6.); \r
- if(qc8<=0.) v8 = pow((-1./33.)*qc8,1./8.); \r
-   \r
- // statistical errors of integrated flow estimates:\r
- Double_t v2Error = 0.; // statistical error of v{2,QC}  \r
- Double_t v4Error = 0.; // statistical error of v{4,QC}  \r
- Double_t v6Error = 0.; // statistical error of v{6,QC}  \r
- Double_t v8Error = 0.; // statistical error of v{8,QC}\r
-   \r
- // squares of statistical errors of integrated flow estimates:\r
- Double_t v2ErrorSquared = 0.; // squared statistical error of v{2,QC} \r
- Double_t v4ErrorSquared = 0.; // squared statistical error of v{4,QC}   \r
- Double_t v6ErrorSquared = 0.; // squared statistical error of v{6,QC}   \r
- Double_t v8ErrorSquared = 0.; // squared statistical error of v{8,QC} \r
\r
- // calculate squared statistical errors of integrated flow estimates:\r
- if(two != 0.) \r
- { \r
-  v2ErrorSquared = (1./(4.*two))*pow(twoError,2.);\r
- } \r
- if(2.*pow(two,2.)-four > 0.)\r
- {\r
-  v4ErrorSquared = (1./pow(2.*pow(two,2.)-four,3./2.))*\r
-                   (pow(two,2.)*pow(twoError,2.)+(1./16.)*pow(fourError,2.)-(1./2.)*two*wCov24);\r
- }\r
- if(six-9.*four*two+12.*pow(two,3.) > 0.) \r
- {\r
-  v6ErrorSquared = ((1./2.)*(1./pow(2.,2./3.))*(1./pow(six-9.*four*two+12.*pow(two,3.),5./3.)))*\r
-                   ((9./2.)*pow(4.*pow(two,2.)-four,2.)*pow(twoError,2.) \r
-                    + (9./2.)*pow(two,2.)*pow(fourError,2.)+(1./18.)*pow(sixError,2.)\r
-                    - 9.*two*(4.*pow(two,2.)-four)*wCov24+(4.*pow(two,2.)-four)*wCov26-two*wCov46); \r
- }\r
- if(-1.*eight+16.*six*two+18.*pow(four,2.)-144.*four*pow(two,2.)+144.*pow(two,4.) > 0.) \r
- {\r
-  v8ErrorSquared = (4./pow(33,1./4.))*(1./pow(-1.*eight+16.*six*two+18.*pow(four,2.)-144.*four*pow(two,2.)+144.*pow(two,4.),7./4.))*\r
-                   (pow(36.*pow(two,3.)-18.*four*two+six,2.)*pow(twoError,2.)\r
-                    + (81./16.)*pow(4.*pow(two,2.)-four,2.)*pow(fourError,2.)\r
-                    + pow(two,2.)*pow(sixError,2.)\r
-                    + (1./256.)*pow(eightError,2.)\r
-                    - (9./2.)*(36.*pow(two,3.)-18.*four*two+six)*(4.*pow(two,2.)-four)*wCov24\r
-                    + 2.*two*(36.*pow(two,3.)-18.*four*two+six)*wCov26\r
-                    - (1./8.)*(36.*pow(two,3.)-18.*four*two+six)*wCov28                    \r
-                    - (9./2.)*two*(4.*pow(two,2.)-four)*wCov46                   \r
-                    + (9./32.)*(4.*pow(two,2.)-four)*wCov48                    \r
-                    - (1./8.)*two*wCov68);\r
- } \r
-\r
- // calculate statistical errors of integrated flow estimates: \r
- if(v2ErrorSquared > 0.)\r
- {\r
-  v2Error = pow(v2ErrorSquared,0.5);\r
- } else\r
-   {\r
-    cout<<"WARNING: Statistical error of v{2,QC} is imaginary !!!!"<<endl;\r
-   }    \r
- if(v4ErrorSquared > 0.)\r
- {\r
-  v4Error = pow(v4ErrorSquared,0.5);\r
- } else\r
-   {\r
-    cout<<"WARNING: Statistical error of v{4,QC} is imaginary !!!!"<<endl;\r
-   }     \r
- if(v6ErrorSquared > 0.)\r
- {\r
-  v6Error = pow(v6ErrorSquared,0.5);\r
- } else\r
-   {\r
-    cout<<"WARNING: Statistical error of v{6,QC} is imaginary !!!!"<<endl;\r
-   }     \r
- if(v8ErrorSquared > 0.)\r
- {\r
-  v8Error = pow(v8ErrorSquared,0.5);\r
- } else\r
-   {\r
-    cout<<"WARNING: Statistical error of v{8,QC} is imaginary !!!!"<<endl;\r
-   }    \r
-                     \r
- // store the results and statistical errors of integrated flow estimates:\r
- fIntFlow->SetBinContent(1,v2);\r
- fIntFlow->SetBinError(1,v2Error);\r
- fIntFlow->SetBinContent(2,v4);\r
- fIntFlow->SetBinError(2,v4Error);\r
- fIntFlow->SetBinContent(3,v6);\r
- fIntFlow->SetBinError(3,v6Error);\r
- fIntFlow->SetBinContent(4,v8);\r
- fIntFlow->SetBinError(4,v8Error);\r
-       \r
-} // end of AliFlowAnalysisWithQCumulants::CalculateIntFlow()\r
-\r
-\r
-//================================================================================================================================ \r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::FillCommonHistResultsIntFlow()\r
-{\r
- // Fill in AliFlowCommonHistResults histograms relevant for 'NONAME' integrated flow (to be improved (name))\r
\r
- if(!fIntFlow)\r
- {\r
-  cout<<"WARNING: fIntFlow is NULL in AFAWQC::FCHRIF() !!!!"<<endl;\r
-  exit(0); \r
- }  \r
-    \r
- if(!(fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th))\r
- {\r
-  cout<<"WARNING: fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th"<<endl; \r
-  cout<<"         is NULL in AFAWQC::FCHRIF() !!!!"<<endl;\r
-  exit(0);\r
- }\r
\r
- Double_t v2 = fIntFlow->GetBinContent(1);\r
- Double_t v4 = fIntFlow->GetBinContent(2);\r
- Double_t v6 = fIntFlow->GetBinContent(3);\r
- Double_t v8 = fIntFlow->GetBinContent(4);\r
-  \r
- Double_t v2Error = fIntFlow->GetBinError(1);\r
- Double_t v4Error = fIntFlow->GetBinError(2);\r
- Double_t v6Error = fIntFlow->GetBinError(3);\r
- Double_t v8Error = fIntFlow->GetBinError(4);\r
\r
- fCommonHistsResults2nd->FillIntegratedFlow(v2,v2Error); // to be improved (hardwired 2nd in the name)  \r
- fCommonHistsResults4th->FillIntegratedFlow(v4,v4Error); // to be improved (hardwired 4th in the name)\r
- if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)) // to be improved (calculate also 6th and 8th order)\r
- {\r
-  fCommonHistsResults6th->FillIntegratedFlow(v6,v6Error); // to be improved (hardwired 6th in the name)\r
-  fCommonHistsResults8th->FillIntegratedFlow(v8,v8Error); // to be improved (hardwired 8th in the name) \r
- }\r
\r
-} // end of AliFlowAnalysisWithQCumulants::FillCommonHistResultsIntFlow()\r
-\r
-\r
-//================================================================================================================================ \r
-\r
-\r
-/*\r
-void AliFlowAnalysisWithQCumulants::ApplyCorrectionForNonUniformAcceptanceToCumulantsForIntFlow(Bool_t useParticleWeights, TString eventWeights)\r
-{\r
- // apply correction for non-uniform acceptance to cumulants for integrated flow \r
- // (Remark: non-corrected cumulants are accessed from fCumulants[pW][0], corrected cumulants are stored in fCumulants[pW][1])\r
\r
- // shortcuts for the flags:\r
- Int_t pW = (Int_t)(useParticleWeights); // 0=pWeights not used, 1=pWeights used\r
- Int_t eW = -1;\r
\r
- if(eventWeights == "exact")\r
- {\r
-  eW = 0;\r
- }\r
\r
- if(!(fCumulants[pW][eW][0] && fCumulants[pW][eW][1] && fCorrections[pW][eW]))\r
- {\r
-  cout<<"WARNING: fCumulants[pW][eW][0] && fCumulants[pW][eW][1] && fCorrections[pW][eW] is NULL in AFAWQC::ACFNUATCFIF() !!!!"<<endl;\r
-  cout<<"pW = "<<pW<<endl;\r
-  cout<<"eW = "<<eW<<endl;\r
-  exit(0);\r
- } \r
-  \r
- // non-corrected cumulants:\r
- Double_t qc2 = fCumulants[pW][eW][0]->GetBinContent(1); \r
- Double_t qc4 = fCumulants[pW][eW][0]->GetBinContent(2); \r
- Double_t qc6 = fCumulants[pW][eW][0]->GetBinContent(3); \r
- Double_t qc8 = fCumulants[pW][eW][0]->GetBinContent(4); \r
- // statistical error of non-corrected cumulants:  \r
- Double_t qc2Error = fCumulants[pW][eW][0]->GetBinError(1); \r
- Double_t qc4Error = fCumulants[pW][eW][0]->GetBinError(2); \r
- Double_t qc6Error = fCumulants[pW][eW][0]->GetBinError(3); \r
- Double_t qc8Error = fCumulants[pW][eW][0]->GetBinError(4); \r
- // corrections for non-uniform acceptance:\r
- Double_t qc2Correction = fCorrections[pW][eW]->GetBinContent(1); \r
- Double_t qc4Correction = fCorrections[pW][eW]->GetBinContent(2); \r
- Double_t qc6Correction = fCorrections[pW][eW]->GetBinContent(3); \r
- Double_t qc8Correction = fCorrections[pW][eW]->GetBinContent(4); \r
- // corrected cumulants:\r
- Double_t qc2Corrected = qc2 + qc2Correction;\r
- Double_t qc4Corrected = qc4 + qc4Correction;\r
- Double_t qc6Corrected = qc6 + qc6Correction;\r
- Double_t qc8Corrected = qc8 + qc8Correction;\r
-  \r
- // ... to be improved (I need here also to correct error of QCs for NUA. \r
- // For simplicity sake I assume at the moment that this correction is negliglible, but it will be added eventually...)\r
\r
- // store corrected results and statistical errors for cumulants:   \r
- fCumulants[pW][eW][1]->SetBinContent(1,qc2Corrected);\r
- fCumulants[pW][eW][1]->SetBinContent(2,qc4Corrected);\r
- fCumulants[pW][eW][1]->SetBinContent(3,qc6Corrected);\r
- fCumulants[pW][eW][1]->SetBinContent(4,qc8Corrected);\r
- fCumulants[pW][eW][1]->SetBinError(1,qc2Error); // to be improved (correct also qc2Error for NUA)\r
- fCumulants[pW][eW][1]->SetBinError(2,qc4Error); // to be improved (correct also qc4Error for NUA)\r
- fCumulants[pW][eW][1]->SetBinError(3,qc6Error); // to be improved (correct also qc6Error for NUA)\r
- fCumulants[pW][eW][1]->SetBinError(4,qc8Error); // to be improved (correct also qc8Error for NUA)  \r
-  \r
-} // end of AliFlowAnalysisWithQCumulants::ApplyCorrectionForNonUniformAcceptanceToCumulantsForIntFlow(Bool_t useParticleWeights, TString eventWeights)\r
-*/\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-/*  \r
-void AliFlowAnalysisWithQCumulants::PrintQuantifyingCorrectionsForNonUniformAcceptance(Bool_t useParticleWeights, TString eventWeights)\r
-{\r
- // print on the screen QC{n,biased}/QC{n,corrected}\r
\r
- // shortcuts for the flags:\r
- Int_t pW = (Int_t)(useParticleWeights); // 0=pWeights not used, 1=pWeights used\r
\r
- Int_t eW = -1;\r
\r
- if(eventWeights == "exact")\r
- {\r
-  eW = 0;\r
- } \r
\r
- if(!(fCumulants[pW][eW][0] && fCumulants[pW][eW][1]))\r
- {\r
-  cout<<"WARNING: fCumulants[pW][eW][0] && fCumulants[pW][eW][1] is NULL in AFAWQC::PQCFNUA() !!!!"<<endl;\r
-  cout<<"pW = "<<pW<<endl;\r
-  cout<<"eW = "<<eW<<endl;\r
-  exit(0);\r
- }\r
-   \r
- cout<<endl;\r
- cout<<" Quantifying the bias to Q-cumulants from"<<endl;\r
- cout<<"  non-uniform acceptance of the detector:"<<endl;\r
- cout<<endl;\r
-  \r
- if(fCumulants[pW][eW][1]->GetBinContent(1)) \r
- { \r
-  cout<<"  QC{2,biased}/QC{2,corrected} = "<<(fCumulants[pW][eW][0]->GetBinContent(1))/(fCumulants[pW][eW][1]->GetBinContent(1))<<endl;   \r
- }\r
- if(fCumulants[pW][eW][1]->GetBinContent(2)) \r
- { \r
-  cout<<"  QC{4,biased}/QC{4,corrected} = "<<fCumulants[pW][eW][0]->GetBinContent(2)/fCumulants[pW][eW][1]->GetBinContent(2)<<endl;   \r
- }\r
\r
- cout<<endl;\r
-            \r
-} // end of AliFlowAnalysisWithQCumulants::PrintQuantifyingCorrectionsForNonUniformAcceptance(Bool_t useParticleWeights, TString eventWeights)\r
-*/\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelationsUsingParticleWeights()\r
-{\r
- // Calculate all correlations needed for integrated flow using particle weights.\r
+ // correction terms for non-uniform acceptance:
+ TString diffFlowDirectCorrectionTermsForNUAName = "fDiffFlowDirectCorrectionTermsForNUA";
+ diffFlowDirectCorrectionTermsForNUAName += fAnalysisLabel->Data();
+ for(Int_t t=0;t<2;t++) // typeFlag (0 = RP, 1 = POI)
+ { 
+  for(Int_t pe=0;pe<2;pe++) // pt or eta
+  {
+   for(Int_t sc=0;sc<2;sc++) // sin or cos
+   {
+    for(Int_t cti=0;cti<9;cti++) // correction term index
+    {
+     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"); 
+     fNestedLoopsList->Add(fDiffFlowDirectCorrectionTermsForNUA[t][pe][sc][cti]);
+    }
+   }
+  }
+ } 
+
+} // end of AliFlowAnalysisWithQCumulants::BookEverythingForNestedLoops()
+
+
+//================================================================================================================================
+
+
+void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelations()
+{
+ // calculate all correlations needed for integrated flow
+ // multiplicity:
+ Double_t dMult = (*fSMpk)(0,0);
+ // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
+ Double_t dReQ1n = (*fReQ)(0,0);
+ Double_t dReQ2n = (*fReQ)(1,0);
+ Double_t dReQ3n = (*fReQ)(2,0);
+ Double_t dReQ4n = (*fReQ)(3,0);
+ Double_t dImQ1n = (*fImQ)(0,0);
+ Double_t dImQ2n = (*fImQ)(1,0);
+ Double_t dImQ3n = (*fImQ)(2,0);
+ Double_t dImQ4n = (*fImQ)(3,0);
+  
+ // real and imaginary parts of some expressions involving various combinations of Q-vectors evaluated in harmonics n, 2n, 3n and 4n:
+ // (these expression appear in the Eqs. for the multi-particle correlations bellow)
+ // Re[Q_{2n} Q_{n}^* Q_{n}^*]
+ Double_t reQ2nQ1nstarQ1nstar = pow(dReQ1n,2.)*dReQ2n + 2.*dReQ1n*dImQ1n*dImQ2n - pow(dImQ1n,2.)*dReQ2n; 
+ // Im[Q_{2n} Q_{n}^* Q_{n}^*]
+ //Double_t imQ2nQ1nstarQ1nstar = pow(dReQ1n,2.)*dImQ2n-2.*dReQ1n*dImQ1n*dReQ2n-pow(dImQ1n,2.)*dImQ2n; 
+ // Re[Q_{n} Q_{n} Q_{2n}^*] = Re[Q_{2n} Q_{n}^* Q_{n}^*]
+ Double_t reQ1nQ1nQ2nstar = reQ2nQ1nstarQ1nstar; 
+ // Re[Q_{3n} Q_{n} Q_{2n}^* Q_{2n}^*]
+ Double_t reQ3nQ1nQ2nstarQ2nstar = (pow(dReQ2n,2.)-pow(dImQ2n,2.))*(dReQ3n*dReQ1n-dImQ3n*dImQ1n) 
+                                 + 2.*dReQ2n*dImQ2n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);
+
+ // Im[Q_{3n} Q_{n} Q_{2n}^* Q_{2n}^*]                                                                  
+ //Double_t imQ3nQ1nQ2nstarQ2nstar = calculate and implement this (deleteMe)
+  
+ // Re[Q_{2n} Q_{2n} Q_{3n}^* Q_{1n}^*] = Re[Q_{3n} Q_{n} Q_{2n}^* Q_{2n}^*]
+ Double_t reQ2nQ2nQ3nstarQ1nstar = reQ3nQ1nQ2nstarQ2nstar;
+  
+ // Re[Q_{4n} Q_{2n}^* Q_{2n}^*]
+ Double_t reQ4nQ2nstarQ2nstar = pow(dReQ2n,2.)*dReQ4n+2.*dReQ2n*dImQ2n*dImQ4n-pow(dImQ2n,2.)*dReQ4n;
+
+ // Im[Q_{4n} Q_{2n}^* Q_{2n}^*]
+ //Double_t imQ4nQ2nstarQ2nstar = calculate and implement this (deleteMe)
+ // Re[Q_{2n} Q_{2n} Q_{4n}^*] =  Re[Q_{4n} Q_{2n}^* Q_{2n}^*]
+ Double_t reQ2nQ2nQ4nstar = reQ4nQ2nstarQ2nstar;
+ // Re[Q_{4n} Q_{3n}^* Q_{n}^*]
+ Double_t reQ4nQ3nstarQ1nstar = dReQ4n*(dReQ3n*dReQ1n-dImQ3n*dImQ1n)+dImQ4n*(dReQ3n*dImQ1n+dImQ3n*dReQ1n);
+ // Re[Q_{3n} Q_{n} Q_{4n}^*] = Re[Q_{4n} Q_{3n}^* Q_{n}^*]
+ Double_t reQ3nQ1nQ4nstar = reQ4nQ3nstarQ1nstar;
+ // Im[Q_{4n} Q_{3n}^* Q_{n}^*]
+ //Double_t imQ4nQ3nstarQ1nstar = calculate and implement this (deleteMe)
+
+ // Re[Q_{3n} Q_{2n}^* Q_{n}^*]
+ Double_t reQ3nQ2nstarQ1nstar = dReQ3n*dReQ2n*dReQ1n-dReQ3n*dImQ2n*dImQ1n+dImQ3n*dReQ2n*dImQ1n
+                              + dImQ3n*dImQ2n*dReQ1n;
+                              
+ // Re[Q_{2n} Q_{n} Q_{3n}^*] = Re[Q_{3n} Q_{2n}^* Q_{n}^*]
+ Double_t reQ2nQ1nQ3nstar = reQ3nQ2nstarQ1nstar;
+ // Im[Q_{3n} Q_{2n}^* Q_{n}^*]
+ //Double_t imQ3nQ2nstarQ1nstar; //calculate and implement this (deleteMe)
+ // Re[Q_{3n} Q_{n}^* Q_{n}^* Q_{n}^*]
+ Double_t reQ3nQ1nstarQ1nstarQ1nstar = dReQ3n*pow(dReQ1n,3)-3.*dReQ1n*dReQ3n*pow(dImQ1n,2)
+                                     + 3.*dImQ1n*dImQ3n*pow(dReQ1n,2)-dImQ3n*pow(dImQ1n,3);
+
+ // Im[Q_{3n} Q_{n}^* Q_{n}^* Q_{n}^*]
+ //Double_t imQ3nQ1nstarQ1nstarQ1nstar; //calculate and implement this (deleteMe)
+ // |Q_{2n}|^2 |Q_{n}|^2
+ Double_t dQ2nQ1nQ2nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.));
+ // Re[Q_{4n} Q_{2n}^* Q_{n}^* Q_{n}^*]
+ Double_t reQ4nQ2nstarQ1nstarQ1nstar = (dReQ4n*dReQ2n+dImQ4n*dImQ2n)*(pow(dReQ1n,2)-pow(dImQ1n,2))
+                                     + 2.*dReQ1n*dImQ1n*(dImQ4n*dReQ2n-dReQ4n*dImQ2n); 
+ // Im[Q_{4n} Q_{2n}^* Q_{n}^* Q_{n}^*]
+ //Double_t imQ4nQ2nstarQ1nstarQ1nstar; //calculate and implement this (deleteMe)
+ // Re[Q_{2n} Q_{n} Q_{n}^* Q_{n}^* Q_{n}^*]
+ Double_t reQ2nQ1nQ1nstarQ1nstarQ1nstar = (dReQ2n*dReQ1n-dImQ2n*dImQ1n)*(pow(dReQ1n,3)-3.*dReQ1n*pow(dImQ1n,2))
+                                        + (dReQ2n*dImQ1n+dReQ1n*dImQ2n)*(3.*dImQ1n*pow(dReQ1n,2)-pow(dImQ1n,3));
+
+ // Im[Q_{2n} Q_{n} Q_{n}^* Q_{n}^* Q_{n}^*] 
+ //Double_t imQ2nQ1nQ1nstarQ1nstarQ1nstar; //calculate and implement this (deleteMe)
+ // Re[Q_{2n} Q_{2n} Q_{2n}^* Q_{n}^* Q_{n}^*]
+ Double_t reQ2nQ2nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
+                                        * (dReQ2n*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) + 2.*dImQ2n*dReQ1n*dImQ1n);
+
+ // Im[Q_{2n} Q_{2n} Q_{2n}^* Q_{n}^* Q_{n}^*]
+ //Double_t imQ2nQ2nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))
+ //                                       * (dImQ2n*(pow(dReQ1n,2.)-pow(dImQ1n,2.)) - 2.*dReQ2n*dReQ1n*dImQ1n);
+ // Re[Q_{4n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]
+ Double_t reQ4nQ1nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,4.)*dReQ4n-6.*pow(dReQ1n,2.)*dReQ4n*pow(dImQ1n,2.)
+                                            + pow(dImQ1n,4.)*dReQ4n+4.*pow(dReQ1n,3.)*dImQ1n*dImQ4n
+                                            - 4.*pow(dImQ1n,3.)*dReQ1n*dImQ4n;
+                                            
+ // Im[Q_{4n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]
+ //Double_t imQ4nQ1nstarQ1nstarQ1nstarQ1nstar = pow(dReQ1n,4.)*dImQ4n-6.*pow(dReQ1n,2.)*dImQ4n*pow(dImQ1n,2.)
+ //                                           + pow(dImQ1n,4.)*dImQ4n+4.*pow(dImQ1n,3.)*dReQ1n*dReQ4n
+ //                                           - 4.*pow(dReQ1n,3.)*dImQ1n*dReQ4n;
+ // Re[Q_{3n} Q_{n} Q_{2n}^* Q_{n}^* Q_{n}^*]
+ Double_t reQ3nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
+                                        * (dReQ1n*dReQ2n*dReQ3n-dReQ3n*dImQ1n*dImQ2n+dReQ2n*dImQ1n*dImQ3n+dReQ1n*dImQ2n*dImQ3n);
+ // Im[Q_{3n} Q_{n} Q_{2n}^* Q_{n}^* Q_{n}^*]
+ //Double_t imQ3nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
+ //                                       * (-dReQ2n*dReQ3n*dImQ1n-dReQ1n*dReQ3n*dImQ2n+dReQ1n*dReQ2n*dImQ3n-dImQ1n*dImQ2n*dImQ3n);
+ // Re[Q_{2n} Q_{2n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]
+ Double_t reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)*dReQ2n-2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)
+                                               + dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n-pow(dImQ1n,2.)*dImQ2n)
+                                               * (pow(dReQ1n,2.)*dReQ2n+2.*dReQ1n*dReQ2n*dImQ1n-dReQ2n*pow(dImQ1n,2.)
+                                               - dImQ2n*pow(dReQ1n,2.)+2.*dReQ1n*dImQ1n*dImQ2n+pow(dImQ1n,2.)*dImQ2n);
+ // Im[Q_{2n} Q_{2n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]
+ //Double_t imQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar = 2.*(pow(dReQ1n,2.)*dReQ2n-dReQ2n*pow(dImQ1n,2.)
+ //                                              + 2.*dReQ1n*dImQ1n*dImQ2n)*(pow(dReQ1n,2.)*dImQ2n
+ //                                              - 2.*dReQ1n*dImQ1n*dReQ2n-pow(dImQ1n,2.)*dImQ2n);
+ // Re[Q_{3n} Q_{n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]
+ Double_t reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
+                                               * (pow(dReQ1n,3.)*dReQ3n-3.*dReQ1n*dReQ3n*pow(dImQ1n,2.)
+                                               + 3.*pow(dReQ1n,2.)*dImQ1n*dImQ3n-pow(dImQ1n,3.)*dImQ3n);
+  
+ // Im[Q_{3n} Q_{n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]                                                                                           
+ //Double_t imQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = (pow(dReQ1n,2.)+pow(dImQ1n,2.))
+ //                                              * (pow(dImQ1n,3.)*dReQ3n-3.*dImQ1n*dReQ3n*pow(dReQ1n,2.)
+ //                                              - 3.*pow(dImQ1n,2.)*dReQ1n*dImQ3n+pow(dReQ1n,3.)*dImQ3n);
+ // |Q_{2n}|^2 |Q_{n}|^4
+ Double_t dQ2nQ1nQ1nQ2nstarQ1nstarQ1nstar = (pow(dReQ2n,2.)+pow(dImQ2n,2.))*pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.);
+ // Re[Q_{2n} Q_{n} Q_{n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]
+ Double_t reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
+                                                  * (pow(dReQ1n,2.)*dReQ2n-dReQ2n*pow(dImQ1n,2.)
+                                                  + 2.*dReQ1n*dImQ1n*dImQ2n);
+                                                  
+ // Im[Q_{2n} Q_{n} Q_{n} Q_{n}^* Q_{n}^* Q_{n}^* Q_{n}^*]                                                  
+ //Double_t imQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar = pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
+ //                                                 * (pow(dReQ1n,2.)*dImQ2n-dImQ2n*pow(dImQ1n,2.)
+ //                                                 - 2.*dReQ1n*dReQ2n*dImQ1n);
+  
+       
+ //                                        **************************************
+ //                                        **** multi-particle correlations: ****
+ //                                        **************************************
+ //
+ // Remark 1: multi-particle correlations calculated with non-weighted Q-vectors are stored in 1D profile fQCorrelations[0]. // to be improved (wrong profiles)
+ // Remark 2: binning of fQCorrelations[0] is organized as follows: // to be improved (wrong profiles)
+ // --------------------------------------------------------------------------------------------------------------------
+ //  1st bin: <2>_{1n|1n} = two1n1n = cos(n*(phi1-phi2))>
+ //  2nd bin: <2>_{2n|2n} = two2n2n = cos(2n*(phi1-phi2))>
+ //  3rd bin: <2>_{3n|3n} = two3n3n = cos(3n*(phi1-phi2))> 
+ //  4th bin: <2>_{4n|4n} = two4n4n = cos(4n*(phi1-phi2))>
+ //  5th bin:           ----  EMPTY ----
+ //  6th bin: <3>_{2n|1n,1n} = three2n1n1n = <cos(n*(2.*phi1-phi2-phi3))>
+ //  7th bin: <3>_{3n|2n,1n} = three3n2n1n = <cos(n*(3.*phi1-2.*phi2-phi3))>
+ //  8th bin: <3>_{4n|2n,2n} = three4n2n2n = <cos(n*(4.*phi1-2.*phi2-2.*phi3))>
+ //  9th bin: <3>_{4n|3n,1n} = three4n3n1n = <cos(n*(4.*phi1-3.*phi2-phi3))>
+ // 10th bin:           ----  EMPTY ----
+ // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1n = <cos(n*(phi1+phi2-phi3-phi4))>
+ // 12th bin: <4>_{2n,1n|2n,1n} = four2n1n2n1n = <cos(2.*n*(phi1+phi2-phi3-phi4))>
+ // 13th bin: <4>_{2n,2n|2n,2n} = four2n2n2n2n = <cos(n*(2.*phi1+phi2-2.*phi3-phi4))>
+ // 14th bin: <4>_{3n|1n,1n,1n} = four3n1n1n1n = <cos(n*(3.*phi1-phi2-phi3-phi4))> 
+ // 15th bin: <4>_{3n,1n|3n,1n} = four3n1n3n1n = <cos(n*(4.*phi1-2.*phi2-phi3-phi4))>
+ // 16th bin: <4>_{3n,1n|2n,2n} = four3n1n2n2n = <cos(n*(3.*phi1+phi2-2.*phi3-2.*phi4))>
+ // 17th bin: <4>_{4n|2n,1n,1n} = four4n2n1n1n = <cos(n*(3.*phi1+phi2-3.*phi3-phi4))> 
+ // 18th bin:           ----  EMPTY ----
+ // 19th bin: <5>_{2n|1n,1n,1n,1n} = five2n1n1n1n1n = <cos(n*(2.*phi1+phi2-phi3-phi4-phi5))>
+ // 20th bin: <5>_{2n,2n|2n,1n,1n} = five2n2n2n1n1n = <cos(n*(2.*phi1+2.*phi2-2.*phi3-phi4-phi5))>
+ // 21st bin: <5>_{3n,1n|2n,1n,1n} = five3n1n2n1n1n = <cos(n*(3.*phi1+phi2-2.*phi3-phi4-phi5))>
+ // 22nd bin: <5>_{4n|1n,1n,1n,1n} = five4n1n1n1n1n = <cos(n*(4.*phi1-phi2-phi3-phi4-phi5))>
+ // 23rd bin:           ----  EMPTY ----
+ // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = six1n1n1n1n1n1n = <cos(n*(phi1+phi2+phi3-phi4-phi5-phi6))>
+ // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = six2n1n1n2n1n1n = <cos(n*(2.*phi1+2.*phi2-phi3-phi4-phi5-phi6))>
+ // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = six2n2n1n1n1n1n = <cos(n*(3.*phi1+phi2-phi3-phi4-phi5-phi6))>
+ // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = six3n1n1n1n1n1n = <cos(n*(2.*phi1+phi2+phi3-2.*phi4-phi5-phi6))>
+ // 28th bin:           ----  EMPTY ----
+ // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = seven2n1n1n1n1n1n1n =  <cos(n*(2.*phi1+phi2+phi3-phi4-phi5-phi6-phi7))>
+ // 30th bin:           ----  EMPTY ----
+ // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = eight1n1n1n1n1n1n1n1n = <cos(n*(phi1+phi2+phi3+phi4-phi5-phi6-phi7-phi8))>
+ // --------------------------------------------------------------------------------------------------------------------
+    
+ // 2-particle:
+ Double_t two1n1n = 0.; // <cos(n*(phi1-phi2))>
+ Double_t two2n2n = 0.; // <cos(2n*(phi1-phi2))>
+ Double_t two3n3n = 0.; // <cos(3n*(phi1-phi2))>
+ Double_t two4n4n = 0.; // <cos(4n*(phi1-phi2))>
+ if(dMult>1)
+ {
+  two1n1n = (pow(dReQ1n,2.)+pow(dImQ1n,2.)-dMult)/(dMult*(dMult-1.)); 
+  two2n2n = (pow(dReQ2n,2.)+pow(dImQ2n,2.)-dMult)/(dMult*(dMult-1.)); 
+  two3n3n = (pow(dReQ3n,2.)+pow(dImQ3n,2.)-dMult)/(dMult*(dMult-1.)); 
+  two4n4n = (pow(dReQ4n,2.)+pow(dImQ4n,2.)-dMult)/(dMult*(dMult-1.)); 
+  
+  // average 2-particle correlations for single event: 
+  fIntFlowCorrelationsAllEBE->SetBinContent(1,two1n1n);
+  fIntFlowCorrelationsAllEBE->SetBinContent(2,two2n2n);
+  fIntFlowCorrelationsAllEBE->SetBinContent(3,two3n3n);
+  fIntFlowCorrelationsAllEBE->SetBinContent(4,two4n4n);
+          
+  // average 2-particle correlations for all events:      
+  fIntFlowCorrelationsAllPro->Fill(0.5,two1n1n,dMult*(dMult-1.));  
+  fIntFlowCorrelationsAllPro->Fill(1.5,two2n2n,dMult*(dMult-1.)); 
+  fIntFlowCorrelationsAllPro->Fill(2.5,two3n3n,dMult*(dMult-1.)); 
+  fIntFlowCorrelationsAllPro->Fill(3.5,two4n4n,dMult*(dMult-1.)); 
+  
+  // store separetately <2> (to be improved: do I really need this?)
+  fIntFlowCorrelationsEBE->SetBinContent(1,two1n1n); // <2>
+  fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(1,dMult*(dMult-1.)); // eW_<2>
+  fIntFlowCorrelationsPro->Fill(0.5,two1n1n,dMult*(dMult-1.));
+  
+  // distribution of <cos(n*(phi1-phi2))>:
+  //f2pDistribution->Fill(two1n1n,dMult*(dMult-1.)); 
+ } // end of if(dMult>1)
+ // 3-particle:
+ Double_t three2n1n1n = 0.; // <cos(n*(2.*phi1-phi2-phi3))>
+ Double_t three3n2n1n = 0.; // <cos(n*(3.*phi1-2.*phi2-phi3))>
+ Double_t three4n2n2n = 0.; // <cos(n*(4.*phi1-2.*phi2-2.*phi3))>
+ Double_t three4n3n1n = 0.; // <cos(n*(4.*phi1-3.*phi2-phi3))>
+ if(dMult>2)
+ {
+  three2n1n1n = (reQ2nQ1nstarQ1nstar-2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
+              - (pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)
+              / (dMult*(dMult-1.)*(dMult-2.));              
+  three3n2n1n = (reQ3nQ2nstarQ1nstar-(pow(dReQ3n,2.)+pow(dImQ3n,2.))
+              - (pow(dReQ2n,2.)+pow(dImQ2n,2.))
+              - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
+              / (dMult*(dMult-1.)*(dMult-2.));
+  three4n2n2n = (reQ4nQ2nstarQ2nstar-2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
+              - (pow(dReQ4n,2.)+pow(dImQ4n,2.))+2.*dMult)
+              / (dMult*(dMult-1.)*(dMult-2.)); 
+  three4n3n1n = (reQ4nQ3nstarQ1nstar-(pow(dReQ4n,2.)+pow(dImQ4n,2.))
+              - (pow(dReQ3n,2.)+pow(dImQ3n,2.))
+              - (pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult)
+              / (dMult*(dMult-1.)*(dMult-2.)); 
+              
+  // average 3-particle correlations for single event: 
+  fIntFlowCorrelationsAllEBE->SetBinContent(6,three2n1n1n);
+  fIntFlowCorrelationsAllEBE->SetBinContent(7,three3n2n1n);
+  fIntFlowCorrelationsAllEBE->SetBinContent(8,three4n2n2n);
+  fIntFlowCorrelationsAllEBE->SetBinContent(9,three4n3n1n);
+        
+  // average 3-particle correlations for all events:                
+  fIntFlowCorrelationsAllPro->Fill(5.5,three2n1n1n,dMult*(dMult-1.)*(dMult-2.)); 
+  fIntFlowCorrelationsAllPro->Fill(6.5,three3n2n1n,dMult*(dMult-1.)*(dMult-2.));
+  fIntFlowCorrelationsAllPro->Fill(7.5,three4n2n2n,dMult*(dMult-1.)*(dMult-2.)); 
+  fIntFlowCorrelationsAllPro->Fill(8.5,three4n3n1n,dMult*(dMult-1.)*(dMult-2.));    
+ } // end of if(dMult>2)
+ // 4-particle:
+ Double_t four1n1n1n1n = 0.; // <cos(n*(phi1+phi2-phi3-phi4))>
+ Double_t four2n2n2n2n = 0.; // <cos(2.*n*(phi1+phi2-phi3-phi4))>
+ Double_t four2n1n2n1n = 0.; // <cos(n*(2.*phi1+phi2-2.*phi3-phi4))> 
+ Double_t four3n1n1n1n = 0.; // <cos(n*(3.*phi1-phi2-phi3-phi4))> 
+ Double_t four4n2n1n1n = 0.; // <cos(n*(4.*phi1-2.*phi2-phi3-phi4))> 
+ Double_t four3n1n2n2n = 0.; // <cos(n*(3.*phi1+phi2-2.*phi3-2.*phi4))> 
+ Double_t four3n1n3n1n = 0.; // <cos(n*(3.*phi1+phi2-3.*phi3-phi4))>   
+ if(dMult>3)
+ {
+  four1n1n1n1n = (2.*dMult*(dMult-3.)+pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ1n,2.)
+               + pow(dImQ1n,2.))-2.*reQ2nQ1nstarQ1nstar+(pow(dReQ2n,2.)+pow(dImQ2n,2.)))
+               / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));     
+  four2n2n2n2n = (2.*dMult*(dMult-3.)+pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)-4.*(dMult-2.)*(pow(dReQ2n,2.)
+               + pow(dImQ2n,2.))-2.*reQ4nQ2nstarQ2nstar+(pow(dReQ4n,2.)+pow(dImQ4n,2.)))
+               / (dMult*(dMult-1)*(dMult-2.)*(dMult-3.));
+  four2n1n2n1n = (dQ2nQ1nQ2nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar-2.*reQ2nQ1nstarQ1nstar)
+               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
+               - ((dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
+               + (dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-(pow(dReQ3n,2.)+pow(dImQ3n,2.)))
+               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
+               + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));
+  four3n1n1n1n = (reQ3nQ1nstarQ1nstarQ1nstar-3.*reQ3nQ2nstarQ1nstar-3.*reQ2nQ1nstarQ1nstar)
+               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
+               + (2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
+               + 6.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-6.*dMult)
+               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
+  four4n2n1n1n = (reQ4nQ2nstarQ1nstarQ1nstar-2.*reQ4nQ3nstarQ1nstar-reQ4nQ2nstarQ2nstar-2.*reQ3nQ2nstarQ1nstar)
+               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
+               - (reQ2nQ1nstarQ1nstar-2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
+               - 3.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
+               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
+               - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));
+  four3n1n2n2n = (reQ3nQ1nQ2nstarQ2nstar-reQ4nQ2nstarQ2nstar-reQ3nQ1nQ4nstar-2.*reQ3nQ2nstarQ1nstar)
+               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
+               - (2.*reQ1nQ1nQ2nstar-(pow(dReQ4n,2.)+pow(dImQ4n,2.))-2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
+               - 4.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))-4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
+               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
+               - 6./((dMult-1.)*(dMult-2.)*(dMult-3.)); 
+  four3n1n3n1n = ((pow(dReQ3n,2.)+pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
+               - 2.*reQ4nQ3nstarQ1nstar-2.*reQ3nQ2nstarQ1nstar)
+               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
+               + ((pow(dReQ4n,2.)+pow(dImQ4n,2.))-(dMult-4.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
+               + (pow(dReQ2n,2.)+pow(dImQ2n,2.))-(dMult-4.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
+               / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.))
+               + (dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.));
+               
+  // average 4-particle correlations for single event: 
+  fIntFlowCorrelationsAllEBE->SetBinContent(11,four1n1n1n1n);
+  fIntFlowCorrelationsAllEBE->SetBinContent(12,four2n1n2n1n);
+  fIntFlowCorrelationsAllEBE->SetBinContent(13,four2n2n2n2n);
+  fIntFlowCorrelationsAllEBE->SetBinContent(14,four3n1n1n1n);
+  fIntFlowCorrelationsAllEBE->SetBinContent(15,four3n1n3n1n);
+  fIntFlowCorrelationsAllEBE->SetBinContent(16,four3n1n2n2n);
+  fIntFlowCorrelationsAllEBE->SetBinContent(17,four4n2n1n1n);
+        
+  // average 4-particle correlations for all events:                
+  fIntFlowCorrelationsAllPro->Fill(10.5,four1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
+  fIntFlowCorrelationsAllPro->Fill(11.5,four2n1n2n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
+  fIntFlowCorrelationsAllPro->Fill(12.5,four2n2n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
+  fIntFlowCorrelationsAllPro->Fill(13.5,four3n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
+  fIntFlowCorrelationsAllPro->Fill(14.5,four3n1n3n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
+  fIntFlowCorrelationsAllPro->Fill(15.5,four3n1n2n2n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));  
+  fIntFlowCorrelationsAllPro->Fill(16.5,four4n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); 
+  
+  // store separetately <4> (to be improved: do I really need this?)
+  fIntFlowCorrelationsEBE->SetBinContent(2,four1n1n1n1n); // <4>
+  fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(2,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)); // eW_<4>
+  fIntFlowCorrelationsPro->Fill(1.5,four1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
+  
+  // distribution of <cos(n*(phi1+phi2-phi3-phi4))>
+  //f4pDistribution->Fill(four1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.));
+  
+ } // end of if(dMult>3)
+
+ // 5-particle:
+ Double_t five2n1n1n1n1n = 0.; // <cos(n*(2.*phi1+phi2-phi3-phi4-phi5))>
+ Double_t five2n2n2n1n1n = 0.; // <cos(n*(2.*phi1+2.*phi2-2.*phi3-phi4-phi5))>
+ Double_t five3n1n2n1n1n = 0.; // <cos(n*(3.*phi1+phi2-2.*phi3-phi4-phi5))>
+ Double_t five4n1n1n1n1n = 0.; // <cos(n*(4.*phi1-phi2-phi3-phi4-phi5))>
+ if(dMult>4)
+ {
+  five2n1n1n1n1n = (reQ2nQ1nQ1nstarQ1nstarQ1nstar-reQ3nQ1nstarQ1nstarQ1nstar+6.*reQ3nQ2nstarQ1nstar)
+                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))
+                 - (reQ2nQ1nQ3nstar+3.*(dMult-6.)*reQ2nQ1nstarQ1nstar+3.*reQ1nQ1nQ2nstar)
+                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))
+                 - (2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
+                 + 3.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))     
+                 - 3.*(dMult-4.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.)))
+                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))
+                 - 3.*(pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
+                 - 2.*(2*dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+2.*dMult*(dMult-4.))
+                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
+                 
+  five2n2n2n1n1n = (reQ2nQ2nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-2.*reQ2nQ2nQ3nstarQ1nstar)
+                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))
+                 + 2.*(reQ4nQ2nstarQ2nstar+4.*reQ3nQ2nstarQ1nstar+reQ3nQ1nQ4nstar)
+                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))
+                 + (reQ2nQ2nQ4nstar-2.*(dMult-5.)*reQ2nQ1nstarQ1nstar+2.*reQ1nQ1nQ2nstar)
+                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))
+                 - (2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+4.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
+                 + 1.*pow((pow(dReQ2n,2.)+pow(dImQ2n,2.)),2.)
+                 - 2.*(3.*dMult-10.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.)))
+                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))
+                 - (4.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
+                 - 4.*(dMult-5.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.))+4.*dMult*(dMult-6.))
+                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
+
+  five4n1n1n1n1n = (reQ4nQ1nstarQ1nstarQ1nstarQ1nstar-6.*reQ4nQ2nstarQ1nstarQ1nstar-4.*reQ3nQ1nstarQ1nstarQ1nstar)
+                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))
+                 + (8.*reQ4nQ3nstarQ1nstar+3.*reQ4nQ2nstarQ2nstar+12.*reQ3nQ2nstarQ1nstar+12.*reQ2nQ1nstarQ1nstar)
+                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))
+                 - (6.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))+8.*(pow(dReQ3n,2.)+pow(dImQ3n,2.))
+                 + 12.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))+24.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))-24.*dMult)
+                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
+  
+  five3n1n2n1n1n = (reQ3nQ1nQ2nstarQ1nstarQ1nstar-reQ4nQ2nstarQ1nstarQ1nstar-reQ3nQ1nstarQ1nstarQ1nstar)
+                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))
+                 - (reQ3nQ1nQ2nstarQ2nstar-3.*reQ4nQ3nstarQ1nstar-reQ4nQ2nstarQ2nstar)
+                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))
+                 - ((2.*dMult-13.)*reQ3nQ2nstarQ1nstar-reQ3nQ1nQ4nstar-9.*reQ2nQ1nstarQ1nstar)
+                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))
+                 - (2.*reQ1nQ1nQ2nstar+2.*(pow(dReQ4n,2.)+pow(dImQ4n,2.))
+                 - 2.*(dMult-5.)*(pow(dReQ3n,2.)+pow(dImQ3n,2.))+2.*(pow(dReQ3n,2.)
+                 + pow(dImQ3n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
+                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))
+                 + (2.*(dMult-6.)*(pow(dReQ2n,2.)+pow(dImQ2n,2.))
+                 - 2.*(pow(dReQ2n,2.)+pow(dImQ2n,2.))*(pow(dReQ1n,2.)+pow(dImQ1n,2.))
+                 - pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)
+                 + 2.*(3.*dMult-11.)*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
+                 / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.))
+                 - 4.*(dMult-6.)/((dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
+                 
+  // average 5-particle correlations for single event: 
+  fIntFlowCorrelationsAllEBE->SetBinContent(19,five2n1n1n1n1n);
+  fIntFlowCorrelationsAllEBE->SetBinContent(20,five2n2n2n1n1n);
+  fIntFlowCorrelationsAllEBE->SetBinContent(21,five3n1n2n1n1n);
+  fIntFlowCorrelationsAllEBE->SetBinContent(22,five4n1n1n1n1n);
+        
+  // average 5-particle correlations for all events:                         
+  fIntFlowCorrelationsAllPro->Fill(18.5,five2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)); 
+  fIntFlowCorrelationsAllPro->Fill(19.5,five2n2n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
+  fIntFlowCorrelationsAllPro->Fill(20.5,five3n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
+  fIntFlowCorrelationsAllPro->Fill(21.5,five4n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.));
+ } // end of if(dMult>4)
+    
+ // 6-particle:
+ Double_t six1n1n1n1n1n1n = 0.; // <cos(n*(phi1+phi2+phi3-phi4-phi5-phi6))>
+ Double_t six2n2n1n1n1n1n = 0.; // <cos(n*(2.*phi1+2.*phi2-phi3-phi4-phi5-phi6))>
+ Double_t six3n1n1n1n1n1n = 0.; // <cos(n*(3.*phi1+phi2-phi3-phi4-phi5-phi6))>
+ Double_t six2n1n1n2n1n1n = 0.; // <cos(n*(2.*phi1+phi2+phi3-2.*phi4-phi5-phi6))>
+ if(dMult>5)
+ {
+  six1n1n1n1n1n1n = (pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),3.)+9.*dQ2nQ1nQ2nstarQ1nstar-6.*reQ2nQ1nQ1nstarQ1nstarQ1nstar)
+                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.))
+                  + 4.*(reQ3nQ1nstarQ1nstarQ1nstar-3.*reQ3nQ2nstarQ1nstar)
+                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.))
+                  + 2.*(9.*(dMult-4.)*reQ2nQ1nstarQ1nstar+2.*(pow(dReQ3n,2.)+pow(dImQ3n,2.)))
+                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.))
+                  - 9.*(pow((pow(dReQ1n,2.)+pow(dImQ1n,2.)),2.)+(pow(dReQ2n,2.)+pow(dImQ2n,2.)))
+                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-5.))
+                  + (18.*(pow(dReQ1n,2.)+pow(dImQ1n,2.)))
+                  / (dMult*(dMult-1)*(dMult-3)*(dMult-4))
+                  - 6./((dMult-1.)*(dMult-2.)*(dMult-3.));
+                  
+  six2n1n1n2n1n1n = (dQ2nQ1nQ1nQ2nstarQ1nstarQ1nstar-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)
+                  * (2.*five2n2n2n1n1n+4.*five2n1n1n1n1n+4.*five3n1n2n1n1n+4.*four2n1n2n1n+1.*four1n1n1n1n)
+                  - dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(4.*four1n1n1n1n+4.*two1n1n
+                  + 2.*three2n1n1n+2.*three2n1n1n+4.*four3n1n1n1n+8.*three2n1n1n+2.*four4n2n1n1n
+                  + 4.*four2n1n2n1n+2.*two2n2n+8.*four2n1n2n1n+4.*four3n1n3n1n+8.*three3n2n1n
+                  + 4.*four3n1n2n2n+4.*four1n1n1n1n+4.*four2n1n2n1n+1.*four2n2n2n2n)
+                  - dMult*(dMult-1.)*(dMult-2.)*(2.*three2n1n1n+8.*two1n1n+4.*two1n1n+2.
+                  + 4.*two1n1n+4.*three2n1n1n+2.*two2n2n+4.*three2n1n1n+8.*three3n2n1n
+                  + 8.*two2n2n+4.*three4n3n1n+4.*two3n3n+4.*three3n2n1n+4.*two1n1n
+                  + 8.*three2n1n1n+4.*two1n1n+4.*three3n2n1n+4.*three2n1n1n+2.*two2n2n
+                  + 4.*three3n2n1n+2.*three4n2n2n)-dMult*(dMult-1.)
+                  * (4.*two1n1n+4.+4.*two1n1n+2.*two2n2n+1.+4.*two1n1n+4.*two2n2n+4.*two3n3n
+                  + 1.+2.*two2n2n+1.*two4n4n)-dMult)
+                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); // to be improved (direct formula needed)
+  six2n2n1n1n1n1n = (reQ2nQ2nQ1nstarQ1nstarQ1nstarQ1nstar-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)
+                  * (five4n1n1n1n1n+8.*five2n1n1n1n1n+6.*five2n2n2n1n1n)-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
+                  * (4.*four3n1n1n1n+6.*four4n2n1n1n+12.*three2n1n1n+12.*four1n1n1n1n+24.*four2n1n2n1n
+                  + 4.*four3n1n2n2n+3.*four2n2n2n2n)-dMult*(dMult-1.)*(dMult-2.)*(6.*three2n1n1n+12.*three3n2n1n
+                  + 4.*three4n3n1n+3.*three4n2n2n+8.*three2n1n1n+24.*two1n1n+12.*two2n2n+12.*three2n1n1n+8.*three3n2n1n
+                  + 1.*three4n2n2n)-dMult*(dMult-1.)*(4.*two1n1n+6.*two2n2n+4.*two3n3n+1.*two4n4n+2.*two2n2n+8.*two1n1n+6.)-dMult)
+                  / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); // to be improved (direct formula needed)
+   
+  six3n1n1n1n1n1n = (reQ3nQ1nQ1nstarQ1nstarQ1nstarQ1nstar-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)
+                  * (five4n1n1n1n1n+4.*five2n1n1n1n1n+6.*five3n1n2n1n1n+4.*four3n1n1n1n)
+                  - dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(4.*four3n1n1n1n+6.*four4n2n1n1n+6.*four1n1n1n1n
+                  + 12.*three2n1n1n+12.*four2n1n2n1n+6.*four3n1n1n1n+12.*three3n2n1n+4.*four3n1n3n1n+3.*four3n1n2n2n)
+                  - dMult*(dMult-1.)*(dMult-2.)*(6.*three2n1n1n+12.*three3n2n1n+4.*three4n3n1n+3.*three4n2n2n+4.*two1n1n
+                  + 12.*two1n1n+6.*three2n1n1n+12.*three2n1n1n+4.*three3n2n1n+12.*two2n2n+4.*three3n2n1n+4.*two3n3n+1.*three4n3n1n
+                  + 6.*three3n2n1n)-dMult*(dMult-1.)*(4.*two1n1n+6.*two2n2n+4.*two3n3n+1.*two4n4n+1.*two1n1n+4.+6.*two1n1n+4.*two2n2n
+                  + 1.*two3n3n)-dMult)/(dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); // to be improved (direct formula needed)
+                                 
+  // average 6-particle correlations for single event: 
+  fIntFlowCorrelationsAllEBE->SetBinContent(24,six1n1n1n1n1n1n);
+  fIntFlowCorrelationsAllEBE->SetBinContent(25,six2n1n1n2n1n1n);
+  fIntFlowCorrelationsAllEBE->SetBinContent(26,six2n2n1n1n1n1n);
+  fIntFlowCorrelationsAllEBE->SetBinContent(27,six3n1n1n1n1n1n);
+        
+  // average 6-particle correlations for all events:         
+  fIntFlowCorrelationsAllPro->Fill(23.5,six1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
+  fIntFlowCorrelationsAllPro->Fill(24.5,six2n1n1n2n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
+  fIntFlowCorrelationsAllPro->Fill(25.5,six2n2n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
+  fIntFlowCorrelationsAllPro->Fill(26.5,six3n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
+
+  // store separetately <6> (to be improved: do I really need this?)
+  fIntFlowCorrelationsEBE->SetBinContent(3,six1n1n1n1n1n1n); // <6>
+  fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(3,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); // eW_<6>
+  fIntFlowCorrelationsPro->Fill(2.5,six1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.));
+  // distribution of <cos(n*(phi1+phi2+phi3-phi4-phi5-phi6))>
+  //f6pDistribution->Fill(six1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)); 
+ } // end of if(dMult>5)
+ // 7-particle:
+ Double_t seven2n1n1n1n1n1n1n = 0.; // <cos(n*(2.*phi1+phi2+phi3-phi4-phi5-phi6-phi7))>
+ if(dMult>6)
+ {
+  seven2n1n1n1n1n1n1n = (reQ2nQ1nQ1nQ1nstarQ1nstarQ1nstarQ1nstar-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)
+                      * (2.*six3n1n1n1n1n1n+4.*six1n1n1n1n1n1n+1.*six2n2n1n1n1n1n+6.*six2n1n1n2n1n1n+8.*five2n1n1n1n1n)
+                      - dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(1.*five4n1n1n1n1n +8.*five2n1n1n1n1n+8.*four3n1n1n1n
+                      + 12.*five3n1n2n1n1n+4.*five2n1n1n1n1n+3.*five2n2n2n1n1n+6.*five2n2n2n1n1n+6.*four1n1n1n1n+24.*four1n1n1n1n
+                      + 12.*five2n1n1n1n1n+12.*five2n1n1n1n1n+12.*three2n1n1n+24.*four2n1n2n1n+4.*five3n1n2n1n1n+4.*five2n1n1n1n1n)
+                      - dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(4.*four3n1n1n1n+6.*four4n2n1n1n+12.*four1n1n1n1n+24.*three2n1n1n
+                      + 24.*four2n1n2n1n+12.*four3n1n1n1n+24.*three3n2n1n+8.*four3n1n3n1n+6.*four3n1n2n2n+6.*three2n1n1n+12.*four1n1n1n1n
+                      + 12.*four2n1n2n1n+6.*three2n1n1n+12.*four2n1n2n1n+4.*four3n1n2n2n+3.*four2n2n2n2n+4.*four1n1n1n1n+6.*three2n1n1n
+                      + 24.*two1n1n+24.*four1n1n1n1n+4.*four3n1n1n1n+24.*two1n1n+24.*three2n1n1n+12.*two2n2n+24.*three2n1n1n+12.*four2n1n2n1n
+                      + 8.*three3n2n1n+8.*four2n1n2n1n+1.*four4n2n1n1n)-dMult*(dMult-1.)*(dMult-2.)*(6.*three2n1n1n+1.*three2n1n1n+8.*two1n1n
+                      + 12.*three3n2n1n+24.*two1n1n+12.*three2n1n1n+4.*three2n1n1n+8.*two1n1n+4.*three4n3n1n+24.*three2n1n1n+8.*three3n2n1n
+                      + 12.*two1n1n+12.*two1n1n+3.*three4n2n2n+24.*two2n2n+6.*two2n2n+12.+12.*three3n2n1n+8.*two3n3n+12.*three2n1n1n+24.*two1n1n
+                      + 4.*three3n2n1n+8.*three3n2n1n+2.*three4n3n1n+12.*two1n1n+8.*three2n1n1n+4.*three2n1n1n+2.*three3n2n1n+6.*two2n2n+8.*two2n2n
+                      + 1.*three4n2n2n+4.*three3n2n1n+6.*three2n1n1n)-dMult*(dMult-1.)*(4.*two1n1n+2.*two1n1n+6.*two2n2n+8.+1.*two2n2n+4.*two3n3n
+                      + 12.*two1n1n+4.*two1n1n+1.*two4n4n+8.*two2n2n+6.+2.*two3n3n+4.*two1n1n+1.*two2n2n)-dMult)
+                      / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)); // to be improved (direct formula needed)
+        
+  // average 7-particle correlations for single event: 
+  fIntFlowCorrelationsAllEBE->SetBinContent(29,seven2n1n1n1n1n1n1n);
+       
+  // average 7-particle correlations for all events:                      
+  fIntFlowCorrelationsAllPro->Fill(28.5,seven2n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.));
+ } // end of if(dMult>6)
+ // 8-particle:
+ Double_t eight1n1n1n1n1n1n1n1n = 0.; // <cos(n*(phi1+phi2+phi3+phi4-phi5-phi6-phi7-phi8))>
+ if(dMult>7)
+ {
+  eight1n1n1n1n1n1n1n1n = (pow(pow(dReQ1n,2.)+pow(dImQ1n,2.),4.)-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)
+                        * (12.*seven2n1n1n1n1n1n1n+16.*six1n1n1n1n1n1n)-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)
+                        * (8.*six3n1n1n1n1n1n+48.*six1n1n1n1n1n1n+6.*six2n2n1n1n1n1n+96.*five2n1n1n1n1n+72.*four1n1n1n1n+36.*six2n1n1n2n1n1n)
+                        - dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(2.*five4n1n1n1n1n+32.*five2n1n1n1n1n+36.*four1n1n1n1n
+                        + 32.*four3n1n1n1n+48.*five2n1n1n1n1n+48.*five3n1n2n1n1n+144.*five2n1n1n1n1n+288.*four1n1n1n1n+36.*five2n2n2n1n1n
+                        + 144.*three2n1n1n+96.*two1n1n+144.*four2n1n2n1n)-dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)
+                        * (8.*four3n1n1n1n+48.*four1n1n1n1n+12.*four4n2n1n1n+96.*four2n1n2n1n+96.*three2n1n1n+72.*three2n1n1n+144.*two1n1n
+                        + 16.*four3n1n3n1n+48.*four3n1n1n1n+144.*four1n1n1n1n+72.*four1n1n1n1n+96.*three3n2n1n+24.*four3n1n2n2n+144.*four2n1n2n1n
+                        + 288.*two1n1n+288.*three2n1n1n+9.*four2n2n2n2n+72.*two2n2n+24.)-dMult*(dMult-1.)*(dMult-2.)*(12.*three2n1n1n+16.*two1n1n
+                        + 24.*three3n2n1n+48.*three2n1n1n+96.*two1n1n+8.*three4n3n1n+32.*three3n2n1n+96.*three2n1n1n+144.*two1n1n+6.*three4n2n2n
+                        + 96.*two2n2n+36.*two2n2n+72.+48.*three3n2n1n+16.*two3n3n+72.*three2n1n1n+144.*two1n1n)-dMult*(dMult-1.)*(8.*two1n1n
+                        + 12.*two2n2n+16.+8.*two3n3n+48.*two1n1n+1.*two4n4n+16.*two2n2n+18.)-dMult)
+                        / (dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.)); // to be improved (direct formula needed)
+  
+  // average 8-particle correlations for single event: 
+  fIntFlowCorrelationsAllEBE->SetBinContent(31,eight1n1n1n1n1n1n1n1n);
+       
+  // average 8-particle correlations for all events:                       
+  fIntFlowCorrelationsAllPro->Fill(30.5,eight1n1n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));
+  // store separetately <8> (to be improved: do I really need this?)
+  fIntFlowCorrelationsEBE->SetBinContent(4,eight1n1n1n1n1n1n1n1n); // <8>
+  fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(4,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.)); // eW_<8>
+  fIntFlowCorrelationsPro->Fill(3.5,eight1n1n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));
+  
+  // distribution of <cos(n*(phi1+phi2+phi3+phi4-phi5-phi6-phi7-phi8))>
+  //f8pDistribution->Fill(eight1n1n1n1n1n1n1n1n,dMult*(dMult-1.)*(dMult-2.)*(dMult-3.)*(dMult-4.)*(dMult-5.)*(dMult-6.)*(dMult-7.));
+ } // end of if(dMult>7) 
+} // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelations()
+
+
+//================================================================================================================================
+
+
+void AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrelations()
+{
+ // Calculate averages of products of correlations for integrated flow  // to be improved (this method can be implemented better)
+ // a) Binning of fIntFlowProductOfCorrelationsPro is organized as follows:
+ //     1st bin: <<2><4>> 
+ //     2nd bin: <<2><6>>
+ //     3rd bin: <<2><8>>
+ //     4th bin: <<4><6>>
+ //     5th bin: <<4><8>>
+ //     6th bin: <<6><8>>
+
+ /*
+ Double_t dMult = (*fSMpk)(0,0); // multiplicity 
+
+ Double_t twoEBE = fIntFlowCorrelationsEBE->GetBinContent(1); // <2>
+ Double_t fourEBE = fIntFlowCorrelationsEBE->GetBinContent(2); // <4>
+ Double_t sixEBE = fIntFlowCorrelationsEBE->GetBinContent(3); // <6>
+ Double_t eightEBE = fIntFlowCorrelationsEBE->GetBinContent(4); // <8>
+ Double_t eW2 = 0.; // event weight for <2>
+ Double_t eW4 = 0.; // event weight for <4>
+ Double_t eW6 = 0.; // event weight for <6>
+ Double_t eW8 = 0.; // event weight for <8>
+ if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights))
+ {
+  eW2 = dMult*(dMult-1);
+  eW4 = dMult*(dMult-1)*(dMult-2)*(dMult-3);
+  eW6 = dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-4)*(dMult-5);
+  eW8 = dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-4)*(dMult-5)*(dMult-6)*(dMult-7);
+ } else 
+   {
+    eW2 = (*fSMpk)(1,1)-(*fSMpk)(0,2); // dM11 = sum_{i,j=1,i!=j}^M w_i w_j;
+    eW4 = (*fSMpk)(3,1)-6.*(*fSMpk)(0,2)*(*fSMpk)(1,1)  
+        + 8.*(*fSMpk)(0,3)*(*fSMpk)(0,1)
+        + 3.*(*fSMpk)(1,2)-6.*(*fSMpk)(0,4); // dM1111 = sum_{i,j,k,l=1,i!=j!=k!=l}^M w_i w_j w_k w_l
+   }
+  
+ fIntFlowProductOfCorrelationsPro->Fill(0.5,twoEBE*fourEBE,eW2*eW4); // <<2><4>> 
+ fIntFlowProductOfCorrelationsPro->Fill(1.5,twoEBE*sixEBE,eW2*eW6); // <<2><6>>
+ fIntFlowProductOfCorrelationsPro->Fill(2.5,twoEBE*eightEBE,eW2*eW8); // <<2><8>>
+ fIntFlowProductOfCorrelationsPro->Fill(3.5,fourEBE*sixEBE,eW4*eW6); // <<4><6>>
+ fIntFlowProductOfCorrelationsPro->Fill(4.5,fourEBE*eightEBE,eW4*eW8); // <<4><8>>
+ fIntFlowProductOfCorrelationsPro->Fill(5.5,sixEBE*eightEBE,eW6*eW8); // <<6><8>>
+ */
+ Int_t counter = 0;
+ for(Int_t ci1=1;ci1<4;ci1++)
+ {
+  for(Int_t ci2=ci1+1;ci2<=4;ci2++)
+  {
+   fIntFlowProductOfCorrelationsPro->Fill(0.5+counter++,
+                                          fIntFlowCorrelationsEBE->GetBinContent(ci1)*fIntFlowCorrelationsEBE->GetBinContent(ci2),
+                                          fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci1)*fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci2));
+  }
+ }
+} // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowProductOfCorrelations()
+
+
+//================================================================================================================================
+
+
+void AliFlowAnalysisWithQCumulants::CalculateCovariancesIntFlow()
+{
+ // a) Calculate unbiased estimators Cov(<2>,<4>), Cov(<2>,<6>), Cov(<2>,<8>), Cov(<4>,<6>), Cov(<4>,<8>) and Cov(<6>,<8>)
+ //    for covariances V_(<2>,<4>), V_(<2>,<6>), V_(<2>,<8>), V_(<4>,<6>), V_(<4>,<8>) and V_(<6>,<8>).
+ // b) Store in histogram fIntFlowCovariances for instance the following: 
+ //
+ //             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)]
+ // 
+ //    where N is the number of events, w_{<2>} is event weight for <2> and w_{<4>} is event weight for <4>.
+ // c) Binning of fIntFlowCovariances is organized as follows:
+ // 
+ //     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)] 
+ //     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)]
+ //     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)]
+ //     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)]
+ //     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)]
+ //     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)]
+    
+ for(Int_t power=0;power<2;power++)
+ { 
+  if(!(fIntFlowCorrelationsPro && fIntFlowProductOfCorrelationsPro 
+       && fIntFlowSumOfEventWeights[power] && fIntFlowSumOfProductOfEventWeights
+       && fIntFlowCovariances)) 
+  {
+   cout<<"WARNING: fIntFlowCorrelationsPro && fIntFlowProductOfCorrelationsPro "<<endl;
+   cout<<"         && fIntFlowSumOfEventWeights[power] && fIntFlowSumOfProductOfEventWeights"<<endl;
+   cout<<"         && fIntFlowCovariances is NULL in AFAWQC::FCIF() !!!!"<<endl;
+   cout<<"power = "<<power<<endl;
+   exit(0);
+  }
+ }
+   
+ // average 2-, 4-, 6- and 8-particle correlations for all events:
+ Double_t correlation[4] = {0.};
+ for(Int_t ci=0;ci<4;ci++)
+ {
+  correlation[ci] = fIntFlowCorrelationsPro->GetBinContent(ci+1);
+ } 
+ // average products of 2-, 4-, 6- and 8-particle correlations: 
+ Double_t productOfCorrelations[4][4] = {{0.}};
+ Int_t productOfCorrelationsLabel = 1;
+ // denominators in the expressions for the unbiased estimator for covariance:
+ Double_t denominator[4][4] = {{0.}};
+ Int_t sumOfProductOfEventWeightsLabel1 = 1;
+ // weight dependent prefactor which multiply unbiased estimators for covariances:
+ Double_t wPrefactor[4][4] = {{0.}}; 
+ Int_t sumOfProductOfEventWeightsLabel2 = 1;
+ for(Int_t c1=0;c1<4;c1++)
+ {
+  for(Int_t c2=c1+1;c2<4;c2++)
+  {
+   productOfCorrelations[c1][c2] = fIntFlowProductOfCorrelationsPro->GetBinContent(productOfCorrelationsLabel);
+   if(fIntFlowSumOfEventWeights[0]->GetBinContent(c1+1) && fIntFlowSumOfEventWeights[0]->GetBinContent(c2+1))
+   {
+    denominator[c1][c2] = 1.-(fIntFlowSumOfProductOfEventWeights->GetBinContent(sumOfProductOfEventWeightsLabel1))/
+                             (fIntFlowSumOfEventWeights[0]->GetBinContent(c1+1) 
+                              * fIntFlowSumOfEventWeights[0]->GetBinContent(c2+1));
+                              
+    wPrefactor[c1][c2] =  fIntFlowSumOfProductOfEventWeights->GetBinContent(sumOfProductOfEventWeightsLabel2)/ 
+                          (fIntFlowSumOfEventWeights[0]->GetBinContent(c1+1)
+                            * fIntFlowSumOfEventWeights[0]->GetBinContent(c2+1));
+                          
+                              
+   }
+   productOfCorrelationsLabel++;
+   sumOfProductOfEventWeightsLabel1++;
+   sumOfProductOfEventWeightsLabel2++;  
+  }
+ }
+ // covariance label:
+ Int_t covarianceLabel = 1;
+ for(Int_t c1=0;c1<4;c1++)
+ {
+  for(Int_t c2=c1+1;c2<4;c2++)
+  {
+   if(denominator[c1][c2])
+   {
+    // covariances:
+    Double_t cov = (productOfCorrelations[c1][c2]-correlation[c1]*correlation[c2])/denominator[c1][c2]; 
+    // covarianced multiplied with weight dependent prefactor:
+    Double_t wCov = cov * wPrefactor[c1][c2];
+    fIntFlowCovariances->SetBinContent(covarianceLabel,wCov);
+   }
+   covarianceLabel++;
+  }
+ }
+} // end of AliFlowAnalysisWithQCumulants::CalculateCovariancesIntFlow()
+
+
+//================================================================================================================================
+
+
+void AliFlowAnalysisWithQCumulants::FinalizeCorrelationsIntFlow() 
+{
+ // From profile fIntFlowCorrelationsPro access measured correlations and spread, 
+ // correctly calculate the statistical errors and store the final results and 
+ // statistical errors for correlations in histogram fIntFlowCorrelationsHist.
+ //
+ // Remark: Statistical error of correlation is calculated as:
+ //
+ //          statistical error = termA * spread * termB:
+ //          termA = sqrt{sum_{i=1}^{N} w^2}/(sum_{i=1}^{N} w)
+ //          termB = 1/sqrt(1-termA^2)   
+ for(Int_t power=0;power<2;power++)
+ { 
+  if(!(fIntFlowCorrelationsHist && fIntFlowCorrelationsPro && fIntFlowSumOfEventWeights[power])) 
+  {
+   cout<<"WARNING: fIntFlowCorrelationsHist && fIntFlowCorrelationsPro && fIntFlowSumOfEventWeights[power] is NULL in AFAWQC::FCIF() !!!!"<<endl;
+   cout<<"power = "<<power<<endl;
+   exit(0);
+  }
+ }
+  
+ for(Int_t ci=1;ci<=4;ci++) // correlation index
+ {
+  Double_t correlation = fIntFlowCorrelationsPro->GetBinContent(ci);
+  Double_t spread = fIntFlowCorrelationsPro->GetBinError(ci);
+  Double_t sumOfLinearEventWeights = fIntFlowSumOfEventWeights[0]->GetBinContent(ci);
+  Double_t sumOfQuadraticEventWeights = fIntFlowSumOfEventWeights[1]->GetBinContent(ci);
+  Double_t termA = 0.;
+  Double_t termB = 0.;
+  if(sumOfLinearEventWeights)
+  {
+   termA = pow(sumOfQuadraticEventWeights,0.5)/sumOfLinearEventWeights;
+  } else
+    {
+     cout<<"WARNING: sumOfLinearEventWeights == 0 in AFAWQC::FCIF() !!!!"<<endl;
+     cout<<"         (for "<<2*ci<<"-particle correlation)"<<endl;
+    }
+  if(1.-pow(termA,2.) > 0.)
+  {
+   termB = 1./pow(1-pow(termA,2.),0.5);
+  } else
+    {
+     cout<<"WARNING: 1.-pow(termA,2.) <= 0 in AFAWQC::FCIF() !!!!"<<endl;   
+     cout<<"         (for "<<2*ci<<"-particle correlation)"<<endl;
+    }     
+  Double_t statisticalError = termA * spread * termB;
+  fIntFlowCorrelationsHist->SetBinContent(ci,correlation);
+  fIntFlowCorrelationsHist->SetBinError(ci,statisticalError);
+ } // end of for(Int_t ci=1;ci<=4;ci++) // correlation index                                                                
+                                                                                                                              
+} // end of AliFlowAnalysisWithQCumulants::FinalizeCorrelationsIntFlow()
+
+
+//================================================================================================================================
+
+
+void AliFlowAnalysisWithQCumulants::FillAverageMultiplicities(Int_t nRP)
+{
+ // Fill profile fAverageMultiplicity to hold average multiplicities and number of events for events with nRP>=0, nRP>=1, ... , and nRP>=8
+ // Binning of fAverageMultiplicity is organized as follows:
+ //  1st bin: all events (including the empty ones)
+ //  2nd bin: event with # of RPs greater or equal to 1
+ //  3rd bin: event with # of RPs greater or equal to 2
+ //  4th bin: event with # of RPs greater or equal to 3
+ //  5th bin: event with # of RPs greater or equal to 4
+ //  6th bin: event with # of RPs greater or equal to 5
+ //  7th bin: event with # of RPs greater or equal to 6
+ //  8th bin: event with # of RPs greater or equal to 7
+ //  9th bin: event with # of RPs greater or equal to 8
+ if(!fAvMultiplicity)
+ {
+  cout<<"WARNING: fAvMultiplicity is NULL in AFAWQC::FAM() !!!!"<<endl;
+  exit(0);
+ }
+ if(nRP<0)
+ {
+  cout<<"WARNING: nRP<0 in in AFAWQC::FAM() !!!!"<<endl;
+  exit(0);
+ }
+ for(Int_t i=0;i<9;i++)
+ {
+  if(nRP>=i) fAvMultiplicity->Fill(i+0.5,nRP,1);
+ }
+} // end of AliFlowAnalysisWithQCumulants::FillAverageMultiplicities(nRP)
+
+
+//================================================================================================================================
+
+
+void AliFlowAnalysisWithQCumulants::CalculateCumulantsIntFlow()
+{
+ // a) Calculate Q-cumulants from the measured multiparticle correlations.
+ // b) Propagate the statistical errors of measured multiparticle correlations to statistical errors of Q-cumulants.  
+ // c) REMARK: Q-cumulants calculated in this method are biased by non-uniform acceptance of detector !!!! 
+ //            Method ApplyCorrectionForNonUniformAcceptance* (to be improved: finalize the name here)
+ //            is called afterwards to correct for this bias.   
+ // d) Store the results and statistical error of Q-cumulants in histogram fCumulants.
+ //    Binning of fCumulants is organized as follows:
+ //
+ //     1st bin: QC{2}
+ //     2nd bin: QC{4}
+ //     3rd bin: QC{6}
+ //     4th bin: QC{8}
+ if(!(fIntFlowCorrelationsHist && fIntFlowCovariances && fIntFlowQcumulants))
+ {
+  cout<<"WARNING: fIntFlowCorrelationsHist && fIntFlowCovariances && fIntFlowQcumulants is NULL in AFAWQC::CCIF() !!!!"<<endl;
+  exit(0);
+ }
+ // correlations:
+ Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>> 
+ Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>>  
+ Double_t six = fIntFlowCorrelationsHist->GetBinContent(3); // <<6>> 
+ Double_t eight = fIntFlowCorrelationsHist->GetBinContent(4); // <<8>>  
+ // statistical errors of average 2-, 4-, 6- and 8-particle azimuthal correlations:
+ Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1); // statistical error of <2>  
+ Double_t fourError = fIntFlowCorrelationsHist->GetBinError(2); // statistical error of <4>   
+ Double_t sixError = fIntFlowCorrelationsHist->GetBinError(3); // statistical error of <6> 
+ Double_t eightError = fIntFlowCorrelationsHist->GetBinError(4); // statistical error of <8> 
+ // covariances (multiplied by prefactor depending on weights - see comments in CalculateCovariancesIntFlow()):
+ Double_t wCov24 = fIntFlowCovariances->GetBinContent(1); // Cov(<2>,<4>) * prefactor(w_<2>,w_<4>)
+ Double_t wCov26 = fIntFlowCovariances->GetBinContent(2); // Cov(<2>,<6>) * prefactor(w_<2>,w_<6>)
+ Double_t wCov28 = fIntFlowCovariances->GetBinContent(3); // Cov(<2>,<8>) * prefactor(w_<2>,w_<8>)
+ Double_t wCov46 = fIntFlowCovariances->GetBinContent(4); // Cov(<4>,<6>) * prefactor(w_<4>,w_<6>)
+ Double_t wCov48 = fIntFlowCovariances->GetBinContent(5); // Cov(<4>,<8>) * prefactor(w_<4>,w_<8>)
+ Double_t wCov68 = fIntFlowCovariances->GetBinContent(6); // Cov(<6>,<8>) * prefactor(w_<6>,w_<8>)
+ // Q-cumulants: 
+ Double_t qc2 = 0.; // QC{2}
+ Double_t qc4 = 0.; // QC{4}
+ Double_t qc6 = 0.; // QC{6}
+ Double_t qc8 = 0.; // QC{8}
+ if(two) qc2 = two; 
+ if(four) qc4 = four-2.*pow(two,2.); 
+ if(six) qc6 = six-9.*two*four+12.*pow(two,3.); 
+ if(eight) qc8 = eight-16.*two*six-18.*pow(four,2.)+144.*pow(two,2.)*four-144.*pow(two,4.); 
+ // statistical errors of Q-cumulants:       
+ Double_t qc2Error = 0.;
+ Double_t qc4Error = 0.;
+ Double_t qc6Error = 0.;
+ Double_t qc8Error = 0.;
+ // squared statistical errors of Q-cumulants:       
+ //Double_t qc2ErrorSquared = 0.;
+ Double_t qc4ErrorSquared = 0.;
+ Double_t qc6ErrorSquared = 0.;
+ Double_t qc8ErrorSquared = 0.;
+        
+ // statistical error of QC{2}:              
+ qc2Error = twoError;                     
+                             
+ // statistical error of QC{4}:              
+ qc4ErrorSquared = 16.*pow(two,2.)*pow(twoError,2)+pow(fourError,2.)
+                 - 8.*two*wCov24;                     
+ if(qc4ErrorSquared>0.)
+ {
+  qc4Error = pow(qc4ErrorSquared,0.5);
+ } else 
+   {
+    cout<<"WARNING: Statistical error of QC{4} is imaginary !!!!"<<endl;
+   }
+                                           
+ // statistical error of QC{6}:              
+ qc6ErrorSquared = 81.*pow(4.*pow(two,2.)-four,2.)*pow(twoError,2.)
+                 + 81.*pow(two,2.)*pow(fourError,2.)
+                 + pow(sixError,2.)
+                 - 162.*two*(4.*pow(two,2.)-four)*wCov24
+                 + 18.*(4.*pow(two,2.)-four)*wCov26
+                 - 18.*two*wCov46; 
+                    
+ if(qc6ErrorSquared>0.)
+ {
+  qc6Error = pow(qc6ErrorSquared,0.5);
+ } else 
+   {
+    cout<<"WARNING: Statistical error of QC{6} is imaginary !!!!"<<endl;
+   }
+                            
+ // statistical error of QC{8}:              
+ qc8ErrorSquared = 256.*pow(36.*pow(two,3.)-18.*four*two+six,2.)*pow(twoError,2.)
+                 + 1296.*pow(4.*pow(two,2.)-four,2.)*pow(fourError,2.)
+                 + 256.*pow(two,2.)*pow(sixError,2.)
+                 + pow(eightError,2.)
+                 - 1152.*(36.*pow(two,3.)-18.*four*two+six)*(4.*pow(two,2.)-four)*wCov24
+                 + 512.*two*(36.*pow(two,3.)-18.*four*two+six)*wCov26
+                 - 32.*(36.*pow(two,3.)-18.*four*two+six)*wCov28
+                 - 1152.*two*(4.*pow(two,2.)-four)*wCov46
+                 + 72.*(4.*pow(two,2.)-four)*wCov48
+                 - 32.*two*wCov68;      
+ if(qc8ErrorSquared>0.)
+ {
+  qc8Error = pow(qc8ErrorSquared,0.5);
+ } else 
+   {
+    cout<<"WARNING: Statistical error of QC{8} is imaginary !!!!"<<endl;
+   }
+
+ // store the results and statistical errors for Q-cumulants:
+ fIntFlowQcumulants->SetBinContent(1,qc2);
+ fIntFlowQcumulants->SetBinError(1,qc2Error);
+ fIntFlowQcumulants->SetBinContent(2,qc4);
+ fIntFlowQcumulants->SetBinError(2,qc4Error);
+ fIntFlowQcumulants->SetBinContent(3,qc6);
+ fIntFlowQcumulants->SetBinError(3,qc6Error);
+ fIntFlowQcumulants->SetBinContent(4,qc8); 
+ fIntFlowQcumulants->SetBinError(4,qc8Error); 
+  
+} // end of AliFlowAnalysisWithQCumulants::CalculateCumulantsIntFlow()
+
+
+//================================================================================================================================ 
+
+
+void AliFlowAnalysisWithQCumulants::CalculateIntFlow()
+{
+ // a) Calculate the final results for integrated flow estimates from Q-cumulants.
+ // b) Propagate the statistical errors of measured multiparticle correlations to statistical errors of integrated flow estimates.  
+ // c) Store the results and statistical errors of integrated flow estimates in histogram fIntFlow.
+ //    Binning of fIntFlow is organized as follows:
+ //
+ //     1st bin: v{2,QC}
+ //     2nd bin: v{4,QC}
+ //     3rd bin: v{6,QC}
+ //     4th bin: v{8,QC}
+ if(!(fIntFlowCorrelationsHist && fIntFlowCovariances && fIntFlowQcumulants && fIntFlow))
+ {
+  cout<<"WARNING: fIntFlowCorrelationsHist && fIntFlowCovariances && fIntFlowQcumulants && fIntFlow is NULL in AFAWQC::CCIF() !!!!"<<endl;
+  exit(0);
+ }
+   
+ // Q-cumulants:
+ Double_t qc2 = fIntFlowQcumulants->GetBinContent(1); // QC{2}  
+ Double_t qc4 = fIntFlowQcumulants->GetBinContent(2); // QC{4}  
+ Double_t qc6 = fIntFlowQcumulants->GetBinContent(3); // QC{6}  
+ Double_t qc8 = fIntFlowQcumulants->GetBinContent(4); // QC{8}
+  
+ // correlations:
+ Double_t two = fIntFlowCorrelationsHist->GetBinContent(1); // <<2>> 
+ Double_t four = fIntFlowCorrelationsHist->GetBinContent(2); // <<4>>  
+ Double_t six = fIntFlowCorrelationsHist->GetBinContent(3); // <<6>> 
+ Double_t eight = fIntFlowCorrelationsHist->GetBinContent(4); // <<8>>  
+ // statistical errors of average 2-, 4-, 6- and 8-particle azimuthal correlations:
+ Double_t twoError = fIntFlowCorrelationsHist->GetBinError(1); // statistical error of <2>  
+ Double_t fourError = fIntFlowCorrelationsHist->GetBinError(2); // statistical error of <4>   
+ Double_t sixError = fIntFlowCorrelationsHist->GetBinError(3); // statistical error of <6> 
+ Double_t eightError = fIntFlowCorrelationsHist->GetBinError(4); // statistical error of <8> 
+ // covariances (multiplied by prefactor depending on weights - see comments in CalculateCovariancesIntFlow()):
+ Double_t wCov24 = fIntFlowCovariances->GetBinContent(1); // Cov(<2>,<4>) * prefactor(w_<2>,w_<4>)
+ Double_t wCov26 = fIntFlowCovariances->GetBinContent(2); // Cov(<2>,<6>) * prefactor(w_<2>,w_<6>)
+ Double_t wCov28 = fIntFlowCovariances->GetBinContent(3); // Cov(<2>,<8>) * prefactor(w_<2>,w_<8>)
+ Double_t wCov46 = fIntFlowCovariances->GetBinContent(4); // Cov(<4>,<6>) * prefactor(w_<4>,w_<6>)
+ Double_t wCov48 = fIntFlowCovariances->GetBinContent(5); // Cov(<4>,<8>) * prefactor(w_<4>,w_<8>)
+ Double_t wCov68 = fIntFlowCovariances->GetBinContent(6); // Cov(<6>,<8>) * prefactor(w_<6>,w_<8>)
+  
+ // integrated flow estimates:
+ Double_t v2 = 0.; // v{2,QC}  
+ Double_t v4 = 0.; // v{4,QC}  
+ Double_t v6 = 0.; // v{6,QC}  
+ Double_t v8 = 0.; // v{8,QC}
+ // calculate integrated flow estimates from Q-cumulants: 
+ if(qc2>=0.) v2 = pow(qc2,1./2.); 
+ if(qc4<=0.) v4 = pow(-1.*qc4,1./4.); 
+ if(qc6>=0.) v6 = pow((1./4.)*qc6,1./6.); 
+ if(qc8<=0.) v8 = pow((-1./33.)*qc8,1./8.); 
+   
+ // statistical errors of integrated flow estimates:
+ Double_t v2Error = 0.; // statistical error of v{2,QC}  
+ Double_t v4Error = 0.; // statistical error of v{4,QC}  
+ Double_t v6Error = 0.; // statistical error of v{6,QC}  
+ Double_t v8Error = 0.; // statistical error of v{8,QC}
+   
+ // squares of statistical errors of integrated flow estimates:
+ Double_t v2ErrorSquared = 0.; // squared statistical error of v{2,QC} 
+ Double_t v4ErrorSquared = 0.; // squared statistical error of v{4,QC}   
+ Double_t v6ErrorSquared = 0.; // squared statistical error of v{6,QC}   
+ Double_t v8ErrorSquared = 0.; // squared statistical error of v{8,QC} 
+ // calculate squared statistical errors of integrated flow estimates:
+ if(two != 0.) 
+ { 
+  v2ErrorSquared = (1./(4.*two))*pow(twoError,2.);
+ } 
+ if(2.*pow(two,2.)-four > 0.)
+ {
+  v4ErrorSquared = (1./pow(2.*pow(two,2.)-four,3./2.))*
+                   (pow(two,2.)*pow(twoError,2.)+(1./16.)*pow(fourError,2.)-(1./2.)*two*wCov24);
+ }
+ if(six-9.*four*two+12.*pow(two,3.) > 0.) 
+ {
+  v6ErrorSquared = ((1./2.)*(1./pow(2.,2./3.))*(1./pow(six-9.*four*two+12.*pow(two,3.),5./3.)))*
+                   ((9./2.)*pow(4.*pow(two,2.)-four,2.)*pow(twoError,2.) 
+                    + (9./2.)*pow(two,2.)*pow(fourError,2.)+(1./18.)*pow(sixError,2.)
+                    - 9.*two*(4.*pow(two,2.)-four)*wCov24+(4.*pow(two,2.)-four)*wCov26-two*wCov46); 
+ }
+ if(-1.*eight+16.*six*two+18.*pow(four,2.)-144.*four*pow(two,2.)+144.*pow(two,4.) > 0.) 
+ {
+  v8ErrorSquared = (4./pow(33,1./4.))*(1./pow(-1.*eight+16.*six*two+18.*pow(four,2.)-144.*four*pow(two,2.)+144.*pow(two,4.),7./4.))*
+                   (pow(36.*pow(two,3.)-18.*four*two+six,2.)*pow(twoError,2.)
+                    + (81./16.)*pow(4.*pow(two,2.)-four,2.)*pow(fourError,2.)
+                    + pow(two,2.)*pow(sixError,2.)
+                    + (1./256.)*pow(eightError,2.)
+                    - (9./2.)*(36.*pow(two,3.)-18.*four*two+six)*(4.*pow(two,2.)-four)*wCov24
+                    + 2.*two*(36.*pow(two,3.)-18.*four*two+six)*wCov26
+                    - (1./8.)*(36.*pow(two,3.)-18.*four*two+six)*wCov28                    
+                    - (9./2.)*two*(4.*pow(two,2.)-four)*wCov46                   
+                    + (9./32.)*(4.*pow(two,2.)-four)*wCov48                    
+                    - (1./8.)*two*wCov68);
+ } 
+
+ // calculate statistical errors of integrated flow estimates: 
+ if(v2ErrorSquared > 0.)
+ {
+  v2Error = pow(v2ErrorSquared,0.5);
+ } else
+   {
+    cout<<"WARNING: Statistical error of v{2,QC} is imaginary !!!!"<<endl;
+   }    
+ if(v4ErrorSquared > 0.)
+ {
+  v4Error = pow(v4ErrorSquared,0.5);
+ } else
+   {
+    cout<<"WARNING: Statistical error of v{4,QC} is imaginary !!!!"<<endl;
+   }     
+ if(v6ErrorSquared > 0.)
+ {
+  v6Error = pow(v6ErrorSquared,0.5);
+ } else
+   {
+    cout<<"WARNING: Statistical error of v{6,QC} is imaginary !!!!"<<endl;
+   }     
+ if(v8ErrorSquared > 0.)
+ {
+  v8Error = pow(v8ErrorSquared,0.5);
+ } else
+   {
+    cout<<"WARNING: Statistical error of v{8,QC} is imaginary !!!!"<<endl;
+   }    
+                     
+ // store the results and statistical errors of integrated flow estimates:
+ fIntFlow->SetBinContent(1,v2);
+ fIntFlow->SetBinError(1,v2Error);
+ fIntFlow->SetBinContent(2,v4);
+ fIntFlow->SetBinError(2,v4Error);
+ fIntFlow->SetBinContent(3,v6);
+ fIntFlow->SetBinError(3,v6Error);
+ fIntFlow->SetBinContent(4,v8);
+ fIntFlow->SetBinError(4,v8Error);
+       
+} // end of AliFlowAnalysisWithQCumulants::CalculateIntFlow()
+
+
+//================================================================================================================================ 
+
+
+void AliFlowAnalysisWithQCumulants::FillCommonHistResultsIntFlow()
+{
+ // Fill in AliFlowCommonHistResults histograms relevant for 'NONAME' integrated flow (to be improved (name))
+ if(!fIntFlow)
+ {
+  cout<<"WARNING: fIntFlow is NULL in AFAWQC::FCHRIF() !!!!"<<endl;
+  exit(0); 
+ }  
+    
+ if(!(fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th))
+ {
+  cout<<"WARNING: fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th"<<endl; 
+  cout<<"         is NULL in AFAWQC::FCHRIF() !!!!"<<endl;
+  exit(0);
+ }
+ Double_t v2 = fIntFlow->GetBinContent(1);
+ Double_t v4 = fIntFlow->GetBinContent(2);
+ Double_t v6 = fIntFlow->GetBinContent(3);
+ Double_t v8 = fIntFlow->GetBinContent(4);
+  
+ Double_t v2Error = fIntFlow->GetBinError(1);
+ Double_t v4Error = fIntFlow->GetBinError(2);
+ Double_t v6Error = fIntFlow->GetBinError(3);
+ Double_t v8Error = fIntFlow->GetBinError(4);
+ fCommonHistsResults2nd->FillIntegratedFlow(v2,v2Error); // to be improved (hardwired 2nd in the name)  
+ fCommonHistsResults4th->FillIntegratedFlow(v4,v4Error); // to be improved (hardwired 4th in the name)
+ if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)) // to be improved (calculate also 6th and 8th order)
+ {
+  fCommonHistsResults6th->FillIntegratedFlow(v6,v6Error); // to be improved (hardwired 6th in the name)
+  fCommonHistsResults8th->FillIntegratedFlow(v8,v8Error); // to be improved (hardwired 8th in the name) 
+ }
+} // end of AliFlowAnalysisWithQCumulants::FillCommonHistResultsIntFlow()
+
+
+//================================================================================================================================ 
+
+
+/*
+void AliFlowAnalysisWithQCumulants::ApplyCorrectionForNonUniformAcceptanceToCumulantsForIntFlow(Bool_t useParticleWeights, TString eventWeights)
+{
+ // apply correction for non-uniform acceptance to cumulants for integrated flow 
+ // (Remark: non-corrected cumulants are accessed from fCumulants[pW][0], corrected cumulants are stored in fCumulants[pW][1])
+ // shortcuts for the flags:
+ Int_t pW = (Int_t)(useParticleWeights); // 0=pWeights not used, 1=pWeights used
+ Int_t eW = -1;
+ if(eventWeights == "exact")
+ {
+  eW = 0;
+ }
+ if(!(fCumulants[pW][eW][0] && fCumulants[pW][eW][1] && fCorrections[pW][eW]))
+ {
+  cout<<"WARNING: fCumulants[pW][eW][0] && fCumulants[pW][eW][1] && fCorrections[pW][eW] is NULL in AFAWQC::ACFNUATCFIF() !!!!"<<endl;
+  cout<<"pW = "<<pW<<endl;
+  cout<<"eW = "<<eW<<endl;
+  exit(0);
+ } 
+  
+ // non-corrected cumulants:
+ Double_t qc2 = fCumulants[pW][eW][0]->GetBinContent(1); 
+ Double_t qc4 = fCumulants[pW][eW][0]->GetBinContent(2); 
+ Double_t qc6 = fCumulants[pW][eW][0]->GetBinContent(3); 
+ Double_t qc8 = fCumulants[pW][eW][0]->GetBinContent(4); 
+ // statistical error of non-corrected cumulants:  
+ Double_t qc2Error = fCumulants[pW][eW][0]->GetBinError(1); 
+ Double_t qc4Error = fCumulants[pW][eW][0]->GetBinError(2); 
+ Double_t qc6Error = fCumulants[pW][eW][0]->GetBinError(3); 
+ Double_t qc8Error = fCumulants[pW][eW][0]->GetBinError(4); 
+ // corrections for non-uniform acceptance:
+ Double_t qc2Correction = fCorrections[pW][eW]->GetBinContent(1); 
+ Double_t qc4Correction = fCorrections[pW][eW]->GetBinContent(2); 
+ Double_t qc6Correction = fCorrections[pW][eW]->GetBinContent(3); 
+ Double_t qc8Correction = fCorrections[pW][eW]->GetBinContent(4); 
+ // corrected cumulants:
+ Double_t qc2Corrected = qc2 + qc2Correction;
+ Double_t qc4Corrected = qc4 + qc4Correction;
+ Double_t qc6Corrected = qc6 + qc6Correction;
+ Double_t qc8Corrected = qc8 + qc8Correction;
+  
+ // ... to be improved (I need here also to correct error of QCs for NUA. 
+ // For simplicity sake I assume at the moment that this correction is negliglible, but it will be added eventually...)
+ // store corrected results and statistical errors for cumulants:   
+ fCumulants[pW][eW][1]->SetBinContent(1,qc2Corrected);
+ fCumulants[pW][eW][1]->SetBinContent(2,qc4Corrected);
+ fCumulants[pW][eW][1]->SetBinContent(3,qc6Corrected);
+ fCumulants[pW][eW][1]->SetBinContent(4,qc8Corrected);
+ fCumulants[pW][eW][1]->SetBinError(1,qc2Error); // to be improved (correct also qc2Error for NUA)
+ fCumulants[pW][eW][1]->SetBinError(2,qc4Error); // to be improved (correct also qc4Error for NUA)
+ fCumulants[pW][eW][1]->SetBinError(3,qc6Error); // to be improved (correct also qc6Error for NUA)
+ fCumulants[pW][eW][1]->SetBinError(4,qc8Error); // to be improved (correct also qc8Error for NUA)  
+  
+} // end of AliFlowAnalysisWithQCumulants::ApplyCorrectionForNonUniformAcceptanceToCumulantsForIntFlow(Bool_t useParticleWeights, TString eventWeights)
+*/
+
+
+//================================================================================================================================
+
+
+/*  
+void AliFlowAnalysisWithQCumulants::PrintQuantifyingCorrectionsForNonUniformAcceptance(Bool_t useParticleWeights, TString eventWeights)
+{
+ // print on the screen QC{n,biased}/QC{n,corrected}
+ // shortcuts for the flags:
+ Int_t pW = (Int_t)(useParticleWeights); // 0=pWeights not used, 1=pWeights used
+ Int_t eW = -1;
+ if(eventWeights == "exact")
+ {
+  eW = 0;
+ } 
+ if(!(fCumulants[pW][eW][0] && fCumulants[pW][eW][1]))
+ {
+  cout<<"WARNING: fCumulants[pW][eW][0] && fCumulants[pW][eW][1] is NULL in AFAWQC::PQCFNUA() !!!!"<<endl;
+  cout<<"pW = "<<pW<<endl;
+  cout<<"eW = "<<eW<<endl;
+  exit(0);
+ }
+   
+ cout<<endl;
+ cout<<" Quantifying the bias to Q-cumulants from"<<endl;
+ cout<<"  non-uniform acceptance of the detector:"<<endl;
+ cout<<endl;
+  
+ if(fCumulants[pW][eW][1]->GetBinContent(1)) 
+ { 
+  cout<<"  QC{2,biased}/QC{2,corrected} = "<<(fCumulants[pW][eW][0]->GetBinContent(1))/(fCumulants[pW][eW][1]->GetBinContent(1))<<endl;   
+ }
+ if(fCumulants[pW][eW][1]->GetBinContent(2)) 
+ { 
+  cout<<"  QC{4,biased}/QC{4,corrected} = "<<fCumulants[pW][eW][0]->GetBinContent(2)/fCumulants[pW][eW][1]->GetBinContent(2)<<endl;   
+ }
+ cout<<endl;
+            
+} // end of AliFlowAnalysisWithQCumulants::PrintQuantifyingCorrectionsForNonUniformAcceptance(Bool_t useParticleWeights, TString eventWeights)
+*/
+
+
+//================================================================================================================================
+
+
+void AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelationsUsingParticleWeights()
+{
+ // Calculate all correlations needed for integrated flow using particle weights.
   
  // Remark 1: When particle weights are used the binning of fIntFlowCorrelationAllPro is organized as follows:
  //
- //  1st bin: <2>_{1n|1n} = two1n1nW1W1 = <w1 w2 cos(n*(phi1-phi2))>\r
- //  2nd bin: <2>_{2n|2n} = two2n2nW2W2 = <w1^2 w2^2 cos(2n*(phi1-phi2))>\r
- //  3rd bin: <2>_{3n|3n} = two3n3nW3W3 = <w1^3 w2^3 cos(3n*(phi1-phi2))> \r
- //  4th bin: <2>_{4n|4n} = two4n4nW4W4 = <w1^4 w2^4 cos(4n*(phi1-phi2))>\r
- //  5th bin:           ----  EMPTY ----\r
- //  6th bin: <3>_{2n|1n,1n} = three2n1n1nW2W1W1 = <w1^2 w2 w3 cos(n*(2phi1-phi2-phi3))>\r
- //  7th bin: <3>_{3n|2n,1n} = ...\r
- //  8th bin: <3>_{4n|2n,2n} = ...\r
+ //  1st bin: <2>_{1n|1n} = two1n1nW1W1 = <w1 w2 cos(n*(phi1-phi2))>
+ //  2nd bin: <2>_{2n|2n} = two2n2nW2W2 = <w1^2 w2^2 cos(2n*(phi1-phi2))>
+ //  3rd bin: <2>_{3n|3n} = two3n3nW3W3 = <w1^3 w2^3 cos(3n*(phi1-phi2))> 
+ //  4th bin: <2>_{4n|4n} = two4n4nW4W4 = <w1^4 w2^4 cos(4n*(phi1-phi2))>
+ //  5th bin:           ----  EMPTY ----
+ //  6th bin: <3>_{2n|1n,1n} = three2n1n1nW2W1W1 = <w1^2 w2 w3 cos(n*(2phi1-phi2-phi3))>
+ //  7th bin: <3>_{3n|2n,1n} = ...
+ //  8th bin: <3>_{4n|2n,2n} = ...
  //  9th bin: <3>_{4n|3n,1n} = ...
- // 10th bin:           ----  EMPTY ----\r
- // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1nW1W1W1W1 = <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))>\r
- // 12th bin: <4>_{2n,1n|2n,1n} = ...\r
- // 13th bin: <4>_{2n,2n|2n,2n} = ...\r
- // 14th bin: <4>_{3n|1n,1n,1n} = ... \r
- // 15th bin: <4>_{3n,1n|3n,1n} = ...\r
- // 16th bin: <4>_{3n,1n|2n,2n} = ...\r
- // 17th bin: <4>_{4n|2n,1n,1n} = ... \r
- // 18th bin:           ----  EMPTY ----\r
- // 19th bin: <5>_{2n|1n,1n,1n,1n} = ...\r
- // 20th bin: <5>_{2n,2n|2n,1n,1n} = ...\r
- // 21st bin: <5>_{3n,1n|2n,1n,1n} = ...\r
- // 22nd bin: <5>_{4n|1n,1n,1n,1n} = ...\r
- // 23rd bin:           ----  EMPTY ----\r
- // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = ...\r
- // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = ...\r
- // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = ...\r
- // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = ...\r
- // 28th bin:           ----  EMPTY ----\r
- // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = ...\r
- // 30th bin:           ----  EMPTY ----\r
- // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = ...\r
+ // 10th bin:           ----  EMPTY ----
+ // 11th bin: <4>_{1n,1n|1n,1n} = four1n1n1n1nW1W1W1W1 = <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))>
+ // 12th bin: <4>_{2n,1n|2n,1n} = ...
+ // 13th bin: <4>_{2n,2n|2n,2n} = ...
+ // 14th bin: <4>_{3n|1n,1n,1n} = ... 
+ // 15th bin: <4>_{3n,1n|3n,1n} = ...
+ // 16th bin: <4>_{3n,1n|2n,2n} = ...
+ // 17th bin: <4>_{4n|2n,1n,1n} = ... 
+ // 18th bin:           ----  EMPTY ----
+ // 19th bin: <5>_{2n|1n,1n,1n,1n} = ...
+ // 20th bin: <5>_{2n,2n|2n,1n,1n} = ...
+ // 21st bin: <5>_{3n,1n|2n,1n,1n} = ...
+ // 22nd bin: <5>_{4n|1n,1n,1n,1n} = ...
+ // 23rd bin:           ----  EMPTY ----
+ // 24th bin: <6>_{1n,1n,1n|1n,1n,1n} = ...
+ // 25th bin: <6>_{2n,1n,1n|2n,1n,1n} = ...
+ // 26th bin: <6>_{2n,2n|1n,1n,1n,1n} = ...
+ // 27th bin: <6>_{3n,1n|1n,1n,1n,1n} = ...
+ // 28th bin:           ----  EMPTY ----
+ // 29th bin: <7>_{2n,1n,1n|1n,1n,1n,1n} = ...
+ // 30th bin:           ----  EMPTY ----
+ // 31st bin: <8>_{1n,1n,1n,1n|1n,1n,1n,1n} = ...
  
  // Remark 2: When particle weights are used there are some extra correlations. They are stored in 
  // fIntFlowExtraCorrelationsPro binning of which is organized as follows:
  
- // 1st bin: two1n1nW3W1 = <w1^3 w2 cos(n*(phi1-phi2))>\r
- // 2nd bin: two1n1nW1W1W2 = <w1 w2 w3^2 cos(n*(phi1-phi2))>  \r
+ // 1st bin: two1n1nW3W1 = <w1^3 w2 cos(n*(phi1-phi2))>
+ // 2nd bin: two1n1nW1W1W2 = <w1 w2 w3^2 cos(n*(phi1-phi2))>  
  // ...
-  \r
- // multiplicity (number of particles used to determine the reaction plane)\r
- Double_t dMult = (*fSMpk)(0,0);\r
\r
- // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: \r
- Double_t dReQ1n1k = (*fReQ)(0,1);\r
- Double_t dReQ2n2k = (*fReQ)(1,2);\r
- Double_t dReQ3n3k = (*fReQ)(2,3);\r
- Double_t dReQ4n4k = (*fReQ)(3,4);\r
- Double_t dReQ1n3k = (*fReQ)(0,3);\r
- Double_t dImQ1n1k = (*fImQ)(0,1);\r
- Double_t dImQ2n2k = (*fImQ)(1,2);\r
- Double_t dImQ3n3k = (*fImQ)(2,3);\r
- Double_t dImQ4n4k = (*fImQ)(3,4);\r
- Double_t dImQ1n3k = (*fImQ)(0,3);\r
-\r
- // dMs are variables introduced in order to simplify some Eqs. bellow:\r
- //..............................................................................................\r
- Double_t dM11 = (*fSMpk)(1,1)-(*fSMpk)(0,2); // dM11 = sum_{i,j=1,i!=j}^M w_i w_j\r
- Double_t dM22 = (*fSMpk)(1,2)-(*fSMpk)(0,4); // dM22 = sum_{i,j=1,i!=j}^M w_i^2 w_j^2\r
- Double_t dM33 = (*fSMpk)(1,3)-(*fSMpk)(0,6); // dM33 = sum_{i,j=1,i!=j}^M w_i^3 w_j^3\r
- Double_t dM44 = (*fSMpk)(1,4)-(*fSMpk)(0,8); // dM44 = sum_{i,j=1,i!=j}^M w_i^4 w_j^4\r
- Double_t dM31 = (*fSMpk)(0,3)*(*fSMpk)(0,1)-(*fSMpk)(0,4); // dM31 = sum_{i,j=1,i!=j}^M w_i^3 w_j\r
- Double_t dM211 = (*fSMpk)(0,2)*(*fSMpk)(1,1)-2.*(*fSMpk)(0,3)*(*fSMpk)(0,1)\r
-                - (*fSMpk)(1,2)+2.*(*fSMpk)(0,4); // dM211 = sum_{i,j,k=1,i!=j!=k}^M w_i^2 w_j w_k\r
- Double_t dM1111 = (*fSMpk)(3,1)-6.*(*fSMpk)(0,2)*(*fSMpk)(1,1)  \r
-                 + 8.*(*fSMpk)(0,3)*(*fSMpk)(0,1)\r
-                 + 3.*(*fSMpk)(1,2)-6.*(*fSMpk)(0,4); // dM1111 = sum_{i,j,k,l=1,i!=j!=k!=l}^M w_i w_j w_k w_l\r
- //..............................................................................................\r
-\r
- // 2-particle correlations:\r
- Double_t two1n1nW1W1 = 0.; // <w1 w2 cos(n*(phi1-phi2))>\r
- Double_t two2n2nW2W2 = 0.; // <w1^2 w2^2 cos(2n*(phi1-phi2))>\r
- Double_t two3n3nW3W3 = 0.; // <w1^3 w2^3 cos(3n*(phi1-phi2))>\r
- Double_t two4n4nW4W4 = 0.; // <w1^4 w2^4 cos(4n*(phi1-phi2))>\r
- if(dMult>1) \r
- { \r
-  if(dM11)\r
-  {\r
-   two1n1nW1W1 = (pow(dReQ1n1k,2)+pow(dImQ1n1k,2)-(*fSMpk)(0,2))/dM11;    \r
-   // average correlation <w1 w2 cos(n*(phi1-phi2))> for single event: \r
-   fIntFlowCorrelationsEBE->SetBinContent(1,two1n1nW1W1);\r
-   fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(1,dM11);\r
-   // average correlation <w1 w2 cos(n*(phi1-phi2))> for all events:\r
-   fIntFlowCorrelationsPro->Fill(0.5,two1n1nW1W1,dM11);   \r
-   fIntFlowCorrelationsAllPro->Fill(0.5,two1n1nW1W1,dM11);   \r
-  }\r
-  if(dM22)\r
-  {\r
+  
+ // multiplicity (number of particles used to determine the reaction plane)
+ Double_t dMult = (*fSMpk)(0,0);
+ // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: 
+ Double_t dReQ1n1k = (*fReQ)(0,1);
+ Double_t dReQ2n2k = (*fReQ)(1,2);
+ Double_t dReQ3n3k = (*fReQ)(2,3);
+ Double_t dReQ4n4k = (*fReQ)(3,4);
+ Double_t dReQ1n3k = (*fReQ)(0,3);
+ Double_t dImQ1n1k = (*fImQ)(0,1);
+ Double_t dImQ2n2k = (*fImQ)(1,2);
+ Double_t dImQ3n3k = (*fImQ)(2,3);
+ Double_t dImQ4n4k = (*fImQ)(3,4);
+ Double_t dImQ1n3k = (*fImQ)(0,3);
+
+ // dMs are variables introduced in order to simplify some Eqs. bellow:
+ //..............................................................................................
+ Double_t dM11 = (*fSMpk)(1,1)-(*fSMpk)(0,2); // dM11 = sum_{i,j=1,i!=j}^M w_i w_j
+ Double_t dM22 = (*fSMpk)(1,2)-(*fSMpk)(0,4); // dM22 = sum_{i,j=1,i!=j}^M w_i^2 w_j^2
+ Double_t dM33 = (*fSMpk)(1,3)-(*fSMpk)(0,6); // dM33 = sum_{i,j=1,i!=j}^M w_i^3 w_j^3
+ Double_t dM44 = (*fSMpk)(1,4)-(*fSMpk)(0,8); // dM44 = sum_{i,j=1,i!=j}^M w_i^4 w_j^4
+ Double_t dM31 = (*fSMpk)(0,3)*(*fSMpk)(0,1)-(*fSMpk)(0,4); // dM31 = sum_{i,j=1,i!=j}^M w_i^3 w_j
+ Double_t dM211 = (*fSMpk)(0,2)*(*fSMpk)(1,1)-2.*(*fSMpk)(0,3)*(*fSMpk)(0,1)
+                - (*fSMpk)(1,2)+2.*(*fSMpk)(0,4); // dM211 = sum_{i,j,k=1,i!=j!=k}^M w_i^2 w_j w_k
+ Double_t dM1111 = (*fSMpk)(3,1)-6.*(*fSMpk)(0,2)*(*fSMpk)(1,1)  
+                 + 8.*(*fSMpk)(0,3)*(*fSMpk)(0,1)
+                 + 3.*(*fSMpk)(1,2)-6.*(*fSMpk)(0,4); // dM1111 = sum_{i,j,k,l=1,i!=j!=k!=l}^M w_i w_j w_k w_l
+ //..............................................................................................
+
+ // 2-particle correlations:
+ Double_t two1n1nW1W1 = 0.; // <w1 w2 cos(n*(phi1-phi2))>
+ Double_t two2n2nW2W2 = 0.; // <w1^2 w2^2 cos(2n*(phi1-phi2))>
+ Double_t two3n3nW3W3 = 0.; // <w1^3 w2^3 cos(3n*(phi1-phi2))>
+ Double_t two4n4nW4W4 = 0.; // <w1^4 w2^4 cos(4n*(phi1-phi2))>
+ if(dMult>1) 
+ { 
+  if(dM11)
+  {
+   two1n1nW1W1 = (pow(dReQ1n1k,2)+pow(dImQ1n1k,2)-(*fSMpk)(0,2))/dM11;    
+   // average correlation <w1 w2 cos(n*(phi1-phi2))> for single event: 
+   fIntFlowCorrelationsEBE->SetBinContent(1,two1n1nW1W1);
+   fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(1,dM11);
+   // average correlation <w1 w2 cos(n*(phi1-phi2))> for all events:
+   fIntFlowCorrelationsPro->Fill(0.5,two1n1nW1W1,dM11);   
+   fIntFlowCorrelationsAllPro->Fill(0.5,two1n1nW1W1,dM11);   
+  }
+  if(dM22)
+  {
    two2n2nW2W2 = (pow(dReQ2n2k,2)+pow(dImQ2n2k,2)-(*fSMpk)(0,4))/dM22; 
    // ...
-   // average correlation <w1^2 w2^2 cos(2n*(phi1-phi2))> for all events:\r
-   fIntFlowCorrelationsAllPro->Fill(1.5,two2n2nW2W2,dM22);   \r
-  }\r
-  if(dM33)\r
-  {\r
-   two3n3nW3W3 = (pow(dReQ3n3k,2)+pow(dImQ3n3k,2)-(*fSMpk)(0,6))/dM33;\r
+   // average correlation <w1^2 w2^2 cos(2n*(phi1-phi2))> for all events:
+   fIntFlowCorrelationsAllPro->Fill(1.5,two2n2nW2W2,dM22);   
+  }
+  if(dM33)
+  {
+   two3n3nW3W3 = (pow(dReQ3n3k,2)+pow(dImQ3n3k,2)-(*fSMpk)(0,6))/dM33;
    // ...
-   // average correlation <w1^3 w2^3 cos(3n*(phi1-phi2))> for all events:\r
-   fIntFlowCorrelationsAllPro->Fill(2.5,two3n3nW3W3,dM33);   \r
-  }\r
-  if(dM44)\r
-  {\r
-   two4n4nW4W4 = (pow(dReQ4n4k,2)+pow(dImQ4n4k,2)-(*fSMpk)(0,8))/dM44; \r
+   // average correlation <w1^3 w2^3 cos(3n*(phi1-phi2))> for all events:
+   fIntFlowCorrelationsAllPro->Fill(2.5,two3n3nW3W3,dM33);   
+  }
+  if(dM44)
+  {
+   two4n4nW4W4 = (pow(dReQ4n4k,2)+pow(dImQ4n4k,2)-(*fSMpk)(0,8))/dM44; 
    // ...
-   // average correlation <w1^4 w2^4 cos(4n*(phi1-phi2))> for all events:\r
+   // average correlation <w1^4 w2^4 cos(4n*(phi1-phi2))> for all events:
    fIntFlowCorrelationsAllPro->Fill(3.5,two4n4nW4W4,dM44);      
   }
- } // end of if(dMult>1) \r
-
- // extra 2-particle correlations:\r
- Double_t two1n1nW3W1 = 0.; // <w1^3 w2 cos(n*(phi1-phi2))>\r
- Double_t two1n1nW1W1W2 = 0.; // <w1 w2 w3^2 cos(n*(phi1-phi2))> \r
- if(dMult>1) \r
- {    \r
-  if(dM31)\r
-  {\r
-   two1n1nW3W1 = (dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k-(*fSMpk)(0,4))/dM31; \r
-   fIntFlowExtraCorrelationsPro->Fill(0.5,two1n1nW3W1,dM31);  \r
-  } \r
-  if(dM211)\r
-  {\r
-   two1n1nW1W1W2 = ((*fSMpk)(0,2)*(pow(dReQ1n1k,2)+pow(dImQ1n1k,2)-(*fSMpk)(0,2))\r
-                 - 2.*(dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k\r
-                 - (*fSMpk)(0,4)))/dM211;\r
-   fIntFlowExtraCorrelationsPro->Fill(1.5,two1n1nW1W1W2,dM211);  \r
-  }  \r
- } // end of if(dMult>1)\r
- //..............................................................................................\r
\r
- //..............................................................................................\r
- // 3-particle correlations:\r
- Double_t three2n1n1nW2W1W1 = 0.; // <w1^2 w2 w3 cos(n*(2phi1-phi2-phi3))>\r
\r
- if(dMult>2) \r
- { \r
-  if(dM211)\r
-  {                                                       \r
-   three2n1n1nW2W1W1 = (pow(dReQ1n1k,2.)*dReQ2n2k+2.*dReQ1n1k*dImQ1n1k*dImQ2n2k-pow(dImQ1n1k,2.)*dReQ2n2k\r
-                     - 2.*(dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k)\r
-                     - pow(dReQ2n2k,2)-pow(dImQ2n2k,2)\r
-                     + 2.*(*fSMpk)(0,4))/dM211;                                                                               \r
-   fIntFlowCorrelationsAllPro->Fill(5.5,three2n1n1nW2W1W1,dM211);\r
-  } \r
- } // end of if(dMult>2) \r
- //..............................................................................................\r
\r
- //..............................................................................................\r
- // 4-particle correlations:\r
- Double_t four1n1n1n1nW1W1W1W1 = 0.; // <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))>\r
- if(dMult>3) \r
- { \r
-  if(dM1111)\r
-  {      \r
-   four1n1n1n1nW1W1W1W1 = (pow(pow(dReQ1n1k,2.)+pow(dImQ1n1k,2.),2)\r
-                        - 2.*(pow(dReQ1n1k,2.)*dReQ2n2k+2.*dReQ1n1k*dImQ1n1k*dImQ2n2k-pow(dImQ1n1k,2.)*dReQ2n2k)\r
-                        + 8.*(dReQ1n3k*dReQ1n1k+dImQ1n3k*dImQ1n1k)\r
-                        + (pow(dReQ2n2k,2)+pow(dImQ2n2k,2))\r
-                        - 4.*(*fSMpk)(0,2)*(pow(dReQ1n1k,2)+pow(dImQ1n1k,2))\r
-                        - 6.*(*fSMpk)(0,4)+2.*(*fSMpk)(1,2))/dM1111;  \r
-                          \r
-   // average correlation <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))> for single event: \r
-   fIntFlowCorrelationsEBE->SetBinContent(2,four1n1n1n1nW1W1W1W1);\r
-   fIntFlowEventWeightsForCorrelationsEBE->SetBinContent(2,dM1111);\r
-   // average correlation <w1 w2 w3 w4 cos(n*(phi1+phi2-phi3-phi4))> for all events:\r
-   fIntFlowCorrelationsPro->Fill(1.5,four1n1n1n1nW1W1W1W1,dM1111);   \r
-   fIntFlowCorrelationsAllPro->Fill(10.5,four1n1n1n1nW1W1W1W1,dM1111);   \r
-  } \r
- } // end of if(dMult>3) \r
- //..............................................................................................\r
\r
-} // end of AliFlowAnalysisWithQCumulants::CalculateIntFlowCorrelationsUsingParticleWeights()\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::CalculateWeightedQProductsForIntFlow() // to be improved (completed)\r
-{\r
- // calculate averages like <<2><4>>, <<2><6>>, <<4><6>>, etc. which are needed to calculate covariances \r
- // Remark: here we take weighted correlations!\r
\r
- /*\r
\r
- // binning of fQProductsW is organized as follows:\r
- // \r
- // 1st bin: <2><4> \r
- // 2nd bin: <2><6>\r
- // 3rd bin: <2><8>\r
- // 4th bin: <4><6>\r
- // 5th bin: <4><8>\r
- // 6th bin: <6><8>\r
\r
- Double_t dMult = (*fSMpk)(0,0); // multiplicity (number of particles used to determine the reaction plane)\r
-\r
- Double_t dM11 = (*fSMpk)(1,1)-(*fSMpk)(0,2); // dM11 = sum_{i,j=1,i!=j}^M w_i w_j\r
- Double_t dM1111 = (*fSMpk)(3,1)-6.*(*fSMpk)(0,2)*(*fSMpk)(1,1)  \r
-                 + 8.*(*fSMpk)(0,3)*(*fSMpk)(0,1)\r
-                 + 3.*(*fSMpk)(1,2)-6.*(*fSMpk)(0,4); // dM1111 = sum_{i,j,k,l=1,i!=j!=k!=l}^M w_i w_j w_k w_l\r
-\r
- Double_t twoEBEW = 0.; // <2>\r
- Double_t fourEBEW = 0.; // <4>\r
\r
- twoEBEW = fQCorrelationsEBE[1]->GetBinContent(1);\r
- fourEBEW = fQCorrelationsEBE[1]->GetBinContent(11);\r
\r
- // <2><4>\r
- if(dMult>3)\r
- {\r
-  fQProducts[1][0]->Fill(0.5,twoEBEW*fourEBEW,dM11*dM1111);\r
- }\r
\r
- */\r
\r
-} // end of AliFlowAnalysisWithQCumulants::CalculateWeightedQProductsForIntFlow()  \r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::InitializeArraysForIntFlow()\r
-{\r
- // Initialize all arrays used to calculate integrated flow.\r
\r
- for(Int_t sc=0;sc<2;sc++) // sin or cos terms\r
- {\r
-  fIntFlowCorrectionTermsForNUAEBE[sc] = NULL;\r
-  fIntFlowCorrectionTermsForNUAPro[sc] = NULL;\r
-  fIntFlowCorrectionTermsForNUAHist[sc] = NULL;\r
- }\r
-   \r
- for(Int_t power=0;power<2;power++) // linear or quadratic \r
- {\r
-  fIntFlowSumOfEventWeights[power] = NULL;    \r
- }\r
\r
-} // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForIntFlow()\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::InitializeArraysForDiffFlow()\r
-{\r
- // Initialize all arrays needed to calculate differential flow.\r
- //  a) Initialize lists holding profiles;\r
- //  b) Initialize lists holding histograms;\r
- //  c) Initialize event-by-event quantities;\r
- //  d) Initialize profiles;\r
- //  e) Initialize histograms holding final results.\r
\r
- // a) Initialize lists holding profiles;\r
- for(Int_t t=0;t<2;t++) // type (RP, POI)\r
- {\r
-  for(Int_t pe=0;pe<2;pe++) // pt or eta\r
-  {\r
-   fDiffFlowCorrelationsProList[t][pe] = NULL;\r
-   fDiffFlowProductOfCorrelationsProList[t][pe] = NULL;\r
-   fDiffFlowCorrectionsProList[t][pe] = NULL;\r
-  }\r
- }  \r
\r
- // b) Initialize lists holding histograms;\r
- for(Int_t t=0;t<2;t++) // type (RP, POI)\r
- {\r
-  for(Int_t pe=0;pe<2;pe++) // pt or eta\r
-  {\r
-   fDiffFlowCorrelationsHistList[t][pe] = NULL;\r
-   for(Int_t power=0;power<2;power++)\r
-   {\r
-    fDiffFlowSumOfEventWeightsHistList[t][pe][power] = NULL;\r
-   } // end of for(Int_t power=0;power<2;power++)  \r
-   fDiffFlowSumOfProductOfEventWeightsHistList[t][pe] = NULL;\r
-   fDiffFlowCorrectionsHistList[t][pe] = NULL;\r
-   fDiffFlowCovariancesHistList[t][pe] = NULL;\r
-   fDiffFlowCumulantsHistList[t][pe] = NULL;\r
-   fDiffFlowHistList[t][pe] = NULL;\r
-  } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta\r
- } // enf of for(Int_t t=0;t<2;t++) // type (RP, POI) \r
\r
- // c) Initialize event-by-event quantities:\r
- // 1D:\r
- for(Int_t t=0;t<3;t++) // type (RP, POI, POI&&RP)\r
- {\r
-  for(Int_t pe=0;pe<2;pe++) // pt or eta\r
-  { \r
-   for(Int_t m=0;m<4;m++) // multiple of harmonic\r
-   {\r
-    for(Int_t k=0;k<9;k++) // power of weight\r
-    {\r
-     fReRPQ1dEBE[t][pe][m][k] = NULL;\r
-     fImRPQ1dEBE[t][pe][m][k] = NULL;\r
-     fs1dEBE[t][pe][k] = NULL; // to be improved (this doesn't need to be within loop over m)\r
-    }   \r
-   }\r
-  }\r
- }\r
- // 1D:\r
- for(Int_t t=0;t<2;t++) // type (RP or POI)\r
- {\r
-  for(Int_t pe=0;pe<2;pe++) // pt or eta\r
-  { \r
-   for(Int_t sc=0;sc<2;sc++) // sin or cos terms\r
-   {\r
-    for(Int_t cti=0;cti<9;cti++) // correction term index\r
-    {\r
-     fDiffFlowCorrectionTermsForNUAEBE[t][pe][sc][cti] = NULL;\r
-    }   \r
-   }\r
-  }\r
- }\r
- // 2D:  \r
- for(Int_t t=0;t<3;t++) // type (RP, POI, POI&&RP)\r
- {\r
-  for(Int_t m=0;m<4;m++) // multiple of harmonic\r
-  {\r
-   for(Int_t k=0;k<9;k++) // power of weight\r
-   {\r
-    fReRPQ2dEBE[t][m][k] = NULL;\r
-    fImRPQ2dEBE[t][m][k] = NULL;\r
-    fs2dEBE[t][k] = NULL; // to be improved (this doesn't need to be within loop over m)\r
-   }   \r
-  }\r
- }\r
\r
- // d) Initialize profiles:\r
- for(Int_t t=0;t<2;t++) // type: RP or POI\r
- { \r
-  for(Int_t pe=0;pe<2;pe++) // pt or eta\r
-  {\r
-   for(Int_t ci=0;ci<4;ci++) // correlation index\r
-   {\r
-    fDiffFlowCorrelationsPro[t][pe][ci] = NULL;\r
-   } // end of for(Int_t ci=0;ci<4;ci++)   \r
-   for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index\r
-   {\r
-    for(Int_t mci2=0;mci2<8;mci2++) // mixed correlation index\r
-    {\r
-     fDiffFlowProductOfCorrelationsPro[t][pe][mci1][mci2] = NULL;\r
-    } // end of for(Int_t mci2=0;mci2<8;mci2++) // mixed correlation index\r
-   } // end of for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index  \r
-   // correction terms for nua:\r
-   for(Int_t sc=0;sc<2;sc++) // sin or cos terms\r
-   {\r
-    for(Int_t cti=0;cti<9;cti++) // correction term index\r
-    {\r
-     fDiffFlowCorrectionTermsForNUAPro[t][pe][sc][cti] = NULL;\r
-    }   \r
-   }\r
-  } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta\r
- } // end of for(Int_t t=0;t<2;t++) // type: RP or POI\r
-  \r
- // e) Initialize histograms holding final results.\r
- for(Int_t t=0;t<2;t++) // type: RP or POI\r
- { \r
-  for(Int_t pe=0;pe<2;pe++) // pt or eta\r
-  {\r
-   for(Int_t ci=0;ci<4;ci++) // correlation index\r
-   {\r
-    fDiffFlowCorrelationsHist[t][pe][ci] = NULL;\r
-    fDiffFlowCumulants[t][pe][ci] = NULL;\r
-    fDiffFlow[t][pe][ci] = NULL;\r
-   } // end of for(Int_t ci=0;ci<4;ci++)    \r
-   for(Int_t covarianceIndex=0;covarianceIndex<5;covarianceIndex++) \r
-   {\r
-    fDiffFlowCovariances[t][pe][covarianceIndex] = NULL;     \r
-   } // end of for(Int_t covarianceIndex=0;covarianceIndex<5;covarianceIndex++) \r
-   // correction terms for nua:\r
-   for(Int_t sc=0;sc<2;sc++) // sin or cos terms\r
-   {\r
-    for(Int_t cti=0;cti<9;cti++) // correction term index\r
-    {\r
-     fDiffFlowCorrectionTermsForNUAHist[t][pe][sc][cti] = NULL;\r
-    }   \r
-   }\r
-  } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta\r
- } // end of for(Int_t t=0;t<2;t++) // type: RP or POI\r
\r
- // sum of event weights for reduced correlations:\r
- for(Int_t t=0;t<2;t++) // type = RP or POI\r
- {\r
-  for(Int_t pe=0;pe<2;pe++) // pt or eta\r
-  {\r
-   for(Int_t p=0;p<2;p++) // power of weight is 1 or 2\r
-   {\r
-    for(Int_t ew=0;ew<4;ew++) // event weight index for reduced correlations\r
-    {\r
-     fDiffFlowSumOfEventWeights[t][pe][p][ew] = NULL;\r
-    } \r
-   }   \r
-  }\r
- }\r
- // product of event weights for both types of correlations:\r
- for(Int_t t=0;t<2;t++) // type = RP or POI\r
- {\r
-  for(Int_t pe=0;pe<2;pe++) // pt or eta\r
-  {\r
-   for(Int_t mci1=0;mci1<8;mci1++) // mixed correlation index\r
-   {\r
-    for(Int_t mci2=0;mci2<8;mci2++) // mixed correlation index\r
-    {\r
-     fDiffFlowSumOfProductOfEventWeights[t][pe][mci1][mci2] = NULL;\r
-    } \r
-   }   \r
-  }\r
- }\r
-\r
\r
\r
\r
- /*\r
\r
- // nested lists in fDiffFlowProfiles:\r
- for(Int_t t=0;t<2;t++)\r
- {\r
-  fDFPType[t] = NULL;\r
-  for(Int_t pW=0;pW<2;pW++) // particle weights not used (0) or used (1)\r
-  {\r
-   fDFPParticleWeights[t][pW] = NULL;\r
-   for(Int_t eW=0;eW<2;eW++)\r
-   {   \r
-    fDFPEventWeights[t][pW][eW] = NULL;\r
-    fDiffFlowCorrelations[t][pW][eW] = NULL;\r
-    fDiffFlowProductsOfCorrelations[t][pW][eW] = NULL;\r
-    for(Int_t sc=0;sc<2;sc++)\r
-    {\r
-     fDiffFlowCorrectionTerms[t][pW][eW][sc] = NULL;\r
-    }\r
-   } \r
-  }\r
- }  \r
\r
\r
- */\r
\r
-  \r
-  \r
-  /*\r
-  for(Int_t pW=0;pW<2;pW++) // particle weights not used (0) or used (1)\r
-  {\r
-   for(Int_t eW=0;eW<2;eW++)\r
-   {\r
-    // correlations:\r
-    for(Int_t correlationIndex=0;correlationIndex<4;correlationIndex++)\r
-    {\r
-     fCorrelationsPro[t][pW][eW][correlationIndex] = NULL;\r
-    }\r
-    // products of correlations:\r
-    for(Int_t productOfCorrelationsIndex=0;productOfCorrelationsIndex<6;productOfCorrelationsIndex++)\r
-    {\r
-     fProductsOfCorrelationsPro[t][pW][eW][productOfCorrelationsIndex] = NULL;\r
-    }\r
-    // correction terms:\r
-    for(Int_t sc=0;sc<2;sc++)\r
-    {\r
-     for(Int_t correctionsIndex=0;correctionsIndex<2;correctionsIndex++)\r
-     {\r
-      fCorrectionTermsPro[t][pW][eW][sc][correctionsIndex] = NULL;\r
-     } \r
-    } \r
-   }\r
-  } \r
-  */\r
-    \r
-} // end of AliFlowAnalysisWithQCumulants::InitializeArraysForDiffFlow()\r
-\r
-\r
-//================================================================================================================================\r
- /*\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::CalculateCorrelationsForDifferentialFlow2D(TString type)\r
-{\r
- // calculate all reduced correlations needed for differential flow for each (pt,eta) bin: \r
\r
- if(type == "RP") // to be improved (removed)\r
- {\r
-  cout<<endl;\r
- }\r
- // ... \r
\r
\r
- Int_t typeFlag = -1; \r
-  \r
- // reduced correlations ares stored in fCorrelationsPro[t][pW][index] and are indexed as follows:\r
- // index:\r
- // 0: <2'>\r
- // 1: <4'>\r
-\r
- // multiplicity:\r
- Double_t dMult = (*fSMpk)(0,0);\r
\r
- // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: \r
- Double_t dReQ1n = (*fReQ)(0,0);\r
- Double_t dReQ2n = (*fReQ)(1,0);\r
- //Double_t dReQ3n = (*fReQ)(2,0);\r
- //Double_t dReQ4n = (*fReQ)(3,0);\r
- Double_t dImQ1n = (*fImQ)(0,0);\r
- Double_t dImQ2n = (*fImQ)(1,0);\r
- //Double_t dImQ3n = (*fImQ)(2,0);\r
- //Double_t dImQ4n = (*fImQ)(3,0);\r
-\r
- // looping over all (pt,eta) bins and calculating correlations needed for differential flow: \r
- for(Int_t p=1;p<=fnBinsPt;p++)\r
- {\r
-  for(Int_t e=1;e<=fnBinsEta;e++)\r
-  {\r
-   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular (pt,eta) bin): \r
-   Double_t p1n0kRe = 0.;\r
-   Double_t p1n0kIm = 0.;\r
-\r
-   // number of POIs in particular (pt,eta) bin:\r
-   Double_t mp = 0.;\r
-\r
-   // 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,eta) bin):\r
-   Double_t q1n0kRe = 0.;\r
-   Double_t q1n0kIm = 0.;\r
-   Double_t q2n0kRe = 0.;\r
-   Double_t q2n0kIm = 0.;\r
-\r
-   // number of particles which are both RPs and POIs in particular (pt,eta) bin:\r
-   Double_t mq = 0.;\r
-   \r
-   // q_{m*n,0}:\r
-   q1n0kRe = fReEBE2D[2][0][0]->GetBinContent(fReEBE2D[2][0][0]->GetBin(p,e))\r
-           * fReEBE2D[2][0][0]->GetBinEntries(fReEBE2D[2][0][0]->GetBin(p,e));\r
-   q1n0kIm = fImEBE2D[2][0][0]->GetBinContent(fImEBE2D[2][0][0]->GetBin(p,e))\r
-           * fImEBE2D[2][0][0]->GetBinEntries(fImEBE2D[2][0][0]->GetBin(p,e));\r
-   q2n0kRe = fReEBE2D[2][1][0]->GetBinContent(fReEBE2D[2][1][0]->GetBin(p,e))\r
-           * fReEBE2D[2][1][0]->GetBinEntries(fReEBE2D[2][1][0]->GetBin(p,e));\r
-   q2n0kIm = fImEBE2D[2][1][0]->GetBinContent(fImEBE2D[2][1][0]->GetBin(p,e))\r
-           * fImEBE2D[2][1][0]->GetBinEntries(fImEBE2D[2][1][0]->GetBin(p,e));\r
-           \r
-   mq = fReEBE2D[2][0][0]->GetBinEntries(fReEBE2D[2][0][0]->GetBin(p,e)); // to be improved (cross-checked by accessing other profiles here)\r
-   \r
-   if(type == "POI")\r
-   {\r
-    // p_{m*n,0}:\r
-    p1n0kRe = fReEBE2D[1][0][0]->GetBinContent(fReEBE2D[1][0][0]->GetBin(p,e))\r
-            * fReEBE2D[1][0][0]->GetBinEntries(fReEBE2D[1][0][0]->GetBin(p,e));\r
-    p1n0kIm = fImEBE2D[1][0][0]->GetBinContent(fImEBE2D[1][0][0]->GetBin(p,e))  \r
-            * fImEBE2D[1][0][0]->GetBinEntries(fImEBE2D[1][0][0]->GetBin(p,e));\r
-            \r
-    mp = fReEBE2D[1][0][0]->GetBinEntries(fReEBE2D[1][0][0]->GetBin(p,e)); // to be improved (cross-checked by accessing other profiles here)\r
-    \r
-    typeFlag = 1;\r
-   }\r
-   else if(type == "RP")\r
-   {\r
-    // p_{m*n,0} = q_{m*n,0}:\r
-    p1n0kRe = q1n0kRe; \r
-    p1n0kIm = q1n0kIm; \r
-    mp = mq; \r
-    \r
-    typeFlag = 0;\r
-   }\r
-   \r
-   // count events with non-empty (pt,eta) bin:\r
-   if(mp>0)\r
-   {\r
-    fNonEmptyBins2D[typeFlag]->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,1);\r
-   }\r
-   \r
-   // 2'-particle correlation for particular (pt,eta) bin:\r
-   Double_t two1n1nPtEta = 0.;\r
-   if(mp*dMult-mq)\r
-   {\r
-    two1n1nPtEta = (p1n0kRe*dReQ1n+p1n0kIm*dImQ1n-mq)\r
-                 / (mp*dMult-mq);\r
-   \r
-    // fill the 2D profile to get the average correlation for each (pt,eta) bin:\r
-    if(type == "POI")\r
-    { \r
-     //f2pPtEtaPOI->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,two1n1nPtEta,mp*dMult-mq);\r
-     \r
-     fCorrelationsPro[1][0][0][0]->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,two1n1nPtEta,mp*dMult-mq);\r
-    }\r
-    else if(type == "RP")\r
-    {\r
-     //f2pPtEtaRP->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,two1n1nPtEta,mp*dMult-mq);   \r
-     fCorrelationsPro[0][0][0][0]->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,two1n1nPtEta,mp*dMult-mq);\r
-    }\r
-   } // end of if(mp*dMult-mq)\r
-  \r
-   // 4'-particle correlation:\r
-   Double_t four1n1n1n1nPtEta = 0.;\r
-   if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)\r
-       + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)) // to be improved (introduce a new variable for this expression)\r
-   {\r
-    four1n1n1n1nPtEta = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)\r
-                      - q2n0kRe*(pow(dReQ1n,2.)-pow(dImQ1n,2.))\r
-                      - 2.*q2n0kIm*dReQ1n*dImQ1n\r
-                      - p1n0kRe*(dReQ1n*dReQ2n+dImQ1n*dImQ2n)\r
-                      + p1n0kIm*(dImQ1n*dReQ2n-dReQ1n*dImQ2n)\r
-                      - 2.*dMult*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)\r
-                      - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*mq                      \r
-                      + 6.*(q1n0kRe*dReQ1n+q1n0kIm*dImQ1n)                                            \r
-                      + 1.*(q2n0kRe*dReQ2n+q2n0kIm*dImQ2n)                      \r
-                      + 2.*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)                       \r
-                      + 2.*mq*dMult                      \r
-                      - 6.*mq)        \r
-                      / ((mp-mq)*dMult*(dMult-1.)*(dMult-2.)\r
-                          + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)); \r
-    \r
-    // fill the 2D profile to get the average correlation for each (pt, eta) bin:\r
-    if(type == "POI")\r
-    {\r
-     //f4pPtEtaPOI->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,four1n1n1n1nPtEta,\r
-     //                  (mp-mq)*dMult*(dMult-1.)*(dMult-2.)\r
-     //                   + mq*(dMult-1.)*(dMult-2.)*(dMult-3.));\r
-     \r
-     fCorrelationsPro[1][0][0][1]->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,four1n1n1n1nPtEta,\r
-                                     (mp-mq)*dMult*(dMult-1.)*(dMult-2.)\r
-                                     + mq*(dMult-1.)*(dMult-2.)*(dMult-3.));\r
-    }\r
-    else if(type == "RP")\r
-    {\r
-     //f4pPtEtaRP->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,four1n1n1n1nPtEta,\r
-     //                 (mp-mq)*dMult*(dMult-1.)*(dMult-2.)\r
-     //                  + mq*(dMult-1.)*(dMult-2.)*(dMult-3.));   \r
-                       \r
-     fCorrelationsPro[0][0][0][1]->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,four1n1n1n1nPtEta,\r
-                                       (mp-mq)*dMult*(dMult-1.)*(dMult-2.)\r
-                                       + mq*(dMult-1.)*(dMult-2.)*(dMult-3.));                   \r
-    }\r
-   } // end of if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)\r
-     //            +mq*(dMult-1.)*(dMult-2.)*(dMult-3.))\r
-   \r
-  } // end of for(Int_t e=1;e<=fnBinsEta;e++)\r
- } // end of for(Int_t p=1;p<=fnBinsPt;p++)\r
-\r
\r
-   \r
-    \r
-      \r
-} // end of AliFlowAnalysisWithQCumulants::CalculateCorrelationsForDifferentialFlow2D()\r
-
-
-
\r
\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::CalculateWeightedCorrelationsForDifferentialFlow2D(TString type)\r
-{\r
- // calculate all weighted correlations needed for differential flow \r
\r
-  if(type == "RP") // to be improved (removed)\r
- {\r
-  cout<<endl;\r
- }\r
- // ... \r
\r
\r
\r
\r
- // real and imaginary parts of weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: \r
- Double_t dReQ1n1k = (*fReQ)(0,1);\r
- Double_t dReQ2n2k = (*fReQ)(1,2);\r
- Double_t dReQ1n3k = (*fReQ)(0,3);\r
- //Double_t dReQ4n4k = (*fReQ)(3,4);\r
- Double_t dImQ1n1k = (*fImQ)(0,1);\r
- Double_t dImQ2n2k = (*fImQ)(1,2);\r
- Double_t dImQ1n3k = (*fImQ)(0,3);\r
- //Double_t dImQ4n4k = (*fImQ)(3,4);\r
\r
- // S^M_{p,k} (see .h file for the definition of fSMpk):\r
- Double_t dSM1p1k = (*fSMpk)(0,1);\r
- Double_t dSM1p2k = (*fSMpk)(0,2);\r
- Double_t dSM1p3k = (*fSMpk)(0,3);\r
- Double_t dSM2p1k = (*fSMpk)(1,1);\r
- Double_t dSM3p1k = (*fSMpk)(2,1);\r
\r
- // looping over all (pt,eta) bins and calculating weighted correlations needed for differential flow: \r
- for(Int_t p=1;p<=fnBinsPt;p++)\r
- {\r
-  for(Int_t e=1;e<=fnBinsEta;e++)\r
-  {\r
-   // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular (pt,eta) bin):  \r
-   Double_t p1n0kRe = 0.;\r
-   Double_t p1n0kIm = 0.;\r
-\r
-   // number of POIs in particular (pt,eta) bin):\r
-   Double_t mp = 0.;\r
-\r
-   // real and imaginary parts of q_{m*n,k}: \r
-   // (weighted Q-vector evaluated for particles which are both RPs and POIs in particular (pt,eta) bin)\r
-   Double_t q1n2kRe = 0.;\r
-   Double_t q1n2kIm = 0.;\r
-   Double_t q2n1kRe = 0.;\r
-   Double_t q2n1kIm = 0.;\r
-\r
-   // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  \r
-   Double_t s1p1k = 0.; \r
-   Double_t s1p2k = 0.; \r
-   Double_t s1p3k = 0.; \r
-   \r
-   // M0111 from Eq. (118) in QC2c (to be improved (notation))\r
-   Double_t dM0111 = 0.;\r
\r
-   if(type == "POI")\r
-   {\r
-    // p_{m*n,0}:\r
-    p1n0kRe = fReEBE2D[1][0][0]->GetBinContent(fReEBE2D[1][0][0]->GetBin(p,e))\r
-            * fReEBE2D[1][0][0]->GetBinEntries(fReEBE2D[1][0][0]->GetBin(p,e));\r
-    p1n0kIm = fImEBE2D[1][0][0]->GetBinContent(fImEBE2D[1][0][0]->GetBin(p,e))\r
-            * fImEBE2D[1][0][0]->GetBinEntries(fImEBE2D[1][0][0]->GetBin(p,e)); \r
-            \r
-    mp = fReEBE2D[1][0][0]->GetBinEntries(fReEBE2D[1][0][0]->GetBin(p,e));\r
-    \r
-    // q_{m*n,k}: \r
-    q1n2kRe = fReEBE2D[2][0][2]->GetBinContent(fReEBE2D[2][0][2]->GetBin(p,e))\r
-            * fReEBE2D[2][0][2]->GetBinEntries(fReEBE2D[2][0][2]->GetBin(p,e));\r
-    q1n2kIm = fImEBE2D[2][0][2]->GetBinContent(fImEBE2D[2][0][2]->GetBin(p,e))\r
-            * fImEBE2D[2][0][2]->GetBinEntries(fImEBE2D[2][0][2]->GetBin(p,e));\r
-    q2n1kRe = fReEBE2D[2][1][1]->GetBinContent(fReEBE2D[2][1][1]->GetBin(p,e))\r
-            * fReEBE2D[2][1][1]->GetBinEntries(fReEBE2D[2][1][1]->GetBin(p,e)); \r
-    q2n1kIm = fImEBE2D[2][1][1]->GetBinContent(fImEBE2D[2][1][1]->GetBin(p,e))\r
-            * fImEBE2D[2][1][1]->GetBinEntries(fImEBE2D[2][1][1]->GetBin(p,e));\r
-       \r
-    // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  \r
-    s1p1k = pow(fs2D[2][1]->GetBinContent(fs2D[2][1]->GetBin(p,e)),1.); \r
-    s1p2k = pow(fs2D[2][2]->GetBinContent(fs2D[2][2]->GetBin(p,e)),1.); \r
-    s1p3k = pow(fs2D[2][3]->GetBinContent(fs2D[2][3]->GetBin(p,e)),1.); \r
-   \r
-    // M0111 from Eq. (118) in QC2c (to be improved (notation)):\r
-    dM0111 = mp*(dSM3p1k-3.*dSM1p1k*dSM1p2k+2.*dSM1p3k)\r
-           - 3.*(s1p1k*(dSM2p1k-dSM1p2k)\r
-           + 2.*(s1p3k-s1p2k*dSM1p1k));\r
-   }\r
-   else if(type == "RP")\r
-   {\r
-    p1n0kRe = fReEBE2D[0][0][0]->GetBinContent(fReEBE2D[0][0][0]->GetBin(p,e))\r
-            * fReEBE2D[0][0][0]->GetBinEntries(fReEBE2D[0][0][0]->GetBin(p,e));\r
-    p1n0kIm = fImEBE2D[0][0][0]->GetBinContent(fImEBE2D[0][0][0]->GetBin(p,e))\r
-            * fImEBE2D[0][0][0]->GetBinEntries(fImEBE2D[0][0][0]->GetBin(p,e));\r
-            \r
-    mp = fReEBE2D[0][0][0]->GetBinEntries(fReEBE2D[0][0][0]->GetBin(p,e));\r
-    \r
-    // q_{m*n,k}: \r
-    q1n2kRe = fReEBE2D[0][0][2]->GetBinContent(fReEBE2D[0][0][2]->GetBin(p,e))\r
-            * fReEBE2D[0][0][2]->GetBinEntries(fReEBE2D[0][0][2]->GetBin(p,e));\r
-    q1n2kIm = fImEBE2D[0][0][2]->GetBinContent(fImEBE2D[0][0][2]->GetBin(p,e))\r
-            * fImEBE2D[0][0][2]->GetBinEntries(fImEBE2D[0][0][2]->GetBin(p,e));\r
-    q2n1kRe = fReEBE2D[0][1][1]->GetBinContent(fReEBE2D[0][1][1]->GetBin(p,e))\r
-            * fReEBE2D[0][1][1]->GetBinEntries(fReEBE2D[0][1][1]->GetBin(p,e));\r
-    q2n1kIm = fImEBE2D[0][1][1]->GetBinContent(fImEBE2D[0][1][1]->GetBin(p,e))\r
-            * fImEBE2D[0][1][1]->GetBinEntries(fImEBE2D[0][1][1]->GetBin(p,e));\r
-   \r
-    // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  \r
-    s1p1k = pow(fs2D[0][1]->GetBinContent(fs2D[0][1]->GetBin(p,e)),1.); \r
-    s1p2k = pow(fs2D[0][2]->GetBinContent(fs2D[0][2]->GetBin(p,e)),1.); \r
-    s1p3k = pow(fs2D[0][3]->GetBinContent(fs2D[0][3]->GetBin(p,e)),1.); \r
-   \r
-    // M0111 from Eq. (118) in QC2c (to be improved (notation)):\r
-    dM0111 = mp*(dSM3p1k-3.*dSM1p1k*dSM1p2k+2.*dSM1p3k)\r
-           - 3.*(s1p1k*(dSM2p1k-dSM1p2k)\r
-           + 2.*(s1p3k-s1p2k*dSM1p1k));\r
-    //...............................................................................................   \r
-   }\r
-   \r
-   // 2'-particle correlation:\r
-   Double_t two1n1nW0W1PtEta = 0.;\r
-   if(mp*dSM1p1k-s1p1k)\r
-   {\r
-    two1n1nW0W1PtEta = (p1n0kRe*dReQ1n1k+p1n0kIm*dImQ1n1k-s1p1k)\r
-                 / (mp*dSM1p1k-s1p1k);\r
-   \r
-    // fill the 2D profile to get the average correlation for each (pt, eta) bin:\r
-    if(type == "POI")\r
-    {\r
-     //f2pPtEtaPOIW->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,two1n1nW0W1PtEta,\r
-     //                   mp*dSM1p1k-s1p1k);\r
-     fCorrelationsPro[1][1][0][0]->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,two1n1nW0W1PtEta,mp*dSM1p1k-s1p1k);\r
-    }\r
-    else if(type == "RP")\r
-    {\r
-     //f2pPtEtaRPW->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,two1n1nW0W1PtEta,\r
-     //                  mp*dSM1p1k-s1p1k); \r
-     fCorrelationsPro[0][1][0][0]->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,two1n1nW0W1PtEta,mp*dSM1p1k-s1p1k);  \r
-    }\r
-   } // end of if(mp*dMult-dmPrimePrimePtEta)\r
-   \r
-   // 4'-particle correlation:\r
-   Double_t four1n1n1n1nW0W1W1W1PtEta = 0.;\r
-   if(dM0111)\r
-   {\r
-    four1n1n1n1nW0W1W1W1PtEta = ((pow(dReQ1n1k,2.)+pow(dImQ1n1k,2.))*(p1n0kRe*dReQ1n1k+p1n0kIm*dImQ1n1k)\r
-                      - q2n1kRe*(pow(dReQ1n1k,2.)-pow(dImQ1n1k,2.))\r
-                      - 2.*q2n1kIm*dReQ1n1k*dImQ1n1k\r
-                      - p1n0kRe*(dReQ1n1k*dReQ2n2k+dImQ1n1k*dImQ2n2k)\r
-                      + p1n0kIm*(dImQ1n1k*dReQ2n2k-dReQ1n1k*dImQ2n2k)\r
-                      - 2.*dSM1p2k*(p1n0kRe*dReQ1n1k+p1n0kIm*dImQ1n1k)\r
-                      - 2.*(pow(dReQ1n1k,2.)+pow(dImQ1n1k,2.))*s1p1k                                            \r
-                      + 6.*(q1n2kRe*dReQ1n1k+q1n2kIm*dImQ1n1k)                                           \r
-                      + 1.*(q2n1kRe*dReQ2n2k+q2n1kIm*dImQ2n2k)                         \r
-                      + 2.*(p1n0kRe*dReQ1n3k+p1n0kIm*dImQ1n3k)                      \r
-                      + 2.*s1p1k*dSM1p2k                                      \r
-                      - 6.*s1p3k)        \r
-                      / dM0111; // to be imropoved (notation of dM0111)\r
-   \r
-    // fill the 2D profile to get the average correlation for each (pt, eta) bin:\r
-    if(type == "POI")\r
-    {\r
-     //f4pPtEtaPOIW->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,four1n1n1n1nW0W1W1W1PtEta,dM0111);\r
-     fCorrelationsPro[1][1][0][1]->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,four1n1n1n1nW0W1W1W1PtEta,dM0111);\r
-    }\r
-    else if(type == "RP")\r
-    {\r
-     //f4pPtEtaRPW->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,four1n1n1n1nW0W1W1W1PtEta,dM0111); \r
-     fCorrelationsPro[0][1][0][1]->Fill(fPtMin+(p-1)*fPtBinWidth,fEtaMin+(e-1)*fEtaBinWidth,four1n1n1n1nW0W1W1W1PtEta,dM0111); \r
-    }\r
-   } // end of if(dM0111)\r
-  \r
-  } // end of for(Int_t e=1;e<=fnBinsEta;e++)\r
- } // end of for(Int_t p=1;p<=fnBinsPt;p++)\r
\r
-  \r
-    \r
-      \r
-} // end of AliFlowAnalysisWithQCumulants::CalculateWeightedCorrelationsForDifferentialFlow2D(TString type)\r
-\r
-\r
-//================================================================================================================================\r
-\r
- */  \r
-\r
-/*\r
-void AliFlowAnalysisWithQCumulants::FinalizeCorrelationsForDiffFlow(TString type, Bool_t useParticleWeights, TString eventWeights)\r
-{\r
- // 1.) Access average for 2D correlations from profiles and store them in 2D final results histograms;\r
- // 2.) Access spread for 2D correlations from profiles, calculate error and store it in 2D final results histograms;\r
- // 3.) Make projections along pt and eta axis and store results and errors in 1D final results histograms. \r
\r
- Int_t typeFlag = -1;\r
- Int_t pWeightsFlag = -1;\r
- Int_t eWeightsFlag = -1;\r
-\r
- if(type == "RP")\r
- {\r
-  typeFlag = 0;\r
- } else if(type == "POI")\r
-   {\r
-    typeFlag = 1;\r
-   } else \r
-     {\r
-      cout<<"WARNING: type must be either RP or POI in AFAWQC::FCFDF() !!!!"<<endl;\r
-      exit(0);\r
-     }\r
-     \r
- if(!useParticleWeights)\r
- {\r
-  pWeightsFlag = 0;\r
- } else \r
-   {\r
-    pWeightsFlag = 1;   \r
-   }   \r
-   \r
- if(eventWeights == "exact")\r
- {\r
-  eWeightsFlag = 0;\r
- }          \r
-  \r
- // shortcuts:\r
- Int_t t = typeFlag;\r
- Int_t pW = pWeightsFlag;\r
- Int_t eW = eWeightsFlag;\r
\r
- // from 2D histogram fNonEmptyBins2D make two 1D histograms fNonEmptyBins1D in pt and eta (to be improved (i.e. moved somewhere else))  \r
- // pt:\r
- for(Int_t p=1;p<fnBinsPt;p++)\r
- {\r
-  Double_t contentPt = 0.;\r
-  for(Int_t e=1;e<=fnBinsEta;e++)\r
-  {\r
-   contentPt += (fNonEmptyBins2D[t]->GetBinContent(fNonEmptyBins2D[t]->GetBin(p,e)));          \r
-  }\r
-  fNonEmptyBins1D[t][0]->SetBinContent(p,contentPt);\r
- }\r
- // eta:\r
- for(Int_t e=1;e<fnBinsEta;e++)\r
- {\r
-  Double_t contentEta = 0.;\r
-  for(Int_t p=1;p<=fnBinsPt;p++)\r
-  {\r
-   contentEta += (fNonEmptyBins2D[t]->GetBinContent(fNonEmptyBins2D[t]->GetBin(p,e)));          \r
-  }\r
-  fNonEmptyBins1D[t][1]->SetBinContent(e,contentEta);\r
- }\r
\r
- // from 2D profile in (pt,eta) make two 1D profiles in (pt) and (eta):\r
- TProfile *profile[2][4]; // [0=pt,1=eta][correlation index] // to be improved (do not hardwire the correlation index)\r
\r
- for(Int_t pe=0;pe<2;pe++) // pt or eta\r
- {\r
-  for(Int_t ci=0;ci<4;ci++) // correlation index\r
-  {\r
-   if(pe==0) profile[pe][ci] = this->MakePtProjection(fCorrelationsPro[t][pW][eW][ci]);\r
-   if(pe==1) profile[pe][ci] = this->MakeEtaProjection(fCorrelationsPro[t][pW][eW][ci]);\r
-  }\r
- }\r
-  \r
- // transfer 2D profile into 2D histogram:\r
- // to be improved (see in documentation if there is a method to transfer values from 2D profile into 2D histogram)    \r
- for(Int_t ci=0;ci<4;ci++)\r
- {\r
-  for(Int_t p=1;p<=fnBinsPt;p++)\r
-  {\r
-   for(Int_t e=1;e<=fnBinsEta;e++)\r
-   {\r
-    Double_t correlation = fCorrelationsPro[t][pW][eW][ci]->GetBinContent(fCorrelationsPro[t][pW][eW][ci]->GetBin(p,e)); \r
-    Double_t spread = fCorrelationsPro[t][pW][eW][ci]->GetBinError(fCorrelationsPro[t][pW][eW][ci]->GetBin(p,e));\r
-    Double_t nEvts = fNonEmptyBins2D[t]->GetBinContent(fNonEmptyBins2D[t]->GetBin(p,e));\r
-    Double_t error = 0.;\r
-    fFinalCorrelations2D[t][pW][eW][ci]->SetBinContent(fFinalCorrelations2D[t][pW][eW][ci]->GetBin(p,e),correlation);          \r
-    if(nEvts>0)\r
-    {\r
-     error = spread/pow(nEvts,0.5);\r
-     fFinalCorrelations2D[t][pW][eW][ci]->SetBinError(fFinalCorrelations2D[t][pW][eW][ci]->GetBin(p,e),error);\r
-    }\r
-   } // end of for(Int_t e=1;e<=fnBinsEta;e++)\r
-  } // end of for(Int_t p=1;p<=fnBinsPt;p++)\r
- } // end of for(Int_t ci=0;ci<4;ci++)\r
\r
- // transfer 1D profile into 1D histogram (pt):\r
- // to be improved (see in documentation if there is a method to transfer values from 1D profile into 1D histogram)    \r
- for(Int_t ci=0;ci<4;ci++)\r
- {\r
-  for(Int_t p=1;p<=fnBinsPt;p++)\r
-  {\r
-   if(profile[0][ci])\r
-   {\r
-    Double_t correlation = profile[0][ci]->GetBinContent(p); \r
-    Double_t spread = profile[0][ci]->GetBinError(p);\r
-    Double_t nEvts = fNonEmptyBins1D[t][0]->GetBinContent(p);\r
-    Double_t error = 0.;\r
-    fFinalCorrelations1D[t][pW][eW][0][ci]->SetBinContent(p,correlation); \r
-    if(nEvts>0)\r
-    {\r
-     error = spread/pow(nEvts,0.5);\r
-     fFinalCorrelations1D[t][pW][eW][0][ci]->SetBinError(p,error);\r
-    }  \r
-   }   \r
-  } // end of for(Int_t p=1;p<=fnBinsPt;p++)\r
- } // end of for(Int_t ci=0;ci<4;ci++)\r
\r
- // transfer 1D profile into 1D histogram (eta):\r
- // to be improved (see in documentation if there is a method to transfer values from 1D profile into 1D histogram)    \r
- for(Int_t ci=0;ci<4;ci++)\r
- {\r
-  for(Int_t e=1;e<=fnBinsEta;e++)\r
-  {\r
-   if(profile[1][ci])\r
-   {\r
-    Double_t correlation = profile[1][ci]->GetBinContent(e); \r
-    fFinalCorrelations1D[t][pW][eW][1][ci]->SetBinContent(e,correlation);      \r
-   }    \r
-  } // end of for(Int_t e=1;e<=fnBinsEta;e++)\r
- } // end of for(Int_t ci=0;ci<4;ci++)\r
-        \r
-} // end of void AliFlowAnalysisWithQCumulants::FinalizeCorrelationsForDiffFlow(TString type, Bool_t useParticleWeights, TString eventWeights)\r
-*/\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCumulants(TString type, TString ptOrEta)\r
-{\r
- // calcualate cumulants for differential flow from measured correlations\r
- // Remark: cumulants calculated here are NOT corrected for non-uniform acceptance. This correction is applied in the method ...\r
- // to be improved (description) \r
\r
- Int_t typeFlag = -1;\r
- Int_t ptEtaFlag = -1;\r
-\r
- if(type == "RP")\r
- {\r
-  typeFlag = 0;\r
- } else if(type == "POI")\r
-   {\r
-    typeFlag = 1;\r
-   } \r
-     \r
- if(ptOrEta == "Pt")\r
- {\r
-  ptEtaFlag = 0;\r
- } else if(ptOrEta == "Eta")\r
-   {\r
-    ptEtaFlag = 1;\r
-   } \r
-  \r
- // shortcuts:\r
- Int_t t = typeFlag;\r
- Int_t pe = ptEtaFlag;\r
-     \r
- // common:\r
- Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};\r
\r
- // correlation <<2>>: \r
- Double_t two = fIntFlowCorrelationsHist->GetBinContent(1);\r
\r
- // 1D:\r
- for(Int_t b=1;b<=nBinsPtEta[pe];b++)\r
- {\r
-  // reduced correlations:   \r
-  Double_t twoPrime = fDiffFlowCorrelationsHist[t][pe][0]->GetBinContent(b); // <<2'>>(pt)\r
-  Double_t fourPrime = fDiffFlowCorrelationsHist[t][pe][1]->GetBinContent(b); // <<4'>>(pt)\r
-  // final statistical error of reduced correlations:\r
-  //Double_t twoPrimeError = fFinalCorrelations1D[t][pW][eW][0][0]->GetBinError(p); \r
-  // QC{2'}:\r
-  Double_t qc2Prime = twoPrime; // QC{2'}\r
-  //Double_t qc2PrimeError = twoPrimeError; // final stat. error of QC{2'}\r
-  fDiffFlowCumulants[t][pe][0]->SetBinContent(b,qc2Prime); \r
-  //fFinalCumulantsPt[t][pW][eW][nua][0]->SetBinError(p,qc2PrimeError);   \r
-  // QC{4'}:\r
-  Double_t qc4Prime = fourPrime - 2.*twoPrime*two; // QC{4'} = <<4'>> - 2*<<2'>><<2>>\r
-  fDiffFlowCumulants[t][pe][1]->SetBinContent(b,qc4Prime); \r
- } // end of for(Int_t p=1;p<=fnBinsPt;p++)\r
\r
-    \r
- /* \r
- // 2D (pt,eta):\r
- // to be improved (see documentation if I can do all this without looping)\r
- for(Int_t p=1;p<=fnBinsPt;p++)\r
- {\r
-  for(Int_t e=1;e<=fnBinsEta;e++) \r
-  {  \r
-   // reduced correlations:   \r
-   Double_t twoPrime = fFinalCorrelations2D[t][pW][eW][0]->GetBinContent(fFinalCorrelations2D[t][pW][eW][0]->GetBin(p,e)); // <<2'>>(pt,eta)\r
-   Double_t fourPrime = fFinalCorrelations2D[t][pW][eW][1]->GetBinContent(fFinalCorrelations2D[t][pW][eW][1]->GetBin(p,e)); // <<4'>>(pt,eta)\r
-   for(Int_t nua=0;nua<2;nua++)\r
-   {\r
-    // QC{2'}:\r
-    Double_t qc2Prime = twoPrime; // QC{2'} = <<2'>>\r
-    fFinalCumulants2D[t][pW][eW][nua][0]->SetBinContent(fFinalCumulants2D[t][pW][eW][nua][0]->GetBin(p,e),qc2Prime);    \r
-    // QC{4'}:\r
-    Double_t qc4Prime = fourPrime - 2.*twoPrime*two; // QC{4'} = <<4'>> - 2*<<2'>><<2>>\r
-    fFinalCumulants2D[t][pW][eW][nua][1]->SetBinContent(fFinalCumulants2D[t][pW][eW][nua][1]->GetBin(p,e),qc4Prime);   \r
-   } // end of for(Int_t nua=0;nua<2;nua++)   \r
-  } // end of for(Int_t e=1;e<=fnBinsEta;e++)\r
- } // end of for(Int_t p=1;p<=fnBinsPt;p++)\r
- */\r
-   \r
-} // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCumulants(TString type, Bool_t useParticleWeights, TString eventWeights); \r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::CalculateFinalResultsForRPandPOIIntegratedFlow(TString type)\r
-{\r
- // calculate final results for integrated flow of RPs and POIs \r
-  \r
- Int_t typeFlag = -1;\r
-\r
- if(type == "RP")\r
- {\r
-  typeFlag = 0;\r
- } else if(type == "POI")\r
-   {\r
-    typeFlag = 1;\r
-   } else \r
-     {\r
-      cout<<"WARNING: type must be either RP or POI in AFAWQC::CDF() !!!!"<<endl;\r
-      exit(0);\r
-     }\r
-     \r
- // shortcuts:\r
- Int_t t = typeFlag;\r
-  \r
- // pt yield:    \r
- TH1F *yield2ndPt = NULL;\r
- TH1F *yield4thPt = NULL;\r
- TH1F *yield6thPt = NULL;\r
- TH1F *yield8thPt = NULL;\r
\r
- if(type == "POI")\r
- {\r
-  yield2ndPt = (TH1F*)(fCommonHists2nd->GetHistPtPOI())->Clone();\r
-  yield4thPt = (TH1F*)(fCommonHists4th->GetHistPtPOI())->Clone();\r
-  yield6thPt = (TH1F*)(fCommonHists6th->GetHistPtPOI())->Clone();\r
-  yield8thPt = (TH1F*)(fCommonHists8th->GetHistPtPOI())->Clone();  \r
- } \r
- else if(type == "RP")\r
- {\r
-  yield2ndPt = (TH1F*)(fCommonHists2nd->GetHistPtRP())->Clone();\r
-  yield4thPt = (TH1F*)(fCommonHists4th->GetHistPtRP())->Clone();\r
-  yield6thPt = (TH1F*)(fCommonHists6th->GetHistPtRP())->Clone();\r
-  yield8thPt = (TH1F*)(fCommonHists8th->GetHistPtRP())->Clone();  \r
- } \r
\r
- Int_t nBinsPt = yield2ndPt->GetNbinsX();\r
\r
- TH1D *flow2ndPt = NULL;\r
- TH1D *flow4thPt = NULL;\r
- TH1D *flow6thPt = NULL;\r
- TH1D *flow8thPt = NULL;\r
\r
- // to be improved (hardwired pt index)\r
- flow2ndPt = (TH1D*)fDiffFlow[t][0][0]->Clone();\r
- flow4thPt = (TH1D*)fDiffFlow[t][0][1]->Clone();\r
- flow6thPt = (TH1D*)fDiffFlow[t][0][2]->Clone();\r
- flow8thPt = (TH1D*)fDiffFlow[t][0][3]->Clone(); \r
-   \r
- Double_t dvn2nd = 0., dvn4th = 0., dvn6th = 0., dvn8th = 0.; // differential flow\r
- Double_t dErrvn2nd = 0., dErrvn4th = 0., dErrvn6th = 0., dErrvn8th = 0.; // error on differential flow\r
\r
- Double_t dVn2nd = 0., dVn4th = 0., dVn6th = 0., dVn8th = 0.; // integrated flow \r
- Double_t dErrVn2nd = 0., dErrVn4th = 0., dErrVn6th = 0., dErrVn8th = 0.; // error on integrated flow\r
-\r
- Double_t dYield2nd = 0., dYield4th = 0., dYield6th = 0., dYield8th = 0.; // pt yield \r
- Double_t dSum2nd = 0., dSum4th = 0., dSum6th = 0., dSum8th = 0.; // needed for normalizing integrated flow\r
\r
- // looping over pt bins:\r
- for(Int_t p=1;p<nBinsPt+1;p++)\r
- {\r
-  dvn2nd = flow2ndPt->GetBinContent(p);\r
-  dvn4th = flow4thPt->GetBinContent(p);\r
-  dvn6th = flow6thPt->GetBinContent(p);\r
-  dvn8th = flow8thPt->GetBinContent(p);\r
-  \r
-  dErrvn2nd = flow2ndPt->GetBinError(p);\r
-  dErrvn4th = flow4thPt->GetBinError(p);\r
-  dErrvn6th = flow6thPt->GetBinError(p);\r
-  dErrvn8th = flow8thPt->GetBinError(p);\r
-\r
-  dYield2nd = yield2ndPt->GetBinContent(p);  \r
-  dYield4th = yield4thPt->GetBinContent(p);\r
-  dYield6th = yield6thPt->GetBinContent(p);\r
-  dYield8th = yield8thPt->GetBinContent(p);\r
-  \r
-  dVn2nd += dvn2nd*dYield2nd;\r
-  dVn4th += dvn4th*dYield4th;\r
-  dVn6th += dvn6th*dYield6th;\r
-  dVn8th += dvn8th*dYield8th;\r
-  \r
-  dSum2nd += dYield2nd;\r
-  dSum4th += dYield4th;\r
-  dSum6th += dYield6th;\r
-  dSum8th += dYield8th;\r
-  \r
-  dErrVn2nd += dYield2nd*dYield2nd*dErrvn2nd*dErrvn2nd; // ro be improved (check this relation)\r
-  dErrVn4th += dYield4th*dYield4th*dErrvn4th*dErrvn4th;\r
-  dErrVn6th += dYield6th*dYield6th*dErrvn6th*dErrvn6th;\r
-  dErrVn8th += dYield8th*dYield8th*dErrvn8th*dErrvn8th;\r
-    \r
- } // end of for(Int_t p=1;p<nBinsPt+1;p++)\r
-\r
- // normalizing the results for integrated flow:\r
- if(dSum2nd) \r
- {\r
-  dVn2nd /= dSum2nd;\r
-  dErrVn2nd /= (dSum2nd*dSum2nd);\r
-  dErrVn2nd = TMath::Sqrt(dErrVn2nd);\r
- } \r
- if(dSum4th) \r
- {\r
-  dVn4th /= dSum4th;\r
-  dErrVn4th /= (dSum4th*dSum4th);\r
-  dErrVn4th = TMath::Sqrt(dErrVn4th);\r
- } \r
- //if(dSum6th) dVn6th/=dSum6th;\r
- //if(dSum8th) dVn8th/=dSum8th;\r
-  \r
- // storing the results for integrated flow in common histos: (to be improved: new method for this?)\r
- if(type == "POI")\r
- {\r
-  fCommonHistsResults2nd->FillIntegratedFlowPOI(dVn2nd,dErrVn2nd); \r
-  fCommonHistsResults4th->FillIntegratedFlowPOI(dVn4th,dErrVn4th); \r
-  fCommonHistsResults6th->FillIntegratedFlowPOI(dVn6th,0.); // to be improved (errors)\r
-  fCommonHistsResults8th->FillIntegratedFlowPOI(dVn8th,0.); // to be improved (errors)\r
- }\r
- else if (type == "RP")\r
- {\r
-  fCommonHistsResults2nd->FillIntegratedFlowRP(dVn2nd,dErrVn2nd); \r
-  fCommonHistsResults4th->FillIntegratedFlowRP(dVn4th,dErrVn4th);\r
-  fCommonHistsResults6th->FillIntegratedFlowRP(dVn6th,0.); // to be improved (errors)\r
-  fCommonHistsResults8th->FillIntegratedFlowRP(dVn8th,0.); // to be improved (errors)\r
- }\r
\r
- delete flow2ndPt;\r
- delete flow4thPt;\r
- //delete flow6thPt;\r
- //delete flow8thPt;\r
\r
- delete yield2ndPt;\r
- delete yield4thPt;\r
- delete yield6thPt;\r
- delete yield8thPt;\r
-           \r
-} // end of AliFlowAnalysisWithQCumulants::CalculateFinalResultsForRPandPOIIntegratedFlow(TString type)\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::InitializeArraysForDistributions()\r
-{\r
- // initialize arrays used for distributions:\r
\r
- /*\r
\r
- for(Int_t pW=0;pW<2;pW++) // particle weights not used (0) or used (1)\r
- {\r
-  for(Int_t eW=0;eW<2;eW++)\r
-  {\r
-   for(Int_t di=0;di<4;di++) // distribution index\r
-   {\r
-    fDistributions[pW][eW][di] = NULL;\r
-   }\r
-  } \r
- }\r
\r
- */\r
\r
-} // end of void AliFlowAnalysisWithQCumulants::InitializeArraysForDistributions()\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::BookEverythingForDistributions()\r
-{\r
- // book all histograms for distributions\r
\r
- /*\r
- //weighted <2>_{n|n} distribution\r
- f2pDistribution = new TH1D("f2pDistribution","<2>_{n|n} distribution",100000,-0.02,0.1);\r
- f2pDistribution->SetXTitle("<2>_{n|n}");\r
- f2pDistribution->SetYTitle("Counts");\r
- fHistList->Add(f2pDistribution);\r
-\r
- //weighted <4>_{n,n|n,n} distribution\r
- f4pDistribution = new TH1D("f4pDistribution","<4>_{n,n|n,n} distribution",100000,-0.00025,0.002);\r
- f4pDistribution->SetXTitle("<4>_{n,n|n,n}");\r
- f4pDistribution->SetYTitle("Counts");\r
- fHistList->Add(f4pDistribution); \r
\r
- //weighted <6>_{n,n,n|n,n,n} distribution\r
- f6pDistribution = new TH1D("f6pDistribution","<6>_{n,n,n|n,n,n} distribution",100000,-0.000005,0.000025);\r
- f6pDistribution->SetXTitle("<6>_{n,n,n|n,n,n}");\r
- f6pDistribution->SetYTitle("Counts");\r
- fHistList->Add(f6pDistribution);\r
\r
- //weighted <8>_{n,n,n,n|n,n,n,n} distribution\r
- f8pDistribution = new TH1D("f8pDistribution","<8>_{n,n,n,n|n,n,n,n} distribution",100000,-0.000000001,0.00000001);\r
- f8pDistribution->SetXTitle("<8>_{n,n,n,n|n,n,n,n}");\r
- f8pDistribution->SetYTitle("Counts");\r
- fHistList->Add(f8pDistribution);\r
- */\r
\r
-} // end of void AliFlowAnalysisWithQCumulants::BookEverythingForDistributions()\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::BookAndNestAllLists()\r
-{\r
- // Book and nest all lists nested in the base list fHistList.\r
- //  a) Book and nest lists for integrated flow;\r
- //  b) Book and nest lists for differential flow;\r
- //  c) Book and nest list for particle weights;\r
- //  d) Book and nest list for distributions;\r
- //  e) Book and nest list for nested loops;\r
\r
- // a) Book and nest all lists for integrated flow:\r
- // base list for integrated flow:\r
- fIntFlowList = new TList();\r
- fIntFlowList->SetName("Integrated Flow");\r
- fIntFlowList->SetOwner(kTRUE);\r
- fHistList->Add(fIntFlowList);\r
- // list holding profiles: \r
- fIntFlowProfiles = new TList();\r
- fIntFlowProfiles->SetName("Profiles");\r
- fIntFlowProfiles->SetOwner(kTRUE);\r
- fIntFlowList->Add(fIntFlowProfiles);\r
- // list holding histograms with results:\r
- fIntFlowResults = new TList();\r
- fIntFlowResults->SetName("Results");\r
- fIntFlowResults->SetOwner(kTRUE);\r
- fIntFlowList->Add(fIntFlowResults);\r
\r
- // b) Book and nest lists for differential flow;\r
- fDiffFlowList = new TList();\r
- fDiffFlowList->SetName("Differential Flow");\r
- fDiffFlowList->SetOwner(kTRUE); \r
- fHistList->Add(fDiffFlowList);\r
- // list holding profiles: \r
- fDiffFlowProfiles = new TList(); \r
- fDiffFlowProfiles->SetName("Profiles");\r
- fDiffFlowProfiles->SetOwner(kTRUE);\r
- fDiffFlowList->Add(fDiffFlowProfiles);\r
- // list holding histograms with results: \r
- fDiffFlowResults = new TList();\r
- fDiffFlowResults->SetName("Results");\r
- fDiffFlowResults->SetOwner(kTRUE);\r
- fDiffFlowList->Add(fDiffFlowResults);\r
- // flags used for naming nested lists in list fDiffFlowProfiles and fDiffFlowResults:  \r
- TList list;\r
- list.SetOwner(kTRUE);\r
- TString typeFlag[2] = {"RP","POI"};  \r
- TString ptEtaFlag[2] = {"p_{T}","#eta"}; \r
- TString powerFlag[2] = {"linear","quadratic"};   \r
- // nested lists in fDiffFlowProfiles (~/Differential Flow/Profiles):\r
- for(Int_t t=0;t<2;t++) // type: RP or POI\r
- {\r
-  for(Int_t pe=0;pe<2;pe++) // pt or eta\r
-  {\r
-   // list holding profiles with correlations:\r
-   fDiffFlowCorrelationsProList[t][pe] = (TList*)list.Clone();\r
-   fDiffFlowCorrelationsProList[t][pe]->SetName(Form("Profiles with correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));\r
-   fDiffFlowProfiles->Add(fDiffFlowCorrelationsProList[t][pe]);\r
-   // list holding profiles with products of correlations:\r
-   fDiffFlowProductOfCorrelationsProList[t][pe] = (TList*)list.Clone();\r
-   fDiffFlowProductOfCorrelationsProList[t][pe]->SetName(Form("Profiles with products of correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));\r
-   fDiffFlowProfiles->Add(fDiffFlowProductOfCorrelationsProList[t][pe]);\r
-   // list holding profiles with corrections:\r
-   fDiffFlowCorrectionsProList[t][pe] = (TList*)list.Clone();\r
-   fDiffFlowCorrectionsProList[t][pe]->SetName(Form("Profiles with correction terms for NUA (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));\r
-   fDiffFlowProfiles->Add(fDiffFlowCorrectionsProList[t][pe]);   \r
-  } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta \r
- } // end of for(Int_t t=0;t<2;t++) // type: RP or POI   \r
- // nested lists in fDiffFlowResults (~/Differential Flow/Results):\r
- for(Int_t t=0;t<2;t++) // type: RP or POI\r
- {\r
-  for(Int_t pe=0;pe<2;pe++) // pt or eta\r
-  {\r
-   // list holding histograms with correlations:\r
-   fDiffFlowCorrelationsHistList[t][pe] = (TList*)list.Clone();\r
-   fDiffFlowCorrelationsHistList[t][pe]->SetName(Form("Correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));\r
-   fDiffFlowResults->Add(fDiffFlowCorrelationsHistList[t][pe]);\r
-   // list holding histograms with corrections:\r
-   fDiffFlowCorrectionsHistList[t][pe] = (TList*)list.Clone();\r
-   fDiffFlowCorrectionsHistList[t][pe]->SetName(Form("Histograms with correction terms for NUA (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));\r
-   fDiffFlowResults->Add(fDiffFlowCorrectionsHistList[t][pe]);   \r
-   for(Int_t power=0;power<2;power++)\r
-   {\r
-    // list holding histograms with sums of event weights:\r
-    fDiffFlowSumOfEventWeightsHistList[t][pe][power] = (TList*)list.Clone();\r
-    fDiffFlowSumOfEventWeightsHistList[t][pe][power]->SetName(Form("Sum of %s event weights (%s, %s)",powerFlag[power].Data(),typeFlag[t].Data(),ptEtaFlag[pe].Data()));\r
-    fDiffFlowResults->Add(fDiffFlowSumOfEventWeightsHistList[t][pe][power]);    \r
-   } // end of for(Int_t power=0;power<2;power++)\r
-   // list holding histograms with sums of products of event weights:\r
-   fDiffFlowSumOfProductOfEventWeightsHistList[t][pe] = (TList*)list.Clone();\r
-   fDiffFlowSumOfProductOfEventWeightsHistList[t][pe]->SetName(Form("Sum of products of event weights (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));\r
-   fDiffFlowResults->Add(fDiffFlowSumOfProductOfEventWeightsHistList[t][pe]);\r
-   // list holding histograms with covariances of correlations:\r
-   fDiffFlowCovariancesHistList[t][pe] = (TList*)list.Clone();\r
-   fDiffFlowCovariancesHistList[t][pe]->SetName(Form("Covariances of correlations (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));\r
-   fDiffFlowResults->Add(fDiffFlowCovariancesHistList[t][pe]);\r
-   // list holding histograms with differential Q-cumulants:\r
-   fDiffFlowCumulantsHistList[t][pe] = (TList*)list.Clone();\r
-   fDiffFlowCumulantsHistList[t][pe]->SetName(Form("Differential Q-cumulants (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));\r
-   fDiffFlowResults->Add(fDiffFlowCumulantsHistList[t][pe]);   \r
-   // list holding histograms with differential flow estimates from Q-cumulants:\r
-   fDiffFlowHistList[t][pe] = (TList*)list.Clone();\r
-   fDiffFlowHistList[t][pe]->SetName(Form("Differential flow (%s, %s)",typeFlag[t].Data(),ptEtaFlag[pe].Data()));\r
-   fDiffFlowResults->Add(fDiffFlowHistList[t][pe]);      \r
-  } // end of for(Int_t pe=0;pe<2;pe++) // pt or eta\r
- } // end of for(Int_t t=0;t<2;t++) // type: RP or POI\r
-  \r
- // c) Book and nest list for particle weights:\r
- fWeightsList->SetName("Weights");\r
- fWeightsList->SetOwner(kTRUE);   \r
- fHistList->Add(fWeightsList); \r
-\r
- // d) Book and nest list for distributions:\r
- fDistributionsList = new TList();\r
- fDistributionsList->SetName("Distributions");\r
- fDistributionsList->SetOwner(kTRUE);\r
- fHistList->Add(fDistributionsList);\r
\r
- // e) Book and nest list for nested loops:\r
- fNestedLoopsList = new TList();\r
- fNestedLoopsList->SetName("Nested Loops");\r
- fNestedLoopsList->SetOwner(kTRUE);\r
- fHistList->Add(fNestedLoopsList);\r
\r
-} // end of void AliFlowAnalysisWithQCumulants::BookAndNestAllLists()\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::FillCommonHistResultsDiffFlow(TString type)\r
-{\r
- // fill common result histograms for differential flow\r
\r
- Int_t typeFlag = -1;\r
- //Int_t ptEtaFlag = -1;\r
-\r
- if(type == "RP")\r
- {\r
-  typeFlag = 0;\r
- } else if(type == "POI")\r
-   {\r
-    typeFlag = 1;\r
-   } \r
-  \r
- // shortcuts:\r
- Int_t t = typeFlag;\r
- //Int_t pe = ptEtaFlag;\r
-\r
- // to be improved (implement protection here)\r
-     \r
- if(!(fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th))\r
- {\r
-  cout<<"WARNING: fCommonHistsResults2nd && fCommonHistsResults4th && fCommonHistsResults6th && fCommonHistsResults8th"<<endl; \r
-  cout<<"         is NULL in AFAWQC::FCHRIF() !!!!"<<endl;\r
-  exit(0);\r
- }\r
\r
- // pt:\r
- for(Int_t p=1;p<=fnBinsPt;p++)\r
- {\r
-  Double_t v2 = fDiffFlow[t][0][0]->GetBinContent(p);\r
-  Double_t v4 = fDiffFlow[t][0][1]->GetBinContent(p);\r
-  Double_t v6 = fDiffFlow[t][0][2]->GetBinContent(p);\r
-  Double_t v8 = fDiffFlow[t][0][3]->GetBinContent(p);\r
-  \r
-  Double_t v2Error = fDiffFlow[t][0][0]->GetBinError(p);\r
-  Double_t v4Error = fDiffFlow[t][0][1]->GetBinError(p);\r
-  //Double_t v6Error = fFinalFlow1D[t][pW][nua][0][2]->GetBinError(p);\r
-  //Double_t v8Error = fFinalFlow1D[t][pW][nua][0][3]->GetBinError(p);\r
\r
-  if(type == "RP")\r
-  {\r
-   fCommonHistsResults2nd->FillDifferentialFlowPtRP(p,v2,v2Error);\r
-   fCommonHistsResults4th->FillDifferentialFlowPtRP(p,v4,v4Error);\r
-   fCommonHistsResults6th->FillDifferentialFlowPtRP(p,v6,0.);\r
-   fCommonHistsResults8th->FillDifferentialFlowPtRP(p,v8,0.);\r
-  } else if(type == "POI")\r
-    {\r
-     fCommonHistsResults2nd->FillDifferentialFlowPtPOI(p,v2,v2Error);\r
-     fCommonHistsResults4th->FillDifferentialFlowPtPOI(p,v4,v4Error);\r
-     fCommonHistsResults6th->FillDifferentialFlowPtPOI(p,v6,0.);\r
-     fCommonHistsResults8th->FillDifferentialFlowPtPOI(p,v8,0.);\r
-    }\r
- } // end of for(Int_t p=1;p<=fnBinsPt;p++)   \r
\r
- // eta:\r
- for(Int_t e=1;e<=fnBinsEta;e++)\r
- {\r
-  Double_t v2 = fDiffFlow[t][1][0]->GetBinContent(e);\r
-  Double_t v4 = fDiffFlow[t][1][1]->GetBinContent(e);\r
-  Double_t v6 = fDiffFlow[t][1][2]->GetBinContent(e);\r
-  Double_t v8 = fDiffFlow[t][1][3]->GetBinContent(e);\r
-  \r
-  Double_t v2Error = fDiffFlow[t][1][0]->GetBinError(e);\r
-  Double_t v4Error = fDiffFlow[t][1][1]->GetBinError(e);\r
-  //Double_t v6Error = fDiffFlow[t][1][2]->GetBinError(e);\r
-  //Double_t v8Error = fDiffFlow[t][1][3]->GetBinError(e);\r
\r
-  if(type == "RP")\r
-  {\r
-   fCommonHistsResults2nd->FillDifferentialFlowEtaRP(e,v2,v2Error);\r
-   fCommonHistsResults4th->FillDifferentialFlowEtaRP(e,v4,v4Error);\r
-   fCommonHistsResults6th->FillDifferentialFlowEtaRP(e,v6,0.);\r
-   fCommonHistsResults8th->FillDifferentialFlowEtaRP(e,v8,0.);\r
-  } else if(type == "POI")\r
-    {\r
-     fCommonHistsResults2nd->FillDifferentialFlowEtaPOI(e,v2,v2Error);\r
-     fCommonHistsResults4th->FillDifferentialFlowEtaPOI(e,v4,v4Error);\r
-     fCommonHistsResults6th->FillDifferentialFlowEtaPOI(e,v6,0.);\r
-     fCommonHistsResults8th->FillDifferentialFlowEtaPOI(e,v8,0.);\r
-    }\r
- } // end of for(Int_t e=1;e<=fnBinsEta;e++)    \r
\r
-} // end of void AliFlowAnalysisWithQCumulants::FillCommonHistResultsDiffFlow(TString type, Bool_t useParticleWeights, TString eventWeights, Bool_t correctedForNUA)\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::AccessConstants()\r
-{\r
- // access needed common constants from AliFlowCommonConstants\r
\r
- fnBinsPhi = AliFlowCommonConstants::GetMaster()->GetNbinsPhi();\r
- fPhiMin = AliFlowCommonConstants::GetMaster()->GetPhiMin();        \r
- fPhiMax = AliFlowCommonConstants::GetMaster()->GetPhiMax();\r
- if(fnBinsPhi) fPhiBinWidth = (fPhiMax-fPhiMin)/fnBinsPhi;  \r
- fnBinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();\r
- fPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();          \r
- fPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();\r
- if(fnBinsPt) fPtBinWidth = (fPtMax-fPtMin)/fnBinsPt;  \r
- fnBinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();\r
- fEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();        \r
- fEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();\r
- if(fnBinsEta) fEtaBinWidth = (fEtaMax-fEtaMin)/fnBinsEta;  \r
\r
-} // end of void AliFlowAnalysisWithQCumulants::AccessConstants()\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfEventWeights()\r
-{\r
- // Calculate sum of linear and quadratic event weights for correlations\r
\r
\r
- /*\r
- Double_t dMult = (*fSMpk)(0,0); // multiplicity \r
-\r
- Double_t eventWeight[4] = {0}; \r
\r
- if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights))\r
- {\r
-  eventWeight[0] = dMult*(dMult-1); // event weight for <2> \r
-  eventWeight[1] = dMult*(dMult-1)*(dMult-2)*(dMult-3); // event weight for <4> \r
-  eventWeight[2] = dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-4)*(dMult-5); // event weight for <6> \r
-  eventWeight[3] = dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-4)*(dMult-5)*(dMult-6)*(dMult-7); // event weight for <8> \r
- } else\r
-   {\r
-    eventWeight[0] = (*fSMpk)(1,1)-(*fSMpk)(0,2); // dM11 = sum_{i,j=1,i!=j}^M w_i w_j;\r
-    eventWeight[1] = (*fSMpk)(3,1)-6.*(*fSMpk)(0,2)*(*fSMpk)(1,1)  \r
-                   + 8.*(*fSMpk)(0,3)*(*fSMpk)(0,1)\r
-                   + 3.*(*fSMpk)(1,2)-6.*(*fSMpk)(0,4); // dM1111 = sum_{i,j,k,l=1,i!=j!=k!=l}^M w_i w_j w_k w_l\r
-    //eventWeight[2] = ... // to be improved (calculated)               \r
-    //eventWeight[3] = ... // to be improved (calculated)              \r
-   }\r
- */\r
-        \r
-                      \r
- for(Int_t p=0;p<2;p++) // power-1\r
- {\r
-  for(Int_t ci=0;ci<4;ci++) // correlation index\r
-  { \r
-   fIntFlowSumOfEventWeights[p]->Fill(ci+0.5,pow(fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci+1),p+1)); \r
-  }\r
- }\r
-  \r
-} // end of void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfEventWeights()\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::CalculateIntFlowSumOfProductOfEventWeights()\r
-{\r
- // Calculate sum of product of event weights for correlations\r
\r
\r
- /*\r
- Double_t dMult = (*fSMpk)(0,0); // multiplicity \r
-\r
- Double_t eventWeight[4] = {0}; \r
\r
- if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights))\r
- {\r
-  eventWeight[0] = dMult*(dMult-1); // event weight for <2> \r
-  eventWeight[1] = dMult*(dMult-1)*(dMult-2)*(dMult-3); // event weight for <4> \r
-  eventWeight[2] = dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-4)*(dMult-5); // event weight for <6> \r
-  eventWeight[3] = dMult*(dMult-1)*(dMult-2)*(dMult-3)*(dMult-4)*(dMult-5)*(dMult-6)*(dMult-7); // event weight for <8> \r
- } else\r
-   {\r
-    eventWeight[0] = (*fSMpk)(1,1)-(*fSMpk)(0,2); // dM11 = sum_{i,j=1,i!=j}^M w_i w_j;\r
-    eventWeight[1] = (*fSMpk)(3,1)-6.*(*fSMpk)(0,2)*(*fSMpk)(1,1)  \r
-                   + 8.*(*fSMpk)(0,3)*(*fSMpk)(0,1)\r
-                   + 3.*(*fSMpk)(1,2)-6.*(*fSMpk)(0,4); // dM1111 = sum_{i,j,k,l=1,i!=j!=k!=l}^M w_i w_j w_k w_l\r
-    //eventWeight[2] = ... // to be improved (calculated)               \r
-    //eventWeight[3] = ... // to be improved (calculated)              \r
-   }\r
-\r
- fIntFlowSumOfProductOfEventWeights->Fill(0.5,eventWeight[0]*eventWeight[1]); \r
- fIntFlowSumOfProductOfEventWeights->Fill(1.5,eventWeight[0]*eventWeight[2]); \r
- fIntFlowSumOfProductOfEventWeights->Fill(2.5,eventWeight[0]*eventWeight[3]); \r
- fIntFlowSumOfProductOfEventWeights->Fill(3.5,eventWeight[1]*eventWeight[2]); \r
- fIntFlowSumOfProductOfEventWeights->Fill(4.5,eventWeight[1]*eventWeight[3]); \r
- fIntFlowSumOfProductOfEventWeights->Fill(5.5,eventWeight[2]*eventWeight[3]); \r
- */\r
-  \r
\r
- Int_t counter = 0;\r
\r
- for(Int_t ci1=1;ci1<4;ci1++)\r
- {\r
-  for(Int_t ci2=ci1+1;ci2<=4;ci2++)\r
-  {\r
-   fIntFlowSumOfProductOfEventWeights->Fill(0.5+counter++,\r
-                                            fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci1)*fIntFlowEventWeightsForCorrelationsEBE->GetBinContent(ci2));\r
-  }\r
- }\r
-\r
\r
-\r
-} // end of void AliFlowAnalysisWithQCumulants::CalculateIntFlowIntFlowSumOfProductOfEventWeights()\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrelations(TString type, TString ptOrEta)\r
-{\r
- // calculate reduced correlations for RPs or POIs in pt or eta bins\r
-\r
- // multiplicity:\r
- Double_t dMult = (*fSMpk)(0,0);\r
\r
- // real and imaginary parts of non-weighted Q-vectors evaluated in harmonics n, 2n, 3n and 4n: \r
- Double_t dReQ1n = (*fReQ)(0,0);\r
- Double_t dReQ2n = (*fReQ)(1,0);\r
- //Double_t dReQ3n = (*fReQ)(2,0);\r
- //Double_t dReQ4n = (*fReQ)(3,0);\r
- Double_t dImQ1n = (*fImQ)(0,0);\r
- Double_t dImQ2n = (*fImQ)(1,0);\r
- //Double_t dImQ3n = (*fImQ)(2,0);\r
- //Double_t dImQ4n = (*fImQ)(3,0);\r
-\r
- // reduced correlations are stored in fDiffFlowCorrelationsPro[0=RP,1=POI][0=pt,1=eta][correlation index]. Correlation index runs as follows:\r
- // \r
- // 0: <<2'>>\r
- // 1: <<4'>>\r
- // 2: <<6'>>\r
- // 3: <<8'>>\r
\r
- Int_t t = -1; // type flag \r
- Int_t pe = -1; // ptEta flag\r
\r
- if(type == "RP")\r
- {\r
-  t = 0;\r
- } else if(type == "POI")\r
-   {\r
-    t = 1;\r
-   }\r
-\r
- if(ptOrEta == "Pt")\r
- {\r
-  pe = 0;\r
- } else if(ptOrEta == "Eta")\r
-   {\r
-    pe = 1;\r
-   }\r
-    \r
- Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};\r
- Double_t minPtEta[2] = {fPtMin,fEtaMin};\r
- //Double_t maxPtEta[2] = {fPtMax,fEtaMax};\r
- Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};\r
-\r
- // looping over all bins and calculating reduced correlations: \r
- for(Int_t b=1;b<=nBinsPtEta[pe];b++)\r
- {\r
-  // real and imaginary parts of p_{m*n,0} (non-weighted Q-vector evaluated for POIs in particular pt or eta bin): \r
-  Double_t p1n0kRe = 0.;\r
-  Double_t p1n0kIm = 0.;\r
-\r
-  // number of POIs in particular pt or eta bin:\r
-  Double_t mp = 0.;\r
-\r
-  // 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):\r
-  Double_t q1n0kRe = 0.;\r
-  Double_t q1n0kIm = 0.;\r
-  Double_t q2n0kRe = 0.;\r
-  Double_t q2n0kIm = 0.;\r
-\r
-  // number of particles which are both RPs and POIs in particular pt or eta bin:\r
-  Double_t mq = 0.;\r
-   \r
-  if(type == "POI")\r
-  {\r
-   // q_{m*n,0}:\r
-   q1n0kRe = fReRPQ1dEBE[2][pe][0][0]->GetBinContent(fReRPQ1dEBE[2][pe][0][0]->GetBin(b))\r
-           * fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b));\r
-   q1n0kIm = fImRPQ1dEBE[2][pe][0][0]->GetBinContent(fImRPQ1dEBE[2][pe][0][0]->GetBin(b))\r
-           * fImRPQ1dEBE[2][pe][0][0]->GetBinEntries(fImRPQ1dEBE[2][pe][0][0]->GetBin(b));\r
-   q2n0kRe = fReRPQ1dEBE[2][pe][1][0]->GetBinContent(fReRPQ1dEBE[2][pe][1][0]->GetBin(b))\r
-           * fReRPQ1dEBE[2][pe][1][0]->GetBinEntries(fReRPQ1dEBE[2][pe][1][0]->GetBin(b));\r
-   q2n0kIm = fImRPQ1dEBE[2][pe][1][0]->GetBinContent(fImRPQ1dEBE[2][pe][1][0]->GetBin(b))\r
-           * fImRPQ1dEBE[2][pe][1][0]->GetBinEntries(fImRPQ1dEBE[2][pe][1][0]->GetBin(b));         \r
-                 \r
-   mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(fReRPQ1dEBE[2][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)\r
-  } \r
-  else if(type == "RP")\r
-  {\r
-   // q_{m*n,0}:\r
-   q1n0kRe = fReRPQ1dEBE[0][pe][0][0]->GetBinContent(fReRPQ1dEBE[0][pe][0][0]->GetBin(b))\r
-           * fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b));\r
-   q1n0kIm = fImRPQ1dEBE[0][pe][0][0]->GetBinContent(fImRPQ1dEBE[0][pe][0][0]->GetBin(b))\r
-           * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));\r
-   q2n0kRe = fReRPQ1dEBE[0][pe][1][0]->GetBinContent(fReRPQ1dEBE[0][pe][1][0]->GetBin(b))\r
-           * fReRPQ1dEBE[0][pe][1][0]->GetBinEntries(fReRPQ1dEBE[0][pe][1][0]->GetBin(b));\r
-   q2n0kIm = fImRPQ1dEBE[0][pe][1][0]->GetBinContent(fImRPQ1dEBE[0][pe][1][0]->GetBin(b))\r
-           * fImRPQ1dEBE[0][pe][1][0]->GetBinEntries(fImRPQ1dEBE[0][pe][1][0]->GetBin(b));         \r
-                 \r
-   mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)  \r
-  }\r
-      \r
-   if(type == "POI")\r
-   {\r
-    // p_{m*n,0}:\r
-    p1n0kRe = fReRPQ1dEBE[1][pe][0][0]->GetBinContent(fReRPQ1dEBE[1][pe][0][0]->GetBin(b))\r
-            * fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b));\r
-    p1n0kIm = fImRPQ1dEBE[1][pe][0][0]->GetBinContent(fImRPQ1dEBE[1][pe][0][0]->GetBin(b))  \r
-            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));\r
-            \r
-    mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(fReRPQ1dEBE[1][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)\r
-    \r
-    t = 1; // typeFlag = RP or POI\r
-   }\r
-   else if(type == "RP")\r
-   {\r
-    // p_{m*n,0} = q_{m*n,0}:\r
-    p1n0kRe = q1n0kRe; \r
-    p1n0kIm = q1n0kIm; \r
-            \r
-    mp = mq; \r
-    \r
-    t = 0; // typeFlag = RP or POI\r
-   }\r
-      \r
-   // 2'-particle correlation for particular (pt,eta) bin:\r
-   Double_t two1n1nPtEta = 0.;\r
-   if(mp*dMult-mq)\r
-   {\r
-    two1n1nPtEta = (p1n0kRe*dReQ1n+p1n0kIm*dImQ1n-mq)\r
-                 / (mp*dMult-mq);\r
-   \r
-    if(type == "POI") // to be improved (I do not this if)\r
-    { \r
-     // fill profile to get <<2'>> for POIs\r
-     fDiffFlowCorrelationsPro[1][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nPtEta,mp*dMult-mq);\r
-     // histogram to store <2'> for POIs e-b-e (needed in some other methods):\r
-     fDiffFlowCorrelationsEBE[1][pe][0]->SetBinContent(b,two1n1nPtEta);      \r
-     fDiffFlowEventWeightsForCorrelationsEBE[1][pe][0]->SetBinContent(b,mp*dMult-mq);      \r
-    }\r
-    else if(type == "RP") // to be improved (I do not this if)\r
-    {\r
-     // profile to get <<2'>> for RPs:\r
-     fDiffFlowCorrelationsPro[0][pe][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],two1n1nPtEta,mp*dMult-mq);\r
-     // histogram to store <2'> for RPs e-b-e (needed in some other methods):\r
-     fDiffFlowCorrelationsEBE[0][pe][0]->SetBinContent(b,two1n1nPtEta); \r
-     fDiffFlowEventWeightsForCorrelationsEBE[0][pe][0]->SetBinContent(b,mp*dMult-mq); \r
-    }\r
-   } // end of if(mp*dMult-mq)\r
-  \r
-   // 4'-particle correlation:\r
-   Double_t four1n1n1n1nPtEta = 0.;\r
-   if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)\r
-       + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)) // to be improved (introduce a new variable for this expression)\r
-   {\r
-    four1n1n1n1nPtEta = ((pow(dReQ1n,2.)+pow(dImQ1n,2.))*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)\r
-                      - q2n0kRe*(pow(dReQ1n,2.)-pow(dImQ1n,2.))\r
-                      - 2.*q2n0kIm*dReQ1n*dImQ1n\r
-                      - p1n0kRe*(dReQ1n*dReQ2n+dImQ1n*dImQ2n)\r
-                      + p1n0kIm*(dImQ1n*dReQ2n-dReQ1n*dImQ2n)\r
-                      - 2.*dMult*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)\r
-                      - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))*mq                      \r
-                      + 6.*(q1n0kRe*dReQ1n+q1n0kIm*dImQ1n)                                            \r
-                      + 1.*(q2n0kRe*dReQ2n+q2n0kIm*dImQ2n)                      \r
-                      + 2.*(p1n0kRe*dReQ1n+p1n0kIm*dImQ1n)                       \r
-                      + 2.*mq*dMult                      \r
-                      - 6.*mq)        \r
-                      / ((mp-mq)*dMult*(dMult-1.)*(dMult-2.)\r
-                          + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)); \r
-    \r
-    if(type == "POI")\r
-    {\r
-     // profile to get <<4'>> for POIs:\r
-     fDiffFlowCorrelationsPro[1][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nPtEta,\r
-                                     (mp-mq)*dMult*(dMult-1.)*(dMult-2.)\r
-                                     + mq*(dMult-1.)*(dMult-2.)*(dMult-3.)); \r
-     // histogram to store <4'> for POIs e-b-e (needed in some other methods):\r
-     fDiffFlowCorrelationsEBE[1][pe][1]->SetBinContent(b,four1n1n1n1nPtEta);                               \r
-     fDiffFlowEventWeightsForCorrelationsEBE[1][pe][1]->SetBinContent(b,(mp-mq)*dMult*(dMult-1.)*(dMult-2.)\r
-                                                                        + mq*(dMult-1.)*(dMult-2.)*(dMult-3.));                               \r
-    }\r
-    else if(type == "RP")\r
-    {\r
-     // profile to get <<4'>> for RPs:\r
-     fDiffFlowCorrelationsPro[0][pe][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],four1n1n1n1nPtEta,\r
-                                       (mp-mq)*dMult*(dMult-1.)*(dMult-2.)\r
-                                       + mq*(dMult-1.)*(dMult-2.)*(dMult-3.));                   \r
-     // histogram to store <4'> for RPs e-b-e (needed in some other methods):\r
-     fDiffFlowCorrelationsEBE[0][pe][1]->SetBinContent(b,four1n1n1n1nPtEta);                   \r
-     fDiffFlowEventWeightsForCorrelationsEBE[0][pe][1]->SetBinContent(b,(mp-mq)*dMult*(dMult-1.)*(dMult-2.)\r
-                                                                        + mq*(dMult-1.)*(dMult-2.)*(dMult-3.));                   \r
-    }\r
-   } // end of if((mp-mq)*dMult*(dMult-1.)*(dMult-2.)\r
-     //            +mq*(dMult-1.)*(dMult-2.)*(dMult-3.))\r
-   \r
- } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)\r
\r
-   \r
-} // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrelations(TString type, TString ptOrEta);\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::CalculateDiffFlowSumOfEventWeights(TString type, TString ptOrEta)\r
-{\r
- // Calculate sums of various event weights for reduced correlations. \r
- // (These quantitites are needed in expressions for unbiased estimators relevant for the statistical errors.)\r
-\r
- Int_t typeFlag = -1;\r
- Int_t ptEtaFlag = -1;\r
-\r
- if(type == "RP")\r
- {\r
-  typeFlag = 0;\r
- } else if(type == "POI")\r
-   {\r
-    typeFlag = 1;\r
-   } \r
-     \r
- if(ptOrEta == "Pt")\r
- {\r
-  ptEtaFlag = 0;\r
- } else if(ptOrEta == "Eta")\r
-   {\r
-    ptEtaFlag = 1;\r
-   } \r
-   \r
- // shortcuts:\r
- Int_t t = typeFlag;\r
- Int_t pe = ptEtaFlag;\r
\r
- // binning:\r
- Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};\r
- Double_t minPtEta[2] = {fPtMin,fEtaMin};\r
- //Double_t maxPtEta[2] = {fPtMax,fEtaMax};\r
- Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWidth};\r
\r
- for(Int_t rpq=0;rpq<3;rpq++)\r
- {\r
-  for(Int_t m=0;m<4;m++)\r
-  {\r
-   for(Int_t k=0;k<9;k++)\r
-   {\r
-    if(!fReRPQ1dEBE[rpq][pe][m][k])\r
-    {\r
-     cout<<"WARNING: fReRPQ1dEBE[rpq][pe][m][k] is NULL in AFAWQC::CSAPOEWFDF() !!!!"<<endl;\r
-     cout<<"pe  = "<<pe<<endl;\r
-     cout<<"rpq = "<<rpq<<endl;\r
-     cout<<"m   = "<<m<<endl;\r
-     cout<<"k   = "<<k<<endl;\r
-     exit(0); \r
-    }\r
-   }\r
-  }\r
- }  \r
-\r
- // multiplicities:\r
- Double_t dMult = (*fSMpk)(0,0); // total event multiplicity\r
- //Double_t mr = 0.; // number of RPs in particular pt or eta bin\r
- Double_t mp = 0.; // number of POIs in particular pt or eta bin \r
- Double_t mq = 0.; // number of particles which are both RPs and POIs in particular pt or eta bin\r
\r
- // event weights for reduced correlations:\r
- Double_t dw2 = 0.; // event weight for <2'>\r
- Double_t dw4 = 0.; // event weight for <4'>\r
- //Double_t dw6 = 0.; // event weight for <6'>\r
- //Double_t dw8 = 0.; // event weight for <8'>\r
-\r
- // looping over bins:\r
- for(Int_t b=1;b<=nBinsPtEta[pe];b++)\r
- {\r
-  if(type == "RP")\r
-  {\r
-   mq = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(b);\r
-   mp = mq; // trick to use the very same Eqs. bellow both for RP's and POI's diff. flow\r
-  } else if(type == "POI")\r
-    {\r
-     mp = fReRPQ1dEBE[1][pe][0][0]->GetBinEntries(b);\r
-     mq = fReRPQ1dEBE[2][pe][0][0]->GetBinEntries(b);    \r
-    }\r
-  \r
-  // event weight for <2'>:\r
-  dw2 = mp*dMult-mq;  \r
-  fDiffFlowSumOfEventWeights[t][pe][0][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw2);\r
-  fDiffFlowSumOfEventWeights[t][pe][1][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw2,2.));\r
-  \r
-  // event weight for <4'>:\r
-  dw4 = (mp-mq)*dMult*(dMult-1.)*(dMult-2.)\r
-     + mq*(dMult-1.)*(dMult-2.)*(dMult-3.);  \r
-  fDiffFlowSumOfEventWeights[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw4);\r
-  fDiffFlowSumOfEventWeights[t][pe][1][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw4,2.));\r
-  \r
-  // event weight for <6'>:\r
-  //dw6 = ...;  \r
-  //fDiffFlowSumOfEventWeights[t][pe][0][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw6);\r
-  //fDiffFlowSumOfEventWeights[t][pe][t][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw6,2.));\r
-  \r
-  // event weight for <8'>:\r
-  //dw8 = ...;  \r
-  //fDiffFlowSumOfEventWeights[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],dw8);\r
-  //fDiffFlowSumOfEventWeights[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],pow(dw8,2.));   \r
- } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++) \r
\r
-} // end of void AliFlowAnalysisWithQCumulants::CalculateDiffFlowSumOfEventWeights()\r
-\r
-\r
-//================================================================================================================================\r
-\r
-\r
-void AliFlowAnalysisWithQCumulants::CalculateDiffFlowSumOfProductOfEventWeights(TString type, TString ptOrEta)\r
-{\r
- // Calculate sum of products of various event weights for both types of correlations (the ones for int. and diff. flow). \r
- // (These quantitites are needed in expressions for unbiased estimators relevant for the statistical errors.)\r
- //\r
- // Important: To fill fDiffFlowSumOfProductOfEventWeights[][][][] use bellow table (i,j) with following constraints: \r
- // 1.) i<j  \r
- // 2.) do not store terms which DO NOT include reduced correlations;\r
- // Table:\r
- // [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'>]\r
-  \r
- Int_t typeFlag = -1;\r
- Int_t ptEtaFlag = -1;\r
-\r
- if(type == "RP")\r
- {\r
-  typeFlag = 0;\r
- } else if(type == "POI")\r
-   {\r
-    typeFlag = 1;\r
-   } \r
-     \r
- if(ptOrEta == "Pt")\r
- {\r
-  ptEtaFlag = 0;\r
- } else if(ptOrEta == "Eta")\r
-   {\r
-    ptEtaFlag = 1;\r
-   } \r
-     \r
- // shortcuts:\r
- Int_t t = typeFlag;\r
- Int_t pe = ptEtaFlag;\r
-  \r
- // binning:\r
- Int_t nBinsPtEta[2] = {fnBinsPt,fnBinsEta};\r
- Double_t minPtEta[2] = {fPtMin,fEtaMin};\r
- //Double_t maxPtEta[2] = {fPtMax,fEtaMax};\r
- Double_t binWidthPtEta[2] = {fPtBinWidth,fEtaBinWid