Added analysis task for the cumulants (still some work to do)
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 Jun 2008 11:44:22 +0000 (11:44 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 Jun 2008 11:44:22 +0000 (11:44 +0000)
PWG2/FLOW/AliAnalysisTaskCumulants.cxx [new file with mode: 0644]
PWG2/FLOW/AliAnalysisTaskCumulants.h [new file with mode: 0644]
PWG2/FLOW/AliFlowAnalysisWithCumulants.cxx
PWG2/FLOW/AliFlowAnalysisWithCumulants.h
PWG2/FLOW/macros/runAliAnalysisTaskCumulants.C [new file with mode: 0644]
PWG2/FLOW/macros/runCumulantsOnKine.C [new file with mode: 0644]
PWG2/PWG2flowLinkDef.h
PWG2/libPWG2flow.pkg

diff --git a/PWG2/FLOW/AliAnalysisTaskCumulants.cxx b/PWG2/FLOW/AliAnalysisTaskCumulants.cxx
new file mode 100644 (file)
index 0000000..75778e0
--- /dev/null
@@ -0,0 +1,265 @@
+/*************************************************************************
+* 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.                  * 
+**************************************************************************/
+
+#include "Riostream.h" //needed as include
+#include "TChain.h"
+#include "TTree.h"
+#include "TFile.h"
+
+
+class AliAnalysisTask;
+#include "AliAnalysisManager.h"
+
+#include "AliESDEvent.h"
+#include "AliESDInputHandler.h"
+
+#include "AliAODEvent.h"
+#include "AliAODInputHandler.h"
+
+#include "AliMCEventHandler.h"
+#include "AliMCEvent.h"
+
+#include "AliAnalysisTaskCumulants.h"
+#include "AliFlowEventSimpleMaker.h"
+#include "AliFlowAnalysisWithCumulants.h"
+
+// AliAnalysisTaskCumulants:
+// analysis task for Lee Yang Zeros method
+// Author: Naomi van der Kolk (kolk@nikhef.nl)
+
+ClassImp(AliAnalysisTaskCumulants)
+
+//________________________________________________________________________
+AliAnalysisTaskCumulants::AliAnalysisTaskCumulants(const char *name) : 
+  AliAnalysisTask(name, ""), 
+  fESD(NULL),
+  fAOD(NULL),
+  fAnalysisType("ESD"), 
+  fMyCumuAnalysis(NULL),
+  fEventMaker(NULL)
+{
+  // Constructor
+  cout<<"AliAnalysisTaskCumulants::AliAnalysisTaskCumulants(const char *name)"<<endl;
+
+  // Define input and output slots here
+  // Input slot #0 works with a TChain
+  DefineInput(0, TChain::Class());
+
+  // Output slot #0 writes into a TList container
+  DefineOutput(0, TList::Class());  
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskCumulants::ConnectInputData(Option_t *) 
+{
+  // Connect ESD or AOD here
+  // Called once
+  cout<<"AliAnalysisTaskCumulants::ConnectInputData(Option_t *)"<<endl;
+
+  TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
+  if (!tree) {
+    Printf("ERROR: Could not read chain from input slot 0");
+  } 
+  else {
+    // Disable all branches and enable only the needed ones
+    if (fAnalysisType == "MC") {
+      // we want to process only MC
+      tree->SetBranchStatus("*", kFALSE);
+
+      AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+
+      if (!esdH) {
+       Printf("ERROR: Could not get ESDInputHandler");
+      } else {
+       fESD = esdH->GetEvent();
+      }
+    }
+    else if (fAnalysisType == "ESD" || fAnalysisType == "ESDMC0" || fAnalysisType == "ESDMC1"  ) {
+      tree->SetBranchStatus("*", kFALSE);
+      tree->SetBranchStatus("Tracks.*", kTRUE);
+
+      AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+
+      if (!esdH) {
+       Printf("ERROR: Could not get ESDInputHandler");
+      } else
+       fESD = esdH->GetEvent();
+    }
+    else if (fAnalysisType == "AOD") {
+      AliAODInputHandler *aodH = dynamic_cast<AliAODInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+
+      if (!aodH) {
+       Printf("ERROR: Could not get AODInputHandler");
+      }
+      else {
+       fAOD = aodH->GetEvent();
+      }
+    }
+    else {
+      Printf("Wrong analysis type: Only ESD, ESDMC0, ESDMC1, AOD and MC types are allowed!");
+
+    }
+  }
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskCumulants::CreateOutputObjects() 
+{
+  // Called once
+  cout<<"AliAnalysisTaskCumulants::CreateOutputObjects()"<<endl;
+
+  if (!(fAnalysisType == "AOD" || fAnalysisType == "ESD" || fAnalysisType == "ESDMC0"  || fAnalysisType == "ESDMC1" || fAnalysisType == "MC")) {
+    cout<<"WRONG ANALYSIS TYPE! only ESD, ESDMC0, ESDMC1, AOD and MC are allowed."<<endl;
+    exit(1);
+  }
+
+  //event maker
+  fEventMaker = new AliFlowEventSimpleMaker();
+  //Analyser
+  fMyCumuAnalysis = new AliFlowAnalysisWithCumulants() ;
+   
+
+  //output file
+  TString outputName = "outputFromCumulantsAnalysis" ;
+  outputName += fAnalysisType.Data();
+  outputName += ".root";
+  fMyCumuAnalysis->SetHistFileName( outputName.Data() ); //Ante please implement
+  
+  
+  fMyCumuAnalysis->CreateOutputObjects();
+
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskCumulants::Exec(Option_t *) 
+{
+  // Main loop
+  // Called for each event
+  if (fAnalysisType == "MC") {
+    // Process MC truth, therefore we receive the AliAnalysisManager and ask it for the AliMCEventHandler
+    // This handler can return the current MC event
+
+    AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+    if (!eventHandler) {
+      Printf("ERROR: Could not retrieve MC event handler");
+      return;
+    }
+
+    AliMCEvent* mcEvent = eventHandler->MCEvent();
+    if (!mcEvent) {
+      Printf("ERROR: Could not retrieve MC event");
+      return;
+    }
+
+    Printf("MC particles: %d", mcEvent->GetNumberOfTracks());
+
+    //Cumulants analysis 
+    AliFlowEventSimple* fEvent = fEventMaker->FillTracks(mcEvent);
+    fMyCumuAnalysis->Exec(fEvent);
+    delete fEvent;
+  }
+  else if (fAnalysisType == "ESD") {
+    if (!fESD) {
+      Printf("ERROR: fESD not available");
+      return;
+    }
+    Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
+    
+    //Cumulant analysis 
+    AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD);
+    fMyCumuAnalysis->Exec(fEvent);
+    delete fEvent;
+  }
+  else if (fAnalysisType == "ESDMC0") {
+    if (!fESD) {
+      Printf("ERROR: fESD not available");
+      return;
+    }
+    Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
+    
+    AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+    if (!eventHandler) {
+      Printf("ERROR: Could not retrieve MC event handler");
+      return;
+    }
+
+    AliMCEvent* mcEvent = eventHandler->MCEvent();
+    if (!mcEvent) {
+      Printf("ERROR: Could not retrieve MC event");
+      return;
+    }
+
+    //Cumulant analysis 
+    AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD,mcEvent,0); //0 = kine from ESD, 1 = kine from MC
+    fMyCumuAnalysis->Exec(fEvent);
+    delete fEvent;
+    //delete mcEvent;
+  }
+  else if (fAnalysisType == "ESDMC1") {
+    if (!fESD) {
+      Printf("ERROR: fESD not available");
+      return;
+    }
+    Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
+    
+    AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+    if (!eventHandler) {
+      Printf("ERROR: Could not retrieve MC event handler");
+      return;
+    }
+
+    AliMCEvent* mcEvent = eventHandler->MCEvent();
+    if (!mcEvent) {
+      Printf("ERROR: Could not retrieve MC event");
+      return;
+    }
+
+    //Cumulant analysis 
+    AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD,mcEvent,1); //0 = kine from ESD, 1 = kine from MC
+    fMyCumuAnalysis->Exec(fEvent);
+    delete fEvent;
+    //delete mcEvent;
+  }
+  else if (fAnalysisType == "AOD") {
+    if (!fAOD) {
+      Printf("ERROR: fAOD not available");
+      return;
+    }
+    Printf("There are %d tracks in this event", fAOD->GetNumberOfTracks());
+
+    //Cumulant analysis 
+    AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fAOD);
+    fMyCumuAnalysis->Exec(fEvent);
+    delete fEvent;
+  }
+  
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskCumulants::Terminate(Option_t *) 
+{
+  // Called once at the end of the query
+  cerr<<"fMyCumuAnalysis->GetHistFile() -> IsOpen() = "<<fMyCumuAnalysis->GetHistFile() -> IsOpen()<<endl;
+
+  //  fMyCumuAnalysis->Terminate(); // how it should be Ante please fix
+  fMyCumuAnalysis->Terminate(100);
+
+  PostData(0,fMyCumuAnalysis->GetHistFile());
+
+  delete fMyCumuAnalysis;
+  delete fEventMaker;
+
+  cout<<".....finished"<<endl;
+}
diff --git a/PWG2/FLOW/AliAnalysisTaskCumulants.h b/PWG2/FLOW/AliAnalysisTaskCumulants.h
new file mode 100644 (file)
index 0000000..750c99a
--- /dev/null
@@ -0,0 +1,51 @@
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* See cxx source for full Copyright notice */
+/* $Id$ */
+
+
+#ifndef AliAnalysisTaskCumulants_H
+#define AliAnalysisTaskCumulants_H
+
+// AliAnalysisTaskCumulants:
+// analysis task for 
+// Cumulant method
+// with many authors
+// who do something
+
+class AliESDEvent;
+class AliAODEvent;
+class AliFlowAnalysisWithCumulants;
+class AliFlowEventSimpleMaker;
+class TFile;
+
+#include "AliAnalysisTask.h"
+
+class AliAnalysisTaskCumulants : public AliAnalysisTask {
+ public:
+  AliAnalysisTaskCumulants(const char *name = "AliAnalysisTaskCumulants");
+  virtual ~AliAnalysisTaskCumulants() {}
+  
+  virtual void   ConnectInputData(Option_t *);
+  virtual void   CreateOutputObjects();
+  virtual void   Exec(Option_t *option);
+  virtual void   Terminate(Option_t *);
+
+  void           SetAnalysisType(TString type) {this->fAnalysisType = type;}
+ private:
+  AliAnalysisTaskCumulants(const AliAnalysisTaskCumulants& aAnalysis);
+  AliAnalysisTaskCumulants& operator=(const AliAnalysisTaskCumulants& aAnalysis);
+
+  AliESDEvent *fESD;                      //ESD object
+  AliAODEvent* fAOD;                      //AOD object
+  TString fAnalysisType;                  //string to select which kind of input to analyse: ESD, AOD or MC
+  AliFlowAnalysisWithCumulants* fMyCumuAnalysis;  //Cumulant analysis object
+  AliFlowEventSimpleMaker* fEventMaker;   //FlowEventSimple maker object
+
+  ClassDef(AliAnalysisTaskCumulants, 1); // example of analysis
+};
+
+#endif
+
index a6d2303..36b5e52 100644 (file)
@@ -40,6 +40,8 @@ ClassImp(AliFlowAnalysisWithCumulants)
 
 AliFlowAnalysisWithCumulants::AliFlowAnalysisWithCumulants():  
   fTrack(NULL),
+  fHistFileName("cummulants.root"),
+  fHistFile(NULL),
   fAvM(0),
   fR0(0),
   fPtMax(0),
@@ -83,8 +85,7 @@ AliFlowAnalysisWithCumulants::~AliFlowAnalysisWithCumulants(){
 //___________________________________________________________________________
 void AliFlowAnalysisWithCumulants::CreateOutputObjects(){
  //output histograms
- TString fHistFileName = "cumulants.root";
- TFile* fHistFile;
+
  fHistFile = new TFile(fHistFileName.Data(),"RECREATE");
  fCommonHists = new AliFlowCommonHist("Cumulants");//control histograms
  fCommonHistsRes2 = new AliFlowCommonHistResults("Cumulants2");
index fbedbef..0d97ef3 100644 (file)
@@ -30,6 +30,12 @@ class AliFlowAnalysisWithCumulants {
   virtual void Exec(AliFlowEventSimple* anEvent);
   virtual void Terminate(Int_t nEvents);
 
+  // Output 
+  void SetHistFileName(TString name)  {this->fHistFileName = name ;} // Sets output file name
+  TString GetHistFileName() const { return this->fHistFileName ; } // Gets output file name
+  TFile* GetHistFile() const { return this->fHistFile ; }     // Gets output file
+
+
  private:
   AliFlowAnalysisWithCumulants(const AliFlowAnalysisWithCumulants& aAnalysis);
   AliFlowAnalysisWithCumulants& operator=(const AliFlowAnalysisWithCumulants& aAnalysis);
@@ -40,7 +46,9 @@ class AliFlowAnalysisWithCumulants {
   static const Int_t fgkFlow=AliFlowCumuConstants::kFlow;//integrated flow coefficient to be calculated
   static const Int_t fgkMltpl=AliFlowCumuConstants::kMltpl;//the multiple in p=m*n (diff. flow) 
   static const Int_t fgknBins=100;//number of pt bins
-      
+  TString  fHistFileName;      //! The output file name     
+  TFile* fHistFile; // histogram file for Cumulants
   Double_t fAvM;//avarage SELECTED multiplicity
 
   Double_t fR0;//needed for numerics
diff --git a/PWG2/FLOW/macros/runAliAnalysisTaskCumulants.C b/PWG2/FLOW/macros/runAliAnalysisTaskCumulants.C
new file mode 100644 (file)
index 0000000..de29c5f
--- /dev/null
@@ -0,0 +1,182 @@
+// 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 runAliAnalysisTaskCumulants(Int_t nRuns = 2, TString type = "ESD", const Char_t* dataDir="/Users/snelling/alice_data/TherminatorFIX", Int_t offset = 0) 
+void runAliAnalysisTaskCumulants(Int_t nRuns = 2, TString type = "MC", const Char_t* dataDir="/Users/snelling/alice_data/TherminatorFix", Int_t offset = 0) 
+{
+  TStopwatch timer;
+  timer.Start();
+
+  // include path (to find the .h files when compiling)
+  gSystem->AddIncludePath("-I$ALICE_ROOT/include") ;
+  gSystem->AddIncludePath("-I$ROOTSYS/include") ;
+
+  // load needed libraries
+  gSystem->Load("libTree.so");
+  gSystem->Load("libESD.so");
+  cerr<<"libESD loaded..."<<endl;
+  gSystem->Load("libANALYSIS.so");
+  cerr<<"libANALYSIS.so loaded..."<<endl;
+  gSystem->Load("libPWG2flow.so");
+  
+  //  gROOT->LoadMacro("AliFlowLYZConstants.cxx+");
+  //  gROOT->LoadMacro("AliFlowCommonConstants.cxx+");
+  //  gROOT->LoadMacro("AliFlowVector.cxx+");
+  //  gROOT->LoadMacro("AliFlowTrackSimple.cxx+");
+  //  gROOT->LoadMacro("AliFlowEventSimple.cxx+");
+  //  gROOT->LoadMacro("AliFlowEventSimpleMaker.cxx+");
+  //  gROOT->LoadMacro("AliFlowCommonHist.cxx+");
+  //  gROOT->LoadMacro("AliFlowCommonHistResults.cxx+");
+  //  gROOT->LoadMacro("AliFlowLYZHist1.cxx+");
+  //  gROOT->LoadMacro("AliFlowLYZHist2.cxx+");
+  //  gROOT->LoadMacro("AliFlowAnalysisWithLeeYangZeros.cxx+"); 
+  //  gROOT->LoadMacro("AliAnalysisTaskLeeYangZeros.cxx+");
+
+  // create the TChain. CreateESDChain() is defined in CreateESDChain.C
+  TChain* chain = CreateESDChain(dataDir, nRuns, offset);
+  cout<<"chain ("<<chain<<")"<<endl;
+
+  //____________________________________________//
+  // Make the analysis manager
+  AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
+  AliVEventHandler* esdH = new AliESDInputHandler;
+  mgr->SetInputEventHandler(esdH);  
+  AliMCEventHandler *mc = new AliMCEventHandler();
+  mgr->SetMCtruthEventHandler(mc);
+  //____________________________________________//
+  // 1st Cumulant task
+  AliAnalysisTaskCumulants *task1 = new AliAnalysisTaskCumulants("TaskCumulants");
+  task1->SetAnalysisType(type);
+  mgr->AddTask(task1);
+
+  // Create containers for input/output
+  AliAnalysisDataContainer *cinput1 = 
+    mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
+  AliAnalysisDataContainer *coutput1 = 
+    mgr->CreateContainer("cobj1", TList::Class(),AliAnalysisManager::kOutputContainer);
+
+  //____________________________________________//
+  mgr->ConnectInput(task1,0,cinput1);
+  mgr->ConnectOutput(task1,0,coutput1);
+
+  if (!mgr->InitAnalysis()) return;
+  mgr->PrintStatus();
+  mgr->StartAnalysis("local",chain);
+
+  timer.Stop();
+  timer.Print();
+}
+
+
+// Helper macros for creating chains
+// from: CreateESDChain.C,v 1.10 jgrosseo Exp
+
+TChain* CreateESDChain(const char* aDataDir, Int_t aRuns, Int_t offset)
+{
+  // creates chain of files in a given directory or file containing a list.
+  // In case of directory the structure is expected as:
+  // <aDataDir>/<dir0>/AliESDs.root
+  // <aDataDir>/<dir1>/AliESDs.root
+  // ...
+  
+  if (!aDataDir)
+    return 0;
+  
+  Long_t id, size, flags, modtime;
+  if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime))
+    {
+      printf("%s not found.\n", aDataDir);
+      return 0;
+    }
+  
+  TChain* chain = new TChain("esdTree");
+  TChain* chaingAlice = 0;
+  
+  if (flags & 2)
+    {
+      TString execDir(gSystem->pwd());
+      TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir);
+      TList* dirList            = baseDir->GetListOfFiles();
+      Int_t nDirs               = dirList->GetEntries();
+      gSystem->cd(execDir);
+      
+      Int_t count = 0;
+      
+      for (Int_t iDir=0; iDir<nDirs; ++iDir)
+       {
+         TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir);
+         if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
+           continue;
+         
+         if (offset > 0)
+           {
+             --offset;
+             continue;
+           }
+         
+         if (count++ == aRuns)
+           break;
+         
+         TString presentDirName(aDataDir);
+         presentDirName += "/";
+         presentDirName += presentDir->GetName();        
+         chain->Add(presentDirName + "/AliESDs.root/esdTree");
+         cerr<<presentDirName<<endl;
+       }
+      
+    }
+  else
+    {
+      // Open the input stream
+      ifstream in;
+      in.open(aDataDir);
+      
+      Int_t count = 0;
+      
+      // Read the input list of files and add them to the chain
+      TString esdfile;
+      while(in.good()) {
+       in >> esdfile;
+       if (!esdfile.Contains("root")) continue; // protection
+       
+       if (offset > 0)
+         {
+           --offset;
+           continue;
+         }
+       
+       if (count++ == aRuns)
+         break;
+       
+        // add esd file
+       chain->Add(esdfile);
+      }
+      
+      in.close();
+    }
+  
+  return chain;
+}
+
+void LookupWrite(TChain* chain, const char* target)
+{
+  // looks up the chain and writes the remaining files to the text file target
+  
+  chain->Lookup();
+  
+  TObjArray* list = chain->GetListOfFiles();
+  TIterator* iter = list->MakeIterator();
+  TObject* obj = 0;
+  
+  ofstream outfile;
+  outfile.open(target);
+  
+  while ((obj = iter->Next()))
+    outfile << obj->GetTitle() << "#AliESDs.root" << endl;
+  
+  outfile.close();
+  
+  delete iter;
+}
+
diff --git a/PWG2/FLOW/macros/runCumulantsOnKine.C b/PWG2/FLOW/macros/runCumulantsOnKine.C
new file mode 100644 (file)
index 0000000..514bd87
--- /dev/null
@@ -0,0 +1,141 @@
+#include "TStopwatch.h"
+#include "TObjArray"
+#include "Riostream.h"
+
+Int_t offset = 0 ;
+
+//int runCumulantsOnKine(Int_t aRuns = 144, Bool_t fFirstRunLYZ = kTRUE, Bool_t fDouble = kFALSE, const char * dir = "/users/alice/KineOnly3/")
+//int runCumulantsOnKine(Int_t aRuns = 10, Bool_t fFirstRunLYZ = kTRUE, Bool_t fDouble = kFALSE, const char * dir = "/data/alice2/LHyquid3_rot/")
+//int runCumulantsOnKine(Int_t aRuns = 144, const char * dir = "/Users/snelling/alice_data/KineOnly3/")
+int runCumulantsOnKine(Int_t aRuns = 144, const char * dir = "/Users/snelling/alice_data/TherminatorFIX/")
+//int runCumulantsOnKine(Int_t aRuns = 200, Bool_t fFirstRunLYZ = kTRUE, Bool_t fDouble = kFALSE, const char * dir = "/data/alice2/abDeleteMeASAP/")
+{
+  TStopwatch timer;
+  timer.Start();
+
+  cout<<" BEGIN ANALYSIS "<<endl;
+  gSystem->AddIncludePath("-I$ALICE_ROOT/include") ;
+  gSystem->AddIncludePath("-I$ROOTSYS/include") ;
+  gROOT->LoadMacro("AliFlowVector.cxx+");
+  gROOT->LoadMacro("AliFlowCommonConstants.cxx+");
+  gROOT->LoadMacro("AliFlowCommonHist.cxx+");
+  gROOT->LoadMacro("AliFlowCommonHistResults.cxx+");
+  gROOT->LoadMacro("AliFlowCumuConstants.cxx+");
+  gROOT->LoadMacro("AliFlowTrackSimple.cxx+");
+  gROOT->LoadMacro("AliFlowEventSimple.cxx+");
+  gROOT->LoadMacro("AliFlowEventSimpleMaker.cxx+");
+  gROOT->LoadMacro("AliFlowAnalysisWithCumulants.cxx+");
+
+  cout<<" loaded macros "<<endl;
+
+
+  AliFlowAnalysisWithCumulants* aFlowAnalysisWithCumulants = new AliFlowAnalysisWithCumulants();//ab
+
+  AliFlowEventSimpleMaker* fEventMaker = new AliFlowEventSimpleMaker(); 
+
+  aFlowAnalysisWithCumulants->CreateOutputObjects();
+
+  // standard code
+  
+  Int_t fCount = 0 ;
+
+  TString execDir(gSystem->pwd());
+  TSystemDirectory* baseDir = new TSystemDirectory(".", dir) ;  // aDataDir   // TSystemDirectory(const char* dirname, const char* path)
+  TList* dirList          = baseDir->GetListOfFiles();
+  Int_t nDirs             = dirList->GetEntries();
+  cout<<" Int_t nDirs = "<<nDirs<<endl;
+  gSystem->cd(execDir);
+
+  for(Int_t iDir=0; iDir<nDirs; ++iDir)
+    {
+      TSystemFile* presentDir = (TSystemFile*)dirList->At(iDir) ;
+      if(!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0) 
+       {
+         cout << endl ; 
+         cout << "Directory (" << iDir << "):  " << presentDir->GetName() << " - Skipping ... " << endl ;
+         continue ;   
+       }
+      if(offset > 0)  { --offset ; continue ; }
+      if((aRuns > 0) && (fCount >= aRuns)) { break ; }
+      TString presentDirName(dir) ; // aDataDir
+      presentDirName += presentDir->GetName();
+      presentDirName += "/";
+      //cerr<<" presentDirName = "<<presentDirName<<endl;
+
+      TString fileName = presentDirName ; 
+      fileName += "galice.root" ;
+      Long_t *id, *size, *flags, *modtime ;
+      if(gSystem->GetPathInfo(fileName.Data(),id,size,flags,modtime)) 
+       { 
+         cout << " File : " << fileName << " does NOT exist ! - Skipping ... " << endl ; 
+         continue ; 
+       }
+      cout << endl ; cout << "Directory (" << iDir << "):  " << presentDirName << "  ... " << endl ;
+
+      // loop (simulations in the present dir) //
+      TSystemDirectory* evtsDir = new TSystemDirectory(".", presentDirName.Data());
+      TList* fileList      = evtsDir->GetListOfFiles();
+      Int_t nFiles                 = fileList->GetEntries();
+      cout<<" Int_t nFiles = "<<nFiles<<endl;
+      gSystem->cd(execDir);
+
+      for(Int_t iFiles=0; iFiles<nFiles; ++iFiles)
+       {
+         TSystemFile* presentFile = (TSystemFile*) fileList->At(iFiles);
+
+         TString presentFileName(presentDirName);
+         presentFileName += presentFile->GetName();
+
+         if(!(presentFileName.Contains("Kinematics") && presentFileName.Contains("root"))) { continue ; }
+
+         cout << " found: " << presentFileName.Data() << endl ; 
+  
+         TFile* kineFile = new TFile(presentFileName.Data(), "READ") ; 
+         // kineFile->ls() ;
+         Int_t nEvts = kineFile->GetNkeys() ; 
+         cout << "  . found: " << nEvts << " KineTree(s) in " << presentFileName.Data() << endl ;
+         TList* kineEventsList = (TList*)kineFile->GetListOfKeys() ; 
+         TTree* kTree ;
+         TIter next(kineEventsList); 
+         TKey* key ;
+
+         //end common code
+        
+         // Loop over the events
+         while( key=(TKey *)next() ) 
+           {
+             TDirectory* tDir = (TDirectory*)key->ReadObj() ;
+             if(!tDir) break;
+             TString evtDir(tDir->GetName()) ; 
+             cout << "  . . found: " << tDir->GetName() << endl ;
+
+             kTree = (TTree *)tDir->Get("TreeK");
+             if(!kTree) break;
+
+             Int_t nPart = kTree->GetEntries() ;
+             cout << "  . . . kTree " << fCount << " has " << nPart << " particles " << endl ;
+             
+             // fill and save the flow event
+
+             AliFlowEventSimple* fEvent = fEventMaker->FillTracks(kTree); 
+              aFlowAnalysisWithCumulants->Exec(fEvent); cout<<"Cumu analysis"<<endl;
+              
+             fCount++ ;
+    
+             delete kTree;
+           }
+         delete kineFile ;
+       }
+      delete evtsDir ;
+    }
+
+  aFlowAnalysisWithCumulants->Terminate(fCount);
+
+  cout <<  endl ;
+  cout << " Finished ... " << endl ;
+  timer.Stop() ;
+  cout << endl ;
+  timer.Print() ;
+}
index 68c2d98..cdbc748 100644 (file)
@@ -26,5 +26,6 @@
 #pragma link C++ class AliAnalysisTaskMCEventPlane+;
 #pragma link C++ class AliAnalysisTaskLYZEventPlane+;
 #pragma link C++ class AliAnalysisTaskLeeYangZeros+;
+#pragma link C++ class AliAnalysisTaskCumulants+;
 
 #endif
index 779adb1..a731c0e 100644 (file)
@@ -20,6 +20,7 @@ SRCS= FLOW/AliFlowEventSimple.cxx \
       FLOW/AliAnalysisTaskScalarProduct.cxx \
       FLOW/AliAnalysisTaskMCEventPlane.cxx \
       FLOW/AliAnalysisTaskLYZEventPlane.cxx \
+      FLOW/AliAnalysisTaskCumulants.cxx \
       FLOW/AliAnalysisTaskLeeYangZeros.cxx
 
 HDRS= $(SRCS:.cxx=.h)