]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Consistent naming for FQD class
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 4 Aug 2009 14:26:00 +0000 (14:26 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 4 Aug 2009 14:26:00 +0000 (14:26 +0000)
16 files changed:
PWG2/CMake_libPWG2flowCommon.txt
PWG2/CMake_libPWG2flowTasks.txt
PWG2/FLOW/AliFlowCommon/AliFittingFunctionsForQDistribution.cxx [deleted file]
PWG2/FLOW/AliFlowCommon/AliFittingFunctionsForQDistribution.h [deleted file]
PWG2/FLOW/AliFlowCommon/AliFittingQDistribution.cxx [deleted file]
PWG2/FLOW/AliFlowCommon/AliFittingQDistribution.h [deleted file]
PWG2/FLOW/AliFlowCommon/AliFlowAnalysisWithFittingQDistribution.cxx [new file with mode: 0644]
PWG2/FLOW/AliFlowCommon/AliFlowAnalysisWithFittingQDistribution.h [new file with mode: 0644]
PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFittingQDistribution.cxx
PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFittingQDistribution.h
PWG2/FLOW/macros/redoFinish.C
PWG2/FLOW/macros/runFlowAnalysis.C
PWG2/FLOW/macros/runFlowAnalysisOnTheFly.C
PWG2/FLOW/macros/runFlowTask.C
PWG2/PWG2flowCommonLinkDef.h
PWG2/libPWG2flowCommon.pkg

index 3df193bbfb1e526854e5a23678e2354a383fdc3d..52947f0be14ad83c32c99bb066fca919a79cab56 100644 (file)
@@ -21,8 +21,7 @@ set(SRCS
       FLOW/AliFlowCommon/AliFlowAnalysisWithCumulants.cxx 
       FLOW/AliFlowCommon/AliFlowAnalysisWithQCumulants.cxx 
       FLOW/AliFlowCommon/AliCumulantsFunctions.cxx
-      FLOW/AliFlowCommon/AliFittingFunctionsForQDistribution.cxx
-      FLOW/AliFlowCommon/AliFittingQDistribution.cxx
+      FLOW/AliFlowCommon/AliFlowAnalysisWithFittingQDistribution.cxx
 )
 
 # fill list of header files from list of source files
index 0877e0079425e39b53e6678f751e6f8406791ee2..ce055c6b430467f3fffc511140bfacc6c35a53d4 100644 (file)
@@ -8,8 +8,8 @@ set(SRCS
   FLOW/AliFlowTasks/AliAnalysisTaskCumulants.cxx
   FLOW/AliFlowTasks/AliAnalysisTaskQCumulants.cxx
   FLOW/AliFlowTasks/AliAnalysisTaskLeeYangZeros.cxx
-      FLOW/AliFlowTasks/AliAnalysisTaskFittingQDistribution.cxx 
-      FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx
+  FLOW/AliFlowTasks/AliAnalysisTaskFittingQDistribution.cxx 
+  FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx
 )
 
 # fill list of header files from list of source files
diff --git a/PWG2/FLOW/AliFlowCommon/AliFittingFunctionsForQDistribution.cxx b/PWG2/FLOW/AliFlowCommon/AliFittingFunctionsForQDistribution.cxx
deleted file mode 100644 (file)
index 35516c4..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-/*************************************************************************
-* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
-*                                                                        *
-* Author: The ALICE Off-line Project.                                    *
-* Contributors are mentioned in the code where appropriate.              *
-*                                                                        *
-* Permission to use, copy, modify and distribute this software and its   *
-* documentation strictly for non-commercial purposes is hereby granted   *
-* without fee, provided that the above copyright notice appears in all   *
-* copies and that both the copyright notice and this permission notice   *
-* appear in the supporting documentation. The authors make no claims     *
-* about the suitability of this software for any purpose. It is          *
-* provided "as is" without express or implied warranty.                  * 
-**************************************************************************/
-
-/******************************** 
- * integrated flow estimate by  *
- *   fitting q-distribution     * 
- *                              *
- * author: Ante Bilandzic       * 
- *          (anteb@nikhef.nl)   *
- *                              *
- * based on the macro written   *
- *     by Sergei Voloshin       *                        
- *******************************/ 
-
-#define AliFittingFunctionsForQDistribution_cxx
-
-#include "Riostream.h"
-#include "TChain.h"
-#include "TFile.h"
-#include "TList.h"
-#include "TParticle.h"
-
-#include "TProfile.h"
-#include "TF1.h"
-#include "TAxis.h"
-#include "TH1.h"
-#include "TH1D.h"
-#include "TMath.h"
-
-#include "AliFlowEventSimple.h"
-#include "AliFlowTrackSimple.h"
-#include "AliFittingQDistribution.h"
-#include "AliFlowCommonConstants.h"
-#include "AliFlowCommonHistResults.h"
-#include "AliFittingFunctionsForQDistribution.h"
-
-ClassImp(AliFittingFunctionsForQDistribution)
-
-//================================================================================================================_
-
-AliFittingFunctionsForQDistribution::AliFittingFunctionsForQDistribution():  
- fAvMultFQD(NULL),
- fQDistributionFQD(NULL), 
- fIntFlowResFQD(NULL),
- fSigma2(NULL),
- fchrFQD(NULL)
-{
- //default constructor 
-}
-
-AliFittingFunctionsForQDistribution::~AliFittingFunctionsForQDistribution()
-{
- //destructor
-}
-
-AliFittingFunctionsForQDistribution::AliFittingFunctionsForQDistribution(TProfile *AvMult, TH1D *QDistribution, TH1D *intFlowRes, TH1D *sigma2, AliFlowCommonHistResults *chr):
- fAvMultFQD(AvMult),
- fQDistributionFQD(QDistribution),
- fIntFlowResFQD(intFlowRes),
- fSigma2(sigma2),
- fchrFQD(chr)
-{
- //custom constructor 
-}
-  
-//================================================================================================================
-
-void AliFittingFunctionsForQDistribution::Calculate()
-{
- //fitting q-distribution
- Int_t n=2;//harmonic (to be improved)
- Double_t AvM = fAvMultFQD->GetBinContent(1);
- Int_t nEvts = (Int_t)(fAvMultFQD->GetBinEntries(1));
-
- Double_t qmin=(fQDistributionFQD->GetXaxis())->GetXmin();  
- Double_t qmax=(fQDistributionFQD->GetXaxis())->GetXmax(); 
- Double_t bin=fQDistributionFQD->GetBinWidth(4);//assuming that all bins have the same width 
- Double_t ent=fQDistributionFQD->GetEntries();
- Double_t norm=bin*ent;//assuming that all bins have the same width
-
- TF1 *fittingFun = new TF1("fittingFun","[2]*(x/[1])*exp(-(x*x+[0]*[0])/(2.*[1]))*TMath::BesselI0(x*[0]/[1])",qmin,qmax); 
- fittingFun->SetParNames("V","sigma","norm");
- fittingFun->SetParameters(0.1*pow(AvM,0.5),0.5,norm);
- fittingFun->SetParLimits(0,0.,10.);//to be improved (limits)
- fittingFun->SetParLimits(1,0.,5.5);//to be improved (limits)
- fittingFun->FixParameter(2,norm);  
-
- Double_t v=0.,errorv=0.,sigma2=0.,errorsigma2=0.;
- if(fQDistributionFQD->GetEntries()>50)//to be improved (only a pragmatic fix)
- {
-  fQDistributionFQD->Fit("fittingFun","NQ","",qmin,qmax);
-  if(AvM)
-  { 
-   v = fittingFun->GetParameter(0)/pow(AvM,0.5);
-   errorv = fittingFun->GetParError(0)/pow(AvM,0.5);
-  }
-  sigma2 = fittingFun->GetParameter(1);
-  errorsigma2 = fittingFun->GetParError(1);
- }
- cout<<" "<<endl;
- cout<<"***************************************"<<endl;
- cout<<"***************************************"<<endl;
- cout<<"      integrated flow by fitting "<<endl;
- cout<<"           q-distribution:      "<<endl;
- cout<<""<<endl;
- cout<<"   v_"<<n<<"{FQD} = "<<v<<" +/- "<<errorv<<endl;
- cout<<"   sigma^2  = "<<sigma2<<" +/- "<<errorsigma2<<endl; 
- //cout<<"vm       = "<<v*pow(AvM,0.5)<<endl;
- cout<<" "<<endl;
- cout<<"      nEvts = "<<nEvts<<", AvM = "<<AvM<<endl; 
- cout<<"***************************************"<<endl;
- cout<<"***************************************"<<endl;
- fIntFlowResFQD->SetBinContent(1,v);
- fIntFlowResFQD->SetBinError(1,errorv);
- fSigma2->SetBinContent(1,sigma2);
- fSigma2->SetBinError(1,errorsigma2);
- //common histograms:
- fchrFQD->FillIntegratedFlow(v,errorv);
- fchrFQD->FillChi(v*pow(AvM,0.5));
- //RP:
- fchrFQD->FillIntegratedFlowRP(v,errorv);
- fchrFQD->FillChiRP(v*pow(AvM,0.5));
- cout<<" "<<endl;
-
- //fQDistributionFQD->Draw("");
- //fittingFun->Draw("SAME");
-
-}//end of Calculate()
-
-  
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/PWG2/FLOW/AliFlowCommon/AliFittingFunctionsForQDistribution.h b/PWG2/FLOW/AliFlowCommon/AliFittingFunctionsForQDistribution.h
deleted file mode 100644 (file)
index fbfae24..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/* 
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. 
- * See cxx source for full Copyright notice 
- * $Id$ 
- */
-
-/******************************** 
- * integrated flow estimate by  *
- *   fitting q-distribution     * 
- *                              *
- * author: Ante Bilandzic       * 
- *          (anteb@nikhef.nl)   *
- *                              *
- * based on the macro written   *
- *     by Sergei Voloshin       *                        
- *******************************/ 
-
-#ifndef AliFittingFunctionsForQDistribution_H
-#define AliFittingFunctionsForQDistribution_H
-
-#include "AliFlowCommonConstants.h"
-
-class TH1;
-class TProfile;
-
-class TObjArray;
-class TList;
-class TFile;
-
-//================================================================================================================
-
-class AliFittingFunctionsForQDistribution{
- public:
-  AliFittingFunctionsForQDistribution();
-  virtual ~AliFittingFunctionsForQDistribution();
-  AliFittingFunctionsForQDistribution(TProfile *AvMult, TH1D *QDistribution, TH1D *intFlowRes, TH1D *sigma2, AliFlowCommonHistResults *chr);
-  void Calculate();
-
- private:
-  AliFittingFunctionsForQDistribution(const AliFittingFunctionsForQDistribution& fun);
-  AliFittingFunctionsForQDistribution& operator=(const AliFittingFunctionsForQDistribution& fun);
-  
-  TProfile                 *fAvMultFQD;           //avarage selected multiplicity for int. flow
-  TH1D                     *fQDistributionFQD;    //q-distribution
-  TH1D                     *fIntFlowResFQD;       //integrated flow final result
-  TH1D                     *fSigma2;              //sigma^2
-  AliFlowCommonHistResults *fchrFQD;              //final results for integrated flow stored in the common histograms
-
-  ClassDef(AliFittingFunctionsForQDistribution, 0);
-};
-
-//================================================================================================================
-
-#endif
-
-
-
-
-
diff --git a/PWG2/FLOW/AliFlowCommon/AliFittingQDistribution.cxx b/PWG2/FLOW/AliFlowCommon/AliFittingQDistribution.cxx
deleted file mode 100644 (file)
index a1acc8b..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-/*************************************************************************
-* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
-*                                                                        *
-* Author: The ALICE Off-line Project.                                    *
-* Contributors are mentioned in the code where appropriate.              *
-*                                                                        *
-* Permission to use, copy, modify and distribute this software and its   *
-* documentation strictly for non-commercial purposes is hereby granted   *
-* without fee, provided that the above copyright notice appears in all   *
-* copies and that both the copyright notice and this permission notice   *
-* appear in the supporting documentation. The authors make no claims     *
-* about the suitability of this software for any purpose. It is          *
-* provided "as is" without express or implied warranty.                  * 
-**************************************************************************/
-
-/******************************** 
- * integrated flow estimate by  *
- *   fitting q-distribution     * 
- *                              *
- * author: Ante Bilandzic       * 
- *          (anteb@nikhef.nl)   *
- *******************************/ 
-
-#define AliFittingQDistribution_cxx
-
-#include "Riostream.h"
-#include "AliFlowCommonConstants.h"
-#include "AliFlowCommonHist.h"
-#include "AliFlowCommonHistResults.h"
-#include "TChain.h"
-#include "TFile.h"
-#include "TList.h" 
-#include "TParticle.h"
-#include "TProfile.h"
-#include "AliFlowEventSimple.h"
-#include "AliFlowTrackSimple.h"
-#include "AliFittingQDistribution.h"
-#include "AliFittingFunctionsForQDistribution.h"
-
-class TH1;
-class TGraph;
-class TPave;
-class TLatex;
-class TMarker;
-class TObjArray;
-class TList;
-class TCanvas;
-class TSystem;
-class TROOT;
-class AliFlowVector;
-class TVector;
-
-//================================================================================================================
-
-ClassImp(AliFittingQDistribution)
-
-AliFittingQDistribution::AliFittingQDistribution():  
- fTrack(NULL),
- fHistList(NULL),
- fWeightsList(NULL),
- fAvMultIntFlowFQD(NULL),
- fIntFlowResultsFQD(NULL),
- fSigma2(NULL),
- fCommonHists(NULL),
- fCommonHistsResults(NULL),
- fQDistributionFQD(NULL),
- fUsePhiWeights(kFALSE)
-{
- //constructor 
- fHistList = new TList();
- fWeightsList = new TList(); 
-}
-
-AliFittingQDistribution::~AliFittingQDistribution()
-{
- //desctructor
- delete fHistList; 
- delete fWeightsList;
-}
-
-//================================================================================================================
-
-void AliFittingQDistribution::Init()
-{
- //various output histograms
- //avarage multiplicity 
- fAvMultIntFlowFQD = new TProfile("fAvMultIntFlowFQD","Average Multiplicity",1,0,1,"s");
- fAvMultIntFlowFQD->SetXTitle("");
- fAvMultIntFlowFQD->SetYTitle("");
- fAvMultIntFlowFQD->SetLabelSize(0.06);
- fAvMultIntFlowFQD->SetMarkerStyle(25);
- fAvMultIntFlowFQD->SetLabelOffset(0.02);
- (fAvMultIntFlowFQD->GetXaxis())->SetBinLabel(1,"Average Multiplicity");
- fHistList->Add(fAvMultIntFlowFQD);
- //final result for integrated flow 
- fIntFlowResultsFQD = new TH1D("fIntFlowResultsFQD","Integrated Flow By Fitting q-distribution",1,0,1);
- fIntFlowResultsFQD->SetXTitle("");
- fIntFlowResultsFQD->SetYTitle("");
- fIntFlowResultsFQD->SetMarkerStyle(25);
- fIntFlowResultsFQD->SetLabelSize(0.06);
- fIntFlowResultsFQD->SetLabelOffset(0.02);
- (fIntFlowResultsFQD->GetXaxis())->SetBinLabel(1,"v_{n}{FQD}");
- fHistList->Add(fIntFlowResultsFQD);
- //sigma^2
- fSigma2 = new TH1D("fSigma2","#sigma^{2}",1,0,1);
- fSigma2->SetXTitle("");
- fSigma2->SetYTitle("");
- fSigma2->SetMarkerStyle(25);
- fSigma2->SetLabelSize(0.06);
- fSigma2->SetLabelOffset(0.02);
- (fSigma2->GetXaxis())->SetBinLabel(1,"#sigma^{2}");
- fHistList->Add(fSigma2);
- //q-distribution 
- fQDistributionFQD = new TH1D("fQDistributionFQD","q-distribution",100,0,10);
- fQDistributionFQD->SetXTitle("q_{n}=Q_{n}/#sqrt{M}");
- fQDistributionFQD->SetYTitle("Counts");
- fHistList->Add(fQDistributionFQD);
-  
- //common control histograms
- fCommonHists = new AliFlowCommonHist("AliFlowCommonHistFQD");
- fHistList->Add(fCommonHists);  
- //common histograms for final results (2nd order)
- fCommonHistsResults= new AliFlowCommonHistResults("AliFlowCommonHistResultsFQD");
- fHistList->Add(fCommonHistsResults); 
-}//end of Init()
-
-//================================================================================================================
-
-void AliFittingQDistribution::Make(AliFlowEventSimple* anEvent)
-{
- //Int_t nPrim = anEvent->NumberOfTracks();//total multiplicity
-  
- Int_t n=2;//harmonic (to be improved)  
-   
- //fill the common control histograms
- fCommonHists->FillControlHistograms(anEvent);   
-
- //calculating Q-vector of event
- AliFlowVector fQVector;
- fQVector.Set(0.,0.);
- fQVector.SetMult(0);
- fQVector=anEvent->GetQ(n,fWeightsList,fUsePhiWeights);                                                                                  
-                                                                                                                                                                      
- //multiplicity
- fAvMultIntFlowFQD->Fill(0.,fQVector.GetMult(),1.);
- //q = Q/sqrt(M)
- Double_t q=0.;
- if(fQVector.GetMult()!=0)
- {
-  q = fQVector.Mod()/sqrt(fQVector.GetMult());
-  fQDistributionFQD->Fill(q,1.);
- }  
-}//end of Make()
-
-//================================================================================================================
-
-void AliFittingQDistribution::GetOutputHistograms(TList *outputListHistos) 
-{
- // get pointers to all output histograms (called before Finish()) 
- if(outputListHistos)   
- {   
-  //final results (integrated flow)
-  TH1D *intFlowResults = dynamic_cast<TH1D*>(outputListHistos->FindObject("fIntFlowResultsFQD")); 
-    
-  //sigma^2
-  TH1D *sigma2 = dynamic_cast<TH1D*>(outputListHistos->FindObject("fSigma2")); 
-    
-  //common histograms to store the final results for the integrated flow
-  AliFlowCommonHistResults *commonHistRes = dynamic_cast<AliFlowCommonHistResults*>(outputListHistos->FindObject("AliFlowCommonHistResultsFQD"));
-    
-  //average selected multiplicity (for int. flow)    
-  TProfile *AvMult = dynamic_cast<TProfile*>(outputListHistos->FindObject("fAvMultIntFlowFQD"));
-    
-  //q-distribution
-  TH1D *qDist = dynamic_cast<TH1D*>(outputListHistos->FindObject("fQDistributionFQD"));
-    
-  //----------------------------------------------------
-    
-  this->SetIntFlowResults(intFlowResults);
-  this->SetSigma2(sigma2); 
-  this->SetCommonHistsResults(commonHistRes); 
-    
-  this->SetAverageMultiplicity(AvMult);
-  this->SetQDistribution(qDist); 
- }   
-}
-
-//================================================================================================================
-
-void AliFittingQDistribution::Finish(Bool_t doFit)
-{
- //calculate the final results
- AliFittingFunctionsForQDistribution finalFitting(fAvMultIntFlowFQD,fQDistributionFQD,fIntFlowResultsFQD,fSigma2,fCommonHistsResults);
-         
- if(doFit) finalFitting.Calculate();            
-}
-
-//================================================================================================================
-
-void AliFittingQDistribution::WriteHistograms(TString* outputFileName)
-{
- //store the final results in output .root file
- TFile *output = new TFile(outputFileName->Data(),"RECREATE");
- //output->WriteObject(fHistList, "cobjFQD","SingleKey");
- fHistList->SetName("cobjFQD");
- fHistList->SetOwner(kTRUE);
- fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
- delete output;
-}
-
-//================================================================================================================
-
-void AliFittingQDistribution::WriteHistograms(TString outputFileName)
-{
- //store the final results in output .root file
- TFile *output = new TFile(outputFileName.Data(),"RECREATE");
- //output->WriteObject(fHistList, "cobjFQD","SingleKey");
- fHistList->SetName("cobjFQD");
- fHistList->SetOwner(kTRUE);
- fHistList->Write(fHistList->GetName(), TObject::kSingleKey); 
- delete output;
-}
-
-//================================================================================================================
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/PWG2/FLOW/AliFlowCommon/AliFittingQDistribution.h b/PWG2/FLOW/AliFlowCommon/AliFittingQDistribution.h
deleted file mode 100644 (file)
index 7985478..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/* 
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. 
- * See cxx source for full Copyright notice 
- * $Id$ 
- */
-
-/******************************** 
- * integrated flow estimate by  *
- *   fitting q-distribution     * 
- *                              *
- * author: Ante Bilandzic       * 
- *          (anteb@nikhef.nl)   *
- *******************************/ 
-#ifndef AliFittingQDistribution_H
-#define AliFittingQDistribution_H
-
-#include "AliFlowCommonConstants.h"
-
-class TObjArray;
-class TList;
-class TFile;
-
-class TH1;
-class TProfile;
-
-class AliFlowEventSimple;
-class AliFlowTrackSimple;
-class AliFlowCommonHist;
-class AliFlowCommonHistResults;
-class AliFlowVector;
-
-//================================================================================================================
-
-class AliFittingQDistribution{
- public:
-  AliFittingQDistribution();
-  virtual ~AliFittingQDistribution(); 
-  
-  virtual void Init();
-  virtual void Make(AliFlowEventSimple* anEvent);
-  virtual void GetOutputHistograms(TList *outputListHistos); //get pointers to all output histograms (called before Finish()) 
-  virtual void Finish(Bool_t doFit = kFALSE);
-  virtual void WriteHistograms(TString* outputFileName);
-  virtual void WriteHistograms(TString outputFileName);
-
-//----------------------------------------------------------------------------------------------------------------
-//                                            setters and getters                                                 
-//----------------------------------------------------------------------------------------------------------------      
-  TList* GetHistList() const {return this->fHistList;}
-  
-  void SetWeightsList(TList* wlist) {this->fWeightsList = wlist;}
-  TList* GetWeightsList() const {return this->fWeightsList;}   
-  
-  void SetIntFlowResults(TH1D* ifr)  {this->fIntFlowResultsFQD = ifr;};
-  TH1D* GetIntFlowResults() const    {return this->fIntFlowResultsFQD;};
-  
-  void SetCommonHistsResults(AliFlowCommonHistResults* chr)  {this->fCommonHistsResults = chr;};
-  AliFlowCommonHistResults* GetCommonHistsResults() const    {return this->fCommonHistsResults;};
-  
-  void SetAverageMultiplicity(TProfile* am)  {this->fAvMultIntFlowFQD = am;};
-  TProfile* GetAverageMultiplicity() const   {return this->fAvMultIntFlowFQD;};
-  
-  void SetQDistribution(TH1D* qd)  {this->fQDistributionFQD = qd;};
-  TH1D* GetQDistribution() const   {return this->fQDistributionFQD;};
-  
-  void SetSigma2(TH1D* s2)  {this->fSigma2 = s2;};
-  TH1D* GetSigma2() const   {return this->fSigma2;};
-  
-  void SetUsePhiWeights(Bool_t const uPhiW) {this->fUsePhiWeights = uPhiW;};
-  Bool_t GetUsePhiWeights() const {return this->fUsePhiWeights;};
-  
-//----------------------------------------------------------------------------------------------------------------
- private:
-  AliFittingQDistribution(const AliFittingQDistribution& afqd);
-  AliFittingQDistribution& operator=(const AliFittingQDistribution& afqd);
-  
-  AliFlowTrackSimple*        fTrack;                   //track
-           
-  TList*                     fHistList;                //list to hold all output histograms
-  TList*                     fWeightsList;             //list to hold all histograms with weights
-  
-  TProfile*                  fAvMultIntFlowFQD;        //avarage selected multiplicity
-  TH1D*                      fIntFlowResultsFQD;       //integrated flow final results
-  TH1D*                      fSigma2;                  //sigma^2
-  AliFlowCommonHist*         fCommonHists;             //common control histograms
-  AliFlowCommonHistResults*  fCommonHistsResults;      //final results for integrated flow stored in the common histograms 
-  TH1D*                      fQDistributionFQD;        //q-distribution 
-  
-  Bool_t                     fUsePhiWeights;           //phi weights
-         
-  ClassDef(AliFittingQDistribution, 0);
-};
-
-//================================================================================================================
-
-#endif
-
-
-
-
-
diff --git a/PWG2/FLOW/AliFlowCommon/AliFlowAnalysisWithFittingQDistribution.cxx b/PWG2/FLOW/AliFlowCommon/AliFlowAnalysisWithFittingQDistribution.cxx
new file mode 100644 (file)
index 0000000..2ed3b09
--- /dev/null
@@ -0,0 +1,860 @@
+/*************************************************************************
+* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
+*                                                                        *
+* Author: The ALICE Off-line Project.                                    *
+* Contributors are mentioned in the code where appropriate.              *
+*                                                                        *
+* Permission to use, copy, modify and distribute this software and its   *
+* documentation strictly for non-commercial purposes is hereby granted   *
+* without fee, provided that the above copyright notice appears in all   *
+* copies and that both the copyright notice and this permission notice   *
+* appear in the supporting documentation. The authors make no claims     *
+* about the suitability of this software for any purpose. It is          *
+* provided "as is" without express or implied warranty.                  * 
+**************************************************************************/
+
+/******************************** 
+ * integrated flow estimate by  *
+ *   fitting q-distribution     * 
+ *                              *
+ * author: Ante Bilandzic       * 
+ *          (anteb@nikhef.nl)   *
+ *                              *  
+ *  based on the macro written  *
+ *     by Sergei Voloshin       *
+ *******************************/  
+
+#define AliFlowAnalysisWithFittingQDistribution_cxx
+
+#include "Riostream.h"
+#include "AliFlowCommonConstants.h"
+#include "AliFlowCommonHist.h"
+#include "AliFlowCommonHistResults.h"
+#include "TChain.h"
+#include "TFile.h"
+#include "TList.h" 
+#include "TF1.h"
+#include "TParticle.h"
+#include "TProfile.h"
+#include "AliFlowEventSimple.h"
+#include "AliFlowTrackSimple.h"
+#include "AliFlowAnalysisWithFittingQDistribution.h"
+
+class TH1;
+class TGraph;
+class TPave;
+class TLatex;
+class TMarker;
+class TObjArray;
+class TList;
+class TCanvas;
+class TSystem;
+class TROOT;
+class AliFlowVector;
+class TVector;
+
+//================================================================================================================
+
+ClassImp(AliFlowAnalysisWithFittingQDistribution)
+
+AliFlowAnalysisWithFittingQDistribution::AliFlowAnalysisWithFittingQDistribution():  
+ fHistList(NULL),
+ fCommonHists(NULL),
+ fCommonHistsResults(NULL),
+ fnBinsPhi(0),
+ fPhiMin(0),
+ fPhiMax(0),
+ fPhiBinWidth(0),
+ fnBinsPt(0),
+ fPtMin(0),
+ fPtMax(0),
+ fPtBinWidth(0),
+ fnBinsEta(0),
+ fEtaMin(0),
+ fEtaMax(0),
+ fEtaBinWidth(0),
+ fHarmonic(2),
+ fAnalysisLabel(NULL),
+ fWeightsList(NULL),
+ fUsePhiWeights(kFALSE),
+ fUsePtWeights(kFALSE),
+ fUseEtaWeights(kFALSE),
+ fUseParticleWeights(NULL),
+ fPhiWeights(NULL),
+ fPtWeights(NULL),
+ fEtaWeights(NULL)
+ {
+  // constructor 
+  
+  // base list to hold all output objects:
+  fHistList = new TList();
+  fHistList->SetName("cobjFQD");
+  fHistList->SetOwner(kTRUE);
+  
+  // analysis label;
+  fAnalysisLabel = new TString();
+  // list to hold histograms with phi, pt and eta weights:      
+  fWeightsList = new TList();
+
+  // initialize all arrays:  
+  this->InitializeArrays();
+
+ } // end of constructor
+//================================================================================================================
+
+AliFlowAnalysisWithFittingQDistribution::~AliFlowAnalysisWithFittingQDistribution()
+{
+ // desctructor
+ delete fHistList; 
+}
+
+
+//================================================================================================================
+
+
+void AliFlowAnalysisWithFittingQDistribution::Init()
+{
+ // access constants and book everything
+ // access constants:
+ this->AccessConstants();
+ // booking:
+ this->BookCommonHistograms();
+ this->BookAndFillWeightsHistograms();
+ this->BookEverythingForDistributions();
+ // nest lists:
+ fWeightsList->SetName("Weights");
+ fWeightsList->SetOwner(kTRUE);   
+ fHistList->Add(fWeightsList);
+ // set harmonic in common control histograms (to be improved (should I do this somewhere else?)):
+ (fCommonHists->GetHarmonic())->Fill(0.5,fHarmonic); 
+} // end of void AliFlowAnalysisWithFittingQDistribution::Init()
+
+
+//================================================================================================================
+
+
+void AliFlowAnalysisWithFittingQDistribution::Make(AliFlowEventSimple* anEvent)
+{
+ // loop over data
+ // a) fill the common control histograms
+ // b) loop over data and calculate non-weighted and weighted Q-vector and sum of particle weights
+ // c) fill histograms for distribution
+ // d) reset e-b-e quantities
+ // fill the common control histograms
+ fCommonHists->FillControlHistograms(anEvent); 
+ Double_t dPhi = 0.; // azimuthal angle in the laboratory frame
+ Double_t dPt  = 0.; // transverse momentum
+ Double_t dEta = 0.; // pseudorapidity
+
+ Double_t wPhi = 1.; // phi weight
+ Double_t wPt  = 1.; // pt weight
+ Double_t wEta = 1.; // eta weight
+ Int_t nPrim = anEvent->NumberOfTracks();  // nPrim = total number of primary tracks, i.e. nPrim = nRP + nPOI + rest, where:
+                                           // nRP   = # of particles used to determine the reaction plane;
+                                           // nPOI  = # of particles of interest for a detailed flow analysis;
+                                           // rest  = # of particles which are not niether RPs nor POIs.  
+ Int_t n = fHarmonic; // shortcut for the harmonic
+ Double_t dReQ[2] = {0.}; // real part of Q-vector [0=particle weights not used, 1=particle weights used]
+ Double_t dImQ[2] = {0.}; // imaginary part of Q-vector [0=particle weights not used, 1=particle weights used]
+ Double_t dSumOfParticleWeights[2]; // [0=particle weights not used, 1=particle weights used] 
+                                                                                                                               
+ AliFlowTrackSimple *aftsTrack = NULL;                                          
+                                           
+ for(Int_t i=0;i<nPrim;i++) 
+ { 
+  aftsTrack=anEvent->GetTrack(i);
+  if(aftsTrack)
+  {
+   if(!(aftsTrack->InRPSelection())) continue; // consider only tracks which are RPs
+     
+   dPhi = aftsTrack->Phi();
+   dPt  = aftsTrack->Pt();
+   dEta = aftsTrack->Eta();
+  
+   if(fUsePhiWeights && fPhiWeights && fnBinsPhi) // determine phi weight for this particle:
+   {
+    wPhi = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*fnBinsPhi/TMath::TwoPi())));
+   }
+   if(fUsePtWeights && fPtWeights && fnBinsPt) // determine pt weight for this particle:
+   {
+    wPt = fPtWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-fPtMin)/fPtBinWidth))); 
+   }            
+   if(fUseEtaWeights && fEtaWeights && fEtaBinWidth) // determine eta weight for this particle: 
+   {
+    wEta = fEtaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-fEtaMin)/fEtaBinWidth))); 
+   } 
+    
+   // calculate real and imaginary part of non-weighted and weighted Q-vector and sum of particle weights for this event:
+   for(Int_t pW=0;pW<1+(Int_t)(fUsePhiWeights||fUsePtWeights||fUseEtaWeights);pW++) // pW not used or used
+   {
+    // Q-vector:
+    dReQ[pW]+=pow(wPhi*wPt*wEta,pW)*TMath::Cos(n*dPhi); 
+    dImQ[pW]+=pow(wPhi*wPt*wEta,pW)*TMath::Sin(n*dPhi);
+    // sum of particle weights:
+    dSumOfParticleWeights[pW] += pow(wPhi*wPt*wEta,pW); // if pW = 0, this sum gives nRP
+   } 
+   
+  } // end of if(aftsTrack)
+ } // end of for(Int_t i=0;i<nPrim;i++)                                      
+                                           
+ // calculate q = Q\sqrt{sum of particle weights}:
+ // Remark: if particle weights are unit than sum of particle weights = multiplicity
+ Double_t q=0;                                          
+ for(Int_t pW=0;pW<1+(Int_t)(fUsePhiWeights||fUsePtWeights||fUseEtaWeights);pW++) // pW not used or used
+ {
+  if(dSumOfParticleWeights[pW])
+  {
+   q = pow(dReQ[pW]*dReQ[pW]+dImQ[pW]*dImQ[pW],0.5)/pow(dSumOfParticleWeights[pW],0.5);
+   // fill histograms:
+   fqDistribution[pW]->Fill(q,1.);
+   fSumOfParticleWeights[pW]->Fill(dSumOfParticleWeights[pW],1.);
+  }
+ } 
+ // reset e-b-e quantities:
+ for(Int_t pW=0;pW<1+(Int_t)(fUsePhiWeights||fUsePtWeights||fUseEtaWeights);pW++) // pW not used or used
+ {
+  dReQ[pW] = 0.;
+  dImQ[pW] = 0.;
+  dSumOfParticleWeights[pW] = 0.;
+ }
+
+}//end of Make()
+
+
+//================================================================================================================
+
+
+void AliFlowAnalysisWithFittingQDistribution::GetOutputHistograms(TList *outputListHistos) 
+{
+ // get pointers to all output histograms (called before Finish()) 
+ if(outputListHistos)   
+ {   
+  // 1.) common control histograms and common histograms for final results:
+  TString commonHistName = "AliFlowCommonHistFQD";
+  commonHistName += fAnalysisLabel->Data();
+  AliFlowCommonHist *commonHist = dynamic_cast<AliFlowCommonHist*>(outputListHistos->FindObject(commonHistName.Data()));
+  if(commonHist) this->SetCommonHists(commonHist); 
+  
+  TString commonHistResName = "AliFlowCommonHistResultsFQD";
+  commonHistResName += fAnalysisLabel->Data();
+  AliFlowCommonHistResults *commonHistRes = dynamic_cast<AliFlowCommonHistResults*>
+                                            (outputListHistos->FindObject(commonHistResName.Data()));
+  if(commonHistRes) this->SetCommonHistsResults(commonHistRes); 
+  
+  // 2.) weights: 
+  TList *weightsList = dynamic_cast<TList*>(outputListHistos->FindObject("Weights"));
+  if(weightsList) this->SetWeightsList(weightsList);
+  Bool_t bUsePhiWeights = kFALSE;
+  Bool_t bUsePtWeights = kFALSE;
+  Bool_t bUseEtaWeights = kFALSE;
+  TString fUseParticleWeightsName = "fUseParticleWeightsFQD";
+  fUseParticleWeightsName += fAnalysisLabel->Data();
+  TProfile *useParticleWeights = dynamic_cast<TProfile*>(weightsList->FindObject(fUseParticleWeightsName.Data()));
+  if(useParticleWeights)
+  {
+   this->SetUseParticleWeights(useParticleWeights);  
+   bUsePhiWeights = (Int_t)useParticleWeights->GetBinContent(1);
+   bUsePtWeights = (Int_t)useParticleWeights->GetBinContent(2);
+   bUseEtaWeights = (Int_t)useParticleWeights->GetBinContent(3);
+  }
+  
+  // 3.) distributions and 4.) final results of fitting:
+  TString pWeightsFlag[2] = {"pWeights not used","pWeights used"};
+  TString sigmaFlag[2] = {"#sigma^{2} not fixed","#sigma^{2} fixed"};
+  
+  // q-distribution:
+  TString qDistributionName = "fqDistribution";
+  qDistributionName += fAnalysisLabel->Data();
+  // sum of particle weights:
+  TString sumOfParticleWeightsName = "fSumOfParticleWeightsName"; 
+  sumOfParticleWeightsName += fAnalysisLabel->Data();
+  // final results for integrated flow:
+  TString intFlowName = "fIntFlowFQD";
+  intFlowName += fAnalysisLabel->Data();
+  // sigma^2:
+  TString sigma2Name = "fSigma2";
+  sigma2Name += fAnalysisLabel->Data();
+  
+  TH1D *qDistribution[2] = {NULL};
+  TH1D *sumOfParticleWeights[2] = {NULL};
+  TH1D *intFlow[2][2] = {{NULL}};
+  TH1D *sigma2[2][2] = {{NULL}};
+   
+  for(Int_t pW=0;pW<1+(Int_t)(bUsePhiWeights||bUsePtWeights||bUseEtaWeights);pW++)
+  {
+   // q-distribution:
+   qDistribution[pW] = dynamic_cast<TH1D*>(outputListHistos->FindObject(Form("%s, %s",qDistributionName.Data(),pWeightsFlag[pW].Data())));
+   if(qDistribution[pW])
+   {
+    this->SetqDistribution(qDistribution[pW],pW);
+   } else
+     {
+      cout<<"WARNING: qDistribution[pW] is NULL in AFAWFQD::GOH() !!!!"<<endl;
+      cout<<"pW = "<<pW<<endl;
+     }
+   // sum of particle weights:
+   sumOfParticleWeights[pW] = dynamic_cast<TH1D*>(outputListHistos->FindObject(Form("%s, %s",sumOfParticleWeightsName.Data(),pWeightsFlag[pW].Data())));
+   if(sumOfParticleWeights[pW])
+   {
+    this->SetSumOfParticleWeights(sumOfParticleWeights[pW],pW);
+   } else
+     {
+      cout<<"WARNING: sumOfParticleWeights[pW] is NULL in AFAWFQD::GOH() !!!!"<<endl;
+      cout<<"pW = "<<pW<<endl;
+     }
+   // final results:
+   for(Int_t f=0;f<2;f++)
+   {
+    // final results for integrated flow:
+    intFlow[pW][f] = dynamic_cast<TH1D*>(outputListHistos->FindObject(Form("%s, %s, %s",intFlowName.Data(),pWeightsFlag[pW].Data(),sigmaFlag[f].Data())));
+    if(intFlow[pW][f])
+    {
+     this->SetIntFlow(intFlow[pW][f],pW,f);
+    } else 
+      {
+       cout<<"WARNING: intFlow[pW][f] is NULL in AFAWFQD::GOH() !!!!"<<endl;
+       cout<<"pW = "<<pW<<endl;
+       cout<<"f  = "<<f<<endl;
+      }
+    // sigma^2:
+    sigma2[pW][f] = dynamic_cast<TH1D*>(outputListHistos->FindObject(Form("%s, %s, %s",sigma2Name.Data(),pWeightsFlag[pW].Data(),sigmaFlag[f].Data())));
+    if(sigma2[pW][f])
+    {
+     this->SetSigma2(sigma2[pW][f],pW,f);
+    } else 
+      {
+       cout<<"WARNING: sigma2[pW][f] is NULL in AFAWFQD::GOH() !!!!"<<endl;
+       cout<<"pW = "<<pW<<endl;
+       cout<<"f  = "<<f<<endl;
+      } 
+   } // end of for(Int_t f=0;f<2;f++)
+  } // end of for(Int_t pW=0;pW<1+(Int_t)(bUsePhiWeights||bUsePtWeights||bUseEtaWeights);pW++)
+ } else // to if(outputListHistos)
+   {
+    cout<<"WARNING: outputListHistos is NULL in AFAWFQD::GOH() !!!!"<<endl;
+    exit(0);
+   } 
+   
+} // end of void AliFlowAnalysisWithFittingQDistribution::GetOutputHistograms(TList *outputListHistos) 
+
+
+//================================================================================================================
+
+
+void AliFlowAnalysisWithFittingQDistribution::Finish(Bool_t doFit)
+{
+ // calculate the final results
+ // a) acces the constants;
+ // b) access the flags;
+ // c) do final fit;
+ // d) fill common hist results;
+ // e) print on the screen the final results.
+ // access the constants:
+ this->AccessConstants();
+ // access the flags: 
+ fUsePhiWeights = (Int_t)fUseParticleWeights->GetBinContent(1); 
+ fUsePtWeights = (Int_t)fUseParticleWeights->GetBinContent(2); 
+ fUseEtaWeights = (Int_t)fUseParticleWeights->GetBinContent(3);
+
+ // do final fit:             
+ if(doFit) 
+ {
+  // particle weights not used:
+  // a) sigma^2 not fixed:
+  this->DoFit(kFALSE,kTRUE);
+  // b) sigma^2 fixed to 0.5:
+  this->DoFit(kFALSE,kFALSE);
+  // particle weights used:
+  if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)      
+  {
+   // a) sigma^2 not fixed:
+   this->DoFit(kTRUE,kTRUE);  
+   // b) sigma^2 fixed:
+   this->DoFit(kTRUE,kFALSE);  
+  }
+  
+  // fill common hist results (by default fill results obtained with sigma^2 not fixed):
+  if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)
+  {
+   this->FillCommonHistResultsIntFlow(kTRUE,kFALSE); 
+  } else
+    {
+     this->FillCommonHistResultsIntFlow(kFALSE,kFALSE);    
+    } 
+  
+  // print final results on the screen:
+  this->PrintFinalResultsForIntegratedFlow();  
+ } // end of if(doFit)
+   
+} // end of void AliFlowAnalysisWithFittingQDistribution::Finish(Bool_t doFit)
+
+
+//================================================================================================================
+
+
+void AliFlowAnalysisWithFittingQDistribution::WriteHistograms(TString* outputFileName)
+{
+ //store the final results in output .root file
+ TFile *output = new TFile(outputFileName->Data(),"RECREATE");
+ //output->WriteObject(fHistList, "cobjFQD","SingleKey");
+ fHistList->SetName("cobjFQD");
+ fHistList->SetOwner(kTRUE);
+ fHistList->Write(fHistList->GetName(), TObject::kSingleKey);
+ delete output;
+}
+
+//================================================================================================================
+
+void AliFlowAnalysisWithFittingQDistribution::WriteHistograms(TString outputFileName)
+{
+ //store the final results in output .root file
+ TFile *output = new TFile(outputFileName.Data(),"RECREATE");
+ //output->WriteObject(fHistList, "cobjFQD","SingleKey");
+ fHistList->SetName("cobjFQD");
+ fHistList->SetOwner(kTRUE);
+ fHistList->Write(fHistList->GetName(), TObject::kSingleKey); 
+ delete output;
+}
+
+
+//================================================================================================================
+
+
+void AliFlowAnalysisWithFittingQDistribution::InitializeArrays()
+{
+ // initialize all arrays
+ for(Int_t pW=0;pW<1+(Int_t)(fUsePhiWeights||fUsePtWeights||fUseEtaWeights);pW++) // pW not used or used
+ {
+  fSumOfParticleWeights[pW] = NULL;
+  fqDistribution[pW] = NULL; 
+  for(Int_t f=0;f<2;f++) // sigma^2 not fixed or fixed
+  {
+   fIntFlow[pW][f] = NULL;
+   fSigma2[pW][f] = NULL;
+  }
+ } 
+
+} // end of void AliFlowAnalysisWithFittingQDistribution::InitializeArrays()
+
+
+//================================================================================================================
+
+
+void AliFlowAnalysisWithFittingQDistribution::BookCommonHistograms()
+{
+ // book common histograms
+ // common control histogram: 
+ TString commonHistName = "AliFlowCommonHistFQD";
+ commonHistName += fAnalysisLabel->Data();
+ fCommonHists = new AliFlowCommonHist(commonHistName.Data());
+ fHistList->Add(fCommonHists);  
+
+ // common histograms for final results:
+ TString commonHistResName = "AliFlowCommonHistResultsFQD";
+ commonHistResName += fAnalysisLabel->Data();
+ fCommonHistsResults = new AliFlowCommonHistResults(commonHistResName.Data());
+ fHistList->Add(fCommonHistsResults); 
+
+} // end of void AliFlowAnalysisWithFittingQDistribution::BookCommonHistograms(
+
+
+//================================================================================================================
+
+
+void AliFlowAnalysisWithFittingQDistribution::BookAndFillWeightsHistograms()
+{
+ // book and fill histograms which hold phi, pt and eta weights
+
+ if(!fWeightsList)
+ {
+  cout<<"WARNING: fWeightsList is NULL in AFAWFQD::BAFWH() !!!!"<<endl;
+  exit(0);  
+ }
+    
+ TString fUseParticleWeightsName = "fUseParticleWeightsFQD";
+ fUseParticleWeightsName += fAnalysisLabel->Data();
+ fUseParticleWeights = new TProfile(fUseParticleWeightsName.Data(),"0 = particle weight not used, 1 = particle weight used ",3,0,3);
+ fUseParticleWeights->SetLabelSize(0.06);
+ (fUseParticleWeights->GetXaxis())->SetBinLabel(1,"w_{#phi}");
+ (fUseParticleWeights->GetXaxis())->SetBinLabel(2,"w_{p_{T}}");
+ (fUseParticleWeights->GetXaxis())->SetBinLabel(3,"w_{#eta}");
+ fUseParticleWeights->Fill(0.5,(Int_t)fUsePhiWeights);
+ fUseParticleWeights->Fill(1.5,(Int_t)fUsePtWeights);
+ fUseParticleWeights->Fill(2.5,(Int_t)fUseEtaWeights);
+ fWeightsList->Add(fUseParticleWeights); 
+  
+ if(fUsePhiWeights)
+ {
+  if(fWeightsList->FindObject("phi_weights"))
+  {
+   fPhiWeights = dynamic_cast<TH1F*>(fWeightsList->FindObject("phi_weights"));
+   if(fPhiWeights->GetBinWidth(1) != fPhiBinWidth)
+   {
+    cout<<"WARNING: fPhiWeights->GetBinWidth(1) != fPhiBinWidth in AFAWFQD::BAFWH() !!!!        "<<endl;
+    cout<<"         This indicates inconsistent binning in phi histograms throughout the code."<<endl;
+    exit(0);
+   }
+  } else 
+    {
+     cout<<"WARNING: fWeightsList->FindObject(\"phi_weights\") is NULL in AFAWFQD::BAFWH() !!!!"<<endl;
+     exit(0);
+    }
+ } // end of if(fUsePhiWeights)
+ if(fUsePtWeights) 
+ {
+  if(fWeightsList->FindObject("pt_weights"))
+  {
+   fPtWeights = dynamic_cast<TH1D*>(fWeightsList->FindObject("pt_weights"));
+   if(fPtWeights->GetBinWidth(1) != fPtBinWidth)
+   {
+    cout<<"WARNING: fPtWeights->GetBinWidth(1) != fPtBinWidth in AFAWFQD::BAFWH() !!!!         "<<endl;
+    cout<<"         This indicates insconsistent binning in pt histograms throughout the code."<<endl;
+    exit(0);
+   }
+  } else 
+    {
+     cout<<"WARNING: fWeightsList->FindObject(\"pt_weights\") is NULL in AFAWFQD::BAFWH() !!!!"<<endl;
+     exit(0);
+    }
+ } // end of if(fUsePtWeights)    
+
+ if(fUseEtaWeights) 
+ {
+  if(fWeightsList->FindObject("eta_weights"))
+  {
+   fEtaWeights = dynamic_cast<TH1D*>(fWeightsList->FindObject("eta_weights"));
+   if(fEtaWeights->GetBinWidth(1) != fEtaBinWidth)
+   {
+    cout<<"WARNING: fEtaWeights->GetBinWidth(1) != fEtaBinWidth in AFAWFQD::BAFWH() !!!!        "<<endl;
+    cout<<"         This indicates insconsistent binning in eta histograms throughout the code."<<endl;
+    exit(0);
+   }
+  } else 
+    {
+     cout<<"WARNING: fUseEtaWeights && fWeightsList->FindObject(\"eta_weights\") is NULL in AFAWFQD::BAFWH() !!!!"<<endl;
+     exit(0);
+    }
+ } // end of if(fUseEtaWeights)
+} // end of AliFlowAnalysisWithFittingQDistribution::BookAndFillWeightsHistograms()
+
+
+//================================================================================================================================
+
+
+void AliFlowAnalysisWithFittingQDistribution::AccessConstants()
+{
+ // access needed common constants from AliFlowCommonConstants
+ fnBinsPhi = AliFlowCommonConstants::GetNbinsPhi();
+ fPhiMin = AliFlowCommonConstants::GetPhiMin();             
+ fPhiMax = AliFlowCommonConstants::GetPhiMax();
+ if(fnBinsPhi) fPhiBinWidth = (fPhiMax-fPhiMin)/fnBinsPhi;  
+ fnBinsPt = AliFlowCommonConstants::GetNbinsPt();
+ fPtMin = AliFlowCommonConstants::GetPtMin();       
+ fPtMax = AliFlowCommonConstants::GetPtMax();
+ if(fnBinsPt) fPtBinWidth = (fPtMax-fPtMin)/fnBinsPt;  
+ fnBinsEta = AliFlowCommonConstants::GetNbinsEta();
+ fEtaMin = AliFlowCommonConstants::GetEtaMin();             
+ fEtaMax = AliFlowCommonConstants::GetEtaMax();
+ if(fnBinsEta) fEtaBinWidth = (fEtaMax-fEtaMin)/fnBinsEta;  
+} // end of void AliFlowAnalysisWithFittingQDistribution::AccessConstants()
+
+
+//================================================================================================================================
+
+
+void AliFlowAnalysisWithFittingQDistribution::BookEverythingForDistributions()
+{
+ // book histograms for distributions
+ TString pWeightsFlag[2] = {"pWeights not used","pWeights used"};
+ TString sigmaFlag[2] = {"#sigma^{2} not fixed","#sigma^{2} fixed"};
+ // q-distribution:
+ TString fqDistributionName = "fqDistribution";
+ fqDistributionName += fAnalysisLabel->Data();
+ // sum of particle weights:
+ TString fSumOfParticleWeightsName = "fSumOfParticleWeightsName";
+ fSumOfParticleWeightsName += fAnalysisLabel->Data();
+ // final results for integrated flow:
+ TString fIntFlowName = "fIntFlowFQD";
+ fIntFlowName += fAnalysisLabel->Data();
+ // sigma^2:
+ TString fSigma2Name = "fSigma2";
+ fSigma2Name += fAnalysisLabel->Data();
+ for(Int_t pW=0;pW<1+(Int_t)(fUsePhiWeights||fUsePtWeights||fUseEtaWeights);pW++) // pW not used or used
+ {
+  // q-distribution:
+  fqDistribution[pW] = new TH1D(Form("%s, %s",fqDistributionName.Data(),pWeightsFlag[pW].Data()),"q-distribution",10000,0,1000);
+  fqDistribution[pW]->SetXTitle("q_{n}=Q_{n}/#sqrt{M}");
+  fqDistribution[pW]->SetYTitle("Counts");
+  fHistList->Add(fqDistribution[pW]);
+  // sum of particle weights: 
+  fSumOfParticleWeights[pW] = new TH1D(Form("%s, %s",fSumOfParticleWeightsName.Data(),pWeightsFlag[pW].Data()),"Sum of particle weights",1000,0,10000);
+  fSumOfParticleWeights[pW]->SetXTitle("#sum_{i=1}^{N} w_{i}");
+  fSumOfParticleWeights[pW]->SetYTitle("Counts");
+  fHistList->Add(fSumOfParticleWeights[pW]);
+  
+  for(Int_t f=0;f<2;f++) // sigma^2 not fixed or fixed
+  {
+   // final results for integrated flow:
+   fIntFlow[pW][f] = new TH1D(Form("%s, %s, %s",fIntFlowName.Data(),pWeightsFlag[pW].Data(),sigmaFlag[f].Data()),"Integrated Flow",1,0,1);
+   fIntFlow[pW][f]->SetLabelSize(0.08);
+   (fIntFlow[pW][f]->GetXaxis())->SetBinLabel(1,"v_{n}");
+   fHistList->Add(fIntFlow[pW][f]);
+   // sigma^2:
+   fSigma2[pW][f] = new TH1D(Form("%s, %s, %s",fSigma2Name.Data(),pWeightsFlag[pW].Data(),sigmaFlag[f].Data()),"#sigma^{2}",1,0,1);
+   fSigma2[pW][f]->SetLabelSize(0.08);
+   (fSigma2[pW][f]->GetXaxis())->SetBinLabel(1,"#sigma^{2}");
+   fHistList->Add(fSigma2[pW][f]);
+  } // end of for(Int_t f=0;f<2;f++) // sigma^2 not fixed or fixed
+  
+ } // end of for(Int_t pW=0;pW<1+(Int_t)(fUsePhiWeights||fUsePtWeights||fUseEtaWeights);pW++) // pW not used or used
+} // end of void AliFlowAnalysisWithFittingQDistribution::BookEverythingForDistributions()
+
+
+//================================================================================================================================
+
+
+void AliFlowAnalysisWithFittingQDistribution::DoFit(Bool_t useParticleWeights, Bool_t sigma2NotFixed)
+{
+ // do final fit to q-distribution
+ // shortcuts for flags:
+ Int_t pW = (Int_t)(useParticleWeights);
+ Int_t s2NF = (Int_t)(sigma2NotFixed);
+ for(Int_t f=0;f<2;f++)
+ {
+  if(!(fqDistribution[pW] && fSumOfParticleWeights[pW] && fIntFlow[pW][f] && fSigma2[pW][f])) 
+  { 
+   cout<<"WARNING: fqDistribution[pW] && fSumOfParticleWeights[pW] && fIntFlow[pW][f] && fSigma2[pw][f] is NULL in AFAWFQD::DoFit() !!!!"<<endl;
+   cout<<"pW = "<<pW<<endl;
+   cout<<"f  = "<<f<<endl;
+   exit(0);
+  }
+ }
+ // average multiplicity and number of events:
+ Double_t AvM = fSumOfParticleWeights[pW]->GetMean(1);
+ //Int_t nEvts = (Int_t)fSumOfParticleWeights[pW]->GetEntries();
+ // for fitting take into account only bins with at least 5 entries:
+ Int_t binMin = fqDistribution[pW]->FindFirstBinAbove(5); // to be improved (add setter for this)  
+ Int_t binMax = fqDistribution[pW]->FindLastBinAbove(5); // to be improved (add setter for this) 
+ Double_t binWidth = fqDistribution[pW]->GetBinWidth(4); // assuming that all bins have the same width 
+ if(binWidth == 0) 
+ {
+  cout<<"WARNING: binWidth == 0 in AFAWFQD::DoFit()"<<endl;
+  exit(0);
+ }
+ Double_t qmin = (binMin-1)*binWidth; 
+ Double_t qmax = (binMax)*binWidth;
+ Double_t ent = 0.; // number of entries between binMin and binMax:
+ for(Int_t b=binMin;b<=binMax;b++)
+ {
+  ent += fqDistribution[pW]->GetBinContent(b);
+ }
+ Double_t norm = binWidth*ent; // norm (assuming that all bins have the same width)
+
+ // fitting function:
+ TF1 *fittingFun = new TF1("fittingFun","[2]*(x/[1])*exp(-(x*x+[0]*[0])/(2.*[1]))*TMath::BesselI0(x*[0]/[1])",qmin,qmax); 
+ fittingFun->SetParNames("v*sqrt{sum of particle weights}","sigma^2","norm");
+ fittingFun->SetParameters(0.05*pow(AvM,0.5),0.75,norm); // to be improved (add setter for starting v)         
+ fittingFun->SetParLimits(0,0.0*pow(AvM,0.5),0.25*pow(AvM,0.5)); // to be improved (add setters for vmin and vmax)
+ if(s2NF)
+ {
+  fittingFun->SetParLimits(1,0.5,2.5); // to be improved (add setters for sigma^2_min and sigma^2_max)      
+ } else
+   {
+    fittingFun->FixParameter(1,0.5);
+   }
+ fittingFun->FixParameter(2,norm);  
+
+ // fitting (do it only if # of entries >50): // to be improved (this is only a pragmatics fix to avoid TMinuit crash)
+ if(ent > 50)
+ {
+  fqDistribution[pW]->Fit("fittingFun","NQ","",qmin,qmax);
+ }
+ // results:
+ Double_t v = 0.; // integrated flow
+ Double_t vError = 0.; // error of integrated flow 
+ Double_t sigma2 = 0.; // sigma^2
+ Double_t sigma2Error = 0.; // error of sigma^2
+ if(AvM)
+ { 
+  v = fittingFun->GetParameter(0)/pow(AvM,0.5);
+  vError = fittingFun->GetParError(0)/pow(AvM,0.5);
+  // store the results:
+  fIntFlow[pW][s2NF]->SetBinContent(1,v);
+  fIntFlow[pW][s2NF]->SetBinError(1,vError);
+ }
+ if(s2NF)
+ {
+  sigma2 = fittingFun->GetParameter(1);
+  sigma2Error = fittingFun->GetParError(1);
+  // store the results:
+  fSigma2[pW][0]->SetBinContent(1,sigma2);  
+  fSigma2[pW][0]->SetBinError(1,sigma2Error);  
+ } else // sigma^2 not fitted, but fixed to 0.5
+   {
+    // sigma2 = 0.5;
+    fSigma2[pW][1]->SetBinContent(1,0.5);  
+    fSigma2[pW][1]->SetBinError(1,0.);
+   }
+ // drawing:
+ //fqDistribution[pW]->Draw("");
+ //fittingFun->Draw("SAME");
+ // to be improved (fill chi)
+ //fchrFQD->FillChi(v*pow(AvM,0.5));
+ //RP:
+ //fchrFQD->FillIntegratedFlowRP(v,errorv);
+ //fchrFQD->FillChiRP(v*pow(AvM,0.5));
+} // end of void AliFlowAnalysisWithFittingQDistribution::DoFit(Bool_t useParticleWeights)
+
+
+//================================================================================================================================ 
+
+
+void AliFlowAnalysisWithFittingQDistribution::FillCommonHistResultsIntFlow(Bool_t useParticleWeights, Bool_t sigma2NotFixed)
+{
+ // fill in AliFlowCommonHistResults histograms relevant for 'NONAME' integrated flow (to be improved (name))
+ // shortcuts for the flags:
+ Int_t pW = (Int_t)(useParticleWeights); // 0 = pWeights not useed, 1 = pWeights used
+ Int_t s2NF = (Int_t)(sigma2NotFixed); // 0 = sigma^2 not fixed, 1 = sigma^2 fixed to 0.5
+ if(!fIntFlow[pW][s2NF])
+ {
+  cout<<"WARNING: fIntFlow[pW][s2NF] is NULL in AFAWFQD::FCHRIF() !!!!"<<endl;
+  cout<<"pW   = "<<pW<<endl;
+  cout<<"s2NF = "<<s2NF<<endl;
+  exit(0); 
+ }  
+ if(!(fCommonHistsResults))
+ {
+  cout<<"WARNING: fCommonHistsResults is NULL in AFAWFQD::FCHRIF() !!!!"<<endl; 
+  exit(0);
+ }
+  
+ Double_t v = fIntFlow[pW][s2NF]->GetBinContent(1); 
+ Double_t vError = fIntFlow[pW][s2NF]->GetBinError(1);
+ fCommonHistsResults->FillIntegratedFlow(v,vError);   
+} // end of void AliFlowAnalysisWithFittingQDistribution::FillCommonHistResultsIntFlow(Bool_t useParticleWeights, Bool_t sigma2NotFixed) 
+
+
+//================================================================================================================================ 
+
+
+void AliFlowAnalysisWithFittingQDistribution::PrintFinalResultsForIntegratedFlow()
+{
+ // print the final results for integrated flow on the screen
+ // shortcuts: pW   = particle weights 
+ //            s2NF = sigma^2 not fixed  
+ for(Int_t pW=0;pW<1+(Int_t)(fUsePhiWeights||fUsePtWeights||fUseEtaWeights);pW++)
+ {
+  if(!fSumOfParticleWeights[pW])
+  {
+   cout<<"WARNING: fSumOfParticleWeights[pW] is NULL in AFAWFQD::FCHRIF() !!!!"<<endl;
+   cout<<"pW = "<<pW<<endl;
+   exit(0);
+  }
+  for(Int_t s2NF=0;s2NF<2;s2NF++)
+  {
+   if(!fIntFlow[pW][s2NF])
+   {
+    cout<<"WARNING: fIntFlow[pW][s2NF] is NULL in AFAWFQD::FCHRIF() !!!!"<<endl;
+    cout<<"pW   = "<<pW<<endl;
+    cout<<"s2NF = "<<s2NF<<endl;
+    exit(0); 
+   }
+  }  
+ }  
+ if(!(fCommonHistsResults))
+ {
+  cout<<"WARNING: fCommonHistsResults is NULL in AFAWFQD::FCHRIF() !!!!"<<endl; 
+  exit(0);
+ }
+ // shortcut for the harmonic:
+ Int_t n = (Int_t)(fCommonHists->GetHarmonic())->GetBinContent(1); 
+
+ // printing:
+ cout<<" "<<endl;
+ cout<<"***************************************"<<endl;
+ cout<<"***************************************"<<endl;
+ cout<<"      integrated flow by fitting "<<endl;
+ cout<<"           q-distribution:      "<<endl;
+ if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)
+ {
+  cout<<"           (with weights)       "<<endl;
+ } else
+   {
+    cout<<"          (without weights)       "<<endl;
+   }   
+ cout<<endl;
+
+ if(fUsePhiWeights||fUsePtWeights||fUseEtaWeights)
+ {
+  cout<<"  v_"<<n<<"{FQD} = "<<fIntFlow[1][0]->GetBinContent(1)<<" +/- "<<fIntFlow[1][0]->GetBinError(1)
+    <<" (sigma^2 fitted = "<<fSigma2[1][0]->GetBinContent(1)<<")"<<endl; 
+  cout<<"  v_"<<n<<"{FQD} = "<<fIntFlow[1][1]->GetBinContent(1)<<" +/- "<<fIntFlow[1][1]->GetBinError(1)
+    <<" (sigma^2 fixed = 0.5"<<")"<<endl; 
+  cout<<" "<<endl; 
+  cout<<"      nEvts = "<<fSumOfParticleWeights[1]->GetEntries()<<", AvM = "<<fSumOfParticleWeights[1]->GetMean()<<endl;
+  cout<<" "<<endl;
+ } else
+   { 
+    cout<<"  v_"<<n<<"{FQD} = "<<fIntFlow[0][0]->GetBinContent(1)<<" +/- "<<fIntFlow[0][0]->GetBinError(1)
+     <<" (sigma^2 fitted = "<<fSigma2[0][0]->GetBinContent(1)<<")"<<endl; 
+    cout<<"  v_"<<n<<"{FQD} = "<<fIntFlow[0][1]->GetBinContent(1)<<" +/- "<<fIntFlow[0][1]->GetBinError(1)
+     <<" (sigma^2 fixed = 0.5"<<")"<<endl; 
+    cout<<" "<<endl;  
+    cout<<"      nEvts = "<<fSumOfParticleWeights[0]->GetEntries()<<", AvM = "<<fSumOfParticleWeights[0]->GetMean()<<endl;
+    cout<<" "<<endl;
+   }
+    
+ cout<<"***************************************"<<endl;
+ cout<<"***************************************"<<endl; 
+} // end of void AliFlowAnalysisWithFittingQDistribution::PrintFinalResultsForIntegratedFlow()
+
+
+//================================================================================================================================ 
diff --git a/PWG2/FLOW/AliFlowCommon/AliFlowAnalysisWithFittingQDistribution.h b/PWG2/FLOW/AliFlowCommon/AliFlowAnalysisWithFittingQDistribution.h
new file mode 100644 (file)
index 0000000..c3910d5
--- /dev/null
@@ -0,0 +1,153 @@
+/* 
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. 
+ * See cxx source for full Copyright notice 
+ * $Id$ 
+ */
+
+/******************************** 
+ * integrated flow estimate by  *
+ *   fitting q-distribution     * 
+ *                              *
+ * author: Ante Bilandzic       * 
+ *          (anteb@nikhef.nl)   *
+ *                              *  
+ *  based on the macro written  *
+ *     by Sergei Voloshin       *
+ *******************************/ 
+#ifndef ALIFLOWANALYSISWITHFITTINGQDISTRIBUTION_H
+#define ALIFLOWANALYSISWITHFITTINGQDISTRIBUTION_H
+
+#include "AliFlowCommonConstants.h"
+
+class TObjArray;
+class TList;
+class TFile;
+
+class TH1;
+class TProfile;
+
+class AliFlowEventSimple;
+class AliFlowTrackSimple;
+class AliFlowCommonHist;
+class AliFlowCommonHistResults;
+class AliFlowVector;
+
+//================================================================================================================
+
+class AliFlowAnalysisWithFittingQDistribution{
+ public:
+  AliFlowAnalysisWithFittingQDistribution();
+  virtual ~AliFlowAnalysisWithFittingQDistribution(); 
+  // 0.) methods called in the constructor:
+  virtual void InitializeArrays();
+  // 1.) method Init() and methods called within Init():
+  virtual void Init();
+   virtual void AccessConstants();
+   virtual void BookCommonHistograms();
+   virtual void BookAndFillWeightsHistograms();
+   virtual void BookEverythingForDistributions();
+  // 2.) method Make() and methods called within Make(): 
+  virtual void Make(AliFlowEventSimple* anEvent);
+  // 3.) method Finish() and methods called within Finish(): 
+  virtual void Finish(Bool_t doFit = kTRUE);
+   virtual void DoFit(Bool_t useParticleWeights, Bool_t sigma2NotFixed);
+   virtual void FillCommonHistResultsIntFlow(Bool_t useParticleWeights, Bool_t sigma2NotFixed);
+   virtual void PrintFinalResultsForIntegratedFlow();
+  // 4.) other methods:
+  virtual void GetOutputHistograms(TList *outputListHistos); 
+  virtual void WriteHistograms(TString *outputFileName);
+  virtual void WriteHistograms(TString outputFileName);
+    
+  // **** SETTERS and GETTERS ****
+  
+  // 0.) base:                                                                                              
+  TList* GetHistList() const {return this->fHistList;} 
+  // 1.) common:
+  void SetCommonHists(AliFlowCommonHist* const ch) {this->fCommonHists = ch;};
+  AliFlowCommonHist* GetCommonHists() const {return this->fCommonHists;};
+  void SetCommonHistsResults(AliFlowCommonHistResults* const chr) {this->fCommonHistsResults = chr;};
+  AliFlowCommonHistResults* GetCommonHistsResults() const {return this->fCommonHistsResults;};
+  void SetHarmonic(Int_t const harmonic) {this->fHarmonic = harmonic;};
+  Int_t GetHarmonic() const {return this->fHarmonic;};
+  void SetAnalysisLabel(const char *aLabel) {this->fAnalysisLabel->Append(*aLabel);};
+  TString *GetAnalysisLabel() const {return this->fAnalysisLabel;};
+  
+  // 2.) weights:
+  void SetWeightsList(TList* wlist) {this->fWeightsList = (TList*)wlist->Clone();};
+  TList* GetWeightsList() const {return this->fWeightsList;}  
+  void SetUsePhiWeights(Bool_t const uPhiW) {this->fUsePhiWeights = uPhiW;};
+  Bool_t GetUsePhiWeights() const {return this->fUsePhiWeights;};
+  void SetUsePtWeights(Bool_t const uPtW) {this->fUsePtWeights = uPtW;};
+  Bool_t GetUsePtWeights() const {return this->fUsePtWeights;};
+  void SetUseEtaWeights(Bool_t const uEtaW) {this->fUseEtaWeights = uEtaW;};
+  Bool_t GetUseEtaWeights() const {return this->fUseEtaWeights;};
+  void SetUseParticleWeights(TProfile* const uPW) {this->fUseParticleWeights = uPW;};
+  TProfile* GetUseParticleWeights() const {return this->fUseParticleWeights;};
+  void SetPhiWeights(TH1F* const histPhiWeights) {this->fPhiWeights = histPhiWeights;};
+  TH1F* GetPhiWeights() const {return this->fPhiWeights;};
+  void SetPtWeights(TH1D* const histPtWeights) {this->fPtWeights = histPtWeights;};
+  TH1D* GetPtWeights() const {return this->fPtWeights;};
+  void SetEtaWeights(TH1D* const histEtaWeights) {this->fEtaWeights = histEtaWeights;};
+  TH1D* GetEtaWeights() const {return this->fEtaWeights;};
+  // 3.) distributions:
+  void SetSumOfParticleWeights(TH1D* const sopW, Int_t pW) {this->fSumOfParticleWeights[pW] = sopW;};
+  TH1D* GetSumOfParticleWeights(Int_t pW) const {return this->fSumOfParticleWeights[pW];};
+  void SetqDistribution(TH1D* const qd, Int_t pW) {this->fqDistribution[pW] = qd;};
+  TH1D* GetqDistribution(Int_t pW) const {return this->fqDistribution[pW];};
+  // 4.) final results of fitting:
+  void SetIntFlow(TH1D* const intFlow, Int_t pW, Int_t sigmaFixed) {this->fIntFlow[pW][sigmaFixed] = intFlow;};
+  TH1D* GetIntFlow(Int_t pW, Int_t sigmaFixed) const {return this->fIntFlow[pW][sigmaFixed];};
+  void SetSigma2(TH1D* const sigma2, Int_t pW, Int_t sigmaFixed) {this->fSigma2[pW][sigmaFixed] = sigma2;};
+  TH1D* GetSigma2(Int_t pW, Int_t sigmaFixed) const {return this->fSigma2[pW][sigmaFixed];};
+  
+ private:
+  AliFlowAnalysisWithFittingQDistribution(const AliFlowAnalysisWithFittingQDistribution &afawfqd);
+  AliFlowAnalysisWithFittingQDistribution& operator=(const AliFlowAnalysisWithFittingQDistribution &afawfqd);
+             
+  // 0.) base:
+  TList *fHistList; // base list to hold all output object
+  // 1.) common:
+  AliFlowCommonHist *fCommonHists; // common control histograms 
+  AliFlowCommonHistResults *fCommonHistsResults; // final results in common histograms
+  Int_t fnBinsPhi; // number of phi bins
+  Double_t fPhiMin; // minimum phi   
+  Double_t fPhiMax; // maximum phi 
+  Double_t fPhiBinWidth; // bin width for phi histograms  
+  Int_t fnBinsPt; // number of pt bins
+  Double_t fPtMin; // minimum pt   
+  Double_t fPtMax; // maximum pt  
+  Double_t fPtBinWidth; // bin width for pt histograms  
+  Int_t fnBinsEta; // number of eta bins
+  Double_t fEtaMin; // minimum eta   
+  Double_t fEtaMax; // maximum eta
+  Double_t fEtaBinWidth; // bin width for eta histograms 
+  Int_t fHarmonic; // harmonic 
+  TString *fAnalysisLabel; // analysis label (all histograms and output file will have this label)
+  // 2.) particle weights (abbreviated to 'pWeights' or even to 'pW' throughout the code):
+  TList *fWeightsList; // list to hold all histograms with particle weights: fUseParticleWeights, fPhiWeights, fPtWeights and fEtaWeights
+  Bool_t fUsePhiWeights; // use phi weights
+  Bool_t fUsePtWeights; // use pt weights
+  Bool_t fUseEtaWeights; // use eta weights
+  TProfile *fUseParticleWeights; // profile with three bins to hold values of fUsePhiWeights, fUsePtWeights and fUseEtaWeights
+  TH1F *fPhiWeights; // histogram holding phi weights
+  TH1D *fPtWeights; // histogram holding phi weights
+  TH1D *fEtaWeights; // histogram holding phi weights 
+  // 3.) distributions:
+  TH1D *fSumOfParticleWeights[2]; // [0=particle weights are unit (not used), 1=particle weights are used]
+  TH1D *fqDistribution[2]; // distribution of Q/sqrt{sum of particle weights} [0=particle weights are unit (not used), 1=particle weights are used]
+  // 4.) final results of fitting:
+  TH1D *fIntFlow[2][2]; // final result for integrated flow [0=pWeights are unit (not used), 1=pWeights are used][0=sigma^2 not fixed, 1=sigma^2 fixed to 1/2]  
+  TH1D *fSigma2[2][2]; // final results for sigma^2 [0=pWeights are unit (not used), 1=pWeights are used][0=sigma^2 not fixed, 1=sigma^2 fixed to 1/2]
+    
+  ClassDef(AliFlowAnalysisWithFittingQDistribution, 0);
+};
+
+//================================================================================================================
+
+#endif
+
+
+
+
+
index c95f5b296f4ead3b9b45c7910167cdaae8d6d39c..3a62849a1b4ba773b00b2a85828e3fb6bb0dad1b 100644 (file)
 
 #include "AliFlowEventSimple.h"
 #include "AliAnalysisTaskFittingQDistribution.h"
-#include "AliFittingQDistribution.h"
+#include "AliFlowAnalysisWithFittingQDistribution.h"
 #include "AliFlowCommonConstants.h"
 #include "AliFlowCommonHistResults.h"
-#include "AliFittingFunctionsForQDistribution.h"
 
 ClassImp(AliAnalysisTaskFittingQDistribution)
 
@@ -104,7 +103,7 @@ void AliAnalysisTaskFittingQDistribution::CreateOutputObjects()
   
   
   //analyser
-  fFQDA = new AliFittingQDistribution();
+  fFQDA = new AliFlowAnalysisWithFittingQDistribution();
   fFQDA->Init();
   
   //weights:
@@ -154,7 +153,7 @@ void AliAnalysisTaskFittingQDistribution::Terminate(Option_t *)
   fListHistos = (TList*)GetOutputData(0);
   //fListHistos->Print();
   
-  fFQDA = new AliFittingQDistribution();
+  fFQDA = new AliFlowAnalysisWithFittingQDistribution();
   
   if(fListHistos) 
   {         
index 8a7baf1d6bb77ed2205579b98af99d228bda8469..310f89952beb83dd63720816bcdc16b940849c0b 100644 (file)
@@ -25,7 +25,7 @@
 class AliESDEvent;
 class AliAODEvent;
 class AliCFManager;
-class AliFittingQDistribution;
+class AliFlowAnalysisWithFittingQDistribution;
 class AliFlowEventSimpleMaker;
 class TFile;
 
@@ -50,7 +50,7 @@ class AliAnalysisTaskFittingQDistribution : public AliAnalysisTask{
   AliAnalysisTaskFittingQDistribution& operator=(const AliAnalysisTaskFittingQDistribution& aatfqd);
 
   AliFlowEventSimple* fEvent;             // the input event
-  AliFittingQDistribution* fFQDA;         // Fitting q-distribution Analysis (FQDA) object
+  AliFlowAnalysisWithFittingQDistribution* fFQDA;         // Fitting q-distribution Analysis (FQDA) object
   TList  *fListHistos;                    // collection of output 
      
   Bool_t       fUseWeights;               // use any weights
index a7a16daa9c423eb431b9a2315b410e471b0937b6..d45407cc45e87c8bbcd6c374e79d5220a2ab348a 100644 (file)
@@ -199,7 +199,7 @@ void redoFinish(TString type="", Int_t mode=mLocal)
    }
  if(mergedListFQD)
  {
-  AliFittingQDistribution* fqd = new AliFittingQDistribution();
+  AliFlowAnalysisWithFittingQDistribution* fqd = new AliFlowAnalysisWithFittingQDistribution();
   fqd->GetOutputHistograms(mergedListFQD);
   fqd->Finish(kTRUE);
   // save the final results for FQD in final output file: 
@@ -672,7 +672,7 @@ void redoFinish(TString type="", Int_t mode=mLocal)
      }
      if(mergedListInSubsetFQD)
      {
-      AliFittingQDistribution *fqd = new AliFittingQDistribution();
+      AliFlowAnalysisWithFittingQDistribution *fqd = new AliFlowAnalysisWithFittingQDistribution();
       fqd->GetOutputHistograms(mergedListInSubsetFQD);
       cout<<endl;
       cout<<"!!!! WARNING WARNING WARNING WARNING !!!!"<<endl;
index 7e167795c541c857fb87c1a30625dacd43f17894..0bec2a279e4979c7b2c1fbf6573c1baf69e05e6a 100644 (file)
@@ -136,16 +136,16 @@ int runFlowAnalysis(Int_t mode=mLocal, Int_t aRuns = 10, const char*
   }
 
   //flow methods:  
-  AliFlowAnalysisWithQCumulants    *qc       = NULL;
-  AliFlowAnalysisWithCumulants     *gfc      = NULL;
-  AliFittingQDistribution          *fqd      = NULL;
-  AliFlowAnalysisWithLeeYangZeros  *lyz1sum  = NULL;
-  AliFlowAnalysisWithLeeYangZeros  *lyz1prod = NULL;
-  AliFlowAnalysisWithLeeYangZeros  *lyz2sum  = NULL;
-  AliFlowAnalysisWithLeeYangZeros  *lyz2prod = NULL;
-  AliFlowAnalysisWithLYZEventPlane *lyzep    = NULL;
-  AliFlowAnalysisWithScalarProduct *sp       = NULL;
-  AliFlowAnalysisWithMCEventPlane  *mcep     = NULL;   
+  AliFlowAnalysisWithQCumulants *qc = NULL;
+  AliFlowAnalysisWithCumulants *gfc = NULL;
+  AliFlowAnalysisWithFittingQDistribution *fqd = NULL;
+  AliFlowAnalysisWithLeeYangZeros *lyz1sum = NULL;
+  AliFlowAnalysisWithLeeYangZeros *lyz1prod = NULL;
+  AliFlowAnalysisWithLeeYangZeros *lyz2sum = NULL;
+  AliFlowAnalysisWithLeeYangZeros *lyz2prod = NULL;
+  AliFlowAnalysisWithLYZEventPlane *lyzep = NULL;
+  AliFlowAnalysisWithScalarProduct *sp = NULL;
+  AliFlowAnalysisWithMCEventPlane *mcep = NULL;   
 
   //MCEP = monte carlo event plane
   if (MCEP) {
@@ -175,7 +175,7 @@ int runFlowAnalysis(Int_t mode=mLocal, Int_t aRuns = 10, const char*
   
   //FQD = Fitting q-distribution 
   if(FQD) {
-    AliFittingQDistribution* fqd = new AliFittingQDistribution();
+    AliFlowAnalysisWithFittingQDistribution* fqd = new AliFlowAnalysisWithFittingQDistribution();
     fqd->Init();
     if(listWithWeights) fqd->SetWeightsList(listWithWeights);
     if(usePhiWeights) fqd->SetUsePhiWeights(usePhiWeights);
@@ -554,7 +554,6 @@ void LoadLibraries(const anaModes mode) {
     
     // Functions needed for various methods
     gROOT->LoadMacro("AliFlowCommon/AliCumulantsFunctions.cxx+");
-    gROOT->LoadMacro("AliFlowCommon/AliFittingFunctionsForQDistribution.cxx+");
     gROOT->LoadMacro("AliFlowCommon/AliFlowLYZEventPlane.cxx+");
     
     // Flow Analysis code for various methods
@@ -564,7 +563,7 @@ void LoadLibraries(const anaModes mode) {
     gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithLeeYangZeros.cxx+");
     gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithCumulants.cxx+");
     gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithQCumulants.cxx+"); 
-    gROOT->LoadMacro("AliFlowCommon/AliFittingQDistribution.cxx+");
+    gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithFittingQDistribution.cxx+");
     
     // Class to fill the FlowEvent without aliroot dependence
     // can be found in the directory FlowEventMakers
index d1964f3f8cd794ff9ddfb121d029138325bda4c3..5b8e1b7ced4f4b01bf3335f057b3d9712348c6e9 100644 (file)
@@ -24,6 +24,12 @@ Bool_t usePhiWeights = kFALSE; // phi weights (correction for non-uniform azimut
 Bool_t usePtWeights  = kFALSE; // pt weights 
 Bool_t useEtaWeights = kFALSE; // eta weights
 
+// Run same flow analysis method but with different settings/aims
+// You will have to label each setting/aim with your own label (see examples bellow): 
+Bool_t GFC_Additional_Analysis = kFALSE;
+Bool_t QC_Additional_Analysis  = kFALSE;
+Bool_t FQD_Additional_Analysis = kFALSE;
+
 // Parameters for the simulation of events 'on the fly': 
 Bool_t bSameSeed = kFALSE; // use always the same seed for random generators. 
                            // usage of same seed (kTRUE) is relevant in two cases:
@@ -102,7 +108,7 @@ enum anaModes {mLocal,mLocalSource,mLocalPAR};
 // mLocalPAR: Analyze data on your computer using root + PAR files
 // mLocalSource: Analyze data on your computer using root + source files
                                           
-int runFlowAnalysisOnTheFly(Int_t mode=mLocal, Int_t nEvts=440)
+int runFlowAnalysisOnTheFly(Int_t mode=mLocal, Int_t nEvts=4400)
 {
  TStopwatch timer;
  timer.Start();
@@ -189,17 +195,17 @@ int runFlowAnalysisOnTheFly(Int_t mode=mLocal, Int_t nEvts=440)
  eventMakerOnTheFly->Init();
   
  //---------------------------------------------------------------------------------------
- // Initialize all the flow methods:  
- AliFlowAnalysisWithQCumulants    *qc       = NULL;
- AliFlowAnalysisWithCumulants     *gfc      = NULL;
- AliFittingQDistribution          *fqd      = NULL;
- AliFlowAnalysisWithLeeYangZeros  *lyz1sum  = NULL;
- AliFlowAnalysisWithLeeYangZeros  *lyz1prod = NULL;
- AliFlowAnalysisWithLeeYangZeros  *lyz2sum  = NULL;
- AliFlowAnalysisWithLeeYangZeros  *lyz2prod = NULL;
- AliFlowAnalysisWithLYZEventPlane *lyzep    = NULL;
- AliFlowAnalysisWithScalarProduct *sp       = NULL;
- AliFlowAnalysisWithMCEventPlane  *mcep     = NULL;   
+ // Initialize all the flow methods for default analysis:  
+ AliFlowAnalysisWithQCumulants *qc = NULL;
+ AliFlowAnalysisWithCumulants *gfc = NULL;
+ AliFlowAnalysisWithFittingQDistribution *fqd = NULL;
+ AliFlowAnalysisWithLeeYangZeros *lyz1sum  = NULL;
+ AliFlowAnalysisWithLeeYangZeros *lyz1prod = NULL;
+ AliFlowAnalysisWithLeeYangZeros *lyz2sum  = NULL;
+ AliFlowAnalysisWithLeeYangZeros *lyz2prod = NULL;
+ AliFlowAnalysisWithLYZEventPlane *lyzep = NULL;
+ AliFlowAnalysisWithScalarProduct *sp = NULL;
+ AliFlowAnalysisWithMCEventPlane *mcep = NULL;   
 
  // MCEP = monte carlo event plane
  if (MCEP) {
@@ -207,32 +213,34 @@ int runFlowAnalysisOnTheFly(Int_t mode=mLocal, Int_t nEvts=440)
    mcep->Init();
  }
 
 // QC = Q-cumulants  
+ // QC = Q-cumulants  
  if(QC) { 
    AliFlowAnalysisWithQCumulants* qc = new AliFlowAnalysisWithQCumulants();
-   qc->Init();
    if(listWithWeights) qc->SetWeightsList(listWithWeights);
    if(usePhiWeights) qc->SetUsePhiWeights(usePhiWeights);
    if(usePtWeights) qc->SetUsePtWeights(usePtWeights);
    if(useEtaWeights) qc->SetUseEtaWeights(useEtaWeights);
+   qc->SetEvaluateNestedLoopsForIntFlow(kFALSE);
+   qc->SetEvaluateNestedLoopsForDiffFlow(kFALSE);
+   qc->Init();  
  }
   
  // GFC = Generating Function Cumulants 
  if(GFC) {
    AliFlowAnalysisWithCumulants* gfc = new AliFlowAnalysisWithCumulants();
-   gfc->Init();
    if(listWithWeights) gfc->SetWeightsList(listWithWeights);
    if(usePhiWeights) gfc->SetUsePhiWeights(usePhiWeights);
    if(usePtWeights) gfc->SetUsePtWeights(usePtWeights);
    if(useEtaWeights) gfc->SetUseEtaWeights(useEtaWeights);
+   gfc->Init();
  }
  
  // FQD = Fitting q-distribution 
  if(FQD) {
-   AliFittingQDistribution* fqd = new AliFittingQDistribution();
-   fqd->Init();
+   AliFlowAnalysisWithFittingQDistribution* fqd = new AliFlowAnalysisWithFittingQDistribution();
    if(listWithWeights) fqd->SetWeightsList(listWithWeights);
    if(usePhiWeights) fqd->SetUsePhiWeights(usePhiWeights);  
+   fqd->Init();
  }
  
  // SP = Scalar Product 
@@ -322,6 +330,67 @@ int runFlowAnalysisOnTheFly(Int_t mode=mLocal, Int_t nEvts=440)
    }
  }
  //---------------------------------------------------------------------------------------
+ //---------------------------------------------------------------------------------------
+ // Initialize all the flow methods for additional analysis with different settings/aims
+ // Label each setting/aim with different label !!!!
+ // GFC:    
+ TString gfcDefaultName = "outputGFCanalysis"; 
+ // 1.) GFC analysis for elliptic flow with r0 = 1.5: 
+ AliFlowAnalysisWithCumulants *gfc_1;
+ TString gfcAnalysisLabels_1 = "_r0_1.5"; // all histograms and output file name will have this label
+ TString gfcOutputFileName_1;
+ gfcOutputFileName_1 = gfcDefaultName.Data();
+ gfcOutputFileName_1 += gfcAnalysisLabels_1.Data();
+ gfcOutputFileName_1 += ".root";
+ if(GFC_Additional_Analysis)
+ {
+  gfc_1 = new AliFlowAnalysisWithCumulants();
+  //gfc_1->SetAnalysisLabel(gfcAnalysisLabels_1.Data());
+  if(listWithWeights) gfc_1->SetWeightsList(listWithWeights);
+  if(usePhiWeights) gfc_1->SetUsePhiWeights(usePhiWeights);
+  if(usePtWeights) gfc_1->SetUsePtWeights(usePtWeights);
+  if(useEtaWeights) gfc_1->SetUseEtaWeights(useEtaWeights);
+  gfc_1->Init();
+ }
+ // QC:
+ TString qcDefaultName = "outputQCanalysis"; 
+ // 1.) QC analysis for directed flow: 
+ AliFlowAnalysisWithQCumulants *qc_1;
+ TString qcAnalysisLabels_1 = "_v1"; // all histograms and output file name will have this label
+ TString qcOutputFileName_1;
+ qcOutputFileName_1 = qcDefaultName.Data();
+ qcOutputFileName_1 += qcAnalysisLabels_1.Data();
+ qcOutputFileName_1 += ".root";
+ if(QC_Additional_Analysis)
+ {
+  qc_1 = new AliFlowAnalysisWithQCumulants();
+  //qc_1->SetAnalysisLabel(qcAnalysisLabels_1->Data());
+  if(listWithWeights) qc_1->SetWeightsList(listWithWeights);
+  if(usePhiWeights) qc_1->SetUsePhiWeights(usePhiWeights);
+  qc_1->Init();
+ }
+ // FQD:
+ TString fqdDefaultName = "outputFQDanalysis";
+ // 1.) FQD fitting with fixed sigma:
+ AliFlowAnalysisWithFittingQDistribution *fqd_1;
+ TString fqdAnalysisLabels_1 = "_fixedSigma"; // all histograms and output file name will have this label
+ TString fqdOutputFileName_1;
+ fqdOutputFileName_1 = fqdDefaultName.Data();
+ fqdOutputFileName_1 += fqdAnalysisLabels_1.Data();
+ fqdOutputFileName_1 += ".root";
+ if(FQD_Additional_Analysis)
+ { 
+  fqd_1 = new AliFlowAnalysisWithFittingQDistribution();
+  //fqd_1->SetAnalysisLabel(fqdAnalysisLabels_1->Data());
+  if(listWithWeights) fqd_1->SetWeightsList(listWithWeights);
+  if(usePhiWeights) fqd_1->SetUsePhiWeights(usePhiWeights);
+  fqd_1->Init();
+ }
+ //---------------------------------------------------------------------------------------
   
  // set the global event parameters: 
  eventMakerOnTheFly->SetNoOfLoops(iLoops);
@@ -401,6 +470,22 @@ int runFlowAnalysisOnTheFly(Int_t mode=mLocal, Int_t nEvts=440)
    if(LYZEP)   lyzep->Make(event,ep);
    if(SP)      sp->Make(event);
    
+   if(GFC_Additional_Analysis)
+   {
+    // r0 = 1.5:
+    gfc_1->Make(event);
+   }
+   if(QC_Additional_Analysis)
+   {
+    // v1:
+    qc_1->Make(event);
+   }
+   if(FQD_Additional_Analysis)
+   {
+    // fixed sigma:
+    fqd_1->Make(event);
+   }
+   
    delete event;
  } // end of for(Int_t i=0;i<nEvts;i++)
  //---------------------------------------------------------------------------------------  
@@ -408,7 +493,7 @@ int runFlowAnalysisOnTheFly(Int_t mode=mLocal, Int_t nEvts=440)
 
 
  //---------------------------------------------------------------------------------------  
- // calculating and storing the final results of flow analysis
+ // calculating and storing the final results of default flow analysis:
  if(MCEP)    {mcep->Finish();    mcep->WriteHistograms("outputMCEPanalysis.root");}
  if(SP)      {sp->Finish();      sp->WriteHistograms("outputSPanalysis.root");}
  if(QC)      {qc->Finish();      qc->WriteHistograms("outputQCanalysis.root");}
@@ -421,7 +506,27 @@ int runFlowAnalysisOnTheFly(Int_t mode=mLocal, Int_t nEvts=440)
  if(LYZEP)   {lyzep->Finish();   lyzep->WriteHistograms("outputLYZEPanalysis.root");}
  //---------------------------------------------------------------------------------------  
  
+ //---------------------------------------------------------------------------------------  
+ // calculating and storing the final results of flow analysis with different settings/aims:
+ if(GFC_Additional_Analysis)
+ {
+  // r0 = 1.5:
+  gfc_1->Finish();
+  gfc_1->WriteHistograms(gfcOutputFileName_1.Data());
+ }
+ if(QC_Additional_Analysis)
+ {
+  // v1:
+  qc_1->Finish();
+  qc_1->WriteHistograms(qcOutputFileName_1.Data());
+ }
+ if(FQD_Additional_Analysis)
+ {
+  // fixed sigma:
+  fqd_1->Finish();
+  fqd_1->WriteHistograms(fqdOutputFileName_1.Data());
+ }
+ //---------------------------------------------------------------------------------------
  
  cout<<endl;
  cout<<endl;
@@ -562,7 +667,6 @@ void LoadLibraries(const anaModes mode) {
     
     // Functions needed for various methods
     gROOT->LoadMacro("AliFlowCommon/AliCumulantsFunctions.cxx+");
-    gROOT->LoadMacro("AliFlowCommon/AliFittingFunctionsForQDistribution.cxx+");
     gROOT->LoadMacro("AliFlowCommon/AliFlowLYZEventPlane.cxx+");
     
     // Flow Analysis code for various methods
@@ -572,7 +676,7 @@ void LoadLibraries(const anaModes mode) {
     gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithLeeYangZeros.cxx+");
     gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithCumulants.cxx+");
     gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithQCumulants.cxx+"); 
-    gROOT->LoadMacro("AliFlowCommon/AliFittingQDistribution.cxx+");
+    gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithFittingQDistribution.cxx+");
     
     // Class to fill the FlowEvent on the fly (generate Monte Carlo events)
     gROOT->LoadMacro("AliFlowCommon/AliFlowEventSimpleMakerOnTheFly.cxx+");   
index 7cfee0ff2c4a41541f925c3918e65c5ebcc44ec6..feff1b4186a75eaec107876ad0dfc2dea6e71aba 100644 (file)
@@ -33,9 +33,9 @@ Bool_t WEIGHTS[] = {kFALSE,kFALSE,kFALSE}; //Phi, v'(pt), v'(eta)
                 //const Char_t* dataDir="/data/alice2/kolk/PP/LHC09a4/81119", Int_t offset = 0)
                 //const Char_t* dataDir="/data/alice2/kolk/Therminator_midcentral", Int_t offset = 0)
                 //const Char_t* dataDir="/Users/snelling/alice_data/Therminator_midcentral", Int_t offset = 0)
-void runFlowTask(Int_t mode=mPROOF, Int_t nRuns = 1000, 
-                //const Char_t* dataDir="/COMMON/COMMON/LHC09a4_run8158X", Int_t offset = 0)
-                const Char_t* dataDir="/PWG2/akisiel/Therminator_midcentral_ESD", Int_t offset=0)
+void runFlowTask(Int_t mode=mPROOF, Int_t nRuns = 1000000
+                const Char_t* dataDir="/COMMON/COMMON/LHC09a14_0.9TeV_0.5T", Int_t offset = 0)
+                 //const Char_t* dataDir="/PWG2/akisiel/Therminator_midcentral_ESD", Int_t offset=0)
 {
   TStopwatch timer;
   timer.Start();
index 807415170a14aeb4648715ebab838e69bc7dcdbc..bdbcf440f1e861722c55c60dd706260344137f58 100644 (file)
@@ -22,7 +22,6 @@
 #pragma link C++ class AliFlowLYZHist2+;
 
 #pragma link C++ class AliCumulantsFunctions+;
-#pragma link C++ class AliFittingFunctionsForQDistribution+;
 #pragma link C++ class AliFlowLYZEventPlane+;
 
 #pragma link C++ class AliFlowAnalysisWithMCEventPlane+;
@@ -31,6 +30,6 @@
 #pragma link C++ class AliFlowAnalysisWithLeeYangZeros+;
 #pragma link C++ class AliFlowAnalysisWithCumulants+;
 #pragma link C++ class AliFlowAnalysisWithQCumulants+;
-#pragma link C++ class AliFittingQDistribution+;
+#pragma link C++ class AliFlowAnalysisWithFittingQDistribution+;
 
 #endif
index 5db61192a5a60973ffd634f2fab6c1137d51f4c8..985068900e9b67527803771d115729ab14285f36 100644 (file)
@@ -19,9 +19,8 @@ SRCS= FLOW/AliFlowCommon/AliFlowEventSimple.cxx \
       FLOW/AliFlowCommon/AliFlowAnalysisWithLeeYangZeros.cxx \
       FLOW/AliFlowCommon/AliFlowAnalysisWithCumulants.cxx \
       FLOW/AliFlowCommon/AliFlowAnalysisWithQCumulants.cxx \
-      FLOW/AliFlowCommon/AliFittingQDistribution.cxx \
       FLOW/AliFlowCommon/AliCumulantsFunctions.cxx \
-      FLOW/AliFlowCommon/AliFittingFunctionsForQDistribution.cxx
+      FLOW/AliFlowCommon/AliFlowAnalysisWithFittingQDistribution.cxx
 
 HDRS= $(SRCS:.cxx=.h)