]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
More methods ready for CAF
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Jul 2008 12:41:22 +0000 (12:41 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Jul 2008 12:41:22 +0000 (12:41 +0000)
17 files changed:
PWG2/FLOW/AliAnalysisTaskLeeYangZeros.cxx
PWG2/FLOW/AliAnalysisTaskLeeYangZeros.h
PWG2/FLOW/AliAnalysisTaskScalarProduct.cxx
PWG2/FLOW/AliAnalysisTaskScalarProduct.h
PWG2/FLOW/AliFlowAnalysisWithLYZEventPlane.cxx
PWG2/FLOW/AliFlowAnalysisWithLeeYangZeros.cxx
PWG2/FLOW/AliFlowAnalysisWithLeeYangZeros.h
PWG2/FLOW/AliFlowAnalysisWithMCEventPlane.cxx
PWG2/FLOW/AliFlowAnalysisWithScalarProduct.cxx
PWG2/FLOW/AliFlowCommonHist.h
PWG2/FLOW/AliFlowCommonHistResults.h
PWG2/FLOW/AliFlowEventSimpleMaker.cxx
PWG2/FLOW/AliFlowEventSimpleMaker.h
PWG2/FLOW/AliFlowLYZHist1.h
PWG2/FLOW/AliFlowLYZHist2.h
PWG2/FLOW/AliFlowTrackSimple.h
PWG2/FLOW/macros/runAliAnalysisTaskFlow.C

index 62d1207b2e94968a9b508108937affcb27fac4dc..c66d022040500298eacb4c5e51d8c4450b80513e 100644 (file)
@@ -17,6 +17,7 @@
 #include "TChain.h"
 #include "TTree.h"
 #include "TFile.h"
+#include "TList.h"
 
 
 class AliAnalysisTask;
@@ -31,6 +32,8 @@ class AliAnalysisTask;
 #include "AliMCEventHandler.h"
 #include "AliMCEvent.h"
 
+#include "../../CORRFW/AliCFManager.h"
+
 #include "AliAnalysisTaskLeeYangZeros.h"
 #include "AliFlowEventSimpleMaker.h"
 #include "AliFlowAnalysisWithLeeYangZeros.h"
@@ -47,9 +50,12 @@ AliAnalysisTaskLeeYangZeros::AliAnalysisTaskLeeYangZeros(const char *name, Bool_
   fESD(0),
   fAOD(0),
   fAnalysisType("ESD"), 
+  fCFManager1(NULL),
+  fCFManager2(NULL),
   fLyz(0),
   fEventMaker(0),
   fFirstRunFile(0),
+  fListHistos(NULL),
   fFirstRunLYZ(firstrun), //set boolean for firstrun to initial value
   fUseSumLYZ(kTRUE)       //set boolean for use sum to initial value
 {
@@ -64,6 +70,39 @@ AliAnalysisTaskLeeYangZeros::AliAnalysisTaskLeeYangZeros(const char *name, Bool_
   DefineOutput(0, TList::Class());  
 }
 
+
+/*
+//________________________________________________________________________
+AliAnalysisTaskLeeYangZeros::AliAnalysisTaskLeeYangZeros() :  
+  fESD(0),
+  fAOD(0),
+  fAnalysisType("ESD"), 
+  fCFManager1(NULL),
+  fCFManager2(NULL),
+  fLyz(0),
+  fEventMaker(0),
+  fFirstRunFile(0),
+  fListHistos(NULL),
+  fFirstRunLYZ(kTRUE), //set boolean for firstrun to initial value
+  fUseSumLYZ(kTRUE)    //set boolean for use sum to initial value
+{
+  // Constructor
+  cout<<"AliAnalysisTaskLeeYangZeros::AliAnalysisTaskLeeYangZeros(const char *name)"<<endl;
+
+}
+
+*/
+
+//________________________________________________________________________
+AliAnalysisTaskLeeYangZeros::~AliAnalysisTaskLeeYangZeros()
+{
+
+  //destructor
+
+}
+
+
+
 //________________________________________________________________________
 void AliAnalysisTaskLeeYangZeros::ConnectInputData(Option_t *) 
 {
@@ -136,27 +175,24 @@ void AliAnalysisTaskLeeYangZeros::CreateOutputObjects()
   fLyz -> SetFirstRun(GetFirstRunLYZ());   //set first run true or false
   fLyz -> SetUseSum(GetUseSumLYZ());       //set use sum true or false
 
-  //output file
-  TString outputName = "outputFromLeeYangZerosAnalysis" ;
-  outputName += fAnalysisType.Data() ;
-  if (fFirstRunLYZ) {
-    outputName += "_firstrun.root" ;
-  } else {
-    outputName += "_secondrun.root" ;
-  }
-  fLyz->SetHistFileName( outputName.Data() );
-  
   // Get data from input slot 1
   if (GetNinputs() == 2) {                   //if there are two input slots
     fFirstRunFile = (TFile*)GetInputData(1);
     cerr<<"fFirstRunFile ("<<fFirstRunFile<<")"<<endl;
-    if (fFirstRunFile) cerr<<"fFirstRunFile -> IsOpen() = "<<fFirstRunFile -> IsOpen()<<endl;
-    
+    if (fFirstRunFile) { cerr<<"fFirstRunFile -> IsOpen() = "<<fFirstRunFile -> IsOpen()<<endl;}
+    else { cerr<<"fFirstRunFile has a NULL pointer!!"<<endl; exit(0);}
     fLyz -> SetFirstRunFile(fFirstRunFile);
   }
   
   fLyz-> Init();
 
+  if (fLyz->GetHistList()) {
+       fLyz->GetHistList()->Print();
+       fListHistos = fLyz->GetHistList();
+       fListHistos->Print();
+  }
+  else {Printf("ERROR: Could not retrieve histogram list"); }
+  
 }
 
 //________________________________________________________________________
@@ -180,10 +216,14 @@ void AliAnalysisTaskLeeYangZeros::Exec(Option_t *)
       return;
     }
 
+    fCFManager1->SetEventInfo(mcEvent);
+    fCFManager2->SetEventInfo(mcEvent);
+
     Printf("MC particles: %d", mcEvent->GetNumberOfTracks());
 
     //lee yang zeros analysis 
-    AliFlowEventSimple* fEvent = fEventMaker->FillTracks(mcEvent);
+    //AliFlowEventSimple* fEvent = fEventMaker->FillTracks(mcEvent);
+    AliFlowEventSimple* fEvent = fEventMaker->FillTracks(mcEvent,fCFManager1,fCFManager2);
     fLyz->Make(fEvent);
     delete fEvent;
   }
@@ -195,11 +235,12 @@ void AliAnalysisTaskLeeYangZeros::Exec(Option_t *)
     Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
     
     //lee yang zeros analysis 
-    AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD);
+    //AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD);
+    AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD,fCFManager1,fCFManager2);
     fLyz->Make(fEvent);
     delete fEvent;
   }
-  else if (fAnalysisType == "ESDMC0") {
+  else if (fAnalysisType == "ESDMC0" || fAnalysisType == "ESDMC1") {
     if (!fESD) {
       Printf("ERROR: fESD not available");
       return;
@@ -218,37 +259,22 @@ void AliAnalysisTaskLeeYangZeros::Exec(Option_t *)
       return;
     }
 
-    //lee yang zeros analysis 
-    AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD,mcEvent,0); //0 = kine from ESD, 1 = kine from MC
-    fLyz->Make(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;
-    }
+    fCFManager1->SetEventInfo(mcEvent);
+    fCFManager2->SetEventInfo(mcEvent);
 
     //lee yang zeros analysis 
-    AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD,mcEvent,1); //0 = kine from ESD, 1 = kine from MC
+    //AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD,mcEvent,0); //0 = kine from ESD, 1 = kine from MC
+    AliFlowEventSimple* fEvent=NULL;
+    if (fAnalysisType == "ESDMC0") { 
+      fEvent = fEventMaker->FillTracks(fESD, mcEvent, fCFManager1, fCFManager2, 0); //0 = kine from ESD, 1 = kine from MC
+    } else if (fAnalysisType == "ESDMC1") {
+      fEvent = fEventMaker->FillTracks(fESD, mcEvent, fCFManager1, fCFManager2, 1); //0 = kine from ESD, 1 = kine from MC
+    }
     fLyz->Make(fEvent);
     delete fEvent;
     //delete mcEvent;
   }
+  
   else if (fAnalysisType == "AOD") {
     if (!fAOD) {
       Printf("ERROR: fAOD not available");
@@ -257,11 +283,13 @@ void AliAnalysisTaskLeeYangZeros::Exec(Option_t *)
     Printf("There are %d tracks in this event", fAOD->GetNumberOfTracks());
 
     //lee yang zeros analysis 
-    AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fAOD);
+    AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fAOD); //no CF yet!
     fLyz->Make(fEvent);
     delete fEvent;
   }
   
+  //PostData(0,fListHistos); //here for CAF
+
 }      
 
 //________________________________________________________________________
@@ -271,14 +299,22 @@ void AliAnalysisTaskLeeYangZeros::Terminate(Option_t *)
   if (GetNinputs() == 2) { 
     cerr<<"fFirstRunFile -> IsOpen() = "<<fFirstRunFile -> IsOpen()<<endl;
   }
-  cerr<<"fLyz->GetHistFile() -> IsOpen() = "<<fLyz->GetHistFile() -> IsOpen()<<endl;
-
-  fLyz->Finish();
+  
+  fLyz->Finish();           //remove for CAF
+  PostData(0,fListHistos);  //remove for CAF
+  
 
-  PostData(0,fLyz->GetHistFile());
+  //print histogram list:
+  TList* fOutListHistos = (TList*)GetOutputData(0);
+  cout << "histogram list in Terminate" << endl;
+  if (fOutListHistos) {
+    //fOutListHistos->Print();  //gives error for secondrun??
+  }    
+  else {
+    cout << "histgram list pointer is empty" << endl;}
 
-  delete fLyz;
-  delete fEventMaker;
+  //delete fLyz;
+  //delete fEventMaker;
 
   cout<<".....finished"<<endl;
 }
index 7f54655a9dc159988995c0e99d0ca4a9807870d4..5f6267d467215ab60534a298548cc001e95d7fa4 100644 (file)
 
 class AliESDEvent;
 class AliAODEvent;
+class AliCFManager;
 class AliFlowAnalysisWithLeeYangZeros;
 class AliFlowEventSimpleMaker;
 class TFile;
+class TList;
 
+#include "TString.h"
 #include "AliAnalysisTask.h"
 
 class AliAnalysisTaskLeeYangZeros : public AliAnalysisTask {
  public:
+  //AliAnalysisTaskLeeYangZeros();
   AliAnalysisTaskLeeYangZeros(const char *name = "AliAnalysisTaskLeeYangZeros", Bool_t firstrun = kTRUE);
-  virtual ~AliAnalysisTaskLeeYangZeros() {}
+  virtual ~AliAnalysisTaskLeeYangZeros();
   
   virtual void   ConnectInputData(Option_t *);
   virtual void   CreateOutputObjects();
@@ -36,19 +40,28 @@ class AliAnalysisTaskLeeYangZeros : public AliAnalysisTask {
   void           SetUseSumLYZ(Bool_t kt)       { this->fUseSumLYZ = kt ;  }
   Bool_t         GetUseSumLYZ() const          { return this->fUseSumLYZ ; }
   void           SetAnalysisType(TString type) {this->fAnalysisType = type ; }
+  TString        GetAnalysisType()             {return this->fAnalysisType; } 
+  void           SetCFManager1(AliCFManager* cfmgr) {this->fCFManager1 = cfmgr; } 
+  AliCFManager*  GetCFManager1()               {return this->fCFManager1; }
+  void           SetCFManager2(AliCFManager* cfmgr) {this->fCFManager2 = cfmgr; } 
+  AliCFManager*  GetCFManager2()               {return this->fCFManager2; }
+
+
  private:
  
   AliAnalysisTaskLeeYangZeros(const AliAnalysisTaskLeeYangZeros& aAnalysis);
   AliAnalysisTaskLeeYangZeros& operator=(const AliAnalysisTaskLeeYangZeros& aAnalysis);
 
-  AliESDEvent *fESD;                      //ESD object
-  AliAODEvent* fAOD;                      //AOD object
-  TString fAnalysisType;                  //string to select which kind of input to analyse: ESD, AOD or MC
+  AliESDEvent*     fESD;                  //ESD object
+  AliAODEvent*     fAOD;                  //AOD object
+  TString          fAnalysisType;         //string to select which kind of input to analyse: ESD, AOD or MC
+  AliCFManager*    fCFManager1;           // correction framework manager
+  AliCFManager*    fCFManager2;           // correction framework manager
   AliFlowAnalysisWithLeeYangZeros* fLyz;  //LYZ analysis object
   AliFlowEventSimpleMaker* fEventMaker;   //FlowEventSimple maker object
 
-  TFile* fFirstRunFile;    //! file from the first loop over events
+  TFile*           fFirstRunFile;         // file from the first loop over events
+  TList*           fListHistos;           // collection of output
 
   //flags
   Bool_t fFirstRunLYZ ;    //! flag for lyz analysis 
index c0c4add805941dbacabd41fdbea0b20ac553539f..1acf40fdc5e88f4fed8b8d9346d42012d0874771 100644 (file)
@@ -16,7 +16,7 @@
 #include "Riostream.h" //needed as include
 #include "TChain.h"
 #include "TTree.h"
-#include "TFile.h" //needed as include
+//#include "TFile.h" //needed as include
 #include "TList.h"
 
 
@@ -32,6 +32,8 @@ class AliAnalysisTask;
 #include "AliMCEventHandler.h"
 #include "AliMCEvent.h"
 
+#include "../../CORRFW/AliCFManager.h"
+
 #include "AliAnalysisTaskScalarProduct.h"
 #include "AliFlowEventSimpleMaker.h"
 #include "AliFlowAnalysisWithScalarProduct.h"
@@ -52,6 +54,8 @@ AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct(const char *name) :
   fSP(NULL),
   fEventMaker(NULL),
   fAnalysisType("ESD"),
+  fCFManager1(NULL),
+  fCFManager2(NULL),
   fListHistos(NULL)
 {
   // Constructor
@@ -72,6 +76,8 @@ AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct() :
   fSP(NULL),
   fEventMaker(NULL),
   fAnalysisType("ESD"),
+  fCFManager1(NULL),
+  fCFManager2(NULL),
   fListHistos(NULL)
 {
   // Constructor
@@ -119,7 +125,7 @@ void AliAnalysisTaskScalarProduct::ConnectInputData(Option_t *)
        fESD = esdH->GetEvent();
       }
     }
-    else if (fAnalysisType == "ESD") {
+    else if (fAnalysisType == "ESD" || fAnalysisType == "ESDMC0" || fAnalysisType == "ESDMC1") {
       cout<<"!!!!!reading the ESD only"<<endl;
       tree->SetBranchStatus("*", kFALSE);
       tree->SetBranchStatus("Tracks.*", kTRUE);
@@ -143,7 +149,7 @@ void AliAnalysisTaskScalarProduct::ConnectInputData(Option_t *)
       }
     }
     else {
-      Printf("!!!!!Wrong analysis type: Only ESD, AOD and MC types are allowed!");
+      Printf("!!!!!Wrong analysis type: Only ESD, ESDMC0, ESDMC1, AOD and MC types are allowed!");
       exit(1);
       
     }
@@ -155,6 +161,12 @@ void AliAnalysisTaskScalarProduct::CreateOutputObjects()
 {
   // Called at every worker node to initialize
   cout<<"AliAnalysisTaskScalarProduct::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
@@ -163,9 +175,9 @@ void AliAnalysisTaskScalarProduct::CreateOutputObjects()
   
 
   if (fSP->GetHistList()) {
-    // fSP->GetHistList()->Print();
-    fListHistos = fSP->GetHistList();
-    // fListHistos->Print();
+       fSP->GetHistList()->Print();
+       fListHistos = fSP->GetHistList();
+       fListHistos->Print();
   }
   else {Printf("ERROR: Could not retrieve histogram list"); }
 }
@@ -176,9 +188,7 @@ void AliAnalysisTaskScalarProduct::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
@@ -196,9 +206,12 @@ void AliAnalysisTaskScalarProduct::Exec(Option_t *)
       return;
     }
 
+    fCFManager1->SetEventInfo(mcEvent);
+    fCFManager2->SetEventInfo(mcEvent);
+
     // analysis 
     Printf("MC particles: %d", mcEvent->GetNumberOfTracks());
-    AliFlowEventSimple* fEvent = fEventMaker->FillTracks(mcEvent);
+    AliFlowEventSimple* fEvent = fEventMaker->FillTracks(mcEvent,fCFManager1,fCFManager2);
     fSP->Make(fEvent);
 
     delete fEvent;
@@ -211,10 +224,44 @@ void AliAnalysisTaskScalarProduct::Exec(Option_t *)
     Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
     
     // analysis 
-    AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD);
+    AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD,fCFManager1,fCFManager2);
     fSP->Make(fEvent);
     delete fEvent;
   }
+else if (fAnalysisType == "ESDMC0" || 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;
+    }
+
+    fCFManager1->SetEventInfo(mcEvent);
+    fCFManager2->SetEventInfo(mcEvent);
+
+    //lee yang zeros analysis 
+    AliFlowEventSimple* fEvent=NULL;
+    if (fAnalysisType == "ESDMC0") { 
+      fEvent = fEventMaker->FillTracks(fESD, mcEvent, fCFManager1, fCFManager2, 0); //0 = kine from ESD, 1 = kine from MC
+    } else if (fAnalysisType == "ESDMC1") {
+      fEvent = fEventMaker->FillTracks(fESD, mcEvent, fCFManager1, fCFManager2, 1); //0 = kine from ESD, 1 = kine from MC
+    }
+    fSP->Make(fEvent);
+    delete fEvent;
+    //delete mcEvent;
+  }
+  
   else if (fAnalysisType == "AOD") {
     if (!fAOD) {
       Printf("ERROR: fAOD not available");
@@ -223,12 +270,13 @@ void AliAnalysisTaskScalarProduct::Exec(Option_t *)
     Printf("There are %d tracks in this event", fAOD->GetNumberOfTracks());
 
     // analysis 
+    //For the moment don't use CF //AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fAOD,fCFManager1,fCFManager2);
     AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fAOD);
     fSP->Make(fEvent);
     delete fEvent;
   }
 
-  //  fListHistos->Print();    
+  //fListHistos->Print();      
   PostData(0,fListHistos);
 } 
 
@@ -238,6 +286,7 @@ void AliAnalysisTaskScalarProduct::Terminate(Option_t *)
   // Called once at the end of the query
   //  fSP->Finish();
   //  PostData(0,fListHistos);
+
   fListHistos = (TList*)GetOutputData(0);
   cout << "histgram list in Terminate" << endl;
   if (fListHistos) 
@@ -248,6 +297,6 @@ void AliAnalysisTaskScalarProduct::Terminate(Option_t *)
     {
       cout << "histgram list pointer is empty" << endl;
     }
-  //  delete fSP;
-  //  delete fEventMaker;
+//  delete fSP;
+//  delete fEventMaker;
 }
index 9e46ef2599f4a6d28802bac3152f7587c073a2c6..8c3133973798689e95af97e3c3dab362ce82c96d 100644 (file)
 
 class AliESDEvent;
 class AliAODEvent;
+class AliCFManager;
 class AliFlowAnalysisWithScalarProduct;
 class AliFlowEventSimpleMaker;
+class TList;
 
 #include "TString.h"
 #include "AliAnalysisTask.h"
@@ -30,7 +32,12 @@ class AliAnalysisTaskScalarProduct : public AliAnalysisTask {
 
   void SetAnalysisType(TString type) { this->fAnalysisType = type; }
   TString GetAnalysisType() const    { return this->fAnalysisType; }
-  
+
+  void SetCFManager1(AliCFManager* cfmgr) {this->fCFManager1 = cfmgr; } 
+  AliCFManager* GetCFManager1()           {return this->fCFManager1; }
+  void SetCFManager2(AliCFManager* cfmgr) {this->fCFManager2 = cfmgr; } 
+  AliCFManager* GetCFManager2()           {return this->fCFManager2; }
+
  private:
 
   AliAnalysisTaskScalarProduct(const AliAnalysisTaskScalarProduct& aAnalysisTask);
@@ -41,7 +48,9 @@ class AliAnalysisTaskScalarProduct : public AliAnalysisTask {
   AliFlowAnalysisWithScalarProduct* fSP;  // analysis object
   AliFlowEventSimpleMaker* fEventMaker;   // FlowEventSimple maker object
   TString fAnalysisType;                  // can be MC, ESD or AOD
-  TList  *fListHistos;                    //collection of output
+  AliCFManager* fCFManager1;              // correction framework manager
+  AliCFManager* fCFManager2;              // correction framework manager
+  TList  *fListHistos;                    // collection of output
 
   ClassDef(AliAnalysisTaskScalarProduct, 1); // example of analysis
 };
index cb4f70293c3fbccd4550d1434797797f20a840ca..94e2abb61eecf96bcebb1259c15743f180b24a9c 100644 (file)
@@ -345,7 +345,7 @@ void AliFlowAnalysisWithLYZEventPlane::Finish() {
   fSecondVPt->SetLineColor(3);
   fSecondVPt->SetLineWidth(2);
   fSecondVPt->Draw();
-  fHistFlow = fCommonHistsRes->GetfHistDiffFlow();
+  fHistFlow = fCommonHistsRes->GetHistDiffFlow();
   fHistFlow->Draw("SAME");
   // draw the legend
   TLegend *legend2 = new TLegend(0.6,0.65,0.88,0.85);
index 83b122446fa0af802b35835425eb82c1c3d19cf8..ccfd6f093aff8e3e6531b8ead027fe2f82414077 100644 (file)
@@ -29,6 +29,7 @@ class AliFlowVector;
 
 #include "TMath.h" //needed as include
 #include "TFile.h" //needed as include
+#include "TList.h"
 
 class TComplex;
 class TProfile;
@@ -59,9 +60,7 @@ ClassImp(AliFlowAnalysisWithLeeYangZeros)
     fUseSum(kTRUE),
     fDoubleLoop(kFALSE),
     fDebug(kFALSE),
-    fHistFileName(0),
-    fHistFile(0),
-    fSummaryFile(0),
+    fHistList(NULL),
     firstRunFileName(0),
     firstRunFile(NULL),
     fHistProVtheta(NULL),
@@ -79,8 +78,7 @@ ClassImp(AliFlowAnalysisWithLeeYangZeros)
   //default constructor
   if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::AliFlowAnalysisWithLeeYangZeros default constructor****"<<endl;
 
-  // output file (histograms)
-  fHistFileName = "outputFromLYZAnalysis.root" ;
+  fHistList = new TList();
 
   for(Int_t i = 0;i<5;i++)
     {
@@ -100,7 +98,7 @@ ClassImp(AliFlowAnalysisWithLeeYangZeros)
    //default destructor
    if (fDebug) cout<<"****~AliFlowAnalysisWithLeeYangZeros****"<<endl;
    delete fQsum;
-   delete fHistFile;
+   delete fHistList;
  }
  
  //-----------------------------------------------------------------------
@@ -110,10 +108,6 @@ Bool_t AliFlowAnalysisWithLeeYangZeros::Init()
   //init method 
   if (fDebug) cout<<"****AliFlowAnalysisWithLeeYangZeros::Init()****"<<endl;
 
-  // Open output files (->plots)
-  fHistFile = new TFile(fHistFileName.Data(), "RECREATE");
-  
-    
   // Book histograms
   Int_t iNtheta = AliFlowLYZConstants::kTheta;
   Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt();
@@ -127,21 +121,43 @@ Bool_t AliFlowAnalysisWithLeeYangZeros::Init()
   
   //for control histograms
   fCommonHists = new AliFlowCommonHist("LYZ");
+  //fHistList->Add(fCommonHists->GetHistList());
+  fHistList->Add(fCommonHists->GetHistMultOrig());
+  fHistList->Add(fCommonHists->GetHistMultInt());
+  fHistList->Add(fCommonHists->GetHistMultDiff());
+  fHistList->Add(fCommonHists->GetHistPtInt());
+  fHistList->Add(fCommonHists->GetHistPtDiff());
+  fHistList->Add(fCommonHists->GetHistPhiInt());
+  fHistList->Add(fCommonHists->GetHistPhiDiff());
+  fHistList->Add(fCommonHists->GetHistEtaInt());
+  fHistList->Add(fCommonHists->GetHistEtaDiff());
+  fHistList->Add(fCommonHists->GetHistProMeanPtperBin());
+  fHistList->Add(fCommonHists->GetHistQ());
   fCommonHistsRes = new AliFlowCommonHistResults("LYZ");
+  //fHistList->Add(fCommonHistsRes->GetHistList()); 
+  fHistList->Add(fCommonHistsRes->GetHistDiffFlow()); 
+  fHistList->Add(fCommonHistsRes->GetHistChi()); 
+  fHistList->Add(fCommonHistsRes->GetHistIntFlow()); 
 
   //for first loop over events 
   if (fFirstRun){
     fHistProR0theta  = new TProfile("First_FlowPro_r0theta_LYZ","First_FlowPro_r0theta_LYZ",iNtheta,-0.5,iNtheta-0.5);
     fHistProR0theta->SetXTitle("#theta");
     fHistProR0theta->SetYTitle("r_{0}^{#theta}");
+    fHistList->Add(fHistProR0theta);
 
     fHistProVtheta  = new TProfile("First_FlowPro_Vtheta_LYZ","First_FlowPro_Vtheta_LYZ",iNtheta,-0.5,iNtheta-0.5);
     fHistProVtheta->SetXTitle("#theta");
     fHistProVtheta->SetYTitle("V_{n}^{#theta}");        
+    fHistList->Add(fHistProVtheta);
 
     //class AliFlowLYZHist1 defines the histograms: fHistProGtheta, fHistProReGtheta, fHistProImGtheta, fHistProR0theta
     for (Int_t theta=0;theta<iNtheta;theta++) {  
       fHist1[theta]=new AliFlowLYZHist1(theta);
+      //fHistList->Add(fHist1[theta]->GetHistList() );
+      fHistList->Add(fHist1[theta]->GetHistGtheta() );
+      fHistList->Add(fHist1[theta]->GetHistProReGtheta() );
+      fHistList->Add(fHist1[theta]->GetHistProImGtheta() );
     }
      
   }
@@ -150,30 +166,43 @@ Bool_t AliFlowAnalysisWithLeeYangZeros::Init()
     fHistProReDenom = new TProfile("Second_FlowPro_ReDenom_LYZ","Second_FlowPro_ReDenom_LYZ" , iNtheta, -0.5, iNtheta-0.5);
     fHistProReDenom->SetXTitle("#theta");
     fHistProReDenom->SetYTitle("Re(Q^{#theta}e^{ir_{0}^{#theta}Q^{#theta}})");
+    fHistList->Add(fHistProReDenom);
 
     fHistProImDenom = new TProfile("Second_FlowPro_ImDenom_LYZ","Second_FlowPro_ImDenom_LYZ" , iNtheta, -0.5, iNtheta-0.5);
     fHistProImDenom->SetXTitle("#theta");
     fHistProImDenom->SetYTitle("Im(Q^{#theta}e^{ir_{0}^{#theta}Q^{#theta}})");
+    fHistList->Add(fHistProImDenom);
 
     fHistProVeta = new TProfile("Second_FlowPro_Veta_LYZ","Second_FlowPro_Veta_LYZ",iNbinsEta,dEtaMin,dEtaMax);
     fHistProVeta->SetXTitle("rapidity");
     fHistProVeta->SetYTitle("v (%)");
+    fHistList->Add(fHistProVeta);
 
     fHistProVPt = new TProfile("Second_FlowPro_VPt_LYZ","Second_FlowPro_VPt_LYZ",iNbinsPt,dPtMin,dPtMax);
     fHistProVPt->SetXTitle("Pt");
     fHistProVPt->SetYTitle("v (%)");
+    fHistList->Add(fHistProVPt);
 
     fHistProReDtheta = new TProfile("Second_FlowPro_ReDtheta_LYZ","Second_FlowPro_ReDtheta_LYZ",iNtheta, -0.5, iNtheta-0.5);
     fHistProReDtheta->SetXTitle("#theta");
     fHistProReDtheta->SetYTitle("Re(D^{#theta})");
+    fHistList->Add(fHistProReDtheta);
 
     fHistProImDtheta = new TProfile("Second_FlowPro_ImDtheta_LYZ","Second_FlowPro_ImDtheta_LYZ",iNtheta, -0.5, iNtheta-0.5);
     fHistProImDtheta->SetXTitle("#theta");
     fHistProImDtheta->SetYTitle("Im(D^{#theta})");
+    fHistList->Add(fHistProImDtheta);
 
     //class AliFlowLYZHist2 defines the histograms: 
     for (Int_t theta=0;theta<iNtheta;theta++)  {  
       fHist2[theta]=new AliFlowLYZHist2(theta);
+      //fHistList->Add(fHist2[theta]->GetHistList() );
+      fHistList->Add(fHist2[theta]->GetHistProReNumer() );
+      fHistList->Add(fHist2[theta]->GetHistProImNumer() );
+      fHistList->Add(fHist2[theta]->GetHistProReNumerPt() );
+      fHistList->Add(fHist2[theta]->GetHistProImNumerPt() );
+      //fHistList->Add(fHist2[theta]->GetHistProReNumer2D() ); //gives error in compilation 
+      //fHistList->Add(fHist2[theta]->GetHistProImNumer2D() ); //gives error in compilation
     }
       
     //read hists from first run file
@@ -183,7 +212,11 @@ Bool_t AliFlowAnalysisWithLeeYangZeros::Init()
       exit(-1);
     } else if (firstRunFile->IsOpen()){
       cout<<"----firstRunFile is open----"<<endl<<endl;
-      fHistProR0theta  = (TProfile*)firstRunFile->Get("First_FlowPro_r0theta_LYZ");
+      TList* list = (TList*)firstRunFile->Get("cobj1");
+      if (!list) {cout<<"list is NULL pointer!"<<endl;}
+      fHistProR0theta  = (TProfile*)list->FindObject("First_FlowPro_r0theta_LYZ");
+      if (!fHistProR0theta) {cout<<"fHistProR0theta has a NULL pointer!"<<endl;}
+      fHistList->Add(fHistProR0theta);
     }    
   }
    
@@ -309,10 +342,6 @@ Bool_t AliFlowAnalysisWithLeeYangZeros::Make(AliFlowEventSimple* anEvent)
 
     if (fDebug) cout<<"****histograms filled****"<<endl;  
     
-    //save histograms in file //temp for testing selector
-    fHistFile->cd();
-    fHistFile->Write();
-
     return kTRUE;
     fEventNumber =0; //set to zero for second round over events
   }  //firstrun
@@ -470,16 +499,9 @@ Bool_t AliFlowAnalysisWithLeeYangZeros::Make(AliFlowEventSimple* anEvent)
       fCommonHistsRes->FillDifferentialFlow(b, dv2pro, dErrdifcomb); 
     } //loop over bins b
  
-    
-    //save histograms in file
-    fHistFile->cd();
-    fHistFile->Write();
-    fHistFile->Close();
-    //Note that when the file is closed, all histograms and Trees in memory associated with this file are deleted
-    if (fDebug) cout<<"****Histograms saved and fHistFile closed, all histograms deleted****"<<endl;
-     
+         
     //close the first run file 
-    firstRunFile->Close();
+    //firstRunFile->Close(); //gives error when writing to TList
 
      
   } //secondrun
@@ -611,7 +633,7 @@ Bool_t AliFlowAnalysisWithLeeYangZeros::Make(AliFlowEventSimple* anEvent)
        dR0 = fHistProR0theta->GetBinContent(theta+1);
       }
       else {
-       cout <<"pointer fHistProR0Theta does not exist" << endl;
+       cout <<"pointer fHistProR0theta does not exist" << endl;
       }
       //cerr<<"dR0 = "<<dR0 <<endl;
 
index 85149b5d0baf5dc5add37c17bde94ced276db9ed..e65e651828ac988414bffaa25562ecd77c1bfb7e 100644 (file)
@@ -24,6 +24,7 @@ class TObjArray;
 class TFile;
 class TComplex;
 class TString;
+class TList;
 class Riostream;
 
 
@@ -56,10 +57,8 @@ class AliFlowAnalysisWithLeeYangZeros {
 
 
    // 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
-  
+   TList*   GetHistList() const                  { return this->fHistList ; }     // Gets output histogram list
+
    // input for second run
    void            SetFirstRunFileName(TString name)   { this->firstRunFileName = name ; } // Sets input file name
    TString  GetFirstRunFileName() const                { return this->firstRunFileName ; } // Gets output file name
@@ -94,9 +93,7 @@ class AliFlowAnalysisWithLeeYangZeros {
    Bool_t       fDoubleLoop ;       // flag for studying non flow effects
    Bool_t       fDebug ;            // flag for lyz analysis: more print statements
 
-   TString      fHistFileName;      //
-   TFile*       fHistFile;          //
-   TFile*       fSummaryFile;       //
+   TList*       fHistList;          //list to hold all output histograms  
    TString      firstRunFileName;   //
    TFile*       firstRunFile;       //
      
index 8471b93cb741777bb6aaaf5f654cfca9c9cf30c5..f4b8cb6d79de3ebacff32bb6f754d36a5050ffa0 100644 (file)
@@ -152,7 +152,7 @@ void AliFlowAnalysisWithMCEventPlane::Finish() {
      
   Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt();
     
-  TH1F* fHistPtDiff = fCommonHists->GetfHistPtDiff();
+  TH1F* fHistPtDiff = fCommonHists->GetHistPtDiff();
   Double_t dV = 0.;
   Double_t dErrV = 0.;
   Double_t dSum = 0.;
index 0f264280194debe2e76faf572cdac39cbb4cd22e..24f0c2788bf4575865f67ddb9b1c5f64c51348d9 100644 (file)
@@ -16,7 +16,7 @@
 #define AliFlowAnalysisWithScalarProduct_cxx
  
 #include "Riostream.h"  //needed as include
-#include "TFile.h"      //needed as include
+//#include "TFile.h"      //needed as include
 #include "TList.h"
 #include "TMath.h"
 #include "TProfile.h"
@@ -79,7 +79,18 @@ void AliFlowAnalysisWithScalarProduct::Init() {
   fHistList->Add(fHistProUQ);
 
   fCommonHists = new AliFlowCommonHist("SP");
-  fHistList->Add(fCommonHists->GetHistList()); 
+  //fHistList->Add(fCommonHists->GetHistList());
+  fHistList->Add(fCommonHists->GetHistMultOrig());
+  fHistList->Add(fCommonHists->GetHistMultInt());
+  fHistList->Add(fCommonHists->GetHistMultDiff());
+  fHistList->Add(fCommonHists->GetHistPtInt());
+  fHistList->Add(fCommonHists->GetHistPtDiff());
+  fHistList->Add(fCommonHists->GetHistPhiInt());
+  fHistList->Add(fCommonHists->GetHistPhiDiff());
+  fHistList->Add(fCommonHists->GetHistEtaInt());
+  fHistList->Add(fCommonHists->GetHistEtaDiff());
+  fHistList->Add(fCommonHists->GetHistProMeanPtperBin());
+  fHistList->Add(fCommonHists->GetHistQ());
   //fCommonHistsRes = new AliFlowCommonHistResults("SP");
   
   fEventNumber = 0;  //set number of events to zero    
index d60fc84ba4702275c82c73ddb0a1caa6827954d7..825f1d73cf8f07fb71c72a0cbc297a56fe171bf1 100644 (file)
@@ -34,18 +34,18 @@ class AliFlowCommonHist: public TObject {
   Double_t GetEntriesInPtBin(Int_t iBin);   //gets entries from fHistPtDiff
   Double_t GetMeanPt(Int_t iBin);           //gets the mean pt for this bin from fHistProMeanPtperBin   
 
-  TH1F*     GetfHistMultOrig()               {return fHistMultOrig;  } ;  
-  TH1F*     GetfHistMultInt()                {return fHistMultInt; } ;  
-  TH1F*     GetfHistMultDiff()               {return fHistMultDiff; } ;  
-  TH1F*     GetfHistPtInt()                  {return fHistPtInt; } ;  
-  TH1F*     GetfHistPtDiff()                 {return fHistPtDiff; } ;   
-  TH1F*     GetfHistPhiInt()                 {return fHistPhiInt; } ;  
-  TH1F*     GetfHistPhiDiff()                {return fHistPhiDiff; } ;  
-  TH1F*     GetfHistEtaInt()                 {return fHistEtaInt; } ;  
-  TH1F*     GetfHistEtaDiff()                {return fHistEtaDiff;  } ;   
-  TProfile* GetfHistProMeanPtperBin()        {return fHistProMeanPtperBin; } ;
-  TH1F*     GetfHistQ()                      {return fHistQ; } ;            
-  TList*    GetHistList()                    {return fHistList;} ;  
+  TH1F*     GetHistMultOrig()               {return fHistMultOrig;  } ;  
+  TH1F*     GetHistMultInt()                {return fHistMultInt; } ;  
+  TH1F*     GetHistMultDiff()               {return fHistMultDiff; } ;  
+  TH1F*     GetHistPtInt()                  {return fHistPtInt; } ;  
+  TH1F*     GetHistPtDiff()                 {return fHistPtDiff; } ;   
+  TH1F*     GetHistPhiInt()                 {return fHistPhiInt; } ;  
+  TH1F*     GetHistPhiDiff()                {return fHistPhiDiff; } ;  
+  TH1F*     GetHistEtaInt()                 {return fHistEtaInt; } ;  
+  TH1F*     GetHistEtaDiff()                {return fHistEtaDiff;  } ;   
+  TProfile* GetHistProMeanPtperBin()        {return fHistProMeanPtperBin; } ;
+  TH1F*     GetHistQ()                      {return fHistQ; } ;            
+  TList*    GetHistList()                   {return fHistList;} ;  
 
   virtual Double_t  Merge(TCollection *aList);  //merge function
  
index 824cab616014fc6db652b91cbe5cce7d6ef84115..7167859ae9778a66b89388678a03af19297ee813 100644 (file)
@@ -27,10 +27,10 @@ class AliFlowCommonHistResults : public TObject {
   Bool_t FillChi(Double_t aChi);                                           //fill fHistChi
 
   //make get methods here
-  TH1D*    GetfHistDiffFlow()               {return fHistDiffFlow; } ; 
-  TH1D*    GetfHistChi()                    {return fHistChi; } ;
-  TH1D*    GetfHistIntFlow()                {return fHistIntFlow; } ;
-  TList*   GetHistList()                    {return fHistList;} ;  
+  TH1D*    GetHistDiffFlow()               {return fHistDiffFlow; } ; 
+  TH1D*    GetHistChi()                    {return fHistChi; } ;
+  TH1D*    GetHistIntFlow()                {return fHistIntFlow; } ;
+  TList*   GetHistList()                   {return fHistList;} ;  
 
   virtual Double_t  Merge(TCollection *aList);  //merge function
 
index 117c586ae02d3db84f7dc59c9a9120f9e10109e7..b77415888c97692ff52f944809cab6c96d1771f1 100644 (file)
@@ -26,6 +26,7 @@
 #include "AliESDtrack.h"
 #include "AliAODEvent.h"
 #include "AliAODTrack.h"
+#include "../../CORRFW/AliCFManager.h"
 
 // AliFlowEventSimpleMaker:
 // Class to fill the AliFlowEventSimple
@@ -33,8 +34,6 @@
 // Has fill methods for TTree, AliMCEvent, AliESDEvent and AliAODEvent
 // author: N. van der Kolk (kolk@nikhef.nl)
 
-
-
 ClassImp(AliFlowEventSimpleMaker)
 //----------------------------------------------------------------------- 
 AliFlowEventSimpleMaker::AliFlowEventSimpleMaker()
@@ -207,12 +206,11 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput)
   Int_t iSelParticlesDiff = 0;
   Int_t iSelParticlesInt = 0;
 
-   
   //normal loop
   while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
     AliMCParticle* pParticle = anInput->GetTrack(itrkN);   //get input particle
     //cut on tracks
-    if (TMath::Abs(pParticle->Eta()) < 0.2)
+    if (TMath::Abs(pParticle->Eta()) < 0.9)
       {
        if(
           TMath::Abs(pParticle->Particle()->GetPdgCode()) == 211
@@ -235,7 +233,7 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput)
            iGoodTracks++;
            pEvent->TrackCollection()->Add(pTrack) ;         
          }
-         /*      else if(
+       /*        else if(
                  TMath::Abs(pParticle->Particle()->GetPdgCode()) == 211
                  )
            {
@@ -267,6 +265,70 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput)
 
 }
 
+
+//-----------------------------------------------------------------------   
+AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliMCEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
+{
+  //Fills the event from the MC kinematic information
+  
+  Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
+  cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
+  AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
+    
+  //Int_t iN = 256; //multiplicity for chi=1
+  Int_t iN = iNumberOfInputTracks;
+  Int_t iGoodTracks = 0;
+  Int_t itrkN = 0;
+  Int_t iSelParticlesDiff = 0;
+  Int_t iSelParticlesInt = 0;
+
+   
+  //normal loop
+  while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
+    //get input particle
+    AliMCParticle* pParticle = anInput->GetTrack(itrkN);   
+    //make new AliFlowTrackSimple
+    AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
+    pTrack->SetPt(pParticle->Pt() );
+    pTrack->SetEta(pParticle->Eta() );
+    pTrack->SetPhi(pParticle->Phi() );
+
+    //check if pParticle passes the cuts
+    if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle)) {
+      pTrack->SetForIntegratedFlow(kTRUE);
+      //cout<<"integrated selection. PID = "<<pParticle->Particle()->GetPdgCode()<<endl; 
+    }
+    if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle)) {
+      pTrack->SetForDifferentialFlow(kTRUE);
+      //cout<<"differential selection. PID = "<<pParticle->Particle()->GetPdgCode()<<endl; 
+    }
+
+    //check if any bits are set
+    TBits bFlowBits = pTrack->GetFlowBits();
+    if (bFlowBits.CountBits() != 0) {
+      //cout<<"The number of bits set = "<<bFlowBits.CountBits()<<endl;
+      pEvent->TrackCollection()->Add(pTrack) ; 
+      iGoodTracks++;
+
+      if (pTrack->UseForIntegratedFlow())
+       { iSelParticlesInt++; }
+      if (pTrack->UseForDifferentialFlow())
+       { iSelParticlesDiff++; }
+    }
+    
+    itrkN++; 
+  }
+  
+  pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);  
+  pEvent-> SetNumberOfTracks(iGoodTracks);
+  cout<<" iGoodTracks = "<<iGoodTracks<<endl;
+  cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
+  return pEvent;
+
+}
+
+
 //-----------------------------------------------------------------------   
 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput)
 {
@@ -289,7 +351,7 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput)
   while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
     AliESDtrack* pParticle = anInput->GetTrack(itrkN);   //get input particle
     //cut on tracks
-    if (TMath::Abs(pParticle->Eta()) < 0.2)
+    if (TMath::Abs(pParticle->Eta()) < 0.9)
       {
        AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
        pTrack->SetPt(pParticle->Pt() );
@@ -319,6 +381,63 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput)
 }
 
 
+//-----------------------------------------------------------------------   
+AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager)
+{
+  //Fills the event from the ESD
+  
+  Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
+  cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
+  
+  AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
+    
+  //Int_t iN = 256; //multiplicity for chi=1
+  Int_t iN = iNumberOfInputTracks;
+  Int_t iGoodTracks = 0;
+  Int_t itrkN = 0;
+  Int_t iSelParticlesDiff = 0;
+  Int_t iSelParticlesInt = 0;
+
+
+  //normal loop
+  while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
+    AliESDtrack* pParticle = anInput->GetTrack(itrkN);   //get input particle
+    //make new AliFLowTrackSimple
+    AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
+    pTrack->SetPt(pParticle->Pt() );
+    pTrack->SetEta(pParticle->Eta() );
+    pTrack->SetPhi(pParticle->Phi() );
+    //check if pParticle passes the cuts
+
+    if (intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {
+      pTrack->SetForIntegratedFlow(kTRUE);
+    }
+    if (diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
+      pTrack->SetForDifferentialFlow(kTRUE);}
+
+    //check if any bits are set
+    TBits bFlowBits = pTrack->GetFlowBits();
+    if (bFlowBits.CountBits() !=0) {
+      pEvent->TrackCollection()->Add(pTrack) ;  
+      iGoodTracks++;
+
+      if (pTrack->UseForIntegratedFlow())
+       { iSelParticlesInt++; }
+      if (pTrack->UseForDifferentialFlow())
+       { iSelParticlesDiff++; }
+      
+    }
+    itrkN++; 
+  }
+  
+  pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);  
+  pEvent->SetNumberOfTracks(iGoodTracks);
+  cout<<" iGoodTracks = "<<iGoodTracks<<endl;
+  cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
+  return pEvent;
+
+
+}
 
 //-----------------------------------------------------------------------   
 AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput)
@@ -336,13 +455,12 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput)
   Int_t itrkN = 0;
   Int_t iSelParticlesDiff = 0;
   Int_t iSelParticlesInt = 0;
-
   
   //normal loop
   while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
     AliAODTrack* pParticle = anInput->GetTrack(itrkN);   //get input particle
     //cut on tracks
-    if (TMath::Abs(pParticle->Eta()) < 0.2)
+    if (TMath::Abs(pParticle->Eta()) < 0.9)
       {
        AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
        pTrack->SetPt(pParticle->Pt() );
@@ -369,6 +487,65 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput)
   return pEvent;
   
 }
+
+
+//-----------------------------------------------------------------------   
+AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(AliAODEvent* anInput,  AliCFManager* intCFManager, AliCFManager* diffCFManager)
+{
+  //Fills the event from the AOD
+  
+  Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
+  cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
+  
+  AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
+    
+  //Int_t iN = 256; //multiplicity for chi=1
+  Int_t iN = iNumberOfInputTracks;
+  Int_t iGoodTracks = 0;
+  Int_t itrkN = 0;
+  Int_t iSelParticlesDiff = 0;
+  Int_t iSelParticlesInt = 0;
+
+  
+  //normal loop
+  while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
+    AliAODTrack* pParticle = anInput->GetTrack(itrkN);   //get input particle
+    //make new AliFlowTrackSimple
+    AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
+    pTrack->SetPt(pParticle->Pt() );
+    pTrack->SetEta(pParticle->Eta() );
+    pTrack->SetPhi(pParticle->Phi() );
+
+    //check if pParticle passes the cuts
+    if (intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {          //check these cuts!!
+      pTrack->SetForIntegratedFlow(kTRUE); }
+    if (diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle)) {
+      pTrack->SetForDifferentialFlow(kTRUE);}  
+
+    //check if any bits are set
+    TBits bFlowBits = pTrack->GetFlowBits();
+    if (bFlowBits.CountBits() !=0) {
+      pEvent->TrackCollection()->Add(pTrack) ; 
+      iGoodTracks++;
+
+      if (pTrack->UseForIntegratedFlow())
+       { iSelParticlesInt++; }
+      if (pTrack->UseForDifferentialFlow())
+       { iSelParticlesDiff++; }
+            
+    }
+      
+    itrkN++; 
+  }
+  
+  pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);  
+  pEvent->SetNumberOfTracks(iGoodTracks);
+  cout<<" iGoodTracks = "<<iGoodTracks<<endl;
+  cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
+  return pEvent;
+  
+}
+
 //-----------------------------------------------------------------------   
 AliFlowEventSimple*  AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)
 {
@@ -448,9 +625,105 @@ AliFlowEventSimple*  AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, A
 
 }
 
+//-----------------------------------------------------------------------   
+AliFlowEventSimple*  AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, AliCFManager* intCFManager, AliCFManager* diffCFManager, Int_t anOption)
+{
+  //fills the event with tracks from the ESD and kinematics from the MC info via the track label
 
+  ///////////////////////////////////////////////////
+  //
+  //   WARNING: this method is not correct yet!
+  //   The PID cut has to be implemented correctly
+  //   24/06/08
+  //
+  //////////////////////////////////////////////////
 
-/*
-$Log$
-*/ 
+  if (!(anOption ==0 || anOption ==1)) {
+    cout<<"WRONG OPTION IN AliFlowEventSimpleMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption)"<<endl;
+    exit(1);
+  }
 
+  Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
+  cerr<<"anInput->GetNumberOfTracks() = "<<iNumberOfInputTracks<<endl;
+  
+  AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
+    
+  //Int_t iN = 256; //multiplicity for chi=1
+  Int_t iN = iNumberOfInputTracks;
+  Int_t iGoodTracks = 0;
+  Int_t itrkN = 0;
+  Int_t iSelParticlesDiff = 0;
+  Int_t iSelParticlesInt = 0;
+
+  //normal loop
+  while (iGoodTracks < iN && itrkN < iNumberOfInputTracks) {
+    AliESDtrack* pParticle = anInput->GetTrack(itrkN);   //get input particle
+    //get Label
+    Int_t iLabel = pParticle->GetLabel();
+    //match to mc particle
+    AliMCParticle* pMcParticle = anInputMc->GetTrack(TMath::Abs(iLabel));
+    
+    //check
+    if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label()) cout<<"pParticle->GetLabel()!=pMcParticle->Label() "<<pParticle->GetLabel()<<"  "<<pMcParticle->Label()<<endl;
+    
+    //make new AliFlowTrackSimple
+    AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
+    if(anOption == 0) { //take the PID from the MC & the kinematics from the ESD
+      pTrack->SetPt(pParticle->Pt() );
+      pTrack->SetEta(pParticle->Eta() );
+      pTrack->SetPhi(pParticle->Phi() );
+    }
+    else if (anOption == 1) { //take the PID and kinematics from the MC
+      pTrack->SetPt(pMcParticle->Pt() );
+      pTrack->SetEta(pMcParticle->Eta() );
+      pTrack->SetPhi(pMcParticle->Phi() );
+    }
+    else { cout<<"Not a valid option"<<endl; }
+
+    //check if pParticle passes the cuts
+    if(anOption == 0) { 
+      //cout<<"take the PID from the MC & the kinematics from the ESD"<<endl;
+      if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts1") && 
+         intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {  //????which cuts to use on which particle
+       pTrack->SetForIntegratedFlow(kTRUE); }
+      if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts2") &&
+         diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle)) {  //????which cuts to use on which particle
+       pTrack->SetForDifferentialFlow(kTRUE);}
+    }
+    else if (anOption == 1) { 
+      //cout<<"take the PID and kinematics from the MC"<<endl;
+      if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle)) {  
+       pTrack->SetForIntegratedFlow(kTRUE); }
+      if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle)) {  
+       pTrack->SetForDifferentialFlow(kTRUE);}
+    }
+    else { cout<<"Not a valid option"<<endl; }
+      
+    //check if any bits are set
+    TBits bFlowBits = pTrack->GetFlowBits();
+    if (bFlowBits.CountBits() !=0) {
+      pEvent->TrackCollection()->Add(pTrack) ; 
+      iGoodTracks++;  
+    
+      if (pTrack->UseForIntegratedFlow())
+       { iSelParticlesInt++; }
+      if (pTrack->UseForDifferentialFlow())
+       { iSelParticlesDiff++; }
+            
+    }
+    itrkN++; 
+  }
+  
+  pEvent-> SetEventNSelTracksIntFlow(iSelParticlesInt);  
+  pEvent->SetNumberOfTracks(iGoodTracks);
+  cout<<" iGoodTracks = "<<iGoodTracks<<endl;
+  cout << "  iSelectedTracksInt = " << iSelParticlesInt << endl;  
+  return pEvent;
+
+}
+
+
+
+
+
index 0000127bb8b573fe806a583b14707195273a71ae..a0518d2dc3b481626b2e7de4977fe7d52964e1ff 100644 (file)
@@ -9,6 +9,9 @@
 #include "AliFlowEventSimple.h"  //needed as include
 //class AliFlowEventSimple; //does not compile
 
+#include "../../CORRFW/AliCFManager.h"
+//class AliCFManager;
+
 class TTree;
 class AliMCEvent;
 class AliESDEvent;
@@ -26,13 +29,22 @@ class AliFlowEventSimpleMaker {
   AliFlowEventSimpleMaker();             //constructor
   virtual  ~AliFlowEventSimpleMaker();   //destructor
   
-  AliFlowEventSimple* FillTracks(TTree* anInput);
-  AliFlowEventSimple* FillTracks(AliMCEvent* anInput);
-  AliFlowEventSimple* FillTracks(AliESDEvent* anInput);
-  AliFlowEventSimple* FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption);
+  //TTree
+  AliFlowEventSimple* FillTracks(TTree* anInput);   //use own cuts
+  //AliMCEvent
+  AliFlowEventSimple* FillTracks(AliMCEvent* anInput);   //use own cuts
+  AliFlowEventSimple* FillTracks(AliMCEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager ); //use CF(2x)
+  //AliESDEvent
+  AliFlowEventSimple* FillTracks(AliESDEvent* anInput);   //use own cuts
+  AliFlowEventSimple* FillTracks(AliESDEvent* anInput,  AliCFManager* intCFManager, AliCFManager* diffCFManager); //use CF(2x)
+  //AliESDEvent & AliMCEvent
+  AliFlowEventSimple* FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, Int_t anOption);  //use own cuts
+  AliFlowEventSimple* FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, AliCFManager* intCFManager, AliCFManager* diffCFManager, Int_t anOption);  //use CF(2x)
   // anOption = 0 : kine from ESD
   // anOption = 1 : kine from MC
-  AliFlowEventSimple* FillTracks(AliAODEvent* anInput);
+  //AliAODEvent
+  AliFlowEventSimple* FillTracks(AliAODEvent* anInput); //use own cuts
+  AliFlowEventSimple* FillTracks(AliAODEvent* anInput, AliCFManager* intCFManager, AliCFManager* diffCFManager);  //use CF(2x)
     
  private:
   AliFlowEventSimpleMaker(const AliFlowEventSimpleMaker& anAnalysis);            //copy constructor
index daca90500c1005a9830318ac97d17bfc471ee5fe..5024b6bdb7209d1c2802ef64e789a0cc6b136406 100644 (file)
@@ -33,7 +33,11 @@ class AliFlowLYZHist1: public TObject  {
   Double_t GetR0();                           //get R0
   Double_t GetBinCenter(Int_t i);             //Get a bincentre of fHistGtheta
   Int_t GetNBins();                           //Gets Nbins
-  TList*    GetHistList()  {return fHistList;} ;  
+
+  TH1D*     GetHistGtheta()  {return this->fHistGtheta;} ;
+  TProfile* GetHistProReGtheta() {return this->fHistProReGtheta;} ;
+  TProfile* GetHistProImGtheta() {return this->fHistProImGtheta;} ;
+  TList*    GetHistList()    {return this->fHistList;} ;  
 
   virtual Double_t  Merge(TCollection *aList);  //merge function
    
index 1e71db86e7969fac4e0799471b71fa9975fc93d7..9cf67f38d03f8ce94a46ae48d95aa27197a8c944 100644 (file)
@@ -38,8 +38,14 @@ class AliFlowLYZHist2: public TObject  {
     {Double_t dPt = fHistProReNumerPt->GetXaxis()->GetBinCenter(i); return dPt;}
   TComplex GetNumerEta(Int_t i);                   //get numerator for diff. flow (eta)
   TComplex GetNumerPt(Int_t i);                    //get numerator for diff. flow (pt)
-  TList*   GetHistList()   
-    {return fHistList;}   
+
+  TProfile*   GetHistProReNumer()   {return this->fHistProReNumer;}         
+  TProfile*   GetHistProImNumer()   {return this->fHistProImNumer;}        
+  TProfile*   GetHistProReNumerPt() {return this->fHistProReNumerPt;} 
+  TProfile*   GetHistProImNumerPt() {return this->fHistProImNumerPt;} 
+  TProfile2D* GetHistProReNumer2D() {return this->fHistProReNumer2D;}       
+  TProfile2D* GetHistProImNumer2D() {return this->fHistProImNumer2D;}
+  TList*      GetHistList()         {return this->fHistList;}   
   
   virtual Double_t Merge(TCollection *aList);  //merge function
  
index b1f9573b2c78d6e4e5fd8825767745f23825541c..70665436b96e843de8599e6ab0106918ffdbe440 100644 (file)
@@ -22,8 +22,9 @@ class AliFlowTrackSimple: public TObject {
   Double_t Eta() const; 
   Double_t Pt()  const; 
   Double_t Phi() const; 
-  Bool_t UseForIntegratedFlow() const;
-  Bool_t UseForDifferentialFlow() const;
+  TBits    GetFlowBits() const;
+  Bool_t   UseForIntegratedFlow() const;
+  Bool_t   UseForDifferentialFlow() const;
   
   void SetEta(Double_t eta);
   void SetPt(Double_t pt); 
@@ -43,16 +44,18 @@ class AliFlowTrackSimple: public TObject {
 };
 
 inline Double_t AliFlowTrackSimple::Eta() const { 
-  return fEta; }
+  return this->fEta; }
 inline Double_t AliFlowTrackSimple::Pt() const {  
   //  cout << "Returned pt:" << fPt << endl; 
-  return fPt;}
+  return this->fPt;}
 inline Double_t AliFlowTrackSimple::Phi() const { 
-  return fPhi; }
+  return this->fPhi; }
+inline TBits AliFlowTrackSimple::GetFlowBits() const { 
+  return this->fFlowBits; }
 inline Bool_t AliFlowTrackSimple::UseForIntegratedFlow() const { 
-  return fFlowBits.TestBitNumber(0); }
+  return this->fFlowBits.TestBitNumber(0); }
 inline Bool_t AliFlowTrackSimple::UseForDifferentialFlow() const { 
-  return fFlowBits.TestBitNumber(1); }
+  return this->fFlowBits.TestBitNumber(1); }
 
 inline void AliFlowTrackSimple::SetEta(Double_t val) {
   fEta = val; }
index 5573db79b50526e462f70c063d7747e1bbe48ad0..e4db58e640076c18b0d0fd95993070c911b88969 100644 (file)
 TChain* CreateESDChain(const char* aDataDir = "ESDfiles.txt", Int_t aRuns = 20, Int_t offset = 0) ;
 void LookupWrite(TChain* chain, const char* target) ;
 
+//SETTING THE ANALYSIS
 
+//Flow analysis method can be:
+// SP    = Scalar Product
+// LYZ1  = Lee Yang Zeroes first run
+// LYZ2  = Lee Yang Zeroes second run
+// LYZEP = Lee Yang Zeroes Event Plane
+// CUM   = Cumulants
+const TString method = "SP";
+
+//Type of analysis can be:
+// ESD, AOD, MC, ESDMC0, ESDMC1
+const TString type = "ESDMC1";
+
+
+//SETTING THE CUTS
+
+//for integrated flow
+const Double_t ptmin1 = 0.0;
+const Double_t ptmax1 = 1000.0;
+const Double_t ymin1  = -2.;
+const Double_t ymax1  = 2.;
+const Int_t mintrackrefsTPC1 = 2;
+const Int_t mintrackrefsITS1 = 3;
+const Int_t charge1 = 1;
+const Int_t PDG1 = 211;
+const Int_t minclustersTPC1 = 50;
+const Int_t maxnsigmatovertex1 = 3;
+
+//for differential flow
+const Double_t ptmin2 = 0.0;
+const Double_t ptmax2 = 1000.0;
+const Double_t ymin2  = -2.;
+const Double_t ymax2  = 2.;
+const Int_t mintrackrefsTPC2 = 2;
+const Int_t mintrackrefsITS2 = 3;
+const Int_t charge2 = 1;
+const Int_t PDG2 = 321;
+const Int_t minclustersTPC2 = 50;
+const Int_t maxnsigmatovertex2 = 3;
+
+
+
+void runAliAnalysisTaskFlow(Int_t nRuns = 10, const Char_t* dataDir="/data/alice1/kolk/TherminatorFIX", Int_t offset = 0) 
 
-void runAliAnalysisTaskFlow(Int_t nRuns = 2, TString type = "ESD", Bool_t firstrun = kTRUE, Bool_t usesum = kTRUE, 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("libANALYSISRL.so");
+  cerr<<"libANALYSISRL.so loaded..."<<endl;
+  gSystem->Load("libCORRFW.so");
+  cerr<<"libCORRFW.so loaded..."<<endl;
   gSystem->Load("libPWG2flow.so");
-  
+  cerr<<"libPWG2flow.so loaded..."<<endl;
+
   // create the TChain. CreateESDChain() is defined in CreateESDChain.C
   TChain* chain = CreateESDChain(dataDir, nRuns, offset);
   cout<<"chain ("<<chain<<")"<<endl;
+  //____________________________________________//
+  //Create cuts using correction framework
+
+  //############# cuts on MC
+  AliCFTrackKineCuts* mcKineCuts1 = new AliCFTrackKineCuts("mcKineCuts1","MC-level kinematic cuts");
+  mcKineCuts1->SetPtRange(ptmin1,ptmax1);
+  mcKineCuts1->SetRapidityRange(ymin1,ymax1);
+  mcKineCuts1->SetChargeMC(charge1);
+  
+  AliCFTrackKineCuts* mcKineCuts2 = new AliCFTrackKineCuts("mcKineCuts2","MC-level kinematic cuts");
+  mcKineCuts2->SetPtRange(ptmin2,ptmax2);
+  mcKineCuts2->SetRapidityRange(ymin2,ymax2);
+  mcKineCuts2->SetChargeMC(charge2);
+
+  AliCFParticleGenCuts* mcGenCuts1 = new AliCFParticleGenCuts("mcGenCuts1","MC particle generation cuts");
+  mcGenCuts1->SetRequireIsPrimary();
+  mcGenCuts1->SetRequirePdgCode(PDG1);
+
+  AliCFParticleGenCuts* mcGenCuts2 = new AliCFParticleGenCuts("mcGenCuts2","MC particle generation cuts");
+  mcGenCuts2->SetRequireIsPrimary();
+  mcGenCuts2->SetRequirePdgCode(PDG2);
+
+  //############# Acceptance Cuts  ????????
+  AliCFAcceptanceCuts *mcAccCuts = new AliCFAcceptanceCuts("mcAccCuts","MC acceptance cuts");
+  mcAccCuts->SetMinNHitITS(mintrackrefsITS1);
+  mcAccCuts->SetMinNHitTPC(mintrackrefsTPC1);
+  
+  //############# Rec-Level kinematic cuts
+  AliCFTrackKineCuts *recKineCuts1 = new AliCFTrackKineCuts("recKineCuts1","rec-level kine cuts");
+  recKineCuts1->SetPtRange(ptmin1,ptmax1);
+  recKineCuts1->SetRapidityRange(ymin1,ymax1);
+  recKineCuts1->SetChargeRec(charge1);
+
+  AliCFTrackKineCuts *recKineCuts2 = new AliCFTrackKineCuts("recKineCuts2","rec-level kine cuts");
+  recKineCuts2->SetPtRange(ptmin2,ptmax2);
+  recKineCuts2->SetRapidityRange(ymin2,ymax2);
+  recKineCuts2->SetChargeRec(charge2);
+
+  AliCFTrackQualityCuts *recQualityCuts = new AliCFTrackQualityCuts("recQualityCuts","rec-level quality cuts");
+  recQualityCuts->SetMinNClusterTPC(minclustersTPC1);
+  recQualityCuts->SetRequireITSRefit(kTRUE);
+
+  AliCFTrackIsPrimaryCuts *recIsPrimaryCuts = new AliCFTrackIsPrimaryCuts("recIsPrimaryCuts","rec-level isPrimary cuts");
+  recIsPrimaryCuts->SetMaxNSigmaToVertex(maxnsigmatovertex1);
+  
+  AliCFTrackCutPid* cutPID1 = new AliCFTrackCutPid("cutPID1","ESD_PID") ;
+  AliCFTrackCutPid* cutPID2 = new AliCFTrackCutPid("cutPID2","ESD_PID") ;
+  int n_species = AliPID::kSPECIES ;
+  Double_t* prior = new Double_t[n_species];
+
+  prior[0] = 0.0244519 ;
+  prior[1] = 0.0143988 ;
+  prior[2] = 0.805747  ;
+  prior[3] = 0.0928785 ;
+  prior[4] = 0.0625243 ;
+  
+  cutPID1->SetPriors(prior);
+  cutPID1->SetProbabilityCut(0.0);
+  cutPID1->SetDetectors("TPC TOF");
+  switch(TMath::Abs(PDG1)) {
+  case 11   : cutPID1->SetParticleType(AliPID::kElectron, kTRUE); break;
+  case 13   : cutPID1->SetParticleType(AliPID::kMuon    , kTRUE); break;
+  case 211  : cutPID1->SetParticleType(AliPID::kPion    , kTRUE); break;
+  case 321  : cutPID1->SetParticleType(AliPID::kKaon    , kTRUE); break;
+  case 2212 : cutPID1->SetParticleType(AliPID::kProton  , kTRUE); break;
+  default   : printf("UNDEFINED PID\n"); break;
+  }
+
+  cutPID2->SetPriors(prior);
+  cutPID2->SetProbabilityCut(0.0);
+  cutPID2->SetDetectors("TPC TOF");
+  switch(TMath::Abs(PDG2)) {
+  case 11   : cutPID2->SetParticleType(AliPID::kElectron, kTRUE); break;
+  case 13   : cutPID2->SetParticleType(AliPID::kMuon    , kTRUE); break;
+  case 211  : cutPID2->SetParticleType(AliPID::kPion    , kTRUE); break;
+  case 321  : cutPID2->SetParticleType(AliPID::kKaon    , kTRUE); break;
+  case 2212 : cutPID2->SetParticleType(AliPID::kProton  , kTRUE); break;
+  default   : printf("UNDEFINED PID\n"); break;
+  }
+
+
+  printf("CREATE MC KINE CUTS\n");
+  TObjArray* mcList1 = new TObjArray(0);
+  mcList1->AddLast(mcKineCuts1);
+  mcList1->AddLast(mcGenCuts1);
+  
+  TObjArray* mcList2 = new TObjArray(0);
+  mcList2->AddLast(mcKineCuts2);
+  mcList2->AddLast(mcGenCuts2);
+
+  printf("CREATE ACCEPTANCE CUTS\n");
+  TObjArray* accList = new TObjArray(0) ;
+  accList->AddLast(mcAccCuts);
+
+  printf("CREATE RECONSTRUCTION CUTS\n");
+  TObjArray* recList1 = new TObjArray(0) ;
+  recList1->AddLast(recKineCuts1);
+  recList1->AddLast(recQualityCuts);
+  recList1->AddLast(recIsPrimaryCuts);
+
+  TObjArray* recList2 = new TObjArray(0) ;
+  recList2->AddLast(recKineCuts2);
+  recList2->AddLast(recQualityCuts);
+  recList2->AddLast(recIsPrimaryCuts);
+
+  printf("CREATE PID CUTS\n");
+  TObjArray* fPIDCutList1 = new TObjArray(0) ;
+  fPIDCutList1->AddLast(cutPID1);
+
+  TObjArray* fPIDCutList2 = new TObjArray(0) ;
+  fPIDCutList2->AddLast(cutPID2);
 
-  //----------------------------------------------------
-  //-----------------standard Lee Yang Zeros------------
-  if (!firstrun){
-    // read the input files
-    TString firstRunFileName = "outputFromLeeYangZerosAnalysis" ;
+  printf("CREATE INTERFACE AND CUTS\n");
+  AliCFManager* cfmgr1 = new AliCFManager();
+  cfmgr1->SetParticleCutsList(AliCFManager::kPartGenCuts,mcList1);
+  //cfmgr1->SetParticleCutsList(AliCFManager::kPartAccCuts,accList);
+  cfmgr1->SetParticleCutsList(AliCFManager::kPartRecCuts,recList1);
+  cfmgr1->SetParticleCutsList(AliCFManager::kPartSelCuts,fPIDCutList1);
+
+  AliCFManager* cfmgr2 = new AliCFManager();
+  cfmgr2->SetParticleCutsList(AliCFManager::kPartGenCuts,mcList2);
+  //cfmgr2->SetParticleCutsList(AliCFManager::kPartAccCuts,accList);
+  cfmgr2->SetParticleCutsList(AliCFManager::kPartRecCuts,recList2);
+  cfmgr2->SetParticleCutsList(AliCFManager::kPartSelCuts,fPIDCutList2);
+
+  if (method == "LYZ2"){  
+    // read the input files from the first run 
+    TString firstRunFileName = "outputLYZ1analysis" ;
     firstRunFileName += type;
     firstRunFileName += "_firstrun.root";
+    cout<<"The input file is "<<firstRunFileName.Data()<<endl;
     TFile* fFirstRunFile = new TFile(firstRunFileName.Data(),"READ");
     if(!fFirstRunFile || fFirstRunFile->IsZombie()) { cerr << " ERROR: NO First Run file... " << endl ; }
     cout<<"input files read..."<<endl;
   }
 
-  //----------------------------------------------------
-  //-----------------Lee Yang Zeros Event Plane---------
-  /*
-  // read the input files
-  TString firstRunFileName = "outputFromLeeYangZerosAnalysis" ;
-  firstRunFileName += type;
-  firstRunFileName += "_firstrun.root";
-  TFile* fFirstRunFile = new TFile(firstRunFileName.Data(),"READ");
-  if(!fFirstRunFile || fFirstRunFile->IsZombie()) { cerr << " ERROR: NO First Run file... " << endl ; }
-  TString secondRunFileName = "outputFromLeeYangZerosAnalysis" ;
-  secondRunFileName += type;
-  secondRunFileName += "_secondrun.root";
-  TFile* fSecondRunFile = new TFile(secondRunFileName.Data(),"READ");
-  if(!fSecondRunFile || fSecondRunFile->IsZombie()) { cerr << " ERROR: NO Second Run file... " << endl ; }
-  cout<<"input files read..."<<endl;
-  */
-
-  //----------------------------------------------------
-  //-----------------Monte Carlo Event Plane------------
-  //no extra input files
-
 
   //____________________________________________//
   // Make the analysis manager
-  AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
-  AliVEventHandler* esdH = new AliESDInputHandler;
-  mgr->SetInputEventHandler(esdH);  
-  AliVEventHandler* aodH = new AliAODInputHandler;
-  mgr->SetInputEventHandler(aodH); 
-  AliMCEventHandler *mc = new AliMCEventHandler();
-  mgr->SetMCtruthEventHandler(mc);
-  //____________________________________________//
-  //----------------------------------------------------
-  //-----------------standard Lee Yang Zeros------------
-  // 1st LYZ task
-  AliAnalysisTaskLeeYangZeros *task1 = new AliAnalysisTaskLeeYangZeros("TaskLeeYangZeros", firstrun);
-  task1->SetAnalysisType(type);
-  task1->SetFirstRunLYZ(firstrun);            //set to first or second run
-  task1->SetUseSumLYZ(usesum);                //set to sum gen.function or product gen.function
-  mgr->AddTask(task1);
+  AliAnalysisManager *mgr = new AliAnalysisManager("FlowAnalysisManager");
+  
+  if (type == "ESD"){
+    AliVEventHandler* esdH = new AliESDInputHandler;
+    mgr->SetInputEventHandler(esdH); }
+   
+  if (type == "AOD"){
+    AliVEventHandler* aodH = new AliAODInputHandler;
+    mgr->SetInputEventHandler(aodH); }
+  
+  if (type == "MC" || type == "ESDMC0" || type == "ESDMC1"){
+    AliVEventHandler* esdH = new AliESDInputHandler;
+    mgr->SetInputEventHandler(esdH);
 
-  // Create containers for input/output
-  AliAnalysisDataContainer *cinput1 = 
-    mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
-  if (!firstrun){ AliAnalysisDataContainer *cinput2 = 
-                   mgr->CreateContainer("cobj2",TList::Class(),AliAnalysisManager::kInputContainer); } 
-  AliAnalysisDataContainer *coutput1 = 
-    mgr->CreateContainer("cobj1", TList::Class(),AliAnalysisManager::kOutputContainer);
+    AliMCEventHandler *mc = new AliMCEventHandler();
+    mgr->SetMCtruthEventHandler(mc); }
+
+  //____________________________________________//
+  // 1st MC EP task
+  if (method == "SP"){
+    AliAnalysisTaskScalarProduct *task1 = new AliAnalysisTaskScalarProduct("TaskScalarProduct");
+    task1->SetAnalysisType(type);
+    task1->SetCFManager1(cfmgr1);
+    task1->SetCFManager2(cfmgr2);
+    mgr->AddTask(task1);
+  }
+  else if (method == "LYZ1"){
+    AliAnalysisTaskLeeYangZeros *task1 = new AliAnalysisTaskLeeYangZeros("TaskLeeYangZeros",kTRUE);
+    task1->SetAnalysisType(type);
+    task1->SetFirstRunLYZ(kTRUE);
+    task1->SetUseSumLYZ(kTRUE);
+    task1->SetCFManager1(cfmgr1);
+    task1->SetCFManager2(cfmgr2);
+    mgr->AddTask(task1);
+  }
+  else if (method == "LYZ2"){
+    AliAnalysisTaskLeeYangZeros *task1 = new AliAnalysisTaskLeeYangZeros("TaskLeeYangZeros",kFALSE);
+    task1->SetAnalysisType(type);
+    task1->SetFirstRunLYZ(kFALSE);
+    task1->SetUseSumLYZ(kTRUE);
+    task1->SetCFManager1(cfmgr1);
+    task1->SetCFManager2(cfmgr2);
+    mgr->AddTask(task1);
+  }
+  else if (method == "LYZEP"){
+    AliAnalysisTaskLYZEventPlane *task1 = new AliAnalysisTaskLYZEventPlane("TaskLYZEventPlane");
+    task1->SetAnalysisType(type);
+    //task1->SetCFManager1(cfmgr1);
+    //task1->SetCFManager2(cfmgr2);
+    mgr->AddTask(task1);
+  }
+  else if (method == "CUM"){
+    AliAnalysisTaskCumulants *task1 = new AliAnalysisTaskCumulants("TaskCumulants");
+    task1->SetAnalysisType(type);
+    //task1->SetCFManager1(cfmgr1);
+    //task1->SetCFManager2(cfmgr2);
+    mgr->AddTask(task1);
+  }
 
-  //----------------------------------------------------
-  //-----------------Lee Yang Zeros Event Plane---------
-  /*
-  // 1st LYZ EP task
-  AliAnalysisTaskLYZEventPlane *task1 = new AliAnalysisTaskLYZEventPlane("TaskLYZEventPlane");
-  task1->SetAnalysisType(type);
-  mgr->AddTask(task1);
 
   // Create containers for input/output
   AliAnalysisDataContainer *cinput1 = 
     mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
-  AliAnalysisDataContainer *cinput2 = 
-    mgr->CreateContainer("cobj2",TList::Class(),AliAnalysisManager::kInputContainer);
-  AliAnalysisDataContainer *cinput3 = 
-    mgr->CreateContainer("cobj3",TList::Class(),AliAnalysisManager::kInputContainer);
-  AliAnalysisDataContainer *coutput1 = 
-    mgr->CreateContainer("cobj1", TList::Class(),AliAnalysisManager::kOutputContainer);
-  */
 
-  //----------------------------------------------------
-  //-----------------Monte Carlo Event Plane------------
-  /*
-  // 1st MC EP task
-  AliAnalysisTaskMCEventPlane *task1 = new AliAnalysisTaskMCEventPlane("TaskMCEventPlane");
-  task1->SetAnalysisType(type);
-  mgr->AddTask(task1);
+  if (method == "LYZ2"){ AliAnalysisDataContainer *cinput2 = 
+                   mgr->CreateContainer("cobj2",TList::Class(),AliAnalysisManager::kInputContainer); } 
 
-  // Create containers for input/output
-  AliAnalysisDataContainer *cinput1 = 
-    mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
+
+  TString outputName = "output";
+  outputName+= method;
+  outputName+= "analysis";
+  outputName+= type;
+  if (method == "LYZ1") outputName+= "_firstrun";
+  if (method == "LYZ2") outputName+= "_secondrun";
+  outputName+= ".root";
   AliAnalysisDataContainer *coutput1 = 
-    mgr->CreateContainer("cobj1", TList::Class(),AliAnalysisManager::kOutputContainer);
-  */
+    mgr->CreateContainer("cobj1", TList::Class(),AliAnalysisManager::kOutputContainer,outputName);
 
   //____________________________________________//
-  //----------------------------------------------------
-  //-----------------standard Lee Yang Zeros------------
   mgr->ConnectInput(task1,0,cinput1);
-  if (!firstrun) { mgr->ConnectInput(task1,1,cinput2); }
+  if (method == "LYZ2") { mgr->ConnectInput(task1,1,cinput2); }
   mgr->ConnectOutput(task1,0,coutput1);
 
-  if (!firstrun){ cinput2->SetData(fFirstRunFile);}
-
-  //----------------------------------------------------
-  //-----------------Lee Yang Zeros Event Plane---------
-  /*
-  mgr->ConnectInput(task1,0,cinput1);
-  mgr->ConnectInput(task1,1,cinput2);
-  mgr->ConnectInput(task1,2,cinput3);
-  mgr->ConnectOutput(task1,0,coutput1);
-
-  cinput2->SetData(fFirstRunFile);
-  cinput3->SetData(fSecondRunFile);
-  */
-
-  //----------------------------------------------------
-  //-----------------Monte Carlo Event Plane------------
-  /*
-  mgr->ConnectInput(task1,0,cinput1);
-  mgr->ConnectOutput(task1,0,coutput1);
-  */
+  if (method == "LYZ2"){ cinput2->SetData(fFirstRunFile);}
 
   if (!mgr->InitAnalysis()) return;
   mgr->PrintStatus();
@@ -263,4 +416,3 @@ void LookupWrite(TChain* chain, const char* target)
   
   delete iter;
 }
-