]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/FORWARD/analysis2/AliForwardFlowTaskQC.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliForwardFlowTaskQC.cxx
index c061b077546731a5eca9f008239292ae49f2df48..f3315bc8b8af11040212c9adcad9b2d95294a8de 100644 (file)
@@ -394,15 +394,17 @@ void AliForwardFlowTaskQC::FillVtxBinList(const TList& list, TH2D& h, Int_t vtx,
   Int_t nVtxBins = fVtxAxis->GetNbins();
   
   while ((bin = static_cast<VertexBin*>(list.At(vtx+(nVtxBins*i))))) {
+    i++;
     // If no tracks do things normally
-    if (!(fFlowFlags & kTracks) && !bin->FillHists(h, fCent, kFillBoth|flags|kReset)) return;
+    if (!(fFlowFlags & kTracks) || (flags & kMC)) {
+      if (!bin->FillHists(h, fCent, kFillBoth|flags|kReset)) continue;
+    }
     // if tracks things are more complicated
     else if ((fFlowFlags & kTracks)) {
-      if (!FillTracks(bin, kFillRef|kReset|flags)) return;
-      if (!bin->FillHists(h, fCent, kFillDiff|kReset|flags)) return;
+      if (!FillTracks(bin, kFillRef|kReset|flags)) continue;
+      if (!bin->FillHists(h, fCent, kFillDiff|kReset|flags)) continue;
     }
     bin->CumulantsAccumulate(fCent);
-    i++;
   }
 
   return;
@@ -427,13 +429,15 @@ void AliForwardFlowTaskQC::FillVtxBinListEtaGap(const TList& list, TH2D& href,
   Int_t nVtxBins = fVtxAxis->GetNbins();
 
   while ((bin = static_cast<VertexBin*>(list.At(vtx+(nVtxBins*i))))) {
-    if (!(fFlowFlags & kTracks) && !bin->FillHists(href, fCent, kFillRef|flags|kReset)) return;
+    i++;
+    if (!(fFlowFlags & kTracks) || (flags & kMC)) {
+      if(!bin->FillHists(href, fCent, kFillRef|flags|kReset)) continue;
+    }
     else if ((fFlowFlags & kTracks)) {
-      if (!FillTracks(bin, kFillRef|kReset|flags)) return;
+      if (!FillTracks(bin, kFillRef|kReset|flags)) continue;
     }
-    if (!bin->FillHists(hdiff, fCent, kFillDiff|kReset)) return;
+    if (!bin->FillHists(hdiff, fCent, kFillDiff|kReset|flags)) continue;
     bin->CumulantsAccumulate(fCent);
-    i++;
   }
 
   return;
@@ -460,9 +464,9 @@ void AliForwardFlowTaskQC::FillVtxBinList3Cor(const TList& list, TH2D& hcent,
   TH2D& h = CombineHists(hcent, hfwd);
 
   while ((bin = static_cast<VertexBin*>(list.At(vtx+(nVtxBins*i))))) {
-    if (!bin->FillHists(h, fCent, kFillBoth|flags|kReset)) return;
-    bin->CumulantsAccumulate3Cor(fCent);
     i++;
+    if (!bin->FillHists(h, fCent, kFillBoth|flags|kReset)) continue;
+    bin->CumulantsAccumulate3Cor(fCent);
   }
 
   return;
@@ -895,10 +899,11 @@ void AliForwardFlowTaskQC::FillVZEROHist(AliVVZERO* vzero)
                      0.521922, 0.785915, 0.703658, 0.832479, 0.77461, 0.73129, 0.778697, 0.710265, 
                      0.89686, 0.967688, 0.974225, 0.873445, 0.811096, 0.828493, 0.889609, 0.586056, 
                      1.15877, 0.954656, 0.914557, 0.979028, 1.04907, 0.748518, 0.928043, 0.98175 };
+
   for (Int_t i = 0; i < 64; i++) {
     if (i % 8 == 0) {
       ring++;
-      bin = (ring < 5 ? ring+1 : 15-ring);
+      bin = (ring < 5 ? 11-ring : ring-3);
       eta = fHistdNdedpV0.GetXaxis()->GetBinCenter(bin);
       fHistdNdedpV0.SetBinContent(bin, 0, 1);
     }
@@ -1048,7 +1053,7 @@ void AliForwardFlowTaskQC::VertexBin::AddOutput(TList* outputlist, TAxis* centAx
 
   // Get bin numbers and binning defined
   Int_t nHBins = GetBinNumberSin();
-  Int_t nEtaBins = 48
+  Int_t nEtaBins = 24
   if ((fFlags & k3Cor)) {
     if ((fFlags & kFMD)) nEtaBins = 24;
     else if ((fFlags & kVZERO)) nEtaBins = 19;
@@ -1197,7 +1202,6 @@ Bool_t AliForwardFlowTaskQC::VertexBin::FillHists(TH2D& dNdetadphi, Double_t cen
     if ((mode & kFillRef))  fCumuRef->Reset();
     if ((mode & kFillDiff)) fCumuDiff->Reset();
   }
-
   // Then we loop over the input and calculate sum cos(k*n*phi)
   // and fill it in the reference and differential histograms
   Int_t nBadBins = 0;
@@ -1218,7 +1222,7 @@ Bool_t AliForwardFlowTaskQC::VertexBin::FillHists(TH2D& dNdetadphi, Double_t cen
             TMath::Abs(eta) < fEtaGap) break;
        // Backward and forward eta gap break for reference flow
        if ((fFlags & kEtaGap) && (mode & kFillRef) && TMath::Abs(eta) > TMath::Abs(limit)) break;
-       if ((fFlags & kStdQC) && (fFlags & kMC)) {
+       if ((fFlags & kStdQC) && (fFlags & kMC) && !(fFlags & kTracks)) {
          if (!(fFlags & kSPD) && TMath::Abs(eta) < 1.75) break; 
          if ((fFlags & kSPD) && TMath::Abs(eta) > 2.00) break;
        }
@@ -1234,9 +1238,8 @@ Bool_t AliForwardFlowTaskQC::VertexBin::FillHists(TH2D& dNdetadphi, Double_t cen
       nInAvg++;
       if (weight == 0) continue;
       if (weight > max) max = weight;
-      
       // Fill into Cos() and Sin() hists
-      if ((mode & kFillRef)) {
+      if ((mode & kFillRef) && !((fFlags & kTracks) && (fFlags & kMC) && TMath::Abs(eta) > 0.75)) {
        fCumuRef->Fill(eta, 0., weight);// mult goes in underflowbin - no visual, but not needed?
         fdNdedpRefAcc->Fill(eta, phi, weight);
       }
@@ -1250,7 +1253,7 @@ Bool_t AliForwardFlowTaskQC::VertexBin::FillHists(TH2D& dNdetadphi, Double_t cen
        Double_t cosnPhi = weight*TMath::Cos(n*phi);
        Double_t sinnPhi = weight*TMath::Sin(n*phi);
         // fill ref
-       if ((mode & kFillRef)) {
+       if ((mode & kFillRef) && !((fFlags & kTracks) && (fFlags & kMC) && TMath::Abs(eta) > 0.75)) {
          fCumuRef->Fill(eta, cosBin, cosnPhi);
          fCumuRef->Fill(eta, sinBin, sinnPhi);
        }
@@ -1318,13 +1321,14 @@ Bool_t AliForwardFlowTaskQC::VertexBin::FillTracks(TObjArray* trList, AliESDEven
       if (!trFilter->IsSelected(esdTr)) continue;
     }
     else if (trList) { // If AOD input
-      Double_t pTMin = 0, pTMax = 0, etaMin = 0, etaMax = 0, minNCl = 0, bit = 0;
+      Double_t pTMin = 0, pTMax = 0, etaMin = 0, etaMax = 0, minNCl = 0;
+      UInt_t bit = 0;
       if ((fFlags & kTPC) == kTPC)    pTMin = 0.2, pTMax = 5., etaMin = -0.8, etaMax = 0.8, minNCl = 70, bit = 128;
       if ((fFlags & kHybrid) == kHybrid) pTMin = 0.2, pTMax = 5., etaMin = -0.8, etaMax = 0.8, minNCl = 70, bit = 272;
 
       AliAODTrack* aodTr = (AliAODTrack*)tr;
       if (aodTr->GetID() > -1) continue;
-      if (!aodTr->TestFilterBit(bit) || !aodTr->Pt() > pTMax || aodTr->Pt() < pTMin || 
+      if (!aodTr->TestFilterBit(bit) || aodTr->Pt() > pTMax || aodTr->Pt() < pTMin || 
        aodTr->Eta() > etaMax || aodTr->Eta() < etaMin || aodTr->GetTPCNcls() < minNCl) continue;
     }
 
@@ -1333,19 +1337,21 @@ Bool_t AliForwardFlowTaskQC::VertexBin::FillTracks(TObjArray* trList, AliESDEven
     Double_t eta = tr->Eta();
     if (((fFlags & kSPD) || (fFlags & kEtaGap)) && TMath::Abs(eta) < fEtaGap) continue;
     Double_t phi = tr->Phi();
+    Double_t weight = 1.;
+
     if ((mode & kFillRef)) {
-      fCumuRef->Fill(eta, 0.);// mult goes in underflowbin - no visual, but not needed?
-      fdNdedpRefAcc->Fill(eta, phi);
+      fCumuRef->Fill(eta, 0., weight);// mult goes in underflowbin - no visual, but not needed?
+      fdNdedpRefAcc->Fill(eta, phi, weight);
     }
     if ((mode & kFillDiff)) {
-      fCumuDiff->Fill(eta, 0);
-      fdNdedpDiffAcc->Fill(eta, phi);
+      fCumuDiff->Fill(eta, 0., weight);
+      fdNdedpDiffAcc->Fill(eta, phi, weight);
     }
     for (Int_t n = 1; n <= 2*fMaxMoment; n++) {
       Double_t cosBin = fCumuDiff->GetYaxis()->GetBinCenter(GetBinNumberCos(n));
       Double_t sinBin = fCumuDiff->GetYaxis()->GetBinCenter(GetBinNumberSin(n));
-      Double_t cosnPhi = TMath::Cos(n*phi);
-      Double_t sinnPhi = TMath::Sin(n*phi);
+      Double_t cosnPhi = weight*TMath::Cos(n*phi);
+      Double_t sinnPhi = weight*TMath::Sin(n*phi);
       // fill ref
       if ((mode & kFillRef)) {
        fCumuRef->Fill(eta, cosBin, cosnPhi);
@@ -1374,7 +1380,7 @@ void AliForwardFlowTaskQC::VertexBin::CumulantsAccumulate(Double_t cent)
   // Fill out NUA hists
   for (Int_t etaBin = 1; etaBin <= fCumuRef->GetNbinsX(); etaBin++) {
     Double_t eta = fCumuRef->GetXaxis()->GetBinCenter(etaBin);
-    if (fCumuRef->GetBinContent(etaBin, 0) == 0) continue;
+    if (fCumuRef->GetBinContent(etaBin, 0) <= 3) continue;
     if ((fFlags & kTracks) && (fFlags && kSPD) && !(fFlags & kEtaGap)) eta = -eta;
     for (Int_t qBin = 0; qBin <= fCumuRef->GetNbinsY(); qBin++) {
       fCumuNUARef->Fill(eta, cent, Double_t(qBin), fCumuRef->GetBinContent(etaBin, qBin));
@@ -1382,6 +1388,8 @@ void AliForwardFlowTaskQC::VertexBin::CumulantsAccumulate(Double_t cent)
   }
   for (Int_t etaBin = 1; etaBin <= fCumuDiff->GetNbinsX(); etaBin++) {
     Double_t eta = fCumuDiff->GetXaxis()->GetBinCenter(etaBin);
+    Double_t refetaBin = fCumuRef->GetXaxis()->FindBin(eta);
+    if (fCumuRef->GetBinContent(refetaBin, 0) <= 3) continue;
     if (fCumuDiff->GetBinContent(etaBin, 0) == 0) continue;
     for (Int_t qBin = 0; qBin <= fCumuDiff->GetNbinsY(); qBin++) {
       fCumuNUADiff->Fill(eta, cent, Double_t(qBin), fCumuDiff->GetBinContent(etaBin, qBin));
@@ -1412,7 +1420,6 @@ void AliForwardFlowTaskQC::VertexBin::CumulantsAccumulate(Double_t cent)
       if ((fFlags & kEtaGap)) refEta = -eta;
       Int_t refEtaBinB = fCumuRef->GetXaxis()->FindBin(refEta);
       if (refEtaBinA != prevRefEtaBin) {
-       prevRefEtaBin = refEtaBinA;
        // Reference flow
        multA  = fCumuRef->GetBinContent(refEtaBinA, 0);
        dQnReA = fCumuRef->GetBinContent(refEtaBinA, GetBinNumberCos(n));
@@ -1424,7 +1431,7 @@ void AliForwardFlowTaskQC::VertexBin::CumulantsAccumulate(Double_t cent)
        dQnReB = fCumuRef->GetBinContent(refEtaBinB, GetBinNumberCos(n));
        dQnImB = fCumuRef->GetBinContent(refEtaBinB, GetBinNumberSin(n));
 
-       if (multA <= 3 || multB <= 3) return
+       if (multA <= 3 || multB <= 3) continue
        // The reference flow is calculated 
        // 2-particle
        if ((fFlags & kStdQC)) {
@@ -1466,6 +1473,7 @@ void AliForwardFlowTaskQC::VertexBin::CumulantsAccumulate(Double_t cent)
          cumuRef->Fill(eta, cent, kSinphi1phi2phi3m, sinPhi1Phi2Phi3m);
          cumuRef->Fill(eta, cent, k3pWeight, multA*(multA-1.)*(multA-2.));
        } // End of QC{4}
+       prevRefEtaBin = refEtaBinA;
       } // End of reference flow
       // For each etaBin bin the necessary values for differential flow is calculated
       Double_t mp = fCumuDiff->GetBinContent(etaBin, 0);
@@ -1482,7 +1490,7 @@ void AliForwardFlowTaskQC::VertexBin::CumulantsAccumulate(Double_t cent)
 
       // Differential flow calculations for each eta bin is done:
       // 2-particle differential flow
-      if ((fFlags & kStdQC) && !(fFlags & kTracks)) {
+      if ((fFlags & kStdQC) && (!(fFlags & kTracks) || ((fFlags & kTracks) && (fFlags & kMC) && !(fFlags & kSPD) && TMath::Abs(eta) < 0.75))) {
        mq = mp;
        qnRe = pnRe;
        qnIm = pnIm;
@@ -1980,7 +1988,7 @@ void AliForwardFlowTaskQC::VertexBin::CalculateReferenceFlow(CumuHistos& cumu2h,
          // The next line covers both cases.
          qc2 -= cosP1nPhiA*cosP1nPhiB + sinP1nPhiA*sinP1nPhiB;
          // Extra NUA term from 2n cosines and sines
-         Double_t den = 1-(cos2nPhiA*cos2nPhiB + sin2nPhiA*sin2nPhiB);
+         Double_t den = 1+(cos2nPhiA*cos2nPhiB + sin2nPhiA*sin2nPhiB);
          if (den != 0) qc2 /= den;
          else qc2 = 0;
        }
@@ -2128,7 +2136,7 @@ void AliForwardFlowTaskQC::VertexBin::CalculateDifferentialFlow(CumuHistos& cumu
          // Old nua
          qc2Prime -= cosP1nPsi*cosP1nPhiB + sinP1nPsi*sinP1nPhiB;
          // Extra NUA term from 2n cosines and sines
-         qc2Prime /= (1.-(cos2nPsi*cos2nPhiB + sin2nPsi*sin2nPhiB));
+         qc2Prime /= (1.+(cos2nPsi*cos2nPhiB + sin2nPsi*sin2nPhiB));
        }
        if (!TMath::IsNaN(qc2Prime)) {
          quality->Fill((n-2)*qualityFactor+3, Int_t(cent));
@@ -2315,7 +2323,7 @@ void AliForwardFlowTaskQC::VertexBin::Calculate3CorFlow(CumuHistos& cumu2h, TH2I
          // Old nua
          qc2 -= cosP1nPhiA*cosP1nPhiB + sinP1nPhiA*sinP1nPhiB;
          // Extra NUA term from 2n cosines and sines
-         qc2 /= (1-(cos2nPhiA*cos2nPhiB + sin2nPhiA*sin2nPhiB));
+         qc2 /= (1+(cos2nPhiA*cos2nPhiB + sin2nPhiA*sin2nPhiB));
        }
        if (qc2 <= 0) { 
          if (fDebug > 0) 
@@ -2361,8 +2369,8 @@ void AliForwardFlowTaskQC::VertexBin::Calculate3CorFlow(CumuHistos& cumu2h, TH2I
          qc2PrimeA -= cosP1nPsi*cosP1nPhiA + sinP1nPsi*sinP1nPhiA;
          qc2PrimeB -= cosP1nPsi*cosP1nPhiB + sinP1nPsi*sinP1nPhiB; // Is this OK?
          // Extra NUA term from 2n cosines and sines
-         if (cos2nPsi*cos2nPhiA + sin2nPsi*sin2nPhiA != 1.) qc2PrimeA /= (1.-(cos2nPsi*cos2nPhiA + sin2nPsi*sin2nPhiA));
-         if (cos2nPsi*cos2nPhiB + sin2nPsi*sin2nPhiB != 1.) qc2PrimeB /= (1.-(cos2nPsi*cos2nPhiB + sin2nPsi*sin2nPhiB));
+         if (cos2nPsi*cos2nPhiA + sin2nPsi*sin2nPhiA != -1.) qc2PrimeA /= (1.+(cos2nPsi*cos2nPhiA + sin2nPsi*sin2nPhiA));
+         if (cos2nPsi*cos2nPhiB + sin2nPsi*sin2nPhiB != -1.) qc2PrimeB /= (1.+(cos2nPsi*cos2nPhiB + sin2nPsi*sin2nPhiB));
        }
        if (!TMath::IsNaN(qc2PrimeA) && !TMath::IsNaN(qc2PrimeB) && qc2 != 0) {
        if (qc2PrimeA*qc2PrimeB >= 0) {