Eqs. for non-isotropic terms for automatic correction for non-uniform acceptance...
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 8 Feb 2010 19:08:24 +0000 (19:08 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 8 Feb 2010 19:08:24 +0000 (19:08 +0000)
PWG2/FLOW/AliFlowCommon/AliFlowAnalysisWithQCumulants.cxx

index eaf7ec0..bc14c12 100644 (file)
@@ -754,7 +754,7 @@ void AliFlowAnalysisWithQCumulants::Finish()
  this->CalculateCumulantsIntFlow();\r
  this->CalculateIntFlow(); \r
 \r
- if(fApplyCorrectionForNUA && !(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)) // to be improved (reorganized, etc)\r
+ if(fApplyCorrectionForNUA) // to be improved (reorganized, etc)\r
  {\r
   this->FinalizeCorrectionTermsForNUAIntFlow();\r
   this->CalculateQcumulantsCorrectedForNUAIntFlow();   \r
@@ -790,7 +790,7 @@ void AliFlowAnalysisWithQCumulants::Finish()
  this->CalculateDiffFlow("POI","Pt");\r
  this->CalculateDiffFlow("POI","Eta");\r
  \r
- if(fApplyCorrectionForNUA && !(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)) // to be improved (reorganized, etc)\r
+ if(fApplyCorrectionForNUA) // to be improved (reorganized, etc)\r
  {\r
   this->FinalizeCorrectionTermsForNUADiffFlow("RP","Pt");\r
   this->FinalizeCorrectionTermsForNUADiffFlow("RP","Eta");\r
@@ -839,11 +839,8 @@ void AliFlowAnalysisWithQCumulants::Finish()
   // correction terms for non-uniform acceptance:\r
   //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
-  {\r
-   this->CrossCheckDiffFlowCorrectionTermsForNUA("POI","Pt");      \r
-   this->CrossCheckDiffFlowCorrectionTermsForNUA("POI","Eta");      \r
-  } \r
+  this->CrossCheckDiffFlowCorrectionTermsForNUA("POI","Pt");      \r
+  this->CrossCheckDiffFlowCorrectionTermsForNUA("POI","Eta");       \r
  } // end of if(fEvaluateDiffFlowNestedLoops)\r
                                                                                                                                                                                                                                                                                                                                    \r
 } // end of AliFlowAnalysisWithQCumulants::Finish()\r
@@ -9197,8 +9194,14 @@ void AliFlowAnalysisWithQCumulants::CrossCheckDiffFlowCorrelations(TString type,
  cout<<endl;\r
  cout<<"   *****************************************"<<endl;\r
  cout<<"   **** cross-checking the correlations ****"<<endl;\r
- cout<<"   ****      for differential flow      ****"<<endl;\r
- cout<<"   ****               "<<rpORpoiString[t]<<"               ****"<<endl;\r
+ cout<<"   ****   for differential flow ("<<rpORpoiString[t]<<")   ****"<<endl;\r
+ if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights))\r
+ {\r
+  cout<<"   ****   (particle weights not used)   ****"<<endl;\r
+ } else\r
+   {\r
+    cout<<"   ****    (particle weights used)      ****"<<endl;\r
+   } \r
  cout<<"   *****************************************"<<endl; \r
  cout<<endl;\r
  cout<<"           "<<ptORetaString[pe]<<" bin: "<<lowerPtEtaEdge[pe]<<" <= "<<ptORetaString[pe]<<" < "<<upperPtEtaEdge[pe]<<endl;\r
@@ -9511,9 +9514,15 @@ void AliFlowAnalysisWithQCumulants::CrossCheckDiffFlowCorrectionTermsForNUA(TStr
  cout<<endl;\r
  cout<<"   ******************************************"<<endl;\r
  cout<<"   ****  cross-checking the correction   ****"<<endl;\r
- cout<<"   **** terms for non-uniform acceptance ****"<<endl;\r
- cout<<"   ****      for differential flow       ****"<<endl;\r
- cout<<"   ****              "<<rpORpoiString[t]<<"                 ****"<<endl;\r
+ cout<<"   **** terms for non-uniform acceptance ****"<<endl; 
+ cout<<"   ****    for differential flow ("<<rpORpoiString[t]<<")   ****"<<endl;\r
+ if(!(fUsePhiWeights||fUsePtWeights||fUseEtaWeights))\r
+ {\r
+  cout<<"   ****    (particle weights not used)   ****"<<endl;\r
+ } else\r
+   {\r
+    cout<<"   ****     (particle weights used)      ****"<<endl;\r
+   } \r
  cout<<"   ******************************************"<<endl; \r
  cout<<endl;\r
  cout<<"           "<<ptORetaString[pe]<<" bin: "<<lowerPtEtaEdge[pe]<<" <= "<<ptORetaString[pe]<<" < "<<upperPtEtaEdge[pe]<<endl;\r
@@ -9889,42 +9898,30 @@ void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTermsUs
 {\r
  // Calculate correction terms for non-uniform acceptance for differential flow (cos terms) using particle weights.\r
  
- type+=""; // to be removed
- ptOrEta+=""; // to be removed
-
-// Remark: w1 bellow is a particle weight used only for particles which were flagged both as POI and RP.
\r
  // Results are stored in fDiffFlowCorrectionTermsForNUAPro[t][pe][1][cti], where cti runs as follows:\r
  //
- //  0: <<w1 cos n(psi)>>\r
- //  1: <<w1 w2 cos n(psi1+phi2)>>\r
- //  2: <<w1 w2 w3 cos n(psi1+phi2-phi3)>>\r
- //  3: <<w1 w2 w3 cos n(psi1-phi2-phi3)>>\r
+ //  0: <<cos n(psi)>>\r
+ //  1: <<w2 cos n(psi1+phi2)>>\r
+ //  2: <<w2 w3 cos n(psi1+phi2-phi3)>>\r
+ //  3: <<w2 w3 cos n(psi1-phi2-phi3)>>\r
  //  4:\r
  //  5:\r
  //  6:\r
  \r
- /*
- // multiplicity:\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 dReQ1n3k = (*fReQ)(0,3);\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 dImQ1n3k = (*fImQ)(0,3);\r
  //Double_t dImQ4n4k = (*fImQ)(3,4);\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
  Int_t t = -1; // type flag \r
  Int_t pe = -1; // ptEta flag\r
@@ -9949,7 +9946,7 @@ void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTermsUs
  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 correction terms: \r
  for(Int_t b=1;b<=nBinsPtEta[pe];b++)\r
  {\r
@@ -9960,29 +9957,22 @@ void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTermsUs
   // 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
   // real and imaginary parts of q_{m*n,0} (weighted Q-vector evaluated for particles which are both RPs and POIs in particular pt or eta bin):\r
-  Double_t q1n1kRe = 0.;\r
-  Double_t q1n1kIm = 0.;\r
   Double_t q1n2kRe = 0.;\r
   Double_t q1n2kIm = 0.;\r
   Double_t q2n1kRe = 0.;\r
   Double_t q2n1kIm = 0.;\r
-  Double_t q2n2kRe = 0.;\r
-  Double_t q2n2kIm = 0.;\r
-  
-  // number of particles which are both RPs and POIs in particular pt or eta bin:\r
-  Double_t mq = 0.;\r
-  
-  // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  \r
+    
+  // s_{1,1}, s_{1,2} // to be improved (add explanation)  \r
   Double_t s1p1k = 0.; \r
   Double_t s1p2k = 0.; \r
-  Double_t s1p3k = 0.; \r
+  
+  // number of particles which are both RPs and POIs in particular pt or eta bin:\r
+  Double_t mq = 0.;
+  \r
+  // M0111 from Eq. (118) in QC2c (to be improved (notation))\r
+  Double_t dM01 = 0.;\r
+  Double_t dM011 = 0.;\r
   
   if(type == "POI")\r
   {\r
@@ -9993,31 +9983,29 @@ void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTermsUs
            * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
    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
    // q_{m*n,k}:\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
-   q1n1kRe = fReRPQ1dEBE[2][pe][0][1]->GetBinContent(fReRPQ1dEBE[2][pe][0][1]->GetBin(b))\r
-           * fReRPQ1dEBE[2][pe][0][1]->GetBinEntries(fReRPQ1dEBE[2][pe][0][1]->GetBin(b));\r
-   q1n1kIm = fImRPQ1dEBE[2][pe][0][1]->GetBinContent(fImRPQ1dEBE[2][pe][0][1]->GetBin(b))\r
-           * fImRPQ1dEBE[2][pe][0][1]->GetBinEntries(fImRPQ1dEBE[2][pe][0][1]->GetBin(b));\r
-   q2n2kRe = fReRPQ1dEBE[2][pe][1][2]->GetBinContent(fReRPQ1dEBE[2][pe][1][2]->GetBin(b))\r
-           * fReRPQ1dEBE[2][pe][1][2]->GetBinEntries(fReRPQ1dEBE[2][pe][1][2]->GetBin(b));\r
-   q2n2kIm = fImRPQ1dEBE[2][pe][1][2]->GetBinContent(fImRPQ1dEBE[2][pe][1][2]->GetBin(b))\r
-           * fImRPQ1dEBE[2][pe][1][2]->GetBinEntries(fImRPQ1dEBE[2][pe][1][2]->GetBin(b));          
-   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
-   // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  \r
+   q1n2kRe = fReRPQ1dEBE[2][pe][0][2]->GetBinContent(fReRPQ1dEBE[2][pe][0][2]->GetBin(b))\r
+           * fReRPQ1dEBE[2][pe][0][2]->GetBinEntries(fReRPQ1dEBE[2][pe][0][2]->GetBin(b));\r
+   q1n2kIm = fImRPQ1dEBE[2][pe][0][2]->GetBinContent(fImRPQ1dEBE[2][pe][0][2]->GetBin(b))\r
+           * fImRPQ1dEBE[2][pe][0][2]->GetBinEntries(fImRPQ1dEBE[2][pe][0][2]->GetBin(b));         \r
+   q2n1kRe = fReRPQ1dEBE[2][pe][1][1]->GetBinContent(fReRPQ1dEBE[2][pe][1][1]->GetBin(b))\r
+           * fReRPQ1dEBE[2][pe][1][1]->GetBinEntries(fReRPQ1dEBE[2][pe][1][1]->GetBin(b));\r
+   q2n1kIm = fImRPQ1dEBE[2][pe][1][1]->GetBinContent(fImRPQ1dEBE[2][pe][1][1]->GetBin(b))\r
+           * fImRPQ1dEBE[2][pe][1][1]->GetBinEntries(fImRPQ1dEBE[2][pe][1][1]->GetBin(b));         \r
+   mq = fReRPQ1dEBE[2][pe][1][1]->GetBinEntries(fReRPQ1dEBE[2][pe][1][1]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)\r
+   
    s1p1k = pow(fs1dEBE[2][pe][1]->GetBinContent(b)*fs1dEBE[2][pe][1]->GetBinEntries(b),1.); \r
    s1p2k = pow(fs1dEBE[2][pe][2]->GetBinContent(b)*fs1dEBE[2][pe][2]->GetBinEntries(b),1.); \r
-   s1p3k = pow(fs1dEBE[2][pe][3]->GetBinContent(b)*fs1dEBE[2][pe][3]->GetBinEntries(b),1.); 
+   
+   // M01 from Eq. (118) in QC2c (to be improved (notation)):\r
+   dM01 = mp*dSM1p1k-s1p1k;
+   dM011 = mp*(dSM2p1k-dSM1p2k)
+         - 2.*(s1p1k*dSM1p1k-s1p2k);
+          
    // typeFlag = RP (0) or POI (1):   
    t = 1; \r
   }else if(type == "RP")\r
    {\r
+    /*
     // q_{m*n,k}: (Remark: m=1 is 0, k=0 iz zero (to be improved!)) \r
     q1n2kRe = fReRPQ1dEBE[0][pe][0][2]->GetBinContent(fReRPQ1dEBE[0][pe][0][2]->GetBin(b))\r
             * fReRPQ1dEBE[0][pe][0][2]->GetBinEntries(fReRPQ1dEBE[0][pe][0][2]->GetBin(b));\r
@@ -10039,67 +10027,66 @@ void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTermsUs
             * fImRPQ1dEBE[0][pe][0][0]->GetBinEntries(fImRPQ1dEBE[0][pe][0][0]->GetBin(b));\r
     mp = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)\r
     // typeFlag = RP (0) or POI (1): \r
-    t = 0;\r
+    t = 0;
+    */\r
   }    \r
   \r
-  // <<w1 cos n(psi1)>>:\r
-  Double_t cosP1nPsiW1 = 0.;\r
-  if(mp-mq+s1p1k)\r
+  // <<cos n(psi1)>>:\r
+  Double_t cosP1nPsi = 0.;\r
+  if(mp)\r
   {\r
-   cosP1nPsiW1 = (p1n0kRe-q1n0kRe+q1n1kRe)/(mp-mq+s1p1k);\r
+   cosP1nPsi = p1n0kRe/mp;\r
    \r
-   // fill profile for <<w1 cos n(psi1)>>:\r
-   fDiffFlowCorrectionTermsForNUAPro[t][pe][1][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsiW1,mp-mq+s1p1k);\r
-   // histogram to store <w1 cos n(psi1)> e-b-e (needed in some other methods):\r
-   fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][0]->SetBinContent(b,cosP1nPsiW1);\r
-  } // end of if(mp-mq+s1p1k)   \r
-  \r  
+   // fill profile for <<cos n(psi1)>>:\r
+   fDiffFlowCorrectionTermsForNUAPro[t][pe][1][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi,mp);\r
+   // histogram to store <cos n(psi1)> e-b-e (needed in some other methods):\r
+   fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][0]->SetBinContent(b,cosP1nPsi);\r
+  } // end of if(mp)   
   
+  // <<w2 cos n(psi1+phi2)>>:\r
+  Double_t cosP1nPsiP1nPhiW2 = 0.;\r
+  if(dM01)\r
+  {\r
+   cosP1nPsiP1nPhiW2 = (p1n0kRe*dReQ1n1k-p1n0kIm*dImQ1n1k-q2n1kRe)/(dM01);\r
+   // fill profile for <<w2 cos n(psi1+phi2)>>:\r
+   fDiffFlowCorrectionTermsForNUAPro[t][pe][1][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsiP1nPhiW2,dM01);\r
+   // histogram to store <w2 cos n(psi1+phi2)> e-b-e (needed in some other methods):\r
+   fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][1]->SetBinContent(b,cosP1nPsiP1nPhiW2);\r
+  } // end of if(dM01)   \r
   
-  // <<w1 w2 cos n(psi1+phi2)>>:\r
-  Double_t cosP1nPsiP1nPhi = 0.;\r
-  if(mp*dMult-mq)\r
-  {\r
-   cosP1nPsiP1nPhi = (p1n0kRe*dReQ1n-p1n0kIm*dImQ1n-q2n0kRe)/(mp*dMult-mq);\r
-   // fill profile for <<w1 w2 cos n(psi1+phi2)>>:\r
-   fDiffFlowCorrectionTermsForNUAPro[t][pe][1][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsiP1nPhi,mp*dMult-mq);\r
-   // histogram to store <w1 w2 cos n(psi1+phi2)> e-b-e (needed in some other methods):\r
-   fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][1]->SetBinContent(b,cosP1nPsiP1nPhi);\r
-  } // end of if(mp*dMult-mq)   \r
-  \r
-  // <<w1 w2 w3 cos n(psi1+phi2-phi3)>>:\r
-  Double_t cosP1nPsi1P1nPhi2MPhi3 = 0.;\r
-  if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))\r
-  {\r
-   cosP1nPsi1P1nPhi2MPhi3 = (p1n0kRe*(pow(dImQ1n,2.)+pow(dReQ1n,2.)-dMult)\r
-                          - 1.*(q2n0kRe*dReQ1n+q2n0kIm*dImQ1n)  \r
-                          - mq*dReQ1n+2.*q1n0kRe)\r
-                          / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));\r
+  // <<w2 w3 cos n(psi1+phi2-phi3)>>:\r
+  Double_t cosP1nPsi1P1nPhi2MPhi3W2W3 = 0.;\r
+  if(dM011)\r
+  {\r
+   cosP1nPsi1P1nPhi2MPhi3W2W3 = (p1n0kRe*(pow(dImQ1n1k,2.)+pow(dReQ1n1k,2.))
+                              - p1n0kRe*dSM1p2k
+                              - q2n1kRe*dReQ1n1k-q2n1kIm*dImQ1n1k
+                              - s1p1k*dReQ1n1k
+                              + 2.*q1n2kRe)
+                              / dM011;  
    // fill profile for <<w1 w2 w3 cos n(psi1+phi2)>>:\r
-   fDiffFlowCorrectionTermsForNUAPro[t][pe][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1P1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));\r
+   fDiffFlowCorrectionTermsForNUAPro[t][pe][1][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1P1nPhi2MPhi3W2W3,dM011);\r
    // histogram to store <w1 w2 w3 cos n(psi1+phi2)> e-b-e (needed in some other methods):\r
-   fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][2]->SetBinContent(b,cosP1nPsi1P1nPhi2MPhi3);\r
-  } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   \r
-  \r
-  // <<w1 w2 w3 cos n(psi1-phi2-phi3)>>:\r
-  Double_t cosP1nPsi1M1nPhi2MPhi3 = 0.;\r
-  if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))\r
-  {\r
-   cosP1nPsi1M1nPhi2MPhi3 = (p1n0kRe*(pow(dReQ1n,2.)-pow(dImQ1n,2.))+2.*p1n0kIm*dReQ1n*dImQ1n\r
-                          - 1.*(p1n0kRe*dReQ2n+p1n0kIm*dImQ2n)  \r
-                          - 2.*mq*dReQ1n+2.*q1n0kRe)\r
-                          / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));\r
+   fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][2]->SetBinContent(b,cosP1nPsi1P1nPhi2MPhi3W2W3);\r
+  } // end of if(dM011)   \r
+  \r
+  // <<w2 w3 cos n(psi1-phi2-phi3)>>:\r
+  Double_t cosP1nPsi1M1nPhi2MPhi3W2W3 = 0.;\r
+  if(dM011)\r
+  {\r
+   cosP1nPsi1M1nPhi2MPhi3W2W3 = (p1n0kRe*(pow(dReQ1n1k,2.)-pow(dImQ1n1k,2.))+2.*p1n0kIm*dReQ1n1k*dImQ1n1k\r
+                              - 1.*(p1n0kRe*dReQ2n2k+p1n0kIm*dImQ2n2k)  \r
+                              - 2.*s1p1k*dReQ1n1k
+                              + 2.*q1n2kRe)\r
+                              / dM011;\r
    // fill profile for <<w1 w2 w3 cos n(psi1+phi2)>>:\r
-   fDiffFlowCorrectionTermsForNUAPro[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1M1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));\r
+   fDiffFlowCorrectionTermsForNUAPro[t][pe][1][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],cosP1nPsi1M1nPhi2MPhi3W2W3,dM011);\r
    // histogram to store <w1 w2 w3 cos n(psi1+phi2)> e-b-e (needed in some other methods):\r
-   fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][3]->SetBinContent(b,cosP1nPsi1M1nPhi2MPhi3);\r
-  } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   \r
+   fDiffFlowCorrectionTermsForNUAEBE[t][pe][1][3]->SetBinContent(b,cosP1nPsi1M1nPhi2MPhi3W2W3);\r
+  } // end of if(dM011)   \r
  
  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)\r
-  
- */
+   
 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUACosTermsUsingParticleWeights(TString type, TString ptOrEta)
 
 \r
@@ -10110,32 +10097,29 @@ void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUASinTermsUs
 {\r
  // Calculate correction terms for non-uniform acceptance for differential flow (sin terms).\r
   
- type+=""; // to be removed
- ptOrEta+=""; // to be removed
  // Results are stored in fDiffFlowCorrectionTermsForNUAPro[t][pe][0][cti], where cti runs as follows:\r
  //  0: <<sin n(psi1)>>\r
- //  1: <<sin n(psi1+phi2)>>\r
- //  2: <<sin n(psi1+phi2-phi3)>>\r
- //  3: <<sin n(psi1-phi2-phi3)>>:\r
+ //  1: <<w2 sin n(psi1+phi2)>>\r
+ //  2: <<w2 w3 sin n(psi1+phi2-phi3)>>\r
+ //  3: <<w2 w3 sin n(psi1-phi2-phi3)>>:\r
  //  4:\r
  //  5:\r
  //  6:\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
+ // 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
+ // 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 dSM2p1k = (*fSMpk)(1,1);\r
 \r
  Int_t t = -1; // type flag \r
  Int_t pe = -1; // ptEta flag\r
@@ -10171,118 +10155,135 @@ void AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUASinTermsUs
   // 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
+  // real and imaginary parts of q_{m*n,0} (weighted Q-vector evaluated for particles which are both RPs and POIs in particular pt or eta bin):\r
+  Double_t q1n2kRe = 0.;\r
+  Double_t q1n2kIm = 0.;\r
+  Double_t q2n1kRe = 0.;\r
+  Double_t q2n1kIm = 0.;\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
+  
   // 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
+  Double_t mq = 0.;
+  \r
+  // M0111 from Eq. (118) in QC2c (to be improved (notation))\r
+  Double_t dM01 = 0.;\r
+  Double_t dM011 = 0.;\r
+\r
   if(type == "POI")\r
   {\r
-   // p_{m*n,0}:\r
+   // p_{m*n,k}:   
    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
+           * fImRPQ1dEBE[1][pe][0][0]->GetBinEntries(fImRPQ1dEBE[1][pe][0][0]->GetBin(b));
+   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
+   // q_{m*n,k}:\r
+   q1n2kRe = fReRPQ1dEBE[2][pe][0][2]->GetBinContent(fReRPQ1dEBE[2][pe][0][2]->GetBin(b))\r
+           * fReRPQ1dEBE[2][pe][0][2]->GetBinEntries(fReRPQ1dEBE[2][pe][0][2]->GetBin(b));\r
+   q1n2kIm = fImRPQ1dEBE[2][pe][0][2]->GetBinContent(fImRPQ1dEBE[2][pe][0][2]->GetBin(b))\r
+           * fImRPQ1dEBE[2][pe][0][2]->GetBinEntries(fImRPQ1dEBE[2][pe][0][2]->GetBin(b));         \r
+   q2n1kRe = fReRPQ1dEBE[2][pe][1][1]->GetBinContent(fReRPQ1dEBE[2][pe][1][1]->GetBin(b))\r
+           * fReRPQ1dEBE[2][pe][1][1]->GetBinEntries(fReRPQ1dEBE[2][pe][1][1]->GetBin(b));\r
+   q2n1kIm = fImRPQ1dEBE[2][pe][1][1]->GetBinContent(fImRPQ1dEBE[2][pe][1][1]->GetBin(b))\r
+           * fImRPQ1dEBE[2][pe][1][1]->GetBinEntries(fImRPQ1dEBE[2][pe][1][1]->GetBin(b));         \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
+   
+   s1p1k = pow(fs1dEBE[2][pe][1]->GetBinContent(b)*fs1dEBE[2][pe][1]->GetBinEntries(b),1.); \r
+   s1p2k = pow(fs1dEBE[2][pe][2]->GetBinContent(b)*fs1dEBE[2][pe][2]->GetBinEntries(b),1.); \r
+   
+   // M01 from Eq. (118) in QC2c (to be improved (notation)):\r
+   dM01 = mp*dSM1p1k-s1p1k;
+   dM011 = mp*(dSM2p1k-dSM1p2k)
+         - 2.*(s1p1k*dSM1p1k-s1p2k);
+      
+   // typeFlag = RP (0) or POI (1):   
+   t = 1; \r
+  }else if(type == "RP")\r
+   {\r
+    /*
+    // q_{m*n,k}: (Remark: m=1 is 0, k=0 iz zero (to be improved!)) \r
+    q1n2kRe = fReRPQ1dEBE[0][pe][0][2]->GetBinContent(fReRPQ1dEBE[0][pe][0][2]->GetBin(b))\r
+            * fReRPQ1dEBE[0][pe][0][2]->GetBinEntries(fReRPQ1dEBE[0][pe][0][2]->GetBin(b));\r
+    q1n2kIm = fImRPQ1dEBE[0][pe][0][2]->GetBinContent(fImRPQ1dEBE[0][pe][0][2]->GetBin(b))\r
+            * fImRPQ1dEBE[0][pe][0][2]->GetBinEntries(fImRPQ1dEBE[0][pe][0][2]->GetBin(b));\r
+    q2n1kRe = fReRPQ1dEBE[0][pe][1][1]->GetBinContent(fReRPQ1dEBE[0][pe][1][1]->GetBin(b))\r
+            * fReRPQ1dEBE[0][pe][1][1]->GetBinEntries(fReRPQ1dEBE[0][pe][1][1]->GetBin(b));\r
+    q2n1kIm = fImRPQ1dEBE[0][pe][1][1]->GetBinContent(fImRPQ1dEBE[0][pe][1][1]->GetBin(b))\r
+            * fImRPQ1dEBE[0][pe][1][1]->GetBinEntries(fImRPQ1dEBE[0][pe][1][1]->GetBin(b));\r
+    // s_{1,1}, s_{1,2} and s_{1,3} // to be improved (add explanation)  \r
+    s1p1k = pow(fs1dEBE[0][pe][1]->GetBinContent(b)*fs1dEBE[0][pe][1]->GetBinEntries(b),1.); \r
+    s1p2k = pow(fs1dEBE[0][pe][2]->GetBinContent(b)*fs1dEBE[0][pe][2]->GetBinEntries(b),1.); \r
+    s1p3k = pow(fs1dEBE[0][pe][3]->GetBinContent(b)*fs1dEBE[0][pe][3]->GetBinEntries(b),1.); \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
+    // to be improved (cross-checked):\r
+    p1n0kRe = 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
+    p1n0kIm = 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
+    mp = fReRPQ1dEBE[0][pe][0][0]->GetBinEntries(fReRPQ1dEBE[0][pe][0][0]->GetBin(b)); // to be improved (cross-checked by accessing other profiles here)\r
+    // typeFlag = RP (0) or POI (1): \r
+    t = 0;
+    */\r
+  }    \r
+  \r
   // <<sin n(psi1)>>:\r
   Double_t sinP1nPsi = 0.;\r
   if(mp)\r
   {\r
    sinP1nPsi = p1n0kIm/mp;\r
+   \r
    // fill profile for <<sin n(psi1)>>:\r
    fDiffFlowCorrectionTermsForNUAPro[t][pe][0][0]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi,mp);\r
    // histogram to store <sin n(psi1)> e-b-e (needed in some other methods):\r
    fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][0]->SetBinContent(b,sinP1nPsi);\r
-  } // end of if(mp)   \r
-  \r
-  // <<sin n(psi1+phi2)>>:\r
-  Double_t sinP1nPsiP1nPhi = 0.;\r
-  if(mp*dMult-mq)\r
-  {\r
-   sinP1nPsiP1nPhi = (p1n0kRe*dImQ1n+p1n0kIm*dReQ1n-q2n0kIm)/(mp*dMult-mq);\r
-   // fill profile for <<sin n(psi1+phi2)>>:\r
-   fDiffFlowCorrectionTermsForNUAPro[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsiP1nPhi,mp*dMult-mq);\r
-   // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):\r
-   fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][1]->SetBinContent(b,sinP1nPsiP1nPhi);\r
+  } // end of if(mp)   
+  
+  // <<w2 sin n(psi1+phi2)>>:\r
+  Double_t sinP1nPsiP1nPhiW2 = 0.;\r
+  if(dM01)\r
+  {\r
+   sinP1nPsiP1nPhiW2 = (p1n0kRe*dImQ1n1k+p1n0kIm*dReQ1n1k-q2n1kIm)/(dM01);\r
+   // fill profile for <<w2 sin n(psi1+phi2)>>:\r
+   fDiffFlowCorrectionTermsForNUAPro[t][pe][0][1]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsiP1nPhiW2,dM01);\r
+   // histogram to store <w2 sin n(psi1+phi2)> e-b-e (needed in some other methods):\r
+   fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][1]->SetBinContent(b,sinP1nPsiP1nPhiW2);\r
   } // end of if(mp*dMult-mq)   \r
-  \r
-  // <<sin n(psi1+phi2-phi3)>>:\r
-  Double_t sinP1nPsi1P1nPhi2MPhi3 = 0.;\r
-  if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))\r
-  {\r
-   sinP1nPsi1P1nPhi2MPhi3 = (p1n0kIm*(pow(dImQ1n,2.)+pow(dReQ1n,2.)-dMult)\r
-                          - 1.*(q2n0kIm*dReQ1n-q2n0kRe*dImQ1n)  \r
-                          - mq*dImQ1n+2.*q1n0kIm)\r
-                          / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));\r
-   // fill profile for <<sin n(psi1+phi2)>>:\r
-   fDiffFlowCorrectionTermsForNUAPro[t][pe][0][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1P1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));\r
-   // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):\r
-   fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][2]->SetBinContent(b,sinP1nPsi1P1nPhi2MPhi3);\r
-  } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   \r
-  \r
-  // <<sin n(psi1-phi2-phi3)>>:\r
-  Double_t sinP1nPsi1M1nPhi2MPhi3 = 0.;\r
-  if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))\r
-  {\r
-   sinP1nPsi1M1nPhi2MPhi3 = (p1n0kIm*(pow(dReQ1n,2.)-pow(dImQ1n,2.))-2.*p1n0kRe*dReQ1n*dImQ1n\r
-                          - 1.*(p1n0kIm*dReQ2n-p1n0kRe*dImQ2n)\r
-                          + 2.*mq*dImQ1n-2.*q1n0kIm)\r
-                          / (mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));\r
-   // fill profile for <<sin n(psi1+phi2)>>:\r
-   fDiffFlowCorrectionTermsForNUAPro[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1M1nPhi2MPhi3,mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.));\r
-   // histogram to store <sin n(psi1+phi2)> e-b-e (needed in some other methods):\r
-   fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][3]->SetBinContent(b,sinP1nPsi1M1nPhi2MPhi3);\r
-  } // end of if(mq*(dMult-1.)*(dMult-2.)+(mp-mq)*dMult*(dMult-1.))   \r
+  
+  // <<w2 w3 sin n(psi1+phi2-phi3)>>:\r
+  Double_t sinP1nPsi1P1nPhi2MPhi3W2W3 = 0.;\r
+  if(dM011)\r
+  {\r
+   sinP1nPsi1P1nPhi2MPhi3W2W3 = (p1n0kIm*(pow(dImQ1n1k,2.)+pow(dReQ1n1k,2.))
+                              - p1n0kIm*dSM1p2k
+                              + q2n1kRe*dImQ1n1k-q2n1kIm*dReQ1n1k
+                              - s1p1k*dImQ1n1k
+                              + 2.*q1n2kIm)
+                              / dM011;  
+   // fill profile for <<w2 w3 sin n(psi1+phi2-phi3)>>:\r
+   fDiffFlowCorrectionTermsForNUAPro[t][pe][0][2]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1P1nPhi2MPhi3W2W3,dM011);\r
+   // histogram to store <w2 w3 sin n(psi1+phi2-phi3)> e-b-e (needed in some other methods):\r
+   fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][2]->SetBinContent(b,sinP1nPsi1P1nPhi2MPhi3W2W3);\r
+  } // end of if(dM011)   \r
+  
+  // <<w2 w3 sin n(psi1-phi2-phi3)>>:\r
+  Double_t sinP1nPsi1M1nPhi2MPhi3W2W3 = 0.;\r
+  if(dM011)\r
+  {\r
+   sinP1nPsi1M1nPhi2MPhi3W2W3 = (p1n0kIm*(pow(dReQ1n1k,2.)-pow(dImQ1n1k,2.))-2.*p1n0kRe*dReQ1n1k*dImQ1n1k\r
+                              + 1.*(p1n0kRe*dImQ2n2k-p1n0kIm*dReQ2n2k)  \r
+                              + 2.*s1p1k*dImQ1n1k
+                              - 2.*q1n2kIm)\r
+                              / dM011;\r
+   // fill profile for <<w2 w3 sin n(psi1-phi2-phi3)>>:\r
+   fDiffFlowCorrectionTermsForNUAPro[t][pe][0][3]->Fill(minPtEta[pe]+(b-1)*binWidthPtEta[pe],sinP1nPsi1M1nPhi2MPhi3W2W3,dM011);\r
+   // histogram to store <w2 w3 sin n(psi1-phi2-phi3)> e-b-e (needed in some other methods):\r
+   fDiffFlowCorrectionTermsForNUAEBE[t][pe][0][3]->SetBinContent(b,sinP1nPsi1M1nPhi2MPhi3W2W3);\r
+  } // end of if(dM011)   \r
+  
  } // end of for(Int_t b=1;b<=nBinsPtEta[pe];b++)\r
\r
- */
 
 } // end of AliFlowAnalysisWithQCumulants::CalculateDiffFlowCorrectionsForNUASinTermsUsingParticleWeights(TString type, TString ptOrEta)\r
 \r
@@ -10295,10 +10296,6 @@ void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNes
  // Evaluate with nested loops correction terms for non-uniform acceptance 
  // with using particle weights (both sin and cos terms) relevant for differential flow.\r
  \r
- anEvent->NumberOfTracks(); // to be removed
- ptOrEta+=""; // to be removed
- type+=""; // to be removed
  // Remark 1: "w1" in expressions bellow is a particle weight used only for particles which were 
  //           flagged both as POI and RP.
  // Remark 2: Reduced correction terms for non-uniform acceptance are evaluated in pt bin number fCrossCheckInPtBinNo \r
@@ -10306,16 +10303,14 @@ void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNes
  // Remark 3: Results are stored in 1 bin profiles fDiffFlowDirectCorrections[t][pe][sc][cti], where first three indices runs as: \r
  //           [0=RP,1=POI][0=Pt,1=Eta][0=sin terms,1=cos terms], whilst the cti (correction term index) runs as follows: \r
  //  cti: \r
- //    0: <<w1 sc n(psi1)>>\r
- //    1: <<w1 w2 sc n(psi1+phi2)>> \r
- //    2: <<w1 w2 w3 sc n(psi1+phi2-phi3)>>\r
- //    3: <<w1 w2 w3 sc n(psi1-phi2-phi3)>>\r
+ //    0: <<sc n(psi1)>>\r
+ //    1: <<w2 sc n(psi1+phi2)>> \r
+ //    2: <<w2 w3 sc n(psi1+phi2-phi3)>>\r
+ //    3: <<w2 w3 sc n(psi1-phi2-phi3)>>\r
  //    4:\r
  //    5:\r
  //    6:\r
-    \r
- /*
+     
  Int_t typeFlag = -1;\r
  Int_t ptEtaFlag = -1;\r
  if(type == "RP")\r
@@ -10344,10 +10339,11 @@ void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNes
  AliFlowTrackSimple *aftsTrack = NULL;\r
  \r
  Double_t psi1=0., phi2=0., phi3=0.;// phi4=0.;// phi5=0., phi6=0., phi7=0., phi8=0.;\r
\r
+ Double_t wPhi2=1., wPhi3=1.;\r
  Int_t n = fHarmonic; \r
  \r
- // 1-particle correction terms:\r
+ // 1'-particle correction terms:\r
  for(Int_t i1=0;i1<nPrim;i1++)\r
  {\r
   aftsTrack=anEvent->GetTrack(i1);\r
@@ -10366,7 +10362,7 @@ void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNes
   fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][0]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*psi1),1.); // <<cos(n*(psi1))>>  \r
  }//end of for(Int_t i1=0;i1<nPrim;i1++)\r
    \r
- // 2-particle correction terms:\r
+ // 2'-particle correction terms:\r
  for(Int_t i1=0;i1<nPrim;i1++)\r
  {\r
   aftsTrack=anEvent->GetTrack(i1);\r
@@ -10385,15 +10381,16 @@ void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNes
    aftsTrack=anEvent->GetTrack(i2);\r
    // RP condition (!(first) particle in the correlator must be RP):\r
    if(!(aftsTrack->InRPSelection())) continue;\r
-   phi2=aftsTrack->Phi();   \r
+   phi2=aftsTrack->Phi();
+   if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));   \r
    // sin terms: \r
-   fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1+phi2)),1.); // <<sin(n*(psi1+phi2))>>  \r
+   fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1+phi2)),wPhi2); // <<w2 sin(n*(psi1+phi2))>>  \r
    // cos terms: \r
-   fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2)),1.); // <<cos(n*(psi1+phi2))>>  \r
+   fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][1]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2)),wPhi2); // <<w2 cos(n*(psi1+phi2))>>  \r
   }//end of for(Int_t i2=0;i2<nPrim;i2++)\r
  }//end of for(Int_t i1=0;i1<nPrim;i1++)   \r
  \r
- // 3-particle correction terms:\r
+ // 3'-particle correction terms:\r
  for(Int_t i1=0;i1<nPrim;i1++)\r
  {\r
   aftsTrack=anEvent->GetTrack(i1);\r
@@ -10413,6 +10410,7 @@ void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNes
    // RP condition (!(first) particle in the correlator must be RP):\r
    if(!(aftsTrack->InRPSelection())) continue;\r
    phi2=aftsTrack->Phi();\r
+   if(fUsePhiWeights && fPhiWeights) wPhi2 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi2*fnBinsPhi/TMath::TwoPi())));   \r
    for(Int_t i3=0;i3<nPrim;i3++)\r
    {\r
     if(i3==i1||i3==i2) continue;\r
@@ -10420,17 +10418,16 @@ void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNes
     // RP condition (!(first) particle in the correlator must be RP):\r
     if(!(aftsTrack->InRPSelection())) continue;\r
     phi3=aftsTrack->Phi();\r
+    if(fUsePhiWeights && fPhiWeights) wPhi3 = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(phi3*fnBinsPhi/TMath::TwoPi())));   \r
     // sin terms: \r
-    fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][2]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1+phi2-phi3)),1.); // <<sin(n*(psi1+phi2-phi3))>>  \r
-    fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][3]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1-phi2-phi3)),1.); // <<sin(n*(psi1-phi2-phi3))>>  \r
+    fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][2]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1+phi2-phi3)),wPhi2*wPhi3); // <<wPhi2*wPhi3 sin(n*(psi1+phi2-phi3))>>  \r
+    fDiffFlowDirectCorrectionTermsForNUA[t][pe][0][3]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,sin(n*(psi1-phi2-phi3)),wPhi2*wPhi3); // <<wPhi2*wPhi3 sin(n*(psi1-phi2-phi3))>>  \r
     // cos terms: \r
-    fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][2]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2-phi3)),1.); // <<cos(n*(psi1+phi2-phi3))>>  \r
-    fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][3]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1-phi2-phi3)),1.); // <<cos(n*(psi1-phi2-phi3))>>  \r
+    fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][2]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1+phi2-phi3)),wPhi2*wPhi3); // <<wPhi2*wPhi3 cos(n*(psi1+phi2-phi3))>>  \r
+    fDiffFlowDirectCorrectionTermsForNUA[t][pe][1][3]->Fill(lowerPtEtaEdge[pe]+binWidthPtEta[pe]/2.,cos(n*(psi1-phi2-phi3)),wPhi2*wPhi3); // <<wPhi2*wPhi3 cos(n*(psi1-phi2-phi3))>>  \r
    }//end of for(Int_t i3=0;i3<nPrim;i3++)  \r
   }//end of for(Int_t i2=0;i2<nPrim;i2++)  \r
- }//end of for(Int_t i1=0;i1<nPrim;i1++)\r
- */ 
+ }//end of for(Int_t i1=0;i1<nPrim;i1++)
                \r
 } // end of void AliFlowAnalysisWithQCumulants::EvaluateDiffFlowCorrectionTermsForNUAWithNestedLoopsUsingParticleWeights(AliFlowEventSimple* anEvent, TString type, TString ptOrEta)\r
 \r