]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
new version with selector
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 2 Feb 2007 10:43:12 +0000 (10:43 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 2 Feb 2007 10:43:12 +0000 (10:43 +0000)
23 files changed:
PWG2/FLOW/AliFlowAnalyser.cxx [new file with mode: 0644]
PWG2/FLOW/AliFlowAnalyser.h [new file with mode: 0644]
PWG2/FLOW/AliFlowAnalysisMaker.cxx [deleted file]
PWG2/FLOW/AliFlowAnalysisMaker.h [deleted file]
PWG2/FLOW/AliFlowConstants.cxx
PWG2/FLOW/AliFlowEvent.cxx
PWG2/FLOW/AliFlowMaker.cxx [new file with mode: 0644]
PWG2/FLOW/AliFlowMaker.h [new file with mode: 0644]
PWG2/FLOW/AliFlowSelection.cxx
PWG2/FLOW/AliFlowSelection.h
PWG2/FLOW/AliFlowV0.cxx
PWG2/FLOW/AliFlowWeighter.cxx [new file with mode: 0644]
PWG2/FLOW/AliFlowWeighter.h [new file with mode: 0644]
PWG2/FLOW/AliSelectorFlow.cxx [deleted file]
PWG2/FLOW/AliSelectorFlow.h [deleted file]
PWG2/FLOW/macros/makeAnal.C [deleted file]
PWG2/FLOW/macros/testAnal.C [new file with mode: 0644]
PWG2/FLOW/macros/testFoF.C [moved from PWG2/FLOW/macros/testAliSelector.C with 79% similarity]
PWG2/FLOW/macros/testMaker.C [new file with mode: 0644]
PWG2/FLOW/macros/testWeight.C [new file with mode: 0644]
PWG2/FLOW/macros/untitled.C [new file with mode: 0644]
PWG2/PWG2flowLinkDef.h
PWG2/libPWG2flow.pkg

diff --git a/PWG2/FLOW/AliFlowAnalyser.cxx b/PWG2/FLOW/AliFlowAnalyser.cxx
new file mode 100644 (file)
index 0000000..e4e8654
--- /dev/null
@@ -0,0 +1,3460 @@
+//////////////////////////////////////////////////////////////////////
+//
+// $Id$
+//
+// Author: Emanuele Simili
+//
+//////////////////////////////////////////////////////////////////////
+//_____________________________________________________________
+//
+// Description: 
+//         the AliFlowAnalyser provides the methods to perform an Event 
+// plane flow analysis over AliFlowEvents. 
+// - The method Init() generates the histograms.
+// - The method Analyse(AliFlowEvent*) calculates/extracts flow observables,  
+//  fills some histograms and performs the E.P. analysis.
+// - The method Resolution() calculates the resolution correction and 
+//  applies it to observed v_n values.
+// - The method Finish() saves the histograms and closes the file.
+// Weights calculation has been moved to the class AliFlowWeighter.
+//
+// The most important features of the Flow Analysis are:
+//  - Reaction Plane calculation: for different harmonics and selections
+//   with user defined cuts. (The calculation of the R.P. is a method in
+//   the AliFlowEvent class).
+//  - Correlation Analysis: particles are related to the R.P. and Vn 
+//   coefficient are extracted. The AliFlowAnalysisMaker also removes 
+//   auto-correlations of each particle with respect to the event plane, 
+//   by subtracting track by track from the Q vector before the correlation 
+//   study. Observable Flow is plotted.
+//  - Differential Flow: for each harmonic and selection, flow values 
+//   (Vn) are plotted versus rapidity/pseudorapidity and pT. 
+//  - Resulution Estimate: event plane resolution is estimated via the 
+//   sub-event method (res ~ sqrt(cos(psi1-psi2))), and flow values are 
+//   then corrected for it. "True" Flow is plotted. 
+//  - Integrated Flow: for the doubly-integrated (pT & eta) Vn values 
+//   the error on the event plane resolution is folded in to the error. 
+//  - Phi and Baiesian weights calculation (from event observables). 
+//
+// The AliFlowAnalysisMaker Class is adapted from the original 
+// StFlowAnalysisMaker, succesfully used to study flow in the 
+// STAR experiment at RICH.
+// Original Authors:                 Raimond Snellings & Art Poskanzer
+//
+//////////////////////////////////////////////////////////////////////
+
+#ifndef ALIFLOWANALYSER_CXX
+#define ALIFLOWANALYSER_CXX
+
+
+// ROOT things
+#include <TROOT.h>
+#include <TMath.h>
+#include <TFile.h>
+#include <TTree.h>
+#include <TChain.h>
+#include <TString.h>
+#include <TObject.h>
+#include <TObjArray.h>
+#include <TOrdCollection.h>
+#include <TParticle.h>
+#include <TParticlePDG.h>
+#include <TDatabasePDG.h>
+#include <TH1.h>
+#include <TH2.h>
+#include <TH3.h>
+#include <TProfile.h>
+#include <TProfile2D.h>
+#include <TVector2.h>
+
+// Flow things
+#include "AliFlowEvent.h"
+#include "AliFlowTrack.h"
+#include "AliFlowV0.h"
+#include "AliFlowConstants.h"
+#include "AliFlowSelection.h"
+#include "AliFlowAnalyser.h"
+
+// ANSI things
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <iostream>
+using namespace std; //required for resolving the 'cout' symbol
+
+ClassImp(AliFlowAnalyser) ;
+//-----------------------------------------------------------------------
+AliFlowAnalyser::AliFlowAnalyser(const AliFlowSelection* flowSelect)
+{
+ // default constructor (selection given or default selection)
+
+ if(flowSelect) { fFlowSelect = new AliFlowSelection(*flowSelect) ; }
+ else          { fFlowSelect = new AliFlowSelection() ; }
+ // output file (histograms)
+ fHistFileName = "flowAnalysPlot.root" ;
+ fHistFile     = 0 ;
+
+ // for phi weights
+ fPhiWgtFile   = 0 ;
+ fPhiBins = Flow::nPhiBins ;     
+ fPhiMin  = 0.;
+ fPhiMax  = 2*TMath::Pi() ; 
+
+ // flags 
+ fTrackLoop    = kTRUE ;  // main loop for charged tracks
+ fV0loop       = kTRUE ;  // correlation analysis is done also for neutral secundary vertex
+ fShuffle      = kFALSE ; // randomly reshuffles tracks
+ fV1Ep1Ep2     = kFALSE ; // disabled by default               
+ fEtaSub       = kFALSE ; // eta subevents
+ fReadPhiWgt   = kFALSE ; // if kTRUE & if flowPhiWgt file is there -> Phi Weights are used                                            
+ fBayWgt       = kFALSE ; // Bayesian Weights for P.Id. used   
+ fRePid        = kFALSE ; // recalculates the P.Id. (becomes kTRUE if new bayesian weights are plugged in)                     
+ fPtWgt        = kFALSE ; // pT as a weight
+ fEtaWgt       = kFALSE ; // eta as a weight
+ fOnePhiWgt    = kTRUE  ; // one/three phi-wgt histogram(s)
+//  fMaxLabel  = 1000 ;     // for labels histogram
+
+ fPhiWgtHistList = 0 ;
+ fVnResHistList = 0 ;
+}
+//-----------------------------------------------------------------------
+AliFlowAnalyser::~AliFlowAnalyser()
+{
+ // default distructor (no actions) 
+}
+//-----------------------------------------------------------------------
+Bool_t AliFlowAnalyser::Init() 
+{
+ // sets some defaults for the analysis
+ cout << "* FlowAnalysis *  -  Init()" << endl ; cout << endl ; 
+ // Open output files (->plots)
+ fHistFile = new TFile(fHistFileName.Data(), "RECREATE");
+ fHistFile->cd() ;
+
+ // counters and pointers to 0
+ fEventNumber = 0 ;
+ fTrackNumber = 0 ;    
+ fV0Number    = 0 ;
+ fPidId       = -1 ;
+ //fNumberOfEvents = 0 ;       
+ fNumberOfTracks = 0 ; 
+ fNumberOfV0s    = 0 ;         
+ fFlowEvent  = 0 ;
+ fFlowTrack  = 0 ;
+ fFlowV0     = 0 ;
+ fFlowTracks = 0 ;
+ fFlowV0s    = 0 ;
+ for(Int_t ii=0;ii<3;ii++) { fVertex[ii] = 0 ; }
+
+ // Check for Reading weights: if weight file is not there, wgt arrays are not used (phiwgt & bayesian)
+ if(!fPhiWgtFile) 
+ { 
+  fReadPhiWgt = kFALSE ; 
+  fBayWgt     = kFALSE ;
+  cout << "  No wgt file. Phi & Bayesian weights will not be used ! " << endl ;
+ }
+ // Histogram settings
+ fLabel = "Pseudorapidity" ;           if(strlen(fFlowSelect->PidPart()) != 0)            { fLabel = "Rapidity"; }
+ fPtMaxPart = Flow::fPtMaxPart ;       if(fFlowSelect->PtMaxPart())    { fPtMaxPart = fFlowSelect->PtMaxPart() ; }
+ fPtBinsPart = Flow::nPtBinsPart ;     if(fFlowSelect->PtBinsPart()) { fPtBinsPart = fFlowSelect->PtBinsPart() ; }
+ fPtMin = Flow::fPtMin ;       
+ fPtMax = Flow::fPtMax ;       
+ fEtaMin = Flow::fEtaMin ;
+ fEtaMax = Flow::fEtaMax ;
+ fPtBins  = Flow::nPtBins ;      
+ fEtaBins = Flow::nEtaBins ;      
+ // -
+ SetPtRangevEta(1.,0.);   // (Flow::fPtMin , Flow::fPtMax) ;
+ SetEtaRangevPt(1.,0.);   // (Flow::fEtaMin , Flow::fEtaMax) ;
+ // -
+ const float triggerMin      =  -1.5;
+ const float triggerMax      =  10.5;
+ const float chargeMin       =  -2.5;
+ const float chargeMax       =   2.5; 
+ const float dcaMin         =   0.0;
+ const float dcaMax         =  10.0; //  0.5; 
+ const float glDcaMax       =  50.0; 
+ const float chi2Min        =    0.;
+ const float chi2Max        =  500.; 
+ const float chi2normMax     =   50.; 
+ const float chi2MaxC       =   30.; 
+ const float chi2MaxI       =   60.; 
+ const float fitPtsMin       =  -0.5;
+ const float fitPtsMaxTpc    = 160.5;
+ const float fitPtsMaxIts    =   6.5;
+ const float fitPtsMaxTrd    = 130.5;
+ const float fitPtsMaxTof    =   1.5;
+ const float fitOverMaxMin   =    0.;
+ const float fitOverMaxMax   =   1.1;
+ const float multOverOrigMin =    0.;
+ const float multOverOrigMax =    1.;
+ const float vertexZMin      =  -10.;
+ const float vertexZMax      =   10.; 
+ const float vertexXYMin     =  -0.1;
+ const float vertexXYMax     =   0.1; 
+ const float etaSymMinPart   =   -1.;
+ const float etaSymMaxPart   =    1.;
+ const float etaSymMin       =   -2.;
+ const float etaSymMax       =    2.;
+ const float psiMin         =    0.;
+ const float psiMax         = 2*TMath::Pi() ; 
+ const float multMin        =    0. ;
+ const float multMax        =25000. ;
+ const float multV0         = 5000. ;
+ const float qMin           =    0. ;
+ const float qMax           =   20. ;
+ const float pidMin         =    0. ;
+ const float pidMax         =    1. ;
+ const float centMin        =  -0.5 ;
+ const float centMax        =   9.5 ;
+ const float logpMin        =  -2.5 ;
+ const float logpMax        =   2.5 ;
+ const float pMin           =    0. ;
+ const float pMax           =  100. ;
+ const float dEdxMax        = 1000. ;
+ const float dEdxMaxTPC             = 1500. ;
+ const float TOFmin         = 10000. ;
+ const float TOFmax         = 50000. ;
+ const float TRDmax         = 2000. ;
+ const float lgMin          = -1000. ;
+ const float lgMax          = 1000. ;
+ const float lgMinV0        =    0. ;
+ const float lgMaxV0        =   50. ;
+ const float massMin        =  -0.1 ;
+ const float massMax        =   2.1 ;
+ const float ZDCpartMin      =  -0.5 ;
+ const float ZDCpartMax             = 1000.5 ;
+ const float ZDCeMin        =    0. ;
+ const float ZDCeMax         = 10000. ;
+ // - 
+ enum { nTriggerBins     = 12,
+       nChargeBins       = 5,
+       nDcaBins          = 1000,
+       nChi2Bins         = 150,
+       nFitPtsBinsTpc    = 161,
+       nFitPtsBinsIts    = 7,
+       nFitPtsBinsTrd    = 131,
+       nFitPtsBinsTof    = 2,
+       nFitOverMaxBins   = 55,
+       nMultOverOrigBins =100,
+       nVertexZBins      = 200,
+       nVertexXYBins     = 1000,
+       nEtaSymBins       = 200,
+       nPhi3DBins        = 60,
+       nPsiBins          = 36,
+       nMultBins         = 250,
+       nPidBins          = 100,
+        nCentBins        = 10,
+       nDedxBins         = 1000,
+       nTofBins          = 1000,
+       nTrdBins          = 100,
+       nMomenBins        = 500,
+       nQbins            =  50,
+       nLgBins           = 500,
+       nMassBins         = 2200,
+       nZDCpartBins      = 1001,
+       nZDCeBins         = 200
+      } ;
+
+ // Histograms Booking ...
+ // Trigger
+ fHistTrigger = new TH1F("Flow_Trigger", "Flow_Trigger", nTriggerBins, triggerMin, triggerMax);
+ fHistTrigger->SetXTitle("Trigger: 1 minbias, 2 central, 3 laser, 10 other");
+ fHistTrigger->SetYTitle("Counts");
+
+ // Charge
+ fHistCharge = new TH1F("Flow_Charge", "Flow_Charge", nChargeBins, chargeMin, chargeMax);
+ fHistCharge->SetXTitle("Charge");
+ fHistCharge->SetYTitle("Counts");
+
+ // Reconstructed Momentum (constrained, if so)
+ fHistPtot = new TH1F("Flow_totalP","Flow_totalP", fPtBins, fPtMin, fPtMax);
+ fHistPtot->Sumw2();
+ fHistPtot->SetXTitle("P (GeV/c)");
+ fHistPtot->SetYTitle("Counts");
+
+ // Reconstructed pT (constrained, if so)
+ fHistPt = new TH1F("Flow_Pt","Flow_Pt", nMomenBins, pMin, pMax);
+ fHistPt->Sumw2();
+ fHistPt->SetXTitle("Pt (GeV/c)");
+ fHistPt->SetYTitle("Counts");
+   
+ // Reconstructed P.id vs pT 
+ fHistPidPt = new TH2F("Flow_PidPt","Flow_PidPt", 12, 0., 12., fPtBins, fPtMin, fPtMax);
+ fHistPidPt->Sumw2();
+ fHistPidPt->SetXTitle("e-, e+, mu-, mu+, pi-, pi+, K-, K+, pr-, pr+, d-, d+");
+ fHistPidPt->SetYTitle("Pt (GeV/c)");
+   
+ // Distance of closest approach - Transverse, Unsigned
+ fHistDca = new TH1F("Flow_TransDCA", "Flow_TransverseDCA", nDcaBins, dcaMin, dcaMax);
+ fHistDca->Sumw2();
+ fHistDca->SetXTitle("|Track's Signed dca (cm)|");
+ fHistDca->SetYTitle("Counts");
+
+ // Distance of closest approach - Transverse
+ fHistTransDca = new TH1F("Flow_TransDCA_Signed", "Flow_TransverseDCA_Signed", nDcaBins, -dcaMax, dcaMax);
+ fHistTransDca->Sumw2();
+ fHistTransDca->SetXTitle("Track's Transverse dca (cm)");
+ fHistTransDca->SetYTitle("Counts");
+
+ // Distance of closest approach - 3d
+ fHistDcaGlobal = new TH1F("Flow_3dDcaGlobal", "Flow_3dDcaGlobal", nDcaBins, dcaMin, glDcaMax);
+ fHistDcaGlobal->Sumw2();
+ fHistDcaGlobal->SetXTitle("|3d Global Track's dca to Vertex (cm)|");
+ fHistDcaGlobal->SetYTitle("Counts");
+
+ // Distance of closest approach for particles correlated with the event plane - 3d
+ fHistDcaGlobalPart = new TH1F("Flow_3dDcaGlobalPart", "Flow_3dDcaGlobalPart", nDcaBins, dcaMin, glDcaMax);
+ fHistDcaGlobalPart->Sumw2();
+ fHistDcaGlobalPart->SetXTitle("|3d Global Track's dca to Vertex (cm)|");
+ fHistDcaGlobalPart->SetYTitle("Counts");
+
+ // Distance of closest approach for particles NOT SELECTED for correlation with the event plane - 3d
+ fHistDcaGlobalOut = new TH1F("Flow_3dDcaGlobalOut", "Flow_3dDcaGlobalOut", nDcaBins, dcaMin, glDcaMax);
+ fHistDcaGlobalOut->Sumw2();
+ fHistDcaGlobalOut->SetXTitle("|3d Global Track's dca to Vertex (cm)|");
+ fHistDcaGlobalOut->SetYTitle("Counts");
+
+ // Yield Pt-Phi for constrained tracks
+ fHistPhiPtCon = new TH2D("Flow_PtPhi_Con", "Flow_PtPhi_Con", fPhiBins, fPhiMin, fPhiMax, fPtBins, fPtMin, fPtMax);
+ fHistPhiPtCon->Sumw2();
+ fHistPhiPtCon->SetXTitle("Phi");
+ fHistPhiPtCon->SetYTitle("Pt (GeV/c)");
+ // Yield Pt-Phi for UNconstrained tracks
+ fHistPhiPtUnc = new TH2D("Flow_PtPhi_Unc", "Flow_PtPhi_Unc", fPhiBins, fPhiMin, fPhiMax, fPtBins, fPtMin, fPtMax);
+ fHistPhiPtUnc->Sumw2();
+ fHistPhiPtUnc->SetXTitle("Phi");
+ fHistPhiPtUnc->SetYTitle("Pt (GeV/c)");
+ // Chi2 
+ // at the main vertex
+ fHistChi2 = new TH1F("Flow_Chi2", "Flow_Chi2", nChi2Bins, chi2Min, chi2MaxC);
+ fHistChi2->SetXTitle("Chi square at Main Vertex");
+ fHistChi2->SetYTitle("Counts");
+ // TPC
+ fHistChi2TPC = new TH1F("Flow_Chi2_TPC", "Flow_Chi2_TPC", nChi2Bins, chi2Min, chi2Max);
+ fHistChi2TPC->SetXTitle("Chi square for TPC");
+ fHistChi2TPC->SetYTitle("Counts");
+ // ITS
+ fHistChi2ITS = new TH1F("Flow_Chi2_ITS", "Flow_Chi2_ITS", nChi2Bins, chi2Min, chi2MaxI);
+ fHistChi2ITS->SetXTitle("Chi square for ITS");
+ fHistChi2ITS->SetYTitle("Counts");
+ // TRD
+ fHistChi2TRD = new TH1F("Flow_Chi2_TRD", "Flow_Chi2_TRD", nChi2Bins, chi2Min, chi2Max);
+ fHistChi2TRD->SetXTitle("Chi square for TRD");
+ fHistChi2TRD->SetYTitle("Counts");
+ // TOF
+ fHistChi2TOF = new TH1F("Flow_Chi2_TOF", "Flow_Chi2_TOF", nChi2Bins, chi2Min, chi2Max);
+ fHistChi2TOF->SetXTitle("Chi square for TOF");
+ fHistChi2TOF->SetYTitle("Counts");
+
+ // Chi2 normalized
+ // TPC
+ fHistChi2normTPC = new TH1F("Flow_Chi2norm_TPC", "Flow_Chi2norm_TPC", nChi2Bins, chi2Min, chi2normMax);
+ fHistChi2normTPC->SetXTitle("Normalized #Chi^{2} for TPC");
+ fHistChi2normTPC->SetYTitle("Counts");
+ // ITS
+ fHistChi2normITS = new TH1F("Flow_Chi2norm_ITS", "Flow_Chi2norm_ITS", nChi2Bins, chi2Min, chi2normMax);
+ fHistChi2normITS->SetXTitle("Normalized #Chi^{2} for ITS");
+ fHistChi2normITS->SetYTitle("Counts");
+ // TRD
+ fHistChi2normTRD = new TH1F("Flow_Chi2norm_TRD", "Flow_Chi2norm_TRD", nChi2Bins, chi2Min, chi2normMax);
+ fHistChi2normTRD->SetXTitle("Normalized #Chi^{2} for TRD");
+ fHistChi2normTRD->SetYTitle("Counts");
+ // TOF
+ fHistChi2normTOF = new TH1F("Flow_Chi2norm_TOF", "Flow_Chi2norm_TOF", nChi2Bins, chi2Min, chi2normMax);
+ fHistChi2normTOF->SetXTitle("Normalized #Chi^{2} for TOF");
+ fHistChi2normTOF->SetYTitle("Counts");
+ // FitPts
+ // TPC
+ fHistFitPtsTPC = new TH1F("Flow_FitPts_TPC", "Flow_FitPts_TPC", nFitPtsBinsTpc, fitPtsMin, fitPtsMaxTpc);
+ fHistFitPtsTPC->SetXTitle("Fit Points");
+ fHistFitPtsTPC->SetYTitle("Counts");
+ // ITS
+ fHistFitPtsITS = new TH1F("Flow_HitPts_ITS", "Flow_HitPts_ITS", nFitPtsBinsIts, fitPtsMin, fitPtsMaxIts);
+ fHistFitPtsITS->SetXTitle("Fit Points");
+ fHistFitPtsITS->SetYTitle("Counts");
+ // TRD
+ fHistFitPtsTRD = new TH1F("Flow_FitPts_TRD", "Flow_FitPts_TRD", nFitPtsBinsTrd, fitPtsMin, fitPtsMaxTrd);
+ fHistFitPtsTRD->SetXTitle("Fit Points");
+ fHistFitPtsTRD->SetYTitle("Counts");
+ // TOF
+ fHistFitPtsTOF = new TH1F("Flow_HitPts_TOF", "Flow_HitPts_TOF", nFitPtsBinsTof, fitPtsMin, fitPtsMaxTof);
+ fHistFitPtsTOF->SetXTitle("Fit Points");
+ fHistFitPtsTOF->SetYTitle("Counts");
+
+ // MaxPts 
+ // TPC
+ fHistMaxPtsTPC = new TH1F("Flow_MaxPts_TPC", "Flow_MaxPts_TPC", nFitPtsBinsTpc, fitPtsMin, fitPtsMaxTpc);
+ fHistMaxPtsTPC->SetXTitle("Max Points");
+ fHistMaxPtsTPC->SetYTitle("Counts");
+ // ITS
+ fHistMaxPtsITS = new TH1F("Flow_MaxPts_ITS", "Flow_MaxPts_ITS", nFitPtsBinsIts, fitPtsMin, fitPtsMaxIts);
+ fHistMaxPtsITS->SetXTitle("Max Points");
+ fHistMaxPtsITS->SetYTitle("Counts");
+ // TRD
+ fHistMaxPtsTRD = new TH1F("Flow_MaxPts_TRD", "Flow_MaxPts_TRD", nFitPtsBinsTrd, fitPtsMin, fitPtsMaxTrd);
+ fHistMaxPtsTRD->SetXTitle("Max Points");
+ fHistMaxPtsTRD->SetYTitle("Counts");
+ // TOF
+ fHistMaxPtsTOF = new TH1F("Flow_MaxPts_TOF", "Flow_MaxPts_TOF", nFitPtsBinsTof, fitPtsMin, fitPtsMaxTof);
+ fHistMaxPtsTOF->SetXTitle("Max Points");
+ fHistMaxPtsTOF->SetYTitle("Counts");
+
+ // FitOverMax 
+ // Tpc
+ fHistFitOverMaxTPC = new TH1F("Flow_FitOverMax_TPC", "Flow_FitOverMax_TPC", nFitOverMaxBins, fitOverMaxMin, fitOverMaxMax);
+ fHistFitOverMaxTPC->SetXTitle("(Fit Points - 1) / Max Points");
+ fHistFitOverMaxTPC->SetYTitle("Counts");  
+ // All
+ fHistFitOverMax = new TH1F("Flow_FitOverMax", "Flow_FitOverMax", nFitOverMaxBins, fitOverMaxMin, fitOverMaxMax);
+ fHistFitOverMax->SetXTitle("(Fit Points - 1) / Max Points");
+ fHistFitOverMax->SetYTitle("Counts");  
+
+ // lenght
+ fHistLenght = new TH1F("Flow_TrackLenght", "Flow_TrackLenght", nLgBins, lgMin, lgMax);
+ fHistLenght->SetXTitle("Lenght of the Track (cm)");
+ fHistLenght->SetYTitle("Counts");
+
+  // OrigMult
+ fHistOrigMult = new TH1F("Flow_OrigMult", "Flow_OrigMult", nMultBins, multMin, multMax);
+ fHistOrigMult->SetXTitle("Original Mult");
+ fHistOrigMult->SetYTitle("Counts");
+
+ // MultEta
+ fHistMultEta = new TH1F("Flow_MultEta", "Flow_MultEta", nMultBins, multMin, multMax);
+ fHistMultEta->SetXTitle("Mult for Centrality");
+ fHistMultEta->SetYTitle("Counts");
+   
+ // Mult
+ fHistMult = new TH1F("Flow_Mult", "Flow_Mult", nMultBins, multMin, multMax);
+ fHistMult->SetXTitle("Mult");
+ fHistMult->SetYTitle("Counts");
+
+ // V0s multiplicity
+ fHistV0Mult = new TH1F("FlowV0_Mult","FlowV0_Mult", nMultBins, multMin, multV0);
+ fHistV0Mult->SetXTitle("V0s Multiplicity");
+ fHistV0Mult->SetYTitle("Counts");
+   
+ // MultOverOrig
+ fHistMultOverOrig = new TH1F("Flow_MultOverOrig", "Flow_MultOverOrig", nMultOverOrigBins, multOverOrigMin, multOverOrigMax);
+ fHistMultOverOrig->SetXTitle("Mult / Orig. Mult");
+ fHistMultOverOrig->SetYTitle("Counts");
+   
+ // Mult correlated with the event planes
+ fHistMultPart = new TH1F("Flow_MultPart", "Flow_MultPart", 2*nMultBins, multMin, multMax);
+ fHistMultPart->SetXTitle("Mult of Correlated Particles");
+ fHistMultPart->SetYTitle("Counts");
+   
+ // Mult correlated with the event planes in 1 unit rapidity
+ fHistMultPartUnit = new TH1F("Flow_MultPartUnit", "Flow_MultPartUnit", 2*nMultBins, multMin, multMax/2);
+ fHistMultPartUnit->SetXTitle("Mult of Correlated Particles (-0.5 < eta < 0.5)");
+ fHistMultPartUnit->SetYTitle("Counts");
+   
+ // Mult of V0s correlated with the event planes
+ fHistV0MultPart = new TH1F("FlowV0_MultPart", "FlowV0_MultPart", nMultBins, multMin, multV0);
+ fHistV0MultPart->SetXTitle("Mult of Correlated V0s");
+ fHistV0MultPart->SetYTitle("Counts");
+   
+ // VertexZ
+ fHistVertexZ = new TH1F("Flow_VertexZ", "Flow_VertexZ", nVertexZBins, vertexZMin, vertexZMax);
+ fHistVertexZ->SetXTitle("Vertex Z (cm)");
+ fHistVertexZ->SetYTitle("Counts");
+   
+ // VertexXY
+ fHistVertexXY2D = new TH2F("Flow_VertexXY2D", "Flow_VertexXY2D", nVertexXYBins, vertexXYMin, vertexXYMax, nVertexXYBins, vertexXYMin, vertexXYMax);
+ fHistVertexXY2D->SetXTitle("Vertex X (cm)");
+ fHistVertexXY2D->SetYTitle("Vertex Y (cm)");
+   
+ // EtaSym vs. Vertex Z Tpc
+ fHistEtaSymVerZ2D = new TH2F("Flow_EtaSymVerZ2D", "Flow_EtaSymVerZ2D", nVertexZBins, vertexZMin, vertexZMax, nEtaSymBins, etaSymMin, etaSymMax);
+ fHistEtaSymVerZ2D->SetXTitle("Vertex Z (cm)");
+ fHistEtaSymVerZ2D->SetYTitle("Eta Symmetry TPC");
+
+ // EtaSym Tpc
+ fHistEtaSym = new TH1F("Flow_EtaSym_TPC", "Flow_EtaSym_TPC", nEtaSymBins, etaSymMin, etaSymMax);
+ fHistEtaSym->SetXTitle("Eta Symmetry Ratio TPC");
+ fHistEtaSym->SetYTitle("Counts");
+   
+ // EtaSym vs. Vertex Z Tpc - correlation analysis
+ fHistEtaSymVerZ2DPart = new TH2F("Flow_EtaSymVerZ2D_part", "Flow_EtaSymVerZ2D_part", nVertexZBins, vertexZMin, vertexZMax, nEtaSymBins, etaSymMinPart, etaSymMaxPart);
+ fHistEtaSymVerZ2DPart->SetXTitle("Vertex Z (cm)");
+ fHistEtaSymVerZ2DPart->SetYTitle("Eta Symmetry TPC");
+
+ // EtaSym Tpc - correlation analysis
+ fHistEtaSymPart = new TH1F("Flow_EtaSym_TPC_part", "Flow_EtaSym_TPC_part", nEtaSymBins, etaSymMinPart, etaSymMaxPart);
+ fHistEtaSymPart->SetXTitle("Eta Symmetry Ratio TPC");
+ fHistEtaSymPart->SetYTitle("Counts");
+   
+ // phi , whatever
+ fHistPhi = new TH1F("Flow_xPhi", "Flow_xPhi (all)", fPhiBins, fPhiMin, fPhiMax);
+ fHistPhi->SetXTitle("Phi (rad)");
+ fHistPhi->SetYTitle("Counts");
+
+ // phi constrained
+ fHistPhiCons = new TH1F("Flow_cPhi", "Flow_cPhi", fPhiBins, fPhiMin, fPhiMax);
+ fHistPhiCons->SetXTitle("cPhi (rad)");
+ fHistPhiCons->SetYTitle("Counts");
+   
+ // EtaPtPhi , whatever
+ fHistAllEtaPtPhi3D = new TH3F("Flow_EtaPtPhi3Dall", "Flow_EtaPtPhi3Dall (whatever)", fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax, nPhi3DBins, fPhiMin, fPhiMax);
+ fHistAllEtaPtPhi3D->SetXTitle("Eta");
+ fHistAllEtaPtPhi3D->SetYTitle("Pt (GeV/c)");
+ fHistAllEtaPtPhi3D->SetZTitle("Phi (rad)");
+   
+ // Constrained EtaPtPhi
+ fHistConsEtaPtPhi3D = new TH3F("Flow_consEtaPtPhi3D", "Flow_consEtaPtPhi3D (constrainable)", fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax, nPhi3DBins, fPhiMin, fPhiMax);
+ fHistConsEtaPtPhi3D->SetXTitle("cEta");
+ fHistConsEtaPtPhi3D->SetYTitle("cPt (GeV/c)");
+ fHistConsEtaPtPhi3D->SetZTitle("cPhi (rad)");
+   
+ // Global EtaPtPhi
+ fHistGlobEtaPtPhi3D = new TH3F("Flow_globEtaPtPhi3D", "Flow_globEtaPtPhi3D (constrainable)", fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax, nPhi3DBins, fPhiMin, fPhiMax);
+ fHistGlobEtaPtPhi3D->SetXTitle("gEta");
+ fHistGlobEtaPtPhi3D->SetYTitle("gPt (GeV/c)");
+ fHistGlobEtaPtPhi3D->SetZTitle("gPhi (rad)");
+
+ // UnConstrained EtaPtPhi
+ fHistUncEtaPtPhi3D = new TH3F("Flow_uncEtaPtPhi3D", "Flow_uncEtaPtPhi3D (un-constrainable)", fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax, nPhi3DBins, fPhiMin, fPhiMax);
+ fHistUncEtaPtPhi3D->SetXTitle("gEta");
+ fHistUncEtaPtPhi3D->SetYTitle("gPt (GeV/c)");
+ fHistUncEtaPtPhi3D->SetZTitle("gPhi (rad)");
+   
+ // EtaPtPhi for particles correlated with the event plane
+ fHistEtaPtPhi3DPart = new TH3F("Flow_EtaPtPhi3Dpart", "Flow_EtaPtPhi3Dpart (selected part)", fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax, nPhi3DBins, fPhiMin, fPhiMax);
+ fHistEtaPtPhi3DPart->SetXTitle("Eta");
+ fHistEtaPtPhi3DPart->SetYTitle("Pt (GeV/c)");
+ fHistEtaPtPhi3DPart->SetZTitle("Phi (rad)");
+   
+ // EtaPtPhi for particles NOT SELECTED for correlation with the event plane
+ fHistEtaPtPhi3DOut = new TH3F("Flow_EtaPtPhi3Dout", "Flow_EtaPtPhi3Dout (NOT selected part)", fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax, nPhi3DBins, fPhiMin, fPhiMax);
+ fHistEtaPtPhi3DOut->SetXTitle("Eta");
+ fHistEtaPtPhi3DOut->SetYTitle("Pt (GeV/c)");
+ fHistEtaPtPhi3DOut->SetZTitle("Phi (rad)");
+   
+ // Yield Pt-Phi for all positive
+ fHistPtPhiPos = new TH2D("Flow_PtPhi_Plus", "Flow_PtPhi_Plus", fPhiBins, fPhiMin, fPhiMax, 50, fPtMin, fPtMax);
+ fHistPtPhiPos->Sumw2();
+ fHistPtPhiPos->SetXTitle("Phi");
+ fHistPtPhiPos->SetYTitle("Pt (GeV/c)");
+
+ // Yield Pt-Phi for all negative
+ fHistPtPhiNeg = new TH2D("Flow_PtPhi_Minus", "Flow_PtPhi_Minus", fPhiBins, fPhiMin, fPhiMax, 50, fPtMin, fPtMax);
+ fHistPtPhiNeg->Sumw2();
+ fHistPtPhiNeg->SetXTitle("Phi");
+ fHistPtPhiNeg->SetYTitle("Pt (GeV/c)");
+   
+ // Yield for all particles
+ fHistYieldAll2D = new TH2D("Flow_YieldAll2D", "Flow_YieldAll2D", fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax);
+ fHistYieldAll2D->Sumw2();
+ fHistYieldAll2D->SetXTitle("Pseudorapidty");
+ fHistYieldAll2D->SetYTitle("Pt (GeV/c)");
+
+ // Yield for constrainable tracks
+ fHistYieldCon2D = new TH2D("Flow_YieldCons2D", "Flow_YieldCons2D", fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax);
+ fHistYieldCon2D->Sumw2();
+ fHistYieldCon2D->SetXTitle("Pseudorapidty");
+ fHistYieldCon2D->SetYTitle("Pt (GeV/c)");
+
+ // Yield for un-constrainable tracks
+ fHistYieldUnc2D = new TH2D("Flow_YieldUnc2D", "Flow_YieldUnc2D", fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax);
+ fHistYieldUnc2D->Sumw2();
+ fHistYieldUnc2D->SetXTitle("Pseudorapidty");
+ fHistYieldUnc2D->SetYTitle("Pt (GeV/c)");
+
+ // Yield for particles correlated with the event plane
+ fHistYieldPart2D = new TH2D("Flow_YieldPart2D", "Flow_YieldPart2D (selected part)", fEtaBins, fEtaMin, fEtaMax, fPtBinsPart, fPtMin, fPtMaxPart);
+ fHistYieldPart2D->Sumw2();
+ fHistYieldPart2D->SetXTitle((char*)fLabel.Data());
+ fHistYieldPart2D->SetYTitle("Pt (GeV/c)");
+
+ // Yield for particles NOT SELECTED for correlation with the event plane
+ fHistYieldOut2D = new TH2D("Flow_YieldOut2D", "Flow_YieldOut2D (NOT selected part)", fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax);
+ fHistYieldOut2D->Sumw2();
+ fHistYieldOut2D->SetXTitle("Pseudorapidty");
+ fHistYieldOut2D->SetYTitle("Pt (GeV/c)");
+ // invariant Mass for all particles (from TOF)
+ fHistInvMass = new TH1F("Flow_InvMass", "Flow_InvMass (tof)", nMassBins, massMin, massMax);
+ fHistInvMass->SetXTitle("Invariant Mass (GeV)");
+ fHistInvMass->SetYTitle("Counts");
+ // invariant Mass for particles correlated with the event plane (from TOF)
+ fHistInvMassPart = new TH1F("Flow_InvMassPart", "Flow_InvMassPart (tof)", nMassBins, massMin, massMax);
+ fHistInvMassPart->SetXTitle("Invariant Mass (GeV)");
+ fHistInvMassPart->SetYTitle("Counts");
+ // invariant Mass for particles NOT SELECTED for correlation with the event plane (from TOF)
+ fHistInvMassOut = new TH1F("Flow_InvMassOut", "Flow_InvMassOut (tof)", nMassBins, massMin, massMax);
+ fHistInvMassOut->SetXTitle("Invariant Mass (GeV)");
+ fHistInvMassOut->SetYTitle("Counts");
+
+ // Mean Eta in each bin for particles correlated with the event plane
+ fHistBinEta = new TProfile("Flow_Bin_Eta", "Flow_Bin_Eta_part (selected part)", fEtaBins, fEtaMin, fEtaMax, fEtaMin, fEtaMax, "");
+ fHistBinEta->SetXTitle((char*)fLabel.Data());
+ fHistBinEta->SetYTitle((char*)fLabel.Data());
+ // Mean Pt in each bin for particles correlated with the event plane
+ fHistBinPt = new TProfile("Flow_Bin_Pt", "Flow_Bin_Pt_part (selected part)", fPtBinsPart, fPtMin, fPtMaxPart, fPtMin, fPtMaxPart, "");
+ fHistBinPt->SetXTitle("Pt (GeV/c)");
+ fHistBinPt->SetYTitle("<Pt> (GeV/c)");
+ // cos(n*phiLab)
+ fHistCosPhi = new TProfile("Flow_CosPhiLab", "Flow_CosPhiLab", Flow::nHars, 0.5, (float)(Flow::nHars) + 0.5, -100., 100., "");
+ fHistCosPhi->SetXTitle("Harmonic");
+ fHistCosPhi->SetYTitle("<cos(n*PhiLab)> (%)");
+   
+ // PID pi+
+ fHistPidPiPlus = new TH1F("Flow_PidPiPlus", "Flow_PidPiPlus", nPidBins, pidMin, pidMax);
+ fHistPidPiPlus->SetXTitle("ALICE P.Id.");
+ fHistPidPiPlus->SetYTitle("Counts");
+   
+ // PID pi-
+ fHistPidPiMinus = new TH1F("Flow_PidPiMinus", "Flow_PidPiMinus", nPidBins, pidMin, pidMax);
+ fHistPidPiMinus->SetXTitle("ALICE P.Id.");
+ fHistPidPiMinus->SetYTitle("Counts");
+   
+ // PID proton
+ fHistPidProton = new TH1F("Flow_PidProton", "Flow_PidProton", nPidBins, pidMin, pidMax);
+ fHistPidProton->SetXTitle("ALICE P.Id.");
+ fHistPidProton->SetYTitle("Counts");
+
+ // PID anti proton
+ fHistPidAntiProton = new TH1F("Flow_PidAntiProton", "Flow_PidAntiProton", nPidBins, pidMin, pidMax);
+ fHistPidAntiProton->SetXTitle("ALICE P.Id.");
+ fHistPidAntiProton->SetYTitle("Counts");
+
+ // PID Kplus
+ fHistPidKplus = new TH1F("Flow_PidKplus", "Flow_PidKplus", nPidBins, pidMin, pidMax);
+ fHistPidKplus->SetXTitle("ALICE P.Id.");
+ fHistPidKplus->SetYTitle("Counts");
+
+ // PID Kminus
+ fHistPidKminus = new TH1F("Flow_PidKminus", "Flow_PidKminus", nPidBins, pidMin, pidMax);
+ fHistPidKminus->SetXTitle("ALICE P.Id.");
+ fHistPidKminus->SetYTitle("Counts");
+
+ // PID deuteron
+ fHistPidDeuteron = new TH1F("Flow_PidDeuteron", "Flow_PidDeuteron", nPidBins, pidMin, pidMax);
+ fHistPidDeuteron->SetXTitle("ALICE P.Id.");
+ fHistPidDeuteron->SetYTitle("Counts");
+
+ // PID anti deuteron
+ fHistPidAntiDeuteron = new TH1F("Flow_PidAntiDeuteron", "Flow_PidAntiDeuteron", nPidBins, pidMin, pidMax);
+ fHistPidAntiDeuteron->SetXTitle("ALICE P.Id.");
+ fHistPidAntiDeuteron->SetYTitle("Counts");
+
+ // PID electron
+ fHistPidElectron = new TH1F("Flow_PidElectron", "Flow_PidElectron", nPidBins, pidMin, pidMax);
+ fHistPidElectron->SetXTitle("ALICE P.Id.");
+ fHistPidElectron->SetYTitle("Counts");
+
+ // PID positron
+ fHistPidPositron = new TH1F("Flow_PidPositron", "Flow_PidPositron", nPidBins, pidMin, pidMax);
+ fHistPidPositron->SetXTitle("ALICE P.Id.");
+ fHistPidPositron->SetYTitle("Counts");
+
+ // PID Muon+
+ fHistPidMuonPlus = new TH1F("Flow_PidMuonPlus", "Flow_PidMuonPlus", nPidBins, pidMin, pidMax);
+ fHistPidMuonPlus->SetXTitle("ALICE P.Id.");
+ fHistPidMuonPlus->SetYTitle("Counts");
+
+ // PID Muon-
+ fHistPidMuonMinus = new TH1F("Flow_PidMuonMinus", "Flow_PidMuonMinus", nPidBins, pidMin, pidMax);
+ fHistPidMuonMinus->SetXTitle("ALICE P.Id.");
+ fHistPidMuonMinus->SetYTitle("Counts");
+
+ // PID pi+ selected
+ fHistPidPiPlusPart = new TH1F("Flow_PidPiPlusPart", "Flow_PidPiPlusPart", nPidBins, pidMin, pidMax);
+ fHistPidPiPlusPart->SetXTitle("ALICE P.Id. (pid = pi+)");
+ fHistPidPiPlusPart->SetYTitle("Counts");
+   
+ // PID pi- selected
+ fHistPidPiMinusPart = new TH1F("Flow_PidPiMinusPart", "Flow_PidPiMinusPart", nPidBins, pidMin, pidMax);
+ fHistPidPiMinusPart->SetXTitle("ALICE P.Id. (pid = pi-)");
+ fHistPidPiMinusPart->SetYTitle("Counts");
+   
+ // PID proton selected
+ fHistPidProtonPart = new TH1F("Flow_PidProtonPart", "Flow_PidProtonPart", nPidBins, pidMin, pidMax);
+ fHistPidProtonPart->SetXTitle("ALICE P.Id. (pid = p)");
+ fHistPidProtonPart->SetYTitle("Counts");
+
+ // PID anti proton selected
+ fHistPidAntiProtonPart = new TH1F("Flow_PidAntiProtonPart", "Flow_PidAntiProtonPart", nPidBins, pidMin, pidMax);
+ fHistPidAntiProtonPart->SetXTitle("ALICE P.Id. (pid = p-)");
+ fHistPidAntiProtonPart->SetYTitle("Counts");
+
+ // PID Kplus selected
+ fHistPidKplusPart = new TH1F("Flow_PidKplusPart", "Flow_PidKplusPart", nPidBins, pidMin, pidMax);
+ fHistPidKplusPart->SetXTitle("ALICE P.Id. (pid = K+)");
+ fHistPidKplusPart->SetYTitle("Counts");
+
+ // PID Kminus selected
+ fHistPidKminusPart = new TH1F("Flow_PidKminusPart", "Flow_PidKminusPart", nPidBins, pidMin, pidMax);
+ fHistPidKminusPart->SetXTitle("ALICE P.Id. (pid = K-)");
+ fHistPidKminusPart->SetYTitle("Counts");
+
+ // PID deuteron selected
+ fHistPidDeuteronPart = new TH1F("Flow_PidDeuteronPart", "Flow_PidDeuteronPart", nPidBins, pidMin, pidMax);
+ fHistPidDeuteronPart->SetXTitle("ALICE P.Id. (pid = d)");
+ fHistPidDeuteronPart->SetYTitle("Counts");
+
+ // PID anti deuteron selected
+ fHistPidAntiDeuteronPart = new TH1F("Flow_PidAntiDeuteronPart", "Flow_PidAntiDeuteronPart", nPidBins, pidMin, pidMax);
+ fHistPidAntiDeuteronPart->SetXTitle("ALICE P.Id. (pid = d--)");
+ fHistPidAntiDeuteronPart->SetYTitle("Counts");
+
+ // PID electron selected
+ fHistPidElectronPart = new TH1F("Flow_PidElectronPart", "Flow_PidElectronPart", nPidBins, pidMin, pidMax);
+ fHistPidElectronPart->SetXTitle("ALICE P.Id. (pid = e-)");
+ fHistPidElectronPart->SetYTitle("Counts");
+
+ // PID positron selected
+ fHistPidPositronPart = new TH1F("Flow_PidPositronPart", "Flow_PidPositronPart", nPidBins, pidMin, pidMax);
+ fHistPidPositronPart->SetXTitle("ALICE P.Id. (pid = e+)");
+ fHistPidPositronPart->SetYTitle("Counts");
+
+ // PID Muon+ selected
+ fHistPidMuonPlusPart = new TH1F("Flow_PidMuonPlusPart", "Flow_PidMuonPlusPart", nPidBins, pidMin, pidMax);
+ fHistPidMuonPlusPart->SetXTitle("ALICE P.Id. (pid = mu+)");
+ fHistPidMuonPlusPart->SetYTitle("Counts");
+
+ // PID Muon- selected
+ fHistPidMuonMinusPart = new TH1F("Flow_PidMuonMinusPart", "Flow_PidMuonMinusPart", nPidBins, pidMin, pidMax);
+ fHistPidMuonMinusPart->SetXTitle("ALICE P.Id. (pid = mu-)");
+ fHistPidMuonMinusPart->SetYTitle("Counts");
+
+ // PID multiplicities (all)
+ fHistPidMult = new TProfile("Flow_PidMult", "Flow_PidMult", 15, 0.5, 15.5, "");
+ fHistPidMult->SetXTitle("all, h+, h-, pi+, pi-, pr+, pr-, K+, K-, d+, d-, e-, e+, mu-, mu+");
+ fHistPidMult->SetYTitle("Multiplicity");
+
+ // PID for all tracks
+ fHistBayPidMult = new TH1F("Flow_BayPidMult","Flow_BayPidMult",Flow::nPid,-0.5,((float)Flow::nPid-0.5));
+ fHistBayPidMult->Sumw2() ;
+ fHistBayPidMult->SetXTitle("e+/- , mu+/- , pi+/- , K+/- , p+/- , d+/- ");
+ fHistBayPidMult->SetYTitle("Counts");
+   
+ // PID for particles correlated with the event plane
+ fHistBayPidMultPart = new TH1F("Flow_BayPidMult_Part","Flow_BayPidMult_Part",Flow::nPid,-0.5,((float)Flow::nPid-0.5));
+ fHistBayPidMultPart->Sumw2() ;
+ fHistBayPidMultPart->SetXTitle("e+/- , mu+/- , pi+/- , K+/- , p+/- , d+/- ");
+ fHistBayPidMultPart->SetYTitle("Counts");
+
+ // Centrality
+ fHistCent = new TH1F("Flow_Cent", "Flow_Cent", nCentBins, centMin, centMax);
+ fHistCent->SetXTitle("Centrality Bin");
+ fHistCent->SetYTitle("Counts");
+   
+ // Deposited Energy in ZDC
+ fHistEnergyZDC = new TH2F("Flow_ZDC_E", "Flow_ZDC_E", 3, 0., 3., nZDCeBins, ZDCeMin, ZDCeMax);
+ fHistEnergyZDC->SetXTitle("neutron , proton , e.m.");
+ fHistEnergyZDC->SetYTitle("ZDC energy");
+
+ // Part. versus Energy in ZDC
+ fHistPartZDC = new TH1F("Flow_ZDC_Participants", "Flow_ZDC_Participants", nZDCpartBins, ZDCpartMin, ZDCpartMax);
+ fHistPartZDC->SetXTitle("ZDC part");
+ fHistPartZDC->SetYTitle("Counts");
+
+ // MeanDedxPos TPC
+ fHistMeanDedxPos2D = new TH2F("Flow_MeanDedxPos2D_TPC","Flow_MeanDedxPos2D_TPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
+ fHistMeanDedxPos2D->SetXTitle("log(momentum) (GeV/c)");
+ fHistMeanDedxPos2D->SetYTitle("mean dEdx (+)");
+ // MeanDedxNeg TPC
+ fHistMeanDedxNeg2D = new TH2F("Flow_MeanDedxNeg2D_TPC","Flow_MeanDedxNeg2D_TPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
+ fHistMeanDedxNeg2D->SetXTitle("log(momentum) (GeV/c)");
+ fHistMeanDedxNeg2D->SetYTitle("mean dEdx (-)");
+
+ // MeanDedxPos ITS
+ fHistMeanDedxPos2DITS = new TH2F("Flow_MeanDedxPos2D_ITS","Flow_MeanDedxPos2D_ITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
+ fHistMeanDedxPos2DITS->SetXTitle("log(momentum) (GeV/c)");
+ fHistMeanDedxPos2DITS->SetYTitle("mean dEdx (+)");
+ // MeanDedxNeg ITS
+ fHistMeanDedxNeg2DITS = new TH2F("Flow_MeanDedxNeg2D_ITS","Flow_MeanDedxNeg2D_ITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
+ fHistMeanDedxNeg2DITS->SetXTitle("log(momentum) (GeV/c)");
+ fHistMeanDedxNeg2DITS->SetYTitle("mean dEdx (-)");
+
+ // MeanDedxPos TPC 3D selected Part
+ fHistMeanDedxPos3DPart = new TH3F("Flow_MeanDedxPos3DPart_TPC","Flow_MeanDedxPos3DPart_TPC", nMomenBins, logpMin, logpMax, nDedxBins, 0., dEdxMaxTPC, Flow::nPid, 0., Flow::nPid);
+ fHistMeanDedxPos3DPart->SetXTitle("log(momentum) (GeV/c)");
+ fHistMeanDedxPos3DPart->SetYTitle("mean dEdx (+)");
+ fHistMeanDedxPos3DPart->SetZTitle("e , mu , pi , k , p , d");
+ // MeanDedxNeg TPC 3D selected Part
+ fHistMeanDedxNeg3DPart = new TH3F("Flow_MeanDedxNeg3DPart_TPC","Flow_MeanDedxNeg3DPart_TPC", nMomenBins, logpMin, logpMax, nDedxBins, 0., dEdxMaxTPC, Flow::nPid, 0., Flow::nPid);
+ fHistMeanDedxNeg3DPart->SetXTitle("log(momentum) (GeV/c)");
+ fHistMeanDedxNeg3DPart->SetYTitle("mean dEdx (-)");
+ fHistMeanDedxNeg3DPart->SetZTitle("e , mu , pi , k , p , d");
+
+ // MeanDedxPos ITS 3D selected Part
+ fHistMeanDedxPos3DPartITS = new TH3F("Flow_MeanDedxPos3DPart_ITS","Flow_MeanDedxPos3DPart_ITS", nMomenBins, logpMin, logpMax, nDedxBins, 0., dEdxMax, Flow::nPid, 0., Flow::nPid);
+ fHistMeanDedxPos3DPartITS->SetXTitle("log(momentum) (GeV/c)");
+ fHistMeanDedxPos3DPartITS->SetYTitle("mean dEdx (+)");
+ fHistMeanDedxPos3DPartITS->SetZTitle("e , mu , pi , k , p , d");
+ // MeanDedxNeg ITS 3D selected Part
+ fHistMeanDedxNeg3DPartITS = new TH3F("Flow_MeanDedxNeg3DPart_ITS","Flow_MeanDedxNeg3DPart_ITS", nMomenBins, logpMin, logpMax, nDedxBins, 0., dEdxMax, Flow::nPid, 0., Flow::nPid);
+ fHistMeanDedxNeg3DPartITS->SetXTitle("log(momentum) (GeV/c)");
+ fHistMeanDedxNeg3DPartITS->SetYTitle("mean dEdx (-)");
+ fHistMeanDedxNeg3DPartITS->SetZTitle("e , mu , pi , k , p , d");
+
+ // MeanSignalPos TRD
+ fHistMeanDedxPos2DTRD = new TH2F("Flow_MeanSignalPos2D_TRD","Flow_MeanSignalPos2D_TRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
+ fHistMeanDedxPos2DTRD->SetXTitle("log(momentum) (GeV/c)");
+ fHistMeanDedxPos2DTRD->SetYTitle("mean TRD (+)");
+ // MeanSignalNeg TRD
+ fHistMeanDedxNeg2DTRD = new TH2F("Flow_MeanSignalNeg2D_TRD","Flow_MeanSignalNeg2D_TRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
+ fHistMeanDedxNeg2DTRD->SetXTitle("log(momentum) (GeV/c)");
+ fHistMeanDedxNeg2DTRD->SetYTitle("mean TRD (-)");
+
+ // MeanTimePos TOF
+ fHistMeanDedxPos2DTOF = new TH2F("Flow_MeanTimePos2D_TOF","Flow_MeanTimePos2D_TOF", nMomenBins, logpMin, logpMax, nTofBins, TOFmin, TOFmax);
+ fHistMeanDedxPos2DTOF->SetXTitle("log(momentum) (GeV/c)");
+ fHistMeanDedxPos2DTOF->SetYTitle("mean Time of Flight (+)");
+ // MeanTimeNeg TOF
+ fHistMeanDedxNeg2DTOF = new TH2F("Flow_MeanTimeNeg2D_TOF","Flow_MeanTimeNeg2D_TOF", nMomenBins, logpMin, logpMax, nTofBins, TOFmin, TOFmax);
+ fHistMeanDedxNeg2DTOF->SetXTitle("log(momentum) (GeV/c)");
+ fHistMeanDedxNeg2DTOF->SetYTitle("mean Time of Flight (-)");
+ // Detector response for each particle { ... 
+ // MeanDedx PiPlus - TPC
+ fHistMeanTPCPiPlus = new TH2F("Flow_MeanDedxPiPlusTPC", "Flow_MeanDedxPiPlusTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
+ fHistMeanTPCPiPlus->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTPCPiPlus->SetYTitle("mean dEdx (pi+)");
+ // MeanDedx PiMinus
+ fHistMeanTPCPiMinus = new TH2F("Flow_MeanDedxPiMinusTPC", "Flow_MeanDedxPiMinusTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
+ fHistMeanTPCPiMinus->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTPCPiMinus->SetYTitle("mean dEdx (pi-)");
+ // MeanDedx Proton
+ fHistMeanTPCProton = new TH2F("Flow_MeanDedxProtonTPC", "Flow_MeanDedxProtonTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
+ fHistMeanTPCProton->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTPCProton->SetYTitle("mean dEdx (pr+)");
+ // MeanDedx Pbar
+ fHistMeanTPCPbar = new TH2F("Flow_MeanDedxPbarTPC", "Flow_MeanDedxPbarTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
+ fHistMeanTPCPbar->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTPCPbar->SetYTitle("mean dEdx (pr-)");
+ // MeanDedx Kplus
+ fHistMeanTPCKplus = new TH2F("Flow_MeanDedxKplusTPC", "Flow_MeanDedxKplusTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
+ fHistMeanTPCKplus->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTPCKplus->SetYTitle("mean dEdx (K+)");
+ // MeanDedx Kminus
+ fHistMeanTPCKminus = new TH2F("Flow_MeanDedxKminusTPC", "Flow_MeanDedxKminusTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
+ fHistMeanTPCKminus->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTPCKminus->SetYTitle("mean dEdx (K-)");
+ // MeanDedx Deuteron
+ fHistMeanTPCDeuteron = new TH2F("Flow_MeanDedxDeuteronTPC", "Flow_MeanDedxDeuteronTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
+ fHistMeanTPCDeuteron->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTPCDeuteron->SetYTitle("mean dEdx (d+)");
+ // MeanDedx AntiDeuteron
+ fHistMeanTPCAntiDeuteron = new TH2F("Flow_MeanDedxAntiDeuteronTPC", "Flow_MeanDedxAntiDeuteronTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
+ fHistMeanTPCAntiDeuteron->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTPCAntiDeuteron->SetYTitle("mean dEdx (d-)");
+ // MeanDedxElectron
+ fHistMeanTPCElectron = new TH2F("Flow_MeanDedxElectronTPC", "Flow_MeanDedxElectronTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
+ fHistMeanTPCElectron->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTPCElectron->SetYTitle("mean dEdx (e-)");
+ // MeanDedx Positron
+ fHistMeanTPCPositron = new TH2F("Flow_MeanDedxPositronTPC", "Flow_MeanDedxPositronTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
+ fHistMeanTPCPositron->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTPCPositron->SetYTitle("mean dEdx (e+)");
+ // MeanDedx MuonPlus
+ fHistMeanTPCMuonPlus = new TH2F("Flow_MeanDedxMuonPlusTPC", "Flow_MeanDedxMuonPlusTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
+ fHistMeanTPCMuonPlus->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTPCMuonPlus->SetYTitle("mean dEdx (mu+)");
+ // MeanDedx MuonMinus
+ fHistMeanTPCMuonMinus = new TH2F("Flow_MeanDedxMuonMinusTPC", "Flow_MeanDedxMuonMinusTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
+ fHistMeanTPCMuonMinus->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTPCMuonMinus->SetYTitle("mean dEdx (mu-)");
+ // MeanDedx PiPlus - ITS
+ fHistMeanITSPiPlus = new TH2F("Flow_MeanDedxPiPlusITS", "Flow_MeanDedxPiPlusITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
+ fHistMeanITSPiPlus->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanITSPiPlus->SetYTitle("mean dEdx (pi+)");
+ // MeanDedx PiMinus
+ fHistMeanITSPiMinus = new TH2F("Flow_MeanDedxPiMinusITS", "Flow_MeanDedxPiMinusITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
+ fHistMeanITSPiMinus->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanITSPiMinus->SetYTitle("mean dEdx (pi-)");
+ // MeanDedx Proton
+ fHistMeanITSProton = new TH2F("Flow_MeanDedxProtonITS", "Flow_MeanDedxProtonITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
+ fHistMeanITSProton->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanITSProton->SetYTitle("mean dEdx (pr+)");
+ // MeanDedx Pbar
+ fHistMeanITSPbar = new TH2F("Flow_MeanDedxPbarITS", "Flow_MeanDedxPbarITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
+ fHistMeanITSPbar->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanITSPbar->SetYTitle("mean dEdx (pr-)");
+ // MeanDedx Kplus
+ fHistMeanITSKplus = new TH2F("Flow_MeanDedxKplusITS", "Flow_MeanDedxKplusITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
+ fHistMeanITSKplus->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanITSKplus->SetYTitle("mean dEdx (K+)");
+ // MeanDedx Kminus
+ fHistMeanITSKminus = new TH2F("Flow_MeanDedxKminusITS", "Flow_MeanDedxKminusITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
+ fHistMeanITSKminus->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanITSKminus->SetYTitle("mean dEdx (K-)");
+ // MeanDedx Deuteron
+ fHistMeanITSDeuteron = new TH2F("Flow_MeanDedxDeuteronITS", "Flow_MeanDedxDeuteronITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
+ fHistMeanITSDeuteron->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanITSDeuteron->SetYTitle("mean dEdx (d+)");
+ // MeanDedx AntiDeuteron
+ fHistMeanITSAntiDeuteron = new TH2F("Flow_MeanDedxAntiDeuteronITS", "Flow_MeanDedxAntiDeuteronITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
+ fHistMeanITSAntiDeuteron->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanITSAntiDeuteron->SetYTitle("mean dEdx (d-)");
+ // MeanDedx Electron
+ fHistMeanITSElectron = new TH2F("Flow_MeanDedxElectronITS", "Flow_MeanDedxElectronITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
+ fHistMeanITSElectron->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanITSElectron->SetYTitle("mean dEdx (e-)");
+ // MeanDedx Positron
+ fHistMeanITSPositron = new TH2F("Flow_MeanDedxPositronITS", "Flow_MeanDedxPositronITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
+ fHistMeanITSPositron->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanITSPositron->SetYTitle("mean dEdx (e+)");
+ // MeanDedx MuonPlus
+ fHistMeanITSMuonPlus = new TH2F("Flow_MeanDedxMuonPlusITS", "Flow_MeanDedxMuonPlusITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
+ fHistMeanITSMuonPlus->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanITSMuonPlus->SetYTitle("mean dEdx (mu+)");
+ // MeanDedx MuonMinus
+ fHistMeanITSMuonMinus = new TH2F("Flow_MeanDedxMuonMinusITS", "Flow_MeanDedxMuonMinusITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
+ fHistMeanITSMuonMinus->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanITSMuonMinus->SetYTitle("mean dEdx (mu-)");
+ // MeanTrd PiPlus - TRD
+ fHistMeanTRDPiPlus = new TH2F("Flow_MeanTrdPiPlusTRD", "Flow_MeanTrdPiPlusTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
+ fHistMeanTRDPiPlus->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTRDPiPlus->SetYTitle("mean t.r.[] (pi+)");
+ // MeanTrd PiMinus
+ fHistMeanTRDPiMinus = new TH2F("Flow_MeanTrdPiMinusTRD", "Flow_MeanTrdPiMinusTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
+ fHistMeanTRDPiMinus->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTRDPiMinus->SetYTitle("mean t.r.[] (pi-)");
+ // MeanTrd Proton
+ fHistMeanTRDProton = new TH2F("Flow_MeanTrdProtonTRD", "Flow_MeanTrdProtonTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
+ fHistMeanTRDProton->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTRDProton->SetYTitle("mean t.r.[] (pr+)");
+ // MeanTrd Pbar
+ fHistMeanTRDPbar = new TH2F("Flow_MeanTrdPbarTRD", "Flow_MeanTrdPbarTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
+ fHistMeanTRDPbar->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTRDPbar->SetYTitle("mean t.r.[] (pr-)");
+ // MeanTrd Kplus
+ fHistMeanTRDKplus = new TH2F("Flow_MeanTrdKplusTRD", "Flow_MeanTrdKplusTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
+ fHistMeanTRDKplus->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTRDKplus->SetYTitle("mean t.r.[] (K+)");
+ // MeanTrd Kminus
+ fHistMeanTRDKminus = new TH2F("Flow_MeanTrdKminusTRD", "Flow_MeanTrdKminusTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
+ fHistMeanTRDKminus->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTRDKminus->SetYTitle("mean t.r.[] (K-)");
+ // MeanTrd Deuteron
+ fHistMeanTRDDeuteron = new TH2F("Flow_MeanTrdDeuteronTRD", "Flow_MeanTrdDeuteronTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
+ fHistMeanTRDDeuteron->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTRDDeuteron->SetYTitle("mean t.r.[] (d+)");
+ // MeanTrd AntiDeuteron
+ fHistMeanTRDAntiDeuteron = new TH2F("Flow_MeanTrdAntiDeuteronTRD", "Flow_MeanTrdAntiDeuteronTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
+ fHistMeanTRDAntiDeuteron->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTRDAntiDeuteron->SetYTitle("mean t.r.[] (d-)");
+ // MeanTrd Electron
+ fHistMeanTRDElectron = new TH2F("Flow_MeanTrdElectronTRD", "Flow_MeanTrdElectronTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
+ fHistMeanTRDElectron->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTRDElectron->SetYTitle("mean t.r.[] (e-)");
+ // MeanTrd Positron
+ fHistMeanTRDPositron = new TH2F("Flow_MeanTrdPositronTRD", "Flow_MeanTrdPositronTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
+ fHistMeanTRDPositron->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTRDPositron->SetYTitle("mean t.r.[] (e+)");
+ // MeanTrd MuonPlus
+ fHistMeanTRDMuonPlus = new TH2F("Flow_MeanTrdMuonPlusTRD", "Flow_MeanTrdMuonPlusTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
+ fHistMeanTRDMuonPlus->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTRDMuonPlus->SetYTitle("mean t.r.[] (mu+)");
+ // MeanTrd MuonMinus
+ fHistMeanTRDMuonMinus = new TH2F("Flow_MeanTrdMuonMinusTRD", "Flow_MeanTrdMuonMinusTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
+ fHistMeanTRDMuonMinus->SetXTitle("Log10(p) (GeV/c)");
+ fHistMeanTRDMuonMinus->SetYTitle("mean t.r.[] (mu-)");
+ // T.O.F. PiPlus - TOF
+ fHistMeanTOFPiPlus = new TH2F("Flow_MeanTofPiPlusTOF", "Flow_MeanTofPiPlusTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
+ fHistMeanTOFPiPlus->SetXTitle("invariant mass (GeV)");
+ fHistMeanTOFPiPlus->SetYTitle("mean t.o.f.[psec] (pi+)");
+ // MeanTof PiMinus
+ fHistMeanTOFPiMinus = new TH2F("Flow_MeanTofPiMinusTOF", "Flow_MeanTofPiMinusTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
+ fHistMeanTOFPiMinus->SetXTitle("invariant mass (GeV)");
+ fHistMeanTOFPiMinus->SetYTitle("mean t.o.f.[psec] (pi-)");
+ // MeanTof Proton
+ fHistMeanTOFProton = new TH2F("Flow_MeanTofProtonTOF", "Flow_MeanTofProtonTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
+ fHistMeanTOFProton->SetXTitle("invariant mass (GeV)");
+ fHistMeanTOFProton->SetYTitle("mean t.o.f.[psec] (pr+)");
+ // Mean TofPbar
+ fHistMeanTOFPbar = new TH2F("Flow_MeanTofPbarTOF", "Flow_MeanTofPbarTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
+ fHistMeanTOFPbar->SetXTitle("invariant mass (GeV)");
+ fHistMeanTOFPbar->SetYTitle("mean t.o.f.[psec] (pr-)");
+ // mean t.o.f.[psec]Kplus
+ fHistMeanTOFKplus = new TH2F("Flow_MeanTofKplusTOF", "Flow_MeanTofKplusTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
+ fHistMeanTOFKplus->SetXTitle("invariant mass (GeV)");
+ fHistMeanTOFKplus->SetYTitle("mean t.o.f.[psec] (K+)");
+ // mean t.o.f.[psec]Kminus
+ fHistMeanTOFKminus = new TH2F("Flow_MeanTofKminusTOF", "Flow_MeanTofKminusTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
+ fHistMeanTOFKminus->SetXTitle("invariant mass (GeV)");
+ fHistMeanTOFKminus->SetYTitle("mean t.o.f.[psec] (K-)");
+ // MeanTof Deuteron
+ fHistMeanTOFDeuteron = new TH2F("Flow_MeanTofDeuteronTOF", "Flow_MeanTofDeuteronTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
+ fHistMeanTOFDeuteron->SetXTitle("invariant mass (GeV)");
+ fHistMeanTOFDeuteron->SetYTitle("mean t.o.f.[psec] (d+)");
+ // MeanTof AntiDeuteron
+ fHistMeanTOFAntiDeuteron = new TH2F("Flow_MeanTofAntiDeuteronTOF", "Flow_MeanTofAntiDeuteronTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
+ fHistMeanTOFAntiDeuteron->SetXTitle("invariant mass (GeV)");
+ fHistMeanTOFAntiDeuteron->SetYTitle("mean t.o.f.[psec] (d-)");
+ // MeanTof Electron
+ fHistMeanTOFElectron = new TH2F("Flow_MeanTofElectronTOF", "Flow_MeanTofElectronTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
+ fHistMeanTOFElectron->SetXTitle("invariant mass (GeV)");
+ fHistMeanTOFElectron->SetYTitle("mean t.o.f.[psec] (e-)");
+ // MeanTof Positron
+ fHistMeanTOFPositron = new TH2F("Flow_MeanTofPositronTOF", "Flow_MeanTofPositronTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
+ fHistMeanTOFPositron->SetXTitle("invariant mass (GeV)");
+ fHistMeanTOFPositron->SetYTitle("mean t.o.f.[psec] (e+)");
+ // MeanTof MuonPlus
+ fHistMeanTOFMuonPlus = new TH2F("Flow_MeanTofMuonPlusTOF", "Flow_MeanTofMuonPlusTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
+ fHistMeanTOFMuonPlus->SetXTitle("invariant mass (GeV)");
+ fHistMeanTOFMuonPlus->SetYTitle("mean t.o.f.[psec] (mu+)");
+ // MeanTof MuonMinus
+ fHistMeanTOFMuonMinus = new TH2F("Flow_MeanTofMuonMinusTOF", "Flow_MeanTofMuonMinusTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
+ fHistMeanTOFMuonMinus->SetXTitle("invariant mass (GeV)");
+ fHistMeanTOFMuonMinus->SetYTitle("mean t.o.f.[psec] (mu-)");
+ // ... }
+
+ TString* histTitle;
+ for (int n = 0; n < Flow::nSubs; n++) // for sub-events
+ {
+  for (int k = 0; k < Flow::nSels; k++) 
+  {
+   for (int j = 0; j < Flow::nHars; j++) 
+   {
+    float order = (float)(j + 1);
+    int i = Flow::nSubs * k + n ;
+
+    // event planes
+    histTitle = new TString("Flow_Psi_Sub");
+    *histTitle += n+1;
+    histTitle->Append("_Sel");
+    *histTitle += k+1;
+    histTitle->Append("_Har");
+    *histTitle += j+1;
+    fHistSub[i].fHistSubHar[j].fHistPsiSubs = new TH1F(histTitle->Data(),histTitle->Data(), nPsiBins, psiMin, (psiMax / order));
+    fHistSub[i].fHistSubHar[j].fHistPsiSubs->SetXTitle("Event Plane Angle (rad)");
+    fHistSub[i].fHistSubHar[j].fHistPsiSubs->SetYTitle("Counts");
+    delete histTitle;
+   }
+  }
+ }
+ if(fV0loop)            // All V0s (if there, if flag on)
+ {
+ // Mass
+  fHistV0Mass = new TH1F("FlowV0_InvMass", "FlowV0_InvMass", nMassBins, massMin, massMax);
+  fHistV0Mass->SetXTitle("Invariant Mass (GeV)");
+  fHistV0Mass->SetYTitle("Counts");
+ // Distance of closest approach
+  fHistV0Dca = new TH1F("FlowV0_Dca", "FlowV0_Dca", nDcaBins, dcaMin, glDcaMax);
+  fHistV0Dca->SetXTitle("dca between tracks (cm)");
+  fHistV0Dca->SetYTitle("Counts");
+ // lenght
+  fHistV0Lenght = new TH1F("FlowV0_Lenght", "FlowV0_Lenght", nLgBins, lgMinV0, lgMaxV0);
+  fHistV0Lenght->SetXTitle("Distance of V0s (cm)");
+  fHistV0Lenght->SetYTitle("Counts");
+ // Sigma for all particles
+  fHistV0Sigma = new TH1F("FlowV0_Sigma", "FlowV0_Sigma", nLgBins, lgMinV0, lgMaxV0 );
+  fHistV0Sigma->SetXTitle("Sigma");
+  fHistV0Sigma->SetYTitle("Counts");
+ // Chi2 
+  fHistV0Chi2 = new TH1F("FlowV0_Chi2", "FlowV0_Chi2", nChi2Bins, chi2Min, chi2MaxC);
+  fHistV0Chi2->SetXTitle("Chi square at Main Vertex");
+  fHistV0Chi2->SetYTitle("Counts");
+ // EtaPtPhi
+  fHistV0EtaPtPhi3D = new TH3F("FlowV0_EtaPtPhi3D", "FlowV0_EtaPtPhi3D", fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax, nPhi3DBins, fPhiMin, fPhiMax);
+  fHistV0EtaPtPhi3D->SetXTitle("Eta");
+  fHistV0EtaPtPhi3D->SetYTitle("Pt (GeV/c)");
+  fHistV0EtaPtPhi3D->SetZTitle("Phi (rad)");
+ // Yield for all v0s
+  fHistV0YieldAll2D = new TH2D("FlowV0_YieldAll2D", "FlowV0_YieldAll2D", fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax);
+  fHistV0YieldAll2D->Sumw2();
+  fHistV0YieldAll2D->SetXTitle("Pseudorapidty");
+  fHistV0YieldAll2D->SetYTitle("Pt (GeV/c)");
+ // Mass slices on pT
+  fHistV0MassPtSlices = new TH2D("FlowV0_MassPtSlices", "FlowV0_MassPtSlices", nMassBins, massMin, massMax, fPtBins, fPtMin, fPtMax);
+  fHistV0MassPtSlices->Sumw2();
+  fHistV0MassPtSlices->SetXTitle("Invariant Mass (GeV)");
+  fHistV0MassPtSlices->SetYTitle("Pt (GeV/c)");
+ // Yield v0s (total P and Rapidity)
+  fHistV0PYall2D = new TH2D("FlowV0_PYall2D", "FlowV0_PYall2D", fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax);
+  fHistV0PYall2D->Sumw2();
+  fHistV0PYall2D->SetXTitle("Rapidty");
+  fHistV0PYall2D->SetYTitle("P (GeV/c)");
+
+ // Selected V0s ...  
+ // Yield 
+  fHistV0YieldPart2D = new TH2D("FlowV0_Yield2Dsel", "FlowV0_Yield2Dsel", fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax);
+  fHistV0YieldPart2D->Sumw2();
+  fHistV0YieldPart2D->SetXTitle("Pseudorapidty");
+  fHistV0YieldPart2D->SetYTitle("Pt (GeV/c)");
+ // Mass Window
+  fHistV0MassWin = new TH1F("FlowV0_MassWinPart", "FlowV0_MassWinPart", nMassBins, massMin, massMax);
+  fHistV0MassWin->SetXTitle("Invariant Mass (GeV)");
+  fHistV0MassWin->SetYTitle("Counts");
+ // EtaPtPhi
+  fHistV0EtaPtPhi3DPart = new TH3F("FlowV0_EtaPtPhi3Dpart", "FlowV0_EtaPtPhi3Dpart", fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax, nPhi3DBins, fPhiMin, fPhiMax);
+  fHistV0EtaPtPhi3DPart->SetXTitle("Eta");
+  fHistV0EtaPtPhi3DPart->SetYTitle("Pt (GeV/c)");
+  fHistV0EtaPtPhi3DPart->SetZTitle("Phi (rad)");
+ // Distance of closest approach
+  fHistV0DcaPart = new TH1F("FlowV0_DcaPart", "FlowV0_DcaPart", nDcaBins, dcaMin, dcaMax);
+  fHistV0DcaPart->Sumw2();
+  fHistV0DcaPart->SetXTitle("dca between tracks (cm)");
+  fHistV0DcaPart->SetYTitle("Counts");
+ // lenght
+  fHistV0LenghtPart = new TH1F("FlowV0_LenghtPart", "FlowV0_LenghtPart", nLgBins, lgMinV0, lgMaxV0);
+  fHistV0LenghtPart->SetXTitle("Distance of V0s (cm)");
+  fHistV0LenghtPart->SetYTitle("Counts");
+ // SideBand Mass (sidebands)
+  fHistV0sbMassSide = new TH1F("FlowV0sb_MassWinSideBands", "FlowV0sb_MassWinSideBands", nMassBins, massMin, massMax);
+  fHistV0sbMassSide->SetXTitle("Invariant Mass (GeV)");
+  fHistV0sbMassSide->SetYTitle("Counts");
+ // EtaPtPhi (sidebands)
+  fHistV0sbEtaPtPhi3DPart = new TH3F("FlowV0sb_EtaPtPhi3D", "FlowV0sb_EtaPtPhi3D", fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax, nPhi3DBins, fPhiMin, fPhiMax);
+  fHistV0sbEtaPtPhi3DPart->SetXTitle("Eta");
+  fHistV0sbEtaPtPhi3DPart->SetYTitle("Pt (GeV/c)");
+  fHistV0sbEtaPtPhi3DPart->SetZTitle("Phi (rad)");
+ // Distance of closest approach (sidebands)
+  fHistV0sbDcaPart = new TH1F("FlowV0sb_Dca", "FlowV0sb_Dca", nDcaBins, dcaMin, dcaMax);
+  fHistV0sbDcaPart->Sumw2();
+  fHistV0sbDcaPart->SetXTitle("dca between tracks (cm)");
+  fHistV0sbDcaPart->SetYTitle("Counts");
+ // lenght (sidebands)
+  fHistV0sbLenghtPart = new TH1F("FlowV0sb_Lenght", "FlowV0sb_Lenght", nLgBins, lgMinV0, lgMaxV0);
+  fHistV0sbLenghtPart->SetXTitle("Distance of V0s (cm)");
+  fHistV0sbLenghtPart->SetYTitle("Counts");
+
+ // Mean Eta in each bin
+  fHistV0BinEta = new TProfile("FlowV0_Bin_Eta", "FlowV0_Bin_Eta", fEtaBins, fEtaMin, fEtaMax, fEtaMin, fEtaMax, "");
+  fHistV0BinEta->SetXTitle((char*)fLabel.Data());
+  fHistV0BinEta->SetYTitle("<Eta>");
+ // Mean Pt in each bin
+  fHistV0BinPt = new TProfile("FlowV0_Bin_Pt", "FlowV0_Bin_Pt", fPtBinsPart, fPtMin, fPtMaxPart, fPtMin, fPtMaxPart, "");
+  fHistV0BinPt->SetXTitle("Pt (GeV/c)");
+  fHistV0BinPt->SetYTitle("<Pt> (GeV/c)");
+ // Mean Eta in each bin (sidebands)
+  fHistV0sbBinEta = new TProfile("FlowV0sb_Bin_Eta", "FlowV0sb_Bin_Eta", fEtaBins, fEtaMin, fEtaMax, fEtaMin, fEtaMax, "");
+  fHistV0sbBinEta->SetXTitle((char*)fLabel.Data());
+  fHistV0sbBinEta->SetYTitle("<Eta>");
+ // Mean Pt in each bin (sidebands)
+  fHistV0sbBinPt = new TProfile("FlowV0sb_Bin_Pt", "FlowV0sb_Bin_Pt", fPtBinsPart, fPtMin, fPtMaxPart, fPtMin, fPtMaxPart, "");
+  fHistV0sbBinPt->SetXTitle("Pt (GeV/c)");
+  fHistV0sbBinPt->SetYTitle("<Pt> (GeV/c)");
+ }
+
+ for (int k = 0; k < Flow::nSels; k++) // for each selection
+ {
+  // cos(n*delta_Psi)
+  histTitle = new TString("Flow_Cos_Sel");
+  *histTitle += k+1;
+  fHistFull[k].fHistCos = new TProfile(histTitle->Data(), histTitle->Data(), Flow::nHars, 0.5, (float)(Flow::nHars) + 0.5, -1., 1., "");
+  fHistFull[k].fHistCos->SetXTitle("Harmonic");
+  fHistFull[k].fHistCos->SetYTitle("<cos(n*delta_Psi)>");
+  delete histTitle;
+   
+  // resolution
+  histTitle = new TString("Flow_Res_Sel");
+  *histTitle += k+1;
+  fHistFull[k].fHistRes = new TH1F(histTitle->Data(), histTitle->Data(), Flow::nHars, 0.5, (float)(Flow::nHars) + 0.5);
+  fHistFull[k].fHistRes->SetXTitle("Harmonic");
+  fHistFull[k].fHistRes->SetYTitle("Resolution");
+  delete histTitle;
+
+  // vObs
+  histTitle = new TString("Flow_vObs_Sel");
+  *histTitle += k+1;
+  fHistFull[k].fHistvObs = new TProfile(histTitle->Data(), histTitle->Data(), Flow::nHars, 0.5, (float)(Flow::nHars) + 0.5, -100., 100., "");
+  fHistFull[k].fHistvObs->SetXTitle("Harmonic");
+  fHistFull[k].fHistvObs->SetYTitle("vObs (%)");
+  delete histTitle;
+
+  // vObs V0
+  histTitle = new TString("FlowV0_vObs_Sel");
+  *histTitle += k+1;
+  fHistFull[k].fHistV0vObs = new TProfile(histTitle->Data(), histTitle->Data(), Flow::nHars, 0.5, (float)(Flow::nHars) + 0.5, -100., 100., "");
+  fHistFull[k].fHistV0vObs->SetXTitle("Harmonic");
+  fHistFull[k].fHistV0vObs->SetYTitle("vObs (%)");
+  delete histTitle;
+   
+  // vObs V0 sideband SX
+  histTitle = new TString("FlowV0sb_vObs_sx_Sel");
+  *histTitle += k+1;
+  fHistFull[k].fHistV0sbvObsSx = new TProfile(histTitle->Data(), histTitle->Data(), Flow::nHars, 0.5, (float)(Flow::nHars) + 0.5, -100., 100., "");
+  fHistFull[k].fHistV0sbvObsSx->SetXTitle("Harmonic");
+  fHistFull[k].fHistV0sbvObsSx->SetYTitle("vObs (%)");
+  delete histTitle;
+   
+  // vObs V0 sideband DX
+  histTitle = new TString("FlowV0sb_vObs_dx_Sel");
+  *histTitle += k+1;
+  fHistFull[k].fHistV0sbvObsDx = new TProfile(histTitle->Data(), histTitle->Data(), Flow::nHars, 0.5, (float)(Flow::nHars) + 0.5, -100., 100., "");
+  fHistFull[k].fHistV0sbvObsDx->SetXTitle("Harmonic");
+  fHistFull[k].fHistV0sbvObsDx->SetYTitle("vObs (%)");
+  delete histTitle;
+   
+  // PID for tracks used in R.P.
+  histTitle = new TString("Flow_BayPidMult_Sel");
+  *histTitle += k+1;
+  fHistFull[k].fHistBayPidMult = new TH1F(histTitle->Data(), histTitle->Data(),Flow::nPid,-0.5,((float)Flow::nPid-0.5));
+  fHistFull[k].fHistBayPidMult->Sumw2() ;
+  fHistFull[k].fHistBayPidMult->SetXTitle("e+/-  ,  mu+/-  ,  pi+/-  ,  K+/-  ,  p+/-  ,  d+/- ");
+  fHistFull[k].fHistBayPidMult->SetYTitle("Counts");
+  delete histTitle;
+
+  for (int j = 0; j < Flow::nHars; j++)   // for each harmonic
+  {
+   float order  = (float)(j+1);
+
+   // multiplicity
+   histTitle = new TString("Flow_Mul_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistMult = new TH1F(histTitle->Data(),histTitle->Data(), nMultBins, multMin, multMax);
+   fHistFull[k].fHistFullHar[j].fHistMult->SetXTitle("Multiplicity");
+   fHistFull[k].fHistFullHar[j].fHistMult->SetYTitle("Counts");
+   delete histTitle;
+
+   // event plane
+   histTitle = new TString("Flow_Psi_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPsi = new TH1F(histTitle->Data(), histTitle->Data(), nPsiBins, psiMin, psiMax / order);
+   fHistFull[k].fHistFullHar[j].fHistPsi->SetXTitle("Event Plane Angle (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPsi->SetYTitle("Counts");
+   delete histTitle;
+     
+   // event plane difference of two selections
+   histTitle = new TString("Flow_Psi_Diff_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   if (k == 0 ) 
+   {
+    Int_t my_order = 1;
+    if (j == 1) { my_order = 2 ; }
+    fHistFull[k].fHistFullHar[j].fHistPsiDiff = new TH1F(histTitle->Data(), histTitle->Data(), nPsiBins, -psiMax/my_order/2., psiMax/my_order/2.);
+   } 
+   else 
+   {
+    fHistFull[k].fHistFullHar[j].fHistPsiDiff = new TH1F(histTitle->Data(), histTitle->Data(), nPsiBins, -psiMax/2., psiMax/2.);
+   }
+   if (k == 0) 
+   {
+    if (j == 0) 
+    {
+     fHistFull[k].fHistFullHar[j].fHistPsiDiff->SetXTitle("#Psi_{1,Sel1} - #Psi_{1,Sel2}(rad)");
+    } 
+    else if (j == 1) 
+    {
+     fHistFull[k].fHistFullHar[j].fHistPsiDiff->SetXTitle("#Psi_{2,Sel1} - #Psi_{2,Sel2}(rad)");
+    }
+   } 
+   else if (k == 1) 
+   {
+    if (j == 0) 
+    {  
+     fHistFull[k].fHistFullHar[j].fHistPsiDiff->SetXTitle("#Psi_{1,Sel1} - #Psi_{2,Sel2}(rad)");
+    } 
+    else if (j == 1) 
+    {
+     fHistFull[k].fHistFullHar[j].fHistPsiDiff->SetXTitle("#Psi_{1,Sel1} - #Psi_{2,Sel1}(rad)");
+    }
+   }
+   fHistFull[k].fHistFullHar[j].fHistPsiDiff->SetYTitle("Counts");
+   delete histTitle;
+
+   // correlation of sub-event planes
+   histTitle = new TString("Flow_Psi_Sub_Corr_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPsiSubCorr = new TH1F(histTitle->Data(), histTitle->Data(), nPsiBins, psiMin, psiMax / order);
+   fHistFull[k].fHistFullHar[j].fHistPsiSubCorr->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistPsiSubCorr->SetXTitle("Sub-Event Correlation (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPsiSubCorr->SetYTitle("Counts");
+   delete histTitle;
+     
+   // correlation of sub-event planes of different order
+   histTitle = new TString("Flow_Psi_Sub_Corr_Diff_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPsiSubCorrDiff = new TH1F(histTitle->Data(), histTitle->Data(), nPsiBins, psiMin, psiMax / (order+1.));
+   fHistFull[k].fHistFullHar[j].fHistPsiSubCorrDiff->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistPsiSubCorrDiff->SetXTitle("Sub-Event Correlation (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPsiSubCorrDiff->SetYTitle("Counts");
+   delete histTitle;
+     
+   // q
+   histTitle = new TString("Flow_NormQ_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistQnorm = new TH1F(histTitle->Data(), histTitle->Data(), nQbins, qMin, qMax);
+   fHistFull[k].fHistFullHar[j].fHistQnorm->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistQnorm->SetXTitle("q = |Q|/sqrt(Mult)");
+   fHistFull[k].fHistFullHar[j].fHistQnorm->SetYTitle("Counts");
+   delete histTitle;
+
+    // particle-plane azimuthal correlation
+   histTitle = new TString("Flow_Phi_Corr_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiCorr = new TH1F(histTitle->Data(), histTitle->Data(), fPhiBins, fPhiMin, fPhiMax / order);
+   fHistFull[k].fHistFullHar[j].fHistPhiCorr->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistPhiCorr->SetXTitle("Particle-Plane Correlation (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiCorr->SetYTitle("Counts");
+   delete histTitle;
+     
+   // neutral particle-plane azimuthal correlation
+   histTitle = new TString("FlowV0_Phi_Corr_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistV0PhiCorr = new TH1F(histTitle->Data(), histTitle->Data(), fPhiBins, fPhiMin, fPhiMax / order);
+   fHistFull[k].fHistFullHar[j].fHistV0PhiCorr->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistV0PhiCorr->SetXTitle("V0-Plane Correlation (rad)");
+   fHistFull[k].fHistFullHar[j].fHistV0PhiCorr->SetYTitle("Counts");
+   delete histTitle;
+
+   // neutral sidebands-plane azimuthal correlation
+   histTitle = new TString("FlowV0sb_Phi_Corr_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistV0sbPhiCorr = new TH1F(histTitle->Data(), histTitle->Data(), fPhiBins, fPhiMin, fPhiMax / order);
+   fHistFull[k].fHistFullHar[j].fHistV0sbPhiCorr->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistV0sbPhiCorr->SetXTitle("V0sideBands-Plane Correlation (rad)");
+   fHistFull[k].fHistFullHar[j].fHistV0sbPhiCorr->SetYTitle("Counts");
+   delete histTitle;
+
+   // Yield(pt)
+   histTitle = new TString("Flow_YieldPt_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistYieldPt = new TH1F(histTitle->Data(), histTitle->Data(), fPtBins, fPtMin, fPtMax);
+   fHistFull[k].fHistFullHar[j].fHistYieldPt->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistYieldPt->SetXTitle("Pt (GeV/c)");
+   fHistFull[k].fHistFullHar[j].fHistYieldPt->SetYTitle("Yield");
+   delete histTitle;
+     
+   // EtaPtPhi 
+   histTitle = new TString("Flow_EtaPtPhi3D_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistEtaPtPhi3D = new TH3F(histTitle->Data(), histTitle->Data(), fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax, nPhi3DBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistEtaPtPhi3D->SetXTitle("Eta");
+   fHistFull[k].fHistFullHar[j].fHistEtaPtPhi3D->SetYTitle("Pt (GeV/c)");
+   fHistFull[k].fHistFullHar[j].fHistEtaPtPhi3D->SetZTitle("Phi (rad)");
+   delete histTitle;
+
+   // Yield(eta,pt)
+   histTitle = new TString("Flow_Yield2D_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistYield2D = new TH2D(histTitle->Data(), histTitle->Data(), fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax);
+   fHistFull[k].fHistFullHar[j].fHistYield2D->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistYield2D->SetXTitle("Pseudorapidty");
+   fHistFull[k].fHistFullHar[j].fHistYield2D->SetYTitle("Pt (GeV/c)");
+   delete histTitle;
+
+   // Dca - 3D
+   histTitle = new TString("Flow_3dDca_Sel") ;
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistDcaGlob = new TH1F(histTitle->Data(), histTitle->Data(), nDcaBins, dcaMin, glDcaMax);
+   fHistFull[k].fHistFullHar[j].fHistDcaGlob->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistDcaGlob->SetXTitle("|3d Global Track's dca to Vertex (cm)|");
+   delete histTitle;
+
+   // Yield(pt) - excluded from R.P.
+   histTitle = new TString("Flow_YieldPt_outSel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistYieldPtout = new TH1F(histTitle->Data(), histTitle->Data(), fPtBins, fPtMin, fPtMax);
+   fHistFull[k].fHistFullHar[j].fHistYieldPtout->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistYieldPtout->SetXTitle("Pt (GeV/c)");
+   fHistFull[k].fHistFullHar[j].fHistYieldPtout->SetYTitle("Yield");
+   delete histTitle;
+     
+   // EtaPtPhi - excluded from R.P. 
+   histTitle = new TString("Flow_EtaPtPhi3D_outSel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistEtaPtPhi3Dout = new TH3F(histTitle->Data(), histTitle->Data(), fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax, nPhi3DBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistEtaPtPhi3Dout->SetXTitle("Eta");
+   fHistFull[k].fHistFullHar[j].fHistEtaPtPhi3Dout->SetYTitle("Pt (GeV/c)");
+   fHistFull[k].fHistFullHar[j].fHistEtaPtPhi3Dout->SetZTitle("Phi (rad)");
+   delete histTitle;
+
+   // Yield(eta,pt) - excluded from R.P.
+   histTitle = new TString("Flow_Yield2D_outSel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistYield2Dout = new TH2D(histTitle->Data(), histTitle->Data(), fEtaBins, fEtaMin, fEtaMax, fPtBins, fPtMin, fPtMax);
+   fHistFull[k].fHistFullHar[j].fHistYield2Dout->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistYield2Dout->SetXTitle("Pseudorapidty");
+   fHistFull[k].fHistFullHar[j].fHistYield2Dout->SetYTitle("Pt (GeV/c)");
+   delete histTitle;
+
+   // Dca - 3D - excluded from R.P.
+   histTitle = new TString("Flow_3dDca_outSel") ;
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistDcaGlobout = new TH1F(histTitle->Data(), histTitle->Data(), nDcaBins, dcaMin, glDcaMax);
+   fHistFull[k].fHistFullHar[j].fHistDcaGlobout->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistDcaGlobout->SetXTitle("|3d Global Track's dca to Vertex (cm)|");
+   delete histTitle;
+
+   // Flow observed - v_obs,Pt,Eta
+   histTitle = new TString("Flow_vObs2D_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistvObs2D = new TProfile2D(histTitle->Data(), histTitle->Data(), fEtaBins, fEtaMin, fEtaMax, fPtBinsPart, fPtMin, fPtMaxPart, -100., 100., "");
+   fHistFull[k].fHistFullHar[j].fHistvObs2D->SetXTitle((char*)fLabel.Data());
+   fHistFull[k].fHistFullHar[j].fHistvObs2D->SetYTitle("Pt (GeV/c)");
+   delete histTitle;
+
+   // v_obs,Eta
+   histTitle = new TString("Flow_vObsEta_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistvObsEta = new TProfile(histTitle->Data(), histTitle->Data(), fEtaBins, fEtaMin, fEtaMax, -100., 100., "");
+   fHistFull[k].fHistFullHar[j].fHistvObsEta->SetXTitle((char*)fLabel.Data());
+   fHistFull[k].fHistFullHar[j].fHistvObsEta->SetYTitle("v (%)");
+   delete histTitle;
+
+   // v_obs,Pt
+   histTitle = new TString("Flow_vObsPt_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistvObsPt = new TProfile(histTitle->Data(), histTitle->Data(), fPtBinsPart, fPtMin, fPtMaxPart, -100., 100., "");
+   fHistFull[k].fHistFullHar[j].fHistvObsPt->SetXTitle("Pt (GeV/c)");
+   fHistFull[k].fHistFullHar[j].fHistvObsPt->SetYTitle("v (%)");
+   delete histTitle;
+
+   // neutral Flow observed - Pt,Eta
+   histTitle = new TString("FlowV0_vObs2D_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistV0vObs2D = new TProfile2D(histTitle->Data(), histTitle->Data(), fEtaBins, fEtaMin, fEtaMax, fPtBinsPart, fPtMin, fPtMaxPart, -100., 100., "");
+   fHistFull[k].fHistFullHar[j].fHistV0vObs2D->SetXTitle((char*)fLabel.Data());
+   fHistFull[k].fHistFullHar[j].fHistV0vObs2D->SetYTitle("Pt (GeV/c)");
+   delete histTitle;
+
+   // neutral Flow observed - Eta
+   histTitle = new TString("FlowV0_vObsEta_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistV0vObsEta = new TProfile(histTitle->Data(), histTitle->Data(), fEtaBins, fEtaMin, fEtaMax, -100., 100., "");
+   fHistFull[k].fHistFullHar[j].fHistV0vObsEta->SetXTitle((char*)fLabel.Data());
+   fHistFull[k].fHistFullHar[j].fHistV0vObsEta->SetYTitle("v (%)");
+   delete histTitle;
+
+   // neutral Flow observed - Pt
+   histTitle = new TString("FlowV0_vObsPt_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistV0vObsPt = new TProfile(histTitle->Data(), histTitle->Data(), fPtBinsPart, fPtMin, fPtMaxPart, -100., 100., "");
+   fHistFull[k].fHistFullHar[j].fHistV0vObsPt->SetXTitle("Pt (GeV/c)");
+   fHistFull[k].fHistFullHar[j].fHistV0vObsPt->SetYTitle("v (%)");
+   delete histTitle;
+
+   // neutral sidebands Flow observed - Pt,Eta
+   histTitle = new TString("FlowV0sb_vObs2D_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObs2D = new TProfile2D(histTitle->Data(), histTitle->Data(), fEtaBins, fEtaMin, fEtaMax, fPtBinsPart, fPtMin, fPtMaxPart, -100., 100., "");
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObs2D->SetXTitle((char*)fLabel.Data());
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObs2D->SetYTitle("Pt (GeV/c)");
+   delete histTitle;
+
+   // neutral sidebands Flow observed - Eta
+   histTitle = new TString("FlowV0sb_vObsEta_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObsEta = new TProfile(histTitle->Data(), histTitle->Data(), fEtaBins, fEtaMin, fEtaMax, -100., 100., "");
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObsEta->SetXTitle((char*)fLabel.Data());
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObsEta->SetYTitle("v (%)");
+   delete histTitle;
+
+   // neutral sidebands Flow observed - Pt
+   histTitle = new TString("FlowV0sb_vObsPt_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObsPt = new TProfile(histTitle->Data(), histTitle->Data(), fPtBinsPart, fPtMin, fPtMaxPart, -100., 100., "");
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObsPt->SetXTitle("Pt (GeV/c)");
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObsPt->SetYTitle("v (%)");
+   delete histTitle;
+
+   // SX neutral sidebands Flow observed - Eta
+   histTitle = new TString("FlowV0sb_vObsEta_sx_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObsEtaSx = new TProfile(histTitle->Data(), histTitle->Data(), fEtaBins, fEtaMin, fEtaMax, -100., 100., "");
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObsEtaSx->SetXTitle((char*)fLabel.Data());
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObsEtaSx->SetYTitle("v (%)");
+   delete histTitle;
+
+   // SX neutral sidebands Flow observed - Pt
+   histTitle = new TString("FlowV0sb_vObsPt_sx_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObsPtSx = new TProfile(histTitle->Data(), histTitle->Data(), fPtBinsPart, fPtMin, fPtMaxPart, -100., 100., "");
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObsPtSx->SetXTitle("Pt (GeV/c)");
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObsPtSx->SetYTitle("v (%)");
+   delete histTitle;
+
+   // DX neutral sidebands Flow observed - Eta
+   histTitle = new TString("FlowV0sb_vObsEta_dx_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObsEtaDx = new TProfile(histTitle->Data(), histTitle->Data(), fEtaBins, fEtaMin, fEtaMax, -100., 100., "");
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObsEtaDx->SetXTitle((char*)fLabel.Data());
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObsEtaDx->SetYTitle("v (%)");
+   delete histTitle;
+
+   // DX neutral sidebands Flow observed - Pt
+   histTitle = new TString("FlowV0sb_vObsPt_dx_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObsPtDx = new TProfile(histTitle->Data(), histTitle->Data(), fPtBinsPart, fPtMin, fPtMaxPart, -100., 100., "");
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObsPtDx->SetXTitle("Pt (GeV/c)");
+   fHistFull[k].fHistFullHar[j].fHistV0sbvObsPtDx->SetYTitle("v (%)");
+   delete histTitle;
+
+   // Phi lab
+   // Tpc (plus)
+   histTitle = new TString("Flow_Phi_TPCplus_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiPlus = new TH1D(histTitle->Data(), histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiPlus->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiPlus->SetYTitle("Counts");
+   delete histTitle;
+
+   // Tpc (minus)
+   histTitle = new TString("Flow_Phi_TPCminus_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiMinus = new TH1D(histTitle->Data(), histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiMinus->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiMinus->SetYTitle("Counts");
+   delete histTitle;
+  
+   // Tpc (cross)
+   histTitle = new TString("Flow_Phi_TPCcross_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiAll = new TH1D(histTitle->Data(), histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiAll->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiAll->SetYTitle("Counts");
+   delete histTitle;
+  
+   // Tpc
+   histTitle = new TString("Flow_Phi_TPC_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhi = new TH1D(histTitle->Data(), histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhi->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhi->SetYTitle("Counts");
+   delete histTitle;
+  
+   // Phi lab flattened
+   // Tpc (Plus)
+   histTitle = new TString("Flow_Phi_Flat_TPCplus_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiFlatPlus = new TH1D(histTitle->Data(), histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiFlatPlus->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiFlatPlus->SetYTitle("Counts");
+   delete histTitle;
+
+   // Tpc (Minus)
+   histTitle = new TString("Flow_Phi_Flat_TPCminus_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiFlatMinus = new TH1D(histTitle->Data(), histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiFlatMinus->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiFlatMinus->SetYTitle("Counts");
+   delete histTitle;
+
+   // Tpc (cross)
+   histTitle = new TString("Flow_Phi_Flat_TPCcross_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiFlatAll = new TH1D(histTitle->Data(), histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiFlatAll->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiFlatAll->SetYTitle("Counts");
+   delete histTitle;
+
+   // Tpc
+   histTitle = new TString("Flow_Phi_Flat_TPC_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiFlat = new TH1D(histTitle->Data(), histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiFlat->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiFlat->SetYTitle("Counts");
+   delete histTitle;
+  }
+ }
+ cout << "    Init()  -  Histograms booked" << endl ; 
+
+ return kTRUE ;
+}
+//-----------------------------------------------------------------------
+
+//-----------------------------------------------------------------------
+Bool_t AliFlowAnalyser::Finish() 
+{
+ // Close the analysis and saves the histograms on the histFile .
+ cout << "* FlowAnalysis *  -  Finish()" << endl ; cout << endl ;
+
+ // Write all histograms
+ fHistFile->cd() ; 
+ fHistFile->Write() ; 
+ // Write Resolution corrected histograms
+ if(fVnResHistList)
+ { 
+  fVnResHistList->Write(); 
+  delete fVnResHistList ;
+ }
+ else { cout << "  E.P. resolution has not been calculated. No v_n histograms!" << endl ; } 
+
+ // Write PhiWgt histograms
+ if(fPhiWgtHistList)
+ { 
+  fPhiWgtHistList->Write();
+  delete fPhiWgtHistList ; 
+ }
+ fFlowSelect->Write(); 
+ // delete fFlowSelect ;
+
+ fHistFile->Close() ;
+
+ cout << "    Finish()  -  Histograms saved : " << fHistFileName.Data() << endl ; cout << endl ; 
+
+ return kTRUE ;
+}
+//-----------------------------------------------------------------------
+// ###
+//----------------------------------------------------------------------
+Float_t AliFlowAnalyser::GetRunBayesian(Int_t nPid, Int_t selN)  
+{
+ // Returns the normalized particle abundance of "e","mu","pi","k","p","d"
+ // in all the analysed events (in selection selN).
+ // Call at the end of the analysis.
+
+ if(selN>Flow::nSels) { selN = 0 ; }
+ Double_t totCount = (fHistFull[selN].fHistBayPidMult)->GetSumOfWeights() ;
+ if(totCount) { return (fHistFull[selN].fHistBayPidMult->GetBinContent(nPid+1) / totCount) ; }
+ else         { return 1. ; }
+}
+//-----------------------------------------------------------------------
+void AliFlowAnalyser::PrintRunBayesian(Int_t selN)  
+{
+ // Prints the normalized particle abundance of all the analysed events 
+ // (in selection selN).
+
+ if(selN>Flow::nSels) { selN = 0 ; } 
+ Char_t* names[Flow::nPid] = {"e","mu","pi","k","p","d"} ;
+ Double_t bayes = 0. ;
+ cout << " selN = " << selN << " particles normalized abundance : " ;
+ for(int i=0;i<Flow::nPid;i++)
+ {
+  bayes = GetRunBayesian(i, selN) ;
+  cout << bayes << "_" << names[i] << " ; " ;
+ }
+ cout << endl ;
+ return ;
+}
+//-----------------------------------------------------------------------
+void AliFlowAnalyser::FillWgtArrays(TFile* wgtFile)
+{
+ // Loads PhiWeights & Bayesian particles' abundance from file (default: flowPhiWgt.hist.root). 
+ // Weights are stored in a static TH1D* data member, ready to be plugged into the AliFlowEvent.
+ // The plugging is done by the method ::FillEvtPhiWgt() (if wgt file is there).
+
+ fPhiWgtFile = wgtFile ;
+
+ TString* histTitle ;
+ TH1D* TPC_all ; TH1D* TPC_plus ; TH1D* TPC_minus ; TH1D* TPC_cross ;
+ TH1D* PID_bay ;
+ for(int k=0;k<Flow::nSels;k++)
+ {
+  for(int j=0;j<Flow::nHars;j++) 
+  {
+  // Tpc (plus)
+   histTitle = new TString("Flow_Phi_Weight_TPCplus_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   TPC_plus = (TH1D*)fPhiWgtFile->Get(histTitle->Data());
+   delete histTitle;
+   // Tpc (minus)
+   histTitle = new TString("Flow_Phi_Weight_TPCminus_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   TPC_minus = (TH1D*)fPhiWgtFile->Get(histTitle->Data());
+   delete histTitle;
+   // Tpc (cross)
+   histTitle = new TString("Flow_Phi_Weight_TPCcross_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   TPC_cross = (TH1D*)fPhiWgtFile->Get(histTitle->Data());
+   delete histTitle;
+
+   // Tpc
+   histTitle = new TString("Flow_Phi_Weight_TPC_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   TPC_all = (TH1D*)fPhiWgtFile->Get(histTitle->Data());
+   delete histTitle;
+
+   for(int n=0;n<fPhiBins;n++) 
+   {
+    fPhiWgtPlus[k][j][n]  = TPC_plus->GetBinContent(n+1) ;
+    fPhiWgtMinus[k][j][n] = TPC_minus->GetBinContent(n+1) ;
+    fPhiWgtCross[k][j][n] = TPC_cross->GetBinContent(n+1) ;
+    fPhiWgt[k][j][n]     = TPC_all->GetBinContent(n+1) ;
+    // cout << "  Weights: " << fPhiWgt[k][j][n] << " ; " << fPhiWgtPlus[k][j][n] << " | " << fPhiWgtMinus[k][j][n] << " | " << fPhiWgtCross[k][j][n] << endl ; 
+   }
+  }
+  
+  // Bayesian weights
+  histTitle = new TString("Flow_BayPidMult_Sel");
+  *histTitle += k+1;
+  PID_bay = (TH1D*)fPhiWgtFile->Get(histTitle->Data());
+  delete histTitle;
+  Double_t totCount = PID_bay->GetSumOfWeights() ;
+  for (int n=0;n<Flow::nPid;n++) 
+  { 
+   if(totCount) { fBayesianWgt[k][n] = PID_bay->GetBinContent(n+1) / totCount ; }
+   else        { fBayesianWgt[k][n] = 1. ; }
+   // cout << "  Bayesian Weights (" << n << ") : " << fBayesianWgt[k][n] << endl ; 
+  }
+ }
+
+ delete TPC_all ; delete TPC_plus ; delete TPC_minus ; delete TPC_cross ;
+ delete PID_bay ;
+
+ return ;
+}
+//-----------------------------------------------------------------------
+void AliFlowAnalyser::FillEvtPhiWgt(AliFlowEvent* fFlowEvent)
+{
+ // Plugs phi weights into the static dwgt data member of the AliFlowEvent class.
+ // Weights are given in special Flow::PhiWgt_t arrays (see AliFlowConstants), 
+ // which are read from the wgt histograms by the method FillWgtArrays(...).
+ fFlowEvent->SetPhiWeight(fPhiWgt);
+ fFlowEvent->SetPhiWeightPlus(fPhiWgtPlus);
+ fFlowEvent->SetPhiWeightMinus(fPhiWgtMinus);
+ fFlowEvent->SetPhiWeightCross(fPhiWgtCross); 
+ return ;
+}
+//-----------------------------------------------------------------------
+void AliFlowAnalyser::FillBayesianWgt(AliFlowEvent* fFlowEvent)
+{
+ // Plugs Bayesian particle abundance into the current AliFlowEvent.
+ // A bayesian vector should be used for the PId of any different selection 
+ // (different sets of cuts -> different particle abundance), but for now  
+ // just the Selection n.0 (with no cuts) is used .
+ // (AliFlowEvent::mBayesianCs[6] is a 1-dimensional array, change that first!).
+
+ Double_t bayes[Flow::nPid] ; 
+ Double_t bayCheck = 0. ;
+ for (int n=0;n<Flow::nPid;n++) 
+ {
+  bayes[n] = fBayesianWgt[0][n] ;
+  bayCheck += bayes[n] ;   
+  // cout << "Bayesian V[" << n << "]  =  " << fBayesianWgt[0][n] << endl ; 
+ }
+ if(bayCheck)   { fFlowEvent->SetBayesian(bayes) ; fRePid = kTRUE ; }
+ else          { cout << "An empty bayesian vector is stored !!! - Bayesian weights = {1,1,1,1,1,1} " << endl ; }
+
+ return ;
+}
+//-----------------------------------------------------------------------
+void AliFlowAnalyser::Weightening()
+{
+ // Calculates weights, and fills PhiWgt histograms .
+ // This is called at the end of the event analysis.
+ cout << " AliFlowAnalyser::Weightening() " << endl ; cout << endl ;
+ // PhiWgt histogram collection
+ fPhiWgtHistList = new TOrdCollection(4*Flow::nSels*Flow::nHars) ;
+ // Creates PhiWgt Histograms
+ TString* histTitle ;
+ for(int k = 0; k < Flow::nSels; k++)
+ {
+  for(int j = 0; j < Flow::nHars; j++) 
+  {
+   // Tpc (plus)
+   histTitle = new TString("Flow_Phi_Weight_TPCplus_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtPlus = new TH1D(histTitle->Data(),histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtPlus->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtPlus->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtPlus->SetYTitle("PhiWgt");
+   delete histTitle;
+   // Tpc (minus)
+   histTitle = new TString("Flow_Phi_Weight_TPCminus_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtMinus = new TH1D(histTitle->Data(),histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtMinus->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtMinus->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtMinus->SetYTitle("PhiWgt");
+   delete histTitle;
+   // Tpc (cross)
+   histTitle = new TString("Flow_Phi_Weight_TPCcross_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtAll = new TH1D(histTitle->Data(),histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtAll->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtAll->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtAll->SetYTitle("PhiWgt");
+   delete histTitle;
+   // Tpc
+   histTitle = new TString("Flow_Phi_Weight_TPC_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiWgt = new TH1D(histTitle->Data(),histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiWgt->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistPhiWgt->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiWgt->SetYTitle("PhiWgt");
+   delete histTitle;
+
+   // Calculate PhiWgt
+   double meanPlus  = fHistFull[k].fHistFullHar[j].fHistPhiPlus->Integral() / (double)fPhiBins ;
+   double meanMinus = fHistFull[k].fHistFullHar[j].fHistPhiMinus->Integral() / (double)fPhiBins ;
+   double meanCross = fHistFull[k].fHistFullHar[j].fHistPhiAll->Integral() / (double)fPhiBins ;
+   double meanTPC = fHistFull[k].fHistFullHar[j].fHistPhi->Integral() / (double)fPhiBins ;
+
+   // Tpc
+   for (int i=0;i<fPhiBins;i++) 
+   {
+    fHistFull[k].fHistFullHar[j].fHistPhiWgtPlus->SetBinContent(i+1,meanPlus);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgtPlus->SetBinError(i+1, 0.);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgtMinus->SetBinContent(i+1,meanMinus);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgtMinus->SetBinError(i+1, 0.);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgtAll->SetBinContent(i+1,meanCross);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgtAll->SetBinError(i+1, 0.);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgt->SetBinContent(i+1,meanTPC);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgt->SetBinError(i+1, 0.);
+   }
+   
+   if(meanTPC==0) { cout << " Sel." << k << " , Har." << j << " :  empty phi histogram ! " << endl ; }
+   else 
+   {
+    fHistFull[k].fHistFullHar[j].fHistPhiWgtPlus->Divide(fHistFull[k].fHistFullHar[j].fHistPhiPlus);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgtMinus->Divide(fHistFull[k].fHistFullHar[j].fHistPhiMinus);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgtAll->Divide(fHistFull[k].fHistFullHar[j].fHistPhiAll);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgt->Divide(fHistFull[k].fHistFullHar[j].fHistPhi);
+   }
+   
+   fPhiWgtHistList->AddLast(fHistFull[k].fHistFullHar[j].fHistPhiWgtPlus);
+   fPhiWgtHistList->AddLast(fHistFull[k].fHistFullHar[j].fHistPhiWgtMinus);
+   fPhiWgtHistList->AddLast(fHistFull[k].fHistFullHar[j].fHistPhiWgtAll);
+   fPhiWgtHistList->AddLast(fHistFull[k].fHistFullHar[j].fHistPhiWgt);
+  }
+ }
+
+ return ;
+}
+//-----------------------------------------------------------------------
+// ###
+//-----------------------------------------------------------------------
+Bool_t AliFlowAnalyser::Analyse(AliFlowEvent* flowEvent)         
+{
+ // Runs the analysis on the AliFlowEvent (* fFlowEvent). 
+ // This method can be inserted in a loop over a collection of 
+ // AliFlowEvents or for on-fly analysis on AliESDs if used toghether 
+ // with the AliFlowMaker.
+ cout << " AliFlowAnalyser::Analyze(" << fFlowEvent << " )   -   " << fEventNumber << endl ;
+ if(!flowEvent) { return kFALSE ; }
+ else  { fFlowEvent = flowEvent ; }
+
+ if(fFlowSelect->Select(fFlowEvent))    // event selected - here below the ANALYSIS FLAGS are setted -
+ {
+  cout << " * 1 . Load event (track & v0s) and set flags . " << endl ;
+  fFlowTracks = fFlowEvent->TrackCollection() ; 
+  fNumberOfTracks = fFlowTracks->GetEntries() ;
+  fFlowV0s = fFlowEvent->V0Collection() ; 
+  fNumberOfV0s = fFlowV0s->GetEntries() ;
+  cout << "       event ID = " << fFlowEvent->EventID() << " :  found " << fNumberOfTracks << " AliFlowTracks, and " << fNumberOfV0s << " AliFlowV0s . " << endl ;  
+                                                           
+  if(fReadPhiWgt) { FillEvtPhiWgt(fFlowEvent) ; }          // phi and bayesian weights are filled previous to the loop (FillWgtArrays(TFile*))
+  else                   { fFlowEvent->SetNoWgt() ; }              // phi weights can be used or not , this plugs them into the event
+
+  if(fBayWgt)    { FillBayesianWgt(fFlowEvent) ; }         // bayesian weights can be used or not , this plugs them into the event
+  if(fRePid)     { fFlowEvent->SetPids() ; }               // re-calculate all p.id. hypotesis with the (new) bayesian array
+
+  if(fOnePhiWgt)  { fFlowEvent->SetOnePhiWgt() ; }         // one phi-wgt histogram
+  else                   { fFlowEvent->SetFirstLastPhiWgt() ; }    // three phi-wgt histogram
+  if(fPtWgt)     { fFlowEvent->SetPtWgt(); ; }             // pT as a weight
+  if(fEtaWgt)    { fFlowEvent->SetEtaWgt() ; }             // eta as a weight
+
+  if(fShuffle)    { fFlowEvent->RandomShuffle() ; }        // tracks re-shuffling
+
+  fFlowEvent->SetSelections(fFlowSelect) ;                 // does the selection of tracks for r.p. calculation (sets flags in AliFlowTrack)
+  fFlowEvent->SetEtaSubs(fEtaSub) ;                        // setting for the subevents (eta or random)
+  fFlowEvent->MakeSubEvents() ;                            // makes the subevent, eta or random basing on the previous flag
+
+  cout << " * 2 . Calculating event quantities all in one shoot . " << endl ; 
+  fFlowEvent->MakeAll() ; 
+  
+  if(FillFromFlowEvent(fFlowEvent))                        // calculates event quantities
+  {
+   cout << " * 3 . Event Histograms and Particles loop . " << endl ;
+   FillEventHistograms(fFlowEvent);                        // fill histograms from AliFlowEvents
+   if(fTrackLoop) { FillParticleHistograms(fFlowTracks) ; } // fill histograms from AliFlowTracks
+   if(fV0loop)    { FillV0Histograms(fFlowV0s) ; }         // fill histograms from AliFlowV0s 
+   //FillLabels() ;                                        // fill the histogram of MC labels (from the simulation)
+  }
+  else 
+  {
+   cout << " * 3 . Event psi = 0   -   Skipping! " << endl ; 
+   return kFALSE ;
+  }
+ }
+ else 
+ {
+  cout << " * 0 . Event " << fEventNumber << " (event ID = " << fFlowEvent->EventID() << ") discarded . " << endl ; 
+  delete fFlowEvent  ; fFlowEvent = 0 ; 
+  return kFALSE ;
+ }
+ fEventNumber++ ;
+ return kTRUE ;
+}
+//-----------------------------------------------------------------------
+Bool_t AliFlowAnalyser::FillFromFlowEvent(AliFlowEvent* fFlowEvent)
+{
+ // gets event quantities, returns kFALSE if Q vector is always 0 
+
+ Int_t selCheck = 0 ;
+ for(Int_t k = 0; k < Flow::nSels; k++) 
+ {
+  fFlowSelect->SetSelection(k) ;
+  for(Int_t j = 0; j < Flow::nHars; j++) 
+  {
+   fFlowSelect->SetHarmonic(j) ;
+   for(Int_t n = 0; n < Flow::nSubs; n++) 
+   {
+    fFlowSelect->SetSubevent(n) ;
+    fPsiSub[n][k][j] = fFlowEvent->Psi(fFlowSelect) ;          // sub-event quantities
+    fMultSub[n][k][j] = fFlowEvent->Mult(fFlowSelect) ;
+   }
+   fFlowSelect->SetSubevent(-1);
+   fQ[k][j]    = fFlowEvent->Q(fFlowSelect) ;          // full event quantities
+   fPsi[k][j]  = fFlowEvent->Psi(fFlowSelect) ;
+   fQnorm[k][j]   = fFlowEvent->NormQ(fFlowSelect).Mod() ; // was: fFlowEvent->q(fFlowSelect) ; // but the normalization was bad (no pT,eta weight)
+   fMult[k][j] = fFlowEvent->Mult(fFlowSelect) ;
+   selCheck += fMult[k][j] ; 
+  }
+ }
+ if(!selCheck) { return kFALSE ; }                     // if there are no particles in the selection -> skip the event
+
+ return kTRUE ;
+}
+//-----------------------------------------------------------------------
+void AliFlowAnalyser::FillEventHistograms(AliFlowEvent* fFlowEvent)    
+{
+ // fill event histograms
+
+ cout << " Fill Event Histograms ... " << endl ; 
+
+ float trigger = (float)fFlowEvent->L0TriggerWord() ;
+ fHistTrigger->Fill(trigger);
+
+ // no selections: OrigMult, Centrality, Mult, MultOverOrig, VertexZ, VertexXY
+ int origMult = fFlowEvent->OrigMult();
+ fHistOrigMult->Fill((float)origMult);
+ fHistMultEta->Fill((float)fFlowEvent->MultEta());
+
+ int cent = fFlowEvent->Centrality();
+ fHistCent->Fill((float)cent);
+
+ fHistMult->Fill((float)fNumberOfTracks) ;
+ fHistV0Mult->Fill((float)fNumberOfV0s) ;
+ if(origMult) { fHistMultOverOrig->Fill((float)fNumberOfTracks/(float)origMult) ; }
+
+ fFlowEvent->VertexPos(fVertex) ;
+ fHistVertexZ->Fill(fVertex[2]) ;
+ fHistVertexXY2D->Fill(fVertex[0],fVertex[1]) ;
+
+ // ZDC info
+ fHistPartZDC->Fill(fFlowEvent->ZDCpart()) ;
+ for(int ii=0;ii<3;ii++) { fHistEnergyZDC->Fill(ii,fFlowEvent->ZDCenergy(ii)) ; }
+
+ // sub-event Psi_Subs
+ for(int k = 0; k < Flow::nSels; k++) 
+ {
+  for(int j = 0; j < Flow::nHars; j++) 
+  {
+   for(int n = 0; n < Flow::nSubs; n++) 
+   {
+    int iii = Flow::nSubs * k + n ;    //cout << "  " << k << j << n << " , " << iii << endl ;
+    fHistSub[iii].fHistSubHar[j].fHistPsiSubs->Fill(fPsiSub[n][k][j]) ;
+   }
+  }
+ }
+
+ // full event Psi, PsiSubCorr, PsiSubCorrDiff, cos, mult, q
+ for(int k = 0; k < Flow::nSels; k++) 
+ {
+  for(int j = 0; j < Flow::nHars; j++) 
+  {
+   float order = (float)(j+1);
+   fHistFull[k].fHistFullHar[j].fHistPsi->Fill(fPsi[k][j]);
+   if(k<2 && j<2)
+   {
+    if(k==0) 
+    { 
+     float psi1 = fPsi[0][j] ; 
+     float psi2 = fPsi[1][j] ;
+     float diff = psi1 - psi2 ;
+     if(diff < -TMath::Pi()/(j+1))      { diff += 2*TMath::Pi()/(j+1) ; } 
+     else if(diff > +TMath::Pi()/(j+1)) { diff -= 2*TMath::Pi()/(j+1) ; }
+     fHistFull[k].fHistFullHar[j].fHistPsiDiff->Fill(diff) ; // k=0
+    } 
+    else if(k==1) 
+    {
+     float psi1 ; float psi2 ;
+     if (j==0)     { psi1 = fPsi[0][0] ; psi2 = fPsi[1][1] ; }  
+     else if(j==1) { psi1 = fPsi[0][0] ; psi2 = fPsi[0][1] ; }
+     float diff = psi1 - psi2 ;
+     diff = (TMath::Abs(diff) > TMath::Pi()) ? ((diff > 0.) ? -(2*TMath::Pi()-diff) : -(diff+2*TMath::Pi())) : diff ;
+     fHistFull[k].fHistFullHar[j].fHistPsiDiff->Fill(diff) ; // k=1
+    }     
+   }
+
+   if(fPsiSub[0][k][j] != 0. && fPsiSub[1][k][j] != 0.)
+   {
+    float psiSubCorr;                          // this is:  delta_Psi
+    if(fV1Ep1Ep2 == kFALSE || order != 1) 
+    {
+     psiSubCorr = fPsiSub[0][k][j] - fPsiSub[1][k][j];
+    }
+    else // i.e. (fV1Ep1Ep2 == kTRUE && order == 1)
+    { 
+     psiSubCorr = fPsiSub[0][k][0] + fPsiSub[1][k][0] - 2*fPsi[k][1];
+    }
+    fHistFull[k].fHistCos->Fill(order, (float)cos(order * psiSubCorr)) ;
+    if(psiSubCorr < 0.)                 { psiSubCorr += 2*TMath::Pi()/order ; }
+    if(psiSubCorr > 2*TMath::Pi()/order) { psiSubCorr -= 2*TMath::Pi()/order ; } // for v1Ep1Ep2 which gives -2*TMath::Pi() < psiSubCorr < 2*2*TMath::Pi()
+    fHistFull[k].fHistFullHar[j].fHistPsiSubCorr->Fill(psiSubCorr);
+   }
+
+   if(j < Flow::nHars - 1) // subevents of different harmonics
+   {
+    int j1, j2;
+    float psiSubCorrDiff;
+    if(j==0)     { j1 = 1, j2 = 2 ; } 
+    else if(j==1) { j1 = 1, j2 = 3 ; } 
+    else if(j==2) { j1 = 2, j2 = 4 ; }
+    psiSubCorrDiff = fmod((double)fPsiSub[0][k][j1-1],2*TMath::Pi()/(double)j2)-fmod((double)fPsiSub[1][k][j2-1],2*TMath::Pi()/(double)j2) ;
+    if(psiSubCorrDiff < 0.) { psiSubCorrDiff += 2*TMath::Pi()/(float)j2 ; }
+    fHistFull[k].fHistFullHar[j].fHistPsiSubCorrDiff->Fill(psiSubCorrDiff) ;
+    psiSubCorrDiff = fmod((double)fPsiSub[0][k][j2-1],2*TMath::Pi()/(double)j2)-fmod((double)fPsiSub[1][k][j1-1],2*TMath::Pi()/(double)j2) ;
+    if(psiSubCorrDiff < 0.) { psiSubCorrDiff += 2*TMath::Pi()/(float)j2 ; }
+    fHistFull[k].fHistFullHar[j].fHistPsiSubCorrDiff->Fill(psiSubCorrDiff) ;
+   }
+   
+   fHistFull[k].fHistFullHar[j].fHistMult->Fill((float)fMult[k][j]) ;
+   fHistFull[k].fHistFullHar[j].fHistQnorm->Fill(fQnorm[k][j]) ;
+  }
+ }
+ return ;
+}
+//-----------------------------------------------------------------------
+void AliFlowAnalyser::FillParticleHistograms(TObjArray* fFlowTracks) 
+{
+ // fills tracks histograms
+
+ cout << " Tracks Loop . " << endl ; 
+
+ float corrMultUnit   = 0. ;
+ float corrMultN      = 0. ;
+ float etaSymPosTpcN  = 0. ;
+ float etaSymNegTpcN  = 0. ;
+ float etaSymPosTpcNpart = 0. ;
+ float etaSymNegTpcNpart = 0. ;
+ float hPlusN        = 0. ;
+ float hMinusN        = 0. ;
+ float piPlusN        = 0. ;
+ float piMinusN       = 0. ;
+ float protonN        = 0. ;
+ float pbarN         = 0. ;
+ float kMinusN        = 0. ;
+ float kPlusN        = 0. ;
+ float deuteronN      = 0. ;
+ float dbarN         = 0. ;
+ float electronN      = 0. ;
+ float positronN      = 0. ;
+ float muonMinusN     = 0. ;
+ float muonPlusN      = 0. ;
+
+ for(fTrackNumber=0;fTrackNumber<fNumberOfTracks;fTrackNumber++) 
+ {
+  fFlowTrack = (AliFlowTrack*)fFlowTracks->At(fTrackNumber) ;
+  //cout << "Track n. " << fTrackNumber << endl ; fFlowTrack->Dump() ; 
+  
+  bool constrainable = fFlowTrack->IsConstrainable() ;
+  // int label = fFlowTrack->Label() ;                         
+  float dcaGlobal = TMath::Abs(fFlowTrack->Dca()) ;    
+  float dcaSigned = fFlowTrack->TransDcaSigned() ;     
+  float dcaTrans = TMath::Abs(dcaSigned) ;             
+  float eta = fFlowTrack->Eta() ;                      
+  float phi = fFlowTrack->Phi() ;                      
+  float pt = fFlowTrack->Pt() ;                        
+  float etaGlob = fFlowTrack->EtaGlobal() ;                                                                    
+  float phiGlob = fFlowTrack->PhiGlobal() ;            
+  float ptGlob = fFlowTrack->PtGlobal() ;              
+  float totalp = fFlowTrack->P() ;                     
+  // float logp = TMath::Log10(totalp) ;
+  // float zFirstPoint = fFlowTrack->ZFirstPoint() ;   
+  // float zLastPoint = fFlowTrack->ZLastPoint() ;     
+  float lenght = fFlowTrack->TrackLength() ;           
+  int  charge = fFlowTrack->Charge() ;                 
+  float chi2 = fFlowTrack->Chi2() ;                    
+  int  fitPtsTPC = (int)((float)fFlowTrack->FitPtsTPC()) ;
+  int  maxPtsTPC = fFlowTrack->MaxPtsTPC() ;           
+  float chi2TPC = fFlowTrack->Chi2TPC() ;              
+  int  fitPtsITS = fFlowTrack->FitPtsITS() ;           
+  int  maxPtsITS = fFlowTrack->MaxPtsITS() ;           
+  float chi2ITS = fFlowTrack->Chi2ITS() ;              
+  int  fitPtsTRD = fFlowTrack->NhitsTRD() ;            
+  int  maxPtsTRD = fFlowTrack->MaxPtsTRD() ;           
+  float chi2TRD = fFlowTrack->Chi2TRD() ;              
+  int  fitPtsTOF = fFlowTrack->NhitsTOF() ;            
+  int  maxPtsTOF = fFlowTrack->MaxPtsTOF() ;           
+  float chi2TOF = fFlowTrack->Chi2TOF() ;              
+  float dEdx = fFlowTrack->DedxTPC() ;                         
+  float its = fFlowTrack->DedxITS() ;                  
+  float trd = fFlowTrack->SigTRD() ;                   
+  float tof = fFlowTrack->TofTOF() ;
+  float lpTPC = 0 ; if(fFlowTrack->PatTPC()>0) { lpTPC = TMath::Log10(fFlowTrack->PatTPC()) ; }
+  float lpITS = 0 ; if(fFlowTrack->PatITS()>0) { lpITS = TMath::Log10(fFlowTrack->PatITS()) ; }
+  float lpTRD = 0 ; if(fFlowTrack->PatTRD()>0) { lpTRD = TMath::Log10(fFlowTrack->PatTRD()) ; }
+  float lpTOF = 0 ; if(fFlowTrack->PatTOF()>0) { lpTOF = TMath::Log10(fFlowTrack->PatTOF()) ; }  
+  float invMass = fFlowTrack->InvMass() ;             
+  Char_t pid[10]="0" ; strcpy(pid,fFlowTrack->Pid()) ; 
+  fPidId        = -1 ; // assigned later
+
+  // no selections: Charge, Dca, Chi2, FitPts, MaxPts, FitOverMax, PID
+  fHistCharge->Fill((float)charge);
+  fHistDcaGlobal->Fill(dcaGlobal);
+  fHistDca->Fill(dcaTrans) ;
+  fHistTransDca->Fill(dcaSigned);
+  fHistChi2->Fill(chi2);
+  
+  // - here ITS   (chi2 & nHits)
+  fHistChi2ITS->Fill(chi2ITS);
+  if (fitPtsITS>0)
+    fHistChi2normITS->Fill(chi2ITS/((float)fitPtsITS));
+  fHistFitPtsITS->Fill((float)fitPtsITS);
+  fHistMaxPtsITS->Fill((float)maxPtsITS);
+
+  // - here TPC   (chi2 & nHits)
+  fHistChi2TPC->Fill(chi2TPC);
+  if (fitPtsTPC>0)
+    fHistChi2normTPC->Fill(chi2TPC/((float)fitPtsTPC));
+  fHistFitPtsTPC->Fill((float)fitPtsTPC);
+  fHistMaxPtsTPC->Fill((float)maxPtsTPC);
+  if(maxPtsTPC>0)
+    fHistFitOverMaxTPC->Fill((float)(fitPtsTPC)/(float)maxPtsTPC);
+
+  // - here TRD  (chi2 & nHits)
+  fHistChi2TRD->Fill(chi2TRD);
+  if (fitPtsTRD>0)
+    fHistChi2normTRD->Fill(chi2TRD/((float)fitPtsTRD));
+  fHistFitPtsTRD->Fill((float)fitPtsTRD);
+  fHistMaxPtsTRD->Fill((float)maxPtsTRD);
+
+  // - here TOF   (chi2 & nHits)
+  fHistChi2TOF->Fill(chi2TOF);
+  if (fitPtsTOF>0)
+    fHistChi2normTOF->Fill(chi2TOF/((float)fitPtsTOF));
+  fHistFitPtsTOF->Fill((float)fitPtsTOF);
+  fHistMaxPtsTOF->Fill((float)maxPtsTOF);
+  
+  // fit over max (all)
+  int maxPts = maxPtsITS + maxPtsTPC + maxPtsTRD + maxPtsTOF ;
+  int fitPts = fitPtsITS + fitPtsTPC + fitPtsTRD + fitPtsTOF ;
+  if(maxPts>0)
+    fHistFitOverMax->Fill((float)(fitPts)/(float)maxPts) ;
+  
+  // lenght
+  fHistLenght->Fill(lenght) ;
+  fHistInvMass->Fill(invMass) ;
+
+  // PID histograms & multiplicity count (for bayesian histogram)
+  if(charge == 1) 
+  {
+   hPlusN++ ;
+   fHistMeanDedxPos2D->Fill(lpTPC, dEdx) ;
+   fHistMeanDedxPos2DITS->Fill(lpITS, its) ;
+   fHistMeanDedxPos2DTRD->Fill(lpTRD, trd) ;
+   fHistMeanDedxPos2DTOF->Fill(lpTOF, tof) ;
+   //
+   float positron  = fFlowTrack->ElectronPositronProb() ;
+   fHistPidPositron->Fill(positron) ;
+   if(strcmp(pid, "e+") == 0) 
+   {
+    fPidId = 0 ; positronN++ ; fHistPidPt->Fill(1.5,pt) ;
+    fHistMeanTPCPositron->Fill(lpTPC, dEdx) ;
+    fHistMeanITSPositron->Fill(lpITS, its);
+    fHistMeanTRDPositron->Fill(lpTRD, trd);
+    fHistMeanTOFPositron->Fill(invMass, tof);
+    fHistPidPositronPart->Fill(positron) ;
+   }
+   float muonPlus  = fFlowTrack->MuonPlusMinusProb() ;
+   fHistPidMuonPlus->Fill(muonPlus) ;
+   if(strcmp(pid, "mu+") == 0) 
+   {
+    fPidId = 1 ; muonPlusN++ ; fHistPidPt->Fill(3.5,pt) ; 
+    fHistMeanTPCMuonPlus->Fill(lpTPC, dEdx) ;
+    fHistMeanITSMuonPlus->Fill(lpITS, its);
+    fHistMeanTRDMuonPlus->Fill(lpTRD, trd);
+    fHistMeanTOFMuonPlus->Fill(invMass, tof);
+    fHistPidMuonPlusPart->Fill(muonPlus) ;
+   }
+   float piPlus = fFlowTrack->PionPlusMinusProb() ;
+   fHistPidPiPlus->Fill(piPlus) ;
+   if(strcmp(pid, "pi+") == 0) 
+   { 
+    fPidId = 2 ; piPlusN++ ; fHistPidPt->Fill(5.5,pt) ;
+    fHistMeanTPCPiPlus->Fill(lpTPC, dEdx) ;
+    fHistMeanITSPiPlus->Fill(lpITS, its);
+    fHistMeanTRDPiPlus->Fill(lpTRD, trd);
+    fHistMeanTOFPiPlus->Fill(invMass, tof);
+    fHistPidPiPlusPart->Fill(piPlus) ;
+   }
+   float kplus  = fFlowTrack->KaonPlusMinusProb() ;
+   fHistPidKplus->Fill(kplus) ;
+   if(strcmp(pid, "k+") == 0) 
+   {
+    fPidId = 3 ; kPlusN++ ; fHistPidPt->Fill(7.5,pt) ; 
+    fHistMeanTPCKplus->Fill(lpTPC, dEdx) ;
+    fHistMeanITSKplus->Fill(lpITS, its);
+    fHistMeanTRDKplus->Fill(lpTRD, trd);
+    fHistMeanTOFKplus->Fill(invMass, tof);
+    fHistPidKplusPart->Fill(kplus) ;
+   }
+   float proton  = fFlowTrack->ProtonPbarProb() ;
+   fHistPidProton->Fill(proton) ;
+   if(strcmp(pid, "pr+") == 0) 
+   {
+    fPidId = 4 ; protonN++ ; fHistPidPt->Fill(9.5,pt) ;  
+    fHistMeanTPCProton->Fill(lpTPC, dEdx) ;
+    fHistMeanITSProton->Fill(lpITS, its);
+    fHistMeanTRDProton->Fill(lpTRD, trd);
+    fHistMeanTOFProton->Fill(invMass, tof);
+    fHistPidProtonPart->Fill(proton) ;
+   }
+   float deuteron  = fFlowTrack->DeuteriumAntiDeuteriumProb() ;
+   fHistPidDeuteron->Fill(deuteron) ;
+   if(strcmp(pid, "d+") == 0) 
+   {
+    fPidId = 6 ; deuteronN++ ; fHistPidPt->Fill(11.5,pt) ; 
+    fHistMeanTPCDeuteron->Fill(lpTPC, dEdx) ;
+    fHistMeanITSDeuteron->Fill(lpITS, its);
+    fHistMeanTRDDeuteron->Fill(lpTRD, trd);
+    fHistMeanTOFDeuteron->Fill(invMass, tof);
+    fHistPidDeuteronPart->Fill(deuteron) ;
+   }
+  } 
+  else if(charge == -1) 
+  {
+   hMinusN++ ;
+   fHistMeanDedxNeg2D->Fill(lpTPC, dEdx) ;
+   fHistMeanDedxNeg2DITS->Fill(lpITS, its) ;
+   fHistMeanDedxNeg2DTRD->Fill(lpTRD, trd) ;
+   fHistMeanDedxNeg2DTOF->Fill(lpTOF, tof) ;
+   //
+   float electron  = fFlowTrack->ElectronPositronProb() ;
+   fHistPidElectron->Fill(electron);
+   if(strcmp(pid, "e-") == 0) 
+   {
+    fPidId = 0 ; electronN++ ; fHistPidPt->Fill(0.5,pt) ; 
+    fHistMeanTPCElectron->Fill(lpTPC, dEdx);
+    fHistMeanITSElectron->Fill(lpITS, its);
+    fHistMeanTRDElectron->Fill(lpTRD, trd);
+    fHistMeanTOFElectron->Fill(invMass, tof);
+    fHistPidElectronPart->Fill(electron);
+   }
+   float muonMinus  = fFlowTrack->MuonPlusMinusProb() ;
+   fHistPidMuonMinus->Fill(muonMinus) ;
+   if(strcmp(pid, "mu-") == 0) 
+   {
+    fPidId = 1 ; muonMinusN++ ; fHistPidPt->Fill(2.5,pt) ;
+    fHistMeanTPCMuonMinus->Fill(lpTPC, dEdx) ;
+    fHistMeanITSMuonMinus->Fill(lpITS, its);
+    fHistMeanTRDMuonMinus->Fill(lpTRD, trd);
+    fHistMeanTOFMuonMinus->Fill(invMass, tof);
+    fHistPidMuonMinusPart->Fill(muonMinus) ;
+   }
+   float piMinus = fFlowTrack->PionPlusMinusProb() ;
+   fHistPidPiMinus->Fill(piMinus) ;
+   if(strcmp(pid, "pi-") == 0) 
+   {
+    fPidId = 2 ; piMinusN++ ; fHistPidPt->Fill(4.5,pt) ;
+    fHistMeanTPCPiMinus->Fill(lpTPC, dEdx);
+    fHistMeanITSPiMinus->Fill(lpITS, its);
+    fHistMeanTRDPiMinus->Fill(lpTRD, trd);
+    fHistMeanTOFPiMinus->Fill(invMass, tof);
+    fHistPidPiMinusPart->Fill(piMinus);
+   }
+   float kminus  = fFlowTrack->KaonPlusMinusProb() ;
+   fHistPidKminus->Fill(kminus);
+   if(strcmp(pid, "k-") == 0) 
+   {
+    fPidId = 3 ; kMinusN++ ; fHistPidPt->Fill(6.5,pt) ;
+    fHistMeanTPCKminus->Fill(lpTPC, dEdx);
+    fHistMeanITSKminus->Fill(lpITS, its);
+    fHistMeanTRDKminus->Fill(lpTRD, trd);
+    fHistMeanTOFKminus->Fill(invMass, tof);
+    fHistPidKminusPart->Fill(kminus);
+   }
+   float antiproton  = fFlowTrack->ProtonPbarProb() ;
+   fHistPidAntiProton->Fill(antiproton);
+   if(strcmp(pid, "pr-") == 0) 
+   {
+    fPidId = 4 ; pbarN++ ; fHistPidPt->Fill(8.5,pt) ;
+    fHistMeanTPCPbar->Fill(lpTPC, dEdx);
+    fHistMeanITSPbar->Fill(lpITS, its);
+    fHistMeanTRDPbar->Fill(lpTRD, trd);
+    fHistMeanTOFPbar->Fill(invMass, tof);
+    fHistPidAntiProtonPart->Fill(antiproton);
+   }
+   float antideuteron  = fFlowTrack->DeuteriumAntiDeuteriumProb() ;
+   fHistPidAntiDeuteron->Fill(antideuteron);
+   if(strcmp(pid, "d-") == 0) 
+   {
+    fPidId = 6 ; dbarN++ ; fHistPidPt->Fill(10.5,pt) ;
+    fHistMeanTPCAntiDeuteron->Fill(lpTPC, dEdx);
+    fHistMeanITSAntiDeuteron->Fill(lpITS, its);
+    fHistMeanTRDAntiDeuteron->Fill(lpTRD, trd);
+    fHistMeanTOFAntiDeuteron->Fill(invMass, tof);
+    fHistPidAntiDeuteronPart->Fill(antideuteron);
+   }
+  }
+  
+  // Yield3D, Yield2D, Eta, Pt, Phi, bayP.Id.
+  fHistPtot->Fill(totalp) ;
+  fHistPt->Fill(pt) ;
+  fHistPhi->Fill(phi);  
+  fHistAllEtaPtPhi3D->Fill(eta, pt, phi) ;
+  fHistYieldAll2D->Fill(eta, pt) ;
+  fHistBayPidMult->Fill(fPidId) ;
+  if(constrainable) 
+  { 
+   fHistPhiCons->Fill(phi);  
+   fHistPhiPtCon->Fill(phi, pt);  
+   fHistYieldCon2D->Fill(eta, pt) ;
+   fHistConsEtaPtPhi3D->Fill(eta, pt, phi) ;
+   fHistGlobEtaPtPhi3D->Fill(etaGlob, ptGlob, phiGlob) ;
+  }
+  else 
+  { 
+   fHistYieldUnc2D->Fill(etaGlob, ptGlob) ;
+   fHistUncEtaPtPhi3D->Fill(etaGlob, ptGlob, phiGlob) ;
+   fHistPhiPtUnc->Fill(phiGlob, ptGlob) ; 
+  }
+  if(fFlowTrack->Charge()>0)       { fHistPtPhiPos->Fill(phi, pt); }
+  else if(fFlowTrack->Charge()<0)  { fHistPtPhiNeg->Fill(phi, pt); }
+
+  // fills selected part histograms
+  if(fFlowSelect->SelectPart(fFlowTrack)) 
+  {
+   if(strlen(fFlowSelect->PidPart()) != 0) 
+   {
+    float rapidity = fFlowTrack->Y();
+    fHistBinEta->Fill(rapidity, rapidity);
+    fHistYieldPart2D->Fill(rapidity, pt);
+   }
+   else 
+   {
+    fHistBinEta->Fill(eta, eta) ;
+    fHistYieldPart2D->Fill(eta, pt) ;
+   }
+   fHistBayPidMultPart->Fill(fPidId) ;
+   fHistBinPt->Fill(pt, pt) ;
+   fHistEtaPtPhi3DPart->Fill(eta,pt,phi) ;
+   fHistDcaGlobalPart->Fill(dcaGlobal) ;
+   fHistInvMassPart->Fill(invMass) ;
+   if(charge == 1) 
+   {
+    fHistMeanDedxPos3DPart->Fill(lpITS, dEdx, fPidId) ;
+    fHistMeanDedxPos3DPartITS->Fill(lpITS, its, fPidId) ;
+   }
+   else if(charge == -1) 
+   {
+    fHistMeanDedxNeg3DPart->Fill(lpITS, dEdx, fPidId) ;
+    fHistMeanDedxNeg3DPartITS->Fill(lpITS, its, fPidId) ;
+   }
+   if(eta > 0.) { etaSymPosTpcNpart++ ; }  // for fHistEtaSymPart 
+   else         { etaSymNegTpcNpart++ ; }
+  }
+  else         
+  {
+   fHistEtaPtPhi3DOut->Fill(eta,pt,phi) ;
+   fHistYieldOut2D->Fill(eta, pt) ;
+   fHistDcaGlobalOut->Fill(dcaGlobal) ;
+   fHistInvMassOut->Fill(invMass) ;
+  }
+
+  // cos(n*phiLab)
+  for(int j = 0; j < Flow::nHars; j++) 
+  {
+   bool oddHar = (j+1) % 2 ;
+   float order = (float)(j+1) ;
+   float vIn   = 100 * cos((double)order * phi) ;
+   if(eta < 0 && oddHar) { vIn *= -1 ; }
+   fHistCosPhi->Fill(order, vIn);
+  }
+
+  //For Eta symmetry TPC
+  if(fFlowTrack->FitPtsTPC())
+  {
+   if(eta > 0.) { etaSymPosTpcN++ ; } // for fHistEtaSym 
+   else         { etaSymNegTpcN++ ; }
+  }
+  
+  // not to call it twice ...
+  int nEtaS = HarmonicsLoop(fFlowTrack) ;
+
+  //For Correlated Multiplicity 
+  corrMultN += (float)nEtaS ;
+
+  //For Correlated Multiplicity in 1 unit rapidity
+  if(TMath::Abs(eta) <= 0.5) { corrMultUnit += (float)nEtaS ; }
+
+  //delete pointer
+  fFlowTrack = 0 ;
+ }                                                                                              // end of tracks loop
+                                                    
+ // EtaSym
+ float etaSymTpc = 0 ; 
+ if(etaSymPosTpcN || etaSymNegTpcN)        { etaSymTpc  = (etaSymPosTpcN  - etaSymNegTpcN)  / (etaSymPosTpcN  + etaSymNegTpcN); }
+ float etaSymTpcPart = 0 ; 
+ if(etaSymPosTpcNpart || etaSymNegTpcNpart) { etaSymTpcPart  = (etaSymPosTpcNpart  - etaSymNegTpcNpart)  / (etaSymPosTpcNpart  + etaSymNegTpcNpart) ; }
+ Float_t vertexZ = fVertex[2] ;
+ // all
+ fHistEtaSym->Fill(etaSymTpc);
+ fHistEtaSymVerZ2D->Fill(vertexZ , etaSymTpc);
+ // selected
+ fHistEtaSymPart->Fill(etaSymTpc);
+ fHistEtaSymVerZ2DPart->Fill(vertexZ , etaSymTpcPart);
+
+ // PID multiplicities
+ float totalMult = (float)fFlowTracks->GetEntries() ;
+ fHistPidMult->Fill(1., totalMult);
+ fHistPidMult->Fill(2., hPlusN);
+ fHistPidMult->Fill(3., hMinusN);
+ fHistPidMult->Fill(4., piPlusN);
+ fHistPidMult->Fill(5., piMinusN);
+ fHistPidMult->Fill(6., protonN);
+ fHistPidMult->Fill(7., pbarN);
+ fHistPidMult->Fill(8., kPlusN);
+ fHistPidMult->Fill(9., kMinusN);
+ fHistPidMult->Fill(10., deuteronN);
+ fHistPidMult->Fill(11., dbarN);
+ fHistPidMult->Fill(12., electronN);
+ fHistPidMult->Fill(13., positronN);
+ fHistPidMult->Fill(14., muonMinusN);
+ fHistPidMult->Fill(15., muonPlusN);
+
+ // Multiplicity of particles correlated with the event planes
+ corrMultN /= (float)(Flow::nHars * Flow::nSels) ; 
+ fHistMultPart->Fill(corrMultN) ;
+ // ...in one unit rapidity
+ corrMultUnit /= (float)(Flow::nHars * Flow::nSels) ; 
+ fHistMultPartUnit->Fill(corrMultUnit) ;
+
+ return ;
+}
+//-----------------------------------------------------------------------
+Int_t AliFlowAnalyser::HarmonicsLoop(AliFlowTrack* fFlowTrack)
+{
+ // HarmonicsLoop, does the correlation analysis, fills histograms
+ // (internally called by ::FillParticleHistograms(..) loop) .
+ float eta = fFlowTrack->Eta() ;                       
+ float phi = fFlowTrack->Phi() ;                       
+ float pt = fFlowTrack->Pt() ;                         
+ float zFirstPoint = fFlowTrack->ZFirstPoint() ; 
+ // float zLastPoint = fFlowTrack->ZLastPoint() ;
+
+ // Looping over Selections and Harmonics
+ int corrMultN = 0 ;
+ for (int k = 0; k < Flow::nSels; k++) 
+ {
+  fFlowSelect->SetSelection(k) ;
+  for (int j = 0; j < Flow::nHars; j++) 
+  {
+   bool oddHar = (j+1) % 2;
+   fFlowSelect->SetHarmonic(j);
+   double order  = (double)(j+1);
+   float psi_i, psi_2;
+   if(fFlowEvent->EtaSubs())          // particles with the opposite subevent
+   {
+    if(eta > 0) { psi_i = fPsiSub[1][k][j] ; }     //check
+    else       { psi_i = fPsiSub[0][k][j] ; }
+   } 
+   else if(order > 3. && !oddHar) 
+   {
+    psi_i = fPsi[k][1];  // 2nd harmomic event plane
+    if(psi_i > 2*TMath::Pi()/order) { psi_i -= 2*TMath::Pi()/order ; } 
+    if(psi_i > 2*TMath::Pi()/order) { psi_i -= 2*TMath::Pi()/order ; }
+   } 
+   else  // random subevents
+   {
+    psi_i = fPsi[k][j] ;
+   }
+
+   if(fFlowSelect->Select(fFlowTrack)) // Get detID
+   {
+    Bool_t kTpcPlus  = kFALSE ;
+    Bool_t kTpcMinus = kFALSE ;
+    Bool_t kTpcAll   = kFALSE ;
+
+    fHistFull[k].fHistFullHar[j].fHistYieldPt->Fill(pt);
+    fHistFull[k].fHistFullHar[j].fHistEtaPtPhi3D->Fill(eta, pt, phi);
+    fHistFull[k].fHistFullHar[j].fHistYield2D->Fill(eta, pt);
+    fHistFull[k].fHistFullHar[j].fHistDcaGlob->Fill(TMath::Abs(fFlowTrack->Dca()));
+
+    // Set Tpc (+ and -)
+    if(fFlowTrack->FitPtsTPC())    //OR*: AliESDtrack:: "TBits& GetTPCClusterMap()" or "Int_t GetTPCclusters(Int_t* idx)" ...
+    {
+     if(zFirstPoint >= 0. && eta > 0.)     { kTpcPlus  = kTRUE ; } 
+     else if(zFirstPoint <= 0. && eta < 0.) { kTpcMinus = kTRUE ; }
+     else                                  { kTpcAll   = kTRUE ; }       
+    }
+
+    // PID Multiplicities (particle for R.P.) - done just one time for each selection
+    if(j==0) { fHistFull[k].fHistBayPidMult->Fill(fPidId) ; }
+
+    // Calculate weights for filling histograms   
+    float wt = 1. ; // TMath::Abs(fFlowEvent->Weight(k, j, fFlowTrack)) ; 
+
+    // Fill histograms with selections
+    if(kTpcPlus)       { fHistFull[k].fHistFullHar[j].fHistPhiPlus->Fill(phi,wt) ;  } 
+    else if(kTpcMinus) { fHistFull[k].fHistFullHar[j].fHistPhiMinus->Fill(phi,wt) ; } 
+    else if(kTpcAll)   { fHistFull[k].fHistFullHar[j].fHistPhiAll->Fill(phi,wt) ;   } 
+    fHistFull[k].fHistFullHar[j].fHistPhi->Fill(phi,wt) ;
+
+    // Get phiWgt from file
+    double phiWgt;
+    if(order > 3. && !oddHar) { phiWgt = fFlowEvent->PhiWeight(k, 1, fFlowTrack) ; } 
+    else                     { phiWgt = fFlowEvent->PhiWeight(k, j, fFlowTrack) ; }
+    if(oddHar && eta<0.)      { phiWgt /= -1. ; } // only for flat hists
+    // cout << " Weight [" << k << "][" << j << "] (" << fFlowTrack->GetName() << ") = " << phiWgt << " or " << wt << " for phi = " << phi << endl ; // chk
+
+    // Fill Flat histograms
+    if(kTpcPlus)       { fHistFull[k].fHistFullHar[j].fHistPhiFlatPlus->Fill(phi, phiWgt) ; } 
+    else if(kTpcMinus) { fHistFull[k].fHistFullHar[j].fHistPhiFlatMinus->Fill(phi, phiWgt) ; } 
+    else if(kTpcAll)   { fHistFull[k].fHistFullHar[j].fHistPhiFlatAll->Fill(phi, phiWgt) ; } 
+    fHistFull[k].fHistFullHar[j].fHistPhiFlat->Fill(phi,phiWgt) ;
+    
+    if(oddHar && eta<0.)  { phiWgt *= -1. ; } // restore value
+
+    // Remove autocorrelations
+    TVector2 Q_i;
+    if(!fFlowEvent->EtaSubs())   // random subevents
+    {
+     if(order > 3. && !oddHar) // 2nd harmonic event plane
+     { 
+      Q_i.Set(phiWgt * cos(phi * 2), phiWgt * sin(phi * 2));
+      TVector2 mQ_i = fQ[k][1] - Q_i;
+      psi_i = mQ_i.Phi() / 2;
+      if(psi_i < 0.) { psi_i += TMath::Pi() ; } 
+     } 
+     else 
+     {
+      Q_i.Set(phiWgt * cos(phi * order), phiWgt * sin(phi * order));
+      TVector2 mQ_i = fQ[k][j] - Q_i;
+      psi_i = mQ_i.Phi() / order;
+      if(psi_i < 0.) { psi_i += 2*TMath::Pi()/order ; }
+     }
+    }
+          
+    // Remove autocorrelations of the second order 'particles' which are used for v1{EP1,EP2}.
+    if (fV1Ep1Ep2 == kTRUE && order == 1) 
+    {
+     AliFlowSelection usedForPsi2 = *fFlowSelect ;
+     usedForPsi2.SetHarmonic(1);
+     if(usedForPsi2.Select(fFlowTrack))  // particle was used for Psi2
+     {
+      Q_i.Set(phiWgt * cos(phi * 2), phiWgt * sin(phi * 2));
+      TVector2 mQ_i = fQ[k][1] - Q_i;
+      psi_2 = mQ_i.Phi() / 2;
+      if(psi_2 < 0.) { psi_2 += TMath::Pi() ; }
+     }
+     else                               // particle was not used for Psi2
+     { 
+      psi_2 = fPsi[k][1];
+     }
+    }
+   }
+   else
+   {
+    fHistFull[k].fHistFullHar[j].fHistYieldPtout->Fill(pt);
+    fHistFull[k].fHistFullHar[j].fHistEtaPtPhi3Dout->Fill(eta, pt, phi);
+    fHistFull[k].fHistFullHar[j].fHistYield2Dout->Fill(eta, pt);
+    fHistFull[k].fHistFullHar[j].fHistDcaGlobout->Fill(TMath::Abs(fFlowTrack->Dca()));
+   }
+
+   // Caculate v for all particles selected for correlation analysis
+   if(fFlowSelect->SelectPart(fFlowTrack)) 
+   {
+    corrMultN++;
+    
+    float v;
+    if (fV1Ep1Ep2 == kFALSE || order != 1) 
+    {
+     v = 100 * cos(order * (phi - psi_i)) ;
+    }
+    else // i.e. (fV1Ep1Ep2 == kTRUE && order == 1)
+    {
+     v = 100 * cos(phi + psi_i - 2*psi_2) ;
+    }
+    
+    float vFlip = v;
+    if(eta < 0 && oddHar) { vFlip *= -1 ; }
+    if(strlen(fFlowSelect->PidPart()) != 0) // pid, fill rapidity 
+    {
+     float rapidity = fFlowTrack->Y();
+     fHistFull[k].fHistFullHar[j].fHistvObs2D->Fill(rapidity, pt, v);
+   
+     if(fPtRangevEta[1] > fPtRangevEta[0])  // cut is used
+     {
+      if(pt < fPtRangevEta[1] && pt >= fPtRangevEta[0]) // check cut range, fill if in range
+      {
+       fHistFull[k].fHistFullHar[j].fHistvObsEta->Fill(rapidity, v);
+      }
+     }
+     else // cut is not used, fill in any case
+     { 
+      fHistFull[k].fHistFullHar[j].fHistvObsEta->Fill(rapidity, v);
+     }
+    } 
+    else  // no pid, fill eta
+    {
+     fHistFull[k].fHistFullHar[j].fHistvObs2D->Fill(eta, pt, v);
+
+     if(fPtRangevEta[1] > fPtRangevEta[0]) // cut is used
+     {
+      if(pt < fPtRangevEta[1] && pt >= fPtRangevEta[0]) // check cut range, fill if in range
+      {
+       fHistFull[k].fHistFullHar[j].fHistvObsEta->Fill(eta, v);
+      }
+     }
+     else // cut is not used, fill in any case
+     { 
+      fHistFull[k].fHistFullHar[j].fHistvObsEta->Fill(eta, v);
+     }
+    }
+
+    if(fEtaRangevPt[1] > fEtaRangevPt[0]) // cut is used
+    { 
+     if(TMath::Abs(eta) < fEtaRangevPt[1] && TMath::Abs(eta) >= fEtaRangevPt[0]) // check cut range, fill if in range
+     {
+      fHistFull[k].fHistFullHar[j].fHistvObsPt->Fill(pt, vFlip);  // for odd harmonis /-/
+     }
+    }
+    else  // cut is not used, fill in any case
+    {
+     fHistFull[k].fHistFullHar[j].fHistvObsPt->Fill(pt, vFlip);
+    }
+
+    // v_
+    Bool_t etaPtNoCut = kTRUE;
+    if(fPtRangevEta[1] > fPtRangevEta[0] && (pt < fPtRangevEta[0] || pt >= fPtRangevEta[1])) 
+    {
+     etaPtNoCut = kFALSE;
+    }
+    if(fEtaRangevPt[1] > fEtaRangevPt[0] && (TMath::Abs(eta) < fEtaRangevPt[0] || TMath::Abs(eta) >= fEtaRangevPt[1]))
+    {
+     etaPtNoCut = kFALSE;
+    }
+    if(etaPtNoCut) { fHistFull[k].fHistvObs->Fill(order, vFlip) ; }
+    // Correlation of Phi of selected particles with Psi
+    float phi_i = phi;
+    if(eta < 0 && oddHar) 
+    {
+     phi_i += TMath::Pi() ; // backward particle and odd harmonic
+     if(phi_i > 2*TMath::Pi()) { phi_i -= 2*TMath::Pi() ; }
+    }
+    float dPhi = phi_i - psi_i;
+    if(dPhi < 0.)             { dPhi += 2*TMath::Pi() ; }
+    fHistFull[k].fHistFullHar[j].fHistPhiCorr->Fill(fmod((double)dPhi, 2*TMath::Pi() / order));
+   }
+  }
+ }
+ return corrMultN ;
+}
+//-----------------------------------------------------------------------
+void AliFlowAnalyser::FillV0Histograms(TObjArray* fFlowV0s)
+{
+ // v0s histograms
+
+ cout << " V0s Loop . " << endl ;
+
+ int corrMultV0 = 0 ;
+ for(fV0Number=0;fV0Number<fNumberOfV0s;fV0Number++) 
+ {
+  fFlowV0 = (AliFlowV0*)fFlowV0s->At(fV0Number) ;          
+
+  float mass = fFlowV0->Mass() ;                   
+  float eta = fFlowV0->Eta() ;                     
+  float rapidity = fFlowV0->Y() ;                  
+  float phi = fFlowV0->Phi() ;                     
+  float pt = fFlowV0->Pt() ;                       
+  float totalp = fFlowV0->P() ;                    
+  //int        charge = fFlowV0->Charge() ;                
+  float dca = fFlowV0->Dca() ;                     
+  float lenght = fFlowV0->V0Lenght() ;             
+  float sigma = fFlowV0->Sigma() ;                 
+  float chi2 = fFlowV0->Chi2() ;       
+  Char_t pid[10] ; strcpy(pid, fFlowV0->Pid()) ;    
+  int labelPlus =  -1 ; 
+  int labelMinus = -1 ;            
+  AliFlowTrack* daughterPlus = fFlowV0->DaughterP() ;  
+  AliFlowTrack* daughterMinus = fFlowV0->DaughterN() ; 
+  if(daughterPlus)  { labelPlus = daughterPlus->Label() ; }                
+  if(daughterMinus) { labelMinus = daughterMinus->Label() ; }                      
+
+  fHistV0Mass->Fill(mass) ;
+  fHistV0EtaPtPhi3D->Fill(eta, pt, phi) ;
+  fHistV0YieldAll2D->Fill(eta, pt) ;
+  fHistV0Dca->Fill(dca);
+  fHistV0Chi2->Fill(chi2);
+  fHistV0Lenght->Fill(lenght);
+  fHistV0Sigma->Fill(sigma);
+  fHistV0MassPtSlices->Fill(mass,pt);
+  fHistV0PYall2D->Fill(rapidity, totalp) ;
+
+  if(fFlowSelect->SelectPart(fFlowV0))
+  {
+   bool inWin = fFlowSelect->SelectV0Part(fFlowV0) ;
+   bool sx = fFlowSelect->SelectV0sxSide(fFlowV0) ;
+   bool dx = fFlowSelect->SelectV0dxSide(fFlowV0) ;
+   corrMultV0++ ;
+
+   fHistV0YieldPart2D->Fill(eta, pt) ;
+   if(inWin) 
+   { 
+    fHistV0EtaPtPhi3DPart->Fill(eta, pt, phi) ;
+    fHistV0LenghtPart->Fill(lenght);
+    fHistV0DcaPart->Fill(dca);
+    fHistV0MassWin->Fill(mass) ; 
+    fHistV0BinEta->Fill(eta, eta);
+    fHistV0BinPt->Fill(pt, pt);   
+   }
+   else      
+   { 
+    fHistV0sbEtaPtPhi3DPart->Fill(eta, pt, phi) ;
+    fHistV0sbLenghtPart->Fill(lenght);
+    fHistV0sbDcaPart->Fill(dca);
+    fHistV0sbMassSide->Fill(mass) ; 
+    fHistV0sbBinEta->Fill(eta, eta);
+    fHistV0sbBinPt->Fill(pt, pt);
+   }
+
+   for(int k = 0; k < Flow::nSels; k++)  // sort of HarmonicsLoop - selection number used
+   {
+    fFlowSelect->SetSelection(k) ;
+    for(Int_t j=0;j<Flow::nHars;j++) 
+    {
+     Bool_t oddHar = (j+1) % 2 ;
+     Float_t order = (Float_t)(j+1) ;
+     fFlowSelect->SetHarmonic(j);      
+
+     // Remove autocorrelations
+     Float_t psi_i, psi_2 ;
+     TVector2 Q_1, Q_2 ;
+     Float_t phiDaughter1 = 0. ; Float_t phiDaughter2 = 0. ;
+     Double_t phiWgt1 = 0. ; Double_t phiWgt2 = 0. ;
+     // -
+     if(daughterPlus)
+     { // 1
+      fFlowTrack = daughterPlus ;
+      phiDaughter1 = fFlowTrack->Phi() ;                 
+      if(fFlowSelect->Select(fFlowTrack)) // Get phiWgt from file
+      {
+       if(order > 3. && !oddHar) { phiWgt1 = fFlowEvent->PhiWeight(k, 1, fFlowTrack) ; } 
+       else                     { phiWgt1 = fFlowEvent->PhiWeight(k, j, fFlowTrack) ; }
+      }
+     }
+     if(daughterMinus)
+     { // 2
+      fFlowTrack = daughterMinus ;
+      phiDaughter2 = fFlowTrack->Phi() ;
+      if(fFlowSelect->Select(fFlowTrack)) // Get phiWgt from file
+      {
+       if(order > 3. && !oddHar) { phiWgt2 = fFlowEvent->PhiWeight(k, 1, fFlowTrack) ; } 
+       else                     { phiWgt2 = fFlowEvent->PhiWeight(k, j, fFlowTrack) ; }
+      } 
+     }
+
+     // psi_2
+     Q_1.Set(phiWgt1 * cos(phiDaughter1 * 2), phiWgt1 * sin(phiDaughter1 * 2));
+     Q_2.Set(phiWgt2 * cos(phiDaughter2 * 2), phiWgt2 * sin(phiDaughter2 * 2));
+     TVector2 mQ_i = fQ[k][1] ; mQ_i -= Q_1 ; mQ_i -= Q_2 ; 
+     psi_2 = mQ_i.Phi() / 2 ;    
+     if(psi_2 < 0.)         { psi_2 += TMath::Pi() ; }
+     if(psi_2 > TMath::Pi()) { psi_2 -= TMath::Pi() ; } 
+
+     // psi_i
+     if(order > 3. && !oddHar) { psi_i = psi_2 ; } 
+     else 
+     {
+      Q_1.Set(phiWgt1 * cos(phiDaughter1 * order), phiWgt1 * sin(phiDaughter1 * order));
+      Q_2.Set(phiWgt2 * cos(phiDaughter2 * order), phiWgt2 * sin(phiDaughter2 * order));
+      TVector2 mQ_i = fQ[k][j] ; mQ_i -= Q_1 ; mQ_i -= Q_2 ;
+      psi_i = mQ_i.Phi()/order ; 
+      if(psi_i < 0.)                 { psi_i += 2*TMath::Pi()/order ; }        
+      if(psi_i > 2*TMath::Pi()/order) { psi_i -= 2*TMath::Pi()/order ; } 
+     }
+
+    // Caculate v for all V0s selected for correlation analysis
+     float v ;
+     if(fV1Ep1Ep2 == kFALSE || order != 1) { v = 100 * cos(order * (phi - psi_i)) ; }
+     else { v = 100 * cos(phi + psi_i - 2*psi_2) ; }
+     float vFlip = v ; if(eta < 0 && oddHar) { vFlip *= -1 ; }
+
+     // invariant mass windows & sidebands
+     if(inWin) { fHistFull[k].fHistFullHar[j].fHistV0vObs2D->Fill(eta, pt, v) ; }
+     else      { fHistFull[k].fHistFullHar[j].fHistV0sbvObs2D->Fill(eta, pt, v) ; }
+
+     if(fPtRangevEta[1] > fPtRangevEta[0]) // cut is used
+     {
+      if(pt < fPtRangevEta[1] && pt >= fPtRangevEta[0]) // check cut range, fill if in range
+      {
+       if(inWin) { fHistFull[k].fHistFullHar[j].fHistV0vObsEta->Fill(eta, v) ; }
+       else      
+       { 
+        fHistFull[k].fHistFullHar[j].fHistV0sbvObsEta->Fill(eta, v) ; 
+       if(sx)      { fHistFull[k].fHistFullHar[j].fHistV0sbvObsEtaSx->Fill(eta, v) ; } 
+       else if(dx) { fHistFull[k].fHistFullHar[j].fHistV0sbvObsEtaDx->Fill(eta, v) ; } 
+       }
+      }
+     }
+     else // cut is not used, fill in any case
+     { 
+      if(inWin) { fHistFull[k].fHistFullHar[j].fHistV0vObsEta->Fill(eta, v) ; }
+      else     
+      { 
+       fHistFull[k].fHistFullHar[j].fHistV0sbvObsEta->Fill(eta, v) ; 
+       if(sx)     { fHistFull[k].fHistFullHar[j].fHistV0sbvObsEtaSx->Fill(eta, v) ; } 
+       else if(dx) { fHistFull[k].fHistFullHar[j].fHistV0sbvObsEtaDx->Fill(eta, v) ; } 
+      }
+     } 
+     if(fEtaRangevPt[1] > fEtaRangevPt[0]) // cut is used
+     {
+      if(TMath::Abs(eta) < fEtaRangevPt[1] && TMath::Abs(eta) >= fEtaRangevPt[0]) // check cut range, fill if in range
+      {          
+       if(inWin) { fHistFull[k].fHistFullHar[j].fHistV0vObsPt->Fill(pt, vFlip) ; }      // for odd harmonis /-/
+       else      
+       { 
+        fHistFull[k].fHistFullHar[j].fHistV0sbvObsPt->Fill(pt, vFlip) ; 
+        if(sx)     { fHistFull[k].fHistFullHar[j].fHistV0sbvObsPtSx->Fill(eta, v) ; } 
+        else if(dx) { fHistFull[k].fHistFullHar[j].fHistV0sbvObsPtDx->Fill(eta, v) ; }         
+       }
+      }
+     }
+     else  // cut is not used, fill in any case
+     {
+      if(inWin) { fHistFull[k].fHistFullHar[j].fHistV0vObsPt->Fill(pt, vFlip) ; } 
+      else     
+      { 
+       fHistFull[k].fHistFullHar[j].fHistV0sbvObsPt->Fill(pt, vFlip) ; 
+       if(sx)     { fHistFull[k].fHistFullHar[j].fHistV0sbvObsPtSx->Fill(eta, v) ; } 
+       else if(dx) { fHistFull[k].fHistFullHar[j].fHistV0sbvObsPtDx->Fill(eta, v) ; }  
+      }
+     }
+     // v_
+     Bool_t etaPtNoCut = kTRUE;
+     if(fPtRangevEta[1] > fPtRangevEta[0] && (pt < fPtRangevEta[0] || pt >= fPtRangevEta[1])) 
+     {
+      etaPtNoCut = kFALSE;
+     }
+     if(fEtaRangevPt[1] > fEtaRangevPt[0] && (TMath::Abs(eta) < fEtaRangevPt[0] || TMath::Abs(eta) >= fEtaRangevPt[1]))
+     {
+      etaPtNoCut = kFALSE;
+     }
+     if(etaPtNoCut) 
+     { 
+      if(inWin) { fHistFull[k].fHistV0vObs->Fill(order, vFlip) ; }
+      else     
+      { 
+       if(sx)     { fHistFull[k].fHistV0sbvObsSx->Fill(order, vFlip) ; } 
+       else if(dx) { fHistFull[k].fHistV0sbvObsDx->Fill(order, vFlip) ; }  
+      }
+     }
+   
+     // Correlation of Phi of selected v0s with Psi
+     float phi_i = phi;
+     if(eta < 0 && oddHar)
+     {
+      phi_i += TMath::Pi() ; // backward particle and odd harmonic
+      if(phi_i > 2*TMath::Pi()) { phi_i -= 2*TMath::Pi() ; }
+     }
+     float dPhi = phi_i - psi_i;
+     if(dPhi < 0.)  { dPhi += 2*TMath::Pi() ; }
+
+     if(inWin) { fHistFull[k].fHistFullHar[j].fHistV0PhiCorr->Fill(fmod((double)dPhi, 2*TMath::Pi() / order)) ; } 
+     else      { fHistFull[k].fHistFullHar[j].fHistV0sbPhiCorr->Fill(fmod((double)dPhi, 2*TMath::Pi() / order)) ; }
+    }
+   }
+  }
+  //delete fFlowV0 ; fFlowV0 = 0 ;
+  //delete daughterPlus ; daughterPlus = 0 ;  
+  //delete daughterMinus ; daughterMinus = 0 ;  
+ }
+ fHistV0MultPart->Fill(corrMultV0) ;
+
+ return ;
+}
+//-----------------------------------------------------------------------
+// void AliFlowAnalyser::FillLabels()  
+// {
+//  // Reads the tracks label (i.e. the link from ESD tracking to KineTree)
+//  // and ...
+//  
+//  cout << " Fill Labels . " << endl ;  
+// 
+//  return ;
+// }
+//-----------------------------------------------------------------------
+void AliFlowAnalyser::PrintEventQuantities()
+{
+ // prints event by event calculated quantities
+
+ cout << endl ; cout << " # " << fEventNumber << " - Event quantities : " << endl ; cout << endl ; 
+ cout << "fQ[k][j] = " ; 
+ for(int k=0;k<Flow::nSels;k++) 
+ {
+  for(int j=0;j<Flow::nHars;j++) 
+  { 
+   cout << (Float_t)fQ[k][j].X() << "," << (Float_t)fQ[k][j].Y() << " ; " ; 
+  }
+  cout << endl ;
+  cout << "           " ; 
+ }
+ cout << endl ; cout << "fPsi[k][j] = " ; 
+ for(int k=0;k<Flow::nSels;k++) 
+ {
+  for(int j=0;j<Flow::nHars;j++) { Float_t aaa = (Float_t)fPsi[k][j] ; cout << aaa << " , " ; }
+  cout << endl ;
+  cout << "             " ; 
+ }
+ cout << endl ; cout << "fQnorm[k][j] = " ; 
+ for(int k=0;k<Flow::nSels;k++) 
+ {
+  for(int j=0;j<Flow::nHars;j++) { Float_t aaa = (Float_t)fQnorm[k][j] ; cout << aaa << " , " ; }
+  cout << endl ;
+  cout << "            " ; 
+ }
+ cout << endl ; cout << "fMult[k][j] = " ; 
+ for(int k=0;k<Flow::nSels;k++) 
+ {
+  for(int j=0;j<Flow::nHars;j++) { Float_t aaa = (Float_t)fMult[k][j] ; cout << aaa << " , " ; } 
+  cout << endl ;
+  cout << "              " ; 
+ }
+ cout << endl ; cout << "fMultSub[n][k][j] = " ; 
+ for(int n=0;n<Flow::nSubs;n++) 
+ {
+  for(int k=0;k<Flow::nSels;k++) 
+  {
+   for(int j=0;j<Flow::nHars;j++) { Float_t aaa = fMultSub[n][k][j] ; cout << aaa << " , " ; } 
+   cout << endl ;
+   cout << "                " ; 
+  }
+ }
+ cout << endl ; cout << "fPsiSub[n][k][j] = " ; 
+ for(int n=0;n<Flow::nSubs;n++) 
+ {
+  for(int k=0;k<Flow::nSels;k++) 
+  {
+   for(int j=0;j<Flow::nHars;j++) { Float_t aaa = fPsiSub[n][k][j] ; cout << aaa << " , " ; } 
+   cout << endl ;
+   cout << "                " ; 
+  }
+ }
+ cout << endl ; cout << "Delta_PsiSub[k][j] = " ; 
+ for(int k=0;k<Flow::nSels;k++) 
+ {
+  for(int j=0;j<Flow::nHars;j++) { Float_t aaa = fPsiSub[0][k][j]-fPsiSub[1][k][j] ; cout << aaa << " , " ; } 
+  cout << endl ;
+  cout << "            " ; 
+ }
+ cout << endl ;
+}
+//----------------------------------------------------------------------
+// ###
+//----------------------------------------------------------------------
+Bool_t AliFlowAnalyser::Resolution()
+{
+ // Calculates the resolution from cos(dPsi) and corrects the observed flow.
+ // New histograms are then created and filled with the corrected vn 
+ // (see fVnResHistList), and saved in the otput file.
+ cout << " AliFlowAnalyser::Resolution()" << endl ;
+ // VnRes histogram collection
+ fVnResHistList = new TOrdCollection(Flow::nSels*Flow::nHars);
+ // Calculate resolution from sqrt(fHistCos)
+ double cosPair[Flow::nSels][Flow::nHars];
+ double cosPairErr[Flow::nSels][Flow::nHars];
+ double content, contentV0;
+ double error, errorV0;
+ double totalError;
+ TString* histTitle;
+
+ for(int k = 0; k < Flow::nSels; k++)
+ {
+  // v for tracks (corrected for resolution)
+  histTitle = new TString("Flow_v_Sel");
+  *histTitle += k+1;
+  fHistFull[k].fHistv = fHistFull[k].fHistvObs->ProjectionX(histTitle->Data());
+  fHistFull[k].fHistv->SetTitle(histTitle->Data());
+  fHistFull[k].fHistv->SetXTitle("Harmonic");
+  fHistFull[k].fHistv->SetYTitle("v (%)");
+  delete histTitle;
+  fVnResHistList->AddLast(fHistFull[k].fHistv);
+   
+  // v for v0s (corrected for resolution)
+  histTitle = new TString("FlowV0_v_Sel");
+  *histTitle += k+1;
+  fHistFull[k].fHistV0v = fHistFull[k].fHistV0vObs->ProjectionX(histTitle->Data());
+  fHistFull[k].fHistV0v->SetTitle(histTitle->Data());
+  fHistFull[k].fHistV0v->SetXTitle("Harmonic");
+  fHistFull[k].fHistV0v->SetYTitle("v (%)");
+  delete histTitle;
+  fVnResHistList->AddLast(fHistFull[k].fHistV0v);
+   
+  for(int j = 0; j < Flow::nHars; j++) 
+  {
+   double order = (double)(j+1);
+   cosPair[k][j]    = fHistFull[k].fHistCos->GetBinContent(j+1);
+   cosPairErr[k][j] = fHistFull[k].fHistCos->GetBinError(j+1);
+   if(cosPair[k][j] > 0.) 
+   {
+    double resSub = 0. ;
+    double resSubErr = 0. ;
+    if(fV1Ep1Ep2 == kTRUE && order == 1) // calculate resolution of second order event plane first
+    {
+     double res2 = 0. ;
+     double res2error = 0. ;
+     if(fHistFull[k].fHistCos->GetBinContent(2) > 0.) 
+     {
+      if(fEtaSub)  // sub res only
+      {
+       res2 = TMath::Sqrt(fHistFull[k].fHistCos->GetBinContent(2));
+       res2error = fHistFull[k].fHistCos->GetBinError(2) / (2. * res2);
+      }
+      else 
+      {
+       if (fHistFull[k].fHistCos->GetBinContent(2) > 0.92)  // resolution saturates
+       {
+        res2 = 0.99;
+        res2error = 0.007;
+       } 
+       else 
+       {
+        double deltaRes2Sub = 0.005;  // differential for the error propagation
+        double res2Sub = TMath::Sqrt(fHistFull[k].fHistCos->GetBinContent(2));
+        double res2SubErr = fHistFull[k].fHistCos->GetBinError(2) / (2. * res2Sub);
+        double chiSub2 = Chi(res2Sub);
+        double chiSub2Delta = Chi(res2Sub + deltaRes2Sub);
+        res2 = ResEventPlane(TMath::Sqrt(2.) * chiSub2); // full event plane res.
+        double mRes2Delta = ResEventPlane(TMath::Sqrt(2.) * chiSub2Delta);
+        res2error = res2SubErr * fabs((double)res2 - mRes2Delta) / deltaRes2Sub;
+       }
+      }
+     }
+     else 
+     {
+      res2 = 0.;
+      res2error = 0.;
+     }
+     // now put everything together with first order event plane
+     fRes[k][j]    = TMath::Sqrt(cosPair[k][0]*res2);
+     fResErr[k][j] = 1./(2.*fRes[k][j]) * TMath::Sqrt(cosPairErr[k][0]*cosPairErr[k][0] + res2error*res2error); // Gaussian error propagation
+    }
+    else if(fEtaSub)  // sub res only
+    {
+     resSub = TMath::Sqrt(cosPair[k][j]);                
+     resSubErr = cosPairErr[k][j] / (2. * resSub);
+     fRes[k][j]    = resSub;
+     fResErr[k][j] = resSubErr;
+    } 
+    else if(order==4. || order==6.|| order==8.)  // 2nd harmonic event plane
+    {
+     double deltaResSub = 0.005;  // differential for the error propagation
+     double resSub = TMath::Sqrt(cosPair[k][1]);
+     double resSubErr = cosPairErr[k][1] / (2. * resSub);
+     double chiSub = Chi(resSub);
+     double chiSubDelta = Chi(resSub + deltaResSub);
+     double mResDelta;
+     if (order==4.) 
+     {
+      fRes[k][j] = ResEventPlaneK2(TMath::Sqrt(2.) * chiSub); // full event plane res.
+      mResDelta = ResEventPlaneK2(TMath::Sqrt(2.) * chiSubDelta);
+     } 
+     else if(order==6.) 
+     {
+      fRes[k][j] = ResEventPlaneK3(TMath::Sqrt(2.) * chiSub); // full event plane res.
+      mResDelta = ResEventPlaneK3(TMath::Sqrt(2.) * chiSubDelta);
+     } 
+     else 
+     {
+      fRes[k][j] = ResEventPlaneK4(TMath::Sqrt(2.) * chiSub); // full event plane res.
+      mResDelta = ResEventPlaneK4(TMath::Sqrt(2.) * chiSubDelta);
+     }
+     fResErr[k][j] = resSubErr * fabs((double)fRes[k][j] - mResDelta) / deltaResSub;
+    }
+    else 
+    {
+     if(cosPair[k][j] > 0.92) // resolution saturates
+     {
+      fRes[k][j]    = 0.99;
+      fResErr[k][j] = 0.007;
+     } 
+     else 
+     {
+      double deltaResSub = 0.005;  // differential for the error propagation
+      double resSub = TMath::Sqrt(cosPair[k][j]);
+      double resSubErr = cosPairErr[k][j] / (2. * resSub);
+      double chiSub = Chi(resSub);
+      double chiSubDelta = Chi(resSub + deltaResSub);
+      fRes[k][j] = ResEventPlane(TMath::Sqrt(2.) * chiSub); // full event plane res.
+      double mResDelta = ResEventPlane(TMath::Sqrt(2.) * chiSubDelta);
+      fResErr[k][j] = resSubErr * TMath::Abs((double)fRes[k][j] - mResDelta) / deltaResSub;
+     }
+    }
+   }
+   else  // subevent correlation must be positive
+   {
+    fRes[k][j]    = 0.;
+    fResErr[k][j] = 0.;
+   }
+   fHistFull[k].fHistRes->SetBinContent(j+1, fRes[k][j]);
+   fHistFull[k].fHistRes->SetBinError(j+1, fResErr[k][j]);
+
+   // Create the v 2D histogram (Flow corrected for res.) - v,Pt,Eta
+   histTitle = new TString("Flow_v2D_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistv2D = fHistFull[k].fHistFullHar[j].fHistvObs2D->ProjectionXY(histTitle->Data());
+   fHistFull[k].fHistFullHar[j].fHistv2D->SetTitle(histTitle->Data());
+   fHistFull[k].fHistFullHar[j].fHistv2D->SetXTitle((char*)fLabel.Data());
+   fHistFull[k].fHistFullHar[j].fHistv2D->SetYTitle("Pt (GeV/c)");
+   fHistFull[k].fHistFullHar[j].fHistv2D->SetZTitle("v (%)");
+   delete histTitle;
+   fVnResHistList->AddLast(fHistFull[k].fHistFullHar[j].fHistv2D);
+
+   // Create the 1D v histograms - v,Eta
+   histTitle = new TString("Flow_vEta_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistvEta = fHistFull[k].fHistFullHar[j].fHistvObsEta->ProjectionX(histTitle->Data());
+   fHistFull[k].fHistFullHar[j].fHistvEta->SetTitle(histTitle->Data());
+   fHistFull[k].fHistFullHar[j].fHistvEta->SetXTitle((char*)fLabel.Data());
+   fHistFull[k].fHistFullHar[j].fHistvEta->SetYTitle("v (%)");
+   delete histTitle;
+   fVnResHistList->AddLast(fHistFull[k].fHistFullHar[j].fHistvEta);
+   
+   // v,Pt
+   histTitle = new TString("Flow_vPt_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistvPt = fHistFull[k].fHistFullHar[j].fHistvObsPt->ProjectionX(histTitle->Data());
+   fHistFull[k].fHistFullHar[j].fHistvPt->SetTitle(histTitle->Data());
+   fHistFull[k].fHistFullHar[j].fHistvPt->SetXTitle("Pt (GeV/c)");
+   fHistFull[k].fHistFullHar[j].fHistvPt->SetYTitle("v (%)");
+   delete histTitle;
+   fVnResHistList->AddLast(fHistFull[k].fHistFullHar[j].fHistvPt);
+
+   // Create the v 2D histogram (V0s Flow corrected for res.) - v,Pt,Eta
+   histTitle = new TString("FlowV0_v2D_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistV0v2D = fHistFull[k].fHistFullHar[j].fHistV0vObs2D->ProjectionXY(histTitle->Data());
+   fHistFull[k].fHistFullHar[j].fHistV0v2D->SetTitle(histTitle->Data());
+   fHistFull[k].fHistFullHar[j].fHistV0v2D->SetXTitle((char*)fLabel.Data());
+   fHistFull[k].fHistFullHar[j].fHistV0v2D->SetYTitle("Pt (GeV/c)");
+   fHistFull[k].fHistFullHar[j].fHistV0v2D->SetZTitle("v (%)");
+   delete histTitle;
+   fVnResHistList->AddLast(fHistFull[k].fHistFullHar[j].fHistV0v2D);
+
+   // Create the 1D v histograms (V0s) - v,Eta
+   histTitle = new TString("FlowV0_vEta_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistV0vEta = fHistFull[k].fHistFullHar[j].fHistV0vObsEta->ProjectionX(histTitle->Data());
+   fHistFull[k].fHistFullHar[j].fHistV0vEta->SetTitle(histTitle->Data());
+   fHistFull[k].fHistFullHar[j].fHistV0vEta->SetXTitle((char*)fLabel.Data());
+   fHistFull[k].fHistFullHar[j].fHistV0vEta->SetYTitle("v (%)");
+   delete histTitle;
+   fVnResHistList->AddLast(fHistFull[k].fHistFullHar[j].fHistV0vEta);
+   
+   // (V0s) v,Pt
+   histTitle = new TString("FlowV0_vPt_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistV0vPt = fHistFull[k].fHistFullHar[j].fHistV0vObsPt->ProjectionX(histTitle->Data());
+   fHistFull[k].fHistFullHar[j].fHistV0vPt->SetTitle(histTitle->Data());
+   fHistFull[k].fHistFullHar[j].fHistV0vPt->SetXTitle("Pt (GeV/c)");
+   fHistFull[k].fHistFullHar[j].fHistV0vPt->SetYTitle("v (%)");
+   delete histTitle;
+   fVnResHistList->AddLast(fHistFull[k].fHistFullHar[j].fHistV0vPt);
+
+   // Create the v 2D histogram (V0s sidebands Flow corrected for res.) - v,Pt,Eta
+   histTitle = new TString("FlowV0sb_v2D_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistV0sbv2D = fHistFull[k].fHistFullHar[j].fHistV0sbvObs2D->ProjectionXY(histTitle->Data());
+   fHistFull[k].fHistFullHar[j].fHistV0sbv2D->SetTitle(histTitle->Data());
+   fHistFull[k].fHistFullHar[j].fHistV0sbv2D->SetXTitle((char*)fLabel.Data());
+   fHistFull[k].fHistFullHar[j].fHistV0sbv2D->SetYTitle("Pt (GeV/c)");
+   fHistFull[k].fHistFullHar[j].fHistV0sbv2D->SetZTitle("v (%)");
+   delete histTitle;
+   fVnResHistList->AddLast(fHistFull[k].fHistFullHar[j].fHistV0sbv2D);
+
+   // Create the 1D v histograms (V0s sidebands) - v,Eta
+   histTitle = new TString("FlowV0sb_vEta_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistV0sbvEta = fHistFull[k].fHistFullHar[j].fHistV0sbvObsEta->ProjectionX(histTitle->Data());
+   fHistFull[k].fHistFullHar[j].fHistV0sbvEta->SetTitle(histTitle->Data());
+   fHistFull[k].fHistFullHar[j].fHistV0sbvEta->SetXTitle((char*)fLabel.Data());
+   fHistFull[k].fHistFullHar[j].fHistV0sbvEta->SetYTitle("v (%)");
+   delete histTitle;
+   fVnResHistList->AddLast(fHistFull[k].fHistFullHar[j].fHistV0sbvEta);
+   
+   // (V0s sidebands) v,Pt
+   histTitle = new TString("FlowV0sb_vPt_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistV0sbvPt = fHistFull[k].fHistFullHar[j].fHistV0sbvObsPt->ProjectionX(histTitle->Data());
+   fHistFull[k].fHistFullHar[j].fHistV0sbvPt->SetTitle(histTitle->Data());
+   fHistFull[k].fHistFullHar[j].fHistV0sbvPt->SetXTitle("Pt (GeV/c)");
+   fHistFull[k].fHistFullHar[j].fHistV0sbvPt->SetYTitle("v (%)");
+   delete histTitle;
+   fVnResHistList->AddLast(fHistFull[k].fHistFullHar[j].fHistV0sbvPt);
+
+  // Calulate v = vObs / Resolution
+   if(fRes[k][j]) 
+   {
+    cout << "***** Resolution of the " << j+1 << "th harmonic = " << fRes[k][j] << " +/- " << fResErr[k][j] << endl;
+    // selected tracks
+    fHistFull[k].fHistFullHar[j].fHistv2D->Scale(1. / fRes[k][j]);
+    fHistFull[k].fHistFullHar[j].fHistvEta->Scale(1. / fRes[k][j]);
+    fHistFull[k].fHistFullHar[j].fHistvPt->Scale(1. / fRes[k][j]);
+    content = fHistFull[k].fHistv->GetBinContent(j+1);        
+    content /=  fRes[k][j]; 
+    fHistFull[k].fHistv->SetBinContent(j+1, content);            
+    // selected V0s    
+    fHistFull[k].fHistFullHar[j].fHistV0v2D->Scale(1. / fRes[k][j]);
+    fHistFull[k].fHistFullHar[j].fHistV0vEta->Scale(1. / fRes[k][j]);
+    fHistFull[k].fHistFullHar[j].fHistV0vPt->Scale(1. / fRes[k][j]);
+    contentV0 = fHistFull[k].fHistV0v->GetBinContent(j+1);        
+    contentV0 /=  fRes[k][j];
+    fHistFull[k].fHistV0v->SetBinContent(j+1, contentV0);            
+    // V0s sidebands    
+    fHistFull[k].fHistFullHar[j].fHistV0sbv2D->Scale(1. / fRes[k][j]);
+    fHistFull[k].fHistFullHar[j].fHistV0sbvEta->Scale(1. / fRes[k][j]);
+    fHistFull[k].fHistFullHar[j].fHistV0sbvPt->Scale(1. / fRes[k][j]);
+    // The systematic error of the resolution is folded in.
+    // tracks
+    error = fHistFull[k].fHistv->GetBinError(j+1) ; 
+    error /= fRes[k][j];                                         
+    totalError = fabs(content) * TMath::Sqrt((error/content)*(error/content) + (fResErr[k][j]/fRes[k][j])*(fResErr[k][j]/fRes[k][j]));
+    fHistFull[k].fHistv->SetBinError(j+1, totalError);
+    cout << "***** v" << j+1 << "= (" << content << " +/- " << error << " +/- " << totalError << "(with syst.)) %" << endl;
+    // V0s
+    errorV0 = fHistFull[k].fHistV0v->GetBinError(j+1) ; 
+    errorV0 /= fRes[k][j]; 
+    if (contentV0>0)
+      totalError = fabs(contentV0) * TMath::Sqrt((errorV0/contentV0)*(errorV0/contentV0) + (fResErr[k][j]/fRes[k][j])*(fResErr[k][j]/fRes[k][j]));
+    else
+      totalError = 0;
+    fHistFull[k].fHistV0v->SetBinError(j+1, totalError);
+   } 
+   else 
+   {
+    cout << "##### Resolution of the " << j+1 << "th harmonic was zero." << endl;
+    // tracks hist
+    fHistFull[k].fHistFullHar[j].fHistv2D->Reset();
+    fHistFull[k].fHistFullHar[j].fHistvEta->Reset();
+    fHistFull[k].fHistFullHar[j].fHistvPt->Reset();
+    fHistFull[k].fHistv->SetBinContent(j+1, 0.);
+    fHistFull[k].fHistv->SetBinError(j+1, 0.);
+    // v0s hist
+    fHistFull[k].fHistFullHar[j].fHistV0v2D->Reset();
+    fHistFull[k].fHistFullHar[j].fHistV0vEta->Reset();
+    fHistFull[k].fHistFullHar[j].fHistV0vPt->Reset();
+    fHistFull[k].fHistFullHar[j].fHistV0sbv2D->Reset();
+    fHistFull[k].fHistFullHar[j].fHistV0sbvEta->Reset();
+    fHistFull[k].fHistFullHar[j].fHistV0sbvPt->Reset();
+    fHistFull[k].fHistV0v->SetBinContent(j+1, 0.);
+    fHistFull[k].fHistV0v->SetBinError(j+1, 0.);
+   }
+  }
+ }
+
+ return kTRUE ;
+}
+//-----------------------------------------------------------------------
+Double_t AliFlowAnalyser::Chi(Double_t res)
+{          
+ // chi from the event plane resolution
+
+ Double_t chi   = 2.0;
+ Double_t delta = 1.0;
+ for(int i = 0; i < 15; i++) 
+ {
+  if(ResEventPlane(chi) < res) { chi = chi + delta ; }
+  else                         { chi = chi - delta ; }
+  delta = delta / 2.;
+ }
+
+ return chi ;
+}
+//-----------------------------------------------------------------------
+Double_t AliFlowAnalyser::ResEventPlane(Double_t chi)    
+{
+ // plane resolution as function of chi
+
+ Double_t con = TMath::Sqrt(TMath::Pi()/2)/2 ;   // ~ 0.626657
+ Double_t arg = chi * chi / 4.;
+ Double_t res = con * chi * exp(-arg) * (TMath::BesselI0(arg) + TMath::BesselI1(arg)); 
+
+ return res ;
+}
+//-----------------------------------------------------------------------
+Double_t AliFlowAnalyser::ResEventPlaneK2(Double_t chi)  
+{
+ // ... for the case k=2.
+
+ Double_t con = TMath::Sqrt(TMath::Pi()/2)/2 ;   // ~ 0.626657
+ Double_t arg = chi * chi / 4.;
+
+ Double_t besselOneHalf = TMath::Sqrt(arg/(TMath::Pi()/2)) * sinh(arg)/arg;
+ Double_t besselThreeHalfs = TMath::Sqrt(arg/(TMath::Pi()/2)) * (cosh(arg)/arg - sinh(arg)/(arg*arg));
+ Double_t res = con * chi * exp(-arg) * (besselOneHalf + besselThreeHalfs); 
+
+ return res ;
+}
+//-----------------------------------------------------------------------
+Double_t AliFlowAnalyser::ResEventPlaneK3(Double_t chi) 
+{
+ // ...for the case k=3.
+
+ Double_t con = TMath::Sqrt(TMath::Pi()/2)/2 ;   // ~ 0.626657
+ Double_t arg = chi * chi / 4.;
+ Double_t res = con * chi * exp(-arg) * (TMath::BesselI1(arg) + TMath::BesselI(2, arg)); 
+
+ return res ;
+}
+//-----------------------------------------------------------------------
+Double_t AliFlowAnalyser::ResEventPlaneK4(Double_t chi) 
+{
+ // ...for the case k=4.
+
+ Double_t con = TMath::Sqrt(TMath::Pi()/2)/2 ;   // ~ 0.626657
+ Double_t arg = chi * chi / 4.;
+
+ Double_t besselOneHalf = TMath::Sqrt(arg/(TMath::Pi()/2)) * sinh(arg)/arg;
+ Double_t besselThreeHalfs = TMath::Sqrt(arg/(TMath::Pi()/2)) * (cosh(arg)/arg - sinh(arg)/(arg*arg));
+ Double_t besselFiveHalfs = besselOneHalf - 3*besselThreeHalfs/arg;
+ Double_t res = con * chi * exp(-arg) * (besselThreeHalfs + besselFiveHalfs); 
+
+ return res ;
+}
+//-------------------------------------------------------------
+// ###
+//-----------------------------------------------------------------------
+
+
+#endif
diff --git a/PWG2/FLOW/AliFlowAnalyser.h b/PWG2/FLOW/AliFlowAnalyser.h
new file mode 100644 (file)
index 0000000..4100fec
--- /dev/null
@@ -0,0 +1,521 @@
+//////////////////////////////////////////////////////////////////////
+//
+// $Id$
+//
+// Author: Emanuele Simili
+//
+//////////////////////////////////////////////////////////////////////
+//
+// Description: flow analysis for AliFlowEvent(s), adapted from STAR .
+// Original Authors:                 Raimond Snellings & Art Poskanzer
+//
+//////////////////////////////////////////////////////////////////////
+
+#ifndef ALIFLOWANALYSER_H
+#define ALIFLOWANALYSER_H
+
+#include <TVector2.h>
+#include <TFile.h>
+#include "AliFlowConstants.h"
+
+class TH1F;
+class TH1D;
+class TH2F;
+class TH2D;
+class TH3F;
+class TProfile;
+class TProfile2D;
+class TOrdCollection;
+
+class AliFlowTrack;
+class AliFlowV0;
+class AliFlowEvent;
+class AliFlowSelection;
+class Flow;
+
+class AliFlowAnalyser {
+
+
+public:
+  
+  AliFlowAnalyser(const AliFlowSelection* flowSelect = 0);     // Constructor with selection object (default selection if no one given)
+  virtual  ~AliFlowAnalyser();                                         // Default destructor (no actions)
+
+ // Steps of the flow analysis
+  Bool_t   Init() ;                                            // Books histograms for flow analysis
+  Bool_t   Finish() ;                                          // Saves histograms, Closes stuff
+
+ // Analysis of 1 event (can be called from outside)
+  Bool_t   Analyse(AliFlowEvent* flowEvent = 0) ;              // Fills the defaults histograms (init them first!) and performs the calculation for the given event         
+
+ // Resolution corrections to v_n (call it at the end of the evts loop)
+  Bool_t   Resolution() ;                                      // Calculates resolution and mean flow values
+ // Weights calculation and saving (call it at the end of the evts loop)
+  void     Weightening() ;                                     // Calculates weights and fills PhiWgt histograms
+
+ // Options
+  void    SetEtaSub(Bool_t es = kTRUE)                         { fEtaSub = es ; }              // Set eta subevents
+  void     SetV1Ep1Ep2(Bool_t v1Ep1Ep2 = kTRUE)                { fV1Ep1Ep2 = v1Ep1Ep2 ; }      // Switches the v_1{EP1,EP2} calculation on/off
+  void    SetShuffle(Bool_t sh = kTRUE)                        { fShuffle = sh ; }             // Set to re-shuffle evt tracks
+  void     SetUsePhiWgt(Bool_t pw = kTRUE)                     { fReadPhiWgt = pw ; }          // Set to use phi weights (true by default...if there)
+  void            SetUseBayWgt(Bool_t bw = kTRUE)                      { fBayWgt = bw ; }              // Set to use bayesian weights for p.id. (false by default)
+  void     SetUsePtWgt(Bool_t ptw = kTRUE)                     { fPtWgt = ptw ; }              // uses pT as a weight for RP determination
+  void     SetUseEtaWgt(Bool_t etw = kTRUE)                    { fEtaWgt = etw ; }             // uses eta as a weight for RP determination
+  void     SetUseOnePhiWgt(Bool_t opw = kTRUE)                 { fOnePhiWgt = opw ; }          // just one wgt histogram
+  void     SetUseFirstLastPhiWgt(Bool_t flw = kTRUE)           { fOnePhiWgt = !flw ; }         // uses 3 wgt histograms
+  void    SetFlowForV0(Bool_t v0 = kTRUE)                      { fV0loop = v0 ; }              // Enables Flow study for v0
+  void    SetTrackLoop(Bool_t trkl = kTRUE)                    { fTrackLoop = trkl ; }         // Enables Tracks loop (keep it kTRUE)
+  //void     SetDebugg(Int_t db = 1) ;                                 // set the cout's for debug (default is 1)
+
+ // Histograms
+  void     SetPtRangevEta(Float_t lo, Float_t hi)              { fPtRangevEta[0] = lo ; fPtRangevEta[1] = hi ; }  // Sets the pt range for the v(eta) histograms.
+  void     SetEtaRangevPt(Float_t lo, Float_t hi)              { fEtaRangevPt[0] = lo ; fEtaRangevPt[1] = hi ; }  // Sets the |eta| range for the v(pt) histograms.
+  //void     SetMaxLabel(Int_t lab = 100)                      { fMaxLabel = lab ; }
+  
+ // Output 
+  void    SetHistFileName(TString name)                        { fHistFileName = name ; }      // Sets output file name
+  TString  GetHistFileName() const                             { return fHistFileName ; }
+
+ // Phi Weights 
+  TString  GetWgtFileName() const                              { return (TString)fPhiWgtFile->GetName() ; }
+  void     FillWgtArrays(TFile* wgtFile) ;                     // Loads phi & bayesian weights from file (flowPhiWgt.hist.root) and fills the arrays
+
+ // Results
+  Float_t  GetRunBayesian(Int_t nPid=2, Int_t selN=0) ;        // Normalized Particle abundance (all events up to here)
+  void     PrintRunBayesian(Int_t selN=0) ;                    // Prints the normalized Particle abundance (up to here)
+  void     PrintEventQuantities() ;                            // Prints event by event calculated quantities
+  Float_t  Res(Int_t eventN, Int_t harN) const                         { return fRes[eventN][harN]; }    // Returns the calculated resolution for the RP
+  Float_t  ResErr(Int_t eventN, Int_t harN) const              { return fResErr[eventN][harN]; } // Returns the estimated error on the resolution 
+
+
+ protected:
+ // Internal methods to fill the histogram
+  Bool_t   FillFromFlowEvent(AliFlowEvent* fFlowEvent) ;       // Fills internal variables and array from Flow Events
+  void     FillEventHistograms(AliFlowEvent* fFlowEvent) ;     // Fills Events' histograms (from AliFlowEvent)
+  void     FillParticleHistograms(TObjArray* fFlowTracks) ;    // Fills Tracks' histograms (from AliFlowTrack)
+  void     FillV0Histograms(TObjArray* fFlowV0s) ;             // Fills V0s' histograms
+  Int_t    HarmonicsLoop(AliFlowTrack* fFlowTrack) ;           // Harmonics & Selections histograms (from AliFlowTracks)
+  //void     FillLabels() ;                                    // fills an histogram of Labels (the ones from ESD) 
+
+ // Weights plugged to the event
+  void     FillBayesianWgt(AliFlowEvent* fFlowEvent) ;                 // Plugs the bayesian weights (fBayesianWgt[0]*) into the AliFlowEvent
+  void            FillEvtPhiWgt(AliFlowEvent* fFlowEvent) ;            // Plugs the PhiWeights (fPhiWgt*, etc.) into the AliFlowEvent
+ // Resolution Calculation
+  Double_t Chi(Double_t res) ;                                 // Calculates chi from the event plane resolution
+  Double_t ResEventPlane(Double_t chi) ;                       // Calculates the event plane resolution as a function of chi
+  Double_t ResEventPlaneK2(Double_t chi) ;                     // Calculates the event plane resolution as a function of chi for the case k=2.
+  Double_t ResEventPlaneK3(Double_t chi) ;                     // Calculates the event plane resolution as a function of chi for the case k=3.
+  Double_t ResEventPlaneK4(Double_t chi) ;                     // Calculates the event plane resolution as a function of chi for the case k=4.
+
+
+ private:
+
+ // Flags
+  Bool_t          fTrackLoop ;                                 //! tracks main loop
+  Bool_t          fV0loop ;                                    //! correlation analysis is done also for neutral secundary vertex
+  Bool_t          fShuffle ;                                   //! to randomly reshuffle tracks
+  Bool_t          fV1Ep1Ep2;                                   //! Flag for v_1{EP1,EP2} calculation on/off
+  Bool_t          fEtaSub;                                     //! eta subevents
+  Bool_t          fReadPhiWgt ;                                //! Phi Weights are applied to Phi distrib. (default is false)
+  Bool_t          fBayWgt ;                                    //! Bayesian Weights are applied to P.Id. (default is false) 
+  Bool_t          fRePid ;                                     //! Re-Calculates the P.Id. basing on the bayesian wgts (if plugged in)
+
+  Bool_t          fPtWgt ;                                     //! flag to use pT as a weight for RP determination
+  Bool_t          fEtaWgt ;                                    //! flag to use eta as a weight for RP determination
+  Bool_t          fOnePhiWgt ;                                 //! if kTRUE: just one phi-wgt histogram, if kFALSE: three phi-wgt histogram (TPC+,TPC-,cross)
+
+ // Files
+  TFile*           fHistFile ;                                         //! histograms file (output)
+  TFile*          fPhiWgtFile ;                                //! phi weight file 
+  TString         fHistFileName ;                              //! Output File Name (histograms from flow analysis)
+  //TString       fFlowEvtFileName ;                           //! Input file name (Flow Events)
+
+ // enumerators                            
+  Int_t            fEventNumber ;                              //! progressive enumeration of AliFlowEvents
+  Int_t            fTrackNumber ;                              //! progressive enumeration of AliFlowTracks
+  Int_t            fV0Number ;                                 //! progressive enumeration of AliFlowV0s
+  //Int_t         fNumberOfEvents ;                            //! total number of AliFlowEvents in file
+  Int_t           fNumberOfTracks ;                            //! total number of tracks in the current event
+  Int_t           fNumberOfV0s ;                               //! total number of v0s in the current event
+  Int_t            fPidId ;                                    //! Particle Id hypothesys of the track (0..4 for e,mu,pi,k,p)
+
+ // Internal pointers
+  AliFlowEvent*     fFlowEvent ;                               //! pointer to AliFlowEvent
+  AliFlowTrack*     fFlowTrack ;                               //! pointer to AliFlowTrack
+  AliFlowV0*        fFlowV0 ;                                  //! pointer to AliFlowV0
+  AliFlowSelection* fFlowSelect ;                              //! selection object
+  TObjArray*        fFlowTracks ;                              //! pointer to the TrackCollection
+  TObjArray*        fFlowV0s ;                                 //! pointer to the V0Collection
+
+  Float_t           fVertex[3] ;                               //! Event's Vertex position 
+
+ // For weights
+  Int_t            fPhiBins ;                                  //! n. of phi bins     
+  Float_t          fPhiMin ;                                   //! wgt histo range (phi)
+  Float_t          fPhiMax ;                                   //! wgt histo range (phi) 
+
+  Flow::PhiWgt_t    fPhiWgt ;                                  //! PhiWgt Array (all TPC)
+  Flow::PhiWgt_t    fPhiWgtPlus ;                              //! PhiWgt Array (TPC+)
+  Flow::PhiWgt_t    fPhiWgtMinus ;                             //! PhiWgt Array (TPC-)
+  Flow::PhiWgt_t    fPhiWgtCross ;                             //! PhiWgt Array (TPC/)     
+
+ // For bayesian weights
+  Double_t         fBayesianWgt[Flow::nSels][Flow::nPid] ;     //! Bayesian weights (expected particle abundance)
+
+#ifndef __CINT__
+  TVector2 fQ[Flow::nSels][Flow::nHars];                       //! flow vector
+  Float_t  fPsi[Flow::nSels][Flow::nHars];                     //! event plane angle
+  UInt_t   fMult[Flow::nSels][Flow::nHars];                    //! multiplicity
+  Float_t  fQnorm[Flow::nSels][Flow::nHars];                    //! Q/Sqrt(Mult)
+  TVector2 fQSub[Flow::nSubs][Flow::nSels][Flow::nHars];       //! flow vector subs
+  Float_t  fPsiSub[Flow::nSubs][Flow::nSels][Flow::nHars];     //! plane angle of subevents
+  UInt_t   fMultSub[Flow::nSubs][Flow::nSels][Flow::nHars];    //! multiplicity subs
+  Float_t  fRes[Flow::nSels][Flow::nHars];                     //! event plane resolution
+  Float_t  fResErr[Flow::nSels][Flow::nHars];                  //! event plane resolution error
+#endif /*__CINT__*/
+
+ // for Histograms
+  TString           fLabel ;                                   //! label axis : rapidity or pseudorapidity
+  Float_t          fEtaMin ;                                   //! histo range (eta)
+  Float_t          fEtaMax ;                                   //! histo range (eta) 
+  Float_t          fPtMin ;                                    //! histo range (pt)       
+  Float_t          fPtMax ;                                    //! histo range (pt)       
+  Float_t          fPtMaxPart ;                                //! max pt for _part histo
+  Int_t            fEtaBins ;                                  //! n. of eta bins
+  Int_t            fPtBins ;                                   //! n. of pt bins     
+  Int_t            fPtBinsPart ;                               //! n. of pt bins for _part histo
+  Float_t          fPtRangevEta[2] ;                           //! pt range for the v(eta) histograms.
+  Float_t          fEtaRangevPt[2] ;                           //! |eta| range for the v(pt) histograms.
+  Int_t            fMaxLabel ;                                 //! for the MC labels histogram (max bin)
+
+  TOrdCollection*   fPhiWgtHistList ;                          //! Weights:  histogram list
+  TOrdCollection*   fVnResHistList ;                           //! Resolution and Vn:  histogram list
+// for Single histograms
+
+ // *****************
+ // EVENTs HISTOGRAMS
+ // *****************
+  TH1F*     fHistTrigger;                                 //!
+  TH1F*     fHistMult;                                    //!
+  TH1F*     fHistV0Mult;                                  //!
+  TH1F*     fHistOrigMult;                                //!
+  TH1F*     fHistMultOverOrig;                            //!
+  TH1F*     fHistMultEta;                                 //!
+  TH1F*     fHistCent;                                    //!
+  TH1F*     fHistVertexZ;                                 //!
+  TH2F*     fHistVertexXY2D;                              //!
+  TH2F*     fHistEnergyZDC;                               //!
+  TH1F*     fHistPartZDC;                                         //!
+  TProfile* fHistPidMult;                                 //!
+  TH1F*     fHistBayPidMult;                              //!
+  TH1F*     fHistEtaSym;                                  //!          // ...part also
+  TH1F*     fHistEtaSymPart;                              //!
+  TH2F*     fHistEtaSymVerZ2D;                            //!          // ...part also
+  TH2F*     fHistEtaSymVerZ2DPart;                        //!
+ // selected (TR & V0)
+  TH1F*     fHistMultPart;                                //!
+  TH1F*     fHistV0MultPart;                              //!
+  TH1F*     fHistBayPidMultPart;                          //!
+  TH1F*     fHistMultPartUnit;                                    //!
+  
+ // *****************
+ // TRACKs HISTOGRAMS (all tracks)
+ // *****************
+  TH1F*     fHistPtot ;                                   //!
+  TH1F*     fHistPt ;                                     //!
+  TH1F*     fHistCharge;                                  //!
+  TH1F*     fHistDcaGlobal;                               //!
+  TH1F*     fHistDca;                                     //!
+  TH1F*     fHistTransDca;                                        //!
+  TH1F*     fHistChi2;                                    //!
+  TH1F*     fHistLenght;                                  //!
+  TH1F*     fHistInvMass ;                                //!
+  TH1F*     fHistFitOverMax;                                      //!
+  TH2D*     fHistPhiPtCon ;                               //!
+  TH2D*     fHistPhiPtUnc ;                               //!
+  TH2D*     fHistPtPhiPos ;                               //!
+  TH2D*     fHistPtPhiNeg ;                               //!
+  TH3F*     fHistAllEtaPtPhi3D;                           //!
+  TProfile* fHistCosPhi;                                  //!
+  TH2F*     fHistPidPt;                                   //!
+  TH1F*     fHistPhi ;                                            //!
+  TH1F*     fHistPhiCons ;                                //!
+  TH2D*     fHistYieldAll2D;                              //!
+  TH2D*     fHistYieldCon2D;                              //!
+  TH2D*     fHistYieldUnc2D;                              //!
+  TH3F*     fHistConsEtaPtPhi3D;                          //!
+  TH3F*     fHistGlobEtaPtPhi3D;                          //! 
+  TH3F*     fHistUncEtaPtPhi3D ;                          //!
+  // fit & dE/dX for each detector (all tracks) 
+  TH1F*     fHistChi2ITS;                                 //!
+  TH1F*     fHistChi2normITS;                             //!
+  TH1F*     fHistFitPtsITS;                               //!
+  TH1F*     fHistMaxPtsITS;                               //!
+  TH2F*     fHistMeanDedxPos2DITS;                        //!
+  TH2F*     fHistMeanDedxNeg2DITS;                        //!
+  // -
+  TH1F*     fHistChi2TPC;                                 //!
+  TH1F*     fHistChi2normTPC;                             //!
+  TH1F*     fHistFitPtsTPC;                               //!
+  TH1F*     fHistMaxPtsTPC;                               //!
+  TH1F*     fHistFitOverMaxTPC;                           //!
+  TH2F*     fHistMeanDedxPos2D;                           //!
+  TH2F*     fHistMeanDedxNeg2D;                           //!
+  // -
+  TH1F*     fHistChi2TRD;                                 //!
+  TH1F*     fHistChi2normTRD;                             //!
+  TH1F*     fHistFitPtsTRD;                               //!
+  TH1F*     fHistMaxPtsTRD;                               //!
+  TH2F*     fHistMeanDedxPos2DTRD;                        //!
+  TH2F*     fHistMeanDedxNeg2DTRD;                        //!
+  // -
+  TH1F*     fHistChi2TOF;                                 //!
+  TH1F*     fHistChi2normTOF;                             //!
+  TH1F*     fHistFitPtsTOF;                               //!
+  TH1F*     fHistMaxPtsTOF;                               //!
+  TH2F*     fHistMeanDedxPos2DTOF;                        //!
+  TH2F*     fHistMeanDedxNeg2DTOF;                        //!
+  // detector response for particle type (all tracks, based on Pid)
+  TH2F*     fHistMeanTPCPiPlus ;                          //!
+  TH2F*     fHistMeanTPCPiMinus ;                         //!
+  TH2F*     fHistMeanTPCProton ;                          //!
+  TH2F*     fHistMeanTPCPbar ;                            //!
+  TH2F*     fHistMeanTPCKplus ;                           //!
+  TH2F*     fHistMeanTPCKminus ;                          //!
+  TH2F*     fHistMeanTPCDeuteron ;                        //!
+  TH2F*     fHistMeanTPCAntiDeuteron ;                    //!
+  TH2F*     fHistMeanTPCPositron ;                        //!
+  TH2F*     fHistMeanTPCElectron ;                        //!
+  TH2F*     fHistMeanTPCMuonPlus ;                        //!
+  TH2F*     fHistMeanTPCMuonMinus ;                       //!
+  // -
+  TH2F*     fHistMeanITSPiPlus ;                          //!
+  TH2F*     fHistMeanITSPiMinus ;                         //!
+  TH2F*     fHistMeanITSProton ;                          //!
+  TH2F*     fHistMeanITSPbar ;                            //!
+  TH2F*     fHistMeanITSKplus ;                           //!
+  TH2F*     fHistMeanITSKminus ;                          //!
+  TH2F*     fHistMeanITSDeuteron ;                        //!
+  TH2F*     fHistMeanITSAntiDeuteron ;                    //!
+  TH2F*     fHistMeanITSPositron ;                        //!
+  TH2F*     fHistMeanITSElectron ;                        //!
+  TH2F*     fHistMeanITSMuonPlus ;                        //!
+  TH2F*     fHistMeanITSMuonMinus ;                       //!
+  // -
+  TH2F*     fHistMeanTOFPiPlus ;                          //!
+  TH2F*     fHistMeanTOFPiMinus ;                         //!
+  TH2F*     fHistMeanTOFProton ;                          //!
+  TH2F*     fHistMeanTOFPbar ;                            //!
+  TH2F*     fHistMeanTOFKplus ;                           //!
+  TH2F*     fHistMeanTOFKminus ;                          //!
+  TH2F*     fHistMeanTOFDeuteron ;                        //!
+  TH2F*     fHistMeanTOFAntiDeuteron ;                    //!
+  TH2F*     fHistMeanTOFPositron ;                        //!
+  TH2F*     fHistMeanTOFElectron ;                        //!
+  TH2F*     fHistMeanTOFMuonPlus ;                        //!
+  TH2F*     fHistMeanTOFMuonMinus ;                       //!
+  // -
+  TH2F*     fHistMeanTRDPiPlus ;                          //!
+  TH2F*     fHistMeanTRDPiMinus ;                         //!
+  TH2F*     fHistMeanTRDProton ;                          //!
+  TH2F*     fHistMeanTRDPbar ;                            //!
+  TH2F*     fHistMeanTRDKplus ;                           //!
+  TH2F*     fHistMeanTRDKminus ;                          //!
+  TH2F*     fHistMeanTRDDeuteron ;                        //!
+  TH2F*     fHistMeanTRDAntiDeuteron ;                    //!
+  TH2F*     fHistMeanTRDPositron ;                        //!
+  TH2F*     fHistMeanTRDElectron ;                        //!
+  TH2F*     fHistMeanTRDMuonPlus ;                        //!
+  TH2F*     fHistMeanTRDMuonMinus ;                       //!
+  // pid probability for all particle (all tracks)
+  TH1F*     fHistPidPiPlus;                               //!
+  TH1F*     fHistPidPiMinus;                              //!
+  TH1F*     fHistPidProton;                               //!
+  TH1F*     fHistPidAntiProton;                           //!
+  TH1F*     fHistPidKplus;                                //!
+  TH1F*     fHistPidKminus;                               //!
+  TH1F*     fHistPidDeuteron;                             //!
+  TH1F*     fHistPidAntiDeuteron;                         //!
+  TH1F*     fHistPidElectron;                             //!
+  TH1F*     fHistPidPositron;                             //!
+  TH1F*     fHistPidMuonMinus;                            //!
+  TH1F*     fHistPidMuonPlus;                             //!
+  // pid probability for particle type (all tracks, based on Pid)
+  TH1F*     fHistPidPiPlusPart;                           //!
+  TH1F*     fHistPidPiMinusPart;                          //!
+  TH1F*     fHistPidProtonPart;                           //!
+  TH1F*     fHistPidAntiProtonPart;                       //!
+  TH1F*     fHistPidKplusPart;                            //!
+  TH1F*     fHistPidKminusPart;                           //!
+  TH1F*     fHistPidDeuteronPart;                         //!
+  TH1F*     fHistPidAntiDeuteronPart;                     //!
+  TH1F*     fHistPidElectronPart;                         //!
+  TH1F*     fHistPidPositronPart;                         //!
+  TH1F*     fHistPidMuonMinusPart;                        //!
+  TH1F*     fHistPidMuonPlusPart;                         //!
+  // MC labels from the simulation (all tracks)
+  TH2F*     mLabHist;                                     //! 
+ // *****************
+ // selected TRACKS
+ // *****************
+  TProfile* fHistBinEta;                                  //!
+  TProfile* fHistBinPt;                                   //!
+  //
+  TH3F*     fHistEtaPtPhi3DPart ;                         //!
+  TH2D*     fHistYieldPart2D;                             //!
+  TH1F*     fHistDcaGlobalPart ;                          //!
+  TH1F*     fHistInvMassPart ;                            //!
+  TH3F*     fHistEtaPtPhi3DOut ;                          //!
+  TH2D*     fHistYieldOut2D;                              //!
+  TH1F*     fHistDcaGlobalOut ;                                   //!
+  TH1F*     fHistInvMassOut ;                             //!
+  TH3F*     fHistMeanDedxPos3DPart ;                      //!
+  TH3F*     fHistMeanDedxNeg3DPart ;                      //!
+  TH3F*     fHistMeanDedxPos3DPartITS ;                           //!
+  TH3F*     fHistMeanDedxNeg3DPartITS ;                           //!
+//
+
+ // *****************
+ // V0s HISTOGRAMS (all v0s)
+ // *****************
+  TH1F*     fHistV0Mass;                                  //!
+  TH3F*     fHistV0EtaPtPhi3D;                            //!
+  TH2D*     fHistV0YieldAll2D;                            //!
+  TH2D*     fHistV0PYall2D;                                       //!
+  TH1F*     fHistV0Dca;                                           //!
+  TH1F*     fHistV0Chi2;                                  //!
+  TH1F*     fHistV0Lenght;                                //!
+  TH1F*     fHistV0Sigma;                                 //!
+  TProfile* fHistV0CosPhi;                                //! 
+  TH2D*     fHistV0MassPtSlices;                          //!
+ // *****************
+ // selected V0s
+ // *****************
+  TProfile* fHistV0BinEta;                                //! 
+  TProfile* fHistV0BinPt;                                 //! 
+  TProfile* fHistV0sbBinEta;                              //! 
+  TProfile* fHistV0sbBinPt;                               //!
+  //
+  TH1F*     fHistV0MassWin ;                              //!
+  TH3F*     fHistV0EtaPtPhi3DPart ;                       //!
+  TH2D*     fHistV0YieldPart2D;                           //!
+  TH1F*     fHistV0DcaPart ;                              //!
+  TH1F*     fHistV0LenghtPart ;                                   //!
+  TH1F*     fHistV0sbMassSide ;                           //!
+  TH3F*     fHistV0sbEtaPtPhi3DPart ;                     //!
+  TH2D*     fHistV0sbYieldPart2D;                         //!
+  TH1F*     fHistV0sbDcaPart ;                            //!
+  TH1F*     fHistV0sbLenghtPart ;                         //!
+
+// for each harmonic, each selection, and each sub-event
+
+ // *****************
+ // SUB-EVENTs HISTOGRAMS
+ // *****************
+  struct histSubHars {
+   TH1F*     fHistPsiSubs;
+  };
+  struct histSubs;     
+  friend struct histSubs;
+  struct histSubs {
+   struct histSubHars fHistSubHar[Flow::nHars];
+  };
+  struct histSubs fHistSub[Flow::nSels*Flow::nSubs];        //!
+
+// for each harmonic and each selection
+
+  struct histFullHars 
+  {
+   // weights
+    TH1D*       fHistPhiPlus;
+    TH1D*       fHistPhiMinus;
+    TH1D*       fHistPhiAll;
+    TH1D*       fHistPhiWgtPlus;
+    TH1D*       fHistPhiWgtMinus;
+    TH1D*       fHistPhiWgtAll;
+    TH1D*       fHistPhiFlatPlus;
+    TH1D*       fHistPhiFlatMinus;
+    TH1D*       fHistPhiFlatAll;
+    TH1D*       fHistPhi;
+    TH1D*       fHistPhiWgt;
+    TH1D*       fHistPhiFlat;
+   // flow (events)
+    TH1F*       fHistPsi;
+    TH1F*       fHistPsiSubCorr;
+    TH1F*       fHistPsiSubCorrDiff;
+    TH1F*       fHistPsiDiff;
+    TH1F*       fHistMult;
+    TH1F*       fHistQnorm;
+   // flow (tracks)
+    TH1F*       fHistPhiCorr;
+    TProfile2D* fHistvObs2D;
+    TProfile*   fHistvObsEta;
+    TProfile*   fHistvObsPt;
+    TH2D*       fHistv2D;
+    TH1D*       fHistvEta;
+    TH1D*       fHistvPt;
+   // flow (v0s)
+    TH1F*       fHistV0PhiCorr;   
+    TProfile2D* fHistV0vObs2D;   
+    TProfile*   fHistV0vObsEta;  
+    TProfile*   fHistV0vObsPt;   
+    TH2D*      fHistV0v2D;      
+    TH1D*      fHistV0vEta;     
+    TH1D*      fHistV0vPt;      
+   // flow (v0s sidebands)
+    TProfile*   fHistV0sbvObsEtaSx ;  
+    TProfile*   fHistV0sbvObsPtSx ;   
+    TProfile*   fHistV0sbvObsEtaDx ;  
+    TProfile*   fHistV0sbvObsPtDx ;   
+    TH1F*       fHistV0sbPhiCorr ;   
+    TProfile2D* fHistV0sbvObs2D ;   
+    TProfile*   fHistV0sbvObsEta ;  
+    TProfile*   fHistV0sbvObsPt ;   
+    TH2D*      fHistV0sbv2D ;      
+    TH1D*      fHistV0sbvEta ;     
+    TH1D*      fHistV0sbvPt ;      
+   // check (tracks used for R.P.)
+    TH1F*       fHistYieldPt ;
+    TH3F*       fHistEtaPtPhi3D ;
+    TH2D*       fHistYield2D ;
+    TH1F*       fHistDcaGlob ;
+   // check (tracks excluded)
+    TH1F*      fHistYieldPtout;
+    TH3F*      fHistEtaPtPhi3Dout ;
+    TH2D*      fHistYield2Dout ;
+    TH1F*      fHistDcaGlobout ;
+  };
+
+// for each selection
+
+  struct histFulls;    
+  friend struct histFulls;
+  struct histFulls 
+  {
+   TH1F*     fHistBayPidMult;
+  // flow (events)
+   TProfile* fHistCos;
+   TH1F*     fHistRes;
+   TProfile* fHistvObs;
+   TH1D*     fHistv;
+   TProfile* fHistV0vObs;
+   TProfile* fHistV0sbvObsSx;
+   TProfile* fHistV0sbvObsDx;
+   TH1D*     fHistV0v;
+  // wgt, evts, trks, v0s (as defined above)
+   struct histFullHars  fHistFullHar[Flow::nHars];
+  };
+  struct histFulls fHistFull[Flow::nSels];                     //!
+
+  ClassDef(AliFlowAnalyser,0)              // macro for rootcint
+};
+
+#endif
+
+
+
+// lame = not productive; poorly designed; uncool ...
diff --git a/PWG2/FLOW/AliFlowAnalysisMaker.cxx b/PWG2/FLOW/AliFlowAnalysisMaker.cxx
deleted file mode 100644 (file)
index 9dee4e1..0000000
+++ /dev/null
@@ -1,3785 +0,0 @@
-//////////////////////////////////////////////////////////////////////
-//
-// $Id$
-//
-// Author: Emanuele Simili
-//
-//////////////////////////////////////////////////////////////////////
-//_____________________________________________________________
-//
-// Description: 
-//         the AliFlowAnalysisMaker class loops over AliFlowEvents, 
-// calculates/extracts interesting observables, produces and fills the 
-// related histograms for flow analysis. 
-// Set AliFlowEvents file via SetInputFileName("file.root"), and the 
-// histograms file via SetHistFileName("hist.root"), defalts are given. 
-// It also calculates the phi weights to make the event plane isotropic 
-// in the lab, and the bayesian weight for p.id. calculation, and saves 
-// them in a file (set it via SetPhiWgtFileName("flowPhiWgt.hist.root")). 
-// Those weights, if enabled, will be used only in the next run of the 
-// analysis. In the first run or whenever the wgt file is missing, all 
-// weights (phi & bayesian) are set to 1 .
-// The most important features of the Flow Analysis are:
-//  - Reaction Plane calculation: for different harmonics and selections
-//   the R.P. is simply extracted via the appropriate AliFlowEvent methods.
-//  - Correlation Analysis: particles are related to the R.P. and Vn 
-//   coefficient are extracted. The AliFlowAnalysisMaker also removes 
-//   auto-correlations of each particle with respect to the event plane, 
-//   by subtracting track by track from the Q vector before the correlation 
-//   study. Observable Flow is plotted.
-//  - Differential Flow: for each harmonic and selection, flow values 
-//   (Vn) are plotted versus rapidity/pseudorapidity and pT. 
-//  - Resulution Estimate: event plane resolution is estimated via the 
-//   sub-event method (res ~ sqrt(cos(psi1-psi2))), and flow values are 
-//   then corrected for it. "True" Flow is plotted. 
-//  - Integrated Flow: for the doubly-integrated (pT & eta) Vn values 
-//   the error on the event plane resolution is folded in to the error. 
-//  - Phi and Baiesian weights calculation (from event observables). 
-//
-// The AliFlowAnalysisMaker Class is adapted from the original 
-// StFlowAnalysisMaker, succesfully used to study flow in the 
-// STAR experiment at RICH.
-// Original Authors:                 Raimond Snellings & Art Poskanzer
-//
-
-#include "AliFlowAnalysisMaker.h"
-#include "AliFlowConstants.h"
-#include "TVector2.h"
-#include <iostream>
-#include <cmath>     //PK: <cmath> needed for fabs() and fmod() on some systems.
-using namespace std; //required for resolving the 'cout' symbol
-
-ClassImp(AliFlowAnalysisMaker)
-//-----------------------------------------------------------------------
-AliFlowAnalysisMaker::AliFlowAnalysisMaker(const Char_t* name)
-{
- // default constructor 
-
- pFlowSelect = new AliFlowSelection();
- mName = name ;
- InitDefault() ;
- cout << FlowAnalysis << " !!! No flowSelection defined .  Will use default cuts  (class AliFlowSelection) !!! " << endl ;
-}
-//-----------------------------------------------------------------------
-AliFlowAnalysisMaker::AliFlowAnalysisMaker(const Char_t* name, const AliFlowSelection& flowSelect)
-{
- //copy constructor
-
- pFlowSelect = new AliFlowSelection(flowSelect);  
- mName = name ;
- InitDefault() ;
-}
-//-----------------------------------------------------------------------
-AliFlowAnalysisMaker::~AliFlowAnalysisMaker() 
-{
- // default distructor (no actions) 
-}
-//-----------------------------------------------------------------------
-void AliFlowAnalysisMaker::InitDefault()
-{
- // sets some defaults for the analysis
- SetDebugg(1) ;  // Debug options (1,2,3)
- if(Debug0) { cout << FlowAnalysis << "Constructor" << endl ; }
- // input-output file (default output is given via the name given to the AliFlowAnalysis Object)
- SetInputFileName("AliFlowEVT.root") ;
- TString histfilename = mName ; histfilename += "Plot"  ; histfilename += ".root" ; 
- SetHistFileName(histfilename.Data());
- fFileNames.Clear() ;
-
- // internal settings (for event loop & printing purpose)
- FlowAnalysis = " [" ; FlowAnalysis += mName ; FlowAnalysis += "] - " ;
- spaces = " " ; for(Int_t s=0;s<(FlowAnalysis.Length()-1);s++) { spaces += " " ; }
- evtN = 0 ;
- pFlowEventsFile = 0 ;
- pFlowEvent      = 0 ;
- for(Int_t ii=0;ii<3;ii++){ vertex[ii] = 0 ; }
- // for labels histogram
- mLabelling = kTRUE ; 
- mLabellingFirst = kTRUE ;
- maxLabel = 0 ;
-
- // analysis settings 
- SetPhiWgtFileName("flowPhiWgt.hist.root");
- mV0           = kTRUE ;  // correlation analysis is done also for neutral secundary vertex
- mShuffle      = kFALSE ; // randomly reshuffles tracks
- mV1Ep1Ep2     = kFALSE ; // disabled by default
- mEtaSub       = kFALSE ; // eta subevents
- mPhiWgt       = kTRUE ;  // if flowPhiWgt file is there -> Phi Weights are used
- mBayWgt       = kFALSE ; // Bayesian Weights for P.Id. not used  
- mRePid        = kFALSE ; // recalculates the P.Id. (becomes kTRUE if new bayesian weights are plugged in)  
-
- mPtWgt        = kFALSE ; // pT as a weight
- mEtaWgt       = kFALSE ; // eta as a weight
- mOnePhiWgt    = kTRUE  ; // one/three phi-wgt histogram(s)
-
- mRedoWgt      = kFALSE ; // to recalculate Wgt histograms (even if flowPhi.hist.root exist)
- mMakeAll      = kTRUE ;  // claculates all events vars in one shoot (should run faster) 
-}
-//------------------------------------------------------------------------
-// ###
-//------------------------------------------------------------------------
-Int_t AliFlowAnalysisMaker::Init()                    
-{
- // Opens input, output and wgt files, books histograms, sets limits & bin 
- if(Debug0) { cout << FlowAnalysis << "Init() . " << endl ; }
-
- // Check for Read/Write weights ... if weight file is there, wgt arrays are filled (phiwgt & bayesian)
- WgtChk() ;  // -> FillWgtArrays(wgtFile)
- // Open output files (->plots)
- histFile = new TFile(GetHistFileName().Data(), "RECREATE");
- histFile->cd() ;
-
- // Variable setting
- float ptMaxPart = 5. ;      if(pFlowSelect->PtMaxPart())  { ptMaxPart = pFlowSelect->PtMaxPart() ; }
- int nPtBinsPart = 40  ;     if(pFlowSelect->PtBinsPart()) { nPtBinsPart = pFlowSelect->PtBinsPart() ; }
- xLabel = "Pseudorapidity" ; if(strlen(pFlowSelect->PidPart()) != 0) { xLabel = "Rapidity"; }
- // -                       
- const float etaMin  = Flow::fEtaMin ; 
- const float etaMax  = Flow::fEtaMax ; 
- const float ptMin   = Flow::fPtMin ;       
- const float ptMax   = Flow::fPtMax ;       
- const int   EtaBins  = Flow::nEtaBins ;      
- const int   nPtBins  = Flow::nPtBins ;      
- const int   nPhiBins = Flow::nPhiBins ;     
- // -
- SetHistoRanges(etaMin, etaMax, EtaBins);
- SetPtRange_for_vEta(1.,0.);   //(ptMin, ptMax);
- SetEtaRange_for_vPt(1.,0.);   //(etaMin, etaMax);
- // -
- const float triggerMin      =  -1.5;
- const float triggerMax      =  10.5;
- const float chargeMin       =  -2.5;
- const float chargeMax       =   2.5; 
- const float dcaMin         =   0.0;
- const float dcaMax         =  10.0; //  0.5; 
- const float glDcaMax       =  50.0; 
- const float chi2Min        =    0.;
- const float chi2Max        =  500.; 
- const float chi2normMax     =   50.; 
- const float chi2MaxC       =   30.; 
- const float chi2MaxI       =   60.; 
- const float fitPtsMin       =  -0.5;
- const float fitPtsMaxTpc    = 160.5;
- const float fitPtsMaxIts    =   6.5;
- const float fitPtsMaxTrd    = 130.5;
- const float fitPtsMaxTof    =   1.5;
- const float fitOverMaxMin   =    0.;
- const float fitOverMaxMax   =   1.1;
- const float multOverOrigMin =    0.;
- const float multOverOrigMax =    1.;
- const float vertexZMin      =  -10.;
- const float vertexZMax      =   10.; 
- const float vertexXYMin     =  -0.1;
- const float vertexXYMax     =   0.1; 
- const float etaSymMinPart   =   -1.;
- const float etaSymMaxPart   =    1.;
- const float etaSymMin       =   -2.;
- const float etaSymMax       =    2.;
- const float phiMin         =    0.;
- const float phiMax         = 2*TMath::Pi() ; 
- const float psiMin         =    0.;
- const float psiMax         = 2*TMath::Pi() ; 
- const float multMin        =    0. ;
- const float multMax        =25000. ;
- const float multV0         = 5000. ;
- const float qMin           =    0. ;
- const float qMax           =   20. ;
- const float pidMin         =    0. ;
- const float pidMax         =    1. ;
- const float centMin        =  -0.5 ;
- const float centMax        =   9.5 ;
- const float logpMin        =   -2.5 ;
- const float logpMax        =    2.5 ;
- const float pMin           =     0. ;
- const float pMax           =   100. ;
- const float dEdxMax        =  1000. ;
- const float dEdxMaxTPC             =  1500. ;
- const float TOFmin         =  10000. ;
- const float TOFmax         =  50000. ;
- const float TRDmax         =  2000. ;
- const float lgMin          =  -1000. ;
- const float lgMax          =  1000. ;
- const float lgMinV0        =  0. ;
- const float lgMaxV0        =  50. ;
- const float massMin        =  -0.1 ;
- const float massMax        =  2.1 ;
- const float ZDCpartMin      = -0.5 ;
- const float ZDCpartMax             =  1000.5 ;
- const float ZDCeMin        =  0. ;
- const float ZDCeMax         =  10000. ;
- // - 
- enum { nTriggerBins     = 12,
-       nChargeBins       = 5,
-       nDcaBins          = 1000,
-       nChi2Bins         = 150,
-       nFitPtsBinsTpc    = 161,
-       nFitPtsBinsIts    = 7,
-       nFitPtsBinsTrd    = 131,
-       nFitPtsBinsTof    = 2,
-       nFitOverMaxBins   = 55,
-       nMultOverOrigBins =100,
-       nVertexZBins      = 200,
-       nVertexXYBins     = 1000,
-       nEtaSymBins       = 200,
-       nPhi3DBins        = nPhiBins/6 ,
-       nPsiBins          = 36,
-       nMultBins         = 250,
-       nPidBins          = 100,
-        nCentBins        = 10,
-       nDedxBins        = 1000,
-       nTofBins         = 1000,
-       nTrdBins         = 100,
-       nMomenBins       = 500,
-       n_qBins          =  50,
-       nLgBins          = 500,
-       nMassBins        = 2200,
-       nZDCpartBins     = 1001,
-       nZDCeBins        = 200
-      } ;
-
-// *temp*   
-  int maxMaxLabel = maxLabel ;
-  if(Debug1) { cout << spaces << " Creating Labels hist at the beginning ( max bin by hand = " << maxMaxLabel << " ) . " << endl ; }
-  TString* labTitle = new TString("TracksLabel_full") ; 
-  mLabHist = new TH2F(labTitle->Data(),labTitle->Data(),Flow::nSels+4,0.,Flow::nSels+4.,maxMaxLabel+1,0.,maxMaxLabel+1.) ;
-  if(Flow::nSels==2) { mLabHist->SetXTitle("tracks , sel0 , sel1 , selPart , v0s , selV0s ") ; }
-  else  { mLabHist->SetXTitle("tracks , sel... , selPart , v0s , selV0s ") ; }
-  mLabHist->SetYTitle("MC label") ;
-  delete labTitle ;
-  mLabellingFirst = kFALSE ; 
-// *temp* 
-
- // Histograms Booking ...
- // Trigger
- mHistTrigger = new TH1F("Flow_Trigger", "Flow_Trigger", nTriggerBins, triggerMin, triggerMax);
- mHistTrigger->SetXTitle("Trigger: 1 minbias, 2 central, 3 laser, 10 other");
- mHistTrigger->SetYTitle("Counts");
-
- // Charge
- mHistCharge = new TH1F("Flow_Charge", "Flow_Charge", nChargeBins, chargeMin, chargeMax);
- mHistCharge->SetXTitle("Charge");
- mHistCharge->SetYTitle("Counts");
-
- // Reconstructed Momentum (constrained, if so)
- mHistPtot = new TH1F("Flow_totalP","Flow_totalP", nPtBins, ptMin, ptMax);
- mHistPtot->Sumw2();
- mHistPtot->SetXTitle("P (GeV/c)");
- mHistPtot->SetYTitle("Counts");
-
- // Reconstructed pT (constrained, if so)
- mHistPt = new TH1F("Flow_Pt","Flow_Pt", nMomenBins, pMin, pMax);
- mHistPt->Sumw2();
- mHistPt->SetXTitle("Pt (GeV/c)");
- mHistPt->SetYTitle("Counts");
-   
- // Reconstructed P.id vs pT 
- mHistPidPt = new TH2F("Flow_PidPt","Flow_PidPt", 12, 0., 12., nPtBins, ptMin, ptMax);
- mHistPidPt->Sumw2();
- mHistPidPt->SetXTitle("e-, e+, mu-, mu+, pi-, pi+, K-, K+, pr-, pr+, d-, d+");
- mHistPidPt->SetYTitle("Pt (GeV/c)");
-   
- // Distance of closest approach - Transverse, Unsigned
- mHistDca = new TH1F("Flow_TransDCA", "Flow_TransverseDCA", nDcaBins, dcaMin, dcaMax);
- mHistDca->Sumw2();
- mHistDca->SetXTitle("|Track's Signed dca (cm)|");
- mHistDca->SetYTitle("Counts");
-
- // Distance of closest approach - Transverse
- mHistTransDca = new TH1F("Flow_TransDCA_Signed", "Flow_TransverseDCA_Signed", nDcaBins, -dcaMax, dcaMax);
- mHistTransDca->Sumw2();
- mHistTransDca->SetXTitle("Track's Transverse dca (cm)");
- mHistTransDca->SetYTitle("Counts");
-
- // Distance of closest approach - 3d
- mHistDcaGlobal = new TH1F("Flow_3dDcaGlobal", "Flow_3dDcaGlobal", nDcaBins, dcaMin, glDcaMax);
- mHistDcaGlobal->Sumw2();
- mHistDcaGlobal->SetXTitle("|3d Global Track's dca to Vertex (cm)|");
- mHistDcaGlobal->SetYTitle("Counts");
-
- // Distance of closest approach for particles correlated with the event plane - 3d
- mHistDcaGlobalPart = new TH1F("Flow_3dDcaGlobalPart", "Flow_3dDcaGlobalPart", nDcaBins, dcaMin, glDcaMax);
- mHistDcaGlobalPart->Sumw2();
- mHistDcaGlobalPart->SetXTitle("|3d Global Track's dca to Vertex (cm)|");
- mHistDcaGlobalPart->SetYTitle("Counts");
-
- // Distance of closest approach for particles NOT SELECTED for correlation with the event plane - 3d
- mHistDcaGlobalOut = new TH1F("Flow_3dDcaGlobalOut", "Flow_3dDcaGlobalOut", nDcaBins, dcaMin, glDcaMax);
- mHistDcaGlobalOut->Sumw2();
- mHistDcaGlobalOut->SetXTitle("|3d Global Track's dca to Vertex (cm)|");
- mHistDcaGlobalOut->SetYTitle("Counts");
-
- // Yield Pt-Phi for constrained tracks
- mHistPhiPtCon = new TH2D("Flow_PtPhi_Con", "Flow_PtPhi_Con", nPhiBins, phiMin, phiMax, nPtBins, ptMin, ptMax);
- mHistPhiPtCon->Sumw2();
- mHistPhiPtCon->SetXTitle("Phi");
- mHistPhiPtCon->SetYTitle("Pt (GeV/c)");
- // Yield Pt-Phi for UNconstrained tracks
- mHistPhiPtUnc = new TH2D("Flow_PtPhi_Unc", "Flow_PtPhi_Unc", nPhiBins, phiMin, phiMax, nPtBins, ptMin, ptMax);
- mHistPhiPtUnc->Sumw2();
- mHistPhiPtUnc->SetXTitle("Phi");
- mHistPhiPtUnc->SetYTitle("Pt (GeV/c)");
- // Chi2 
- // at the main vertex
- mHistChi2 = new TH1F("Flow_Chi2", "Flow_Chi2", nChi2Bins, chi2Min, chi2MaxC);
- mHistChi2->SetXTitle("Chi square at Main Vertex");
- mHistChi2->SetYTitle("Counts");
- // TPC
- mHistChi2TPC = new TH1F("Flow_Chi2_TPC", "Flow_Chi2_TPC", nChi2Bins, chi2Min, chi2Max);
- mHistChi2TPC->SetXTitle("Chi square for TPC");
- mHistChi2TPC->SetYTitle("Counts");
- // ITS
- mHistChi2ITS = new TH1F("Flow_Chi2_ITS", "Flow_Chi2_ITS", nChi2Bins, chi2Min, chi2MaxI);
- mHistChi2ITS->SetXTitle("Chi square for ITS");
- mHistChi2ITS->SetYTitle("Counts");
- // TRD
- mHistChi2TRD = new TH1F("Flow_Chi2_TRD", "Flow_Chi2_TRD", nChi2Bins, chi2Min, chi2Max);
- mHistChi2TRD->SetXTitle("Chi square for TRD");
- mHistChi2TRD->SetYTitle("Counts");
- // TOF
- mHistChi2TOF = new TH1F("Flow_Chi2_TOF", "Flow_Chi2_TOF", nChi2Bins, chi2Min, chi2Max);
- mHistChi2TOF->SetXTitle("Chi square for TOF");
- mHistChi2TOF->SetYTitle("Counts");
-
- // Chi2 normalized
- // TPC
- mHistChi2normTPC = new TH1F("Flow_Chi2norm_TPC", "Flow_Chi2norm_TPC", nChi2Bins, chi2Min, chi2normMax);
- mHistChi2normTPC->SetXTitle("Normalized #Chi^{2} for TPC");
- mHistChi2normTPC->SetYTitle("Counts");
- // ITS
- mHistChi2normITS = new TH1F("Flow_Chi2norm_ITS", "Flow_Chi2norm_ITS", nChi2Bins, chi2Min, chi2normMax);
- mHistChi2normITS->SetXTitle("Normalized #Chi^{2} for ITS");
- mHistChi2normITS->SetYTitle("Counts");
- // TRD
- mHistChi2normTRD = new TH1F("Flow_Chi2norm_TRD", "Flow_Chi2norm_TRD", nChi2Bins, chi2Min, chi2normMax);
- mHistChi2normTRD->SetXTitle("Normalized #Chi^{2} for TRD");
- mHistChi2normTRD->SetYTitle("Counts");
- // TOF
- mHistChi2normTOF = new TH1F("Flow_Chi2norm_TOF", "Flow_Chi2norm_TOF", nChi2Bins, chi2Min, chi2normMax);
- mHistChi2normTOF->SetXTitle("Normalized #Chi^{2} for TOF");
- mHistChi2normTOF->SetYTitle("Counts");
- // FitPts
- // TPC
- mHistFitPtsTPC = new TH1F("Flow_FitPts_TPC", "Flow_FitPts_TPC", nFitPtsBinsTpc, fitPtsMin, fitPtsMaxTpc);
- mHistFitPtsTPC->SetXTitle("Fit Points");
- mHistFitPtsTPC->SetYTitle("Counts");
- // ITS
- mHistFitPtsITS = new TH1F("Flow_HitPts_ITS", "Flow_HitPts_ITS", nFitPtsBinsIts, fitPtsMin, fitPtsMaxIts);
- mHistFitPtsITS->SetXTitle("Fit Points");
- mHistFitPtsITS->SetYTitle("Counts");
- // TRD
- mHistFitPtsTRD = new TH1F("Flow_FitPts_TRD", "Flow_FitPts_TRD", nFitPtsBinsTrd, fitPtsMin, fitPtsMaxTrd);
- mHistFitPtsTRD->SetXTitle("Fit Points");
- mHistFitPtsTRD->SetYTitle("Counts");
- // TOF
- mHistFitPtsTOF = new TH1F("Flow_HitPts_TOF", "Flow_HitPts_TOF", nFitPtsBinsTof, fitPtsMin, fitPtsMaxTof);
- mHistFitPtsTOF->SetXTitle("Fit Points");
- mHistFitPtsTOF->SetYTitle("Counts");
-
- // MaxPts 
- // TPC
- mHistMaxPtsTPC = new TH1F("Flow_MaxPts_TPC", "Flow_MaxPts_TPC", nFitPtsBinsTpc, fitPtsMin, fitPtsMaxTpc);
- mHistMaxPtsTPC->SetXTitle("Max Points");
- mHistMaxPtsTPC->SetYTitle("Counts");
- // ITS
- mHistMaxPtsITS = new TH1F("Flow_MaxPts_ITS", "Flow_MaxPts_ITS", nFitPtsBinsIts, fitPtsMin, fitPtsMaxIts);
- mHistMaxPtsITS->SetXTitle("Max Points");
- mHistMaxPtsITS->SetYTitle("Counts");
- // TRD
- mHistMaxPtsTRD = new TH1F("Flow_MaxPts_TRD", "Flow_MaxPts_TRD", nFitPtsBinsTrd, fitPtsMin, fitPtsMaxTrd);
- mHistMaxPtsTRD->SetXTitle("Max Points");
- mHistMaxPtsTRD->SetYTitle("Counts");
- // TOF
- mHistMaxPtsTOF = new TH1F("Flow_MaxPts_TOF", "Flow_MaxPts_TOF", nFitPtsBinsTof, fitPtsMin, fitPtsMaxTof);
- mHistMaxPtsTOF->SetXTitle("Max Points");
- mHistMaxPtsTOF->SetYTitle("Counts");
-
- // FitOverMax 
- // Tpc
- mHistFitOverMaxTPC = new TH1F("Flow_FitOverMax_TPC", "Flow_FitOverMax_TPC", nFitOverMaxBins, fitOverMaxMin, fitOverMaxMax);
- mHistFitOverMaxTPC->SetXTitle("(Fit Points - 1) / Max Points");
- mHistFitOverMaxTPC->SetYTitle("Counts");  
- // All
- mHistFitOverMax = new TH1F("Flow_FitOverMax", "Flow_FitOverMax", nFitOverMaxBins, fitOverMaxMin, fitOverMaxMax);
- mHistFitOverMax->SetXTitle("(Fit Points - 1) / Max Points");
- mHistFitOverMax->SetYTitle("Counts");  
-
- // lenght
- mHistLenght = new TH1F("Flow_TrackLenght", "Flow_TrackLenght", nLgBins, lgMin, lgMax);
- mHistLenght->SetXTitle("Lenght of the Track (cm)");
- mHistLenght->SetYTitle("Counts");
-
-  // OrigMult
- mHistOrigMult = new TH1F("Flow_OrigMult", "Flow_OrigMult", nMultBins, multMin, multMax);
- mHistOrigMult->SetXTitle("Original Mult");
- mHistOrigMult->SetYTitle("Counts");
-
- // MultEta
- mHistMultEta = new TH1F("Flow_MultEta", "Flow_MultEta", nMultBins, multMin, multMax);
- mHistMultEta->SetXTitle("Mult for Centrality");
- mHistMultEta->SetYTitle("Counts");
-   
- // Mult
- mHistMult = new TH1F("Flow_Mult", "Flow_Mult", nMultBins, multMin, multMax);
- mHistMult->SetXTitle("Mult");
- mHistMult->SetYTitle("Counts");
-
- // V0s multiplicity
- mHistV0Mult = new TH1F("FlowV0_Mult","FlowV0_Mult", nMultBins, multMin, multV0);
- mHistV0Mult->SetXTitle("V0s Multiplicity");
- mHistV0Mult->SetYTitle("Counts");
-   
- // MultOverOrig
- mHistMultOverOrig = new TH1F("Flow_MultOverOrig", "Flow_MultOverOrig", nMultOverOrigBins, multOverOrigMin, multOverOrigMax);
- mHistMultOverOrig->SetXTitle("Mult / Orig. Mult");
- mHistMultOverOrig->SetYTitle("Counts");
-   
- // Mult correlated with the event planes
- mHistMultPart = new TH1F("Flow_MultPart", "Flow_MultPart", 2*nMultBins, multMin, multMax);
- mHistMultPart->SetXTitle("Mult of Correlated Particles");
- mHistMultPart->SetYTitle("Counts");
-   
- // Mult correlated with the event planes in 1 unit rapidity
- mHistMultPartUnit = new TH1F("Flow_MultPartUnit", "Flow_MultPartUnit", 2*nMultBins, multMin, multMax/2);
- mHistMultPartUnit->SetXTitle("Mult of Correlated Particles (-0.5 < eta < 0.5)");
- mHistMultPartUnit->SetYTitle("Counts");
-   
- // Mult of V0s correlated with the event planes
- mHistV0MultPart = new TH1F("FlowV0_MultPart", "FlowV0_MultPart", nMultBins, multMin, multV0);
- mHistV0MultPart->SetXTitle("Mult of Correlated V0s");
- mHistV0MultPart->SetYTitle("Counts");
-   
- // VertexZ
- mHistVertexZ = new TH1F("Flow_VertexZ", "Flow_VertexZ", nVertexZBins, vertexZMin, vertexZMax);
- mHistVertexZ->SetXTitle("Vertex Z (cm)");
- mHistVertexZ->SetYTitle("Counts");
-   
- // VertexXY
- mHistVertexXY2D = new TH2F("Flow_VertexXY2D", "Flow_VertexXY2D", nVertexXYBins, vertexXYMin, vertexXYMax, nVertexXYBins, vertexXYMin, vertexXYMax);
- mHistVertexXY2D->SetXTitle("Vertex X (cm)");
- mHistVertexXY2D->SetYTitle("Vertex Y (cm)");
-   
- // EtaSym vs. Vertex Z Tpc
- mHistEtaSymVerZ2D = new TH2F("Flow_EtaSymVerZ2D", "Flow_EtaSymVerZ2D", nVertexZBins, vertexZMin, vertexZMax, nEtaSymBins, etaSymMin, etaSymMax);
- mHistEtaSymVerZ2D->SetXTitle("Vertex Z (cm)");
- mHistEtaSymVerZ2D->SetYTitle("Eta Symmetry TPC");
-
- // EtaSym Tpc
- mHistEtaSym = new TH1F("Flow_EtaSym_TPC", "Flow_EtaSym_TPC", nEtaSymBins, etaSymMin, etaSymMax);
- mHistEtaSym->SetXTitle("Eta Symmetry Ratio TPC");
- mHistEtaSym->SetYTitle("Counts");
-   
- // EtaSym vs. Vertex Z Tpc - correlation analysis
- mHistEtaSymVerZ2DPart = new TH2F("Flow_EtaSymVerZ2D_part", "Flow_EtaSymVerZ2D_part", nVertexZBins, vertexZMin, vertexZMax, nEtaSymBins, etaSymMinPart, etaSymMaxPart);
- mHistEtaSymVerZ2DPart->SetXTitle("Vertex Z (cm)");
- mHistEtaSymVerZ2DPart->SetYTitle("Eta Symmetry TPC");
-
- // EtaSym Tpc - correlation analysis
- mHistEtaSymPart = new TH1F("Flow_EtaSym_TPC_part", "Flow_EtaSym_TPC_part", nEtaSymBins, etaSymMinPart, etaSymMaxPart);
- mHistEtaSymPart->SetXTitle("Eta Symmetry Ratio TPC");
- mHistEtaSymPart->SetYTitle("Counts");
-   
- // phi , whatever
- mHistPhi = new TH1F("Flow_xPhi", "Flow_xPhi (all)", nPhiBins, phiMin, phiMax);
- mHistPhi->SetXTitle("Phi (rad)");
- mHistPhi->SetYTitle("Counts");
-
- // phi constrained
- mHistPhiCons = new TH1F("Flow_cPhi", "Flow_cPhi", nPhiBins, phiMin, phiMax);
- mHistPhiCons->SetXTitle("cPhi (rad)");
- mHistPhiCons->SetYTitle("Counts");
-   
- // EtaPtPhi , whatever
- mHistAllEtaPtPhi3D = new TH3F("Flow_EtaPtPhi3Dall", "Flow_EtaPtPhi3Dall (whatever)", mNEtaBins, mEtaMin, mEtaMax, nPtBins, ptMin, ptMax, nPhi3DBins, phiMin, phiMax);
- mHistAllEtaPtPhi3D->SetXTitle("Eta");
- mHistAllEtaPtPhi3D->SetYTitle("Pt (GeV/c)");
- mHistAllEtaPtPhi3D->SetZTitle("Phi (rad)");
-   
- // Constrained EtaPtPhi
- mHistConsEtaPtPhi3D = new TH3F("Flow_consEtaPtPhi3D", "Flow_consEtaPtPhi3D (constrainable)", mNEtaBins, mEtaMin, mEtaMax, nPtBins, ptMin, ptMax, nPhi3DBins, phiMin, phiMax);
- mHistConsEtaPtPhi3D->SetXTitle("cEta");
- mHistConsEtaPtPhi3D->SetYTitle("cPt (GeV/c)");
- mHistConsEtaPtPhi3D->SetZTitle("cPhi (rad)");
-   
- // Global EtaPtPhi
- mHistGlobEtaPtPhi3D = new TH3F("Flow_globEtaPtPhi3D", "Flow_globEtaPtPhi3D (constrainable)", mNEtaBins, mEtaMin, mEtaMax, nPtBins, ptMin, ptMax, nPhi3DBins, phiMin, phiMax);
- mHistGlobEtaPtPhi3D->SetXTitle("gEta");
- mHistGlobEtaPtPhi3D->SetYTitle("gPt (GeV/c)");
- mHistGlobEtaPtPhi3D->SetZTitle("gPhi (rad)");
-
- // UnConstrained EtaPtPhi
- mHistUncEtaPtPhi3D = new TH3F("Flow_uncEtaPtPhi3D", "Flow_uncEtaPtPhi3D (un-constrainable)", mNEtaBins, mEtaMin, mEtaMax, nPtBins, ptMin, ptMax, nPhi3DBins, phiMin, phiMax);
- mHistUncEtaPtPhi3D->SetXTitle("gEta");
- mHistUncEtaPtPhi3D->SetYTitle("gPt (GeV/c)");
- mHistUncEtaPtPhi3D->SetZTitle("gPhi (rad)");
-   
- // EtaPtPhi for particles correlated with the event plane
- mHistEtaPtPhi3DPart = new TH3F("Flow_EtaPtPhi3Dpart", "Flow_EtaPtPhi3Dpart (selected part)", mNEtaBins, mEtaMin, mEtaMax, nPtBins, ptMin, ptMax, nPhi3DBins, phiMin, phiMax);
- mHistEtaPtPhi3DPart->SetXTitle("Eta");
- mHistEtaPtPhi3DPart->SetYTitle("Pt (GeV/c)");
- mHistEtaPtPhi3DPart->SetZTitle("Phi (rad)");
-   
- // EtaPtPhi for particles NOT SELECTED for correlation with the event plane
- mHistEtaPtPhi3DOut = new TH3F("Flow_EtaPtPhi3Dout", "Flow_EtaPtPhi3Dout (NOT selected part)", mNEtaBins, mEtaMin, mEtaMax, nPtBins, ptMin, ptMax, nPhi3DBins, phiMin, phiMax);
- mHistEtaPtPhi3DOut->SetXTitle("Eta");
- mHistEtaPtPhi3DOut->SetYTitle("Pt (GeV/c)");
- mHistEtaPtPhi3DOut->SetZTitle("Phi (rad)");
-   
- // Yield Pt-Phi for all positive
- mHistPtPhiPos = new TH2D("Flow_PtPhi_Plus", "Flow_PtPhi_Plus", nPhiBins, phiMin, phiMax, 50, ptMin, ptMax);
- mHistPtPhiPos->Sumw2();
- mHistPtPhiPos->SetXTitle("Phi");
- mHistPtPhiPos->SetYTitle("Pt (GeV/c)");
-
- // Yield Pt-Phi for all negative
- mHistPtPhiNeg = new TH2D("Flow_PtPhi_Minus", "Flow_PtPhi_Minus", nPhiBins, phiMin, phiMax, 50, ptMin, ptMax);
- mHistPtPhiNeg->Sumw2();
- mHistPtPhiNeg->SetXTitle("Phi");
- mHistPtPhiNeg->SetYTitle("Pt (GeV/c)");
-   
- // Yield for all particles
- mHistYieldAll2D = new TH2D("Flow_YieldAll2D", "Flow_YieldAll2D", mNEtaBins, mEtaMin, mEtaMax, nPtBins, ptMin, ptMax);
- mHistYieldAll2D->Sumw2();
- mHistYieldAll2D->SetXTitle("Pseudorapidty");
- mHistYieldAll2D->SetYTitle("Pt (GeV/c)");
-
- // Yield for constrainable tracks
- mHistYieldCon2D = new TH2D("Flow_YieldCons2D", "Flow_YieldCons2D", mNEtaBins, mEtaMin, mEtaMax, nPtBins, ptMin, ptMax);
- mHistYieldCon2D->Sumw2();
- mHistYieldCon2D->SetXTitle("Pseudorapidty");
- mHistYieldCon2D->SetYTitle("Pt (GeV/c)");
-
- // Yield for un-constrainable tracks
- mHistYieldUnc2D = new TH2D("Flow_YieldUnc2D", "Flow_YieldUnc2D", mNEtaBins, mEtaMin, mEtaMax, nPtBins, ptMin, ptMax);
- mHistYieldUnc2D->Sumw2();
- mHistYieldUnc2D->SetXTitle("Pseudorapidty");
- mHistYieldUnc2D->SetYTitle("Pt (GeV/c)");
-
- // Yield for particles correlated with the event plane
- mHistYieldPart2D = new TH2D("Flow_YieldPart2D", "Flow_YieldPart2D (selected part)", mNEtaBins, mEtaMin, mEtaMax, nPtBinsPart, ptMin, ptMaxPart);
- mHistYieldPart2D->Sumw2();
- mHistYieldPart2D->SetXTitle((char*)xLabel.Data());
- mHistYieldPart2D->SetYTitle("Pt (GeV/c)");
-
- // Yield for particles NOT SELECTED for correlation with the event plane
- mHistYieldOut2D = new TH2D("Flow_YieldOut2D", "Flow_YieldOut2D (NOT selected part)", mNEtaBins, mEtaMin, mEtaMax, nPtBins, ptMin, ptMax);
- mHistYieldOut2D->Sumw2();
- mHistYieldOut2D->SetXTitle("Pseudorapidty");
- mHistYieldOut2D->SetYTitle("Pt (GeV/c)");
- // invariant Mass for all particles (from TOF)
- mHistInvMass = new TH1F("Flow_InvMass", "Flow_InvMass (tof)", nMassBins, massMin, massMax);
- mHistInvMass->SetXTitle("Invariant Mass (GeV)");
- mHistInvMass->SetYTitle("Counts");
- // invariant Mass for particles correlated with the event plane (from TOF)
- mHistInvMassPart = new TH1F("Flow_InvMassPart", "Flow_InvMassPart (tof)", nMassBins, massMin, massMax);
- mHistInvMassPart->SetXTitle("Invariant Mass (GeV)");
- mHistInvMassPart->SetYTitle("Counts");
- // invariant Mass for particles NOT SELECTED for correlation with the event plane (from TOF)
- mHistInvMassOut = new TH1F("Flow_InvMassOut", "Flow_InvMassOut (tof)", nMassBins, massMin, massMax);
- mHistInvMassOut->SetXTitle("Invariant Mass (GeV)");
- mHistInvMassOut->SetYTitle("Counts");
-
- // Mean Eta in each bin for particles correlated with the event plane
- mHistBinEta = new TProfile("Flow_Bin_Eta", "Flow_Bin_Eta_part (selected part)", mNEtaBins, mEtaMin, mEtaMax, mEtaMin, mEtaMax, "");
- mHistBinEta->SetXTitle((char*)xLabel.Data());
- mHistBinEta->SetYTitle((char*)xLabel.Data());
- // Mean Pt in each bin for particles correlated with the event plane
- mHistBinPt = new TProfile("Flow_Bin_Pt", "Flow_Bin_Pt_part (selected part)", nPtBinsPart, ptMin, ptMaxPart, ptMin, ptMaxPart, "");
- mHistBinPt->SetXTitle("Pt (GeV/c)");
- mHistBinPt->SetYTitle("<Pt> (GeV/c)");
- // cos(n*phiLab)
- mHistCosPhi = new TProfile("Flow_CosPhiLab", "Flow_CosPhiLab", Flow::nHars, 0.5, (float)(Flow::nHars) + 0.5, -100., 100., "");
- mHistCosPhi->SetXTitle("Harmonic");
- mHistCosPhi->SetYTitle("<cos(n*PhiLab)> (%)");
-   
- // PID pi+
- mHistPidPiPlus = new TH1F("Flow_PidPiPlus", "Flow_PidPiPlus", nPidBins, pidMin, pidMax);
- mHistPidPiPlus->SetXTitle("ALICE P.Id.");
- mHistPidPiPlus->SetYTitle("Counts");
-   
- // PID pi-
- mHistPidPiMinus = new TH1F("Flow_PidPiMinus", "Flow_PidPiMinus", nPidBins, pidMin, pidMax);
- mHistPidPiMinus->SetXTitle("ALICE P.Id.");
- mHistPidPiMinus->SetYTitle("Counts");
-   
- // PID proton
- mHistPidProton = new TH1F("Flow_PidProton", "Flow_PidProton", nPidBins, pidMin, pidMax);
- mHistPidProton->SetXTitle("ALICE P.Id.");
- mHistPidProton->SetYTitle("Counts");
-
- // PID anti proton
- mHistPidAntiProton = new TH1F("Flow_PidAntiProton", "Flow_PidAntiProton", nPidBins, pidMin, pidMax);
- mHistPidAntiProton->SetXTitle("ALICE P.Id.");
- mHistPidAntiProton->SetYTitle("Counts");
-
- // PID Kplus
- mHistPidKplus = new TH1F("Flow_PidKplus", "Flow_PidKplus", nPidBins, pidMin, pidMax);
- mHistPidKplus->SetXTitle("ALICE P.Id.");
- mHistPidKplus->SetYTitle("Counts");
-
- // PID Kminus
- mHistPidKminus = new TH1F("Flow_PidKminus", "Flow_PidKminus", nPidBins, pidMin, pidMax);
- mHistPidKminus->SetXTitle("ALICE P.Id.");
- mHistPidKminus->SetYTitle("Counts");
-
- // PID deuteron
- mHistPidDeuteron = new TH1F("Flow_PidDeuteron", "Flow_PidDeuteron", nPidBins, pidMin, pidMax);
- mHistPidDeuteron->SetXTitle("ALICE P.Id.");
- mHistPidDeuteron->SetYTitle("Counts");
-
- // PID anti deuteron
- mHistPidAntiDeuteron = new TH1F("Flow_PidAntiDeuteron", "Flow_PidAntiDeuteron", nPidBins, pidMin, pidMax);
- mHistPidAntiDeuteron->SetXTitle("ALICE P.Id.");
- mHistPidAntiDeuteron->SetYTitle("Counts");
-
- // PID electron
- mHistPidElectron = new TH1F("Flow_PidElectron", "Flow_PidElectron", nPidBins, pidMin, pidMax);
- mHistPidElectron->SetXTitle("ALICE P.Id.");
- mHistPidElectron->SetYTitle("Counts");
-
- // PID positron
- mHistPidPositron = new TH1F("Flow_PidPositron", "Flow_PidPositron", nPidBins, pidMin, pidMax);
- mHistPidPositron->SetXTitle("ALICE P.Id.");
- mHistPidPositron->SetYTitle("Counts");
-
- // PID Muon+
- mHistPidMuonPlus = new TH1F("Flow_PidMuonPlus", "Flow_PidMuonPlus", nPidBins, pidMin, pidMax);
- mHistPidMuonPlus->SetXTitle("ALICE P.Id.");
- mHistPidMuonPlus->SetYTitle("Counts");
-
- // PID Muon-
- mHistPidMuonMinus = new TH1F("Flow_PidMuonMinus", "Flow_PidMuonMinus", nPidBins, pidMin, pidMax);
- mHistPidMuonMinus->SetXTitle("ALICE P.Id.");
- mHistPidMuonMinus->SetYTitle("Counts");
-
- // PID pi+ selected
- mHistPidPiPlusPart = new TH1F("Flow_PidPiPlusPart", "Flow_PidPiPlusPart", nPidBins, pidMin, pidMax);
- mHistPidPiPlusPart->SetXTitle("ALICE P.Id. (pid = pi+)");
- mHistPidPiPlusPart->SetYTitle("Counts");
-   
- // PID pi- selected
- mHistPidPiMinusPart = new TH1F("Flow_PidPiMinusPart", "Flow_PidPiMinusPart", nPidBins, pidMin, pidMax);
- mHistPidPiMinusPart->SetXTitle("ALICE P.Id. (pid = pi-)");
- mHistPidPiMinusPart->SetYTitle("Counts");
-   
- // PID proton selected
- mHistPidProtonPart = new TH1F("Flow_PidProtonPart", "Flow_PidProtonPart", nPidBins, pidMin, pidMax);
- mHistPidProtonPart->SetXTitle("ALICE P.Id. (pid = p)");
- mHistPidProtonPart->SetYTitle("Counts");
-
- // PID anti proton selected
- mHistPidAntiProtonPart = new TH1F("Flow_PidAntiProtonPart", "Flow_PidAntiProtonPart", nPidBins, pidMin, pidMax);
- mHistPidAntiProtonPart->SetXTitle("ALICE P.Id. (pid = p-)");
- mHistPidAntiProtonPart->SetYTitle("Counts");
-
- // PID Kplus selected
- mHistPidKplusPart = new TH1F("Flow_PidKplusPart", "Flow_PidKplusPart", nPidBins, pidMin, pidMax);
- mHistPidKplusPart->SetXTitle("ALICE P.Id. (pid = K+)");
- mHistPidKplusPart->SetYTitle("Counts");
-
- // PID Kminus selected
- mHistPidKminusPart = new TH1F("Flow_PidKminusPart", "Flow_PidKminusPart", nPidBins, pidMin, pidMax);
- mHistPidKminusPart->SetXTitle("ALICE P.Id. (pid = K-)");
- mHistPidKminusPart->SetYTitle("Counts");
-
- // PID deuteron selected
- mHistPidDeuteronPart = new TH1F("Flow_PidDeuteronPart", "Flow_PidDeuteronPart", nPidBins, pidMin, pidMax);
- mHistPidDeuteronPart->SetXTitle("ALICE P.Id. (pid = d)");
- mHistPidDeuteronPart->SetYTitle("Counts");
-
- // PID anti deuteron selected
- mHistPidAntiDeuteronPart = new TH1F("Flow_PidAntiDeuteronPart", "Flow_PidAntiDeuteronPart", nPidBins, pidMin, pidMax);
- mHistPidAntiDeuteronPart->SetXTitle("ALICE P.Id. (pid = d--)");
- mHistPidAntiDeuteronPart->SetYTitle("Counts");
-
- // PID electron selected
- mHistPidElectronPart = new TH1F("Flow_PidElectronPart", "Flow_PidElectronPart", nPidBins, pidMin, pidMax);
- mHistPidElectronPart->SetXTitle("ALICE P.Id. (pid = e-)");
- mHistPidElectronPart->SetYTitle("Counts");
-
- // PID positron selected
- mHistPidPositronPart = new TH1F("Flow_PidPositronPart", "Flow_PidPositronPart", nPidBins, pidMin, pidMax);
- mHistPidPositronPart->SetXTitle("ALICE P.Id. (pid = e+)");
- mHistPidPositronPart->SetYTitle("Counts");
-
- // PID Muon+ selected
- mHistPidMuonPlusPart = new TH1F("Flow_PidMuonPlusPart", "Flow_PidMuonPlusPart", nPidBins, pidMin, pidMax);
- mHistPidMuonPlusPart->SetXTitle("ALICE P.Id. (pid = mu+)");
- mHistPidMuonPlusPart->SetYTitle("Counts");
-
- // PID Muon- selected
- mHistPidMuonMinusPart = new TH1F("Flow_PidMuonMinusPart", "Flow_PidMuonMinusPart", nPidBins, pidMin, pidMax);
- mHistPidMuonMinusPart->SetXTitle("ALICE P.Id. (pid = mu-)");
- mHistPidMuonMinusPart->SetYTitle("Counts");
-
- // PID multiplicities (all)
- mHistPidMult = new TProfile("Flow_PidMult", "Flow_PidMult", 15, 0.5, 15.5, "");
- mHistPidMult->SetXTitle("all, h+, h-, pi+, pi-, pr+, pr-, K+, K-, d+, d-, e-, e+, mu-, mu+");
- mHistPidMult->SetYTitle("Multiplicity");
-
- // PID for all tracks
- mHistBayPidMult = new TH1F("Flow_BayPidMult","Flow_BayPidMult",Flow::nPid,-0.5,((float)Flow::nPid-0.5));
- mHistBayPidMult->Sumw2() ;
- mHistBayPidMult->SetXTitle("e+/- , mu+/- , pi+/- , K+/- , p+/- , d+/- ");
- mHistBayPidMult->SetYTitle("Counts");
-   
- // PID for particles correlated with the event plane
- mHistBayPidMultPart = new TH1F("Flow_BayPidMult_Part","Flow_BayPidMult_Part",Flow::nPid,-0.5,((float)Flow::nPid-0.5));
- mHistBayPidMultPart->Sumw2() ;
- mHistBayPidMultPart->SetXTitle("e+/- , mu+/- , pi+/- , K+/- , p+/- , d+/- ");
- mHistBayPidMultPart->SetYTitle("Counts");
-
- // Centrality
- mHistCent = new TH1F("Flow_Cent", "Flow_Cent", nCentBins, centMin, centMax);
- mHistCent->SetXTitle("Centrality Bin");
- mHistCent->SetYTitle("Counts");
-   
- // Deposited Energy in ZDC
- mHistEnergyZDC = new TH2F("Flow_ZDC_E", "Flow_ZDC_E", 3, 0., 3., nZDCeBins, ZDCeMin, ZDCeMax);
- mHistEnergyZDC->SetXTitle("neutron , proton , e.m.");
- mHistEnergyZDC->SetYTitle("ZDC energy");
-
- // Part. versus Energy in ZDC
- mHistPartZDC = new TH1F("Flow_ZDC_Participants", "Flow_ZDC_Participants", nZDCpartBins, ZDCpartMin, ZDCpartMax);
- mHistPartZDC->SetXTitle("ZDC part");
- mHistPartZDC->SetYTitle("Counts");
-
- // MeanDedxPos TPC
- mHistMeanDedxPos2D = new TH2F("Flow_MeanDedxPos2D_TPC","Flow_MeanDedxPos2D_TPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
- mHistMeanDedxPos2D->SetXTitle("log(momentum) (GeV/c)");
- mHistMeanDedxPos2D->SetYTitle("mean dEdx (+)");
- // MeanDedxNeg TPC
- mHistMeanDedxNeg2D = new TH2F("Flow_MeanDedxNeg2D_TPC","Flow_MeanDedxNeg2D_TPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
- mHistMeanDedxNeg2D->SetXTitle("log(momentum) (GeV/c)");
- mHistMeanDedxNeg2D->SetYTitle("mean dEdx (-)");
-
- // MeanDedxPos ITS
- mHistMeanDedxPos2DITS = new TH2F("Flow_MeanDedxPos2D_ITS","Flow_MeanDedxPos2D_ITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
- mHistMeanDedxPos2DITS->SetXTitle("log(momentum) (GeV/c)");
- mHistMeanDedxPos2DITS->SetYTitle("mean dEdx (+)");
- // MeanDedxNeg ITS
- mHistMeanDedxNeg2DITS = new TH2F("Flow_MeanDedxNeg2D_ITS","Flow_MeanDedxNeg2D_ITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
- mHistMeanDedxNeg2DITS->SetXTitle("log(momentum) (GeV/c)");
- mHistMeanDedxNeg2DITS->SetYTitle("mean dEdx (-)");
-
- // MeanDedxPos TPC 3D selected Part
- mHistMeanDedxPos3DPart = new TH3F("Flow_MeanDedxPos3DPart_TPC","Flow_MeanDedxPos3DPart_TPC", nMomenBins, logpMin, logpMax, nDedxBins, 0., dEdxMaxTPC, Flow::nPid, 0., Flow::nPid);
- mHistMeanDedxPos3DPart->SetXTitle("log(momentum) (GeV/c)");
- mHistMeanDedxPos3DPart->SetYTitle("mean dEdx (+)");
- mHistMeanDedxPos3DPart->SetZTitle("e , mu , pi , k , p , d");
- // MeanDedxNeg TPC 3D selected Part
- mHistMeanDedxNeg3DPart = new TH3F("Flow_MeanDedxNeg3DPart_TPC","Flow_MeanDedxNeg3DPart_TPC", nMomenBins, logpMin, logpMax, nDedxBins, 0., dEdxMaxTPC, Flow::nPid, 0., Flow::nPid);
- mHistMeanDedxNeg3DPart->SetXTitle("log(momentum) (GeV/c)");
- mHistMeanDedxNeg3DPart->SetYTitle("mean dEdx (-)");
- mHistMeanDedxNeg3DPart->SetZTitle("e , mu , pi , k , p , d");
-
- // MeanDedxPos ITS 3D selected Part
- mHistMeanDedxPos3DPartITS = new TH3F("Flow_MeanDedxPos3DPart_ITS","Flow_MeanDedxPos3DPart_ITS", nMomenBins, logpMin, logpMax, nDedxBins, 0., dEdxMax, Flow::nPid, 0., Flow::nPid);
- mHistMeanDedxPos3DPartITS->SetXTitle("log(momentum) (GeV/c)");
- mHistMeanDedxPos3DPartITS->SetYTitle("mean dEdx (+)");
- mHistMeanDedxPos3DPartITS->SetZTitle("e , mu , pi , k , p , d");
- // MeanDedxNeg ITS 3D selected Part
- mHistMeanDedxNeg3DPartITS = new TH3F("Flow_MeanDedxNeg3DPart_ITS","Flow_MeanDedxNeg3DPart_ITS", nMomenBins, logpMin, logpMax, nDedxBins, 0., dEdxMax, Flow::nPid, 0., Flow::nPid);
- mHistMeanDedxNeg3DPartITS->SetXTitle("log(momentum) (GeV/c)");
- mHistMeanDedxNeg3DPartITS->SetYTitle("mean dEdx (-)");
- mHistMeanDedxNeg3DPartITS->SetZTitle("e , mu , pi , k , p , d");
-
- // MeanSignalPos TRD
- mHistMeanDedxPos2DTRD = new TH2F("Flow_MeanSignalPos2D_TRD","Flow_MeanSignalPos2D_TRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
- mHistMeanDedxPos2DTRD->SetXTitle("log(momentum) (GeV/c)");
- mHistMeanDedxPos2DTRD->SetYTitle("mean TRD (+)");
- // MeanSignalNeg TRD
- mHistMeanDedxNeg2DTRD = new TH2F("Flow_MeanSignalNeg2D_TRD","Flow_MeanSignalNeg2D_TRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
- mHistMeanDedxNeg2DTRD->SetXTitle("log(momentum) (GeV/c)");
- mHistMeanDedxNeg2DTRD->SetYTitle("mean TRD (-)");
-
- // MeanTimePos TOF
- mHistMeanDedxPos2DTOF = new TH2F("Flow_MeanTimePos2D_TOF","Flow_MeanTimePos2D_TOF", nMomenBins, logpMin, logpMax, nTofBins, TOFmin, TOFmax);
- mHistMeanDedxPos2DTOF->SetXTitle("log(momentum) (GeV/c)");
- mHistMeanDedxPos2DTOF->SetYTitle("mean Time of Flight (+)");
- // MeanTimeNeg TOF
- mHistMeanDedxNeg2DTOF = new TH2F("Flow_MeanTimeNeg2D_TOF","Flow_MeanTimeNeg2D_TOF", nMomenBins, logpMin, logpMax, nTofBins, TOFmin, TOFmax);
- mHistMeanDedxNeg2DTOF->SetXTitle("log(momentum) (GeV/c)");
- mHistMeanDedxNeg2DTOF->SetYTitle("mean Time of Flight (-)");
- // Detector response for each particle { ... 
- // MeanDedx PiPlus - TPC
- mHistMeanTPCPiPlus = new TH2F("Flow_MeanDedxPiPlusTPC", "Flow_MeanDedxPiPlusTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
- mHistMeanTPCPiPlus->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTPCPiPlus->SetYTitle("mean dEdx (pi+)");
- // MeanDedx PiMinus
- mHistMeanTPCPiMinus = new TH2F("Flow_MeanDedxPiMinusTPC", "Flow_MeanDedxPiMinusTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
- mHistMeanTPCPiMinus->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTPCPiMinus->SetYTitle("mean dEdx (pi-)");
- // MeanDedx Proton
- mHistMeanTPCProton = new TH2F("Flow_MeanDedxProtonTPC", "Flow_MeanDedxProtonTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
- mHistMeanTPCProton->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTPCProton->SetYTitle("mean dEdx (pr+)");
- // MeanDedx Pbar
- mHistMeanTPCPbar = new TH2F("Flow_MeanDedxPbarTPC", "Flow_MeanDedxPbarTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
- mHistMeanTPCPbar->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTPCPbar->SetYTitle("mean dEdx (pr-)");
- // MeanDedx Kplus
- mHistMeanTPCKplus = new TH2F("Flow_MeanDedxKplusTPC", "Flow_MeanDedxKplusTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
- mHistMeanTPCKplus->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTPCKplus->SetYTitle("mean dEdx (K+)");
- // MeanDedx Kminus
- mHistMeanTPCKminus = new TH2F("Flow_MeanDedxKminusTPC", "Flow_MeanDedxKminusTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
- mHistMeanTPCKminus->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTPCKminus->SetYTitle("mean dEdx (K-)");
- // MeanDedx Deuteron
- mHistMeanTPCDeuteron = new TH2F("Flow_MeanDedxDeuteronTPC", "Flow_MeanDedxDeuteronTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
- mHistMeanTPCDeuteron->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTPCDeuteron->SetYTitle("mean dEdx (d+)");
- // MeanDedx AntiDeuteron
- mHistMeanTPCAntiDeuteron = new TH2F("Flow_MeanDedxAntiDeuteronTPC", "Flow_MeanDedxAntiDeuteronTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
- mHistMeanTPCAntiDeuteron->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTPCAntiDeuteron->SetYTitle("mean dEdx (d-)");
- // MeanDedxElectron
- mHistMeanTPCElectron = new TH2F("Flow_MeanDedxElectronTPC", "Flow_MeanDedxElectronTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
- mHistMeanTPCElectron->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTPCElectron->SetYTitle("mean dEdx (e-)");
- // MeanDedx Positron
- mHistMeanTPCPositron = new TH2F("Flow_MeanDedxPositronTPC", "Flow_MeanDedxPositronTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
- mHistMeanTPCPositron->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTPCPositron->SetYTitle("mean dEdx (e+)");
- // MeanDedx MuonPlus
- mHistMeanTPCMuonPlus = new TH2F("Flow_MeanDedxMuonPlusTPC", "Flow_MeanDedxMuonPlusTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
- mHistMeanTPCMuonPlus->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTPCMuonPlus->SetYTitle("mean dEdx (mu+)");
- // MeanDedx MuonMinus
- mHistMeanTPCMuonMinus = new TH2F("Flow_MeanDedxMuonMinusTPC", "Flow_MeanDedxMuonMinusTPC", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMaxTPC);
- mHistMeanTPCMuonMinus->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTPCMuonMinus->SetYTitle("mean dEdx (mu-)");
- // MeanDedx PiPlus - ITS
- mHistMeanITSPiPlus = new TH2F("Flow_MeanDedxPiPlusITS", "Flow_MeanDedxPiPlusITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
- mHistMeanITSPiPlus->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanITSPiPlus->SetYTitle("mean dEdx (pi+)");
- // MeanDedx PiMinus
- mHistMeanITSPiMinus = new TH2F("Flow_MeanDedxPiMinusITS", "Flow_MeanDedxPiMinusITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
- mHistMeanITSPiMinus->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanITSPiMinus->SetYTitle("mean dEdx (pi-)");
- // MeanDedx Proton
- mHistMeanITSProton = new TH2F("Flow_MeanDedxProtonITS", "Flow_MeanDedxProtonITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
- mHistMeanITSProton->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanITSProton->SetYTitle("mean dEdx (pr+)");
- // MeanDedx Pbar
- mHistMeanITSPbar = new TH2F("Flow_MeanDedxPbarITS", "Flow_MeanDedxPbarITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
- mHistMeanITSPbar->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanITSPbar->SetYTitle("mean dEdx (pr-)");
- // MeanDedx Kplus
- mHistMeanITSKplus = new TH2F("Flow_MeanDedxKplusITS", "Flow_MeanDedxKplusITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
- mHistMeanITSKplus->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanITSKplus->SetYTitle("mean dEdx (K+)");
- // MeanDedx Kminus
- mHistMeanITSKminus = new TH2F("Flow_MeanDedxKminusITS", "Flow_MeanDedxKminusITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
- mHistMeanITSKminus->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanITSKminus->SetYTitle("mean dEdx (K-)");
- // MeanDedx Deuteron
- mHistMeanITSDeuteron = new TH2F("Flow_MeanDedxDeuteronITS", "Flow_MeanDedxDeuteronITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
- mHistMeanITSDeuteron->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanITSDeuteron->SetYTitle("mean dEdx (d+)");
- // MeanDedx AntiDeuteron
- mHistMeanITSAntiDeuteron = new TH2F("Flow_MeanDedxAntiDeuteronITS", "Flow_MeanDedxAntiDeuteronITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
- mHistMeanITSAntiDeuteron->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanITSAntiDeuteron->SetYTitle("mean dEdx (d-)");
- // MeanDedx Electron
- mHistMeanITSElectron = new TH2F("Flow_MeanDedxElectronITS", "Flow_MeanDedxElectronITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
- mHistMeanITSElectron->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanITSElectron->SetYTitle("mean dEdx (e-)");
- // MeanDedx Positron
- mHistMeanITSPositron = new TH2F("Flow_MeanDedxPositronITS", "Flow_MeanDedxPositronITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
- mHistMeanITSPositron->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanITSPositron->SetYTitle("mean dEdx (e+)");
- // MeanDedx MuonPlus
- mHistMeanITSMuonPlus = new TH2F("Flow_MeanDedxMuonPlusITS", "Flow_MeanDedxMuonPlusITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
- mHistMeanITSMuonPlus->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanITSMuonPlus->SetYTitle("mean dEdx (mu+)");
- // MeanDedx MuonMinus
- mHistMeanITSMuonMinus = new TH2F("Flow_MeanDedxMuonMinusITS", "Flow_MeanDedxMuonMinusITS", nMomenBins, logpMin, logpMax, nDedxBins, 0, dEdxMax);
- mHistMeanITSMuonMinus->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanITSMuonMinus->SetYTitle("mean dEdx (mu-)");
- // MeanTrd PiPlus - TRD
- mHistMeanTRDPiPlus = new TH2F("Flow_MeanTrdPiPlusTRD", "Flow_MeanTrdPiPlusTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
- mHistMeanTRDPiPlus->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTRDPiPlus->SetYTitle("mean t.r.[] (pi+)");
- // MeanTrd PiMinus
- mHistMeanTRDPiMinus = new TH2F("Flow_MeanTrdPiMinusTRD", "Flow_MeanTrdPiMinusTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
- mHistMeanTRDPiMinus->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTRDPiMinus->SetYTitle("mean t.r.[] (pi-)");
- // MeanTrd Proton
- mHistMeanTRDProton = new TH2F("Flow_MeanTrdProtonTRD", "Flow_MeanTrdProtonTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
- mHistMeanTRDProton->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTRDProton->SetYTitle("mean t.r.[] (pr+)");
- // MeanTrd Pbar
- mHistMeanTRDPbar = new TH2F("Flow_MeanTrdPbarTRD", "Flow_MeanTrdPbarTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
- mHistMeanTRDPbar->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTRDPbar->SetYTitle("mean t.r.[] (pr-)");
- // MeanTrd Kplus
- mHistMeanTRDKplus = new TH2F("Flow_MeanTrdKplusTRD", "Flow_MeanTrdKplusTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
- mHistMeanTRDKplus->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTRDKplus->SetYTitle("mean t.r.[] (K+)");
- // MeanTrd Kminus
- mHistMeanTRDKminus = new TH2F("Flow_MeanTrdKminusTRD", "Flow_MeanTrdKminusTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
- mHistMeanTRDKminus->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTRDKminus->SetYTitle("mean t.r.[] (K-)");
- // MeanTrd Deuteron
- mHistMeanTRDDeuteron = new TH2F("Flow_MeanTrdDeuteronTRD", "Flow_MeanTrdDeuteronTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
- mHistMeanTRDDeuteron->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTRDDeuteron->SetYTitle("mean t.r.[] (d+)");
- // MeanTrd AntiDeuteron
- mHistMeanTRDAntiDeuteron = new TH2F("Flow_MeanTrdAntiDeuteronTRD", "Flow_MeanTrdAntiDeuteronTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
- mHistMeanTRDAntiDeuteron->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTRDAntiDeuteron->SetYTitle("mean t.r.[] (d-)");
- // MeanTrd Electron
- mHistMeanTRDElectron = new TH2F("Flow_MeanTrdElectronTRD", "Flow_MeanTrdElectronTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
- mHistMeanTRDElectron->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTRDElectron->SetYTitle("mean t.r.[] (e-)");
- // MeanTrd Positron
- mHistMeanTRDPositron = new TH2F("Flow_MeanTrdPositronTRD", "Flow_MeanTrdPositronTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
- mHistMeanTRDPositron->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTRDPositron->SetYTitle("mean t.r.[] (e+)");
- // MeanTrd MuonPlus
- mHistMeanTRDMuonPlus = new TH2F("Flow_MeanTrdMuonPlusTRD", "Flow_MeanTrdMuonPlusTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
- mHistMeanTRDMuonPlus->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTRDMuonPlus->SetYTitle("mean t.r.[] (mu+)");
- // MeanTrd MuonMinus
- mHistMeanTRDMuonMinus = new TH2F("Flow_MeanTrdMuonMinusTRD", "Flow_MeanTrdMuonMinusTRD", nMomenBins, logpMin, logpMax, nTrdBins, 0, TRDmax);
- mHistMeanTRDMuonMinus->SetXTitle("Log10(p) (GeV/c)");
- mHistMeanTRDMuonMinus->SetYTitle("mean t.r.[] (mu-)");
- // T.O.F. PiPlus - TOF
- mHistMeanTOFPiPlus = new TH2F("Flow_MeanTofPiPlusTOF", "Flow_MeanTofPiPlusTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
- mHistMeanTOFPiPlus->SetXTitle("invariant mass (GeV)");
- mHistMeanTOFPiPlus->SetYTitle("mean t.o.f.[psec] (pi+)");
- // MeanTof PiMinus
- mHistMeanTOFPiMinus = new TH2F("Flow_MeanTofPiMinusTOF", "Flow_MeanTofPiMinusTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
- mHistMeanTOFPiMinus->SetXTitle("invariant mass (GeV)");
- mHistMeanTOFPiMinus->SetYTitle("mean t.o.f.[psec] (pi-)");
- // MeanTof Proton
- mHistMeanTOFProton = new TH2F("Flow_MeanTofProtonTOF", "Flow_MeanTofProtonTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
- mHistMeanTOFProton->SetXTitle("invariant mass (GeV)");
- mHistMeanTOFProton->SetYTitle("mean t.o.f.[psec] (pr+)");
- // Mean TofPbar
- mHistMeanTOFPbar = new TH2F("Flow_MeanTofPbarTOF", "Flow_MeanTofPbarTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
- mHistMeanTOFPbar->SetXTitle("invariant mass (GeV)");
- mHistMeanTOFPbar->SetYTitle("mean t.o.f.[psec] (pr-)");
- // mean t.o.f.[psec]Kplus
- mHistMeanTOFKplus = new TH2F("Flow_MeanTofKplusTOF", "Flow_MeanTofKplusTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
- mHistMeanTOFKplus->SetXTitle("invariant mass (GeV)");
- mHistMeanTOFKplus->SetYTitle("mean t.o.f.[psec] (K+)");
- // mean t.o.f.[psec]Kminus
- mHistMeanTOFKminus = new TH2F("Flow_MeanTofKminusTOF", "Flow_MeanTofKminusTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
- mHistMeanTOFKminus->SetXTitle("invariant mass (GeV)");
- mHistMeanTOFKminus->SetYTitle("mean t.o.f.[psec] (K-)");
- // MeanTof Deuteron
- mHistMeanTOFDeuteron = new TH2F("Flow_MeanTofDeuteronTOF", "Flow_MeanTofDeuteronTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
- mHistMeanTOFDeuteron->SetXTitle("invariant mass (GeV)");
- mHistMeanTOFDeuteron->SetYTitle("mean t.o.f.[psec] (d+)");
- // MeanTof AntiDeuteron
- mHistMeanTOFAntiDeuteron = new TH2F("Flow_MeanTofAntiDeuteronTOF", "Flow_MeanTofAntiDeuteronTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
- mHistMeanTOFAntiDeuteron->SetXTitle("invariant mass (GeV)");
- mHistMeanTOFAntiDeuteron->SetYTitle("mean t.o.f.[psec] (d-)");
- // MeanTof Electron
- mHistMeanTOFElectron = new TH2F("Flow_MeanTofElectronTOF", "Flow_MeanTofElectronTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
- mHistMeanTOFElectron->SetXTitle("invariant mass (GeV)");
- mHistMeanTOFElectron->SetYTitle("mean t.o.f.[psec] (e-)");
- // MeanTof Positron
- mHistMeanTOFPositron = new TH2F("Flow_MeanTofPositronTOF", "Flow_MeanTofPositronTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
- mHistMeanTOFPositron->SetXTitle("invariant mass (GeV)");
- mHistMeanTOFPositron->SetYTitle("mean t.o.f.[psec] (e+)");
- // MeanTof MuonPlus
- mHistMeanTOFMuonPlus = new TH2F("Flow_MeanTofMuonPlusTOF", "Flow_MeanTofMuonPlusTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
- mHistMeanTOFMuonPlus->SetXTitle("invariant mass (GeV)");
- mHistMeanTOFMuonPlus->SetYTitle("mean t.o.f.[psec] (mu+)");
- // MeanTof MuonMinus
- mHistMeanTOFMuonMinus = new TH2F("Flow_MeanTofMuonMinusTOF", "Flow_MeanTofMuonMinusTOF", nMassBins, massMin, massMax, nTofBins, TOFmin, TOFmax);
- mHistMeanTOFMuonMinus->SetXTitle("invariant mass (GeV)");
- mHistMeanTOFMuonMinus->SetYTitle("mean t.o.f.[psec] (mu-)");
- // ... }
-
- TString* histTitle;
- for (int n = 0; n < Flow::nSubs; n++) // for sub-events
- {
-  for (int k = 0; k < Flow::nSels; k++) 
-  {
-   for (int j = 0; j < Flow::nHars; j++) 
-   {
-    float order = (float)(j + 1);
-    int i = Flow::nSubs * k + n ;
-
-    // event planes
-    histTitle = new TString("Flow_Psi_Sub");
-    *histTitle += n+1;
-    histTitle->Append("_Sel");
-    *histTitle += k+1;
-    histTitle->Append("_Har");
-    *histTitle += j+1;
-    histSub[i].histSubHar[j].mHistPsiSubs = new TH1F(histTitle->Data(),histTitle->Data(), nPsiBins, psiMin, (psiMax / order));
-    histSub[i].histSubHar[j].mHistPsiSubs->SetXTitle("Event Plane Angle (rad)");
-    histSub[i].histSubHar[j].mHistPsiSubs->SetYTitle("Counts");
-    delete histTitle;
-   }
-  }
- }
- if(mV0)            // All V0s (if there, if flag on)
- {
- // Mass
-  mHistV0Mass = new TH1F("FlowV0_InvMass", "FlowV0_InvMass", nMassBins, massMin, massMax);
-  mHistV0Mass->SetXTitle("Invariant Mass (GeV)");
-  mHistV0Mass->SetYTitle("Counts");
- // Distance of closest approach
-  mHistV0Dca = new TH1F("FlowV0_Dca", "FlowV0_Dca", nDcaBins, dcaMin, glDcaMax);
-  mHistV0Dca->SetXTitle("dca between tracks (cm)");
-  mHistV0Dca->SetYTitle("Counts");
- // lenght
-  mHistV0Lenght = new TH1F("FlowV0_Lenght", "FlowV0_Lenght", nLgBins, lgMinV0, lgMaxV0);
-  mHistV0Lenght->SetXTitle("Distance of V0s (cm)");
-  mHistV0Lenght->SetYTitle("Counts");
- // Sigma for all particles
-  mHistV0Sigma = new TH1F("FlowV0_Sigma", "FlowV0_Sigma", nLgBins, lgMinV0, lgMaxV0 );
-  mHistV0Sigma->SetXTitle("Sigma");
-  mHistV0Sigma->SetYTitle("Counts");
- // Chi2 
-  mHistV0Chi2 = new TH1F("FlowV0_Chi2", "FlowV0_Chi2", nChi2Bins, chi2Min, chi2MaxC);
-  mHistV0Chi2->SetXTitle("Chi square at Main Vertex");
-  mHistV0Chi2->SetYTitle("Counts");
- // EtaPtPhi
-  mHistV0EtaPtPhi3D = new TH3F("FlowV0_EtaPtPhi3D", "FlowV0_EtaPtPhi3D", mNEtaBins, mEtaMin, mEtaMax, nPtBins, ptMin, ptMax, nPhi3DBins, phiMin, phiMax);
-  mHistV0EtaPtPhi3D->SetXTitle("Eta");
-  mHistV0EtaPtPhi3D->SetYTitle("Pt (GeV/c)");
-  mHistV0EtaPtPhi3D->SetZTitle("Phi (rad)");
- // Yield for all v0s
-  mHistV0YieldAll2D = new TH2D("FlowV0_YieldAll2D", "FlowV0_YieldAll2D", mNEtaBins, mEtaMin, mEtaMax, nPtBins, ptMin, ptMax);
-  mHistV0YieldAll2D->Sumw2();
-  mHistV0YieldAll2D->SetXTitle("Pseudorapidty");
-  mHistV0YieldAll2D->SetYTitle("Pt (GeV/c)");
- // Mass slices on pT
-  mHistV0MassPtSlices = new TH2D("FlowV0_MassPtSlices", "FlowV0_MassPtSlices", nMassBins, massMin, massMax, nPtBins, ptMin, ptMax);
-  mHistV0MassPtSlices->Sumw2();
-  mHistV0MassPtSlices->SetXTitle("Invariant Mass (GeV)");
-  mHistV0MassPtSlices->SetYTitle("Pt (GeV/c)");
-
- // Selected V0s ...  
- // Yield 
-  mHistV0YieldPart2D = new TH2D("FlowV0_Yield2Dsel", "FlowV0_Yield2Dsel", mNEtaBins, mEtaMin, mEtaMax, nPtBins, ptMin, ptMax);
-  mHistV0YieldPart2D->Sumw2();
-  mHistV0YieldPart2D->SetXTitle("Pseudorapidty");
-  mHistV0YieldPart2D->SetYTitle("Pt (GeV/c)");
- // Mass Window
-  mHistV0MassWin = new TH1F("FlowV0_MassWinPart", "FlowV0_MassWinPart", nMassBins, massMin, massMax);
-  mHistV0MassWin->SetXTitle("Invariant Mass (GeV)");
-  mHistV0MassWin->SetYTitle("Counts");
- // EtaPtPhi
-  mHistV0EtaPtPhi3DPart = new TH3F("FlowV0_EtaPtPhi3Dpart", "FlowV0_EtaPtPhi3Dpart", mNEtaBins, mEtaMin, mEtaMax, nPtBins, ptMin, ptMax, nPhi3DBins, phiMin, phiMax);
-  mHistV0EtaPtPhi3DPart->SetXTitle("Eta");
-  mHistV0EtaPtPhi3DPart->SetYTitle("Pt (GeV/c)");
-  mHistV0EtaPtPhi3DPart->SetZTitle("Phi (rad)");
- // Distance of closest approach
-  mHistV0DcaPart = new TH1F("FlowV0_DcaPart", "FlowV0_DcaPart", nDcaBins, dcaMin, dcaMax);
-  mHistV0DcaPart->Sumw2();
-  mHistV0DcaPart->SetXTitle("dca between tracks (cm)");
-  mHistV0DcaPart->SetYTitle("Counts");
- // lenght
-  mHistV0LenghtPart = new TH1F("FlowV0_LenghtPart", "FlowV0_LenghtPart", nLgBins, lgMinV0, lgMaxV0);
-  mHistV0LenghtPart->SetXTitle("Distance of V0s (cm)");
-  mHistV0LenghtPart->SetYTitle("Counts");
- // SideBand Mass (sidebands)
-  mHistV0sbMassSide = new TH1F("FlowV0sb_MassWinSideBands", "FlowV0sb_MassWinSideBands", nMassBins, massMin, massMax);
-  mHistV0sbMassSide->SetXTitle("Invariant Mass (GeV)");
-  mHistV0sbMassSide->SetYTitle("Counts");
- // EtaPtPhi (sidebands)
-  mHistV0sbEtaPtPhi3DPart = new TH3F("FlowV0sb_EtaPtPhi3D", "FlowV0sb_EtaPtPhi3D", mNEtaBins, mEtaMin, mEtaMax, nPtBins, ptMin, ptMax, nPhi3DBins, phiMin, phiMax);
-  mHistV0sbEtaPtPhi3DPart->SetXTitle("Eta");
-  mHistV0sbEtaPtPhi3DPart->SetYTitle("Pt (GeV/c)");
-  mHistV0sbEtaPtPhi3DPart->SetZTitle("Phi (rad)");
- // Distance of closest approach (sidebands)
-  mHistV0sbDcaPart = new TH1F("FlowV0sb_Dca", "FlowV0sb_Dca", nDcaBins, dcaMin, dcaMax);
-  mHistV0sbDcaPart->Sumw2();
-  mHistV0sbDcaPart->SetXTitle("dca between tracks (cm)");
-  mHistV0sbDcaPart->SetYTitle("Counts");
- // lenght (sidebands)
-  mHistV0sbLenghtPart = new TH1F("FlowV0sb_Lenght", "FlowV0sb_Lenght", nLgBins, lgMinV0, lgMaxV0);
-  mHistV0sbLenghtPart->SetXTitle("Distance of V0s (cm)");
-  mHistV0sbLenghtPart->SetYTitle("Counts");
-
- // Mean Eta in each bin
-  mHistV0BinEta = new TProfile("FlowV0_Bin_Eta", "FlowV0_Bin_Eta", mNEtaBins, mEtaMin, mEtaMax, mEtaMin, mEtaMax, "");
-  mHistV0BinEta->SetXTitle((char*)xLabel.Data());
-  mHistV0BinEta->SetYTitle("<Eta>");
- // Mean Pt in each bin
-  mHistV0BinPt = new TProfile("FlowV0_Bin_Pt", "FlowV0_Bin_Pt", nPtBinsPart, ptMin, ptMaxPart, ptMin, ptMaxPart, "");
-  mHistV0BinPt->SetXTitle("Pt (GeV/c)");
-  mHistV0BinPt->SetYTitle("<Pt> (GeV/c)");
- // Mean Eta in each bin (sidebands)
-  mHistV0sbBinEta = new TProfile("FlowV0sb_Bin_Eta", "FlowV0sb_Bin_Eta", mNEtaBins, mEtaMin, mEtaMax, mEtaMin, mEtaMax, "");
-  mHistV0sbBinEta->SetXTitle((char*)xLabel.Data());
-  mHistV0sbBinEta->SetYTitle("<Eta>");
- // Mean Pt in each bin (sidebands)
-  mHistV0sbBinPt = new TProfile("FlowV0sb_Bin_Pt", "FlowV0sb_Bin_Pt", nPtBinsPart, ptMin, ptMaxPart, ptMin, ptMaxPart, "");
-  mHistV0sbBinPt->SetXTitle("Pt (GeV/c)");
-  mHistV0sbBinPt->SetYTitle("<Pt> (GeV/c)");
- }
-
- for (int k = 0; k < Flow::nSels; k++) // for each selection
- {
-  // cos(n*delta_Psi)
-  histTitle = new TString("Flow_Cos_Sel");
-  *histTitle += k+1;
-  histFull[k].mHistCos = new TProfile(histTitle->Data(), histTitle->Data(), Flow::nHars, 0.5, (float)(Flow::nHars) + 0.5, -1., 1., "");
-  histFull[k].mHistCos->SetXTitle("Harmonic");
-  histFull[k].mHistCos->SetYTitle("<cos(n*delta_Psi)>");
-  delete histTitle;
-   
-  // resolution
-  histTitle = new TString("Flow_Res_Sel");
-  *histTitle += k+1;
-  histFull[k].mHistRes = new TH1F(histTitle->Data(), histTitle->Data(), Flow::nHars, 0.5, (float)(Flow::nHars) + 0.5);
-  histFull[k].mHistRes->SetXTitle("Harmonic");
-  histFull[k].mHistRes->SetYTitle("Resolution");
-  delete histTitle;
-
-  // vObs
-  histTitle = new TString("Flow_vObs_Sel");
-  *histTitle += k+1;
-  histFull[k].mHist_vObs = new TProfile(histTitle->Data(), histTitle->Data(), Flow::nHars, 0.5, (float)(Flow::nHars) + 0.5, -100., 100., "");
-  histFull[k].mHist_vObs->SetXTitle("Harmonic");
-  histFull[k].mHist_vObs->SetYTitle("vObs (%)");
-  delete histTitle;
-
-  // vObs V0
-  histTitle = new TString("FlowV0_vObs_Sel");
-  *histTitle += k+1;
-  histFull[k].mHistV0_vObs = new TProfile(histTitle->Data(), histTitle->Data(), Flow::nHars, 0.5, (float)(Flow::nHars) + 0.5, -100., 100., "");
-  histFull[k].mHistV0_vObs->SetXTitle("Harmonic");
-  histFull[k].mHistV0_vObs->SetYTitle("vObs (%)");
-  delete histTitle;
-   
-  // vObs V0 sideband SX
-  histTitle = new TString("FlowV0sb_vObs_sx_Sel");
-  *histTitle += k+1;
-  histFull[k].mHistV0sb_vObs_sx = new TProfile(histTitle->Data(), histTitle->Data(), Flow::nHars, 0.5, (float)(Flow::nHars) + 0.5, -100., 100., "");
-  histFull[k].mHistV0sb_vObs_sx->SetXTitle("Harmonic");
-  histFull[k].mHistV0sb_vObs_sx->SetYTitle("vObs (%)");
-  delete histTitle;
-   
-  // vObs V0 sideband DX
-  histTitle = new TString("FlowV0sb_vObs_dx_Sel");
-  *histTitle += k+1;
-  histFull[k].mHistV0sb_vObs_dx = new TProfile(histTitle->Data(), histTitle->Data(), Flow::nHars, 0.5, (float)(Flow::nHars) + 0.5, -100., 100., "");
-  histFull[k].mHistV0sb_vObs_dx->SetXTitle("Harmonic");
-  histFull[k].mHistV0sb_vObs_dx->SetYTitle("vObs (%)");
-  delete histTitle;
-   
-  // PID for tracks used in R.P.
-  histTitle = new TString("Flow_BayPidMult_Sel");
-  *histTitle += k+1;
-  histFull[k].mHistBayPidMult = new TH1F(histTitle->Data(), histTitle->Data(),Flow::nPid,-0.5,((float)Flow::nPid-0.5));
-  histFull[k].mHistBayPidMult->Sumw2() ;
-  histFull[k].mHistBayPidMult->SetXTitle("e+/-  ,  mu+/-  ,  pi+/-  ,  K+/-  ,  p+/-  ,  d+/- ");
-  histFull[k].mHistBayPidMult->SetYTitle("Counts");
-  delete histTitle;
-
-  for (int j = 0; j < Flow::nHars; j++)   // for each harmonic
-  {
-   float order  = (float)(j+1);
-
-   // multiplicity
-   histTitle = new TString("Flow_Mul_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistMult = new TH1F(histTitle->Data(),histTitle->Data(), nMultBins, multMin, multMax);
-   histFull[k].histFullHar[j].mHistMult->SetXTitle("Multiplicity");
-   histFull[k].histFullHar[j].mHistMult->SetYTitle("Counts");
-   delete histTitle;
-
-   // event plane
-   histTitle = new TString("Flow_Psi_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistPsi = new TH1F(histTitle->Data(), histTitle->Data(), nPsiBins, psiMin, psiMax / order);
-   histFull[k].histFullHar[j].mHistPsi->SetXTitle("Event Plane Angle (rad)");
-   histFull[k].histFullHar[j].mHistPsi->SetYTitle("Counts");
-   delete histTitle;
-     
-   // event plane difference of two selections
-   histTitle = new TString("Flow_Psi_Diff_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   if (k == 0 ) 
-   {
-    Int_t my_order = 1;
-    if (j == 1) { my_order = 2 ; }
-    histFull[k].histFullHar[j].mHistPsi_Diff = new TH1F(histTitle->Data(), histTitle->Data(), nPsiBins, -psiMax/my_order/2., psiMax/my_order/2.);
-   } 
-   else 
-   {
-    histFull[k].histFullHar[j].mHistPsi_Diff = new TH1F(histTitle->Data(), histTitle->Data(), nPsiBins, -psiMax/2., psiMax/2.);
-   }
-   if (k == 0) 
-   {
-    if (j == 0) 
-    {
-     histFull[k].histFullHar[j].mHistPsi_Diff->SetXTitle("#Psi_{1,Sel1} - #Psi_{1,Sel2}(rad)");
-    } 
-    else if (j == 1) 
-    {
-     histFull[k].histFullHar[j].mHistPsi_Diff->SetXTitle("#Psi_{2,Sel1} - #Psi_{2,Sel2}(rad)");
-    }
-   } 
-   else if (k == 1) 
-   {
-    if (j == 0) 
-    {  
-     histFull[k].histFullHar[j].mHistPsi_Diff->SetXTitle("#Psi_{1,Sel1} - #Psi_{2,Sel2}(rad)");
-    } 
-    else if (j == 1) 
-    {
-     histFull[k].histFullHar[j].mHistPsi_Diff->SetXTitle("#Psi_{1,Sel1} - #Psi_{2,Sel1}(rad)");
-    }
-   }
-   histFull[k].histFullHar[j].mHistPsi_Diff->SetYTitle("Counts");
-   delete histTitle;
-
-   // correlation of sub-event planes
-   histTitle = new TString("Flow_Psi_Sub_Corr_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistPsiSubCorr = new TH1F(histTitle->Data(), histTitle->Data(), nPsiBins, psiMin, psiMax / order);
-   histFull[k].histFullHar[j].mHistPsiSubCorr->Sumw2();
-   histFull[k].histFullHar[j].mHistPsiSubCorr->SetXTitle("Sub-Event Correlation (rad)");
-   histFull[k].histFullHar[j].mHistPsiSubCorr->SetYTitle("Counts");
-   delete histTitle;
-     
-   // correlation of sub-event planes of different order
-   histTitle = new TString("Flow_Psi_Sub_Corr_Diff_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistPsiSubCorrDiff = new TH1F(histTitle->Data(), histTitle->Data(), nPsiBins, psiMin, psiMax / (order+1.));
-   histFull[k].histFullHar[j].mHistPsiSubCorrDiff->Sumw2();
-   histFull[k].histFullHar[j].mHistPsiSubCorrDiff->SetXTitle("Sub-Event Correlation (rad)");
-   histFull[k].histFullHar[j].mHistPsiSubCorrDiff->SetYTitle("Counts");
-   delete histTitle;
-     
-   // q
-   histTitle = new TString("Flow_NormQ_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHist_q = new TH1F(histTitle->Data(), histTitle->Data(), n_qBins, qMin, qMax);
-   histFull[k].histFullHar[j].mHist_q->Sumw2();
-   histFull[k].histFullHar[j].mHist_q->SetXTitle("q = |Q|/sqrt(Mult)");
-   histFull[k].histFullHar[j].mHist_q->SetYTitle("Counts");
-   delete histTitle;
-
-    // particle-plane azimuthal correlation
-   histTitle = new TString("Flow_Phi_Corr_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistPhiCorr = new TH1F(histTitle->Data(), histTitle->Data(), nPhiBins, phiMin, phiMax / order);
-   histFull[k].histFullHar[j].mHistPhiCorr->Sumw2();
-   histFull[k].histFullHar[j].mHistPhiCorr->SetXTitle("Particle-Plane Correlation (rad)");
-   histFull[k].histFullHar[j].mHistPhiCorr->SetYTitle("Counts");
-   delete histTitle;
-     
-   // neutral particle-plane azimuthal correlation
-   histTitle = new TString("FlowV0_Phi_Corr_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistV0PhiCorr = new TH1F(histTitle->Data(), histTitle->Data(), nPhiBins, phiMin, phiMax / order);
-   histFull[k].histFullHar[j].mHistV0PhiCorr->Sumw2();
-   histFull[k].histFullHar[j].mHistV0PhiCorr->SetXTitle("V0-Plane Correlation (rad)");
-   histFull[k].histFullHar[j].mHistV0PhiCorr->SetYTitle("Counts");
-   delete histTitle;
-
-   // neutral sidebands-plane azimuthal correlation
-   histTitle = new TString("FlowV0sb_Phi_Corr_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistV0sbPhiCorr = new TH1F(histTitle->Data(), histTitle->Data(), nPhiBins, phiMin, phiMax / order);
-   histFull[k].histFullHar[j].mHistV0sbPhiCorr->Sumw2();
-   histFull[k].histFullHar[j].mHistV0sbPhiCorr->SetXTitle("V0sideBands-Plane Correlation (rad)");
-   histFull[k].histFullHar[j].mHistV0sbPhiCorr->SetYTitle("Counts");
-   delete histTitle;
-
-   // Yield(pt)
-   histTitle = new TString("Flow_YieldPt_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistYieldPt = new TH1F(histTitle->Data(), histTitle->Data(), nPtBins, ptMin, ptMax);
-   histFull[k].histFullHar[j].mHistYieldPt->Sumw2();
-   histFull[k].histFullHar[j].mHistYieldPt->SetXTitle("Pt (GeV/c)");
-   histFull[k].histFullHar[j].mHistYieldPt->SetYTitle("Yield");
-   delete histTitle;
-     
-   // EtaPtPhi 
-   histTitle = new TString("Flow_EtaPtPhi3D_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistEtaPtPhi3D = new TH3F(histTitle->Data(), histTitle->Data(), mNEtaBins, mEtaMin, mEtaMax, nPtBins, ptMin, ptMax, nPhi3DBins, phiMin, phiMax);
-   histFull[k].histFullHar[j].mHistEtaPtPhi3D->SetXTitle("Eta");
-   histFull[k].histFullHar[j].mHistEtaPtPhi3D->SetYTitle("Pt (GeV/c)");
-   histFull[k].histFullHar[j].mHistEtaPtPhi3D->SetZTitle("Phi (rad)");
-   delete histTitle;
-
-   // Yield(eta,pt)
-   histTitle = new TString("Flow_Yield2D_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistYield2D = new TH2D(histTitle->Data(), histTitle->Data(), mNEtaBins, mEtaMin, mEtaMax, nPtBins, ptMin, ptMax);
-   histFull[k].histFullHar[j].mHistYield2D->Sumw2();
-   histFull[k].histFullHar[j].mHistYield2D->SetXTitle("Pseudorapidty");
-   histFull[k].histFullHar[j].mHistYield2D->SetYTitle("Pt (GeV/c)");
-   delete histTitle;
-
-   // Dca - 3D
-   histTitle = new TString("Flow_3dDca_Sel") ;
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistDcaGlob = new TH1F(histTitle->Data(), histTitle->Data(), nDcaBins, dcaMin, glDcaMax);
-   histFull[k].histFullHar[j].mHistDcaGlob->Sumw2();
-   histFull[k].histFullHar[j].mHistDcaGlob->SetXTitle("|3d Global Track's dca to Vertex (cm)|");
-   delete histTitle;
-
-   // Yield(pt) - excluded from R.P.
-   histTitle = new TString("Flow_YieldPt_outSel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistYieldPtout = new TH1F(histTitle->Data(), histTitle->Data(), nPtBins, ptMin, ptMax);
-   histFull[k].histFullHar[j].mHistYieldPtout->Sumw2();
-   histFull[k].histFullHar[j].mHistYieldPtout->SetXTitle("Pt (GeV/c)");
-   histFull[k].histFullHar[j].mHistYieldPtout->SetYTitle("Yield");
-   delete histTitle;
-     
-   // EtaPtPhi - excluded from R.P. 
-   histTitle = new TString("Flow_EtaPtPhi3D_outSel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistEtaPtPhi3Dout = new TH3F(histTitle->Data(), histTitle->Data(), mNEtaBins, mEtaMin, mEtaMax, nPtBins, ptMin, ptMax, nPhi3DBins, phiMin, phiMax);
-   histFull[k].histFullHar[j].mHistEtaPtPhi3Dout->SetXTitle("Eta");
-   histFull[k].histFullHar[j].mHistEtaPtPhi3Dout->SetYTitle("Pt (GeV/c)");
-   histFull[k].histFullHar[j].mHistEtaPtPhi3Dout->SetZTitle("Phi (rad)");
-   delete histTitle;
-
-   // Yield(eta,pt) - excluded from R.P.
-   histTitle = new TString("Flow_Yield2D_outSel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistYield2Dout = new TH2D(histTitle->Data(), histTitle->Data(), mNEtaBins, mEtaMin, mEtaMax, nPtBins, ptMin, ptMax);
-   histFull[k].histFullHar[j].mHistYield2Dout->Sumw2();
-   histFull[k].histFullHar[j].mHistYield2Dout->SetXTitle("Pseudorapidty");
-   histFull[k].histFullHar[j].mHistYield2Dout->SetYTitle("Pt (GeV/c)");
-   delete histTitle;
-
-   // Dca - 3D - excluded from R.P.
-   histTitle = new TString("Flow_3dDca_outSel") ;
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistDcaGlobout = new TH1F(histTitle->Data(), histTitle->Data(), nDcaBins, dcaMin, glDcaMax);
-   histFull[k].histFullHar[j].mHistDcaGlobout->Sumw2();
-   histFull[k].histFullHar[j].mHistDcaGlobout->SetXTitle("|3d Global Track's dca to Vertex (cm)|");
-   delete histTitle;
-
-   // Flow observed - v_obs,Pt,Eta
-   histTitle = new TString("Flow_vObs2D_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHist_vObs2D = new TProfile2D(histTitle->Data(), histTitle->Data(), mNEtaBins, mEtaMin, mEtaMax, nPtBinsPart, ptMin, ptMaxPart, -100., 100., "");
-   histFull[k].histFullHar[j].mHist_vObs2D->SetXTitle((char*)xLabel.Data());
-   histFull[k].histFullHar[j].mHist_vObs2D->SetYTitle("Pt (GeV/c)");
-   delete histTitle;
-
-   // v_obs,Eta
-   histTitle = new TString("Flow_vObsEta_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHist_vObsEta = new TProfile(histTitle->Data(), histTitle->Data(), mNEtaBins, mEtaMin, mEtaMax, -100., 100., "");
-   histFull[k].histFullHar[j].mHist_vObsEta->SetXTitle((char*)xLabel.Data());
-   histFull[k].histFullHar[j].mHist_vObsEta->SetYTitle("v (%)");
-   delete histTitle;
-
-   // v_obs,Pt
-   histTitle = new TString("Flow_vObsPt_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHist_vObsPt = new TProfile(histTitle->Data(), histTitle->Data(), nPtBinsPart, ptMin, ptMaxPart, -100., 100., "");
-   histFull[k].histFullHar[j].mHist_vObsPt->SetXTitle("Pt (GeV/c)");
-   histFull[k].histFullHar[j].mHist_vObsPt->SetYTitle("v (%)");
-   delete histTitle;
-
-   // neutral Flow observed - Pt,Eta
-   histTitle = new TString("FlowV0_vObs2D_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistV0_vObs2D = new TProfile2D(histTitle->Data(), histTitle->Data(), mNEtaBins, mEtaMin, mEtaMax, nPtBinsPart, ptMin, ptMaxPart, -100., 100., "");
-   histFull[k].histFullHar[j].mHistV0_vObs2D->SetXTitle((char*)xLabel.Data());
-   histFull[k].histFullHar[j].mHistV0_vObs2D->SetYTitle("Pt (GeV/c)");
-   delete histTitle;
-
-   // neutral Flow observed - Eta
-   histTitle = new TString("FlowV0_vObsEta_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistV0_vObsEta = new TProfile(histTitle->Data(), histTitle->Data(), mNEtaBins, mEtaMin, mEtaMax, -100., 100., "");
-   histFull[k].histFullHar[j].mHistV0_vObsEta->SetXTitle((char*)xLabel.Data());
-   histFull[k].histFullHar[j].mHistV0_vObsEta->SetYTitle("v (%)");
-   delete histTitle;
-
-   // neutral Flow observed - Pt
-   histTitle = new TString("FlowV0_vObsPt_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistV0_vObsPt = new TProfile(histTitle->Data(), histTitle->Data(), nPtBinsPart, ptMin, ptMaxPart, -100., 100., "");
-   histFull[k].histFullHar[j].mHistV0_vObsPt->SetXTitle("Pt (GeV/c)");
-   histFull[k].histFullHar[j].mHistV0_vObsPt->SetYTitle("v (%)");
-   delete histTitle;
-
-   // neutral sidebands Flow observed - Pt,Eta
-   histTitle = new TString("FlowV0sb_vObs2D_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistV0sb_vObs2D = new TProfile2D(histTitle->Data(), histTitle->Data(), mNEtaBins, mEtaMin, mEtaMax, nPtBinsPart, ptMin, ptMaxPart, -100., 100., "");
-   histFull[k].histFullHar[j].mHistV0sb_vObs2D->SetXTitle((char*)xLabel.Data());
-   histFull[k].histFullHar[j].mHistV0sb_vObs2D->SetYTitle("Pt (GeV/c)");
-   delete histTitle;
-
-   // neutral sidebands Flow observed - Eta
-   histTitle = new TString("FlowV0sb_vObsEta_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistV0sb_vObsEta = new TProfile(histTitle->Data(), histTitle->Data(), mNEtaBins, mEtaMin, mEtaMax, -100., 100., "");
-   histFull[k].histFullHar[j].mHistV0sb_vObsEta->SetXTitle((char*)xLabel.Data());
-   histFull[k].histFullHar[j].mHistV0sb_vObsEta->SetYTitle("v (%)");
-   delete histTitle;
-
-   // neutral sidebands Flow observed - Pt
-   histTitle = new TString("FlowV0sb_vObsPt_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistV0sb_vObsPt = new TProfile(histTitle->Data(), histTitle->Data(), nPtBinsPart, ptMin, ptMaxPart, -100., 100., "");
-   histFull[k].histFullHar[j].mHistV0sb_vObsPt->SetXTitle("Pt (GeV/c)");
-   histFull[k].histFullHar[j].mHistV0sb_vObsPt->SetYTitle("v (%)");
-   delete histTitle;
-
-   // SX neutral sidebands Flow observed - Eta
-   histTitle = new TString("FlowV0sb_vObsEta_sx_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistV0sb_vObsEta_sx = new TProfile(histTitle->Data(), histTitle->Data(), mNEtaBins, mEtaMin, mEtaMax, -100., 100., "");
-   histFull[k].histFullHar[j].mHistV0sb_vObsEta_sx->SetXTitle((char*)xLabel.Data());
-   histFull[k].histFullHar[j].mHistV0sb_vObsEta_sx->SetYTitle("v (%)");
-   delete histTitle;
-
-   // SX neutral sidebands Flow observed - Pt
-   histTitle = new TString("FlowV0sb_vObsPt_sx_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistV0sb_vObsPt_sx = new TProfile(histTitle->Data(), histTitle->Data(), nPtBinsPart, ptMin, ptMaxPart, -100., 100., "");
-   histFull[k].histFullHar[j].mHistV0sb_vObsPt_sx->SetXTitle("Pt (GeV/c)");
-   histFull[k].histFullHar[j].mHistV0sb_vObsPt_sx->SetYTitle("v (%)");
-   delete histTitle;
-
-   // DX neutral sidebands Flow observed - Eta
-   histTitle = new TString("FlowV0sb_vObsEta_dx_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistV0sb_vObsEta_dx = new TProfile(histTitle->Data(), histTitle->Data(), mNEtaBins, mEtaMin, mEtaMax, -100., 100., "");
-   histFull[k].histFullHar[j].mHistV0sb_vObsEta_dx->SetXTitle((char*)xLabel.Data());
-   histFull[k].histFullHar[j].mHistV0sb_vObsEta_dx->SetYTitle("v (%)");
-   delete histTitle;
-
-   // DX neutral sidebands Flow observed - Pt
-   histTitle = new TString("FlowV0sb_vObsPt_dx_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistV0sb_vObsPt_dx = new TProfile(histTitle->Data(), histTitle->Data(), nPtBinsPart, ptMin, ptMaxPart, -100., 100., "");
-   histFull[k].histFullHar[j].mHistV0sb_vObsPt_dx->SetXTitle("Pt (GeV/c)");
-   histFull[k].histFullHar[j].mHistV0sb_vObsPt_dx->SetYTitle("v (%)");
-   delete histTitle;
-
-   // Phi lab
-   // Tpc (plus)
-   histTitle = new TString("Flow_Phi_TPCplus_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistPhiPlus = new TH1D(histTitle->Data(), histTitle->Data(), nPhiBins, phiMin, phiMax);
-   histFull[k].histFullHar[j].mHistPhiPlus->SetXTitle("Azimuthal Angles (rad)");
-   histFull[k].histFullHar[j].mHistPhiPlus->SetYTitle("Counts");
-   delete histTitle;
-
-   // Tpc (minus)
-   histTitle = new TString("Flow_Phi_TPCminus_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistPhiMinus = new TH1D(histTitle->Data(), histTitle->Data(), nPhiBins, phiMin, phiMax);
-   histFull[k].histFullHar[j].mHistPhiMinus->SetXTitle("Azimuthal Angles (rad)");
-   histFull[k].histFullHar[j].mHistPhiMinus->SetYTitle("Counts");
-   delete histTitle;
-  
-   // Tpc (cross)
-   histTitle = new TString("Flow_Phi_TPCcross_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistPhiAll = new TH1D(histTitle->Data(), histTitle->Data(), nPhiBins, phiMin, phiMax);
-   histFull[k].histFullHar[j].mHistPhiAll->SetXTitle("Azimuthal Angles (rad)");
-   histFull[k].histFullHar[j].mHistPhiAll->SetYTitle("Counts");
-   delete histTitle;
-  
-   // Tpc
-   histTitle = new TString("Flow_Phi_TPC_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistPhi = new TH1D(histTitle->Data(), histTitle->Data(), nPhiBins, phiMin, phiMax);
-   histFull[k].histFullHar[j].mHistPhi->SetXTitle("Azimuthal Angles (rad)");
-   histFull[k].histFullHar[j].mHistPhi->SetYTitle("Counts");
-   delete histTitle;
-  
-   // Phi lab flattened
-   // Tpc (Plus)
-   histTitle = new TString("Flow_Phi_Flat_TPCplus_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistPhiFlatPlus = new TH1D(histTitle->Data(), histTitle->Data(), nPhiBins, phiMin, phiMax);
-   histFull[k].histFullHar[j].mHistPhiFlatPlus->SetXTitle("Azimuthal Angles (rad)");
-   histFull[k].histFullHar[j].mHistPhiFlatPlus->SetYTitle("Counts");
-   delete histTitle;
-
-   // Tpc (Minus)
-   histTitle = new TString("Flow_Phi_Flat_TPCminus_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistPhiFlatMinus = new TH1D(histTitle->Data(), histTitle->Data(), nPhiBins, phiMin, phiMax);
-   histFull[k].histFullHar[j].mHistPhiFlatMinus->SetXTitle("Azimuthal Angles (rad)");
-   histFull[k].histFullHar[j].mHistPhiFlatMinus->SetYTitle("Counts");
-   delete histTitle;
-
-   // Tpc (cross)
-   histTitle = new TString("Flow_Phi_Flat_TPCcross_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistPhiFlatAll = new TH1D(histTitle->Data(), histTitle->Data(), nPhiBins, phiMin, phiMax);
-   histFull[k].histFullHar[j].mHistPhiFlatAll->SetXTitle("Azimuthal Angles (rad)");
-   histFull[k].histFullHar[j].mHistPhiFlatAll->SetYTitle("Counts");
-   delete histTitle;
-
-   // Tpc
-   histTitle = new TString("Flow_Phi_Flat_TPC_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistPhiFlat = new TH1D(histTitle->Data(), histTitle->Data(), nPhiBins, phiMin, phiMax);
-   histFull[k].histFullHar[j].mHistPhiFlat->SetXTitle("Azimuthal Angles (rad)");
-   histFull[k].histFullHar[j].mHistPhiFlat->SetYTitle("Counts");
-   delete histTitle;
-  }
- }
- if(Debug1)  { cout << spaces << "Histograms booked" << endl ; }
- if(fOneInputFile)
- {
-  if(Open(GetInputFileName().Data()))  { if(Debug1)  { cout << spaces << "Events File Opened" << endl ; } }
-  else                                        { cout << FlowAnalysis << "ERROR OPENING THE FILE!" << endl ; return 0 ; }
- }
- else
- {
-  if(Debug1)  
-  { 
-   cout << spaces << "Events Files : " << endl ; 
-   Int_t tot = fFileNames.GetEntries() ;
-   for(Int_t jj=0;jj<tot;jj++) 
-   { 
-    cout << spaces << "          " << jj << " : " << ((TObjString*)fFileNames.At(jj))->GetString().Data() << endl ;  
-   }
-   cout << spaces << " tot : " << tot << " . " << endl ; 
-  }
- }
-
- if(Debug1)  { cout << FlowAnalysis << "Initialized" << endl ; }
- return 1 ;
-}
-//-----------------------------------------------------------------------
-Int_t AliFlowAnalysisMaker::Make()                   
-{
- // Performs the event loop (0..nEvents) and makes call to : 
- //  - get the event and checks it with AliFlowSelection (dummy) ,
- //  - plugs in the Phi and the Bayesian weights from file (if there) ,
- //  - re-sets the r.p. calculation cuts and re-does the tracks' selection loop (*) ,
- //  - re-shuffles the tracks' array and re-devide in sub-events (*) ,
- //  - fills event histograms (FillEventHistograms()) ,
- //  - fills particle histograms (FillParticleHistograms()) ,
- //  - fills v0 histograms (FillV0Histograms()) (*) .
- // Then makes call to:
- //  - calculate the global resolution and correct flow coefficients (Resolution()) ,
- //  - calculate Phi & Bayesian weights and fill the weight histograms (Weightening()) .
- if(Debug0) { cout << FlowAnalysis << "Make (starting events loop) . " << endl ; cout << endl ; }
-
- Int_t succEv = 0 ;
- Int_t tot = 1 ;
- if(!fOneInputFile) { tot = fFileNames.GetEntries() ; }
- for(Int_t ll=0;ll<tot;ll++)
- {
-  if(!fOneInputFile) 
-  { 
-   TString nextFile = ((TObjString*)fFileNames.At(ll))->GetString().Data() ;
-   if(Open(nextFile.Data()))  { if(Debug0)  { cout << spaces << "Just Opened : " << nextFile.Data() << endl ; } }
-   else                      { cout << FlowAnalysis << "ERROR OPENING THE FILE: " << nextFile.Data() << endl ; continue ; }
-  }
-  for(int ie=0;ie<nEvents;ie++)
-  {
-   evtN = ie ;
-   pFlowEvent = GetEvt(evtN) ;
-   if(pFlowEvent) 
-   {
-    if(Analyze(pFlowEvent)) { cout << FlowAnalysis << " ev. " << evtN << " taken" << endl ; succEv++ ; } 
-    else                    { cout << FlowAnalysis << " ev. " << evtN << " discarded" << endl ; }
-   }
-   else 
-   {
-    if(Debug1) { cout << FlowAnalysis << "Problem opening  ev" << evtN << " . " << endl ; }
-    delete pFlowEvent  ; pFlowEvent = 0 ; 
-    continue ;
-   }
-   delete pFlowEvent  ; pFlowEvent = 0 ; 
-   pFlowTracks = 0 ;
-   pFlowV0s = 0 ;   
-  }
-  if(!fOneInputFile) 
-  {
-   pFlowEventsFile->Close() ; 
-   if(Debug1) { cout << spaces << "...going for next    " << ll << endl ; } 
-  }
- }
- if(!succEv) 
- { 
-  if(Debug0) { cout << FlowAnalysis << "NO EVENT HAS BEEN PROCESSED !!!" << endl ; } 
-  return kFALSE ; 
- }
- Resolution() ;                                                 // calculates the resolution (and corrected v's)
- if(mWritePhiWgt || mRedoWgt) { Weightening() ; }       // calculates the phi weights 
- if(Debug1) { cout << FlowAnalysis << "Made" << endl ; }
-  
- return 1 ;
-}
-//-----------------------------------------------------------------------
-Int_t AliFlowAnalysisMaker::Finish()                   
-{
- // Close the analysis and saves the histograms on the histFile .
-
- if(Debug0) { cout << FlowAnalysis << "Finish . " << endl ; } 
- cout << FlowAnalysis << "Output File :  " << GetHistFileName() << endl ;
- cout << endl ;
-
- // Write all histograms
- histFile->cd() ; histFile->Write() ; 
- histFile->cd() ; mVnResHistList->Write();
-
-// *temp*  --  !uncomment!
- // if(mLabelling) { histFile->cd() ; mLabHist->Write(); delete mLabHist ; }
-// *temp*  --  !uncomment!
-
- histFile->Close() ;
-  
- delete mVnResHistList ;
- delete pFlowSelect ;
- if(Debug1) { cout << FlowAnalysis << "Finished" << endl ; } 
- return 1 ;
-}
-//-----------------------------------------------------------------------
-// ###
-//------------------------------------------------------------------------
-void AliFlowAnalysisMaker::WgtChk()
-{
- // Check for Read/Write weights ...
- TFile* wgtFile = new TFile(GetPhiWgtFileName().Data(),"READ");
- // In case the file does not exist or is not a valid ROOT file, it is made a Zombie. 
- // One can detect this situation with a code like:  f.IsZombie()
- if(wgtFile->IsZombie()) 
- {
-  if(Debug0) { cout << spaces << "Weights File ( " << GetPhiWgtFileName().Data() << " ) not present . A new one will be created ." << endl ; }
-  mReadPhiWgt = kFALSE ; mWritePhiWgt = kTRUE  ; mRedoWgt = kFALSE ; 
- }
- else 
- { 
-  if(Debug0) { cout << spaces << "Reading Weights from File : " << GetPhiWgtFileName().Data() << " . " << endl ; }
-  mReadPhiWgt = kTRUE  ; mWritePhiWgt = kFALSE ; 
-  FillWgtArrays(wgtFile) ;                     
-  if(Debug2) { cout << spaces << "PhiWgt Arrays filled . " << endl ; } 
- }
- wgtFile->Close() ;
-}
-//-----------------------------------------------------------------------
-void AliFlowAnalysisMaker::FillWgtArrays(TFile* wgtFile)
-{
- // Loads PhiWeights & Bayesian particles' abundance from file (default: 
- // flowPhiWgt.hist.root). Weights are stored in some AliFlowAnalysisMaker 
- // static data member, ready to be plugged into the AliFlowEvent .
- // This is called at the beginning of the analysis (if wgt file is there).
- TString* histTitle ;
- TH1D* TPC_all ; TH1D* TPC_plus ; TH1D* TPC_minus ; TH1D* TPC_cross ;
- TH1D* PID_bay ;
- const int nPhiBins = Flow::nPhiBins ;
-
- for(int k=0;k<Flow::nSels;k++)
- {
-  for(int j=0;j<Flow::nHars;j++) 
-  {
-   // Tpc (plus)
-   histTitle = new TString("Flow_Phi_Weight_TPCplus_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   TPC_plus = (TH1D*)wgtFile->Get(histTitle->Data());
-   delete histTitle;
-   // Tpc (minus)
-   histTitle = new TString("Flow_Phi_Weight_TPCminus_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   TPC_minus = (TH1D*)wgtFile->Get(histTitle->Data());
-   delete histTitle;
-   // Tpc (cross)
-   histTitle = new TString("Flow_Phi_Weight_TPCcross_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   TPC_cross = (TH1D*)wgtFile->Get(histTitle->Data());
-   delete histTitle;
-
-   // Tpc
-   histTitle = new TString("Flow_Phi_Weight_TPC_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   TPC_all = (TH1D*)wgtFile->Get(histTitle->Data());
-   delete histTitle;
-  
-   for (int n=0;n<nPhiBins;n++) 
-   { 
-    nPhiWgtPlus[k][j][n]  = TPC_plus->GetBinContent(n+1) ;
-    nPhiWgtMinus[k][j][n] = TPC_minus->GetBinContent(n+1) ;
-    nPhiWgtCross[k][j][n] = TPC_cross->GetBinContent(n+1) ;
-    nPhiWgt[k][j][n]     = TPC_all->GetBinContent(n+1) ;
-    if(Debug2) { cout << "Weights: " << nPhiWgt[k][j][n] << " ; " << nPhiWgtPlus[k][j][n] << " | " << nPhiWgtMinus[k][j][n] << " | " << nPhiWgtCross[k][j][n] << endl ; }
-   } 
-  }
-  // Bayesian weights
-  histTitle = new TString("Flow_BayPidMult_Sel");
-  *histTitle += k+1;
-  PID_bay = (TH1D*)wgtFile->Get(histTitle->Data());
-  delete histTitle;
-  Double_t totCount = PID_bay->GetSumOfWeights() ;
-  for (int n=0;n<Flow::nPid;n++) 
-  { 
-   if(totCount) { nBayWgt[k][n] = PID_bay->GetBinContent(n+1) / totCount ; }
-   else        { nBayWgt[k][n] = 1. ; }
-   if(Debug2)  { cout << "Bayesian Weights (" << n << ") : " << nBayWgt[k][n] << endl ; }
-  }
- }
- delete TPC_all ; delete TPC_plus ; delete TPC_minus ; delete TPC_cross ;
- delete PID_bay ;
-}
-//-----------------------------------------------------------------------
-void AliFlowAnalysisMaker::FillEvtPhiWgt()
-{
- // Plugs Wgt arrays into the current AliFlowEvent.
- pFlowEvent->SetPhiWeight(nPhiWgt);
- pFlowEvent->SetPhiWeightPlus(nPhiWgtPlus);
- pFlowEvent->SetPhiWeightMinus(nPhiWgtMinus);
- pFlowEvent->SetPhiWeightCross(nPhiWgtCross); 
-}
-//-----------------------------------------------------------------------
-void AliFlowAnalysisMaker::FillBayesianWgt(int sel)
-{
- // Plugs Bayesian particle abundance into the current AliFlowEvent.
- // In principle a bayesian vector is stored for each selection and each
- // harmonic. In practice just the 1st one is then plugged into the event
- // (AliFlowEvent::mBayesianCs[6] is a 1-dimensional array).
-
- Double_t bayes[Flow::nPid] ; 
- Double_t bayCheck = 0. ;
- for (int n=0;n<Flow::nPid;n++) 
- {
-  bayes[n] = nBayWgt[sel][n] ;
-  bayCheck += bayes[n] ;   
-  if(Debug2) { cout << "Bayesian V[" << n << "]  =  " << nBayWgt[sel][n] << endl ; } 
- }
- if(bayCheck)   { pFlowEvent->SetBayesian(bayes) ; }
- else          { cout << "An empty bayesian vector is stored !!! - Bayesian weights = {1,1,1,1,1,1} " << endl ; }
- mRePid = kTRUE ;
-}
-//-----------------------------------------------------------------------
-void AliFlowAnalysisMaker::Weightening()
-{
- // Calculates weights, and fills PhiWgt histograms and saves them into
- // the PhiWgt file (by default: flowPhiWgt.hist.root) .
- // This is called at the end of the analysis.
- if(Debug0) { cout << FlowAnalysis << "Calculating/Filling weights . " << endl ; } 
- cout << endl ;
- // PhiWgt histogram collection
- mPhiWgtHistList = new TOrdCollection(Flow::nSels*Flow::nHars) ;
- const float phiMin   = 0. ;
- const float phiMax   = 2*TMath::Pi() ; 
- const int   nPhiBins = Flow::nPhiBins ;  // 120 
- TString* histTitle ;
-
- for(int k = 0; k < Flow::nSels; k++)
- {
-  for(int j = 0; j < Flow::nHars; j++) 
-  {
-   // Creates PhiWgt Histograms
-
-   // Tpc (plus)
-   histTitle = new TString("Flow_Phi_Weight_TPCplus_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistPhiWgtPlus = new TH1D(histTitle->Data(),histTitle->Data(), nPhiBins, phiMin, phiMax);
-   histFull[k].histFullHar[j].mHistPhiWgtPlus->Sumw2();
-   histFull[k].histFullHar[j].mHistPhiWgtPlus->SetXTitle("Azimuthal Angles (rad)");
-   histFull[k].histFullHar[j].mHistPhiWgtPlus->SetYTitle("PhiWgt");
-   delete histTitle;
-   // Tpc (minus)
-   histTitle = new TString("Flow_Phi_Weight_TPCminus_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistPhiWgtMinus = new TH1D(histTitle->Data(),histTitle->Data(), nPhiBins, phiMin, phiMax);
-   histFull[k].histFullHar[j].mHistPhiWgtMinus->Sumw2();
-   histFull[k].histFullHar[j].mHistPhiWgtMinus->SetXTitle("Azimuthal Angles (rad)");
-   histFull[k].histFullHar[j].mHistPhiWgtMinus->SetYTitle("PhiWgt");
-   delete histTitle;
-   // Tpc (cross)
-   histTitle = new TString("Flow_Phi_Weight_TPCcross_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistPhiWgtAll = new TH1D(histTitle->Data(),histTitle->Data(), nPhiBins, phiMin, phiMax);
-   histFull[k].histFullHar[j].mHistPhiWgtAll->Sumw2();
-   histFull[k].histFullHar[j].mHistPhiWgtAll->SetXTitle("Azimuthal Angles (rad)");
-   histFull[k].histFullHar[j].mHistPhiWgtAll->SetYTitle("PhiWgt");
-   delete histTitle;
-
-   // Tpc
-   histTitle = new TString("Flow_Phi_Weight_TPC_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistPhiWgt = new TH1D(histTitle->Data(),histTitle->Data(), nPhiBins, phiMin, phiMax);
-   histFull[k].histFullHar[j].mHistPhiWgt->Sumw2();
-   histFull[k].histFullHar[j].mHistPhiWgt->SetXTitle("Azimuthal Angles (rad)");
-   histFull[k].histFullHar[j].mHistPhiWgt->SetYTitle("PhiWgt");
-   delete histTitle;
-
-   // Calculate PhiWgt
-   double meanPlus  = histFull[k].histFullHar[j].mHistPhiPlus->Integral() / (double)nPhiBins ;
-   double meanMinus = histFull[k].histFullHar[j].mHistPhiMinus->Integral() / (double)nPhiBins ;
-   double meanCross = histFull[k].histFullHar[j].mHistPhiAll->Integral() / (double)nPhiBins ;
-
-   double meanTPC = histFull[k].histFullHar[j].mHistPhi->Integral() / (double)nPhiBins ;
-
-   // Tpc
-   for (int i=0;i<nPhiBins;i++) 
-   {
-    histFull[k].histFullHar[j].mHistPhiWgtPlus->SetBinContent(i+1,meanPlus);
-    histFull[k].histFullHar[j].mHistPhiWgtPlus->SetBinError(i+1, 0.);
-    histFull[k].histFullHar[j].mHistPhiWgtMinus->SetBinContent(i+1,meanMinus);
-    histFull[k].histFullHar[j].mHistPhiWgtMinus->SetBinError(i+1, 0.);
-    histFull[k].histFullHar[j].mHistPhiWgtAll->SetBinContent(i+1,meanCross);
-    histFull[k].histFullHar[j].mHistPhiWgtAll->SetBinError(i+1, 0.);
-
-    histFull[k].histFullHar[j].mHistPhiWgt->SetBinContent(i+1,meanTPC);
-    histFull[k].histFullHar[j].mHistPhiWgt->SetBinError(i+1, 0.);
-   }
-   histFull[k].histFullHar[j].mHistPhiWgtPlus->Divide(histFull[k].histFullHar[j].mHistPhiPlus);
-   mPhiWgtHistList->AddLast(histFull[k].histFullHar[j].mHistPhiWgtPlus);
-   histFull[k].histFullHar[j].mHistPhiWgtMinus->Divide(histFull[k].histFullHar[j].mHistPhiMinus);
-   mPhiWgtHistList->AddLast(histFull[k].histFullHar[j].mHistPhiWgtMinus);
-   histFull[k].histFullHar[j].mHistPhiWgtAll->Divide(histFull[k].histFullHar[j].mHistPhiAll);
-   mPhiWgtHistList->AddLast(histFull[k].histFullHar[j].mHistPhiWgtAll);
-
-   histFull[k].histFullHar[j].mHistPhiWgt->Divide(histFull[k].histFullHar[j].mHistPhi);
-   mPhiWgtHistList->AddLast(histFull[k].histFullHar[j].mHistPhiWgt);
-  }
- }
- if(Debug2) { mPhiWgtHistList->ls() ; }
-
- // Write PhiWgt histograms
- TString wgtName ;
- if(mRedoWgt) { wgtName = "new." ; }
- else        { wgtName = "" ; }
- wgtName += GetPhiWgtFileName() ;
- TFile* phiWgtFile = new TFile(wgtName.Data(), "RECREATE");
- phiWgtFile->cd() ; mPhiWgtHistList->Write();
- delete mPhiWgtHistList ; delete wgtName ;
- // Write Bayesian Weights for P.Id.
- phiWgtFile->cd() ; 
- for(int k=0;k<Flow::nSels;k++) { histFull[k].mHistBayPidMult->Write() ; }
- phiWgtFile->Close();
-
- if(Debug1) { cout << FlowAnalysis << "Done . " << endl ; cout << endl ; }
-
- return ;
-}
-//----------------------------------------------------------------------
-void AliFlowAnalysisMaker::GetRunBayesian(Double_t bayes[Flow::nPid],int sel)  
-{
- // Returns the normalized particle abundance of all the events.
- // This is called at the end of the analysis.
-
- if(sel>Flow::nSels) 
- { 
-  if(Debug1) { cout << "Wrong Selection! " << endl ; } 
-  return ; 
- }
- Double_t totCount = histFull[sel].mHistBayPidMult->GetSumOfWeights() ;
- for(int i=0;i<Flow::nPid;i++)
- {
-  if(totCount) { bayes[i] = histFull[sel].mHistBayPidMult->GetBinContent(i+1) / totCount ; }
-  else         { bayes[i] = 1. ; }
- }
- return ;
-}
-//----------------------------------------------------------------------
-void AliFlowAnalysisMaker::PrintRunBayesian(int sel)  
-{
- // Prints the normalized particle abundance of all the events (at this step).
-
- if(sel>Flow::nSels) 
- { 
-  if(Debug1) { cout << "Wrong Selection! " << endl ; } 
-  return ; 
- }
- Double_t totCount = histFull[sel].mHistBayPidMult->GetSumOfWeights() ;
- Char_t* names[Flow::nPid] = {"e","mu","pi","k","p","d"} ;
- Double_t bayes = 0. ;
- cout << "  " ;
- for(int i=0;i<Flow::nPid;i++)
- {
-  if(totCount) { bayes = histFull[sel].mHistBayPidMult->GetBinContent(i+1) / totCount ; }
-  else         { bayes = 1. ; }
-  cout << bayes << "_" << names[i] << " ; " ;
- }
- cout << endl ;
- return ;
-}
-//-----------------------------------------------------------------------
-// ###
-//-----------------------------------------------------------------------
-Bool_t AliFlowAnalysisMaker::Open(const Char_t* filename)              
-{
- // Checks/Opens the FlowEvents file for analysis. Sets the n. of events 
- // (for the loop) and sets the internal counter evtN to 0.
-
- if(Debug1) { cout << spaces << "...opening file . " << endl ; }
- //if(pFlowEventsFile) { if(Debug1) { cout << spaces << "...file already open (I'll go on) . " << endl ; } return kTRUE ; } 
- if(Debug0)  { cout << FlowAnalysis << "Opening input-File :  " << filename << "  . " << endl ; }
- pFlowEventsFile = new TFile(filename ,"READ") ; 
- if(!pFlowEventsFile || pFlowEventsFile->IsZombie())
- {
-  if(Debug0) { cout << FlowAnalysis << "flow events file NOT FOUND ( " << filename << " ) . " << endl ; }
-  return kFALSE ;
- }
- else
- {
-  nEvents = pFlowEventsFile->GetNkeys() ; 
-  pFlowEventsList = (TList*)pFlowEventsFile->GetListOfKeys() ; 
-  evtN = 0 ;  
-  if(Debug0) { cout << spaces << "file: " << GetInputFileName().Data() << " , found " << nEvents << " Flow Events . " << endl ; }
-  if(Debug2) { pFlowEventsFile->ls() ; } //if(Debug2) { cout << " Lista : " << endl ; pFlowEventsList->Dump() ; }
- }
- if(Debug0) { cout << endl ; }
-
- return kTRUE ;
-}
-//-----------------------------------------------------------------------
-AliFlowEvent* AliFlowAnalysisMaker::GetEvt(Int_t evt)         
-{
- // Gets the FlowEvent n.evt from file, loads Tracks and V0s arrays into memory
- // if evt is not specified, gets the next event basing on the internal counter evtN (0...N)
- if(Debug1) { cout << spaces << "Getting Event " << evt << " . " << endl ; } 
- if(!pFlowEventsFile) { return 0 ; }    // if no file open -> quit!
- else
- {
-  if(evt>=0) { evtN = evt ; }   // specified event "evt" is selected, the iterator "evtN" changes accordingly
-  //evt_name = "ev" ; evt_name += evtN ;
-  if(evtN<nEvents) //&& (pFlowEventsFile->GetKey(evt_name)))
-  {
-   // gets the name of the key
-   evt_name = pFlowEventsList->At(evtN)->GetName() ;
-   if(Debug1) { cout << "####" << endl ; cout << evt_name << endl ; cout << "####" << endl ; }
-
-   // gets the event from file
-   pFlowEventsFile->GetObject(evt_name.Data(),pFlowEvent) ;                    // new way
-   //pFlowEvent = (AliFlowEvent*)pFlowEventsFile->Get(evt_name.Data()) ;       // old way
-
-   if(Debug2) { cout << "     dumping: " << endl ; pFlowEvent->Dump() ; cout << endl ; }
-    
-   // loading tracks and v0s collections
-   pFlowTracks = pFlowEvent->TrackCollection() ; 
-   nTracks = pFlowTracks->GetEntries() ;
-   if(Debug1) { cout << FlowAnalysis << "event: " << evt_name.Data() << " , found " << nTracks << " Flow Tracks . " << endl ; }
-   pFlowV0s = pFlowEvent->V0Collection() ; 
-   nV0s = pFlowV0s->GetEntries() ;
-   if(Debug1) { cout << FlowAnalysis << "event: " << evt_name.Data() << " , found " << nV0s << " Flow V0s . " << endl ; }
-  }
-  else 
-  { 
-   cout << FlowAnalysis << "! no event !" << endl ; 
-   return 0 ;
-  }
- }
- return pFlowEvent ;
-}
-//-----------------------------------------------------------------------
-Bool_t AliFlowAnalysisMaker::Analyze(AliFlowEvent* pFlowEvent)         
-{
- // Runs the analysis on a single AliFlowEvent (pointer given). 
- // In principle this method can be used externally by the 
- // AliSelectorFlow for on-fly analysis.
-//
-cout << "* 1 . " << endl ;
-//
- if(pFlowSelect->Select(pFlowEvent))              // event selected - here below the ANALYSIS FLAGS are setted -
- {
-//
-cout << "* 2 . " << endl ;
-//
-  if(mReadPhiWgt)                                       // if weights file is there (previously checked by WgtChk()
-  { 
-   if(mPhiWgt)    { FillEvtPhiWgt() ;  }                // pFlowEvent->SetPhiWgt(...)
-   if(mOnePhiWgt) { pFlowEvent->SetOnePhiWgt() ; }      // one phi-wgt histogram
-   else          { pFlowEvent->SetFirstLastPhiWgt() ; } // three phi-wgt histogram
-  }
-  if(mBayWgt)    { FillBayesianWgt() ; }                // pFlowEvent->SetBayesian(...)
-  if(mRePid)     { pFlowEvent->SetPids() ; }            // re-calculate all p.id. hypotesis with the (new) bayesian array
-
-  if(mPtWgt)     { pFlowEvent->SetPtWgt(); ; }          // pT as a weight
-  if(mEtaWgt)    { pFlowEvent->SetEtaWgt() ; }          // eta as a weight
-
-  pFlowEvent->SetSelections(pFlowSelect) ;              // does the selection of tracks for r.p. calculation (sets flags in AliFlowTrack)
-  if(mShuffle)    { pFlowEvent->RandomShuffle() ; }     // tracks re-shuffling
-  pFlowEvent->SetEtaSubs(mEtaSub) ;                     // setting for the subevents (eta or random)
-  pFlowEvent->MakeSubEvents() ;                         // makes the subevent, eta or random basing on the previous flag
-
-  if(mMakeAll)
-  {
-   if(Debug1) { cout << FlowAnalysis << "All calculation in one shoot for ev." << evtN << " . " << endl ; }
-   pFlowEvent->MakeAll() ; 
-  }
-  else 
-  {
-   if(Debug1) { cout << FlowAnalysis << "Single calls for each Q,Psi,... for ev." << evtN << " . " << endl ; }
-  }
-  if(FillFromFlowEvent())                         // calculates event quantities
-  {
-//  
-cout << "* 3 . " << endl ;
-//
-   FillEventHistograms();                         // fill histograms from AliFlowEvents
-   FillParticleHistograms();                      // fill histograms from AliFlowTracks
-   if(mV0)       { FillV0Histograms() ; }         // fill histograms from AliFlowV0s 
-   if(mLabelling) { FillLabels() ; }              // fill the histogram of MC labels (from the simulation)
-  }
-  else 
-  {
-   cout << FlowAnalysis << "Event psi = 0 . " << endl ; 
-   cout << FlowAnalysis << "                           Skipping! " << endl ; 
-   return kFALSE ;
-  }
-  
- }
- else 
- {
-  if(Debug1) { cout << FlowAnalysis << "Event  ev" << evtN << " discarded . " << endl ; }
-  delete pFlowEvent  ; pFlowEvent = 0 ; 
-  return kFALSE ;
- }
- return kTRUE ;
-}
-//-----------------------------------------------------------------------
-Bool_t AliFlowAnalysisMaker::FillFromFlowEvent()
-{
- // gets event quantities ;
-
- if(Debug1) { cout << spaces << "Getting Event quantities . " << endl ; } 
- Int_t selCheck = 0 ;
- for(int k = 0; k < Flow::nSels; k++) 
- {
-  pFlowSelect->SetSelection(k) ;
-  for(int j = 0; j < Flow::nHars; j++) 
-  {
-   pFlowSelect->SetHarmonic(j) ;
-   for(int n = 0; n < Flow::nSubs; n++) 
-   {
-    pFlowSelect->SetSubevent(n) ;
-    mPsiSub[n][k][j] = pFlowEvent->Psi(pFlowSelect) ;          // sub-event quantities
-    mMultSub[n][k][j] = pFlowEvent->Mult(pFlowSelect) ;
-   }
-   pFlowSelect->SetSubevent(-1);
-   mQ[k][j]    = pFlowEvent->Q(pFlowSelect) ;          // full event quantities
-   mPsi[k][j]  = pFlowEvent->Psi(pFlowSelect) ;
-   m_q[k][j]   = pFlowEvent->NormQ(pFlowSelect).Mod() ; // was: pFlowEvent->q(pFlowSelect) ; // but the normalization was bad (no pT,eta weight)
-   mMult[k][j] = pFlowEvent->Mult(pFlowSelect) ;
-   selCheck += mMult[k][j] ; 
-  }
- }
- if(!selCheck) { return kFALSE ; }                     // if there are no particles in the selection -> skip the event
- if(Debug1)                                            // prints event by event calculated quantities
- {
-  cout << FlowAnalysis << "Read from FlowEvent : " << endl ;
-  cout << endl ; cout << spaces << "mQ[k][j] = " ; 
-  for(int k=0;k<Flow::nSels;k++) 
-  {
-   for(int j=0;j<Flow::nHars;j++) 
-   { 
-    cout << (Float_t)mQ[k][j].X() << "," << (Float_t)mQ[k][j].Y() << " ; " ; 
-   }
-   cout << endl ;
-   cout << spaces << "            " ; 
-  }
-  cout << endl ; cout << spaces << "mPsi[k][j] = " ; 
-  for(int k=0;k<Flow::nSels;k++) 
-  {
-   for(int j=0;j<Flow::nHars;j++) { Float_t aaa = (Float_t)mPsi[k][j] ; cout << aaa << " , " ; }
-   cout << endl ;
-   cout << spaces << "              " ; 
-  }
-  cout << endl ; cout << spaces << "m_q[k][j] = " ; 
-  for(int k=0;k<Flow::nSels;k++) 
-  {
-   for(int j=0;j<Flow::nHars;j++) { Float_t aaa = (Float_t)m_q[k][j] ; cout << aaa << " , " ; }
-   cout << endl ;
-   cout << spaces << "             " ; 
-  }
-  cout << endl ; cout << spaces << "mMult[k][j] = " ; 
-  for(int k=0;k<Flow::nSels;k++) 
-  {
-   for(int j=0;j<Flow::nHars;j++) { Float_t aaa = (Float_t)mMult[k][j] ; cout << aaa << " , " ; } 
-   cout << endl ;
-   cout << spaces << "               " ; 
-  }
-  if(Debug1)
-  {
-   cout << endl ; cout << spaces << "mMultSub[n][k][j] = " ; 
-   for(int n=0;n<Flow::nSubs;n++) 
-   {
-    for(int k=0;k<Flow::nSels;k++) 
-    {
-     for(int j=0;j<Flow::nHars;j++) { Float_t aaa = mMultSub[n][k][j] ; cout << aaa << " , " ; } 
-     cout << endl ;
-     cout << spaces << "                 " ; 
-    }
-   }
-   cout << endl ; cout << spaces << "mPsiSub[n][k][j] = " ; 
-   for(int n=0;n<Flow::nSubs;n++) 
-   {
-    for(int k=0;k<Flow::nSels;k++) 
-    {
-     for(int j=0;j<Flow::nHars;j++) { Float_t aaa = mPsiSub[n][k][j] ; cout << aaa << " , " ; } 
-     cout << endl ;
-     cout << spaces << "                 " ; 
-    }
-   }
-   cout << endl ; cout << spaces << "Delta_PsiSub[k][j] = " ; 
-   for(int k=0;k<Flow::nSels;k++) 
-   {
-    for(int j=0;j<Flow::nHars;j++) { Float_t aaa = mPsiSub[0][k][j]-mPsiSub[1][k][j] ; cout << aaa << " , " ; } 
-    cout << endl ;
-    cout << spaces << "                  " ; 
-   }
-  }
-  cout << endl ;
- }
- return kTRUE ;
-}
-//-------------------------------------------------------------
-void AliFlowAnalysisMaker::FillEventHistograms()    
-{
- // event histograms
-
- if(Debug1) { cout << spaces << "Event Histograms . " << endl ; } 
-
- Float_t trigger = (Float_t)pFlowEvent->L0TriggerWord() ;
- mHistTrigger->Fill(trigger);
-
- // no selections: OrigMult, Centrality, Mult, MultOverOrig, VertexZ, VertexXY
- int origMult = pFlowEvent->OrigMult();
- mHistOrigMult->Fill((float)origMult);
- mHistMultEta->Fill((float)pFlowEvent->MultEta());
-
- int cent = pFlowEvent->Centrality();
- mHistCent->Fill((float)cent);
-
- mHistMult->Fill((float)nTracks) ;
- mHistV0Mult->Fill((float)nV0s) ;
- if(origMult) { mHistMultOverOrig->Fill((float)nTracks/(float)origMult) ; }
-
- pFlowEvent->VertexPos(vertex) ;
- mHistVertexZ->Fill(vertex[2]) ;
- mHistVertexXY2D->Fill(vertex[0],vertex[1]) ;
-
- // ZDC info
- mHistPartZDC->Fill(pFlowEvent->ZDCpart()) ;
- for(int ii=0;ii<3;ii++) { mHistEnergyZDC->Fill(ii,pFlowEvent->ZDCenergy(ii)) ; }
-
- // sub-event Psi_Subs
- for(int k = 0; k < Flow::nSels; k++) 
- {
-  for(int j = 0; j < Flow::nHars; j++) 
-  {
-   for(int n = 0; n < Flow::nSubs; n++) 
-   {
-    int iii = Flow::nSubs * k + n ;    //cout << "  " << k << j << n << " , " << iii << endl ;
-    histSub[iii].histSubHar[j].mHistPsiSubs->Fill(mPsiSub[n][k][j]) ;
-   }
-  }
- }
-
- // full event Psi, PsiSubCorr, PsiSubCorrDiff, cos, mult, q
- for(int k = 0; k < Flow::nSels; k++) 
- {
-  for(int j = 0; j < Flow::nHars; j++) 
-  {
-   float order = (float)(j+1);
-   histFull[k].histFullHar[j].mHistPsi->Fill(mPsi[k][j]);
-   if(k<2 && j<2)
-   {
-    if(k==0) 
-    { 
-     float psi1 = mPsi[0][j] ; 
-     float psi2 = mPsi[1][j] ;
-     float diff = psi1 - psi2 ;
-     if(diff < -TMath::Pi()/(j+1))      { diff += 2*TMath::Pi()/(j+1) ; } 
-     else if(diff > +TMath::Pi()/(j+1)) { diff -= 2*TMath::Pi()/(j+1) ; }
-     histFull[k].histFullHar[j].mHistPsi_Diff->Fill(diff) ; // k=0
-    } 
-    else if(k==1) 
-    {
-     float psi1 ; float psi2 ;
-     if (j==0)     { psi1 = mPsi[0][0] ; psi2 = mPsi[1][1] ; }  
-     else if(j==1) { psi1 = mPsi[0][0] ; psi2 = mPsi[0][1] ; }
-     float diff = psi1 - psi2 ;
-     diff = (TMath::Abs(diff) > TMath::Pi()) ? ((diff > 0.) ? -(2*TMath::Pi()-diff) : -(diff+2*TMath::Pi())) : diff ;
-     histFull[k].histFullHar[j].mHistPsi_Diff->Fill(diff) ; // k=1
-    }     
-   }
-
-   if(mPsiSub[0][k][j] != 0. && mPsiSub[1][k][j] != 0.)
-   {
-    float psiSubCorr;                          // this is:  delta_Psi
-    if(mV1Ep1Ep2 == kFALSE || order != 1) 
-    {
-     psiSubCorr = mPsiSub[0][k][j] - mPsiSub[1][k][j];
-    }
-    else // i.e. (mV1Ep1Ep2 == kTRUE && order == 1)
-    { 
-     psiSubCorr = mPsiSub[0][k][0] + mPsiSub[1][k][0] - 2*mPsi[k][1];
-    }
-    histFull[k].mHistCos->Fill(order, (float)cos(order * psiSubCorr)) ;
-    if(psiSubCorr < 0.)                 { psiSubCorr += 2*TMath::Pi()/order ; }
-    if(psiSubCorr > 2*TMath::Pi()/order) { psiSubCorr -= 2*TMath::Pi()/order ; } // for v1Ep1Ep2 which gives -2*TMath::Pi() < psiSubCorr < 2*2*TMath::Pi()
-    histFull[k].histFullHar[j].mHistPsiSubCorr->Fill(psiSubCorr);
-   }
-
-   if(j < Flow::nHars - 1) // subevents of different harmonics
-   {
-    int j1, j2;
-    float psiSubCorrDiff;
-    if(j==0)     { j1 = 1, j2 = 2 ; } 
-    else if(j==1) { j1 = 1, j2 = 3 ; } 
-    else if(j==2) { j1 = 2, j2 = 4 ; }
-    psiSubCorrDiff = fmod((double)mPsiSub[0][k][j1-1],2*TMath::Pi()/(double)j2)-fmod((double)mPsiSub[1][k][j2-1],2*TMath::Pi()/(double)j2) ;
-    if(psiSubCorrDiff < 0.) { psiSubCorrDiff += 2*TMath::Pi()/(float)j2 ; }
-    histFull[k].histFullHar[j].mHistPsiSubCorrDiff->Fill(psiSubCorrDiff) ;
-    psiSubCorrDiff = fmod((double)mPsiSub[0][k][j2-1],2*TMath::Pi()/(double)j2)-fmod((double)mPsiSub[1][k][j1-1],2*TMath::Pi()/(double)j2) ;
-    if(psiSubCorrDiff < 0.) { psiSubCorrDiff += 2*TMath::Pi()/(float)j2 ; }
-    histFull[k].histFullHar[j].mHistPsiSubCorrDiff->Fill(psiSubCorrDiff) ;
-   }
-   
-   histFull[k].histFullHar[j].mHistMult->Fill((float)mMult[k][j]) ;
-   histFull[k].histFullHar[j].mHist_q->Fill(m_q[k][j]) ;
-  }
- }
- if(Debug1) { cout << FlowAnalysis << "Event  " << (pFlowEvent->GetName()) << endl ; }
-}
-//-----------------------------------------------------------------------
-void AliFlowAnalysisMaker::FillParticleHistograms() 
-{
- // tracks histograms
-
- if(Debug0) { cout << spaces << "Tracks Loop . " << endl ; } 
-
- float corrMultUnit   = 0. ;
- float corrMultN      = 0. ;
- float etaSymPosTpcN  = 0. ;
- float etaSymNegTpcN  = 0. ;
- float etaSymPosTpcNpart = 0. ;
- float etaSymNegTpcNpart = 0. ;
- float hPlusN        = 0. ;
- float hMinusN        = 0. ;
- float piPlusN        = 0. ;
- float piMinusN       = 0. ;
- float protonN        = 0. ;
- float pbarN         = 0. ;
- float kMinusN        = 0. ;
- float kPlusN        = 0. ;
- float deuteronN      = 0. ;
- float dbarN         = 0. ;
- float electronN      = 0. ;
- float positronN      = 0. ;
- float muonMinusN     = 0. ;
- float muonPlusN      = 0. ;
- int numPid = -1 ;
-
- mOnlyConstrainable = pFlowSelect->JustLoopConstrainable() ;
- if(Debug1) { cout << spaces << "Looping over " << nTracks << "  flow tracks  " ; if(mOnlyConstrainable) { cout << " (just constrainable) " ; } cout << ". " << endl ; } 
- int itr ;
- for(itr=0;itr<nTracks;itr++) 
- {
-  pFlowTrack = (AliFlowTrack*)pFlowTracks->At(itr) ;   if(Debug2) { cout << "Track n. " << itr << endl ; pFlowTrack->Dump() ; }
-  
-  bool constrainable = pFlowTrack->IsConstrainable() ;  if(Debug2) {  
-                                                        if(constrainable) { cout << "Constrainable" << endl ; }
-                                                        else              { cout << "UnConstrainable" << endl ; }
-                                                       }
-  if(mOnlyConstrainable && !constrainable) { continue ; } 
-  
-  int label = pFlowTrack->Label() ;                    if(Debug2) { cout << itr << " label: " << label << endl ; }
-  if(label>maxLabel) { maxLabel = label ; }             // this has just the purpose to fill a labels histogram
-  // -
-  float dcaGlobal = TMath::Abs(pFlowTrack->Dca()) ;    if(Debug2) { cout << "dcaGlob "  << dcaGlobal << endl ; }               
-  float dcaSigned = pFlowTrack->TransDcaSigned() ;     if(Debug2) { cout << "dcaSigned " << dcaSigned  << endl ; }             
-  float dcaTrans = TMath::Abs(dcaSigned) ;             if(Debug2) { cout << "dcaTrans "  << dcaTrans << endl ; }
-  float eta = pFlowTrack->Eta() ;                      if(Debug2) { cout << "eta "  << eta << endl ; }
-                                                       if(Debug2) { cout << "rapidity " << pFlowTrack->Y() << endl ; }
-  float phi = pFlowTrack->Phi() ;                      if(Debug2) { cout << "Phi "  << phi<< endl ; } 
-  float pt = pFlowTrack->Pt() ;                        if(Debug2) { cout << "Pt  "   << pt << endl ; }
-  float totalp = pFlowTrack->P() ;                     if(Debug2) { cout << "P "    << totalp << endl ; }
-  // float logp = TMath::Log10(totalp) ;
-  float etaGlob = pFlowTrack->EtaGlobal() ;            if(Debug2) { cout << "etaGlobal "  << eta << endl ; }
-                                                       if(Debug2) { cout << "rapidityGlobal " << pFlowTrack->YGlobal() << endl ; }
-  float phiGlob = pFlowTrack->PhiGlobal() ;            if(Debug2) { cout << "PhiGlobal "  << phi<< endl ; } 
-  float ptGlob = pFlowTrack->PtGlobal() ;              if(Debug2) { cout << "PtGlobal  "   << pt << endl ; }
-  float zFirstPoint = pFlowTrack->ZFirstPoint() ;      if(Debug2) { cout << "Zfirst " << zFirstPoint << endl ; }
-  float zLastPoint = pFlowTrack->ZLastPoint() ;        if(Debug2) { cout << "Zlast " << zLastPoint << endl ; }
-  float lenght = pFlowTrack->TrackLength() ;           if(Debug2) { cout << "lenght " << lenght << endl ; }
-  int  charge = pFlowTrack->Charge() ;                 if(Debug2) { cout << "charge " << charge << endl ; }
-  float chi2 = pFlowTrack->Chi2() ;                    if(Debug2) { cout << "chi2 " << chi2 << endl ; } 
-  int  fitPtsTPC = (int)((float)pFlowTrack->FitPtsTPC()) ;     if(Debug2) { cout << "fitPtsTPC " << fitPtsTPC << endl ; }
-  int  maxPtsTPC = pFlowTrack->MaxPtsTPC() ;           if(Debug2) { cout << "maxPtsTPC " << maxPtsTPC << endl ; }          
-  float chi2TPC = pFlowTrack->Chi2TPC() ;              if(Debug2) { cout << "chi2TPC " << chi2TPC << endl ; }
-  int  fitPtsITS = pFlowTrack->FitPtsITS() ;           if(Debug2) { cout << "fitPtsITS " << fitPtsITS << endl ; }      
-  int  maxPtsITS = pFlowTrack->MaxPtsITS() ;           if(Debug2) { cout << "maxPtsITS " << maxPtsITS << endl ; }  
-  float chi2ITS = pFlowTrack->Chi2ITS() ;              if(Debug2) { cout << "chi2ITS " << chi2ITS << endl ; }
-  int  fitPtsTRD = pFlowTrack->NhitsTRD() ;            if(Debug2) { cout << "fitPtsTRD " << fitPtsTRD << endl ; }
-  int  maxPtsTRD = pFlowTrack->MaxPtsTRD() ;           if(Debug2) { cout << "maxPtsTRD " << maxPtsTRD << endl ; }          
-  float chi2TRD = pFlowTrack->Chi2TRD() ;              if(Debug2) { cout << "chi2TRD " << chi2TRD << endl ; }
-  int  fitPtsTOF = pFlowTrack->NhitsTOF() ;            if(Debug2) { cout << "fitPtsTOF " << fitPtsTOF << endl ; }
-  int  maxPtsTOF = pFlowTrack->MaxPtsTOF() ;           if(Debug2) { cout << "maxPtsTOF " << maxPtsTOF << endl ; }          
-  float chi2TOF = pFlowTrack->Chi2TOF() ;              if(Debug2) { cout << "chi2TOF " << chi2TOF << endl ; }
-  float dEdx = pFlowTrack->DedxTPC() ;                         if(Debug2) { cout << "dEdxTPC " << dEdx << endl ; }
-  float its = pFlowTrack->DedxITS() ;                  if(Debug2) { cout << "dEdxITS " << its << endl ; }
-  float trd = pFlowTrack->SigTRD() ;                   if(Debug2) { cout << "SigTRD " << trd << endl ; }
-  float tof = pFlowTrack->TofTOF() ;                   if(Debug2) { cout << "TofTOF " << tof << endl ; }
-
-  float lpTPC = 0 ; if(pFlowTrack->PatTPC()>0) { lpTPC = TMath::Log10(pFlowTrack->PatTPC()) ; }
-                                                       if(Debug2) { cout << "log(pTPC) " << lpTPC << endl ; }                                                  
-  float lpITS = 0 ; if(pFlowTrack->PatITS()>0) { lpITS = TMath::Log10(pFlowTrack->PatITS()) ; }
-                                                       if(Debug2) { cout << "log(pTPC) " << lpITS << endl ; }
-  float lpTRD = 0 ; if(pFlowTrack->PatTRD()>0) { lpTRD = TMath::Log10(pFlowTrack->PatTRD()) ; }
-                                                       if(Debug2) { cout << "log(pTPC) " << lpTRD << endl ; }
-  float lpTOF = 0 ; if(pFlowTrack->PatTOF()>0) { lpTOF = TMath::Log10(pFlowTrack->PatTOF()) ; }
-                                                       if(Debug2) { cout << "log(pTPC) " << lpTOF << endl ; }  
-  
-  float invMass = pFlowTrack->InvMass() ;              if(Debug2) { cout << "InvMass " << invMass << endl ; }
-  Char_t pid[10]="0" ; strcpy(pid,pFlowTrack->Pid()) ;         if(Debug2) { cout << "pid "  << pid << endl ; }   
-
-  // no selections: Charge, Dca, Chi2, FitPts, MaxPts, FitOverMax, PID
-  mHistCharge->Fill((float)charge);
-  mHistDcaGlobal->Fill(dcaGlobal);
-  mHistDca->Fill(dcaTrans) ;
-  mHistTransDca->Fill(dcaSigned);
-  mHistChi2->Fill(chi2);
-  
-  // - here ITS   (chi2 & nHits)
-  mHistChi2ITS->Fill(chi2ITS);
-  if (fitPtsITS>0)
-    mHistChi2normITS->Fill(chi2ITS/((float)fitPtsITS));  // 5 is the # of parameters in the track fit
-  mHistFitPtsITS->Fill((float)fitPtsITS);
-  mHistMaxPtsITS->Fill((float)maxPtsITS);
-
-  // - here TPC   (chi2 & nHits)
-  mHistChi2TPC->Fill(chi2TPC);
-  if (fitPtsTPC>0)
-    mHistChi2normTPC->Fill(chi2TPC/((float)fitPtsTPC));
-  mHistFitPtsTPC->Fill((float)fitPtsTPC);
-  mHistMaxPtsTPC->Fill((float)maxPtsTPC);
-  if(maxPtsTPC>0)
-    mHistFitOverMaxTPC->Fill((float)(fitPtsTPC)/(float)maxPtsTPC);
-
-  // - here TRD  (chi2 & nHits)
-  mHistChi2TRD->Fill(chi2TRD);
-  if (fitPtsTRD>0)
-    mHistChi2normTRD->Fill(chi2TRD/((float)fitPtsTRD));
-  mHistFitPtsTRD->Fill((float)fitPtsTRD);
-  mHistMaxPtsTRD->Fill((float)maxPtsTRD);
-
-  // - here TOF   (chi2 & nHits)
-  mHistChi2TOF->Fill(chi2TOF);
-  if (fitPtsTOF>0)
-    mHistChi2normTOF->Fill(chi2TOF/((float)fitPtsTOF));
-  mHistFitPtsTOF->Fill((float)fitPtsTOF);
-  mHistMaxPtsTOF->Fill((float)maxPtsTOF);
-  
-  // fit over max (all)
-  int maxPts = maxPtsITS + maxPtsTPC + maxPtsTRD + maxPtsTOF ;
-  int fitPts = fitPtsITS + fitPtsTPC + fitPtsTRD + fitPtsTOF ;
-  if(maxPts>0)
-    mHistFitOverMax->Fill((float)(fitPts)/(float)maxPts) ;
-  
-  // lenght
-  mHistLenght->Fill(lenght) ;
-  mHistInvMass->Fill(invMass) ;
-
-  // PID histograms & multiplicity count (for bayesian histogram)
-  if(charge == 1) 
-  {
-   hPlusN++ ;
-   mHistMeanDedxPos2D->Fill(lpTPC, dEdx) ;
-   mHistMeanDedxPos2DITS->Fill(lpITS, its) ;
-   mHistMeanDedxPos2DTRD->Fill(lpTRD, trd) ;
-   mHistMeanDedxPos2DTOF->Fill(lpTOF, tof) ;
-   //
-   float positron  = pFlowTrack->ElectronPositronProb() ;
-   mHistPidPositron->Fill(positron) ;
-   if(strcmp(pid, "e+") == 0) 
-   {
-    numPid = 0 ; positronN++ ; mHistPidPt->Fill(1.5,pt) ;
-    mHistMeanTPCPositron->Fill(lpTPC, dEdx) ;
-    mHistMeanITSPositron->Fill(lpITS, its);
-    mHistMeanTRDPositron->Fill(lpTRD, trd);
-    mHistMeanTOFPositron->Fill(invMass, tof);
-    mHistPidPositronPart->Fill(positron) ;
-   }
-   float muonPlus  = pFlowTrack->MuonPlusMinusProb() ;
-   mHistPidMuonPlus->Fill(muonPlus) ;
-   if(strcmp(pid, "mu+") == 0) 
-   {
-    numPid = 1 ; muonPlusN++ ; mHistPidPt->Fill(3.5,pt) ; 
-    mHistMeanTPCMuonPlus->Fill(lpTPC, dEdx) ;
-    mHistMeanITSMuonPlus->Fill(lpITS, its);
-    mHistMeanTRDMuonPlus->Fill(lpTRD, trd);
-    mHistMeanTOFMuonPlus->Fill(invMass, tof);
-    mHistPidMuonPlusPart->Fill(muonPlus) ;
-   }
-   float piPlus = pFlowTrack->PionPlusMinusProb() ;
-   mHistPidPiPlus->Fill(piPlus) ;
-   if(strcmp(pid, "pi+") == 0) 
-   { 
-    numPid = 2 ; piPlusN++ ; mHistPidPt->Fill(5.5,pt) ;
-    mHistMeanTPCPiPlus->Fill(lpTPC, dEdx) ;
-    mHistMeanITSPiPlus->Fill(lpITS, its);
-    mHistMeanTRDPiPlus->Fill(lpTRD, trd);
-    mHistMeanTOFPiPlus->Fill(invMass, tof);
-    mHistPidPiPlusPart->Fill(piPlus) ;
-   }
-   float kplus  = pFlowTrack->KaonPlusMinusProb() ;
-   mHistPidKplus->Fill(kplus) ;
-   if(strcmp(pid, "k+") == 0) 
-   {
-    numPid = 3 ; kPlusN++ ; mHistPidPt->Fill(7.5,pt) ; 
-    mHistMeanTPCKplus->Fill(lpTPC, dEdx) ;
-    mHistMeanITSKplus->Fill(lpITS, its);
-    mHistMeanTRDKplus->Fill(lpTRD, trd);
-    mHistMeanTOFKplus->Fill(invMass, tof);
-    mHistPidKplusPart->Fill(kplus) ;
-   }
-   float proton  = pFlowTrack->ProtonPbarProb() ;
-   mHistPidProton->Fill(proton) ;
-   if(strcmp(pid, "pr+") == 0) 
-   {
-    numPid = 4 ; protonN++ ; mHistPidPt->Fill(9.5,pt) ;  
-    mHistMeanTPCProton->Fill(lpTPC, dEdx) ;
-    mHistMeanITSProton->Fill(lpITS, its);
-    mHistMeanTRDProton->Fill(lpTRD, trd);
-    mHistMeanTOFProton->Fill(invMass, tof);
-    mHistPidProtonPart->Fill(proton) ;
-   }
-   float deuteron  = pFlowTrack->DeuteriumAntiDeuteriumProb() ;
-   mHistPidDeuteron->Fill(deuteron) ;
-   if(strcmp(pid, "d+") == 0) 
-   {
-    numPid = 6 ; deuteronN++ ; mHistPidPt->Fill(11.5,pt) ; 
-    mHistMeanTPCDeuteron->Fill(lpTPC, dEdx) ;
-    mHistMeanITSDeuteron->Fill(lpITS, its);
-    mHistMeanTRDDeuteron->Fill(lpTRD, trd);
-    mHistMeanTOFDeuteron->Fill(invMass, tof);
-    mHistPidDeuteronPart->Fill(deuteron) ;
-   }
-  } 
-  else if(charge == -1) 
-  {
-   hMinusN++ ;
-   mHistMeanDedxNeg2D->Fill(lpTPC, dEdx) ;
-   mHistMeanDedxNeg2DITS->Fill(lpITS, its) ;
-   mHistMeanDedxNeg2DTRD->Fill(lpTRD, trd) ;
-   mHistMeanDedxNeg2DTOF->Fill(lpTOF, tof) ;
-   //
-   float electron  = pFlowTrack->ElectronPositronProb() ;
-   mHistPidElectron->Fill(electron);
-   if(strcmp(pid, "e-") == 0) 
-   {
-    numPid = 0 ; electronN++ ; mHistPidPt->Fill(0.5,pt) ; 
-    mHistMeanTPCElectron->Fill(lpTPC, dEdx);
-    mHistMeanITSElectron->Fill(lpITS, its);
-    mHistMeanTRDElectron->Fill(lpTRD, trd);
-    mHistMeanTOFElectron->Fill(invMass, tof);
-    mHistPidElectronPart->Fill(electron);
-   }
-   float muonMinus  = pFlowTrack->MuonPlusMinusProb() ;
-   mHistPidMuonMinus->Fill(muonMinus) ;
-   if(strcmp(pid, "mu-") == 0) 
-   {
-    numPid = 1 ; muonMinusN++ ; mHistPidPt->Fill(2.5,pt) ;
-    mHistMeanTPCMuonMinus->Fill(lpTPC, dEdx) ;
-    mHistMeanITSMuonMinus->Fill(lpITS, its);
-    mHistMeanTRDMuonMinus->Fill(lpTRD, trd);
-    mHistMeanTOFMuonMinus->Fill(invMass, tof);
-    mHistPidMuonMinusPart->Fill(muonMinus) ;
-   }
-   float piMinus = pFlowTrack->PionPlusMinusProb() ;
-   mHistPidPiMinus->Fill(piMinus) ;
-   if(strcmp(pid, "pi-") == 0) 
-   {
-    numPid = 2 ; piMinusN++ ; mHistPidPt->Fill(4.5,pt) ;
-    mHistMeanTPCPiMinus->Fill(lpTPC, dEdx);
-    mHistMeanITSPiMinus->Fill(lpITS, its);
-    mHistMeanTRDPiMinus->Fill(lpTRD, trd);
-    mHistMeanTOFPiMinus->Fill(invMass, tof);
-    mHistPidPiMinusPart->Fill(piMinus);
-   }
-   float kminus  = pFlowTrack->KaonPlusMinusProb() ;
-   mHistPidKminus->Fill(kminus);
-   if(strcmp(pid, "k-") == 0) 
-   {
-    numPid = 3 ; kMinusN++ ; mHistPidPt->Fill(6.5,pt) ;
-    mHistMeanTPCKminus->Fill(lpTPC, dEdx);
-    mHistMeanITSKminus->Fill(lpITS, its);
-    mHistMeanTRDKminus->Fill(lpTRD, trd);
-    mHistMeanTOFKminus->Fill(invMass, tof);
-    mHistPidKminusPart->Fill(kminus);
-   }
-   float antiproton  = pFlowTrack->ProtonPbarProb() ;
-   mHistPidAntiProton->Fill(antiproton);
-   if(strcmp(pid, "pr-") == 0) 
-   {
-    numPid = 4 ; pbarN++ ; mHistPidPt->Fill(8.5,pt) ;
-    mHistMeanTPCPbar->Fill(lpTPC, dEdx);
-    mHistMeanITSPbar->Fill(lpITS, its);
-    mHistMeanTRDPbar->Fill(lpTRD, trd);
-    mHistMeanTOFPbar->Fill(invMass, tof);
-    mHistPidAntiProtonPart->Fill(antiproton);
-   }
-   float antideuteron  = pFlowTrack->DeuteriumAntiDeuteriumProb() ;
-   mHistPidAntiDeuteron->Fill(antideuteron);
-   if(strcmp(pid, "d-") == 0) 
-   {
-    numPid = 6 ; dbarN++ ; mHistPidPt->Fill(10.5,pt) ;
-    mHistMeanTPCAntiDeuteron->Fill(lpTPC, dEdx);
-    mHistMeanITSAntiDeuteron->Fill(lpITS, its);
-    mHistMeanTRDAntiDeuteron->Fill(lpTRD, trd);
-    mHistMeanTOFAntiDeuteron->Fill(invMass, tof);
-    mHistPidAntiDeuteronPart->Fill(antideuteron);
-   }
-  }
-  
-  // Yield3D, Yield2D, Eta, Pt, Phi, bayP.Id.
-  mHistPtot->Fill(totalp) ;
-  mHistPt->Fill(pt) ;
-  mHistPhi->Fill(phi);  
-  mHistAllEtaPtPhi3D->Fill(eta, pt, phi) ;
-  mHistYieldAll2D->Fill(eta, pt) ;
-  mHistBayPidMult->Fill(numPid) ;
-  if(constrainable) 
-  { 
-   mHistPhiCons->Fill(phi);  
-   mHistPhiPtCon->Fill(phi, pt);  
-   mHistYieldCon2D->Fill(eta, pt) ;
-   mHistConsEtaPtPhi3D->Fill(eta, pt, phi) ;
-   mHistGlobEtaPtPhi3D->Fill(etaGlob, ptGlob, phiGlob) ;
-  }
-  else 
-  { 
-   mHistYieldUnc2D->Fill(etaGlob, ptGlob) ;
-   mHistUncEtaPtPhi3D->Fill(etaGlob, ptGlob, phiGlob) ;
-   mHistPhiPtUnc->Fill(phiGlob, ptGlob) ; 
-  }
-  if(pFlowTrack->Charge()>0)       { mHistPtPhiPos->Fill(phi, pt); }
-  else if(pFlowTrack->Charge()<0)  { mHistPtPhiNeg->Fill(phi, pt); }
-
-  // fills selected part histograms
-  if(pFlowSelect->SelectPart(pFlowTrack)) 
-  {
-   if(strlen(pFlowSelect->PidPart()) != 0) 
-   {
-    float rapidity = pFlowTrack->Y();
-    mHistBinEta->Fill(rapidity, rapidity);
-    mHistYieldPart2D->Fill(rapidity, pt);
-   }
-   else 
-   {
-    mHistBinEta->Fill(eta, eta) ;
-    mHistYieldPart2D->Fill(eta, pt) ;
-   }
-   mHistBayPidMultPart->Fill(numPid) ;
-   mHistBinPt->Fill(pt, pt) ;
-   mHistEtaPtPhi3DPart->Fill(eta,pt,phi) ;
-   mHistDcaGlobalPart->Fill(dcaGlobal) ;
-   mHistInvMassPart->Fill(invMass) ;
-   if(charge == 1) 
-   {
-    mHistMeanDedxPos3DPart->Fill(lpITS, dEdx, numPid) ;
-    mHistMeanDedxPos3DPartITS->Fill(lpITS, its, numPid) ;
-   }
-   else if(charge == -1) 
-   {
-    mHistMeanDedxNeg3DPart->Fill(lpITS, dEdx, numPid) ;
-    mHistMeanDedxNeg3DPartITS->Fill(lpITS, its, numPid) ;
-   }
-   if(eta > 0.) { etaSymPosTpcNpart++ ; }  // for mHistEtaSymPart 
-   else         { etaSymNegTpcNpart++ ; }
-  }
-  else         
-  {
-   mHistEtaPtPhi3DOut->Fill(eta,pt,phi) ;
-   mHistYieldOut2D->Fill(eta, pt) ;
-   mHistDcaGlobalOut->Fill(dcaGlobal) ;
-   mHistInvMassOut->Fill(invMass) ;
-  }
-
-  // cos(n*phiLab)
-  for(int j = 0; j < Flow::nHars; j++) 
-  {
-   bool oddHar = (j+1) % 2 ;
-   float order = (float)(j+1) ;
-   float vIn   = 100 * cos((double)order * phi) ;
-   if(eta < 0 && oddHar) { vIn *= -1 ; }
-   mHistCosPhi->Fill(order, vIn);
-  }
-
-  //For Eta symmetry TPC
-  if(pFlowTrack->FitPtsTPC())
-  {
-   if(eta > 0.) { etaSymPosTpcN++ ; } // for mHistEtaSym 
-   else         { etaSymNegTpcN++ ; }
-  }
-  
-  // not to call it twice ...
-  int nEtaS = HarmonicsLoop(eta,phi,pt,numPid) ;
-
-  //For Correlated Multiplicity 
-  corrMultN += (float)nEtaS ;
-
-  //For Correlated Multiplicity in 1 unit rapidity
-  if(TMath::Abs(eta) <= 0.5) { corrMultUnit += (float)nEtaS ; }
-
-  //delete pointer
-  pFlowTrack = 0 ;
- }                                                                                              // end of tracks loop
-                                                    
- // EtaSym
- float etaSymTpc = 0 ; 
- if(etaSymPosTpcN || etaSymNegTpcN)        { etaSymTpc  = (etaSymPosTpcN  - etaSymNegTpcN)  / (etaSymPosTpcN  + etaSymNegTpcN); }
- float etaSymTpcPart = 0 ; 
- if(etaSymPosTpcNpart || etaSymNegTpcNpart) { etaSymTpcPart  = (etaSymPosTpcNpart  - etaSymNegTpcNpart)  / (etaSymPosTpcNpart  + etaSymNegTpcNpart) ; }
- Float_t vertexZ = vertex[2] ;
- // all
- mHistEtaSym->Fill(etaSymTpc);
- mHistEtaSymVerZ2D->Fill(vertexZ , etaSymTpc);
- // selected
- mHistEtaSymPart->Fill(etaSymTpc);
- mHistEtaSymVerZ2DPart->Fill(vertexZ , etaSymTpcPart);
-
- // PID multiplicities
- float totalMult = (float)pFlowTracks->GetEntries() ;
- mHistPidMult->Fill(1., totalMult);
- mHistPidMult->Fill(2., hPlusN);
- mHistPidMult->Fill(3., hMinusN);
- mHistPidMult->Fill(4., piPlusN);
- mHistPidMult->Fill(5., piMinusN);
- mHistPidMult->Fill(6., protonN);
- mHistPidMult->Fill(7., pbarN);
- mHistPidMult->Fill(8., kPlusN);
- mHistPidMult->Fill(9., kMinusN);
- mHistPidMult->Fill(10., deuteronN);
- mHistPidMult->Fill(11., dbarN);
- mHistPidMult->Fill(12., electronN);
- mHistPidMult->Fill(13., positronN);
- mHistPidMult->Fill(14., muonMinusN);
- mHistPidMult->Fill(15., muonPlusN);
-
- // Multiplicity of particles correlated with the event planes
- corrMultN /= (float)(Flow::nHars * Flow::nSels) ; 
- mHistMultPart->Fill(corrMultN) ;
- // ...in one unit rapidity
- corrMultUnit /= (float)(Flow::nHars * Flow::nSels) ; 
- mHistMultPartUnit->Fill(corrMultUnit) ;
-
- if(Debug1) { cout << FlowAnalysis << "Tracks Loop...    " << totalMult << " tracks done . (" << corrMultN << ") . " << endl ; }
-}
-//-----------------------------------------------------------------------
-int AliFlowAnalysisMaker::HarmonicsLoop(float eta, float phi, float pt, int numPid)
-{
- // HarmonicsLoop ...
-
- if(Debug2) { cout << FlowAnalysis << "Harmonic Loop . " << endl ; }
-
- int corrMultN = 0 ;
- float zFirstPoint = pFlowTrack->ZFirstPoint() ; 
- // float zLastPoint = pFlowTrack->ZLastPoint() ;
-
- // Looping over Selections and Harmonics
- for (int k = 0; k < Flow::nSels; k++) 
- {
-  pFlowSelect->SetSelection(k) ;
-  for (int j = 0; j < Flow::nHars; j++) 
-  {
-   bool oddHar = (j+1) % 2;
-   pFlowSelect->SetHarmonic(j);
-   double order  = (double)(j+1);
-   float psi_i, psi_2;
-   if(pFlowEvent->EtaSubs())          // particles with the opposite subevent
-   {
-    if(eta > 0) { psi_i = mPsiSub[1][k][j] ; }     //check
-    else       { psi_i = mPsiSub[0][k][j] ; }
-   } 
-   else if(order > 3. && !oddHar) 
-   {
-    psi_i = mPsi[k][1];  // 2nd harmomic event plane
-    if(psi_i > 2*TMath::Pi()/order) { psi_i -= 2*TMath::Pi()/order ; } 
-    if(psi_i > 2*TMath::Pi()/order) { psi_i -= 2*TMath::Pi()/order ; }
-   } 
-   else  // random subevents
-   {
-    psi_i = mPsi[k][j] ;
-   }
-
-   if(pFlowSelect->Select(pFlowTrack)) // Get detID
-   {
-    Bool_t kTpcPlus  = kFALSE ;
-    Bool_t kTpcMinus = kFALSE ;
-    Bool_t kTpcAll   = kFALSE ;
-
-    histFull[k].histFullHar[j].mHistYieldPt->Fill(pt);
-    histFull[k].histFullHar[j].mHistEtaPtPhi3D->Fill(eta, pt, phi);
-    histFull[k].histFullHar[j].mHistYield2D->Fill(eta, pt);
-    histFull[k].histFullHar[j].mHistDcaGlob->Fill(TMath::Abs(pFlowTrack->Dca()));
-
-    // Set Tpc (+ and -)
-    if(pFlowTrack->FitPtsTPC())    //OR*: AliESDtrack:: "TBits& GetTPCClusterMap()" or "Int_t GetTPCclusters(Int_t* idx)" ...
-    {
-     if(zFirstPoint >= 0. && eta > 0.)     { kTpcPlus  = kTRUE ; } 
-     else if(zFirstPoint <= 0. && eta < 0.) { kTpcMinus = kTRUE ; }
-     else                                  { kTpcAll   = kTRUE ; }       
-    }
-    else 
-    {
-     if(Debug2) { cout << FlowAnalysis << "!!! no TPC hits ( track ??? ) ." << endl ; }
-    }
-
-    // PID Multiplicities (particle for R.P.) - done just one time for each selection
-    if(j==0) { histFull[k].mHistBayPidMult->Fill(numPid) ; }
-
-    // Calculate weights for filling histograms   
-    float wt = 1. ; // TMath::Abs(pFlowEvent->Weight(k, j, pFlowTrack)) ; 
-
-    // Fill histograms with selections
-    if(kTpcPlus)       { histFull[k].histFullHar[j].mHistPhiPlus->Fill(phi,wt) ;  } 
-    else if(kTpcMinus) { histFull[k].histFullHar[j].mHistPhiMinus->Fill(phi,wt) ; } 
-    else if(kTpcAll)   { histFull[k].histFullHar[j].mHistPhiAll->Fill(phi,wt) ;   } 
-    histFull[k].histFullHar[j].mHistPhi->Fill(phi,wt) ;
-
-    // Get phiWgt from file
-    double phiWgt;
-    if(order > 3. && !oddHar) { phiWgt = pFlowEvent->PhiWeight(k, 1, pFlowTrack) ; } 
-    else                     { phiWgt = pFlowEvent->PhiWeight(k, j, pFlowTrack) ; }
-    if(oddHar && eta<0.)      { phiWgt /= -1. ; } // only for flat hists
-    // chk
-    if(Debug2) { cout << " Weight [" << k << "][" << j << "] (" << pFlowTrack->GetName() << ") = " << phiWgt << " or " << wt << " for phi = " << phi << endl ; }
-
-    // Fill Flat histograms
-    if(kTpcPlus)       { histFull[k].histFullHar[j].mHistPhiFlatPlus->Fill(phi, phiWgt) ; } 
-    else if(kTpcMinus) { histFull[k].histFullHar[j].mHistPhiFlatMinus->Fill(phi, phiWgt) ; } 
-    else if(kTpcAll)   { histFull[k].histFullHar[j].mHistPhiFlatAll->Fill(phi, phiWgt) ; } 
-    histFull[k].histFullHar[j].mHistPhiFlat->Fill(phi,phiWgt) ;
-    
-    if(oddHar && eta<0.)  { phiWgt *= -1. ; } // restore value
-
-    // Remove autocorrelations
-    TVector2 Q_i;
-    if(!pFlowEvent->EtaSubs())   // random subevents
-    {
-     if(order > 3. && !oddHar) // 2nd harmonic event plane
-     { 
-      Q_i.Set(phiWgt * cos(phi * 2), phiWgt * sin(phi * 2));
-      TVector2 mQ_i = mQ[k][1] - Q_i;
-      psi_i = mQ_i.Phi() / 2;
-      if(psi_i < 0.) { psi_i += TMath::Pi() ; } 
-     } 
-     else 
-     {
-      Q_i.Set(phiWgt * cos(phi * order), phiWgt * sin(phi * order));
-      TVector2 mQ_i = mQ[k][j] - Q_i;
-      psi_i = mQ_i.Phi() / order;
-      if(psi_i < 0.) { psi_i += 2*TMath::Pi()/order ; }
-     }
-    }
-          
-    // Remove autocorrelations of the second order 'particles' which are used for v1{EP1,EP2}.
-    if (mV1Ep1Ep2 == kTRUE && order == 1) 
-    {
-     AliFlowSelection usedForPsi2 = *pFlowSelect ;
-     usedForPsi2.SetHarmonic(1);
-     if(usedForPsi2.Select(pFlowTrack))  // particle was used for Psi2
-     {
-      Q_i.Set(phiWgt * cos(phi * 2), phiWgt * sin(phi * 2));
-      TVector2 mQ_i = mQ[k][1] - Q_i;
-      psi_2 = mQ_i.Phi() / 2;
-      if(psi_2 < 0.) { psi_2 += TMath::Pi() ; }
-     }
-     else                               // particle was not used for Psi2
-     { 
-      psi_2 = mPsi[k][1];
-     }
-    }
-   }
-   else
-   {
-    histFull[k].histFullHar[j].mHistYieldPtout->Fill(pt);
-    histFull[k].histFullHar[j].mHistEtaPtPhi3Dout->Fill(eta, pt, phi);
-    histFull[k].histFullHar[j].mHistYield2Dout->Fill(eta, pt);
-    histFull[k].histFullHar[j].mHistDcaGlobout->Fill(TMath::Abs(pFlowTrack->Dca()));
-   }
-
-   // Caculate v for all particles selected for correlation analysis
-   if(pFlowSelect->SelectPart(pFlowTrack)) 
-   {
-    corrMultN++;
-    
-    float v;
-    if (mV1Ep1Ep2 == kFALSE || order != 1) 
-    {
-     v = 100 * cos(order * (phi - psi_i)) ;
-    }
-    else // i.e. (mV1Ep1Ep2 == kTRUE && order == 1)
-    {
-     v = 100 * cos(phi + psi_i - 2*psi_2) ;
-    }
-    
-    float vFlip = v;
-    if(eta < 0 && oddHar) { vFlip *= -1 ; }
-    if(strlen(pFlowSelect->PidPart()) != 0) // pid, fill rapidity 
-    {
-     float rapidity = pFlowTrack->Y();
-     histFull[k].histFullHar[j].mHist_vObs2D->Fill(rapidity, pt, v);
-   
-     if(mPtRange_for_vEta[1] > mPtRange_for_vEta[0])  // cut is used
-     {
-      if(pt < mPtRange_for_vEta[1] && pt >= mPtRange_for_vEta[0]) // check cut range, fill if in range
-      {
-       histFull[k].histFullHar[j].mHist_vObsEta->Fill(rapidity, v);
-      }
-     }
-     else // cut is not used, fill in any case
-     { 
-      histFull[k].histFullHar[j].mHist_vObsEta->Fill(rapidity, v);
-     }
-    } 
-    else  // no pid, fill eta
-    {
-     histFull[k].histFullHar[j].mHist_vObs2D->Fill(eta, pt, v);
-
-     if(mPtRange_for_vEta[1] > mPtRange_for_vEta[0]) // cut is used
-     {
-      if(pt < mPtRange_for_vEta[1] && pt >= mPtRange_for_vEta[0]) // check cut range, fill if in range
-      {
-       histFull[k].histFullHar[j].mHist_vObsEta->Fill(eta, v);
-      }
-     }
-     else // cut is not used, fill in any case
-     { 
-      histFull[k].histFullHar[j].mHist_vObsEta->Fill(eta, v);
-     }
-    }
-
-    if(mEtaRange_for_vPt[1] > mEtaRange_for_vPt[0]) // cut is used
-    { 
-     if(TMath::Abs(eta) < mEtaRange_for_vPt[1] && TMath::Abs(eta) >= mEtaRange_for_vPt[0]) // check cut range, fill if in range
-     {
-      histFull[k].histFullHar[j].mHist_vObsPt->Fill(pt, vFlip);  // for odd harmonis /-/
-     }
-    }
-    else  // cut is not used, fill in any case
-    {
-     histFull[k].histFullHar[j].mHist_vObsPt->Fill(pt, vFlip);
-    }
-
-    // v_
-    Bool_t etaPtNoCut = kTRUE;
-    if(mPtRange_for_vEta[1] > mPtRange_for_vEta[0] && (pt < mPtRange_for_vEta[0] || pt >= mPtRange_for_vEta[1])) 
-    {
-     etaPtNoCut = kFALSE;
-    }
-    if(mEtaRange_for_vPt[1] > mEtaRange_for_vPt[0] && (TMath::Abs(eta) < mEtaRange_for_vPt[0] || TMath::Abs(eta) >= mEtaRange_for_vPt[1]))
-    {
-     etaPtNoCut = kFALSE;
-    }
-    if(etaPtNoCut) { histFull[k].mHist_vObs->Fill(order, vFlip) ; }
-    // Correlation of Phi of selected particles with Psi
-    float phi_i = phi;
-    if(eta < 0 && oddHar) 
-    {
-     phi_i += TMath::Pi() ; // backward particle and odd harmonic
-     if(phi_i > 2*TMath::Pi()) { phi_i -= 2*TMath::Pi() ; }
-    }
-    float dPhi = phi_i - psi_i;
-    if(dPhi < 0.)             { dPhi += 2*TMath::Pi() ; }
-    histFull[k].histFullHar[j].mHistPhiCorr->Fill(fmod((double)dPhi, 2*TMath::Pi() / order));
-   }
-  }
- }
- return corrMultN ;
-}
-//-----------------------------------------------------------------------
-void AliFlowAnalysisMaker::FillV0Histograms()
-{
- // v0s histograms
-
- if(Debug0) { cout << spaces << "V0s Loop . " << endl ; } 
-
- int corrMultV0 = 0 ;
-
- if(Debug1) { cout << spaces << "Looping over " << nV0s << "  flow V0s  . " << endl ; } 
- for(Int_t vloop=0;vloop<nV0s;vloop++) 
- {
-  pFlowV0 = (AliFlowV0*)pFlowV0s->At(vloop) ;      if(Debug3) { cout << "v0 n. " << vloop << endl ; pFlowV0->Dump() ; }
-
-  // // LABELS FOR V0s ARE NOT DEFINED !!!
-  // int label = pFlowV0->Label() ;                if(Debug3) { cout << vloop << " label: " << label << endl ; }
-
-  float mass = pFlowV0->Mass() ;                   if(Debug3) { cout << "mass " << mass << endl ; } 
-  float eta = pFlowV0->Eta() ;                     if(Debug3) { cout << "eta "  << eta << endl ; } 
-  float rapidity = pFlowV0->Y() ;                  if(Debug3) { cout << "Y   "  << rapidity << endl ; } 
-  float phi = pFlowV0->Phi() ;                     if(Debug3) { cout << "Phi "  << phi<< endl ; } 
-  float pt = pFlowV0->Pt() ;                       if(Debug3) { cout << "Pt "  << pt << endl ; }  
-  float totalp = pFlowV0->P() ;                    if(Debug3) { cout << "P "   << totalp << endl ; }   
-  int  charge = pFlowV0->Charge() ;                if(Debug3) { cout << "charge " << charge << endl ; }
-  float dca = pFlowV0->Dca() ;                     if(Debug3) { cout << "dca "  << dca << endl ; }  
-  float lenght = pFlowV0->V0Lenght() ;             if(Debug3) { cout << "lenght " << lenght << endl ; }
-  float sigma = pFlowV0->Sigma() ;                 if(Debug3) { cout << "sigma " << sigma << endl ; }  
-  float chi2 = pFlowV0->Chi2() ;                   if(Debug3) { cout << "chi2 " << chi2 << endl ; }  
-  Char_t pid[10] ; strcpy(pid, pFlowV0->Pid()) ;    if(Debug3) { cout << "pid "  << pid << endl ; }   
-  AliFlowTrack* daughterPlus = pFlowV0->DaughterP() ;   if(Debug3) { cout << "daughter + :  " << daughterPlus << endl ; }
-  AliFlowTrack* daughterMinus = pFlowV0->DaughterN() ;  if(Debug3) { cout << "daughter - :  " << daughterMinus << endl ; }
-  // -
-  mHistV0Mass->Fill(mass) ;
-  mHistV0EtaPtPhi3D->Fill(eta, pt, phi) ;
-  mHistV0YieldAll2D->Fill(eta, pt) ;
-  mHistV0Dca->Fill(dca);
-  mHistV0Chi2->Fill(chi2);
-  mHistV0Lenght->Fill(lenght);
-  mHistV0Sigma->Fill(sigma);
-  mHistV0MassPtSlices->Fill(mass,pt);
-  if(Debug3) { cout << spaces <<  "global histograms filled . " << endl ; }
-
-  if(pFlowSelect->SelectPart(pFlowV0))
-  {
-   bool inWin = pFlowSelect->SelectV0Part(pFlowV0) ;
-   bool sx = pFlowSelect->SelectV0sxSide(pFlowV0) ;
-   bool dx = pFlowSelect->SelectV0dxSide(pFlowV0) ;
-   corrMultV0++ ;
-
-   mHistV0YieldPart2D->Fill(eta, pt) ;
-   if(inWin) 
-   { 
-    mHistV0EtaPtPhi3DPart->Fill(eta, pt, phi) ;
-    mHistV0LenghtPart->Fill(lenght);
-    mHistV0DcaPart->Fill(dca);
-    mHistV0MassWin->Fill(mass) ; 
-    mHistV0BinEta->Fill(eta, eta);
-    mHistV0BinPt->Fill(pt, pt);   
-   }
-   else      
-   { 
-    mHistV0sbEtaPtPhi3DPart->Fill(eta, pt, phi) ;
-    mHistV0sbLenghtPart->Fill(lenght);
-    mHistV0sbDcaPart->Fill(dca);
-    mHistV0sbMassSide->Fill(mass) ; 
-    mHistV0sbBinEta->Fill(eta, eta);
-    mHistV0sbBinPt->Fill(pt, pt);
-   }
-
-   for(int k = 0; k < Flow::nSels; k++)  // sort of HarmonicsLoop - selection number used
-   {
-    pFlowSelect->SetSelection(k) ;
-    for(Int_t j=0;j<Flow::nHars;j++) 
-    {
-     Bool_t oddHar = (j+1) % 2 ;
-     Float_t order = (Float_t)(j+1) ;
-     pFlowSelect->SetHarmonic(j);                        if(Debug3) { cout << spaces <<  "start correlation computation .   " << j << endl ; }
-
-     // Remove autocorrelations
-     Float_t psi_i, psi_2 ;
-     TVector2 Q_1, Q_2 ;
-     Float_t phiDaughter1 = 0. ; Float_t phiDaughter2 = 0. ;
-     Double_t phiWgt1 = 0. ; Double_t phiWgt2 = 0. ;
-     // -
-     if(daughterPlus)
-     { // 1
-      pFlowTrack = daughterPlus ;
-      phiDaughter1 = pFlowTrack->Phi() ;                 if(Debug3) { cout << spaces <<  "track 1 . " << daughterPlus << " . phi1 = " << phiDaughter1 << " . " << endl ; } 
-      if(pFlowSelect->Select(pFlowTrack)) // Get phiWgt from file
-      {
-       if(order > 3. && !oddHar) { phiWgt1 = pFlowEvent->PhiWeight(k, 1, pFlowTrack) ; } 
-       else                     { phiWgt1 = pFlowEvent->PhiWeight(k, j, pFlowTrack) ; }
-      }
-      if(Debug3) { cout << spaces <<  "track 1 . " << daughterPlus << " . wgt1 = " << phiWgt1 << " . " << endl ; } 
-     }
-     if(daughterMinus)
-     { // 2
-      pFlowTrack = daughterMinus ;
-      phiDaughter2 = pFlowTrack->Phi() ;                 if(Debug3) { cout << spaces <<  "track 2 . " << daughterMinus << " . phi2 = " << phiDaughter2 << " . " << endl ; }
-      if(pFlowSelect->Select(pFlowTrack)) // Get phiWgt from file
-      {
-       if(order > 3. && !oddHar) { phiWgt2 = pFlowEvent->PhiWeight(k, 1, pFlowTrack) ; } 
-       else                     { phiWgt2 = pFlowEvent->PhiWeight(k, j, pFlowTrack) ; }
-      }
-      if(Debug3) { cout << spaces <<  "track 2 . " << daughterMinus << " . wgt2 = " << phiWgt2 << " . " << endl ; } 
-     }
-
-     // psi_2
-     Q_1.Set(phiWgt1 * cos(phiDaughter1 * 2), phiWgt1 * sin(phiDaughter1 * 2));
-     Q_2.Set(phiWgt2 * cos(phiDaughter2 * 2), phiWgt2 * sin(phiDaughter2 * 2));
-     TVector2 mQ_i = mQ[k][1] ; mQ_i -= Q_1 ; mQ_i -= Q_2 ; 
-     psi_2 = mQ_i.Phi() / 2 ;    
-     if(psi_2 < 0.)         { psi_2 += TMath::Pi() ; }
-     if(psi_2 > TMath::Pi()) { psi_2 -= TMath::Pi() ; } 
-     if(Debug3) { cout << spaces <<  "psi2 = " << psi_2 << " . " << endl ; }
-
-     // psi_i
-     if(order > 3. && !oddHar) { psi_i = psi_2 ; } 
-     else 
-     {
-      Q_1.Set(phiWgt1 * cos(phiDaughter1 * order), phiWgt1 * sin(phiDaughter1 * order));
-      Q_2.Set(phiWgt2 * cos(phiDaughter2 * order), phiWgt2 * sin(phiDaughter2 * order));
-      TVector2 mQ_i = mQ[k][j] ; mQ_i -= Q_1 ; mQ_i -= Q_2 ;
-      psi_i = mQ_i.Phi()/order ; 
-      if(psi_i < 0.)                 { psi_i += 2*TMath::Pi()/order ; }        
-      if(psi_i > 2*TMath::Pi()/order) { psi_i -= 2*TMath::Pi()/order ; } 
-     }
-     if(Debug3) { cout << spaces <<  "psi_i = " << psi_i << " . " << endl ; }
-
-    // Caculate v for all V0s selected for correlation analysis
-     float v ;
-     if(mV1Ep1Ep2 == kFALSE || order != 1) { v = 100 * cos(order * (phi - psi_i)) ; }
-     else { v = 100 * cos(phi + psi_i - 2*psi_2) ; }
-     float vFlip = v ; if(eta < 0 && oddHar) { vFlip *= -1 ; }
-
-     // invariant mass windows & sidebands
-     if(inWin) { histFull[k].histFullHar[j].mHistV0_vObs2D->Fill(eta, pt, v) ; }
-     else      { histFull[k].histFullHar[j].mHistV0sb_vObs2D->Fill(eta, pt, v) ; }
-
-     if(mPtRange_for_vEta[1] > mPtRange_for_vEta[0]) // cut is used
-     {
-      if(pt < mPtRange_for_vEta[1] && pt >= mPtRange_for_vEta[0]) // check cut range, fill if in range
-      {
-       if(inWin) { histFull[k].histFullHar[j].mHistV0_vObsEta->Fill(eta, v) ; }
-       else      
-       { 
-        histFull[k].histFullHar[j].mHistV0sb_vObsEta->Fill(eta, v) ; 
-       if(sx)      { histFull[k].histFullHar[j].mHistV0sb_vObsEta_sx->Fill(eta, v) ; } 
-       else if(dx) { histFull[k].histFullHar[j].mHistV0sb_vObsEta_dx->Fill(eta, v) ; } 
-       }
-      }
-     }
-     else // cut is not used, fill in any case
-     { 
-      if(inWin) { histFull[k].histFullHar[j].mHistV0_vObsEta->Fill(eta, v) ; }
-      else     
-      { 
-       histFull[k].histFullHar[j].mHistV0sb_vObsEta->Fill(eta, v) ; 
-       if(sx)     { histFull[k].histFullHar[j].mHistV0sb_vObsEta_sx->Fill(eta, v) ; } 
-       else if(dx) { histFull[k].histFullHar[j].mHistV0sb_vObsEta_dx->Fill(eta, v) ; } 
-      }
-     } 
-     if(mEtaRange_for_vPt[1] > mEtaRange_for_vPt[0]) // cut is used
-     {
-      if(TMath::Abs(eta) < mEtaRange_for_vPt[1] && TMath::Abs(eta) >= mEtaRange_for_vPt[0]) // check cut range, fill if in range
-      {          
-       if(inWin) { histFull[k].histFullHar[j].mHistV0_vObsPt->Fill(pt, vFlip) ; }      // for odd harmonis /-/
-       else      
-       { 
-        histFull[k].histFullHar[j].mHistV0sb_vObsPt->Fill(pt, vFlip) ; 
-        if(sx)     { histFull[k].histFullHar[j].mHistV0sb_vObsPt_sx->Fill(eta, v) ; } 
-        else if(dx) { histFull[k].histFullHar[j].mHistV0sb_vObsPt_dx->Fill(eta, v) ; }         
-       }
-      }
-     }
-     else  // cut is not used, fill in any case
-     {
-      if(inWin) { histFull[k].histFullHar[j].mHistV0_vObsPt->Fill(pt, vFlip) ; } 
-      else     
-      { 
-       histFull[k].histFullHar[j].mHistV0sb_vObsPt->Fill(pt, vFlip) ; 
-       if(sx)     { histFull[k].histFullHar[j].mHistV0sb_vObsPt_sx->Fill(eta, v) ; } 
-       else if(dx) { histFull[k].histFullHar[j].mHistV0sb_vObsPt_dx->Fill(eta, v) ; }  
-      }
-     }
-     // v_
-     Bool_t etaPtNoCut = kTRUE;
-     if(mPtRange_for_vEta[1] > mPtRange_for_vEta[0] && (pt < mPtRange_for_vEta[0] || pt >= mPtRange_for_vEta[1])) 
-     {
-      etaPtNoCut = kFALSE;
-     }
-     if(mEtaRange_for_vPt[1] > mEtaRange_for_vPt[0] && (TMath::Abs(eta) < mEtaRange_for_vPt[0] || TMath::Abs(eta) >= mEtaRange_for_vPt[1]))
-     {
-      etaPtNoCut = kFALSE;
-     }
-     if(etaPtNoCut) 
-     { 
-      if(inWin) { histFull[k].mHistV0_vObs->Fill(order, vFlip) ; }
-      else     
-      { 
-       if(sx)     { histFull[k].mHistV0sb_vObs_sx->Fill(order, vFlip) ; } 
-       else if(dx) { histFull[k].mHistV0sb_vObs_dx->Fill(order, vFlip) ; }  
-      }
-     }
-   
-     // Correlation of Phi of selected v0s with Psi
-     float phi_i = phi;
-     if(eta < 0 && oddHar)
-     {
-      phi_i += TMath::Pi() ; // backward particle and odd harmonic
-      if(phi_i > 2*TMath::Pi()) { phi_i -= 2*TMath::Pi() ; }
-     }
-     float dPhi = phi_i - psi_i;
-     if(dPhi < 0.)  { dPhi += 2*TMath::Pi() ; }
-
-     if(inWin) { histFull[k].histFullHar[j].mHistV0PhiCorr->Fill(fmod((double)dPhi, 2*TMath::Pi() / order)) ; } 
-     else      { histFull[k].histFullHar[j].mHistV0sbPhiCorr->Fill(fmod((double)dPhi, 2*TMath::Pi() / order)) ; }
-    }
-   }
-  }
-  //delete pFlowV0 ; pFlowV0 = 0 ;
-  //delete pFlowTrack ; pFlowTrack = 0 ;
- }
- mHistV0MultPart->Fill(corrMultV0) ;
-
- if(Debug1) { cout << FlowAnalysis << "V0s Loop...    " << nV0s << " v0s done . (" << corrMultV0 << ") . " << endl ; }
-}
-//-----------------------------------------------------------------------
-void AliFlowAnalysisMaker::FillLabels()  
-{
- // Reads the tracks label (i.e. the link from ESD tracking to KineTree)
- // and puts them in a TH2F (nEvt x nLabels) for later use. The histogram 
- // is then  saved in the standar output.
- if(Debug1) { cout << FlowAnalysis << "Filling Labels . " << endl ; } 
-
-// *temp*  --  !uncomment!
-//  if(mLabellingFirst)        
-//  {
-//   if(Debug1) { cout << spaces << " Creating Labels hist ( max label = " << maxLabel << " ) . " << endl ; }
-//   mLabellingFirst = kFALSE ; 
-//   TString* labTitle = new TString("TracksLabel_full") ; 
-//   int maxMaxLabel = maxLabel + (int)((float)maxLabel / 10.) ;
-//   mLabHist = new TH2F(labTitle->Data(),labTitle->Data(),Flow::nSels+4,0.,Flow::nSels+4.,maxMaxLabel+1,0.,maxMaxLabel+1.) ;
-//   if(Flow::nSels==2) { mLabHist->SetXTitle("tracks , sel0 , sel1 , selPart , v0s , selV0s ") ; }
-//   else  { mLabHist->SetXTitle("tracks , sel... , selPart , v0s , selV0s ") ; }
-//   mLabHist->SetYTitle("MC label") ;
-//   delete labTitle ;
-//   if(Debug1) { cout << spaces << " Labels histogram created ( max bin = " << maxMaxLabel << " ) . " << endl ; }
-//  }
-// *temp*  --  !uncomment! 
-
- // Labels histogram
- float lBin = 0. ; float label = 0. ; 
- for(int tk=0;tk<nTracks;tk++) 
- {
-  pFlowTrack = (AliFlowTrack*)pFlowTracks->At(tk) ;
-  label = (float)pFlowTrack->Label() ;                                 if(Debug4) { cout << " trak. " << tk  << " label. " << label  << endl ; }
-  lBin = 0.1 ; 
-  mLabHist->Fill(lBin,label) ;                                 if(Debug4) { cout << "    allTr -       bin " << lBin << endl ; } 
-  for(int ss=0;ss<Flow::nSels;ss++) 
-  {
-   lBin = (float)ss + 1.1 ;
-   if(pFlowTrack->Select(0,ss,-1))       
-   { 
-    mLabHist->Fill(lBin,label) ;                                       if(Debug4) { cout << "    sel " << ss << "      -       bin " << lBin << endl ; } 
-   }
-  }
-  lBin = (float)Flow::nSels + 1.1 ;
-  if(pFlowSelect->SelectPart(pFlowTrack)) 
-  { 
-   mLabHist->Fill(lBin,label) ;                                if(Debug4) { cout << "    part  -       bin " << lBin << endl ; }  
-  }
- }
- // LABELS FOR V0s ARE NOT DEFINED (...but for each daughter)
- if(mV0)
- {
-  float label1 = 0. ; float label2 = 0. ; 
-  for(int vk=0;vk<nV0s;vk++) 
-  {
-   pFlowV0 = (AliFlowV0*)pFlowV0s->At(vk) ;                          if(Debug4) { cout << " v0  . " << vk  << " label from daughters .... " << endl ; }
-   //label = (float)pFlowV0->Label() ;                       if(Debug4) { cout << " v0  . " << vk  << " label. " << label  << endl ; }
-   pFlowTrack = (AliFlowTrack*)pFlowV0->DaughterP() ; label1 = (float)pFlowTrack->Label() ;
-   pFlowTrack = (AliFlowTrack*)pFlowV0->DaughterN() ; label2 = (float)pFlowTrack->Label() ;
-                                                             if(Debug4) { cout << " daughter1 = " << label1  << " , daughter2 = " << label2  << endl ; }
-   lBin = (float)Flow::nSels + 2.1 ; 
-   mLabHist->Fill(lBin,label1) ;                             if(Debug4) { cout << "    allV0 -       bin " << lBin << endl ; } 
-   mLabHist->Fill(lBin,label2) ;                             if(Debug4) { cout << "    allV0 -       bin " << lBin << endl ; } 
-   lBin = (float)Flow::nSels + 3.1 ;   
-   if(pFlowSelect->SelectPart(pFlowV0)) 
-   {
-    mLabHist->Fill(lBin,label1) ;                            if(Debug4) { cout << "    V0 part        -       bin " << lBin << endl ; }  
-    mLabHist->Fill(lBin,label2) ;                            if(Debug4) { cout << "    V0 part        -       bin " << lBin << endl ; }  
-   }
-  }
- }
-}
-//----------------------------------------------------------------------
-// ###
-//----------------------------------------------------------------------
-void AliFlowAnalysisMaker::Resolution()
-{
- // Calculates the resolution, corrects the flow values, and stores all 
- // of them in few new histograms (see mVnResHistList). Histogram are 
- // then saved in the same otput file.
- if(Debug0) { cout << FlowAnalysis << "Calculating Resolution . " << endl ; cout << endl ; } 
- // VnRes histogram collection
- mVnResHistList = new TOrdCollection(Flow::nSels*Flow::nHars);
- // Calculate resolution from sqrt(mHistCos)
- double cosPair[Flow::nSels][Flow::nHars];
- double cosPairErr[Flow::nSels][Flow::nHars];
- double content, contentV0;
- double error, errorV0;
- double totalError;
- TString* histTitle;
-
- for(int k = 0; k < Flow::nSels; k++)
- {
-  // v for tracks (corrected for resolution)
-  histTitle = new TString("Flow_v_Sel");
-  *histTitle += k+1;
-  histFull[k].mHist_v = histFull[k].mHist_vObs->ProjectionX(histTitle->Data());
-  histFull[k].mHist_v->SetTitle(histTitle->Data());
-  histFull[k].mHist_v->SetXTitle("Harmonic");
-  histFull[k].mHist_v->SetYTitle("v (%)");
-  delete histTitle;
-  mVnResHistList->AddLast(histFull[k].mHist_v);
-   
-  // v for v0s (corrected for resolution)
-  histTitle = new TString("FlowV0_v_Sel");
-  *histTitle += k+1;
-  histFull[k].mHistV0_v = histFull[k].mHistV0_vObs->ProjectionX(histTitle->Data());
-  histFull[k].mHistV0_v->SetTitle(histTitle->Data());
-  histFull[k].mHistV0_v->SetXTitle("Harmonic");
-  histFull[k].mHistV0_v->SetYTitle("v (%)");
-  delete histTitle;
-  mVnResHistList->AddLast(histFull[k].mHistV0_v);
-   
-  for(int j = 0; j < Flow::nHars; j++) 
-  {
-   double order = (double)(j+1);
-   cosPair[k][j]    = histFull[k].mHistCos->GetBinContent(j+1);
-   cosPairErr[k][j] = histFull[k].mHistCos->GetBinError(j+1);
-   if(cosPair[k][j] > 0.) 
-   {
-    double resSub = 0. ;
-    double resSubErr = 0. ;
-    if(mV1Ep1Ep2 == kTRUE && order == 1) // calculate resolution of second order event plane first
-    {
-     double res2 = 0. ;
-     double res2error = 0. ;
-     if(histFull[k].mHistCos->GetBinContent(2) > 0.) 
-     {
-      if(mEtaSub)  // sub res only
-      {
-       res2 = TMath::Sqrt(histFull[k].mHistCos->GetBinContent(2));
-       res2error = histFull[k].mHistCos->GetBinError(2) / (2. * res2);
-      }
-      else 
-      {
-       if (histFull[k].mHistCos->GetBinContent(2) > 0.92)  // resolution saturates
-       {
-        res2 = 0.99;
-        res2error = 0.007;
-       } 
-       else 
-       {
-        double deltaRes2Sub = 0.005;  // differential for the error propagation
-        double res2Sub = TMath::Sqrt(histFull[k].mHistCos->GetBinContent(2));
-        double res2SubErr = histFull[k].mHistCos->GetBinError(2) / (2. * res2Sub);
-        double chiSub2 = chi(res2Sub);
-        double chiSub2Delta = chi(res2Sub + deltaRes2Sub);
-        res2 = resEventPlane(TMath::Sqrt(2.) * chiSub2); // full event plane res.
-        double mRes2Delta = resEventPlane(TMath::Sqrt(2.) * chiSub2Delta);
-        res2error = res2SubErr * fabs((double)res2 - mRes2Delta) / deltaRes2Sub;
-       }
-      }
-     }
-     else 
-     {
-      res2 = 0.;
-      res2error = 0.;
-     }
-     // now put everything together with first order event plane
-     mRes[k][j]    = TMath::Sqrt(cosPair[k][0]*res2);
-     mResErr[k][j] = 1./(2.*mRes[k][j]) * TMath::Sqrt(cosPairErr[k][0]*cosPairErr[k][0] + res2error*res2error); // Gaussian error propagation
-    }
-    else if(mEtaSub)  // sub res only
-    {
-     resSub = TMath::Sqrt(cosPair[k][j]);                
-     resSubErr = cosPairErr[k][j] / (2. * resSub);
-     mRes[k][j]    = resSub;
-     mResErr[k][j] = resSubErr;
-    } 
-    else if(order==4. || order==6.|| order==8.)  // 2nd harmonic event plane
-    {
-     double deltaResSub = 0.005;  // differential for the error propagation
-     double resSub = TMath::Sqrt(cosPair[k][1]);
-     double resSubErr = cosPairErr[k][1] / (2. * resSub);
-     double chiSub = chi(resSub);
-     double chiSubDelta = chi(resSub + deltaResSub);
-     double mResDelta;
-     if (order==4.) 
-     {
-      mRes[k][j] = resEventPlaneK2(TMath::Sqrt(2.) * chiSub); // full event plane res.
-      mResDelta = resEventPlaneK2(TMath::Sqrt(2.) * chiSubDelta);
-     } 
-     else if(order==6.) 
-     {
-      mRes[k][j] = resEventPlaneK3(TMath::Sqrt(2.) * chiSub); // full event plane res.
-      mResDelta = resEventPlaneK3(TMath::Sqrt(2.) * chiSubDelta);
-     } 
-     else 
-     {
-      mRes[k][j] = resEventPlaneK4(TMath::Sqrt(2.) * chiSub); // full event plane res.
-      mResDelta = resEventPlaneK4(TMath::Sqrt(2.) * chiSubDelta);
-     }
-     mResErr[k][j] = resSubErr * fabs((double)mRes[k][j] - mResDelta) / deltaResSub;
-    }
-    else 
-    {
-     if(cosPair[k][j] > 0.92) // resolution saturates
-     {
-      mRes[k][j]    = 0.99;
-      mResErr[k][j] = 0.007;
-     } 
-     else 
-     {
-      double deltaResSub = 0.005;  // differential for the error propagation
-      double resSub = TMath::Sqrt(cosPair[k][j]);
-      double resSubErr = cosPairErr[k][j] / (2. * resSub);
-      double chiSub = chi(resSub);
-      double chiSubDelta = chi(resSub + deltaResSub);
-      mRes[k][j] = resEventPlane(TMath::Sqrt(2.) * chiSub); // full event plane res.
-      double mResDelta = resEventPlane(TMath::Sqrt(2.) * chiSubDelta);
-      mResErr[k][j] = resSubErr * TMath::Abs((double)mRes[k][j] - mResDelta) / deltaResSub;
-     }
-    }
-   }
-   else  // subevent correlation must be positive
-   {
-    mRes[k][j]    = 0.;
-    mResErr[k][j] = 0.;
-   }
-   histFull[k].mHistRes->SetBinContent(j+1, mRes[k][j]);
-   histFull[k].mHistRes->SetBinError(j+1, mResErr[k][j]);
-
-   // Create the v 2D histogram (Flow corrected for res.) - v,Pt,Eta
-   histTitle = new TString("Flow_v2D_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHist_v2D = histFull[k].histFullHar[j].mHist_vObs2D->ProjectionXY(histTitle->Data());
-   histFull[k].histFullHar[j].mHist_v2D->SetTitle(histTitle->Data());
-   histFull[k].histFullHar[j].mHist_v2D->SetXTitle((char*)xLabel.Data());
-   histFull[k].histFullHar[j].mHist_v2D->SetYTitle("Pt (GeV/c)");
-   histFull[k].histFullHar[j].mHist_v2D->SetZTitle("v (%)");
-   delete histTitle;
-   mVnResHistList->AddLast(histFull[k].histFullHar[j].mHist_v2D);
-
-   // Create the 1D v histograms - v,Eta
-   histTitle = new TString("Flow_vEta_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHist_vEta = histFull[k].histFullHar[j].mHist_vObsEta->ProjectionX(histTitle->Data());
-   histFull[k].histFullHar[j].mHist_vEta->SetTitle(histTitle->Data());
-   histFull[k].histFullHar[j].mHist_vEta->SetXTitle((char*)xLabel.Data());
-   histFull[k].histFullHar[j].mHist_vEta->SetYTitle("v (%)");
-   delete histTitle;
-   mVnResHistList->AddLast(histFull[k].histFullHar[j].mHist_vEta);
-   
-   // v,Pt
-   histTitle = new TString("Flow_vPt_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHist_vPt = histFull[k].histFullHar[j].mHist_vObsPt->ProjectionX(histTitle->Data());
-   histFull[k].histFullHar[j].mHist_vPt->SetTitle(histTitle->Data());
-   histFull[k].histFullHar[j].mHist_vPt->SetXTitle("Pt (GeV/c)");
-   histFull[k].histFullHar[j].mHist_vPt->SetYTitle("v (%)");
-   delete histTitle;
-   mVnResHistList->AddLast(histFull[k].histFullHar[j].mHist_vPt);
-
-   // Create the v 2D histogram (V0s Flow corrected for res.) - v,Pt,Eta
-   histTitle = new TString("FlowV0_v2D_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistV0_v2D = histFull[k].histFullHar[j].mHistV0_vObs2D->ProjectionXY(histTitle->Data());
-   histFull[k].histFullHar[j].mHistV0_v2D->SetTitle(histTitle->Data());
-   histFull[k].histFullHar[j].mHistV0_v2D->SetXTitle((char*)xLabel.Data());
-   histFull[k].histFullHar[j].mHistV0_v2D->SetYTitle("Pt (GeV/c)");
-   histFull[k].histFullHar[j].mHistV0_v2D->SetZTitle("v (%)");
-   delete histTitle;
-   mVnResHistList->AddLast(histFull[k].histFullHar[j].mHistV0_v2D);
-
-   // Create the 1D v histograms (V0s) - v,Eta
-   histTitle = new TString("FlowV0_vEta_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistV0_vEta = histFull[k].histFullHar[j].mHistV0_vObsEta->ProjectionX(histTitle->Data());
-   histFull[k].histFullHar[j].mHistV0_vEta->SetTitle(histTitle->Data());
-   histFull[k].histFullHar[j].mHistV0_vEta->SetXTitle((char*)xLabel.Data());
-   histFull[k].histFullHar[j].mHistV0_vEta->SetYTitle("v (%)");
-   delete histTitle;
-   mVnResHistList->AddLast(histFull[k].histFullHar[j].mHistV0_vEta);
-   
-   // (V0s) v,Pt
-   histTitle = new TString("FlowV0_vPt_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistV0_vPt = histFull[k].histFullHar[j].mHistV0_vObsPt->ProjectionX(histTitle->Data());
-   histFull[k].histFullHar[j].mHistV0_vPt->SetTitle(histTitle->Data());
-   histFull[k].histFullHar[j].mHistV0_vPt->SetXTitle("Pt (GeV/c)");
-   histFull[k].histFullHar[j].mHistV0_vPt->SetYTitle("v (%)");
-   delete histTitle;
-   mVnResHistList->AddLast(histFull[k].histFullHar[j].mHistV0_vPt);
-
-   // Create the v 2D histogram (V0s sidebands Flow corrected for res.) - v,Pt,Eta
-   histTitle = new TString("FlowV0sb_v2D_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistV0sb_v2D = histFull[k].histFullHar[j].mHistV0sb_vObs2D->ProjectionXY(histTitle->Data());
-   histFull[k].histFullHar[j].mHistV0sb_v2D->SetTitle(histTitle->Data());
-   histFull[k].histFullHar[j].mHistV0sb_v2D->SetXTitle((char*)xLabel.Data());
-   histFull[k].histFullHar[j].mHistV0sb_v2D->SetYTitle("Pt (GeV/c)");
-   histFull[k].histFullHar[j].mHistV0sb_v2D->SetZTitle("v (%)");
-   delete histTitle;
-   mVnResHistList->AddLast(histFull[k].histFullHar[j].mHistV0sb_v2D);
-
-   // Create the 1D v histograms (V0s sidebands) - v,Eta
-   histTitle = new TString("FlowV0sb_vEta_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistV0sb_vEta = histFull[k].histFullHar[j].mHistV0sb_vObsEta->ProjectionX(histTitle->Data());
-   histFull[k].histFullHar[j].mHistV0sb_vEta->SetTitle(histTitle->Data());
-   histFull[k].histFullHar[j].mHistV0sb_vEta->SetXTitle((char*)xLabel.Data());
-   histFull[k].histFullHar[j].mHistV0sb_vEta->SetYTitle("v (%)");
-   delete histTitle;
-   mVnResHistList->AddLast(histFull[k].histFullHar[j].mHistV0sb_vEta);
-   
-   // (V0s sidebands) v,Pt
-   histTitle = new TString("FlowV0sb_vPt_Sel");
-   *histTitle += k+1;
-   histTitle->Append("_Har");
-   *histTitle += j+1;
-   histFull[k].histFullHar[j].mHistV0sb_vPt = histFull[k].histFullHar[j].mHistV0sb_vObsPt->ProjectionX(histTitle->Data());
-   histFull[k].histFullHar[j].mHistV0sb_vPt->SetTitle(histTitle->Data());
-   histFull[k].histFullHar[j].mHistV0sb_vPt->SetXTitle("Pt (GeV/c)");
-   histFull[k].histFullHar[j].mHistV0sb_vPt->SetYTitle("v (%)");
-   delete histTitle;
-   mVnResHistList->AddLast(histFull[k].histFullHar[j].mHistV0sb_vPt);
-
-  // Calulate v = vObs / Resolution
-   if(mRes[k][j]) 
-   {
-    cout << FlowAnalysis << "Resolution of the " << j+1 << "th harmonic = " << mRes[k][j] << " +/- " << mResErr[k][j] << endl;
-    // selected tracks
-    histFull[k].histFullHar[j].mHist_v2D->Scale(1. / mRes[k][j]);
-    histFull[k].histFullHar[j].mHist_vEta->Scale(1. / mRes[k][j]);
-    histFull[k].histFullHar[j].mHist_vPt->Scale(1. / mRes[k][j]);
-    content = histFull[k].mHist_v->GetBinContent(j+1);        
-    content /=  mRes[k][j]; 
-    histFull[k].mHist_v->SetBinContent(j+1, content);            
-    // selected V0s    
-    histFull[k].histFullHar[j].mHistV0_v2D->Scale(1. / mRes[k][j]);
-    histFull[k].histFullHar[j].mHistV0_vEta->Scale(1. / mRes[k][j]);
-    histFull[k].histFullHar[j].mHistV0_vPt->Scale(1. / mRes[k][j]);
-    contentV0 = histFull[k].mHistV0_v->GetBinContent(j+1);        
-    contentV0 /=  mRes[k][j];
-    histFull[k].mHistV0_v->SetBinContent(j+1, contentV0);            
-    // V0s sidebands    
-    histFull[k].histFullHar[j].mHistV0sb_v2D->Scale(1. / mRes[k][j]);
-    histFull[k].histFullHar[j].mHistV0sb_vEta->Scale(1. / mRes[k][j]);
-    histFull[k].histFullHar[j].mHistV0sb_vPt->Scale(1. / mRes[k][j]);
-    // The systematic error of the resolution is folded in.
-    // tracks
-    error = histFull[k].mHist_v->GetBinError(j+1) ; 
-    error /= mRes[k][j];                                         
-    totalError = fabs(content) * TMath::Sqrt((error/content)*(error/content) + (mResErr[k][j]/mRes[k][j])*(mResErr[k][j]/mRes[k][j]));
-    histFull[k].mHist_v->SetBinError(j+1, totalError);
-    cout << FlowAnalysis << "v" << j+1 << "= (" << content << " +/- " << error << " +/- " << totalError << "(with syst.)) %" << endl;
-    // V0s
-    errorV0 = histFull[k].mHistV0_v->GetBinError(j+1) ; 
-    errorV0 /= mRes[k][j]; 
-    if (contentV0>0)
-      totalError = fabs(contentV0) * TMath::Sqrt((errorV0/contentV0)*(errorV0/contentV0) + (mResErr[k][j]/mRes[k][j])*(mResErr[k][j]/mRes[k][j]));
-    else
-      totalError = 0;
-    histFull[k].mHistV0_v->SetBinError(j+1, totalError);
-   } 
-   else 
-   {
-    cout << "##### Resolution of the " << j+1 << "th harmonic was zero." << endl;
-    // tracks hist
-    histFull[k].histFullHar[j].mHist_v2D->Reset();
-    histFull[k].histFullHar[j].mHist_vEta->Reset();
-    histFull[k].histFullHar[j].mHist_vPt->Reset();
-    histFull[k].mHist_v->SetBinContent(j+1, 0.);
-    histFull[k].mHist_v->SetBinError(j+1, 0.);
-    // v0s hist
-    histFull[k].histFullHar[j].mHistV0_v2D->Reset();
-    histFull[k].histFullHar[j].mHistV0_vEta->Reset();
-    histFull[k].histFullHar[j].mHistV0_vPt->Reset();
-    histFull[k].histFullHar[j].mHistV0sb_v2D->Reset();
-    histFull[k].histFullHar[j].mHistV0sb_vEta->Reset();
-    histFull[k].histFullHar[j].mHistV0sb_vPt->Reset();
-    histFull[k].mHistV0_v->SetBinContent(j+1, 0.);
-    histFull[k].mHistV0_v->SetBinError(j+1, 0.);
-   }
-  }
- }
- if(Debug1) { cout << FlowAnalysis << "Done . " << endl ; cout << endl ; }
-
- return ;
-}
-//-----------------------------------------------------------------------
-Double_t AliFlowAnalysisMaker::chi(double res)          // chi from the event plane resolution
-{
- double chi   = 2.0;
- double delta = 1.0;
- for(int i = 0; i < 15; i++) 
- {
-  if(resEventPlane(chi) < res) { chi = chi + delta ; }
-  else                         { chi = chi - delta ; }
-  delta = delta / 2.;
- }
-
- return chi;
-}
-//-----------------------------------------------------------------------
-Double_t AliFlowAnalysisMaker::resEventPlane(double chi)    // plane resolution as function of chi
-{
- double con = TMath::Sqrt(TMath::Pi()/2)/2 ;   // ~ 0.626657
- double arg = chi * chi / 4.;
- Double_t res = con * chi * exp(-arg) * (TMath::BesselI0(arg) + TMath::BesselI1(arg)); 
-
- return res ;
-}
-//-----------------------------------------------------------------------
-Double_t AliFlowAnalysisMaker::resEventPlaneK2(double chi)  // ... for the case k=2.
-{
- double con = TMath::Sqrt(TMath::Pi()/2)/2 ;   // ~ 0.626657
- double arg = chi * chi / 4.;
-
- double besselOneHalf = TMath::Sqrt(arg/(TMath::Pi()/2)) * sinh(arg)/arg;
- double besselThreeHalfs = TMath::Sqrt(arg/(TMath::Pi()/2)) * (cosh(arg)/arg - sinh(arg)/(arg*arg));
- Double_t res = con * chi * exp(-arg) * (besselOneHalf + besselThreeHalfs); 
-
- return res;
-}
-//-----------------------------------------------------------------------
-Double_t AliFlowAnalysisMaker::resEventPlaneK3(double chi) // ...for the case k=3.
-{
- double con = TMath::Sqrt(TMath::Pi()/2)/2 ;   // ~ 0.626657
- double arg = chi * chi / 4.;
- Double_t res = con * chi * exp(-arg) * (TMath::BesselI1(arg) + TMath::BesselI(2, arg)); 
-
- return res;
-}
-//-----------------------------------------------------------------------
-Double_t AliFlowAnalysisMaker::resEventPlaneK4(double chi) // ...for the case k=4.
-{
- double con = TMath::Sqrt(TMath::Pi()/2)/2 ;   // ~ 0.626657
- double arg = chi * chi / 4.;
-
- double besselOneHalf = TMath::Sqrt(arg/(TMath::Pi()/2)) * sinh(arg)/arg;
- double besselThreeHalfs = TMath::Sqrt(arg/(TMath::Pi()/2)) * (cosh(arg)/arg - sinh(arg)/(arg*arg));
- double besselFiveHalfs = besselOneHalf - 3*besselThreeHalfs/arg;
- Double_t res = con * chi * exp(-arg) * (besselThreeHalfs + besselFiveHalfs); 
-
- return res;
-}
-//-----------------------------------------------------------------------
-Float_t AliFlowAnalysisMaker::Res(Int_t eventN, Int_t harN)    const   { return mRes[eventN][harN]; }
-Float_t AliFlowAnalysisMaker::ResErr(Int_t eventN, Int_t harN)         const   { return mResErr[eventN][harN]; }
-//-----------------------------------------------------------------------
-// ###
-//-----------------------------------------------------------------------
-TString AliFlowAnalysisMaker::GetHistFileName()                const   { return mHistFileName ; }
-TString AliFlowAnalysisMaker::GetPhiWgtFileName()              const   { return mPhiWgtFileName ; }
-TString AliFlowAnalysisMaker::GetInputFileName()               const   { return mFlowEvtFileName ; }
-//-----------------------------------------------------------------------
-void AliFlowAnalysisMaker::SetV1Ep1Ep2(Bool_t v1Ep1Ep2)                { mV1Ep1Ep2 = v1Ep1Ep2 ; }
-void AliFlowAnalysisMaker::SetFlowForV0(Bool_t fV0)                    { mV0 = fV0 ; }
-void AliFlowAnalysisMaker::SetEtaSub()                                         { mEtaSub = kTRUE ; }
-void AliFlowAnalysisMaker::SetHistFileName(TString name)               { mHistFileName = name ; }
-void AliFlowAnalysisMaker::SetPhiWgtFileName(TString name)             { mPhiWgtFileName = name ; }
-void AliFlowAnalysisMaker::SetInputFileName(TString name)              { mFlowEvtFileName = name ; }
-void AliFlowAnalysisMaker::SetShuffle(Bool_t sh)                       { mShuffle = sh ; }
-void AliFlowAnalysisMaker::SetRedoWgt(Bool_t rd)                       { mRedoWgt = rd ; }
-
-void AliFlowAnalysisMaker::SetUsePhiWgt(Bool_t pw)                     { mPhiWgt = pw ; }
-void AliFlowAnalysisMaker::SetUseBayWgt(Bool_t bw)                     { mBayWgt = bw ; }
-void AliFlowAnalysisMaker::SetUsePtWgt(Bool_t ptw)                     { mPtWgt = ptw ; }
-void AliFlowAnalysisMaker::SetUseEtaWgt(Bool_t etw)                    { mEtaWgt = etw ; }
-void AliFlowAnalysisMaker::SetUseOnePhiWgt()                           { mOnePhiWgt = kTRUE ; }
-void AliFlowAnalysisMaker::SetUseFirstLastPhiWgt()                     { mOnePhiWgt = kFALSE ; }
-
-void AliFlowAnalysisMaker::SetFillLabels(Bool_t lb)                    { mLabelling = lb ; }
-void AliFlowAnalysisMaker::SetMaxLabel(Int_t bin)                      { maxLabel = bin ; }
-void AliFlowAnalysisMaker::SetOneInputFile(Bool_t in)                  { fOneInputFile = in ; }
-void AliFlowAnalysisMaker::SetMakeAll(Bool_t mka)                      { mMakeAll = mka ; }
-//-----------------------------------------------------------------------
-void AliFlowAnalysisMaker::SetInputFileNames(TString name)             
-{ 
- TObjString* objName = new TObjString(name.Data()) ; 
- fFileNames.Add(objName) ;
-}
-//-----------------------------------------------------------------------
-void AliFlowAnalysisMaker::SetHistoRanges(float etaMin, float etaMax, int EtaBins)    
-{
- // sets eta limits for histogram 
-
- mEtaMin = etaMin ;
- mEtaMax = etaMax ;
- mNEtaBins = EtaBins ;
-}
-//------------------------------------------------------------------------
-void AliFlowAnalysisMaker::SetPtRange_for_vEta(Float_t lo, Float_t hi)  
-{
- // pt range for the v(eta) histograms
-
- mPtRange_for_vEta[0] = lo ;
- mPtRange_for_vEta[1] = hi ;
-}
-//------------------------------------------------------------------------
-void AliFlowAnalysisMaker::SetEtaRange_for_vPt(Float_t lo, Float_t hi)
-{
- // |eta| range for the v(pt) histograms 
- mEtaRange_for_vPt[0] = lo ;
- mEtaRange_for_vPt[1] = hi ;
-}
-//------------------------------------------------------------------------
-void AliFlowAnalysisMaker::SetDebugg(Int_t db)  
-{
- // debug options (0..3) 
- mDebug = db ; 
- Debug0 = kTRUE ; Debug1 = kFALSE ; Debug2 = kFALSE ; Debug3 = kFALSE ; 
- if(mDebug == 1) { Debug1 = kTRUE ; }
- if(mDebug == 2) { Debug1 = kTRUE ; Debug2 = kTRUE ; } 
- if(mDebug == 3) { Debug1 = kTRUE ; Debug3 = kTRUE ; } 
- if(mDebug == 4) { Debug1 = kTRUE ; Debug4 = kTRUE ; } 
- if(mDebug > 4)  { Debug1 = kTRUE ; Debug2 = kTRUE ; Debug3 = kTRUE ; Debug4 = kTRUE ; } 
-}
-//-----------------------------------------------------------------------
-
diff --git a/PWG2/FLOW/AliFlowAnalysisMaker.h b/PWG2/FLOW/AliFlowAnalysisMaker.h
deleted file mode 100644 (file)
index 4444ed9..0000000
+++ /dev/null
@@ -1,570 +0,0 @@
-//////////////////////////////////////////////////////////////////////
-//
-// $Id$
-//
-// Author: Emanuele Simili
-//
-//////////////////////////////////////////////////////////////////////
-//
-// Description: routines to study Flow from AliFlowEvent, adapted from STAR
-// Original Authors:                 Raimond Snellings & Art Poskanzer
-//
-//////////////////////////////////////////////////////////////////////
-
-#ifndef AliFlowAnalysisMaker_H
-#define AliFlowAnalysisMaker_H
-
-#include <stdlib.h>
-#include <iostream>
-
-#include "AliFlowTrack.h"
-#include "AliFlowV0.h"
-#include "AliFlowEvent.h"
-#include "AliFlowSelection.h"
-#include "AliFlowConstants.h"
-
-#include "TTree.h"
-#include "TFile.h"
-#include "TString.h"
-#include "TH1.h"
-#include "TH2.h"
-#include "TH3.h"
-#include "TProfile.h"
-#include "TProfile2D.h"
-#include "TOrdCollection.h"
-#include "TMath.h"
-#include "TText.h"
-#include "TVector2.h"
-#include "TString.h"
-#include "TList.h" 
-#include "TObjArray.h"
-#include "TObjString.h"
-
-class AliFlowTrack;
-class AliFlowV0;
-class AliFlowEvent;
-class AliFlowSelection;
-class Flow;
-class TH1F;
-class TH1D;
-class TH2F;
-class TH2D;
-class TH3F;
-class TProfile;
-class TProfile2D;
-
-class AliFlowAnalysisMaker {
-
-  /*!
-    \class AliFlowAnalysisMaker
-    Makes histograms for the flow analysis. It reads event and particle quantities
-    from AliFlowEvent. It removes autocorrelations of each particle with respect
-    to the event plane. For each harmonic and each selection makes a 2D histogram
-    of the anisotropic flow, v, vs. y and p_t.
-  */
-  
-public:
-  
-  AliFlowAnalysisMaker(const Char_t* name="FlowAnalysis");                        // Default constructor
-  AliFlowAnalysisMaker(const Char_t* name, const AliFlowSelection& pFlowSelect);   // Constructor with selection object
-  AliFlowAnalysisMaker(const AliFlowAnalysisMaker &from) {};
-  virtual  ~AliFlowAnalysisMaker();
-
- // Steps of the flow analysis
-  void     InitDefault() ;                                     // Default sets
-  Int_t    Init() ;                                            // Books histograms for flow analysis
-  Int_t    Make() ;                                            // Open FlowEvents, Gets quantities, Fills histograms
-  Int_t    Finish() ;                                          // Saves histograms, Closes stuff
-
- // Analysis of 1 event (can be called from outside)
-  Bool_t   Analyze(AliFlowEvent* pFlowEvent = 0) ;             // Fills the defaults histograms (init them first!) and performs the calculation for the given event         
-
- // Analysis options
-  void    SetEtaSub() ;                                        // Set eta subevents
-  void     SetV1Ep1Ep2(Bool_t v1Ep1Ep2 = kTRUE);               // Switches the v_1{EP1,EP2} calculation on/off
-  void    SetShuffle(Bool_t sh = kTRUE) ;                      // Set to re-shuffle evt tracks
-  void     SetUsePhiWgt(Bool_t pw = kTRUE) ;                   // Set to use phi weights (true by default...if there)
-  void            SetUseBayWgt(Bool_t bw = kTRUE) ;                    // Set to use bayesian weights for p.id. (false by default)
-
-  void     SetUsePtWgt(Bool_t ptw = kTRUE);                    // uses pT as a weight for RP determination
-  void     SetUseEtaWgt(Bool_t etw = kTRUE);                   // uses eta as a weight for RP determination
-  void     SetUseOnePhiWgt();                                  // just one wgt histogram
-  void     SetUseFirstLastPhiWgt();                            // uses 3 wgt histograms
-
- // Other options
-  void    SetMakeAll(Bool_t mka=kTRUE) ;                       // Set to calculate all events variables in one shoot
-  void    SetFlowForV0(Bool_t fV0 = kTRUE) ;                   // Enables Flow study for v0
-  void    SetRedoWgt(Bool_t rd = kTRUE) ;                      // Set recalculation of weights
-
- // Histograms
-  void     SetHistoRanges(float etaMin = -1.,float etaMax = 1.,int EtaBins = 40) ; // Sets the histograms' limits
-  void     SetPtRange_for_vEta(Float_t lo, Float_t hi);                // Sets the pt range for the v(eta) histograms.
-  void     SetEtaRange_for_vPt(Float_t lo, Float_t hi);                // Sets the |eta| range for the v(pt) histograms.
-
- // Input/Output 
-  void    SetHistFileName(TString name) ;                      // Sets output file name
-  void    SetPhiWgtFileName(TString name) ;                    // Sets Wgt file name
-  void    SetInputFileName(TString name) ;                     // Sets Input File name (the FlowEvents file) 
-  void    SetInputFileNames(TString name) ;                    // Sets Input Files (more than 1)
-  void    SetOneInputFile(Bool_t in=kTRUE) ;                   // Sets just one Input file 
-  TString  GetHistFileName() const ;                           // Output File Name
-  TString  GetPhiWgtFileName() const ;                         // Wgt File Name
-  TString  GetInputFileName() const ;                          // Input (Flow Events) file Name
-
- // MC simulation & debug
-  void     SetDebugg(Int_t db = 1) ;                           // set the cout's for debug (default is 1)
-  void     SetFillLabels(Bool_t lb=kTRUE) ;                    // fills labels histogram (execution is heavier)
-  void            SetMaxLabel(Int_t bin) ;                             // set the last bin in the MC-label histogram
-
- // Some Results
-  Float_t  Res(Int_t eventN, Int_t harN) const ;               // Returns the calculated resolution for the RP
-  Float_t  ResErr(Int_t eventN, Int_t harN) const ;            // Returns the estimated error on the resolution 
-  void     GetRunBayesian(Double_t bayes[Flow::nPid],int sel=0) ;  // Normalized Particle abundance (all events up to here)
-  void     PrintRunBayesian(int sel=0) ;                       // Prints the normalized Particle abundance (up to here)
-
-
-private:
-
- // Weightening
-  void     WgtChk() ;                                          // Check for Read/Write weights, sets labels accordingly
-  void     FillEvtPhiWgt() ;                                   // Plugs the PhiWeights into the AliFlowEvent
-  void     FillWgtArrays(TFile* wgtFile) ;                     // Loads phi & bayesian weights from file (flowPhiWgt.hist.root) and fills the specific arrays
-  void     FillBayesianWgt(int sel=0) ;                        // Plugs the Bayesian Weights into the AliFlowEvent (selection 0)
-  void     Weightening() ;                                     // Calculates weights and fills PhiWgt histograms
-
- // Open a new Imput File / Load a new Event
-  AliFlowEvent* GetEvt(Int_t evt = -1) ;                       // Gets flow event & V0s
-  Bool_t   Open(const Char_t* filename="") ;                   // Open FlowEvents file
-  Bool_t   FillFromFlowEvent() ;                               // Fills internal variables and array from Flow Events
-
- // Internal methods to fill the histogram
-  void     FillEventHistograms() ;                             // Fills Events' histograms (from AliFlowEvent)
-  void     FillParticleHistograms() ;                          // Fills Tracks' histograms (from AliFlowTrack)
-  void     FillV0Histograms() ;                                 // Fills V0s' histograms
-  int      HarmonicsLoop(float eta,float phi,float pt,int numPid=-1) ;         // Harmonics & Selections relates histograms (from AliFlowTracks)
-  void     FillLabels() ;                                      // fills an histogram of Labels (the ones from ESD) 
-
- // Resolution Calculation
-  void     Resolution() ;                                      // Calculates resolution and mean flow values
-  Double_t chi(double res) ;                                   // Calculates chi from the event plane resolution
-  Double_t resEventPlane(double chi) ;                         // Calculates the event plane resolution as a function of chi
-  Double_t resEventPlaneK2(double chi) ;                       // Calculates the event plane resolution as a function of chi for the case k=2.
-  Double_t resEventPlaneK3(double chi) ;                       // Calculates the event plane resolution as a function of chi for the case k=3.
-  Double_t resEventPlaneK4(double chi) ;                       // Calculates the event plane resolution as a function of chi for the case k=4.
-
- // Flags
-  Bool_t   mV0 ;                                               //! correlation analysis is done also for neutral secundary vertex
-  Bool_t   mShuffle ;                                          //! to randomly reshuffle tracks
-  Bool_t   mV1Ep1Ep2;                                          //! Flag for v_1{EP1,EP2} calculation on/off
-  Bool_t   mEtaSub;                                             //! eta subevents
-  Bool_t   mReadPhiWgt ;                                       //! Flag for reading Wgt histograms from file (automatic if flowPhi.hist.root is there)
-  Bool_t   mWritePhiWgt ;                                      //! Flag for writing Wgt histograms to file (automatic if flowPhi.hist.root is NOT there)
-  Bool_t   mRedoWgt ;                                          //! Flag for recalculating Wgt histograms (even if flowPhi.hist.root exist)
-  Bool_t   mPhiWgt ;                                           //! Phi Weights are applied to Phi distrib. (default is true)
-  Bool_t   mBayWgt ;                                           //! Bayesian Weights are applied to P.Id. (default is false) 
-  Bool_t   mRePid ;                                            //! Re-Calculates the P.Id. basing on the bayesian wgts (if plugged in)
-  Bool_t   mOnlyConstrainable ;                                        //! to loop just over constrainable tracks
-  Bool_t   mMakeAll ;                                          //! claculates all events vars in one shoot (should run faster)
-  Bool_t   mLabellingFirst ;                                   //! creates label file (internal)
-  Bool_t   mLabelling ;                                                //! takes note of Labels from ESD
-
-  Bool_t   mPtWgt ;                                            //! flag to use pT as a weight for RP determination
-  Bool_t   mEtaWgt ;                                           //! flag to use eta as a weight for RP determination
-  Bool_t   mOnePhiWgt ;                                        //! if kTRUE: just one phi-wgt histogram, if kFALSE: three phi-wgt histogram (TPC+,TPC-,cross)
-
- // ...for debugging
-  Int_t    mDebug ;                                            //! Debug level (0,1,2,3)
-  Bool_t   Debug0 ;                                            //! Flag for Debug couts
-  Bool_t   Debug1 ;                                            //! Flag for Debug couts lev.1
-  Bool_t   Debug2 ;                                            //! Flag for Debug couts lev.2
-  Bool_t   Debug3 ;                                            //! Flag for Debug couts lev.3
-  Bool_t   Debug4 ;                                            //! Flag for Debug couts lev.3
-
- // File names
-  TString          mHistFileName ;                             //! Output File Name (histograms from flow analysis)
-  TString          mPhiWgtFileName ;                           //! Wgt File Name (histograms for weight)
-  TString          mFlowEvtFileName ;                          //! Input file name (Flow Events)
-  Bool_t           fOneInputFile ;                             //! one/more imput file
-  TObjArray         fFileNames ;
-
- // Couts
-  TString          mName ;                                     //! Name from the constructor
-  TString          FlowAnalysis ;                              //! Default mark for cout's
-  TString          spaces ;                                    //! Default spaces for cout's
-
- // variables
-  Int_t             nEvents ;                                  //! number of FlowEvents in file
-  Int_t             nTracks ;                                  //! number of FlowTracks in FlowEvent
-  Int_t             nV0s ;                                     //! number of FlowV0s in FlowEvent
-  Int_t             evtN ;                                     //! current Event number (after selected ++)
-  TString           evt_name ;                                         //! current Event name (number) 
-  Float_t           vertex[3] ;                                        //! Event's Vertex position 
-
- // For weights
-  Flow::PhiWgt_t nPhiWgt ;                                     //! PhiWgt Array (all TPC)
-  Flow::PhiWgt_t nPhiWgtPlus ;                                 //! PhiWgt Array (TPC+)
-  Flow::PhiWgt_t nPhiWgtMinus ;                                //! PhiWgt Array (TPC-)
-  Flow::PhiWgt_t nPhiWgtCross ;                                //! PhiWgt Array (TPC/)     
- // For bayesian weights
-  Double_t nBayWgt[Flow::nSels][Flow::nPid] ;                  //! Bayesian weights (expected particle abundance)
-
-#ifndef __CINT__
-  TVector2 mQ[Flow::nSels][Flow::nHars];                       //! flow vector
-  Float_t  mPsi[Flow::nSels][Flow::nHars];                     //! event plane angle
-  UInt_t   mMult[Flow::nSels][Flow::nHars];                    //! multiplicity
-  Float_t  m_q[Flow::nSels][Flow::nHars];                      //! Q/::sqrt(Mult)
-  TVector2 mQSub[Flow::nSubs][Flow::nSels][Flow::nHars];       //! flow vector subs
-  Float_t  mPsiSub[Flow::nSubs][Flow::nSels][Flow::nHars];     //! plane angle of subevents
-  UInt_t   mMultSub[Flow::nSubs][Flow::nSels][Flow::nHars];    //! multiplicity subs
-  Float_t  mRes[Flow::nSels][Flow::nHars];                     //! event plane resolution
-  Float_t  mResErr[Flow::nSels][Flow::nHars];                  //! event plane resolution error
-#endif /*__CINT__*/
-
- // Internal pointers
-  AliFlowEvent*     pFlowEvent ;                               //! pointer to AliFlowEvent
-  AliFlowTrack*     pFlowTrack ;                               //! pointer to AliFlowTrack
-  AliFlowV0*        pFlowV0 ;                                  //! pointer to AliFlowV0
-  AliFlowSelection* pFlowSelect ;                              //! selection object
-  TFile*            pFlowEventsFile ;                          //! pointer to FlowEvents file (input)
-  TList*            pFlowEventsList ;                          //! FlowEvents in the file (input)
-  TObjArray*        pFlowTracks ;                              //! pointer to the TrackCollection
-  TObjArray*        pFlowV0s ;                                 //! pointer to the V0Collection
-  TFile*            histFile ;                                         //! histograms file (output)
-  //TTree*            pFlowTree;                               //! flow events TTree (NEW input - not there)
-
- // for Histograms
-  TString           xLabel ;                                   //! label axis with rapidity or pseudorapidity
-  Float_t          mEtaMin ;                                   //! histo range (eta)
-  Float_t          mEtaMax ;                                   //! histo range (eta)
-  Int_t            mNEtaBins ;                                 //! histo bins  (eta)
-  Float_t          mPtRange_for_vEta[2] ;                      //! pt range for the v(eta) histograms.
-  Float_t          mEtaRange_for_vPt[2] ;                      //! |eta| range for the v(pt) histograms.
-  Int_t            maxLabel ;                                  //! for the MC labels histogram (max bin)
-
-  TOrdCollection*   mPhiWgtHistList ;                          //! Weights:  histogram list
-  TOrdCollection*   mVnResHistList ;                           //! Resolution and Vn:  histogram list
-// for Single histograms
-
- // *****************
- // EVENTs HISTOGRAMS
- // *****************
-  TH1F*     mHistTrigger;                                 //!
-  TH1F*     mHistMult;                                    //!
-  TH1F*     mHistV0Mult;                                  //!
-  TH1F*     mHistOrigMult;                                //!
-  TH1F*     mHistMultOverOrig;                            //!
-  TH1F*     mHistMultEta;                                 //!
-  TH1F*     mHistCent;                                    //!
-  TH1F*     mHistVertexZ;                                 //!
-  TH2F*     mHistVertexXY2D;                              //!
-  TH2F*     mHistEnergyZDC;                               //!
-  TH1F*     mHistPartZDC;                                         //!
-  TProfile* mHistPidMult;                                 //!
-  TH1F*     mHistBayPidMult;                              //!
-  TH1F*     mHistEtaSym;                                  //!          // ...part also
-  TH1F*     mHistEtaSymPart;                              //!
-  TH2F*     mHistEtaSymVerZ2D;                            //!          // ...part also
-  TH2F*     mHistEtaSymVerZ2DPart;                        //!
- // selected (TR & V0)
-  TH1F*     mHistMultPart;                                //!
-  TH1F*     mHistV0MultPart;                              //!
-  TH1F*     mHistBayPidMultPart;                          //!
-  TH1F*     mHistMultPartUnit;                                    //!
-  
- // *****************
- // TRACKs HISTOGRAMS (all tracks)
- // *****************
-  TH1F*     mHistPtot ;                                   //!
-  TH1F*     mHistPt ;                                     //!
-  TH1F*     mHistCharge;                                  //!
-  TH1F*     mHistDcaGlobal;                               //!
-  TH1F*     mHistDca;                                     //!
-  TH1F*     mHistTransDca;                                        //!
-  TH1F*     mHistChi2;                                    //!
-  TH1F*     mHistLenght;                                  //!
-  TH1F*     mHistInvMass ;                                //!
-  TH1F*     mHistFitOverMax;                                      //!
-  TH2D*     mHistPhiPtCon ;                               //!
-  TH2D*     mHistPhiPtUnc ;                               //!
-  TH2D*     mHistPtPhiPos ;                               //!
-  TH2D*     mHistPtPhiNeg ;                               //!
-  TH3F*     mHistAllEtaPtPhi3D;                           //!
-  TProfile* mHistCosPhi;                                  //!
-  TH2F*     mHistPidPt;                                   //!
-  TH1F*     mHistPhi ;                                            //!
-  TH1F*     mHistPhiCons ;                                //!
-  TH2D*     mHistYieldAll2D;                              //!
-  TH2D*     mHistYieldCon2D;                              //!
-  TH2D*     mHistYieldUnc2D;                              //!
-  TH3F*     mHistConsEtaPtPhi3D;                          //!
-  TH3F*     mHistGlobEtaPtPhi3D;                          //! 
-  TH3F*     mHistUncEtaPtPhi3D ;                          //!
-  // fit & dE/dX for each detector (all tracks) 
-  TH1F*     mHistChi2ITS;                                 //!
-  TH1F*     mHistChi2normITS;                             //!
-  TH1F*     mHistFitPtsITS;                               //!
-  TH1F*     mHistMaxPtsITS;                               //!
-  TH2F*     mHistMeanDedxPos2DITS;                        //!
-  TH2F*     mHistMeanDedxNeg2DITS;                        //!
-  // -
-  TH1F*     mHistChi2TPC;                                 //!
-  TH1F*     mHistChi2normTPC;                             //!
-  TH1F*     mHistFitPtsTPC;                               //!
-  TH1F*     mHistMaxPtsTPC;                               //!
-  TH1F*     mHistFitOverMaxTPC;                           //!
-  TH2F*     mHistMeanDedxPos2D;                           //!
-  TH2F*     mHistMeanDedxNeg2D;                           //!
-  // -
-  TH1F*     mHistChi2TRD;                                 //!
-  TH1F*     mHistChi2normTRD;                             //!
-  TH1F*     mHistFitPtsTRD;                               //!
-  TH1F*     mHistMaxPtsTRD;                               //!
-  TH2F*     mHistMeanDedxPos2DTRD;                        //!
-  TH2F*     mHistMeanDedxNeg2DTRD;                        //!
-  // -
-  TH1F*     mHistChi2TOF;                                 //!
-  TH1F*     mHistChi2normTOF;                             //!
-  TH1F*     mHistFitPtsTOF;                               //!
-  TH1F*     mHistMaxPtsTOF;                               //!
-  TH2F*     mHistMeanDedxPos2DTOF;                        //!
-  TH2F*     mHistMeanDedxNeg2DTOF;                        //!
-  // detector response for particle type (all tracks, based on Pid)
-  TH2F*     mHistMeanTPCPiPlus ;                          //!
-  TH2F*     mHistMeanTPCPiMinus ;                         //!
-  TH2F*     mHistMeanTPCProton ;                          //!
-  TH2F*     mHistMeanTPCPbar ;                            //!
-  TH2F*     mHistMeanTPCKplus ;                           //!
-  TH2F*     mHistMeanTPCKminus ;                          //!
-  TH2F*     mHistMeanTPCDeuteron ;                        //!
-  TH2F*     mHistMeanTPCAntiDeuteron ;                    //!
-  TH2F*     mHistMeanTPCPositron ;                        //!
-  TH2F*     mHistMeanTPCElectron ;                        //!
-  TH2F*     mHistMeanTPCMuonPlus ;                        //!
-  TH2F*     mHistMeanTPCMuonMinus ;                       //!
-  // -
-  TH2F*     mHistMeanITSPiPlus ;                          //!
-  TH2F*     mHistMeanITSPiMinus ;                         //!
-  TH2F*     mHistMeanITSProton ;                          //!
-  TH2F*     mHistMeanITSPbar ;                            //!
-  TH2F*     mHistMeanITSKplus ;                           //!
-  TH2F*     mHistMeanITSKminus ;                          //!
-  TH2F*     mHistMeanITSDeuteron ;                        //!
-  TH2F*     mHistMeanITSAntiDeuteron ;                    //!
-  TH2F*     mHistMeanITSPositron ;                        //!
-  TH2F*     mHistMeanITSElectron ;                        //!
-  TH2F*     mHistMeanITSMuonPlus ;                        //!
-  TH2F*     mHistMeanITSMuonMinus ;                       //!
-  // -
-  TH2F*     mHistMeanTOFPiPlus ;                          //!
-  TH2F*     mHistMeanTOFPiMinus ;                         //!
-  TH2F*     mHistMeanTOFProton ;                          //!
-  TH2F*     mHistMeanTOFPbar ;                            //!
-  TH2F*     mHistMeanTOFKplus ;                           //!
-  TH2F*     mHistMeanTOFKminus ;                          //!
-  TH2F*     mHistMeanTOFDeuteron ;                        //!
-  TH2F*     mHistMeanTOFAntiDeuteron ;                    //!
-  TH2F*     mHistMeanTOFPositron ;                        //!
-  TH2F*     mHistMeanTOFElectron ;                        //!
-  TH2F*     mHistMeanTOFMuonPlus ;                        //!
-  TH2F*     mHistMeanTOFMuonMinus ;                       //!
-  // -
-  TH2F*     mHistMeanTRDPiPlus ;                          //!
-  TH2F*     mHistMeanTRDPiMinus ;                         //!
-  TH2F*     mHistMeanTRDProton ;                          //!
-  TH2F*     mHistMeanTRDPbar ;                            //!
-  TH2F*     mHistMeanTRDKplus ;                           //!
-  TH2F*     mHistMeanTRDKminus ;                          //!
-  TH2F*     mHistMeanTRDDeuteron ;                        //!
-  TH2F*     mHistMeanTRDAntiDeuteron ;                    //!
-  TH2F*     mHistMeanTRDPositron ;                        //!
-  TH2F*     mHistMeanTRDElectron ;                        //!
-  TH2F*     mHistMeanTRDMuonPlus ;                        //!
-  TH2F*     mHistMeanTRDMuonMinus ;                       //!
-  // pid probability for all particle (all tracks)
-  TH1F*     mHistPidPiPlus;                               //!
-  TH1F*     mHistPidPiMinus;                              //!
-  TH1F*     mHistPidProton;                               //!
-  TH1F*     mHistPidAntiProton;                           //!
-  TH1F*     mHistPidKplus;                                //!
-  TH1F*     mHistPidKminus;                               //!
-  TH1F*     mHistPidDeuteron;                             //!
-  TH1F*     mHistPidAntiDeuteron;                         //!
-  TH1F*     mHistPidElectron;                             //!
-  TH1F*     mHistPidPositron;                             //!
-  TH1F*     mHistPidMuonMinus;                            //!
-  TH1F*     mHistPidMuonPlus;                             //!
-  // pid probability for particle type (all tracks, based on Pid)
-  TH1F*     mHistPidPiPlusPart;                           //!
-  TH1F*     mHistPidPiMinusPart;                          //!
-  TH1F*     mHistPidProtonPart;                           //!
-  TH1F*     mHistPidAntiProtonPart;                       //!
-  TH1F*     mHistPidKplusPart;                            //!
-  TH1F*     mHistPidKminusPart;                           //!
-  TH1F*     mHistPidDeuteronPart;                         //!
-  TH1F*     mHistPidAntiDeuteronPart;                     //!
-  TH1F*     mHistPidElectronPart;                         //!
-  TH1F*     mHistPidPositronPart;                         //!
-  TH1F*     mHistPidMuonMinusPart;                        //!
-  TH1F*     mHistPidMuonPlusPart;                         //!
-  // MC labels from the simulation (all tracks)
-  TH2F*     mLabHist;                                     //! 
- // *****************
- // selected TRACKS
- // *****************
-  TProfile* mHistBinEta;                                  //!
-  TProfile* mHistBinPt;                                   //!
-  //
-  TH3F*     mHistEtaPtPhi3DPart ;                         //!
-  TH2D*     mHistYieldPart2D;                             //!
-  TH1F*     mHistDcaGlobalPart ;                          //!
-  TH1F*     mHistInvMassPart ;                            //!
-  TH3F*     mHistEtaPtPhi3DOut ;                          //!
-  TH2D*     mHistYieldOut2D;                              //!
-  TH1F*     mHistDcaGlobalOut ;                                   //!
-  TH1F*     mHistInvMassOut ;                             //!
-  TH3F*     mHistMeanDedxPos3DPart ;                      //!
-  TH3F*     mHistMeanDedxNeg3DPart ;                      //!
-  TH3F*     mHistMeanDedxPos3DPartITS ;                           //!
-  TH3F*     mHistMeanDedxNeg3DPartITS ;                           //!
-//
-
- // *****************
- // V0s HISTOGRAMS (all v0s)
- // *****************
-  TH1F*     mHistV0Mass;                                  //!
-  TH3F*     mHistV0EtaPtPhi3D;                            //!
-  TH2D*     mHistV0YieldAll2D;                            //!
-  TH1F*     mHistV0Dca;                                           //!
-  TH1F*     mHistV0Chi2;                                  //!
-  TH1F*     mHistV0Lenght;                                //!
-  TH1F*     mHistV0Sigma;                                 //!
-  TProfile* mHistV0CosPhi;                                //! 
-  TH2D*     mHistV0MassPtSlices;                          //!
- // *****************
- // selected V0s
- // *****************
-  TProfile* mHistV0BinEta;                                //! 
-  TProfile* mHistV0BinPt;                                 //! 
-  TProfile* mHistV0sbBinEta;                              //! 
-  TProfile* mHistV0sbBinPt;                               //!
-  //
-  TH1F*     mHistV0MassWin ;                              //!
-  TH3F*     mHistV0EtaPtPhi3DPart ;                       //!
-  TH2D*     mHistV0YieldPart2D;                           //!
-  TH1F*     mHistV0DcaPart ;                              //!
-  TH1F*     mHistV0LenghtPart ;                                   //!
-  TH1F*     mHistV0sbMassSide ;                           //!
-  TH3F*     mHistV0sbEtaPtPhi3DPart ;                     //!
-  TH2D*     mHistV0sbYieldPart2D;                         //!
-  TH1F*     mHistV0sbDcaPart ;                            //!
-  TH1F*     mHistV0sbLenghtPart ;                         //!
-
-// for each harmonic, each selection, and each sub-event
-
- // *****************
- // SUB-EVENTs HISTOGRAMS
- // *****************
-  struct histSubHars {
-   TH1F*     mHistPsiSubs;
-  };
-  struct histSubs;     
-  friend struct histSubs;
-  struct histSubs {
-   struct histSubHars histSubHar[Flow::nHars];
-  };
-  struct histSubs histSub[Flow::nSels*Flow::nSubs];        //!
-
-// for each harmonic and each selection
-
-  struct histFullHars 
-  {
-   // weights
-    TH1D*       mHistPhiPlus;
-    TH1D*       mHistPhiMinus;
-    TH1D*       mHistPhiAll;
-    TH1D*       mHistPhiWgtPlus;
-    TH1D*       mHistPhiWgtMinus;
-    TH1D*       mHistPhiWgtAll;
-    TH1D*       mHistPhiFlatPlus;
-    TH1D*       mHistPhiFlatMinus;
-    TH1D*       mHistPhiFlatAll;
-    TH1D*       mHistPhi;
-    TH1D*       mHistPhiWgt;
-    TH1D*       mHistPhiFlat;
-   // flow (events)
-    TH1F*       mHistPsi;
-    TH1F*       mHistPsiSubCorr;
-    TH1F*       mHistPsiSubCorrDiff;
-    TH1F*       mHistPsi_Diff;
-    TH1F*       mHistMult;
-    TH1F*       mHist_q;
-   // flow (tracks)
-    TH1F*       mHistPhiCorr;
-    TProfile2D* mHist_vObs2D;
-    TProfile*   mHist_vObsEta;
-    TProfile*   mHist_vObsPt;
-    TH2D*       mHist_v2D;
-    TH1D*       mHist_vEta;
-    TH1D*       mHist_vPt;
-   // flow (v0s)
-    TH1F*       mHistV0PhiCorr;   
-    TProfile2D* mHistV0_vObs2D;   
-    TProfile*   mHistV0_vObsEta;  
-    TProfile*   mHistV0_vObsPt;   
-    TH2D*      mHistV0_v2D;      
-    TH1D*      mHistV0_vEta;     
-    TH1D*      mHistV0_vPt;      
-   // flow (v0s sidebands)
-    TProfile*   mHistV0sb_vObsEta_sx ;  
-    TProfile*   mHistV0sb_vObsPt_sx ;   
-    TProfile*   mHistV0sb_vObsEta_dx ;  
-    TProfile*   mHistV0sb_vObsPt_dx ;   
-    TH1F*       mHistV0sbPhiCorr ;   
-    TProfile2D* mHistV0sb_vObs2D ;   
-    TProfile*   mHistV0sb_vObsEta ;  
-    TProfile*   mHistV0sb_vObsPt ;   
-    TH2D*      mHistV0sb_v2D ;      
-    TH1D*      mHistV0sb_vEta ;     
-    TH1D*      mHistV0sb_vPt ;      
-   // check (tracks used for R.P.)
-    TH1F*       mHistYieldPt ;
-    TH3F*       mHistEtaPtPhi3D ;
-    TH2D*       mHistYield2D ;
-    TH1F*       mHistDcaGlob ;
-   // check (tracks excluded)
-    TH1F*      mHistYieldPtout;
-    TH3F*      mHistEtaPtPhi3Dout ;
-    TH2D*      mHistYield2Dout ;
-    TH1F*      mHistDcaGlobout ;
-  };
-
-// for each selection
-
-  struct histFulls;    
-  friend struct histFulls;
-  struct histFulls 
-  {
-   TH1F*     mHistBayPidMult;
-  // flow (events)
-   TProfile* mHistCos;
-   TH1F*     mHistRes;
-   TProfile* mHist_vObs;
-   TH1D*     mHist_v;
-   TProfile* mHistV0_vObs;
-   TProfile* mHistV0sb_vObs_sx;
-   TProfile* mHistV0sb_vObs_dx;
-   TH1D*     mHistV0_v;
-  // wgt, evts, trks, v0s (as defined above)
-   struct histFullHars histFullHar[Flow::nHars];
-  };
-  struct histFulls histFull[Flow::nSels];                     //!
-
-  ClassDef(AliFlowAnalysisMaker,2)              // macro for rootcint
-};
-
-#endif
-
-
-
-// lame = not productive; poorly designed; uncool ...
index 726ded9ff80fdf9baaa76abbe1169accc9fa64fc..f213cf2469b2f0959bfaeac82e0e53108cdb1e98 100644 (file)
@@ -16,8 +16,8 @@
 
 ClassImp(Flow)
   
-  Float_t  Flow::fEtaMin    = -2.5 ;
-  Float_t  Flow::fEtaMax    =  2.5 ;
+  Float_t  Flow::fEtaMin    = -2. ;
+  Float_t  Flow::fEtaMax    =  2. ;
   Float_t  Flow::fPtMin     =  0. ;
   Float_t  Flow::fPtMax     = 10. ;
   Float_t  Flow::fPtMaxPart =  5. ;
index 35bb89a5b2f021f6517bc8ff4db60507526c3d4e..d72af6a40ca1a3329761af6c917902aab4506680 100644 (file)
@@ -125,14 +125,6 @@ Double_t AliFlowEvent::PhiWeightRaw(Int_t selN, Int_t harN, AliFlowTrack* pFlowT
   else                                 { phiWgt = (Double_t)fPhiWgtCross[selN][harN][n] ; }
  } 
 
- // ... weight can be implemented as well for ITS , TRD , PHOS , etc.
- // 
- // if(...) 
- // {
- //  n = (int)((phi/2*TMath::Pi())*Flow::nPhiBins...) ;
- //  ...
- // }
-
  return phiWgt ;
 }
 //-------------------------------------------------------------
@@ -162,7 +154,7 @@ Double_t AliFlowEvent::PhiWeight(Int_t selN, Int_t harN, AliFlowTrack* pFlowTrac
  // (it simply rerurns PhiWeightRaw() * Weight()). If fNoWgt = kTRUE, returns +/-1 ,
  // basing on Sign(eta), for odd harmonics .
  
- if(NoWgt()) // no weights (but +/- according to eta)
+ if(fNoWgt) // no weights (but +/- according to eta)
  { 
   bool oddHar = (harN+1) % 2 ;
   if(oddHar) { return TMath::Sign((Double_t)1.,(Double_t)pFlowTrack->Eta()) ; }
diff --git a/PWG2/FLOW/AliFlowMaker.cxx b/PWG2/FLOW/AliFlowMaker.cxx
new file mode 100644 (file)
index 0000000..e3dae60
--- /dev/null
@@ -0,0 +1,507 @@
+//////////////////////////////////////////////////////////////////////
+//
+// $Id$
+//
+// Author: Emanuele Simili
+//
+//////////////////////////////////////////////////////////////////////
+//_____________________________________________________________
+//
+// Description: 
+//        AliFlowMaker provides the method to create AliFlowEvent(s) 
+// from AliESD(s). Very basic track cuts are applyed.
+// The present class can be used in a simple AliRoot macro or in a 
+// more complex enviroment such as AliSelector or AliTask.
+//
+//////////////////////////////////////////////////////////////////////
+
+#ifndef ALIFLOWMAKER_CXX
+#define ALIFLOWMAKER_CXX
+
+// ROOT things
+#include <TROOT.h>
+#include <TFile.h>
+#include <TTree.h>
+#include <TChain.h>
+#include <TString.h>
+#include <TObject.h>
+#include <TObjArray.h>
+#include <TParticle.h>
+#include <TParticlePDG.h>
+#include <TDatabasePDG.h>
+
+// AliRoot things
+#include "AliESD.h"
+#include "AliESDVertex.h"
+#include "AliESDtrack.h"
+#include "AliESDv0.h"
+#include "AliKalmanTrack.h"
+//#include "AliRun.h"
+//#include "AliRunLoader.h"
+//#include "AliMagFMaps.h"
+//#include "AliITStrackV2.h"
+
+// Flow things
+#include "AliFlowEvent.h"
+#include "AliFlowTrack.h"
+#include "AliFlowV0.h"
+#include "AliFlowConstants.h"
+#include "AliFlowMaker.h"
+
+// ANSI things
+#include <stdio.h>
+#include <stdlib.h>
+#include <iostream>
+using namespace std; //required for resolving the 'cout' symbol
+
+ClassImp(AliFlowMaker) ;
+//-----------------------------------------------------------------------
+AliFlowMaker::AliFlowMaker()
+{
+ // default constructor 
+ // resets counters , sets defaults
+ fNewAli = kFALSE ;
+ // flags
+ fLoopTrks = kTRUE ;
+ fLoopV0s = kTRUE ;    
+ fCounter = 0 ; 
+ // loop variable
+ fRunID = 0 ;       
+ fEventNumber = 0 ; 
+ fTrackNumber = 0 ; 
+ fV0Number = 0 ;    
+ fEventNumber = 0 ;
+ fNumberOfTracks = 0 ;
+ fNumberOfV0s = 0 ; 
+ fMagField = 0. ;
+ // counters
+ fGoodTracks = 0  ;  
+ fGoodV0s    = 0  ;    
+ fGoodTracksEta = 0  ;
+ fPosiTracks = 0  ;  
+ fNegaTracks = 0  ;  
+ fUnconstrained = 0  ;
+ fCutEvts    = 0  ;    
+ fCutTrks    = 0  ;    
+ fCutV0s     = 0  ;
+ for(Int_t bb=0;bb<5;bb++) { fBayesianAll[bb] = 0 ; } ;
+ fSumAll = 0  ; 
+
+ // trak cuts
+ fNHits = 0 ;                  
+ fElow = 0.001 ; fEup = 1000. ;   
+ fLabel[0] = 0 ; fLabel[1] = -1 ;
+}
+//-----------------------------------------------------------------------
+AliFlowMaker::~AliFlowMaker()
+{
+ // default destructor (no actions) 
+}
+//-----------------------------------------------------------------------
+
+//-----------------------------------------------------------------------
+AliFlowEvent* AliFlowMaker::FillFlowEvent(AliESD* fESD)
+{
+ // From the AliESD (input) fills the AliFlowEvent (output) . 
+ // It loops on track & v0 and calls the methods to fill the arrays . 
+ // ... . 
+
+ fFlowEvent = new AliFlowEvent() ; if(!fFlowEvent) { return 0 ; }
+ //cout << " -evt- " << fFlowEvent << endl ;
+
+ fRunID = fESD->GetRunNumber() ;
+ fEventNumber = fESD->GetEventNumber() ;
+ fNumberOfTracks = fESD->GetNumberOfTracks() ;
+ fNumberOfV0s = fESD->GetNumberOfV0s() ;
+ //
+ cout << " *evt n. " << fEventNumber << " (run " << fRunID << ")  -  tracks: " << fNumberOfTracks << " ,   v0s " << fNumberOfV0s << endl ;
+
+ // Event id 
+ fFlowEvent->SetRunID(fRunID) ;               
+ fFlowEvent->SetEventID(fEventNumber) ;         
+ fFlowEvent->SetOrigMult((UInt_t)fNumberOfTracks) ;
+
+ // Run information (fixed - ???)
+ fMagField = fESD->GetMagneticField() ; // cout << " *fMagField " << fMagField << endl ;
+ fFlowEvent->SetMagneticField(fMagField) ;     
+ fFlowEvent->SetCenterOfMassEnergy(Flow::fCenterOfMassEnergy) ;        
+ fFlowEvent->SetBeamMassNumberEast(Flow::fBeamMassNumberEast) ;        
+ fFlowEvent->SetBeamMassNumberWest(Flow::fBeamMassNumberWest) ;        
+
+ // Trigger information (now is: ULon64_t - some trigger mask)
+ fFlowEvent->SetL0TriggerWord((Int_t)fESD->GetTriggerMask()); 
+ // Get primary vertex position
+ fVertex = (AliESDVertex*)fESD->GetVertex() ;
+ Double_t position[3] ; 
+ fVertex->GetXYZ(position) ;
+ fFlowEvent->SetVertexPos((Float_t)position[0],(Float_t)position[1],(Float_t)position[2]) ; 
+
+ // Zero Degree Calorimeter information
+ Int_t zdcp = fESD->GetZDCParticipants() ; 
+ Float_t zdce[3] ; 
+ zdce[0] = fESD->GetZDCN1Energy() + fESD->GetZDCN2Energy(); 
+ zdce[1] = fESD->GetZDCP1Energy() + fESD->GetZDCP2Energy() ; 
+ zdce[2] = fESD->GetZDCEMEnergy() ;
+ fFlowEvent->SetZDCpart(zdcp);                         
+ fFlowEvent->SetZDCenergy(zdce[0],zdce[1],zdce[2]);    
+
+ // Track loop
+ if(fLoopTrks)
+ {
+  Int_t badTrks = 0 ;
+  for(fTrackNumber=0;fTrackNumber<fNumberOfTracks;fTrackNumber++) 
+  {
+   fTrack = fESD->GetTrack(fTrackNumber) ;
+   if(CheckTrack(fTrack))
+   {
+    fFlowTrack = FillFlowTrack(fTrack) ;   
+    fFlowEvent->TrackCollection()->Add(fFlowTrack) ;   
+    fGoodTracks++ ;                                  
+   }
+   else { badTrks++ ; continue ; }
+  }
+  fCutTrks += badTrks ;
+ }
+
+ // V0 loop
+ if(fLoopV0s)
+ {
+  Int_t badV0s = 0 ;
+  for(fV0Number=0;fV0Number<fNumberOfV0s;fV0Number++) 
+  {
+   fV0 = fESD->GetV0(fV0Number) ;                      
+   if(CheckV0(fV0))
+   {
+    fFlowV0 =  FillFlowV0(fV0) ;
+    fFlowEvent->V0Collection()->Add(fFlowV0) ;
+    fGoodV0s++ ;                       
+   }
+   else { badV0s++ ; continue ; }
+  }
+  fCutV0s += badV0s ;
+ }
+
+ // Evt setting stuff
+ fFlowEvent->SetCentrality();  
+                               
+ fCounter++ ; 
+ return fFlowEvent ;
+}
+//----------------------------------------------------------------------
+AliFlowTrack* AliFlowMaker::FillFlowTrack(AliESDtrack* fTrack)
+{
+ // From the AliESDtrack (input) fills the AliFlowTrack (output) .
+
+ TString name = "" ; name += fTrackNumber ;
+ fFlowTrack = new AliFlowTrack(name.Data()) ;
+ //cout << " -tr- " << name.Data() << endl ;
+ // ESD particle label (link: KineTree-ESD)
+ Int_t label = TMath::Abs(fTrack->GetLabel());
+ fFlowTrack->SetLabel(label) ;                         
+
+ // signed DCA from ESDtrack
+ Float_t xy = 0 ; Float_t z = 0 ; 
+ fTrack->GetImpactParameters(xy,z) ; 
+ fFlowTrack->SetDcaSigned(xy,z) ;                  
+
+ // UnConstrained (global) first
+ Double_t gD[3] ;                              
+ fTrack->GetPxPyPz(gD) ;                       
+ // -
+ Float_t phiGl = (Float_t)Phi(gD) ;  
+ if(phiGl<0) { phiGl += 2*TMath::Pi() ; }
+ fFlowTrack->SetPhiGlobal(phiGl) ;             
+ Float_t ptGl = (Float_t)Pt(gD) ; 
+ fFlowTrack->SetPtGlobal(ptGl) ;               
+ Float_t etaGl = (Float_t)Eta(gD) ; 
+ fFlowTrack->SetEtaGlobal(etaGl) ;             
+
+ // Constrained (NEW)
+ Double_t cD[3] ;
+ Double_t par1 ; Double_t par2 ;  Double_t par3[3] ;
+ if(fTrack->GetConstrainedExternalParameters(par1,par2,par3))
+ {
+  fTrack->GetConstrainedPxPyPz(cD) ;     
+ }
+ else { for(Int_t iii=0;iii<3;iii++) { cD[iii] =0 ; } }
+
+ if(Norm(cD)!=0.)   // ConstrainedPxPyPz != 0 if ConstrainedChi2 < something ...
+ {                                                     
+  Float_t phi = (Float_t)Phi(cD) ; 
+  if(phi<0) { phi += 2*TMath::Pi() ; }
+  fFlowTrack->SetPhi(phi) ;                            
+  Float_t pt = (Float_t)Pt(cD) ; 
+  fFlowTrack->SetPt(pt) ;                              
+  Float_t eta = (Float_t)Eta(cD) ; 
+  fFlowTrack->SetEta(eta) ;                            
+  // number of constrainable tracks with |eta| < Flow::fEtaGood (0.9)
+  if(TMath::Abs(eta) < Flow::fEtaGood)  { fGoodTracksEta++ ; }
+ }
+ else  // in case Constriction impossible for track, fill the UnConstrained (global)
+ {
+  fUnconstrained++ ;   
+  fFlowTrack->SetPhi(0.) ;
+  fFlowTrack->SetPt(0.) ;   
+  fFlowTrack->SetEta(0.) ; 
+ }          
+
+ // positive - negative tracks
+ Int_t trk_sign = (Int_t)fTrack->GetSign() ; 
+ fFlowTrack->SetCharge(trk_sign) ;             
+ if(trk_sign>0)        { fPosiTracks++ ; }
+ else if(trk_sign<0)   { fNegaTracks++ ; }
+ else                  { return 0 ; }
+
+ // Tracking parameters (fit , TPC , ITS , dE/dx)
+ fFlowTrack->SetChi2(fTrack->GetConstrainedChi2()) ;           
+ fFlowTrack->SetTrackLength(fTrack->GetIntegratedLength()) ;   
+ // -
+ Int_t idXt[180] ; // used for Cluster Map ( see AliESDtrack::GetTPCclusters() )    // old:    Int
+ Int_t idX[6] ;    // used for Cluster Map ( see AliESDtrack::GetITSclusters() )    // old:    UInt
+ Int_t idxr[130] ; // used for Cluster Map ( see AliESDtrack::GetTRDclusters() )    // old:    UInt
+ Int_t nClus = 0 ;     
+ Int_t fNFound = 0 ;                                   // *!* fNFoundable (in AliTPCtrack) ... added by M.Ianov 
+ Double_t pVecAt[3] ; 
+ for(Int_t gg=0;gg<3;gg++) { pVecAt[gg] = gD[gg] ; }
+ Bool_t boh ; Float_t pAt = 0 ;                        // to get p at each detector
+ // -
+ if(fNewAli) { boh = fTrack->GetPxPyPzAt(Flow::fTPCx, fMagField, pVecAt) ; }
+ else       { boh = fTrack->GetInnerParam()->GetPxPyPzAt(Flow::fTPCx, fMagField, pVecAt) ; }
+ pAt = (Float_t)Norm(pVecAt) ; if(!pAt) { pAt = (Float_t)Norm(gD) ; }
+ nClus = fTrack->GetTPCclusters(idXt) ;
+ fNFound = fTrack->GetTPCNclsF() ;  // was 160
+ fFlowTrack->SetMaxPtsTPC(fNFound) ;                           
+ fFlowTrack->SetFitPtsTPC(nClus) ;                             
+ fFlowTrack->SetDedxTPC(fTrack->GetTPCsignal()) ;              
+ fFlowTrack->SetChi2TPC((Float_t)(fTrack->GetTPCchi2())) ;     
+ fFlowTrack->SetPatTPC(pAt) ;                                  
+ // -
+ if(fNewAli) { boh = fTrack->GetPxPyPzAt(Flow::fITSx, fMagField, pVecAt) ; }
+ else       { boh = fTrack->GetInnerParam()->GetPxPyPzAt(Flow::fITSx, fMagField, pVecAt) ; }
+ pAt = (Float_t)Norm(pVecAt) ; if(!pAt) { pAt = (Float_t)Norm(gD) ; }
+ nClus = fTrack->GetITSclusters(idX) ;
+ fNFound = 6 ;
+ fFlowTrack->SetMaxPtsITS(fNFound) ;                           
+ fFlowTrack->SetFitPtsITS(nClus) ;                             
+ fFlowTrack->SetDedxITS(fTrack->GetITSsignal()) ;              
+ fFlowTrack->SetChi2ITS((Float_t)(fTrack->GetITSchi2())) ;     
+ fFlowTrack->SetPatITS(pAt) ;                                  
+ // -
+ if(fNewAli) { boh = fTrack->GetPxPyPzAt(Flow::fTRDx, fMagField, pVecAt) ; } 
+ else       { boh = fTrack->GetInnerParam()->GetPxPyPzAt(Flow::fTRDx, fMagField, pVecAt) ; } 
+ pAt = (Float_t)Norm(pVecAt) ; if(!pAt) { pAt = (Float_t)Norm(gD) ; }
+ fNFound = fTrack->GetTRDncls() ;  // was 130
+ nClus = fTrack->GetTRDclusters(idxr) ;
+ fFlowTrack->SetMaxPtsTRD(fNFound) ;                           
+ fFlowTrack->SetNhitsTRD(nClus) ;                              
+ fFlowTrack->SetSigTRD(fTrack->GetTRDsignal()) ;               
+ fFlowTrack->SetChi2TRD((Float_t)fTrack->GetTRDchi2()) ;       
+ fFlowTrack->SetPatTRD(pAt) ;                                  
+ // -
+ if(fNewAli) { boh = fTrack->GetPxPyPzAt(Flow::fTOFx, fMagField, pVecAt) ; }
+ else       { boh = fTrack->GetInnerParam()->GetPxPyPzAt(Flow::fTOFx, fMagField, pVecAt) ; }
+ pAt = (Float_t)Norm(pVecAt) ; if(!pAt) { pAt = (Float_t)Norm(gD) ; }
+ fNFound = 0 ; if(fTrack->GetTOFCalChannel() > 0) { fNFound = 1 ; }
+ nClus = fTrack->GetTOFcluster() ;
+ fFlowTrack->SetMaxPtsTOF(fNFound) ;                           
+ fFlowTrack->SetNhitsTOF(nClus) ;                              
+ fFlowTrack->SetTofTOF(fTrack->GetTOFsignal()) ;               
+ fFlowTrack->SetChi2TOF(fTrack->GetTOFchi2()) ;                
+ fFlowTrack->SetPatTOF(pAt) ;                                  
+ // -
+ Double_t rIn[3]  ; rIn[0] = 0.  ;  rIn[1] = 0. ;  rIn[2] = 0. ;
+ Double_t rOut[3] ; rOut[0] = 0. ; rOut[1] = 0. ; rOut[2] = 0. ;
+ // -
+ fTrack->GetInnerXYZ(rIn) ;                                    
+ fFlowTrack->SetZFirstPoint(rIn[2]) ; 
+ //fTrack->GetXYZAt(Flow::fTPCx,fMagField,rOut) ;              
+ fTrack->GetOuterXYZ(rOut) ;                                   
+ fFlowTrack->SetZLastPoint(rOut[2]) ; 
+ // ESD-P.Id. = 5-vector of Best detectors probabilities for [e , mu , pi , K , p] 
+ Double_t trkPid[5] ; fTrack->GetESDpid(trkPid) ;              
+ Double_t trkPid6[Flow::nPid] ; 
+ for(Int_t bb=0;bb<5;bb++) { trkPid6[bb] = trkPid[bb] ; } 
+ trkPid6[5] = 0. ;                                             // *!* implement P.Id. for Deuterim
+
+ // Bayesian P.Id. method (weighted probabilities for [e , mu , pi , K , p , d])
+ Double_t Bsum = 0 ; 
+ Double_t bayePid[Flow::nPid] ;    // normalized P.id
+ Double_t storedPid[Flow::nPid] ;  // stored P.id
+ for(Int_t nB=0;nB<Flow::nPid;nB++)  { Bsum += trkPid6[nB]*Flow::fBayesian[nB] ; }
+ if(Bsum)
+ {
+  for(Int_t nB=0;nB<Flow::nPid;nB++) 
+  { 
+   bayePid[nB] = trkPid6[nB]*Flow::fBayesian[nB] / Bsum ; 
+   storedPid[nB] = trkPid6[nB] ; 
+  }
+ }
+ else { cout << " ERROR - Empty Bayesian Vector !!! " << endl ; }
+ fFlowTrack->SetElectronPositronProb(storedPid[0]);               
+ fFlowTrack->SetMuonPlusMinusProb(storedPid[1]);
+ fFlowTrack->SetPionPlusMinusProb(storedPid[2]);
+ fFlowTrack->SetKaonPlusMinusProb(storedPid[3]);
+ fFlowTrack->SetProtonPbarProb(storedPid[4]);
+ fFlowTrack->SetDeuteriumAntiDeuteriumProb(storedPid[5]);      // *!* implement P.Id. for Deuterim
+
+ // P.id. label given via the weighted prob.
+ const Int_t code[]   =  {11,13,211,321,2212,10010020} ;
+ Int_t kkk = 2 ;                       // if No id. -> then is a Pi
+ Float_t pid_max = bayePid[2] ;        // (if all equal, Pi probability get's the advantage to be the first)
+ for(Int_t iii=0; iii<5; iii++) 
+ {
+  if(bayePid[iii]>pid_max) { kkk = iii ; pid_max = bayePid[iii] ; }  // !!! Bayesian as well !!!
+ }
+ fBayesianAll[kkk]++ ; fSumAll++ ;     // goes on filling the vector of observed abundance 
+ //-
+ Int_t pdg_code = trk_sign*code[kkk] ;
+ fFlowTrack->SetMostLikelihoodPID(pdg_code);
+ return fFlowTrack ; 
+}
+//-----------------------------------------------------------------------
+AliFlowV0* AliFlowMaker::FillFlowV0(AliESDv0* fV0)
+{
+ // From the AliESDv0 (input) fills the AliFlowV0 (output) .
+
+ TString name = "" ; name += fV0Number ;
+ fFlowV0 = new AliFlowV0(name.Data()) ;
+ //cout << " -v0- " << name.Data() << endl ;
+
+ Double_t Pxyz[3] ;            // reconstructed momentum of the V0
+ fV0->GetPxPyPz(Pxyz[0],Pxyz[1],Pxyz[2]) ;
+
+ Float_t phi = (Float_t)Phi(Pxyz) ; if(phi<0) { phi += 2*TMath::Pi() ; }
+ fFlowV0->SetPhi(phi) ;                
+ Float_t pt = (Float_t)Pt(Pxyz) ; 
+ fFlowV0->SetPt(pt) ;          
+ Float_t eta = (Float_t)Eta(Pxyz) ; 
+ fFlowV0->SetEta(eta) ;        
+
+ Double_t xyz[3] ;             // reconstructed position of the V0 
+ fV0->GetXYZ(xyz[0],xyz[1],xyz[2]) ;           
+ fFlowV0->SetCrossPoint(xyz[0],xyz[1],xyz[2]) ;
+
+ // // V0's impact parameter & error (chi2 , DCA , sigma)  
+ // fFlowV0->SetDca((Float_t)fV0->GetDistNorm()) ;    // GetD()  
+ // fFlowV0->SetSigma((Float_t)fV0->GetDistSigma()) ;
+ // fFlowV0->SetChi2((Float_t)fV0->GetChi2V0()) ;     // AliRoot v4-04-Release (December 2006) 
+ // fFlowV0->SetChi2((Float_t)fV0->GetChi2()) ;              // AliRoot v4-04-Release (old)
+ // // ...when they'll stop changing the methods I may enable the above lines. For now:
+ fFlowV0->SetChi2(1.) ;
+ fFlowV0->SetDca(1.);      // GetD()
+ fFlowV0->SetSigma(1.); 
+
+ // P.id. 
+ Int_t pdg_code = fV0->GetPdgCode() ;
+ fFlowV0->SetMostLikelihoodPID(pdg_code);      
+
+ // mass 
+ fFlowV0->SetVmass((Float_t)fV0->GetEffMass()) ; 
+ Int_t pN = fV0->GetPindex() ;
+ Int_t nN = fV0->GetNindex() ;
+ AliFlowTrack* pos = (AliFlowTrack*)fFlowEvent->TrackCollection()->At(pN) ; 
+ AliFlowTrack* neg = (AliFlowTrack*)fFlowEvent->TrackCollection()->At(nN) ; 
+ fFlowV0->SetDaughters(pos,neg) ;
+
+ return fFlowV0 ;
+}
+//-----------------------------------------------------------------------
+Bool_t AliFlowMaker::CheckTrack(AliESDtrack* fTrack)
+{
+ // applies track cuts (E , nHits , label)
+
+ Int_t idXt[180] ;  // used for Cluster Map ( see AliESDtrack::GetTPCclusters() )
+ Int_t   nHits = fTrack->GetTPCclusters(idXt) ;
+ Float_t E     = fTrack->GetP() ;
+ Int_t   label = fTrack->GetLabel() ;
+ if(fNHits && (nHits<=fNHits))                                                  { return kFALSE ; }
+ if((fElow < fEup) && ((E<fElow) || (E>fEup)))                          { return kFALSE ; }
+ if((fLabel[0] < fLabel[1]) && ((label<fLabel[0]) || (label>fLabel[1]))) { return kFALSE ; }
+ //if(fPrimary && ...)                                                          { return kFALSE ; }
+
+ return kTRUE ;
+}
+//-----------------------------------------------------------------------
+Bool_t AliFlowMaker::CheckV0(AliESDv0* fV0)
+{
+ // applies v0 cuts (dummy)
+
+ return kTRUE ;
+}
+//-----------------------------------------------------------------------
+Bool_t AliFlowMaker::CheckEvent(AliESD* fESD)
+{
+ // applies event cuts (dummy)
+
+ return kTRUE ;
+}
+//-----------------------------------------------------------------------
+void AliFlowMaker::PrintCutList()
+{ 
+ // Prints the list of Cuts 
+
+ cout << " * ESD cuts list * " << endl ; 
+ if(fLabel[0]<fLabel[1])
+ { 
+  cout << "  Track Label [ " << fLabel[0] << " , " << fLabel[1] << " ] " << endl ; 
+ }
+ if(fNHits)
+ { 
+  cout << "  TPC clusters > " << fNHits << endl ; 
+ }
+ if(fElow<fEup)
+ { 
+  cout << "  Track Energy (P_total) [ " << fElow << " , " << fEup << " ] " << endl ; 
+ }
+ cout << " *               * " << endl ;
+}
+//-----------------------------------------------------------------------
+
+//-----------------------------------------------------------------------
+//*** USEFULL METHODS for a 3-array of double (~ TVector3) ***
+//-----------------------------------------------------------------------
+Double_t AliFlowMaker::Norm(Double_t nu[3])
+{ 
+ // returns the norm of a double[3] 
+
+ Double_t norm2 = nu[0]*nu[0] + nu[1]*nu[1] + nu[2]*nu[2] ;
+ return TMath::Sqrt(norm2) ; 
+}
+//-----------------------------------------------------------------------
+Double_t AliFlowMaker::Phi(Double_t nu[3])
+{
+ // returns the azimuthal angle of a double[3] 
+
+ if(nu[0]==0 && nu[1]==0) { return 0. ; }
+ else                    { return TMath::ATan2(nu[1],nu[0]) ; }
+}
+//-----------------------------------------------------------------------
+Double_t AliFlowMaker::Pt(Double_t nu[3])
+{
+ // returns the transvers momentum of a double[3] 
+
+ Double_t trans = nu[0]*nu[0] + nu[1]*nu[1] ;
+ return TMath::Sqrt(trans) ; 
+}
+//-----------------------------------------------------------------------
+Double_t AliFlowMaker::Eta(Double_t nu[3])
+{
+ // returns the PseudoRapidity of a double[3] 
+ // if transvers momentum = 0 --> returns +/- 1.000
+
+ Double_t m = Norm(nu) ;
+ if(nu[0]!=0 || nu[1]!=0) { return 0.5*TMath::Log((m+nu[2])/(m-nu[2])) ; }
+ else                    { return TMath::Sign((Double_t)1000.,nu[2]) ; }
+}
+//-----------------------------------------------------------------------
+
+#endif
diff --git a/PWG2/FLOW/AliFlowMaker.h b/PWG2/FLOW/AliFlowMaker.h
new file mode 100644 (file)
index 0000000..b1487e4
--- /dev/null
@@ -0,0 +1,116 @@
+//////////////////////////////////////////////////////////////////////
+//
+// $Id$
+//
+// Author: Emanuele Simili
+//
+//////////////////////////////////////////////////////////////////////
+//
+// Description: parser class from AliESD to AliFlowEvent . 
+//
+//////////////////////////////////////////////////////////////////////
+
+#ifndef ALIFLOWMAKER_H
+#define ALIFLOWMAKER_H
+
+class AliFlowEvent ;
+class AliFlowTrack ;
+class AliFlowV0 ;
+
+class AliESD ;
+class AliESDVertex ;
+class AliESDtrack ;
+class AliESDv0 ;
+
+class AliFlowMaker  {
+
+  public:
+    AliFlowMaker();
+    virtual ~AliFlowMaker();
+
+  // FLOW SPECIFIC METHODS (to fill the flowEvents)
+    AliFlowEvent*  FillFlowEvent(AliESD* fESD) ;           // fills up evt quantities 
+    AliFlowTrack*  FillFlowTrack(AliESDtrack* fTrack) ;     // fills up track quantities (global & constrained) ; p.id. & bayesian calculation ; 
+    AliFlowV0*    FillFlowV0(AliESDv0* fV0) ;              // fills up v0 quantities ; links v0 to tracks and back ;
+
+  // USEFULL METHODS
+    Double_t      Norm(Double_t nu[3]) ;                   // norm of a non-vector 3 array      
+    Double_t      Phi(Double_t nu[3]) ;                    // phi of a non-vector 3 array       
+    Double_t      Pt(Double_t nu[3]) ;                     // pt of a non-vector 3 array       
+    Double_t      Eta(Double_t nu[3]) ;                    // eta of a non-vector 3 array       
+
+  // Cut METHODS
+    Bool_t         CheckTrack(AliESDtrack* fTrack) ;       // checks track (applies track cuts)
+    Bool_t         CheckV0(AliESDv0* fV0) ;                // checks v0 (dummy)
+    Bool_t         CheckEvent(AliESD* fESD) ;              // checks event (dummy)
+    void          PrintCutList() ;                         // prints the list of cuts
+    void          SetNHitsCut(Int_t nHits)                 { fNHits = nHits ; }                        // exclude tracks with less than .. TPC hits 
+    void          SetECut(Float_t eLow, Float_t eUp)       { fElow = eLow ; fEup = eUp ; }             // exclude tracks below and above .. GeV 
+    void          SetLabelCut(Int_t labLo, Int_t labHi)    { fLabel[0] = labLo ; fLabel[1] = labHi ; } // exclude tracks outside label interval
+
+  // Get METHODS
+    Int_t          GetNgoodTracks()                        { return fGoodTracks ; }      
+    Int_t          GetNgoodV0s()                           { return fGoodV0s ; }         
+    Int_t          GetNgoodTracksEta()                     { return fGoodTracksEta ; } 
+    Int_t          GetNposiTracks()                        { return fPosiTracks ; }    
+    Int_t          GetNnegaTracks()                        { return fNegaTracks ; }    
+    Int_t          GetNunconstrained()                     { return fUnconstrained ; } 
+    Int_t          GetBayesian(Int_t i = 2)                { return fBayesianAll[i] ; }
+    Float_t        GetBayesianNorm(Int_t i = 2)            { return (Float_t)fBayesianAll[i] / (Float_t)fSumAll ; }
+
+ protected:
+  // enumerators                           
+    Int_t            fEventNumber ;                        //! progressive enumeration of ESD events
+    Int_t            fTrackNumber ;                        //! progressive enumeration of ESD tracks
+    Int_t            fV0Number ;                           //! progressive enumeration of ESD V0
+
+    Int_t            fGoodTracks ;                         //! enumerator for good tracks
+    Int_t            fGoodV0s ;                            //! enumerator for good v0s
+    Int_t            fGoodTracksEta ;                      //! enumerator for good tracks in the good eta range (-0.9..0.9)
+    Int_t            fPosiTracks ;                         //! enumerator for positive tracks
+    Int_t            fNegaTracks ;                         //! enumerator for negative tracks
+    Int_t            fUnconstrained ;                      //! enumerator for tracks not constrainable
+    Int_t            fBayesianAll[5] ;                     //! final particles abundance -> AliFlowEvent (see Bayesian P.Id.)
+    Int_t            fSumAll ;                             //! total particles abundance (all kind)
+
+    Int_t            fCutEvts ;                            //! total enumerator for discarded events
+    Int_t            fCutTrks ;                            //! total enumerator for discarded tracks
+    Int_t            fCutV0s ;                             //! total enumerator for discarded V0s
+  // Flags
+    Bool_t           fNewAli ;                             //! enables the new ESD features (since AliRoot 12/2006) 
+    Bool_t           fLoopTrks ;                           //! flag to loop over tracks 
+    Bool_t           fLoopV0s ;                            //! flag to loop over v0s 
+
+    Int_t           fCounter ;                             //! number of processed events
+
+ private:
+
+  // ESDs
+    AliESD*          fESD;                                 //! "ESD" branch in fChain
+    AliESDtrack*     fTrack;                               //! "ESD track" 
+    AliESDv0*        fV0;                                  //! "ESD v0" 
+    AliESDVertex*    fVertex;                              //! "ESD primary vertex"  
+
+    Int_t            fRunID;                               //! last run ID
+    Int_t            fNumberOfEvents ;                     //! total number of ESD events in file
+    Int_t            fNumberOfTracks ;                     //! total number of tracks in the current event
+    Int_t            fNumberOfV0s ;                        //! total number of v0s in the current event
+    Float_t         fMagField ;                            //! magnetic field from the ESD
+
+  // Flow
+    AliFlowEvent*    fFlowEvent ;                          //! pointer to flow event
+    AliFlowTrack*    fFlowTrack;                           //! pointer to flow track
+    AliFlowV0*       fFlowV0;                                      //! pointer to flow V0
+
+  // Tracks cuts
+    Int_t   fNHits;                                                // exclude tracks with less than .. TPC hits 
+    Float_t fElow ;                                        // exclude tracks below .. GeV (~total Momentum)
+    Float_t fEup ;                                         // exclude tracks above .. GeV (~total Momentum)
+    Int_t   fLabel[2] ;                                            // exclude tracks outside label interval
+  ClassDef(AliFlowMaker,0);
+};                     
+
+#endif
index 747b17ce02fbaaf39b8522f92d9d1e77de0f35f9..04544a947b53f690181fad2285ee566d12886e1c 100644 (file)
@@ -32,8 +32,8 @@
 using namespace std; //required for resolving the 'cout' symbol
 
 // - 1st selection (both harmonic) is Disabled ! - the 2 following are the same (basic cuts, no P.id)
-Float_t  AliFlowSelection::fEtaTpcCuts[2][Flow::nHars][Flow::nSels] = {{{1.0,0.0},{1.0,0.0}},{{0.0,2.1},{0.0,2.1}}} ;
-Float_t  AliFlowSelection::fPtTpcCuts[2][Flow::nHars][Flow::nSels]  = {{{1.0,0.1},{1.0,0.1}},{{0.0,9.0},{0.0,9.0}}} ;
+Float_t  AliFlowSelection::fEtaTpcCuts[2][Flow::nHars][Flow::nSels] = {{{1.0,0.0},{1.0,0.0}},{{0.0,1.1},{0.0,1.1}}} ;
+Float_t  AliFlowSelection::fPtTpcCuts[2][Flow::nHars][Flow::nSels]  = {{{1.0,0.1},{1.0,0.1}},{{0.0,10.0},{0.0,10.0}}} ;
 Float_t  AliFlowSelection::fDcaGlobalCuts[2]    = { 0. , 1. } ;
 Char_t   AliFlowSelection::fPid[10]              = { '\0' } ;
 Bool_t   AliFlowSelection::fConstrainable        = kTRUE ;
@@ -45,8 +45,6 @@ AliFlowSelection::AliFlowSelection()
 {
  // Default constructor: when initialized all selection cuts are disabled (lo>hi).
 
- fJustLoopConstrainable = kFALSE ;     // = kTRUE
- // -
  fCent                = -1 ; 
  fRun                 = -1 ; 
  // -
@@ -95,6 +93,8 @@ AliFlowSelection::AliFlowSelection()
  fV0LenghtOverSigma[1] = 0 ;  
  fV0DcaCross[0]        = 1 ;  
  fV0DcaCross[1]        = 0 ;  
+ fV0Mass[0]           = 1 ;
+ fV0Mass[1]           = 0 ;
  // -
  fPtBinsPart          = Flow::nPtBinsPart ;  
  // -                  
@@ -465,12 +465,6 @@ void AliFlowSelection::SetSubevent(const Int_t& subN)
  else { fSubevent = subN; } 
 }
 //-----------------------------------------------------------------------
-Float_t AliFlowSelection::PtMaxPart() const                           
-{ 
- if(fPtPart[1]>fPtPart[0]) { return fPtPart[1] ; } 
- else { return 0. ; } 
-}
-//-----------------------------------------------------------------------
 void AliFlowSelection::SetEtaCut(Float_t lo, Float_t hi, Int_t harN, Int_t selN) 
 { 
  fEtaTpcCuts[0][harN][selN] = lo ; 
@@ -483,67 +477,31 @@ void AliFlowSelection::SetPtCut(Float_t lo, Float_t hi, Int_t harN, Int_t selN)
  fPtTpcCuts[1][harN][selN] = hi ; 
 }
 //-----------------------------------------------------------------------
-void AliFlowSelection::SetV0SideBands() 
-{  
- Float_t massInterval = fV0Mass[1] - fV0Mass[0] ;
- SetV0SideBands(TMath::Abs(massInterval/2)) ; 
-}                      
-//-----------------------------------------------------------------------
-void AliFlowSelection::SetV0SideBands(Float_t sb)                     
+void AliFlowSelection::SetDcaGlobalCut(Float_t lo, Float_t hi)      
 { 
- fV0SideBand = sb ; 
-}                      
+ fDcaGlobalCuts[0] = lo ; 
+ fDcaGlobalCuts[1] = hi ; 
+}
 //-----------------------------------------------------------------------
-void    AliFlowSelection::SetCentralityCut(Int_t cent)                        { fCent = cent ; }
-void    AliFlowSelection::SetRunIdCut(Int_t run)                      { fRun = run ; }
-void   AliFlowSelection::SetDcaGlobalCut(Float_t lo, Float_t hi)      { fDcaGlobalCuts[0] = lo ; fDcaGlobalCuts[1] = hi ; }
-void   AliFlowSelection::SetPidCut(const Char_t* pid)                 { strncpy(fPid, pid, 9) ; fPid[9] = '\0' ; }
-void   AliFlowSelection::SetConstrainCut(Bool_t tf)                   { fConstrainable = tf ; }
-void   AliFlowSelection::SetNhitsCut(Int_t hits,Int_t selN)           { fTPChits[selN] = hits; }
-void   AliFlowSelection::SetPidPart(const Char_t* pid)                { strncpy(fPidPart, pid, 9); fPidPart[9] = '\0'; }
-void   AliFlowSelection::SetPidProbPart(Float_t lo, Float_t hi)       { fPidProbPart[0] = lo ; fPidProbPart[1] = hi; }
-void   AliFlowSelection::SetPtPart(Float_t lo, Float_t hi)            { fPtPart[0] = lo; fPtPart[1] = hi; }
-void   AliFlowSelection::SetPtBinsPart(Int_t bins)                    { fPtBinsPart = bins; }
-void   AliFlowSelection::SetPPart(Float_t lo, Float_t hi)             { fPPart[0] = lo; fPPart[1] = hi; }
-void   AliFlowSelection::SetEtaPart(Float_t lo, Float_t hi)           { fEtaPart[0] = lo; fEtaPart[1] = hi; }
-void    AliFlowSelection::SetEtaAbsPart(Float_t lo, Float_t hi)        { fEtaAbsPart[0] = TMath::Abs(lo); fEtaAbsPart[1] = TMath::Abs(hi); }
-void   AliFlowSelection::SetYPart(Float_t lo, Float_t hi)             { fYPart[0] = lo; fYPart[1] = hi; }
-void   AliFlowSelection::SetFitPtsPart(Int_t lo, Int_t hi)            { fFitPtsPart[0] = lo; fFitPtsPart[1] = hi; }
-void   AliFlowSelection::SetDedxPtsPart(Int_t lo, Int_t hi)           { fDedxPtsPart[0] = lo; fDedxPtsPart[1] = hi; }
-void   AliFlowSelection::SetFitOverMaxPtsPart(Float_t lo, Float_t hi) { fFitOverMaxPtsPart[0] = lo; fFitOverMaxPtsPart[1] = hi; }
-void   AliFlowSelection::SetChiSqPart(Float_t lo, Float_t hi)         { fChiSqPart[0] = lo; fChiSqPart[1] = hi; }
-void   AliFlowSelection::SetDcaGlobalPart(Float_t lo, Float_t hi)     { fDcaGlobalPart[0] = lo; fDcaGlobalPart[1] = hi; }
-void    AliFlowSelection::SetConstrainablePart(Bool_t constr)          { fConstrainablePart = constr ; }
-void   AliFlowSelection::SetV0Pid(const Char_t* pid)                  { strncpy(fV0Pid, pid, 9) ; fV0Pid[9] = '\0' ; }                 
-void    AliFlowSelection::SetV0Mass(Float_t lo, Float_t hi)            { fV0Mass[0] = lo ; fV0Mass[1] = hi; }
-void   AliFlowSelection::SetV0Pt(Float_t lo, Float_t hi)              { fV0Pt[0] = lo ; fV0Pt[1] = hi; }
-void   AliFlowSelection::SetV0P(Float_t lo, Float_t hi)               { fV0P[0] = lo ; fV0P[1] = hi; }
-void   AliFlowSelection::SetV0Eta(Float_t lo, Float_t hi)             { fV0Eta[0] = lo ; fV0Eta[1] = hi; }
-void   AliFlowSelection::SetV0EtaAbs(Float_t lo, Float_t hi)          { fV0EtaAbs[0] = lo ; fV0EtaAbs[1] = hi; }
-void   AliFlowSelection::SetV0Y(Float_t lo, Float_t hi)               { fV0Y[0] = lo ; fV0Y[1] = hi; }
-void   AliFlowSelection::SetV0ChiSqPart(Float_t lo, Float_t hi)       { fV0ChiSq[0] = lo ; fV0ChiSq[1] = hi; }
-void   AliFlowSelection::SetV0Lenght(Float_t lo, Float_t hi)          { fV0Lenght[0] = lo ; fV0Lenght[1] = hi; }
-void   AliFlowSelection::SetV0DcaCross(Float_t lo, Float_t hi)        { fV0DcaCross[0] = lo ; fV0DcaCross[1] = hi; }
-void   AliFlowSelection::SetV0LenghtOverSigma(Float_t lo, Float_t hi) { fV0LenghtOverSigma[0] = lo ; fV0LenghtOverSigma[1] = hi; }
+void AliFlowSelection::SetPidCut(const Char_t* pid)           
+{ 
+ strncpy(fPid, pid, 9) ; 
+ fPid[9] = '\0' ; 
+}
 //-----------------------------------------------------------------------
-Char_t* AliFlowSelection::PidPart()                                   { return fPidPart; }
-Int_t  AliFlowSelection::PtBinsPart() const                           { return fPtBinsPart; }
-Int_t  AliFlowSelection::Sel() const                                  { return fSelection; }
-Int_t  AliFlowSelection::Har() const                                  { return fHarmonic; }
-Int_t  AliFlowSelection::Sub() const                                  { return fSubevent; }
-Float_t AliFlowSelection::EtaCutLo(Int_t harN, Int_t selN) const       { return fEtaTpcCuts[0][harN][selN] ; }
-Float_t AliFlowSelection::EtaCutHi(Int_t harN, Int_t selN) const       { return fEtaTpcCuts[1][harN][selN] ; }
-Float_t AliFlowSelection::PtCutLo(Int_t harN, Int_t selN) const        { return fPtTpcCuts[0][harN][selN] ; }
-Float_t AliFlowSelection::PtCutHi(Int_t harN, Int_t selN) const        { return fPtTpcCuts[1][harN][selN] ; }
-Char_t* AliFlowSelection::Pid() const                                 { return fPid; }
-Float_t AliFlowSelection::DcaGlobalCutLo() const                      { return fDcaGlobalCuts[0] ; }
-Float_t AliFlowSelection::DcaGlobalCutHi() const                      { return fDcaGlobalCuts[1] ; }
-Bool_t  AliFlowSelection::ConstrainCut() const                        { return fConstrainable ; }
-Int_t   AliFlowSelection::NhitsCut(Int_t selN) const                  { return fTPChits[selN] ; }
+void AliFlowSelection::SetConstrainCut(Bool_t tf) 
+{ 
+ fConstrainable = tf ; 
+}
 //-----------------------------------------------------------------------
-Int_t   AliFlowSelection::CentralityCut() const                       { return fCent ; }
-Int_t   AliFlowSelection::RunIdCut() const                            { return fRun ; }
+void AliFlowSelection::SetNhitsCut(Int_t hits,Int_t selN)
+{ 
+ fTPChits[selN] = hits; 
+}
 //-----------------------------------------------------------------------
-void    AliFlowSelection::SetJustLoopConstrainable()                  { fJustLoopConstrainable = kTRUE ; }
-Bool_t  AliFlowSelection::JustLoopConstrainable() const                       { return fJustLoopConstrainable ; }
+Float_t AliFlowSelection::PtMaxPart() const                           
+{ 
+ if(fPtPart[1]>fPtPart[0]) { return fPtPart[1] ; } 
+ else { return 0. ; } 
+}
 //-----------------------------------------------------------------------
index d9f683c7e0e7cfe95e9583bb42c6803ca7d903ec..1f728dce6d120b3dcffa96a84f692c9b7d4afa43 100644 (file)
@@ -35,101 +35,101 @@ class Flow ;
 
 class AliFlowSelection : public TObject {
 
+
  public:
 
           AliFlowSelection();
   virtual ~AliFlowSelection();
 
  // Selection Methods for ... 
-  Bool_t  Select(AliFlowEvent*);                               // (dummy)
-  Bool_t  Select(AliFlowTrack*);                               // selection for R.P.[nSel][nHar]
-  Bool_t  Select(AliFlowV0*);                                  // (dummy) 
-  Bool_t  SelectPart(AliFlowTrack*);                           // track selection for Correlation Analysis
-  Bool_t  SelectPart(AliFlowV0*);                              // v0 selection for Correlation Analysis (mass window + sidebands)
-  Bool_t  SelectV0Part(AliFlowV0*);                                    // v0 mass window for Correlation Analysis 
-  Bool_t  SelectV0Side(AliFlowV0*);                                    // v0 sidebands for Correlation Analysis 
-  Bool_t  SelectV0sxSide(AliFlowV0*);                          // selects v0s in the left hand sideband
-  Bool_t  SelectV0dxSide(AliFlowV0*);                          // selects v0s in the right hand sideband
+  Bool_t  Select(AliFlowEvent*);                      // (dummy)
+  Bool_t  Select(AliFlowTrack*);                      // selection for R.P.[nSel][nHar]
+  Bool_t  Select(AliFlowV0*);                         // (dummy) 
+  Bool_t  SelectPart(AliFlowTrack*);                  // track selection for Correlation Analysis
+  Bool_t  SelectPart(AliFlowV0*);                     // v0 selection for Correlation Analysis (mass window + sidebands)
+  Bool_t  SelectV0Part(AliFlowV0*);                           // v0 mass window for Correlation Analysis 
+  Bool_t  SelectV0Side(AliFlowV0*);                           // v0 sidebands for Correlation Analysis 
+  Bool_t  SelectV0sxSide(AliFlowV0*);                 // selects v0s in the left hand sideband
+  Bool_t  SelectV0dxSide(AliFlowV0*);                 // selects v0s in the right hand sideband
 
  // Gets (Harmonic, Selection, Sub-event)
-  Int_t   Sel() const;                                         // Returns the Harmonic                       
-  Int_t   Har() const;                                         // Returns the Selection
-  Int_t   Sub() const;                                         // Returns the Sub-Event
+  Int_t   Sel() const                                 { return fSelection; }                  // Returns the Harmonic 
+  Int_t   Har() const                                 { return fHarmonic; }                   // Returns the Selection
+  Int_t   Sub() const                                 { return fSubevent; }                   // Returns the Sub-Event
+
+ // Gets (R.P. cuts) and CutList
+  Float_t EtaCutLo(Int_t harN, Int_t selN) const       { return fEtaTpcCuts[0][harN][selN] ; } // Returns lower eta cut for R.P.[harN][selN] calculation (absolute values)
+  Float_t EtaCutHi(Int_t harN, Int_t selN) const       { return fEtaTpcCuts[1][harN][selN] ; } // Returns upper eta cut for R.P.[harN][selN] calculation (absolute values)
+  Float_t PtCutLo(Int_t harN, Int_t selN) const        { return fPtTpcCuts[0][harN][selN] ; }  // Returns lower pT cut for R.P.[harN][selN] calculation 
+  Float_t PtCutHi(Int_t harN, Int_t selN) const        { return fPtTpcCuts[1][harN][selN] ; }  // Returns upper pT cut for R.P.[harN][selN] calculation
+  Float_t DcaGlobalCutLo() const                      { return fDcaGlobalCuts[0] ; }          // Returns lower DCA cut for R.P. calculation
+  Float_t DcaGlobalCutHi() const                      { return fDcaGlobalCuts[1] ; }          // Returns upper DCA cut for R.P. calculation
+  Bool_t  ConstrainCut() const                        { return fConstrainable ; }             // Returns kTRUE/kFalse if the cut over un-constrainable tracks is enabled
+  Int_t   NhitsCut(Int_t selN) const                  { return fTPChits[selN] ; }             // Returns the minimum number of TPC hits for R.P.[selN] calculation
+  Char_t* Pid() const                                 { return fPid; }                        // Returns particle specie used in R.P. calculation
 
  // Gets (Event cuts)
-  Int_t   CentralityCut() const ;                              // Returns Event Centrality class
-  Int_t   RunIdCut() const ;                                   // Returns Run number 
+  Int_t   CentralityCut() const                               { return fCent ; }                      // Returns Event Centrality class
+  Int_t   RunIdCut() const                            { return fRun ; }                       // Returns Run number 
 
- // Gets (R.P. cuts) and CutList
-  Float_t EtaCutLo(Int_t harN, Int_t selN) const;              // Returns lower eta cut for R.P.[harN][selN] calculation (absolute values)
-  Float_t EtaCutHi(Int_t harN, Int_t selN) const;              // Returns upper eta cut for R.P.[harN][selN] calculation (absolute values)                             
-  Float_t PtCutLo(Int_t harN, Int_t selN)  const;              // Returns lower pT cut for R.P.[harN][selN] calculation 
-  Float_t PtCutHi(Int_t harN, Int_t selN) const ;              // Returns upper pT cut for R.P.[harN][selN] calculation
-  Float_t DcaGlobalCutLo() const;                              // Returns lower DCA cut for R.P. calculation
-  Float_t DcaGlobalCutHi() const;                              // Returns upper DCA cut for R.P. calculation
-  Char_t* Pid() const;                                         // Returns particle specie used in R.P. calculation
-  Bool_t  ConstrainCut() const;                                        // Returns kTRUE/kFalse if the cut over un-constrainable tracks is enabled
-  Int_t   NhitsCut(Int_t selN) const;                                  // Returns the minimum number of TPC hits for R.P.[selN] calculation
-
- // Gets (correlation cuts)
-  Char_t* PidPart() ;                                          // Returns selected particle species wrt Reaction Plane
-  Float_t PtMaxPart() const ;                                  // Returns the max pT for evt.plane calc.
-  Int_t   PtBinsPart() const ;                                 // Returns N. of pT binning
-  void    SetPtBinsPart(const Int_t);                          // Sets N. of bins from fPtPart[0] to fPtPart[1]
-  void    PrintList() const ;                                  // Prints the tracks cut-list (for correlation analysis)
-  void    PrintSelectionList() const ;                         // Prints a summary of the selection criteria (for RP determination)
-  void    PrintV0List() const ;                                        // Prints the v0s cut-list (for correlation analysis)
+ // Gets (Correlation analysis cuts of tracks & V0s)
+  Char_t* PidPart()                                   { return fPidPart; }                    // Returns selected particle species wrt Reaction Plane
+  Int_t          PtBinsPart() const                           { return fPtBinsPart; }                 // Returns N. of pT binning             
+  Float_t PtMaxPart() const ;                                                                 // Returns the max pT for evt.plane calc.
+
+ // Cuts list
+  void    PrintList() const ;                                                                 // Prints the tracks cut-list (for correlation analysis)
+  void    PrintSelectionList() const ;                                                        // Prints a summary of the selection criteria (for RP determination)
+  void    PrintV0List() const ;                                                                       // Prints the v0s cut-list (for correlation analysis)
 
  // Harmonic & Selection set (R.P.)
-  void    SetHarmonic(const Int_t&);                           // Sets the Harmonic
-  void    SetSelection(const Int_t&);                          // Sets the Selection
-  void    SetSubevent(const Int_t&);                           // Sets the Sub-Event
-  
- // Cuts set (Events)
-  void    SetCentralityCut(Int_t cent) ;                       // Sets Event Centrality class
-  void    SetRunIdCut(Int_t run) ;                             // Sets Run number 
+  void    SetHarmonic(const Int_t&);                                                          // Sets the Harmonic
+  void    SetSelection(const Int_t&);                                                         // Sets the Selection
+  void    SetSubevent(const Int_t&);                                                          // Sets the Sub-Event
   
  // Cuts set (Reaction Plane)
-  static void  SetPidCut(const Char_t* pid);                              // Sets the particle specie used in R.P. calculation
-  static void  SetEtaCut(Float_t lo, Float_t hi, Int_t harN, Int_t selN);  // Sets |eta| cut for R.P.[harN][selN] calculation
-  static void  SetPtCut(Float_t lo, Float_t hi, Int_t harN, Int_t selN);   // Sets pT cut for R.P.[harN][selN] calculation
-  static void  SetDcaGlobalCut(Float_t lo, Float_t hi);                   // Sets DCA cut for R.P. calculation
-  static void  SetConstrainCut(Bool_t tf = kTRUE) ;                       // Sets the cut over un-constrainable tracks
-  static void  SetNhitsCut(Int_t hits, Int_t selN) ;                      // Sets the minimum number of TPC hits for R.P.[selN] calculation
-
- // Cuts set (Correlation Analysis)
-  void    SetPidPart(const Char_t*);                           // Sets PID for particles wrt Reaction plane 
-  void   SetPidProbPart(const Float_t, const Float_t);         // Sets PID probability for particles wrt Reaction plane
-  void    SetPtPart(const Float_t, const Float_t);             // Sets pT for particles wrt Reaction plane 
-  void    SetPPart(const Float_t, const Float_t);              // Sets Momentum for particles wrt Reaction plane 
-  void    SetEtaPart(const Float_t, const Float_t);            // Sets Eta for particles wrt Reaction plane    
-  void    SetEtaAbsPart(const Float_t, const Float_t);         // Sets |Eta| for particles wrt Reaction plane          
-  void    SetYPart(const Float_t, const Float_t);              // Sets Rapidity for particles (with sign.) wrt Reaction plane 
-  void    SetFitPtsPart(const Int_t, const Int_t);             // Sets FitPoints for particles wrt Reaction plane  
-  void    SetDedxPtsPart(const Int_t, const Int_t);            // Sets dE/dx for particles wrt Reaction plane          
-  void    SetFitOverMaxPtsPart(const Float_t, const Float_t);  // Sets FitPoints/MaxPoints for particles wrt Reaction plane 
-  void    SetChiSqPart(const Float_t, const Float_t);          // Sets Chi^2 for particles wrt Reaction plane          
-  void    SetDcaGlobalPart(const Float_t, const Float_t);      // Sets d.c.a. for particles wrt Reaction plane         
-  void    SetConstrainablePart(Bool_t constr = kTRUE);         // Sets constrainability for particles wrt Reaction plane       
-
- // Cuts set (V0 Analysis)
-  void    SetV0Pid(const Char_t*) ;                            // Sets PID for v0 wrt plane (...)
-  void    SetV0Mass(const Float_t, const Float_t) ;            // Sets invariant mass cut for v0 wrt plane 
-  void    SetV0Pt(const Float_t, const Float_t) ;              // Sets pT for v0 wrt plane 
-  void    SetV0P(const Float_t, const Float_t) ;               // Sets Momentum for v0 wrt plane 
-  void    SetV0Eta(const Float_t, const Float_t) ;             // Sets Eta cut for v0 wrt plane 
-  void    SetV0EtaAbs(const Float_t, const Float_t) ;          // Sets |Eta| cut (absolute value) for v0 wrt plane 
-  void    SetV0Y(const Float_t, const Float_t) ;               // Sets Rapidity for v0 wrt plane 
-  void    SetV0ChiSqPart(const Float_t, const Float_t) ;       // Sets Chi^2 for v0 wrt plane 
-  void    SetV0DcaCross(const Float_t, const Float_t) ;        // Sets distance to the main vertex for v0 wrt plane
-  void    SetV0Lenght(const Float_t, const Float_t) ;          // Sets distance to the main vertex in sigma units for v0 wrt plane
-  void    SetV0LenghtOverSigma(const Float_t, const Float_t) ; // Sets closest approach (between the 2 daughter tracks) for v0 wrt plane  
-  void   SetV0SideBands() ;                                    // Includes the v0 sideband analysis wrt plane          
-  void   SetV0SideBands(const Float_t) ;                       // Includes the v0 sideband analysis and a width                
-
- // For just constrainable track analysis (main loop, R.P. excluded)
-  void    SetJustLoopConstrainable() ;                         // Sets for the analysis loop just over constrainable track
-  Bool_t  JustLoopConstrainable() const ;                      // kFALSE (default) or kTRUE (set it above) 
+  static void  SetPidCut(const Char_t* pid);                                                  // Sets the particle specie used in R.P. calculation
+  static void  SetEtaCut(Float_t lo, Float_t hi, Int_t harN, Int_t selN);                     // Sets |eta| cut for R.P.[harN][selN] calculation
+  static void  SetPtCut(Float_t lo, Float_t hi, Int_t harN, Int_t selN);                      // Sets pT cut for R.P.[harN][selN] calculation
+  static void  SetDcaGlobalCut(Float_t lo, Float_t hi);                                       // Sets DCA cut for R.P. calculation
+  static void  SetConstrainCut(Bool_t tf = kTRUE) ;                                           // Sets the cut over un-constrainable tracks
+  static void  SetNhitsCut(Int_t hits, Int_t selN) ;                                          // Sets the minimum number of TPC hits for R.P.[selN] calculation
+
+ // Sets (Event cuts)
+  void    SetCentralityCut(Int_t cent)                { fCent = cent ; }                      // Sets Event Centrality class
+  void    SetRunIdCut(Int_t run)                      { fRun = run ; }                        // Sets Run number 
+
+ // Cuts set (correlation analysis cuts of tracks & V0s)
+  void    SetPtBinsPart(Int_t bins)                   { fPtBinsPart = bins; }                                               // Sets N. of bins from fPtPart[0] to fPtPart[1]                
+
+  void    SetPidPart(const Char_t* pid)               { strncpy(fPidPart, pid, 9); fPidPart[9] = '\0'; }                    // Sets PID for particles wrt Reaction plane 
+  void    SetPidProbPart(Float_t lo, Float_t hi)       { fPidProbPart[0] = lo ; fPidProbPart[1] = hi; }                     // Sets PID probability for particles wrt Reaction plane
+  void    SetPtPart(Float_t lo, Float_t hi)           { fPtPart[0] = lo; fPtPart[1] = hi; }                                 // Sets pT for particles wrt Reaction plane 
+  void    SetPPart(Float_t lo, Float_t hi)            { fPPart[0] = lo; fPPart[1] = hi; }                                   // Sets Momentum for particles wrt Reaction plane 
+  void    SetEtaPart(Float_t lo, Float_t hi)          { fEtaPart[0] = lo; fEtaPart[1] = hi; }                               // Sets Eta for particles wrt Reaction plane    
+  void    SetEtaAbsPart(Float_t lo, Float_t hi)        { fEtaAbsPart[0] = TMath::Abs(lo); fEtaAbsPart[1] = TMath::Abs(hi); } // Sets |Eta| for particles wrt Reaction plane         
+  void    SetYPart(Float_t lo, Float_t hi)            { fYPart[0] = lo; fYPart[1] = hi; }                                   // Sets Rapidity for particles (with sign.) wrt Reaction plane 
+  void    SetFitPtsPart(Int_t lo, Int_t hi)           { fFitPtsPart[0] = lo; fFitPtsPart[1] = hi; }                         // Sets FitPoints for particles wrt Reaction plane  
+  void    SetDedxPtsPart(Int_t lo, Int_t hi)          { fDedxPtsPart[0] = lo; fDedxPtsPart[1] = hi; }                       // Sets dE/dx for particles wrt Reaction plane          
+  void    SetFitOverMaxPtsPart(Float_t lo, Float_t hi) { fFitOverMaxPtsPart[0] = lo; fFitOverMaxPtsPart[1] = hi; }          // Sets FitPoints/MaxPoints for particles wrt Reaction plane 
+  void    SetChiSqPart(Float_t lo, Float_t hi)         { fChiSqPart[0] = lo; fChiSqPart[1] = hi; }                          // Sets Chi^2 for particles wrt Reaction plane          
+  void    SetDcaGlobalPart(Float_t lo, Float_t hi)     { fDcaGlobalPart[0] = lo; fDcaGlobalPart[1] = hi; }                  // Sets d.c.a. for particles wrt Reaction plane         
+  void    SetConstrainablePart(Bool_t constr)         { fConstrainablePart = constr ; }                                     // Sets constrainability for particles wrt Reaction plane      
+
+  void    SetV0Pid(const Char_t* pid)                 { strncpy(fV0Pid, pid, 9) ; fV0Pid[9] = '\0' ; }                      // Sets PID for v0 wrt plane (...)
+  void    SetV0Mass(Float_t lo, Float_t hi)           { fV0Mass[0] = lo ; fV0Mass[1] = hi; }                                // Sets invariant mass cut for v0 wrt plane 
+  void    SetV0Pt(Float_t lo, Float_t hi)             { fV0Pt[0] = lo ; fV0Pt[1] = hi; }                                    // Sets pT for v0 wrt plane 
+  void    SetV0P(Float_t lo, Float_t hi)              { fV0P[0] = lo ; fV0P[1] = hi; }                                      // Sets Momentum for v0 wrt plane 
+  void    SetV0Eta(Float_t lo, Float_t hi)            { fV0Eta[0] = lo ; fV0Eta[1] = hi; }                                  // Sets Eta cut for v0 wrt plane 
+  void    SetV0EtaAbs(Float_t lo, Float_t hi)         { fV0EtaAbs[0] = lo ; fV0EtaAbs[1] = hi; }                            // Sets |Eta| cut (absolute value) for v0 wrt plane 
+  void    SetV0Y(Float_t lo, Float_t hi)              { fV0Y[0] = lo ; fV0Y[1] = hi; }                                      // Sets Rapidity for v0 wrt plane 
+  void    SetV0ChiSqPart(Float_t lo, Float_t hi)       { fV0ChiSq[0] = lo ; fV0ChiSq[1] = hi; }                             // Sets Chi^2 for v0 wrt plane 
+  void    SetV0Lenght(Float_t lo, Float_t hi)         { fV0Lenght[0] = lo ; fV0Lenght[1] = hi; }                            // Sets distance to the main vertex for v0 wrt plane
+  void    SetV0DcaCross(Float_t lo, Float_t hi)        { fV0DcaCross[0] = lo ; fV0DcaCross[1] = hi; }                       // Sets distance to the main vertex in sigma units for v0 wrt plane
+  void    SetV0LenghtOverSigma(Float_t lo, Float_t hi) { fV0LenghtOverSigma[0] = lo ; fV0LenghtOverSigma[1] = hi; }         // Sets closest approach (between the 2 daughter tracks) for v0 wrt plane  
+  void    SetV0SideBands()                            { SetV0SideBands(TMath::Abs((fV0Mass[1]-fV0Mass[0])/2)) ; }           // Includes the v0 sideband analysis wrt plane          
+  void    SetV0SideBands(Float_t sb)                  { fV0SideBand = sb ; }                                                // Includes the v0 sideband analysis and a width                
+
 
  private:
 
@@ -181,8 +181,6 @@ class AliFlowSelection : public TObject {
   static Int_t    fTPChits[Flow::nSels];                       //! minimum number of TPC hits
   static Bool_t   fConstrainable;                              //! cut un-constrainable tracks 
 
- // Cuts for all tracks entering the main loop (R.P. loop is excluded)
-  Bool_t  fJustLoopConstrainable ;                             // constrainability for tracks entering the main loop 
 
   ClassDef(AliFlowSelection,1)                                 // macro for rootcint
 }; 
index 64dcf8e0724875af5bffe32449cc18b3861d002b..761fdb8ea46208f9bfb425ae638b4cbc820fb992 100644 (file)
@@ -59,6 +59,9 @@ Float_t  AliFlowV0::P() const
 { 
  // Returns the reconstructed momentum of the v0
 
+ if(Pt()<=0)  { return 0. ; }
+ if(Eta()==0) { return 0. ; }
+
  float momentum = Pt()/TMath::Sqrt(1-(tanh(Eta())*tanh(Eta()))) ; 
  return momentum; 
 }
@@ -68,7 +71,7 @@ Float_t  AliFlowV0::Y() const
  // Rapidity of the v0
 
  if(TMath::Abs((Float_t)P()) == TMath::Abs((Float_t)Pt()))     { return 0. ; }
- else if(TMath::Abs((Float_t)P()) < TMath::Abs((Float_t)Pt())) { cout << "v0: " << GetName() << "has  Pt() > P() !!!" << endl ; }
+ else if(TMath::Abs((Float_t)P()) < TMath::Abs((Float_t)Pt())) { cout << "v0: " << GetName() << "has  Pt() > P() !!!" << endl ; return -1000. ; }
  // -
  float M = Mass() ; 
  double Pz = TMath::Sqrt(P()*P() - Pt()*Pt()); 
diff --git a/PWG2/FLOW/AliFlowWeighter.cxx b/PWG2/FLOW/AliFlowWeighter.cxx
new file mode 100644 (file)
index 0000000..1ca6be5
--- /dev/null
@@ -0,0 +1,439 @@
+       //////////////////////////////////////////////////////////////////////
+//
+// $Id$
+//
+// Author: Emanuele Simili
+//
+//////////////////////////////////////////////////////////////////////
+//_____________________________________________________________
+//
+// Description: 
+//         the AliFlowWeighter class generates the phi-weights which 
+// are later used to correct for azimuthal anisotropy in the reconstruction 
+// efficiency of the ALICE TPC. It also fills an histogram of normalised 
+// particle abundancies, which can be used as bayesian weights for particle Id. 
+//
+// - The method Init() generates the histograms and opens a new fPhiWgt file.
+// - The method WeightEvent(AliFlowEvent*) fills phi and PId histograms. 
+//   It must be inserted in a loop over the event sample.
+// - The method Finish() calculates the weights, saves the histograms and 
+//   closes the file. The AliFlowSelection object is saved as well.
+//
+//////////////////////////////////////////////////////////////////////
+
+#ifndef ALIFLOWANALYSER_CXX
+#define ALIFLOWANALYSER_CXX
+
+// ROOT things
+#include <TROOT.h>
+#include <TMath.h>
+#include <TFile.h>
+#include <TTree.h>
+#include <TString.h>
+#include <TObject.h>
+#include <TObjArray.h>
+#include <TOrdCollection.h>
+#include <TH1.h>
+#include <TVector2.h>
+
+// Flow things
+#include "AliFlowEvent.h"
+#include "AliFlowTrack.h"
+#include "AliFlowV0.h"
+#include "AliFlowConstants.h"
+#include "AliFlowSelection.h"
+#include "AliFlowWeighter.h"
+
+// ANSI things
+#include <stdio.h>
+#include <stdlib.h>
+#include <iostream>
+using namespace std; //required for resolving the 'cout' symbol
+
+ClassImp(AliFlowWeighter) ;
+//-----------------------------------------------------------------------
+AliFlowWeighter::AliFlowWeighter(const AliFlowSelection* flowSelect)
+{
+ // default constructor (selection given or default selection)
+
+ if(flowSelect) { fFlowSelect = new AliFlowSelection(*flowSelect) ; }
+ else          { fFlowSelect = new AliFlowSelection() ; }
+ // output file (histograms)
+ fWgtFileName = "flowPhiWgt.hist.root" ;
+ fWgtFile     = 0 ;
+}
+//-----------------------------------------------------------------------
+AliFlowWeighter::~AliFlowWeighter()
+{
+ // default distructor (no actions) 
+}
+//-----------------------------------------------------------------------
+Bool_t AliFlowWeighter::Init() 
+{
+// sets some defaults for the analysis
+ cout << "* FlowWeighter *  -  Init()" << endl ; cout << endl ; 
+ // Open output files (->plots)
+ fWgtFile = new TFile(fWgtFileName.Data(), "RECREATE");
+ fWgtFile->cd() ;
+
+ // counters and pointers to 0
+ fEventNumber = 0 ;
+ fTrackNumber = 0 ;    
+ fNumberOfTracks = 0 ; 
+ fNumberOfV0s    = 0 ; 
+ fFlowEvent  = 0 ;
+ fFlowTrack  = 0 ;
+ fFlowTracks = 0 ;
+ //for(Int_t ii=0;ii<3;ii++) { fVertex[ii] = 0 ; }
+
+ // Histogram settings
+ fPhiBins = Flow::nPhiBins ;     
+ fPhiMin  = 0.;
+ fPhiMax  = 2*TMath::Pi() ; 
+
+ TString* histTitle ;
+ for(int k = 0; k < Flow::nSels; k++)
+ {
+  histTitle = new TString("Flow_BayPidMult_Sel");
+  *histTitle += k+1;
+  fHistFull[k].fHistBayPidMult = new TH1F(histTitle->Data(), histTitle->Data(),Flow::nPid,-0.5,((Float_t)Flow::nPid-0.5));
+  fHistFull[k].fHistBayPidMult->Sumw2() ;
+  fHistFull[k].fHistBayPidMult->SetXTitle("e+/-  ,  mu+/-  ,  pi+/-  ,  K+/-  ,  p+/-  ,  d+/- ");
+  fHistFull[k].fHistBayPidMult->SetYTitle("Counts");
+  delete histTitle;
+
+  for(int j = 0; j < Flow::nHars; j++) 
+  {
+   // Tpc - Phi lab
+   histTitle = new TString("Flow_Phi_TPC_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhi = new TH1D(histTitle->Data(), histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhi->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhi->SetYTitle("Counts");
+   delete histTitle;
+   // Tpc (plus)
+   histTitle = new TString("Flow_Phi_TPCplus_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiPlus = new TH1D(histTitle->Data(), histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiPlus->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiPlus->SetYTitle("Counts");
+   delete histTitle;
+   // Tpc (minus)
+   histTitle = new TString("Flow_Phi_TPCminus_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiMinus = new TH1D(histTitle->Data(), histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiMinus->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiMinus->SetYTitle("Counts");
+   delete histTitle;
+   // Tpc (cross)
+   histTitle = new TString("Flow_Phi_TPCcross_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiAll = new TH1D(histTitle->Data(), histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiAll->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiAll->SetYTitle("Counts");
+   delete histTitle;
+
+   // Tpc - Phi lab flattened
+   histTitle = new TString("Flow_Phi_Flat_TPC_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiFlat = new TH1D(histTitle->Data(), histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiFlat->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiFlat->SetYTitle("Counts");
+   delete histTitle;
+   // Tpc Plus
+   histTitle = new TString("Flow_Phi_Flat_TPCplus_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiFlatPlus = new TH1D(histTitle->Data(), histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiFlatPlus->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiFlatPlus->SetYTitle("Counts");
+   delete histTitle;
+   // Tpc Minus
+   histTitle = new TString("Flow_Phi_Flat_TPCminus_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiFlatMinus = new TH1D(histTitle->Data(), histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiFlatMinus->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiFlatMinus->SetYTitle("Counts");
+   delete histTitle;
+   // Tpc cross
+   histTitle = new TString("Flow_Phi_Flat_TPCcross_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiFlatAll = new TH1D(histTitle->Data(), histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiFlatAll->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiFlatAll->SetYTitle("Counts");
+   delete histTitle;
+  }
+ }
+ return kTRUE ;
+} 
+//-----------------------------------------------------------------------
+
+//-----------------------------------------------------------------------
+Bool_t AliFlowWeighter::Finish() 
+{
+ // Calls the method to fill wgt histograms, then saves them 
+ // on the fWgtFile and closes the file .
+ cout << "* FlowWeighter *  -  Finish()" << endl ; cout << endl ;
+
+ Weightening() ;
+ fWgtFile->cd() ; 
+
+ // Write PhiWgt histograms
+ fPhiWgtHistList->Write();
+ delete fPhiWgtHistList ;
+ // Write Bayesian Weights for P.Id.
+ for(int k=0;k<Flow::nSels;k++) { fHistFull[k].fHistBayPidMult->Write() ; }
+
+ // Write the AliFlowSelection object
+ fFlowSelect->Write();
+ delete fFlowSelect ;
+
+ fWgtFile->Close();
+
+ cout << "    Finish()  -  Wgt file closed : " << fWgtFileName.Data() << endl ; cout << endl ; 
+
+ return kTRUE ;
+}
+//-----------------------------------------------------------------------
+// ###
+//-----------------------------------------------------------------------
+Bool_t AliFlowWeighter::WeightEvent(AliFlowEvent* fFlowEvent)         
+{
+ // Reads the AliFlowEvent (* fFlowEvent) and loops over the 
+ // AliFlowTraks to fill phi histograms .
+ cout << " AliFlowWeighter::WeightEvent(" << fFlowEvent << " )   -   " << fEventNumber << endl ;
+ if(!fFlowEvent) { return kFALSE ; }
+
+ if(fFlowSelect->Select(fFlowEvent))    // event selected - here below the ANALYSIS FLAGS are setted -
+ {
+  fFlowTracks = fFlowEvent->TrackCollection() ; 
+  fNumberOfTracks = fFlowTracks->GetEntries() ;
+  cout << "       event ID = " << fFlowEvent->EventID() << " :  found " << fNumberOfTracks << " AliFlowTracks . " << endl ;  
+  fFlowEvent->SetNoWgt() ;
+  fFlowEvent->SetSelections(fFlowSelect) ; // does the selection of tracks for r.p. calculation (sets flags in AliFlowTrack)
+  
+  TracksLoop(fFlowTracks) ;  
+ }
+ else 
+ {
+  cout << "       * " << fEventNumber << " (event ID = " << fFlowEvent->EventID() << ") discarded . " << endl ; 
+  delete fFlowEvent  ; fFlowEvent = 0 ; 
+  return kFALSE ;
+ }
+ fEventNumber++ ;
+ return kTRUE ;
+}
+//-----------------------------------------------------------------------
+// ###
+//-----------------------------------------------------------------------
+void AliFlowWeighter::TracksLoop(TObjArray* fFlowTracks) 
+{
+ // fills phi and PId histograms
+
+ cout << " Tracks Loop . " << endl ; 
+  
+ Float_t phi, eta, zFirstPoint ; // , zLastPoint ;
+ Int_t  fPidId ;
+ Char_t pid[10] = "0" ;
+ for(fTrackNumber=0;fTrackNumber<fNumberOfTracks;fTrackNumber++) 
+ {
+  fFlowTrack = (AliFlowTrack*)fFlowTracks->At(fTrackNumber) ;
+  // cout << "Track n. " << fTrackNumber << endl ; fFlowTrack->Dump() ; 
+  phi = fFlowTrack->Phi() ;            
+  eta = fFlowTrack->Eta() ;            
+  zFirstPoint = fFlowTrack->ZFirstPoint() ; 
+  //zLastPoint = fFlowTrack->ZLastPoint() ;
+  strcpy(pid,fFlowTrack->Pid()) ; 
+
+  fPidId = -1 ;
+  if(strstr(pid,"e"))              { fPidId = 0 ; }
+  else if(strstr(pid,"mu")) { fPidId = 1 ; }
+  else if(strstr(pid,"pi")) { fPidId = 2 ; }
+  else if(strstr(pid,"k"))  { fPidId = 3 ; }
+  else if(strstr(pid,"pr")) { fPidId = 4 ; }
+  else if(strstr(pid,"d"))  { fPidId = 5 ; }
+
+  // Looping over Selections and Harmonics
+  for (int k = 0; k < Flow::nSels; k++) 
+  {
+   fFlowSelect->SetSelection(k) ;
+   for (int j = 0; j < Flow::nHars; j++) 
+   {
+    fFlowSelect->SetHarmonic(j);
+    if(fFlowSelect->Select(fFlowTrack))
+    {
+     Bool_t kTpcPlus  = kFALSE ;
+     Bool_t kTpcMinus = kFALSE ;
+     Bool_t kTpcAll   = kFALSE ;
+
+     // Set Tpc (+ and -)
+     if(fFlowTrack->FitPtsTPC())
+     {
+      if(zFirstPoint >= 0. && eta > 0.)             { kTpcPlus  = kTRUE ; } 
+      else if(zFirstPoint <= 0. && eta < 0.) { kTpcMinus = kTRUE ; }
+      else                                  { kTpcAll   = kTRUE ; }      
+     }
+    
+     // Phi distribution (particle for R.P.)
+     Float_t wt = 1. ; // TMath::Abs(fFlowEvent->Weight(k, j, fFlowTrack)) ; 
+     if(kTpcPlus)       { fHistFull[k].fHistFullHar[j].fHistPhiPlus->Fill(phi,wt) ;  } 
+     else if(kTpcMinus) { fHistFull[k].fHistFullHar[j].fHistPhiMinus->Fill(phi,wt) ; } 
+     else if(kTpcAll)   { fHistFull[k].fHistFullHar[j].fHistPhiAll->Fill(phi,wt) ;   } 
+     fHistFull[k].fHistFullHar[j].fHistPhi->Fill(phi,wt) ;
+
+     // PID Multiplicities (particle for R.P.) - just once for each selection
+     if(j==0)          { fHistFull[k].fHistBayPidMult->Fill(fPidId) ; }
+    }
+   }
+  }
+ }
+  
+ return ;
+}
+//-----------------------------------------------------------------------
+Bool_t AliFlowWeighter::Weightening()
+{
+ // Calculates weights, and fills PhiWgt histograms .
+ // This is called at the end of the event loop .
+ cout << " AliFlowWeighter::Weightening() " << endl ; cout << endl ;
+ // PhiWgt histogram collection
+ fPhiWgtHistList = new TOrdCollection(4*Flow::nSels*Flow::nHars) ;
+ // Creates PhiWgt Histograms
+ TString* histTitle ;
+ for(Int_t k = 0; k < Flow::nSels; k++)
+ {
+  for(Int_t j = 0; j < Flow::nHars; j++) 
+  {
+   // Tpc plus
+   histTitle = new TString("Flow_Phi_Weight_TPCplus_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtPlus = new TH1D(histTitle->Data(),histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtPlus->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtPlus->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtPlus->SetYTitle("PhiWgt");
+   delete histTitle;
+   // Tpc minus
+   histTitle = new TString("Flow_Phi_Weight_TPCminus_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtMinus = new TH1D(histTitle->Data(),histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtMinus->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtMinus->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtMinus->SetYTitle("PhiWgt");
+   delete histTitle;
+   // Tpc cross
+   histTitle = new TString("Flow_Phi_Weight_TPCcross_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtAll = new TH1D(histTitle->Data(),histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtAll->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtAll->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiWgtAll->SetYTitle("PhiWgt");
+   delete histTitle;
+   // Tpc
+   histTitle = new TString("Flow_Phi_Weight_TPC_Sel");
+   *histTitle += k+1;
+   histTitle->Append("_Har");
+   *histTitle += j+1;
+   fHistFull[k].fHistFullHar[j].fHistPhiWgt = new TH1D(histTitle->Data(),histTitle->Data(), fPhiBins, fPhiMin, fPhiMax);
+   fHistFull[k].fHistFullHar[j].fHistPhiWgt->Sumw2();
+   fHistFull[k].fHistFullHar[j].fHistPhiWgt->SetXTitle("Azimuthal Angles (rad)");
+   fHistFull[k].fHistFullHar[j].fHistPhiWgt->SetYTitle("PhiWgt");
+   delete histTitle;
+
+   // Calculate PhiWgt
+   Double_t meanPlus  = fHistFull[k].fHistFullHar[j].fHistPhiPlus->Integral() / (Double_t)fPhiBins ;
+   Double_t meanMinus = fHistFull[k].fHistFullHar[j].fHistPhiMinus->Integral() / (Double_t)fPhiBins ;
+   Double_t meanCross = fHistFull[k].fHistFullHar[j].fHistPhiAll->Integral() / (Double_t)fPhiBins ;
+   Double_t meanTPC = fHistFull[k].fHistFullHar[j].fHistPhi->Integral() / (Double_t)fPhiBins ;
+
+   // Tpc
+   for(Int_t i=0;i<fPhiBins;i++) 
+   {
+    fHistFull[k].fHistFullHar[j].fHistPhiWgtPlus->SetBinContent(i+1,meanPlus);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgtPlus->SetBinError(i+1, 0.);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgtMinus->SetBinContent(i+1,meanMinus);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgtMinus->SetBinError(i+1, 0.);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgtAll->SetBinContent(i+1,meanCross);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgtAll->SetBinError(i+1, 0.);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgt->SetBinContent(i+1,meanTPC);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgt->SetBinError(i+1, 0.);
+   }
+   
+   if(meanTPC==0) { cout << " Sel." << k << " , Har." << j << " :  empty histogram ! " << endl ; }
+   else 
+   {
+    fHistFull[k].fHistFullHar[j].fHistPhiWgtPlus->Divide(fHistFull[k].fHistFullHar[j].fHistPhiPlus);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgtMinus->Divide(fHistFull[k].fHistFullHar[j].fHistPhiMinus);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgtAll->Divide(fHistFull[k].fHistFullHar[j].fHistPhiAll);
+    fHistFull[k].fHistFullHar[j].fHistPhiWgt->Divide(fHistFull[k].fHistFullHar[j].fHistPhi);
+   }
+
+   fPhiWgtHistList->AddLast(fHistFull[k].fHistFullHar[j].fHistPhiWgtPlus);
+   fPhiWgtHistList->AddLast(fHistFull[k].fHistFullHar[j].fHistPhiWgtMinus);
+   fPhiWgtHistList->AddLast(fHistFull[k].fHistFullHar[j].fHistPhiWgtAll);
+   fPhiWgtHistList->AddLast(fHistFull[k].fHistFullHar[j].fHistPhiWgt);
+  }
+ }
+
+ return kTRUE ;
+}
+//-----------------------------------------------------------------------
+void AliFlowWeighter::PrintBayesian(Int_t selN)  
+{
+ // Prints the normalized particle abundance of all events (selection selN).
+ // Call this at the end of the loop, just before Finish() .
+
+ if(selN>Flow::nSels) { selN = 0 ; } 
+ Char_t* names[Flow::nPid] = {"e","mu","pi","k","p","d"} ;
+ Double_t bayes = 0. ;
+ Double_t totCount = (fHistFull[selN].fHistBayPidMult)->GetSumOfWeights() ;
+ if(totCount) 
+ { 
+  cout << " Sel." << selN << " particles normalized abundance (tot. " << totCount << " tracks) : " ;
+  for(Int_t ii=0;ii<Flow::nPid;ii++)
+  {
+   bayes = (fHistFull[selN].fHistBayPidMult->GetBinContent(ii+1) / totCount) ; 
+   cout << bayes << "_" << names[ii] << " ; " ;
+  }
+ }
+ else {  cout << " Sel." << selN << " :  empty P.Id. histogram ! " << endl ; }
+ cout << endl ;
+ return ;
+}
+//-----------------------------------------------------------------------
+
+
+#endif
diff --git a/PWG2/FLOW/AliFlowWeighter.h b/PWG2/FLOW/AliFlowWeighter.h
new file mode 100644 (file)
index 0000000..da4c245
--- /dev/null
@@ -0,0 +1,116 @@
+//////////////////////////////////////////////////////////////////////
+//
+// $Id$
+//
+// Author: Emanuele Simili
+//
+//////////////////////////////////////////////////////////////////////
+//
+// Description: generates phi-weights and counts particle abundances .
+//
+//////////////////////////////////////////////////////////////////////
+
+#ifndef ALIFLOWEIGHTER_H
+#define ALIFLOWEIGHTER_H
+
+#include <TVector2.h>
+#include <TFile.h>
+#include "AliFlowConstants.h"
+
+class TH1F;
+class TH1D;
+class TOrdCollection;
+
+class AliFlowTrack;
+class AliFlowV0;
+class AliFlowEvent;
+class AliFlowSelection;
+class Flow;
+
+class AliFlowWeighter {
+
+
+ public:
+
+  AliFlowWeighter(const AliFlowSelection* flowSelect = 0);     // Constructor with selection object (default selection if no one given)
+  virtual  ~AliFlowWeighter();                                         // Default destructor (no actions)
+
+ // Steps of the flow analysis
+  Bool_t   Init() ;                                            // Books wgt histograms, opens output file
+  Bool_t   Finish() ;                                          // Saves histograms, closes stuff
+
+ // Analysis of 1 event (can be called from outside)
+  Bool_t   WeightEvent(AliFlowEvent* fFlowEvent = 0) ;                 // Runs on the event
+
+ // Output 
+  void    SetWgtFileName(TString name)                         { fWgtFileName = name ; }                                  // Sets output file name
+  void    SetWgtFile(TFile* file)                              { fWgtFile = file ; fWgtFileName = fWgtFile->GetName() ; }  // Sets output file
+  TString  GetWgtFileName() const                              { return fWgtFileName ; }
+
+  void            PrintBayesian(Int_t selN = 0) ;                      // Prints normalized particle abundance (selN)
+
+
+ protected:
+ // Internal methods to fill the histogram
+  void     TracksLoop(TObjArray* fFlowTracks) ;                // Fills Phi and PId histograms
+  Bool_t   Weightening() ;                                     // Calculates weights and fills PhiWgt histograms
+
+
+ private:
+
+ // enumerators etc.                       
+  Int_t            fEventNumber ;                              //! progressive enumeration of AliFlowEvents
+  Int_t            fTrackNumber ;                              //! progressive enumeration of AliFlowTracks
+  Int_t            fNumberOfV0s ;                              //! total number of V0s in the current event
+  Int_t           fNumberOfTracks ;                            //! total number of tracks in the current event
+
+  Int_t            fPhiBins ;     
+  Float_t         fPhiMin ;
+  Float_t         fPhiMax ; 
+
+ // Internal pointers
+  AliFlowEvent*     fFlowEvent ;                               //! pointer to AliFlowEvent
+  AliFlowTrack*     fFlowTrack ;                               //! pointer to AliFlowTrack
+  AliFlowSelection* fFlowSelect ;                              //  selection object
+  TObjArray*        fFlowTracks ;                              //! pointer to the TrackCollection
+  //Float_t           fVertex[3] ;                             //! Event's Vertex position 
+
+ // PhiWgt File
+  TFile*           fWgtFile ;                                  //! phi weight file 
+  TString          fWgtFileName ;                              //! Wgt File Name (histograms for weight)
+
+ // Histograms
+  TOrdCollection*   fPhiWgtHistList ;                          //! Weights:  histogram list
+  struct fHistFullHars 
+  {
+    TH1D*       fHistPhiPlus;
+    TH1D*       fHistPhiMinus;
+    TH1D*       fHistPhiAll;
+    TH1D*       fHistPhi;
+    TH1D*       fHistPhiWgtPlus;
+    TH1D*       fHistPhiWgtMinus;
+    TH1D*       fHistPhiWgtAll;
+    TH1D*       fHistPhiWgt;
+    TH1D*       fHistPhiFlatPlus;
+    TH1D*       fHistPhiFlatMinus;
+    TH1D*       fHistPhiFlatAll;
+    TH1D*       fHistPhiFlat;
+  };
+  
+  struct fHistFulls;   
+  friend struct fHistFulls;
+  struct fHistFulls 
+  {
+   TH1F*       fHistBayPidMult;
+   struct fHistFullHars fHistFullHar[Flow::nHars];             // wgt, evts, trks, v0s (as defined above)
+  };
+  struct fHistFulls fHistFull[Flow::nSels];                     //!
+
+  ClassDef(AliFlowWeighter,0)                                  // macro for rootcint
+};
+
+#endif
+
+
+
diff --git a/PWG2/FLOW/AliSelectorFlow.cxx b/PWG2/FLOW/AliSelectorFlow.cxx
deleted file mode 100644 (file)
index 0cf232e..0000000
+++ /dev/null
@@ -1,779 +0,0 @@
-/* $Id$ */
-/* derived from AliSelector.cxx,v 1.17 2006/08/31 jgrosseo Exp $ */
-
-// The class definition in esdV0.h has been generated automatically
-// by the ROOT utility TTree::MakeSelector(). This class is derived
-// from the ROOT class TSelector. For more information on the TSelector
-// framework see $ROOTSYS/README/README.SELECTOR or the ROOT User Manual.
-
-// The following methods are defined in this file:
-//    Begin():        called everytime a loop on the tree starts,
-//                    a convenient place to create your histograms.
-//    SlaveBegin():   called after Begin(), when on PROOF called only on the
-//                    slave servers.
-//    Process():      called for each event, in this function you decide what
-//                    to read and fill your histograms.
-//    SlaveTerminate: called at the end of the loop on the tree, when on PROOF
-//                    called only on the slave servers.
-//    Terminate():    called at the end of the loop on the tree,
-//                    a convenient place to draw/fit your histograms.
-//
-// To use this file, try the following session on your Tree T:
-//
-// Root > T->Process("AliSelector.C")
-// Root > T->Process("AliSelector.C","some options")
-// Root > T->Process("AliSelector.C+")
-//
-
-#include "AliSelectorFlow.h"
-
-#include <TStyle.h>
-#include <TSystem.h>
-#include <TCanvas.h>
-#include <TRegexp.h>
-#include <TTime.h>
-#include <TFriendElement.h>
-#include <TTree.h>
-#include <TChain.h>
-#include <TFile.h>
-#include <TTimeStamp.h>
-#include <TMath.h>
-
-#include "/localstore/alice/alice_new/AliRoot_Head/include/AliLog.h"      //  
-#include "/localstore/alice/alice_new/AliRoot_Head/include/AliESD.h"      //  
-#include "/localstore/alice/alice_new/AliRoot_Head/include/AliESDtrack.h" //  
-#include "/localstore/alice/alice_new/AliRoot_Head/include/AliESDv0.h"    //  
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <iostream>
-using namespace std; //required for resolving the 'cout' symbol
-
-#include "AliFlowEvent.h"
-#include "AliFlowTrack.h"
-#include "AliFlowV0.h"
-#include "AliFlowConstants.h"
-
-ClassImp(AliSelectorFlow)
-
-//-----------------------------------------------------------------------
-
-AliSelectorFlow::AliSelectorFlow() :
-  TSelector(),
-  fTree(0),
-  fESD(0),
-  fCountFiles(0),
-  fKineFile(0)
-{
-  //
-  // Constructor. Initialization of pointers
-  //
-  
-  fFlowEventFileName = "flowEvtS.root" ;    
-
-  fEtrkLow = 0.01  ;
-  fEtrkHig = 100. ;
-  fHitsTrk = 1 ;
-}
-
-//-----------------------------------------------------------------------
-
-AliSelectorFlow::~AliSelectorFlow()
-{
-  //
-  // Destructor
-  //
-
- if (fTree) { fTree->ResetBranchAddresses() ; }
-
- if (fESD)
- {
-   delete fESD;
-   fESD = 0;
- }
-}
-
-//-----------------------------------------------------------------------
-
-void AliSelectorFlow::CheckOptions()
-{
-  // checks the option string for the debug flag
-
-  AliLog::SetClassDebugLevel(ClassName(), AliLog::kInfo);
-
-  TString option = GetOption();
-
-  if (option.Contains("moredebug"))
-  {
-    printf("Enabling verbose debug mode for %s\n", ClassName());
-    AliLog::SetClassDebugLevel(ClassName(), AliLog::kDebug+1);
-    AliInfo(Form("Called with option %s.", option.Data()));
-  }
-  else if (option.Contains("debug"))
-  {
-    printf("Enabling debug mode for %s\n", ClassName());
-    AliLog::SetClassDebugLevel(ClassName(), AliLog::kDebug);
-    AliInfo(Form("Called with option %s.", option.Data()));
-  }
-}
-
-//-----------------------------------------------------------------------
-
-void AliSelectorFlow::Begin(TTree*)
-{
-  // The Begin() function is called at the start of the query.
-  // When running with PROOF Begin() is only called on the client.
-  // The tree argument is deprecated (on PROOF 0 is passed).
-  
-  cout << " HERE I begin !!! " << endl ; cout << endl ;
-
-  CheckOptions();
-
-  AliDebug(AliLog::kDebug, "============BEGIN===========");
-
- // Opens OutputFile
- pFlowfile = new TFile(fFlowEventFileName.Data(),"RECREATE") ;
- pFlowfile->cd() ; 
- cout << " OUTput File Name : " << fFlowEventFileName.Data() << endl ; 
-  
- // Resets counters
- fGoodTracks = 0  ;  
- fGoodV0s    = 0  ;    
- fGoodTracksEta = 0  ;
- fPosiTracks = 0  ;  
- fNegaTracks = 0  ;  
- for(Int_t bb=0;bb<5;bb++) { fBayesianAll[bb] = 0 ; } ;
- fSumAll = 0 ;
- fCutEvts = 0  ;
- fCutTrks = 0  ;
- fCutV0s  = 0  ; 
- fLoopV0 = kFALSE ;     // kTRUE ;     // something is wrong with them ... too many!?
- fDoNothing = kFALSE ;  // kFALSE ;
- fOnFlyAnalysis = kFALSE ;  
-}
-
-//-----------------------------------------------------------------------
-
-void AliSelectorFlow::SlaveBegin(TTree* tree)
-{
-  // The SlaveBegin() function is called after the Begin() function.
-  // When running with PROOF SlaveBegin() is called on each slave server.
-  // The tree argument is deprecated (on PROOF 0 is passed).
-
-  CheckOptions();
-
-  AliDebug(AliLog::kDebug, "=======SLAVEBEGIN========");
-  AliDebug(AliLog::kDebug, Form("Hostname: %s", gSystem->HostName()));
-  AliDebug(AliLog::kDebug, Form("Time: %s", gSystem->Now().AsString()));
-
-  if (tree != 0) { Init(tree) ; }
-}
-
-//-----------------------------------------------------------------------
-
-void AliSelectorFlow::Init(TTree *tree)
-{
-  // The Init() function is called when the selector needs to initialize
-  // a new tree or chain. Typically here the branch addresses of the tree
-  // will be set. It is normaly not necessary to make changes to the
-  // generated code, but the routine can be extended by the user if needed.
-  // Init() will be called many times when running with PROOF.
-
-  AliDebug(AliLog::kDebug, "=========Init==========");
-
-  fTree = tree;
-
-  if (fTree == 0)
-  {
-   AliDebug(AliLog::kError, "ERROR: tree argument is 0.");
-   return;
-  }
-
-  // Set branch address
-  fTree->SetBranchAddress("ESD", &fESD);
-  if (fESD != 0) { AliDebug(AliLog::kInfo, "INFO: Found ESD branch in chain.") ; }
-}
-
-//-----------------------------------------------------------------------
-
-Bool_t AliSelectorFlow::Notify()
-{
-  // The Notify() function is called when a new file is opened. This
-  // can be either for a new TTree in a TChain or when when a new TTree
-  // is started when using PROOF. Typically here the branch pointers
-  // will be retrieved. It is normaly not necessary to make changes
-  // to the generated code, but the routine can be extended by the
-  // user if needed.
-
-  AliDebug(AliLog::kDebug, "=========NOTIFY==========");
-  AliDebug(AliLog::kDebug, Form("Hostname: %s", gSystem->HostName()));
-  AliDebug(AliLog::kDebug, Form("Time: %s", TTimeStamp(time(0)).AsString()));
-
-  ++fCountFiles;
-  if (fTree)
-  {
-    TFile *f = fTree->GetCurrentFile();
-    AliDebug(AliLog::kInfo, Form("Processing %d. file %s", fCountFiles, f->GetName()));
-  }
-  else
-  {
-    AliDebug(AliLog::kError, "fTree not available");
-  }
-
-  DeleteKinematicsFile();
-
-  return kTRUE;
-}
-
-//-----------------------------------------------------------------------
-
-Bool_t AliSelectorFlow::Process(Long64_t entry)
-{
-  // The Process() function is called for each entry in the tree (or possibly
-  // keyed object in the case of PROOF) to be processed. The entry argument
-  // specifies which entry in the currently loaded tree is to be processed.
-  // It can be passed to either TTree::GetEntry() or TBranch::GetEntry()
-  // to read either all or the required parts of the data. When processing
-  // keyed objects with PROOF, the object is already loaded and is available
-  // via the fObject pointer.
-  //
-  // This function should contain the "body" of the analysis. It can contain
-  // simple or elaborate selection criteria, run algorithms on the data
-  // of the event and typically fill histograms.
-
-  // WARNING when a selector is used with a TChain, you must use
-  //  the pointer to the current TTree to call GetEntry(entry).
-  //  The entry is always the local entry number in the current tree.
-  //  Assuming that fTree is the pointer to the TChain being processed,
-  //  use fTree->GetTree()->GetEntry(entry).
-
-  AliDebug(AliLog::kDebug, Form("=========PROCESS========== Entry %lld", entry));
-
-  if (!fTree)
-  {
-    AliDebug(AliLog::kError, "ERROR: fTree is 0.");
-    return kFALSE;
-  }
-
-  fEventNumber = entry ;
-  fTree->GetTree()->GetEntry(fEventNumber) ;
-
-  if(fESD) { AliDebug(AliLog::kDebug, Form("ESD: We have %d tracks.", fESD->GetNumberOfTracks())); }
-  // cout << " event !!! " << entry << endl ;
-
-  fRunID = fESD->GetRunNumber() ;
-  fEventNumber = fESD->GetEventNumber() ;
-  fNumberOfTracks = fESD->GetNumberOfTracks() ;
-  fNumberOfV0s = fESD->GetNumberOfV0s() ;
-
-  cout << " *evt n. " << fEventNumber << " (run " << fRunID << ") " << endl ;
-  cout << "  tracks: " << fNumberOfTracks << " ,   v0s " << fNumberOfV0s << endl ;
-
- // Dummy Loop (for testing)
-  if(fDoNothing) 
-  { 
-   pFlowEvent = new AliFlowEvent() ;  
-   pFlowEvent->SetRunID(fRunID) ;              
-   pFlowEvent->SetEventID(fEventNumber) ;      
-   pFlowEvent->SetOrigMult((UInt_t)fNumberOfTracks) ;
-   return pFlowEvent ; 
-  }
-
- // Evt cuts (dummy) :
-  // if(pFlowCuts->CheckEvent(fESD)) { fCutEvts++ ; ...  }
-
- // Instantiate a new AliFlowEvent
-  pFlowEvent = FillFlowEvent(fESD) ;
-
-   if(!pFlowEvent) 
-   { 
-    cout << "!something bad occurred" << endl ;
-    // fCutEvts++ ; continue ; 
-    return kFALSE ;
-   }
-   else {  cout << "!event filled " << endl ; }
-
-  cout << " save event ... " << endl ;
-
-  TString strID = "" ; strID += entry ; 
-  pFlowfile->cd() ; 
-  pFlowEvent->Write(strID.Data()) ;
-
-  cout << " saved  " << strID.Data() << "                # thanks gesus ! #       " << endl ;
-  cout << endl ;  
-
-  if(fOnFlyAnalysis)  { cout << "seeeeeeeeeeeeeeeeeeeeeee :D  " << endl ;} 
-   
-  return kTRUE;
-}
-
-//-----------------------------------------------------------------------
-
-void AliSelectorFlow::SlaveTerminate()
-{
-  // The SlaveTerminate() function is called after all entries or objects
-  // have been processed. When running with PROOF SlaveTerminate() is called
-  // on each slave server.
-
-  AliDebug(AliLog::kDebug, "=======SLAVETERMINATE=======");
-
-  DeleteKinematicsFile();
-}
-
-//-----------------------------------------------------------------------
-
-void AliSelectorFlow::Terminate()
-{
-  // The Terminate() function is the last function to be called during
-  // a query. It always runs on the client, it can be used to present
-  // the results graphically or save the results to file.
-
-  AliDebug(AliLog::kDebug, "=========TERMINATE==========");
-
- cout << " file closed . " << endl ;
- pFlowfile->Close() ; 
-}
-
-//-----------------------------------------------------------------------
-
-TTree* AliSelectorFlow::GetKinematics()
-{
-  // Returns kinematics tree corresponding to current ESD active in fTree
-  // Loads the kinematics from the kinematics file, the file is identified by replacing "AliESDs" to
-  // "Kinematics" in the file path of the ESD file. This is a hack, to be changed!
-
-  if (!fKineFile)
-  {
-    if(!fTree->GetCurrentFile()) { return 0 ; }
-
-    TString fileName(fTree->GetCurrentFile()->GetName());
-    fileName.ReplaceAll("AliESDs", "Kinematics");
-
-    // temporary workaround for PROOF bug #18505
-    fileName.ReplaceAll("#Kinematics.root#Kinematics.root", "#Kinematics.root");
-
-    AliDebug(AliLog::kInfo, Form("Opening %s", fileName.Data()));
-
-    fKineFile = TFile::Open(fileName);
-    if(!fKineFile) { return 0 ; }
-  }
-
-  return dynamic_cast<TTree*> (fKineFile->Get(Form("Event%d/TreeK", fTree->GetTree()->GetReadEntry())));
-}
-
-//-----------------------------------------------------------------------
-
-void AliSelectorFlow::DeleteKinematicsFile()
-{
-  //
-  // Closes the kinematics file and deletes the pointer.
-  //
-
-  if (fKineFile)
-  {
-    fKineFile->Close();
-    delete fKineFile;
-    fKineFile = 0;
-  }
-}
-
-
-//----------------------------------------------------------------------
-//*** FLOW SPECIFIC METHODS (to fill the flowEvents) ***
-//----------------------------------------------------------------------
-
-AliFlowEvent* AliSelectorFlow::FillFlowEvent(AliESD* fESD)
-{
- // Fills the AliFlowEvent . 
- // Calls the methods to fills track & v0 arrays . 
- // Re-Shuffles the tracks (if fShuffle) . 
-
- fEventNumber = fESD->GetEventNumber() ; 
- fNumberOfTracks = fESD->GetNumberOfTracks() ; 
- fNumberOfV0s = fESD->GetNumberOfV0s() ; 
- fRunID = fESD->GetRunNumber() ;
-
- fTrackNumber = 0 ;
- fV0Number = 0 ;
-
- cout << "FillFlowEvent()   " << fEventNumber << "   (run " << fRunID << ") " << endl ; 
-   
- // Instantiate a new AliFlowEvent
- pFlowEvent = new AliFlowEvent() ; if(!pFlowEvent) { return 0 ; }
-
- // Event id 
- pFlowEvent->SetRunID(fRunID) ;                
- pFlowEvent->SetEventID(fEventNumber) ;        
- pFlowEvent->SetOrigMult((UInt_t)fNumberOfTracks) ;
-                                               
- // Run information (fixed - ???)
- fMagField = fESD->GetMagneticField() ;
- pFlowEvent->SetMagneticField(fMagField) ;     
- pFlowEvent->SetCenterOfMassEnergy(5500) ;     
- pFlowEvent->SetBeamMassNumberEast(208) ;      
- pFlowEvent->SetBeamMassNumberWest(208) ;      
-
- // Trigger information (now is: ULon64_t - some trigger mask)
- pFlowEvent->SetL0TriggerWord((Int_t)fESD->GetTriggerMask()); 
- // Get primary vertex position
- AliESDVertex* pVertex = (AliESDVertex*)fESD->GetVertex() ;
- Double_t position[3] ; 
- pVertex->GetXYZ(position) ;
- pFlowEvent->SetVertexPos((Float_t)position[0],(Float_t)position[1],(Float_t)position[2]) ; 
-
- // Zero Degree Calorimeter information
- Int_t zdcp = fESD->GetZDCParticipants() ; 
- Float_t zdce[3] ; 
- zdce[0] = fESD->GetZDCN1Energy() + fESD->GetZDCN2Energy(); 
- zdce[1] = fESD->GetZDCP1Energy() + fESD->GetZDCP2Energy() ; 
- zdce[2] = fESD->GetZDCEMEnergy() ;
- pFlowEvent->SetZDCpart(zdcp);                         
- pFlowEvent->SetZDCenergy(zdce[0],zdce[1],zdce[2]);    
-  cout << "  looping tracks ... (real)  " << fNumberOfTracks << endl ;
-
-  Int_t badTrks = 0 ;
-  for(Int_t itr=0;itr<fNumberOfTracks;itr++)   // Loop over tracks
-  {
-   fTrackNumber = itr ;
-   fTrack = fESD->GetTrack(fTrackNumber) ;
-   
-  // Trk cuts (temporary) :
-   Int_t idXt[180] ;  // used for Cluster Map ( see AliESDtrack::GetTPCclusters() )
-   Int_t   nHits = fTrack->GetTPCclusters(idXt) ;
-   Float_t E    = fTrack->GetP() ; 
-   if((nHits<fHitsTrk) || ((E<fEtrkLow) || (E>fEtrkHig)))  { fCutTrks++ ; continue ; }
-   // -or-
-   // if(pFlowCuts->CheckTrack(pTrack)) { fCutTracks++ ; ...  }  // Apply track Cuts
-
-  // Instantiate a new AliFlowTrack and fills it
-   pFlowTrack = FillFlowTrack(fTrack) ;   
-   if(!pFlowTrack) { badTrks++ ; continue ; }
-
-   pFlowEvent->TrackCollection()->Add(pFlowTrack) ;   
-   fGoodTracks++ ;                                   
-  }
-  cout << " " << fCutTrks+badTrks << " tracks from event n." << fEventNumber << " have been trown away . " << endl ; 
-
-  if(fLoopV0)
-  {
-   cout << "  looping v0s ...  " << fNumberOfV0s << endl ;
-
-   Int_t badV0s = 0 ;
-   for(Int_t v0n=0;v0n<fNumberOfV0s;v0n++)   // Loop over v0 in AliESD
-   {
-    fV0Number = v0n ;
-    fV0 = fESD->GetV0(fV0Number) ;                     
-
-   // Instantiate a new AliFlowV0 and fills it
-    pFlowV0 =  FillFlowV0(fV0) ;
-    if(!pFlowV0) {  badV0s++ ; continue ; }
-    
-    pFlowEvent->V0Collection()->Add(pFlowV0) ;
-    fGoodV0s++ ;                       
-   }
-   cout << " " << fCutV0s+badV0s << " v0s from event n." << fEventNumber << " have been trown away . " << endl ; 
-  }
- // Evt setting stuff
- pFlowEvent->SetCentrality();  
-                               
- return pFlowEvent ;
-}
-
-//----------------------------------------------------------------------
-
-AliFlowTrack* AliSelectorFlow::FillFlowTrack(AliESDtrack* fTrack)
-{
-
- // cout << "FillFlowTrack() " << endl ; 
- // fTrack->Dump() ;
-
- TString ntra = "" ; ntra += fTrackNumber ;
- pFlowTrack = new AliFlowTrack(ntra.Data()) ;  
-
- // ESD particle label (link: KineTree-ESD)
- Int_t label = TMath::Abs(fTrack->GetLabel());
- pFlowTrack->SetLabel(label) ;                         
-
- //cout  << "      - track " << fTrackNumber << " ... pTrack->GetLabel() = " << label << endl ;
-
- // signed DCA from ESDtrack
- Float_t xy = 0 ; Float_t z = 0 ; 
- fTrack->GetImpactParameters(xy,z) ;                           // this returns (0,0) !!!
-// if(xy == 0 && z == 0)                                       // if 0 get it from the ITS method
-// {
-//   cout << " ------------- no dca !!!" << endl ; 
-//   AliITStrackV2 *itsTrack = 0 ;     
-//   UInt_t status = fTrack->GetStatus();
-//   if((status&AliESDtrack::kITSrefit)==0) 
-//   { 
-//    xy = 0 ;         
-//   }
-//   else                               
-//   {
-//    itsTrack = new AliITStrackV2(*fTrack) ;
-//    if(itsTrack) { xy = itsTrack->GetD() ; }                 // signed DCA from ITStrack
-//    delete itsTrack ;
-//   }  
-// }
- pFlowTrack->SetDcaSigned(xy,z) ;                  
-
- // UnConstrained (global) first
- Double_t gD[3] ;                              
- fTrack->GetPxPyPz(gD) ;                       
- // -
- Float_t phiGl = (Float_t)Phi(gD) ;  
- if(phiGl<0) { phiGl += 2*TMath::Pi() ; }
- pFlowTrack->SetPhiGlobal(phiGl) ;             
- Float_t ptGl = (Float_t)Pt(gD) ; 
- pFlowTrack->SetPtGlobal(ptGl) ;               
- Float_t etaGl = (Float_t)Eta(gD) ; 
- pFlowTrack->SetEtaGlobal(etaGl) ;             
-
- // Constrained (NEW)
- Double_t cD[3] ;
- Double_t par1 ; Double_t par2 ;  Double_t par3[3] ;
- if(fTrack->GetConstrainedExternalParameters(par1,par2,par3))
- {
-  fTrack->GetConstrainedPxPyPz(cD) ;     
- }
- else { for(Int_t iii=0;iii<3;iii++) { cD[iii] =0 ; } }
-
- if(Norm(cD)!=0.)   // ConstrainedPxPyPz != 0 if ConstrainedChi2 < something ...
- {                                                     
-  Float_t phi = (Float_t)Phi(cD) ; 
-  if(phi<0) { phi += 2*TMath::Pi() ; }
-  pFlowTrack->SetPhi(phi) ;                            
-  Float_t pt = (Float_t)Pt(cD) ; 
-  pFlowTrack->SetPt(pt) ;                              
-  Float_t eta = (Float_t)Eta(cD) ; 
-  pFlowTrack->SetEta(eta) ;                            
-  // number of constrainable tracks with |eta| < Flow::fEtaGood (0.9)
-  if(TMath::Abs(eta) < Flow::fEtaGood)  { fGoodTracksEta++ ; }
- }
- else  // in case Constriction impossible for track, fill the UnConstrained (global)
- {
-  fUnconstrained++ ;   
-  pFlowTrack->SetPhi(0.) ;
-  pFlowTrack->SetPt(0.) ;   
-  pFlowTrack->SetEta(0.) ; 
- }          
-
- // positive - negative tracks
- Int_t trk_sign = (Int_t)fTrack->GetSign() ; 
- pFlowTrack->SetCharge(trk_sign) ;             
- if(trk_sign>0)        { fPosiTracks++ ; }
- else if(trk_sign<0)   { fNegaTracks++ ; }
- else                  { return 0 ; }
-
- // Tracking parameters (fit , TPC , ITS , dE/dx)
- pFlowTrack->SetChi2(fTrack->GetConstrainedChi2()) ;           
- pFlowTrack->SetTrackLength(fTrack->GetIntegratedLength()) ;   
- // -
- Int_t idXt[180] ; // used for Cluster Map ( see AliESDtrack::GetTPCclusters() )    // old:    Int
- Int_t idX[6] ;    // used for Cluster Map ( see AliESDtrack::GetITSclusters() )    // old:    UInt
- Int_t idxr[130] ; // used for Cluster Map ( see AliESDtrack::GetTRDclusters() )    // old:    UInt
- Int_t nClus = 0 ;     
- Int_t fNFound = 0 ;                                                   // *!* fNFoundable (in AliTPCtrack) ... added by M.Ianov 
- Double_t pVecAt[3] ; Bool_t boh ; Float_t pAt = (Float_t)Norm(gD) ;   // to get p at each det.
- // -
- boh = fTrack->GetInnerParam()->GetPxPyPzAt(Flow::fTPCx, fMagField, pVecAt) ;
- pAt = (Float_t)Norm(pVecAt) ;
- nClus = fTrack->GetTPCclusters(idXt) ;
- fNFound = fTrack->GetTPCNclsF() ;  // was 160                 // *!* fNFoundable (in AliTPCtrack) ... added by M.Ianov 
- pFlowTrack->SetMaxPtsTPC(fNFound) ;                           
- pFlowTrack->SetFitPtsTPC(nClus) ;                             
- pFlowTrack->SetDedxTPC(fTrack->GetTPCsignal()) ;              
- pFlowTrack->SetChi2TPC((Float_t)(fTrack->GetTPCchi2())) ;     
- pFlowTrack->SetPatTPC(pAt) ;                                  
- // -
- boh = fTrack->GetInnerParam()->GetPxPyPzAt(Flow::fITSx, fMagField, pVecAt) ;
- pAt = (Float_t)Norm(pVecAt) ;
- nClus = fTrack->GetITSclusters(idX) ;
- fNFound = 6 ;
- pFlowTrack->SetMaxPtsITS(fNFound) ;                           
- pFlowTrack->SetFitPtsITS(nClus) ;                             
- pFlowTrack->SetDedxITS(fTrack->GetITSsignal()) ;              
- pFlowTrack->SetChi2ITS((Float_t)(fTrack->GetITSchi2())) ;     
- pFlowTrack->SetPatITS(pAt) ;                                  
- // -
- boh = fTrack->GetInnerParam()->GetPxPyPzAt(Flow::fITSx, fMagField, pVecAt) ;
- pAt = (Float_t)Norm(pVecAt) ;
- fNFound = fTrack->GetTRDncls() ;  // was 130
- nClus = fTrack->GetTRDclusters(idxr) ;
- pFlowTrack->SetMaxPtsTRD(fNFound) ;                           
- pFlowTrack->SetNhitsTRD(nClus) ;                              
- pFlowTrack->SetSigTRD(fTrack->GetTRDsignal()) ;               
- pFlowTrack->SetChi2TRD((Float_t)fTrack->GetTRDchi2()) ;       
- pFlowTrack->SetPatTRD(pAt) ;                                  
- // -
- boh = fTrack->GetInnerParam()->GetPxPyPzAt(Flow::fITSx, fMagField, pVecAt) ;
- pAt = (Float_t)Norm(pVecAt) ;
- fNFound = 0 ; if(fTrack->GetTOFCalChannel() > 0) { fNFound = 1 ; }
- nClus = fTrack->GetTOFcluster() ;
- pFlowTrack->SetMaxPtsTOF(fNFound) ;                           
- pFlowTrack->SetNhitsTOF(nClus) ;                              
- pFlowTrack->SetTofTOF(fTrack->GetTOFsignal()) ;               
- pFlowTrack->SetChi2TOF(fTrack->GetTOFchi2()) ;                
- pFlowTrack->SetPatTOF(pAt) ;                                  
- // -
- Double_t rIn[3]  ; rIn[0] = 0.  ;  rIn[1] = 0. ;  rIn[2] = 0. ;
- Double_t rOut[3] ; rOut[0] = 0. ; rOut[1] = 0. ; rOut[2] = 0. ;
- // -
- fTrack->GetInnerXYZ(rIn) ;                                    
- pFlowTrack->SetZFirstPoint(rIn[2]) ; 
- //fTrack->GetXYZAt(Flow::fTPCx,fMagField,rOut) ;              
- fTrack->GetOuterXYZ(rOut) ;                                   
- pFlowTrack->SetZLastPoint(rOut[2]) ; 
- // ESD-P.Id. = 5-vector of Best detectors probabilities for [e , mu , pi , K , p] 
- Double_t trkPid[5] ; fTrack->GetESDpid(trkPid) ;              
- Double_t trkPid6[Flow::nPid] ; 
- for(Int_t bb=0;bb<5;bb++) { trkPid6[bb] = trkPid[bb] ; } 
- trkPid6[5] = 0. ;                                             // *!* implement P.Id. for Deuterim
-
- // Bayesian P.Id. method (weighted probabilities for [e , mu , pi , K , p , d])
- Double_t Bsum = 0 ; 
- Double_t bayePid[Flow::nPid] ;    // normalized P.id
- Double_t storedPid[Flow::nPid] ;  // stored P.id
- for(Int_t nB=0;nB<Flow::nPid;nB++)  { Bsum += trkPid6[nB]*Flow::fBayesian[nB] ; }
- if(Bsum)
- {
-  for(Int_t nB=0;nB<Flow::nPid;nB++) 
-  { 
-   bayePid[nB] = trkPid6[nB]*Flow::fBayesian[nB] / Bsum ; 
-   storedPid[nB] = trkPid6[nB] ; 
-  }
- }
- else { cout << " ERROR - Empty Bayesian Vector !!! " << endl ; }
- pFlowTrack->SetElectronPositronProb(storedPid[0]);               
- pFlowTrack->SetMuonPlusMinusProb(storedPid[1]);
- pFlowTrack->SetPionPlusMinusProb(storedPid[2]);
- pFlowTrack->SetKaonPlusMinusProb(storedPid[3]);
- pFlowTrack->SetProtonPbarProb(storedPid[4]);
- pFlowTrack->SetDeuteriumAntiDeuteriumProb(storedPid[5]);      // *!* implement P.Id. for Deuterim
-
- // P.id. label given via the weighted prob.
- const Int_t code[]   =  {11,13,211,321,2212,10010020} ;
- Int_t kkk = 2 ;                       // if No id. -> then is a Pi
- Float_t pid_max = bayePid[2] ;        // (if all equal, Pi probability get's the advantage to be the first)
- for(Int_t iii=0; iii<5; iii++) 
- {
-  if(bayePid[iii]>pid_max) { kkk = iii ; pid_max = bayePid[iii] ; }  // !!! Bayesian as well !!!
- }
- fBayesianAll[kkk]++ ; fSumAll++ ;     // goes on filling the vector of observed abundance 
- //-
- Int_t pdg_code = trk_sign*code[kkk] ;
- pFlowTrack->SetMostLikelihoodPID(pdg_code);
- return pFlowTrack ; 
-}
-
-//-----------------------------------------------------------------------
-
-AliFlowV0* AliSelectorFlow::FillFlowV0(AliESDv0* fV0)
-{
- // Fills the AliFlowV0 .
- // Sets the index of the 2 daughter tracks in the track array . 
-  
- // cout << "FillFlowV0()" << endl ; 
- // fV0->Dump() ;
-
- TString ntra = "" ; ntra += fV0Number ;
- pFlowV0 = new AliFlowV0(ntra.Data()) ;
-
- Double_t Pxyz[3] ;            // reconstructed momentum of the V0
- fV0->GetPxPyPz(Pxyz[0],Pxyz[1],Pxyz[2]) ;
-
- Float_t phi = (Float_t)Phi(Pxyz) ; if(phi<0) { phi += 2*TMath::Pi() ; }
- pFlowV0->SetPhi(phi) ;                
- Float_t pt = (Float_t)Pt(Pxyz) ; 
- pFlowV0->SetPt(pt) ;          
- Float_t eta = (Float_t)Eta(Pxyz) ; 
- pFlowV0->SetEta(eta) ;        
-
- Double_t xyz[3] ;             // reconstructed position of the V0 
- fV0->GetXYZ(xyz[0],xyz[1],xyz[2]) ;           
- pFlowV0->SetCrossPoint(xyz[0],xyz[1],xyz[2]) ;
-
- // V0's impact parameter & error
- pFlowV0->SetDca((Float_t)fV0->GetD()) ;       
- //pFlowV0->SetSigma(1.) ;                     
-
- // chi2 of the V0 
- //pFlowV0->SetChi2((Float_t)fV0->GetChi2()) ;   // AliRoot v4-04-Release
- //pFlowV0->SetChi2((Float_t)fV0->GetChi2V0()) ;  // AliRoot v4-04-Release (but a different one!)      
- // ...when they'll stop annoying me with stupid name changes (see above) I may enable these lines
- pFlowV0->SetChi2(1.) ;
-
- // P.id. 
- Int_t pdg_code = fV0->GetPdgCode() ;
- pFlowV0->SetMostLikelihoodPID(pdg_code);      
-
- // mass 
- pFlowV0->SetVmass((Float_t)fV0->GetEffMass()) ; 
- //Int_t pN = fV0->GetPindex() ;
- //Int_t nN = fV0->GetNindex() ;
- AliFlowTrack* pos = 0 ;
- AliFlowTrack* neg = 0 ;
- //if(fMovedTr[pN]>=0) { pos = (AliFlowTrack*)pFlowEvent->TrackCollection()->At(fMovedTr[pN]) ; }
- //if(fMovedTr[nN]>=0) { neg = (AliFlowTrack*)pFlowEvent->TrackCollection()->At(fMovedTr[nN]) ; }
- pFlowV0->SetDaughters(pos,neg) ;
-
- return pFlowV0 ;
-}
-
-//----------------------------------------------------------------------
-//*** USEFULL METHODS (to use 3-array) ***
-//-----------------------------------------------------------------------
-
-Double_t AliSelectorFlow::Norm(Double_t nu[3])
-{ 
- // returns the norm of a double[3] 
-
- Double_t norm2 = nu[0]*nu[0] + nu[1]*nu[1] + nu[2]*nu[2] ;
- return TMath::Sqrt(norm2) ; 
-}
-
-//-----------------------------------------------------------------------
-
-Double_t AliSelectorFlow::Phi(Double_t nu[3])
-{
- // returns the azimuthal angle of a double[3] 
-
- if(nu[0]==0 && nu[1]==0) { return 0. ; }
- else                    { return TMath::ATan2(nu[1],nu[0]) ; }
-}
-
-//-----------------------------------------------------------------------
-
-Double_t AliSelectorFlow::Pt(Double_t nu[3])
-{
- // returns the transvers momentum of a double[3] 
-
- Double_t trans = nu[0]*nu[0] + nu[1]*nu[1] ;
- return TMath::Sqrt(trans) ; 
-}
-
-//-----------------------------------------------------------------------
-
-Double_t AliSelectorFlow::Eta(Double_t nu[3])
-{
- // returns the PseudoRapidity of a double[3] 
- // if transvers momentum = 0 --> returns +/- 1.000
-
- Double_t m = Norm(nu) ;
- if(nu[0]!=0 || nu[1]!=0) { return 0.5*TMath::Log((m+nu[2])/(m-nu[2])) ; }
- else                    { return TMath::Sign((Double_t)1000.,nu[2]) ; }
-}
-
-//-----------------------------------------------------------------------
-
-
-
diff --git a/PWG2/FLOW/AliSelectorFlow.h b/PWG2/FLOW/AliSelectorFlow.h
deleted file mode 100644 (file)
index 933f5a3..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/* $Id$ */
-/* derived from AliSelector.h,v 1.10 2006/08/15 jgrosseo Exp $ */
-
-// This selector is only dependent on the ESD library, if you need the whole of AliROOT use AliSelectorRL
-#ifndef ALISELECTORFLOW_H
-#define ALISELECTORFLOW_H
-
-// ANSI things
-#include <stdio.h>
-#include <stdlib.h>
-#include <iostream>
-#include <vector>
-
-// ROOT things
-#include <TROOT.h>
-#include <TSelector.h>
-#include <TVector3.h>
-#include <TVector.h>
-#include <TObject.h>
-#include <TString.h>
-#include <TObjArray.h>
-#include <TFile.h>
-#include <TTree.h>
-#include <TChain.h>
-#include <TParticlePDG.h>
-#include <TDatabasePDG.h>
-
-// // AliRoot things
-// #include "AliESD.h"
-// #include "AliESDtrack.h"
-// #include "AliKalmanTrack.h"
-// #include "AliITStrackV2.h"
-// #include "AliESDVertex.h"
-// #include "AliESDv0.h"
-
-// FLOW things
-#include "AliFlowEvent.h"
-#include "AliFlowConstants.h"
-
-class TFile;
-class TChain;
-class TTree;
-class TParticle;
-
-class AliESD;
-class AliESDtrack;
-class AliESDv0;
-
-class AliSelectorFlow : public TSelector {
-
-  public:
-    AliSelectorFlow();
-    virtual ~AliSelectorFlow();
-
-    virtual Int_t   Version() const {return 1;}
-    virtual void    Begin(TTree*);
-    virtual void    SlaveBegin(TTree* tree);
-    virtual void    Init(TTree *tree);
-    virtual Bool_t  Notify();
-    virtual Bool_t  Process(Long64_t entry);
-    virtual void    SlaveTerminate();
-    virtual void    Terminate();
-
-  // output file name
-    //void    SetFlowEventFileName(TString name) ;
-    //TString GetFlowEventFileName() ;
-
-  // FLOW SPECIFIC METHODS (to fill the flowEvents)
-    AliFlowEvent*      FillFlowEvent(AliESD* fESD) ;            // fills up evt quantities 
-    AliFlowTrack*      FillFlowTrack(AliESDtrack* fTrack) ;     // fills up track quantities (global & constrained) ; p.id. & bayesian calculation ; 
-    AliFlowV0*         FillFlowV0(AliESDv0* fV0) ;              // fills up v0 quantities ; links v0 to tracks and back ;
-
-  // USEFULL METHODS (to use 3-arrays)
-    Double_t      Norm(Double_t nu[3]) ;                        // norm of a non-vector 3 array      
-    Double_t      Phi(Double_t nu[3]) ;                         // phi of a non-vector 3 array       
-    Double_t      Pt(Double_t nu[3]) ;                          // pt of a non-vector 3 array       
-    Double_t      Eta(Double_t nu[3]) ;                         // eta of a non-vector 3 array       
-
- protected:
-    TTree*  GetKinematics();
-    void CheckOptions();
-
-    TTree      *fTree;           //! pointer to the TTree containing the events
-    AliESD*          fESD;               //! "ESD" branch in fChain
-    AliESDtrack*     fTrack;             //! "ESD track" 
-    AliESDv0*        fV0;                //! "ESD v0" 
-    Int_t           fCountFiles ;        // number of processed file
-    TString         fFlowEventFileName ; //! output file name 
-
- private:
-
-    TFile*        pFlowfile ;
-    AliFlowEvent* pFlowEvent ;          //! pointer to flow event
-    AliFlowTrack* pFlowTrack;           //! pointer to flow track
-    AliFlowV0*    pFlowV0;             //! pointer to flow V0
-  // enumerators                            
-    Int_t       fRunID;                 //! last run ID
-    Int_t      fEventNumber ;          //! progressive enumeration of ESD events
-    Int_t       fTrackNumber ;         //! progressive enumeration of ESD tracks
-    Int_t       fV0Number ;            //! progressive enumeration of ESD V0
-    Int_t       fNumberOfEvents ;       //! total number of ESD events in file
-    Int_t       fNumberOfTracks ;      //! total number of tracks in the current event
-    Int_t       fNumberOfV0s ;         //! total number of v0s in the current event
-  // other enumerators                              
-    Int_t      fGoodTracks ;           //! enumerator for good tracks
-    Int_t      fGoodV0s ;              //! enumerator for good v0s
-    Int_t      fGoodTracksEta ;        //! enumerator for good tracks in the good eta range (-0.9..0.9)
-    Int_t      fPosiTracks ;           //! enumerator for positive tracks
-    Int_t      fNegaTracks ;           //! enumerator for negative tracks
-    Int_t      fUnconstrained ;        //! enumerator for tracks not constrainable
-    Int_t       fBayesianAll[5] ;       //! final particles abundance -> AliFlowEvent (see Bayesian P.Id.)
-    Int_t       fSumAll ;              //! total particles abundance (all kind)
-
-    Int_t       fCutEvts ;             //! total enumerator for discarded events
-    Int_t       fCutTrks ;             //! total enumerator for discarded tracks
-    Int_t       fCutV0s ;              //! total enumerator for discarded V0s
-  // Flags
-    Bool_t      fLoopV0 ;               //! flag to loop over v0s 
-    Bool_t      fDoNothing ;            //! flag for a dummy execution 
-    Bool_t      fOnFlyAnalysis ;        //! flag for on-fly analysis 
-
-  // Cuts
-    Float_t fEtrkLow ;
-    Float_t fEtrkHig ;
-    Int_t   fHitsTrk ;
-
-  // ...
-    Float_t    fMagField ;             //! magnetic field from the ESD
-    void DeleteKinematicsFile();
-
-    TFile*        fKineFile;            //! pointer to Kinematics.root if the file was opened
-
-    AliSelectorFlow(const AliSelectorFlow&);
-    AliSelectorFlow& operator=(const AliSelectorFlow&);
-
-  ClassDef(AliSelectorFlow,0);
-};
-
-#endif
diff --git a/PWG2/FLOW/macros/makeAnal.C b/PWG2/FLOW/macros/makeAnal.C
deleted file mode 100644 (file)
index b5392aa..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/////////////////////////////////////////////////////////////
-//
-// $Id$
-//
-// Author: Emanuele Simili
-//
-/////////////////////////////////////////////////////////////
-//
-// Description:  ROOT macro to perform the AliFlowAnalysis 
-//
-/////////////////////////////////////////////////////////////
-
-#include <vector>
-#include <iostream>
-#include <fstream>
-#include "TVector.h"
-#include "TVector2.h"
-#include "TVector3.h"
-#include "TMath.h"
-#include "TObjArray"
-#include "TStopwatch.h"
-
-using namespace std; //required for resolving the 'cout' symbol
-
-void makeAnal(TString wch = "ESD")
-{
- cout << " . Here the newly compiled flow analysis . " << endl ;
- cout << " . AliFlowEvent(s) --> root histograms  " << endl ;
- cout << endl ;
-
- gSystem->Load("libPhysics.so");
- gSystem->Load("libPWG2.so");
- gSystem->Load("libPWG2flow.so");
-
- //char *loadFrom = gSystem->ExpandPathName("$ALICE_ROOT/PWG2/FLOW/AliFlow_Anal.so") ;
- //cout << " . *** Loading libs from   ' " << loadFrom << " ' ." << endl ;
- //gSystem->Load(loadFrom);
- cout << " .                          ...libs  loaded" << endl ;
-
- int cc = -1 ;           // centrality class
- TString ver = "h_" ;     // names ... according to the FlowMaker 
- int selNumber = 0 ;      // ... 
-
- TStopwatch timer;
- timer.Start();
-
- AliFlowSelection* select = new AliFlowSelection() ;
-
-// Event Cuts
- select->SetCentralityCut(-1) ;
- select->SetRunIdCut(-1) ;
-
-// R.P. calculation cuts
- for(int j=0;j<Flow::nHars;j++)
- {
-  select->SetEtaCut(0., 1.1, j, 1) ;
-  select->SetPtCut(0.1, 10. , j, 1);
- }
- select->SetConstrainCut(kTRUE) ;
- select->SetDcaGlobalCut(0.,0.1);
- //select->SetNhitsCut(3., 1) ;
- //select->SetPidCut("pi");
-
-// Correlation analysis cuts
- select->SetEtaPart(-1.1,1.1);
- select->SetPtPart(0.1,10.);
- select->SetConstrainablePart(kTRUE);
- select->SetDcaGlobalPart(0.,0.1);
- //select->SetPPart(0.1,10.);
- //select->SetEtaAbsPart(0.5,1.1);
- //select->SetPidPart("pi");
- //select->SetYPart(..,..);
- //select->SetPidProbPart(0.5,1.);
- //select->SetFitPtsPart(3, 480);
- //select->SetFitOverMaxPtsPart(0.1,3.);
- //select->SetDedxPtsPart(1.,0.);
- //select->SetChiSqPart(0.,100.);
-
-// V0 analysis cuts
- //select->SetV0DcaCross(0.,0.1) ;
- select->SetV0Mass(0.4875,0.5078) ;    // Mk0 = 0.49765
- select->SetV0SideBands(0.08) ;
- //select->SetV0P(0.,10.) ;
- select->SetV0Pt(0.1,10.) ;
- select->SetV0Eta(-2.1,2.1) ;
- //select->SetV0EtaAbs(0.,0.9) ;
- //select->SetV0Pid("0") ;
- //select->SetV0Y(0.,10.) ;
- //select->SetV0Lenght(0.,100.) ;
- //select->SetV0LenghtOverSigma(0.,5.) ;
- //select->SetV0ChiSqPart(0.,100.) ;
-
- cout << " . Selection for R.P. calculation: " << endl ;
- select->PrintSelectionList() ;
- cout << " . Selection for correlation analysis: " << endl ;
- select->PrintList() ;
- cout << " . Selection for V0 analysis: " << endl ;
- select->PrintV0List() ;
-
- AliFlowAnalysisMaker* flow = new AliFlowAnalysisMaker("FlowAnal",*select) ;
-
-// Input/Output/Wgt files : auto-naming
- TString inpt = ver ; inpt += wch ; inpt += "flow" ;
- TString outp = inpt ; outp += "AnalPlot" ;
- if(selNumber) { outp += selNumber ; }
- if(cc>=0) { outp += "_" ; outp += cc ; }
- TString wgt  = "flowPhiWgt." ; wgt += wch ;
- inpt += ".root" ; outp += ".root" ; wgt += ".root" ;
-
-// tmporary setting ---
- inpt = "flowEvtS.root" ;
- outp = "flowEvtSanalPlot.root" ;
-// tmporary setting ---
-
-//OUTput file
- flow->SetHistFileName(outp.Data());       // __MC/ESDflowAnalPlot.root
- cout << " . Writing Histograms on  : " << flow->GetHistFileName()   << "  . " << endl ;
-
-// auto file name
- flow->SetOneInputFile(kTRUE) ;
- flow->SetInputFileName(inpt.Data()) ;    // __MC/ESDflow.root
- cout << " . Reading FlowEvents from  : " << flow->GetInputFileName()  << "  . " << endl ;
-//INput: one flowEvent file
- //flow->SetOneInputFile(kTRUE) ;
- //flow->SetInputFileName("neo_ESDflow.root") ;
-//INput: more than one file
-//  //flow->SetInputFileNames("...") ;
-//  cout << " . Reading FlowEvents from  : " << "  tot files  " << endl ;
-
-//WGT file
- flow->SetPhiWgtFileName(wgt.Data());      // flowPhiWgt.MC/ESD.root
- cout << "# Weights File (if there)  : " << flow->GetPhiWgtFileName() << "  . " << endl ;
- cout << endl ;
-
-// Analysis settings
- flow->SetFlowForV0() ;         // default kTRUE.
- // flow->SetEtaSub() ;          // default is Disabled - DO NOT USE (kFALSE) AS AN ARGUMENT !!!
- //flow->SetV1Ep1Ep2() ;        // default kFALSE.
- flow->SetShuffle() ;           // default kFALSE. shuffles track array
- //flow->SetRedoWgt();         // default kFALSE. recalculates phiWgt (even if phiWgt file is already there)
- flow->SetUsePhiWgt() ;         // default kTRUE if phiWgt file is there, kFALSE if not (& phiWgt file is created)
- //flow->SetUseBayWgt() ;      // default kFALSE. uses bayesian weights in P.id.
- //flow->SetUsePtWgt();                // default kFALSE. uses pT as a weight for RP determination
- //flow->SetUseEtaWgt();               // default kFALSE. uses eta as a weight for RP determination
- flow->SetUseOnePhiWgt() ; // or // flow->SetUseFirstLastPhiWgt() ; // uses 1 or 3 wgt histograms (default is 1)
- //
- flow->SetMakeAll() ;           // default kTRUE. this should speed up the execution time
- flow->SetMaxLabel(1000) ;     // THERE WAS A CRASH WHEN LOOPING OVER MORE FLOWEVENT FILES !!!
- flow->SetFillLabels(kFALSE) ;   // ... ~A CHANGE WAS MADE IN THE ANALYSIS TO FIX IT (// *temp*)
- //
- flow->SetDebugg(1) ;          // more couts
- //Flow::mDebug = kTRUE ;      // more couts from singleton
-
-// init (make histograms, start the analysis)
- Int_t step = 0 ;
- step += flow->Init() ;
- if(step<1) { cout << "#! UNEXPECTED TERMINATION !# " << step << endl ; break ; }
-
-// make (loop)
- step += flow->Make() ;
- if(step<2) { cout << "#! UNEXPECTED TERMINATION !# " << step << endl ; break ; }
- cout << endl;
- cout << "Particles normalized abundance:" << endl;  // shows the bayesian vector
- flow->PrintRunBayesian() ; cout << endl;
-
-// finish (save hists, close files)
- step += flow->Finish() ;
- if(step<3) { cout << "#! UNEXPECTED TERMINATION !# " << step << endl ; break ; }
-
- timer.Stop();
- cout << endl ;
- cout << " . " ; timer.Print();
- cout << " . here it was (analysis) ... " << endl ;  //juice!
- cout << endl ;
-}
diff --git a/PWG2/FLOW/macros/testAnal.C b/PWG2/FLOW/macros/testAnal.C
new file mode 100644 (file)
index 0000000..24eb40f
--- /dev/null
@@ -0,0 +1,177 @@
+/////////////////////////////////////////////////////////////
+//
+// $Id$
+//
+// Author: Emanuele Simili
+//
+/////////////////////////////////////////////////////////////
+//
+// Description: ROOT macro to perform the Flow analysis on AliFlowEvents (new way)
+//
+/////////////////////////////////////////////////////////////
+
+#include <vector>
+#include <iostream>
+#include <fstream>
+#include "TVector.h"
+#include "TVector2.h"
+#include "TVector3.h"
+#include "TMath.h"
+#include "TObjArray"
+#include "TStopwatch.h"
+
+using namespace std; //required for resolving the 'cout' symbol
+
+void testAnal(TString output = "pFlowEvtsAnal.root")
+{
+ cout << " . Here the new flow analysis (2007) ... " << endl ;
+ cout << endl ;
+
+ bool kOne = kFALSE ;
+
+ TStopwatch timer;
+ timer.Start();
+
+ gSystem->Load("libPhysics.so");
+ //gSystem->Load("libPWG2.so");
+ gSystem->Load("libPWG2flow.so");
+
+ // output file //
+
+ TFile * fFlowfile = new TFile(output.Data(),"RECREATE") ;
+ //fFlowfile->cd() ; 
+
+ // selection object (cuts) //
+
+ AliFlowSelection* select = new AliFlowSelection() ;
+ // Event Cuts
+ select->SetCentralityCut(-1) ;
+ select->SetRunIdCut(-1) ;
+
+ // R.P. calculation cuts
+ for(int j=0;j<Flow::nHars;j++)
+ {
+  select->SetEtaCut(0., 1.1, j, 1) ;
+  select->SetPtCut(0.1, 10. , j, 1);
+ }
+ select->SetConstrainCut(kTRUE) ;
+ select->SetDcaGlobalCut(0.,0.1);
+ //select->SetNhitsCut(3., 1) ;
+ //select->SetPidCut("pi");
+
+ // Tracks Correlation analysis cuts
+ select->SetEtaPart(-1.1,1.1);
+ select->SetPtPart(0.1,10.);
+ select->SetConstrainablePart(kTRUE);
+ select->SetDcaGlobalPart(0.,0.1);
+ //select->SetPPart(0.1,10.);
+ //select->SetEtaAbsPart(0.5,1.1);
+ //select->SetPidPart("pi");
+ //select->SetYPart(..,..);
+ //select->SetPidProbPart(0.5,1.);
+ //select->SetFitPtsPart(3, 480);
+ //select->SetFitOverMaxPtsPart(0.1,3.);
+ //select->SetDedxPtsPart(1.,0.);
+ //select->SetChiSqPart(0.,100.);
+
+ // V0 Correlation analysis cuts
+ //select->SetV0DcaCross(0.,0.1) ;
+ select->SetV0Mass(0.4875,0.5078) ;    // Mk0 = 0.49765
+ select->SetV0SideBands(0.08) ;
+ //select->SetV0P(0.,10.) ;
+ select->SetV0Pt(0.1,10.) ;
+ select->SetV0Eta(-2.1,2.1) ;
+ //select->SetV0EtaAbs(0.,0.9) ;
+ //select->SetV0Pid("0") ;
+ //select->SetV0Y(0.,10.) ;
+ //select->SetV0Lenght(0.,100.) ;
+ //select->SetV0LenghtOverSigma(0.,5.) ;
+ //select->SetV0ChiSqPart(0.,100.) ;
+
+ // couts
+ cout << " . Selection for R.P. calculation: " << endl ;
+ select->PrintSelectionList() ;
+ cout << " . Selection for correlation analysis: " << endl ;
+ select->PrintList() ;
+ cout << " . Selection for V0 analysis: " << endl ;
+ select->PrintV0List() ;
+
+ // flow analyser //
+
+ AliFlowAnalyser* flow = new AliFlowAnalyser(select) ;
+ AliFlowEvent* flowEvt = new AliFlowEvent() ;
+
+ // output file
+ flow->SetHistFileName(output.Data()) ;
+ cout << " . Writing Histograms on  : " << flow->GetHistFileName()   << "  . " << endl ;
+
+ // Wgt file
+ TString wgtFileName = "pFlowPhiWgt.root" ;
+ TFile* wgtFile = new TFile(wgtFileName.Data(),"READ");
+ flow->FillWgtArrays(wgtFile) ; // fix this !!!
+ cout << " . Weights from  : " << flow->GetWgtFileName() << "  . " << endl ;
+
+ // Analysis settings
+ flow->SetFlowForV0() ;         // default kTRUE.
+ flow->SetEtaSub() ;            // default kFALSE
+ //flow->SetV1Ep1Ep2() ;        // default kFALSE.
+ flow->SetShuffle() ;           // default kFALSE. shuffles track array
+ //flow->SetRedoWgt();         // default kFALSE. recalculates phiWgt (even if phiWgt file is already there)
+ flow->SetUsePhiWgt(kFALSE) ;   // default kTRUE if phiWgt file is there, kFALSE if not (& phiWgt file is created)
+ flow->SetUseOnePhiWgt() ; // or // flow->SetUseFirstLastPhiWgt() ; // uses 1 or 3 wgt histograms (default is 1)
+ flow->SetUseBayWgt(kFALSE) ;   // default kFALSE. uses bayesian weights in P.id.
+ //flow->SetUsePtWgt();                // default kFALSE. uses pT as a weight for RP determination
+ //flow->SetUseEtaWgt();       // default kFALSE. uses eta as a weight for RP determination
+
+ // init (make histograms, start the analysis)
+ cout << endl ;
+ kOne = flow->Init() ;  if(kOne) { cout << "   ok! " << endl ;}
+ // flowEvents chain (imput) //
+
+ TString fFlowFileName = "pFlowEvts.root" ;
+
+ // organizing event loop
+ TFile* flowEventsFile = new TFile(fFlowFileName.Data(), "READ") ; // flowEventsFile->ls() ;
+ Int_t nEvts = flowEventsFile->GetNkeys() ; 
+ cout << " . Found  " << nEvts << " AliFlowEvents in file " << fFlowFileName.Data() << endl ;
+ TList* flowEventsList = (TList*)flowEventsFile->GetListOfKeys() ; 
+
+ // event loop
+ cout << endl ;
+ for(Int_t ie=0;ie<nEvts;ie++)
+ {
+  TString evtName = flowEventsList->At(ie)->GetName() ;
+  flowEventsFile->GetObject(evtName.Data(),flowEvt) ;
+  // cout << "dumping event " << ie << " : " << endl ; flowEvt->Dump() ; cout << endl ; 
+  Bool_t succ = flow->Analyse(flowEvt) ;  
+  if(succ) { cout << ie << " done ... " << endl ; } 
+ }
+
+ // p.Id
+ cout << endl ;
+ cout << "Particles normalized abundance:" << endl;  // shows the bayesian vector
+ flow->PrintRunBayesian() ; cout << endl;
+ // resolution
+ cout << endl ;
+ flow->Resolution() ;
+
+ // saves the wgt file
+ cout << endl ;
+ flow->Weightening() ;
+
+ // finish (save hists, close file)
+ cout << endl ;
+ kOne = flow->Finish() ; if(kOne) { cout << "   ok! " << endl ;}
+
+ timer.Stop();
+ cout << endl ;
+ cout << " . " ; timer.Print();
+ cout << " . here it was (analyser) ... " << endl ;  //juice!
+ cout << endl ;
+
+ // break ;
+}
similarity index 79%
rename from PWG2/FLOW/macros/testAliSelector.C
rename to PWG2/FLOW/macros/testFoF.C
index 9327375db7c063a21b58d23fd233e6928468d713..cf3629bbd36ea89fe081d2e9d108381d5802902d 100644 (file)
@@ -1,33 +1,20 @@
-/* $Id$ */
-
-//
-// This is an example how to run an AliSelector ...
-// this script runs the AliSelectorFlow on a chain of ESD files, some debug information is printed
-//
-
-// parameters are
-//   dataDir: the directory containing subdirectories that contain the ESD files
-//   nRuns: the number of files that should be processed
-//   offset: the directory to start with
-
 // from CreateESDChain.C - instead of  #include "CreateESDChain.C"
 TChain* CreateESDChain(const char* aDataDir = "ESDfiles.txt", Int_t aRuns = 20, Int_t offset = 0) ;
 void LookupWrite(TChain* chain, const char* target) ;
 //
 
-void testAliSelector(const Char_t* dataDir=".", Int_t nRuns = 10, Int_t offset = 0)
+void testFoF(const Char_t* dataDir=".", Int_t nRuns = 10, Int_t offset = 0)
 {
  // load needed libraries
   gSystem->Load("libESD");
+  gSystem->Load("libPhysics.so");
   
- // PWG2 libraries 
-  gSystem->Load("libPWG2.so");
-  gSystem->Load("libPWG2flow.so");
-  //char *loadFrom = gSystem->ExpandPathName("$ALICE_ROOT/PWG2/FLOW/AliFlow_Pure.so") ;
-  //gSystem->Load(loadFrom);
+ // Flow libraries 
+ gSystem->Load("libPWG2.so");
+ gSystem->Load("libPWG2flow.so");
 
  // Selector
-  char *loadSelector = gSystem->ExpandPathName("$ALICE_ROOT/PWG2/FLOW/AliSelectorFlow.cxx+") ;
+  char *loadSelector = gSystem->ExpandPathName("/localstore/alice/alice_new/AliRoot/PWG2/FLOW/AliSelectorFoF.cxx+") ;
   //gInterpreter->AddIncludePath(inc) ;
 
  // create the TChain. CreateESDChain() is defined in CreateESDChain.C
@@ -36,7 +23,7 @@ void testAliSelector(const Char_t* dataDir=".", Int_t nRuns = 10, Int_t offset =
   cout << " * " << chain->GetEntries() << " * " << endl ;
 
  // enable debugging
-  AliLog::SetClassDebugLevel("AliSelectorFlow", AliLog::kInfo);
+  AliLog::SetClassDebugLevel("AliSelectorFoF", AliLog::kInfo);
 
  // run selector on chain
   Long64_t result = chain->Process(loadSelector);
diff --git a/PWG2/FLOW/macros/testMaker.C b/PWG2/FLOW/macros/testMaker.C
new file mode 100644 (file)
index 0000000..6680a05
--- /dev/null
@@ -0,0 +1,118 @@
+/////////////////////////////////////////////////////////////
+//
+// $Id$
+//
+// Author: Emanuele Simili
+//
+/////////////////////////////////////////////////////////////
+//
+// Description: AliRoot macro to make AliFlowEvents from AliESDs (new way) 
+//
+/////////////////////////////////////////////////////////////
+
+#include <vector>
+#include <iostream>
+#include <fstream>
+#include "TMath.h"
+#include "TFile.h"
+#include "TObjArray"
+#include "TStopwatch.h"
+
+using namespace std; //required for resolving the 'cout' symbol
+
+void testMaker(TString output = "pFlowEvts.root")
+{
+ cout << " . Here the new flow maker (2007) ... " << endl ;
+ cout << endl ;
+
+ bool kOne = kFALSE ;
+
+ TStopwatch timer;
+ timer.Start();
+
+ gSystem->Load("libPWG2flow.so");
+
+ // output file //
+
+ TFile * fFlowfile = new TFile(output.Data(),"RECREATE") ;
+ //fFlowfile->cd() ; 
+
+ // esd chain //
+
+ TString fESDfileName = "AliESDs.root" ;
+ TString fESDtree = "esdTree" ;
+ TString fESDbranch = "ESD" ;
+
+ TChain * pESDchain = new TChain(fESDtree.Data()) ;
+
+ if(kOne)
+ {
+  pESDchain->Add(fESDfileName.Data()) ; // nFiles++ ;
+ }
+ else
+ {
+  pESDchain->Add("1/AliESDs.root") ; // nFiles++ ;
+  pESDchain->Add("2/AliESDs.root") ; // nFiles++ ;
+  pESDchain->Add("3/AliESDs.root") ; // nFiles++ ;
+ }
+
+ Int_t fNumberOfEvents = (Int_t)pESDchain->GetEntries() ;
+ cout << " tot. " << fNumberOfEvents << " events in the TChain ... " << endl ; cout << endl ;
+
+ AliESD * pEsd = 0 ;
+ pESDchain->SetBranchAddress(fESDbranch.Data(),&pEsd) ;
+
+ // flow maker //
+
+ AliFlowMaker * flowMaker = new  AliFlowMaker() ;
+ // cuts, etc.
+ flowMaker->SetNHitsCut(1) ;
+ flowMaker->SetECut(0.01,100.) ;
+ //flowMaker->SetLabelCut(..,..) ;
+ flowMaker->PrintCutList() ;
+
+ // loop //
+
+ Int_t evtN = 0 ;
+ AliFlowEvent * flowEvt = 0 ;
+ for(evtN=0;evtN<fNumberOfEvents;evtN++)
+ {
+  pESDchain->GetEntry(evtN,1) ;
+
+  Int_t evtNN = pEsd->GetEventNumber() ;
+  Int_t nTrk = pEsd->GetNumberOfTracks() ;
+  Int_t nV0s = pEsd->GetNumberOfV0s() ;
+  cout << endl ; cout << " Event " << evtN << "  ( " << evtNN << " )  : " << nTrk << " tracks  &  " << nV0s << " v0s ." << endl ;
+
+  flowEvt = flowMaker->FillFlowEvent(pEsd) ;
+  cout << " Event filled " << flowEvt << " ... " << endl ;
+
+  TString evtID = "" ; evtID += evtN ; 
+  fFlowfile->cd() ; 
+  flowEvt->Write(evtID.Data()) ;
+  cout <<  " Event " << evtN << "  ( " << evtID.Data() << " )  -  written on disk (" << output << ") ." << endl;
+  delete flowEvt ;
+ }
+ fFlowfile->Close() ; 
+
+ cout << " Finished ... " << endl ;
+ cout << "  nTracks:  " << flowMaker->GetNgoodTracks() << endl ;   
+ cout << "  nV0s:  " << flowMaker->GetNgoodV0s()  << endl ;         
+ cout << "  nTracks (|eta|<0.5):  " << flowMaker->GetNgoodTracksEta() << endl ; 
+ cout << "  nTracks+:  " << flowMaker->GetNposiTracks() << endl ;           
+ cout << "  nTracks-:  " << flowMaker->GetNnegaTracks() << endl ;           
+ cout << "  nTracks unconstrained:  " << flowMaker->GetNunconstrained() << endl ;       
+ cout << "  Bayesian :  " ; 
+ for(int ii=0;ii<5;ii++) { cout << flowMaker->GetBayesianNorm(ii) << "   " ; } 
+ cout << " . " << endl ; 
+
+ timer.Stop() ;
+ cout << endl ;
+ timer.Print() ;
+ cout << " . here it was (maker) ... " << endl ;  //juice!
+ cout << endl ;
+
+ // break ;
+
+}
diff --git a/PWG2/FLOW/macros/testWeight.C b/PWG2/FLOW/macros/testWeight.C
new file mode 100644 (file)
index 0000000..c07e53d
--- /dev/null
@@ -0,0 +1,118 @@
+/////////////////////////////////////////////////////////////
+//
+// $Id$
+//
+// Author: Emanuele Simili
+//
+/////////////////////////////////////////////////////////////
+//
+// Description: ROOT macro to perform the fill phi weights from AliFlowEvents (new way)
+//
+/////////////////////////////////////////////////////////////
+
+#include <vector>
+#include <iostream>
+#include <fstream>
+#include "TVector.h"
+#include "TVector2.h"
+#include "TVector3.h"
+#include "TMath.h"
+#include "TObjArray"
+#include "TStopwatch.h"
+
+using namespace std; //required for resolving the 'cout' symbol
+
+void testWeight(TString wgts = "pFlowPhiWgt.root")
+{
+ cout << " . Here the new flow Weighter (2007) ... " << endl ;
+ cout << endl ;
+
+ bool kOne = kFALSE ;
+
+ TStopwatch timer;
+ timer.Start();
+
+ gSystem->Load("libPhysics.so");
+ gSystem->Load("libPWG2.so");
+ gSystem->Load("libPWG2flow.so");
+
+ TStopwatch timer;
+ timer.Start();
+
+
+ // selection object (cuts) //
+
+ AliFlowSelection* select = new AliFlowSelection() ;
+ // Event Cuts
+ select->SetCentralityCut(-1) ;
+ select->SetRunIdCut(-1) ;
+
+ // R.P. calculation cuts
+ for(int j=0;j<Flow::nHars;j++)
+ {
+  select->SetEtaCut(0., 1.1, j, 1) ;
+  select->SetPtCut(0.1, 10. , j, 1);
+ }
+ select->SetConstrainCut(kTRUE) ;
+ select->SetDcaGlobalCut(0.,0.1);
+ //select->SetNhitsCut(3., 1) ;
+ //select->SetPidCut("pi");
+
+ // couts
+ cout << " . Selection for R.P. calculation: " << endl ;
+ select->PrintSelectionList() ;
+
+ // flow weighter //
+
+ AliFlowWeighter* fwgt = new AliFlowWeighter(select) ;
+
+ // output file //
+
+ TFile * wgtFile = new TFile(wgts.Data(),"RECREATE") ;
+ fwgt->SetWgtFile(wgtFile) ;
+ cout << " . Writing Histograms on  : " << fwgt->GetWgtFileName()  << "  . " << endl ;
+
+ // init (make histograms, start the analysis)
+ cout << endl ;
+ kOne = fwgt->Init() ;  if(kOne) { cout << "   ok! " << endl ;}
+ // flowEvents chain (imput) //
+
+ TString input = "pFlowEvts.root" ;
+ TFile* flowEventsFile = new TFile(input.Data(), "READ") ; // flowEventsFile->ls() ;
+ Int_t nEvts = flowEventsFile->GetNkeys() ; 
+ cout << " . Found  " << nEvts << " AliFlowEvents in file " << input.Data() << endl ;
+ TList* flowEventsList = (TList*)flowEventsFile->GetListOfKeys() ; 
+
+ // event loop
+ cout << endl ;
+ AliFlowEvent* flowEvt = new AliFlowEvent() ;
+ for(Int_t ie=0;ie<nEvts;ie++)
+ {
+  TString evtName = flowEventsList->At(ie)->GetName() ;
+  flowEventsFile->GetObject(evtName.Data(),flowEvt) ;
+  // cout << "dumping event " << ie << " : " << endl ; flowEvt->Dump() ; cout << endl ; 
+  Bool_t succ = fwgt->WeightEvent(flowEvt) ;  
+  if(succ) { cout << ie << " done ... " << endl ; } 
+ }
+ // p.Id
+ cout << endl ;
+ cout << "Particles normalized abundance:" << endl;  // shows the bayesian vector
+ for(Int_t k=0;k<2;k++)  { fwgt->PrintBayesian(k) ; }
+ cout << endl ;
+
+ // finish (save hists, close file)
+ cout << endl ;
+ kOne = fwgt->Finish() ; if(kOne) { cout << "   ok! " << endl ;}
+
+ timer.Stop();
+ cout << endl ;
+ cout << " . " ; timer.Print();
+ cout << " . here it was (weighter) ... " << endl ;  //juice!
+ cout << endl ;
+
+ // break ;
+}
diff --git a/PWG2/FLOW/macros/untitled.C b/PWG2/FLOW/macros/untitled.C
new file mode 100644 (file)
index 0000000..ac9d5a5
--- /dev/null
@@ -0,0 +1,124 @@
+// exampleMacro.C
+
+#include <vector>
+#include <iostream>
+#include <fstream>
+#include "TVector.h"
+#include "TVector2.h"
+#include "TMath.h"
+#include "TObject.h"
+#include "TObjArray.h"
+#include "TStopwatch.h"
+#include "TList.h"
+
+//#include "AliFlowConstants.h"
+
+using namespace std; //required for resolving the 'cout' symbol
+
+bool untitled(int something=0)
+{
+ cout << " . Example of how to use the new flow package (2007) ...  " << something << endl ;
+ cout << endl ;
+
+ TStopwatch timer;
+ timer.Start();
+
+ gSystem->Load("libPhysics.so");
+ gSystem->Load("AliFlow_All.so");
+
+ // allocate space for event quantities //
+  Float_t  fQ[2][2];           // flow vector
+  Float_t  fPsi[2][2];         // event plane angle
+  Int_t    fMult[2][2];        // multiplicity
+  Float_t  fQnorm[2][2];       // Q/Sqrt(Mult)
+
+ // output file //
+
+ // ...
+
+ // selection object (cuts) //
+
+ AliFlowSelection* select = new AliFlowSelection() ;
+ // Event Cuts
+ select->SetCentralityCut(-1) ;
+ select->SetRunIdCut(-1) ;
+
+ // R.P. calculation cuts
+ for(int j=0;j<Flow::nHars;j++)
+ {
+  select->SetEtaCut(0., 1.1, j, 1) ;
+  select->SetPtCut(0.1, 10. , j, 1);
+ }
+ select->SetConstrainCut(kTRUE) ;
+ select->SetDcaGlobalCut(0.,0.1);
+ select->SetNhitsCut(1., 1) ;
+
+ // couts
+ cout << " . Selection for R.P. calculation: " << endl ;
+ select->PrintSelectionList() ;
+ cout << " . Selection for correlation analysis: " << endl ;
+ select->PrintList() ;
+ cout << " . Selection for V0 analysis: " << endl ;
+ select->PrintV0List() ;
+
+ // Wgt file // 
+
+ // ...
+
+ // flowEvents chain (imput) //
+
+ // organise the loop     ... in a very clever way :)
+ TString input = "fFlowEvts.root" ;
+ TFile* flowEventsFile = new TFile(input.Data(), "READ") ; // flowEventsFile->ls() ;
+ Int_t nEvts = flowEventsFile->GetNkeys() ; 
+ cout << " . Found  " << nEvts << " AliFlowEvents in file " << input.Data() << endl ;
+ TList* flowEventsList = (TList*)flowEventsFile->GetListOfKeys() ; 
+ cout << endl ;
+
+ // event loop
+ AliFlowEvent* flowEvt = new AliFlowEvent() ;
+ for(Int_t ie=0;ie<nEvts;ie++)
+ {
+  TString evtName = flowEventsList->At(ie)->GetName() ;
+  flowEventsFile->GetObject(evtName.Data(),flowEvt) ;
+  //flowEvt->Dump() ;
+  cout << "* event ID = " << flowEvt->EventID() << " :  found " << flowEvt->FlowEventMult() << " AliFlowTracks, and " << flowEvt->V0Mult() << " AliFlowV0s . " << endl ;  
+
+  if(select->Select(flowEvt))          // event selected
+  {
+   cout << "  selected ... " <<  endl ; 
+   
+   flowEvt->SetSelections(select) ;    // applies the selection of tracks for RP calculation
+   flowEvt->MakeAll() ;                // calculates Q, Psi, Mult for RP analysis [nSel]*[nHar] times
+
+   int selCheck = 0 ;
+   for (int k = 0; k < Flow::nSels; k++) 
+   {
+    select->SetSelection(k) ;          // set the Sel. of interest
+    //cout << "  selN : " << k << " = " << select->Sel() <<  endl ; 
+    for (int j = 0; j < Flow::nHars; j++) 
+    {
+     select->SetHarmonic(j) ;          // set the Har. of interest 
+     //cout << "  harN : " << j << " = " << select->Har() << endl ; 
+     select->SetSubevent(-1) ;         // set the SubEvt of interest (-1 for the full event) 
+     //cout << "  subN : " << -1 << " = " << select->Sub() << endl ; 
+
+     cout << "  calculating  ...  " << k << "," << j <<  endl ; 
+
+     fQ[k][j]    = flowEvt->Q(select) ;           //cout << "  Q ..."      << fQ[k][j]   << endl ; 
+     fPsi[k][j]   = flowEvt->Psi(select) ;        //cout << "  Psi  ..."   << fPsi[k][j]   << endl ; 
+     fQnorm[k][j] = flowEvt->NormQ(select).Mod() ; //cout << "  NormQ  ..." << fQnorm[k][j] << endl ; 
+     fMult[k][j]  = flowEvt->Mult(select) ;       //cout << "  Mult  ..."  << fMult[k][j]  << endl ; 
+
+     selCheck += fMult[k][j] ; 
+    }
+   }
+  }
+  if(selCheck==0) { cout << " Bad Event : " << ie << endl ; }
+  else                   { cout << " Event : " << ie << " :  psi[1][1] = " << fPsi[1][1] << " (" << fMult[1][1] << " traks)" << endl ; }
+ }
+ return kTRUE ;
+}
index 071eabe0ad36070ea0e69fa927d3df14de38a8ad..9fe1ae84a3d0c61bc846a8bf493c53c5c414df54 100644 (file)
@@ -5,12 +5,13 @@
 #pragma link off all functions;
 
 #pragma link C++ class AliFlowEvent+;
-
 #pragma link C++ class AliFlowTrack+;
 #pragma link C++ class AliFlowV0+;
 #pragma link C++ class AliFlowSelection+;
 #pragma link C++ class AliFlowConstants+;
 
-#pragma link C++ class AliFlowAnalysisMaker+;
+#pragma link C++ class AliFlowMaker+;
+#pragma link C++ class AliFlowWeighter+;
+#pragma link C++ class AliFlowAnalyser+;
 
 #endif
index bff7576cddbf96eb16f50ff800e6ac5c1e6a3612..b1b665dc98fc427c782beccb19614f4769c43af3 100644 (file)
@@ -1,7 +1,11 @@
-SRCS= FLOW/AliFlowEvent.cxx FLOW/AliFlowTrack.cxx \
-      FLOW/AliFlowConstants.cxx FLOW/AliFlowV0.cxx\
+SRCS= FLOW/AliFlowEvent.cxx \
+      FLOW/AliFlowTrack.cxx \
+      FLOW/AliFlowConstants.cxx \
+      FLOW/AliFlowV0.cxx \
       FLOW/AliFlowSelection.cxx \
-      FLOW/AliFlowAnalysisMaker.cxx
+      FLOW/AliFlowAnalyser.cxx \
+      FLOW/AliFlowMaker.cxx \
+      FLOW/AliFlowWeighter.cxx 
 
 HDRS= $(SRCS:.cxx=.h) 
 
@@ -9,5 +13,5 @@ DHDR:=PWG2flowLinkDef.h
 
 EXPORT:=
 
-EINCLUDE:= PYTHIA6
+EINCLUDE:=